akhauriyash/Code-Regression huggingface dataset:
import java.util.*;

public class Main {

	static int c[][];
	static int e[];
	static int ans;
	static int n;

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		n = Integer.parseInt(sc.next());
		int m = Integer.parseInt(sc.next());

		c = new int[n][n];
		e = new int[n];

		for (int i = 0; i < m; i++) {
			int a = Integer.parseInt(sc.next());
			int b = Integer.parseInt(sc.next());
			c[a-1][b-1] = 1;
			c[b-1][a-1] = 1;
		}

		e[0] = 1;
		dfs(0, n);
		System.out.println(ans);
	}

	public static void dfs(int s, int q) {
		if (q == 1){
			ans ++;
			return;
		}

		for (int i=1; i<n; i++){
			if (c[s][i] == 1 && e [i] == 0){
				e[i] = 1;
				dfs(i, q-1);
				e[i] = 0;
			}
		}
	}
}


Measured memory_bytes: 23508
def resolve():
    N, M = map(int, input().split())
    H = list(map(int, input().split()))
    not_good = []
    for i in range(M):
        A, B = map(lambda x: int(x) - 1, input().split())
        if H[A] > H[B]:
            not_good.append(B)
        elif H[A] < H[B]:
            not_good.append(A)
        elif H[A] == H[B]:
            not_good.extend([A, B])
    print(N - len(set(not_good)))

resolve()

Measured memory_bytes: 20116
#include<cstdio>
#include<cstdlib>
#include<cmath>
#include<cstring>
#include<vector>
#include<algorithm>
#include<functional>
#include<set>
#include<map>
#include<queue>
#include<stack>
#include<deque>
#include<tuple>
#include<iostream>
#include<string>
#include<unordered_map>
#include<unordered_set>
using namespace std;
#define REP(i,x) for (int i=0;i<x;i++)
#define REPP(i,x,y) for (int i=x;i<=y;i++)
#define SI(x) scanf("%d",&x)
#define SL(x) scanf("%lld",&x)
#define MX3(x,y,z) max(x,max(y,z))
#define MX4(x,y,z,p) max(x,max(y,max(z,p)))
#define MX5(x,y,z,p,q) max(x,max(y,max(z,max(p,q))))
#define MN3(x,y,z) min(x,min(y,z))
#define MN4(x,y,z,p) min(x,min(y,min(z,p)))
#define MN5(x,y,z,p,q) min(x,min(y,min(z,min(p,q))))
#define amax(x,y) x=max(x,y)
#define amin(x,y) x=min(x,y)
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<bool> vb;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
typedef vector<vb> vvb;
typedef long double ld;
typedef pair<int,int> pi;
typedef pair<ll,ll> pl;
typedef tuple<int,int,int> ti;
typedef tuple<ll,ll,ll> tl;
// #####################################################################

int n, a, b, target;
int pop_count(int x) {
    int ret = 0;
    while(x > 0) ret += x & 1, x >>= 1;
    return ret;
}

bool vis[200000];

int deg(int x) {
    int ret = 0;
    for(int i = 0 ; i < n ; i++) {
        if((x^(1<<i)) != target && !vis[x^(1<<i)]) ret++;
    }
    return ret;
}

void solve() {

    SI(n); SI(a); SI(b);

    int pa = pop_count(a);
    int pb = pop_count(b);
    if((pa + pb) % 2 == 0) puts("NO");
    else {
        puts("YES");
        
        vi ans(1<<n);
        target = a^b;

        REP(i, (1<<n)) {
            if(i == 0) ans[i] = 0;
            else {
                int tmp = ans[i-1];
                int pick = -1;
                for (int j = 0 ; j < n ; j++) {
                    int t = tmp ^ (1<<j);
                    if (!vis[t]) {
                        if (pick == -1) pick = t;
                        else if (pick == target) {
                            pick = t;
                        } else if (t != target) {
                            int pt = pop_count(t ^ target);
                            int pp = pop_count(pick ^ target);
                            if (pt > pp) pick = t;
                            else {
                                int dt = deg(t);
                                int dp = deg(pick);
                                if (dt < dp) pick = t;
                            }
                        }
                    }
                }
                ans[i] = pick;
            }
            vis[ans[i]] = true;
        }
        
        for(auto e: ans) {
            printf("%d ", e^a);
        }
    }
}

void init() {
    


}

int main () {
    init();
    solve();
    return 0;
}




Measured memory_bytes: 1664
A = [int(i) for i in input().split()]
A.sort()
s,m,l = A
count = 0
ls = l-s
lm = l-m
count += ls//2
count += lm//2
if ls%2 == 0 and lm%2 == 0:
  print(count)
  exit()
elif ls%2 == 1 and lm%2 == 1:
  count += 1
  print(count)
else:
  count += 2
  print(count)


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

int main()
{
    int X, Y;
    cin >> X >> Y;
    for (int i = 0; i <= X; i++)
    {
        if (i * 2 + (X - i) * 4 == Y)
        {
            cout << "Yes" << endl;
            return 0;
        }
    }

    cout << "No" << endl;
    return 0;
}


Measured memory_bytes: 3588
/* Great things never come from comfort zones,
"whatever the mind of a man can conceive and believe,it can achieve." */
 
#include <bits/stdc++.h>
#define ll long long
#define scf(n) scanf("%d",&n)
#define lscf(n) scanf("%lld",&n)
#define lpri(n) printf("%lld ",n)
#define pri(n) printf("%d ",(int)n)
#define prin(n) printf("%d\n",(int)n)
#define lprin(n) printf("%lld\n",n)
#define rep(i,ini,n) for(int i=ini;i<(int)n;i++)
#define pb push_back
#define pf push_front
#define mp make_pair
#define F first
#define S second
#define all(x)     x.begin(),x.end()
#define tc   int tt; scf(tt); while(tt--)
#define inf INT_MAX
#define ninf INT_MIN
#define gcd __gcd
#define bitcount(n) __builtin_popcount(n)
typedef double dd;
using namespace std;
const ll mod =1e9+7;
const int N = 1e6+7;

void my_dbg() { cout << endl; }
template<typename Arg, typename... Args> void my_dbg(Arg A, Args... B) 
{ cout << ' ' << A; my_dbg(B...); }
#define dbg(...) cout << "(" << #__VA_ARGS__ << "):", my_dbg(__VA_ARGS__)


int main()
{
    
  
   
    int n,b;
    scf(n),scf(b);

    int ans=max(100*(10-n),0);

    prin(b+ans);

  }

    


Measured memory_bytes: 3780
# solution
import io

n, m, l, h = map(int, [input() for i in range(4)])
counter = 0
for i in range(n+1):
  for j in range(m+1):
    for k in range(l+1):
      if i * 500 + j * 100 + k * 50 == h:
        counter += 1
print(counter)

Measured memory_bytes: 3060
import sys
import math
from itertools import permutations
from itertools import combinations

#input = sys.stdin.readline
sys.setrecursionlimit(10**7)
N = int(input())
xys = []
for _ in range(N):
    A = int(input())
    xy = [list(map(int, input().split())) for _ in range(A)]
    xys.append(xy)


ok = [0] * N
maxv = 0
for i in range(2**N):
    flg = 1
    chk = [i>>n & 1 for n in range(N)]
    for ii, xy in enumerate(xys):
        if chk[ii] == 0:
            continue
        for xyi in xy:
            x = xyi[0]
            y = xyi[1]

            if chk[x-1] != y:
                flg = 0
                break
        if flg == 0:
            break
    if flg == 1:
        sumchk = sum(chk)
        if maxv < sumchk:
            maxv = sumchk

print(maxv) 

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

int main() {
  int A,B,C;
  cin >> A >> B >> C;
  if ((A<C && C<B) || (A>C && C>B)){
    cout << "Yes" << endl;
  }
  else{
    cout << "No" << endl;
  }

}

Measured memory_bytes: 256
#include<deque>
#include<queue>
#include<vector>
#include<algorithm>
#include<iostream>
#include<set>
#include<cmath>
#include<tuple>
#include<string>
#include<chrono>
#include<functional>
#include<iterator>
#include<random>
#include<unordered_set>
#include<array>
#include<map>
#include<iomanip>
using namespace std;
typedef long long int llint;
#define mp make_pair
#define mt make_tuple
#define pub push_back
#define puf push_front
#define pob pop_back
#define pof pop_front
#define fir first
#define sec second
#define res resize
#define ins insert
#define era erase
const int mod=1000000007;
const llint big=1e18+10;
const long double pai=3.141592653589793238462643383279502884197;
const long double eps=1e-9;
template <class T,class U>void mineq(T& a,U b){if(a>b){a=b;}}
template <class T,class U>void maxeq(T& a,U b){if(a<b){a=b;}}
llint gcd(llint a,llint b){if(a%b==0){return b;}else return gcd(b,a%b);}
llint lcm(llint a,llint b){return a/gcd(a,b)*b;}
template<class T> void SO(T& ve){sort(ve.begin(),ve.end());}
template<class T> void REV(T& ve){reverse(ve.begin(),ve.end());}
int LBI(vector<int>&ar,int in){return lower_bound(ar.begin(),ar.end(),in)-ar.begin();}
int UBI(vector<int>&ar,int in){return upper_bound(ar.begin(),ar.end(),in)-ar.begin();}
int main(void){
	int n,i;cin>>n;
	llint ans=0;
	vector<int>a(n);for(i=0;i<n;i++){cin>>a[i];}SO(a);
	vector<int>b(n);for(i=0;i<n;i++){cin>>b[i];}SO(b);
	for(int h=28;h>=0;h--){
		llint gen=0;
		for(i=0;i<n;i++){b[i]%=(1<<(h+1));}
		SO(b);
		for(i=0;i<n;i++){
			if(a[i]&(1<<h)){
				llint it=a[i]%(1<<(h+1));
				gen+=n;
				gen-=LBI(b,3*(1<<h)-it);
				gen+=LBI(b,2*(1<<h)-it);
			}else{
				llint it=a[i]%(1<<(h+1));
				gen+=LBI(b,2*(1<<h)-it);
				gen-=LBI(b,(1<<h)-it);
			}
		}
		if(gen%2==1){ans+=(1<<h);}
	}
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 1792
//
//  main.cpp
//  sanpie
//
//  Created by h3037178 on 2017/07/28.
//  Copyright ?? 2017??´ ?????£?????????. All rights reserved.
//

#include <iostream>
#include <algorithm>
using namespace std;
int main(){
    int i[10];
    for(int o=0;o<10;o++){
        cin>>i[o];
    }
    sort(i,i+10);
    cout<<i[9]<<endl<<i[8]<<endl<<i[7]<<endl;
}

Measured memory_bytes: 3132
#include <iostream>
#include <cmath>
#include <algorithm>
using namespace std;
bool cmp(int a,int b){
    return a > b;
}
int main() {
    int n;
    cin>>n;
    int data[n];
    for(int i=0;i<n;i++)
    {
        cin>>data[i];
    }
    sort(data,data+n,cmp);
    long long a1=0,a2=0;
    for(int i=0;i<n-1;i++)
    {
        if(data[i]==data[i+1])
        {
            if(a1==0)
            {
                a1=data[i];
                i++;
            } else
            {
                a2=data[i];
                break;
            }
        }
    }
    cout<<a1*a2<<endl;
}


Measured memory_bytes: 3516
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        String s = sc.next();
        char[] ch = s.toCharArray();
        String[] result = new String[ch.length];
        for (int i = 0; i < s.length(); i++) {
            result[i] = String.valueOf((char) ((ch[i] - 'A' + n) % 26 + 'A'));
        }
        System.out.println(String.join("", result));
    }

}



Measured memory_bytes: 22996
#include <stdio.h>

int main(){
    int n,k;
    char s[53];
    scanf("%d %d",&n,&k);
    scanf("%s",s);
    if(s[k-1]=='A'){
        s[k-1]='a';
    }
    if(s[k-1]=='B'){
        s[k-1]='b';
    }
    if(s[k-1]=='C'){
        s[k-1]='c';
    }

    printf("%s",s);
    return 0;
}

Measured memory_bytes: 128
mod = 998244353
n = gets.to_i
d = gets.split.map{|e| e.to_i}

if d[0] != 0
    puts 0
else
    h = Array.new(n+1,0)
    max = 0
    d.each do |e| 
        h[e] += 1
        max = e if max < e
    end

    if h[0] != 1
        puts 0
    else
        ans = 1
        1.upto(max) do |i|
            ans = (ans * h[i-1] ** h[i]) % mod
        end
        puts ans
    end
end

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

using namespace std;

int main(void) {
  int n;
  while (cin >> n, n) {
    int x, y, h, w, l;
    int ans = 0;
    for (int i = 0; i < n; i++) {
      cin >> x >> y >> h >> w;
      l = x + y + h;

      if (l <= 60 && w <= 2) ans += 600;
      else if (l <= 80 && w <= 5) ans += 800;
      else if (l <= 100 && w <= 10) ans += 1000;
      else if (l <= 120 && w <= 15) ans += 1200;
      else if (l <= 140 && w <= 20) ans += 1400;
      else if (l <= 160 && w <= 25) ans += 1600;
    }

    cout << ans << endl;
  }

  return 0;
}


Measured memory_bytes: 3004
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, srt, end) for (long long i = (srt); i < (long long)(end); i++)
#define VL vector<ll>
#define VS vector<string>
#define VB vector<bool>
#define VP vector<pair<ll,ll>>
#define VVL vector<vector<ll>>
#define VVP vector<vector<pair<ll,ll>>>
#define PL pair<ll,ll>
#define ALL(v) (v).begin(), (v).end()
ll d1[4] = {1, -1, 0, 0};
ll d2[4] = {0, 0, 1, -1};

int main(){
  ll a, b;
  cin >> a >> b;
  cout << (a-1) * (b-1) << endl;
}


Measured memory_bytes: 3608
#include <stdio.h>
void insertionSort(int A[],int N){ // N??????????´??????????0-?????????????????????A
   int i,j,v,l;
   for(i=0;i<N-1;i++){
   		printf("%d ",A[i]);
   }
   printf("%d\n",A[N-1]);
   for (i=1;i<=N-1;i++){ 
     	v = A[i];
     	j = i - 1;
   		while (j >= 0 && A[j] > v){
    		A[j+1] = A[j];
	    	j--;
   			A[j+1] = v;
		}
		for(l=0;l<N;l++){
			if(l!=N-1){
			printf("%d ",A[l]);
			}else{
			printf("%d\n",A[l]);
			}
		}
	}

}

int main(){
	int i,n;
	int num[100];
	scanf("%d",&n);

	for(i=0;i<n;i++){
		scanf("%d",&num[i]);
	}

	insertionSort(num,n);
	return 0;
}

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

int main() {
	int k;cin>>k;
	string s;cin>>s;
	if(s.size()<=k){
		cout<<s<<endl;
	}else{
		for(int i=0;i<k;i++){
			cout<<s[i];
		}
		cout<<"..."<<endl;
	}
	return 0;
}


Measured memory_bytes: 3620
#include<stdio.h>
int main(){
    int h, w, k;
    scanf("%d%d%d",&h,&w,&k);
    char c[h][w];
    for(int i = 0; i < h; i++)
        scanf("%s",c[i]);
    int ans = 0;
    for(int i = 0; i < (1 << h); i++){
        for(int j = 0; j < (1 << w); j++){
            int b = 0;
            for(int l = 0; l < h; l++){
                for(int p = 0; p < w; p++){
                    if(((i >> l) & 1) == 0 && ((j >> p) & 1) == 0 && c[l][p] == '#')
                        b ++;
                }
            }
            if(b == k)
                ans ++;
        }
    }
    printf("%d\n",ans);
    return 0;
}

Measured memory_bytes: 1732
from itertools import accumulate
from bisect import bisect_right

N, M, K = map(int, input().split())
A = [int(i) for i in input().split()]
B = [int(i) for i in input().split()]

ans = 0
m = [0] + list(accumulate(A))
l = list(accumulate(B))
for i, x in enumerate(m):
    if x > K:
        break        
    else:
        ans = max(ans, i + bisect_right(l, K-x))
print(ans)

Measured memory_bytes: 49232
# coding=UTF-8
from collections import deque
from operator import itemgetter
from bisect import bisect_left, bisect
import itertools
import sys
import math
import numpy as np
import time
sys.setrecursionlimit(10**6)
input = sys.stdin.readline


def main():
    n, m = map(int, input().split())
    h = [int(x) for x in input().split()]
    tenbo = [[] for _ in range(n)]
    ans = 0
    for i in range(m):
        a, b = map(int, input().split())
        tenbo[a - 1].append(b)
        tenbo[b - 1].append(a)
    for i in range(n):
        flg = 0
        if len(tenbo[i]) == 0:
            ans += 1
            continue
        for j in tenbo[i]:
            if h[i] <= h[j-1]:
                flg = 1
                break
        if flg == 0:
            ans += 1
    print(ans)


if __name__ == '__main__':
    main()


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

using namespace std;
typedef long long ll;

int main(){
  int n;
  cin >> n;
  vector<int> h(n);
  for(int i=0;i<n;i++) cin >> h[i];

  for(int i=n-1;i>=0;i--) {
    if(h[i]==h[i-1]-1) {
      h[i-1]-=1;
    } else if(h[i]<=h[i-1]-2) {
      cout << "No" << endl;
      return 0;
    }
  }
  cout << "Yes" << endl;
  return 0;
}


Measured memory_bytes: 640
#!/usr/bin/env python3
import sys
import numpy as np


def solve(N: int, p: "List[int]"):
    sorted_list = [i for i in range(1, N + 1)]
    if N - sum(np.array(p) == sorted_list) == 0:
        print("YES")
    elif N - sum(np.array(p) == sorted_list) == 2:
        print("YES")
    else:
        print("NO")


def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word

    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    p = [int(next(tokens)) for _ in range(N)]  # type: "List[int]"
    solve(N, p)


if __name__ == "__main__":
    main()


Measured memory_bytes: 12396
import java.util.*;
import static java.lang.Math.*;
public class Main {
	final Scanner sc=new Scanner(System.in);
	public static void main(String[] args) {
		new Main().init();
	}
	void init(){
		//final long STACK_SIZE=8*1024*1024;
		//new Thread(null, new C(), "RUN", STACK_SIZE).start();
		new C();
	}
	
	class C{
		C(){
			while(sc.hasNext()){
				line=sc.next();
				if(line.equals("#"))	break;
				solve();
			}
		}
		
		String line;
		
		void solve(){
			int LEN=line.length();
			int[] v={-1,0,1,2,0,-1,2,0,1,2};
			
			int[][][][] dp=new int[2][3][3][2];
			for(int i=0; i<2; i++)for(int j=0; j<3; j++)for(int k=0; k<3; k++)for(int m=0; m<2; m++)	dp[i][j][k][m]=1<<29;
			dp[1][2][0][0]=0;
			dp[1][2][0][1]=0;
			
			for(int i=0; i<LEN; i++){
				int idx=i%2,last=(idx==0?1:0),d=v[line.charAt(i)-'0'];
				
				for(int r=0; r<3; r++)for(int l=0; l<3; l++){
					
					// right
					if(l<=d || i==0){
						dp[idx][d][l][0]=min(dp[idx][d][l][0], min(dp[last][r][l][1], dp[last][r][l][0]+1));
					}
					
					// left
					if(d<=r){
						dp[idx][r][d][1]=min(dp[idx][r][d][1], min(dp[last][r][l][0], dp[last][r][l][1]+1));
					}
				}
				
				for(int r=0; r<3; r++)for(int l=0; l<3; l++)for(int j=0; j<2; j++)dp[last][r][l][j]=1<<29;
			}
			
			int ans=1<<29;
			for(int r=0; r<3; r++)for(int l=0; l<3; l++)for(int i=0; i<2; i++)ans=min(ans,dp[LEN%2==0?1:0][r][l][i]);
			
			System.out.println(ans);
		}
	}
}

Measured memory_bytes: 13000
# python template for atcoder1
import sys
sys.setrecursionlimit(10**9)
input = sys.stdin.readline

s = input()
ans = "Yes"
if "W" in s:
    if not "E" in s:
        ans = "No"
if "E" in s:
    if not "W" in s:
        ans = "No"

if "N" in s:
    if not "S" in s:
        ans = "No"
if "S" in s:
    if not "N" in s:
        ans = "No"

print(ans)


Measured memory_bytes: 3060
#include <set>
#include <map>
#include <list>
#include <stack>
#include <cmath>
#include <ctime>
#include <cstdio>
#include <vector>
#include <string>
#include <bitset>
#include <cctype>
#include <cstdlib>
#include <cstring>
#include <utility>
#include <numeric>
#include <complex>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <cassert>
#include <iostream>
#include <iterator>
#include <algorithm>
using namespace std;
typedef long long ll;
const double EPS = 1e-9;
#define rep(i, n) REP(i, 0, n)
#define ALL(v) v.begin(), v.end()
#define MSG(a) cout << #a << " " << a << endl;
#define REP(i, x, n) for(int i = x; i < n; i++)

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);

  string a;
  int count=0;
  cin >> a;
  if(a[0]==a[1] && a[0]!=a[2] && a[2]==a[3]) {
    cout << "Yes" << endl;
  }
  else if(a[0]==a[2] && a[0]!=a[1] && a[1]==a[3]) {
    cout << "Yes" << endl;
  }
  else if(a[0]==a[3] && a[0]!=a[1] && a[1]==a[2]) {
    cout << "Yes" << endl;
  }
  else {
    cout << "No" << endl;
  }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)n;++i)
#define REP(i,a,b) for(int i=int(a);i<(int)b;++i)
#define Graph vector<vecctor<ll>>
#define pairs vector<pair<ll,ll>>
#define pb push_back



using namespace std;
using ll = long long;

template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}





int main(void)
{
    std::cin.tie(nullptr);
    std::ios::sync_with_stdio(false);
    int h,w,k,ans=0;
    cin >> h >> w >> k;
    char masu[h][w];
    rep(i,h){
        rep(j,w){
            cin >> masu[i][j];
        }
    }

    for(int i= 0;i < (1<<h);i++){
        for(int j=0;j < (1<<w);j++){
            int sum=0;
            rep(a,h){rep(b,w){
                if((i & 1<<a) && (j & 1<<b)){
                    if(masu[a][b] == '#'){
                        sum++;
                    }
                }
            }}
            if(sum==k){
                ans ++;
            }

        }
    }

    cout << ans << endl;


    return 0;
   
}


Measured memory_bytes: 3620
import java.util.*;

public class Main{
  public static void main(String[] args){
    Scanner sc=new Scanner(System.in);
    String s="ABCDEF";
    String a=sc.next();
    String b=sc.next();
    if(s.indexOf(a)<s.indexOf(b)){
      System.out.println("<");
    }else if(s.indexOf(a)==s.indexOf(b)){
      System.out.println("=");
    }else if(s.indexOf(a)>s.indexOf(b)){
      System.out.println(">");
    }
  }
}

Measured memory_bytes: 22740
#include <iostream>
#include <iomanip>
#include <utility>
#include <cmath>
#include <random>
#include <vector>
#include <tuple>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <string>
#include <algorithm>
using namespace std;

#define rep(i,n) for(int i = 0; i<n; ++i)
#define REP(i,n) for(int i = 1; i<=n; ++i)
#define all(x) begin(perm),end(perm)
#define showall(obj) for(auto x:obj)cout<<x<<endl;
typedef long long ll;
typedef pair<int,int> ip;
typedef pair<ll,ll> lp;
typedef vector<int> vint;
typedef vector<ll> vll;
const int inf = 100100100;
const ll INF = 1LL<<60;
const int MOD = (int)1e9 + 7;

int main(){
    int h,w;cin>>h>>w;
    vector<vector<char>> g(h,vector<char>(w));
    rep(i,h)rep(j,w)cin>>g[i][j];
    rep(i,h){
        bool ch = true;
        rep(j,w)if(g[i][j] == '#')ch = false;
        if(ch){
            rep(j,w)g[i][j] = '1';
        }
    }
    rep(j,w){
        bool ch = true;
        rep(i,h)if(g[i][j] == '#')ch = false;
        if(ch){
            rep(i,h)g[i][j] = '1';
        }
    }
    rep(i,h){
        bool p = false;
        rep(j,w)if(g[i][j] != '1'){p = true;cout<<g[i][j];}
        if(p)cout<<endl;
    }
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <cmath>
#include <vector>
#include <string>
#include <iomanip>
#include <string.h>
//#include <>
//#define N 200

using namespace std;
long long cmd(long long a , long long  b){
    return a > b;
}

int main()
{
    int N,M;
    cin >>N>>M;
    long NN[N],NNN[N];
    long MM[M],MMM[M];
    for(int i=1;i<=N;i++)
    cin >>NN[i]>>NNN[i];
    for(int i=1;i<=M;i++){
        cin >>MM[i]>>MMM[i];
    }
   // cout<<abs(MM[0]-NN[0])<<endl;
    for(int j=1;j<=N;j++){
        long long sum=999999999,place=0;
        for(int i=1;i<=M;i++){
        if(sum>abs(MM[i]-NN[j])+abs(MMM[i]-NNN[j])){
            sum=abs(MM[i]-NN[j])+abs(MMM[i]-NNN[j]);
            place=i;
            }
        }
        cout<<place<<endl;
    }

    return 0;

}


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

struct ModInt {
    using M = ModInt;

    static vector<M> fact, finv;
    static long long MOD;
    long long v;

    // normalize: [-MOD, MOD**2] -> [0, MOD)
    ModInt(const long long _v = 0) : v((_v < 0) ? _v % MOD + MOD : _v % MOD) {}

    M operator+(const M& x) const { return M(v + x.v); }
    M operator-(const M& x) const { return M(v - x.v); }
    M operator*(const M& x) const { return M(v * x.v); }
    M operator/(const M& x) const { return M(v * x.inv().v); }
    M& operator+=(const M& x) { return *this = *this + x; }
    M& operator-=(const M& x) { return *this = *this - x; }
    M& operator*=(const M& x) { return *this = *this * x; }
    M& operator/=(const M& x) { return *this = *this / x; }
    bool operator==(const M& x) const { return v == x.v; }
    bool operator!=(const M& x) const { return v != x.v; }
    friend istream& operator>>(istream& input, M& x) {
        return input >> x.v, x = M(x), input;
    }
    friend ostream& operator<<(ostream& output, const M& x) {
        return output << x.v;
    }
    inline M pow(long long n) const {
        M x(v), res(1);
        while (n) {
            if (n & 1) res *= x;
            x *= x;
            n >>= 1;
        }
        return res;
    }
    inline M inv() const { return this->pow(MOD - 2); }
    static void build(int n) {
        fact.assign(n + 1, 1);
        for (int i = 1; i < n + 1; i++) fact[i] = fact[i - 1] * M(i);
        finv.assign(n + 1, fact[n].inv());
        for (int i = n; i > 0; i--) finv[i - 1] = finv[i] * M(i);
    }
    static M comb(int n, int k) {
        if (n < k || k < 0) return M(0);
        return fact[n] * finv[n - k] * finv[k];
    }
    static M extgcd(int a, int b, int& x, int& y) {
        M d(a);
        if (b) {
            d = extgcd(b, a % b, y, x);
            y -= (a / b) * x;
        } else {
            x = 1;
            y = 0;
        }
        return d;
    }
};
vector<ModInt> ModInt::fact = vector<ModInt>();
vector<ModInt> ModInt::finv = vector<ModInt>();
long long ModInt::MOD = 1e9 + 7;

vector<int> sieve_of_eratosthenes(int n) {
    vector<int> prime(n + 1, 0);
    for (int i = 2; i <= n; i++) prime[i] = i;
    for (int i = 2; i * i <= n; i++) {
        if (prime[i]) {
            for (int j = 2 * i; j <= n; j += i) prime[j] = 0;
        }
    }
    prime.erase(remove(begin(prime), end(prime), 0), end(prime));
    return prime;
}

int main() {
    int n, k;
    cin >> n >> k;
    // cs[i]: 約数系包除のゼータ変換＝iの倍数になりうる（範囲内の）整数の累積和
    vector<ModInt> cs(k + 1);
    for (int i = 1; i <= k; i++) {
        cs[i] = ModInt(k / i).pow(n);
    }
    // メビウス変換（ゼータ変換の逆）によってcs[i]をちょうどiのみの要素とする
    for (auto p : sieve_of_eratosthenes(k)) {
        for (int i = 1; p * i <= k; i++) {
            cs[i] -= cs[p * i];
        }
    }
    ModInt ans = 0;
    for (int i = 1; i < k + 1; i++) {
        ans += cs[i] * i;
    }
    cout << ans << endl;
}

Measured memory_bytes: 4316
#include<stdio.h>
 
int main(){
		int n,i,j,f=0;
		long long sum=0,a[100000],b[100000];
		scanf("%d",&n);
		for(i=0;i<n;i++){
				scanf("%lld",&a[i]);
		}for(i=0;i<n;i++){
				scanf("%lld",&b[i]);
		}
		long long tmp=0,tmpp=0;
		for(i=0;i<n;i++){
				if(b[i]>a[i])tmp+=(b[i]-a[i])/2;
				if(a[i]>b[i])tmpp+=a[i]-b[i];
		}
		if(tmp>=tmpp)puts("Yes");
		else puts("No");
		return 0;
}

Measured memory_bytes: 384
N, M = map(int, input().split())

anss = []
if N % 2:
    for x in range(1, N+1):
        y = N-x
        if x >= y:
            break
        anss.append((x, y))
else:
    K1 = (N-1)//2
    K2 = K1-1
#    print('K1:', K1, '/ K2:', K2)
    for x in range(1, K1+1):
        y = K1+2-x
        if x >= y:
            break
        anss.append((x, y))
    for x in range(1, K2+1):
        y = K2+2-x
        if x >= y:
            break
        anss.append((K1+1+x, K1+1+y))

print('\n'.join(map(lambda x: str(x[0])+' '+str(x[1]), anss[:M])))


Measured memory_bytes: 28468
#include<cstdio>
#include<iostream>
using namespace std;
int main(void){
	int flg=1,i,max,a,b,mise;
	char s[]="ABCDE";
	while(1){
		max=-1;
		for(i=0;i<5;i++){
			cin>>a;
			cin>>b;
			if(max<a+b){
				mise=i;
				max=a+b;
			}
			if(max==0){
				flg=0;
				break;
			}
		}
		if(flg==0) break;
		cout<<s[mise]<<' '<<max<<endl;
	}
	return 0;
}

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

int main() {
	int a,b,n,T,cas=0;
	string str;
	cin>>str;
	if(str[0] != 'A') return cout<<"WA", 0;
	int cnt=0;
	for(int i=2;i<str.size()-1;++i) {
		if(str[i]=='C') cnt++;
	}
	if(cnt!=1) return cout<<"WA", 0;
	for(int i=1;i<str.size();++i) {
		if(str[i]=='C') continue;
		if(isupper(str[i])) return cout<<"WA", 0;
	}
	return cout<<"AC", 0;
}

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

int main() {
	vector<vector<int>> c(3, vector<int>(3));
	rep(i, 3) rep(j, 3) cin >> c[i][j];
	vector<int> a(3), b(3);
	rep(i, 3) a[i] = c[0][i] - b[0];
	rep(i, 3) b[i] = c[i][0] - a[0];
	bool ok = true;
	rep(i, 3) rep(j, 3) {
		if (b[i] + a[j] != c[i][j]) ok = false;
	}
	if (ok) cout << "Yes" << endl;
	else cout << "No" << endl;
	return 0;
}

Measured memory_bytes: 3624
import sys

input = sys.stdin.readline

n, x = map(int, input().split())
l = list(map(int, input().split()))

count=1

current=0

for _ in range(n):
    current+=l[_]
    count+=1
    if current > x:
        break



if current > x:
    print(count - 1)
else:
    print(count)


Measured memory_bytes: 3064
<?php
$input = file_get_contents('php://stdin');
$inarr = explode("\n", $input);

$nmList = explode(" ", $inarr[0]);
$n = $nmList[0];
$m = $nmList[1];

$numList = array_map(function ($e) {
    return explode(" ", $e);
  }, array_splice($inarr, 1, $m));

$result = array_fill(0, $n, "999");

foreach($numList as $num){
    if($result[$num[0]-1]=="999"){
        $result[$num[0]-1]=$num[1];
    }
    else{
        if($result[$num[0]-1]!=$num[1]){
            echo "-1";
            exit();
        }
    }
}
if($n!="1" and $result[0]=="999"){
    $result[0]="1";
}
if($n!="1" and $result[0]=="0"){
    echo "-1";
    exit();
}
foreach($result as &$num){
    if($num=="999"){
        $num="0";
    }
    echo $num;
}
unset($num);
?>

Measured memory_bytes: 4728
#include<stdio.h>
#include<string.h>

#define M 1000000/* your task*/
#define NIL (-1)
#define L 14

char H[M][L]; /* Hash Table */

int getChar(char ch){
  if ( ch == 'A') return 1;
  else if ( ch == 'C') return 2;
  else if ( ch == 'G') return 3;
  else if ( ch == 'T') return 4;
}

/* convert a string into an integer value */
long long getKey(char str[]){
  long long sum = 0, p = 1, i;
  for ( i = 0; i < strlen(str); i++ ){
    sum += p*(getChar(str[i]));
    p *= 5;
  }
  return sum;
}

int h1(int key){ return key % 2001; }
int h2(int key){ return 1 + (key % 2000); }

int find(char str[]){
  int x = h1(getKey(str));
  int y = h2(getKey(str));

  while(1){
    if(strcmp(H[x],str) == 0) return 1;
    if(strcmp(H[x],"\0") == 0) break;
    x+=y;
  }
  return 0;
}

int insert(char str[]){
  int x = h1(getKey(str));
  int y = h2(getKey(str));

  while(1){
    if(strcmp(H[x],"\0") == 0){
      strcpy(H[x],str);
      return 1;
    }
    x+=y;
  }
  return NIL;
}

int main(){
  int i, n, h;
  char str[L], com[9];
  for ( i = 0; i < M; i++ ) H[i][0] = '\0';
    scanf("%d", &n);

  for ( i = 0; i < n; i++ ){
    scanf("%s %s", com, str);

    if ( com[0] == 'i' ){
      insert(str);
    } else {
      if (find(str)){
        printf("yes\n");
      } else {
        printf("no\n");
      }
    }
  }

  return 0;
}

Measured memory_bytes: 14280
import java.util.*;
 
public class Main {
    private static final int INF = 1_000_000_001;
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int M = sc.nextInt();
        int L = sc.nextInt();
        int[][] g = new int[N][N];
        for (int i = 0; i < N; i++) {
            for (int j = 0; j < N; j++) {
                if (i == j) {
                    g[i][j] = 0;
                } else {
                    g[i][j] = INF;
                }
            }
        }
        for (int i = 0; i < M; i++) {
            int A = sc.nextInt();
            int B = sc.nextInt();
            int C = sc.nextInt();
            g[A-1][B-1] = C;
            g[B-1][A-1] = C;
        }

        for (int k = 0; k < N; k++) {
            for (int i = 0; i < N; i++) {
                for (int j = 0; j < N; j++) {
                    g[i][j] = Math.min(g[i][j], g[i][k] + g[k][j]);
                }
            }
        }

        int[][] l = new int[N][N];
        for (int i = 0; i < N; i++) {
            for (int j = 0; j < N; j++) {
                if (i == j) {
                    l[i][j] = 0;
                } else if (g[i][j] <= L) {
                    l[i][j] = 1;
                } else {
                    l[i][j] = INF;
                }
            }
        }
        for (int k = 0; k < N; k++) {
            for (int i = 0; i < N; i++) {
                for (int j = 0; j < N; j++) {
                    l[i][j] = Math.min(l[i][j], l[i][k] + l[k][j]);
                }
            }
        }


        int Q = sc.nextInt();
        long[] ans = new long[Q];
        for (int q = 0; q < Q; q++) {
            int s = sc.nextInt();
            s--;
            int t = sc.nextInt();
            t--;
            if (l[s][t] == INF) {
                ans[q] = -1;
            } else {
                ans[q] = l[s][t]-1;
            }
        }

        for (long a : ans) {
            System.out.println(a);
        }
    }
}


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

int main(){

  while(1){

    int n, p, c, r, yamahuda[51] = {0}, ue[51] = {0}, shita[51] = {0}, cnt = 1;

    cin >> n >> r;
    if(n == 0 && r == 0) break;

    for(int i = n; i >= 1; i--){
      yamahuda[n-i+1] = i;
    }

    for(int i = 1; i <= r; i++){
      cin >> p >> c;
      for(int j = 1; j < p; j++){
	ue[j] = yamahuda[j];
	//cout << ue[j];
      }
      //cout << endl;
      cnt = 1;
      for(int s = p; s < p+c; s++){
	shita[cnt] = yamahuda[s];
	//	cout << shita[cnt];
	//cout << cnt;
	cnt++;
      }
      //cout << endl;
      // cnt = 1;
      for(int l = 1; l < cnt; l++){
	yamahuda[l] = shita[l];
	//	cout << shita[l];
      }
      //  cout << endl;
      
      for(int m = 1; m < p; m++){
	yamahuda[cnt] = ue[m];
	cnt++;
      }
      // for(int k = 1; k <= n; k++) cout << yamahuda[k];
      //cout << endl;
    }
     cout << yamahuda[1] << endl;
   
    
  }

  return 0;
} 

Measured memory_bytes: 1160
#include <bits/stdc++.h>
using namespace std;
#define FOR(ii, ss, ee) for(ll ii = (ss); ii <= (ll)(ee); ++ii)
#define DEC(ii, ss, ee) for(ll ii = (ss); ii >= (ll)(ee); --ii)
#define VALS(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }
#define IAMSPEED ios_base::sync_with_stdio(false); cin.tie(0);
#define pb push_back
#define pf push_front
#define INF 1234567890ll
#define EPS (1e-7)
#define PI (acos((ld)-1.0))
#define ll long long int 
#define ld long double
#define all(x) (x).begin(), (x).end()
#define f first
#define s second
typedef pair <int, int> pi;
void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) { cerr << *it << " = " << a << '\n'; err(++it, args...);}
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
string lts(ll x){stringstream s; s << x; return s.str(); }
ll stl(string x){stringstream s(x); ll temp; s >> temp; return temp; }
const int MOD = 1e9 + 7;
int A[100005], dp[100005];
int main()
{
	IAMSPEED
	int n,k; cin >> n >> k;
	FOR(i,1,n) {
		cin >> A[i];
	}
	fill(dp,dp+n+1,INF);
	dp[1] = 0;
	FOR(i,2,n) {
		if (i == 2) dp[i] = abs(A[2]-A[1]);
		else {
			DEC(j,i-1,max(i-k,(ll)1)) {
				dp[i] = min(dp[j] + abs(A[i]-A[j]), dp[i]);
			}
		}
	}
	cout << dp[n];
}

Measured memory_bytes: 1024
#include <iostream>
#include <vector>
#include <algorithm>
#include <random>
#include <map>

#define show(x) cerr << #x << " = " << x << endl

using namespace std;
using ll = long long;

template <typename T>
ostream& operator<<(ostream& os, const vector<T>& v)
{
    os << "sz:" << v.size() << "\n[";
    for (const auto& p : v) {
        os << p << ",";
    }
    os << "]\n";
    return os;
}


int main()
{
    ll N, M, L;
    cin >> N >> M >> L;
    uniform_int_distribution<ll> kdist{1, M};
    vector<ll> K(N);
    for (int i = 0; i < N; i++) {
        cin >> K[i];
        K[i]--;
    }
    vector<ll> S(M);
    vector<ll> sum(M);
    for (int i = 0; i < M; i++) {
        cin >> S[i];
        sum[i] = ((i > 0) ? sum[i - 1] : 0) + S[i];
    }
    sort(K.begin(), K.end());
    vector<vector<ll>> dist(N, vector<ll>(N, 0));
    for (int i = 0; i < N; i++) {
        for (int j = 0; j < N; j++) {
            ll l = min(K[i], K[j]);
            ll r = max(K[i], K[j]);
            dist[i][j] = (sum[r] - ((l > 0) ? sum[l - 1] : 0)) / L;
        }
    }
    constexpr ll INF = 1LL << 60;

    vector<ll> prev(N, INF);
    prev[0] = 0;
    for (int i = 0; i < N - 1; i++) {
        vector<ll> dp(N, INF);
        for (int j = 0; j <= i; j++) {
            dp[i] = min(dp[i], prev[j] + dist[j][i + 1]);
            dp[j] = min(dp[j], prev[j] + dist[i][i + 1]);
        }
        prev = dp;
    }
    ll mini = INF;
    for (int j = 0; j < N - 1; j++) {
        mini = min(mini, prev[j] + dist[j][N - 1]);
    }
    cout << mini << endl;

    return 0;
}

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

struct Process {
  string name;
  int time;
};

Process Queue[101000];
int head, tail;

void enqueue(Process x) {
  Queue[tail] = x;
  tail = (tail + 1) % 101000;
}

Process dequeue() {
  Process x = Queue[head];
  head = (head + 1) % 101000;
  return x;
}

int Min(int a, int b) {
  if (a < b) return a;
  return b;
}

int main() {
  int n, q;
  cin >> n >> q;
  for (int i = 0; i < n; i++) {
    cin >> Queue[i].name >> Queue[i].time;
  }
  head = 0, tail = n;

  int ans = 0;
  while (head != tail) {
    Process tmp = dequeue();
    int val = Min(q, tmp.time);
    tmp.time -= val;
    ans += val;
    if (tmp.time > 0) enqueue(tmp);
    else cout << tmp.name << " " << ans << endl;
  }
  
  return 0;  
}


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

#define REP(i, a, b) for (int i = (a); i < (b); i++)
#define REPR(i, a, b) for (int i = (a); i >= (b); i--)
#define ALL(container) (container).begin(), (container).end()

using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef pair<int, int> pi;
typedef pair<ll, ll> pll;

const int INF = 1e9;

int main() {
  int N;
  string s;
  cin >> N >> s;
  int red_count = 0;

  REP(i, 0, N) {
    if (s[i] == 'R') {
      red_count++;
    }
  }

  if (red_count > N - red_count) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }

  return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <vector>
#include <queue>
#include <map>
#include <set>
#include <algorithm>
#include <cassert>

using namespace std;
typedef long long LL;
typedef pair<int,int> pii;

const int MAXN = 3e5 + 1;
const int MOD = 1e9 + 7;
#define pb push_back
#define eb emplace_back
#define fi first
#define se second
#define FAILNO {printf("NO\n"); return 0;}
#define FAIL1 {printf("-1\n"); return 0;}

vector<pii> edges;
vector<pii> V;

int main() {
#ifdef OJ
	freopen("input.txt", "rt", stdin);
	//freopen("output.txt", "wt", stdout);
#endif

	int N;
	scanf("%d", &N);

	int odd = N%2;

	if (odd) N--;
	for (int i = 1, j = N; i < j; i++, j--) {
		V.eb(i,j);
	}

	for (int i = 0; i < (int)V.size(); i++) {
		for (int j = i+1; j < (int)V.size(); j++) {
			edges.eb(V[i].fi, V[j].fi);
			edges.eb(V[i].fi, V[j].se);
			edges.eb(V[i].se, V[j].fi);
			edges.eb(V[i].se, V[j].se);
		}
	}

	if (odd) {
		for (int i = 0; i < (int)V.size(); i++) {
			edges.eb(V[i].fi, N+1);
			edges.eb(V[i].se, N+1);
		}
	}

	printf("%d\n", (int)edges.size());
	for (auto e: edges) printf("%d %d\n", e.fi, e.se);
	return 0;
}


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

using namespace std;
typedef long long ll;
typedef pair<int,int> P;

//マクロ
#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=(ll)(n)-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=(a);i<=(b);i++)
#define FORD(i,a,b) for(ll i=(a);i>=(b);i--)
#define ALL(x) (x).begin(),(x).end() //sortなどの引数を省略したい
#define SIZE(x) ((ll)(x).size()) //sizeをsize_tからllに直しておく
#define MAX(x) *max_element(ALL(x))
#define INF 1000000000000 //10^12
#define MOD 10000007 //10^9+7
#define PB push_back
#define MP make_pair
#define F first
#define S second

int main(int argc, char const *argv[]) {
    string s;
    cin >> s;
    FOR(i,1,SIZE(s)-1)
    {
        if (s[i] == s[i-1])
        {
            cout << "Bad" << endl;
            return 0;
        }
    }
    cout << "Good" << endl;
    return 0;
}


Measured memory_bytes: 256
#ABC 108 B
x1, y1, x2, y2 = map(int, input().split())
x3 = x2 + y1-y2
y3 = y2 + x2-x1
x4 = x1 + y1-y2
y4 = y1 + x2-x1
print(" ".join(map(str, [x3, y3, x4, y4])))

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

int main(){
  string s;
  ll k;
  cin >> s >> k;
  int pos = 0;
  int len = (int)s.length();
  for(int i = 0; i < len; ++i){
    if((s[i] - '0') > 1){
      pos = i;
      break;
    }
  }
  if(k < (ll)(pos + 1)) cout << '1' << '\n';
  else cout << s[pos] << '\n';
}

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

string S;
int N;

void input() {
    cin >> N;
    cin >> S;
}

void solve() {
    input();
    string tmp = "No";
    int K = N / 2;
    if(N % 2 == 0 && S.substr(0, K) == S.substr(K, K)) tmp = "Yes";
    cout << tmp << endl;
    return;
}

int main() {
    solve();
    return 0;
}


Measured memory_bytes: 3608
/**
 * Author: Martin Leshko (leshko.martin@gmail.com)
 */

#include <bits/stdc++.h>
#define F0R(i, n) for (decltype(n) i = 0; i < (int)(n); i++)
#define FOR(i, n) for (decltype(n) i = 1; i <= (int)(n); i++)
#define FUR(i, a, b) for (decltype(a) i = (a); i < (b); i++)
#define trav(i, a) for (auto& i: a)
#define sz(x) (int)x.size()
#define psb push_back
#define all(a) (a).begin(), (a).end()
template<class T> void re(T& x) { std::cin >> x; }
template<class T, class... Ts> void re(T& t, Ts&... ts) { re(t); re(ts...); }
void pr(int x) { std::cout << x; }
void pr(long long x) { std::cout << x; }
void pr(float x) { std::cout << x; }
void pr(double x) { std::cout << x; }
void pr(char x) { std::cout << x; }
void pr(const char* x) { std::cout << x; }
void pr(const std::string& x) { std::cout << x; }
template<class T> void pr(const T& x);
template<class T, class... Ts> void pr(const T& t, const Ts&... ts) {  pr(t); pr(ts...); }
void ps() { std::cout << "\n"; }

using namespace std;
using ll = long long;
using vi = vector<int>;
using pii = pair<int, int>;

int main() {
  ios::sync_with_stdio(false); cout.tie(0);
  ll n; re(n); int t = 0; FOR(i, n) { int x; re(x); t ^= x; } pr(t ? "No" : "Yes");
  return 0;
}

Measured memory_bytes: 256
// 基本テンプレート
 
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <cfloat>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <fstream>
#include <functional>
using namespace std;
 
#define rep(i,a,n) for(int (i)=(a); (i)<(n); (i)++)
#define repq(i,a,n) for(int (i)=(a); (i)<=(n); (i)++)
#define repr(i,a,n) for(int (i)=(a); (i)>=(n); (i)--)
#define int long long int
 
template<typename T> void chmax(T &a, T b) {a = max(a, b);}
template<typename T> void chmin(T &a, T b) {a = min(a, b);}
template<typename T> void chadd(T &a, T b) {a = a + b;}
 
typedef pair<int, int> pii;
typedef long long ll;
 
int dx[] = {0, 0, 1, -1};
int dy[] = {1, -1, 0, 0};
const ll INF = 1001001001001001LL;
const ll MOD = 1000000007LL;

int N;
double dp[410][410][410];
int cnt[4];

double solve(int x, int y, int z) {
    // メモ化しよう
    if(dp[x][y][z] != -1) return dp[x][y][z];
    dp[x][y][z] = 0;
    // 2 枚以下しか持っていないものが出るまで引く回数の期待値
    double exp_num = 1.0 * N / (N - z);
    // (先の期待値) * (それを引く確率) の足しあわせ
    if(x != N) dp[x][y][z] += (solve(x+1, y, z) + exp_num) * (N - x) / (N - z);
    if(y != x) dp[x][y][z] += (solve(x, y+1, z) + exp_num) * (x - y) / (N - z);
    if(z != y) dp[x][y][z] += (solve(x, y, z+1) + exp_num) * (y - z) / (N - z);
    return dp[x][y][z];
}
 
signed main() {
    cin >> N;
    repq(i,0,N) repq(j,0,N) repq(k,0,N) dp[i][j][k] = -1;
    dp[N][N][N] = 0;

    
    for(int i = 0; i < N; i++){
        int a; cin >> a;
        cnt[3 - a]++;
    }

    repr(i,2,0) {
        cnt[i] += cnt[i+1];
    }

    //cout << cnt[1] << " " << cnt[2] << " " << cnt[3] << endl;
    printf("%.12f\n", solve(cnt[1], cnt[2], cnt[3]));
    return 0;
}

Measured memory_bytes: 395264
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {

    public static void main(String[] args) throws IOException {

        BufferedReader std = new BufferedReader(new InputStreamReader(System.in));
        
        double r = Double.parseDouble(std.readLine());
        
        double b = Math.PI * r * r;
        double c = 2 * Math.PI * r;
        
        System.out.printf("%.5f %.5f\n", b,c);
        
    }
}

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

using namespace std;

string s;

int main() {
#if DEBUG
    freopen("in.txt", "r", stdin);
#endif
    ios::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
    cin >> s;
    int pos = (int)s.size();
    string prev;
    int ans = 0;
    while (pos > 0) {
        bool ok = false;
        for (int i = 1; i <= pos; ++i) {
            string can = s.substr(pos - i, i);
            if (can == prev) continue;
            else {
                prev = can;
                pos -= i;
                ok = true;
                break;
            }
        }
        if (ok) ++ans;
        else {
            prev += s[pos];
            --pos;
        }
    }
    cout << ans << '\n';
}


Measured memory_bytes: 720
#!python3

# input
s = input()
t = input()


def main():
    sn, tn = len(s), len(t)
    dp = [[0] * (tn + 1) for _ in range(sn + 1)]
    w = [[None] * (tn + 1) for _ in range(sn + 1)]
    for i in range(1, sn + 1):
        for j in range(1, tn + 1):
            if s[i - 1] == t[j - 1]:
                dp[i][j] = dp[i - 1][j - 1] + 1
                w[i][j] = s[i - 1]
            else:
                dp[i][j] = max(dp[i][j - 1], dp[i - 1][j])
    ans = []
    i, j = sn, tn
    while i != 0 and j != 0:
        if s[i - 1] == t[j - 1]:
            ans.append(w[i][j])
            i, j = i - 1, j - 1
        else:
            if dp[i][j - 1] < dp[i - 1][j]:
                i -= 1
            else:
                j -= 1
    print("".join(ans[::-1]))


if __name__ == "__main__":
    main()


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

int main() {
  int n, k, q;
  cin >> n >> k >> q;
  vector<int> p(n);
  for (int i = 0; i < q; ++i) {
    int a;
    cin >> a;
    ++p[a - 1];
  }
  for (int i = 0; i < n; ++i) {
    if (k - (q - p[i]) > 0)
      cout << "Yes\n";
    else
      cout << "No\n";
  }

  return 0;
}


Measured memory_bytes: 1024
#include <stdio.h>

int main () {
    
    
    int a;
    int b;
    scanf("%d%d", &a,&b);
    
    if(a>=10) {
        printf("%d", b);
    }
    else if(a<10) {
        printf("%d",b+(100*(10-a)));
    }
    
    
    
    
    return 0;
}

Measured memory_bytes: 1704
#include <bits/stdc++.h>
#define repr(i,a,b) for(int i=a;i<b;i++)
#define rep(i,n) for(int i=0;i<n;i++)
#define reprrev(i,a,b) for(int i=b-1;i>=a;i--) // [a, b)
#define reprev(i,n) reprrev(i,0,n)
#define _GLIBCXX_DEBUG

using ll = long long;
using ull = unsigned long long;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
const ll mod = 1e9+7;
void chmod(ll &M){
  if(M >= mod) M %= mod;
  else if(M < 0){
     M += (abs(M)/mod + 1)*mod;
    M %= mod;
}
}
ll modpow(ll x, ll n){
   if(n==0) return 1;
  ll res=modpow(x, n/2);
 if(n%2==0) return res*res%mod;
else return res*res%mod*x%mod;
}
int getl(int i, int N) { return i==0? N-1:i-1; };
int getr(int i, int N) { return i==N-1? 0:i+1; };
long long GCD(long long a, long long b) {
  if (b == 0) return a;
  else return GCD(b, a % b);
}

using namespace std;
/* <-----------------------------------------------------------------------------------> */
/* <-----------------------------------------------------------------------------------> */
/* <-----------------------------------------------------------------------------------> */
/* <-----------------------------------------------------------------------------------> */
int main()
{
    int K;
    cin >> K;
    string S;
    cin >> S;
    if(S.size() <= K) {
        cout << S << "\n";
    }
    else cout << S.substr(0, K) << "...\n";
    
}

Measured memory_bytes: 3632
#include<stdio.h>

int main()
{
    int a,b;
    int area = 0, perimeter = 0;
    
    scanf("%d %d", &a, &b); fflush(stdin);
    area = a*b;
    perimeter = 2*(a+b);
    printf("%d %d\n", area, perimeter);
}


Measured memory_bytes: 2076