akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <queue>
#include <vector>
#include <bitset>
#include <string>
#include <cassert>
#include <set>
#include <map>
#define Rep(i, x, y) for (int i = x; i <= y; i ++)
#define Dwn(i, x, y) for (int i = x; i >= y; i --)
#define RepE(i, x) for (int i = tp[x]; i; i = t[i].nex)
#define RepG(i, x) for (int i = gp[x]; i; i = g[i].nex)
#define ev t[i].y
#define gv g[i].y
#define eps 1e-10
using namespace std;
typedef long long ll;
typedef double db;
const int N = 100005, mod = 1000000007;
int n, rt, q[N], tp[N], ts, gp[N], gs, ans[N];
bool p[N], p0[N];
struct edge { int y, nex; } t[N * 2], g[N * 4];
void init(int x, int y) { t[++ ts] = (edge) { y, tp[x] }, tp[x] = ts; }
void adde(int x, int y) { g[++ gs] = (edge) { y, gp[x] }, gp[x] = gs; }
void build(int x) {
//	cout << x <<endl;
	p[x] = 1;
	int k = 0;
	RepE(i, x) {
		build(ev);
		p[x] ^= 1;
		if (!k) k = q[ev];
		else {
			adde(k, q[ev]), adde(q[ev], k);
			k = 0;
		}
	}
	if (k) q[x] = k;
	else q[x] = x;
}
void dfs(int x) {
	RepG(i, x) {
		if (!ans[gv]) {
			ans[gv] = -ans[x];
			dfs(gv);
		}
		assert(ans[x] == -ans[gv]);
	}
}
int main()
{
	scanf ("%d", &n);
	Rep(i, 1, n) {
		int x;
		scanf ("%d", &x);
		if (x > 0) init(x, i);
		else rt = i;
	}
	build(rt);
	Rep(i, 1, n) p0[i] = p[i];
	memset(tp, 0, sizeof(tp)); ts = 0;
	Rep(i, 1, n) {
		int x;
		scanf ("%d", &x);
		if (x > 0) init(x, i);
		else rt = i;
	}
	build(rt);
	Rep(i, 1, n) if (p0[i] != p[i]) {
		puts("IMPOSSIBLE"); return 0;
	}
	Rep(i, 1, n) if (p[i] && !ans[i]) {
		ans[i] = 1;
		dfs(i);
	}
	puts("POSSIBLE");
	Rep(i, 1, n) printf("%d ", ans[i]);
	puts("");

	return 0;
}

Measured memory_bytes: 8832
#define _USE_MATH_DEFINES
#include <iostream>
#include <string>
#include <list>
#include <vector>
#include <queue>
#include <algorithm>
#include <climits>
#include <cstring>
#include <cmath>
#include <stack>
#include <iomanip>
#include <tuple>
#include <functional>
#include <cfloat>
#include <map>

#define int long long
#define CONTAINS(v,n) (find((v).begin(), (v).end(), (n)) != (v).end())
#define SORT(v) sort((v).begin(), (v).end())
#define RSORT(v) sort((v).rbegin(), (v).rend())
#define ARY_SORT(a, size) sort((a), (a)+(size))
#define MAX(a,b) (((a) > (b)) ? (a) : (b))
#define MIN(a,b) (((a) < (b)) ? (a) : (b))
#define REMOVE(v,a) (v.erase(remove((v).begin(), (v).end(), (a)), (v).end()))
#define REVERSE(v) (reverse((v).begin(), (v).end()))
#define LOWER_BOUND(v,a) (lower_bound((v).begin(), (v).end(), (a)))
#define UPPER_BOUND(v,a) (upper_bound((v).begin(), (v).end(), (a)))
#define REP(i, n) for (int (i) = 0; (i) < (n); (i)++)
#define CONTAINS_MAP(m, a) (m).find((a)) != m.end()
using namespace std;


signed main()
{
	int N, A;
	cin >> N >> A;
	if (N % 500 <= A)
	{
		cout << "Yes" << endl;
	}
	else
	{
		cout << "No" << endl;
	}
}

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

using namespace std;

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

#define MOD 1000000007
#define REP(i, N) for (int i = 0; i < N; ++i)
#define REP1(i, N) for (int i = 1; i <= N; ++i)
#define RREP(i, N) for (int i = N - 1; i >= 0; --i)
#define ALL(a) a.begin(), a.end()

int main() {
  int d;
  while (cin >> d) {
    int ans = 0;
    for (int i = d; i <= 600 - d; i += d) {
      ans += i * i * d;
    }
    cout << ans << endl;
  }
  return 0;
}


Measured memory_bytes: 3000
#include <bits/stdc++.h>
using namespace std;
double x;
double ans = 0;
string s;
int n;
int main()
{
    cin >> n;
    for (int i = 0; i < n; ++i)
    {
        cin >> x >> s;
        if (s == "JPY")
        {
            ans += x;
        }
        else
        {
            ans += x * 380000;
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
n = input()

black = 0
white = 0

for i in range(len(n)):

    if i % 2 == 0:
        if n[i] == "0":
            white += 1
        else:
            black += 1

    else:
        if n[i] == "0":
            black += 1
        else:
            white += 1

if black <= white:
    print(black)
else:
    print(white)


Measured memory_bytes: 3188
#include<cstdio>
#include<cmath>
#include<iostream>
#include<algorithm>
using namespace std;
long long int fie[102][4][4];
int day[102];
int main(){
    int N,K;
    cin>>N>>K;
    for(int i=0;i<K;i++){
        int a,b;
        cin>>a>>b;
        day[a]=b;
    }
    fie[0][0][0]=1;
    for(int i=1;i<=N;i++){
        for(int j=1;j<=3;j++){
            for(int k=0;k<=3;k++){
                for(int l=0;l<=3;l++){
                    if(day[i]==0||day[i]==j){
                        if(j!=k||k!=l||j!=l)fie[i][l][j]+=fie[i-1][k][l];
                        fie[i-1][k][l]%=10000;
                    }
                }
            }
        }
    }
    long long int ans=0;
    for(int i=1;i<=3;i++){
        for(int j=1;j<=3;j++){
            ans+=fie[N][i][j];
        }
    }
    cout<<ans%10000<<endl;
    return 0;
}

Measured memory_bytes: 1168
// copied by Nurstan Duisengaliev
// skatal
#include <bits/stdc++.h>
 
#define ll long long
#define all(x) x.begin(), x.end()
#define in insert
#define mp make_pair
#define F first
#define S second
#define ppf pop_front
#define pb push_back
#define ppb pop_back
#define pf push_front
#define pii pair <int, int>
#define boost() ios_base::sync_with_stdio(0), cin.tie(0)
#define sz(x) x.size()
#define int ll 
using namespace std;
 
const int N = (int)3e5 + 123;
const int mod = (int)1e9 + 7;
const ll INF = (ll)1e18 + 7;
ll a[N];
ll cnt[100][3];
void solve () {
	int n;
	cin >> n;
	ll ans = 0;
	for (int i = 1; i <= n; i ++) cin >> a[i];
	for (int i = 1; i <= n; i ++) {
		for (int j = 0; j <= 60; j ++) {
			if ((a[i] & (1ll << j)) == 0) {  
			    
				ans += ((cnt[j][1] * ((1ll << j) % mod)) % mod);
			 	ans %= mod;
			 	cnt[j][0] ++;
			}
			else {
			 	ans += ((cnt[j][0] * ((1ll << j) % mod)) % mod);
			 	ans %= mod;
			 	cnt[j][1] ++;
			}
						 
		}
	}
	cout << ans;
}           
 
main () {
//	freopen (".in", "r", stdin);
//	freopen (".out", "w", stdout);
	boost ();
	int TT = 1;
//  cin >> TT;
	while (TT --) {
		solve ();
	}
	return 0;	
}

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

#define ALL(a) (a).begin(), (a).end()
#define FOR(i, s, n) for (int i = (s); i < (n); i++)
#define rep(i, n) FOR(i, 0, n)
#define repi(i, n) FOR(i, 1, n + 1)
#define pp(v) cerr << #v "=" << (v) << endl;
#define ppa(v) cerr << "- " << #v << endl; rep(i,v.size()) cerr << #v << "[" << i << "] = " << v[i] << endl;
#define div_ceil(a,b) ((a) + ((b) - 1)) / (b)
#define UNIQUE(v) v.erase( unique(ALL(v)), v.end() );
#define INF 0x3f3f3f3f
#define LLINF 1000111000111000111LL
#define MOD 1000000007
#define TIME system("date +%M:%S.%N")
using Graph = vector<vector<int>>;
using ll = long long;
template<class T> T gcd(const T &a, const T &b) { return a < b ? gcd(b, a) : b ? gcd(b, a % b) : a; }
template<class T> T lcm(const T &a, const T &b) { return a / gcd(a, b) * b; }

#define x first
#define y second
#define mp make_pair
using Pos = pair<int,int>;
#define ppp(v) cerr << #v << "(" << v.x << "," << v.y << ")"
#define cr cerr << endl;


int main() {
  int n;cin>>n;
  map<int,int> m;
  vector<int> a(5);
  vector<char> h = {'M', 'A', 'R', 'C', 'H'};
  rep(i,n) {
    string s;cin>>s;
    rep(j,5) if (s[0] == h[j]) m[h[j]]++;
  }
  rep(i,5) a[i] = m[h[i]];
  // ppa(a);

  ll ans = 0;
  rep(bit,1<<5) {
    if (__builtin_popcount(bit) != 3) continue;
    ll product = 1;
    rep(j,5) if (bit>>j&1) {
      product *= a[j];
    }
    ans += product;
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
#include <stdio.h>

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

Measured memory_bytes: 596
MAX_ARRAY_SIZE = 100000

class Queue:
    array = [None] * MAX_ARRAY_SIZE
    start = end = 0
    def enqueue(self, a):
        assert not self.isFull(), "オーバーフローが発生しました。"
        self.array[self.end] = a
        if self.end + 1 == MAX_ARRAY_SIZE:
            self.end = 0
        else:
            self.end += 1
    def dequeue(self):
        assert not self.isEmpty(), "アンダーフローが発生しました。"
        if (self.start + 1) == MAX_ARRAY_SIZE:
            self.start = 0
            return self.array[MAX_ARRAY_SIZE - 1]
        else:
            self.start += 1
            return self.array[self.start - 1]
    def isEmpty(self):
        return self.start == self.end
    def isFull(self):
        return self.start == (self.end + 1) % MAX_ARRAY_SIZE

n, q = list(map(lambda x: int(x), input().strip().split()))

queue = Queue()

for i in range(n):
    queue.enqueue(input().strip().split())


sum_time = 0
while not queue.isEmpty():
    name, time = queue.dequeue()
    if int(time) <= q:
        sum_time += int(time)
        print(name + ' ' + str(sum_time))
    else:
        queue.enqueue([name, str(int(time) - q)])
        sum_time += q


Measured memory_bytes: 23760
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <ctype.h>
#include <limits.h>	
#define inf (INT_MAX-1)
#define INF 9223372036854775807
#define sq(n) ((n)*(n))
#define rep(i,n) for(i=0;i<n;i++)
#define rev(i,n) for(i=n-1;i>=0;i--)
#define sort(a,n) qsort(a,n,sizeof(TYPE),cmp)
#define sort_r(a,n) qsort(a,n,sizeof(TYPE),cmp_r);
#define TYPE int
#define MEMSET(a) memset(a,0,sizeof(a))
const int mod=(int)1e09+7;

int in(void){
	int i;scanf("%d",&i);
	return i;
}
long long llin(void){
	long long i;scanf("%lld",&i);
	return i;
}
double din(void){
	double i;scanf("%lf",&i);
	return i;
}
void chin(char s[]){
	scanf("%s",s);
}
void print(int a){
	printf("%d\n",a);
}
void llprint(long long a){
	printf("%lld\n",a);
}
void dprint(double a){
	printf("%.10f\n",a);
}
void print2(int a,int b){
	printf("%d %d\n",a,b);
}
long long max(long long a,long long b){
	return a>b?a:b;
}
long long min(long long a,long long b){
	return a<b?a:b;
}
long long llabs(long long a){
	return a>0?a:-a;
}
double dmax(double a,double b){
	return a>b?a:b;
}
int cmp(const void *a,const void *b){
	return *(TYPE *)a-*(TYPE *)b;
}
int cmp_r(const void *a,const void *b){
	return *(TYPE *)b-*(TYPE *)a;
}

int main(void){
	int a=in(),b=in(),n=in(),s,f,t[10000]={},i;
	rep(i,n){
		s=in();
		f=in();
		t[s]++;
		t[f]--;
	}
	rep(i,1010){
		t[i+1]+=t[i];
	}
	for(i=a;i<b;i++){
		if(t[i]){
			puts("1");
			return 0;
		}
	}
	puts("0");
	return 0;
}

Measured memory_bytes: 1776
# n=int(input())
n, A, B, C = map(int, input().split())
# l=list(map(int,input().split()))
#l=[list(map(int,input().split())) for i in range(n)]
l = [int(input()) for i in range(n)]

INF = 10**9


def dfs(cur, a, b, c):
    if cur == n:
        return abs(a-A)+abs(b-B)+abs(c-C)-30 if min(a, b, c) > 0 else INF
    ret0 = dfs(cur+1, a, b, c)
    ret1 = dfs(cur+1, a+l[cur], b, c)+10
    ret2 = dfs(cur+1, a, b+l[cur], c)+10
    ret3 = dfs(cur+1, a, b, c+l[cur])+10

    return min(ret0, ret1, ret2, ret3)


ans = dfs(0, 0, 0, 0)
print(ans)

Measured memory_bytes: 9144
import java.util.Scanner;


public class Main {

    public static void main(String[] args) {

    	Main main=new Main();

    	main.run();

    }

    void run() {

    	Scanner sc=new Scanner(System.in);

    	String S=sc.next();

    	if(S.contains("AC")) {
    		System.out.println("Yes");
    	}else {
    		System.out.println("No");
    	}
    }
}



Measured memory_bytes: 23764
/* {{{ Shinobu kawaii */
/*
  ______   __        _                  __                 
.' ____ \ [  |      (_)                [  |                
| (___ \_| | |--.   __   _ .--.   .--.  | |.--.   __   _   
 _.____`.  | .-. | [  | [ `.-. |/ .'`\ \| '/'`\ \[  | | |  
| \____) | | | | |  | |  | | | || \__. ||  \__/ | | \_/ |, 
 \______.'[___]|__][___][___||__]'.__.'[__;.__.'  '.__.'_/ 
                                                           
*/
/* }}} */

#include <bits/stdc++.h>
using namespace std;

// #define int long long

/* cpp template {{{ */

/* short */
#define pb push_back
#define mp make_pair
#define print(x) cout << x << '\n'
#define Fi first
#define Se second

/* REPmacro */
#define REPS(i, a, n) for (int i = (a); i < (n); i++)
#define REP(i, n) for (int i = 0; i < (n); i++)
#define RREP(i, n) for (int i = 1; i <= (n); i++)
#define DEPS(i, a, n) for (int i = (a); i >= n; i--)
#define DEP(i, n) for (int i = (n); i >= 0; i--)

/* typedef */
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<vector<int> > vii;
typedef pair<int, int> pii;

/* const */
const int INF = 999999999;
const int dx[] = {0, 1, 0, -1, 1, -1, 1, -1}, dy[] = {1, 0, -1, 0, 1, -1, -1, 1};

/* func */
inline bool is_uruu(int y) {return (y % 4 == 0 && (y % 100 != 0 || y % 400 == 0));}
inline bool inside(int y, int x, int H, int W) {return (y >= 0 && x >= 0 && y < H && x < W);}

/* }}} */

signed main()
{
  cin.tie(0);
  ios::sync_with_stdio(false);
  int a[4], e, f;
  
  REP(i, 4) cin >> a[i];
  cin >> e >> f;
  sort(a, a + 4);
  print(a[3] + a[2] + a[1] + max(e, f));

  return (0);
}

Measured memory_bytes: 1208
#include<cstdio>
#include<cstring>
#include<vector>
#include<queue>
#include<algorithm>
#include<cmath>
#include<climits>
#include<string>
#include<set>
#include<map>
#include<iostream>
using namespace std;
#define rep(i,n) for(int i = 0;i<((int)(n));i++)
#define reg(i,a,b) for(int i = ((int)(a));i<=((int)(b));i++)
#define irep(i,n) for(int i = ((int)(n)-1);i>=0;i--)
#define ireg(i,a,b) for(int i = ((int)(b)-1);i>=((int)(a));i--)
typedef long long int lli;
typedef pair<int, int> mp;
#define fir first
#define sec second
#define IINF INT_MAX
#define LINF LLONG_MAX
#define eprintf(...) fprintf(stderr,__VA_ARGS__)
#define pque(type) priority_queue<type,vector<type>,greater<type> >
#define memst(a,b) memset(a,b,sizeof(a))

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

	bool s = true;
	lli ans = LINF;
	rep(j, 2){
		lli sum = 0, b = 0;
		rep(i, n){
			sum += a[i];
			if(sum == 0){
				if(s) sum = 1;
				else sum = -1;
				b++;
			}else if(s^(sum>0)){
				b += abs(sum) + 1;
				if(s) sum = 1;
				else sum = -1;
			}
			s = !s;
		}
		ans = min(ans, b);
		s = false;
	}

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

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

static const int INF=1e9;
static const int MOD=1000000007;
typedef long long ll;
typedef pair<int,int> P;

int main(){
    int N; cin >> N;
    ll a[N];
    for(int i=0;i<N;i++){
        cin >> a[i];
    }
    map<ll,ll> ma;
    for(int i=0;i<N;i++){
        ll res=a[i];
        ll tmp=1;
        while(res){
            ma[tmp%MOD]+=res%2;
            if(res%2==1) res--;
            res/=2;
            tmp*=2;
        }
    }
    ll ans=0;
    for(auto it=ma.begin();it!=ma.end();it++){
        ans+=(it->first%MOD)*((it->second)*(N-it->second)%MOD)%MOD;
        ans%=MOD;
    }
    cout << ans%MOD << endl;
}


Measured memory_bytes: 2560
#include <cstdio>
#include <vector>
using namespace std;

int main()
{
	int n; scanf("%d",&n);
	vector<int> a(n);
	for(int i = 0; i < n; ++i) {
		scanf("%d",&a[i]);
	}
	scanf("%d",&n);
	vector<int> b(n);
	for(int i = 0; i < n; ++i) {
		scanf("%d",&b[i]);
	}
	vector<int> c;
	for(int i = 0; i < n; ++i) {
		for(unsigned int j = 0; j < a.size(); ++j) {
			if(a[j] == b[i]) {
				c.push_back(b[i]);
				break;
			}
		}
	}
	printf("%d\n",c.size());
	return 0;
}



Measured memory_bytes: 2760
import sys

readline = sys.stdin.readline
MOD = 10 ** 9 + 7
INF = float('INF')
sys.setrecursionlimit(10 ** 5)


def main():
    N = int(readline())
    K = int(readline())
    X = int(readline())
    Y = int(readline())

    ans = 0
    if N <= K:
        ans = N * X
    else:
        ans = K * X + (N - K) * Y

    print(ans)


if __name__ == '__main__':
    main()


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

int main() {
  string S;
  int K,N;
  cin >> K >> S;
  N = S.size();
  if (N <= K) {
    cout << S << endl;
  }
  else {
    for (int i=0; i<K; i++) {
      cout << S[i];
    }
    cout << "..." << endl;
  }
}


Measured memory_bytes: 3624
n=int(input())
ans=0
ANS=0
for i in range(n):
    a,b=map(int,input().split())
    if a==b:
        ans+=1
    else:
        ans=0
    if ANS<ans:
        ANS=ans
if ANS>2:
    print("Yes")
else:
    print("No")

Measured memory_bytes: 9116
#include <bits/stdc++.h>
using namespace std;
int main(){
	int array[1000001];
	array[1]=1;
	for(int i=2;i<=1000000;i++){
		int k=i;
		bool f=false;
		while(1){
			if(k%2==0)k/=2;
			else if(k%3==0)k/=3;
			else if(k%5==0)k/=5;
			else break;
			if(k==1){
				f=true;break;
			}
		}
		if(f)array[i]=array[i-1]+1;
		else array[i]=array[i-1];
	}
	int a,b;
	while(cin>>a>>b,a){
		cout<<array[b]-array[a-1]<<endl;
	}
}

Measured memory_bytes: 5064
n = int(input())
a = list(map(int, input().split()))

balls = [0] * n
nrev = reversed(range(n))
ballcount = 0

for i in nrev:
    if i > n // 2:
        balls[i] = a[i]
        if balls[i] == 1:
            ballcount = ballcount + 1
    else:
        kosuu = n // (i + 1)
        ball = 0
        now = i + 1
        for j in range(kosuu):
            if balls[now - 1] == 1:
                ball = ball + 1
            now = now + i + 1
        if ball % 2 == a[i]:
            balls[i] = 0
        else:
            balls[i] = 1
            ballcount = ballcount + 1

print(ballcount)

for i in range(n):
    if balls[i] == 1:
        print(i + 1)

Measured memory_bytes: 7276
#define MYDEBUG
#include <iostream>
#include <vector>
#include <chrono>
#include <random>
#include <algorithm>
#include <queue>
#include <set>
#include <cstdio>
#include <unordered_map>

#ifdef MYDEBUG
#define debug(x) cout<<#x<<": "<<x<<endl
#else
#define debug(x)
#endif
#define ll long long
#define ull unsigned long long
#define eps 1e-14
#define all(x) x.begin(), x.end()
using namespace std;

template<typename T>
ostream& operator<<(ostream& out, const vector<T>& v) {
	out << "[";
	size_t last = v.size() - 1;
	for (size_t i = 0; i < v.size(); ++i) {
		out << v[i];
		if (i != last)
			out << ",";
	}
	out << "]";
	return out;
}
int n, m;
const int MAXN = 8 + 1;
int g[MAXN][MAXN];
int vis = 0;
long long dfs(int now, int rest, int vis) {
	if (rest == 0)
		return 1;
	ll ans = 0;
	for (int i = 2; i <= n; ++i) {
		if ((vis >> i) % 2 == 0 && g[now][i] == 1) {
			vis = vis | (1 << i);
			ans += dfs(i, rest - 1, vis);
			vis -= 1 << i;
		}
	}
	return ans;
}

void solve() {
	cin >> n >> m;
	for (int i = 0; i < MAXN; ++i) {
		for (int k = 0; k < MAXN; ++k) {
			g[i][k] = g[k][i] = 0;
		}
	}
	for (int i = 0; i < m; ++i) {
		int a, b;
		cin >> a >> b;
		g[a][b] = g[b][a] = 1;
	}
	vis = 1 << 1;
	ll cnt = dfs(1, n - 1, vis);
	cout << cnt << endl;
}
int main() {
	solve();
	return 0;
}


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

int main(){

	int n, m, k;
	int card[200];
	int tmp[200];
	for(int i = 1; i <= 200; i++){
		card[i-1] = i;
	}
	cin >> n;
	cin >> m;
	
	for(int i = 0; i < m; i++){
		cin >> k;
		if(k == 0){
			int o, p;
			o = 0;
			p = n;
			for(int j = 0; j < 2*n; j++){
				if(j % 2 == 0){
					tmp[j] = card[o];
					o++;
				}else {
					tmp[j] = card[p];
					p++;
				}
			}
		}else {
			for(int j = 0; j < k; j++){
				tmp[j+(2*n-k)] = card[j];
			}
			for(int j = k; j < 2*n; j++){
				tmp[j-k] = card[j];
			}		
		}
		for(int j = 0; j < 200; j++){
			card[j] = tmp[j];
		}	
	}
	
	for(int i = 0; i < 2*n; i++){
		cout << card[i] << endl;
	}
	return 0;
}

Measured memory_bytes: 1164
#include<bits/stdc++.h>
using namespace std;
template <class A, class B> inline bool chmax(A &a, const B &b) { return b > a && (a = b, true); }
template <class A, class B> inline bool chmin(A &a, const B &b) { return b < a && (a = b, true); }
typedef long long ll;
typedef vector<int> vint;
typedef pair<int, int> pint;
typedef vector<long long> vlong;
#define vpush(a,x) a.push_back(x);
#define _GLIBCXX_DEBUG
#define rep(i, n) REP(i, 0, n)
#define all(v) v.begin(), v.end()
#define REP(i, x, n) for(int i = x; i < n; i++)
signed main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    char c;
    cin>>c;
    c=c+1;
    cout<<c<<'\n';
    return(0);
}

Measured memory_bytes: 256
S = input()
N = len(S)
res1 = 0
sample = "0"
tmp = "1"
for i in range(N):
    if S[i] != sample:
        res1 += 1
    sample, tmp = tmp, sample

res2 = 0
sample = "1"
tmp = "0"
for i in range(N):
    if S[i] != sample:
        res2 += 1
    sample, tmp = tmp, sample


print(min(res1, res2))

Measured memory_bytes: 3188
#include "bits/stdc++.h"
 
using namespace std;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<VVI> VVVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef vector<PII> VPII;
typedef long long LL;
typedef priority_queue<int> PQ_DESC;
typedef priority_queue<int, vector<int>, greater<int>> PQ_ASC;
typedef priority_queue<PII> PQ_DESC_PII;
typedef priority_queue<PII, vector<PII>, greater<PII>> PQ_ASC_PII;
typedef vector<LL> VLL;
typedef vector<VLL> VVLL;
typedef vector<VVLL> VVVLL;

#define SORT_ASC(c) sort((c).begin(), (c).end())
#define SORT_DESC(c) sort((c).begin(), (c).end(), greater<typeof((c).begin())>())
 
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define FORL(i,a,b) for(LL i=(a);i<(b);++i)
#define REPL(i,n)  FORL(i,0,n)
#define SIZE(a) int((a).size())
#define ALL(a) (a).begin(),(a).end()
 
const double EPS = 1e-10;
const double PI  = acos(-1.0);
 
template <typename Iterator>
inline bool next_combination(const Iterator first, Iterator k, const Iterator last)
{
   /* Credits: Thomas Draper */
   if ((first == last) || (first == k) || (last == k))
      return false;
   Iterator itr1 = first;
   Iterator itr2 = last;
   ++itr1;
   if (last == itr1)
      return false;
   itr1 = last;
   --itr1;
   itr1 = k;
   --itr2;
   while (first != itr1)
   {
      if (*--itr1 < *itr2)
      {
         Iterator j = k;
         while (!(*itr1 < *j)) ++j;
         iter_swap(itr1,j);
         ++itr1;
         ++j;
         itr2 = k;
         rotate(itr1,j,last);
         while (last != j)
         {
            ++j;
            ++itr2;
         }
         rotate(k,itr2,last);
         return true;
      }
   }
   rotate(first,k,last);
   return false;
}

inline double get_time_sec(void){
    return static_cast<double>(chrono::duration_cast<chrono::nanoseconds>(chrono::steady_clock::now().time_since_epoch()).count())/1000000000;
}

template<typename T>
T gcd(T a, T b) {
    if(a > b) swap(a, b);
    if(a == 0) return b;
    else return gcd(b%a, a);
}

template<typename T>
map<T, T> prime_list(T n) {
    map<T, T> ret;
    for(T i = 2; i*i <= n; i++) {
        if(n % i == 0) {
            ret[i] = 0;
            while(n % i == 0) {
                n /= i;
                ret[i]++;
            }
        }
    }
    if(n != 1) ret[n]++;
    return ret;
}

#define MOD 1000000007

LL mypow(LL a, LL n) {
    if(n == 1) return a % MOD;
    if(n % 2 == 1) return (a * mypow(a, n-1)) % MOD;
    LL t = mypow(a, n/2);
    return (t * t) % MOD; 
}

int main(void) {
    int n;
    cin >> n;
    VVI f(n, VI(10)), p(n, VI(11));
    REP(i, n) {
        REP(j, 10) cin >> f[i][j];
    }
    REP(i, n) {
        REP(j, 11) cin >> p[i][j];
    }
    LL ans = LLONG_MIN;
    FOR(i, 1, 1 << 10) {
        LL tmp = 0;
        REP(j, n) {
            int c = 0;
            REP(k, 10) {
                if((i >> k & 1) && f[j][k]) c++;
            }
            tmp += p[j][c];
        }
        ans = max(ans, tmp);
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <math.h>
#define _GLIBCXX_DEBUG
#define _LIBCPP_DEBUG 0

using namespace std;
#define ll long long
#define rep(i,n) for (int i = 0; i < n; i++)
#define rrep(i,n) for (int i = n-1; i >= 0; i--)
#define MOD (1000000007)
#define vi vector<int>
#define vl vector<ll>
#define vb vector<bool>
#define vvi vector<vi>
#define vvl vector<vl>
#define pii pair<int, int>
#define pli pair<ll, int>
#define pb push_back

#define mp make_pair
#define all(a) (a).begin(),(a).end()

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

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

ll keta(ll n){
  string s = to_string(n);
  ll num = s.size();
  return num;
}

const ll INF = 1LL << 60;

const int dh[4] = {1,0,-1,0};
const int dw[4] = {0,1,0,-1};

struct Edge{
  int to;
  int weight;
  Edge(int t, int w) : to(t), weight(w){}
};
using Graph = vector<vector<Edge>>;
using P = pair<ll, int>;

const int MAX = 5e5;

long long fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

// 二項係数計算
long long COM(ll n, ll k){
  if(n >= MAX){
    ll tmp = 1;
    rep(i,k){
      tmp *= (n-i);
      tmp %= MOD;
    }
    return tmp*finv[k]%MOD;
  }

  if (n < k) return 0;
  if (n < 0 || k < 0) return 0;
  return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

ll POW(ll x, ll n){
  ll ret = 1;
  while(0 < n){
    if(n%2 == 0){
      x = x*x%MOD;
      n = n >> 1;
    }
    else{
      ret = ret*x%MOD;
      n--;
    }
  }
  return ret;
}

int main(){
  int n,q; cin >> n >> q;
  vector<tuple<int,int,int>> a;
  rep(i,n){
    int s, t, x; cin >> s >> t >> x;
    s -= x; t -= x;
    a.pb(make_tuple(x,s,t));
  }
  sort(all(a));
  set<pii> s;
  rep(i,q){
    int d; cin >> d;
    s.insert(pii(d,i));
  }

  vi ans(q,-1);

  rep(i,n) {
    int l,r,x;
    tie(x,l,r) = a[i];
    auto it = s.lower_bound(pii(l,-1));
    while(it != s.end()){
      if(it->first >= r) break;
      ans[it->second] = x;
      s.erase(it++);
    }
  }

  rep(i,q) cout << ans[i] << endl;
}


Measured memory_bytes: 14832
N, M = map(int, input().split())

if N == 2 or M == 2:
    print(0)

elif N == 1:
    if M ==1:
        print(1)
    else:
        print(M-2)
    
elif M ==1:
    print(N-2)
    
else:
    print((N-2)*(M-2))

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

#define ran 202202

int s, n;
int a[ran];

int main() {
	scanf("%d%d", &s, &n);
	for(int i=0;i<n;i++) scanf("%d", &a[i]);
	a[n] = a[0] + s;
	
	int ma = 0;
	for(int i=1;i<=n;i++)
		ma = max(ma, a[i]-a[i-1]);
	printf("%d\n", s-ma);
	
	return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
#include <math.h>
#define _GLIBCXX_DEBUG
#define _LIBCPP_DEBUG 0

using namespace std;
#define ll long long
#define rep(i,n) for (int i = 0; i < n; i++)
#define MOD (1000000007)
#define vi vector<int>
#define vvi vector<vi>
#define all(a)  (a).begin(),(a).end()

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

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

const ll INF = 1LL << 60;

int main(){
  int n; cin >> n;
  vi x(n), y(n), h(n);
  int index;
  rep(i, n){
    cin >> x[i] >> y[i] >> h[i];
    if(h[i] >= 1) index = i;
  }
  rep(px, 101) rep(py, 101){
    int ph = h[index] + abs(x[index] - px) + abs(y[index] - py);
    bool ok = true;
    rep(i, n){
      int tmp = max(ph - abs(x[i] - px) - abs(y[i] - py), 0);
      if(tmp != h[i]) ok = false;
    }
    if(ok){
      printf("%d %d %d\n",px, py, ph);
    }
  }

}


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

int main(){
  string S;
  cin >> S;
  if(S.at(2)==S.at(3) && S.at(4)==S.at(5)){
    cout << "Yes" << endl;
  }
  else{
    cout << "No" << endl;
  }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main() {
    int n;
    cin>>n;

    vector<long long>l(n+1);
    l[0]=2;
    l[1]=1;

    for (int i=2;i<=n;i++) {
        l[i]=l[i-1]+l[i-2];
    }

    cout<<l[n]<<endl;

}


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

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

int main(){
	int H, W, K;
	cin >> H >> W >> K;
	vector<string> c(H);
	rep(i,H) cin >> c[i];
	int ans=0;
	rep(bitH,1<<H){
		rep(bitW,1<<W){
			int res=0;
			rep(i,H){
				rep(j,W){
					if(bitH & 1<<i) continue;
					if(bitW & 1<<j) continue;
					if(c[i][j]=='#') res++;
				}
			}
			if(res==K) ans++;
		}
	}
	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 3628
#include<iostream>
using namespace std; // 575

const int MOD = 1000000007; // 今回使う余り]
int main() {
	int N;
	string S;
	cin >> N >> S;
	
	static int dp[100001], use[26];
	for (int i = 0;i < 26;++ i) use[i] = 0;
	dp[0] = 0;
	for (int i = 0;i < S.size();++ use[S[i] - 'a'], ++ i) {
		long tmp = 1;
		for (int j = 0;j < 26;++ j) if (S[i] - 'a' != j) tmp = tmp * (use[j] + 1) % MOD;
		dp[i + 1] = (dp[i] + tmp) % MOD;
	}
	cout << dp[N];
	return 0;
}
/*
31536000のコメント解説欄
ここテンプレで用意してるから、A問題とかだとこの先空欄の危険あり
また、コンテスト後に https://31536000.hatenablog.com/ で解説していると思うので、良かったら読んでねー

dp[i] = 第i番目の文字までの答え
*/

Measured memory_bytes: 896
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<map>
#include<math.h>
#include<queue>
#include<deque>
#include<stack>
#include<cstdio>
#include<utility>
#include<set>
#include<list>
#include<cmath>
#include<stdio.h>
#include<string.h>
#include<iomanip>
#include<cstdio>
#include<cstdlib>
#include<cstring>
using namespace std;
#define FOR(i, a, b) for (ll i = (a); i <= (b); i++)
#define REP(i, n) FOR(i, 0, n - 1)
#define NREP(i, n) FOR(i, 1, n)
using ll = long long;
using pii = pair<int, int>;
using piii = pair<pii, pii>;
const ll dx[4] = { 0, -1, 1, 0 };
const ll dy[4] = { -1, 0, 0, 1 };
const int INF = 1e9 + 7;
int gcd(int x, int y) {
	if (x < y)swap(x, y);
	if (y == 0)return x;
	return gcd(y, x%y);
}
void mul(ll a, ll b) {
	a = a * b % INF;
}
using Graph = vector<vector<int>>;
ll mypow(ll x, ll n, ll m) {
	if (n == 0) {
		return 1;
	}
	if (n % 2 == 0) {
		return mypow(x*x%m, n / 2, m);
	}
	else {
		return x * mypow(x, n - 1, m) % m;
	}
}
long long modinv(long long a, long long m) {
	long long b = m, u = 1, v = 0;
	while (b) {
		long long t = a / b;
		a -= t * b; swap(a, b);
		u -= t * v; swap(u, v);
	}
	u %= m;
	if (u < 0) u += m;
	return u;
}
const int MAX = 510000;
ll fac[MAX], finv[MAX], inv[MAX];
//テーブルをつくる前処理
void COMinit() {
	fac[0] = fac[1] = 1;
	finv[0] = finv[1] = 1;
	inv[1] = 1;//mod pにおける1,2,,,nの逆元
	for (int i = 2; i < MAX; ++i) {
		fac[i] = fac[i - 1] * i%INF;
		inv[i] = INF - inv[INF%i] * (INF / i) % INF;
		finv[i] = finv[i - 1] * inv[i] % INF;
	}
}

ll COM(int n, int k) {
	if (n < k)return 0;
	if (n < 0 || k < 0)return 0;
	return fac[n] * (finv[k] * finv[n - k] % INF) % INF;
}
///////////////////////////////////////


int main() {
	int k; cin >> k;
	int sum = 0;
	for (int i = 1; i <= k; ++i) {
		for (int j = 1; j <= k; ++j) {
			for (int l = 1; l <= k; ++l) {
				sum += gcd(i, gcd(j, l));
			}
		}
	}
	cout << sum << endl;
	return 0;
}

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

#define int long long

int32_t main(){
 	ios::sync_with_stdio(false);
 	cin.tie(0);
 	int a, b;
 	cin >> a >> b;
 	if(a <= b){
 	 	cout <<"Yes";
 	}
 	else{
 	 	cout <<"No";
 	}
 	return 0;
}

Measured memory_bytes: 256
#include <array>
#include <cmath>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <set>
#include <string>
#include <tuple>
#include <utility>
#include <vector>

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

int main() {
    int K, N;
    cin >> K >> N;
    vector<int> A(N);
    rep(i, N)
        cin >> A[i];
    
    int max_distance = 0;
    for(int i=0; i<N-1; ++i) {
        max_distance = max(max_distance, A[i+1] - A[i]);
    }
    max_distance = max(max_distance, A[0] + K-A[N-1]);

    cout << K - max_distance << endl;
    return 0;
}


Measured memory_bytes: 1024
#include<iostream>
#include<bits/stdc++.h>
using namespace std;
int dp[3000][3000];

string get_string(string &s,string &t,int len)
{
    string lcs;
    int i=0,j=0;
    while(len>0)
    {
        if(s[i]==t[j])
        {
            lcs.push_back(s[i]);
            i++;
            j++;
            len--;
        }
        else
        {
            if(dp[i][j+1]>dp[i+1][j])
            {
                j++;
            }
            else
            {
                i++;
            }
        }
    }
    return lcs;
}

int count(string &s,string &t,int i,int j)
{
    if(i>=s.length() || j>=t.length())
    {
        return 0;
    }
    else
    {
        if(dp[i][j]!=-1)
        {
            return dp[i][j];  // agar pehle se value assigned hai tu in that case
            // uss pre calculated vaue ko return kr do...
        }
        if(s[i]==t[j])
        {
            return dp[i][j]=1+count(s,t,i+1,j+1);
        }
        else
        {
            return dp[i][j]=max(count(s,t,i,j+1),count(s,t,i+1,j));
        }
    }
}

string  solve(string &s,string &t)
{
    memset(dp,-1,sizeof(dp));  // initailly -1 assign kr diya hai....
    return get_string(s,t,count(s,t,0,0));
}

int main()
{
    string s,t;
    cin>>s>>t;
    cout<<solve(s,t);
}

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

int main(){
  string a,b,c;
  int d;
  cin >> a >> b;
  for(int i=0;i<a.size();i++){
    c[i]=a[i];
  }
  for(int i=a.size();i<a.size()+b.size();i++){
    c[i]=b[i-a.size()];
  }
  d=stoi(c);
  
  for(int i=0;i<1000;i++){
    if(i*i == d){
      cout << "Yes" << endl;
      return 0;
    }
  }
  cout << "No" << endl;
  return 0;
}

Measured memory_bytes: 256
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

var sc = bufio.NewScanner(os.Stdin)

func main() {
	scanInit()

	n := nextInt()
	l := make([]int, n)

	evencnt := 0
	quadcnt := 0
	for i := 0; i < n; i++ {
		l[i] = nextInt()

		if l[i]%4 == 0 {
			quadcnt++
		} else if l[i]%2 == 0 {
			evencnt++
		}
	}

	if quadcnt*2+1 >= n {
		fmt.Println("Yes")
		return
	}
	non4 := n - quadcnt*2
	if non4 <= evencnt {
		fmt.Println("Yes")
		return
	}

	fmt.Println("No")
	return

}

// ---- readfunc
func scanInit() {
	const cap = 200 * 1024 // default=64*1024
	var buf = make([]byte, cap)
	sc.Buffer(buf, cap)
	sc.Split(bufio.ScanWords)
	return
}
func nextInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}
func nextStr() string {
	sc.Scan()
	return sc.Text()
}


Measured memory_bytes: 4344
#include<iostream>
#include<vector>
#include<algorithm>
#include<cmath>
using namespace std;
using ll = long long;

int main() {
    ll n,X=0,Y=0;
    cin >> n;
    vector<ll> a(n);
    for(ll i=0;i<n;i++){
         cin >> a[i];
         Y+=a[i];
    }
    X=a[0],Y-=a[0];
    ll ans=abs(X-Y);
    for(ll i=1;i<n-1;i++){
        X+=a[i];
        Y-=a[i];
        ans=min(abs(X-Y),ans);
    }
    cout << ans << endl;
	return 0;
}

Measured memory_bytes: 1792
N = int(input())
S = input()
Q = int(input())
K = [int(i) for i in input().split()]

for k in K:
    ans = 0

    d = m = dm = 0
    for i, si in enumerate(S):
        if 0 <= i - k:
            if S[i - k] == "D":
                d -= 1
                dm -= m
            elif S[i - k] == "M":
                m -= 1

        if si == "D":
            d += 1
        elif si == "M":
            m += 1
            dm += d
        elif si == "C":
            ans += dm

    print(ans)

Measured memory_bytes: 75624
import sys
from math import sqrt

inf = 1<<60

def solve():
    N, M = map(int, sys.stdin.readline().split())

    edges = [None] * M
    # Adj = [[] for i in range(N)]
    Adjr = [[] for i in range(N)]

    for i in range(M):
        ai, bi, ci = map(int, sys.stdin.readline().split())
        edges[i] = (ai - 1, bi - 1, -ci)
        # Adj[ai - 1].append(bi - 1)
        Adjr[bi - 1].append(ai - 1)

    reachable = [False] * N
    dfs(N, M, Adjr, reachable, N - 1)

    edges = [(u, v, c) for (u, v, c) in edges if reachable[u] and reachable[v]]

    ans = BellmanFord(N, M, edges)

    if ans is None:
        print('inf')
    else:
        print(-ans)

def dfs(N, M, Adj, visited, u):
    visited[u] = True

    for v in Adj[u]:
        if not visited[v]:
            dfs(N, M, Adj, visited, v)

def BellmanFord(N, M, edges):
    d = [inf] * N
    d[0] = 0

    for i in range(N):
        flag = False

        for (u, v, c) in edges:
            if d[u] != inf and d[u] + c < d[v]:
                d[v] = d[u] + c
                flag = True

        if not flag:
            break

        if flag and i == N - 1:
            return None

    return d[N - 1]

if __name__ == '__main__':
    solve()

Measured memory_bytes: 41968
/**
 * @author derrick20
 */
import java.io.*;
import java.util.*;

public class Main {
    public static void main(String args[]) throws Exception {
        FastScanner sc = new FastScanner(System.in);
        PrintWriter out = new PrintWriter(System.out);

        int N = sc.nextInt();
        int W = sc.nextInt();
        int[] weight = new int[N];
        long[] value = new long[N];
        for (int i = 0; i < N; i++) {
            weight[i] = sc.nextInt();
            value[i] = sc.nextLong();
        }

        long[] dp = new long[W + 1];
        // What's the best value achievable with weight W?
        for (int item = 0; item < N; item++) {
            long val = value[item];
            int wt = weight[item];
            for (int nextWt = W; nextWt - wt >= 0; nextWt--) {
                // We can either add to the first state or something that was
                // reachable already
                dp[nextWt] = Math.max(dp[nextWt], dp[nextWt - wt] + val);
            }
        }
        long best = 0;
        for (long val : dp) {
            best = Math.max(best, val);
        }
        out.println(best);
        out.close();
    }

    static class FastScanner {
        BufferedReader br;
        StringTokenizer st;

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

        FastScanner(FileReader s) {
            br = new BufferedReader(s);
        }

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

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

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

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

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

Measured memory_bytes: 21716
import java.util.Scanner;

public class Main{

	public static void main(String[] args) {
		Scanner stdin = new Scanner(System.in);
		boolean[] spade = new boolean[13];
		boolean[] dia = new boolean[13];
		boolean[] club = new boolean[13];
		boolean[] heart = new boolean[13];

		int n = stdin.nextInt();

		for (int i = 0; i < n; ++i) {
			String markChar = stdin.next();
			int number = stdin.nextInt();
			boolean[] mark = null;
			if (markChar.equals("S")) {
				mark = spade;
			}
			if (markChar.equals("H")) {
				mark = heart;
			}
			if (markChar.equals("C")) {
				mark = club;
			}
			if (markChar.equals("D")) {
				mark = dia;
			}
			mark[number - 1] = true;

		}

		for (int i = 0; i < spade.length; i++) {
			if (spade[i] != true) {
				System.out.println("S " + (i + 1));
			}
		}
		for (int i = 0; i < heart.length; i++) {
			if (heart[i] != true) {
				System.out.println("H " + (i + 1));
			}
		}
		for (int i = 0; i < club.length; i++) {
			if (club[i] != true) {
				System.out.println("C " + (i + 1));
			}
		}
		for (int i = 0; i < dia.length; i++) {
			if (dia[i] != true) {
				System.out.println("D " + (i + 1));
			}

		}

	}

}

Measured memory_bytes: 26280
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time

sys.setrecursionlimit(10**7)
inf=10**20
mod=10**9+7

def LI(): return list(map(int,input().split()))
def II(): return int(input())
def LS(): return input().split()
def S(): return input()

def main():
  N,K=LI()
  s=S()
  print(s[:K-1]+s[K-1].lower()+s[K:])

main()
# print(main())


Measured memory_bytes: 7840
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define i_7 (ll)(1E9+7)
#define i_5 (ll)(1E9+5)
ll mod(ll a){
    ll c=a%i_7;
    if(c>=0)return c;
    else return c+i_7;
}
typedef pair<int,int> i_i;
typedef pair<ll,ll> l_l;
ll inf=(ll)1E12;
#define rep(i,l,r) for(ll i=l;i<=r;i++)
#define pb push_back
ll max(ll a,ll b){if(a<b)return b;else return a;}
ll min(ll a,ll b){if(a>b)return b;else return a;}
void Max(ll * pos,ll val){*pos=max(*pos,val);}//Max(&dp[i][j],dp[i-1][j]);
void Min(ll * pos,ll val){*pos=min(*pos,val);}
void Add(ll * pos,ll val){*pos=mod(*pos+val);}
const long double EPS=1E-8;
////////////////////////////////////////

ll f(ll n){
    ll res=0;
    while(n>=1){
        if(n%2==0){
            n/=2;
            res++;
        }else break;
    }
    return res;
}

int main(){
    ll n;cin>>n;
    ll a[n];rep(i,0,n-1)cin>>a[i];
    bool changed[n];memset(changed,false,sizeof(changed));
    ll p[n];
    rep(i,0,n-1){
        p[i]=f(a[i]);
    }
    ll ans=0;
    for(ll i=40;i>=0;i--){
        ll c=0;
        ll num=-1;
        rep(j,0,n-1){
            if(changed[j]==false&&(a[j]>>i)&1)c++;
            if(p[j]==i)num=j;
        }
        if((c+ans)%2==1){
            if(num==-1){
                cout<<-1;return 0;
            }
            ans++;
            changed[num]=true;
        }
    }
    cout<<ans<<endl;
    return 0;
}



Measured memory_bytes: 1920
#include <bits/stdc++.h>
 
using namespace std;
 
int N;
 
int solve(string &s,string &t){
  queue<string> Q;
  map<string,int> dist;
  Q.push(s);
  dist[s] = 0;
  while(!Q.empty()){
    string v = Q.front(); Q.pop();
    if(v == t) return dist[v];
    int i;
    for(i = 0 ; i < N ; i++){
      if(v[i] != t[i]) break;
    }
    string next = v;
    int diff = (t[i]-v[i]+10)%10;
    for(int j = i ; j < N ; j++){
      next[j] = ((next[j]-'0' + diff) % 10) + '0';
      if(dist.find(next) == dist.end()){
        dist[next] = dist[v] + 1;
        Q.push(next);
      }
    }
  }
}
 
int main(){
  string s,t;
  while(cin >> N, N){
    cin >> s >> t;
    cout << solve(s,t) << endl;
  }
  return 0;
}

Measured memory_bytes: 2648
#include <stdio.h>
#include <stdlib.h>

int main() {
    char a[3];
    scanf("%s", a);

    for (int i = 0; i< sizeof(a); i ++) {
        if( a[i] == '7' ) {
            printf("Yes\n");
            return 0;
        }
    }
    printf("No\n");
    return 0;
}

Measured memory_bytes: 1628
#include<bits/stdc++.h>
typedef long long int ll;
typedef unsigned long long int ull;
#define BIG_NUM 2000000000
#define HUGE_NUM 99999999999999999
#define MOD 1000000007
#define EPS 0.000000001
using namespace std;



#define SIZE 200005

enum Type{

	SAME,
	SMALL,
};


int length;
ll sum_table[2][SIZE],count_table[2][SIZE];
char S[SIZE],T[SIZE];
Type type_array[2] = {SAME,SMALL};


int main(){

	scanf("%s",S);
	scanf("%s",T);

	for(length = 0; S[length] != '\0'; length++);

	for(int i = 0; i < length; i++){
		for(int k = 0; k < 2; k++){

			sum_table[k][i] = 0;
			count_table[k][i] = 0;
		}
	}

	count_table[SAME][0] = 1;

	Type type;

	for(int i = 0; i <= length-1; i++){
		for(int k = 0; k < 2; k++){

			type = type_array[k];
			if(count_table[type][i] == 0)continue;

			for(ll num = 0; num <= 9; num++){
				if(T[i] != '?' && (T[i]-'0') != num)continue;

				if(type == SAME){

					if(num > S[i]-'0')continue;

					if(num == S[i]-'0'){

						count_table[SAME][i+1] = 1;
						sum_table[SAME][i+1] = (sum_table[SAME][i]*10+num)%MOD;

					}else{ //num < S[i]-'0'

						count_table[SMALL][i+1] += 1;
						sum_table[SMALL][i+1] += (sum_table[SAME][i]*10+num)%MOD;
						sum_table[SMALL][i+1] %= MOD;
					}

				}else{ //type == SMALL

					count_table[SMALL][i+1] += count_table[SMALL][i];
					count_table[SMALL][i+1] %= MOD;
					sum_table[SMALL][i+1] += (sum_table[SMALL][i]*10+num*count_table[SMALL][i])%MOD;
					sum_table[SMALL][i+1] %= MOD;
				}
			}
		}
	}

	printf("%lld\n",(sum_table[SAME][length]+sum_table[SMALL][length])%MOD);

	return 0;
}



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

int main(){
  int N;
  cin >> N;
  long long ans=1;
  for (int i = 1; i <= N; i++) {
    ans *= i;
    if(ans>1000000007) ans %= 1000000007;
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define mp make_pair
#define pb push_back
#define pii pair<ll, ll>
#define to second
#define cost first
typedef long long ll;
typedef long double ld;
using namespace std;

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

    ll sum = 0;
    for(ll i = 1; i*i < n; i++) {
        if(n % i != 0) continue;

        ll div = n/i;
        if(n % (div - 1) == 0) continue;

        sum += div-1;
    }

    cout << sum << endl;

    /*for(ll i = 1; i <= n; i++) {
        if((i+1) * (n/i) == n) cout << i << endl;
    }*/
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <boost/range/algorithm.hpp>
#include <boost/range/numeric.hpp>
#include <boost/integer/common_factor.hpp>
#include <boost/integer/common_factor_rt.hpp>
#include <boost/multiprecision/cpp_dec_float.hpp>

using std::string;
using std::vector;
using std::set;
using std::unordered_set;
using std::map;
using std::unordered_map;
using std::pair;
using std::cin;
using std::cout;

typedef uintmax_t    ull;
typedef intmax_t     ll;
typedef uint64_t     ul;
typedef uint32_t     ui;
typedef uint8_t      uc;

typedef boost::multiprecision::number<boost::multiprecision::cpp_dec_float<1000>> cpp_dec_float_1000;

constexpr char CRLF = '\n';
constexpr char SPACE = ' ';
constexpr char VECTOR_COUT_SEPARATOR = SPACE;
constexpr ll INF = 1000'000'007;

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> std::ostream& operator<< (std::ostream& os, const std::vector<T>& vc) { for(auto it = vc.begin(); it != vc.end(); ++it) { if (std::next(it) == vc.end()) os << *it; else os << *it << VECTOR_COUT_SEPARATOR; } return os; }
template<class T1, class T2> inline std::ostream & operator<< (std::ostream & os, const std::pair<T1, T2> & p) { return os << p.first << ' ' << p.second; }

void solve(void)
{
  string s,t; cin >> s >> t;

  ull res{};
  for(ui i = 0; i < s.size(); ++i)
  {
    if(s[i] == t[i]) ++res;
  }
  cout << res << CRLF;
  return;
}

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

  solve();

  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
 
int main()
{
ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int n,t,m=0;
  int i,j;
  
  
  cin>>n>>t;
  float a[n][t];
  for(i=0;i<n;i++)
  {
       for(int k=0;k<t;k++) cin>>a[i][k];
       for(j=0;j<i;j++)
   { float f=0;
        for(int k=0;k<t;k++) 
            { f+= pow(a[i][k]-a[j][k],2); }
            
            
            f=sqrt(f);
            if(floor(f)==f) { m++;  }
   }
      
  }
 
   cout<<m;
  
}


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

#define FOR(i,a,n) for(int i=(a), i##_len=(n); i<i##_len; ++i)
#define REP(i,n) FOR(i,0,n)
using ll = long long;

int main() {
  int n,z,w; cin >> n >> z >> w;
  vector<int> a(n+1);
  a[0] = w;
  REP(i,n) cin >> a[i+1];
  int ans = max(abs(a[n] - a[n-1]), abs(a[n] - w));
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using ll=long long;
int main(void){
  ll n,a,b;
  cin>>n>>a>>b;
  ll h[n];
  for(int i=0;i<n;i++){
    cin>>h[i];
  }
  ll l=0,r=10000000000;
  while(r-l>1){
    ll num=(r+l)/2;
    ll vec[n];
    for(int i=0;i<n;i++){
      vec[i]=h[i]-b*num;
    }
    ll count=0;
    ll dif=a-b;
    for(int i=0;i<n;i++){
      if(vec[i]>0){
        count+=(vec[i]+dif-1)/dif;
      }
    }
    if(count>num){
      l=num;
    }else{
      r=num;
    }
  }
  cout<<r<<endl;
  return 0;
}

Measured memory_bytes: 1920