akhauriyash/Code-Regression huggingface dataset:
import math

c60 = math.cos(math.radians(60))
s60 = math.sin(math.radians(60))

def koch(d, p1, p2):
    """ Print the coordinates of the vertices of Koch Curve.
    d is the depth of recursion.
    p1, p2 are coordinates of end point of the initial state.
    """
    if d == 0:
        return

    sx = (2 * p1[0] + p2[0]) / 3
    sy = (2 * p1[1] + p2[1]) / 3

    tx = (p1[0] + 2 * p2[0]) / 3
    ty = (p1[1] + 2 * p2[1]) / 3

    dx = tx - sx
    dy = ty - sy

    ux = dx * c60 - dy * s60 + sx
    uy = dx * s60 + dy * c60 + sy

    koch(d - 1, p1, (sx, sy))
    print("{0:.8f} {1:.8f}".format(sx, sy))

    koch(d - 1, (sx, sy), (ux, uy))
    print("{0:.8f} {1:.8f}".format(ux, uy))

    koch(d - 1, (ux, uy), (tx, ty))
    print("{0:.8f} {1:.8f}".format(tx, ty))

    koch(d - 1, (tx, ty), p2)


n = int(input())

ax = 0
ay = 0

bx = 100
by = 0

print("{0:.8f} {1:.8f}".format(ax, ay))
koch(n, (ax, ay), (bx, by))
print("{0:.8f} {1:.8f}".format(bx, by))


Measured memory_bytes: 5768
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <tuple>
#include <map>
using namespace std;
using ll = long long;

int main(){
        int x,y,z,i,ia=0,ib=0,ic=0,cnt=0;
        ll k;
        cin >> x >> y >> z >> k;
        vector<ll> a(x);
        vector<ll> b(y);
        vector<ll> c(z);
        for(i=0;i<x;++i) cin >> a.at(i);
        for(i=0;i<y;++i) cin >> b.at(i);
        for(i=0;i<z;++i) cin >> c.at(i);
        sort(a.rbegin(), a.rend());
        sort(b.rbegin(), b.rend());
        sort(c.rbegin(), c.rend());
        priority_queue<tuple<ll,int,int,int>> q;
        map<tuple<int,int,int>,int> mp;
        q.push({a.at(ia)+b.at(ib)+c.at(ic),ia,ib,ic});
        ++mp[{ia,ib,ic}];
        while(1){
                cout << get<0>(q.top()) << endl;
                ia = get<1>(q.top()); ib = get<2>(q.top()); ic = get<3>(q.top());
                q.pop(); ++cnt;
                if(cnt==k) return 0;
                if(ia<x-1){
                        if(mp[{ia+1,ib,ic}]==0){
                                q.push({a.at(ia+1)+b.at(ib)+c.at(ic),ia+1,ib,ic});
                                ++mp[{ia+1,ib,ic}];
                        }
                }
                if(ib<y-1){
                        if(mp[{ia,ib+1,ic}]==0){
                                q.push({a.at(ia)+b.at(ib+1)+c.at(ic),ia,ib+1,ic});
                                ++mp[{ia,ib+1,ic}];
                        }
                }
                if(ic<z-1){
                        if(mp[{ia,ib,ic+1}]==0){
                                q.push({a.at(ia)+b.at(ib)+c.at(ic+1),ia,ib,ic+1});
                                ++mp[{ia,ib,ic+1}];
                        }
                }
        }
}

Measured memory_bytes: 4136
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
typedef long long ll;
/////////////////////////////////
int main()
{
    string s;
    cin >> s;
    bool ok = true;
    rep(i, 3)
    {
        if (s[i] == s[i + 1])
            ok = false;
    }
    if (ok)
        cout << "Good" << endl;
    else
        cout << "Bad" << endl;
}

Measured memory_bytes: 3628
#include <iostream>
using namespace std;
using ll = long long;

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

    ll A, B; cin >> A >> B;
    if (A & 1) {
        if (B & 1)
            cout << ((B - A) / 2 & 1 ^ A) << "\n";
        else
            cout << ((B - A - 1) / 2 & 1 ^ A ^ B) << "\n";
    }
    else {
        if (B & 1)
            cout << ((B - A + 1) / 2 & 1) << "\n";
        else
            cout << ((B - A) / 2 & 1 ^ B) << "\n";
    }
}

Measured memory_bytes: 256
import java.util.*;
import java.io.*;

class Main {
 public static void main(String[] args){
  Scanner in = new Scanner(System.in);
  while(in.hasNext()){
   int num = in.nextInt();
   boolean first = true;
   int beki = 1;
   while(num != 0){
    if(num % 2 == 1){
     if(!first){ System.out.print(" "); }
     System.out.print(beki);
     first = false;
    }
    num = num / 2;
    beki = beki * 2;
   }
   System.out.println();
  }
 }
 
}

Measured memory_bytes: 25996
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0; i<n; i++)
#define rrep(i,n) for(int i=n-1; i>=0; i--)

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> pi;
typedef long double lb;

const int INF=1<<27;
const int MOD=(int)1e9+7;

int main(void)
{
        ll x,y;
        cin >> x >> y;
        ll ans;
        for(ans=0;(ll)pow(2,ans)*x<=y;ans++);
        cout << ans << endl;
        return 0;
}



Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
typedef long long ll;

int main()
{
    string s;
    int k;
    cin>>s>>k;
    int n=s.size();
    int c=0;
    string v;
    vector<string> ss(5*n,"zzzzzz");
    for(int i=0;i<n;i++){
        ss[c]=s[i];
        c++;
    }
    for(int i=0;i<n-1;i++){
        ss[c]=s[i];
        ss[c]+=s[i+1];
        c++;
    }
    for(int i=0;i<n-2;i++){
        ss[c]=s[i];
        ss[c]+=s[i+1];
        ss[c]+=s[i+2];
        c++;
    }
    for(int i=0;i<n-3;i++){
        ss[c]=s[i];
        ss[c]+=s[i+1];
        ss[c]+=s[i+2];
        ss[c]+=s[i+3];
        c++;
    }
    for(int i=0;i<n-4;i++){
        ss[c]=s[i];
        ss[c]+=s[i+1];
        ss[c]+=s[i+2];
        ss[c]+=s[i+3];
        ss[c]+=s[i+4];
        c++;
    }
    sort(all(ss));

    //for(int i=0;i<n*5;i++){
      //  cout<<ss[i]<<" ";
    //}

    int x=1;
    if(k==1){
        cout<<ss[0]<<endl;;
    }
    else{
    for(int i=1;i<c;i++){
        if(ss[i-1]==ss[i]){
            continue;
        }
        else{
            x++;
            if(x==k){
                cout<<ss[i]<<endl;
            }
        }
    }
    }
    
}

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

class Main {
  public static void main(String[] args) throws IOException {
    BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    String str = br.readLine();
    String tbdLine = "2019/05/01";
    String ans = "";
    if (str.compareTo(tbdLine) < 0) {
      ans = "Heisei";
    } else if (str.compareTo(tbdLine) >= 0) {
      ans = "TBD";
    }
    System.out.println(ans);
  }
}

Measured memory_bytes: 22484
while 1:
    x,y,z=raw_input().split()
    x=int(x)
    z=int(z)
    if(y=='?'):
        break
    if(y=='+'):
        print x+z
    if(y=='-'):
        print x-z
    if(y=='/'):
        print x/z
    if(y=='%'):
        print x%z
    if(y=='*'):
        print x*z

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



  
int main() 
{ 
    ios_base::sync_with_stdio(false); 
    cin.tie(NULL);
    ll d,s,t;cin>>d>>t>>s;
    ll k=d/s;
    if(d%s!=0)k+=1;
    if(k<=t)cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
   
      
    return 0; 
} 

Measured memory_bytes: 3608
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#define MOD1 1000000007
#define MOD2 998244353
#define LIMIT1 200002
#define LIMIT2 500002
typedef long long ll;
typedef long double ld;
#define rep(i,n) for(i=0;i<n;i++)
#define max(a,b) ((a)>(b) ? (a) : (b))
#define min(a,b) ((a)<(b) ? (a) : (b))
#define zt(a,b) (max(a,b)-min(a,b))
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll nPr(int n,int r){ll i,result=1;rep(i,r){result*=(ll)(n-i);}return result;}
ll nCr(int n,int r){ll i,result=1; rep(i,min(r,n-r)){result*=(ll)(n-i);result/=(ll)(i+1);}return result;}
#define fact(n) nPr((int)n,(int)n)
#define nHr(n,r) nCr((int)(n+r+1),(int)r)
#define sankaku(x) ((1+x)*x)/2
int dx[8]={1,0,-1,0,1,-1,-1,1};
int dy[8]={0,1,0,-1,1,1,-1,-1};
int upint(const void *a, const void *b) { return *(int *)a < *(int *)b ? -1 : *(int *)a > *(int *)b ? 1 : 0; }
int downint(const void *a, const void *b) { return *(int *)a < *(int *)b ? 1 : *(int *)a > *(int *)b ? -1 : 0; }
int upchar(const void* left, const void* right) {return strcmp((char *)left,(char *)right);}
int downchar(const void* left, const void* right) {return strcmp((char *)right,(char *)left);}
void initialize(){
  
}
int main(void){
  initialize();
  ll n,m,i,j,result=0;
  int a[LIMIT2]={0};
  char s[LIMIT1];

  scanf("%lld",&n);
  for(i=1;i<=n;i++){
    if(i % 3 == 0 || i % 5 == 0) continue;
    else result+=i;
  }
  printf("%lld",result);

  return 0;
}



Measured memory_bytes: 1728
//敗因　その発想はなかった
//二つに一定数振り分ける際に、大きい二つに分けて、その大きいものの中で影響が出ない状況下で小さいものを作って増やすのも手

#include<iostream>

using namespace std;

int A, B;
bool fld[100][100];

int main() {
	cin >> A >> B;
	cout << 100 << " " << 100 << endl;
	for (int i = 50; i < 100; i++) {
		for (int j = 0; j < 100; j++) {
			fld[i][j] = true;
		}
	}
	A--, B--;
	//Aの配置
	for (int i = 1; i < 49; i += 2) {
		for (int j = 1; j < 100; j += 2) {
			if (A == 0)goto endfirst;
			A--;
			fld[i][j] = true;
		}
	}
endfirst:;
	//Bの配置
	for (int i = 51; i < 100; i += 2) {
		for (int j = 1; j < 100; j += 2) {
			if (B == 0)goto endsecond;
			B--;
			fld[i][j] = false;
		}
	}
endsecond:;
	for (int i = 0; i < 100; i++) {
		for (int j = 0; j < 100; j++) {
			if (fld[i][j])cout << ".";
			else cout << "#";
		}
		cout << endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define MOD (ll)(1e9+7)
#define M(x) ((x+MOD)%MOD)
#define MAX 200010

int p[MAX], A, B, C, D, n;

//判断路上是否有相邻的三个plain,有返回1
int bfs(int st, int ed)
{
	for (int i = st - 1;i <= ed - 1;++i)
		if (p[i] && p[i + 1] && p[i + 2]) return 1;
	return 0;
}

//判断路上是否有相邻的两个障碍物,有返回1
int bfs2(int st, int ed)
{
	for (int i = st + 1;i <= ed - 2;++i)
		if (!p[i] && !p[i + 1]) return 1;
	return 0;
}

int main()
{
	string str;
	scanf("%d%d%d%d%d", &n, &A, &B, &C, &D);
	cin >> str;
	for (int i = 0;i < str.length();++i)
		p[i + 1] = (str[i] == '.' ? 1 : 0);
	//1表示可以走，0表示不能走
	if (C < D)
	{
		if (!bfs2(B, D) && !bfs2(A, C))
			printf("Yes\n");
		else
			printf("No\n");
	}
	else
		if (bfs2(A, C))
			printf("No\n");
		else
		{
			if (bfs(B, D))
				printf("Yes\n");
			else
				printf("No\n");
		}
	return 0;
}

Measured memory_bytes: 1284
#include"bits/stdc++.h"

using namespace std;
using ll = long long;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;

#define FOR(k,m,n) for(ll (k)=(m);(k)<(n);(k)++)
#define REP(i,n) FOR((i),0,(n))
#define WAITING(str) int str;std::cin>>str;
#define DEBUGING(str) cout<<str<<endl

constexpr int INF = (1 << 30);
constexpr ll INFL = (1ll << 60);
constexpr ll MOD = 1000000007;// 10^9+7

int N;
vector<vector<vector<ld>>> dp;

ld solve(int x, int y, int z)
{
	if(dp[x][y][z] != -1)return dp[x][y][z];
	dp[x][y][z] = 0;

	ld num = (ld)1.* N / (N - z);
	if(x != N)dp[x][y][z] += (solve(x + 1, y, z) + num)*(N - x) / (N - z);
	if(y != x)dp[x][y][z] += (solve(x, y + 1, z) + num)*(x - y) / (N - z);
	if(z != y)dp[x][y][z] += (solve(x, y, z + 1) + num)*(y - z) / (N - z);
	return dp[x][y][z];
}

//メイン関数
int main()
{
	cin >> N;
	vector<int> cnt(4);
	REP(i, N)
	{
		int a;
		cin >> a;
		cnt[3 - a]++;
	}
	for(int i = 3; i > 0; i--)cnt[i - 1] += cnt[i];
	dp.resize(N + 1, vector<vector<ld>>(N + 1, vector<ld>(N + 1, -1)));
	dp[N][N][N] = 0;
	cout << fixed << setprecision(12) << solve(cnt[1], cnt[2], cnt[3]) << endl;

	return 0;
}


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

int main()
{
	long long int x,k;
	cin>>k>>x;
	int i=x-k+1;
	int j=(k-1)*2+1;
	for(int k=0;k<j;k++) {cout<<i<<' ';i++;}
	cout<<endl;
return 0;
}

Measured memory_bytes: 3488
/*
ID: anonymo14
TASK: wormhole
LANG: C++                 
*/
#include<bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<pair<int,int>> vpii;

#define F first
#define S second
#define PU push
#define PUF push_front
#define PUB push_back
#define PO pop
#define POF pop_front
#define POB pop_back

#define REP(i,a,b) for(int i=a; i<=b; i++)

#define MOD 1000000007

void solve(int test_case) {//227
	int n;
	cin>>n;
	int ans=0;
	for(int i=1;i<=n;i+=2) {
		int cnt=0;
		REP(j,1,i)if(i%j==0)cnt++;
		if(cnt==8)ans++;
	}
	cout<<ans;
}

int main() {
	
	////// FILE BASED IO////
	//freopen("wormhole.in", "r", stdin);
	//freopen("wormhole.out", "w", stdout);
	///////////////
	
	ios::sync_with_stdio(0);
	cin.tie(0);
	int t=1;
	//cin>>t;
	REP(i,1,t) {
		solve(i);
	}
	return 0;
}	


Measured memory_bytes: 3536
#include<bits/stdc++.h>
using namespace std;
using Int = long long;
//INSERT ABOVE HERE
signed main(){
  Int a,b,c,k;
  cin>>a>>b>>c>>k;
  Int x=max({a,b,c});
  Int s=a+b+c-x;
  for(Int i=0;i<k;i++) x<<=1;
  cout<<s+x<<endl;
  return 0;
}


Measured memory_bytes: 384
// ~/BAU/ACM-ICPC/Teams/Rampage/Corvus
// ~/sudo apt-get verdict Accpeted

#include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <memory.h>
#include <limits.h>
#include <math.h>
#include <string.h>
#include <string>
#include <cstring>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <bitset>
#include <functional>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
const int N = 205;
const ll MOD = 1e9 + 7;
const double eps = 1e-9;

struct cmp {
	bool operator()(const vector<ll> &a, const vector<ll> &b) const {
		for (int i = 1; i < a.size(); i++) {
			if (a[i] - a[i - 1] != b[i] - b[i - 1])
				return a[i] - a[i - 1] < b[i] - b[i - 1];
		}
		return false;
	}
};

int n;
ll k, a[N];
map<vector<ll>, vector<pair<ll, ll> >, cmp> mp;

inline int count(ll x) {
	int c = 0;
	while (x) {
		c++;
		x -= (x & -x);
	}
	return c;
}

vector<ll> calcDiff(vector<ll> &v) {
	vector<ll> r;
	for (int i = 1; i < v.size(); i++)
		r.push_back(v[i] - v[i - 1]);
	return r;
}

int main() {
	scanf("%d%lld", &n, &k);
	for (int i = 0; i < n; i++)
		scanf("%lld", a + i);
	sort(a, a + n);
	for (ll d = 0; d <= min(60ll, k); d++) {
		ll msk = (1ll << d) - 1;
		vector<ll> v;
		v.push_back(-1);
		for (int i = 0; i < n; i++)
			v.push_back(a[i] & msk);
		sort(v.begin(), v.end());
		v.resize(unique(v.begin(), v.end()) - v.begin());
		for (int i = 1; i < (int)v.size(); i++) {
			ll pre = v[i - 1] + 1, cur = v[i], val = pre;
			for(ll j=60; j>=0; j--)
				if (pre >> j != cur >> j) {
					if (pre >> j << j == pre) val = pre;
					else val = cur >> j << j;
					break;
				}
			ll rem = k - d - count(val);
			if (rem < 0) continue;
			vector<ll> v2;
			for (int j = 0; j < n; j++)
				v2.push_back((a[j] - val) >> d);
			if (v2[0] < 0) continue;
			mp[v2].push_back(make_pair(max(0ll,v2[0]-rem), v2[0]));
		}
	}
	int ans = 0;
	for (auto it = mp.begin(); it != mp.end(); it++) {
		vector<pair<ll, ll> > v = it->second;
		sort(v.begin(), v.end());
		ll last = v[0].first - 1;
		for (int i = 0; i < (int)v.size(); i++) {
			ll l = max(last + 1, v[i].first), r = v[i].second;
			if (l <= r)
				ans = (ans + (r - l + 1)) % MOD;
			last = max(last, r);
		}
	}
	printf("%d\n", ans);
	return 0;
}

Measured memory_bytes: 16512
n,c,k = map(int,input().split())
t_list = []
bus = 1
for i in range(n):
  t_list.append(int(input()))
  
t_list.sort()
first = t_list[0]
people = 1
for i in range(1,n):
  if t_list[i] - first > k or people >= c:
    bus += 1
    first = t_list[i]
    people = 1
  else:
    people += 1
    
print(bus)
    
  
  
  

Measured memory_bytes: 13388
#include<bits/stdc++.h>
using namespace std;
#include<string>
#define ll long long int
#define ull unsigned long long int
#define ld long double
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
#define intarr(arr, n)  ll arr[n];  for (ll i = 0; i < n; i++)  cin >> arr[i]
#define ff first
#define ss second
#define pb push_back
#define mkp make_pair
const ll mod=1e9+7;

bool subsequence_checker(string str1, string str2, ll m, ll n) 
{ 
    if (m == 0) return true; 
    if (n == 0) return false; 
    if (str1[m-1] == str2[n-1]) 
        return subsequence_checker(str1, str2, m-1, n-1); 
    return subsequence_checker(str1, str2, m, n-1); 
}


void solve(){

    string s;
    cin>>s;

    if(s[0]!=s[1]  || s[1]!=s[2])
        cout<<"Yes";
    else
        cout<<"No";

    return;
}

int main()
{
    IOS;
    ll t;
    //cin>>t;
    t=1;
    while(t--){
        solve();
        cout<<endl;
    }
 
    return 0;
}       

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
	int a,b,c,n;
	cin>>n;
	a=n%10;
	n=n/10;
	b=n%10;
	c=n/10;
	if(a==7||b==7||c==7)cout<<"Yes";
	else cout<<"No";
	return 0;
}

Measured memory_bytes: 3624
#include <cstdio>
#include <cctype>
#include <algorithm>
using namespace std;

int read() {
    int ret, fl = 1;
    char ch;
    while(!isdigit(ch = getchar())) (ch == '-') && (fl = -1);
    for(ret = ch - '0'; isdigit(ch = getchar()); ret *= 10, ret += ch - '0');
    return ret * fl;
}

void print(int x) {
    if(x < 0) putchar('-'), x = -x;
    if(x > 9) print(x / 10);
    putchar(x % 10 + '0');
}

int main() {
    int a = read(), b = read(), c = read();
    if(a < b) swap(a, b);
    if(b < c) swap(b, c);
    if(a < b) swap(a, b);
    // printf("%d %d %d\n", a, b, c);
    int ans = a - b;
    c += ans;
    if((a - c) & 1) ans += (a - c + 3) >> 1;
    else ans += (a - c) >> 1;
    print(ans);
    return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <cstdio>
using namespace std;
int main(void){
    int a,b;
    cin >> a >>b;
    if(a<b){
        cout << "a < b";
    }else if(a>b){
        cout << "a > b";
    }else{
        cout << "a == b";
    }
    cout << endl;
    
}


Measured memory_bytes: 3084
//84104971101048411497 - Can you guess what does this mean?
using namespace std;
#include <bits/stdc++.h>
#define mapii map<int, int>
#define debug(a) cout << #a << ": " << a << endl
#define debuga1(a, l, r) fto(i, l, r) cout << a[i] << " "; cout << endl
#define fdto(i, r, l) for(int i = (r); i >= (l); --i)
#define fto(i, l, r) for(int i = (l); i <= (r); ++i)
#define forit(it, var) for(__typeof(var.begin()) it = var.begin(); it != var.end(); it++)
#define forrit(rit, var) for(__typeof(var.rbegin()) rit = var.rbegin(); rit != var.rend(); rit++)
#define ii pair<int, int>
#define iii pair<int, ii>
#define ff first
#define ss second
#define mp make_pair
#define pb push_back
#define ll long long
#define maxN 1000005
#define EPS 1e-9

template <class T>
T min(T a, T b, T c) {
    return min(a, min(b, c));
}

template <class T>
T max(T a, T b, T c) {
    return max(a, max(b, c));
}

int n;
string s, t;

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

    fdto(l, n, 0) {
        bool ok = true;
        int ls = s.length(), lt = t.length();
        fto(i, 0, l-1) {
//            printf("%d %d %d %d\n", l, i, ls-l+i, i);
            if (s[ls-l+i] != t[i]) {
                ok = false; break;
            }
        }
        if (ok) {
            printf("%d\n", max(n, ls+lt-l));
            break;
        }
    }

    return 0;
}


Measured memory_bytes: 256
#flipping signs
N=int(input())
A=list(map(int,input().split()))
n_plus=sum(x>0 for x in A)
min_abs=1000000000
if n_plus%2==N%2:
    ans=sum(abs(x) for x in A)
else:
    for x in A:
        x_abs=abs(x)
        if x_abs<min_abs:
            min_abs = x_abs
    ans=sum(abs(x) for x in A)-min_abs*2
print(ans)

Measured memory_bytes: 14412
#include <iostream>

using namespace std;

int main(void){
    int A, B, C;

    cin >> A >> B >> C;

    if((A == B && B != C) || (B == C && C != A) || (C == A && A != B)){
        cout << "Yes" << endl;
    }
    else{
        cout << "No" << endl;
    }

    return 0;
}

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

vector<pair<long long, long long> > prime_factorize(long long N) {
    vector<pair<long long, long long> > res;
    for (long long a = 2; a * a <= N; ++a) {
        if (N % a != 0) continue;
        long long ex = 0; // 指数

        // 割れる限り割り続ける
        while (N % a == 0) {
            ++ex;
            N /= a;
        }

        // その結果を push
        res.push_back({a, ex});
    }

    // 最後に残った数について
    if (N != 1) res.push_back({N, 1});
    return res;
}

int main() {
    long long n;
    cin >> n;
    long long count = 0, c = 1;
    while(c < n) {
        long long a = n - c;
        const auto &res = prime_factorize(a);
        long long k = 1;
        for(auto f : res) {
            k *= f.second +1;
        }
        count += k;
        c++;
    }
    cout << count << endl;
}

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


int main() {
    string S;
    cin >> S;
    int N = S.size();
    int l[10] = {0};
    l[0] = pow(2, N - 1);
    long long ans = 0;
    for (int k = N - 1; k >= 0; k--) {
        int x = S[k] - '0';
        long long t = 0;
        for (int m = 0; m < N - k; m++) {
            t += l[m] * pow(10, m);
        }
        ans += x * t;
        l[N - k - 1] /= 2;
        l[N - k] = l[N - k - 1];
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <ctime>
#include <iostream>
#include <sstream>
#include <functional>
#include <map>
#include <string>
#include <cstring>
#include <vector>
#include <queue>
#include <stack>
#include <deque>
#include <set>
#include <list>
#include <numeric>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll,ll> P;
const double PI = 3.14159265358979323846;
const double EPS = 1e-12;
const ll INF = 1LL<<29;
const ll mod = 1e9+7;
#define rep(i,n) for(int (i)=0;(i)<(ll)(n);++(i))
#define repd(i,n,d) for(ll (i)=0;(i)<(ll)(n);(i)+=(d))
#define all(v) (v).begin(), (v).end()
#define pb(x) push_back(x)
#define mp(x,y) make_pair((x),(y))
#define mset(m,v) memset((m),(v),sizeof(m))
#define chmin(X,Y) ((X)>(Y)?X=(Y),true:false)
#define chmax(X,Y) ((X)<(Y)?X=(Y),true:false)
#define fst first
#define snd second
#define UNIQUE(x) (x).erase(unique(all(x)),(x).end())
template<class T> ostream &operator<<(ostream &os, const vector<T> &v){int n=v.size();rep(i,n)os<<v[i]<<(i==n-1?"":" ");return os;}

int main(){
	ll n, s = 0;
	cin>>n;
	rep(i, n){
		ll a;
		cin>>a;
		s += a%2;
	}
	cout<<(s%2==0?"YES":"NO")<<endl;
	return 0;
}


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

using namespace std;

int main(){
	string s;
	while(true){
		getline(cin, s);
		if(s == ".") break;
		stack<char> st;
		bool ok = true;
		for(int i=0;i<s.size();i++){
			if(s[i]=='(') st.push(s[i]);
			if(s[i]==')'){
				if(st.empty() || st.top() != '('){
					ok = false;
				} else {
					st.pop();
				}
			}
			if(s[i]=='[') st.push(s[i]);
			if(s[i]==']'){
				if(st.empty() || st.top() != '['){
					ok = false;
				} else {
					st.pop();
				}
			}
		}
		if(!st.empty()) ok = false;
		cout << (ok ? "yes" : "no") << endl;
	}
}

Measured memory_bytes: 1176
n = int(input())
acc = 0
wac = 0
tlec = 0
rec = 0
for i in range(n):
  x = str(input())
  if x == "AC":
    acc = acc + 1
  elif x == "WA":
    wac = wac + 1
  elif x == "TLE":
    tlec = tlec + 1
  elif x == "RE":
  	rec = rec + 1

print("AC x "+str(acc))
print("WA x "+str(wac))
print("TLE x "+str(tlec))
print("RE x "+str(rec))

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

using namespace std;

void swap(void *a,void *b){
    void *c = a;
    a = b;
    b = c;
}

void make_heap(int *heap,int size,int idx){
    int left  = 2*idx+1;
    int right = left+1;

    int largest = idx;
    if(left < size && heap[idx] < heap[left])
        largest = left;
    if(right < size && heap[largest] < heap[right])
        largest = right;

    if(largest != idx){
        swap(heap[idx],heap[largest]);
        make_heap(heap,size,largest);
    } 
}


void build_heap(int *heap,int size){
    for(int i=size/2-1;i>-1;i--)
        make_heap(heap,size,i);
}


int main(){
    int h; cin >> h;
    int heap[h];
    for(int i=0;i<h;i++) cin >> heap[i];
    build_heap(heap,sizeof(heap)/sizeof(heap[0]));

    for(int i=0;i<h;i++) cout << " " << heap[i];
    cout << endl;

}


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

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define vi vector<int>
#define vivi vector<vi>
const int INF = 1<<29;
typedef long long ll;

int main(){
    ll N, K;cin >> N >> K;
    ll H[N];rep(i, N)cin >> H[i];
    sort(H, H + N);
    ll ans = 0;
    rep(i, N - K)ans += H[i];
    cout << ans;
}


Measured memory_bytes: 1792
#include<bits/stdc++.h>
#include<climits>
#define FOR(i,a,b) for(int i = (a);i<=(b);i++)
#define ROF(i,a,b) for(int i = (a);i>=(b);i--)
#define MST(a,x) memset(a,x,sizeof(a))
#define ll long long
#define PB push_back
#define PH push
#define MP make_pair
#define FT first
#define SD second
#define N 105
#define M 10005
//#define INF
#define MOD 1000000007
#define MOD2 1000000009
#define eps 1e-7
using namespace std;
const ll INF = ~1ull>>1;
inline int Max(int a,int b)
{
    return (((b-a)>>(32-1))&(a^b))^b;
}
inline int Min(int a,int b)
{
    return (((b-a)>>(32-1))&(a^b))^a;
}
int is_mul_overflow(ll a, ll b) {
        return LLONG_MAX / a < b;
}

string s[N];
int vis[N][N];
int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n,m;
    while(cin>>n>>m)
    {
        MST(vis,0);
        FOR(i,0,n-1)cin>>s[i];
        int x = 0,y = 0,f = 1;
        vis[x][y] = 1;
        while(x!=n-1||y!=m-1)
        {
            if(x+1<n&&s[x+1][y] == '#')x++;
            else if(y+1<m&&s[x][y+1] == '#')y++;
            else
            {
                f = 0;
                break;
            }
            vis[x][y] = 1;
        }
        FOR(i,0,n-1)
        {
            FOR(j,0,m-1)
            {
                //if(vis[i][j])cout<<i<<" "<<j<<" "<<vis[i][j]<<endl;
                if(s[i][j] == '#'&&vis[i][j] == 0)f = 0;
                if(s[i][j] != '#'&&vis[i][j] == 1)f = 0;
            }
        }
        if(f)cout<<"Possible"<<endl;
        else cout<<"Impossible"<<endl;
    }
    return 0;
}


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

using str = string;
using ss = stringstream;

str key="keyence";

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

    str s;cin>>s;

    int fk=0;

    for(;fk<7;fk++)if(s[fk]!=key[fk])break;

    int bk=0;

    for(;bk<7;bk++)if(s[s.size()-1-bk]!=key[7-1-bk])break;

    bool ans=fk+bk>=7;

    puts(ans?"YES":"NO");

    return 0;
}


Measured memory_bytes: 3624
#import decimal
#decimal.getcontext().prec==500 Floatの桁数を500まで増やす
#Decimal(c).sqrt() それで平方根を求める
#Decimal(1) / Decimal(7) 1/7
from collections import *
from itertools import *
from bisect import *
from heapq import *
import copy
import math
from fractions import gcd
import sys
#input = sys.stdin.readline


#N=int(input())

N,K=map(int,input().split())
A=list(map(int,input().split()))
A.sort(reverse=True)

M=sum(A)
maxi=round(M**.5)+2
lst=[]
i=2

for i in range(1,maxi):
    if M%i==0:
        lst.append(i)
        lst.append(M//i)


lst.sort(reverse=True)
for l in lst:
    B=deque(sorted([i%l for i in A if i%l!=0]))
    _K=K
    #print(B,l)
    while len(B)>=2 and _K:

        n=min(B[0],l-B[-1],_K)
        B[0]-=n
        B[-1]+=n
        _K-=n
        if not B[0]%l:
            B.popleft()
        if not B[-1]%l:
            B.pop()

    if not B:
        print(l)
        exit()


Measured memory_bytes: 5180
#include <bits/stdc++.h>
using namespace std;
#define  rep(i, n) for(int i = 0; i < n; i++) 
#define  all(x) (x).begin(),(x).end()     // 昇順ソート
#define  rall(v) (v).rbegin(), (v).rend() // 降順ソート
#define  INF 1LL << 60
typedef long long int LL;
const int MOD = 1000000007;
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return true; } return false; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return true; } return false; }
//sort(all(x))とするとソートできるよ
// 10^x は pow(10,(x)) 
// 任意のlogは　対数の底の変換を使う    log(N) / log(任意の底)

int main(){
    int A,B;cin >> A >>B;
    if(A >=13)cout << B << endl;
    else if(A < 13 && A >= 6)cout << B/2 << endl;
    else cout << 0 << endl;
}


Measured memory_bytes: 256
#include <cmath>
#include <queue>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>
#define il inline 
#define re register
#define LL long long
using namespace std;
const int maxn = 1e6 + 50;
const int mod = 998244353;
const int INF = (1 << 30);
LL read() {
    LL res = 0, f = 1; char ch = ' ';
    while (!isdigit(ch)) { ch = getchar(); if (ch == '-') f = -1; } 
    while (isdigit(ch)) res = (res << 3) + (res << 1) + ch - '0', ch = getchar();
    return res * f;
}

int n, k;
struct node { int x, dis; };
deque<node> q;
int flag[maxn];
void BFS() {
	while (!q.empty()) q.pop_front();
	q.push_front({1, 1});
	while (!q.empty()) {
		node x = q.front(); q.pop_front();
		if (flag[x.x]) continue;
		flag[x.x] = 1;
		if (!x.x) {
			printf("%d\n", x.dis);
			return;
		}
		q.push_front({x.x * 10 % k, x.dis});
		q.push_back({(x.x + 1) % k, x.dis + 1});
	}
}		
int main() {
	k = read();
	BFS();
	return 0;
}

Measured memory_bytes: 1408
import sys
def input(): return sys.stdin.readline().strip()


def main():
    N, D = map(int, input().split())
    ans = 0
    for _ in range(N):
        x, y = map(int, input().split())
        if x * x + y * y <= D * D: ans += 1
    print(ans)


if __name__ == "__main__":
    main()


Measured memory_bytes: 68632
#include<stdio.h>
int main()
{
	int a,b,c;
	scanf("%d %d %d",&a,&b,&c);
	if(a==5&&b==5&&c==7)
	{
		printf("YES\n");
	}
	else if(a==5&&b==7&&c==5)
	{
		printf("YES\n");
	}
	else if(a==7&&b==5&&c==5)
	{
		printf("YES\n");
	}
	else
	{
		printf("NO\n");
	}
	return 0;
}

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

int main()
{
    string s,t,ans="No";
    cin>>s>>t;
    rep(i,s.size()){
      rep(j,s.size()){
        int k=(j+i)%s.size();
        if(t[j]!=s[k])break;
        if(j+1==s.size())ans="Yes";
      }
    }
    cout<<ans<<endl;
    return 0;
}


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

int main() {
  int n;
  cin >> n;
  vector<int> a(n);
  
  for (int i = 0; i < n; i++) {
    cin >> a.at(i);
  }
  
  sort(a.begin(), a.end());
  
  int same = 0;
  for (int i = 0; i < n - 1; i++) {
    if (a.at(i) == a.at(i + 1))
      same++;
  }
  cout << a.size() - same << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define itn int
#define rep(i, n) for (int i = 0; i < n; i++)

using namespace std;
typedef long long ll;

int main() {
    int N;
    cin >> N;
    int a,tmp;
    int ans=1;
    cin >> a;
    for(int i;i!=N-1;i++){
        cin >> tmp;
        if(a>tmp){
            continue;
        }
        else{
            ans++;
            a=tmp;
        }
    }
    cout << ans << endl;
}


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

#define ll long long
#define mx 100005
int n,m;
int ar[mx];
char ch[mx];

int main()
{
    string s;
  cin>>s;
  if(s[0]=='7'|| s[1]=='7'||s[2]=='7')cout<<"Yes\n";
  else cout<<"No\n";
    
}


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

map<int,int> data;

int counter(int idx){
	auto nx = data.upper_bound(idx);
	auto it = --nx;
	return it->second;
}

void debug(){
	for( auto i : data ) cout << i.first << " " << i.second << endl;
	cout << "_____" << endl;
}
int query(int idx,int b){
	//cout << idx << " " << b << endl;
	//cout << "++++" << endl;
	//debug();
	
	auto nx = data.upper_bound(idx);
	auto it = nx;--it;
	//cout << it->first << endl;
	//cout << b+1 << " " << nx->first << endl;
	if( idx+1 < nx->first ){
		data[idx+1] = it->second;
	}
	auto nx2 = data.upper_bound(idx);
	int len = nx2->first - it->first;
	auto pr = it;
	pr--;
	int diff = pr->second - it->second;
	//cout << diff << "<<" << endl;
	if( pr->first >= 0 and diff * len <= b ){
		data.erase(it);
		return b - diff * len;
	}else{
		int all = b / len;
		int part = b % len;
		//cout << all << " " << part << endl;
		if( all + 1 == pr->second ){
			if( part ){
				data[it->first+part] = it->second + all;
				data.erase(it);
			}else{
				it->second = it->second + all;
			}
		}else{
			if(part){
				data[it->first+part] = it->second + all;
				it->second = it->second + all + 1;
			}else{
				it->second = it->second + all;
			}
		}
		return 0;
	}
}
signed main(){
	ios::sync_with_stdio(false);
	int N,Q;
	cin >> N >> Q;
	data[-1] = 1e18;
	data[0] = 0;
	data[N] = -1;
	
	for(int i = 0 ; i < Q ; i++){
		int a,b;
		cin >> a >> b;
		--a;
		while(b = query(a,b));

	}
	
	for(int i = 0 ; i < N ; i++){
		cout << counter(i) << endl;
	} 
}

Measured memory_bytes: 7680
#include <iostream>
#include <queue>
#include <functional>
#include <vector>
#include <tuple>
using namespace std;

template<typename Type> class RangeMin {
private:
	int size_;
	std::vector<Type> dat;
public:
	RangeMin() : size_(0), dat(std::vector<Type>()) {};
	RangeMin(int size__) {
		for (size_ = 1; size_ < size__; ) size_ <<= 1;
		dat.resize(size_ << 1, make_pair(1000000, 1000000));
	}
	template<class T>
	RangeMin(T begin_, T end_) {
		int n = end_ - begin_;
		for (size_ = 1; size_ < n; size_ <<= 1); dat.resize(size_ << 1, make_pair(1000000, 1000000));
		for (int i = 0; i < n; i++) dat[i + size_] = *(begin_ + i);
		for (int i = size_ - 1; i > 0; i--) dat[i] = std::min(dat[i << 1], dat[(i << 1) + 1]);
	}
	inline unsigned size() { return size_; }
	inline void update(int i, Type x) {
		i += size_; dat[i] = x;
		while (i > 1) {
			i >>= 1;
			dat[i] = std::min(dat[i << 1], dat[i << 1 | 1]);
		}
	}
	inline Type query(int l, int r) {
		Type ret = make_pair(1000000, 1000000);
		l += size_; r += size_;
		while (l != r) {
			if (l & 1) ret = std::min(ret, dat[l++]); l >>= 1;
			if (r & 1) ret = std::min(ret, dat[--r]); r >>= 1;
		}
		return ret;
	}
};

int n, a[200009];
RangeMin<pair<int, int>> X1, X2;
priority_queue<tuple<int, int, int>, vector<tuple<int, int, int>>, greater<tuple<int, int, int>>>Q;

pair<int, int> Min1(int l, int r) {
	if (l % 2 == 0) return X2.query(l, r + 1);
	return X1.query(l, r + 1);
}

int main() {
	cin >> n; X1 = RangeMin<pair<int, int>>(n + 2); X2 = RangeMin<pair<int, int>>(n + 2);
	for (int i = 1; i <= n; i++) {
		cin >> a[i];
		if (i % 2 == 1) X1.update(i, make_pair(a[i], i));
		else X2.update(i, make_pair(a[i], i));
	}
	Q.push(make_tuple(Min1(1, n).first, 1, n)); vector<int>ans;
	for (int i = 1; i <= n / 2; i++) {
		tuple<int, int, int>G = Q.top(); Q.pop();
		int LL = get<1>(G), RR = get<2>(G);
		pair<int, int>G1 = Min1(LL, RR); ans.push_back(G1.first);
		pair<int, int>G2 = Min1(G1.second + 1, RR); ans.push_back(G2.first);
		if (LL != G1.second) Q.push(make_tuple(Min1(LL, G1.second - 1).first, LL, G1.second - 1));
		if (G1.second + 1 != G2.second) Q.push(make_tuple(Min1(G1.second + 1, G2.second - 1).first, G1.second + 1, G2.second - 1));
		if (G2.second != RR) Q.push(make_tuple(Min1(G2.second + 1, RR).first, G2.second + 1, RR));
	}
	for (int i = 0; i < ans.size(); i++) {
		if (i)cout << " "; cout << ans[i];
	}
	cout << endl;
	return 0;
}

Measured memory_bytes: 11944
#include <bits/stdc++.h>
#include <string>
using namespace std;
 
int main() {
	long int N;
	cin >> N;
	long int ball[N],cache[N],ball2[N];
	for(long int i=0;i < N;i++){
		cin >> ball[i];
	}

    memcpy(ball2, ball, sizeof(ball));
	sort(ball,ball+N);

    long int num = 0;long int numcount =0;
	for(long int i=0;i<N;i++){
      numcount++;
	  if(ball[i] != ball[i+1]){
	      if(numcount > 0){
	       num +=  numcount * (numcount-1) /2;
			cache[ball[i]] = numcount - 1;
	      };
	      numcount=0;
	  }
	}

	for(long int c=0;c<N;c++){
		cout << num - cache[ball2[c]] << endl;
    }
}


Measured memory_bytes: 7296
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>

#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#include <regex>
#define rep(i,n) for(int i = 0; i < n; i++)
#define reps(i,j,n) for(int i = j; i < n; i++)
#define rrep(i,j,n) for(int i = j-1; i >= n; i--)
#define prec(n) fixed << setprecision(n)
#define print_array(v) rep(__k, v.size()) { cout << v[__k]; if(__k != v.size()-1) cout << " "; else cout << endl; }
#define YesorNo(a) printf(a?"Yes\n":"No\n")
#define fi first
#define se second
using namespace std;

int inf = 2147483647;
int64_t inf64 = 9223372036854775807;
int mod = 1e+7;

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

  int n;
  cin >> n;
  vector<int> garden(n);
  rep(i,n) cin >> garden[i];

  int res = garden[0];
  reps(i,1,n) res += max(0, garden[i] - garden[i-1]);

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

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long int
using namespace std;
ll i, temp,t, n, dp[100100], x, y, M, N;
vector<ll>adj[100010];
bool vis[100010];
ll dfs(ll x)
{
    if(adj[x].size()==0)
        return 0;
    ll ans = 0;
    if(vis[x])
        return dp[x];
    vis[x] = true;
    for(int i=0;i<adj[x].size();i++)
        ans = max(ans, dfs(adj[x][i])+1);
    return dp[x] = ans;
}
int main()
{
    //I am Monim, a tiny creature of Allah
    cin >> N >> M;
    ll ans= 0;
    for(i=1;i<=M;i++)
    {
        cin >> x >> y;
        adj[x].push_back(y);
    }
    for(i=1;i<=N;i++)
        if(!vis[i])
            ans = max(ans,dfs(i));
    cout << ans <<endl;
    return 0;
}



Measured memory_bytes: 11856
#pragma GCC target("avx2")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#include <stdio.h>
using namespace std;
static inline int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }

int pow(long x, int n, int m){
    long ret = 1;
    while (n > 0) {
        if (n & 1) ret *= x, ret %= m;
        x *= x, x %= m;
        n >>= 1; 
    }
    return ret % m;
}

int euler_phi(int n) {
   int ret = n;
   for(int i = 2; i * i <= n; ++i){
       if(n % i == 0) {
           ret -= ret / i;
           while(n % i == 0) n /= i;
       }
   }
   if(n > 1) ret -= ret / n;
   return ret;
}

int main()
{
    int K = 0, c = getchar();
    while(c > 47 && c < 58){
        K = K * 10 + c - 48;
        c = getchar();
    }

    K /= gcd(K, 7);
    if(K == 1){
        putchar('1');
        return 0;
    }

    K *= 9;

    if(gcd(K, 10) != 1) {
        putchar('-');
        putchar('1');
        return 0;
    }

    int res = euler_phi(K);

    int ans = 1000000;
    int now = 10;
    for(int i = 1; i * i <= res; ++i){
        if(res % i == 0) {
            if(now == 1){
                printf("%d\n", i);
                return 0;
            }
            int tmp = res / i;
            if(pow(10, tmp, K) == 1) if(tmp < ans) ans = tmp;
        }
        now *= 10, now %= K;
    }

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

    return 0;
}


Measured memory_bytes: 3224
#include <iostream>
#include <string>
#include <vector>
#include <cstring>
#include <climits>
#include <algorithm>
#include <map>
#include <list>
using namespace std;

bool dead[200000];

int main() {
    int N, M, Q;
    cin >> N >> M >> Q;
    list<int> student;
    for (int i=0; i<N; ++i) student.push_back(i);
    auto it = student.begin();
    int a;
    for (int i=0; i<M; ++i) {
        cin >> a;
        if (a % 2 == 0) { // direction +
            a %= N - i;
            while (a--) {
                it ++;
                if (it == student.end()) it = student.begin();
            }
        } else { // direction -
            a %= N - i;
            while (a--) {
                if (it == student.begin()) it = student.end();
                it --;
            }
        }
        dead[*it] = true;
        it = student.erase(it);
        if (it == student.end()) it = student.begin();
    }
    int q;
    for (int i=0; i<Q; ++i) {
        cin >> q;
        cout << (dead[q] ? 0 : 1) << endl;
    }
    return 0;
}

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

int main(){
  int h, w;
  cin >> h >> w;
  vector<vector<int>> v(h, vector<int>(w));
  for (int i = 0; i < h; i ++) {
    for (int j = 0; j < w; j ++) cin >> v[i][j];
  }
  vector<int> a(w);
  for (int i = 0; i < w; i ++) cin >> a[i];

  for (int i = 0; i < h; i ++) {
    int sum = 0;
    for (int j = 0; j < w; j ++) {
      sum += v[i][j] * a[j];
    }

    cout << sum << endl;
  }
}


Measured memory_bytes: 3164
import sys

sys.setrecursionlimit(500005)
stdin = sys.stdin

ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline().rstrip()  # ignore trailing spaces

n, k = na()
a = na()
a.sort()
print(sum(a[0:k]))


Measured memory_bytes: 62412
#include<iostream>

using namespace std;

int main() {
	int n;
	cin >> n;
	char* stone = new char[n];
	for (int i = 0;i < n;i++) {
		cin >> stone[i];
	}
	int l = 0;
	int r = n - 1;
	int ans = 0;
	while (1) {
		while (l < n && stone[l] == 'R') {
			l++;
		}
		while (r >= 0 && stone[r] == 'W') {
			r--;
		}
		if (l <= r) {
			swap(stone[l], stone[r]);
			ans++;
		}
		else {
			break;
		}
	}
	cout << ans << endl;
}

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

const ll mod = 1e9+7;
const ll INF = 1e18;
const double pi = acos(-1.0);


int main(void)
{
    ll a,b,c,d,x=0; cin>>a>>b>>c>>d;
    if(d==1) x=1;
    cout<<x<<endl;
    return 0;
}

Measured memory_bytes: 3624
//package com.company;

import java.io.*;
import java.util.*;

public class Main {
    public static class Task {


        public void solve(Scanner sc, PrintWriter pw) throws IOException {
            pw.println((sc.nextInt() + 1) / 2);
        }
    }

    static long TIME_START, TIME_END;

    public static void main(String[] args) throws IOException {
        Scanner sc = new Scanner(System.in);
//        Scanner sc = new Scanner(new FileInputStream("input"));
        PrintWriter pw = new PrintWriter(new BufferedOutputStream(System.out));
//        PrintWriter pw = new PrintWriter(new FileOutputStream("input"));

        Runtime runtime = Runtime.getRuntime();
        long usedMemoryBefore = runtime.totalMemory() - runtime.freeMemory();
        TIME_START = System.currentTimeMillis();
        Task t = new Task();
        t.solve(sc, pw);
        TIME_END = System.currentTimeMillis();
        long usedMemoryAfter = runtime.totalMemory() - runtime.freeMemory();
        pw.close();
        System.err.println("Memory increased: " + (usedMemoryAfter - usedMemoryBefore) / 1000000);
        System.err.println("Time used: " + (TIME_END - TIME_START) + ".");
    }

    static class Scanner {
        StringTokenizer st;
        BufferedReader br;

        public Scanner(InputStream s) {
            br = new BufferedReader(new InputStreamReader(s));
        }

        public Scanner(FileReader s) throws FileNotFoundException {
            br = new BufferedReader(s);
        }

        public String next() throws IOException {
            while (st == null || !st.hasMoreTokens())
                st = new StringTokenizer(br.readLine());
            return st.nextToken();
        }

        public int nextInt() throws IOException {
            return Integer.parseInt(next());
        }

        public long nextLong() throws IOException {
            return Long.parseLong(next());
        }

        public String nextLine() throws IOException {
            return br.readLine();
        }

        public double nextDouble() throws IOException {
            return Double.parseDouble(next());
        }

        public boolean ready() throws IOException {
            return br.ready();
        }
    }
}

Measured memory_bytes: 21460
w,h,n = map(int,input().split())
xyn_list = [list(map(int,input().split())) 
            for nesya in range(n)]
hoge1 = 0
hoge2 = w
hoge3 = 0
hoge4 = h
for xyn in xyn_list:
  a = xyn[2]
  if a == 1:
    if hoge1 < xyn[0]:
      hoge1 = xyn[0]
  elif a == 2:
    if hoge2 > xyn[0]:
      hoge2 = xyn[0]
  elif a ==3:
    if hoge3 < xyn[1]:
      hoge3 = xyn[1]
  else:
    if hoge4 > xyn[1]:
      hoge4 = xyn[1]
if hoge4 > hoge3 and hoge2 > hoge1:
  ans = (hoge4-hoge3)*(hoge2-hoge1)
else:
  ans = 0
print(ans)

Measured memory_bytes: 3064
open System

let rec calc (r: int) (d: int) (x2000: int) (year: int): int =
    match year with
    | 2000 -> x2000
    | y when y > 2000 -> r * (calc r d x2000 (year - 1)) - d
    | _ -> failwith "n < 2000"

[<EntryPoint>]
let main _ =
    let input = Console.ReadLine()
    let [| r; d; x2000 |] = input.Split(' ') |> Array.map Int32.Parse
    
    [2001..2010]
    |> List.map (calc r d x2000)
    |> List.iter (printfn "%d")
    
    0


Measured memory_bytes: 14044
#include<bits/stdc++.h>
using namespace std;
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC optimize ("-ffloat-store")  
#pragma GCC optimize ("-fno-defer-pop")
typedef long long int ll; 
typedef long double ld; 


int main()
{
    std::ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
		
	ll a,b;
	cin>>a>>b;
	
	cout<<(a*b)<<endl;
}



























Measured memory_bytes: 3612
#include<iostream>
#include<algorithm>
#include<cmath>
using namespace std;
const int N = 105;
int a[N];
bool In[N];
int main() {
    int x,n;
    cin >> x >> n;
    for(int i = 1; i <= n; ++i) cin >> a[i], In[a[i]] = true;
    sort(a+1,a+1+n);

    int Min = 0x7fffffff, Mini;
    if(!n) {
        cout << x << endl;
        return 0;
    }
    for(int i = a[1]-1; i <= a[n]+1; ++i) {
        if(!In[i] && abs(x-i) < Min) {
            Min = abs(x-i), Mini = i;
        }
    }
    cout << Mini << '\n';
return  0;
}

Measured memory_bytes: 3628
#include <vector>
#include <stack>
#include <stdio.h>
#include <iostream>
#include <string>
#include <algorithm>
#include <math.h>
#include <typeinfo>
#include <queue>
#include <set>
#include <sstream>

using namespace std;

#define RSORT(c) sort((c).begin(),(c).end(),std::greater<int>())
#define REP(i,n) for(int i=0;i<(n);i++)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define SORT(c) sort((c).begin(),(c).end())

static const int INFTY = (1<<21);
static const int WHITE = 0;
static const int GRAY = 1;
static const int BLACK = 2;
#define MAX 200000
#define SENTINEL 10000000000
typedef long long ll;


void c1(){
  int l = 10;
  string s;
  cin >> s;
  //s[4] = "8";
  s.replace(3, 1, "8");
  cout << s << endl;
}

int main(){
  c1();
  return 0;
}


Measured memory_bytes: 256