akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <iomanip>
#include <vector>
#include <utility>
#include <map>
#include <algorithm>
#include <queue>
#include <cmath>
#include <numeric>
#include <set>

using namespace std;
struct aaa{aaa(){cin.tie(nullptr); ios::sync_with_stdio(false); cout<<fixed<<setprecision(20);};}aaa;
template <class T>ostream &operator<<(ostream &o,const vector<T>&v){o<<"{";for(int i=0;i<(int)v.size();i++)o<<(i>0?", ":"")<<v[i];o<<"}";return o;}
#define debug(v) {cerr<<"\033[1;36m[debug]\033[m "<<#v<<" : "<<v<<endl;}

using int64 = long long;

int main() {
    char c;
    cin >> c;
    if ('A' <= c && c <= 'Z') c = 'A';
    else c = 'a';
    cout << c << endl;
}

Measured memory_bytes: 3024
def main():
    n,k,c=map(int,input().split())
    s=list(input())
    l,r=[0]*(k+1),[0]*(k+1)
    x,i=1,0
    while i<=n-1:
        if s[i]=='o':
            l[x]=i+1
            i+=c+1
            x+=1
            if x==k+1:
                break
        else:
            i+=1
    x,i=k,n-1
    while 0<=i:
        if s[i]=='o':
            r[x]=i+1
            x-=1
            i-=c+1
            if x==0:
                break
        else:
            i-=1
    for i in range(1,k+1):
        if l[i]==r[i]:
            print(l[i])

if __name__ == '__main__':
    main()

Measured memory_bytes: 21908
list = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 
        2, 2, 5, 4, 1, 4, 1, 51]

index = input()
index = int(index)
print(list[index-1])


Measured memory_bytes: 2940
#include<stdio.h>

int main(void){

int n,i,taro=0,hanako=0;
char card1[101],card2[101];
scanf("%d",&n);
for(i=0;i<n;i++){
 scanf("%s %s",card1,card2);
 if(strcmp(card1,card2)==0) taro+=1,hanako+=1;
 else if(strcmp(card1,card2)>0) taro+=3;
 else if(strcmp(card1,card2)<0) hanako+=3;
}
printf("%d %d\n",taro,hanako);
return 0; 
}


Measured memory_bytes: 2056
#include"iostream"
#include"string"
using namespace std;

int main()
{
	string o, e;
	cin >> o >> e;
	string ans = "";
	for (int i = 0; i < e.size(); i++)
	{
		cout << o[i] << e[i];
	}
	if (o.size() > e.size())cout << o.back();
	cout << endl;
}


Measured memory_bytes: 256
// #pragma GCC target("avx2")  // CPU 処理並列化
// #pragma GCC optimize("O3")  // CPU 処理並列化
// #pragma GCC optimize("unroll-loops")  // 条件処理の呼び出しを減らす
#include<stdio.h>
#include<math.h>
#include<algorithm>
#include<queue>
#include<deque>
#include<stack>
#include<string>
#include<string.h>
#include<vector>
#include<set>
#include<map>
#include<bitset>
#include<stdlib.h>
#include<cassert>
#include<time.h>
#include<bitset>
#include<numeric>
using namespace std;
const long long mod=1000000007;
const long long inf=mod*mod;
const long long d2=(mod+1)/2;
const double EPS=1e-10;
const double INF=1e+10;
const double PI=acos(-1.0);
const int C_SIZE = 3121000;
long long fact[C_SIZE];
long long finv[C_SIZE];
long long inv[C_SIZE];
long long Comb(int a,int b){
 	if(a<b||b<0)return 0;
 	return fact[a]*finv[b]%mod*finv[a-b]%mod;
}
void init_C(int n){
	fact[0]=finv[0]=inv[1]=1;
	for(int i=2;i<n;i++){
		inv[i]=(mod-(mod/i)*inv[mod%i]%mod)%mod;
	}
	for(int i=1;i<n;i++){
		fact[i]=fact[i-1]*i%mod;
		finv[i]=finv[i-1]*inv[i]%mod;
	}
}
long long pw(long long a,long long b){
	if(a<0LL)return 0;
	long long ret=1;
	while(b){
		if(b%2)ret=ret*a%mod;
		a=a*a%mod;
		b/=2;
	}
	return ret;
}
int ABS(int a){return max(a,-a);}
long long ABS(long long a){return max(a,-a);}
double ABS(double a){return max(a,-a);}
// ここから編集しろ

int main(){
	int a,b;scanf("%d%d",&a,&b);
	if(a*b%2==0)printf("No\n");else printf("Yes\n");
}

Measured memory_bytes: 128
#include<iostream>
#include<cstdio>
#include<vector>
#include<string>
#include<cstring>
#include<functional>
#include<queue>
#include <iomanip>
#include<map>
#include<limits>
#include<cmath>
#include<algorithm>
#include<bitset>
#include<utility>
#include<complex>
#include<cstdlib>
#include<set>
#include<cctype>

#define DBG cerr << '!' << endl;
#define REP(i,n) for(int (i) = (0);(i) < (n);++i)
#define rep(i,s,g) for(int (i) = (s);(i) < (g);++i)
#define rrep(i,s,g) for(int (i) = (s);i >= (g);--(i))
#define PB push_back
#define MP make_pair
#define FI first
#define SE second
#define SHOW1d(v,n) {for(int i = 0;i < (n);i++)cerr << v[i] << ' ';cerr << endl << endl;}
#define SHOW2d(v,i,j) {for(int aaa = 0;aaa < i;aaa++){for(int bbb = 0;bbb < j;bbb++)cerr << v[aaa][bbb] << ' ';cerr << endl;}cerr << endl;}
#define ALL(v) v.begin(),v.end()
#define Decimal fixed<<setprecision(10)

using namespace std;

typedef long long ll;
typedef vector<int> iv;
typedef vector<iv> iiv;
typedef vector<string> sv;

int dp[310][310];
int n;
vector<int> node;

int dfs(int l,int r)
{
	if(l > r)return 0;
	if(l == r)return 0;
	if(dp[l][r] != -1)return dp[l][r];
	if(r - l == 1)return (abs(node[l]-node[r])<2)?2:0;
	
	int ret = 0;
	
	if(dfs(l+1,r-1)==r-l-1&&(abs(node[l]-node[r])<2))
	{
		return r-l+1;
	}
	
	for(int i=0;i < r-l;i++)
	{
		ret = max(ret,dfs(l,l+i)+dfs(l+i+1,r));
	}
	
	return dp[l][r] = ret;
}

int main()
{
	while(cin >> n,n)
	{
		
		REP(i,310)REP(j,310)dp[i][j] = -1;
		node.clear();
		
		REP(i,n)
		{
			int tmp;cin >> tmp;
			node.PB(tmp);
		}
		
		cout << dfs(0,n-1) << endl;
		
	}
	
	return 0;
}


Measured memory_bytes: 3544
import Foundation

let input_lines = readLine()?.characters.split{ $0==" " }

var count5 = 0
var count7 = 0
for str in input_lines! {
  if "5" == String(str) {
    count5 += 1
  }
  else if "7" == String(str) {
    count7 += 1
  }
}

print((count5 == 2 && count7 == 1) ? "YES" : "NO")


Measured memory_bytes: 6884
w, h, n = map(int, input().split())
min_X, max_X = 0, w
min_Y, max_Y = 0, h

for _ in range(n):
    x, y, a = map(int, input().split())
    if a == 1:
        min_X = max(x, min_X)
    elif a == 2:
        max_X = min(x, max_X)
    elif a == 3:
        min_Y = max(y, min_Y)
    elif a == 4:
        max_Y = min(y, max_Y)

W = max(0, max_X - min_X)
H = max(0, max_Y - min_Y)
print(W*H)

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

int main() {
    int N; cin >> N;
    map<int, int> m;
    rep(i, N){
        int a; cin >> a;
        m[a]++;
    }

    ll ans1 = 0;
    ll ans2 = 0;
    for(auto p : m){
        auto key = p.first;
        auto value = p.second;

        if(value >= 4){
            ans2 = key;
            ans1 = key;
        } else if (value >= 2){
            ans1 = ans2;
            ans2 = key;
        }
    }

    cout << ans1*ans2 << endl;

    return 0;
}

Measured memory_bytes: 8272
#include<stdio.h>

int main(void)
{
    int a, b;

    scanf("%d %d", &a, &b);

    if(a < b)
    {
        printf("%s\n", "a < b");
    }

    else if(a > b)
    {
        printf("%s\n", "a > b");
    }

    else
    {
        printf("%s\n", "a == b");
    }

    return 0;
}


Measured memory_bytes: 2104
while True:
  n = int(input())
  if n == 0:
    break
  hr_lst = []
  for _ in range(n):
    h, r = map(int, input().split())
    hr_lst.append((h, r))
  
  m = int(input())
  for _ in range(m):
    h, r = map(int, input().split())
    hr_lst.append((h, r))
  
  hr_lst.sort(reverse=True)

  r_lst = [[] for _ in range(1001)]
  for h, r in hr_lst:
    r_lst[h].append(r)
  r_lst = [lst for lst in r_lst if lst != []]
  
  """
  dp[y] ... 最大yまでの最大入れ子数
  dp[y] = max(dp[y], dp[v - 1] + 1)
  """
  dp = [0] * 1001
  for x in range(len(r_lst)):
    vlst = r_lst[x]
    max_v = 1000
    for v in vlst:
      dpv1 = dp[v - 1] + 1
      for y in range(max_v, v - 1, -1):
        if dp[y] < dpv1:
          dp[y] = dpv1
      max_v = v
  print(dp[1000])


Measured memory_bytes: 5644
#create date: 2020-07-03 16:40

import sys
stdin = sys.stdin

def ns(): return stdin.readline().rstrip()
def ni(): return int(ns())
def na(): return list(map(int, stdin.readline().split()))

def main():
    a, b = na()
    print(max(a+b, a-b, a*b))

if __name__ == "__main__":
    main()

Measured memory_bytes: 9064
//Sani buyuk Osman Pasa Plevneden cikmam diyor.
//FatihSultanMehmedHan
//Abdulhamid Han
//Bismillahirrahmanirrahim

#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")

#include <bits/stdc++.h>

using namespace std;

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

#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define fio() ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define FOR for(int i=1;i<=n;i++)
#define mid ((start+end)/2)
#define ort ((bas+son)/2)

const lo MAX = -1000000000000000000; 
const lo MIN = 1000000000000000000; 
const lo inf = 1000000000; 
const lo KOK = 100000; 
const lo LOG = 30; 
const lo li = 100005; 
const lo mod = 1000000007; 

int n,m,b,a[li],k,flag,cev;
string s;
vector<int> v;

int main(void){
	scanf("%d",&n);
	scanf("%d",&m);
	FOR{
		scanf("%d",&a[i]);
		if(abs(a[i]-0)*2<=abs(a[i]-m)*2) cev+=(a[i]-0)*2;
		else cev+=abs(a[i]-m)*2;
	}
	printf("%d\n",cev);
	
	return 0;
}


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

using namespace std;
typedef long long ll;
#define int 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))

const ll LLINF = (1LL<<60);
const int INF = (1LL<<30);
const double DINF = std::numeric_limits<double>::infinity();
const int MOD = 1000000007;
#define MAX_N 110
#define MAX_V 100010

ll N, W;
ll item_v[MAX_N];
ll item_w[MAX_N];
ll dp[MAX_N][MAX_V];

signed main()
{
    cin >> N >> W;
    REP(i, N) { cin >> item_w[i] >> item_v[i]; }

    REP(i, N) { REP(j, MAX_V) { dp[i][j] = (j == 0) ? 0 : LLINF; } }

    // 配る DP
    // dp[i][val] : [0,i] まで使って val を作った時の最小の重さ
    ll ans = 0;
    for(ll i = 0; i < N; ++i) {
        for(ll val = 0; val < MAX_V; ++val) {
            // V[i] を入れるだけ val を作れる
            if(val == item_v[i]) { dp[i][val] = min(dp[i][val], item_w[i]); }
            if (i > 0) {
                dp[i][val] = min(dp[i][val], dp[i-1][val]); // 値の伝搬
                // W[i] を入れてもいいなら、重さを更新
                if(dp[i-1][val] + item_w[i] <= W) {
                    dp[i][val + item_v[i]] = min(dp[i][val + item_v[i]], dp[i-1][val] + item_w[i]);
                }
            }
            if(dp[i][val] <= W) { ans = max(ans, val); }
        }
    }

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


Measured memory_bytes: 80128
#include <iostream>
#include <vector>
#include <cstring>
#include <algorithm> // sort

#define REP(i, n) for (long long i = 0; i < (n); i++) 
typedef long long ll;
static const ll MOD = 1000000007;
static const ll INF = 1000000000000000000LL;
using namespace std;

//Choose Integers
//A*1 から A *Bまでやればよい(A*(B+1) のあまりは(A*1) と一緒)
int main(){
  ll A,B,C;
  cin >> A >> B >> C;

  string res = "NO";

  ll k = 0;
  for(ll i = 1; i <= B; ++i)
  {
    k += A;
    if(k % B == C)
    {
      res = "YES";
      break;
    }
  }

  cout << res << endl;

  return 0;
}

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

using namespace std;


int V[26];
bool flag = true;


int solve(string &s, int b, int e){
    if(flag == false) return -1;

	
    if(e - b == 1) {
		return s[b] - 'a';
	}

    int x;

    for(int i = b, d = 0; i < e; i++){
        if(s[i] == '[') {
            d++;
        } else if(s[i] == ']') {
            d--;
        } else if(s[i] == '-') {
            if(d ==  1) x = i;
        }
    }
	
    int ch1 = solve(s, b+1, x);
    int ch2 = solve(s, x+1, e-1);
	
    if(ch1 == -1 || ch2 == -1) return -1;
	
    if(!!V[ch1] == !!V[ch2]) {
        flag = false;
        return -1;
    } else if(V[ch1]) {
        V[ch1]--;

        return ch1;
    } else {
        V[ch2]--;
        return ch2;
    }

	
    return -1;
}

signed main(){
    string s;

    cin>>s;

    char a;
    int v;

    int N = 0;

    for(int i = 0; i<  s.size(); i++){
        if('a' <= s[i] && s[i] <= 'z') N++;
    }
	
    for(int i = 0; i < N; i++){
		if(!(cin>>a)) break;
		
		cin>>v;
		
        V[a - 'a'] = v;
    }

    solve(s, 0, s.size());
	
	for(int i = 0; i < 26; i++){
		if(V[i]) flag = false;
	}

    if(flag == true) cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
}




Measured memory_bytes: 3160
import math
import bisect
def makeprime(n):
  prime = []
  for i in range(2,n+1):
    flag = 1
    for j in range(2,math.ceil(math.sqrt(i)+1)):
       if not i == 2:
                   if i%j == 0:
                    flag = 0
                    break
    if flag:
     prime.append(i)
  return prime


def solve():
  q = int(input())
  primelike = []
  primenumber = makeprime(100001)
  for i in range(100001):
    if i%2 == 0:continue
    else:
      if i in primenumber:
        if (i+1)//2 in primenumber:
          primelike.append(i)
  for j in range(q):
      l,r = (int(k) for k in input().split())
      left = bisect.bisect_left(primelike,l)
      right = bisect.bisect_right(primelike,r)
      print(right-left)
solve()

Measured memory_bytes: 58204
/*SorooshH*/
#include <bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define pb push_back
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<pii,int> tpi;
typedef pair<pii,pii> qpi;
const int MAX = 1e5;
const int MV = 1e5;
const int MOD = 1e9 + 7;
const int INF = 2e9;

int n;
set<int> st;

int32_t main()
{
    ios_base::sync_with_stdio(0) , cin.tie(0) , cout.tie(0);
    cin >> n;

    for(int i=0 ; i<n ; i++)
    {
        int x;
        cin >> x;
        st.insert(x);
    }

    cout << st.size() << "\n";

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define _                             \
    ios_base::sync_with_stdio(false); \
    cin.tie(NULL);                    \
    cout.tie(NULL);
#define deb(x) cerr << "\n" \
                    << #x << "=" << x << "\n";
#define deb2(x, y) cerr << "\n"                   \
                        << #x << "=" << x << "\n" \
                        << #y << "=" << y << "\n";
typedef long long int ll;

const int mod = 1e9+7;

int main() {
	int n,k;
	cin>>n>>k;
	
	int a[n+1];
	
	for(int i=0;i<n;i++)
		cin>>a[i];
		
	int dp[n+1][k+1];
	
	memset(dp,0,sizeof(dp));
	
	
	for(int i=0;i<n;i++)
	{
		dp[i][0] = 1;
	}
	
	for(int i=1;i<=k;i++)
	{
		if(a[0]>=i)
			dp[0][i]=(dp[0][i-1]+1)%mod;
		else
			dp[0][i]=dp[0][i-1];
	}
	if(n==1)
	{
		cout<<dp[0][k]-dp[0][k-1];
		return 0;
	}
	
	for(int cand= 1;cand<=k;cand++)
	{
		for(int i=1;i<n-1;i++)
		{
			int temp = 0;
	
			if(cand>a[i])
				temp = (dp[i-1][cand]%mod - dp[i-1][cand-a[i]-1]%mod + mod )%mod;
			else
				temp = dp[i-1][cand]%mod;
			dp[i][cand] = (dp[i][cand-1]%mod+temp%mod)%mod;
		}
	}
	
	
	if(k>a[n-1])
		cout<<(dp[n-2][k]%mod-dp[n-2][k-a[n-1]-1]%mod + mod)%mod;
	else
		cout<<dp[n-2][k];
	
    return 0;
}


Measured memory_bytes: 39680
use std::io::prelude::*;
use std::io::stdin;
use std::str::FromStr;

fn main() {
    let h: usize = read();
    let w: usize = read();
    let mut ss = vec![vec!['.'; w + 2]; h + 2];

    for i in 1..h + 1 {
        let s: Vec<char> = read::<String>().chars().collect();
        for j in 1..s.len() + 1 {
            ss[i][j] = s[j - 1];
        }
    }

    for i in 1..h + 1 {
        for j in 1..w + 1 {
            if ss[i][j] == '.' {
                let mut count = 0;
                for k in i - 1..i + 2 {
                    for l in j - 1..j + 2 {
                        if ss[k][l] == '#' {
                            count += 1;
                        }
                    }
                }
                print!("{}", count);
            } else {
                print!("#");
            }
        }
        println!();
    }
}

fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let token: String = stdin
        .lock()
        .bytes()
        .map(|b| b.unwrap() as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().unwrap()
}


Measured memory_bytes: 4352
#include<bits/stdc++.h>
using namespace std;
template <class A, class B> inline bool chmax(A &a, const B &b) { return b > a && (a = b, true); }
template <class A, class B> inline bool chmin(A &a, const B &b) { return b < a && (a = b, true); }
typedef long long ll;
typedef vector<int> vint;
typedef pair<int, int> pint;
typedef vector<long long> vlong;
#define _GLIBCXX_DEBUG
#define vpush(a,x) a.push_back(x);
#define rep(i, n) REP(i, 0, n)
#define all(v) v.begin(), v.end()
#define REP(i, x, n) for(int i = x; i < n; i++)
const int INF = 1 << 30;
const int dx[] = {1,0,-1,0,1,1,-1,-1};
const int dy[] = {0,-1,0,1,1,-1,-1,1};
#define stp(x)  setprecision(x)
int main(){
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  string s,t;
  cin>>s>>t;
  int si=s.size();  
  rep(i,si){
    if(s==t){
      cout<<"Yes"<<'\n';
      return(0);
    }
    char tmp=s[si-1],tmp2,tmp3=s[0];
    REP(j,1,si){
      tmp2=s[j];
      s[j]=tmp3;
      tmp3=tmp2;
    }
    s[0]=tmp;
  }
  cout<<"No"<<'\n';
  return(0);
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <set>
#include <map>
#include <queue>
#include <assert.h>
#include <numeric>
#include <math.h>
#include <climits>
#include <stack>
#include <iomanip>

using namespace std;
#define REP(i,s,n) for(int i=s, i##_len=(n); i<i##_len; ++i)
#define all(x) (x).begin(),(x).end()
typedef long long ll;
typedef unsigned long long ull;

template <typename T>
T gcd(T a, T b) {
    if(a < b) gcd(b, a);
    if (b == 1) return 1;
    T r;
    while ((r=a%b)) {
        a = b;
        b = r;
    }
    return b;
}

#define MOD (1'000'000'000+7)

bool _less(pair<int, int> a, pair<int, int> b) {
    return a.second < b.second;
}

int main() {
    ll A, B;
    cin >> A >> B;
    if (A > B) {
        ll t = A;
        A = B;
        A = t;
    }
    
    if ((A+B)%2 == 1) {
        cout << "IMPOSSIBLE" << endl;
    } else {
        cout << (A+B)/2 << endl;
    }
}


Measured memory_bytes: 888
import numpy as np
from collections import Counter

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

counter = Counter(S)
m = max(counter.values())

most_common_let = [i for i in counter.keys() if counter[i] == m]
sorted_list = sorted(most_common_let)
for i in sorted_list:
    print(i)


Measured memory_bytes: 44480
#include<iostream>
#include<string>
#include<algorithm>
#include<cmath>
#include<iomanip>
#include<cstring>
#include<map>
#include<vector>
#include<queue>
#include<stack>
#include<climits>
#include<set>
#include<utility>
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;
const ll MOD=1e9+7;

int main(){
	
	ll n, a[100000], ans=1;
	bool up=false, down=false;
	cin >> n;
	for(int i=0; i<n; i++){
		cin >> a[i];
	}
	for(int i=0; i<n-1; i++){
		if(a[i]<a[i+1]){
			up=true;
		} else if(a[i]>a[i+1]){
			down=true;
		}
		if(up && down){
			up=false, down=false;
			ans++;
		}
	}
	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
using namespace std;
using ll = long long;
const double PI = 3.14159265358979323846;

int main() {
  int n;
  cin >> n;
  string s;
  cin >> s;
 
  rep(i, s.size()) {
    int x = s.at(i) - 'A';
    x = (x + n) % 26;
    cout << (char)('A' + x);
  }
  cout << endl;
  return 0;
}
      

Measured memory_bytes: 3632
#include <cstdio>
#include <vector>
#include <cmath>
#include <algorithm>

using namespace std;

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

typedef vector<int> vi;

int main()
{
	int n;
	scanf("%d%*c", &n);
	rep(i, n){
		vi a, b;
		char c;
		while(scanf("%c", &c), c != '\n')
			a.push_back(c-'0');
		while(scanf("%c", &c), c != '\n')
			b.push_back(c-'0');
		
		reverse(a.begin(), a.end());
		reverse(b.begin(), b.end());

		int kuri = 0;
		vi ans;
		for(int j=0, k=0; j<(int)a.size() || k<(int)b.size() || kuri; ++j, ++k){
			int v = (j<(int)a.size() ? a[j] : 0) + (k<(int)b.size() ? b[k] : 0) + kuri;
			kuri = v/10;
			ans.push_back(v%10);
		}

		if(ans.size()>80)
			puts("overflow");
		else{
			for(int j=ans.size()-1; j>=0; --j)
				printf("%d", ans[j]);
			puts("");
		}
	}
	return 0;
}

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

typedef long long ll;

int main() {
    int T, N, M, A, B;
    cin >> T;
    while(T--) {
        cin >> N >> M >> A >> B;
        cout << floor_sum(N, M, A, B) << "\n";
    }
}

Measured memory_bytes: 3640
const p=parse(Int,readline())
const A=(x->parse(Int,x)).(split(readline()))
const B=zeros(Int,p,p)
B[1,1]=1
B[p,1]=p-1
for i=1:p-1
	B[p,i+1]=p-1
	for j=p-1:-1:2
		B[j,i+1]=B[j+1,i+1]*i%p
	end
end
println.(B*A.%p)

Measured memory_bytes: 186008
#include <iostream>
#include <sstream>
#include <algorithm>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <memory>
#include <complex>
#include <numeric>
#include <cstdio>
#include <iomanip>
#include <unordered_map>

#define REP(i,m,n) for(int i=int(m);i<int(n);i++)
#define RREP(i,m,n) for(int i=int(n)-1;i>=int(m);--i)
#define EACH(i,c) for (auto &(i): c)
#define all(c) begin(c),end(c)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort(begin(c),end(c))
#define pb emplace_back
#define MP make_pair
#define SZ(a) int((a).size())

#ifdef LOCAL
#define DEBUG(s) cout << (s) << endl
#define dump(x)  cerr << #x << " = " << (x) << endl
#define BR cout << endl;
#else
#define DEBUG(s) do{}while(0)
#define dump(x) do{}while(0)
#define BR 
#endif
using namespace std;

using UI = unsigned int;
using UL = unsigned long;
using LL = long long int;
using ULL = unsigned long long;
using VI = vector<int>;
using VVI = vector<VI>;
using VLL = vector<LL>;
using VS = vector<string>;
using PII = pair<int,int>;
using VP = vector<PII>;

//struct edge {int from, to, cost;};

constexpr double EPS = 1e-10;
//constexpr double PI  = acos(-1.0);
//constexpr int INF = INT_MAX;

template<class T> inline T sqr(T x) {return x*x;}

void solve() {
    int n,m;
    cin >> n >> m;
    VLL a(n);
    REP(i,0,n) cin >> a[i];
    REP(i,0,n) a[i] %= m;
    VI ru(n);
    ru[0] = a[0];
    REP(i,1,n) ru[i] += (ru[i-1] + a[i]) % m;
    //VI c(m);
    unordered_map<int, int> c;
    REP(i,0,n) ++c[ru[i]];
    LL sum = 0;
    LL ans = 0;
    REP(i,0,n) {
        ans += c[sum];
        sum = (sum + m + a[i]) % m;
        --c[ru[i]];
    }
    cout << ans << endl;
}

int main() {
    solve();
    
    return 0;
}

Measured memory_bytes: 4876
/* ex3_2 "∴(Therefore)"
   dada__               */
#include<stdio.h>
int main(void){
    int pencil;
    scanf("%d", &pencil); //本数Nの入力

    switch(pencil%10){ //一の位による場合分け
        case 2:case 4:case 5:case 7:case 9:
        printf("hon\n"); break;
        case 0:case 1:case 6:case 8:
        printf("pon\n"); break;
        case 3:
        printf("bon\n"); break;
    }

    return 0;
}

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

using namespace std;
#define all(a)a.begin(),a.end()
using ll=long long;
const int INF = 1<<30;
const ll INFll =1LL<<62;
const int mod= int(1e9)+7;
using P = pair<ll,ll>;
using ld=long double;

int main(){
    ll now=0;
    ll ans=0;
    string s;cin >>s;
    int n=s.size();
    for (int i = 0; i < n; ++i) {
        if(s[i]=='R')now++;
        else {
            ans=max(ans,now);
            now=0;
        }
    }
    ans=max(ans,now);
    cout <<ans <<endl;
}


Measured memory_bytes: 3620
#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
#pragma GCC optimization("unroll-loops")
#include <bits/stdc++.h>
using namespace std;
# define ll  long long int
# define ld  long double
# define pb push_back
# define pp pop_back
# define ff first
# define ss second
# define mp make_pair
# define ac accumulate
# define mod 1000000007
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);

int  main()
{
    #ifndef ONLINE_JUDGE
       freopen("input.txt", "r", stdin);
       freopen("output.txt", "w", stdout);
    #endif
     IOS
     int n;
     cin >> n;
     vector<int> a(n+1,0);
     for(int i = 1; i <= n; i++){
     	for(int j = 0; j <= n; j += i)
     		a[j]++;
     }
     ll total = 0;
     for(ll i = 1; i <= n; i++)
     	total += i*a[i];
     cout << total;
     return 0;
}

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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
#define REP(i, n) for(int i=0; i<n; i++)
#define REPi(i, a, b) for(int i=int(a); i<int(b); i++)
#define MEMS(a,b) memset(a,b,sizeof(a))
#define mp make_pair
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
const ll MOD = 1e9+7;

bool S[20][2000];

ll popcount(ll x){
    ll cnt = 0;
    while(x > 0){
        if(x & 1) cnt++;
        x >>= 1;
    }
    return cnt;
}

int main(){
    ll H, W, K;
    cin >> H >> W >> K;
    REP(i,H){
        REP(j,W){
            char c;
            cin >> c;
            if(c == '1')
                S[i][j] = true;
            else
                S[i][j] = false;
        }
    }

    ll ans = LLONG_MAX;
    for(int i = 0; i < (1 << (H-1)); i++){
        ll tmp = 0;
        ll cnt = popcount(i);
        tmp += cnt;
        vector<ll> block(cnt+1, 0);
        REPi(j, 0, W){
            int b = 0;
            bool update = false;
            REPi(h,0,H){
                bool s = S[h][j];
                if(s){
                    block[b]++;
                    if(block[b] > K){
                        update = true;
                        tmp++;
                        break;
                    }
                }
                if((i >> h) & 1)
                    b++;
            }

            if(update){
                if(j == 0){
                    tmp = LLONG_MAX;
                    break;
                }
                for(auto&& x : block)
                    x = 0;
                j--;
            }
        }

        chmin(ans, tmp);
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
using namespace std;
#define mod 1e9+7
int main()
{
	int a[25];
	int n, sum = 0;
	cin >> n;
	for (int i = 0; i < n; i++)
		cin >> a[i];
	for (int i = 1; i < n - 1; i++)
		if ((a[i] > a[i - 1] && a[i] < a[i + 1]) || (a[i] < a[i - 1] && a[i] > a[i + 1]))sum++;
	cout << sum;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
const int INF = 1e9;
const ll LINF = 1e18;

/*
 <url:https://cf17-final-open.contest.atcoder.jp/tasks/cf17_final_c>
 問題文============================================================
 XXXX年のCODE FESTIVALには、世界中から高橋君を含めて N+1 人の参加者が集まりました。
 
 高橋君の都市と他の N 人の都市の時刻の差を調べてみたところ、i 番目の人の都市との時刻の差は Di 時間でした。
 ただし 2 つの都市について、片方の都市で 0 時の瞬間にもう一方の都市で d 時であるようなとき、
 これらの都市の時刻の差は min(d,24−d) であるものとします。
 ここで、時刻の表記には 24 時間表記を用いるものとします。
 つまり、例えば高橋君の都市で 0 時の瞬間には i 番目の人の都市は Di 時または 24−Di 時のいずれかとなります。
 
 高橋君は次に、N+1 人のうちの全ての 2 人組についてその人の都市どうしの時刻の差を書き出し、
 それらの時刻の差のうちの最小値を s としました。
 
 s として考えられる最大値を求めて下さい。
 =================================================================
 
 解説=============================================================
 
 高橋君を 0時とすることを最初に確定しておく。
 時差をソートしておき、順番に時間を見て行った時、
 おく時の選択は D[i] or 24 - D[i] となる
 
 ここで、その二つの選択に関して、それまでに確定した時間との差の最小値をそれぞれ見て行き、
 差が大きい選択をその都市の時間とすれば良い
 （ソートされているので時間は必ず　0 -> 12 or 24 -> 12 で埋まって行く）
 
 
 解説を確認したところ
 この選択方法は
     D[i] と 24-D[i] を交互に選択した場合と同義になる。（確かにそれは、そう）
 
 ================================================================
 */
ll solve(){
    ll ret = INF;
    ll N; cin >> N;
    vector<ll> D(N);
    for(auto& in:D) cin >> in;
    sort(D.begin(),D.end());
    vector<ll> t; t.push_back(0);
    for(int i = 0; i < N;i++){
        ret = min(ret,D[i]);
        
        ll t1 = D[i],t2 = 24 - D[i];
        ll dif1 = INF, dif2 = INF;
        for(auto T:t){
            dif1 = min(dif1,min(abs(t1-T),abs(24+t1-T)));
            dif2 = min(dif2,min(abs(t2-T),abs(24+t2-T)));
        }
        ret = min(ret,max(dif1,dif2));
        if(dif1 > dif2){
            t.push_back(t1);
        }else{
            t.push_back(t2);
        }
    }
    return ret;
}

ll solve_2(){
    ll ret = INF;
    ll N; cin >> N;
    vector<ll> D(N);
    for(auto& in:D) cin >> in;
    sort(D.begin(),D.end());
    vector<ll> t; t.push_back(0);
    for(int i = 0; i < N;i++){
        if(i%2 == 0){
            t.push_back(D[i]);
        }else{
            t.push_back(24-D[i]);
        }
    }
    for(int i = 0; i <= N;i++){
        for(int j = i+1; j <= N;j++){
            ret = min(ret,abs(t[i]-t[j]));
        }
    }
    return ret;
}

int main(void) {
    cin.tie(0); ios::sync_with_stdio(false);
    cout << solve() << endl;
    return 0;
}


Measured memory_bytes: 384
#include"bits/stdc++.h"

using namespace std;

int main() {
	int N;
	cin >> N;
	int ans = 0;

	for (int i = 1; i <= N; i += 2) {
		int cnt = 0;
		for (int j = 1; j <= i; j++) {
			if (i%j == 0) {
				cnt++;	
			}
			if (cnt == 8) {
				ans++;
			}
		}
	}

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

Measured memory_bytes: 256
#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 N, K;
vector<int> d;
vector<vector<int>> A;

void input() {
  cin >> N >> K;
  d.resize(K);
  A.resize(K, vector<int>());
  for(int i = 0; i < K; i++){
    cin >> d[i];
    A[i].resize(d[i]);
    for(int j = 0; j < d[i]; j++) {
            cin >> A[i][j];
          }
      }
  }   

void solve() {
  int ans = 0;
  for(int i = 1; i <= N; i++) {
    bool have = false;
    for(auto v : A) {
      for (auto p: v){
        if (p == i) have = true;
      }
    }
    if(!have) ans++;
  }
  cout << ans << endl;
}

int main() {
  input();
  solve();
  return 0;
}

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

const ll INF = 100100100100100100;

struct edge{
    // Dijkstraでは隣接リストを用いるのでfromはいらない
    // int from;
    int to;
    int c;
};

ll V,E;
const ll MAX_V = 15;
const ll MAX_E = 15;
void warshall(vector<vector<ll>> &dp){
    
    // dpは初期化する．
    // dp[i][i]=0, dp[i][j]=(経路があればその値), (なければINF)

    for(ll k = 0; k < V; k++){
        for(ll i = 0; i < V; i++){
            for(ll j = 0; j < V; j++){
                dp[i][j] = min(dp[i][j], dp[i][k]+dp[k][j]);
            }
        }
    }
}

int main(){
    V = 10;
    E = 10;
    ll H,W;
    cin >> H >> W;

    vector<vector<ll>> dp(MAX_V, vector<ll>(MAX_E,INF));
    rep(i,V){
        dp[i][i] = 0;
    }
    rep(i,V)rep(j,E){
        cin >> dp[i][j];
    }

    warshall(dp);

    ll ans = 0;
    rep(i,H)rep(j,W){
        ll tmp; cin >> tmp;
        if(tmp==-1)continue;
        ans += dp[tmp][1];
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
#define REP(i,n) for (int i = 0; i < (n); i++)
#define ALL(a) a.begin(), a.end()
#define RALL(a) a.rbegin(), a.rend()
using namespace std;
using ll = long long;
const ll MOD = 1000000007;
const ll INF = MOD * MOD;
const int inf = (1<<29);

int main() {

    int n, k, cnt = 0;
    cin >> n >> k;
    
    string s;
    cin >> s;
    for(int i = 1; i < s.size(); i++) {
        if(s[i-1] != s[i]) cnt++;
    }  

    int ans;
    ans = min(n-1, n - (cnt+1) + 2*k);

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
#define rep(i, a, b) for(int i = a; i < b; i++)
#define Rep(i, a, b) for(int i = a; i <= b; i++)
#define _GLIBCXX_DEBUG
#define V vector<int>
#define ll long long
using namespace std;


int main() {
    string s; 
    cin >> s;

    int N = 0, W = 0, S = 0, E = 0;
    rep(i, 0, s.size()) {
        if(s[i] == 'N') N++;
        else if (s[i] == 'W') W++;
        else if (s[i] == 'S') S++;
        else if (s[i] == 'E') E++;
    }

    if((N && S) && ((W && E)||(!W && !E))) cout << "Yes" << endl;
    else if((W && E) && (!N && !S)) cout << "Yes" << endl;
    else cout << "No" << endl;
}


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

int main(){

	long int X;

	cin >> X;

	long int t=0;
	long int sum = 0;

	for(t=1; sum < X; t++){
		sum += t;
		if(sum >= X){
			break;
		}
	}

	cout << t << endl;

	return 0;

}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define MAX 1000001
#define INF 1000000000
#define M 1000000007
#define ll long long
#define zero(x) memset(x,0,sizeof(x))
using namespace std;

int main(){
	int n;
	cin >> n;
	int x[n];
	for (int i=0;i<n;i++) cin >> x[i];
	ll z,o;
	z = x[1]-2;
	o = 2;
	ll res = 1;
	ll prev = x[1];
	for (int i=2;i<n;i++){
		if (z+1<o){
			res = (res*o)%M;
			o--;
			z++;
		}
		z+=(x[i]-prev-1);
		o++;
		prev = x[i];
	}
	ll fac = 1;
	for (ll i=2;i<=o;i++){
		fac = (fac*i)%M;
	}
	res = (res*fac)%M;
	cout << res;
	return 0;
}

Measured memory_bytes: 640
S[12][1024];
f(n,s,u,i){
  for(S[n++][s]++;i--;)
      u&1<<i&&f(n,s+i*n,u^1<<i,10);
}
main(n,s)
{
  for(f(0,0,1023,10);~scanf("%d%d",&n,&s);)printf("%d\n",s>1023?0:S[n][s]);
}

Measured memory_bytes: 324
#include <cstdio>
#include <algorithm>

using namespace std;

int edge[300000],nxt[300000],first[300000];
int c1[300000],c2[300000],d1[300000],d2[300000],e[300000];
int i,j,k,n,p,t,t1,t2,x,y,sum_edge;

inline void addedge(int x,int y)
{
	sum_edge++,edge[sum_edge]=y,nxt[sum_edge]=first[x],first[x]=sum_edge; 
	return;
}

int main()
{
	scanf("%d",&n);
	if (n==2)
		return printf("1 2"),0;
	if (n==3)
		return printf("1 2 3"),0;
	for (i=1;i<n;i++)
	{
		scanf("%d%d",&x,&y);
		addedge(x,y),addedge(y,x);
	}
	for (i=1;i<=n;i++)
		for (j=first[i];j!=0;j=nxt[j])
			if (nxt[first[edge[j]]])
				if (! d1[i])
					d1[i]=edge[j];
				else
					if (! d2[i])
						d2[i]=edge[j];
					else
						return puts("-1"),0;
			else
				e[i]++;
	for (i=1;i<=n;i++)
		if ((d1[i]) && (d1[d1[i]]!=i) && (d2[d1[i]]!=i))
			if (! d1[d1[i]])
			{
				d1[d1[i]]=i;
				e[d1[i]]--;
				if (! t1)
					t1=i;
				else
					t2=i;
			}
			else
				if (! d2[d1[i]])
				{
					d2[d1[i]]=i;
					e[d1[i]]--;
					if (! t1)
						t1=i;
					else
						t2=i;
				}
	for (k=0,p=0,i=t1;i!=t2;)
	{
		k++,c1[k]=e[i]+1;
		if (d1[i]==p)
			p=i,i=d2[i];
		else
			p=i,i=d1[i];
	}
	k++,c1[k]=e[i]+1;
	swap(t1,t2);
	for (k=0,p=0,i=t1;i!=t2;)
	{
		k++,c2[k]=e[i]+1;
		if (d1[i]==p)
			p=i,i=d2[i];
		else
			p=i,i=d1[i];
	}
	k++,c2[k]=e[i]+1;
	t1=1,t2=0;
	for (i=1;i<=k;i++)
	{
		if (c1[i]<c2[i])
		{
			t1=1,t2=0;
			break;
		}
		if (c2[i]<c1[i])
		{
			t1=0,t2=1;
			break;
		}
	}
	t=0;
	for (i=1;i<=k;i++)
		if (t1)
		{
			for (j=2;j<=c1[i];j++)
				printf("%d ",t+j);
			printf("%d ",t+1);
			t=t+c1[i];
		}
		else
		{
			for (j=2;j<=c2[i];j++)
				printf("%d ",t+j);
			printf("%d ",t+1);
			t=t+c2[i];
		}
	return 0;
}


Measured memory_bytes: 8448
import math

N = input()
num_list = list(map(int,input().split(' ')))
i = 0
Bob = 0
Alice = 0
for n in sorted(num_list, reverse=True):
  i += 1
  if i % 2 == 1:
    Bob += n
  elif i % 2 == 0:
    Alice += n
ans = Bob - Alice
print(ans)

Measured memory_bytes: 9112
# -*- coding: utf-8 -*-
import sys
sys.setrecursionlimit(10**9)
INF=10**18
MOD=10**9+7
def input(): return sys.stdin.readline().rstrip()

def main():
    S=input()
    for i in range(1,10):
        if S=='hi'*i:
            print('Yes')
            exit()
    print('No')

if __name__ == '__main__':
    main()


Measured memory_bytes: 38384
#include <bits/stdc++.h>
#define ll long long
using namespace std;
int n;
ll ans[87];
int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	cin>>n;
	ans[0]=2;
	ans[1]=1;
	for (int i=2;i<=n;++i) ans[i]=ans[i-1]+ans[i-2];
	cout<<ans[n];
	return 0;
}

Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

import static java.lang.Integer.parseInt;

/**
 * Delivery to a Luxurious House
 */
public class Main {

	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String line;
		String[] words;

		StringTokenizer st = new StringTokenizer(br.readLine());

		int N, M, T;
		N = parseInt(st.nextToken());
		M = parseInt(st.nextToken());
		T = parseInt(st.nextToken());

		int a[] = new int[N + 2];

		a[0] = -M;
		a[N + 1] = T + M;

		st = new StringTokenizer(br.readLine());

		for (int i = 0; i < N; i++) {
			a[i + 1] = parseInt(st.nextToken());
		}

		int t = 0;

		for (int i = 1; i < N + 2; i++) {
			int _t = a[i] - a[i - 1] - 2 * M;
			if (_t > 0) t += _t;
		}

		System.out.println(t);

	} //end main
}

Measured memory_bytes: 24468
//OPTIMIZATIONS
#pragma GCC optimize("O3")
//(UNCOMMENT WHEN HAVING LOTS OF RECURSIONS)
//#pragma comment(linker, "/stack:200000000")
//(UNCOMMENT WHEN NEEDED)
//#pragma GCC optimize("Ofast,unroll-loops,no-stack-protector,fast-math")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,tune=native")
//OPTIMIZATIONS
#include <bits/stdc++.h>
typedef long long ll;
typedef unsigned long long uu;
typedef long long int lll;
typedef unsigned long long int uuu;
using namespace std;

#define watch(x) cerr << "\n" \
					  << (#x) << " is " << (x) << endl
#define cel(x, y) 1 + ((x - 1) / y)
const double PI = 3.141592653589793238463;
const int MOD = 1000000007;
const int INF = 0x3f3f3f3f;

/*
$alil03

URL: url

Solution Begins here
*/

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	int n;
	cin >> n;
	string a, b;
	cin >> a >> b;
	for (int i = 0; i < n; i++)
	{
		cout << a[i] << b[i];
	}
}

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

#define REP(i,init, n) for(lli i=init;i<n;i++)
#define REPE(i,init, n) for(lli i=init;i<=n;i++)
#define REPIT(it,container) for(auto it = container.begin(); it != container.end(); it++)
#define REPIT_R(it,container) for(auto it = container.rbegin(); it != container.rend(); it++)

#define ARRAY_LENGTH(array) (sizeof(array) / sizeof(array[0]))

typedef long long int lli;
typedef pair<lli, lli> P;

int main() {
    lli n, a, b;
    cin >> n >> a >> b;
    cout << min(a*n, b) << endl;
}


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

int find(vector<int> kk, vector<vector<int>> a){
  int flag=0;
  int person=0;
  set<int> kkk(kk.begin(), kk.end());

  for(int j=0;j<a.size();j++){
    int cnt=0;
    for(int k=0;k<a[j].size();k++){
      if(kkk.find(a[j][k])!=kkk.end()){
         cnt++;
         if(cnt==kkk.size()){
           person=j+1;
           flag++;
         }
      }
    }
  }

  if(flag!=1)
    return 0;
  else
    return person;
}

int main(){
  int n;

  while(cin>>n&&n){
    vector<vector<int>> a(n);
    vector<int> kk;

    for(int i=0;i<n;i++){
      int m;
      cin >> m;
      for(int j=0;j<m;j++){
        int p;
        cin >> p;
        a[i].push_back(p);
      }
    }

    int k;
    cin >> k;
    int person;
    for(int i=0;i<k;i++){
      int l;
      cin >> l;
      kk.push_back(l);
    }

    person = find(kk, a);

    if(person!=0) cout << person << endl;
    else cout << -1 << endl;

  }

  return 0;
}

Measured memory_bytes: 1312
# -*- coding: utf-8 -*-

import sys
input = sys.stdin.readline

def io_generator():
	return input()

#+++++++++++++++++++

def main(io):
	a,b,c,d = map(int, io().split())
	
	rets=['Left', 'Balanced', 'Right']
	
	if a+b > c+d:
		return rets[0]
	elif a+b < c+d:
		return rets[2]
	else:
		return rets[1]

#++++++++++++++++++++

if __name__ == "__main__":
	io= lambda : io_generator()
	print (main(io))

Measured memory_bytes: 3060
# -*- coding: utf-8 -*-

import sys
from collections import Counter

def input(): return sys.stdin.readline().strip()
def list2d(a, b, c): return [[c] * b for i in range(a)]
def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]
def list4d(a, b, c, d, e): return [[[[e] * d for j in range(c)] for j in range(b)] for i in range(a)]
def ceil(x, y=1): return int(-(-x // y))
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(N=None): return list(MAP()) if N is None else [INT() for i in range(N)]
def Yes(): print('Yes')
def No(): print('No')
def YES(): print('YES')
def NO(): print('NO')
sys.setrecursionlimit(10 ** 9)
INF = 10 ** 18
MOD = 10 ** 9 + 7

S = input()
N = len(S)

if N % 2 == 1:
    No()
    exit()

for i in range(0, N, 2):
    if S[i] != 'h' or S[i+1] != 'i':
        No()
        exit()
Yes()


Measured memory_bytes: 3444
#include<bits/stdc++.h>
#define hell 1000000007
#define int long long int
#define inf (int)(100000000)

using namespace std;

void solve(){
    int a,b;
    cin>>a>>b;
    cout<<a*b;
}

signed main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int t;
    //cin>>t;
    t=1;
    while(t--){
        solve();
    }
    return 0;
}



Measured memory_bytes: 3640
#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  string s;
  cin >> s;
  int need1 = 0, need2= 0;
  int cnt = 0;

  int opn = 0;
  for(int i=0;i<s.size();i++) {
    if(s[i] == '(')
      cnt++;
    else {
      cnt--;
      if(cnt < 0)
        opn = max(opn, abs(cnt));
    }
  }
  string ans = "";
  for(int i=0;i<opn;i++) {
    ans += '(';
  }
  ans += s;
  cnt = 0;
  for(int i=0;i<ans.size();i++) {
    if(ans[i] == '(')
      cnt++;
    else
      cnt--;
  }
  for(int i=0;i<cnt;i++) {
    ans += ')';
  }
  cout << ans << endl;

}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define fastcin() cin.tie(0);ios::sync_with_stdio(false)
#define rep(i,n) for(int i=0;i<int(n);i++)
#define rep1(i,n) for(int i=1;i<=int(n);i++)
#define per(i,n) for(int i=int(n)-1;i>=0;i--)
#define per1(i,n) for(int i=int(n);i>0;i--)
#define foreach(i,n) for(auto &&i:n)
#define all(x) (x).begin(),(x).end()
#define SORT(x) sort(all(x))
#define REV(x) reverse(all(x))
#define MAX(x) *max_element(all(x))
#define MIN(x) *min_element(all(x))
#define LOWitr(x, n) lower_bound(all(x), n)
#define UPRitr(x, n) upper_bound(all(x), n)
#define cii(x) int x;cin >> x
#define cill(x) LL x;cin >> x
#define cis(x) string x;cin >> x
#define co(x) cout << x << endl
#define dump(x)  cout << #x << " = " << (x) << endl
#define truecheck assert
#define pb push_back
#define mp make_pair
#define F first
#define S second
using namespace std;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;
typedef long long int64;
template<class T,class U>bool chmax(T &a, const U &b) { if (a<b) { a=b; return true; } return false; }
template<class T,class U>bool chmin(T &a, const U &b) { if (b<a) { a=b; return true; } return false; }
const int INF = 1e9, MOD = 1e9 + 7;
const LL LLINF = 1e16;

int main() {
    fastcin();
    cout << fixed << setprecision(10);
    cii(n);
    cii(m);
    int ans = n * (n - 1) + m * (m - 1);
    co(ans / 2);
    return 0;
}

Measured memory_bytes: 256
M=9;main(n,i,j,k,a,b,c){
	float p=atan(1)*4,X[100],Y[100],x,y;
	for(;scanf("%d",&n),n;printf("%d\n",a)){
		for(i=0;i<n;i++)scanf("%f,%f",X+i,Y+i);
		for(a=i=0;i<n;i++){
			for(b=k=0;k<M;k++){
				x=X[i]+cos(p*k/M),y=Y[i]+sin(p*k/M);
				for(c=j=0;j<n;j++){
					if((X[j]-x)*(X[j]-x)+(Y[j]-y)*(Y[j]-y)<1+1e-3)c++;
				}
				if(b<c)b=c;
			}
			if(a<b)a=b;
		}
	}
exit(0);}

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

using namespace std;
 
#define rep2(x,fr,to) for(int (x)=(fr);(x)<(to);(x)++)
#define rep(x,to) for(int (x)=0;(x)<(to);(x)++)
#define repr(x,fr,to) for(int (x)=(fr);(x)>=(to);(x)--)
#define all(c) (c).begin(),(c).end()
#define sz(v) (int)(v).size()

typedef int64_t ll; typedef vector<int> VI; typedef pair<ll,ll> pii;
const int MD = 1e9+7; typedef vector<ll> VL;

void dbg(){ cerr << "\n"; }  
template <typename T,typename ...T2>
void dbg(const T& fst, const T2&...rst){ cerr << fst << ": "; dbg(rst...); }


int main()
{
	
	cin.tie(0); ios_base::sync_with_stdio(false);
	int n, k;
	cin >>n >>k;
	

	VL ct(k);
	rep2(i, 1, n+1) ct[i%k]++;
	
	ll res = (ll)ct[0]*ct[0]*ct[0];
	if(k%2==0) res += (ll)ct[k/2] * ct[k/2] * ct[k/2];
	cout << res <<"\n";
	return 0;
}


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

int main()
{
	string S, T;

	cin >> S >> T;

	T.erase(T.end() - 1);

	if (S==T)
	{
		cout << "Yes" << endl;
	}
	else
	{
		cout << "No" << endl;
	}
	return 0;
}

Measured memory_bytes: 3632
Q, H, S,D = map(int, input().split())
N = int(input())
# Dから順番に使おうとする
# Nを4倍しておこう
N *= 4
cnt = 0
# D > 2*Sなら使わない
if D <= 2 * S and D <= 4*H and D <= 8*Q:
    cnt += N // 8 *  (D)
    N %= 8

# 次、Sを使うかどうか
if S <= 2 * H and S <= 4*Q:
    cnt += N // 4 * (S)
    N %= 4

# 次、Hを使うかどうか
if H <= 2 * Q :
    cnt += N // 2 * (H)
    N %= 2

# 最後
cnt += N * (Q)

print(cnt)

Measured memory_bytes: 3064
#include<iostream>
#include<cstdio>
#include<cstring>
#include<string>
#include<vector>
#include<cmath>
#include<algorithm>
#include<map>
#include<queue>
#include<deque>
#include<iomanip>
#include<tuple>
using namespace std;
typedef long long int LL;
typedef pair<int,int> P;
typedef pair<LL,int> LP;
const int INF=1<<30;
const LL MAX=1e9+7;

void array_show(int *array,int array_n,char middle=' '){
	for(int i=0;i<array_n;i++)printf("%d%c",array[i],(i!=array_n-1?middle:'\n'));
}
void array_show(LL *array,int array_n,char middle=' '){
	for(int i=0;i<array_n;i++)printf("%lld%c",array[i],(i!=array_n-1?middle:'\n'));
}
void array_show(vector<int> &vec_s,int vec_n=-1,char middle=' '){
	if(vec_n==-1)vec_n=vec_s.size();
	for(int i=0;i<vec_n;i++)printf("%d%c",vec_s[i],(i!=vec_n-1?middle:'\n'));
}
void array_show(vector<LL> &vec_s,int vec_n=-1,char middle=' '){
	if(vec_n==-1)vec_n=vec_s.size();
	for(int i=0;i<vec_n;i++)printf("%lld%c",vec_s[i],(i!=vec_n-1?middle:'\n'));
}

int main(){
	int n,m;
	int i,j,k;
	int a,b,c;
	char ca;
	cin>>a>>ca>>b;
	if(ca=='+')cout<<a+b<<endl;
	else cout<<a-b<<endl;
}

Measured memory_bytes: 256
//標準関数をすべてインクルードする。
#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;

const int_least64_t INF = 10000000;

int main(){
    //cin coutを高速化
	std::ios::sync_with_stdio(false);
	std::cin.tie(0);
	std::cout.tie(0);

    int N;
    cin >> N;
    string S;
    set<string> st;
    rep(i, N){
        cin >> S;
        st.insert(S);
    }

    cout << st.size() << endl;

    return 0;
}



Measured memory_bytes: 19288
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
const int mod=7+1e9;
ll gcd(ll x,ll y){return y?gcd(y,x%y):x;}
ll lcm(ll x,ll y){return x/gcd(x,y)*y;}
ll qpow(ll a,ll b,ll p){a%=p; ll ret=1;for(;b;b>>=1,a=a*a%p) if(b&1) ret=ret*a%p; return ret;}
ll getInv(ll x,ll p){return qpow(x,p-2,p);}

int main(){
    int n,k; scanf("%d%d",&n,&k);
    vector<bool> a(n+1);
    for(int i=1;i<=k;i++){
        int x; scanf("%d",&x);
        while(x--){
            int o; scanf("%d",&o);
            a[o]=1;
        }
    }
    int cnt=0;
    for(int i=1;i<=n;i++) if(!a[i]) cnt++;
    printf("%d\n",cnt);
}

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

int main(){
    int n, q;
    cin >> n >> q;
    string s;
    cin >> s;
    vector<int> d(n, 0);
    vector<int> r(n), l(n);
    for(int i = 0; i < q; i++){
        cin >> l[i] >> r[i];
    }
    for(int i = 1; i < n; i++){
        if(s[i] == 'C' && s[i-1] == 'A'){
            d[i] = d[i-1] + 1;
        }else{
            d[i] = d[i-1];
        }
    }
    
    for(int i = 0; i < q; i++){
        cout << d[r[i]-1] - d[l[i]-1] << endl;
    }
    return 0;


}

Measured memory_bytes: 2240
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n,c,k;
  cin >> n >> c >> k;
  int i,t[100010];
  for(i=0;i<n;i++){
    cin >> t[i];
  }
  sort(t,t+n);
  int sum=1,time=t[0],ans=0;
  for(i=1;i<n;i++){
    if(sum==c){
      ans++,sum=1,time=t[i];
    }
    else if(t[i]-time>k){
      if(sum%k==0){
        ans+=sum/c;
      }
      else{
        ans+=sum/c+1;
      }
      sum=1,time=t[i];
    }
    else{
      sum++;
    }
  }
  if(sum%c==0){
    ans+=sum/c;
  }
  else{
    ans+=sum/k+1;
  }
  cout << ans << endl;
}

Measured memory_bytes: 3876