akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define repr(i,n) for(int i = (int)(n); i >= 0; i--)
#define all(v) v.begin(),v.end()
typedef long long ll;

int ctoi(char c){
    switch (c){
        case '0': return 0;
        case '1': return 1;
        case '2': return 2;
        case '3': return 3;
        case '4': return 4;
        case '5': return 5;
        case '6': return 6;
        case '7': return 7;
        case '8': return 8;
        case '9': return 9;
        default: return 0;
    }
}

int main(){
    string A,B;
    cin >> A >> B;
    int len_A = A.size();
    int len_B = B.size();
    if (len_A < len_B){
        cout << "LESS" << endl;
    }
    else if (len_A > len_B){
        cout << "GREATER" << endl;
    }
    else{
        int count = 0;
        rep(i,len_A){
            if (ctoi(A[i]) < ctoi(B[i])){
                cout << "LESS" << endl;
                break;
            }
            else if (ctoi(A[i]) > ctoi(B[i])){
                cout << "GREATER" << endl;
                break;
            }
            count++;
        }
        if (count == len_A){
            cout << "EQUAL" << endl;
        }
    }
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
//#include <boost/multiprecision/cpp_int.hpp>
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>

#define ll long long
//#define bint int1024_t
#define ld long double
#define vect vector<ll>
#define unmap unordered_map
#define pb push_back
#define F first
#define pll pair<ll,ll>
#define S second
#define pi 3.1415926536
#define mod int(1e9+7)
//ios_base::sync_with_stdio(false);cin.tie(NULL);
#define testcases ll t; cin>>t; while(t--)

using namespace std;
//using namespace boost::multiprecision;
//using namespace __gnu_pbds;

ll n,k;
ll v[200001];
map<ll,bool> m;
vect p(1,1),q;

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

    cin>>n>>k;
    for(int i=1;i<=n;i++) cin>>v[i];

    m[1]=1;
    ll curr=v[1];

    while(!m[curr])
    {
        m[curr]=1;
        p.pb(curr);
        curr=v[curr];
    }

    ll i=0;
    k++;
    while(p[i]!=curr) i++;
    if(k<=i)
    {
        cout<<p[k-1];
        return 0;
    }
    k-=i;
    k--;
    while(i<p.size()) q.pb(p[i]),i+=1;
    k%=(int)q.size();
    cout<<q[k];

    return 0;
}


Measured memory_bytes: 19140
#ifdef DEBUG
#define _GLIBCXX_DEBUG
#endif

#include <bits/stdc++.h>

using namespace std;

typedef long double ld;

#ifdef DEBUG
#define eprintf(...) fprintf(stderr, __VA_ARGS__), fflush(stderr)
#else
#define eprintf(...) ;
#endif

#define sz(x) ((int) (x).size())
#define TASK "text"

const int inf = (int) 1.01e9;
const long long infll = (long long) 1.01e18;
const ld eps = 1e-9;
const ld pi = acos((ld) -1);

mt19937 mrand(random_device{} ()); 

int rnd(int x) {
  return mrand() % x;
}

void precalc() {
}

const int maxn = 2005;
int n;
int a[maxn];
int par[maxn];
vector<int> g[maxn];

int read() {
  if (scanf("%d", &n) < 1) {
    return false;
  }
  for (int i = 0; i < n; i++) {
    g[i].clear();
  }
  par[0] = -1;
  for (int i = 1; i < n; i++) {
    int p;
    scanf("%d", &p);
    par[i] = p;
    g[p].push_back(i);
  }
  for (int i = 0; i < n; i++) {
    scanf("%d", &a[i]);
  }
  return true;
}

int tin[maxn], tout[maxn], t;
int dep[maxn];

void dfs(int v) {
  tin[v] = t++;
  for (int i = 0; i < sz(g[v]); i++) {
    int u = g[v][i];
    dep[u] = dep[v] + 1;
    dfs(u);
  }
  tout[v] = t++;
}

bool anc(int v, int u) {
  return tin[v] <= tin[u] && tout[u] <= tout[v];
}

int ok[maxn];

int get(int v, int x) {
  int res = -1;
  for (int i = 0; i < sz(g[v]); i++) {
    int u = g[v][i];
    int cur = get(u, x);
    if (cur == -1) {
      continue;
    }
    if (res == -1 || dep[res] < dep[cur]) {
      res = cur;
    }
  }
  if (res == -1 && (!ok[v] || anc(a[v], x))) {
    res = v;
  }
  return res;
}

void rot(int v) {
  int x = a[v];
  a[v] = a[0];
  v = par[v];
  while (v != -1) {
    swap(a[v], x);
    v = par[v];
  }
}

void solve() {
  t = 0;
  dep[0] = 0;
  dfs(0);
  vector<int> ans;
  while (true) {
    bool allok = true;
    for (int i = 0; i < n; i++) {
      ok[i] = anc(a[i], i);
      if (!ok[i]) {
        allok = false;
      }
    }
    if (allok) {
      break;
    }
    int v = a[0];
    int u = get(v, v);
    ans.push_back(u);
    rot(u);
  }
  printf("%d\n", sz(ans));
  for (int i = 0; i < sz(ans); i++) {
    printf("%d\n", ans[i]);
  }
}

int main() {
  precalc();
#ifdef DEBUG
  assert(freopen(TASK ".in", "r", stdin));
  assert(freopen(TASK ".out", "w", stdout));
#endif
  while (read()) {
    solve();
#ifdef DEBUG
    eprintf("Time %.2f\n", (double) clock() / CLOCKS_PER_SEC);
#endif
  }
  return 0;
}


Measured memory_bytes: 640
import numpy as np
import sys
sys.setrecursionlimit(10**9)

def mi(): return map(int,input().split())
def ii(): return int(input())
def isp(): return input().split()
def deb(text): print("-------\n{}\n-------".format(text))

class Polynomial:
    def __init__(self,dim=0,const=1):
        self.values = [(dim,const)]
    def __add__(self,other):
        return self.values + other.values


class PolySolver:
    def __init__(self,size,init_val=1):
        self.size = size
        self.f = np.zeros(size, np.int64)
        self.f[0] = init_val


    def multiple(self,polynomial,MOD): # const1 * x^dim1 + const2 * x^dim2 + ... をfにかけ合わせる
        new_F = np.zeros(self.size, np.int64)
        for dim,const in polynomial:
            if dim != 0:
                g = np.zeros(self.size, np.int64)
                g[dim:] += self.f[:-dim] # dim分係数情報をずらす
            else:
                g = const * self.f.copy()

            new_F += g

        self.f = new_F
        self.f %= MOD
    
    def add(self,polynomial,MOD): # const1 * x^dim1 + const2 * x^dim2 + ... をfに足す
        for dim,const in polynomial:
            self.f[dim] += const
            self.f %= MOD

    def get_coefficient(self,dim):
        return self.f[dim]



INF=10**20
def main():
    N,S=mi()
    A=list(mi())
    MOD=998244353

    F = PolySolver(3010,init_val=0)
    ans = 0
    for i in range(N):
        f = Polynomial(dim=A[i]) + Polynomial(const=1)
        F.add(Polynomial(const=1).values,MOD)
        F.multiple(f,MOD)
        ans += F.get_coefficient(S)
    
    print(ans % MOD)
    


if __name__ == "__main__":
    main()

Measured memory_bytes: 27420
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < n; i++)
#define repr(i, n) for (int i = n-1; i >= 0; i--)
using namespace std;
typedef long long int ll;
typedef vector<ll> vll;
typedef vector<vll> vvll;

int main() {
    string s; cin >> s;
    int n = s.size();
    int ans = 0;
    rep(i, n) {
        if (i%2 == 0) {
            if (s[i] == 'R' || s[i] == 'U' || s[i] == 'D')
                ans++;
            else {
                cout << "No" << endl;
                return 0;
            }
        }
        else if (i%2 == 1) {
            if (s[i] == 'L' || s[i] == 'U' || s[i] == 'D')
                ans++;
            else {
                cout << "No" << endl;
                return 0;
            }
        }
    }
    if (ans)
        cout << "Yes" << endl;
    else
        cout << "No" << endl;
}

Measured memory_bytes: 256
/*
 * 2519.cc: English
 */

#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<set>
#include<stack>
#include<list>
#include<queue>
#include<deque>
#include<algorithm>
#include<numeric>
#include<utility>
#include<complex>
#include<functional>
 
using namespace std;

/* constant */

const int MAX_N = 100;
const int H = 4, W = 4;
const int MAX_T = 10000;

const int dxs[] = {1, 1, 0, -1, -1, -1, 0, 1};
const int dys[] = {0, -1, -1, -1, 0, 1, 1, 1};

/* typedef */

/* global variables */

string words[MAX_N], flds[H];
int scs[MAX_N], wns[MAX_N], dp[2][MAX_T + 1];
bool used[H][W];

/* subroutines */

int rec(string &s, int k, int ux, int uy) {
  int sn = s.size();
  if (k >= sn - 1) return 1;

  int cnt = 0;
  used[uy][ux] = true;

  for (int di = 0; di < 8; di++) {
    int vx = ux + dxs[di], vy = uy + dys[di];
    if (vx >= 0 && vx < W && vy >= 0 && vy < H &&
	flds[vy][vx] == s[k + 1] && ! used[vy][vx])
      cnt += rec(s, k + 1, vx, vy);
  }

  used[uy][ux] = false;
  return cnt;
}

/* main */

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

  for (int i = 0; i < n; i++) cin >> words[i] >> scs[i];
  for (int i = 0; i < H; i++) cin >> flds[i];

  int t;
  cin >> t;

  for (int i = 0; i < n; i++) {
    string &wdi = words[i];
    wns[i] = 0;
    for (int y = 0; y < H; y++)
      for (int x = 0; x < W; x++)
	if (flds[y][x] == wdi[0]) wns[i] += rec(wdi, 0, x, y);
    //printf("wns[%d] = %d\n", i, wns[i]);
  }

  memset(dp, -1, sizeof(dp));
  dp[0][0] = 0;
  int cur = 0, nxt = 1;

  for (int i = 0; i < n; i++) {
    int &wn = wns[i];
    int &si = scs[i], s = si;
    int wi = words[i].size(), w = wi;

    memcpy(dp[nxt], dp[cur], sizeof(dp[0]));

    for (int k = 0; k < wn && w <= t; k++, s += si, w += wi) {
      int maxj = t - w;
      for (int j = 0; j <= maxj; j++)
	if (dp[cur][j] >= 0) {
	  int d = dp[cur][j] + s;
	  if (dp[nxt][j + w] < d) dp[nxt][j + w] = d;
	}
    }
    cur ^= 1, nxt ^= 1;
  }

  int maxdp = 0;
  for (int i = 0; i <= t; i++)
    if (maxdp < dp[cur][i]) maxdp = dp[cur][i];
  printf("%d\n", maxdp);
  return 0;
}

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


typedef long long ll;
using namespace std;

int main()
{
  int n, i;
  ll a[200001]={0};
  ll p[200001]={0};
  cin >> n;

  for(i=1; i<=n; i++){
    cin >> a[i];
    p[i] = a[i] + p[i-1];
  }

  ll ans = 1e16;
  ll diff[4];

  ll l=1, r=3;

  for(i=1; i<=n; i++){
    while(l<i && abs(p[l]-(p[i]-p[l])) >= abs(p[l+1]-(p[i]-p[l+1])))l++;
    while(r<n && abs((p[r]-p[i])-(p[n]-p[r])) >= abs((p[r+1]-p[i])-(p[n]-p[r+1])))r++;

    diff[0]=p[l];
    diff[1]=p[i]-p[l];
    diff[2]=p[r]-p[i];
    diff[3]=p[n]-p[r];

    sort(diff, diff+4);
    
    ans = min(ans, diff[3]-diff[0]);
  }

  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 3456
#include <iostream>
#include <string>
#include <cmath>
#include<algorithm>
#include<stack>
#include<queue>
#include<map>
#include<set>
#include<iomanip>
#define _USE_MATH_DEFINES
#include <math.h>
#include <functional>
using namespace std;

#define rep(i,x) for(ll i=0;i<x;i++)
#define repn(i,x) for(ll i=1;i<=x;i++)

typedef long long ll;
const ll INF = 1e17;
const ll MOD = 998244353;
const ll MAX = 1000001;

ll max(ll a, ll b) {
	if (a > b) { return a; }
	return b;
}

ll min(ll a, ll b) {
	if (a > b) { return b; }
	return a;
}

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

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

struct edge {
	ll ind;
	ll fr;
	ll to;
	ll d;
};


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



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

	cout << min(A, B) <<" "<< max(A + B - N, 0);

	system("PAUSE");
}


Measured memory_bytes: 504
//in the name of allah
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int , int> ii;
int solve(string s , char c){
	int pass=0;
	while(true){
		int n = s.size();
		bool f = true;
		for(int i=0 ; i<n ; i++)
			if(s[i] != s[0])
				f = false;
		if(f)
			break;
		pass ++;
		for(int i=0 ; i<n-1 ; i++)
			s[i] = (s[i] == c || s[i+1] == c ? c : s[i]);
		s.pop_back();
	}
	return pass;
}
int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	string s;
	cin >> s;
	int ret=(int)s.size()-1;
	for(int i=0 ; i<26 ; i++)
		ret = min(ret , solve(s , char('a' + i)));
	cout << ret << "\n";
}

//.


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

int main(){
	int m,f,b;
	cin >> m >> f >> b;
	if(b <= m){
		cout << 0 << endl;
	}
	else if( b <= m + f){
		cout << b - m << endl;
	}
	else{
		cout << "NA" << endl;
	}
	return 0;
}

Measured memory_bytes: 3096
IDENTIFICATION DIVISION.
       PROGRAM-ID. ATCODER.
       DATA DIVISION.
       WORKING-STORAGE SECTION.
       01  indata PIC X(100).
       01  a1 PIC 9(12).
       01  a2 PIC 9(12).
       01  a3 PIC 9(12).
       01  r pic 9(12).
       01  g pic 9(12).
       01 disp pic Z(10)9.
       PROCEDURE DIVISION.
        ACCEPT indata.
        
        UNSTRING indata DELIMITED BY SPACE INTO a1 a2.
        compute a3 = a1 *a1 * 3
        MOVE FUNCTION TRIM(a3) to disp
        DISPLAY disp


       STOP RUN.


Measured memory_bytes: 892
using System;
using System.Collections.Generic;

class Program
{
    static void Main(string[] args)
    {
        int Num = int.Parse(Console.ReadLine());

        List<int> Targets = new List<int>() { 7, 5, 3 };

        Console.WriteLine(Targets.Contains(Num) ? "YES" : "NO");
    }
}

Measured memory_bytes: 11220
#include <bits/stdc++.h>
using namespace std;
const int N=2100;
int n,m,vi[N],match[N],cnt;
int tot,first[N],nxt[N],point[N];
void add_edge(int x,int y)
{
	tot++;
	nxt[tot]=first[x];
	first[x]=tot;
	point[tot]=y;
}
bool dfs(int x)
{
	for (int i=first[x];i!=-1;i=nxt[i])
	{
		int u=point[i];
		if (vi[u]) continue;
		vi[u]=1;
		if (!match[u] || dfs(match[u]))
		{
			match[u]=x;
			return true;
		}
	}
	return false;
}
void dfs1(int x)
{
	cnt++;
	vi[x]=1;
	for (int i=first[x];i!=-1;i=nxt[i])
	{
		int u=point[i];
		if (vi[u]) continue;
		dfs1(u);
	}
}
int main()
{
	tot=-1;
	memset(first,-1,sizeof(first));
	memset(nxt,-1,sizeof(nxt));
	scanf("%d%d",&n,&m);
	for (int i=1;i<=m;i++)
	{
		int u,v;
		scanf("%d%d",&u,&v);
		v+=n;
		add_edge(u,v);
		add_edge(v,u);
	}
	cnt=0;
	for (int i=1;i<=n;i++)
	{
		memset(vi,0,sizeof(vi));
		if (dfs(i)) cnt++;
	}
	printf("%d ",m-cnt);
	memset(vi,0,sizeof(vi));
	int ans=0;
	for (int i=1;i<=n+n;i++)
	{
		if (vi[i]) continue;
		cnt=0;
		dfs1(i);
		if (cnt==1) continue;
		ans++;
	}
	printf("%d\n",m-ans);
}


Measured memory_bytes: 3268
n = int(input())
P = list(map(int,input().split()))
p = [0]*3
cnt = 0
for i in range(1,n-1):
    for j in range(0,len(p)):
        p[j] = P[i+(j-1)] - P[i]
    p.sort()
    if p.index(0) == 1:
        cnt += 1
print(cnt)

Measured memory_bytes: 3060
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)  
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define llong long long
#define pb(a) push_back(a)
#define INF 999999999
using namespace std;
typedef pair<int, int> P;
typedef pair<llong, llong> LP;
typedef pair<int, P> PP;
typedef pair<llong, LP> LPP;

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

int main(){

  
  int a,b;
  int h,w;
  cin>>a>>b>>h>>w;
  cout<<a*b-h*b-a*w+h*w<<endl;

 

  return 0;
}

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

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(a)  (a).begin(),(a).end()
#define pb push_back
#define ppb pop_back
#define INF 1e18
typedef long long ll;

using namespace std;

int main(int argc,char* argv[])
{
    ios::sync_with_stdio(false);
    cin.tie(0);

    int a,b;
    cin>>a>>b;
    if(a>2*b)cout<<a-2*b<<endl;
    else cout<<0<<endl;


    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(n);i++)
#define rep1(i,n) for(int i=1;i<=(n);i++)
#define all(x) (x).begin(),(x).end()
#define V vector
typedef V<int> vi;
typedef V<vi> vvi;
typedef long long ll;
typedef pair<int, int> P;
typedef tuple<int, int, int> T;
constexpr auto INF = INT_MAX >> 1;
constexpr auto LINF = 5000000000000000LL;
constexpr auto MOD = 1000000007;

int main() {
	
	string s;
	cin >> s;
	bool good=true;
	rep(i, 3)if (s[i] == s[i + 1])good = false;
	cout << (good ? "Good" : "Bad") << endl;

}

Measured memory_bytes: 256
function Main(input) {
  input = input.split("\n");
  var S = input[0].split("/");
  var ans = "Heisei";
  if(parseInt(S[0])>=2020||(parseInt(S[0])>=2019&&parseInt(S[1])>=5)){
    ans ="TBD";
  }


  console.log('%s', ans);
  return ans;
}
// "実行する"ボタンを押した時に実行される関数 (デバッグ用)
function debug(n){
  var input = document.getElementById("input"+n).value;
  Main(input);
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));

Measured memory_bytes: 7372
#include <cstdio>
#include <cstdlib>
#include <limits>
#include <cmath>
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <map>
#include <complex>
using namespace std;


int main() {
	int c[3][3];
	int sumc = 0;
	for(int i=0; i < 3; i++) {
		for (int j = 0; j < 3; j++) {
			cin >> c[i][j];
			sumc += c[i][j];
		}
	}
	sumc /= 3;
	if (sumc == c[0][0] + c[1][1] + c[2][2] && sumc == c[1][0] + c[2][1] + c[0][2] && sumc == c[2][0] + c[0][1] + c[1][2]) {
		cout << "Yes" << endl;
	}
	else
		cout << "No" << endl;
	return 0;
}


Measured memory_bytes: 256
/**
        	C++14 (GCC 5.4.1)
**/
#include <iostream>
#include <cmath>
#include <algorithm>
#include <string>
#include <vector>
#include <set>
using namespace std;

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

    P += A * 3;

    cout << P / 2 << endl;
    return 0;
}

Measured memory_bytes: 256
import java.util.*;
public class Main{
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        if(n%2==0){
          System.out.println(n/2);
        }
        else{
          System.out.println(n/2+1);
        }
	}
}

Measured memory_bytes: 23764
package main

import (
	"fmt"
	"os"
)

func main() {
	var N int
	fmt.Scan(&N)
	var H []int = make([]int, N)

	for i, _ := range H {
		fmt.Scan(&H[i])
	}

	for i := 0; i < N-1; i++ {
		if H[i] <= H[i+1] {
			continue
		}
		if H[i]-1 <= H[i+1] {
			H[i+1]++
			continue
		}
		fmt.Println("No")
		os.Exit(0)
	}
	fmt.Println("Yes")

}


Measured memory_bytes: 5504
#include <bits/stdc++.h>
#define ll long long
using namespace std;
const int N = 1e5 + 7;

#define inc(i, x, y) for (int i = x; i <= y; ++i)
#define dec(i, x, y) for (int i = x; i >= y; --i)
#define gc getchar

bool chkmin(int &x, int y) { return x > y ? x = y, 1 : 0; }
bool chkmax(int &x, int y) { return x < y ? x = y, 1 : 0; }

int rd() {
	int ret = 0; bool fl = 0; char ch = 0;
	while (!isdigit(ch)) fl |= (ch == '-'), ch = gc();
	while (isdigit(ch)) ret = (ret << 1) + (ret << 3) + (ch ^ 48), ch = gc();
	return fl ? -ret : ret;
}

#define go(i, v, x) for (int i = head[x], v = e[i].to; i; i = e[i].nxt, v = e[i].to)
struct edge { int nxt, to; } e[N << 1];
int head[N], cnt;
void add(int u, int v) {
	e[++cnt] = (edge) { head[u], v }; head[u] = cnt;
	e[++cnt] = (edge) { head[v], u }; head[v] = cnt;
}

int dfs(int x, int fa) {
	int ret = 0;
	go(i, v, x) if (v != fa) ret += dfs(v, x);
	if (ret > 1) puts("First"), exit(0);
	return (ret ^ 1);
} 

int main() {
	int n = rd();
	inc(i, 1, n - 1) add(rd(), rd());
	puts(dfs(1, -1) ? "First" : "Second");
}

Measured memory_bytes: 2176
n=int(input())
a=list(map(int,input().split()))
right,ans,sum_xor,sum=1,0,a[0],a[0]

for left in range(n):
  if left==right:
    right=left+1
    sum_xor^=a[left]
    sum+=a[left]
  while right<n and sum_xor^a[right]==sum+a[right]:
    sum_xor^=a[right]
    sum+=a[right]
    right+=1
  ans+=right-left
  sum_xor^=a[left]
  sum-=a[left]
print(ans)

Measured memory_bytes: 100228
#include <bits/stdc++.h>
typedef long long int LL;
typedef unsigned long long int ULL;
using namespace std;

// 插入此處

int main() {
    std::ios::sync_with_stdio(false);
    cin.tie(0);
    int N, X, T;
    cin >> N >> X >> T;
    int ans = N / X * T;
    if (N % X)  ans += T;
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3644
mod = 10**9+7

def comb(n,m,p=10**9+7):
    if n < m : return 0
    if n < 0 or m < 0:return 0
    m = min(m, n-m)
    top = bot = 1
    for i in range(m):
        top = top*(n-i) % p
        bot = bot*(i+1) % p
    bot = pow(bot, p-2, p)
    return top*bot % p

n,a,b = map(int, input().split())
ans = pow(2, n, mod)-1 - comb(n,a) - comb(n, b)
ans %= mod
print(ans)


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

#define ALL(v) v.begin(), v.end()
#define V vector
#define P pair
#define ld long double
#define ll long long

const int MOD =  1000000007;
const int IINF = INT_MAX;
const ll INF = 1LL << 60;

vector<long long> enum_divisors(ll N){
    vector<ll> res;
    for(ll i = 1; i * i <= N; i++){
        if(N % i == 0){
            res.push_back(i);
            if(N / i != i) res.push_back(N / i);
        }
    }
    sort(res.begin(), res.end());
    return res;
}

int main() {
    ll n, m; cin >> n >> m;

    V<ll> v = enum_divisors(m);
    ll ans = 0;
    for(int i = 0; i < (int)v.size(); i++){
        if(v[i] * n <= m) ans = max(ans, v[i]);
    }
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 3580
#include <bits/stdc++.h>
#define int long long
#define double long double
#define rep(i, a, n) for(int i = (int)(a);(i) < (int)(n);++(i))
#define repe(i, a, n) for(int i = (int)(a);(i) <= (int)(n);++(i))
#define repif(i, a, x) for(int i = (int)(a);(x);++(i))
#define repr(i, a, n) for(int i = ((int)(a)-1);(i) >= (int)(n);--(i))
#define reper(i, a, n) for(int i = (int)(a);(i) >= (int)(n);--(i))
#define SZ(x) ((int)(x).size())
#define ALL(x) begin(x), end(x)
#define CEIL(x) ((int)ceil(((double)x)))
#define POW(x, y) ((int)pow(x, y))
#define UNIQUE(x) (x).erase(unique(ALL((x))), end(x))
#define gcd(x, y) __gcd(x, y)
#define lcm(x, y) ((x)/gcd(x,y)*(y))
#define isin(x, l, r) ((l) <= (x) and (x) < (r))
#define fcout cout << fixed << setprecision(10)
#define rcout(n) cout << right << setw(n)
#define pb push_back
#define eb emplace_back
#define lb lower_bound
#define ub upper_bound
#define PI (acos(-1))
#define EPS (1e-10)
#define INF LLONG_MAX
#define INF32 INT32_MAX
#define MOD 1000000007LL
using namespace std;
using VI = vector<int>;
using PII = pair<int, int>;
using TIII = tuple<int, int, int>;
using VPII = vector<PII>;
using VTIII = vector<TIII>;
using Complex = complex<double>;
template<typename T, template<typename> typename C = less> using PQ = priority_queue<T, vector<T>, C<T>>;
template<typename T> bool chmax(T& a, const T& b, bool t = false){ if(a<b or (t and a == b)){ a=b; return true; } return false; }
template<typename T> bool chmin(T& a, const T& b, bool t = false){ if(a>b or (t and a == b)){ a=b; return true; } return false; }


int N, D, A;
PII M[200010];
int dmg[200010];


signed main(){
    cin >> N >> D >> A;
    rep(i, 0, N) cin >> M[i].first >> M[i].second;

    sort(M, M+N);

    int i = 0, ans = 0;
    while(i < N){
        int c = CEIL((M[i].second-dmg[i])/A);
        ans += c;
        int rm = ub(M, M+N, make_pair(M[i].first+2*D, -1), [](auto p, auto v){ return p.first < v.first; })-M;
        dmg[i] += c*A;
        dmg[rm] -= c*A;
        while(i < rm){
            if(M[i].second-dmg[i] > 0) break;
            dmg[i+1] += dmg[i];
            i++;
        }
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 4992
#include <bits/stdc++.h>
using namespace std;
#define FAST ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
typedef long long ll;

int main()
{

    int n;
    cin>>n;

    int ans[n];
    int arr[n-1];

    for(int i=0;i<n-1;i++)
    {
        cin>>arr[i];
    }

    ans[0] = arr[0];
    int sum = ans[0];
    for(int i=1;i<n-1;i++)
    {
        ans[i] = min(arr[i],arr[i-1]);
        sum+=ans[i];
    }
    sum+=arr[n-2];
    cout<<sum<<endl;

    return 0;
}


Measured memory_bytes: 3588
/*
title:

url:
*/

#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <functional>
#include <queue>
#include <limits>
#include <string>
#include <utility>
#include <cstring>
#include <map>
#include <cmath>
#include <iterator>

using namespace std;

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

typedef pair<int, int> pint;
typedef long long ll;

signed main()
{
    int n, h;
    cin >> n >> h;
    //huru, nageru
    priority_queue<int> hr, ng;
    rep(i, n)
    {
        int a, b;
        cin >> a >> b;
        hr.push(a);
        ng.push(b);
    }
    int ans = 0;
    while (h > 0)
    {
        if (ng.empty() || hr.top() > ng.top())
        {
            ans += h / hr.top();
            if (h % hr.top() != 0)
                ans++;
            break;
        }
        else
        {
            h -= ng.top();
            ans++;
            ng.pop();
        }
    }
    cout << ans << endl;
}

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

int main(){
	using ll = long long ;
	ll n,k ;
	cin >> n >> k ;
	vector<ll> p(n) ;
	vector<ll> sum ;
	ll sub = 0 ;
	for(ll i=0;i<n;i++){
		ll x ; cin >> x ;
		p.at(i) = x ;
		if(i<k-1) sub += x ;
		else if(i==k-1){
			sub += x ;
			sum.push_back(sub) ;
		}else{
			sum.push_back(sum.at(sum.size()-1)+x-p.at(i-k)) ;
		}
	}
	sort(sum.begin(),sum.end()) ;
	ll ans = (sum.at(sum.size()-1)+k) ;
	cout << fixed << setprecision(5) << (double)ans/2 << endl ;
}


Measured memory_bytes: 3956
import java.io.*;
import java.io.IOException;
import java.util.*;

class Main {
    final static int INF = 1 << 28;
    final static long LNF = 1L << 60;
    final static double EPS = 1e-9;
    final static double GOLDEN_RATIO = (1.0 + Math.sqrt(5)) / 2.0;

    static final long MOD = 1_000_000_007;

    public static void main(String[] args) throws Exception {
        final MyScanner sc = new MyScanner();
        long N;
        N = sc.nextLong();
        long[] d = new long[(int)(N)];
        for(int i = 0 ; i < N ; i++){
                d[i] = sc.nextLong();
        }
        solve(N, d);
    }

    static void solve(long N, long[] d){
        HashSet<Long> hoge = new HashSet<>();
        for (Long long1 : d) {
            hoge.add(long1);
        }
        System.out.println(hoge.size());
        
    }


    static class MyScanner {
 
        BufferedReader br;
        StringTokenizer st;
 
        MyScanner(FileReader fileReader) {
            br = new BufferedReader(fileReader);
        }
 
        MyScanner() {
            br = new BufferedReader(new InputStreamReader(System.in));
        }
 
        String nn() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }
 
        String next() {
            String ans = "";
            try {
                ans = br.readLine();
            } catch (IOException ex) {
                ex.printStackTrace();
            }
            return ans;
        }
 
        char nextChar() {
            return nn().charAt(0);
        }
 
        int nextInt() {
            return Integer.parseInt(nn());
        }
 
        long nextLong() {
            return Long.parseLong(nn());
        }
 
        double nextDouble() {
            return Double.parseDouble(nn());
        }
 
        Integer[] niArr0(int n) {
            Integer[] ar = new Integer[n];
            for (int i = 0; i < n; i++) {
                ar[i] = nextInt();
            }
            return ar;
        }
 
        Integer[] niArr1(int n) {
            Integer[] ar = new Integer[n + 1];
            for (int i = 1; i <= n; i++) {
                ar[i] = nextInt();
            }
            return ar;
        }
 
        Long[] nlArr0(int n) {
            Long[] ar = new Long[n];
            for (int i = 0; i < n; i++) {
                ar[i] = nextLong();
            }
            return ar;
        }
 
        Long[] nlArr1(int n) {
            Long[] ar = new Long[n + 1];
            for (int i = 1; i <= n; i++) {
                ar[i] = nextLong();
            }
            return ar;
        }
    }

}


Measured memory_bytes: 22996
#include<bits/stdc++.h>
#define eps 1e-9
#define MOD 1000000007
#define INV_10 299473306
#define INF 1000000000
using namespace std;
int main()
{
	ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
	int n;
	cin >> n;
	set<string>se;
	string s;
	while(n--)
	{
		cin >> s;
		se.insert(s);
	}
	cout << se.size() << '\n';
}

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

int main(){
  long long int a, b, k; cin >> a >> b >> k;
  if(a - k >= 0) cout << a - k << " " << b << endl;
  else if(b - (k - a) >= 0) cout << 0 << " " << b - (k - a) << endl;
  else cout << 0 << " " << 0 << endl;
  return 0;

}


Measured memory_bytes: 256
def prime(n):
  if n==1:
    return False
  elif n==2 or n==3:
    return True
  else:
    for i in range(2,int(n**0.5)+1):
      if n%i==0:
        return False
    else:
      return True

ans=[0]*(10**5+1)
for i in range(3,10**5+1,2):
  if prime(i) and prime((i+1)//2):
    ans[i]=1
for i in range(1,10**5+1):
  ans[i]=ans[i]+ans[i-1]
q=int(input())
for i in range(q):
  l,r=map(int,input().split())
  print(ans[r]-ans[l-1])

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

using namespace std;

int helper(vector<int> a, int n)
{
    vector<int>dp(n,0);
    dp[0]=0;
    dp[1]=abs(a[0]-a[1]);
    
    for(int i=2;i<n;i++)
    {
        dp[i]=min(dp[i-2]+abs(a[i]-a[i-2]),dp[i-1]+abs(a[i-1]-a[i]));
    }
    return dp.back();
}

int main()
{
    int n;
    cin>>n;
    vector<int> a(n,0);
    for(int i=0;i<n;i++)
    {
        cin>>a[i];
    }
    int res=helper(a,n);
    cout<<res<<endl;
    
}

Measured memory_bytes: 1408
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)
#define repr(i,x,n) for(int i=x; i<(n); i++)
#define ALL(x) (x).begin(),(x).end()
typedef long long ll;
#define INF 1e9
typedef vector<int> VI;
typedef vector<string> VS;
int main()
{
string cofee;

    cin>>cofee;

if (cofee[2]==cofee[3]&&cofee[4]==cofee[5])
{
   cout<<"Yes"<<endl;
}
else
{
    cout<<"No"<<endl;
}

    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define FOR(i,a,b) for(long long i = (long long)(a); i < (long long)(b); i++)
#define RFOR(i,a,b) for(long long i = (long long)(a); i >= (long long)(b); i--)
#define MIN3(a,b,c) (a)<(b)?((a)<(c)?(a):(c)):((b)<(c)?(b):(c))
#define MAX(a,b) (a)>(b)?(a):(b)
#define MIN2(a,b) (a)<(b)?(a):(b)
using namespace std;
typedef pair<int, int> ii;
typedef pair<int, ii> iii;
typedef vector<ii> vii;
typedef vector<int> vi;
typedef long long ll;
#define ull unsigned long long
typedef long double ld;
typedef vector<ll> vll;
typedef pair<ll,ll> lll;
#define deb(x )     cerr << #x << " here "<< x << endl;
#define endl    "\n"
#define printCase() "Case #" << caseNum << ": "
inline bool is_palindrome(const string& s){ return std::equal(s.begin(), s.end(), s.rbegin()); }
const ll MOD = 1000000007;
const ll INF = 1e9+5;
const double eps = 1e-7;
const double PI = acos(-1.0);
#define coud(a,d) cout << fixed << showpoint << setprecision(d) << a;
inline void debug_vi(vi a) {FOR(i, 0, a.size()) cout<<a[i]<<" ";}
inline void debug_vll(vll a) {FOR(i, 0, a.size()) cout<<a[i]<<" ";}
#define ff first
#define ss second
/*----------------------------------------------------------------------*/

int main(){
    std::ios::sync_with_stdio(false);cin.tie(NULL); cout.tie(NULL);

    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    long double ans = 0;
    int n; cin>>n; int a;
    FOR(i, 0, n) {
    	cin>>a;
    	ans += 1.0/a;
    }
    ans = 1.0 / ans;
    coud(ans, 10);

    return 0;
}

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

int main(void){
    ll n, ans = 0;
    cin >> n;
    vector<int> a(n);
    for(int i = 0; i < n; i++) cin >> a[i];
    sort(a.begin(), a.end());
    vector<bool> flag(a.back()+1, true);
    for(int i = 0; i < n; i++) if(flag[a[i]]) for(int j = 2*a[i]; j < a.back()+1; j += a[i])
        flag[j] = false;
    if(n == 1) {
        ans = 1;
    } else if(n == 2){
        if(a[0] == a[1]) ans = 0;
        else if(a[1] % a[0] == 0) ans = 1;
        else ans = 2;
    } else {
        if(flag[a[0]] && (a[0] != a[1])) ans++;
        for(int i = 1; i < n-1; i++) if(flag[a[i]] && (a[i-1] != a[i]) && (a[i] != a[i+1])) ans++;
        if(flag[a[n-1]] && (a[n-2] != a[n-1])) ans++;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3960
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <climits>
#include <iomanip>
#include <cmath>

using namespace std;

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

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout << fixed << setprecision(10);
    
    long long a, b;
    cin >> a >> b;
    
    cout << a*b/f(max(a,b),min(a,b)) << endl;
    
    
    return 0;
}


Measured memory_bytes: 256
X, N = map(int, input().split())
if N == 0:
    print(X)
else:
    p = sorted(map(int, input().split()))
    nums = [num for num in range(102) if not num in p]
    A = [abs(num - X) for num in nums]
    print(nums[A.index(min(A))])

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

int main()
{
	while (true)
	{
		int m, f, r;
		cin >> m >> f >> r;

		if (m < 0 && f < 0 && r < 0)
		{
			break;
		}
		
		if (m < 0 || f < 0)
		{
			cout << "F";
		}
		else
		{
			if (m + f >= 80)
			{
				cout << "A";
			}
			else if (m + f >= 65)
			{
				cout << "B";
			}
			else if (m + f >= 50)
			{
				cout << "C";
			}
			else if (m + f >= 30)
			{
				if (r >= 50)
				{
					cout << "C";
				}
				else
				{
					cout << "D";
				}
			}
			else
			{
				cout << "F";
			}
		}
		cout << endl;
	}
}


Measured memory_bytes: 3080
//a[i]<x<=a[i+1]:first to x,then keep adding 1
//contribution=x-a[i]-1
//a[i+1]<a[i]<x:first to x,then keep adding 1
//contribution=x-a[i]-1
//x<=a[i+1]<a[i]:first to x,then keep adding 1
//contribution=(m-a[i]-1)+x
#include<cstdio>
#include<vector>
using namespace std;
int n,m,a[100010],i,j,num,now;
vector<int> c[100010],d[100010],e[100010],f[100010];
long long anss,s,ans[100010],sum;
int main()
{
	scanf("%d%d",&n,&m);
	for (i=1;i<=n;i++) scanf("%d",&a[i]);
	for (i=1;i<n;i++)
	{
		if (a[i]<a[i+1])
		{
			c[a[i]].push_back(i);
			d[a[i+1]].push_back(i);
		}
		else 
		{
			e[a[i]].push_back(i);
			f[a[i+1]].push_back(i);
			num++;
			s+=m-a[i]-1;
		}
	}
	now=0;//how many intervals 
	sum=0;//current contribution
	for (i=2;i<=m;i++)
	{
		if (d[i-1].size()!=0)
		{
			for (j=0;j<d[i-1].size();j++)
			{
				now--;
				int t=d[i-1][j];
				sum-=a[t+1]-a[t]-1;
			}
		}
		sum+=now;
		ans[i]+=sum;
		now+=c[i-1].size();
	}
	now=0;sum=0;
	for (i=2;i<=m;i++)
	{
		sum+=now;
		ans[i]+=sum;
		now+=e[i-1].size();
	}
	now=num;sum=s;
	//m-a[i]-1+x
	for (i=1;i<=m;i++)
	{
		sum+=now;
		ans[i]+=sum;
		if (f[i].size()!=0)
		{
			for (j=0;j<f[i].size();j++)
			{
				now--;
				int t=f[i][j];
				sum-=m-a[t]-1+a[t+1];
			}
		}
	}
	anss=0;
	for (i=1;i<=m;i++)
	  if (ans[i]>anss) anss=ans[i];
	anss=-anss;
	for (i=1;i<n;i++)
	{
		if (a[i]<a[i+1]) anss+=a[i+1]-a[i];
		else anss+=a[i+1]+m-a[i];
	}
	printf("%lld\n",anss);
}

Measured memory_bytes: 15488
import bisect

N = int(input())
A = []
for i in range(N):
  A.append(int(input()))

dp = []
for a in A:
  if len(dp)==0:
    dp.append(a)
  elif a > dp[-1]:
    dp.append(a)
  else:
    pos = bisect.bisect_left(dp, a)
    dp[pos] = a

print(len(dp))


Measured memory_bytes: 10340
#include<stdio.h>
#define N 8
#define FREE 0
#define NOT_FREE 1

int row[N], col[N], dpos[N + N - 1], dneg[N + N - 1], A[N][N];

void putQueen(int i){
  int j;

  if(i == N){
    for(i = 0; i < N; i++){
      for(j = 0; j < N; j++){
        if(A[i][j] == NOT_FREE){
          if(row[i] != j)
            return ;
        }
      }
    }

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

  for(j = 0; j <= N - 1; j++){
    if(col[j] == NOT_FREE || dpos[i + j] == NOT_FREE || dneg[i - j + N - 1] == NOT_FREE)
      continue;

    row[i] = j;
    col[j] = dpos[i + j] = dneg[i - j + N - 1] = NOT_FREE;

    putQueen(i + 1);

    col[j] = dpos[i + j] = dneg[i - j + N - 1] = FREE;
  }
}

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

  for(i = 0; i < N + N - 1; i++){
    if(i < N)
      col[i] = dpos[i] = dneg[i] = FREE;
    else
      dpos[i] = dneg[i] = FREE;
  }

  scanf("%d", &k);

  for(i = 0; i < k; i++){
    scanf("%d%d", &r, &c);
    A[r][c] = NOT_FREE;
  }

  putQueen(0);

  return 0;
}



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

int main() {
	int N, T[100], M;
	int sum = 0;
	int drink[100][2];//1つ目が何番目かを表し、２つ目が何に代わるかを表す。
	cin >> N;
	for (int i = 0; i < N; i++) {
		cin >> T[i];
		sum += T[i];
	}

	cin >> M;
	for (int i = 0; i < M; i++) {
		cin >> drink[i][0] >> drink[i][1];
	}

	for (int i = 0; i < M; i++) {
		cout << sum - T[drink[i][0]-1] + drink[i][1] << endl;
	}

}

Measured memory_bytes: 256
a,b=map(int,input().split())
s1=[1, 3, 5, 7, 8, 10, 12]
s2=[4, 6, 9, 11]
s3=[2]
if (a in s1 and b in s1) or(a in s2 and b in s2)or(a in s3 and b in s3):
  print("Yes")
else:
  print("No")

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

int main() {
  int n[3];
  for ( int i = 0; i < 3; i++ ) { cin >> n[i]; }
  sort(n, n+3);
  cout << 10*n[2] + n[1] + n[0] << endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, a, n) for(int i = a; i < n; i++)
#define int long long
using namespace std;
typedef pair<int, int> P;
const int mod = 1000000007;
const int INF = 1e18;

struct Combination {
    vector<int64_t> fact, rfact;
    Combination(int sz) : fact(sz + 1), rfact(sz + 1) {
        fact[0] = 1;
        for(int i = 1; i < fact.size(); i++){
            fact[i] = fact[i - 1] * i % mod;
        }
        rfact[sz] = inv(fact[sz]);
        for(int i = sz - 1; i >= 0; i--){
            rfact[i] = rfact[i + 1] * (i + 1) % mod;
        }
    }
    int64_t inv(int x) const {
        return pow(x, mod - 2);
    }
    int64_t pow(int64_t x, int64_t n) const {
        int64_t ret = 1;
        while(n > 0){
            if(n & 1) (ret *= x) %= mod;
            (x *= x) %= mod;
            n >>= 1;
        }
        return (ret);
    }
    int64_t P(int n, int r) const {
        if(r < 0 || n < r) return (0);
        return (fact[n] * rfact[n - r] % mod);
    }

    int64_t C(int p, int q) const {
        if(q < 0 || p < q) return (0);
        return (fact[p] * rfact[q] % mod * rfact[p - q] % mod);
    }

    int64_t H(int n, int r) const {
        if(n < 0 || r < 0) return (0);
        return (r == 0 ? 1 : C(n + r - 1, r));
    }
};

signed main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int b, w;
    cin >> b >> w;
    Combination comb(b + w);
    vector<int> p(b + w), q(b + w);
    p[0] = q[0] = 0;
    rep(i, 1, b + w){
        (p[i] = p[i - 1] + comb.C(i - 1, b - 1) * comb.inv(comb.pow(2, i)) % mod) %= mod;
        (q[i] = q[i - 1] + comb.C(i - 1, w - 1) * comb.inv(comb.pow(2, i)) % mod) %= mod;
    }
    rep(i, 0, b + w){
        int ans = (1 - p[i] + q[i] + mod) % mod * comb.inv(2) % mod;
        cout << ans << endl;
    }
}

Measured memory_bytes: 8448
#include<iostream>
#include<stdio.h>
#include<string>
#include<cmath>
#include<math.h>
#include<vector>
#include<algorithm>
#include<map>
#pragma warning(disable: 4996)
#define rep(i,n) for(int i = 0; i < (n); i++)
using namespace std;
using ll = long long;

int isprime(int x) {
	if (x == 2) { return true; }
	if (x < 2 || x % 2 == 0) {
		return false;
	}
	int sqrtx = sqrt(x);

	int i = 3;
	while (i <= sqrtx) {
		if (x % i == 0) {
			return false;
		}
		i += 2;
	}
	return true;
}

int main() {

	int X;
	cin >> X;

	while (1) {
		if (isprime(X) == true) { break; }
		X++;

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

Measured memory_bytes: 256
# 要復習
import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd
from bisect import bisect
 
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def S_MAP(): return map(str, input().split())
def LIST(): return list(map(int, input().split()))
def S_LIST(): return list(map(str, input().split()))
 
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

def main():
    N = INT()
    B = LIST()

    B.insert(0, INF)
    B.append(INF)
    A = []
    for i in range(1, N+1):
        A.append(min(B[i-1], B[i]))
    print(sum(A))
    

if __name__ == "__main__":
    main()




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

#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 ll long long
#define MOD 1000000007
#define LLMN LONG_LONG_MIN
#define LLMX LONG_LONG_MAX
#define MAX 1000000


ll  fastpower(ll a, ll n)
{
    ll res = 1;
    while(n > 0)
    {
        if(n % 2 != 0)
        {
            res = (res * a) % MOD;
        }
        n /= 2;
        a=(a * a) % MOD;
    }
    return res;
}

void getprime(vector<bool>&prime)
{
    prime[0] = false;
    prime[1] = false;
    
    for(ll i = 2;i <= MAX; i++)
    {
        if(prime[i])
        {
            for(ll j = i*i; j <= MAX; j += i)
                prime[j] = false;
        }
    }
}

void getfact(vector<ll>&fact, vector<ll>&factinv)
{
    fact[0] = 1;
    factinv[0] = 1;
    
    for(ll i = 1; i <= MAX; i++)
        fact[i] = (fact[i-1] * i)%MOD;
    
    for(ll i = 1; i <= MAX; i++)
        factinv[i] = (factinv[i-1] * fastpower(i, MOD -2) )%MOD;

}


int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    ll t,n,m,k,q;
    cin>>n;
    long double ld;
    cin>>ld;
    k = (1.0*n*ld);
    cout<<k;
    return 0;
}


Measured memory_bytes: 3744
#include <cstdio>
#include <algorithm>
using namespace std;
#define REP(i, n) for(int i = 0; i < (int)(n); ++i)

int vs[110];

int main(void) {
  int n;
  scanf("%d", &n);
  REP(i, n) {
    scanf("%d", &vs[i]);
  }

  int res = 1000000000;
  for(int v = -100; v <= 100; ++v) {
    int cur = 0;
    REP(i, n) {
      cur += (vs[i]-v) * (vs[i]-v);
    }
    res = min(res, cur);
  }
  printf("%d\n", res);
  return 0;
}


Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
#define MOD 1000000007
#define BIG 1000000010
#define repi(i,x,n) for(int i=x;i<n;i++)
#define rep(i,n) repi(i,0,n)
#define repn(i,n) for(int i=n;i>=0;i--)
typedef long long int ll;


string a,b,c;
int aa=1,bb=0,cc=0;

char A(int d){
  char s=a[d];
  aa++;
  return s;
}
char B(int e){
  char s=b[e];
  bb++;
  return s;
}
char C(int f){
  char s=c[f];
  cc++;
  return s;
}


int main(){
  cin>>a>>b>>c;
  char z=a[0];
  while(1){
    if(z=='a'){
      if(aa==a.size()) break;
      z=A(aa);
    }
    else if(z=='b'){
      if(bb==b.size()) break;
      z=B(bb);
    }
    else{
      if(cc==c.size()) break;
      z=C(cc);
    }
  }
  cout<<char(z-32)<<endl; 

  return 0;
}







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

const ll mod = 1e9+7;
const ll INF = 1e18;
const double pi = acos(-1.0);

int main(void)
{
    ll n,m,x; cin>>n>>m>>x;
    vector<ll> a(n);
    ll ans=INF,l=0,r=0;
    rep(i,m){
        cin>>a[i];
        if(a[i]<x) l++;
        else r++;
    }
    ans=min(l,r);
    cout<<ans<<endl;
    return 0;
}

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

vector<int> rd [200005] ;
vector<int> ans   ;

void dfs(int x, int y = -1){
    for(int u : rd[x]){
        if(u == y){
            continue ;
        }
        ans[u] += ans[x] ;
        dfs(u, x) ;
    }
}
int main (){
    int n, q ;
    cin >> n >> q ;
    rep(i, n -1 ){
        int a, b ;
        cin >> a >> b ;
        a-- ; b-- ;
        rd[a].push_back(b) ;
        rd[b].push_back(a) ;
    }
    ans.resize(n) ;
    rep(i, q){
        int p, x ;
        cin >> p >> x ;
        p-- ;
        ans[p] += x ;
    }
    dfs(0) ;
    rep(i, n){
        cout << ans[i] << " ";
    }
    cout << endl ;

}


Measured memory_bytes: 24300
#include <algorithm>
#include <cmath>
#include <vector>
#include <functional>
#include <cstdlib>
#include <map>
#include <set>
#include <iostream>
#include <string>
#include <ctype.h>
using namespace std;
#define REP(i, n) for(int i = 0; i < (int)(n); i++)
typedef long long lint;


int main(){
   int a,b,c;
   cin >> a >> b >> c;
   
   if(a+b+c >= 22) cout<<"bust\n";
   else cout<<"win\n";
   
   return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
    public static void main(String args[]){
        Scanner stdIn = new Scanner(System.in);
        int n = stdIn.nextInt();
        
        //int x = stdIn.nextInt();
        int a[] = new int[n];
        //String s = stdIn.next();
        //String t = stdIn.next();
        //char c[] = s.toCharArray();
        //int sum = 0;
        //boolean flag = true;
        for(int i = 0; i < n; i++){
            a[i] = stdIn.nextInt();
        }
        
        int m = stdIn.nextInt();
        int b[] = new int[m];
        for(int i = 0; i < m; i++){
            b[i] = stdIn.nextInt();
        }
        
        boolean flag = false;
        
        for(int i = 0; i < Math.min(m, n); i++){
            if(a[i] > b[i]){
                System.out.println(0);
                flag = true;
                break;
            }else if(a[i] < b[i]){
                System.out.println(1);
                flag = true;
                break;
            }
        }
        
        if(!flag){
            if(m > n){
                System.out.println(1);
            }else{
                System.out.println(0);
            }
        }
        //System.out.println(sum);

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

        stdIn.close();
    }
}




Measured memory_bytes: 32304
import numpy as np
N, D = map(int, input().split())
X = []
for _ in range(N):
    x = list(map(int, input().split()))
    X.append(x)
ans = 0
for i in range(N-1):
    for j in range(i+1, N):
        dis = 0
        for d in range(D):
            dis += (X[i][d] - X[j][d])**2
        distance = np.sqrt(dis)
        if distance.is_integer():
            ans += 1
print(ans)

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

int main()
{
	char s[16][16]={0};
	while(cin >> s[0])
	{
		int y,x; char c;
		for(y=1; y<8; y++)
		cin >> s[y];

		for(y=0; y<8; y++)
		for(x=0; x<8; x++)
		s[y][x]-='0';

		for(y=0; y<64; y++)
		if(s[y/8][y%8])break;

		x=y%8; y/=8;

		     if(s[y+3][x  ]) c='B';
		else if(s[y  ][x+3]) c='C';
		else if(s[y+1][x+2]) c='E';		
		else if(s[y+2][x+1]) c='F';
		else if(s[y+1][x+1]) c='A';
		else if(s[y  ][x+1]) c='G';
		else                 c='D';

		cout << c << endl;
	}
}

Measured memory_bytes: 0