akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <cstring>
#include <algorithm>
#include <vector>
#include <string>
#include <math.h>
#include <iomanip>
#include <limits>
#include <list>
#include <queue>
#include <tuple>
#include <map>
using namespace std;
#define MOD (long long int)(1e9+7)
#define ll long long int
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define reps(i,n) for(int i=1; i<=(int)(n); i++)
#define REP(i,n) for(int i=n-1; i>=0; i--)
#define REPS(i,n) for(int i=n; i>0; i--)
#define FOR(i,a,b) for(int i=a; i<(int)(b); i++)
#define ALL(x) (x).begin(),(x).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define SORT(c) sort(ALL(x))
#define CLR(a) memset((a), 0 ,sizeof(a))
#define PB push_back
#define MP make_pair
#define SP << " " <<
const int INF = 1001001001;
const ll LINF = 100100100100100100;
const double EPS = 1e-10;
const double PI  = acos(-1.0);
typedef pair<int,int> PII;
typedef vector<int> VI;
typedef vector<VI> VVI;

void solve(){
	int n; cin >> n;
	if(__builtin_popcount(n)==1){
		cout << "No" << endl;
		return;
	}
	cout << "Yes" << endl;
	cout << 1+n SP 2+n << endl;
	cout << 2+n SP 3+n << endl;
	cout << 3+n SP 1 << endl;
	cout << 1 SP 2 << endl;
	cout << 2 SP 3 << endl;

	FOR(i,4,n){
		if(__builtin_ffs(i)!=1){
			cout << 1 SP i << endl;
			cout << i SP i+1 << endl;
			cout << 1 SP i+1+n << endl;
			cout << i+1+n SP i+n << endl;
		}else{
			continue;
		}
	}

	if(__builtin_ffs(n)!=1){
		int tmp = 2;
		while(n > tmp*2) tmp *= 2;
		cout << n SP tmp << endl;
		cout << n+n SP n-tmp+1+n << endl;
	}

	return;
}

signed main(){
	cin.tie(nullptr);
	ios::sync_with_stdio(false);
	cout << fixed << setprecision(15);
	solve();
	return 0;
}


Measured memory_bytes: 2304
#include<bits/stdc++.h>
using namespace std;
const long long INF = 1LL << 60;
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;}
#define rep(i,n) for(int i=0;i<n;i++)
#define all(a)  (a).begin(),(a).end()
#define P pair<int, int>
#define ll long long
const int MOD = 1000000007;
//bitset<64>(x).count()
//fixed << setprecision(15) << 

int main(){
  string s;
  cin >> s;
  cout << s ;
  if(s[s.size()-1]=='s'){
    cout << "es" << endl;
  } else {
    cout << "s" << endl;
  }
}


Measured memory_bytes: 3560
a, b, c = map(int, input().split())
k = int(input())
list = [a, b, c]
max = max(list)
if a == max:
    print(b+c+a*2**k)
elif b == max:
    print(a+c+b*2**k)
else:
    print(a+b+c*2**k)

Measured memory_bytes: 38256
//AOJ_ALDS1_4
#include<iostream>
#include<string>
#include<vector>
#include<cstdio>
#include<sstream>
#include<algorithm>
#include<cmath>
#include<map>
using namespace std;
int main(){
int n,q,ans=0;
int s[100000],t[100000];
cin>>n;
for(int i=0;i<n;i++)scanf("%d",&s[i]);
cin>>q;
for(int i=0;i<q;i++)scanf("%d",&t[i]);
for(int i=0;i<q;i++){
	int now=t[i];
	bool f=0;
	int a=0,b=n,mid=(a+b)/2;
	while(a<b){
	//cout<<a<<" "<<b<<endl;
	mid=(a+b)/2;
	if(a>b)break;
	if(s[mid]==now){f=1;break;}//発見
	else if(s[mid]<now)a=mid+1;//鋼板を探索
	else b=mid;//前半を探索
	}
	if(f)ans++;
}
cout<<ans<<endl;
return 0;
}

Measured memory_bytes: 1836
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

struct unionfind {
    vector<int> uf;
     
    unionfind(int n) : uf(n, -1) {}
     
    int root(int i) {
        if(uf[i]<0) return i;
        else return uf[i] = root(uf[i]);
    }
     
    bool same(int i, int j) {
        return root(i) == root(j);
    }
     
    bool unite(int i, int j) {
        int ri = root(i);
        int rj = root(j);
        if(ri!=rj) {
            uf[ri] += uf[rj];
            uf[rj] = ri;
            return true;
        }
        return false;
    }
     
    int size(int i) {
        return -uf[root(i)];
    }
};

int main() {
    int n, q;
    cin >> n >> q;
    unionfind uf(n);
    while(q--) {
        int c, x, y;
        cin >> c >> x >> y;
        if(c) {
            cout << (uf.same(x, y) ? 1 : 0) << endl;
        } else {
            uf.unite(x, y);
        }
    }
    return 0;
}


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

using namespace std;
#define rep(i,n) for(int i=0;i<(n);i++)

int main(int, char**)
{
    vector<int> a(10);
    rep(i,10) cin >> a[i];
    sort(a.begin(), a.end(), greater<int>());
    rep(i,3) cout << a[i] << endl;

    return 0;
}



Measured memory_bytes: 3148
#include<iostream>
#include<algorithm>

using namespace std;

int N;
int A[100000];
int dp[100000];
const int INF = 1145141919;

int main() {
	cin >> N;
	for (int i = 0; i < N; i++)cin >> A[i], dp[i] = INF;
	reverse(A, A + N);
	for (int i = 0; i < N; i++) {
		*upper_bound(dp, dp + N, A[i]) = A[i];
	}

	cout << (lower_bound(dp, dp + N, INF) - dp) << endl;
	return 0;
}

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

int main() {
  int n;
  cin >> n;
  int sum = 0;
  vector<int> a(n);
  for (int &ai : a) {
    cin >> ai;
    sum += ai;
  }
  int b = sum;
  for (int i = 1; i <= n - 2; i += 2)
    b -= a[i] * 2;
  cout << b << " ";
  for (int i = 1; i < n; ++i) {
    b = (a[i - 1] - b / 2) * 2;
    cout << b << " ";
  }
  return 0;
}

Measured memory_bytes: 1664
#include <iostream>
#include <cstdio>
#include <cstring>
#include <climits>
#include <string>
#include <algorithm>
#include <cmath>
#include <vector>
#include <stack>
#include <queue>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <sstream>
#include <numeric>
#include <iomanip>
// #include <boost/multiprecision/cpp_dec_float.hpp>
// #include <boost/multiprecision/cpp_int.hpp>

///////////////////////////////////////////////////////////////
// namespace
///////////////////////////////////////////////////////////////
using namespace std;
// namespace mp = boost::multiprecision;

///////////////////////////////////////////////////////////////
// types
///////////////////////////////////////////////////////////////
using ll = long long int;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
// using mpi = mp::cpp_int;
// using mpf = mp::number<mp::cpp_dec_float<1024>>;

///////////////////////////////////////////////////////////////
// mod https://qiita.com/drken/items/3b4fdf0a78e7a138cd9a
///////////////////////////////////////////////////////////////
// ll MOD = 1000000007;
//
//  ll mod(ll val) {
//      ll res = val % MOD;
//      if (res < 0) res += MOD;
//      return res;
//  }
//
// ll modinv(ll a) {
//     ll b = MOD, u = 1, v = 0;
//     while (b) {
//         ll t = a / b;
//         a -= t * b; swap(a, b);
//         u -= t * v; swap(u, v);
//     }
//     u %= MOD;
//     if (u < 0) u += MOD;
//     return u;
// }
//
// const int MAX = -1;
// ll fac[MAX], finv[MAX], inv[MAX];
// void com_init() {  // initialize nCk table with O(N)
//     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;
//     }
// }
// ll com(int n, int k){  // nCk
//     if (n < k) return 0;
//     if (n < 0 || k < 0) return 0;
//     return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
// }

const int N = 305;
int n;
int dist[N][N];
bool flag[N][N];


int main() {
    cin >> n;
    memset(flag, true, sizeof(flag));
    for (int i = 0; i < n; ++i) {
        for (int j = 0; j < n; ++j) {
            dist[i][j] = numeric_limits<int>::max();
            if (i == j) dist[i][j] = 0;
            cin >> dist[i][j];
        }
    }
    for (int k = 0; k < n; ++k) {
        for (int i = 0; i < n; ++i) {
            for (int j = 0; j < n; ++j) {
                if (dist[i][j] > dist[i][k] + dist[k][j]) {
                    cout << -1 << endl;
                    return 0;
                }
                if (i != k && k != j && dist[i][j] == dist[i][k] + dist[k][j]) {
                    flag[i][j] = false;
                }
            }
        }
    }
    ll ans = 0;
    for (int i = 0; i < n; ++i) {
        for (int j = i + 1; j < n; ++j)  {
            // cout << (int)(flag[i][j]) << "\t";
            if (flag[i][j]) ans += dist[i][j];
        }
        // cout << endl;
    }
    cout << ans << endl;
    // cout << setprecision(10);
    return 0;
}


Measured memory_bytes: 640
#include <bits/stdc++.h> //C++の標準ライブラリを一行で一括でインクルードする
#include <math.h> //数学関数と数学定数を利用する
#define rep(i,n) for (int i = 0; i < (n); i++)
using namespace std;
typedef long long ll;
template<class T> void chmax(T &a,T b) { if (a<b) a=b;}
template<class T> void chmin(T &a,T b) { if (a>b) a=b;}

int main(){
  int n;
  cin >> n;
  vector<int> c(n),s(n),f(n);
  rep(i,n-1){
    cin >> c[i] >> s[i] >> f[i];
  }
  c[n-1] = 0;
  s[n-1] = 0;
  f[n-1] = 1;
  
  for(int i = 0; i < n-1;i++){ //i駅の人出発
    int x = 0;
    x += s[i]; //開会式後の時間
    for(int j = i+1; j < n;j++){
      x += c[j-1]; //前の駅からの移動時間加算
      if(x < s[j]){ //もし辿りついた時間が最初の電車発車前だったら
        x = s[j]; //それまで待つ
      }
      
      while(x%f[j] != 0){ //次の電車まで待つ
        x++;
      }
    }
    cout << x << endl;
  }
  cout << 0 << endl;
  
  return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>

int main(void)
{
  long MOD = 1000000007;
  char s[100005];
  scanf("%s", s);
  long dp[100005][13];
  int n = strlen(s);
  dp[0][0] = 1;

  for(int i = 0; i < n; i++){
    int c;
    if(s[i] == '?')
      c = -1;
    else
      c = s[i] - '0';

    for(int j = 0; j < 10; j++){
      if(c != -1 && c != j)
        continue;
      for(int ki = 0; ki < 13; ki++)
        dp[i+1][(ki*10+j)%13] += dp[i][ki];
    }
    for(int j = 0; j < 13; j++)
      dp[i+1][j] %= MOD;
  }
  printf("%ld\n", dp[n][5]);
  return 0;
}


Measured memory_bytes: 10368
while True:
    (H,W) = [int(x) for x in input().split()]
    if H == W == 0:
     break

    for h in range(H):
     for w in range(W):
      if h == 0 or h == H - 1 or w == 0 or w == W - 1:
       print("#", end="")
       if w == W - 1:
        print()
        break
      else:
       print(".", end="")

    print()

Measured memory_bytes: 6808
#include<iostream>
#include<string>
#include<algorithm>
#include<functional>
#include<vector>
#include<set>
#include<queue>
#include<list>
#include<stdio.h>
#include<stdlib.h>
#include<map>
#include<cstdio>
#include <iomanip>

#define rep(i,b) for(int i=0;i<b;i++)
#define rrep(i,a,b) for(int i=a;i<=b;i++)
#define fore(i,a) for(auto &i:a)
#define all(x) (x).begin(),(x).end()

using namespace std;
typedef long long ll;

int main() {
	ll N, H; cin >> N >> H;

	vector<ll> a(N), b(N);

	for (int i = 0; i < N; i++) {
		cin >> a[i] >> b[i];
	}

	sort(a.begin(), a.end(), greater<ll>());
	sort(b.begin(), b.end(), greater<ll>());

	ll maxa = a[0];

	ll cnt = 0;
	for (int i = 0; i < N; i++) {
		if (b[i]>maxa) {
			H -= b[i];
			cnt++;
		}
		
		if (H <= 0) {
			break;
		}
	}

	if (H > 0) {
		cnt += (H + maxa - 1) / maxa;
	}
	

	cout << cnt << endl;

	return 0;
}

Measured memory_bytes: 1792
#![allow(
  non_snake_case,
  unused_variables,
  unused_assignments,
  unused_mut,
  unused_imports,
  dead_code
)]
//use proconio::fastout;
use proconio::input;
use proconio::marker::*;
//use std::collections::HashSet;
use std::cmp::*;
//use std::collections::VecDeque;

fn main() {
  input! {
    a:i128,b:i128,c:i128,d:i128
  }
  let mut ans = a*c;
  ans = max(ans, a*d);
  ans = max(ans, b*c);
  ans = max(ans, b*d);
  println!("{}", ans);
}


Measured memory_bytes: 2128
A = gets.to_i
B = gets.to_i
C = gets.to_i
X = gets.to_i

c = 0
(A + 1).times do |i|
  (B + 1).times do |j|
    (C + 1).times do |k|
      if i * 500 + j * 100 + k * 50 == X
        c += 1
      end
    end
  end
end
puts c

Measured memory_bytes: 1788
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
ll read(){
	ll a=0,b=getchar(),c=1;
	while(!isdigit(b))c=b=='-'?-1:1,b=getchar();
	while(isdigit(b))a=a*10+b-'0',b=getchar();
	return a*c;
}
int h,n,ab,ans=1e9,a[1005],b[1005],dp[20005];
int main(){
	h=read(),n=read();
	for(int i=0;i<n;i++)
		a[i]=read(),b[i]=read(),ab=max(ab,a[i]);
	memset(dp,0x3f,sizeof(dp));
	dp[0]=0;
	for(int i=0;i<n;i++)
		for(int j=a[i];j<h+ab;j++)
			dp[j]=min(dp[j],dp[j-a[i]]+b[i]);
	for(int i=h;i<h+ab;i++)
		ans=min(ans,dp[i]);
	cout << ans;
	return 0;
}

Measured memory_bytes: 384
//  Copyright © 2020 Diego Garcia Rodriguez del Campo. All rights reserved.
#include<bits/stdc++.h>
#define MAX 200005
#define optimiza_io cin.tie(0); ios_base::sync_with_stdio(0);
#define what_is(x) cerr << #x << " is " << x << endl;
using namespace std;
typedef long long ll;

ll A, B, C, N, ans;

int main()
{
    optimiza_io
    cin >> A >> B >> C >> N;
    if( N < A ) {
        cout << N << "\n";
        return 0;
    }
    N -= A;
    N -= B;
    ans = A;
    N = max( N , 0LL );
    cout << ans - N << "\n";
    return 0;
}

// CHECAR LIMITES 

Measured memory_bytes: 3612
#include <vector>
#include <queue>
#include <stack>
#include <algorithm>
#include <iostream>
#include <string>
#include <set>
#include <map>
#include <unordered_map>
#include <complex>
#include <iomanip>
#include <cmath>
#include <tuple>
using namespace std;

struct UnionFind {
    vector<int> parent;
    vector<int> treeSize;

    UnionFind(int n) : parent(n), treeSize(n) {
        for (int i = 0; i < n; i++) {
            parent[i] = i;
            treeSize[i] = 1;
        }
    }

    int root(int x) {
        if (parent[x] == x) return x;
        return parent[x] = root(parent[x]);
    }

    void unite(int x, int y) {
        int rootX = root(x);
        int rootY = root(y);
        if (rootX == rootY) return;
        treeSize[rootY] += treeSize[rootX];
        treeSize[rootX] = 0;
        parent[rootX] = rootY;
    }
};

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

    UnionFind tree(n);
    int a[m], b[m];
    for (int i = 0; i < m; i++) {
        cin >> a[i] >> b[i];
        --a[i], --b[i];
    }

    long long res[m];
    long long minus = 0;
    for (int i = m - 1; i >= 0; i--) {
        res[i] = (long long) n * (long long) (n - 1) / 2 - minus;

        int rootA = tree.root(a[i]);
        int rootB = tree.root(b[i]);

        if (rootA != rootB) minus += (long long) tree.treeSize[rootA] * (long long) tree.treeSize[rootB];
        tree.unite(a[i], b[i]);
    }

    for (int i = 0; i < m; i++) cout << res[i] << endl;
}


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

int main(void)
{
    int i,n,s[1000];
    double h,sum;
    
    while(1){
        scanf("%d",&n);
        if(!n) break;
        
        sum=0;
        h=0;
        
        for(i=0;i<n;i++){
            scanf("%d",&s[i]);
            sum += s[i];
        }
        
        sum /= n;
        
        for(i=0;i<n;i++){
        h += pow(s[i]-sum, 2.0);
    }
    
    h /= n;
    printf("%.8f\n",pow(h,1.0/2.0));
    }
    return 0;
}



Measured memory_bytes: 2048
x = []
i = 0

while True :
    a, op, b = input().split()
    c = int(a)
    d = int(b)
    
    if op == "?" :
        break
    
    if op == "+" :
        y = c + d
        x.append(y)
        i += 1
        
    if op == "-" :
        y = c - d
        x.append(y)
        i += 1
        
    if op == "*" :
        y = int(c * d)
        x.append(y)
        i += 1
        
    if op == "/" :
        y = int(c / d)
        x.append(y)
        i += 1
        
for j in range(0, i) :
    print(x[j])


Measured memory_bytes: 5596
#include<bits/stdc++.h>
 #include <ext/pb_ds/tree_policy.hpp>
 #include <ext/pb_ds/assoc_container.hpp>
 #include<chrono>
 using namespace std;
 using namespace std::chrono;      
 using namespace __gnu_pbds; 
 #define fastio     ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
 #define fi         first
 #define se         second
 #define int         long long 
 #define pb         push_back
 #define emp        emplace_back
 #define vv(x)      vector<x>
 #define mp(x,y)    map<x,y>
 #define dq(x)      deque<x>
 #define pql(x)     priority_queue<x>
 #define pqs(x)     priority_queue<x,vv(x),greater<x> >
 #define M          1000000007
 #define forf(i,a,b) for(int i=a;i<b;i++)
 #define it(x)      x::iterator
 #define ll         long long 
 #define debug(...) fprintf(stderr, __VA_ARGS__), fflush(stderr)
 #define time__(d)  for(long blockTime = 0; (blockTime == 0 ? (blockTime=clock()) != 0 : false); debug("%s time : %.4fs", d, (double)(clock() - blockTime) / CLOCKS_PER_SEC))
 #define vii        vector<int>
 #define big        3e18
 #define sm         -2e9
 #define mkr        make_pair
 #define vpi        vector<pair<int,int> >
 #define pii        pair<int,int>
 #define rng        500005
 #define sz(x)      (int)x.size()
 #define rv(x)      reverse(x.begin(),x.end())
 #define out(x)     cout<<x.fi<<" "<<x.se<<endl;

//#define ordered_set tree<pii, null_type,less<pii>, rb_tree_tag,tree_order_statistics_node_update> 
  
void pr_init()
{
   
    #ifndef ONLINE_JUDGE
    freopen("gin.txt", "r", stdin);
    freopen("gout.txt", "w", stdout);
   
    #endif
}


vector<vii> dp;
vector<vector<char> >mat;
void solve()
{
  
  int h,w;
  cin >> h >> w;  
  
  dp.assign(h+1,vii(w+1,0));
  mat.assign(h,vector<char>(w,'a'));
  dp[h-1][w-1] = 1;
  

  forf(i,0,h)
  {
    forf(j,0,w) cin >> mat[i][j];
  }


  for(int x = h-1;x>=0;x--)
  {
    for(int y = w-1;y>=0;y--)
    if(x!=h-1 || y!=w-1)
    {
      if(mat[x][y]=='#') dp[x][y] = 0;
      else dp[x][y] = dp[x+1][y] + dp[x][y+1] , dp[x][y]%=M;
    }
  }


  cout<<dp[0][0];

}


int32_t main()
{
  pr_init();
  //fastio;
  
  auto start = high_resolution_clock::now(); 
 
  solve();
  auto stop = high_resolution_clock::now();
  auto duration = duration_cast<microseconds>(stop - start); 
   // cout << "Time taken by function: "
   //       << duration.count() << " microseconds" << endl; 

 }
      
      

Measured memory_bytes: 12424
import sys
import math
import collections
import itertools
import array
import inspect

# Set max recursion limit
sys.setrecursionlimit(10000)

# Debug output
def chkprint(*args):
    names = {id(v):k for k,v in inspect.currentframe().f_back.f_locals.items()}
    print(', '.join(names.get(id(arg),'???')+' = '+repr(arg) for arg in args))

# Binary converter
def to_bin(x):
    return bin(x)[2:]

# --------------------------------------------

dp = None

def main():
    x = int(input())

    A = [1]
    for a in range(2, 100):
        for b in range(2, 10000):
            if a ** b <= 1000:
                A.append(a ** b)
            else:
                break

    print(sorted(filter(lambda a: a<=x, A))[-1])



main()


Measured memory_bytes: 4804
/*
    ThunderClap and Flash.
    Raunaq Singh
*/
#include <bits/stdc++.h> 
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll,ll> pll;
#define ThunderClap ios::sync_with_stdio(0),cin.tie(NULL),cout.tie(NULL);
#define debugg(something)   cout<<#something<<" - "<<something<<"\n";
#define vi vector
#define umap unordered_map
#define uset unordered_set
#define mset multiset
#define LB lower_bound
#define UB upper_bound
#define mp make_pair
#define pb push_back
#define in insert
#define s second
#define f first
#define pQueue priority_queue
#define maxElement *max_element
#define minElement *min_element
#define MAX 100000LL
#define mod 1000000007LL
#define inf 1000000000000000000LL
#define mI2 500000004LL
inline ll add(ll a, ll b){ return ((a%mod)+(b%mod))%mod;}
inline ll mul(ll a, ll b){ return ((a%mod)*(b%mod))%mod;}
inline ll sub(ll a, ll b){ return ((a%mod)-(b%mod)+mod)%mod;}

void Flash(){
    ll n,d,a;
    cin>>n>>d>>a;
    pll xh[n];
    for(ll i=0;i<n;i++){
        cin>>xh[i].f>>xh[i].s;
    }
    sort(xh,xh+n);
    ll x[n],h[n];
    ll dp[n+1]={};
    for(ll i=0;i<n;i++){
        x[i]=xh[i].f,h[i]=xh[i].s;
    }
    ll j;
    ll ans=0;
    ll bombsUsed;
    for(ll i=0;i<n;i++){
        dp[i+1]+=dp[i];
        h[i]+=(dp[i+1]);
        h[i]=max(h[i],0LL);
        j=(UB(x,x+n,x[i]+2*d)-x);
        bombsUsed=((h[i]/a) + ((h[i]%a)!=0));
        ans+=bombsUsed;
        dp[i+1]-=(bombsUsed*a);
        dp[j+1]+=(bombsUsed*a);
    }
    cout<<ans<<"\n";
}

int main(int argc, char const *argv[]){
    ThunderClap;
    ll t=1;
    //cin>>t;
    for(ll i=1;i<=t;i++){
        //cout<<"Case #"<<i<<": ";
        Flash();
    }
    return 0;
}

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

int main(){
  int s;
  cin>> s;
  
  string ans;
  bool front=1<=s/100 && s/100<=12;
  bool back=1<=s%100 && s%100<=12;
  if (front){
    if (back) ans="AMBIGUOUS";
    else ans="MMYY";
  }
  else{
    if (back) ans="YYMM";
    else ans="NA";
  }
  cout<< ans <<endl;
}

Measured memory_bytes: 256
function NotOne(arr){
   var cnt=[0,0,0,0,0,0,0,0,0,0];
   arr.forEach(function(v){cnt[(v-0)]++;});
   var bad=[];
   cnt.forEach(function(v,i){if(v>=2)bad.push(i);});
   var result=[];
   arr.forEach(function(v,i){if(bad.indexOf(v)!=-1)result.push(i);});
   return result;
}
var input = require('fs').readFileSync('/dev/stdin', 'utf8');
var Arr=input.trim().split("\n");
var STR="";
var n=Arr.shift()-0;
for(var I=0;I<n;I++){
   var yx=[];
   var YX=[];
   for(var i=0;i<9;i++){
      var v=Arr.shift().split(" ").map(Number);
      yx.push(v);
      YX.push([0,0,0,0,0,0,0,0,0]);
   }
   for(var i=0;i<9;i++){
      var re=NotOne(yx[i]);
      re.forEach(function(v){YX[i][v]++;});
   }
   for(var i=0;i<9;i++){
      var yy=[];
      for(var j=0;j<9;j++)yy.push(yx[j][i]);
      var re=NotOne(yy);
      re.forEach(function(v){YX[v][i]++;});
   }
   for(var y=0;y<3;y++){
      for(var x=0;x<3;x++){
         var z=[
         [0+y*3, 0+x*3], [0+y*3, 1+x*3], [0+y*3, 2+x*3],
         [1+y*3, 0+x*3], [1+y*3, 1+x*3], [1+y*3, 2+x*3],
         [2+y*3, 0+x*3], [2+y*3, 1+x*3], [2+y*3, 2+x*3]
         ];
         var zz=[];
         z.forEach(function(v){zz.push(yx[v[0]][v[1]]);});
         var re=NotOne(zz);
         re.forEach(function(v){YX[z[v][0]][z[v][1]]++;});
      }
   }
   yx.forEach(function(V,i){
      V.forEach(function(v,j){
         yx[i][j]=(YX[i][j]>=1)?"*"+v:" "+v;
      });
   });
   STR+=yx.join("\n").replace(/\,/g,"")+"\n\n";
}
console.log(STR.trim());

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

#ifndef DEBUG
#define endl '\n'
#define debug(...)
#else
#define debug(...) __VA_ARGS__
#endif
#define debugf(...) debug(printf(__VA_ARGS__);)

using ll = long long;
const int N = 2e5 + 5;
const ll mod = 1e9 + 7;

ll dp[N][2];

int n;
string l;
ll f(int i, bool anythingAllowed) {
    if (i == n)
        return 1;

    int aa = anythingAllowed;
    ll& ans = dp[i][aa];
    if (~ans) return ans;

    int digit = l[i] - '0';

    if (digit == 1)
        return ans = (2 * f(i+1, anythingAllowed) + f(i+1, true)) % mod;

    if (anythingAllowed)
        return ans = (2 * f(i+1, true) + f(i+1, true)) % mod;
    return ans = f(i+1, anythingAllowed);
}

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

    memset(dp, -1, sizeof(dp));

    cin >> l;
    n = l.size();

    cout << f(0, false) << endl;

    return 0;
%>

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

using namespace std;

template <typename _Ty>
ostream& operator << (ostream& ostr, const vector<_Ty>& v) {
    if (v.empty()) {
        ostr << "{ }";
        return ostr;
    }
    ostr << "{" << v.front();
    for (auto itr = ++v.begin(); itr != v.end(); itr++) {
        ostr << ", " << *itr;
    }
    ostr << "}";
    return ostr;
}

int main(void){

  int N;
  cin >> N;

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

  sort(d.begin(), d.end());
  int val = N/2;
  int k_min = d[val - 1];
  int k_max = d[val];

  int ans = 0;
  for (int i = k_min + 1; i <= k_max; i++){ans++;}

  cout << ans << endl;



  return 0;
}



Measured memory_bytes: 640
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define zero_pad(num) setfill('0') << std::right << setw(num)
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<int, int>;

int main() {
    int n;
    cin >> n;
    map<int, int> mp;
    rep(i, n){
        int a;
        cin >> a;
        mp[a]++;
    }
    int cnt = 0;
    for(auto itr = mp.begin(); itr != mp.end(); itr++){
        cnt += itr->second - 1;
    }
    int ans = n - (cnt + 1) / 2 * 2;
    cout << ans << endl;
}

Measured memory_bytes: 4992
#include<bits/stdc++.h>
using namespace std;
int main(){
    int a,b,c;
    cin>>a>>b>>c;
    if(a>b){
        swap(a,b);
    }
    if(b>c){
        swap(b,c);
    }
    if(a>b){
        swap(a,b);
    }
    cout<<a<<' '<<b<<' '<<c<<endl;
}


Measured memory_bytes: 3112
#include "bits/stdc++.h"
#define FOR(i, a, b) for (int i = a; i < b; i++)
#define mFOR(i, a, b) for (int i = a; i > b; i--)
#define MP make_pair
#define PB push_back
#define ALL(v) v.begin(), v.end()
#define N 100007
#define INF 1000000007 //10^9
using namespace std;

typedef long long ll;

ll gcd(ll a, ll b) { return b == 0 ? a : gcd(b, a % b); }
ll fceil(ll a, ll b) { return (a % b == 0 ? a / b : a / b + 1); }
int main()
{
   ll n, k, ans = 0;
   cin >> n >> k;
   ll h[n] = {};
   FOR(i, 0, n)
   cin >> h[i];

   sort(h, h + n);

   FOR(i,0,n-k)
      ans += h[i];

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


Measured memory_bytes: 1792
#include <map>
#include <set>
#include <list>
#include <cmath>
#include <queue>
#include <stack>
#include <cstdio>
#include <string>
#include <vector>
#include <complex>
#include <cstdlib>
#include <cstring>
#include <numeric>
#include <sstream>
#include <iostream>
#include <algorithm>
#include <functional>
  
#define mp       make_pair
#define pb       push_back
#define all(x)   (x).begin(),(x).end()
#define rep(i,n) for(int i=0;i<(n);i++)
  
using namespace std;
  
typedef    long long          ll;
typedef    unsigned long long ull;
typedef    vector<bool>       vb;
typedef    vector<int>        vi;
typedef    vector<vb>         vvb;
typedef    vector<vi>         vvi;
typedef    pair<int,int>      pii;
  
const int INF = (1LL << 31) - 1;
const double EPS = 1e-9;

struct SegmentTree {
    const int INF = (1LL << 31) - 1;
    vector<int> node;
    int n;
    SegmentTree(vector<int> a) {
        int n_ = a.size();
        n = 1;
        while(n < n_) n <<= 1;
        node.resize(2 * n - 1, INF);
        for(int i = 0; i < n_; i++) {
            node[n - 1 + i] = a[i];
        }
        for(int i = n - 2; i >= 0; i--) {
            node[i] = min(node[2 * i + 1], node[2 * i + 2]);
        }
    }
    void update(int i, int x) {
        i = n - 1 + i;
        node[i] = x;
        while(i > 0) {
            i = (i - 1) / 2;
            node[i] = min(node[i * 2 + 1], node[i * 2 + 2]);
        }
    }
    int find(int a, int b, int k = 0, int l = 0, int r = 0) {
        if (l == 0 && r == 0) r = n;
        if (r <= a || b <= l) return INF;
        if (a <= l && r <= b) return node[k];

        int vl = find(a, b, 2 * k + 1, l, (l + r) / 2);
        int vr = find(a, b, 2 * k + 2, (l + r) / 2, r);
        return min(vl, vr);
    }
};

int main() {
    int N, Q;
    cin >> N >> Q;
    vector<int> A(N, INF);
    SegmentTree seg(A);
    for (int q = 0; q < Q; q++) {
        int c, x, y;
        cin >> c >> x >> y;
        if (c == 0) {
            seg.update(x, y);
        } else {
            cout << seg.find(x, y + 1) << endl;
        }
    }

    return 0;
}

Measured memory_bytes: 4756
#include <stdio.h>

int main(void){
	int a,b,c;
	scanf("%d%d%d",&a,&b,&c);
	if((a == b && a != c) || (a == c && a != b) || (b==c && a != b)){
		printf("Yes\n");
	}else{
		printf("No\n");
	}
	
	return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
#define watch(x) cout << (#x) << " is " << (x) << endl
#define eps 1e-9

typedef long long ll;

using namespace std;

const ll inf = 1e18;
const ll mod = 1e9+7;
const int N = 1e5+5;
//int a[N];

int main()

{
    ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);

    int r;

    cin >> r;

    if (r < 1200) cout << "ABC";
    else if (r < 2800) cout << "ARC";
    else cout << "AGC";

    return 0;
}


Measured memory_bytes: 256
N=int(input())
room=[[[0]*10 for _ in range(3)] for _ in range(4)]

for _ in range(N):
    b,f,r,v=map(int,input().split())
    room[b-1][f-1][r-1]+=v

for i in range(4):
    for j in range(3):
        for k in range(10):
            print(" {}".format(room[i][j][k]), end="")
        print()
    if i!=3:
        print("####################")


Measured memory_bytes: 5628
# For taking integer inputs.
def inp():
    return(int(input()))


# For taking List inputs.
def inlist():
    return(list(map(int, input().split())))


# For taking string inputs. Actually it returns a List of Characters, instead of a string, which is easier to use in Python, because in Python, Strings are Immutable.
def instr():
    s = input()
    return(list(s[:len(s)]))


# For taking space seperated integer variable inputs.
def invr():
    return(map(int, input().split()))


N, L = invr()

A = []
for i in range(N):
    A.append(input())
A = sorted(A)

res = ""
for i in A:
    res += i
print(res)


Measured memory_bytes: 3064
import java.util.ArrayList;
import java.util.Comparator;
import java.util.List;
import java.util.Scanner;

public class Main {

    static Scanner sc = new Scanner(System.in);


    public static void main(String[] args) {
        List<Integer> a = new ArrayList<>();
        for (int i = 0; i < 3; i++) {
            a.add(sc.nextInt());
        }
        a.sort(Comparator.naturalOrder());
        int answer = 0;
        answer += a.get(1) - a.get(0);
        answer += a.get(2) - a.get(1);
        System.out.println(answer);
    }
}


Measured memory_bytes: 21588
#include<stdio.h>

int main(void){
    long int s,x,y;
    scanf("%ld",&s);

    if(s % 1000000000 == 0 ){
        y = s / 1000000000;
        x = 0;
    }else{
        y = s / 1000000000 + 1;
        x = y - s % 1000000000; 
    }
    x = 1000000000 * y - s;

    printf("0 0 1000000000 1 %ld %ld\n",x,y);
    
    return 0;

}

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

int main() {
	long long a, b;
	cin >> a >> b;
	if(a > 0) cout << "Positive\n";
	else if(a * b <= 0) cout << "Zero\n";
	else if((b-a) & 1) cout << "Positive\n";
	else cout << "Negative\n";
	return 0;
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using Console = System.Console;

namespace Atcoder
{
    class Program
    {
        static void Main(string[] args)
        {
            var r = Console.ReadLine().Split().Select(int.Parse).ToArray();
            var ret = Math.Min(r[3], r[1]) - Math.Max(r[2], r[0]);
            Console.WriteLine(ret < 0 ? 0 : ret);
        }
    }
}

Measured memory_bytes: 13396
#include<iostream>
#include<map>
#include<climits>
#include<ctime>
#include<cstring>
#include<numeric>

#include<algorithm>
#include<array>
#include<cmath>
#include<vector>

#define ALL(v) (v).begin(),(v).end()
#define REP(i,p,n) for(int i=p;i<(int)(n);++i)
#define rep(i,n) REP(i,0,n)
#define dump(a) (cerr << #a << "=" << (a) << endl)
#define DUMP(list) cout << "{ "; for(auto nth : list){ cout << nth << " "; } cout << "}" << endl;

using namespace std;

typedef double Real;
const Real EPS = 1e-8;
int sign(Real d) { return d > EPS ? 1 : d < -EPS ? -1 : 0; }

//define class ...

struct Point {
	Real x, y;
	Point(Real x_ = 0, Real y_ = 0):x(x_), y(y_) {}

	Point operator+(const Point &p) const {
		return Point(x + p.x, y + p.y);
	}

	Point operator-(const Point &p) const {
		return Point(x - p.x, y - p.y);
	}

	Point operator*(Real s) const {
		return Point(x * s, y * s);
	}

	Point operator/(Real s) const {
		return Point(x / s, y / s);
	}

	bool operator<(const Point &p) const {
		return sign(x - p.x) == -1 || (sign(x - p.x) == 0 && sign(y - p.y) == -1);
	}

	bool operator==(const Point &p) const {
		return sign(x - p.x) == 0 && sign(y - p.y) == 0;
	}
};

struct Line : public array<Point, 2> { //??????
	Line(const Point &a, const Point &b) { at(0) = a; at(1) = b; }
};

struct Segment : public array<Point, 2> { //??´???
	Segment(const Point &a, const Point &b) { at(0) = a; at(1) = b; }
};

struct Circle {
	Point c;
	Point r;
	Circle(const Point &c_, Real r_): c(c_), r(r_) {}
};

typedef vector<Point> Polygon;

// define function
Point rotate90(const Point &p) { // ???????¨???¨???
	return Point(-p.y, p.x);
}

Point rotate(const Point &p, Real theta) {
	const Real s = sin(theta), c = cos(theta);
	return Point(c * p.x - s * p.y, s * p.x + c * p.y);
}

Real angle(const Point &p) {
	return atan2(p.y, p.x);
}

Real norm(const Point &p) {
	return p.x * p.x + p.y * p.y;
}

Real abs(const Point &p) {
	return sqrt(norm(p));
}

Real dot(const Point &a, const Point &b) { // ??????
	return a.x * b.x + a.y * b.y;
}

Real cross(const Point &a, const Point &b) { // ??????
	return a.x * b.y - a.y * b.x;
}

// define app function

bool is_parallel(const Line &a, const Line &b) {
	return sign( cross(a[1] - a[0], b[1] - b[0]) ) == 0; 
}

bool is_orthogonal(const Line &a, const Line &b) {
	return sign( dot(a[1] - a[0], b[1] - b[0]) ) == 0; 
}

int main() {
	int n;
	cin >> n;
	
	vector<Point> p(4, Point(0, 0));	
	rep(i, n) {
		rep(j, 4) {
			cin >> p[j].x >> p[j].y;
		}
		
		int ans = 0;
		const Line a(p[0], p[1]), b(p[2], p[3]);
		if(is_parallel(a, b)) {
			ans = 2;
		}
		else if(is_orthogonal(a, b)) {
			ans = 1;
		}
		else {
			ans = 0;
		}
		cout << ans << endl;
	}
	return 0;
}

Measured memory_bytes: 1240
#include <iostream>
#include <iomanip> 
#include <string> 
#include <math.h>

using namespace std;

int main() {
	int a, b,c;
	cin >> a >> b >> c;
	if (a < b && b < c)
		cout << "Yes\n";
	else cout << "No\n";
}

Measured memory_bytes: 1124
using System;
using System.Collections.Generic;
using System.Linq;

namespace ziyuutyou
{
    class Program
    {
        static void Main(string[] args)
        {
            List<int> a = new List<int>() { 1, 3, 5, 7, 8, 10,  12 };
            List<int> b = new List<int>() { 4, 6, 9, 11 };
            List<int> c = new List<int>() { 2 };

            var number = Array.ConvertAll(Console.ReadLine().Split(' '), int.Parse);

            if ((a.Contains(number[1]) && a.Contains(number[0])) || (b.Contains(number[1]) && b.Contains(number[0])) || (c.Contains(number[1]) && c.Contains(number[0])))
            {
                Console.WriteLine("Yes");
            }
            else
            {
                Console.WriteLine("No");
            }

        }
    }
}


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

int main() {
    string s;
    cin >> s;
    int n = s.size() - 2;
    int ans = 1000;
    for (int i = 0; i < n; ++i) {
        string ss = s.substr(i, 3);
        int num = stoi(ss);
        ans = min(ans, abs(753 - num));
    }
    cout << ans << endl;
}

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

int main() {
  int N,K,count = 0;
  cin >> N >> K;
  vector<int> vec(N);
  for(int i = 0; i < N; i++){
    cin >> vec[i];
  }
  sort(vec.begin(), vec.end());
  reverse(vec.begin(), vec.end());
  for(int i = 0; i < N; i++){
    if(vec[i] >= K){
      count ++;
    }
  }
  cout << count <<endl;
}


Measured memory_bytes: 640
# -*- coding: utf-8 -*-

def main():
    x,y = [int(s) for s in input().split()]
    # groups
    g1 = [1,3,5,7,8,10,12]
    g2 = [4,6,9,11]
    g3 = [2]

    res = False
    for g in (g1,g2,g3):
        # if in the same group
        if x in g and y in g:
            res = True

    if res: print('Yes')
    else: print('No')

if __name__ == '__main__':
    main()


Measured memory_bytes: 3060
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace mondai0005
{
	class Program
	{
		static void Main(string[] args)
		{
			while( true ) {
				var	ss	= Console.ReadLine();
				if( ss == null ) {
					break;
				}
				var	s	= ss.Split();
				var	a	= long.Parse( s[ 0 ] );
				var	b	= long.Parse( s[ 1 ] );
			
				long	gcd	= get_gcd( a, b );
				long	lcm	= (a * b) / gcd;
				Console.WriteLine( gcd + " " + lcm );
			}
		}

		
		// 最大公約数（ユーグリッドの互除法）
		static long get_gcd( long a, long b )
		{
			long	r;
			while( (r = a % b) != 0 ) {
				a = b;
				b = r;
			}
			return( b );
		}
	}
}

Measured memory_bytes: 5624
def is_Prime(i):
    if i == 2:
        return True
    if i % 2 == 0 or i == 1:
        return False
    s = int(i ** (1 / 2))
    while True:
        if s == 1:
            return True
        if i % s == 0:
            return False
        s -= 1

def prime_factorize(n):
    ans = []
    for i in range(2, int(n ** (1 / 2)) + 1):
        while True:
            if not n % i == 0:
                break
            ans.append(i)
            n /= i
        if n == 1:
            break
    if n != 1:
        ans.append(int(n))
    return ans

n = int(input())
if n == 1:
    print(0)
    exit()
s = prime_factorize(n)
x = s[0]
t = []
c = 0
for i in s:
    if i == x:
        c += 1
    else:
        t.append(c)
        c = 1
        x = i
t.append(c)
ans = 0
for i in t:
    j = 1
    while True:
        if i - j < 0:
            break
        i -= j
        j += 1
        ans += 1
print(ans)

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

int main()
{
	string str;
	cin >> str;
	if(str.size()==2)
		cout << str;
	
	if(str.size()==3)
	{
		for(int i=str.size()-1;i>=0;i--)
			cout << str[i];
	}
	cout << endl;
	return 0;
}

Measured memory_bytes: 256
s = list(input())
s = [int(i) for i in s]
ans1, ans2 = 0, 0
for i in range(len(s)):
    if i % 2 == 1:
        if s[i] == 1:
            ans1 += 1
        else:
            ans2 += 1
    else:
        if s[i] == 1:
            ans2 += 1
        else:
            ans1 += 1
print(min(ans1, ans2))


Measured memory_bytes: 4652
#include<bits/stdc++.h>
using namespace std;
const int INF= 1e9 + 5;
int main()
{
    int n,x,i,j,c1,c2,k;
    cin>>n;
    cin>>k;
    vector<int>h;
    for(i=0;i<n;i++)
    {
        cin>>x;
        h.push_back(x);
    }
    vector<int>dp(n,INF);
    dp[0]=0;
    for(i=0;i<n;i++)
    {
        for(j=i+1;j<=i+k;j++)
        {
            if(j<n)
            {
                dp[j]=min(dp[j],dp[i]+abs(h[i]-h[j]));
            }
        }
    }
    cout<<dp[n-1]<<endl;

}


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

int main(){
    string s;
    cin >> s;
    if(s[0] == 'S'){
        cout << "Cloudy" << endl;
    }
    
    if(s[0] == 'C'){
        cout << "Rainy" << endl;
    }
    
    if(s[0] == 'R'){
        cout << "Sunny" << endl;
    }
    return 0;
}

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

typedef long long LL;

#define REP(i, n) for(int i = 0; i < (int)(n); i++)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define ALL(x) (x).begin(),(x).end()
const int IINF = 1e9;
const LL LINF = 1e18;
const LL mod = 1e9+7;

int main() {
    vector<vector<int>> A(3, vector<int>(3));
    REP(i, 3) {
        REP(j, 3) {
            cin >> A[i][j];
        }
    }

    int N;
    cin >> N;
    REP(i, N) {
        int b;
        cin >> b;
        REP(j, 3) {
            REP(k, 3) {
                if(A[j][k] == b) {
                    A[j][k] = -1;
                }
            }
        }
    }

    REP(i, 3) {
        bool hori = true;
        bool ver = true;
        REP(j, 3) {
            hori = hori && A[i][j] == -1;
            ver = ver && A[j][i] == -1;
        }
        if(hori || ver) {
            cout << "Yes" << endl;
            return 0;
        }
    }

    bool up = true;
    bool down = true;
    REP(i, 3) {
        up = up && A[i][i] == -1;
        down = down && A[i][2 - i] == -1;
    }
    if(up || down) {
        cout << "Yes" << endl;
        return 0;
    }
    cout << "No" << endl;
    return 0;
}



Measured memory_bytes: 256
package main

import "fmt"

func main() {
	var a, b, c, x, y int
	fmt.Scan(&a, &b, &c, &x, &y)

	n := min(x, y)

	ans := min(
		a*x+b*y,
		min(
			c*2*max(x, y),
			(c*2*n)+(a*(x-n))+(b*(y-n)),
		),
	)

	fmt.Println(ans)
}

func min(a, b int) int {
	if a < b {
		return a
	}
	return b
}

func max(a, b int) int {
	if a > b {
		return a
	}
	return b
}


Measured memory_bytes: 512
#include <stdio.h>
#include <string.h>
#pragma warning(disable : 4996)

int main()
{

    long long a, b, x;
    long long count = 0;

    scanf("%lld %lld %lld", &a, &b, &x);

    long long ai = a / x;
    long long bi = b / x;

    long long start, goal;

    if (ai * x == a)
        start = ai;
    else
        start = ai + 1;

    goal = bi;

    printf("%lld", goal - start + 1);


    return 0;

}

Measured memory_bytes: 2132
#include "bits/stdc++.h"
using namespace std;
#define INF 1000000000
#define rep(i, n) for(int i = 0; i < n; i++)
#define ALL(x) (x).begin(), (x).end()  //昇順
#define RALL(x) (x).rbegin(), (x).rend() // 降順
const long long mod = 1e9+7;
typedef priority_queue<int> PQ;
typedef vector<long long> VL;
typedef vector<int> VI;  // VI a(n);
typedef vector<string> VS;  
typedef vector<char> VC; 
typedef vector<VS> VSS;
typedef vector<VC> VCC;    
typedef vector<VI> VVI;   // VVI a(n,vector<int>(m)) n * m 
typedef vector<VL> VVL;
typedef pair<int, int> PII;
typedef map<int, int> MP;   //MP a;
typedef vector<pair<int, int> > PS;
typedef long long ll;  //ll とdoubleは違う
template <class T>  // chmax(max, a);
bool chmax(T &a, const T &b)
{
    if (a < b)
    {
        a = b;
        return 1;
    }
    return 0;
}
template <class T> //chmin(min,a)
bool chmin(T &a, const T &b)
{
    if (b < a)
    {
        a = b;
        return 1;
    }
    return 0;
}
template<typename T>   // operator << (cout,a);
ostream& operator << (ostream& os, vector<T>& v) {
    os << "{";
    rep(i, (int)v.size()) { os << v[i] << (i < v.size() - 1 ? ", " : ""); }
    os << "}";
    return os;
}

int main(){
    ll x,y,n,m,h,k,max=-10000000,min=2020202021,ans=0,sum=0,left=0,right=0;
    string s,t;
    cin >> n;
    VL a(n);
    rep(i,n){
        cin >> a[i];
	}
    left += a[0];
    for(int j=1;j<n;j++){
        right += a[j];
    }
    for(int i=1;i<n;i++){
        if(min > abs(left-right))
            min = abs(left-right);
        left += a[i];
        right -= a[i];
    }
    
    cout << min << endl;
    return 0;
}

Measured memory_bytes: 1792
#include <iostream>
using namespace std;
int main(void){
    string s;
    cin >> s ;
    int l = s.length();
    int check = 1;
    int i;
    int count0=0;
    int count1=0;
    for(i=0;i<l;i++)
    {
        if(s[i] == '0')
        {
            count0++;
        }
        else
        {
            count1++;
        }
    }
    cout << 2*min(count0,count1)<<endl;
}

Measured memory_bytes: 512
#include <iostream>
#include <iomanip>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <vector>
#include <algorithm>
#define lli long long int
#define lower(a) transform(a.begin(),a.end(),a.begin(),::tolower);


using namespace std;

const int N = 3e5 + 500;
const long long mod = 1e9 + 7;
const long long INF = 1LL << 57;
const int M = 1e6 + 500;

void solve()
{
    lli n;
    cin>>n;
    map<string, lli> x;
    while(n --)
    {
        string s;
        cin>>s;
        sort(s.begin(), s.end());
        x[s] ++;
    }
    lli ans = 0;
    for(auto it : x)
    {
        ans += (it.second * (it.second - 1)) / 2;
    }
    cout<<ans;
    return ;
}
/*
10
6
10 3 2 5 7 8
*/
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);

    lli t;
    t = 1;
//    cin>>t;
    while(t --)
    {
        solve();
    }
    return 0;
}


Measured memory_bytes: 11264
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll maxn=1e5+9;
ll arr[maxn];
ll sum[maxn];
ll sz[maxn];
ll n,k;
int main(){
        ll a,b,c,d,e,f,g,h;
        ios::sync_with_stdio(0);
        ll k,s;
        while(cin>>a>>b>>e>>f){
                for(int i=0;i<f-b;i++){
                        cout<<'U';
                }
                for(int i=0;i<e-a;i++){
                        cout<<'R';
                }
                for(int i=0;i<f-b;i++){
                        cout<<'D';
                }
                for(int i=0;i<e-a;i++){
                        cout<<'L';
                }
                cout<<'L';
                for(int i=0;i<=f-b;i++){
                        cout<<'U';
                }
                for(int i=0;i<=e-a;i++){
                        cout<<'R';
                }
                cout<<'D';
                cout<<'R';
                for(int i=0;i<=f-b;i++){
                        cout<<'D';
                }
                for(int i=0;i<=e-a;i++){
                        cout<<'L';
                }
                cout<<'U'<<endl;

        }
        return 0;
}


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

#define int long long

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


signed main(void) {
  int num; // num
  num = 0; // count, result
  // num = numeric_limits<int>::min(); // max
  num = numeric_limits<int>::max(); // min
  int N;
  // int M;
  array<int, 100000> A;
  string S;
  // string T;
  int T;

  cin >> S;

  if (S.length() == 2) {
    cout << S << endl;
  } else {
    cout << S[2] << S[1] << S[0] << endl;
  }

  return 0;
}


Measured memory_bytes: 764
n=int(input())
cnt=0
lst=[0,0,0]
while n!=0:
    lst[cnt]=n%10
    n=n//10
    cnt+=1
if lst[2]>lst[1]:
    for i in range(cnt):
        print(lst[2],end="")
elif  lst[2]==lst[1]:
    if lst[1]>=lst[0]:
        for i in range(cnt):
            print(lst[2], end="")
    else:
        for i in range(cnt):
            print(lst[2]+1, end="")
else:
    for i in range(cnt):
        print(lst[2]+1,end="")

Measured memory_bytes: 3064
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
using namespace std;
using int64 = long long;

int main()
{
  int n;
  cin >> n;
  int count = 1 << n;
  vector<int64> s(count);
  
  for (int i = 0; i < count; ++i)
  {
    cin >> s[i];
  }
  sort(s.begin(), s.end(), greater<int64>());
  
  vector<int64> parent;
  parent.push_back(s[0]);
  for (int t = 0; t < n; ++t)
  {
    vector<int64> currentParent(parent);
    int pi = 0;
    int psize = currentParent.size();
    for (int i = 1; (i < count) && (pi < psize); ++i)
    {
      if (s[i] == -1) continue;
      if (s[i] < currentParent[pi])
      {
        parent.push_back(s[i]);
        s[i] = -1;
        ++pi;
      }
    }
    if (pi < psize)
    {
      cout << "No" << endl;
      return 0;
    }
    sort(parent.begin(), parent.end(), greater<int64>());
  }
  cout << "Yes" << endl;
  return 0;
}


Measured memory_bytes: 5484
#include<iostream>
#include<iomanip>
#include<math.h>
#include<algorithm>
#include<utility>
#include<functional>
#include<queue>
#include<string.h>
#include<string>
#include<set>
#include<map>
#include<vector>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
const ll INF=2e18;

ll N,M,K,C;
string a,b,c,d;
string s;
int main(){
    cin>>a>>b>>c;
    if(a[a.length()-1]==b[0] && b[b.length()-1]==c[0]){
        cout<<"YES"<<endl;
    }else{
        cout<<"NO"<<endl;
    }
    
    return 0;
}

Measured memory_bytes: 764
#include <bits/stdc++.h>
using namespace std;
int main(){
	int a[2];
	cin>>a[0];
	cin>>a[1];
	cin>>a[2];
	if (a[0]==a[1]){
		cout<<a[2];
	}
	if (a[0]==a[2]){
		cout<<a[1];
	}
	if (a[1]==a[2]){
		cout<<a[0];
	}
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll mod = 1000000007;
const int INF = INT_MAX / 2;

int main(){
    int N, K; cin >> N >> K;
    set<int> s;
    for (int i = 0; i < K; i++)
    {
        int d; cin >> d;
        s.insert(d);
    }
    
    int ans;
    for (int i = N; i < 1000000; i++)
    {
        string t = to_string(i);
        bool flag = true;
        for(char c: t){
            int ci = c - '0';
            if(s.count(ci)){
                flag = false;
                break;
            } 
        }
        if(flag){
            ans = i;
            break;
        } 
    }
    cout << ans << endl;
    
}

Measured memory_bytes: 256
#include <stdio.h>

int main(int argc, const char * argv[]) {
    int a, b, d, r;
    double f;
    
    scanf("%d %d", &a, &b);
    
    d = a / b;
    r = a % b;
    f = a * 1.0 / b * 1.0;
    
    printf("%d %d %lf\n", d, r, f);
    
    return 0;
}


Measured memory_bytes: 2108