akhauriyash/Code-Regression huggingface dataset:
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>

#include <iostream>
#include <complex>
#include <string>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>

#include <functional>
#include <cassert>

typedef long long ll;
using namespace std;

#define debug(x) cerr << __LINE__ << " : " << #x << " = " << (x) << endl;

#define mod 1000000007 //1e9+7(prime number)
#define INF 1000000000 //1e9
#define LLINF 2000000000000000000LL //2e18
#define SIZE 300

set<int> calc(char *s){
  int r, counter  = 0;
  
  for(r=0;;r++){
    if(s[r] == '(') counter++;
    if(s[r] == ')') counter--;
    if(counter < 0) break;
  }
  
  set<int> num[11];
  char op[11];

  int pos = 0, curnum = 0, f = 0;
  
  for(int i=0;i<r;i++){
    if(s[i] == '('){
      num[pos] = calc(s+i+1);
      int counter = -1;
      while(1){
        counter += (s[i] == '(') - (s[i] == ')');
        if(counter < 0) break;
        i++;
      }
      f = true;
      continue;
    }

    if('0' <= s[i] && s[i] <= '9'){
      curnum = curnum * 10 + (s[i] - '0');
      continue;
    }

    if(!f)
      num[pos] = {curnum};

    op[pos] = s[i];
    pos++;
    curnum = 0;
    f = false;
  }
  
   if(!f) num[pos] = {curnum};
   
   if(pos == 0) return num[0];
   
  int per[11];
  for(int i=0;i<pos;i++) per[i] = i;
  
  set<int> res;

  
  do{
    bool used[11] = {};

    set<int> temp[11];
    for(int i=0;i<=pos;i++) temp[i] = num[i];
    
    for(int i=0;i<pos;i++){
      int lnum = per[i];
      int rnum = per[i]+1;

      while(used[lnum]) lnum--;
      while(used[rnum]) rnum++;
      
      set<int> cur;

      for(int a : temp[lnum]){
        for(int b : temp[rnum]){
          switch(op[per[i]]){
          case '+':
            cur.insert(a + b);
            break;
          case '-':
            cur.insert(a - b);
            break;
          case '*':
            cur.insert(a * b);
            break;
          case '/':
            if(b != 0) cur.insert(a / b);
            break;
          }
        }
      }

      temp[lnum] = cur;
      used[rnum] = true;
    }

    for(int a: temp[0]){
      res.insert(a);
    }

  }while(next_permutation(per, per+pos));

  /*
  for(int i=0;i<r;i++){
    printf("%c", s[i]);
  }
  puts("");
  for(int a: res){
    printf(" = %d\n", a);
  }
  */
  
  return res;
}

int solve(){
  char formula[SIZE];

  scanf("%s", formula);
  int n = strlen(formula);
  formula[n] = ')';
  n++;
  
  if(formula[0] == '#') return false;

  printf("%d\n", (int)calc(formula).size());

  return true;
}

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



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


Measured memory_bytes: 18476
#include <stdio.h>

void swap(int num[], int a, int b)
{
    int tmp;
    tmp = num[a];
    num[a] = num[b];
    num[b] = tmp;
}

int main(void)
{
    int num[3];
    scanf("%d %d %d", &num[0], &num[1], &num[2]);
    int i, j;
    
    for(i = 0; i < 3; i++)
        for(j = i+1; j < 3; j++)
            if(num[i] > num[j])
            swap(num, i, j);
    printf("%d %d %d\n", num[0], num[1], num[2]);
    
    return 0;
    
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
 
signed main(){
  int a;
  scanf("%d",&a);
  int b[4][3][10]{};
  for(int c=0;c<a;c++){
      int d,e,f,g;
      scanf("%d%d%d%d",&d,&e,&f,&g);
      b[d-1][e-1][f-1]+=g;
      }
      for(int t=0;t<4;t++){
	  for(int x=0;x<3;x++){
	      for(int z=0;z<10;z++){
		  printf(" %d",b[t][x][z]);
		  }
		  printf("\n");
	      }
	      if(t<3){
		  for(int s=0;s<20;s++){
		      printf("#");
		      }
		      printf("\n");
		  }
		  
	  }
}

Measured memory_bytes: 3188
#include <iostream>
#include <algorithm>
using namespace std;
int main(void){
  int n,s=0;
  cin >> n;
  while (n>0){
    s+=n%10;
    n/=10;
  }
  if (s==1) cout << 10 << endl;
  else cout << s << endl;
  return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#define MAX_N 100001
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
vector<ll> Gh[MAX_N],Gl[MAX_N];
ll n,m,used_l[MAX_N]={},used_h[MAX_N]={};
void search_human(ll v);
void search_lang(ll v);

void search_human(ll v){
  if(used_h[v]){
    return;
  }
  used_h[v]=true;
  for(int i=0;i<Gh[v].size();i++){
    search_lang(Gh[v][i]);
  }
}
void search_lang(ll v){
  if(used_l[v]){
    return;
  }
  used_l[v]=true;
  for(int i=0;i<Gl[v].size();i++){
    search_human(Gl[v][i]);
  }
}
signed main(){
  ll k,l;
  bool can=true;
  cin >> n >> m;
  for(int i=0;i<n;i++){
    cin >> k;
    for(int j=0;j<k;j++){
      cin >> l;
      l--;
      Gh[i].push_back(l);
      Gl[l].push_back(i);
    }
  }
  search_human(0);
  for(int i=0;i<n;i++){
    if(used_h[i]==false){
      can=false;
      break;
    }
  }
  if(can){
    cout <<"YES\n";
  }else{
    cout <<"NO\n";
  }
}


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

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

    bool zoro = false;
    int count = 0;

    for(int i = 0; i < N; i++) {
        int D1, D2;
        cin >> D1 >> D2;
        if(D1 == D2) {
            count += 1;
            if(count >= 3) {
                zoro = true;
            }
        } else {
            count = 0;
        }
    }

    if(zoro) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }

    return 0;
}

Measured memory_bytes: 3564
N = int(input())
a = list(map(int, input().split()))

min_a = 10**6+1
max_a = -10**6-1
for i in range(N):
    if a[i] < min_a:
        min_a = a[i]
        i_min = i
    if a[i] > max_a:
        max_a = a[i]
        i_max = i

print(2 * (N-1))
if abs(max_a) >= abs(min_a):
    for i in range(N):
        if i != i_max:
            print(i_max+1, i+1)
    for i in range(N-1):
        print(i+1, i+2)
else:
    for i in range(N):
        if i != i_min:
            print(i_min+1, i+1)
    for i in range(N-1):
        print(N-i, N-i-1)


Measured memory_bytes: 38384
# https://atcoder.jp/contests/abc065/tasks/abc065_b

N = int(input())
a_list = []

for i in range(N):
    a = int(input())
    a_list.append(a)


current = 0
count = 0
for _ in range(N):
    current = a_list[current] - 1
    count += 1

    if current == 1:
        print(count)
        exit()

print(-1)

Measured memory_bytes: 7084
#include<iostream>
#include<stack>

using namespace std;

int main(){

   while(1){
      string s;
      getline(cin, s);
      if(s==".") break;
      
      stack<char> S;
      for(int i=0; i<s.size(); i++){
         if(s[i]=='(' or s[i]=='['){
            S.push(s[i]);
         }else if(s[i]==')'){
            if(S.empty()){
               cout<< "no"<< endl;
               break;
            }
            char c=S.top();
            if(c=='('){
               S.pop();
            }else{
               cout<< "no"<< endl;
               break;
            }
         }else if(s[i]==']'){
            if(S.empty()){
               cout<< "no"<< endl;
               break;
            }
            char c=S.top();
            if(c=='['){
               S.pop();
            }else{
               cout<< "no"<< endl;
               break;
            }
         }else if(s[i]=='.'){
            if(S.empty()){
               cout<< "yes"<< endl;
            }else{
               cout<< "no"<< endl;
            }
         }
      }
   }
   return 0;
}

Measured memory_bytes: 3164
#include <bits/stdc++.h>
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=int(a);i<int(b);i++)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define rrep(i,n) for (int i=(n-1);i >= 0;i--)
#define all(v) v.begin(),v.end()
#define sz(v) (int)((v).size())
#define MAX(v) *max_element(all(v))
#define MIN(v) *min_element(all(v))
using namespace std; using ll = long long; using P = pair<int,int>;
using vl = vector<ll>; using vvl = vector<vl>;
void debug_out() { cout << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
    cout << H << " ";
    debug_out(T...);
}
#ifdef _DEBUG
#define debug(...) debug_out(__VA_ARGS__)
#else
#define debug(...)
#endif
template <typename T>
std::ostream& operator<<(std::ostream& os, std::vector<T> vec) {
    for (std::size_t i = 0; i < vec.size(); i++)os << vec[i] << (i + 1 == vec.size() ? "" : " ");
    return os;
}
inline void IN(void){return;}
template <typename First, typename... Rest>
void IN(First& first, Rest&... rest){cin >> first;IN(rest...);return;}
template<class T>bool chmax(T &a, const T &b) {if(a<b){a=b; return 1;} return 0;}
template<class T>bool chmin(T &a, const T &b) {if(b<a){a=b; return 1;} return 0;}
const ll INF = 1LL << 60;
const int dx[8] = {1,0,-1,0,1,1,-1,-1}; const int dy[8] = {0,1,0,-1,1,1,-1,-1};
const ll mod = 1000000007;

ll modPow(ll a,ll n){
    if(n == 1) return a%mod;
    if(n%2 == 1) return (a*modPow(a,n-1))%mod;
    ll t = modPow(a,n/2);
    return t*t%mod;
}

int main(){
    cin.tie(0); ios::sync_with_stdio(false);
    int n,k;
    cin >> n >> k;
    // a[i]はgcdがiになる組個数
    // a[i]をgcdがiの倍数になる組の個数で初期化
    vl a(k+1);
    rep(i,1,k+1){
        a[i] = modPow(k/i,n);
    }
    // a[i]の初期値から余計なものを引く
    for(int i = k;i >= 1;i--){
        for(int j = 2;i*j <= k;j++){
            a[i] = (a[i] - a[i*j] + mod)%mod;
        }
    }
    ll ans = 0;
    rep(i,1,k+1){
        ans = (ans+a[i]*i%mod)%mod;
    }
    cout << ans << endl;
}

Measured memory_bytes: 3964
n = int(input())
*x, = map(int, input().split())
*y, = map(int, input().split())
print(sum([abs(x[i]-y[i]) for i in range(n)]))
print(sum([(x[i]-y[i])**2 for i in range(n)])**0.5)
print(sum([abs(x[i]-y[i])**3 for i in range(n)])**(1/3))
print(max([abs(x[i]-y[i]) for i in range(n)]))



Measured memory_bytes: 5652
#include <bits/stdc++.h>
//#pragma GCC optimize(2)

using namespace std;

#define LL long long
#define Re register
#define U unsigned
#define forn(i,a,b) for(int i = a;i <= b;++i)
#define nfor(i,a,b) for(int i = a;i >= b;--i)
#define CLR(i,a) memset(i,a,sizeof(i))
#define BR printf("--------------------\n")
#define pb push_back
#define Rep(i,a,b) for(int i=a;i<=b;i++)
#define DEBUG(x) std::cerr << #x << '=' << x << std::endl
const double PI=atan(1.)*4.;
const int maxn=1e5+5;
const int inf = 0x3f3f3f3f;
const int mod=1e9+7;
const double e=2.71828182845904523536;
int dirx[8]={1,0,-1,0,1,-1,-1,1};
int diry[8]={0,1,0,-1,1,1,-1,-1};
int n,m;
struct node
{
    LL a,b;
    double x;
}st[maxn];

bool cmp(node a,node b)
{
    return a.a^b.a?a.a<b.a:a.b>b.b;
}


int main()
{
	ios::sync_with_stdio(false);
    cin.tie(0);
   	cout.tie(0);
    cin>>n>>m;
    for(int i=0;i<n;i++)
    {
        cin>>st[i].a>>st[i].b;
    }
    sort(st,st+n,cmp);
    LL ans=0;
    priority_queue<int> q;
    int cur=0;
    for(int i=m-1;i>=0;i--)
    {
        while(cur<n&&i+st[cur].a<=m)
        {
            q.push(st[cur++].b);
        }
        if(!q.empty())
        {
            ans+=q.top();
            q.pop();
        }
    }
    cout<<ans;
	return 0;
}


Measured memory_bytes: 3196
MOD = int(1e9+7)
def modpow(a, p, mod):  # return a**p (% MOD)
  res = 1
  while p > 0:
    if p & 1 > 0:
        res = res * a % mod
    a = a**2 % mod
    p >>= 1
  return res

N, K = map(int, input().strip().split())
res = [-1]*(K+1)  # res[x] := gcd(...)がxになるものの個数(%MOD)
for x in range(K, 0, -1):
  n = K//x  # 1~Kの中に、xの倍数がいくつあるか
  if n == 1: res[x] = 1
  else:
    res[x] = modpow(n, N, MOD)
    for i in range(2,n+1):
      res[x] = (res[x] - res[x*i]) % MOD

ans = 0
for i in range(1, K+1):
  ans = (ans + i*res[i]) % MOD
print(ans)

Measured memory_bytes: 11268
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

typedef struct {
    int idx;
    int cnt;
} Num;

static int cmp_num (const void *a, const void *b) {
    return ((Num*)b)->cnt - ((Num*)a)->cnt;
}

int main (void) {
    int i;
    int n;
    int v;
    Num eve[100001], odd[100001];
    int ans=0;

    /* initialize */
    for ( i=0; i<100001; i++ ) {
        eve[i].idx = i;
        eve[i].cnt = 0;
        odd[i].idx = i;
        odd[i].cnt = 0;
    }

    scanf("%d", &n);

    for ( i=0; i<n; i++ ) {
        scanf("%d", &v);
        if ( i%2 == 0 )
            eve[v].cnt++;
        else
            odd[v].cnt++;
    }

    qsort(eve, 100001, sizeof(Num), cmp_num);
    qsort(odd, 100001, sizeof(Num), cmp_num);

    if ( eve[0].idx == odd[0].idx ) {
        if ( eve[0].cnt + odd[1].cnt > eve[1].cnt + odd[0].cnt )
            ans += n - (eve[0].cnt + odd[1].cnt);
        else
            ans += n - (eve[1].cnt + odd[0].cnt);
    }
    else
        ans += n - (eve[0].cnt + odd[0].cnt);

    printf("%d\n", ans);
    return EXIT_SUCCESS;
}


Measured memory_bytes: 2352
#include<iostream>
#include<vector>

using namespace std;

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

    for(int i=0;i<N;++i){
        cin >> x;
        if(x%2==0){
            if(x%3!=0 and x%5!=0){
                cout << "DENIED" << endl;
                return 0;
            }
        }
    }

    cout << "APPROVED" << endl;
    return 0;
   
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for(int i=0; i<(n); i++)
#define itrep(type, it, t) for(type::iterator it=t.begin(); it!=t.end(); it++)
using namespace std;


int main(void) {

    int N;
    cin >> N;
    map<int , int>A;
    string ans = "YES";

    rep(i, N) {
        int a;
        cin >> a;
        A[a]++;

        if(A[a] > 1) {
            ans = "NO";
        }
    }
    cout << ans;
    return 0;
}

Measured memory_bytes: 9600
#include <bits/stdc++.h>
using namespace std;
#define repr(i,k,n) for(int i = (k); i < (n); i++)
#define rep(i,n) repr(i,0,n)
#define ALL(a) begin(a),end(a)
const int INF = 114514810;
const int MOD = 1000000007;
typedef vector<int> vi;
typedef vector<string> vs;
typedef long long ll;
int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	int A,B,C,D;
	cin >> A >> B >> C >> D;
	bool can=false;
	if (abs(A-B)<=D&&abs(B-C)<=D||abs(A-C)<=D){
		can = true;
	}
	cout << (can?"Yes":"No") << endl;
}

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

using namespace std;

int dfs(const vector<int>& p,int i,vector<int>& to,vector<int>& vis)
{
	if(vis[i]) return to[i];
	vis[i]=1; to[i]=-1;
	if(p[i]==0) return to[i]=i;
	return to[i]=dfs(p,i+p[i],to,vis);
}

int main()
{
	for(int n;cin>>n;){
		vector<int> p(n);
		for(int i=0;i<n;i++) cin>>p[i];
		
		vector<int> to(n),vis(n);
		for(int i=0;i<n;i++)
			if(!vis[i])
				dfs(p,i,to,vis);
		
		vector<int> step(n,1<<29);
		queue<pair<int,int>> q; q.emplace(0,0);
		while(!q.empty()){
			int i=q.front().first,c=q.front().second; q.pop();
			if(step[i]<=c) continue;
			step[i]=c;
			for(int j=1;j<=6;j++)
				if(to[min(i+j,n-1)]!=-1)
					q.emplace(to[min(i+j,n-1)],c+1);
		}
		
		cout<<step[n-1]<<endl;
	}
}

Measured memory_bytes: 3900
#include <bits/stdc++.h>
 
using namespace std;
 
 #define tr(c, i) for (__typeof((c).begin()) i = (c).begin(); i != (c).end(); i++)
#define   ipr         	pair<int, int>
#define   pb            push_back
#define   ff            first
#define   ss            second
#define fill(a,b) memset(a, b, sizeof(a))
#define   fr(i, j, k)   for (int i = j; i < k; i++)
#define   rf(i, j, k)   for (int i = j; i >= k;i--)
#define   int           long long int
#define   ll 			unsigned long long
#define   ld            long double
#define   all(x)        x.begin(), x.end()
#define   rall(x)       x.rbegin(),x.rend()
#define   mp            make_pair
#define L(x) ('a'<=x && x<='z')
#define   inf           INT_MAX
#define   read_file();	freopen("input.txt", "r", stdin);	freopen("output.txt", "w", stdout);
#define   IOS           std::ios::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
 
 
const ld  pi   =  acos(-1);
const int mod =  1000000007;
const double epsilon = 1e-9; 
 
 
template<class T> ostream& operator <<(ostream &out,vector<T> &A){for(auto x:A) out<<x<<" ";return out;}
template<class T> ostream& operator <<(ostream &out,set<T> &A){for(auto x:A) out<<x<<" ";return out;}
template<class T> ostream& operator <<(ostream &out,unordered_set<T> &A){for(auto x:A) out<<x<<" ";return out;}
template <class T1,class T2>T1 powr(T1 a,T2 b){T1 res = 1;fr(i,1,b+1)res = res*a;return res;}
 
int binpow(int a,int b) {
    a=a%mod;
   
    int res = 1;
while (b > 0) {
        if (b & 1)res = (res * a)%mod;
        a = (a * a)%mod;
        b >>= 1;
}
return (res+mod)%mod;
}


void dfs(int index, vector<vector<int>> &graph, vector<bool> &vis){
 
 if(vis[index])return;

 vis[index]=true;

 fr(i,0,graph[index].size()){
    int idx = graph[index][i];
    dfs(idx,graph,vis);
 }

}
 



 
 int32_t main(){
    IOS;
 
     int t;
     //cin>>t;
   
     t=1;
   while(t--){
    int n,m;
    cin>>n>>m;
    vector<vector<int>>G(n);
    vector<bool>visited(n,false);

    
    while(m--){
       int x,y;
       cin>>x>>y;

       x--;
       y--;

       G[x].pb(y);
       G[y].pb(x);
    }


    dfs(0,G,visited);

    int cnt=0;

    fr(i,0,n){
       if(!visited[i]){
          dfs(i,G,visited);
          cnt++;
       }
    }

 cout<<cnt<<"\n";
   
 }
 }

Measured memory_bytes: 10292
#include<iostream>
#include<string>
#include<algorithm>    
#include<cmath>
#include<map>
#include<vector>
#include<math.h>
#include<stdio.h>
#include<stack>
#include<queue>
#include<tuple>
#include<cassert>
#include<set>
//#include<bits/stdc++.h>
using ll = long long;
using namespace std;
const ll INF = 10000000000000000;
const ll mod = 1000000007;
ll test[1234][1234];
signed main() {
	ll n = 0, m = 0, k, l, cnt = 0, z = 0; cin >> k >> l >> n;
	cnt = k * 100 + l * 10 + n;
	if (cnt % 4 == 0) { cout << "YES" << endl; }
	else { cout << "NO" << endl; }
	cin >> n; return 0;
}

Measured memory_bytes: 256
import java.util.*;
import java.io.*;

public class Main {
    public static void main(String[] args) {
        FastScanner sc = new FastScanner();
        String s = sc.next();
        int l = 0;
        int r = s.length() - 1;
        int cnt = 0;
        while (l < r) {
            char ch1 = s.charAt(l);
            char ch2 = s.charAt(r);
            if (ch1 == ch2) {
                l++;
                r--;
            } else {
                if (ch1 == 'x') {
                    l++;
                    cnt++;
                } else if (ch2 == 'x') {
                    r--;
                    cnt++;
                } else {
                    System.out.println(-1);
                    return;
                }
            }
        }
        System.out.println(cnt);
    }
}

class FastScanner {
    private final InputStream in = System.in;
    private final byte[] buffer = new byte[1024];
    private int ptr = 0;
    private int buflen = 0;

    private boolean hasNextByte() {
        if (ptr < buflen) {
            return true;
        } else {
            ptr = 0;
            try {
                buflen = in.read(buffer);
            } catch (IOException e) {
                e.printStackTrace();
            }
            if (buflen <= 0) {
                return false;
            }
        }
        return true;
    }

    private int readByte() {
        if (hasNextByte())
            return buffer[ptr++];
        else
            return -1;
    }

    private static boolean isPrintableChar(int c) {
        return 33 <= c && c <= 126;
    }

    public boolean hasNext() {
        while (hasNextByte() && !isPrintableChar(buffer[ptr]))
            ptr++;
        return hasNextByte();
    }

    public String next() {
        if (!hasNext())
            throw new NoSuchElementException();
        StringBuilder sb = new StringBuilder();
        int b = readByte();
        while (isPrintableChar(b)) {
            sb.appendCodePoint(b);
            b = readByte();
        }
        return sb.toString();
    }

    public long nextLong() {
        if (!hasNext())
            throw new NoSuchElementException();
        long n = 0;
        boolean minus = false;
        int b = readByte();
        if (b == '-') {
            minus = true;
            b = readByte();
        }
        if (b < '0' || '9' < b) {
            throw new NumberFormatException();
        }
        while (true) {
            if ('0' <= b && b <= '9') {
                n *= 10;
                n += b - '0';
            } else if (b == -1 || !isPrintableChar(b)) {
                return minus ? -n : n;
            } else {
                throw new NumberFormatException();
            }
            b = readByte();
        }
    }

    public int nextInt() {
        long nl = nextLong();
        if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE)
            throw new NumberFormatException();
        return (int) nl;
    }

    public double nextDouble() {
        return Double.parseDouble(next());
    }
}


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

int main(void){
    string s;
    cin >> s;
    for(int i=0; i<s.size(); i+=2){
        if(s[i] == 'L'){
            cout << "No" << endl;
            return 0;
        }
    }
    for(int i=1; i<s.size(); i+=2){
        if(s[i] == 'R'){
            cout << "No" << endl;
            return 0;
        }
    }
    cout << "Yes" << endl;
    return 0;
}

Measured memory_bytes: 256
fn main() {
    println!("{:?}", solve(input()));
}

fn input() -> u64 {
    let mut buf = String::new();
    std::io::stdin().read_line(&mut buf).unwrap();
    buf.pop();
    let x: u64 = buf.parse().unwrap();
    x
}

fn solve(x: u64) -> u64 {
    let mut amount: u64 = 100;
    let mut counter = 0;
    loop {
        amount += amount / 100;
        counter += 1;
        if x <= amount { break; }
        
    }
    counter
}

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

using ll = long long;
const ll MOD = 1e9 + 7;

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  
  ll n, k;
  cin >> n >> k;
  
  vector<ll> keep(n + 1);
  for (int i = 1; i <= n; i++) {
    keep.at(i) = i;
    keep.at(i) += keep.at(i - 1);
  }
  
  ll ans = 0;
  for (ll i = k; i <= n + 1; i++) {
    if (i == n + 1) ans += 1;
    else ans += keep.at(n) - keep.at(n - i) - keep.at(i - 1) + 1;
    ans %= MOD;
  }
  
  cout << ans << '\n';
}

Measured memory_bytes: 4756
import sys

input = sys.stdin.readline

def main():
  n, a, b = map(int, input().split())
  h = [int(input()) for _ in range(n)]
  h.sort()
  
  l, r = -1, h[-1]+1
  while r-l > 1:
    key = (r+l)//2
    count = 0
    for i in range(n):
      if h[i] <= key*b:
        continue
      else:
        count += (h[i]-key*b-1)//(a-b)+1
    if count <= key:
      r = key
    else:
      l = key
  print(r)
  
if __name__ == "__main__":
  main()

Measured memory_bytes: 13212
#include<iostream>
#include<string>
using namespace std;
int main()
{
	int x[5];
	for (int i = 0; i < 5 ;i++)
	{
		cin >> x[i];
	}
	for (int i = 0; i < 5; i++)
	{
		if (x[i] == 0)
		{
			cout << i + 1;
		}
	}
}

Measured memory_bytes: 3592
import java.util.*;


public class Main {
    public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int r = sc.nextInt();
		if (n >= 10) {
		    System.out.println(r);
		} else {
		    System.out.println(r + (100*(10 - n)));
		}
		
		
    }
}



Measured memory_bytes: 35628
s = input()
N = len(s)
count_w = 0
for i in range(N):
    if ((i%2) == 0 and int(s[i]) == 0) or ((i%2) == 1 and int(s[i]) == 1):
        count_w += 1
count_b = 0
for i in range(N):
    if ((i%2) == 0 and int(s[i]) == 1) or ((i%2) == 1 and int(s[i]) == 0):
        count_b += 1
print(min(count_b,count_w))

Measured memory_bytes: 3316
max_n = 110000

N = int(input())

dp = [N for i in range(max_n)]
dp[0] = 0
for n in range(1, N+1):
    for pow6 in range(n+1):
        if 6 ** pow6 <= n:
            dp[n] = min(dp[n], dp[n - 6 ** pow6] + 1)
        else:
            break

    for pow9 in range(n+1):
        if 9 ** pow9 <= n:
            dp[n] = min(dp[n], dp[n - 9 ** pow9] + 1)
        else:
            break

# print(dp)
print(dp[N])


Measured memory_bytes: 4040
#include <algorithm>
#include <cmath>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <string>
#include <unordered_set>
#include <vector>

using namespace std;
using LLONG = long long;
const LLONG MOD = 1000000007;

int main()
{
	string S; cin >> S;
	if (S.length() < 4) cout << "No" << endl;
	else if (S.substr(0, 4) == "YAKI") cout << "Yes" << endl;
	else  cout << "No" << endl;
}

Measured memory_bytes: 3632
import math
import fractions
from functools import reduce

def gcd(*numbers):
    return reduce(fractions.gcd, numbers)

def gcd_list(numbers):
    return reduce(fractions.gcd, numbers)

N = int(input())

List = list(map(int,input().split()))

a = List[0]
L = [0 for i in range(N)]
L[0] = a
for i in range(1,N):
  L[i] = gcd(List[i],L[i-1])
  
a = List[-1]
R = [0 for i in range(N)]
R[0] = a
for i in range(1,N):
  R[i] = gcd(List[-i-1],R[i-1])


p = 0
for i in range(N):
  if i == 0:
    ans = R[N-2]
  elif i == N-1:
    ans = L[-2]
  else:
    a = L[i-1]
    b = R[N-i-2]
    ans = gcd(a,b)
  p = max(p,ans)
  
print(int(p))

Measured memory_bytes: 16156
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < int(n); i++)
using namespace std;
using ll = long long;
const int INF = (1<<30)-1;
const long long LINF = (1LL<<62)-1;
const int dx[] = {-1, 0, 1, 0};
const int dy[] = {0, 1, 0, -1};
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

signed main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n;
  string s;
  cin >> n >> s;
  vector<int> r, g, b;
  rep(i, n) {
    if (s[i] == 'R')
      r.push_back(i);
    else if (s[i] == 'G')
      g.push_back(i);
    else
      b.push_back(i);
  }
  ll ans = 0;
  rep(i, r.size()) rep(j, g.size()) {
    ans += b.size();
    int mn = min(r[i], g[j]), mx = max(r[i], g[j]), d = mx-mn;
    auto it = lower_bound(b.begin(), b.end(), mx+d);
    if (it != b.end() && *it == mx+d)
      ans--;
    it = lower_bound(b.begin(), b.end(), mn-d);
    if (it != b.end() && *it == mn-d)
      ans--;
    it = lower_bound(b.begin(), b.end(), mn+d/2);
    if (d%2 == 0 && it != b.end() && *it == mn+d/2)
      ans--;
  }
  cout << ans << endl;
  return 0;
}

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

int main() {
  
  int a,b;
  cin>>a>>b;
  int c=1;
  int count=0;
  while(c<b){
    c--;
    count++;
    c+=a;
    
  }
 cout<<count<<endl;
  
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,N) for(int i=0;i<(N);i++)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
using namespace std;
const long long MOD = 1e9 + 7;
const long long INF = 1e12;
const int inf = 1e9;
const int mod = 1e9+7;
typedef long long ll;
typedef pair<ll,int> P;
typedef set<int> S;
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; }
int main(){
    cout << fixed << setprecision(10);
    int n;
    string s;
    cin >> n >> s;
    int ans = 0;
    rep(i,1000){
        int now = i;
        string t = "";
        rep(j,3){
            t += '0' + now%10;
            now /= 10;
        }
        int itr = 0;
        int itr_t = 0;
        while(itr < n){
            if(s[itr] == t[itr_t]){
                itr++;
                itr_t++;
                if(itr_t == 3){
                    ans++;
                    break;
                }
            }
            else itr++;
        }
    }
    cout << ans << endl;
    return 0;
}

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

using namespace std;

#define SZ(v) ((int)(v).size())
#define ALL(v) (v).begin(),(v).end()
#define one first
#define two second
using ll = long long;
using pi = pair<int, int>;
const int INF = 0x3f3f3f3f;
const ll LINF = 1ll * INF * INF;

const int MAX_K = 1e2 + 10;

int N, M, K;
int Nr[MAX_K][3];
int main() {
	cin >> N >> M >> K;
	int ans = 0;
	for(int i=0; i<K; i++) for(int k=0; k<3; k++) scanf("%d", &Nr[i][k]);
	for(int i=1; i<=N; i++) for(int j=1; j<=M; j++) {
		bool isCan = false;
		for(int k=0; k<K; k++) {
			if(Nr[k][2] == 1 && i <= Nr[k][0]) isCan = true;
			if(Nr[k][2] == 2 && i >  Nr[k][0]) isCan = true;
			if(Nr[k][2] == 3 && j <= Nr[k][1]) isCan = true;
			if(Nr[k][2] == 4 && j >  Nr[k][1]) isCan = true;
			if(isCan) break;
		}
		if(isCan) ans++;
	}
	cout << N * M - ans << endl;
	return 0;
}


Measured memory_bytes: 256
import itertools
n, m, k = [int(i) for i in input().split()]
a_list = [int(i) for i in input().split()]
b_list = [int(i) for i in input().split()]

a_acc = [0]
a_acc.extend(list(itertools.accumulate(a_list)))
b_acc = [0]
b_acc.extend(list(itertools.accumulate(b_list)))

ans = 0
j = m
for i in range(n+1):
    if a_acc[i] > k:
        break

    while b_acc[j] > k - a_acc[i]:
        j -= 1

    ans = max(ans, i+j)

print(ans)


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

// #define int long long
#define rep(i, n) for (int i = (int)(0); i < (int)(n); ++i)
#define reps(i, n) for (int i = (int)(1); i <= (int)(n); ++i)
#define rrep(i, n) for (int i = ((int)(n)-1); i >= 0; i--)
#define rreps(i, n) for (int i = ((int)(n)); i > 0; i--)
#define irep(i, m, n) for (int i = (int)(m); i < (int)(n); ++i)
#define ireps(i, m, n) for (int i = (int)(m); i <= (int)(n); ++i)
#define SORT(v, n) sort(v, v + n);
#define REVERSE(v, n) reverse(v, v+n);
#define vsort(v) sort(v.begin(), v.end());
#define all(v) v.begin(), v.end()
#define mp(n, m) make_pair(n, m);
#define cout(d) cout<<d<<endl;
#define coutd(d) cout<<std::setprecision(10)<<d<<endl;
#define cinline(n) getline(cin,n);
#define replace_all(s, b, a) replace(s.begin(),s.end(), b, a);
#define PI (acos(-1))
#define FILL(v, n, x) fill(v, v + n, x);
#define sz(x) int(x.size())

using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using vs = vector<string>;
using vpll = vector<pair<ll, ll>>;

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 = 1e15;
const int MOD = 1e9+7;
const ll LINF = 1e18;

ll n,m;
bool G[55][55];
bool visited[55];


void dfs(ll v){
  if(visited[v]) return;
  visited[v]=true;
  rep(i,n){
    if(G[i][v]){
      dfs(i);
    }
  }
}

signed main()
{
  cin.tie( 0 ); ios::sync_with_stdio( false );
  cin>>n>>m;
  vll a(m), b(m);
  rep(i,m){
    cin>>a[i]>>b[i];
    a[i]--,b[i]--;
  }
  
  ll ans=0;
  rep(i,m){
    memset(G,false,sizeof(G));
    memset(visited,false,sizeof(visited));
    rep(j,m){
      if(i==j) continue;
      G[a[j]][b[j]]=G[b[j]][a[j]]=true;
    }
    dfs(0);
    bool ok=true;
    rep(i,n) if(!visited[i]) ok=false;
    if(!ok) ans++;
  }
  cout<<ans<<endl;
}

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

int main(){
//srandom((unsigned long)time(NULL));

int k,a,b;
cin>>k>>a>>b;

string ans="NG";
for(int i=a;i<=b;i++){
    if(i%k==0) ans="OK";
}

cout<<ans<<endl;


return 0;
}



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

using namespace std;

int n, k;
int d;
int all;
int cou[110];
int ans;

int main(void)
{
	scanf("%d %d", &n, &k);
	
	for(int i = 0 ; i < k ; i++)
	{
		scanf("%d", &d);
		
		for(int j = 0 ; j < d ; j++)
		{
			scanf("%d", &all);
			cou[all] = 1;
		}
	}
	
	for(int i = 1 ; i <= n ; i++)
	{
		if(cou[i] == 0)
			ans++;
	}
	
	printf("%d", ans);
	return 0;
}

Measured memory_bytes: 3824
#include <iostream>
#include <queue>
#include <cstdio>
using namespace std;
#define rep(i,n) for(int i=0;i<(n);++i)
#define rep1(i,n) for(int i=1;i<=(n);++i)
#define all(c) (c).begin(),(c).end()
typedef pair<int,int> P;
int d[140][140],dx[6]={0,1,1,0,-1,-1},dy[6]={1,1,0,-1,-1,0},mid=70,t;
bool obs[140][140];
void bfs(int x,int y){
	d[x][y]=0;
	queue<P> que;
	que.push(P(x,y));
	while(!que.empty()){
		P p=que.front();
		que.pop();
		int x=p.first,y=p.second;
		if(d[x][y]==t) break;
		rep(i,6){
			int nx=x+dx[i],ny=y+dy[i];
			if(obs[nx][ny] || d[nx][ny]!=1e8) continue;
			d[nx][ny]=d[x][y]+1;
			que.push(P(nx,ny));
		}
	}
}
int main(){
	while(true){
		int n;
		cin >> t >> n;
		if(t==0) break;
		rep(i,140) rep(j,140) d[i][j]=1e8,obs[i][j]=0;
		rep(i,n){
			int x,y;
			cin>>x>>y;
			x+=mid,y+=mid;
			obs[x][y]=true;
		}
		int x,y;
		cin>>x>>y;
		bfs(x+mid,y+mid);
		int cnt=0;
		rep(i,140) rep(j,140) if(d[i][j]!=1e8) cnt++;
		cout << cnt << endl;
	}
}

Measured memory_bytes: 1312
import std.functional,
       std.algorithm,
       std.container,
       std.typetuple,
       std.typecons,
       std.bigint,
       std.string,
       std.traits,
       std.array,
       std.range,
       std.stdio,
       std.conv,
       std.format;

void main()
{
auto ip = readln.split.to!(int[]);
writefln("%s %s %.10f", ip[0]/ip[1], ip[0]%ip[1], ip[0].to!double/ip[1].to!double);
}


Measured memory_bytes: 2564
#include <iostream>
using namespace std;
 
int main(void) {
	int N, A, B;
	cin >> N;
 
	if (N == 1) {
		cout << "Hello World" << endl;
	}
	else if (N == 2) {
		cin >> A;
		cin >> B;
		cout << A + B << endl;
}
		return 0;
	}

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

#define __m int mid=(l+r)>>1
#define lson l,mid,rt<<1
#define rson mid+1,r,rt<<1|1

template<class T>
inline bool rd(T &num) {
    char in;
    bool IsN = false;
    while(in = getchar(), in != '-' && (in < '0' || in > '9'))if(in == EOF)return false;
    in == '-' ? (IsN = true, num = 0) : num = in - '0';
    while(in = getchar(), in >= '0' && in <= '9')num = num * 10 + in - '0';
    return IsN ? num = -num : num, true;
}

#define rep(i,a,b) for(register int i = (a); i< (b); i++)
#define per(i,a,b) for(register int i = (a); i> (b); i--)
#define clr(a) memset(a,0,sizeof(a));
#define inf(a) memset(a,0x3f,sizeof(a));
#define IO ios::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define rd2(a,b) rd(a)&&rd(b)
#define rd3(a,b,c) rd(a)&&rd(b)&&rd(c)
#define min(a,b) ((a)<(b)?(a):(b))
#define max(a,b) ((a)>(b)?(a):(b))

string nico;
#ifdef LOCAL
#define bug(x) cout<<#x<<" : "<<x<<endl
#define infile(x) freopen(x,"r",stdin)
#define outfile(x) freopen(x,"w",stdout)
#else
#define bug(x)
#define infile(x)
#define outfile(x)
#endif

const int maxn = 1e5 + 7;
const int inf  = 0x3f3f3f3f;
const LL linf  = (LL)inf << 32 | inf;
const int mod  = 1e9 + 7;

int num[maxn];
int main() {
    IO;
    int ans=0,pos=0;
    int n,k;
    cin>>n>>k;
    rep(i,0,n){
        cin>>num[i];
        if(num[i]==1)
            pos = i;
    }
    int l=pos,r=pos; 
    while(!(l==0 && r==n-1)){
        int t = k-1;
        while(l!=0 && t){
            l--;
            t--;
        }
        while(r!=n-1 && t){
            r++;
            t--;
        }
        ans++;
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < n; i++)
#define rep2(i, x, n) for(int i = x; i <= n; i++)
#define rep3(i, x, n) for(int i = x; i >= n; i--)
#define elif else if
#define sp(x) fixed << setprecision(x)
#define pb(x) push_back(x)
#define all(x) x.begin(), x.end()
using ll = long long;
using ld = long double;
using pii = pair<int, int>;
using pil = pair<int, ll>;
using pli = pair<ll, int>;
using pll = pair<ll, ll>;
const ll MOD = 1e9+7;
//const ll MOD = 998244353;
const int inf = 1e9;
const ll INF = 1e18;
const ld EPS = 1e-10;

int main(){
    ll A, B, N;
    cin >> A >> B >> N;
    ll b = min(N, B-1);
    cout << (A*b)/B << endl;
}

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

using namespace std;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  cout << fixed << setprecision(15);

  int a, b;
  cin >> a >> b;

  int cnt = 0;
  for (int i = a; i <= b; ++i) {
    if ((i / 10000) == (i % 10) && (i / 1000 % 10) == (i / 10 % 10)) {
      ++cnt;
    }
  }

  cout << cnt << '\n';

  return 0;
}


Measured memory_bytes: 3656
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ITP1_5_A
{
    public class Program

    {
        public static void Main(string[] args)
        {
            int[] line;

            while (true)
            {
                line = ReadIntAr();
                if (line[0] == 0 && line[1] == 0) return;
                
                for(int i = 0; i < line[0]; i++)
                {
                    Console.WriteLine("{0}", new string('#', line[1]));
                }
                Console.WriteLine("");
            }


        }

        static string ReadSt() { return Console.ReadLine(); }
        static int ReadInt() { return int.Parse(Console.ReadLine()); }
        static long ReadLong() { return long.Parse(Console.ReadLine()); }
        static double ReadDouble() { return double.Parse(Console.ReadLine()); }
        static string[] ReadStAr(char sep = ' ') { return Console.ReadLine().Split(sep); }
        static int[] ReadIntAr(char sep = ' ') { return Array.ConvertAll(Console.ReadLine().Split(sep), e => int.Parse(e)); }
        static long[] ReadLongAr(char sep = ' ') { return Array.ConvertAll(Console.ReadLine().Split(sep), e => long.Parse(e)); }
        static double[] ReadDoubleAr(char sep = ' ') { return Array.ConvertAll(Console.ReadLine().Split(sep), e => double.Parse(e)); }

    }

}



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

using namespace std;
const int MAXN = 100010;

int n;
deque<int> b;

int main() {
	scanf( "%d", &n );
	for( int i = 1; i <= n; ++i ) {
		int a; scanf( "%d", &a );
		if( i & 1 ) b.push_back(a);
		else b.push_front(a);
	}
	if( n & 1 ) {
		while( !b.empty() ) {
			printf( "%d ", b.back() );
			b.pop_back();
		}
	} else {
		while( !b.empty() ) {
			printf( "%d ", b.front() );
			b.pop_front();
		}
	}
	return 0;
}


Measured memory_bytes: 2944
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
typedef long long ll;
using namespace __gnu_pbds;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pbds;
#pragma GCC target ("avx2")
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")
#define ios ios_base::sync_with_stdio(0) ; cin.tie(0) ; cout.tie(0)
#define so sizeof
#define pb push_back
#define vl vector<ll>
#define el endl;cout.flush();
#define be begin()
#define fi first
#define se second
#define br break
#define sz size()
#define en end()
#define ro return 0;
#define br break;
#define con continue;
#define um unordered_map<ll,ll>
#define ms(x) memset(x , 0, so x)
#define all(x) (x).be , (x).en
#define rall(x) (x).rbegin() , (x).rend()
#define acc(x) accumulate((x).be , (x).en , 0ll)
#define forn(i,a,b) for(ll i=a;i<=b;++i)
#define forr(i,a,b) for(ll i=a;i<b;++i)
#define rng_58 mt19937 rng(chrono::steady_clock::now().time_since_epoch().count())
#define vll vector<pair<ll,ll> >
#define pll pair<ll,ll>
#define plll pair<ll,pair<ll,ll>>
#define plvl pair<pair<ll,ll> ,ll>
#define mp make_pair
#define trace2(a,b) cerr <<"a is " << a << " b is " << b << el;
#define trace3(a,b,c) cerr <<"a is " << a << " b is " << b << " c is " << c << el;
#define trace4(a,b,c,d) cerr <<"a is " << a << " b is " << b << " c is " << c <<" d is " << d << el ;
#define trace5(a,b,c,d,e) cerr <<"a is " << a << " b is " << b << " c is " << c <<" d is " << d << " e is " << e << el;
#define trace6(a,b,c,d,e,f) cerr <<"a is " << a << " b is " << b << " c is " << c <<" d is " << d << " e is " << e << " f is " << f << el ;
bool op(pll &a , pll &b){
  return a.se < b.se ;
}
int main()
{
    ios;
    ll a , b , c , d , e ;
    cin  >> a >> b >> c >> d >> e ;
    vl v ;
    v.pb(a); v.pb(b); v.pb(c) ; v.pb(d) ; v.pb(e) ;
    sort(all(v));
    vll vv ;
    for(auto &x : v){
         if(x%10 == 0){
            vv.pb({x , 0 });
         }
         else {
            ll foo = x % 10 ;
            ll diff = 10 - foo ;
            vv.pb({x , diff}) ;
         }
    }
    sort(vv.be , vv.en , op) ;
    forn(i , 0 , vv.size()-2){
        pll x = vv[i] ;
        ll foo = x.fi ;
        ll fiz = x.se ;
        ll ziz = foo % 10 ;
        ll diff = 10 - ziz ;
        if(diff == 10 ) diff = 0 ;
        foo = foo + diff;
        vv[i].fi  = foo ;
    }
    ll sum = 0  ;
    for(auto &x : vv){
        cerr << x.fi << " " << x.se << el ;
    }
    forn(i , 0 , vv.size() -2){
        sum = sum + vv[i].fi ;
    }
    sum = sum + vv[vv.size()-1].fi ;
    cout << sum << el ;
    ro  ;


}























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

using namespace std;

int calc(int f, int y, int c, double r, int t)
{
	int m = f;
	int a=0;

	if(t==0){
		for(int i=0; i<y; i++){
			a = a + (int)(m * r);
			m = m - c;
		}
	}
	else{
		for(int i=0; i<y; i++){
			m = m + (int)(m * r) - c;
		}
	}

	return (m+a);
}

int main()
{
	int m, f, y, n, t, c, max, a;
	double r;

	cin >> m;
	for(int i=0; i<m; i++){
		cin >> f >> y >> n;
		max=0;
		for(int j=0; j<n; j++){
			cin >> t >> r >> c;
			a = calc(f,y,c,r,t);
			if(max<a){max=a;}
		}
		cout << max << endl;
	}

	return 0;
}

Measured memory_bytes: 1232
n = int(input())

xyz = {}
for x in range(1, 10**2):
    for y in range(1, 10**2):
        for z in range(1, 10**2):
            num = x**2 + y**2 + z**2 + x*y + y*z + z*x
            if num in xyz.keys():
                xyz[num] += 1
            else:
                xyz[num] = 1

for i in range(1, n + 1):
    if i in xyz.keys():
        print(xyz[i])
    else:
        print(0)

Measured memory_bytes: 72184
n = int(input())
a_1 = (int(x) for x in input().split())
a_2 = (int(x) for x in input().split())

tmp = 0
s_1 = []
for a in a_1:
    tmp += a
    s_1.append(tmp)

tmp = 0
s_2 = [0]
for a in a_2:
    tmp += a
    s_2.append(tmp)

res = 0
for i in range(n):
    res = max(res, s_1[i] + s_2[-1] - s_2[i])

print(res)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define P pair<int,int>
#define FOR(I,A,B) for(int I = int(A); I < int(B); ++I)
const int N=7;
int dic[N],w;
string s;
int e=0,n=0;
map<P,int> ans;
 
int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	FOR(i,1,7){
		cin>>dic[i];
	}
	s = "EEEESEEEESEEEESEEEESESEEEESEEEESEEEESEEEESESEEEESEEEESEEEESEEEESESEEEESEEEESEEEESEEEESESEEEESEEEESEEEESEEEES";
	FOR(i,0,s.size()){
		if(s[i]=='E'){
			w=dic[1];
			dic[1]=dic[4];
			dic[4]=dic[6];
			dic[6]=dic[3];
			dic[3]=w;
		}else if(s[i]=='W'){
			w=dic[1];
			dic[1]=dic[3];
			dic[3]=dic[6];
			dic[6]=dic[4];
			dic[4]=w;
		}else if(s[i]=='N'){
			w=dic[1];
			dic[1]=dic[2];
			dic[2]=dic[6];
			dic[6]=dic[5];
			dic[5]=w;
		}else{
			w=dic[1];
			dic[1]=dic[5];
			dic[5]=dic[6];
			dic[6]=dic[2];
			dic[2]=w;
		}
		ans[{dic[1],dic[2]}] = dic[3];
	}
	int q;
	cin >> q;
	FOR(i,0,q){
		int x,y;
		cin >> x >> y;
		cout << ans[{x,y}] << endl;
	}
	return 0;
}


Measured memory_bytes: 3192
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <iomanip>
using namespace std;

int main()
{
    int n, m;
    cin >> n >> m;
    vector<int> bridge(n);
    int tmp;
    for(int i = 0; i < 2 * m; i++){
        cin >> tmp;
        bridge[tmp-1]++;
    }

    for (int j = 0; j < n; j++)
    {
        cout << bridge[j] << endl;
    }
       
    return 0;

}

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

#define rep(i, n) for(int i = 0; i < (int)n; i++)
#define rep2(i, m, n) for(int i = (int)m; i < (int)n; i++)
typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<vi> vii; //2次元配列
typedef vector<ll> vll;
typedef vector<string> vs;


/*FUNCs=================================================*/


/*MAIN==================================================*/
int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);   //cin cout 高速化

    int a,b,c,d,e,f; cin >> a >> b>> c>>d>>e >> f;
    ll max_p1 = -1, max_p2 = 100000;
    int ans_w, ans_s;
    vi water;
    vi suger;
    for(int i = 1; 100 * a * i <= f; i++){
        for(int j = 0; 100 * b * j < f - 100 * a * i; j++){
            water.push_back(100 * a * i + 100 * b * j);
        }
    }
    for(int i = 0; c*i <= f; i++){
        for(int j = 0; c*i+d*j <= f; j++){
            suger.push_back(c*i+d*j);
        }
    }
    sort(water.begin(), water.end());
    sort(suger.begin(), suger.end());
    bool escape = true;

    for(int wat : water){
        if(escape == false) break;
        for(int sug : suger){
            if(wat + sug > f) break; //water and suger are sorted.

            if(e * (sug+wat) < sug * (100 + e)) break; //water and suger are sorted.
            else if(e * (sug+wat) == sug * (100 + e)){
                ans_w = wat;
                ans_s = sug;
                escape = false;
                break;
            }
            else{
                int p = sug, p2 = sug + wat;
                if(p * max_p2 >= max_p1 * p2){
                    max_p1 = p;
                    max_p2 = p2;
                    ans_w = wat;
                    ans_s = sug;
                }
            }
        }
    }
    cout << ans_s+ans_w <<" "<< ans_s << endl;
}


Measured memory_bytes: 1400
#include <iostream>
#include <bits/stdc++.h>
using namespace std;
string s;
int main()
{
    cin >> s;
    if(s=="SAT") printf("1");
    else if(s=="SAT") printf("1");
    else if(s=="SUN") printf("7");
    else if(s=="MON") printf("6");
    else if(s=="TUE") printf("5");
    else if(s=="WED") printf("4");
    else if(s=="THU") printf("3");
    else if(s=="FRI") printf("2");

    return 0;
}


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

#define forn(i,m,n) for(int i=m;i<n;i++)
#define vv vector
#define vi vv<int>
#define ii pair<int,int>
#define vii vv<ii>
#define mp make_pair
#define pb push_back
#define PI 3.141592653589
#define ll long long
#define pll pair<ll,ll>
#define vl vv<ll>
#define ff first
#define ss second
#define MOD 1000000007

bool is_prime[1000001];
vi prime;
void sieve(int n)
{
    memset(is_prime,true,sizeof(is_prime));
    for(int i=2;i*i<=n;i++)
    {
        if(is_prime[i])
        {
            for(int j=i*i;j<=n;j+=i)
            {
                is_prime[j]=false;
            }
        }
    }
    forn(i,2,n+1)
    {
        if(is_prime[i])
            prime.pb(i);
    }
}


ll ex(ll a,ll b)
{
    ll res=1;
    a=a%MOD;
    while(b)
    {
        if(b%2){res=(res*a)%MOD;b--;}
        b/=2;
        a=(a*a)%MOD;
    }
    return res;
}

ll fermat_inv(ll a){ return ex(a,MOD-2); }
ll max(ll a,ll b){ return a>b?a:b; }
ll min(ll a,ll b){ return a<b?a:b; }

vv<vi> a;
vi dp;

int dfs(int x)
{
    if(dp[x]!=-1)
        return dp[x];
    dp[x]=0;
    for(auto i:a[x])
    {
        dp[x]=max(dp[x],dfs(i)+1);
    }
    return dp[x];
}

int main()
{
    ios_base::sync_with_stdio(false);
        cin.tie(NULL);
        #ifndef ONLINE_JUDGE
            freopen("input.txt", "r", stdin);
            freopen("output.txt", "w", stdout);
        #endif
    //sieve(1000000);
    int te=1;
    //cin>>te;
    while(te--)
    {
        int n,m,x,y;
        cin>>n>>m;
        a=vv<vi>(n+1);
        dp=vi(n+1,-1);
        forn(i,0,m)
        {
            cin>>x>>y;
            a[x].pb(y);
        }
        int res=0;
        forn(i,1,n+1)
        {
            if(dp[i]==-1)
                res=max(res,dfs(i));            
        }
        cout<<res;
    }
}


Measured memory_bytes: 11000