akhauriyash/Code-Regression huggingface dataset:
{-# LANGUAGE FlexibleContexts, BangPatterns #-}

module Main where

import Data.Char
import Data.List
import Control.Monad
import Control.Monad.ST
import Data.Array.ST
import Data.Array.Unboxed
import Control.Applicative
import Text.Printf


readInt :: IO Int
readInt = read <$> (input `seq` input)
    where input = do
            !c <- getChar
            if isDigit c || c == '-'
                then (c :) <$> input
                else return []

prints :: Show a => [a] -> IO ()
prints as = putStrLn $ concat $ intersperse " " $ map show as

check s p
  | length s < length p = False
  | otherwise = (and $ zipWith (==) s p) || check (tail s) p

main = putStrLn . f =<< replicateM 2 getLine
  where f [s,p] = if check (s ++ s) p then "Yes" else "No"


Measured memory_bytes: 3720
#include<stdio.h>
int main(void){
    int n;
    int a[101];
    int i,j;
    int temp;
    scanf("%d",&n);
    int k=n-1;
    for(i=0;i<n;i++)
        scanf("%d",&a[i]);
    for(j=0;j<n/2;j++){
        temp=a[j];
        a[j]=a[k];
        a[k]=temp;
        k--;
    }
    for(i=0;i<n;i++){
        printf("%d",a[i]);
        if(i!=n-1)
            printf(" ");
    }
    printf("\n");
    return 0;
}

Measured memory_bytes: 600
#include <bits/stdc++.h>
using namespace std;
long long dp[100005];
int main(){
    memset(dp, -1, sizeof(dp));
    int n, W;
    scanf("%d%d", &n, &W);   
    dp[0] = 0;
    for(int i=1;i<=n;i++){
        int w, v;
        scanf("%d%d", &w, &v);
        for(int j=W;j>=0;j--){
            if(dp[j] == -1) continue;
            if(j+w <= W) dp[j+w] = max(dp[j+w], dp[j] + v);
        }
    }
    long long ans = 0;
    for(int i=0;i<=W;i++) ans = max(ans, dp[i]);
    printf("%lld\n", ans);
}

Measured memory_bytes: 1024
#include<iostream>
#include<algorithm>
#include<cmath>
#include<cstdio>
#include<cstring>
#include<vector>
#include<stack>
#include<queue>
#include<set>
#include<map>
using namespace std;
int main()
{
	int a,b,c,k;
	cin>>a>>b>>c;
	cin>>k;
	while(k--){
		if(b<=a) b=b*2;
		else c=c*2;
	}
	if(c>b&&b>a){
			cout<<"Yes"<<endl;
	}
	else cout<<"No"<<endl;
    return 0;
}

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

int main() {
  int N;
  int64_t M;
  cin >> N >> M;
  vector<int64_t> data(N);
  for(int i=0; i<N; i++){
    cin >> data.at(i);
  }
  sort(data.begin(), data.end());
  vector<int64_t> sum(N+1, 0);
  for(int i=1; i<=N; i++){
    sum.at(i)= data.at(N-i)+ sum.at(i-1);
  }

  int64_t ans= 0;
  int64_t ng= data.at(0)+ data.at(0)- 1;
  int64_t ok= data.at(N-1)+ data.at(N-1);
  while(ok-ng > 1){
    int64_t mid= (ng+ok)/2;
    int64_t cnt_g  = 0;
    for(auto &pow:data){
      auto itr_g= upper_bound(data.begin(), data.end(), mid- pow);
      cnt_g+= distance(itr_g, data.end());
    }

    if(cnt_g < M){
      ok= mid;
    }
    else{// cnt_g >= M
      ng= mid;
    }
  }

  int64_t cnt_g= 0;
  for(auto &pow:data){
    auto itr_g= upper_bound(data.begin(), data.end(), ok- pow);
    int idx= distance(itr_g, data.end());
    ans+= pow*idx + sum.at(idx);
    cnt_g+= idx;
  }
  ans+= ok*(M-cnt_g);

  cout << ans << endl;
}

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

int main() {
    int W, H, x, y, r;
    cin >> W >> H >> x >> y >> r;
    
    if (x - r >= 0 && x + r <= W &&
        y - r >= 0 && y + r <= H)
        cout << "Yes\n";
    else 
        cout << "No\n";
    return 0;
}


Measured memory_bytes: 3096
#include<bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define forn(i,a,b) for(int i =a;i<b;i++)
#define fi first
#define se second
#define fast ios_base::sync_with_stdio(false);
using namespace std;

//for debugging 
/*
g++ -D_GLIBCXX_ASSERTIONS -DDEBUG -ggdb3 -std=c++14 
*/
int recur_depth = 0;
#ifdef DEBUG
#define dbg(x) {++recur_depth; auto x_=x; --recur_depth; cerr<<string(recur_depth, '\t')<<"\e[91m"<<__func__<<":"<<__LINE__<<"\t"<<#x<<" = "<<x_<<"\e[39m"<<endl;}
#else
#define dbg(x)
#endif
template<typename Ostream, typename Cont>
typename enable_if<is_same<Ostream,ostream>::value, Ostream&>::type operator<<(Ostream& os,  const Cont& v){
	os<<"[";
	for(auto& x:v){os<<x<<", ";}
	return os<<"]";
}
template<typename Ostream, typename ...Ts>
Ostream& operator<<(Ostream& os,  const pair<Ts...>& p){
	return os<<"{"<<p.first<<", "<<p.second<<"}";
}
// debugging ends here

typedef long long int ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<vi> vvi;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

const int modi = 1e9+7;

void solve(){
	int n,k;
	cin >> n >> k;
	int a[n];
	forn(i,0,n)
		cin >> a[i];
	int l=1,r=1e9+100;
	auto ok=[&](int ans, int ck){
		
		for(int i =0;i<n;i++){
			ck-=((a[i]+ans-1)/ans - 1);
		}
		// cout << ck << endl;
		// cout << ans << endl;
		return ck>=0;
	};
	while(l<r){
		int mid = l+(r-l)/2;
		if(ok(mid,k)){
			r=mid;
		}
		else l= mid+1;
	}
	cout << l << endl;
}

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

	// int t;cin >> t;while(t--)
		solve();
}


Measured memory_bytes: 4336
INF = 2*10**7


def main():
    import sys
    input = sys.stdin.buffer.readline
    N, M = (int(i) for i in input().split())
    A = []
    B = []
    C = []
    for _ in range(M):
        a, b = (int(i) for i in input().split())
        A.append(a)
        B.append(b)
        bit = 0
        for i in input().split():
            bit |= (1 << (int(i)-1))
        C.append(bit)
    dp = [[INF]*(1 << N) for _ in range(M+1)]
    dp[0][0] = 0
    for i in range(M):
        for j in range(1 << N):
            dp[i+1][j] = min(dp[i+1][j], dp[i][j])
            if dp[i][j] != INF:
                next_bit = j | C[i]
                dp[i+1][next_bit] = min(dp[i+1][next_bit], dp[i][j] + A[i])
    ans = dp[-1][-1]
    if ans == INF:
        print(-1)
    else:
        print(ans)
    # print(*dp, sep="\n")


if __name__ == '__main__':
    main()


Measured memory_bytes: 75116
#include<iostream>
#include<string>
#include<algorithm>	
#include<cmath>
using namespace std;
int main() {
	long long n, w, sum = 0; string s; cin >> s >> w;
	for (int i = 0; i < s.size(); i++) {
		cout << s[i];
		i += w - 1;
	}
	cout << endl;
	cin >> n;
}

Measured memory_bytes: 256
using System;
using System.Text;
using System.Collections.Generic;
using System.Collections;
using System.Linq;
using E = System.Linq.Enumerable;
class Program
{
    static char[] abc = "abcdefghijklmnopqrstuvwxyz".ToCharArray();
    static char[] moji = "atcoder@".ToCharArray();
    static long mod = 1000000007;
    static void Main(string[] args)
    {
        var S = Console.ReadLine();
        var K = long.Parse(Console.ReadLine());
        //var A = Console.ReadLine().Split(' ').Select(x => long.Parse(x)).ToArray();
        var T = (S + S).ToCharArray();
        long fir = 0;
        long count = 0;
        long sa = 0;
        long N = S.Length;

        for (int i = 1; i < 2*N; i++)
        {
            if(T[i] == T[i - 1])
            {
                count++;
                T[i] = '@';
            }

            if(i == N - 1)
            {
                fir = count;
                count = 0;
            }

            if(i == 2*N - 1)
            {
                sa = count;
            }
        }

        var same = true;

        for (int i = 1; i < N; i++)
        {
            if(S[i] != S[i  -1])
            {
                same = false;
                break;
            }
        }

        if(same)
        {
            Console.WriteLine((N*K)/2);
        }
        else
        {
            Console.WriteLine(fir + sa * (K - 1));
        }
        
    }
        

    
}


Measured memory_bytes: 27524
#pragma comment(linker, "/stack:20000000")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx")

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

using namespace std;

#include <x86intrin.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
template <typename T> using ordered_set = tree<T, null_type, std::less<T>, rb_tree_tag, tree_order_statistics_node_update>;

#define all(x) x.begin(), x.end()

#define mp make_pair
#define in insert
#define er erase
#define con continue
#define pb push_back
#define sc scanf
#define pr printf
#define ub upper_bound
#define lb lower_bound
#define s second
#define f first
#define int long long

const long long infl = 1e18; 
const int N = 3e5 + 300, N2 = 2e3, inf = 1e9 + 200;

set <int> S;
vector <int> g;
int n, m, k, d[4000][4000];
int a[N];

void go(int id, int ans1, int ans2){
	cout << "Case " << id << ": " << ans1 << " " << ans2 << endl;
}

int cc(int n, int k){
	//cout << n << " " << k << endl;
	k = max(k, n - k);
	int res = 1, res2 = 1;
	for (int i = k + 1; i <= n; i++){
		res *= i;
	}
	for (int i = 1; i <= n - k; i++){
		res2 *= i;
	}
	return res / res2;
}

void sol(int _id){
	string s, ss;
	cin >> s >> ss;
	n = s.size();
	m = ss.size();
	s = " " + s;
	ss = " " + ss;
	for (int i = 1; i <= n; i++){
		for (int j = 1; j <= m; j++){
			if (s[i] == ss[j]){
				d[i][j] = d[i - 1][j - 1] + 1;
			}
			else{
				d[i][j] = max(d[i][j - 1], d[i - 1][j]);
			}
		}
	}
	int ans = d[n][m], ansa = ans;
	string w;
	int last = 4000;
	for (int i = n; i >= 1; i--){
		for (int j = min(m, last); j >= 1; j--){
			if (ans == d[i][j] && s[i] == ss[j]){
				ans--;
				last = j - 1;
				w += s[i];
				break;
			}
		}
	}
	reverse(all(w));
	cout << w;
}

main (){
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	sol(0);
//	int t;
//	cin >> t;
//	for (int i = 1; i <= t; i++) sol(i);	
	return 0;
}












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

using namespace std;

inline int read() {
	int res=0,fh=1;
	char ch=getchar();
	while((ch>'9'||ch<'0')&&ch!='-')ch=getchar();
	if(ch=='-')fh=-1,ch=getchar();
	while(ch>='0'&&ch<='9')res=res*10+ch-'0',ch=getchar();
	return fh*res;
}

const int maxn=16;
int n,m,mxs,sum[(1<<16)+12],a[maxn][maxn];
int f[(1<<maxn)][maxn];
inline int Max(int a,int b){return a>b?a:b;}

int main(){
	n=read(),m=read();
	mxs=(1<<n)-1;
	for(int i=1;i<=m;i++){
		int x=read()-1,y=read()-1,z=read();
		a[x][y]=a[y][x]=z;
	}
	for(int i=0;i<=mxs;i++){
		sum[i]=0;
		for(int j=0;j<n;j++)
			if((i&(1<<j)))
				for(int k=j+1;k<n;k++)
					if((i&(1<<k))) sum[i]+=a[j][k];
	}
	memset(f,-1,sizeof f);
	f[1][0]=0;
	for(int i=1;i<=mxs;i+=2){
		for(int j=0;j<n;j++){
			if(f[i][j]==-1) continue;
			if(!(i&(1<<j))) continue;
			for(int k=0;k<n;k++)
				if(a[j][k]&&(!(i&(1<<k))))
					f[i|(1<<k)][k]=Max(f[i|(1<<k)][k],f[i][j]+a[j][k]);
			int c=(mxs-i)|(1<<j);
			for(int k=c;k>=0;k=(k==0?-1:(k-1)&c))
				f[i|k][j]=Max(f[i][j]+sum[k],f[i|k][j]);
		}
	}
	int ans=0;
	for(int i=(mxs>>1)+2;i<=mxs;i+=2)
		ans=Max(ans,f[i][n-1]);
	printf("%d\n",sum[mxs]-ans);
	return 0;
}


Measured memory_bytes: 4480
N,W = map(int,input().split())
WV = []
for i in range(N):
    WV.append(list(map(int,input().split())))
dp = [[0 for i in range(W+1)] for i in range(N+1)]
for i in range(N):
    if i == 0:
        for j in range(W+1):
            if j >= WV[i][0]:
                dp[i][j] = WV[i][1]
    else:
        for j in range(W+1):
            if j - WV[i][0] < 0:
                dp[i][j] = dp[i-1][j]
            else:
                dp[i][j] = max(dp[i-1][j],dp[i-1][j-WV[i][0]]+WV[i][1])
print(dp[N-1][W])

Measured memory_bytes: 171656
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.NoSuchElementException;

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

		int n = scan.nextInt();
		int k = scan.nextInt();

		int ret = 0;
		for (int i = 0; i < n; i++) {
			if (scan.nextInt() >= k) {
				ret++;
			}

		}

		out.println(ret);
		out.flush();
	}
}

class FastScanner {
	private final InputStream in = System.in;
	private final byte[] buffer = new byte[1024];
	private int ptr = 0;
	private int buflen = 0;

	private boolean hasNextByte() {
		if (ptr < buflen) {
			return true;
		} else {
			ptr = 0;
			try {
				buflen = in.read(buffer);
			} catch (IOException e) {
				e.printStackTrace();
			}
			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;
	}

	public boolean hasNext() {
		while (hasNextByte() && !isPrintableChar(buffer[ptr]))
			ptr++;
		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() {
		long nl = nextLong();
		if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE)
			throw new NumberFormatException();
		return (int) nl;
	}

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

Measured memory_bytes: 22612
import sys
input=sys.stdin.readline
h,n=map(int,input().split())
INF=10**9
dp=[INF]*(h+1+10**4)
magic=[]
for i in range(n):
    a,b=map(int,input().split())
    magic.append((a,b))
dp[0]=0
for i in range(1,h+1+10**4):
    for j in magic:
        if i-j[0]>=0:
            if dp[i-j[0]]+j[1]<dp[i]:
                dp[i]=dp[i-j[0]]+j[1]
ans=INF
for i in range(h,h+1+10**4):
    ans=min(ans,dp[i])
print(ans)


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

int main()
{
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int n;
  cin >> n;
  vector<int> a(n), b(n);
  for (int i = 0; i < n; ++i) {
    cin >> a[i];
  }
  queue<int> q;
  auto sum = [&](int i) {
    return b[(i + n - 1) % n] + b[(i + n + 1) % n];
  };
  auto canAdd = [&](int i) {
    return b[i] > sum(i) && b[i] > a[i];
  };
  for (int i = 0; i < n; ++i) {
    cin >> b[i];
    if (canAdd(i)) {
      q.push(i);
    }
  }
  long long ans = 0;
  while (!q.empty()) {
    int i = q.front();
    q.pop();
    int mod = sum(i);
    int pi = (i + n - 1) % n, ni = (i + n + 1) % n;
    int old = b[i];
    b[i] -= (b[i] - a[i]) / mod * mod;
    ans += (old - b[i]) / mod;
    if (canAdd(pi)) {
      q.push(pi);
    }
    if (canAdd(ni)) {
      q.push(ni);
    }
  }
  for (int i = 0; i < n; ++i) {
    if (b[i] != a[i]) {
      cout << -1 << endl;
      return 0;
    }
  }
  cout << ans << endl;
  return 0;
}


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

typedef long long int LL;
typedef long long int LLint;
typedef pair<int,int> intpair;
typedef pair<bool,bool> boolpair;
typedef pair<string,string> strpair;
typedef pair<LL,LL> LLpair;
typedef pair<double,double> doublepair;
typedef pair<float,float> floatpair;
typedef vector<int> intvector;
typedef vector<bool> boolvector;
typedef vector<string> strvector;
typedef vector<LL> LLvector;
typedef vector<double> doublevector;
typedef vector<float> floatvector;
#define wait(sec) usleep((sec) * 1000000)
#define ED return 0;
#define TEST cout << "OK" << endl;
#define UP(a,b) ((a+(b-1))/b)
#define SORT(vec) sort(vec.begin(),vec.end());
#define DOUBLECHANGE(count) cout << setprecision(count);
#define REV(vec) reverse(vec.begin(),vec.end());
#define ipow(x,y) LL(pow(x,y))
#define INF 999999999
const long long mod = 1000000007;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    long long int X, Y;
    cin >> X >> Y;
    cout << int(log2l(Y/X))+1 << endl;
}

Measured memory_bytes: 512
#define _GLIBCXX_DEBUG
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cmath>
#include <utility>
using namespace std;
#define omajinai ios::sync_with_stdio(false);cin.tie(nullptr);

#pragma region typedef 
typedef long long ll;
typedef long double ld;
typedef pair<int, int> P;
#pragma endregion

#pragma region define
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define rep(i, n) for(int i = 0; (i) < (n); (i)++)
#define pb push_back
#define pf push_front
#pragma endregion

#pragma region const
const ll INF = 1e18;
const ld PI = 3.141592653589793;
#pragma endregion

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

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

int main(){
omajinai;

    long long h[100010];
    long long dp[100010];

    int N; cin >> N;
    rep(i, N) cin >> h[i];

    rep(i, 100010) dp[i] = INF;

    dp[0] = 0;

    for(int i = 1; i < N; ++i){
        chmin(dp[i], dp[i-1] + abs(h[i] - h[i-1]));
        if (i > 1)
            chmin(dp[i], dp[i-2] + abs(h[i] - h[i-2]));
    }

    cout << dp[N-1] << endl;
return 0;
}

Measured memory_bytes: 5160
#include<bits/stdc++.h>
using namespace std;
#define rep(i,N) for(int i = 0; i < N; i++)
#define all(x) x.begin(), x.end()
#define sort(x) sort(all(x))
#define cou(x) cout << x << endl
using lint = long long;
using vi = vector<int>;

int main() {
	int N;
	cin >> N;
	vi l(N);
	int p;
	rep(i, N) {
		cin >> p;
		l.at(i) = p;
	}
	p = 0;
	int q = 0;
	rep(i, N) {
		if (l.at(i) > p) {
			p = l.at(i);
			q = i;
		}
	}
	int elsesum = 0;
	rep(i, N) {
		if (i != q) {
			elsesum += l.at(i);
		}
	}
	if (l.at(q) < elsesum) {
		cou("Yes");
	}
	else {
		cou("No");
	}
}

Measured memory_bytes: 256
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define all(v) v.begin(), v.end()
using in = int64_t;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define REP(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define Yes cout<<"Yes"<<endl
#define No cout<<"No"<<endl
#define yes cout<<"yes"<<endl
#define no cout<<"no"<<endl
const double PI=3.14159265358979323846;
const in MOD = 1000000007;
const in INF=1e18+7;
const int inf=1e9+7;
using P=pair<int,int>;
vector<int> dx={0,1,-1,0};
vector<int> dy={1,0,0,-1};

using ld=long double;

int main(){
ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
cout << fixed << setprecision(10);
    ld n,m,d;
    cin>>n>>m>>d;
    ld ans=(m-1.0)*(n-d);
    if(d!=0.0) ans *=2.0;
    ans /=n;
    ans /=n;
    cout<<ans<<'\n';
}/*
./problem.exe
*/

Measured memory_bytes: 256
#define _USE_MATH_DEFINES

#include <iostream>
#include <algorithm> // min()
#include <string>
#include <vector>
#include <numeric>
#include <queue>
#include <stack>
#include <tuple>
#include <random>

#include <climits> // INT_MAX
#include <cmath> // ceil()
#include <cstring>

#define rep(i, n) for (int i = 0; i < n; ++i)
#define b2e(vec) vec.begin(), vec.end()

using namespace std;
using ll = long long;
using ull = unsigned long long;
using P = pair<int, int>;
using Graph = vector<vector<int>>;

const int type_num = 26;

random_device rnd;     // 非決定的な乱数生成器を生成
mt19937 mt(rnd());     //  メルセンヌ・ツイスタの32ビット版、引数は初期シード値
uniform_int_distribution<> rand26(0, 25);        // [0, 99] 範囲の一様乱数


int decrease_satis(vector<int> & c, vector<int> & last, int d) {
	int y = 0;
	rep(i, type_num) y += c[i] * (d + 1 - last[i]);
	return y;
}


int main() {
	int D;
	cin >> D;

	vector<int> c(type_num);
	rep(i, type_num) cin >> c[i];

	vector<vector<int>> s(D, vector<int>(type_num));
	rep(i, D) rep(j, type_num) cin >> s[i][j];

	//vector<int> t(D);
	//rep(i, D) {
	//	cin >> t[i];
	//	t[i]--;
	//}
	rep(i, D) cout << rand26(mt) + 1 << endl;


	//vector<int> last(type_num);
	//int satis = 0;

	//rep(i, D){
	//	last[t[i]] = i + 1;
	//	satis += s[i][t[i]] - decrease_satis(c, last, i);
	//}
	//cout << satis << endl;
}

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

int main(){
  vector<int> v;
  int a;
  for (int i=0; i<3; i++){
    cin >> a;
    v.push_back(a);
  }
  sort(v.begin(), v.end());

  for (int i=0; i<v.size(); i++){
    if(i == v.size() -1){
      cout << v[i];
    }else{
      cout << v[i] << " ";
    }
  }
  cout << endl;
  return 0;

}

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

int main() {
    int n;
    cin >> n;
    int a, b;
    cin >> a >> b;
    int c;
    cin >> c;
    int d[n];
    for (int i = 0; i < n; i++) {
        cin >> d[i];
    }

    sort(d, d + n, greater<int>());

    int sump = c, summ = a;
    double max = (double)sump / summ;
    for (int i = 0; i < n; i++) {
        sump += d[i];
        summ += b;
        if ((double)sump / summ < max) break;
        max = (double)sump / summ;
    }
    cout << (int)max << endl;
    return 0;
}

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

#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define FOR(i,n,m) for(int i=(int)(n); i<=(int)(m); i++)
#define RFOR(i,n,m) for(int i=(int)(n); i>=(int)(m); i--)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define RITR(x,c) for(__typeof(c.rbegin()) x=c.rbegin();x!=c.rend();x++)
#define setp(n) fixed << setprecision(n)

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

#define ll long long
#define vll vector<ll>
#define vi vector<int>
#define pll pair<ll,ll>
#define pi pair<int,int>

#define all(a) (a.begin()),(a.end())
#define rall(a) (a.rbegin()),(a.rend())
#define fi first
#define se second
#define pb push_back
#define ins insert

#define debug(a) cerr<<(a)<<endl
#define dbrep(a,n) rep(_i,n) cerr<<(a[_i])<<" "; cerr<<endl
#define dbrep2(a,n,m) rep(_i,n){rep(_j,m) cerr<<(a[_i][_j])<<" "; cerr<<endl;}

using namespace std;

template<class A, class B>
ostream &operator<<(ostream &os, const pair<A,B> &p){return os<<"("<<p.fi<<","<<p.se<<")";}
template<class A, class B>
istream &operator>>(istream &is, pair<A,B> &p){return is>>p.fi>>p.se;}

/* Some Libraries */

//-------------------------------------------------

int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N; cin>>N;
    vi a(N),b(N);
    rep(i,N) cin>>a[i]>>b[i];
    rep(i,N-2){
        if (a[i]==b[i] && a[i+1]==b[i+1] && a[i+2]==b[i+2]){
            cout<<"Yes\n";
            return 0;
        }
    }
    cout<<"No\n";
    return 0;
}


Measured memory_bytes: 3640
#include <stdio.h>
#include <iostream>
#include <vector>
#include <algorithm>
#include <iomanip>
#include <string>
#include <math.h>
#include <set>
#include <map>
#include <numeric>
using namespace std;
#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()
#define _printV(vec) for(int i = 0; i < SZ(vec); i++){cout << vec[i];if (i==SZ(vec)-1){cout<<endl;}else{cout << " ";}}
#define printV(vec) cout<<#vec<<":";_printV(vec)
#define _printA(arr,n) for(int i = 0; i < n; i++){cout << arr[i];if (i==n-1){cout<<endl;}else{cout << " ";}}
#define printA(arr) cout<<#arr<<":";_printA(arr,sizeof(arr)/sizeof(arr[0]))
#define LLINF = (1LL<<62)
#define puts(var) cout<<#var<<":"<<var<<" "
typedef long long ll;

int main()
{
  int H,W;
  cin >> H >> W;
  int A[H][W];
  ll sum = 0;

  REP(j,H){
    REP(i,W){
      int a;
      cin >> a;
      a = a%2;
      sum += a;
      A[j][i] = a;
    }
  }
  vector<int> a1;
  vector<int> a2;
  vector<int> a3;
  vector<int> a4;
  int cnt = 0;
  REP(j,H){
    REP(i,W){
      if(i!=W-1 && A[j][i]){
        if(A[j][i+1]){
          A[j][i] = 0;
          A[j][i+1] = 0;
        }
        else{
          A[j][i] = 0;
          A[j][i+1] = 1;
        }
        a1.push_back(j+1);
        a2.push_back(i+1);
        a3.push_back(j+1);
        a4.push_back(i+2);
        cnt++;
      }
    }
  }

  REP(j,H){
    int i = W-1;
    if(j!=H-1 && A[j][i]){
      if(A[j+1][i]){
        A[j][i] = 0;
        A[j+1][i] = 0;
      }
      else{
        A[j][i] = 0;
        A[j+1][i] = 1;
      }
      a1.push_back(j+1);
      a2.push_back(i+1);
      a3.push_back(j+2);
      a4.push_back(i+1);
      cnt++;
    }
  }
  cout << cnt << endl;
  REP(i,cnt){
    cout << a1[i] << " " << a2[i] << " " << a3[i] << " " << a4[i] << endl;

  }





  return 0;
}


Measured memory_bytes: 5220
#include <iostream>
#include <iomanip>
#include <random>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <cmath>
#include <numeric>
#include <cstdlib>
#include <cstring>
#include <deque>
#include <sstream>
#include <bitset>
#include <cassert>
#include <fstream>

#define len(X) ((int)(X).size())

#ifdef __LOCAL
#define DBG(X) cout << #X << "=" << (X) << endl;
#else
#define DBG(X)
#endif
 
using namespace std;

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

const int INT_INF = (int)(2e9);
const ll  LL_INF  = (ll)(2e18);

const ll mod = 1e9 + 7;
const int NIL = -1;
static mt19937 _g(time(nullptr));

inline ll randint(ll a, ll b) { ll w = (_g() << 31LL) ^ _g(); return a + w % (b - a + 1); }
inline void fast_io() { ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); };
template<typename T> inline T sign(T x) { return T(x > 0) - T(x < 0); }
template<typename T, typename S> inline ostream& operator<<(ostream& os, const pair<T, S> p) { cout << "[" << p.first << ";" << p.second << "]"; return os; }
template<typename T> inline ostream& operator<<(ostream& os, const vector<T>& v) { for(auto el: v) cout << el << " "; return os; }

const int MAX_V = (int)1e5 + 77;

vector<int> g[MAX_V];
bool met[MAX_V];
int dp[MAX_V][3];
int V, E, S, T;

inline void run_bfs()
{
	memset(met, 0, sizeof(met[0]) * V);

	deque<int> q = {S};
	met[S] = true;

	while(!q.empty())
	{
		int v = q.front();
		q.pop_front();

		for(auto u: g[v])
		{
			if(!met[u])
			{
				met[u] = true;
				q.push_back(u);
			}

			for(int r = 0; r < 3; ++r)
			{
				int r2 = (r + 1) % 3;
				dp[u][r2] = min(dp[u][r2], dp[v][r] + 1);
			}
		}
	}
}

void solve()
{
	cin >> V >> E;

	for(int i = 0; i < E; ++i)
	{
		int v, u;
		cin >> v >> u;
		--v, --u;

		g[v].push_back(u);
	}

	cin >> S >> T;
	--S, --T;

	for(int v = 0; v < V; ++v)
		for(int r = 0; r < 3; ++r)
			dp[v][r] = INT_INF;

	dp[S][0] = 0;

	for(int i = 0; i < 3; ++i)
		run_bfs();

#ifdef __LOCAL

	for(int v = 0; v < V; ++v)
		for(int r = 0; r < 3; ++r)
			cout << make_pair(v + 1, r) << " --> " << dp[v][r] << endl;

#endif

	cout << (dp[T][0] == INT_INF ? NIL : dp[T][0] / 3) << endl;
}

int main()
{
	fast_io();
	solve();

	return 0;
}


Measured memory_bytes: 7040
#
# File    : A.rb
# Author  : Kazune Takahashi
# Created : 2018-7-21 20:51:33
# Powered by Visual Studio Code
#

a = gets.chomp.split(" ").map{|i| i.to_i}.sort

puts [(a[1] - a[0]).abs + (a[2] - a[1]).abs,
(a[1] - a[2]).abs + (a[2] - a[0]).abs,
(a[1] - a[0]).abs + (a[2] - a[0]).abs].min




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

int main(){
    int N;
    cin >> N;
    int a[210];
    for(int i = 0; i<N; i++) cin >> a[i];
    
    int count = 0;
    bool flag = true;
    while(true){
        for (int i = 0; i < N; i++){
            if (a[i] % 2 != 0){
                flag = false;
            } else{
                a[i] /= 2;
            }
        }
        if (flag==false){
            break;
        }
        count++;
    }
    cout << count << endl;
    
}

Measured memory_bytes: 256
def main():
    _ = int(input())
    S = input()
    a = 0
    b = 0
    for s in S:
        if s == '(':
            b += 1
            continue
        if s == ')' and b == 0:
            a += 1
            continue
        b -= 1
    print('(' * a + S + ')' * b)


main()


Measured memory_bytes: 2940
/*
    ThunderClap and Flash.
    Raunaq Singh
*/
#include "bits/stdc++.h" 
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll,ll> pll;
#define ThunderClap ios::sync_with_stdio(0),cin.tie(NULL),cout.tie(NULL);
#define debugg(something)   cout<<#something<<" - "<<something<<"\n";
#define vi vector
#define umap unordered_map
#define uset unordered_set
#define mset multiset
#define LB lower_bound
#define UB upper_bound
#define mp make_pair
#define pb push_back
#define in insert
#define s second
#define f first
#define pQueue priority_queue
#define maxElement *max_element
#define minElement *min_element
#define MAX 100000LL
#define mod 1000000007LL
#define inf 1000000000000000000LL
#define mI2 500000004LL
inline ll add(ll a, ll b){ return ((a%mod)+(b%mod))%mod;}
inline ll mul(ll a, ll b){ return ((a%mod)*(b%mod))%mod;}
inline ll sub(ll a, ll b){ return ((a%mod)-(b%mod)+mod)%mod;}

void Flash(){
    ll n,m;
    cin>>n>>m;
    ll a[m];
    ll ss=0;
    for(ll i=0;i<m;i++){
        cin>>a[i];
        ss+=a[i];
    }
    cout<<max(-1LL,n-ss)<<"\n";
}

int main(int argc, char const *argv[]){
    ThunderClap;
    cout<<fixed<<setprecision(10);
    ll t=1;
    //cin>>t;
    for(ll i=1;i<=t;i++){
        //cout<<"Case #"<<i<<": ";
        Flash();
    }
    return 0;
}

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

int main(){
  int n, m;
  cin >> n >> m;
  if(n%2==1 || n>=4*m){
    for(int i=1; i<=m; i++){
      cout << i << ' ' << n-i+1 << endl;
    }
    return 0;
  }
  else{
    int d=1;
    for(int i=m; i>=1; i--){
      if(d==n/2 || d-1==n/2)d++;
      cout << i << ' ' << i+d << endl;
      d+=2;
    }
    return 0;
  }
}

Measured memory_bytes: 3192
n, m = map(int, input().split())
a_and_b_list = [list(map(int, input().split())) for _ in range(m)]
bridge_broken = [False for _ in range(n-1)]
a_and_b_list.sort(key=lambda x: x[1])
previous_broken_bridge = -1
for a_and_b in a_and_b_list:
    if previous_broken_bridge < a_and_b[0]:
        bridge_broken[a_and_b[1]-2] = True
        previous_broken_bridge = a_and_b[1] - 1
print(bridge_broken.count(True))

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


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

	if(a+b > c+d) cout << "Left" << endl;
	else if(a+b == c+d) cout << "Balanced" << endl;
	else cout << "Right" << endl;

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define debug(...) cerr << "[(" << __LINE__ << ") " << (#__VA_ARGS__) << "]: " << __VA_ARGS__ << endl;

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

    int k, a, b;
    cin >> k >> a >> b;

    if (b-a >= k-1 || a%k > b%k || a%k == 0)
        cout << "OK\n";
    else
        cout << "NG\n";
}


Measured memory_bytes: 3648
def get_int
  gets.chop.to_i
end

def get_ints
  gets.chop.split.map(&:to_i)
end

def get_double
  gets.chop.to_f
end

def get_str
  gets.chop
end

def get_strs
  gets.chop.split
end

def main
  s = get_strs
  puts s[1] + s[0]
end

if __FILE__ == $0
  main
end


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

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

#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define sz size()

const int N = 1e5 + 5;
const int MOD = 1e9 + 7;

int main(){

  int n;
  cin >> n;
  ll ans = 0LL;
  for(int i = 1; i <= n; i++){
    for(int j = 1; j <= n; j++){
      for(int k = 1; k <= n; k++){
        ans +=  __gcd( __gcd(i, j), k );
      }
    }
  }
  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 3632
#include <iostream>
#include<string>
#include<algorithm>
using namespace std;
int main()
{
	int t,x,a[101],c=0;
	cin >> t >> x;
	for (int i = 0; i < t; i++)
	{
		cin >> a[i];
	}
	sort(a, a + t);
	for (int i = 0; i < t; i++)
	{
		x -= a[i];
		if (x<0)
		{
			break;
		}
		else if (x==0)
		{
			c++;
			break;
		}
		c++;
	}
	while (x>0)
	{
		x -= a[0]; 
		if (x < 0)
			break;
		c++;
	}
	cout << c;
}

Measured memory_bytes: 256
def solve(f, A):
    r, s = 0, 0
    for a in A:
        s += a
        if s == 0:
            r += 1
            s = f
        elif s * f < 0:
            r += -(s * f) + 1
            s = f
        f = -f
    return r

def main():
    N = int(input())
    A = list(map(int, input().split()))
    return min(solve(1, A), solve(-1, A))

print(main())


Measured memory_bytes: 14332
import sys
readline = sys.stdin.readline

S = readline().rstrip()
T = readline().rstrip()

dp = [[0] * (len(T) + 1) for i in range(len(S) + 1)]

for i in range(len(S)):
  for j in range(len(T)):
    if S[i] == T[j]:
      dp[i + 1][j + 1] = dp[i][j] + 1
    else:
      dp[i + 1][j + 1] = max(dp[i][j + 1],dp[i + 1][j])
      
#for d in dp:
#  print(d)
x = len(S)
y = len(T)
ans = ""
while y > 0 and x > 0:
  if dp[x][y] == dp[x][y - 1] + 1 == dp[x - 1][y] + 1:
    ans += T[y - 1]
    y -= 1
    x -= 1
  else:
    if dp[x][y - 1] == dp[x][y]:
      y -= 1
    else:
      x -= 1
  
print(ans[::-1])

Measured memory_bytes: 144628
long long x[101],i,j,dp[100][80],n;int main(){scanf("%lld",&n);for(i=1;i<=n;i++){scanf("%lld",&x[i]);}dp[1][50+x[1]]=1;for(i=2;i<n;i++){for(j=0;j<=20;j++){dp[i][50+j]=dp[i-1][50+j+x[i]]+dp[i-1][50+j-x[i]];}}printf("%lld\n",dp[n-1][50+x[n]]);return 0;}

Measured memory_bytes: 660
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,a,b) for(int i=a;i>=b;i--)
#define fore(i,a) for(auto &i:a)
#define all(x) (x).begin(),(x).end()
//#pragma GCC optimize ("-O3")
using namespace std;

int main() {
  
  int a,b,c,d,x;
  double da,db;
  string s,ss,sss;
  
  int ans = 0;
  string anss = "";
  
  cin >> x >> a;
  
  int ab [] = {0 , 1 , 3 , 1 , 2 , 1 , 2 , 1 , 1 , 2 , 1 , 2 , 1};
  int result3 = std::max({a, b, c});
//--------------------------------------------------------------------------------

  if(x>=a) ans = 10;
  else ans = 0;

  cout << ans << endl;

}

Measured memory_bytes: 256
// Queens Problem
#include <stdio.h>

#define N 8
#define NOT_FREE -1
#define FREE 1

int B[N][N];        // N*Nの盤面
int dpos[2 * N - 1];        // dpos[x]がNOT_FREEのとき、左下方向の列xは襲撃されている
int dneg[2 * N - 1];        // dneg[x]がNOT_FREEのとき、右下方向の列xは襲撃されている
int row[N]; // row[x]がNOT_FREEのとき、行xは襲撃されている
int col[N]; // col[x]がNOT_FREEのとき、列xは襲撃されている

void printBoard(){
  int i, j;
  
  for(i=0; i < N; i++){
    for(j=0; j < N; j++){
      if(B[i][j]){
	if(row[i] != j) return;
      }
    }
  }
  
  for(i=0; i < N; i++){
    for(j=0; j < N; j++){
      if(row[i] == j)printf("Q");
      else printf(".");
    }
    printf("\n");
  }
}

void putQueen(int i){
  int j;

  if(i == N){
    printBoard();
    return;
  }
  for(j=0; j < N; j++){
    if(col[j] == NOT_FREE || dpos[i+j] == NOT_FREE
       || dneg[i-j+N-1] == NOT_FREE) continue;
    row[i] = j;
    col[j] = dpos[i+j] = dneg[i-j+N-1] = NOT_FREE;
    putQueen(i+1);
    row[i] = col[j] = dpos[i+j] = dneg[i-j+N-1] = FREE;
  }
}

int main(){
  int i, j, k, r, c;

  for(i=0; i < N; i++) row[i] = col[i] = FREE;
  for(i=0; i < 2 * N - 1; i++) dpos[i] = dneg[i] = FREE;
  
  for(i=0; i < N; i++){
    for(j=0; j < N; j++){
      B[i][j] = 0;
    }
  }
  
  scanf("%d", &k);
  for(i=0; i < k; i++){
    scanf("%d%d", &r, &c);
    B[r][c] = 1;
  }

  putQueen(0);
  
  return 0;
}



Measured memory_bytes: 2112
#include <bits/stdc++.h>
#define ll long long
#define INF 999999999
#define MOD 1000000007
#define rep(i,n) for(int i=0;i<n;i++)

using namespace std;

typedef pair<int,int>P;

const int MAX_N = 125252;

vector<P> lens[125252];

int bit[MAX_N+1],n,m;
//i番目までの和を計算する
int sum(int i)
{
	int s = 0;
	while(i>0){
		s += bit[i];
		i -= i & -i;
	}
	return s;
}
//i番目の値にxを加える
void add(int i,int x)
{
	while(i <= MAX_N){
		bit[i] += x;
		i += i & -i;
	}
}

int main()
{
	scanf("%d%d",&n,&m);
	rep(i,n){
		int l,r;
		scanf("%d%d",&l,&r);
		r++;
		lens[r-l].push_back(P(l,r));	//rはr+1を指すようにする
	}
	printf("%d\n",n);
	int rest = n;
	for(int i=2;i<m+1;i++){	//iは間隔dのこと
		rep(j,lens[i-1].size()){
			add(lens[i-1][j].first,1);
			add(lens[i-1][j].second,-1);
			rest--;
		}
		int ans = rest;	//間隔がm以上の区間
		int it = i;
		while(it<=m){
			ans += sum(it);
			it += i;
		}
		printf("%d\n",ans);
	}
}

Measured memory_bytes: 8576
#include<stdio.h>

int main(void)
{
	int x[100]={0};
	int st,fn,a,n,i,ty,kai;
	while(0==0){
		scanf("%d",&n);
		if(n==0)break;		
		kai=1;  st=0; fn=n-1;
		for(i=0;i<n;i++) scanf("%d",&x[i]);
		scanf("%d",&a);
		while(0==0){
			ty=(st+fn)/2;
			if(a==x[ty]||fn-st==0)break;
			else if(fn-st<0){kai--;break;}
			else if(a>x[ty])  st=ty+1;
			else fn= ty-1;
			kai++;
		}
		printf("%d\n",kai);
	}
	return 0;
}

Measured memory_bytes: 1028
#include<iostream>
#include<algorithm>
#include<string>
#include<math.h>
#include<vector>
#include<iomanip>
using namespace std;

int main(void)
{
    string s;
    int total = 0,min = 999999999;
    cin >> s;
    for(int i = 0;i < s.size() - 2;i++)
    {
        total = (s[i] - 48) * 100 + (s[i + 1] - 48) * 10 + (s[i + 2] - 48);
        if(abs(total - 753) < min){min = abs(total - 753);}
    }
    cout << min << endl;
    return 0;
}

Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import static java.lang.Math.sin;
import static java.lang.Math.cos;
import static java.lang.Math.toRadians;

public class Main {

  private static StringBuilder buf = new StringBuilder();

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

      int n = Integer.parseInt( br.readLine() );
      Point2D p1 = new Point2D(0,0);
      Point2D p2 = new Point2D(100, 0);

      calcKochCurve(n, p1, p2);
      System.out.print(buf);
      
    }
  }

  private static void calcKochCurve(int d, Point2D p1, Point2D p2) {
    double rad = toRadians(60);

    buf.append(p1);
    kochCurve( d, p1, p2, rad );
    buf.append(p2);
  } 

  private static void kochCurve(int d, Point2D p1, Point2D p2, double rad) {
    if( d != 0) {
      Point2D s = new Point2D();
      Point2D t = new Point2D();

      s.x = (2*p1.x + p2.x) / 3;
      s.y = (2*p1.y + p2.y) / 3;
      t.x = (p1.x + 2*p2.x) / 3;
      t.y = (p1.y + 2*p2.y) / 3;

      Point2D u = new Point2D();

      u.x = (t.x - s.x)*cos(rad) - (t.y - s.y)*sin(rad) + s.x;
      u.y = (t.x - s.x)*sin(rad) + (t.y - s.y)*cos(rad) + s.y;

      kochCurve(d-1, p1, s, rad);
      buf.append(s);
      kochCurve(d-1, s, u, rad);
      buf.append(u);
      kochCurve(d-1, u, t, rad);
      buf.append(t);
      kochCurve(d-1, t, p2, rad);
    }
  }
}

class Point2D {
  double x;
  double y;

  public Point2D() { }
  public Point2D(double x,double y) {
    this.x = x;
    this.y = y;
  }

  @Override
  public String toString() {
    return String.format("%.8f %.8f\n", x, y);
  }
  public double distance(Point2D p) {
    return Math.sqrt(Math.pow((p.x - this.x),2) + Math.pow((p.y - this.y), 2));
  }
}


Measured memory_bytes: 39224
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define FOR(I,A,B) for(ll I = (A); I < (B); ++I)
#define CLR(mat) memset(mat, -1, sizeof(mat))
#define N 200
const ll inf=1e9+7;
ll a,b;

int main(){
	cin>>a>>b;
	if(a==1)a+=13;
	if(b==1)b+=13;
	if(a>b){
		cout<<"Alice"<<endl;
	}else if(a==b){
		cout<<"Draw"<<endl;
	}else{
		cout<<"Bob"<<endl;
	}

	return 0;
}

Measured memory_bytes: 256
#include<iostream>

int main()
{
	using namespace std;
	string S,a, b, c;
	int rain = 0;
	cin >>S;
	a = S[0];
	b = S[1];
	c = S[2];
	if (a == "R")
	{
		rain = 1;
		if (b == "R")
		{
			rain = 2;
			if (c == "R")
			{
				rain = 3;
			}
			else
			{
				rain = 2;
			}
		}
		else
		{

		}

	}
	else
	{
		if (b == "R")
		{
			rain = 1;
			if (c == "R")
			{
				rain = 2;
			}
			else
			{

			}
		}
		else
		{
			if (c == "R")
			{
				rain = 1;
			}
			else
			{

			}
		}
	}
	cout << rain;
}

Measured memory_bytes: 3620
#include <stdio.h>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <list>
#include <queue>
#include <stack>
#include <cmath>
#include <ctime>
#include <cstdio>
#include <vector>
#include <string>
#include <bitset>
#include <cctype>
#include <cstdlib>
#include <cstring>
#include <utility>
#include <numeric>
#include <complex>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <cassert>
#include <iostream>
#include <iterator>
#include <algorithm>
#include <functional>
using namespace std;
typedef long long ll;
const double EPS = 1e-9;
typedef vector<int> vint;
typedef vector<vector<int>> v2int;
typedef vector<vector<vector<int>>> v3int;
typedef vector<ll> vll;
typedef vector<vector<ll>> v2ll;
typedef vector<vector<vector<ll>>> v3ll;
typedef list<int> liint;
typedef pair<int, int> pint;
typedef vector<pair<int, int>> vpint;
typedef vector<pair<ll, ll>> vpll;
typedef vector<pair<ll, int>> vpll_int;
typedef vector<pair<int, ll>> vpint_ll;
typedef set<pair<int, int>> spint;
typedef set<pair<ll, int>> spll;
typedef unordered_map<int, unordered_set<int>> Graph;
const int INF = int(2e9);
const ll LINF = ll(2e9) * ll(2e9);
#define rep(i, n) REP(i, 0, n)
#define ALL(v) v.begin(), v.end()
#define MSG(a) cout << #a << " " << a << endl;
#define REP(i, x, n) for(int i = x; i < n; i++)
template<class T, class C> void chmax(T& a, C b) { a > b ? : a = b; }
template<class T, class C> void chmin(T& a, C b) { a < b ? : a = b; }



int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int N;
    cin >> N;
    if (N >= 30) {
        cout << "Yes" << endl;
    }
    else {
        cout << "No" << endl;
    }
    
    return 0;
}

Measured memory_bytes: 3664
#include<bits/stdc++.h>
#define ll long long int
using namespace std;
int main(){
	int n,d;
	cin>>n>>d;
	ll cnt=0;
	vector<double>v;
	while(n--){
		double x1,x2;
		cin>>x1>>x2;
		double x11=abs(x1);
		double x22=abs(x2);
		double xx1 = x11*x11;
		double xx2 = x22*x22;
		double ans = sqrt(xx1+xx2);
		v.push_back(ans);
	}
	for(int i=0;i<v.size();i++){
		if(v[i]<=d)
		cnt++;
		//cout<<v[i]<<" ";
	}
	cout<<cnt<<endl;
}

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


int main() {
	
	int N, M;
	cin >> N >> M;
	vector<pair<int,int>> a(N);
	vector<pair<int,int>> c(M);
	
	for(auto &i : a) cin >> i.first >> i.second;
	for(auto &j : c) cin >> j.first >> j.second;
	
	for(auto i : a){
		int k;
		int64_t l = pow(10,8)*4;
		int o = 1;
		for(auto j : c){
			if (abs(i.first-j.first)+abs(i.second-j.second) < l){
				l = abs(i.first-j.first)+abs(i.second-j.second);
				k = o;
			}
			o++;
		}
		cout << k << endl;
	}
	
	
	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(void)

{
  int a , b , c , d;

  scanf("%d %d %d %d",&a,&b,&c,&d);
  if(a * b >= c * d){
  printf("%d\n",a*b);
  } else {
   printf("%d\n",c*d);
  }
  return 0;
}

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

using namespace std;
#define ll long long
#define ld long double
#define INF 0x3f3f3f3f
const int N=2e5 + 5;
const ll mod = 1e9 + 7;

int main()
{
    ios_base::sync_with_stdio(0),cin.tie(NULL),cout.tie(NULL);
    ll x;
    cin >> x;
    for(int i=-1000;i<=1000;i++) {
        for(int j=-1000;j<=1000;j++) {
            ll a = (ll)pow(i, 5);
            ll b = (ll)pow(j, 5);
            if(a - b == x) {
                cout << i << " " << j << endl;
                return 0;
            }
        }
    }
    return 0;
}


Measured memory_bytes: 4112
@n = gets.chomp.to_i
@numbers = gets.chomp.split(' ').map(&:to_i)
@output = 'No'

@bit_array = []

@digit = @numbers.max.to_s(2).size

@numbers.each do |v|
  bit = v.to_s(2)
  bit_size = bit.size
  offset = @digit - bit_size
  new_bit_str = "0" * offset + bit
  @bit_array << new_bit_str
end

# @return Bool
def ok_array?(a)
  return true if a.uniq == ["0"]
  return true if (a.select{|k| k == "0"}.size*2) == (a.select{|k| k == "1"}.size*1)
  return false
end

@flag_array = []

def check(a)
  1.upto(@digit) do |d|
    target_digit_arr = @bit_array.collect{|b| b[d-1]}
    @flag_array << ok_array?(target_digit_arr)
  end
end
check(@bit_array)

if @flag_array.uniq == [true]
  print 'Yes'
else
  print 'No'
end

Measured memory_bytes: 47492
import java.io.IOException;
import java.io.InputStream;
import java.util.*;

public class Main {
	public static void main(String[] args) {
		FastScanner sc = new FastScanner();
		long n = sc.nextLong();
		long sum;
		if (n == 2) {
			sum = 1; // n
		} else {
			sum = 2; // n, n-1
		}
		for (long i = 2; i <= Math.sqrt(n); i++) {
			if (n % i == 0) {
				long m = n;
				while (m % i == 0) {
					m /= i;
				}
				if ((m - 1) % i == 0) {
					sum++;
				}
				long l = n;
				long j = n / i;
				if (i == j) {
					break;
				}
				while (l % j == 0) {
					l /= j;
				}
				if ((l - 1) % j == 0) {
					sum++;
				}
			}
		}
		for (int i = 2; i <= Math.sqrt(n - 1); i++) {
			if ((n - 1) % i == 0) {
				if (i == Math.sqrt(n - 1)) {
					sum++;
				} else {
					sum += 2;
				}
			}
		}
		System.out.println(sum);
	}
}

class FastScanner {
	private final InputStream in = System.in;
	private final byte[] buffer = new byte[1024];
	private int ptr = 0;
	private int buflen = 0;
	private boolean hasNextByte() {
		if (ptr < buflen) {
			return true;
		} else {
			ptr = 0;
			try {
				buflen = in.read(buffer);
			} catch (IOException e) {
				e.printStackTrace();
			}
			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;
	}
	public boolean hasNext() {
		while (hasNextByte() && !isPrintableChar(buffer[ptr])) {
			ptr++;
		}
		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() {
		long nl = nextLong();
		if (nl < Integer.MIN_VALUE || Integer.MAX_VALUE < nl) {
			throw new NumberFormatException();
		}
		return (int) nl;
	}
	public double nextDouble() {
		return Double.parseDouble(next());
	}
}

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

#define Nil -1

struct Node {
  int left;
  int right;
};

void preorder(Node nodes[], int id) {
  if (id == Nil) return;
  cout << " " << id;
  preorder(nodes, nodes[id].left);
  preorder(nodes, nodes[id].right);
}

void inorder(Node nodes[], int id) {
  if (id == Nil) return;
  inorder(nodes, nodes[id].left);
  cout << " " << id;
  inorder(nodes, nodes[id].right);
}

void postorder(Node nodes[], int id) {
  if (id == Nil) return;
  postorder(nodes, nodes[id].left);
  postorder(nodes, nodes[id].right);
  cout << " " << id;
}

int main() {
  int N;
  cin >> N;
  Node nodes[N];
  bool isChild[N];

  for (int i = 0; i < N; i++) {
    isChild[i] = false;
  }

  for (int i = 0; i < N; i++) {
    int id;
    cin >> id;
    cin >> nodes[id].left >> nodes[id].right;
    isChild[nodes[id].left] = true;
    isChild[nodes[id].right] = true;
  }

  int root;
  for (int i = 0; i < N; i++) {
    if (isChild[i] == false) {
      root = i;
      break;
    }
  }

  cout << "Preorder" << endl;
  preorder(nodes, root);
  cout << endl;
  cout << "Inorder" << endl;
  inorder(nodes, root);
  cout << endl;
  cout << "Postorder" << endl;
  postorder(nodes, root);
  cout << endl;
}


Measured memory_bytes: 3088