akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <sstream>
#include <string>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <cassert>

using namespace std;

#define FOR(i,k,n) for(int i=(k); i<(int)(n); ++i)
#define REP(i,n) FOR(i,0,n)
#define FORIT(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)

template<class T> void debug(T begin, T end){ for(T i = begin; i != end; ++i) cerr<<*i<<" "; cerr<<endl; }
inline bool valid(int x, int y, int W, int H){ return (x >= 0 && y >= 0 && x < W && y < H); }

typedef long long ll;
const int INF = 100000000;
const double EPS = 1e-8;
const int MOD = 1000000007;
int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
struct Node{
  char value;
  Node* child[2];
  Node() { memset(child, 0, sizeof(child)); }
  Node(char c) : value(c) { memset(child, 0, sizeof(child)); }
};
struct Result{
  Node* n;
  int p;
  Result(){}
  Result(Node* n, int p) : n(n), p(p) {}
};
int G;
map<char, int> ope_d;
char type[100];
bool is_ope(char c){
  return ope_d.count(c);
}
Result expr(const string& s, int p, int depth){
  //printf("p = %d depth = %d s[p] = %c\n", p, depth, s[p]);
  if(depth == G){
    if(s[p] == '('){
      Result r = expr(s, p + 1, 0);
      assert(s[r.p] == ')');
      r.p++;
      return r;
    }else if(isalpha(s[p])){
      Node* n = new Node(s[p]);
      return Result(n, p + 1);
    }else{
      assert(false);
    }
  }else{
    if(type[depth] == 'L'){
      Result r = expr(s, p, depth + 1);
      while(is_ope(s[r.p]) && ope_d[s[r.p]] == depth){
        Node* n = new Node(s[r.p]);
        Result r_ = expr(s, r.p + 1, depth + 1);
        n->child[0] = r.n;
        n->child[1] = r_.n;
        r.n = n;
        r.p = r_.p;
      }
      return r;
    }else if(type[depth] == 'R'){
      Result r = expr(s, p, depth + 1);
      if(is_ope(s[r.p]) && ope_d[s[r.p]] == depth){
        Result r_ = expr(s, r.p + 1, depth);
        Node* n = new Node(s[r.p]);
        n->child[0] = r.n;
        n->child[1] = r_.n;
        r.n = n;
        r.p = r_.p;
      }
      return r;
    }else{
      assert(false);
    }
  }
}
void print(Node* p){
  assert(p);
  if(isalpha(p->value)){
    assert(!p->child[0]);

    putchar(p->value);
  }else{
    assert(p->child[0]);

    putchar('(');
    print(p->child[0]);
    putchar(p->value);
    print(p->child[1]);
    putchar(')');
  }
}
int main(){
  int D;
  cin >> D;
  bool first = true;
  while(D--){
    if(first) first = false;
    else cout << endl;

    cin >> G;
    REP(i, G){
      cin >> type[i];
      int T; cin >> T;
      while(T--){
        char ope; cin >> ope;
        ope_d[ope] = i;
      }
    }
    int N; cin >> N;
    REP(i, N){
      string s;
      cin >> s;
      Result r = expr(s, 0, 0);
      print(r.n);
      cout << endl;
    }
  }
  return 0;
}

Measured memory_bytes: 6744
N = int(input())

count = 0
flag = False
for i in range(N):
    D = list(map(int, input().split()))
    if (flag):
        if (D[0] == D[1]):
            count += 1
        else:
            flag = False
            count = 0
    else:
        if (D[0] == D[1]):
            flag = True
            count = 1
    if (count == 3):
        print("Yes")
        exit()

print("No")

Measured memory_bytes: 9200
//2013 6/29
import java.lang.*;
import java.util.*;

public class Main
{
    static Scanner sc = new Scanner(System.in);
    
    public static void main(String args[])
    {	
	while(true){
	    int N = sc.nextInt();
	    if(N==0) break;
	    
	    int[] v = new int[N];
	    int[] w = new int[N];
	    for(int i=0; i<N; i++){
		v[i] = sc.nextInt();
		w[i] = sc.nextInt();
	    }

	    int[] tmp = new int[2];
	     for(int i=0; i<N-1; i++){
		 for(int j=i+1; j<N; j++){
		     if(w[i] == w[j] && v[i] >v[j]){
			 tmp[0] = w[i];
			 tmp[1] = v[i];
			 w[i] = w[j];
			 v[i] = v[j];
			 w[j] = tmp[0];
			 v[j] = tmp[1];
		     }
		     if(w[i] > w[j]){
			 tmp[0] = w[i];
			 tmp[1] = v[i];
			 w[i] = w[j];
			 v[i] = v[j];
			 w[j] = tmp[0];
			 v[j] = tmp[1];
		     }
		     
		 }	 
	    }
	     
	     
	     int t = 0;
	     boolean f = true;
	     for(int i=0;i<N;i++){
		 t+=v[i];
		 if(t > w[i]){
		     System.out.println("No");
		     f = false;
		     break;
		 }
	     }
	     
	     if(f) System.out.println("Yes");
	}
    }
}
	    
	    

Measured memory_bytes: 24536
using System;

namespace oasobi
{
    static class MainClass
    {
        static int Find(int n)
        {
            int sum = 0;
            while(n > 0)
            {
                sum = sum + (n % 10);
                n = n / 10;
            }
            return sum;
        }


        public static void Main()
        {
            

            string[] input = Console.ReadLine().Split(' ');
            int N = int.Parse(input[0]);
            int A = int.Parse(input[1]);
            int B = int.Parse(input[2]);

            int total = 0;

            for(int i = 1; i <= N; ++i)
            {
                int sum = Find(i);
                if(sum >= A && sum <= B)
                {
                    total = total + i;
                }
            }

            Console.WriteLine(total);

        }
    }
}

Measured memory_bytes: 13140
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int x[10],i;
    for(i=1; i<=5; i++)
    {
        cin>>x[i];
    }
    for(i=1; i<=5; i++)
    {
        if(x[i]==0)
        {
            cout<<i<<endl;
        }
    }
}


Measured memory_bytes: 3564
#include <iostream>
#include <string>
#include <cstring>
#include <cmath>
#include <cstdio>
#include <algorithm>
using namespace std;
#define int long long
signed main(){
    int n,k;
    cin>>n>>k;
    int c=1;
    for(int i=0;i<n;i++){
        char a;
        cin>>a;
        if(c==k)cout<<char(a+('a'-'A'));
        else cout<<a;
        c++;
    }
    cout<<endl;
    return 0;
}









Measured memory_bytes: 256
N = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
D = [[False] * 51 for i in range(51)]
use = []


def calc(a, b, D):
    if a == b:
        return True
    d = {}
    stack = [a]
    while stack:
        u = stack.pop()
        if u == b:
            return True
        d[u] = 1
        for w in range(1, 51):
            if (u % w) in d:
                continue
            if D[u][u % w]:
                stack.append(u % w)

    return False


def check(n):
    D = [[False] * 51 for i in range(51)]
    for i in range(51):
        for k in range(1, n):
            D[i][i % k] = True
        D[i][i] = True

    for i in range(51):
        for j in use:
            D[i][i % j] = True

    for a, b in zip(A, B):
        if not calc(a, b, D):
            return True
    return False


if check(51):
    print(-1)
    exit()

ans = 0
for j in range(50, 0, -1):
    if check(j):
        use.append(j)
        ans += 2 ** j

print(ans)


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

int n, c, k, *a, ans;

int main() {
  scanf("%d%d%d", &n, &c, &k);
  a = new int[n];
  for (int i = 0; i < n; ++i) {
    scanf("%d", a + i);
  }
  std::sort(a, a + n);
  for (int i = 0; i < n; ) {
    for (int j = i; j <= n; ++j) {
      if(j == n || j >= i + c || a[j] > a[i] + k) {
        i = j;
        break;
      }
    }
    ++ans;
  }
  printf("%d\n", ans);
  return 0;
}

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

#define rep2(x,fr,to) for(int (x)=(fr);(x)<(to);(x)++)
#define rep(x,to) for(int (x)=0;(x)<(to);(x)++)
#define repr(x,fr,to) for(int (x)=(fr);(x)>=(to);(x)--)
#define all(c) (c).begin(),(c).end()
#define sz(v) (int)(v).size()

using namespace std;
typedef long long ll; typedef vector<int> VI; typedef pair<int,int> pii;
const int mod = (int)1e9 + 7;
void dbg(){ cerr << "\n"; }  
template <typename T,typename ...T2>
void dbg(const T& fst, const T2&...rst){ cerr << fst << ": "; dbg(rst...); }


int main(){
	string s,t;
	cin >>s >>t;
	VI sk1(26, -1), sk2(26, -1);
	bool fck =true;
	rep(i, sz(s)){
		if(sk1[s[i]-'a'] !=-1 && sk1[s[i]-'a'] != t[i]-'a') fck=false;
		sk1[s[i]-'a'] = t[i]-'a';
		if(sk2[t[i]-'a'] !=-1 && sk2[t[i]-'a'] != s[i]-'a') fck=false;
		sk2[t[i]-'a'] = s[i]-'a';
	}
	
	cout << (fck? "Yes":"No") <<"\n";
}


Measured memory_bytes: 776
#include <bits/stdc++.h>
using namespace std;
int main(){
  int n;
  cin>>n;
  for(int i=1;i<=n;i++){
    if(i%3==0){
      cout<<" "<<i;
      continue;
    }
    int g=i;
    while(g>0){
      if(g%10==3){
        cout<<" "<<i;
        break;
      }
      g/=10;
    }
  }
  cout<<endl;
}


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

#define M 40000

int main() {
  int n, a[M], b[M], ans, w, p, q;
  while(cin >> n && n) {
    for(int i=0; i<n; ++i) cin >> a[i]; sort(a, a+n, greater<int>());
    for(int i=0; i<n; ++i) cin >> b[i]; sort(b, b+n, greater<int>());
    ans = -1; w=0; p=0; q=0;
    while(p<n) {
      if(a[p]>b[q]) {
        ++p; ++w;
      }else {
        ++p; ++q; --w;
      }
      //cout << ">" << p << " : " << q << " " << w << endl;
      if(w>0) {
        ans = p; break;
      }
    }
    if(ans==-1 || ans==n) cout << "NA" << endl;
    else cout << ans << endl;
  }
  return 0;
}

Measured memory_bytes: 1492
#include<bits/stdc++.h>
using namespace std;
int main() {
//string s,t;
int a,b,c,i,n,t;
long double g,h,o;
vector<int> v;
cin>>n;
cin>>t>>a;
h=10000000.0;
for(i=0;i<n;i++){cin>>c; g = t - (c*0.006); g=abs(a-g); if(g<h){h=g; b=i;}}
cout<<b+1<<endl;

}

Measured memory_bytes: 256
#include <math.h>
#include <time.h>
#include <ctype.h>
#include <stdio.h>
#include <assert.h>
#include <stdlib.h>
#include <string.h>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <bitset>
#include <string>
#include <vector>
#include <iostream>
#include <algorithm>
#include<iomanip>

#define MX 10000000000
#define mod 1000000007
#define ll long long int
#define pb(x) push_back(x)
#define MP(x,y) make_pair(x,y)

using namespace std;

ll power(ll a, ll b, ll m)
{
	if (b == 0)
		return(1);
	ll sol = power(a, b / 2, m);
	sol = (sol * sol) % m;
	if (b % 2 == 1)
		sol = (sol * a) % m;
	return(sol);
}

ll gcd(ll a, ll b)
{
	if (b == 0)
		return a;
	else
	{
		return gcd(b, a % b);
	}
}
void solve()
{
	int n;
	cin >> n;
	string s;
	cin >> s;
	int l = s.length();
	if (l & 1)
	{
		cout << "No";
		return;
	}
	for (int i = 0; i < l / 2; i++)
	{
		if (s[i] != s[i + l / 2])
		{
			cout << "No";
			return;
		}
	}
	cout << "Yes";
}
int main()
{
	int t = 1;
	//cin >> t;
	while (t--)
	{
		solve();
	}
	return 0;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
using ll     = long long;
using pii    = pair<int, int>;
using pll    = pair<ll, ll>;
using vi     = vector<int>;
using vl     = vector<ll>;
using vvi    = vector<vi>;
using vvl    = vector<vl>;
const ll INF = 1LL << 60;
const ll MOD = 1000000007;
template <class T>
bool chmax(T &a, const T &b) {
    return (a < b) ? (a = b, 1) : 0;
}
template <class T>
bool chmin(T &a, const T &b) {
    return (b < a) ? (a = b, 1) : 0;
}
template <class C>
void print(const C &c, std::ostream &os = std::cout) {
    std::copy(std::begin(c), std::end(c), std::ostream_iterator<typename C::value_type>(os, " "));
    os << std::endl;
}

// greatest common divisor and least common multiple
// gcd is calculated by Euclidean Algorithm
// lcm = m * n / gcd(m,n)
template <typename T = int>
T gcd(T a, T b) {
    if (a < b)
        return gcd(b, a);
    T r;
    while ((r = a % b)) {
        a = b;
        b = r;
    }
    return b;
}

int main() {
    ll n, k;
    cin >> n >> k;
    vl a(n);
    ll maxi = 0;
    for (int i = 0; i < n; ++i) {
        cin >> a[i];
        chmax(maxi, a[i]);
    }
    if (maxi < k) {
        cout << "IMPOSSIBLE"
             << "\n";
        return 0;
    }
    if (n == 1) {
        if (k == a[0])
            cout << "POSSIBLE"
                 << "\n";
        else
            cout << "IMPOSSIBLE"
                 << "\n";
        return 0;
    }
    ll gcds = gcd(a[0], a[1]);
    for (int i = 2; i < n; ++i) {
        gcds = gcd(gcds, a[i]);
    }
    for (int i = 0; i < n; ++i) {
        if (abs(a[0] - k) % gcds == 0) {
            cout << "POSSIBLE"
                 << "\n";
            return 0;
        }
    }

    cout << "IMPOSSIBLE"
         << "\n";
    return 0;
}

Measured memory_bytes: 1024
N = int(input())
names = {}

ms = 'MARCH'

for i in list(ms) :
    names[i] = 0
    
for i in range(N) :
    s = input()
    if s[0] in list(ms) :
        names[s[0]] += 1
        
perms = []
def perm(s, idx, n) :
    if n == 3 :
        perms.append(s)
    else :
        if idx < len(ms) :
            perm(s + ms[idx], idx + 1, n + 1)
            perm(s, idx + 1, n)        
perm("", 0, 0)

sum_over = 0
for p in perms :
    sum_over += names[p[0]] * names[p[1]] * names[p[2]]
    
print(sum_over)

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

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

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

    vector<vector<int>> dp(n + 1, vector<int>(3, 0));
    for (int i = 1; i <= n; i++) {
        dp[i][0] = max(dp[i - 1][1] + a[i][0], dp[i - 1][2] + a[i][0]);
        dp[i][1] = max(dp[i - 1][0] + a[i][1], dp[i - 1][2] + a[i][1]);
        dp[i][2] = max(dp[i - 1][0] + a[i][2], dp[i - 1][1] + a[i][2]);
    }
    cout << max({dp[n][0], dp[n][1], dp[n][2]}) << endl;
}

Measured memory_bytes: 11136
#include "iostream"
#include "algorithm"
#include "string"
#include "vector"
#include "cmath"
#include "bitset"
#include "queue"
#include "functional"

#define lp(n) for (int i = 0; i < n; i++)
#define LP(n,i) for (int i = 0; i < n; i++)
#define mod 1000000007
#define sp ' '
#define intmax 2147483647
#define intmin -2147483647
#define llmax 9223372036854775807
#define nyan "(=^･ω･^=)"
typedef long long ll;
using namespace std;

int n, m, a, b, c, mem, cnt;
vector<pair<int, int>>gp[100];
pair<int, bool>djk[100];
pair<int, int>mem2;

/*
ll gcd(ll x, ll y) {
	if (y == 0) return x;
	return gcd(y, x%y);
}
ll lcm(ll x, ll y) {
	ll g = gcd(x, y);
	return x / g * y;
}*/



int main(){
	cin >> n >> m;
	lp(m) {
		cin >> a >> b >> c;
		gp[a - 1].push_back(make_pair(b - 1, c));
		gp[b - 1].push_back(make_pair(a - 1, c));
	}
	cnt = 0;
	lp(n) {
		mem = i;
		LP(n, j)
			djk[j] = make_pair(intmax, false);
		djk[i] = make_pair(0, true);
		LP(n, j) {
			LP(gp[mem].size(), k) {
				djk[gp[mem][k].first].first = min(djk[gp[mem][k].first].first, djk[mem].first + gp[mem][k].second);
			}
			mem2.first = intmax;
			LP(n, k) {
				if (!djk[k].second&&djk[k].first < mem2.first)
					mem2 = make_pair(djk[k].first, k);
			}
			djk[mem2.second].second = true;
			mem = mem2.second;
		}
		LP(gp[i].size(), j) {
			if (djk[gp[i][j].first].first != gp[i][j].second)
				cnt++;
		}
	}
	cout << cnt / 2 << endl;
	return 0;
}

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

int main()
{
    int cnt=0;
    string str;
    while(getline(cin,str)){
        for(int i=0; i<str.length(); i++){
            if(str[i] != str[str.length()-i-1]){
                break;
            }
            if(i==str.length()-1){
                cnt++;
            }
        }
    }
    cout<<cnt<<endl;
    return 0;
}

Measured memory_bytes: 1176
#include <iostream>
#include <cstdio>
#include <cmath>

using namespace std;

int a, b;
char op;

int main()
{
    while (true){
        cin >> a >> op >> b;
        if (op=='?'){
            break;
        } else if (op=='+'){
            cout << a+b << endl;
        } else if (op=='-'){
            cout << a-b << endl;
        } else if (op=='*'){
            cout << a*b << endl;
        } else if (op=='/'){
            cout << a/b << endl;
        }
    }
}



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

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int n, K;
  cin >> n >> K;
  vector<int> edge[n+1], dep(n+1);
  function<void(int, int)> dfs = [&](int u, int fa) {
    for ( auto v : edge[u]) {
      if( v ^ fa) {
        dep[v] = dep[u] + 1; dfs(v, u);
      }
    }
  };
  for ( int i = 2, x, y; i <= n; ++ i) {
    cin >> x >> y;
    edge[x].push_back(y); edge[y].push_back(x);
  }
  int ans = 1e9;
  if( K & 1) {
    for ( int i = 1; i <= n; ++ i) {
      for ( auto v : edge[i]) {
        if( v < i) {
          continue;
        }
        int ret = 0;
        dep[i] = dep[v] = 0;
        dfs(i, v); 
        dfs(v, i);
        for ( int k = 1; k <= n; ++ k) {
          if( dep[k] > K >> 1) {
            ++ ret;
          }
        }
        ans = min(ans, ret);
      }
    }
  } else {
    for ( int i = 1; i <= n; ++ i) {
      dfs(i, dep[i] = 0);
      int ret = 0;
      for ( int k = 1; k <= n; ++ k) {
        if( dep[k] > K >> 1) {
          ++ ret;
        }
      }
      ans = min(ans, ret);
    }
  }
  cout << ans << "\n";
  return 0;
}

Measured memory_bytes: 512
#define _CRT_SECURE_NO_WARNINGS
#include<bits/stdc++.h>
using namespace std;
#ifndef FAST_IO
 #define IOS ios_base::sync_with_stdio(false);cin.tie(nullptr);
#endif

#define int long long
#define FILE_IO freopen("input.txt","r",stdin)/#define int long long
#define f first
#define s second
#define endl '\n'
#define all(c) c.begin(),c.end()
#define bp __builtin_popcount
#define debug(x) cerr << #x << " = " << x << endl;

const int MOD = 1e9 + 7;
const int INF = 1000000000;

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
template <typename T>void print(T t){for(auto &it : t)cout<<it<<" ";}
inline int powerexp(int a, int b, int m = MOD){ int res = 1;while(b){if(b&1)res = res * a % m;a = a * a % m,b >>= 1;}return res % m;}
inline int modinv(int a){ return powerexp(a,MOD-2,MOD);}
inline int lcm(int a, int b){ int g = __gcd(a,b);return a/g*b;}
inline int add(int x, int y){ x += y; if (x >= MOD) x -=  MOD; return x;}
inline int mul(int x, int y){ return (x * 1ll * y) % MOD;}
inline int sub(int x, int y){ x -= y; if (x<0) x += MOD; return x ;}

//-------------------< start here >-------------------------// 

void solve(){
   string s, t;
   cin >> s >> t;
   
   vector<int> a(26), b(26);
   for (auto it : s) a[it - 'a']++;
   for (auto it : t) b[it - 'a']++;	
   
   sort(all(a));
   sort(all(b));
   bool ok = true;
   for (int i = 0; i < 26; i++){
	   if (a[i] != b[i]){
		   ok = false;
		   break;  
		 }
	 }
   if (ok) cout << "Yes" << endl;
   else cout << "No" << endl;
}

//-----------------------------
//comment from here for TOPCODER 
int32_t main(){
   IOS;
   solve();
   //find();
   #ifdef LOCAL_DEFINE
   cerr << "time elapsed " << (double)clock()/CLOCKS_PER_SEC << endl;
   #endif
}


Measured memory_bytes: 916
#include<iostream>
using namespace std;
int main(){
  int n;
  int i,j,k;
  int build[4][3][10]={{{}}};
  cin >> n;
  int b,f,r,v;
  for(i=0;i<n;i++){
    cin >> b >> f >> r >> v;
    build[b-1][f-1][r-1]+=v;
  }
  for(i=0;i<4;i++){
    for(j=0;j<3;j++){
      for(k=0;k<10;k++){
	cout << " ";
	cout << build[i][j][k];
      }
      cout << endl;
    }
    if(i<3)cout << "####################" << endl;
  }
  return 0;
}



Measured memory_bytes: 3088
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repr(i, a, b) for(int i = a; i < b; i++)
#define  all(x) (x).begin(),(x).end()     // 昇順ソート
#define  rall(v) (v).rbegin(), (v).rend() // 降順ソート
#define  FastIO ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0)
typedef long long ll;
typedef long long int lli;
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return true; } return false; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return true; } return false; }

int main(){
    int k, x;
    cin >> k >> x;
    if (500 * k < x) cout << "No" << endl;
    else cout << "Yes" << endl;
}

Measured memory_bytes: 256
#include <algorithm>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>

#define SREP(s,i,m) for(unsigned int i = s; i < m; ++i)
#define REP(i,m) SREP(0,i,m)

using namespace std;
#ifdef _MSC_VER
using LONG = __int64;
using ULONG = unsigned __int64;
#else
using LONG = long long int;
using ULONG = unsigned long long int;
#endif

class Triplet {
public:
	int a, b, c;
	bool operator<(const Triplet &left) const {
		if (a != left.a) return a < left.a;
		else if (b != left.b) return b < left.b;
		else return c < left.c;
	}
};

int main(void) {
	int A, B, C;
	cin >> A >> B >> C;
	set<Triplet> generated;
	generated.insert({ A, B, C });
	int cnt = 0;
	for (;;) {
		if (A % 2 == 1 || B % 2 == 1 || C % 2 == 1) {
			break;
		}
		int a, b, c;
		a = A; b = B; c = C;
		A = (b + c) / 2; B = (a + c) / 2; C = (a + b) / 2;
		cnt++;
		Triplet tri = { A, B, C };
		if (generated.find(tri) != generated.end()) {
			cout << -1 << endl;
			return 0;
		}
		generated.insert(tri);
	}
	cout << cnt << endl;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define RFOR(i,a,b) for(int i=(b) - 1;i>=(a);i--)
#define REP(i,n) for(int i=0;i<(n);i++)
#define RREP(i,n) for(int i=n-1;i>=0;i--)

#define PB push_back
#define INF (1<<29)
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(),(a).rend()
#define CLR(a) memset(a,0,sizeof(a))
const int dx[] = {-1,0,0,1},dy[] = {0,1,-1,0};

typedef long long int ll;

using namespace std;

int main(){
    while(true){
	int r,c;
	int d[11][10001];
	int cs[10001];
	cin >> r >> c;
	if(r==0 && c == 0) break;
	REP(i,r)REP(j,c){
	    cin >> d[i][j];
	}
	int ans = 0;
	REP(i,(1<<r)){
	    int td[11][10001];
	    memset(cs,0,sizeof(cs));
	    REP(k,r)REP(j,c){
		td[k][j] = d[k][j];
	    }
	    REP(j,r){
		if( ((1<<j) & i) != 0){
		    REP(k,c){
			if(td[j][k] == 0) td[j][k] = 1;
			else td[j][k] = 0;
		    }
		}
	    }
	    REP(k,c)REP(j,r){
		cs[k] += td[j][k];
	    }
	    int temp = 0;
	    REP(k,r)REP(j,c){
		temp += td[k][j];
	    }
	    REP(j,c){
		temp = max(temp, temp - cs[j] + (r-cs[j]) );
	    }
	    ans = max(ans,temp);
	}
	cout << ans << endl;
    }
    return 0;
}

Measured memory_bytes: 1992
#include<iostream>
#include<string>
#include<cmath>
#include<cstdlib>
#include<vector>
#include<map>
#include<set>
#include<algorithm>
#include<queue>

using namespace std;

int n,m;
pair<int,int> edge[200005];
int start[100005];
int finish[100005];
int cnt;
int visit[100005];
int cnt2;
int visit2[100005];

int main(){
  cin>>n>>m;
  for(int i=0;i<m;i++){
    int a,b;
    cin>>a>>b;
    a--;b--;
    edge[i*2] = make_pair(a,b);
    edge[i*2+1] = make_pair(b,a);
  }
  sort(edge,edge+(m*2));

  int s = edge[0].first;
  start[0] = 0;
  for(int i=1;i<(m*2);i++){
    if(s != edge[i].first){
      start[edge[i].first] = i;
      s = edge[i].first;
    }
  }

  //for(int i=0;i<(2*m);i++)cout<<edge[i].first<<" "<<edge[i].second<<endl;
  //for(int i=0;i<n;i++)cout<<start[i]<<" ";cout<<endl;


  int now = 0;
  while(1){
    finish[now] = 1;
    visit[cnt++] = now;
    bool cango = false;
    for(int i=start[now];;i++){
      if(edge[i].first != now) break;
      if(finish[edge[i].second]==0){
        now = edge[i].second;
        cango = true;
        break;
      }
    }
    if(!cango){
      break;
    }
  }

  now = 0;
  while(1){
    finish[now] = 1;
    visit2[cnt2++] = now;
    bool cango = false;
    for(int i=start[now];;i++){
      if(edge[i].first != now) break;
      if(finish[edge[i].second]==0){
        now = edge[i].second;
        cango = true;
        break;
      }
    }
    if(!cango){
      break;
    }
  }

  cout<<(cnt+cnt2-1)<<endl;
  for(int i=cnt2-1;i>=0;i--){
    cout<<(visit2[i]+1)<<" ";
  }
  for(int i=1;i<cnt;i++){
    cout<<(visit[i]+1)<<" ";
  }cout<<endl;

  return 0;
}

Measured memory_bytes: 3584
#include <bits/stdc++.h>
using namespace std;
#define ll long long 
#define endl "\n"
#define pb push_back
#define f(i,n) for(i=0;i<n;i++)
#define F(i,a,b) for(i=a;a<=b;i++)
#define arr(a,n) for( i=0;i<n;i++)cin>>a[i];
#define fi first
#define se second
#define mp make_pair
#define mod 1000000007
#define YES cout<<"YES"<<endl;
#define Yes cout<<"Yes"<<endl;
#define NO cout<<"NO"<<endl;
#define No cout<<"No"<<endl;
#define yes cout<<"yes"<<endl;
#define no cout<<"no"<<endl;
#define vi vector<ll>
#define ed end()
#define bg begin()
#define sz size()
#define ln length()
#define s() sort(a,a+n);
#define sr() sort(a,a+n,greater<ll>());
#define v()  sort(v.begin(),v.end());
#define vr() sort(v.begin(),v.end(),greater<ll>());
#define mod 1000000007
#define fast() ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
ll gcd(ll a, ll b){if(!b)return a;return gcd(b, a % b);}
ll power(ll x,ll y,ll p){ll res=1;x%=p;while(y>0){if(y&1)res=(res*x)%p;y=y>>1;x=(x*x)%p;}return res;}
int main() {
/*		#ifndef ONLINE_JUDGE
	    // for getting input from input.txt
	    freopen("input.txt", "r", stdin);
	    // for writing output to output.txt
	    freopen("output.txt", "w", stdout);
	#endif*/
fast();
//ll  t;cin>>t;while(t--)
{
	string s,t;
	cin>>s>>t;
	string x=t+s;
	cout << x << endl;
	
	

}
return 0;
}

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

int main()
{
  char str[1000];
  int i;
  cin >> str;
  while (str[i] != '\0'){
    if ('A' <= str[i] && str[i] <= 'C'){
      str[i] += 23;
    }
    else {
      str[i] -= 3;
    }
    i++;
  }
  cout << str << endl;
}  

Measured memory_bytes: 1144
#include<bits/stdc++.h>
using namespace std;
int main(){
  int t;
  pair<int,char>card[9];
  cin>>t;
  for(int i=0;i<t;++i){
    int data[10][3]={},flag=0;
    for(int j=0;j<9;++j) cin>>card[j].first;
    for(int j=0;j<9;++j) cin>>card[j].second;
    for(int j=0;j<9;++j){
      if(card[j].second=='R') data[card[j].first][0]++;
      else if(card[j].second=='G') data[card[j].first][1]++;
      else data[card[j].first][2]++;
    }
    for(int j=1;j<10;++j)
      for(int k=0;k<3;++k)
	if(data[j][k]>=3){
	  flag++; data[j][k]-=3;
	}
    for(int j=2;j<9;++j)
      for(int k=0;k<3;++k)
	if(data[j][k]>=1&&data[j-1][k]>=1&&data[j+1][k]>=1){
	  flag++;
	  data[j][k]--; data[j-1][k]--; data[j+1][k]--;
	  --k;
	}
    cout<<(flag==3?"1":"0")<<endl;
      
  }
  
  return 0;
}



Measured memory_bytes: 3080
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<algorithm>
#include<vector>
using namespace std;
typedef long long LL;
int main(){
  int a,b,c;
  cin>>a>>b>>c;
  if((b/a)<c)
    cout<<b/a<<endl;
  else
    cout<<c<<endl;
}


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

using namespace std;

map<char, char> mp1, mp2;

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

    string s,t;
    cin >> s >> t;

    bool flag = true;

    for (int i=0; i<s.length(); i++) {
        if (mp1.find(s[i]) == mp1.end())
            mp1[s[i]] = t[i];
        else {
            if (mp1[s[i]] != t[i]) {
                //cout << s[i] << ' ' << mp1[s[i]] << ' ' << t[i] << ' ';
                cout << "No\n";
                return 0;
            }
        }
    }

    for (int i=0; i<s.length(); i++) {
        if (mp2.find(t[i]) == mp2.end())
            mp2[t[i]] = s[i];
        else {
            if (mp2[t[i]] != s[i]) {
                cout << "No\n";
                return 0;
            }
        }
    }

    cout << "Yes\n";

    return 0;
}


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

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

#define pb push_back
#define eb emplace_back
#define mp make_pair
#define fi first
#define se second
#define rep(i,n) rep2(i,0,n)
#define rep2(i,m,n) for(int i=m;i<(n);i++)
#define ALL(c) (c).begin(),(c).end()
#define dump(x) cout << #x << " = " << (x) << endl

const int dx[4] = {0,0,1,-1};
const int dy[4] = {1,-1,0,0};

int a[510][510];

int main() {
	int K; cin >> K;
	if (K == 1) {
		puts("1");
		puts("1");
		return 0;
	}
	
	int n = ((K + 3) / 4) * 2;
	int c = n * 4;

	rep(i, n) {
		rep(j, n) {
			if (i % 2 == 0) {
				a[i][j] = (i + j) % n;
			} else {
				a[i][j] = n + (i + j) % n;
			}
		}
	}

	while (c > K) {
		rep(i, n) {
			rep(j, n) {
				if (a[i][j] == c-1) {
					a[i][j] -= n;
				}
			}
		}
		--c;
	}

	printf("%d\n", n);
	rep(i, n) {
		rep(j, n) {
			printf("%d%c", a[i][j] + 1, j == n-1 ? '\n' : ' ');
		}
	}

	return 0;
}

Measured memory_bytes: 2304
#include<algorithm>
#include<iostream>
#include<iomanip>
#include<numeric>
#include<vector>
#include<cmath>
#include<set>
using namespace std;
int main() {
	int n,l,pai=0,mii=1000000000;
	cin >> n >> l;
	vector<int> r(n);
	for(int i = 0; i < n; ++i) {
		r[i] = l + i;
		pai += r[i];
		mii=min(mii,abs(r[i]));
	}
	int mi = 1000000000;
	for(int i = 0; i < n; ++i) {
		int a = r[i];
		if(pai-(pai-abs(a)) <=abs(mi) )
			mi = r[i];
	}
	cout << pai - mi << endl;
}

Measured memory_bytes: 3632
import java.util.Stack;
import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
		
		Scanner in = new Scanner(System.in);
		Stack<String> expr = new Stack<>();
		while (in.hasNext()) {
			String next = in.next();
			if (next.equals("+")) {
				int a = Integer.parseInt(expr.pop());
				int b = Integer.parseInt(expr.pop());
				int result = a + b;
				expr.push((result + ""));
			} else if(next.equals("-")) {
				int a = Integer.parseInt(expr.pop());
				int b = Integer.parseInt(expr.pop());
				int result = b - a;
				expr.push((result + ""));
			} else if (next.equals("*")) {
				int a = Integer.parseInt(expr.pop());
				int b = Integer.parseInt(expr.pop());
				int result = a * b;
				expr.push((result + ""));
			} else {
				expr.push(next);
			}
			
		}
		System.out.println(expr.peek());
	}
}



Measured memory_bytes: 26320
#include <iostream>
#include <cmath>

using namespace std;

int main(void)
{
    long long X;
    int elapsed_year;
    long long deposit = 100;
    cin >> X;
    
    elapsed_year = 0;
    while( deposit < X)
    {
      deposit += deposit/100;
      elapsed_year++;
    }
  
    cout << elapsed_year << endl;
    return 0;
}


Measured memory_bytes: 3604
k,t = map(int, input().split())
a=sorted(list(map(int, input().split())))
count=0

while(len(a)>0):
    a[-1]-=1
    if len(a)>1:
        a[-2]-=1
    else:
        count=a[0]
        break
    a=sorted([i for i in a if i>0])
print(count)    
    

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

#ifndef DEBUG
#define endl '\n'
#define debugf(...)
#define debug(...)
#else
#define debugf(...) printf(__VA_ARGS__)
#define debug(...) __VA_ARGS__
#endif

const int N = 128;

int a[N];

int solve(int x, int n) {
    int ans = 0;
    for (int i = 0; i < n; i++) {
        int k = a[i] - x;
        ans += k * k;
    }
    return ans;
}

int (((((main)))))() <%
    ios_base::sync_with_stdio(false);
    cin.tie(0); cout.tie(0);
    
    int n;
    cin >> n;

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

    int ans = 0x3f3f3f3f;
    for (int x = 0; x <= 100; x++) {
        ans = min(ans, solve(x, n));
    }

    cout << ans << endl;
    
    return 0;
%>

Measured memory_bytes: 256
N= list(map(int,input().split())) #１行目の入力

root_list = []
cost = 1001
for i in range(N[0]):
    root_list.append(list(map(int,input().split())))

    if root_list[i][1] <= N[1]:
        if root_list[i][0] < cost:
            cost = root_list[i][0]


if cost == 1001:
    print("TLE")
else:
    print(cost)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
int64_t dp[101][100001];
int main()
  {int N, W; cin >> N >> W;
  for (int i = 0; i < N; ++i)
    {int w, v; cin >> w >> v;
    for (int j = 0; j <= W; ++j) dp[i + 1][j] = max(dp[i][j], j >= w ? dp[i][j - w] + v : 0);}
  cout << dp[N][W] << endl;}

Measured memory_bytes: 81588
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.Scanner;

class Main{
    private static final InputStreamReader ir = new InputStreamReader(System.in);
    private static final PrintWriter out = new PrintWriter(System.out);
    public static void main(String[] Args) throws IOException{
        int in;
        while( (in = ir.read())!=-1){
            if(Character.isLowerCase(in)) out.write(Character.toUpperCase(in));
            else if(Character.isUpperCase(in)) out.write(Character.toLowerCase(in));
            else out.write(in);
        }
        out.flush();
    }
}

Measured memory_bytes: 24352
#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;
template <class T> using treap = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
#define int long long
#define REP(i, n) for (long long i = 0, max_i = (n); i < max_i; i++)
#define REPI(i, a, b) for (long long i = (a), max_i = (b); i < max_i; i++)
#define ALL(obj) begin(obj), end(obj)
#define RALL(obj) rbegin(obj), rend(obj)
#define fi first
#define se second
using ii = pair<int, int>;
vector<ii> dirs = {
  {1, 0}, {0, 1}, {-1, 0}, {0, -1},  // 4方向
  {1, 1}, {-1, 1}, {-1, -1}, {1, -1},  // 斜め
  {0, 0},  // 自身
};
template <class T> inline bool chmax(T& a, const T& b) { if (a < b) { a = b; return true; } return false; }
template <class T> inline bool chmin(T& a, const T& b) { if (a > b) { a = b; return true; } return false; }
template <class T, class S> vector<T> make_vec(size_t n, S x) { return vector<T>(n, x); }
template <class T, class... Ts> auto make_vec(size_t n, Ts... ts) { return vector<decltype(make_vec<T>(ts...))>(n, make_vec<T>(ts...)); }

// debug
template <class T> ostream& operator<<(ostream& s, vector<T>& d) { REP (i, d.size()) s << d[i] << (i == d.size() - 1 ? "" : " "); return s; }
template <class T> ostream& operator<<(ostream& s, vector<vector<T>>& d) { REP (i, d.size()) s << d[i] << (i == d.size() - 1 ? "" : "\n"); return s; }
template <class T, class S> ostream& operator<<(ostream& s, pair<T, S>& p) { s << "{" << p.first << ", " << p.second << "}"; return s; }
template <class T, class S> ostream& operator<<(ostream& s, map<T, S> m) { for (auto it = m.begin(); it != m.end(); it++) { s << *it << (next(it) == m.end() ? "" : "\n"); } return s; }
template <class T, class S> ostream& operator<<(ostream& s, unordered_map<T, S> m) { for (auto it = m.begin(); it != m.end(); it++) { s << *it << (next(it) == m.end() ? "" : "\n"); } return s; }
#ifdef _MY_DEBUG
  #define dump(...) cerr << "/* " << #__VA_ARGS__ << " :[" << __LINE__ << ":" << __FUNCTION__ << "]" << endl, dump_func(__VA_ARGS__), cerr << "*/\n\n";
#else
  #define dump(...)
  #define endl "\n"
#endif
void dump_func() { cerr << endl; }
template <class Head, class... Tail> void dump_func(Head&& h, Tail&&... t) { cerr << h << (sizeof...(Tail) == 0 ? "" : ", "), dump_func(forward<Tail>(t)...); }

struct Fast { Fast() { cin.tie(0); ios::sync_with_stdio(false); } } fast;
mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());
constexpr int MOD = 1000000007;
// *************** TEMPLATE END *************** 

signed main() {
  int n; cin >> n;
  vector<int> a(n); REP (i, n) cin >> a[i];
  multiset<int> s;
  for (int x : a) {
    auto it = s.lower_bound(x);
    if (it == s.begin()) {
      s.insert(x);
    } else {
      it--;
      assert(*it < x);
      s.erase(it);
      s.insert(x);
    }
  }
  cout << s.size() << endl;
}


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

using namespace std;

typedef pair<int, int> P;

P solve(int n, int h[]) {
    P answer(0, 0);
    for (int i = 0; i < n - 1; ++i) {
        if (h[i] < h[i + 1]) {
            answer.first = max(answer.first, h[i + 1] - h[i]);
        }
        if (h[i] > h[i + 1]) {
            answer.second = max(answer.second, h[i] - h[i + 1]);
        }
    }
    return answer;
}

int main() {
    int t, n;
    int h[100];
    P answer;
    cin >> t;
    for (int case_num = 0; case_num < t; ++case_num) {
        cin >> n;
        for (int i = 0; i < n; ++i) {
            cin >> h[i];
        }
        answer = solve(n, h);
        cout << answer.first << ' ' << answer.second << endl;
    }
    return 0;
}

Measured memory_bytes: 1160
#include <bits/stdc++.h>
using namespace std;
     
#define int  long long
#define endl '\n'
using pii = pair<int, int>;
const int MOD = 1e9 + 7;
const int INF = 1 << 29;
const int N = 1e6 + 10;

struct IOsetup{
  IOsetup(){
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(20);
  }
}IO;

int32_t main(){
  int n;
  cin >> n;
  vector<int> a(n);
  for (int i = 0; i < n; i++) cin >> a[i];
  int curr = 1;
  int ret = 0;
  for (int i = 0; i < n; i++){
    if (a[i] == curr) curr++;
    else ret++;
  }
  if (ret == n) cout << -1 << endl;
  else cout << ret << endl;
}


Measured memory_bytes: 1792
import java.io.*;

public class Main {

	public static void main(String[] args) throws NumberFormatException, IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		
		int n=Integer.parseInt(br.readLine());
        String[] str=br.readLine().split(" ");
        int[] S=new int[n];
        
        for(int i=0;i<n;i++)
            S[i]=Integer.parseInt(str[i]);
         
        int q=Integer.parseInt(br.readLine());
        str=br.readLine().split(" ");
        boolean con;
        int count=0;
        for(int i=0;i<q;i++)
            {con=false;
        	con=method(S,Integer.parseInt(str[i]));
            if(con)count++;}
        System.out.println(count);
         
        
         
 
    }
    static boolean method(int[] s,int t){
                        
        int count=0;
        int q=s.length/4;
        
        	if(t>s[q*2]){
        		if(t>s[q*3]){
            		for(int j=s[q*3];j<s.length;j++)
            			if(t==s[j]){count++;break;}}
            	else if(t<s[q*3]){
            		for(int j=q*2;j<q*3;j++)if(t==s[j]){count++;break;}}
            	else if(s[q*3]==t){count++;}}
        	
        	else if(t<s[q*2]){
        		if(t>s[q]){
            		for(int j=s[q+1];j<q*2;j++)
            			if(t==s[j]){count++;break;}}
            	else if(t<s[q]){
            		for(int j=0;j<q;j++)if(t==s[j]){count++;break;}}
            	else if(s[q]==t){count++;}}
        	
        		
        	else if(s[s.length/2]==t){count++;}
        		
        	
        
        
                 
        return count==1;
    }
 
}

Measured memory_bytes: 42492
#include <iostream>

using namespace std;

int main () {
    long long a, b, k;
    cin >> a >> b >> k;
    long long d = b - max((k - a), 0LL);
    d = max(d, 0LL);
    cout << max(a - k, 0LL) << " " << d << endl;
}

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

int main(){

for(;;){
string num;
cin>>num;
if(num=="0"){break;}
int al=0;

for(int i=0;i<(int)num.size();i++){
al+=num[i]-'0';
}

cout<<al<<endl;
}

return 0;
}


Measured memory_bytes: 3152
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES

#include "bits/stdc++.h"
#define REP(i,a,b) for(int i=a;i<b;++i)
#define rep(i,n) REP(i,0,n)
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
#define ALL(a) begin(a),end(a)
#define ifnot(a) if(not (a))
#define dump(x)  cerr << #x << " = " << (x) << endl
using namespace std;

// #define int ll
#ifdef _MSC_VER
const bool test = true;
#else 
const bool test = false;
#endif

int dx[] = { 0,1,0,-1 };
int dy[] = { 1,0,-1,0 };
#define INF (1 << 28)
ull mod = (int)1e9 + 7;
//.....................
const int MAX = (int)2e5 + 5;

int a[1000];

int main() {
	int N;
	cin >> N;
	REP(i, 1, N + 1) {
		int b = i;
		REP(j, 2, N + 1) {
			while (b % j == 0) {
				a[j]++;
				b /= j;
			}
		}
	}
	ll res = 1;
	rep(i, 1000) {
		res *= a[i] + 1;
		res %= mod;
	}
	cout << res << endl;
	return 0;
}

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


int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
	int N; cin >> N;
	int tmp = 1;
	while (tmp <= N) tmp *= 2;
	cout << tmp / 2 << endl;

    return 0;
}


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

int main() {
  int A,B,C;
  cin>>A>>B>>C;
  if(A==B&&B==C){
    cout <<"No"<<endl;
  }
    else if(A==B||B==C||C==A){
      cout <<"Yes"<<endl;
    }
  else{
    cout<<"No"<<endl;
  }
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
  public static void main(String[] args) {
    Scanner scanner = new Scanner(System.in);

    int N = scanner.nextInt();
    long sum = 0;
    for (int i = 1; i <= N; i++) {
      if (i % 3 == 0 || i % 5 == 0) continue;
      sum += i;
    }
    System.out.println(sum);
  }
}


Measured memory_bytes: 27228
#include <iostream>
#include<algorithm>
#include<string>
#include <cmath>
#include <vector>
#include <map>
#include <cstdio>
#pragma region Macros
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,n) for(int i=1;i<=n;i++)
#define int long long
#define all(x) (x).begin(),(x).end()
#define swap(a,b) (a += b,b = a - b,a -= b)
int gcd(int a, int b) // assuming a,b >= 1
{
    if (a < b)
        swap(a, b);
    if (b == 0)
        return a;
    if (a % b == 0)
        return b;
    return gcd(b, a % b);
}
int lcm(int a, int b) // assuming a,b >= 1
{
    return  a * b / gcd(a, b);
}
using namespace std;
#pragma endregion
signed main() {
    char a[3];
    cin >> a[0] >> a[1] >> a[2];
    rep(i, 3) {
        if (a[i] == '1')
            a[i] = '9';
        else
            a[i] = '1';
    }
    cout << a[0] << a[1] << a[2];
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <map>
#include <queue>
#include <deque>
#include <complex>
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,a) FOR(i,0,a)
using namespace std;
typedef vector<int> vi;
int main() {
	int N,tmp;
	while(cin >> N && N){
	vi blocks;
	REP(i,N){
		cin >> tmp;
		blocks.push_back(tmp);
	}
	int times=0;
	while(times<=10001){
		REP(i,blocks.size())
			if(i+1!=blocks[i])
			break;
			else if(i+1==blocks.size()){
				cout << times << endl;
				goto end;
			}
		times++;
		int s=blocks.size();
		for(vi::iterator ite=blocks.begin();ite!=blocks.end();++ite){
			(*ite)--;
			if(*ite==0){
				ite=blocks.erase(ite);
				--ite;
			}
		}
		blocks.push_back(s);
	}
	
	cout << -1 << endl;
	end:;
}
	// your code goes here
	return 0;
}

Measured memory_bytes: 1236
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
typedef tuple<ll, ll, ll> T;

int H, W;
vector<string> grid;

int main(void){
    
    scanf("%d %d", &H, &W);
    int cnt = 0;
    for(int i = 0; i < H; ++i){
        string s, c(W, '.'); cin >> s;
        if(s != c) grid.push_back(s);
        else ++cnt;
    }
    H -= cnt;
    
    string c(H, '.');
    map<int, int> mp;
    for(int i = 0; i < W; ++i){
        string d;
        for(int j = 0; j < H; ++j) d.push_back(grid[j][i]);
        if(d == c) ++mp[i];
    }
    
    for(int i = 0; i < H; ++i){
        for(int j = 0; j < W; ++j) if(mp.find(j) == mp.end()) printf("%c", grid[i][j]);
        printf("\n");
    }
    
    return 0;
}

Measured memory_bytes: 256
use proconio::input;
 
fn main() {
  input! {
    n: usize,
    ais: [isize; n+1],
    bis: [isize; n]
  }
  
  let mut left = 0;
  let mut sum = 0;
  for i in 0..n {
    let a_val = if ais[i] - left > 0 {
      sum += left;
      ais[i] - left
    } else {
      sum += ais[i];
      0
    };
    let b_val = bis[i];

    if a_val < b_val {
      left = b_val - a_val;
      sum += a_val;
    } else {
      sum += b_val;
      left = 0;
    };
  }
  
  let last = if ais[n] - left > 0 {
    left
  } else {
    ais[n]
  };
  
  sum += last;
  println!("{}", sum);
}

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

int main()
{
	int N;
	bool f;
	string s1, s2;
	char c;
	char c1[] = { '.', '#', '.', '#' };
	char c2[] = { '.', '.', '#', '#' };
	cin >> N;
	do {
		f = false;
		for (int i = 0; i < 4; i++) {
			cout << s1 << c1[i] << endl;
			cout << s2 << c2[i] << endl;
			cin >> c;
			if (c == 'T') {
				s1 += c1[i];
				s2 += c2[i];
				f = true;
				break;
			}
		}
	} while (f);
	do {
		f = false;
		for (int i = 0; i < 4; i++) {
			cout << c1[i] << s1 << endl;
			cout << c2[i] << s2 << endl;
			cin >> c;
			if (c == 'T') {
				s1 = c1[i] + s1;
				s2 = c2[i] + s2;
				f = true;
				break;
			}
		}
	} while (f);
	return 0;
}


Measured memory_bytes: 596
import sys
az =["a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"]
sum_az = [0 for x in range(26)]

for x in sys.stdin.read().lower():
    for i in range(26):
        if x == az[i]:
            sum_az[i] += 1


for i in range(26):
    print ("%s : %d" % (az[i], sum_az[i]))
                

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

using namespace std;


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

#define rep(i,m,n) for(ll i=m;i<n;i++)
#define repr(i,m,n) for(ll i=m;i>=n;i--)


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

 string s;
  cin >> s;
  ll res=0;
  rep(i,0,(s.size()+1)/2) if(s[i]!=s[s.size()-1-i]) res++;
  
 cout << res << endl;
  
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <complex>
#define MAX_N 20
using namespace std;
typedef complex<double> P;
P data[MAX_N];

double distance(P a, P b) {
    double diffx = b.real()-a.real(), diffy = b.imag()-a.imag();
    return(sqrt(diffx*diffx+diffy*diffy));
}

double areaOfTriangle(P a, P b, P c) {
    double ret;
    double A = distance(a,b),B = distance(b,c),C = distance(c,a);
    double z = (A+B+C)/2.0;
    ret = sqrt(z*(z-A)*(z-B)*(z-C));
    return(ret);
}

void solve(int len) {
    double S = 0.0;
    for(int r = 1; r < len-1; r++) {
        S += areaOfTriangle(data[0], data[r], data[r+1]);
    }
    printf("%.6f\n", S);
}

int main(void) {
    double x, y;
    int idx = 0;
    while(scanf("%lf,%lf", &x,&y) != EOF) {
        data[idx++] = P(x, y);
    }
    solve(idx);
    return(0);
}

Measured memory_bytes: 1228
#include <bits/stdc++.h>
#define rep(i, n) for (int i=0; i<(int)(n); i++)
#define all(v) v.begin(), v.end()
#define PRINT(v) for (auto x : (V)) cout <<x <<" " <<endl;
using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
const ll MOD = 1000000007;
const ll INF = 10000000000000000;
vector<int> x4 = {0, 1, 0, -1}, x8 = {0, 1, 1, 1, 0, -1, -1, -1};
vector<int> y4 = {1, 0, -1, 0}, y8 = {1, 1, 0, -1, -1, -1, 0, 1};
template<class T> struct edge { int from, to; T cost;};
template<class T> inline bool chmin(T& a, T b){if (a>b){a = b; return true;}return false;}
template<class T> inline bool chmax(T& a, T b){if (a<b){a = b; return true;}return false;}
template<class T> inline T powerM(T a,T b){if (b==0) return 1;
T tmp = powerM(a,b/2); if (b%2==0) return tmp*tmp%MOD; else return tmp*tmp%MOD*a%MOD; }
template<class T> inline T power(T a,T b,T m){ if (b==0) return 1;
  T tmp = power(a,b/2,m); if (b%2==0) return tmp*tmp%m; else return tmp*tmp%m*a%m; }
template<class T> inline T gcd(T a, T b){if (b==0) return a; return gcd(b, a%b);}
template<class T> inline T lcm(T a, T b){return a / gcd(a,b) * b;}
// ax+by=gcd(a,b)を解く
template<class T> inline T extgcd(T a,T b,T &x,T &y){if (b==0){x=1; y=0; return a;} T d=extgcd(b,a%b,y,x); y -= a/b*x; return d;}
void hey(){ cout <<"hey" <<endl; }


int main() {
  ll n; cin >>n;
  cout <<n * (n-1) / 2 <<endl;
}

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

const int MAX_N = 123456 * 2;
bool prime[MAX_N + 1];

void sieve()
{
  prime[0] = prime[1] = false;
  for(int i = 2; i <= MAX_N; i++)
    prime[i] = true;
  for(int i = 2; i <= MAX_N; i++)
    if(prime[i])
      for(int j = i * 2; j <= MAX_N; j += i)
	prime[j] = false;
}

int main()
{
  sieve();
  while(1){
    int n, ans = 0;
    cin >> n;
    if(n){
      for(int i = n + 1; i <= 2 * n; i++)
	if(prime[i])
	  ans++;
      cout << ans << endl;
    }else{
      break;
    }
  }
}

Measured memory_bytes: 1400