akhauriyash/Code-Regression huggingface dataset:
def main():
    import sys
    input=sys.stdin.readline
    sys.setrecursionlimit(10000000)
    
    n,q=map(int,input().split())
    tree=[[] for _ in range(n)]
    for _ in range(n-1):
        a,b=map(int,input().split())
        a-=1
        b-=1
        tree[a].append(b)
        tree[b].append(a)
    
    cnt=[0]*n
    for _ in range(q):
        p,x=map(int,input().split())
        p-=1
        cnt[p]+=x
    
    def dfs(i,before=-1):
        for e in tree[i]:
            if e!=before:
                cnt[e]+=cnt[i]
                dfs(e,i)
                
    dfs(0)   
    print(*cnt)

if __name__=='__main__':
    main()



Measured memory_bytes: 268464
#include <bits/stdc++.h>
#define ll long long
using namespace std;
const int N = 1e2+7, M = 1e5+7;
int a[N], sg[M];
int main()
{
	int n, k;
	scanf("%d%d", &n, &k);
	for(int i = 1; i <= n; i++)
	{
		scanf("%d", &a[i]);
	}
	sg[0] = 0;
	for(int i = 1; i <= k; i++)
	{
		set<int> s;
		for(int j = 1; j <= n; j++)
		{
			if(i-a[j]>=0)
			{
				s.insert(sg[i-a[j]]);
			}
		}
		if(s.empty())
		{
			sg[i] = 0;
		}
		else
		{
			if(0<*s.begin())
			{
				sg[i] = 0;
			}
			else
			{
				while(s.size())
				{
					if(s.find(*s.begin()+1)==s.end())
					{
						sg[i] = *s.begin()+1;
						break;
					}
					s.erase(s.begin());
				}
			}
		}
	}
	printf("%s\n", sg[k] == 0 ? "Second" : "First");
	return 0;
}

Measured memory_bytes: 640
n = int(input())

a = list(map(int, input().split()))
b = list(map(int, input().split()))
plus = []
minus = []
for ai, bi in zip(a,b):
    point = ai-bi
    if point > 0:
        plus.append(point)
    elif point < 0:
        minus.append(point)

total_minus = abs(sum(minus))
# print("total minus is ", total_minus)


plus.sort(reverse=True)
# print(plus, minus, sep='\n')

ans = 0
if sum(plus) + sum(minus) < 0:
    print(-1)
else:
    sum = 0
    for i in range(len(plus)):
        if sum >= total_minus:
            break
        sum+=plus[i]
        ans+=1

    ans+=len(minus)
    print(ans)

Measured memory_bytes: 19068
#include <bits/stdc++.h>
using namespace std;
int main(){
    int N;
    cin>>N;
    bool a=true;
    vector<int>wtf(N);
    for(int i=0; i<N; i++){
    cin>>wtf.at(i);
    }
    sort(wtf.begin(),wtf.end());
    for(int i=0; i<N-1; i++){
    if(wtf.at(i)==wtf.at(i+1)){
    a=false;
    break;
    }
    }
    if(a==true){
    cout<<"YES"<<endl;
    }
    else
    cout<<"NO"<<endl;
}

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

int main() {
  int n, a, b, c, d;
  cin >> n;
  
  a = n/1000;
  b = (n/100)%10;
  c = (n/10)%10;
  d = n%10;
  
  if((a==b&&b==c)||(b==c&&c==d)){
	cout << "Yes" << endl;
  }
  else{
    cout << "No" << endl;
  }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll  long long  
#define pb push_back
#define fi first
#define se second
using namespace std;
//vector<ll> v[1000001];
void dfs(ll u,ll p)
{
	
}
bool comp(const pair<ll,ll>&a,const pair<ll,ll> &b)
{
	return (a.second < b.second);
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
 int tc=1;
//cin>>tc;
ll cas=1;
 while(tc--)
 {
	map<string,ll> m;
	ll n;
	cin>>n;
	string s[n];
	for(ll i=0;i<n;i++)
{
	cin>>s[i];
	m[s[i]]++;
}
	cout<<m.size();
	//cout<<"No";
	cout<<"\n"; 
 } 
}


Measured memory_bytes: 25468
#include <stdio.h>

long gcd(long x, long y) {
	if (y == 0) return x;
	return gcd(y, x%y);
}

int main() {
	long A, B, G_Common, k, cnt, i, j;
	scanf("%ld %ld",&A,&B);
	G_Common = gcd(A,B);
	/*while ((k = A%B) > 0) {
		A = B;
		B = k;
	}*/

	//G_Common = B;
	cnt = 1;
	for (i = 2; G_Common > 1 && G_Common >= i*i; ) {
		for (j = 0; G_Common % i == 0; j++) G_Common /= i;
		if (j > 0) cnt++;
		if (i == 2) i++;
		else i += 2;
	}
	if (G_Common >= i) cnt++; //残りの素因数が2乗より小さい時
	printf("%ld\n",cnt);
	return 0;
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
using UL = unsigned long;
using ULL = unsigned long long;
using LL = long long;
#define rep(i, n) for(UL i = 0; i < (n); i++)

struct Problem {

    void Solve() {
        UL N; cin >> N;
        vector<UL> dp(N + 1, -1); dp[0] = 0;
        cin >> dp[1];
        rep(i, N - 1) {
            UL a; cin >> a;
            UL l, r; l = 0; r = N + 2;
            while (l + 1 < r) {
                UL m = (l + r) >> 1;
                if (dp[m] < a) l = m; else r = m;
            }
            dp[l + 1] = a;
        }
        UL ans = 0;
        rep(i, N + 1) if (dp[i] != -1) ans = i;
        cout << ans << endl;
    }
};
int main() {
    unique_ptr<Problem> p(new Problem());
    cout << fixed << setprecision(10);
    p->Solve();
    return 0;
}



Measured memory_bytes: 3556
#include <iostream>
#include <vector>
#include <cmath>
#include <map>
#include <complex>
#include <algorithm>
using namespace std;
#define mk make_pair
typedef pair<int,int> pii;
typedef complex<double> C;

const double agl = M_PI / 2;
vector<C> temp1, temp2;

int roundOff( double x ){
	if( 0 <= x ) return (int)(x + 0.5);
	else				 return (int)(x - 0.5);
}

C rotate( C p ){
	p *= C(cos(agl), sin(agl));
	p.real(roundOff(p.real()));
	p.imag(roundOff(p.imag()));
	return p;
}

bool isSame( vector<C> l ){
	bool res = false;
	for( int r = 0; r < 4; r++ ){	// 90度づつ回転(clockwise)
		bool f1 = true, f2 = true;
		for( int i = 0; i < temp1.size(); i++ ){
			l[i] = rotate(l[i]);
			if( temp1[i] != l[i] ) f1 = false;
			if( temp2[i] != l[i] ) f2 = false;
		}
		if( f1 || f2 ) res = true;
	}
	return res;
}

int main(){
	int n;
	while( cin >> n, n ){
		vector<int> diff;
		for( int i = 0; i <= n; i++ ){
			int m;
			cin >> m;
			vector<C> lines(m);
			double dx, dy;
			for( int j = 0; j < m; j++ ){
				int x, y;
				cin >> x >> y;
				if( j == 0 ){
					dx = x;
					dy = y;
				}
				lines[j] = C(x-dx,y-dy);	// スタートを原点にするように平行移動
			}
			// 探したい折れ線を設定
			if( i == 0 ){
				temp1 = lines;
				reverse(lines.begin(), lines.end());
				temp2 = lines;
				dx = temp2[0].real();
				dy = temp2[0].imag();
				for( int i = 0; i < m; i++ ){
					temp2[i] = C(temp2[i].real()-dx, temp2[i].imag()-dy);
				}
				continue;
			}
			if( temp1.size() != lines.size() ) continue;
			if( isSame(lines) ) diff.push_back(i);
		}

		// output
		for( int i = 0; i < diff.size(); i++ ) cout << diff[i] << endl;
		cout << "+++++" << endl;
	}
}

Measured memory_bytes: 1224
import java.util.Scanner;

public class Main {
	public static void main (String args[]) {
		Scanner scan = new Scanner(System.in);
		int n = scan.nextInt();
		
		for(int i = 0; i < n; i++) {
			int a = scan.nextInt();
			if(a % 2 == 0) {
				if(!(a % 3 == 0 || a % 5 == 0)) {
					System.out.println("DENIED");
					return;
				}
			}
		}
		System.out.println("APPROVED");

	}
}

Measured memory_bytes: 23252
#include<stdio.h>

int main()
{
    int n,minj,box,cnt = 0;
    scanf("%d",&n);
    int A[n];
    for(int x=0;x<n;x++){
        scanf("%d",&A[x]);
    }
    for(int i=0;i<n;i++){
        minj = i;
        for(int j=i;j<n;j++){
            if(A[j] < A[minj]){
                minj = j;
            }
        }
        if(minj != i){
            box = A[i];
            A[i] = A[minj];
            A[minj] = box;
            cnt += 1;
        }
    }
    for(int x=0;x<n;x++){
        if(x != n-1){
            printf("%d ",A[x]);
        }else {
            printf("%d\n",A[x]);
        }
    }
    printf("%d\n",cnt);
    return 0;
}


Measured memory_bytes: 2116
#include <iostream>
#include <cmath>
#include <string>
#include <vector>
#include <array>

using namespace std;

int main(){
    string s;
    cin >> s;

    vector<bool> appeared('z'-'a'+1);

    for(char c : s){
        appeared.at(c - 'a') = true;
    }

    for(char c = 'a'; c <= 'z'; c++){
        if(!appeared.at(c-'a')){
            cout << c << endl;
            return 0;
        }
    }
    cout << "None" << endl;

    return 0;
}



Measured memory_bytes: 512
#include <iostream>
#include <stdio.h>
#include <vector>
#include <algorithm>
#include <math.h>
#include <numeric>
#include <iomanip>
#include <map>
#include <queue>
#include <list>

#define REP(i, n ,N) for(ll i = (n); i < (N); i++)
//#define RREP(i, n ,N) for(ll i = (N-1); i >= (n); i--)
#define p(s) cout<<(s)<<endl
#define p2(a, b) cout<<(a)<<" "<<(b)<<endl
#define INF 1e9

using namespace std;
typedef long long  ll;

const long long MOD = 1e9+7;

int main(){
    string s,t;
    cin >> s >> t;
    p(t+s);

}

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

using namespace std;
using ll = long long int;

int main(){

    int n;
    cin >> n;

    string colors;
    cin >> colors;

    vector<int> cnt(n, 0);
    cnt[0] = (colors[0] == 'R');

    for(int i=1; i<n; i++){
        if (colors[i] == 'R') cnt[i]++;
        cnt[i] += cnt[i - 1];
    }

    int redcnt = cnt.back();
    int ans = min(redcnt, n - redcnt);
    if (redcnt > 0) {
        ans = min(ans, cnt.back() - cnt[redcnt - 1]);
    }
    cout << ans << endl;

    return 0;
}

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

typedef long long ll;
const ll INF = 1010000000000000017LL;
const ll MOD = 1000000007LL;

#define REP(i, n) for(ll i = 0 ; i < n; i++)

//#define DEBUG(fmt, ...)
#define DEBUG(fmt, ...) fprintf(stderr, fmt "\n", ##__VA_ARGS__)

int main(){
    std::cout<<std::fixed<<std::setprecision(10);

    string S;
    cin >> S;

    if( S.find("7") != string::npos ){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
}


Measured memory_bytes: 3628
#include <stdio.h>
#include <algorithm>
#include <assert.h>
#include <bitset>
#include <cmath>
#include <complex>
#include <deque>
#include <functional>
#include <iostream>
#include <limits.h>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <stdlib.h>
#include <string.h>
#include <string>
#include <time.h>
#include <unordered_map>
#include <unordered_set>
#include <vector>

#pragma warning(disable:4996)
#pragma comment(linker, "/STACK:336777216")
using namespace std;

#define mp make_pair
#define all(x) (x).begin(), (x).end()
#define ldb ldouble

typedef tuple<int, int, int> t3;
typedef long long ll;
typedef unsigned long long ull;
typedef double db;
typedef long double ldb;
typedef pair <int, int> pii;
typedef pair <ll, ll> pll;
typedef pair <ll, int> pli;
typedef pair <db, db> pdd;

int IT_MAX = 1 << 19;
int MOD = 1000000007;
const int INF = 0x3f3f3f3f;
const ll LL_INF = 0x3f3f3f3f3f3f3f3f;
const db PI = acos(-1);
const db ERR = 1e-10;
#define szz(x) (int)(x).size()
#define rep(i, n) for(int i=0;i<n;i++)
#define Se second
#define Fi first

const int MX = 200005;
const int MM = 1000000007;

int N, M;
ll D[MX];

int main()
{
	scanf("%d", &N);
	for(int i = 1; i <= N; i++) scanf("%lld", D+i);
	ll ans = 1e18;
	for(int t = 0; t <= N; t++){
		ll s = 0, e = 1e16, m;
		while(s <= e){
			m = (s+e) / 2;
			ll v = m * (N+1) + t;
			ll ans = 0;
			for(int i = 1; i <= N; i++){
				ans += (D[i] + v+1) / (N+1);
			}
			if( ans <= v ) e = m-1;
			else s = m+1;
		}swap(s, e);
		ans = min(ans, e * (N+1)+t);
	}
	printf("%lld\n", ans);
}



Measured memory_bytes: 384
#include <algorithm>
#include <bitset>
#include <climits>
#include <cmath>
#include <cstdio>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <unordered_map>
#include <vector>

#define MOD 1000000007
#define MOD2 998244353
#define int long long
#define double long double
#define EPS 1e-9
//#define PI 3.14159265358979

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

using namespace std;

template < typename T >
ostream &operator<<(ostream &os, const vector< T > &A) {
	for (int i = 0; i < A.size(); i++)
		os << A[i] << " ";
	os << endl;
	return os;
}
template <>
ostream &operator<<(ostream &os, const vector< vector< int > > &A) {
	int N = A.size();
	for (int i = 0; i < N; i++) {
		for (int j = 0; j < A[i].size(); j++)
			os << A[i][j] << " ";
		os << endl;
	}
	return os;
}

typedef pair< int, int > pii;
typedef long long ll;

struct edge {
	int from, to, d, c;
	edge(int _from = 0, int _to = 0, int _d = 0, int _c = 0) {
		from = _from;
		to = _to;
		d = _d;
		c = _c;
	}
	bool operator<(const edge &rhs) const {
		return (d == rhs.d) ? (c < rhs.c) : (d < rhs.d);
	}
};
struct aabb {
	int x1, y1, x2, y2;
	aabb(int x1, int y1, int x2, int y2) : x1(x1), y1(y1), x2(x2), y2(y2) {}
};

typedef vector< edge > edges;
typedef vector< edges > graph;
struct flow {
	int to, cap, rev, cost;
	flow(int to = 0, int cap = 0, int rev = 0, int cost = 0) : to(to), cap(cap), rev(rev), cost(cost) {}
};
typedef vector< vector< flow > > flows;

const int di[4] = {0, -1, 0, 1};
const int dj[4] = {-1, 0, 1, 0};
const int ci[5] = {0, 0, -1, 0, 1};
const int cj[5] = {0, -1, 0, 1, 0};
const ll LINF = LLONG_MAX / 2;
const int INF = INT_MAX / 2;
const double PI = acos(-1);

int pow2(int n) { return 1LL << n; }
template < typename T, typename U >
bool chmin(T &x, const U &y) {
	if (x > y) {
		x = y;
		return true;
	}
	return false;
}
template < typename T, typename U >
bool chmax(T &x, const U &y) {
	if (x < y) {
		x = y;
		return true;
	}
	return false;
}

struct initializer {
	initializer() {
		cout << fixed << setprecision(20);
	}
};
initializer _____;

int N, M, K, T, Q, H, W;
signed main() {
	cin >> N >> M;
	vector< vector< int > > G(N);
	rep(i, M) {
		int a, b;
		cin >> a >> b;
		--a;
		--b;
		G[a].push_back(b);
		G[b].push_back(a);
	}
	vector< int > ans(N);
	ans[0] = 0;
	vector< int > d(N, LINF);
	d[0] = 0;
	queue< pii > q;
	q.push(pii(0, 0));
	while (!q.empty()) {
		pii p = q.front();
		q.pop();
		int i = p.first;
		int b = p.second;
		ans[i] = b;
		for (auto j : G[i]) {
			if (d[j] != LINF)
				continue;
			d[j] = d[i] + 1;
			q.push(pii(j, i));
		}
	}
	cout << "Yes" << endl;
	for (int i = 1; i < N; i++) {
		cout << ans[i] + 1 << endl;
	}
	return 0;
}

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

typedef long long LL;

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define DECIM8  fixed<<setprecision(8) 
#define SZ(a) int((a).size())
#define SORT(c) sort((c).begin(),(c).end())

//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI  = acos(-1.0);

//clear memory
#define CLR(a) memset((a), 0 ,sizeof(a))

using namespace std;
int main(void)
{
  int n;
  cin >> n;
  n--;
  int answer=1;
  while(n/=3) answer++;
  cout << answer << endl;
  return 0;
}

Measured memory_bytes: 1160
using System;
using System.Collections.Generic;


namespace ConsoleApplication16
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] str = Console.ReadLine().Split(' ');
            double r = double.Parse(str[0]);

            double are = r * r * 3.141592653589;
            double cir = 2 * r * 3.141592653589;

            Console.WriteLine("{0} {1}", are.ToString("F6"), cir.ToString("F6"));
        }
    }
}

Measured memory_bytes: 9332
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
using namespace std;


int main(){
	string s;
    vector<string> v;
    int k;
    int n, m=0;

    cin >> s;
    cin >> k;
    n = s.size();

    for(int i=0;i<n;i++){
        for(int j=1;j<=k&&i+j<=n;j++){
            v.push_back(s.substr(i, j));
        }
    }
    sort(v.begin(), v.end());
    unique(v.begin(), v.end());

    cout << v[k-1] << endl;
    return 0;
}


Measured memory_bytes: 1660
n = gets.to_i
args = gets

a = args.split(" ").map(&:to_i)
ans = a[0]
threshold = 10 ** 18

if a.include?(0)
  ans = 0
else
  (n-1).times do |i|
    ans *= a[i+1]
    if ans > threshold
      ans = -1
      break
    end
  end
end

p ans

Measured memory_bytes: 21692
//quming
#include<bits/stdc++.h>
#define R register
#define fp(i,a,b) for(R int i=(a),I=(b)+1;i<I;++i)
#define fd(i,a,b) for(R int i=(a),I=(b)-1;i>I;--i)
#define go(u) for(int i=head[u],v=e[i].v;i;i=e[i].nx,v=e[i].v)
template<class T>inline bool cmax(T&a,const T&b){return a<b?a=b,1:0;}
template<class T>inline bool cmin(T&a,const T&b){return a>b?a=b,1:0;}
using namespace std;
const int N=3e5+5;
int ans[N],cnt[N],id[N],sum[N],n;
int main(){
//	freopen("testdata.in","r",stdin);
    scanf("%d",&n);
    for(R int i=1,x;i<=n;++i)scanf("%d",&x),++cnt[x];
    fp(i,1,n)id[i]=i;
    sort(id+1,id+1+n,[](const int &x,const int &y){return cnt[x]>cnt[y];});
    ans[1]=n;
    fp(i,1,n)sum[i]=sum[i-1]+cnt[id[i]];
    fp(i,2,n){
        R int l=1,r=i-1,ret=-1;
        while(l<=r){
            R int mid=(l+r)>>1;
            if((n-sum[mid])/(i-mid)<=cnt[id[mid]])l=mid+1,ret=mid;
            else r=mid-1;
        }
        if(ret==-1)ans[i]=n/i;
        else ans[i]=(n-sum[ret])/(i-ret);
    }
    fp(i,1,n)printf("%d\n",ans[i]);
    return 0;
}

Measured memory_bytes: 5504
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
int main(void){
int h,m,hh,mm,k;
int sum;
scanf("%d %d %d %d %d",&h,&m,&hh,&mm,&k);
if(mm-m<0){hh--;mm=mm+60;}
sum=((hh-h)*60+mm-m);
printf("%d\n",sum-k);
}


Measured memory_bytes: 1732
package main

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

func main() {
	n := readI()
	P, Q := make([]int, n), make([]int, n)
	for i := 0; i < n; i++ {
		P[i] = readI()
	}
	for i := 0; i < n; i++ {
		Q[i] = readI()
	}

	a := make([]int, n)
	for i := 0; i < n; i++ {
		a[i] = i + 1
	}
	b := make([][]int, 1)
	b[0] = a
	for nextPermutation(a) {
		b = append(b, make([]int, n))
		copy(b[len(b)-1], a)
	}

	fmt.Println(abs(nop(P, b) - nop(Q, b)))

}

func abs(a int) int {
	if a < 0 {
		return -a
	}
	return a
}

func nop(a []int, b [][]int) int {
	for i := 0; i < len(b); i++ {
		if reflect.DeepEqual(a, b[i]) {
			return i
		}
	}
	return -1
}

func nextPermutation(p []int) bool {
	reverse := func(s []int) {
		for i := 0; i < len(s)/2; i++ {
			s[i], s[len(s)-1-i] = s[len(s)-1-i], s[i]
		}
	}
	l, r := len(p)-2, len(p)-1

	for p[l] > p[l+1] {
		if l == 0 {
			reverse(p)
			return false
		}
		l--
	}

	for p[l] > p[r] {
		r--
	}

	p[l], p[r] = p[r], p[l]

	reverse(p[l+1:])
	return true
}

/*-----------Input utils-----------*/

var sc = bufio.NewScanner(os.Stdin)

func init() {
	if len(os.Args) >= 2 {
		if os.Args[1] == "debug" {
			debug()
		}
	}
	const buf = 200100
	sc.Split(bufio.ScanWords)
	sc.Buffer(make([]byte, buf), buf)
}

func debug() {
	testFile, err := os.Open("./test/sample-1.in")
	if err != nil {
		fmt.Fprintln(os.Stderr, "There is no testfile.")
		os.Exit(1)
	}
	sc = bufio.NewScanner(testFile)
}

func readS() string {
	sc.Scan()
	return sc.Text()
}

func readR() []rune {
	return []rune(readS())
}

func readI() int {
	i, _ := strconv.Atoi(readS())
	return i
}

func readF() float64 {
	f, _ := strconv.ParseFloat(readS(), 64)
	return f
}


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

int main() {
    ll n, k;
    cin >> n >> k;
    unordered_map<int, int> adj;
    rep(i, n) {
        int a;
        cin >> a;
        a--;
        adj[i] = a;
    }
    vector<int> proc{0};
    vector<int> time(n, -1);
    time[0] = 0;
    int cur = 0, cycle, bc;
    while (1) {
        int nxt = adj[cur];
        if (time[nxt] != -1) {
            cycle = time[cur] + 1 - time[nxt];
            bc = nxt;
            break;
        }
        time[nxt] = time[cur] + 1;
        proc.push_back(nxt);
        cur = nxt;
    }
    // for (int a : proc) {
    //     cout << a << " ";
    // }
    // cout << endl;
    for (int i = 0; i < (int)proc.size(); i++) {
        if (proc[i] == bc) {
            k %= cycle;
        }
        if (k == 0) {
            cout << proc[i]+1 << endl;
            return 0;
        }
        k--;
    }
}

Measured memory_bytes: 14012
#include <iostream>
#include <algorithm>
#include <string>

using namespace std;

int main(void){
    int n, l;
    cin >> n >> l;
    string s[n];
    
    for (int i = 0; i < n; i++) cin >> s[i];
    
    sort(s, s + n);
    
    string str = "";
    for (int i = 0; i < n; i++){
        str += s[i];
    }
    cout << str << endl;
    
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REV(v) reverse(v.begin(), v.end());
#define REP(i, n) for (int i = 0; i < n; i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define FOR(i, start, stop) for (int i = start; i < stop; i++)
#define FORR(i, start, stop) for (int i = start; i > stop; i--)
#define SORT(v, n) sort(v, v + n);
#define SORTR(v, n) sort(v, v + n,greater<int>());
#define VSORT(v) sort(v.begin(), v.end());
#define VSORTR(v) sort(v.begin(), v.end(),greater<int>());
#define REMOVE(v,n) remove(vector<int> v,v+v.size(),int n)
#define ll long long
#define ull unsigned long long
#define pb(a) push_back(a)
#define INF 999999999
#define V(v,i,j) vector(v.begin() + i, v.begin() + j)
#define INSERT(va,vb) va.insert(va.end(), vb.begin(), vb.end())
using namespace std;
typedef vector<int> vint;
typedef pair<int, int> P;
typedef pair<ll, ll> LP;
typedef pair<int, P> PP;
typedef pair<ll, LP> LPP;

int dy[] = {0, 0, 1, -1};
int dx[] = {1, -1, 0, 0};
const int MOD = 1000000007;

//vector< vector<int> > v (size1, vector<int>(size2) );

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;
    cin>>n;
    vint va(9,0);
    int a;
    int over3200=0;
    FOR(i,0,n){
        cin>>a;
        if(a<3200) va[a/400]++;
        else over3200++;
    }
    int ans=0;
    
    FOR(i,0,9){
        if(va[i]!=0) ans++;
    }
    if(ans!=0) cout<<ans<<' '<<ans+over3200<<endl;
    else cout<<1<<' '<<ans+over3200<<endl;
	
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <cmath>
#include <iomanip>
#include <algorithm>
using namespace std;

int main(){
    int a, b;
    cin >> a >> b;
    cout << (a-1)*(b-1) << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int lint
typedef long long lint;
typedef pair<int,int> P;
const int    INF=(int)1e9;
const int    MOD=(int)1e9+7;
const double EPS=(double)1e-10;
struct Accelerate_Cin{
    Accelerate_Cin(){
        cin.tie(0); ios::sync_with_stdio(0);cout<<fixed<<setprecision(20);
    };
};



signed main(){
  int A,B,X;
  cin>>A>>B>>X;

  if(A>X||X>A+B){
    cout<<"NO"<<"\n";
  }else{
    cout<<"YES"<<"\n";
  }

  return 0;
}


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

typedef long long LL;
const int mn=5e5+7,mod=1e9+7;
LL fac[mn],inv[mn],ans;
int n,m;

LL mul(LL a,LL b) {return a*b%mod;}

LL poww(LL a,LL b)
{
    LL ans=1;
    while (b) {
        if(b&1) ans=mul(ans,a);
        a=mul(a,a);
        b>>=1;
    }
    return ans;
}

LL comb(int n,int m) {return mul(mul(fac[n],inv[m]),inv[n-m]);}
LL perm(int n,int m) {return mul(fac[n],inv[n-m]);}

int main()
{
    scanf("%d%d",&n,&m);
    fac[0]=inv[0]=1;
    for(int i=1;i<=m;++i) fac[i]=mul(fac[i-1],i);
    inv[m]=poww(fac[m],mod-2);
    for(int i=m-1;i;--i) inv[i]=mul(inv[i+1],(i+1));
    for(int i=0;i<=n;++i) {
        ans+=mul(mul(poww(-1,i),comb(n,i)),mul(perm(m,i),poww(perm(m-i,n-i),2)));
        ans=(ans+mod)%mod;
    }
    cout<<ans;
}

Measured memory_bytes: 11320
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,k,n) for(int i = (int)(k); i < (int)(n); i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(a) a.begin(), a.end()
#define MS(m,v) memset(m,v,sizeof(m))
typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<string> vs;
typedef pair<int, int> pii;
const int MOD = 1000000007;
const int INF = MOD + 1;
const ld EPS = 1e-12;
template<class T> T &chmin(T &a, const T &b) { return a = min(a, b); }
template<class T> T &chmax(T &a, const T &b) { return a = max(a, b); }

/*--------------------template--------------------*/




struct Dice
{
	int top, bottom, right, left, front, back;
	int x, y;
	string s;
	Dice() {};
	Dice(int t, int bt, int r, int l, int f, int bk, int x, int y, string s) : top(t), bottom(bt), right(r), left(l), front(f), back(bk), x(x), y(y), s(s) { ; };
	void to_front() 
	{
		int t = front;
		front = top;
		top = back;
		back = bottom;
		bottom = t;
	}
	void to_back() { REP(i, 3) to_front(); }
	void to_right() 
	{
		int t = right;
		right = top;
		top = left;
		left = bottom;
		bottom = t;
	}
	void to_left() { REP(i, 3) to_right(); }
};

int n;
vector<Dice> v;
int vis[4000][4000];
int dp[1 << 16];

int solve(int bit)
{
	if (bit == (1 << n) - 1) return 0;
	if (dp[bit] >= 0) return dp[bit];
	int res = 0;
	REP(i, n)
	{
		Dice tmp = v[i];
		if ((bit >> i) & 1) continue;
		int nbit = bit | (1 << i);
		int sum = 0;
		int x = tmp.x, y = tmp.y;
		string s = tmp.s;
		map<pii, int> mp;
		if ((nbit | vis[x][y]) == nbit) mp[pii(x,y)] = tmp.bottom;
		for (auto j : s)
		{
			if (j == 'L')
			{
				x--;
				tmp.to_left();
			}
			if (j == 'R')
			{
				x++;
				tmp.to_right();
			}
			if (j == 'F')
			{
				y--;
				tmp.to_front();
			}
			if (j == 'B')
			{
				y++;
				tmp.to_back();
			}
			if ((nbit | vis[x][y]) == nbit) mp[pii(x, y)] = tmp.bottom;
		}
		for (auto k : mp) sum += k.second;
		chmax(res, solve(nbit) + sum);
	}
	return dp[bit] = res;
}

int main()
{
	cin.sync_with_stdio(false); cout << fixed << setprecision(10);
	while (cin >> n, n)
	{
		MS(vis, 0);
		MS(dp, -1);
		v.clear();
		REP(i, n)
		{
			int x, y, l, r, f, b, d, u;
			cin >> x >> y >> l >> r >> f >> b >> d >> u;
			x += 2000, y += 2000;
			string s; cin >> s;
			v.emplace_back(u, d, r, l, f, b, x, y, s);
		}
		REP(i, n)
		{
			int x = v[i].x, y = v[i].y;
			string s = v[i].s;
			vis[x][y] |= 1 << i;
			for(auto j : s)
			{
				if (j == 'L') x--;
				if (j == 'R') x++;
				if (j == 'F') y--;
				if (j == 'B') y++;
				vis[x][y] |= 1 << i;
			}
		}
		cout << solve(0) << endl;
		
	}
	return 0;
}

Measured memory_bytes: 65948
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
#define rep(i, m, n) for(int i = m; i < (n); i++)
#define print(x) cout << (x) << endl;
#define printa(x,n) for(int i = 0; i < n; i++){ cout << (x[i]) << " ";} cout << endl;
#define printa2(x,m,n) for(int i = 0; i < m; i++){ for(int j = 0; j < n; j++){ cout << x[i][j] << " ";} cout << endl;}
#define printp(x,n) for(int i = 0; i < n; i++){ cout << "(" << x[i].first << ", " << x[i].second << ") "; } cout << endl;
#define INF (1e18)
using namespace std;
typedef long long ll;
const ll MOD = 1e9 + 7;

void foreach_permutation(int n, std::function<void(int *)> f) {
    int indexes[n];
    for (int i = 0; i < n; i++) indexes[i] = i+1;
    do {
        f(indexes);
    } while (std::next_permutation(indexes, indexes + n));
}

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


typedef struct{
    int x;
    int y;
} P;
typedef struct{
    ll to;
    ll cost;
} edge;
typedef pair<ll, ll> lpair;
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;
}

int main() {
    double R;
    cin >> R;
    double pi =3.141592653589793;
    double ans = pi * 2 * R;
    printf("%lf",ans);


}


Measured memory_bytes: 3788
import java.util.*;
import java.lang.*;

public class Main {

    public static void main(String[] args) {
        Scanner num = new Scanner(System.in);
        int[] A = new int[100];
        int sum = 0;

        int N = num.nextInt();
        for(int i = 0; i < N; i++) {
            A[i] = num.nextInt();    
        }

        for(int i = 0; i < N - 1; i++) {
            for(int j = N - 1; j > i; j--) {
                if(A[j - 1] > A[j]) {
                    int tmp = A[j - 1];
                    A[j - 1] = A[j];
                    A[j] = tmp;
                    sum++;
                }
            }
        }

        for(int i = 0; i < N; i++) {
            System.out.print(A[i]);
            if(i != N - 1) {
                System.out.print(" ");
            }
        }
        System.out.println("\n" + sum);
    }
}


Measured memory_bytes: 26296
import sys
input = sys.stdin.readline

n, c = map(int, input().split())
sushi = [list(map(int, input().split())) for _ in range(n)]

if n == 1:
    print(max(sushi[0][1]-sushi[0][0], sushi[0][1]-(c-sushi[0][0]), 0))
    exit()

x = []
for i in range(n):
    x.append(sushi[i][0])

vcum = []
v = 0
for i in range(n):
    v += sushi[i][1]
    vcum.append(v)

ans = 0

# 1. 時計回りのみ（方向変換なし）
for i in range(n):
    if ans < vcum[i] - x[i]:
        ans = vcum[i] - x[i]


# 2. 反時計回りのみ（方向転換なし）
for i in range(n):
    if i == 0:
        if ans < vcum[n-1] - (c - x[0]):
            ans = vcum[n-1] - (c - x[0])
    else:
        if ans < (vcum[n - 1] - vcum[i - 1]) - (c - x[i]):
            ans = (vcum[n - 1] - vcum[i - 1]) - (c - x[i])


# 3. 時計回りのあと、方向変換して反時計回り
# right_dp[i]: 反時計回りに見て n-1~i番目 (0-index)までの寿司を取れる時(必ずしもi番目を取らなくて良い)の、カロリーの正味の最大値
right_dp = [0] * n
right_dp[n-1] = vcum[n-1] - vcum[n-2] - (c - x[n-1])
for i in reversed(range(1, n-1)):
    right_dp[i] = max(right_dp[i+1], vcum[n-1] - vcum[i-1] - (c - x[i]))

# 時計回りにi番目まで見てから折り返す(すると、反時計回りに回る時に得る正味のカロリーの最大値はright_dp[i+1]となる
for i in range(n-1):
    cal = vcum[i] - 2 * x[i] + right_dp[i+1]
    if ans < cal:
        ans = cal

# 4. 反時計回りのあと、方向変換して時計回り
# left_dp[i]: 時計回りにみてi番目(0-index)までの寿司を取れる時（必ずしもi番目を取らなくて良い）の、カロリーの正味の最大値
left_dp = [0] * n
left_dp[0] = vcum[0] - x[0]
for i in range(1, n):
    left_dp[i] = max(left_dp[i-1], vcum[i] - x[i])

# 反時計回りにi番目まで見てから折り返す (すると、時計回りに回る時に得る正味のカロリーの最大値はleft_dp[i-1]となる)
for i in range(1, n):
    cal = vcum[n-1] - vcum[i-1] - 2 * (c - x[i]) + left_dp[i-1]
    if ans < cal:
        ans = cal


print(ans)


Measured memory_bytes: 40948
#include<iostream>
using namespace std;
int a;
int main()
{
	int n,i,s=1;
	cin>>n;
	for(i=0;i<n;i++)
	 {cin>>a;if(a==s) s++;}
	s--;
	if(s) cout<<n-s;
	else cout<<"-1";
	return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		    Scanner sc = new Scanner(System.in);

		    int n = sc.nextInt();
		    String s = sc.next();

		    if(n>=3200) {
		    	System.out.println(s);
		    }else {
		    	System.out.println("red");
		    }

		    sc.close();
	}
}


Measured memory_bytes: 21588
c, t = [int(x) for x in input().split()]
cost = 1001
try:
  while 1:
    path = [int(x) for x in input().split()]
    if path[1] > t:
      continue
    else:
      if path[0] < cost:
        cost = path[0]
except EOFError:
  if cost != 1001:
    print(cost)
  else:
    print('TLE')

Measured memory_bytes: 3060
import sys, os, math, bisect, itertools, collections, heapq, queue
from decimal import Decimal

# import fractions

sys.setrecursionlimit(10000000)

ii = lambda: int(sys.stdin.buffer.readline().rstrip())
il = lambda: list(map(int, sys.stdin.buffer.readline().split()))
fl = lambda: list(map(float, sys.stdin.buffer.readline().split()))
iln = lambda n: [int(sys.stdin.buffer.readline().rstrip()) for _ in range(n)]

iss = lambda: sys.stdin.buffer.readline().decode().rstrip()
sl = lambda: list(map(str, sys.stdin.buffer.readline().decode().split()))
isn = lambda n: [sys.stdin.buffer.readline().decode().rstrip() for _ in range(n)]

lcm = lambda x, y: (x * y) // math.gcd(x, y)
# lcm = lambda x, y: (x * y) // fractions.gcd(x, y)

MOD = 10 ** 9 + 7
MAX = float('inf')


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

    # エラトステネスの篩で、
    # 2 から 10^5までの素数を列挙
    limit = 10 ** 5 + 1
    prime = [False if n % 2 == 0 or n % 3 == 0 or n % 5 == 0 else True for n in range(limit)]
    prime[0] = prime[1] = False
    prime[2] = prime[3] = prime[5] = True
    for p in range(3, limit, 2):
        if math.sqrt(limit) < p:
            break
        for q in range(p ** 2, limit, p):
            prime[q] = False

    # 累積和
    # 2017に似た数字の数を求めておく
    cnt = [0] * limit
    for n in range(len(cnt)):
        if prime[n] and prime[(n + 1) // 2]:
            cnt[n] = 1
    for n in range(1, len(cnt)):
        cnt[n] += cnt[n - 1]

    # 回答
    Q = ii()
    for q in range(Q):
        l, r = il()
        print(cnt[r] - cnt[l - 1])


if __name__ == '__main__':
    main()


Measured memory_bytes: 9664
N,x = map(int,input().split())
a = [int(i) for i in input().split()]
ans = 0
if a[0] > x:
  ans += (a[0]-x)
  a[0] = x
for i in range(N-1):
  if a[i] + a[i+1] > x:
    ans += (a[i]+a[i+1]-x)
    a[i+1] -= (a[i]+a[i+1]-x)
print(ans)

Measured memory_bytes: 14052
#include <bits/stdc++.h>
#define ll long long
#define x first
#define y second
using namespace std;
typedef pair <int,int> ii;
ii a[10];
int p[10];
int main() {
    int n;
    cin >> n;
    for (int i=0; i<n; i++)
        cin >> a[i].x >> a[i].y;
    double ans=0;
    for (int i=0; i<n; i++)
        for (int j=i+1; j<n; j++)
            ans+=sqrt((a[i].x-a[j].x)*(a[i].x-a[j].x)+(a[i].y-a[j].y)*(a[i].y-a[j].y));
    //p[1]=1;
    //for(int i=2;i<=n;i++) p[i]=p[i-1]*i;
    //ans*=p[n-1]+(n-2)*2*p[n-2];
    ans*=2;
    ans/=n;
    cout<<fixed<<setprecision(8)<<ans;
}


Measured memory_bytes: 3824
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
bool valid(int a, int b, int c){
	return a+b > c && b+c > a && a+c >b;
}
int main() {
	int n;
	int num;
	cin >> n;
	map<int,int>ctr;
	for (int i = 1; i <=n ;i++){
		cin >> num;
		ctr[num]++;
	}
	vector<int>v;
	map<int,int>::iterator it;
	for (it = ctr.begin(); it != ctr.end(); it++)
		v.push_back(it->first);
	n = v.size();
	ll ans = 0;
	for (int i = 0 ; i < n; i++){
		for (int j = i+1 ; j < n; j++){
			for (int k = j+1 ; k < n; k++) {
				if(valid(v[i],v[j],v[k]))
					ans += ctr[v[i]]*ctr[v[j]]*ctr[v[k]];
			}		
		}
	}
	cout << ans;
	return 0;
}

Measured memory_bytes: 3628
A = list(input())
B = list(input())
C = list(input())

turn = "a"
while True:
    if turn == "a":
        if A:
            turn = A.pop(0)
        else:
            print("A")
            break

    if turn == "b":
        if B:
            turn = B.pop(0)
        else:
            print("B")
            break

    if turn == "c":
        if C:
            turn = C.pop(0)
        else:
            print("C")
            break


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

using namespace std;
typedef pair<int, int> P;

int main(void) {
  int n;
  while (cin >> n, n) {
    bool juel[21][21] = {};
    int x, y;
    for (int i = 0; i < n; i++) {
      cin >> x >> y;
      juel[y][x] = true;
    }

    int m, l;
    P p = P(10, 10), dp[4] = {P(0, 1), P(1, 0), P(0, -1), P(-1, 0)};
    char d;
    const string ord = "ENWS";
    cin >> m;
    juel[p.first][p.second] = false;
    for (int i = 0; i < m; i++) {
      cin >> d >> l;
      for (int j = 0; j < l; j++) {
        p.first += dp[ord.find(d)].first;
        p.second += dp[ord.find(d)].second;
        juel[p.first][p.second] = false;
      }
    }

    bool no = false;
    for (int i = 0; i <= 20; i++) {
      for (int j = 0; j <= 20; j++) {
        if (juel[i][j]) no = true;
      }
    }
    cout << (no ? "No" : "Yes") << endl;
  }

  return 0;
}


Measured memory_bytes: 3008
while True:
    N, W = map(int, input().split())
    if not N:
        break
    s = list(sorted([int(input()) for i in range(N)]))
    m = s[-1] // W + 1
    ss = [0] * m
    for c in s:
        ss[c // W] += 1
    unit = max(ss)
    a = 0
    for i, c in enumerate(ss):
        a += (1 - i / (m - 1)) * (c / unit)
    print(a + 0.01)

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

int main() {
	ll n;
	cin >> n;
	vector<char> ans;
	int len = 0;
	ll keta = 1;

	do {
		int r = n % 26;
		if (r==0) r = 26;
		char c = 'a' + r - 1;
		//cout << r << endl;
		ans.push_back(c);
		n -= r;
		n /= 26;
		//keta *= 26;
		len++;
	} while (n>0);

	rep(i,len) cout << ans[len-1-i];

	return 0;
}


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

#define _ << " _ " <<
#define TRACE(x) cout << #x << " = " << x << endl

int n;
string s;


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

    cin >> s;
    n = s.length();

    if (s[0] == '0' || s[n - 1] == '1') {
        cout  << "-1\n";
        return 0;
    }
    
    for (int i = 0; i < n - 1; i++)
        if (s[i] != s[n - 2 - i]) {
            cout << "-1\n";
            return 0;
        }

    int prev = 0;
    for (int i = 1; i < n; i++) {
        cout << prev + 1 << " " << i + 1 << "\n";
        if (s[i - 1] == '1') prev = i;
    }

    return 0;
}



Measured memory_bytes: 1616
#!/usr/bin/env python3

from heapq import heapify, heappop, heappush

n, m = map(int, input().split())
a = list(map(int, input().split()))
a = [-1*item for item in a]
heapify(a)

for i in range(m):
    max = -1* heappop(a)
    heappush(a, int(-1*max/2))  # 要素の挿入

a = [-1*item for item in a]
ans = sum(list(a))

print(ans)


Measured memory_bytes: 14180
import numpy as np

MOD = 998244353

N, S = map(int, input().split())
As = list(map(int, input().split()))

dp = np.zeros((N+1, S+1), np.int64)
dp[:, 0] = 1
dp[1, 0] = 3
if As[0] <= S:
    dp[1, As[0]] = 1
for i in range(1, N):
    A = As[i]
    dp[i+1] += 2 * dp[i] - dp[i-1]
    dp[i+1, A:] += dp[i, :-A] - dp[i-1, :-A]
    dp[i+1] %= MOD

print(dp[N, S])
    

Measured memory_bytes: 82764
#include <algorithm>
#include <bitset>
#include <cmath>
#include <iostream>
#include <queue>
#include <set>
#include <string>
#include <utility>
using namespace std;

#define FOR(i, a, b) for (int i = a; i < b; ++i)
#define RFOR(i, a, b) for (int i = a; i > b; --i)
#define REP(i, n) for (int i = 0; i < n; ++i)

int X, A, B;
int ans = 0;

int main() {
  cin >> X >> A >> B;

  X -= A;
  ans = X % B;

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


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define db(x) cout << #x << " = " << (x) << "\n";
using ll = long long;
using ld = long double;

int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(NULL);
    int a, b, c;
    cin >> a >> b >> c;
    int j = 0;
    for (int i = 100; i >= 1; --i)
    {
        if (a % i == 0 and b % i == 0)
        {
            ++j;
        }
        if (j == c)
        {
            cout << i << endl;
            ;
            return 0;
        }
    }
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#define NUM 13
#define TYPE 4
using namespace std;

int main(){
	int n, num, i, j;
	int card[TYPE][NUM] = {0};
	char ch;
	cin>>n;
	for(i=0;i<n;i++){
		cin>>ch>>num;
		switch(ch){
			case 'S':
				card[0][num-1]++;
				break;
			case 'H':
				card[1][num-1]++;
				break;
			case 'C':
				card[2][num-1]++;
				break;
			case 'D':
				card[3][num-1]++;
				break;
		}
	}
	for(i=0;i<TYPE;i++){
		for(j=0;j<NUM;j++){
			if(card[i][j] == 0){
				switch(i){
					case 0:
					ch = 'S';
						break;
					case 1:
						ch = 'H';
						break;
					case 2:
						ch = 'C';
						break;
					case 3:
						ch = 'D';
						break;
				}
				cout << ch << ' ' << j+1 << endl;
			}
		}
	}
	return 0;
}

Measured memory_bytes: 1160
//
#include <vector>
#include <set>
#include <array>
#include <iostream>
#include <cstdio>
#include <cstdint>
#include <algorithm>
#include <numeric>
#include <bitset>
#include <string>
//
using ll = long long;
using ld = long double;
using namespace std;
#define rep(i,n) for(ll i=0;i<(n);++i)
inline void yes(bool cond) { cond ? puts("Yes") : puts("No"); }
template<typename Type> inline void chmin(Type& a, Type b) { if (a > b) a = b; }
template<typename Type> inline void chmax(Type& a, Type b) { if (a < b) a = b; }
template<typename Arr, typename Type> inline void fill(Arr& arr, Type v) { std::fill(arr.begin(), arr.end(), v); }
template<typename Type> inline void sort(Type& arr) { std::sort(arr.begin(), arr.end()); }
template<typename Type> inline Type nth(vector<Type>& arr, size_t pos) { std::nth_element(arr.begin(), arr.begin() + pos, arr.end()); return arr[pos]; }
constexpr double BIGP = 1000000007L;
constexpr double INF_I = std::numeric_limits<double>::max();
constexpr double INF_F = std::numeric_limits<float>::infinity();
constexpr double PI = 3.14159265358979323846L;
//
int main()
{
    cin.tie(0); ios::sync_with_stdio(false);
    ll N;
    cin >> N;
    set<ll> kku;
    rep(i,9)
    {
        rep(j, 9)
        {
            kku.insert((i+1)*(j+1));
        }
    }
    yes(kku.find(N) != kku.end());
    return 0;
}

Measured memory_bytes: 3056
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.math.BigDecimal;
import java.util.Arrays;

public class Main {

	/* several useful subroutines */
	private static BufferedReader brStdin = new BufferedReader(new InputStreamReader(System.in));
	private static String[] readBuf = null;
	private static int readPtr = 0;
	private static String getString() throws IOException {
		while ( readBuf == null || readPtr >= readBuf.length ) {
			readBuf = brStdin.readLine().split(" ");
			readPtr = 0;
		}
		return readBuf[readPtr++];
	}
	private static int getInt() throws IOException {
		return Integer.parseInt(getString());
	}
	private static long getLong() throws IOException {
		return Long.parseLong(getString());
	}
	private static BigDecimal getBD() throws IOException {
		return new BigDecimal(getString());
	}
	@SuppressWarnings("unused")
	private static String[] getStringArray(int size) throws IOException {
		String stringArray[] = new String[size];
		for (int i = 0; i < stringArray.length; i++) {
			stringArray[i] = getString();
		}
		return stringArray;
	}
	@SuppressWarnings("unused")
	private static int[] getIntArray(int size) throws IOException {
		int intArray[] = new int[size];
		for (int i = 0; i < intArray.length; i++) {
			intArray[i] = getInt();
		}
		return intArray;
	}
	@SuppressWarnings("unused")
	private static long[] getLongArray(int size) throws IOException {
		long longArray[] = new long[size];
		for (int i = 0; i < longArray.length; i++) {
			longArray[i] = getLong();
		}
		return longArray;
	}
	@SuppressWarnings("unused")
	private static BigDecimal[] getBDArray(int size) throws IOException {
		BigDecimal bdArray[] = new BigDecimal[size];
		for (int i = 0; i < bdArray.length; i++) {
			bdArray[i] = getBD();
		}
		return bdArray;
	}
	@SuppressWarnings("unused")
	private static long calculateLCM(long a, long b) throws IOException {
		if ( a  < b ) {
			long t = a;
			a = b;
			b = t;
		}
		while ( b > 0 ) {
			long t = b;
			b = a % b;
			a = t;
		}
		return a;
	}

	
	/* main routine */
	
	public static void main(String args[]) throws IOException {
		int n = getInt();
		int l[] = getIntArray(n);
		Arrays.sort(l);

		int cnt = 0;

		int i,j,k;
		for ( i = 0 ; i < n-2 ; i++ ) {
			for ( j = i+1 ; j < n-1 ; j++ ) {
				for ( k = j+1 ; k < n && l[k] < l[i] + l[j] ; k++ ) {
					if ( k != i && k != j ) {
						cnt++;
					}
				}
			}
		}
		
		System.out.println(cnt);
	}
}


Measured memory_bytes: 22228
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>

using namespace std;
using namespace __gnu_pbds;

using u128 = __uint128_t;

#define int long long
#define idxSet tree<int, null_type,less_equal<int>, rb_tree_tag,tree_order_statistics_node_update>
#define atIdx find_by_order
#define idxOf order_of_key
#define MOD 1000000007
#define MAX 200005
#define endl '\n'

typedef pair<int, int> ii;
typedef vector<int> vi;
typedef vector<ii> vii;

int dp[MAX];

int f(int b , int n){
    if(n < b){
        return n;
    }else return f(b , n / b) + (n % b);
}

void solve() {
    int n , s;
    cin>>n>>s;
    int k = (int)sqrtl((double)n);

    // for k <= sqrt(n)
    for(int i = 2 ; i<= k ; i++){
        if(f(i , n) == s){
            cout<<i<<endl;
            return ;
        }
    }
    if(s > n){
        cout<<-1<<endl;
    }else if(s == n){
        cout<<n + 1 <<endl;
    }else {
        int term = n - s;
        int b = LONG_LONG_MAX;
        for(int i = 1 ; i <= k ; i++){
            if(term % i == 0 && (s - i) >= 0 && i < ((term / i) + 1) && (s - i) < ((term / i) + 1) && (s - i) >= 0){
                b = min(b , (term / i) + 1 );
            }
        }
        if(b != LONG_LONG_MAX){
            cout<<b<<endl;
        }else cout<<-1<<endl;
    }

}

int32_t main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int t = 1;
    //cin>>t;
    while (t--)
        solve();
    return 0;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
#define ote(x) cout<<(x)<<endl
#define all(x) (x).begin(),(x).end()
#define rp(i,s,e) for(int i=(s);i<(e);++i)
#define rpz(i,e) rp(i,0,(e))
#define irp(i,s,e) for(int i=(s);i>(e);--i)
#define irpz(i,s) irp(i,(s),-1)
template<class T>bool chmax(T &a, const T &b){if(a<b){a=b;return 1;}return 0;}
template<class T>bool chmin(T &a, const T &b){if(b<a){a=b;return 1;}return 0;}
template<class T>void outarr(int s,int e,vector<T> &V){
	for(int i=s;i<e;i++)cout<<V[i]<<(i<e-1?" ":"\n");
}
// outarr<int>(0,V.size(),V);
// outarr<ll>(0,V.size(),V);

int N,M,X,Y;
vi XX,YY;

bool solve(){
	vector<pair<int,int>> V;//<point,state:[0|1]=[A|B]>
	V.emplace_back(X, 0);
	rp(i,0,N){
		V.emplace_back(XX[i], 0);
	}
	V.emplace_back(Y, 1);
	rp(i,0,M){
		V.emplace_back(YY[i], 1);
	}

	sort(all(V));

	// for(auto x:V){printf("%3d %3d\n",x.first,x.second);}puts("");//

	// bool ret = false;

	int pre_point, pre_state;
	int point, state;
	tie(pre_point, pre_state) = V[0];
	rp(i, 1, V.size()){
		tie(point, state) = V[i];
		if(pre_state > state){
			return false;
		}
		else if(pre_state < state){
			if(pre_point == point){
				return false;
			}
		}
		pre_point = point;
		pre_state = state;
	}

	return true;
	// return ret;
}

int main(){
	cin>>N>>M>>X>>Y;
	XX.resize(N); rp(i, 0, N) cin>>XX[i];
	YY.resize(M); rp(i, 0, M) cin>>YY[i];
	cout<< (solve()? "No War":"War") <<endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define REP(i,n) for(int i=0;i<(n);i++)
#define ALL(v) (v).begin(),(v).end()
#define int long long
using namespace std;
typedef vector<int>   vint;
typedef pair<int,int> pint;

signed main()
{
    int N,K; cin>>N>>K;

    int ans=(N/K)*(N/K)*(N/K);
    if(K%2==0){
        ans+=((N+K/2)/K)*((N+K/2)/K)*((N+K/2)/K);
    }
    cout<<ans<<endl;
}


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

#define FOR(i,a,b)   for(int i=(a)  ;i<(b) ;i++)
#define RFOR(i,a,b)  for(int i=(b)-1;i>=(a);i--)
#define rep(i,n)     for(int i=0    ;i<(n) ;i++)
#define rrep(i,n)    for(int i=(n)-1;i>=0  ;i--)
#define each(i,a,b)  for(int i=(a)  ;i<=(b);i++)
#define reach(i,a,b) for(int i=(b)  ;i>=(a);i--)
#define all(a)       (a).begin(), (a).end()
#define rall(a)      (a).rbegin(), (a).rend()

int main() {
  int n;
  cin >> n;
  vector<int> vc(n);
  rep(i, n) cin >> vc[i];
  int alice = 0, bob = 0;
  
  rep(i, n/2){
    int index = 0;
    int max_val = 0;
    rep(j, vc.size()){
      if(vc[j] > max_val){
        index = j;
        max_val = vc[j];
      }
    }
    alice += max_val;
    vc.erase(vc.begin() + index);
    index = 0;
    max_val = 0;
    rep(j, vc.size()){
      if(vc[j] > max_val){
        index = j;
        max_val = vc[j];
      }
    }
    bob += max_val;
    vc.erase(vc.begin() + index);
  }
  if(n % 2 == 1) {
    alice += vc[0];
  }
  cout << alice - bob << endl;
  return 0;
}

Measured memory_bytes: 3588
#include<bits/stdc++.h>
#define fast ios::sync_with_stdio(false), cin.tie(0);
#define ll long long
#define endl '\n'

using namespace std;

main()
{
  fast;
  int a,b,c;
  cin>>a>>b>>c;
  if (a==b && a!=c)
    	cout<<"Yes\n";
  else if (b==c && c!=a)
    	cout<<"Yes\n";
  else if (a==c && a!=b)
    	cout<<"Yes\n";
  else
    	cout<<"No\n";
}

Measured memory_bytes: 256
#include<stdio.h>
int main(){
double x,m,n;
scanf("%lf",&x);
m=x;
n=x;
while(scanf("%lf",&x)!=EOF){
if(x>m)m=x;
if(n>x)n=x;
}
printf("%lf\n",m-n);
return 0;
}

Measured memory_bytes: 0