akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <iomanip>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <algorithm>
#include <cstdio>
#include <utility>
#include <string>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <deque>
#include <numeric>

using namespace std;

typedef uint64_t u64;
typedef int64_t s64;
typedef uint32_t u32;
typedef int32_t s32;
typedef vector<s32> vs32;
typedef vector<u32> vu32;
typedef vector<s64> vs64;
typedef vector<u64> vu64;

const double PI=3.14159265358979323846;

#define MAX(x, y) ((x) < (y) ? (y) : (x))
#define MIN(x, y) ((x) > (y) ? (y) : (x))

#define rep(i, N) for(int i = 0; i < N; ++i)

#define CEIL(x, y) (((x) + (y) - 1) / (y))
#define MOD 1000000007ULL

#define IN(l, r, x) ((l) <= (x) && (x) < (r))


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

    int n, m;
    cin >> n;
    map<string, int> dict;
    rep (i, n)
    {
        string s;
        cin >> s;
        ++dict[s];
    }
    cin >> m;
    rep (i, m)
    {
        string s;
        cin >> s;
        --dict[s];
    }

    int ans = 0;
    for (auto& p : dict)
    {
        ans = MAX(ans, p.second);
    }

    cout << ans << "\n";
    return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
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; }
const ll INF = 1LL << 60;

int main() {
    int n, m; cin >> n >> m;
    vector<int> h(n);
    for (int i = 0; i < n; i++) {
        scanf("%d", &h[i]);
    }
    vector<bool> T(n, true);
    for (int i = 0; i < m; i++) {
        int a, b; cin >> a >> b;
        if (h[a - 1] > h[b - 1]) {
            T[b - 1] = false;
        } else if (h[a - 1] < h[b - 1]) {
            T[a - 1] = false;
        } else {
            T[a - 1] = false;
            T[b - 1] = false;
        }
    }
    
    int cnt = 0;
    for (int i = 0; i < n; i++) {
        if (T[i]) cnt++;
    }
    cout << cnt << endl;
    return 0;
}

Measured memory_bytes: 3812
#include <iostream>
#include <vector>
#include <map>
#include <algorithm>
using namespace std;
typedef long long ll;

int main() {
	int N;
	vector<int> X;
	cin >> N;
	int tmp, ans = 2000000000;
	for (int i = 0; i < N; i++) {
		cin >> tmp;
		X.push_back(tmp);
	}
	sort(X.begin(), X.end());
	int start = X.at(0);
	int end = X.at(X.size()-1);
	for (int i = start; i <= end; i++) {
		tmp = 0;
		auto Xend = X.end();
		for (auto Xitr = X.begin(); Xitr != Xend; Xitr++) {
			tmp += (i - *Xitr) * (i - *Xitr);
		}
		if (ans > tmp) ans = tmp;
	}

	cout << ans << "\n";
	return 0;
}


Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main(){
    int a, b;
    cin >> a >> b;
    
    // int ans = 0;
    if(a + b == 3){
        cout << 3 << endl;
    }
    if(a + b == 4){
        cout << 2 << endl;
    }
    if(a + b == 5){
        cout << 1 << endl;
    }
}

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

public class Main {

	public static void main(String[] args) {
		hayami saori = new hayami();
		int n = saori.saori_hayami();
		int[] a = new int[n];
		for(int i=0; i<n; i++){
			a[i] = saori.saori_hayami();
		}
		Arrays.sort(a);
		
		long ans = 1;
		int[] num = new int[n/2];
		int half = 0;
		if(n%2 == 0){
			for(int i=0; i<n; i++){
				if(a[i]%2 == 0){
					System.out.println(0);
					return;
				}
				num[a[i] / 2]++;
			}
		}else{
			for(int i=0; i<n; i++){
				if(a[i]%2 == 1){
					System.out.println(0);
					return;
				}
				if(a[i] == 0){
					half++;
				}else{
					num[a[i] / 2 - 1]++;
				}
			}
			if(half != 1){
				System.out.println(0);
				return;
			}
		}
		for(int i=0; i<n/2; i++){
			if(num[i/2] != 2){
				System.out.println(0);
				return;
			}
			ans *= 2;
			if(ans >= 1000000007){
				ans %= 1000000007;
			}
		}
		System.out.println(ans);

	}

}

class hayami implements Closeable {
	private final InputStream in = System.in;
	private final byte[] hayami = new byte[1024];
	private int Hayami = 0;
	private int saori = 0;
	private boolean HayamiSaori() {
		if (Hayami < saori) {
			return true;
		}else{
			Hayami = 0;
			try {
				saori = in.read(hayami);
			} catch (IOException e) {
				e.printStackTrace();
			}
			if (saori <= 0) {
				return false;
			}
		}
		return true;
	}
	private int SaoriHayami() { 
		if (HayamiSaori()) {
            return hayami[Hayami++];
         }else{
             return -1;
         }
	}
	private static boolean hayami_saori(int hayami) { 
		return 33 <= hayami && hayami <= 126;
	}
	public boolean hayamisaori() { 
		while(HayamiSaori() && !hayami_saori(hayami[Hayami])) Hayami++; return HayamiSaori();
	}
	public String nextHayami() {
		if (!hayamisaori()) throw new NoSuchElementException();
		StringBuilder hayamin = new StringBuilder();
		int saori = SaoriHayami();
		while(hayami_saori(saori)) {
			hayamin.appendCodePoint(saori);
			saori = SaoriHayami();
		}
		return hayamin.toString();
	}
	public long saorihayami() {//nextLong
		if (!hayamisaori()) throw new NoSuchElementException();
		long hayami = 0;
		boolean misao = false;
		int saori = SaoriHayami();
		if (saori == '-') {
			misao = true;
			saori = SaoriHayami();
		}
		if (saori < '0' || '9' < saori) {
			throw new NumberFormatException();
		}
		while(true){
			if ('0' <= saori && saori <= '9') {
				hayami *= 10;
				hayami += saori - '0';
			}else if(saori == -1 || !hayami_saori(saori)){
				return misao ? -hayami : hayami;
			}else{
				throw new NumberFormatException();
			}
			saori = SaoriHayami();
		}
	}
	public int saori_hayami() {//nextInt
		long hayami = saorihayami();
		if (hayami < Integer.MIN_VALUE || hayami > Integer.MAX_VALUE) throw new NumberFormatException();
		return (int) hayami;
	}
	public double Hayamin() { //nextDouble
		return Double.parseDouble(nextHayami());
	}
	public void close() {
		try {
			in.close();
		} catch (IOException e) {
		}
    }
    
}

Measured memory_bytes: 22992
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
const ll MOD = 2019;
const ll INF = 1e18;
#define rep(i,m,n) for(ll i = (m); i <= (n); i++)
#define zep(i,m,n) for(ll i = (m); i < (n); i++)
#define rrep(i,m,n) for(ll i = (m); i >= (n); i--)
#define print(x) cout << (x) << endl;
#define printa(x,m,n) for(int i = (m); i <= n; i++){cout << (x[i]) << " ";} cout<<endl;

long long powmod(long long a, long long x){
    if(x == 0)return 1;
    long long r = powmod(a, x / 2);
    return (x%2)? (r * r % MOD) * a % MOD : r * r % MOD;
}

int main(){
	cin.tie(0); ios::sync_with_stdio(false);
	
	string s; cin >> s;
	ll n = s.size();
	ll v[n];
	ll x = 0;
	rrep(i, n-1, 0){
		ll y = s[i]-'0';
		x += y*powmod(10, n-1-i);
		x %= 2019;
		v[i] = x;	
	}
	
	ll cnt[2019]; memset(cnt, 0, sizeof(cnt));
	cnt[0] = 1;
	ll ans = 0;
	zep(i, 0, n){
		//print(v[i])
		ans += cnt[v[i]];
		cnt[v[i]]++;
	}
	print(ans)
	return 0;
}

Measured memory_bytes: 5292
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <numeric>
#include <queue>
#include <vector>
#include <cmath>
#include <cctype>
#include <cstring>
#include <cstdio>
#include <set>

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

using namespace std;

typedef long long LL;
typedef pair<int, int> PII;

string eraser = "resare";
string _erase = "esare";
string dreamer = "remaerd";
string dream = "maerd";

int main(void){
  string s;
  cin >> s;
  reverse(s.begin(), s.end());

  for (int i = 0; i < s.length(); i++) {
    if (s.substr(i, 5) == _erase) {
      i += 4;
    } else if (s.substr(i, 5) == dream) {
      i += 4;
    } else if (s.substr(i, 6) == eraser) {
      i += 5;
    } else if (s.substr(i, 7) == dreamer) {
      i += 6;
    } else {
      cout << "NO" << endl;
      return 0;
    }
  }

  cout << "YES" << endl;

  return 0;
}

Measured memory_bytes: 512
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
int strdcmp(const char *a, const char *b){
  return strcmp(b,a);
}
int main(){
  char s[101],t[101];
  scanf("%s %s",s,t);
  qsort(s,strlen(s),sizeof(char),strcmp);
  qsort(t,strlen(t),sizeof(char),strdcmp);
  puts(strcmp(s,t)<0?"Yes":"No");
  return 0;
}

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

void die(){
	cout << "No";
	exit(0);
}
long long arr[100005];
int main(){
	//freopen("i.txt","r",stdin);
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	
	int n, m, k;
	cin >> n >> m >> k;
	
	int a[n];
	int b[m];
	
	for(int i = 0;i < n;i++) cin >> a[i];
	for(int i = 0;i < m;i++) cin >> b[i];
	
	int minA = 12839232, minB = 132321323;
	
	for(int i =0 ;i < n;i++) minA = min(minA, a[i]);
	for(int i =0 ;i < m;i++) minB = min(minB, b[i]);
	
	int ans = minA+minB;
	
	for(int i = 0;i < k;i++){
		int x, y, z;
		cin >> x >> y >> z;
		x--; y--;
		ans = min(ans, max(0, a[x] + b[y] - z));
	}
	
	cout << ans;
	
}


Measured memory_bytes: 1024
a = input().split()

if int(a[0])<=int(a[1]) and int(a[0])<=int(a[2]):
  min = int(a[0])
  if int(a[1])<=int(a[2]):
    max = int(a[2])
  else:
    max = int(a[1])
elif int(a[1])<=int(a[2]) and int(a[1])<=int(a[0]):
  min = int(a[1])
  if int(a[0])<=int(a[2]):
    max = int(a[2])
  else:
    max = int(a[0])
else:
  min = int(a[2])
  if int(a[0])<=int(a[1]):
    max = int(a[1])
  else:
    max = int(a[0])

print(max-min)

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

int main() {
  int n;
  cin >> n;
  int k = 1;
  rep(i,0,n) {
    int a;
    cin >> a;
    if (k == a) {
      k++;
    }
  }
  if (k == 1) {
    cout << -1 << endl;
    return 0;
  }
  cout << n-k+1 << endl;
  return 0;
}


Measured memory_bytes: 3636
# -*- coding: utf-8 -*-
import math

def main():
    N, K = map(int, input().split(' '))
    
    result = 1 / N * sum([math.pow(0.5, math.ceil(math.log2(K / n))) if n < K else 1.0 for n in range(1, N + 1)])
    print('{:.12f}'.format(result))


if __name__ == '__main__':
    main()


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

const int N = 100 * 1000 + 20;
int n, a[3][N], cnt[2], fen[N];
long long _move[2];
bool ans = true;

int get(int idx) {
        int res = 0;
        for (idx++; idx; idx -= idx & -idx)
                res += fen[idx];
        return res;
}

void add(int idx) {
        for (idx++; idx < N; idx += idx & -idx)
                fen[idx]++;
}

int main() {
        cin >> n;
        for (int i = 0; i < 3; i++)
                for (int j = 0; j < n; j++)
                        cin >> a[i][j], a[i][j]--;
        for (int i = 0; i < 3; i++)
                for (int j = 0; j < n; j++)
                        ans &= a[i][j] % 2 == (i + j) % 2;
        for (int i = 0; i < n; i++) {
                for (int j = 0; j < 3; j++)
                        for (int k = 0; k < 3; k++)
                                ans &= a[j][i] / 3 == a[k][i] / 3;
                cnt[i % 2] += (a[0][i] % 3 == 2);
                ans &= (a[0][i] / 3) % 2 == i % 2;
                ans &= a[1][i] % 3 == 1;
        }
        for (int i = 0; i < n; i += 2) {
                _move[0] += i / 2 - get(a[0][i] / 3);
                add(a[0][i] / 3);
        }
        memset(fen, 0, sizeof fen);
        for (int i = 1; i < n; i += 2) {
                _move[1] += i / 2 - get(a[0][i] / 3);
                add(a[0][i] / 3);
        }
        ans &= _move[0] % 2 == cnt[1] % 2;
        ans &= _move[1] % 2 == cnt[0] % 2;
        cout << (ans? "Yes": "No") << "\n";
}

Measured memory_bytes: 5176
#include <limits>
#include <iostream>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <string>
#include <vector>
#include <bitset>
#include <map>
#include <unordered_map>
#include <cstdint>
using namespace std;


int main(){
    int d,n;
    cin >> d >> n;
    
    int k = 1;
    if(d > 0) k *= 100;
    if(d > 1) k *= 100;
    
    if(n == 100) n+=1;
      
    cout << k*n << '\n';

    return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;
import java.text.DecimalFormat;

public class Main{

    public static void main(String argv[])
    {
	Scanner scan = new Scanner(System.in);
	DecimalFormat df = new DecimalFormat("0.000000");
	double r = scan.nextDouble();
	double S,L;

	S = Math.pow(r,2) * Math.PI;
	L = 2 * r * Math.PI;
	System.out.println(df.format(S)+" "+df.format(L));
    }
}

Measured memory_bytes: 28052
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long LL;
typedef vector<ll>VI;
typedef pair<ll,ll>P;
typedef pair<double,double>P_D;
#define VV(T) vector<vector<T>>
#define PI 3.1415926535897932384626433832795
#define rep(i, n) for (ll i = 0; i < (ll)n; i++)
#define reprev(i, n) for (ll i = (ll)n - 1; i >= 0; i--)
#define ALL(a)  (a).begin(),(a).end()
#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 MAX_6 1001001//6
#define MAX_7 10010010//7
#define SENTINEL 2000000000//9
#define NIL -1
const int MOD = 1000000007;
#define INF 1<<30
#define INFTY 1LL<<61
#define MAX_INT INT_MAX
#define Endl '\n'
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<int> >;//ll or Edge
using Edge=pair<int,ll>;
//const int dx[4]={1,0,-1,0},dy[4]={0,1,0,-1};
// sort_reverse...greater<ll>()
// vector型から重複を削除 list.erase(unique(ALL(list)),list.end());
// g++ -o a a.cpp -Wall -lm -std=c++17

int main(){
    int n;cin>>n;
    VI x(n),y(n);
    rep(i,n)cin>>x[i]>>y[i];
    ll res=n;
    rep(i,n){
        rep(j,n){
            if(i==j)continue;
            ll dx=x[j]-x[i],dy=y[j]-y[i];
            ll sub=0;
            rep(i2,n)rep(j2,n){
                if(i2==j2)continue;
                if(dx==x[i2]-x[j2] && dy==y[i2]-y[j2])sub++;
            }
            chmin(res,n-sub);
        }
    }
    cout<<res<<endl;
}

Measured memory_bytes: 3596
n = int(input())
S = [input() for i in range(n)]
char = list("abcdefghijklmnopqrstuvwxyz")
char_count = {}
for i in range(26):
    char_count.setdefault(char[i], float("inf"))
    
for i in range(n):
    s = S[i]
    for j in range(26):
        char_count[char[j]] = min(char_count[char[j]], s.count(char[j]))
        
ans_list = []
for key, count in char_count.items():
    if count != float("inf") and count > 0:
        ans_list.append(key*count)
        
for ans in sorted(ans_list):
    print(ans, end="")

Measured memory_bytes: 3064
function Main(input) {
	input = input.split("\n");
	a = input[1].split(" ");
	
	var n = parseInt(input[0], 10);
	
	var result = 0;
	for (var i = 0; i < n; i = i + 2) {
	if  (a[i] % 2 != 0) {
	result = result + 1;
	} else {
	}
	}
	console.log(result);
	}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));

Measured memory_bytes: 29612
import sys
import math
import bisect
 
 
sys.setrecursionlimit(1000000000)
def input():
    return sys.stdin.readline().strip()
 
def iinput():
    return int(input())
 
def finput():
    return float(input())
 
def tinput():
    return input().split()
 
def rinput():
    return map(int, tinput())
 
def rlinput():
    return list(rinput())
 
def modst(a, s):
    res = 1
    while s:
        if s % 2:
            res *= a
        a *= a
        s //= 2
    return res

 
def main():
    a, b, x = rinput()
    p = math.pi
    if x * 2 >= a * a * b:
        print(180 * math.atan((2 * b - x * 2 / a / a ) / a) / p)
    else:
        print(180 / p * math.atan(b / x * a * b / 2))
main()

Measured memory_bytes: 38436
{-# OPTIONS_GHC -Wall #-}

readInt :: String -> Int
readInt = read

solve :: Int -> Bool
solve n = let n' = fromIntegral n in ceiling (7*n'/28) <= floor (8*n'/28)

main :: IO ()
main = do
    n <- fmap readInt getLine

    let ans = solve n

    putStrLn $ if ans then "Yes" else "No"


Measured memory_bytes: 508
a,b,c,x,y = map(int,input().split())

i = a if x > y else b
piza_1 = a * x + b * y
piza_2 = min(x,y) * 2 * c + (max(x,y) - min(x,y)) * i
piza_3 = max(x,y) * 2 * c

print(min(piza_1,piza_2,piza_3))


Measured memory_bytes: 38384
/*
数据不清空，爆零两行泪。
多测不读完，爆零两行泪。
边界不特判，爆零两行泪。
贪心不证明，爆零两行泪。
D P 顺序错，爆零两行泪。
大小少等号，爆零两行泪。
变量不统一，爆零两行泪。
越界不判断，爆零两行泪。
调试不注释，爆零两行泪。
溢出不 l l，爆零两行泪。
*/
#include<bits/stdc++.h>
using namespace std;
#define int long long
const int N=200000;
int n;
int a[N+1],b[N+1]; 
struct segtree{
	struct node{int l,r,mx;}nd[N<<2];
	#define l(p) nd[p].l
	#define r(p) nd[p].r
	#define mx(p) nd[p].mx
	void bld(int l=0,int r=n,int p=1){
		l(p)=l;r(p)=r;mx(p)=0;
		if(l==r)return;
		int mid=l+r>>1;
		bld(l,mid,p<<1);bld(mid+1,r,p<<1|1);
	}
	void init(){bld();}
	void sprup(int p){mx(p)=max(mx(p<<1),mx(p<<1|1));}
	void chkmx(int x,int v,int p=1){
		if(l(p)==r(p)){mx(p)=max(mx(p),v);return;}
		int mid=l(p)+r(p)>>1;
		chkmx(x,v,p<<1|(x>mid));
		sprup(p);
	}
	int ask_mx(int l,int r,int p=1){
		if(l<=l(p)&&r>=r(p))return mx(p);
		int mid=l(p)+r(p)>>1,res=0;
		if(l<=mid)res=max(res,ask_mx(l,r,p<<1));
		if(r>mid)res=max(res,ask_mx(l,r,p<<1|1));
		return res;
	}
}segt;
int dp[N+1];
signed main(){
	cin>>n;
	for(int i=1;i<=n;i++)cin>>a[i];
	for(int i=1;i<=n;i++)cin>>b[i];
	segt.init();
	for(int i=1;i<=n;i++)dp[i]=segt.ask_mx(0,a[i]-1)+b[i],segt.chkmx(a[i],dp[i])/*,printf("dp[%lld]=%lld\n",i,dp[i])*/;
	cout<<*max_element(dp+1,dp+n+1);
	return 0;
}
/*1
4
3 1 4 2
10 20 30 40
*/
/*2
1
1
10
*/
/*3
5
1 2 3 4 5
1000000000 1000000000 1000000000 1000000000 1000000000
*/
/*4
9
4 2 5 8 3 6 1 7 9
6 8 8 4 6 3 5 7 5
*/

Measured memory_bytes: 19584
N = int(input())
H = [int(x) for x in input().split()]

if N == 1:
  print(0)
else:
  ans = []
  c = 0
  for i in range(N - 1):
    if H[i] >= H[i + 1]:
      c += 1
      if i == N - 2:
        ans.append(c)
    elif H[i] < H[i + 1]:
      ans.append(c)
      c = 0
  print(max(ans))

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

using namespace std;

const int SIZE = 100013;

typedef pair<int, int> pii;

bool visited[SIZE];
int disc[SIZE], low[SIZE], parent[SIZE];

vector<int> G[SIZE];


void bridges(int u, priority_queue<pii, vector<pii>, greater<pii> > *bridge){
  static int time = 0;
  int children = 0;
  visited[u] = true;
  disc[u] = low[u] = ++time;
  for(int i = 0; i < G[u].size(); i++){
    int v = G[u][i];
    if(!visited[v]){
      children++;
      parent[v] = u;
      bridges(v, bridge);
      low[u] = min(low[u], low[v]);
      if(low[v] > disc[u]) bridge->push({min(u,v),max(u,v)});
    }
    else if(v != parent[u])
      low[u] = min(low[u], disc[v]);
  }
}

int main(){
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  #ifdef Larra
  freopen("in","r",stdin);
  freopen("out","w",stdout);
  #endif
  int n,m;
  cin>>n>>m;
  for(int i = 0; i < m; i++){
      int u,v;
      cin>>u>>v;
      G[u].push_back(v);
      G[v].push_back(u);
  }
  priority_queue<pii, vector<pii>, greater<pii> > bridge;
  for(int i = 0; i < SIZE; i++)
    parent[i] = -1;
  bridges(0, &bridge);
  while(!bridge.empty()){
    cout<<bridge.top().first<<" "<<bridge.top().second<<"\n";
    bridge.pop();
  }
}

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

int main(){
  int n;
  cin >> n;
  vector<int> A(n);
  rep(i,n) cin >> A[i];
  int ans = 0;
  int i = 1;
  int b;
  while(ans <= n){
    b = A[i];
    ++ans;
    if(b == 2){
      cout << ans << endl;
      return 0;
    }
    i = b;
  }
  cout << -1 << endl;
  return 0;
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
int main(){
    int a,b;
    cin>>a>>b;
    if(a<b){cout<<"a < b"<<endl;}
    else if (a==b){cout<<"a == b"<<endl;}
    else {cout<<"a > b"<<endl;}
    return 0;
}


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

int main(){
  int n,mx = 0;
  scanf("%d",&n);
  
  
  vector<vector<char>> s(n,vector<char>(10));
  vector<string> str(n);
  map<string, int> mp;
  
  rep(i,n) {
    rep(j,10){
      cin >> s.at(i).at(j);
    }   
    sort(all(s.at(i)));
    rep(j,10){
      str.at(i).push_back(s.at(i).at(j));
  	}
    mp[str.at(i)] ++;
  }
  
  int64_t ans=0;
  for(auto p:mp)if(p.second>1) ans += (int64_t)p.second*(p.second-1)/2;
  printf("%ld",ans);
    
}
  

Measured memory_bytes: 18944
//author rhythmicankur
                                                                  //god_is_almighty
#pragma GCC optimize("O3")
#pragma GCC target ("sse4")
#include<bits/stdc++.h>
#define f 	first
#define s 	second
#define ll 	int
#define int 	long long
#define ld 	long double
#define pb 	push_back
#define eb 	emplace_back
#define mk 	make_pair
#define vi 	vector<int>
#define pii 	pair<int,int>
#define vpi 	vector<pii>
#define fori(a,b,c) for(register int i=a;i<b;i+=c)
#define ford(a,b,c) for(register int i=a;i>=b;i-=c)
#define 	PI acos(-1)
#define coud(a,b) cout<<fixed << setprecision((b)) << (a)
#define M1 	998244353
#define M2 	1000000007
const ll LL_INF = 0x3f3f3f3f3f3f3f3f;
template<typename T> T gcd(T a,T b) { if(a==0) return b; return gcd(b%a,a); } 
#define test4(x,y,z,a) 		cerr<<#x<<":" <<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<"  |  "<<#a<<": "<<a<<endl;
#define test1(x)                cerr<<#x<<": "<<x<<endl
#define test2(x, y)             cerr<<#x<<": "<<x<<" | "<<#y<<": "<<y<<endl
#define test3(x, y, z)          cerr<<#x<<":" <<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl
ll power(ll a,ll b,ll m=M2){ll answer=1;while(b){if(b&1)answer=(answer*a)%m;b/=2;a=(a*a)%m;}return answer;}
using namespace std;
void ctrl()
{
	cout<<"Control\n";
}
bool func(pii a,pii b)
{
    return a.s-a.f>b.s-b.f;
}
signed main()
{	ios::sync_with_stdio(0);
	cin.tie(0); cout.tie(0);
	int n,k;
    cin>>n>>k;
    string p;
    cin>>p;

    vpi L,R;
    int trans=0;

    for(int i=0;i<n;i++)
    {   
        
        if(p[i]=='L')
        {
            int id=i;
            while(p[id]=='L'&&id<n)
            id++;

            L.pb(mk(i,id-1));
            i=id-1;

        }
    }
    for(int i=0;i<n;i++)
    {
        if(p[i]=='R')
        {
            int id=i;
            while(p[id]=='R'&&id<n)
            id++;

            R.pb(mk(i,id-1));
            i=id-1;

        }
    }

    for(int i=1;i<n-1;i++)
    {
        if(i>0&&i<n-1)
        {
            if(p[i-1]!=p[i]&&p[i]!=p[i+1])
            trans++;

            i++;
        }
    }

    sort(L.begin(),L.end(),func);
    /*for(auto it:L)
    {
        test2(it.f,it.s);
    }
    ctrl();*/
    sort(R.begin(),R.end(),func);
    /*for(auto it:R)
    {
        test2(it.f,it.s);
    }*/

    string l=p,r=p;

    for(int i=0;i<min((int)(L.size()),k);i++)
    {
        for(int j=L[i].f;j<=L[i].s;j++)
        l[j]='R';
    }
     for(int i=0;i<min((int)(R.size()),k);i++)
    {
        for(int j=R[i].f;j<=R[i].s;j++)
        r[j]='L';
    }

    /*cout<<l<<'\n';
    cout<<r<<'\n';*/
    
    int lx=0,rx=0;

    for(int i=0;i<n-1;i++)
    {
        if(l[i]==l[i+1])
        lx++;

        if(r[i]==r[i+1])
        rx++;
    }

    int g=L.size();
    g+=R.size();
    g=max(1LL,g-k-k);
    //cout<<max(rx,max(lx,n-g));
    cout<<n-g;
    

return 0;
}

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

int main()
{
    int n;
    cin >> n;
    vector<int> a(n, 0);
    for (int i = 0; i < a.size(); i++) {
        int tmp;
        cin >> tmp;
        a[i] = tmp;
    }
    int cnt = 0;
    for (int i = 0; i < a.size(); i++) {
        if ((i + 1) % 2 == 1) {
            if (a[i] % 2 == 1) {
                cnt++;
            }
        }

    }
    cout << cnt << endl;
    return 0;
}



Measured memory_bytes: 3572
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define Rep(i,s,n) for(int i=s;i<n;i++)
#define per(i,s,n) for(int i=n-1;i>=s;i--)
#define fi first
#define se second
#define all(c) c.begin(),c.end()
typedef long long int ll;
typedef pair<ll, int> P;
typedef long double ld;
void Ans(bool x){if(x) cout<<"Yes"<<endl;else cout<<"No"<<endl;}

const ll INF=1001001001;


ll mod;




struct mint {
  ll x; 
  mint(ll x=0):x((x%mod+mod)%mod){}
  mint operator-() const { return mint(-x);}
  mint& operator+=(const mint a) {
    if ((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += mod-a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator*=(const mint a) {
    (x *= a.x) %= mod;
    return *this;
  }
  mint operator+(const mint a) const {
    mint res(*this);
    return res+=a;
  }
  mint operator-(const mint a) const {
    mint res(*this);
    return res-=a;
  }
  mint operator*(const mint a) const {
    mint res(*this);
    return res*=a;
  }
  mint pow(ll t) const {
    if (!t) return 1;
    mint a = pow(t>>1);
    a *= a;
    if (t&1) a *= *this;
    return a;
  }

  // for prime mod
  mint inv() const {
    return pow(mod-2);
  }
  mint& operator/=(const mint a) {
    return (*this) *= a.inv();
  }
  mint operator/(const mint a) const {
    mint res(*this);
    return res/=a;
  }
};


int main(){
  ll n;
  cin>>n;
  ll m;
  cin>>m;
  
  ll l,h;
  
  cin>>mod;
  
  mint a[mod+10];
  int ch[mod+10];
  rep(i,mod){
    ch[i]=-1;
  }
  
  a[0]=m;
  
  ll cnt=0;
  ch[m]=0;
  
  Rep(i,1,mod+10){
    a[i]=a[i-1]*a[i-1];
    if(ch[a[i].x]==-1) ch[a[i].x]=i;
    else{
      l=ch[a[i].x];
      h=i;
      break;
    }
  }
  
  Rep(i,l,h){
    cnt+=a[i].x;
  }
  
  ll ans=0;
  rep(i,l){
    if(n==0) break;
    ans+=a[i].x;
    n--;
  }
  
  ll c=n/(h-l);
  
  
  ans+=c*cnt;
  
  rep(i,n-c*(h-l)){
    ans=ans+a[i+l].x;
  }
  
  cout<<ans<<endl;
  
  
  
  
    
  
  
}

Measured memory_bytes: 4796
#include<bits/stdc++.h>
#define int long long
#define dd second
#define mp make_pair
#define pb push_back
#define ff first
#define dd second
#define pp pair<int,int>
using namespace std;
int n;
vector<int> tab;
main()
{
    ios_base::sync_with_stdio(false);
    cin >> n;
    for(int i = 0; i < n; ++i)
    {
        int temp; cin >> temp;
        tab.pb(temp);
    }
    int ans = 0;
    sort(tab.begin(), tab.end());
    int one = -1;
    int two = -1;
    while(tab.size() > 1)
    {
        if(tab.back() != tab[tab.size()-2])
        {
            tab.pop_back();
        }
        else
        {
            int a = tab.back(); tab.pop_back(); tab.pop_back();
            one = a;
            break;
        }

    }
    while(tab.size() > 1)
    {
        if(tab.back() != tab[tab.size()-2])
        {
            tab.pop_back();
        }
        else
        {
            int a = tab.back(); tab.pop_back(); tab.pop_back();
            two = a;
            break;
        }

    }
    if(one != -1 and two != -1) ans = one*two;
    cout << ans << endl;
}



Measured memory_bytes: 1400
#include <algorithm>
#include <cmath>
#include <iostream>
#include <iomanip>
#include <map>
#include <string>
#include <vector>
#include <queue>
#include <stack>
#include <set>
#include <list>
#define INF 1000000000ll
#define MOD 1000000007ll
#define EPS 1e-10
#define REP(i,m) for(long long i=0; i<m; i++)
#define FOR(i,n,m) for(long long i=n; i<m; i++)
#define DUMP(a) for(long long dump=0; dump<(ll)a.size(); dump++) { cout<<a[dump]; if(dump!=(ll)a.size()-1) cout<<" "; else cout<<endl; }
#define ALL(v) v.begin(),v.end()
#define pb push_back
using namespace std;
typedef long long int ll;
typedef pair<ll, ll> P;
typedef long double ld;
using namespace std;
int main(){
	ll q, h, s, d, n;
	cin >> q >> h >> s >> d >> n;
	s = min(4*q, min(2*h, s));
	d = min(d, 2*s);
	ll ans;
	if(n % 2 == 0) ans = d * (n / 2);
	else ans = d * (n / 2) + s;
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 256
from collections import deque
dxdy = ((-1,0), (1,0), (0,-1), (0,1)) # タプルやリストで持っておくと便利

H, W, K = map(int,input().split())
x1, y1, x2, y2 = map(int,input().split())
mp = [input() for _ in range(H)]
INF = 10**10
dist = [[INF]*W for _ in range(H)]
dist[x1-1][y1-1] = 0
q = deque()
q.append((x1-1,y1-1)) # スタート地点をenqueue
while(q):
    x, y = q.popleft()
    if x==x2-1 and y==y2-1:
        print (dist[x2-1][y2-1])
        exit()
    else:
        for dx, dy in  dxdy:
            for i in range(1,K+1):
                nx = x + dx*i
                ny = y + dy*i
                if not (0<=nx<H and 0<=ny<W) or mp[nx][ny]=='@':
                    break
                if dist[nx][ny] <= dist[x][y]:
                    break 
                if dist[nx][ny] == INF:
                    q.append((nx,ny))
                    dist[nx][ny] = dist[x][y] + 1
print(-1)

Measured memory_bytes: 88008
N, K, Q = map(int, input().split())
a = list(map(int, input().split()))

d=[a]
a = sorted(a)

ans = a[Q-1] - a[0]


while True:
  d_temp = list()
  sub_temp = list()
  for sub in d:
    for c in sub:
      if c != a[0]:
        sub_temp.append(c)
      else:
        d_temp.append(sub_temp)
        sub_temp = list()
    d_temp.append(sub_temp)
    sub_temp = list()

  d = list()
  a = list()
  for sub in d_temp:
    if len(sub) < K:
      continue
    else:
      d.append(sub)
      sub = sorted(sub)
      a.extend(sub[0:len(sub)-K+1])

  a.sort()

  if len(a) < Q:
    break
  else:
    ans = min(ans, a[Q-1] - a[0])

print(ans)


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

#define AndIamIronMan ios::sync_with_stdio(false); cin.tie(0);cout.tie(0); 
 
using namespace std;
 
typedef  long long int lli; 

int main(){
    
    lli i,x,j,k,n,y,m,t; 	
    AndIamIronMan;
//    cin>>t;
//    while(t--){
	char s;
	cin>>s;
	if(s>=65 && s<=90){
		cout<<'A';
	}
	else{
		cout<<'a';
	}
//	}
	return 0;
}


Measured memory_bytes: 3652
#include <iostream>
#include <vector>
#include <math.h>
#define rep(i,n) for(int i=0;i<(n);++i)
using namespace std;
typedef long long ll;

int main() {
	int n;
	cin >> n;
	vector<int> arr(n);
	rep(i,n) cin >> arr[i];
	int ans = 0;
	
	rep(i,n){
		int minj = i;
		for(int j = i;j < n; ++j){
			if(arr[j] < arr[minj]){
				minj = j;
			}
		}
		if(minj != i) ans++;
		swap(arr[i], arr[minj]);
	}
	
	rep(i,n){
		if(i != n -1) cout << arr[i] << ' ';
		else cout << arr[i] << endl;
	}
	cout << ans << endl;
	return 0;
}


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

typedef long long ll;

const long double PI = (acos(-1));


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

  string s;
  cin >> s;

  int count = 0;
  for (int i = 0; i < s.size() / 2; i++){
    if (s.at(i) != s.at(s.size() - i - 1)) count++;
  }

  cout << count << endl;

  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
//#pragma GCC optimize("O3")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize("unroll-loops")
#define pb push_back
#define IOS                                                                    \
  ios_base::sync_with_stdio(false);                                            \
  cin.tie(0);                                                                  \
  cout.tie(0);cout<<fixed<<setprecision(16);
#define ll long long int
#define ld long double
#define el '\n'
#define El '\n'
#define PI (ld)3.141592653589793238462643383279502884197169399375105820974944
#define inf (ll)1000000000
#define mod (ll)1000000007
#define mod1 (ll)998244353
#define fo(i, n) for (long long i = 0; i < n; i++)
#define pll pair<ll, ll>
#define ml map<ll,ll>
#define vpl vector<pll>
#define vvl vector<vector<ll> >
#define vvpl vector< vector<pll> >
#define ff first
#define ss second
#define pqueue priority_queue< ll >
#define pdqueue priority_queue< ll,vl ,greater< ll > >
#define mem(a,b) memset(a,b,sizeof(a));
//mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
#define sz(a) (ll)a.size()
#define f(i,a,b) for(ll i=a;i<b;i++)
#define fd(i,a,b) for(ll i=a;i>=b;i--)
#define all(a) a.begin(),a.end()
#define vl vector<ll>
//#define x ff
//#define y ss
#define pt(a) for(auto it:a)cout<<it<<" ";cout<<endl;
unsigned seed = std::chrono::system_clock::now().time_since_epoch().count();
using namespace std;

// vector
template<class T> istream& operator >> (istream &is , vector<T> &v) { for(T &a : v) is >> a; return is; }
template<class T> ostream& operator << (ostream &os , const vector<T> &v) { for(const T &t : v) os << t<<" "; return os << endl; }
// pair
template<class T, class U> ostream& operator << (ostream &os , const pair<T, U> &v) { return os << v.first << " " << v.second ; }

double gcd(double a, double b) { return a < 0.01 ? b : gcd(fmod(b, a), a); }

long long bpow(long long a, long long b, long long m) {
  a %= m;
  long long res = 1;
  while (b > 0) {
    if (b & 1)

      res = res * a % m;
      a = a * a % m;
      b >>= 1;
  }
  return res;
}


ll kv;
ll t,n,x,y,h,k,z,p,q,w,r;
string s,s1,s2;
vvl v;
vl vis,d;

void dfs(int s){
    vis[s]=1;
    //cout<<s<<endl;
    for(int u:v[s])if(vis[u]==0)dfs(u);
    d.pb(s);
}

int main() {
    IOS;
    cin>>n>>k;
    v.resize(n);
    vis.assign(n,0);
    fo(i,k){
        cin>>x>>y;x--;y--;
        v[x].pb(y);
        //v[y].pb(x);
    }
    fo(i,n){
        if(vis[i]==0)dfs(i);
    }
    reverse(all(d));
    vl a(n,0);
    for(int i=n-1;i>=0;i--){
        x=0;
        for(int u:v[d[i]])x=max(x,1+a[u]);
        a[d[i]]=x;
        kv=max(kv,x);
    }
    cout<<kv;
    return 0;
}


Measured memory_bytes: 10996
import sys
sys.setrecursionlimit(500*500)
N, M = map(int, input().split())
connect_list = [set() for _ in range(N)]    #繋がっているリスト
for _ in range(M):
    A, B = map(int, input().split())
    connect_list[A-1].add(B)
    connect_list[B-1].add(A)

root_list = [0]*N
root_list[0] = "Yes"

for i in list(connect_list[0]):
    root_list[i-1] = 1
now_set = connect_list[0]

def do_ranking(now_set):
    global connect_list, root_list
    if len(now_set) == 0:
        return 0
    for j in list(now_set):
        for m in list(connect_list[j-1]):
            if root_list[m-1] == 0:
                root_list[m-1] = j
                now_set.add(m)
        now_set.remove(j)
    do_ranking(now_set)


do_ranking(now_set)   #道しるべ作成

for k in root_list:
    print(k)

Measured memory_bytes: 123200
#include <algorithm>
#include <iostream>
#include <vector>
#include <math.h>
#include <set>
#include <map>
#include <string>
#include <stack>
#include <queue>
#include <iomanip>
#include <numeric>
#include <tuple>
#include <bitset>
#include <complex>
#include <unistd.h>
#include <cassert>
#include <cctype>
#include <random>
#include <time.h>
#define _USE_MATH_DEFINES
#define _GLIBCXX_DEBUG
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> plglg;
typedef pair<double, ll> pdlg;
typedef tuple<int, int, int> tiii;
typedef tuple<ll, ll, ll> tlglglg;
typedef tuple<double, double, double> tddd;
typedef complex<double> xy_t;
typedef vector<ll> vll;
typedef vector< vector<ll> > matrix;
typedef unsigned int uint;
typedef unsigned long long ull;
template <class T> using V = vector<T>;
template <class T> using VV = V<V<T>>;
template <class T> using VVV = V<VV<T>>;
#define REP(i, x, y) for(ll i = (ll)x; i < (ll)y; i++)
#define DREP(i, x, y, d) for(ll i = (ll)x; i < (ll)y; i += (ll)d)
#define PER(i, x, y) for(ll i = (ll)x; i > (ll)y; i--)
#define DPER(i, x, y, d) for(ll i = (ll)x; i > (ll)y; i -= (ll)d)
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
double pi = 3.141592653589793;
ll mod = 1000000007;
int intmax = 2147483647;
int intmin = -2147483648;
ll llmax = 9223372036854775807;
ll llmin = -9223372036854775807;
int iinf = intmax / 8;
ll inf = llmax / 8;
double eps = 1e-12;
void yesno(bool ok, string yes = "Yes", string no = "No") {
    if (ok) {
        cout << yes << endl;
    } else {
        cout << no << endl;
    }
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    double R;
    cin >> R;
    cout << 2 * pi * R << endl;
}


Measured memory_bytes: 3752
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <cstring>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <algorithm>
using namespace std;
 
#define REP(i,n) for(int i=0; i<n; ++i)
#define FOR(i,a,b) for(int i=a; i<=b; ++i)
#define FORR(i,a,b) for (int i=a; i>=b; --i)
#define ALL(c) (c).begin(), (c).end()
 
typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<VL> VVL;
typedef vector<VI> VVI;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;
 
int main() {
    string s;
    cin >> s;
    if (s[0] == s[1] && s[1] == s[2]) cout << "Yes" << endl;
    else if (s[1] == s[2] && s[2] == s[3]) cout << "Yes" << endl;
    else cout << "No" << endl;
 
 
    return 0;
}

Measured memory_bytes: 256
"use strict"
const create = () => {
    const input = require("fs").readFileSync("/dev/stdin", "utf8").trim().split("\n");
    const res = {
        "list": input, "index": 0, "max": input.length,
        "hasNext": function () { return this.index < this.max },
        "next": function () { if (!this.hasNext()) { throw "ArrayIndexOutOfBoundsException"; } else { return this.list[this.index++]; } }
    };
    return res;
}
const o = create();
const next = () => o.next()
const nextInt = () => parseInt(o.next())
const nextStrArray = () => o.next().split(" ")
const nextIntArray = () => o.next().split(" ").map(el => parseInt(el))
const nextCharArray = () => o.next().split("")
const hasNext = () => o.hasNext()
const myout = (...x) => console.log(...x)
const Main = () => {
    let n = nextInt()
    let l = nextIntArray()
    l.sort((a, b) => a - b)
    let cnt = 0
    for (let i = 0; i < l.length; i++) {
        for (let j = i + 1; j < l.length; j++) {
            for (let k = j + 1; k < l.length; k++) {
                if (l[i] !== l[j] && l[j] !== l[k] && l[k] !== l[i]) {
                    if (l[k] < l[i] + l[j]){
                        cnt++
                    } 
                }
            }
        }
    }
    console.log(cnt)
}
Main()



Measured memory_bytes: 32456
from itertools import accumulate

n, k = map(int, input().split())
a = list(map(int, input().split()))

for j in range(k):
    a01 = [0] * (n + 1)
    for i, ai in enumerate(a):
        l, r = max(0, i - ai), min(i + ai + 1, n)
        a01[l] += 1
        a01[r] -= 1
    a = list(accumulate(a01))[:-1]
    if all(ai == n for ai in a):
        break
print(*a)


Measured memory_bytes: 180996
// https://atcoder.jp/contests/m-solutions2020/tasks/m_solutions2020_a
#include<bits/stdc++.h>
using namespace std;

int main(int argc, char* argv[]) {
	int x, y;
	cin >> x;
	if (x >= 400 && x <= 599) y = 8;
	else if (x >= 600 && x <= 799) y = 7;
	else if (x >= 800 && x <= 999) y = 6;
	else if (x >= 1000 && x <= 1199) y = 5;
	else if (x >= 1200 && x <= 1399) y = 4;
	else if (x >= 1400 && x <= 1599) y = 3;
	else if (x >= 1600 && x <= 1799) y = 2;
	else if (x >= 1800 && x <= 1999) y = 1;
	cout << y << endl;
	return 0;
}


Measured memory_bytes: 3608
n = int(input())
w = [input() for _ in range(n)]

for i in range(1, len(w)):
    if w[i][0] != w[i - 1][-1]:
        print('No')
        exit()
    else:
        for j in range(0, i):
            if w[j] == w[i]:
                print('No')
                exit()
print('Yes')

Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
#define flash ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define F first
#define S second
#define pb push_back
#define all(v) (v).begin(),(v).end() 
#define endl "\n"
#define int long long int
#define ll long long
#define ld long double
#define Yes() cout << "Yes" << endl
#define YES() cout << "YES" << endl
#define No() cout << "No" << endl
#define NO() cout << "NO" << endl
typedef pair<int, int> ii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ii> vii;
typedef vector<string> vs;
typedef vector<bool> vb;
const int mod = 1000000007;
const int N=200005;
const int inf=1e18;
vector<vector<int>>adj(N);

bool isprime(int n){for(int i=2;i*i<=n;++i){if(n%i==0){return false;}}return true;}
int factorial(int n){return (n==1 || n==0) ? 1:n*factorial(n-1);} 
int gcd(int a,int b){if (a==0)return b;return gcd(b%a,a);}
int lcm(int a,int b){return (a/gcd(a,b)*b);}
int max(int a,int b){int sol=a>b?a:b;return sol;}
int min(int a,int b){int sol=a<b?a:b;return sol;} 

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


signed main(){
    flash;
    fun();
    int t=1;
    //cin>>t;
    while(t--){
        int  n;
        cin>>n;
        int k=n/108;
        k*=100;
        int i,f=0;
        for(i=k;i<=n;i++){
            int x=i*1.08;
            if(x==n){
                f=1;
                break;
            }

        }      
        if(f)
            cout<<i;
        else 
            cout<<":(";
        
    }
    return 0;
}

Measured memory_bytes: 7832
#!/usr/bin/env python3

import sys
import math
from bisect import bisect_right as br
from bisect import bisect_left as bl
sys.setrecursionlimit(2147483647)
from heapq import heappush, heappop,heappushpop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from collections import deque
from operator import itemgetter
from itertools import permutations
mod = 10**9 + 7
inf = float('inf')
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))

n, p = LI() 
s = list(map(int,list(input())))
t = []
ans = 0
if p == 2 or p == 5:
    for i in range(n):
        if s[i] % p == 0:
            ans += i+1
    print(ans)
    quit()
 
for i in range(n):
    t.append(s[i]*pow(10,n-i-1,p))
t = list(accumulate(t))
u = [i % p for i in t]
u = list(Counter(u).items())
ans = 0
for i,j in u:
    if i == 0:
        ans += j
    if j >= 2:
        ans += j*(j-1) // 2
print(ans)


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

#define REP(i, n) for(int (i)=0; (i)<(n); (i)++)
#define ALL(v) (v).begin(), (v).end()
#define INF 1e9

using namespace std;

#define MAX 300000
int divisor[MAX];
int prime[MAX];

int main(){
  REP(i, MAX){
    if(i == 0 or i == 1) continue;
    REP(j, MAX){
      if(j == 0 or j == 1) continue;
      if(i * j >= MAX) break;
      divisor[i*j]++;
    }
  }
  int ps = 0;
  REP(i, MAX){
    if(i == 0 or i == 1) continue;
    if(divisor[i] == 0) ps++;
    prime[i] = ps;
  }
  int n;
  while(cin >> n and n) cout << prime[2*n] - prime[n] << endl;
  return 0;
}

Measured memory_bytes: 5344
#include<iostream>
#include<iomanip>
#include<climits>
#include<vector>
#include<list>
#include<functional>
#include<algorithm>
#include<string>
#include<cmath>
#include<complex>
#include<set>
#include<map>
#include<stack>
#include<queue>
#include<deque>
#include<tuple>
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n) for(int i=0;i<(n);i++)
using namespace std;
typedef long long ll;
typedef pair<int, int> P;

class SegmentTree {
	int n;
	vector<set<char>> node;
public:
	SegmentTree(const string &s) {
		n = 1;
		while (n < s.size()) n *= 2;
		node.resize(2 * n - 1);
		REP(i, n) {
			node[i + n - 1].insert(s[i]);
		}
		for (int i = n - 2;i >= 0;--i) {
			node[i] = node[2 * i + 1];
			for (auto itr = node[2 * i + 2].begin();itr != node[2 * i + 2].end();++itr) {
				node[i].insert(*itr);
			}
		}
	}

	void update(int i, char c) {
		i += (n - 1);
		if (node[i].find(c) != node[i].end()) return;
		node[i].clear();
		node[i].insert(c);
		while (i > 0) {
			i = (i - 1) / 2;
			node[i] = node[2 * i + 1];
			for (auto itr = node[2 * i + 2].begin();itr != node[2 * i + 2].end();++itr) {
				node[i].insert(*itr);
			}
		}
	}

	set<char> get(int a, int b, int i = 0, int l = 0, int r = -1) {
		if (r < 0) r = n;

		if (b <= l || r <= a) return set<char>();
		if (a <= l && r <= b) return node[i];

		set<char> ans = get(a, b, 2 * i + 1, l, (l + r) / 2);
		set<char> tmp = get(a, b, 2 * i + 2, (l + r) / 2, r);
		for (auto itr = tmp.begin();itr != tmp.end();++itr) {
			ans.insert(*itr);
		}
		return ans;
	}
};

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

	int N, Q;
	string S;
	cin >> N >> S >> Q;
	SegmentTree seg(S);
	REP(k, Q) {
		int type;
		cin >> type;
		if (type == 1) {
			int i;
			char c;
			cin >> i >> c;
			seg.update(i - 1, c);
		}
		else {
			int l, r;
			cin >> l >> r;
			cout << seg.get(l - 1, r).size() << endl;
		}
	}
	
	return 0;
}


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

using namespace std;
typedef long long ll;

#define REP(i,n) for(int i=0;i<n;++i)
#define SORT(name) sort(name.begin(), name.end())
#define ZERO(p) memset(p, 0, sizeof(p))
#define MINUS(p) memset(p, -1, sizeof(p))

#define MOD 1000000007
#define INF 1000000000
#define MAX_N 305
#define MAX_M MAX_N

int N,M;
int A[MAX_N][MAX_M];
int sports[MAX_M];      // スポーツ i に参加した人の人数

int main()
{
    ZERO(A);
    cin >> N >> M;
    REP(i, N) {
        REP(j, M) {
            cin >> A[i][j];
        }
    }
    int ans = INF;
    while(1) {
        ZERO(sports);
        REP(i, N) {
            REP(j, M) {
                if(A[i][j] != 0) {
                    sports[A[i][j]]++;
                    break;
                }
            }
        }
        pair<int, int> fav = make_pair(0, 0);
        REP(i, M+1) {
            if(fav.second < sports[i]) {
                fav = make_pair(i, sports[i]);
            }
        }
        if(fav.second == 0) { break; }
        ans = min(ans, fav.second);
        // 人気スポーツを除外
        REP(i, N) {
            REP(j, M) {
                if(A[i][j] == fav.first) {
                    A[i][j] = 0;
                    break;
                }
            }
        }
    }

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


Measured memory_bytes: 640
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<queue>
#include<functional>
#include<cmath>
#include<set>
#include<random>
#include<stdio.h>
#include<map>
using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
const long long mod = 1000000007;
const long long inf = 11451419198109311;
const long double pi = 3.1415926535897932384626433;
typedef pair<int, int> P;
struct edge { int to, cost; };

signed main() {
	int h, w, x, y; cin >> h >> w >> x >> y;
	if (1 & (h*w) && 1 & (x + y))puts("No");
	else puts("Yes");
}



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

#define MX1 2005
#define MX2 4000005
bitset<MX2>b_set;
int a[MX1],n;

void process()
{
    b_set.reset();
    b_set.set(0);
    for(int i=0; i<n; i++)
    {
        b_set = b_set|(b_set<<a[i]);
    }
}

int main()
{
    int i,x,s=0;
    scanf("%d",&n);
    for(i=0; i<n; i++)
    {
        scanf("%d",&a[i]);
        s += a[i];
    }
    x = (s+1)>>1;
    process();
    for(i=x; i<=s; i++)
    {
        if(b_set.test(i))
        {
            printf("%d\n",i);
            exit(0);
        }
    }
    return  0;
}
/// median >= (sum+1)/2


Measured memory_bytes: 2176
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<cmath>
#include<cstdio>
#include<queue>
#include<deque>
#include<map>
#include<stack>
#include<set>
#include<tuple>
using namespace std;
typedef pair<int,int> ii;
typedef long long ll;
typedef pair<ll,ll> pll;
const int INF=1e9;
const ll MOD=1e9+7;
int dy[]={1,0,-1,0};
int dx[]={0,1,0,-1};

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

int dis2(int x1,int y1,int x2,int y2){
    return (x1-x2)*(x1-x2)+(y1-y2)*(y1-y2);
}
ll power(ll a,ll x){
    ll res=1;
    while(x>0){
        if(x&1) res=res*a%MOD;
        a=a*a%MOD;
        x>>=1;
    }
    return res;
}
string s;
int g(int i){
    if(i<0) return 0;
    if(i==0) return 1;
    if(i==1&&s[1]==s[0]) return 1;

}
int main(){
    int x,y;cin>>x>>y;
    if(4*x-y>=0&&y-2*x>=0&&(4*x-y)%2==0&&(y-2*x)%2==0){
        cout<<"Yes"<<endl;
    }else cout<<"No"<<endl;
    return 0;
}

Measured memory_bytes: 3608
#include <iostream>
#include <cmath>
#include <algorithm>
#include <bitset>
#include <iomanip>
#include <cstdio>
#include <new>
#include <vector>
#include <cstdlib>
#include <string>
#include <set>
#include <tuple>
#include<map>

using namespace std;
int main() {
	string s1, s2, s3;

	cin >> s1 >> s2 >> s3;

	s1 = toupper(s1.at(0));
	s2 = toupper(s2.at(0));
	s3 = toupper(s3.at(0));

	cout << s1 << s2 << s3 << endl;
}

Measured memory_bytes: 3568