akhauriyash/Code-Regression huggingface dataset:
import os
import heapq
import sys,threading
import math
import bisect
import operator
from collections import defaultdict
sys.setrecursionlimit(10**5)
from io import BytesIO, IOBase
def gcd(a,b):
    if b==0:

        return a
    else:
        return gcd(b,a%b)
def power(x, p,m):
    res = 1
    while p:
        if p & 1:
            res = (res * x) % m
        x = (x * x) % m
        p >>= 1
    return res
def inar():
    return [int(k) for k in input().split()]

def lcm(num1,num2):
    return (num1*num2)//gcd(num1,num2)

def main():
    #t=int(input())
    t=1
    for _ in range(t):
        st=input()
        c=0
        ans=0
        res=0
        for i in range(3):
            if c==0 and st[i]=="R":
                c=1
                ans+=1
                continue
            if c==1 and st[i]=="R":
                ans+=1
            else:
                res=max(res,ans)
                ans=0
        res=max(res,ans)
        print(res)





BUFSIZE = 8192


class FastIO(IOBase):
    newlines = 0

    def __init__(self, file):
        self._fd = file.fileno()
        self.buffer = BytesIO()
        self.writable = "x" in file.mode or "r" not in file.mode
        self.write = self.buffer.write if self.writable else None

    def read(self):
        while True:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            if not b:
                break
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines = 0
        return self.buffer.read()

    def readline(self):
        while self.newlines == 0:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            self.newlines = b.count(b"\n") + (not b)
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines -= 1
        return self.buffer.readline()

    def flush(self):
        if self.writable:
            os.write(self._fd, self.buffer.getvalue())
            self.buffer.truncate(0), self.buffer.seek(0)


class IOWrapper(IOBase):
    def __init__(self, file):
        self.buffer = FastIO(file)
        self.flush = self.buffer.flush
        self.writable = self.buffer.writable
        self.write = lambda s: self.buffer.write(s.encode("ascii"))
        self.read = lambda: self.buffer.read().decode("ascii")
        self.readline = lambda: self.buffer.readline().decode("ascii")


sys.stdin, sys.stdout = IOWrapper(sys.stdin), IOWrapper(sys.stdout)
input = lambda: sys.stdin.readline().rstrip("\r\n")

if __name__ == "__main__":
    main()
    #threadin.Thread(target=main).start()


Measured memory_bytes: 74812
/*######################################################
#########~~~~~####~~~~###~~##~~##~~##~~##~~##~~#########
#########~~##~~##~~##~~##~~~#~~##~~~#~~##~~##~~#########
#~~~~~~##~~~~~###~~~~~~##~~#~~~##~~#~~~##~~##~~##~~~~~~#
#########~~######~~##~~##~~##~~##~~##~~##~~##~~#########
#########~~######~~##~~##~~##~~##~~##~~###~~~~##########
######################################################*/
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("O3")
#define ll long long
#define str string
#define rtn return
#define endl '\n'
#define F first
#define S second
#define pb push_back
#define db long double
#define MOD 1000000007
#define INF 1e18
#define EPS 1e-15
#define pll pair <ll, ll>
#define vi vector<ll>
#define vpll vector<pll>
#define value_at find_by_order
#define index_of order_of_key
#define fill(a,v) memset(a,v,sizeof(a))
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define rep(i,n) for(ll i=0;i<n;++i)
#define per(i,n) for(ll i=n-1;i>=0;--i)
#define loop1(i, n) for (int i=1;i<=n;++i)
#define loop(i, begin, end) for (__typeof(end) i = (begin)-((begin)>(end));i!=(end)-((begin)>(end));i+=1-2*((begin)>(end)))
#define FAST_IO std::ios_base::sync_with_stdio(false);std::cin.tie(NULL);std::cout.tie(NULL)

#define TRACE
#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
    cerr << name << " = " << arg1 << '\n';
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
  const char* comma = strchr(names + 1, ',');
  cerr.write(names, comma - names) << " = " << arg1 << " |";
  __f(comma+1, args...);
}
#else
#define trace(...)
#endif

template<class T> void remin(T &a, T b) {a = min(a, b);}
template<class T> void remax(T &a, T b) {a = max(a, b);}
template <class T> using Tree = tree<T, null_type, less<T>, rb_tree_tag,tree_order_statistics_node_update>;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

#define N 100005

int n;
int h[N];
int dp[N];

int solve(int i) {
  if (i == n - 1) rtn 0;
  if (dp[i] != -1) rtn dp[i];
  dp[i] = INF;
  if (i < n - 1) {
    remin(dp[i], abs(h[i] - h[i + 1]) + solve(i + 1));
  }
  if (i < n - 2) {
    remin(dp[i], abs(h[i] - h[i + 2]) + solve(i + 2));
  }
  rtn dp[i];
}

int main() {
  FAST_IO;
  fill(dp, -1);
  cin >> n;
  rep(i, n) cin >> h[i];
  cout << solve(0);
  rtn 0;
}


Measured memory_bytes: 4224
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
#define Would
#define you
#define please

int main() {


	int A, B, C;
	cin >> A >> B >> C;

	int saishou = 1e9;
	rep(i, 52) {
		int kariA = A;
		int kariB = B;
		int kariC = C;

		int kari = 0;
		while (kariA < i) {
			kariA += 2;
			kari++;
		}
		kari += kariA - i;
		while (kariB < i) {
			kariB += 2;
			kari++;
		}
		kari += kariB - i;
		while (kariC < i) {
			kariC += 2;
			kari++;
		}
		kari += kariC - i;

		saishou = min(saishou, kari);
	}
	co(saishou);

	Would you please return 0;

}

Measured memory_bytes: 256
N=int(input())+2
A=[0]+list(map(int,input().split(" ")))+[0]

import fractions
from functools import reduce

proc = lambda x: reduce(fractions.gcd, x)

GCD_L=[0 for x in range(N)]

for i in range(N-1):
    l=[GCD_L[i], A[i]]
    GCD_L[i+1]=proc(l)

GCD_R=[0 for x in reversed(range(N))]

for i in reversed(range(N-1)):
    l=[GCD_R[i+1], A[i]]
    GCD_R[i]=proc(l)

M = [0 for x in range(N-1)]

for i in range(N-1):
    l=[GCD_L[i], GCD_R[i+1]]
    M[i]=proc(l)

print(max(M))

Measured memory_bytes: 14584
#include <iostream>
#include <vector>
#include <string>
#include <map>
#include <set>
#include <queue>
#include <list>
#include <stack>
#include <algorithm>
#include <functional>
#include <numeric>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <sstream>
using namespace std;

#define REP(i,a,n) for(i=a; i<n; i++)
#define rep(i,n) REP(i,0,n)
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define foreach(it,x) for(typeof(x.begin()) it=x.begin(); it!=x.end(); it++)

int w,h;
string dp[77][77], field[77];

string stmax(const string& a, const string& b){
    if( a.length() == b.length() ){
        return (a > b ? a : b);
    }
    return (a.length() > b.length() ? a : b);
}

int main(){
    int i,j;

    while( cin >> w >> h, w|h ){
        rep(i,h) cin >> field[i];

        // init
        rep(i,77) rep(j,77) dp[i][j] = "";

        string res;
        REP(i,1,h+1){
            REP(j,1,w+1){
                if( isdigit(field[i-1][j-1]) ){
                    dp[i][j] = stmax(dp[i-1][j], dp[i][j-1]) + field[i-1][j-1];
                    if( dp[i][j].length() > 1 && dp[i][j][0] == '0' ){
                        dp[i][j] = dp[i][j].substr(1);
                    }
                    res = stmax(res, dp[i][j]);
                }
            }
        }

        cout << res << endl;
    }
    return 0;
}

Measured memory_bytes: 1068
#include <iostream>

using namespace std;

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

    if (a==b)
    {
        cout <<c ;
    }
    else if(a==c)
    {
        cout<<b ;
    }
    else
    {
        cout<<a ;
    }
    return 0 ;
}
///||


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

int main(){
    int N,M;
    cin >> N >> M;
    int A[N];
    int sum=0;
    for(int i=0;i<N;i++) {
        cin >> A[i];
        sum += A[i];
    }

    sort(A,A+N);
    double T=(double)sum/(double)(4*M);
    if(A[N-M]>=T) cout << "Yes" <<endl;
    else cout << "No" <<endl;

}



Measured memory_bytes: 256
n, m, x, y = list(map(int, input().split()))
xv = list(map(int, input().split()))
yv = list(map(int, input().split()))
xv.append(x)
yv.append(y)
if x < y and max(xv) < min(yv):
  print('No War')
else:
  print('War')


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

#define BUF_SIZE 20

int get_int2(int *a1, int *a2) {
#ifdef BUF_SIZE
  char line[BUF_SIZE];
  if(!fgets(line, BUF_SIZE, stdin)) return -1;
  sscanf(line, "%d %d", a1, a2);
#else
#error
#endif
  return 0;
}

#define VERTEX_MAX 50
#define EDGE_MAX ((VERTEX_MAX*(VERTEX_MAX-1))/2)

static int stack[VERTEX_MAX];
static int pos;

void push(int v) {
    stack[pos++] = v;
}

int pop(void) {
    return stack[--pos];
}

int peek(void) {
    return stack[pos-1];
}

int is_empty(void) {
    return !pos;
}

void init_stack(void) {
    pos = 0;
}

struct pair {
    int v1;
    int v2;
};

int main(void) {
    int vs, es;
    get_int2(&vs, &es);
    int i, j;
    struct pair ps[EDGE_MAX];
    static char map[VERTEX_MAX][VERTEX_MAX];
    for(i = 0; i < es; i++) {
        int v1, v2;
        get_int2(&v1, &v2);
        // 1-indexed -> 0-indexed
        v1--; v2--;
        ps[i].v1 = v1; ps[i].v2 = v2;
        map[v1][v2] = map[v2][v1] = 1;
    }

    int ans = 0;
    for(i = 0; i < es; i++) {
        int v1 = ps[i].v1; int v2 = ps[i].v2;
        char check[VERTEX_MAX] = {0};
        init_stack();
        push(v1);
        check[v1] = 1;
        // dfs
        while(!is_empty()) {
            int v = peek();
            int nv;
            int flag = 0;
            for(nv = 0; nv < vs; nv++) {
                // exclude edge
                if(v == v1 && nv == v2) continue;
                if(nv == v1 && v == v2) continue;
                if(map[v][nv] && !check[nv]) {
                    check[nv] = 1;
                    push(nv);
                    flag = 1;
                    break;
                }
            }
            if(!flag) pop();
        }
        int flag = 1;
        for(j = 0; j < vs; j++) {
            if(!check[j]) {
                flag = 0;
                break;
            }
        }
        // if separated
        if(!flag) ans++;
    }

    printf("%d\n", ans);
    return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
using UL=unsigned int;
using LL=long long;
using ULL=unsigned long long;
#define rep(i,n) for(UL i=0; i<(n); i++)

UL N;
UL C[10001];

int main(){
 scanf("%u",&N);
 rep(i,N) {
  UL a; scanf("%u",&a);
  C[a]++;
 }
 bool sp=false;
 rep(i,10001){
  rep(t,C[i]) {
   if(sp) printf(" ");
   sp=true;
   printf("%u",i);
  }
 }
 printf("\n");
}


Measured memory_bytes: 3228
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define endl '\n'
#define vi vector<int>
#define vb vector<bool>
#define pii pair<int,int>
#define mod 1000000007
#define ss second
#define ff first
#define vpii vector<pii>
#define vvi vector<vi>
#define pb push_back
#define vs vector<string>
#define all(x) x.begin(),x.end()
#define mii map<int,int>
const int inf=0x3f3f3f3f3f3f3f3f;
void print(vi &v){
    for(int i=0;i<v.size();i++)cout<<v[i]<<" ";
    cout<<endl;
}
int power(int a,int b){
    int res = 1;
    while(b!=0){
        if(b&1){
            res *= a; 
        }
        a = (a * a);
        b = (b / 2);
    }
    return res;
}
int gcd(int a,int b,int c){
	return __gcd(a,__gcd(b,c));
}
int32_t main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    int t;
    t = 1;
    while(t--){
        int n,i,j;
        cin>>n;
        string s;
        cin>>s;
        int r=0,g=0,b=0;
        for(i=0;i<n;i++){
        	if(s[i]=='R')r++;
        	else if(s[i]=='B')b++;
        	else g++;
        }
        int val = r*g*b;
        for(i=2;i<n;i++){
        	for(j=0;j<i-1;j++){
        		int k = (i+j)/2;
        		if((i-k)==(k-j)){
        			if(s[i]!=s[j] && s[j]!=s[k] && s[i]!=s[k])val--;
        		}
        	}
        }
        cout<<val<<endl;
    }
    return 0;
}

Measured memory_bytes: 3664
def main():
    YES="Yes"
    NO="No"
    N,K,Q=map(int, input().split())
    point = [K-Q] * N
    for i in range(Q):
        point[int(input())-1] += 1
    for p in point:
        if p > 0:
            print(YES)
        else:
            print(NO)

if __name__ == '__main__':
    main()

Measured memory_bytes: 6508
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cstring>
#include<vector>
#include<cmath>
using namespace std;
#define MAXN 500
int n,k,sum,ans;
int a[MAXN+5],p[MAXN+5];
int check(int d)
{
	int s=0;
	for(int i=1;i<=n;i++){
	s+=a[i]%d,p[i]=a[i]%d;
	}
	int num=s/d,opt=0;
	sort(p+1,p+n+1);
	for(int i=1;i<=n-num;i++)
	opt+=p[i];
	return (opt<=k)?d:0;
}
int main()
{
	scanf("%d%d",&n,&k);
	for(int i=1;i<=n;i++)
	{scanf("%d",&a[i]);sum+=a[i];}
	for(int i=1;i<=sqrt(sum);i++)
	if(sum%i==0){
		ans=max(ans,check(i));
		ans=max(ans,check(sum/i));
	}
	printf("%d",ans);
}

Measured memory_bytes: 256
var GET=(function(){function f(s){return new g(s);}function g(s){this._s=s.trim().split("\n");this._y=0;}g.prototype.a=function(f){var s=this._s, y=this._y, r;if(typeof s[y]==="string")s[y]=s[y].split(" ").reverse();r=s[y].pop();if(!s[y].length)this._y++;return f?r:+r;};g.prototype.l=function(f){var s=this._s[this._y++].split(" ");return f?s:s.map(a=>+a);};g.prototype.m=function(n,f){var r=this._s.slice(this._y,this._y+=n).map(a=>a.split(" "));return f?r:r.map(a=>a.map(a=>+a));};g.prototype.r=function(n,f){var r=this._s.slice(this._y,this._y+=n);return f?r:r.map(a=>+a);};return f;})();
var o=GET(require("fs").readFileSync("/dev/stdin","utf8"));
function xArray(v){var a=arguments,l=a.length,r="Array(a["+--l+"]).fill(0).map(x=>{return "+v+";})";while(--l)r="Array(a["+l+"]).fill(0).map(x=>"+r+")";return eval(r);}
var mod = 1e9+7;
function abmod(){for(var a=arguments,r=a[0],i=1;i<a.length;)r=((r>>16)*a[i]%mod*65536+(r&65535)*a[i++])%mod;return r;}
var fac=[1,1];
function fSet(n){for(var i=2;i<=n;)fac[i]=abmod(fac[i-1],i++);}

console.log(main());
function main(){
  var n = o.a();
  var s = o.a(1);
  if(s[0] === "W")return 0;
  fSet(n);
  var ans = fac[n];
  var l=1;
  var cnt = 1;
  for(var i = 1; i < 2*n; i++){
    if(s[i] === "W"){
      if(l&1){
        l++;
      }else{
        cnt = abmod(cnt,l);
        l--;
      }
    }else{
      if(l&1){
        cnt = abmod(cnt,l);
        l--;
      }else{
        l++;
      }
    }
  }
  if(l !== 0)return 0;
  return abmod(ans,cnt);
}

Measured memory_bytes: 21192
#include <bits/stdc++.h>
using namespace std;
#define all(a)a.begin(),a.end()
using ll=long long;
const int INF = 1<<30;
const ll INFll =1LL<<62;
const int mod= int(1e9)+7;
//const int mod=998244353;
using P = pair<int,int>;
using Pl= pair<ll,ll>;
using ld=long double;
using V=vector<int>;
using Vl=vector<ll>;
using VV=vector<vector<int>>;
using VVl=vector<vector<ll>>;

int main(){
    int a,b;cin >>a>>b;
    int now=1;
    int ans=0;
    while(now<b){
        now--;
        now+=a;
        ans++;
    }
    cout <<ans <<endl;
}


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

int n;
int cnt[200005];

int main()
{
	cin >> n;
	for (int i = 1; i < n; i++)
	{
		int t;
		cin >> t;
		cnt[t]++;
	}
	for (int i = 1; i <= n; i++) cout << cnt[i] << endl;
	return 0;
}


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

#define ll long long
#define ld long double
using namespace std;

int  main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    string p;
    cin >> p;
    if (p[0] == 'Y' && p[1] == 'A' && p[2] == 'K' && p[3] == 'I' ){
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
int main()
{
	int n;
	std::cin >> n;
	std::vector<bool>result(n);
	for (int i = 0; i < n; i++)
	{
		long double x1, y1, x2, y2, x3, y3, x4, y4;
		std::cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> x4 >> y4;
		result[i] = x1 == x2 && x3 == x4 || (y1 - y2) / (x1 - x2) == (y3 - y4) / (x3 - x4);
	}
	for (auto i : result)
	{
		std::cout << (i ? "YES" : "NO") << std::endl;
	}
	return 0;
}


Measured memory_bytes: 3152
#! /usr/bin/python
# -*- coding: utf-8 -*-

YOKO = 1
TATE = 2

def main():
    # input
    while True:
        N = int(raw_input())
        if N == 0:
            break

        data = []
        for x in xrange(N):
            data.append(map(int, raw_input().split()))

        print(restBlock(data))

def restBlock(data):
    state = []
    for x in data:
        if x[0] == YOKO:
            block = makeYokoBlock(x)
            state = yokoBlock(state, block)
        else:
            blocks = makeTateBlocks(x)
            state = tateBlock(state, blocks)

        state = clearTetoris(state)
    return countRestBlock(state)

def clearTetoris(state):
    return filter(lambda x:sum(x) < 5, state)

# Blockが重なっていたらFalse
def checkBlock(a, b):
    if max([sum(x) for x in zip(a, b)]) > 1:
        return False
    else:
        return True

def countRestBlock(state):
    return sum([sum(x) for x in state])

def tateBlock(state, blocks):
    for x in blocks:
        state = yokoBlock(state, x)
    return state

def makeTateBlocks(block_data):
    sckellton = [0, 0, 0, 0, 0]
    i = block_data[2] - 1
    sckellton[i] = 1
    return [sckellton for x in xrange(block_data[1])]

def yokoBlock(state, block):

    if len(state) == 0:
        state.append(block)
        return state

    for i, x in enumerate(state[::-1]):
        if checkBlock(x, block):
            pass
        else:
            if i == 0:
                state.append(block)
            else:
                state[-i] = [sum(x) for x in zip(state[-i], block)]
            break
    else:
        state[0] = [sum(x) for x in zip(state[0], block)]

    return state

def makeYokoBlock(block_data):
    block = [0, 0, 0, 0, 0]
    i = block_data[2]
    j = block_data[1]
    for x in xrange(j):
        block[i - 1 + x] = 1

    return block

def test():
    data = [[1,4,1],
            [1,3,1],
            [2,2,4],
            [2,3,5]]

    # print(makeYokoBlock([1,3,2]))
    # print(checkBlock([1, 1, 0, 0, 0], [0, 0, 1, 1, 0]))
    # state = [[1, 1, 1, 1, 0], [1, 1, 0, 0, 0], [1, 1, 0, 0, 0]]
    # print(yokoBlock(state, [1, 0, 1, 0, 1]))
    # state = []
    # print(yokoBlock(state, [1, 0, 1, 0, 1]))
    # state = [[1, 1, 1, 1, 0]]
    # print(yokoBlock(state, [1, 0, 1, 0, 1]))
    # state = [[1, 1, 1, 1, 1], [1, 1, 0, 0, 0], [1, 1, 1, 1, 1]]
    # print(clearTetoris(state))
    # print(makeTateBlocks([2, 3, 2]))
    # state = [[1, 1, 0, 1, 1], [1, 1, 0, 0, 0], [1, 1, 0, 1, 1]]
    # print(tateBlock(state, [[0, 0, 1, 0, 0], [0, 0, 1, 0, 0], [0, 0, 1, 0, 0]]))
    # print(countRestBlock(state))
    # print(restBlock(data))

if __name__=='__main__':
    # test()
    main()

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

const int N = 1e6 + 100;

long long lim = 1000000000000000000LL;

int main() {
    // freopen("in.txt", "r", stdin);
    ios::sync_with_stdio(0);
    cin.tie(0);


    long long n;
    cin >> n;
    long long ans = 1;
    double lg = 0;
    bool bad = false;
    for(int i = 1; i <= n; i++) {
        long long x;
        cin >> x;
        if(x == 0) {
            cout << "0" << endl;
            return 0;
        }
        if(lg + log10(x) <= 18.0001) {
            ans *= x;
            lg += log10(x);
        }
        else bad = true;
    }
    if(bad or ans > lim) cout << "-1" << endl;
    else cout << ans << endl;


    return 0;
}


Measured memory_bytes: 4020
def solve(K, S):
    import bisect
    count = 0
    z_array = [i for i in range(K+1)]
    for x in range(K+1):
        for y in range(K+1):
                z = S - x - y
                if(z >= 0 and z <= K):count+=1
    return count

def main():
    K, S = map(int, input().split())
    print(solve(K, S))
#print(solve(2, 2))
#print(solve(5, 15))
main()

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

bool isprime (ll n ) 
{
    if (n == 2 ) 
        return true; 
    if ( n <= 1 ) 
        return false ; 
    if ( n %2 == 0 )
        return false ; 

    for ( ll i = 3 ; i <= sqrt(n) ; i+= 2 )
        if ( n %i ==0 )
            return false ;
    return true; 
}

int main () 
{
    ll n ;
    cin >> n ; 
    while ( !isprime ( n)) 
    {
        n++ ; 
    } 
    cout << n << endl ; 
    return 0 ; 
} 


Measured memory_bytes: 256
import Foundation

func gcd(_ a_: Int, _ b_: Int) -> Int {
    var a = a_
    var b = b_
    while a % b != 0 {
        (a, b) = (b, a%b)
    }
    return b
}

func readInt() -> [Int]{
    return readLine()!.split(separator: " ").map{Int($0)!}
}

func main() {
    let N = Int(readLine()!)!
    var ans = 0
    for i in 1...N {
        for j in 1...N {
            let ij = gcd(i, j)
            for k in 1...N {
                ans += gcd(ij, k)
            }
        }
    }
    
    print(ans)
}

main()


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

int main () {

    int N;
    cin>>N;
    int64_t sum=0;

    for (int i=0; i<N; i++){
        if ((i+1)%3!=0 && (i+1)%5!=0) {
            sum += (i+1);
        }
    }
    cout<<sum<<endl;
}

Measured memory_bytes: 3608
# https://atcoder.jp/contests/agc033/tasks/agc033_a

from collections import deque
import sys
sys.setrecursionlimit(10 ** 8)
input = sys.stdin.readline
move = [(1, 0), (-1, 0), (0, 1), (0, -1)]     # 動ける場所の候補


def debug(start, goal, p, t):
    player = p
    debug_grid = list(list(grid[h]) for h in range(H))
    if start != (None, None):
        debug_grid[start[0]][start[1]] = "S"
    if goal != (None, None):
        debug_grid[goal[0]][goal[1]] = "G"
    debug_grid[player[0]][player[1]] = "P"
    print("~~~~~~~~~ t = " + str(t+1) + "  ~~~~~~~~")
    for debug_h in range(H):
        print("".join(str(debug_grid[debug_h][debug_w]) for debug_w in range(W)))


def search(grid, next_set, goal=(None,None), visit=set()):
    visit.add(start)                            # スタート地点はすでに訪れている
    while next_set:                             # p = [] になったら止める
        p, t = next_set.popleft()               # 要素を消去して、消去した要素を出力
        h, w = p
        for dh, dw in move:                     # 頂点 p から進める経路の候補から一つ選ぶ
            q = (h + dh, w + dw)
            if q[0] < 0 or q[0] >= H or q[1] < 0 or q[1] >= W:
                continue
            if grid[q[0]][q[1]] == wall:         # 壁があったら進まない
                continue
            if q in visit:                      # 一度訪れていた場合は進まない
                continue
            #### (debug code) ######
            # debug(start, goal, q, t)
            ########################
            if q == goal:                       # ゴールがあるならば、ここで判定
                return t + 1                    # 経路の長さは t + 1 で与えられる
            visit.add(q)                        # 頂点 q に一度訪れた事をメモ (for の前に書くと、ここで選ばれた q が最短であるはずなのに、違う経路でvisit = Trueを踏んでしまう可能性がある)
            next_set.append((q, t + 1))         # p から q へと移動。時刻を 1 進める
    return t



road, wall = ".", "#"                         # (進行可能を意味する記号, 進行不可を意味する記号)

H,W = map(int,input().split())                # 左上は(h,w)=(0,0)、右下は(h,w)=(H-1,W-1)

grid = []
next_set = deque()
visit = set()
for h in range(H):
    grid.append(input())
    for w, a in enumerate(grid[-1]):
        if a == "#":
            start = (h, w)
            next_set.append((start,0))
            visit.add(start)

print(search(grid, next_set, goal=(None,None), visit=visit))

Measured memory_bytes: 248320
import java.util.Scanner;

public class Main {
    static int WHITE = 0;
    static int GRAY = 1;
    static int BLACK = 2;
    public static void main(String[] args){
        Scanner input = new Scanner(System.in);
        int n = input.nextInt();
        int[][] G = new int[n][n];
        for(int i = 0; i < n; i++) {
            for(int j = 0; j < n; j++) {
                G[i][j] = input.nextInt();
            }
        }
        int[] p = new int[n];
        int[] d = new int[n];
        int[] color = new int[n];

        // 初始化
        for(int i = 0; i < n; i++) {
            d[i] = Integer.MAX_VALUE;
            p[i] = - 1;
            color[i] = WHITE;
        }

        d[0] = 0;
        int totalCost = 0;

        // 不断添加点，直到所有点都加入MST中
        while(true) {
            int minCost = Integer.MAX_VALUE;
            int u = 0;
            // 找到当前T内顶点与V-T内顶点的的边中最小的边
            for(int i = 0; i < n; i++){
                if(color[i] != BLACK && d[i] < minCost) {
                    minCost = d[i];
                    u = i;
                }
            }
            if(minCost == Integer.MAX_VALUE) {
                break;
            }
            // 将对应顶点和边加入T
            color[u] = BLACK;
            totalCost += minCost;

            // 更新新顶点加入后T内顶点与V-T内顶点的边的距离
            for(int v = 0; v < n; v++){
                if(color[v] != BLACK && G[u][v] != -1) {
                    if(G[u][v] < d[v]) {
                        d[v] = G[u][v];
                        p[v] = u;
                        color[v] = GRAY;
                    }
                }
            }
        }
        System.out.println(totalCost);
    }
}



Measured memory_bytes: 40824
#include <iostream>
#include <vector>
#include <numeric>

using namespace std;

int main()
{
	int N, M;
	cin >> N >> M;
	vector<int> A(M);
	for (auto& x : A) {
		cin >> x;
	}

	auto T = accumulate(A.begin(), A.end(), 0LL);
	if (T <= N) {
		cout << N - T << endl;
	}
	else {
		cout << -1 << endl;
	}
}


Measured memory_bytes: 3672
s=int(input())
def func(n):
    if n%2==0:
        return n/2
    else:
        return 3*n+1
lis=[]
lis.append(s)
flag=0
count =0
ans=0
while flag==0:
    if func(lis[count]) in lis:
        ans=count+2
        flag=1
    else:
        lis.append(func(lis[count]))
        count=count+1
        
print(ans)

Measured memory_bytes: 3064
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <queue>
#include <cstring>
#include <vector>
#include <map>
#include <algorithm>
#include <cctype>
#include <cmath>
#include <bitset>
#include <set>
#include <stack>
using namespace std;

#define REP(i,n) for(int i=0;i<(int)(n);i++)
#define RREP(i,n) for(int i=n-1;i>=0;i--)
#define FOR(i,k,n) for(int i=(k);i<(int)(n);i++)
#define all(i,n) (i),(i+n)

int dx4[4]={1,0,-1,0};
int dy4[4]={0,-1,0,1};
int dx8[8]={1,0,-1,1,-1,1,0,-1};
int dy8[8]={1,1,1,0,0,-1,-1,-1};
int dx9[9]={0,1,0,-1,1,-1,1,0,-1};
int dy9[9]={0,1,1,1,0,0,-1,-1,-1};

typedef pair<int, int> P;
typedef pair<string, int> SP;
typedef long long ll;
typedef pair<ll, ll> PLL;

const int INF = 1e9;
const ll LLINF = 1e18;
const int MAX_V = 1e6+1;
const ll mod = 1000000007;
// << fixed << setprecision
// --------------------------------------
int n;
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);

  cin >> n;
  vector<int> a(n);
  priority_queue<int, vector<int>, greater<int>> que;

  REP(i, n) cin >> a[i];
  multiset<int> s;

  s.insert(-1);

  REP(i, n) {
    auto it = s.lower_bound(a[i]);
    if(it != s.begin()) {
      it--;
      s.erase(it);
      s.insert(a[i]);
    } else {
      s.insert(a[i]);
    }
  }

  cout << s.size() << endl;
}


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

using namespace std;
using ll = long long;
#define int ll
using VI = vector<int>;
using VVI = vector<VI>;
using PII = pair<int, int>;

#define FOR(i, a, n) for (ll i = (ll)a; i < (ll)n; ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(x) x.begin(), x.end()
#define PB push_back

const ll LLINF = (1LL<<60);
const int INF = (1LL<<30);
const int MOD = 1000000007;

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); }
template <typename T> bool IN(T a, T b, T x) { return a<=x&&x<b; }
template<typename T> T ceil(T a, T b) { return a/b + !!(a%b); }
template<class S,class T>
ostream &operator <<(ostream& out,const pair<S,T>& a){
  out<<'('<<a.first<<','<<a.second<<')';
  return out;
}
template<class T>
ostream &operator <<(ostream& out,const vector<T>& a){
  out<<'[';
  REP(i, a.size()) {out<<a[i];if(i!=a.size()-1)out<<',';}
  out<<']';
  return out;
}

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

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

  int n;
  cin >> n;
  VI a(n);
  REP(i, n) cin >> a[i];

  int ret = 0;
  REP(i, n) {
    while(a[i] && a[i]%2==0) a[i] /= 2, ret++;
  }
  cout << ret << endl;

  return 0;
}


Measured memory_bytes: 384
S=input();n=len(S)
abc=[chr(i) for i in range(97,97+26)]

if n<26:
    s=set()
    for c in S:
        s.add(c)
    for c in abc:
        if c not in s:
            ans=S+c
            break
else:
    l=[]
    i=25
    l.append(S[i])
    while i>0 and S[i-1]>l[-1]:
        l.append(S[i-1])
        i-=1
    if i==0:
        ans='-1'
    else:
        c=S[i-1]
        l.append(c)
        l.sort()
        for j in range(len(l)):
            if l[j]==c:
                d=l[j+1]
        ans=S[:i-1]+d 

print(ans)

Measured memory_bytes: 38384
from collections import deque

N,M=map(int,input().split())
#n部屋数、M通路数
AB=[]
for i in range(M):
	AB.append(list(map(int,input().split())))

links=[[] for _ in range(N+1)]
results=[-1]*(N+1)#番号をそのまま使いたいから

for a, b in AB:
    links[a].append(b)
    links[b].append(a)
q=deque([1])

while q:
	pos=q.popleft()#1からスタート
	for i in links[pos]:#部屋posにつながる部屋iを探索
		if results[i]==-1:#部屋iを未探索なら、そこに行くべき場所posを記入
			results[i]=pos
			q.append(i)#捜索した部屋iを次の出発地として追記
print('Yes')
print('\n'.join(str(i) for i in results[2:]))

Measured memory_bytes: 65612
#include <iostream>
#include <algorithm>

using namespace std;

typedef unsigned long long ull;

int main(int argc, char const *argv[]) {
  ull N, t, a;
  cin >> N >> t >> a;

  for(int i = 1; i < N; i++) {
    ull T, A;
    cin >> T >> A;

    ull f = (t - 1) / T + 1;
    ull e = (a - 1) / A + 1;

    t = T * max(f, e);
    a = A * max(f, e);
  }

  cout << t + a << endl;

  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define LL long long
#define For(I,X,Y) for(LL I=(X);I<=(Y);I++)
#define ForDown(I,X,Y) for(LL I=(X);I>=(Y);I--)
using namespace std;

inline LL Read(){
	LL X=0;char CH=getchar();bool F=0;
	while(CH>'9'||CH<'0'){if(CH=='-')F=1;CH=getchar();}
	while(CH>='0'&&CH<='9'){X=(X<<1)+(X<<3)+CH-'0';CH=getchar();}
	return F?-X:X;
}

LL N,Ans;
LL Len,W[105];

bool Check(LL X){
	LL Len=0,W[105]={0};
	LL S=sqrt(X);
	
	For(I,1,S) if(X%I==0) W[++Len]=I,W[++Len]=X/I;
	
	if(S*S==X){
		if(Len==9) return true;
		return false;
	} else {
		if(Len==8) return true;
		return false;
	}
	
}

int main(){
	N=Read();
	
	For(I,1,N) if(I&1) if(Check(I)==true) Ans++;

	printf("%lld",Ans);
	
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main (){
  int i;
  string s;
  cin>>s;
  int x=0;
  for(i=0;i<s.length();i++){
    if(s[i]=='7')
    x++;
  }
  if(x>0)
  cout<<"Yes"<<endl;
  else
  {
    cout<<"No"<<endl;
  }
  
  return 0;
}


Measured memory_bytes: 3592
n=int(input())
hoge=list(map(int,input().split()))
ans=1
flag=True

if(min(hoge)==0):
  print(0)
  flag=False
else:
  for i in range(n):
    ans=ans*hoge[i]
    if(ans>10**18):
      print(-1)
      flag=False
      break
if(flag):
  print(ans)

Measured memory_bytes: 21656
#include<stdio.h>
#define MAX 100

int n;
int list[MAX+1][MAX+1];
int c[MAX+1],d[MAX+1],f[MAX+1],time;
int u,v,k;

void dfs_visit(int u) {
  int i;
  c[u] = 1;
  d[u] = ++time; 
  for ( i = 1; i <= n; i++) {
    if (list[u][i] == 0) continue;
    if (c[i] == 0) {
      dfs_visit(i);
    }
  }
  c[u] = 2;
  f[u] = ++time; 
}
 
void dfs() {
 
  int i;
  for (i = 1; i <= n; i++) {
    c[i] = 0;
  }
  time = 0;
 
  for (i = 1; i <=n; i++) {
    if (c[i] == 0) {
      dfs_visit(i);
    }
  }
 
  for (i = 1; i <= n; i++) {
    printf("%d %d %d\n", i, d[i], f[i]);
  }
}
 

int main(){
  int i,j;

  scanf("%d",&n);
  for (i = 1; i <= n; i++) {
    for (j = 1; j <= n; j++) {
      list[i][j] = 0;
    }
  }
   
  for (i = 1; i <= n; i++) {
    scanf("%d %d", &u, &k);
    
    for (j = 1; j <= k; j++) {
      scanf("%d", &v);
      
      list[u][v] = 1;
    }
  }
  dfs();

  return 0;
}



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

using namespace std;

int main()
{
	int num;
	int bucket[101] = {0};
	int max = 0;
	
	while (scanf("%d", &num) != EOF){
		bucket[num]++;
	}
	
	for (int i = 1; i <= 100; i++){
		if (bucket[i] > max) max = bucket[i];
	}
	
	for (int i = 1; i <= 100; i++){
		if (max == bucket[i]) cout << i << "\n";
	}
	
	return (0);
}


Measured memory_bytes: 3136
#include <bits/stdc++.h>
using namespace std;
#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 fi first
#define se second
#define mp make_pair
#define itrfor(itr,A) for(auto itr = A.begin(); itr !=A.end();itr++)
template <class T> using reversed_priority_queue = priority_queue<T, vector<T>, greater<T> >;
typedef long long llong;
char moji[26]={'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'};
char moji2[26]={'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'};
char moji3[10]={'0','1','2','3','4','5','6','7','8','9'};
#define Sort(a) sort(a.begin(),a.end());
#define Reverse(a) reverse(a.begin(),a.end());
#define print(a) cout << a << endl;
#define MOD llong(1e9+7)
#define MAX int(2 * 1e5 +5)
#define debug(x)  cout << #x << " = " << (x) << endl;
#define pi acos(-1.0)
#define int llong
#define INF llong(1e17)
void myprint(int* A,int A_num){
   REP(i,A_num) cout << A[i] << " ";
   cout << endl;
}

signed main(){
    int n;
    cin >> n;
    int A[n];
    REP(i,n) cin >> A[i];
    int ans = 0;
    int tmp = 0;
    REP(i,n-1){
        if(A[i] >= A[i+1]) tmp ++;
        else{
            ans = max(ans,tmp);
            tmp = 0;
        }
    }
    ans = max(ans,tmp);
    cout << ans << endl;

}

Measured memory_bytes: 1024
#include <iostream>
#include <vector>
#include <algorithm>
#include <set>
#include <map>
#include <cassert>
#include <numeric>
#include <string>
#include <cstring>
#include <complex>
#include <cstdio>
#include <cstdlib>
using namespace std;

#define REP(i, n) for(int i=0;i<(int)n;i++)
#define REPS(i, n) for(int i=1;i<=(int)n;i++)
#define RREP(i, n) for(int i=n-1;i>=0;i--)
#define RREPS(i, n) for(int i=n;i>0;i--)
#define ALL(v) v.begin(), v.end()
#define RALL(v) v.rbegin(), v.rend()
#define pb push_back
#define eb emplace_back
typedef vector<int> vi;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

int n, m, q;

int check(const vector<vi> &req, const vector<vi> &rest, vi ave, int debug = 0){
	vi target;
	REP(i, n) if(accumulate(ALL(rest[i]), 0)) target.pb(i);
	random_shuffle(ALL(target));
	while(1){
		int update = false;
		REP(ii, target.size()){
			int i = target[ii];
			int ok = 1;
			REP(j, m)if(ave[j] < rest[i][j]){
				ok = 0;
				break;
			}
			if(ok){
//				if(debug) cout << i << endl;
				REP(j, m) ave[j] += req[i][j] - rest[i][j];
				swap(target[ii], target.back());
				target.pop_back();
				ii --;
				update = 1;
			}
		}
		if(!update) break;
	}
	return target.empty();
}

int main(){
	scanf("%d%d%d", &n, &m, &q);
	vi res(m);
	vector<vi> req(n, vi(m));
	REP(i, m) scanf("%d", &res[i]);
	REP(i, n)REP(j, m) scanf("%d", &req[i][j]);
	vector<pii> query;
	REP(i, q){
		int a, b;
		scanf("%d%d", &a, &b);a --; b --;
		query.eb(a, b);
	}
	int l = 0, r = q+1; // [0, l): ok, [0, r): NG
	
	vi checking(m);
	iota(ALL(checking), 0);
	random_shuffle(ALL(checking));

	while(l+1<r){
		int mid = (l+r)/2;
		auto rest = req;
		auto ave = res;
//	cout << "!" << mid << "," << l << ", " << r << endl;
//	REP(i, m) cout << ave[i] << " \n"[i+1 == m];cout << endl;
		REP(i, mid){
			int a, b;
			tie(a, b) = query[i];
			rest[a][b] --;
			ave[b] --;
			int f = 1;
			for(int j : checking){
				if(rest[a][j]){
					f = 0;
					break;
				}
			}
			if(f){
				for(int j : checking) ave[j] += req[a][j];
			}
		}
//	REP(i, m) cout << ave[i] << " \n"[i+1 == m];cout << endl;
//	REP(i, n)REP(j, m) cout << rest[i][j] << " \n"[j+1 == m];
//	check(req, rest, ave, 1);
		if(check(req, rest, ave)) l = mid;
		else r = mid;
	}
	if(l == q) cout << -1 << endl;
	else cout << r << endl;
	return 0;
}

Measured memory_bytes: 5312
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		
		Scanner scan = new Scanner(System.in);
		int a = scan.nextInt();
		int b = scan.nextInt();
		int h = scan.nextInt();
		int m = scan.nextInt();

		double lon = h * 30 + m * 0.5;
		double sho = m * 6 ;
		
		if(lon == 0) {
			lon = 360;
		}
		
		if(sho == 0) {
			sho = 360;
		}
		
		double big = 0;
		double small = 0;
		
		double answer = 0;
		
		if(lon > sho) {
			big = lon;
			small = sho;
		}else if(lon < sho) {
			big = sho;
			small = lon;
		}else if(lon == sho) {
			answer  = 0;
		}
		
		if((big - small) == 180) {
			answer = a + b;
		}
		
		
		double deg = big - small;
		if(deg > 180) {
			deg = 360 - deg;
		}
		
		if(deg > 180) {
			deg = 180 - (deg - 180);
		}
		
		double rad = Math.toRadians(deg);
		double cos = Math.cos(rad);
		answer = Math.sqrt(a*a + b*b - 2 * a * b * cos);
		
		if( deg == 90) {
			answer = Math.sqrt(a*a + b*b);
		}
		
		System.out.println(answer);
		
		
}
}


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

using namespace std;


void solve() {
    int n,m,t;
    cin >> n >> m >> t;
    vector<int> X(m), Y(m);
    for (int i = 0; i < m; i++) {
        cin >> X[i] >> Y[i];
        X[i]--;Y[i]--;
    }
    if (t == 1) {
        const int N = 50008; 
        vector<bitset<N>> g(n);
        for (int i = 0; i < n; i++) {
            g[i][i] = 1;
        }
        for (int _ = m-1; _ >= 0; _--) {
            int x = X[_], y = Y[_];
            g[x] = (g[y] |= g[x]);
        }
        bitset<N> all_reach = g[0];
        for (int i = 1; i < n; i++) {
            all_reach &= g[i];
        }
        int w = all_reach._Find_first();
        if (w < n) {
            string s(m, '^');
            bitset<N> trk; trk[w] = 1;
            for (int i = m-1; i >= 0; i--) {
                int x = X[i], y = Y[i];
                if (trk[x] && !trk[y]) {
                    s[i] = '^';
                    trk[y] = 1;
                } else if (!trk[x] && trk[y]){
                    s[i] = 'v';
                    trk[x] = 1;
                }
            }
            cout << s;
        } else {
            cout << -1; return;
        }
    } else {
        if (n==2) {
            cout << -1; return;
        }
        vector<int> ids;
        for (int i = 0; i < m; i++) {
            if (Y[i] < 3) ids.push_back(i);
        }
        string s(m, '^');
        for (int _ = ids.size()-2; _ >= 0; _--) {
            int crt = ids[_], nxt = ids[_+1];
            int x = X[crt], y = Y[crt];
            int u = X[nxt], v = Y[nxt];
            if (x==u && y==v) s[crt] = s[nxt];
            else {
                int k = 3 - u-v;
                if (x == k) s[crt] = '^';
                else assert(y==k), s[crt] = 'v';
            }
        }
        cout << s;
    }
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    solve();
    cout << endl;
}


Measured memory_bytes: 306688
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <climits>
#include <cstdlib>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <string>
#include <vector>
#define DEBUG 1
using namespace std;
constexpr int kMod = 1000000007;
typedef long long LL;

int main() {
  int N; cin >> N;
  vector<LL> A(N), B(N);
  for (int i = 0; i < N; ++i) {
    cin >> A[i] >> B[i];
  }

  LL cnt = 0;
  for (int i = N-1; i >= 0; --i) {
    if ((A[i] + cnt) % B[i] == 0) continue;
    LL x = B[i] - (A[i] + cnt) % B[i];
    cnt += x;
  }
  cout << cnt << endl;
}


Measured memory_bytes: 4796
#include <iostream>
#include <iomanip>
#include <cstdlib>
#include <cmath>
#include <map>
#include <string.h>
#include <algorithm>
#include <bits/stdc++.h>
#include <vector>

using namespace std;
#define set_precision cout << fixed << setprecision(10)
#define rep(i, a, b) for (int i = a; i < b; i++)
#define repb(i, a, b) for (int i = a; i >= b; i--)
#define repit(arr) for (auto it = arr.begin(); it != arr.end(); it++)
#define vi vector<int>
#define vl vector<long long int>
#define Vi vector<vector<int>>
#define vpi vector<pair<int,int>>
#define seti set<int>
#define setl set<ll>
#define dseti set<int, greater<int>>
#define dsetl set<ll, greater<ll>>
#define mseti multiset<int>
#define msetl multiset<ll>
#define dmseti multiset<int, greater<int>>
#define dmsetl multiset<ll, greater<ll>>
#define sortA(arr) sort(arr.begin(), arr.end())
#define dsortA(arr) sort(arr.begin(), arr.end(), greater<int>())
#define ssort(arr) stable_sort(arr.begin(), arr.end())
#define nth(v,n) nth_element(v.begin,v.begin+n-1,v.end())
#define dnth(v,n) nth_element(v.begin,v.begin+n-1,v.end(), greater<int>())
#define pb push_back
#define ll long long

int fact(int n) 
{ 
    int res = 1; 
    for (int i = 2; i <= n; i++) 
        res = res * i; 
    return res; 
}
int nCr(int n, int r) 
{ 
    return fact(n) / (fact(r) * fact(n - r)); 
}
int cel(int a,int b){return((a-1)/b+1);} 
int gcd(int a, int b)
{
    if (a < b)
        swap(a, b);
    if (b == 0)
        return a;
    else
        return gcd(b, a % b);
}
int lcm(int a,int b){
    return (a*b)/gcd(a,b);
}
void dfs(int u,vi &visited,vi adj[]) {
    visited[u] = 1; 
	for (int i=0; i<adj[u].size(); i++) 
		if (visited[adj[u][i]] == 0) 
			dfs(adj[u][i],visited,adj); 
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int n,t;
    cin>>n;
    if(n>=30)cout<<"Yes";
    else cout<<"No";
    return 0;
}

Measured memory_bytes: 3632
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Text.RegularExpressions;
using static System.Console;

namespace AtCoder_1
{
    class Program
    {
        static void Main(string[] args)
        {
            var a = Cin().Split('/');
            if(S2i(a[0]) >= 2019)
            {
                if(S2i(a[1]) < 5) {
                    Cout("Heisei");
                }
                else
                {
                    Cout("TBD");
                }
            }
            else
            {
                Cout("Heisei");
            }
            
            Cin();
        }

        static readonly int MOD1E9 = (int)1e9 + 7;
        static string Cin() { return ReadLine(); }
        static string[] CinAr() { return ReadLine().Split(' '); }
        static int CinT() { return S2i(Cin()); }
        static int[] CinTAr() { return CinAr().Select((x, i) => { return S2i(x); }).ToArray(); }
        static long CinL() { return S2L(Cin()); }
        static long[] CinLAr() { return CinAr().Select((x, i) => { return S2L(x); }).ToArray(); }
        static double CinD() { return S2D(Cin()); }
        static double[] CinDAr() { return CinAr().Select((x, i) => { return S2D(x); }).ToArray(); }
        static int S2i(string s) { return int.Parse(s); }
        static long S2L(string s) { return long.Parse(s); }
        static double S2D(string s) { return double.Parse(s); }
        static void OYes() { Cout("Yes"); }
        static void ONo() { Cout("No"); }
        static void Cout(object s) { WriteLine(s); }
        /// <summary>
        /// Debug時のみの使用を推奨
        /// </summary>
        /// <typeparam name="Type"></typeparam>
        /// <param name="types"></param>
        static void CoutAr<Type>(IEnumerable<Type> types)
        {
            string text = "";
            foreach (var i in types)
            {
                text += " " + i;
            }
            WriteLine(text.Substring(1));
        }
    }
}


Measured memory_bytes: 11092
def main():
    H,W = map(int,input().split())
    cost = [[2**60]*10 for _ in range(10)]
    for i in range(10):
        cost[i][i] = 0
    for j in range(10):
        for i,c in enumerate(tuple(map(int,input().split()))):
            cost[j][i] = c
    a = [tuple(map(int,input().split()))for _ in range(H)]
    for k in range(10):
        for i in range(10):
            for j in range(10):
                cost[i][j] = min(cost[i][j],cost[i][k]+cost[k][j])
    ans = 0
    for h in range(H):
        for w in range(W):
            if a[h][w] == -1:continue
            ans += cost[a[h][w]][1]
    print(ans)

if __name__ == "__main__":
    main()

Measured memory_bytes: 3444
import java.io.*;
import java.util.*;

public class Main {
	static final int N=(int)5005;
    public static void main(String[] args) {  
        InputStream sys=System.in;
        InputReader in=new InputReader(sys);
        PrintWriter out=new PrintWriter(System.out);
        int n=in.nextInt();
        if(n/100==n%10) out.println("Yes");
        else out.println("No");
        out.flush();
    }
	static class InputReader {
		public BufferedReader reader;
		public StringTokenizer tokenizer;
        
		public InputReader(InputStream stream) {
			reader = new BufferedReader(new InputStreamReader(stream), 32768);
			tokenizer = null;
		}

		public String next() {
			while (tokenizer == null || !tokenizer.hasMoreTokens()) {
				try {
					tokenizer = new StringTokenizer(reader.readLine());
				} catch (IOException e) {
					throw new RuntimeException(e);
				}
			}
			return tokenizer.nextToken();
		}

		public int nextInt() {
			return Integer.parseInt(next());
		}
		
		public double nextDouble() {
			return Double.parseDouble(next());
		}
	}
}

Measured memory_bytes: 21076
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

fn main() {
    input!{
        n: usize,
        a: [i32; n],
    }

    let mut c = [0;100001];
    let mut ignore = 0;

    for i in 0..n {
        let x = a[i];
        if x > 100000 {
            ignore += 1;
            continue;
        }
        c[x as usize] += 1;
    }


    for i in 0..100001 {
        let x = c[i];
        if x == 0 {
            continue;
        }
        if x == i {
            continue;
        }
        if x > i {
            ignore += x -i;
        } else {
            ignore += x;
        }
    }

    println!("{}", ignore);
}


Measured memory_bytes: 5116