akhauriyash/Code-Regression huggingface dataset:
#pragma GCC optimize("O3")
#pragma GCC target("avx")
#pragma GCC optimize("unroll-loops")
#include <bits/stdc++.h>
using namespace std;
#define LL long long
#define DB double
#define ST string
#define BS bitset
#define PA pair<LL,LL>
#define VE vector
#define VL vector<LL>
#define VP vector<pair<LL,LL>>
#define VVL vector<vector<LL>>
#define PQ priority_queue
#define PQS priority_queue<LL,vector<LL>,greater<LL>>
#define PB push_back
#define POB pop_back
#define PF push_front
#define POF pop_front
#define EB emplace_back
#define MP make_pair
#define TS to_string
#define TU to_ullong
#define BPL __builtin_popcountll
#define FOR(i,a,n) for(i=a;i<n;i++)
#define FORR(i,a,n) for(i=n-1;i>=a;i--)
#define rep(i,n) FOR(i,0,n)
#define repr(i,n) FOR(i,0,n)
#define ALL(a) a.begin(),a.end()
#define RALL(a) a.rbegin(),a.rend()
#define SORT(a) sort(ALL(a))
#define REV(a) reverse(ALL(a))
#define UB(a,n) *upper_bound(ALL(a),n)
#define LB(a,n) *lower_bound(ALL(a),n)
#define INF 1145141919810364364
#define PI 3.14159265358979
#define MOD 1000000007
//#define MOD 998244353
#define ERR 0.00000001
//#define ERR 0.00000000000001
#define NUM 200010
#define FAST cin.tie(0);ios::sync_with_stdio(false)

void Yn(LL a){if(a)printf("Yes\n");else printf("No\n");}
void YN(LL a){if(a)printf("YES\n");else printf("NO\n");}
LL pwmn(LL a,LL n){LL ans=1;while(ans<a)ans*=n;return ans;}
LL GCD(LL a,LL b){LL c=1,tmp=max(a,b);b=min(a,b);a=tmp;while(c!=0){c=a%b;a=b;b=c;}return a;}
LL LCM(LL a,LL b){return a*b/GCD(a,b);}
int lcmp(const void* a,const void* b){if(*(LL*)a>*(LL*)b)return 1;if(*(LL*)a<*(LL*)b)return -1;return 0;}
int lcmpr(const void* a,const void* b){if(*(LL*)a>*(LL*)b)return -1;if(*(LL*)a<*(LL*)b)return 1;return 0;}
int ccmp(const void* a,const void* b){return *(char*)a-*(char*)b;}
int ccmpr(const void* a,const void* b){return *(char*)b-*(char*)a;}
int scmp(const void* a,const void* b){return strcmp((char*)a,(char*)b);}
int scmpr(const void* a,const void* b){return strcmp((char*)b,(char*)a);}
LL mod(LL a,LL m){if(a<0)return a%m+m;else return a%m;}
LL DIV(LL a,LL d){LL m=MOD,x=1,y=0,k;while(m){k=d/m;d-=k*m;swap(m,d);x-=k*y;swap(x,y);}return mod(a*mod(x,MOD),MOD);}
LL POW(LL a,LL n){LL ans=1;while(n>0){if(n&1)ans=ans*a%MOD;a=a*a%MOD;n>>=1;}return ans;}
LL fact[NUM],finv[NUM],inv[NUM];
void comi(){LL i;fact[0]=fact[1]=1;finv[0]=finv[1]=1;inv[1]=1;FOR(i,2,NUM){fact[i]=fact[i-1]*i%MOD;inv[i]=MOD-inv[MOD%i]*(MOD/i)%MOD;finv[i]=finv[i-1]*inv[i]%MOD;}}
LL com(LL n,LL k){if(n<k||n<0||k<0)return 0;return fact[n]*(finv[k]*finv[n-k]%MOD)%MOD;}
bool cmps(pair<LL,LL> a,pair<LL,LL> b){if(a.second!=b.second)return a.second<b.second;return a.first<b.first;}
template<typename T>bool chmax(T &a,T b){if(a<b){a=b;return true;}return false;}
template<typename T>bool chmin(T &a,T b){if(a>b){a=b;return true;}return false;}

int main(){
  LL A,B,C;
  cin>>A>>B>>C;
  cout<<max(0LL,C-(A-B))<<endl;
}


Measured memory_bytes: 256
import java.util.Scanner;
class Main
 {
   public static void main(String[] args)
      {
    	Scanner sc = new Scanner(System.in);
    	int i, ans;
    	String snum;
    	char[] c = new char[1000];
    	while(true){
        	snum = sc.next();
        	c = snum.toCharArray();
        	ans=0;
        	for(i=0;i<snum.length();i++){
            	ans+= c[i]-'0';
        	}
        	if(ans==0)break;
        	System.out.println(ans);
           }  
      }
 }




Measured memory_bytes: 26340
#include "bits/stdc++.h"
#include<unordered_map>
#pragma warning(disable:4996)
using namespace std;

const int My_Inf=2147483647;
const long long int My_LInf=9223372036854775807;

int main() {
	while (1) {
		int n, m, s, g1, g2; cin >> n >> m >> s >> g1 >> g2;
		if (!n)break;
		s--; g1--; g2--;
		vector<vector<int>>dis(n, vector<int>(n, 99999999));
		for (int i = 0; i < m; ++i) {
			int f, t, c; cin >> f >> t >> c;
			f--; t--;
			dis[f][t] = c;
		}
		for (int i = 0; i < n; ++i) {
			dis[i][i] = 0;
		}
		for (int k = 0; k < n; ++k) {
			for (int i = 0; i < n; ++i) {
				for (int j = 0; j < n; ++j) {
					dis[i][j] = min(dis[i][k] + dis[k][j], dis[i][j]);
				}
			}
		}
		int ans = 99999999;
		for (int i = 0; i < n; ++i) {
			ans = min(ans, dis[s][i] + dis[i][g1] + dis[i][g2]);
		}
		cout << ans << endl;
	}
	
	return 0;
}

Measured memory_bytes: 3196
#include <iostream>
#include <iomanip>
#include <math.h> 
using namespace std;

int main() {
	double a, b, d, h, m, angle;
	cin >> a >> b >> h >> m;
	angle = cos((h*30.0 - 5.5 * m)/180.0*3.141592653589793);
	d = sqrt(a*a + b*b - 2*a*b*angle);
	cout << setprecision(15);
	cout << d << endl;
	return 0;
}

Measured memory_bytes: 4188
a,b,c=map(int,input().split())

if a >= b >=c:
    print(c,b,a)
elif b >= c >= a:
    print(a,c,b)
elif c >= a >= b:
    print(b,a,c)
elif a >= c >= b:
    print(b,c,a)
elif b >= a >= c:
    print(c,a,b)
else:
    print(a,b,c)


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

int main() {
  long long n, h;
  cin >> n >> h;
  vector<pair<long long, long long>> vec;
  for(long long i=0; i<n; i++){
    long long a, b;
    cin >> a >> b;
    vec.push_back(make_pair(b, a));
  }
  long long biggest = 0;
  for(long long i=0; i<n; i++){
    if(biggest < vec[i].second) biggest = vec[i].second;
  }
  long long count = 0;
  sort(all(vec), std::greater<>());
  for(long long i=0; i<n; i++){
    if(biggest < vec[i].first){
      h -= vec[i].first;
      count++;
      if(h <= 0){
        cout << count << endl;
        return 0;
      }
    }
  }
  if(h % biggest == 0) cout << count + h/biggest << endl;
  else cout << count + h/biggest + 1 << endl;
  return 0;
}
    
    
    
    
    


Measured memory_bytes: 2420
/******************************************************************************

                              Online C++ Compiler.
               Code, Compile, Run and Debug C++ program online.
Write your code in this editor and press "Run" button to compile and execute it.

*******************************************************************************/

//#include <iostream>
#include<bits/stdc++.h>

using namespace std;

int main()
{
   int n,k;
   cin>>n>>k;
   map<int,int>mp;
   while(k--)
   {
       int d;
       cin>>d;
       
       while(d--)
       {
           int a;
           cin>>a;
           mp[a]++;
       }
   }
   
   cout<<n-mp.size();
   
    return 0;
}


Measured memory_bytes: 3632
/*
                   _ooOoo_
                  o8888888o
                  88" . "88
                  (| -_- |)
                  O\  =  /O
               ____/`---'\____
             .'  \\|     |//  `.
            /  \\|||  :  |||//  \
           /  _||||| -:- |||||-  \
           |   | \\\  -  /// |   |
           | \_|  ''\---/''  |   |
           \  .-\__  `-`  ___/-. /
         ___`. .'  /--.--\  `. . __
      ."" '<  `.___\_<|>_/___.'  >'"".
     | | :  `- \`.;`\ _ /`;.`/ - ` : | |
     \  \ `-.   \_ __\ /__ _/   .-` /  /
======`-.____`-.___\_____/___.-`____.-'======
                   `=---='
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
         fozubaoyou    pass System Test!
*/


//include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>

using namespace std;

//conversion
//------------------------------------------
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

//math
//-------------------------------------------
template<class T> inline T sqr(T x) {return x*x;}

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())

//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI  = acos(-1.0);

//clear memory
#define CLR(a) memset((a), 0 ,sizeof(a))

//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

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

    int t = 0;
    while(c > 0){
        c = c - b;
        t++;
    }
    
    int ao = 0;
    while(a > 0){
        a = a - d;
        ao++;
    }
    if(t <= ao){
        cout << "Yes";
    }else{
        cout << "No";
    }
    cout << endl;
    return 0;
}


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

typedef long long ll;
const int INF = 1e9;
const int MOD = 1e9 + 7;
const ll LINF = 1e18;
#define y0 y3487465
#define y1 y8687969
#define j0 j1347829
#define j1 j234892
#define next asdnext
#define prev asdprev
#define dump(x)  cout << #x << " = " << (x) << endl;	//debug
#define SZ(x) ((int)(x).size())
#define REP(i, n) for(ll i = 0; i < (n); i++)
#define REPR(i, n) for (ll i = (n); i >= 0; i--)
#define FOR(i, a, b) for (ll i = (a); i <= (b); i++)
#define ps(s) cout << #s << endl;
#define pv(v) cout << (v) << endl;

int main() {
	int n;
	cin >> n;
	int x = n % 10;
	if (x == 0 || x == 1 || x == 6 || x == 8) {
		ps(pon);
	}
	else if (x == 3) {
		ps(bon);
	}
	else {
		ps(hon);
	}
	return(0);
}

Measured memory_bytes: 3592
#include<stdio.h>
#include<stdlib.h>
void swap(int *x,int *y){
    int tmp=*x;
    *x=*y;
    *y=tmp;
}

int main(){
    int n;scanf("%d",&n);
    char s[n+1];scanf("%s",s);

    int r[4000]={},g[4000]={},b[4000]={};
    int r_i,g_i,b_i;r_i=g_i=b_i=0;
    for(int i=0;i<n;i++){
        if(s[i]=='R')r[r_i++]=i;
        if(s[i]=='G')g[g_i++]=i;
        if(s[i]=='B')b[b_i++]=i;
    }
    int cnt=0;
    for(int i=1;i<n-1;i++){
        int dist=1;
        while(i-dist>=0&&i+dist<n){
            if(s[i-dist]!=s[i]&&s[i]!=s[i+dist]&&s[i-dist]!=s[i+dist])
                cnt++;
            dist++;
        }
    }
    long long ans;
    ans=r_i*g_i;
    ans*=b_i;
    printf("%lld\n",ans-cnt);
}

Measured memory_bytes: 1696
n = int(input())
c = [list(map(int, input().split())) for _ in range(n-1)]

def tr(s,n):
    time = c[s-1][1] + c[s-1][0]
    for j in range(s,n-1):
        if (time <= c[j][1]):
            time = c[j][1]+c[j][0]
        else:        
            a = (time - c[j][1]) // c[j][2]
            if ((time - c[j][1])%c[j][2] != 0):
                a = a+1
            time = c[j][1]+c[j][2]*(a)+c[j][0]
    return time

ans = []
for k in range(1,n):
    ans.append(tr(k,n))
ans.append(0)
print(*ans, sep='\n')

Measured memory_bytes: 3188
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
#define mod (int) (1e9 +7)

int main(){
    const double pie=3.1417;
    //int t; cin>>t;
    //while(t--){
    
    int n,m,sum=0; cin>>n>>m;
    
    int days[m];
    
    for(int i=0;i<m;i++){
        cin>>days[i];
        sum=sum+days[i];
    }
    if(sum<=n){
        cout<<n-sum<<"\n";
    }else{
        cout<<"-1"<<"\n";
    }
    
//  } 
    
    return 0;
}

Measured memory_bytes: 3640
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <cmath>
#include <map>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> plglg;
typedef pair<double, ll> pdlg;
typedef tuple<int, int, int> tiii;
typedef tuple<ll, ll, ll> tlglglg;
typedef tuple<double, double, double> tddd;
static const int giga = pow(10,9);

int main(void){
  int a,b;
  cin >> a >> b;
  if(a + b >= 10){
    cout << "error" << endl;
  } else {
    cout << a + b << endl;
  }

  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
const int dx[]={1,0,0,-1,1,-1,-1,1};
const int dy[]={0,1,-1,0,1,1,-1,-1};
const int INF = 1e8;
const double EPS = 1e-8;
#define PB push_back
#define mk make_pair
#define fr first
#define sc second
#define reps(i,j,k) for(int i = (j); i < (k); ++i)
#define rep(i,j) reps(i,0,j)
#define MOD 1000000007
#define lengthof(x) (sizeof(x) / sizeof(*(x)))
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int,int> Pii;
typedef pair<int,vi > P;

typedef unsigned long long ll;
int main(){
	int N,M,s,g1,g2;
	while(scanf("%d%d%d%d%d",&N,&M,&s,&g1,&g2),N){
		--s;--g1;--g2;
		int dp[128][128];
		rep(i,128){
			rep(j,128){
				if(i == j){
					dp[i][j] = 0;
				}
				else{
					dp[i][j] = INF;
				}
			}
		}
		rep(i,M){
			int a,b,c;
			scanf("%d%d%d",&a,&b,&c);
			--a;--b;
			dp[a][b] = c;
		}

		rep(k,N){
			rep(i,N){
				rep(j,N){
					dp[i][j] = min(dp[i][j],dp[i][k]+dp[k][j]);
				}
			}
		}

		int ans = INF;

		rep(i,N){
			ans = min(ans,dp[s][i]+dp[i][g1]+dp[i][g2]);
		}
		printf("%d\n",ans);
	}
	return 0;
}

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

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define repm(i, m, n) for(int i = (int)(m); i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define inf 2e9
#define MOD 1000000007

typedef long long ll;

int main(){
  string s,t; cin >> s >> t;
  int a,b; cin >> a >> b;
  string u; cin >> u;

  map<string, int> m;
  m[s] = a;
  m[t] = b;

  m[u]--;

  cout << m[s] << " " << m[t] << endl;

}

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

typedef long long LL;
const int mo=1000000007;
LL f[100],a[100][200],b[100][200],cnt[100];

int main(){
	f[0]=f[1]=1;
	for (int i=2;i<90;i++) f[i]=f[i-1]+f[i-2];
	cnt[1]=2;a[1][0]=1;b[1][0]=2;a[1][1]=1;b[1][1]=3;
	for (int i=1;i<85;i++)
		for (int j=0;j<cnt[i];j++){
			LL x=b[i][j],y=a[i][j]+b[i][j];
			for (;y<=f[i]+f[i+3];y+=b[i][j])
				a[i+1][cnt[i+1]]=x,b[i+1][cnt[i+1]++]=y;
		}
	int Q;
	scanf("%d\n",&Q);
	for (;Q--;){
		LL X,Y;int ans=0;
		scanf("%lld%lld\n",&X,&Y);
		if (X>Y) std::swap(X,Y);
		int k=1;
		for (;f[k+1]<=X && f[k+2]<=Y;k++);
		if (!--k) ans=1ll*X*Y%mo;
		else{
			for (int i=0;i<cnt[k];i++){
				LL x=a[k][i],y=b[k][i];
				if (y<=X) ans=(ans+(Y-x)/y)%mo;
				if (y<=Y && x<=X) ans=(ans+(X-x)/y)%mo;
			}
		}
		printf("%d %d\n",k+1,ans);
	}
}

Measured memory_bytes: 4224
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <iomanip>
#include <math.h>
#include <map>
using namespace std;

#define INF 1e9
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
typedef long long ll;


int main() {
    string s;
    cin >> s;
    vector<bool> a(26, false);
    rep(i, s.size()) {
        if (a.at(s.at(i) - 'a')) {
            cout << "no" << endl;
            return 0;
        }
        else a.at(s.at(i) - 'a') = true;
    }
    cout << "yes" << endl;
}

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

int main(void){
    int N=0;
    int M=0;
    int C=0;
    int A[20]={0};
    int B[20]={0};
    int count=0;
    int sum=0;

    cin >> N >> M >> C;

    for(int i=0;i<M;i++){
        cin >> B[i];
    }

    for(int i=0;i<N;i++){
        for(int j=0;j<M;j++){
            cin >> A[j];
            sum+=A[j]*B[j];
        }
        sum+=C;
        if(sum>0){
            count++;
            sum=0;
        }else{
            sum=0;
        }
    }

    cout << count << endl;

    return 0;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
#define INF (1<<30)
#define INFLL (1ll<<60)
typedef pair<int, int> P;
typedef pair<int, P> E;
#define MOD (1000000007ll)
#define l_ength size

void mul_mod(ll& a, ll b){
	a *= b;
	a %= MOD;
}

void add_mod(ll& a, ll b){
	a += b;
	if(a>MOD){
		a -= MOD;
	}
}

int a[2020],b[2020],d[2020],n,k,tmp,ans=INF;
vector<int> g[2020];
queue<int> q;

void solve(int x, int y){
	int u,v,j;
	fill(d,d+2020,-1);
	d[x] = k/2;
	q.push(x);
	if(k%2){
		d[y] = k/2;
		q.push(y);
	}
	tmp = n;
	while(!q.empty()){
		u = q.front();
		q.pop();
		--tmp;
		for(j=(g[u].l_ength()-1); j>=0; --j){
			v = g[u][j];
			if(d[v]>=0){
				continue;
			}
			if(d[u]){
				d[v] = d[u]-1;
				q.push(v);
			}
		}
	}
	ans = min(tmp,ans);
}

int main(void){
	int i;
	cin >> n >> k;
	for(i=1; i<n; ++i){
		cin >> a[i] >> b[i];
		--a[i]; --b[i];
		g[a[i]].push_back(b[i]);
		g[b[i]].push_back(a[i]);
	}
	for(i=k%2; i<n; ++i){
		solve((k%2)?a[i]:i,(k%2)?b[i]:(-1));
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 384
from collections import Counter,defaultdict,deque
import sys
import bisect
import math
import itertools
import string
import queue
import copy
from heapq import heappop, heappush
input = sys.stdin.readline
sys.setrecursionlimit(10**8)
mod = 10**9+7

def inp(): # n=1
    return int(input())
def inpm(): # x=1,y=2
    return map(int,input().split())
def inpl(): # a=[1,2,3,4,5,...,n]
    return list(map(int, input().split()))
def inpls(): # a=['1','2','3',...,'n']
    return list(input().split())
def inplm(n): # x=[] 複数行
    return list(int(input()) for _ in range(n))
def inpll(n): # [[1,1,1,1],[2,2,2,2],[3,3,3,3]]
    return sorted([list(map(int, input().split())) for _ in range(n)])
def sortx(x,n,k):
    if k == 0:x.sort(key=lambda y:y[1,n])
    else:x.sort(reversed=True, key=lambda y:y[1,n])
def graph():
    n=inp()
    g=[[] for _ in range(n)]
    for i in range(n):
        a=inp()
        a-=1
        g[i].append(a)
        g[a].append(i)
    return n,g
def graphm():
    n,m=inpm()
    g=[[] for _ in range(n)]
    for _ in range(m):
        a,b,w=inpm()
        a-=1
        b-=1
        g[a].append((b,w))
        g[b].append((a,w))
    return n,m,g

def dijkstra(s,n,g): # sからの最短距離 頂点数n
    s -= 1
    que = []
    d = [10**15 for _ in range(n)]
    d[s] = 0
    heappush( que,(0,s) )
    while len(que)>0:
        p =  heappop(que)
        v = p[1]
        if d[v] < p[0]:
            continue
        for i in range(len(g[v])):
            edge = g[v][i]
            if d[edge[0]] > d[v] + edge[1]:
                d[edge[0]] = d[v] + edge[1]
                heappush( que,(d[edge[0]] , edge[0]) )
    return d

def main():
    n,m,g=graphm()
    s=1
    for i in range(n-1):
        a=i+1
        b=i
        g[a].append((b,0))
    
    dis=dijkstra(s,n,g)
    if dis[n-1]==10**15:
        print(-1)
    else:
        print(dis[n-1])
    
if __name__ == "__main__":
    main()




Measured memory_bytes: 79532
#include <bits/stdc++.h>
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)   FOR(i,0,n)

using namespace std;
using ll = long long;

int solve(vector<vector<int>> &edges, int start) {
	vector<int> color(edges.size(), 0);
	queue<int> q;
	q.push(start);
	color[start] = 1;
	while(!q.empty()) {
		int v = q.front(); q.pop();
		for (int next : edges[v]) {
			// cout << v << " " << next << " " << color[v] << " " << color[next] << endl;
			if (color[next] == 0) {
				q.push(next);
				color[next] = color[v] + 1;
			} else {
				if (color[next] != color[v] + 1 && color[next] != color[v] - 1) {
					return -1;
				}
			}
		}
	}
	int _max = *max_element(color.begin(), color.end());
	return _max;
}

void Main() {
	int N; cin >> N;
	vector<vector<int>> edges(N, vector<int>());
	REP(i, N) {
		string s; cin >> s;
		REP(j, N) {
			if (s[j] == '1') {
		    	edges[i].push_back(j);
		    }
		}
	}
	int ans = -1;
	REP(i, N) {
		int result = solve(edges, i);
		if (result == -1) continue;
		ans = max(ans, result);
	}
	cout << ans << endl;
	// vector<int> color(N, 0);
	// queue<int> q;
	// q.push(0);
	// color[0] = 1;
	// while(!q.empty()) {
	// 	int v = q.front(); q.pop();
	// 	for (int next : edges[v]) {
	// 		if (color[next] == 0) {
	// 			q.push(next);
	// 			color[next] = color[v] + 1;
	// 		} else {
	// 			if (color[next] != color[v] + 1 && color[next] != color[v] - 1) {
	// 				cout << -1 << endl;
	// 				return;
	// 			}
	// 		}
	// 	}
	// }
	// int _max = *max_element(color.begin(), color.end());
	// cout << _max << endl;
}

int main() {
    cin.tie(nullptr);
	ios_base::sync_with_stdio(false);
	cout << fixed << setprecision(15);
	Main();
}


Measured memory_bytes: 512
#include <iostream>
#include <cmath>
#include <cstdlib>
#include <string>

using namespace std;

int main() {
  string S, T;
  cin >> S >> T;

  if (T.size() != S.size() + 1) {
    cout << "No" << endl;
  }

  if ((T.size() == S.size() + 1) && T.find(S) == 0) {
    cout << "Yes" << endl;
    return 0;
  }
  cout << "No" << endl;

  return 0;
}
 


Measured memory_bytes: 3132
#include <bits/stdc++.h>
using namespace std;
using ULL=unsigned long long;
struct cww{cww(){ios::sync_with_stdio(false);cin.tie(0);}}star;
int main()
{
    ULL A, B, X;
    cin >> A >> B >> X;
    cout << B / X - A / X + ( A % X == 0 ? 1 : 0 ) << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <queue>
#define P pair<int,int>
#define PP pair<int,P>
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
using namespace std;


int main() {
int a,b;cin>>a>>b;
int ans = 1;
if(b==100)b++;
rep(i,a) ans *=100;
ans *= b;

cout << ans << endl;

return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>

using namespace std;

int main()
{
    int N, i;
    string ans = "Three";
    cin >> N;

    string *S = new string[N];

    for (i = 0; i < N; i++)
    {
        cin >> S[i];
        if (S[i] == "Y")
            ans = "Four";
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include<string>
#include<algorithm>
#include<cmath>
using namespace std;
int main(void){
    
    string s;
    cin>>s;
    int a[100],n=s.size(),ans=999;
    for(int i=0;i<=n-3;i++){
        int num=(s[i]-'0')*100+(s[i+1]-'0')*10+(s[i+2]-'0');
        ans=min(ans,abs(num-753));
    }
    
    cout<<ans<<endl;
}


Measured memory_bytes: 256
#include<iostream>
#include<stdio.h>
#include<string.h>
using namespace std;
int main()
{   int i;

    char str2[5];
    for(i=0;i<3;i++)
    {
        cin>>str2[i];
    }
    for(i=0;i<3;i++)
    {
        if(str2[i]== 'A' && str2[i+1]== 'B'&&str2[i+2]== 'C')
            {cout<<"ARC";
            return 0;
            }

    }
    cout<<"ABC";
}


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

typedef long long ll;

int cal(long long x,long long k)
{
    while(x%k==0)
    {
        x/=k;
    }
    return x%k==1;
}

int main()
{
    ll n,t;
    cin>>n;
    ll x,sq=sqrt(n),nm,sqq;
    nm=n-1;
    sqq=sqrt(nm);
    ll ans=0;
    for(x=1;x<=sqq;x++)
    {
        if(nm%x==0)
        {
            ans++;
            if(x!=nm/x)ans++;
        }
    }
    for(x=2;x<=sq;x++)
    {
        if(n%x==0){
            ans+=cal(n,x);
            if(x!=n/x)ans+=cal(n,n/x);
            
            
        }
       // cout<<t<<" "<<x<<" "<<endl;
        
        
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define endl '\n'
#define MOD 1e9+7

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

    int n,a = 0,b = 0;
    string s;

    cin >> n >> s;

    for(int i = 0;i < n;i++)
    {
        if(s[i]=='(') a++;
        else a--;
        a = max(a,0);
    }

    for(int i = n-1;i >= 0;i--)
    {
        if(s[i]==')') b++;
        else b--;
        b = max(b,0);
    }

    for(int i = 0;i < b;i++) cout << '(';
    cout << s;
    for(int i = 0;i < a;i++) cout << ')';
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define dump(x) cout << (x) << endl
typedef long long ll;
typedef pair<ll, ll> pl;
typedef pair<int, int> pi;
typedef vector<int> V;

int main() {
  string s;
  cin >> s;
  if (s == "abc" ||
      s == "acb" ||
      s == "bca" ||
      s == "bac" ||
      s == "cab" ||
      s == "cba") dump("Yes");
  else dump("No");
  return 0;
}


Measured memory_bytes: 256
package main

import "fmt"

func main() {
	var n int
	fmt.Scan(&n)
	
	a := n
	b := 0
	for a > 0 {
		b += a % 10
		a /= 10
	}
	
	if n % b == 0 {
		fmt.Println("Yes")
	} else {
		fmt.Println("No")
	}
}


Measured memory_bytes: 512
for i in range(int(input())):
	c,a,n = map(int,input().split())
	cnt1 = min(c,a,n)
	c -= cnt1
	a -= cnt1
	cnt2 = min(c//2,a)
	c -= cnt2*2
	cnt3 = c//3
	print(cnt1+cnt2+cnt3)

#for i in range(int(input())):
#	c,a,n = map(int,input().split())
#	cnt = 0
#	while True:
#		if c<1 or a<1 or n<1:
#			break
#		c -= 1
#		a -= 1
#		n -= 1
#		cnt += 1
#	while True:
#		if c<2 or a<1:
#			break
#		c -= 2
#		a -= 1
#		cnt += 1
#	while True:
#		if c<3:
#			break
#		c -= 3
#		cnt += 1
#	print(cnt)

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

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

  int sockets = 1;
  int count = 0;
  while (sockets < b) {
	sockets += a - 1;
	count++;
  }

  cout << count << endl;


  return 0;
}


Measured memory_bytes: 256
// g++ -I ~/Documents/programming/cppLib -std=gnu++14 -o test ~/Documents/programming/cppLib/test.cpp && ./test && rm test
#include <bits/stdc++.h>
using namespace std;
template <typename T> using vector2 = vector <vector  <T>>;
template <typename T> using vector3 = vector <vector2 <T>>;
template <typename T> using vector4 = vector <vector3 <T>>;
using lint = long long;
#define FOR( i, a, b ) for( lint i=(a) ; i < (b) ; ++i )
#define REP( i, n )    for( lint i= 0  ; i < (n) ; ++i )
#define ALL( v )       (v).begin(), (v).end()

struct rest {
    int number;
    string S;
    int P;
};

bool comp( struct rest a, struct rest b ) {
    if( a.S == b.S ) {
        return a.P > b.P;
    }
    return a.S < b.S;
}

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

    vector<struct rest> R(N);
    REP( i, N ) {
        R[i].number = i+1;
        cin >> R[i].S >> R[i].P;
    }

    sort( ALL(R), comp );

    REP( i, N ) {
        cout << R[i].number << endl;
    }
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
#define lli long long int
#define uli unsigned long long int
#define INF 999999999999999999
#define rep(i,m,n) for(lli i = m;i < n;i++)
#define rrep(i,m,n) for(lli i=m-1;i>=n;i--)
#define pb(n) push_back(n)
#define UE(N) N.erase(unique(N.begin(),N.end()),N.end());
#define Sort(n) sort(n.begin(), n.end())
#define Rev(n) reverse(n.begin(),n.end())
#define Out(S) cout << S << endl
#define NeOut(S) cout << S
#define HpOut(S) cout << setprecision(25) << S << endl
#define Vec(K,L,N,S) vector<L> K(N,S)
#define DV(K,L,N,M,S) vector<vector<L>> K(N,vector<L>(M,S))
#define TV(K,L,N,M,R,S) vector<vector<vector<L>>> K(N,vector<vector<L>>(M,vector<L>(R,S)))
#define pint pair<lli,lli>
#define paf(L,R) pair<L,R>
#define mod 1000000007
#define MAX 5100000
#define ALL(a)  a.begin(),a.end()
#define chmax(a, b) a = (((a)<(b)) ? (b) : (a))
#define chmin(a, b) a = (((a)>(b)) ? (b) : (a))
int dx[4]={1,-1,0,0};
int dy[4]={0,0,1,-1};
int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  lli A,B,C,D,E,F,N,M,K,L,X,Y,Z,H,W,sum=0,num=0,flag=0;string S,T;
  cin >> N >> M;
  DV(G,lli,N,0,0);
  Vec(P,lli,N,-1);
  Vec(dist,lli,N,-1);
  rep(i,0,M){
      cin >> A >> B;
      A--;B--;
      G[A].pb(B);
      G[B].pb(A);
  }
  queue<lli>que;
  que.push(0);
  dist[0]=0;
  while(!que.empty()){
    auto v=que.front();que.pop();
    for(auto nv:G[v]){
        if(dist[nv]!=-1)continue;
        dist[nv]=dist[v]+1;
        P[nv]=v+1;
        que.push(nv);
    }
  }
  rep(i,1,N)if(P[i]==-1)flag=1;
  if(flag)Out("No");
  else {
      Out("Yes");
      rep(i,1,N)Out(P[i]);
  }
}

Measured memory_bytes: 13656
n = int(input())
t, a = map(int, input().split())
h = list(map(int,input().split()))

mintemp = 10 ** 9
ans = 0
for i in range(n):
    temp = t - (h[i] * 0.006)
    if mintemp > abs(a - temp):
        mintemp = abs(a - temp)
        ans = i
print(ans + 1)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
int main(){
	string s;
	cin>>s;
	if (s[0]==s[1] && s[2]==s[3] && s[0]!=s[2]) cout<<"Yes";
	else if (s[0]==s[2] && s[1]==s[3] && s[0]!=s[1]) cout<<"Yes";
	else if (s[1]==s[2] && s[0]==s[3] && s[0]!=s[1]) cout<<"Yes";
	else cout<<"No";
}

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

using ll = long long;
using ull = unsigned long long;

#define all(x) begin(x), end(x)



void solve() {
    ll n, m, k;
    cin >> n >> m >> k;
    ll org_k = k;
    
    // binary search
    vector<ll> pa(n + 1, 0), pb(m + 1, 0);
    for (int i= 1; i <= n; ++i) {
        int x;
        cin >> x;
        
        pa[i] = x + pa[i - 1];        
    }
    for (int i=1; i <= m; ++i) {
        int x;
        cin >> x;
        
        pb[i] = x + pb[i - 1];
    }
    
    ll ans = 0;
    for (ll i = 0; i <= n; ++i) {
        ll rem = k - pa[i];
        if (rem < 0) continue;
        
        auto it = lower_bound(all(pb), rem);
        if (it == end(pb)) {
            ans = max(ans, i + m);
            continue;
        }
        if (*it > rem) it = prev(it); 
        if (it == begin(pb)) {
            ans = max(ans, i);
            continue;
        }
        ans = max(ans, i + distance(begin(pb), it));        
    }
    
    cout << ans << endl;
}







    
    
    
    
    
    
    
    
int main() {
    solve();
}

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

int main(){
  int N,M;
  cin >> N >> M;
  int A[N];
  double sum = 0;
  
  for(int i =0; i<N; i++){
    cin >> A[i];
    sum += A[i];
  }
  sum /= 4 *M;  
  int count = 0;
  for(int i =0; i<N; i++){
    if(A[i] >= sum)count++;
  }
  if(count >= M)cout<< "Yes"<< endl;
  else cout << "No" << endl;
}

Measured memory_bytes: 3572
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <map>
#include <set>
#include <string>
#include<bitset>

using namespace std;
#define loop(i,n) for(int i = 0; i < (n); ++i)
#define loops(i,f,n) for(int i = (f); i < (n); ++i)
#define INF 9999999
#define in(a) cin>>a
#define out(a) cout<<a<<endl

bool graph[10][30];

int dfs(int v, int n, bool visited[10])//v=今見てる頂点のインデックス　n=ノードの数　visited[]=それまでどの頂点を訪れたかを記録した配列
{
	bool all_visited = true;
	loop(i, n)
	{
		if (visited[i] == false)all_visited = false;//全て訪れているかを調べる
	}
	if (all_visited)return 1;//パスが見つかれば1を返す

	int ret = 0;

	loop(i, n)//すべての頂点に対して
	{
		if (graph[v][i] == false)continue;
		if (visited[i])continue;
		//グラフが繋がっている、かつ未訪問ならば
		visited[i] = true;//訪問済みにする
		ret += dfs(i, n, visited);
		visited[i] = false;
	}
	return ret;
}

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

	loop(i, m)
	{
		int a, b;
		cin >> a >> b;
		graph[a - 1][b - 1] = graph[b - 1][a - 1] = true;
	}

	bool visited[10];
	loop(i, n)visited[i] = false;

	visited[0] = true;
	cout << dfs(0, n, visited) << endl;
	return 0;
}

Measured memory_bytes: 256
#define watch5(a,b,c,d,e) cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d << " | "<<#e<<": "<<e<<endl;
#define watch4(a,b,c,d) cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<endl;
#define watch3(a,b,c) cerr <<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<endl;
#define printclock cerr<<"Time : "<<1000*(ld)clock()/(ld)CLOCKS_PER_SEC<<"ms\n";
#define sharingan cerr << "\n-------------------------------------------\n\n";
#define watch2(a,b) cerr <<#a<<": "<<a<<" | "<<#b<<": "<<b<< endl;
#define Yup ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define watch(a) cerr <<#a<<": "<<a<<endl;
#define __gcd(a, b) __algo_gcd(a, b)
#define PI 3.14159265358979323846
#define mod 1000000007
#include<set>
#include<map>
#include<cmath>
#include<stack>
#include<queue>
#include<array>
#include<cstdio>
#include<bitset>
#include<vector>
#include<utility>
#include<sstream>
#include<cstring>
#include <climits>
#include <fstream>
#include<iostream>
#include<iomanip>
#include<algorithm>
#include <unordered_map>
using namespace std;

#define endl "\n"
#define int long long

int dp[100001];

int go( int i, vector<int> &v ){
    int n = v.size();
    if( i >= n )return INT_MAX;
    if( i == n-1 ){
        return 0;
    }
    if( dp[i] != -1 )return dp[i];
    int ans = go(i+1, v) + abs(v[i]-v[i+1]);
    if( i+1 < n ){
        ans = min(ans, go(i+2, v) + abs(v[i]-v[i+2]));
    }
    return dp[i] = ans;
}

int32_t main(){
    Yup;
    int n;
    cin >> n;
    vector<int> v(n);
    for( int i = 0; i < n; i++ ){
        cin >> v[i];
    }
    memset(dp, -1, sizeof(dp));
    cout << go(0, v);
}

Measured memory_bytes: 8064
//#define _GLIBCXX_DEBUG

#include<bits/stdc++.h>
#define PI 3.14159265359
using namespace std;
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
const int INF= 1e9+5;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vector<ll> >vvl;
typedef pair<ll,ll> P;
typedef tuple<ll,ll,ll> T;
const ll MOD=1000000007LL;
string abc="abcdefghijklmnopqrstuvwxyz";
string ABC="ABCDEFGHIJKLMNOPQRSTUVWXYZ";
ll factorial(ll x){
  if(x==0)return 1;
  return x*factorial(x-1)%MOD;
}
int main(){
  ll n;cin>>n;
  vl t(n);
  rep(i,n)cin>>t[i];
  ll sum=0;
  rep(i,n)sum+=t[i];
  ll m;cin>>m;
  vl p(m),x(m);
  rep(i,m)cin>>p[i]>>x[i];
  rep(i,m){
    cout<<sum-t[p[i]-1]+x[i]<<endl;
  }
}

Measured memory_bytes: 256
N,P=map(int,input().split())
A = list(map(int,input().split()))
x = sum([1 for i in A if i%2==0])
y = N - x
#even
ans = (2**x) * (2**max(0,y-1))
#odd
if P == 1:
  ans = (2**x)*(2**y)-ans
print(ans)

Measured memory_bytes: 3064
K, N = map(int,input().split())
lis = list(map(int,input().split()))

import math

m = 0

for i in range(len(lis)):
    a = abs(lis[i] - lis[i-1])
    if K-a <= a:
        a = K-a
    if a >= m:
        m = a

print(K-m)


Measured memory_bytes: 26444
import math
def main():
    A, B, H, M = map(int, input().split())
    Th = 360*(H/12) + 30*(M/60)
    Tm = 6*M
    Th = math.radians(Th)
    Tm = math.radians(Tm)

    xh, yh = A*math.sin(Th), A*math.cos(Th)
    xm, ym = B*math.sin(Tm), B*math.cos(Tm)
    d = math.sqrt((xh - xm)**2 + (yh - ym)**2)
    print(d)

if __name__ == "__main__":
    main()

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

int main () {
    int W, H, x, y, r;
    cin >> W >> H >> x >> y >> r;
    
    if ((W >= x+r && H >= y+r) && (0 <= x-r && 0 <= y-r)) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
}


Measured memory_bytes: 3136
#include<iostream>
#include<string>
#include<queue>
#include<algorithm>
#include<map>
#include<set>
#include<vector>
#include<math.h>

using namespace std;

#define INF 1000000007
#define LINF (1LL << 62)

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


i64 T, n, m, to[10101];
vector<int> v[404];
vector<P> G[404];
vector<vector<int>> dist(404, vector<int>(404, INF));
vector<int> route[404][404];
i64 now = 1, next_t = 0;
i64 have[404] = {0};

void floyd(){
	for(int i = 1; i <= n; i++){
		for(int j = 1; j <= n; j++){
			for(int k = 1; k <= n; k++){
				if(dist[j][k] > dist[j][i] + dist[i][k]){
					//route[j][k] = route[j][i]+route[i][k];
					route[j][k] = route[j][i];
					route[j][k].insert(route[j][k].end(),route[i][k].begin(),route[i][k].end());
					dist[j][k] = dist[j][i] + dist[i][k];
				}
			}
		}
	}
}

P choice_next(int start, i64 t){
	i64 ma = -1, k = -1;
	for(int i = 2; i <= n; i++){
		if(!have[i]) continue;
		if(dist[start][i] >= T-t) continue;
		i64 cnt = 0;
		for(int j = 0; j < route[start][i].size(); j++){
			cnt += have[route[start][i][j]];
		}
		if(ma < cnt * 333 / (dist[start][i])){
			ma = cnt * 333 / (dist[start][i]);
			k = i;
		}
	}
	return P(ma, k);
}

int Move(int start, i64 next_t){
	P choice = choice_next(start, next_t);
	i64 ma = choice.first, k = choice.second;
	if(ma >= 100){
		int npos = route[start][k][0];
		have[npos] = 0;
		for(int i = 0; i < dist[now][npos]; i++){
			if(next_t >= T) break;
			next_t++;
			cout << npos << endl;
		}
		now = npos;
		next_t = Move(now, next_t);
		
		return next_t;
	}
	for(int i = route[1][now].size()-2; i >= -1; i = route[1][now].size()-2){
		int npos;
		if(i == -1) npos = 1;
		else npos = route[1][now][i];
		for(int j = 0; j < dist[now][npos]; j++){
			if(next_t >= T) break;
			next_t++;
			cout << npos << endl;
		}
		now = npos;
	}
	return next_t;
}

int main(){
	cin >> n >> m;
	for(int i = 0; i <= n; i++){
		dist[i][i] = 0;
	}
	for(int i = 0; i < m; i++){
		int a,b,c;
		cin >> a >> b >> c;
		G[a].push_back(P(b,c));
		G[b].push_back(P(a,c));
		dist[a][b] = c;
		dist[b][a] = c;
		route[a][b].push_back(b);
		route[b][a].push_back(a);
	}
	cin >> T;
	for(int i = 0; i < T; i++){
		int a,b,c;
		cin >> a;
		if(a){
			cin >> b >> c;
			v[c].push_back(i);
			to[i] = c;
		}
	}
	
	floyd();
	
	for(i64 t = 0; t < T; t++){
		if(now == 1) have[to[t]]++;
		if(next_t > t) continue;
		next_t = Move(1, t);
		if(next_t == t){
			cout << -1 << endl;
		}
	}
	
	return 0;
}

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

void dfs(string com, int cnt, const string s){
    if(com.size() == 7) {
        int sum = com[0] - '0';
        loop(i, 1, com.size()-1){
            if(com[i] == '+') sum += (com[i+1] - '0');
            else if(com[i] == '-') sum -= (com[i+1] - '0');
        }
        if(sum == 7){
            cout << com << "=7" << endl;
            exit(0);
        }
        return;
    }
    com += s[cnt];
    if(cnt < 3){
        dfs(com+'+', cnt+1, s);
        dfs(com+'-', cnt+1, s);
    } else dfs(com, cnt+1, s);
    return;
}

int main(){
    string s; cin >> s;
    dfs("", 0, s);
    return 0;
}

Measured memory_bytes: 256
N,K = map(int,input().split())
R,S,P = map(int,input().split())
T = list(input())

ans = 0
for i in range(N):
 if(i <= K-1):
   if(T[i] == 'r'):   ans += P
   elif(T[i] == 's'): ans += R
   elif(T[i] == 'p'): ans += S
 else:
   if(T[i-K] != T[i]):
     #上から Pでwin #Rでwin #Sでwin
     if(T[i] == 'r'): ans += P
     elif(T[i] == 's'): ans += R
     elif(T[i] == 'p'): ans += S
   if(T[i-K] == T[i]):
     T[i] = 'A'
      
print(ans)

Measured memory_bytes: 4084
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using ll = long long;
using P = pair<string,int>;
const double PI = acos(-1);

int main() {
int n;
cin >> n;
string ans = ":(";
for(int i = 1; i <= 50000; i++){
  if((int)(i*1.08) == n){
    ans = to_string(i);
    break;
    
  }
}

cout << ans << endl;

}


Measured memory_bytes: 3676
//126 B - YYMM or MMYY 2019/05/19
#include <bits/stdc++.h>
#define rep(i ,n) for(int i=0;i<(int)(n);++i)
using namespace std;
typedef long long int int64;
typedef unsigned long long uint64;

int main(){
    string s; cin >> s;
    string num1 , num2;
    int flag;
    num1=s.substr(0,2); num2=s.substr(2,2);
    int num1_i,num2_i;
    num1_i=stoi(num1); num2_i=stoi(num2);
    if(num1_i<=12 && num1_i!=0 && num2_i<=12 && num2_i!=0)  cout << "AMBIGUOUS"; //1201 0112 ambiguous
    else if(num1_i<=12 && num1_i==0 && num2_i>12) cout << "NA"; //0013
    else if(num1_i<=12 && num1_i!=0) cout << "MMYY"; //1213 MMYY
    else if(num2_i<=12 && num2_i==0 && num1_i>12) cout << "NA"; //1300
    else if(num2_i<=12 && num2_i!=0) cout << "YYMM"; //0012 YYMM
    //else if(num1_i>12 && num2_i<=12 && num2_i==0) cout << "NA"; //1300
    else if(num1_i>12 && num2_i>12) cout << "NA"; //1313 NA
    else if(num1_i==0 && num2_i==0) cout << "NA"; //0000 NA
    cout << endl;
}

Measured memory_bytes: 256
#![allow(unused_macros)]
#![allow(dead_code)]
#![allow(unused_imports)]

use itertools::Itertools;
use std::collections::HashMap;
use text_io::*;

const U_INF: usize = 1 << 60;
const I_INF: isize = 1 << 60;

fn main() {
    let n: usize = read!();
    let mut blue = HashMap::new();
    for _ in 0..n {
        let s: String = read!();
        let b = blue.entry(s).or_insert(0);
        *b += 1;
    }

    let m: usize = read!();
    let mut red = HashMap::new();
    for _ in 0..m {
        let t: String = read!();
        let r = red.entry(t).or_insert(0);
        *r += 1;
    }

    let mut ans = 0;
    for (s, v) in &blue {
        ans = ans.max(v - red.get(s).unwrap_or(&0));
    }

    println!("{}", ans);
}


Measured memory_bytes: 2216
#include <cstdio>
#include <vector>
#include <stack>
#include <iostream>
#include <string>
#include <tuple>
#include <random>
#include <map>
#include <queue>
#include <set>
#include <complex>
#include <algorithm>
#include <cassert>
#include <iterator>
#include <numeric>
#include <cmath>
#include <stdio.h>
#include <functional>

using namespace std;
using ll = long long;
using ld = double;
using P = pair<ll, ll>;
using T = tuple<ll, ll, ll>; //(x, y, dx, dy)
const ll INF = 1e17;
const ld eps = 1e-10;
const ll MOD = 1e9 + 7;

const double pi = acos(-1.0);

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

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	ll N;
	cin >> N;
	vector<ll> a(N);
	for (int i = 0;i < N;i++)
		cin >> a[i];
	vector<ll> l(N, a[0]);
	for (int i = 1;i < N;i++)
		l[i] = gcd(l[i-1], a[i]);
	vector<ll> r(N, a[N-1]);
	for (int i = 1;i < N;i++)
		r[i] = gcd(r[i - 1], a[N-i-1]);
	ll ans = 0;
	for (int i = 0;i < N;i++) {
		if (i == 0)
			ans = max(ans, r[N - 2]);
		else if (i == N - 1)
			ans = max(ans, l[N - 2]);
		else
			ans = max(ans, gcd(l[i - 1], r[N - i - 2]));
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 2560
#define _GLIBCXX_DEBUG
#include<bits/stdc++.h>
using namespace std;
typedef long long int lli;
typedef unsigned long long int ulli;
typedef long double ld;
#define vec(s) vector

#define vvec(s) vector<vector
>
typedef vector<lli> vi;
typedef vector<vi> vvi;
typedef pair<lli,lli> pii;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define Yes(x) cout<<(x?"Yes":"No")<<endl;
#define YES(x) cout<<(x?"YES":"NO")<<endl;
#define out(s) cout<<s<<endl;
#define pb(s) push_back(s);
#define sp " " 
#define INF 10000000000
#define LINF 9000000000000000000
#define all(s) s.begin(),s.end()
void vout(vi v){
    for(lli i=0;i<v.size();i++)
    cout<<v.at(i)<<endl;
}
int main(){
    cout << std::fixed << std::setprecision(10);
    lli n, k;
    cin>>n>>k;
    if(n%2!=0){ 
        n++;
    }
    YES(n/2>=k);
}

Measured memory_bytes: 3644
#include<iostream>
#include<vector>
#include<algorithm>
#include<iomanip>
#include<map>
#include<set>
#include<queue>

using namespace std;

#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define ALL(a) (a).begin(),(a).end()
#define PI 3.141592653589793238
#define INF 1050000000
#define INFL (long long)(4e18)

using vi = vector<int>;

template<class T>
struct Edge {
    int to;
    T cost;
    Edge() {};
    Edge(int to, T cost) : to(to), cost(cost) {};
};

template<class T>
class Graph {
    int n;
    bool directed;
    vector<vector<Edge<T>>> edges;
public:

    Graph(int n, bool directed) :n(n), directed(directed), edges(vector<vector<Edge<T>>>(n)){};
    Graph() {};

    void add(int to, T cost) {
        emplace_back(to, cost);
    }

    int size() {
        return n;
    }
};


int main() {

    long long N,K;

    cin >> N >> K;

    int count = 0;

    int pow = 1;

    while(1){
        if(N<pow){
            break;
        }
        pow = pow*K;
        count++;
    }

    cout << count << endl;

    return 0;
}

Measured memory_bytes: 256
import collections
S = input()
N = len(S)
mod = 2019
div = [0]*(N+1)
for i in range(N):
    div[i+1] = (div[i] + int(S[N-1-i])*pow(10,i,mod))%mod
d = collections.Counter(div[1::])
ans = d[0]
for i in d.values():
    ans += i*(i-1)//2
print(ans) 

Measured memory_bytes: 72112
#include <bits/stdc++.h>
#define fi first
#define se second
#define pb push_back
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;

int main() {
    ios_base::sync_with_stdio(0);
    string s; cin >> s;
    cout << ((accumulate(s.begin(), s.end(), 0)-s.length()*48)%9==0? "Yes": "No") << endl;
}


Measured memory_bytes: 3744
#include<iostream>
#include<vector>
#include<queue>
#define rep(i,n) for (int i = 0; i < n; i++)
using namespace std;
using ll = long long;
using P = pair<int,int>;

int main() {
  int a[3][3] = {0};  
  rep(i,3) {
    rep(j,3) {
      cin >> a[i][j];
    }
  }
  
  int n;
  cin >> n;
  vector<int> b(n);
  rep(i,n) cin >> b[i];

  int c[3][3] = {0};

  rep(i,n) {
    rep(j,3) {
      rep(k,3) {
        if( a[j][k] == b[i]) c[j][k]++;
      }
    }
  }

  rep(i,3) {
    if( c[i][0] > 0 && c[i][1] > 0 && c[i][2] > 0) {
      cout << "Yes" << endl;
      return 0;
    }
    if( c[0][i] > 0 && c[1][i] > 0 && c[2][i] > 0) {
      cout << "Yes" << endl;
      return 0;
    }
  }

  if( c[0][0] > 0 && c[1][1] > 0 && c[2][2] >0 ) {
    cout << "Yes" << endl;
    return 0;
  }
  
  if( c[0][2] > 0 && c[1][1] > 0 && c[2][0] > 0) {
    cout << "Yes" << endl;
    return 0;
  }

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

 


Measured memory_bytes: 888
#!/usr/bin/env python3

import os
import sys
import numpy as np

def ncut(l, x):
  return np.sum(np.ceil(l / x) - 1)

def solve(N, K, AS):
  ng, ok = -1, np.amax(AS)
  while abs(ok - ng) > 1:
    mid = (ok + ng) // 2
    if ncut(AS, mid) <= K:
      ok = mid
    else:
      ng = mid

  return ok.item()


def main():
  d = np.fromstring(sys.stdin.read(), dtype=np.int64, sep=' ')
  N, K = d[:2]
  AS = d[2:]

  print('{}'.format(solve(N, K, AS)))

if __name__ == '__main__':
  main()

Measured memory_bytes: 32052
import java.io.*;

public class Main {

  static long x;
  
  public static void main(String[] args) throws Exception {
    
    BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

    String[] in = br.readLine().split(" ");
    x = Long.parseLong(in[0]);

    br.close();

    long m = 100L;
    int ans = 0;
    while(m < x){
      m += m / 100;
      ans++;
    }

    System.out.println(ans);
    
  }

}

Measured memory_bytes: 32612
#include <iostream>
#include <vector>
#include<list>
#include <algorithm>
#include <string>
#include <math.h>
#include<map>
#include <utility>

#include<queue>
using namespace std;
#define REP(i,n) for(int i=0;i<n;i++)
 
#define INF (1e8)
typedef long long unsigned int ll;
#define SIZE_OF_ARRAY(array) (sizeof(array)/sizeof(array[0]))
 

template<typename T>
int vector_finder(std::vector<T> vec, T number) {
  auto itr = std::find(vec.begin(), vec.end(), number);
  size_t index = std::distance( vec.begin(), itr );
  if (index != vec.size()) { // 発見できたとき
    return 1;
  }
  else { // 発見できなかったとき
    return 0;
  }
}

template<typename T>
T gcd(T a,T b){
	if(b>0){
		return gcd(b, a % b);
	}else{
		return a;
	}
}

template<typename T>
T lcm(T a,T b){
	T g = gcd(a, b);
	return a * b / g;
}

void clear( std::queue<pair<int,int> > &q )
{
   std::queue<pair<int,int> > empty;
   std::swap( q, empty );
}

int N;
int ans = 0;

int main()
{
	cin >> N;
	ll a[N];
	int b1=0;
	int b2 = 0;
	int b4 = 0;
	REP(i, N)
	{
		cin >> a[i];
		if(a[i]%4==0){
			b4++;
		}else if(a[i]%2==0){
			b2++;
		}else{
			b1++;
		}
	}

	if(b2==0){
		if(b1<=b4+1){
			cout << "Yes" << endl;
		}else{
			cout << "No" << endl;
		}
	}else{
		if(b1<=b4){
			cout << "Yes" << endl;
		}else{
			cout << "No" << endl;
		}
	}


	return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
#include <math.h>
using namespace std;
int main(){
    int N,T,A;
    cin>>N>>T>>A;
    vector<int>H(N);
    for(int i=0;i<N;i++){
        cin>>H.at(i);
    }
    double sa=100000;

    for(int i=0;i<N;i++){
     if(abs(T-H.at(i)*0.006-A)<=sa){sa=abs(T-H.at(i)*0.006-A);}
    }
    for(int i=0;i<N;i++){
        double ka=abs(T-H.at(i)*0.006-A);
     if(ka==sa){cout<<i+1<<endl;break;}
        }
    return 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 P = pair<int, int>;

int main() {
  int n, sum = 0;
  cin >> n;
  vector<int> v(n);
  rep(i, n){
    cin >> v.at(i);
  }
  sort(v.begin(), v.end());
  int maxL = v[n-1];
  rep(i, n-1){
  	sum += v[i];
  }
  if(maxL < sum){
  	cout << "Yes" << endl;
  }else{
  	cout << "No" << endl;
  }
  return 0;
}

Measured memory_bytes: 256