akhauriyash/Code-Regression huggingface dataset:
/**
*
* Author: Mouhanad
* Lang: GNU C++14
*
**/
#include<bits/stdc++.h>
using namespace std;

#define F first
#define S second
#define ii pair < int , int >
#define LS pair < ll , string >
typedef long long ll;
const int inf = 1<<30;
const int N =100100;
int n ;
char s[N];
vector<pair<int, int> > v;
int main() {
	scanf("%s", s);
		n = strlen(s);
		int pos = 1;
		if(s[n-1]=='1' || s[0]=='0'){pos=0;}
		int q = 0;
		for(int i=0; i<n/2; i++){
			if(s[i]!=s[n-2-i]){pos=0;}
			if(s[i]=='1'){q++;}
		}
		if(pos==0){
			printf("-1\n");
			return 0;
		}
		int edg = n-1;
		for(int i=0; i<q; i++){
			v.push_back({i, i+1});
			edg--;
		}
		int vert = q + 1, last = 0;
		for(int i=0; i<n/2; i++){
			if(s[i]=='0'){
				v.push_back({last, vert++});
				edg--;
			}
			else{
				last++;
			}
		}
		for(int i=0; i<edg; i++){
			v.push_back({q, vert++});
		}
		for(int i=0; i<n-1; i++){
			printf("%d %d\n", v[i].first+1, v[i].second+1);
		}
	return 0;
}


Measured memory_bytes: 2420
num = int(input())
a = list(map(int, input().split()))
b = 0
for i in a:
  if i % 2 != 1 and i % 3 != 0 and i % 5 != 0:
    b += 1
if b != 0:
  print("DENIED")
else:
  print("APPROVED")

Measured memory_bytes: 2940
N,Q=map(int,input().split())
S=str(input())
p=[0]
count=0
for j in range(1,N):
    if S[j-1:j+1]=='AC':
        count += 1
    p.append(count)        


for i in range(Q):
    L,R=map(int,input().split())
    print(p[R-1]-p[L-1])
    

    


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

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

    if (n == 0)
    {
        cout << x << endl;
        return 0;
    }

    vector<bool> ok(102, true);
    rep (i, n)
    {
        int p;
        cin >> p;
        ok[p] = false;
    }

    int ans = x;
    if (ok[ans])
    {
        cout << ans << endl;
        return 0;
    }

    int dif = 0;
    while (1)
    {
        ++dif;
        if (ok[ans - dif])
        {
            cout << ans - dif << endl;
            return 0;
        }
        if (ok[ans + dif])
        {
            cout << ans + dif << endl;
            return 0;
        }
    }

    return 0;
}

Measured memory_bytes: 3612
#include "bits/stdc++.h"
 
using namespace std;
 
#define sp(x) cout<<setprecision(x);
#define all(a) (a).begin(), (a).end()
#define inf 10000000
#define linf INT64_MAX*0.99
#define int long long
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n) FOR(i,0,n)
#define yes "Yes"
#define no "No"
#define divs 1000000007
#define dive 1000000009
#define pi 3.141592653589793238
 
typedef pair<int, int> P;
 
 
signed main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << fixed << setprecision(10);
    cerr << fixed << setprecision(10);
    long long N;
    scanf("%lld",&N);
    long long M;
    scanf("%lld",&M);
    std::vector<long long> A(M);
    int wa=0;
    for(int i = 0 ; i < M ; i++){
        scanf("%lld",&A[i]);
        wa+=A[i];
    }
    if(wa>N) cout<<-1<<endl;
    else cout<<N-wa<<endl;
    return 0;
}


Measured memory_bytes: 3800
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define INF 2e9
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
typedef vector<ll> vll;
typedef vector<vll> vvll;

ll get_distance(pair<ll, ll>& point1, pair<ll, ll>& point2) {
    return abs(point1.first - point2.first) + abs(point1.second - point2.second);
}
int main()
{
    ll n, m;
    cin >> n >> m;
    vector<pair<ll, ll>> positions(n);
    REP(i, n) {
        ll a, b;
        cin >> a >> b;
        positions.at(i) = make_pair(a, b);
    }
    vector<pair<ll, ll>> flags(m);
    REP(i, m) {
        ll c, d;
        cin >> c >> d;
        flags.at(i) = make_pair(c, d);
    }
    
    REP(i, n) {
        ll shortest_distance = pow(10, 16);
        ll index = 0;
        REP(j, m) {
            ll distance = get_distance(positions.at(i), flags.at(j));
            if (distance < shortest_distance) {
                shortest_distance = distance;
                index = j+1;
            }
        }
        cout << index << endl;
    }
    return 0;
}

Measured memory_bytes: 256
import sys
mod = 998244353
sys.setrecursionlimit(pow(10, 8))

def power(x, y):
    if   y == 0: return 1
    elif y == 1	 : return x % mod
    elif y % 2 == 0 : return power(x, y//2)**2 % mod
    else: return power(x, (y-1)//2)**2 * x % mod
    
def mul(a, b):
    return ((a % mod) * (b % mod)) % mod

def div(a, b):
    return mul(a, power(b, mod-2))
def div2(a, b):
    return mul(a, modinv(b))

def modinv(a):
    b, u, v = mod, 1, 0
    while b:
        t = a//b
        a, u = a-t*b, u-t*v
        a, b, u, v = b, a, v, u
    u %= mod
    return u

def cmb(n, r):
    if ( r<0 or r>n ):
        return 0
    r = min(r, n-r)
    return g1[n] * g2[r] * g2[n-r]

NNN = (10**6)
g1 = [1, 1]
g2 = [1, 1]
inverse = [0, 1]

for i in range( 2, NNN + 1 ):
    g1.append( ( g1[-1] * i ) % mod )
    inverse.append( ( -inverse[mod % i] * (mod//i) ) % mod )
    g2.append( (g2[-1] * inverse[-1]) % mod )

N, M, K = map(int, input().split())
r = 0
for i in range(K+1):
    r += (cmb(N-1, i) * M * pow(M-1, N-i-1, mod)) % mod
    r %= mod
print(r)


Measured memory_bytes: 165668
#include <iostream>
using namespace	std;
int main(){
  int a,b,c,d,e,f;
  cin>>a>>b>>c>>d>>e>>f;
  c+=b*100;
  f+=e*100;
  if(a<d) cout<<(f>c?d-a+1:d-a)<<endl;
  else if(a>d) cout<<(f<c?a-d+1:a-d)<<endl;
  else cout<<(f==c?0:1)<<endl;
  return 0;
}


Measured memory_bytes: 3092
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;

typedef long long ll;
typedef pair<int,int> ii;
typedef tree<ii,null_type,less<ii>,rb_tree_tag,tree_order_statistics_node_update> indexed_set;

int main() {
	cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(0);
	int A,V,B,W,T; cin>>A>>V>>B>>W>>T;
	if(V<=W) {
		cout<<"NO\n";
		return 0;
	}
	ll U=V-W, D=abs(A-B);
	cout<<(U*T>=D ? "YES" : "NO")<<"\n";
	return 0;
}

Measured memory_bytes: 3640
"use strict";

function Main(input) {
  let x = Math.ceil(input/1.08);
  let x2 = Math.floor(x*1.08);
  if(input == x2){
    console.log(Math.ceil(x));
  } else {
    console.log(":(");
  }
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));


Measured memory_bytes: 21064
#include<bits/stdc++.h>
using namespace std;
int main(){
  int X,Y,Z;
  cin>>X>>Y>>Z;
  int h=Y+Z;
  if(X%h<Z){
    cout<<X/h-1<<endl;
  }
  else{
    cout<<X/h<<endl;
  }
}


Measured memory_bytes: 256
import heapq

H, W = map(lambda x: int(x)+4, input().split())
Ch, Cw = map(int, input().split())
Dh, Dw = map(int, input().split())

grid = '#' * W * 2
for _ in range(H-4):
  grid += '##' + input() + '##'
grid += '#' * W * 2

move_list = []
for i in range(5):
  for j in range(5):
    if (i, j) == (2, 2):
      continue
    elif (i, j) == (1, 2) or (i, j) == (2, 1) or (i, j) == (2, 3) or (i, j) == (3, 2):
      move_list.append((0, i-2 + W*(j-2)))
    else:
      move_list.append((1, i-2 + W*(j-2)))

def dijkstra(s):
  hq = [(0, s)]
  heapq.heapify(hq)
  cost = [float("inf")] * (H*W)
  cost[s] = 0
  while hq:
    c, v = heapq.heappop(hq)
    if c > cost[v]:
      continue
    for dc, dv in move_list:
      w = v + dv
      tmp = cost[v] + dc
      if grid[w] == "#":
        continue
      if tmp < cost[w]:
        cost[w] = tmp
        heapq.heappush(hq, (tmp, w))
  return cost

ans = dijkstra( (Ch+1)*W + Cw+1 )[(Dh+1)*W + Dw+1]

if ans == float("inf"):
  print(-1)
else:
  print(ans)

Measured memory_bytes: 167356
#include<iostream>
#include<string>
using namespace std;
int main(){
long i,j,k;
string s,c[8]={"black","blue","lime","aqua","red","fuchsia","yellow","white"};
while(cin>>s){
if(s=="0")break;
k=0;
i=s[1]-48;if(s[1]>64)i-=39;
j=s[2]-48;if(s[2]>64)j-=39;
if(i*16+j>=128)k+=4;
i=s[3]-48;if(s[3]>64)i-=39;
j=s[4]-48;if(s[4]>64)j-=39;
if(i*16+j>=128)k+=2;
i=s[5]-48;if(s[5]>64)i-=39;
j=s[6]-48;if(s[6]>64)j-=39;
if(i*16+j>=128)k++;
cout<<c[k]<<endl;
}
return 0;
}

Measured memory_bytes: 1192
import itertools

a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())

input = [a, b, c, d, e]

dec = [n % 10 for n in input]
pair = zip(dec, input)
min_val = 999
for num in dec:
  if num != 0 and min_val > num:
    min_val = num

sum = 0
min_flag = False
for d, n in pair:
  if not min_flag and d == min_val:
    min_flag = True
    sum += n
  elif d == 0:
    sum += n
  else:
    sum += (n + (10 - d))
      
print(sum)        

Measured memory_bytes: 3064
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>

#define ll long long
#define ull unsigned long long

using namespace std;

int main() {
	int R, G, B, N;
	cin >> R >> G >> B >> N;

	int ans = 0;
	for (int ii = 0; ii <= N/R; ++ii){
		int val1 = ii*R;
		for (int jj = 0; jj <= N/G; ++jj){
			int val2 = jj*G;
			if (val1 + val2 > N){
				break;
			}

			int rem = N - val1 - val2;
			if (rem % B == 0){
				ans++;
			}
		}
	}

	cout << ans << "\n";		

	return 0;
}


Measured memory_bytes: 3640
N = int(input())
S = input()

r = S.count('R')
g = S.count('G')
b = S.count('B')

ans = r*g*b

for i in range(N):
    for d in range(N):
        j = i+d
        k = i+2*d
        if k > N-1:
            break
        if S[i] != S[j] and S[j] != S[k] and S[k] != S[i]:
            ans -= 1
            
print(ans)

Measured memory_bytes: 9156
// Author: HarshKumar

#include <bits/stdc++.h>
using namespace std;
#define ll int64_t
const ll N = 1e6 + 6, M = 1e9 + 7;
int main()
{
    ios::sync_with_stdio(false), cin.tie(nullptr);
    ll n;
    cin >> n;
    while (n--)
        cout << "ACL";
}

Measured memory_bytes: 3648
#include<iostream>
#include<iomanip>
#include<cassert>
#include<math.h>
#include<complex>
#include<algorithm>
#include<utility>
#include<queue>
#include<string.h>
#include<string>
#include<set>
#include<map>
#include<unordered_map>
#include<functional>
#include<vector>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
const ll INF=2e18;
const ll MOD=1e9+7;

int main(){
    for(ll i=0;i<5;i++){
        ll x;
        cin>>x;
        if(x==0){
            cout<<i+1<<endl;
            return 0;
        }
    }

    return 0;
}

Measured memory_bytes: 3588
#include <bits/stdc++.h>
using namespace std;
int main()
{
	long int n;
	cin>>n;
	long int x=0,i,a[n];
	for(i=0;i<n;i++)
	{
		cin>>a[i];		
	}

	
	
for(int j=0;;j++)
{
	
	
	for(i=0;i<n;i++)
	{

		if(a[i]%2!=0)
		{
			cout<<x<<endl;
			return 0;
		}
		a[i]=a[i]/2;
	}
	x++;

}
}


Measured memory_bytes: 3528
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		while(sc.hasNext()) {
			int count=0;
			int n=sc.nextInt();
			for(int a=0;a<=9;a++) {
				for(int b=0;b<=9;b++) {
					for(int c=0;c<=9;c++) {
						for(int d=0;d<=9;d++) {
							if(a+b+c+d==n) {
								count++;
							}
						}
					}
				}
			}
			System.out.printf("%d\n",count);
		}
	}
}




Measured memory_bytes: 27036
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long; 
using pii =  pair<int, int>;
using pll =  pair<long long, long long>;
#define rep(i, n) for(int i = 0; i < (n); ++i)
#define all(x) (x).begin(),(x).end()
constexpr char ln =  '\n';
constexpr long long MOD = 1000000007LL;
//constexpr long long MOD = 998244353LL;
template<class T, class U> inline bool chmax(T &a, U b) { if (a < b) { a = b; return true;} return false; }
template<class T, class U> inline bool chmin(T &a, U b) { if (a > b) { a = b; return true;} return false; }
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
int main() {
    ios::sync_with_stdio(false); cin.tie(nullptr);
    
    int n;
    cin >> n;
    string s;
    cin >> s;
    
    s.erase(unique(s.begin(), s.end()), s.end());
    
    cout << s.size() << ln;
    return 0;
}

Measured memory_bytes: 512
#include<iostream>
#define rep(i,n) for(int i=0;i<n;i++)
#define ck(a,b) 0<=a&&a<b
using namespace std;
int w,h,m[8][8],c[8][8][7],dy[]={-1,0,1,0,0},dx[]={0,-1,0,1,0};
void dfs(int y,int x,int hp){
	if(hp<=0)return;
	int nhp=m[y][x]==4?5:hp-1;
	rep(d,5){
		int ny=y+dy[d],nx=x+dx[d];
		if(ck(ny,h)&&ck(nx,w)&&m[ny][nx]&&c[ny][nx][nhp]>c[y][x][hp]+1){
			c[ny][nx][nhp]=c[y][x][hp]+1,dfs(ny,nx,nhp);
		}
	}
}
int main(){
	while(cin>>w>>h,w){
		int sy,sx,gy,gx,ans=1<<20;
		rep(i,h)rep(j,w){
			cin>>m[i][j];
			if(m[i][j]==2)sy=i,sx=j,m[i][j]=1;
			if(m[i][j]==3)gy=i,gx=j;
			rep(k,7)c[i][j][k]=1<<20;
		}
		c[sy][sx][6]=0;dfs(sy,sx,6);
		rep(i,6)if(ans>c[gy][gx][i+1])ans=c[gy][gx][i+1];
		cout<<(ans==1<<20?-1:ans)<<endl;
	}
	return 0;
}

Measured memory_bytes: 0
from bisect import bisect_right, bisect_left

N = int(input())
L = list(map(int,input().split()))
L.sort()
ans = 0

for i in range(N-2):
    for j in range(i+1,N-1):
        a = L[i]
        b = L[j]
        left = abs(a-b)
        right = a+b
        q = max(j+1,bisect_left(L,right))
        w = max(j+1,bisect_right(L,left))
        ans += q-w
print(ans)



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

#長針の座標（0時起点）
B_x=math.cos(math.radians(6*M))*B
B_y=math.sin(math.radians(6*M))*B

#短針の座標
A_x=math.cos(math.radians(0.5*(60*H+M)))*A
A_y=math.sin(math.radians(0.5*(60*H+M)))*A

kyori=((A_x-B_x)**2+(A_y-B_y)**2)**0.5

print(kyori)

Measured memory_bytes: 9468
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
pair<ll,ll>p[114514];
int main() {
	ll n;
	cin>>n;
	for(int i=0;i<n;i++){
		ll x,l;
		cin>>x>>l;
		p[i].first=x+l;
		p[i].second=x-l;
	}
	sort(p,p+n);
	ll ri=-1e15,ans=0;
	for(int i=0;i<n;i++){
		if(ri<=p[i].second){
			ans++;
			ri=p[i].first;
		}
	}
	cout<<ans;
	return 0;
}


Measured memory_bytes: 1792
from collections import defaultdict,deque
import sys,heapq,bisect,math,itertools,string,queue,datetime
sys.setrecursionlimit(10**8)
INF = float('inf')
mod = 10**9+7
eps = 10**-7
def inpl(): return list(map(int, input().split()))
def inpl_s(): return list(input().split())

N = int(input())
ans = 0
for n in range(1,N+1):
	tmp =0
	if n%2 == 0:
		continue

	for i in range(1,n+1):
		if n%i == 0:
			tmp += 1

	if tmp == 8:
		ans += 1

print(ans)


Measured memory_bytes: 4588
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n,cnt=0,a;
  cin>>n;
  for(int i=0;i<n;++i){
    cin>>a;
    if(a%2==0) ++cnt;
  }
  cout<<cnt<<endl;
  return 0;
}



Measured memory_bytes: 3084
N=int(input())
T,A=map(int,input().split())
H=list(map(int,input().split()))
INF=10**4
mini=INF
index=0

for i in range(N):
  temp=T-H[i]*0.006
  if abs(temp - A) < mini:
    mini=abs(temp-A)
    index=i+1

print(index)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define INF 1e9
using namespace std;

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

    string s;
    cin>>s;
    for(int i=0;i<s.size()-8;i++)cout<<s[i];
    cout<<endl;
}

Measured memory_bytes: 256
use std::io::*;
use std::str::FromStr;

fn func(x: usize, list: &Vec<Vec<usize>>) -> i64 {
    if list[x].len() == 0 {
        return 0;
    }
    let mut po: Vec<i64> = Vec::new();
    for i in 0..list[x].len() {
        po.push(func(list[x][i], &list));
    }
    po.sort();
    let mut res: i64 = 0;
    for i in 0..list[x].len() {
        res = std::cmp::max(res, po[i] + (list[x].len() - i) as i64);
    }
    return res;
}

fn main() {
    let n: usize = read();
    let a: Vec<usize> = (0..n - 1).map(|_| read::<usize>() - 1).collect();
    let mut list: Vec<Vec<usize>> = vec![Vec::new(); n];
    for i in 0..n - 1 {
        list[a[i]].push(i + 1);
    }
    println!("{}", func(0, &list));
}

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


Measured memory_bytes: 35964
#include <bits/stdc++.h>
typedef long long ll;
typedef long double ld;
const int INF=1e9,MOD=1e9+7,ohara=1e6+10;
const ll LINF=1e18;
using namespace std;
    
#define rep(i,n) for(int (i)=0;(i)<(int)(n);(i)++)
#define rrep(i,a,b) for(int i=(a);i<(b);i++)
#define rrrep(i,a,b) for(int i=(a);i>=(b);i--)
#define all(v) (v).begin(), (v).end()
#define Size(n) (n).size()
#define Cout(x) cout<<(x)<<endl
#define doublecout(a) cout<<fixed<<setprecision(15)<<a<<endl;
#define Cerr(x) cerr<<(x)<<endl
#define fi first
#define se second
#define P pair<ll,ll> 
#define m_p make_pair
#define V vector<ll> 
#define U_MAP unordered_map<ll,ll>
#define pq priority_queue<ll>
#define rpq priority_queue<ll,vector<ll>,greater<ll>>
#define p_b push_back
    
ll n,cnt,ans,a,b,c,d,tmp,tmpp,m,h,w,x,y,sum,pos,k;
ld doua;
int dy[]={1,0,-1,0};
int dx[]={0,1,0,-1};
//int dy[]={-1,0,1,-1,1,-1,0,1};
//int dx[]={-1,-1,-1,0,0,1,1,1};
string alph("abcdefghijklmnopqrstuvwxyz"),s;
bool fl;
struct edge{int to,cost;};
    
//-------------------------↓↓↓↓↓↓------------------------
    
//------ 自分を天才だと信じる ------
    
int main(void){
    cin.tie(0);
    cout.tie(0);
    ios::sync_with_stdio(false);
    
    cin>>a>>b>>x;
    ans=LINF;
    rep(i,30){
        rep(j,50){
            ll lit=1000*i+500*j;
            if(lit<x)continue;
            ll cost=i*min(a,b*2)+j*b;
            ans=min(ans,cost);
        }
    }
    Cout(ans);
    return 0;
}


Measured memory_bytes: 3212
#include <bits/stdc++.h>
using namespace std;
#define rep(i,r) for(int i = 0; i < (r); i++)
#define pb push_back
#define all(a) a.begin(), a.end()
#define fastio ios::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define int long long
#define uint unsigned long long
#define endl '\n'

string s;
int n;
const int mn = 1e6+1;
int f[mn][2];

int solve(int idx, int c) {
  if (idx == n) return c;
  int& res = f[idx][c];
  if (~res) return res;
  res = 1e9; 
  int amt = s[idx] - '0' + c;
  if (amt < 10) {
    res = min(res,solve(idx + 1, 0) + amt);
  }
  res = min(res, solve(idx + 1, 1) + 10-amt);
  return res;
}

signed main() {
  fastio;
  cin >> s;
  n = s.size();
  reverse(all(s));
  memset(f,-1, sizeof(f));
  cout << solve(0,0) << endl;
}


Measured memory_bytes: 82372
#include <string>
#include <iostream>
#include <cstdlib>
#include <map>
using namespace std;

int main()
{
	string s;
	bool prev = true;
	map<int, int> lm, tm;
	while (getline(cin, s)) {
		string::size_type p = s.find_first_of(",");
		if (p == string::npos) {
			prev = false;
			continue;
		}

		int num = atoi(s.substr(0, p).c_str());
		if (prev)
			++lm[num];
		else
			++tm[num];
	}

	for (map<int, int>::iterator it = lm.begin(); it != lm.end(); ++it) {
		map<int, int>::iterator jt = tm.find(it->first);
		if (jt != tm.end())
			cout << it->first << " " << it->second+jt->second << endl;
	}
	return 0;
}

Measured memory_bytes: 0
#include<iostream>
#include<bits/stdc++.h>
using namespace std;
int main()
{
    string s;
    cin>>s;
    bool ans=true;
  	if(s.length()%2==1)
    {
      cout<<"No";
      return 0;
    }
    for(int i=0;i<s.length();i++)
    {
        if(i%2==0)
        {
            if(s[i]!='h')
            {
                ans=false;
                break;
            }
        }
        else
        {
            if(s[i]!='i')
            {
                ans=false;
                break;
            }
        }
    }
    if(ans)
        cout<<"Yes";
    else cout<<"No";
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define DUMP(x)  cout << #x << " = " << (x) << endl;
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define IFOR(i, m, n) for(int i = n - 1; i >= m; i-- )
#define REP(i, n) FOR(i,0,n)
#define IREP(i, n) IFOR(i,0,n)
#define FOREACH(x,a) for(auto& (x) : (a) )
#define ALL(v) (v).begin(), (v).end()
using namespace std;
typedef long long ll;
const ll INF = 1e18;
/* テンプレートここまで */
void yes(){
  cout << "Yes" << endl;
  exit(0);
}

void no(){
  cout << "No" << endl;
  exit(0);
}

int main() {
  ll a; cin >> a;
  cout << 3*a*a << endl;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
#define ll long long int
#define rep(i,n) for( int i = 0; i < n; i++ )
#define rrep(i,n) for( int i = n; i >= 0; i-- )
#define REP(i,s,t) for( int i = s; i <= t; i++ )
#define RREP(i,s,t) for( int i = s; i >= t; i-- )
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define INF 2000000000
#define mod 1000000007
#define INF2 1000000000000000000


int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    string A, B, C;
    cin >> A >> B >> C;
    cout << "A" << B[0] << "C" << endl;

    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <cmath>
#include <string>
using namespace std;
int main() {
	int x, a, b;
	cin >> x >> a >> b;
	if (b <= a)
		cout << "delicious" << "\n";
	else if (b - a <= x)
		cout << "safe" << "\n";
	else
		cout << "dangerous" << "\n";
}

Measured memory_bytes: 3620
#include <bits/stdc++.h>
// #include <boost/multiprecision/cpp_int.hpp>
using namespace std;
// namespace boost::multiprecision;
// using Bint = cpp_int;
#define _overload3(_1, _2, _3, name, ...) name
#define _rep(i, n) repi(i, 0, n)
#define repi(i, a, b) for(int i = int(a), i##_len = (b); i < i##_len; ++i)
#define rep(...) _overload3(__VA_ARGS__, repi, _rep, )(__VA_ARGS__)
#define _repr(i, n) repri(i, n, 0)
#define repri(i, a, b) for(int i = int(a), i##_len = (b); i >= i##_len; --i)
/* 閉区間で定義しているので注意！repr(i,n,m)でn〜mまで */
#define repr(...) _overload3(__VA_ARGS__, repri, _repr, )(__VA_ARGS__)
/* 逆回しのループ。両閉区間であることに注意 */
#define all(x) (x).begin(), (x).end()
#define debug(x) cerr << #x << ": " << (x) << '\n'
typedef long long lint;
#define int lint
const int INF = (int)1145141919;
int MOD = (int)1e9 + 7;
const double EPS = 1e-9;
const lint LINF = (lint)1e18;
typedef vector<int> vint;
typedef pair<int, int> pint;
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(a > b) {
        a = b;
        return 1;
    }
    return 0;
}
template <class T, class U>
std::ostream &operator<<(std::ostream &os, const std::pair<T, U> p) {
    os << "(" << p.first << "," << p.second << ")";
    return os;
}
template <typename T1, typename T2>
ostream &operator<<(ostream &os, const pair<T1, T2> &p) {
    os << p.first << " " << p.second;
    return os;
}

template <typename T1, typename T2>
istream &operator>>(istream &is, pair<T1, T2> &p) {
    is >> p.first >> p.second;
    return is;
}

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

template <typename T> istream &operator>>(istream &is, vector<T> &v) {
    for(T &in : v)
        is >> in;
    return is;
}

template <typename T = lint> vector<T> make_v(size_t a) { return vector<T>(a); }

template <typename T, typename... Ts> auto make_v(size_t a, Ts... ts) {
    return vector<decltype(make_v<T>(ts...))>(a, make_v<T>(ts...));
}

template <typename T, typename V>
typename enable_if<is_class<T>::value == 0>::type fill_v(T &t, const V &v) {
    t = v;
}

template <typename T, typename V>
typename enable_if<is_class<T>::value != 0>::type fill_v(T &t, const V &v) {
    for(auto &e : t)
        fill_v(e, v);
}

/* templates */ /* templates */ /* templates */ /* templates */ /* templates */
/* make directory: atcoder-tools gen コンテスト略称(ex.agc033) */
/* テストコード：atcoder-tools test */
/* 提出：atcoder-tools submit -u */

signed main() {
#ifdef LOCAL
    ifstream in("in_1.txt");
    cin.rdbuf(in.rdbuf());
#else
    cin.tie(0);
    ios::sync_with_stdio(false);
#endif

    /* input part */
    long long N;
    cin >> N;
    long long K;
    cin >> K;
    string S;
    cin >> S;

    /* write your code!*/
    S[K - 1] ^= 32;
    cout << S << endl;
}


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

#define rep(i, n) REP(i, 0, n)
#define ALL(v) v.begin(), v.end()
#define MSG(a) cout << #a << " " << a << endl;
#define REP(i, x, n) for (int i = x; i < n; i++)
#define OP(m) cout << m << endl
typedef long long ll;
typedef unsigned long long ull;

int main()
{
    ll n, m;
    cin >> n >> m;
    if (n >= m)
        OP(m / 2);
    else
        OP(n + (m - 2 * n) / 4);

    return 0;
}

Measured memory_bytes: 384
a, b = map(int, input().split())
if a == b:
    print("Draw")
elif a == 1:
    print("Alice")
elif b == 1:
    print("Bob")
elif a == 2:
    print("Bob")
elif b == 2:
    print("Alice")
elif a > b:
    print("Alice")
elif b > a:
    print("Bob")

Measured memory_bytes: 3060
n = gets.to_i
a = gets.chomp.split(" ").map(&:to_i)
b = Array.new(n,0)
c = 0
for i in 1..30
  if a.map{|num|num%2} == b
    c += 1
  else
    break
  end
  a.map!{|num|num/2}
end
puts c

Measured memory_bytes: 1788
#include <bits/stdc++.h>
using namespace std;
typedef long long int64;
typedef vector<int> vec;
typedef vector<int64> vec64;
#define db(x) cout << "> " << #x << ": " << x << "\n";
#define ss cout << " ";
#define ct(x) cout << x;
#define nn cout << "\n";
#define cts(x) cout << x << " ";
#define ctn(x) cout << x << "\n";
#define qr queries();
void solve();
void YN(bool b){if (b){ctn("YES");}else{ctn ("NO");}};
void yn(bool b){if (b){ctn("Yes");}else{ctn ("No");}};
void queries(){int n;cin >> n;while (n--)solve();}
// // // // // // // // // // // // // // // // // // // // // // 
/*                  TEMPLATE - VANILLA                         */
// // // // // // // // // // // // // // // // // // // // // //
int64 q, n;

void solve(){

    return;
}


int main(){
    ios_base::sync_with_stdio(0);cin.tie(0);
    int n,k;
    cin >> n >> k;
    vec cost (n);
    for (int i = 0; i < n; i++){
        cin >> cost[i];
    }
    vec64 dp (n);
    dp[0] = 0;
    dp[1] = abs(cost[1] - cost[0]);
    for (int i = 2; i < n; i++){
        int64 sofar = INT_MAX;
        for (int j = max(0,i - k); j < i; j++){
            sofar = min(sofar, abs(cost[i] - cost[j]) + dp[j]);
        }
        dp[i] = sofar;
    }
    // for (int i = 0; i < n; i++){
    //     cts(dp[i]);
    // }
    ctn(dp[n-1]);
    return 0;
}


Measured memory_bytes: 4496
#include <bits/stdc++.h>
#define SIZE(x) ((x).size())
#define PB push_back

using namespace std;

const int N = 100;

int n;

set<string> uniq;
vector<string> w;

bool read() {
    if (!(cin >> n)) {
        return false;
    }
    uniq.clear();
    w.resize(n);
    for (int i = 0; i < n; i++) {
        cin >> w[i];
    }
    return true;
}

void solve() {
    uniq.insert(w[0]);
    char lc = w[0].back();
    for (int i = 1; i < n; i++) {
        if (uniq.count(w[i]) == 0 && lc == w[i].front()) {
            uniq.insert(w[i]);
            lc = w[i].back();
        } else {
            cout << "No" << endl;
            return;
        }
    }
    cout << "Yes" << endl;
}

int main(void) {
    while (read())
        solve();
    return 0;
}


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

//#include <atcoder/all>

using namespace std;
//using namespace atcoder;

//#define int long long
#define ll long long

ll INF = (1LL << 60);
int mod = 998244353;
using P = pair<ll, ll>;
double PI = 3.1415926535;
signed main() {
	string s, t; cin >> s >> t;
	t.pop_back();
	if (s == t)cout << "Yes" << endl;
	else cout << "No" << endl;
	return 0;
}



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

int main() {
        int N, K, count;
        cin >> N >> K;
        count = 0;
        int number;
        for (int i = 0; i < N;i++){
                cin >> number;
               int tmp=min(number,K-number);
               count += tmp;
        }
        cout << count * 2;
}

Measured memory_bytes: 256
/**
 *    Coded by : lucky_21
 *               --------Lokesh Singh
**/

#include<bits/stdc++.h>
using namespace std;

#include<ext/pb_ds/tree_policy.hpp>
#include<ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
template<class T> using oset=tree<T,null_type,less<T>,rb_tree_tag,tree_order_statistics_node_update>;

#define     F           first
#define     S           second
#define     pb          push_back
#define     lb          lower_bound
#define     ub          upper_bound
#define     pii         pair<int,int>
#define     all(x)      x.begin(),x.end()
#define     fix         fixed<<setprecision(10)
#define     rep(i,a,b)  for(int i=int(a);i<=int(b);i++)
#define     repb(i,b,a) for(int i=int(b);i>=int(a);i--)
#define     FastIO      ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0)

typedef double db;
typedef long long ll;

const int N=1e5+5;
const int mod=1e9+7;

int n,k;
ll dp[N];
int power(ll x,int b){
    ll res=1;
    while(b){
        if(b&1) res=res*x%mod;
        x=x*x%mod;
        b/=2;
    }
    return res;
}
signed main(){
    FastIO;
    cin>>n>>k;
    int ans=0;
    repb(i,k,1){
        dp[i]=power(k/i,n);
        rep(j,2,k/i) dp[i]=(dp[i]+mod-dp[i*j])%mod;
        ans=(ans+i*dp[i])%mod;
    }
    cout<<ans;
    return 0;
}


Measured memory_bytes: 4368
#include <bits/stdc++.h>
#define rep(i, a, n) for(int i = a; i < n; i++)
#define repb(i, a, b) for(int i = a; i >= b; i--)
#define all(a) a.begin(), a.end()
#define o(a) cout << a << endl
#define int long long
using namespace std;
typedef pair<int, int> P;

signed main(){
    int h, w;
    while(1){
        cin >> h >> w;
        if(h + w == 0) break;
        int a[21] = {};
        int b[21] = {};
        int d;
        rep(i, 0, h){
            cin >> d;
            a[d]++;
        }
        rep(i, 0, w){
            cin >> d;
            b[d]++;
        }
        int ans = 0;
        rep(i, 0, 21){
            ans += i * max(a[i], b[i]);
        }
        cout << ans << endl;
    }
}

Measured memory_bytes: 3052
using System;
using System.Collections.Generic;
using System.Linq;

namespace ABC124_D
{
    class Program
    {
        static void Main(string[] args)
        {
            var NK = Console.ReadLine().Split().Select(int.Parse).ToArray();
            var N = NK[0];
            var K = NK[1];
            var S = Console.ReadLine();

            var list = new List<int>();
            var val = '1';
            var cnt = 0;
            for (int i = 0; i < N; i++)
            {
                if (S[i] == val) cnt++;
                else
                {
                    list.Add(cnt);
                    val = val == '1' ? '0' : '1';
                    cnt = 1;
                }
            }
            if (cnt > 0) list.Add(cnt);
            if (list.Count % 2 == 0) list.Add(0);

            var cumSum = new int[list.Count + 1];
            for (int i = 0; i < list.Count; i++)
            {
                cumSum[i + 1] = cumSum[i] + list[i];
            }

            var ans = 0;
            for (int i = 0; i < list.Count; i += 2)
            {
                var l = i;
                var r = Math.Min(i + 2 * K + 1, list.Count);
                ans = Math.Max(ans, cumSum[r] - cumSum[l]);
            }

            Console.WriteLine(ans);
        }
    }
}


Measured memory_bytes: 13372
#define _USE_MATH_DEFIMES
#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <cctype>
#include <climits>
#include <clocale>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <ctime>
#include <deque>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <regex>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>

const int MOD = 1'000'000'007;
const int INF = 1'000'000'000; //1e9
const int NIL = -1;
const long long LINF = 1'000'000'000'000'000'000; // 1e18
const long double EPS = 1E-10;

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




long long power(long long a, unsigned long long b, long long m){
    long long ret(1);
    while(b){
        if(b & 1) ret = (ret * a) % m;
        a = (a * a) % m;
        b /= 2;
        if(ret < 0) ret += m;
        if(a < 0) a += m;
    }
    return ret;
}


long long power(long long a, unsigned long long b) {
    return power(a, b, MOD);
}

long long inv(int a, long long m){ // GCD(a, m) = 1
    return power(a, m-2);
}

long long inv(int a){
    return inv(a, MOD);
}

std::map<long long, int> primeFactorisation_Map(long long n){
    std::map<long long, int> mp;
    for(long long i(2); i * i <= n; ++i)
        while(!(n % i)){
            ++mp[i]; n /= i;
        }
    if(n > 1) ++mp[n];
    return mp;
}

int main(){
    int N; std::cin >> N;
    std::map<long long, int> LCM;
    std::vector<int> A(N);
    {
        for(int i(0); i < N; ++i){
            std::cin >> A[i];
            std::map<long long, int> p(primeFactorisation_Map(A[i]));

            for(auto &pp: p){
                long long n(pp.first);
                chmax(LCM[n], pp.second);
            }
        }
    }
    long long L(1);
    for(auto &pp: LCM){
        L = L * power(pp.first, pp.second) % MOD;
    }
    long long ans(0);
    for(int i(0); i < N; ++i){
        ans = (ans + (L*inv(A[i]) % MOD)) % MOD;
    }
    std::cout << ans << std::endl;
    return 0;
}


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

#define forn(i, n) for (int i = 0; i < (int)(n); ++i)
#define for1(i, n) for (int i = 1; i <= (int)(n); ++i)
#define fore(i, l, r) for (int i = (int)(l); i <= (int)(r); ++i)
#define ford(i, n) for (int i = (int)(n) - 1; i >= 0; --i)
#define PB push_back
#define F first
#define S second
#define SZ(a) a.size()
#define MP(a,b) make_pair(a,b)
#define ALL(x) (x).begin(), (x).end()
#define RALL(x) (x).rbegin(), (x).rend()
#define NL << "\n"

#define mod 1000000007
#define pi 3.14159265359

using namespace std;

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<int, string> pis;
typedef pair<string, int> psi;
typedef pair<ll, ll> pll;
typedef pair<ll, string> pls;
typedef pair<string, ll> psl;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vi> vvi;
typedef vector<vll> vvll;
typedef vector<string> vs;
typedef vector<pll> vpll;
typedef double ld;

int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.precision(10);
  cout << fixed;
  
  ll n, k, q, tmp;
  cin >> n >> k >> q;

  vll scores(n, 0);

  forn(i,q){
    cin >> tmp;
    scores[tmp-1]++;
  }

  forn(i,n){
    cout << ((k - q + scores[i]) > 0? "Yes" : "No") NL;
  }
  
  return 0;
}




Measured memory_bytes: 1408
A,B,C,X,Y = gets.split.map(&:to_i)

AB_MAX = [X,Y].max

ans = Float::INFINITY

0.upto(AB_MAX) do |i|
  tmp = 2*i*C

  tmp +=
    if X > i
      A*(X-i)
    else
      0
    end

  tmp +=
    if Y > i
      B*(Y-i)
    else
      0
    end
  ans = tmp if tmp < ans
end

puts ans


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

int main(){
	int a, b;
	cin >> a >> b;
	
	if(a==b) 
	cout << "a == b" << endl;
	else if(a<b) 
	cout << "a < b" << endl;
	else
	cout << "a > b" << endl;
}


Measured memory_bytes: 3136
package main

import (
	"fmt"
)

func main() {
	var (
		n, q int
		s    string
	)
	fmt.Scan(&n, &q, &s)

	count := make([]int, len(s))

	for i := 1; i < len(s); i++ {
		count[i] = count[i-1]
		if s[i-1] == 'A' && s[i] == 'C' {
			count[i]++
		}
	}

	for i := 0; i < q; i++ {
		var l, r int
		fmt.Scan(&l, &r)
		fmt.Println(count[r-1] - count[l-1])
	}

}


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

int main(){
  int A;
  int Son,Stw,Sth;
  cin >>A;
  Son = A/100 ; A -= Son*100;
  Stw = A/10  ; A -= Stw*10;
  Sth = A;

  cout <<Son+Stw+Sth<<endl;
}


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

int main() {
	int n, k;
	cin >> n >> k;
	vector<int> h(n);
	for (int i = 0; i < n; i++)
		cin >> h[i];
	sort(h.begin(), h.end());
	int min = 10e9;
	for (int i = k-1; i < n; i++)
		if (min > h[i] - h[i - k + 1])
			min = h[i] - h[i - k + 1];
	cout << min << endl;
	return 0;
}

Measured memory_bytes: 640
c = [list(map(int,input().split())) for _ in range(3)]

a = [None for _ in range(3)]
b = [None for _ in range(3)]

b[0],a[0]=0,c[0][0]

for i in range(1,3):
    a[i] = c[0][i]-b[0]
for j in range(1,3):
    b[j] = c[j][0]-a[0]

ans = "Yes"
for i in range(3):
    for j in range(3):
        if c[i][j] != a[j]+b[i]:
            ans = "No"
            break

print(ans)


Measured memory_bytes: 3064
#include <iostream>
#include <stack>
#include <math.h>
#include <vector>
#include <string>
#include <algorithm>
#include <map>

#define rep(i,n) for(int i=0; i < n; i++)
using ll =  long long;
using namespace std;
#define pi 3.14159265358979

int main()
{
	int n, m;
	cin >> n >> m;
	vector<int> city(n);
	rep(i, m)
	{
		int in, out;
		cin >> in >> out;
		city[in - 1] ++;
		city[out - 1] ++;
	}
	rep(i, n) cout << city[i] << endl;
	return 0;
}

Measured memory_bytes: 3548
#include<algorithm>
#include<iostream>
#include<cstring>
#include<string>
#include<vector>
#include<cstdio>
#include<cmath>
#include<set>
#include<map>
using namespace std;
typedef long long ll;
const int MAXN=1e5+5;
int read()
{
    int s=0,f=1;
    char ch=getchar();
    while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
    while(ch>='0'&&ch<='9'){s=s*10+ch-'0';ch=getchar();}
    return s*f;
}
int main()
{
    ll a,b,k;
    while(cin>>a>>b>>k)
    {
        if(a<=k)
        {
            k-=a;
            a=0;
            if(b<=k)
            {
                k-=b;
                b=0;
            }
            else
            {
                b-=k;
                k=0;
            }
        }
        else
        {
            a-=k;
            k=0;
        }
        cout<<a<<" "<<b<<endl;
    }
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <cmath>
using namespace std;
int main(void){
    // Your code here!
    long A;
    cin >> A;
    long flag = 0;
    long x = A+1,y = A+1;
    double min_d = (x-1) + (y-1);
    for(int i = 1; i <= (long)sqrt(A); i++){
        if(A%i == 0){
            long tmp_x = i;
            long tmp_y = A/i;
            long tmp_d = (tmp_x-1) + (tmp_y-1);
            if(tmp_d < min_d){
                x = tmp_x;
                y = tmp_y;
            }
        }
    }
    cout << (x-1)+(y-1) << endl;

}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

int N;
int main() {
    cin >> N ;
    vector<int> A(N);
    for (int i = 0; i < N; ++i) {
        int a;
        cin >> a;
        A[i] = a- i-1;
    }
    sort(A.begin(), A.end());
    int b = A[N/2];

    long sum = 0;
    for (int j = 0; j < N; ++j) {
        sum += abs(A[j] - b);
    }

    cout << sum << endl;
    return 0;
}

Measured memory_bytes: 1024
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools

sys.setrecursionlimit(10**7)
inf = 10**20
gosa = 1.0 / 10**9
mod = 10**9 + 7

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()


def main():
    N = I()
    r = 0
    while N>=2:
        N //= 2
        r += 1

    return 2**r



print(main())



Measured memory_bytes: 6732
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(){
    char X;
    cin >> X;
    //cout << int (X) << endl;
    if(int(X) <= 96){
        cout << 'A' << endl;
    }
    
    else{
        cout << 'a' << endl;
    }
    return 0;
}

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

int main() {
    double n;
    cin >> n;
    vector<int> a(n);
    double bunsi = 1;
    double bunbo = 0;
    rep(i, n) cin >> a[i];
    rep(i, n) {
        double tmp = 1;
        rep(j, n) {
            if(i != j)
                tmp *= a[j];
        }
        bunbo += tmp;
        bunsi *= a[i];
    }
    // cout << "bunsi:" << bunsi << ",bunbo:" << bunbo << endl;
    cout << setprecision(10) << bunsi / bunbo << endl;
    return 0;
}


Measured memory_bytes: 3776
#include <stdio.h>
#include <string.h>
#include <algorithm>
#include <iostream>
#include <math.h>
#include <assert.h>
#include <vector>

using namespace std;
typedef long long ll;
typedef unsigned int uint;
typedef unsigned long long ull;
static const double EPS = 1e-9;
static const double PI = acos(-1.0);

#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define FOR(i, s, n) for (int i = (s); i < (int)(n); i++)
#define FOREQ(i, s, n) for (int i = (s); i <= (int)(n); i++)
#define FORIT(it, c) for (__typeof((c).begin())it = (c).begin(); it != (c).end(); it++)
#define MEMSET(v, h) memset((v), h, sizeof(v))

int n, k;
int seq[1010];
int card[1010][1010];

int main() {
  srand(time(NULL));
  while (scanf("%d %d", &n, &k) > 0) {
    REP(i, k) {
      REP(j, n / 2) {
        scanf("%d", &card[i][j]);
        card[i][j]--;
      }
    }
    while (true) {
      REP(i, n) { seq[i] = rand() & 1; }
      REP(i, k) {
        int sum = 0;
        REP(j, n) {
          sum += seq[card[i][j]];
        }
        if (sum < n / 8 || sum > 3 * n / 8) { goto next; }
      }
      break;
next:;
    }
    REP(i, n) {
      printf("%d", seq[i]);
    }
    puts("");
  }
}

Measured memory_bytes: 2604
#pragma comment(linker, "/STACK:1024000000,1024000000")
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <string>
using namespace std;
#define LL long long
#define mp make_pair
#define fr first
#define sc second
#define pb push_back
#define lc (x<<1)
#define rc ((x<<1)|1)
const int N=100005;
int v[N*2],nxt[N*2],point[N],bs;
void addedge(int x,int y){
    bs++;v[bs]=y;nxt[bs]=point[x];point[x]=bs;
    bs++;v[bs]=x;nxt[bs]=point[y];point[y]=bs;
}
LL c[2];
int vis[N],ff;
void dfs(int x,int f){
    c[f]++;vis[x]=f;
    for (int p=point[x];p;p=nxt[p])
     if (vis[v[p]]==-1) dfs(v[p],f^1);
      else if (vis[v[p]]==f) ff=1;
}
int main(){
   // freopen("in.txt","r",stdin);
   //freopen("out.txt","w",stdout);
    int i,n,m;
    cin>>n>>m;
    for (i=1;i<=m;i++){
        int x,y;
        scanf("%d%d",&x,&y);
        addedge(x,y);
    }
    for (i=1;i<=n;i++) vis[i]=-1;
    c[0]=c[1]=0;dfs(1,0);
    cout<<(ff?((LL)n)*(n-1)/2:c[0]*c[1])-m<<endl;

    return 0;
}


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

#[allow(unused_macros)]
macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

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

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

#[allow(unused_macros)]
macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

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

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

    ($next:expr, bytes) => {
        read_value!($next, String).into_bytes()
    };

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

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

#[allow(unused_imports)]
use std::cmp::{max, min};
#[allow(unused_imports)]
use std::collections::{BinaryHeap, HashMap};

#[allow(dead_code)]
type Graph = Vec<Vec<usize>>;

fn main() {
    input! {
        n: usize,
        t: [usize; n],
        v: [f64; n],
    }

    let last = t.iter().sum::<usize>() * 2;

    let mut speed = vec![vec![]; last + 1];

    for i in 0..last + 1 {
        speed[i].push(i as f64 / 2.0);
    }
    for i in 0..last + 1 {
        speed[i].push((last - i) as f64 / 2.0);
    }
    let mut pre = 0;
    for i in 0..n {
        let now = pre + t[i] * 2;
        for j in pre..now + 1 {
            speed[j].push(v[i] as f64);
        }
        for j in 0..pre + 1 {
            speed[j].push(v[i] + (pre - j) as f64 / 2.0);
        }
        for j in now..last + 1 {
            speed[j].push(v[i] + (j - now) as f64 / 2.0);
        }
        pre = now;
    }

    for i in 0..last + 1 {
        speed[i].sort_by_key(|a| (a * 20.0) as usize);
    }

    let mut area = 0f64;

    for i in 1..last + 1 {
        area += (speed[i - 1][0] + speed[i][0]) / 4.0;
    }

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


Measured memory_bytes: 45308
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <utility>
#include <tuple>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <cmath>
#include <iomanip>
#include <cassert>
#define REP(i, n) for (int i = 0; i < (n); ++i)
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) (int)(x).size()
using namespace std;
using ll = long long;
constexpr ll INF = 3000000000000000000;

int main() {
    int l, r, d;
    cin >> l >> r >> d;
    cout << r / d - (l - 1) / d << "\n";
    return 0;
}


Measured memory_bytes: 3628
#include<bits/stdc++.h>
using namespace std;
int n,m;
long long x[1200],y[1200],z[1200];
int main(){
	//freopen("input.txt","r",stdin);
	//freopen("output.txt","w",stdout);
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	cin>>n>>m;
	long long res=0;
	for(int i=1;i<=n;i++){
		cin>>x[i]>>y[i]>>z[i];
	}
	for(int mask=0;mask<8;mask++){
		vector<long long> v;
		for(int i=1;i<=n;i++){
			int t=mask;
			long long val=0;
			if(t%2==0)
				val+=x[i];
			else
				val-=x[i];
			t/=2;
			if(t%2==0)
				val+=y[i];
			else
				val-=y[i];
			t/=2;
			if(t%2==0)
				val+=z[i];
			else
				val-=z[i];
			v.push_back(val);
		}
		sort(v.begin(),v.end());
		reverse(v.begin(),v.end());
		long long cand=0;
		for(int i=0;i<m;i++)
			cand+=v[i];
		res=max(res,cand);
	}
	cout<<res<<endl;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <numeric>
#define rep(i, n) for(int i=0; i < n; i++)
#define reps(i, n) for(int i=1; i <= n; i++)
#define ALL(v) v.begin(), v.end()
#define pb(x) push_back(x)
#define mp(x,y) make_pair(x,y)

using namespace std;
using ll=long long;

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; }

const ll INF=1LL << 60;

ll xs[100005];

ll gcd(ll x,ll y){
  if(!(x%y))return y;
  else return gcd(y,x%y);
}

int main() {
  ll n,x,xs;cin >> n >> x;
  queue<int> q;
  while(cin >> xs)q.push(abs(xs-x));

  while(q.size()>1){
    ll a=q.front();q.pop();
    ll b=q.front();q.pop();
    q.push(gcd(a,b));
  }


  cout << q.front() << endl;
}

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

#define rep(X,N) for(ll X = 0; X < (N); X++)
#define PI (acos(-1.0))
#define pback push_back
#define mpair make_pair
#define MODN 1000000007
#define ALL(V) (V).begin(),(V).end()
#define INT_MAX_HALF (INT_MAX / 2)
#define EPS (1e-10)

using namespace std;
typedef long long ll;



int main(){

    int n;
    cin >> n;

    map<string, int> m;

    rep(i, n){
        string s;
        cin >> s;
        m[s] = 1;
    }

    cout << m.size() << endl;
    return 0;
}


Measured memory_bytes: 19124