akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <string>
#include <algorithm>
using namespace std;

string plus_string(string a, string b){
	string c;
	reverse( a.begin() , a.end() );
	reverse( b.begin() , b.end() );
	while( a.size() != b.size() ){
		if( a.size() < b.size() ){
			a.push_back('0');
		}else{
			b.push_back('0');
		}
	}
	for(int i=0 ; i < a.size() ; i++ ){
		c.push_back('0');
	}
	int n=0;
	for(int i=0 ; i < a.size() ; i++ ){
		if( n+a[i]+b[i]-'0'-'0' <= 9 ){
			c[i] = a[i] + b[i] - '0' + n;
			n = 0;
		}else{
			c[i] = a[i] + b[i] - '0' - 10 + n;
			n = 1;
		}
	}
	if( n == 1 ){
		c.push_back( '1' );
	}
	reverse( c.begin() , c.end() );
	return c;
}

string change_X(string s, char c){
	for(int i=0 ; i < s.size() ; i++ ){
		if( s[i] == 'X' ){
			s[i] = c;
		}
	}
	return s;
}

void solve(string s){
	string num1, num2, num3, a, b, c;
	int plus, equal;
	for(int i=0 ; i < s.size() ; i++ ){
		if( s[i] == '+' )
			plus = i;
		if( s[i] == '=' )
			equal = i;
	}
	num1 = s.substr( 0 , plus );
	num2 = s.substr( plus+1 , equal-plus-1 );
	num3 = s.substr( equal+1 );
	for(int i=0 ; i <= 9 ; i++ ){
		a = change_X( num1 , i+'0' );
		b = change_X( num2 , i+'0' );
		c = change_X( num3 , i+'0' );
		if( plus_string( a , b ) == c ){
			cout << i << endl;
			return;
		}
	}
	cout << "NA" << endl;
}

int main(){
	string s;
	while( cin >> s ){
		solve( s );
	}
}

Measured memory_bytes: 1200
#include <iostream>
#include <vector>
using namespace std;
int main(){
  int n;
  while(cin >> n, n){
    vector<string> name(n);
    vector<int> D(30, 0);
    vector< vector<int> > T(n);
    for(int i = 0; i < n; ++i){
      int m;
      cin >> name[i] >> m;
      for(int j = 0; j < m; ++j){
        int d;
        cin >> d;
        ++D[d];
        T[i].push_back(d);
      }
    }
    vector<int> P(n, 0);
    for(int i = 0; i < n; ++i){
      for(int j = 0; j < T[i].size(); ++j){
        int d = T[i][j];
        P[i] += n - D[d] + 1;
      }
    }
    int id = 0;
    for(int i = 0; i < n; ++i){
      if(P[i] < P[id]) id = i;
      else if(P[i] == P[id] && name[i] < name[id])  id = i;
    }
    cout << P[id] << " " << name[id] << endl;
  }
  return 0;
}



Measured memory_bytes: 3200
#include<bits/stdc++.h>
/*
CE 头文件 
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<iostream>
#include<string>
#include<vector>
#include<stack>
#include<bitset>
#include<cstdlib>
#include<cmath>
#include<set>
#include<list>
#include<deque>
#include<map>
#include<queue>

*/
using namespace std;
#define rep(i,a,n) for (int i=a;i<=n;i++)
#define per(i,a,n) for (int i=n;i>=a;i--)
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define SZ(x) ((int)(x).size())
#define mem(a,b) memset(a,b,sizeof (a))
#define ios std::ios::sync_with_stdio(false); std::cin.tie(0); std::cout.tie(0);
// ios和scanf,printf不能混用.即用ios必须全部cin,cout. 
typedef vector<int> VI;
typedef long long ll;
typedef pair<int,int> PII;
const ll mod=1000000007;

ll ksm(ll a,ll b){ll res=1;a%=mod;for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
const int N=110;
PII a[N];
int n;
int main(){
	scanf("%d",&n);
	rep(i,1,n){
		scanf("%d%d",&a[i].first,&a[i].se);
	}
	bool f=false;
	rep(i,1,n){
		if(i+2<=n){
			if(a[i].fi==a[i].se&&a[i+1].first==a[i+1].se&&a[i+2].first==a[i+2].se){
				f=true;
				break;
			}
		}
	}
	if(f)puts("Yes");
	else puts("No");
    return 0;
}

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

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

  int ans = 1;
  while (ans*2 <= n) ans*=2;
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int[] x = new int[n];
		int[] y = new int[n];
		for (int i = 0; i < n; i++) {
			x[i] = sc.nextInt();
			y[i] = sc.nextInt();
		}
		sc.close();

		double sum = 0;
		for (int i = 0; i < n; i++) {
			for (int j = 0; j < n; j++) {
				sum += Math.sqrt(Math.pow(x[i] - x[j], 2) + Math.pow(y[i] - y[j], 2));
			}
		}
		System.out.println(sum / n);
	}
}


Measured memory_bytes: 25044
#include<bits/stdc++.h>
using namespace std;
int main()
{
	string n;
	int a;
	cin>>n;
	a=n.length();
	for(int i=0;i<a;i++)
	{
		if(n[i]=='9')
		{
			cout<<"Yes"<<endl;
			return 0;
		}
	}
	cout<<"No"<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <bits/stdc++.h>
using namespace std;
int main(void){
    int N;
    cin>>N;
    vector<int> t(N);
    vector<int> x(N);
    vector<int> y(N);
    for(int i=0;i<N;i++){
        cin>>t.at(i)>>x.at(i)>>y.at(i);
    }
    int t0=0;
    int x0=0;
    int y0=0;
    int flag=0;
    for(int i=0;i<N;i++){
        if(abs(x.at(i)-x0)+abs(y.at(i)-y0) > (t.at(i)-t0) || ((t.at(i)-t0)-(abs(x.at(i)-x0)+abs(y.at(i)-y0)))%2==1){
            flag ++;
            break;
        } 
        t0=t.at(i);
        x0=x.at(i);
        y0=y.at(i);
    }
    if(flag==1){
        cout << "No" << endl;
    }
    else{
        cout << "Yes" << endl;
    }
}

Measured memory_bytes: 1408
#include <iostream>
#include <algorithm>
#include <cstring>

using namespace std;

char A[2000][2000];
int D[2000][2000];

int main() {
    ios::sync_with_stdio(false);
    cin.tie(NULL);
    
    int n, m; cin >> n >> m;
    for(int i = 0; i < n; ++i)
        for(int j = 0; j < m; ++j)
            cin >> A[i][j];
    for(int i = 0; i < n; ++i) {
        int j = 0;
        while(j < m) {
            int rx = 0;
            while(j < m && A[i][j] == '.') {
                rx += 1;
                j += 1;
            }
            
            for(int l = j - rx; l < j; ++l)
                D[i][l] = rx;
            j += 1;
        }
    }
    
    for(int j = 0; j < m; ++j) {
        int i = 0;
        while(i < n) {
            int rx = 0;
            while(i < n && A[i][j] == '.') {
                rx += 1;
                i += 1;
            }
            
            for(int l = i - rx; l < i; ++l)
                D[l][j] += rx;
            i += 1;
        }
    }
    
    int mx = 0;
    for(int i = 0; i < n; ++i)
        for(int j = 0; j < m; ++j)  
            mx = max(mx, D[i][j]);

    cout << mx - 1;

    return 0;
}

Measured memory_bytes: 19840
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define rep(i,n) for(int i = 0; i < n; i++)
#define IOS std::ios::sync_with_stdio(false);cin.tie(0); cout.tie(0);
const int N = 1e6+20;
const ll Mod = 1e5;
const int INF = 0x3f3f3f3f;
int main(){
  int n,m;
  cin>>n>>m;
  string s;
  cin>>s;
  m--;
  if(s[m] == 'A'){
    s[m] = 'a';
  }else if(s[m] == 'B'){
    s[m] = 'b';
  }else if(s[m] == 'C'){
    s[m] = 'c';
  }
cout<<s<<endl;


	return 0;
}


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

int main() {
  int n;
  cin >> n;
  int a, b, c;
  a = n / 100;
  b = (n / 10) % 10;
  c = n % 10;
  if (a == 7 || b == 7 || c == 7) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
}

Measured memory_bytes: 3624
#include <cmath>
#include <iomanip>
#include <iostream>

using namespace std;

int main() {
    const double pi = 3.14159265358979323846264338327950288;

    double a, b, x;
    cin >> a >> b >> x;

    if (x / a < a * b / 2) {
        cout << setprecision(12) << fixed << 90.0 - atan(2 * x / (a * b * b)) * 180.0 / pi << endl;
    } else if (x / a == a * b / 2) {
        cout << setprecision(12) << fixed << 45.0 << endl;
    } else {
        cout << setprecision(12) << fixed << atan((2 * (a * b - x / a)) / (a * a)) * 180.0 / pi << endl;
    }
}


Measured memory_bytes: 256
N,K=map(int,input().split())
table=[[0]*K for i in range(K)]#W=1
C=0
for i in range(N):
    x,y,z=input().split()
    x = int(x)
    y=int(y)
    if z=='B':
        y +=K
    x %=(2*K)
    y %=(2*K)
    t = (x//K +y//K)%2
    x%= K
    y%=K
    if t:
        table[y][x]-=1
    else:
        table[y][x]+=1
        C+=1
B=N-C
#print(table)
pr=[[0]*(K+1) for i in range(K)]
for i in range(K):
    for j in range(K):
        pr[j][i+1]=pr[j][i]+table[j][i]
#print(pr)
pr2=[[0]*(K+1) for i in range(K+1)]
for j in range(K):
    for i in range(K):
        pr2[j+1][i+1]=pr2[j][i+1]+pr[j][i+1]
#print(pr2)
ans = 0
for i in range(K+1):
    for j in range(K+1):
        #s=pr2[K][K]-pr2[i-1][K] -pr2[K][j-1]+2*pr2[i-1][j-1]
        s =pr2[i][K] +pr2[K][j]-2*pr2[i][j]
        #白で塗った時に差し引き難点もらえるか
        #t=pr2[K][K]-s#黒で塗る
        #print(s,t,s-t,C-s)
        ans = max(ans,C-s,B+s)
print(ans)


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

int main(){

	int room[4][3][10];
	int b,f,r,v;

	for (b=0; b<4; b++){
		for (f=0; f<3; f++){
			for (r=0; r<10; r++){
				room[b][f][r]=0;
			}
		}
	}
	
	int n;
	cin >>n;
	
	for (int i=0; i<n; i++){
		int x,y,z,w;
		cin >> x >> y >> z >> w ;
		for (b=0; b<4; b++){
			for (f=0; f<3; f++){
				for (r=0; r<10; r++){
					if (b==x-1 && f==y-1 && r==z-1) room[b][f][r]+=w;
					if (room[b][f][r]<0) room[b][f][r]=0;
				}
			}
		}		
	}

	for (b=0; b<4; b++){
		for (f=0; f<3; f++){
			for (r=0; r<10; r++){
				if (room[b][f][r]==0) cout << " " << 0 ;
				else cout << " " << room[b][f][r] ;
			}
			cout << "\n";
		}
		if (b!=3) cout << "####################" << "\n";
	}

	return 0;
}

Measured memory_bytes: 1164
# import sys
# import math #sqrt,gcd
# import decimal
# import queue # queue
# import bisect
# import heapq # priolity-queue
# import time
# from itertools import permutations #順列生成
# import collections # deque
# from operator import itemgetter
# from fractions import Fraction

mod = int(1e9+7)
INF = 1<<29
lINF = 1<<35

def readInt():
    return list(map(int,input().split()))

def main():
    n = input()
    for i in range(3):
        if n[i]=='7':
            print("Yes")
            return
    print("No")
    return

if __name__=='__main__':
    main()

Measured memory_bytes: 61672
n, y = map(int, input().split())
ans = "-1 -1 -1"

for i in range(n+1):
    for j in range(n+1):
        k = n - i - j
        if (k >= 0):
            if (y == i * 10000 + j * 5000 + k * 1000):
                ans = str(i) + " " + str(j) + " " + str(k)

print(ans)


Measured memory_bytes: 3060
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <numeric>

using namespace std;

bool kaibun(string s){
    size_t len = s.length();
    for(int i = 0; i < len/2; i++){
        if(s[i] != s[len-i-1]) return false;
    }
    return true;
}

int main(){
    string s;
    cin >> s;
    if(s[0]==s[1] and s[1]==s[2]){
        cout << "No" <<endl;
    }else{
        cout << "Yes" << endl;
    }

    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
int main(){
	int cin = 0, set = 0, readed;
	for(int i = 0; i < 3; ++i){
		scanf("%d", &readed);
		if(readed == 5) cin++;
		if(readed == 7) set++;
	}
	if(cin == 2 && set == 1){
		printf("YES");
	}else printf("NO");
}

Measured memory_bytes: 128
n,k=[int(x) for x in input().split()]
ok=[]
for i in range(k):
  d_i=int(input())
  a_i=[int(x) for x in input().split()]
  for a in a_i:
    ok.append(a)

bad=[]
for i in range(1,n+1):
  if i not in ok:
    bad.append(i)

print(len(bad))

Measured memory_bytes: 9188
#include"bits/stdc++.h"

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define REP(i, n) for (int i = 1; i <= (int)(n); i++)
#define all(v) v.begin(), v.end()
using namespace std;
using ll = long long;
using pi = pair<int, int>;
const ll INF = 1LL << 60;


int main() {
    int a,index=0;
    string b, c;
    bool ans = false;
    cin >> a >> b >> c;
    index = a;
    rep(i, a) {
        ans = true;
        for (int j = 0; j < a - i; j++) {
            if (b[i + j] != c[j]) {
                ans = false;
                break;
            }
        }
        if (ans)break;
        else index ++;
    }
    cout << index << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll INF = 1e18,MOD = 1e9 + 7;
const int INT_INF = 1e9,INT_MOD=1e9+7;
#define rep(i, N) for(int i = 0; i < N; i++)
typedef pair<int, int> Pi;
typedef pair<double, double> P;
signed main(){
    string s;
    cin>>s;
    if(s[2]==s[3] and s[4]==s[5]){
        cout<<"Yes"<<endl;
        return 0;
    }
    cout<<"No"<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
int main(){
  int n,flag;
  char s[100+1]={0}, t[100+1]={0};
  scanf("%d",&n);
  scanf("%s%s",s,t);
  for(int i=0; i<n; i++){
    for(int j=i,k=0; j<n; j++,k++){
      if( s[j]!=t[k] ){ flag=0; break; }
      flag=k+1;
    }
	if( flag ){ break; }
  }
  printf("%d", n+n-flag);
  return 0;
}

Measured memory_bytes: 1672
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.HashMap;
 
 
 
 class Main{
      
    static long aa[][];//
    static int n;
    static long max=Long.MIN_VALUE;
    
     public static void main(String args[]){
         BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
         
         try{
             String line;
             line=br.readLine();n=Integer.parseInt(line);
             aa=new long[n][n];//y-x
             for(int i=0; i<n;i++){String spl[] = br.readLine().split(" ");
                for(int j=0;j<n;j++){
                    if(i==0){if(j==0)aa[i][j]=(long)Integer.parseInt(spl[j]);
                        else aa[i][j]=aa[i][j-1]+(long)Integer.parseInt(spl[j]);
                    }else{
                        if(j==0)aa[i][j]=aa[i-1][j]+(long)Integer.parseInt(spl[j]);
                        else aa[i][j]=(long)Integer.parseInt(spl[j])+aa[i-1][j]+aa[i][j-1]-aa[i-1][j-1];
                    }
             }}
             
             /*System.out.println("array");for(long[] ar:aa){
                 for(long k:ar){
                     System.out.print(k+" ");
                 }System.out.println("");
             }*/

            {if(aa[0][0]>max)max=aa[0][0];}if(n==1){System.out.println(max);return;}
            //y==0
            {for(int x=1;x<n;x++){if(aa[0][x]>max)max=aa[0][x];
                for(int wx=0;wx<=x-1;wx++){long cal=aa[0][x]-aa[0][x-wx-1];if(cal>max)max=cal;}
            }}
            {for(int y=1;y<n;y++){if(aa[y][0]>max)max=aa[y][0];
                for(int wy=0;wy<y-1;wy++){long cal=aa[y][0]-aa[y-wy-1][0];if(cal>max)max=cal;}
            }}
             for(int x=1;x<n;x++){
                 for(int y=1;y<n;y++){
                     for(int wX=0;wX<=x;wX++){
                         for(int wY=0;wY<=y;wY++){
                             long cal=0;
                             if(wX==x&&wY==y){cal=aa[y][x];}
                             else if(wX==x){cal=aa[y][x]-aa[y-wY-1][x];}
                             else if(wY==y){cal=aa[y][x]-aa[y][x-wX-1];}
                             else{cal=aa[y][x]-aa[y-wY-1][x]-aa[y][x-wX-1]+aa[y-wY-1][x-wX-1];}
                             if(cal>max)max=cal;
                         }
                     }
                 }
             }
             
             System.out.println(max);
             
         }catch(Exception e){}         
     }
      
    
 }

Measured memory_bytes: 24040
#include <iostream>
#include <algorithm>
#include <string>
#include <math.h>
#include <cstdint>
#include <map>
 
using namespace std;
typedef long long ll;

ll ans,mx;
int main(){
	int n;
	cin>>n;
	ll a[n];
	for(int i=0; i<n; i++){
		cin>>a[i];
	}
	sort(a,a+n);
	for(int i=0; i<n-1; i++) ans+=a[i];
	cout<<ans +(a[n-1]/2)<<endl;
}

Measured memory_bytes: 632
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner input = new Scanner(System.in);
		int count = 0;
		int forIndex = Integer.parseInt(input.nextLine());
		for (int i = 0; i < forIndex; i++) {
			int number = Integer.parseInt(input.nextLine());
			int index = (int) Math.sqrt(number) + 1;
			for (; index > 1; index--) {
				if (number % index == 0 && index != number) {
					break;
				} else if (index == 2 || index == 1) {
					count++;
				}
			}
		}
		System.out.println(count);

	}

}



Measured memory_bytes: 63364
n, m = map(int, input().split())
swl = []
ans = 0

for i in range(m):
    s = input().split()
    swl.append(list(map(int, s[1:])))

pl = list(map(int, input().split()))

for i in range(2**n): #onになっているswの組み合わせ
    for sw, p in zip(swl, pl):
        odd = False
        for a in sw:
            if i & 1 << (a - 1): #今見ている電球と連動しているswがonかどうか
                odd = not odd
        if int(odd) != p:
            break
    else:
        ans += 1

print(ans)

Measured memory_bytes: 3064
N, K = list(map(int, input().split()))
h = [0]
for _ in range(N):
    h += [int(input())]        
h = sorted(h)

min_value = h[-1]
for i in range(K, N + 1):
    min_value = min(h[i] - h[i - K + 1], min_value)
print(min_value)

Measured memory_bytes: 8276
#include<bits/stdc++.h>
using namespace std;
#define int long long
typedef unsigned long long ull;
typedef pair<int,int> P;
struct st{
  int h,w;
  vector<string> vs;
  st(){}
  st(int h1,int w1,vector<string> ts){
    vs.push_back(string(w1+2,'.'));
    for(int i=0;i<h1;i++) vs.push_back('.'+ts[i]+'.'); 
    vs.push_back(string(w1+2,'.'));
    h=h1+2;w=w1+2;
    construct();
  }
  int ax[8]={1,-1,0,0,1,1,-1,-1};
  int ay[8]={0,0,1,-1,1,-1,1,-1};
  int color[111][111];
  int cnt;
  void construct(){
    //for(int i=0;i<h;i++) cout<<vs[i]<<endl;cout<<endl;
    memset(color,-1,sizeof(color));
    cnt=0;
    for(int i=0;i<h;i++){
      for(int j=0;j<w;j++){
	if(~color[i][j]) continue;
	queue<P> q;
	q.emplace(i,j);
	color[i][j]=cnt;
	while(!q.empty()){
	  P p=q.front();q.pop();
	  int y=p.first,x=p.second;
	  for(int k=0;k<4+4*(vs[i][j]=='#');k++){
	    int ny=y+ay[k],nx=x+ax[k];
	    if(ny<0||h<=ny||nx<0||w<=nx) continue;
	    if(vs[y][x]!=vs[ny][nx]) continue;
	    if(~color[ny][nx]) continue;
	    color[ny][nx]=cnt;
	    q.emplace(ny,nx);
	  }
	}
	cnt++;
      }
    }
    for(int i=0;i<h;i++){
      for(int j=0;j<w;j++){
	int y=i,x=j;
	for(int k=0;k<4;k++){
	  int ny=y+ay[k],nx=x+ax[k];
	  if(ny<0||h<=ny||nx<0||w<=nx) continue;
	  if(color[y][x]!=color[ny][nx]){
	    G[color[y][x]].insert(color[ny][nx]);
	    G[color[ny][nx]].insert(color[y][x]);
	  }
	}
      }
    }
  }
  
  set<int> G[11111];
  ull BASE=1000000007LL;
  ull dfs(int v,int p=-1){
    //cout<<v<<" "<<p<<endl;
    if(G[v].empty()) return 1;
    vector<ull> x;
    for(int i:G[v]) if(i!=p) x.push_back(dfs(i,v));
    sort(x.begin(),x.end());
    ull res=0,tmp=1LL;
    for(int i:x) res+=i*tmp,tmp*=BASE;
    return res;
  }
  ull hash(){
    return dfs(0);
  }
  string dfss(int v, int p = -1) {
    if(G[v].empty()) return "01";
    vector<string> vec;
    for(int i : G[v]) if(i != p) vec.push_back(dfss(i, v));
    sort(vec.begin(), vec.end());
    string res = "";
    for(string s : vec) res += s;
    return "0"+res+"1";
  }
  string hashs() {
    return dfss(0);
  }
};
signed main(){
  int h,w;
  while(cin>>h>>w,h||w){
    vector<string> vs(h);
    for(int i=0;i<h;i++) cin>>vs[i];
    st t1(h,w,vs);
    cin>>h>>w;
    vs.clear();vs.resize(h);
    for(int i=0;i<h;i++) cin>>vs[i];
    st t2(h,w,vs);
    if(t1.hashs()==t2.hashs()) cout<<"yes"<<endl;
    else cout<<"no"<<endl;
  }
  return 0;
}

Measured memory_bytes: 4492
import math
N = int(input())
#https://qiita.com/jamjamjam888/items/e066b8c7bc85487c0785
xy = [map(int, input().split()) for _ in range(N)]
x, y = [list(i) for i in zip(*xy)]
l = 0

for j in range(N):
    for k in range(N):
        if j >= k:
            continue
        l += math.sqrt((x[j] - x[k])**2 + (y[j] - y[k]) ** 2)

print(l * 2/N)

Measured memory_bytes: 62168
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <functional>
#include <numeric>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <utility>
#include <sstream>
#include <complex>
#include <fstream>

using namespace std;

#define FOR(i,a,b) for(long long i=(a);i<(b);i++)
#define REP(i,N) for(long long i=0;i<(N);i++)
#define ALL(s) (s).begin(),(s).end()
#define fi first
#define se second

#define PI acos(-1.0)
#define INF 1000000007
#define MOD 1000000007
#define EPS 1e-10
#define MAX_N 100100
#define MAX_M 100100

typedef long long ll;
typedef pair<ll, ll> P;
typedef pair<double, double> PD;
typedef pair<string, ll> PS;
typedef vector<ll> V;
typedef pair<P, char> PC;
typedef pair<ll, string> PLS;

string s[10];

int main(){
	cin >> s[0] >> s[1] >> s[2];
	int num = 0, pos[10] = {};
	while (1){
		if (pos[num] == s[num].size()){
			if (num == 0)cout << "A" << endl;
			else if (num == 1)cout << "B" << endl;
			else cout << "C" << endl;
			break;
		}

		pos[num]++;
		if (s[num][pos[num] - 1] == 'a')num = 0;
		else if (s[num][pos[num] - 1] == 'b')num = 1;
		else num = 2;
	}
}

Measured memory_bytes: 256
#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++)
const ll mod = 1000000000 + 7;

int main() {
    ll n;
    cin >> n;
    vector<ll> a(n), acc(n+1, 0);
    rep(i, 0, n) {
        cin >> a[i];
    }
    for(ll i = n-1; i >= 0; i--){
        acc[i] = acc[i+1] + a[i];
        acc[i] %= mod;
    }
    ll ans = 0;
    rep(i, 0, n) {
        ans += (a[i] * acc[i+1]) % mod;
        ans %= mod;
    }
    cout << ans % mod << endl;
    return 0;
}

Measured memory_bytes: 6432
#include <stdio.h>
#include <ctype.h>
#include <stdlib.h>
 
int main()
{
    int m, f, r;
    int s;
 
    while (1) {
        scanf("%d%d%d", &m, &f, &r);
        if (m == -1 && f == -1 && r == -1) break;
 
        if (m < 0 || f < 0) puts("F");
        else {
            s = m + f;
            if (s >= 80) puts("A");
            else if (s >= 65) puts("B");
            else if (s >= 50) puts("C");
            else if (s < 30) puts("F");
            else puts(r >= 50 ? "C" : "D");
        }
    }
    return 0;
}


Measured memory_bytes: 2112
use proconio::{input, fastout};
use std::collections::HashMap;

#[fastout]
fn main() {
    input! {
        n: usize,
        a: [String; n],
    };

    let mut ac = 0;
    let mut wa = 0;
    let mut tle = 0;
    let mut re = 0;

    for i in 0..n {
        match &a[i][..] {
            "AC" => ac += 1,
            "WA" => wa += 1,
            "TLE" => tle += 1,
            "RE" => re += 1,
            _ => panic!("error"),
        };
    }

    println!("AC x {}", ac);
    println!("WA x {}", wa);
    println!("TLE x {}", tle);
    println!("RE x {}", re);
}


Measured memory_bytes: 7808
// Har Har Mahadev
#include <bits/stdc++.h>
#define debug(x) cout << #x << " -> " << x << endl
#define booga cout << "booga" << endl
#define ll long long int
#define pb push_back

using namespace std;

void testcase(){
	int a,b,c,k,op = 0;
	cin >> a >> b >> c >> k;
	while(b <= a){
		b *= 2;
		op++;
	}
	while(c <= b){
		c *= 2;
		op++;
	}
	if(op <= k){
		cout << "Yes";
	}
	else{
		cout << "No";
	}
}
int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	int t = 1;
	while(t--){
		testcase();
	}
	return 0;
}


Measured memory_bytes: 3608
//g++ main.cpp -I /usr/local/include/ac-library
#include<cmath>
//#include <atcoder/all>
#include <bits/stdc++.h>
using ll = long long;
using namespace std;
//using namespace atcoder;
stack<int> st;
queue<int> qu;
priority_queue<int> pq;
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define rep2(i,n) for(int i=1; i<=(int)(n); i++)
#define mins(x,y) x=min(x,y)
#define maxs(x,y) x=max(x,y)
#define ALL(a) a.begin(), a.end()
typedef set<int> set_t;
typedef set<string> set_g;
typedef complex<double> xy_t;
static const int NIL = -1;
static const int INF = 1000000007;
#define mp make_pair
#define pb push_back
#define sz(x) (int)(x).size()
#define mod 1000000007
//#define mint=modint1000000007
#define reps(i,s,n) for(int i = s; i < n; i++)
#define Rreps(i,n,e) for(int i = n - 1; i >= e; --i)
#define Rrep(i,n) Rreps(i,n,0)
deque<int> deq;
#define fi first
#define se second
//const ll MOD = 998244353;
const ll MOD = (1e+9) + 7;
typedef pair<int, int> P;
typedef vector<ll> vec;
typedef vector<vec> mat;
int main(){
    string s;
    cin >> s;
    int x,y;
    cin >> x>> y;
    int n=sz(s);
    vector<int> X,Y;
    int temp=0;
    bool axis=0;
    rep(i,n){
        if(s[i]=='F'){
            temp++;
        }else{
            axis=1-axis;
            if(axis){
                if(sz(X)==0){
                    x-=temp;
                    temp=0;
                    X.pb(0);
                }else{
                    X.pb(temp);
                    temp=0;
                }
            }else{
                Y.pb(temp);
                temp=0;
            }
        }
    }
    if(temp>0){
        if(1-axis){
            if(sz(X)==0){
                x-=temp;
                X.pb(0);
            }else{
                X.pb(temp);
                temp=0;
            }
        }else{
            Y.pb(temp);
            temp=0;
        }
    }
    sort(ALL(X),greater<int>());
    sort(ALL(Y),greater<int>());
    //cerr<<sz(X)<<"  "<<sz(Y)<<endl;
    /*
    rep(i,sz(X)){cout<<X[i]<<' ';}
    cout<<endl;
    rep(i,sz(Y)){cout<<Y[i]<<' ';}
    cout<<endl;
    */
    rep(i,sz(X)){
        x=min(abs(x-X[i]),abs(x+X[i]));
    }
    rep(i,sz(Y)){
        y=min(abs(y-Y[i]),abs(y+Y[i]));
    }
    //cerr<<x<<' '<<y<<endl;
    if(x==0&&y==0){
        cout<<"Yes"<<endl;
    }else{
        cout<<"No"<<endl;
    }
    return 0;
}

Measured memory_bytes: 3672
#include<stdio.h>

 

int main(void)

 

{

 

int a,b,d,r;

double f;

 

scanf("%d %d",&a,&b);

 

d=a/b;

 

r=a%b;

 

f=(double)a/(double)b;

 

printf("%d %d %lf",d,r,f);

 

return 0;

 

}

Measured memory_bytes: 636
INF = float('inf')
N,W = map(int,input().split())
wv = [list(map(int,input().split())) for _ in range(N)]

dp = [[-INF]*(W+1) for _ in range(N+1)]
dp[0][0]=0
for i in range(N):
    for j in range(W+1):
        if j-wv[i][0] >= 0:
            dp[i+1][j] = max(dp[i][j-wv[i][0]]+wv[i][1],dp[i][j])
        else:
            dp[i+1][j] = dp[i][j]
print(max(dp[-1]))

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

int main(){
	int a, b;
	while (true){
		cin >> a >> b;
		if (a == 0 && b == 0){
			break;
		}
		else {
			if (a > b){
				cout << b << " " << a << endl;	
			}
			else {
				cout << a << " " << b << endl;
			}
		}
	}
	return 0;
}


Measured memory_bytes: 3004
#include<stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
 
int compare_int(const void *a, const void *b)
{
    return *(int*)a - *(int*)b;
}
 
int main()
{
    int N;
  int i;
    char s[3][3]={};
//    int k=0;
    for(i=0;i<3;i++){
      scanf("%s", &s[i]);
 //     printf("%s\n", s[i]);
    }
//   printf("%s%s%s\n",s[0][0],s[1][1],s[2][2]);
     printf("%c%c%c\n",s[0][0],s[1][1],s[2][2]);

return 0;
}


Measured memory_bytes: 128
#include<iostream>
#include <bits/stdc++.h>
#include <cstdio>
#include<set>
using namespace std;
int main()
{
    // �����̓���
    int N;
    int sum = 0;
    
    cin >> N;
    vector<int> A(N);
    vector<int> B(N);
    vector<int> C(N); 
    for (int i = 0; i < N; ++i) { 
       cin >> A[i]; 
    }
    for (int i = 0; i < N; ++i) { 
       cin >> B[i]; 
       sum += B[i];
        fprintf(stderr, "%d, %d, %d\n", i, B[i], sum);
    }
    for (int i = 0; i < N - 1; ++i) { 
       cin >> C[i]; 
    }
    for (int i = 0; i < N - 1; i++){
       if (A[i] + 1 == A[i + 1]){
          sum += C[A[i] - 1];
       }
    }    
    cout << (sum) << endl;
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<bits/stdc++.h>
#include<iomanip>
using namespace std;
typedef long long ll;
typedef long  l;
typedef pair<int,int> P;
#define rep(i,n) for(int i=0;i<n;i++)
#define fs first
#define sc second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define ALL(A) A.begin(),A.end()
const int INF=1000000001;
const double PI=3.141592653589;

string kai(int a){
  string c;
  while(a>=10){
    c+=(a%10)+'0';
    a/=10;
  }
  // cout<<a<<endl;
  if(a!=0)
  c+=a+'0';
  return c;
}

int main(){
  int a,b; cin>>a>>b;

  int ans=0;
  for(int i=a;i<=b;i++){
    string s1=kai(i);
    string s2=s1;
    reverse(s1.begin(),s1.end());
     // cout<<s1<<" "<<s2<<endl;
    if(s1==s2)
    ans++;
  }
  cout<<ans<<endl;

  return 0;

}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <queue>
#include <string.h>
#include <math.h>
using namespace std;
typedef long long ll;

int main(void){
    ll n, a[200010];
    cin >> n;
    for (int i = 0; i < n; i++) cin >> a[i];
    
    ll s[200020], t[200020];
    for (int i = 0; i < n; i++) {
        if (i == 0) s[i] = t[i] = a[i];
        else {
            s[i] = s[i - 1] + a[i];
            t[i] = (t[i - 1] ^ a[i]);
        }
    }
    
    /*
    for (int i = 0; i < n; i++) cout << s[i] << " ";
    cout << endl;
    for (int i = 0; i < n; i++) cout << t[i] << " ";
    cout << endl;
    for (int i = 0; i < n; i++) cout << s[i] - t[i] << " ";
    cout << endl;*/
    
    ll ans = 0, i = 0, j = 0;
    bool cont = false;
    while (1) {
        ll s, t;
        if (i == 0 && j == 0) s = t = a[0];
        else if (cont) {
            s -= a[i - 1];
            t = (t ^ a[i - 1]);
            cont = false;
        }
        else {
            s += a[j];
            t = (t ^ a[j]);
        }
        
        if (s == t) {
            //cout << i <<" "<< j <<" " << s << " " << t << endl;
            j++;
        }
        else {
            ans += (j - i);
            //cout << j - i << endl;
            i++;
            cont = true;
        }
        if (j == n) {
            while (i != n) {
                ans += (j - i);
                i++;
            }
            break;
        }
    }
    
    cout << ans << endl;
    
    
    
}


Measured memory_bytes: 1792
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <vector>
#include <list>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <tuple>
using namespace std;
#define ll long long

int main(){

    int n; cin >> n;
    long long a[n];

    for(int i=0; i<n; i++){
        cin >> a[i];
        a[i] -= (i+1);
    }

    sort(a, a+n);

    long long lament = 1e18;

    for(int j = n/2 - 1; j <= n/2 + 1; j++){

        if(j < 0 || n <= j) continue;

        ll temp = 0;
        for(int i=0; i<n; i++){
            temp += abs(a[i] - a[j]);
        }

        lament = min(lament, temp);
    }

    cout << lament;



}

Measured memory_bytes: 1792
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cstring>
#include<cmath>
using namespace std;
int main(){
	int a,b;
	char c;
	cin>>a>>c>>b;
	if(c=='+') cout<<a+b;
	if(c=='-') cout<<a-b;
	cout<<endl;
	return 0;
}


Measured memory_bytes: 256
import java.util.HashSet;
import java.util.Scanner;
import java.util.Set;

public class Main {

	private static long n;

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		n = sc.nextLong();
		System.out.println(dfs(0));
	}

	private static long dfs(long a) {
		if (a > n) return 0;

		long i = a;
		Set<Integer> set = new HashSet<>();
		while (i > 0) {
			if (i % 10 == 7) {
				set.add(7);

			} else if (i % 10 == 5) {
				set.add(5);

			} else if (i % 10 == 3) {
				set.add(3);
			}
			if (set.size() >= 3) break;
			i /= 10;
		}

		long b = set.size() >= 3 ? 1 : 0;

		b += dfs(a * 10 + 7);
		b += dfs(a * 10 + 5);
		b += dfs(a * 10 + 3);
		return b;
	}
}


Measured memory_bytes: 32080
#!/usr/bin/python
# coding: UTF-8

S = list(input())
S = list(map(int,S))
#S.append(-1)
#S.insert(0,-2)
#Count = 0
#Before = len(S)
#L = len(S)
#S1 = S[0:L//2]
#S2 = S[L//2:L]
zero = 0
for i in S:
    if i == 0:
        zero += 1
one = len(S) - zero
ans = one - zero if one > zero else zero - one
print(len(S) - ans)


Measured memory_bytes: 4652
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repr(i, n) for (int i = (int)(n); i >= 0; i--)
#define REP(i, m, n) for (int i = (int)(m); i < (int)(n); i++)
#define INF 1e9
#define all(v) v.begin(), v.end()
typedef long long ll;

int main(){
  int n, k;
  string s;
  cin >> n >> k >> s;
  
  s[k-1] -= 'A' - 'a';

  cout << s << endl;

  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <map>
#include <vector>
#include <set> 
#include <iterator> 

using namespace std;

int main() {
	// your code goes here
	int ans=0, x,y,z,n;
	register int a,b,c;
	cin >> x >> y >> z >> n;

	for(a=0;a<=3000;a++){
		if(a*x>n)
			break;
		for(b=0;b<=3000;b++){
			if(a*x + b*y > n)
				break;
			int temp = n - a*x - b*y;
			if(temp%z == 0)
				ans++;
		}
	}

	cout << ans << endl;
		
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define int long long 
using namespace std;
signed main(){
  string  a,b;
  int z,x;
  cin>>a>>b;
  z=a.size();
  x=b.size();
  if(a==b) cout<<"EQUAL\n";
  else if(z>x) cout<<"GREATER\n";
  else if(z<x) cout<<"LESS\n";
  else if(a>b) cout<<"GREATER\n";
  else if(a<b) cout<<"LESS\n";
}


Measured memory_bytes: 256
#include <iostream>
#include <set>
#include <map>
#include <string>
#include <math.h>
#include <algorithm>
 
using namespace std;
 
int main() {
	// 入力
    int N, M;
    cin >> N >> M;
    long long x[N], y[N], z[N];
    for (int i = 0; i < N; ++i) cin >> x[i] >> y[i] >> z[i];
 
    long long ans_total = 0;
    long long sum[N];
    for (int i = 0; i < N; ++i)sum[i] = x[i] + y[i] + z[i];
    sort(sum, sum + N, greater<long long>());
    for (int i = 0; i < M; ++i)ans_total += sum[i];
    
    long long ans = 0;
    for (int i = 0; i < N; ++i)sum[i] = x[i] + y[i] - z[i];
    sort(sum, sum + N, greater<long long>());
    for (int i = 0; i < M; ++i)ans += sum[i];
    if (ans>ans_total) ans_total = ans;
    
    ans = 0;
    for (int i = 0; i < N; ++i)sum[i] = x[i] - y[i] + z[i];
    sort(sum, sum + N, greater<long long>());
    for (int i = 0; i < M; ++i)ans += sum[i];
    if (ans>ans_total) ans_total = ans;
    
    ans = 0;
    for (int i = 0; i < N; ++i)sum[i] = x[i] - y[i] - z[i];
    sort(sum, sum + N, greater<long long>());
    for (int i = 0; i < M; ++i)ans += sum[i];
    if (ans>ans_total) ans_total = ans;
    
    ans = 0;
    for (int i = 0; i < N; ++i)sum[i] = -x[i] + y[i] + z[i];
    sort(sum, sum + N, greater<long long>());
    for (int i = 0; i < M; ++i)ans += sum[i];
    if (ans>ans_total) ans_total = ans;
    
    ans = 0;
    for (int i = 0; i < N; ++i)sum[i] = -x[i] + y[i] - z[i];
    sort(sum, sum + N, greater<long long>());
    for (int i = 0; i < M; ++i)ans += sum[i];
    if (ans>ans_total) ans_total = ans;
    
    ans = 0;
    for (int i = 0; i < N; ++i)sum[i] = -x[i] - y[i] + z[i];
    sort(sum, sum + N, greater<long long>());
    for (int i = 0; i < M; ++i)ans += sum[i];
    if (ans>ans_total) ans_total = ans;
    
    ans = 0;
    for (int i = 0; i < N; ++i)sum[i] = -x[i] - y[i] - z[i];
    sort(sum, sum + N, greater<long long>());
    for (int i = 0; i < M; ++i)ans += sum[i];
    if (ans>ans_total) ans_total = ans;
    

    cout << ans_total << endl;;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <bitset>
#include <map>
#include <unordered_map>
#include <list>
#include <numeric>
#include <utility>
#include <iterator>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <climits>
#include <ctime>
#include <cassert>

#define INF 1000000000
#define LINF 9000000000000000000
#define mod 1000000007

#define rep(i,n) for(int i=0;i<int(n);i++)
#define rrep(i,n) for(int i=n-1;i>=0;i--)
#define REP(i,a,b) for(int i=(a);i<int(b);i++)
#define all(x) (x).begin(),x.end()
#define pb push_back
#define mp make_pair

using namespace std;

/*
   cin.tie(0);
   ios::sync_with_stdio(false);
   */

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef pair<int,int> pi;

int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
int ddx[8]={-1,-1,0,1,1,1,0,-1};
int ddy[8]={0,1,1,1,0,-1,-1,-1};
bool debug=false;

/*---------------------------------------------------*/

int main(){
  int a,b;
  cin>>a>>b;
  if(a<=0&&0<=b){
    cout<<"Zero"<<endl;
  }else if(0<a){
    cout<<"Positive"<<endl;
  }else{
    if((b-a+1)%2==0)cout<<"Positive"<<endl;
    else cout<<"Negative"<<endl;
  }
  return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

int main() {
    int h, w;
    for(;;) {
        scanf("%d %d", &h, &w);
        if(h==0) break;
        for(int i=0;i<h;i++) {
            for(int j=0;j<w;j++) {
                printf("#");
            }
            printf("\n");
        }
        printf("\n");
    }
}


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

static const int VER = 10000;
static const int EDGE = 500000;
static const int INF = 1e9;

typedef struct{
    int ver,next_ver,cost;
}graph;

int n,ind,d[VER];
graph G[EDGE];

void dijkstra(){
    int ok;
    
    for(int i=0; i<n; i++){
        d[i] = INF;
    }

    d[0] = 0;
    ok = 1;

    while(ok){
        ok = 0;
        for(int i=0; i<ind; i++){
            if(d[G[i].next_ver] > d[G[i].ver]+G[i].cost){
                
                d[G[i].next_ver] = d[G[i].ver]+G[i].cost;
                ok = 1;
            }
        }
    }
}

int main(){
    int k,u;
    cin>>n;
    ind = 0;

    for(int i=0; i<n; i++){
        cin>>u>>k;
        for(int j=0; j<k; j++){
            G[ind].ver = u;
            int c,v;
            cin>>c>>v;
            G[ind].next_ver = c;
            G[ind].cost = v;
            ind++;
        }
    }

    dijkstra();

    for(int i=0; i<n; i++){
        cout<<i<<" "<<d[i]<<endl;
    }

    return 0;
}


Measured memory_bytes: 8976
#include<stdio.h>

int main(){
  char s[4];
  int i,j,count;
  count=0;
  scanf("%s",&s);
  for(i=0;i<4;i++){
    for(j=0;j<4;j++){
      if(s[i]==s[j]) count++;
    }
  }
  if(count==8) printf("Yes\n");
  else printf("No\n");
  return 0;
}


Measured memory_bytes: 128
S = input()
uni_s = list(set(list(S)))

ans = len(S) - 1

# -1,1
for s in uni_s:
  L = len(S)
  T = list(S)
  all_same = [s == t for t in S]
  cnt = 0
  while not all(all_same):
    cnt += 1
    newT = [False] * (L-1)
    for i in range(L):
      t = T[i]
      if s == t:
        if i < L-1:
          newT[i] = t
        if 0 <= i-1:
          newT[i-1] = t
      else:
        if i < L-1 and not newT[i]:
          newT[i] = t
        if 0 <= i-1 and not newT[i-1]:
          newT[i-1] = t
    
    all_same = [s==t for t in newT]
    T = newT
    L = len(T)
  ans = min(ans,cnt)

print(ans)
      
    


Measured memory_bytes: 3192
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<n+1;i++)
#define sort(A) sort(A.begin(),A.end())
#define reverse(A) reverse(A.begin(),A.end())
typedef long long ll;
typedef vector<int> vec;
typedef vector<vector<int>> vv;


int main(){
  int n,a;
  cin >> n >> a;
  if(n%500 > a) cout << "No" << endl;
  else cout << "Yes" << endl;
}

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

int dx[]{ -1,-1,-1,0,0,1,1,1 }, dy[]{ -1,0,1,-1,1,-1,0,1 };
char s[8][9];
int dfs(int x, int y, int id, char c, int cnt) {
	if (!(0 <= x&&x < 8 && 0 <= y&&y < 8) || s[x][y] == '.')return 0;
	if (s[x][y] == c)return cnt;
	return dfs(x + dx[id], y + dy[id], id, c, cnt + 1);
}
int main() {
	rep(i, 8)scanf("%s", s[i]);
	bool flag = false;
	for (int i = 1;; i++) {
		if (i & 1) {//o
			int Max = 0, nx, ny;
			rep(j, 8)rep(k, 8) {
				if (s[j][k] != '.')continue;
				int d = 0;
				rep(t, 8)d += dfs(j + dx[t], k + dy[t], t, 'o', 0);
				if (Max < d) {
					Max = d; nx = j; ny = k;
				}
			}
			if (Max == 0) {
				if (flag)break;
				flag = true;
				continue;
			}
			flag = false;
			s[nx][ny] = 'o';
			rep(t, 8) {
				int k = dfs(nx + dx[t], ny + dy[t], t, 'o', 0);
				rep(y, k)s[nx + dx[t] * (y + 1)][ny + dy[t] * (y + 1)] = 'o';
			}
		}
		else {//x
			int Max = 0, nx, ny;
			for (int j = 7; j >= 0; j--)for (int k = 7; k >= 0; k--) {
				if (s[j][k] != '.')continue;
				int d = 0;
				rep(t, 8)d += dfs(j + dx[t], k + dy[t], t, 'x', 0);
				if (Max < d) {
					Max = d; nx = j; ny = k;
				}
			}
			if (Max == 0) {
				if (flag)break;
				flag = true;
				continue;
			}
			flag = false;
			s[nx][ny] = 'x';
			rep(t, 8) {
				int k = dfs(nx + dx[t], ny + dy[t], t, 'x', 0);
				rep(y, k)s[nx + dx[t] * (y + 1)][ny + dy[t] * (y + 1)] = 'x';
			}
		}
	}
	rep(i, 8)printf("%s\n", s[i]);
}

Measured memory_bytes: 3176
/**
 * @file A-FavoriteSound.cpp
 * @author murnana
 * @brief A - Favorite Sound
 *  https://atcoder.jp/contests/abc120/tasks/abc120_a
 * 
 * @copyright Copyright (c) 2019
 * 
 */

#include <iostream>
using namespace std;

/**
 * @brief Entry point
 * 
 * @return int 
 */
int main()
{
    // 自販で買うジュースの値段A円、
    // 高橋君が持っているお金B円
    // 聞きたい音の回数C回を取得する
    int A, B, C;
    cin >> A >> B >> C;

    // C回音を聞くのにいくらか = C * A
    // それはB円で足りるのか
    if (B >= C * A)
    {
        cout << C << endl;
    }
    else
    {
        cout << (B / A) << endl;
    }

    return 0;
}


Measured memory_bytes: 256
#include<string>
#include<string.h>
#include<map>
#include<set>
#include<vector>
#include<stdio.h>
#include<math.h>
#include<iostream>
#include<algorithm>
#include<queue>
using namespace std;
int main()
{
    string s;
    cin>>s;
    for (int i=0;i<s.size();i++)
        if (i%2==0) cout<<s[i];
    cout<<endl;
    return 0;
}

Measured memory_bytes: 512
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
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 (b<a) { a=b; return 1; } return 0; }
const ll INF=1LL<<60;
const int inf=1<<30;
const int mod=1e9+7;
const int MOD=998244353;
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    long double x;cin >> x;
    int ans=0;
    long double now=100;
    while(now<x){
        now=floor(now*1.01);
        ans++;
    }
    cout << ans << endl;
}

Measured memory_bytes: 3740
#include <bits/stdc++.h>
#include <cassert>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define rep2(i, a, b) for(ll i = a; i <= b; ++i)
#define rep3(i, a, b) for(ll i = a; i >= b; --i)
#define pb push_back
#define eb emplace_back
#define fi first
#define se second
#define all(c) begin(c), end(c)
#define ok() puts(ok?"Yes":"No");
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; }
using namespace std;
using ll = long long;
using vi = vector<int>;
using vll = vector<ll>;
using ii = pair<int, int>;
using vvi = vector<vi>;
using vii = vector<ii>;
using gt = greater<int>;
using minq = priority_queue<int, vector<int>, gt>;
using P = pair<ll,ll>;
const ll LINF = 1e18L + 1;
const int INF = 1e9 + 1;
//clang++ -std=c++11 -stdlib=libc++ 

int H,W;
string grid[51];
int dist[51][51];

int main() {
  cin >> H >> W;
  rep(i,H) cin >> grid[i];
  int path = INF;
  int black = 0;
  rep(i,H)rep(j,W) {
    if (grid[i][j] == '#') black++;
    dist[i][j]=INF;    
  }
  dist[0][0] = 0;
  queue<ii> q;
  q.emplace(0,0);
  while(q.size()) {
    auto [i,j] = q.front(); q.pop();
    int dx[] = {0,1,0,-1};
    int dy[] = {1,0,-1,0};
    rep(k,4) {
      int ni = i+dy[k];
      int nj = j+dx[k];
      if (ni < 0 || ni >= H || nj < 0 || nj >= W || dist[ni][nj] != INF || grid[ni][nj] == '#') continue;
      q.emplace(ni,nj);
      dist[ni][nj] = dist[i][j] + 1;
    }
  }
  int ans = H*W - black - dist[H-1][W-1] - 1;
  if (dist[H-1][W-1] == INF) ans = -1;
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 3596
#include <iostream>
#include <string>
using namespace std;
int main(){
  string s;
  cin >> s;
  if(s=="Sunny") cout << "Cloudy" << endl;
  else if(s=="Cloudy") cout << "Rainy" << endl;
  else if(s=="Rainy") cout << "Sunny" << endl;
  return 0;
}

Measured memory_bytes: 256
<?php
  fscanf(STDIN,"%d %d",$N,$X);
  $m=[];
  $sum=0;
  $min=1000;
  for($i=0;$i<$N;$i++){
  fscanf(STDIN,"%d",$s);
  $m[$i]=$s;
  $sum+=$m[$i];
  	if($m[$i]<$min){
 	 $min=$m[$i];
  	}
  }
  echo $N+floor(($X-$sum)/$min);

  ?>
  

Measured memory_bytes: 3828
import std.algorithm, std.container, std.conv, std.math, std.range, std.typecons, std.stdio, std.string;

auto rdsp(){return readln.splitter;}
void pick(R,T)(ref R r,ref T t){t=r.front.to!T;r.popFront;}
void readV(T...)(ref T t){auto r=rdsp;foreach(ref v;t)pick(r,v);}
void readC(T...)(size_t n,ref T t){foreach(ref v;t)v=new typeof(v)(n);foreach(i;0..n){auto r=rdsp;foreach(ref v;t)pick(r,v[i]);}}

void main()
{
  int h, w; readV(h, w);
  string[] c; readC(h, c);

  foreach (ci; c) {
    writeln(ci);
    writeln(ci);
  }
}


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

int main(){
  int n;
  cin >> n;
  map<int, int> mp;
  int maxans = 0;
  for(int i=0; i<n; ++i){
    int x;
    cin >> x;
    if(x >= 3200) ++maxans;
    else ++mp[x/400];
  }
  if(mp.size() == 0) cout << 1 << " " << maxans << endl;
  else cout << mp.size() << " " << mp.size()+maxans << endl;
}

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

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

const double PI = 3.14159265358979323846;
const double EPS = 1e-12;
const ll INF = 1LL<<29;
const ll mod = 1e9+7;

#define rep(i, a, b) for(ll (i) = (a); (i) < (b);++i)

int main(){
  int A, B;
  cin >> A >> B;
  if (A <= 8 && B <= 8) {
    cout << "Yay!" << endl;
  }else{
    cout << ":(" << endl;
  }
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define reps(i,s,n) for(int i = s; i < n; i++)
#define rep(i,n) reps(i,0,n)
#define Rreps(i,n,e) for(int i = n - 1; i >= e; --i)
#define Rrep(i,n) Rreps(i,n,0)
#define ALL(a) a.begin(), a.end()
#define fi first
#define se second
#define endl "\n"
typedef long long ll;
typedef vector<ll> vec;
typedef vector<vec> mat;

//const ll MOD = 998244353;
const ll MOD = (1e+9) + 7;
const ll INF = 2e+9 + 10;
typedef pair<ll, ll> P;


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

  int N; cin >> N;
  int res = 1, cnt = 0;
  reps(i, 1, N+1) {
    int num = i;
    int cnt2 = 0;
    while(num%2==0 && num!=0) {
      num/=2;
      ++cnt2;
    }
    if(cnt2 > cnt) {
      cnt = cnt2;
      res = i;
    }
  }

  cout << res << endl;

  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using i64 = long long;
#define rep(i,s,e) for(i64 (i) = (s);(i) < (e);(i)++)
#define rev(i,s,e) for(i64 (i) = (s);(i) --> (e);)
#define all(x) x.begin(),x.end()

int main() {
  i64 N;
  cin >> N;
  vector<double> X(N), Y(N);
  vector<char> D(N);
  map<char, pair<i64, i64>> mp;
  mp['R'] = {1, 0};
  mp['L'] = {-1, 0};
  mp['U'] = {0, 1};
  mp['D'] = {0, -1};
  rep(i,0,N) cin >> X[i] >> Y[i] >> D[i];

  auto f = [&](double t) {
    double xM = -1e18;
    double xm = 1e18;
    double yM = -1e18;
    double ym = 1e18;
    rep(i,0,N) {
      auto p = mp[D[i]];
      xM = max(xM, X[i] + p.first * t);
      xm = min(xm, X[i] + p.first * t);
      yM = max(yM, Y[i] + p.second * t);
      ym = min(ym, Y[i] + p.second * t);
    }
    return (xM - xm) * (yM - ym);
  };
  double b = 1e8;
  double a = 0;
  rep(i,0,200) {
    double c = (a * 2 + b) / 3;
    double d = (a + b * 2) / 3;
    if(f(c) < f(d)) {
      b = d;
    }
    else {
      a = c;
    }
  }
  cout << fixed << setprecision(10);
  cout << f(a) << endl;
}


Measured memory_bytes: 1920
#include <iostream>

using namespace std;

int main() {
    long long a, b, x;
    cin >> a >> b >> x;
    if (x > b && a != 0)
    {
        cout << 0;
        return 0;
    }
    if (a == b && b % x != 0)
    {
        cout << 0;
        return 0;
    }
    long long k = a / x;
    if (a % x != 0)
        k++;
    long long t = b / x;
    cout << t - k + 1;
}

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

int main()
{
  string ans = "Three";
  int N;
  cin >> N;
  for (int i = 0; i < N; i++)
  {
    string S;
    cin >> S;
    if (S == "Y")
    {
      ans = "Four";
      break;
    }
  }

  cout << ans << endl;
}


Measured memory_bytes: 256