akhauriyash/Code-Regression huggingface dataset:
import java.math.*;
import java.util.*;
import static java.lang.System.*;

public class Main {
	//初期フィールド・メソッド---------------------------------------------
	static Scanner sc = new Scanner(System.in);
	static int min(int... ar) {Arrays.sort(ar); return ar[0];}
	static int max(int... ar) {Arrays.sort(ar); return ar[ar.length-1];}
	//------------------------------------------------------------


	//フィールド追加場所-----------------------------------------------
	//------------------------------------------------------------


	//メソッド追加場所------------------------------------------------
	//------------------------------------------------------------


	//mainメソッド---------------------------------------------------
	public static void main(String[] args) {
		while(sc.hasNext()) {
			int n = sc.nextInt();
			int m = sc.nextInt();
			if (n==0 && m==0) break;
			
			LinkedList<Integer> list = new LinkedList<>();
			for (int i=1; i<=n-1; i++) list.add(i);
			list.addFirst(n);
			
			list.addLast(list.removeFirst());
			while (list.size() != 1) {
				for (int i=0; i<m-1; i++) list.addLast(list.removeFirst());
				list.removeFirst();
			}
			
			out.println(list.getFirst());
		}
	}
	//------------------------------------------------------------
}


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

using namespace std;

#define int long long

const int N = 1e6 + 10;

int a[N], b[N];

signed main()
{
	int n;
	cin >> n;
	for (int i = 1; i <= n; i++)
	{
		cin >> a[i];
		if (a[i] != a[i - 1]) b[++b[0]] = a[i];
	}
	int money = 1000;
	int left = 0;
	int ans = 1000;
	for (int i = 1; i <= b[0]; i++)
	{
		//big
		if ((b[i] > b[i + 1] && b[i] > b[i - 1]) || (i == 1 && b[i] > b[i + 1]) || (i == b[0] && b[i] > b[i - 1]))
		{
			//sell
			if (left)
				money += left * b[i], left = 0;
		}
		if ((b[i] < b[i + 1] && b[i] < b[i - 1]) || (i == 1 && b[i] < b[i + 1]) || (i == b[0] && b[i] < b[i - 1]))
		{
			if (money)
				left += money / b[i], money %= b[i];
		}
		ans = max(ans, money);
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 3632
n=int(input())
s = str(input())
r = 0
w = 0
d = 0
for i in range(n):
    if (s[i] == 'R'):
        r += 1
    else:
        w += 1
sd = sorted(s)
for i in range(n):
    if (s[i] != sd[i]):
        d += 1

if (w == 0 or r == 0):
    print(0)
else:
    print(min(r, w, int(d/2)))



Measured memory_bytes: 11252
#include <iostream>
using namespace std;
int main()
{
  int A, B, C;
  cin >> A >> B >> C;
  int ans = 0;
  if (A == B && B == C)
  {
    if (A % 2 == 0)
      cout << -1 << endl;
    else
      cout << 0 << endl;
    return 0;
  }
  while (A % 2 == 0 && B % 2 == 0 && C % 2 == 0)
  {
    int tmpA = A;
    int tmpB = B;
    int tmpC = C;
    A = tmpB / 2 + tmpC / 2;
    B = tmpA / 2 + tmpC / 2;
    C = tmpA / 2 + tmpB / 2;
    ans++;
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
<?php
  list($n) = explode(" ", trim(fgets(STDIN)));
$a = array_map('intval', explode(" ", trim(fgets(STDIN))));
  $ans=0;
$prev=$a[0];
for ($i=1; $i<$n; $i++) {
  if($a[$i]-$a[$i-1] < 0){
    $ans+=$a[$i-1]-$a[$i];
  }
}
echo $ans+$a[$n-1];

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

int main() {
  int n;
  cin >> n;
  if(n == 1){
    cout << 1 << endl;
  }
  if(2 <= n && n < 4){
    cout << 2 << endl;
  }
  if(4 <= n && n < 8){
    cout << 4 << endl;
  }
  if(8 <= n && n < 16){
    cout << 8 << endl;
  }
  if(16 <= n && n < 32){
    cout << 16 << endl;
  }
  if(32 <= n && n < 64){
    cout << 32 << endl;
  }
  if(64 <= n && n < 101){
    cout << 64 << endl;
  }
	return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
int main()
{
    int a, b, sum = 1, cnt = 0;
    scanf("%d%d", &a, &b);
    while (1)
    {
        if (sum < b)
        {
            sum += a - 1;
            cnt++;
        }
        else
        {
            break;
        }
    }
    printf("%d\n", cnt);
    return 0;
}

Measured memory_bytes: 128
import itertools
n = int(input())
XY = []
for i in range(n):
    x, y = map(int, input().split())
    XY.append((x, y))
d = 0
for P in itertools.permutations(XY):
    for i in range(1, n):
        x0, y0 = P[i-1]
        x1, y1 = P[i]
        d += ((x0-x1)**2+(y0-y1)**2)**0.5
k = 1
for i in range(1, n+1):
    k *= i
print(d/k)


Measured memory_bytes: 3064
package main

import (
    "fmt"
    "sort"
)

func main() {
    
	var n, l int
	fmt.Scanf("%d %d",&n, &l)
	
	s := make([]string, n)
	for i := 0; i < n; i++ {
	    fmt.Scan(&s[i])
	}
	
	sort.Strings(s)
	
	for i := 0; i < n; i++ {
	    fmt.Print(s[i])
	}
	
	fmt.Println()
	
}

Measured memory_bytes: 512
#include<iostream>
#include<cstring>
using namespace std;
int main(){
	char s[20]={0};
	cin>>s;
	if(strlen(s)%2==1){
		cout<<"No";
		return 0;
	} 
	for(int i=0;i<strlen(s)-1;i+=2){
		if(s[i]!='h'||s[i+1]!='i'){
			cout<<"No";
			return 0;
		}
	}
	cout<<"Yes";
	return 0;
} 

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

#ifdef DEBUG
#define PRINT(x)\
    cout<<"func "<<__func__<<": line "<<__LINE__<<": "<<#x<<" = "<<(x)<<endl;
#define PRINTA(a,first,last)\
    cout<<"func "<<__func__<<": line "<<__LINE__<<": "<<#a<<"["<<(first)<<", "<<(last)<<")"<<endl;\
    for (int i=(first);i<(last);++i){cout<<#a<<"["<<i<<"] = "<<(a)[i]<<endl;}
#else
#define PRINT(x)
#define PRINTA(a,first,last)
#endif

#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 pb push_back
#define mp make_pair
#define all(a) (a).begin(),(a).end()
#define MOD 1000000007

using namespace std;

using ll = long long;
using ull = unsigned long long;
using pii = pair<int, int>;

template <class T, class U> void amax(T& x, U y) {if (x < y) x = y;}
template <class T, class U> void amin(T& x, U y) {if (x > y) x = y;}

int main(void)
{
    const int N_MAX = 100000;
    int N;
    int a[N_MAX];
    cin >> N;
    REP(i, N) cin >> a[i];
    bool all_even = true;
    REP(i, N) {
        if (a[i] % 2 == 1) {
            all_even = false;
            break;
        }
    }
    if (all_even) {
        cout << "second" << endl;
    } else {
        cout << "first" << endl;
    }
    return 0;
}



Measured memory_bytes: 640
N =input()
A = list(map(int,input().split()))
cnt=0
ans=0
wh=1
while(wh==1):
    for j in range(len(A)):
        if A[j]%2==0:
            cnt+=1
            A[j]/=2
        else: wh=0
        if (j==len(A)-1 and cnt==len(A)):
            cnt=0
            ans+=1
print(ans)

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

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

    int maxsum=0;
    
    maxsum = min(a, k);
    k-=a;
    if(k>0){
        k -= b;
    }
    if(k>0){
        maxsum -= min(c, k);
    }
    
    cout << maxsum << endl;

    return 0;
}

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

using namespace std;

int main()
{
    int i,p=0,q=0;
    long long k,sum=0,sum1=0;
    string s;
    cin>>s>>k;
    for(i=1; i<s.length(); i++)
        if(s[i]!=s[i-1])
            q=1;
    if(q==0)
    {
        sum=(k*s.length())/2;
    }
    else
    {
        for(i=1; i<s.length(); i++)
            if(s[i-1]==s[i])
            {
                sum++;
                i++;
            }
        if(k>1)
        {
            s+=s;
            for(i=1; i<s.length(); i++)
            {
                if(s[i-1]==s[i])
                {
                    sum1++;
                    i++;
                }
            }
            sum1=sum1-sum;
            sum=sum+sum1*(k-1);
        }
    }
    cout <<sum<< endl;
    return 0;
}

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

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

		while((str=br.readLine()) != null){
			int n = Integer.parseInt(str);
			int count = 0;
			int prime[] = new int[n+1];


				for(int i=2; i<=n; i++){
					if(prime[i]==0){
						for(int j=i*2; j<=n; j = j+i){
							prime[j]=1;
						}
					}
				}
				for(int i=2; i<=n; i++){
					if(prime[i]==0){
						count++;
					}
				}

			System.out.println(count);
		}
	}
}

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

using namespace std;

//BEGIN
class DisjointSet {
private:
	vector<int> rank, size, p;
	int num = 0;;
public:
	DisjointSet() {}
	DisjointSet(int n) {
		num = n;
		rank.assign(n, 0);
		size.assign(n, 1);
		p.assign(n, 0);
		for (int i = 0; i < n; i++) p[i] = i;
	}

	bool same(int x, int y) {
		return root(x) == root(y);
	}

	void unite(int x, int y) {
		x = root(x), y = root(y);
		if (x == y) return;
		num--;
		if (rank[x] > rank[y]) {
			p[y] = x;
			size[x] += size[y];
		} else {
			p[x] = y;
			size[y] += size[x];
			if (rank[x] == rank[y]) rank[y]++;
		}
	}

	int root(int x) {
		return p[x]==x?x:p[x]=root(p[x]);
	}

	int get_size(int x) {
		return size[root(x)];
	}

	int forest_size() {
		return num;
	}
};
//END

int main() {
	int n, q; cin >> n >> q;
	DisjointSet ds(n);
	for (int i = 0; i < q; ++i) {
		int t, a, b; cin >> t >> a >> b;
		if (t == 0) ds.unite(a, b);
		else if (t == 1) {
			if (ds.same(a, b)) cout << 1 << endl;
			else cout << 0 << endl;
		}
	}
	
	return 0;
}


/*
	created: 2019-08-27
	https://onlinejudge.u-aizu.ac.jp/courses/library/3/DSL/all/DSL_1_A
*/


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

using namespace std;

int N, col[209], d[209];
char sir[209][209];

void dfs (int nod, int c)
{
    col[nod] = c;
    for (int i=1; i<=N; i++)
        if (sir[nod][i] == '1' && col[i] == 0)
            dfs (i, 3 - c);
}

int main ()
{
//freopen ("input", "r", stdin);
//freopen ("output", "w", stdout);

scanf ("%d\n", &N);
for (int i=1; i<=N; i++)
    scanf ("%s\n", sir[i] + 1);
dfs (1, 1);
for (int i=1; i<=N; i++)
    for (int j=i+1; j<=N; j++)
        if (sir[i][j] == '1' && col[i] == col[j])
        {
            printf ("-1\n");
            return 0;
        }
int ans = 0;
for (int i=1; i<=N; i++)
{
    queue < int > cc;
    cc.push (i);
    for (int j=1; j<=N; j++)
        d[j] = -1;
    d[i] = 0;
    while (!cc.empty ())
    {
        int nod = cc.front ();
        cc.pop ();
        for (int j=1; j<=N; j++)
            if (sir[nod][j] == '1' && d[j] == -1)
                d[j] = d[nod] + 1, cc.push (j);
    }
    for (int j=1; j<=N; j++)
        if (d[j] > ans)
            ans = d[j];
}
printf ("%d\n", ans + 1);
return 0;
}


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

int main(void){
  int n;
  cin >> n;
  int x[100010];
  int y[100010];
  int t[100010];

  for(int i=0; i<n; i++){
    cin >> t[i] >> x[i] >> y[i];

  }
  for(int i=0; i<n; i++){
    if(t[i]<x[i]+y[i]){cout << "No" <<endl;return 0;}
    else if(t[i]%2==1 && (x[i]+y[i])%2==0){cout << "No" <<endl;return 0;}
    else if(t[i]%2==0 && (x[i]+y[i])%2==1){cout << "No" <<endl;return 0;}
  }

  cout << "Yes" << endl;
  return 0;
}


Measured memory_bytes: 1408
import java.util.ArrayList;
import java.util.Collections;
import java.util.Scanner;
public class Main
{
	public static void main(String arg[])
	{
		Scanner in=new Scanner(System.in);
		for(;;)
		{
			int n=in.nextInt();
			String t=in.nextLine();
			ArrayList<String> AL=new ArrayList<String>();
			if(n==0)
				return;
			for(int i=0;i<n;i++)
			{
				String s[]=in.nextLine().split(" ");
				for(int j=0;j<s.length;j++)
					AL.add(s[j]);
			}
			String se=in.next();
			for(int i=0;i<AL.size();i++)
				if(se.charAt(0)!=AL.get(i).charAt(0))
				{
					AL.remove(i);
					i--;
				}
			if(AL.isEmpty())
			{
				System.out.println("NA");
				continue;
			}
			Collections.sort(AL);
			int count[]=new int[AL.size()];
			for(int i=0;i<AL.size()-1;i++)
			{
				while(i+1<AL.size()&&AL.get(i).equals(AL.get(i+1)))
				{
					count[i]++;
					AL.remove(i);
				}
			}
			ArrayList<Integer> cou=new ArrayList<Integer>();
			for(int i=0;i<count.length;i++)
				cou.add(count[i]);

			ArrayList<String> ANS=new ArrayList<String>();
			while(!AL.isEmpty())
			{
				int m=0;
				for(int j=0;j<cou.size();j++)
				{
					if(cou.get(m)<cou.get(j))
						m=j;
				}
				ANS.add(AL.get(m));
				AL.remove(m);
				cou.remove(m);
			}
			int p=0;
			for(int i=0;i<ANS.size();i++)
			{
				if(p==0)
					System.out.print(ANS.get(i));
				else
					System.out.print(" "+ANS.get(i));
				if(i>3)
					break;
				p=1;
			}
			System.out.println();
		}
	}
}

Measured memory_bytes: 13000
def main():
    N = int(input())
    A = list(map(int, input().split()))

    R = [1]
    for i in range(1, 8):
        R.append(400 * i)
    # print(R)
    
    st = set()
    free = 0
    for ai in A:
        if ai >= 3200:
            free += 1
            continue
        for ri in R[::-1]:
            if ai >= ri:
                st.add(ri)
                break
    # print(st)
    # print(free)
    

    print(max(1, len(st)), len(st) + free)

if __name__ == "__main__":
    main()

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
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; }
typedef long long ll;

int main() {
  int N;
  cin >> N;
  vector<vector<ll>> a(101000, vector<ll>(3));
  vector<vector<ll>> dp(101000, vector<ll>(3));
  
  for(int i = 0;i<N;i++){
    for(int j = 0;j<3;j++){
      cin >> a[i][j];
    }
  }
  
  for(int i = 0;i<N;i++){
   for(int j = 0;j<3;j++){
    for(int k = 0;k<3;k++){
      if(j ==k) continue;
      chmax(dp[i+1][k],dp[i][j] + a[i][k]);
    }
   }
  }
  cout<< max(dp[N][0],max(dp[N][1],dp[N][2]))<< endl;

  
}


Measured memory_bytes: 11264
#include <bits/stdc++.h>
#include <algorithm>
#define rep(i, n) for (int i=0; i<n; ++i)
#define all(obj) (obj).begin(),(obj).end()
using namespace std;
typedef long long ll;
 
int main(){
    int A, B, C, D;
    cin >> A >> B >> C >> D;
    while(A>0||B>0){
        C -= B;
        if(C<=0){
            cout << "Yes" << endl;
            return 0;
        }
        A -= D;
        if(A<=0){
            cout << "No" << endl;
            return 0;
        }
    }
    return 0;
 }

Measured memory_bytes: 3624
#include<iostream>
#include<iomanip>
#include<string>
#include<algorithm>
#include<cmath>
using namespace std;
int main(){
    float a;
    while(cin>>a){
        if(a<=48.00){
            cout<<"light fly"<<endl;
        }else if(a<=51.00){
            cout<<"fly"<<endl;
        }else if(a<=54.00){
            cout<<"bantam"<<endl;
        }else if(a<=57.00){
            cout<<"feather"<<endl;
        }else if(a<=60.00){
            cout<<"light"<<endl;
        }else if(a<=64.00){
            cout<<"light welter"<<endl;
        }else if(a<=69.00){
            cout<<"welter"<<endl;
        }else if(a<=75.00){
            cout<<"light middle"<<endl;
        }else if(a<=81.00){
            cout<<"middle"<<endl;
        }else if(a<=91.00){
            cout<<"light heavy"<<endl;
        }else{
            cout<<"heavy"<<endl;
        }
    }
    
    return 0;
}

Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
inline int read()
{
	char ch=getchar(); int nega=1; while(!isdigit(ch)) {if(ch=='-') nega=-1; ch=getchar();}
	int ans=0; while(isdigit(ch)) {ans=ans*10+ch-48;ch=getchar();}
	if(nega==-1) return -ans;
	return ans;
}
#define N 200005
int a[N];
double sum[N];
signed main()
{
#ifdef __LOCAL__
	freopen("in.txt","r",stdin);
#endif
	int n=read(),k=read();
	for(int i=1;i<=n;i++) a[i]=read();
	for(int i=1;i<=n;i++) sum[i]=sum[i-1]+(a[i]+1.0)/2;
	double ans=0;
	for(int i=k;i<=n;i++)
	{
		double r=sum[i]-sum[i-k];
		if(r>ans) ans=r;
	}
	printf("%.6lf\n",ans);
#ifdef __LOCAL__
	cout<<"Time Used : "<<clock()<<endl;
#endif
	return 0;
}



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

int n, d, s, sq, cnt, a[15][15];
int main() {
	int i, j, k;
	cin>>n>>d;
	for(i=0; i<n; i++) for(j=0; j<d; j++) cin>>a[i][j];
	for(i=0; i<n; i++) for(j=i+1; j<n; j++) {
		s = 0;
		for(k=0; k<d; k++) {
			s += (a[i][k] - a[j][k]) * (a[i][k] - a[j][k]);
		}
		sq = sqrt(1.0 * s);
		if(sq * sq == s) cnt++;
	}
	cout<<cnt;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
const int MOD = 1e9 + 7;
const long long INF = 1e15;

#include <math.h>
#define PI 3.14159265358979323846264338327950L

int main() {
    int n;
    cin >> n;
    string s;
    cin >> s;
    int i = 0;
    int j = n - 1;
    int cnt = 0;
    while (i < j) {
        if (s[i] != s[j] && s[i] == 'W') {
            cnt++;
            i++;
            j--;
        }
        else {
            if (s[i] == 'W') {
                j--;
            }
            else {
                i++;
            }
        }
    }
    cout << cnt;

    return 0;
}

Measured memory_bytes: 3748
#include <iostream>
using namespace std;
int main()
{
	int n, m = 0, i, j, k, a[10000] = {}, c = 0, p[10000] = {};
	bool b;
	
	cin >> n;
	for(i = 0; i < n; ++i){
		cin >> a[i];
		if( m < a[i] ) 
			m = a[i];
	}
	++m;
	m = min(m, 10000);
	
	for(i = 2; i < m; ++i){
		if( p[i] == 0 ){
			p[i] = 1;
			k = m/i;
			for(j = 2; j <= k; ++j)
				p[i * j] = 2;
		}
	}

	for(i = 0; i < n; ++i){
		if( a[i] <= 10000 ){
			if( p[a[i]] == 1 )
				++c;
		} else {
			b = true;
			for(j = 2; j < 10000; ++j){
				if( p[j] == 1 && a[i] % j == 0 ){
					b = false;
					break;
				}
			}
			if( b )
				++c;
		}
	}

	cout << c << "\n";

	return 0;
}

Measured memory_bytes: 1248
#include <stdio.h>

int main(void){
    int i,n,T;
    scanf("%d %d",&n,&T);
    int c,t,min_c=1001;
    for(i=0;i<n;i++){
        scanf("%d %d",&c,&t);
        if(t<=T){
            if(c<min_c) min_c=c;
        }
    }
    if(min_c<1001){
        printf("%d\n", min_c);
    }else{
        printf("TLE\n");
    }
    return 0;
}

Measured memory_bytes: 128
#include <cstdio>

using namespace std;

int main()
{
	// v = 9.8t y = 4.9t^2
	
	double t,y,x;
	int n;
	
	while(scanf("%lf", &x) != EOF){
	
		t = x / 9.8;
		y = 4.9 * t * t;
		
		n = y;
		
		n /= 5;
		
		printf("%d\n", n+2);
	}
	return(0);
}

Measured memory_bytes: 1056
#include<stdio.h>
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<string.h>
using namespace std;

typedef long long LL;
typedef vector<int> VI;

#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define EACH(i,c) for(__typeof((c).begin()) i=(c).begin(),i##_end=(c).end();i!=i##_end;++i)
#define eprintf(...) fprintf(stderr, __VA_ARGS__)

template<class T> inline void amin(T &x, const T &y) { if (y<x) x=y; }
template<class T> inline void amax(T &x, const T &y) { if (x<y) x=y; }
template<class Iter> void rprintf(const char *fmt, Iter begin, Iter end) {
    for (bool sp=0; begin!=end; ++begin) { if (sp) putchar(' '); else sp = true; printf(fmt, *begin); }
    putchar('\n');
}

int N, M;
int A[200011];
int C[200011];
int P[200011];
int cnt = 0;

void MAIN() {
    scanf("%d%d", &N, &M);
    REP (i, N) scanf("%d", A+i);

    REP (i, N) {
	int pos = A[i] - C[A[i]];
	if (pos > 0) {
	    if (P[pos] == 0) cnt++;
	    P[pos]++;
	}
	C[A[i]]++;
    }

    REP ($, M) {
	int x, y;
	scanf("%d%d", &x, &y);
	x--;

	C[A[x]]--;
	int pos = A[x] - C[A[x]];
	if (pos > 0) {
	    if (P[pos] == 1) cnt--;
	    P[pos]--;
	}

	A[x] = y;

	pos = A[x] - C[A[x]];
	if (pos > 0) {
	    if (P[pos] == 0) cnt++;
	    P[pos]++;
	}
	C[A[x]]++;
	printf("%d\n", N - cnt);
    }

}

int main() {
    int TC = 1;
//    scanf("%d", &TC);
    REP (tc, TC) MAIN();
    return 0;
}



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

template<class T> inline void YES(T condition){ if(condition) cout << "YES" << endl; else cout << "NO" << endl; }
template<class T> inline void Yes(T condition){ if(condition) cout << "Yes" << endl; else cout << "No" << endl; }
template<class T> inline void POSS(T condition){ if(condition) cout << "POSSIBLE" << endl; else cout << "IMPOSSIBLE" << endl; }
template<class T> inline void Poss(T condition){ if(condition) cout << "Possible" << endl; else cout << "Impossible" << endl; }
template<class T> inline void First(T condition){ if(condition) cout << "First" << endl; else cout << "Second" << endl; }
int character_count(string text, char character){ int ans = 0; for(int i = 0; i < text.size(); i++){ ans += (text[i] == character); } return ans; }
long power(long base, long exponent, long module){ if(exponent % 2){ return power(base, exponent - 1, module) * base % module; }else if(exponent){ long root_ans = power(base, exponent / 2, module); return root_ans * root_ans % module; }else{ return 1; }}
struct position{ int y, x; }; position move_pattern[4] = {{-1, 0}, {0, 1}, {1, 0}, {0, -1}}; // double euclidean(position first, position second){ return sqrt((second.x - first.x) * (second.x - first.x) + (second.y - first.y) * (second.y - first.y)); }
template<class itr> void array_output(itr start, itr goal){ string ans; for(auto i = start; i != goal; i++){ ans += to_string(*i) + " "; } ans.pop_back(); cout << ans << endl; }
long gcd(long a, long b){ if(a && b){ return gcd(min(a, b), max(a, b) % min(a, b)); }else{ return a; }}
#define mod long(1e9 + 7)
#define all(x) (x).begin(), (x).end()
#define bitcount(n) __builtin_popcount(n)

int main(){
    int N;
    cin >> N;
    vector<int> prime_sieve(1e5, -1);
    for(int i = 2; i * i < 1e5; i++){
        if(prime_sieve[i] == -1){
            prime_sieve[i] = 1;
            for(int j = i * 2; j < 1e5; j += i){
                prime_sieve[j] = 0;
            }
        }
    }
    vector<int> ans;
    for(int i = 6; ans.size() < N; i += 5){
        if(prime_sieve[i]){
            ans.push_back(i);
        }
    }
    array_output(all(ans));
}



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

using namespace std;

int main() {
    int n;
    cin >> n;
    vector<string> dp[n + 1][n + 1];
    dp[1][1].emplace_back("a");
    for (int i = 2; i <= n; i++) {
        for (int k = 1; k <= i; k++) {
            vector<string> next;
            for (auto s: dp[i - 1][k]) {
                for (int l = 0; l < (int)s.size(); l++) {
                    next.emplace_back(s + s[l]);
                }
            }
            for (auto s: dp[i - 1][k - 1]) {
                set<char> sc;
                for (auto c: s) {
                    sc.emplace(c);
                }
                next.emplace_back(s + char('a' + sc.size()));
            }
            dp[i][k] = next;
        }
    }
    set<string> ans;
    for (auto s: dp[n]) {
        for (auto a: s) {
            ans.emplace(a);
        }
    }
    for (auto a: ans) {
        cout << a << endl;
    }
    return 0;
}


Measured memory_bytes: 294420
loop do
  m, f, r = gets.split.map(&:to_i)
  break if m == -1 && f == -1 && r == -1

  p = m + f

  if m == -1 || f == -1 || p < 30
    puts 'F'
  elsif p >= 80
    puts 'A'
  elsif p >= 65 && p < 80
    puts 'B'
  elsif (p >= 50 && p < 65) || r >= 50
    puts 'C'
  else
    puts 'D'
  end
end



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

void solve(long long sx, long long sy, long long tx, long long ty){
    ll dx = (tx - sx);
    ll dy = (ty - sy);
    string ans = "";
    ans = ans + string(dy, 'U') + string(dx, 'R');
    ans = ans + string(dy, 'D') + string(dx, 'L');
    ans = ans + 'L' + string(dy+1, 'U') + string(dx+1, 'R') + 'D';
    ans = ans + 'R' + string(dy+1, 'D') + string(dx+1, 'L') + 'U';
    cout << ans << endl;
    return;
}

int main(){
    long long sx;
    scanf("%lld",&sx);
    long long sy;
    scanf("%lld",&sy);
    long long tx;
    scanf("%lld",&tx);
    long long ty;
    scanf("%lld",&ty);
    solve(sx, sy, tx, ty);
    return 0;
}


Measured memory_bytes: 3672
S=input()
i=0
while i<=len(S):
    if i==len(S):
        print("YES")
        exit()

    if S[i:i+11] == "dreameraser":
        i+=11
        continue
    elif S[i:i+10] == "dreamerase":
        i+=10
        continue
    elif S[i:i+7] == "dreamer":
        i+=7
        continue
    elif S[i:i+6] == "eraser":
        i+=6
        continue
    elif S[i:i+5] in ["dream","erase"]:
        i+=5
        continue
    else:
        print("NO")
        exit()


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

typedef long long ll;
typedef pair<int,int> P;
typedef map<int,int> M;
typedef vector<int> V;
typedef queue<int> Q;
typedef pair<long,long> PLL;
typedef map<long,long> MLL;
typedef vector<long long> VLL;
typedef vector<pair<int,int>> VP;
typedef vector<vector<int>> VV;
#define INF (int)(1e9)
#define MAXX 1.1529215e+18
#define inf 999999
#define EPS (1e-7)
#define MOD (1e9+7)
#define rep(i,n) for(int i=0; i<(int)(n);i++)
#define REP(i,n) for(int i=1;i<=(int)(n);i++)
#define rrep(i,n) for(int i=(int)(n-1);i>=0;i--)
#define FOR(i,k,n) for(int i=(k);i<(int)(n);i++)
#define ALL(a)  a.begin(),a.end()
#define RALL(a) a.begin(),a.end(),greater<int>()
#define PRALL(a) a.begin(),a.end(),greater<pair<int,int>>()
#define ROT(a) a.begin(),a.begin()+1,a.end()
#define RROT(a) a.begin(),a.end()-1,a.end()
#define PB push_back
#define MP make_pair
#define PI acos(-1.0)
/*--------------------------------------------*/
V g[inf];//隣接リストの作成
bool visited[inf];
bool flag=false;
void dfs(int,int);
int n;
int main(){
    int m;cin>>n>>m;
    rep(i,m){
        int a,b;cin>>a>>b;
        a--;b--;//0-index;
        //無向グラフ
        g[a].PB(b);
        g[b].PB(a);
    }
    dfs(0,0);
    cout<<(flag?"POSSIBLE":"IMPOSSIBLE")<<endl;
}
void dfs(int depth,int v){
    visited[v]=true;
    if(depth==2){
        if(v==n-1)flag=true;
        return;
    }
    //vから行ける各頂点について
    rep(i,(int)g[v].size()){
        //printf("v,next_v=%d,%d\n",v,g[v][i]);
        if(visited[g[v][i]])continue;//訪問済みはスルー
        dfs(depth+1,g[v][i]);
    }
}

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

using namespace std;

const int N = 1e5 + 9, OO = 0x3f3f3f3f;

int n, k, h[N], dp[N];

int solve(int i){
    if(i == n - 1)  return 0;
    if(i >= n)   return 1e9;

    int &ret = dp[i];
    if(~ret)    return ret;

    ret = OO;
    for(int j = 1;j <= k;j++)
        ret = min(ret, abs(h[i] - h[i + j]) + solve(i + j));

    return ret;
}

int main(){

    cin >> n >> k;
    for(int i = 0;i < n;i++)
        cin >> h[i];

    memset(dp, -1, sizeof dp);

    cout << solve(0);
}


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

using namespace std;

int main(){
  int A,B,T;
  cin >> A >> B >> T;

  int tmp = T/A;
  int result;

  if(A > T){
    result = 0;
  }
  else{
    result = tmp*B;
  }

  cout << result << endl;
 
}



Measured memory_bytes: 256
N = int(input())
strng = [input() for i in range(N)]

counts = [0]*4
for i in range(N):
    if strng[i] == 'AC':
        counts[0] += 1
    elif strng[i] == 'WA':
        counts[1] += 1
    elif strng[i] == 'TLE':
        counts[2] += 1
    elif strng[i] == 'RE':
        counts[3] += 1

print('AC x ' + str(counts[0]))
print('WA x ' + str(counts[1]))
print('TLE x ' + str(counts[2]))
print('RE x ' + str(counts[3]))

Measured memory_bytes: 16244
#include<iostream>
#include<iomanip>
//#include<cstdio>
#include<vector>
#include<map>
#include<queue>
#include<algorithm>
#include<cmath>
#include<cassert>
using namespace std;
typedef long long ll;
const int Mmax = 1e5;
int N, M, A[Mmax], B[Mmax];

class UnionFind{
	vector<int> par, rnk, cnt;
	public:
	UnionFind(int n){
		par=vector<int>(n);
		rnk=vector<int>(n,0);
		cnt=vector<int>(n,1);
		for(int i=0; i<n; i++) par[i]=i;
	}
	int root(int i){
		if(par[i]==i) return i;
		return par[i]=root(par[i]);
	}
	void unite(int i, int j){
		int ri = root(i);
		int rj = root(j);
		if(ri==rj) return;

		if(rnk[ri]==rnk[rj]){
			cnt[rj] += cnt[ri];
			par[ri] = rj;
			rnk[rj]++;
		}
		else if(rnk[ri] < rnk[rj]){
			cnt[rj] += cnt[ri];
			par[ri] = rj;
		}
		else{
			cnt[ri] += cnt[rj];
			par[rj] = ri;
		}
	}
	bool same(int i, int j){
		return root(i) == root(j);
	}
	int count(int i){
		return cnt[root(i)];
	}
};

int main(){
	cin >> N >> M;
	for(int i=0; i<M; i++){
		cin >> A[i] >> B[i];
		A[i]--; B[i]--;
	}

	ll total = (ll)N*(N-1)/2;
	vector<ll> ans(1, total);
	UnionFind uf(N);
	for(int i=M-1; i>=0; i--){
		if(uf.same(A[i], B[i])){
			ans.push_back(total);
		} else {
			total -= (ll)uf.count(A[i])*uf.count(B[i]);
			ans.push_back(total);
			uf.unite(A[i], B[i]);
		}
	}
	for(int i=M-1; i>=0; i--){
		cout << ans[i] << endl;
	}

	return 0;
}


Measured memory_bytes: 4212
#include<algorithm>
#include<bitset>
#include<climits>
#include<cmath>
#include<cstdlib>
#include<iomanip>
#include<iostream>
#include<map>
#include<numeric>
#include<queue>
#include<set>
#include<string>
#include<time.h>
#include<tuple>
#include<utility>
#include<vector>

using namespace std;
const long mod = 1000000007;

struct UnionFind {
	vector<long> par;//親を返す

	UnionFind(long N) : par(N) {
		for (int i = 0; i < N; i++) par[i] = i;//全て根である状態
	}

	long root(long i) {//根を返す
		if (par[i] == i) return i;
		return par[i] = root(par[i]); //根に直接繋ぎなおす
	}

	void unite(long x, long y) {//二つの木の統合(rxをryに繋ぐ)
		long rx = root(x);
		long ry = root(y);

		if (rx == ry) return;
		par[rx] = ry;
	}

	bool same(long x, long y) { return root(x) == root(y); }//根が等しいか
};

int main() { 
	//逆から走査する 
	long N, M; cin >> N >> M;
    
	vector<long> F(M + 1);//崩落後の不便さ
	vector<long> able(N);//ある島から直接渡れる島の数
	vector<pair<long, long>> bridge(M);//入力リスト

	F[M] = N * (N - 1) / 2;
	for (int i = 0; i < N; i++) able[i] = 1;//全崩落直後
	
	UnionFind tree(N);


	for (int i = 0; i < M; i++) {//入力
		long A, B; cin >> A >> B;
		A--; B--;
		bridge[i] = make_pair(A, B);
	}

	for (int i = M - 1; i >= 0; i--) {
		long A, B; 
		A = bridge[i].first;
		B = bridge[i].second;

		if (tree.same(A, B)) {
			F[i] = F[i + 1];
		}
		else {
			F[i] = F[i + 1] - (able[tree.root(A)] * able[tree.root(B)]);
            //ここそれぞれのグラフの代表として根を使ってみる(大丈夫か?)
			able[tree.root(A)] += able[tree.root(B)];
			able[tree.root(B)] = able[tree.root(A)];
			tree.unite(A, B);
		}
	}

	for (int i = 1; i <= M; i++) cout << F[i] << endl;
}

Measured memory_bytes: 5248
import math, sys
from bisect import bisect_left, bisect_right
from collections import Counter, defaultdict, deque
from copy import deepcopy
from functools import lru_cache
from heapq import heapify, heappop, heappush
from itertools import accumulate, combinations, permutations
input = sys.stdin.readline
mod = 10**9 + 7
ns = lambda: input().strip()
ni = lambda: int(input().strip())
nm = lambda: map(int, input().split())
nl = lambda: list(map(int, input().split()))

def main():
    a, b, h, m = nm()

    rad = 2*math.pi*((h+m/60)/12 - m/60)

    print(math.sqrt(a**2 + b**2 - 2*a*b*math.cos(rad)))


if __name__ == '__main__':
    main()

Measured memory_bytes: 10036
import java.util.*;

public class Main {

    public static void main(String args[]) {

        // 入力
        Scanner sc = new Scanner(System.in);
        int h = Integer.parseInt(sc.next());
        int w = Integer.parseInt(sc.next());
        List<List<String>> list = new ArrayList<>();
        for (int i = 0; i < h; i++) {
            list.add(new ArrayList<>());
            for (int j = 0; j < w; j++) {
                list.get(i).add(sc.next());
            }
        }
        sc.close();

        // 主処理
        char column = 'A';
        int line = 1;
        for (int i = 0; i < h; i++) {
            for (int j = 0; j < w; j++) {
                if ("snuke".equals(list.get(i).get(j))) {
                    column = (char) ((int) column + j);
                    line += i;
                    break;
                }
            }
        }
        String result = column + Integer.toString(line);

        // 出力
        System.out.println(result);
    }
}


Measured memory_bytes: 21844
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return true; } return false; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return true; } return false; }
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define mp make_pair
#define si(x) int(x.size())
const int mod=1000000007,MAX=2005,INF=1<<30;

double amari(double x,double y){
    int z=x/y;
    if(y*z>=x) return min(y,x-y*(z-1));
    else return min(y,x-y*z);
}

int main(){
    
    std::ifstream in("text.txt");
    std::cin.rdbuf(in.rdbuf());
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    double goal,lim;
    int N;
    cin>>goal>>N>>lim;
    
    vector<double> p(N),h(N);
    for(int i=0;i<N;i++) cin>>p[i]>>h[i];
    
    double ans=INF;
    
    for(int i=0;i<=lim;i++){
        double d=goal/double(i+1);
        
        {
            double v=sqrt(d/2.0),t=2.0*v;
            
            bool ok=true;
            for(int j=0;j<N;j++){
                double a=amari(p[j],d);
                double tt=t*a/d;
                double y=-0.5*tt*tt+v*tt;
                
                if(y<h[j]) ok=false;
            }
            
            if(ok) chmin(ans,sqrt(2.0*v*v));
        }
        
        double left=0.0,right=INF;
        for(int q=0;q<100;q++){
            double mid=(left+right)/2.0;
            
            bool ok=true;
            
            double v=sqrt(mid*2.0),t=2.0*v;
            
            for(int j=0;j<N;j++){
                double a=amari(p[j],d);
                
                if(a<1e-8) ok=false;
                
                double hh=-0.5*(a/d*t)*(a/d*t)+v*(a/d*t);
                if(hh<h[j]) ok=false;
            }
            
            if(ok) right=mid;
            else left=mid;
        }
        
        if(right>INF-1) continue;
        double vy=sqrt(right*2.0),t=2.0*vy,vx=d/t;
        chmin(ans,sqrt(vx*vx+vy*vy));
        
        //cout<<vx<<" "<<vy<<endl;
        
    }
    
    cout<<setprecision(25)<<ans<<endl;
}




Measured memory_bytes: 3292
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int,int>;
#define enld '\n'
#define rep(i,n) for(int i=0; i<(n); i++)
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize("Ofast")
constexpr ll INF = 1e18;
constexpr int inf = 1e9;
constexpr ll mod = 1000000007;
constexpr ll mod2 = 998244353;
const double PI = 3.1415926535897932384626433832795028841971;
const int dx[6] = {1, 0, -1, 0,1,1};
const int dy[6] = {0, 1, 0, -1,1,-1};
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
// ---------------------------------------------------------------------------

int main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int sum = 0;
    for(int i=0; i<5; i++){
        int a;
        cin >> a;
        sum += max(a,40);
    }
    cout << sum/5 <<enld;
    return 0;
}


Measured memory_bytes: 3192
# Author: cr4zjh0bp
# Created: Thu Mar 26 22:17:55 UTC 2020
import sys
 
stdin = sys.stdin
inf = 1 << 60
mod = 1000000007
 
ni      = lambda: int(ns())
nin     = lambda y: [ni() for _ in range(y)]
na      = lambda: list(map(int, stdin.readline().split()))
nan     = lambda y: [na() for _ in range(y)]
nf      = lambda: float(ns())
nfn     = lambda y: [nf() for _ in range(y)]
nfa     = lambda: list(map(float, stdin.readline().split()))
nfan    = lambda y: [nfa() for _ in range(y)]
ns      = lambda: stdin.readline().rstrip()
nsn     = lambda y: [ns() for _ in range(y)]
ncl     = lambda y: [list(ns()) for _ in range(y)]
nas     = lambda: stdin.readline().split()

from math import ceil

n = ni()
p = na()

cnt = 0
ans = 0
for i in range(n):
    if p[i] == i + 1:
        cnt += 1
    else:
        ans += ceil(cnt / 2)
        cnt = 0

ans += ceil(cnt / 2)
print(ans)

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

using namespace std;

typedef long long int li;
typedef long double ld;
typedef vector<li> vi;
typedef pair<li,li> pi;
#define PB push_back
#define MP make_pair
#define F first
#define S second
#define B begin()
#define E end()
#define f(i,l,r) for(li i=l;i<=r;++i)
#define fr(i,l,r) for(li i=l;i>=r;--i)
#define u_map unordered_map
#define endl "\n"

li fastpow(li base,li exp,li M) 
{
    li res=1;
    while(exp>0) {
        if(exp&1)
            res=(res*base)%M;

        base=(base*base)%M;
        exp>>=1;
    }
    return res;
}

int main()
{    
    // #ifndef ONLINE_JUDGE
    // freopen("input.txt", "r", stdin);
    // freopen("output.txt", "w", stdout);
    // #endif

    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);

    li a,p;

    cin>>a>>p;

    cout<<(3*a+p)/2;

    return 0;
}

Measured memory_bytes: 256
from collections import Counter
N,M = map(int,input().split())
src = list(map(int,input().split()))

if M == 1:
    print(N // 2)
    exit()

hist = [0] * M
ctrs = [Counter() for i in range(M)]
for a in src:
    hist[a%M] += 1
    ctrs[a%M].update([a])

ans = 0
for i in range(1, (M+1)//2):
    j = M - i
    if hist[j] < hist[i]: i,j = j,i
    ans += hist[i]
    rem = (hist[j] - hist[i]) // 2
    n = sum([v//2 for v in ctrs[j].values()])
    ans += min(rem, n)

ans += sum(ctrs[0].values()) // 2
if M%2 == 0:
    ans += sum(ctrs[M//2].values()) // 2

print(ans)

Measured memory_bytes: 40292
//love yjl forever
#include<bits/stdc++.h>
using namespace std;
#define ll long long 
#define pii pair<int,int>
#define mp make_pair
#define pb push_back
#define fi first
#define se second
const int INF=0x3f3f3f3f,N=2e5+5;
int n;
int a[N];
int ans[N];
bool vis[N];
int b[N];
int tot=1;
vector<int> v[N],v1;
void dfs(int x)
{
	ans[x]=tot;
	vis[x]=1;
	for(int i=0;i<v[x].size();i++)
	{
		int u=v[x][i];
		if(vis[u]) continue;
		
		int pos=lower_bound(b+1,b+tot+1,a[u])-b;
		if(pos>tot)
		{
			tot++;
			b[tot]=a[u];
			dfs(u);
			b[tot]=0;
			tot--;
		}
		else 
		{
			int tmp=b[pos];
			b[pos]=a[u];
			dfs(u);
			b[pos]=tmp;
		}
	}
}
int main()
{
/*	freopen("","r",stdin);
	freopen("","w",stdout);*/
	int i;
	cin>>n;
	for(i=1;i<=n;i++)
		scanf("%d",&a[i]);
	for(i=1;i<n;i++)
	{
		int x,y;
		scanf("%d%d",&x,&y);
		v[x].pb(y);
		v[y].pb(x);
	}
	b[1]=a[1];
	dfs(1);
	
	for(i=1;i<=n;i++)
		cout<<ans[i]<<endl;
}

Measured memory_bytes: 30736
#include <stdio.h>

#define N_MAX (200000)

int p[N_MAX];

int main(void)
{
    int N;
    int i;
    int min = N_MAX;
    int cnt = 0;

    scanf("%d", &N);
    for (i = 0; i < N; i++) {
        scanf("%d", &p[i]);
    }

    for (i = 0; i < N; i++) {
        if (min >= p[i]) {
            cnt++;
            min = p[i];
        }
    }

    printf("%d",cnt);

    return 0;
}

Measured memory_bytes: 896
#include <iostream>
#include <string>

using namespace	std;

int f(int N) {
  int ret = 0;
  while(N != 0) {
    ret	+= N % 10;
    N /= 10;
  }
  return ret;
}

int main() {
  int N; cin>>N;
  cout << (N%f(N)==0 ? "Yes" : "No") << endl;
  return 0;
}


Measured memory_bytes: 256
# -*- coding: utf-8 -*-
"""
A - Biscuits
https://atcoder.jp/contests/agc017/tasks/agc017_a

"""
import sys

from math import factorial

def solve(N, P, A):
    even = len([a for a in A if a%2==0])
    odd = len([a for a in A if a%2==1])
    ans = 0
    if P == 0:
        for i in range(0, odd+1, 2):
            ans += 2 ** even * factorial(odd) // factorial(odd - i) // factorial(i)
    else:
        for i in range(1, odd+1, 2):
            ans += 2 ** even * factorial(odd) // factorial(odd - i) // factorial(i)
    return ans


def main(args):
    N, P = map(int, input().split())
    A = [int(a) for a in input().split()]
    ans = solve(N, P, A)
    print(ans)


if __name__ == '__main__':
    main(sys.argv[1:])


Measured memory_bytes: 3064
#include<stdio.h>
#define N 100

int main(){
    int i,j,n,k,u,v,M[N+1][N+1];

    scanf("%d",&n);

    for(i=0;i<n;i++){
        for(j=0;j<n;j++){
            M[i][j]=0;
        }
    }

    for(i=0;i<n;i++){
        scanf("%d%d",&u,&k);
        for(j=0;j<k;j++){
            scanf("%d",&v);
            M[u-1][v-1]=1;
        }
    }
    for(i=0;i<n;i++){
        for(j=0;j<n;j++){
            if(j!=0) printf(" ");
            printf("%d",M[i][j]);
        }
        puts("");
    }
    return 0;
}

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

using namespace std;
#define IOS ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0)
#define ll long long
#define ld long double
#define endl "\n"

int main()
{
	IOS;
	int a,b;
	cin >>a>>b;
	int x=6-(a+b);
	cout <<x<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <array>
#include <set>
#include <cmath>
#include <string>
#include <sstream>
#include <queue> 
#include <list>
#include <stack>
#include <unordered_map>
#include <algorithm> 
#include <numeric>  
#include <functional>
#include <cassert>
#include <bitset>
#include <cctype>  
#include <iomanip> 
#include <limits>  
#include <regex>
// std::numeric_limits<int>::max(), min()
// std::setprecision(X)
// std::islower(), std::isupper(), std::tolower, std::toupper
// std::accumulate(m.begin(), m.end(), 0LL);
// std::sort(begin(),end()) // 0, 1, 2, 3 ,4 (default, less);
// std::priority_queue<int, vector<int>, less<int>> que; // 4, 3, 2, 1 (defualt, less) : 
// if ( std::regex_match(S, std::regex("(dream|dreamer|erase|eraser)*")) ) std::cout << "YES" << std::endl;

#define rep(i,n)  for(int i = 0; i < (int)(n);    i++)
#define sz(x)     ((int)(x).size())
#define all(x)    (x).begin(),(x).end()

using ll = long long;

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

int main (void) {
  std::cin.tie(0);  std::ios::sync_with_stdio(false);
  int X, Y; std::cin >> X >> Y;

  bool flag = false;
  for(int x=0; x<=X; x++) {
    int legs = 2*x + (X-x)*4;
    if ( legs == Y ) flag = true;
  }

  if ( flag ) std::cout << "Yes" << std::endl;
  else std::cout << "No" << std::endl;
  return 0;
}



Measured memory_bytes: 3636
#include <cstdio>
#include <cmath>
#include <iostream>
#include <set>
#include <algorithm>
#include <vector>
#include <map>
#include <cassert>
#include <string>
#include <cstring>
#include <queue>

using namespace std;

#define rep(i,a,b) for(int i = a; i < b; i++)
#define S(x) scanf("%d",&x)
#define S2(x,y) scanf("%d%d",&x,&y)
#define P(x) printf("%d\n",x)
#define all(v) v.begin(),v.end()
#define FF first
#define SS second

typedef long long int LL;
typedef pair<int, int > pii;
typedef vector<int > vi;

const int N = 100005;

int cnt[N];
set<int > cur;

int main() {
  int n,m;
  S2(n,m);
  rep(i,1,n+1) cnt[i] = 1;
  cur.insert(1);
  while(m--) {
    int x,y;
    S2(x,y);
    cnt[y]++;
    cnt[x]--;
    if(cur.find(x) == cur.end()) {
      continue;
    }
    if(cnt[x] == 0) {
      cur.erase(x);
    }
    cur.insert(y);
  }
  P((int)cur.size());
  return 0;
}

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

// #define int long long
#define rep(i, n) for (int i = (int)(0); i < (int)(n); ++i)
#define reps(i, n) for (int i = (int)(1); i <= (int)(n); ++i)
#define rrep(i, n) for (int i = ((int)(n)-1); i >= 0; i--)
#define rreps(i, n) for (int i = ((int)(n)); i > 0; i--)
#define irep(i, m, n) for (int i = (int)(m); i < (int)(n); ++i)
#define ireps(i, m, n) for (int i = (int)(m); i <= (int)(n); ++i)
#define SORT(v, n) sort(v, v + n);
#define REVERSE(v, n) reverse(v, v+n);
#define vsort(v) sort(v.begin(), v.end());
#define all(v) v.begin(), v.end()
#define mp(n, m) make_pair(n, m);
#define cout(d) cout<<d<<endl;
#define coutd(d) cout<<std::setprecision(10)<<d<<endl;
#define cinline(n) getline(cin,n);
#define replace_all(s, b, a) replace(s.begin(),s.end(), b, a);
#define PI (acos(-1))
#define FILL(v, n, x) fill(v, v + n, x);
#define sz(x) int(x.size())

using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using vs = vector<string>;
using vpll = vector<pair<ll, ll>>;
using vtp = vector<tuple<ll,ll,ll>>;
using vb = vector<bool>;

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

const ll INF = 1e15;
const int MOD = 1e9+7;
const ll LINF = 1e18;



signed main()
{
  cin.tie( 0 ); ios::sync_with_stdio( false );
  ll k; cin>>k;
  if(k<=9){
    cout<<k<<endl;
    return 0;
  }
  queue<pll> q;
  reps(i,9) q.emplace(i,i);
  
  ll cnt=10;
  vll nxt={-1,0,1};
  while(!q.empty()){
    auto p=q.front(); q.pop();
    ll v=p.first, c=p.second;
    rep(i,3){
      ll nc=c+nxt[i];
      if(nc<0||9<nc) continue;
      ll nv=10*v+nc;
      if(cnt==k){
        cout<<nv<<endl;
        return 0;
      }
      cnt++;
      q.emplace(nv,nc);
    }
  }
}

Measured memory_bytes: 1408
void main() {
	auto N = ri;
	auto H = readAs!(int[]);
	int k = 0;
	ulong cnt;
	foreach(v; H) {
		if(v >= k) {
			k = v;
			cnt++;
		}
	}
	cnt.writeln;
}

// ===================================

import std.stdio;
import std.string;
import std.functional;
import std.algorithm;
import std.range;
import std.traits;
import std.math;
import std.container;
import std.bigint;
import std.numeric;
import std.conv;
import std.typecons;
import std.uni;
import std.ascii;
import std.bitmanip;
import core.bitop;

T readAs(T)() if (isBasicType!T) {
	return readln.chomp.to!T;
}
T readAs(T)() if (isArray!T) {
	return readln.split.to!T;
}

T[][] readMatrix(T)(uint height, uint width) if (!isSomeChar!T) {
	auto res = new T[][](height, width);
	foreach(i; 0..height) {
		res[i] = readAs!(T[]);
	}
	return res;
}

T[][] readMatrix(T)(uint height, uint width) if (isSomeChar!T) {
	auto res = new T[][](height, width);
	foreach(i; 0..height) {
		auto s = rs;
		foreach(j; 0..width) res[i][j] = s[j].to!T;
	}
	return res;
}

int ri() {
	return readAs!int;
}

double rd() {
	return readAs!double;
}

string rs() {
	return readln.chomp;
}


Measured memory_bytes: 256
/// إِنَّ مَعَ الْعُسْرِ يُسْرًا
/// لَا أَبْرَحُ حَتَّىٰ أَبْلُغَ

#include <bits/stdc++.h>
#include <ext/rope>
#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>

using namespace __gnu_cxx;
using namespace __gnu_pbds;
using namespace std;
template<class T> using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

#define LL long long
#define ll long long
#define LD double

#define HabdModeActive ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define S second
#define F first
#define PI acos(-1)
#define MAX 5000005
#define file freopen("input.txt","r",stdin); freopen("output.txt","w",stdout);
int main()
{
    HabdModeActive
    ll n,m,x;
    ll sum =0;
    cin>>n>>m;
    for(int i=0 ; i<m ; i++)
        cin>>x,sum+=x;

    cout<<max(-1ll,n-sum);
    return 0;
}


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

int n,a[100100];

int main(){
	cin>>n;
	for (int i=1;i<=n;i++) cin>>a[i];
	sort(a+1,a+n+1);
	int p,q,k;
	p=0;q=0;k=1;
	int ans=1;
	for (int i=2;i<=n;i++){
		if (a[i]==a[i-1]) k++;
		else{
			ans=max(ans,p+q+k);
			if (a[i]-a[i-1]==1){
				p=q;
				q=k;
				k=1;
			}
			else if (a[i]-a[i-1]==2){
				p=k;
				q=0;
				k=1;
			}
			else{
				p=0;
				q=0;
				k=1;
			}
		}
	}
	ans=max(ans,p+q+k);
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 640
#include <cstdio>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <map>
#include <queue>
#include <stack>
#include <vector>
#include <deque>
#include <functional>
#include <string>
#include <iostream>
#include <cctype>
#include <set>
#include <climits>
#include <iomanip>
#include <cassert>

//#include <bits/stdc++.h>

using namespace std;


#define ll long long


int main()
{
   ll n,m;

   cin >> n >> m;
   int a[m+1];

   for(int i=0;i<m;i++)
   {
       cin >> a[i] ;

   }
   sort(a,a+m);
   vector <int> v;
   for(int i=0;i<m-1;i++){
    int x = abs(a[i]-a[i+1]);
   //cout << x << endl;

    v.push_back(x);
   }

   sort(v.begin(),v.end());
 // for(int i=0; i<v.size();i++) cout << v[i] << endl;
   int ans = 0;
   int loop = v.size();
   loop = loop - (n-1);
   for(int i=0;i<loop;i++) {
    ans += v[i];
   }


 cout << ans << endl;




    return 0;
}



Measured memory_bytes: 1276