akhauriyash/Code-Regression huggingface dataset:
#include <algorithm>
#include <cstdio>
#include <ctype.h>
#define DEBUG
const int bufSize = 1e6;
inline char nc()
{
#ifdef DEBUG
    return getchar();
#endif
    static char buf[bufSize], *p1 = buf, *p2 = buf;
    return p1 == p2 && (p2 = (p1 = buf) + fread(buf, 1, bufSize, stdin), p1 == p2) ? EOF : *p1++;
}
inline void read(char* s)
{
    static char c;
    for (; !isalpha(c); c = nc());
    for (; isalpha(c); c = nc()) *s++ = c;
    *s = '\0';
}
template <typename T>
inline T read(T& r)
{
    static char c;
    static int flag;
    flag = 1, r = 0;
    for (c = nc(); !isdigit(c); c = nc()) if (c == '-') flag = -1;
    for (; isdigit(c); c = nc()) r = r * 10 + c - 48;
    return r *= flag;
}
const int maxn = 3100;
int n, m, num;
int a[maxn][maxn];
long long f[2][maxn][4], g[2][maxn];
int main()
{
    read(n), read(m), read(num);
    while (num--)
    {
        int x, y, z;
        read(x), read(y), read(z);
        a[x][y] = z;
    }
    int now = 1,last = 0;
    for (int i = 1; i <= n; ++i)
    {
        for (int j = 1; j <= m; ++j)
        {
            for (int k = 0; k <= 3; ++k)
            {
                f[now][j][k] = std::max(f[now][j - 1][k], f[last][j][k]);
                if (k) 
                {
                    f[now][j][k] = std::max(f[now][j][k], g[last][j] + a[i][j]);
                    f[now][j][k] = std::max(f[now][j][k], f[now][j - 1][k - 1] + a[i][j]);
                }
            }
            g[now][j] = 0;
            for (int k = 0; k <= 3; ++k) g[now][j] = std::max(g[now][j], f[now][j][k]);
        }
        now ^= 1,last ^= 1;
    }
    printf("%lld\n", g[last][m]);
    return 0;
}

Measured memory_bytes: 39652
#include <iostream>
#include <vector>
using namespace std;

int main(int argc,char* argv[])
{
    int h,w,i,j;
    cin >> h >> w;
    vector<vector<char>> vec_2d(h+2,vector<char>(w+2,'#'));

    for(i=1;i<h+1;i++){
        for(j=1;j<w+1;j++){
            cin >> vec_2d.at(i).at(j);
        }
    }

    for(i=0;i<h+2;i++){
        for(j=0;j<w+2;j++){
            cout << vec_2d.at(i).at(j);
        }
        cout << "\n";
    }

    return 0;
}

Measured memory_bytes: 256
import java.io.*;
import java.util.*;

public class Main {

	static int n;
	static long INF = (long) 1e18 + 1;

	static class Edge implements Comparable<Edge> {
		int node;
		double cost;

		Edge(int u, double c) {
			node = u;
			cost = c;
		}

		@Override
		public int compareTo(Edge other) {
			if (cost != other.cost)
				return Double.compare(cost, other.cost);
			return node - other.node;
		}
	}

	public static void main(String[] args) throws IOException {
		Scanner sc = new Scanner();
		PrintWriter out = new PrintWriter(System.out);
		int[] start = sc.nxtArr(2), end = sc.nxtArr(2);
		int n = sc.nextInt();
		int[][][] circles = new int[n][2][];
		for (int i = 0; i < n; i++) {
			circles[i][0] = sc.nxtArr(2);
			circles[i][1] = sc.nxtArr(1);
		}
		double[] dist = new double[n];
		Arrays.fill(dist, INF);
		PriorityQueue<Edge> pq = new PriorityQueue();
		for (int i = 0; i < n; i++)
			pq.add(new Edge(i, dist[i] = Math.max(0, dist(start, circles[i][0]) - circles[i][1][0])));
		while (!pq.isEmpty()) {
			Edge curr = pq.poll();
			int u = curr.node;
			double d = curr.cost;
			if (d - 1e-6 > dist[u])
				continue;
			for (int v = 0; v < n; v++) {
				double total = d
						+ Math.max(0, dist(circles[u][0], circles[v][0]) - circles[u][1][0] - circles[v][1][0]);
				if (total < dist[v])
					pq.add(new Edge(v, dist[v] = total));
			}

		}
		double ans = dist(start, end);
		for (int i = 0; i < n; i++)
			ans = Math.min(ans, dist[i] + Math.max(0, dist(end, circles[i][0]) - circles[i][1][0]));
		System.out.printf("%.9f\n", ans);
		out.close();

	}

	static double dist(int[] p1, int[] p2) {
		long dx = p1[0] - p2[0], dy = p1[1] - p2[1];
		return Math.sqrt(dx * dx + dy * dy);
	}

	static class Scanner {
		BufferedReader br;
		StringTokenizer st;

		Scanner() {
			br = new BufferedReader(new InputStreamReader(System.in));
		}

		Scanner(String fileName) throws FileNotFoundException {
			br = new BufferedReader(new FileReader(fileName));
		}

		String next() throws IOException {
			while (st == null || !st.hasMoreTokens())
				st = new StringTokenizer(br.readLine());
			return st.nextToken();
		}

		String nextLine() throws IOException {
			return br.readLine();
		}

		int nextInt() throws IOException {
			return Integer.parseInt(next());
		}

		long nextLong() throws NumberFormatException, IOException {
			return Long.parseLong(next());
		}

		double nextDouble() throws NumberFormatException, IOException {
			return Double.parseDouble(next());
		}

		boolean ready() throws IOException {
			return br.ready();
		}

		int[] nxtArr(int n) throws IOException {
			int[] ans = new int[n];
			for (int i = 0; i < n; i++)
				ans[i] = nextInt();
			return ans;
		}

	}

	static void sort(int[] a) {
		shuffle(a);
		Arrays.sort(a);
	}

	static void shuffle(int[] a) {
		int n = a.length;
		Random rand = new Random();
		for (int i = 0; i < n; i++) {
			int tmpIdx = rand.nextInt(n);
			int tmp = a[i];
			a[i] = a[tmpIdx];
			a[tmpIdx] = tmp;
		}
	}

}

Measured memory_bytes: 51272
import sys
sys.setrecursionlimit(10 ** 7)
read = sys.stdin.buffer.read 
input = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines  

def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append((i, n//i))
            
    # divisors.sort()
    return divisors

N = int(input())
div = make_divisors(N)

ans = 10**15
for a, b in div:
  ans = min(ans, a+b-2)
print(ans)  



Measured memory_bytes: 3464
#include <iostream>
#include <string>
#include <algorithm>
#include <math.h>
using namespace std;

bool ans = true;

int main() {
	int n, a, b;
	cin >> n >> a >> b;
	if ((b - a) % 2 == 0)cout << "Alice" << endl;
	else cout << "Borys" << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
/*
*/

ll gcd(ll a,ll b){
  if(b == 0) return a;
  return gcd(b, a % b);
}

using Graph = vector<vector<int>>;

ll calc(ll a, ll b, ll p){//aのb乗をpで割った余り
  if(b == 0) return 1;

  else if(b%2 == 0){
    ll d = calc(a,b/2,p);
    return (d*d)%p;
  }
  else if(b%2 == 1){
    return (a * calc(a,b-1,p))%p;
  }
}

typedef pair<int,int> P;

bool is_prime(int n){//nが素数であるかどうか判定 iで割り切れると素数でない
    if(n == 1) return false;//1は例外
    for(int i = 2;i*i <= n;i++){
        if(n%i == 0) return false;
    }
    
    return true;
}
int factorial(int a){
  int res = 1;
  while(a){
    res *= a;
    a--;
  }
  return res;
}

int main(){
  int N;
  cin >> N;
  vector<pair<int,int>> p(N);
  rep(i,N){
    cin >> p[i].first;
    p[i].second = i+1;
  }
  
  sort(p.begin(),p.end());
  rep(i,N){
    cout << p[i].second << " ";
  }
  cout << endl;
 }

Measured memory_bytes: 1664
#include <iostream>
using namespace std;
 
int main() {
  int N;
  cin >> N;
  
  int maxL = 0, S = 0;
  for (int i = 0; i < N; ++i) {
    int L;
    cin >> L;
    
    maxL = max(L, maxL);
    S += L;
  }
  
  if (maxL < S - maxL) cout << "Yes" << endl;
  else cout << "No" << endl;
}
 

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(void){
    // Your code here
  
    for(int x,y = 0; ;){
      cin >> x >> y;
      if (x == 0 && y == 0)break;
        if(x < y){
            cout << x << " " << y << endl; 
        }else if(x > y){
            cout << y << " " << x << endl;
        }else{
            cout << x << " " << y <<endl;
        }
    }
    return 0;
}



Measured memory_bytes: 3020
#include<iostream>
using namespace std;

int main(void) {
  int a, b;
  cin >> a >> b;
  int count =0;

  for (int i=a; i<=b; i++) {
    if (i/10000 == i%10 && (i/1000)%10 == (i/10)%10) count++;
  }
  cout << count << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define For(i, a, b) for (int(i) = (int)(a); (i) < (int)(b); ++(i))
#define rFor(i, a, b) for (int(i) = (int)(a)-1; (i) >= (int)(b); --(i))
#define rep(i, n) For((i), 0, (n))
#define rrep(i, n) rFor((i), (n), 0)
#define fi first
#define se second
using namespace std;
typedef long long lint;
typedef unsigned long long ulint;
typedef pair<int, int> pii;
typedef pair<lint, lint> pll;
template <class T>
bool chmax(T &a, const T &b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
template <class T>
bool chmin(T &a, const T &b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template <class T>
T div_floor(T a, T b) {
    if (b < 0) a *= -1, b *= -1;
    return a >= 0 ? a / b : (a + 1) / b - 1;
}
template <class T>
T div_ceil(T a, T b) {
    if (b < 0) a *= -1, b *= -1;
    return a > 0 ? (a - 1) / b + 1 : a / b;
}

constexpr lint mod = 1000000007;
constexpr lint INF = mod * mod;
constexpr int MAX = 200010;

int main() {
    int n;
    scanf("%d", &n);
    lint a[n];
    rep(i, n) scanf("%lld", &a[i]);
    lint tmp = 0, ans = 0;
    rep(i, n) {
        if (a[i] < tmp) ans += tmp - a[i];
        chmax(tmp, a[i]);
    }
    printf("%lld\n", ans);
}

Measured memory_bytes: 5320
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
using namespace std;
using ll = long long;
const int INF = 1001001001;
const int MOD = 1000000007;
typedef long long ll;

int main(){
    int N, K, S;
    cin >> N >> K >> S;
    vector<int> A(N, (S/2) + 1);
    if(S == 1){
        rep(i, N){
            A[i] = 1000001;
        }
    }
    rep(i, K){
        A[i] = S;
    }
    for(int i = 0; i < N; i++){
        if(i) cout << " ";
        cout << A[i];
    }
    cout << endl;
    return 0;
}


Measured memory_bytes: 1664
#define __mode_debug__
/*   ξ
     ll
   ＿ll＿
 ／  ∞  ＼
│*  Ａ  *│
│*  Ｃ  *│
│*  祈  *│
│*  願  *│
│*      *│
 ￣￣￣￣￣    */
//C++14 (GCC 5.4.1)
#include <bits/stdc++.h>
using namespace std;
#ifdef __mode_debug__
    #define DBG
#else
    #define DBG if(false)
#endif

#define LLINF (1LL<<60)
using ll = long long;
#define mod  1000000007

#define whole(a) (a).begin(),(a).end()
#define rwhole(a) (a).rbegin(),(a).rend()

#define repd(i,a,b) for (int i=(a);i<(b);i++)
#define rep(i,n) repd(i,0,n)
#define rrepd(i,a,b) for(int i=(a);i>=(b);i--)
#define each(itr,ds) for(auto itr=(ds).begin();itr!=(ds).end();itr++)

template<typename T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<typename T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

template < typename T > inline string toString( const T &a ) { ostringstream oss; oss << a; return oss.str(); }

//DUMP
//  ostream vector<T> , vector<vector<T>> , set<T> ,queue<T> , priority_queue<T> , pair<T,U> , map<T,U>
template<class T> ostream& operator<<(ostream&os,vector<T>&vec){os<<"{ ";rep(i,vec.size()) os<<((i==0)?"":", ")<<i<<":"<<vec[i];os<<" }";return os;}
template<class T> ostream& operator<<(ostream&os,vector<vector<T>>&vec){os<<"{"<<endl;rep(i,vec.size())os<<"\t   "<<i<<":"<<vec[i]<<((i==vec.size()-1)? "":",")<<endl;os<<"\t }";return os;}
template<class T> ostream& operator<<(ostream&os,set<T>&p){os<<"{ ";each(itr,p)  os<<((itr==p.begin())?"":", ")<<*itr;os<<" }";return os;}
template<class T> ostream& operator<<(ostream&os,queue<T>&p){queue<T> q(p);os<<"[< "<<(q.empty()?" <]":"");while(!q.empty()){os<<q.front();q.pop();os<< (q.empty() ? " <]" : ", ");}return os;}
template<class T> ostream& operator<<(ostream&os,priority_queue<T>&p){priority_queue<T> q(p);os<<"[< "<<(q.empty()?" <]":"");while(!q.empty()){os<<q.top();q.pop();os<< (q.empty() ? " <]" : ", ");}return os;}
template<class T,class U> ostream& operator<<(ostream&os,pair<T,U>&p){os<<"("<<p.first<<","<<p.second<<")";return os;}
template<class T,class U> ostream& operator<<(ostream&os,map<T,U>&p){os<<"{ ";each(itr,p)os<<((itr==p.begin())?"":", ")<<itr->first<<":"<<itr->second;os<<" }";return os;}
void dump_f(string &nm,char t){cerr<<endl;}
template<class T,class... Ts> void dump_f(string &nm,char t,T &&x,Ts&&... ts){int l=nm.find_first_of(',');string name(nm,0,l),nx(nm,l+1,-1);if(t=='\n') cerr<<"  "<<name<<"\t: "<<x<<t;else cerr << name<<": "<<x<<","<<t;dump_f(nx,t,forward<Ts>(ts)...);}
template<class... Ts> void dump_m(int &&ln,string &&nm,char t,Ts&&... ts){cerr<<"[ln: "<<ln<<"]"<<t;dump_f(nm,t,forward<Ts>(ts)...);}
#define dump(...) DBG dump_m(__LINE__,#__VA_ARGS__,'\n',__VA_ARGS__)
#define dl(...) DBG dump_m(__LINE__,#__VA_ARGS__,'\t',__VA_ARGS__)

#define lower_bound_idx(V,c) distance(V.begin(),lower_bound(whole(V),c))

int main() {
    ios::sync_with_stdio(false);//stdout<=>cout
    cin.tie(nullptr);//cin<=>cout


    ll N,K;
    cin >>N>>K;

    //-----------------------------------

    cout << min(N%K,K-(N%K)) <<endl;


    return (0);
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef pair<int,P> P1;
typedef pair<P,P> P2;
#define pu push
#define pb push_back
#define mp make_pair
#define eps 1e-7
#define INF 1000000000
#define mod 1000000007
#define fi first
#define sc second
#define rep(i,x) for(int i=0;i<x;i++)
#define repn(i,x) for(int i=1;i<=x;i++)
#define SORT(x) sort(x.begin(),x.end())
#define ERASE(x) x.erase(unique(x.begin(),x.end()),x.end())
#define POSL(x,v) (lower_bound(x.begin(),x.end(),v)-x.begin())
#define POSU(x,v) (upper_bound(x.begin(),x.end(),v)-x.begin())
string str;
int d;
ll dp[10005][105][2];
int main(){
	cin>>str;
	cin>>d;
	dp[0][0][0] = 1;
	for(int i=0;i<str.size();i++){
		int pos = str[i]-'0';
		for(int j=0;j<d;j++){
			for(int a=0;a<=pos;a++){
				if(a == pos) dp[i+1][(j+a)%d][0] += dp[i][j][0];
				else dp[i+1][(j+a)%d][1] += dp[i][j][0];
			}
			for(int a=0;a<=9;a++){
				dp[i+1][(j+a)%d][1] += dp[i][j][1];
			}
		}
		rep(j,d)rep(k,2)dp[i+1][j][k]%=mod;
	}
	ll ans = -1LL+dp[str.size()][0][0]+dp[str.size()][0][1];
	cout<<(ans%mod+mod)%mod<<endl;
}

Measured memory_bytes: 16640
#include <algorithm>
#include <iostream>
#include <vector>

int main() {
    int n;
    std::cin >> n;

    std::vector<int> vec{};
    for (int i = 0; i < n; ++i) {
        int a;
        std::cin >> a;
        vec.push_back(a);
    }

    auto iter_erased_start = unique(vec.begin(), vec.end());
    vec.erase(iter_erased_start, vec.end());

    for (auto iter = vec.begin(); iter != vec.end(); ++iter) {
        std::cout << *iter;
        if (iter != vec.end() - 1) std::cout << ' ';
    }
    std::cout << std::endl;
}


Measured memory_bytes: 3520
#include <stdio.h>

int main(void)
{
	int a,b,c;
	int i;
	int point = 0;
	
	scanf("%d %d %d",&a,&b,&c);
	
	for(i = 1;i <= 10000;i++){
		if(c % i == 0){
			if(a <= i && i <= b){
				point++;
			}
		}
	}
	
	printf("%d\n",point);
	
	return(0);
}

Measured memory_bytes: 596
#include <algorithm>
#include <cassert>
// #include <chrono>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <iostream>
#include <map>
#include <memory>
#include <queue>
// #include <random>
#include <set>
#include <stack>
#include <string>
#include <utility>
#include <vector>

/*
unsigned seed1 = std::chrono::system_clock::now().time_since_epoch().count();
mt19937 g1.seed(seed1);
*/
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef pair<pii, pii> ppiipii;
typedef pair<int, ppiipii> pippiipii;
typedef pair<int, pii> pipii;
typedef pair<pii, int> ppiii;
typedef pair<int, ppiii> pippiii;
typedef pair<int, ll> pill;
typedef pair<int, double> pid;
typedef pair<string, string> pss;
// note to self, the below two triggers someone
typedef pair<ll, ll> pll;
typedef pair<ll, int> plli;
typedef long double ld;

int main() {
  int k, s;
  scanf("%d%d", &k, &s);
  int ret = 0;
  for(int x = 0; x <= k; x++) {
    for(int y = 0; y <= k; y++) {
      int z = s-x-y;
      if(z >= 0 && z <= k) ret++;
    }
  }
  printf("%d\n", ret);
}


Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#include <vector>

using namespace std;

typedef long long ll;
typedef pair<ll, ll> P;

#define MOD 1000000007
#define REP(i, N) for (int i = 0; i < N; ++i)
#define REP1(i, N) for (int i = 1; i <= N; ++i)
#define RREP(i, N) for (int i = N - 1; i >= 0; --i)
#define ALL(a) a.begin(), a.end()

int main() {
  int n, k;
  cin >> n >> k;
  string s;
  cin >> s;
  int cnt = 0;
  REP(i, n) {
    if (s[i] == 'L') {
      if (0 < i && s[i - 1] == 'L') {
        cnt++;
      }
    } else {
      if (i < n - 1 && s[i + 1] == 'R') {
        cnt++;
      }
    }
  }
  cnt += 2 * k;
  int ans = min(n - 1, cnt);
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 512
s=input()
cnt=0
if s[0] != 'A':
    print('WA')
    exit()
if s[2:len(s)-1].count('C') != 1:
    print('WA')
    exit()
else:
    for i in range(1,len(s)):
        if s[i]=='C':
            continue
        if s[i].isupper():
            print('WA')
            exit()

print('AC')

Measured memory_bytes: 3060
#include <vector>
#include <stack>
#include <queue>
#include <list>
#include <bitset>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <algorithm>
#include <numeric>
#include <iostream>
#include <iomanip>
#include <string>
#include <chrono>
#include <random>
#include <cmath>
#include <cassert>
#include <climits>
#include <cstring>
#include <cstdlib>
#include <functional>
#include <sstream>

using namespace std;

class Solution {
public:
    long long solve(int n, int m, vector<int>& A, vector<int>& B, vector<int>& C) {

        sort(A.begin(), A.end(), greater<int>());
        sort(B.begin(), B.end(), greater<int>());
        //sort(C.begin(), C.end(), greater<int>());

        while (A.size() < n) {
            A.push_back(0);
        }
        while (A.size() > n) {
            A.pop_back();
        }
        while (B.size() < m) {
            B.push_back(0);
        }
        while (B.size() > m) {
            B.pop_back();
        }

        int N = C.size();
        for (auto x : A) {
            C.push_back(x);
        }
        for (auto y : B) {
            C.push_back(y);
        }
        sort(C.begin(), C.end(), greater<int>());
        long long res = 0;
        for (int i = 0; i < n + m; ++i) {
            res += C[i];
        }

        return res;
    } 
};

int main(int argc, char** argv) {
    ios::sync_with_stdio(false);
    cin.tie(0);

    int n, m, a, b, c;
    cin >> n >> m >> a >> b >> c;
    vector<int> A(a);
    vector<int> B(b);
    vector<int> C(c);

    for (int i = 0; i < a; ++i) {
        cin >> A[i];
    }
    for (int i = 0; i < b; ++i) {
        cin >> B[i];
    }
    for (int i = 0; i < c; ++i) {
        cin >> C[i];
    }

    Solution sol;
    cout << sol.solve(n, m, A, B, C) << "\n";
    return 0;
}

Measured memory_bytes: 2552
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
using namespace std;
#define MAXS 26
int main(int argc,char const* argv[])
{
  int i,j,length;
  string s;
  string buckets;
  vector<int> flag(MAXS,0);
  for(i=0;i<MAXS;i++)
    {
      buckets[i]=i+'a';
    }
  cin >> s;
  length=s.size();
  for(i=0;i<length;i++)
    {
      for(j=0;j<MAXS;j++)
	{
	  if(s[i]==buckets[j])
	    {
	      flag[j]+=1;
	    }
	}
    }
  for(i=0;i<MAXS;i++)
    {
      if(flag[i]>=2)
	{
	  cout << "no" << endl;
	  return 0;
	}
    }
  cout << "yes" << endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h> 
using namespace std;
#define ll long long int
#define deb1(x) cout<<#x<<" :: "<<x<<"\n";
#define deb2(x,y) cout<<#x<<" :: "<<x<<"\t"<<#y<<" :: "<<y<<"\n";
#define deb3(x,y,z) cout<<#x<<" :: "<<x<<"\t"<<#y<<" :: "<<y<<"\t"<<#z<<" :: "<<z<<"\n";
ll mod=1000000007;

int main(){
     ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	ll n;
	cin>>n;
	ll a,b,c=0,fl=0;
	for(ll i=0;i<n;i++){
		cin>>a>>b;
		if(a==b)
			c++;
		if(a!=b)
			c=0;
			
		if(c>=3)
			fl=1;
			
			}
		if(fl==1){
			cout<<"Yes"<<endl;
			}
		else
			cout<<"No"<<endl;
	
	 }
	 			
	 
	
	 			


			
		
			
			
	
			
			
			
			
			
			
			
			
			
			
			
			
			
			
			
			
			
			
	
			
	
	

	
				
	











Measured memory_bytes: 3596
n = gets.to_i
array = gets.split(" ").map(&:to_i)
result = []
array.each.with_index(1) do |a, i|
  result << [a, i]
end

result.sort! {|a,b| a[0] <=> b[0]}

result.each.with_index(1) do |re, i|
  print re[1]
  print " " unless i == result.length
end

Measured memory_bytes: 17924
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <string>
#include <iomanip>
#include <map>
#include <set>
#include <cmath>
#include <cstdio>
using namespace std;
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define FOR(i,m,n) for(int (i)=(m);(i)<(n);(i)++)
#define All(v) (v).begin(),(v).end()
typedef long long ll;

int main(){
    int N;
    cin >> N;
    vector<int> b(N);
    rep(i,N)cin >> b[i];
    vector<int> res;
    while(!b.empty()){
        int ok = 0;
        for(int i=b.size()-1;i>=0;i--){
            if(b[i]==i+1){
                res.push_back(b[i]);
                b.erase(b.begin()+(i));
                ok=1;
                break;
            }
        }
        if(!ok){
            cout << -1 << endl;
            return 0;
        }
    }
    reverse(All(res));
    rep(i,res.size())cout << res[i] << endl;
    return 0;
}

Measured memory_bytes: 256
n = int(input())
u = {input() for i in range(n)}
m = int(input())
isLocked = True
for i in range(m):
	t = input()
	if t in u:
		if isLocked:
			print("Opened by",t)
		else:
			print("Closed by",t)
		isLocked = not isLocked
	else:
		print("Unknown",t)



Measured memory_bytes: 5612
#include "bits/stdc++.h"
using namespace std;
using ll = long long;
#define rep(i, begin, n) for (int i = begin; i < n; i++)
#define repe(i, begin, n) for (int i = begin; i <= n; i++)
#define repr(i, begin, n) for (int i = begin; i > begin - n; i--)
#define repre(i, begin, end) for (int i = begin; i >= end; i--)

const int inf = 1000000007;
const int MOD = 1000000007;
const long long INF = 1000000000000000007;

const int MAX = 1010101;

long long fac[MAX], finv[MAX], inv[MAX];

void binom_init()
{
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++)
    {
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

long long binom(int n, int k)
{
    if (n < k)
        return 0;
    if (n < 0 || k < 0)
        return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

int N, K;
int A[101010];

int main()
{
    cin >> N >> K;
    repe(i, 1, N)
    {
        cin >> A[i];
    }
    sort(A + 1, A + N + 1);
    ll ans = 0;

    binom_init();

    for (int i = K; i <= N; i++)
    {
        ll add = (binom(i - 1, K - 1) * A[i]) % MOD;
        ans += add;
        ans %= MOD;
    }
    for (int i = 1; i <= N - K + 1; i++)
    {
        ll sub = (binom(N - i, K - 1) * A[i]) % MOD;
        ans += MOD - sub;
        ans %= MOD;
    }
    cout << ans << endl;
}


Measured memory_bytes: 24320
#include <iostream>
#include <cmath>
#include <algorithm>
#include <string> //文字列
#include <iomanip> //doubleの桁数指定 setprecision()
#include <list> //前後に数値を入れれる配列
#include <map> //map
#include <vector> //vecror



#define REP(i,m,n) for(ll i = (ll) (m);i < (ll) (n);i++) //forの短縮
#define rep(i,n) REP(i,0,n) //REPが0の時
#define ll long long int

using namespace std;

double PI = acos(-1); //円周率

//常設関数↓

//最大公約数
ll gcd(ll a, ll b) {
	if (b == 0) return a;
	return gcd(b, a % b);
}

//最小公倍数
ll lcm(ll a, ll b) {
	return a * b / gcd(a, b);
}

//degree → radian
long double chg_DegRad(long double deg) {
	return deg * PI / 180.0;
}

//radian → degree
long double chg_RadDeg(long double rad) {
	return rad * 180.0 / PI;
}
 
//桁数
ll CountDigit(ll n) {
	ll digit = 1;
	while ((n /= 10) != 0) digit++;
	return digit;
}

//距離
double dis(double xa, double ya, double xb, double yb) {
	return pow(pow(xa - xb, 2.0) + pow(ya - yb, 2.0), 0.5);
}

//abs()平均
//pow(,)累乗


//提出コード↓

ll h, a;



int main() {
	cin >> h >> a;
	if (h % a == 0) cout << h / a << endl;
	else cout << h / a + 1 << endl;
	


	return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(begin, end) for (i=begin;i<end;i++)
#define init(arr, val) for (i=0;i<end;i++) arr[i] = val;
#define printint(i0, i1) printf("%d %d\n", i0, i1)

using namespace std;
const int inf = pow(10,9);
const int nil = -1;
const float pi = 3.141592653589;
int a[1000];
float n;

int main() {
    scanf(" %f", &n);

    printf("%f\n", 2 * n * pi);
}

Measured memory_bytes: 3828
#!/usr/bin/ruby
P=->s{puts s;exit};R,C=gets.split.map &:to_i;N=gets.to_i;M=Hash.new{|h,k|h[k]=[]}
N.times{x,y,d=gets.split.map &:to_i;M[x]<<[y+R,d];M[y+R]<<[x,-d]}
while !M.empty?
	a=-1<<61;b=1<<61;s=M.find{|e|e}[0];t=[[s,0]];m={s=>0}
	while !t.empty?
		x,d=t.pop;m[x]=d;M[x].map{|y,c|!m[y]?t<<[y,d+c]:m[y]!=d+c&&P[:No]};x<=R ? a=[a,d].max: b=[b,d].min
	end
	a>b&&P[:No]
	m.map{|k,v|M.delete k}
end
P[:Yes]

Measured memory_bytes: 59772
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)
#define all(v) v.begin(), v.end()
//
int main(){
    char a;
    cin>>a;
    if(a<92)cout<<"A"<<endl;
    else cout<<"a"<<endl;
}

Measured memory_bytes: 3632
#include <bits/stdc++.h>
using namespace std;
int main()
{
  string s;
  cin>>s;
  string result="No";
  int c=0;
  for(int i=0,limit=s.size();i<limit;i++){
    if(i%2!=0){
      if(s[i]=='L'||s[i]=='U'||s[i]=='D'){
        c++;
      } 
    }
    else{
      if(s[i]=='R'||s[i]=='U'||s[i]=='D'){
        c++;
      }
    }
    if(c==limit){
      result="Yes";
    }
  }
  cout<<result<<endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
using namespace std;
#define ll long long

ll gcd(ll,ll);

int main(){
  
  int n,x;
  cin >> n>>x;
  
  vector<ll> vec;
  for (int i=0;i<n;i++){
    ll a;
    cin >> a;
    vec.emplace_back(abs(a-x));
  }
  
  if (n==1) {
    cout << vec[0];
    return 0;
  }
  if (n==2) {
    cout << gcd(vec[0],vec[1]);
    return 0;
  }
  
  ll a=vec[0],b=vec[1];
  for (int i=2;i<n;i++){
    a=gcd(a,b);
    b=vec[i];
  }
  a=gcd(a,b);
  
  cout << a;

  return 0;
}

ll gcd(ll x, ll y)
{
    ll r;

    if(x == 0 || y == 0)  // 引数チェック
    {
        return 0;
    }

    // ユーグリッドの互除法
    while((r = x % y) != 0)  // yで割り切れるまでループ
    {
        x = y;
        y = r;
    }
    return y;
}


Measured memory_bytes: 1400
n, x = gets.chomp.split.map(&:to_i)
a = gets.chomp.split.map(&:to_i).sort

c = 0
n.times do |i|
  next if x < a[i]
  c += 1
  x -= a[i]
end

if x != 0 && c == n
  p c - 1
else
  p c
end


Measured memory_bytes: 1788
#include <stdio.h>


int main(void)
{
	int			n,a,b,c,d,e,num=0;
	while(scanf("%d",&n)!=EOF){
		num = 0;
		for(a=0; a<10; a++){
			for(b=0; b<10; b++){
				for(c=0; c<10; c++){
					if((0<=n-a-b-c) &&(n-a-b-c <=9) ){

						num++;
					}
				}
			}
		}		
	printf("%d\r\n", num);	}

	return 0;
}

Measured memory_bytes: 596
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

func main() {
	N := nextInt()
	bits := make([]mint, 64)

	for i := 0; i < N; i++ {
		a := nextUint64()

		for j := 0; j <= 60; j++ {
			bits[j] += mint(nthbit(a, j))
		}
	}

	s := mint(0)

	for i := 0; i <= 60; i++ {
		b := mint(2).pow(mint(i))
		s = s.add(b.mul(bits[i]).mul(mint(N) - bits[i]))
	}

	fmt.Println(s)
}

func nthbit(a uint64, n int) int { return int((a >> uint(n)) & 1) }

type mint uint64

var mod = mint(1e9 + 7)

// add は a + bを返します
func (a mint) add(b mint) mint {
	return (a + b) % mod
}

// sub は a - bを返します
func (a mint) sub(b mint) mint {
	return (a - b + mod) % mod
}

// mul は a * bを返します
func (a mint) mul(b mint) mint {
	return (a * (b % mod)) % mod
}

// div は a/bを返します
func (a mint) div(b mint) mint {
	return a.mul(b.inv())
}

// inv は aの逆元を返します
func (a mint) inv() mint {
	// 拡張ユークリッドの互除法
	b := mod
	u := mint(1)
	v := mint(0)
	for b > 0 {
		t := a / b
		a -= t * b
		a, b = b, a
		u -= t * v
		u, v = v, u
	}
	return (u + mod) % mod
}

// pow は a ^ bを返します
func (a mint) pow(b mint) mint {
	ans := mint(1)

	for b != 0 {
		if b&1 == 1 {
			ans = ans.mul(a)
		}
		a = a.mul(a)
		b = b >> 1
	}
	return ans
}

var stdin = initStdin()

func initStdin() *bufio.Scanner {
	bufsize := 1 * 1024 * 1024 // 1 MB
	var stdin = bufio.NewScanner(os.Stdin)
	stdin.Buffer(make([]byte, bufsize), bufsize)
	stdin.Split(bufio.ScanWords)
	return stdin
}

func nextString() string {
	stdin.Scan()
	return stdin.Text()
}

func nextBytes() []byte {
	stdin.Scan()
	return stdin.Bytes()
}

func nextInt() int {
	i, _ := strconv.Atoi(nextString())
	return i
}

func nextUint64() uint64 {
	i, _ := strconv.ParseUint(nextString(), 10, 64)
	return i
}


Measured memory_bytes: 6528
#include<stdio.h>

int main(void)
{
  int i,n,j,y,m,d,SS;

  scanf("%d",&n);
  for(j=1;j<=n;j++)
    {
      scanf("%d%d%d",&y,&m,&d);
      SS=0;
      for(i=y+1;i<1000;i++)
        {
         if(i%3==0)
	   {
	     SS+=200;
	   }
         else
	   {
	     SS+=195;
	   }
       }
      if(y%3==0)
	{
	  for(i=m+1;i<11;i++)
	    {
	      SS+=20;
	    }
	}
      else
	{
	  for(i=m+1;i<11;i++)
	    {
	      if(i%2==1)
		{
		  SS+=20;
		}
	      else
		{
		  SS+=19;
		}
	    }
	}
      if(y%3!=0 && m%2==0)
	{
          for(i=d;i<20;i++)
	    {
	      SS+=1;
	    }
	}
      else
	{
	  for(i=d;i<21;i++)
	    {
	      SS+=1;
	    }
	}
      printf("%d\n",SS);
    }
  return 0;
}

Measured memory_bytes: 596
#include<iostream>
#include<cstring>
#include<vector>
#include<queue>
#include<cstdio>
#include<algorithm>
using namespace std;

#define LL long long

inline LL read(){
	LL x=0,f=1;char c=getchar();
	for(;!isdigit(c);c=getchar()) if(c=='-') f=-1;
	for(;isdigit(c);c=getchar()) x=x*10+c-'0';
	return x*f;
}
const LL INF=9999999;
const LL MAXN=100010;
const LL Mod = 1e9+7;

LL N,X,Y,Z;
LL Finall,MAX;
LL f[41][(1<<18)];
LL ans=0;

int main(){
	//freopen(".in","r",stdin);
	//freopen(".out","w",stdout);
	N=read(); X=read(),Y=read(),Z=read();
	Finall=(1LL<<(X-1))|(1LL<<(X+Y-1))|(1LL<<(X+Y+Z-1));
	MAX=(1LL<<(X+Y+Z))-1; f[0][0]=1; LL Pw=1;
	for(LL i=0;i<N;i++){
		Pw=Pw*10LL%Mod;
		for(LL j=0;j<=MAX;j++){
			if(!f[i][j]) continue;
			for(LL k=1;k<=10;k++){
				LL x=MAX&((j<<k)|(1LL<<(k-1)));
				if((x&Finall)==Finall) continue;
				f[i+1][x]+=f[i][j]; f[i+1][x]%=Mod;
			} 
		} //cout<<endl; system("pause");
	} for(LL j=0;j<=MAX;j++) (ans+=f[N][j])%=Mod;
	printf("%lld\n",(Pw-ans+Mod)%Mod);
	return 0;
}


Measured memory_bytes: 82176
#include <iostream>
#include <string>
using namespace std;

int main()
{
	int n, k, max = 0, pcon = 0, p = 0, start = 0, p1 = 0, tr = 0;
	cin >> n >> k;
	string s;
	cin >> s;
	char cy;
	cy = s[0];
	for (auto c : s)
	{

		if (pcon != 0) {
			if (cy != c && max == 0) {
				max = 1;
			}
			else if (max == 1 && cy != c) {
				p += 1;
				max = 0;
			}
			cy = c;
		}
		pcon = 1;
	}
	if (s[0] != s[n - 1]) {
		p1 = 1;
	}
	while (k > 0 && p > 0) {
		start += 2;
		k -= 1;
		p -= 1;
	}
	while (k > 0 && p1 > 0) {
		start += 1;
		k -= 1;
		p1 -= 1;
	}
	pcon = 0;
	cy = s[0];
	for (auto c : s)
	{

		if (pcon != 0) {
			if (cy == c) {
				tr += 1;
			}
			cy = c;
		}
		pcon = 1;
	}
	cout << start + tr;
}

Measured memory_bytes: 512
#include<bits/stdc++.h>

using namespace std;
long long gcd(long long a,long long b);
long long lcm(long long a2,long long b2);

int main()
{
  int x;
  cin >> x;
  vector<long long> num(100,0);
  for(int i=0;i<x;i++)
  {
    cin >> num.at(i);
  }
  long long ans=1;
  for(int i=0;i<x;i++)
  {
    ans=lcm(ans,num.at(i));
  }
  cout << ans <<endl;
  return(0);
}

long long gcd(long long a,long long b)
{
    while(b!=0)
    {
        long long r=a%b;
        a=b;
        b=r;
    }
    return(a);
}

long long lcm(long long a2,long long b2)
{
  return(a2/gcd(a2,b2)*b2);
}


Measured memory_bytes: 3124
#include <iostream>
#include <algorithm>
using namespace std;
int main(void){
  int n;
  string c;
  cin >> n;
  int s[50][26]={};
  int ans[26];
  for(int i=0; i<n; i++){
    cin >> c;
    for(int j=0; j<c.size(); j++){
      s[i][c[j]-'a']++;
    }
  }

  int mina[26];
  for(int i=0; i<26; i++){
    mina[i]=100000000;
  }

  for(int i=0; i<26; i++){
    for(int j=0; j<n; j++){
      mina[i]=min(s[j][i], mina[i]);
    }
  }

  for(int i=0; i<26; i++){
    for(int j=0; j<mina[i]; j++){
      cout << (char)('a'+i);
    }
  }
  cout << endl;
  return 0;
}


Measured memory_bytes: 256
import numpy as np

N = int(input())
A = list(map(int, input().split()))
B = list(range(1,N+1,1))

An = np.array(A)
Bn = np.array(list(range(1,N+1,1)))

Cn = An - Bn

ans = 0
b = int(round(np.median(Cn)))

for c in Cn:
    ans += abs(c - b)

print(ans)

Measured memory_bytes: 38904
import java.util.*;
public class Main { //クラス名はMain
    public static void main(String[] args) {
        Scanner sc=new Scanner(System.in);
        int n=sc.nextInt();
        int sum=0;
        int sum2=0;
        for(int i=0;i<n;i++){
        	int d=sc.nextInt();
            sum+=d;
            sum2+=Math.pow(d,2);
        }
        int o=((int)Math.pow(sum,2)-sum2)/2;
        System.out.println(o);
    }
}

Measured memory_bytes: 21716
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

static const int MAX = 51;
ll c[MAX][MAX];

void makeCombi(int n){
    c[1][0] = c[1][1] = 1;
    for(int i = 2; i <= n; i++){
        for(int j = 0; j <= i; j++){
            c[i][j] = c[i-1][j] + c[i-1][j-1];
            //printf("c[%d][%d] = %ld\n", i, j, c[i][j]);
        }
    }
}

int main(){
    int n, p;
    int even = 0, odd = 0;
    cin >> n >> p;
    for(int i = 0; i < n; i++){
        int a;
        cin >> a;
        if(a & 1) odd++;
        else even++;
        //cout << odd << " " << even << endl;
    }
    makeCombi(n);
    ll ans = 0;
    if(p == 0){
        for(int i = 0; i <= odd; i += 2){
            for(int j = 0; j <= even; j++){
                ans += max(1LL, c[even][j]) * max(1LL, c[odd][i]);
                //cout << c[even][j] << " " << c[odd][i] << endl;
            }
        }
    } else {
        for(int i = 1; i <= odd; i += 2){
            for(int j = 0; j <= even; j++){
                ans += max(1LL, c[even][j]) * max(1LL, c[odd][i]);
                //cout << c[even][j] << " " << c[odd][i] << endl;
            }
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3616
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int a,b,c,d;
  cin>>a>>b>>c>>d;
  int x,y;
  if(a%d==0){
    x=a/d;
  }
  else{
    x=a/d+1;
  }
  if(c%b==0){
    y=c/b;
  }
  else{
    y=c/b+1;
  }
  if(x<y){
    cout<<"No"<<endl;
  }
  else{
    cout<<"Yes"<<endl;
  }

}

Measured memory_bytes: 3624
def get_int
  gets.chop.to_i
end

def get_ints
  gets.chop.split.map(&:to_i)
end

def get_double
  gets.chop.to_f
end

def get_str
  gets.chop
end

def get_strs
  gets.chop.split
end

def main
  a, b = get_ints
  c = a - 2 *b
  puts [0, c].max
end

if __FILE__ == $0
  main
end



Measured memory_bytes: 1788
#include <iostream>
#include <string>
#include <vector>
using namespace std;
typedef long long ll;
const int mod = 1000000007;
const int N = 110;
string num;
int d;
ll f[100010][N]; // f[i][j]: i bits的任意数对D取模余j的个数

ll dp() {
    int len = num.size();
    vector<int> nums;
    for(int i = len - 1; i >= 0; i --) {
        nums.push_back(num[i] - '0');
    }
    ll res = 0;
    ll last = 0;
    for(int i = len-1; i >= 0; i --) {
        if(nums[i] > 0) {
            for(int j = 0; j < nums[i]; j ++) {
                res += f[i][(10*d-last-j) % d];
                res %= mod;
            }
        }
        last += nums[i];
        last = last % d;
    }
    if(last % d == 0) res ++;
    return res % mod;
}

void init() {
    f[0][0] = 1;
    for(int i = 1; i <= num.size(); i ++) {
        for(int j = 0; j < d; j ++) {
            for(int k = 0; k < 10; k ++) {
                f[i][j] += f[i-1][(10*d-k+j) % d];
                f[i][j] %= mod;
            }
            //cout << i << " " << j <<": "  <<f[i][j] << endl;
        }
    }
}

int main() {
    cin >> num >> d;
    init();
    cout << (dp()-1 + mod) % mod<< endl;
    return 0;
}

Measured memory_bytes: 10624
#include <bits/stdc++.h>

using namespace std;

int main() {
    int n;
    cin >> n;

    int cnt = 0;
    long long sum = 0;
    long long mn = 1e10;
    for (int i = 0; i < n; ++i) {
        long long a;
        cin >> a;
        if (a < 0) {
            cnt++;
            a *= -1;
        }
        mn = min(mn, a);
        sum += a;
    }

    if (cnt % 2 == 1) sum -= 2 * mn;
    cout << sum << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <numeric>
using namespace std;
#define ll long long
#define mod107 1000000007
#define rep(i, n) for (int i = 0; i < n; ++i)
using Graph = vector<vector<int>>;
#define grepq priority_queue<double, std::vector<double>, std::greater<double>>
#define all(v) v.begin(), v.end()
#define PI acos(-1)
const ll INF = 10010001010;
const int inf = 1000034000;
typedef vector<ll> vecl;
typedef vector<int> veci;
typedef tuple<string, int, int> TUP;

const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

int main()
{
    int M,D;
    cin >> M >> D;
    int ans = 0;
    for (int i = 1; i <= M;i++)
    {
        for (int j = 1; j <= D;j++)
        {
            int d10 = j / 10;
            int d1 = j - d10 * 10;
            if(d10 >= 2 && d1 >= 2){
                if(i == d10 *d1){
                    ans++;
                }
            }
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 3644
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
const int INF = 1001001001;

ll f(ll n){
    if(n == 0) return 1;
    ll ret = f(n / 2) * f(n / 2);
    if(n % 2 == 1) ret *= 2;
    return ret;
}
ll g(ll h){
    if(h == 1)return 1;
    ll ret = 2 * g(h/2) + 1;
    return ret;
}

int main(){
    ll h;
    cin >> h;
    cout << g(h) << endl;
    // ll c = 0;
    // while(h != 0){
    //     h /= 2;
    //     c++;
    // }
    // cout << f(c) - 1 << endl;

}

Measured memory_bytes: 3628
#include <iostream>
#include <vector>
#include <algorithm>
#define int long long

using namespace std;

signed main(){
    int n, k, sum=0;
    cin >> n >> k;
    for(int i=k;i<=n;i++){
        sum += i*n-i*(i-1)+1;
    }
    cout << 1+sum%1000000007 << endl;
    return 0;
}

Measured memory_bytes: 3636
k,s = map(int,input().split())

ans = 0

for i in range(k+1):
	for j in range(k+1):
		if i+j <= s and s-(i+j) <= k :
			#print('------')
			#print(i)
			#print(j)
			#print(s-(i+j))
			ans = ans +1


print(ans)		
		


Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define rep(i, n) for (ll i = 0; i < n; ++i)
#define P pair<ll, ll>
#define Graph vector<vector<ll>>
#define fi first
#define se second
constexpr ll mod = 1000000007;
constexpr ll INF = (1ll << 60);
constexpr double pi = 3.14159265358979323846;
template <typename T>
inline bool chmax(T &a, T b) {
    if (a < b) {
        a = b;
        return 1;
    }
    return 0;
}
template <typename T>
inline bool chmin(T &a, T b) {
    if (a > b) {
        a = b;
        return 1;
    }
    return 0;
}

int main() {
    ll n;
    cin >> n;
    vector<P> d(n);
    rep(i, n) cin >> d[i].fi >> d[i].se;

    ll rec = 0;
    rep(i, n - 2) {
        if (d[i].fi == d[i].se && d[i + 1].fi == d[i + 1].se &&
            d[i + 2].fi == d[i + 2].se) {
            cout << "Yes\n";
            return 0;
        }
    }

    cout << "No\n";
    return 0;
}

Measured memory_bytes: 3624
#include <iostream>
using namespace std;
const int inf=1e9;
int n,ans=inf;
int nums(int x){int res=0;while(x){res+=x%10;x/=10;}return res;}
signed main()
{
	cin>>n;
	for (int i=1;i<=n/2;++i) ans=min(ans,nums(i)+nums(n-i));
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 256
//In The Name of Allah
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

const int N = 60;

int U[N], V[N], H[N], st[N], ft[N], lca[N][N], dp[N], t, res;
vector < int > adj[N];

void dfs0(int v, int p){
    st[v] = t ++;
    for (int u : adj[v]){
        if (u == p)
            continue;
        H[u] = H[v] + 1;
        dfs0(u, v);
    }
    ft[v] = t - 1;
}

void dfs(int v, int p){
    for (int u : adj[v]){
        if (u == p)
            continue;
        dfs(u, v);
        dp[v] += dp[u];
        if (!dp[u])
            res ++;
    }
}

int main(){
    ios::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
    int n;
    cin >> n;
    for (int i = 1; i < n; i ++){
        int u, v;
        cin >> u >> v;
        adj[u].push_back(v);
        adj[v].push_back(u);
    }
    int m;
    cin >> m;
    for (int i = 0; i < m; i ++)
        cin >> U[i] >> V[i];
    dfs0(1, 0);
    H[0] = -1;
    for (int i = 1; i <= n; i ++)
        for (int j = 1; j <= n; j ++)
            for (int k = 1; k <= n; k ++)
                if (st[k] <= st[i] && ft[i] <= ft[k] && st[k] <= st[j] && ft[j] <= ft[k] && H[lca[i][j]] < H[k])
                    lca[i][j] = k;
    ll ans = 0;
    for (int msk = 0; msk < 1 << m; msk ++){
        fill(dp, dp + N, 0);
        for (int i = 0; i < m; i ++)
            if (msk >> i & 1)
                dp[U[i]] ++, dp[V[i]] ++, dp[lca[U[i]][V[i]]] -= 2;
        res = 0;
        dfs(1, 0);
        ans += (1LL << res) * (__builtin_popcount(msk) & 1 ? -1 : 1);
    }
    cout << ans;
    return 0;
}


Measured memory_bytes: 3636
#include<bits/stdc++.h>
#define ll long long int
using namespace std;



int main()
{
    ll n,k,x=-2,a;
    cin>>n;
    for(int i=1;i<=n;i++){
        //x=max(x,(ll)log2(i+0.0));
        if((ll)log2(i+0.0)>x){
            x=(ll)log2(i+0.0);a=i;
        }
    }
    cout<<a;

    return 0;
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;

#define for_(i,a,b) for(int i=(a);i<(b);++i)
#define allof(a) (a).begin(),(a).end()

typedef long long lint;

struct State { int v, step; };

int N, M, term[2], dst[2][100010];
vector< vector< int > > adj;
vector< int > sdl[2][100010];

int bfs() {
	for_(i,0,2) {
		queue< State > que;
		que.push(State{term[i], 0});
		
		vector< bool > vis(N + 1, false);
		vis[term[i]] = true;
		
		while (!que.empty()) {
			State s = que.front(); que.pop();
			dst[i][s.v] = s.step;
			sdl[i][s.step].push_back(s.v);
			
			for (int v : adj[s.v]) {
				if (vis[v]) continue;
				vis[v] = true;
				que.push(State{v, s.step + 1});
			}
		}
	}
	
	return dst[0][term[1]];
}

void solve() {
	int min_dst = bfs();
	
	lint ans = 0;
	
	for_(step,0,N) ans += (lint)sdl[0][step].size() * (lint)sdl[1][min_dst - step - 2].size();
	
	cout << ans << endl;
}

int main() {
	cin >> N >> M >> term[0] >> term[1];
	
	adj.assign(N+1, vector< int >());
	
	for_(i,0,M) {
		int u, v;
		cin >> u >> v;
		adj[u].push_back(v);
		adj[v].push_back(u);
	}
	
	solve();
}

Measured memory_bytes: 16092
#include<stdio.h>
int main(void){
  int n, q, num, i, j;
  int a[2001] = {1};
  scanf("%d", &n);
  for(i = 0; i < n; i++){
    scanf("%d", &num);
    for(j= 2000-num;j>=0 ; j--){
      if(a[j]) a[j + num] = 1;
    }
  }

  scanf("%d", &q);
  for(i=0; i<q; i++){
    scanf("%d", &num);
    if(a[num]) printf("yes\n");
    else printf("no\n");
  }
  return 0;
}
		 



Measured memory_bytes: 2048
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <numeric>
using namespace std;

long long CT[110][2];
int N, T;

int main(void)
{
    cin >> N >> T;

    for (int i = 0; i < N; i++)
    {
        cin >> CT[i][0] >> CT[i][1];
    }
    int O;
    O = 10000;
    for (int i = 0; i < N; i++)
    {
        if (CT[i][1] <= T)
        {
            if (CT[i][0] < O)
            {
                O = CT[i][0];
            }
        }
    }

    if (O == 10000)
    {
        cout << "TLE";
    }
    else
    {
        cout << O;
    }

    return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <algorithm>

using namespace std;

char a[512][512], b[512][512];

int main ()
{
  //  freopen ("file.in", "r", stdin);

    int n, m;
    scanf ("%d %d", &n, &m);

    for (int j = 1; j <= m; ++j)
        a[1][j] = b[n][j] = '#', a[n][j] = b[1][j] = '.';

    for (int i = 2; i < n; ++i)
        for (int j = 1; j <= m; ++j)
            if (j & 1) a[i][j] = '#', b[i][j] = '.';
            else a[i][j] = '.', b[i][j] = '#';

    for (int i = 1; i <= n; ++i)
    {
        scanf ("\n");
        for (int j = 1; j <= m; ++j)
        {
            char c;
            scanf ("%c", &c);

            if (c == '#') a[i][j] = b[i][j] = '#';
        }
    }

    for (int i = 1; i <= n; ++i, printf ("\n"))
        for (int j = 1; j <= m; ++j)
            printf ("%c", a[i][j]);

    printf ("\n");

    for (int i = 1; i <= n; ++i, printf ("\n"))
        for (int j = 1; j <= m; ++j)
            printf ("%c", b[i][j]);

    return 0;
}


Measured memory_bytes: 1280
#include <bits/stdc++.h>

#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define FOR(i,n,m) for(int i=(int)(n); i<=(int)(m); i++)
#define RFOR(i,n,m) for(int i=(int)(n); i>=(int)(m); i--)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define RITR(x,c) for(__typeof(c.rbegin()) x=c.rbegin();x!=c.rend();x++)
#define setp(n) fixed << setprecision(n)

template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }

#define ll long long
#define vll vector<ll>
#define vi vector<int>
#define pll pair<ll,ll>
#define pi pair<int,int>

#define all(a) (a.begin()),(a.end())
#define rall(a) (a.rbegin()),(a.rend())
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define ins insert

using namespace std;

ll dp[51][51];

//-------------------------------------------------

int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N,A,B; cin>>N>>A>>B;
    vll v(N);
    rep(i,N) cin>>v[i];
    sort(rall(v));
    set<ll> S;
    ll sum=0;
    int x=0;
    rep(i,A){
        sum+=v[i];
        if (v[i]==v[A-1]) x++;
        S.ins(v[i]);
    }
    int y = upper_bound(rall(v),v[A-1])-lower_bound(rall(v),v[A-1]);

    dp[0][0] = 1;
    rep(i,50)rep(j,50){
        dp[i+1][j]+=dp[i][j];
        dp[i+1][j+1]+=dp[i][j];
    }
    
    int kind=S.size();
    ll ans=0;
    if (kind==1){
        FOR(i,A,min(B,y)){
            ans+=dp[y][i];
        }
    }else{
        ans+=dp[y][x];
    }
    cout<<setp(12)<<(double)sum/A<<"\n";
    cout<<ans<<"\n";
    return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <cctype>
#include <algorithm>
#include <cstring>
#include <map>
using namespace std;
typedef long long i64;
inline int read(int f = 1, int x = 0, char ch = ' ')
{
    while(!isdigit(ch = getchar())) if(ch == '-') f = -1;
    while(isdigit(ch)) x = x*10+ch-'0', ch = getchar();
    return f*x;
}
int n; i64 s, ans; map<i64, int> h;
int main()
{
    n = read(), h[0] = 1;
    for(int i = 1; i <= n; ++i)
    {
        s += read(); if(h.count(s)) ans += h[s];
        ++h[s];
    }
    printf("%lld\n", ans);
    return 0;
}

Measured memory_bytes: 12800