akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
#define MAX 2000000
#define MOD 1000000007

int main(){
  int N,K;
  cin>>N>>K;
  vector<int> a(N);
  for(int i=0;i<N;i++){
    cin>>a.at(i);
  }
  sort(a.begin(),a.end());

  vector<int> G_number(K+1,0);
  for(int i=1;i<=K;i++){
    int g=0;
    for(int j=0;j<N;j++){
      if(i-a.at(j)<0){
        continue;
      }
      if(G_number.at(i-a.at(j))==0){
        g=1;
        break;
      }
    }
    G_number.at(i)=g;
  }

  if(G_number.at(K)==1){
    cout<<"First"<<endl;
  }else{
    cout<<"Second"<<endl;
  }
}


Measured memory_bytes: 768
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll INF = 1LL << 60;
ll MOD = 1000000000 + 7;

int main() {
    ll k, a, b;
    cin >> k >> a >> b;
    ll ans = 0;
    if (a >= b - 1) {
        ans = k + 1;
    } else {
        k -= a - 1;
        ans = a;
        ans += (b - a) * (k / 2);
        if (k % 2) ans++;
    }
    cout << ans << endl;
    return 0;
}

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

void solve()
{
  ll a,b,c,k;
  cin >> a >> b >> c >> k;
  ll sum=min(a,k);
  k-=min(a,k);
  k-=min(b,k);
  sum-=k;
  cout << sum << endl;

}

int main ()
{
      
     int t;
     t=1;//cin >> t;
     for (int tt=1;tt<=t;tt++)
     {
         solve();

     }

    return 0;
     
     
     
     
 }


Measured memory_bytes: 3576
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Random;
import java.util.Scanner;
import java.util.TreeMap;
 class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner s=new Scanner(System.in);
		int n=s.nextInt();
		int b;
		int minsum=Integer.MAX_VALUE;
		for(int a=1;a<=n/2;a++){
			b=n-a;
			int tempa=a;
			//System.out.println("ere");
			int suma=0;
			int sumb=0;
			while(tempa>0){
				suma+=tempa%10;
				tempa/=10;
			}
			while(b>0){
				sumb+=b%10;
				b/=10;
			}
			if(suma+sumb<minsum){
				//System.out.println(a+" "+sumb);
				minsum=suma+sumb;
			}
		}
		System.out.println(minsum);
	}
}

Measured memory_bytes: 23124
#include <stdio.h>
int main(){
	int i,sum,N;
	char S[100000];
	scanf("%d",&N);
	sum = N;
	scanf("%s",S);
	for(i = 0;i < N;i++){
		if(S[i] == S[i + 1])sum--; 
	}
	printf("%d",sum);
	return 0;
}

Measured memory_bytes: 256
/// sultanov

#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
     
#define x first
#define y second
#define pb push_back
#define sz(x) (int) x.size()
 
using namespace std;
using namespace __gnu_pbds;
                                                          
template<typename T> 
using ordered_set = tree<T, null_type,   
less<T>, rb_tree_tag,
tree_order_statistics_node_update>;

using ll = long long;
using pii = pair<int, int>;                                   

const int INF32 = 1e9 + 1e2;

vector<int> top, was;

vector<vector<int>> adj;

void topsort(int x) {
    was[x] = true;
    for (int to : adj[x])
        if (!was[to])
            topsort(to);
    top.pb(x);
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    int n, m;
    cin >> n >> m;
    adj.resize(n);
    for (int u, v; m--;) {
        cin >> u >> v;
        u--, v--;
        adj[u].pb(v);
    }   
    was.resize(n, false);
    for (int i = 0; i < n; i++)
        if (!was[i])    
            topsort(i);
    reverse(top.begin(), top.end());
    was.assign(n, false);
    vector<int> dp(n);
    for (int x : top) {
        was[x] = true; 
        for (int to : adj[x])
            if (!was[to]) 
                dp[to] = max(dp[to], dp[x] + 1);
    }   
    int ans = 0;
    for (int i = 0; i < n; i++)
        ans = max(ans, dp[i]);
    cout << ans;        
    return false;                                                       
}


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

using namespace std;

#ifdef DEBUG_MODE
	#define DBG(n) n;
#else
	#define DBG(n) ;
#endif
#define REP(i,n) for(ll (i) = (0);(i) < (n);++i)
#define PB push_back
#define MP make_pair
#define FI first
#define SE second
#define SHOW1d(v,n) {for(int W = 0;W < (n);W++)cerr << v[W] << ' ';cerr << endl << endl;}
#define SHOW2d(v,i,j) {for(int aaa = 0;aaa < i;aaa++){for(int bbb = 0;bbb < j;bbb++)cerr << v[aaa][bbb] << ' ';cerr << endl;}cerr << endl;}
#define ALL(v) v.begin(),v.end()
#define Decimal fixed<<setprecision(20)
#define INF 1000000000
#define LLINF 1000000000000000000LL
#define MOD 1000000007

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

int mp[666][666];
int sum[666][666];
int sum1[666][666];

int main(){

	int h,w;cin >> h >> w;
	REP(i,h){
		REP(j,w){
			char tmp;cin >> tmp;
			if(tmp == '#'){
				mp[i+j][h-i+j] = 1;
				sum[i+j][h-i+j] = 1;
				sum1[i+j][h-i+j] = 1;
			}
		}
	}

	REP(i,666){
		REP(j,666){
			if(j < 665)sum[i][j+1] += sum[i][j];
			if(i < 665)sum1[i+1][j] += sum1[i][j];
		}
	}
	ll ans = 0;

	REP(i,666){
		vector<int> v;
		REP(j,666){
			if(mp[i][j]){
				REP(k,v.size()){
					int tmp = j - v[k];
					if(i - tmp >= 0){
						ans += sum[i-tmp][j] - sum[i-tmp][j-tmp-1];
					}
					if(i + tmp < 666){
						ans += sum[i+tmp][j] - sum[i+tmp][j-tmp-1];
					}
				}
				v.PB(j);
			}
		}
	}

	REP(j,666){
		vector<int> v;
		REP(i,666){
			if(mp[i][j]){
				REP(k,v.size()){
					int tmp = i - v[k];
					if(j - tmp >= 0){
						ans += sum1[i-1][j-tmp] - sum1[i-tmp][j-tmp];
					}
					if(j + tmp < 666){
						ans += sum1[i-1][j+tmp] - sum1[i-tmp][j+tmp];
					}
				}
				v.PB(i);
			}
		}
	}

	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 5248
#include <iostream>
#include <fstream>
#include <vector>
#include <cstring>
#include <algorithm> // sort
#include <math.h> // sort

#define REP(i, n) for (long long i = 0; i < (n); i++) 
typedef long long ll;
static const ll MOD = 1000000007;
static const ll INF = 1000000000000000000LL;
using namespace std;

int main(){
    //std::ifstream in("input.txt");
    //std::cin.rdbuf(in.rdbuf());
    string n;
    cin >> n;
    string res = "No";

    if(n[0] == n[2])
    {
        res = "Yes";
    }

    cout << res << endl;
    return 0;    
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
#define FOR(i,k,n) for(int i=(k);i<(int)(n);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(x) begin(x),end(x)

using namespace std;

struct Node {
  int op;
  vector<int> children;
  uint8_t state;
};

void dfs(vector<Node> &nodes, int i, uint8_t state = 0) {
  switch (nodes[i].op) {
    case 0:
      state = 0;
      break;
    case 1:
      state |= 3;
      break;
    case 2:
      state |= 5;
      break;
    case 3:
      state &= 3;
      break;
    case 4:
      state &= 5;
      break;
    case 5:
      state ^= 3;
      break;
    case 6:
      state ^= 5;
      break;
  }
  nodes[i].state = state;
  for (int ch : nodes[i].children) {
    dfs(nodes, ch, state);
  }
}

bool solve(const vector<Node> &nodes, int i, uint8_t state, bool player) {
  if (nodes[i].children.empty()) {
    bool valid = (1 << nodes[i].state) & state;
    return valid == player;
  }
  for (int ch : nodes[i].children) {
    if (!solve(nodes, ch, state, !player)) return true;
  }
  return false;
}

int main() {
  int n,m;
  cin>>n>>m;
  vector<Node> nodes(n);
  nodes[0].op = 0;
  REP(i,n-1) {
    string s;
    cin>>s;
    s = s.substr(3);
    if (s == "|X") {
      nodes[i+1].op = 1;
    } else if (s == "|Y") {
      nodes[i+1].op = 2;
    } else if (s == "&X") {
      nodes[i+1].op = 3;
    } else if (s == "&Y") {
      nodes[i+1].op = 4;
    } else if (s == "^X") {
      nodes[i+1].op = 5;
    } else {
      nodes[i+1].op = 6;
    }
  }
  REP(i,n-1) {
    int u,v;
    cin>>u>>v;
    nodes[u].children.push_back(v);
  }
  dfs(nodes, 0);
  vector<bool> vcan(1<<8);
  REP(i,1<<8) {
    vcan[i] = solve(nodes, 0, i, true);
  }
  REP(i,m) {
    int x,y;
    cin>>x>>y;
    vector<pair<int,int>> vp;
    REP(j,8) {
      int val = 0;
      if ((j>>2)&1) val |= y&~x;
      if ((j>>1)&1) val |= x&~y;
      if (j&1) val |= x&y;
      vp.emplace_back(val, j);
    }
    sort(ALL(vp));
    int mx = 0;
    REP(j,1<<8) {
      if (!vcan[j]) continue;
      REP(k,8) {
        if ((j >> vp[k].second) & 1) {
          mx = max(mx, vp[k].first);
          break;
        }
      }
    }
    cout << mx << endl;
  }
  return 0;
}

Measured memory_bytes: 14504
#[allow(unused_macros)]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}
 
#[allow(unused_macros)]
macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};
 
    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
 
    ($next:expr, mut $var:ident : $t:tt $($r:tt)*) => {
        let mut $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}
 
#[allow(unused_macros)]
macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };
 
    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };
 
    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };
 
    ($next:expr, bytes) => {
        read_value!($next, String).into_bytes()
    };
 
    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };
 
    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

fn main() {
   input! {
       n: u32,
       a: u32,
       b: u32,
   } 

   if b > a * n {
       println!("{}", a*n);
   } else {
       println!("{}", b);
   }
}


Measured memory_bytes: 4352
import math

n, m = map(int, input().split())


def combinations_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))


if m >= 2:
    odd = combinations_count(m, 2)
elif m == 0 or m == 1:
    odd = 0

if n >= 2:
    even = combinations_count(n, 2)
elif n == 1:
    even = 1
elif n == 0:
    even = 0

answer = odd + even
if m == 1 and n == 1:
    answer = 0

print(answer)


Measured memory_bytes: 3064
#include<cstdio>
#include<cmath>
#include<iostream>
#include<algorithm>
#include<cstring>
#include<cstdlib>
#include<queue>
#include<map>
#include<stack>
#include<set>
#include<vector>
#include<functional>
using namespace std;
typedef long long LL;
inline long long read()
{
	long long kk=0,f=1;
	char cc=getchar();
	while(cc<'0'||cc>'9'){if(cc=='-')f=-1;cc=getchar();}
	while(cc>='0'&&cc<='9'){kk=(kk<<1)+(kk<<3)+cc-'0';cc=getchar();}
	return kk*f;
}
int main()
{
	int a,b,c;a=read();b=read();c=read();
	LL k=b+min(a+b+1,c);
	printf("%lld\n",k);
}

Measured memory_bytes: 256
/*** author: yuji9511 ***/
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using lpair = pair<ll, ll>;
const ll MOD = 1e9+7;
const ll INF = 1e18;
#define rep(i,m,n) for(ll i=(m);i<(n);i++)
#define rrep(i,m,n) for(ll i=(m);i>=(n);i--)
#define printa(x,n) for(ll i=0;i<n;i++){cout<<(x[i])<<" \n"[i==n-1];};
void print() {}
template <class H,class... T>
void print(H&& h, T&&... t){cout<<h<<" \n"[sizeof...(t)==0];print(forward<T>(t)...);}

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll N,M;
    cin >> N >> M;
    ll A[110];
    rep(i,0,N) cin >> A[i];
    ll sum = 0;
    rep(i,0,N) sum += A[i];
    sort(A, A+N, greater<ll>());
    bool ok = true;
    rep(i,0,M){
        if(4 * M * A[i] < sum) ok = false;
    }
    if(ok){
        print("Yes");
    }else{
        print("No");
    }
    

}

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

int main()
{
    int a,b,c,s,k,t;
    cin>>a>>b>>c;
    cin>>k;
    s=a>=b?a:b;
    t=s>=c?s:c;
    int sum;
    int d;
    d=pow(2,k);
    sum=a+b+c+d*t-t;
    cout<<sum<<endl;
    return 0;
}


Measured memory_bytes: 512
#include <cstdio>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <iostream>
#include <bitset>
#include <deque>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <vector>
#include <algorithm>
#include <iterator>
#include <string>
const int INF = 1000000009;

long n;
long a[100005];
long dif1[100005];//[i]: iからi+1
long dif2[100005];//i-1からi+1

int main(){
	scanf("%ld", &n);
	for(int i = 1; i <= n; i++){
		scanf("%ld", &a[i]);
		dif1[i-1] = std::abs(a[i] - a[i-1]);
		if(i > 1){
			dif2[i-1] = std::abs(a[i-2] - a[i]);
		}
	}
	dif1[n] = std::abs(a[n]);
	dif2[n] = std::abs(a[n+1] - a[n-1]);
	long ans = 0;
	for(int i = 0; i <= n; i++){
		ans += dif1[i];
	}
	for(int i = 1; i <= n; i++){
		printf("%ld\n", ans - (dif1[i-1] + dif1[i] - dif2[i]));
	}
	return 0;
}


Measured memory_bytes: 3712
import math
n = int(input())
lis = []
for i in range(2,math.ceil(math.sqrt(n))+1):
    cnt = 0
    while n % i == 0:
        n //= i
        cnt += 1
    if cnt:lis.append(cnt)
if n != 1:
    lis.append(1)
ans = 0

if lis == []:
    if n == 1:
        print(0)
        exit()
    else:
        print(1)
        exit()
for num in lis:
    go = 1
    while num >= go:
        ans += 1
        num -= go
        go += 1
print(ans)


Measured memory_bytes: 9208
#include <stdio.h>
#include <string.h>
#include <limits.h>
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <map>

#ifndef U_L_LONG
typedef unsigned long long U_L_LONG;
#endif
#ifndef L_LONG
typedef long long L_LONG;
#endif


static void ABC115D_Christmas();

#if 1
int main()
{
	ABC115D_Christmas();

	fflush(stdout);
	return 0;
}
#endif


class ABC115D_Burger
{
public:
	L_LONG _bun = 0;
	L_LONG _patty = 0;
	L_LONG _total = 0;
	L_LONG _center = 0;
};


static L_LONG ABC115D_getPatty(ABC115D_Burger* bgr, int lv, L_LONG eatCount)
{
	L_LONG eatenPatty = 0;

	if (lv == 0) {
		return ((eatCount > 0) ? 1 : 0);
	}
	
	if (eatCount == bgr[lv]._center) {
		eatenPatty = ((bgr[lv]._patty - 1) / 2) + 1;
	}
	else {
		if (eatCount > bgr[lv]._center) {
			//	半分までの分は計算を済ませておく
			eatenPatty = ((bgr[lv]._patty - 1) / 2) + 1;
			eatCount -= ((bgr[lv]._total - 1) / 2) + 1;
		}
		else {
			eatCount--;	//	バン1枚分
		}
		if (eatCount > 0) {
			eatenPatty += ABC115D_getPatty(bgr, lv - 1, eatCount);
		}
	}

	return eatenPatty;
}

static void ABC115D_Christmas()
{
	int N;
	L_LONG X;

	scanf(" %d %lld", &N, &X);

	ABC115D_Burger bgr[51];

	bgr[0]._patty = 1;
	for (int lv = 1; lv <= N; lv++) {
		bgr[lv]._bun = (bgr[lv - 1]._bun * 2) + 2;
		bgr[lv]._patty = (bgr[lv - 1]._patty * 2) + 1;
		bgr[lv]._total = bgr[lv]._patty + bgr[lv]._bun;
		bgr[lv]._center = ((bgr[lv]._total - 1) / 2) + 1;
	}

	printf("%lld\n", ABC115D_getPatty(bgr, N, X));
}


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

#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

#define sf scanf
#define pf printf
#define pb push_back
#define mp make_pair
#define PI ( acos(-1.0) )
#define mod 1000000007
#define IN freopen("testing.txt","r",stdin)
#define OUT freopen("output.txt","w",stdout)
#define FOR(i,a,b) for(i=a ; i<=b ; i++)
#define DBG pf("Hi\n")
#define INF 1000000000000000000LL
#define i64 long long int
#define eps (1e-8)
#define xx first
#define yy second
#define ln 17
#define off 2

using namespace __gnu_pbds;
using namespace std ;

typedef pair<pair<i64, i64>,int> pi ;
typedef tree< pi, null_type, less<pi>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;

#define maxn 100005

int dp[302][302][302] , n ;

vector <pair< int,int > > q[305] ;

int f( int i , int r, int g, int b )
{
    if( dp[r][g][b]!=-1 ) return dp[r][g][b] ;
    for(int j=0; j<q[i].size(); j++)
    {
        int ret = 0;
        if( r>=q[i][j].xx ) ret++ ;
        if( g>=q[i][j].xx ) ret++ ;
        if( b>=q[i][j].xx ) ret++ ;
        if( ret!=q[i][j].yy ) return dp[r][g][b] = 0 ;
    }
    if( i==n ) return dp[r][g][b] = 1 ;

    i++ ;
    int ret = f( i , i , g , b ) + f( i , r , i , b ) ;
    if( ret >= mod ) ret -= mod ;
    ret += f(i,r,g,i) ;
    if( ret >= mod ) ret -= mod ;
    return dp[r][g][b] = ret ;
}

int main()
{
    memset(dp,-1,sizeof(dp)) ;

    int i , j , k ,l , m ;

    scanf("%d %d",&n,&m) ;

    for(i=1 ;i<=m ; i++)
    {
        int u ,v , c ;
        scanf("%d %d %d",&u,&v,&c) ;
        q[v].pb(mp(u,c)) ;
    }

    int ans = f(0,0,0,0) ;

    printf("%d\n",ans) ;

    return 0 ;
}


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


/* エイリアス */
#define ll long long
#define ld long double
#define vi vector<int>
#define vll vector<ll>
#define pii pair<int,int>
#define pll pair<ll,ll>
#define vpi vector<pii>
#define vpll vector<pll>
#define endl '\n'

#define fi first
#define se second
#define pb push_back
#define eb emplace_back
#define em emplace


/* 関数マクロ */
#define rep(i, n) for (ll i = 0; i < n; ++i)
#define rep2(i, n, m) for (ll i = n; i <= m; ++i)
#define rep3(i, n, m) for (ll i = n; i >= m; --i)
#define all(v) v.begin(), v.end()
#define si(v) int(v.size())
#define UNIQUE(v) sort(all(v)), v.erase(unique(all(v)),v.end())


/* 定数 */
const ll mod = 1e9 + 7;
const ll infll = (1LL << 62) - 1;
const ll inf = (1LL << 30) - 1;


/* その他 */
template<class S, class T> inline bool chmax(S &a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class S, class T> inline bool chmin(S &a, T b) { if (a > b) { a = b; return 1; } return 0; }
template<class T> using pq = priority_queue<T>;
template<class T> using pqg = priority_queue<T, vector<T>, greater<T>>;


signed main()
{
  ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  cout << fixed << setprecision(15);
  
  string s; cin >> s;
  if (s[1] == 'B') cout << "ARC" << endl;
  else cout << "ABC" << endl;
}

Measured memory_bytes: 3600
#include <stdio.h>
int binarySearch(int A[],int key,int n){
  int i=0;
  int right=n,left=0;
  int mid;

  while(right>left){
    mid = (right + left)/2;
    if(A[mid]==key)return 1;
    else if(key<A[mid])right = mid;
    else left = mid + 1;
  }
  return 0;
}
int main() {
  int n,q,S[100000],T[50000],i,key,count=0;
  scanf("%d",&n);
  for(i=0;i<n;i++)scanf("%d",&S[i]);
  scanf("%d",&q);
  for(i=0;i<q;i++) {
    scanf("%d",&key);
    count += binarySearch(S,key,n);
  }
  printf("%d\n",count);
  return 0;
}



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

int main(){
    ll N, A, B; cin >> N >> A >> B;
    ll ans = N / (A+B)*A;
    ll ram = N % (A+B);
    cout << ans+min(A, ram) << endl;

}


Measured memory_bytes: 384
n = int(input())
S = []
for i in range(n):
    s = input()
    S.append(s)
S.sort()
A = list(set(S))
A.sort()
#print(A)
#print(S)
NUM =[0]*len(A)
j = 0
for i in range(len(S)):
    if(i+1<len(S)):
        if (S[i] == S[int(i)+1]):
            NUM[j] = NUM[j]+ 1
        else:
            j += 1
import numpy as np
b = np.argmax(NUM)
#print(NUM,b)
for e,i in enumerate(NUM):
    #print(NUM[b])
    if (i == NUM[b]):
        print(A[e])

Measured memory_bytes: 32500
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <set>
#include <cmath>
#include <cstring>
#include <iomanip>
#include <random>
#include <chrono>
#include <queue>
using namespace std;
typedef long long ll;
typedef pair<int, int> PII;
typedef pair<ll, ll> PLL;
#define INF 1000000000
#define MOD 1000000007
#define EPS 0.00000001



int gcd(int a, int b){
    
    while(b){
        int r = b;
        b = a%b;
        a = r;
    }
    
    return a;
}

int main(){
    int N; cin >> N;
    vector<int> A(N);
    for(int i=0; i<N; i++){
        cin >> A[i];
    }
    
    int g = gcd(A[0], A[1]);
    for(int i=2; i<N; i++){
        g = gcd(g, A[i]);
    }
    
    cout << g << endl;
    return 0;
}


Measured memory_bytes: 640
#include<stdio.h>
 
int haruna[102][102];
int paruru[102],akane[102];
int t=0,n;
 
int dfs(int x)
{
  t++;
  int i;
  for(i=1;i<=n;i++)
    {
      if(paruru[x]==0)
	{
	  paruru[x] = t;
	}     
      if(haruna[x][i]==1 && akane[i]==0)
	{
	  haruna[x][i]=0;
	  if(paruru[i]==0)
	    {
	      dfs(i);
	      t++;
	    }
	}
      if(i==n && akane[x]==0)
	{
	  akane[x] = t+1;
	}
    }
  return 0;
}
 
int main(void)
{
  scanf("%d", &n);
  int i,j;
  for(i=1;i<=n;i++)
    {
      for(j=1;j<=n;j++)
	{
	  haruna[i][j] = 0;
	}
      paruru[i]=0;
      akane[i]=0;
    }
 
  int u,k;
  for(i=0;i<n;i++)
    {
      scanf("%d %d", &u,&k);
      for(j=0;j<k;j++)
	{
	  int v;
	  scanf("%d", &v);
	  haruna[u][v] = 1;
	}
    }
 
  for(i=1;i<=n;i++)
    {
      if(akane[i]==0)
	{
	  dfs(i);
	  t++;
	}
    }
  for(i=1;i<=n;i++)
    {
      printf("%d %d %d\n", i, paruru[i], akane[i]);
    }
  return 0;
}

Measured memory_bytes: 636
#include<bits/stdc++.h>
 
using namespace std;
 
#define int1(a) scanf("%d",&a)
#define int2(a,b) scanf("%d %d",&a,&b)
#define int3(a,b,c) scanf("%d %d %d",&a,&b,&c)
#define int4(a,b,c,d) scanf("%d %d %d %d",&a,&b,&c,&d)
 
#define lint1(a) scanf("%lld",&a)
#define lint2(a,b) scanf("%lld %lld",&a,&b)
#define lint3(a,b,c) scanf("%lld %lld %lld",&a,&b,&c)
#define lint4(a,b,c,d) scanf("%lld %lld %lld %lld",&a,&b,&c,&d)
#define lli long long int
 
#define pint(x) printf("%d",x)
#define plint(x) printf("%lld",x)
#define endl '\n'
#define nl printf("\n");
#define ps printf(" "); 
 
#define all(x) x.begin(),x.end()
#define pb push_back
#define Set(a, s) memset(a, s, sizeof (a))
#define mod1 (lli)(1e9 + 7)
#define mod2 (lli)(1e9 + 9)
#define EPS 1e-9
 
#define fore(i,n) for(int i=n; i>=0; i--)
#define fors(i,a,n) for(int i=a; i<n; i++)
#define fora(i,ele) for(auto i: ele)
 
#define trace1(x)                cerr<<#x<<": "<<x<<endl
#define trace2(x, y)             cerr<<#x<<": "<<x<<" | "<<#y<<": "<<y<<endl
#define trace3(x, y, z)          cerr<<#x<<":" <<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl
 
typedef vector<int> vi;
typedef vector<string> vs;
typedef pair<int,int> pii;
typedef vector<lli> vli;
 
template< class T > T gcd(T a, T b) { return (b != 0 ? gcd<T>(b, a%b) : a); }
template< class T > T lcm(T a, T b) { return (a / gcd<T>(a, b) * b); }
 
double tick(){static clock_t oldt,newt=clock();double diff=1.0*(newt-oldt)/CLOCKS_PER_SEC;oldt=newt;return diff;}
float roundoff(float val, float p){ return floor(val*pow(10.0,p)+0.5)/pow(10.0,p);}
lli power(lli a, lli b, lli mod){lli x=1,y=a; while(b > 0){if(b&1){x=(x*y)%mod;}y = (y*y)%mod; b /= 2;}return x;}
 
const int INF = 0x3f3f3f3f;
const float pi = 3.14159265;
 
//int dx[]={1,1,0,-1,-1,-1,0,1};int dy[]={0,1,1,1,0,-1,-1,-1};
//int dx[]={1,-1,0,0}; int dy[]={0,0,1,-1};
 
int main(void) {
    ios_base::sync_with_stdio(true);
    cin.tie(NULL);
    cout.tie(NULL);
	//srand (time(NULL));
	/*
    freopen("input.txt","r",stdin);
    freopen("output.txt","w",stdout);
	*/
    // cout<<"Execution time : "<<tick()<<"\n";
    
   lli n;
   lint1(n);
   
   cout<<((n*(n-1))/2);
	
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
using P = pair<int,int>;
/* ちゃんと考えてわかって実装 */

bool is_sgs(int x){
    map<int, int> mp;
    while(x){
        int d = x%10;
        mp[d]++;
        x /= 10;
    }
    if(mp[3] > 0 && mp[5] > 0 && mp[7] > 0){
        return true;
    }
    else{
        return false;
    }
}

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

    queue<int> sgs;
    sgs.push(3);
    sgs.push(5);
    sgs.push(7);

    int cnt = 0;
    int flag = 1;
    while(flag){
        int tmp = sgs.front();
        sgs.pop();
        if(tmp <= n){
            if(is_sgs(tmp)){
                cnt++;
            }
            sgs.push(tmp*10 + 3);
            sgs.push(tmp*10 + 5);
            sgs.push(tmp*10 + 7);
        }
        else{
            flag = 0;
        }
    }

    cout << cnt << endl;
    return 0;
}

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

#define int long long

#define CHOOSE(a) CHOOSE2 a
#define CHOOSE2(a0,a1,a2,a3,x,...) x
#define REP1(i, s, cond, cal) for (signed i = signed(s); i cond; i cal)
#define REP2(i, s, n) REP1(i, s, < signed(n), ++)
#define REP3(i, n) REP2(i, 0, n)
#define rep(...) CHOOSE((__VA_ARGS__,REP1,REP2,REP3))(__VA_ARGS__)
#define rrep(i, s) rep(i, s, >= 0, --)

#define all(c) begin(c), end(c)
template<typename T>bool maxup(T& a, T&& b) { if (a < b) { a = b; return true; }; }
template<typename T>bool maxup(T& a, T& b) { if (a < b) { a = b; return true; }; }
template<typename T>bool minup(T& a, T&& b) { if (a > b) { a = b; return true; }; }
template<typename T>bool minup(T& a, T& b) { if (a > b) { a = b; return true; }; }

#define X first
#define Y second

using VV = vector<vector<int>>;
using V = vector<int>;
using P = pair<int, int>;
using IP = pair<int, P>;

template<typename T>
inline void input(vector<T>& v) { for (auto& x : v) cin >> x; }

signed main() {
	int x; cin >> x;
	int k = x / 11;
	cout << k * 2 + (x - k * 11 != 0) + (x - k * 11 > 6) << endl;
	system("pause");
}

Measured memory_bytes: 504
#include <iostream>
#include <sstream>
#include <fstream>
#include <ctime>
#include <cstdlib>
#include <cstring>
#include <cctype>
#include <string>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <cmath>
#include <algorithm>
#include <functional>
#include <numeric>

using namespace std;
template<typename T> ostream& operator<<(ostream& os, const vector<T>& v){
    os << "{ ";
    for(typename vector<T>::const_iterator it=v.begin(); it!=v.end(); ++it)
        os << '\"' << *it << '\"' << (it+1==v.end() ? "" : ", ");
    os << " }";
    return os;
}

typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<bool> vb;
typedef vector<vb> vvb;
#define vv(type,w,h,init) vector<vector<type>>(h,vector<type>(w,init))
typedef vector<string> vs;
typedef long long ll;
typedef unsigned uint;
typedef unsigned long ul;
typedef unsigned long long ull;

#define all(c) (c).begin(), (c).end()
#define rall(c) (c).rbegin(), (c).rend()
#define loop(i,a,b) for(int i=(a); i<(int)(b); i++)
#define rep(i,b) loop(i,0,b)
#define pb push_back
#define mp make_pair

string const resstr[] = {"Impossible","Possible","No","Yes"};

int main(){
    int n; cin >> n;
    rep(i,n){
        string a,b;
        cin >> a >> b;
        reverse(all(a));
        reverse(all(b));
        if(b.size()<a.size())swap(a,b);
        b += "0";
        rep(i,b.size()-1){
            int aa = i < (int)a.size() ? a[i] - '0' : 0;
            int bb = b[i] - '0';
            int cc = aa + bb;
            b[i] = (cc%10) + '0';
            //cout << aa << "+" << bb << "=" << cc << endl;
            if(cc >= 10){
                b[i+1]++;
            }
        }
        if(b[b.size()-1] == '0')
            b = string(b.begin(), b.end()-1);
        reverse(b.begin(), b.end());
        if(b.size() > 80)
            cout << "overflow" << endl;
        else cout << b << endl;
    }
    return 0;
}
    

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

using namespace std;
#define int  long long
 
#define I32_MAX 2147483647
#define I64_MAX 9223372036854775807LL
#define I64_MAX2 1223372036854775807LL
#define INF I64_MAX2
#define MOD 1000000007
#define MEM_SIZE 10000
#define DEBUG_OUT true
#define ALL(x) (x).begin(),(x).end()
// int DP[MEM_SIZE][MEM_SIZE] = {0};
// int GMEM[MEM_SIZE][MEM_SIZE] = {0};
template<typename T> void DEBUG(T e){if(DEBUG_OUT == false)return; std::cout << e << std::endl;}
template<typename T> void DEBUG(const std::vector<T>& v){if(DEBUG_OUT == false)return;for(const auto& e : v){std::cout<< e << " "; } std::cout << std::endl;}
template<typename T> void DEBUG(const std::vector<std::vector<T> >& vv){if(DEBUG_OUT == false)return;for(const auto& v : vv){ DEBUG(v); } }
template<class T,class X> void DEBUG(X d, T e){if(DEBUG_OUT == false)return;std::cout <<d<<" ";DEBUG(e);};
template <class T> void corner(bool flg, T hoge) {if (flg) {cout << hoge << endl; exit(0);}}
template< typename T1, typename T2 > inline bool chmax(T1 &a, T2 b) { return a < b && (a = b, true); }
template< typename T1, typename T2 > inline bool chmin(T1 &a, T2 b) { return a > b && (a = b, true); }
template< typename T > using matrix = vector< vector< T > >;

//FUNCTION  


void solve(void)
{
  int N;
  cin>>N;
  map<int,int> mp;
  for (int i = 0; i < N; i++)
  {
    int A;
    cin>>A;
    mp[A]++;
  }
  int ANS = 1;
  for (int i = 0; i < mp.size(); i++)
  {
    static auto itr = mp.begin();
    int A = itr->first;
    int B = itr->second;
    if( A == 0)
    if(N%2 == 1){
      if(B == 2) ANS = 0;
    }
    else
    {
      if(B == 1) ANS = 0;
    }
    else
    {
      if(B != 2) ANS = 0;
      else ANS *= 2;
      ANS %= MOD;
    }
    
    itr++;

    
  }
  cout<<ANS<<endl;
  
  
  
  return;
}

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

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

  return 0;
}


Measured memory_bytes: 4224
/*input
axyb
abyxb
*/
#include<bits/stdc++.h>
using namespace std;

#define int long long 
#define double long double
#define f first
#define s second
#define mp make_pair
#define pb push_back
#define RE(i,n) for (int i = 1; i <= n; i++)
#define RED(i,n) for (int i = n; i > 0; i--)
#define REPS(i,n) for(int i = 1; (i*i) <= n; i++)
#define REP(i,n) for (int i = 0; i < n; i++)
#define FOR(i,a,b) for (int i = a; i < b; i++)
#define REPD(i,n) for (int i = n-1; i >= 0; i--)
#define FORD(i,a,b) for (int i = a; i >= b; i--)
#define remax(a,b) a = max(a,b)
#define remin(a,b) a = min(a,b)
#define all(v) v.begin(),v.end()
#define pii pair<int,int>
#define mii map<int,int>
#define vi vector<int>
#define vvi vector<vi>
#define WL(t) while(t --)
#define gcd(a,b) __gcd((a),(b))
#define lcm(a,b) ((a)*(b))/gcd((a),(b))
#define print(arr) for (auto it = arr.begin(); it != arr.end(); ++it) cout << *it << " "; cout << endl;
#define debug(x) cout << x << endl;
#define debug2(x,y) cout << x << " " << y << endl;
#define debug3(x,y,z) cout << x << " " << y << " " << z << endl;
const int INF = 1e18+1;
const int MOD = 1e9+7;
const double PI = 3.14159265358979323846264338;

int fast_ex(int a,int n,int m){
  if(n == 0)return 1;
  if(n == 1)return a;
  int x = 1;
    x *= fast_ex(a,n/2,m);
    x %= m;
    x *= x;
    x %= m;
    if(n%2)x*= a;
    x %= m;
    return x;
}

const int N = 3001;

int dp[N][N];

int n,m;
string s,t;

void solve(){
	 cin >> s >> t;
	 n = s.size();
	 m = t.size();
	 dp[0][0] = 0;
   //lcs[0][0] = "";
	 RE(i,n){
	 	RE(j,m){
	 		dp[i][j] = max(dp[i-1][j],dp[i][j-1]);
      //if(dp[i][j] == dp[i-1][j])lcs[i][j] = lcs[i-1][j];
      //else lcs[i][j] = lcs[i][j-1];
	 		if(s[i-1] == t[j-1]){
        dp[i][j] = max(dp[i][j],dp[i-1][j-1]+1);
       // if(dp[i][j] == dp[i-1][j-1]+1)lcs[i][j] = lcs[i-1][j-1]+s[i-1];
      }

	 	}
	 }
   string ans = "";
   int x = n;
   int y = m;
   while(x > 0 && m > 0){
        if(dp[x][y] == dp[x-1][y])x--;
        else if(dp[x][y] == dp[x][y-1])y--;
        else{
           ans += s[x-1];
           x--;y--;
        }
   }
   reverse(all(ans));
	 cout << ans;
}

signed main(){
  ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
  //freopen(".in","r",stdin);freopen(".out","w",stdout);
  int t = 1;//cin >> t;
  WL(t)solve();
  return 0;
}

Measured memory_bytes: 70656
N= gets.to_i
blocks = gets.split.map(&:to_i)
if !blocks.include?(1)
  puts -1
  exit
end

i = 0
num = 1
count = 0
while i < N
  val = blocks.shift
  if val == num
    num += 1
  else
    count += 1
  end
  i += 1
end
puts count


Measured memory_bytes: 17284
#import<vector>
#import<set>
#import<cstdio>
using namespace std;int main(){long long H,W;int N,h,w,h0,w0,z,t;scanf("%lld%lld%d",&H,&W,&N);vector<long long>v(10);set<pair<int,int>>se;v[0]=(H-2)*(W-2);for(;N--;)for(scanf("%d%d",&h,&w),h--,w--,se.emplace(h,w),h0=-2;++h0<2;)for(w0=-2;++w0<2;)if(1<=h+h0&&h+h0<H-1 && 1<=w+w0&&w+w0<W-1){for(t=z=0;z<9;z++)t+=se.find({h+h0+z/3-1,w+w0+z%3-1})!=se.end();v[t-1]--,v[t]++;}for(auto &e:v)printf("%lld\n",e);}

Measured memory_bytes: 4864
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{
    int n,W;
    cin>>n>>W;
    int w[n+1],v[n+1];
    for(int i=1;i<=n;i++)
    cin>>w[i]>>v[i];
    ll dp[n+1][W+1];
    for(int i=0;i<=n;i++)
    {
        for(int j=0;j<=W;j++)
        {
            if(i==0 || w==0)
            dp[i][j]=0;
            else if(w[i]<=j)
            dp[i][j]=max(dp[i-1][j],v[i]+dp[i-1][j-w[i]]);
            else
            dp[i][j]=dp[i-1][j];
        }
    }
    cout<<dp[n][W]<<"\n";
    return 0;
}

Measured memory_bytes: 79104
using System;

namespace A___Something_on_It
{
    class Program
    {
        static void Main(string[] args)
        {
            var s = Console.ReadLine();
            var sum = 700;
            for(var i=0; i<3; i++)
            {
                if(s.Substring(i,1)== "o")
                {
                    sum += 100;
                }
            }
            Console.WriteLine(sum);
        }
    }
}

Measured memory_bytes: 13140
import java.util.Scanner;

public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    
    for(int i=0;i<10000;i++){
        int n = sc.nextInt();
        if(n==0){
            break;
        } else {
            System.out.println("Case "+(i+1)+": " + n);
        }
    }

    sc.close();
  }
}



Measured memory_bytes: 41512
#include<cstdio>
#include<iostream>
#include<vector>
#include<queue>
#include<bitset>
#include<string>
#include<stack>
#include<set>
#include<map>
#include<cstring>
#include<complex>
#include<cmath>
#include<algorithm>
#include<list>
#include<functional>
#define _USE_MATH_DEFINES
#define X first
#define Y second
#define INF 1987654321
#define PI 3.14159265358979323846264
#define MOD 1000000007
#define fup(i,a,b,c) for(int (i)=(a);(i)<=(b);(i)+=(c))
#define fdn(i,a,b,c) for(int (i)=(a);(i)>=(b);(i)-=(c))
#define MEM0(a) memset(a,0,sizeof(a));
#define MEM_1(a) memset(a,-1,sizeof(a));
using namespace std;
typedef long long ll;
typedef unsigned int uint;
typedef unsigned long long ull;
typedef pair<int, int> Pi;
typedef pair<ll, ll> Pll;
typedef pair<double, double> Pd;
typedef vector<int> Vi;
typedef vector<ll> Vll;
typedef vector<double> Vd;
typedef vector<Pi> VPi;
typedef vector<Pll> VPll;
typedef vector<Pd> VPd;
typedef complex<double> base;
char s[100001];
int main() {
	scanf("%s", s);
	int n = strlen(s);
	fup(i,1,n-1,1)
		if (s[i] == s[i - 1])
		{
			printf("%d %d", i, i + 1);
			return 0;
		}
	fup(i, 2, n - 1, 1)
		if (s[i] == s[i - 2])
		{
			printf("%d %d", i-1, i + 1);
			return 0;
		}
	printf("-1 -1");
}

Measured memory_bytes: 384
import bisect
import cmath
import heapq
import itertools
import math
import operator
import os
import re
import string
import sys
from collections import Counter, deque, defaultdict
from copy import deepcopy
from decimal import Decimal
from fractions import gcd
from functools import lru_cache, reduce
from operator import itemgetter, mul, add, xor

import numpy as np

if os.getenv("LOCAL"):
    sys.stdin = open("_in.txt", "r")

sys.setrecursionlimit(10 ** 9)
INF = float("inf")
IINF = 10 ** 18
MOD = 10 ** 9 + 7
# MOD = 998244353

N = int(sys.stdin.buffer.readline())
S, T = sys.stdin.buffer.readline().decode().rstrip().split()
for c, d in zip(S, T):
    print(c + d, end='')
print()


Measured memory_bytes: 13592
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <map>

using namespace std;


int main()
{
	int N, X;

	cin >> N >> X;

	vector<int> dis = vector<int>(N, 0);

	int x;
	int min_dis = 1000000001;
	for (int xi = 0; xi < N; xi++) {
		cin >> x;
		dis[xi] = abs(X - x);
		min_dis = min(min_dis, dis[xi]);
	}

	int ans = min_dis;
	int div = 1;
	while(1){
		int flag = 1;
		for (int di = 0; di < N; di++) {
			if (dis[di] % ans != 0) {
				flag = 0;
				break;
			}
		}
		if (flag == 1) break;

		div++;
		while (min_dis % div != 0) {
			div++;
			if (div >= ans) {
				ans = 1;
				break;
			}
		}

		if (ans == 1) break;

		ans = min_dis / div;
	}

	printf("%d",ans);


	return 0;
}



Measured memory_bytes: 640
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<utility>
#include<set>
#include<stack>
#include<list>
#include<deque>
#include<bitset>
#include<iomanip>
#include<cstring>
#include<sstream>
#include<cstdio>
#include<cstdlib>
#include<climits>
#include<cmath>
#include<cctype>


#define pb push_back
#define mp make_pair
#define rep(i,a,b) for(int i=a;i<=b;i++)
#define ren(i,a,b) for(int i=a;i>=b;i--)
#define ff first
#define ss second
#define pll pair<long long int,long long int>
#define pii pair<int,int>
#define vll vector<long long int>
#define vii vector<int>
#define gi(n) scanf("%d",&n)
#define gll(n) scanf("%lld",&n)
#define gstr(n) scanf("%s",n)
#define gl(n) cin >> n
#define oi(n) printf("%d",n)
#define oll(n) printf("%lld",n)
#define ostr(n) printf("%s",n)
#define ol(n) cout << n
#define os cout<<" "
#define on cout<<"\n"
#define o2(a,b) cout<<a<<" "<<b
#define all(n) n.begin(),n.end()
#define present(s,x) (s.find(x) != s.end())
#define cpresent(s,x) (find(all(s),x) != s.end())
#define tr(container, it) for(__typeof(container.begin()) it = container.begin(); it != container.end(); it++)
using namespace std;

typedef unsigned long long int ull;
typedef long long int ll;
typedef long double ld;
typedef vector<vector<ll> > mat;


int main()
{ios_base::sync_with_stdio(false);
int n;
cin>>n;
string s[105];
int t[105];
int ans=0;
rep(i,0,n-1)
{
	cin>>s[i]>>t[i];
	ans+=t[i];
}
string w;
cin>>w;
rep(i,0,n-1)
{
	ans-=t[i];
	if(s[i]==w)break;
}
ol(ans);
return 0;
}



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

#define fast                          \
    ios_base::sync_with_stdio(false); \
    cin.tie(0);                       \
    cout.tie(0);

#define ll long long
#define ld long double
#define pb push_back
#define mkpr make_pair
#define fi(i,a,b) for (int i=a;i<b;i++)
#define vll vector<ll>
#define vch vector<char>
#define vst vector<string>
#define vpll vector<pll>
#define vii vector<int>
#define vvl vector<vector<ll>>
#define rev(v) reverse(v.begin(),v.end())
#define srt(v) sort(v.begin(),v.end())
#define rsrt(v) sort(v.rbegin(), v.rend())
#define mxe(v) *max_element(v.begin(),v.end())
#define pii pair<int, int>
#define pll pair<ll, ll>
#define ff first
#define ss second
#define mll map<ll, ll>
#define gcd(a, b) __gcd(a, b)
#define lcm(a, b) ((a)*1ll * (b)) / gcd(a, b)
#define nl "\n"
#define sp " "
#define sz(x)  (int)x.size()

using namespace std;

double PI = (acos(-1));
ll md = 1000000007;
//ll md = 998244353;

int min (int a,int b){if(a>=b)return b;else return a;}
ll pw(ll a, ll b){ll c=1,m=a;while (b){if (b&1)c=(c*m);m=(m*m);b/=2;}return c;}
ll pwmd(ll a, ll b){ll c = 1, m = a;while (b){if (b & 1)c = ((c * m)) % md;m = (m * m) % md;b /= 2;}return c;}
ll modinv(ll n){return pwmd(n, md - 2);}
ll nc2(ll n){return (1ll * n * (n - 1)) / 2;}
ll nsum(ll n){return (1ll * n * (n + 1)) / 2;}
bool prime(ll a){for(int i=2;i*i<=a;i++){if(a%i==0)return false;}return true;}

#define MAX_SIZE 1005
/*void Sieve(vector<int> &primes){bool IsPrime[MAX_SIZE];memset(IsPrime, true, sizeof(IsPrime));
for (int p = 2; p * p < MAX_SIZE; p++){if (IsPrime[p] == true){
			for (int i = p * p; i < MAX_SIZE; i += p)IsPrime[i] = false;}}
	for (int p = 2; p < MAX_SIZE; p++)if (IsPrime[p])primes.push_back(p);}
        */


//vector<char> sml={'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'};
//vector<char> cap={'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z'};


// Lets start ...




int main(){
    //vector<int> primes;
    //Sieve(primes);

    fast
    ll tests=1;
    //cin>>tests;
    while(tests--){
        int a,b,c;
        cin>>a>>b>>c;
        swap(a,b);swap(a,c);
        cout<<a<<sp<<b<<sp<<c;
        
        
    }
    
    return 0;
    }

// Done:)








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

typedef long long LL;
typedef pair<int, int> PII;
typedef vector<int> VI;
#define MP make_pair
#define PB push_back
#define X first
#define Y second

#define FOR(i, a, b) for(int i = (a); i < (b); ++i)
#define RFOR(i, b, a) for(int i = (b) - 1; i >= (a); --i)
#define ALL(a) a.begin(), a.end()
#define SZ(a) (int)((a).size())
#define FILL(a, value) memset(a, value, sizeof(a))
#define debug(a) cerr << #a << " = " << a << endl;

template<typename T> void setmax(T& x, T y) {x = max(x, y);}
template<typename T> void setmin(T& x, T y) {x = min(x, y);}

const double PI = acos(-1.0);
const LL INF = 1e9 + 47;
const LL LINF = INF * INF;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

int main()
{
	ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	
	map<string, int> mp;
	int n;
	cin >> n;
	while(n--)
	{
		string s;
		cin >> s;
		mp[s]++;
	}
	
	int mx = 0;
	for(auto i: mp) setmax(mx, i.Y);
	vector<string> ans;
	for(auto i: mp) if (mx == i.Y)
		ans.PB(i.X);
	sort(ALL(ans));
	for(auto i: ans) cout << i << endl;
	
	cerr << "Time elapsed: " << clock() / (double)CLOCKS_PER_SEC << endl;
	return 0;
}



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

int main() {
  string str0,str1;
  cin >> str0;
  
  str1 = str0;
  
  reverse(str1.begin(), str1.end());
  
  int cnt=0;

  for( int i = 0; i < str0.size(); i++ ) {
        if(str0[i] != str1[i]) cnt++;
  }
  cout << cnt/2;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define int long long
#define endl "\n"
#define pii pair<int,int> 
#define ff first
#define ss second
#define mii map<int,int>
#define si set<int>
#define sti stack<int>
#define qi queue<int>
#define vi vector<int>
#define pq priority_queue<int>
#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
const int M=1e9+7;

int32_t main(){
	IOS;
	int m,d;
	cin>>m>>d;
	int ans=0;
	for(int i=1;i<=m;i++){
		for(int j=1;j<=d;j++){
			if(j%10>=2&&(j/10)>=2&&(j%10)*(j/10)==i) ans++;
		}
	}
	cout<<ans<<endl;
}

Measured memory_bytes: 256
import sys
readline = sys.stdin.readline

N = int(readline())
statement = [[] for i in range(N)]
for i in range(N):
  A = int(readline())
  for j in range(A):
    x,y = map(int,readline().split())
    statement[i].append([x - 1,y])
  
# N人の誰が正直者か、全探索して、矛盾がないパターンはOK
ans = 0
for i in range(2 ** N):
  ok = True
  for j in range(N):
    if (i >> j) & 1:
      # 人jのコメントを検証
      for s in statement[j]:
        person = s[0]
        flag = s[1]
        if ((i >> person) & 1) != flag:
          # 間違ってる
          ok = False
          break
    if not ok:
      break
  if ok:
    honest = str(bin(i)).count("1")
    if ans < honest:
      ans = honest
print(ans)


Measured memory_bytes: 3064
#include<stdio.h>

int main(void)
{
	int S,h,m,s;
	scanf("%d\n",&S);
	h=S/3600;
	m=(S%3600)/60;
	s=(S%3600)%60;
	printf("%d:%d:%d\n",h,m,s);
	return 0;
}

Measured memory_bytes: 596
S=input()
result=[]
tmp=""
now_len=0
skip_flag=False
for i,c in enumerate(list(S)):
    tmp+=c
    now_len+=1
    if skip_flag:
        skip_flag=False
        continue
    if tmp!=S[i+1:i+now_len+1]:
        result.append(tmp)
        tmp=""
        now_len=0
    elif tmp!=S[i+1:i+now_len] and now_len>=2:
        result.append(tmp)
        tmp=""
        now_len=0
    elif tmp!=S[i+1:i+now_len+2]:
        result.append(tmp)
        tmp=""
        now_len=0
        skip_flag=True            
 
print(len(result))

Measured memory_bytes: 9848
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <map>
using namespace std;

int a[110];

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

	int n;
	cin >> n;

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

	int cnt = 0;
	for(int i = 0; i < n; ++i){
		int minj = i;
		for(int j = i; j < n; ++j){
			if(a[j] < a[minj]){
				minj = j;
			}
		}
		if(i != minj){
			swap(a[i], a[minj]);
			++ cnt;
		}
	}

	for(int i = 0; i < n; ++i){
		cout << a[i];
		if(i != n - 1)
			cout << " ";
		else
			cout << endl;
	}
	cout << cnt << endl;

	return 0;
}

Measured memory_bytes: 1192
#include <algorithm>
#include <iostream>
#include <map>
#include <numeric>
#include <set>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#include <queue>
#define MOD (1000000007l)
#define rep(i, n) for(long i = 0; i < n; i++)

using namespace std;

int main(void) {
  long X, Y;
  cin >> X >> Y;
  long result = 0;
  while (X <= Y) {
    result++;
    X *= 2;
  }
  cout << result << endl;
  return 0;
}


Measured memory_bytes: 256
a, v = gets.split(" ").map(&:to_i)
b, w = gets.split(" ").map(&:to_i)
t = gets.to_i
oni = v*t
nige = w*t
if a <= b
  if a+oni >= b+nige
    puts "YES"
  else
    puts "NO"
  end
else
  if b-nige >= a-oni
    puts "YES"
  else
    puts "NO"
  end
end

Measured memory_bytes: 14304
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
using namespace std;
static const double EPS = 1e-5;
typedef long long ll;
#define FOR(i,n) for(i=0;i<n;i++) 

int a[40][40];
int b[40][40];
int m[40][40];
int w,h;
int f(int x,int y,int d){
	if(m[x][y]<=d)return 0;
	m[x][y]=d;
	if(x>0&&!a[x-1][y])f(x-1,y,d+1);
	if(x<w-1&&!a[x][y])f(x+1,y,d+1);
	if(y>0&&!b[x][y-1])f(x,y-1,d+1);
	if(y<h-1&&!b[x][y])f(x,y+1,d+1);
	return 0;
}

int main(){
	for(;cin>>w>>h,w;){
		for(int i=0;i<40;i++)for(int j=0;j<40;j++){
			m[i][j]=INT_MAX/3;
		}
		for(int i=0;i<h-1;i++){
			for(int j=0;j<w-1;j++){
				cin>>a[j][i];
			}
			for(int j=0;j<w;j++){
				cin>>b[j][i];
			}
		}
		for(int i=0;i<w-1;i++){
			cin>>a[i][h-1];
		}
		f(0,0,1);
		if(m[w-1][h-1]!=INT_MAX/3){
			cout<<m[w-1][h-1]<<endl;
		}else{
			cout<<0<<endl;
		}
	}
	return 0;
}

Measured memory_bytes: 896
#include <bits/stdc++.h>
using namespace std;
long long a;
int main()
{
	cin>>a;
	a--;
	queue<long long>q;
	for(int i=1;i<10;i++)
	q.push(i);
	while(a--)
	{
		if(q.front()%10!=0)
		q.push(q.front()*10+q.front()%10-1);
		q.push(q.front()*10+q.front()%10);
		if(q.front()%10!=9)
		q.push(q.front()*10+q.front()%10+1);
		q.pop();
	}
	cout<<q.front()<<endl;
	return 0;
}

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

using namespace std;
const double PI=3.14159265358979323846;

#define SIZE_OF_ARRAY(array) (sizeof(array)/sizeof(array[0]))

int gcd(int a, int b) {
	if (a < b) {
		int tmp;
		tmp = a;
		a = b;
		b = tmp;
	}

	int r = a % b;

	if (r == 0) return b;

	return gcd(b, r);
}

int main() {

	int N;

	cin >> N;

	int ans = 0;

	for (int i = 1; i <= N; i++) {
		for (int j = 1; j <= N; j++) {
			for (int k = 1; k <= N; k++) {
				ans += gcd(gcd(i, j), k);
			}
		}
	}

	cout << ans << endl;
}

Measured memory_bytes: 3532