akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
using ll = long long;

#define forn(i,x,y) for(int i = int(x); i<int(y); i++)
#define debug(x) cerr << #x << " == " << (x) << '\n';
#define all(V) V.begin(), V.end()
#define on(x, b) (x & (1LL << b))
#define trav(x, v) for(auto &x : v)

#define f first
#define s second

const int N = 1e5 + 10;

bool good(string &s) {
    string t = s;
    reverse(all(t));
    return s == t;
}

int main() {
    ios::sync_with_stdio(false); cin.tie(NULL);
    string s; cin >> s;
    int n = s.size();
    bool ok = true;
    if(!good(s)) ok = false;
    string s1 = s.substr(0, (n - 1) / 2);
    string s2 = s.substr((n + 2) / 2);

    if(!good(s1) or !good(s2)) ok = false;
    cout << (ok ? "Yes\n" : "No\n");

    return 0;
}

/* don't forget to check:
   int overflow
   min/max cases (n = 1)
   printing index of sorted array
   limits for ans (start with inf)
   s = 'x' + s is linear! dont use it!
 */

Measured memory_bytes: 256
S = input()

if S == "SAT":
    print(1)
elif S == "SUN":
    print(7)
elif S == "MON":
    print(6)
elif S == "TUE":
    print(5)
elif S == "WED":
    print(4)
elif S == "THU":
    print(3)
elif S == "FRI":
    print(2)


Measured memory_bytes: 2940
use std::io;

fn collatz_problem() -> usize {
    let mut s = String::new();
    io::stdin().read_line(&mut s).unwrap();
    let s = s.trim_right().parse::<u32>().unwrap();

    let mut list = vec![s];
    let f = |n| {
        if n % 2 == 0 {
            n / 2
        }
        else {
            3 * n + 1
        }
    };
    
    let mut i = 0;
    loop {
        let a = f(list[i]);
        i += 1;
        if list.contains(&a) {
            return i + 1;
        }
        list.push(a);
    }
}

fn main() {
    let ans = collatz_problem();
    println!("{}", ans);
}

Measured memory_bytes: 4352
#include<iostream>
#include<algorithm>
#include<math.h>
#include<vector>
#include<map>
#include<set>

#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rrep(i, a, n) for (int i = a; i <= (n); ++i)

using namespace std;
using ll = long long;

int main() {
    string S; cin >> S;
    string T; cin >> T;

    cout << T + S << endl;
    return 0;
}


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

int N;
vector<int> L;
vector<int> A; // A, B, C

int main() {
  cin >> N;
  A.resize(3);
  for (int i = 0; i < 3; i++) cin >> A[i];
  L.resize(N);
  for (int i = 0; i < N; i++) cin >> L[i];


  int min_cost = 1<<19;
  vector<int> bit(3);
  for (bit[0] = 1; bit[0] < (1<<N); bit[0]++) {
    for (bit[1] = 1; bit[1] < (1<<N); bit[1]++) {
      for (bit[2] = 1; bit[2] < (1<<N); bit[2]++) {
        if (bit[0] & bit[1]) continue;
        if (bit[0] & bit[2]) continue;
        if (bit[1] & bit[2]) continue;

        vector<int> sums(3, 0), nums(3, 0);
        for (int i = 0; i < N; i++) {
          for (int j = 0; j < 3; j++) {
            if (bit[j] & (1<<i)) {
              sums[j] += L[i];
              nums[j]++;
            }
          }
        }

        int score = 0;
        for (int i = 0; i < 3; i++) {
          score += abs(sums[i] - A[i]);
          score += (nums[i] - 1) * 10;
        }
        
        min_cost = min(min_cost, score);
      }
    }
  }
  cout << min_cost << endl;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main(){
  int N,K;
  cin >> N >> K;
  vector<int> A(N);
  for(int i=0;i<N;i++) cin >> A.at(i);
  
  for(int k=0;k<K;k++){
    vector<int> B(N+1,0);
    
    for(int i=0;i<N;i++){
      int left = max(0,i-A.at(i));
      int right = min(i+A.at(i)+1,N);
      B.at(left) ++;
      B.at(right) --;
    }
    for(int i=1;i<=N;i++){
      B.at(i) += B.at(i-1);
    }
    if(A==B) break;
    A = B;
  }
  for(int i=0;i<N;i++){
    cout << A.at(i) << endl;
  }
}

Measured memory_bytes: 5632
a = input()
test = ''
for i in range(len(a)):
  if a[i] == '0':
    test += '0'
  elif a[i] == '1':
    test += '1'
  else:
    if len(a) == 0:
      pass
    else:
      test = test[:-1]
    
print(test)

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

int main(){
string S;
  cin >> S;
int cnt = 0;  
  
char now = S.at(0);  
  
  for(int i = 1;i < S.size();i++){
  if(now != S.at(i)){
  now = S.at(i);
  cnt++;  
  }
  }
  
  cout << cnt << endl;
  return 0;
  
}

Measured memory_bytes: 512
#include<iostream>
#include<set>
#include<vector>
#include<array>
#include<algorithm>

uint64_t xor64(void) {
  static uint64_t x = 88172645463325252ULL;
  x = x ^ (x << 7);
  return x = x ^ (x >> 9);
}

int main() {
  std::cin.tie(0); std::ios::sync_with_stdio(false);
  int D; std::cin >> D;
  int c[26];
  for(auto& ci: c) std::cin >> ci;
  std::vector<std::array<int,26>> s(D);
  for(int d = 0; d < D; ++d) {
    for(auto& si: s[d]) std::cin >> si;
  }
  std::vector<int> t(D);
  for(int i = 0; i < D; ++i) t[i] = i%26;
  std::set<int> last[26];
  for(auto& li: last) li.insert(-1); // sentinel
  int ans = 0;
  for(int d = 0; d < D; ++d) {
    int t1 = t[d];
    ans += s[d][t1];
    last[t1].insert(d);
    for(int i = 0; i < 26; ++i) {
      ans -= c[i]*(d - *last[i].rbegin());
    }
  }
  for(auto& li: last) li.insert(D); // sentinel
  
  // additional score when t[d] = i compare to t[d] = -1
  auto sum_up = [](int d) { return d*(d-1)/2; };
  auto score = [&](int d, int i)->int {
    int res = s[d][i];
    auto it = last[i].lower_bound(d);
    int nd = *it;
    int pd = *--it;
    int diff = sum_up(d-pd) + sum_up(nd-d) - sum_up(nd-pd);
    res -= c[i]*diff;
    return res;
  };
  
  // hill climbing
  int lm = 0;
  int sc[26];
  for(;;) {
    if((xor64()>>25)&1) {
      int d = xor64()%D;
      int pi = t[d];
      last[pi].erase(d);
      for(int i = 0; i < 26; ++i) sc[i] = score(d, i);
      int mi = std::max_element(sc, sc+26) - sc;
      t[d] = mi;
      last[mi].insert(d);
      if(mi != pi) lm = 0; else ++lm;
    } else {
      int d1 = xor64()%D, d2 = xor64()%D;
      while(d1 < d2-16 || d2 < d1-16 || t[d1] == t[d2]) {
        d1 = xor64()%D; d2 = xor64()%D;
      }
      int pi1 = t[d1], pi2 = t[d2];
      last[pi1].erase(d1);
      int diff = score(d1, pi2) - score(d1, pi1);
      last[pi2].insert(d1);
      last[pi2].erase(d2);
      diff += score(d2, pi1) - score(d2, pi2);
      if(diff > 0) {
        last[pi1].insert(d2);
        t[d1] = pi2;
        t[d2] = pi1;
        lm = 0;
      } else {
        last[pi2].insert(d2);
        last[pi2].erase(d1);
        last[pi1].insert(d1);
        ++lm;
      }
    }
    if(lm >= 1000000) break;
  }
  for(auto ti: t) std::cout << ti+1 << "\n";
  return 0;
}


Measured memory_bytes: 3712
#include <cstdio>
#include <algorithm>
#include <vector>
#include <set>
#include <cstdlib>
#include <utility>
#include <cmath>
#include <queue>
#include <stack>
#include <cstring>

using namespace std;

#define ll long long

#ifndef ONLINE_JUDGE
#define debug(format, ...) fprintf(stderr, \
    "%s:%d: " format "\n", __func__, __LINE__,##__VA_ARGS__)
#else
#define debug(format, ...)
#define NDEBUG
#endif

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

int Lcm(int a, int b)
{
    return (a * b) / Gcd(a, b);
}

int main()
{
    int x; scanf("%d", &x);
    printf("%d", Lcm(x, 360) / x);
    return 0;
}


Measured memory_bytes: 1712
#include <iostream>
#include <vector>
#include <cmath>
#include <cstdio>

using namespace std;

int N;

int main() {

    cin >> N;
    vector<int> p(N+1, 0);
    for (int i = 1; i < N+1; i++) {
        cin >> p[i];
    }

    /*
    for (int i = 1; i < N+1; i++) {
        cout << i << " " << p[i] << ":" << (i == p[i]) << '\n';
    }
    */
    
    int ans = 0;
    int cnt = 0;
    for (int i = 1; i < N+1; i++) {
        if (i == p[i]) cnt++;
        else {
            ans += (cnt + 1) / 2;
            cnt = 0;
        }
    }
            ans += (cnt + 1) / 2;

    cout << ans << '\n';

}


Measured memory_bytes: 768
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Scanner;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author ZYCSwing
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskB solver = new TaskB();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskB {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            int n = in.nextInt();
            int[] a = new int[n];
            for (int i = 0; i < n; ++i) a[i] = in.nextInt();
            int res = (int) Math.pow(3, n);
            int tmp = 1;
            for (int i = 0; i < n; ++i) {
                if (a[i] % 2 == 0) {
                    tmp *= 2;
                }
            }
            out.println(res - tmp);
        }

    }
}



Measured memory_bytes: 22356
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <utility>
#include <set>
#include <map>
#include <cmath>
#include <queue>
#include <cstdio>
#define rep(i,n) for(int i = 0; i < n; ++i)
#define rep1(i,n) for(int i = 1; i <= n; ++i)
#define rep2(i,s,t) for(int i = s; i <= t; ++i)
#define rev(i,n) for(int i = n-1; i >= 0; --i)
#define rev1(i,n) for(int i = n; i > 0; --i)
#define rev2(i,s,t) for(int i = s; i >= t; --i)
#define F first
#define S second
using namespace std;
template<class T>bool chmax(T &a, const T &b) { if(a < b){ a = b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if(a > b){ a = b; return 1; } return 0; }
using ll = long long;
using pi = pair<int,int>;
using vi = vector<int>;
using vii = vector<vi>;
typedef long long ll;
const ll MOD=1e+9+7;
struct mint{
  ll x;
  mint(ll x=0):x(x%MOD){}
  mint& operator+=(const mint a){
    if((x+=a.x)>=MOD) x-=MOD;
    return *this;
  }
  mint& operator-=(const mint a){
    if((x += MOD-a.x)>=MOD) x-=MOD;
    return *this;
  }
  mint& operator*=(const mint a){
    (x*=a.x)%=MOD;
    return *this;
  }
  mint operator+(const mint a) const{
    mint res(*this);
    return res+=a;
  }
  mint operator-(const mint a) const{
    mint res(*this);
    return res-=a;
  }
  mint operator*(const mint a) const{
    mint res(*this);
    return res*=a;
  }
  mint pow(ll t) const{
    if(!t) return 1;
    mint a = pow(t>>1);
    a*=a;
    if(t&1) a*=*this;
    return a;
  }
  
  //for prime mod
  mint inv() const{
    return pow(MOD-2);
  }
  mint& operator/=(const mint a){
    return (*this) *= a.inv();
  }
  mint operator/(const mint a) const{
    mint res(*this);
    return res/=a;
  }
};


int main()
{
  string s; cin >> s;
  int d; cin >> d;
  int n = s.size();
  
  vector<vector<mint>> dp(d, vector<mint>(2));
  dp[0][0].x = 1;
  
  rep(i,n) {
    int c = s[i] - '0';
    vector<vector<mint>> ndp(d, vector<mint>(2));
    rep(f,2) {
      rep(j,d) {
	rep(k,(f ? 10 : c+1)) {
	  ndp[(j + k) % d][f || k < c] += dp[j][f];
	}
      }
    }
    dp = ndp;
  }
  cout << (dp[0][0] + dp[0][1] - (mint)1).x << "\n";
  
  return 0;
}


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

const int maxn=200007;
int n;
string s;
int dp[maxn][7];

int main(){
	ios::sync_with_stdio(false);
	cin>>s;
	n=s.size();
	dp[1][1]=1;
	for (int i=2;i<=n;++i){
		dp[i][1]=dp[i-1][2]+1,dp[i][2]=dp[i-2][1]+1;
		if (s[i-1]!=s[i-2]) dp[i][1]=max(dp[i][1],dp[i-1][1]+1);
	}
	cout<<max(dp[n][1],dp[n][2])<<endl;
	return 0;
} 

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

int main() {
  int n, i, v, ans = 1;
  vector<int> d;

  cin >> n;
  for (i = 0; i < n; i++) {
    cin >> v;
    d.push_back(v);
  }

  sort(d.begin(), d.end(), greater<int>());

  for (i = 0; i < n - 1; i++) {
    if (d.at(i) == d.at(i + 1)) {
      continue;
    }

    ans++;
  }

  cout << ans << endl;
}


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

using namespace std;

int main(){
    string N;

    cin>>N;

    if(N[0] == '7' || N[1] == '7' || N[2] == '7'){
        cout<<"Yes"<<endl;
    }else{
        cout<<"No"<<endl;
    }

    return 0;
}

Measured memory_bytes: 3608
#include<stdio.h>
int main () {
    int a,b;
    scanf("%d %d",&a,&b);
    int c=a;
    a=0;
    for(int i=0;i<c;i++){
        a=a+i;
    }
    int d=b;
    b=0;
    for(int i=0;i<d;i++){
        b=b+i;
    }
    printf("%d",a+b);
    return 0;
}

Measured memory_bytes: 1720
N = int(input())
A = input()
B = input()
C = input()

a = list(A)
b = list(B)
c = list(C)

ans = 0

for i,j in enumerate(a):
    if j == b[i] or j == c[i] or b[i] == c[i]:
        if j == b[i] == c[i]:
            continue
        ans += 1
    elif a[i] != b[i] != c[i]:
        ans += 2
    

print(ans)

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

using namespace std;

int main()
{
	int n, x;
	
	while(true)
	{
		scanf("%d %d", &n, &x);
		
		if(n == 0 && x == 0)
			break;
		
		int num_combinations = 0;
		
		for(int i = 1; i <= n; i++)
			for(int j = 1; j < i; j++)
				for(int k = 1; k < j; k++)
					if((i + j + k) == x)
						num_combinations++;
						
		printf("%d\n", num_combinations);
	}
	
	return 0;
}


Measured memory_bytes: 3220
#pragma region
#include <bits/stdc++.h>
using namespace std;
inline void ci(void){
  return;
}
template <typename First, typename... Rest>
void ci(First& first, Rest&... rest){
  cin >> first;
  ci(rest...);
  return;
}
inline void co(void){
  cout << "\n";
  return;
}
template <typename First, typename... Rest>
void co(First first, Rest... rest){
  cout << first << " ";
  co(rest...);
  return;
}
#define ll long long
#define ld long double
#define st string
#define dl double
#define wh while
#define mp make_pair
#define mt make_tuple
#define pb push_back
#define tp tuple
#define ft first
#define sc second
#define ve vector
#define tos to_string
#define len length
#define rt return 0
#define gcd __gcd
#define lcm(n, m) n * m / gcd(n, m)
#define np next_permutation
#define repi(i, m, n) for(int i=(int)(m);i<(int)(n);i++)
#define rep(i, n) repi(i, 0, n)
#define sz(v) ((int)(v).size()) 
#define ea(i, n) for(auto&& i: n)
#define so(n) sort(n.begin(), n.end())
#define sp(n) cout << fixed << setprecision(n)
#pragma endregion
// rtsq ルート, int 2*10^9, __gcd

int main() {
  int X, Y, Z;
  ci(X, Y, Z);
  co(Z, X, Y);
}

Measured memory_bytes: 256
parseInt(x) = parse(Int, x)
parseMap(x::Array{SubString{String},1}) = map(parseInt, x)

function main()
	p = 10^9+7
	n = readline() |> parseInt
	s = readline() |> chomp
	lr = zeros(Int,2n)
	lr[1] = -1
	f = 0
	for i in 2:2n
		if s[i]==s[i-1]
			lr[i]=lr[i-1]*(-1)
		else
			lr[i]=lr[i-1]
		end
	end
	ans = 1
	lc = 0
	rc = 0
	for i in 1:2n
		if lr[i]==1
			ans = ans*(lc-rc)%p
			rc += 1
		else
			lc += 1
		end
	end
	for i in 1:n
		ans = ans*i%p
	end
	println(sum(lr)==0&&s[2n]=='B'&&s[1]=='B'?ans:0)
end

main()

Measured memory_bytes: 119648
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
ll MOD=1000000007;

int main() {
    int N; cin>>N;
    long long int T; cin>>T;
    vector<ll> t(N,0);
    ll ans=0;
    for(int i=0;i<N;i++){
        cin>>t[i];
    }
    for(int i=0;i<N-1;i++){
        if(t[i+1]-t[i]>=T){
            ans+=T;
        }
        else{
            ans+=(t[i+1]-t[i]);
        }
    }
    cout<<ans+T;
    return 0;
}

Measured memory_bytes: 1792
#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 MD = (int)1e9 + 7; typedef vector<ll> VL;
void dbg(){ cerr << "\n"; }  template <class T, class ...T2> void dbg(const T& fst, const T2&...rst){ cerr << fst << ": "; dbg(rst...); }
template <class T, class T2> void amax(T& a,T2 b){ if(a < b) a = b;}
const int INF = 1<<28;


int main()
{
	cin.tie(0); ios_base::sync_with_stdio(false);
	ll n, x, y;
	cin >>n >>x >>y;
	
	vector<VI> a(n, VI(n));
	rep(i, n) rep2(j, i+1, n){
		a[i][j] = a[j][i] = abs(j-i);
	}
	rep(i, n) rep2(j, i+1, n){
		a[i][j] = min(a[i][j], a[i][x-1] + a[y-1][j] + 1);
		a[j][i] = a[i][j];
	}
	VI ds(n+2);
	rep(i, n) rep2(j, i+1, n) ds[a[i][j]]++;
	
	rep2(i, 1, n) cout << ds[i]<<"\n";
	
	return 0;
}


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

int h, w;
void solve(int y, int x, vector<string> const& v, vector<string>& ret) {
    int dx[8] = {0, 1, 1, 1, 0, -1, -1, -1},
        dy[8] = {-1, -1, 0, 1, 1, 1, 0, -1};
    for(int i=0; i<8; ++i) {
        string s;
        vector<vector<bool>> used(h, vector<bool>(w, false));
        while(!used[y][x]) {
            s += v[y][x];
            used[y][x] = true;
            x = (x + dx[i] + w)%w;
            y = (y + dy[i] + h)%h;
            if(s.size() >= 2) {
                ret.push_back(s);
            }
        }
    }
}

int main() {
    while(cin >> h >> w, h) {
        vector<string> v(h);
        vector<string> ret;
        for(int i=0; i<h; ++i) {
            cin >> v[i];
        }
        for(int i=0; i<h; ++i) {
            for(int j=0; j<w; ++j) {
                solve(i, j, v, ret);
            }
        }
        sort(ret.begin(), ret.end());
        string ret2;
        for(int i=0; i<ret.size()-1; ++i) {
            if(ret[i] == ret[i+1]) {
                if(ret2.size() < ret[i].size() || ret2.size() == ret[i].size() && ret2 > ret[i]) {
                    ret2 = ret[i];
                }
            }
        }
        if(ret2.size() == 0) {
            cout << 0 << endl;
        } else {
            cout << ret2 << endl;
        }
    }   
}


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

int main(){
    string str;
    cin>>str;
    int count[2]={0,0};
    for(int i = 0; i < str.length();i++){
        count[str[i]-'0']++;
    }
    cout<<min(count[0],count[1])*2<<endl;
}



Measured memory_bytes: 512
#include <iostream>
#include <string>
#include <vector>
#include <tuple>
#include <algorithm>
#include <cmath>
#include <cstdio>

using namespace std;

int main() {
    int A, B, C, times;
    cin >> A >> B >> C;
    times = C / A;
    cout << B * times << endl;


    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
int main(){
  int A=0;
  int B=0;

  scanf("%d",&A);
  scanf("%d",&B);

  int ans=A*B;
  if(A>9||B>9){
    printf("-1");
  }else{
    printf("%d\n",ans);
  }
  return 0;
}


Measured memory_bytes: 128
def solve():
   N, K = map(int, input().split())
   ans = 0
   MOD = 10 ** 9 + 7

   for i in range(K,N+2):
       mn, lim = (i - 1) * i // 2, ((N - i + 1) + N) * (i) // 2
       ans += lim - mn + 1
   print(ans%MOD) 

if __name__ == '__main__':
    solve()

Measured memory_bytes: 9128
import fractions
a,b,c,d = map(int,input().split())
lcm_cd = int(c*d / fractions.gcd(c,d))
if a%c==0:
  tc = b//c - a//c + 1
else:
  tc = b//c - a//c
if a%d==0:
  td = b//d - a//d + 1
else:
  td = b//d - a//d
if a%(lcm_cd)==0:
  tcd = b//(lcm_cd) - a//(lcm_cd) + 1
else:
  tcd = b//(lcm_cd) - a//(lcm_cd)

print(b-a+1-tc-td+tcd)

Measured memory_bytes: 5180
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int[][] array = new int[n][2];
		for (int i = 0; i < n; i++) {
			array[i][0] = sc.nextInt() - 1;
		}
		for (int i = 0; i < n; i++) {
			array[i][1] = sc.nextInt();
		}
		int[] c = new int[n - 1];
		for (int i = 0; i < n - 1; i++) {
			c[i] = sc.nextInt();
		}
		long sum = 0L;
		int pi = -2;
		for (int i = 0; i < n; i++) {
			sum += array[array[i][0]][1];
			if (array[i][0] == pi + 1) {
				sum += c[pi];
			}
			pi = array[i][0];
		}
		System.out.println(sum);
	}
}


Measured memory_bytes: 23252
import java.util.Scanner;

class Main {
	private static Scanner scan = new Scanner(System.in);;

	public static void main(String[] args) {
		try {
			int n = Integer.parseInt(scan.next());
			System.out.println((n / 3600) + ":" + (n % 3600 / 60) + ":" + (n % 3600 % 60));
		} catch (Exception e) {
			System.exit(0);
		}
	}
}

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

void fnInput(int& rnNum)
{
  cin >> rnNum;
}
  
int fnNextPrimeGet(int nNum)
{
  int nNextPrime = nNum - 1;
  bool bPrime = false;

  while (!bPrime)
  {
    nNextPrime++;
    int nSqrtInt = sqrt(nNextPrime);
    bPrime = true;

    for (int n = 2; n <= nSqrtInt; n++)
      if (nNextPrime % n == 0)
      {
        bPrime = false;
        break;
      }
  }
  return nNextPrime;
}
  
int main()
{
  int nNum;

  fnInput(nNum);
  cout << fnNextPrimeGet(nNum) << endl;

  return 0;
}

Measured memory_bytes: 256
import std.stdio, std.string, std.conv, std.range;
import std.algorithm, std.array, std.typecons, std.container;
import std.math, std.numeric, std.random, core.bitop;

enum inf = 1_001_001_001;
enum infl = 1_001_001_001_001_001_001L;



void main() {
    long N;
    scan(N);
    auto ans = N * (N - 1) / 2;
    writeln(ans);
}



void scan(T...)(ref T args) {
    auto line = readln.split;
    foreach (ref arg; args) {
        arg = line.front.to!(typeof(arg));
        line.popFront;
    }
    assert(line.empty);
}

void fillAll(R, T)(ref R arr, T value) {
    static if (is(typeof(arr[] = value))) {
        arr[] = value;
    }
    else {
        foreach (ref e; arr) {
            fillAll(e, value);
        }
    }
}

bool chmin(T, U...)(ref T x, U args) {
    bool isChanged;
    foreach (arg; args) if (x > arg) {
        x = arg;
        isChanged = true;
    }
    return isChanged;
}

bool chmax(T, U...)(ref T x, U args) {
    bool isChanged;
    foreach (arg; args) if (x < arg) {
        x = arg;
        isChanged = true;
    }
    return isChanged;
}

void yes(bool ok, string y = "Yes", string n = "No") {
    return writeln(ok ? y : n);
}

Measured memory_bytes: 256
from collections import defaultdict
from collections import deque
from string import ascii_uppercase
import sys, bisect, math, heapq

stdin = sys.stdin
read_int = lambda : list(map(int,stdin.readline().split()))
read_str = lambda : stdin.readline().rstrip()

S = read_str()

def solve():
    return S[0] == '7' or S[1] == '7' or S[2] == '7'

if __name__ == "__main__":
    if solve():
        print('Yes')
    else:
        print('No')

Measured memory_bytes: 9784
#include "bits/stdc++.h"
 
typedef long long ll;
#define int ll
#define fi first
#define se second
#define SORT(a) sort(a.begin(),a.end())
#define rep(i,n) for(int i = 0;i < (n) ; i++) 
#define REP(i,n) for(int i = 0;i < (n) ; i++) 
#define MP(a,b) make_pair(a,b)
#define pb(a) push_back(a)
#define INF LLONG_MAX/2
#define all(x) (x).begin(),(x).end()
#define debug(x) cerr<<#x<<": "<<x<<endl
#define debug_vec(v) cerr<<#v<<":";rep(i,v.size())cerr<<" "<<v[i];cerr<<endl
using namespace std;

int MOD = 998244353;

int d[2510];
struct edge{
    int from;
    int to;
    int cost;
};
int n,m,p;
int bfs_d[2510];
vector<int> G[2510]; 
int dont_use[2510] = {0};
void bfs(){
    queue<int> q;
    rep(i,n)bfs_d[i] = INF;
    bfs_d[n-1] = 0;
    q.push(n-1);
    
    while(q.size()){
        int p = q.front();
        q.pop();
        for(auto x:G[p]){
            if(bfs_d[x] == INF){
                bfs_d[x] = bfs_d[p] + 1;
                q.push(x);
            }
        }
    }
    
    return;
}

signed main(){
    vector<edge> es;

    cin >> n >> m >> p;
    rep(i,m){
        int a,b,c;
        cin >> a >> b >> c;
        edge e1 = {a-1,b-1,p-c};
        es.push_back(e1);
        G[b-1].pb(a-1);
    }
    bfs();
    rep(i,n) if(bfs_d[i] == INF)dont_use[i] = 1;
    //rep(i,n)cerr << i << " " << dont_use[i] << endl;

    rep(i,n)d[i] = INF;
    d[0] = 0;
    rep(i,n){
        rep(j,m){
            struct edge e = es[j];
            if(dont_use[e.from])continue;
            if(dont_use[e.to] != 1 && d[e.from] != INF && d[e.to] > d[e.from] + e.cost){
                d[e.to] = d[e.from] + e.cost;
                if(i == n-1){
                    cout << -1 << endl;
                    return 0;
                }
            }
        }
    }
    cout << max(-d[n-1],0LL) << endl;
    // rep(i,n)cerr << d[i] << endl;
    
    return 0;
}

// g++ -std=c++14 code1.cpp
// rm -r -f test;oj dl https://cf17-final-open.contest.atcoder.jp/tasks/cf17_final_a
// rm -r -f test;oj dl http://abc137.contest.atcoder.jp/tasks/abc137_b


Measured memory_bytes: 768
#include <iostream>
#include <vector>
#include <queue>
#include <map>
#include<numeric>
using namespace std;
using P = pair<int, int>;
#define rep(i,n) for(int i=0; i<(n);i++)
typedef long long ll;


int main(){
    int k,a,b; cin >> k >> a >> b;
    for(int i = a; i <= b; i++){
        if(i%k==0){
            cout << "OK" << endl;
            return 0;
        }
    }
    cout << "NG" << endl;
	return 0;
}


Measured memory_bytes: 3072
#include<set>
#include<map>
#include<stack>
#include<cmath>
#include<cstdio>
#include<queue>
#include<vector>
#include<climits>
#include<cstring>
#include<iostream>
#include<algorithm>
#define LL long long
using namespace std;
LL read(){
	LL	f=1,x=0;
	char c=getchar();
	while(c<'0'||'9'<c){if(c=='-')f=-1;c=getchar();}
	while('0'<=c&&c<='9'){x=x*10+c-'0';c=getchar();}
	return f*x;
}
#define MAXN 200000
#define INF 0x3f3f3f3f
LL candle[MAXN+5];
int main(){
	LL n=read(),k=read(),p=n+1,f=0,ans;
	for(int i=1;i<=n;i++){
		candle[i]=read();
		if(!candle[i]){
			k--,n--,i--;
			continue;
		}
		if(!f&&candle[i]>0)
			f=1,p=i,candle[i+1]=candle[i],candle[i]=0,i++,n++;
	}
	if(!f) n++;
	ans=INF;
	for(int i=0;i<=k;i++)
		if(1<=p-(k-i)&&p+i<=n)
			ans=min(ans,-candle[p-(k-i)]+candle[p+i]+(!i||i==k?0:min(-candle[p-(k-i)],candle[p+i])));
	printf("%lld\n",ans==INF?0ll:ans);
	return 0;
}

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

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;

#define fi first
#define se second
#define repl(i,a,b) for(ll i=(ll)(a);i<(ll)(b);i++)
#define rep(i,n) repl(i,0,n)
#define all(x) (x).begin(),(x).end()
#define dbg(x) cout<<#x"="<<x<<endl
#define mmax(x,y) (x>y?x:y)
#define mmin(x,y) (x<y?x:y)
#define maxch(x,y) x=mmax(x,y)
#define minch(x,y) x=mmin(x,y)
#define uni(x) x.erase(unique(all(x)),x.end())
#define exist(x,y) (find(all(x),y)!=x.end())
#define bcnt __builtin_popcountll

#define INF 1e16
#define mod 1000000007

ll mod_pow(ll a,ll n){
  ll res=1;
  while(n>0){
    if(n&1)res=res*a%mod;
    a=a*a%mod;
    n>>=1;
  }
  return res;
}

ll fac[100010],finv[100010];

ll f(ll n,ll r){
  if(n<r) return 0;
  return fac[n]*finv[n-r]%mod;
}

ll n,k;
vector<ll> g[100010];
ll res=1;

void dfs(ll v,ll pre){
  ll rest;
  if(pre==-1) rest=k-1;
  else rest=k-2;
  ll ch=0;
  for(ll nv : g[v]){
    if(nv==pre)continue;
    dfs(nv,v);
    ch++;
  }
  res*=f(rest,ch);
  res%=mod;
}

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

  fac[0]=1;
  rep(i,100000)fac[i+1]=fac[i]*(i+1)%mod;
  rep(i,100001)finv[i]=mod_pow(fac[i],mod-2);

  cin>>n>>k;
  rep(i,n-1){
    ll a,b;
    cin>>a>>b;
    a--;b--;
    g[a].push_back(b);
    g[b].push_back(a);
  }

  dfs(0,-1);
  cout<<res*k%mod<<endl;

  return 0;
}


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

// #undef DEBUG  // Uncomment this line to forcefully disable debug print.
#if DEBUG
template <typename T>
void debug(T value) {
  std::cerr << value;
}
template <typename T, typename... Ts>
void debug(T value, Ts... args) {
  std::cerr << value << ", ";
  debug(args...);
}
#define DBG(...)                \
  cerr << #__VA_ARGS__ << ": "; \
  debug(__VA_ARGS__);           \
  cerr << " (L" << __LINE__ << ")" << endl
#else
#define DBG(...)
#endif

#define ALL(x) (x).begin(), (x).end()
#define FOR(i, n) for (auto i : (n))
#define REP(i, n) for (int i = 0; i < (int)(n); ++i)

using namespace std;

int main() {
  string S;
  cin >> S;
  int Q;
  cin >> Q;
  bool flipped = false;
  string head, tail;
  REP(q, Q) {
    int T;
    cin >> T;
    if (T == 1) {
      flipped = !flipped;
      continue;
    }
    int F;
    char C;
    cin >> F >> C;
    (((F == 1) ^ flipped) ? head : tail) += C;
    DBG(head, tail);
  }
  reverse(ALL(head));
  string s = head + S + tail;
  if (flipped) {
    reverse(ALL(s));
  }
  cout << s << endl;
}


Measured memory_bytes: 1348
'''
ITP-1_6-B
 ????¶???????????????????????????????
???????????±?????¨?????????????????????????????????????????¨????????¨?????????52?????????????????????????????? n ???????????????????????????????????????????????????????????? n ????????????????????\?????¨??????????¶??????????????????????????????????????????°?????????????????????????????????
???????????????????????£?????????????????????????????§??????????????????52?????????????????§??????
52??????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????13??????????????????????????????
???Input
?????????????????????????????£??????????????????????????° n (n ??? 52)????????????????????????

?¶??????? n ??????????????????????????????????????????????????????????????????????????????????????§???????????????????????¨??´??°??§??????
????????????????????????????????¨?????????????????????'S'???????????????'H'???????????????'C'???????????????'D'??§??¨?????????????????????
??´??°??????????????????????????????(1 ??? 13)?????¨??????????????????
???Output
?¶??????????????????????????????????1???????????????????????????????????????????????\?????¨????§?????????????????????§???????????????????????¨??´??°??§?????????????????????????????????????????\????????¨????????¨????????????
???????????????????????????????????????????????????????????????????????§???????????????????????????
????????????????????´??????????????????????°????????????????????????????
'''
# import

# ?????°??????????????????

trumpData = {
        "S": list(range(1,14)),
        "H": list(range(1,14)),
        "C": list(range(1,14)),
        "D": list(range(1,14)),
        }

taroCard = int(input())
# ??????????????§??????????????????????????????????????????
for nc in range(taroCard):
    (trumpDataLostMark, trumpDataLostCnt) = input().split()
    index = trumpData[trumpDataLostMark].index(int(trumpDataLostCnt))
    del trumpData[trumpDataLostMark][index]

# ????¶???????????????????????????????
for trumpDataMark in ['S', 'H', 'C', 'D']:
    for trumpDataCnt in trumpData[trumpDataMark]:
        # Output
        print(trumpDataMark, trumpDataCnt)

Measured memory_bytes: 7664
s = input()

answer = 0
for canditate in range(1 << len(s)-1):
    combi = s[0]
    for n_digit in range(len(s) - 1):
        if (canditate >> n_digit) & 1:
            combi += '+'
        combi += s[n_digit+1]  # 足される数's[0]'を除いた数値部分を取り出す
    answer += eval(combi)

print(answer)


Measured memory_bytes: 3060
#include <stdio.h>
#include <string.h>
#define LEN 100005
 
typedef struct pp {
  char name[100];
  int t;
} P;
 
P Q[LEN];
int head, tail, n;
 
void enqueue(P x) {
  Q[tail] = x;
  tail = (tail + 1) % LEN;
}
 
P dequeue() {
  P x = Q[head];
  head = (head + 1) % LEN;
  return x;
}
 
int min(int a,int b) {
  return a < b ? a : b; 
}
 
int main() {
  int elaps = 0, c;
  int i, q;
  P u;
  
  scanf("%d %d",&n ,&q);
  for(i=1; i<=n; i++) {
    scanf("%s", Q[i].name);
    scanf("%d", &Q[i].t);
  }
  head = 1; tail = n + 1;
 
  while(head != tail) {
    u = dequeue();
    c = min(q, u.t);
    u.t -= c;
    elaps += c;
    if(u.t > 0) enqueue(u);
    else {
      printf("%s %d\n",u.name,elaps);
    }
  }
  return 0;
}


Measured memory_bytes: 11904
#include <iostream>
#include <vector>
#include <cmath>
#include <string>
#include <algorithm>
#include <numeric>
#include <climits>
#define ll long long
#define LIM 1000
using namespace std;
int main() {
  int a, b, c;
  cin >> a >> b >> c;
  if (a == b) {
    cout << c << endl;
    return 0;
  } else if (a == c) {
    cout << b << endl;
    return 0;
  } else {
    cout << a << endl;
    return 0;
  }
  return 0;
}


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

int main() {
    string s;
    cin >> s;
    int l = s.length();
    int cnt[26] = {0};
    bool ans = true;
    
    rep(i, l) {
        cnt[s[i] - 'a']++;
    }
    
    rep(i, 26) {
        if (cnt[i] > 1) {
            ans = false;
            break;
        }
    }
    
    cout << (ans ? "yes" : "no") << endl;
    return 0;
}

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

using ll = long long;

const ll MOD = 1000 * 1000 * 1000 + 7;

ll fact[200000];

int main() {
    ll N, M;
    cin >> N >> M;

    fact[0] = 1;
    for (ll i = 1; i < 200000; i++) {
        fact[i] = (i * fact[i - 1]) % MOD;
    }

    if (N < M) swap(N, M);

    ll ans = 0;
    if (N - M == 0) ans = (2 * fact[N] * fact[M]) % MOD;
    else if (N - M == 1) ans = (fact[N] * fact[M]) % MOD;

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 1792
#include<bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp> 
//#include <ext/pb_ds/tree_policy.hpp>
//#include <functional> // for less
//using namespace __gnu_pbds;
using namespace std;
typedef long long  L;

int main()
{
    L d;
    cin>>d;
    double ans=(double)d*3.1415926*2.0;
    cout<<ans<<endl;
    return 0;
}
/// empty() lld I64d push_back() top() pop() insert() upper_bound() lower_bound() memset() max() min() scanf continue


Measured memory_bytes: 3784
x, a, b = input().split()
x = int(x)
a = int(a)
b = int(b)
if x < a:
  dis_ax = a-x
else:
  dis_ax = x-a
if x < b:
  dis_bx = b-x
else:
  dis_bx = x-b
if dis_ax > dis_bx:
  print("B")
else:
  print("A")

Measured memory_bytes: 3064
/*
ID: Aman Raj
LANG: C++
TASK: prefix
*/
//#include<iostream>
#include <stdio.h>
//#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
#include<math.h>
typedef  long long int ll;
#include <bits/stdc++.h>
#include <vector>
#include <set>
#include <map>
#include <string>
#include <cstdio>
#include <cstdlib>
#include <climits>
#include <utility>
#include <algorithm>
#include <cmath>
#include <queue>
#include <stack>
#include <iomanip>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
//setbase - cout << setbase (16); cout << 100 << endl; Prints 64
//setfill -   cout << setfill ('x') << setw (5); cout << 77 << endl; prints xxx77
//setprecision - cout << setprecision (14) << f << endl; Prints x.xxxx
//cout.precision(x)  cout<<fixed<<val;  // prints x digits after decimal in val

using namespace std;
using namespace __gnu_pbds;

#define f(i,a,b) for(i=a;i<b;i++)
#define rep(i,n) f(i,0,n)
#define fd(i,a,b) for(i=a;i>=b;i--)
#define pb push_back
#define mp make_pair
#define vi vector< int >
#define vl vector< ll >
#define ss second
#define ff first
//#define ll long long
#define pii pair< int,int >
#define pll pair< ll,ll >
#define sz(a) a.size()
#define inf (1000*1000*1000+5)
#define all(a) a.begin(),a.end()
#define tri pair<int,pii>
#define vii vector<pii>
#define vll vector<pll>
#define viii vector<tri>
#define mod (1000*1000*1000+7)
#define pqueue priority_queue< int >
#define pdqueue priority_queue< int,vi ,greater< int > >
//#define flush fflush(stdout)
#define primeDEN 727999983
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
#include <fstream>
// find_by_order()  // order_of_key
typedef tree<
	int,
	null_type,
	less<int>,
	rb_tree_tag,
	tree_order_statistics_node_update>
	ordered_set;
  ll aman(ll a,ll b,ll c)
  {
      ll r=a%c;ll a1;
       if(r==0)a1=a;else a1=a+c-r;
      r=b%c;
      ll b1=b-r;
      return ((b1-a1)/c +1);
  }
  ll gcd(ll c, ll d)
  {
      if(c==0)return d;
      return gcd(d%c,c);
  }



   int main()
{
  ll a,b,c,d;
    cin>>a>>b>>c>>d;
     ll ans=0;
      ll n1=aman(a,b,c);
      ll n2=aman(a,b,d);
      ll l=c*d/gcd(c,d);
      ll n3=aman(a,b,l);
      cout<<b-a+1-(n1+n2)+n3;


    return 0;
 }


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define FOR0(i,n) for(i=0;i<n;i++)
#define FOR(i,j,n) for(i=j;i<n;i++)
#define FORD(i,j,k) for(i=j;i>=k;i--)
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define inf 1000000000
#define ninf -1000000000
#define endl '\n' 
#define she_told_me_dont_worry ios_base::sync_with_stdio (false) ; cin.tie(0) ; cout.tie(0) ;
#define MOD 1000000007
// Use cout.flush() for interactive problems.
inline long long  MAX2(long long  a, long long int b){return (a)>(b)?(a):(b);}
inline long long  MAX3(long long  a, long long  b,long long  c){return (a)>(b)?((a)>(c)?(a):(c)):((b)>(c)?(b):(c));}
inline long long  MIN2(long long  a, long long  b){return (a)<(b)?(a):(b);}
inline long long  MIN3(long long  a, long long b,long long c){return (a)<(b)?((a)<(c)?(a):(c)):((b)<(c)?(b):(c));}
using namespace std;
typedef long long ll;
typedef pair<int,int> ii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector< ii > vii;
ll d;
ll n;
string s;
ll dp[10005][105][2];
ll compute(ll i, ll cur, ll m)
{
    if(i==n)
    {
        if(cur==0) return 1;
        return 0;
    }
    if(dp[i][cur][m]!=-1) return dp[i][cur][m];
    ll ans = 0;
    ll j;
    ll b = s[i] - '0';
    if(m==0)
    {
        FOR0(j, 10)
        {
            ans += compute(i+1, (cur+j)%d, 0);
            ans %= MOD;
        }
    }
    else 
    {
        FOR0(j, b)
        {
            ans += compute(i+1, (cur+j)%d, 0);
            ans %= MOD;
        }
        ans += compute(i+1, (cur+b)%d, 1);
        ans %= MOD;
    }
    return dp[i][cur][m] = ans;
}
int main()
{
    she_told_me_dont_worry
    cin>>s;
    cin>>d;
    n = s.size();
    int i;
    ll sum = 0;
    FOR0(i, n)
    {
        sum += s[i] - '0';
    }
    memset(dp, -1, sizeof dp);
    ll ans = 0;
    ll b = s[0] - '0';
    FOR0(i, b)
    {
        ans += compute(1, (i)%d, 0);
        ans %= MOD;
    }
    ans += compute(1, b%d, 1)-1;
    ans %= MOD;
    cout<<ans;
    cerr <<endl<< "Time elapsed : " << clock() * 1000.0 / CLOCKS_PER_SEC << " ms" << '\n';
}

Measured memory_bytes: 17408
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;
using ll = long long;

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

  ll n,m,s; cin>>n>>m>>s;
  struct Train {
    ll s, c, d;
    Train(ll s,ll c,ll d):s(s),c(c),d(d){}
    bool operator>(const Train& x) const {return d>x.d;}
  };
  vector<Train> graph[n];
  for (int i = 0; i < m; i++) {
    ll u,v,a,b; cin>>u>>v>>a>>b; u--; v--;
    graph[u].emplace_back(v,a,b);
    graph[v].emplace_back(u,a,b);
  }
  for (int i = 0; i < n; i++) {
    int c,d; cin>>c>>d;
    graph[i].emplace_back(i,-c,d);
  }
  constexpr ll MAX = 200;
  constexpr ll INF = 1e18;
  vector<array<ll, MAX+1>> dp(n);
  for (auto& arr:dp) arr.fill(INF);
  dp[0][min(s,MAX)] = 0;
  priority_queue<Train, vector<Train>, greater<>> qs;
  qs.emplace(0,s,0);
  while (not qs.empty()) {
    auto [s,c,d] = qs.top(); qs.pop();
    if (d > dp[s][min(c,MAX)]) continue;
    for (auto t:graph[s]) {
      if (c-t.c<0) continue;
      if (d+t.d >= dp[t.s][min(c-t.c,MAX)]) continue;
      dp[t.s][min(c-t.c,MAX)] = d+t.d;
      qs.emplace(t.s, c-t.c, d+t.d);
    }
  }
  for (int i = 1; i < n; i++) {
    cout << *min_element(dp[i].begin(), dp[i].end()) << '\n';
  }

  return 0;
}


Measured memory_bytes: 3856
#include <iostream>

using namespace std;

int main()
{
    int num=0,n,p,w,y,g;
    char c;
    scanf("%d",&n);
    p=w=y=g=0;
    for (int i=0;i<n;i++)
        {
            cin>>c;
            if (c=='G') g=1;
            if (c=='W') w=1;
            if (c=='Y') y=1;
            if (c=='P') p=1;
        }
    if (g+w+y+p==3) printf("Three");
    if (g+w+y+p==4) printf("Four");
    return 0;
}


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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
#define REP(i, n) for(int i=0; i<n; i++)
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 MOD = 1e9+7;

int main(){
    ll A[3];
    bool ok = true;
    REP(i,3){
        ll a;
        cin >> a;
        A[i] = a;
        if(a % 2) ok = false;
    }

    if(!ok){
        cout << 0 << endl;
        return 0;
    }

    sort(A, A+3);

    ll X = A[1] - A[0];
    ll Y = A[2] - A[0];

    if(X == 0 && Y == 0){
        cout << -1 << endl;
        return 0;
    }


    ll cnt = 0;
    while(1){
        if(X % 2 == 0 && Y % 2 == 0) {
            X /= 2;
            Y /= 2;
            cnt++;
        }
        else{
            break;
        }
    }


    cout << cnt << endl;

    return 0;
}


Measured memory_bytes: 256
def recur(n, count):
    if n < 10:
        print(count)
        return
    part = []
    i = 10
    while i < n:
        part.append((n%i) * (n/i))
        i *= 10
    recur(max(part), count+1)


q = int(raw_input())
for i in range(q):
    n = int(raw_input())
    lst = []
    recur(n, 0)

Measured memory_bytes: 6440
#include<stdio.h>
#include<math.h>
#include<algorithm>
#include<queue>
#include<deque>
#include<stack>
#include<string>
#include<string.h>
#include<vector>
#include<set>
#include<map>
#include<bitset>
#include<stdlib.h>
#include<cassert>
#include<time.h>
#include<bitset>
using namespace std;
const long long mod=1000000007;
const long long inf=mod*mod;
const long long d2=(mod+1)/2;
const double EPS=1e-10;
const double INF=1e+10;
const double PI=acos(-1.0);
const int C_SIZE = 3121000;
long long fact[C_SIZE];
long long finv[C_SIZE];
long long inv[C_SIZE];
long long Comb(int a,int b){
 	if(a<b||b<0)return 0;
 	return fact[a]*finv[b]%mod*finv[a-b]%mod;
}
void init_C(int n){
	fact[0]=finv[0]=inv[1]=1;
	for(int i=2;i<n;i++){
		inv[i]=(mod-(mod/i)*inv[mod%i]%mod)%mod;
	}
	for(int i=1;i<n;i++){
		fact[i]=fact[i-1]*i%mod;
		finv[i]=finv[i-1]*inv[i]%mod;
	}
}
long long pw(long long a,long long b){
	long long ret=1;
	while(b){
		if(b%2)ret=ret*a%mod;
		a=a*a%mod;
		b/=2;
	}
	return ret;
}
int ABS(int a){return max(a,-a);}
long long ABS(long long a){return max(a,-a);}
double ABS(double a){return max(a,-a);}
// ここから編集しろ

int main(){
	int n,a,b;
	scanf("%d%d%d",&n,&a,&b);
	long long ret=1;
	ret+=min(n,a-1);
	n-=min(n,a-1);
	if(a+2<=b){
		ret+=(long long)(n/2)*(b-a);
		n%=2;
	}
	ret+=n;
	printf("%lld\n",ret);
}

Measured memory_bytes: 256
n=int(input())
v=list(map(int,input().split()))
a=[[0,i]for i in range(10**5+1)]
b=[[0,i]for i in range(10**5+1)]
for t in sorted(v[0::2]):a[t][0]+=1
for t in sorted(v[1::2]):b[t][0]+=1
c=sorted(a)[::-1]
d=sorted(b)[::-1]
print(n-c[0][0]-[max(c[1][0],d[1][0]),d[0][0]][c[0][1]!=d[0][1]])

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

void solve()
{
    string n;
    cin >> n;
    cout << "ABC" + n << endl;
}

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

Measured memory_bytes: 3540
#include <iostream> 
#include <cmath>
#include <string>
#include <algorithm>
#include <vector>

using namespace std;

int main() {
	int P , K ;
	cin >> P >> K;
	int count = 0;
	int outlets = 1;

	while(outlets < K) {
		outlets--;
		outlets += P;
		++count;
	}
	cout << count << " ";
}


Measured memory_bytes: 3624
#include<iostream>
using namespace std;
void Insert(int);
void Increase(int,int);
int Extract(void);
void maxHeapify(int i);
int H[1000000];
int n=0;
int main(){
  int key,n=0;
  char ch[10];

  while(1){
    cin>>ch;
    if(ch[0]=='i'){
      cin>>key;
      Insert(key);
    }
    else if(ch[0]=='e' && ch[1]=='x'){
      cout<<Extract()<<endl;
    }
    else{
      break;
    }
  }
  for(int i=0;i<n;++i){
    cout<< H[i]<<endl;
  }
  return 0;
}

void Insert(int key)
{
  n+=1;
  H[n]=-1;
  Increase(n,key);
}
void Increase(int i,int key)
{
  int tmp;
  H[i]=key;
  while(i>1 &&H[i/2]<H[i]){
    tmp=H[i];
    H[i]=H[i/2];
    H[i/2]=tmp;
    i=i/2;
  }
}

int Extract()
{
  int max=H[1];
  H[1]=H[n];
  n--;
  maxHeapify(1);
  return max;
}
void maxHeapify(int i)
{
  int r,l,largest,tmp;
  l=i*2;
  r=i*2+1;

  if(l<=n&& H[l]>H[i])largest=l;
  else largest=i;

  if(r<=n && H[r]>H[largest])largest=r;

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

Measured memory_bytes: 5068
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define int ll
#define REP(i, n) FOR(i, 0, n)
#define FOR(i, a, b) for (ll i = a; i < b; i++)
#define UM unordered_map
#define ALL(a) (a).begin(), (a).end()
typedef vector<ll> vi;
typedef vector<vector<ll>> vvi;
typedef pair<ll, ll> pii;
const long long INF = 1LL << 58;
struct Edge
{
    ll s, t, d;
};
typedef vector<vector<Edge>> Graph;
typedef vector<pii> vpii;
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()
{
    int N, X;
    cin >> N >> X;
    int bp[52][2];
    REP(i, 52)
    {
        bp[i][0] = 2;
        bp[i][1] = 1;
    }
    bp[0][0] = 0;
    bp[0][1] = 1;
    REP(i, 51)
    {
        bp[i + 1][0] += bp[i][0] * 2;
        bp[i + 1][1] += bp[i][1] * 2;
    }
    int ans = 0;
    for (int i = N; i >= 0; i--)
    {
        if (i == 0)
            ans++;
        else if (X == 1)
            break;
        else if (X < 1 + bp[i - 1][0] + bp[i - 1][1])
        {
            X -= 1;
        }
        else if (X == 1 + bp[i - 1][0] + bp[i - 1][1])
        {
            ans += bp[i - 1][1];
            break;
        }
        else if (X == 1 + bp[i - 1][0] + bp[i - 1][1] + 1)
        {
            ans += bp[i - 1][1] + 1;
            break;
        }
        else if (X < 1 + bp[i - 1][0] + bp[i - 1][1] + 1 + bp[i - 1][0] + bp[i - 1][1])
        {
            ans += bp[i - 1][1] + 1;
            X -= 1 + bp[i - 1][0] + bp[i - 1][1] + 1;
        }
        else
        {
            ans += bp[i][1];
            break;
        }
    }
    cout << ans << endl;
    //system("pause");
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
const long long mod = 1e9+7;
int main(void){
    long long n, a = 1, b = 1, c = 1;
    cin >> n;
    for(int i=0;i<n;i++){
        a *= 10;
        b *= 9;
        c *= 8;
        a %= mod;
        b %= mod;
        c %= mod;

    }
    cout << (a-b-b+c+mod + mod)%mod << endl;
}


Measured memory_bytes: 3192
#include<iostream>
#include<algorithm>
#include<functional>
#include<cmath>
#include<string>
#include<vector>
#include<stack>
#include<queue>
#include<map>
#include<set>
#include<deque>
using namespace std;
#define ll long long
const int mod = 1000000007;
const ll INF = 1000000000000000000;

ll A[100010], B[100010];
int main()
{
	int N;
	cin >> N;
	for (int i = 0; i < N + 1; i++) cin >> A[i];
	for (int i = 0; i < N; i++) cin >> B[i];
	ll ans = 0;
	for (int i = 0; i < N; i++) {
		ans += min(A[i], B[i]);
		B[i] = max(0ll, B[i] - A[i]);
		ans += min(A[i + 1], B[i]);
		A[i + 1] = max(0ll, A[i + 1] - B[i]);
	}
	cout << ans << endl;
}

Measured memory_bytes: 1792
$<.each{|line|
  n = line.to_i
  ret = 0
  10.times{|a|
    break if n < a
    if n == a
      ret+=1
      break
    end
    10.times{|b|
      break if n < a + b     
      if n == a + b 
        ret+=1
        break
      end
      10.times{|c|
        break if n < a + b + c
        if n == a + b + c 
          ret+=1
          break
        end
        10.times{|d|
          break if n < a + b + c + d
          if n == a + b + c + d
            ret+=1
            break
          end
        }
      }
    }
  }
  puts ret
}

Measured memory_bytes: 6104
#include <algorithm>
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(), (x).end()
#define ll long long
#define INF 1000000000000000000

int main() {
    int N;
    cin >> N;
    vector<ll> A(N);
    map<ll, ll> ma;
    rep(i, N) {
        cin >> A[i];
        ma[A[i]]++;
    }

    stack<ll> st;
    for (auto m : ma) {
        ll num = m.second - 1;
        rep(j, num) {
            if (st.empty())
                st.push(m.first);
            else
                st.pop();
        }
    }

    set<ll> cnt;
    while (!st.empty()) {
        cnt.insert(st.top());
        st.pop();
    }

    ll ans = (ll)ma.size() - (ll)cnt.size();
    cout << ans << endl;
}

Measured memory_bytes: 7296