akhauriyash/Code-Regression huggingface dataset:
s = input()
length = 4 # fixed

for bit in range(1<<(length-1)):  # for bit in range(2 ** (length-1)):
  ans = 0
  f = s[0]  
  for i in range(length-1): 
    if bit & (1 << i):   # 0はプラス、1はマイナス
      f += "-"
    else:
      f += "+"
    f += s[i + 1]
  # print('d:',f)
  ans = eval(f)
  
  if ans == 7:
    print(f+'=7')
    exit()

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

int r, c;
bool senbei[10][10000];
bool status[10];

int counter()
{
  int ret = 0;
  for(int i = 0; i < c; i++){
    int b = 0, w = 0;
    for(int j = 0; j < r; j++){
      if(senbei[j][i] ^ status[j])
	w++;
      else
	b++;
    }
    ret += max(b, w);
  }
  
  return ret;
}

int search(int t = 0)
{
  if(t == r)
    return counter();

  int ret = 0;
  status[t] = false;
  ret = search(t + 1);
  status[t] = true;
  ret = max(ret, search(t + 1));
  return ret;
}

int main()
{
  while(cin >> r >> c && (r || c)){
    for(int i = 0; i < r; i++)
      for(int j = 0; j < c; j++)
	cin >> senbei[i][j];

    cout << search() << endl;
  }
  return 0;
}

Measured memory_bytes: 1252
#include "stdio.h"

int main(void)
{
    int a;
    int b;
    int c;
    scanf("%d%d%d",&a,&b,&c);
    if(a == b)
    {
        if(a != c)
            printf("Yes");
        else
            printf("No");
    }

    else if(a == c)
    {
        if(a != b)
            printf("Yes");
        else
            printf("No");
    }

    else if(b == c)
    {
        if(b != a)
            printf("Yes");
        else
            printf("No");
    }

    else
    {
        printf("No");
    }
}

Measured memory_bytes: 128
list_K = []
N,K = map(int,input().split())
for i in range(K):
    d = int(input())
    A = [int(j) for j in input().split()]
    for k in range(d):
        list_K.append(A[k])
list_K0 = list(set(list_K))
list_K0.sort()
list_N = list(range(1,N+1))
set_NK = set(list_N)-set(list_K0)
print(len(set_NK))

Measured memory_bytes: 9200
ii = lambda : int(input())
mi = lambda : map(int,input().split())
li = lambda : list(map(int,input().split()))

n,a,b = mi()
p = 10 **9 + 7
nstr = str(n)
nstr = nstr[::-1]
two_ten = []
two_ten.append(2)
for i in range(1,11):
    ima = two_ten[i-1]
    temp = 1
    for _ in range(10):
        temp = temp*ima % p
    two_ten.append(temp)

ans = 1
for i in range(len(nstr)):
    temp = 1
    for j in range(int(nstr[i])):
        temp = temp * two_ten[i] % p
    ans = ans * temp % p
ans -= 1

#a^-1 (mod P)
def modinv(a, mod=10**9+7):
    return pow(a, mod-2, mod)

#  これは計算量rでncr mod p を求められる。
def combination(n, r, mod=10**9+7):
    r = min(r, n-r)
    res = 1
    for i in range(r):
        res = res * (n - i) * modinv(i+1, mod) % mod
    return res

ans -= combination(n,a)
ans -= combination(n,b)
print(ans % p)



    




Measured memory_bytes: 40172
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, a, b) for (int i = (a); i < (b); i++)
//#include "library/debug.cpp"

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n;
    cin >> n;
    string s;
    cin >> s;
    int ans = 0;
    rep(i, 0, n - 2) {
        if (s.substr(i, 3) == "ABC") ans++;
    }
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256
#if !defined(__clang__) && defined(__GNUC__)
#include <bits/stdc++.h>
#else
#include <cstdlib>
#include <climits>
#include <iostream>
#include <cstdint>
#include <vector>
#include <string>
#include <complex>
#include <bitset>
#include <queue>
#include <deque>
#include <stack>
#include <utility>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <regex>
#endif //  !defined(__clang__) && defined(__GNUG__)
#include <boost/lexical_cast.hpp>
#include <boost/algorithm/string.hpp>
#include <boost/multi_array.hpp>
#include <boost/optional.hpp>
#include <boost/math/common_factor_rt.hpp>  // https://boostjp.github.io/tips/math.html
#include <boost/dynamic_bitset.hpp>  // https://boostjp.github.io/tips/dynamic_bitset.html

constexpr int64_t DIV1097 = 1000000007LL;

using namespace std;

int main()
{
    int64_t A, B, C, D, E, F;
    std::cin >> A >> B >> C >> D >> E >> F;

    int64_t maxW = 1;
    int64_t maxS = 0;
    for (int64_t a = 0; 100*A * a <= F; ++a) {
        for (int64_t b = 0; 100*B * b <= F; ++b) {
            auto W = a * 100 * A + b * 100 * B;
            if (W > F || W == 0) {
                continue;
            }

            for (int64_t c = 0; c <= E * W / 100; c += C) {
                for (int64_t d = 0; d <= E * W / 100; d += D) {
                    auto S = c + d;

                    if (W+S > F) {
                        continue;
                    }
                    if (W * E < S * 100) {
                        continue;
                    }

                    if ((W+S)*maxS <= S*(maxW+maxS)) {
                        maxS = S;
                        maxW = W;
                    }
                }
            }
        }
    }

    std::cout << maxW + maxS << " " << maxS << std::endl;

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <iomanip>
using namespace std;
#define reps(i,s,n) for(int i = s; i < n; i++)
#define rep(i,n) reps(i,0,n)
#define fi first
#define se second
#define mp make_pair
typedef long long ll;
typedef vector<ll> vec;
typedef vector<vec> mat;

ll N,M,H,W,K,A,B;
string S;
string alpha = "abcdefghijklmnopqrstuvwxyz";
string ALPHA = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";

int main(){
    cin>>N;
    vec prf(100,0);
    reps(i,2,N+1){
        ll n = i;
        reps(j,2,i+1){
            while(n%j == 0){
                ++prf.at(j);
                n /= j;
            }
        }
    }
    sort(prf.begin(),prf.end());
    //reverse(prf.begin(),prf.end());
    ll ans = 0;
    ans += (prf.end() - lower_bound(prf.begin(),prf.end(),74));
    ans += (prf.end() - lower_bound(prf.begin(),prf.end(),24))
           *((prf.end() - lower_bound(prf.begin(),prf.end(),2))-1);
    ans += (prf.end() - lower_bound(prf.begin(),prf.end(),14))
           *((prf.end() - lower_bound(prf.begin(),prf.end(),4))-1);
    ans += (prf.end() - lower_bound(prf.begin(),prf.end(),4))
            *((prf.end() - lower_bound(prf.begin(),prf.end(),4))-1)
            *((prf.end() - lower_bound(prf.begin(),prf.end(),2))-2)
            /2;
    cout<<ans<<endl;
}


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

using namespace std;

int main()
{
    int h1, m1, s1, h2, m2, s2;
    while (cin >> h1 >> m1 >> s1 >> h2 >> m2 >> s2) {
        int sum1 = h1 * 3600 + m1 * 60 + s1;
        int sum2 = h2 * 3600 + m2 * 60 + s2;
        int diff = sum2 - sum1;
        int h = diff / 3600; diff %= 3600;
        int m = diff / 60;   diff %= 60;
        int s = diff;
        cout << h << " " << m << " " << s << endl;
    }
    return 0;
}

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

int main() {
  int N;
  cin >> N;
  vector<int> P(N), Q(N), V(N);
  for(int i=0; i<N; i++) {
    cin >> P[i];
  }
  for(int i=0; i<N; i++) {
    cin >> Q[i];
  }
  for(int i=0; i<N; i++) {
    V[i]=i+1;
  }
  
  int i=1, a, b;
  do {
    if (V==P) {
      a=i;
    }
    if (V==Q) {
      b=i;
    }
    i++;
  } while(next_permutation(V.begin(), V.end()));
  cout << abs(a-b) << endl;
}

Measured memory_bytes: 3616
fun main(args: Array<String>) {
    val a = readLine()!!.toInt()
    val b = readLine()!!.toInt()
    val c = readLine()!!.toInt()
    val x = readLine()!!.toInt()
    var num = 0
    for(i in 0..a) {
        for(j in 0..b) {
            for(k in 0..c) {
                if(x == i * 500 + j * 100 + k * 50) {
                    num = num + 1
                }
            }
        }
    }
    println(num)
}

Measured memory_bytes: 31520
# inputList = list(map(int, '''6
# 5 6 4 2 1 3'''.split()))
# N = inputList.pop(0)


def formatting(nums):
    for i in range(len(nums)):
        if i != len(nums) - 1:
            print(nums[i], end=' ')
        else:
            print(nums[i])


def selectionSort(A, N):
    count = 0
    for i in range(N - 1):
        minJ = i
        for j in range(i, N):
            if A[j] < A[minJ]:
                minJ = j

        if i != minJ:
            A[i], A[minJ] = A[minJ], A[i]
            count += 1

    formatting(A)
    print(count)



N = int(input())
inputList = list(map(int, input().split()))

selectionSort(inputList, N)



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


using namespace std;


int main(){
int k;
string s;
cin >> k >> s;
if(s.size()>k){
    string es = s.substr(0,k);
    es.insert(es.size(),"...");
    cout<<es<<endl;
}else{

cout<<s<<endl;
}
}

Measured memory_bytes: 3604
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<map>
#include<set>
#include<bitset>
using namespace std;
#define REP(i,m,n) for(int i=(int)m ; i < (int) n ; ++i )
#define rep(i,n) REP(i,0,n)
typedef long long ll;
typedef pair<int,int> pint;
typedef pair<ll,int> pli;
const int inf=1e9+7;
const ll longinf=1LL<<60 ;
const ll mod=1e9+7 ;
int dx[4]={1,0,-1,0} , dy[4]={0,1,0,-1} ;

int main(){
  int d,a;
  cin>>d>>a;
  int cnt[d],p[d];
  vector<int> v;
  rep(i,d){
    cin>>cnt[i]>>p[i];
    rep(j,cnt[i])v.push_back(100*(i+1));
    p[i]+=100*(i+1)*cnt[i];
    }
  int n=v.size();
  int bit=1<<d;
  bool used[10];
  int ans=inf;
  reverse(v.begin(),v.end());
  rep(i,bit){
    int ret=0;
    rep(j,d)used[j]=(i>>j)&1;
    int sum=0;
    rep(j,d)if(used[j]){
      sum+=p[j];
      ret+=cnt[j];
      }
    int idx=0;
    while(sum<a&&idx<n){
      if(used[v[idx]/100-1]){
        idx++;
        continue;
        }
      sum+=v[idx];
      ret++;
      idx++;
      }
    ans=min(ans,ret);
    }
  cout<<ans<<endl;
   return 0;
}


Measured memory_bytes: 256
n=int(input())
li=list(map(int,input().split()))
ans=[0]*n
ans[1]=abs(li[0]-li[1])
for i in range(2,n):
    ans[i]=min(ans[i-2]+abs(li[i-2]-li[i]),ans[i-1]+abs(li[i-1]-li[i]))
    
print(ans[n-1])

Measured memory_bytes: 13980
#include <bits/stdc++.h>
using namespace std;
#define REP(i,n) for(int i=0;i<(n);i++)
#define N 105
#define INF 100000000
typedef long long ll;
#define ALL(v) (v).begin(),(v).end()
#define SZ(x) int(x.size())
#define IN(a) cin>>(a)
#define OUT(a) cout<<(a)<<endl
typedef pair<int,int> P;
const int MAX = 100005;
const int MOD = 1000000007;
int main(){
    int a,b,c;
    cin>>a>>b>>c;
    OUT(a*b/2);
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main() {
  int r, d, x;
  cin >> r >> d >> x;
  for (int i = 0; i < 10; i++) {
    cout << r * x - d << endl;
    x = r * x - d;
  }
  
  return 0;
}


Measured memory_bytes: 256
using System;
using static System.Console;
using static System.Math;
using System.Collections.Generic;
using System.Linq;
using System.IO;

class Program
{
    static void Main()
    {
        new Program().Solve();
    }
    Scanner cin = new Scanner();
    readonly int[] dd = { 0, 1, 0, -1, 0 }; //→↓←↑
    readonly int mod = 1000000007;
    void chmax<T>(ref T a, T b) where T : IComparable<T> { a = a.CompareTo(b) < 0 ? b : a; }
    void chmin<T>(ref T a, T b) where T : IComparable<T> { a = a.CompareTo(b) < 0 ? a : b; }

    public void Solve()
    {
        int n = cin.nextint;
        for(int i = n; i < n + 111; i++)
        {
            string istr = i.ToString();
            if (istr[0] == istr[1] && istr[1] == istr[2])
            {
                WriteLine(istr);
                break;
            }
        }
        return;
    }
}


class Scanner
{
    string[] s; int i;
    char[] cs = new char[] { ' ' };
    public Scanner() { s = new string[0]; i = 0; }
    public string[] scan { get { return ReadLine().Split(); } }
    public int[] scanint { get { return Array.ConvertAll(scan, int.Parse); } }
    public long[] scanlong { get { return Array.ConvertAll(scan, long.Parse); } }
    public double[] scandouble { get { return Array.ConvertAll(scan, double.Parse); } }
    public string next
    {
        get
        {
            if (i < s.Length) return s[i++];
            string st = ReadLine();
            while (st == "") st = ReadLine();
            s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
            i = 0;
            return next;
        }
    }
    public int nextint { get { return int.Parse(next); } }
    public long nextlong { get { return long.Parse(next); } }
    public double nextdouble { get { return double.Parse(next); } }
}

Measured memory_bytes: 11092
import sys
# input = sys.stdin.readline
inf = 10 ** 18

N = int(input())
uvw = [list(map(int, input().split())) for _ in range(N - 1)]

table = [[] for _ in range(N)]
for i, (ui, vi, wi) in enumerate(uvw):
    table[ui - 1].append((vi, wi))
    table[vi - 1].append((ui, wi))
    
import heapq

d = [inf] * N
d[0] = 0
prev = [None] * N

q = []
heapq.heappush(q, (0, 1))

while len(q) > 0:
    du, u = heapq.heappop(q)
    for v, wv in table[u - 1]:
        alt = d[u - 1] + wv
        if d[v - 1] > alt:
            d[v - 1] = alt
            prev[v - 1] = u
            heapq.heappush(q, (alt, v))

# print("#", d)
for di in d:
    print(di % 2)

Measured memory_bytes: 57252
n = int(input())
t, a = map(int, input().split())
h = list(map(int, input().split()))
h.insert(0, 10000000000)

for i in range(1,n+1):
    h[i] = t - 0.006 * h[i]
    if(h[i]>a):
        h[i] = h[i] - a
    else:
        h[i] = a - h[i]
        
nmin = 10000000000
num = 0
for i in range(1, n+1):
    if(nmin > h[i]):
        nmin = h[i]
        num = i
        
print(num)

Measured memory_bytes: 3064
#include<stdio.h>

int main(void){
  int h,w;
  char s[101][101];
  int a[101][101];
  
  int i,j;
  scanf("%d %d\n",&h,&w);
  for(i=1;i<=h;i++){
    for(j=1;j<=w;j++){
      scanf("%c",&s[i][j]);
    }
    scanf("\n");
  }
  
  if(s[1][1]=='.'){
    a[1][1]=1;
  }else{
    a[1][1]=2;
  }
  
  for(j=2;j<=w;j++){
    if(s[1][j-1]==s[1][j]){
      a[1][j]=a[1][j-1];
    }else{
      a[1][j]=a[1][j-1]+1;
    }
  }
  
  for(i=2;i<=h;i++){
    if(s[i-1][1]==s[i][1]){
      a[i][1]=a[i-1][1];
    }else{
      a[i][1]=a[i-1][1]+1;
    }
    for(j=2;j<=w;j++){
      if(a[i-1][j]<a[i][j-1]){
        if(s[i-1][j]==s[i][j]){
          a[i][j]=a[i-1][j];
        }else{
          a[i][j]=a[i-1][j]+1;
        }
      }else{
        if(s[i][j-1]==s[i][j]){
          a[i][j]=a[i][j-1];
        }else{
          a[i][j]=a[i][j-1]+1;
        }
      }
    }
  }
  
  printf("%d",a[h][w]/2);
  
  return 0;
}

Measured memory_bytes: 256
def solve():
    dp = [0]
    for a, s in zip(A[::-1], S[::-1]):
        # print(f'a: {a}, s: {s}')
        x = a
        for y in dp:
            # print(f'min({x}, {x ^ y})', end=', ')
            x = min(x, x ^ y)
        # print()
        if s == "0":
            if x:
                dp.append(x)
        else:
            if x:
                return 1
        # print(dp)
    return 0


t = int(input())
for i in range(t):
    n = int(input())
    *A, = map(int, input().split())
    S = input()
    # print(A, S)
    print(solve())
    # print('-'*32)


Measured memory_bytes: 9076
import sys

sys.setrecursionlimit(10 ** 6)
int1 = lambda x: int(x) - 1
p2D = lambda x: print(*x, sep="\n")
def II(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def LI(): return list(map(int, sys.stdin.readline().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]
def SI(): return sys.stdin.readline()[:-1]

def ng():
    if s[0]=="0" or s[-1]=="1":return True
    for i in range(n):
        if i>n-2-i:break
        if s[i]!=s[n-2-i]:return True
    return False

s=SI()
n=len(s)

if ng():
    print(-1)
    exit()

aa=[]
for i in range(n//2):
    if s[i]=="1":aa.append(i+1)
aa.append(n)

ans=[]
for i in range(len(aa)-1):ans.append([i+1,i+2])

j=len(aa)+1
for i,(a0,a1) in enumerate(zip(aa,aa[1:])):
    for _ in range(a1-a0-1):
        ans.append([i+2,j])
        j+=1

for u,v in ans:print(u,v)


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

using namespace std;

typedef long long ll;

const ll mod = 1e9+7;
const int N = 4e5;

ll iv[N+1], f[N+1], f2[N+1];

ll nck(ll n, ll k){
    return f[n]*f2[n-k]%mod*f2[k]%mod;
}

int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    ll n, k;
    cin >> n >> k;
    iv[1] =1;
    for(ll i=2; i<=N; i++)
        iv[i] =mod-mod/i*iv[mod%i]%mod;
    f[0]=f2[0]=1;
    for(ll i=1; i<=N; i++){
        f[i] =i*f[i-1]%mod;
        f2[i] = iv[i] *f2[i-1] %mod;
    }
    ll ans = nck(2*n-1, n-1)%mod;
    for(ll i=k+1; i<n; i++){
        ans += 2*mod;
        ans -= (nck(n, i)*nck(n-1, n-i-1))%mod;
        ans %= mod;
    }
    cout << ans%mod;
    return 0;
}


Measured memory_bytes: 9600
#include<bits/stdc++.h>
using namespace std;
int a[1010][1010];
int cnt=0;
int ans1[1000010],ans2[1000010],ans3[1000010],ans4[1000010];
inline void add_ans(int x,int y,int xx,int yy){
	ans1[++cnt]=x;
	ans2[cnt]=y;
	ans3[cnt]=xx;
	ans4[cnt]=yy;
}
int main()
{
	int h,w;
	cin>>h>>w;
	for(int i=1;i<=h;i++){
		for(int j=1;j<=w;j++){
			cin>>a[i][j];
		}
	}
	for(int i=1;i<h;i++){
		for(int j=1;j<=w;j++){
			if(a[i][j]&1)
				a[i+1][j]++,add_ans(i,j,i+1,j);
		}
	}
	for(int i=1;i<w;i++)
		if(a[h][i]&1)
			a[h][i+1]++,add_ans(h,i,h,i+1);
	cout<<cnt<<endl;
	for(int i=1;i<=cnt;i++){
		cout<<ans1[i]<<' '<<ans2[i]<<' '<<ans3[i]<<' '<<ans4[i]<<endl;
	}
	return 0;
}


Measured memory_bytes: 16896
#include <stdio.h>
#define N 100001

int partition(int a[],int p,int r){
  int x,i,temp,j;
  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 i,n,A[N],x;

  scanf("%d",&n);

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

  x=partition(A,0,n-1);

  for(i=0;i<n;i++){
    if(i==x)printf("[%d]",A[i]);
    else printf("%d",A[i]);
    if(i<n-1)printf(" ");

  }
  printf("\n");


  return 0;
}



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

int a[100005],b[100005],c[100005];
vector<int>d[100006];
 
void dfs(int v,int s) {
	a[v]=a[s]+1;
	b[v]=1;
	c[v]=s;
	for(auto x:d[v]) {
		if(x==s) continue;
		dfs(x,v);
		b[v]=max(b[v],b[x]+1);
	}
	
}
int main(){
    int n,u,v;
    cin>>n>>u>>v;
	for(int i=1;i<n;i++) {
		int x,y;
		cin>>x>>y;
		d[x].push_back(y);
		d[y].push_back(x);
	}
	dfs(v,0);
	int ans=-1;
	int dis=a[u]-a[v];
	
	dis=(dis-1)>>1;
//	cout<<dis<<endl;
	while(dis--){ 
	    u=c[u];
	}
	if(d[u].size()==1) 
	     ans=a[u]-2;
	else 
	    ans=b[u]+a[u]-3;
	    
	cout<<ans<<endl;
	

}


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

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N; cin >> N;
    vector<int> a(N);
    for (int i=0;i<N;++i) cin >> a[i],--a[i];
    int ans=0;
    for (int i=0;i<N;++i)
        if (a[a[i]]==i) ++ans;
    cout << ans/2 << '\n';
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll INF = LONG_LONG_MAX / 2;
const ll mod = 1000000000 + 7;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

int main() {
  int D, T, S;
  cin >> D >> T >> S;
  if ((D + S - 1) / S > T)
    cout << "No" << endl;
  else
    cout << "Yes" << endl;
}


Measured memory_bytes: 3672
#[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 , usize1 ) => {read_value ! ($ next , usize ) - 1 } ; ($ next : expr , $ t : ty ) => {$ next () . parse ::<$ t > () . expect ("Parse error" ) } ; }
#[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 ) * } } ; }
#[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 ) * } } ; }

fn main() {
    input! {
        n: usize,
        csf: [(i32, i32, i32); n - 1],
    }
    for i in 0..n {
        let mut time = 0;
        for j in i..n - 1 {
            let wait = if time < csf[j].1 {
                csf[j].1 - time
            } else {
                (csf[j].2 - time % csf[j].2) % csf[j].2
            };
            time += wait + csf[j].0;
        }
        println!("{}", time);
    }
}


Measured memory_bytes: 2124
#include <iostream>
#include <iomanip>
#include <cmath>
#include <vector>
#include <algorithm>
#include <set>
#include <unordered_set>
#include <queue>
#include <stack>
#include <map>
#include <unordered_map>
#define rep(i, n) for (int i = 0; i < n; i++)
#define all(a) (a).begin(), (a).end()
typedef long long ll;
using namespace std;
const int N = 2e5 + 5;

int main(void)
{
    int n;
    cin >> n;
    vector<int> a;
    rep(i, n)
    {
        int x;
        cin >> x;
        if (i % 2 == 0)
        {
            a.insert(a.begin(), x);
        }
        else
        {
            a.push_back(x);
        }
    }
    if (n % 2 == 0)
    {
        reverse(a.begin(), a.end());
    }
    for (int e : a)
    {
        cout << e << " ";
    }
}


Measured memory_bytes: 4284
import sys
input_str = sys.stdin.read()
table = [0]*26
letters = "abcdefghijklmnopqrstuvwxyz"
for A in input_str:
    index = 0
    for B in letters:
        if A == B or A == B.upper():
            table[index] += 1
            break
        index += 1
for i in range(len(letters)):
    print("{} : {}".format(letters[i],table[i]))



Measured memory_bytes: 5560
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace past10.Abc
{
    public class Question1
    {
        public static void Main(string[] args)
        {
            var sw = new System.IO.StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
            Console.SetOut(sw);

            string[] str = Console.ReadLine().Split(' ');
            long a = long.Parse(str[0]);
            long b = long.Parse(str[1]);

            string result = a*b%2 == 0 ? "Even": "Odd";

            Console.WriteLine(result);

            Console.Out.Flush();
        }
    }
}

Measured memory_bytes: 27368
#include <iostream>
#include <iomanip>
#include <vector>
#include <set>
#include <string>
#include <queue>
#include <algorithm>
#include <map>
#include <cmath>
#include <numeric>
#include <list>
#include <stack>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <tuple>
#include <deque>
#include <complex>

using namespace std;

/*
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int, int> pii;
typedef vector<pii> vpii;
*/

typedef long long ll;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef pair<long long, long long> pll;
typedef vector<pll> vpll;

typedef long double ld;
typedef vector<ld> vld;

typedef vector<bool> vb;

#define rep(i, n) for (ll i = 0; i < (n); i++)
#define reps(i, n) for (ll i = 1; i <= (n); i++)
#define rrep(i, n) for (ll i = (n) - 1; i >= 0; i--)
#define rreps(i, n) for (ll i = (n); i >= 1; i--)
#define all(v) (v).begin(), (v).end()

template <class T> void chmin(T& a, T b) { a = min(a, b);}
template <class T> void chmax(T& a, T b) { a = max(a, b);}

constexpr int INF = 1 << 30;
constexpr ll INFL = 1LL << 60;
constexpr ll MOD = 1000000007;
constexpr ld EPS = 1e-12;
ld PI = acos(-1.0);

void solve() {
    ll n;
    cin >> n;
    for(ll i = 1; i <= 10; i++) {
        ll dif = 1000 * i - n;
        if(dif >= 0) {
            cout << dif << endl;
            return;
        }
    }
    return;
}

int main() {
    std::cin.tie(nullptr);
    std::ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    solve();
}

Measured memory_bytes: 3648
#include<iostream>
#include<cmath>
#include<algorithm>
using namespace std;
int arr[100005],dp[100005];
int main()
{
    int n;
    cin >> n;
    for(int i=0;i<n;i++) {
            cin >> arr[i];
    }
    dp[0]=0;
    for(int i=1;i<n;i++) {
            if(i==1) dp[i]=abs(arr[1]-arr[0]);
            else dp[i]=min(dp[i-1]+abs(arr[i-1]-arr[i]),dp[i-2]+abs(arr[i-2]-arr[i]));
    }
    cout <<dp[n-1];
    return 0;
}
    
    


Measured memory_bytes: 1024
//fifer a tak luboin
#include <bits/stdc++.h>
// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>

#define ll long long
#define mp make_pair
#define pb push_back
#define s second
#define f first
#define endl "\n"

// using namespace __gnu_pbds;
using namespace std;
// template <typename T> using ordered_set =  tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>; 

const ll inf = 1e14;
const double eps = 1e-10;                                     
const double pi = acos(-1.0);
const ll mod = 1000000007;
const int N = 100100;

int a[N];
int main() {
    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0); 
    // freopen("input.txt", "r", stdin);
    // freopen("output.txt", "w", stdout);
    int n;
    cin >> n;
    bool check = true;
    for (int i = 1; i <= n; i++) {
        cin >> a[i];
        if (a[i] % 2 == 0) {
            if (a[i] % 3 == 0) continue;
            if (a[i] % 5 == 0) continue;
            cout << "DENIED" << endl;
            return 0;
        }
    }
    cout << "APPROVED" << endl;
    return 0;  
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define trace1(x)                  cerr<<#x<<": "<<x<<endl
#define trace2(x, y)               cerr<<#x<<": "<<x<<" | "<<#y<<": "<<y<<endl
int main() 
{
	ll k,n;
	string s; 
	ll ans=0;  
	cin>>n>>s;
	for (int i = 0; i < n-2; ++i)
	 {
	 	if(s[i]=='A'&&s[i+1]=='B'&&s[i+2]=='C') 
         ans++;
	 } 
	cout<<ans;
    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
#define MAX 2000000

int H;

int parent(int i){ return i/2; }
int left(int i){ return 2*i; }
int right(int i){ return (2*i)+1; }

void maxHeapify(int A[], int i){
  int l, r, largest, tmp;
  l = left(i);
  r = right(i);
  if( l <= H && A[l] > A[i] ) largest = l;
  else largest = i;
  
  if( r <= H && A[r] > A[largest] ) largest = r;

  if( largest != i ){
    tmp = A[i];
    A[i] = A[largest];
    A[largest] = tmp;
    maxHeapify(A, largest);
  }
}

void buildMaxHeap(int A[]){
  int i;
  for( i = H/2 ; i >= 1 ; i-- ) maxHeapify(A,i);
}

int main(){
  int i, A[MAX+1];

  scanf("%d", &H);

  for( i = 1 ; i <= H ; i++ ) scanf("%d", &A[i]);

  buildMaxHeap(A);

  for( i = 1 ; i <= H ; i++ ) printf(" %d",A[i]);
  printf("\n");

  return 0;
}



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

#define fi first
#define se second

const int N = 2020;
const int MAGIC = 1000;
const long long mod = 998244353;

using namespace std;

int n;
char a[N];
int s[N];
int col[N];
vector < int > v[N];

int dfs(int x, int p, int g = 0)
{
        int res = 0;
        if(a[x] == '1'){
                res = g;
        }
        for(int y: v[x]){
                if(y == p){
                        continue;
                }
                res += dfs(y, x, g + 1);
        }
        s[x] = res;
        return res;
}

int good(int x, int p, int need, int f = 1)
{
        vector < int > g;
        s[x] = 0;
        if(a[x] == '1'){
                s[x] += f;
                col[x] = 1;
        } else{
                col[x] = 0;
        }
        for(int y: v[x]){
                if(y == p){
                        continue;
                }
                need = good(y, x, need, f + 1);
                g.push_back(s[y] - col[y] * f);
                col[x] += col[y];
                s[x] += s[y];
        }
        if(g.empty()){
                return need;
        }
        sort(g.begin(), g.end());
        int sum = 0;
        for(int i = 1; i < g.size(); i++) sum += g[i - 1];
        int can = 0;
        if(sum >= g.back()){
                can = sum + g.back();
        } else{
                can = sum * 2;
        }
        int gg = min(can, need);
        need -= gg;
        s[x] -= gg;
        return need;
}

int main()
{
        //freopen("input.txt", "r", stdin);
        //freopen("output.txt", "w", stdout);
        ios_base::sync_with_stdio(0);

        cin >> n;
        for(int i = 1; i <= n; i++){
                cin >> a[i];
        }
        for(int i = 1; i < n; i++){
                int x, y;
                cin >> x >> y;
                v[x].push_back(y);
                v[y].push_back(x);
        }
        int res = 1e9;
        vector < pair < int, int > > g;
        for(int i = 1; i <= n; i++){
                g.clear();
                for(int j: v[i]){
                        g.push_back({dfs(j, i, 1), j});
                }
                int s = 0;
                sort(g.begin(), g.end());
                for(auto x: g) s += x.fi;
                int need = max(0, g.back().fi - (s - g.back().fi));
                if(s % 2 == 0 && good(g.back().se, i, need) == 0){
                        res = min(res, s / 2);
                }
        }
        if(res == 1e9){
                res = -1;
        }
        cout << res << "\n";
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
#include <iostream>
#include <iomanip>
#include <numeric>
#include <math.h>
#include <stdio.h>
#include <climits>
#include <cfloat>
#include <string>
#include <unordered_map>
using namespace std;

int main(){
	char a, b;
	cin >> a >> b;
	string ans = "";
	for(char i='0';i<max(a,b);i++){
		ans += min(a,b);
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
  
using namespace std;
using namespace __gnu_pbds;
 
#define ll long long
#define uint unsigned int
#define ull  unsigned long long
#define pb push_back
#define mk make_pair
#define ins insert
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define X first
#define Y second
#define umap unordered_map
#define speed() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define setvalue(d,s,e,n) for(int qwe = s; qwe < e; ++qwe) d[qwe] = n
#define mset multiset
#define pqueue priority_queue
   
template<class T> using oset = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
        
const int  N = 1e6 + 314;
const int INF = 1e9;
const double PI = acos(-1);
const int MOD = 1e9 + 7;
const double eps = 1e-9;
const long long LINF = 1e18 + 3141;
void solve(){
    int a, b;
    cin >> a >> b;
    cout << a * b;
    
}

 
 
int main(){
    speed();
    int t = 1;
    // cin >> t;
    while(t--)solve();
}


Measured memory_bytes: 3572
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define REP(i,m,n) for(int i=(int)(m); i<(int)(n); i++)
#define rep(i,n) REP(i,0,n)
#define REPL(i,m,n) for(ll i=(ll)(m); i<(ll)(n); i++)
#define repl(i,n) REP(i,0,n)
#define all(v) v.begin(), v.end()
const int inf = 1e9+7;
const ll longinf = 1LL<<60;
const ll mod = 1e9+7;

bool so (pair<ll, ll> a, pair<ll, ll> b) {
  if (a.first + a.second < b.first + b.second) {
    return true;
  }
  else {
    return false;
  }
}

int main () {

  ll N;
  vector<ll> X, L;

  cin >> N;
  ll temp;
  REP(i, 0, N) {
    cin >> temp;
    X.push_back(temp);
    cin >> temp;
    L.push_back(temp);
  }

  // debug
  // cout << endl;
  // REP(i, 0, N) {
  //   cout << X[i] << " " << L[i] << endl;
  // }

  vector<pair<ll, ll> > p(N);
  REP(i, 0, N) {
    p[i] = make_pair(X[i], L[i]);
  }
  sort(p.begin(), p.end(), so);

  // debug
  // cout << endl;
  // REP(i, 0, N) {
  //   cout << "r_end: " << p[i].first + p[i].second << ", (first, end): "
  //        <<  p[i].first << ", " << p[i].second << endl;
  // }

  ll ans = 1;
  ll end_index = 0;
  ll current_end_pos = 0;
  REP(i, 0, N) {
    if (p[end_index].first + p[end_index].second <= p[i].first - p[i].second) {
      end_index = i;
      ans++;
    }
  }

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 3692
#include <stdio.h>
#define MAX 20
int Combination(int *,int,int,int);

int main()
{
    int a,b;
    int num,res;
    int i;
    int A[MAX];

    scanf("%d",&a);
    for(i=0;i<a;i++)
    {
        scanf("%d",&A[i]);
    }
    scanf("%d",&b);
    for(i=0;i<b;i++)
    {
        scanf("%d",&num);
        if(Combination(A,a,num,0)) printf("yes\n");
        else printf("no\n");
    }
    return 0;
}

int Combination(int *A,int a,int num,int i)
{
    int res;
    if(num==0) return 1;
    if(i>=a) return 0;
    res=Combination(A,a,num,i+1) || Combination(A,a,(num-A[i]),i+1);
    return res;
}


Measured memory_bytes: 2120
n,l= list(map(int,input().split()))
ans = 0
taste_list = []
for i in range(n):
    taste_list.append(l+i)
    ans += (l+i)
if 0 in taste_list:
    print(ans)
else:
    mini = min(taste_list)
    if mini > 0:
        print(ans-mini)
    else:
        mini2 = taste_list[-1]
        print(ans-mini2)


Measured memory_bytes: 2940
#include<iostream>
#include<cstdio>
#include<queue>
#include<vector>
#include<string.h>
#include<algorithm>
#include <cmath>
#include<map>

using namespace std;

int i,j,k,A,B,N,M,ans,a,b;

int main()
{
  cin>>N>>M;
  if(N%2==1)
  {
    for(i=0;i<M;i++)
    {
      cout<<i+1<<" "<<2*M-i<<endl;      
    }
  }
  else
  {
    for(i=0;i<M/2;i++)
    {
      cout<<i+1<<" "<<M-i<<endl;
    }
    
    for(i=0;i<M-M/2;i++)
    {
      cout<<M+1+i<<" "<<2*M+1-i<<endl;
    }
  }

  
}

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

const ll MOD=1000000007;

ll abs1(ll a){
  if(a>=0)return a;
  else return -a;
}

ll pow1(ll a,ll b){
  ll p=1;
  for(int i=0;i<b;i++){
    p*=a;
  }
  return p;
}

int digit(ll a,ll b){
  int i=0;
  while(a!=0){
    a/=b;
    i++;
  }
  return i;
}

ll gcd1(ll a,ll b){
  if(a==0 && b==0)return 0;
  ll n;
  while(a%b!=0){
    n=a%b;
    a=b;
    b=n;
  }
  return b;
}

ll solveLinear(ll n,ll m,ll c){
  if(n==0 && m==0)return 0;
  ll a[100],b[100];
  a[0]=n;b[0]=m;
  int i=1;
  while(b[i-1]!=0){
    a[i]=b[i-1];
    b[i]=a[i-1]%b[i-1];
    i++;
  }
  n=i;
  if(c%a[n-1]!=0){
    return 0;
  }
  ll x=c/a[n-1],y=0;
  for(i=1;i<n;i++){
    ll cnt=x;
    x=y;
    y=cnt-(a[n-i-1]/b[n-i-1])*y;
  }
  return x;
}

ll modRev(ll a,ll p=MOD){
  a%=p;
  ll n=solveLinear(a,p,1);
  n%=p;
  if(n<0)return n+p;
  return n;
}

ll binom1(ll n,ll k,ll p=MOD){
  if(n<0 || k<0 || n<k)return 0;
  int i;
  ll ret=1;
  for(i=0;i<k;i++){
    ret=ret*(n-i)/(i+1);
    if(ret>=p)ret%=p;
  }
  return ret;
}

ll f[300001];

ll binom2(ll n,ll k,ll p=MOD){
  if(n<0 || k<0 || n<k)return 0;
  return (f[n]*modRev(f[k]*f[n-k]))%p;
}

int main(){
  int i,j,k,cnt=0;
  ll h,w,a,b;
  cin>>h>>w>>a>>b;
  f[0]=1;
  for(i=1;i<=300000;i++){
    f[i]=i*f[i-1];
    if(f[i]>=MOD)f[i]%=MOD;
  }
  ll sum=binom2(h+w-2,h-1)%MOD;
  for(i=0;i<b;i++){
    sum-=(binom2(h-a+i-1,h-a-1)*binom2(w+a-2-i,a-1))%MOD;
    if(sum>=MOD)sum%=MOD;
    if(sum<0)sum+=MOD;
  }
  cout<<sum<<endl;
}


Measured memory_bytes: 2560
#include <iostream>
#include <map>

using namespace std;

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

    map<int, int> mp;
    for (int i = 0; i < N; i++) {
        int tmp; cin >> tmp;
        mp[tmp - 1] = i + 1;
    }

    for (int i = 0; i< N; i++)
        cout << mp[i] << " ";
    
    cout << endl;
}


Measured memory_bytes: 5504
#include <bits/stdc++.h>
using namespace std;
//************************************//
//-Manthan Surkar----((smallstar))----//
//***********************************//
/*

 */
//***************************************************************************
#define ll long long int
#define mp make_pair
#define pb push_back
#define fi first
#define se second
//****************************************************************************
#define rep(i,n) for(int i=0, _##i=(n); i<_##i; ++i)
#define dwn(i,n) for(int i=(n); --i>=0; )
#define repr(i,l,r) for(int i=(l), _##i=(r); i<_##i; ++i)
#define dwnr(i,l,r) for(int i=(r), _##i=(l); --i>=_##i; )
#define repi(i,a) for(__typeof((a).begin()) i=(a).begin(), _##i=(a).end(); i!=_##i; ++i)
#define dwni(i,a) for(__typeof((a).rbegin()) i=(a).rbegin(), _##i=(a).rend(); i!=_##i; ++i)
//******************************************************************************
int w[105],v[105];


// oned dp knapsnack


int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
 
         ll t,ww; 
          cin>>t>>ww;

    ll dp[100005];
    rep(i,100005){
        dp[i]=INT_MIN;
    }
	  rep(i,t)
	  {
         cin>>w[i]>>v[i];
      
      }
    dp[0]=0;
    rep(i,t){
        
        for(int j=100005-w[i];j>=0;j--){
        dp[j+w[i]] = max(dp[j+w[i]],dp[j]+v[i]);    
        }
        
    }
         
              // cout<<"hi";
           ll ans=0;
          
           for(int i=1;i<=ww;i++){
              // cout<<"hi";
             // cout<<dp[i]<<" "<<i<<endl;
               if(dp[i]>=ans){
                   ans=dp[i];
                   
               }
               
               
           }
           cout<<ans;
           

}


//************************************//
// Manthan Surkar----((smallstar))----//
//***********************************//



Measured memory_bytes: 1024
#: Author - Soumya Saurav
import sys,io,os,time
from collections import defaultdict
from collections import OrderedDict
from collections import deque
from itertools import combinations
from itertools import permutations
import bisect,math,heapq
alphabet = "abcdefghijklmnopqrstuvwxyz"

input = sys.stdin.readline

########################################

n = int(input())
s = input()
i = 0
j = n-1
ans2 = 0
while i < j:
	while s[i] == "R":
		i+=1
	while s[j] == "W":
		j-=1
	if i < j: 
		ans2+=1
		i+=1
		j-=1
print(ans2)


Measured memory_bytes: 74012
n = int(input())
a = input().strip().split()
a = [ int(a[i]) for i in range(len(a)) ]

a.sort(reverse=True)

alice = 0
bob = 0
for i in range(n):
    if i % 2 is 0:
        alice = alice + int(a[i])
    else:
        bob = bob + int(a[i])
        
print(alice - bob)

Measured memory_bytes: 3064
#include<iostream>
#include<string.h>
#include<algorithm>
#include<stdio.h>
#include<math.h>
#include<vector>
#include<map>
#include<set>
#define max(a, b) (a) > (b) ? (a) : (b)
#define debug(a) cout << "*" << a << "*" << endl
using namespace std;
typedef long long ll;
ll f[87], n;
int main()
{
	f[0] = 2;
	f[1] = 1;
	for (int i = 2; i < 87; i++)
		f[i] = f[i - 1] + f[i - 2];
	while (~scanf("%lld", &n))
		printf("%lld\n", f[n]);
}

Measured memory_bytes: 256
#include<iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <cmath>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
int Max = 1000000;
int main(){
  	int N;
    cin >> N;
    int a[N];
    for(int i=0;i<N;i++) cin >> a[i];

    int ans = 0;
    int i=0;
    while(i<N-1){
      int cnt = 1;
      while(a[i]==a[i+1]){
        cnt++;
        i++;
      }
      i++;
      ans += cnt/2;
    }
    cout << ans <<endl;
  	return 0;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main() {
  // input
  int a, b;
  cin >> a >> b;

  // solve
  int ans = 0;
  if (a >= 13){
    ans = b;
  }else if((a < 13) && (a >= 6)){
    ans = b / 2;
  }

  // output
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 256
s = list(str(input()))
t = list(str(input()))
col = []
for i in range(len(s)-len(t)+1):
	count = 0
	for j in range(len(t)):
		if s[i+j] == t[j]:
			count += 1
	col.append(count)
print(len(t)-max(col))

Measured memory_bytes: 9052
N, A, B = map(int, input().split())
s = list(map(str, input()))

clear = 0

ab = A + B
b = 0

for obj in s:
    if clear < ab:
        if obj == "a":
            print("Yes")
            clear += 1
        elif obj == "b" and b < B:
            print("Yes")
            clear += 1
            b += 1
        else:
            print("No")

    else:
        print("No")

Measured memory_bytes: 9992
#include<bits/stdc++.h>
using namespace std;
#define reg register
#define ll double
inline int read()
{
	int x=0,w=0;char ch=getchar();
	while(!isdigit(ch))w|=ch=='-',ch=getchar();
	while(isdigit(ch))x=(x<<3)+(x<<1)+(ch^48),ch=getchar();
	return w?-x:x;
}
int a,b,x;ll fl,t;
int main()
{
    a=read(),b=read(),x=read();
    if(a*a*b>=x*2)
    {
        t=atan(2.0*(ll)x/a/b/b)/acos(-1.0)*180.0;
        printf("%.10lf\n",90.0-t);
    }
    else
    {
        x=a*a*b-x;
        t=atan(2.0*(ll)x/a/a/a)/acos(-1.0)*180.0;
        printf("%.10lf\n",t);
    }
	return 0;
}


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

namespace ConsoleApp61 {
    class Program {
        static void Main(string[] args) {
            var st = Console.ReadLine().Split().Select(int.Parse).ToArray();
            int N = st[0];
            int T = st[1];

            var CTTuple = new List<Tuple<int, int>>();

            for (int i = 0; i < N; i++) {
                var x = Console.ReadLine().Split().Select(int.Parse).ToArray();

                CTTuple.Add(new Tuple<int, int>(x[0], x[1]));

            }

            var newList = new List<Tuple<int, int>>();

            CTTuple.Sort((a, b) => a.Item1.CompareTo(b.Item1));


            newList = CTTuple.Where(a => a.Item2 <= T).ToList();

            foreach(var element in CTTuple) {
                //Console.WriteLine(element);
            }

            if (newList.Count() != 0) {
                Console.WriteLine(newList[0].Item1);
            } else {
                Console.WriteLine("TLE");
            }

        }
    }
}


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

class Program
{
    static void Main(string[] args)
    {
        var N = int.Parse(Console.ReadLine());
        var ST = Console.ReadLine().Split();

        var output = string.Empty;
        for (int i = 0; i < N; i++)
        {
            output += ST[0][i];
            output += ST[1][i];
        }

        Console.WriteLine(output);
    }
}


Measured memory_bytes: 13140
#include<bits/stdc++.h>
using namespace std;
int main(void){
	string s,t;
	int i,flg;
	cin>>s>>t;
	flg=0;
	for(i=0;i<s.size();i++){
		if(s[i]!=t[i])	flg=1;
	}
	if(flg==0)	cout<<"Yes"<<endl;
	else		cout<<"No"<<endl;
}

Measured memory_bytes: 3596
#include <algorithm>
#include <climits>
#include <iostream>
#include <string>
#include <utility>
#include<vector>
#include<iomanip>
#include<map>
#include <queue>
#include<cmath>
#include<cstdio>
#include<iomanip>

using namespace std;

using ll = long long int; 

void prime(vector<int> &num, int n){
    for(int i=0;i<=n;i++){
        num[i] = 1;
    }
    num[0] = 0;
    num[1] = 0;
    num[2] = 1;

    for(int i=2;i<=sqrt(n);i++){
        if(num[i] == 1){
            for(int j=2;j<=n/i;j++){
                num[i*j] = 0;
            }
        }
    }
}


ll gcd(ll a, ll b) {
  ll tmp;
  if ( b > a) {
    tmp = a;
    a = b;
    b = tmp;
  }
  while (a % b !=0) {
    tmp = b;
    b = a % b;
    a = tmp;
  }
  return b;
}
 
ll lcm(ll a, ll b) {
  return a * b / gcd(a, b);
}

ll keta(ll a){
  ll ans = 1;
  while(1){
    if(a/10 > 0){
      ans++;
      a = a/10;
    }
    if(a<10) break;
  }
  return ans;
}

int main(void){
   
   ll n;
   cin>>n;
   int ans;

   for(ll i=1;i<=sqrt(n);i++){
     ll x;
     if(n%i==0){
       x = n/i;
       //cout<<i<<" "<<x<<endl;
       ll a, b;
       a = keta(i);
       b = keta(x);
       //cout<<a<<" "<<b<<endl;
       int c = max(a,b);
       //cout<<c<<endl;
       if(i==1) ans = c;
       if(i!=1)  ans = min(ans, c);
     }
   }

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

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        long N = sc.nextLong();
        long[] arr = new long[5];
        long mi = 1L << 60;
        for(int i = 0; i < 5; i++) {
            arr[i] = sc.nextLong();
            mi = Math.min(mi, arr[i]);
        }
        System.out.println((N+mi-1)/mi + 4);
    }
}


Measured memory_bytes: 35792
N = str(input())
S=[int(c) for c in N]

eq_1=0 # siki
for num in range(1<<(len(S)-1)):
    eq_1 = S[0]
    list_1=[]
    for i in range(len(S)-1):
        if num & (1 << i):
            eq_1+=S[i+1]
            list_1.append("+")
        else:
            eq_1-=S[i+1]
            list_1.append("-")
    if eq_1==7:
        print("{}{}{}{}{}{}{}=7".format(S[0],list_1[0],S[1],list_1[1],S[2],list_1[2],S[3]))
        break


Measured memory_bytes: 3064
N = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
attack = 0
m = sum(A)
for i in range(N):
    attack = A[i] - B[i]
    if attack < 0:
        A[i+1] = max(0, A[i+1] + attack)
    A[i] = max(0, A[i] - B[i])

print(m-sum(A))

Measured memory_bytes: 18624
//file_name:ABC113_B.cpp
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(a) a.begin(),a.end()
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define limit(x,l,r) max(l,min(x,r))
#define lims(x,l,r) (x = max(l,min(x,r)))
#define isin(x,l,r) ((l) <= (x) && (x) < (r))
#define pb push_back
#define sz(x) (int)(x).size()
#define pcnt __builtin_popcountll
#define uni(x) x.erase(unique(rng(x)),x.end())
#define snuke srand((unsigned)clock()+(unsigned)time(NULL));
#define show(x) cout<<#x<<" = "<<x<<endl;
#define PQ(T) priority_queue<T,v(T),greater<T> >
#define bn(x) ((1<<x)-1)
#define dup(x,y) (((x)+(y)-1)/(y))
#define newline puts()
#define v(T) vector<T>
#define vv(T) v(v(T))
using namespace std;
typedef long long int ll;
typedef unsigned uint;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
inline int in() { int x; scanf("%d",&x); return x;}
template<typename T>inline istream& operator>>(istream&i,v(T)&v)
{rep(j,sz(v))i>>v[j];return i;}
template<typename T>string join(const v(T)&v)
{stringstream s;rep(i,sz(v))s<<' '<<v[i];return s.str().substr(1);}
template<typename T>inline ostream& operator<<(ostream&o,const v(T)&v)
{if(sz(v))o<<join(v);return o;}
template<typename T1,typename T2>inline istream& operator>>(istream&i,pair<T1,T2>&v)
{return i>>v.fi>>v.se;}
template<typename T1,typename T2>inline ostream& operator<<(ostream&o,const pair<T1,T2>&v)
{return o<<v.fi<<","<<v.se;}
template<typename T>inline ll suma(const v(T)& a) { ll res(0); for (auto&& x : a) res += x; return res;}
const double eps = 1e-10;
const ll LINF = 1001002003004005006ll;
const int INF = 1001001001;
#define dame { puts("-1"); return 0;}
#define yn {puts("YES");}else{puts("NO");}
const int MX = 200005;

    // 整数スキャン（複数）
    /*
    int x;
    scanf("%d",&x);
    int y;
    scanf("%d",&y);
    int z;
    scanf("%d",&y);

    // n個の整数のスキャン
    /*
    ll a[n] = {};
    rep(i,n){
        scanf("%lld",&a[i]);
    }
    */

    // 文字列スキャン
    /*
    string s;
    cin >> s;
    */


int main() {
    int n;
    scanf("%d",&n);
    int t;
    scanf("%d",&t);
    int aa;
    scanf("%d",&aa);
    double a[n] = {};
    double min = 9999;
    int ans = 0;
    rep(i,n){
        scanf("%lf",&a[i]);
        a[i] = abs((t-a[i]*0.006)-aa);
        if(a[i]<min){
            min = a[i];
            ans = i+1;
        }
    }

    

    cout << ans << endl;

    return 0;
}



Measured memory_bytes: 256