akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
using Graph = vector<vector<int>>;
const int INT_INF = 1001001001;

bool gusu(string s){
    int n = s.size();
    if(n%2 == 1) return false;
    string s1 = s.substr(0,n/2);
    string s2 = s.substr(n/2);
    if(s1 == s2) return true;
    else return false;
}

int main(){
    string S;
    cin >> S;  
    while(!S.empty()){
        S.pop_back();
        if(gusu(S)){
            cout << S.size() << endl;
            return 0;
        }
    }
}

Measured memory_bytes: 256
N =int(input().strip())

lst = [4, 7]

num = 8

while num <= 100:

    for elem in lst:
        if elem + 4 == num or elem + 7 == num:
            lst.append(num)
            break
    num+=1

if N in lst:
    print('Yes')
else:
    print('No')

Measured memory_bytes: 2940
#include <bits/stdc++.h>
    using namespace std;
     
    int main() {
      int N, K, X;
      cin >> N >> K;
      X = 1;
      for(;N > 0; N--){
        if(X * 2 > X + K){
          X += K;
        }else{
          X *= 2;
        }
      }
      cout << X << endl;
      
    }

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <math.h>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
using namespace std;

typedef long long ll;
#define rep(i, n) for(int i = 0; i < n; i++)

int main(){
    int A, B, C;
    cin >> A >> B >> C;
    bool is_ex = false;
    for(int i = 1; i <= B; i++){
        int num = A * i;
        if(num % B == C) is_ex = true;
    }
    if(is_ex) cout << "YES" << endl;
    else cout << "NO" << endl;
    return 0;
}

Measured memory_bytes: 384
package main

import (
	"fmt"
)

func main() {
	var o, e string
	fmt.Scan(&o, &e)

	for i := 0; i < len(o); i++ {
		if (len(o)-len(e)) == 1 && i == len(o)-1 {
			fmt.Println(string(o[i]))
		} else {
			fmt.Print(string(o[i]), string(e[i]))
		}
	}

}


Measured memory_bytes: 512
#include <iostream>
#include <iomanip>
#include <vector>
#include <string>
#include <algorithm>
#include <math.h>
#include <map>
#include <string.h>
using namespace std;

bool is_753(int n){
    bool f = true, f3 = false, f5 = false, f7 = false;
    while (n>0) {
        int tmp = n % 10;
        if (tmp == 3) f3 = true;
        else if (tmp == 5) f5 = true;
        else if (tmp == 7) f7 = true;
        else f = false;
        n /= 10;
    }
    return f && f3 && f5 && f7;
}


int main(){
    int n, cnt = 0;
    cin >> n;
    int num = 357;
    while (num <= n) {
        if (is_753(num)) cnt++;
        int firstdig = num % 10;
        int seconddig = (num/10) % 10;
        int thirddig = (num/100) % 10;
        if(firstdig == 3 || firstdig == 5) num += 2;
        else {
            if(seconddig == 3 || seconddig == 5) num += 16;
            else{
                if(thirddig == 3 || thirddig == 5) num += 156;
                else num += 556;
            }
        }
    }
    cout << cnt << endl;
    return 0;
}

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

int main( void )
{
    int x,y,z;
    cin >> x >> y >> z;

    cout << z << ' ' << x << ' ' << y << endl;
}

Measured memory_bytes: 256
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <climits>
#include <cmath>
#include <ctime>
#include <cassert>
#include <iostream>
#include <fstream>
#include <sstream>
#include <iomanip>
#include <complex>
#include <string>
#include <vector>
#include <list>
#include <deque>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <bitset>
#include <iterator>
#include <functional>
#include <utility>
#include <algorithm>
#include <numeric>
#include <typeinfo>

using namespace std;

#define dump(n) cerr<<"# "<<#n<<"="<<(n)<<endl
#define repi(i,a,b) for(int i=int(a);i<int(b);i++)
#define rep(i,n) repi(i,0,n)
#define iter(c) __typeof((c).begin())
#define foreach(i,c) for(iter(c) i=(c).begin();i!=(c).end();++i)
#define allof(c) (c).begin(),(c).end()
#define mp make_pair

typedef unsigned int uint;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<string> vs;
typedef pair<int,int> pii;

void turn(vs& grid)
{
	vs temp(5,string(5,'#'));
	rep(i,5) rep(j,5){
		char c='#';
		if(grid[i][j]=='|') c='-';
		if(grid[i][j]=='-') c='|';
		if(grid[i][j]=='.') c='.';
		temp[j][4-i]=c;
	}
	grid=temp;
}

void reverse(vs& grid)
{
	rep(i,5)
		reverse(allof(grid[i]));
}

int getval(vs& lines,int oi,int oj,bool isrev,int tcount)
{
	vs grid(5);
	rep(i,5)
		grid[i]=lines[oi+1+i].substr(oj+1,5);
	rep(i,tcount)
		turn(grid);
	if(isrev)
		reverse(grid);
	
	string _ss[10][5]={
		{"","",",",""},
		{".....","...|.",".....","...|.","..-.."},
		{"..-..","...|.","..-..",".|...","..-.."},
		{"..-..","...|.","..-..","...|.","..-.."},
		{".....",".|.|.","..-..","...|.","....."},
		{"..-..",".|...","..-..","...|.","..-.."},
		{"..-..",".|...","..-..",".|.|.","..-.."},
		{"..-..","...|.",".....","...|.","....."},
		{"..-..",".|.|.","..-..",".|.|.","..-.."},
		{"..-..",".|.|.","..-..","...|.","..-.."},
	};
	vector<vs> ss(10,vs(5));
	repi(i,1,10)
		ss[i]=vs(_ss[i],_ss[i]+5);
	
	repi(i,1,10)
		if(ss[i]==grid)
			return i;
	return -1;
}

int main()
{
	for(;;){
		vs lines(21);
		rep(i,21) cin>>lines[i];
		if(lines[0]=="0") break;
		vvi a(2,vi(6));
		rep(i,2){
			int oj=i*29;
			a[i][0]=getval(lines,0,oj+7,true,0);
			a[i][1]=getval(lines,7,oj+0,true,1);
			a[i][2]=getval(lines,7,oj+7,true,0);
			a[i][3]=getval(lines,7,oj+14,true,3);
			a[i][4]=getval(lines,7,oj+21,true,0);
			a[i][5]=getval(lines,14,oj+7,false,2);
		}
		int hi=0,lo=0;
		rep(i,6) rep(j,6){
			if(a[0][i]>a[1][j]) hi++;
			if(a[0][i]<a[1][j]) lo++;
		}
		if(hi>=lo)
			puts("HIGH");
		else
			puts("LOW");
	}
	
	return 0;
}

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

int main(){
	int n;
	cin>>n;
	vector<int> a(n);
	vector<int> c(1e5,0);
	for(int i=0;i<n;i++){
		cin>>a[i];
		a[i]--;
		c[a[i]]++;
	}
	int cnt=0;
	int res=0;
	for(int i=0;i<1e5;i++){
		if(c[i]!=0&& c[i]%2==0){
			cnt++;	
		}
		if(c[i]!=0) res++;
	
	}
	if(cnt%2==1) cout<<res-1<<endl;
	else if(cnt>=4 || cnt==0)cout<<res<<endl;
	else{
		bool bef=false;
		int buf=0;
		for(int i=0;i<1e5;i++){
			if(c[i]!=0){
				if(c[i]%2==0){
					if(!bef) bef=true;
					else{
						buf=-1;		
						bef=false;
					}
				}
				else{
					bef=false;
				}
			}
		}
		cout<<res+buf<<endl;
	}
	return 0;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define all(x) (x).begin(),(x).end()
#define sz(x) (int)((x).size())
#define mp make_pair

using namespace std;

typedef unsigned long long ull;
typedef pair<int,int> ii;

template<class U,class T>ostream& operator<<(ostream& out, pair<U,T> & P){
    return out << "[" << P.first << ", " << P.second << "]";
}
template<class T>ostream& operator<<(ostream& out, vector<T> & V){
    if(!V.empty())out << "[";
    for(int i = 0; i < sz(V); i++)out << V[i] << (i+1==sz(V)?"]":", ");
    return out;
}

int main(){
    ios_base::sync_with_stdio(false);
    int n,m;
    cin >> n >> m;
    cout << (n==m? "Yes" : "No") << endl;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
#define INF 1<<30
#define LINF 1LL<<60

bool dfs(int u,int t,int dep,vector<vector<int>>& G){
    if(dep == 2)return false;
    for(auto next: G[u]){
        if(next == t)return true;
        if(dfs(next,t,dep+1,G)){
            return true;
        }
    }
    return false;
}
int main(void) {
    cin.tie(0); ios::sync_with_stdio(false);
    int N,M; cin >> N >> M;
    vector<vector<int>> G(N);
    for(int i = 0; i < M;i++){
        int a,b; cin >> a >> b;
        a--; b--;
        G[a].push_back(b);
        G[b].push_back(a);
    }
    if(dfs(0,N-1,0,G)){
        cout << "POSSIBLE" << endl;
    }else{
        cout << "IMPOSSIBLE" << endl;
    }
    return 0;
}

Measured memory_bytes: 12016
use proconio::input;

fn main() {
    input! {
        n: usize,
    }
    let mut table = vec![0; n];

    for x in 1..=100 {
        for y in 1..=100 {
            for z in 1..=100 {
                let num = x * x + y * y + z * z + x * y + y * z + z * x;
                if num <= n {
                    table[num - 1] += 1;
                }
            }
        }
    }
    for a in table {
        println!("{}", a);
    }
}

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

/**
 * [IPC - Contest III]
 * @author Rodrigo Moreira Pires de Andrade
 * @version 13/04/2020
*/

using namespace std;

// Functions and class come here..


int main() {

    // Solve the problem here ..
    int times[3];

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

    vector<int> sum;
    for(int i = 0; i < 3; i++) {
        for(int j = i + 1; j < 3; j++) { 
            sum.push_back(times[i] + times[j]);
        }
    }

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

    cout << sum.front() << endl;
   
    return 0;
}


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

int		main(void)
{
	int a, b, c;
	
	cin >> a >> b >> c;
	int ans = 1;

	if (b != a)
		ans++;
	if (c != a && c != b)
		ans++;
	cout << ans << endl;
}



Measured memory_bytes: 256
N = gets.to_i

B = (N+1).bit_length - 1
rem = N - 2**B + 1
tail = []

ans = []
(1..B).each do |i|
    if rem%2 == 1
        ans.push(i+B)
        tail.unshift(i+B)
    end
    ans.push(i)
    rem /= 2
end
ans += (1..B).to_a + tail
puts ans.length, ans.join(' ')

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


int main(){
    int long long x,y,c=0;
    cin>>x>>y;
    while(1)
    {
        if(x<=y)
        {
            c++;
            x*=2;
        }
        else
            break;
        
    }
    cout<<c;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
const int m = 1e9+7;

int main(){
    cin.tie( nullptr );
    cout.tie( nullptr );
    ios_base::sync_with_stdio(0);

    int n, x, k; cin >> n >> k;
    vector< int > v( k+5, 0 ); v[0] = 1;

    for(int i=0; i<n; i++){
        cin >> x;
        vector<int> tmp(k+5, 0);
        for(int ses=k; ses>=0; ses--){
            int add = v[ses], l=ses+1, r=ses+min(x, k-ses);
            if(l <= r){r++; r=min(r, k+1);
                tmp[l] = (tmp[l] + add) % m;
                tmp[r] = (tmp[r] - add) % m;
                tmp[r] = (tmp[r] + m) % m;
            }
        }int sum = 0;
        for(int j=0; j<=k; j++){
            sum+=tmp[j]; sum%=m; sum+=m; sum%=m;
            v[j]+=sum; v[j]%=m; v[j]+=m; v[j]%=m;
        }
    }cout << v[k]%m << "\n";

    return 0;
}


Measured memory_bytes: 3988
#include <bits/stdc++.h>
using namespace std;
 
#define ff first
#define ss second
#define mp(a,b) make_pair(a,b)
#define pb(a) push_back(a)
#define check(x) cout << #x << " : " << (x) << endl
#define all(v) v.begin(),v.end() 
#define show(a) for(auto i:a) cout<<i<<" ";cout<<endl
// #define endl '\n'  
typedef long long ll; 
typedef unsigned long long ull; 
typedef long double ld;
typedef pair< int , int > mypair;
typedef priority_queue <int> max_heap;
typedef priority_queue <mypair, vector<mypair>, greater<mypair> > min_heap;
const int mod=1000000007;
const int inf=1e9;
const int N=1e7+10;

int v[N];

int32_t main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);cout.tie(0);
    cin.exceptions(cin.failbit);
    int n;
    cin>>n;

    for(int i=1;i<=n;i++)
    	for(int j=i;j<=n;j+=i)

    		v[j]++;
    ll ans=0;
    for(int i=1;i<=n;i++) ans+=1ll*i*v[i];

    cout<<ans;	

    

    return 0;
} 

Measured memory_bytes: 42668
/*
　　　  ∧＿∧　やあ
　　 （´・ω・｀)　　　　　/　　　　　ようこそ、バーボンハウスへ。
　　 ／∇y:::::＼　　　 [￣]　　　　　このテキーラはサービスだから、まず飲んで落ち着いて欲しい。
　　 |:⊃:|:::::|　　　|──|
￣￣￣￣￣￣￣￣￣￣￣￣￣￣￣￣￣|　うん、「また」なんだ。済まない。
￣￣￣￣￣￣￣￣￣￣￣￣￣￣￣|￣　  仏の顔もって言うしね、謝って許してもらおうとも思っていない。
￣￣￣￣￣￣￣￣￣￣￣￣￣￣／|
　　　　∇　∇　∇　∇　　　／.／|　　　でも、この提出を見たとき、君は、きっと言葉では言い表せない
　　　　┴　┴　┴　┴　／ ／　  |　　　「ときめき」みたいなものを感じてくれたと思う。
￣￣￣￣￣￣￣￣￣￣|／　　  |　　　殺伐としたコンテストの中で、そういう気持ちを忘れないで欲しい
￣￣￣￣￣￣￣￣￣￣　　　　 |　　　そう思って、この提出を投げたんだ。
　　　(⊆⊇)　(⊆⊇)　(⊆⊇)　　|
　    ||　　 ||　　||　　|　　　 じゃあ、判定を聞こうか。
　　.／|＼　／|＼ ／|＼
*/

#include <iostream>
#include <cstdlib>
#include <algorithm>
#include <array>
#include <bitset>
#include <climits>
#include <cmath>
#include <cstdio>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <string>
#include <vector>
using namespace std;
#define fst first
#define snd second
#define mp make_pair
#define ALL(obj) (obj).begin(),(obj).end()
#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(i,0,n)
#define RREP(i,n) RFOR(i,0,n) 
#define SIZE(x) ((int)(x).size())
#define debug(x) cerr << #x << " -> " << x << " (line:" << __LINE__ << ")" << '\n';
#define debugpair(x, y) cerr << "(" << #x << ", " << #y << ") -> (" << x << ", " << y << ") (line:" << __LINE__ << ")" << '\n';
typedef long long lint;
typedef pair<int, int> pint;
typedef pair<lint, lint> plint;
typedef vector<lint> vec;
typedef vector<vector<lint>> matrix;
typedef priority_queue<lint> p_que;
typedef priority_queue<lint, vector<lint>, greater<lint>> p_que_rev;
const lint INF = INT_MAX;
const lint LINF = LLONG_MAX;
const lint MOD = 1000000000 + 7;
const double EPS = 1e-9;
const double PI = acos(-1);
const int di[]{0, -1, 0, 1, -1, -1, 1, 1};
const int dj[]{1, 0, -1, 0, 1, -1, -1, 1};

lint gcd(lint a, lint b) {
    lint r;
    while (b != 0) {
        r = a % b;
        a = b; 
        b = r;
    }
    return a;
}

lint lcm(lint a, lint b) {
    return (a / gcd(a, b)) * b;
}

lint power(lint x, lint n, lint mod = MOD) {
    lint ret = 1;
    while(n > 0) {
        if(n & 1){
            (ret *= x) %= mod;
        }
        (x *= x) %= mod;
        n >>= 1;
    }
    return ret;
}

vector<lint> make_power(int n, lint base){
    lint num = 1;
    vector<lint> ret;
    for (int i=0; i<=n; ++i){
        ret.push_back(num);
        num *= base;
    }
    return ret;
}

int main()
{
    cin.tie(0);
    ios_base::sync_with_stdio(false);
    int a, b;
    cin >> a>> b;
    if(a >= 13){
        cout << b << endl;
    }
    else if(a >= 6){
        cout << (b/2) << endl;
    }
    else {
        cout << 0 << endl;
    }
    return 0;
}

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

int main() {
  int N;
  cin >> N;
  vector<int> vec(N);
  for(int i = 0;i < N;++i) {
    cin >> vec.at(i);
  }
  sort(vec.begin(), vec.end());
  int a = vec.at(0);
  reverse(vec.begin(), vec.end());
  int b = vec.at(0);
  b = b - a;
  cout << b << endl;
}


Measured memory_bytes: 3592
#include<bits/stdc++.h>
#include<string>
using namespace std;
typedef long long ll;
int main()
{
	string s;
	cin >> s;
	ll x = 0,sum=0;
	for (int i = 0; i < s.size(); i++)
	{
		sum += s[i] - '0';
	}
	if (sum % 9 == 0)
		cout << "Yes";
	else
		cout << "No";
}

Measured memory_bytes: 3696
using namespace std;

#include <iostream>
#include <vector>
#include <set>
#include <string>
#include <algorithm>
#include <utility>
#include <functional>
#include <queue>
#include <cmath>
#include <numeric>
#include <map>
using namespace std;


int main(void){
	long long int N;
    map<pair<string, int>, int> SP;

	cin >> N;

  for (int i = 1; i <= N; i++) {
    string s;
    int p;
    cin >> s >> p;
    
    SP[make_pair(s, 100 - p)] = i;
  }
  
  for (auto i : SP)
    cout << i.second << endl;
	
	return 0;
}


Measured memory_bytes: 256
import sys
int1 = lambda x: int(x) - 1
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(500000)

S = readline().decode().rstrip()
q = int(readline())

head = ""
tail = ""
flip = 0
for _ in range(q):
    que = readline().decode().split()
    if len(que) == 1:
        flip += 1

    else:
        if que[1] == '1':
            if flip % 2 == 0:

                head = ''.join([que[2], head])
            else:
                tail = ''.join([tail, que[2]])

        else:
            if flip % 2 == 0:

                tail = ''.join([tail, que[2]])
            else:
                head = ''.join([que[2], head])

if flip % 2 == 0:
    print(''.join([head, S, tail]))
else:
    print(''.join([tail[::-1], S[::-1], head[::-1]]))


Measured memory_bytes: 4512
#include "bits/stdc++.h"
#define int long long
#define range(i, a, b) for(auto i = a; i < b; i++)
#define rep(i, a) range(i, 0, a)
#define all(a) (a).begin(),(a).end()
using namespace std;
const int MOD = 1e9 + 7, INF = 1e8;
using vi = vector <int>;
using vvi = vector <vi>;

signed main(){
	int m;
	cin >> m;

	cout << 24 + (24 - m ) << endl;

	int ans = 0;


}


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

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

  int n;
  cin >> n;
  vector<int> a(n);
  for (auto &i : a) {
    cin >> i;
  } 
  int ans = 0;
  for (int i = 0; i < n; i++) {
    if (i % 2 == 0 && a[i] % 2 == 1) {
      ans++;
    }
  }
  cout << ans << "\n";
  return 0;
}


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

#define rep(i, n) for(int i = 0; i < (n); ++i)
#define repr(i, n) for(int i = (n-1); i >= 0; --i)

typedef long long ll;
typedef pair<int, int> Pi;

const int MAX = 2 * 1e5 + 5;
const int INF = 1001001001;
const int MOD = 1000000007;

vector<int> G[MAX];
vector<int> D;

void dfs(int n, int c=0) {
    if (D[n] < 0) D[n] = c;
    else return;
    for (int &i : G[n]) {
        dfs(i, 1-c);
    }
}

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

    rep(i, N-1) {
        int a, b;
        cin >> a >> b;
        a--, b--;
        G[a].push_back(b);
        G[b].push_back(a);
    }

    D = vector<int>(N, -1);
    dfs(0);

    vector<int> B, W;
    rep(i, N) {
        if (D[i] == 0) B.push_back(i);
        else W.push_back(i);
    }

    vector<int> ans(N), used(N + 1, false);
    if ((int)B.size() <= N / 3) {
        int num = 3;
        for (int &i : B) {
            ans[i] = num;
            used[num] = true;
            num += 3;
        }
        num = 1;
        rep(i, N) {
            if (ans[i] > 0) continue;
            while (used[num]) num++;
            ans[i] = num;
            used[num] = true;
        }
    } else if ((int)W.size() <= N / 3) {
        int num = 3;
        for (int &i : W) {
            ans[i] = num;
            used[num] = true;
            num += 3;
        }
        num = 1;
        rep(i, N) {
            if (ans[i] > 0) continue;
            while (used[num]) num++;
            ans[i] = num;
            used[num] = true;
        }
    } else {
        int num = 1;
        for (int &i : B) {
            if (num <= N) {
                ans[i] = num;
                num += 3;
            } else {
                num = 3;
                ans[i] = num;
                num += 3;
            }
        }
        if (num % 3 != 0) num = 3;
        for (int &i : W) {
            if (num <= N) {
                ans[i] = num;
                num += 3;
            } else {
                num = 2;
                ans[i] = num;
                num += 3;
            }
        }
    }

    for (int &i : ans) cout << i << " ";
    cout << endl;
}

Measured memory_bytes: 18036
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#define lol(i,n) for(int i=0;i<n;i++)
#define mod 1000000007
typedef long long ll;

using namespace std;
#define X 15
vector<pair<int,int> > v[30];
int cnt;
void make(int a,int b,int len){
    v[a].push_back(make_pair(b,len));
    cnt++;
}
int f(){
    int s=1;
    lol(i,X-1)s*=3;
    return s;
}
int main(){
    cnt=0;
    int n;cin>>n;
    int sum=0;
    int k=f();
    lol(i,X){
	for(int j=1;j<=n/k;j++){
	    make(1,i+2,sum);
	    sum+=k;
	}
	n%=k;
	k/=3;
    }
    k=f()/3;
    lol(i,X-1){
	lol(j,3)make(i+2,i+3,j*k);
	k/=3;
    }
    lol(i,30)for(auto x:v[i])if(x.second>1000000)cnt--;
    cout<<X+1<<" "<<cnt<<endl;
    lol(i,30){
	for(auto x:v[i]){
	    if(x.second>1000000)continue;
	    int a=i,b=x.first;
	    if(a>b)swap(a,b);
	    cout<<a<<" "<<b<<" "<<x.second<<endl;
	}
    }
    return 0;
}


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

int main(void){
    char tmp[1000];
    //????????¢????¨??????????????????????x,y???????????\???
    fgets(tmp,sizeof(tmp),stdin);
    
    //????????¢????¨??????????????????????x,y??????????????????
    int width=atoi(strtok(tmp," "));
    int height=atoi(strtok(NULL," "));
    int circleX=atoi(strtok(NULL," "));
    int circleY=atoi(strtok(NULL," "));
    int radius=atoi(strtok(NULL," "));
    
    //width=20,height=10
    //x=5,y=3,r=4
    if(circleY-radius>=0&&circleX-radius>=0&&width>=circleX+radius&&height>=circleY+radius){
        printf("Yes\n");
    }else{
        printf("No\n");
    }

return 0;
}

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

int main() {
    ios_base::sync_with_stdio(false); cin.tie(0);
    int n;
    while(cin >> n) {
        vector<int> v(n);
        map<int,int> parity;
        for(int i = 0; i < n; i++) {
            cin >> v[i];
            parity[v[i]] = 0;
        }
        int f = 0;
        for(auto &it : parity) {
            it.second = f;
            f = !f;
        }
        int cont = 0;
        for(int i = 0; i < n; i++) {
            if((i&1) != parity[v[i]])
                cont++;
        }
        cout << cont/2 << '\n';
    }
    return 0;
}

Measured memory_bytes: 5376
#include <bits/stdc++.h>
using namespace std;
 
typedef long long ll;
typedef long double ld;
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define FOR(i,l,r) for(ll i=(l); i<(r); i++)
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const ll INF = 1LL << 60;
const int inf = 1001001001;
const ll mod = 1000000007;
using pp=pair<ll,ll>;
 
// union by size + path having
class UnionFind {
public:
   vector <ll> par; // 各元の親を表す配列
   vector <ll> siz; // 素集合のサイズを表す配列(1 で初期化)
 
   // Constructor
   UnionFind(ll sz_): par(sz_), siz(sz_, 1LL) {
       for (ll i = 0; i < sz_; ++i) par[i] = i; // 初期では親は自分自身
   }
   void init(ll sz_) {
       par.resize(sz_);
       siz.assign(sz_, 1LL);  // resize だとなぜか初期化されなかった
       for (ll i = 0; i < sz_; ++i) par[i] = i; // 初期では親は自分自身
  }
 
   // Member Function
   // Find
   ll root(ll x) { // 根の検索
      while (par[x] != x) {
           x = par[x] = par[par[x]]; // x の親の親を x の親とする
       }
       return x;
  }
 
   // Union(Unite, Merge)
   bool unite(ll x, ll y) {
       x = root(x);
       y = root(y);
       if (x == y) return false;
       // merge technique（データ構造をマージするテク．小を大にくっつける)
       if (siz[x] < siz[y]) swap(x, y);
       siz[x] += siz[y];
       par[y] = x;
       return true;
  }
 
  bool same(ll x, ll y) { // 連結判定
       return root(x) == root(y);
  }
 
  ll size(ll x) { // 素集合のサイズ
      return siz[root(x)];
  }
};
 
ll modpow(ll x, ll n) {
   x = x%mod;
   if(n==0) return 1;  //再帰の終了条件
 
   else if(n%2==1) {
       return (x*modpow(x, n-1))%mod;  //nが奇数ならnを1ずらす
   }
   else return modpow((x*x)%mod, n/2)%mod;  //nが偶数ならnが半分になる
}
 
ll com(ll n, ll k) {
   ll x = 1;
   for(int i=n-k+1; i<=n; i++) {
      x = x*i%mod;
   }
 
   ll y = 1;
   for(int i=1; i<=k; i++) {
       y = y*i%mod;
   }
   y = modpow(y, mod-2);
 
   return x*y%mod;
}
 
bool is_prime(const unsigned n){
   switch(n){
       case 0: // fall-through
       case 1: return false;
       case 2: // fall-through
       case 3: return true;
  } // n > 3 が保証された
 
   if(n % 2 == 0 || n % 3 == 0) return false;
   // n は 2 と 3 のいずれの倍数でもないことが保証された
   // これより n は (6の倍数)-1 か (6の倍数)+1 である
 
   // 6の倍数前後の数を使って試し割りをする
   for(unsigned i = 5; i * i <= n; i += 6) {
       if(n % i     == 0) return false; // (6の倍数)-1
       if(n % (i+2) == 0) return false; // (6の倍数)+1
   }
 
   return true;
}
 
int digsum(int n) {
   int res = 0;
   while(n > 0) {
       res += n%10; //ここをres++;に変えたら桁数を求める関数になる
       n /= 10;
   }
   return res;
}
vector<ll> divisor(ll n){
   vector<ll> ret;
   for(ll i = 1 ; i*i <= n ; i++){
       if(n%i == 0){
           ret.push_back(i);
           if(i*i != n) ret.push_back(n/i);
       }
   }
   sort(ret.begin(),ret.end());
   return ret;
}
 
int main(){

    ll n;
    cin >> n;
    ll x=digsum(n);
    if(n%x==0) cout << "Yes" << endl;
    else cout << "No" << endl;
}

Measured memory_bytes: 3576
#!/usr/bin/env python3

import sys
sys.setrecursionlimit(300000)

YES = "Yes"  # type: str
NO = "No"  # type: str

def solve(S: str):
    s = set(S)
    if len(s) > 1:
        ret = YES
    else:
        ret = NO
    print(ret)
    return

def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    S = next(tokens)  # type: str
    solve(S)

if __name__ == '__main__':
    main()


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

int main()
{
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    string s;

    cin >> s;

    if(s[2]==s[3] && s[4]==s[5])
        cout << "Yes" <<endl;
    else
        cout << "No" << endl;

    return 0;
}


Measured memory_bytes: 256
#include<cstdio>
#include<iostream>
#include<algorithm>
#include<cstring>
typedef long long int LL;
using namespace std;
int main()
{
    LL A,B,K,cnt=0,n;
    scanf("%lld%lld%lld",&A,&B,&K);
    n=max(A,B);
    for(LL i=n;i>=1;i--)
    {
        if(A%i==0&&B%i==0)
            cnt+=1;
        if(cnt==K)
        {
            printf("%lld\n",i);
            return 0;
        }
    }
}

Measured memory_bytes: 256
#include<stdio.h>

main(){
  int n,i,j;
  int c[2];
  while(1){

    scanf("%d",&n);
    if(n==0) break;

    int sum[2]={0};

    for(i=0;i<n;i++){
      scanf("%d %d",&c[0],&c[1]);
      if(c[0]>c[1]){
	sum[0]+=c[0]+c[1];
      }
      else if(c[0]<c[1]){
	sum[1]+=c[0]+c[1];
      }
      else{
	for(j=0;j<2;j++)
	  sum[j]+=c[j];
      }
    }

    printf("%d %d\n",sum[0],sum[1]);

  }

  return 0;
}

Measured memory_bytes: 0
#include<bits/stdc++.h>
const int N=500007;
char s[N];
int n,v[N];
bool chk(int M){
	for(int i=1;i<=n;++i)v[i]=s[i]-'0';
	v[n+1]=M;
	for(int i=n;i;--i){
		if(v[i]>v[i+1])return 0;
		int x=(v[i+1]-v[i])/10;
		v[i]+=x*10;
		v[i-1]-=x;
	}
	return 1;
}
int main(){
	scanf("%s",s+1);
	n=strlen(s+1);
	int L=s[n]-'0',R=N*50,M;
	while(L<R)chk(M=L+R>>1)?R=M:L=M+1;
	printf("%d\n",(L+8)/9);
	return 0;
}

Measured memory_bytes: 2688
#include<iostream>
#include<queue>
#include<string>
#include<vector>

using namespace std;
using vs = vector<string>;
using vi = vector<int>;
using vvi = vector<vi>;
using ll = long long;
const int Max = 100000;

int main() {
	ll a, b, c;
	cin >> a >> b >> c;
	int ans = 0;
	if (!(a % 2 == 0 && b % 2 == 0 && c % 2 == 0)) {
		cout << 0 << endl;
		return 0;
	}

	if (a == b &&b == c) {
		cout << -1 << endl;
		return 0;
	}
	while (a % 2 == 0 && b % 2 == 0 && c % 2 == 0) {
		int x = b / 2 + c / 2;
		int y = a / 2 + c / 2;
		int z = a / 2 + b / 2;
		a = x;
		b = y;
		c = z;
		ans++;
	}
	cout << ans << endl;
}

Measured memory_bytes: 256
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

var sc = bufio.NewScanner(os.Stdin)

func nextLine() string {
	sc.Scan()
	return sc.Text()
}

func nextInt() int {
	sc.Scan()
	i, _ := strconv.Atoi(sc.Text())
	return i
}

func nextIntSlice(size int) []int {
	re := make([]int, size)
	for i := 0; i < size; i++ {
		re[i] = nextInt()
	}
	return re
}

func max(a []int) int {
	max := a[0]
	for _, v := range a {
		if v > max {
			max = v
		}
	}
	return max
}

func min(a []int) int {
	min := a[0]
	for _, v := range a {
		if v < min {
			min = v
		}
	}
	return min
}

func abs(n int) int {
	if n < 0 {
		return -n
	}
	return n
}

func main() {
	sc.Split(bufio.ScanWords)
	n, m := nextInt(), nextInt()
	a := make([]int, n)
	b := make([]int, n)
	c := make([]int, m)
	d := make([]int, m)
	for i := 0; i < n; i++ {
		a[i], b[i] = nextInt(), nextInt()
	}
	for i := 0; i < m; i++ {
		c[i], d[i] = nextInt(), nextInt()
	}

	for i := 0; i < n; i++ {
		minj := 0
		mindist := abs(a[i]-c[0]) + abs(b[i]-d[0])
		for j := 1; j < m; j++ {
			tempdist := abs(a[i]-c[j]) + abs(b[i]-d[j])
			if tempdist < mindist {
				minj = j
				mindist = tempdist
			}
		}
		fmt.Println(minj + 1)
	}
}


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

template <class T>
inline void read(T &res)
{
	char ch; bool flag = false; res = 0;
	while (ch = getchar(), !isdigit(ch) && ch != '-');
	ch == '-' ? flag = true : res = ch ^ 48;
	while (ch = getchar(), isdigit(ch))
		res = res * 10 + ch - 48;
	flag ? res = -res : 0;
}

template <class T>
inline void put(T x)
{
	if (x > 9)
		put(x / 10);
	putchar(x % 10 + 48);
}

template <class T>
inline void CkMax(T &x, T y) {x < y ? x = y : 0;}
template <class T>
inline void CkMin(T &x, T y) {x > y ? x = y : 0;}
template <class T>
inline T Max(T x, T y) {return x > y ? x : y;}
template <class T>
inline T Min(T x, T y) {return x < y ? x : y;}

const int N = 1e5 + 5;
int n, ans;

struct seg
{
	int l, r;

	seg() {}
	seg(int L, int R):
		l(L), r(R) {}

	inline int len()
	{
		return r >= l ? r - l + 1 : 0;
	}

	inline void scan()
	{
		read(l);
		read(r);
	}

	inline bool operator < (const seg &a) const
	{
		return r < a.r || r == a.r && l > a.l;
	}

	inline seg operator & (const seg &a) const 
	{
		return seg(Max(l, a.l), Min(r, a.r));
	}
}p[N], pre[N], suf[N];

inline void solve()
{
	pre[0] = seg(1, 1e9);
	for (int i = 1; i <= n; ++i)
		pre[i] = pre[i - 1] & p[i];
	suf[n + 1] = seg(1, 1e9);
	for (int i = n; i >= 1; --i)
		suf[i] = suf[i + 1] & p[i];
	for (int i = 1; i < n; ++i)
		CkMax(ans, pre[i].len() + suf[i + 1].len());
	for (int i = 1; i <= n; ++i)
		CkMax(ans, (pre[i - 1] & suf[i + 1]).len() + p[i].len());
}

int main()
{
	read(n);
	for (int i = 1; i <= n; ++i)
		p[i].scan();

	std::sort(p + 1, p + n + 1);
	solve();
	for (int i = n; i >= 1; --i)
	{
		p[i].l = 1e9 - p[i].l + 1;
		p[i].r = 1e9 - p[i].r + 1;
	}

	std::sort(p + 1, p + n + 1);
	solve();
	for (int i = 1; i <= 100; ++i)
	{
		for (int j = 1; j <= 100; ++j)
			std::swap(p[1ll * rand() * rand() % n + 1], p[1ll * rand() * rand() % n + 1]);
		solve();
	}
	
	printf("%d\n", ans);

	return 0;
}

Measured memory_bytes: 2560
#include "iostream"
#include "vector"
#include "string"
#include "algorithm"
#include "math.h"
#include "cstring"
#include "stack"
#include "queue"

using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<vector<int> > mat;

int main()
{
  int n;
  cin >> n;
  double x[11];
  string u[11];
  double ans = 0;
  for (int i = 0; i < n; i++)
  {
    cin >> x[i] >> u[i];
    if (u[i] == "BTC")
    {
      x[i] *= 380000.0;
    }
    ans += x[i];
  }
  printf("%.6f\n", ans);
}

Measured memory_bytes: 256
#include <iostream>
#include <map>
#include <vector>
#include <algorithm>
using namespace std;
int main(){
    int ans = 0;
    int N;
    cin>>N;
    map<int, int>mp;
    vector<int>vec(N);
    for(int i=0;i<N;i++){
        cin>>vec[i];
        mp[vec[i]]++;
    }
    sort(vec.begin(), vec.end(), greater<int>());
    for(int i=0;i<vec.size();i++){
        int a = vec[i];
        if(mp[a]==0)continue;
        int b;
        for(int t = 1;t <= a;b=t-a)t*=2;
        if(mp[b]==0)continue;
        if(a==b && mp[a]==1)continue;
        ans++;
        mp[a]--;
        mp[b]--;
    }
    cout<<ans<<endl;
    return 0;
}

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

//repetition
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i, n) for(int i = 0; i < (int)(n); i++)

//container util
#define all(x) (x).begin(),(x).end()

//typedef
typedef long long ll;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<ll> VLL;
typedef vector<VLL> VVLL;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef pair<ll, ll> PLL;


//conversion
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}


int main(){
  ll Q,H,S,D,N;
  cin >> Q >> H >> S >> D;
  cin >> N;
  ll one = min(Q*4,min(H*2,S));
  ll ans = 0;
  if(one*2 > D){
    ans += N/2 * D;
    N = N%2;
  }
  ans += N * one;
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define RI register int
const int mod=1e9+7,N=2005;
int n,m,K,ans,f[N<<1][N][2],s[N];
int qm(int x) {return x>=mod?x-mod:x;}
int main()
{
//	freopen("84.in","r",stdin);
//	freopen("84.out","w",stdout); 
    scanf("%d%d%d",&n,&m,&K);
    f[0][0][0]=1;
    for(RI i=1;i<=max(n,m)*2;++i) {
        s[0]=qm(f[i-1][0][0]+f[i-1][0][1]);
        for(RI j=1;j<=n;++j)
            s[j]=qm(s[j-1]+qm(f[i-1][j][0]+f[i-1][j][1]));
        for(RI j=0;j<=n;++j) {
            f[i][j][0]=qm(s[j]-s[j-1]+mod);
            if(j) f[i][j][1]=qm(s[j-1]-(j-K>=0?s[j-K]:0)+mod);
        }
        for(RI j=0;j<=n;++j)
            if(j%(K-1)==n%(K-1)&&(i*(K-1)-j+1)%(K-1)==m%(K-1)&&i*(K-1)-j+1<=m)
                ans=qm(ans+f[i][j][1]);
    }
    printf("%d\n",ans);
    return 0;
}

Measured memory_bytes: 62976
#include <vector>
#include <cstdio>
#define M(x,y)push_back(make_pair(x,y))
using namespace std;
main(){
	int n,x,i,q;
	pair<int,int> p;
	for(;scanf("%d%d",&n,&x),n;printf("%d\n",x)){
		vector<pair<int,int> >v;
		v.M(x,1);
		for(i=1;i<n;i++)
			if(p=v.back(),scanf("%d",&x),x==p.first)v.back().second++;
			else if(i&1){
				if(v.pop_back(),q=0,v.size())q=v.back().second,v.pop_back();
				v.M(x,q+p.second+1);
			}else v.M(x,1);
		for(x=i=0;i<v.size();i++)if(!v[i].first)x+=v[i].second;
	}
}

Measured memory_bytes: 1032
#include <bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define R cin>>
#define Z class
#define ll long long
#define ln cout<<'\n'
#define in(a) insert(a)
#define pb(a) push_back(a)
#define pd(a) printf("%.10f\n",a)
#define mem(a) memset(a,0,sizeof(a))
#define all(c) (c).begin(),(c).end()
#define iter(c) __typeof((c).begin())
#define rrep(i,n) for(ll i=(ll)(n)-1;i>=0;i--)
#define REP(i,m,n) for(ll i=(ll)(m);i<(ll)(n);i++)
#define rep(i,n) REP(i,0,n)
#define tr(it,c) for(iter(c) it=(c).begin();it!=(c).end();it++)
template<Z A>void pr(A a){cout<<a;ln;}
template<Z A,Z B>void pr(A a,B b){cout<<a<<' ';pr(b);}
template<Z A,Z B,Z C>void pr(A a,B b,C c){cout<<a<<' ';pr(b,c);}
template<Z A,Z B,Z C,Z D>void pr(A a,B b,C c,D d){cout<<a<<' ';pr(b,c,d);}
template<Z A>void PR(A a,ll n){rep(i,n){if(i)cout<<' ';cout<<a[i];}ln;}
ll check(ll n,ll m,ll x,ll y){return x>=0&&x<n&&y>=0&&y<m;}
const ll MAX=1e9+7,MAXL=1LL<<61,dx[4]={-1,0,1,0},dy[4]={0,1,0,-1};
typedef pair<ll,ll> P;

void Main() {
  ll n;
  R n;
  P a[n];
  rep(i,n) cin >> a[i].F >> a[i].S;
  set<P> s;
  rep(i,n) s.in(a[i]);
  ll ans=MAX;
  rep(x,n) {
    REP(y,x+1,n) {
      ll p=a[y].F-a[x].F,q=a[y].S-a[x].S;
      ll d=0;
      rep(i,n) {
        if(!s.count(P(a[i].F-p,a[i].S-q))) d++;
      }
      ans=min(ans,d);
    }
  }
  if(n==1) ans=1;
  pr(ans);
}

int main(){ios::sync_with_stdio(0);cin.tie(0);Main();return 0;}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define rep(i, n) for (ll i = 0; i < n; i++)
vector<ll> to[300005];
vector<ll> memo;
vector<ll> done;
ll d = 0;
ll dfs(ll u, ll v)
{
    if (done[u] != 0)
    {
        d = v;
        return u; //繰り返しのスタートがu;その時v回目の到着だった。
    }
    else
    {

        memo[u] = v;
        done[u] = 1;
        return dfs(to[u][0], v + 1);
    }
}
int main()
{
    ll n, k;
    cin >> n >> k;
    memo.resize(n, 0);
    done.resize(n, 0);
    rep(i, n)
    {
        ll a = 0;
        cin >> a;
        a--;
        to[i].push_back(a);
    }
    ll b = 0;
    b = dfs(0, 0); //それぞれの頂点に何回テレポートしたらいけるかを記録する。最終的に0に戻ってきたら終了
    ll c = 0;
    c = d - memo[b]; //これが周期。
    ll h = 0;
    if (k < memo[b])
    {
        h = k;
    }
    else
    {
        h = (k - memo[b]) % c + memo[b];
    }
    rep(i, n)
    {
        if (memo[i] == h)
        {
            cout << i + 1 << endl;
            break;
        }
    }
}

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

double A, B;
double H, M;
double aH, aM, ang;
double C;

int main()
{
	cin >> A >> B >> H >> M;
	aH = (30.0 * H + 0.5 * M);
	aM = (6.0 * M);
	ang = fabs(aM - aH) * acos(-1.0) / 180;
	C = sqrt(A * A + B * B - 2.0 * A * B * cos(ang));
	printf("%.16lf", C);
//	system("pause");
	return 0;
}

Measured memory_bytes: 4188
function main(input: string) {
  const [N, K, X, Y] = input.split("\n").map((elm: string) => Number(elm));
  if (N <= K) {
    console.log(X * N);
  } else {
    console.log(X * K + Y * (N - K));
  }
}

main(require("fs").readFileSync("/dev/stdin", "utf8"));


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

int main() {
  int h ,w;
  cin >> h >> w;

  char c[120][120];

  for(int i = 0; i  < h; i++) {
    for(int j = 0; j < w; j++) {
      cin >> c[i][j];
    }
  }

  for(int i  = 0; i < h; i++) {
    bool f = false;
    for(int j = 0; j < w; j++) {
      cout << c[i][j];
    }
    cout << endl;
    for(int j = 0; j < w; j++) {
      cout << c[i][j];
    }
    cout << endl;
  }

  return 0;
}


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

const int MOD=1000000007;

int main(){
  int i,j,cnt=0;
  int n;
  cin>>n;
  int a[n];
  for(i=0;i<n;i++)cin>>a[i];
  for(i=0;i<n;i++){
    if((a[i]+n)%2==0){
      cout<<0<<endl;
      return 0;
    }
  }
  if(n%2==0){
    int b[n/2];
    for(i=0;i<n/2;i++)b[i]=0;
    for(i=0;i<n;i++){
      b[(n-1-a[i])/2]++;
    }
    for(i=0;i<n/2;i++){
      if(b[i]!=2){
        cout<<0<<endl;
        return 0;
      }
    }
    int prod=1;
    for(i=0;i<n/2;i++){
      prod=prod*2%MOD;
    }
    cout<<prod<<endl;
  }else{
    int b[n/2+1];
    for(i=0;i<n/2+1;i++)b[i]=0;
    for(i=0;i<n;i++){
      b[(n-1-a[i])/2]++;
    }
    for(i=0;i<n/2;i++){
      if(b[i]!=2){
        cout<<0<<endl;
        return 0;
      }
    }
    if(b[n/2]!=1){
      cout<<0<<endl;
      return 0;
    }
    int prod=1;
    for(i=0;i<n/2;i++){
      prod=prod*2%MOD;
    }
    cout<<prod<<endl;
  }
}

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

int main(){
    cin.tie(0);
    int a,b,c,ans=0;
    cin >> a >> b >> c;

    ans=a-b;
    c-=ans;

    if(c<0){
        cout << 0 << endl;
        return 0;
    }
    cout << c << endl;
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>
#define rep(i, a) for(int i = 0; i < a; ++i)
 
int main(void) {
  char s[1500];
  int i, j = 0;
  while(scanf("%s", s) != EOF) {
    if(j) printf(" ");
    else j = 1;
    rep(i, strlen(s)) {
      if(s[i] >= 'a' && s[i] <= 'z') printf("%c", s[i] + 'A' - 'a');
      else if(s[i] >= 'A' && s[i] <= 'Z') printf("%c", s[i] + 'a' - 'A');
      else printf("%c", s[i]);
    }
  }
  printf("\n");
  return 0;
}


Measured memory_bytes: 2044
from collections import Counter,defaultdict,deque
from heapq import heappop,heappush,heapify
import sys,bisect,math,itertools,fractions,pprint
sys.setrecursionlimit(10**8)
mod = 10**9+7
INF = float('inf')
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))
def inpln(n): return list(int(sys.stdin.readline()) for i in range(n))

s = input()
n = len(s)
res = 0
cnt = 0
for t in s:
    if t == 'S':
        cnt += 1
    else:
        if cnt > 0:
            cnt -= 1
        else:
            res += 1
print(res+cnt)

Measured memory_bytes: 67416
// Copyright lzt
#include<stdio.h>
#include<cstring>
#include<cstdlib>
#include<algorithm>
#include<vector>
#include<map>
#include<set>
#include<cmath>
#include<iostream>
#include<queue>
#include<string>
#include<ctime>
using namespace std;
typedef long long ll;
typedef std::pair<ll, ll> pii;
typedef long double ld;
typedef unsigned long long ull;
typedef std::pair<long long, long long> pll;
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define rep(i, j, k)  for (register ll i = (ll)(j); i <= (ll)(k); i++)
#define rrep(i, j, k) for (register ll i = (ll)(j); i >= (ll)(k); i--)
#define Debug(...) fprintf(stderr, __VA_ARGS__)

inline ll read() {
  ll x = 0, f = 1;
  char ch = getchar();
  while (ch < '0' || ch > '9') {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while (ch <= '9' && ch >= '0') {
    x = 10 * x + ch - '0';
    ch = getchar();
  }
  return x * f;
}

const ll maxn = 200200;
ll n;
ll h[maxn], a[maxn];
ll f[maxn];

struct Node {
  ll l, r;
  ll val;
} tr[maxn << 2];

#define lc (i << 1)
#define rc (i << 1 | 1)
void build(ll i, ll l, ll r) {
  tr[i].l = l; tr[i].r = r;
  if (l == r) return;
  ll md = (l + r) >> 1;
  build(lc, l, md); build(rc, md + 1, r);
}
ll ask(ll i, ll l, ll r) {
  if (tr[i].l >= l && tr[i].r <= r) return tr[i].val;
  if (tr[i].l > r || tr[i].r < l) return 0;
  return max(ask(lc, l, r), ask(rc, l, r));
}
void update(ll i, ll p, ll v) {
  if (tr[i].l == tr[i].r) {
    tr[i].val = v;
    return;
  }
  ll md = (tr[i].l + tr[i].r) >> 1;
  if (p <= md) update(lc, p, v);
  else update(rc, p, v);
  tr[i].val = max(tr[lc].val, tr[rc].val);
}

void work() {
  n = read();
  rep(i, 1, n) h[i] = read();
  rep(i, 1, n) a[i] = read();
  ll mx = 0;
  build(1, 1, n);
  rep(i, 1, n) {
    f[i] = ask(1, 1, h[i]) + a[i];
    mx = max(mx, f[i]);
    update(1, h[i], f[i]);
  }
  cout<<mx<<endl;
}

int main() {
  #ifdef LZT
    freopen("in", "r", stdin);
  #endif

  work();

  #ifdef LZT
    Debug("My Time: %.3lfms\n", (double)clock() / CLOCKS_PER_SEC);
  #endif
}


Measured memory_bytes: 19584
import java.io.InputStream;
import java.io.PrintStream;
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        solve(System.in, System.out);
    }

    static void solve(InputStream is, PrintStream os) {
        // Your code here!
        Scanner scan = new Scanner(is);
        int N = scan.nextInt();
        int A[] = new int[N];
        int B[] = new int[N];
        int C[] = new int[N-1];
        for(int i = 0; i < N ; i++) {
            A[i] = scan.nextInt() - 1;
        }
        for(int i = 0; i < N ; i++) {
            B[i] = scan.nextInt();
        }
        for(int i = 0; i < N-1 ; i++) {
            C[i] = scan.nextInt();
        }

        long answer = 0;
        answer += B[A[0]];
        for(int i = 1; i < N; i++) {
            answer += B[A[i]];
            if(A[i] == A[i-1] +1) {
                answer += C[A[i-1]];
            }
        }
        os.println(answer);


    }
}

Measured memory_bytes: 21844
#include<bits/stdc++.h>
using namespace std;
typedef long long LL;
#define pb push_back
#define mp make_pair
#define fastio ios_base::sync_with_stdio(0), cin.tie(0)
#define debug(x) cout << x << endl
const int INF = 1e9;
const LL INF64 = 1e18;

const int NMAX = 1e5 + 5;

LL power(LL a, LL b){
	LL res = 1;
	while(b){
		if(b & 1) res = res * a;
		b >>= 1;
		a = a * a;
	}
	return res;
}

int main(){
	LL a, b, c, k;
	cin >> a >> b >> c >> k;
	LL mx = max(max(a, b),c);
	LL sum = a + b + c - mx;
	sum += power(2, k) * mx;
	cout << sum << endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <stdio.h>
#include <string>
using namespace std;
int main() {
  int n; cin >> n;
  string s; cin >> s;
  int cnt = 0;
  for(int i; i<n-1; i++){
  	if ( s.at(i) != s.at(i+1) )  cnt++;
  }
  cout << cnt + 1 << endl;
}

Measured memory_bytes: 512
//e4 - e5 - f4
//#include <boost/multiprecision/cpp_int.hpp> 
#include "bits/stdc++.h"
#include "ext/pb_ds/assoc_container.hpp"
#include "ext/pb_ds/tree_policy.hpp"
typedef long long int ll;
typedef double db;
// __int128 s128;
// __uint128_t u128;
typedef unsigned long long u64;
#define int long long int
#define P 1000000007
#define Q 1000000006
#define sz(a) (ll)a.size()
#define lt(a) (ll)a.length()
#define pll pair<ll,ll>
#define f(i,a,b) for(ll i=(ll)a;i<(ll)b;i++)
#define bac(i,a,b) for(ll i=(ll)a;i>=(ll)b;i--)
#define mll map<ll,ll>
#define umll unordered_map<ll,ll>
#define vl vector<ll>
#define vvl vector<vector<ll>>
#define mt make_tuple
#define eb emplace_back
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define all(a) a.begin(),a.end()
#define F first
#define S second
#define teevra_gati ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define N 100005
#define PI 3.14159265359
#define inf LLONG_MAX
//using namespace boost::multiprecision; 
using namespace __gnu_pbds;
using namespace std;

void solve(){
    ll x,y1=200,y2=-1,n;
    cin>>x>>n;
    mll m;
    f(i,0,n){
        ll p;
        cin>>p;
        m[p]++;
    }
    f(i,x, x+150) if(m.count(i)==0){y1=i; break;}
    bac(i,x-1,x-150) if(m.count(i)==0){y2=i; break;}
    if(abs(y1-x) < abs(y2-x)) cout<<y1;
    else cout<<y2;
}

signed main() {
    teevra_gati
        
    solve();

    return 0;
}

Measured memory_bytes: 3632
N,M = map(int, input().split())

if N % 2 == 1:
    for i in range(M):
        print(i+1,N-i)
else:
    M1 = -(-M//2)
    M2 = M - M1
    for j in range(M1):
        print(j+1,N-j)
    for k in range(M2):
        print(int(N/2-1-k),int(N/2+1+k))

Measured memory_bytes: 9276
#include<iostream>
#include <vector>
#include <cstdlib>
using namespace std;

long long max_2(long long a, long long b){
    if (a < b){
        return b;
    }else{
        return a;
    }
}

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

    long long dp[W+1];

    long long w,v;

    for (int i = 0; i < W+1; ++i) {
        dp[i]=0;
    }

    for (int i = 1; i < N+1; ++i) {
        cin >> w >> v;

        for (int j = W; j > w-1; --j) {
            dp[j]=max_2(dp[j],dp[j-w]+v);
        }
    }

    cout << dp[W] << endl;
    return 0;
}

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

int main()
{
    int n;
    cin>>n;
    int arr[n+5];
    for(int i=0;i<n;i++)cin>>arr[i];
    long long sum=0;
    sort(arr,arr+n);
    for(int i=0;i<n;i++)
    {
        if(i==n-1)
        {
            sum+=(arr[i]/2);
        }
        else sum+=arr[i];
    }
    cout<<sum<<endl;
}


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

template<typename T>
void printVec(vector<T> vec) {
  cout << "[";
  for(auto& v : vec) {
    cout << v << ",";
  }
  cout << "]" << endl;
}

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

  if (s == u) a -= 1;
  if (t == u) b -= 1;

  cout << a << " " << b;

  return 0;
}


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

int main(){
	string a;
	cin >> a;
	if (a == "A") cout << "T" << endl;
	else if (a == "T") cout << "A" << endl;
	else if (a == "G") cout << "C" << endl;
	else cout << "G" << endl;
}


Measured memory_bytes: 256
#pragma GCC optimize("O3")
#include<bits/stdc++.h>
using namespace std;
// Begin Template IO/Utility
#define dbg(...) cerr << "(" << #__VA_ARGS__ << "):", dbg_out(__VA_ARGS__)
void dbg_out(){
	cerr<<endl;
}
template<typename Head, typename... Tail> void dbg_out(Head H, Tail... T){
	cerr<<' '<< H; 
	dbg_out(T...);
}
template<typename T> ostream& operator<<(ostream &os, const vector<T> &V){
	os<<'[';
	for(int i=0;i<(int)V.size();i++)
		os<<V[i]<<",]"[i==(int)V.size()-1];
	return os;
}
template<typename T> istream& operator>>(istream &is, vector<T> &V){
	for(T &x:V)
		is>>x;
	return is;
}
template<typename T, typename U> ostream& operator<<(ostream &os, const pair<T,U> &p){
	os<<'{'<<p.first<<','<<p.second<<'}';
	return os;
}
template<typename T, typename U> istream& operator>>(istream &is, pair<T,U> &p){
	is>>p.first>>p.second;
	return is;
}
// End Template IO/Utility
int const MAXN=100100;
int cnt[MAXN];
int solve(){
	int n;
	long long sum=0LL;
	cin>>n;
	for(int i=0;i<n;i++){
		int tmp;
		cin>>tmp;
		cnt[tmp]++;
		sum+=tmp;
	}
	int q;
	cin>>q;
	while(q--){
		long long int a, b;
		cin>>a>>b;
		cnt[b]+=cnt[a];
		sum-=cnt[a]*a;
		sum+=cnt[a]*b;
		cnt[a]=0;
		cout<<sum<<endl;
	}
	return 0;
}
int main(){
	cin.tie(0),cin.sync_with_stdio(0),cout.tie(0),cout.sync_with_stdio(0);
	int T=1;
	//cin>>T;
	while(T--){
		solve();
	}
}


Measured memory_bytes: 3972