akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define syosu(x) fixed<<setprecision(x)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef pair<double,double> pdd;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<string> vs;
typedef vector<P> vp;
typedef vector<vp> vvp;
typedef vector<pll> vpll;
typedef pair<ll,pll> pip;
typedef vector<pip> vip;
const int inf=1<<30;
const ll INF=1ll<<60;
const double pi=acos(-1);
const double eps=1e-9;
const ll mod=1e9+7;
const int dx[4]={0,1,0,-1},dy[4]={1,0,-1,0};

int n,m;
priority_queue<int> q;

int main(){
	cin>>n>>m;
	for(int i=0;i<n;i++){
		int x;
		cin>>x;
		q.push(x);
	}
	for(int i=0;i<m;i++){
		int x=q.top();q.pop();
		q.push(x/2);
	}
	ll res=0;
	for(int i=0;i<n;i++){
		int x=q.top();q.pop();
		res+=x;
	}
	cout<<res<<endl;
}

Measured memory_bytes: 892
#include<stdio.h>
#include<stdlib.h>
#include<string.h>

typedef struct node{
	int num;
	struct node *prev;
	struct node *next;
} List;

List *list;

List *insert(List *head, int x)
{
	List *p;
	if((p=(List *)malloc(sizeof(List))) == NULL){
		printf("malloc error\n");
		exit(1);
	}
	p->num = x;
	p->next=head;
	if(head != NULL){
		p->prev = head->prev;
		head->prev = p;
	}//????´?1??\?????????????°?????????????????§?????????????
	else p->prev=p;//????´?0?????¨???????°????????????????
	return p;
}

List *deleteFirst(List *head)
{
	List *p;
	if(head==NULL) return head;
	if(head->next == NULL){
		free(head); return NULL;
	}
	p=head->next; p->prev=head->prev;//????°?????????????????§??????????
	free(head); return p;
}

List *deleteLast(List *head)
{
	if(head==NULL) return head;
	if(head->next == NULL){
		free(head); return NULL;
	}
	else{ 
		head->prev=head->prev->prev;
		free(head->prev->next);
		head->prev->next=NULL;
		return head;
	}
}
List *delete_x(List *head,int x){
	List *p=head->next;
	if(head->num == x){
		head = deleteFirst(head);
		return head;
	}
	while(p != NULL){
		if(p->num == x){
			p->prev->next = p->next;
			if(p->next != NULL) p->next->prev = p->prev;
			else head->prev = p->prev;
			free(p);
			break;
		}
		p = p->next;
	}
	return head;
}

void showAll(List *head){
	List *p=head;
	
	if(p != NULL){
		printf("%d", p->num);
		p = p->next;
	}
	while( p!= NULL){
		printf(" %d", p->num); p=p->next;
	}
	printf("\n");
}


int main(void){
	char com[13];
	int x,n;
	int i;
	list=NULL;
	scanf("%d",&n);
	for(i=0;i<n;i++){
		scanf("%s", com);
		if(strcmp( com, "insert") == 0){
			if(scanf("%d", &x) ==  -1){
				printf("No number\n");
				exit(1);
			}
			list=insert(list,x);
		}
		else if(strcmp( com, "delete") == 0){
			if(scanf("%d", &x) ==  -1){
				printf("No number\n");
				exit(1);
			}
			list=delete_x(list,x);
		}
		else if(strcmp( com, "deleteFirst") == 0){
			list=deleteFirst(list);
		}
		else if(strcmp( com, "deleteLast") == 0){
			list=deleteLast(list);
		}
	}
	showAll(list);
	return 0;
}

Measured memory_bytes: 33008
#include <iostream>
#include <algorithm>
#include <iomanip>
#include <string>
#include <vector>
#include <math.h>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#define PI 3.14159265359
typedef long long ll;
const int MOD = 1e9+7;
const ll LLINF = 7e18;
using namespace std;


int main(){
	int c[3][3];
	for (int i = 0; i < 3; i++){
		for (int j = 0; j < 3; j++){
			cin >> c[i][j];
		}
	}

	int a1 = 0;
	int b1 = c[0][0];
	int b2 = c[1][0];
	int b3 = c[2][0];
	int a2 = c[0][1] - b1;
	int a3 = c[0][2] - b1;
	if (c[1][1] == a2+b2 && c[2][1] == a2+b3 && c[1][2] == a3+b2 && c[2][2] == a3+b3){
		cout << "Yes" << endl;
	}else{
		cout << "No" << endl;
	}
	return 0;
}

Measured memory_bytes: 3636
group1 = ["1","3","5","7","8","10","12"]
group2 = ["4","6","9","11"]
group3 = ["2"]
data = input().split()
if data[0] in group1 and data[1] in group1:
    print("Yes")
elif data[0] in group2 and data[1] in group2:
    print("Yes")
elif data[0] in group3 and data[1] in group3:
    print("Yes")
else:
    print("No")

Measured memory_bytes: 38256
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i<(n); i++)
#define reps(i,s,n) for(int i=(s); i<(n); i++)
#define all(v) v.begin(),v.end()
#define outve(v) for(auto i : v) cout << i << " ";cout << endl
#define outmat(v) for(auto i : v){for(auto j : i) cout << j << " ";cout << endl;}
#define in(n,v) for(int i=0; i<(n); i++){cin >> v[i];}
#define out(n) cout << (n) << endl
#define fi first
#define se second
#define pb push_back
#define mod 1000000007
#define infi 1900000000
#define infl 1100000000000000000
#define cyes cout << "Yes" << endl
#define cno cout << "No" << endl
#define csp << " " <<
#define outset(n) cout << fixed << setprecision(n);
using namespace std;
using ll = long long;
using ld = long double;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vs = vector<string>;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;
using pii = pair<int,int>;
using pll = pair<ll,ll>;
using vvp = vector<vector<pair<int,int>>>;
template<typename T> using ve = vector<T>;
template<typename T> using pq2 = priority_queue<T>;
template<typename T> using pq1 = priority_queue<T,vector<T>,greater<T>>;
template<typename T> bool chmax(T &a, T b) {if(a < b) {a = b;return 1;}return 0;}
template<typename T> bool chmin(T &a, T b) {if(a > b) {a = b;return 1;}return 0;}




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

    int N,K;
    cin >> N >> K;

    set<int> a;
    rep(i,K){
        int d;
        cin >> d;
        rep(j,d) {
            int aa;
            cin >> aa;
            a.insert(aa);
        }
    }
    
    cout << N-int(a.size()) << endl;
    
    
    

    return 0;
}


Measured memory_bytes: 3668
#include<iostream>
#include<algorithm>
#include<vector>
#define WHITE 0
#define BLACK 1
using namespace std;

vector<int> adj[100005];
int parent[100005];
int color[100005];
int N;

void assign_color(int u, int cl, int goal) {
    color[u] = cl;
    for (int i = 0; i < adj[u].size(); i++) {
        int v = adj[u][i];
        if (v == goal) {
            continue;
        }
        if (color[v] != cl) {
            color[v] = cl;
            assign_color(v, cl, goal);
        }
    }
    return;
}

void path_dfs(int u) {
    color[u] = BLACK;
    for (int i = 0; i < adj[u].size(); i++) {
        int v = adj[u][i];
        if (v == N - 1) {
            parent[v] = u;
            return;
        }
        if (color[v] != BLACK) {
            parent[v] = u;
            color[v] = BLACK;
            path_dfs(v);
        }
    }
    return;
}

int main() {
    int a, b, p, s2g = 0, fennec_count = 0;
    cin >> N;
    for (int i = 0; i < N - 1; i++) {
        cin >> a >> b;
        a--; b--;
        adj[a].push_back(b);
        adj[b].push_back(a);
    }
    for (int i = 0; i < N; i++) {
        color[i] = WHITE;
        parent[i] = i;
    }
    path_dfs(0);
    p = parent[N - 1];
    while (p != 0 || parent[p] != p) {
        s2g++;
        p = parent[p];
    }
    p = N - 1;
    for (int i = 0; i < s2g / 2; i++) {
        p = parent[p];
    }
    for (int i = 0; i < N; i++) color[i] = WHITE;
    assign_color(0, BLACK, p);
    for (int i = 0; i < N; i++) {
        if (color[i] == BLACK) fennec_count++;
    }
    if (fennec_count > N - fennec_count) cout << "Fennec" << endl;
    else cout << "Snuke" << endl;

    return 0;

}

Measured memory_bytes: 11136
N, M, C = map(int, input().split())
B = list(map(int, input().split()))
n = 0
for _ in range(N):
    Ai = list(map(int, input().split()))
    s = C
    for a, b in zip(Ai, B):
        s += a * b
    if s > 0:
        n += 1
print(n)


Measured memory_bytes: 9040
#include <bits/stdc++.h>
#define mst(a,b) memset(a,b,sizeof(a))
#define ALL(x) x.begin(),x.end()
#define pii pair<int,int>
#define eps 1e-6
#define debug(a) cout << #a": " << a << endl;
#define eularMod(a, b) a < b ? a : a % b + b
inline int lowbit(int x){ return x & -x; }
const int N = 1e5 + 10;
const int mod = (int) 1e8 + 7;
const int INF = 0x3f3f3f3f;
const long long LINF = (1LL << 62);
typedef long long LL;
typedef unsigned long long ULL;
const double PI = acos(-1.0);
using namespace std;



int main() {
#ifdef LOCAL
    freopen("in.txt", "r", stdin);
//    freopen("out.txt","w",stdout);
#endif
    int a, b;
    scanf("%d%d", &a, &b);
    printf("%d\n", a + b / 2);
    return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using pint = pair<int, int>;
using pll = pair<ll, ll>;
using Edge = pair<int, ll>;
using Graph = vector<vector<int>>;
using WeightedGraph = vector<vector<Edge>>;
const ll INF64 = 1LL << 60;
const int INF32 = 1 << 29;
const ll MOD = 1000000007;

const int CASES = 3;

void solve() {
    ll A, V, B, W; cin >> A >> V >> B >> W;
    ll T; cin >> T;
    ll at = 0, bt = 0;
    string ans = "NO";
    if(A < B){
        at = A + V * T;
        bt = B + W * T;
        if(at >= bt)ans = "YES";
    }
    else if (A > B) {
        at = A - V * T;
        bt = B - W * T;
        if(at <= bt) ans = "YES";
    }
    else{
        ans = "YES";
    }
    cout << ans << endl;
}

int main() {
#ifdef MYLOCAL
    vector<string> filenames {"input1.txt", "input2.txt", "input3.txt", "input4.txt", "input5.txt"};
    cout << "------------\n";
    for(int i = 0; i < CASES; ++i){
        ifstream in(filenames[i]);
        cin.rdbuf(in.rdbuf());
        solve();
        cout << "------------\n";
    }
#else

    solve();

#endif
    return 0;
}


Measured memory_bytes: 3632
#include<stdio.h>
#include<stdlib.h>
#include<math.h>

int main(){
    int s,y=0,n,m,sum,c=0,h=0;
    scanf("%d %d",&n,&m);
    int k[m][n+1],p[m],b[n];
    for(int l=0;l<m;l++){
        scanf("%d",&k[l][0]);
        for(int i=0;i<k[l][0];i++){
            scanf("%d",&k[l][i+1]);
        }
    }
    for(int i=0;i<m;i++){
        scanf("%d",&p[i]);
    }
    for(int i=0;i<pow(2,n);i++){
        c=0;
        int o=i;
        for(int j=0;j<n;j++){
            b[j]=o%2;
            o/=2;
        }
        for(int j=0;j<m;j++){
            sum=0;
            for(int l=0;l<k[j][0];l++){
                sum+=b[k[j][l+1]-1];
            }
            if(p[j]!=sum%2){
                c++;
                break;
            }
        }
        if(c==0){
            h++;
        }
    }
    printf("%d\n",h);
}


Measured memory_bytes: 256
N, M = map(int,input().split())
AB = [list(map(int, input().split())) for _ in range(M)]
prev = [0] * N
to_list = [ [] for _ in range(N)]
for a,b in AB:
 to_list[a - 1].append(b - 1)
 to_list[b - 1].append(a - 1)
marked = {0}
que = [0]
for i in que:
   for j in to_list[i]:
       if j in marked: continue
       que.append(j)
       marked.add(j)
       prev[j] = i+1
print('Yes')
print(*prev[1:], sep='\n')

Measured memory_bytes: 79056
#include <stdio.h>

int main()
{
 int x,y;
  scanf("%d",&x);
  
  x/=100;
  if(x%2==1)
    x-=1;
  
  y=x-4;
  y/=2;
  printf("%d\n",8-y);
  return 0;
}

Measured memory_bytes: 1736
#include<bits/stdc++.h>
using namespace std;
#define ll long long
int main()
{   
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    ll n,w;cin>>n>>w;
   
    ll v[n+1],we[n+1];
    ll sum=0;
    for(int i=1;i<=n;++i)
    {
        cin>>we[i]>>v[i];
        sum+=v[i];
    }
    ll dp[n+1][sum+1];
    for(int i=0;i<=n;++i)
    {
        for(int j=0;j<=sum;++j)
        {
            dp[i][j]=1e18;
        }
    }
    for(int i=0;i<=n;++i)
    {
        dp[i][0]=0;
    }
    for(int i=1;i<=n;++i)
    {
        for(int j=1;j<=sum;++j)
        {
            
            dp[i][j]=dp[i-1][j];
            if(j>=v[i])
            {
                dp[i][j]=min(dp[i][j],dp[i-1][j-v[i]]+we[i]);
            }
        }
    }
    ll ans=0;
    for(ll i=1;i<=sum;++i)
    {
        if(dp[n][i]<=w)
        {
            ans=max(ans,i);
        }
    }
    cout<<ans<<endl;

    
    return 0;
}

Measured memory_bytes: 79232
#include <bits/stdc++.h>
#include <string>
using namespace std;
#define ll long long int
#define ld long double
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define mod 1000000007
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define fr(i,a,n) for(i=a;i<n;i++)
#define frn(i,a,n) for(i=a;i<=n;i++)
#define vll vector<ll>
#define pll pair<ll,ll>
#define vp vector<pll>
#define ub upper_bound
#define lb lower_bound
//#define map map<ll,ll>
#define mem(x,y) memset(x,y,sizeof(x))
#define all(v) v.begin(),v.end()
#define bs binary_search
#define qll queue<ll>
#define sll set<ll>
#define ma 500000
ll power(ll x,ll n)
{
    if(n==0)
        return 1;
    else if(n%2 == 0)        //n is even
        return power(x*x,n/2);
    else                             //n is odd
        return x*power(x*x,(n-1)/2);
}
int highestPowerof2(int n)
{
   int p = (int)log2(n);
   return (int)pow(2, p);  
}
ll powermod(ll x, ll y, ll p)  
{  
    ll res = 1;
    x = x % p;
    if (x == 0) return 0;  
  
    while (y > 0)  
    {  
        if (y & 1)  
            res = (res*x) % p;  
        y = y>>1; 
        x = (x*x) % p;  
    }  
    return res;  
}
ll compare(ll x,ll y,ll z)
{
    if(x==y==z)
    return 1;
    else if(x==y||y==z||x==z)
    return 3;
    else
    return 6;
}
 
int main()
{
    ll n,v;
    cin>>n;
    ll a[100001]={0};
    for(ll x=1;x<=100;x++)
    {
        for(ll y=1;y<=100;y++)
        {
            for(ll z=1;z<=100;z++)
            {
               ll  in=x*x+y*y+z*z + x*y+ y*z +z*x;
               a[in]++;
            }
        }
    }
    for(int i=1;i<=n;i++)
    cout<<a[i]<<endl;
}


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

const ll maxs = 1e6+5;
const ll lmaxs = 20;
ll mod = 1e9+7;
ll oo = 1e15;

#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define I insert

const int MAX = 3005;
ll dp[MAX][MAX];

void solve(){
    mod =  998244353;
    ll n,s;
    cin>>n>>s;
    ll ans=0;
    ll a[n];
    for(ll i=0;i<n;i++){
        cin>>a[i];
        memcpy(dp[i+1],dp[i] ,sizeof dp[0]);
        (dp[i+1][a[i]] += i+1)%=mod;
        for(ll j=0 ; j+a[i] <= s ; j++){
            (dp[i+1][j+a[i]] += dp[i][j])%= mod;
        }
        ans += dp[i+1][s];
        ans %= mod;
    }
    cout << ans << endl;
}

int main(){
    
    IOS;
    ll T = 1;
    //cin>>T;
    while(T--){
        solve();   
    }
    return 0;
}

Measured memory_bytes: 70656
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
typedef int64_t llong;
char moji[26]={'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'};
char moji2[26]={'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'};
char moji3[10]={'0','1','2','3','4','5','6','7','8','9'};
#define Sort(a) sort(a.begin(),a.end());
#define Reverse(a) reverse(a.begin(),a.end());
#define ld PRId64


int main(){
    int n,k;
    cin >> n >> k;
    llong ans=1;
    REP(i,n){
        if(ans < k) ans*=2;
        else ans+=k;
    }
    cout << ans <<endl;

}

Measured memory_bytes: 256
n, m = map(int, input().split())
l = [-1]*n

r = True
for i in range(m):
    s, c = map(int, input().split())
    if l[s-1] == -1:
        l[s-1] = c
    else:
        if l[s-1] != c:
            r = False

if l[0] == -1:
    if n == 1:
        l[0] = 0
    else:
        l[0] = 1
if l[0] == 0:
    if n != 1:
        r = False
        
for i in range(1, n):
    if l[i] == -1:
        l[i] = 0
        
if r == True:
    print("".join(map(str, l)))
else:
    print(-1)

Measured memory_bytes: 3064
from collections import deque
k = int(input())
a = deque([1, 2, 3, 4, 5, 6, 7, 8, 9])
for i in range(k-1):
    b = a.popleft()
    if b%10 != 0: a.append(b*10+b%10-1)
    a.append(b*10+b%10)
    if b%10 != 9: a.append(b*10+b%10+1)
print(a[0])

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

typedef unsigned long long ull;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<double, double> pdd;
const ull mod = 1e9 + 7;
#define REP(i,n) for(int i=0;i<(int)n;++i)

//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

template < typename T >
void vprint(T &v){
	REP(i, v.size()){
		cout << v[i] << " ";
	}
	cout << endl;
}

int main(){
	string S;
	cin >> S;
	int mi = 100000;
	REP(i, S.size()-2){
		int x = 100 * (S[i] - '0') + 10 * (S[i+1] - '0') + (S[i+2] - '0');
		if (mi>abs(x-753)){
			mi = abs(x-753);
		}
	}
	cout << mi << endl;
    return 0;
}

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

#define rep(i, n) for (int i = 0; i < n; i++)
using namespace std;
typedef long long ll;
using P = pair<ll, ll>;

template<class T> inline bool chmin(T& a,T b) {if (a > b) {a = b; return true;} return false;}
template<class T> inline bool chmax(T& a,T b) {if (a < b) {a = b; return true;} return false;}

const ll MOD = 1000000007;
const int INF = 1<<29;

int main(){
  int n; cin >> n;
  vector<ll> a(n);
  rep(i, n) cin >> a[i];

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


Measured memory_bytes: 2560
#include<iostream>
using namespace std;
int main(){
  int n;
  cin >> n;
  for(int i=0;i<n;i++){
    int a,b,c;
    cin >> a >> b >> c;
    if((a*a+b*b==c*c)||(b*b+c*c==a*a)||(c*c+a*a==b*b))
      cout << "YES" << endl;
    else cout << "NO" << endl;
  }
}

Measured memory_bytes: 2972
def iwa_check(start, end):
    for i in range(start, end):
        if s[i] == '#' and s[i + 1] == '#':
            return False
    return True


n, a, b, c, d = map(int, input().split())
s = list(input())
s = ['#'] + s + ['#']

# 岩が2個並ぶ
if not iwa_check(a, c) or not iwa_check(b, d):
    print('No')
    exit()

# 追い越す場合
if c > d:
    ok = False
    for i in range(b, d + 1):
        if s[i - 1] == '.' and s[i] == '.' and s[i + 1] == '.':
            ok = True
            break
    if not ok:
        print('No')
        exit()

# 追い越さない
print('Yes')


Measured memory_bytes: 13528
#include<iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <cmath>
#include <queue>
using namespace std;
typedef long long ll;
typedef pair<ll,int> P;
int Max = 1000000;
int main(){
    int X, Y, A, B, C;
    cin >> X >> Y >> A >> B >> C;
    ll Red[A];
    ll Green[B];
    ll tmp;
    for(int i=0;i<A;i++){
      cin >> Red[i];
    }
    sort(Red, Red+A);

    vector<ll> eat;
    for(int i=0;i<X;i++){
      eat.push_back(Red[A-1-i]);
    }

    for(int i=0;i<B;i++){
      cin >> Green[i];
    }
    sort(Green, Green+B);

    for(int i=0;i<Y;i++){
      eat.push_back(Green[B-1-i]);
    }


    for(int i=0;i<C;i++){
      cin >> tmp;
      eat.push_back(tmp);
    }

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

    ll ans = 0;
    for(int i=0;i<X+Y;i++){
      ans += eat[X+Y+C-1-i];
    }
    
    cout << ans <<endl;

  	return 0;
}



Measured memory_bytes: 7536
#include <stdio.h>

int main () {
    
   int A, H, n;
    scanf("%d %d", &H, &A);
    
    n=H/A;
    
    if(H%A==0)
     printf("%d", n);
    else
     {n++;
    
   printf("%d", n);}
return 0;
}

Measured memory_bytes: 128
#include <iostream>

using namespace std;

int cif(int b)
{
    int ci=0;
    while(b)
    {
        b=b/10;
        ci++;
    }
    return ci;
}

int putere(int c)
{
    int pz;
    pz=1;
    while(c)
    {
        pz=pz*10;
        c--;
    }
    return pz;
}

int nrdiv(int n)
{
    int i,d=0;
    for(i=1;i<=n;i++)
    {
        if(n%i==0)
            d++;
    }
    return d;
}
int main()
{
    int a,b,c,p,n,div;
    cin>>a>>b;
    c=cif(b);
    p=putere(c);
    n=a*p+b;
    div=nrdiv(n);
    if(div%2==1)
        cout<<"Yes";
    else
        cout<<"No";
    return 0;
}


Measured memory_bytes: 256
#include <cstdint>
#include <iostream>
#include <vector>

using namespace std;

int main() {
  int64_t N, Z, W;
  cin >> N >> Z >> W;
  if (N == 1) {
    int64_t n;
    cin >> n;
    cout << abs(n - W) << endl;
    return 0;
  }
  int64_t max_val = 1;
  int64_t min_val = 1000000000;
  vector<int64_t> cards(N);
  for (int n = 0; n < N; ++n) {
    cin >> cards[n];
  }
  cout << max(abs(cards.back() - W), abs(cards[N-2] - cards.back())) << endl;
  
  return 0;
}


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

int main(){
  int i,j,cnt=0;
  int n,m;
  cin>>n>>m;
  int x[m];
  for(i=0;i<m;i++)cin>>x[i];
  sort(x,x+m);
  int p[m-1];
  for(i=0;i<m-1;i++)p[i]=x[i+1]-x[i];
  sort(p,p+m-1);
  int sum=0;
  for(i=0;i<m-n;i++)sum+=p[i];
  cout<<sum;
}

Measured memory_bytes: 1024
#![allow(non_snake_case)]

use std::io::{stdin, Read};
use std::str::FromStr;
fn read_option<T: FromStr>() -> Option<T> {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok()
}
fn read<T: FromStr>() -> T {
    let opt = read_option();
    opt.expect("failed to parse token")
}

fn main() {
    let N: usize = read();
    let K: i64 = read();
    let vec: Vec<usize> = (0..N).map(|_| read::<usize>() - 1).collect();
    use std::collections::HashMap;
    let mut set = HashMap::new();
    let mut now = 0;
    let mut vec2 = vec![];
    vec2.push(now);
    set.insert(now, 0);
    loop {
        now = vec[now];
        match set.get(&now) {
            None => {
                vec2.push(now);
                set.insert(now, vec2.len() - 1);
            }
            Some(_) => break,
        }
    }
    let &loop_first_idx = set.get(&now).unwrap();
    if K < loop_first_idx as i64 {
        println!("{}", vec2[K as usize] + 1);
        return;
    }
    let rem = (K - loop_first_idx as i64) % (set.len() - loop_first_idx) as i64;
    println!("{}", vec2[rem as usize + loop_first_idx] + 1);
}


Measured memory_bytes: 11080
#include <iostream>
#include <vector>

using namespace std;

int main(){
    vector<int> pow6, pow9;
    int dp[100001];
    int N;
    cin >> N;
    int tmp = 1;
    while(tmp <= N){
        pow6.push_back(tmp);
        tmp *= 6;
    }
    tmp = 1;
    while(tmp <= N){
        pow9.push_back(tmp);
        tmp *= 9;
    }
    dp[0] = 0;
    dp[1] = 1;
    for(int i = 2; i <= N; i++){
        dp[i] = dp[i-1]+1;
        for(int j = 0; j < pow6.size(); j++){
            if(i-pow6[j] < 0) break;
            dp[i] = min(dp[i], dp[i-pow6[j]]+1);
        }
        for(int j = 0; j < pow9.size(); j++){
            if(i-pow9[j] < 0) break;
            dp[i] = min(dp[i], dp[i-pow9[j]]+1);
        }
    }
    cout << dp[N] << endl;
}

Measured memory_bytes: 640
#include<iostream>
#include<iomanip>
#include<climits>
#include<vector>
#include<list>
#include<functional>
#include<algorithm>
#include<string>
#include<cmath>
#include<complex>
#include<set>
#include<map>
#include<stack>
#include<queue>
#include<deque>
#include<tuple>
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n) for(int i=0;i<(n);i++)
using namespace std;
typedef long long ll;
typedef pair<int, int> P;


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

	int N, X;
	cin >> N >> X;
	int D = 0;
	int cnt = 1;
	REP(i, N) {
		int L;
		cin >> L;
		D += L;
		if (D <= X) cnt++;
	}

	cout << cnt << endl;

	return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<cstdio>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
#include<cassert>
#include<complex>
#include<numeric>
using namespace std;

//#define int long long
typedef long long ll;

typedef unsigned long long ul;
typedef unsigned int ui;
const ll mod = 1000000007;
const ll INF = (1e+18) + 7;
typedef pair<int, int>P;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
#define all(v) (v).begin(),(v).end()
typedef pair<ll, ll> LP;
typedef long double ld;
typedef pair<ld, ld> LDP;
const ld eps = 1e-8;
const ld pi = acos(-1.0);
//typedef vector<vector<ll>> mat;
typedef vector<int> vec;

ll mod_pow(ll a, ll n, ll m) {
	ll res = 1;
	while (n) {
		if (n & 1)res = res * a%m;
		a = a * a%m; n >>= 1;
	}
	return res;
}

struct modint {
	ll n;
	modint() :n(0) { ; }
	modint(ll m) :n(m) {
		if (n >= mod)n %= mod;
		else if (n < 0)n = (n%mod + mod) % mod;
	}
	operator int() { return n; }
};
bool operator==(modint a, modint b) { return a.n == b.n; }
modint operator+=(modint &a, modint b) { a.n += b.n; if (a.n >= mod)a.n -= mod; return a; }
modint operator-=(modint &a, modint b) { a.n -= b.n; if (a.n < 0)a.n += mod; return a; }
modint operator*=(modint &a, modint b) { a.n = ((ll)a.n*b.n) % mod; return a; }
modint operator+(modint a, modint b) { return a += b; }
modint operator-(modint a, modint b) { return a -= b; }
modint operator*(modint a, modint b) { return a *= b; }
modint operator^(modint a, int n) {
	if (n == 0)return modint(1);
	modint res = (a*a) ^ (n / 2);
	if (n % 2)res = res * a;
	return res;
}

ll inv(ll a, ll p) {
	return (a == 1 ? 1 : (1 - p * inv(p%a, a)) / a + p);
}
modint operator/(modint a, modint b) { return a * modint(inv(b, mod)); }

const int max_n = 1<<18;
modint fact[max_n], factinv[max_n];
void init_f() {
	fact[0] = modint(1);
	for (int i = 0; i < max_n - 1; i++) {
		fact[i + 1] = fact[i] * modint(i + 1);
	}
	factinv[max_n - 1] = modint(1) / fact[max_n - 1];
	for (int i = max_n - 2; i >= 0; i--) {
		factinv[i] = factinv[i + 1] * modint(i + 1);
	}
}
modint comb(int a, int b) {
	if (a < 0 || b < 0 || a < b)return 0;
	return fact[a] * factinv[b] * factinv[a - b];
}
using mP = pair<modint, modint>;

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

void solve() {
	int n; cin >> n;
	vector<int> a(n);
	rep(i, n) {
		cin >> a[i];
	}
	sort(all(a));
	rep(i, n - 1) {
		if (a[i] == a[i + 1]) {
			cout << "NO" << endl; return;
		}
	}
	cout << "YES" << endl;
}



signed main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	//cout << fixed << setprecision(10);
	//init_f();
	//init();
	//int t; cin >> t; rep(i, t)solve();
	solve();
	stop
		return 0;
}

Measured memory_bytes: 5120
#include<bits/stdc++.h>
using namespace std;
#define INF 1000000000

int main()
{
  int n;cin>>n;
  int m;cin>>m;
  vector<int> a(m);
  vector<int> b(m);
  vector<int> c(m,0);
  int i,j;
  for(i=0;i<m;i++)
  {
    cin>>a.at(i)>>b.at(i);
    for(j=0;j<b.at(i);j++)
    {
      int g;cin>>g;
      c.at(i)+=1<<(g-1);
    }
  }
  vector<vector<int>> bitDP(m+1,vector<int>(1<<n,INF));
  for(i=0;i<=m;i++)
  {
    bitDP.at(i).at(0)=0;
  }
  for(i=1;i<=m;i++)
  {
    for(j=0;j<(1<<n);j++)bitDP.at(i).at(j)=bitDP.at(i-1).at(j);
    for(j=0;j<(1<<n);j++)
    {
      int kans=min(bitDP.at(i-1).at(j|c.at(i-1)),bitDP.at(i-1).at(j)+a.at(i-1));
      bitDP.at(i).at(j|c.at(i-1))=min(kans,bitDP.at(i).at(j|c.at(i-1)));
    }
  }
  if(bitDP.at(m).at((1<<n)-1)>=INF)cout<<"-1"<<endl;
  else cout<<bitDP.at(m).at((1<<n)-1)<<endl;
}


Measured memory_bytes: 16384
import java.util.*;

public class Main {

	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		long A = in.nextLong();
		long B = in.nextLong();
		long C = in.nextLong();

		if (A + B >= C) {
			System.out.println(B + C);
		} else {
			System.out.println(Math.min(A + B, C) + 1 + B);
		}
		in.close();
	}

}


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

int main(){
    int k;
    string s;

    cin >> k>>s;

    if(s.size()<=k){
        cout << s<<endl;
    }else{
        rep(i, k){
            cout << s[i];
        }
        cout << "..."<<endl;
    }
}

Measured memory_bytes: 3628
{-# LANGUAGE BangPatterns #-}
{-# LANGUAGE BinaryLiterals #-}
{-# LANGUAGE MultiWayIf #-}
{-# LANGUAGE NumDecimals #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE TupleSections #-}

import Control.Applicative
import Control.Arrow
import Control.Monad
import Control.Monad.ST

import Data.Char
import Data.List
import Data.Maybe

import qualified Data.ByteString.Char8 as B

import Data.Array.ST.Safe
import Data.STRef

import Debug.Trace
import Text.Printf

readInt = readLn :: IO Int
readInteger = readLn :: IO Integer
readInts = map ( fst . fromJust . B.readInt ) . B.words <$> B.getLine
readIntegers = map ( fst . fromJust . B.readInteger ) . B.words <$> B.getLine

which a b f = if f then a else b
mp [ a, b ] = ( a, b )

modifyArray a i f = writeArray a i =<< f <$> readArray a i

main = do
	[ s, t ] <- words <$> getLine
	[ a, b ] <- readInts
	u <- getLine
	uncurry ( printf "%d %d\n" ) $ if u == s
		then ( a - 1, b )
		else ( a, b - 1 )

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

int main(){
    int n;
    cin >> n;
    for(int i = 0 ; i< n ; i ++ ){
        string s ;
        cin >> s ;

        if (s =="Y"){
            cout << "Four" << endl;
            break;
        }

        if (i+1 == n){
            cout <<"Three" <<endl;
        }
    }
}

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

int main()
{
    int N;
    cin >> N;
    vector<int> a(N);
    int alice_sum = 0;
    int bob_sum = 0;
    int ans;

    for (int i = 0; i < N; i++)
    {
        cin >> a[i];
    }
    sort(a.begin(), a.end(), greater<int>());

    for (int i = 0; i < N; i++)
    {
        if (i % 2 == 0)
        {
            alice_sum += a[i];
        }
        else
        {
            bob_sum += a[i];
        }
    }
    ans = alice_sum - bob_sum;

    cout << ans << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
const int N=100005;
struct edge{
	int to,next;
}e[N*2];
int head[N],tot;
int f[N],n,ans;
void add(int x,int y){
	e[++tot]=(edge){y,head[x]};
	head[x]=tot;
}
void dfs(int x,int fa){
	int has=0,bad=0;
	for (int i=head[x];i;i=e[i].next)
		if (e[i].to!=fa){
			dfs(e[i].to,x);
			bad|=(has&f[e[i].to]);
			has|=f[e[i].to];
		}
	int tmp=16;
	for (;tmp>=0;tmp--)
		if (bad&(1<<tmp)) break;
	for (tmp++;has&(1<<tmp);tmp++);
	f[x]=(has&((1<<17)-(1<<tmp)))|(1<<tmp);
	ans=max(ans,tmp);
}
int main(){
	scanf("%d",&n);
	for (int i=1;i<n;i++){
		int x,y;
		scanf("%d%d",&x,&y);
		add(x,y); add(y,x);
	}
	dfs(1,0);
	printf("%d\n",ans);
}

Measured memory_bytes: 7168
#include<stdlib.h>
#include<stdio.h>
#include<string.h>

typedef struct Node
{
    int key;
    struct Node *prev, *next;
} Node;

struct Node *nil;

void initlist()
{
    nil = (Node *)malloc(sizeof(Node));
    nil->next = nil;
    nil->prev = nil;
}

void insertNode(int key)
{
    Node *x = (Node *)malloc(sizeof(Node));
    x->key = key;
    x->next = nil->next;
    nil->next->prev = x;
    nil->next = x;
    x->prev = nil;
}

Node* listSearch(int key)
{
    Node *cur = nil->next;
    while (cur != nil && cur->key != key)
    {
        cur = cur->next;
    }
    return cur;
}
void deleteNode(Node *t)
{
    if (t == nil)
    {
        return;
    }
    t->prev->next = t->next;
    t->next->prev = t->prev;
    free(t);
}

void deleteFirst()
{
    deleteNode(nil->next);
}

void deleteLast()
{
    deleteNode(nil->prev);
}

void deleteKey(int key)
{
    deleteNode(listSearch(key));
}

void printList()
{
    Node *cur = nil->next;
    int isf = 0;
    while (1)
    {
        if (cur == nil)
        {
            break;
        } else if(isf++ > 0)
        {
            printf(" ");
        }
        printf("%d", cur->key);
        cur = cur->next;
    }
    printf("\n");
}

int main()
{
    int key, n;
    char comm[15];

    scanf("%d", &n);

    initlist();
    for (int i = 0; i < n; i++)
    {
        scanf("%s%d", comm, &key);
        if (comm[0] == 'i')
        {
            insertNode(key);
        } else if (comm[0] == 'd')
        {
            if (strlen(comm) > 6)
            {
                if (comm[6] == 'F')
                {
                    deleteFirst();
                } else if (comm[6] == 'L')
                {
                    deleteLast();
                }
            } else
            {
                deleteKey(key);
            }
            
        }
        
    }
    
    printList();
    return 0;
}


Measured memory_bytes: 33000
#include<bits/stdc++.h>
using namespace std;
int main(){
  string S;
  cin >> S;
  int n = S.size()-1;
  char a[201];
  for(int i = 0; i < S.size();i++){
    a[i] = S.at(i);
  }
  for(int n = S.size()-1; n > 0; n--){
  bool b = true;
  if(n%2 != 0){
    b = false;
  }
  else{
    for(int j = 0; j <n/2; j++){
    if(a[j] != a[(n/2)+j]){
      b = false;
    }
  }
  }
  if(b == true){
    cout << n << endl;
    return 0;
  }
}
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cctype>
#include <cstring>
#include <cmath>
#include <cstdarg>
#include <cstdlib>
#include <string>

#include <vector>
#include <tuple>
#include <queue>
#include <algorithm>
using namespace std;

int main(int argc, char const *argv[])
{
    string S, T;
    cin >> S >> T;
    int ind = -1;
    for (int i = 0; i < S.size() - T.size() + 1; i ++) {
        int f = 1;
        for (int j = 0; j < T.size(); j ++) {
            if (S[i + j] !='?' && S[i + j] != T[j]) {
                f = 0;
                break;
            }
        }
        if (f) {
            ind = i;
        }
    }
    if (ind == -1) {
        cout << "UNRESTORABLE" << endl;
        return 0;
    } else {
        for (int j = 0; j < T.size(); j ++) {
            S[ind + j] = T[j];
        }
    }
    for (int i = 0; i < S.size(); i ++) {
        if (S[i] == '?') {
            cout << "a";
        } else {
            cout << S[i];
        }
    }
    cout << endl;
    return 0;
}

Measured memory_bytes: 256
N = int(input())
T, A = map(int, input().split())
H = list(map(int, input().split()))
def avetem(x):
  return T-x*0.006
B = []
for i in range(N):
  B.append(abs(A-avetem(H[i])))
print((B.index(min(B))+1))

Measured memory_bytes: 3060
#include<bits/stdc++.h>
#define pii pair<int,int>
#define F first
#define S second
#define mp make_pair
#define ll long long
using namespace std;
const int N=1e5+5;
ll n,x[N],sum;
int main()
{
	cin>>n;
	for(int i=1;i<=n;i++)cin>>x[i],sum+=x[i];
	for(int i=2;i<=n;i+=2)sum-=x[i]*2;
	cout<<sum<<' ';
	for(int i=1;i<n;i++)
	{
		sum=x[i]*2-sum;
		cout<<sum<<' ';
	}
	return 0;
}

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

#define endl '\n'
#define ll long long
#define ii pair<int,int>
#define vi vector<int>
#define vii vector<ii>
#define vvi vector<vi>
#define add push_back
#define MAXN 200005

int main(){ios_base::sync_with_stdio(false);

    int a, b, c, d;
    cin>>a>>b>>c>>d;
    
    if((a+d-1)/d>=(c+b-1)/b) cout << "Yes" << endl;
    else cout << "No" << endl;

    return 0;
}



Measured memory_bytes: 3616
<?php
$n = trim(fgets(STDIN));

for ($i = 0; $i < $n; $i++) {
    $stdin = explode(' ', trim(fgets(STDIN)));
    sort($stdin);
    //var_dump($stdin);
    if($stdin[0]*$stdin[0] + $stdin[1]*$stdin[1] ==
       $stdin[2]*$stdin[2]){
        echo "YES". PHP_EOL;
    }else{
        echo "NO". PHP_EOL;
    }
}

Measured memory_bytes: 6572
using System;
 
namespace Sample
{
  class Sample
  {
    static void Main(string[] args)
    {
    string[] input=Console.ReadLine().Split(' ');
    int a =int.Parse(input[0]);
    int b =int.Parse(input[1]);
    
      int coins =(a+b);
      int toy=int.Parse(input[2]);
      if(coins >= toy)
      {
      Console.WriteLine("Yes");
      }else{
        Console.WriteLine("No");
      }
    }
    
  }
}

Measured memory_bytes: 11092
# -*- coding: utf-8 -*-
# x = p * b + q
# 0 <= q < b
# int(a * p + a * q / b) - a * int(p - q / b)
# = a * p + int(a * q / b) - a * p
# = int(a * q / b)

a, b, n = map(int, input().split())

print(a * min(b - 1, n) //  b)


Measured memory_bytes: 9092
# -*- coding: utf-8 -*-
from collections import defaultdict
def inpl(): return list(map(int, input().split()))
N, M = inpl()
A = [""]*M
P = [[] for _ in range(N+1)]
for i in range(M):
    p, y = inpl()
    P[p].append((y, i))

for p, prefecture in enumerate(P):
    prefecture = sorted(prefecture, key=lambda x: x[0])
    for j, (y, i) in enumerate(prefecture):
        A[i] = "{}{}".format(str(p).zfill(6), str(j+1).zfill(6))

print(*A, sep="\n")

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

using namespace std;

#define int 		long long
#define endl 		"\n"
#define mod 		1000000007
#define inf 		1e18
#define IOS 		ios::sync_with_stdio(0), cin.tie(0), cout.tie(0)

int32_t main() {

	IOS;

	int n;
	cin >> n;

	int x = 1, y = 1, z = 1;

	for (int i = 0; i < n; i++) {
		(x *= 10) %= mod;
		(y *= 9) %= mod;
		(z *= 8) %= mod;
	}

	(y *= 2) %= mod;

	int ans = (((x + z - y) % mod) + mod) % mod;

	cout << ans;

	return 0;
}

Measured memory_bytes: 3644
// Aizu 0215: Pachimon Creature
// 2017.9.9 bal4u@uu

#include <stdio.h>
#include <string.h>

#define abs(a)  ((a)>=0?(a):-(a))
#define INF 0x7fffffff
#define MAX 50000
typedef struct { int t, r, c, k; } QUE;
QUE que[MAX]; int qsize;

#define PARENT(i) ((i)>>1)
#define LEFT(i)   ((i)<<1)
#define RIGHT(i)  (((i)<<1)+1)

void min_heapify(int i)
{
  int l, r;
  int smallest;

  l = LEFT(i), r = RIGHT(i);
  if (l < qsize && que[l].t < que[i].t) smallest = l; else smallest = i;
  if (r < qsize && que[r].t < que[smallest].t) smallest = r;
  if (smallest != i) {
    QUE t = que[i]; que[i] = que[smallest]; que[smallest] = t;
    min_heapify(smallest);
  }
}

int deq(int *r, int *c, int *k)
{
  if (qsize == 0) return 0;
  *r = que[0].r, *c = que[0].c, *k = que[0].k;
  que[0] = que[--qsize];
  min_heapify(0);
  return 1;
}

void enq(int r, int c, int t, int k)
{
  int i, ii;

  i = qsize++;
  que[i].r = r, que[i].c = c, que[i].t = t, que[i].k = k;
  while (i > 0 && que[ii = PARENT(i)].t > que[i].t) {
    QUE tt = que[i]; que[i] = que[ii]; que[ii] = tt;
    i = ii;
  }
}

typedef struct { int r, c; } TBL;
TBL start, goal, tbl[5][1002]; int len[5];
int node[1002][1002][5];
char map[1002][1002]; int w, h;

int search(int item)
{
	int r, c, r2, c2, i, k, fin, f, f2;
	TBL *tp;

	qsize = 0;
	memset(node, -1, sizeof(node));
	fin = (item + 4) % 5;
	node[start.r][start.c][item] = 0;
	enq(start.r, start.c, 0, item);
	while(deq(&r, &c, &f)) {
		if (r == goal.r && c == goal.c) continue;
		f2 = f + 1; if (f2 >= 5) f2 = 0;
		if (f == fin) {
			r2 = goal.r, c2 = goal.c;
			k = node[r][c][f] + abs(r2 - r) + abs(c2 - c);
			if (node[r2][c2][f] < 0 || k < node[r2][c2][f]) node[r2][c2][f] = k, enq(r2, c2, k, f);
		} else for (tp = tbl[f2], i = 0; i < len[f2]; i++, tp++) {
			r2 = tp->r, c2 = tp->c;
			k = node[r][c][f] + abs(r2 - r) + abs(c2 - c);
			if (node[r2][c2][f2] < 0 || k < node[r2][c2][f2]) node[r2][c2][f2] = k, enq(r2, c2, k, f2); 
		}
	}
	return node[goal.r][goal.c][fin];
}

int main()
{
	int r, c, i, ii, ans, f[5], s, g, k;

	while (scanf("%d%d", &w, &h) && w) {
		for (r = 0; r < h; r++) scanf("%s", map[r]);
		memset(len, 0, sizeof(len)), memset(f, 0, sizeof(f));
		for (s = g = r = 0; r < h; r++) for (c = 0; c < w; c++) {
			char cc = map[r][c];
			if      (cc == 'S') start.r = r, start.c = c, s = 1;
			else if (cc == 'G') goal.r = r, goal.c = c, g = 1;
			else if (cc >= '1' && cc <= '5') {
				cc -= '1', f[cc] = 1;
				tbl[cc][len[cc]].r = r, tbl[cc][len[cc]].c = c, len[cc]++;
			}
		}
		for (k = i = 0; i < 5; i++) { k += f[i]; if (!f[i]) ii = i; }
		if (!s || !g || k < 4) puts("NA");
		else {
			int k1, k2;
			if (k == 4) k1 = k2 = ii; else k1 = 0, k2 = 4;
			for (ans = INF, i = k1; i <= k2; i++) if ((k = search(i)) < ans) ans = k, ii = i;
			printf("%d %d\n", ii+1, ans);
		}
	}
	return 0;
}

Measured memory_bytes: 22576
#include <stdio.h>

int main(){
	int a[6],sum=0,min=100;
	for (int i=0;i<6;i++) scanf("%d",a+i);
	for (int i=0;i<6;i++) sum += a[i];
	for (int i=0;i<4;i++) min = (min > a[i])?(a[i]):(min);
	sum -= min;
	sum -= (a[4] < a[5])?a[4]:a[5];
	printf("%d\n",sum);
}

Measured memory_bytes: 2656
#include <bits/stdc++.h>
#define INF 1e18
#define int long long
#define Rep(i, a, n) for (int i = (a); i < (n); i++)
#define Repr(i, n, a) for (int i = (n); i >= (a); i--)
#define rep(i, n) Rep(i, 0, n)
#define repr(i, n) Repr(i, n, 0)
#define all(a) a.begin(), a.end()
using namespace std;
typedef pair<int, int> P;
typedef pair<int, P> PP;
const int mod = 1000000007;

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

    int a, b, t;
    cin >> a >> b >> t;
    cout << b * (t / a) << endl;
}

Measured memory_bytes: 256
#include <cstdio>
using namespace std;
typedef long long ll;
ll A, B, ans = 1;
ll gcd(ll a, ll b) {
  if(b == 0) return a;
  return gcd(b, a%b);
}
int main() {
  scanf("%ld %ld", &A, &B);
  ll M = gcd(A, B), n = M;
  for(ll i = 2; i*i <= M; ++i) {
    if(n%i != 0) continue;
    while(n%i == 0) n /= i;
    ++ans;
  }
  if(n != 1) ++ans;
  printf("%ld\n", ans);
}

Measured memory_bytes: 128
#include <iostream>
#include <map>
using namespace std;
using LL=long long;
map<pair<int,int>,int>mp;
LL ans[10];
int main(){
  int H,W,N;
  cin>>H>>W>>N;
  for(int n=0;n<N;n++){
    int h,w;
    scanf("%d%d",&h,&w);
    for(int i=-2;i<=0;i++)for(int j=-2;j<=0;j++){
      if(1<=h+i&&h+i<=H-2&&1<=w+j&&w+j<=W-2){
        mp[{h+i,w+j}]++;
      }
    }
  }
  for(auto m:mp){
    ans[m.second]++;
  }
  ans[0]=(LL)(H-2)*(W-2)-mp.size();
  for(LL a:ans)cout<<a<<endl;
}

Measured memory_bytes: 56448
//
// Created by 10034 on 2020/7/24.
//

#include <iostream>
using namespace std;
int ans[10010];
int main(){
    int n;
    cin>>n;
    for(int x=1;x<=100;++x){
        for(int y=1;y<=100;++y){
            for(int z=1;z<=100;++z){
                if(x*x+y*y+z*z+x*y+y*z+x*z<=n){
                    ans[x*x+y*y+z*z+x*y+y*z+x*z]++;
                }
            }
        }
    }
    for(int i=1;i<=n;++i)
        cout<<ans[i]<<endl;
    return 0;
}

Measured memory_bytes: 3176
#include<iostream>
#include<cstring>
using namespace std;
int main(){
	char stra[21],strb[21];
	int a,c;
	cin>>stra;
	a = strlen(stra);
	for(int i=0;i<a;i++){
		c = a - i -1;
		strb[i]=stra[c];
	strb[i+1]='\0';
	}
	cout<<strb<<endl;	
}

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

typedef unsigned long long ull;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> PII;
typedef pair<ll, int> PILL;
typedef pair<ll, ll> PLL;

const int MAX_N = 1e5+5;
const int M = 1e6;
const ll INF = (ll)(1e18);
const int inf = 1e9;
const ll MOD = 1000000007LL;

void solve() {

}

int n;
string s;
unordered_map<string, PII> mp;

bool check(int len) {
    if (len == 0) return true;
    mp.clear();
    for (int i=0; i+len<=n; i++) {
        string tmp = s.substr(i, len);
        PII p = {i, i+len-1};
        if (mp.find(tmp) == mp.end()) {
            mp[tmp] = p;
            continue;
        }
        PII cur = mp[tmp];
        if (cur.second < p.first) {
            return true;
        }
    }
    return false;
}

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

    cin >> n >> s;
    int left = 0;
    int right = n/2;

    while (left < right) {
        int mid = (left+1+right)/2;
        if (check(mid)) {
            left = mid;
        } else {
            right = mid-1;
        }
    }

    cout << left;

    return 0;
}


Measured memory_bytes: 6692
#include <stdio.h>

int main(void)
{
    int a, b, c;

    scanf("%d %d %d", &a, &b, &c);

    if (a > b && b > c)
    {
        printf("%d %d %d\n", c, b, a);
    }
    else if (a < b && b > c && a <= c)
    {
        printf("%d %d %d\n", a, c, b);
    }
    else if (a > b && b < c && a <= c)
    {
        printf("%d %d %d\n", b, a, c);
    }
    else if (a > b && b <= c && c < a)
    {
        printf("%d %d %d\n", b, c, a);
    }
    else if (a >= b && b > c && a > c)
    {
        printf("%d %d %d\n", c, a, b);
    }
    else
    {
        printf("%d %d %d\n", a, b, c);
    }
    return 0;
}


Measured memory_bytes: 2716
#include<stdio.h>
#include<string.h>
int main(){
  char s1[1001];
  int sum=0,i;
  while(1){
    scanf("%s",s1);
    if(s1[0]=='0') break;
    int len=strlen(s1);
    for(i=0;i<len;i++){
      sum+=s1[i]-'0';
    }
    printf("%d\n",sum);
    sum=0;
  }
  return(0);
}

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

int main() {
    string s;
    cin >> s;
    int len = 0;
    int maxlen = 0;
    unordered_set<char> atgc = { 'A', 'T', 'G', 'C' };
    for (char c : s) {
        if (atgc.find(c) != atgc.end()) {
            len++;
            maxlen = max(maxlen, len);
        } else {
            len = 0;
        }
    }
    cout << maxlen << endl;
}

Measured memory_bytes: 256
import java.util.*;

//081C
public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		int N = sc.nextInt();
		int K = sc.nextInt();
		int A[] = new int[N];
		for(int i=0;i<N;i++)A[i]=sc.nextInt()-1;//A ：0~N-1
		sc.close();
		
		Set<Integer> s = new HashSet<Integer>();
		
		int cnt[] = new int[N]; //各数字の登場回数
		
		for(int i=0;i<N;i++) {
			cnt[A[i]]++;
			s.add(A[i]);
		}
		
		int num[] = new int[N+1];
		for(int i=0;i<N;i++) {
			num[cnt[i]]++; //配列の要素番号が、登場回数、要素が使える回数。
		}
		
		int change = Math.max(0, s.size() - K) ;
		
		int last = 0;
		for(int i=N-1;i>=0;i--) {
			if(num[i]!=0) {
				last=i;
				break;
			}
		}
		
		int ans = 0;
		int changed = 0;
		int i=1;
		while(changed<change) {
			if(num[i]==0) {
				i++;
				continue;
			}
			ans += i;
			num[i]--;
			num[last]--;
			last+=i;
			num[last]++;
			changed++;
		}
		
		System.out.println(ans);
		
	}
}


Measured memory_bytes: 91120
#include <bits/stdc++.h>
#include <ext/rope>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
//#pragma GCC optimize("Ofast")
//#pragma GCC optimize("unroll-loops")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#define ll long long
#define int long long
#define pb push_back
#define x first
#define ld long double
#define y second
#define mk(a,b) make_pair(a,b)
#define rr return 0
#define sqr(a) ((a)*(a))
#define all(a) a.begin(),a.end()

using namespace std;
using namespace __gnu_cxx;
using namespace __gnu_pbds;
template<class value, class cmp = less<value> >
using ordered_set = tree<value, null_type, cmp, rb_tree_tag, tree_order_statistics_node_update>;
template<class value, class cmp = less_equal<value> >
using ordered_multiset = tree<value, null_type, cmp, rb_tree_tag, tree_order_statistics_node_update>;
template<class key, class value, class cmp = less<key> >
using ordered_map = tree<key, value, cmp, rb_tree_tag, tree_order_statistics_node_update>;

/// find_by_order()
/// order_of_key()
mt19937 rng(chrono::high_resolution_clock::now().time_since_epoch().count());
inline int randll(int l = INT_MIN, int r = INT_MAX) {
    return uniform_int_distribution<int>(l, r)(rng);
}
main()
{
    ios::sync_with_stdio(0);
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int n, ans = 0;
    cin >> n;
    int r = -1e10;
    vector <pair<int, int> > a(n);
    for (int i = 0; i < n; i++) {
        cin >> a[i].x >> a[i].y;
        tie(a[i].x, a[i].y) = mk(a[i].x - a[i].y, a[i].x + a[i].y);
    }
    sort(all(a));
    for (int i = 0; i < n; i++) {
        if (a[i].x >= r) {
            ++ans;
            r = a[i].y;
        }
        else {
            if (a[i].y < r) {
                r = a[i].y;
            }
        }
    }
    cout << ans << '\n';
}


Measured memory_bytes: 1792
#include <iostream>
#include <algorithm>
using namespace std;
 
int main() {
    int n;
    int counter;
    int a[100100];
  
    cin >> n;
    for (int i = 0; i < n; ++i) cin >> a[i];
  
    counter = 0;
  
    for (int i = 0; i < n; ++i) {
      if(a[i] % 2 == 1){
        counter = counter + 1;
      }
    }
    
    if (counter % 2 == 0) { 
         cout << "YES" << endl;   
        }
        else { 
           cout << "NO" << endl; 
        }        
}

Measured memory_bytes: 640