akhauriyash/Code-Regression huggingface dataset:
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		final int M = 2019;
		long l = sc.nextLong();
		long r = sc.nextLong();
		long lm = l % M;
		long rm = r % M;

		if (lm >= rm || r - l >= M - 1) {
			System.out.println(0);
			return;
		}

		long answer = 2018;
		for (long i = lm; i < rm; i++) {
			for (long j = i + 1; j <= rm; j++) {
				answer = Math.min(answer, (i * j) % M);
			}
		}
		System.out.println(answer);
	}
}


Measured memory_bytes: 21844
using System;
using System.Linq;

class Program
{
    static double T = 0.0;

    static void Main(string[] args)
    {
	//N
	var input = Console.ReadLine();
	int n = int.Parse(input);
	//T A
	input = Console.ReadLine();
	var inputs = input.Split();
	int t = int.Parse(inputs[0]);
	int a = int.Parse(inputs[1]);
	double tempA = (double)a;
	T = (double)t;
	// Hn
	input = Console.ReadLine();
	inputs = input.Split();
	var hs = inputs.Select(x => int.Parse(x));
	//結果の計算
	int res = 1;
	double tempRes = temperature(hs.First());
	int count = 0;
	foreach (var h in hs) {
	    count++;
	    double tempH = temperature((double)h);
	    if (Math.Abs(tempA - tempH) < Math.Abs(tempA - tempRes)) {
		tempRes = tempH;
		res = count;
	    }
	}
	//結果を出力
	Console.WriteLine($"{res}");
    }

    static double temperature(double x) {
	return T - (x * 0.006);
    }
}


Measured memory_bytes: 13340
#include<stdio.h>

int main() {
    
    int x, y, r, temp;
    
    scanf("%d %d", &x, &y);
    
    if (x < y){
        temp = x;
        x = y;
        y = temp;
    }
    
    while (y > 0){
        r = x % y;
        x = y;
        y = r;
    }
    printf("%d\n", x);
}

Measured memory_bytes: 1812
N=int(input())
A=list(map(int, input().split()))
for i in range(N):
  if(A[i]%2==0):
    if((A[i]%3!=0)and(A[i]%5!=0)):
      print('DENIED')
      break
  if(i==N-1):
    print('APPROVED')

Measured memory_bytes: 38384
#include <iostream>
#include <algorithm>
#include <vector>
#include <map>
#include <unordered_map>
#include <queue>
#include <utility>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;

ll mod = 1e9+7;

int main(){
    int n;
    cin >> n;
    int ans = 0;
    for (int i=1;i<=n;i++){
        if (to_string(i).length()%2!=0){
            ans++;
        }
    }
    cout << ans << endl;
}    

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

int main() {
	int h, w, K;
	cin >> h >> w >> K;

	string str;
	vector<vector<int>> a(h, vector<int> (w, 0));
	
	for (int i = 0; i < h; i++)
	{
		cin >> str;
		for (int j = 0; j < w; j++)
		{
			if (str[j] == '#')
			{
				a[i][j] = 1;
			}
		}
	}

	int ans = 0;
	
	for (int i = 0; i < (1<<h); i++)
	{
		for (int j = 0; j < (1<<w); j++)
		{
			int cnt = 0;
			for (int k = 0; k < h; k++)
			{
				if (i & (1 << k)) continue;
				for (int l = 0; l < w; l++)
				{
					if (j & (1 << l)) continue;
					if (a[k][l] == 1)cnt++;
				}
			}
			if (cnt == K) ans++;
		}
	}

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 3564
import java.io.BufferedReader;
import java.io.InputStreamReader;

public class Main
{

  public static void main
  (
    String[] args
  )
  {
    BufferedReader in_stream;
    String         in_str;
    String[]       in_str_split;

    int    a;
    int    b;
    double sum;

    try
    {

      in_stream    = new BufferedReader(new InputStreamReader(System.in));
      in_str       = new String(in_stream.readLine());
      in_str_split = in_str.split(" ");


      a = Integer.parseInt(in_str_split[0]);
      b = Integer.parseInt(in_str_split[1]);

      sum = (double)(a + b) / 2;
      sum = Math.ceil(sum);
      UtilLog.ans_ln("" + (int)(sum) );
    }
    catch(Exception e)
    {
      e.printStackTrace();
    }
  }
}

class UtilLog
{
  private static boolean is_debug_mode = false;



  public static void ans_ln
  (
    String i_message
  )
  {
    System.out.println(i_message);
  }



  public static void ans_f
  (
    String i_message
  )
  {
    System.out.printf(i_message);
  }



  public static void inf_ln
  (
    String i_message
  )
  {
    StackTraceElement[] stack;


    if(is_debug_mode)
    {
    stack = new Throwable().getStackTrace();

    System.out.println
      (
        String.format
          (
            "[inf][%s:%s():%5d]",
            stack[1].getClassName(),
            stack[1].getMethodName(),
            stack[1].getLineNumber(),
            i_message
          )
      );
    }
  }
}


Measured memory_bytes: 21204
#include <iostream>
#include <string>
#include <math.h>
#include <iomanip>
#include <stdio.h>
#include <algorithm>
#include <ctime>
#include <vector>
#include <set>
#include <queue>
using namespace std;

#define PI 3.14159265358979323846264338327950L

int res;

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

    int A, B, C, X;
    cin >> A >> B >> C >> X;
    res = 0;
    for (int i = 0; i <= A; ++i)
    {
        for (int j = 0; j <= B; ++j)
        {
            for (int k = 0; k <= C; ++k)
            {
                int tmp = i * 500 + j * 100 + k * 50;
                if (tmp == X)
                    res++;
            }
        }
    }
    cout << res << endl;
    return 0;
}

Measured memory_bytes: 256
//#include <bits/stdc++.h>
#include <iostream>
#include <complex>
#include <sstream>
#include <string>
#include <algorithm>
#include <deque>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <vector>
#include <set>
#include <limits>
#include <cstdio>
#include <cctype>
#include <cmath>
#include <cstring>
#include <cstdlib>
#include <ctime>
#include <climits>
#define REP(i, n) for(int i = 0; i < (int)(n); i++)
#define FOR(i, j, k) for(int i = (int)(j); i < (int)(k); ++i)
#define ROF(i, j, k) for(int i = (int)(j); i >= (int)(k); --i)
#define FORLL(i, n, m) for(long long i = n; i < (long long)(m); i++)
#define SORT(v, n) sort(v, v+n)
#define REVERSE(v) reverse((v).begin(), (v).end())

using namespace std;
using ll = long long;
const ll MOD=1000000007LL;
typedef pair<int, int> P;

ll ADD(ll x, ll y) { return (x+y) % MOD; }
ll SUB(ll x, ll y) { return (x-y+MOD) % MOD; }
ll MUL(ll x, ll y) { return x*y % MOD; }
ll POW(ll x, ll e) { ll v=1; for(; e; x=MUL(x,x), e>>=1) if (e&1) v = MUL(v,x); return v; }
ll DIV(ll x, ll y) { /*assert(y%MOD!=0);*/ return MUL(x, POW(y, MOD-2)); }


int
main(void){  
  int n;
  cin >> n;
  int a[n];
  double sum = 0LL;
  //ll ans = 1e9+7;

  REP(i, n) {
    cin >> a[i];
    sum += a[i];    
  }

  int mean  = ceil(sum/n);
  int mean2 = floor(sum/n);

  ll ans = 0LL;
  ll ans2 = 0LL;
  //if(mean < 0 && sum/n < mean){    
  //  mean--;
  //}   
      
  REP(i, n){
    ans  += (a[i]-mean)*(a[i]-mean);
    ans2 += (a[i]-mean2)*(a[i]-mean2);
  }

  cout << min(ans, ans2) << endl;
  
  
  /*
  FOR(i, -100, 101){
    ll temp = 0LL;
    REP(j, n){
      temp += (i - a[j])*(i - a[j]);
    }
    ans = min(ans, temp);
  }
  cout << ans << endl;

  */
  
  return 0;
}


Measured memory_bytes: 256
import fractions

def lcm(a, b):
    return a * b // fractions.gcd(a, b)

N = int(input())
A = [int(i) for i in input().split()]
mod = 10**9+7
ll = A[0]
for i in A:
    ll = lcm(ll, i)
ans = 0
for i in A:
    ans += ll // i
print(int(ans%mod))


Measured memory_bytes: 6200
#include <iostream>
#include <vector>
#include <climits>
#include <algorithm>
#include <cmath>
#include <map>
#include <set>
#include <string>
#include <bitset>
#include <utility>
#include <numeric>
#include <queue>
#include <stack>

using ll = long long;
using namespace std;

constexpr int MOD = 1e9 + 7;
constexpr ll MOD_LL = ll(1e9) + 7;

int main(void) {
	int n;
	string s;
	cin >> n >> s;
	
	map<char, ll> mp;
	for(int i = 0; i < n; ++i) {
		mp[s[i]]++;
	}
	
	ll ans = mp['R'] * mp['G'] * mp['B'];
	
	for(int i = 0; i < n; ++i) {
		for(int j = 1; j <= n; ++j) {
			int y = i + j;
			int z = i + 2 * j;
			
			if( z < n && s[i] != s[y] && s[y] != s[z] && s[i] != s[z] ) {
				ans--;
			}
		}
	}
	
	cout << ans << endl;
	
	return 0;
}


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

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

long lcm(long a, long b)
{
   return a * b / gcd(a, b);
}

int main()
{
  long a, b;
  cin >> a >> b;
  cout << lcm(a, b) << endl;
  return 0;
}

Measured memory_bytes: 256
import std.stdio;
import std.string;
import std.conv;

void main(){
auto a = readln.chomp.to!int;
auto b = a % 10;
auto c = a / 10 % 10;
auto d = a / 100 % 10;
auto e = a /1000 % 10;
writeln(b==c&&c==d||c==d&&d==e ? "Yes":"No");
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
using namespace std;
int main(void){

int n;
long w;  
long we[100010];
long v[110];

cin >> n >> w;

for(int i = 0; i < n; i++) cin >> we[i] >> v[i];

long long dp[110][100010] = {0};

for(int i = 0; i < n; ++i){
        for(int j = 0; j <= w; ++j){
                if(j - we[i] >= 0){
                        dp[i + 1][j] = max(dp[i + 1][j],dp[i][j - we[i]] + v[i]);
                        }
                
                dp[i + 1][j] = max(dp[i + 1][j], dp[i][j]);
                }
    }
cout << dp[n][w] << "\n";
}

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

int main()
{
  vector<int> a(3);
  cin >> a[0] >> a[1] >> a[2];

  sort(a.begin(), a.end());

  cout << a[0] + a[1] << endl;

  return 0;

}



Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, start, end) for (long long i = start; i < end; ++i)
#define repreverse(i, start, end) for (long long i = start; i >= end; --i)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define len(x) ((long long)(x).size())
#define lcm(a, b) ((a) / __gcd((a), (b)) * (b))
using namespace std;
using ll = long long;
using ld = long double;
using vll = vector<ll>;
using vllvll = vector<vll>;
using pll = pair<ll, ll>;
template<class T>void print1d(T x,ll n=-1){if(n==-1)n=x.size();rep(i,0,n){cout<<x[i]<<' ';}cout<<'\n';}
template<class T>void print2d(T x,ll r=-1,ll c=-1){if(r==-1)r=x.size();if(c==-1)c=x[0].size();rep(i,0,r)print1d(x[i],c);}
template<class T, class U>bool haskey(T mp, U key) { return mp.find(key) != mp.end(); }
template<class T, class U>bool isin(T el, U container) { return find(all(container), el) != container.end(); }
template<class T>bool chmax(T& a, const T& b) { if (a < b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T& a, const T& b) { if (b < a) { a = b; return 1; } return 0; }
template<class T>bool even(T n) { return ! (n & 1); }
template<class T>bool odd(T n) { return n & 1; }
template<class T>ld deg2rad(T deg) { return M_PI * deg / 180.0; }
template<class T>ld rad2deg(T rad) { return 180.0 * rad / M_PI; }
ll intpow(ll a,ll n){ll p=1;while(n){if(n&1)p*=a;a*=a;n>>=1;}return p;}
const long double pi = M_PI;
const long long big = 1LL << 50;
const long long inf = 1LL << 60;
const long long mod = 1e9 + 7;



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

        rep(i, A, B+1) {
                ll l = i - A + 1;
                ll r = B - i + 1;
                if ((1 <= l and l <= K) or (1 <= r and r <= K)) {
                        cout << i << endl;
                }
        }
}

Measured memory_bytes: 3616
import itertools
import sys

[a,b,c] = [int(x) for x in input().split()]
[d,e,f] = [int(x) for x in input().split()]
[g,h,i] = [int(x) for x in input().split()]
N = int(input())
num_list = []
for j in range(N):
  n = int(input())
  num_list.append(n)

set_list = [{a,b,c},{d,e,f},{g,h,i},{a,d,g},{b,e,h},{c,f,i},{a,e,i},{c,e,g}]
the_set = set(num_list) & set([a,b,c,d,e,f,g,h,i])

v = itertools.permutations(the_set,3)
for k in v:
  if set(k) in set_list:
    print('Yes')
    sys.exit()
print('No')


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


int main(){


    long long r, g, b, n, i, j;

    long long k = 0;

 
    cin >> r >> g >> b >> n;


    for( i = 0 ; i * r < n + 1 ; i = i + 1 ){

         for( j = 0 ; i * r + j * g < n + 1 ; j = j + 1 ){

              if( ( n - i * r - j * g ) % b == 0 ) k += 1;

              }

         }


    cout << k << endl;


    return 0;


    }

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

void solve(){
    string n;
    cin >> n;
    bool f = false;
    for(int i=0; i < 3; i++){
        if(n[i] == '7'){
            f = true;
        }
    }
    if(f){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
}

int main(){
    solve();
}

Measured memory_bytes: 3596
#include <stdio.h>
#include <string.h>

const int dir[4][2]={{0,1},{0,-1},{-1,0},{1,0}};

int syoukyo(int banmen[5][5],int scorelist[5]) {
	int score=0;
	int kesuflag[5][5]={0};
	int kietaflag=0;
	int i,j,k;
	for(i=0;i<5;i++) {
		for(j=0;j<3;j++) {
			if(banmen[i][j]==banmen[i][j+1] && banmen[i][j+1]==banmen[i][j+2]) {
				kesuflag[i][j]=kesuflag[i][j+1]=kesuflag[i][j+2]=1;
			}
		}
	}
	for(i=0;i<3;i++) {
		for(j=0;j<5;j++) {
			if(banmen[i][j]==banmen[i+1][j] && banmen[i+1][j]==banmen[i+2][j]) {
				kesuflag[i][j]=kesuflag[i+1][j]=kesuflag[i+2][j]=1;
			}
		}
	}
	for(i=0;i<5;i++) {
		for(j=0;j<5;j++) {
			if(kesuflag[i][j] && banmen[i][j]>0) {
				score+=scorelist[banmen[i][j]-1];
				banmen[i][j]=0;
				kietaflag=1;
			}
		}
	}
	for(i=3;i>=0;i--) {
		for(j=0;j<5;j++) {
			if(banmen[i+1][j]==0) {
				for(k=i+1;k<5 && banmen[k][j]==0;k++);
				banmen[k-1][j]=banmen[i][j];
				banmen[i][j]=0;
			}
		}
	}
	return kietaflag?score:-1;
}

int getscore(int banmen[5][5],int scorelist[5]) {
	int bonus;
	int scoresum=0;
	int nowscore;
	for(bonus=1;(nowscore=syoukyo(banmen,scorelist))>=0;bonus++) {
		scoresum+=nowscore*bonus;
	}
	return scoresum;
}

int main(void) {
	int n;
	int banmen[5][5];
	int banmen2[5][5];
	int scorelist[5];
	int i,j,x,y,idounum;
	int maxscore,nowscore;
	while(scanf("%d",&n)==1 && n>=0) {
		for(i=0;i<5;i++) {
			for(j=0;j<5;j++)scanf("%d",&banmen[i][j]);
		}
		for(i=0;i<5;i++)scanf("%d",&scorelist[i]);
		memcpy(banmen2,banmen,sizeof(banmen));
		maxscore=getscore(banmen2,scorelist);
		for(idounum=1;idounum<=n;idounum++) {
			for(i=0;i<1<<(idounum*2);i++) {
				for(y=0;y<5;y++) {
					for(x=0;x<5;x++) {
						int nx=x,ny=y;
						int error=0;
						memcpy(banmen2,banmen,sizeof(banmen));
						for(j=0;j<idounum;j++) {
							int mid=(i>>(j*2))&3;
							int temp;
							if(nx+dir[mid][0]<0 || nx+dir[mid][0]>=5 ||
								ny+dir[mid][1]<0 || ny+dir[mid][1]>=5){error=1;break;}
							temp=banmen2[ny][nx];
							banmen2[ny][nx]=banmen2[ny+dir[mid][1]][nx+dir[mid][0]];
							banmen2[ny+dir[mid][1]][nx+dir[mid][0]]=temp;
							nx+=dir[mid][0];
							ny+=dir[mid][1];
						}
						if(error)continue;
						nowscore=getscore(banmen2,scorelist);
						if(nowscore>maxscore)maxscore=nowscore;
					}
				}
			}
		}
		printf("%d\n",maxscore);
	}
	return 0;
}

Measured memory_bytes: 600
#include <iostream>

using namespace std;

int main(void)
{
    int atob, btoc, ctoa;

    cin >> atob >> btoc >> ctoa;

    int least = atob + btoc + ctoa;
    int sum = 0;

    if(least > atob + btoc){
        least = atob + btoc;
    }
    if(least > btoc + ctoa){
        least = btoc + ctoa;
    }
    if(least > ctoa + atob){
        least = ctoa + atob;
    }

    cout << least << endl;


    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define For(i,j,k) for(int i=j;i<=k;++i)
#define Forr(i,j,k) for(int i=j;i>=k;--i)
#define getchar getchar_unlocked
#define ll long long 
using namespace std;
const int N=10010,INF=0x3f3f3f3f;
template<class T>void read(T &x){
	x=0;register char c=getchar();
	while(!isdigit(c))c=getchar();
	while( isdigit(c))x=x*10+c-48,c=getchar();
}
int n,X[N<<1],Lim,id[N<<1],sz[N<<2],m,Low,K;
vector<int>G[N<<2];
inline void add(int x,int y){G[y].push_back(x);}
inline void Add(int x,int y){add(x,y),add(y,x);}
inline void link(int x,int y){
	Add(x*2+1,y*2),Add(y*2+1,x*2);
}
inline void Link(int x,int y){
	add(x*2+1,y*2),add(y*2+1,x*2);
}
inline bool cmp(int a,int b){return X[a]<X[b];}
int pre[N<<2],sccno[N<<2],scc[N<<2],scc_cnt,low[N<<2],dfs_cnt;
stack<int>s;
void dfs(int u){
	low[u]=pre[u]=++dfs_cnt;
	sccno[u]=1;s.push(u);
	int S=G[u].size();
	For(i,0,S-1){
		int v=G[u][i];
		if(!pre[v])dfs(v),low[u]=min(low[u],low[v]);
		else if(sccno[v])low[u]=min(low[u],pre[v]);
	}
	if(pre[u]==low[u]){
		++scc_cnt;
		int w;
		do{
			w=s.top();s.pop();
			scc[w]=scc_cnt;sccno[w]=0;
		}while(w!=u);
	}
}
bool check(int dis){
	For(i,0,m)G[i].resize(sz[i]);
	For(i,0,K){
		For(j,max(i-9,0),min(i+9,K)){
			if(j==i)continue;
			if(abs(X[id[j]]-X[id[i]])>=dis)continue;
			if(abs(id[i]-id[j])==n)continue;
			Link(id[i],id[j]);
		}
	}
	dfs_cnt=0;scc_cnt=0;
	For(i,0,m)pre[i]=0,scc[i]=0;
	For(i,0,m)if(!pre[i])dfs(i);
	For(i,0,K)if(scc[i*2]==scc[i*2+1])return 0;
	return 1;
}
inline bool Check(int dis){
	int cnt=0,last=-INF;
	For(i,0,K){
		if(X[id[i]]-last>=dis)cnt++,last=X[id[i]];
		if(cnt==n)break;
	}
	return cnt==n;
}
void solveLim(){
	int L=0,R=Lim,ans=0;
	while(L<=R){
		int Mid=(L+R)>>1;
		if(Check(Mid))ans=Mid,L=Mid+1;
		else R=Mid-1;
	}
	Lim=ans;
}
int main(){
	read(n);Low=INF;
	For(i,0,n-1){
		read(X[i]),read(X[i+n]);
		link(i,i+n);
		Lim=max(Lim,max(X[i],X[i+n]));
		if(i)Low=min(Low,X[i]-X[i-1]);
	}
	m=4*n-1;K=2*n-1;
	For(i,0,K)id[i]=i;
	For(i,0,m)sz[i]=G[i].size();
	sort(id,id+K+1,cmp);
	solveLim();
	int L=Low,R=Lim,ans=0;
	while(L<=R){
		int Mid=(L+R)>>1;
		if(check(Mid))L=Mid+1,ans=Mid;
		else R=Mid-1;
	}
	printf("%d\n",ans);
	return 0;
}


Measured memory_bytes: 6016
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rrep(i, n) for (int i = (int)(n - 1); i >= 0; i--)
#define all(x) (x).begin(), (x).end()
#define sz(x) int(x.size())
#define get_unique(x) x.erase(unique(all(x)), x.end());
typedef long long ll;
typedef complex<double> Complex;
const int INF = 1e9;
const ll MOD = 1e9 + 7;
const ll LINF = 1e18;
template <class T>
bool chmax(T& a, const T& b) {
    if (a < b) {
        a = b;
        return 1;
    }
    return 0;
}
template <class T>
bool chmin(T& a, const T& b) {
    if (b < a) {
        a = b;
        return 1;
    }
    return 0;
}
template <class T>
vector<T> make_vec(size_t a) {
    return vector<T>(a);
}
template <class T, class... Ts>
auto make_vec(size_t a, Ts... ts) {
    return vector<decltype(make_vec<T>(ts...))>(a, make_vec<T>(ts...));
}
int main() {
    int n, k;
    cin >> n >> k;
    vector<ll> a(n);
    rep(i, n) cin >> a[i];
    vector<ll> b(n);
    ll ans = LINF;
    rep(bit, 1 << n) {
        if (__builtin_popcount(bit) < k) continue;
        ll now = 0;
        ll MAX = -1;
        rep(i, n) b[i] = a[i];
        rep(i, n) {
            if (bit & (1 << i)) {
                if (MAX >= b[i]) {
                    now += (MAX + 1 - b[i]);
                    b[i] = MAX + 1;
                }
            }
            chmax(MAX, b[i]);
        }
        chmin(ans, now);
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define FOR(i, j, k) for(int i=j; i<=k; i++)
#define FFOR(i, j, k) for(int i=j; i<k; i++)
#define DFOR(i, j, k) for(int i=j; i>=k; i--)
#define bug(x) cerr<<#x<<" = "<<x<<'\n'
#define pb push_back
#define mp make_pair
typedef long long ll;
typedef long double ld;
template <typename T> inline void read(T &x){
    char c;
    bool nega=0;
    while((!isdigit(c=getchar()))&&(c!='-'));
    if(c=='-'){
        nega=1;
        c=getchar();
    }
    x=c-48;
    while(isdigit(c=getchar())) x=x*10+c-48;
    if(nega) x=-x;
}
template <typename T> inline void writep(T x){
    if(x>9) writep(x/10);
    putchar(x%10+48);
}
template <typename T> inline void write(T x){
    if(x<0){
        putchar('-');
        x=-x;
    }
    writep(x);
}
template <typename T> inline void writeln(T x){
    write(x);
    putchar('\n');
}
#define taskname "D"
ll n, s;
ll f(ll b, ll n){
    if(b>n) return n;
    return f(b, n/b)+n%b;
}
vector <pair <ll, int> > v;
void fact(ll x){
    ll i=2;
    while(i*i<=x){
        if(x%i==0) v.pb(mp(i, 0));
        while(x%i==0){
            x/=i;
            v.back().second++;
        }
        i++;
    }
    if(x>1) v.pb(mp(x, 1));
}
ll ans=1LL<<50;
void check(ll x){
    if(f(x+1, n)==s) ans=min(ans, x+1);
}
void backtrack(ll x, int u, int d){
    if(u==v.size()) check(x);
    else{
        backtrack(x, u+1, 0);
        if(d<v[u].second) backtrack(x*v[u].first, u, d+1);
    }
}
int main(){
    #ifdef Megumin
        if(fopen(taskname".inp", "r"))
            freopen(taskname".inp", "r", stdin);
    #endif // Megumin
    read(n);
    read(s);
    ll i=2;
    while(i*i<=n){
        if(f(i, n)==s){
            write(i);
            return 0;
        }
        i++;
    }
    /** if now there is an i then:
        n=x*i+y
        x+y=s
        => x*i+s-x=n
        =>x*(i-1)=n-s.
        =>i-1|n-s.
        with n=s, x=0 or i=1(fail). to have x=0, i>n
    */
    if(n<s){
        write(-1);
        return 0;
    }
    if(n==s){
        write(n+1);
        return 0;
    }
    fact(n-s);
    backtrack(1LL, 0, 0);
    if(ans==1LL<<50) write(-1);
    else write(ans);
}

Measured memory_bytes: 384
#pragma region
#include <bits/stdc++.h>
using namespace std;
inline void ci(void){
  return;
}
template <typename First, typename... Rest>
void ci(First& first, Rest&... rest){
  cin >> first;
  ci(rest...);
  return;
}
inline void co(void){
  cout << "\n";
  return;
}
template <typename First, typename... Rest>
void co(First first, Rest... rest){
  cout << first << " ";
  co(rest...);
  return;
}
#define ll long long
#define ld long double
#define st string
#define dl double
#define wh while
#define mp make_pair
#define mt make_tuple
#define pb push_back
#define tp tuple
#define ft first
#define sc second
#define ve vector
#define tos to_string
#define len length
#define rt return 0
#define br break
#define con continue
#define lcm(n, m) (n * m / gcd(n, m))
#define np next_permutation
#define repi(i, m, n) for(int i=(int)(m);i<(int)(n);i++)
#define rep(i, n) repi(i, 0, n)
#define repill(i, m, n) for(ll i=(ll)(m);i<(ll)(n);i++)
#define repll(i, n) repill(i, 0, n)
#define revi(i, m, n) for(int i=(int)(m);i>(int)(n);i--)
#define rev(i, m) revi(i, m, 0)
#define revill(i, m, n) for(ll i=(ll)(m);i>(ll)(n);i--)
#define revll(i, n) revill(i, 0, n)
#define sz(v) ((int)(v).size()) 
#define each(i, n) for(auto&& i: n)
#define all(n) (n.begin(), n.end())
#define allr(n) (n.rbegin(), n.rend())
#define sp(n) cout << fixed << setprecision(n)
#pragma endregion
// sqrt ルート, int 2*10^9, gcd　最大公約数
// __builtin_popcount bitの個数

int main() {
  int N, M;
  ci(N);
  ve<int> T(N);
  int a = 0;
  rep(i, N){
    ci(T.at(i));
    a += T.at(i);
  }
  ci(M);
  ve<int> P(M), X(M);
  rep(i, M){
    ci(P.at(i), X.at(i));
  }
  rep(i, M){
    co(a + X.at(i) - T.at(P.at(i) - 1));
  }
}

Measured memory_bytes: 256
import java.io.PrintWriter
val pw = PrintWriter(System.out)
fun main(args: Array<String>) {
    func()
    pw.flush()
}
fun println(value: Any) { pw.println(value) }

fun func() {
    val (w, h, x, y) = listOfDouble()
    val d = w * h / 2
    val s = if (w == x * 2 && h == y * 2) 1 else 0

    println("${d} ${s}")
}

fun next() = readLine()!!
fun listOfString() = next().split(" ")
fun listOfDouble() = listOfString().map { it.toDouble() }


Measured memory_bytes: 35980
import sys
N = int(sys.stdin.readline())
A = [int(sys.stdin.readline()) for _ in range(N)]
ans = 0
for i in range(1, N):
    ans += (A[i - 1] + A[i]) >> 1
    if A[i]:
        A[i] = (A[i - 1] + A[i]) & 1
print(A[0] >> 1 if N == 1 else ans)

Measured memory_bytes: 44252
#include <bits/stdc++.h>
#define LL long long
#define Accel ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
#define Re(a,b) memset(a,b,sizeof a)
#define F first
#define S second
#define MP make_pair
#define PB push_back
#define ALL(X) (X).begin(), (X).end()
#define FOR(I, A, B) for (int I = (A); I <= (B); I++)
#define REP(I, N) for (int I = 0; I < (N); I++)
#define PII pair<int,int>
#define PLL pair<LL,LL>
#define SZ(a) ((int)a.size())
#define endl "\n"
//#pragma GCC optimize(2)
using namespace std;
const int N=1e6+1;
const int M=1e9+7;
const double eps=1e-6;
typedef complex<double>C;
const double PI(acos(-1.0));
//__gcd, atan2(y,x)=y/x , __int128
//c(n,k)=c(n-1,k-1)+c(n-1,k)
//c(i,r),i for r to n =c(n+1,r+1)
//void add(int x){while(x<N)BIT[x]++,x+=x&-x;}
//int sum(int x){return x?BIT[x]+sum(x-(x&-x)):0;}
//int find(int x){return x==p[x]?x:p[x]=find(p[x]);}
//LL pw(LL a, LL b,LL M) { return b ? b & 1 ? a*pw(a, b - 1,M) % M : pw(a*a%M, b>>1,M) : 1; }
//log() = ln() , log(x)/log(y)=log(y)-base-x
//INT_MAX 127,INT_MIN 128
//int dw[4][2]={{0,1},{1,0},{0,-1},{-1,0}};
//int dw[8][2]={{0,1},{1,0},{0,-1},{-1,0},{1,1},{1,-1},{-1,1},{-1,-1}};
int main(){Accel
	int n;
	LL a,k;
	cin>>n;
	int t=0;
	REP(i,n){
		cin>>a>>k;
		while(1){
			if(a<k)break;
			else if(a%k==0){
				t^=a/k;
				break;
			}
			else{
				LL div=a/k+1,mod=a%k;
				if(mod%div)
					a-=div*(mod/div+1);
				else a-=div*(mod/div);
			}
		}
	}
	if(t)cout<<"Takahashi"<<endl;
	else cout<<"Aoki"<<endl;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
typedef pair<ll, ll>P;
#define PI 3.14159265359
#define MOD 1000000007
const int MAX = 510000;

int main(){
  string S;cin>>S;
  int N=S.size();
  ll K;cin>>K;
  ll cho=5ll*1e15;
  rep(i,N){
  	if(i==K-1ll){cout<<S[i];break;}
  	if(S[i]!='1'){cout<<S[i];break;}
  }
  
}

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

#define rep(i, n) for (ll i = 0; i < (n); i++)
#define rep2(i, a, b) for (ll i = (a); i < (b); i++)
typedef uint64_t ull;
typedef int64_t ll;
typedef std::pair<ll, ll> PLL;

using namespace std;

// dp[i][t] 先頭からi個目までの料理を見て、すべてを食べ終わった時間がtのときの、満足度の最大値
ll dp[3100][3100];

// dp[i][t] 終端からi個目までの料理を見て、すべてを食べ終わった時間がtのときの、満足度の最大値
ll dp2[3100][3100];

signed main() {
  ll N, T;
  cin >> N >> T;
  vector<PLL> v(N+1); // {時間、おいしさ}
  for (ll i=1; i<=N; i++) {
    cin >> v[i].first >> v[i].second;
  }

  for (ll i=1; i<=N; i++) {
    for (ll t=0; t<T; t++) {
      ll nt = t + v[i].first;
      ll nd = dp[i-1][t] + v[i].second;
      dp[i][t] = max(dp[i][t], dp[i-1][t]);
      if (nt <= T)
        dp[i][nt] = max(dp[i][nt], nd);
    }
  }

  for (ll i=N; i>=1; i--) {
    for (ll t=0; t<T; t++) {
      ll nt = t + v[i].first;
      ll nd = dp2[i+1][t] + v[i].second;
      dp2[i][t] = max(dp2[i][t], dp2[i+1][t]);
      if (nt <= T)
        dp2[i][nt] = max(dp2[i][nt], nd);
    }
  }
  ll ans = 0;
  for (ll i=1; i<=N; i++) {
    ll p = 0;
    for (ll t1 = 0; t1 <= T-1; t1++) {
      ll t2 = T-1-t1;
      // printf("%d %d %d\n", i, t1, t2);
      p = max(p, dp[i-1][t1] + dp2[i+1][t2]);
    }

    ans = max(ans, p + v[i].second);
  }
  cout << ans << endl;
}


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

using namespace std;

int N, M, K, ans, upMost[200009];
pair < int, int > v[200009];

bool isBlocked (int i, int j)
{
    int pos = lower_bound (v + 1, v + K + 1, make_pair (i, j)) - v;
    if (v[pos].first == i && v[pos].second == j && 1 <= pos && pos <= K) return 1;
    return 0;
}

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

scanf ("%d %d %d", &N, &M, &K), ans = N;
for (int i=1; i<=K; i++)
    scanf ("%d %d", &v[i].first, &v[i].second);
sort (v + 1, v + K + 1);
for (int i=1; i<=M; i++)
    upMost[i] = N + 1;
int x = 2, y = 1;
upMost[y] = 1;
while (x < N)
{
    if (y < M && !isBlocked (x, y + 1))
        y ++, upMost[y] = x;
    x ++;
}
for (int i=1; i<=K; i++)
{
    int x = v[i].first, y = v[i].second;
    if (upMost[y] < x)
        ans = min (ans, x - 1);
}
printf ("%d\n", ans);
return 0;
}


Measured memory_bytes: 2560
#include <bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define rep(i,a,b) for(int i = (a);i <= (b);i++)
#define pii pair<int,int>
#define pll pair<long long, long long>
#define fi first
#define se second
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
const ll mod = 1e9 + 7;
const ll INF = 0x3f3f3f3f3f3f3f3f;
const int inf = 0x3f3f3f3f;
const int maxn = 2e5 + 5;
const int maxm = 1e6 + 5;
const double eps = 1e-8;
const double pi = acos(-1.0);
ll gcd(ll a,ll b){return !b?a:gcd(b,a%b);}
ll lcm(ll a,ll b){return a * b / gcd(a,b);}
ll poww(ll x,ll y,ll p){ll ans = 1;while(y){if(y & 1) ans = ans * x % p;x = x * x % p;y >>= 1;}return ans % p;}
bool isp(ll x){if(x < 2) return 0; for(ll i = 2;i * i <= x;i++){if(x % i == 0) return 0;}return 1;}
int n,m,ac,wa;
int rt[maxn],wr[maxn];
int main(){
 	ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
	cin >> n >> m;
	int p = 0; 
	string s = "";
	while(m--){
		cin >> p >> s;
		if(s == "AC") rt[p]++;
		else{
			if(!rt[p]) wr[p]++;
		}
	}
	for(int i = 1;i <= n;i++){
		if(rt[i]){
			ac++;
			wa += wr[i];
		}
	}
	cout << ac << " " << wa << endl;
	return 0;
}
//do smt instead of nothing! never give up!
//take care of long long!
//take care of upper or lower case e.g "yes" or "YES"?
//boundary condition! e.g. n = 0?
//brute force is always the first choice!
// print the ans to look for patterns in the data!

Measured memory_bytes: 1024
import sys
from math import floor, sqrt
from bisect import bisect_left as bi_l

def prime_nums(n):
    sieve = set(range(2, n + 1))
    non_prime = set(range(2 * 2, n + 1, 2))
    sieve -= non_prime
    for i in range(3, floor(sqrt(n)) + 1, 2):
        if i in sieve:
            non_prime = set(range(i * 2, n + 1, i))
            sieve -= non_prime
    return sieve

ps = prime_nums(10 ** 6)
ps = sorted(ps)

x = int(sys.stdin.readline().rstrip())

def main():
    return ps[bi_l(ps, x)]

if __name__ == '__main__':
    ans = main()
    print(ans)

Measured memory_bytes: 131164
#include <bits/stdc++.h>
    #include <cstdio>
    #include <cstring>
    #include <cmath>
    #include <cstring>
    #include <chrono>
    #include <complex>
    #define ll long long int
    #define ld long double
    #define vi vector<int>
    #define vll vector<ll>
    #define vvi vector < vi >
    #define pii pair<int,int>
    #define pll pair<long long, long long>
    #define mod 1000000007
    #define inf 1000000000000000001;
    #define all(c) c.begin(),c.end()
    #define mp(x,y) make_pair(x,y)
    #define mem(a,val) memset(a,val,sizeof(a))
    #define eb emplace_back
    #define pb push_back
    #define f first
    #define s second
    
    using namespace std;
    int main()
    {
        std::ios::sync_with_stdio(false);
        int T;
        T=1;
        // cin.ignore(); must be there when using getline(cin, s)
        while(T--)
        {
            ll n,i,j,ans=1;
            string s;
            cin>>n;
            cin>>s;
            for(i=1;i<n;++i)
            {
                if(s[i]!=s[i-1])
                    ++ans;
            }
            cout<<ans<<endl;
        }
        return 0;
    }


Measured memory_bytes: 512
#include<cstdio>
#include<cmath>
#include<iostream>
#include<algorithm>
using namespace std;
int main(){
    string S;
    cin>>S;
    int flg=1;
    for(int i=0;i<S.size();i++){
        if(i%2==0&&S[i]=='L')flg=0;
        if(i%2==1&&S[i]=='R')flg=0;
    }
    if(flg)cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
    return 0;
}


Measured memory_bytes: 256
import math
import collections
k=int(input())
ans=0
a=[]
for i in range(1,k+1):
    for j in range(1,k+1):
        a.append(math.gcd(i,j))
a=collections.Counter(a)
for key,value in a.items():
    for i in range(1,k+1):
        ans+=math.gcd(i,key)*value
print(ans)

Measured memory_bytes: 9652
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();

		if (a >= 13) {
			System.out.print(b);
		} else if (a >= 6) {
			System.out.print(b / 2);
		} else {
			System.out.print(0);
		}
	}

}

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

int main() {
    int x;
    cin >> x;
    int pos = 0;
    for (int i = 1; i < 1001001001; i++)
    {
        pos += i;

        if (pos - i < x && x <= pos) {
            cout << i << endl;
            return 0;
        }
        
    }
    return 0;
}

Measured memory_bytes: 3608
n = int(input())
A = list(map(int, input().split()))
for i in range(n - 1):
	A[i + 1] += A[i]
minv = float('inf')
for a in A[:-1]:
	minv = min(minv, abs(A[-1]/2 - a))
print(int(minv * 2))

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

int main(){

  int n;
  cin>>n;
  

  if (n==1 or n==2 or n==3 or n==5 or n==6 or n==9 or n==10 or n==13 or n==17){
    cout<<"No"<<endl;
  }
  
  else {
    cout<<"Yes"<<endl;
  }
  
  
  
    
}
  













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

using namespace std;

int table[10001][800];

int main()
{
  int N, M;
  while(cin >> N >> M, N || M){
    memset(table, 0, sizeof(table));
    int r, q;
    cin >> r;
    while(r--){
      int t, n, m, s;
      cin >> t >> n >> m >> s; 
      if(s == 1) table[m][t-540] += 1;
      else table[m][t-540] -= 1;
    }
    for(int i = 1; i <= M; i++){
      for(int j = 1; j < 800; j++) table[i][j] += table[i][j-1];
    }
    cin >> q;
    while(q--){
      int ts, te, m;
      int cnt = 0;
      cin >> ts >> te >> m;
      for(int j = ts - 540; j < te - 540; j++){
	if(table[m][j] > 0) cnt++; 
      }
      cout << cnt << endl;
    }
  }
  return 0;
}

Measured memory_bytes: 32420
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int cnt[8];
int h,w,n,sx,sy;
char s[200005],t[200005];
int main()
{
	scanf("%d%d%d%d%d",&h,&w,&n,&sx,&sy);
	scanf("%s",&s);
	scanf("%s",&t);
	for(int i=0;i<n;i++)
	{
		if(s[i]=='L')
		cnt[0]++;
		if(s[i]=='R')
		cnt[1]++;
		if(s[i]=='U')
		cnt[2]++;
		if(s[i]=='D')
		cnt[3]++;
		if(sy-cnt[0]+cnt[5]<=0)
		{
			cout << "NO" << endl;
			return 0;
		}
		if(sy+cnt[1]-cnt[4]>w)
		{
			cout << "NO" << endl;
			return 0;
		}
		if(sx-cnt[2]+cnt[7]<=0)
		{
			cout << "NO" << endl;
			return 0;
		}
		if(sx+cnt[3]-cnt[6]>h)
		{
			cout << "NO" << endl;
			return 0;
		}
		if((t[i]=='L')&&(sy-cnt[4]+cnt[1]-1>0||s[i]=='R'))
		cnt[4]++;
		if((t[i]=='R')&&(sy+cnt[5]+1-cnt[0]<=w||s[i]=='L'))
		cnt[5]++;
		if((t[i]=='U')&&(sx-cnt[6]-1+cnt[3]>0||s[i]=='D'))
		cnt[6]++;
		if((t[i]=='D')&&(sx+cnt[7]+1-cnt[2]<=h||s[i]=='U'))
		cnt[7]++;
	}
	cout << "YES" << endl;
    return 0;
}

Measured memory_bytes: 640
N=int(input())
A=input().split()
A=[int(x) for x in A]
A2=A[:]

S=0
for i in range(1,N):
  if A[i]<A2[i-1]:
    A2[i]=A2[i-1]
    S+=(A2[i]-A[i])
# print(A2)
print(S)


Measured memory_bytes: 32332
#include<vector>
#include<initializer_list>
#include<algorithm>
#include<iostream>
signed
main(){
    int n,m;
    std::cin >> n >> m;
    std::vector<std::vector<int>>v(m);
    std::vector<int>p(m);
    for(auto & u : v){
        int k; std::cin >> k;
        for(int j = 0; j < k; ++j){
            int p; std::cin >> p;
            u.push_back(p);
        }
    }
    for(auto & e : p)
        std::cin >> e;
    int ans = 0;
    auto accept = [&](int s){
        int idx = 0;
        for(auto u : v){
            int cnt = 0;
            for(auto g : u){
                cnt += (( (s >> (g-1)) & 1));
            }
            if((cnt % 2) != p[idx++]) return false;
        }
        return true;
    };
    for(int s = 0; s < (1 << (n)); ++s){
        if(accept(s))
            ++ans;
    }
    std::cout << ans << std::endl;
}


Measured memory_bytes: 256
#include<iostream>
using namespace std;
int lower(int a[], int n, int k){
	int left=0, right=n;
	while(left<right){
		int m=(left+right)/2;
		if(a[m]>=k){
			if(a[m-1]<k || m==0)
				return m;
			else
				right=m;
		}
		else{
			if(a[m+1]>k)
				return m+1;
			else
				left=m+1;
		}
	}
	return n;
}

int upper(int a[], int n, int k){
	int left=0, right=n;
	//if(k<a[0])  return 0;
	while(left<right){
		int m=(left+right)/2;
		if(a[m]>k){
			if(a[m-1]<k)
				return m;
			else
				right=m;
		}
		else if(a[m]==k){
			while(a[m]==k)
				m++;
			return m;
		}
		else{
			if(a[m+1]>k)
				return m+1;
			else
				left=m+1;
		}
	}
	return left;
}

int main(){
	int n;
	cin>>n;
	int a[n];
	for(int i=0; i<n; i++)
		cin>>a[i];
	int q;
	cin>>q;
	while(q--){
		int k;
		cin>>k;
		cout<<lower(a, n, k)<<" "<<upper(a, n, k)<<endl;
	}
	return 0;
}


Measured memory_bytes: 3504
#include<bits/stdc++.h>
#define rep(i,n)for(int i=0;i<n;++i)
#include<string>
#include<vector>
using namespace std;
typedef long long ll;
typedef pair<int, int>P;
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; }
//max=({});
//条件式が真ならwhileの中身を回し続ける
//printf("%d\n", ans);

//pairの入力
//vector<pair<ll, ll>>work(n);
//rep(i, n) {
//	ll a, b;
//	cin >> a >> b;
//	work[i] = make_pair(a, b);
//}

int g[15][15];
const int INF = 1001001001;
const int dx[4] = { -1,0,1,0 };
const int dy[4] = { 0,-1,0,1 };

//最大公約数
ll gcd(ll x, ll y) {
	return y ? gcd(y, x % y) : x;
}

ll lcm(ll x, ll y) {
	if (x == 0 || y == 0)return 0;
	return (x / gcd(x, y) * y);
}

//素因数分解
vector<pair<ll, int>>factorize(ll n) {
	vector<pair<ll, int>>res;
	for (ll i = 2;i * i <= n;++i) {
		if (n % i)continue;
		res.emplace_back(i, 0);
		while (n % i == 0) {
			n /= i;
			res.back().second++;
		}
	}
	if (n != 1)res.emplace_back(n, 1);
	return res;
}

int dp[1010][1010];
int bingo[3][3];
bool flag[3][3];
int I[100][20];

int main() {
	int n, k;
	cin >> n >> k;
	vector<int>a(n);
	rep(i, n) {
		cin >> a[i];
	}
	int res = k;
	int ans = 1;
	while (res < n) {
		res += k - 1;
		ans++;
	}
	cout << ans << endl;
	return 0;
}


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

int main() {
  int a,b,c,d;
  cin>>a>>b>>c>>d;
  int t=0;
  for(int i=1;i<=100;i++){
    if(a<i&&b>=i&&c<i&&d>=i){t++;}
  }
  cout<<t<<endl;
}

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

#define int         long long
#define pb          push_back
#define pii         pair<int,int>
#define vi          vector<int>
#define vii         vector<pii>
#define mi          map<int,int>
#define mii         map<pii,int>
#define all(a)      (a).begin(),(a).end()
#define sz(x)       (int)x.size()
#define endl        "\n"
#define repp(i,a,b) for(int i=a;i<b;i++)
#define rep(i,a,b) 	for(int i=a;i<=b;i++)
#define IOS         ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);

const int N=1e5 + 5;

int32_t main()
{
	IOS;
	int x,a;
	cin >> x >> a;
	if(x<a)
		cout << "0" << endl;
	else
		cout << "10" << endl;
}


Measured memory_bytes: 256
// template version 1.6
// {{{ define basic macro
using namespace std;
#include <iostream>
#include <bits/stdc++.h>
// varibable settings
#define int long long
#define INF 1000000000000000000LL
// #define INF 2147483647
#define MOD 1000000007LL
// #define MOD 998244353LL
#define infile "../test/sample-1.in"

#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define _rrep(i,n) rrepi(i,0,n)
#define rrepi(i,a,b) for(int i=(int)(b-1);i>=(int)(a);--i)
#define rrep(...) _overload3(__VA_ARGS__,rrepi,_rrep,)(__VA_ARGS__)
#define all(x) (x).begin(),(x).end()
#define sz(x) ((int)(x).size())
#define pb(a) push_back(a)
#define mp(a, b) make_pair(a, b)
#define uni(x) sort(all(x));x.erase(unique(all(x)),x.end())
#define ten(n) ((int)1e##n)
template<class T, size_t N> size_t sza(const T (&array)[N]) { return N; }
template<class T> inline void chmax(T &a, const T &b) { if(a < b) a = b; }
template<class T> inline void chmin(T &a, const T &b) { if(a > b) a = b; }
template<class T=int> T in() {T x; cin>>x; return (x);}
struct Fast { Fast(){ std::cin.tie(0); ios::sync_with_stdio(false); } } fast;

// dump macro
#ifdef PCM
  #include "dump.hpp"
#else
  #define dump(...) 42
  #define dump_1d(...) 42
  #define dump_2d(...) 42
#endif

typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef long double ld;
typedef pair<int,int> pii;
typedef tuple<int,int,int> iii;
template<typename T> using PQ = priority_queue<T, vector<T>, greater<T>>;
int dx[]={1, -1, 0, 0};
int dy[]={0, 0, 1, -1};
#define fi first
#define se second

// }}}

int solve(){
  int n;cin>>n;
  int y;cin>>y;y/=1000;

  rep(i, 2001){
    rep(j, 4001){
      if (i+j>n) continue;
      if (i*10 + j*5 + (n-i-j)==y){
        cout << i << " " << j << " " << n-i-j << endl;
        return 0;
      }
    }
  }
  cout << "-1 -1 -1" << endl;

  return 0;
}
signed main() { //{{{
#ifdef INPUT_FROM_FILE
  std::ifstream in(infile);
  std::cin.rdbuf(in.rdbuf());
#endif
  solve();
  return 0;
} //}}}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(void)
{
	int i,j,k,n,flg[10001],cnt,kei[10001],ff;
	while(cin>>n&&n) {
		cnt=ff=0;
		for(i=0;i<n;i++) {
			flg[i]=0;
			cin>>kei[i];
		}	
		for(i=0;i<n;i++) {
			if(kei[i]>=2) ff=1;
			if(kei[i]>=1) flg[i]=1;
			
		}
		for(i=0;i<n;i++) 
			if(flg[i]==1) cnt++;
		if(ff==0) cout<<"NA"<<endl;
		else cout<<cnt+1<<endl;
	}
}

Measured memory_bytes: 3144
#include<bits/stdc++.h>
#define ll long long
using namespace std;
const int N=1e5+5;
vector<int>v,e;
map<int,int>mp;
int n,m;
void add(int &now)
{
	while(mp[now])
	{
		now++;
	}
}
int main()
{
	cin>>n>>m;
	if(n%2==0){
		for(int i=1;i<=m;i++)
		{
			if(i%2==1)cout<<(n-i+1)/2<<" "<<(n+i+1)/2<<"\n";
			else cout<<i/2<<" "<<n-i/2<<"\n";
		}
	}else{
		n--;
		for(int i=0;i<m;i++)
		{
			cout<<i+1<<" "<<n-i<<"\n";
		}
	}
	return 0;
}

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

using namespace std;

int main() {
	int n,m;
    cin>>n>>m;
    int arr[109][109];
 	vector<int> vecr;
 	vector<int> vecc;
    for(int i=1;i<=n;i++) {
      int temp_cnt = 0;
    	for(int j=1;j<=m;j++) {
            char a;
            cin>>a;
            if(a == '.') arr[i][j] = 1;	
        	else arr[i][j] = 0;
        	
            if(arr[i][j] == 1) temp_cnt++;
        }
        if(temp_cnt == m) {
        	vecr.push_back(i);
        }
    }
  
  	for(int i=1;i<=m;i++) {
      int temp_cnt = 0;
    	for(int j=1;j<=n;j++) {
            if(arr[j][i] == 1) temp_cnt++;
        }
        if(temp_cnt == n) {
        	vecc.push_back(i);
        }
    }
    
    for(int r=0;r<vecr.size();r++) {
            for(int i=1;i<=m;i++) {
            	arr[vecr[r]][i] = -1;
            }	
            }
            
                for(int r=0;r<vecc.size();r++) {
            for(int i=1;i<=n;i++) {
            	arr[i][vecc[r]] = -1;
            }	
            }
    
  	for(int i=1;i<=n;i++) {
    	for(int j=1;j<=m;j++) {
            
          	if(arr[i][j] != -1) {
            	if(arr[i][j] == 1) cout<<'.';
                else cout<<'#';
            } 
        }
        cout<<endl;
    }	

	return 0;
}

Measured memory_bytes: 256
n = int(input())
a = [list(map(str, input().split())) for _ in range(n)]

a.sort()


check = 0
#print(a)
cC = 0
cD = 0
cH = 0
cS = 0
lc = []
ld = []
lh = []
ls = []

count = 0

#print(len(a))




while True:
    while 'C' == a[cC][0]:
        lc.append(a[cC][1])#no exist
        cC += 1
    cD = cC
    while 'D' == a[cD][0]:
        ld.append(a[cD][1])#no exist
        cD += 1
    cH = cD
    while 'H' == a[cH][0]:
        lh.append(a[cH][1])#no exist
        cH += 1
    cS =cH
    while cS < n:
        ls.append(a[cS][1])#no exist
        cS += 1
    break


ans = ["1","2","3","4","5","6","7","8","9","10","11","12","13"]
lc_a = set(ans) ^ set(lc)
ld_a = set(ans) ^ set(ld)
lh_a = set(ans) ^ set(lh)
ls_a = set(ans) ^ set(ls)

#print(lc_a)
#print(ld_a)
#print(lh_a)
#print(ls_a)

lc_al = list(lc_a)
ld_al = list(ld_a)
lh_al = list(lh_a)
ls_al = list(ls_a)

lc_al.sort(key=int)
ld_al.sort(key=int)
lh_al.sort(key=int)
ls_al.sort(key=int)

#print(ls_al)
#print(lh_al)
#print(lc_al)
#print(ld_al)



for i in range(len(ls_a)):
   # ls_al.append(ls_a)
    print("S %s"%(ls_al[i]))
          
for i in range(len(lh_a)):
    #lh_al.append(lh_a)
    print("H %s"%(lh_al[i]))
          
for i in range(len(lc_a)):
    #lc_al.append(lc_a)
    print("C %s"%(lc_al[i]))
          
for i in range(len(ld_a)):
   # ld_al.append(ld_a)
    print("D %s"%(ld_al[i]))



Measured memory_bytes: 5620
N,M= map(int,input().split())
A = list(map(int,input().strip().split()))
A.sort(reverse=True)
count=0
for i in range(M):
    if A[i]<((1/(4*M))*sum(A)):
        count+=1



if count==0:
    print("Yes")

else:
    print("No")


Measured memory_bytes: 8800
#include <iostream>

using namespace std;

int main(){
  
  int a[] = {1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
  
  int n;
  cin >> n;
  
  cout << a[n-1] << endl;
  return 0;
}

Measured memory_bytes: 256
using System;
using System.Linq;
using System.Collections.Generic;
using static System.Console;
using System.Text;
using System.IO;
using static System.Math;
namespace AtCoder
{
    class Program
    {
        static public long[] Sarray() { return ReadLine().Split().Select(long.Parse).ToArray(); }
        static public List<long> Slist() { return ReadLine().Split().Select(long.Parse).ToList(); }

        static readonly long Mod = 1000000000 + 7;

        static void Main(string[] args)
        {
            SetOut(new StreamWriter(OpenStandardOutput()) { AutoFlush = false });
            var N = Sarray()[0];
            var Ai = new List<long>();
            var max = -1L;
            var second = max;
            var maxNo = -1L;
            for (var i = 0; i < N; ++i)
            {
                Ai.Add(Sarray()[0]);
                if (max < Ai[i])
                {
                    max = Ai[i];
                    maxNo = i;
                }
            }
            Ai.Sort();
            Ai.Reverse();
            for (var i = 0; i < N; ++i)
            {
                if (i == maxNo)
                    WriteLine(Ai[1]);
                else
                    WriteLine(Ai[0]);
            }

            Out.Flush();
        }
    }
}

Measured memory_bytes: 20644
#include <bits/stdc++.h>
#define rep(i, to) for (int i = 0; i < (to); ++i)
#define repf(i, from, to) for (int i = (from); i < (to); ++i)
#define unless(cond) if (!(cond))
using namespace std;
using ll = long long;
template <typename T>
using V = vector<T>;
template <typename T, typename U>
using P = pair<T, U>;

int main() {
  int n;
  V<int> a;
  cin >> n;
  a.resize(n);
  rep(i, n) {
    cin >> a[i];
  }

  int min_elem = a[0];
  int max_elem = a[0];
  rep(i, n) {
    min_elem = min(min_elem, a[i]);
    max_elem = max(max_elem, a[i]);
  }

  cout << max_elem - min_elem << endl;
}


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

using namespace std;
int main(){
  int D, G, p[11], c[11];
  cin >> D >> G;
  for(int i = 0; i < D; ++i){
      cin >> p[i] >> c[i];
  }

  int ans = 1e9;
  for(int mask = 0; mask < (1 << D); ++mask){
      int s = 0, num = 0, rest_max = -1;
      for(int i = 0; i < D; ++i){
          if(mask >> i & 1){
              s += 100 * (i+1) * p[i] + c[i];
              num += p[i];
          }else{
              rest_max = i;
          }
      }
      if(s < G){
          int s1 = 100 * (rest_max + 1);
          int need = (G - s + s1 - 1) / s1;
          if(need >= p[rest_max]){
              continue;
          }
          num += need;
      }
      ans = min(ans, num);
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
import java.util.*;
public class Main {

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


        int a=scan.nextInt();
        int b=scan.nextInt();
        if(a%3==0 || b%3==0 || (a+b)%3==0){
            System.out.println("Possible");
        }else{
            System.out.println("Impossible");
        }


    }
}


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

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

	vector<string> s(n);
	for (int i = 0; i < n; i++)
	{
		cin >> s.at(i);
	}

	int m;
	cin >> m;
	vector<string> t(m);
	for (int i = 0; i < m; i++)
	{
		cin >> t.at(i);
	}

	int max = 0;
	for (int i = 0; i < n; i++)
	{
		int count = 0;
		for (int j = 0; j < n; j++)
		{
			if (s.at(i) == s.at(j))
			{
				count++;
			}
		}
		for (int j = 0; j < m; j++)
		{
			if (s.at(i) == t.at(j))
			{
				count--;
			}
		}
		if (max < count)
		{
			max = count;
		}
	}

	cout << max << endl;
}

Measured memory_bytes: 256