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

int main(){
  vector<vector<int>> card(3, vector<int>(3));
  vector<vector<bool>> check(3, vector<bool>(3, false));
  for (int i = 0; i < 3; i++){
    for (int j = 0; j < 3; j++){
      cin >> card.at(i).at(j);
    }
  }
  int N, b;
  cin >> N;
  for(int i = 0; i < N; i++){
    cin >> b;
    for (int i = 0; i < 3; i++){
      for (int j = 0; j < 3; j++){
        if (b == card.at(i).at(j)){
          check.at(i).at(j) = true;
        }
      }
    }
  }
  
  bool ans = false;
  
  if (check.at(0).at(0) == true && check.at(1).at(0) == true  && check.at(2).at(0) == true){
    ans = true;
  }
  if (check.at(0).at(1) == true && check.at(1).at(1) == true  && check.at(2).at(1) == true){
    ans = true;
  }
  if (check.at(0).at(2) == true && check.at(1).at(2) == true  && check.at(2).at(2) == true){
    ans = true;
  }
  if (check.at(0).at(0) == true && check.at(0).at(1) == true  && check.at(0).at(2) == true){
    ans = true;
  }
  if (check.at(1).at(0) == true && check.at(1).at(1) == true  && check.at(1).at(2) == true){
    ans = true;
  }
  if (check.at(2).at(0) == true && check.at(2).at(1) == true  && check.at(2).at(2) == true){
    ans = true;
  }
  if (check.at(0).at(0) == true && check.at(1).at(1) == true  && check.at(2).at(2) == true){
    ans = true;
  }
  if (check.at(0).at(2) == true && check.at(1).at(1) == true  && check.at(2).at(0) == true){
    ans = true;
  }
  
  if (ans) cout << "Yes";
  else cout << "No";
}
  
  

Measured memory_bytes: 3612
#include <stdio.h>

int main(int argc, const char * argv[]) {
    
    int a, b, c;
    
    scanf("%d %d %d", &a, &b, &c);
    
    if (a < b && b < c){
        printf("Yes\n");
    }else{
        printf("No\n");
    }
    
    return 0;
}

Measured memory_bytes: 580
#import math
#import copy
#import sys
#import bisect
#input = sys.stdin.readline
mod=10**9+7
def swap(a,b):
    c=a
    a=b
    b=c
    return a,b
def factorial(x): #階乗計算
    n=1
    for i in range(x):
        n=(n*(i+1))%mod
    return n

def gcd(a, b):
    if b == 0:
        return a
    else:
        return gcd(b, a%b)
def lcm(a, b):
    return((a*b)//gcd(a,b))
def div(x): #約数配列
    div=[1]
    check=2
    while(x!=1 and check <= int(x**0.5)+2):
        if(x%check==0):
            div.append(check)
            while(x%check==0):
                x=x//check
        check+=1
    if x != 1:
      div.append(x)
    return div
def div2(x): #素因数分解配列
    div2=[]
    check=2
    while(x!=1 and check <= int(x**0.5)+2):
        while x%check==0:
            div2.append(check)
            x/=check
        check+=1
    if x != 1:
      div2.append(x)
    return div2

def main():
    # x,y = map(int,input().split())           x=1,y=2
    # a = input().split()                      a=['1','2','3',...,'n']
    # a = list(map(int,input().split()))       a=[1,2,3,4,5,...,n]
    # li = input().split('T')	              FFFTFTTFF => li=['FFF', 'F', '', 'FF']
    # 複数行の「1 2 3 4」型の入力を一配列に
    # x = sorted([list(map(int, input().split())) for _ in range(n)])
    # ソート x.sort(key=lambda y:y[1])
    # [chr(i) for i in range(97, 97+26)] 英語小文字リスト
    # [chr(i) for i in range(65, 65+26)] 英語大文字リスト atcoder
    # ord(c) chr(2) alphabet <=> number
    n=int(input())
    cnt=a=b=ba=0
    for _ in range(n):
        s=input()
        for i in range(len(s)-1):
            if s[i:i+2]=="AB":
                cnt+=1
        if s[0]=="B" and s[len(s)-1]=="A":
            ba+=1
        elif s[0]=="B":
            b+=1
        elif s[len(s)-1]=="A":
            a+=1
    if ba==0:print(cnt+min(a,b))
    else:
        print(cnt+ (ba-1 if a+b==0 else ba+min(a,b)) )
main()

Measured memory_bytes: 55256
#include <stdio.h>
int main(void)
{
	int a,b,t,i,j;
	while(scanf("%d %d",&a,&b) != EOF)
	{
		if(a < b){
				t = a;
				a = b;
				b = t;
			 }
		i = a;
		j = b;
		while(a != 0 && b != 0)
		{
			a = a % b;
			if(a == 0){
					printf("%d %d\n",b,i/b*j);
					break ;
			  	  }
			b = b % a;
			if(b == 0){
					printf("%d %d\n",a,i/a*j);
					break ;
			  	  }  
		}
	}

	return 0;
}

Measured memory_bytes: 596
a, b, c = map(int, input().split())
k = int(input())
ans = "No"
for ia in range(k + 1):
    for ib in range(k + 1):
        for ic in range(k + 1):
            if ia + ib + ic > k:
                break
            if (b * 2 ** ib > a * 2 ** ia) and (c * 2 ** ic > b * 2 ** ib):
                ans = "Yes"
print(ans)


Measured memory_bytes: 9132
// common include
#include <bits/stdc++.h>
using namespace std;
typedef pair<int, int> P;

int main() {
    int n, m;
    int i, j, k;
    vector<P> v;
    vector<int> num;
    cin >> n >> m;
    for (i = 0; i < m; i++) {
        cin >> j >> k;
        v.push_back(P(j, k));
    }
    for (i = 1; i <= n; i++) {
        num.push_back(i);
    }
    int result = 0;
    do {
        if (num[0] != 1) break;
        bool complete = true;
        for (i = 0; i < n - 1; i++) {
            bool exist = false;
            for (j = 0; j < v.size(); j++) {
                if (num[i] == v[j].first && num[i + 1] == v[j].second || num[i + 1] == v[j].first && num[i] == v[j].second) {
                    exist = true;
                    break;
                }
            }
            if (!exist) complete = false;
        }
        if (complete) result++;
    } while (next_permutation(num.begin(), num.end()));
    cout << result << endl;
    return 0;
}


Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <cmath>
#include <algorithm>
#include <vector>
#include <numeric>
#include <queue>
#include <map> 
#include <set>
#include <string>
#include <functional>
#include <list>
#include <random>
#include <time.h>
#include <iomanip>
#include <assert.h>
#include <numeric>
#define int long long
#define double long double
#define oku7 1000000007
#define MAXN (int)1e+5 * 2+1
#define LL_MAX 9223372036854775807	//ない環境用
#define LL_HALFMAX 9223372036854775807 / 2	//ない環境用

using namespace std;
std::mt19937 mt((int)time(0));

int dx[4] = { 0, 1, 0, -1 }; // x軸方向への変位
int dy[4] = { 1, 0, -1, 0 }; // y軸方向への変位


signed main() {
	string s;
	cin >> s;
	int len = s.length();
	if (s[0] == s[s.length() - 1]) {
		len -= 1;
	}
	//ここでのlenは実際に取る数と偶奇が等しい
	if (len % 2 == 0) cout << "Second\n";
	else cout << "First\n";

	return 0;
}

Measured memory_bytes: 512
use proconio::input;

#[proconio::fastout]
fn main() {
    input! {
        n: usize,
        m: usize,
        k: usize,
        a: [usize; n],
        b: [usize; m],
    }
    let mut a_fold: Vec<usize> = vec![0; n + 1];
    let mut b_fold: Vec<usize> = vec![0; m + 1];
    for i in 0..n {
        a_fold[i + 1] = a[i] + a_fold[i];
    }
    for i in 0..m {
        b_fold[i + 1] = b[i] + b_fold[i];
    }
    let mut ans = 0;
    let mut last = k;
    let mut b_best = m;
    for i in 0..(n + 1) {
        if last < a_fold[i] {
            break;
        }
        last = last - a_fold[i];

        while b_fold[b_best] > last {
            b_best -= 1;
        }
        ans = std::cmp::max(ans, i + b_best);
        last = k;
    }
    println!("{}", ans);
}


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

using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
#define a first
#define b second
#define sz size()
#define pb(x) push_back(x) 
#define bg begin()
#define ed end()
#define rep(i,n) for(ll i=0;i<n;i++)
#define rep1(i,n) for(ll i=1;i<=n;i++)
#define mp(x,y) make_pair(x,y)
const ll MOD=1000000007;
const ll INF=1000000000000000;

vector<ll> pw2(51,1); vector<ll> pw10(19,1);
ll maxx(ll x,ll y,ll z){return max(max(x,y),z);}
ll minn(ll x,ll y,ll z){return min(min(x,y),z);}
ll mid(ll x,ll y,ll z){return x>y?y>=z?y:min(z,x):x>=z?x:min(y,z);}
ll gcd(ll x,ll y){if(x%y==0) return y;else return gcd(y,x%y);}
ll lcm(ll x,ll y){return x*(y/gcd(x,y));}
ll myceil(ll x,ll y){if(x<=y) return 1;else if(x%y==0) return x/y;else return x/y+1;}
vector<ll> divisor(ll x){
	vector<ll> div;
	for(int i=1;i*i<=x;i++){
		if(i*i!=x && x%i==0){
			div.pb(i);
			div.pb(x/i);
		}
		else if(x%i==0) div.pb(i);
	}
	return div;
}
vector<ll> vectorprime(ll x){
	vector<bool> is_prime(x+1);
	vector<ll> prime;
	rep(i,x+1) is_prime[i]=true;
	is_prime[0]=is_prime[1]=false;
	for(int i=2;i<=x;i++){
		if(is_prime[i]){
			prime.pb(i);
		}
		for(int j=i*2;j<=x;j+=i) is_prime[j]=false;
	}
	return prime;
}

//a,b x
int main(){
	ll N,x; cin>>N>>x;
	vector<ll> A(N);
	ll ans=0;
	rep(i,N){
		cin>>A[i];
		if(A[i]>x){
			ans+=A[i]-x;
			A[i]=x;
		}
	}
	//x以下
	ll spt=1;
	while(spt<N){
		if(A[spt]+A[spt-1]>x){
			ll tmp=A[spt]+A[spt-1]-x;
			A[spt]-=tmp;
			ans+=tmp;
		}
		spt++;
	}
	cout<<ans;
}

Measured memory_bytes: 1024
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <cmath>
#include <iomanip>
#define rep(i,n) for (int i=0; i < (n); ++i)
using namespace std;
typedef long long ll;

int main(){
    int n;
    cin >> n;
    vector<int> L(n);
    rep(i, n) cin >> L[i];
    sort(L.begin(), L.end());
    int ans=0;
    for(int b=0; b<n; b++){
        for(int a=0; a<b; a++){
            int ab = L[a]+L[b];
            int r = lower_bound(L.begin(), L.end(), ab) - L.begin();
            int l = b+1;
            ans += max(0, r-l);
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3604
#include<algorithm>
#include<bitset>
#include<cassert>
#include<cctype>
#include<cerrno>
#include<cfloat>
#include<ciso646>
#include<climits>
#include<clocale>
#include<cmath>
#include<complex>
#include<csetjmp>
#include<csignal>
#include<cstdarg>
#include<cstddef>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<ctime>
#include<ctype.h>
#include<cwchar>
#include<cwctype>
#include<deque>
#include<exception>
#include<fstream>
#include<functional>
#include<iomanip>
#include<ios>
#include<iosfwd>
#include<iostream>
#include<istream>
#include<iterator>
#include<limits>
#include<list>
#include<locale>
#include<map>
#include<math.h>
#include<memory>
#include<new>
#include<numeric>
#include<ostream>
#include<queue>
#include<set>
#include<sstream>
#include<stack>
#include<stdexcept>
#include<stdio.h>
#include<stdlib.h>
#include<streambuf>
#include<string.h>
#include<string>
#include<typeinfo>
#include<utility>
#include<valarray>
#include<vector>
using namespace std;
inline void gtmx(int &a,int b){
	if (a<b) a=b;
}
int adj[16][16];
int dist[16][32788];
int ins[32788];
int dp[16][32788];
int main(void){
	int n,m;
	int tot=0;
	scanf("%d%d",&n,&m);
	for (int i=1;i<=m;++i){
		int u,v,w;
		scanf("%d%d%d",&u,&v,&w);
		tot+=w;
		--u;
		--v;
		adj[u][v]=adj[v][u]=w;
	}
	int mxst=(1<<n)-1;
	for (int i=1;i<=mxst;++i){
		for (int j=0;j<n;++j){
			if (!(i&(1<<j))) continue;
			for (int k=j+1;k<n;++k){
				if (!(i&(1<<k))) continue;
				ins[i]+=adj[j][k];
			}
		}
	}
	memset(dp,128,sizeof(dp));
	dp[0][1]=0;
	for (int st=1;st<mxst;++st){
		int lft=mxst^st;
		for (int i=0;i<n;++i){
			if (!(st&(1<<i))) continue;
			for (int j=0;j<n;++j){
				if (st&(1<<j)) continue;
				if (adj[i][j]){
					gtmx(dp[j][st|(1<<j)],dp[i][st]+adj[i][j]);
				}
			}
			for (int j=lft;j;j=(j-1)&lft){
				gtmx(dp[i][st|j],dp[i][st]+ins[j|(1<<i)]);
			}
		}
	}
	printf("%d",tot-dp[n-1][mxst]);
	return 0;
}

Measured memory_bytes: 4352
#include<stdio.h>
int main()
{
	int n,m,i,j,s;
	int a[10]={0,2,4,8,16,32,64,108};
	while(scanf("%d%d",&n,&m)!=EOF)
	{
		s=(n-m)*100;
		s+=m*1900;
		s*=a[m];
		printf("%d\n",s);
	}
} 

Measured memory_bytes: 128
// AOJ 1068: School of Killifish
// 2017.12.14 bal4u@uu

#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#define INF 0x7fffffff

int pool[8000002];
int **seg;
int h, w;
int r1, c1, r2, c2, g;
char buf[10000000], *p;

int getint()
{
	int n = 0;
	while (*p >= '0') n = (n<<3) + (n<<1) + (*p++ & 0xf);
	p++;
	return n;
}

void update(int r, int c, int x)
{
	int c2, t, a;

	r += h - 1;
	c += w - 1;
	seg[r][c] = x;

	while (r >= 0) {
		c2 = c;
		while (c2) {
			if (!(c2 & 1)) c2--;
			t = c2, c2 >>= 1;
			a = seg[r][t++]; if (a > seg[r][t]) a = seg[r][t];
			seg[r][c2] = a;
		}
		if (r == 0) break;

		if (!(r & 1)) r--;
		t = r, r >>= 1;
		a = seg[t++][c]; if (a > seg[t][c]) a = seg[t][c];
		seg[r][c] = a;
	}
}
 
int query2(int l, int r, int k)
{
	int m, lmin, rmin;

	if (c2 <= l || r <= c1) return INF;
    if (c1 <= l && r <= c2) return seg[g][k];
     
	k <<= 1, m = (l + r) >> 1;
    lmin = query2(l, m, ++k);
    rmin = query2(m, r, ++k);
    if (lmin > rmin) lmin = rmin; 
    return lmin;
}
 
int query(int l, int r, int k)
{
	int m, lmin, rmin;

    if (r2 <= l || r <= r1) return INF;
    if (r1 <= l && r <= r2) { g = k; return query2(0, w, 0); }
    
	k <<= 1, m = (l + r) >> 1;
    lmin = query(l, m, ++k);
    rmin = query(m, r, ++k);
    if (lmin > rmin) lmin = rmin;
    return lmin;
}
 
int main()
{
	int R, C, Q, h2, w2, r, c, i;

    while (fgets(p=buf, 40, stdin) && *p != '0') {
		R = getint(), C = getint(), Q = getint();

		h = w = 1;
		while (h < R) h <<= 1;
		while (w < C) w <<= 1;

		h2 = (h << 1) - 1, w2 = (w << 1) - 1;

		memset(pool, 0, sizeof(pool));
		seg = malloc(h2 * sizeof(int *));
		for (c = r = 0; r < h2; r++, c += w2) seg[r] = pool + c;

        for (r = 0; r < R; r++) {
			fgets(p=buf, 10000000, stdin);
			for (c = 0; c < C; c++)	update(r, c, getint());
        }

        for (i = 0; i < Q; i++) {
			fgets(p=buf, 100, stdin);
			r1 = getint(), c1 = getint(), r2 = getint()+1, c2 = getint()+1;
            printf("%d\n", query(0, h, 0));
        }

		free(seg);
    }
    return 0;
}

Measured memory_bytes: 48952
S = input()
count = 0
frag = 0
for i in range(len(S)):
  if i%2 != 0 and S[i] != 'R':
    count = count+1
  elif i%2 == 0 and S[i] != 'L':
    count = count+1
  else:
    frag = 1
if frag == 0:
  print('Yes')
else:
  print('No')

Measured memory_bytes: 3060
#include <iostream>
#include <cmath>

static const int MOD = 1000000007;
using namespace std;

int main() {
    double m; int T;
    cin >> m >> T;
    double pi = acos(-1);
    m /= 180/pi;
    double ans = 0;
    for (int _ = 0; _ < T*100; ++_) {
        double t = _/100.0;
        double x = 3800, p = 19;
        double cs = x*p*cos(m+t*pi*2*60/2500000)*sin(t/120*pi*2);
        double A = x*x+p*p-2*cs, B = x*x-cs, C = 3800*3800-18*18;
        double d = B*B-A*C;
        if(d > 0 && (B+sqrt(d))/A < 1) ans += 0.01;
    }
    printf("%.10lf\n", ans);
    return 0;
}


Measured memory_bytes: 3544
#include<cstdio>
#include<iostream>
#include<algorithm>
#include<string>
#include<cstring>
#include<cmath>
#include<map>
#include<vector>
#include<utility>
#include<queue>
#include<stack>
#include<set>
#include<ctime>
#include<unordered_map>
const  int N = 2e6*1.0;
const int mod = 1e9 + 7;
const int INF = 0x3f3f3f3f;
typedef long long ll;
typedef long double lw;
#define sc(n) scanf("%d",&n)
#define fo(i,a,b) for(int i=a;i<b;i++)
#define mem(a,b) memset(a,b,sizeof a)
using namespace std;

int main()
{
	int n, k;
	cin >> n >> k;
	if (k == 1)
		cout << 0 << endl;
	else
		cout << n - k << endl;
	return 0;
}

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

#define rep(i,o,n) for(auto i=o;i<n;i++)

typedef vector<vector<long long>> matrix;

const int P=1000000007;
int n;


matrix multiply(matrix& m1,matrix& m2){
	matrix ans(n,vector<long long>(n,0));

	rep(i,0,n){
		rep(j,0,n){
			rep(k,0,n){
				ans[i][j] = (ans[i][j]+ m1[i][k]*m2[k][j])%P;
			}
		}
	}

	return ans;
}

matrix binexp(matrix G,long long k){
	if(k==0){
		matrix I(n,vector<long long>(n,0));
		rep(i,0,n)
			I[i][i]=1;
		return I;
	}
	matrix sqr = multiply(G,G);
	matrix res = binexp(sqr,k>>1);
	if(k&1)
		return multiply(G,res);
	return res;
}

int main(){
	long long k;
	cin>>n>>k;
	matrix G(n,vector<long long>(n,0));
	
	rep(i,0,n)
		rep(j,0,n)
			cin>>G[i][j];

	matrix A = binexp(G,k);
	
	int sum = 0;
	rep(i,0,n)
		rep(j,0,n)
			sum = (sum+A[i][j])%P;

	cout<<sum<<endl;
}


Measured memory_bytes: 6288
#include<stdio.h>

int main(){
  int N;
  int str[200];
  int count = 0;
  int flag = 0;

  
  scanf("%d",&N);
  for(int i = 0; i<N; i++){
    scanf("%d", &str[i]);
  }
  int res = 1000000000;
  for(int i=0; i<N; i++){
    count = 0;

    if(str[i]%2 != 0){
      flag =1;
    }
    while(str[i] % 2 == 0){
      str[i] /= 2;
      ++count;
    }
    if( res > count && count >=1 ){
      res = count;
    }
  }
  
  if(flag==0){
    printf("%d", res);
  }else {
    printf("0\n");
  }
  return 0;


}

Measured memory_bytes: 128
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>

typedef long long int ll;

#define FOR(i,n,m) for(ll i=(ll)(m);i<(ll)(n);++i)
#define REP(i,n) FOR(i,n,0)
#define IREP(i,n) for(ll i=(ll)(n);i>=0;--i)

const ll MOD = 1000000007;

using namespace std;

bool V[55];

int main()
{
	int N;
	cin >> N;
	string S[2];
	cin >> S[0] >> S[1];

	REP(i, N)
	{
		V[i] = false;
	}

	int s = 2;
	ll sum = 6;
	if (S[0][0] == S[1][0])
	{
		sum = 3;
		s = 1;
		V[0] = true;
	}

	FOR(i, N, s)
	{
		if (S[0][i] == S[1][i])
		{
			if (V[i - 1])
			{
				sum *= 2;
			}
			V[i] = true;
		}
		else
		{
			if (V[i - 1])
			{
				sum *= 2;
			}
			else
			{
				sum *= 3;
			}
			i++;
		}
		sum %= MOD;
	}

	cout << sum << endl;
	return 0;
}

Measured memory_bytes: 256
#include<map>
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
using namespace std;
int main()
{
	map < string, vector<int> > p;
	string s;
	int page;
	while (cin >> s >> page){
		p[s].push_back(page);
	}

	map< string, vector<int> >::iterator it;
	for (it = p.begin(); it != p.end(); it++){
		sort(p[(*it).first].begin(), p[(*it).first].end());
		cout << (*it).first << endl;
		for (int i = 0; i < p[(*it).first].size(); i++){
			if (i == p[(*it).first].size()-1){
				cout << p[(*it).first][i];
				break;
			}
			cout << p[(*it).first][i] << " ";
		}
		cout << endl;
	}
}

Measured memory_bytes: 1244
//defines e includes
#include <bits/stdc++.h>
#define fastio ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0)
#define rep1(i, n) for(int i=0;i<(int)n;i++)
#define rep2(i, a, b) for(int i=(int)a;i<(int)b;i++)
#define st first
#define nd second
#define pb push_back
#define pf push_front
#define p_b pop_back
#define p_f pop_front
#define mp make_pair
#define MAX 200010
#define oo INT_MAX
using namespace std;
//tipagem de pares
typedef pair<int, int> ii;
typedef pair<char, char> cc;
typedef pair<int, char> ic;
typedef pair<char, int> ci;
typedef pair<int, string> istr;
//tipagem de vetores
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<pair<int, int>> vii;
typedef vector<istr> vistr;
typedef vector<bool> vb;
//tipagem de outras estruturas
typedef queue<int> qi;
typedef deque<int> dqi;
//tipagem de tipos primitivos
typedef long long int ll;
typedef unsigned long long int ull;

int main()
{
	
	fastio;
	int n, v[MAX];
	cin >> n;
	rep1(i, n){
		cin >> v[i];
	}
	int is = 1;
	int min = v[0];
	rep1(i, n){
		if(v[i] < min){
			min = v[i];
			is++;
		}
	}
	cout << is << endl;
	return 0;
}

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

bool check[(int)1e9];

int main() {
    int N;
    cin >> N;
    vector<int> A(N);
    for(int i=0; i<N; i++){
        cin >> A[i];
    }

    bool flag = true;
    for(int i=0; i<N; i++){
        if(check[A[i]] == false){
            check[A[i]] = true;
        }else{
            flag = false;
            break;
        }
    }

    if(flag){
        cout << "YES" << endl;
    }else{
        cout << "NO" << endl;
    }

    return 0;
}

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


int main(){
    int N;
    cin >> N;
    vector<int> a(N), c(111111);
    for(int i=0; i<N; i++){
        cin >> a[i];
        c[a[i]]++;
        c[a[i]+1]++;
        if(a[i]>0) c[a[i]-1]++;
    }
    sort(c.begin(),c.end());
    reverse(c.begin(),c.end());
    
    cout << c[0] << endl;
}


Measured memory_bytes: 1024
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author Jaynil
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        CRally solver = new CRally();
        solver.solve(1, in, out);
        out.close();
    }

    static class CRally {
        public void solve(int testNumber, InputReader in, PrintWriter out) {
            int n = in.nextInt();
            int x[] = new int[n];
            for (int i = 0; i < n; i++) x[i] = in.nextInt();
            int ans = 0;
            long max = Long.MAX_VALUE;
            for (int i = 1; i <= 100; i++) {
                long temp = 0;
                for (int j = 0; j < n; j++) {
                    temp += (i - x[j]) * (i - x[j]);
                }
                if (temp < max) {
                    max = temp;
                    ans = i;
                }
            }
            out.println(max);
        }

    }

    static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

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

    }
}



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

int main(){
    int n, cnt = 0, area;
    cin >> n;

    for(int i = 0; i < n; i++){
        cin >> area;
        for(int x = 1; 2*x*x + 2*x <= area; x++){
            if((area-x)%(2*x+1) == 0){
                cnt++;
                break;
            }
        }
    }

    cout << n-cnt << endl;

    return 0;
}


Measured memory_bytes: 3084
using System;
class aoj
{
    static void Main()
    {
        char[] k = new char[50];
        int l = 0;
        while (true)
        {
            bool[,] a = new bool[8,8];
            int c = 0, d = 0;
            bool f = true;
            for (int i = 0; i < 8; i++)
            {
                string b = Console.ReadLine();
                if (String.IsNullOrEmpty(b)) goto stop;
                for(int j = 0; j < 8; j++)
                {
                    if (b[j] == '0')
                    {
                        a[i, j] = false;
                    }
                    else
                    {
                        a[i, j] = true;
                        if (f)
                        {
                            c = i;
                            d = j;
                            f = false;
                        }
                    }
                }
            }
            if (c<7&&d<7&&a[c, d] && a[c + 1, d] && a[c, d + 1] && a[c + 1, d + 1])
            {
                k[l] = 'A';
                l++;
            }
            else if (c < 5 && a[c, d] && a[c + 1, d] && a[c + 2, d] && a[c + 3, d])
            {
                k[l] = 'B';
                l++;
            }
            else if (d < 5 && a[c, d] && a[c, d + 1] && a[c, d + 2] && a[c, d + 2])
            {
                k[l] = 'C';
                l++;
            }
            else if (c < 6 && d > 0 && a[c, d] && a[c + 1, d - 1] && a[c + 1, d] && a[c + 2, d - 1])
            {
                k[l] = 'D';
                l++;
            }
            else if (c < 7 && d < 6 && a[c, d] && a[c, d + 1] && a[c + 1, d + 1] && a[c + 1, d + 2])
            {
                k[l] = 'E';
                l++;
            }
            else if(c < 6 && d < 7 && a[c, d] && a[c + 1, d] && a[c + 1, d + 1] && a[c + 2, d + 1])
            {
                k[l] = 'F';
                l++;
            }
            else if (c < 7 && d < 7 && d > 0 && a[c, d] && a[c, d + 1] && a[c + 1, d - 1] && a[c + 1, d])
            {
                k[l] = 'G';
                l++;
            }
            Console.ReadLine();
        }
        stop:;
        for(int i = 0; i < l; i++)
        {
            Console.WriteLine(k[i]);
        }
    }
}

Measured memory_bytes: 8816
#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>

//Code Short
#define REP(i,n) for(int i = 0;i < n;++i)
#define PB(s) push_back(s)
#define DSORT(n) sort(n.begin(),n.end())
#define QECHO(n) cout << n
#define QECHOS(n) cout << n << " "

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

using namespace std;
typedef long long ll;
/* prototype */
int EDSum(ll);//各桁の和
vector<int> SOE(int,int);//素数 (Min,Max)
int MinCM(int,int);//最小公倍数(num1,num2)
int MaxCD(int,int);//最大公約数(num1,num2)
vector<int> igets(int);//cin * N
ll nPr(ll,ll); //(n,r)
ll nE(ll); //(n)
ll nCr(ll,ll); //(n,r)

void solve(){
  //START
  string a;
  cin >> a;
  int b;
  cin >> b;
  for(int i=0;i<a.length();i+=b){
    cout << a[i];
  }
  cout << endl;
}

int main(void){cin.tie(0);ios::sync_with_stdio(false);solve();}
int EDSum(ll number) {
  int ans = 0;
  while (1) {
    ans += number % 10;
    number /= 10;
    if (number == 0) break;
  }
  return ans;
}

vector < int > SOE(int min, int max) {
  if (min < 2) min = 2;
  vector < int > int_array;
  for (int i = min; i <= max; i++) int_array.push_back(i);
  vector < int > sosu;
  double stop = sqrt(max);
  while (true) {
    sosu.push_back(int_array.front());
    int_array.erase(int_array.begin());
    if (stop < (double)(sosu.back())) break;
    for (int i = 0; i < (int) int_array.size(); i++) {
      if (int_array[i] % sosu.back() == 0)
        int_array.erase(int_array.begin() + i);
    }
  }
  sosu.insert(sosu.end(), int_array.begin(), int_array.end());
  return sosu;
}

int MinCM(int a, int b) {
  int c = a * b;
  if (a < b)
    swap(a, b);
  int r = a % b;
  while (r != 0) {
    a = b;
    b = r;
    r = a % b;
  }
  return c / b;
}

int MaxCD(int a, int b) {
  if (a < b)
    swap(a, b);
  int r = a % b;
  while (r != 0) {
    a = b;
    b = r;
    r = a % b;
  }
  return b;
}
vector < int > igets(int N) {
  vector < int > A;
  int temp;
  for (int i = 0; i < N; ++i) {
    cin >> temp;
    A.push_back(temp);
  }
  return A;
}

ll nPr(ll n, ll r) {
  ll ans = 1;
  r = n - r;
  while (n != r) {
    ans *= n;
    --n;
  }
  return ans;
}

ll nE(ll n) {
  return nPr(n, n);
}

ll nCr(ll n, ll r) {
  if (r == 0) return -1;
  else {
    if (0 != n - r && n - r < r) r = n - r;
    return nPr(n, r) / nE(r);
  }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int n,m,sum=0,i,j;
int mat[10001][1001],ve[10001];
int main()
{

    cin>>n>>m;
    for(i=0;i<n;i++)
    {
        for(j=0;j<m;j++)
        {
            cin>>mat[i][j];
        }
    }
    for(j=0;j<m;j++) cin>>ve[j];
    for(i=0;i<n;i++)
    {
        sum=0;
        for(j=0;j<m;j++)
        {
            sum+=mat[i][j]*ve[j];
        }
        cout<<sum<<endl;
    }

    return 0;
}



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

int main (){
	int A, B;cin>>A >> B;
	if((A+B)%2==1){
		cout << "IMPOSSIBLE" << endl;
		return 0;
	}
	cout<<(A+B)/2<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <bitset>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <functional>
#include <iostream>
#include <queue>
#include <set>
#include <map>
#include <unordered_map>
#include <stack>
#include <string>
#include <vector>
 
using namespace std;
typedef long long ll;
using gra = vector<vector<ll>>;
using gram = vector<unordered_map<ll,ll>>;
 
typedef unsigned long long ull;
 
template <class T> inline bool chmin(T &a, T b) { if (a > b) { a = b; return true; } return false; }
template <class T> inline bool chmax(T &a, T b) { if (a < b) { a = b; return true; } return false; }
 
template <class T> T gcd(T a, T b) { return b ? gcd(b, a % b) : a; }
template <class T> T lcm(T a, T b) { return a / gcd(a, b) * b; }
template <class T> T dup(T a, T b) { return (a + b - 1) / b; }
template <class T> T modpow(T x, T p, T m) { T a=1; while(p){ if(p%2)a =a*x%m; x = x+x%m; p/=2; } return a; }
// template <class T> void prim(T a) { for(ll i=0;i<a.size();++i) { cout << a[i]; } cout << "\n"; }
 
#define mod 1000000007LL
#define INF 10000000000000000LL
 
#define rep(i, n) for (ll i = 0; i < n; ++i)
#define rep1(i, n) for (int i = 1; i <= n; ++i)
#define rrep(i, n) for (int i = (n - 1); i >= 0; --i)
#define rrep1(i, n) for (int i = n; i > 0; --i)
 
#define pri(x) cout << (x) << "\n"
#define pri2(x, y) cout << (x) << " " << (y) << "\n"
#define pri3(x, y, z) cout << (x) << " " << (y) << " " << (z) << "\n"
//#define modpow(x, p, m) { ll a=1; while(p){ if(p%2)a =a*x%m; x = x+x%m; p/=2; } return a; }
 
#define m0(h) memset(h, 0, sizeof(h))
#define m1(h) memset(h, 1, sizeof(h))
#define m(h, n) memset(h, (n), sizeof(h))
#define all(n) (n).begin(),(n).end()
#define bit(n) (1LL << (n))
#define pb push_back
 
//#ifdef LOCAL
//
//#define dpri(...) fprintf(stderr, __VA_ARGS__)
//#define pria(g) rep(i,g.size()){ cout << i << "{"; rep(j,g[i].size()) cout << g[i][j] << " "; cout << "}" << "\n"; }
//#else
//#define dpri(...) 42
//#define pria(g) 42
//#endif
 
 
 
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  // ---------------------
  // コーディング開始
  // ---------------------
  ll n;
  cin >> n;
  ll ok = 200;
  ll ho[201];
  m0(ho);
  rep1(i,ok){
    ll no = i;
    while(1){
      ho[no]+=1;
      no+=i;
      if(no>ok) break;
    }
  }
  ll ans = 0;
  rep1(i,n){
    //pri2(i,ho[i]);
    if(ho[i]==8) if(i%2==1)ans++;
  }
  pri(ans);







  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <cmath>
#include<algorithm>
#include<stack>
#include<queue>
#include<map>
#include<set>
#include<iomanip>
#define _USE_MATH_DEFINES
#include <math.h>
#include <functional>
using namespace std;

#define rep(i,x) for(int i=0;i<x;i++)
#define repn(i,x) for(int i=1;i<=x;i++)

typedef long long ll;
const ll INF = 1e17;
const ll MOD = 998244353;
const ll MAX = 1000000;

ll max(ll a, ll b) {
	if (a > b) { return a; }
	return b;
}

ll min(ll a, ll b) {
	if (a > b) { return b; }
	return a;
}

//gcd,lcm,べき,二進展開
//組み合わせ、mod計算
//最短路問題、bit、union find

///////////////////////////



bool beki(ll k) {
	for (ll i = 1; i <= 31; i++) {
		for (ll j = 2; j <= 7; j++) {
			if (pow(i, j) == k) { return true; }
		}
	}
	return false;
}

	
int main() {
	ll x;
	cin >> x;

	ll ans = 1;

	repn(i, x) {
		if (beki(i) == 1) { ans = i; }
	}
	cout << ans;
	system("PAUSE");
}

Measured memory_bytes: 504
#include<bits/stdc++.h>
using namespace std;
#define mods 1000000007
#define pb push_back
#define mp make_pair
#define st first
#define nd second
typedef long long int lint;
typedef unsigned long long int ulint;

lint n,dp[100020],dizi[100020];
int main(){
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
	lint i,j,k,l;
	cin>>n;
	for(i=1;i<=n;i++){
		cin>>dizi[i];
	}
	dp[1]=0;
	dp[2]=abs(dizi[1]-dizi[2]);
	for(i=3;i<=n;i++) dp[i]=fmin(dp[i-1]+abs(dizi[i]-dizi[i-1]),dp[i-2]+abs(dizi[i]-dizi[i-2]));
	cout<<dp[n];
	
	
	
	
	
	return 0;
}


Measured memory_bytes: 1792
#include<iostream>
#include<cmath>
#include<algorithm>
#include <cassert>
#include<string>
#include<vector>
#include <utility>
using namespace std;
int a = 0, b = 0, c = 0, d = 0, e[60][60], f[100200], g[100200], h[100200], counto = 1000000000, ans =1 , x[100] = {}, y, z;
int64_t ab[10000] = {}, abc = 0, abcd = 0;
pair<int, int>manji[101] = {};
char rikka, toka[150][150] = {};
vector<int> train, code;
vector<char>aka, ao;
string saya, homu, kyok, mami[108], mado[100];
bool gg = true ,ap=false;
bool exist[100200];
int main() {
	cin >> a;
	for (int i = 0; i < a; i++) {
		cin >> mami[i];
		if ( i != 0) {
			if (mami[i].substr(0, 1) != mami[i - 1].substr(mami[i - 1].length() - 1) ) {
				//cout << mami[i - 1].substr(mami[i - 1].length()-1) << endl;
				//cout << mami[i].substr(0,1) << endl;
				cout << "No" << endl;
				return 0;
			}
			//cout << '1' << endl;
		}
		/*if (mami[i].length() == 1) {
			mami
		}*/
		for (int j = 0; j < i; j++) {
			if (mami[j] == mami[i]) {
				cout << "No" << endl;
				return 0;
			}
		}
		//cout <<'2'<< endl;
	}
	cout << "Yes" << endl;


	return 0;
}


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

const long long INF = 1LL << 60;

int main()
{
    string n;
    cin >> n;
    for (int i = 0; i < n.size(); i++)
    {
        if (n[i] == '9')
            n[i] = '1';
        else if (n[i] == '1')
            n[i] = '9';
    }
    cout << n << endl;
    return 0;
}


Measured memory_bytes: 3596
#include "bits/stdc++.h"
using namespace std;
#ifdef _DEBUG
#include "dump.hpp"
#else
#define dump(...)
#endif

//#define int long long
#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define rrep(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define all(c) begin(c),end(c)
const int INF = sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD = (int)(1e9) + 7;
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 (b < a) { a = b; return true; } return false; }

struct Dinic {
	using Flow = int;
	struct Edge {
		int to, rev;
		Flow cap;
		Edge() {}
		Edge(int to, int rev, Flow cap) :to(to), rev(rev), cap(cap) {}
	};
	int n;
	vector<vector<Edge>> g;
	vector<bool> used;
	vector<int> level;
	vector<int> iter;
	Dinic(int n) :n(n), g(n), used(n), level(n), iter(n) {};
	void addArc(int from, int to, Flow cap) {
		g[from].emplace_back(to, (int)g[to].size(), cap);
		g[to].emplace_back(from, (int)g[from].size() - 1, 0);
	}
	void addEdge(int a, int b, Flow cap) {
		g[a].emplace_back(b, (int)g[b].size(), cap);
		g[b].emplace_back(a, (int)g[a].size() - 1, cap);
	}
	Flow maximumFlow(int s, int t) {
		Flow total = 0;
		while (true) {
			levelize(s);
			if (level[t] < 0)return total;
			fill(iter.begin(), iter.end(), 0);
			Flow f;
			while (true) {
				f = augment(s, t, INF);
				if (f == 0)break;
				total += f;
			}
		}
	}
	Flow augment(int v, int t, Flow f) {
		if (v == t)return f;
		for (int &i = iter[v]; i < g[v].size(); i++) {
			Edge &e = g[v][i];
			if (e.cap > 0 && level[v] < level[e.to]) {
				Flow d = augment(e.to, t, min(f, e.cap));
				if (d > 0) {
					e.cap -= d;
					g[e.to][e.rev].cap += d;
					return d;
				}
			}
		}
		return 0;
	}
	void levelize(int s) {
		fill(level.begin(), level.end(), -1);
		queue<int> q;
		level[s] = 0;
		q.emplace(s);
		while (q.size()) {
			int v = q.front(); q.pop();
			for (int i = 0; i < g[v].size(); i++) {
				Edge &e = g[v][i];
				if (e.cap > 0 && level[e.to] < 0) {
					level[e.to] = level[v] + 1;
					q.emplace(e.to);
				}
			}
		}
	}
};

signed main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	int N; cin >> N;
	rep(c, 1, N + 1) {
		int W, H; cin >> W >> H;
		vector<vector<int>> r(H, vector<int>(W));
		int sum = 0;
		rep(i, 0, H) rep(j, 0, W) { cin >> r[i][j]; sum += r[i][j]; }
		Dinic dinic(W*H + 2);
		int s = dinic.n - 2, t = s + 1;
		auto inrange = [&](int i, int j) { return i >= 0 && i < H && j >= 0 && j < W; };
		rep(i, 0, H) {
			rep(j, 0, W) {
				if ((i + j) % 2 == 0) {
					dinic.addArc(s, i*W + j, r[i][j]);
					static const int di[] = { 1,0,-1,0 };
					static const int dj[] = { 0,1,0,-1 };
					rep(k, 0, 4) {
						int ni = i + di[k], nj = j + dj[k];
						if (inrange(ni, nj)) {
							dinic.addArc(i*W + j, ni*W + nj, INF);
						}
					}
				}
				else {
					dinic.addArc(i*W + j, t, r[i][j]);
				}
			}
		}
		cout << "Case " << c << ": " << sum - dinic.maximumFlow(s, t) << endl;
	}
	return 0;
}

Measured memory_bytes: 3260
#include<cstdio>
#include<cstring>
using namespace std;
char s[100];
int main()
{
	scanf("%s",s);
	if (s[0]=='Y'&&s[1]=='A'&&s[2]=='K'&&s[3]=='I')
	  printf("Yes");
	else
	  printf("No");
}

Measured memory_bytes: 128
require 'set'; require 'prime'
INF=Float::INFINITY
s = gets.chomp.split(//)

gcount=0
pcount=0
ans = 0
s.each do |e|
  if e == 'g'
    if gcount > pcount
      ans += 1
      pcount += 1
    else
      gcount += 1
    end
  else
    if gcount > pcount
      pcount += 1
    else
      ans -= 1
      gcount += 1
    end
  end
end

puts ans

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

ll sum[200010];

int bin_s(int l, int r){
	ll g=(sum[l]+sum[r])/2;
	int ok=l, ng=r;
	while(ok+1<ng){
		int mid=(ok+ng)/2;
		if(sum[mid]<=g) ok=mid;
		else ng=mid;
	}
	if(g-sum[ok]<sum[ng]-g) return ok;
	else return ng;
}

int main() {
	int N;
	cin >> N;
	for(int i=0; i<N; ++i){
		ll A;
		cin >> A;
		sum[i+1]=sum[i]+A;
	}
	ll ans=1e15;
	for(int i=2; i+2<=N; ++i){
		int form=bin_s(0, i), latt=bin_s(i, N);
		ll mn=min(sum[form], sum[i]-sum[form]), mx=max(sum[form], sum[i]-sum[form]);
		mn=min(mn, min(sum[latt]-sum[i], sum[N]-sum[latt]));
		mx=max(mx, max(sum[latt]-sum[i], sum[N]-sum[latt]));
		ans=min(ans, mx-mn);
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
 
#define ll          long long
#define pb          push_back
#define mp          make_pair
#define pii         pair<int,int>
#define vi          vector<int>
#define vll         vector<ll>
#define all(a)      (a).begin(),(a).end()
#define lol         1000000007
#define rep(i,a,b)    for(int i=a;i<b;i++)
#define SIZE        1000005
#define debug(x)    cerr << #x << " = " << x << endl;
#define F             first
#define S             second
#define endl        '\n'
#define deci(n)     cout<<fixed<<setprecision(n);
const double         pi=acos(-1.0);


using namespace std;

void MOD(ll &x)
{
    if (x >= lol) x -= lol;
    if (x < 0) x += lol;
}

ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }




void solve()
{
    int n;
    cin>>n;
    ll arr[n];
    rep(i,0,n) cin>>arr[i];
    sort(arr,arr+n);
    ll ans[n];
    int i = 1;
    while(2*i-1 < n)
    {
        ans[2*i-1] = arr[n-i];
        i++;
    }
    int k = n-i;
    int j = 0;
    i = 2;
    while(i<n)
    {
        ans[i] = arr[j];
        j++;
        i += 2;
    }
    ans[0] = arr[j];
    ll boii = -ans[0];
    int sign = 1;
    rep(i,1,n-1)
    {
        boii += sign*2*ans[i];
        sign *= -1;
    }
    boii += sign*ans[n-1];
    // rep(i,0,n) cout<<ans[i]<<" ";
    // cout<<boii<<endl;
    reverse(arr,arr+n);
    i = 1;
    while(2*i-1 < n)
    {
        ans[2*i-1] = arr[n-i];
        i++;
    }
    k = n-i;
    j = 0;
    i = 2;
    while(i<n)
    {
        ans[i] = arr[j];
        j++;
        i += 2;
    }
    ans[0] = arr[j];
    ll boii1 = ans[0];
    sign = -1;
    rep(i,1,n-1)
    {
        boii1 += sign*2*ans[i];
        sign *= -1;
    }
    // rep(i,0,n) cout<<ans[i]<<" ";
    boii1 += sign*ans[n-1];
    // cout<<boii<<endl;
    cout<<max(boii,boii1)<<endl;


    
    
}



// Remove  debugs!!

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
//    #ifndef ONLINE_JUDGE
//        freopen("input.txt", "r", stdin);
//        freopen("output.txt", "w", stdout);
//    #endif
    int t=1;
//    cin>>t; int i=1;
    while(t--){
        //cout<<"Case #"<<i++<<": ";
        solve();
            //cout<<endl;    
      }
    return 0;
}

Measured memory_bytes: 1792
import java.util.*;
public class Main{
	static String Rort(String s, String t){
		String ss = s + s;
		ss = ss.replaceFirst(t, "");
		if(ss.equals(s))return "Yes";
		return "No";
	}

	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		String S = sc.next();
		String T = sc.next();
		System.out.println(Rort(S, T));
	}
}

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

int N, A, B, C;
vector<int> l;

int Dfs(int now, int a, int b, int c) {
  if (now == N) {
    if (min(min(a, b), c) > 0) return abs(a - A) + abs(b - B) + abs(c - C) - 30;
    else return 1000000000;
  }

  int cost0 = Dfs(now + 1, a, b, c);
  int cost1 = Dfs(now + 1, a + l[now], b, c) + 10;
  int cost2 = Dfs(now + 1, a, b + l[now], c) + 10;
  int cost3 = Dfs(now + 1, a, b, c + l[now]) + 10;

  return min(min(min(cost0, cost1), cost2), cost3);
}

int main() {
  cin >> N >> A >> B >> C;
  l.resize(N);
  for (int i = 0; i < N; i++) cin >> l[i];
  cout << Dfs(0, 0, 0, 0) << endl;
}

Measured memory_bytes: 256
#d=["a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"]
#import numpy as np
import math
#n=int(input())
#li=input().split()
#S=input()
#import fractions
#n=int(input())

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

if lis[0]<lis[2] and lis[1]>lis[2]:
    ans="Yes"
elif lis[0]>lis[2] and lis[1]<lis[2]:
    ans="Yes"
else:
    ans="No"

print(ans)


Measured memory_bytes: 3060
tanni = ["", "Man", "Oku", "Cho", "Kei", "Gai", "Jo", "Jou", "Ko", "Kan", "Sei", "Sai", "Gok", "Ggs", "Asg", "Nyt", "Fks", "Mts"]
while true
	n, m = gets.chomp.split.map(&:to_i)
	break if [n, m] == [0, 0]
	x, arr = (n ** m), []
	while x > 0
    	x, r = x.divmod 10000
	    arr << r.to_s
	end
    0.upto(arr.length - 1){|i|
        case arr[i]
        when "0" then arr[i] = ""
        else arr[i] += tanni[i]
        end
    }
	puts arr.reverse.join
end


Measured memory_bytes: 6888
import sys
import heapq, math
from itertools import zip_longest, permutations, combinations, combinations_with_replacement
from itertools import accumulate, dropwhile, takewhile, groupby
from functools import lru_cache
from copy import deepcopy


def gcd(x, y):
    while y != 0:
        x, y = y, x % y

    return x


N, X = map(int, input().split())
x = list(map(int, input().split())) + [X]

x.sort()

y = 0
for i in range(N):
    y = gcd(x[i + 1] - x[i], y)

print(y)


Measured memory_bytes: 14892
#pragma GCC optimize("Ofast,no-stack-protector,unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")

#include <bits/stdc++.h>
#define int long long
#define endl '\n'
#define null nullptr
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(), x.rend()
#define pb push_back
#define mp make_pair
#define test int t; cin>>t; while(t--)
#define FAST                          \
    ios_base::sync_with_stdio(false); \
    cin.tie(NULL);                    \
    cout.tie(NULL)

using namespace std;

typedef vector<int> vi;
typedef vector<pair<int,int>> vii;
typedef pair<int,int> pii;
typedef unordered_map<int,int> mp;

const int mod = 1e9+7;
const int inf = 1e17+21;



int32_t main(){
    FAST;

    int n;  cin >> n;
    int m;  cin >> m;
    int start;  cin >> start;

    unordered_map<int,int> has_toll;
    for(int x=0,t;x<m;x++){
        cin >> t;
        has_toll[t] = 1;
    }

    int ans = inf;
    int sum1 = 0 , sum2 = 0;

    for(int x=start+1;x<=n;x++){
        if(has_toll[x]) sum1++;
    }

    for(int x=start-1;x>=0;x--){
        if(has_toll[x]) sum2++;
    }

    cout << min(sum1 , sum2);


    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>
// using namespace __gnu_pbds;
using namespace std;

// #define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
#define ll long long int
#define ld long double
#define pb push_back
#define mp make_pair

ll h[100005],ans[100005];

ll fep(ll x, ll y, ll mod)
{ll res=1;while(y>0){if(y&1)res=(res*x)%mod;
    y=y>>1;x=(x*x)%mod;}return res%mod;}

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

	ll n,i;
	cin >> n;
	for(i=0;i<n;i++)
	{
		cin >> h[i];
		if(i>0)	ans[i]=1000000000;
	}
	ans[1]=abs(h[1]-h[0]);
	for(i=2;i<n;i++)
		ans[i]=min(ans[i-1]+abs(h[i]-h[i-1]),ans[i-2]+abs(h[i]-h[i-2]));
	cout << ans[n-1];

	return 0;
}


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

int main()
{
	int n,m,c,a[20][20],b[20],v=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[i][j];
		
	for(int i=0;i<n;i++){
		int sum=0;
		for(int j=0;j<m;j++) sum+=a[i][j]*b[j];
		if(sum+c>0) v++;
	}
	
	cout<<v<<endl;
	
	return 0;
}


Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Text;
using System.Numerics;
using System.IO;

namespace SolutionCS
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] s = Console.ReadLine().Split(' ');
            int N = int.Parse(s[0]);
            int M = int.Parse(s[1]);

            List<int>[] lists = new List<int>[N];
            for (int i = 0; i < N; i++)
            {
                lists[i] = new List<int>();
            }

            for (int i = 0; i < M; i++)
            {
                s = Console.ReadLine().Split(' ');
                int f = int.Parse(s[0]) - 1;
                int t = int.Parse(s[1]) - 1;

                lists[f].Add(t);
                lists[t].Add(f);
            }

            bool[] reach = new bool[N];

            int ans = CanAllReach(0, N, lists, reach);

            Console.WriteLine(ans);
        }

        static int CanAllReach(int from, int nodeNum, List<int>[] edgeList, bool[] reachFlas)
        {
            reachFlas[from] = true;

            bool allreach = true;
            for (int i = 0; i < nodeNum; i++)
            {
                allreach &= reachFlas[i];
            }
            if (allreach)
            {
                return 1;
            }

            int ans = 0;
            foreach(int t in edgeList[from])
            {
                if (!reachFlas[t])
                {
                    bool[] newReach = new bool[nodeNum];
                    Array.Copy(reachFlas, newReach, nodeNum);

                    ans += CanAllReach(t, nodeNum, edgeList, newReach);
                }
            }

            return ans;
        }
    }
}


Measured memory_bytes: 13268
#include<stdio.h>
int main(void)
{
	int n=0;
	int i=0;
	int kane=100000;
	scanf("%d",&n);
	for (i=0;i<n;i++)
	{
		kane=kane*0.05+kane;
		if (kane%1000!=0)
		{
			kane/=1000;
			kane*=1000;
			kane+=1000;
		}
	}
	printf("%d\n",kane);
	return 0;
}

Measured memory_bytes: 592
#include<stdio.h>
int main(void)
{
	int h,w,i,j;
	char a[200][200],b[200][200];
	scanf("%d%d",&h,&w);
	for(i=0;i<=h+1;i++){
		for(j=0;j<=w+1;j++) b[i][j]='#';
	}
	for(i=0;i<h;i++) scanf("%s",a[i]);
	for(i=0;i<h;i++){
		for(j=0;j<w;j++){
			b[i+1][j+1]=a[i][j];
		}
	}
	for(i=0;i<=h+1;i++)printf("%s\n",b[i]);
	return 0;
}

Measured memory_bytes: 256
N = int(input())
ABC = [[int(i) for i in input().split()]for _ in range(N)]

dp = [[0]*4 for _ in range(N+1)]
for i in range(N):
  for j in range(3):
    for k in range(3):
      if j == k:
        continue
      dp[i+1][j] = max(dp[i+1][j], dp[i][k]+ABC[i][j])
print(max(dp[N]))

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

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

int main(){
  int k,g,t,sum=0;
  cin>>k;
  for(int i=1;i<=k;i++){
    for(int j=1;j<=k;j++){
      for(int x=1;x<=k;x++){
        g=gcd(i,j);
        t=gcd(g,x);
        sum+=t;
      }
    }
  }
  cout<<sum;
}


Measured memory_bytes: 3676
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int n,k,i,j,sum=0;
	cin>>n>>k;
	int a[n];
	for(i=0;i<n;i++)
		cin>>a[i];
	sort(a,a+n);
	for(i=0;i<k;i++)
		sum=sum+a[i];
	cout<<sum;
}

Measured memory_bytes: 3628
inputDataStr = input()
splitData = list(map(int, inputDataStr.split()))
maxData = 0
minData = 0
allNinzuu = splitData[0]

if(splitData[1] > splitData[2]):
	maxData = splitData[1]
	minData = splitData[2]
else:
	maxData = splitData[2]
	minData = splitData[1]

if(allNinzuu > (splitData[1] + splitData[2])):
	minRyouhou = 0
else:
	minRyouhou =(splitData[1] + splitData[2]) - allNinzuu

print(minData, end=" ")
print(minRyouhou)


Measured memory_bytes: 3064