akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>

using namespace std;

#pragma GCC optimize "-O3"

#define watch(x) cout << (#x) << " is " << (x) << endl

#define rep(i,a,b)  for(int i=a;i<b;i++)
#define repd(i,a,b) for(int i=a-1;i>=b;i--)
#define nl          cout<<endl;
#define test()      lli t;cin>>t;while(t--)
#define sp(n)       setprecision(n)

#define lli     long long int
#define ulli    unsigned long long int
#define ld      long double
#define uld     unsigned long double
#define S       string
#define C       char
#define elif    else if
 
#define pb      push_back
#define pp      pop_back
#define plli    pair<lli,lli>
#define vlli    vector<lli>
#define vulli   vector<ulli>
#define vld     vector<ld>
#define vs      vector<string>

#define bs      binary_search
#define ub      upper_bound
#define lb      lower_bound

#define vsort(v) sort(v.begin(),v.end())

#define max1 1000001    //10^6 + 1
#define max2 10000001   //10^7 + 1
#define max3 1000000007 //10^9 + 7
#define inf  1000000009 //10^9 + 9

const int N = 1e5+5;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    string s;
    string t;
    cin >> s >> t;
    int m,n;
    m = s.length();
    n = t.length();
    int dp[m+1][n+1];
    for (int i = 0; i <= m; ++i)
    {
        for (int j = 0; j <= n; ++j)
        {
            if(i==0 || j == 0) dp[i][j] = 0;
            else{
                if (s[i-1] == t[j-1]) {
                    dp[i][j] = 1 + dp[i-1][j-1];
                    // cout << s[i-1];
                }
                else dp[i][j] = max(dp[i-1][j], dp[i][j-1]);
            }
        }
    }
    int i = m;
    int j = n;
    int z = dp[m][n];
    char arr[z];
    while(i>0 && j > 0){
        if(s[i-1] == t[j-1]) {arr[z-1]= s[i-1]; i--; j--; z--;}
        else{
            if (dp[i][j-1] > dp[i-1][j]) j = j-1;
            else i = i-1;
        } 
    }
    for (int i = 0; i < dp[m][n]; ++i)
    {
        cout << arr[i];
    }
    cout << '\n';
    // cout << dp[m][n] <<'\n';
    
    return 0;
}


Measured memory_bytes: 35456
#include <bits/stdc++.h>
#define INF (1<<30)
#define MOD 1000000007
#define l_ength size
using ll = long long;
using namespace std;

int main(){
	int n; cin >> n;
	int cnt = 0;
	while( n-- ){
		int k; cin >> k;
		if( k % 2 == 1 ) ++cnt;
	}
	cout << ( ( cnt % 2 == 0 ) ? "YES" : "NO" ) << endl;
	return 0;
}

Measured memory_bytes: 256
T_REVERT = "1"
T_APPEND = "2"
F_BEFORE = "1"
F_AFTER = "2"

S = input()
Q = int(input())

before = []
after = []
is_revert = False


for i in range(Q):
  q = input().split(" ")
  if q[0] == T_REVERT:
    is_revert = not is_revert
    continue
  if (q[1] == F_BEFORE) ^ is_revert:
    before.append(q[2])
  else:
    after.append(q[2])


ans_s = ""
if not is_revert:
  print("".join(before[::-1]) + S + "".join(after))
else:
  print("".join(after[::-1]) + S[::-1] + "".join(before))
  

Measured memory_bytes: 12276
import numpy as np
import sys

x = [[int(i) for i in input().split()] for j in range(1)]
k = x[0][0]
s = x[0][1]


#k = 5
#s = 14

count = 0
for x in range(k+1):
    for y in range(k+1):
        z = s - x - y
        if z <= k and 0 <= z:
            count += 1
print(count)


Measured memory_bytes: 12452
n,k,q = map(int,input().split())
point = [0 for i in range(n)]

for _ in range(q):
  ans = int(input())
  point[ans-1] += 1
  
for i in range(n):
  if k + point[i] - q > 0:
    print("Yes")
  else:
    print("No")

Measured memory_bytes: 4680
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {

    static int debt = 100000;

    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String line = "";

        while ((line = br.readLine()) != null && !line.isEmpty()) {
            int w = Integer.parseInt(line);
            for (int i = 0; i < w; i++) {
                debt *= 1.05;
                if (debt % 1000 > 0) {
                    debt = debt - (debt % 1000) + 1000;
                }
            }
            System.out.println(debt);
        }
    }
}

Measured memory_bytes: 16860
#include<cmath>
#include<bits/stdc++.h>
#define MAX(a,b) (a>b? a:b)
#define MIN(a,b) (a>b? b:a)
#define rep(i,n) for(lint i=0;i<(lint)(n);i++)
#define repr(i,n) for(lint i=(lint)(n);i>0;--i)
#define reps(i,a,b) for(lint i=a;i<=(lint)(b);i++)
typedef long long lint;
typedef long double ld;
using namespace std;
const ld PI = acos(-1.0);

int main(){
    string S;
    int N, K;
    cin >> N >> K >> S;
    if (S[K - 1] == 'A') S[K - 1] = 'a';
    if (S[K - 1] == 'B') S[K - 1] = 'b';
    if (S[K - 1] == 'C') S[K - 1] = 'c';
    cout << S << endl;
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<vector>
using namespace std;
int n,x[100100],m,d[100100],ans[100100],tmp[100100];long long K;
double a[100100];
int main()
{
    cin>>n;
    for(int i=1;i<=n;++i)cin>>x[i];
    cin>>m>>K;
    for(int i=1;i<=n;++i)d[i]=i,ans[i]=i;
    for(int i=1;i<=m;++i)
    {
    	int x;
        cin>>x;
        swap(d[x],d[x+1]);
    }
    while(K)
    {
        if(K&1)
        {
            for(int i=1;i<=n;++i)tmp[i]=ans[d[i]];
            for(int i=1;i<=n;++i)ans[i]=tmp[i];
        }
        for(int i=1;i<=n;++i)tmp[i]=d[d[i]];
        for(int i=1;i<=n;++i)d[i]=tmp[i];
        K>>=1;
    }
    for(int i=1;i<=n;++i)a[i]=x[ans[i]]-x[ans[i]-1];
    for(int i=1;i<=n;++i)printf("%.1lf\n",a[i]+=a[i-1]);
    return 0;
}

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

int main(){
    long int i,N,k;
    i = 0;
    int S[11111];
    cin >> N;
    
    if(N == 0) cout << N;
    
    if(N != 0){
        while(N){
        if(N%2 == 0) S[10000 - i] = 0;
        if(N%2 != 0) S[10000 - i] = 1;
        N = (N - S[10000 - i]) / (-2);
        i++;
    }
    for(k=1;k<=i;k++)
        cout << S[10000-i+k];
    };
}


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

int main(int argc, const char * argv[]) {
    int n,i;
    double s[1000];
    double a,m;
    
    while(1) {
        m=0;
        a = 0;
        scanf("%d" , &n);
        if(n == 0) {
            break;
        }
        
        for(i=0;i<n;i++) {
            scanf("%lf", &s[i]);
            m=m+s[i];
        }
        m=m/n;
        
        for(i=0; i<n; i++) {
            a =a+(s[i]-m)*(s[i]-m);
        }
        a = a/n;
        
        printf("%lf\n",sqrt(a));
        
    }
    
    return 0;
    
}


Measured memory_bytes: 2104
#include<bits/stdc++.h>
using namespace std;
typedef unsigned long long ll;
#define sqr(x) ((x)*(x))
#define mp make_pair
#define uint unsigned
#define PI pair<int,int>
inline char gc(){
    static char buf[100000],*p1=buf,*p2=buf;
    return p1==p2&&(p2=(p1=buf)+fread(buf,1,100000,stdin),p1==p2)?EOF:*p1++;
}
#define gc getchar
inline int read(){
	int x = 0; char ch = gc(); bool positive = 1;
	for (; !isdigit(ch); ch = gc())	if (ch == '-')	positive = 0;
	for (; isdigit(ch); ch = gc())	x = x * 10 + ch - '0';
	return positive ? x : -x;
}
inline void write(int a){
    if(a<0){
    	a=-a; putchar('-');
	}
    if(a>=10)write(a/10);
    putchar('0'+a%10);
}
inline void writeln(int a){
    if(a<0){
    	a=-a; putchar('-');
	}
	write(a); puts("");
}
inline int rnd(int x){
	return (rand()<<16|rand())%x;
}
const int N=100005,mod=1000007;
int n,father[N],vis[N];
queue<PI> q;
ll ycl[N];
vector<int> v[N];
struct has_table{
	bool has[mod]; int b[mod];
	ll a[mod],v[mod];
	inline int insert(int xx,int yy){
		ll x=ycl[xx]*n+ycl[yy];
		for(int i=x%mod;;i=i+1==mod?0:i+1){
			if(!has[i]||a[i]==x){
				has[i]=1; a[i]=x; b[i]++; return b[i];
			}
		}
	}
	inline void clear(int xx,int yy){
		ll x=ycl[xx]*n+ycl[yy];
		for(int i=x%mod;;i=i+1==mod?0:i+1){
			if(!has[i]||a[i]==x){
				has[i]=1; a[i]=x; b[i]=0; return;
			}
		}
	}
	inline int find(int xx,int yy){
		ll x=ycl[xx]*n+ycl[yy];
		for(int i=x%mod;;i=i+1==mod?0:i+1){
			if(!has[i]||a[i]==x){
				return b[i];
			}
		}
	}
}Ma;
inline int getfather(int x){
	return father[x]==x?x:father[x]=getfather(father[x]);
}
int main(){
	srand(time(0));
	n=read();
	for(int i=1;i<=n;i++)ycl[i]=(ll)rand()<<32|rand();
    for(int i=1;i<=n*2-2;i++){
        int x=read(),y=read(); 
        v[x].push_back(y); v[y].push_back(x);
        Ma.insert(y,x);
        if(Ma.insert(x,y)==2)q.push(mp(x,y));
    }
    for(int i=1;i<=n;i++)father[i]=i;
    while(!q.empty()){
    	int x=q.front().first,y=q.front().second; q.pop();
		x=getfather(x); y=getfather(y); if(x==y){continue; return 0;}
		if(v[x].size()<v[y].size()) swap(x,y); 
		//cout<<x<<" "<<y<<endl;
		vis[y]=1;
        for(unsigned i=0;i<v[y].size();i++){ 
            int to=v[y][i]; if(vis[to])continue;
            //if(y!=3||to!=3)cout<<x<<" "<<y<<" "<<to<<" "<<er.find(y,to)<<endl;
            v[to].push_back(x);
            Ma.insert(x,to);
            if(Ma.insert(to,x)==2)q.push(mp(to,x));
            v[x].push_back(to);
        }
        father[y]=x; v[y].clear();
    }
    int ans=0;
    for(int i=1;i<=n;i++)ans+=father[i]==i;
    if(ans==1) puts("YES"); else puts("NO");
    return 0;
}

Measured memory_bytes: 30192
#include<bits/stdc++.h>
using namespace std;
typedef long long LL;

#define CIN_ONLY if(1)
struct cww{cww(){
    CIN_ONLY{
        ios::sync_with_stdio(false);cin.tie(0);
    }
}}star;
#define fin "\n"
#define FOR(i,bg,ed) for(int i=(bg);i<(ed);i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(),(v).end()
#define fi first
#define se second
#define pb push_back
#define DEBUG if(0)
#define REC(ret, ...) std::function<ret (__VA_ARGS__)>
template <typename T>inline bool chmin(T &l,T r)
{bool a=l>r;if(a)l=r;return a;}
template <typename T>inline bool chmax(T &l,T r)
{bool a=l<r;if(a)l=r;return a;}
template <typename T>
istream& operator>>(istream &is,vector<T> &v){
    for(auto &it:v)is>>it;
    return is;
}
    
int main(){
    int a,b,c;
    cin>>a>>b>>c;
    if((b*10+c)%4==0)cout<<"YES"<<endl;
    else cout<<"NO"<<endl;
    return 0;
}


Measured memory_bytes: 256
package main

import (
	"fmt"
	"math"
)

func main() {
	var s, rs string
	fmt.Scanf("%s", &s)
	l := len(s)
	for i := 0; i < l; i++ {
		rs += string(s[l-1-i])
	}
	rs += " "
	i := 0
	flg := true
	for i < l {
		if "resare" == rs[i:int(math.Min(float64(i+6), float64(l)))] {
			i += 6
		} else if "esare" == rs[i:int(math.Min(float64(i+5), float64(l)))] {
			i += 5
		} else if "remaerd" == rs[i:int(math.Min(float64(i+7), float64(l)))] {
			i += 7
		} else if "maerd" == rs[i:int(math.Min(float64(i+5), float64(l)))] {
			i += 5
		} else {
			flg = false
			break
		}
	}
	if flg {
		fmt.Println("YES")
	} else {
		fmt.Println("NO")
	}
}


Measured memory_bytes: 7944
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
#define LLINF 9223372036854775807
#define MOD ll(1e9+7)
#define all(x) (x).begin(),(x).end()
#define dbg(x) cerr<<#x<<": "<<x<<endl

int main(){
    int a, b;
    cin >> a >> b;

    cout << 6-a-b << endl;

    return 0;

}


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

using namespace std;

#define DUMP(x) std::cerr << (#x) << " = " << (x) << "\n"
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define REP(i, k, n) for (int i = (k); i < (int)(n); ++i)
#define ALL(r) r.begin(), r.end()
#define YES puts("YES")
#define Yes puts("Yes")
#define NO puts("NO")
#define No puts("No")
#define IMP puts("IMPOSSIBLE")
#define Imp puts("Impossible")
#define imp puts("impossible")
#define M1 puts("-1")
#define pb push_back

template <typename T>
T dup(T x, T y)
{
    return (x + y - 1) / y;
};
template <typename A, size_t N, typename T>
inline void arrayFill(A (&array)[N], const T &val) { std::fill((T *)array, (T *)(array + N), val); }

using ll = int64_t;
using vint = vector<int32_t>;
using vvint = vector<vint>;
using vll = vector<ll>;
using vvll = vector<vll>;
using vstr = vector<string>;
using pint = pair<int32_t, int32_t>;
using pll = pair<ll, ll>;
using setint = set<int32_t>;
using setstr = set<string>;
using qint = queue<int32_t>;
using qpint = queue<pint>;

constexpr std::int32_t INF = 1001001001;
constexpr std::int64_t LINF = 1001001001001001001;

void Main()
{
    int n;
    cin >> n;
    vint x(n), y(n);

    rep(i, n) cin >> x[i] >> y[i];

    vint perm(n);
    rep(i, n) perm[i] = i;
    double sum = 0;
    do
    {
        double tmp = 0;
        rep(i, n - 1)
        {
            double a = (x[perm[i]] - x[perm[i + 1]]) * (x[perm[i]] - x[perm[i + 1]]);
            double b = (y[perm[i]] - y[perm[i + 1]]) * (y[perm[i]] - y[perm[i + 1]]);
            tmp += sqrt(a + b);
        }
        sum += tmp;

    } while (next_permutation(ALL(perm)));
    ll frac = 1;
    for (int i = 1; i <= n; ++i)
    {
        frac *= i;
    }
    cout << sum / frac << endl;
}

int main()
{
    std::cin.tie(nullptr);
    std::ios_base::sync_with_stdio(false);
    std::cout << std::fixed << std::setprecision(15);
    Main();
    return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <climits>
#include <cmath>
#include <cstdio>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
#define REP(var, a, b) for (int var = (a); var < (b); var++)
#define rep(var, n) for (int var = 0; var < (n); ++var)
#define ALL(c) (c).begin(), (c).end()
#define rALL(c) (c).rbegin(), (c).rend()
ll MOD = 1000000007;
ll INF = 1e18;
#define def 0

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

class SegTree {
 private:
  const ll def_val_ = 0;
  vl val_;
  ll n_;

  ll getr(ll x, ll y, ll k, ll l, ll r) {
    if (y <= l || r <= x) return def_val_;
    if (x <= l && r <= y) return val_[k];
    auto vl = getr(x, y, 2 * k + 1, l, (l + r) / 2);
    auto vr = getr(x, y, 2 * k + 2, (l + r) / 2, r);
    return comp(vl, vr);
  }

 public:
  SegTree(ll size) {
    n_ = 1;
    while (n_ < size) n_ *= 2;
    val_ = vl(2 * n_, def_val_);
  }

  void update(ll i, ll v) {
    i += (n_ - 1);
    val_[i] = v;
    while (i > 0) {
      i = (i - 1) / 2;
      val_[i] = comp(val_[2 * i + 1], val_[2 * i + 2]);
    }
  }

  ll comp(ll l, ll r) { return gcd(l, r); }

  // get XXX value between [x,y)
  ll getRange(ll x, ll y) { return getr(x, y, 0, 0, n_); }
};

int main() {
  //
  ll n;
  cin >> n;
  vl a(n);
  rep(i, n) cin >> a[i];
  SegTree st(n);
  rep(i, n) st.update(i, a[i]);
  ll ans = 0;
  rep(i, n) {
    ll g = 0;
    g = gcd(g, st.getRange(0, i));
    g = gcd(g, st.getRange(i + 1, n));
    ans = max(ans, g);
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 3072
#include<iostream>
#include<vector>
using namespace std;
const int maxn = 100001;
const int maxk = 17;
#define is_anc(a, b) (in[a] < in[b] and out[a] >= out[b])
struct info{
	int v, c, w;
};
struct query{
	int id, c, w, y;
};
int n, sz[maxn], g[maxn], top[maxn], up[maxn], depth[maxn], m;
long long ans[maxn];
vector < info > edge[maxn];
vector < query > ask[maxn];
int get_lca(int a, int b){
	while(g[a] != g[b])
		if(depth[top[g[a]]] < depth[top[g[b]]])b = up[top[g[b]]];
		else a = up[top[g[a]]];
	return depth[a] < depth[b] ? a : b;
}
void dfs1(int now, int last = 1){
	static int now_d = 0;
	up[now] = last;
	depth[now] = now_d++;
	sz[now] = 1;
	if(last != now){
		for(int i = 0;i < edge[now].size();++i)
			if(edge[now][i].v == last){
				edge[now].erase(edge[now].begin() + i);
				break;
			}
	}
	for(int i = 0;i < edge[now].size();++i){
		dfs1(edge[now][i].v, now), sz[now] += sz[edge[now][i].v];
		if(sz[edge[now][i].v] > sz[edge[now][0].v])swap(edge[now][i], edge[now][0]);
	}
	--now_d;
}
void dfs3(int now){
	static int now_g = 0;
	g[now] = now_g;
	if(!top[now_g])top[now_g] = now;
	if(!edge[now].empty()){
		dfs3(edge[now][0].v);
		for(int i = 1;i < edge[now].size();++i)
			++now_g, dfs3(edge[now][i].v);
	}
}
void dfs2(int now, int last = 1){
	static int total_w = 0;
	static int q_of[maxn] = {};
	static int w_of[maxn] = {};
	for(auto &i : ask[now]){
		ans[i.id] += (total_w - w_of[i.c] + q_of[i.c] * i.y) * i.w;
	}
	for(auto &i : edge[now]){
		if(i.v != last){
			++q_of[i.c];
			w_of[i.c] += i.w;
			total_w += i.w;
			dfs2(i.v, now);
			--q_of[i.c];
			w_of[i.c] -= i.w;
			total_w -= i.w;
		}
	}
}
int main(){
	ios_base::sync_with_stdio(0), cin.tie(0);
	cin >> n >> m;
	for(int a, b, c, d, i = 1;i < n;++i){
		cin >> a >> b >> c >> d;
		edge[a].push_back({b, c, d});
		edge[b].push_back({a, c, d});
	}
	dfs1(1);
	dfs3(1);
	for(int i = 0, x, y, u, v, lca;i < m;++i){
        cin >> x >> y >> u >> v;
		lca = get_lca(u, v);
		ask[u].push_back({i, x, 1, y});
		ask[v].push_back({i, x, 1, y});
		ask[lca].push_back({i, x, -2, y});
	}
	dfs2(1);
	for(int i = 0;i < m;++i)cout << ans[i] << '\n';
}


Measured memory_bytes: 23924
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define lvector vector<ll>
#define cvector vector<char>
#define svector vector<string>
#define lque queue<ll>
#define lpque priority_queue<ll>
#define dlpque priority_queue<ll,lvector,greater<ll>>
#define P pair<ll,ll>
#define ALL(a) a.begin(),a.end()
#define RALL(a) a.rbegin(),a.rend()
#define rep(i,n) for(ll i=0; i<n; ++i)
#define print(a) cout << (a) << endl

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  ll n,ans=0,tmp=0,h,h_=0;cin>>n;
  rep(i,n) {
    cin>>h;
    if(h<=h_) tmp++;
    else {ans=max(ans,tmp);tmp=0;}
    h_=h;
  }
  print(max(ans,tmp));
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define sz(x) (int((x).size()))
#define pb push_back
#define eb emplace_back
#define all(x) (x).begin(), (x).end()
template<typename T> bool domax(T &a, T b) { return (b > a ? (a = b, true) : false); }
template<typename T> bool domin(T &a, T b) { return (b < a ? (a = b, true) : false); }
typedef long long ll;

const int maxn = 100*1000+5;

int n, k, a[maxn], ans;
std::vector<int> c[maxn];

int go(int i) {
    int d = 0;
    for (int j : c[i]) {
        domax(d, go(j));
    }
    if (i && a[i] != 0 && d+1 == k) {
        ans++;
        return 0;
    }
    return d+1;
}

int main() {
    scanf("%d%d", &n, &k);
    for (int i = 0; i < n; i++) {
        scanf("%d", a+i); a[i]--;
        if (i) c[a[i]].pb(i);
    }
    if (a[0]) ans++;
    go(0);
    printf("%d\n", ans);
}


Measured memory_bytes: 10752
#include <iostream>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <vector>
#include <numeric> // accumulate(v.begin(), v.end(), 0)

using namespace std;
#define ll long long

int main(){
  int N;
  cin >> N;
  vector<string> W(N);
  bool ret = true;
  for(int i=0; i<N; i++) {
    cin >> W[i];
    if(ret && i != 0) {
      if(W[i][0] != W[i-1][W[i-1].size()-1] ||
	 find(W.begin(), W.begin()+i, W[i]) != W.begin()+i) {
	ret = false;
      }
    }
  }
  if(ret)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <cstring>
#include <map>
#include <queue>
#include <cmath>
#include <complex> // complex<double> a(1.2 , 2.3);// real(): 1.2, imag()2.3
using namespace std;

#define MOD 1000000007
#define ll long long
#define ld long double
#define FOR(i,a,b) for(ll i=(ll)a;i<(ll)b;i++)
#define rep(i,n) FOR(i,0,n)
#define pb push_back
#define mp make_pair
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define rmsame(a) sort(all(a)),a.erase(unique(all(a)), a.end())
#define rmvector(a,b) rep(i,a.size())rep(j,b.size())if(a[i]==b[j]){a.erase(a.begin()+i);i--;break;}
#define pq_pair_tB priority_queue <pair<ll,ll>, vector<pair<ll,ll> > , greater<pair<ll,ll> > >
#define pq_pair_ts priority_queue <pair<ll,ll> > //第二成分の大きさが関係ない
template<typename X> bool exist(vector<X> vec, X item){return find(all(vec), item)!=vec.end();}
ll gcd(ll a, ll b){if(b==0)return a;return gcd(b,a%b);}
ll lcm(ll a, ll b){return a/gcd(a,b)*b;}

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

    ll inp;
    cin >> inp;

    if(inp % 2) cout << inp * 2 << endl;
    else cout << inp << endl;

    //cout << fixed << setprecision(16) << ans << endl;
    return 0;
}




Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;

namespace ConsoleApp1
{
    class Program
    {
        static void Main(string[] args)
        {
            int[] NM = Console.ReadLine().Split(" ").Select(int.Parse).ToArray();
            int[] H = Console.ReadLine().Split(" ").Select(int.Parse).ToArray();
            bool[] NGs = new bool[NM[0]];
            List<int>[] Roads = new List<int>[NM[0]];
            for (int i = 0; i < Roads.Length; i++)
            {
                Roads[i] = new List<int>();
            }

            for (int i = 0; i < NM[1]; i++)
            {
                int[] v = Console.ReadLine().Split(" ").Select(int.Parse).ToArray();
                if (!(NGs[v[0] - 1]))
                {
                    if (H[v[0] - 1] > H[v[1] - 1])
                    {
                        Roads[v[0] - 1].Add(v[1] - 1);
                    }
                    else
                    {
                        NGs[v[0] - 1] = true;
                    }
                }
                if (!(NGs[v[1] - 1]))
                {
                    if (H[v[1] - 1] > H[v[0] - 1])
                    {
                        Roads[v[1] - 1].Add(v[0] - 1);
                    }
                    else
                    {
                        NGs[v[1] - 1] = true;
                    }
                }

            }

            int res = 0;

            for (int i = 0; i < NM[0]; i++)
            {
                if (!(NGs[i]))
                {
                    bool t = true;
                    for (int j = 0; j < Roads[i].Count; j++)
                    {
                        if(H[i] <= H[Roads[i][j]])
                        {
                            t = false;
                            break;
                        }    
                    }
                    if (t) { res += 1; }

                }
            }
            
            Console.WriteLine(res);

        }
    }
}


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

#define INITIAL_DEBT 100000 // 10万

int main()
{
        int n;
        cin >> n;
        
        int debt = INITIAL_DEBT;
        for(int i=1; i<=n; i++){
                debt *= 1.05; // 利子(5%/1week)
                int rem = debt%1000; // 1,000円以下の端数
                if( rem ){ debt = debt - rem + 1000; }
        }
        cout << debt << endl;
                
        return 0;
}

Measured memory_bytes: 1160
#include <vector>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <deque>
#include <algorithm>
#include <utility>
#include <functional>
#include <sstream>
#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <climits>
 
using namespace std;
 
inline int toInt(string s) { int v; istringstream sin(s); sin >> v; return v;}
template<class T> inline string toString(T x) { ostringstream sout; sout << x; return sout.str();}
 
typedef vector<int> vi;
typedef vector<vi>  vvi;
typedef vector<string> vs;
typedef pair<int, int> pii;
typedef long long ll;
 
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(),(a).rend()
#define EACH(t,i,c) for(t::iretator i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
 
const double EPS = 1e-10;

int main() {
	int t;
	cin >> t;

	REP(syzygy, t) {
		int n;
		cin >> n;

		int max = 0, min = 0;
		int last, now;

		cin >> last;

		REP(i, n-1) {
			cin >> now;

			if(last > now) {
				if(last-now > max) {
					max = last-now;
				}
			} else {
				if(now-last > min) {
					min = now-last;
				}
			}

			last = now;
		}

		cout << min << " " << max << endl;
	}
}

Measured memory_bytes: 0
from sys import stdin
N = int(stdin.readline().rstrip())
S = []
T = []
for i in range(N):
    s,t = [(x) for x in stdin.readline().rstrip().split()]
    S.append(s)
    T.append(int(t))
X = (stdin.readline().rstrip())
ans = sum(T[S.index(X)+1:])
print(ans)

Measured memory_bytes: 3060
def divisor(N:int):
    res = set()
    i = 1
    while i * i <= N:
        if N % i == 0:
            res.add(i)
            if i != N // i:
                res.add(N // i)
        i += 1
    return res

def check(N:int, K:int):
    while N % K == 0:
        N //= K
    return True if N % K == 1 else False

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

    ans = set()
    for K in divisor(N):
        if K == 1: continue
        if check(N, K):
            ans.add(K)

    ans |= divisor(N - 1)

    ans.remove(1)

    print(len(ans))

if __name__ == "__main__":
    main()

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

typedef long long ll;
typedef vector<ll> vi;
typedef vector<vi> vvi;
typedef vector<pair<ll,ll>> vii;
typedef vector<vii> vvii;
typedef pair<ll,ll> ii;

#define pb push_back
#define mp make_pair
#define sz(vs) (ll)(vs.size())
#define rep(i,a,b) for (ll i=a;i<b;i++)
#define rep_(i,a,b) for (ll i=a;i>b;--i)
#define iter(i,c) for (auto i:c)
#define ss second
#define ff first
#define D(x) cout << '>' << #x << ':' << x << endl;
#define D2(x,a) cout << '>' << #x << ':' << x << " >" << #a << ':' << a <<  endl;
#define D3(x,a,b) cout << '>' << #x << ':' << x << " >" << #a << ':' << a << " >" << #b << ':' << b << endl;
#define D4(x,a,b,c) cout << '>' << #x << ':' << x << " >" << #a << ':' << a << " >" << #b << ':' << b << " >" << #c << ':' << c << endl;
#define PS(a,st,e) if (1) {if (st<e) {cout<<a[st];rep(noname,st+1,e) cout<<""<<a[noname];}cout<<"\n";}
#define PA1(a,st,e) if (1) {if (st<e) {cout<<a[st];rep(noname,st+1,e) cout<<" "<<a[noname];}cout<<'\n';}
#define PA(a,st,e) if (1) {cout<<#a<<": [";if (st<e) {cout<<a[st];rep(noname,st+1,e) cout<<", "<<a[noname];}cout<<"]\n";}
#define PSET(c) if (1) {cout<<#c<<": {";for (auto noname:c) cout<<noname<<",";cout<<"}\n";}
#define PM(c) if (1) {cout<<#c<<": {";for (auto noname:c) cout<<noname.first<<":"<<noname.second<<", ";cout<<"}\n";}

#define MAXN 200005
#define MAXK 1000006
#define mod 1000000007

ll n, m, k, a[MAXN];
string s;
char c;

void solve() {
	cin>>n;
	ll ans = 0;
	rep(i, 1, n+1) {cin>>a[i];if (a[i]&1 && i&1) ans++;}
	cout<<ans<<endl;
}

void aux() {
}

int main() {
	ios::sync_with_stdio(false); cin.tie(0);
	aux();
	ll _ = 1;
	// cin>>_;
	while(_--) {
		solve();
	}
	return 0;
}

Measured memory_bytes: 3600
//map made in C
//ABC171-D
//https://atcoder.jp/contests/abc171/tasks/abc171_d
#include<stdio.h>
#include<stdlib.h>
#include<stdbool.h>
#include<time.h>
#include<sys/time.h>
#define hsize 4194304 //must be 2^N

unsigned long long seed;

unsigned long long xorshift(){
  seed=seed^(seed<<13);
  seed=seed^(seed>>7);
  seed=seed^(seed<<17);
  return seed;
}

long long hash[hsize];
long long inhfl=1;
bool hashfl[hsize]={0};

long long hbase[8][256];

long long reshash(){
  srand(time(0));
  struct timeval tv;
  gettimeofday(&tv, NULL);
  seed=(tv.tv_sec*1000000+tv.tv_usec);
  long long i,j;
  for(i=0;i<100;i++){xorshift();}
  for(i=0;i<8;i++){
    for(j=0;j<256;j++){
      hbase[i][j]=((xorshift()%hsize)^(rand()%hsize));
    }
  }
  if(inhfl==0){for(i=0;i<hsize;i++){hashfl[i]=false;}}
  inhfl=0;
}

long long gbhash(long long x){
  long long r=0,i;
  for(i=0;i<8;i++){
    r^=hbase[i][(x&(255ll))];
    x>>=8;
  }
  return r;
}

long long access(long long x){
  long long p=gbhash(x);
  while(1){
    if((!hashfl[p]) || hash[p]==x){
      hash[p]=x;
      hashfl[p]=true;
      return p;
    }
    p++;
    if(p==hsize){p=0;}
  }
}

int main(){
  reshash();
  long long n,a[131072],q,b,c,s=0,i,j;
  long long mpb[hsize]={0};
  long long bh,ch;
  scanf("%lld",&n);
  for(i=0;i<n;i++){
    scanf("%lld",&a[i]);
    s+=a[i];
    mpb[access(a[i])]++;
  }
  scanf("%lld",&q);
  for(i=0;i<q;i++){
    scanf("%lld%lld",&b,&c);
    bh=access(b);
    ch=access(c);
    s-=b*mpb[bh];
    s+=c*mpb[bh];
    mpb[ch]+=mpb[bh];
    mpb[bh]=0;
    printf("%lld\n",s);
  }
  return 0;
}


Measured memory_bytes: 72068
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
#define sz(x) (int)(x).size()
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
using namespace std;
using ll = long long;
using P = pair<int, int>;
using vi = vector<int>;
using vc = vector<char>;
using vb = vector<bool>;
using vs = vector<string>;
using vll = vector<long long>;
using vp = vector<pair<int, int>>;
using vvi = vector<vector<int>>;
using vvc = vector<vector<char>>;
using vvll = vector<vector<long long>>;
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 (b<a) {a=b; return 1;} return 0;}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    
    double t, x;
    cin >> t >> x;
    cout << fixed << setprecision(16) << t / x << endl;
}

Measured memory_bytes: 256
N = int(input())
A = []
for n in range(N):
    a = int(input())
    A.append(a)

A_max = max(A)
C = A.count(A_max)

if C>=2:
    for l in range(N):
        print(A_max)
else:
    p = A.index(A_max)
    B = sorted(A,reverse=True)
    for k in range(N):
        if k==p:
            print(B[1])
        else:
            print(A_max)


Measured memory_bytes: 15100
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Main main = new Main();
        main.solve();
    }
    public void solve() {
        Scanner scan = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
        int N = scan.nextInt();
        // 4/N = 1/h + 1/w + 1/n
        // 4 * h * w * n = N * (h * w + w * n + n * h)
        // 4 * h * w * n - N * w * n - N * h * n = N * h * w
        // (4 * h * w - N * w - N * h) * n = N * h * w
        for (long h = 1; h <= 3500; h++) {
            for (long w = 1; w <= 3500; w++) {
                long x = 4 * h * w - N * w - N * h;
                if (x <= 0) {
                    continue;
                }
                long y = N * h * w;
                if (y % x == 0) {
                    System.out.printf("%d %d %d\n", h, w, y / x);
                    return;
                }
            }
        }
    }
}


Measured memory_bytes: 22736
#include<bits/stdc++.h>
using namespace std;
#define FastRead ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define ll int
#define ld long double
#define FOR(i,a,n) for (int i=(a);i<=(n);++i)
#define RFOR(i,a,n) for (int i=(n);i>=(a);--i)
#define FI(i,n) for (int i=0; i<(n); ++i)
#define ZERO(a) memset((a),0,sizeof((a)))
#define MINUS(a) memset((a),-1,sizeof((a)))
#define f first
#define s second
#define pb push_back
#define mk make_pair
#define all(g) g.begin(),g.end()
int fastMax(int x, int y) { return (((y-x)>>(32-1))&(x^y))^y; }
int fastMin(int x, int y) { return (((y-x)>>(32-1))&(x^y))^x; }

// #include <ext/pb_ds/assoc_container.hpp> // Common file
// #include <ext/pb_ds/tree_policy.hpp>     // Including tree_order_statistics_node_updat
// using namespace __gnu_pbds;
// typedef tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;

// I am questioning life and universe and 
// everything else after looking at this


void solve(){
    ll n,m; cin>>n>>m;
    ll p[m+1];

    vector<ll> swi[m+1];

    FOR(i,1,m){
        ll k; cin>>k;
        FOR(j,1,k) {
            ll x; cin>>x;
            swi[i].push_back(x);
        }
    }

    ll mask = (1<<n)-1;
    FOR(i,1,m) cin>>p[i];

    ll ans = 0;
    FOR(mas,0,mask){
        bool bulb[n-1];
        FOR(i,0,n-1){
            if((mas & (1<<i))) bulb[i] = 1;
            else bulb[i] = 0;
        }


        ll number = 0;
        FOR(i,1,m){
            ll c = 0;
            for(ll v:swi[i]) if(bulb[v-1]) c = (c+1)%2;
            if(c == p[i]) number++;
        }

        if(number == m) ans++;
    }

    cout<<ans<<endl;
}   

signed main(){

   FastRead;    


    ll t;
    t = 1; 
    // cin>>t;
    FOR(i,1,t){
        // cout<<"Case #"<<i<<": ";
        solve();
    }
}




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

int main(){
    int n;cin>>n;
    int a[n+1],b[n+1],c[n+1];
    for(int i=1;i<=n;i++) cin>>a[i];
    for(int i=1;i<=n;i++) cin>>b[i];
    for(int i=1;i<=n;i++) cin>>c[i];
    int s=0;
    for(int i=1;i<=n;i++){
        s+=b[a[i]];
        if(a[i]!=n&&a[i+1]==a[i]+1){
            s+=c[a[i]];
        }
    }
    cout<<s<<endl;
}

Measured memory_bytes: 888
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main(){

  vector <int> a;
  int n,x,i;

  cin>>n;
  for(i=0;i<n;i++){
    cin>>x;
    a.push_back(x);
  }
  sort(a.begin(),a.end());

  for(i=0;i<n;i++) if(n-i<=a[i]) break;

  cout<<n-i<<endl;
  return 0;

}

Measured memory_bytes: 3120
#include<set>
#include<map>
#include<cmath>
#include<ctime>
#include<cstdio>
#include<cassert>
#include<cstdlib>
#include<cstring>
#include<algorithm>
using namespace std;
const double PI=acos(-1);
typedef long long ll;
typedef pair<int,int> pi;
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define rep(i,a,b) for (int i=(a);i<=(b);i++)
#define per(i,a,b) for (int i=(a);i>=(b);i--)
#define Rep(i,a,b) for (int i=(a);i<(b);i++)
#define Per(i,a,b) for (int i=(a);i>(b);i--)
//debug
#define deb printf("begin\n");
#define dee printf("end\n");
#define def printf("find\n");
#define dey printf("Yes\n");
#define den printf("No\n");
#define dew printf("wrong\n");
void read(int&x){
	x=0;int f=1;char ch=getchar();
	while ((ch<'0'||ch>'9')&&ch!='-')ch=getchar();
	if (ch=='-')f=-1,ch=getchar();
	while (ch>='0'&&ch<='9')x=x*10+ch-'0',ch=getchar();
	x*=f;
}
//--------------------------head--------------------------//

#define maxn 100005
int a[maxn],n;
void py(){printf("Yes\n");exit(0);}
void pn(){printf("No\n");exit(0);}
bool check1(){
	rep(i,1,n)if (a[i]!=n-1)return false;
	return true;
}
int mn,mx;
bool check2(){
	mn=a[1],mx=a[1];
	rep(i,2,n){
		mn=min(mn,a[i]);
		mx=max(mx,a[i]);
	}
	if (mx-mn>=2)return true;
	return false;
}
int cnt(int x){
	int res=0;
	rep(i,1,n)if (a[i]==x)res++;
	return res;
}
int main(){
	read(n);rep(i,1,n)read(a[i]);
	if (check1())py();//sort(a+1,a+n+1);
	if (check2())pn();
	mn=mx-1;
	if ((mx>=1+cnt(mn))&&(mx<=cnt(mx)/2+cnt(mn)))py();else pn();
	return 0;
}

Measured memory_bytes: 512
#include <iostream>
#include <set>
#include <map>
#include <vector>
#include <algorithm>
#include <iomanip>
#include <climits>
#include <numeric>
#include <cmath>
#include <queue>
#include <sstream>

using namespace std;
typedef long long ll;

int main() {
  int n;
  cin >> n;
  map<int, int> f;
  map<int, int> s;
  for (int i = 0; i < n; i++) {
    int a;
    cin >> a;
    if (i % 2 == 0) {
      f[a]++;
    } else {
      s[a]++;
    }
  }
  
  int f_maxnum = -1;
  int f_maxcnt = 0;
  for (auto itr = f.begin(); itr != f.end(); itr++) {
    if (itr->second > f_maxcnt) {
      f_maxcnt = itr->second;
      f_maxnum = itr->first;
    }
  }
  
  int s_maxnum = -1;
  int s_maxcnt = 0;
  for (auto itr = s.begin(); itr != s.end(); itr++) {
    if (itr->second > s_maxcnt) {
      s_maxcnt = itr->second;
      s_maxnum = itr->first;
    }
  }
  
  if (f_maxnum != s_maxnum) {
    cout << n - f_maxcnt - s_maxcnt << endl;
  } else {
    int f_secondnum = -1;
    int f_secondcnt = 0;
    for (auto itr = f.begin(); itr != f.end(); itr++) {
      if (itr->second > f_secondcnt && itr->first != f_maxnum) {
        f_secondcnt = itr->second;
        f_secondnum = itr->first;
      }
    }
    
    int s_secondnum = -1;
    int s_secondcnt = 0;
    for (auto itr = s.begin(); itr != s.end(); itr++) {
      if (itr->second > s_secondcnt && itr->first != s_maxnum) {
        s_secondcnt = itr->second;
        s_secondnum = itr->first;
      }
    }
    if (f_secondcnt > s_secondcnt) {
      cout << n - f_secondcnt - s_maxcnt << endl;
    } else {
      cout << n - f_maxcnt - s_secondcnt << endl;
    }
  }
  return 0;
}


Measured memory_bytes: 4992
// #define _GLIBCXX_DEBUG // for STL debug (optional)
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <cfloat>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <fstream>
#include <functional>
#include <bitset>
using namespace std;
using ll = long long int;
using int64 = long long int;
 
template<typename T> void chmax(T &a, T b) {a = max(a, b);}
template<typename T> void chmin(T &a, T b) {a = min(a, b);}
template<typename T> void chadd(T &a, T b) {a = a + b;}
 
int dx[] = {0, 0, 1, -1};
int dy[] = {1, -1, 0, 0};
const int INF = 1LL << 29;
const ll LONGINF = 1LL << 60;
const ll MOD = 1000000007LL;
 
int main() {
    int N; cin >> N;
    string s;
    int ans = 0;
    for(int i=0; i<N; i++) {
        cin >> s;
        if(s == "E869120") ans++;
    }
    cout << ans << endl;
    return 0;
}



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


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

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

  sort(v.begin(), v.end());

  int cnt = 1;
  for(int i = 0; i < n-1; i++){
    if(v[i] != v[i+1]){cnt++;}
  }

  cout << cnt << endl;
}

Measured memory_bytes: 9548
import math,itertools,fractions,heapq,bisect,sys,queue,copy

sys.setrecursionlimit(10**7)
inf=10**20
mod=10**9+7
dd=[(-1,0),(0,1),(1,0),(0,-1)]
ddn=[(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())
def LS(): return sys.stdin.readline().split()
def S(): return input()

def main():
  h,w=LI()
  dp=[[0]*w for _ in range(h)]
  dp[0][0]=1

  l=[S() for _ in range(h)]

  for i in range(h):
    for j in range(w):
      
      y=i-1
      x=j-1

      if y<0 and x<0:
        continue
      if l[i][j]=='#':
        continue
      if y<0:
        dp[i][j]=dp[i][j-1]
      elif x<0:
        dp[i][j]=dp[i-1][j]
      else:
        dp[i][j]=(dp[i-1][j]+dp[i][j-1])%mod

  return dp[h-1][w-1]

# main()
print(main())


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

using namespace std;
using ll = long long int;
using P = pair<int, int>;

#define roop(i, n) for(int i = 0;i < n;i++)

int main(void){

    int n;
    cin >> n;

    map<string, int> mp;

    roop(i, n){
        string s; cin >> s;
        mp[s];
    }

    cout << mp.size() << endl;

    return 0;
}


Measured memory_bytes: 19204
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;


public class Main {
	private	static	BufferedReader	br = null;

	static {
		br   = new BufferedReader(new InputStreamReader(System.in));
	}

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		String	strStdin = null;
		int		nNum     = 0;
		boolean	bLoop    = true;

		while((strStdin = parseStdin()) != null) {
			nNum = Integer.parseInt(strStdin);
			for (int n = 0; n < nNum; n++) {
				if((strStdin = parseStdin()) != null) {
					bLoop = true;
					for (int nA = 1; nA < 26 && bLoop; nA += 2) {
						if (nA == 13) {
							continue;
						}
						for (int nB = 0; nB < 26 && bLoop; nB++) {
							if (strStdin.contains(encode("this", nA, nB)) || strStdin.contains(encode("that", nA, nB))) {
								System.out.println(decode(strStdin, nA, nB));
								bLoop = false;
							}
						}
					}
				}
			}
		}
	}

	private static String encode(String strNum, int nA, int nB) {
		String	strTmp = "";
		int		nTmp   = 0;

		for (char c : strNum.toCharArray()) {
			// Ck = APk + K (mod M)
			if (Character.isLowerCase(c)) {
				nTmp = (nA * (c - 'a') + nB) % 26 + 'a';
				c    = (char)nTmp;
			}
			strTmp += c;
		}

		return strTmp;
	}

	private static String decode(String strNum, int nA, int nB) {
		String	strTmp = "";
		int		nInvA  = inverse(nA);
		int		nTmp   = 0;

		for (char c : strNum.toCharArray()) {
			// Pk = A-1(Ck - K) (mod M)
			if (Character.isLowerCase(c)) {
				nTmp = (nInvA * (c - 'a' - nB + 26)) % 26 + 'a';
				c    = (char)nTmp;
			}
			strTmp += c;
		}

		return strTmp;
	}

	private static int inverse(int nA) {
		int	nInvA  = 0;

		switch (nA) {
        case 1:
        	nInvA = 1;
        	break;
        case 3:
        	nInvA = 9;
        	break;
        case 5:
        	nInvA = 21;
        	break;
        case 7:
        	nInvA = 15;
        	break;
        case 9:
        	nInvA = 3;
        	break;
        case 11:
        	nInvA = 19;
        	break;
        case 15:
        	nInvA = 7;
        	break;
        case 17:
        	nInvA = 23;
        	break;
        case 19:
        	nInvA = 11;
        	break;
        case 21:
        	nInvA = 5;
        	break;
        case 23:
        	nInvA = 17;
        	break;
        case 25:
        	nInvA = 25;
        	break;
		}

		return nInvA;
	}

	private static String parseStdin() {
		String	strNum = null;

		try {
			String line = br.readLine();
			if (line != null) {
				if (!line.isEmpty()) {
					strNum = line;
				}
			}
		}
		catch (IOException e) {}

		return strNum;
	}
}

Measured memory_bytes: 22060
# include "iostream"
int N , C ;
int s [100000] , t [100000] , c [100000];
int sm [200002];
int tt [200002];
int main ()
{
scanf ("%d %d " ,&N ,& C );
for ( int i =0; i < N ; i ++)
scanf ("%d %d %d " ,& s [ i ] ,& t [ i ] ,& c [ i ]);
for ( int i =1; i <= C ; i ++)
{
for ( int j =0; j <200002; j ++) tt [ j ]=0;
for ( int j =0; j < N ; j ++) if ( c [ j ]== i ) tt [ s [ j ]*2 -1]++ , tt [ t [ j ]*2]--;
for ( int j =1; j <200002; j ++) tt [ j ]+= tt [j -1];
for ( int j =0; j <200002; j ++) if ( tt [ j ] >0) sm [ j ]++;
}
int mx =0;
for ( int j =0; j <200002; j ++) if ( mx < sm [ j ]) mx = sm [ j ];
printf ("% d \n " , mx );
}

Measured memory_bytes: 2944
#include <iostream>
#include <algorithm>
#include <vector>
#include <unordered_map>
#include <cmath>
#include <string>
#include <climits>

using std::cin;
using std::cout;
using std::endl;
using std::max;
using std::min;
using std::sort;
using std::string;
using std::vector;

using ll = long long int;

#define rep(i,s,t)for(ll i = s;i <= t;i++)
#define rrep(i,s,t)for(ll i = s;i >= t;i--)

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

	ll res = 0;
	
	rep(atop, 1, 9){
		rep(abottom, 1, 9){

			
			ll ap = 0;
			ll bp = 0;
			if(atop == abottom){
				if(atop > n)continue;
				ap += 1;
				bp += 1;
			}
			ll k = 10;
			while(true){
				ll amax = (atop + 1) * k - 10 + abottom;
				ll amin = atop * k + abottom;

				if(n < amax){
					if(n >= amin){
						ap += (n - amin) / 10 + 1;
					}
					break;
				}
				ap += (k / 10);
				k *= 10;
			}
			k = 10;
			while(true){
				ll bmax = (abottom + 1) * k - 10 + atop;
				ll bmin = abottom * k + atop;

				if(n < bmax){
					if(n >= bmin){
						bp += (n - bmin) / 10 + 1;
					}
					break;
				}
				bp += (k / 10);
				k *= 10;
			}
			res += ap * bp;
		}
	}

	cout << res << endl;

	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
long long dp[100100][3], n, a, b, c;
int main() {
	cin >> n >> a >> b >> c;
	dp[0][0] = a;
	dp[0][1] = b;
	dp[0][2] = c;
	//cout << "+" <<dp[0][0] << " " << dp[0][1] << " " << dp[0][2] << endl;
	for (int i = 1; i < n; i++) {
		cin >> a >> b >> c;
		dp[i][0] = a + max(dp[i - 1][1], dp[i - 1][2]);
		dp[i][1] = b + max(dp[i - 1][0], dp[i - 1][2]);
		dp[i][2] = c + max(dp[i - 1][0], dp[i - 1][1]);
		//cout << "+" <<dp[i][0] << " " << dp[i][1] << " " << dp[i][2] << endl;
	}
	cout << max(dp[n - 1][0], max(dp[n - 1][1], dp[n - 1][2]));
}

Measured memory_bytes: 5936
#include <stdio.h>
int main() {
	int n, h, w, a, b, ans = 0;
	scanf("%d%d%d", &n, &h, &w);
	for (int i = 0; i < n; i++) {
		scanf("%d%d", &a, &b);
		if (a >= h && b >= w) {
			ans++;
		}
	}
	printf("%d\n", ans);
	return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
#ifdef ENABLE_DEBUG
#define dump(a) cerr<<#a<<"="<<a<<endl
#define dumparr(a,n) cerr<<#a<<"["<<n<<"]="<<a[n]<<endl
#else
#define dump(a) 
#define dumparr(a,n) 
#endif
#define FOR(i, a, b) for(ll i = a;i < b;i++)
#define For(i, a) FOR(i, 0, a)
#define REV(i, a, b) for(ll i = b-1;i >= a;i--)
#define Rev(i, a) REV(i, 0, a)
#define REP(a) For(i, a)
#define SIGN(a) (a==0?0:(a>0?1:-1))

typedef long long int ll;
typedef unsigned long long ull;
typedef unsigned int uint;
typedef pair<ll, ll> pll;
typedef pair<ll,pll> ppll;
typedef vector<ll> vll;

const ll INF=(1LL<<50);
#if __cplusplus<201700L
ll gcd(ll a, ll b) {
  if(a < b) return gcd(b, a);
  ll r;
  while ((r=a%b)) {
    a = b;
    b = r;
  }
  return b;
}
#endif

template<class S,class T>
std::ostream& operator<<(std::ostream& os,pair<S,T> a){
  os << "(" << a.first << "," << a.second << ")";
  return os;
}
template<class T>
std::ostream& operator<<(std::ostream& os,vector<T> a){
  os << "[ ";
  REP(a.size()){
    os<< a[i] << " ";
  }
  os<< " ]";
  return os;
}


void solve(long long X){
  set<ll> ps;
  for (ll i = 2; i < 100005; i+=2)
  {
    bool f=true;
    for (auto &&j : ps)
    {
      if(i%j==0){
        f=false;
        break;
      }
      if(j*j>i)break;
    }
    if(f){
      ps.insert(i);
    }
    if(i==2)--i;
  }
  cout<<*ps.lower_bound(X)<<endl;
}

int main(){
    long long X;
    scanf("%lld",&X);
    solve(X);
    return 0;
}


Measured memory_bytes: 640
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ABC150A
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] KX = Console.ReadLine().Split(' ');
            int K = int.Parse(KX[0]);
            int X = int.Parse(KX[1]);
            int a = 500 * K;
            if (a >= X)
            {
                Console.WriteLine("Yes");
            }
            else
            {
                Console.WriteLine("No");
            }
        }
    }
}


Measured memory_bytes: 27460
#!/usr/bin/env python3
from itertools import product
import sys


def solve(A: int, B: int, C: int, X: int):
    print(sum(
        1
        for a, b, c in product(range(A + 1), range(B + 1), range(C + 1))
        if a * 500 + b * 100 + c * 50 == X
    ))


def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    A = int(next(tokens))  # type: int
    B = int(next(tokens))  # type: int
    C = int(next(tokens))  # type: int
    X = int(next(tokens))  # type: int
    solve(A, B, C, X)


if __name__ == '__main__':
    main()


Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n,i,count = 0;
    unordered_map<int,int> m;
    cin>>n;
    for(i = 0; i < n; i++)
    {
        int temp;
        cin>>temp;
        m[temp]++;
    }
    for(auto x : m)
    {
        if(x.second % 2 == 0)
            count++;
    }
    if(count & 1)
        cout<<(m.size() - 1)<<endl;
    else
        cout<<(m.size())<<endl;
    return 0;
}


Measured memory_bytes: 4388
#include<iostream>

int main(){
	int a[5],i,n,j;
	
	for(i=0;i<5;i++){
	std::cin>>a[i];
	}
	for(i=0;i<5;i++){
		for(j=i+1;j<5;j++){
			if(a[i]<a[j]){
				n=a[i];
				a[i]=a[j];
				a[j]=n;
				}
			}
		}
	for(i=0;i<4;i++){
	std::cout<<a[i]<<" ";
	}	
	
	std::cout<<a[4];
	
	std::cout<<std::endl;
	
	return 0;
	
	}

Measured memory_bytes: 1160