akhauriyash/Code-Regression huggingface dataset:
#include<stdio.h>
#define M 45
int fibo(int );
int i=0,f[M];
int main(){
  int s;
  scanf("%d",&s);
  printf("%d\n",fibo(s));
}
int fibo(int x){
  if(f[x]>0)return f[x];
  if(x==0||x==1)return 1;
  else return f[x]= fibo(x-1)+fibo(x-2);
}



Measured memory_bytes: 2112
#include<iostream>
int dp[1000000];
int main(){
	int n;
	std::cin>>n;
	dp[0]=1;
	dp[1]=1;
	for(int i=2;i<=n;i++){
		dp[i]=dp[i-1]+dp[i-2];
	}
	std::cout<<dp[n]<<"\n";
}

Measured memory_bytes: 3100
string = 'abcdefghijklmnopqrstuvwxyz'

num = int(input())
ans = ""
while num != 0:
    num, m = divmod(num, 26)
    if m == 0:
        ans = string[m-1] + ans
        num = num - 1
    else:
        ans = string[m-1] + ans

print(ans)

Measured memory_bytes: 9188
#include <iostream>
#include <fstream>
#include <string>
#include <cmath>
#include <cstdio>
#include <algorithm>
#include <iomanip>
#include <vector>
#include <utility>
#include <numeric>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <unordered_map>
#include <limits.h>
#include <bitset>
#include <math.h>
#define int long long
using namespace std;
using P = pair<int, int>;
using ll = long long;
using prique = priority_queue<int>;
const int MOD = 1000000007;
const int INF = LLONG_MAX/3;
const int MAX = 710000;

/*-----Library-----*/

struct UnionFind {
    vector<int> par; // 親ノード
    vector<int> rank; // ランク
    vector<int> sizeuf; //要素数
    UnionFind(int n = 1) {
        init(n);
    }

    void init(int n = 1) {
        par.resize(n); rank.resize(n); sizeuf.resize(n);
        for (int i = 0; i < n; ++i) {
            par[i] = i;
            rank[i] = 0;
            sizeuf[i]=1;
        }
    }

    int root(int x) {
        if (par[x] == x) {
            return x;
        }
        else {
            int r = root(par[x]);
            return par[x] = r;
        }
    }

    bool issame(int x, int y) {
        return root(x) == root(y);
    }

    bool merge(int x, int y) {
        x = root(x); y = root(y);
        if (x == y) return false;
        if (rank[x] < rank[y]) swap(x, y);
        if (rank[x] == rank[y]) ++rank[x];
        par[y] = x;
        sizeuf[x]+=sizeuf[y];
        return true;
    }

    int size(int x){
        return sizeuf[root(x)];
    }
};

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

long long lcm(long long i,long long j){
    return i*(j/gcd(i,j));
}

long long fac[MAX], finv[MAX], inv[MAX];
// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

// 二項係数計算
long long COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
/*-----Library-----*/
signed main(){
    int t,tt;
    cin>>t>>tt;
    int a,aa,b,bb;
    cin>>a>>aa>>b>>bb;
    int d,dd;
    d=(a-b)*t;
    dd=(aa-bb)*tt;
    if((d>0&&dd>0)||(d<0&&dd<0)||abs(d)>abs(dd))cout<<0<<endl;
    else if(d+dd==0)cout<<"infinity"<<endl;
    else{
        int ans=0;
        ans+=(abs(d)/abs(d+dd))*2;
        if(abs(d)%abs(d+dd)!=0)ans++;
        cout<<ans<<endl;
    }
}



Measured memory_bytes: 256
//Created by Aminul on 9/13/2020.

import java.io.*;
import java.util.*;
import static java.lang.Math.*;

public class Main {
    public static void main(String[] args)throws Exception {
        Scanner in = new Scanner(System.in);
        PrintWriter pw = new PrintWriter(System.out);
        int x = in.nextInt();
        pw.println(x ^ 1);
          
        pw.close();
    }

    static void debug(Object...obj) {
        System.err.println(Arrays.deepToString(obj));
    }
}

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

int main(){
    long long n,k;
    cin >> n >> k;
    long long ans = 0;
    for(long long i=n+1;i>=k;i--){
        long long max,min;
        long long tempn,tempi;
        tempn = n%MOD;
        tempi = i%MOD;
        long long temp = (tempn + tempn - tempi +1)%MOD;
        max=(temp*tempi)/2;
        min=(tempi*(tempi-1))/2;
        temp = (max-min+1)%MOD;
        ans += temp;
        ans %= MOD;
    }
    cout <<(long long) ans << endl;
}

Measured memory_bytes: 3672
#include<bits/stdc++.h>
using namespace std;
#define ll long long 
#define INF 999999999
#define rep(i,n) for(int i=0;i<n;i++)
const int mod = 1000000007;
ll cnt = 0;
bool flag=0;
int dfs(int y,int x);
int h,w;  
char table[100][100];
int dp[100][100];

int main(){
  cin >> h >> w;
 
  rep(i,h){
     rep(j,w){
        cin >> table[i][j];
      
     }
  }
 
dfs(0,0);



rep(i,h){
   rep(j,w){
      if(table[i][j] == '#'){
         cout << "Impossible" << endl;
         return 0;
      }  
   }
}


cout << "Possible" << endl;
return 0;

}

int dfs(int y,int x){
   table[y][x] = '.';
   int nx,ny;
   nx = x+1;
   ny = y+1;
   if(0<=nx && nx<w && 0<=ny && ny<h && table[ny][x] == '#' && table[y][nx] == '#'){
      return 0;
   }

   if( 0<=ny && ny<h && table[ny][x] == '#' ){
      dfs(ny,x);
   }
   if(0<=nx && nx<w &&  table[y][nx] == '#'){
      
      dfs(y,nx);
   }

   
}

Measured memory_bytes: 256
#include <stdio.h>
#include <assert.h>
#include <fstream>
#include <iostream>
#include <algorithm>
#include <array>
#include <vector>
#include <queue>
#include <set>
#include <cmath>
#include <unordered_map>
//#include <unordered_set>
//#include <boost/container/static_vector.hpp>
//#include <boost/unordered_set.hpp>
//#include <boost/unordered_map.hpp>
//#include <unistd.h>

long long pow_mod(long long x, long long n, long long mod_num) {
    long long res = 1;
    while (n > 0) {
        if (n & 1) { res = (res * x) % mod_num; }
        x = (x * x) % mod_num;
        n = (n >> 1);
    }
    return res;
}

const long long MOD = 1000000007;
const int MAX_N = 410;
const int MAX_C = 410;
const int MAX_V = 410;
int N, C;
long long A[MAX_N], B[MAX_N];

long long val_ac[MAX_C][MAX_V] = {};
long long dp[MAX_N][MAX_C] = {};
 
int main(int argc, char **argv) {
    std::cin >> N >> C;

    for (int i = 1; i <= N; i++) {
        std::cin >> A[i];
    }

    for (int i = 1; i <= N; i++) {
        std::cin >> B[i];
    }

    for (int n = 0; n < MAX_C; n++) {
        for (int v = 1; v < MAX_V; v++) {
            val_ac[n][v] = (val_ac[n][v-1] + pow_mod(v, n, MOD)) % MOD;
        }
    }

    for (int j = 0; j <= C; j++) {
        dp[1][j] = (val_ac[j][B[1]] - val_ac[j][A[1] - 1] + MOD) % MOD;
        //dp[1][j] = pow_mod(A[1], j, MOD);
        //std::cout << 1 << " " << j << " " << A[j] << " " << dp[1][j] << std::endl;
    }

    for (int i = 2; i <= N; i++) {
        for (int j = 0; j <= C; j++) {
            for (int k = 0; k + j <= C; k++) {
                long long tmp_tmp = (val_ac[j][B[i]] - val_ac[j][A[i] - 1] + MOD) % MOD;
                long long tmp = (dp[i-1][k] * tmp_tmp) % MOD;
                dp[i][j+k] = (dp[i][j+k] + tmp) % MOD;

                //std::cout << i << " " << j << " " << k << " " << dp[i][j+k] << std::endl;
            }
        }
    }

    std::cout << dp[N][C] << std::endl;

    return 0;
}

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

using namespace std;
const long long MOD=998244353;
long long fact[200009], inv_fact[200009];

long long modpow(long long a, long long n, long long mod){
  long long ret = 1;
  while(n>0){
    if(n&1)ret = ret * a % mod;
    a = a * a % mod;
    n >>= 1;
  }
  return ret;
}

long long modinv(long long a, long long mod){
  return modpow(a, mod-2, mod);
}

long long nCr(long long n, long long r, long long mod){
  return (((fact[n]*inv_fact[n-r])%MOD)*inv_fact[r])%MOD;
}

int main(){
  long long n, m, k;
  cin >>n >> m >> k;
  long long cnt=0;
  
  fact[0]=1;inv_fact[0]=1;
  for(int i=1;i<=n;i++){
    fact[i]=(fact[i-1]*i)%MOD;
    inv_fact[i] = modinv(fact[i], MOD);
  }
  for(int i=0;i<=k;i++){
    long long lcnt=m;
    lcnt = (lcnt * nCr(n-1, i, MOD))%MOD;
    lcnt = (lcnt * modpow(m-1, n-1-i, MOD))%MOD;
    cnt = (cnt + lcnt)%MOD;
  }
  cout << cnt << endl;
}



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

#ifndef ONLINE_JUDGE
    #define gc getchar
    #define pc putchar
#else
    #define gc getchar_unlocked
    #define pc putchar_unlocked
#endif

using namespace std;

#define vi vector<int>
#define si set<int>
#define vs vector<string>
#define pii pair<int,int>
#define vpi vector<pii>
#define pri priority_queue<int>
#define rev_pri priority_queue<int,vector<int>,greater<int> >
#define mpi map<int,int>
#define i64 long long int
#define endl '\n'
#define pi acos(-1)
#define all(v) v.begin(),v.end()
#define pb push_back
#define mp make_pair
#define mod 1000000007
#define inf INT_MAX/2
#define infll LLONG_MAX/3
#define For(i,n) for(int i=0;i<n;i++)
#define Fre(i,a,b) for(int i = a; i < b; i++)
#define sf(n) scanf("%d", &n)
#define sff(a,b) scanf("%d %d", &a, &b)
#define sfff(a,b,c) scanf("%d %d %d", &a, &b, &c)
#define pfn(n) printf("%d\n", n)
#define pfs(n) printf("%d ", n)
#define eps 1e-8
#define ff first
#define ss second
#define mem(a,b) memset(a,b,sizeof(a))
#define READ freopen("in.txt", "r", stdin)
#define WRITE freopen("out.txt", "w", stdout)
#define sz size()
#define dbg(i) printf("yo %d\n", i)
#define foreach(i,c) for(__typeof((c).begin()) i = (c).begin(); i != (c).end(); i++)
#define sqr(a) (a) * (a)
#define clr clear()
#define CASE(a) printf("Case %d: ",a)

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


//i64 gcd(i64 a,i64 b){if(!b)return a;return gcd(b,a%b);}

//inline void fastRead(int *a){register char c=0;while(c<33)c=gc();*a=0;while(c>33){*a=*a*10+c-'0';c=gc();}}

//inline void fastWrite(int a){char snum[20];int i=0;do{snum[i++]=a%10+48;a=a/10;}while(a!=0);i=i-1;while(i>=0)pc(snum[i--]);pc('\n');}

//i64 bigmod(i64 num,i64 n){if(n==0)return 1;i64 x=bigmod(num,n/2);x=x*x%mod;if(n%2==1)x=x*num%mod;return x;}

//i64 modinverse(i64 num){return bigmod(num,mod-2)%mod;}

//i64 po(i64 a,i64 b){i64 ans=1;while(b--)ans *= a;return ans;}

//i64 ncr(i64 n,i64 r){if(n==r)return 1;if(r==1)return n;if(dp[n][r]!=-1)return dp[n][r];return dp[n][r]=ncr(n-1,r)+ncr(n-1,r-1);}


// bit manipulations

//bool checkbit(int mask,int bit){return mask & (1<<bit);}

//int setbit(int mask,int bit){ return mask  (1<<bit) ; }

//int clearbit(int mask,int bit){return mask & ~(1<<bit);}

//int togglebit(int mask,int bit){return mask ^ (1<<bit);}

#define mxn 100005
#define mod1 1000000007
#define mod2 1000000009
#define p1 33
#define p2 163

i64 ans;
vi v[mxn];
map< i64 ,i64> gg;


i64 dfs(int s)
{

        i64 sum = p1 ;
        For(i,v[s].sz)
        {
                i64 tem = dfs(v[s][i]);
                gg[tem]++;
                sum = ( sum + (tem * p1) % mod1) % mod1 ;
        }

        return sum ;
}

int main()
{


        int n , a , b;
        sf(n);
        For(i,n-1)
        {
                sff(a,b);
                v[a].pb(b);
        }
        dfs(1);
        foreach(i,gg)
        {
                i64 tem = i->ss;
                ans += (tem * (tem-1)) / 2;
        }
        cout << ans << endl;








        return 0;
}

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

typedef long long ll;
const int N = 2e5;

int n;
ll li[N+5];

int main(){
	ll ans = 0ll;
	scanf("%d",&n);
	ll hrs = 0ll;
	for(int i=1;i<=n;i++){
		scanf("%lld",&li[i]);
		if(li[i] > hrs){
			printf("-1\n");
			return 0;
		}
		if(li[i] == 0){
			hrs = 1;
			continue;
		}
		if(li[i] == li[i-1]+1){
			ans++;
		} else {
			ans+=li[i];
			hrs = li[i];
		}
		hrs++;
//		cout << ">> " << ans << endl;
	}
	printf("%lld\n",ans);
	return 0;
}

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

int main()
{
    int n;
    cin >> n;
    ll sum = 0;
    int mod = 1e9+7;
    vector<int> A(n);
    rep(i,n) {
        cin >> A[i];
        sum += A[i];
        sum %= mod;
    }
    ll ans = 0;
    rep(i,n) {
        sum -= A[i];
        if (sum < 0) sum += mod;
        ans += A[i] * sum;
        ans %= mod;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 4044
#include <iostream>
#include <cstdio>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <iomanip>
#include <stdlib.h>
#include <string.h>
#include <cstring>
#include <cmath>
#include <map>
#include <queue>
#include <deque>
#include <stack>
#include <set>
#include <stdio.h>
#include <tuple>
#include <bitset>
#include <cfloat>
#include <fstream>
#include <limits.h>
#include <list>
#include <math.h>
#include <random>
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#include <numeric>
#include <utility>
#include <sstream>

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;
}

using namespace std;
#define ll long long
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
#define FORR(i,a,b)for(ll i=(a);i<=(b);i++)
#define repR(i,n) for(ll i=n;i>=0;i--)
#define P pair<ll, ll>
#define sz(x) (ll)x.size()
#define ALL(x) (x).begin(),(x).end()
#define ALLR(x) (x).rbegin(),(x).rend()
#define VE vector<ll>
#define COUT(x) cout<<(x)<<endl
#define MA map<ll,ll>
#define SE set<ll>
#define PQ priority_queue<ll>
#define PQR priority_queue<ll,VE,greater<ll>>
#define COUT(x) cout<<(x)<<endl
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define EPS (1e-10)
ll gcd(ll a, ll b) {
	if (a < b)swap(a, b);
	if (b == 0) return a;
	return gcd(b, a % b);
}
ll lcm(ll a, ll b) {
	ll g = gcd(a, b);
	return a / g * b;
}
bool prime(ll n) {
	for (ll i = 2; i <= sqrt(n); i++) {
		if (n%i == 0)return false;
	}
	return n != 1;
}


const long long MOD = 1000000007;
const long long INF = 1e16;
#define int long long

const int MAX_N = 1010;


signed main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	int n, k; cin >> n >> k;
	vector<pair<int, int>>p;
	rep(i, n) {
		int a, b; cin >> a >> b;
		p.push_back(make_pair(a,b));
	}
	sort(ALL(p));
	int now = 0;
	rep(i, n) {
		now += p[i].second;
		if (now >= k) {
			cout << p[i].first << endl; return 0;
		}
	}
	return 0;
}


Measured memory_bytes: 2420
#include <bits/stdc++.h>
using namespace std;
#define modulo 998244353
#define mod(mod_x) ((((long long)mod_x+modulo))%modulo)
#define Inf 1000000001

template <typename T>
struct trie{
	T init_value;
	struct node{
		vector<int> next;
		vector<int> v;
		int depth;
		node(int k,T iv,int d){
			next.resize(k,-1);
			v = iv;
			depth = d;
		}
		
		int link;
	};
	vector<node> _N;
	int n;
	trie(int k,T iv){
		init_value = iv;
		n = k;
		_N.push_back(node(n,init_value,0));
	}
	
	T add(string &s,int now = 0,int nowv=0){
		if(now==s.size())return init_value;
		int c = get(s[now]);
		if(_N[nowv].next[c]==-1){
			_N[nowv].next[c] = _N.size();
			_N.push_back(node(n,init_value,_N[nowv].depth+1));
		}
		int newv = _N[nowv].next[c];
		vector<int> V = init_value;
		V = add(s,now+1,newv);
		V[c]++;
		for(int i=0;i<26;i++){
			if(V[i]>0){
				_N[nowv].v[i]++;
			}
		}
		return V;
		
	}
	

	
	T get_value(string &S){
		T ret = init_value;;
		int now = 0;
		for(int i=0;i<S.size();i++){
			int c = get(S[i]);
			if(_N[now].next[c]!=-1){
				now = _N[now].next[c];
			}
			else{
				return ret;
			}
		}
		return _N[now].v;
	}
	
	int get(char c){
		return c-'a';
	}

	
};

int main(){
	
	int N;
	cin>>N;
	
	
	vector<vector<string>> X(1000000,vector<string>());
	
	for(int i=0;i<N;i++){
		string S;
		cin>>S;
		reverse(S.begin(),S.end());
		X[(int)S.size()-1].push_back(S);
	}
	
	
	
	
	vector<string> S;
	
	for(int i=1000000-1;i>=0;i--){
		for(int j=0;j<X[i].size();j++)S.push_back(X[i][j]);
	}
	
	trie<vector<int>> T(26,vector<int>(26,0));
	
	long long ans = 0LL;
	
	for(int i=0;i<N;i++){
		char c = S[i].back();
		S[i].pop_back();
		vector<int> ret = T.get_value(S[i]);
		ans += ret[c-'a'];
		S[i] += c;
		T.add(S[i]);
	}
	
	cout<<ans<<endl;
	
	return 0;
}


Measured memory_bytes: 598940
#include <algorithm>
#include <cstdio>
#include <iostream>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <stack>
#include <vector>
using namespace std;
typedef long long int ll;
typedef long double ld;
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define Sort(Array) sort(Array.begin(), Array.end())
#define Reverse(a) reverse(a.begin(), a.end())
#define out(ans) cout << ans << endl;
const int MOD = 1000000007;
const int INF = INT_MAX;

//------------↓------------- M -------------- E ---------------- M --------------- O ---------------↓--------------//
// コンパイル 
// g++ -std=c++1z
//
// -------型変換--------
// int を string に変換
// string s = to_string(n);
// string を int に変換
// int n = stoi(s);
//
// -------二分探索---------
// k以上の値が最初に現れる時のイテレータ O(logN)
// lower_bound(data.begin(), data.end(), k)
// kより大きい値が最初の現れる時のイテレータ O(logN)
// upper_bound(data.begin(), data.end(), k)
// kがdataに存在するかをtrue or falseで返す O(logN)
// binary_search(data.begin(), data.end(), k)
// 
//
//
//
//
//
// 
//------------↑------------- M -------------- E ---------------- M --------------- O ---------------↑--------------//




int main() {

    int N; cin >> N;
    int a[N];
    int x[20][20], y[20][20];
    rep(i,N) {
        cin >> a[i];
        rep(j,a[i]) cin >> x[i][j] >> y[i][j];
    }

    int ans = 0;
    for (int bit = 0; bit < (1<<N); ++bit) {
        bool flag = true;
        int tmp = 0;
        rep(i,N) {
            if (bit & (1<<i)) {
                ++tmp;
                rep(j,a[i]) {
                    if (bit & (1<<(x[i][j]-1))) {
                        if (y[i][j] == 0) flag = false;
                    }
                    else {
                        if (y[i][j] == 1) flag = false;
                    }
                }
            }
        }
        if (flag) ans = max(ans, tmp);
    }
    out(ans);


    return 0;
}






Measured memory_bytes: 888
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <cstdio>
#include <cmath>
#include <tuple>
#include <iomanip>
#include <numeric>
#include <unordered_map>
#include <sstream>   
#include<limits.h>
#include<float.h>
#include<list>
#include <array>
#include <complex>
#include<stdio.h>
#include<string.h>
#include <bitset>

using namespace std;
#define int  long long
 
#define I32_MAX 2147483647
#define I64_MAX 9223372036854775807LL
#define I64_MAX2 1223372036854775807LL
#define INF I64_MAX2
#define MOD 1000000007
#define MEM_SIZE 10000
#define DEBUG_OUT true
#define ALL(x) (x).begin(),(x).end()

// int DP[MEM_SIZE][MEM_SIZE] = {0};
// int GMEM[MEM_SIZE][MEM_SIZE] = {0};
template<typename T> void DEBUG(T e){if(DEBUG_OUT == false)return; std::cout << e <<" ";}
template<typename T> void DEBUG(const std::vector<T>& v){if(DEBUG_OUT == false)return;for(const auto& e : v){std::cout<< e << " "; } std::cout << std::endl;}
template<typename T> void DEBUG(const std::vector<std::vector<T> >& vv){if(DEBUG_OUT == false)return;for(const auto& v : vv){ DEBUG(v); } }
template<class T,class... Ts> void DEBUG(T d, Ts... e){if(DEBUG_OUT == false)return;DEBUG(d);DEBUG(e...);}
template <class T> void corner(bool flg, T hoge) {if (flg) {cout << hoge << endl; exit(0);}}
template< typename T1, typename T2 > inline bool chmax(T1 &a, T2 b) { return a < b && (a = b, true); }
template< typename T1, typename T2 > inline bool chmin(T1 &a, T2 b) { return a > b && (a = b, true); }


void solve(void)
{
  int N;
  cin>>N;
  vector<vector<int> > vv (N,vector<int>(3,0));
  for (int i = 0; i < N; i++)
  {
    cin>>vv[i][0]>>vv[i][1]>>vv[i][2];
  }

  for (int x = 0; x < 101; x++)
  {
    for (int y = 0; y < 101; y++)
    {
      int check = 1;
      int H = 0;
      int valid = 0;
      for (int i = 0; i < N; i++)
      {
        int dx = vv[i][0];
        int dy = vv[i][1];
        int dh = vv[i][2];
     
        if(valid == 0)
        {
          if(dh != 0)
          {
          H = dh +abs(x -dx) + abs(y-dy);
          if(dh > 0 && H > 0)
          { valid = 1;
            i = -1;
          }
          }
        }
        else
        {
          if(dh != max(0LL,H - abs(x-dx) - abs(y -dy)))
          { check = 0;
          }
          else
          {
            // DEBUG(H,dx,dy,dh,x,y,"\n");
          }
        }   
      }
      if(check == 1)
      {
        cout<<x<<" "<<y<<" "<<H<<endl;
        return;
      }
      
    }
    
  }
  
  
  return;
}

int32_t main(int32_t argc, const char *argv[])
{
  std::ios::sync_with_stdio(false);
  std::cin.tie(0);

  std::cout << std::fixed;
  std::cout << std::setprecision(15);
  solve();

  return 0;
}


Measured memory_bytes: 256
#include<cstdio>
#include<iostream>
using namespace std;
int n,ans;
int sum;
int main(){
	cin>>n;
	for(int i=1;i<=n;i++){
		int a=i;
		sum=0;
		while(a>0){
			a/=10;
			sum++;
		}
		if(sum%2==1){
			ans++;
		}
		
	}
	cout<<ans;
	return 0;
}

Measured memory_bytes: 256
// I SELL YOU...! 
#include<iostream>
#include<vector>
#include<algorithm>
#include<functional>
#include<queue>
#include<chrono>
#include<iomanip>
#include<map>
#include<set>
using namespace std;
using ll = long long;
using P = pair<ll,ll>;
using TP = tuple<ll,ll,ll>;
void init_io(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(18);
}
const ll MOD = 998244353;
#define MAX 510000

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

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

long long COM(int n, int k){
  if (n < k) return 0;
  if (n < 0 || k < 0) return 0;
  return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
ll modinv(ll a, ll m){
  ll b=m,u=1,v=0;
  while(b){
    ll t=a/b;
    a-=t*b; swap(a,b);
    u-=t*v; swap(u,v);
  }
  u%=m;
  if(u<0) u+=m;
  return u;
}
signed main(){
  init_io();
  COMinit();
  ll n,m,k,ans=0,tmp;
  cin >> n >> m >> k;
  if(m==1){
    if(k==n-1){
      cout << "1\n";
    }else{
      cout <<"0\n";
    }
    return 0;
  }
  tmp = m;
  for(ll i=1;i<n;i++){
    tmp *= (m-1);
    tmp %= MOD;
  }
  for(ll i=0;i<=k;i++){
    ll v = tmp * COM(n-1,i);
    v %= MOD;
    ans += v;
    ans %= MOD;
    tmp *= modinv(m-1,MOD);
    tmp %= MOD;
  }
  cout << ans << endl;
}


Measured memory_bytes: 15608
#include <bits/stdc++.h>
using namespace std;
 
int main(){
    string S;
    cin >> S;

    int N = S.length();
    int cnt_o = 0;
    int cnt_x = 0;

    for (int i = 0; i < N; i++){
        if(S[i] == 'x'){
            cnt_x++;
        }
        else {
            cnt_o++;
        }
    }

    if (cnt_x > 7){
        cout << "NO" << endl;
    }
    else {
        cout << "YES" << endl;
    }
}

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

int main(){
    int n, c;
    cin >> n >> c;
    vector<vector<int>> d(c, vector<int>(c));
    rep(i, c) rep(j, c) cin >> d[i][j];
    vector<vector<int>> cv(n, vector<int>(n));
    map<int, int> mp_mod3_0;
    map<int, int> mp_mod3_1;
    map<int, int> mp_mod3_2;
    rep(i, n) rep(j, n) {
        cin >> cv[i][j];
        --cv[i][j];
        if ( ( i + j + 2 ) % 3 == 0 ) {
            ++mp_mod3_0[cv[i][j]];
        }
        else if ( ( i + j + 2 ) % 3 == 1 ) {
            ++mp_mod3_1[cv[i][j]];
        }
        else if ( ( i + j + 2 ) % 3 == 2 ) {
            ++mp_mod3_2[cv[i][j]];
        }
    }

    int ans = 1e9;
    rep(i, c) rep(j, c) rep(k, c) {
        if ( i == j || j == k || k == i ) continue;
        int tmp_ans = 0;
        if ( !mp_mod3_0.empty() ) {
            for ( auto tmp_mp : mp_mod3_0 ) {
                tmp_ans += d[tmp_mp.first][i] * tmp_mp.second;
            }
        }
        if ( !mp_mod3_1.empty() ) {
            for ( auto tmp_mp : mp_mod3_1 ) {
                tmp_ans += d[tmp_mp.first][j] * tmp_mp.second;
            }
        }
        if ( !mp_mod3_2.empty() ) {
            for ( auto tmp_mp : mp_mod3_2 ) {
                tmp_ans += d[tmp_mp.first][k] * tmp_mp.second;
            }
        }
//        cout << i << " " << tmp_ans << endl;
        ans = min(ans, tmp_ans);
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 1280
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
const int INF = 1000000000;
#define REP(i,s,n) for(int i=(int)(s);i<(int)(n);i++)
#define rep(i,n) REP(i, 0, n)
typedef pair<bool, int> bi;
int T[100000];
bool marked[100000];
int N;
int dfs(int v){
    if(marked[v])
      return v;
    else
      return dfs(T[v]);
}
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ifstream ifs("2170_input.txt");
    int Q, _t;
    char _c;
    while(cin >> N >> Q && N){
        vector<bi> query;
        memset(marked, 0, sizeof(marked));
        REP(i, 1, N){
            cin >> _t; _t--;
            T[i] = _t;
        }
        marked[0] = true;
        ll sum = 0;
        rep(i, Q){
            cin >> _c >> _t; _t--;
            if(_c == 'Q')
                sum += dfs(_t) + 1;
            else
              marked[_t] = true;
        }
        cout << sum << endl;
    }
    return 0;
}

Measured memory_bytes: 1708
n=int(input())
l=list(map(int,input().split()))
ans=1
y=pow(10,18)
flag=0
for i in l:
    ans=ans*i
    if(i>y or ans>y):
        flag=1
        break
for i in l:
    if i==0:
        ans=0
        flag=0
        break
if flag==1:
    print(-1)
else:
    print(ans)

Measured memory_bytes: 21796
from collections import defaultdict


def solve(N, ab, ne_table, start: int, used: set):
    if len(used) == N:
        return 1
    res = 0
    next_list = ne_table[start]
    for i in next_list:
        if i not in used:
            res += solve(N, ab, ne_table, i, used.union({i}))
    return res


def main():
    N, M = [int(a) for a in input().split()]

    ab = [
        [int(a) - 1 for a in input().split()]
        for _ in range(M)
    ]

    ne_table = defaultdict(lambda: [])
    for (a, b) in ab:
        ne_table[a].append(b)
        ne_table[b].append(a)

    print(solve(N, ab, ne_table, 0, {0}))


if __name__ == '__main__':
    main()


Measured memory_bytes: 3316
n = list(input())
x = n[0]+n[1]
y = n[2]+n[3]
count = 0
if 12 >= int(y) >= 1:
    count += 1
if 12 >= int(x) >= 1:
    count += 2
if count == 3:
    print("AMBIGUOUS")
elif count == 2:
    print("MMYY")
elif count ==1:
    print("YYMM")
else:
    print("NA")

Measured memory_bytes: 3064
#include <stdio.h>
#include <stdbool.h>
#define N 8
#define NFR -1
#define FR 1

int row[N], col[N], dpos[2 * N - 1], dneg[2 * N - 1];
bool A[N][N];

void initialize()
{
    int i; //
    for (i = 0; i < N; i++)
    {
        row[i] = FR;
        col[i] = FR;
    }
    for (i = 0; i < 2 * N - 1; i++)
    {
        dpos[i] = FR;
        dneg[i] = FR;
    }
}

void print()
{
    int i, j;
    for (i = 0; i < N; i++)
    {
        for (j = 0; j < N; j++)
        {
            if (A[i][j])
            {
                if (row[i] != j)
                    return;
            }
        }
    }

    for (i = 0; i < N; i++)
    {
        for (j = 0; j < N; j++)
        {
            if (row[i] != j)
                printf(".");
            else
                printf("Q");
        }
        printf("\n");
    }
}

void qeen(int i)
{
    int j;
    if (i == N)
    {
        print();
        return;
    }
    for (j = 0; j < N; j++)
    {
        if (col[j] == NFR || dpos[i + j] == NFR || dneg[i - j + (N - 1)] == NFR)
            continue;
        row[i] = j;
        col[j] = NFR;
        dpos[i + j] = NFR;
        dneg[i - j + (N - 1)] = NFR;
        
        qeen(i + 1);
        row[i] = FR;
        col[j] = FR;
        dpos[i + j] = FR;
        dneg[i - j + (N - 1)] = FR;
    }
}

int main()
{
    int i, j, k, r, c;

    initialize();
    for (i = 0; i < N; i++)
    {
        for (j = 0; j < N; j++)
        {
            A[i][j] = false;
        }
    }
    scanf("%d", &k);
    for (i = 0; i < k; i++)
    {
        scanf("%d%d", &r, &c);
        A[r][c] = true;
    }
    qeen(0);

    return 0;
}



Measured memory_bytes: 2036
N, M = map(int, input().split())
move = []
for i in range(M):
	move.append(list(map(int,input().split())))
box = [1 for i in range(N)]
box_flag = [False for i in range(N)]
box_flag[0] = True
for i in range(len(move)):
	box[move[i][0]-1] -= 1
	box[move[i][1]-1] += 1
	if box_flag[move[i][0]-1]:
		box_flag[move[i][1]-1] = True
	if box[move[i][0]-1] == 0:
		box_flag[move[i][0]-1] = False
print(box_flag.count(True))

Measured memory_bytes: 29128
#include <iostream>
#include <string>
#include <utility>
#include <stack>
#include <vector>
#include <queue>
#include <algorithm>
#include <map>
#include <climits>
#include <set>
#include <cmath>
#include <numeric>
using namespace std;

string A[8];

int main(){
    int H;
    int W;

    cin >> H >> W;
    for(int i = 0; i < H; i++){
        cin >> A[i];
    }

    int cur_h = 0;
    int cur_w = 0;
    while(cur_h != H - 1 || cur_w != W - 1){
        A[cur_h][cur_w] = '.';
        if(cur_h + 1 < H && A[cur_h + 1][cur_w] == '#'){
            cur_h ++;
        } else if (cur_w + 1 < W && A[cur_h][cur_w + 1] == '#'){
            cur_w ++;
        } else {
            cout << "Impossible" << endl;
            return 0;
        }
    }
    
    A[cur_h][cur_w] = '.';
    //cout << cur_h << " " << cur_w << endl;
    //for(int i = 0; i < H; i++){
    //    cout << A[i] << endl;
    //}
    for(int i = 0; i < H; i++){
        for(int j = 0; j < W; j++){
            if(A[i][j] == '#'){
                cout << "Impossible" << endl;
                return 0;
            }
        }
    }
    cout << "Possible" << endl;

    
    return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <iostream>
#include <vector>
#include <map>
#include <stack>
#include <queue>
#include <string>
#include <algorithm>
#include <functional>
#include <utility>
#include <numeric>
#include <set>

using namespace std;
using ll = long long;
using P = pair<int, int>;
const int MOD = 1000000007;
const ll INF = 1LL << 60;

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

// vector<vector<int> > vvi;
// vector<vector<vector<int> > > vvvi;
//
// template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
// template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

// int GCD(int a, int b) { return b ? GCD(b, a%b) : a; }


int main(int argc, char**argv){
    int h, w;
    cin >> h >> w;
    vector<string> a(h);
    for (int i = 0; i < h; i++){
        cin >> a[i];
    }

    queue<pair<int, int> > black_idx;
    for (int i = 0; i < h; i++){
        for (int k = 0; k < w; k++){
            if (a[i][k] == '#'){
                black_idx.push(make_pair(i, k));
            }
        }
    }
    black_idx.push(make_pair(-1, -1));

    int ans = 0;
    bool updated = false;
    while(1){
        pair<int, int> idx = black_idx.front();
        black_idx.pop();
        if (idx.first == -1 && idx.second == -1){
            if (not updated) break;
            ans++;
            black_idx.push(idx);
            updated = false;
        }else{
            int fi = idx.first;
            int se = idx.second;
            for (int i = 0; i < 4; i++){
                if (0 <= fi + dy[i] && fi + dy[i] < h && 0 <= se + dx[i] && se + dx[i] < w && a[fi + dy[i]][se + dx[i]] == '.'){
                    a[fi + dy[i]][se + dx[i]] = '#';
                    black_idx.push(make_pair(fi + dy[i], se + dx[i]));
                    updated = true;
                }
            }
        }
    }
    cout << ans << endl;

    return 0;
}



Measured memory_bytes: 9488
#include <stdio.h>
#include "string.h" 
char s[4];
 
int main()
{
    scanf("%s",s);
    if(strcmp(s,"AAA")==0 ||strcmp(s,"BBB")==0){
        printf("No");
    }
    else{
        printf("Yes");
    }
  return 0;
}

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

using namespace std;

using ll = long long;
using ld = long double;
using P = pair<int, int>;
constexpr ld EPS = 1e-12;
constexpr int INF = numeric_limits<int>::max() / 2;
constexpr int MOD = 1e9 + 7;

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

    string s;
    while (cin >> s, s != "#")
    {
        int n = s.length();
        vector<int> edit(n + 1);
        for (int i = 0; i < n; i++)
        {
            edit[i + 1] = (s[i] - '1') % 3;
        }
        // left, right
        vector<vector<int>> dp(n + 1, vector<int>(2, INF));
        edit[0] = 1;
        dp[0][0] = dp[0][1] = 0;
        dp[1][0] = dp[1][1] = 0;
        for (int i = 2; i <= n; i++)
        {
            if (edit[i] < edit[i - 1])
            {
                dp[i][0] = min(dp[i - 1][1], dp[i - 1][0] + 1);
            }
            else if (edit[i] > edit[i - 1])
            {
                dp[i][1] = min(dp[i - 1][0], dp[i - 1][1] + 1);
            }
            else
            {
                dp[i][0] = min(dp[i - 1][1], dp[i - 1][0] + 1);
                dp[i][1] = min(dp[i - 1][0], dp[i - 1][1] + 1);
            }
        }
        cout << min(dp[n][0], dp[n][1]) << endl;
    }
}



Measured memory_bytes: 8848
#include<iostream>
#include<vector>
#include<algorithm>
int main()
{
	int n, x;
	std::cin >> n >> x;
	std::vector<int>a(n);
	std::vector<std::vector<int>>minimum_time(n + 1, std::vector<int>(n));
	for (int i = 0; i < n; i++)
	{
		std::cin >> a[i];
		minimum_time[0][i] = a[i];
	}
	long long ans = 10000000000000000;
	for (int i = 0; i < n; i++)
	{
		long long sum = i * static_cast<long long>(x);
		for (int j = 0; j < n; j++)
		{
			sum += minimum_time[i][j];
			minimum_time[i + 1][j] = std::min(minimum_time[i][j], minimum_time[i][(j - 1 + n) % n]);
		}
		if (ans > sum)
		{
			ans = sum;
		}
	}
	std::cout << ans << std::endl;
	return 0;
}

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

ll m = 1e9 + 7;
int main() {
  int n;
  cin >> n;
  vector<ll> a(n);
  rep(i,n) cin >> a[i];

  ll ans = 0;
  rep(i,60) {
    ll y = 0;
    rep(j,n) if((a[j] >> i) & 1) y++;
    ll p = (y * (n - y)) % m;
    rep(j,i) p = (p * 2) % m;
    ans += p;
    ans %= m;
  }
  cout << ans << endl;
}

Measured memory_bytes: 5560
#include <stdio.h>
#include <iostream>
#include <cstdlib>
#include <iomanip>
#include <cmath>
#include <vector>
#include <string>
#include <algorithm>
#include <cstdlib>
#include <limits>
#include <numeric>
#include <set>

using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;


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

	cout << s << endl;

	return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <cstdio>
#include <functional>
#include <iostream>
#include <cfloat>
#include <climits>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <time.h>
#include <complex>
#include <vector>
#include<limits>
#include<iomanip>

using namespace std;

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<long long, long long> pll;

const long double pi = 3.141592653589793;

#define debug(x) cout << #x << " = " << (x) << endl;
#define rep(i, n) for(int i = 0;i < n;i++)
#define repi(i, j, n) for(int i = j;i < n;i++)
#define pb push_back
#define mp make_pair
#define mod 998244353
#define F first
#define S second

// #define COMMENT

/*

const int NN = 200090;
ll fact[NN];
ll finv[NN];
ll inv[NN];

void inverse_modulao() {
  fact[0] = fact[1] = 1;
  finv[0] = finv[1] = 1;
  inv[1] = 1;

  for(int i = 2;i < NN;i++) {
    fact[i] = fact[i-1]*i%mod;
    inv[i] = mod-mod/i*inv[mod%i]%mod;
    finv[i] = finv[i-1]*inv[i]%mod;
  }
}

ll nCr(int n, int r) {
  return fact[n]*finv[r]%mod*finv[n-r]%mod;
}

*/

// 3000 3000 3000


int N, maxh=0;
vector<pii> vf, vb;

int main() {

 // freopen("input.in","r",stdin);
 // freopen("output.out","w",stdout);

  cin>>N;
  rep(i, N) {
    string s, t;
    cin>>s;
    rep(i,s.size()) {
      if(t.size() == 0 || s[i] == '(' || t[t.size()-1] == ')') t.pb(s[i]);
      else t.pop_back();
    }
    int cnt=0;
    rep(i,t.size()) if(t[i] == ')') cnt++;
    if(cnt == (t.size()-cnt)) maxh = max(maxh,cnt);
    else if(cnt < (t.size()-cnt)) vf.pb(mp(cnt,(t.size()-cnt)));
    else vb.pb(mp((t.size()-cnt), cnt));
  }
  sort(vf.begin(), vf.end());
  sort(vb.begin(), vb.end());
  int h1=0,h2=0;
  rep(i,vf.size()) {
    h1 -= vf[i].F;
    if(h1 < 0) {cout<<"No";return 0;}
    h1+=vf[i].S;
  }
  rep(i,vb.size()) {
    h2 -= vb[i].F;
    if(h2 < 0) {cout<<"No";return 0;}
    h2+=vb[i].S;
  }
  if(h1 == h2 && (h1-maxh) >= 0) cout<<"Yes";
  else cout<<"No";


  return 0;
}


Measured memory_bytes: 11336
//***********************
//*** writer : Alan Hu **
//***********************
#include<iostream>
#include<vector>
#include<string>
#include<set>
#include<map>
#include<algorithm>
#include<queue>
#include<list>
#include<stack>
#include<cstdio>
#include<fstream>
#include<numeric>
#include<functional>
#include<utility>
#include<memory>
#include<cstring>
#include<cmath>
using namespace std;

#define CLEAN(a,b) memset(a,b,sizeof(a))
#define mp make_pair
#define pb push_back
#define rept(i,a,b) for(int i=(int)(a);i<(int)(b);i++)

typedef long long ll;
typedef pair<int, int> pii;

int main()
{
	int a=0,b=0;
	string s;
	cin>>s;
	for (int i=0;i<s.size();i++)
	{
		if (s[i]=='+') a++;
		else b++;
	}
	cout<<a-b<<endl;
	return 0;
}

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

namespace AtCoder
{
  class Program
  {
    static void Main(string[] args)
    {
      List<long> ts = new List<long>();
      int N = int.Parse(Console.ReadLine());
      for(int i = 0; i < N; i++)
        ts.Add(long.Parse(Console.ReadLine()));

      long c = 1;
      foreach(long t in ts)
        c = GetLCM(c, t);

      Console.WriteLine(c);
      Console.ReadLine();
    }

    static long GetLCM(long a, long b)
    {
      return a / GetGCD(a, b) * b;
    }

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

    static long GetGCD(long a, long b)
    {
      Align(ref a, ref b);

      while(true)
      {
        long c = a % b;
        if(c == 0)
          return b;

        a = b;
        b = c;
      }
    }

    static void Align(ref long a, ref long b)
    {
      if(a >= b)
        return;

      long c = a;
      a = b;
      b = c;
    }
  }
}

Measured memory_bytes: 27836
#include <bits/stdc++.h>
#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> A(N+1);
    vector<int> ans(N+1);
    rep(i, N){
        cin >> A[i+1];
    }
    for (int i = N; i >= 1; i--){
        int x = 0;
        for (int j = i; j <= N; j+=i){
            x += ans[j];
        }
        if (x%2 == A[i]){
            ans[i] = 0;
        } else {
            ans[i] = 1;
        }
    }
    queue<int> Q;
    int M = 0;
    rep(i, N){
        if(ans[i+1] == 1){
            Q.push(i+1);
            M++;
        }
    }

    cout << M << endl;
    while(!Q.empty()){
        cout << Q.front();
        Q.pop();
        if(Q.empty()){
            cout << endl;
        } else {
            cout << " ";
        }
    }

    return 0;
}

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

bool b[3][3];

int main(){
	vector<int> A(9);
	for(auto &i:A)cin >> i;
	int N;
	cin >> N;
	vector<int> B(N);
	for(auto &i:B)cin >> i;
	
	for(int i=0;i<9;i++){
		for(auto v:B)if(A[i]==v)b[i/3][i%3]=true;
	}
	
	bool ans=false;
	if(b[0][0]&&b[0][1]&&b[0][2])ans=true;
	if(b[1][0]&&b[1][1]&&b[1][2])ans=true;
	if(b[2][0]&&b[2][1]&&b[2][2])ans=true;
	if(b[0][0]&&b[1][0]&&b[2][0])ans=true;
	if(b[0][1]&&b[1][1]&&b[2][1])ans=true;
	if(b[0][2]&&b[1][2]&&b[2][2])ans=true;
	if(b[0][0]&&b[1][1]&&b[2][2])ans=true;
	if(b[0][2]&&b[1][1]&&b[2][0])ans=true;
	
	if(ans)cout << "Yes" << endl;
	else cout << "No" << endl;
	
	return 0;
}

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

using namespace std;

using ll = long long;

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

    int h, w; cin >> h >> w;
    vector<string> g(h);
    for (auto& x : g) cin >> x;

    vector<vector<int>> x(h, vector<int>(w, 0)), y(h, vector<int>(w, 0));
    for (int i = 0; i < h; i++) {
        int j = 0;
        while (j < w) {
            if (g[i][j] == '#') {
                j++;
                continue;
            }
            
            int q = j;
            while (q < w && g[i][q] == '.') q++;
            int l = q - j;
            for (int k = j; k < q; k++) x[i][k] = l;
            j = q;
        }
    }

    for (int i = 0; i < w; i++) {
        int j = 0;
        while (j < h) {
            if (g[j][i] == '#') {
                j++;
                continue;
            }
            
            int q = j;
            while (q < h && g[q][i] == '.') q++;
            int l = q - j;
            for (int k = j; k < q; k++) y[k][i] = l;
            j = q;
        }
    }

    int ans = 0;
    for (int i = 0; i < h; i++) {
        for (int j = 0; j < w; j++) {
            ans = max(ans, x[i][j] + y[i][j] - 1);
        }
    }
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 35968
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <cstring>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <algorithm>
#include <climits>
using namespace std;

#define REP(i,n) for(int i=0; i<n; ++i)
#define FOR(i,a,b) for(int i=a; i<=b; ++i)
#define FORR(i,a,b) for (int i=a; i>=b; --i)
#define ALL(c) (c).begin(), (c).end()

typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;


int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int a, b;
    string s;
    cin >> a >> b >> s;
    REP(i, s.size()) {
        if(i == a and s[i] != '-') break;
        if(i != a and (s[i] < '0' or '9' < s[i])) break;
        if(i == s.size() - 1) {
            cout << "Yes" << endl;
            return 0;
        }
    }
    cout << "No" << endl;
    return 0;
}


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

int main(){
  int64_t i,n,num;
  double s;
  int64_t v = 1e+12;
  
  cin >> n;
  s = sqrt(n);
  num = s;
  
  for (i=1;i<num+1;i++){
    if (n % i == 0){
      v = min(v,(i + n / i) - 2);
    }
  }
  
  cout << v << "\n";
  
  return 0;
}


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

int main(){
    int N;
    string S;
    cin >> N;
    cin >> S;
    int i;
    int count=0;
    char tmp = 'X';
    for(i=0;i<N;i++){
        if(S[i]!=tmp){
            count++;
            tmp=S[i];
        }
    }
    cout << count << endl;
}

Measured memory_bytes: 512
#include<bits/stdc++.h>
using namespace std;
int main()
{
    string s1,s2,s3,x;
    cin>>s1>>s2>>s3;
    s1[0]=s1[0]-32;
    s2[0]=s2[0]-32;
    s3[0]=s3[0]-32;
    x=x+s1[0];
    x=x+s2[0];
    x=x+s3[0];
    cout<<x<<endl;
    return 0;


}



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

#define DECIMAL 10

int h, w;
vector<vector<char>> mazeBoard;

int mazeBFS(int startH, int startW){
    int nMaxMove = 0;
    queue<pair<int, int>> searchCoor;
    vector< vector<int> > dist( h+1, vector<int>(w+1, -1) );

    searchCoor.push( make_pair( startH, startW ) );
    dist.at(startH).at(startW) = 0;
    while (searchCoor.size() > 0){
        auto now = searchCoor.front(); searchCoor.pop();
        for (int i = -1; i < 3; i++){                           // sin, cos内部の値が大きいと誤差で正確な値がでない...
            int nextH = now.first + sin(0.5*i*M_PI);
            int nextW = now.second + cos(0.5*i*M_PI);
            if (mazeBoard.at(nextH).at(nextW) == '.' && dist.at(nextH).at(nextW) == -1){
                searchCoor.push(make_pair(nextH, nextW));
                dist.at(nextH).at(nextW) = dist.at(now.first).at(now.second) + 1;
                nMaxMove = dist.at(nextH).at(nextW);
            }
        }
    }
    nMaxMove += 0;
    return nMaxMove;
}

int main(void){
    cin >> h >> w;
    mazeBoard.assign( h+2, vector<char>( w+2, '#' ) );
    for (int i = 1; i < h+1; i++){
        for (int j = 1; j < w+1; j++){
            char c;
            cin >> c;
            mazeBoard.at(i).at(j) = c;
        }
    }
    
    int ans = 0;
    for (int i = 1; i < h+1; i++){
        for (int j = 1; j < w+1; j++){
            if( mazeBoard.at(i).at(j) == '#' ){
                continue;
            }
            ans = max( ans, mazeBFS(i, j) );
        }
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 4064
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.List;

public class Main {

	public static void main(String args[] ) throws Exception {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String line = br.readLine();
		String output = "";
		List<String> input = new ArrayList<String>();
		while (line != null) {
			// CTRL+Z??§??\????????????
			if("0 0".equals(line)) {
				break;
			}
			input.add(line);

			line = br.readLine();
		}
		boolean isFirstRow = true;
		for (String inputLine : input) {
			if (!isFirstRow) {
				System.out.println();
			}
			String[] inputData = inputLine.split(" ");
			int startYear = Integer.parseInt(inputData[0]);
			int endYear = Integer.parseInt(inputData[1]);
			if (startYear == 0 && endYear == 0) {
				break;
			}
			boolean isEmpty = true;
			for (int i = startYear; i <= endYear; i++) {
				if ((i % 4 == 0 && i % 100 != 0) || i % 400 == 0) {
					System.out.println(i);
					isEmpty = false;
				}
			}
			if (isEmpty) {
				System.out.println("NA");
			}
			isFirstRow = false;
		}
    }

}

Measured memory_bytes: 25544
#include<bits/stdc++.h>
using namespace std;
#define rep(i,a,b) for(int i=(a),i##_end=(b);i<=i##_end;++i)
#define per(i,a,b) for(int i=(b),i##_end=(a);i>=i##_end;--i)
#define For(i,a,b) for(int i=(a),i##_end=(b);i<i##_end;++i)
#define foe(i,a) for(__typeof(a.begin())i=a.begin();i!=a.end();++i)
#define X first
#define Y second
#define mp make_pair
#define pb push_back
#define SZ(x) ((int)(x).size())
#define all(x) (x).begin(),(x).end()
typedef double ld;
typedef long long L;
typedef vector<int> VI;
typedef pair<int,int> pa;
#ifdef flukehn
#define debug(...) fprintf(stderr, __VA_ARGS__)
#else
#define debug(...)
#endif
const int N=1e6+11,mo=998244353;
int fpow(int a,int b){
	int r=1;
	for(;b;b>>=1,a=1ll*a*a%mo)
		if(b&1)r=1ll*r*a%mo;
	return r;
}
int inv(int x){return fpow(x,mo-2);}
int jc[N+1],jcv[N+1];
int C(int a,int b){
	return a<b?0:1ll*jc[a]*jcv[b]%mo*jcv[a-b]%mo;
}
int n,m;
int main(){
#ifdef flukehn
	freopen("c.in","r",stdin);
#endif
	ios::sync_with_stdio(0);
	jc[0]=1;
	rep(i,1,N)jc[i]=1ll*jc[i-1]*i%mo;
	jcv[N]=inv(jc[N]);
	per(i,1,N)jcv[i-1]=1ll*jcv[i]*i%mo;
	cin>>n>>m;
	if(n<m)swap(n,m);
	int ans=0;
	rep(i,1,m){
		ans=(ans+1ll*C(2*i,i)*C(n+m-2*i,n-i))%mo;
	}
	ans=1ll*ans*inv(C(n+m,n))%mo;
	ans=1ll*ans*inv(2)%mo;
	printf("%d\n",(ans+n)%mo);
}


Measured memory_bytes: 8064
#include <stdio.h>
#include <math.h>

void eq(double a, double b, double c, double d, double e, double f, double *x, double *y)
{
    *x = (c * e - b * f) / (a * e - b * d);
    *y = (c * d - a * f) / (b * d - a * e);
}

double sqr(double a) { return a * a; }
double sqrplus(double a, double b) { return sqr(a) + sqr(b); }

int main(void)
{
    int n;

    scanf("%d", &n);
    while (n-- > 0){
        double x1, x2, x3;
        double y1, y2, y3;
        double l, m;
        double x, y, r;

        scanf("%lf %lf %lf %lf %lf %lf", &x1, &y1, &x2, &y2, &x3, &y3);
        eq(x1 - x2, y1 - y2, sqrplus(x1, y1) - sqrplus(x2, y2),
            x1 - x3, y1 - y3, sqrplus(x1, y1) - sqrplus(x3, y3), &l, &m);
        x = l / 2;
        y = m / 2;
        r = sqrt(sqrplus(x1 - x, y1 - y));
        printf("%.3lf %.3lf %.3lf\n", x, y, r);
    }

    return 0;
}

Measured memory_bytes: 664