akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
using namespace std;
int main(){
    int a,b;
    cin >> a >> b;
    while (a!=0 || b!=0){
        if (a < b)
            cout << a << " " << b << endl;
        else
            cout << b << " " << a << endl;
        cin >> a >> b;
    }
}

Measured memory_bytes: 1160
#include <iostream> 
#include <cmath>
using namespace std; 
  int main(){
  long long 	int a,b;
  	cin>>a>>b;
  long	int k=(a+b)/2;
  	if(abs(a-k)==abs(b-k)){
  		cout<<k<<endl;
	  }
	  else
	  cout<<"IMPOSSIBLE"<<endl;
	  return 0;
  }


Measured memory_bytes: 888
#include <iostream>
#include <vector>
#define inc 1
#define dec -1
#define init 0


using  namespace std;

int main() {

    int N;
    cin >> N;
    vector<long long> A(N);
    for (int i = 0; i <N ; ++i) cin >> A[i];

    int c = 0;
    long long pa = A[0];
    int j = init;
    int pj = init;
    for (int k = 1; k <N ; ++k) {
        if(pa < A[k]){
            j = inc;

        }else if(pa > A[k]){
            j = dec;
        }else{
            pj = j;
            pa = A[k];
            continue;
        }


        if (j != pj && pj != init){
            c++;
            j = init;
        }
        pa = A[k];
        pj = j;


    }

    cout << ++c;
    return 0;
}

Measured memory_bytes: 1024
#include <stdio.h>


void swap(int *x,int *y) {
    
    int tmp;
    
    tmp = *x;
    *x = *y;
    *y = tmp;
    
}

int main(int argc, const char * argv[]) {
    
    int x,y;
    
    while (1) {
        
        
        scanf("%d %d",&x,&y);
        
        if (x == 0 && y == 0) {
            break;
        }
        
        if (x > y) {
            swap(&x, &y);
        }
        
        printf("%d %d\n",x,y);
    }
    
    return 0;
}

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

int main(void) {
int N,M;
scanf("%d %d",&N,&M);
int sum=0;
int sum1=0;
for (int i=N-1;i>0;i--){
    sum+=i;
}
for (int i=M-1;i>0;i--){
    sum1+=i;
}
if (M>1){
printf("%d",sum+sum1);
}
else printf("%d",sum);
 return EXIT_SUCCESS;
}


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

int main()
{
	int x;
  cin>>x;
  int ans=0;
    int coins;
  while(x/500>=1||x/5>=1)
  {
  	if(x/500>=1)
    {
       coins=x/500;
       ans=ans+coins*1000;
      x=x-coins*500;
    }
    else if(x/5>=1)
    {
      coins=x/5;
      ans=ans+coins*5;
      x=x-coins*5;
    }
  }
  cout<<ans<<endl;
}


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

typedef long long ll;

const int N = 1005;
const int H = 10005;
int h, n, a, c;
int dp[H];

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

    int res = INT_MAX;
    memset(dp, 0x3f, sizeof dp);
    dp[0] = 0;
    cin >> h >> n;
    for (int i = 0; i < n; ++i) {
        cin >> a >> c;
        for (int k = 0; k <= h; ++k) {
            if (dp[k] != 0x3f3f3f3f) {
                if (k + a >= h)
                    res = min(res, dp[k] + c);
                else
                    dp[k + a] = min(dp[k + a], dp[k] + c);
            }
        }
    }

    cout << res << endl;

    return 0;
}



Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#include<deque>
#include<queue>

using namespace std;

using lli = long long int;
using ulli = unsigned long long int;

//#define EVEL 1

#ifndef EVEL
#define dbug(X) std::cout << #X << ":" <<X<<" " ;
#define dbugf(s) std::cout << s << " ";
#define dbugln std::cout<<"\n";
#else
#define dbug(X) {}
#define dbugf(s) {}
#define dbugln {}
#endif

typedef pair<int, int> P;

int N, a, b, ret, W = 0, B = 0;
vector <int> G[100010];
queue <int> Q;
int d1[100010], dN[100010];

void ds1(){
	for(int i = 1; i <= N; i++) d1[i] = 9999999;
	priority_queue<P, vector<P>, greater<P>> que;
	d1[1] = 0;
	que.push(P(0, 1));
	while(!que.empty()){
		P p = que.top(); que.pop();
		int v = p.second;
		if(d1[v] < p.first) continue;
		for(auto i :G[v]){
			if(d1[i] > d1[v]+1){
				d1[i] = d1[v]+1;
				que.push(P(d1[i], i));
			}
		}
	}
}

void dsN(){
	for(int i = 1; i <= N; i++) dN[i] = 9999999;
	priority_queue<P, vector<P>, greater<P>> que;
	dN[N] = 0;
	que.push(P(0, N));
	while(!que.empty()){
		P p = que.top(); que.pop();
		int v = p.second;
		if(dN[v] < p.first) continue;
		for(auto i :G[v]){
			if(dN[i] > dN[v]+1){
				dN[i] = dN[v]+1;
				que.push(P(dN[i], i));
			}
		}
	}
}

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

	cin >> N;
	for(int i = 0; i < N-1; i++){
		cin >> a >> b;
		G[a].push_back(b);
		G[b].push_back(a);
	}
	ds1(); dsN();
	for(int i = 1; i <= N; i++){
		if(d1[i] <= dN[i]){
			B++;
		}else if(d1[i] > dN[i]){
			W++;
		}
	}

	if(B > W){
		cout << "Fennec\n";
	}else if (B < W){
		cout << "Snuke\n";
	}else{
		if(d1[N]%2 == 0) cout << "Fennec\n";
		else cout << "Snuke\n";
	}

  return 0;
}


Measured memory_bytes: 7024
#[allow(unused_macros)]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };

    ($next:expr, mut $var:ident : $t:tt $($r:tt)*) => {
        let mut $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, bytes) => {
        read_value!($next, String).into_bytes()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}
fn main() {
    input!{
        n: usize,
        k: i64,
        a: [i64;n],
    }
    let mut dp:Vec<Vec<i64>> = vec![vec![-1;2];100];
    dp[0][0] = 0;
    for d in 0..50 {
        let mask:i64 = 1<<(50 - d- 1);
        let mut num = 0;
        for i in 0..n {
            if a[i]&mask != 0 {
                num+=1;
            }
        }
        let cost0 = mask*num;
        let cost1 = mask*(n as i64 - num);
        if dp[d][1] != -1 {
            dp[d+1][1] = std::cmp::max(dp[d+1][1], dp[d][1] + std::cmp::max(cost0, cost1));
        }
        if dp[d][0] != -1 {
            if k & mask != 0 {
                dp[d+1][1] = std::cmp::max(dp[d+1][1], dp[d][0] + cost0);
            }
        }
        if dp[d][0] != -1 {
            if k & mask != 0 {
                dp[d+1][0] = std::cmp::max(dp[d+1][0], dp[d][0] + cost1);
            }else{
                dp[d+1][0] = std::cmp::max(dp[d+1][0], dp[d][0] + cost0);
            }
        }
    }
    // println!("{:?}", dp);
    println!("{}", std::cmp::max(dp[50][0], dp[50][1]));
}

Measured memory_bytes: 4352
S=input()
if S=='SUN':
    print(7)
elif S=='MON':
    print(6)
elif S=='TUE':
    print(5)
elif S=='WED':
    print(4)
elif S=='THU':
    print(3)
elif S=='FRI':
    print(2)
else:
    print(1)

Measured memory_bytes: 2940
#include<iostream> 
#include <algorithm>
#include <vector>
#include <cstdlib>
#include <sstream>
#include <vector>

using namespace std;
#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++)


int main() {
	int h,w,i=0,j=0;
	cin >> h>>w;
	vector<string> s(0);
	string str;
	string st;
	getline(cin, st);
	rep(i, h) {

		getline(cin, str);
		s.push_back(str);
	}
	rep(i, w + 2) {
		cout << "#";
	}
	cout << "\n";
	rep(i, s.size()) {
		cout << "#" << s.at(i) << "#" << endl;
	}
			
		
		rep(i,w+2){
			cout << "#";
		}
	
	

	cout << "\n";

	return 0;
}

Measured memory_bytes: 3596
import java.util.*;

public class Main {
	Scanner sc = new Scanner(System.in);
	final int MOD = 998244353;
	final int MAX = Integer.MAX_VALUE;
	final long LMAX = Long.MAX_VALUE;
	int len = (int)1e6 + 1;
	
	
	void doIt() {
		int N = sc.nextInt();
		int A[] = new int[N];
		for(int i = 0; i < N; i++) {
			A[i] = sc.nextInt();
		}
		Map<Integer, Long> L = new HashMap<>();
		Map<Integer, Long> R = new HashMap<>();
		for(int i = 0; i < N; i++) {
			
			int l = i + A[i];
			if(L.containsKey(l)) {
				L.put(l, L.get(l) + 1);
			}
			else {
				L.put(l, 1l);
			}

			int r = i - A[i];
			if(R.containsKey(r)) {
				R.put(r, R.get(r) + 1);
			}
			else {
				R.put(r, 1l);
			}
		}
		long sum = 0;
		for(int i : L.keySet()) {
			if(R.containsKey(i)) {
				sum += L.get(i) * R.get(i);
			}
		}
		System.out.println(sum);
	}
	
	
	public static void main(String[] args) {
		new Main().doIt();
	}

}


Measured memory_bytes: 76148
#include <iostream>
#include <vector>
#include <string>
#include <map>
#include <set>
#include <algorithm>
#include <cmath>
#include <iomanip>

using namespace std;

#define REP(i,n) for(ll (i) = (0); (i) < (n); ++i)
#define PB push_back
#define MP make_pair
#define FI first
#define SE second
#define ALL(v) v.begin(),v.end()
#define INF 1100000000
#define LLINF 1000000000000000000LL
#define MOD 1000000007
#define Decimal fixed << setpresicion(20)


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


ll dist[2600];
int main()
{
  ll N, M, P; cin >> N >> M >> P;
  vector<vector<pair<ll, ll>>> v(N);
  REP(i, M) {
    ll a, b, c; cin >> a >> b >> c;
    a--; b--;
    v[a].PB(MP(b, -(c-P)));
  }

  REP(i, 2600) dist[i] = LLINF;
  dist[0] = 0;
  REP(i, N - 1) {
    REP(j, N) {
      if (dist[j] == LLINF) continue;
      for (auto e : v[j]) {
        if (dist[e.first] > dist[j] + e.second) {
          dist[e.first] = dist[j] + e.second;
        }
      }
    }
  }

  vector<bool> ng(N, false);
  REP(i, N - 1) {
    REP(j, N) {
      if (dist[j] == LLINF) continue;
      for (auto e : v[j]) {
        if (dist[e.first] > dist[j] + e.second) {
          dist[e.first] = dist[j] + e.second;
          ng[e.first] = true;
        }
        if (ng[j]) ng[e.first] = true;
      }
    }
  }
  if (ng[N-1]) cout << "-1" << endl;
  else cout << max(0LL, -dist[N-1]) << endl;

  return 0;
}


Measured memory_bytes: 640
#include <iostream>
#include <string>
#include <algorithm>

using namespace std;

int main(void){

    int N, M;
    cin >> N >> M;

    long long X[N];
    long long Y[M];
    long long l_mod = 1e9+7;

    for(int i=0;i<N;i++){
        cin >> X[i];
    }
    for(int i=0;i<M;i++){
        cin >> Y[i];
    }
    sort(X, X+N);
    sort(Y, Y+M);

    long long vert=0;
    long long hori=0;

    for(int i=0;i<N-1;i++){
        vert = (vert + (X[i+1] - X[i]) * (N-i-1) * (i + 1)) % l_mod;
    }
    for(int i=0;i<M-1;i++){
        hori = (hori + (Y[i+1] - Y[i]) * (M-i-1) * (i + 1)) % l_mod;
    }
    long long ans = 0;
    ans = (vert * hori) % l_mod;
    cout << ans << endl;

    return 0;
}

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

int p[100010], size;

bool isPrime(int x){
	for(int i=0;i<size && p[i]<=sqrt(x);i++){
		if(x % p[i] == 0) return false;
	}
	return true;
}

int main(void){
	int n;

	p[0] = 2;
	size = 1;
	for(int i=3;i<1299730;i+=2) if(isPrime(i)) p[size++] = i;

	while(cin>>n && n){
		int i;
		for(i=0;p[i]<n;i++);

		if(p[i] == n) cout<<"0\n";
		else cout<<p[i] - p[i-1]<<endl;
	}

	return 0;
}

Measured memory_bytes: 1252
#include<iostream>
#include<cstring>
#include<cstdio>
#include<algorithm>
using namespace std;
#define int long long
#define MAXN 506
int n;
int dp[MAXN][MAXN] , Sa[MAXN][MAXN] , Si[MAXN][MAXN];
int A[MAXN][MAXN] , B[MAXN][MAXN];
signed main() {
	cin >> n;
	for( int i = 1 ; i <= n ; ++ i ) {
		for( int j = 1 ; j < i ; ++ j ) 
			scanf("%lld",&A[j][i]);
		for( int j = i + 1 ; j <= n ; ++ j )
			scanf("%lld",&B[i][j]);
	}
	for( int i = 1 ; i <= n ; ++ i ) 
		for( int j = n ; j >= i + 1 ; -- j ) {
			Sa[i][j] = Sa[i][j + 1];
			for( int k = 1 ; k <= i ; ++ k ) Sa[i][j] += A[k][j];
		}
	for( int i = 1 ; i <= n ; ++ i ) 
		for( int j = i + 1 ; j <= n + 1 ; ++ j ) {
			Si[i][j] = Si[i][j - 1];
			for( int k = i ; k <= j - 1 ; ++ k ) Si[i][j] += B[k][j];
		}
	memset( dp , 0x3f3f , sizeof dp );
	dp[0][0] = 0;
	for( int i = 0 ; i <= n ; ++ i ) 
		for( int j = i ; j <= n ; ++ j )
			if( dp[i][j] < 0x3f3f3f3f3f3f3f3f ) {
				for( int k = j + 1 ; k <= n + 1 ; ++ k ) 
					dp[j][k] = min( dp[j][k] , dp[i][j] + Si[j + 1][k] + Sa[j][k + 1] - Sa[i][k + 1] );
			}
	int ans = 0x3f3f3f3f3f3f3f3f;
	for( int i = 0 ; i <= n ; ++ i ) 
		ans = min( ans , dp[i][n + 1] );
	cout << ans << endl;
}

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

using namespace std;

//BEGIN
template <typename T> 
struct edge {
	int from, to;
	T cost;

	edge(int from, int to, T cost) :from(from), to(to), cost(cost) {}
};

template <typename T>
bool cmp(const edge<T>& a,const edge<T>& b) {
	return a.cost < b.cost;
}

class DisjointSet {
private:
	vector<int> rank, p;
public:
	DisjointSet() {}
	DisjointSet(int n) {
		rank.assign(n, 0);
		p.assign(n, 0);
		for (int i = 0; i < n; i++) p[i] = i;
	}

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

	void unite(int x, int y) {
		x = root(x), y = root(y);
		if (x == y) return;
		if (rank[x] > rank[y]) {
			p[y] = x;
		} else {
			p[x] = y;
			if (rank[x] == rank[y]) rank[y]++;
		}
	}

	int root(int x) {
		return p[x] == x ? x : p[x] = root(p[x]);
	}
};

template <typename T>
T kruskal(int V, vector<edge<T> > G) {
	sort(G.begin(), G.end(), cmp<T>);
	DisjointSet ds(V);
	T cost = 0;
	for (edge<T> e : G) {
		if (!ds.same(e.from, e.to)) {
			cost += e.cost;
			ds.unite(e.from, e.to);
		}
	}
	return cost;
}
//END

int main() {
	int V, E; cin >> V >> E;
	vector<edge<int> > G;
	for (int i = 0; i < E; ++i) {
		int a, b, c; cin >> a >> b >> c;
		G.push_back(edge<int>(a, b, c));
	}
	cout << kruskal(V, G) << endl;
		
	return 0;
}


Measured memory_bytes: 5148
#include <bits/stdc++.h>
#define rep(i, a, n) for(int i = a; i < n; i++)
#define int long long
using namespace std;
typedef pair<int, int> P;
const int mod = 1000000007;
const int INF = 1e18;

int dp[6010], nxt[6010];

signed main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int n, t;
    cin >> n >> t;
    vector<int> a(n), b(n);
    vector<P> d(n);
    rep(i, 0, n){
        cin >> a[i] >> b[i];
        d[i] = {a[i], b[i]};
    }
    sort(d.begin(), d.end());
    rep(i, 0, n){
        a[i] = d[i].first;
        b[i] = d[i].second;
    }
    rep(i, 0, 6010) dp[i] = -1;
    dp[0] = 0;
    rep(i, 0, n){
        rep(j, 0, 6010) nxt[j] = dp[j];
        rep(j, 0, t){
            if(dp[j] == -1) continue;
            nxt[j + a[i]] = max(nxt[j + a[i]], dp[j] + b[i]);
        }
        swap(dp, nxt);
    }
    int ans = 0;
    rep(i, 0, 6010) ans = max(ans, dp[i]);
    cout << ans << endl;
}


Measured memory_bytes: 512
//保留所有权利。
#include<iostream>
#include<stdio.h>//printするよ
#include<vector>
#include<algorithm>//辞書順はnext_permutationだよ
#include<set>
#include<string>
#include<sstream>
#include<string.h>
#include<time.h>
#include<random>
#include<cmath>
#include<math.h>
#include<queue>
#include<time.h>
#include<iomanip>
#include<utility>//swapで数値交換するよ
//END OF LIBRARIES.
#define rt "\n"//改行を最速化させるよ
#define rep(i,n) for(int i=0;i<n;i++)
#define rop(i,n) for(int i=1;i<=n;i++)
#define drep(i,n) for(int i=n-1;0<=i;i--)
#define drop(i,n) for(int i=n;0<i;i--)
#define yes(ans) if(ans)cout<<"yes"<<rt;else cout<<"no"<<rt;
#define Yes(ans) if(ans)cout<<"Yes"<<rt;else cout<<"No"<<rt;
#define YES(ans) if(ans)cout<<"YES"<<rt;else cout<<"NO"<<rt;
#define sec(a,b,ans) if(ans)cout<<a<<rt;else cout<<b<<rt;
#define vcin(s,n) rep(i,n)cin>>s[i];//vcin(配列名),(繰り返し回数)
#define vcin(v) for (int i = 0; i < (v).size(); i++) { cin >> (v)[i]; }
#define sort(s) sort(s.begin(),s.end())
#define reve(s) reverse(s.begin(),s.end())
#define asas int ans=0
#define llcncn llint cnt=0
#define llasas llint ans=0
#define cncn int cnt=0
#define smsm int sum=0
#define str srting
#define v vector
#define please return
#define AC 0//おまじないだよ
#define Rapid cin.tie(0);ios::sync_with_stdio(false)
//END OF DEFINE.
using namespace std;
typedef vector<int> vint;
typedef vector<string> vstr;
typedef vector<char> vcha;
typedef vector<double> vdou;
typedef long long int llint;
typedef pair<int, int> pint;
typedef pair<llint, llint> pllint;
typedef vector<llint> vllint;
typedef vector<pint> vpint;
typedef vector<pair<llint, llint>> vpllint;
typedef vector<vector<int>> vvint;
typedef vector<vector<llint>> vvllint;
typedef vector<vector<string>> vvstr;
typedef vector<vector<pint>> vvpint;
typedef vector<bool> vbool;
//printf("%02d:%02d:%02d\n", h, m, s);・・・2文字は埋める・h、m、ｓ
//END OF TYPEDEF.

//最大公約数（GCD）を求めるよ
//最小公倍数（LCM）は＜＜　A × B ÷ GCD　 ＞＞で求まるよ

long long GCD(long long a, long long b) {
	if (b == 0) return a;
	else return GCD(b, a % b);
}
long long LCM(long long a, long long b) {
	return a * b / GCD(a, b);
}

//for A以上B未満でI探索 for (int I = A; i <= B; i++)
//string s = to_string(i);
int a = 0, b = 0, c = 0, x = 0, y = 0, z = 0, n = 0, sum = 0, i = 0;
string s = ""; asas; cncn;

int main(void) {
	char c;
	cin >> a >> c >> b;
	if (c == '+') {
		cout << a + b << rt;
	}
	else {
		cout << a - b << rt;
	}
	please AC;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<iomanip>
using namespace std;
typedef long long ll;
typedef long  l;
typedef pair<int,int> P;
#define rep(i,n) for(int i=0;i<n;i++)
#define fs first
#define sc second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define ALL(A) A.begin(),A.end()
const int INF=1000000001;
const double PI=3.141592653589;
const ll LMAX=1000000000000001;
ll gcd(ll a,ll b){if(a<b)swap(a,b);while((a%b)!=0){a=b;b=a%b;}return b;}
int dx[]={-1,0,1,0};
int dy[]={0,1,0,-1};



int main(){
  int n,m; cin>>n>>m;
  vector<P> ab(n);
  vector<P> cd(m);
  rep(i,n) cin>>ab[i].fs>>ab[i].sc;
  rep(i,m) cin>>cd[i].fs>>cd[i].sc;

  rep(i,n){
    int goal=INF;
    int id;
    rep(j,m){
      int d=abs(ab[i].fs-cd[j].fs)+abs(ab[i].sc-cd[j].sc);
      if(goal>d){
        goal=d;
        id=j+1;
      }
    }
    cout<<id<<endl;
  }

  return 0;
}


Measured memory_bytes: 256
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<cmath>
#include<iostream>
#include<vector>
using namespace std;
#define rep(i,l,r) for(int i=(l);i<=(r);++i)
#define rpe(i,r,l) for(int i=(r);i>=(l);--i)
#define rpp(i,x,e,head) for(int i=head[x];~i;i=e[i].next)
#define dyes cerr<<"yes"<<endl
#define dbg(x) cerr<<#x<<"="<<x<<endl
#define debug(...) fprintf(stderr, __VA_ARGS__)
#define pts puts("")
typedef double db;
typedef long long ll;
typedef unsigned long long ull;
inline int read(){
    int f=1,x=0;char ch;
    do{ch=getchar();if(ch=='-')f=-1LL;}while(ch<'0'||ch>'9');
    do{x=x*10+ch-'0';ch=getchar();}while(ch>='0'&&ch<='9');
    return f*x;
}
inline ll readll(){
    ll f=1,x=0;char ch;
    do{ch=getchar();if(ch=='-')f=-1LL;}while(ch<'0'||ch>'9');
    do{x=x*10+ch-'0';ch=getchar();}while(ch>='0'&&ch<='9');
    return f*x;
}
template <class T> inline void chmax(T &a,T b){if(a<b) a=b;}
template <class T> inline void chmin(T &a,T b){if(a>b) a=b;}
inline void swap(int &a,int &b){int c=a;a=b;b=c;}
using namespace std;
#define mst(a,val) memset(a,val,sizeof(a))
#define pii pair<int,int>
#define piii pair<int,pair<int,int> >
#define mp(i,j) make_pair(i,j)
#define fi first
#define sc second
#define inf (0x3f3f3f3f)
#define infl (0x3f3f3f3f3f3f3f3fLL)
#define forvec(i,j) for(vector<int>::iterator i=j.begin();i!=j.end();++i)
#define forvecv(i,j) for(vector<int>::iterator i=--j.end();i>=j.begin();--i)
//=====================head end======================//
const int N=1e3+10;
const int M=2e5+10;
vector<pii> e[N];
inline void add(int u,int v,int id){e[u].push_back(mp(v,id));}
int n,m;
int rea[N][N],vis[N];
inline void dfs1(int x,int frm){
    vis[x]=1;rea[frm][x]=1;
    for(auto k:e[x]){
	int v=k.fi;if(vis[v]) continue;
	dfs1(v,frm);
    }
}
int p[N][N],q[N][N],col;
inline void dfs2(int x,int frm){
    p[frm][x]=col;vis[x]=1;
    for(auto k:e[x]){
	int v=k.fi;if(vis[v]) continue;
	dfs2(v,frm);
    }
}
inline void dfs3(int x,int frm){
    q[frm][x]=col;vis[x]=1;
    for(auto k:e[x]){
	int v=k.fi;if(vis[v]) continue;
	dfs3(v,frm);
    }
}
struct edge{int u,v,id;}E[M];
int main(){
    n=read();m=read();
    rep(i,1,m){
	int u=read(),v=read();
	add(u,v,i);E[i].id=i;E[i].u=u;E[i].v=v;
    }
    rep(i,1,n){mst(vis,0);dfs1(i,i);}
    rep(x,1,n){
	mst(vis,0);vis[x]=1;
	for(auto k:e[x]){
	    col=k.sc;
	    int v=k.fi;if(vis[v]) continue;
	    dfs2(v,x);
	}
	mst(vis,0);vis[x]=1;
	int sz=(int)e[x].size()-1;
	rpe(j,sz,0){
	    pii k=e[x][j];
	    col=k.sc;
	    int v=k.fi;if(vis[v]) continue;
	    dfs3(v,x);
	}
    }
    rep(i,1,m){
	int u=E[i].u,v=E[i].v;
	int k=rea[v][u];
	k^=(p[u][v]!=i||q[u][v]!=i);
	if(k){puts("diff");}
	else puts("same");
    }
    return 0;
}


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

int main(int argc, char const *argv[]) {
    int n, m;
    cin >> n >> m;
    vector<bool> stairs(n+1, true);
    for (size_t i = 0; i < m; i++) {
        int a;
        cin >> a;
        stairs[a] = false;
    }

    vector<long long> dp(n+1);
    dp[0] = 1;
    for (size_t i = 0; i <= n; i++) {
        if (stairs[i+1]) {
            dp[i+1] += dp[i];
            dp[i+1] %= 1000000007;
        }
        if (stairs[i+2]) {
            dp[i+2] += dp[i];
            dp[i+2] %= 1000000007;
        }
    }

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


Measured memory_bytes: 3968
N_keta, M_ko = map(int, input().split())
conditions = [list(map(int, input().split())) for i in range(M_ko)]

answers = []

for num in range(0, 10 ** N_keta):

    judge = True
    str_num = str(num)
    
    if (len(str_num) != N_keta):
        judge = False
        continue

    
    for i in range(M_ko):
        keta, n = conditions[i]
        keta -= 1

        if (keta + 1 > len(str_num)):
            judge = False
            break

        elif (str_num[keta] != str(n)):
            judge = False
            break
    
    if (judge):
        answers.append(num)

print(-1 if (len(answers) == 0) else min(answers))

Measured memory_bytes: 3064
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> // Common file
#include <ext/pb_ds/tree_policy.hpp> // Including tree_order_statistics_node_update

using namespace std;
using namespace __gnu_pbds;

//find_by_order gives kth-largest element
//order_of_key gives the number of items in the set that are strictly smaller!!

// OT.find_by_order(k-1)
// 
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;

#define db(x) cerr << #x << "=" << x << endl
#define db2(x, y) cerr << #x << "=" << x << "," << #y << "=" << y << endl
#define db3(x, y, z) cerr << #x << "=" << x << "," << #y << "=" << y << "," << #z << "=" << z << endl
#define db4(x, y, z, w) cerr << #x << "=" << x << "," << #y << "=" << y << "," << #z << "=" << z << "," << #w << "=" << w << endl
#define ll long long
#define pb push_back
#define eb emplace_back
#define all(x) (x).begin(), (x).end()
#define mp make_pair
#define X first
#define Y second
#define sz(x) (int)((x).size())
#define pii pair<int,int>
#define MOD (ll)(998244353)
#define rep(i, n)    for(int i = 0; i < (n); ++i)
#define repA(i, a, n)  for(int i = a; i <= (n); ++i)
#define repD(i, a, n)  for(int i = a; i >= (n); --i)
#define trav(a, x) for(auto& a : x)
typedef vector<int> vi;
#define inf (ll)(1e18)
#define double long double
#define int long long

//////////////////////
// const int N = 316330;


int32_t main() {

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

    int n,m;
    cin >> n >> m;

    int ans = 0;
    if(n == 1 and m == 1) {
        ans = 1;
    }
    else if(m == 1) {
        ans = n-2;
    }
    else if(n == 1) {
        ans = m-2;
    }
    else {
        ans = max((n-2)*(m-2), 0ll);
    }

    cout << ans << "\n";
}

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

int main() {
  char a[3];
  for(int i = 0; i < 3; i++) cin >> a[i];
  int count=1, check=0;
  for (int i = 0; i < 2; i++) {
    if(a[i] == 'R' && a[i+1] == 'R') count++;
    if(a[i] == 'R' || a[i+1] == 'R') check++;
    }
    if (check == 0) cout << 0 << endl;
    else if (count != 0) cout << count << endl;
    return 0;
}

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

#define FOR(i,a,b) for(int i=a;i<=b;++i)
#define FORD(i,a,b) for(int i=a;i>=b;--i)
#define maxn 1010

using namespace std;
const int oo = 1e9 + 7;

int h, w, F[maxn][maxn];

int main()
{
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	cin >> h >> w;
    memset(F, 0, sizeof(F));
    F[1][1] = 1;
    FOR(i, 1, h)
    FOR(j, 1, w) {
        char t;
        cin >> t;
        if (t == '.') {
            F[i][j] += (F[i-1][j] + F[i][j-1]);
            if (F[i][j] >= oo)
                F[i][j] -= oo;
        }
    }
//    FOR(i, 1, h) FOR(j, 1, w) cout << F[i][j] << ' ';
    cout << F[h][w];
	return 0;
}


Measured memory_bytes: 4224
#include<iostream>
#include<vector>
#include<string>
#include<set>
#include<algorithm>
#include<cstring>
#include<cmath>

using namespace std;



int main() {
	int a,b;
	cin >> a >> b;
	cout << "40 100" << endl;
	for (int i = 0; i < 10; i++) {
		for (int j = 0; j < 50; j++) {
			if (--a > 0) {
				cout << ".#";
			}
			else {
				cout << "##";
			}
		}
		cout << endl;
		for (int j = 0; j < 100; j++) {
			cout << "#";
		}
		cout << endl;		
	}
	for (int i = 0; i < 10; i++) {

		for (int j = 0; j < 100; j++) {
			cout << ".";
		}
		cout << endl;		
		for (int j = 0; j < 50; j++) {
			if (--b > 0) {
				cout << ".#";
			}
			else {
				cout << "..";
			}
		}
		cout << endl;
	}


	return 0;
}


Measured memory_bytes: 256
using Yorukatsu043.Questions;
using Yorukatsu043.Extensions;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;

namespace Yorukatsu043.Questions
{
    public class QuestionA : AtCoderQuestionBase
    {
        public override IEnumerable<object> Solve(TextReader inputStream)
        {
            var ab = inputStream.ReadIntArray();
            var a = ab[0];
            var b = ab[1];

            for (int i = 0; i <= 10000; i++)
            {
                if (i * 8 / 100 == a && i * 10 / 100 == b)
                {
                    yield return i;
                    yield break;
                }
            }

            yield return -1;
        }
    }
}


namespace Yorukatsu043
{
    class Program
    {
        static void Main(string[] args)
        {
            IAtCoderQuestion question = new QuestionA();    // 問題に合わせて書き換え
            var answers = question.Solve(Console.In);
            foreach (var answer in answers)
            {
                Console.WriteLine(answer);
            }
        }
    }
}

#region Base Classes

namespace Yorukatsu043.Questions
{

    public interface IAtCoderQuestion
    {
        IEnumerable<object> Solve(string input);
        IEnumerable<object> Solve(TextReader inputStream);
    }

    public abstract class AtCoderQuestionBase : IAtCoderQuestion
    {
        public IEnumerable<object> Solve(string input)
        {
            var stream = new MemoryStream(Encoding.Unicode.GetBytes(input));
            var reader = new StreamReader(stream, Encoding.Unicode);

            return Solve(reader);
        }

        public abstract IEnumerable<object> Solve(TextReader inputStream);
    }

}

#endregion

#region Extensions

namespace Yorukatsu043.Extensions
{
    internal static class TextReaderExtensions
    {
        internal static int ReadInt(this TextReader reader) => int.Parse(ReadString(reader));
        internal static long ReadLong(this TextReader reader) => long.Parse(ReadString(reader));
        internal static double ReadDouble(this TextReader reader) => double.Parse(ReadString(reader));
        internal static string ReadString(this TextReader reader) => reader.ReadLine();

        internal static int[] ReadIntArray(this TextReader reader, char separator = ' ') => ReadStringArray(reader, separator).Select(int.Parse).ToArray();
        internal static long[] ReadLongArray(this TextReader reader, char separator = ' ') => ReadStringArray(reader, separator).Select(long.Parse).ToArray();
        internal static double[] ReadDoubleArray(this TextReader reader, char separator = ' ') => ReadStringArray(reader, separator).Select(double.Parse).ToArray();
        internal static string[] ReadStringArray(this TextReader reader, char separator = ' ') => reader.ReadLine().Split(separator);
    }
}

#endregion

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

int f[5][5];

int main(){
    int n;
    cin >> n;
    for(int x=0;x<n;x++){
        for(int i=0;i<5;i++){
            for(int j=0;j<5;j++){
                cin >> f[i][j];
            }
        }
        int ret=0;
        for(int i=0;i<5;i++){
            for(int j=0;j<5;j++){
                for(int k=0;k<5;k++){
                    for(int l=0;l<5;l++){
                        bool isok = true;
                        for(int p=i;p<=k;p++){
                            for(int q=j;q<=l;q++){
                                if(!f[p][q]){
                                    isok = false;
                                }
                            }
                        }
                        if(isok && i <= k && j <= l){
                            ret = max(ret, (k-i+1)*(l-j+1));
                        }
                    }
                }
            }
        }
        cout << ret << endl;
    }


}

Measured memory_bytes: 1160
#include<stdio.h>
int main(void)
{
	int a,b,c,d,e,f,coin;
	scanf("%d %d %d %d %d %d",&a,&b,&c,&d,&e,&f);
	while((a!=0)||(b!=0)||(c!=0)||(d!=0)||(e!=0)||(f!=0)) {

		coin=100;
		coin=coin+a*90;
		coin=coin+b*60;
		coin=coin+c*7;
		coin=coin+d*2;
		coin=coin+e*3;
		coin=coin-(f-a*5-b*3)*3;
		coin=coin-(a*5+b*3)*2;

		printf("%d\n",coin);
		scanf("%d %d %d %d %d %d",&a,&b,&c,&d,&e,&f);
	}
	return 0;
}

Measured memory_bytes: 600
#include<iostream>
#include<string.h>
using namespace std;

int main(void) {
  char A[10], B[10], C[10];
  cin >> A >> B >> C;
  if ((A[strlen(A)-1] == B[0]) && (B[strlen(B)-1] == C[0])) printf("YES");
  else printf("NO");
  
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main() {
    int H,W;
    cin >> H >> W;
    char S[H][W];
    for(int i=0; i<H; i++){
        for(int j=0; j<W; j++){
            cin >> S[i][j];
        }
    }
    
    //処理
    int difx[8] = {-1,0,1,1,1,0,-1,-1};
    int dify[8] = {-1,-1,-1,0,1,1,1,0};

    for(int i=0; i<H; i++){
        for(int j=0; j<W; j++){
            if(S[i][j]=='.'){
                int count = 0;
                for(int k=0; k<8; k++){
                    if(i+difx[k] >= 0 && j+dify[k] >= 0 && i+difx[k] < H && j+dify[k] < W){
                        if(S[i+difx[k]][j+dify[k]]=='#') count++;
                    }
                }
                S[i][j] = '0' + count;
            }
        }
    }

    //出力
    for(int i=0; i<H; i++){
        for(int j=0; j<W; j++){
            cout << (char)S[i][j];
        }
        cout << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll= long long ;
using P = pair<ll,ll>;
#define rep(i,n) for (ll i = 0; i<(ll)(n); i++)
#define mod 1000000007
#define pi 3.141592653589793
typedef vector<ll> vcl;

ll gcd(ll a,ll b){
    if(b>a) swap(a,b);
    if(b==0) return a;
    return gcd(b,a%b);
}
ll lcm(ll a, ll b){
    ll g=gcd(a,b);
    return a/g*b;
}
ll rep_jijo(ll n,ll x){
    if(x==0) return 1;
    if(x%2==0){
        ll t =rep_jijo(n,x/2);
        return t*t%mod;
  }
  return n*rep_jijo(n,x-1)%mod;
}
ll c2(ll n){
    return n*(n-1)/2;
}

int main(){
ll d,t,s;
cin>>d>>t>>s;
if(d>t*s)cout<<"No"<<endl;
else cout<<"Yes"<<endl;
}

Measured memory_bytes: 3592
#include<stdio.h>
#include<stdlib.h>
///*
void sort_N(int *x,int n);

int main() {

	int i, n, *ary;
	int counter=0;

	scanf("%d", &n);

	ary = (int*)calloc(2 * n, sizeof(int));
	if (ary == NULL) {
		return 0;
	}

	for (i = 0; i < 2 * n; i++) {
		scanf("%d", &ary[i]);
	}

	sort_N(ary, 2 * n);

	for (i = 0; i < n; i++) {
		counter += ary[2 * i];
	}

	//for (i = 0; i < 2 * n; i++) {
		//printf("%d ", ary[i]);
	//}
	//printf("\n");

	printf("%d\n", counter);

	free(ary);

	return 0;
}

void sort_N(int *x,int n) {

	int i,j,fake;
	
	for (i = 0; i < n - 1; i++) {
		for (j = 0; j < n - 1;j++){
			if (x[j] > x[j + 1]) {
				fake = x[j];
				x[j] = x[j + 1];
				x[j + 1] = fake;
			}
		}
	}
}
//*/

Measured memory_bytes: 128
import sys
import math
a, b, x = [float(i) for i in sys.stdin.readline().split()]

if x < a**2*b / 2:
    print(90.0 - math.degrees(math.atan(x / (a*b**2/2))))
elif a**2*b-x == 0:
    print(0.0)
else:
    print(90.0 - math.degrees(math.atan(a**3 / 2 / (a**2*b-x))))

Measured memory_bytes: 3188
#ifdef __APPLE__
#include <iostream>
#include <vector>
#include <utility>
#include <stack>
#include <queue>
#include <set>
#include <algorithm>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <random>
#include <iomanip>
#include <cmath>
#include <ctgmath>
#include <math.h>
#else
#include <bits/stdc++.h>
#endif

using namespace std;
#define io ios_base::sync_with_stdio(false), cin.tie(NULL)
#define GFOR(i,a,n) for (i=a;i<n;i++)
#define FOR(i,a,n) for (int i=a;i<n;i++)
#define RFOR(i,a,n) for (int i=n-1;i>=a;i--)
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define sz(x) ((int)(x).size())
#define tc(t) for (int tc=1; tc<=t; tc++)
typedef vector<int> vi;
typedef vector<string> vs;
typedef vector<long long int> vll;
typedef vector<pair<int, int> > vpi;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll, ll> pll;
mt19937 mrand(random_device{}()); 
const ll mod=1000000007;
int rnd(int x) { return mrand() % x;}
ll powmod(ll a,ll b) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
ll gcd(ll a,ll b) { return b?gcd(b,a%b):a;}
ll modInverse (ll a) {ll p = mod - 2; return powmod(a, p);}
// head

void solve() {
    int n;
    cin >> n;
    vector<int> div(n+1, 1);
    for (int i = 2; i <= n; i++) {
        for (int j = i; j <= n; j+=i) {
            div[j]++;
        }
    }
    ll ans = 0;
    for (ll i = 1; i <= n; i++)
        ans += i*(ll)div[i];
    cout << ans << "\n";
}

int main() {
    io;
    int t = 1;
    tc(t) {
        solve();
    }
}
//check for edge cases in limits
//printing double may print 1.223232e9 like values, beware of that


Measured memory_bytes: 42272
#include <bits/stdc++.h>
using namespace std;
 
int main() {
	int a, b, c, n; cin >> a >> b >> c >> n;
	int ans = 0;
	for (int i = 0; i <= n; i++) {
		for (int j = 0; j <= n; j++) {
			if ((n - (a * i + b * j)) % c == 0) {
if (n - (a * i + b * j) >= 0) ans++;

			}
		}
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
int main(){
    int n;
    int A[100000];
    int L[100002];
    int R[100002];
    cin >> n;
    for (int i=0;i<n;i++){
        cin >> A[i];
    }
    L[0] = 0;
    R[n+1] = 0;
    for (int i=1;i<n+1;i++){
        int j = n-i-1;
        L[i] = __gcd(L[i-1],A[i-1]);
        R[j] = __gcd(R[j+1],A[j+1]);
    }  
    int mx = 0;
    for (int i=0;i<n+2;i++){
        mx = max(mx, __gcd(L[i],R[i]));
    }
    cout << mx << endl;
}

Measured memory_bytes: 1408
#include <bits/stdc++.h>
using namespace std;
 
const int64_t MOD = 1e9+7;
 
int64_t extgcd(int64_t a, int64_t b, int64_t& x, int64_t& y){
    int64_t d = a;
    if(b != 0){
        d = extgcd(b, a%b, y, x);
        y -= (a/b) * x;
    }else{
        x = 1; y = 0;
    }
    return d;
}
 
int64_t mod_inv(int64_t a){
    int64_t x, y;
    extgcd(a, MOD, x, y);
    return (MOD + x%MOD) % MOD;
}
 
void add(int64_t& a, int64_t b){
    a = (a+b+MOD) % MOD;
}
void mul(int64_t& a, int64_t b){
    a = a*b % MOD;
}
 
int main(){
    int i, j, k;
    int N;
    const int MAX = 100001;
    cin >> N;
    int64_t A[MAX];
    for(i=1; i<=N; i++) scanf("%lld", &A[i]);
 
    int64_t invsum[MAX];
    invsum[0] = 0;
    for(i=1; i<=N; i++){
        invsum[i] = (invsum[i-1] + mod_inv(i)) % MOD;
    }
 
    int64_t ans = 0;
    for(i=1; i<=N; i++){
        add(ans, A[i] * (invsum[i] + invsum[N+1-i] - 1) % MOD);
    }
    for(i=2; i<=N; i++) mul(ans, i);
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 1792
#include<stdio.h>
#include<stdlib.h>
int main(void){
  int N;
  scanf("%d",&N);
  int A[N+2]={0};
  for(int i=1;i<=N;i++){
    scanf("%d",A+i);
  }
  int sum = 0;
  for(int i=0;i<N+1;i++){
    sum +=abs(A[i+1]-A[i]);
  }
  for(int i = 1;i <= N;i++){
    if((A[i-1]<=A[i] && A[i]<=A[i+1])||(A[i-1]>=A[i] && A[i]>=A[i+1])){
      printf("%d\n",sum);
    }
    else{
     printf("%d\n",sum +abs(A[i+1]-A[i-1])-abs(A[i+1]-A[i])-abs(A[i]-A[i-1]));
     
     }
    }
  
  return 0;
}


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


int main(){
  int n,i,ans;
  cin >> n;
  ans=0;
  map<int,int> mp;
  for(i=0;i<n;++i){
    int a;
    cin >> a;
    mp[a]++;
  }

  for(auto& p : mp){
    int s=p.second;
    if(s%2!=0){
      ans++;
    }
  }
  cout << ans << endl;
  return 0;

}


Measured memory_bytes: 4864
#include <stdio.h>

int main(void){
  int i,j,n,temp;
  int cnt = 0;
  int array[100];

  scanf("%d",&n);
  for( i = 0 ; i < n ; i++ ){
    scanf("%d",&array[i]);
  }

  for( i = 0 ; i < n - 1 ; i++ ){
    for( j = n - 1 ; j > i ; j-- ){
      if( array[j-1] > array[j] ){
        temp = array[j];
        array[j] = array[j-1];
        array[j-1] = temp;
        cnt++;
      }
    }
  }
  for( i = 0 ; i < n ; i++ ){
    if( i < n - 1 ) printf("%d ",array[i]);
    else printf("%d\n",array[i]);
  }
  printf("%d\n",cnt);
  return 0;
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
 
using namespace std;
 
typedef long long ll;
typedef pair<ll,ll> P;
 
long long int INF = 3e18;
double Pi = 3.1415926535897932384626;
 
vector<ll> G1[500005];
vector<ll> G2[500005];
//vector<P> tree[500010];
priority_queue <ll> pql;
priority_queue <P> pqp;
//big priority queue
priority_queue <ll,vector<ll>,greater<ll> > pqls;
priority_queue <P,vector<P>,greater<P> > pqps;
//small priority queue
//top pop
 
int dx[8]={1,0,-1,0,1,1,-1,-1};
int dy[8]={0,1,0,-1,1,-1,-1,1};
char dir[] = "DRUL";
//ll bit[500005];
//↓,→,↑,←
 
 
#define p(x) cout<<x<<endl;
#define el cout<<endl;
#define pe(x) cout<<(x)<<" ";
#define ps(x) cout<<fixed<<setprecision(25)<<x<<endl;
#define pu(x) cout<<(x);
#define pb push_back
#define lb lower_bound
#define ub upper_bound
 
 
ll mod = 1000000007;
ll rui(ll number1,ll number2){
 
    if(number2 == 0){
        return 1;
    }else{
        ll number3 = rui(number1,number2 / 2);
        number3 *= number3;
        number3 %= mod;
        if(number2%2==1){
            number3 *= number1;
            number3 %= mod;
        }
        return number3;
    }
}
ll gcd(ll number1,ll number2){
 
    if(number1 > number2){
        swap(number1,number2);
    }
    if(number1 == 0 || number1 == number2){
        return number2;
    }else{
        return gcd(number2 % number1,number1);
    }
}
void YES(bool condition){
 
    if(condition){
        p("YES");
    }else{
        p("NO");
    }
    return;
}
void Yes(bool condition){
 
    if(condition){
        p("Yes");
    }else{
        p("No");
    }
    return;
}

 
//ll fact[800005],rfact[800005];
/*
void c3_init(){
    fact[0] = rfact[0] = 1;
    for(ll i=1; i<=800000; i++){
        fact[i] = (fact[i-1]*i) % mod;
    }
    rfact[800000] = rui(fact[800000],mod - 2);
    for(ll i=800000; i>=1; i--){
       rfact[i-1] = rfact[i] * i;
       rfact[i-1] %= mod;
    }
    return;}
ll c3(ll n,ll r){
    return (((fact[n] * rfact[r]) % mod) * rfact[n-r]) % mod;}
*/
 
ll n,m,num,sum,ans,a,b,c,e,g,h,w,i,j,k,q;
ll x[500005],y[500005],z[500005];
bool dp[100005];
bool dame;

int main(){
    cin >> a >> b >> c;
    ll ans = c - a + b;
    if(ans < 0){
        p(0);
    }else{
        p(ans);
    }
    //p(c - a + b);
    
    return 0;
}












Measured memory_bytes: 25216
#include <bits/stdc++.h>
#define INF 1e9
using namespace std;

#define REPR(i,n) for(int i=(n); i >= 0; --i)
#define FOR(i, m, n) for(int i = (m); i < (n); ++i)
#define REP(i, n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define ALL(a)  (a).begin(),(a).end()

template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return true; } return false; }
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return true; } return false; }
int gcd(int a,int b){return b?gcd(b,a%b):a;}
typedef long long ll;
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}

double kitaichi(int part) {
    double res = 0;
    FOR(i,1,part+1) {
        res += (double)i * 1/(double)part;
    }
    return res;
}

int main() {
    // 前計算
    vector<double> tbl(1001);
    FOR(i,1,1001) {
        tbl[i] = kitaichi(i);
    }
    int N,K;
    cin >> N >> K;
    vector<int> p(N);
    REP(i,N) cin >> p[i];

    double now_kitai = 0;
    double ans = 0;
    // init
    REP(i,K) now_kitai += tbl[p[i]];
    chmax(ans,now_kitai);
    FOR(i,K,N) {
        now_kitai -= tbl[p[i-K]];
        now_kitai += tbl[p[i]];
        chmax(ans,now_kitai);
    }

    cout << fixed << setprecision(12) << ans << endl;

    return 0;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
#include <vector>
#include <algorithm>
#include <cmath>

using namespace std;

int main(){

	int n, tmp;
	long long int ans = 0;
	int board[10][10];

	cin>> n;

	if (n <= 10) {
		cout << n << endl;
		return 0;
	}

	for (int i = 1;i < 10;i++) {
		for (int j = 1;j < 10;j++) {
			tmp = 0;
			if(i==j) tmp++;

			if (i * 10 + j <= n) tmp++;

			if (i * 100 + j <= n) {
				if (n < (i + 1) * 100) {
					tmp += ((n / 10) % 10);
					if (j <= n % 10) tmp++;
				}
				else {
					tmp += 10;
				}
			}

			if (i * 1000 + j <= n) {
				if (n < (i + 1) * 1000) {
					tmp += ((n / 10) % 100);
					if (j <= n % 10) tmp++;
				}
				else {
					tmp += 100;
				}
			}

			if (i * 10000 + j <= n) {
				if (n < (i + 1) * 10000) {
					tmp += ((n / 10) % 1000);
					if (j <= n % 10) tmp++;
				}
				else {
					tmp += 1000;
				}
			}

			if (i * 100000 + j <= n) {
				if (n < (i + 1) * 100000) {
					tmp += ((n / 10) % 10000);
					if (j <= n % 10) tmp++;
				}
				else {
					tmp += 10000;
				}
			}

			if (i * 1000000 + j <= n) {
				if (n < (i + 1) * 1000000) {
					tmp += ((n / 10) % 100000);
					if (j <= n % 10) tmp++;
				}
				else {
					tmp += 100000;
				}
			}
			board[i][j] = tmp;
		}
	}

	for (int i = 1;i < 10;i++) {
		for (int j = 1;j < 10;j++) {
			ans += board[i][j] * board[j][i];
		}
	}

	cout<< ans << endl;


}


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

import sys, re
from collections import deque, defaultdict, Counter
from math import sqrt, hypot, factorial, pi, sin, cos, radians
if sys.version_info.minor >= 5: from math import gcd
else: from fractions import gcd 
from heapq import heappop, heappush, heapify, heappushpop
from bisect import bisect_left, bisect_right
from itertools import permutations, combinations, product
from operator import itemgetter, mul
from copy import deepcopy
from functools import reduce, partial
from fractions import Fraction
from string import ascii_lowercase, ascii_uppercase, digits

def input(): return sys.stdin.readline().strip()
def ceil(a, b=1): return int(-(-a // b))
def round(x): return int((x*2+1) // 2)
def fermat(x, y, MOD): return x * pow(y, MOD-2, MOD) % MOD
def lcm(x, y): return (x * y) // gcd(x, y)
def lcm_list(nums): return reduce(lcm, nums, 1)
def gcd_list(nums): return reduce(gcd, nums, nums[0])
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
MOD = 10 ** 9 + 7

N, K = MAP()
aN = LIST()
Kb = format(K, 'b')
mxlen = len(Kb)

c = Counter()
for i in range(N):
    b = format(aN[i], 'b')
    b = b.zfill(mxlen)
    b = b[::-1]
    for j in range(len(b)):
        if b[j] == '0':
            c[j] += 1

num = ''
for i in range(mxlen):
    if c[i] > N / 2:
        num = '1' + num
    else:
        num = '0' + num

X = 0
for i in range(len(num)):
    if num[i] == '1':
        if X + 2 ** (len(num)-i-1) <= K:
            X += 2 ** (len(num)-i-1)

ans = 0
for i in range(N):
    ans += X ^ aN[i]
print(ans)


Measured memory_bytes: 16820
#include <bits/stdc++.h>
#define REP(i,n)   for(int i=0;i<(n);++i)
#define ALL(v)     (v).begin(),(v).end()
#define debug(x)   cerr<<#x<<": "<<(x)<<endl
using namespace std;
using llong = long long;
using vi    = vector<int>;
using vvi   = vector<vi >;
using vvvi  = vector<vvi >;
using pii   = pair<int,int>;
constexpr int    INF=1e9;
constexpr double EPS=1e-9;
constexpr int    MOD=1e9+7;
template<class Type>
void line(const Type &a){int cnt=0;for(const auto &elem:a){cerr<<(cnt++?' ':'>');cerr<<elem;}cerr<<endl;}

int main(){//Refering other editorials.
	int n;
	cin>>n;
	
	vector<pii > red(n),bule(n);
	REP(i,n){
		int a,b;
		cin>>a>>b;
		a--, b--;
		red[i]=pii(a,b);
	}
	REP(i,n){
		int c,d;
		cin>>c>>d;
		c--, d--;
		bule[i]=pii(c,d);
	}
	sort(ALL(red));
	sort(ALL(bule));
	
	int ans=0;
	bool used[n]={};
	REP(i,n){
		int c,d;
		tie(c,d)=bule[i];
		
		int p=-1;
		int ymn=-INF;
		REP(j,n){
			int a,b;
			tie(a,b)=red[j];
			if(a>=c) break;
			
			if(!used[j] and b<d and b>ymn){
				p=j;
				ymn=b;
			}
		}
		if(p!=-1){
			used[p]=true;
			ans++;
		}
	}
	
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 3572
#define DBG 0 //submit 0
#if DBG==1
    #include <algorithm>
    #include <ctime>
    #include <cstdlib>
    #include <string>
    #include <vector>
    #include <iostream>
    #include <cmath>
    #include <numeric>
#else
    #include <bits/stdc++.h>
#endif

using namespace std;

long long mygcd(long long x,long long y){
    if (x<y) swap(x,y);
    long long r = x%y;
    while(r!=0){
        x = y;
        y = r;
        r = x % y;
    }

    return y;
}

int main(){
    //long long ans = 0,sum = 0;
    //long long A,B,lltmp=0,llans=0; 
    int C,D,L,i,j,k,tmp = 0,tmpi = 0,ans = 0,day = 0;
    int N;
    //string S;
    cin >> N;
    vector <pair<int,int>> data(N);
    for(i=0;i<N;i++){
        cin >> C >> D;
        data[i] = make_pair(D,C);
    }

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

    for(i=0;i<N;i++){
        day += data[i].second;
        if (day > data[i].first){
            cout << "No" << endl;
            break;
        }else if(i == N-1){
            cout << "Yes" << endl;
            break;
        }
    }    
}


Measured memory_bytes: 1792
m, n = gets.split.map(&:to_i)
s = gets.chomp
t = gets.chomp

def gcd(a, b)
  gcd(b, a) if b > a
  return b if (r = a % b).zero?
  gcd(b, r)
end

def solve(m, n, s, t)
  a = gcd(m, n)
  m1 = m / a
  n1 = n / a
  a.times do |i|
    if s[m1 * i] != t[n1 * i]
      return -1
    end
  end
  return m * n / gcd(m, n)
end

puts solve(m, n, s, t)


Measured memory_bytes: 2044
n = int(input())
li =[list(map(int, input().split())) for _ in range(n)]
now = [0, 0]
t = 0

for i in li:
    cost = abs(i[1] - now[0]) + abs(i[2] - now[1]) 
    if (i[0] - t) < cost or (i[0] - t - cost) % 2 != 0:
        print("No")
        break
    t = i[0]
    now = [i[1], i[2]]
else:
    print("Yes")

Measured memory_bytes: 27300