akhauriyash/Code-Regression huggingface dataset:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;



class Program
{
    const int MOD = 1000000007;
    const int INF = 1 << 30;

    static void Main(string[] args)
    {
        Solve();
    }

    static int digitsum(int x)
    {
        string s = x.ToString();
        int ret = 0;
        for(int i = 0; i < s.Length; ++i)
        {
            ret += s[i] - '0';
        }
        return ret;
    }


    static void Solve()
    {
        Scan sc = new Scan();
        write wr = new write();

        int n = sc.intarr[0];
        if (n % digitsum(n) == 0)
        {
            wr.wri("Yes");
        }
        else wr.wri("No");
    }
}
    




class Scan
{
        public string str => Console.ReadLine();

        public string[] strarr => str.Split(' ');

        public long[] longarr => strarr.Select(long.Parse).ToArray();
        public int[] intarr => strarr.Select(int.Parse).ToArray();
    public char[] chararr => str.ToArray();


}



class write
{
    public void wri<Type>(Type x)
    {
        Console.WriteLine(x);
    }
}


Measured memory_bytes: 13396
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
using namespace std;
int main(){
    int N;
    cin>>N;
    while(N--){
        string str;
        cin>>str;
        int len=str.size();
        int ans=-1;
        if(str[0]=='>'&&str[1]=='\''){
            int pos=2;
            int cnt=0;
            int turn=0;
            int flag=0;
            do{
                if(str[pos]=='=')
                    cnt+=(turn)?(-1):(1);
                else if(str[pos]=='#')turn=1;
                else flag=0;
                if(pos==2&&cnt>0)flag=1;
                pos++;
            }while(pos<len-1);
            if(cnt==0&&flag&&str[pos]=='~')ans=0;
        }
        else if(str[0]=='>'&&str[1]=='^'){
            int pos=2;
            int flag=1;
            do{
                if(str[pos]!='Q'||str[pos+1]!='='){
                    flag=0;
                    break;
                }
                pos+=2;
            }while(pos<len-2);
            if(flag&&str[pos]=='~'&&str[pos+1]=='~')ans=1;
        }
        if(ans==0)cout<<"A"<<endl;
        else if(ans==1)cout<<"B"<<endl;
        else cout<<"NA"<<endl;
    }
    return 0;
}

Measured memory_bytes: 1200
#include<iostream>
#include<iomanip>
using namespace std;
int main()
{
		int n;
		cin>>n;
		double a[n];
		double sum=0;
		for(int i=0;i<n;i++)
		{
				cin>>a[i];
				sum+=1/a[i];
		}
		cout<<fixed<<setprecision(15)<<1/sum;
}	


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = int64_t;
using P = pair<ll, ll>;
const ll INF = 5e15;
int main(){
    ll L, N;
    cin >> L >> N;
    vector<ll> X(N);
    vector<ll> revX(N);
    for(ll &x : X) cin >> x;
    for(ll i = 0; i < N; i++) revX[i] = L - X[i];
    vector<ll> sum(N + 1), rsum(N + 1);
    for(ll i = 0; i < N; i++) sum[i + 1] = sum[i] + X[i];
    for(ll i = 0; i < N; i++) rsum[i + 1] = rsum[i] + revX[i];
    ll ans = max(X[N - 1], revX[0]);
    for(ll i = 0; i < N - 1; i++){
        //cout << i << " : ";
        ll tmp = 0;
        ll cnt = min(i + 1, N - i - 1);
        tmp += sum[i + 1] - sum[i + 1 - cnt];
        //cout << sum[i + 1] - sum[i + 1 - cnt] << ", ";
        tmp += rsum[i + 1 + cnt] - rsum[i + 1];
        //cout << rsum[i + 1 + cnt] - rsum[i + 1] << ", ";
        tmp *= 2;
        tmp -= min(X[i], revX[i + 1]);
        //cout << min(X[i], revX[i + 1]) << endl;
        ans = max(tmp, ans);
        if(i + 1 > cnt){
            ll tmp = 0;
            tmp += sum[i] - sum[i - cnt];
            tmp += rsum[i + 1 + cnt] - rsum[i + 1];
            tmp *= 2;
            tmp += X[i];
            ans = max(ans, tmp);
        }
        if(N - i - 1 > cnt){
            ll tmp = 0;
            tmp += sum[i + 1] - sum[i + 1 - cnt];
            tmp += rsum[i + 2 + cnt] - rsum[i + 2];
            tmp *= 2;
            tmp += revX[i + 1];
            ans = max(ans, tmp);
        }
    }
    cout << ans << endl;
    return 0;
}


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

#define str(a) to_string(a)
#define int long long
#define pb push_back
#define mp make_pair
#define SORT(c) sort(c.begin(),c.end())
#define max_heap priority_queue<int>
#define min_heap priority_queue< int,vector<int>, greater<int> >
#define mod 1000000007
#define setbits(x) __builtin_popcount(x)
#define ps(x,y) fixed<<setprecision(y)<<x
#define start(t) int x;cin>>x;while(x--)
#define inf LLONG_MAX
#define sync ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define endl "\n"
#define MOD 998244353

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







int32_t main()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
	int a, b, c, d;
	cin >> a >> b >> c >> d;
	bool chancea = true;
	bool flag = false;
	while (1) {
		if (chancea) {
			c = c - b;
			chancea = false;
			if (c <= 0) {
				cout << "Yes" << endl;
				flag = true;
				return 0;
			}
		} else {
			a = a - d;
			chancea = true;
			if (a <= 0) {
				cout << "No" << endl;
				return 0;
			}
		}
	}

}












Measured memory_bytes: 3640
#include<stdio.h>
int partition(int *a,int p,int r){
  int x;
  int i,j,temp;

  x = a[r];
  i = p-1;
  for(j=p;j<r;j++){
    if(a[j]<=x){
      i++;
      temp = a[i];
      a[i] = a[j];
      a[j] = temp;
    }
  }
 temp = a[i+1];
 a[i+1] = a[r];
 a[r] = temp;
  
  return i+1;
}

int main(){
  int p,n,a[110000];
  int i;
  
  scanf("%d",&n);
  for(i=0;i<n;i++) scanf("%d",&a[i]);
  p = partition(a,0,n-1);
  for(i=0;i<n;i++){
    if(i==p) printf("[%d]",a[i]);
    else printf("%d",a[i]);
    if(i==n-1) printf("\n");
    else printf(" ");
  }

  return 0;
}



Measured memory_bytes: 3068
import sys

sys.setrecursionlimit(10 ** 7)
input = sys.stdin.readline
f_inf = float('inf')
mod = 10 ** 9 + 7


def resolve():
    n = int(input())

    cnt = n
    if n % 2:
        cnt -= 1

    edge = []
    for i in range(n):
        for j in range(i + 1, n):
            if j + 1 == cnt:
                continue
            edge.append([i + 1, j + 1])
        cnt -= 1

    print(len(edge))
    for res in edge:
        print(*res)


if __name__ == '__main__':
    resolve()


Measured memory_bytes: 9608
n,m=list(map(int ,input().split()))
a=list(map(int ,input().split()))
s=0
for i in range(0,len(a)):
	s+=a[i]
if(s>n):
	print(-1)
	
elif(s<n):
	hangout=n-s
	print(hangout)
		
elif(s==n):
	print(0)


Measured memory_bytes: 10028
#!/usr/bin/env python3
import sys


def solve(L: int):
    r = L / 3
    print(r ** 3)
    return


# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    L = int(next(tokens))  # type: int
    solve(L)

if __name__ == '__main__':
    main()


Measured memory_bytes: 2940
n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
cnt = 0
for i in range(n):
  if a[i] >= b[i]:
    a[i] = a[i] - b[i]
    cnt += b[i]
  elif a[i] + a[i + 1] >= b[i]:
    a[i + 1] = a[i] + a[i + 1] - b[i]
    a[i] = 0
    cnt += b[i]
  else:
    cnt += a[i] + a[i + 1]
    a[i] = 0
    a[i + 1] = 0
print(cnt)

Measured memory_bytes: 18624
#include <iostream>

using namespace std;

int main() {

    int a, b, c, count;
    cin >> a >> b >> c;
    
    for (int i = a; i <= b; i++){
        if (c % i == 0){
            count++;
        }
    }
    cout << count << endl;
    
    return 0;
}

Measured memory_bytes: 1160
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
#define rrep(i,n) for(int i=1;i<=n;i++)
# define ALL(x) (x).begin(), (x).end()
# define SZ(x) ((int)(x).size())
# define pb push_back
using namespace std;

int main(){
    int n;
    cin>>n;
    vector<long long> l(n+1);
    rep(i,n+1){
        if(i==0) l[i]=2;
        else if(i==1) l[i]=1;
        else l[i]=l[i-1]+l[i-2];
    }
    cout<<l[n]<<endl;
    return 0;
}

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

using namespace std;

#define pb push_back
#define ll long long
#define speed ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0)
#define bug cout << "ok" << endl

const ll INF = 1e9 + 5, N = 3e5 + 5, mod = 998244353, M = 1e6 + 5;

int dp[N], n, k, seg[15][2], pref[N];

int main(){
	cin >> n >> k;
	for(int i = 1; i <= k; i++){
		cin >> seg[i][0] >> seg[i][1];
	}
	dp[1] = 1;
	pref[1] = 1;
	for(int i = 2; i <= n; i++){
		for(int j = 1; j <= k; j++){
			if(i - seg[j][0] <= 0) continue;
			int end = i - seg[j][0], start = max(1, i - seg[j][1]);
			dp[i] = (dp[i] + (pref[end] - pref[start - 1])) % mod;
			while(dp[i] < 0) dp[i] += mod;
		}
		pref[i] = (pref[i - 1] + dp[i]) % mod;
	}
	cout << dp[n] << endl;
}

Measured memory_bytes: 5156
#include <algorithm>
#include <array>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>

using namespace std;
using ll = long long;
using pint = pair<int, int>;
using pll = pair<ll, ll>;

constexpr double EPS = 1e-7;
constexpr int INF = 1e9;
#define PI (acos(-1))

constexpr int MOD = 1e9 + 7;

int main(int argc, char const *argv[]) {
	cin.tie(nullptr);
	ios::sync_with_stdio(false);
	cout << fixed << setprecision(15);

	ll H;
	cin >> H;

	ll d = floor(log2(H));
	ll ans = 0;
	for (ll i = 0; i < d + 1; i++) {
		ans += pow(2, i);
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 888
def e():
    n, m, l = map(int, input().split())
    dist = [[float('inf') if i != j else 0 for j in range(n)] for i in range(n)]
    fuel = [[float('inf') if i != j else 0 for j in range(n)] for i in range(n)]

    for i in range(m):
        a, b, c = map(int, input().split())
        a -= 1
        b -= 1
        dist[a][b] = c
        dist[b][a] = c

    q = int(input())
    li_st = []
    for i in range(q):
        s, t = map(int, input().split())
        li_st.append([s, t])

    for k in range(n):
        for i in range(n):
            for j in range(n):
                dist[i][j] = min(dist[i][j], dist[i][k] + dist[k][j])

    for i in range(n):
        for j in range(n):
            if i == j:
                continue
            if dist[i][j] <= l:
                fuel[i][j] = min(1, fuel[i][j])

    for k in range(n):
        for i in range(n):
            for j in range(n):
                fuel[i][j] = min(fuel[i][j], fuel[i][k] + fuel[k][j])

    for s, t in li_st:
        s -= 1
        t -= 1
        if fuel[s][t] == float('inf'):
            print(-1)
        else:
            print(fuel[s][t] - 1)


if __name__ == '__main__':
    e()


Measured memory_bytes: 131548
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
using namespace std;
using ll=long long;
using vec=vector<ll>;
using Graph = vector<vector<ll>>;
#define loop(i,n) for(ll i=0;i<n;i++)
#define Loop(i, m, n) for(ll i = m;i < n;i++)
#define pool(i,n) for(ll i=n-1;i>=0;i--)
#define Pool(i, m, n) for(ll i=n-1;i>=m;i--)
#define MAX 99999999999ll
#define MIN -99999999999ll
#define setbit bitset<8>
#define flagcount __builtin_popcount
#define flag(x) (1<<x)
#define flagadd(bit,x) bit|=flag(x)
#define flagpop(bit,x) bit&=~flag(x) 
#define flagon(bit,i) bit&flag(i)
#define flagoff(bit,i) !(bit & (1<<i))
#define all(v) v.begin(),v.end()
#define low2way(v,x) lower_bound(all(v),x)
#define high2way(v,x) upper_bound(all(v),x)
#define count2way(v,x) high2way(v,x)-low2way(v,x)
#define lower(v,x) low2way(v,x)-v.begin() //1番左が0、もし見つから無いならｎを出力
#define higher(v,x) high2way(v,x)-v.begin()-1 //1番左が0、もし見つからないならn-1を出力（注意）
#define putout(x) cout<<x<<endl
#define Gput(a,b) G[a].push_back(b)
int main() {
  ll n;
  cin>>n;
  vec s(n);
  loop(i,n){
    cin>>s[i];
  }
  bool z=true;
  ll count=0;
  loop(i,n-1){
    if(count>1){
      z=false;
      break;
    }
    if(s[i]>s[i+1]+1){
      z=false;
      break;
    }
    if(s[i]>s[i+1]){
      count++;
      continue;
    }
    if(s[i]<s[i+1]&&count>0){
      count=0;
      continue;
    }
    
  }
 if(count>1){
      z=false;
    }
 if(z)putout("Yes");
  else putout("No");
 
 
 
 
}


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

int main(){
  int n;
  cin >> n;
  int a[n],b[n];
  for(int i=0;i<n;i++) cin >> a[i];
  for(int i=0;i<n;i++) cin >> b[i];
  int ans=0;
  for(int i=0;i<n;i++){
    if(a[i]>b[i]){
      ans+=(a[i]-b[i]);
    }
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
#include<stdio.h>
#include<stdlib.h>

int main(void){
    int N,R;
    int ans;

    scanf("%d",&N);
    scanf("%d",&R);

    if(N>=10){
        printf("%d",R);
    }else{
        printf("%d",R+(100*(10-N)));
    }

    return 0;
}

Measured memory_bytes: 128
class UnionFind():
    # 作りたい要素数nで初期化
    # 使用するインスタンス変数の初期化
    def __init__(self, n):
        self.n = n
        # root[x]<0ならそのノードが根かつその値が木の要素数
        # rootノードでその木の要素数を記録する
        self.root = [-1]*(n+1)
        # 木をくっつける時にアンバランスにならないように調整する
        self.rnk = [0]*(n+1)

    # ノードxのrootノードを見つける
    def Find_Root(self, x):
        if(self.root[x] < 0):
            return x
        else:
            # ここで代入しておくことで、後の繰り返しを避ける
            self.root[x] = self.Find_Root(self.root[x])
            return self.root[x]
    # 木の併合、入力は併合したい各ノード
    def Unite(self, x, y):
        # 入力ノードのrootノードを見つける
        x = self.Find_Root(x)
        y = self.Find_Root(y)
        # すでに同じ木に属していた場合
        if(x == y):
            return
        # 違う木に属していた場合rnkを見てくっつける方を決める
        elif(self.rnk[x] > self.rnk[y]):
            self.root[x] += self.root[y]
            self.root[y] = x

        else:
            self.root[y] += self.root[x]
            self.root[x] = y
            # rnkが同じ（深さに差がない場合）は1増やす
            if(self.rnk[x] == self.rnk[y]):
                self.rnk[y] += 1
    # xとyが同じグループに属するか判断
    def isSameGroup(self, x, y):
        return self.Find_Root(x) == self.Find_Root(y)

    # ノードxが属する木のサイズを返す
    def Count(self, x):
        return -self.root[self.Find_Root(x)]

n, m = map(int, input().split())
bridges = [map(int, input().split()) for _ in range(m)]
nodes = [[] for _ in range(n)] # いける島のリスト
ans = n*(n-1)//2
ans_list = []
u = UnionFind(n)
for i in range(m):
    ans_list.append(ans)
    # 順番に橋をかけていく
    a, b = bridges[-(i+1)]
    if u.isSameGroup(a, b):
        continue
    else:
        ans -= u.Count(a)*u.Count(b)
        u.Unite(a, b)

# print(nodes)
for i in range(m):
    print(ans_list[-i-1])


Measured memory_bytes: 58788
#include <bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define R cin>>
#define Z class
#define ll long long
#define ln cout<<'\n'
#define in(a) insert(a)
#define pb(a) push_back(a)
#define pd(a) printf("%.10f\n",a)
#define mem(a) memset(a,0,sizeof(a))
#define all(c) (c).begin(),(c).end()
#define iter(c) __typeof((c).begin())
#define rrep(i,n) for(ll i=(ll)(n)-1;i>=0;i--)
#define REP(i,m,n) for(ll i=(ll)(m);i<(ll)(n);i++)
#define rep(i,n) REP(i,0,n)
#define tr(it,c) for(iter(c) it=(c).begin();it!=(c).end();it++)
template<Z A>void pr(A a){cout<<a;ln;}
template<Z A,Z B>void pr(A a,B b){cout<<a<<' ';pr(b);}
template<Z A,Z B,Z C>void pr(A a,B b,C c){cout<<a<<' ';pr(b,c);}
template<Z A,Z B,Z C,Z D>void pr(A a,B b,C c,D d){cout<<a<<' ';pr(b,c,d);}
template<Z A>void PR(A a,ll n){rep(i,n){if(i)cout<<' ';cout<<a[i];}ln;}
ll check(ll n,ll m,ll x,ll y){return x>=0&&x<n&&y>=0&&y<m;}
const ll MAX=1e9+7,MAXL=1LL<<61,dx[4]={-1,0,1,0},dy[4]={0,1,0,-1};
typedef pair<ll,ll> P;

void Main() {
  ll n,m;
  cin >> n >> m;
  ll dp[n+2],a[n+2];
  mem(dp);
  mem(a);
  rep(i,m) {
    ll x;
    R x;
    a[x]=1;
  }
  dp[0]=1;
  rep(i,n) {
    if(!a[i+1]) {
      dp[i+1]+=dp[i];
      dp[i+1]%=MAX;
    }
    if(!a[i+2]) {
      dp[i+2]+=dp[i];
      dp[i+2]%=MAX;
    }
  }
  pr(dp[n]);
}

int main(){ios::sync_with_stdio(0);cin.tie(0);Main();return 0;}


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

pub 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")
}

fn main() {
  let n = read::<i64>();
  let m = read::<u32>();
  let two: i32 = 2;

  println!(
    "{}",
    ((1900 * m) + (100 * (n - m as i64) as u32)) as u32 * two.pow(m) as u32
  );
}

Measured memory_bytes: 4352
import java.util.*;
public class Main{
public static void main(String[]args){
Scanner sc=new Scanner(System.in);
  int a=sc.nextInt();
  int b=sc.nextInt();
  int c=sc.nextInt();
  int d=sc.nextInt();
  System.out.println((Math.min(b,d)-Math.max(a,c)<0)?0:Math.min(b,d)-Math.max(a,c));
}
}

Measured memory_bytes: 23252
n = int(input())
a = []
for i in range(n):
  a.append(list(map(int,input().split())))

a.sort(key=lambda x: x[1])

q = 0
w = 0
flg = 0
for j in a:
  q += j[0]
  w = j[1]
  if q > w :
    flg = 1
    break

if flg == 0:
  print('Yes')
else:
  print('No')
  

Measured memory_bytes: 53720
#import sys
MOD = 10 ** 9 + 7
INFI = 10**10
#input = sys.stdin.readline
import math
from collections import deque
import itertools
import heapq
#import bisect
from fractions import Fraction
import copy
from functools import lru_cache
from collections import defaultdict
import pprint

#oo=list("ABCDEFGHIJKLMNOPQRSTUVWXYZ")
# ko=list("abcdefghijklmnopqrstuvwxyz")

def sosuhante(n):
    for k in range(2, int(math.sqrt(n))+1):
        if n% k ==0:
            return False
    return True
def cmb(n, r):
    if n - r < r: r = n - r
    if r == 0: return 1
    if r == 1: return n

    numerator = [n - r + k + 1 for k in range(r)]
    denominator = [k + 1 for k in range(r)]

    for p in range(2,r+1):
        pivot = denominator[p - 1]
        if pivot > 1:
            offset = (n - r) % p
            for k in range(p-1,r,p):
                numerator[k - offset] /= pivot
                denominator[k] /= pivot

    result = 1
    for k in range(r):
        if numerator[k] > 1:
            result *= int(numerator[k])

    return result

def kingaku(a,b,n):
    keta=len(str(n))
    return a*n+b*keta

def my_index(l, x, default=False):
    if x in l:
        return l.index(x)
    else:
        return default

#    h,w,a,b = map(int, input().split())
#    c = [[0 for j in range(n)] for i in range(n)]

def ret(a):
    c=[None]*(len(a)-1)
    if len(a)==1:
        return a[0]
    elif len(a)==0:
        return 0
    for i in range(1,len(a)):
        c[i-1]=abs(a[i]-a[i-1])
    return ret(c)

def soinsubunkai(n):
    a = []
    i = 1
    while i*i <= n:
        if n % i == 0 and i!=1:
            a.append(i)
            n=n//i

        if n% i !=0 or i==1:
            i += 1
    nokori=[n]
    return a + nokori

def make_divisors(n):
    lower_divisors , upper_divisors = [], []
    i = 1
    while i*i <= n:
        if n % i == 0:
            lower_divisors.append(i)
            if i != n // i:
                upper_divisors.append(n//i)
        i += 1
    return lower_divisors + upper_divisors[::-1]

def main():
    n,m=map(int,input().split())
    graph=[[] for _ in range(n+1)]
    for i in range(m):
        a,b,c=map(int,input().split())
        graph[a].append(b)
        graph[b].append(a)
    stack=[]
    visited=[0 for _ in range(n+1)]

    zones=0
    count=0
    def DFS():
        c=1
        while True:
            if len(stack)==0:
                break
            s=stack.pop()
            if visited[s]==0:
                for i in graph[s]:
                    if visited[i]==0:
                        stack.append(i)

                visited[s]=1
                c+=1
            if len(stack)==0:
                break
        return c
    for i in range(1,n+1):
        if visited[i]==0:
            visited[i]=1
            for j in graph[i]:
                stack.append(j)
            if len(stack)>0:
                count+=DFS()
                zones += 1
        else:
            continue

#    print(n,count,zones)
    print(n-count+zones)





if __name__ == "__main__":

    main()

Measured memory_bytes: 29384
#include <iostream>

using namespace std;

string s;

void solve() {
  int i = 0;
  while (i < s.size()) {
    int r = 0;
    int l = 0;
    while (s[i] == 'R') {
      r++;
      i++;
    }
    while (i < s.size() && s[i] == 'L') {
      l++;
      i++;
    }
    for (int j=0;j<r-1;j++) {
      cout << 0 << " ";
    }
    cout << ((r + 1) / 2 + l / 2) << " ";
    cout << (r / 2 + (l + 1) / 2) << " ";
    for (int j=0;j<l-1;j++) {
      cout << 0 << " ";
    }
  }
  cout << endl;
}

int main() {
  cin >> s;
  solve();
}


Measured memory_bytes: 768
#include<bits/stdc++.h>
#define forr(i, a, b) for(int i = (a); i < (b); i++)
#define rep(i,n) for(int i = 0; i < (n); i++)
#define rrep(i,n) for(int i = 1; i <= (n); i++)
#define ALL(a) (a.begin()),(a.end())
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef pair<ll, ll> LP;
const ll LINF = 1LL<<60;
const int INF = 1001001001;
const int MOD = 1000000007;

/* --------------------------------------------------- */

double solve(int x1, int y1, int x2, int y2) {
  double a = x2 - x1, b = y2 - y1;
  return sqrt(a * a + b * b); 
}

int main() {
  int n;
  cin >> n;
  vector<P> A(n);
  rep(i, n) {
    cin >> A[i].first >> A[i].second;
  }
  vector<int> order(n);
  rep(i, n) order[i] = i;

  int cnt = 1;
  rrep(i, n) {
    cnt *= i;
  }
  double ans = 0;
  do {
    double tot = 0;
    rep(i, n - 1) {
      int k1 = order[i], k2 = order[i + 1];
      tot += solve(A[k1].first, A[k1].second, A[k2].first, A[k2].second);
    }
    ans += tot;
  } while (next_permutation(order.begin(), order.end()));

  printf("%.10f\n", ans / cnt);
  return 0;
}

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

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

    vector<int> count (n);
    for (int i = 0; i < n-1; i++) {
        int a;
        cin >> a;
        count[a-1]++;
    }

    for (int i = 0; i < n; i++) {
        cout << count[i] << "\n";
    }
}

Measured memory_bytes: 4048
#include<iostream>
#include<cmath>
#include<cstdlib>
#include<string>
#include<cstring>
#include<algorithm>
#include<vector>
#include<map>

using namespace std;

typedef long long ll;

typedef std::pair<int, int> ipair;
bool lessPair(const ipair& l, const ipair& r){return l.second < r.second;}
bool morePair(const ipair& l, const ipair& r){return l.second > r.second;}

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 MOD = 1e9 + 7;
void add(long long &a, long long b) { a += b; if (a >= MOD) a -= MOD; }

int main() {
   int x, a;
   cin >> x >> a;
   if (x < a) cout << "0" << endl;
   else cout << "10" << endl;
   return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define st first
#define nd second
#define mp make_pair
#define pb push_back
#define N 1000005
using namespace std;

int a[5];

int main() {
	// freopen("in.txt", "r", stdin);
	// freopen("out.txt", "w", stdout);
	for(int i = 1; i <= 3; i++){scanf(" %d",a+i);}
	sort(a + 1, a + 3 + 1);
	printf("%d\n",a[3] - a[1]);
	// for(int i = 1; i <= 3; i++)
	// 	for(int j = 1; j <= 3; j++)
	// 		for(int k = 1; k <= 3; k++)
	// 			if(i != j and k != j and k != i){
	// 				ans = min(ans, abs(a[i] - a[j]) + abs(a[j] - a[k]));
	// 			}
	// printf("%d\n",ans);
	return 0;
}

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

int main(){
  int a = 0, d = 0, n = 0;
  int sum = 0;
  
  while(1){
    int count = 0;
    cin >> a >> d >> n;
    if(a == 0 && d == 0 && n == 0) break;
    sum = a;
    while(1){
      if(sum == 2){
        count++;
      }
      else if(sum > 2){
        bool flag = true;
        if(sum % 2 == 0) flag = false;
        for(int i = 3; i <= sqrt(sum); i += 2){
          if(sum % i == 0){
            flag = false;
            break;
          }
        }
        if(flag) count++;
      }

      if(count == n) break;
      sum += d;
    }
    cout << sum << endl;
  }
  
  return 0;
}

Measured memory_bytes: 2980
def main():
    R,G,B,N=map(int, input().split())
    ans=0
    for r in range(N//R+1):
        for g in range((N-r*R)//G+1):
            if (N-r*R-g*G)%B==0:
                ans+=1
    print(ans)

if __name__ == "__main__":
    main()

Measured memory_bytes: 3060
package main
 
import (
	"bufio"
	"os"
	"strconv"
	"fmt"
)
 
var sc = bufio.NewScanner(os.Stdin)
 
func init() {
	sc.Split(bufio.ScanWords)
	sc.Buffer(make([]byte, 1024*1024), bufio.MaxScanTokenSize)
}
 
//func nextString() string {
//	sc.Scan()
//	return sc.Text()
//}
 
func nextInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

func main() {
	N := nextInt()
	ANS := 0
	l := make([]int, N)
	for i := 0; i < N - 1; i++ {
		l[i] = nextInt()
	}
	for i := 0; i < N - 2; i++ {
		ANS = ANS + min(l[i], l[i+1])
	}
	ANS = ANS + l[N-2] + l[0]
	fmt.Println(ANS)
}

func min(a, b int) int {
	if a < b {
		return a
	} else {
		return b
	}
}


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

int main() {
	int a;
	cin>>a;
	if(a==25){
		cout<<"Christmas"<<endl;
	}
	else if(a==24){
		cout<<"Christmas Eve"<<endl;
	}
	else if(a==23){
		cout<<"Christmas Eve Eve"<<endl;
	}
	else if(a==22){
		cout<<"Christmas Eve Eve Eve"<<endl;
	}
}


Measured memory_bytes: 256
using System;
using System.Text;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Threading.Tasks;
using System.IO;

class Solve
{
	const int mod = 1000000007;
	static void Main(string[] args)
	{
        var sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
		Console.SetOut(sw);

		var input = Console.ReadLine().Split().Select(int.Parse).ToArray();
		int N = input[0];
		int M = input[1];
		List<List<int>> island = new List<List<int>>();
        for(var i = 0; i < N; i++)
		{
			island.Add(new List<int>());
		}
        for(var i = 0; i < M; i++)
		{
			var route = Console.ReadLine().Split().Select(int.Parse).ToArray();
			island[route[0] - 1].Add(route[1] - 1);
			island[route[1] - 1].Add(route[0] - 1);
		}

		string ans = "IMPOSSIBLE";
        for(var i = 0; i < N; i++)
		{
			if (island[i].Contains(0) && island[i].Contains(N - 1))
			{
				ans = "POSSIBLE";
				break;
			}
		}

		Console.WriteLine(ans);

		Console.Out.Flush();
	}
}

Measured memory_bytes: 37900
x1,x2,x3,x4,x5 = map(int,input().split())
if x1 == 0:
  print(1)
elif x2 == 0:
  print(2)
elif x3 == 0:
  print(3)
elif x4 == 0:
  print(4)
elif x5 == 0:
  print(5)

Measured memory_bytes: 9168
#include <iostream>
#include <string>
typedef long long ll;
//#include <algorithm>
using namespace std;

int main() {
  int A,B;
  cin >> A >> B;

  if(A == B){
    cout << 2 * A << endl;
  }else{
    int num = max(A,B);
    cout << 2 * num - 1 << endl;
  }


}


Measured memory_bytes: 256
c = [list(map(int,input().split())) for _ in range(3)]
#%%
b = [0]*3
N = max(max(c))+1

for a1 in range(N):
    for a2 in range(N):
        for a3 in range(N):
            b[0] = c[0][0]-a1
            b[1] = c[0][1]-a1
            b[2] = c[0][2]-a1
            flag = True
            nb = [0]*3
            for i in range(3):
                nb[i] = c[1][i]-a2
                if nb[i]!=b[i]:
                    flag = False
                    break
            for i in range(3):
                nb[i] = c[2][i]-a3
                if nb[i]!=b[i]:
                    flag = False
                    break
            
            if flag:
                import sys
                print('Yes')
                sys.exit()

            
print('No')            
            

Measured memory_bytes: 3064
#include<bits/stdc++.h>
#define rep(i,j,n) for(int i=(j);i<(n);i++)
#define per(i,n,j) for(int i=(n)-1;i>=(j);i--)
using ll=long long;
using namespace std;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const ll INF=1LL<<60;

vector<vector<int>> c(3,vector<int>(3));

int main(){
    rep(i,0,3) rep(j,0,3) cin>>c[i][j];
    bool flag=true;

    rep(i,1,3){
        if(c[0][i]-c[0][i-1]!=c[1][i]-c[1][i-1] || c[2][i]-c[2][i-1]!=c[1][i]-c[1][i-1]){
            flag=false;
            break;
        }
        if(c[i][0]-c[i-1][0]!=c[i][1]-c[i-1][1] || c[i][2]-c[i-1][2]!=c[i][1]-c[i-1][1]){
            flag=false;
            break;
        }
    }
    if(flag) cout<<"Yes"<<"\n";
    else cout<<"No"<<"\n";
    return 0;
}


Measured memory_bytes: 3628
#include<stdio.h>

int main(){
	int p[14][14];
	int x,y,s;
	int i,j,k;
	int ans=0;
	int strong=0;
	for(i=0;i<14;i++){
		for(j=0;j<14;j++){
			p[i][j] = 0;//初期化
		}
	}
	while(~scanf("%d,%d,%d",&x,&y,&s)){
		x=x+2;y=y+2;//ズレを解消
		switch(s){
			case 3:p[x+2][y]++;p[x][y+2]++;p[x-2][y]++;p[x][y-2]++;
			case 2:p[x+1][y+1]++;p[x+1][y-1]++;p[x-1][y-1]++;p[x-1][y+1]++;
			case 1:p[x][y]++;p[x+1][y]++;p[x-1][y]++;p[x][y+1]++;p[x][y-1]++;break;
		}
	}
	for(i=2;i<12;i++){
		for(j=2;j<12;j++){
			if(p[i][j]==0){
				ans++;
			}
			if(strong<p[i][j]){
				strong=p[i][j];
			}
		}
	}
	printf("%d\n",ans);
	printf("%d\n",strong);
	
	return 0;
}

Measured memory_bytes: 600
#include <iostream>
#include <vector>
#include <array>
#include <list>
#include <queue>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <string>
#include <sstream>
#include <algorithm>
#include <random>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <cmath>
#include <cassert>
#include <climits>
#include <thread>

#define FOR_LT(i, beg, end) for (int i = beg; i < end; i++)
#define FOR_LE(i, beg, end) for (int i = beg; i <= end; i++)

using namespace std;

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

	if (e - a <= k) {
		cout << "Yay!" << endl;
	}
	else {
		cout << ":(" << endl;
	}

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;++i)
#define all(x) (x).begin(),(x).end()
using namespace std;
const int INF=1145141919,MOD=1e9+7;
const int64_t LINF=8931145141919364364,LMOD=998244353;
// const int dy[]={0,-1,0,1,1,-1,-1,1};
// const int dx[]={1,0,-1,0,1,1,-1,-1};

int main() {
	string s; cin >> s;
	int n = s.size();
	for(int i = 0; i < n; ++i) {
		if(s[i] != s[n - 1 - i]) {
			cout << "No" << '\n';
			return 0;
		}
	}
	for(int i = 0; i <= (n - 1) / 2 - 1; ++i) {
		if(s[i] != s[(n - 1) / 2 - 1 - i]) {
			cout << "No" << '\n';
			return 0;
		}
	}
	for(int i = (n + 3) / 2 - 1; i < n; ++i) {
		// cerr << s[i] << " " << s[(n - 1) - i] << '\n';
		if(s[i] != s[(n - 1) - i]) {
			cout << "No" << '\n';
			return 0;
		}
	}
	cout << "Yes" << '\n';
	return 0;
}

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

typedef long long ll;
//loop
#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=a;i<=(ll)(b);i++)
#define FORD(i,a,b) for(ll i=a;i>=(ll)(b);i--)
//STL
#define ALL(x) (x).begin(),(x).end()
#define SIZE(x) ((ll)(x).size())
#define MAX(x) *max_element(ALL(x))
#define MIN(x) *min_element(ALL(x))

//const
#define MOD 1000000007 //10^9+7:合同式の法

//acronym
#define PB push_back //vectorヘの挿入
#define MP make_pair //pairのコンストラクタ
#define F first //pairの一つ目の要素
#define S second //pairの二つ目の要素

void Main() {
    int n;
    cin >> n;
    cout << "ABC" << n << endl;
}

int main() {
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	Main();
	return 0;
}


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

public class AtCoder
{

    public static int[] ReadArray()
    {
        return Array.ConvertAll(Console.ReadLine().Split(' '), m => Convert.ToInt32(m));
    }

    public static int ReadInt()
    {
        return Convert.ToInt32(Console.ReadLine());
    }

    public static string ReadStr()
    {
        return Console.ReadLine();
    }

    public static long ReadLong()
    {
        return Convert.ToInt64(Console.ReadLine());
    }

    public static long[] ReadLongArray()
    {
        return Array.ConvertAll(Console.ReadLine().Split(' '), m => Convert.ToInt64(m));

    }


    public static void Main()
    {

        int n = ReadInt();

        int[,] dp = new int[3, n];

        for (int i = 0; i < n; i++)
        {
            int[] A = ReadArray();
            int a = A[0], b = A[1], c = A[2];

            if (i == 0)
            {
                dp[0, i] = a;
                dp[1, i] = b;
                dp[2, i] = c;
            }
            else
            {
                dp[0, i] = a + Math.Max(dp[1, i - 1], dp[2, i - 1]);
                dp[1, i] = b + Math.Max(dp[0, i - 1], dp[2, i - 1]);
                dp[2, i] = c + Math.Max(dp[0, i - 1], dp[1, i - 1]);
            }
        }

        Console.WriteLine(Math.Max(Math.Max(dp[0, n - 1], dp[1, n - 1]), dp[2, n - 1]));


        
       









    }


}


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

int main() {
  int a,b,c;
  cin>>a>>b>>c;
  cout<<max(c-(a-b),0)<<endl;
  return 0;
}



Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main(){
	int cards[10][15];
	for (int j = 0; j < 15; j++){
		for (int i = 0; i < 10; i++){
				cards[i][j] = 0;
			}
		}
	int n;
	cin >> n;
	for (int h = 0; h < n; h++){
		int b, f, r, v;
		cin >> b >> f >> r >> v;
		if (b == 1){
			cards[r - 1][f - 1] +=v ;
		}
		if (b == 2){
			cards[r - 1][f + 3] += v;
		}
		if (b == 3){
			cards[r - 1][f + 7] += v;
		}
		if (b == 4){
			cards[r - 1][f + 11] += v;
		}
	}
	for (int j = 0; j < 15; j++){
		for (int i = 0; i < 10; i++){
			if ((j + 1) % 4 == 0 && j >= -1){
				cout << "#" << "#";
			}
			else{ cout << ' ' << cards[i][j]; }
		}
		cout << endl;
	}
	return 0;
}


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

#define rng(i, a, b) for (int i = int(a); i < int(b); i++)
#define rep(i, b) rng(i, 0, b)
#define gnr(i, a, b) for (int i = int(b) - 1; i >= int(a); i--)
#define per(i, b) gnr(i, 0, b)

using namespace std;

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

int main() {
  int n, m;
  cin >> n >> m;
  vector<int> h(n);
  rep(i, n) cin >> h[i];
  vector<int> a(m), b(m);
  rep(i, m) {
    int aa, bb;
    cin >> aa >> bb;
    aa--;
    bb--;
    a[i] = aa;
    b[i] = bb;
  }
  vector<vector<int>> nears(n, vector<int>());
  rep(i, m) {
    int aa = a[i];
    int bb = b[i];
    nears[aa].push_back(bb);
    nears[bb].push_back(aa);
  }
  int res = 0;
  rep(i, n) {
    vector<int> near = nears[i];
    int height = h[i];
    bool good = true;
    rep(j, near.size()) {
      if (height <= h[near[j]]) {
        good = false;
      }
    }
    if (good) {
      res++;
    }
  }
  cout << res << endl;
  return 0;
}


Measured memory_bytes: 9676
let inp_loop_index : (int -> 'a) -> int -> 'a list = fun inp_fun n ->
  let rec loop i =
    if i = n then []
    else
      let x = inp_fun i in
      x :: loop (i + 1)
  in loop 0
    
let () =
  let n = int_of_string (input_line stdin) in
  let l = inp_loop_index (fun i -> Scanf.sscanf (input_line stdin) "%s %d" (fun s p -> (i + 1, s, p))) n in
  let l' = List.sort (fun (i1, s1, p1) (i2, s2, p2)->
               if s1 > s2 then 1
               else if s1 < s2 then -1
               else if p1 > p2 then -1
               else if p1 < p2 then 1
               else 0) l in
  List.iter
    (fun (i, s, p) ->
      print_int i;
      print_newline ()) l'


Measured memory_bytes: 640
package main

import (
	"fmt"
)

func main() {
	var l, r int
	fmt.Scan(&l, &r)
	num := l % 2019

	if r >= l + 2019 - num {
		fmt.Println(0)
	} else {
		result := 2019
		for i := num; i < r-l+num; i++ {
			for j := i+1; j < r-l+num+1; j++ {
				if result > i*j%2019 {
					result = i*j%2019
				}
			}
		}
		fmt.Println(result)
	}
}


Measured memory_bytes: 512
// https://atcoder.jp/contests/

#include <iostream>
using namespace std;

int main()
{
  /* Magic word */
  cin.tie(0);
  ios::sync_with_stdio(false);
  /* ---------- */

  int a, b;
  string r;

  cin >> a >> b;

  r = (a % 3) * (b % 3) * ((a + b) % 3) == 0 ? "Possible" : "Impossible";

  cout << r << '\n';

  return 0;
}


Measured memory_bytes: 256
import Data.List (findIndex)
import Data.Maybe (fromJust)

main = (+2) . fromJust . solve <$> readLn >>= print

solve a = findIndex f $ fmap (`take` collatz a) [2..]
    where
        f x = let y = reverse x in head y `elem` tail y

collatz a = fmap ($ a) <$> scanl (.) id $ repeat f
    where
        f n | even n = div n 2
            | otherwise = 3*n+1

Measured memory_bytes: 1020
#include <bits/stdc++.h>
#define repeat(i, n) for(int (i) = 0; i < (n); i++)
using namespace std;
typedef long long ll;
const double EPS = numeric_limits<double>::epsilon();

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

	map<string, int> dic;

	for(int i = 0; i < s.length(); i++) {
		string a = s.substr(i, s.length());
		auto itr = dic.find(a);
		string end;
		int idx = 0;

		for(auto it: dic) {
			if (idx == K-1) {
				end = it.first;
				break;
			}
			idx++;
		}

		if (dic.size() > 5) {
			if (end.compare(a) < 0) continue;
		}
		if (itr != dic.end()) continue;

		for(int j = 1; j <= s.length() - i; j++) {
			string a = s.substr(i, j);
			auto itr = dic.find(a);
			dic[a]++;
		}
	}

	int idx = 0;
	for(auto it: dic) {
		if (idx == K-1) {
			cout << it.first << endl;
		}
		idx++;
	}
	return 0;
}


Measured memory_bytes: 182656
#include <bits/stdc++.h>
using namespace std;
#define dbg(x) #x "=" << x << " "
#define fore(i,a,b) for(int i=a,gon=b;i<gon;++i)
#define pb push_back
#define F first
#define S second
typedef double lf;
typedef long long ll;
typedef pair<int, int> pii;

int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    #ifdef LOCAL
        freopen("in.txt", "r", stdin);
        //freopen("out.txt", "w", stdout);
    #else
        #define endl '\n'
    #endif
    int n, a;
    cin >> n;
    map<int, int> mp;
    fore(i,0,n) {
        cin >> a;
        mp[a-1]++;
        mp[a]++;
        mp[a+1]++;
    }
    int mx = 0;
    for (auto &x : mp) {
        mx = max(mx, x.S);
    }
    cout << mx << endl;
}


Measured memory_bytes: 4736
#include <iostream>

using namespace std;

int main(void)
{
    string day;

    cin >> day;

    if(day == "SUN"){
        cout << 7;
    }else if(day == "MON"){
        cout << 6;
    }else if(day == "TUE"){
        cout << 5;
    }else if(day == "WED"){
        cout << 4;
    }else if(day == "THU"){
        cout << 3;
    }else if(day == "FRI"){
        cout << 2;
    }else if(day == "SAT"){
        cout << 1;
    }

    cout << endl;

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  string s,t;
  cin >> s >> t;
  bool n = true;
  for (int i=0; i<size(s); i++){
    if(s.at(i) == t.at(i))
      continue;
    else{
      n = false;
      break;
    }
  }
  if(n)
    cout << "Yes";
  else
    cout << "No";
}

Measured memory_bytes: 3624
package main

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

const (
	initialBufSize = 1e4
	maxBufSize     = 1e6 + 7
)

var buf []byte = make([]byte, maxBufSize)
var sc = bufio.NewScanner(os.Stdin)

func init() {
	sc.Split(bufio.ScanWords)
	sc.Buffer(buf, maxBufSize)
}

func main() {
	M1, _, M2, _ := nextInt(), nextInt(), nextInt(), nextInt()
	if M1 == M2 {
		fmt.Println(0)
	} else {
		fmt.Println(1)
	}
}

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

func nextInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

func abs(a int) int {
	if a > 0 {
		return a
	} else {
		return -a
	}
}

func pow(p, q int) int {
	res := p
	if q == 0 {
		return 1
	}
	for i := 0; i < q-1; i++ {
		res *= p
	}
	return res
}

func MinOf(vars ...int) int {
	min := vars[0]
	for _, i := range vars {
		if min > i {
			min = i
		}
	}
	return min
}

func MaxOf(vars ...int) int {
	max := vars[0]
	for _, i := range vars {
		if max < i {
			max = i
		}
	}
	return max
}

func gcdof2numbers(a int, b int) int {
	if b == 0 {
		return a
	}
	return gcdof2numbers(b, a%b)
}

func lcmof2numbers(a int, b int) int {
	return a / gcdof2numbers(a, b) * b
}

// マイナスの場合は考慮していない
func fuctorial(a int) int {
	if a == 1 || a == 0 {
		return 1
	} else {
		return fuctorial(a-1) * a
	}
}

func NextPermutation(x sort.Interface) bool {
	n := x.Len() - 1
	if n < 1 {
		return false
	}
	j := n - 1
	for ; !x.Less(j, j+1); j-- {
		if j == 0 {
			return false
		}
	}
	l := n
	for !x.Less(j, l) {
		l--
	}
	x.Swap(j, l)
	for k, l := j+1, n; k < l; {
		x.Swap(k, l)
		k++
		l--
	}
	return true
}

// 素因数分解したmapを返す
func primeFuctorize(n int) map[int]int {
	pf := map[int]int{}
	for i := 2; i*i <= n; i++ {
		for n%i == 0 {
			pf[i]++
			n /= i
		}
	}
	if n != 1 {
		pf[n]++
	}
	return pf
}

// ここから拝借
// https://shoman.hatenablog.com/entry/2020/02/25/185456
// Stackは[]intのエイリアス
type Stack []int

// Push adds an element
func (s *Stack) Push(v int) {
	*s = append(*s, v)
}

// Pop removes the top element and return it
func (s *Stack) Pop() (int, error) {
	if s.Empty() {
		return 0, fmt.Errorf("stack is empty")
	}

	v := (*s)[len(*s)-1]
	*s = (*s)[:len(*s)-1]
	return v, nil
}

// Peek returns the top value
func (s *Stack) Peek() (int, error) {
	if s.Empty() {
		return 0, fmt.Errorf("stack is empty")
	}

	return (*s)[len(*s)-1], nil
}

// Size returns the length of stack
func (s *Stack) Size() int {
	return len(*s)
}

// Empty returns true when stack is empty
func (s *Stack) Empty() bool {
	return s.Size() == 0
}

// NewStack generates stack
func NewStack() *Stack {
	s := new(Stack)
	return s
}


Measured memory_bytes: 1808
#include <bits/stdc++.h>
#define IO_OP std::ios::sync_with_stdio(0); std::cin.tie(0);
#define F first
#define S second
#define PB push_back
#define MP make_pair
#define EB emplace_back

using namespace std;

typedef long long ll;
typedef pair<int, int> pi;
typedef vector<int> vi;

const int INF = 1e9 + 7;

int main()
{
	IO_OP;
	
	int n, x, s = 0, ans = 0;
	cin >> n >> x;
	for(int i=0;i<n;i++) {
		if(s <= x) ans++;
		int t;
		cin >> t;
		s += t;
	}
	
	if(s <= x) ans++;
	cout << ans << endl;
}



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

int main() {
    int N;
    cin >> N;
    vector<int> X(N), Y(N), H(N);
    int able_h = 0;
    for (int i = 0; i < N; i++) {
        cin >> X[i] >> Y[i] >> H[i];
        if (H[i] > 0) {
            able_h = i;
        }
    }

    for (int cx = 0; cx <= 100; cx++) {
        for (int cy = 0; cy <= 100; cy++) {
            int h = abs(X[able_h] - cx) + abs(Y[able_h] - cy) + H[able_h];
            bool flag = true;
            for (int i = 0; i < N; i++) {
                if (max(h - abs(X[i] - cx) - abs(Y[i] - cy), 0) != H[i]) {
                    flag = false;
                    break;
                }
            }
            if (flag) {
                cout << cx << " " << cy << " " << h << endl;
                return 0;
            }
        }
    }
}

Measured memory_bytes: 256
n = int(input())
strings = [input() for i in range(n)]

cnt_ac = 0
cnt_wa = 0
cnt_tle = 0
cnt_re = 0
for s in strings:
  if s == 'AC':
    cnt_ac +=1
  elif s == 'WA':
    cnt_wa +=1
  elif s == 'TLE':
    cnt_tle +=1
  elif s == 'RE':
    cnt_re +=1

print('AC x ' +str(cnt_ac))
print('WA x ' +str(cnt_wa))
print('TLE x ' +str(cnt_tle))
print('RE x ' +str(cnt_re))



Measured memory_bytes: 16328
#include <iostream>
#include <iomanip>
#include <map>
#include <vector>
#include <utility>

using namespace std;

int main() {
    int N, M;
    cin >> N >> M;
    
    map<int, map<long long int, int> > mp;
    vector<pair<int, long long int> > vec(M);
    for(int m=0; m<M; m++) {
        cin >> vec[m].first >> vec[m].second;
        mp[vec[m].first][vec[m].second];
    }
    
    for(auto itr=mp.begin(); itr!=mp.end(); itr++) {
        int cnt=1;
        for(auto jtr=itr->second.begin(); jtr!=itr->second.end(); jtr++) {
            jtr->second = cnt;
            cnt++;
        }
    }
    for(int m=0; m<M; m++) {
        cout << setw(6) << setfill('0') << vec[m].first;
        cout << setw(6) << setfill('0') << mp[vec[m].first][vec[m].second] << endl;
    }

    return 0;
    
}

Measured memory_bytes: 18688
#include <iostream>
#include <vector>
#include <utility>
#include <algorithm>
#include <cmath>
#include <string>
#include <map>

#define pb push_back
#define mp make_pair

using namespace std;

typedef vector<int> vi;
typedef pair<int, int> ii;
typedef vector<ii> vii;
typedef unsigned long long ull;
typedef long long ll;

int main() {
  int n;
  cin >> n;
  
  int a, b;
  a = b = 1;
  
  while (n--) {
    int k;
    cin >> k;
    
    a *= 3;
    if (k % 2 == 0) {
      b *= 2;
    }
  }
  
  cout << a-b << endl;
  return 0;
}

Measured memory_bytes: 3636
use proconio::{fastout, input, marker::Usize1};

pub struct AdjList {
    dim: usize,
    list: Vec<Vec<usize>>,
}

impl AdjList {
    pub fn new(d: usize) -> AdjList {
        AdjList {
            dim: d,
            list: vec![vec![]; d],
        }
    }

    pub fn dim(&self) -> usize {
        self.dim
    }

    pub fn add_edge(&mut self, from: usize, to: usize) {
        self.list.get_mut(from).unwrap().push(to);
    }

    pub fn add_undirected_edge(&mut self, from: usize, to: usize) {
        self.list.get_mut(from).unwrap().push(to);
        self.list.get_mut(to).unwrap().push(from);
    }

    pub fn out_edges(&mut self, vertex: usize) -> Vec<usize> {
        self.list.get_mut(vertex).unwrap().to_vec()
    }

    pub fn in_edges(&mut self, v: usize) -> Vec<usize> {
        let mut res = vec![];
        for l in 0..self.dim() {
            if let Some(list) = self.list.get(l) {
                if list.contains(&v) {
                    res.push(l);
                }
            }
        }

        res
    }
}

#[fastout]
fn main() {
    input! {
        n:usize,
        q:usize,
        abz: [(Usize1, Usize1); n-1],
        px: [(Usize1, usize); q],
    }

    let mut adl = AdjList::new(n);
    for ab in abz {
        adl.add_undirected_edge(ab.0, ab.1);
    }

    let mut visited = vec![false; n];
    let mut cnt = vec![0; n];
    for query in px {
        cnt[query.0] += query.1;
    }

    let mut stack = vec![];
    stack.push(0);
    while !stack.is_empty() {
        let now = stack.pop().unwrap();
        if visited[now] {
            continue;
        }
        visited[now] = true;
        for i in 0..adl.list[now].len() {
            let nxt = adl.list[now][i];
            if !visited[nxt] {
                cnt[nxt] += cnt[now];
                stack.push(nxt);
            }
        }
    }

    for c in cnt {
        println!("{}", c);
    }
}


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

using namespace std;

int main() {
  int N, M, X;
  cin >> N >> M >> X;
  vector<bool> A(N + 1, false);
  for (int i = 0; i < M; i++) {
    int x;
    cin >> x;
    A[x] = true;
  }
  int left = 0;
  int right = 0;

  for (int i = 0; i <= N; i++) {
    if (A[i]) {
      if (i < X) {
        left++;
      } else {
        right++;
      }
    }
  }

  cout << min(left, right);

  return 0;
}


Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.math.BigDecimal;
import java.math.RoundingMode;

class Main {

    public static void main(String[] args) throws Exception {

        try {

            BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

            double input = Double.parseDouble(br.readLine());
            double countOdd = Math.round(input / 2);
            BigDecimal result = new BigDecimal(countOdd / input);
            result.setScale(10, RoundingMode.HALF_UP);

            System.out.println(result);
        } catch (IOException | NumberFormatException e) {
            e.printStackTrace();
            System.exit(0);
        } catch (final Exception e) {
            e.printStackTrace();
            System.exit(0);
        }
    }
}

Measured memory_bytes: 22740