akhauriyash/Code-Regression huggingface dataset:
/*
    written by Pankaj Kumar.
    country:-INDIA
*/
#include <bits/stdc++.h>
using namespace std;
typedef long long ll ;
typedef set<pair<int,int>> spi;
typedef set<pair<ll,ll>> spl;
typedef vector<pair<int,int>> vpi;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<bool> vb;
typedef vector<char> vc;
typedef vector<pair<ll,ll>> vpl;
typedef vector<string> vs;
typedef map<int,int>mi;
typedef map<ll,ll> ml;
typedef set<string> ss;
typedef set<char>sc;
typedef set<int> si;
typedef set<ll> sl;
#define pan cin.tie(0);cout.tie(0);ios_base::sync_with_stdio(0);
// define values.
#define mod 1e9+7LL
#define phi 1.618
/* Bit-Stuff */
#define get_set_bits(a) (__builtin_popcount(a))
#define get_set_bitsll(a) ( __builtin_popcountll(a))
#define get_trail_zero(a) (__builtin_ctz(a))
#define get_lead_zero(a) (__builtin_clz(a))
#define get_parity(a) (__builtin_parity(a))
/*  Abbrevations  */
#define ff first
#define ss second
#define mp make_pair
#define line cout<<endl;
#define pb push_back
#define Endl "\n"
// loops
#define loop(i,start,end) for(ll i=ll(start);i<ll(end);i++)
#define loop0(num) for(ll i=0;i<ll(num);i++)
#define forin(arr,n) for(ll i=0;i<n;i++) cin>>arr[i];
// Some print
#define no cout<<"NO"<<endl;
#define yes cout<<"YES"<<endl;
#define cc ll test;cin>>test;while(test--)
// sort
#define all(V) (V).begin(),(V).end()
#define srt(V) sort(all(V))
#define srtGreat(V) sort(all(V),greater<ll>())
// function

ll power(ll x,   ll y, ll p)  
{  
    ll res = 1;      
    x = x % p;             
    while (y > 0)  
    {    
        if (y & 1)  
            res = (res*x) % p;   
        y = y>>1; 
        x = (x*x) % p;  
    }  
    return res;  
} 
/* ascii value 
A=65,Z=90,a=97,z=122 1=49
*/
/*  -----------------------------------------------------------------------------------*/
// freopen("input.txt", "r", stdin);
// freopen("output.txt", "w", stdout);



int main()
{
    string s;
    cin>>s;
    ll count=0;
    for(ll i=0;i<s.length();i++)
    {
        count+=ll(s[i]-'0');
    }
    if(count%9==0)
        cout<<"Yes"<<endl;
    else
        cout<<"No"<<endl;
}

Measured memory_bytes: 3724
#include<bits/stdc++.h>
using namespace std;
#define task "atcoder"
#define FOR(i, a, b) for (int i = (a), _b = (b); i <= _b; ++i)
#define FORD(i, b, a) for (int i = (b), _a = (a); i >= _a; --i)
#define BIT(x, i) (((x) >> (i)) & 1)
#define lb lower_bound
#define ub upper_bound
#define lla(v) (v).begin(),(v).end()
#define zs(v) int((v).size())
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define ar array
#define endl '\n'
typedef long double ld;
typedef long long ll;
typedef pair<int,int> pii;
const int mod=1000000007; /// 998244353
const int base=311;
const int N=1e5+5;

void solved()
{
    int ans=0;
    string s; cin>>s;
    for(char i:s)
    {
        ans=(ans+(i-'0'))%9;
    }
    if(ans==0) cout<<"Yes";
    else cout<<"No";
}
int main()
{
    ios_base::sync_with_stdio(0); cin.tie(0);
    if(fopen(task".inp","r"))
    {
        freopen(task".inp","r",stdin);
        freopen(task".out","w",stdout);
    }
    solved();
}










Measured memory_bytes: 3780
#include<bits/stdc++.h>
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define ll long long
#define ld long double
#define pll pair<ll,ll>
#define vll vector<pll>
#define vl vector<ll>
#define f first
#define s second
#define N 50000
#define pb push_back
#define MAP map<ll,ll>
#define MAPs map<<ll,sl>
#define MAPv map<ll,vl>
#define  mset(x,val) memset(x,val,sizeof(x))
#define mod 1000000007
#define foo(i,a,b) for(ll i=(a);i<=(b);i++)
#define rep(i,a,b) for(ll i=(a);i>=(b);i--)
#define FOR(i,v) for(auto &(i):(v))
#define sl set<ll>
#define sll set<pll>
#define ub upper_bound
#define lb lower_bound
using namespace std;

const ll   INF = 0x7f7f7f7f7f7f7f7f;
const ll NINF = -INF;
const ll MAXN  = 1e+6 + 8;

int dx8[] = {0, 1, 1, 1, 0, -1, -1, -1}, dy8[] = {1, 1, 0, -1, -1, -1, 0, 1};
int dx4[] = {0, 1, 0, -1}, dy4[] = {1, 0, -1, 0};
//<<-----Declare Variable Here------->>//
ll x;
//<<-----Implement Functions Here---->>//
ll solve(ll n) {
    if (n >= 1800 and n <= 1999) return 1;
    if (n >= 1600 and n < 1800) return 2;
    if (n >= 1400 and n < 1600) return 3;
    if (n >= 1200 and n < 1400) return 4;
    if (n >= 1000 and n < 1200) return 5;
    if (n >= 800 and n < 1000) return 6;
    if (n >= 600 and n < 800) return 7;
    if (n >= 400 and n < 600) return 8;

}

//<<-----Start of Main--------------->>//
void MAIN() {
    cin >> x;
    cout << solve(x) << "\n";
}

int main() {
    fastio;
    ll t = 1;
    // cin>>t;
    while (t--) {
        MAIN();
    }

// #ifndef ONLINE_JUDGE
//     cout << "\nTime Elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " sec\n";
// #endif
}

Measured memory_bytes: 3604
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)
#define all(v) v.begin(), v.end()
#define chmax(x,y) (x = max(x,y))
#define chmin(x,y) (x = min(x,y))

using ll = long long;
using PAIR = pair<int, int>;
using PAIRLL = pair<ll,ll>;
using vi = vector<int>;
using vvi = vector<vi>;

int main()
{
  string S;
  int N, Q,temp=0,l,r,f_ans;
  vi ans(100000);
  cin >> N >> Q >> S;
  rep(i,N-1)
  {
    if (S[i]=='A'&&S[i+1]=='C')
    {
      temp++;
    }
    ans[i] = temp;
  }

  rep(i,Q)
  {
    cin >> l >> r;
      if (S[l-1]=='A'&&S[l]=='C')
      {
        f_ans = ans[r - 2] - ans[l - 1] + 1;
      }
      else
      {
        f_ans = ans[r - 2] - ans[l - 1];
      }
    cout << f_ans << endl;
  }

  return 0;
}


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

int main() {
  int K,X;
  cin >> K >> X;
  for(int i=0; i<2*K-1; i++){
    cout << X-(K-1)+i << " " ;
  }
  cout << endl;
}


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

using namespace std;

typedef long long ll;

const ll MD = 1e9 + 7;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll n, ans = 1;
    cin >> n;
    vector<int> a(n);
    for (int &i : a)
        cin >> i;
    sort(a.begin(), a.end(), greater<int>());
    bool state = true;
    for (int i = 0, j = 0; i < n - 1 - (n % 2); i += 2)
        state &= (a[i] == a[i + 1] && a[i] == n - (2 * (j++) + 1));
    if (n % 2)
        state &= (a[n - 1] == 0);
    if (state)
    {
        for (int i = 0; i < n / 2; i++)
            ans = (ans << 1) % MD;
        cout << ans << "\n";
    }
    else
        cout << 0 << "\n";
    return 0;
}

Measured memory_bytes: 640
h, w, a, b = map(int,input().split())
for i in range(b):
    for j in range(a):
        print("0",end="")
    for j in range(w-a):
        print("1",end="")
    print()
for i in range(h-b):
    for j in range(a):
        print("1",end="")
    for j in range(w-a):
        print("0",end="")
    print()

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

#define uint        unsigned int
#define ld          long double
#define int         long long
#define showoff     ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define pb          push_back
#define pii         pair<int,int>
#define FOR(i,a,b)  for(int i=a;i<b;++i)
#define RFOR(i,a,b) for(int i=a;i>b;--i)
#define f           first
#define se          second
#define maxn        400005
#define all(v)      v.begin(),v.end()
#define sz(x)       (int)x.size()
#define mod         1000000007
#define pqueue      priority_queue<int>
#define pdqueue     priority_queue< int,vector<int> ,greater< int >>

using namespace std;

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
//const int md = 998244353;

/*const int mod = 998244353;
int power(int a,int n)
{
    if(n == 1)return a%mod;
    if(n == 0)return 1;
    if(n&1)return ((a%mod)*(power((a*a)%mod,n/2))%mod)%mod;
    return power((a*a)%mod,n/2)%mod;
}
*/


signed main()
{
    showoff;
    double t,x;
    cin >> t >> x;
    cout << t/x;


    return 0;
}
//*->for large size of matrix take int not long long ......


Measured memory_bytes: 256
#pragma warning(disable:4996)
#include<climits>
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<map>
#include<set>
#include<cmath>
#include<stack>
#include<queue>
#include<string>
using namespace std;
typedef long long ll;
const int INF = INT_MAX;
int main()
{
	ll n, a, b, cnt=0,MIN=0,t,ia,ib;
	scanf("%lld%lld%lld", &n, &a, &b);
	ia = a; ib = b;
	if (a > b)
	{
		t = a;
		a = b;
		b = t;
	}
	if ((b - a) % 2 == 0)
	{
		printf("%lld\n", (b - a) / 2);
	}
	else
	{
		ll temp1=0, temp2=0;
		if (a > 1)
		{
			temp1 = (a - 1);
			b -= temp1;
			a = 1;
		}
		temp1++;
		b--;
		cnt = (b - a) / 2 + temp1;
		a = ia; b = ib;
		if (b < n)
		{
			temp2 = (n - b);
			a += temp2;
			b = n;
		}
		temp2++;
		a++;
		MIN = temp2 + (b - a) / 2;
		MIN = min(MIN, cnt);
		printf("%lld\n", MIN);
	}
	return 0;
}

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

struct Square{
    int h, w;
    bool operator>(const Square &obj)const{
        if(h*h+w*w == obj.h*obj.h+obj.w*obj.w)return h > obj.h;
        else return h*h+w*w > obj.h*obj.h+obj.w*obj.w;
    }
    bool operator<(const Square &obj)const{
        if(h*h+w*w == obj.h*obj.h+obj.w*obj.w)return h < obj.h;
        else return h*h+w*w < obj.h*obj.h+obj.w*obj.w;
    }
};

int main(){
    int h, w;
    while(cin >> h >> w, h != 0){
        Square s = (Square){h, w};
        Square ans = (Square){100, 100};
        for(int i=1;i<=150;++i){
            for(int j=i+1;j<=150;++j){
                Square t = (Square){i, j};
                if(t > s)ans = min(ans, t);
            }
        }
        cout << ans.h << ' ' << ans.w << endl;
    }

    return 0;
}



Measured memory_bytes: 3076
#include <cstdio>
#include <cmath>
#include <cstring>
#include <cstdlib>
#include <climits>
#include <ctime>
#include <queue>
#include <stack>
#include <algorithm>
#include <list>
#include <vector>
#include <set>
#include <map>
#include <iostream>
#include <deque>
#include <complex>
#include <string>
#include <iomanip>
#include <sstream>
#include <bitset>
#include <valarray>
#include <iterator>
using namespace std;
typedef long long int ll;
typedef unsigned int uint;
typedef unsigned char uchar;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef vector<int> vi;

#define REP(i,x) for(int i=0;i<(int)(x);i++)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();i++)
#define RREP(i,x) for(int i=((int)(x)-1);i>=0;i--)
#define RFOR(i,c) for(__typeof((c).rbegin())i=(c).rbegin();i!=(c).rend();i++)
#define ALL(container) container.begin(), container.end()
#define RALL(container) container.rbegin(), container.rend()
#define SZ(container) ((int)container.size())
#define mp(a,b) make_pair(a, b)
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );
#define F first
#define S second
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }
template<class T> ostream& operator<<(ostream &os, const vector<T> &t) {
os<<"["; FOR(it,t) {if(it!=t.begin()) os<<","; os<<*it;} os<<"]"; return os;
}
template<class T> ostream& operator<<(ostream &os, const set<T> &t) {
os<<"{"; FOR(it,t) {if(it!=t.begin()) os<<","; os<<*it;} os<<"}"; return os;
}
template<class S, class T> ostream& operator<<(ostream &os, const pair<S,T> &t) { return os<<"("<<t.first<<","<<t.second<<")";}

const int INF = 1<<28;
const double EPS = 1e-8;
const int MOD = 1000000007;


int n, m;

main(){
	while(cin >> n >> m, n){
		vector< pair<string, pii> > names(n);
		REP(i, n){
			cin >> names[i].F >> names[i].S.F >> names[i].S.S;
			names[i].S.F = names[i].S.S - names[i].S.F;
		}
		REP(i, m){
			int y, f=0;
			cin >> y;
			REP(j, n){
				if(names[j].S.F < y && y <= names[j].S.S){
					cout << names[j].F << " " << y - names[j].S.F << endl;
					f = 1;
					break;
				}
			}
			if(!f) cout << "Unknown" << endl;
		}
	}
	return 0;
}

Measured memory_bytes: 1280
from collections import defaultdict
import math
import sys
 
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

def gcd(x, y):
    if y == 0:
        return x
    else:
        return gcd(y, x % y)

def main():
    MOD = 1000000007
    N = int(readline())
    m = map(int, read().split())
    A, B = zip(*zip(m, m))
    # Ai * Aj + Bi * Bj = 0
    # -> Ai * Aj = -Bi * Bj
    # -> (Ai/Bi) = -(Aj/Bj)
    # のとき、そのイワシ同士は入れられない

    # そこで、 Ci = Ai/Bi を約分したもの（かつBi>0としておく）
    # を覚えておき、Ci = -Cj となるようなペア同士を数えていく

    C = defaultdict(int)
    n00 = 0
    for a, b in zip(A, B):
        # (0, 0) はどのイワシとも仲が悪いので、考慮の対象から外して置き、
        # 後で(0, 0)のイワシの本数分足す
        if a == 0 and b == 0:
            n00 += 1
            continue

        # Bが0の場合、Aが0のイワシであればなんでも仲が悪くなるので、
        # C = -1 / 0 で統一する。
        if b == 0:
            C[(-1, 0)] += 1
            continue
        # Aが0の場合、Bが0のイワシであればなんでも仲が悪くなるので、
        # C = 0 / 1 で統一する。
        elif a == 0:
            C[(0, 1)] += 1
            continue
        # A / B を約分して、同じ値のイワシの個数を数え上げる
        g = math.gcd(a, b)
        a = a // g
        b = b // g
        # bは常に0以上にする
        if b < 0:
            b = -b
            a = -a
        C[(a, b)] += 1
    
    C = dict(C)
    flag = {k: False for k in C.keys()}

    ans = 1
    for c, nc in C.items():
        a, b = c
        a2, b2 = (-b, a) if a >= 0 else (b, -a)
        # 仲の悪いイワシの個数
        nBad = C.get((a2, b2), 0)
        # 仲の悪いイワシがいなければ、
        # この中からイワシを選ぶ時のすべての組み合わせ（全て選択しない場合を含む）の数を考える
        # = 2^nc  = 1 << nc
        if nBad == 0:
            k = 1 << nc
        else:
            # (-2, 3) (3, 2) があるとき、それぞれで組み合わせを考えると重複するので、
            # 片方しか数えないようにする
            if flag[(a2, b2)]:
                continue

            # 仲の悪いイワシがいる場合、
            # あるCのイワシがnc本、それと中の悪いイワシがnBad本あるとする。
            # nc + nBad 本のイワシのうち、OKな組み合わせの個数は
            # [nc本から1本以上選ぶ組み合わせ] + [nc本から1本以上選ぶ組み合わせ] + [イワシを全て選択しない場合]
            # (2^nc - 1) + (2^nBad - 1) + 1 = 2^nc + 2^nBad - 1
            k = (1 << nc) + (1 << nBad) - 1
        
        ans = (ans * k) % MOD
        flag[c] = True

    # 上の数え上げだと、イワシを1本も選ばない場合も含まれているので、
    # そのパターンを除外するため-1する。
    # -1 するついでに(0, 0) のイワシから1本以上選ぶ場合の数も足しておく
    ans = (ans + n00 - 1) % MOD
    print(ans)


if __name__ == '__main__':
    main()

Measured memory_bytes: 81424
numN = int(input())
args = input()
 
lines = list()
 
 
for i in range(numN):
    if i == numN - 1 :
        lines.append(int(args))
        break

    lines.append(int(args[0:args.find(" ")]))
    args = args[args.find(" ") + 1 :]
 
list_sorted = sorted(lines, reverse = True)
max_line = list_sorted[0]
 
for m in range(numN - 1):
    max_line = max_line - list_sorted[m+1]

if max_line < 0 :
    print('Yes')
else:
    print('No')

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

#define REP(i, n) for(int i=0; i<n;i++)
#define REPR(i, n) for(int i=n-1 ; i>=0; i--)
#define FOR(i, m, n) for(int i=m; i<n; i++)

#define INF 2e9
#define ll long long

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

    double x[n][d];
    int i, j, k;

    for(i=0; i<n; i++){
        for(j=0; j<d; j++){
            cin>>x[i][j];
        }
    }

    double distance;
    int ans=0;
    for(i=0; i<n; i++){
        for(j=i+1; j<n; j++){
            distance = 0;
            for(k=0; k<d; k++){
                distance += (x[i][k]-x[j][k]) * (x[i][k]-x[j][k]);
            }
            int heiho = (int)sqrt((distance));
            if(heiho*heiho == distance){
                ans++;
            }
        }
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int max_v = 0;
map<pair<int,int>,int>uniq;
int get_idx(pair<int,int>p){
    if(uniq.find(p) == uniq.end()){
        uniq[p] = max_v++;
    }
    return uniq[p];
}
vector<vector<int>>edge;
void dfs(vector<int>&d,int v,int value){
    for(auto nxt : edge[v]){
        if(d[nxt] < value + 1){
            d[nxt] = value + 1;
            dfs(d,nxt,d[nxt]);
        }
    }
    return;
}
signed main(){
    int N; cin >> N;
    vector<vector<int>>g(N);
    for(auto& v : g){
        for(int i = 0; i < N - 1; ++i){
            int t; cin >> t;
            v.push_back(--t);
        }
    }
    // 0-index
    vector<vector<int>>pos(N,vector<int>(N,-1LL));
    for(int i = 0; i < g.size(); ++i){
        for(int j = 0; j < g[i].size(); ++j){
            auto e = g[i][j];
            pos[i][e] = j;
        }
    }
    vector<vector<bool>>used(N,vector<bool>(N-1,false));
    edge.resize(N*N);
    vector<int>d(N*N,-1);
    vector<int>in(N*N);
    auto f = [](int i, int j){
        return make_pair(min(i,j), max(i,j));
    };
    for(int j = 0; j < N - 1; ++j){
        for(int i = 0; i < N; ++i){
            if(used[i][j])continue;
            //cout <<  i + 1 << " " << g[i][j]+ 1 << endl;
            auto e = g[i][j];
            int rj = pos[e][i];
            auto p = f(i,e);
            if(j + 1  < N - 1){
                auto nxt = f(i,g[i][j + 1]);
                in[get_idx(nxt)]++;
                edge[get_idx(p)].push_back(get_idx(nxt));
            }
            if(rj + 1 < N - 1 ){
                auto nxt = f(e,g[e][rj + 1]);
                in[get_idx(nxt)]++;
                edge[get_idx(p)].push_back(get_idx(nxt));
            }
            used[i][j] = used[e][rj] = true;
        }
    }
    queue<int>que;
    vector<int>cnt(max_v,0);
    for(int j = 0; j < N ; ++j)
        cnt[get_idx(f(j,g[j].front()))] += 1;
    
    for(int p = 0; p < max_v; ++p){
        if(in[p])continue;
        d[p] = 1;
        que.push(p);
        
    }
    while(not que.empty()){
        int top = que.front(); que.pop();
        for(auto nxt : edge[top]){
            if(cnt[nxt] == 2) continue;
            cnt[nxt]++;
            d[nxt]  = max(d[nxt],d[top] + 1);
            if(cnt[nxt] == 2) que.push(nxt);
            
        }
    }
    for(int i = 0; i < max_v; ++i)
        if(d[i] == -1) return puts("-1") * 0;
    cout << *max_element(d.begin(), d.end()) << endl;
}


Measured memory_bytes: 88448
import sys
N=int(input())
table=[]
for i in range(N):
    x,y=map(int,input().split())
    table.append((x,y))
L=[0,0]
for x,y in table:
    L[(x+y)%2]=1
if sum(L)==2:
    print(-1)
    sys.exit()
def f(a,b):
    pas=''
    s=a[::-1]
    t=b[::-1]
    A=[0]*31
    B=[0]*31
    for i in range(len(s)):
        if s[i]=='1':
            A[i]=1
    for i in range(len(t)):
        if t[i]=='1':
            B[i]=1
    n=31
    for i in range(n):
        if A[i]==0 and B[i]==0:
            pas+='L'
        if A[i]==0 and B[i]==1:
            pas+='D'
        if A[i]==1 and B[i]==0:
            pas+='U'
        if A[i]==1 and B[i]==1:
            pas+='R'
        
    return pas
if L[0]==1:
    m=32
    d=[1]+[pow(2,i) for i in range(31)]
    ans=[]
    S=[]
    for x,y in table:
        S.append((x-1,y))
    for x,y in S:
        a='R'
        u=(x+y+(pow(2,31)-1))//2
        v=(x-y+(pow(2,31)-1))//2
        u=bin(u)[2:]
        v=bin(v)[2:]
        a+=f(u,v)
        ans.append(a)       
else:
    m=31
    d=[pow(2,i) for i in range(31)]
    ans=[]
    S=table
    for x,y in S:
        a=''
        u=(x+y+(pow(2,31)-1))//2
        v=(x-y+(pow(2,31)-1))//2
        u=bin(u)[2:]
        v=bin(v)[2:]
        a+=f(u,v)
        ans.append(a)      

print(m)
print(' '.join(map(str,d)))
for s in ans:
    print(s)
    

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

using namespace std;

#define REP(i,m) for(int i=0; i<m; i++)
#define FOR(i,n,m) for(long long i=n; i<m; i++)
#define INF 1000000001
#define INFL (1LL << 60)
#define MOD 1000000007
#define ALL(v) v.begin(),v.end()
#define pb push_back
#define ll long long int
#define P pair<ll, ll>

ll min(ll a, ll b){
  return (a<b?a:b);
}

int main() {
  int n;
  ll x;
  cin >> n >> x;
  ll a[n];
  REP(i, n) cin >> a[i];
  ll lt[n][n];
  REP(i, n) lt[0][i] = a[i];
  FOR(i, 1, n){
    REP(j, n){
      if(j == 0){
        lt[i][j] = min(lt[i-1][j], lt[i-1][n-1]);
      }
      else{
        lt[i][j] = min(lt[i-1][j], lt[i-1][j-1]);
      }
    }
  }
  ll ans = INFL;
  REP(i, n){
    ll tmp = i*x;
    REP(j, n) tmp += lt[i][j];
    ans = min(tmp, ans);
  }
  cout << ans << endl;
  return 0;
}

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

using namespace std;

#define INF 2000000000
#define MOD 1000000007
typedef long long ll;
typedef pair<ll, ll> P;


ll gcd(ll a, ll 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;
}

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

	ll y, tmp;
	cin >> y;
	for (ll i = 1; i < n; i++) {
		cin >> tmp;
		y = lcm(y, tmp);
	}
	cout << y << endl;
}


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

inline void solve(){
    long long a, b, c, d;
    cin >> a >> b >> c >> d;
    cout << max({a * c, a * d, b * c, b * d}) << endl;
}

int main(){
    #ifndef ONLINE_JUDGE
        freopen("input.txt", "r", stdin);
    #endif

    //int t;
    //cin >> t;
    //while(t--)
    solve();

    return 0;
}

Measured memory_bytes: 3640
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>

using namespace std;

int main(){
	int n,k;
	cin >> n >> k;
	char str[52];
	scanf("%s", str);
	str[k-1] = str[k-1] - ('A'-'a');

	cout << string(str) << endl;

	return 0;
}


Measured memory_bytes: 256
def LI(): return list(map(int, input().split()))
def I(): return map(int, input().split())
  
def main():
  m = int(input())
  a = LI()
  ans = 0
  if a.count(1) == 1:
    print(1)
    exit()
  n = max(a)
  num = [True]*(n+1)
  num[0] = num[1] = False
  a.sort()
  for i in range(m):
    if (i != m-1 and a[i]==a[i+1]) or (i != 0 and a[i]== a[i-1]): num[a[i]] = False
    for j in range(a[i]*2, n+1, a[i]):
      num[j] = False
  for aa in a:
    if num[aa]:
      ans += 1
  print(ans)

if __name__ == '__main__':
  main()

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

const int N = 1e5 + 10;
const int inf = INT_MAX;

#define ll long long
#define FOR(i,a,b) for(int i = a;i <= b;i++)
#define _FOR(i,a,b) for(int i = a;i >= b;i--)

template<typename T> void read(T &x)
{
  x = 0;int f = 1;
  char c = getchar();
  for(;!isdigit(c);c = getchar()) if(c == '-') f = -1;
  for(;isdigit(c);c = getchar()) x = x * 10 + c - '0';
  x *= f;
}

int n;
double a[110];
int main()
{
  //freopen(".in","r",stdin);
  //freopen(".out","w",stdout);
  cin >> n;
  FOR(i,1,n)
    cin >> a[i];
  double ans = 0;
  FOR(i,1,n)
    ans = ans + 1.0 / a[i];
  printf("%f\n",1.0 / ans);
  return 0;
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i, n) for(int (i)=0 ;i <(n); ++(i))
#define REP(i,m,n) for(int (i) = (m); (i) <= (n); ++(i))
#define yorn(f) puts((f)?"Yes":"No")
#define YORN(f) puts((f)? "YES":"NO")
typedef long long ll;
using namespace std;

int main() {
  string s;
  cin >> s;
  for(char c = 'a'; c <= 'z'; c++) {
    bool f = true;
    rep(i ,s.size()) {
      if(s[i] == c) {
        f = false;
      }
    }
    if(f) {
      cout << c << endl;
      return 0;
    }
  }

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

Measured memory_bytes: 512
#include <iostream>
using namespace std;
 
int main() {
	int N, A;
	cin >> N >> A;
	int x[53];
	int sum = 0;
	for (int i = 0; i < N; i++) {
		cin >> x[i];
		sum += x[i];
	}
	long long dp[53][2550][53] = { 0 };
	dp[0][0][0] = 1;
	for (int i = 0; i < N; i++) {
		for (int k = 0; k <= i+1; k++) {
			for (int j = 0; j <= sum; j++) {
				if (j >= x[i]&&k>0) {
					dp[i + 1][j][k] = dp[i][j - x[i]][k - 1] + dp[i][j][k];
				}
				else {
					dp[i + 1][j][k] = dp[i][j][k];
				}
			}
		}
	}
	long long combi;
	combi = 0;
	for (int i = 1; i <= N; i++) {
			combi += dp[N][i*A][i];
	}
	cout << combi;
	return 0;
}

Measured memory_bytes: 56192
#include<bits/stdc++.h>
#define REP(i,n) for(int i=0;i<(n);i++)
#define ALL(v) (v).begin(),(v).end()
#define int long long
using namespace std;
typedef vector<int>   vint;
typedef pair<int,int> pint;

string s[100];

signed main()
{
    int H,W; cin>>H>>W;
    REP(i,H) cin>>s[i];

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

    bool ok=true;
    REP(i,H) REP(j,W){
        if(s[i][j]=='.') continue;

        bool f=false;
        REP(k,4){
            int y=i+dy[k],x=j+dx[k]; 
            if(y<0 or H<=y or x<0 or W<=x) continue;
            if(s[y][x]=='#') f=true;
        }
        if(f==false) ok=false;

    }
    cout<<(ok? "Yes":"No")<<endl;
    
}


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

int main()
{
	int n,p[2]={};
	string str[2];
	cin >> n;

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

		if(str[0] == str[1]){
			p[0]++;
			p[1]++;
		}else if(str[0] > str[1]){
			p[0]+=3;
		}else{
			p[1] += 3;
		}
	}

	cout << p[0] << " " << p[1] << endl;
	return 0;
}

Measured memory_bytes: 1208
#include <iostream>
#include <vector>
#include <stack>
#include <queue>
#include <list>
#include <functional>
#include <algorithm>
#include <complex>
#include <map>
#include <cmath>
#include <string>
#include <cstdio>
#include <stdio.h>
#include <cstdlib>
#include <istream>



using namespace std;

//--------------------------------------------------------------//

char s;
int a = 0, k, L;
//s??\???????????????a?????¢??????k?????°???L?????¢???
stack<int> s1;
stack<pair<int, int> > s2;

int main() {
	for (int i = 0; cin >> s; i++) {
		if (s == '\\') {
			s1.push(i);
		}
		else if (s == '/'&& s1.size() > 0) {
			int j = s1.top(); s1.pop();
			a += i - j;
			int b = i - j;
			while (s2.size() > 0 && s2.top().first > j) {
				b += s2.top().second; s2.pop();
			}
			s2.push(make_pair(j, b));
		}
	}


	vector<int> ans;

	while (s2.size() > 0) {
		ans.push_back(s2.top().second);
		s2.pop();
	}
	reverse(ans.begin(), ans.end());

	cout << a << endl;

	cout << ans.size();
	for (int i = 0; i < ans.size(); i++) {
		cout << " " ;
		cout << ans[i];
	}
	cout << endl;
}

Measured memory_bytes: 3184
def kiriage(n):
    if n%10==0:
        return n
    else: return n-(n%10)+10

A = int(input())
B = int(input())
C = int(input())
D = int(input())
E = int(input())

least = 100
dish = [A, B, C, D, E]
kiri = []
ans = 1000
for i in dish:
    kiri.append(kiriage(i))
for i in range(5):
    time = sum(kiri) - kiri[i] + dish[i]
    ans = min(ans, time)

print(ans)

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

int main() {
  
  int n;
  cin >> n;
  
  vector<int> a(n-1),b(n);
  
  for ( int i = 0; i < n -1; i++){
    cin >> a.at(i);
  }
  
  for ( int i = 0; i < n-1; i++){
    b.at(a.at(i)-1)++;
  }
  
  for ( int i = 0; i < n; i++){
    cout << b.at(i) << endl;
  }
    
  
  
}



Measured memory_bytes: 4844
import java.util.*;

class Main{
    public static void main(String args[]){
        Scanner in = new Scanner(System.in);
        while(true){
            int n = in.nextInt();
            if(n == 0) return ;
            int mat[][] = new int[n+1][n+1];
            for(int i=0; i<n; i++){
                int sumr = 0;
                for(int j=0; j<n; j++){
                    mat[i][j] = in.nextInt();
                    sumr += mat[i][j];
                }
                mat[i][n] = sumr;
            }
            for(int j=0; j<=n; j++){
                int sumc = 0;
                for(int i=0; i<n; i++){
                    sumc += mat[i][j];
                }
                mat[n][j] = sumc;
            }
            for(int i=0; i<=n; i++){
                for(int j=0; j<=n; j++){
                    System.out.printf("%5d",mat[i][j]);
                }
                System.out.println();
            }
        }
    }
}

Measured memory_bytes: 13000
#include <iostream>
#include <vector>
#include <algorithm>
#include <cstdlib>

using namespace std;

struct student {
	int x;
  	int y;
};

struct check {
	int x;
  	int y;
};

int distance(student s, check c)
{
	return abs(c.x - s.x) + abs(c.y - s.y);
}

int main()
{
	int N, M, min, m_dist, pnum; //min:minimum distance, pnum:point number 
  	vector<student> st;
  	vector<check> cp;
  	cin >> N >> M;
  	for (int i = 0; i < N; i++){
    	int x; int y; cin >> x >> y;
      	student s = {x, y};
      	st.push_back(s);
    }
  	for (int j = 0; j < M; j++){
    	int x2; int y2; cin >> x2 >> y2;
      	check c = {x2, y2};
      	cp.push_back(c);
    }
  
  	for (int i = 0; i < N; i++){
    	min = distance(st[i], cp[0]);
      	pnum = 1;
      	for (int j = 1; j < M; j++){
        	m_dist = distance(st[i], cp[j]);
          	if (min > m_dist){
            	min = m_dist;
              	pnum = j + 1;
            }
        }
      	cout << pnum << endl;
    }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define F(i,a,b) for(int i=(int)a;i<=(int)b;i++)
#define FD(i,a,b) for(int i=(int)a;i>=(int)b;i--)
#define pii pair<int,int>
#define reset(x,y) memset(x, y,sizeof(x))
#define MIN(x,y) if (x > (y)) x = (y)
#define MAX(x,y) if (x < (y)) x = (y)
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define EL putchar('\n');
#define mod 1000000007
#define oo 1000006
int read()
{
    int x = 0, f = 1;
    char c = getchar();
    while (c < '0' || c > '9') {if (c == '-') f = -1; c = getchar();}
    while (c >= '0' && c <= '9') {x = x * 10 + c - '0'; c = getchar();}
    return x * f;
}
void write(int x)
{
    if (x > 9) write(x / 10);
    putchar(x % 10 + '0');
}
int a,b,c,k,n;
double f[333][333][333];
void ReadInPut()
{
    n=read();
    F(i,1,n)
    {
        k=read();
        a+=k==1;
        b+=k==2;
        c+=k==3;
    }
}
double tinh(int a,int b,int c)
{
    if(a+b+c==0)return 0;
    if(f[a][b][c]!=0)return f[a][b][c];
    f[a][b][c]=(double(n))/double((a+b+c));
    if(a)f[a][b][c]+=double(a)/double((a+b+c))*tinh(a-1,b,c);
    if(b)f[a][b][c]+=double(b)/double((a+b+c))*tinh(a+1,b-1,c);
    if(c)f[a][b][c]+=double(c)/double((a+b+c))*tinh(a,b+1,c-1);
    return f[a][b][c];
}
void Solve()
{
    cout<<fixed<<setprecision(14)<<tinh(a,b,c);
}
main()
{
//    freopen("t.INP","r",stdin);
  //  freopen(".OUT","w",stdout);
    int sotest=1;
    //cin>>sotest;
    for(int i=1;i<=sotest;i++)
    {
        ReadInPut();
        Solve();
    }
}


Measured memory_bytes: 260224
S=list(input())
flag = True
for i in range(len(S)):
  s = S[i]
  if (i+1)%2==0:
    if s=="R":
      flag = False
  else:
    if s=="L":
      flag = False

if flag is True:
  print("Yes")
else:
  print("No")
  
    
  

Measured memory_bytes: 2940
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
int main() {
	ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
	int n;
	cin >> n;
	int a[n];
	map <int, ll> mp;
	for(int i = 0; i < n; i ++) {
		cin >> a[i];
		mp[a[i]] ++;
	}
	ll ans[n + 1] = {0};
	ll tmp = 0;
	for(auto p : mp) tmp += 1LL * p.second * (p.second - 1) / 2;
	for(auto p : mp) {
		ll cur = tmp;
		cur -= 1LL * p.second * (p.second - 1) / 2;
		cur += 1LL * (p.second - 1) * (p.second - 2) / 2;
		ans[p.first] = cur;
	}
	for(int i = 0; i < n; i ++) cout << ans[a[i]] << "\n";
	return 0;
}


Measured memory_bytes: 11904
import java.util.*
 
fun main(args: Array<String>) {
    val sc = Scanner(System.`in`)
    val N = sc.nextInt()
    val T = sc.nextInt()
    val ans = (1..N).map {
        val c = sc.nextInt()
        val t = sc.nextInt()
        if (t <= T) {
            c
        } else {
            Int.MAX_VALUE
        }
    }.min()
    println(if (ans == Int.MAX_VALUE) "TLE" else ans)
}

Measured memory_bytes: 31648
#include<bits/stdc++.h>
using namespace std;
long long int a,b,c,ar[1000009],sum,cnt,br[1000009];
int main()
{
    cin>>a;
    if(a%2) cout<<0<<endl;
    else
    {
        b=a/10;
        while(b!=0)
        {
            c+=b;
            b/=5;
        }
        cout<<c<<endl;
    }
    return 0;
}



Measured memory_bytes: 764
import Control.Applicative
import Control.Monad
import Data.List
import Data.Array
import Data.Char

main = do
  [a, b] <- map (read::String -> Int) . words <$> getLine
  putStrLn $ if a `mod` 2 == 0 || b `mod` 2 == 0 then "No" else "Yes"
  

Measured memory_bytes: 508
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cmath>
#include<cstring>
#include<cstdlib>
#include<cctype>
#include<vector>
#include<queue>
#include<deque>
#include<map>
#include<set>
#include<stack>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
typedef pair<int,int> PII;
typedef vector<int> VI;
#define fast ios::sync_with_stdio(0),cin.tie(0)
#define fi first
#define se second
#define pb push_back
#define mk make_pair
#define ls (rt<<1)
#define rs (rt<<1|1)
#define All(a) (a).begin(),(a).end()
#define clr(a) memset((a),0,sizeof(a))
#define FOR(i,a,b) for(int i=(a);i<=(b);++i)
#define REP(i,a,b) for(int i=(a);i>=(b);--i)
#define FOR_edge(i,u)  for(int i=hd[u];i;i=e[i].nxt)
const int inf=0x3f3f3f3f;
const ll INF=0x3f3f3f3f3f3f3f3f;
const int dx[]={1,-1,0,0};
const int dy[]={0,0,-1,1};

inline char in() {
	static char buf[10001],*p1=buf,*p2=buf;
	return p1==p2&&(p2=(p1=buf)+fread(buf,1,10000,stdin),p1==p2)?EOF:*p1++;
}
template <class Tp> inline void read(register Tp &s) {
	s=0;
	register bool neg=0;
	register char c;
	while(!isdigit(c=in())) if(c=='-') neg=1;
	while(s=(s<<3)+(s<<1)+c-48,isdigit(c=in()));
	s=(neg?-s:s);
}
template <class Tp> inline void write(register Tp x) {
	if(x<0) putchar('-'),x=-x;
	if(x>9) write(x/10);
	putchar(x%10+'0');
}
template <class Tp> inline void print(const Tp &x,const char &end) {write(x); putchar(end);}
template <class Tp> inline Tp pow(register Tp x,register Tp p,const Tp &mod) {
	register Tp res=1;
	for(;p;p>>=1,x=(x*x)%mod) if(p&1) res=(res*x)%mod;
	return res;
}
inline int comp(const double &x,const double &y) {
	const double d=x-y,eps=1e-8;
	return (d<=eps&&d>=-eps)?0:(d>eps?1:-1);
}
template <class Tp> inline Tp sqr(const Tp &x) {return x*x;}
template <class Tp> inline Tp gcd(const Tp &x,const Tp &y) {return(y==0?x:gcd(y,x%y));}
template <class Tp> inline Tp inv(const Tp &x,const Tp &MOD) {return POW(x,MOD-2,MOD);}
template <class Tp> inline Tp lowbit(const Tp &x) {return x&-x;}

int n;
int main() {
	read(n);
	if(n<1200) puts("ABC");
	else if(n<2800) puts("ARC");
	else puts("AGC");
	return 0;
}

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

using namespace std;

using ll = long long;
const ll MOD = 1e9 + 7;
const ll INF = 1e18;

int main() {
    ll n, m, i, j, k;
    ll a,b;
    cin >> a >> b >> k;
    if(a>=k){
        a-=k;
        k=0;
        cout << a << " " << b << endl;
    }else {
        k-=a;
        a = 0;
        b= max(0ll,b-k);
        cout << a << " " << b << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <algorithm>
#include <assert.h>
#include <cmath>
#include <deque>
#include <iostream>
#include <limits.h>
#include<functional>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <stdlib.h>
#include <string.h>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#include <stack>

#define LL long long
#define pii pair<int,int>
#define pLL pair<LL,LL>
#define mp make_pair
#define mt make_tuple
#define pq priority_queue<LL>
#define pqg priority_queue<int,vector<int>,greater<int>>
#define pb push_back
#define vec vector<int>
#define vecll vector<LL>
#define vecpii vector<pii>
#define vecpLL vector<pLL>
#define vecbL vector<bool>
#define endl "\n"
#define REP(e,v) for(auto e:v)
#define rep(i, a, n) for(LL i = a; i < n;i++)

using namespace std;

int inp(){
	int x;
	scanf("%d",&x);
	return x;
}
LL linp(){
	LL x;
	scanf("%lld",&x);
	return x;
}

void outp(int i){
	printf("%d",i);
}

void loutp(LL i){
	printf("%lld",i);
}

LL mod(LL i){
	return i % 1000000007;
}


int gcd(int i,int j){
	if(j != 0)
		return gcd(j, i % j);
	else
		return i;

}

int tNoEP(){
	LL N,M;

	cin >> N >> M;

	loutp((N*(N-1))/2+(M*(M-1)/2));

	return 0;
}

bool isKaibun(string s){



	for(LL i = 0,j = s.length()-1; i < j;i++,j--){

		if(s[i] != s[j]) {
			return false;
		}

	}

	return true;
//	string rs = s;
//	reverse(s.begin(), s.end());
//
//	if(rs == s)
//		return true;
//	else
//		return false;
}

int SP(){

	string s;

	cin >> s;

	LL N = s.length();

	if(isKaibun(s) &&
			isKaibun(s.substr(0, (N-1)/2  )) &&
				isKaibun(s.substr((N+3)/2 -1 , N)))
		printf("Yes");
	else
		printf("No");

	return 0;

}

signed main() {

	//tNoEP();
	SP();
	return 0;
}


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


int main(){
    ll n,K;cin>>n>>K;
    ll x[55],y[55];
    rep(i,0,n)cin>>x[i]>>y[i];
    ll cn,an=8e18;
    rep(i,0,n){
        rep(j,0,n){
            rep(k,0,n){
                rep(m,0,n){
                    cn=0;
                    ll u=y[i],d=y[j],r=x[k],l=x[m];
                    if(d>u||l>r)continue;
                    rep(I,0,n){
                        if(d<=y[I]&&y[I]<=u&&l<=x[I]&&x[I]<=r)cn++;
                    }
                    if(cn==K){an=min(an,(u-d)*(r-l));}
                }
            }
        }
    }
    cout<<an<<endl;
}

    









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

using namespace std;
 
int main(void){

	int n,m;
	int sum;
	string trea[100+20];
	int money[100+20];
	string inp;

    while(1){
		cin>>n>>m;
		sum=0;
		if(n==0&&m==0) break;
		for(int i=0;i<n;i++){
			cin>>trea[i]>>money[i];
		}
		for(int i=0;i<m;i++){
			cin>>inp;
			for(int j=0;j<n;j++){
				for(int k=0;k<8;k++){
					if(inp[k]==trea[j][k]||trea[j][k]=='*'){
						if(k==7) sum+=money[j];
					}
					else break;
				}
			}
		}
		cout<<sum<<endl;
    }

    return 0;
}

Measured memory_bytes: 1208
s = list(input())
q = int(input())
cnt = 0
pre = []
end = []
for i in range(q):
    t, *fc = input().split()
    if t == '1':
        cnt^=1
    else:
        f, c = fc
        f = int(f)%2
        if f^cnt:
            pre.append(c)
        else:
            end.append(c)
ans = list(reversed(pre))+s+end
print
if cnt:
    ans = reversed(ans)
print(*ans, sep = '')



Measured memory_bytes: 101112
def main():
    K=int(input())
    A, B = map(int, input().split())

    result = isPossible(K, A, B)
    if result:
        print("OK")
    else:
        print("NG")

def isPossible(K, A, B):
    i = 1
    while True:
        current = K * i
        if A <= current <= B:
            return True
        if current > B:
            return False
        i += 1


if __name__ == '__main__':
    main()

Measured memory_bytes: 9068
n, m = map(int, input().split())
sc = [tuple(map(int, input().split())) for j in range(m)]
for i in range(0 if n == 1 else 10**(n - 1), 10**n):
    if all(str(i)[s - 1] == str(c) for s, c in sc):
        print(i)
        break
else:
    print(-1)

Measured memory_bytes: 9128
#include<iostream>
using namespace std;
#define df 0
#define MAX 10000000
#define rep(i,n) for(int i=0;i<(n);i++)
#define repa(i,a,n) for(int i=(a);i<(n);i++)


int main(){
  int n,k,ans=0;cin >>n >>k;
  rep(i,n){
    int h; cin >>h;
    if(h>=k)ans++;
  }
  printf("%d",ans);

}

/// confirm df==0 ///


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <stdlib.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef pair<ll,ll> llP;

int main() {
  string s;
  cin>>s;
  bool ans=true;
  int cnt=0;
  for(int i=0;i<s.size();i++){
    if(i==0){
      if(s[i]!='A') ans=false;
      continue;
    }
    if(s[i]=='C'){
      if(i==1 or i==s.size()-1){
        ans=false;
        continue;
      }
      cnt++;
      if(cnt>1) ans=false;
      continue;
    }
    if(s[i]<'a') ans=false;
  }
  if(cnt==0) ans=false;
  if(ans) cout<<"AC"<<endl;
  else cout<<"WA"<<endl;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main()
{
    int x,a,input;
    cin >> x >> a;
    bool ans = true;
    while(a--)
    {
      cin >> input;
      x -= input;
      if(x <= 0){
        break;
      }
    }

    if(x > 0){
      ans = false;
    }else {
      ans = true;
    }

    if(ans){
      cout << "Yes" << endl;
    }else {
      cout << "No" << endl;
    }
    return 0;
}


Measured memory_bytes: 256
//verma_ankit484

#include <bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>

#define int long long
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
#define pb push_back
const int mod = (int) 1e9+7;

using namespace std;
//using namespace __gnu_pbds;

//#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>

int dp[13][(1ll << 12) + 5];
int n, m, x;
vector<int> vc(13);
int arr[13][13];

int rec(int idx, int mask) {
  if (idx == n) {
    vector<int> sum(m, 0);
    int s = 0;
    for (int i = 0; i < n; i++) {
      if (mask & (1ll << i)) {
        s += vc[i];
        for (int j = 0; j < m; j++) {
          sum[j] += arr[i][j];
        }
      }
    }
    for (int i = 0; i < m; i++) {
      if (sum[i] < x) return INT_MAX;
    }
    return s;
  }
  int &ans = dp[idx][mask];
  if (ans != -1) return ans;
  ans = INT_MAX;
  ans = min(ans, rec(idx + 1, mask));
  ans = min(ans, rec(idx + 1, mask | (1ll << idx)));
  return ans;
}

int32_t main() {
  IOS
  #ifdef AV
  freopen("input.txt", "r", stdin);
  #endif
  memset(dp, -1, sizeof(dp));
  cin >> n >> m >> x;
  for (int i = 0; i < n; i++) {
    cin >> vc[i];
    for (int j = 0; j < m; j++) cin >> arr[i][j];
  }
  int ans = rec(0, 0);
  ans >= INT_MAX ? cout << -1 : cout << ans;
  return 0;
}


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

using ll = long long;
using ull = unsigned long long;
using namespace std;
constexpr int inf = 1<<30;
constexpr int mo = 1e9+7;
constexpr ll infl = 1ll<<60;

int main(){
    cin.tie(nullptr);
    std::ios::sync_with_stdio(false);
    
    int n;
    cin>>n;
    vector<int> ret(n+1);
    for(int x=1;x<=100;++x){
        for(int y=1;y<=100;++y){
            for(int z=1;z<=100;++z){
                int cur = x*x+y*y+z*z+x*y+x*z+y*z;
                if(cur <= n){
                    ret[cur]++;
                }
            }
        }
    }
    for(int i=1;i<=n;++i)cout << ret[i] << endl;
    return 0;
    
}

Measured memory_bytes: 3636
#include <bits/stdc++.h>
#include <bitset>
#include <cassert>
#include <cstring>
#include <functional>
#include <iomanip>
#include <list>
#include <cmath>
#include <memory>
#include <queue>
#include <set>
#include <stack>
#include <vector>
// #include <boost/multiprecision/cpp_dec_float.hpp>
// #include <boost/multiprecision/cpp_int.hpp>
using namespace std;
#define REP(i, n) for (int64_t i = 0; i < (int64_t)n; i++)
#define REP_FOR(i, a, b) for (int64_t i = (int64_t)a; i < (int64_t)b; i++)
#define REP_REV(i, a, b) for (int64_t i = (int64_t)a; i > (int64_t)b; i--)
#define FORALL(v) (v).begin(), (v).end()
#define mp(a, b) make_pair(a, b)
#define eb(x) emplace_back(x)
#define F first
#define S second
typedef long long ll;
typedef long double ld;
typedef pair<int64_t, int64_t> pii;
typedef pair<ll, ll> pll;
typedef pair<ld, ld> pdd;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef vector<int64_t> vii;
typedef vector<vii> vvii;
const ll mod = 1e9 + 7;
const int64_t infi = 1147483600;
const ll infl = 4e18 + 5;
const char EOL = '\n';
//cout << fixed << setprecision(17) << res << endl;
// const ll MOD = 1000000009;

#define M 1000000007

bool ok(string s, char c) {
    if (s[1] == 'A' && s[2] == 'G' && c == 'C') {
        return false;
    }
    if (s[1] == 'G' && s[2] == 'A' && c == 'C') {
        return false;
    }
    if (s[1] == 'A' && s[2] == 'C' && c == 'G') {
        return false;
    }
    if (s[0] == 'A' && s[2] == 'G' && c == 'C') {
        return false;
    }
    if (s[0] == 'A' && s[1] == 'G' && c == 'C') {
        return false;
    }
    return true;
}

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

    map<string, ll> dp[2];
    for (auto & c0 : string("ATCG")) {
        for (auto & c1 : string("ATCG")) {
            for (auto & c2 : string("ATCG")) {
                string s(3, '_');
                s[0] = c0; s[1] = c1; s[2] = c2;
                //cerr << s << endl;
                if (s != "AGC" && s != "GAC" && s != "ACG") {
                    dp[0].insert(make_pair(s, 1));
                    dp[1].insert(make_pair(s, 1));
                } else {
                    dp[0].insert(make_pair(s, 0));
                    dp[1].insert(make_pair(s, 0));
                }
            }
        }
    }

    ll cur = 0;
    for (ll i = 0; i + 3 < n; ++i) {
        cur = 1 - cur;
        ll prev = 1 - cur;
        dp[cur].clear();
        for (auto & iter : dp[prev]) {
            for (auto & c : string("ATCG")) {
                if (ok(iter.first, c)) {
                    string s(3, '_');
                    s[0] = iter.first[1]; s[1] = iter.first[2]; s[2] = c;
                    dp[cur][s] += iter.second;
                    dp[cur][s] %= M;
                }
            }
        }
    }
    ll res = 0;
    for (auto & iter : dp[cur]) {
        // cerr << iter.first << endl;
        res += iter.second;
        res %= M;
    }
    cout << res << endl;
}


Measured memory_bytes: 256
/**
*    created: 10.07.2020 17:44:14
**/
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
// #include <boost/multiprecision/cpp_int.hpp>
// using bint = boost::multiprecision::cpp_int;
using namespace std;
#define int long long
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define pcnt(bit) __builtin_popcountll(bit)
template<class T> bool chmax(T &a, const T &b) {if (a < b) {a = b; return 1;} return 0;}
template<class T> bool chmin(T &a, const T &b) {if (b < a) {a = b; return 1;} return 0;}
const long double pi = acos(-1.0);
const int MAX = 1000010;
const int INF = 1LL << 60;
const int MOD = 1000000007;
// const int MOD = 998244353;

// Template for ModInt
template <typename T> T pow(T a, long long n, T e = 1) {
    T ret = e;
    while (n) {if (n & 1) ret *= a; a *= a; n >>= 1;}
    return ret;
}

template <int mod> struct ModInt {
    int x;
    ModInt() : x(0) {}
    ModInt(long long x_) {if ((x = x_ % mod + mod) >= mod) x -= mod;}
    ModInt& operator+=(ModInt rhs) {if ((x += rhs.x) >= mod) x -= mod; return *this;}
    ModInt& operator-=(ModInt rhs) {if ((x -= rhs.x) < 0) x += mod; return *this;}
    ModInt& operator*=(ModInt rhs) {x = (unsigned long long)x * rhs.x % mod; return *this;}
    ModInt& operator/=(ModInt rhs) {x = (unsigned long long)x * rhs.inv().x % mod; return *this;}
    ModInt operator-() const {return -x < 0 ? mod - x : -x;}
    ModInt operator+(ModInt rhs) const {return ModInt(*this) += rhs;}
    ModInt operator-(ModInt rhs) const {return ModInt(*this) -= rhs;}
    ModInt operator*(ModInt rhs) const {return ModInt(*this) *= rhs;}
    ModInt operator/(ModInt rhs) const {return ModInt(*this) /= rhs;}
    bool operator==(ModInt rhs) const {return x == rhs.x;}
    bool operator!=(ModInt rhs) const {return x != rhs.x;}
    ModInt inv() const {return pow(*this, mod - 2);}
    friend ostream& operator<<(ostream& s, ModInt<mod> a) {s << a.x; return s;}
    friend istream& operator>>(istream& s, ModInt<mod>& a) {s >> a.x; return s;}
};

using mint = ModInt<MOD>;

signed main() {

    cin.tie(0);
    ios_base::sync_with_stdio(false);

    int n; cin >> n;
    map<int,int> mp;
    rep(i,n) {int a; cin >> a; mp[a]++;}
    bool ok = true;
    if (n % 2 == 1) {
        for (auto p : mp) {
            if (p.first == 0) {if (p.second != 1) ok = false;}
            else if (p.second != 2) ok = false;
        }
        if (!ok) {cout << 0 << endl; return 0;}
        else {cout << pow((mint)2,n/2) << endl; return 0;}
    }
    else {
        for (auto p : mp) if (p.second != 2) ok = false;
        if (!ok) {cout << 0 << endl; return 0;}
        else {cout << pow((mint)2,n/2) << endl; return 0;}
    }
}

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

using namespace std;
using ll = long long;

int main() {
	
	int a;
	string s;
	
	cin >> a >> s;
	if(a >= 3200) {
		cout << s << endl;
	} else {
		cout << "red" << endl;
	}
	
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include<vector>
#include<algorithm>
#include<string>
using namespace std;
int f(int n) {
	if (n % 2 == 0) {
		return n / 2;

	}
	else {
		return (3 * n + 1);
	}
}


int main() {
	bool flag[1000001];
	for (int i = 0; i < 1000001; i++) {
		flag[i] = false;
	}
	int s;
	cin >> s;
	flag[s] = true;
	for (int i = 2; i <= 100000; i++) {
		if (flag[f(s)] == true) {
			cout << i;
			break;
		}
		else
		{
			flag[f(s)] = true;
			s = f(s);
		}
	}
	return 0;
}

Measured memory_bytes: 1280