akhauriyash/Code-Regression huggingface dataset:
fun main(args: Array<String>) {
    a53(readLineList())
}

fun readLineList(): Array<String> {
    val lineList = mutableListOf<String>()
    while (true) {
        val line = readLine()
        if (line.isNullOrBlank()) {
            break
        } else {
            lineList.add(line!!)
        }
    }
    return lineList.toTypedArray()
}

fun a53(args: Array<String>) {
    if (args.size != 1) {
        throw IllegalArgumentException()
    }
    val (x1, y1, x2, y2) = args[0].split(" ").map { it.toInt() }
    print(if (x1 * y1 > x2 * y2) x1 * y1 else x2 * y2)
}


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

using namespace std;

#define pb push_back
#define mp make_pair
#define forn(i, n) for (int i = 0; i < (int)(n); ++i)
typedef long long LL;
typedef pair<int, int> PII;

int h, w;

int main() {
    cin >> h >> w;
    LL ans = min(h, w);
    if (h % 3 == 0 || w % 3 == 0) {
        ans = 0;
    }
    forn(_, 2) {
        for (int i = 1; i < h; ++i) {
            LL a = (LL)i * w;
            int j = h - i;
            LL b = (LL)j * (w / 2);
            LL c = (LL)j * (w - w / 2);
            ans = min(ans, max({a, b, c}) - min({a, b, c}));
        }
        swap(w, h);
    }
    cout << ans << endl;
    return 0;
}


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

typedef long long ll;
typedef pair<int,int> P;
int dx[] = {-1, 1, 0,  0};
int dy[] = { 0, 0, 1, -1};

 
int main(){
  int n, m;
  cin >> n >> m;
  vector<P> p[n];
  for(int i=0; i<m; i++){
    int x, y;
    cin >> x >> y;
    x--;
    p[x].push_back(make_pair(y, i));
  }
  vector<P> ans(m);
  for(int i=0; i<n; i++){
    if(p[i].size()==0) continue;
    sort(p[i].begin(), p[i].end());
    for(int j=0; j<p[i].size(); j++){
      ans[p[i][j].second] = make_pair(i+1, j+1);
    }
  }
  for(int i=0; i<m; i++){
    int cty, ord;
    cty = ans[i].first;
    ord = ans[i].second;
    stringstream ss;
    ss << setw(6) << setfill('0') << cty;
    ss << setw(6) << ord;

    cout << ss.str() << endl;
  }
  return 0;
}


Measured memory_bytes: 7808
#include <iostream>
#include <vector>
#include <algorithm>
#include <list>
#include <iomanip>
#include <string>
#include <cctype>
#include <cstdio>;


using namespace std;



int main() {
    string card;
    int m, h;
   
    while (1) {
        cin >> card;
        if (card == "-") {
            break;
        }
        cin >> m;
        for (int i = 0; i < m; i++) {
            cin >> h;
            for (int j = 0; j < h; j++) {
                card = card + card[0];
                card.erase(card.begin());
            }

        }
        cout << card << endl;
    }

    
}


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


int main()
{
	int a, b, c;
	cin >> a >> b >> c;
	if (a*b*c==175) 
		cout << "YES" << endl;
	else
		cout << "NO" << endl;
	}

Measured memory_bytes: 256
#include <stdio.h>

int main() {
  int N, A[101], tmp, ans = 0;
  int i, j;
  scanf("%d", &N);
  for(i = 0; i < N; i++) scanf("%d", A+i);
  for(i = 0; i < N-1; i++){
    for(j = N-1; j > i; j--) {
      if(A[j] < A[j-1]) {
	tmp = A[j];
	A[j] = A[j-1];
	A[j-1] = tmp;
	ans++;
      }
    }
  }
  for(i = 0; i < N; i++) {
    if(i) printf(" ");
    printf("%d", A[i]);
  }
  puts("");
  printf("%d\n", ans);
  return 0;
}

Measured memory_bytes: 616
ans :: String -> String -> String
ans s ('(':as) = ans ('(':s) as
ans s ('[':as) = ans ('[':s) as
ans (s:sr) (')':as) = if s == '(' then (ans sr as) else "no"
ans (s:sr) (']':as) = if s == '[' then (ans sr as) else "no"
ans [] (')':as) = "no"
ans [] (']':as) = "no"
ans s (a:as) = ans s as
ans (a:as) [] = "no"
ans [] [] = "yes"

main = do
  c <- getContents
  let i = takeWhile (/= ".") $ lines c
      o = map (ans []) i
  mapM_ putStrLn o
  



Measured memory_bytes: 4096
#include<iostream>
using namespace std;
int main() {
	int N, X;
	int m[101];
	cin >> N >> X;
	int sum = 0;
	int M = 100000000;
	for (int i = 0; i < N; ++i) {
		cin >> m[i];
		sum += m[i];
		if (M > m[i]) {
			M = m[i];
		}
	}
	X -= sum;
	int mcount = X / M;
	cout << N + mcount << endl;
	return 0;
}

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

#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace __gnu_pbds;
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
 
#define ll long long
ll mod = 1000000000+7;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);  
    cout.tie(NULL);
    ll T;
    T=1;
    //cin>>T;
    start:
    while(T--)
    {
        ll l,r,d,c=0;
        cin>>l>>r>>d;
        for(ll i=l;i<=r;i++){
            if(i%d==0){c++;}
        }
        cout<<c<<endl;
        
    }
    return 0;
}



Measured memory_bytes: 3604
#include<stdio.h>
#include<stdlib.h>
#include<string.h>

int upchar(const void* left, const void* right) {return strcmp((char *)left,(char *)right);}

int main(void){
  int n,i,result=0;
  char s[210000][21];
  
  scanf("%d",&n);
    for(i=0;i<n;i++){
      scanf("%s",s[i]);
    }
  qsort(s,n,sizeof(s[0]),upchar);
  result=1;
  for(i=0;i<n-1;i++){
   if(strcmp(s[i],s[i+1])!=0) result++;
  }
  printf("%d",result);
  
  return 0;
}


Measured memory_bytes: 9648
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<stack>
#include<queue>
#include<map>
#include<functional>
#include<math.h>
using namespace std;
#define rep(i,n) for(ll i=0;i<(n);i++)
#define pf(n) printf("%d\n",n)
typedef long long ll;
typedef pair<ll, ll> p;
const int INF = 1001001001;
const double PI = acos(-1);

int main() {
	int t;
	cin >> t;
	
	int a = t / 100;
	int b = t % 100;


	
	string ans;

	if (a > 12) {
		if (1 <= b && b <= 12) {
			ans = "YYMM";
		}
		else {
			ans = "NA";
		}
	}
	else if (1 <= a && a <= 12) {
		if (1 <= b && b <= 12) {
			ans = "AMBIGUOUS";
		}
		else {
			ans = "MMYY";
		}
	}
	else {
		if (1 <= b && b <= 12) {
			ans = "YYMM";
		}
		else {
			ans = "NA";
		}
	}
	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 3600
N,M=map(int,input().split())
broken=[0]*N
for _ in range(M):
  a=int(input())
  broken[a]=1
dp=[0]*(N+2)
dp[N]=1
for i in range(N-1,-1,-1):
  if broken[i]==1:
    dp[i]=0
  else:
    dp[i]=(dp[i+1]+dp[i+2])%1000000007
print(dp[0])

Measured memory_bytes: 7668
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <map>
#include <numeric>

using namespace std;
int main()
{
    long long int a, b, c, k;

    cin >> a >> b >> c >> k;

    if (k%2) {
        cout << (a-b)*-1 << endl;
    }
    else {
        cout << a-b << endl;
    }
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
using namespace std;
int main(){ 
    int N,M;
    cin >> N >> M;
    vector<int> P(M);
    vector<string> S(M);
    vector<int> V(N+1);//誤答累計
    vector<int> Q(N+1);//正解状況
    int cor = 0;
    int qid = 0;
    for (int i = 0; i < M; i++) {
      cin >> P[i];
      cin >> S[i];
      qid = P[i];//話題になってるやつ
      if (Q[qid] == 0) {
        if (S[i] == "AC") {
          Q[qid] =1;//正解してないやつを正解
          cor ++;
        } else {
          V[qid]++;
        }
      }
    }
    int wrn = 0;
    for (int i = 0; i < N+1; i++) {
      if (Q[i] == 1) {
        wrn += V[i];
      }
    }
    cout << cor << " " << wrn << endl;
    return 0;
}

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

using namespace std;

typedef long long ll;

int main(){
  int N, K;
  cin >> N >> K;
  vector<int> v(N);
  for(int i=0; i<N; i++) cin >> v[i];
  
  sort(v.begin(), v.end());
  int ret = 0;
  for(int i=0; i<K; i++) ret += v[i];
  
  cout << ret << endl;
  return 0;
}

Measured memory_bytes: 3628
#include<bits/stdc++.h>
#define endl '\n'
#define fastIO ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define int long long int
using namespace std;

int gcd(int a, int b){
    return b == 0 ? a : gcd(b, a%b);
}
int lcm(int a, int b){
    return (a*b)/gcd(a,b);
}

signed main(){

#ifndef ONLINE_JUDGE
    //freopen("input.txt","r", stdin);
#endif

    fastIO

    int n,m;
    cin >> n >> m;
    map<int, pair<string, int >> prob;
    int ac = 0, wa = 0;
    for(int i=0;i<m;i++){
        string ver;
        int num;
        cin >> num >> ver;
        if(prob.count(num)){
            if(prob[num].first == "WA" && ver == "AC"){
//                cout << "In if\n";
                wa += prob[num].second;
                ac++;
                prob[num].first = ver;
            }else{
//                cout << "in else\n";
                prob[num].second += 1;
            }
        }else{
            prob[num] = {ver,1};
            if(ver == "AC") ac++;
        }
//        cout << "prob[" << num << "] = " << prob[num].first << " " << prob[num].second << endl;
//        cout << ac << " " << wa << endl;
    }

    cout << ac << ' ' <<wa;


    return 0;
}


Measured memory_bytes: 11264
import sys

input = sys.stdin.readline
n, x, y = map(int, input().split())
ans = [0] * (n-1)
for i in range(1, n+1):
    for j in range(1, n+1):
        if i < j:
            # iとjを固定、rangeでi<jを表現
            d = min(j-i, abs(x-i)+abs(j-y)+1)
            # 長さを示すところに+１
            ans[d-1] += 1
print(*ans, sep="\n")

Measured memory_bytes: 45532
#include <bits/stdc++.h>
using namespace std;
#define mp       make_pair
#define pb       push_back
#define all(x)   (x).begin(),(x).end()
#define YES() printf("YES\n")
#define NO() printf("NO\n")
#define Yes() printf("Yes\n")
#define No() printf("No\n")
#define in(x,y,h,w) x >= 0 && x < h && y >= 0 && y < w

#define int long long
//typedef    long long          ll;
typedef    vector<bool>       vb;
typedef    vector<int>        vi;
typedef    vector<vb>         vvb;
typedef    vector<vi>         vvi;
typedef    pair<int,int>      P;

template <typename T> T &chmin(T &a, const T &b) { return a = min(a, b); }
template <typename T> T &chmax(T &a, const T &b) { return a = max(a, b); }
 
const int INF=1e+18;
const double EPS=1e-9;
const int MOD=1000000007;

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

signed main(){
	int n,ans = 0,a = 0,b = 0,prev = -1;
	string s;
	cin >> s;
	n = s.length();
	for(int i = 0;i < n;i++){
		if(s[i] == '0'){
			if(prev == 1){
				ans += min(a,b) * 2;
				a = 1;
				b = 0;
			}else a++;
		}
		else b++;
	}
	ans += min(a,b) * 2;
	cout << ans << endl;
}

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

int main()
{
	int N, M;
	cin >> N >> M;
	vector<int> p( M );
	vector<int> waa( N + 1 );
	vector<int> acc( N + 1 );
	vector<string> S( M );
	for( int i = 0; i < M; i++ ) {
		cin >> p[i] >> S[i];
	}

	int ac = 0;
	int wa = 0;
	for( int i = 0; i < M; i++ ) {
		if( S[i] == "AC" && acc[ p[i] ] == 0 ) {
			acc[ p[i] ] = 1;
			ac++;
			wa += waa[ p[i] ];
		}
		else if( S[i] == "WA" ) waa[ p[i] ]++;
	}

	cout << ac << " " << wa << endl;
}


Measured memory_bytes: 6912
import sys
input = sys.stdin.readline
N, M = map(int, input().split())
A = [0]*M
B = [0]*M
C = [0]*M
for i in range(M):
    A[i], B[i] = map(int, input().split())
    for c in [int(i) for i in input().split()]:
        C[i] |= 1 << (c - 1)

dp = [[float("inf")] * 2 ** N for _ in range(2)]
dp[0][0] = 0
for i, c in enumerate(C):
    for bit in range(2 ** N):
        if c & bit == bit:
            dp[1][bit] = min(dp[1][bit], dp[0][bit], A[i])
        else:
            dp[1][bit] = min(dp[1][bit], dp[0][bit])
        dp[1][c | bit] = min(dp[0][c | bit], dp[0][bit] + A[i], dp[1][c | bit])
    dp[0], dp[1] = dp[1], dp[0]
print(dp[0][-1] if dp[0][-1] < float("inf") else - 1)

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

using namespace std;

using ll = long long;

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

    int h, w;
    cin >> h >> w;
    vector<string> s(h);
    for (int i = 0; i < h; ++i) cin >> s[i];

    for (int i = 0; i < h; ++i) {
        for (int j = 0; j < w; ++j) {
            if (s[i][j] == '#') cout << '#';
            else {
                int cnt = 0;
                for (int dx = -1; dx <= 1; ++dx) {
                    for (int dy = -1; dy <= 1; ++dy) {
                        if (dx == 0 && dy == 0) continue;
                        if (i + dy < 0 || h <= i + dy || j + dx < 0 || w <= j + dx)
                            continue;
                        if (s[i + dy][j + dx] == '#') ++cnt;
                    }
                }
                cout << cnt;
            }
        }
        cout << '\n';
    }

    return 0;
}


Measured memory_bytes: 256
import sys
import math
from collections import defaultdict
from bisect import bisect_left, bisect_right

sys.setrecursionlimit(10**7)
def input():
    return sys.stdin.readline()[:-1]

mod = 10**9 + 7

def I(): return int(input())
def LI(): return list(map(int, input().split()))
def LIR(row,col):
    if row <= 0:
        return [[] for _ in range(col)]
    elif col == 1:
        return [I() for _ in range(row)]
    else:
        read_all = [LI() for _ in range(row)]
        return map(list, zip(*read_all))

#################

def make_divisors(n,sort=False):
    divisors = []
    for i in range(1,int(n**0.5)+1):
        if n%i == 0:
            divisors.append(i)
            if i != n//i:
                divisors.append(n//i)
    if sort:
        divisors.sort()
    return divisors

N = I()

D = make_divisors(N)
D2 = make_divisors(N-1)
ans = 0
for d in D:
    if d==1:
        continue
    i = 0
    temp = N
    while 1:
        if temp%d == 0:
            i += 1
            temp = temp//d
        else:
            break
    if temp%d == 1:
        ans += 1

print(ans+len(D2)-1)

Measured memory_bytes: 39920
c=[list(map(int, input().split())) for i in range(3)]
def C(a,b):
    for i in range(3):
        for j in range(3):
            if c[i][j]!=a[i]+b[j]:
                return False
    return True 
def D():
    for a1 in range(101):
        for a2 in range(101):
            for a3 in range(101):
                b1=c[0][0]-a1
                b2=c[0][1]-a1
                b3=c[0][2]-a1
                if C([a1,a2,a3],[b1,b2,b3]):
                    return True
    return False
print('Yes' if D() else 'No')

Measured memory_bytes: 3064
l, r = map(int, raw_input().split(" "))

ans = -1
if r - l >= 2019 or (l % 2019) - (r % 2019) > 0:
    ans = 0
else:
    for i in range(l, r):
        for j in range(i + 1, r + 1):
            tmp = (i * j) % 2019
            if ans < 0 or ans > tmp:
                ans = tmp

print(ans)


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

using namespace std;

#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep2(i,n) for(int i=1;i<=(int)(n);i++)
#define rep3(i,n) for(int i=0;i<=(int)(n);i++)
#define REP(i,m,n) for(int i=m;i<(int)(n);i++)
#define INF 1e9  //
#define INFLL 4e18  //
#define MOD (1e9)+7
#define MP make_pair

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

// a 0x61  z 0x7a  0 0x30

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

int main() {
    int group[13];
    group[0] = 0;
    group[1] = 1;
    group[2] = 3;
    group[3] = 1;
    group[4] = 2;
    group[5] = 1;
    group[6] = 2;
    group[7] = 1;
    group[8] = 1;
    group[9] = 2;
    group[10] = 1;
    group[11] = 2;
    group[12] = 1;

    int x, y;
    cin >> x >> y;
    cout << (group[x] == group[y] ? "Yes" : "No") << endl;
    return 0;
}

Measured memory_bytes: 256
N = int(input())
arr = [int(x) for x in input().split()]
found = False
for x in arr:
  if x == 0:
    found = True
if found:
  print(0)
  exit(0)
res = 1
MAX = 10 ** 18
for x in arr:
  res *= x
  if res > MAX:
    print(-1)
    exit(0)
print(res)


Measured memory_bytes: 84972
N = int(input())
button_list = []
for _ in range(N):
    button_list.append(int(input()))
ans = -1
p = 1
s = 0
for i in range(N):
    p = button_list[p-1]
    s += 1
    if p == 2:
        ans = s
        break
print(ans)

Measured memory_bytes: 7084
// #define _GLIBCXX_DEBUG
// #pragma GCC optimize("Ofast")
#pragma GCC diagnostic ignored "-Wsign-compare"
#include <bits/stdc++.h>
// #include <atcoder/all>
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define reps(i, s, n) for (int i = s; i < (int)(n); ++i)
using namespace std;
using ll = long long;
template <class T> using V = vector<T>;
template <class T> using VV = V<V<T>>;
template <class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
template <class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
constexpr int INF = 1e9 + 7;
constexpr ll LINF = 1LL << 60;

void solve() {
    int n;
    cin >> n;
    cout << 180 * (n - 2) << "\n";
}
int main() {
    cin.tie(nullptr);
    // ios_base::sync_with_stdio(false);
    // cout << fixed << setprecision(15);
    solve();
}

Measured memory_bytes: 3600
#include <bits/stdc++.h>
using namespace std;
int main() {
  long long Mod=1000000007;
  long long n,k;
  cin >> n >> k;
  long long m = n+1-k;
  long long M=m*(m+1)/2;
  cout << ((n+1)*M+(m+1)-M*(2*m+1)/3)%Mod << endl;
} 

Measured memory_bytes: 3632
#include <iostream>
using namespace std;
int main()
{
    int A,B,C,X;
    int res=0;
    cin>>A>>B>>C>>X;
    for(int i=0;i<=A;i++){
        for(int j=0;j<=B;j++){
            for(int k=0;k<=C;k++){
                if((i*500+j*100+k*50)==X)res++;
            }
        }
    }
    cout<<res<<'\n';
    return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <algorithm>
#define REP(i, n) for(int i = 0; i < (int)(n); ++i)
using namespace std;
typedef long long ll;

int main(void) {
  ll n, m;
  cin >> n >> m;
  if(n >= m) {
    swap(n, m);
  }
  ll res = 0;
  if(n == 1) {
    if(m == 1) {
      res = 1;
    } else {
      res = m-2;
    }
  } else {
    res = (n-2)*(m-2);
  }
  cout << res << endl;
  return 0;
}


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

using namespace std;

using ll = long long;

int main() {

  ll n; cin >> n;
  ll arr[n] = {0};
  for(ll i = 1; i <= n; ++i){
    cin >> arr[i];
    if(i % 2 == 0) arr[i] += arr[i - 1];
    else arr[i] = arr[i - 1] - arr[i];
  }
  for(ll i = 1; i <= n; ++i){
    if(i % 2 == 0){
        cout << abs(2 * arr[i - 1] - arr[n]) << " ";
    }
    else cout << abs(arr[n] - 2 * arr[i - 1]) << " ";
  }
  return 0;
}


Measured memory_bytes: 4428
import java.util.*;


public class Main {
    public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int[] a = new int[3];
		for (int i = 0; i < 3; i++) {
		    a[i] = sc.nextInt();
		}
		Arrays.sort(a);
        System.out.println(a[0] + " " + a[1] + " " + a[2]);
		
		
    }
}


Measured memory_bytes: 26344
#include <iostream>
#include <cmath>
#include <vector>
using namespace std;

#define ll long long

ll MAX(ll a, ll b) {

	if (a>b)return a;
	else return b;

}
bool func(ll n) {

	for (int i = 2; i <= sqrt(n); i++)if (n%i == 0)return false;

	return true;

}
int main() {
	
	ll X, ans = 0;
	cin >> X;

	if (X < 4)ans = 1;
	else {

		for (int i = 2; i <= sqrt(X); i++) {

			ll n = 1;
			while (pow(i, n) <= X) {

				ans = MAX(ans, pow(i, n));
				n++;

			}

		}

	}
	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 640
h,w=list(map(int,input().split()))
ans=0
arr=[]
for _ in range(h):
    arr+=[list(input())]
visited={}
for i in range(h):
    for j in range(w):
        visited[(i,j)]=False
for i in range(h):
    for j in range(w):
        stack=[(i,j)]
        visited[(i,j)]=True
        numblack=0
        numwhite=0
        while stack!=[]:
            current=stack.pop()
            if arr[current[0]][current[1]]=='.':
                numwhite+=1
            else:
                numblack+=1
            children=[]
            a,b=current[0],current[1]
            if a-1>=0:
                children+=[(a-1,b)]
            if a+1<h:
                children+=[(a+1,b)]
            if b-1>=0:
                children+=[(a,b-1)]
            if b+1<w:
                children+=[(a,b+1)]
            for child in children:
                if not visited[child] and (arr[child[0]][child[1]]!=arr[current[0]][current[1]]):
                    visited[child]=True
                    stack+=[child]
        ans+=numblack*numwhite
print(ans)            
                


Measured memory_bytes: 30436
#include "bits/stdc++.h"
#include "string"
using namespace std;
const int maxn=1e5+100;
struct node{
	int t;
	int x,y;
}p[maxn];
int n;
int main()
{
	cin>>n;
	for(int i=1;i<=n;i++){
	    cin>>p[i].t>>p[i].x>>p[i].y;
	}
	p[0].t=0,p[0].x=0,p[0].y=0;
	int flag=0;
	for(int i=1;i<=n;i++){
		int time=p[i].t-p[i-1].t;
		int dis=abs(p[i].x-p[i-1].x)+abs(p[i].y-p[i-1].y);
	//	cout<<dis<<" "<<time<<endl;
		if(time<dis){
		    flag=1; break;
		}
		int cha=abs(dis-time);
		if(cha%2==1){
			flag=1; break;
		}
	}
	if(flag) cout<<"No"<<endl;
	else cout<<"Yes"<<endl;
	return 0;
}

Measured memory_bytes: 1408
#include<iostream>
using namespace std;
typedef long long ll;
int main(){
  ll n,max_l=1,j,len=1;
  cin >> n;
  ll h[n];
  for(int i=0;i<n;i++){
    cin >> h[i];
  }
  j=0;
  while(j<n-1){
    if(h[j]>=h[j+1]){
      len++;
      max_l=max(max_l,len);
    }else{
      len=1;
    }
    j++;
  }
  cout << max_l-1<<endl;
}


Measured memory_bytes: 1024
#include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <utility>
#include <limits>
 
using namespace std;
 
int N;
vector<long long> v;
vector<vector<long long>> dp; 
long long LIM = std::numeric_limits<long long>::min();
 
long long deque(long long i, long long j)
{
  if (i == j) return v[i];
  if (dp[i+1][j] == LIM) dp[i+1][j] = deque(i+1, j); 
  if (dp[i][j-1] == LIM) dp[i][j-1] = deque(i, j-1);

  long long a = v[i] - dp[i+1][j];
  long long b = v[j] - dp[i][j-1];

  dp[i][j] = max(a, b); 
  return dp[i][j];
}
 
int main()
{
  std::ios_base::sync_with_stdio(false);
  std::cin.tie(0);
 
  std::cin >> N;
  v.resize(N);
  dp = vector<vector<long long>>(N+1, vector<long long>(N+1, LIM));
 
  for (int i = 0; i < N; ++i)
  {
    long long val;
    cin >> val;
    v[i] = val;
  }
 
  std::cout << deque(0, N-1);
 
  return 0;
}

Measured memory_bytes: 70912
import java.util.Scanner;

public class Main {

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

		// input
		long num = scan.nextLong();
		long min = Long.MAX_VALUE;
		for(int i = 0; i < 5; i++) {
			long temp = scan.nextLong();
			if(temp < min) {
				min = temp;
			}
		}

		// check
		long group = (long)Math.ceil((double)num / (double)min);
		long answer = (group - 1) + 5;

		// answer
		System.out.println(answer);


	}
}


Measured memory_bytes: 23124
def main():
    n = int(input())
    num_list = list(map(int, input().split()))

    count = n

    min = num_list[0]

    for i in range(1,n):
        if num_list[i] > min:
            count -= 1
        if num_list[i] < min:
            min = num_list[i]

    print(count)

if __name__ == '__main__':
    main()

Measured memory_bytes: 75472
#include <bits/stdc++.h>
#include <algorithm>
#define rep(i, n) for (int i=0; i<n; ++i)
#define all(obj) (obj).begin(),(obj).end()
using namespace std;
typedef long long ll;
long long GCD(long long x, long long y) { return y ? GCD(y, x%y) : x; }

vector<pair<long long, long long> > prime_factorize(long long N) {
    vector<pair<long long, long long> > res;
    for (long long a = 2; a * a <= N; ++a) {
        if (N % a != 0) continue;
        long long ex = 0; // 指数

        // 割れる限り割り続ける
        while (N % a == 0) {
            ++ex;
            N /= a;
        }

        // その結果を push
        res.push_back({a, ex});
    }

    // 最後に残った数について
    if (N != 1) res.push_back({N, 1});
    return res;
}

int main(){
    ll N; cin >> N;
    int cnt = 0;
    const auto &res = prime_factorize(N);
    for(auto p: res){
        for(int i=1; i<=p.second; ++i){
            if(p.second-i>=0){
                cnt++;
                p.second-=i;
            }
        }
    }
    cout << cnt << endl;
    return 0;
}


Measured memory_bytes: 3632
#include <iostream>
#include <algorithm>
#include <vector>
#include <cstdio>
#include <bits/stdc++.h>
#include <unordered_map>
#include <unordered_set>
#include <queue>

using namespace std;
typedef long long ll;


bool debug = false;



int main()
{
	std::ios::sync_with_stdio(false);

	ll res = 0;

	ll a,b,n;

	//
	//a = 4, b = 9, n = 30;

	/*
	for (int x = 0; x <= n; x++)
	{
		int f = (a*x) / b;
		int g = a * (x / b);

		cout << "for x = " << x << ", we have " << f - g << endl;
	}
	*/
	cin >> a >> b >> n;

	ll x;

	if (n >= b)
		x = b-1;
	else
		x = n;

	ll f = (a*x) / b;
	ll g = a * (x / b);	


	res = f - g;


	cout << res << endl;

	return 0;
}

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

#define ll long long
const ll MPF=1e6+1;
const ll INF=1e6;

ll n,p;
bool pr[MPF];
map<ll,ll> mp;

int main(){
	cin>>n>>p;
	if (n==1){
		cout<<p<<endl;
		return 0;
	}
	if (n>50){
		cout<<1<<endl;
		return 0;
	}
	
	for (ll i=2;i<=min(p,INF);i++)
		if (!pr[i])
			for (ll j=i+i;j<=min(p,INF);j+=i)
				pr[j]=1;
	//for (int i=2;i<=min(p,INF);i++) if (!pr[i]) cout<<i<<" ";
	//cout<<endl;
	ll k=p;
	for (int i=2;i<=min(p,INF);i++){
		if (k==1) break;
		if (!pr[i]){
			while (k%i==0){
				mp[i]++;
				k/=i;
			}
		}
	}
	
	//cout<<1;
	ll ans=1;
	for (int i=2;i<=min(p,INF);i++){
	//	cout<<mp[i]<<" "<<i<<endl;
		if (pr[i]) continue;
		if (mp[i]<n) continue;
		ll t=mp[i]/n;
		while(t--) ans*=i;
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 6144
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <cmath>
#include <cctype>

using namespace std;

inline int gi()
{
    int f = 1, x = 0;
    char c = getchar();
    while (c < '0' || c > '9')
    {
        if (c == '-') f = -1;
        c = getchar();
    }
    while (c >= '0' && c <= '9')
    {
        x = x * 10 + c - '0';
        c = getchar();
    }
    return f * x;
}

int n, a[105], ans = 1000000007, Max, b[105];

int main()
{
	n = gi();
	for (int i = 1; i <= n; i++) a[i] = gi(), b[i] = b[i - 1] + a[i];
	for (int t = 1; t <= n; t++)
	{
		int s1 = 0, s2 = 0;
		s1 = b[t], s2 = b[n] - b[t];
		ans = min(ans, abs(s1 - s2));
	}
	printf("%d\n", ans);
	return 0;
}

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

using namespace std;

using ll = long long;
using vi = vector<int>;
using vll = vector<ll>;
using vvi = vector<vector<int>>;
using vvl = vector<vector<ll>>;

ll f(ll i) {
  return (i + 1) * i / 2;
}

int main() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  ll a, b;
  cin >> a >> b;
  cout << f(abs(a - b)) - max(a, b) << endl;
  return 0;
}


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

#define FOR(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define RFOR(i,a,b) for(int i=(int)(b)-1;i>=(int)(a);i--)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define LL long long
#define INF INT_MAX

const double EPS = 1e-14;
const double PI  = acos(-1.0);


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

  vector<int> v(n);
  REP (i, n) {
    cin >> v[i];
  }

  sort(v.begin(), v.end());
  int sum = accumulate(v.begin(), v.end(), 0);

  x -= sum;
  int cnt = 0;
  while(x >= v[0]) {
    x -= v[0];
    cnt++;
  }

  cout << cnt + n << endl;
}


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

using namespace std;

void div(string &m, const string &n)
{
	int i = 0;
	for (; i < m.length(); i++) {
		if (~m[i] & 1) continue;
		if (i + n.length() > m.length())
			break;
		for (int j = 1; j < n.length(); j++)
			m[i + j] ^= n[j] & 1;
	}
	m = m.substr(i);
}

void gcd(string &m, string &n)
{
	for (; !n.empty(); m.swap(n))
		div(m, n);
}

int main()
{
	int N, a = 0;
	string X, A, B;
	cin >> N >> X;
	while (N--) {
		cin >> B;
		gcd(A, B);
	}
	for (int i = 0; i + A.length() <= X.length(); i++)
		a = (a * 2 | X[i] & 1) % 998244353;
	string Y = X;
	div(Y, A);
	cout << (a + (!Y.length() || X.length() >= Y.length() && X[X.length() - Y.length()] & 1)) % 998244353 << endl;
	return 0;
}


Measured memory_bytes: 384
#include <iostream>
using namespace std;
int main(void)
{
	int a, b;
	cin >> a >> b;
	switch (a + b)
	{
		case 3:
			cout << "3" << endl;
			break;
		case 4:
			cout << "2" << endl;
			break;
		case 5:
			cout << "1" << endl;
			break;
		default:
			break;
	}
	return (0);
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define MOD 1000000007LL
using namespace std;
typedef long long ll;
typedef pair<int,int> P;

int main(void){
	string s;
	cin >> s;
	if(s=="ABC"){
		cout << "ARC" << endl;
	}else{
		cout << "ABC" << endl;
	}
	return 0;
}


Measured memory_bytes: 3596
import           Control.Monad
import           Control.Monad.ST
import qualified Data.Array                  as A
import qualified Data.Array.ST               as ST
import qualified Data.Array.Unboxed          as AU
import           Data.Bits
import qualified Data.ByteString.Char8       as BS
import           Data.Char
import           Data.Int
import qualified Data.IntMap                 as IM
import           Data.List
import qualified Data.Map                    as M
import           Data.Maybe
import           Data.Ord
import qualified Data.Set                    as S
import           Data.Time
import qualified Data.Vector                 as V
import qualified Data.Vector.Mutable         as VM
import qualified Data.Vector.Unboxed         as VU
import qualified Data.Vector.Unboxed.Mutable as VUM

readInt :: IO [Int]
readInt = map (fst . fromJust . BS.readInt) . BS.words <$> BS.getLine

readInts :: Int -> IO [[Int]]
readInts n = replicateM n readInt

readInteger :: IO [Integer]
readInteger = map (fst . fromJust . BS.readInteger) . BS.words <$> BS.getLine

readIntegers :: Int -> IO [[Integer]]
readIntegers n = replicateM n readInteger

readString :: IO [String]
readString = map BS.unpack . BS.words <$> BS.getLine

readStrings :: Int -> IO [[String]]
readStrings n = replicateM n <$> readString

toPair :: [a] -> (a, a)
toPair [x, y] = (x, y)

count :: Eq a => a -> [a] -> Int
count a as = length $ filter (== a) as

putListWithSpace :: Show a => [a] -> IO ()
putListWithSpace [a] = putStr $ show a
putListWithSpace (a:as) = do
  putStr $ show a
  putStr " "
  putListWithSpace as

main = do
  [a, b, c, d] <- readInt
  let (ab, bc) = (abs (a - b), abs (b - c))
   in if (ab <= d && bc <= d) || abs (a - c) <= d
        then putStrLn "Yes"
        else putStrLn "No"


Measured memory_bytes: 380
import java.util.*;
public class Main {
    public static void main(String[]args){
    	Scanner sc = new Scanner(System.in);
    	int reg =0;
    	int a = sc.nextInt();
    	int b = sc.nextInt();
    	int c = sc.nextInt();
    	for(int i=a;i<b+1;i++){
    		if(c%i==0){
    			reg++;
    		}
    	}
    	System.out.println(reg);
    }
}



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

using namespace std;
using ll = long long;
using ull = unsigned long long;
using vll = vector<ll>;
using vull = vector<ull>;
using vvll = vector<vll>;
using vvvll = vector<vvll>;

#define REP(i, n, m) for(ll i=n; i<(ll)m; ++i)
#define IREP(i, n, m) for(ll i=n-1; i>=m; --i)
#define rep(i, n) REP(i, 0, n)
#define irep(i, n) IREP(i, n, 0)
#define all(v) v.begin(), v.end()
#define vprint(v) for(auto e:v){cout<<e<<" ";};cout<<endl;
#define vvprint(vv) for(auto v:vv)vprint(v);

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << setprecision(20);

    ull N;
    cin >> N;
    vull A(N);
    bool zero = false;
    rep(i, N){
        cin >> A[i];
        if(A[i]==0) zero = true;
    }

    if(zero){
        cout << 0 << endl;
        return 0;
    }

    ull ans = 1;
    rep(i, N){
        if(ans>1000000000000000000ll/A[i]){
            cout << -1 << endl;
            return 0;
        }
        ans *= A[i];
    }
    cout << ans << endl;
}


Measured memory_bytes: 3996
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author aajisaka
 */

#include<bits/stdc++.h>

using namespace std;

void debug_out() { cerr << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cerr << " " << to_string(H);
  debug_out(T...);
}
#ifdef LOCAL
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define debug(...) 42
#endif

#define SPEED ios_base::sync_with_stdio(false);cin.tie(nullptr)
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define all(v) v.begin(), v.end()
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

using ll = long long;
using P = pair<ll, ll>;

constexpr double PI = 3.14159265358979323846;
mt19937_64 engine(chrono::steady_clock::now().time_since_epoch().count());

class ATakahashiCalendar {
public:
    void solve(istream& cin, ostream& cout) {
      SPEED;
      int m, d; cin >> m >> d;
      int ans = 0;
      for(int i=22; i<=d; i++) {
        int tmp = i;
        int a = tmp%10;
        tmp/=10;
        int b = tmp%10;
        if (a>=2 && b>=2 && a*b <= m) {
          ans++;
        }

      }
      cout << ans << endl;
    }
};

signed main() {
  ATakahashiCalendar solver;
  std::istream& in(std::cin);
  std::ostream& out(std::cout);
  solver.solve(in, out);
  return 0;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

void rec(long n, long current) {
  if (n == 0) return;
  if (n % (current * -2) == 0) {
    rec(n, current * -2);
    cout << 0;
  } else {
    rec(n - current, current * -2);
    cout << 1;
  }
}

int main(void) {
  long N;
  cin >> N;
  if (N == 0) {
    cout << 0 << endl;
    return 0;
  }
  rec(N, 1);
  cout << endl;
  return 0;
}


Measured memory_bytes: 256
n=int(input())
a=[list(map(int,input().split())) for _ in range(2)]
for i in range(n-1):
  a[0][i+1]+=a[0][i]
a[1][0]+=a[0][0]
for i in range(n-1):
  a[1][i+1]+=max(a[0][i+1],a[1][i])
print(a[1][-1])

Measured memory_bytes: 61708
import sys
# sys.setrecursionlimit(100000)


def input():
    return sys.stdin.readline().strip()


def main():
    _ = int(input())
    A = [int(i) for i in input().split()]

    ans = 0
    cur = A[0]
    for a in A:
        if a >= cur:
            cur = a
        else:
            ans += cur - a

    print(ans)
    return


if __name__ == "__main__":
    main()


Measured memory_bytes: 94076
import sys
read = sys.stdin.readline
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
import numpy as np
MOD = 10 ** 9 + 7

N, K = map(int, read().split())

k = np.arange(K, N + 2, dtype=np.int64)
low = (k - 1) * k // 2
high = N * k - low
cnt = high - low + 1
print(cnt.sum() % MOD)


Measured memory_bytes: 33404
times = [int(input()) for _ in range(5)]
extra = []

for i in range(5):
    extra.append(times[i] % 10)

ans = 0

for time in times:
    ans += time // 10 * 10
    if time % 10 != 0:
        ans += 10

loss = [10 - e if e != 0 else 0 for e in extra]
ans -= max(loss)
print(ans)


Measured memory_bytes: 3060
S = input()

alphabet = ["a", "b", "c", "d", "e",
            "f", "g", "h", "i", "j",
            "k", "l", "m", "n", "o",
            "p", "q", "r", "s", "t",
            "u", "v", "w", "x", "y", "z"]

ans = ""
for i in range(len(S)):
    if S[i] in alphabet:
        alphabet.remove(S[i])
        if len(alphabet) == 0:
            break

if len(alphabet) == 0:
    print("None")
else:
    print(alphabet[0])


Measured memory_bytes: 3188
#include <bits/stdc++.h>
using namespace std;
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define int long long
#define vi vector<int>
#define pii pair<int,int>
#define vpii vector<pii>
#define endl '\n'
#define mod 1000000007
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define in insert
#define pi 3.14159265358979323846
#define rep(i,a,b) for(int i = a ; i < b ; i++)
#define repr(i,a,b) for(int i = b ; i > a ; i--)
  
long long fact(long long a, long long b){
    int r= max(a, b);
    int v= min(a, b);
    int l=1;
    // if(v==0)
    for(int i=r+1; i<=a+b; i++){
        l*=i;
    }
    for(int i=v; i>=2; i--){
        l/=i;
    }
    return l;
}

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

int powr(int a) { 
    int var=1;
    for(int i=0; i<a; i++){
        var*=2;
    }
    return var;
}

signed main(){   
    fast;
    int x;
    cin >> x;
    if(x>=30)
        cout << "Yes";
    else
        cout << "No";
}

Measured memory_bytes: 3652
# include <iostream>
# include <cstdio>

using namespace std ;

long long a , b ;

int main()
{
	scanf("%lld" , &a) ;
	char ch ;
	ch = getchar() ;
	while ( ch < '0' || ch > '9' ) ch = getchar() ;
	// puts("") ;
	while ( ch >= '0' && ch <= '9' ) 
	{
		// printf("%c" , ch) ;
		b = b * 10 + ch - '0' ;
		ch = getchar() ;
	}
	ch = getchar() ;
	while ( ch >= '0' && ch <= '9' )
	{
		// printf("%c" , ch) ;
		b = b * 10 + ch - '0' ;
		ch = getchar() ;
	}
	// puts("") ;
	// printf("%lld %lld\n" , a , b) ;
	printf("%lld\n" , a * b / 100) ;
	return 0 ;
}

Measured memory_bytes: 3828
#include<bits/stdc++.h>
 #include <ext/pb_ds/tree_policy.hpp>
 #include <ext/pb_ds/assoc_container.hpp>
 #include<chrono>
 using namespace std;
 using namespace std::chrono;      
 using namespace __gnu_pbds; 
 #define fastio     ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
 #define fi         first
 #define se         second
#define int         long long 
 #define pb         push_back
 #define emp        emplace_back
 #define vv(x)      vector<x>
 #define mp(x,y)    map<x,y>
 #define dq(x)      deque<x>
 #define pql(x)     priority_queue<x>
 #define pqs(x)     priority_queue<x,vv(x),greater<x> >
 #define mod          1000000007
 #define forf(i,a,b) for(int i=a;i<b;i++)
 #define it(x)      x::iterator
 #define ll         long long 
 #define debug(...) fprintf(stderr, __VA_ARGS__), fflush(stderr)
 #define time__(d)  for(long blockTime = 0; (blockTime == 0 ? (blockTime=clock()) != 0 : false); debug("%s time : %.4fs", d, (double)(clock() - blockTime) / CLOCKS_PER_SEC))
 #define vii        vector<int>
 #define big        2e18
 #define sm         -1e9
 #define mkr        make_pair
 #define vpi        vector<pair<int,int> >
 #define pii        pair<int,int>
 #define rng        500005
 #define sz(x)      (int)x.size()
 #define rv(x)      reverse(x.begin(),x.end())
 #define out(x)     cout<<x.fi<<" "<<x.se<<endl;

#define ordered_set tree<pii, null_type,less<pii>, rb_tree_tag,tree_order_statistics_node_update> 
  
void pr_init()
{
   
    #ifndef ONLINE_JUDGE
    freopen("in.txt", "r", stdin);
    freopen("out.txt", "w", stdout);
   
    #endif
}
vector<int> a, asc, ans;
int ptr = 0;
vector<vii> G;
 

void recsolve(int v, int p = -1) {
    int ind = lower_bound(asc.begin(),asc.end(), a[v]) - asc.begin();
    int was = asc[ind];
    asc[ind] = a[v];
    while (asc[ptr] < mod) ++ptr;
    while (ptr > 0 && asc[ptr - 1] == mod) --ptr;
    ans[v] = ptr;
    for (auto i : G[v])
        if (i != p)
            recsolve(i, v);
    asc[ind] = was;
}


void solve()
{
 

   int n;
    cin >> n;
    a = vector<int>(n);
    forf(i,0,n) cin >> a[i];
    G = vector<vii>(n);
    for (int i = 1; i < n; ++i) {
        int u, v;
        cin >> u >> v;
        --u, --v;
        G[u].pb(v);
        G[v].pb(u);
    }
    ans = vector<int>(n);
    asc = vector<int>(n + 1, mod);
    recsolve(0);
    for (auto i : ans) cout << i << '\n';
 
}

int32_t main()
{
  pr_init();
  //fastio;
  
  auto start = high_resolution_clock::now(); 
 
  solve();
  auto stop = high_resolution_clock::now();
  auto duration = duration_cast<microseconds>(stop - start); 
  
    // cout << "Time taken by function: "
    //      << duration.count() << " microseconds" << endl; 

 }


Measured memory_bytes: 30396
import sys


def input(): return sys.stdin.readline().strip()
def I(): return int(input())
def LI(): return list(map(int, input().split()))
def IR(n): return [I() for i in range(n)]
def LIR(n): return [LI() for i in range(n)]
def SR(n): return [S() for i in range(n)]
def S(): return input()
def LS(): return input().split()


INF = float('inf')


x = I()
print(1 if x == 0 else 0)

Measured memory_bytes: 9192
#include <regex>
#include "bits/stdc++.h"
#define FOR(i, s, e) for (int i = int(s); i < int(e); ++i)
#define REP(i, e) FOR(i, 0, e)
#define INF (INT_MAX / 2)
#define LINF (LLONG_MAX / 2)
#define EPS (1.0e-8)
const int MGN = 10;
const int ARY_SZ_MAX = (int)1e7;
using namespace std;
using ll = long long; using ull = unsigned long long;
using vi = vector<int>; using vvi = vector<vi>;
using vc = vector<char>; using vvc = vector<vc>;
using vb = vector<bool>; using vvb = vector<vb>;
using vl = vector<ll>; using vvl = vector<vl>;
using vd = vector<double>; using vs = vector<string>;
using pii = pair<int, int>; using pll = pair<ll, ll>; using psl = pair<string, ll>;

// n が素数か判定 O(√N)
bool is_prime(int n) {
    if (n <= 1) return false;
    for(int i=2; i*i <= n; i++) {
        if (n%i == 0) return false;
    }
    return true;
}

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


  int X; cin>>X;

  int x=X;
  while(!is_prime(x)) {
    x++;
  }

  int ans = x;
  cout << ans << endl;


  return 0;
}


Measured memory_bytes: 256
lines=readlines(open("/dev/fd/0"))
input()=shift!(lines)
int(s::String)=parse(Int,s)
intSub(s::SubString{String})=parse(Int,s)
intLine(s::Array{SubString{String},1})=map(intSub,s)
function main()
  a,p=intLine(split(input()))
  println(floor(Int,(3a+p)/2))
end
main()

Measured memory_bytes: 112516
<?php
fscanf(STDIN, "%s", $s);

$i = 0;
while (1) {
	foreach ([$i + 1, $i + 2] as $j) {
		if (!isset($s[$j])) break 2;
		if ($s[$i] == $s[$j]) exit(($i + 1) . ' ' . ($j + 1) . "\n");
	}
	$i++;
}
echo "-1 -1\n";

Measured memory_bytes: 3704
#include <iostream>
#include <string>
#include <map>
#include <queue>
#include <math.h>
#include <bitset>
#include <cmath>
#include <set>
#include <queue>
#include <stack>
#include <algorithm>
#include <vector>
#include <random>
using namespace std;
typedef long long ll;
#define repe(i,s,n)for(ll i = s;i<=n;i++)
#define rep_r(i,s,n)for(ll i = n-1;i>s;i--)
#define rep_re(i,s,n)for(ll i = n-1;i>=s;i--)
ll MOD = 1e9 + 7;

/////////////////////////////////////////////////////////////////////////////////////////////

typedef long long ll;
#define rep_re(i,s,n)for(ll i = n-1;i>=s;i--)
#define rep(i,s,n)for(ll i = s;i<n;i++)

bool kaibun(string s) {
    bool isK = true;
    int N = s.size();
    rep(i, 0,  N/ 2) {
        isK &= (s[i] == s[N - i - 1]);
    }
    return isK;
}

int main()
{
    string s,s1,s2; cin >> s;

    s1 = s.substr(0, (s.size() - 1) / 2);
    s2 = s.substr((s.size() +3) / 2-1, (s.size() - 1) / 2);

    bool ok = kaibun(s) && kaibun(s1) && kaibun(s2);

    cout << ((ok) ? "Yes" : "No") << endl;

    return 0;
}

//Solution* sol = new Solution();
//vector<int> v1 = { 1,2,3,4 };
//vector<vector<int>> v;
//vector<int> p = { 1,0 };
// Solution* sol = new Solution();


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

int main(){
  int a,b,d;
  int c[120];
    cin>>a;
  cin >> b>>d;
  for(int i=0;i<a;i++){
  cin >>c[i];
  }
  
  
  int e = d;
  for(int i =0;i<a;i++){
     e += ((b+c[i]-1)/c[i]);
  }
  
  cout << e << endl;
  }
  


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

#define fastio ios_base::sync_with_stdio(0); cin.tie(0)

typedef long long ll;

const int M=2e5+5;
const int INF=2e9;
const int MOD=1e9+7; //prime number

void Solve(int n);

void Solve()
{
    ll N,ans = 0, pre = 0, A;
    cin >> N;
    cin >> pre;
    while(--N)
    {
        cin >> A;
        if(pre>A)
        {
            ans+=(pre-A);
            A = pre;
        }
        pre = A;
    }
    cout << ans;

}
int main()
{
    fastio;
    Solve();

    return 0;
}
void Solve(int n)
{
    for(int i = 1; i <= n; ++i)
    {
        cout << "Case " << i << ":" << '\n';
        Solve();
        cout << '\n';
    }
}


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

int main() {
    int N;
    cin >> N;
    vector<int> X(N);
    for (int i=0; i<N; i++) {
        cin >> X[i];
    }
    vector<int> P(100,0);
    for (int i=0; i<100; i++) {
        for (int j=0; j<N; j++) {
            P[i] += (X[j]-(i+1))*(X[j]-(i+1));
        }
    }
    sort(P.begin(),P.end());
    cout << P[0] << endl;
}

Measured memory_bytes: 3632
#include <iostream>
#include <algorithm>
#include <math.h>
#include <vector>

int main()
{
	int N = 0, ans = 0;

	std::cin >> N;

	std::vector<int> A(N, 0);
	std::vector<std::vector<std::pair<int, int>>> S(N);

	for (int i = 0; i < N; i++)
	{
		std::cin >> A[i];
		for (int j = 0; j < A[i]; j++)
		{
			S[i].resize(A[i]);
			std::cin >> S[i][j].first >> S[i][j].second;
		}
	}

	for (long long int as = 0; as < (1 << N); as++)
	{
		bool chk = true;
		for (int i = 0; i < N; i++)
		{
			// 人iが正直者だった場合のみ実行
			if (!(as & (1 << i))) continue;
			for (int j = 0; j < A[i]; j++)
			{
				//　正直者iのj個目の証言の真偽確認
				if (((as >> (S[i][j].first - 1)) & 1) ^ S[i][j].second) chk = false;
			}
		}
		if (chk)
		{
			int cnt = 0;
			for (int i = 0; i < N; i++)
			{
				cnt += ((as >> i) & 1 == 1) ? 1 : 0;
			}
			ans = std::max(ans, cnt);
		}
	}

	std::cout << ans << std::endl;

	return 0;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)n;i++)
#define rep1(i,n) for(int i=1;i<=(int)n;i++)
#define rep2(i,j,n) for(int j=i;j<n;j++)
#define rep3(i,j,n) for(int j=i;j<=n;j++)
#define rrep(i,n) for(int i=n-1;i>=0;i--)
#define sp(n) cout << fixed << setprecision(n)
typedef long long ll;
using namespace std;
const int inf=1e+9;
int main(void){
    int n,m;cin>>n>>m;
    queue<tuple<int,int,int>> que;
    int d[n][n];
    rep(i,n)rep(j,n) d[i][j]=(i==j)? 0:inf;
    rep(i,m){
        int a,b,c;cin>>a>>b>>c;a--;b--;
        d[a][b]=d[b][a]=c;
        que.push(make_tuple(a,b,c));
    }
    
    rep(k,n)rep(i,n)rep(j,n) d[i][j]=min(d[i][j],d[i][k]+d[k][j]);
    int res=m;
    rep(i,m){
        auto x=que.front();que.pop();
        int a,b,c;
        tie(a,b,c)=x;
        rep(j,n)rep(k,n){
            if(j==k)continue;
            if(d[j][a]+c+d[b][k]==d[j][k]){
                res--;
                goto skip;
            }
        }
        skip:
        continue;
    }
    cout<<res<<endl;
}


Measured memory_bytes: 256
d = int(input())
c = list(map(int,input().split()))
like=0
but=0
s=[]
last=[]
show=''
for i in range(26):
    last.append(0)
for i in range(365):
    keys=list(map(int,input().split()))
    s.append(keys)
for i in range(365):
    show+=str(s[i].index(max(s[i]))+1)+'\n'
print(show)

Measured memory_bytes: 9184
import re

S = input()
s = re.split('/', S)

y = int(s[0])
m = int(s[1])
d = int(s[2])

f = False
if y <= 2018:
    f = True
if y == 2019:
    if m <= 4:
        f = True

if f:
    print("Heisei")
else:
    print("TBD")

Measured memory_bytes: 3188
#include <iostream>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <map>
#include <queue>

static const int MOD = 1000000007;
using ll = long long;
using u32 = unsigned;
using namespace std;

template<class T>
constexpr T INF = ::numeric_limits<T>::max() / 32 * 15 + 208;

int main() {
    int x;
    cin >> x;
    if(x == 3) puts("YES");
    else if(x == 5) puts("YES");
    else if(x == 7) puts("YES");
    else puts("NO");
    return 0;
}


Measured memory_bytes: 256
a = int(input())
b = int(input())
c = int(input())
x = int(input())

a = min(x//500, a)+1
b = min(x//100, b)+1
c = min(x//50, c)

cnt = 0

for i in range(a):
  for j in range(b):
    now = x-500*i-100*j
    if now>=0 and now//50 <= c:
      cnt +=1

print(cnt)

Measured memory_bytes: 9188
hoge = [0] * 26
a = ord('a')
string = input()
for i in range(len(string)):
    hoge[ord(string[i])-a] = 1

for i in range(26):
    if hoge[i] == 0:
        print(chr(i+a))
        break
    if i == 25:
        print('None')

Measured memory_bytes: 3188