akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
    string a,b;
    int siza,sizb,i,j;
    int l[3005][3005];
    char sym[3005][3005];
void ok()
{
    siza=a.size();
    sizb=b.size();
    for(i=0;i<siza;i++)
        {
            l[0][i]=0;
            sym[0][i]='e';
        }
    for(i=1;i<sizb;i++)
        {
            l[i][0]=0;
            sym[i][0]='e';
        }
    //0anbh siz 5 <siz 1->4
    for(i=1;i<sizb;i++)
    {
        for(j=1;j<siza;j++)
        {
            if(b[i]==a[j])
            {
                sym[i][j]='(';
                l[i][j]=l[i-1][j-1]+1;
            }
            else if(l[i-1][j]>=l[i][j-1])
            {
                l[i][j]=l[i-1][j];
                sym[i][j]='|';
            }
            else {
                 l[i][j]=l[i][j-1];
                sym[i][j]='-';
            }
        }
    }



    string res="K";
    int k=0,init=siza-1;
    for(i=sizb-1;i>0;i--)
    {
        for(j=init;j>0;j--)
        {
            if(sym[i][j]=='('){
                res=res+a[j];
                init=j-1;
                break;
            }
            else if(sym[i][j]=='|')
            {
                init=j;
                break;
            }
            else init=siza-1;
        }
    }
    int siz=res.size();
    for(i=siz-1;i>0;i--)
        cout<<res[i];
    cout<<endl;


}
int main()
{
//    while(1)
//    {


    cin>>a>>b;
    a="K"+a;
    b="K"+b;
    ok();
//    }
    return 0;
}


Measured memory_bytes: 44288
public class Main {


  private static void solve() {
    int n = ni();
    int a = ni();
    int b = ni();
    int x = Math.min(a, b);
    int y = Math.max(0, a + b - n);
    System.out.println(x + " " + y);
   }

  public static void main(String[] args) {
    new Thread(null, new Runnable() {
      @Override
      public void run() {
        long start = System.currentTimeMillis();
        String debug = args.length > 0 ? args[0] : null;
        if (debug != null) {
          try {
            is = java.nio.file.Files.newInputStream(java.nio.file.Paths.get(debug));
          } catch (Exception e) {
            throw new RuntimeException(e);
          }
        }
        reader = new java.io.BufferedReader(new java.io.InputStreamReader(is), 32768);
        solve();
        out.flush();
        tr((System.currentTimeMillis() - start) + "ms");
      }
    }, "", 64000000).start();
  }

  private static java.io.InputStream is = System.in;
  private static java.io.PrintWriter out = new java.io.PrintWriter(System.out);
  private static java.util.StringTokenizer tokenizer = null;
  private static java.io.BufferedReader reader;

  public static String next() {
    while (tokenizer == null || !tokenizer.hasMoreTokens()) {
      try {
        tokenizer = new java.util.StringTokenizer(reader.readLine());
      } catch (Exception e) {
        throw new RuntimeException(e);
      }
    }
    return tokenizer.nextToken();
  }

  private static double nd() {
    return Double.parseDouble(next());
  }

  private static long nl() {
    return Long.parseLong(next());
  }

  private static int[] na(int n) {
    int[] a = new int[n];
    for (int i = 0; i < n; i++)
      a[i] = ni();
    return a;
  }

  private static char[] ns() {
    return next().toCharArray();
  }

  private static long[] nal(int n) {
    long[] a = new long[n];
    for (int i = 0; i < n; i++)
      a[i] = nl();
    return a;
  }

  private static int[][] ntable(int n, int m) {
    int[][] table = new int[n][m];
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < m; j++) {
        table[i][j] = ni();
      }
    }
    return table;
  }

  private static int[][] nlist(int n, int m) {
    int[][] table = new int[m][n];
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < m; j++) {
        table[j][i] = ni();
      }
    }
    return table;
  }

  private static int ni() {
    return Integer.parseInt(next());
  }

  private static void tr(Object... o) {
    if (is != System.in)
      System.out.println(java.util.Arrays.deepToString(o));
  }
}


Measured memory_bytes: 24660
#include <iostream>
#include <iomanip>
#include <cstdlib>
#include <cmath>
#include <map>
#include <string.h>
#include <algorithm>
#include <bits/stdc++.h>
#include <vector>

using namespace std;
#define set_precision cout << fixed << setprecision(10)
#define rep(i, a, b) for (int i = a; i < b; i++)
#define repb(i, a, b) for (int i = a; i >= b; i--)
#define vi vector<int>
#define vl vector<long long int>
#define Vi vector<vector<int>>
#define vpi vector<pair<int,int>>
#define seti set<int>
#define setl set<ll>
#define dseti set<int, greater<int>>
#define dsetl set<ll, greater<ll>>
#define mseti multiset<int>
#define msetl multiset<ll>
#define dmseti multiset<int, greater<int>>
#define dmsetl multiset<ll, greater<ll>>
#define sortA(arr) sort(arr.begin(), arr.end())
#define dsortA(arr) sort(arr.begin(), arr.end(), greater<ll>())
#define ssort(arr) stable_sort(arr.begin(), arr.end())
#define nth(v,n) nth_element(v.begin,v.begin+n-1,v.end())
#define dnth(v,n) nth_element(v.begin,v.begin+n-1,v.end(), greater<ll>())
#define init(a)  memset((a),0,sizeof(a))
#define pi pair<int,int>
#define pb push_back
#define pl pair<ll,ll>
#define ll long long
#define FIO ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define mod 1000000007
long double EPS = 1e-9;

/*struct comp {
  bool operator() (const int& lhs, const int& rhs) const
  {return lhs<rhs;}
};*/

ll cel(ll a,ll b){return((a-1)/b+1);} 
ll gcd(ll a, ll b){
    if (a < b)swap(a, b);
    return (b == 0)? a: gcd(b, a % b);
}
ll lcm(ll a,ll b){return (a*b)/gcd(a,b);}
ll po(ll x,ll y){
    ll ans=1;
    while(y){
        if(y&1){ans=(ans*x)%mod;}
        y>>=1;x=(x*x)%mod;
    }
    return ans;
}

int main()
{
    FIO;
    ll n,t=0,x,y,a;
    cin>>n;
    cin>>x;y=0;
    rep(i,0,n-1){cin>>a;y+=(max(t,x-a));x=max(x,a);}
    cout<<y;
    return 0;
}

Measured memory_bytes: 3636
#include<bits/stdc++.h>
#define ll long long
using namespace std;

int main()
{
    int a,b,t,bs=0;
    cin>>a>>b>>t;
    for(int i=1;i<=t;i++)
    {
        if(i%a==0)
            bs+=b;
    }
    cout<<bs<<endl;

}


Measured memory_bytes: 256
# -*- coding: utf-8 -*-

import fractions
def min_kou(a):
  ans = a[0]
  for i in range(1, len(a)):
    ans = ans * a[i] // fractions.gcd(ans, a[i])
  return ans

def main():
  N = int(input())
  A = list(map(int, input().split()))
  min_res = min_kou(A)
  ans = 0
  for i in A:
    ans += min_res // i
  print(ans % 1000000007)
  
if __name__ == '__main__':
  main()

Measured memory_bytes: 6108
import java.util.Scanner;

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

	String str = in.next();

	for(int cnt = 0; cnt < str.length(); cnt++){
		if(cnt % 2 != 1){
			char t = str.charAt(cnt);
			System.out.print(t);
		}
	}


}
}

Measured memory_bytes: 31316
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
using namespace std;
#define INF 0x3f3f3f3f
#define pb push_back
#define mk make_pair
#define ll long long 

int n,m;

int main()
{
	string a;
	cin >> a;
	n=0;
	for(int i=0;i<a.size();i++)
	{
		if(a[i]=='1')
			n++;
	}
	printf("%d\n",n);
	

	return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;
import java.util.StringTokenizer;

public class Main {
    public static void main(String[] args){
        Scanner scan=new Scanner(System.in);
       Ball b=new Ball(scan.next(),scan.next(),scan.nextInt(),scan.nextInt());
       Ball.decrement(b,scan.next());
       System.out.print(Ball.sn+" "+Ball.tn);

    }
}
class Ball{
    public static int sn;
    public static int tn;
    public static String s;
    public static String t;
    public Ball(String s,String t,int sn,int tn){
        this.sn=sn;
        this.tn=tn;
        this.s=s;
        this.t=t;
    }
    public static void decrement(Ball b,String u){
        if (u.equals(s)){
            sn-=1;
        }else {
            tn-=1;
        }

    }

}

Measured memory_bytes: 21716
//   _/                _/                 _/_/_/   _/
//_/_/_/_/   _/_/   _/_/_/_/   _/_/    _/       _/_/
// _/     _/    _/   _/     _/    _/  _/_/_/     _/
//_/     _/    _/   _/     _/    _/  _/    _/   _/
// _/_/   _/_/       _/_/   _/_/      _/_/     _/
#include<iostream>
#include<algorithm>
#include<cmath>
#include<iomanip>
#include<set>
#include<map>
#include<queue>
#include<vector>
using namespace std;
typedef long long ll;
const int MOD=1e9+7;
const double pi=3.14159265358979323846;
const int inf=2e9;
const ll INF=9e18;
typedef pair<ll,ll> P;
int main() {
  cin.tie(0),cout.tie(0);
  ios::sync_with_stdio(false);
  int n,a[100005][3]={},dp[100005][3]={},ans=0;
  cin >> n;
  for(int i=0; i<n; i++) {
    for(int j=0; j<3; j++) {
      cin >> a[i][j];
    }
  }
  for(int i=0; i<3; i++) {
    dp[0][i]=a[0][i];
  }
  for(int i=1; i<n; i++) {
    for(int j=0; j<3; j++) {
      dp[i][j]=max(dp[i-1][(j+1)%3]+a[i][j],dp[i-1][(j+2)%3]+a[i][j]);
    }
  }
  for(int i=0; i<3; i++) {
    ans=max(dp[n-1][i],ans);
  }
  cout << ans << endl;
}

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

static const int MAX=200000;

int main(){
    int R[MAX],n;
    cin >> n;
    for(int i=0;i<n;i++) cin >> R[i];
    
    int maxv=-2000000000;
    int minv=R[0];
    
    for(int i=1;i<n;i++){
        maxv=max(maxv,R[i]-minv);
        minv=min(minv,R[i]);
    }
    
    cout << maxv << endl;
    
    return 0;
}


Measured memory_bytes: 3892
N = int(input())
a = [int(input()) for _ in range(N)]
lam = [0] * N
ram = [0] * N
lam[0] = a[0]
ram[N - 1] = a[N - 1]
for i in range(1, N):
  lam[i] = max(lam[i - 1], a[i])
  ram[N - 1 - i] = max(ram[N - 1 - i + 1], a[N - 1 - i])
print(ram[1])
for i in range(1, N - 1):
  print(max(lam[i - 1], ram[i + 1]))
print(lam[N - 2])


Measured memory_bytes: 15656
#include <iostream>
#include <algorithm>
#include <cstring>
#include <cstdio>
#include <string>
using namespace std;

int main () 
{
	int n,m;
	int i,j;
	cin>>n>>m;
	string a[100];
	for(i=0;i<n;i++)
	{
		cin>>a[i];
	}
	sort(a,a+n);
	for(i=0;i<n;i++)
	{
		cout<<a[i];
	}
	cout<<endl;
//	cout<<"The following order should be used: ";
//	for(i=0;i<n;i++)
//	{
//		cout<<a[i];
//		if(i!=n-1)
//		cout<<",";
//		else
//		cout<<"."<<endl;
//	}
	return 0;
}

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

int main()
{
  int N;
  string S;
  cin >> N >> S;
  int64_t r = 0, g = 0, b = 0;
  for (int i = 0; i < S.size(); i++)
  {
    if (S.at(i) == 'R')
    {
      r++;
    }
    if (S.at(i) == 'G')
    {
      g++;
    }
    if (S.at(i) == 'B')
    {
      b++;
    }
  }
  int64_t ans = r * g * b;
  for (int i = 0; i < N - 2; i++)
  {
    for (int j = i + 1; j < N - 1; j++)
    {
      int k = 2 * j - i;
      if (S.at(i) == S.at(j))
      {
        continue;
      }
      if (k < N && (S.at(j) != S.at(k) && S.at(k) != S.at(i)))
      {
        ans--;
      }
    }
  }
  cout << ans << endl;
}


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

typedef long long ll;
typedef vector<ll> vint;
typedef vector< vector<ll> > vvint;

#define rep(i,n) for(ll i=0;i<n;i++)
#define repf(i,f,n) for(ll i=f;i<n;i++)
#define repr(i,n) for(ll i=n-1;i>=0;i--)
#define mp make_pair
#define mt make_tuple
#define ALL(obj) (obj).begin(), (obj).end()
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; }

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


int main() {
    cout<<fixed<<setprecision(10);

    ll n; cin>>n;
    n--;
    string ans = "";

    vector<ll> vec;

    while(n >= 0){
        ll m = n % 26;
        // ans += ('a'+m);
        vec.push_back(m);
        n = n/26 - 1;
    }


    reverse(ALL(vec));

    for(auto e:vec) cout<<(char)('a'+e);cout<<endl;
    // cout<<ans<<endl;



    return 0;

}

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

fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char) 
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}


fn main() {
    let n: usize = read();
    let s: String = read();
    let v: Vec<char> = s.chars().collect();
    let mut r: u32 = 0;
    let mut g: u32 = 0;
    let mut b: u32 = 0;
    for i in 0..n {
        if v[i] == 'R' {
            r += 1;
        } else if v[i] == 'G' {
            g += 1;
        } else {
            b += 1;
        }
    }
    let all: u32 = r * g * b;
    let mut sub: u32 = 0;
    for i in 0..n {
        for j in i+1..n {
            if v[i] == v[j] { continue; }
            let k = j + (j - i);
            if k >= n || v[k] == v[i] || v[k] == v[j] {
                continue;
            }
            sub += 1;
        }
    }
    println!("{}", all - sub);
}


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

using namespace std;
int main(){

	int n, mi;
	int max=0;
	int sum=0;
	vector<int> p;

	cin>> n;

	p.resize(n);

	for(int i=0;i<n;i++){
		cin>> p[i];
		sum+=p[i];
		if(max<p[i]){
			max=p[i];
			mi=i;
		}
	}

	sum-=p[mi]/2;

	cout<< sum << "\n";

}

Measured memory_bytes: 256
macro_rules! get {
    ($t:ty) => {
        {
            let mut line: String = String::new();
            std::io::stdin().read_line(&mut line).unwrap();
            line.trim().parse::<$t>().unwrap()
        }
    };
    ($($t:ty),*) => {
        {
            let mut line: String = String::new();
            std::io::stdin().read_line(&mut line).unwrap();
            let mut iter = line.split_whitespace();
            (
                $(iter.next().unwrap().parse::<$t>().unwrap(),)*
            )
        }
    };
    ($t:ty; $n:expr) => {
        (0..$n).map(|_|
            get!($t)
        ).collect::<Vec<_>>()
    };
    ($($t:ty),*; $n:expr) => {
        (0..$n).map(|_|
            get!($($t),*)
        ).collect::<Vec<_>>()
    };
}

fn main() {
    let mut s = get!(String).chars().collect::<Vec<_>>();
    let s_len = s.len();
    let t = get!(String).chars().collect::<Vec<_>>();
    let t_len = t.len();

    for i in (0..s_len-t_len+1).rev() {
        let mut ok = true;
        for j in 0..t_len {
            if s[i+j] != '?' && s[i+j] != t[j] {
                ok = false;
                break;
            }
        }
        if ok {
            for j in 0..t_len {
                s[i+j] = t[j];
            }
            for k in 0..s_len {
                if s[k] == '?' {
                    s[k] = 'a';
                }
            }
            println!("{}", s.into_iter().collect::<String>());
            return;
        }
    }
    println!("UNRESTORABLE");
}

Measured memory_bytes: 2108
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
int main(void){
    int k;
    cin >> k;
    int x = 7;
    for(int i=1;i<=1e6+10;i++){
        x %= k;
        if(x%k == 0){
            cout << i << endl;
            return 0;
        }
        x = (x*10+7);
    }
    cout << -1 << endl;
}


Measured memory_bytes: 3192
#include <bits/stdc++.h>
using namespace std;
int main(){
  int a,b,c,d; cin>>a>>b>>c>>d;
  if(abs(a-c)<=d){
    cout<<"Yes"<<endl;
  }
  else if(abs(a-b)<=d&&abs(b-c)<=d){
    cout<<"Yes"<<endl;
  }else{
    cout<<"No"<<endl;
  }
  return 0;
}

Measured memory_bytes: 256
import java.util.*;

class Main{
  static class Team implements Comparable<Team> {
    public int id;
    public int pt;
    public Team(int id, int pt) {
      this.id = id;
      this.pt = pt;
    }
    public int compareTo( Team o ) {
      return o.pt-pt;
    }
  }
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    List<Team> list = new ArrayList<Team>();
    while(true) {
      String str = sc.next();
      String[] strArr = str.split(",");
      int id = Integer.parseInt(strArr[0]);
      int pt = Integer.parseInt(strArr[1]);
      if (id == 0 && pt == 0){
        break;
      }
      list.add(new Team(id,pt));
    }
    Collections.sort(list);
    while (sc.hasNext()){
      int id = sc.nextInt();
      int rank = 0;
      int temp = -1;
      for (int i = 0; i < list.size(); i++) {
        Team team = list.get(i);
        if (temp != team.pt) {
          rank++;
          temp = team.pt;
        }
        if (id == team.id) {
          System.out.println(rank);
        }
      }
    }
  }
}

Measured memory_bytes: 12000
#include <bits/stdc++.h>
#define owo(i,a, b) for(int i=(a);i<(b); ++i)
#define uwu(i,a, b) for(int i=(a)-1; i>=(b); --i)
#define senpai push_back
#define ttgl pair<int, int>
#define ayaya cout<<"ayaya~"<<endl
 
using namespace std;
/*#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
gpu_hash_map<int, int> mp;*/
using ll = long long;
using ld = long double;
const ll MOD = 1000000007;
const ll root = 62;
int gcd(int a,int b){return b?gcd(b,a%b):a;}
ll binpow(ll a,ll b){ll res=1;while(b){if(b&1)res=(res*a)%MOD;a=(a*a)%MOD;b>>=1;}return res;}
ll modInv(ll a){return binpow(a, MOD-2);}
const double PI = acos(-1);
const double eps = -1e6;
const int INF = 0x3f3f3f3f;
const int NINF = 0xc0c0c0c0;
const ll INFLL = 0x3f3f3f3f3f3f3f3f;
const ll NINFLL = 0xc0c0c0c0c0c0c0c0;
const int mxN = 1001;
ll arr[mxN];
ll b[mxN];
int cnt[mxN*mxN];
ll n, m;
int main() {
    //freopen("file.in", "r", stdin);
    //freopen("file.out", "w", stdout);
    mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
    cin.tie(0)->sync_with_stdio(0);
    cin>>n>>m;
    owo(i, 0, n) {
        cin>>arr[i];
        cnt[arr[i]]++;
        if(cnt[arr[i]]>1) {
            cout<<"0\n";
            exit(0);
        }
    }
    memset(cnt, 0, sizeof(cnt));
    owo(i, 0, m) {
        cin>>b[i];
        cnt[b[i]]++;
        if(cnt[b[i]]>1) {
            cout<<"0\n";
            exit(0);
        }
    }
    ll ans = 1;
    sort(arr, arr+n);
    sort(b, b+m);
    reverse(arr, arr+n);
    reverse(b, b+m);
    ll aidx = 0;
    ll bidx = 0;
    for(ll nxt=n*m; nxt>0; --nxt) {
        while(aidx<n&&arr[aidx]>=nxt)aidx++;
        while(bidx<m&&b[bidx]>=nxt)bidx++;
        if(arr[aidx-1]==nxt&&b[bidx-1]==nxt) {
            ans = (ans*1LL)%MOD;
        }else if(arr[aidx-1]==nxt) {
            ans = (ans * bidx)%MOD;
        }else if(b[bidx-1]==nxt) {
            ans = (ans * aidx)%MOD;
        }else {
            ans = (ans * max((aidx * bidx - n * m + nxt), 0LL))%MOD;
        }
    }
    cout<<ans<<"\n";
    return 0;
}

Measured memory_bytes: 7436
#include<iostream>
#include<algorithm>
#include <cstdlib>
using namespace std;
int main() {
	int H, W, ans, dist1, dist2;
	cin >> H >> W;
	// 同じ方向に3等分
	ans = H%3?W:0;
	ans = min(W%3?H:0, ans);
	// 違う方法にそれぞれ切る
	// まず縦に切る
	dist1 = (H - H%3) / 3; // 縦幅がやや小さいとき
	dist2 = (W - W%2) / 2; // 次に切った横幅のうち小さい側
	ans = min(max(max(abs(dist1*W-dist2*(H-dist1)),abs(dist1*W-(dist2+W%2)*(H-dist1))),(H-dist1)*(W%2)),ans);
	dist1 = (H - H%3) / 3 + 1; // 縦幅がやや大きいとき
	ans = min(max(max(abs(dist1*W-dist2*(H-dist1)),abs(dist1*W-(dist2+W%2)*(H-dist1))),(H-dist1)*(W%2)),ans);
	// まず横に切る
	dist1 = (W - W%3) / 3; // 横幅がやや小さいとき
	dist2 = (H - H%2) / 2; // 次に切った縦幅のうち小さい側
	ans = min(max(max(abs(dist1*H-dist2*(W-dist1)),abs(dist1*H-(dist2+W%2)*(W-dist1))),(W-dist1)*(H%2)),ans);
	dist1 = (W - W%3) / 3 + 1; // 横幅がやや大きいとき
	ans = min(max(max(abs(dist1*H-dist2*(W-dist1)),abs(dist1*H-(dist2+W%2)*(W-dist1))),(W-dist1)*(H%2)),ans);
	cout << ans;
	return 0;
}

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

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; }

int main(){
	int n[32];
  	n[0]=1,n[1]=1,n[2]=1,n[3]=2,n[4]=1,n[5]=2,n[6]=1,n[7]=5,n[8]=2,n[9]=2;
  	n[10]=1,n[11]=5,n[12]=1,n[13]=2,n[14]=1,n[15]=14,n[16]=1,n[17]=5,n[18]=1,n[19]=5;
  	n[20]=2,n[21]=2,n[22]=1,n[23]=15,n[24]=2,n[25]=2,n[26]=5,n[27]=4,n[28]=1,n[29]=4;
 	n[30]=1,n[31]=51;
  //1, 1, 1, 2, 1, 2, 1, 5, 2, 2,
  //1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 
  //2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 
  //1, 51
  	int K;
  	cin >> K;
  	int s;
  	s = n[K -1];
  	cout << s << endl;

}


Measured memory_bytes: 256
#include <stdio.h>

int main(void){
	int S = 0, T = 0;
	int i, sc;
	for(i = 0; i < 4; i++){
		scanf("%d", &sc);
		S += sc;
	}
	
	for(i = 0; i < 4; i++){
		scanf("%d", &sc);
		T += sc;
	}

	if(T > S){
		printf("%d\n", T);
	}else{
		printf("%d\n", S);
	}

	return 0;
}

Measured memory_bytes: 592
#include <iostream>
#include <vector>
#define rep(i, a, b) for(int i = (a); i < (b); i++)
using namespace std;

int main() {
  int n, d, x, c = 0;
  cin >> n >> d >> x;
  vector<int> v(n);
  rep(i, 0, n) {
    cin >> v[i];
  }
  rep(i, 0, n) {
    rep(j, 0, d) {
      if(v[i]*j < d) {
        c++;
      } else {
        break;
      }
    }
  }
  cout << c + x << " ";
}

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

const ll INF = 1LL << 60;
const ll MOD = 1e9 + 7;

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

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

    ll sum = 0;
    for (ll i = 0; i < n; i++){
        sum += a[i];
    }

    ll x = (sum - a[n-1]);
    ll y = a[n-1];
    ll ans = abs(x-y);

    for (ll i = n-2; i > 0; i--){
        x -= a[i];
        y += a[i];
        ans = min(ans, abs(x-y));
    }

    cout << ans << endl;

}

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

void solve(long long N, std::vector<long long> B){
  long long acc = B[0];

  REP(i, N-2){
    long long x = min(B[i], B[i+1]);
    acc += x;
  }

  cout << (acc+B[N-2]) << endl;
}

// Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
int main(){
    long long N;
  scanf("%lld",&N);
  std::vector<long long> B(N-1);
  for(int i = 0 ; i < N-1 ; i++){
    scanf("%lld",&B[i]);
  }
    solve(N, std::move(B));
    return 0;
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
const int INF = (1<<30);
const ll INFLL = (1ll<<60);
const ll MOD = (ll)(1e9+7);

#define l_ength size

void mul_mod(ll& a, ll b){
	a *= b;
	a %= MOD;
}

void add_mod(ll& a, ll b){
	a = (a<MOD)?a:(a-MOD);
	b = (b<MOD)?b:(b-MOD);
	a += b;
	a = (a<MOD)?a:(a-MOD);
}

ll memo[2020][2020];
bool done[2020][2020];

ll c(int n, int k){
	if(k<0 || n<0 || n<k){
		return 0ll;
	}
	if(done[n][k]){
		return memo[n][k];
	}
	done[n][k] = true;
	if(k==0 || k==n){
		return memo[n][k] = 1ll;
	}
	memo[n][k] = (c(n-1,k-1)+c(n-1,k))%MOD;
	return memo[n][k];
}

int main(void){
	int n,k,i;
	ll ans;
	cin >> n >> k;
	for(i=1; i<=k; ++i){
		ans = c(n-k+1,i);
		mul_mod(ans,c(k-1,i-1));
		cout << ans << endl;
	}
	return 0;
}


Measured memory_bytes: 35840
#include <bits/stdc++.h>
using namespace std;
 
struct Treenode
{
	bool left = false;
	bool right = false;
	pair<Treenode*, Treenode*> child;
	int num = INT_MAX / 6;
};
 
Treenode* saiki( string S ) {
	//cout << S << endl;
	int num = 0;
	int xx = 0;
	int parentnum = 0;
	int s = -1;
	int count = 0;
	Treenode *reta = new Treenode;
	for( size_t i = 0; i < S.length(); i++ ) {
		if( S[i] == '(' ) {
			num++;
			if( s == -1 ) {
				s = i;
			}
		} else if( S[i] == ')' ) {
			num--;
			if( num == 0 ) {
				if( count == 0 ) {
					if( i - s > 1 ) {
						(*reta).child.first = saiki( S.substr( s + 1, i - s - 1 ) );
						if( (*(*reta).child.first).num != INT_MAX / 6 ) {
							(*reta).left = true;
						}
					}
					count++;
				} else {
					if( i - s > 1 ) {
						(*reta).child.second = saiki( S.substr( s + 1, i - s - 1 ) );
						if( (*(*reta).child.second).num != INT_MAX / 6 ) {
							(*reta).right = true;
						}
					}
				}
				s = -1;
			}
		} else if( S[i] == '[' ) {
			xx = 0;
		} else if( S[i] == ']' ) {
			if( num == 0 ) {
				(*reta).num = xx;
			}
		} else {
			xx *= 10;
			xx += S[i] - '0';
		}
	}
	return reta;
}
 
Treenode* saiki2( Treenode* A, Treenode* B ) {
	Treenode* retc = new Treenode;
	(*retc).num = (*A).num + (*B).num;
 
	if( (*A).left && (*B).left ) {
		(*retc).left = true;
		(*retc).child.first = saiki2( (*A).child.first, (*B).child.first );
	}
	if( (*A).right && (*B).right ) {
		(*retc).right = true;
		(*retc).child.second = saiki2( (*A).child.second, (*B).child.second );
	}
	return retc;
 
}
 
string saiki3( Treenode* C ) {
	string ret = "";
	if( (*C).left ) {
		ret += '(' + saiki3( (*C).child.first ) + ')';
	} else {
		ret += "()";
	}
	ret += '[' + to_string( (*C).num ) + ']';
	if( (*C).right ) {
		ret += '(' + saiki3( (*C).child.second ) + ')';
	} else {
		ret += "()";
	}
	return ret;
 
}
 
int main() {
	string A, B;
	cin >> A >> B;
	Treenode* Atree = saiki( A );
	Treenode* Btree = saiki( B );
	Treenode* Ctree = saiki2( Atree, Btree );
	cout << saiki3( Ctree ) << endl;
}

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

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

    using psii = tuple<string, int, int>;

    vector<psii> Data(N);

    string fir;
    int sec;
    for(int i = 0; i < N; i++) {
        cin >> fir >> sec;
        Data.at(i) = make_tuple(fir, -1*sec, i+1);
    }

    sort(Data.begin(), Data.end());

    for(int i = 0; i < N; i++) {
        cout << get<2>(Data.at(i)) << endl;
    }
}


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

int main()
{
    int n,k;
    cin>>n>>k;
    string s;
    cin>>s;
    if(s[k-1]=='A'){s[k-1]='a';}
    else if(s[k-1]=='B'){s[k-1]='b';}
    else {s[k-1]='c';}
    cout<<s<<endl;
    return 0;
}


Measured memory_bytes: 256
package main

import (
	"fmt"
)

func main() {
	var n int
	fmt.Scan(&n)
	var sum, max int
	for i := 0; i < n; i++ {
		var a int
		fmt.Scan(&a)
		sum += a
		if max < a {
			max = a
		}
	}
	fmt.Println(sum - (max / 2))
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>

using namespace std;
using namespace __gnu_pbds;

template <class T> using Tree = tree<T, null_type, less<T>, rb_tree_tag,tree_order_statistics_node_update>;

typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> pll;
typedef pair<double, double> pdd;

#define all(x)                      (x).begin(),(x).end()
#define Sort(x)                     sort(all((x)))
#define X                           first
#define Y                           second
#define sep                         ' '
#define endl                        '\n'
#define SZ(x)                       ll(x.size())

ll poww(ll a, ll b, ll md) {
    return (!b ? 1 : (b & 1 ? a * poww(a * a % md, b / 2, md) % md : poww(a * a % md, b / 2, md) % md));
}

const ll MAXN = 2e4 + 10;
const ll LOG = 22;
const ll INF = 8e18;
const ll MOD = 1e9 + 7; // 998244353; // 1e9 + 9;

ll h , n , ans = INF , A[MAXN] , B[MAXN] , dp[MAXN];

int main() {
    ios::sync_with_stdio(false);cin.tie(0);cout.tie(0); 
    fill(dp , dp + MAXN , INF);
    cin >> h >> n;
    for(ll i = 1 ; i <= n ; i++)    cin >> A[i] >> B[i];
    
    dp[0] = 0;
    for(ll i = 1 ; i < MAXN ; i++){
        for(ll j = 1 ; j <= n ; j++){
            if(A[j] <= i)   dp[i] = min(dp[i] , dp[i - A[j]] + B[j]);
        }
    }
    for(ll i = h ; i < MAXN ; i++)  ans = min(ans , dp[i]);
    cout << ans << endl;

    return 0;
}
/*

*/


Measured memory_bytes: 512
import Control.Monad (replicateM)

main :: IO ()
main = do
    [n, a, b] <- getSeq
    ts        <- fmap read <$> replicateM n getLine
    print $ solve a b ts

solve :: Int -> Int -> [Int] -> Int
solve a b ts = length [()| t <- ts, t < a || b <= t]

getSeq  = map read . words <$> getLine



Measured memory_bytes: 1020
#include <bits/stdc++.h>
#pragma GCC optimize ("O2,unroll-loops")
//#pragma GCC optimize("no-stack-protector,fast-math")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")

using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<pii, int> piii;
typedef pair<ll, ll> pll;
#define debug(x) cerr<<#x<<'='<<(x)<<endl;
#define debugp(x) cerr<<#x<<"= {"<<(x.first)<<", "<<(x.second)<<"}"<<endl;
#define debug2(x, y) cerr<<"{"<<#x<<", "<<#y<<"} = {"<<(x)<<", "<<(y)<<"}"<<endl;
#define debugv(v) {cerr<<#v<<" : ";for (auto x:v) cerr<<x<<' ';cerr<<endl;}
#define all(x) x.begin(), x.end()
#define pb push_back
#define kill(x) return cout<<x<<'\n', 0;

const int inf=1000000010;
const ll INF=10000000000000010LL;
const int mod=1000000007;
const int MAXN=100010, LOG=20;

int n, m, k, u, v, x, y, t, a, b, ans=1;
int A[MAXN], B[MAXN], ted[MAXN], deg[MAXN];
int mark[MAXN], last[MAXN], dor[MAXN];
ll dp[MAXN];

int main(){
	ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
	//freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);
	cin>>n;
	for (int i=1; i<=n; i++) cin>>A[i], deg[A[i]]++;
	for (int i=1; i<=n; i++) if (!mark[i]){
		int v=i;
		while (mark[v]<=2){
			if (last[v]!=i) last[v]=i, mark[v]=1;
			else mark[v]++;
			if (mark[v]==2) dor[v]=1;
			v=A[v];
		}
	}
	for (int i=1; i<=n; i++) if (deg[i]>2 || (deg[i]==2 && !dor[i])) kill(0);
	for (int i=1; i<=n; i++) B[A[i]]^=i;
	
	memset(mark, 0, sizeof(mark));
	for (int i=1; i<=n; i++) if (dor[i] && !mark[i]){
		int v=i, bad=0;
		while (!mark[v]){
			mark[v]++;
			B[A[v]]^=v;
			v=A[v];
		}
		vector<int> vec;
		while (mark[v]<2){
			mark[v]++;
			int len=0, u=v;
			while (!dor[B[u]] && B[u]){
				u=B[u];
				len++;
			}
			if (len) bad=1;
			vec.pb(len);
			v=A[v];
		}
//		debugv(vec)
		if (!bad){
			ted[vec.size()]++;
			continue ;
		}
		int c0=0;
		while (vec.back()==0) c0++, vec.pop_back();
		for (int x:vec){
			if (x==0) c0++;
			else{
				if (x<=c0) ans=ans*2%mod;
				if (x-1>c0) kill(0)
				c0=0; 
			}
		}
	}
//	debug(ans)
	for (int i=1; i<=n; i++) if (ted[i]){
		ll z=1+(i>1 && i%2);
		dp[0]=1;
		dp[1]=z;
		for (int j=2; j<=ted[i]; j++) dp[j]=(dp[j-1]*z + (j-1ll)*i%mod*dp[j-2])%mod;
		ans=ans*dp[ted[i]]%mod;
	}
	cout<<ans<<"\n";
	
	return 0;
}

Measured memory_bytes: 6616
//
#include <vector>
#include <set>
#include <map>
#include <array>
#include <iostream>
#include <cstdio>
#include <cstdint>
#include <algorithm>
#include <numeric>
#include <bitset>
//
using ll = long long;
using namespace std;
#define rep(i,n) for(ll i=0;i<(n);++i)
inline void yes(bool cond) { cond ? puts("Yes") : puts("No"); }
template<typename Type> inline void chmin(Type& a, Type b) { if (a > b) a = b; }
template<typename Type> inline void chmax(Type& a, Type b) { if (a < b) a = b; }
template<typename Arr, typename Type> inline void fill(Arr& arr, Type v) { std::fill(arr.begin(), arr.end(), v); }
template<typename Type> inline void sort(Type& arr) { std::sort(arr.begin(), arr.end()); }
template<typename Type> inline Type nth(vector<Type>& arr, size_t pos) { std::nth_element(arr.begin(), arr.begin() + pos, arr.end()); return arr[pos]; }
constexpr double BIGP = 1000000007L;
constexpr double INF_I = std::numeric_limits<double>::max();
constexpr double INF_F = std::numeric_limits<float>::infinity();
constexpr double PI = 3.14159265358979323846L;
//
int main()
{
    cin.tie(0); ios::sync_with_stdio(false);
    string S;
    cin >> S;
    bool okay = true;
    rep(i, S.size())
    {
        if (i % 2 == 0)
        {
            if (S[i] != 'R' && S[i] != 'U' && S[i] != 'D')
            {
                okay = false;
            }
        }
        else
        {
            if (S[i] != 'L' && S[i] != 'U' && S[i] != 'D')
            {
                okay = false;
            }
        }
    }
    yes(okay);
    //
    return 0;
}

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

int main(){
    long long M,N;
    cin >> M >> N;
    if(M==1 && N == 1) cout << 1 << "\n";
    else if(M == 1 || N == 1) cout << max((long long)0,max(M,N)-2) <<"\n";
    else cout << (M - 2) * (N - 2) << "\n";
}


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

typedef struct {
    int s, f;
}Interval;
bool compare_f(const Interval &x, const Interval &y) {
    return x.f < y.f;
}

int main(int argc, const char * argv[]) {
    int N;
    int A, B;
    
    vector<Interval> J;
    cin >> N;
    for (int i = 0; i < N; i++) {
        cin >> A;
        cin >> B;
        Interval t;
        t.s = A;
        t.f = B;
        J.push_back(t);
    }
    
    vector<Interval> Ans;
    sort(J.begin(), J.end(), compare_f);
    int time = 0;
    for (int i = 0; i < J.size(); ++i) {
        time += J[i].s;
        if (time > J[i].f) {
            cout << "No" << endl;
            return 0;
        }
    }
    
    cout << "Yes" << endl;
    
    return 0;
}

Measured memory_bytes: 2420
#include<stdio.h>
int main()
{
    long long int n, a, b;
    scanf("%lld %lld %lld", &n, &a, &b);
    if(a>b || (n==1 && a!=b))
    {
        printf("0");
    }
    else
    {
        printf("%lld", (b-a)*(n-2)+1);
    }
    return 0;
}

Measured memory_bytes: 1708
import java.util.Scanner;
import java.util.Arrays;

public class Main {

    public static void main(String[] args) {
        new Main().solve();
    }

    void solve() {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] a = new int[n + 1];
        long c = 1;
        for (int i = 2; i <= n; i++) {
            int m = i;
            for (int j = 2; j <= i; j++) {
                while (m % j == 0) {
                    m /= j;
                    a[j]++;
                }
            }
        }
        for (int i = 2; i <= n; i++) {
            c = c * (a[i] + 1) % 1000000007;
        }
        System.out.println(c);
    }
}

Measured memory_bytes: 21972
#include <bits/stdc++.h>
using namespace std;
const int MAXN=200005;
const int MAXA=40;
const int INF=0x3f3f3f3f;
pair<int,int> shop[MAXN];
int dp[MAXN][MAXA];
int main()
{
    int n,T;
    scanf("%d%d",&n,&T);
    for(int i=1;i<=n;i++)
        scanf("%d%d",&shop[i].first,&shop[i].second);
    auto f=[](const pair<int,int> &p,int t){
        return 1LL*(p.first+1)*(t+1)+p.second;
    };
    auto cmp=[f](const pair<int,int> &x,const pair<int,int> &y){
        return f(y,f(x,0))<f(x,f(y,0));
    };
    sort(shop+1,shop+n+1,cmp);
    memset(dp,INF,sizeof(dp));
    int res=0,i;
    for(i=(dp[0][0]=0);i<n;i++)
    {
        if(shop[i+1].first==0)break;
        for(int j=0;j<MAXA;j++)
        {
            dp[i+1][j]=min(dp[i+1][j],dp[i][j]);
            if(j+1<MAXA)dp[i+1][j+1]=min(1LL*dp[i+1][j+1],f(shop[i+1],dp[i][j]));
        }
    }
    sort(shop+i+1,shop+n+1);
    for(int j=0;j<MAXA;j++)
    {
        if(dp[i][j]>T)continue;
        int now=j,cost=dp[i][j];
        for(int k=i+1;k<=n;k++)
            if(f(shop[k],cost)<=T)
                cost=f(shop[k],cost),now++;
        res=max(res,now);
    }
    return 0*printf("%d\n",res);
}

Measured memory_bytes: 33024
#include <math.h>
#include <stdlib.h>
#include <string.h>
#include <algorithm>
#include <array>
#include <iomanip>
#include <iostream>
#include <limits>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>

using namespace std;

#define rep(i, n) for (int i = 0; i < (n); i++)
#define loop(i, a, n) for (int i = a; i < (n); i++)
#define all(in) in.begin(), in.end()
const int INF = 1e9;
const int MOD = 1e9 + 7;
int main() {
    double T, X;
    cin >> T >> X;
    cout << setprecision(9) << T / X << endl;
    return 0;
}

Measured memory_bytes: 256
// 11:41
#include<bits/stdc++.h>
#define fast ios::sync_with_stdio(false);cin.tie(NULL)
using namespace std;
#define int long long
#define MOD 1000000007
typedef vector<int> vi;
typedef pair<int,int> pi;
#define inf 1e18
#define For(i,a,b) for (int i = a; i < b; i++)
#define Rep(i,a,b) for (int i = a; i <= b; i++)
#define ps(x,y) fixed << setprecision(y) << x 
#define pb push_back 
#define mp make_pair 

int sieve[10005];
vi primes;

int32_t main()
{
    fast;
    int n, ans = 1; cin >> n;
    for(int x = 2; x <= n; x++) {
        if(sieve[x]) continue;
        for(int u = 2*x; u <= n; u += x) {
            sieve[u] = x;
        }
    }

    Rep(i, 2, n) {
        int cnt = 0;
        if(sieve[i] == 0) {
            int exp = 1;
            while(pow(i, exp) <= n) {
                int x = pow(i, exp);
                cnt += (n/x);
                exp++;
            }
            ans *= (cnt+1);
            ans %= MOD;
        }
    }

    cout << ans;
   
    
    return 0;
}

Measured memory_bytes: 4008
#include<bits/stdc++.h>
#define ll long long
using namespace std;
int main()
{
    char a;
    cin>>a;
    if(a>='A'&&a<='Z')
    {
        cout<<"A"<<endl;
    }
    else
    {
        cout<<'a'<<endl;
    }
    return 0;
}

Measured memory_bytes: 3556
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)n;i++)
#define rep1(i,n) for(int i=1;i<=(int)n;i++)
#define sp(n) cout << fixed << setprecision(n)
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
typedef long long ll;
using namespace std;
const int mod = 1000000007;
long long modpow(long long a, long long n){
  long long r = 1;
  while (n) {
    r = r * ( (n%2)?a:1 ) %mod;
    a = a * a % mod;
    n >>= 1;
  }
  return r;
}
struct mint {
  ll x; // typedef long long ll;
  mint(ll x=0):x((x%mod+mod)%mod){}
  mint operator-() const { return mint(-x);}
  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 { return mint(*this) += a;}
  mint operator-(const mint a) const { return mint(*this) -= a;}
  mint operator*(const mint a) const { return mint(*this) *= 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 { return mint(*this) /= a;}
};
istream& operator>>(istream& is, mint& a) { return is >> a.x;}
ostream& operator<<(ostream& os, const mint& a) { return os << a.x;}

int main(void){
    ll n;cin>>n;
    vector<ll> a(n);
    map<ll,ll> mp;
    rep(i,n){
        cin>>a[i];
        ll x=a[i];
        for(int j=2;j<=sqrt(x);j++){
            ll buf=0;
            while(x%j==0){
                buf++;
                x/=j;
            }
            chmax(mp[j],buf);
        }
        if(x>1){
            chmax(mp[x],(ll)1);
        }
    }
    ll l=1;
    for(auto& p:mp){
        l*=modpow(p.first,p.second);
        l%=mod;
    }
    ll res=0;
    for(int i=0;i<n;i++){
        (res+=l*modpow(a[i],mod-2)%mod)%=mod;
    }
    cout<<res<<endl;
}

Measured memory_bytes: 4244
#include <iostream>
#include <vector>
#include <functional>
#include <algorithm>
#include <string>
#include <cmath>
#include <map>
#include <queue>
#include <set>

using namespace std;

set<pair<pair<int, int>, int>> m;

int A, B, C;

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

    int ans = 0;
    while (1)
    {
        if (A % 2 || B % 2 || C % 2)
        {
            break;
        }
        auto ABC = make_pair(make_pair(A, B), C);
        if (m.find(ABC) != m.end())
        {
            ans = -1;
            break;
        }
        ans++;
        m.insert(ABC);

        int a = B / 2 + C / 2;
        int b = A / 2 + C / 2;
        int c = B / 2 + A / 2;
        A = a;
        B = b;
        c = C;
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 504
#include<bits/stdc++.h>
#define int long long
using namespace std;
constexpr int mod=1e9+7;
int m,c[200000],d[200000];
signed main(){
    cin>>m;
    for(int i=0;i<m;i++)
        cin>>d[i]>>c[i];
    vector<int>a={d[0]};
    int ans=0,b;
    c[0]--;
    for(int i=0;i<m;){
        if(c[i]==0){
            i++;
            continue;
        }
        if(c[i]>=9){
            ans+=(d[i]+9)*(c[i]/9);
            c[i]-=c[i]/9*9;
            continue;
        }
        for(int j=0;j<c[i];j++)
            a.push_back(d[i]);
        i++;
        while(a.size()>=2){
            int tmp=a[0]+a[1];
            a.erase(a.begin());
            a.erase(a.begin());
            a.insert(a.begin(),tmp%10);
            if(tmp/10!=0)
                a.insert(a.begin(),tmp/10);
            ans++;
        }
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 3328
#include <cstdio>
int n;
char s[100005], t[100005];
int f(char p[]) {
	t[0]=p[0], t[1]=p[1];
	for(int i=2; i<=n; i++) {
		if(t[i-1]=='S' && s[i-1]=='o' || t[i-1]=='W' && s[i-1]=='x') t[i] = t[i-2];
		else t[i] = t[i-2]=='S' ? 'W':'S';
	}
	if(t[0]!=t[n]) return 0;
	if(t[0]=='S' && s[0]=='o' || t[0]=='W' && s[0]=='x') return t[1] == t[n-1];
	return t[1]!=t[n-1];
}

int main() {
	scanf("%d%s", &n, s);
	if(f("SS") || f("SW") || f("WS") || f("WW")) {
		for(int i=0; i<n; i++) putchar(t[i]);
		return 0;
	}
	puts("-1");
	return 0;
}

Measured memory_bytes: 512
#include<bits/stdc++.h>
using namespace std;
 
int main()
{
  int i, n, q, arr[100011], num_ap[100011] = {0};
  long sum = 0, ans[100011], q1, q2;
  scanf("%d", &n);
  for(i = 0 ; i < n ; i++)
  {
    scanf("%d", &arr[i]);
    num_ap[arr[i]]++;
    sum += arr[i];
  }
  scanf("%d", &q);
  for(i = 0 ; i < q ; i++)
  {
      scanf("%ld %ld", &q1, &q2);
      long nums = num_ap[q1];
      num_ap[q1] = 0;
      num_ap[q2] += nums;
      sum += (q2 * nums);
      sum -= (q1 * nums);
      ans[i] = sum;
  }
  for(i = 0 ; i < q ; i++)
      printf("%ld\n",ans[i]);
  return 0;
}

Measured memory_bytes: 5316
#include <iostream>
#include<math.h>
using namespace std;


int main() {
	long int a,b,c,min;
	cin>>a>>b>>c;
	if((a%2==0)||(b%2==0)||(c%2==0)){
		cout<<0;
		goto end;
	}
		if((a>=b)&&(a>=c)){
			cout<<b*c;
			goto end;
		}
		if((b>=a)&&(b>=c)){
			cout<<a*c;
			goto end;
	}
	cout<<a*b;
	end:
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <cmath>
#include <map>

int digit_sum(int n) {
	if (n < 10)  return n;
	return digit_sum(n / 10) + n % 10;
}

int main() {
	int N, A, B; std::cin >> N >> A >> B;
	long long ans = 0;
	for (int i = 1; i <= N; ++i) {
		int all = digit_sum(i);
		if (A <= all && all <= B) ans += i;
	}
	std::cout << ans << std::endl;

	return 0;
}

Measured memory_bytes: 3624
#include "bits/stdc++.h"

using namespace std;

int main()
{
    int a, b;

    cin >> a >> b;

    if (a == 1) a = 14;
    if (b == 1) b = 14;

    if (a > b)
    {
        cout << "Alice" << endl;
    }
    else if (b > a)
    {
        cout << "Bob" << endl;
    }
    else
    {
        cout << "Draw" << endl;
    }

    return 0;

}

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

using namespace std;

int main() {
	
	int n;
	int r;
	int l;
	while( cin >> n) {
	
		int cars;
		int a, b;
		
		r = 0;
		l = 0;
		
		cin >> cars;
		
		for(int i=0;i<n;i++){
			
		cin >> a >> b;
		cars += ( a - b );
		
		r = max(r, cars);
		l = min(l, cars);
		
	}
	if( l < 0)
	cout << "0\n";
	
	else
	cout << r << "\n";
}
	
	return 0;
}


Measured memory_bytes: 3048
#制約が小さいので全探索する
n,m=list(map(int,input().split()))
#辺があるかどうかが知りたい→隣接行列表現
es=[[0]*n for i in range(n)]
for i in range(m):
  a,b=list(map(int,input().split()))
  es[a-1][b-1]=1
  es[b-1][a-1]=1

#順列を作る
from itertools import permutations
per=[i+1 for i in range(n-1)]
per=list(permutations(per,n-1))

#全探索する
ans=0
for i in per:
  cnt=0
  if es[0][i[0]]==0:
    continue
  else:
    for j in range(1,n-1):
      if es[i[j]][i[j-1]]==0:
        cnt+=1
    if cnt==0:
      ans=ans+1
print(ans)



Measured memory_bytes: 71396
import java.util.Scanner;

class Main{
	public static void main(String[] args){

		Scanner sc = new Scanner(System.in);
		
		int S = sc.nextInt();
		int h,m,s;
		int x,y;

		h=S/3600;
		x=S%3600;
		m=x/60;
		y=x%60;
		s=y;

		System.out.println(h + ":" + m + ":" + s);
	}
}


Measured memory_bytes: 26220
import java.util.Scanner;

class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        boolean[][] cards = new boolean[4][13];
        char[] row = new char[] {'S','H','C','D'};
        for(int i=0; i<n; i++){
            String m = sc.next();
            int t = sc.nextInt();
            switch(m){
                case "S": cards[0][t-1] = true; break; 
                case "H": cards[1][t-1] = true; break;
                case "C": cards[2][t-1] = true; break;
                case "D": cards[3][t-1] = true; break;
            }
        }
        for(int i=0; i<4; i++){
            for(int j=0; j<13; j++){
                if(!cards[i][j]) System.out.println(row[i] +" "+ (j+1));
            }
        }
    }
}


Measured memory_bytes: 26316
#include <bits/stdc++.h> //C++の機能を「全て」読み込むための命令
#define rep(i,n) for(int i=0; i<(n); ++i)
#define cout(x) cout<<x<<endl
#define all(v) v.begin(), v.end()
using namespace std;
//型エイリアス
using vi = vector<int>;
using ll = long long;
using P = pair<int,int>;
using Mat = vector<vector<int>>;
const ll inf = 1e18;
const int N = 2e5+10;

int main(){
    int n,t,a;
    cin >> n >> t >> a;
    vi h(n);
    rep(i, n) cin >> h[i];

    double diff_min = 1e5;
    int ans = 0;
    rep(i,n){
        double temp = t - h[i]*0.006;
        double diff = fabs(temp - a);
        if(diff_min > diff){
            diff_min = diff;
            ans = i+1;
        }
    }
    cout(ans);
    return 0;
}

Measured memory_bytes: 256
import itertools
X = int(input())
price=[100,101,102,103,104,105]
num = int(X / 100)
state=False
for i in range(num,0,-1):
    for j in itertools.combinations_with_replacement(price, i):
        if sum(j) == X:
            print(1)
            state=True
            exit()
if state != True:
    print(0)

Measured memory_bytes: 3064
#include <iostream>
#include <cmath>
#include <vector>
#include <map>
#include <set>
#include <string>
#include <cstring>
#include <queue>
#include <ctime>
#include <cassert>
#include <cstdio>
#include <algorithm>
#include <unordered_set>
#include <unordered_map>
#include <bitset>
#include <random>

using namespace std;

#define F first
#define S second
#define mp make_pair
#define pb push_back
#define epr(...) fprintf(stderr, __VA_ARGS__)
#define db(x) cerr << #x << " = " << x << endl
#define db2(x, y) cerr << "(" << #x << ", " << #y << ") = (" << x << ", " << y << ")\n"; 
#define db3(x, y, z) cerr << "(" << #x << ", " << #y << ", " << #z << ") = (" << x << ", " << y << ", " << z << ")\n"
#define all(a) (a).begin(), (a).end()
#define sz(a) (int)a.size()
#define pw(n) (1ll << (n))

#define equal equalll
#define less lesss
const int N = 1e6 + 10;
const long long INF = 1e9 + 19;
typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> pi;


int n, c, k;
int t[N];


int main(){
#ifdef HOME 
    freopen("in", "r", stdin);
#endif
    scanf("%d%d%d", &n, &c, &k);
    for (int i = 0; i < n; i++) {
        scanf("%d", &t[i]);
    }
    sort(t, t + n); 
    int answer = 0;
    int prev = -INF;
    int sz = 0;
    //for (auto x: t) {
    for (int i = 0; i < n; i++) {
        int x = t[i];
        if (sz == c || prev + k < x) {
            sz = 1;
            prev = x;
            answer++;
        }
        else {
            sz++;
            assert(sz <= c);
        }
    }
    printf("%d\n", answer);


    return 0;
}



Measured memory_bytes: 640