akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define null NULL
#define mp make_pair
#define pb(a) push_back(a)
#define sz(a) ((int)(a).size())
#define all(a) a.begin() , a.end()
#define fi first
#define se second
#define relaxMin(a , b) (a) = min((a),(b))
#define relaxMax(a , b) (a) = max((a),(b))
#define SQR(a) ((a)*(a))
#define PI 3.14159265358979323846
typedef vector<int> vi;
typedef pair<int,int> pii;
typedef long long ll;

ll len[61];

int Eval(ll pos, int l){
  if(l == 0) return 1 << 0;
  if(pos < len[l - 1]) return Eval(pos, l - 1);
  if(pos == len[l - 1]) return 1 << l;
  return Eval(pos - len[l - 1] - 1, l - 1);
}

int Sg(ll pos){
  if(pos == 0) return 0;
  if(pos & 1) return 1;
  else return 2 * Eval(pos / 2 - 1, 60);
}

// Trie
const int MAXN = 200010;

struct Node {
  vector<pair<char, int>> go;

  int Next(char on){
    for(const auto& e : go)
      if(e.fi == on)
        return e.se;
    return -1;
  }
};

Node nodes[MAXN];
int root = 0, lst = 1;

void Add(const string& w){
  int pos = root;
  for(char c : w){
    if(nodes[pos].Next(c) == -1)
      nodes[pos].go.pb(mp(c, lst++));
    pos = nodes[pos].Next(c);
  }
}

int n;
ll l;
string wrd;

vector<ll> trees;

void Traverse(int vr, ll dpt){
  if(dpt >= l) return;

  if(nodes[vr].go.empty()) return;

  if(nodes[vr].Next('0') == -1) trees.pb(l - dpt - 1);
  else Traverse(nodes[vr].Next('0'), dpt + 1);

  if(nodes[vr].Next('1') == -1) trees.pb(l - dpt - 1);
  else Traverse(nodes[vr].Next('1'), dpt + 1);
}

/*
int Mex(vi on){
  sort(all(on));
  for(int i = 0;;++i)
    if(i >= sz(on) || on[i] != i)
      return i;
}
*/

int main(){
  ios_base::sync_with_stdio(false);

  len[0] = 1;
  for(int i = 1;i < 61;++i)
    len[i] = 2 * len[i - 1] + 1;

  /*
  int sg[1000];
  sg[0] = 0;

  for(int i = 1;i < 1000;++i){
    int x = 0;
    vi s = {0};
    for(int j = i - 1;j > 0;--j)
      s.pb(x ^= sg[j]);
    sg[i] = Mex(s);
  }
  */

  cin >> n >> l;
  for(int i = 0;i < n;++i){
    cin >> wrd;
    Add(wrd);
  }

  Traverse(root, 0);

  //for(int i = 0;i < sz(trees);++i)
  //  cout << trees[i] << " : " << Sg(trees[i]) << endl;

  int res = 0;
  for(ll e : trees) res ^= Sg(e + 1);

  if(!res) printf("Bob\n");
  else printf("Alice\n");

  return 0;
}


Measured memory_bytes: 14024
#include<iostream>
#include<iomanip>
#include<algorithm>
#include<array>
#include<bitset>
#include<cassert>
#include<cctype>
#include<cmath>
#include<cstdio>
#include<cstring>
#include<functional>
#include<limits>
#include<list>
#include<map>
#include<numeric>
#include<set>
#include<stack>
#include<string>
#include<sstream>
#include<unordered_map>
#include<queue>
#include<vector>
using namespace std;

using ll = long long;
using ull = unsigned long long;
using pii = pair<int, int>;

#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define RFOR(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define REP(i,n) for(int i=0;i<(n);i++)
#define RREP(i,n) for(int i=(n)-1;i>=0;i--)
#define ALL(a) (a).begin(),(a).end()
#define DUMP(o) {cerr<<#o<<" "<<o<<endl;}
#define DUMPC(o) {cerr<<#o; for(auto &e:(o))cerr<<" "<<e;cerr<<endl;}
#define INF 0x3f3f3f3f
#define INFL 0x3f3f3f3f3f3f3f3fLL
const int MOD = 1e9 + 7;

signed main() {
	int dp[4][4010] = {};
	REP(i, 1001)dp[0][i] = 1;
	REP(i, 3) {
		REP(j, 4010) {
			REP(k, 1001) {
				if (j + k < 4010)dp[i + 1][j + k] += dp[i][j];
			}
		}
	}
	for (int n; cin >> n;) {
		cout << dp[3][n] << endl;
	}
	return 0;
}

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

signed main(){
    int n, q; cin >> n >> q;
    queue<pair<string,int>> que;
    rep(i,n){
        string name; int time;
        cin >> name >> time;
        que.push(make_pair(name,time));
    }
    int now = 0;
    while (! que.empty()){
        pair<string,int> p = que.front();
        que.pop();
        if(p.second <= q){
            now += p.second;
            cout << p.first << " " << now << endl;
        }
        else {
            p.second -= q;
            now += q;
            que.push(p);
        }
        
    }
    return 0;
}


Measured memory_bytes: 6212
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define ll long long
#define pp pair<ll,ll>
#define ld long double
#define all(a) (a).begin(),(a).end()
#define mk make_pair
int inf=1000001000;
ll INF=1e18;
ll mod=1000000007;
ll MOD=INF;


int main() {
  ll ans=0;
  ll p=0;
  int n;
  cin >> n;
  vector<ll> a(n);
  rep(i,n) cin >> a[i];
  rep(i,n){
      if (a[i]<p) ans+=p-a[i];
      p=max(p,a[i]);
  }
  cout << ans << endl;
}


Measured memory_bytes: 4772
let () = Scanf.scanf "%d %d\n" @@ fun n m ->
  let as_ = Array.init n @@ fun _ -> Scanf.scanf "%d " @@ fun a -> a in
  let somme = Array.fold_left ( + ) 0 as_ in
  print_endline @@
  if m <= Array.fold_right (fun a -> ( + ) @@ if a * 4 * m < somme then 0 else 1) as_ 0
  then "Yes"
  else "No"

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

int main() {
  string s, t;
  cin >> s >> t;

  int d = stoi(s + t);
  // sqrt(100100)=316.38
  rep(i, 333) {
    if (i * i == d) {
      cout << "Yes" << endl;
      return 0;
    }
  }
  cout << "No" << endl;
  return 0;
}

Measured memory_bytes: 3616
#include <bits/stdc++.h>
#define syosu(x) fixed<<setprecision(x)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef pair<double,double> pdd;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<string> vs;
typedef vector<P> vp;
typedef vector<vp> vvp;
typedef vector<pll> vpll;
typedef pair<int,P> pip;
typedef vector<pip> vip;
const int inf=1<<30;
const ll INF=1ll<<60;
const double pi=acos(-1);
const double eps=1e-8;
const ll mod=1e9+7;
const int dx[4]={-1,0,1,0},dy[4]={0,-1,0,1};

int n,k;

int main(){
	cin>>n>>k;
	cout<<(k==1?0:n-k)<<endl;
}

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

signed main() {
    cin >> N;
    map<long, long> m;
    while (N--) {
        int a;
        cin >> a;
        m[a]++;
    }
    typedef pair<long, long> P;
    vector<P> l;
    for (auto p:m)l.emplace_back(p);
    for (int i = 0; i < l.size(); i++) {
        ans += l[i].second * (l[i].second - 1) * (l[i].second - 2) / 6;
        for (int j = 0; j < i; j++) {
            long c = l[j].second * l[i].second, d = l[i].first - l[j].first;
            if (l[j].first * 2 > l[i].first)ans += c * (l[j].second - 1) / 2;
            ans += c * (l[i].second - 1) / 2;
            for (int k = 0; k < j; k++) {
                if (l[k].first <= d)continue;
                else ans += c * l[k].second;
            }
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 384
#include <iostream>
#include <algorithm>
#include <functional>
#include <vector>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <string>
#include <numeric>
#include <cmath>
#include <bitset>

#define rep(i, n) for (int i = 0; i < n; i++)
using namespace std;
typedef long long ll;
using P = pair<ll, ll>;

template<class T> inline bool chmin(T& a,T b) {if (a > b) {a = b; return true;} return false;}
template<class T> inline bool chmax(T& a,T b) {if (a < b) {a = b; return true;} return false;}

const ll MOD = 1000000007;
const int INF = 1<<30;
//const ll INF = (ll)1e18 + 1;

int main(){
  long double A, B; cin >> A >> B;
  cout << ll(floor(A * B)) << endl;
}


Measured memory_bytes: 3732
mod=10**9+7

s=input()
n=len(s)

dp=[[0] * 2 for _ in range(100001)]

dp[0][0] =1

for i in range(n):
    if s[i] == '0':
        dp[i+1][0] = dp[i][0]
        dp[i+1][1] = dp[i][1]
    else:
        dp[i+1][1] = (dp[i][0] + dp[i][1]) % mod

    if s[i] == '0':
        dp[i+1][1] += dp[i][1]*2 % mod
    else:
        dp[i+1][0] += dp[i][0]*2 % mod
        dp[i+1][1] += dp[i][1]*2 % mod

print((dp[n][0]+dp[n][1]) % mod)

Measured memory_bytes: 19700
#include <cstdio>
#include <algorithm>
#include <complex>
using namespace std;

int main() {
  const complex<double> I(0,1);
  complex<double> d2(2,0);
  for(int tci = 0; ; tci++) {
    int n; scanf("%d", &n);
    if(!n) break;
    complex<double> *pts = new complex<double>[n];
    for(int i = 0; i < n; i++) {
      scanf("%lf%lf", &pts[i].real(), &pts[i].imag());
    }
    int maxcnt = 1;
    for(int i = 0; i < n; i++) {
      for(int j = 0; j < n; j++) {
        if(i==j) continue;
        complex<double> d = (pts[i] - pts[j]) / d2;
        double absd = abs(d);
        complex<double> k = d*I/absd * sqrt(1-absd*absd);
        complex<double> c = (pts[i] + pts[j]) / d2 + k;
        int cnt = 0;
        for(int k = 0; k < n; k++) {
          cnt += (abs(pts[k]-c) <= 1 + 1e-9);
        }
        maxcnt = max(maxcnt, cnt);
      }
    }
    delete[] pts;
    printf("%d\n", maxcnt);
  }
  return 0;
}

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

int gcd (int x, int y){
    if(y>x){
        swap (x,y);
    }
    if(x==0 || y==0){
        return max(x,y);
    }
    else {
        return gcd(x%y,y);
    }
}

int main(){
    int N;
    cin >> N;
    vector<int> A(N);
    for (int i=0; i<N; i++){
        cin >> A.at(i);
    }

    int ans = A.at(0);
    for(int i=0;i<N-1;i++){
        ans = gcd (ans, A.at(i+1));
    }

    cout << ans << endl;

}

Measured memory_bytes: 640
#include <bits/stdc++.h>
#define be(v) (v).begin(),(v).end()
#define pb(q) push_back(q)
typedef long long ll;
using namespace std;
const ll mod=1000000007, INF=(1LL<<60);
#define doublecout(a) cout<<fixed<<setprecision(10)<<a<<endl;

int main() {
    cin.tie(0);
    cout.tie(0);
    ios::sync_with_stdio(false);
    int n, m;
    cin >> n;
    m = 1;

    while(m <= n){
    	m *= 2;
    }
    m /= 2;
    cout << m << endl;
    return 0;
}


Measured memory_bytes: 256
#include<string.h>
#include <stdio.h>

int main(void){
    int i = 0,total = 0;
    char number[1000] = {0};
    
    while(1){
        scanf("%s",number);
        
        if(number[0] == '0') break;
        
        while(number[i] != '\0'){
            total += (number[i]-'0');
            i++;
        }
        printf("%d\n",total);
        total = 0;
        i = 0;
    }
}

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

int main(){
  int N;
  cin >> N;
  
  vector<int> A(N + 1, 0);
  for (int i = 1; i <= N; i++){
    cin >> A.at(i);
  }
  
  vector<int> ans(N + 1, 0);
  for (int i = 1; i <= N; i++){
    ans.at(A.at(i)) = i;
  }
  
  for (int i = 1; i <= N; i++){
    cout << ans.at(i) << ' ';
  }
  
  cout << endl;
}

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

const int INF=1001001001;
 int a[12][12];
int main(){
  int n,m,x;
  cin>>n>>m>>x;
  vector<int>c(n);
  for(int i=0;i<n;i++){
    cin>>c[i];
    for(int j=0;j<m;j++){
      cin>>a[i][j];
    }
  }
  int kotae=INF;
  for(int s=0;s<(1<<n);s++){
    int sum=0;
    vector<int> d(m,0);
    for(int i=0;i<n;i++){
      if(s>>i&1){
        sum+=c[i];
        for(int j=0;j<m;j++){
          d[j]+=a[i][j];
        }
      }
    }
    bool hantei=true;
    for(int j=0;j<m;j++){
      if(d[j]<x){
        hantei=false;
        break;
      }
    }
    if(hantei)kotae=min(kotae,sum);
  }
  if(kotae==INF){
    cout<<-1<<endl;
  }else{
    cout<<kotae<<endl;
  }
  return 0;
}

Measured memory_bytes: 3624
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using db = double;
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
#define all(v) (v).begin(), (v).end()
#define siz(v) (ll)(v).size()
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define repi(i, x, n) for (ll i = x; i < (ll)(n); i++)
#define lb lower_bound
#define ub upper_bound
typedef pair<ll, ll> P;
typedef pair<ll, ll> PL;
const ll mod = 1000000007;
const ll INF = 100000000000000099;
const ll LINF = (ll)(1e18 + 99);
vector<ll> dx = {-1, 1, 0, 0}, dy = {0, 0, -1, 1};
//cin.tie(0);ios::sync_with_stdio(false);

template<typename T>
vector<T> finddivisor(T x){//整数xの約数が入ったvectorを返すよ(xを含む)  
    vector<T> divisor;
    for(T i=1; (i*i)<=x ;i++)
    {
        if(x%i==0){
            divisor.pb(i);
            if(i*i!=x){
                divisor.pb(x/i);
            }//約数はペアを持つことを利用

        }
    }
    //divisor.push_back(x);
    return divisor;
}


signed main()
{
    ll a,b,ans=0;cin>>a>>b;
    vector<ll> ase=finddivisor(a);
    sort(all(ase));

    rep(i,siz(ase)){
        if(b%ase[i]!=0)continue;

        ans++;

        if(ase[i]==1)continue;

        repi(j,i+1,siz(ase)){
            if(ase[j]%ase[i]==0){
                ase.erase(ase.begin()+j);
                j--;
            }
        }
    }

    cout<<ans<<endl;

}

Measured memory_bytes: 384
#include <bits/stdc++.h>
#define ll long long int
#define pb push_back
#define mp make_pair
#define mod 1000000007
#define pi 3.141592653589793
const int N = 200001;
using namespace std;




int main() {
//    cout << fixed << setprecision(10);
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);

    
    string s;
    cin >> s;
    if (s[0] == '7' || s[1] == '7' || s[2] == '7') cout << "Yes";
    else cout << "No";



}


Measured memory_bytes: 3648
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		long[] a = new long[n];
		long sum = 0;
		for (int i = 0; i < a.length; i++) {
			a[i] = sc.nextLong();
			sum += a[i];
		}
		
		long min = Long.MAX_VALUE;
		long sum2 = 0;
		for (int i = 0; i < n - 1; i++) {
			sum2 += a[i];
			min = Math.min(min, Math.abs(sum - (2 * sum2)));
		}
		
		System.out.println(min);
		
		
	}
}




Measured memory_bytes: 87028
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 = read();
    let mut v: Vec<(i32, i32, i32)> =
        (0..n).map(|_| (read(), read(), read())).collect();
    v.insert(0, (0, 0, 0));
    let mut yes = true;
    for i in 0..v.len() - 1 {
        let (t, x, y) = v[i];
        let (nt, nx, ny) = v[i + 1];
        let time = nt - t;
        let dist = (nx - x).abs() + (ny - y).abs();
        if dist > time || time % 2 != dist % 2 {
            yes = false;
            break;
        }
    }
    println!("{}", if yes { "Yes" } else { "No" });
}


Measured memory_bytes: 6396
import java.util.*;

public class Main {

  public static void main(String[] args) {
    
     Scanner sc = new Scanner(System.in);
     int i = sc.nextInt();
  	 System.out.println((i + (i % 2 == 1 ? 1 : 0)) / 2d / i);
    
  }
  
}
  

Measured memory_bytes: 23124
//This code was made by Chinese_zjc_
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<string>
#define int long long
#define INF 0x3fffffffffffffff
using namespace std;
inline int rd(int &ddd)
{
	char tmp=getchar();
	int xxx=1;
	ddd=0;
	while(('0'>tmp||tmp>'9')&&tmp!='-'&&tmp!=EOF)
	{
		tmp=getchar();
	}
	if(tmp==EOF)
	{
		return EOF;
	}
	if(tmp=='-')
	{
		xxx=-1;
		tmp=getchar();
	}
	while('0'<=tmp&&tmp<='9')
	{
		ddd=(ddd<<3)+(ddd<<1)+(tmp^48);
		tmp=getchar();
	}
	return ddd*=xxx;
}
inline char rd(char &ddd)
{
	char tmp=getchar();
	while(tmp==' '||tmp=='\n')
	{
		tmp=getchar();
	}
	if(tmp==EOF)
	{
		return EOF;
	}
	return ddd=tmp;
}
inline int max(const int &A,const int &B)
{
	return A<B?B:A;
}
inline int min(const int &A,const int &B)
{
	return A<B?A:B;
}
int a,b;
signed main()
{
	rd(a);
	rd(b);
	if(a+b&1)
	{
		puts("IMPOSSIBLE");
		return 0;
	}
	printf("%lld",(a+b)>>1);
	return 0;
}


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

using namespace std;

const int Mod = 1e9 + 7;
const int N = 2020;

int a[N];

void add_self(int& x,int y){
    if((x += y) >= Mod) x -= Mod;
}

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

    for(int i = 0; i < n; i++)  scanf("%d", a + i);

    int K1 = ( ( (ll) k * (k + 1) ) / 2 ) % Mod;
    int K2 = ( ( (ll) k * (k - 1) ) / 2 ) % Mod;

    int Ans = 0;

    for(int i = 0; i < n; i++)
        for(int j = 0; j < n; j++)
            if(a[i] > a[j])
            {
                if(i < j)   add_self( Ans, K1);
                else        add_self( Ans, K2);
            }

    cout << Ans << endl;
}


Measured memory_bytes: 256
$n=<>;
$min=1e5;
$#DP=$n;$DP[0]=0;
for$i(1..$n){
    $DP[$i] = $DP[$i-1] +1;
    for($j=1;$j<=$i;$j*=6){$DP[$i] = $DP[$i]<$DP[$i-$j]+1?$DP[$i]:$DP[$i-$j]+1}
    for($j=1;$j<=$i;$j*=9){$DP[$i] = $DP[$i]<$DP[$i-$j]+1?$DP[$i]:$DP[$i-$j]+1}
}
print$DP[$n];


Measured memory_bytes: 3584
a, b = map(int, input().split())
A = [1, 3, 5, 7, 8, 10, 12]
B = [4, 6, 9, 11]
C = [2]

if A.count(a) + A.count(b) == 2 or B.count(a) + B.count(b) == 2 or C.count(a) + C.count(b) == 2: print("Yes")
else: print("No")


Measured memory_bytes: 2940
N, M = [int(_) for _ in input().split()]
A = [int(_) for _ in input().split()]
BC = [tuple(int(_) for _ in input().split()) for i in range(M)]


A = sorted(A)
BC = sorted(BC, key=lambda x:-x[1])

#print(A, BC)

i = 0
for b, c in BC:
    if i > N:
        break
    for j in range(b):
        if i >= N or A[i] >= c:
            break
        A[i] = c
        i += 1
    
#print(A, BC)

result = sum(A)

print(result)


Measured memory_bytes: 26460
#include <bits/stdc++.h>
using namespace std;
#define rep(i, m, n) for (int i = m; i < n; ++i)
#define rem(i, m, n) for (int i = m; i >= n; --i)
typedef long long ll;
template<class T>bool chmax(T &a, const T &b) { if (a < b) { a = b; return 1; } return 0; }

int dp[101][404][110];
int main() {
  int N, W;
  cin >> N >> W;
  vector<int> w(N), v(N);
  rep(i, 0, N) cin >> w[i] >> v[i];
  int s = w.front() - 1;
  rep(i, 0, N) w[i] -= s;
  rep(i, 0, N) rep(j, 0, 400) rep(k, 0, N + 1) {
    chmax(dp[i + 1][j][k], dp[i][j][k]);
    chmax(dp[i + 1][j + w[i]][k + 1], dp[i][j][k] + v[i]);
  }
  int ans = 0;
  rep(i, 0, 400) rep(j, 0, N + 1) {
    if(i + (ll)j * s <= W) chmax(ans, dp[N][i][j]);
  }
  cout << ans << endl;
  return 0;
}


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

using namespace std;
  
#define ll long long int

int m=1e9+7;

int main()
{
	  #ifndef ONLINE_JUDGE
	  freopen("input.txt", "r", stdin);
	  freopen("output.txt", "w", stdout);

	  #endif
	  int n;
	  cin>>n;
	  // ll arr[n];
	  map<ll,ll> mp;
	  for(int i=0;i<n;i++)
	  {
	  		ll temp;
	  		cin>>temp;
	  		mp[temp]++;	
	  }
	  ll res=1;
	  for(auto i: mp)
	  {
	  		if(n%2==0)
	  		{

	  			if(i.first%2!=1 || i.second!=2)
	  			{
	  				cout<<0;
	  				return 0;
	  			}
	  			else
	  				res=(res*2)%m;
	  		}
	  		else
	  		{
	  			if(i.first%2!=0 || i.second!=2)
	  			{
	  				if(i.first==0 && i.second==1);
	  				
	  				else
	  				{
	  					cout<<0;
	  					return 0;
	  				}

	  			}
	  			else
	  			{
	  				res=(res*2)%m;
	  				// cout<<i.second<<"  ";
	  			}
	  		}
	  }
	  cout<<res;

}

Measured memory_bytes: 7480
#include <bits/stdc++.h>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace __gnu_pbds; 
#define ordered_set tree<int,null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update> 
#define ordered_set_pair tree<pair<int,int>,null_type,less<pair<int,int>>, rb_tree_tag,tree_order_statistics_node_update> 
#define ordered_set_mutiset tree<int,null_type,less_equal<int>, rb_tree_tag,tree_order_statistics_node_update>
typedef long long int ll;
typedef long double ld;
typedef unsigned long long int ull;
typedef pair<int,int> pi; 
#define PI 3.1415926535897932384
#define FOR(i,vv,n) for(int i=vv;i<n;i++)
#define FORR(i,n,vv) for(int i=n-1;i>=vv;i--)
#define ve vector 
#define maxind(v) (max_element(v.begin(),v.end())-v.begin())
#define minind(v) (min_element(v.begin(),v.end())-v.begin())
#define maxe(v) *max_element(v.begin(),v.end())
#define mine(v) *min_element(v.begin(),v.end())
#define pb push_back
#define pf push_front
#define ppb pop_back
#define ppf pop_front
#define eb emplace_back
#define FAST ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define mp make_pair
#define M 1000000007ll
#define INF 1000000000000000000ll
#define PRECISE cout.precision(18);
#define all(v) v.begin(),v.end()
#define BS(v,n) binary_search(all(v),n)
#define srt(v) sort(v.begin(),v.end())
#define rsrt(v) sort(all(v),greater <ll>())
#define uni(v) v.resize(unique(all(v))-v.begin())
#define F first
#define S second
#define GET(i,p) get<p>(i)



int main(){



    FAST
//	PRECISE

ll n,m,k;
cin>>n>>m>>k;
ve <ll> v1(n,0),v2(m,0);
FOR(i,0,n)
{cin>>v1[i];
if(i!=0)
	v1[i]+=v1[i-1];
}
FOR(i,0,m){
cin>>v2[i];
if(i!=0)
	v2[i]+=v2[i-1];
}
ll ans=0;
	auto x=upper_bound(all(v2),k);
	ll z=0;
	if(x!=v2.begin()){
		x--;
	z=x-v2.begin(),z++;}
	ans=z;
FOR(i,0,n){

	if(k<v1[i])
		break;
	ll t=k-v1[i];
	auto x=upper_bound(all(v2),t);
	ll z=0;
	if(x!=v2.begin()){
		x--;
	z=x-v2.begin(),z++;}
	ans=max(ans,z+i+1);

}
cout<<ans;



return 0;
 }

Measured memory_bytes: 6364
#include<cstdio>
int i,j,k,o,n,c,s[500000];
void g(int l,int m,int r){
  int L[m-l+1],R[r-m+1];
  for(i=0;i<m-l;++i)L[i]=s[i+l];
  for(i=0;i<r-m;++i)R[i]=s[i+m];
  L[m-l]=R[r-m]=1e9,i=o=0;
  for(k=l;k<r;++c)s[k++]=L[i]>R[o]?R[o++]:L[i++];
}
void e(int l,int r){
  int m=(l+r)/2;
  if(l+1<r)e(l,m),e(m,r),g(l,m,r);
}
main(){
  for(scanf("%d",&n);i<n;scanf("%d",&s[i++]));
  e(0,n);
  for(;j<n;)printf(j-n?"%d ":"%d\n",s[j++]);
  printf("%d\n",c);
}

Measured memory_bytes: 6500
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <utility>
#include <numeric>
#include <array>
#include <cmath>
#include <memory>
using namespace std;
//変数デバッグ
#define DEB(variable) cout << #variable << '=' << variable << endl

//for簡易表記(引数ミス防止)
#define FOR(LoopVariable,numberOFbegin,numberOFend) for (long long int LoopVariable = (numberOFbegin); (LoopVariable) < (numberOFend); (LoopVariable)++)
#define DEFOR(LoopVariable,numberOFbegin,numberOFend) for (long long int LoopVariable = (numberOFbegin)-1; (LoopVariable) >= (numberOFend); (LoopVariable)--)
#define REP(LoopVariable,numberOFend) for(long long int LoopVariable = 0;(LoopVariable)<(numberOFend);LoopVariable++)

using llint = long long int;

constexpr long long int linf = numeric_limits<long long int>::max()-5;
constexpr long long int inf= numeric_limits<int>::max()-5;
constexpr long long int mod = 1000000007;
llint n;
vector<vector<llint>> dp;

vector<pair<llint, llint>> v;
llint recur(llint l,llint r){
    if(r-l==1){
        return dp[l][r]=0;
    }
    if(r-l==2){
        return dp[l][r] = v[l].first * v[l].second * v[r-1].second;
    }
    if(dp[l][r]!=-1){
        return dp[l][r];
    }
    llint result = linf;
    FOR(i,l+1,r){
        result = min(result, recur(l,i) +  recur(i,r) + v[l].first * v[i].first * v[r-1].second);
    }
    return dp[l][r]=result;
}
int main(){

    cin >> n;
    v.resize(n);
    dp.resize(n, vector<llint>(n + 1, -1));
    REP(i,n){
        cin >> v[i].first >> v[i].second;
    }
    cout << recur(0, n) << endl;
    return 0;
}



Measured memory_bytes: 3188
import string

count = {x: 0 for x in string.ascii_lowercase}
lines = ""

while True:
    try:
        lines += input().lower()
    except EOFError:
        break

for c in lines:
    if 'a' <= c <= 'z':
        count[c] += 1

for key in string.ascii_lowercase:
    print("{0} : {1}".format(key, count[key]))

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

using namespace std;
#define rep(i, n) for (ll i = 0; i < (n); ++i)
//#define rep(i, n) for (int i = 0; i < (n); ++i)
#define sz(x) ll(x.size())
typedef long long ll;
typedef pair<int, int> P;
//typedef pair<ll, ll> P;
const double INF = 1e10;
//const ll INF = 10e10;
const ll MINF = -10e10;
//const int INF = INT_MAX;
#define mins(x, y) x = min(x, y)
#define maxs(x, y) x = max(x, y)

typedef priority_queue<P, vector<P>, greater<P> > PQ_ASK;
const int mod = 1000000007;
//ifstream myfile("C:\\Users\\riku\\Downloads\\0_00.txt");
//ofstream outfile("log.txt");
//outfile << setw(6) << setfill('0') << prefecture << setw(6) << setfill('0') << rank << endl;
// std::cout << std::bitset<8>(9);
typedef tuple<int, int, int> Q;

struct mint {
    ll x; // typedef long long ll;
    mint(ll x = 0) : x((x % mod + mod) % 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;
    vector<vector<mint>> dp(s.size() + 1, vector<mint>(4, 0));
    dp[0][0] = 1;
    for (int i = 0; i < s.size(); i++) {

        if (s[i] == 'A') {
            dp[i + 1][1] += dp[i][0];
        } else if (s[i] == 'B') {
            dp[i + 1][2] += dp[i][1];
        } else if (s[i] == 'C') {
            dp[i + 1][3] += dp[i][2];
        } else {
            for (int j = 0; j < 3; j++) {
                dp[i + 1][j + 1] += dp[i][j];
            }
        }

        if (s[i] == '?') {
            for (int j = 0; j < 4; j++) {
                dp[i + 1][j] += dp[i][j] * 3;
            }
        } else {
            for (int j = 0; j < 4; j++) {
                dp[i + 1][j] += dp[i][j];
            }
        }

    }

    cout << dp[s.size()][3].x << endl;

}


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

using namespace std;

int main(void){
    int N;
    cin>>N;
    string s;
    cin>>s;
    for(int i=0;i<s.size();i++){
        s[i]+=N;
        if(s[i]>=91) s[i]-=26;
    }
    cout<<s<<endl;
    return 0;
}

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

namespace MyProgram{
    class AtCoder{
        static void Main(){
            long[] input = Array.ConvertAll(Console.ReadLine().Split(' '),long.Parse);
            long N = input[0];
            long Y = input[1];

            for(var i=0;i<=N;i++){
                for(var j=0;j<=N-i;j++){
                    if(10000*i+5000*j+1000*(N-i-j)==Y){
                        Console.WriteLine($"{i} {j} {N-i-j}");
                        return;
                    }
                }
            }
            Console.WriteLine("-1 -1 -1");
        }
    } 
}

Measured memory_bytes: 13268
import java.util.*;
 
public class Main{
  public static void main(String[]args){
    Scanner sc =  new Scanner(System.in);
    long N = Long.parseLong(sc.nextLine());
    
    int ans = 0;
    long m = 100;
    while(m < N){
      m += (long)(m*0.01);
      ans++;
    }
    System.out.println(ans);
  }
}

Measured memory_bytes: 35688
import sys

read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
MOD = 1000000007


def main():
    S = readline().strip()
    days = ['SUN', 'MON', 'TUE', 'WED', 'THU', 'FRI', 'SAT']

    print(7 - days.index(S))

    return


if __name__ == '__main__':
    main()


Measured memory_bytes: 9016
#include<cstdio>
#include<algorithm>
#include<cstdlib>
#include<cmath>
#include<ctime>
#include<vector>
#include<set>
#include<map>
#include<cstring>
using namespace std;
int n,p,a[110],i;
long long f[110][2];
inline int read()
{
    int x=0,f=1;
    char ch=getchar();
    while (ch<'0'||ch>'9')
    {
        if (ch=='-') f=-1;
        ch=getchar();
    }
    while (ch<='9'&&ch>='0')
    {
        x=x*10+ch-'0';
        ch=getchar();
    }
    return x*f;
}
inline void write(long long x)
{
    if (x<0) putchar('-'),x=-x;
    if (x>=10) write(x/10);
    putchar(x%10+'0');
}
int main()
{
				n=read();
				p=read();
				for (i=1;i<=n;i++) a[i]=read()&1;
				f[0][0]=1;
				for (i=1;i<=n;i++)
				{
								if (a[i]) f[i][1]+=f[i-1][0],f[i][0]+=f[i-1][1];
								else f[i][1]+=f[i-1][1],f[i][0]+=f[i-1][0];
								f[i][0]+=f[i-1][0];
								f[i][1]+=f[i-1][1];
				}
				write(f[n][p]);
				return 0;
}

Measured memory_bytes: 128
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <cstring>
#include <queue> //priority_queue 优先队列
#include <map>
#include <set> //multiset  set<int,greater<int>>大到小
#include <vector>// ::iterator it;
#include <stack>
#include <cmath> // auto &Name : STLName  Name.
#include <utility>
#include <sstream>
#include <string>
#define mod 1000000007
#define mod9 998244353
typedef unsigned long long ull;
typedef long long ll;
typedef double db;
typedef long double ld;
const db eps=1e-10;
const int INF = 0x3f3f3f3f;
const ll inf=0x3f3f3f3f3f3f3f3f;
const int N=1e6+2e5;
inline ll read(){ll s=0,w=1;char ch=getchar();while(ch<'0'||ch>'9'){if(ch=='-')w=-1;ch=getchar();}while(ch>='0'&&ch<='9') s=s*10+ch-'0',ch=getchar();return s*w;}
using namespace std;

int t,n,m,k=0,cnt=0,flag=0;
string s;
int main(){
    cin>>s;
    if(s[2]==s[3]&&s[4]==s[5]) puts("Yes");
    else puts("No");

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <cstdio>
#include <vector>
#include <queue>
#include <set>
#include <numeric>
#include <cmath>

using namespace std;

typedef long long int ll;

const ll mod = 1e9+7;
const ll INF = 1e9;
const ll MAXN = 1e9;

int main()
{
    ll a,b,c,k;
    cin >> a >> b >> c >> k;

    if(k % 2 == 0) cout << a-b << endl;
    else cout << b-a << endl;


    return 0;
}

Measured memory_bytes: 256
#include<iostream>

std::string judgeInside(int w, int h, int x, int y, int r);

int main()
{
	int width, hight, x, y, radius;
	std::string ans;

	std::cin >> width >> hight >> x >> y >> radius;

	ans = judgeInside(width, hight, x, y, radius);

	std::cout << ans << std::endl;

	return 0;
}

std::string judgeInside(int w, int h, int x, int y, int r)
{
	if (r <= y && y <= h - r && r <= x && x <= w - r)		// 条件式が長い気がするけど、うまい分け方がよくわからない
	{
		return "Yes";
	}
	else
	{
		return "No";
	}
}


Measured memory_bytes: 3224
#include <iostream>
#include <map>
#include <string>
#include <queue>
using namespace std;

typedef pair<string,int> bug;

bool check(string str ) {
  for ( int i = 1; i < str.size(); i++ ) {
    if ( str[0] != str[i] ) return 0;
  }
  return 1;
}

char change( char a, char b ) {
  if ( a > b ) swap(a,b);
  if ( a == 'b' && b == 'g' ) return 'r';
  else if ( a == 'b' && b == 'r' ) return 'g';
  else return 'b';
}

void bfs(string str ) {
  int ans = -1;
  queue<bug> Q;
  map<string,int> close;

  Q.push( make_pair(str, 0) );
  close.insert( make_pair(str, 1) );

  while( !Q.empty() ) {
    bug b = Q.front(); Q.pop();
    string tmp1 = b.first;
    if ( check(tmp1) ) {
      ans = b.second;
      break;
    }

    for ( int i = 0; i < tmp1.size()-1; i++ ) {
      if ( tmp1[i] != tmp1[i+1] ) {
	string tmp2 = tmp1;
	char nc = change(tmp2[i],tmp2[i+1]);
	tmp2[i] = nc;
	tmp2[i+1] = nc;
	if ( close[tmp2] ) continue;
	Q.push( make_pair(tmp2,b.second+1) );
	close[tmp2] = 1;
	
      }
    }

  }

  if ( ans == -1 ) cout << "NA" << endl;
  else cout << ans << endl;

}


int main() {
  string str;
  while ( cin >> str , str != "0") {
    bfs(str);
  }

  return 0;
}

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

using namespace std;

// https://onlinejudge.u-aizu.ac.jp/courses/library/5/GRL/2/GRL_2_A

vector<int> parents;
vector<int> ranks;

int init(int n) {
    parents = vector<int>(n, 0);
    ranks = vector<int>(n, 0);
    for (int i = 0; i < n; ++i) {
        parents[i] = i;
    }
}

int find(int x) {
    if (parents[x] == x) {
        return x;
    }
    else {
        parents[x] = find(parents[x]);
        return parents[x];
    }
}

void unite(int x, int y) {
    x = find(x);
    y = find(y);
    if (x == y) {
        return;
    }

    if (ranks[x] > ranks[y]) {
        parents[y] = x;
    }
    else if (ranks[y] > ranks[x]) {
        parents[x] = y;
    }
    else {
        parents[y] = x;
        ++ranks[x];
    }
}

bool same(int x, int y) {
    return find(x) == find(y);
}

struct Edge {
    int start;
    int end;
    int weight;
};

bool comp(const Edge& e1, const Edge& e2) {
    return e1.weight < e2.weight;
}

void Main() {
    int V, E;
    cin >> V >> E;
    vector<Edge> edges(E);
    for (int i = 0; i < E; ++i) {
        cin >> edges[i].start >> edges[i].end >> edges[i].weight;
    }

    sort(edges.begin(), edges.end(), comp);
    init(V);
    int ans = 0;
    for (int i = 0; i < E; ++i) {
        if (!same(edges[i].start, edges[i].end)) {
            unite(edges[i].start, edges[i].end);
            ans += edges[i].weight;
        }
    }
    cout << ans << endl;
}

int main() {
    std::cout << std::fixed << std::setprecision(15);
    Main();
    return 0;
}



Measured memory_bytes: 4124
#include<stdio.h>
#include<string.h>

int main()
{
  int i,n,j,flag=1,minj,k=0;
  char C[36][3],t[3],str[36][3];

  scanf("%d",&n);
  for(i=0;i<n;i++)
    {
      scanf("%s",C[i]);
    }
  for(i=0;i<n;i++)
    {
      strcpy(str[i],C[i]);
    }
  
  i=0;
  while(flag)
    {
      flag=0;
      for(j=n-1;j>=i+1;j--)
	{
	  if(C[j][1]<C[j-1][1])
	    {
	      strcpy(t,C[j]);
	      strcpy(C[j],C[j-1]);
	      strcpy(C[j-1],t);
	      flag=1;
	      
	    }
	}
      i++;
    }

  for(i=0;i<n-1;i++)
    {
      printf("%s ",C[i]);
    }
  printf("%s\n",C[i]);
  printf("Stable\n");

  for(i=0;i<n;i++){
    minj=i;
    for(j=i;j<n;j++)
      {
	if(str[j][1]< str[minj][1])
	  {
	    minj=j;
	  } 
      }  
    if(i!=minj)
      {
	strcpy(t,str[i]);
	strcpy(str[i],str[minj]);
	strcpy(str[minj],t);
      }
  }

  for(i=0;i<n-1;i++)
    {
      printf("%s ",str[i]);
    }
  printf("%s\n",str[i]);
  flag=1;
  for(i=0;i<n;i++)
    {
      if(strcmp(&C[i][0],&str[i][0])!=0 && k==0)
	{
	  printf("Not stable\n");
	  flag=0;
	  k++;
	}
    }
  if(flag==1)
    {
      printf("Stable\n");
    }


  return 0;
}

Measured memory_bytes: 620
def main():
  
  h,n=map(int,input().split())
  AB=tuple([list(map(int,input().split()))for _ in range(n)])
  
  DP=[float("inf") for _ in range(h+2)]
  DP[0]=0
  for i in range(1,h+2):
    for a,b in AB:
      if i<=a:
        DP[i]=min(DP[i],b)
      else:
        DP[i]=min(DP[i],DP[i-a]+b)
        
  print(DP[h])
  
if __name__=="__main__":
  main()

Measured memory_bytes: 43100
#include<stdio.h>
int main(void){
  int a,b,c,d;
  scanf("%d %d %d %d",&a,&b,&c,&d);
  int mul_ab,mul_cd;
  mul_ab=a*b;
  mul_cd=c*d;
  int max=0;
  if(mul_ab<=mul_cd) max=mul_cd;
  if(mul_ab>=mul_cd) max=mul_ab;
  printf("%d",max);
  return 0;
}

Measured memory_bytes: 128
A, B, H, M = gets.split.map(&:to_i)

hour_theta = H * 0.5 * 60 + M * 0.5
minute_theta = M * 6
theta = (hour_theta-minute_theta-360).abs
xx = A*A + B*B - 2 * A * B * Math::cos(theta * (Math::PI/180))

puts Math::sqrt(xx)


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

typedef long long int   ll;
#define int             ll
#define PI              3.1415926535897932384626433832795

#define pb              push_back
#define rep0            for(int i=0;i<n;i++)
#define rep1            for(int i=1;i<=n;i++)
#define inputar0(ar)    for(int i=0;i<n;i++)cin>>ar[i]
#define inputar1(ar)    for(int i=1;i<=n;i++)cin>>ar[i]

#define hell            freopen("input.txt","r", stdin);freopen("output.txt", "w", stdout);freopen("error.txt", "w",stderr);
#define fastasF_boi()   ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define endl            "\n"
//#define cerr            if(false)cerr

int mod=1000000007;
int maxn=200001;
int binpow(int a,int b,int mod){int res=1;while(b>0){if(b%2){res=(res*a)%mod;b--;}a=(a*a)%mod;b/=2;}return res%mod;}
int binpow(int a,int b){int res=1;while(b>0){if(b%2){res=(res*a);b--;}a=(a*a);b/=2;}return res;}
bool isPrime(int n){if(n==1)return false;for(int i=2;i*i<=n;i++){if(n%i==0)return false;}return true;}
int mulmod(int a,int b){return ((a%mod)*(b%mod))%mod;}
int addmod(int a,int b){return (((a%mod)+(b%mod))+mod)%mod;}

map<int,int> mp;

void primeFactors(int n)
{
    // Print the number of 2s that divide n
    if(n%2==0) mp[2]++;
    while (n % 2 == 0)
    {
        n = n/2;
    }

    // n must be odd at this point. So we can skip
    // one element (Note i = i +2)
    for (int i = 3; i <= sqrt(n); i = i + 2)
    {
        // While i divides n, print i and divide n
        if(n%i==0) mp[i]++;
        while (n % i == 0)
        {
            n = n/i;
        }
    }

    // This condition is to handle the case when n
    // is a prime number greater than 2
    if (n > 2)
        mp[n]++;
}

void solve(){
    int n;cin>>n;
    int ar[n];
    for(int i=0;i<n;i++){
        cin>>ar[i];
    }
    int gcd=ar[0];
    for(int i=1;i<n;i++){
        gcd=__gcd(ar[i],gcd);
    }
    if(gcd!=1){
        cout<<"not coprime"<<endl;
    }else {
        for(int i=0;i<n;i++){
            if(isPrime(ar[i])){
                mp[ar[i]]++;
            }else {
                primeFactors(ar[i]);
            }
        }
        bool tr=false;
        for(auto it:mp){
//            cout<<it.first<<" "<<it.second<<endl;
            if(it.second>1){
                tr=true;
                break;
            }
        }
        if(tr) cout<<"setwise coprime"<<endl;
        else cout<<"pairwise coprime"<<endl;
    }
}

signed main(){
//    hell;

    fastasF_boi();
    int t=1;
//    cin>>t;
    for(int tt=1;tt<=t;tt++){
        solve();
    }
}



Measured memory_bytes: 16232
#include <stdio.h>
#include <iostream>
using namespace std;
//線形探索
int binary(int A[],int n,int key){
	int left = 0;
	int right = n;
	int mid;
	while(left<right){
		mid = (left+right)/2;
		if(A[mid] == key) return 1;
		else if(key<A[mid]) right = mid;
		else left = mid + 1;
	}
	return 0;
}

int main(){
	//個数ｎ、時間のｑ、2個目の数字key
	int n,A[1000000],q,key,sum = 0;

	cin >> n;

	for(int i = 0;i < n;i++){//Aに1つ目の時間を入れる
		cin >> A[i];
	}

	cin >> q;

	for(int i = 0;i < q;i++){
		cin >> key;//探索すべき数字
		if(binary(A,n,key) )sum++;
	}

	cout << sum << endl;

	return 0;
}


Measured memory_bytes: 3488
n,k=map(int,input().split())
ans=0

if n<k:    
    for i in range(1,n+1):
        cnt=0
        while(i<k):
            i=i*2
            cnt+=1
        ans+=(1/n)*(1/(2**cnt))
else:
    for i in range(1,k):
        cnt=0
        while(i<k):
            i=i*2
            cnt+=1
        ans+=(1/n)*(1/(2**cnt))
    ans=ans+((n-k+1)/n)
print(ans)
    
        

Measured memory_bytes: 3064
#include "bits/stdc++.h"
#include "iostream"
using namespace std;

int main()
{
	int A,B,C;
	cin>>A>>B>>C;
	if (A==B){
		cout<<C<<endl;
	}
	else if (B==C){
		cout<<A<<endl;
	}
	else if (A==C){
		cout<<B<<endl;}
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(void)
{
  int x,n,d;
  cin >> x;
  n = x/100;
  d = x%100;
  if(n > 98) cout << "1\n";
  else
  {
      while(d > 5 && n > 0)
      {
          d -= 5;
          n--;
      }
      if(n > 0) cout << "1\n";
      else cout <<"0\n";
  }
}


Measured memory_bytes: 256
use io::*;

fn main() {
    let con = read_string();
    let mut sc = Scanner::new(&con);

    let n: usize = sc.next();
    let bd: Vec<Vec<char>> = (0..n)
        .map(|_| sc.next::<String>().chars().collect())
        .collect();

    let mut nbd: Vec<Vec<char>> = vec![vec![' '; 2 * n]; 2 * n];
    for i in 0..2 * n {
        for j in 0..2 * n {
            nbd[i][j] = bd[j % n][i % n];
        }
    }

    let mut rbd: Vec<Vec<char>> = vec![vec![' '; 2 * n]; 2 * n];

    for i in 0..2 * n {
        for j in 0..2 * n {
            rbd[i][j] = nbd[j][i];
        }
    }

    let mut ans = 0;
    for a in 0..n {
        for b in 0..n {
            let mut ok = true;
            for i in 0..n {
                let r1 = &nbd[(i + a) % n];
                let r2 = &rbd[(i + b) % n];

                if &r1[b..b + i] != &r2[a..a + i] {
                    ok = false;
                    break;
                }
            }

            if ok {
                ans += 1;
            }
        }

        if n >= 250 && ans >= n * n / 2 && ans == (a + 1) * n {
            ans = n * n;
            break;
        }
    }

    println!("{:?}", ans);
}

//-----

pub mod io {
    use std;

    pub struct Scanner<'a> {
        iter: std::str::SplitWhitespace<'a>,
    }

    impl<'a> Scanner<'a> {
        pub fn new(s: &'a str) -> Scanner<'a> {
            Scanner {
                iter: s.split_whitespace(),
            }
        }

        pub fn next<T>(&mut self) -> T
        where
            T: std::str::FromStr,
            <T as std::str::FromStr>::Err: std::fmt::Debug,
        {
            let s = self.iter.next().unwrap();
            s.parse::<T>().unwrap()
        }
    }

    pub fn read_string() -> String {
        use std::io::Read;

        let mut s = String::new();
        std::io::stdin().read_to_string(&mut s).unwrap();
        s
    }

    pub fn read_line() -> String {
        let mut s = String::new();
        std::io::stdin().read_line(&mut s).unwrap();
        s.trim_right().to_owned()
    }
}


Measured memory_bytes: 6396
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <cstring>
#include <complex>
#include <stack>
#include <queue>
#include <unordered_map>
#include <map>

#define rep(i, a) for (int i = 0; i < (a); i++)
using namespace std;


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

    vector<int> v(n);

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

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

    cout << v[n/2] - v[n/2-1] << endl;

}






Measured memory_bytes: 640
import java.util.*;
import java.math.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int M = sc.nextInt();
        int[][] edges = new int[M][2];
        Map<Integer, List<Integer>> map = new HashMap<>();
        Map<Integer, Integer> memo = new HashMap<>();
        for (int i = 1; i <= N; i++) {
            map.put(i, new ArrayList<>());
        }

        for (int i = 0; i < M; i++) {
            int start = sc.nextInt();
            int end = sc.nextInt();
            map.get(start).add(end);
        }

        int res = 0;
        for (int i = 1; i <= N; i++) {
            res = Math.max(res, helper(i, map, memo));
        }

        System.out.println(res);
    }

    public static int helper(int v, Map<Integer, List<Integer>> map, Map<Integer, Integer> memo) {
        if (memo.containsKey(v)) return memo.get(v);
        Queue<Integer> Q = new LinkedList<>();
        Q.offer(v);
        int res = 0;
        for (int next : map.get(v)) {
            res = Math.max(res, 1 + helper(next, map, memo));
        }

        memo.put(v, res);
        return memo.get(v);
    }
}


Measured memory_bytes: 117028
#include <cstdio>
#include <climits>
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <cmath>
#include <stack>
#include <algorithm>
#include <iomanip>
#include <map>
#include <queue>
#include <functional>
#include <numeric>
#include <chrono>
#include <cstdlib>
using ll = long long;
using namespace std;

const ll MOD = 1e9 + 7;
const double pi = acos(-1);
#define REP(i, n) for (int(i) = 0; (i) < (n); ++(i))
#define repi(i, a, b) for (int i = int(a); i < int(b); ++i)
#define EPS 1e-4
#define OUTPUT(i) (cout << (ll)i << endl)
// bool operator<(const pair<int, int> &a, const pair<int, int> &b)
// {
//     if (a.first == b.first)
//         return a.second < b.second;
//     return a.first < b.first;
// };

/*unsigned int xor128(void)
{
    static unsigned int x = 123456789, y = 362436069, z = 521288629, w = 88675123;
    unsigned int t = (x ^ (x << 11));
    x = y;
    y = z;
    z = w;
    return (w = (w ^ (w >> 19)) ^ (t ^ (t >> 8)));
}
unsigned int xor128rnd(unsigned int m)
{
    return xor128() % m;
}*/

bool operator<(const pair<ll, ll> &a, const pair<ll, ll> &b)
{

    if (a.first == b.first)
        return a.second < b.second;

    return a.first < b.first;
}

bool used[100010];
int neta[100010];
priority_queue<ll, vector<ll>, greater<ll>> que;
vector<pair<ll, ll>> vp;
vector<pair<ll, ll>> v;
vector<vector<ll>> v1(100010);
int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    //cout << fixed << setprecision(10);

    int K, N;
    cin >> N >> K;
    for (int i = 0; i < N; ++i)
    {
        int t, d;
        cin >> t >> d;
        t--;
        vp.push_back({d, t});
        v1[t].push_back(d);
    }
    sort(vp.rbegin(), vp.rend());

    ll sum = 0, cnt = 0;
    for (int i = 0; i < K; ++i)
    {
        sum += vp[i].first;
        if (!used[vp[i].second])
        {
            cnt++;
            used[vp[i].second] = true;
        }
        else
        {
            que.push(vp[i].first);
        }
    }

    ll ans = sum + cnt * cnt;

    for (int i = K; i < N; ++i)
    {
        if (cnt >= K)
            break;
        if (used[vp[i].second])
            continue;
        ++cnt;
        used[vp[i].second] = true;
        ll mini = que.top();
        que.pop();
        sum -= mini;
        sum += vp[i].first;
        ans = max(ans, sum + cnt * cnt);
    }
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 7408
#!/usr/bin/env python3
import sys


def diff(L):
    return(max(L)-min(L))

def solve(H: int, W: int):
    N = 3
    if H % N == 0 or W % N == 0:
        print(0)
        return
    
    res = H * W
    for h in range(1, H):
        s1 = (H - h) * W

        s2 = h * (W // 2)
        s3 = h * (W - W // 2)
        res = min(res, diff([s1, s2, s3]))

        s2 = (h // 2) * W
        s3 = (h - h // 2) * W
        res = min(res, diff([s1, s2, s3]))

    for w in range(1, W):
        s1 = H * (W - w)

        s2 = (H // 2) * w
        s3 = (H - H // 2) * w
        res = min(res, diff([s1, s2, s3]))
        
        s2 = H * (w // 2)
        s3 = H * (w - w // 2)
        res = min(res, diff([s1, s2, s3]))

    print(res)
    return


# Generated by 1.1.4 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    H = int(next(tokens))  # type: int
    W = int(next(tokens))  # type: int
    solve(H, W)

if __name__ == '__main__':
    main()


Measured memory_bytes: 3064
#include <iostream>
#include <algorithm>
#include <string>
#include <cmath>
#include <ctype.h>
#include <map>
#include <vector>
#include <stdlib.h>
#include <stdio.h>
#include <cctype>
#include <queue>
#include <set>
#include <list>
#define PI 3.141592653
#define rep(i,a,n) for(int i=a;i<(int)n;++i)
#define SZ(x) ((int)(x).size())	//size() unsigned -> int
#define DescSort(a) sort(a.begin(),a.end(),std::greater<int>())

using namespace std;
typedef long long ll;
const ll INF = 1e9 + 7;

int main() {
	string s;
	int q;
	cin >> s >> q;
	string t;
	rep(i, 0, q) {
		int in;
		cin >> in;
		if (in == 1) {
			swap(s, t);
		}
		else {
			int F;char C;
			cin >> F >> C;
			if (F == 1) t += C;
			else s += C;
		}
	}
	reverse(t.begin(), t.end());
	t += s;
	cout << t << endl;
}

Measured memory_bytes: 1128
#include<iostream>
#include<vector>
#include<algorithm>

#define REP(i,n) for(int i=0;i<(n);i++)

using namespace std;

int main(){
    int n, r;
    vector<int> vc;
    while(cin >> n >> r){
        if(n == 0 && r == 0) break;
        vc.clear();
        REP(i,n){
            vc.insert(vc.begin(),i+1);
        }
        int p, c;
        REP(i,r){
            cin >> p >> c;
            REP(j, c){
                int tmp = vc[p+c-2];
                vc.erase(vc.begin()+p+c-2);
                vc.insert(vc.begin(), tmp);
            }
        }
        cout << vc.front() << endl;
    }
    return 0;
}

Measured memory_bytes: 1220