akhauriyash/Code-Regression huggingface dataset:
#include <stdio.h>
#include <string.h>

int getaline(char *);
void double_str(char src[101], char dst[201]);

int main(void)
{
	char s1[101];
	char s[201];
	char p[101];

	// input s
	getaline(s1);
	
	// input p
	getaline(p);
	
	double_str(s1, s);

	int len_s = strlen(s);
	int len_p = strlen(p);
//	printf("%s\n", s);
//	printf("lens=%d lenp=%d\n", len_s, len_p);

	// check pattern
	int find = -1;
	int pp = 0;	// pointer of finding pattern
	int sp = 0;	// pointer of strings
	int loop = 0;

	while(find<0){
		if(p[pp] == s[sp]){
			pp++;
			if(pp >= len_p){
				//putchar('\n');
				find = 1;
				break;
			}
			sp++;
			if(sp >= len_s){
				find = 0;
				break;
			}
		}else{
			if(pp == 0){
				sp++;
				if(sp >= len_s){
					find = 0;
					break;
				}
				continue;
			}else{
				pp = 0;
				sp = ++loop;
				//putchar('\n');
				continue;
			}
			
		}
	}
			
	printf("%s\n", (find==1) ? "Yes":"No");
	return 0;
}

void double_str(char src[101], char dst[201]){
	int i=0;
	int len = strlen(src);
	for(i=0; i<len; i++)
		dst[i]=src[i];
	int j=0;
	for(j=0; j<len-1 ; j++, i++)
		dst[i] = src[j];
	dst[i] = 0;
}

int getaline(char *s){
	int i = 0;
	while(1){
		int c = getchar();
		if(c == '\n' || c == EOF)
			break;
		s[i++] = c;
	}
	s[i]=0;
	return i;
}



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

int main(){
  int a, b, C;
  double rad, S, L, h;
  cin >> a >> b >> C;
  rad = C * acos(-1) / 180;
  S = a * b * sin(rad) / 2;
  L = a + b + sqrt(pow(a, 2) + pow(b, 2) - 2 * a * b * cos(rad));
  h = b * sin(rad);
  printf("%f\n%f\n%f\n", S, L, h);

  return 0;
}

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

typedef long long int ll;
typedef unsigned long long int ull;
#define rep(i,n) for(auto i=0;i<(n);i++)
#define rep1(i,n) for(auto i=1;i<=(n);i++)
#define all(x) (x).begin(),(x).end()

using namespace std;


struct init{ init(){ cin.tie(0); ios::sync_with_stdio(0); cout<<fixed<<setprecision(20); }; }aaaaaaa;


int main(){
    ll n;
    cin >> n;
    vector<ll> color;
    ll last = -1;
    rep(i, n){
        ll c;
        cin >> c;
        if(last != c) color.push_back(c);
        last = color.back();
    }
    n = color.size();
    ll mod = 1e9 + 7;

    set<ll> keys;
    for(auto c : color) keys.insert(c);

    map<ll, vector<ll>> cma;
    rep(i, n) cma[color[i]].push_back(i);    

    map<ll, vector<pair<ll, ll>>> ma;
    for(auto c : keys){
        ll l = -1;
        for(auto r : cma[c]){
            if(l != -1) ma[l].push_back({c, r});
            l = r;
        }
    }

    vector<ll> pat(n, 0);
    pat[n-1] = ma[n-1].size() % mod;
    for(ll i = n-2; 0 <= i; i--){
        ll sum = 0;
        for(auto p : ma[i]) sum += pat[p.second]+1, sum %= mod;
        pat[i] = sum + pat[i+1];
        pat[i] %= mod;
    }

    cout << (pat[0]+1)%mod << endl;
    

    return 0;
}

Measured memory_bytes: 50288
#from collections import deque,defaultdict
printn = lambda x: print(x,end='')
inn = lambda : int(input())
inl   = lambda: list(map(int, input().split()))
inm   = lambda:      map(int, input().split())
ins = lambda : input().strip()
DBG = True # and False
BIG = 10**18
R = 10**9 + 7
#R = 998244353

def ddprint(x):
  if DBG:
    print(x)

import bisect
n = inn()
a = inl()
lacc = [0]*(n+1)
for i in range(n):
    lacc[i+1] = lacc[i]+a[i]
ans = BIG
for i in range(2,n-1):
    j = bisect.bisect_left(lacc,lacc[i]//2+1)
    j = min(j,i-1)
    k = bisect.bisect_left(lacc,(lacc[n]+lacc[i])//2+1)
    k = min(k,n-1)
    for dj in range(2):
        jj = j-dj
        if jj<=0:
            continue
        for dk in range(2):
            kk = k-dk
            if kk<=i:
                continue
            v = []
            v.append(lacc[jj])
            v.append(lacc[i]-lacc[jj])
            v.append(lacc[kk]-lacc[i])
            v.append(lacc[n]-lacc[kk])
            ans = min(ans,max(v)-min(v))
print(ans)


Measured memory_bytes: 103200
#include<bits/stdc++.h>
const long long INF = INT_MAX / 2;
const long long MOD = 1000000007;
const long double PI = 3.1415926;
#define FOR(i,r,n) for(ll i = (ll)(r); i < (ll)(n); i++)
#define RFOR(i,r,n) for(ll i=(ll)(n-1);i>=r;i--)
#define REP(i,n) FOR(i,0,n)
#define REP1(i,n) FOR(i,1,n+1)
#define RREP(i,n) RFOR(i,0,n)
#define ALL(x) x.begin(),x.end()
#define RALL(x) x.rbegin(),x.rend()
#define ll long long int
using namespace std;
ll ans = 0, sum = 0, n, k, cnt = 0, w, h;
string s;
vector<ll> v;
vector<ll> v1;
vector < pair<ll, ll > > vp;
vector < pair<ll, ll > > vp1;
vector<vector<ll> > vv(50, vector<ll>(50, INF));
vector<string> vs;
vector<char> vc;
set<ll> st;
map<char, ll> mp;

/*--------------------template--------------------*/



int main()
{
	cin >> n >> k >> h;
	if(k-n==h-k)
	{
		cout << "YES" << endl;
	}
	else
	{
		cout << "NO" << endl;
	}
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#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 pb push_back
#define mp make_pair
#define fi first
#define se second
#define pcnt __builtin_popcount
#define sz(x) (int)(x).size()
#define maxs(x,y) x = max(x,y)
#define mins(x,y) x = min(x,y)
#define show(x) cout<<#x<<" = "<<x<<endl;
#define rng(a) (a.begin()),(a.end())
#define each(it,c) for(__typeof((c).begin()) it=(c).begin();it!=(c).end();it++)

using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<pii> vpii;
typedef set<int> si;
typedef pair<ll,ll> pll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<pll> vpll;
typedef set<ll> sl;
typedef __int128_t lll;
typedef pair<lll,lll> plll;
typedef vector<lll> vlll;
template<typename T>string join(vector<T>&v){stringstream s;FOR(i,0,sz(v))s<<' '<<v[i];return s.str().substr(1);}
template<typename A,size_t N,typename T>void Fill(A (&array)[N],const T&v){fill((T*)array,(T*)(array+N),v);}
lll gcd(lll a,lll b,lll &x,lll &y){if(!b){x=1;y=0;return a;}lll d=gcd(b,a%b,y,x);y-=a/b*x;return d;}
ll gcd(ll a,ll b){lll x=0,y=0;return gcd(a,b,x,y);}
ll modpow(lll a,lll n,ll m){if(!a)return a;lll p=1;for(;n>0;n>>=1,a=a*a%m)if(n&1)p=p*a%m;return(ll)p;}
void dout(double d){printf("%.12f\n",d);}
void YN(bool z){cout<<(z?"YES\n":"NO\n");}
void Yn(bool z){cout<<(z?"Yes\n":"No\n");}
void yn(bool z){cout<<(z?"yes\n":"no\n");}

const int iinf = 1e9;
const ll linf = 1e18;
const int mod = 1e9+7;
const double pi = acos(-1);
const double eps = 1e-10;
const int N = 0;
int n, t, c, s;
main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  cin >> n >> t;
  int ans = iinf;
  FOR(i, 0, n){
    cin >> c >> s;
    if(s <= t) mins(ans, c);
  }
  if(ans == iinf){
    cout << "TLE" << endl;
  }else{
    cout << ans << endl;
  }
  return 0;
}

Measured memory_bytes: 256
mod = 10 ** 9 + 7
def regularize(a, b):
    if a < 0 or (a == 0 and b < 0):
        a, b = -a, -b
    if b > 0:
        return 0, a, b
    else:
        return 1, -b, a

def gcd(x, y):
    if y == 0:
        return x
    else:
        return gcd(y, x % y)


n = int(input())
edict = dict()
zero_num = 0
for _ in range(n):
    a, b = map(int, input().split())
    if a == 0 and b == 0:
        zero_num += 1
        continue
    ab_gcd=gcd(a, b)
    a, b = a//ab_gcd, b//ab_gcd
    index, a, b = regularize(a, b)
    key = (a, b)
    if key not in edict.keys():
        edict[key] = [0, 0]
    edict[key][index] += 1


not_zeros = 1
for key in edict.keys():
    a, b = key
    pp, pm = edict[key]
    not_zeros *= (pow(2, pp, mod) + pow(2, pm, mod) - 1) % mod
    not_zeros %= mod

print((zero_num + not_zeros - 1) % mod)



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

int main()
{
  double n;
  cin >> n;
  int x = n;
  if (x % 2 == 0) {
    cout <<  0.5 << endl;
  }
  else {
    cout << 1 / n * (x / 2 + 1) << endl;
  }
  return 0;
}

Measured memory_bytes: 3744
#include<bits/stdc++.h>//头文件
using namespace std;
int n,k,ans=1;
int main()
{
    cin>>n>>k;
    for(int i=1;i<=n;i++)
	{
        if(ans>k) 
		ans+=k;
        else ans+=ans;
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<iostream>
#include<cstdio>
#define ll long long 
using namespace std;
char a1[2006811];
ll n,i,j,m,k,la,a[71720],b[71720],c[71720],d[71720],e[71720],f[71720],sum[71720],sumend,lsbl[71720];
int main()
{
    cin>>a1;
    la=strlen(a1);
    if(a1[0]==a1[la-1]&&!(la%2))
    {
        cout<<"First"<<endl;
        return 0;     
    }
    else if(a1[0]==a1[la-1]&&(la%2))
    {
        cout<<"Second"<<endl;
        return 0;
    }
    else if(a1[0]!=a1[la-1]&&!(la%2))
    {
        cout<<"Second"<<endl;
        return 0;
    }
    cout<<"First"<<endl;
    return 0;
}

Measured memory_bytes: 2304
#include<bits/stdc++.h>
using namespace std;
int main() {
    map<string,int> mp;
    mp["maerd"]=1;
    mp["remaerd"]=1;
    mp["esare"]=1;
    mp["resare"]=1;
    string s,s2;
    cin>>s;
    int len=s.length()-1;
    while(len>=0) {
        s2+=s[len];
        if(mp.count(s2))
            s2.clear();
        len--;
        if(s2.length()>7) break ;
    }
    if(s2.length()) cout<<"NO";
    else cout<<"YES";
}


Measured memory_bytes: 512
#include <iostream>
using namespace std;
int n,a,b,x,cnt;

int main()
{
    scanf("%d %d %d",&n,&a,&b);
    for(int i=0;i<n;i++)
    {
        scanf("%d",&x);
        if(x>=a && x<b) cnt++;
    }
    printf("%d\n",n-cnt);
    return 0;
}


Measured memory_bytes: 256
A=list(input())
B=list(input())
C=list(input())
temp = A.pop(0)
ans=''
while True:
  if temp=='a':
    if len(A)==0:
      print('A')
      exit()
    temp=A.pop(0)
  elif temp=='b':
    if len(B)==0:
      print('B')
      exit()
    temp=B.pop(0)
  elif temp=='c':
    if len(C)==0:
      print('C')
      exit()
    temp=C.pop(0)

Measured memory_bytes: 3064
# 点数計算
def scoring(last_, c, s, t, d, score):
    score = s[d][t]
    for i in range(len(c)):
        score -= c[i] * (d + 6 - last_[i])
    return score

# input
score = 0
D = int(input())
c = [int(i) for i in input().split()]
s = []
for i in range(D):
    s.append([int(i) for i in input().split()])
last = [[0 for i in range(len(c))] for j in range(D+1)] # last[d][i]

ans = []
for d in range(D):
    last_dummy = last[d][:]
    score = -float("inf")
    t_d = 0
    for t in range(len(c)):
        last_dummy2 = last_dummy[:]
        last_dummy2[t] = d+1
        if score < scoring(last_dummy2, c, s, t, d, score):
            score = scoring(last_dummy2, c, s, t, d, score)
            t_d = t
    ans.append(t_d)
    last[d][t_d] = d+1


    # last更新
    for i in range(len(c)):
        last[d+1][i] = last[d][i]


[print(ans[i]+1) for i in range(D)]





Measured memory_bytes: 9616
#include<bits/stdc++.h>
using namespace std;
#pragma region atcoder
#include <atcoder/segtree>
using namespace atcoder;
#pragma endregion
#pragma region macros
using ll = long long;
using vi = vector<int>;
using vs = vector<string>;
using vl = vector<ll>;
using vb = vector<bool>;
using vvi = vector<vector<int>>;
using vvl = vector<vector<ll>>;
#define rep(i, n) for(int i = 0; i < n; i++)
#define all(x) (x).begin(), (x).end()
#define sz(x) ((int)(x).size())
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; }
template<class T> T gcd(T a,T b){return b?gcd(b,a%b):a;}
template<class T> T lcm(T a,T b){return a / gcd(a, b) * b;}
#pragma endregion
#pragma region debug for var, v, vv
#define debug(var)  do{std::cout << #var << " : ";view(var);}while(0)
template<typename T> void view(T e){std::cout << e << std::endl;}
template<typename T> void view(const std::vector<T>& v){for(const auto& e : v){ std::cout << e << " "; } std::cout << std::endl;}
template<typename T> void view(const std::vector<std::vector<T> >& vv){cout << endl;int cnt = 0;for(const auto& v : vv){cout << cnt << "th : "; view(v); cnt++;} cout << endl;}
#pragma endregion
const ll mod = 1000000007;
const int inf = 1001001001;
const ll INF = 1001001001001001001;
const int MAX = 2000005;
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
int target;
int op(int a, int b){return max(a, b);}
int e(){return -1;}
bool f(int v){ return v < target;}

int main() {
	cin.tie(0);
   	ios::sync_with_stdio(false);
	int n, q; cin >> n >> q;
	vi a(n);
	for(int i = 0; i < n; i++) cin >> a[i];
	segtree<int, op, e> d(a);
	for(int i = 0; i < q; i++){
		int t; cin >> t;
		if(t == 1){
			int x, v; cin >> x >> v;
			x--;
			d.set(x, v);
		}
		if(t == 2){
			int l, r; cin >> l >> r;
			l--;
			cout << d.prod(l, r) << endl;
		}
		if(t == 3){
			int x; cin >> x >> target;
			x--;
			cout << d.max_right<f>(x) + 1 << endl;
		}
	}
} 


Measured memory_bytes: 6080
def 解():
    sS = input().rstrip()
    sT = input().rstrip()
    impo = "UNRESTORABLE"
    iS = len(sS)
    iT = len(sT)
    for i in range(iS-iT,-1,-1):
        bF = 1
        for j in range(iT):
            if sS[i+j] != "?" and sS[i+j] != sT[j]:
                bF = 0
                break
        if bF:
            sAns = (sS[0:i]+sT+sS[i+iT:]).replace("?","a")
            print(sAns)
            exit()
    print(impo)
解()


Measured memory_bytes: 3192
#include <bits/stdc++.h>
using namespace std;
using lint = long long int;
#define ARRAY_LENGTH(array) (sizeof(array) / sizeof(array[0]))
#define REP(i,n) for (lint i = 0; i < (n); i++)
#define REP1(i,n) for (lint i = 1; i < (n); i++)

lint a , b;

int main(void){
    cin >> a >> b;
    ((a <= 8) && (b <= 8)) ? cout << "Yay!" << endl : cout << ":(" << endl;
    return 0;
}

Measured memory_bytes: 256
A, B = map(int, input().split())
import math

for i in range(1, 10010):
    tmpa = int(math.floor(i * 0.08))
    tmpb = int(math.floor(i * 0.1))
    if A == tmpa and B == tmpb:
        print(i)
        exit()
print(-1)

Measured memory_bytes: 39408
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

func nextLine(sc *bufio.Scanner) string {
	sc.Scan()
	return sc.Text()
}

func main() {
	sum := 0
	sc := bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanWords)
	a, _ := strconv.Atoi(nextLine(sc))
	b, _ := strconv.Atoi(nextLine(sc))

	if a > b {
		sum += a + a - 1
	} else if a == b {
		sum += a + b
	} else {
		sum += b + b - 1
	}
	fmt.Println(sum)
}


Measured memory_bytes: 640
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		String kSt = scanner.nextLine();
		int k = Integer.parseInt(kSt);
		String s = "";
		String str = "";
		for(int i = 0; i < k; i++){
			s = scanner.nextLine();
			str = s.replace("Hoshino", "Hoshina");
			System.out.println(str);
		}
	}
}

Measured memory_bytes: 26096
import java.util.Scanner;

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

        int summer = 0;
        while (sc.hasNext()) {
            summer+=sc.nextInt();
        }
        int ans = n-summer;
        if (ans<0) {
            ans = -1;
        }
        System.out.println(ans);

    }
}


Measured memory_bytes: 47452
#include<stdio.h>
int main(void){
	double x;
	while(scanf("%lf",&x)!=EOF){
		if(x<=48.0) printf("light fly\n");
		else if(x<=51.0) printf("fly\n");
		else if(x<=54.0) printf("bantam\n");
		else if(x<=57.0) printf("feather\n");
		else if(x<=60.0) printf("light\n");
		else if(x<=64.0) printf("light welter\n");
		else if(x<=69.0) printf("welter\n");
		else if(x<=75.0) printf("light middle\n");
		else if(x<=81.0) printf("middle\n");
		else if(x<=91.0) printf("light heavy\n");
		else printf("heavy\n");
	}
	return 0;
}

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


int main() {
	ll n,i,j,k;
	cin>>n>>k;
	ll a[n+3];
	for(i=1;i<=n;i++)
	cin>>a[i];
	a[0]=0;
	sort(a,a+n+1);
	vector<vector<ll>>dp(k+2,vector<ll>(n+2,1));
	ll ans=1;
	ll mod=1000000007;
	for(i=1;i<=k;i++)
	{
	    for(j=1;j<=n;j++)
	    {
	        ll x=min(i,a[j]);
	        x++;
	        if(x>i)
	        ans=dp[i][j-1]%mod;
	        else
	        {
	            ans=dp[i][j-1]-dp[i-x][j-1]+mod;
	            ans%=mod;
	        }
	        dp[i][j]=dp[i-1][j]%mod+ans;
	        dp[i][j]%=mod;
	    }
	}
    cout<<ans;
	return 0;
}


Measured memory_bytes: 86688
using System;
using System.Linq;//リストの使用
using System.Collections.Generic;
using System.Text;//テキストの高速出力に必要
class Program
{
	static void Main()
	{
		int h = int.Parse(Console.ReadLine());
    int w = int.Parse(Console.ReadLine());
    int n = int.Parse(Console.ReadLine());
		int mod = Math.Max(h,w);

		Console.WriteLine((n+mod-1)/mod);
	}
}

Measured memory_bytes: 13140
#include<iostream>
using namespace std;
int main()
{
int n,u;
cin>>n;
u=n%10;
if(u==2||u==4||u==5||u==7||u==9)
{
cout<<"hon";
}
else if(u==0||u==1||u==6||u==8){
cout<<"pon";
}
else{
cout<<"bon";
}
return 0;
}


Measured memory_bytes: 3636
#include<bits/stdc++.h>
using namespace std;
long long read() { 
    bool flag = true; long long num = 0;char c = getchar(); 
    for(;c < '0' || c > '9';c = getchar())if(c == '-') flag = false; 
    for(;c >= '0' && c <= '9';c = getchar()) num = ( num << 3 ) + ( num << 1 ) + c - 48; 
    if(flag) return num;  else return -num; 
}
int main(){
	long long n,k;
	n = read();
	k=read();
	long long ans=0;
	if(k==0) {
		cout<<n*n;
		exit(0);
	}
	for(int i=k+1;i<=n;++i) { 
     long long a,b;
	 a=n/i;
	 b=n%i;
	 ans=ans+a*(i-k);
	 if(a*i+k<=n)
	  ans=ans+n-(a*i+k)+1;
	} 
	cout<<ans;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <string>
#include <vector>
#include <iterator>  // std::back_inserter()
#include <algorithm>  // std::copy()
#include <functional>  // std::greater<T>()
#include <utility>  // std::swap()
#include <numeric>  // accumulate(ALL(vec), 0)  0 は初期値
#include <cmath>
#include <climits>  // INT_MIN
#include <cctype>  // std::isdigit()
#include <ios>     // std::left, std::right
#include <iomanip> // std::setw(int), std::setfill(char)
using namespace std;

// typedef
typedef long long ll;
typedef unsigned long ul;
// #define int long long

// macro
#define ALL(obj) (obj).begin(), (obj).end()
#define REP(i, n) for (int i=0; i < (int)(n); i++)  // 0 ~ n-1
#define REPN(i, n) for (int i=1; i <= (int)(n); i++)  // 1 ~ n
#define DESCEND greater<int>()  // sort 降順 大きい順
#define UNIQUE(vec) (vec).erase(unique(ALL((vec))), (vec).end());  // 必ずsortを行なってから
#define MIN(vec) min_element(ALL((vec)))  // 値を取り出すときは * を先頭につける
#define MAX(vec) max_element(ALL((vec)))
#define IDX(vec, element_iter) distance((vec).begin(), element_iter)
#define SUM(vec) accumulate(ALL((vec)), 0)  // 0 は初期値
#define COPY(vec1, vec2) copy(ALL(vec1), back_inserter(vec2))  // vec1をvec2にコピーする vec2は空にしておく必要あり
#define zero_pad(num) setfill('0') << std::right << setw(num)  // 直後の要素をパディング
#define space_pad(num) setfill(' ') << std::right << setw(num)  // 直後の要素をパディング

// func declaration
template <class T> void print2DVec(vector< vector<T> >&);
template <class T> void calcVec(vector<T>&, int, char);
int char_to_int(const char);

// const
const int INF = 10000000;

/*MEMO
・辞書順
abc < abcd, atcoder < atlas
・イテレータ
std::vector<int>::iterator とタイプするのは面倒なので、
 通常は型推論の auto を使用する。
 auto iter = max_element(ALL(vec));
・2次元配列
vector<vector<int>> vec = {{1, 2, 3}, {4, 5, 6}}
・20×10の配列
vector<vector<int>> vec(20, vector<int>(10, 0));
・(n, m)の多次元配列
vector< vector<int> > vec(n, vector<int>(m, 0))  // 0で初期化
*/

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

    // input
    int a, b;
    cin >> a >> b;
    
    // calculation
    if (a*b % 2 == 0) {
        cout << "Even" << "\n";
    } else {
        cout << "Odd" << "\n";
    }
    
    
    return 0;
}


// function
template <class T> void print2DVec(vector< vector<T> >& vec) {
    REP(i, vec.size()) {
        REP(j, vec.front().size()) {
            cout << vec.at(i).at(j);
        }
        cout << endl;
    }
}

template <class T> void calcVec(vector<T> &vec, int num, char ch) {
    // vec全体への演算
    switch (ch) {
        case '+':
            REP(i, vec.size()) vec.at(i) += num; break;
        case '-':
            REP(i, vec.size()) vec.at(i) -= num; break;
        case '*':
            REP(i, vec.size()) vec.at(i) *= num; break;
        case '/':
            REP(i, vec.size()) vec.at(i) /= num; break;
        case '%':
            REP(i, vec.size()) vec.at(i) %= num; break;
        default:
            cout << "Incorrect Operator" << endl;
    }
}

int char_to_int(const char c) {
    if('0' <= c && c <= '9') return (c - '0');
    return -1;
}


Measured memory_bytes: 256
/******************************************************************************

Welcome to GDB Online.
GDB online is an online compiler and debugger tool for C, C++, Python, PHP, Ruby, 
C#, VB, Perl, Swift, Prolog, Javascript, Pascal, HTML, CSS, JS
Code, Compile, Run and Debug online from anywhere in world.

*******************************************************************************/
#include <bits/stdc++.h>
#define ll long long
using namespace std;

int main()
{
    ll n,k;
    cin>>n>>k;
    
    ll a[n];
    
    for(ll i=0;i<n;i++)
      cin>>a[i];
      
    sort(a,a+n);
    
    ll sum=0;
    for(ll i=0;i<k;i++)
       sum+=a[i];
       
     cout<<sum;  
    return 0;
}


Measured memory_bytes: 3640
#include<stdio.h>
#include<iostream>
#include<algorithm>
#include<math.h>
#include<string.h>
#include<queue>
#include<map>
using namespace std;
int a[100005],b[100005];
int x=0,n,k=0;
long long sum=0;
int main()
{
	scanf("%d",&n);
	for(int i=0;i<n;i++)
	{
		scanf("%d",&a[i]);
		if(a[i]<0)
		{
			x++;
		}
		b[k++]=abs(a[i]);
		sum+=abs(a[i]);
	}
	if(x%2==0)
		printf("%lld\n",sum);
	else
	{
		sort(b,b+k);
		printf("%lld\n",sum-2*b[0]);
	}
	return 0;
}

Measured memory_bytes: 4008
import math
n, k = map(int, input().split())
mod = 1000000007
m = math.ceil((n+1)/2)

def makeTable(n):
    fac = [n+1]
    
    for i in range(1, m):
        fac.append(fac[i-1]+(n-i)-i)
    return fac

def answer(fac):
    ans = 0
    for i in range(k-1, n):
        if (i < m):
            ans = ans + fac[i]
        else:
            ans = ans + fac[n-1-i]
    ans = ans + 1
    return ans

fac = makeTable(n)
print(answer(fac) % mod)

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

#define UN unsigned
#define ll long long
#define mod 1000000007
#define pii pair<int, int>
#define pb push_back

void solve(){
    int x, y;
    cin >> x  >> y;

    for(int i=0; i<=x; i++){
        int ans = i*2 + (x-i)*4;
        if(ans == y){
            cout << "Yes";
            return;
        }
    }
    cout << "No";
}

int main(void){
    ios::sync_with_stdio(0);
    cin.tie(nullptr);
    cout.tie(nullptr);
    cerr.tie(nullptr);
    solve();
    return 0;
}

Measured memory_bytes: 3648
#include <bits/stdc++.h>
using namespace std;
#define MOD 1000000007
#define ll long long
#define li long
#define pb push_back
#define mem(arr,x) memset(arr,x,sizeof(arr))

ll n,W;
ll w[101],v[101];
ll dp[101][100010];
ll totalV=0;

ll minWeight(ll end, ll Val)
{
  if(Val<=0)
  return 0;
  if(end==0)
  return INT_MAX;
  if(dp[end][Val]!=1000000010)
  return dp[end][Val];
  if(v[end-1]>Val)
  return dp[end][Val]=minWeight(end-1,Val);
  else
  return dp[end][Val]=min(w[end-1]+minWeight(end-1,Val-v[end-1]), minWeight(end-1,Val));
}

int main() 
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll i,j;
    cin>>n>>W;
    for(i=0;i<n;i++)
    {
      cin>>w[i]>>v[i];
      totalV+=v[i];
    }

    for(i=0;i<=n;i++)
      for(j=0;j<=totalV;j++)
        dp[i][j]=1000000010;

    for(i=totalV;i>=1;i--)
    {
      if(minWeight(n,i)<=W)
      break;
    }
    cout<<i;
    return 0;
}

Measured memory_bytes: 82404
#include <stdio.h>

int search(int,int,int[]);

int main(){
  int n,q,i,key,ans=0;
  int S[10000];

  scanf("%d",&n);
  for(i=0;i<n;i++)scanf("%d",&S[i]);
  
  scanf("%d",&q);
  for(i=0;i<q;i++){
    scanf("%d",&key);

    ans += search(key,n,S);
  
  }
  printf("%d\n",ans);
  

  return 0;
}

int search(int key,int n,int S[]){
  int i;
  
  for(i=0;i<n;i++){
    if(S[i] == key)return 1;
  }
  
  return 0;
}



Measured memory_bytes: 2108
#include<bits/stdc++.h>
using namespace std;
typedef long long LL;
int a[200005];
int b[200005];
int c[200005];
int dp[200005][3];
int n;
int f(int i,char prev){
    if(i==n) return 0;
    if(dp[i][prev-'A']!=-1) return dp[i][prev-'A'];
    if(prev=='A'){
        return dp[i][prev-'A'] = max(b[i]+f(i+1,'B'),c[i]+f(i+1,'C'));
    }else if(prev=='B'){
        return dp[i][prev-'A'] = max(a[i]+f(i+1,'A'),c[i]+f(i+1,'C'));
    }else{
        return dp[i][prev-'A'] = max(b[i]+f(i+1,'B'),a[i]+f(i+1,'A'));
    }
}
void solve(){
    int k;
   cin>>n;
   for(int i=0;i<n;i++){
       cin>>a[i]>>b[i]>>c[i];
       dp[i][0] = -1;
       dp[i][1] = -1;
       dp[i][2] = -1;
   }
   int ans1 = f(0,'A');
   int ans2 = f(0,'B');
   int ans3 = f(0,'C');
   cout<<max(max(ans1,ans2),ans3)<<endl;
}
int main(){
    int t;
    t = 1;
    while(t--) solve();
    return 0;
}

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

using namespace std;
typedef pair<int,int> pii;
typedef long long int ll;

#define INF 1 << 30
#define REP(i,n) for(ll i=0; i<(int)(n); i++)
#define FOR(i,k,n) for(ll i=(k);i<(int)(n);i++)



vector<bool> gen_sosuu(vector<bool> sosuu){
  int size = sosuu.size();
  REP(i,size){
    sosuu[i] = true;
  }
  sosuu[0] = false;
  sosuu[1] = false;
  sosuu[2] = true;
  FOR(i,2,sqrt(size)+1){
    if(sosuu[i] == false) continue;
    for(int j = 2; i*j<size;j++){
      sosuu[i*j] =false;
    }
  }
  return sosuu;
}

string s;
int k;
vector<string> vec;
int main(){
  cin >> s >> k;
  REP(i,s.size()){
    REP(j,k){
      if(i+j+1>s.size())break;
      vec.push_back(s.substr(i,j+1));
    }
  }
  sort(vec.begin(),vec.end());
  unique(vec.begin(),vec.end());
  cout << vec[k-1] << endl;
}


Measured memory_bytes: 1660
#include <iostream>
#include <queue>
#include <vector>
#include <bits/stdc++.h>
#include <string.h>
using namespace std;


int main() {
    ios::sync_with_stdio(false);
    cin.tie(NULL);
    int n;
    cin>>n;
    string res="";
    string acl="ACL";

    while(n--){
        res.append(acl);
    }
    cout<<res<<endl;
     return 0;
}


Measured memory_bytes: 3612
N,K = map(int,input().split())


P = 0
for i in range(1,N+1,1):
    count = 0
    I=i
    while(I<K):
        I*=2
        count +=1
    
    coin_n = count
    P += (0.5**coin_n)

P/= N
print(P)


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

def solve():
    S = input()
    ans = 0
    left = 0
    right = len(S)-1
    while left <= right:
        if S[left] != S[right]:
            ans += 1
        left += 1
        right -= 1
    print(ans)


if __name__ == "__main__":
    solve()


Measured memory_bytes: 2940
#include <bits/stdc++.h>
using namespace std;
map <int , long long> mp ;
vector <int> v;
int main()
{
int n ; cin >> n ;
for (int i = 0 ; i< n ; i++){
    int a ; cin >> a ;
    mp[a]++;
    v.push_back(a);
}
long long sum = 0 ;
for (auto it=mp.begin(); it!=mp.end(); ++it){
    sum += it->second*(it->second-1) / 2;
}
for (int i = 0 ; i < n ; i ++){
    int a= v[i];
    long long ans = sum - (mp[a]*(mp[a]-1))/2;
    ans += ((mp[a]-1)*(mp[a]-2))/2;
    cout << ans << endl ;
}
}


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

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

    vector<vector<int>> a(n);
    rep(i,0,n-1){
        int tmp;
        cin>>tmp;
        a.at(tmp-1).push_back(1);
    }

    rep(i,0,n){
        cout<<a.at(i).size()<<endl;
    }
}

Measured memory_bytes: 13900
import math
N, M = map(int, input().split())
if N>=2:
    n=math.factorial(N) // (math.factorial(N - 2) * math.factorial(2))
else:
    n=0
if M>=2:
    m=math.factorial(M) // (math.factorial(M - 2) * math.factorial(2))
else:
    m=0
print(n+m)

Measured memory_bytes: 3060
#include <bits/stdc++.h>
#define rep(i, a, b) for (int i = a; i < (b); i++)
#define rrep(i, a, b) for (int i = a; i >= (b); i--)
#define all(x) (x).begin(), (x).end()
using namespace std;
using ll = long long;
using P = pair<int, int>;
template <class T>
inline bool chmin(T& a, T b) {
   if (a > b) {
      a = b;
      return true;
   }
   return false;
}
template <class T>
inline bool chmax(T& a, T b) {
   if (a < b) {
      a = b;
      return true;
   }
   return false;
}
void hr() {
   cerr << "--------------" << endl;
}
const int INF = 1001001001;
const int MOD = 1000000007;
// const int MOD = 998244353;

vector<ll> enumDiv(ll n) {
   vector<ll> res;
   for (ll i = 1; i * i <= n; i++) {
      if (n % i != 0) continue;
      res.push_back(i);
      if (i * i != n) res.push_back(n / i);
   }
   return res;
}
int main() {
   cin.tie(0);
   ios_base::sync_with_stdio(0);

   ll n;
   cin >> n;
   int ans = 0;
   for (ll x : enumDiv(n)) {
      if (x == 1) continue;
      ll tmp = n;
      while (tmp % x == 0)
         tmp /= x;
      tmp %= x;
      if (tmp == 1) ans++;
   }
   ans += enumDiv(n - 1).size() - 1;
   cout << ans << endl;
   return 0;
}

Measured memory_bytes: 384
N, K = list(map(int, input().split()))
height = []
mindiv = 1000000000
for i in range(N):
    temp = int(input())
    height.append(temp)
height.sort()
for i in range(N - (K - 1)):
    if (height[i + K - 1] - height[i]) < mindiv:
        mindiv = height[i + K - 1] - height[i]

print(mindiv)

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

const int MAX_N = 1e5+2;
int N, M;
int A[MAX_N], B[MAX_N];
ll ans[MAX_N];
int par[MAX_N], sz[MAX_N];

int look(int x)
{
	if(par[x] == x) return x;
	else return par[x] = look(par[x]);
}

void comb(int x, int y)
{
	int a = look(x), b = look(y);
	if(a != b){
		par[a] = b;
		sz[b] += sz[a];
	}
}

void solve()
{
	for(int i=1;i<=N;++i){
		par[i] = i;
		sz[i] = 1;
	}
	ll cur = 1LL*N*(N-1)/2;
	for(int i=M-1;i>=0;--i){
		ans[i]=cur;
		if(look(A[i])!=look(B[i])){
			const ll n = 1LL*sz[par[A[i]]]*sz[par[B[i]]];
			cur -= n;
		}
		comb(A[i],B[i]);
	}	
	for(int i=0;i<M;++i) cout << ans[i] << '\n';
}

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

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

const int MAX_N = 1e6;
const int INF = 1e8;
int dp[MAX_N+1],dp2[MAX_N+1];

int main(){
  fill(dp,dp+MAX_N,INF);
  fill(dp2,dp2+MAX_N,INF);
  dp[0] = dp2[0] = 0;

  int n = 1, pil = 1;
  do{
    for(int i=0;i<=MAX_N-pil;i++){
      dp[i+pil] = min(dp[i+pil], dp[i] + 1);
    }
    if(pil % 2){
      for(int i=0;i<=MAX_N-pil;i++){
	dp2[i+pil] = min(dp2[i+pil], dp2[i] + 1);
      }
    }

    n++;
    pil = n*(n+1)*(n+2)/6;
  }while(pil<=MAX_N);

  while(cin >> n, n){
    cout << dp[n] << " " << dp2[n] << endl;
  }
}

Measured memory_bytes: 8972
#include<stdio.h>
#define N 100
int main()
{
    int a,i,j,tmp,minj,cnt = 0;
    int A[N];

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

    for(i = 0 ; i < a - 1 ; i++){
        minj = i;
        for(j = i+1 ; j < a ; j++){
            if(A[j] < A[minj])
            minj = j;
        }
        if(i != minj){
        tmp = A[i];
        A[i] = A[minj];
        A[minj] = tmp;
        cnt++;
        }
    }

    for(i = 0 ; i < a ; i++){
        printf("%d",A[i]);
        if(i < a - 1)printf(" ");
    }
    printf("\n%d\n",cnt);
    return 0;
}



Measured memory_bytes: 2108
#include<cstdio>
#include<functional>
#include<algorithm>
using namespace std;
int main(void)
{
	int a[3],b[2],i,x;
	for(i=0;i<3;i++){
		scanf("%d",&a[i]);
	}
	for(i=0;i<2;i++){
		scanf("%d",&b[i]);
	}
	sort(a,a+3);
	sort(b,b+2);
	x=a[0]+b[0]-50;
	printf("%d\n",x);
	return 0;
}

Measured memory_bytes: 1036
#include<stdio.h>                                                                      
int i,j,left,right,mid,c=0;                                                            
int binarysearch(int t,int S[],int n)
{
   left=0;//左端
   right=n;//右端
  while(left < right){
    mid = (left + right) / 2;
    if(S[mid]==t){
      c++;
      break;
    }
    else if(t<S[mid])
      right=mid;
    else
      left = mid + 1;
  }
  return 0;
}
int main()
{
  int n,q;
  scanf("%d",&n);
  int S[n];
  for(i=0; i<n; i++)
    scanf("%d",&S[i]);
  scanf("%d",&q);
  int T[q];
  for(i=0; i<q; i++){
    scanf("%d",&T[i]);
    binarysearch(T[i],S,n);
  }
  printf("%d\n",c);
  return 0;
}
                                                                                                                                                                                                                                                                     



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

int main(){
 int sx,sy,tx,ty;
 cin >> sx >> sy >> tx >> ty;

 const int dx=tx-sx,dy=ty-sy;

 // Path 1
 cout << string(dy,'U') << string(dx,'R');

// Path 2
 cout << string(dy,'D') << string(dx,'L');

 // Path 3
 cout << 'L' << string(dy+1,'U') << string(dx+1,'R') << 'D';

 // Path 4
 cout << 'R' << string(dy+1,'D') << string(dx+1,'L') << 'U';

 // EndLine
    cout << endl;
    return 0;
}

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

int main() {
	ll n,m; cin>>n>>m;
	vector<vector<ll>> cakes(n,vector<ll>(3,0));
	for (ll i=0; i<n; i++) {
		ll x,y,z; cin>>x>>y>>z;
		cakes[i][0] = x;
		cakes[i][1] = y;
		cakes[i][2] = z;
	}

	ll ans=-1;
	for (ll i=0; i<8; i++) {
		//bitmask add or subtract
		vector<ll> eval(n);
		for (ll j=0; j<n; j++) {
			for (ll k=0; k<3; k++) {
				if (1<<k & i) eval[j]+=cakes[j][k];
				else eval[j]-=cakes[j][k];
			}
		}

		sort(eval.begin(),eval.end(),greater<ll>());
		ll temp=0;
		for (ll j=0; j<m; j++) temp+=eval[j];

		ans = max(ans,temp);
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define INFTY 1<<20
typedef long long int ll;
const int MOD=1000000007;
using Graph = vector<vector<int>>;
#define rep(i,n) for (int i = 0; i < (n); ++i)

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

int main(){
  int n;cin>>n;
  vector<int> dif(n);
  rep(i,n){
    cin>>dif[i];
  }
  sort(dif.begin(),dif.end());
  int l,r;
  l = dif[n/2-1];r=dif[n/2];
  cout<<r-l<<endl;
  return 0;

}

Measured memory_bytes: 640
#coding: utf-8


def judge(str):
    for i, x in enumerate(str):
        for j, v in enumerate(str):
            if (i != j) and x == v:
                return 'no'
    return 'yes'

str = input()

if len(str) < 1 or len(str) > 27:
    print ('error')

print (judge(str))


Measured memory_bytes: 2940
// turmak-_-
#include<bits/stdc++.h>

#define all(v) v.begin(),v.end()
#define nl "\n"
#define IOI return 0;
#define pb push_back
#define ll long long
#define ld long double
#define IOS ios_base :: sync_with_stdio(NULL); cin.tie(0); cout.tie(0);
#define pii pair<int,int>
#define X first
#define Y second

using namespace std;
const int N = (int)2e5 + 7 ;
const int MOD = (int)1e9 + 7;
const int INF = (int)1e9 + 7;
const int UNDEF = -1;

pii dx[] = {{1, 0}, {-1, 0}, {0, 1}, {0, -1}};

double p[3001];
double dp[3001];
int main() {
    IOS
    //freopen("lepus.in", "r", stdin);
    //freopen("lepus.out", "w", stdout);
    int n;
    cin>>n;
    for(int i=1; i<=n; ++i) cin>>p[i];
    dp[0]=1.0;
    for(int i=1; i<=n; ++i) {
        for(int j=i; j>=0; --j) {
            dp[j]=dp[j-1]*p[i]+dp[j]*(1.0-p[i]);
        }
    }
    double ans = 0.0;
    for(int i=0; i<=n; ++i) {
        if(i>n-i) {
            ans+=dp[i];
        }
    }
    cout<<setprecision(9)<<fixed<<ans;
    IOI
}


Measured memory_bytes: 3864
s = list(map(str, input().rstrip()))
t = list(map(str, input().rstrip()))

ans = []
for i in range(len(s) - len(t) + 1):
    tmp = []
    for j in range(len(t)):
        if s[i:][j] == t[j] or s[i + j] == "?":
            tmp.append(True)
        else:
            tmp.append(False)
    if all(tmp):
        tmp_l = [x.replace("?", "a") for x in s[:i]]
        tmp_r = [x.replace("?", "a") for x in s[i + j + 1:]]
        ans.append(tmp_l + t + tmp_r)

if len(ans) == 0:
    print("UNRESTORABLE")
else:
    ans = ["".join(x) for x in ans]
    ans.sort()
    print(ans[0])

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

int main() {
  int M, D;
  cin >> M >> D;
  int count = 0;
  for(int m=1; m<=M; m++){
  	for(int day=22; day<=D; day++){
      int d1, d10;
      d1 = day%10;
      d10 = day/10;
      if((d1>1 && d10>1) && m==d1*d10){
        //cout << m << " " << d10 << " " << d1 << endl;
        count++;
      }
    }
  }
  
  cout << count << endl;
  
  return 0;
}


Measured memory_bytes: 256
/*
 * ITP1_6_B.cpp
 *
 *  Created on: Apr 20, 2018
 *      Author: 13743
 */

#include<iostream>
#include<cmath>

using namespace std;


int main() {
	int n;
	cin >> n;
	int lower;
	int maxR = -1000000000;
	cin >> lower;
	for(int i=1; i<n; i++) {
		int r;
		cin >> r;
		maxR = max(r - lower, maxR);
		lower = min(r, lower);
	}
	cout << maxR << endl;
}



Measured memory_bytes: 3096
import collections
S = int(input())
def prime_factorize(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a

l = prime_factorize(S)
x = collections.Counter(l)
X = list(x.values())

y = len(X)
ans = 0
for i in range(y):
    if 1 <=X[i] <= 2:
        ans +=1
    elif 3 <= X[i] <=5 :
        ans += 2
    elif 6<= X[i] <=9:
        ans +=3
    elif 10<= X[i] <=14:
        ans +=4
    elif 15<= X[i] <= 20:
        ans +=5
    elif 21 <= X[i] <= 27:
        ans +=6
    elif 28 <= X[i] <=35:
        ans +=7
    elif 36 <= X[i] <= 44:
        ans +=8
print(ans)

Measured memory_bytes: 9472
#pragma GCC optimize("O2")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("avx,avx2,sse,sse2,fma,tune=native")
#include<bits/stdc++.h>
#define rall(x) x.rbegin(), x.rend()
#define all(x) x.begin(), x.end()
#define pb push_back
#include <x86intrin.h>
#define pb push_back
using namespace std;
using ll = long long;
using pi = pair<int, int>;
using vi = vector<ll>;
using vpi = vector<pi>;
using ld = long double;
const int maxn = 1e5 + 55, mod = 1e9 + 7;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

int main() {
	ios::sync_with_stdio(0);
	cin.tie(0);
	int n;
	cin >> n;
	cout << n*1ll*(n-1)/2;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
	long long r,D,x2000;
	cin>>r>>D>>x2000;
	long long tmpres=x2000;
	for(int i=0;i<10;i++){
		tmpres = r * tmpres - D;
		cout<<tmpres<<'\n';
	}
	return 0;
}

Measured memory_bytes: 256
#include<cstdio>
#include<iostream>

using namespace std;

int main()
{
	int a[3]={1,0,0};
	char cha1,cha2,buf;
	int i,j,t;

	while(scanf("%c,%c%c",&cha1,&cha2,&buf)!=EOF){
		i=cha1-'A';
		j=cha2-'A';
		t=a[i];
		a[i]=a[j];
		a[j]=t;
	}

	for(i=0;i<3;i++)
		if(a[i]==1){
			printf("%c\n",i+'A');
		}
	return 0;
}

Measured memory_bytes: 1140
#include <bits/stdc++.h>
using namespace std;
typedef unsigned long long int ull;
typedef long long int ll;
#define LONGMAX 1e18
#define MOD 1000000007
#define mp make_pair
#define endl "\n"
#define test() ull t;cin>>t;while(t--)
#define pb push_back
#define fr(a,n) for(int i=a;i<n;i++)

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

	int h,w;
	cin>>h>>w;

	char maze[h][w];

	for(int i=0;i<h;i++)
	{
		for(int j=0;j<w;j++)
			cin>>maze[i][j];
	}

	ll dp[h][w];

	// dp[0][0]=0;
	// memset(dp,0,h*w);
	for( int i=0;i<h;i++)
	{
		for(int j=0;j<w;j++)
		{
			dp[i][j]=0;
		}
		// cout<<endl;
	}
	dp[0][0]=1;
	for( int i=0;i<h;i++)
	{
		for(int j=0;j<w;j++)
		{
			if((i-1)>=0 and maze[i-1][j]=='.')
				dp[i][j]=(dp[i][j]+dp[i-1][j])%MOD;
			if((j-1)>=0 and maze[i][j-1]=='.')
				dp[i][j]=(dp[i][j]+dp[i][j-1])%MOD;
		}
	}

	cout<<dp[h-1][w-1]<<endl;
}



Measured memory_bytes: 9088
from math import ceil
from collections import deque
N, D, A = map(int, input().split())
Monsters = sorted([list(map(int, input().split())) for i in range(N)])
Monsters = [[x, ceil(h / A)] for x, h in Monsters]


acc_damage = 0
que = deque([])

ans = 0
for x, h in Monsters:
    # 期限切れの蓄積ダメージを削除
    while que and x > que[0][0]:
        limit, damage = que.popleft()
        acc_damage -= damage

    need = max(0, h - acc_damage)
    ans += need
    acc_damage += need

    if need:
        que.append([x + 2 * D, need])

print(ans)


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

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

    int r;
    cin>>r;
    cout << r * r << endl;
}

Measured memory_bytes: 256
# include <iostream>
# include <algorithm>
# include <vector>
# include <string>
# include <set>
# include <map>
# include <cmath>
# include <iomanip>
# include <functional>
# include <utility>
# include <stack>
# include <queue>
# include <list>
constexpr int MOD = 1000000000 + 7;
constexpr int INF = 2000000000;
using namespace std;

int main() {
	int n;
	cin >> n;
	long long a[51];
	long long maxl = 0;
	for (int i = 0; i < n; i++) {
		cin >> a[i];
		maxl = max(maxl, a[i]);
	}
	long long ans = 0;
	bool update = true;
	while (update) {
		update = false;
		for (int i = 0; i < n; i++) {
			if (a[i] >= n) {
				update = true;
				long long num = ((a[i] - (n - 1)) + n - 1) / n;
				a[i] -= num*n;
				for (int j = 0; j < n; j++) {
					if (i != j)a[j] += num;
				}
				ans += num;
			}
		}
	}
	cout << ans << endl;
}

Measured memory_bytes: 256
s = input()

if s[0] != 'A' or s[1]<'a':
  print('WA')
else:
  tmp=0
  for i in range(2,len(s)-1):
    if s[i]<'a':
      tmp+=1
      if s[i] != 'C' or tmp==2:
        print('WA')
        exit()
  if tmp!=1:
    print('WA')
    exit()
  if s[-1] <'a':
    print('WA')
    exit()
  print('AC')
        



Measured memory_bytes: 3060
#include <iostream>
using namespace std;
using ll = unsigned long long;

int main() {
  const int mmax = 200000;
  int M;
  ll d[mmax];
  ll c[mmax];
  ll digits = 0;
  ll sum = 0;

  cin >> M;

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

  for (int i = 0; i < M; i++) {
    digits += c[i];
    sum += d[i] * c[i];
  }

  cout << digits - 1 + (sum - 1) / 9 << endl;
}


Measured memory_bytes: 3328
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.*;
import java.util.stream.Collectors;

public class Main {
    public static void main(String[] args) {
        Main main = new Main();
        main.solve();
    }

    public void solve() {
        Scanner scan = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
        int N = scan.nextInt();
        List<Integer> candidate = new ArrayList<>();
        for (int i = 1; i <= N; i++) {
            candidate.add(i);
        }
        scan.nextLine();
        String p = scan.nextLine();
        String q = scan.nextLine();
        List<List<Integer>> list = make(candidate);
        List<String> strings = new ArrayList();
        for (List<Integer> x : list) {
            strings.add(x.stream().map(i -> i.toString()).collect(Collectors.joining(" ")));
        }
        int len = strings.size();
        int l = 0;
        int r = 0;
        for (int i = 0; i < len; i++) {
            if (p.equals(strings.get(i))) {
                l = i;
            }
            if (q.equals(strings.get(i))) {
                r = i;
            }
        }
        System.out.println(Math.abs(l - r));
    }

    public static List<List<Integer>> make(List<Integer> candidate) {
        if (candidate.size() == 0) {
            List<List<Integer>> empty = new ArrayList<>();
            empty.add(new ArrayList<>());
            return empty;
        }

        return candidate.stream().flatMap(i -> {
            List<Integer> rest = new ArrayList<>(candidate);
            rest.remove(i);
            return make(rest).stream().map(list -> {
                list.add(0, i);
                return list;
            });
        }).collect(Collectors.toList());
    }
}


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

using namespace std;
int main(){
    int T;
    cin>>T;
    double sum;
    for(int i = 0;i < T;i++){
        double k;
        cin>>k;
        sum += 1.0/k;
    }
    printf("%lf",1.0/sum);
    return 0;
}

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

using namespace std;

const int N = 401;

long long dp[N][N];
long long pref[N];
int n;
int arr[N];

long long rec(int l, int r) {
  if(l == r) return 0;
  long long& lr = dp[l][r];
  if(lr != -1) return lr;
  lr = LLONG_MAX;
  for(int k = l; k < r; ++k) {
    long long op1 = rec(l, k);
    long long op2 = rec(k + 1, r);
    lr = min(lr, op1 + op2 + pref[r] - pref[l - 1]);
  }
  return lr;
}

int main(){
  ios_base::sync_with_stdio(false);
  cin.tie(NULL); cout.tie(NULL);
  memset(dp, -1, sizeof dp);
  cin >> n;
  for(int i = 1; i <= n; ++i) {
    cin >> arr[i];
    pref[i] = pref[i - 1] + arr[i];
  }
  cout << rec(1, n) << "\n";
}

Measured memory_bytes: 1536
from collections import defaultdict
from collections import deque
n, m = map(int, input().split())
g = defaultdict(list)
for i in range(m):
    u, v = map(int, input().split())
    g[u].append(v)
    g[v].append(u)

c = 0
a = []
visited = set()
for i in range(1, n+1):
    if i in visited: continue
    c += 1
    visited.add(i)
    q =  deque([i])
    nos = 0
    while q:
        u = q.popleft()
        nos += 1
        for v in g[u]:
            if v in visited: continue
            visited.add(v)
            q.append(v)
    a.append(nos)

a.sort(reverse=True)
s = 0
for i in range(len(a)-1):
    s += a[i]-a[i+1]
print(s+a[-1])



Measured memory_bytes: 155628
#include <iostream>
#include <cmath>
using namespace std;
int main(){
    int R , G , B , K;
    cin >> R >> G >> B >> K;
    int total = 0;
    if (G <= R){
        int must = ceil(log2(double(R + 1) / G));
        total += must;
        G = G * (1 << must);
    }
    if (B <= G){
        int must = ceil(log2(double(G + 1) / B));
        total += must;
    }
    cout << (total <= K ? "Yes\n" : "No\n");
}


Measured memory_bytes: 3868
x = int(input())

if 400<=x<=599:
    print(8)
elif 600<=x<=799:
    print(7)
elif 800<=x<=999:
    print(6)
elif 1000<=x<=1199:
    print(5)
elif 1200<=x<=1399:
    print(4)
elif 1400<=x<=1599:
    print(3)
elif 1600<=x<=1799:
    print(2)
elif 1800<=x<=1999:
    print(1)


Measured memory_bytes: 9176
N=int(input())
A=list(map(int,input().split()))
def main(now,A,ans):
    for i in range(1,N):
        if now<0 and now+A[i]<=0:
            ans+=abs(now)-A[i]+1
            now=1
        elif now>0 and now+A[i]>=0:
            ans+=now+A[i]+1
            now=-1
        else:
            now+=A[i]
    return ans
z=float('inf')
x=main(A[0],A,0)
if A[0]>0:
    now=-1
    ans=A[0]+1
elif A[0]<0:
    now=1
    ans=abs(A[0])+1
elif A[0]==0:
    z=main(-1,A,1)
    now=1
    ans=1
y=main(now,A,ans)
print(min(x,y,z))

Measured memory_bytes: 14468
//mokoちゃん解
#include <bits/stdc++.h>
#include <stdio.h>
using namespace std;
 
#define INF 2147483647
#define LINF 9223372036854775807
#define FOR(i,a,b) for (int i = (a); i < (b); ++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(), (v).end()
 
typedef long long ll;
typedef pair<ll, int> P;
 
int n;
ll a[300000];
priority_queue<ll,vector<ll>,greater<ll> > mi;
priority_queue<ll> ma;
ll front[300000],back[300000];
ll sf,sb,ans=-LINF;
 
int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
 
	cin>>n;
	REP(i,3*n) {
		cin>>a[i];
		if(i<n) {
			mi.push(a[i]);
			sf+=a[i];
		}
		if(i>=2*n) {
			ma.push(a[i]);
			sb+=a[i];
		}
	}
	front[n-1]=sf;
	FOR(i,n,2*n) {
		mi.push(a[i]);
		sf+=(a[i]-mi.top());
		mi.pop();
		front[i]=sf;
	}
	back[2*n-1]=sb;
	for(int i=2*n-2;i>=n-1;i--) {
		ma.push(a[i+1]);
		sb+=(a[i+1]-ma.top());
		ma.pop();
		back[i]=sb;
		ans=max(ans,front[i]-back[i]);
	}
 //-----
		ans=max(ans,front[2*n-1]-back[2*n-1]);
//-------
	cout<<ans<<endl;
 
	return 0;
}

Measured memory_bytes: 7796