akhauriyash/Code-Regression huggingface dataset:
using System;

namespace ConsoleApp1
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] line = Console.ReadLine().Split(' ');
            for(var p = 0; p < line.Length; p++)
            {
                if(int.Parse(line[p]) == 0)
                {
                    Console.WriteLine(p + 1);
                }
            }
        }
    }
}


Measured memory_bytes: 27540
import java.util.*;
public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int N = Integer.parseInt(sc.next()); 
    int counter = 0;
    int max = 0;
    int a[] = new int[N];
    for (int i=0; i < N ;i++) {
        a[i] = Integer.parseInt(sc.next()); 
    }
    for (int i=0; i < N-1 ;i++) {
        if(a[i] >= a[i+1]){
            counter++;
            max = Math.max(max,counter);
        }else{
            counter=0;
        }
    }
    System.out.println(max);
  }
}



Measured memory_bytes: 45960
import collections
N = int(input())

def prime_factorize(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a

def main():
    c = prime_factorize(N)
    if c == []:
        print(0)
        return
    else:
        coll = collections.Counter(c).values()
        ans = 0
        for i in coll:
            tmp = 0
            while i > 0:
                if(tmp < i):
                    ans += 1
                    tmp += 1
                    i -= tmp
                else:
                    break
        print(ans)
        return

if __name__ == "__main__":
    main()

Measured memory_bytes: 65980
import sys

def solve():
      input = sys.stdin.readline
      N = int(input())
      A = [int(a) for a in input().split()]
      sumA = 0
      mod = 7 + 10 ** 9
      for a in A:
            sumA += a
            sumA %= mod
      ans = 0
      for a in A:
            ans += ((sumA - a + mod) * a) % mod
            ans %= mod
      print((ans * pow(2, mod-2, mod)) % mod)

      return 0

if __name__ == "__main__":
      solve()

Measured memory_bytes: 30972
def p_n():
    from itertools import accumulate
    n = int(input())
    *a, = map(int, input().split())
    ac = list(accumulate(a)) + [0]
    dp = [[0] * (n + 1) for _ in range(n + 1)]
    for i in range(2, n + 1):
        for j in range(n - i + 1):
            dp[i][j] = ac[j + i - 1] - ac[j - 1] + min(dp[k][j] + dp[i - k][j + k] for k in range(1, i))
    print(dp[-1][0])


if __name__ == '__main__':
    p_n()


Measured memory_bytes: 43356
#include <iostream>
#include <string>
using namespace std;
int main(){
	int cnt=0,x,y;
	char zero;
	while(cin>>zero){
		char masu[8][8];
		cnt=0;
		for(int i=0;i<8;i++){
			for(int j=0;j<8;j++){
				if(i==0&&j==0){
					masu[0][0]=zero;
				}else{
					cin>>masu[i][j];
				}
				if(masu[i][j]=='1'&&cnt==0){
					x=i,y=j;
					cnt++;
				}
			}
		}
		if(masu[x][y+1]=='1'){
			if(masu[x][y+2]=='1'){
				cout<<"C"<<endl;
			}else if(masu[x+1][y]=='0'){
				cout<<"E"<<endl;
			}else if(masu[x+1][y+1]=='0'){
				cout<<"G"<<endl;
			}else{
				cout<<"A"<<endl;
			}
		}else{
			if(masu[x+1][y-1]=='1'){
				cout<<"D"<<endl;
			}else if(masu[x+1][y+1]=='1'){
				cout<<"F"<<endl;
			}else{
				cout<<"B"<<endl;
			}
		}
	}
	return 0;
}

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

#define int long long

#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=(int)a, i##_len=(b); i<i##_len; i++)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define all(box) box.begin(), box.end()

using namespace std;

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

const long long INF = LLONG_MAX/3;

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

struct UnionFind{
	std::vector<int> par,siz;
	void init(int n){
		par.resize(n);
		for(int i=0;i<n;i++)par[i]=i;
		siz.resize(n,1);
	}
	UnionFind(int n){
		init(n);
	}
	int root(int n){
		if(par[n]==n)return n;
		else return par[n]=root(par[n]);
	}
	bool issame(int x,int y){
		return (root(x)==root(y));
	}
	bool marge(int a,int b){
		if(issame(a,b))return false;
		else{
			a=root(a),b=root(b);
			if(siz[a]<siz[b])swap(a,b);
			siz[a]+=siz[b];
			par[a]=par[b];
			return true;
		}
	}
	int size(int n){
		return siz[root(n)];
	}
};

long long gcd(long long a,long long b){
    if(b==0)return a;
    return gcd(b,a%b);
}
long long lcm(long long i,long long j){
    return i*(j/gcd(i,j));
}

const int MOD=1e9+7;
long long fac[510000], finv[510000], inv[510000];
long long MAX=510000;
bool COMinited=false;
long long COM(int n, int k){
	if(COMinited==false){
		fac[0] = fac[1] = 1;
    	finv[0] = finv[1] = 1;
    	inv[1] = 1;
    	for (int i = 2; i < MAX; i++){
        	fac[i] = fac[i - 1] * i % MOD;
        	inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        	finv[i] = finv[i - 1] * inv[i] % MOD;
    	}
		COMinited=true;
	}
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
long long modpow(long long a, long long n, long long mod) {
    long long res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}
long long modinv(long long a, long long mod) {
    return modpow(a, mod - 2, mod);
}

signed main(){
	int n,k;
	cin>>n>>k;
	int h[200010];
	rep(i,n)cin>>h[i];
	sort(h,h+n);
	int s=0;
	rep(i,n-k)s+=h[i];
	cout<<s<<endl;
}


Measured memory_bytes: 1792
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <string>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <iomanip>
#include <utility>
#include <tuple>
#include <functional>
#include <bitset>
#include <cassert>
#include <complex>
#include <stdio.h>
#include <time.h>
#include <numeric>
#include <unordered_map>
#include <unordered_set>
#define all(a) a.begin(),a.end()
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define pb push_back
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
typedef long double ld;
typedef complex<ld> com;
constexpr int inf = 1000000000;
constexpr ll INF = 1000000000000000000;
constexpr ld EPS = 1e-12;
constexpr ld PI = 3.141592653589793238;
template<class T, class U> inline bool chmax(T &a, const U &b) { if (a < b) { a = b; return true; } return false; }
template<class T, class U> inline bool chmin(T &a, const U &b) { if (a > b) { a = b; return true; } return false; }


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

	int n;
	cin >> n;
	vector<int> c(n - 1), s(n - 1), f(n - 1);
	rep(i, n - 1) cin >> c[i] >> s[i] >> f[i];
	rep(i, n) {
		int time = 0;
		for (int j = i; j < n - 1; j++) {
			if (time%f[j] != 0) {
				time -= time % f[j];
				time += f[j];
			}
			if (time < s[j]) time = s[j];
			time += c[j];
		}
		cout << time << '\n';
	}
}

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

using namespace std;
typedef long long ll;

#define MAX 200010
ll MOD = 1000000007;
int x[MAX/2];
ll Inv[MAX], fact[MAX], factInv[MAX];

void calc_modinv() {
    Inv[1] = 1;
    for(int i=2; i<=MAX; i++) {
        Inv[i] = MOD - (MOD / i) * Inv[MOD%i] % MOD;
    }
}

void calc_factinv() {
    fact[0] = factInv[0] = 1;
    for(int i=1; i<=MAX; i++) {
        fact[i] = (fact[i-1] * i) % MOD;
        factInv[i] = (factInv[i-1] * Inv[i]) % MOD;
    }
}

long long nCr(int n, int r) { 
    if(n - r >= 0 && r >= 0) return fact[n] * factInv[r] % MOD * factInv[n - r] % MOD;
    else return 0;
}

int main(void) {
    int i, n, l, r, z;
    cin >> n;
    for(i=0; i<n+1; i++) {
        scanf("%d", &z);
        if (x[z] != 0)l = x[z] - 1, r = i;
        x[z] = i + 1;
    }
    
    calc_modinv();
    calc_factinv();

    ll ans;
    for(int k=1; k<=n+1; k++) {
        ans = (nCr(n+1, k) - nCr(n - (r-l), k-1) + MOD) % MOD;
        printf("%lld\n", ans);
    }

    return 0;
}

Measured memory_bytes: 6272
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		ArrayList<Integer> num = new ArrayList<Integer>();
		ArrayList<String> param = new ArrayList<String>();
		int system = 0; // 文字の空白区切り 0:ON 1:OFF

		while (sc.hasNext()) {
			if (sc.hasNextInt()) {
				num.add(sc.nextInt());
			} else {
				if (system == 0)
					param.add(sc.next());
				if (system == 1)
					param.add(sc.nextLine());
			}
		}
		Method(num, param);
	}

	static void Method(ArrayList<Integer> num, ArrayList<String> param) {
		Map<String, Integer> bottle = new HashMap<String, Integer>();
		String mozi = "";
		boolean cheak = false;

		for (int i = 0; i < param.get(0).length(); i++) {
			mozi = param.get(0).substring(i,i+1);
			if(bottle.containsKey(mozi)){
				bottle.put(mozi,bottle.get(mozi)+1);
			} else {
				bottle.put(mozi,1);			
			}
		}
		for (String key : bottle.keySet()) {
		    if(bottle.get(key) % 2 != 0) cheak = true;
		}
		if(cheak){
			System.out.println("No");
		} else {
			System.out.println("Yes");
		}
	}
}

Measured memory_bytes: 22868
#include <iostream>
#include <algorithm>
#include <string>
#include <map>
#include <math.h>
#include <set>

using namespace std;
typedef long long  ll;
#define rep(i,s,n)for(ll i=s;i<n;i++)
#define repe(i,s,n)for(ll i=s;i<=n;i++)

static const double PI = 3.1415926535897932384626433;

///////////////////////////
////Prime Creator//////////
///////////////////////////
//bool Prime[100001] = {};
//void createPrime() {
//	ll n = 100001;
//	rep(i, 0, n) Prime[i] = true;
//	Prime[0] = false;
//	Prime[1] = false;
//	rep(i, 2, n) {
//		if (Prime[i]) {
//			rep(j, 2, n) {
//				if (j*i >= n)break;
//				Prime[j*i] = false;
//			}
//		}
//	}
//}
///////////////////////////
///////////////////////////

///////////////////////////
////Warshal Floyid/////////
///////////////////////////
////initialize`
////rep(i, 0, N)rep(j, 0, N) wf[i][j] = 1 << 29;
//static const ll WF_MAX = 300;
//ll wf[WF_MAX][WF_MAX];
//void WarshalFloyid(int size) {
//	rep(k, 0, size)rep(i, 0, size)rep(j, 0, size)wf[i][j] = min(wf[i][j], wf[i][k] + wf[k][j]);
//}

ll x[100001] = {};
ll y[100001] = {};
int main() {
	ll n, m; cin >> n >> m;
	repe(i, 1, n)cin >> x[i];
	repe(i, 1, m)cin >> y[i];
	//sort(x + 1, x + n);
	//sort(y + 1, y + n);
	ll MOD = 1000000007;
	ll X = 0;
	repe(k, 1, n) {
		X = (X + (2 * k - n - 1)*x[k] % MOD) % MOD;
	}
	ll Y = 0;
	repe(k, 1, m) {
		Y = (Y + (2 * k - m - 1)*y[k] % MOD) % MOD;
	}

	cout << X * Y % MOD << endl;
	return 0;
}

Measured memory_bytes: 1792
#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++)
#define dame { printf("No\n"); return 0;}
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)


char chara[MAX];
char houkou[MAX];
int n,q;
string s;


bool solve(int x){
    if(x < 0 ) return false;
    int now = x;
    REP(i,q){
        if(s[now] == chara[i]){
            if(houkou[i] == 'L'){
                now --;
                if(now < 0) return false;
            }
            else{
                now ++;
            }
        }
    }
    return true;
}


bool solve2(int x){
    if(x >= n) return false;
    int now = x;
    REP(i,q){
        if(s[now] == chara[i]){
            if(houkou[i] == 'L'){
                now --;
            }
            else{
                now ++;
                if(now >= n) return false;
            }
        }
    }
    return true;
}




signed main(){

    cin >> n >> q;
    cin >> s;

    REP(i,q){
        cin >> chara[i] >> houkou[i];
    }


    int lef = -1, rig = n-1;
    while(lef + 1 < rig){
        int mid = (lef + rig) / 2;
        if(solve(mid))  rig = mid;
        else lef = mid;
    }
    int leftans = lef;

    REP(i,3){
        if( not solve(lef -1 + i)) leftans = lef - 1 + i;
    }

    if(not solve2(leftans + 1)){
        cout << 0 << endl;
        return 0;
    }

    lef = leftans + 1;
    rig = n;

    while(lef + 1 < rig){
        int mid = (lef + rig ) / 2;
        if(solve2(mid)) lef = mid;
        else rig = mid;
    }
    int rightans = rig;


    REP(i,3){
        if( not solve2(rig +1 - i)) rightans = rig + 1 - i;
    }
    cout << max(llong(0),n - (leftans + 1) - (n - rightans)) << endl;


}


Measured memory_bytes: 900
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <cctype>
#include <cassert>
#include <climits>
#include <string>
#include <bitset>
#include <cfloat>
#include <unordered_set>
#pragma GCC optimize("Ofast")
using namespace std;
typedef long double ld;
typedef long long int ll;
typedef unsigned long long int ull;
typedef vector<int> vi;
typedef vector<char> vc;
typedef vector<bool> vb;
typedef vector<double> vd;
typedef vector<string> vs;
typedef vector<ll> vll;
typedef vector<pair<int,int> > vpii;
typedef vector<vector<int> > vvi;
typedef vector<vector<char> > vvc;
typedef vector<vector<string> > vvs;
typedef vector<vector<ll> > vvll;
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define irep(it, stl) for(auto it = stl.begin(); it != stl.end(); it++)
#define drep(i,n) for(int i = (n) - 1; i >= 0; --i)
#define fin(ans) cout << (ans) << '\n'
#define mp(p,q) make_pair(p, q)
#define pb(n) push_back(n)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define floatprec(dig) fixed << setprecision(dig)
#define Sort(a) sort(a.begin(), a.end())
#define Rort(a) sort(a.rbegin(), a.rend())
#define MATHPI acos(-1)
#define itn int;
int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
template <class T> inline bool chmax(T& a,T b){if(a<b){a=b;return 1;} return 0;}
template <class T> inline bool chmin(T& a,T b){if(a>b){a=b;return 1;} return 0;}
struct io{io(){ios::sync_with_stdio(false);cin.tie(0);}};
const int INF = INT_MAX;
const ll LLINF = 1LL<<60;
const ll MOD = 1000000007;
const double EPS = 1e-9;

void dfs(vvi& points, vll& acc, vi& q, int cur, int prev) {
  for(auto p : points[cur]) {
    if(p != prev) {
      acc[p] = acc[cur] + q[p];
      dfs(points, acc, q, p, cur);
    }
  }
}

signed main(void) {
  cin.tie(0);
  ios::sync_with_stdio(false);
  
  int N, Q;
  cin >> N >> Q;
  vvi points(N, vi());
  vll acc(N);
  rep(i, N - 1) {
    int a, b;
    cin >> a >> b;
    --a; --b;
    points[a].push_back(b);
    points[b].push_back(a);
  }
  vi q(N);
  rep(i, Q) {
    int p, x;
    cin >> p >> x;
    --p;
    q[p] += x;
  }
  
  acc[0] = q[0];
  
  //ルートからDFSたどる
  dfs(points, acc, q, 0, -1);
  
  rep(i, N) {
    cout << acc[i] << " ";
  }
  cout << endl;
}


Measured memory_bytes: 37632
n = int(input())
a = list(map(int,input().split()))
b = list(map(int,input().split()))
c = list(map(int,input().split()))
ans = sum(b)
for i in range(n-1):
        if a[i]+1 == a[i+1]:
            ans += c[a[i]-1]
print(ans)

Measured memory_bytes: 9052
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N,M;
  cin >> N >> M;
  int x=0;
  int y = 0;
  if(N>1)
  	x = N*(N-1)/2;
  if(M>1)
  	y = M*(M-1)/2;
  cout << x+y << endl;
 

}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define INF 1LL<<62
#define inf 1000000007 

map <ll,ll>a;
int main() {
	ll n;
	cin>>n;
	for(ll i=1;i<=n;i++){
		ll x;
		cin>>x;
		a[x]=i;
	}
    for(auto itr = a.begin(); itr != a.end(); ++itr,cout << (itr!=a.end()? " ":"\n")) {
        ll vale= itr->second ;
        cout << vale;
    }	
	// your code goes here
	return 0;
}

Measured memory_bytes: 7040
#include <iostream>
#include <algorithm>
#include <cstring>
#include <cmath>
#include <vector>
#include <set>
#include <queue>
#include <map>
#include <string>

#define rep(i, a, b) for ( int i = (a); i < (b); i++ )
#define per(i, a, b) for ( int i = (b)-1; i >= (a); i--)
#define pb push_back
#define mp make_pair
#define bg begin()
#define en end()
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define sz(v) (int)(v).size()

using namespace std;

typedef long long ll;
typedef long double ld;

using P = pair<int, int>;

static const long long MOD = 1000000007;
static const long long LINF = (ll)(1e18+99);
static const int INF = 1e9+99;

int ans;


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

    rep(ai, 0, k+1) rep(bi, 0, k+1) rep(ci, 0, k+1) {
        if (ai+bi+ci>k) continue;
        int ta = a<<ai, tb = b<<bi, tc = c<<ci;
        if (tc>tb&&tb>ta) {
            puts("Yes");
            return 0;
        }
    } 


  
    puts("No");
    return 0;
}



Measured memory_bytes: 3632
import sys
sys.setrecursionlimit(1 << 25)
read = sys.stdin.readline
ra = range
enu = enumerate


def read_ints():
    return list(map(int, read().split()))


def read_a_int():
    return int(read())


def read_tuple(H):
    '''
    H is number of rows
    '''
    ret = []
    for _ in range(H):
        ret.append(tuple(map(int, read().split())))
    return ret


def read_col(H):
    '''
    H is number of rows
    A列、B列が与えられるようなとき
    ex1)A,B=read_col(H)    ex2) A,=read_col(H) #一列の場合
    '''
    ret = []
    for _ in range(H):
        ret.append(list(map(int, read().split())))
    return tuple(map(list, zip(*ret)))


def read_matrix(H):
    '''
    H is number of rows
    '''
    ret = []
    for _ in range(H):
        ret.append(list(map(int, read().split())))
    return ret
    # return [list(map(int, read().split())) for _ in range(H)] # 内包表記はpypyでは遅いため


MOD = 10**9 + 7
INF = 2**31  # 2147483648 > 10**9
# default import
from collections import defaultdict, Counter, deque
from operator import itemgetter
from itertools import product, permutations, combinations
from bisect import bisect_left, bisect_right  # , insort_left, insort_right

# https://atcoder.jp/contests/abc123/tasks/abc123_b

# 愚直に全部回すか
# ％10が一番小さいの料理が一番最後
A = list(map(int, open(0).read().split()))
ans = 0
B = []
for a in A:
    ans += (a - 1) // 10 + 1
    B.append(10 - a % 10 if a % 10 != 0 else 0)

print(ans * 10 - max(B))


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

#define rep(i, m, n) for(int(i) = (int)(m); i < (int)(n); ++i)
#define rep2(i, m, n) for(int(i) = (int)(n)-1; i >= (int)(m); --i)
#define REP(i, n) rep(i, 0, n)
#define REP2(i, n) rep2(i, 0, n)
#define all(hoge) (hoge).begin(), (hoge).end()
#define en '\n'
using ll = long long;
using ull = unsigned long long;
template <class T>
using vec = vector<T>;
template <class T>
using vvec = vector<vec<T>>;
typedef pair<ll, ll> P;
using tp = tuple<ll, ll, ll>;
constexpr long long INF = 1LL << 60;
constexpr int INF_INT = 1 << 25;
constexpr long long MOD = (ll)1e9 + 7;
//constexpr long long MOD = 998244353LL;
using ld = long double;
static const ld pi = 3.141592653589793L;
typedef vector<ll> Array;
typedef vector<Array> Matrix;

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

//グラフ関連
struct Edge {
    ll to, cap, rev;
    Edge(ll _to, ll _cap, ll _rev) {
        to = _to;
        cap = _cap;
        rev = _rev;
    }
};
typedef vector<Edge> Edges;
typedef vector<Edges> Graph;

void add_edge(Graph &G, ll from, ll to, ll cap, bool revFlag, ll revCap) {
    G[from].push_back(Edge(to, cap, (ll)G[to].size()));
    if(revFlag)
        G[to].push_back(Edge(from, revCap, (ll)G[from].size() - 1));
}

void solve() {
    ll n;
    cin >> n;
    if(n >= 30)
        cout << "Yes" << en;
    else
        cout << "No" << en;
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    /*
    ll t;
    cin >> t;
    while(t--)*/
    solve();

    return 0;
}


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

main()
{
	int n; cin >> n; int a[n];
	for(int i=0;i<n;i++) cin >> a[i];
	
	
	
	
	int dp[n];
	dp[0]=0;
	dp[1]= abs(a[1]-a[0]);
//	cout << dp[0] << " " << dp[1] << endl;
	for(int i=2;i<n;i++)
	{
		int onejump =  (dp[i-1]+abs(a[i]-a[i-1]));
		int twojump = (dp[i-2]+abs(a[i]-a[i-2]) );
	//	cout << onejump << " " << twojump << endl;
		dp[i] = min(onejump,twojump);
	//	cout << dp[i] << endl;
	}
//	cout << endl;
	cout << dp[n-1] << endl;
	
}

Measured memory_bytes: 1024
n, k = map(int, input().split())
 
h = list(map(int, input().split()))
sum = 0
h.sort()

if n <= k:
  print(0)
else:
   for i in range(0, k):
    h[n-i-1] = 0
  
   for i in range(0, n):
    sum += h[i]
   
   print(sum)

Measured memory_bytes: 26024
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long LL;
typedef long double ld;
typedef vector<ll>VI;
typedef pair<ll,ll>P;
#define VV(T) vector<vector<T>>
#define sz(x) int(x.size())
#define PI 3.1415926535897932384626433832795
#define rep(i, n) for (ll i = 0; i < (ll)n; i++)
#define ALL(a)  (a).begin(),(a).end()
#define rALL(a) (a).rbegin(),(a).rend()
#define c_max(a, b) (((ll)a)>((ll)b)?(a):(b))
#define c_min(a,b) (((ll)a)<((ll)b)?(a):(b))
#define chmax(x,a) x=max(x,a)
#define chmin(x,a) x=min(x,a)
#define vmax(v) *max_element(ALL(v))
#define vmin(v) *min_element(ALL(v))
#define $(x) {cout<<#x<<" = " <<(x)<<endl;}
#define fi first
#define se second
#define MAX 100100//5
#define MAX2 200100
#define MAX6 1001001//6
#define MAX7 10010010//7
#define SENTINEL 2000000000//9
const int MOD = 1000000007;
#define INF 1<<30
#define INFTY 1LL<<61
#define MAX_INT INT_MAX
#define Endl '\n'
#define CLR(mat) memset(mat, 0, sizeof(mat))
inline ll GCD(ll a,ll b){return b?GCD(b,a%b):a;}
inline ll lcm(ll a,ll b){return a*b/GCD(a,b);}
template<class T> bool contain(const std::string& s, const T& v) {
   return s.find(v) != std::string::npos;
}
using Edge=pair<int,ll>;
using Graph=vector<vector<ll> >;//ll or Edge
//const int dx[4]={1,0,-1,0},dy[4]={0,1,0,-1};
// sort_reverse -> greater<long long>()
// vector型から重複を削除 list.erase(unique(ALL(list)),list.end());
// g++ -o a a.cpp -Wall -lm -std=c++17
//push_back -> emplace_back

int main(){
   ll n;cin>>n;
   VI A(n+1);
   rep(i,n+1)cin>>A[i];
   VI L(n+1),R(n+1);
   L[n]=R[n]=A[n];
   for(int i=n-1;i>=0;i--){
      L[i]=A[i]+(L[i+1]+2-1)/2;
      R[i]=A[i]+R[i+1];
   }
   if(L[0]>1){
      cout<<-1<<Endl;
      return 0;
   }
   ll ans=0;
   ll cur=1;
   rep(i,n+1){
      ans+=cur;
      cur-=A[i];
      cur=min(cur*2,R[i+1]);
   }
   cout<<ans<<endl;
}

Measured memory_bytes: 5616
#include <bits/stdc++.h>
using namespace std;
int main()
{
        long long int i,j,g=0,m=0,ans,k=0,n,r=0,a[100000],b[100000];
        cin>>n;
        string s[n];
        for(i=0;i<n;i++)
            cin>>s[i];
        for(i=0;i<n;i++)
        {
            if(s[i]=="AC")
            {
                g++;
            }
           else if(s[i]=="WA")
            {
                k++;
            }
            else if(s[i]=="TLE")
            {
                r++;
            }
            else if(s[i]=="RE")
            {
                m++;
            }
        }
        cout<<"AC"<<" x " <<g<<endl;
         cout<<"WA"<<" x " <<k<<endl;
          cout<<"TLE"<<" x " <<r<<endl;
           cout<<"RE"<<" x " <<m<<endl;

    return 0;
}



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

#define rep(i, n) for(int i = 0; i < (n); ++i)
#define all(a) (a).begin(), (a).end()
typedef long long ll;

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

  int n; cin >> n;
  map<ll, int, greater<ll>> mp;
  int a;
  rep(i, n) {
    cin >> a;
    mp[a]++;
  }

  ll H = 0, W = 0;
  for(auto elem : mp) {
    if(H != 0 && W != 0) break;
    ll tmp = elem.second;

    if(H == 0) tmp -= 2;
    if(H == 0 && tmp >= 0) H = elem.first;
    if(W == 0) tmp -= 2;
    if(W == 0 && tmp >= 0) W = elem.first;
  }

  cout << H*W << '\n';
  return 0;
}


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

int main() {
  long long X;
  cin >> X;
  double ini = 100;
  long long res = 3760;
  for (long long i = 1; i < 5000; i++) {
    ini = floor(ini * 1.01);
    if (ini >= X) {
      res = i;
      break;
    }
  }
  cout << res << endl;
  return 0;
}

Measured memory_bytes: 3592
#include<bits/stdc++.h>
#define int long long
using namespace std;
const int INF = 1e14;
const int ZERO = 0;
const double PI = 3.14159265359;
typedef pair<int,int> P;

int def(int a,int b) {
    if(b == 0) {
        return 0; //ここでは計算の都合上a^0=0とする
    }
    else {
        int A=1;
for(int i=0;i<b;i++) A = A*a%998244353;
return A;
    }
}

signed main() {
    int N;
    cin >> N;
    vector<int> vec(N);
    for(int i = 0;i < N;i++) {
        cin >> vec.at(i);
    }
    if(N == 1) {
        cout << 1 << endl;
    }
    else if(vec.at(0) != 0) {
        cout << 0 << endl;
    }
    else {
        sort(vec.begin(),vec.end());
        if(vec.at(0) == 0 && vec.at(1) == 0) {
            cout << 0 << endl;
        }
        else {
            int cnt[100010];
            for(int i = 0;i < 100010;i++) {
                cnt[i] = 0;
            }
            for(int i = 0;i < N;i++) {
                cnt[vec.at(i)]++;
            }
            int ret = 1;
            for(int i = 1;i <= vec.at(N - 1);i++) {
                ret = ret * def(cnt[i - 1],cnt[i]) % 998244353;
            }
            cout << ret << endl;
        }
    }
    
}


Measured memory_bytes: 1792
#include<bits/stdc++.h>
using namespace std;
typedef  long long ll;
using vll=vector<ll>;
using vvll=vector<vll>;
using vi=vector<int>;
using vvi=vector<vector<int>>;
using vb=vector<bool>;
using pii=pair<int,int>;
using vpii=vector<pair<int,int>>;
using plli=pair<ll,int>;
using vplli=vector<pair<ll,int>>;
using pllll=pair<ll,ll>;
using vpllll=vector<pair<ll,ll>>;

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

//pow(llpow,modpow)
template<class T> ll llpow(ll x,T n){ll ans=1;if(x==0)ans=0;while(n){if(n&1)ans*=x;x*=x;n>>=1;}return ans;}
long long modpow(long long a, long long n, long long mod) {long long res = 1;while (n > 0) {if (n & 1) res = res * a % mod;a = a * a % mod;n >>= 1;}return res;}
//最大公約数
template<class T> inline T gcd(T x,T y){if(y==0)return x; else {return gcd(y,x%y);}}
//最小公倍数
template<class T> inline T lcm(T x,T y){return x/gcd(x,y)*y;}
//逆元
long long modinv(long long a, long long m) {long long b = m, u = 1, v = 0;while (b) {long long t = a / b;a -= t * b; swap(a, b);u -= t * v; swap(u, v);}u %= m;if (u < 0) u += m;return u;}

#define rep(i, begin_i, end_i) for (ll i = (ll)begin_i; i < (ll)end_i; i++)
//試験導入
#define irep(i, end_i, begin_i) for (ll i = (ll)begin_i-1; i >= (ll)end_i; i--)

long long INF = 1LL<<60;
struct UnionFind { vector<int> d; UnionFind(int n=0): d(n,-1) {} int find(int x) { if (d[x] < 0) return x; return d[x] = find(d[x]); } bool unite(int x, int y) { x = find(x); y = find(y); if (x == y) return false; if (d[x] > d[y]) swap(x,y); d[x] += d[y]; d[y] = x; return true; } bool same(int x, int y) { return find(x) == find(y);} int size(int x) { return -d[find(x)];} };
int main( ){
    ll N,M;
    cin>>N>>M;
    vi p;
    rep(i,0,N){
        int t;
        cin>>t;
        p.push_back(t);
    }
    UnionFind uf(N+1);
    rep(i,0,M){
        int x,y;
        cin>>x>>y;
        uf.unite(x,y);
    }
    ll ans=0;
    rep(i,0,N){
        int pos=i+1,wannago=p[i];
        if(uf.same(pos,wannago))ans++;
    }
    cout<<ans<<endl;
    return 0;
}




Measured memory_bytes: 1144
#include <iostream>
#include <map>
#include <queue>
#include <vector>
#include <utility>
#include <algorithm>
using namespace std;
const int maxn = 1000100;
const int INF = 0x3f3f3f3f;
int a[5];
char ch[5];
int flag;
char shit(int i) {
    if (i == 0)
        return '-';
    else
        return '+';
}
int main() {
    flag = 0;
    int n;
    cin >> n;
    int i = 4;
    while (i) {
        a[i] = n % 10;
        n /= 10;
        i--;
    }
    int f = a[1];
    for (int i = 0; i <= 1; ++i) {
        int it = f;
        it += (i == 0) ? -a[2] : a[2];
        for (int j = 0; j <= 1; ++j) {
            int jt = it;
            jt += (j == 0) ? -a[3] : a[3];
            for (int k = 0; k <= 1; ++k) {
                int kt = jt;
                kt += (k == 0) ? -a[4] : a[4];
                if (kt == 7) {
                    cout << a[1] << shit(i) << a[2] << shit(j) << a[3] << shit(k) << a[4] << "=7" << endl;
                    flag = 1;
                    break;
                }
            }
            if (flag)
                break;
        }
        if (flag)
            break;
    }
}

Measured memory_bytes: 256
h, w = map(int, input().split())
s = [input() for _ in range(h)]
flag = 0
dx = [-1, 0, 1]
dy = [-1, 0, 1]

for i in range(h):
  for j in range(w):
    f = 0
    if s[i][j] == "#":
      for dx_ in dx:
        for dy_ in dy:
          if (dx_==0 and dy_!=0) or (dx_!=0 and dy_==0):
            nx, ny = j+dx_, i+dy_
            if 0<=nx<w and 0<=ny<h:
              if s[ny][nx] == "#":
                f = 1
      if f == 0:
        flag = 1
if flag:
  print("No")
else:
  print("Yes")

Measured memory_bytes: 3064
#include <iostream>
#include <cmath>
#include <queue>
#include <algorithm>
#include <string>
#include <vector>
#include <map>
#include <functional>
using namespace std;

long long A, B, C, D, E, F; bool u1[3009], u2[3009];

int main() {
	cin >> A >> B >> C >> D >> E >> F;
	for (int i = 0; i <= 30; i++) {
		for (int j = 0; j <= 30; j++) {
			int V1 = 100 * (i * A + j * B);
			if (V1 <= 3000) u1[V1] = true;
		}
	}
	for (int i = 0; i <= 3000; i++) {
		for (int j = 0; j <= 3000; j++) {
			int V2 = i * C + j * D;
			if (V2 <= 3000) u2[V2] = true;
		}
	}
	long double ret = 0; pair<int, int>DD = make_pair(-1, -1);
	for (int i = 1; i <= 3000; i++) {
		for (int j = 0; j <= 3000; j++) {
			if (!(u1[i] == true && u2[j] == true) || i + j > F) continue;
			long double maxv = 1.0L * E / (100.0L + E);
			long double rem = 1.0L * j / (1.0L * (i + j));
			if (rem <= maxv + 1e-9 && ret <= rem) {
				ret = rem;
				DD = make_pair(i + j, j);
			}
		}
	}
	cout << DD.first << " " << DD.second << endl;
	return 0;
}

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

#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
#define ll long long
#define pii pair<int,int>
#define all(x) begin(x), end(x)
#define loop(i,n) for(int i=0; i<n; i++)
#define rep(i,a,b,c) for(int i=a; i<b; i+=c)
#define brep(i,a,b,c) for(int i=a; i>b; i-=c)
#define tc(t) int t; cin>>t; while(t--)
#define sz(v) int((v).size())
#define pb push_back


using namespace std;

void __print(int x) {cout << x;}
void __print(long x) {cout << x;}
void __print(long long x) {std::cout << x;}
void __print(unsigned x) {std::cout << x;}
void __print(unsigned long x) {std::cout << x;}
void __print(unsigned long long x) {std::cout << x;}
void __print(float x) {std::cout << x;}
void __print(double x) {std::cout << x;}
void __print(long double x) {std::cout << x;}
void __print(char x) {cout << '\'' << x << '\'';}
void __print(const char *x) {cout << '\"' << x << '\"';}
void __print(const string &x) {cout << '\"' << x << '\"';}
void __print(bool x) {cout << (x ? "true" : "false");}
template<typename T, typename V>
void __print(const pair<T, V> &x) {cout << '{'; __print(x.first); cout << ','; __print(x.second); cout << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cout << '{'; for (auto &i : x) cout << (f++ ? "," : ""), __print(i); cout << "}";}
void _print() {cout << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cout << ", "; _print(v...);}
template <typename T> inline void inp(T &any) {cin >> any;} template <typename T, typename... U>inline void inp(T &a, U &...b) {cin >> a; inp(b...);}
#define rin(args...) ll args; inp(args);
#ifndef ONLINE_JUDGE
#define debug(x...) cout << "[" << #x << "] = ["; _print(x)
#define matdeb(mat,row,col) cout << #mat << "::" << endl; printmat(mat,row,col); printpartition;
#define debugv(v,n) cout << #v << ":" << endl; printv(v,0,n-1); printpartition;
#else
#define debug(x...)
#define matdeb(mat,row,col)
#define debugv(v,n)
#endif

const int maxm = 1000000000 + 7;

double startTime;
double getCurrentTime() {
	return ((double)clock() - startTime) / CLOCKS_PER_SEC;
}


//----------->CODE BEGINS --------------->


int main()
{

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

	int n,m;
	cin>>n>>m;

	int a,b;

	vector<int>adj[n+1];

	while(m--)
	{
		cin>>a>>b;

		adj[a].push_back(b);
		adj[b].push_back(a);
	}

	for(int i=1; i<=n; i++)
	{
		cout<<adj[i].size()<<endl;
	}



}


Measured memory_bytes: 3620
#include <iostream>
#include <vector>
#include <string>
using namespace std;
int main() {
	int n;
	cin >> n;
	int a[n];
	int min_abs = 1e9;
	int max_num = 0;
	int max_idx = 0;
	for (int i = 0; i < n; i++){
		cin >> a[i];
		if (max_num < a[i]){
			max_num = a[i];
			max_idx = i;
		}
	}
	int res = a[0];

	for (int i = 0; i < n; i++){
		if(i == max_idx) continue;
		if (min_abs > abs(a[i]-(max_num/2))){
			min_abs = abs(a[i]-(max_num/2));
			res = a[i];
		}
	}

	cout << max_num << " " << res << endl;

}


Measured memory_bytes: 640
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int,int>;
 
int main(){
  int n;
  cin >> n;
  vector<vector<string>> ans(n, vector<string>(0));
  ans.at(0).push_back("a");
  for(int i=0; i<n-1; i++){
    rep(j, ans.at(i).size()){
      int ia = 0;
      int ib = 0;
      int ic = 0;
      int id = 0;
      int ie = 0;
      int iff = 0;
      int ig = 0;
      int ih = 0;
      int ii = 0;
      int ij = 0;
      rep(l, ans.at(i).at(j).size()){
        if(ans.at(i).at(j).at(l) == 'a') ia = 1;
        if(ans.at(i).at(j).at(l) == 'b') ib = 1;
        if(ans.at(i).at(j).at(l) == 'c') ic = 1;
        if(ans.at(i).at(j).at(l) == 'd') id = 1;
        if(ans.at(i).at(j).at(l) == 'e') ie = 1;
        if(ans.at(i).at(j).at(l) == 'f') iff = 1;
        if(ans.at(i).at(j).at(l) == 'g') ig = 1;
        if(ans.at(i).at(j).at(l) == 'h') ih = 1;
        if(ans.at(i).at(j).at(l) == 'i') ii = 1;
        if(ans.at(i).at(j).at(l) == 'j') ij = 1;
      }
      int k = ia + ib + ic + id + ie + iff + ig + ih + ii + ij;
      rep(m, k+1){
        if(m == 0) ans.at(i+1).push_back(ans.at(i).at(j)+'a');
        if(m == 1) ans.at(i+1).push_back(ans.at(i).at(j)+'b');
        if(m == 2) ans.at(i+1).push_back(ans.at(i).at(j)+'c');
        if(m == 3) ans.at(i+1).push_back(ans.at(i).at(j)+'d');
        if(m == 4) ans.at(i+1).push_back(ans.at(i).at(j)+'e');
        if(m == 5) ans.at(i+1).push_back(ans.at(i).at(j)+'f');
        if(m == 6) ans.at(i+1).push_back(ans.at(i).at(j)+'g');
        if(m == 7) ans.at(i+1).push_back(ans.at(i).at(j)+'h');
        if(m == 8) ans.at(i+1).push_back(ans.at(i).at(j)+'i');
        if(m == 9) ans.at(i+1).push_back(ans.at(i).at(j)+'j');
      }
    }
  }
  sort(ans.at(n-1).begin(), ans.at(n-1).end());
  rep(i, ans.at(n-1).size()) cout << ans.at(n-1).at(i) << endl;
  return 0;
}

Measured memory_bytes: 11380
#include <bits/stdc++.h>
using namespace std;
#define REP(i,n) for (int i=0;i<(n);++i)

int N;
string s;

int main(){
    cin >> N >> s;
    int r=0,b=0;
    REP(i,N){
        s[i]=='R' ? ++r : ++b;
    }
    cout << (r > b ? "Yes" : "No") << endl;
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>


int main(void){
	int sum = 0;
	char k = 0;
	while(1){
		k = getchar();
		if(k=='\n'){
			break;
		}
		sum = sum + (k-'0');

	}
	if(sum%9==0){
		printf("Yes");
	}
	else{
		printf("No");
	}




}

Measured memory_bytes: 1588
import java.util.Scanner;

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

		int A = sc.nextInt();
		int B = sc.nextInt();
		int C = sc.nextInt();
		int X = sc.nextInt();
		int counter = 0;

		for(int a = 0; a <= A; a++) {
			for(int b = 0; b <= B; b++) {
				for(int c = 0; c <= C; c++) {
					int total = 500*a + 100*b + 50*c;
					if(total == X) counter += 1;
				}
			}
		}
      System.out.println(counter);
  }
}


Measured memory_bytes: 22608
#include <iostream>
#include <iomanip>
#include <vector>
#include <valarray>
#include <map>
#include <set>
#include <list>
#include <queue>
#include <stack>
#include <bitset>
#include <utility>
#include <numeric>
#include <algorithm>
#include <functional>
#include <complex>
#include <string>
#include <sstream>

#include <cstdio>
#include <cstdlib>
#include <cctype>
#include <cstring>
#include <cmath>

using namespace std;

#define all(c) c.begin(),c.end()
#define repeat(i,n) for(int i=0;i<static_cast<int>(n);i++)
#define debug(x) #x << "=" << (x)
#define dump(x) cerr << debug(x) << " (L:" << __LINE__ << ")"<< endl

typedef long long ll;
typedef vector<int> vi;
typedef vector<vector<int> > vvi;
typedef vector<string> vs;

template<typename T>
ostream& operator<<(ostream& os, const vector<T>& vec){
    os << "[";
    for(int i = 0; i < vec.size(); i++){
        os << vec[i] << ",";
    }
    os << "]";
    return os;
}

template<typename T>
T input(){
    T t;
    cin >> t;
    return t;
}

template<typename T>
vector<T> input(const int N){
    vector<T> v(N);
    repeat(i,N) cin >> v[i];
    return v;
}

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

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

long long mul(const long long& a, const long long& b, const long long& mod) {
    return ((a % mod) * (b % mod)) % mod;
}

long long power(const long long& x, const long long& y, const long long& mod) {
    if (y == 0) {
        return 1;
    } else if (y == 1) {
        return x % mod;
    } else {
        long long value = power(x, y / 2, mod);
        if (y % 2 == 0) {
            return mul(value, value, mod);
        } else {
            return mul(value, value, mod) * x % mod;
        }
    }
}

long long div(const long long& a, const long long& b, const long long& mod) {
    return mul(a, power(b, mod - 2, mod), mod);
}

map<long long, long long> factorials;
long long factorial(const long long& n, const long long& mod) {
    if (n == 0 || n == 1) {
        return 1;
    }
    if (factorials[n] != 0) {
        return factorials[n];
    }
    factorials[n] = n * factorial(n - 1, mod) % mod;
    return factorials[n] % mod;
}

long long combination(const long long& n, const long long& x, const long long& mod) {
    long long numerator = 1;
    long long denominator = 1;
    repeat(i, x) {
        numerator *= (n - i) % mod;
        numerator %= mod;
        denominator *= (i + 1) % mod;
        denominator %= mod;
    }
    return div(numerator, denominator, mod);
}

int main(){
    vi numbers(3);
    cin >> numbers[0] >> numbers[1] >> numbers[2];
    sort(numbers.begin(), numbers.end());
    if (numbers[0] == 5 && numbers[1] == 5 && numbers[2] == 7) {
        cout << "YES" << endl;
    } else {
        cout << "NO" << endl;
    }
    return 0;
}


Measured memory_bytes: 256
#include<algorithm>
#include <bits/stdc++.h>
#include<stdio.h>
#include<math.h>
#include<string.h>
#include<stdlib.h>
#include<stdbool.h>
#include<ctype.h>
using namespace std;
#define pb push_back
#define S second
#define F first
#define f(i,n) for(ll i=0;i<n;i++)
#define f1(i,n) for(ll i=1;i<=n;i++)
#define fb(i,n) for(ll i=n-1;i>=0;i--)
#define fb1(i,n) for(ll i=n;i>0;i--)
#define end cout<<'\n';
#define fast ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define vi vector<ll>
#define pii pair<ll,ll>
#define CASES  ll t;cin>>t;while(t--)
typedef long long ll;
typedef unsigned long long ull;
//typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> indexed_set;
//typedef tree<ll,null_type,less<ll>,rb_tree_tag,tree_order_statistics_node_update>ordered_set;
//*X.find_by_order()
//X.order_of_key()
int main()
{
fast;
    ll n;
    cin>>n;
    ll a[n];
    f(i,n)
        cin>>a[i];
    ll dp[n];
    dp[0]=0;
    dp[1]=abs(a[1]-a[0]);
    for(ll i=2;i<n;i++)
    {
        dp[i]=min((dp[i-1]+abs(a[i]-a[i-1])),(dp[i-2]+abs(a[i]-a[i-2])));
    }
    //f(i,n)
   //     cout<<dp[i]<<' ';
    cout<<dp[n-1];
    return 0;
}

Measured memory_bytes: 1792
#dpでできないかな？
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)
from collections import Counter, deque
from collections import defaultdict
from itertools import combinations, permutations, accumulate, groupby, product
from bisect import bisect_left,bisect_right
from heapq import heapify, heappop, heappush
from math import floor, ceil,pi,sqrt
from operator import itemgetter
def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))
def LI2(): return [int(input()) for i in range(n)]
def MXI(): return [[LI()]for i in range(n)]
def SI(): return input().rstrip()
def printns(x): print('\n'.join(x))
def printni(x): print('\n'.join(list(map(str,x))))
inf = 10**17
mod=10**9+7

h,w=MI()
lis=[LI() for i in range(h)]
pos=[0 for i in range(h*w)]
nums=[0 for i in range(h*w)]
count=0
for i in range(h):
    for j in range(w):
        if i%2==0:
            k=j
        else:
            k=w-j-1
        nums[count]=lis[i][k]
        pos[count]=[i+1,k+1]
        count+=1
#print(nums)
#print(pos)
c=0
for i in range(h*w):
    if nums[i]%2==1:
        c+=1
u=[]
for i in range(h*w-1):
    if nums[i]%2==1:
        nums[i+1]+=1
        u.append([pos[i],pos[i+1]])
        #print(*pos[i],*pos[i+1])
print(len(u))
for i in range(len(u)):
    print(*u[i][0],end=" ")
    print(*u[i][1])

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

int main() {
	string s;cin>>s;
	int n=s.length();
	int rem_count[2019];memset(rem_count,0,sizeof(rem_count));
	rem_count[0]=1;
	int total=0,num=0,pow10=1;
	for(int i=n-1;i>=0;i--){
	    num+=(s[i]-'0')*pow10;
	    int rem=num%2019;
	    total+=rem_count[rem];
	    rem_count[rem]++;
	    pow10*=10;num=rem;pow10=pow10%2019;
	}
	cout<<total;
}

Measured memory_bytes: 3748
def examA():
    N, A, B = LI()
    if (A-B)%2==0:
        ans = "Alice"
    else:
        ans = "Borys"
    print(ans)
    return

import sys,copy,bisect,itertools,heapq,math
from heapq import heappop,heappush,heapify
from collections import Counter,defaultdict,deque
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))
def LSI(): return list(map(str,sys.stdin.readline().split()))
def LS(): return sys.stdin.readline().split()
def SI(): return sys.stdin.readline().strip()
mod = 10**9 + 7
inf = float('inf')

if __name__ == '__main__':
    examA()


Measured memory_bytes: 38512
// Problem : D - Alter Altar
// Contest : AtCoder - AtCoder Beginner Contest 174
// URL : https://atcoder.jp/contests/abc174/tasks/abc174_d
// Memory Limit : 1024 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

#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 vvpii vector<vpii>
#define vvi vector<vi>
#define pb push_back
#define vs vector<string>
#define all(x) x.begin(),x.end()
#define mii map<int,int>
#define vd vector<double>
#define deb(x) cout<<#x<<" -> "<<x<<endl
const int inf=0x3f3f3f3f3f3f3f3f;
#define MAXN 1000005

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

void print(vi &v){
    for(int i=0;i<v.size();i++)cout<<v[i]<<" ";
    cout<<endl;
}

// <--------------------Code Begins Here-------------------->




int32_t main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    int t = 1;
    // cin>>t;
    while(t--){
        int n;
        cin>>n;
        string s;
        cin>>s;
        set<int>white;
        set<int,greater<int>>red;
        for(int i = 0; i < n; i++) {
        	if(s[i]=='R')red.insert(i);
        	else white.insert(i);
        }
        int cnt = 0;
        while(!red.empty() && !white.empty() && *red.begin()>*white.begin()){
        	cnt++;
        	red.erase(red.begin());
        	white.erase(white.begin());
        }
        cout<<cnt<<endl;
    }
    return 0;
}

Measured memory_bytes: 12968
MOD = 10 ** 9 + 7


def prepare(n):
    global MOD
    modFacts = [0] * (n + 1)
    modFacts[0] = 1
    for i in range(n):
        modFacts[i + 1] = (modFacts[i] * (i + 1)) % MOD

    invs = [1] * (n + 1)
    invs[n] = pow(modFacts[n], MOD - 2, MOD)
    for i in range(n, 1, -1):
        invs[i - 1] = (invs[i] * i) % MOD

    return modFacts, invs


def pathVar(sx, sy, gx, gy):
    x = gx - sx
    y = gy - sy
    rst = modFacts[x + y]
    rst *= invs[x] * invs[y]
    rst %= MOD
    return rst


H, W, A, B = map(int, input().split())
# H -= 1; W -= 1
modFacts, invs = prepare(H + W)

cnt = 0
while A > 0 and B > 0:
    x = H - A
    y = B - 1
    path1 = pathVar(0, 0, x, y)
    path2 = pathVar(x, y, H - 1, W - 1)
    cnt += path1 * path2
    cnt %= MOD
    A -= 1; B -= 1

ans = pathVar(0, 0, H - 1, W - 1)
print((ans - cnt) % MOD)


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

int main()
{
	string s1,s2;
	while(cin >> s1 >> s2)
	{
		if(s1[0] == s2[2] && s1[1] == s2[1] && s1[2] == s2[0])
			printf("YES\n");
		else
			printf("NO\n");
	}
}

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

int main()
{
    int a,b;
    cin >> a >> b;
    int m = max(a,b);
    int n = min(a,b);
    if(m - n >= 2){
        cout << m + m-1 << endl;
    }else{
        cout << m + n << endl;
    }
    return 0;
}

Measured memory_bytes: 256
N, Q = map(int, input().split())
AB = [list(map(int, input().split())) for _ in range(N - 1)]
PX = [list(map(int, input().split())) for _ in range(Q)]
 
graph = [[] for _ in range(N + 1)]
for a, b in AB:
  graph[a].append(b)
  graph[b].append(a)
  
cost = [0] * (N + 1)
for p, x in PX:
  cost[p] += x
  
check = [0] * (N + 1)
stack = [1]
check[1] = 1
 
while stack:
  s = stack.pop()
  for g in graph[s]:
    if check[g] == 0:
      check[g] = 1
      cost[g] += cost[s]
      stack.append(g)
      
print(*cost[1:])

Measured memory_bytes: 125088