akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#define watch(x) cout << (#x) << " is " << (x) << endl
typedef long long ll;
using namespace std;
int static fast = [](){
  ios::sync_with_stdio(false);
  cin.tie(0); cout.tie(0); return 0;
}();
int find(vector<int>& grp, int x) {
    if (grp[x] == x)
        return x;
    return grp[x] = find(grp, grp[x]);
}
int main() {
    int n, m, k, val, L;
    cin >> n >> m;
    unordered_map<int, vector<int>> lang;
    vector<int> grp(n+1, 0);
    for(int i = 0; i < n; i++) {
        grp[i+1] = i+1;
        cin >> k;
        for(int j = 0; j < k; j++) {
            cin >> L;
            lang[L].push_back(i+1);
        }
    }
    for(auto p: lang) {
        auto vec = p.second;
        for(int i = 1; i < vec.size(); i++) {
            int r1 = find(grp, vec[0]);
            int r2 = find(grp, vec[i]);
            if (r1 != r2) {
                grp[r1] = grp[r2] = min(r1, r2);
            }
        }
    }
    unordered_set<int> ans;
    for(int i =1; i <= n; i++) {
        ans.insert(find(grp, i));
    }
    if (ans.size() == 1)
        cout << "YES" << endl;
    else
        cout << "NO" << endl;
    return 0;
}




Measured memory_bytes: 6668
import sys
from io import StringIO
import unittest
import math

def resolve():
    n = int(input())
    a = [int(input()) for _ in range(5)]

    min_a = min(a)

    # print(n // min_a + 5)
    print(math.ceil(n / min_a) + 4)

class TestClass(unittest.TestCase):
    def assertIO(self, input, output):
        stdout, stdin = sys.stdout, sys.stdin
        sys.stdout, sys.stdin = StringIO(), StringIO(input)
        resolve()
        sys.stdout.seek(0)
        out = sys.stdout.read()[:-1]
        sys.stdout, sys.stdin = stdout, stdin
        self.assertEqual(out, output)
    def test_入力例_1(self):
        input = """5
3
2
4
3
5"""
        output = """7"""
        self.assertIO(input, output)
    def test_入力例_2(self):
        input = """10
123
123
123
123
123"""
        output = """5"""
        self.assertIO(input, output)
    def test_入力例_3(self):
        input = """10000000007
2
3
5
7
11"""
        output = """5000000008"""
        self.assertIO(input, output)

if __name__ == "__main__":
    # unittest.main()
    resolve()

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


int main(){
  int l, r, d;
  cin >> l >> r >> d;
  int ans=0;
  for (int i = l; i <= r; ++i){
    if (i % d == 0) ans += 1;
  }
  cout << ans << endl;
}


Measured memory_bytes: 3596
#include<bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define fi first
#define sec second
#define opr iterator
typedef long long ll;
using namespace std;
string s,t; 
int main()
{
	cin>>s>>t;
	string res;
	bool fd=false;
	if(s.size()<t.size())
	{
		cout<<"UNRESTORABLE"<<endl;
		exit(0);
	}
	for(int i=0;i<s.size();i++)
	{
		res+="z";
	}
	for(int beg=0;beg<=s.size()-t.size();beg++)
	{
		string tmp;
		bool ok=1;
		for(int i=0;i<t.size();i++)
		{
			if(t[i]!=s[i+beg]&&s[i+beg]!='?'){
				ok=0;
				break;
			}
		}
		if(ok){
			tmp=s;
			for(int i=0;i<t.size();i++)
			{
				if(t[i]!=tmp[i+beg]){
					tmp[i+beg]=t[i];
				}
			}
			for(int i=0;i<tmp.size();i++)
			{
				if(tmp[i]=='?')
				{
					tmp[i]='a';
				}
			}
			res=min(res,tmp);
			fd=true;
		}
	}
	if(fd)
	{
		cout<<res<<endl;
	}
	else
	{
		cout<<"UNRESTORABLE"<<endl;
	}
	return 0;
}

Measured memory_bytes: 256
s = input()

if 0 < (int(s[0] + s[1])) < 13:
    if 0 < (int(s[2] + s[3])) < 13:
        print("AMBIGUOUS")
    else:
        print("MMYY")

else:
    if 0 < (int(s[2] + s[3])) < 13:
        print("YYMM")
    else:
        print("NA")





Measured memory_bytes: 2940
while True:
    num = int(raw_input())
    if num == 0: break

    dic = {}
    odr = []
    for i in range(num):
        uid, p, q = map(int, raw_input().split())
        if dic.has_key(uid): dic[uid] += p * q
        else:
            dic[uid] = p * q
            odr.append(uid)

    if max(dic.values()) < 1000000: print "NA"
    else:
        for i in odr:
            if dic[i] >= 1000000: print i

Measured memory_bytes: 4336
def calc_bin(bin_data):
    sum_bin = ''
    for i in range(len(bin_data)):
        now_data = bin_data[i]
        if now_data == '0':
            if i == len(bin_data) - 1:
                if len(bin_data) == 1:
                    add_data = '0'
                else:
                    if bin_data[-2] == '0':
                        add_data = '0'
                    else:
                        add_data = '1'
            else:
                add_data = '0'
        else:
            if i == len(bin_data) - 1:
                if len(bin_data) == 1:
                    add_data = '1'
                else:
                    if bin_data[-2] == '0':
                        add_data = '1'
                    else:
                        add_data = '0'
            elif bin_data[-1] == '0':
                add_data = '1'
            else:
                add_data = '0'
        sum_bin += add_data
    return sum_bin

def calc_ans(a_sun_bin, b_sum_bin):
    a_sun_bin_rev = a_sun_bin[::-1]
    b_sun_bin_rev = b_sum_bin[::-1]
    ans = ''
    for i in range(len(b_sun_bin_rev)):
        if i >= len(a_sun_bin_rev):
            a_data = '0'
        else:
            a_data = a_sun_bin_rev[i]
        b_data = b_sun_bin_rev[i]
        if a_data == b_data:
            add_ans = '0'
        else:
            add_ans = '1'
        ans += add_ans
    ans = ans[::-1]
    return ans


def main():
    a, b = map(int, input().split())
    a_bin = bin(a - 1)[2:]
    b_bin = bin(b)[2:]
    # print(a_bin)
    # print(b_bin)
    # ketasuu = mlen(b_bin))

    a_sun_bin = calc_bin(a_bin)
    b_sun_bin = calc_bin(b_bin)
    # print(a_sun_bin, 'a_bin_sum')
    # print(b_sun_bin)
    ans_bin = calc_ans(a_sun_bin, b_sun_bin)
    # print(ans_bin)
    print(int(ans_bin, 2))



if __name__ == '__main__':
    main()


Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MOD=1e9+7;
const int INF=1e9;
const ll LINF=1e18;

int main(){
    int n;
    cin>>n;
    vector<pair<int,int>> v(n);
    for(int i=0;i<n;i++){
        int a;
        cin>>a;
        v[i]={a,-i};
    }
    sort(v.begin(),v.end());
    ll ans[n]={};
    int mx=v[n-1].first;
    int mxi=v[n-1].second;
    ll sum=mx;
    for(int i=n-2;i>=0;i--){
        if(v[i].second>mxi){
            ans[-mxi]=sum-(ll)v[i].first*(n-1-i);
            sum=(ll)v[i].first*(n-1-i);
            mx=v[i].first;
            mxi=v[i].second;
        }
        sum+=v[i].first;
    }
    ans[-mxi]=sum;
    for(int i=0;i<n;i++){
        cout<<ans[i]<<endl;
    }
}


Measured memory_bytes: 2688
#include<cstdio>
#include<algorithm>
#include<cstring>
using namespace std;
int main(void)
{
	int n,r,t,i,j,x,y,xf,yf;
	scanf("%d",&n);
	for(i=0;i<n;i++)	{
		scanf("%d %d",&r,&t);
		x=r/100;
		if(r%100==0)	xf=1;
		else xf=0;
		y=t/30;
		if(t%30==0)	yf=1;
		else yf=0;
//		printf("x=%d y=%d\n",x,y);
		if(xf==0 && yf==0)	printf("%d %d %d %d\n",5*y+x,5*y+x+1,5*(y+1)+x,5*(y+1)+x+1);
		else if(xf==0 && yf==1)	printf("%d %d\n",5*y+x,5*y+x+1);
		else if(yf==0 && xf==1)	printf("%d %d\n",5*y+x,5*(y+1)+x);
		else printf("%d\n",5*y+x);
	}
	return 0;
}


Measured memory_bytes: 1028
#![allow(unused_imports)]

use proconio::input;

fn main() {
    input! {
        n: u64,
    }

    let w = 10u64.pow(9) + 7;
    let mut x = 1;
    let mut y = 1;
    let mut z = 1;
    for _ in 0..n {
        y = y * 9 % w;
        x = x * 10 % w;
        z = z * 8 % w;
    }
    y = 2 * y % w;
    println!("{}", (w + x + z - y) % w);
}


Measured memory_bytes: 2156
n=int(input())
a=[]
l=[0]*n
ans=0
for i in range(n):
	a.append(int(input()))
	l[i]=[list(map(int,input().split())) for i in range(a[-1])]
for i in range(2**n):
	i=format(i,'b').zfill(n)
	c=[]
	for j in range(n):
		if i[j]=='1':
			c.append(j)
	for j in c:
		for k in l[j]:
			if k[1]==1 and (k[0]-1 not in c):
				break
			elif k[1]==0 and (k[0]-1 in c):
				break
		else:
			continue
		break
	else:
		ans=max(ans,len(c))
print(ans)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
 
int main() {
    char I[3];
    int nedan = 700;
    cin >> I;
    for(int i = 0;i<3;i++){
        if (I[i]=='o') {
            nedan += 100;
        }
    }
    cout << nedan << endl;
}

Measured memory_bytes: 384
package main

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

const MaxBuf = 200100
var buf []byte
var sc = bufio.NewScanner(os.Stdin)

func init() {
   sc.Split(bufio.ScanWords)
   sc.Buffer(buf,MaxBuf)
}

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

func readInt64() int64 {
   sc.Scan()
   r,_ := strconv.ParseInt(sc.Text(),10,64)
   return r
}

func readInt() int {
   sc.Scan()
   r,_ := strconv.Atoi(sc.Text())
   return r
}

func main() {
	n := readInt()
	k := readInt()
	q := readInt()
	l := make([]int,n)
	for i := 0; i < q ; i++ {
		l[readInt()-1]++
	}

	ans := make([]byte,0,4*n)
	yes := "Yes\n"
	no := "No\n"
	for _,v := range l {
		if k - q + v > 0 {
			ans = append(ans,yes...)
		} else {
			ans = append(ans,no...)
		}
	}
	fmt.Print(string(ans))
}

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

def main():
    a, b, m = map(int, input().split())
    t_a = tuple(map(int, input().split()))
    t_b = tuple(map(int, input().split()))
    t_ken = [tuple(map(int, input().split())) for _ in range(m)]

    r = min(t_a) + min(t_b)
    for x, y, c in t_ken:
        r = min(r, t_a[x-1] + t_b[y-1] - c)
    print(r)

if __name__ == '__main__':
    main()


Measured memory_bytes: 29640
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)
from collections import Counter, deque
from collections import defaultdict
from itertools import combinations, permutations, accumulate, groupby, product
from bisect import bisect_left,bisect_right
from heapq import heapify, heappop, heappush
from math import floor, ceil,pi,factorial
from operator import itemgetter
def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))
def LI2(): return [int(input()) for i in range(n)]
def MXI(): return [[LI()]for i in range(n)]
def SI(): return input().rstrip()
def printns(x): print('\n'.join(x))
def printni(x): print('\n'.join(list(map(str,x))))
inf = 10**17
mod = 10**9 + 7

def main():
    r,c,k=MI()
    #dp=[[[-inf]*4 for j in range(c)]  for i in range(r)]
    dp0=[[-inf]*c for i in range(r)]
    dp1=[[-inf]*c for i in range(r)]
    dp2=[[-inf]*c for i in range(r)]
    dp3=[[-inf]*c for i in range(r)]
    val=[[0]*c for i in range(r)]
    for i in range(k):
        x,y,v=MI()
        val[x-1][y-1]=v
    if val[0][0]>0:
        dp1[0][0]=val[0][0]
        dp0[0][0]=0
    else:
        dp0[0][0]=0
    #print(dp)
    for i in range(r):
        for j in range(c):
            if i<r-1:
                if val[i+1][j]>0:
                        dp1[i+1][j]=max(dp1[i+1][j],dp0[i][j]+val[i+1][j],dp1[i][j]+val[i+1][j],dp2[i][j]+val[i+1][j],dp3[i][j]+val[i+1][j])
                dp0[i+1][j]=max(dp0[i+1][j],dp0[i][j],dp1[i][j],dp2[i][j],dp3[i][j])                 
            if j<c-1:
                if val[i][j+1]>0:
                    dp1[i][j+1]=max(dp1[i][j+1],dp0[i][j]+val[i][j+1])
                    dp2[i][j+1]=max(dp2[i][j+1],dp1[i][j]+val[i][j+1])
                    dp3[i][j+1]=max(dp3[i][j+1],dp2[i][j]+val[i][j+1])
                    #for k in range(1,4):
                        #dp[i][j+1][k]=max(dp[i][j+1][k],dp[i][j][k-1]+val[i][j+1])
                dp0[i][j+1]=max(dp0[i][j+1],dp0[i][j])
                dp1[i][j+1]=max(dp1[i][j+1],dp1[i][j])
                dp2[i][j+1]=max(dp2[i][j+1],dp2[i][j])
                dp3[i][j+1]=max(dp3[i][j+1],dp3[i][j])
                #for k in range(4):
                    #dp[i][j+1][k]=max(dp[i][j+1][k],dp[i][j][k])
    #print(dp0)
    #print(dp1)
    #print(dp2)
    #print(dp3)
    print(max(dp0[-1][-1],dp1[-1][-1],dp2[-1][-1],dp3[-1][-1]))
if __name__=="__main__":
    main()
    
            



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

int main() {
  int N;
  cin >> N;
  vector<int> T(N);
  for(int i=0;i<N;i++){
    cin >> T.at(i);
  }
  int M;
  cin >> M;
  vector<int> P(M),X(M);
  for(int i=0;i<M;i++){
    cin >> P.at(i)>> X.at(i);
  }
  long long sum;
  for(int i=0;i<M;i++){
    sum=0;
    for(int j=0;j<N;j++){
      if(j!=P.at(i)-1){
        sum+=T.at(j);
      }
      else{
        sum+=X.at(i);
      }
    }
    cout << sum << endl;
  }
}

Measured memory_bytes: 3568
import java.util.*

/**
 * リストをスタックに変換する
 * @param list リスト
 * @return スタック
 */
fun listToStack(list: List<Int>): Stack<Int> {
    // スタック
    val stack = Stack<Int>()

    for (e in list) {
        stack.push(e)
    }

    return stack
}

/**
 * ユークリッドの互除法を用いて、最大公約数を導出する
 * @param list 最大公約数を求める対象となる数が格納されたリスト
 * @return 最大公約数
 */
fun gcd(list: List<Int>): Int {
    // 最大公約数を求める対象となる数が格納されたスタック
    val stack = listToStack(list)

    // ユークリッドの互除法を用いて、最大公約数を導出する
    // (最終的にスタック内に1つだけ数が残り、それが最大公約数となる)
    while (1 < stack.size) {
        // スタックから2つの数をpop
        val pops = (0 until 2).map {
            stack.pop()
        }

        // スタックからpopした2つの数のうち、小さい方の数のインデックス
        val minIndex = if (pops[1] < pops[0]) {
            1
        } else {
            0
        }

        // スタックからpopした2つの数のうち、小さい方の数をpush
        stack.push(pops[minIndex])

        // スタックからpopした2つの数の剰余
        val r = pops[(minIndex + 1) % 2] % pops[minIndex]

        // スタックからpopした2つの数に剰余があるならば、それをpush
        if (0 < r) {
            stack.push(r)
        }
    }

    // 最大公約数を返す
    return stack.pop()
}

fun main(args: Array<String>) {
    // 座標Xと座標x_iの距離が格納されるリスト
    val xx = mutableListOf<Int>()

    // 入力
    Scanner(System.`in`).use {
        val n = it.nextInt()
        val x = it.nextInt()
        for (i in 0 until n) {
            val xxI = it.nextInt()
            if (xxI < x) {
                xx.add(x - xxI)
            } else {
                xx.add(xxI - x)
            }
        }
    }

    // 正整数Dの最大値を出力
    println(gcd(xx))
}


Measured memory_bytes: 55716
#include<bits/stdc++.h>
using namespace std;
typedef long long int ULL;
int main(){
	ULL n;cin>>n;
	string s;cin>>s;
	int ans = 1;
	for(int i = 0 ; i < n-1 ; i++){
		if(s[i] != s[i+1]) ans++;
	}
	cout<<ans;
	
}

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

using namespace std;

int main () {
	int n, x;
	cin >> n >> x;
	if (n == 1) {
		cout << "Yes\n";
		cout << 1;
		return 0;
	}      
	int mid = n;
	n = n * 2 - 1;
	if (x == 1 || x == n) {
		cout << "No";
		return 0;
	}
	cout << "Yes\n";
	if (x <= mid) {
		for (int i = 1;i <= n;i ++) {
			if (i == mid + 1) {
				cout << x - 1 << endl << x << endl;		
			}
			if (i != x && i != x - 1) 
				cout << i << endl;
		} 
	}
	if (x > mid) {
		for (int i = 1;i <= n;i ++) {
			if (i == mid) {
				cout << x << endl << x + 1 << endl;		
			}
			if (i != x && i != x + 1) 
				cout << i << endl;
		} 
	}
	return 0;
}

Measured memory_bytes: 1536
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<int, ll> pil;
typedef pair<int, ll> pli;
typedef pair<double,double> pdd;
#define SQ(i) ((i)*(i))
#define MEM(a, b) memset(a, (b), sizeof(a))
#define SZ(i) int(i.size())
#define FOR(i, j, k, in) for (int i=j ; i<k ; i+=in)
#define RFOR(i, j, k, in) for (int i=j ; i>=k ; i-=in)
#define REP(i, j) FOR(i, 0, j, 1)
#define REP1(i,j) FOR(i, 1, j+1, 1)
#define RREP(i, j) RFOR(i, j, 0, 1)
#define ALL(_a) _a.begin(),_a.end()
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define X first
#define Y second
#ifdef tmd
#define TIME(i) Timer i(#i)
#define debug(...) do{\
    fprintf(stderr,"%s - %d (%s) = ",__PRETTY_FUNCTION__,__LINE__,#__VA_ARGS__);\
    _do(__VA_ARGS__);\
}while(0)
template<typename T>void _do(T &&_x){cerr<<_x<<endl;}
template<typename T,typename ...S> void _do(T &&_x,S &&..._t){cerr<<_x<<" ,";_do(_t...);}
template<typename _a,typename _b> ostream& operator << (ostream &_s,const pair<_a,_b> &_p){return _s<<"("<<_p.X<<","<<_p.Y<<")";}
template<typename It> ostream& _OUTC(ostream &_s,It _ita,It _itb)
{
    _s<<"{";
    for(It _it=_ita;_it!=_itb;_it++)
    {
        _s<<(_it==_ita?"":",")<<*_it;
    }
    _s<<"}";
    return _s;
}
template<typename _a> ostream &operator << (ostream &_s,vector<_a> &_c){return _OUTC(_s,ALL(_c));}
template<typename _a> ostream &operator << (ostream &_s,set<_a> &_c){return _OUTC(_s,ALL(_c));}
template<typename _a> ostream &operator << (ostream &_s,deque<_a> &_c){return _OUTC(_s,ALL(_c));}
template<typename _a,typename _b> ostream &operator << (ostream &_s,map<_a,_b> &_c){return _OUTC(_s,ALL(_c));}
template<typename _t> void pary(_t _a,_t _b){_OUTC(cerr,_a,_b);cerr<<endl;}
#define IOS()
class Timer {
private:
    string scope_name;
    chrono::high_resolution_clock::time_point start_time;
public:
    Timer (string name) : scope_name(name) {
        start_time = chrono::high_resolution_clock::now();
    }
    ~Timer () {
        auto stop_time = chrono::high_resolution_clock::now();
        auto length = chrono::duration_cast<chrono::microseconds>(stop_time - start_time).count();
        double mlength = double(length) * 0.001;
        debug(scope_name, mlength);
    }
};
#else
#define TIME(i)
#define debug(...)
#define pary(...)
#define endl '\n'
#define IOS() ios_base::sync_with_stdio(0);cin.tie(0)
#endif

const ll MOD = 1000000007;
const ll INF = 0x3f3f3f3f3f3f3f3f;
const int iNF = 0x3f3f3f3f;
// const ll MAXN = 

int n;
double sum;
/********** Good Luck :) **********/
int main () {
    TIME(main);
    IOS();
    cin >> n;
    REP (i, n) {
        double a;
        cin >> a;
        sum += 1.0 / a;
    }

    cout << fixed << setprecision(10) << 1/sum << endl;
    return 0;
}


Measured memory_bytes: 256
#include "iostream"
#include "climits"
#include "list"
#include "queue"
#include "stack"
#include "set"
#include "functional"
#include "algorithm"
#include "math.h"
#include "utility"
#include "string"
#include "map"
#include "unordered_map"
#include "iomanip"
#include "random"

using namespace std;
const long long int MOD = 1000000007;
list<long long int> Prime(int M) {
	list<long long int>P;
	P.push_back(2);
	P.push_back(3);
	for (int i = 5; i <= M; i += 6) {
		bool flag = true;
		for (auto j : P) {
			if (i%j == 0) {
				flag = false;
				break;
			}
		}
		if (flag)P.push_back(i);
		flag = true;
		for (auto j : P) {
			if ((i + 2) % j == 0) {
				flag = false;
				break;
			}
		}
		if (flag)P.push_back(i + 2);
	}
	return P;
}
long long int power(long long int x, long long int n, long long int M) {
	long long int tmp = 1;

	if (n > 0) {
		tmp = power(x, n / 2, M);
		if (n % 2 == 0) tmp = (tmp*tmp) % M;
		else tmp = (((tmp*tmp) % M)*x) % M;
	}
	return tmp;
}

long long int N, M, K, Q, W, H;
long long int ans;

int main() {
	ios::sync_with_stdio(false);
	cin >> N;
	int num[100000] = {};
	int ma = 0;
	int mi = 100000;
	for (int i = 0; i < N; i++) {
		cin >> num[i];
		ma = max(ma, num[i]);
		mi = min(mi, num[i]);
	}
	if (ma - mi > 1) {
		cout << "No\n";
		return 0;
	}
	if (ma == mi) {
		if (ma <= N / 2 || ma == N - 1) {
			cout << "Yes\n";
			return 0;
		}
		cout << "No\n";
		return 0;
	}
	int box = 0;
	int bag = 0;
	for (int i = 0; i < N; i++) {
		if (num[i] == ma)box++;
		else bag++;
	}
	if (bag <= mi&&bag >= mi - min(mi - 1, (int)N - 2 - mi)) {
		cout << "Yes\n";
		return 0;
	}
	cout << "No\n";
	return 0;
}

Measured memory_bytes: 768
#include <bits/stdc++.h>
#define all(x) (x).begin(), (x).end()
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
const string ln = "\n";
constexpr int INF = 1001001001;
constexpr int MOD = 1000000007;

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

  ll x;
  cin >> x;

  ll ans = (x / 500) * 1000;
  ll nokori = x % 500;
  ans += (nokori / 5) * 5;

  cout << ans << ln;

  return 0;
}

Measured memory_bytes: 256
#include<iostream>

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

	std::cin >> N;
	for (int i = 0; i < N; ++i)
	{
		std::cin >> a >> b >> c;
		a *= a;
		b *= b;
		c *= c;
		if (a == b + c || b == c + a || c == a + b)
			std::cout << "YES" << std::endl;
		else
			std::cout << "NO" << std::endl;
	}

	return 0;
}


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

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

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

  double x_a, x_b, y_a, y_b;
  x_a = A*100/8.0;
  x_b = B*100/10.0;
  y_a = (A+1)*100/8.0;
  y_b = (B+1)*100/10.0;

  if(y_a<=x_b||y_b<=x_a) cout<<-1;
  else cout<<max(ceil(x_a), ceil(x_b));
}

Measured memory_bytes: 256
'''
import math
from functools import reduce

N = int(input())
s = 0

def gcd(*numbers):
    return reduce(math.gcd, numbers)

def gcd_list(numbers):
    return reduce(math.gcd, numbers)

for i in range(1, N+1):
    for j in range(1, N+1):
        for k in range(1, N+1):
            s += gcd(i, j, k)


print(s)
'''

import math
from functools import reduce
import itertools


N = int(input())
s = 0

def gcd(*numbers):
    return reduce(math.gcd, numbers)

def gcd_list(numbers):
    return reduce(math.gcd, numbers)

seq = list(range(1, N+1))
comb = list(itertools.combinations_with_replacement(seq,3))

#print(seq)
#print(comb)

i = 1
for c in comb:
    if i == 1 or (c[0] == c[1] and c[1] == c[2]):
        s += gcd(c[0], c[1], c[2])
    elif c[0] != c[1] and c[1] != c[2] and c[0] != c[2]:
        s = s + gcd(c[0], c[1], c[2]) * 6
    else:
        s = s + gcd(c[0], c[1], c[2]) * 3
    i += 1

print(s)

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

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

	string s, front, back;
	cin >> s;
	int rev = 0;
	int q;
	cin >> q;
	while(q--) {
		int type;
		cin >> type;
		if(type == 1) {
			rev ^= 1;
		} else {
			int f;
			char c;
			cin >> f >> c;
			if((f + rev) % 2 == 1) {
				front.push_back(c);
			} else {
				back.push_back(c);
			}
		}
	}

	if(rev) {
		reverse(s.begin(), s.end());
		reverse(back.begin(), back.end());
		swap(front, back);
	} else {
		reverse(front.begin(), front.end());
	}

	cout << front+s+back << endl;
}

Measured memory_bytes: 1300
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Scanner;
import java.util.stream.Collectors;
import java.util.stream.IntStream;

public class Main {

	public static void main(String[] args) {
		try (Scanner scanner = new Scanner(System.in)) {
			int n = scanner.nextInt();
			// それぞれの数字の数のマップ
			Map<Integer, Integer> map = new HashMap<>();
			IntStream.range(0, n).forEach(i -> {
				int ai = scanner.nextInt();
				map.put(ai, map.getOrDefault(ai, 0) + 1);
			});
			List<Entry<Integer, Integer>> resultList = map.entrySet().stream().filter(entry -> entry.getValue() > 1)
					.sorted((x, y) -> y.getKey().compareTo(x.getKey())).collect(Collectors.toList());
			long result = 0L;
			if (resultList.size() > 0) {
				Entry<Integer, Integer> firstEntry = resultList.get(0);
				if (firstEntry.getValue() >= 4) {
					result = ((long) firstEntry.getKey()) * firstEntry.getKey();
				} else {
					if (resultList.size() > 1) {
						Entry<Integer, Integer> secondEntry = resultList.get(1);
						result = ((long) firstEntry.getKey()) * secondEntry.getKey();
					}
				}
			}
			System.out.println(result);
		}
	}
}


Measured memory_bytes: 64620
#include <cstdio>
#include <cstring>
#include <string>
#include <set>

using namespace std;

int k;
char s[5001];

int main() {
    int n, k, i, j;
    string st;
    set <string> se;
    set <string>::iterator it;
    
    scanf("%s", s);
    scanf("%d", &k);
    
    n = strlen(s);
    
    st = s;
    
    for (i = 0; i < n; i++) {
        for (j = 1; j <= 5; j++) {
            string t = st.substr(i, j);
            se.insert(t);
        }
    }
    
    for (it = se.begin(); it != se.end(); it++) {
        k--;
        if (k == 0) {
            printf("%s\n", it->c_str());
            break;
        }
    }
    
    return 0;
}


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

int main(void)
{
	int N;
	cin >> N;

	int a = N / 100;
	int b = (N - (a * 100)) / 10;
	int c = (N - (a * 100) - (b * 10));

	if (a == 7 || b == 7 || c == 7) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}
	return 0;
}


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

using namespace std;
using ll = long long;
using vec = vector<ll>;
using mat = vector<vec>;

#define INF (1LL << 60)
#define MOD 1000000007
#define PI 3.14159265358979323846

#define REP(i,m,n) for(ll (i)=(m),(i_len)=(n);(i)<(i_len);++(i))
#define FORR(i,v) for(auto (i):v)
#define ALL(x) (x).begin(), (x).end()
#define PR(x) cout << (x) << endl
#define PS(x) cout << (x) << " "
#define SZ(x) ((ll)(x).size())
#define MAX(a,b) (((a)>(b))?(a):(b))
#define MIN(a,b) (((a)<(b))?(a):(b))
#define ASC(x) sort(ALL((x)))
#define DESC(x) sort(ALL((x)),greater<ll>())
#define pb push_back

int main()
{
    ll A, B, N;
    cin >> A >> B >> N;

    PR(A*MIN(B-1,N)/B);

    return 0;
}

/*



*/

Measured memory_bytes: 3604
#include <cstdio>

int N,count=0;

void dfs(long long,unsigned char);

int main(void)
{
    scanf("%d",&N);
    dfs(0,0);
    printf("%d\n",count);
    return 0;
}

void dfs(long long nextNum,unsigned char flag357)
{
    if(nextNum<=N)
    {
        if(flag357==07)    // 07 is BIN 111
            count++;
        dfs(nextNum*10+3,flag357|01); // BIN 001
        dfs(nextNum*10+5,flag357|02); // BIN 010
        dfs(nextNum*10+7,flag357|04); // BIN 100
    }
}


Measured memory_bytes: 128
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <queue>
#include <map>

using namespace std;

typedef long long ll;

int main(){
    int N;
    cin >> N;
    vector<int> p(N);
    for(int i = 0; i < N; ++i){
        cin >> p[i];
    }
    
    int cnt = 0; 
    
    for(int i = 0; i < N; ++i){
        if(p[i] != i + 1)       continue;
        
        if(i < N - 1){
            swap(p[i], p[i + 1]);
            cnt++;
        }
        if(i == N - 1){
            swap(p[i - 1], p[i]);
            cnt++;
        }
    }
    
    cout << cnt << endl;
}

Measured memory_bytes: 640
import java.io.IOException;
import java.io.InputStream;
import java.util.*;
public class Main{
	public static void main(String args[]) throws Exception {
		FastScanner sc=new FastScanner();
		int A=sc.nextInt(),B=sc.nextInt(),C=sc.nextInt();
		String str="No";
		if(C>=A&&C<=B)
			str="Yes";
		System.out.println(str);
	}
}
class FastScanner {
	public static String debug = null;
 
	private final InputStream in = System.in;
	private int ptr = 0;
	private int buflen = 0;
	private byte[] buffer = new byte[1024];
	private boolean eos = false;
 
	private boolean hasNextByte() {
		if (ptr < buflen) {
			return true;
		} else {
			ptr = 0;
			try {
				if (debug != null) {
					buflen = debug.length();
					buffer = debug.getBytes();
					debug = "";
					eos = true;
				} else {
					buflen = in.read(buffer);
				}
			} catch (IOException e) {
				e.printStackTrace();
			}
			if (buflen < 0) {
				eos = true;
				return false;
			} else if (buflen == 0) {
				return false;
			}
		}
		return true;
	}
 
	private int readByte() {
		if (hasNextByte())
			return buffer[ptr++];
		else
			return -1;
	}
 
	private static boolean isPrintableChar(int c) {
		return 33 <= c && c <= 126;
	}
 
	private void skipUnprintable() {
		while (hasNextByte() && !isPrintableChar(buffer[ptr]))
			ptr++;
	}
 
	public boolean isEOS() {
		return this.eos;
	}
 
	public boolean hasNext() {
		skipUnprintable();
		return hasNextByte();
	}
 
	public String next() {
		if (!hasNext())
			throw new NoSuchElementException();
		StringBuilder sb = new StringBuilder();
		int b = readByte();
		while (isPrintableChar(b)) {
			sb.appendCodePoint(b);
			b = readByte();
		}
		return sb.toString();
	}
 
	public long nextLong() {
		if (!hasNext())
			throw new NoSuchElementException();
		long n = 0;
		boolean minus = false;
		int b = readByte();
		if (b == '-') {
			minus = true;
			b = readByte();
		}
		if (b < '0' || '9' < b) {
			throw new NumberFormatException();
		}
		while (true) {
			if ('0' <= b && b <= '9') {
				n *= 10;
				n += b - '0';
			} else if (b == -1 || !isPrintableChar(b)) {
				return minus ? -n : n;
			} else {
				throw new NumberFormatException();
			}
			b = readByte();
		}
	}
 
	public int nextInt() {
		return (int) nextLong();
	}
 
	public long[] nextLongList(int n) {
		return nextLongTable(1, n)[0];
	}
 
	public int[] nextIntList(int n) {
		return nextIntTable(1, n)[0];
	}
 
	public long[][] nextLongTable(int n, int m) {
		long[][] ret = new long[n][m];
		for (int i = 0; i < n; i ++) {
			for (int j = 0; j < m; j ++) {
				ret[i][j] = nextLong();
			}
		}
		return ret;
	}
 
	public int[][] nextIntTable(int n, int m) {
		int[][] ret = new int[n][m];
		for (int i = 0; i < n; i ++) {
			for (int j = 0; j < m; j ++) {
				ret[i][j] = nextInt();
			}
		}
		return ret;
	}
}

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

struct Fast {Fast(){std::cin.tie(0);ios::sync_with_stdio(false);}} fast;

/* cpp template {{{ */

/* short */
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define Fi first
#define Se second
#define ALL(v) begin(v), end(v)
#define X real()
#define Y imag()

/* REPmacro */
#define REPS(i, a, n) for (ll i = (a); i < (ll)(n); ++i)
#define rep(i, n) REPS(i, 0, n)
#define REP1(i,n) for (ll i = 1; i <= (ll)(n); ++i)
#define RREP(i, n) REPS(i, 1, n + 1)
#define DEPS(i, a, n) for (ll i = (a); i >= (ll)(n); --i)
#define dep(i, n) DEPS(i, n, 0)
#define EACH(i, n) for (auto&& i : n)

/* debug */
#define debug(x) cerr << x << " " << "(L:" << __LINE__ << ")" << '\n';

/* alias */
using ll = long long;
using ull = unsigned long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vvvi = vector<vvi>;
using pii = pair<int, int>;
using D = double;
using P = complex<D>;
using vs = vector<string>;
template <typename T> using PQ = priority_queue<T>;
template <typename T> using minPQ = priority_queue<T, vector<T>, greater<T>>;

/* const */
const int INF = 1001001001;
const ll LINF = 1001001001001001001ll;
const int MOD = 1e9 + 7;
const D EPS = 1e-9;
const int dx[] = {0, 1, 0, -1, 1, -1, 1, -1}, dy[] = {1, 0, -1, 0, 1, -1, -1, 1};

/* func */
inline bool inside(int y, int x, int H, int W) {return y >= 0 && x >= 0 && y < H && x < W;}
inline int in() {int x; cin >> x; return x;}
inline ll IN() {ll x; cin >> x; return x;}
inline vs split(const string& t, char c) {vs v; stringstream s(t); string b; while(getline(s, b, c)) v.eb(b); return v;}
template <typename T> inline bool chmax(T& a, const T& b) {if (a > b) a = b; return a > b;}
template <typename T> inline bool chmin(T& a, const T& b) {if (a < b) a = b; return a < b;}
template <typename T, typename S> inline void print(const pair<T, S>& p) {cout << p.first << " " << p.second << endl;}
template <typename T> inline void print(const T& x) {cout << x << '\n';}
template <typename T, typename S> inline void print(const vector<pair<T, S>>& v) {for (auto&& p : v) print(p);}
template <typename T> inline void print(const vector<T>& v, string s = " ") {rep(i, v.size()) cout << v[i] << (i != (ll)v.size() - 1 ? s : "\n");}

signed main() 
{
  int n,x; cin>>n>>x;
  vi m(n);
  rep(i,n) cin>>m[i];
  sort(ALL(m));
  int cnt=0;
  rep(i,n)
  {
    x-=m[i];
    if(x>=0)
    {
      cnt++;
    }
  }
  cnt+=x/m[0];
  print(cnt);

  return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <vector>
#include <algorithm>

using namespace std;

struct node{
    int parent, left, right;
    node(){ parent=-1; }
};

vector<node> tree;

void print_pre(int id)
{
    printf(" %d", id);
    if(tree[id].left!=-1){
        print_pre(tree[id].left);
    }
    if(tree[id].right!=-1){
        print_pre(tree[id].right);
    }
}

void print_in(int id)
{
    if(tree[id].left!=-1){
        print_in(tree[id].left);
    }
    printf(" %d", id);
    if(tree[id].right!=-1){
        print_in(tree[id].right);
    }
}

void print_post(int id)
{
    if(tree[id].left!=-1){
        print_post(tree[id].left);
    }
    if(tree[id].right!=-1){
        print_post(tree[id].right);
    }
    printf(" %d", id);
}

int main()
{
    int n;
    scanf("%d", &n);
    tree=vector<node>(n);
    for(int i=0; i<n; i++){
        int id; scanf("%d", &id);
        auto it=&tree[id];
        scanf("%d %d", &it->left, &it->right);
        if(it->left!=-1){
            tree[it->left].parent=id;
        }
        if(it->right!=-1){
            tree[it->right].parent=id;
        }
    }

    int root_id;
    for(auto it=tree.begin(); it!=tree.end(); it++){
        if(it->parent==-1){
            root_id=distance(tree.begin(), it);
            break;
        }
    }

    printf("Preorder\n");
    print_pre(root_id);
    printf("\n");
    printf("Inorder\n");
    print_in(root_id);
    printf("\n");
    printf("Postorder\n");
    print_post(root_id);
    printf("\n");

    return 0;
}

Measured memory_bytes: 2660
#include<iostream>
#include<string>
#include<vector>
#include<stdio.h>
#include<algorithm>
#include<stdlib.h>
#define _USE_MATH_DEFINES
#include<math.h>
#include<numeric>
#include<iomanip>
#include<deque>
using namespace std;

typedef pair<int, int> P;

bool pc1(const P& firstElof, const P& secondElof)
{//first降順
	return firstElof.first > secondElof.first;
}
bool pc2(const P& firstElof, const P& secondElof)
{//first昇順
	return firstElof.first < secondElof.first;
}
bool pc3(const P& firstElof, const P& secondElof)
{//second降順
	return firstElof.second > secondElof.second;
}
bool pc4(const P& firstElof, const P& secondElof)
{//second昇順
	return firstElof.second < secondElof.second;
}


int main(){
	int n;
	cin >> n;
	deque<pair<int, int>>point(n);
	deque<pair<int, int>>ben(n);
	for (int i = 0; i < n; i++) {
		cin >> point[i].first>>point[i].second;
		ben[i].first = point[i].first + point[i].second;
		ben[i].second = point[i].first;
	}

	long long int taka = 0, aoki = 0;
	for (int i = 0; i < n; i++) {
		if (i == 0) {
			sort(ben.begin(), ben.end(), pc1);
			taka += ben.front().second;
			ben.pop_front();
		}
		else if (i % 2 == 0) {
			taka += ben.front().second;
			ben.pop_front();
		}
		else if(i%2==1){
			aoki += ben.front().first-ben.front().second;
			ben.pop_front();
		}
	}
	cout << taka-aoki<< endl;
	
}


Measured memory_bytes: 1920
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <cmath>
int main()
{
    long X;
    std::cin >> X;
    long key = X%100;
    double key2=key;
    long key3=std::ceil(key2/(double)5.0);
    long hundred=X/100;
    if(hundred>=key3){
        std::cout << 1 << std::endl;
    }else{
        std::cout << 0 << std::endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<cmath>
#include<algorithm>
#include<string>
#include<vector>
#include<stack>
#include<queue>
#include<set>
#include<map>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef pair<int,P> P1;
typedef pair<P,P> P2;
#define pu push
#define pb push_back
#define mp make_pair
#define eps 1e-7
#define INF 1000000000
#define fi first
#define sc second
#define rep(i,x) for(int i=0;i<x;i++)
#define repn(i,x) for(int i=1;i<=x;i++)
#define SORT(x) sort(x.begin(),x.end())
#define ERASE(x) x.erase(unique(x.begin(),x.end()),x.end())
#define POSL(x,v) (lower_bound(x.begin(),x.end(),v)-x.begin())
#define POSU(x,v) (upper_bound(x.begin(),x.end(),v)-x.begin())

const int MAX = 510000;
const int MOD = 1000000007;

int main(){
  ll N,X;cin>>N>>X;

  ll ans = N;
  ll a = max(N-X,X), b= min(N-X,X);
  while(b){
    ll p = a / b;
    ll r = a % b;

    ans += (b*2) * p;
    if(r == 0) ans -= b;

    a = b, b = r;
  }
  cout<<ans<<endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <set>
#include <map>
#include <vector>
#include <algorithm>

using namespace std;
typedef long long ll;

const int INF = 1e9;

const int nmax = 40, abmax = 10;
ll dp[nmax + 1][nmax * abmax + 1][nmax * abmax + 1];

int main(int argc, const char * argv[]) {
  int N, MA, MB;
  cin >> N >> MA >> MB;
  vector<int> alist(N), blist(N), clist(N);
  for (int i = 0; i < N; i++) {
    cin >> alist[i] >> blist[i] >> clist[i];
  }

  for (int i = 0; i <= nmax; i++) {
    for (int j = 0; j <= nmax * abmax; j++) {
      for (int k = 0; k <= nmax * abmax; k++) {
        dp[i][j][k] = INF;
      }
    }
  }
  dp[0][0][0] = 0;
  for (int i = 0; i < N; i++) {
    for (int j = 0; j <= nmax * abmax; j++) {
      for (int k = 0; k <= nmax * abmax; k++) {
        if (dp[i][j][k] == INF) continue;
        dp[i + 1][j][k] = min(dp[i + 1][j][k], dp[i][j][k]);
        dp[i + 1][j + alist[i]][k + blist[i]] = min(dp[i + 1][j + alist[i]][k + blist[i]], dp[i][j][k] + clist[i]);
      }
    }
  }

  ll ans = INF;
  for (int i = 1; i <= N; i++) {
    int a = MA * i, b = MB * i;
    if (a > nmax * abmax || b > nmax * abmax) {
      continue;
    }
    ans = min(ans, dp[N][a][b]);
  }

  if (ans == INF) {
    cout << "-1" << endl;
  } else {
    cout << ans << endl;
  }
  return 0;
}

Measured memory_bytes: 51840
#include<iostream>

using namespace std;

int main()
{
	int card[300];
	int card2[300],card3[300];
	int n,m,k,i,j,l,h;
	
	cin >> n >> m ;
	
	for(i=0;i<2*n;i++)
		card[i]=i+1;
	
	for(i=0;i<m;i++)
	{
		cin >> k ;
		
		if(k==0)
		{
			for(j=0;j<n;j++)
			{
				card2[j]=card[j];
//				cout << "j:" << j << " 2:" << card2[j] << endl;
			}
			for(j=n;j<n*2;j++)
			{
				card3[j-n]=card[j];
//				cout << "j:" << j << " 3:" << card3[j-n] << endl;
			}
			for(h=0,j=0,l=0;j<n;j++,l++)
			{
				card[h]=card2[j];
				h++;
				card[h]=card3[l];
				h++;
			}
		}
		else
		{
			for(j=n*2-(n*2-k),l=0;j<n*2;j++,l++)
			{
				card3[l]=card[j];
//				cout << "j:" << j <<" l:" << l << " 3:" << card3[l] << endl;
			}
			for(j=0;j<k;j++)
			{
				card2[j]=card[j];
//				cout << "j:" << j << " 2:" << card2[j] << endl;
			}
			for(h=0;h<l;h++)
			{
				card[h]=card3[h];
//				cout << "ツ確ツ認2:" << card[h] << endl;
			}
			for(h=l;h<j+l;h++)
			{
				card[h]=card2[h-l];
//				cout << "ツ確ツ認3:" << card[h] << endl;
			}
		}
//		for(j=0;j<n*2;j++)
//		{
//			cout << "ツ確ツ認:" << card[j] << endl;
//		}
	}
	
	for(i=0;i<n*2;i++)
	{
		cout << card[i] << endl;
	}
}

Measured memory_bytes: 0
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String s = sc.nextLine();
		sc.close();

		int idxA = 0;
		for(int i = 0;i < s.length();++i) {
			if(s.charAt(i) == 'A') {
				idxA = i;
				break;
			}
		}
		
		int idxZ = s.length()-1;
		for(int i = s.length()-1;i >= 0;--i) {
			if(s.charAt(i) == 'Z') {
				idxZ = i;
				break;
			}
		}
		
		System.out.println((idxZ - idxA + 1));
	}
}


Measured memory_bytes: 27584
z[2002],*a=z,*b=z+1001,m,i,j;main(n){for(;scanf("%d",&n),i=n;printf("%d\n",m))for(memset(a,m=0,4004);i--;j=a,a=b,b=j)for(j=scanf(" ");j++<n;)m=fmax(m,b[j]=getchar()-42?1+fmin(fmin(b[j-1],a[j-1]),a[j]):0);}

Measured memory_bytes: 0
#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );
using namespace std;
using ll = long long;
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 = 1e9;
const ll MOD = 1e9 + 7;


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

Measured memory_bytes: 3624
#include <bits/stdc++.h>
using namespace std;
#define FOR(i, begin, end) for (ll i = (begin); i < (end); i++)
#define REP(i, n) FOR(i, 0, n)
#define IFOR(i, begin, end) for (ll i = (begin)-1; i >= (end); i--)
#define IREP(i, n) IFOR(i, n, 0)
#define SORT(a) sort(a.begin(), a.end())
#define ISORT(a) sort(a.begin(), a.end(), greater<ll>())
#define REVERSE(a) reverse(a.begin(), a.end())
#define debug(x) cout << #x << "=" << x << endl;
#define vdebug(v)                                                              \
  cout << #v << "=(" << v[0];                                                  \
  FOR(i_debug, 1, v.size()) { cout << "," << v[i_debug]; }                     \
  cout << ")" << endl;
#define mdebug(m)                                                              \
  cout << #m << "=" << endl;                                                   \
  REP(i_debug, m.size()) {                                                     \
    REP(j_debug, m[i_debug].size()) { cout << m[i_debug][j_debug] << ","; }    \
    cout << endl;                                                              \
  }
#define Lower_bound(v, x)                                                      \
  distance(v.begin(), lower_bound(v.begin(), v.end(), x))
#define Upper_bound(v, x)                                                      \
  distance(v.begin(), upper_bound(v.begin(), v.end(), x))
#define Max(a, b) a = max(a, b)
#define Min(a, b) a = min(a, b)

#define ll long long
// #define f first
// #define s second
#define mp make_pair
#define pb push_back
#define INF 1000000000000000000

using vec = vector<ll>;
using mat = vector<vec>;
using Pii = pair<ll, ll>;
using PiP = pair<ll, Pii>;
using PPi = pair<Pii, ll>;
using bvec = vector<bool>;
using Pvec = vector<Pii>;

template <typename T> void readv(vector<T> &a) { REP(i, a.size()) cin >> a[i]; }
void readv_m1(vector<int> &a) {
  REP(i, a.size()) {
    cin >> a[i];
    a[i]--;
  }
}

ll mod = 1000000007;

int main() {
  ll X, Y, Z;
  cin >> X >> Y >> Z;
  cout << Z << ' ' << X << ' ' << Y << endl;

  return 0;
}

Measured memory_bytes: 256
N, K = input().split()
N = int(N)
K = int(K)
scores = [int(s) for s in input().split()]
sums = []
k = K-1
for i in range(k,N-1):
    if(scores[i-k] < scores[i+1]):
        print("Yes")
    else:
        print("No")

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

int main() {
  int n,k ;
  cin>>n>>k;
  map<int,bool> ma;
  rep(i,n){
   ma[i+1]=false; 
  }
  rep(i,k){
    int di;
    cin>>di;
    rep(j,di){
      int a;
      cin>>a;
      ma[a]=true;
    }
  }
  int count=0;
  rep(i,n){
    if(ma[i+1]==false){
      count++;
    }
  }
  cout<<count<<endl;
}

Measured memory_bytes: 3632
#include <iostream>

using namespace std;

int main()
{
    int N, D, X, val;
    int A[100];
    int day[100] = {0};

    cin >> N >> D >> X;

    for( int i=0; i<N; i++ )
        cin >> A[i];

    day[0] = N;

    for( int i=0; i<N; i++ )
    {
        if( A[i] >= D )
            continue;

        for( int j=1; j<D; j++ )
        {
            val = A[i] * j;
            if( val < D )
                day[val]++;
        }
    }

    for( int i=0; i<D; i++ )
    {
        if( day[i] != 0 )
            X += day[i];
    }

    cout << X << endl;
    
    return 0;
}

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

int main()
{
    //freopen("in.txt","r",stdin);
    //freopen("out.txt","w",stdout);
    int n;
    long long ans=0,tmp;
    cin>>n;
    for(int i=0;i<n;i++)
    {
        cin>>tmp;
        while(tmp>0&&(tmp%2==0))
        {
            ans++;
            tmp/=2;
        }
    }
    cout<<ans<<endl;

    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <bits/stdc++.h>
#include <time.h>
#include <sys/timeb.h>
#include <cstdio>
#include <sys/time.h>

using namespace std;
#define ll long long
#define uint unsigned int
#define ulong unsigned long long int
#define Vec vector

template<typename T> bool InRange(T t, T l, T r){ return l <= t && t < r; }

int main(){
	
	int A, B, Q;
	cin >> A >> B >> Q;
	Vec<ll> S(A), T(B);
	for(int i=0;i<A;i++) cin >> S[i];
	for(int j=0;j<B;j++) cin >> T[j];
	Vec<ll> X(Q);
	for(int i=0;i<Q;i++) cin >> X[i];
	
	for(int q = 0; q < Q; q++){
		ll x = X[q];
		int sp = (int)(lower_bound(S.begin(), S.end(), x) - S.begin());
		int tp = (int)(lower_bound(T.begin(), T.end(), x) - T.begin());
		
		ll mi = (ll) 1e18;
		for(int i=-2;i<=2;i++){
			for(int j=-2;j<2;j++){
				int ts = sp + i;
				int tt = tp + j;
				if(!InRange(ts, 0, A) || !InRange(tt, 0, B)) continue;
				
				// x => s => t
				ll xst = abs(x - S[ts]) + abs(S[ts] - T[tt]);
				mi = min(mi, xst);
				// x => t => s
				ll xts = abs(x - T[tt]) + abs(T[tt] - S[ts]);
				mi = min(mi, xts);
			}
		}
		cout << mi << endl;
		
		
	}
	
	
	
	
    return 0;
}

Measured memory_bytes: 3712
input = raw_input()
a, b = input.split()
a = int(a)
b = int(b)
if a > 0 and b > 0:
    print 'Positive'
elif a < 0 and b < 0:
    if (b - a) % 2 == 0:
        print 'Negative'
    else:
        print 'Positive'
else:
    print 'Zero'

Measured memory_bytes: 2568
#include<iostream>
using namespace std;
long long c[]={1,10,100,1000,10000,100000,1000000,10000000,100000000,1000000000};
char s[100];
bool query(long long n)
{
	cout<<"? "<<n<<endl;
	cin>>s;
	return s[0]=='Y';
}
int main()
{
	if(query(c[9]))for(int i=9;;i--)
		if(!i||!query(c[i]-1))
		{
			cout<<"! "<<c[i]<<endl;
			return 0;
		}
	for(int i=8;;i--)
		if(query(c[i]))
		{
			long long l=c[i],r=c[i+1];
			while(l+1<r)
			{
				long long m=(l+r)>>1;
				if(query(m*10))r=m;
				else l=m;
			}
			cout<<"! "<<r<<endl;
			return 0;
		}
}

Measured memory_bytes: 596
#include<bits/stdc++.h>
using namespace std;
int main(){
    int n,a[101101],ans;
    cin>>n;
    for(int i=1;i<=n;i++){
        cin>>a[i];
    }
    sort(a+1,a+1+n);
    for(int i=1;i<=n;i++){
        if(a[i]==a[i-1])ans++;
    }
    if(ans&1)ans++;
    cout<<n-ans<<"\n";
    return 0;
}

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

typedef long long ll;
typedef double ld;


int main() 
{ 
	ios::sync_with_stdio(0);
	cin.tie(0);
	//freopen("data.in", "r", stdin);
	
	int n;
	cin >> n;
	int a = 0, w = 0, t = 0, r = 0;
	while (n--) {
		string s; cin >> s;
		if (s == "AC") a++; 
		else if (s == "WA") w++;
		else if (s == "TLE") t++;
		else if (s == "RE") r++;
	} 
	
	printf("AC x %d\n", a);
	printf("WA x %d\n", w);
	printf("TLE x %d\n", t);
	printf("RE x %d\n", r);
	
	
	
    return 0; 
}

























Measured memory_bytes: 3728
#include<iostream>
#include<algorithm>
#define ll long long
using namespace std;
const int N=2e5+10;
int n,valmn[N],valmx[N];
struct item{int x,y;}A[N];
int cmp(const item&A,const item&B) {return A.x>B.x;}
int main()
{
	cin>>n;
	for(int i=1;i<=n;i++)
	{
		scanf("%d%d",&A[i].x,&A[i].y);
		if(A[i].y>A[i].x) swap(A[i].x,A[i].y);
	}
	sort(A+1,A+n+1,cmp);
	int mn=1e9,mx=0,fl=0;
	for(int i=1;i<=n;i++)
		mn=min(mn,A[i].y),mx=max(mx,A[i].y);
	ll Ans=1ll*(A[1].x-A[n].x)*(mx-mn);
	for(int i=2;i<=n;i++) if(mn==A[i].y) fl=1;
	if(!fl) return printf("%lld\n",Ans),0;
	valmn[0]=1e9;
	for(int i=1;i<=n;i++)
	{
		valmn[i]=min(valmn[i-1],A[i].y);
		valmx[i]=max(valmx[i-1],A[i].y);
		ll res=1ll*(A[1].x-mn)*
			(max(A[i].x,valmx[i-1])-min(A[n].x,valmn[i-1]));
		Ans=min(Ans,res);
	}
	cout<<Ans<<endl;
}


Measured memory_bytes: 3328
#define ENABLE_DEBUG 1
// Kana's kitchen {{{
#include<bits/stdc++.h>
#define ALL(v) std::begin(v), std::end(v)
#define REP(i, k) for (std::decay_t<decltype(k)> i = 0; i < k; i++)
#define LOOP(k) REP (ngtkana_is_a_genius, k)

using i32 = std::int_least32_t;
using i64 = std::int_least64_t;
using u32 = std::uint_least32_t;
using u64 = std::uint_least64_t;
using usize = std::size_t;

template <class T, class U> using pair = std::pair<U, T>;
template <class T> using diag_pair = std::pair<T, T>;
template <class... Args> using tuple = std::tuple<Args...>;
template <class T> using vec = std::vector<T>;
template <class T> using numr = std::numeric_limits<T>;

#ifdef NGTKANA
#include<debug.hpp>
#else
#define DEBUG(...)(void)0
#endif
/*}}}*/

int main() {
    std::cin.tie(nullptr);
    std::ios::sync_with_stdio(false);
    std::cout << std::setprecision(15) << std::fixed;

    i64 n; std::cin >> n;
    std::string ans;
    while (n) {
        i64 r = n % 26;
        if (!r) r = 26;
        ans.push_back('a' + r - 1);
        n -= r;
        n /= 26;
    }
    std::reverse(ALL(ans));
    std::cout << ans << '\n';
}


Measured memory_bytes: 3644