akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
using lint = long long;
using pint = pair<int, int>;
using vec = vector<int>;
using mat = vector<vector<int>>;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(v) v.begin(), v.end()
#define endl "\n"

constexpr int MOD = 1000000007;
const int INF = 1 << 30;

int main() {
    string s;
    cin >> s;
    int n = s.size();
    string t, u;
    t = s.substr(0, (n-1)/2);
    u = s.substr((n+1)/2, (n-1)/2);

    bool f = true;

    for (int i = 0, j = n-1; i < j; ) {
        if (s[i] != s[j]) f = false;
        i++;
        j--;
    }

    for (int i = 0, j = t.size()-1; i < j; ) {
        if (t[i] != t[j]) f = false;
        i++;
        j--;
    }

    for (int i = 0, j = u.size()-1; i < j; ) {
        if (u[i] != u[j]) f = false;
        i++;
        j--;
    }

    if (f) cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 256
n = int(input())
num_list = input().split()
 
def bubbleSort(num_list, n):
    flag = 1
    count = 0
    while flag:
        flag = 0
        for j in range(n-1, 0, -1):
            if int(num_list[j]) < int(num_list[j-1]):
                num_list[j], num_list[j-1] = num_list[j-1], num_list[j]
                flag = 1
                count += 1
 
    result = ' '.join(num_list)
    print(result)
    print(count)
 
bubbleSort(num_list, n)

Measured memory_bytes: 7772
N,X = map(int,input().split())
L = list(map(int,input().split()))

def accmulate(array):
    global cs
    cs = [0]*(len(array)+1)
    for i in range(len(array)):
        cs[i+1] = cs[i] + array[i]

def query(l,r):
    return cs[r+1] - cs[l]

accmulate(L)

cnt = 0
for a in cs:
    if a <= X:
        cnt += 1

print(cnt)

Measured memory_bytes: 3064
#include <iostream>
#include <map>
#include <utility>

std::map<std::string, int> memo;

int main(){
	int loopvalue;
	std::string str;
	std::cin >> loopvalue;

	for(int i=0;i<loopvalue;i++) {
		std::cin >> str;
		memo[str] += 1;
	}
	
	int max = 0;
	for (auto const& entry: memo)
	{
		int newvalue = entry.second;
		if (newvalue > max) {
			max = newvalue;
		}
	}
	for (auto const& entry: memo)
	{
		if(max == entry.second) {
			std::cout << entry.first << std::endl;
		}
	}
}


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

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

    while (in.hasNext()) {
      int N = in.nextInt();
      int[] d = new int[N];

      for (int i = 0; i < d.length; ++i) {
        d[i] = in.nextInt();
      }

      Arrays.sort(d);
      int mid1 = d[N / 2 - 1];
      int mid2 = d[N / 2];
      
      System.out.println(mid2 - mid1);
    }
  }
}

Measured memory_bytes: 50608
#include<iostream>
#include<algorithm>
#include<climits>
#include<map>
#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define scan(arg) cin>>arg
#define prin(arg) cout<<arg<<"\n"
#define prin2(arg1,arg2) cout<<arg1<<" "<<arg2<<"\n"
using namespace std;
typedef long long ll;
const int NMAX=1<<17;
int n;
int a[100010];
map<int,int> mp;
int main(){
  scan(n);
  rep(i,n){
    scan(a[i]);
  }
  rep(i,n){
    mp[a[i]]++;
  }
  int res=0;
  for(auto ite=mp.begin();ite!=mp.end();ite++){
    if(ite->second%2==1){
      res++;
    }
  }
  prin(res);
  
  return 0;
}


Measured memory_bytes: 5376
#include <bits/stdc++.h>
#define rep(i, a, n) for(int i = a; i < n; i++)
#define REP(i, n) rep(i, 0, n)
#define repb(i, a, b) for(int i = a; i >= b; i--)
#define all(a) a.begin(), a.end()
#define int long long
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
using namespace std;
typedef pair<int, int> P;
const int mod = 1000000007;
const int INF = 1e12;

signed main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    int h, w, n;
    cin >> h >> w >> n;
    vector<int> a(n);
    rep(i, 0, n){
        cin >> a[i];
    }
    int d[110][110];
    int y = 0, x = 0;
    rep(i, 0, n){
        while(a[i]){
            d[y][x] = i;
            a[i]--;
            if(y % 2 == 0){
                if(x != w - 1) x++;
                else y++;
            }else{
                if(x != 0) x--;
                else y++;
            }
        }
    }
    rep(i, 0, h){
        rep(j, 0, w){
            if(j != 0) cout << " ";
            cout << d[i][j] + 1;
        }
        cout << endl;
    }
}

Measured memory_bytes: 512
s = list(input())
ls = len(s)
for i in range(1, ls):
    if s[i] == s[i-1]:
        print(i, i+1)
        break
    if i == 1:
        continue
    if s[i] == s[i-2]:
        print(i-1, i+1)
        break
else:
    print(-1, -1)

Measured memory_bytes: 3956
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author aajisaka
 */

#include<bits/stdc++.h>

using namespace std;

void debug_out() { cerr << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cerr << " " << to_string(H);
  debug_out(T...);
}
#ifdef LOCAL
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define debug(...) 42
#endif

#define SPEED ios_base::sync_with_stdio(false);cin.tie(nullptr)
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define all(v) v.begin(), v.end()
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

using ll = long long;
using P = pair<ll, ll>;

constexpr long double PI = 3.14159265358979323846264338327950288L;
mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());

class DMangaMarket {
public:
    void solve(istream& cin, ostream& cout) {
      SPEED;
      ll n, t; cin >> n >> t;

      vector<P> vec1;
      vector<ll> vb;
      rep(i, n) {
        ll a, b; cin >> a >> b;
        if (a==0) {
          vb.push_back(b);
        } else {
          vec1.emplace_back(a, b);
        }
      }

      sort(all(vec1), [](auto p1, auto p2) {
          return p1.first*(p2.second+1) > p2.first*(p1.second+1);
      });
      for(auto e: vec1) {
        debug(e.first, e.second);
      }

      vector<ll> time(40, t+1);
      time[0] = 0;
      for(auto e: vec1) {
        for(int i=39; i>0; i--) {
          chmin(time[i], (time[i-1]+1)*e.first+e.second+time[i-1]+1);
        }
      }

      sort(all(vb));
      int n0 = vb.size();
      vector<ll> cnt(n0+1);
      rep(i, n0) {
        cnt[i+1] = cnt[i] + 1 + vb[i];
      }

      ll ans = 0;
      ll p = 0;
      for(int i=39; i>=0; i--) {
        if (time[i] > t) continue;
        while(p < n0 && time[i] + cnt[p+1] <= t) {
          p++;
        }
        chmax(ans, i+p);
      }
      cout << ans << endl;
    }
};

signed main() {
  DMangaMarket solver;
  std::istream& in(std::cin);
  std::ostream& out(std::cout);
  solver.solve(in, out);
  return 0;
}

Measured memory_bytes: 6384
#include <bits/stdc++.h>
#define ll long long
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define pii pair<int,int>
#define pll pair<ll,ll>
#define pcc pair<char,char>
#define vi vector <int>
#define vl vector <ll>
#define sd(x) scanf("%d",&x)
#define slld(x) scanf("%lld",&x)
#define pd(x) printf("%d",x)
#define plld(x) printf("%lld",x)
#define pds(x) printf("%d ",x)
#define pllds(x) printf("%lld ",x)
#define pdn(x) printf("%d\n",x)
#define plldn(x) printf("%lld\n",x)
#define INF 2e9
#define INFLL 4e18
using namespace std;
ll powmod(ll base,ll exponent,ll mod){ // with mod < 1e9
	ll ans=1;
	while(exponent){
		if(exponent&1)ans=(ans*base)%mod;
		base=(base*base)%mod;
		exponent/=2;
	}
	return ans;
}
ll gcd(ll a, ll b){
	if(b==0) return a;
	else return gcd(b,a%b);
}
const int upperlimit = 1e6+100;
const int mod = 1e9+7;
int a[upperlimit];
int visited[upperlimit];
int main() {
//	freopen(".in","r",stdin);freopen(".out","w",stdout);
	int n;
	ll k;
	sd(n);slld(k);
	for(int i = 1; i <= n; i++) sd(a[i]);
	int x=1,moves=1;
	while((! visited[x])&&(k>0)){
		visited[x]=moves;
		moves++;
		k--;
		x=a[x];
	}
  	if(k==0){
      	pd(x);
      	return 0;
    }
	int cycle_len=moves-visited[x];
	k%=cycle_len;
	for(int i = 1; i <= k; i++) x=a[x];
	pd(x);
	return 0;
}


Measured memory_bytes: 5356
n,k=map(int,input().split())
teleport=list(map(int,input().split()))
double_counter=set()
# mojiretu="1"
mojiretu=["1"]
index=1
double_counter.add(index)
flag=False
for i in range(k):
    tmp=teleport[index-1]
    if tmp in double_counter:
        flag=True
        break
    else:
        double_counter.add(tmp)
        # mojiretu+=str(tmp)
        mojiretu.append(str(tmp))
        index=tmp
else:
    print(tmp)

if flag:
    # index=mojiretu.index(str(tmp))
    # roop_str=mojiretu[index:]
    # length=k%len(roop_str)-len(mojiretu[:index])%len(roop_str)
    # print(roop_str[length])

    index = mojiretu.index(str(tmp))
    roop_str=mojiretu[index:]
    length=k%len(roop_str)-len(mojiretu[:index])%len(roop_str)
    print(roop_str[length])


Measured memory_bytes: 40036
import java.util.*;
public class Main{
	public static void main(String[] args){
		Scanner sc=new Scanner(System.in);
		int h=sc.nextInt();
		int a=sc.nextInt();
		if(h%a==0){
			System.out.println(h/a);
		}else{
			System.out.println(h/a+1);
		}
	}
}


Measured memory_bytes: 23892
import java.util.*;
public class Main {
	public static void main(String[] args){
      	//データ取り込み
		Scanner sc = new Scanner(System.in);

		int A = sc.nextInt();
      	int B = sc.nextInt();
      	if(A<=B){
        	System.out.println(A);
        }else{
        	System.out.println(A-1);      
        }
      
      	
    }
}

Measured memory_bytes: 23252
#include<math.h>
#include<map>
#include<iostream>
#include <algorithm>
#include <string>
#include<vector>
#include<array>
#include<tuple>
#include<queue>
#include<stack>
#include<iomanip>
#include<bitset>
#include <list>
#include<numeric>
//AtCoderC++.cpp

using namespace std;

int main() {
	int a, b; char op; cin >> a >> op >> b;
	if (op == '+')cout << a + b << endl;
	else cout << a - b << endl;
}


Measured memory_bytes: 256
#include <vector>
#include <math.h>
#include <iostream>
#include <string>
#include <algorithm>
#include <queue>
#include <iomanip>
#include <deque>
#include <map>
using namespace std;
struct Node {
    int y;
    int x;
    int depth;
};
queue<Node> que;
int H, W;
int sy, sx, gy, gx;
int y, x, depth;
vector<int> y_vec = {0, 0, -1, 1};
vector<int> x_vec = {-1, 1, 0, 0};
vector<string> vec;

int bfs() {
    while (!que.empty()) {
        Node node = que.front(); que.pop();
        y = node.y;
        x = node.x;
        depth = node.depth;
        if (y == gy && x == gx) return depth;

        for (int i = 0; i < 4; ++i) {
            Node next = {y + y_vec[i], x + x_vec[i], depth + 1};

            if (0 <= next.y && next.y <= H-1 && 0 <= next.x && next.x <= W - 1 && vec[next.y][next.x] == '.') {
                vec[next.y][next.x] = 'x';
                que.push(next);
            }
        }
    }
    return 0;
}
 
int main() {
    int count = 0;
    cin >> H >> W;
    sy = 0;
    sx = 0;
    gy = H - 1;
    gx = W - 1;
    vec.resize(H);
    for (int i = 0; i < H; ++i) {
        cin >> vec[i];
    }

    for (int i = 0; i < H; ++i) {
        for (int j = 0; j < W; ++j) {
            if (vec[i][j] == '.') ++count;
        }
    }

    Node start = {sy, sx, 1};
    que.push(start);
    int dep = bfs();
    if (dep != 0) {
        cout << (count - dep) << endl;
    } else {
        cout << -1 << endl;
    }
    return 0;
}


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

#define rep(x,to) for(int x=0;x<to;x++)
#define rep2(x,from,to) for(x=from;x<to;x++)

using namespace std;


int main(void){

char g;
int a,b,c;
int tcnt=0,hcnt=0;

	while(cin >> a >> g >> b >> g >> c){
		if(a*a+b*b == c*c ) tcnt++;
		if(a==b ) hcnt++;
	}
	cout << tcnt <<endl << hcnt << endl;
	return 0;
	
	
}

Measured memory_bytes: 1160
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Arrays;

//public class Problem0001_ListOfTop3Hills {
public class Main {
	public static void main(String[] args) {
		try {
			BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
			
			int[] mountains = new int[10];
			int num = 0;
			while(num < 10){
				String line = reader.readLine();
			//	System.out.println(line);
				mountains[num] = Integer.parseInt(line);
				num++;
			}
			
			Arrays.sort(mountains);
			
			for(int i = 9; i > 6; i--) {
				System.out.println(mountains[i]);
			}
		} catch(Exception e) {
			e.printStackTrace();
		}
	}
}

Measured memory_bytes: 9356
N = int(input())
l = [int(i) for i in input().split()]

def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.extend([i,int(n/i)])
    return divisors

def gcd(a,b):
    if b==0:return a
    return gcd(b,a%b)

p = make_divisors(l[0])
p.extend(make_divisors(l[1]))

p.sort(reverse=True)
for i in p:
    ans = 1
    flag = 0
    for j in l:
        if j%i != 0:
            if flag == 1:
                ans = 0
                break
            flag = 1
    if ans:
        print(i)
        exit()


Measured memory_bytes: 63984
#include<algorithm>
#include<bitset>
#include<cmath>
#include<cstdlib>
#include<iomanip>
#include<iostream>
#include<queue>
#include<set>
#include<string>
#include<utility>
#include<vector>

using namespace std;
 
typedef long long ll;

#define MP make_pair
#define F first
#define S second

int main(){
	ll n,x,y;
    cin >> n >> x >> y;
    ll d[n][n];
    vector<ll> K(n-1,0);
    for(ll i=0;i<n;i++){
    	for(ll j=0;j<n;j++){
            d[i][j]=abs(i-j);
            d[j][i]=abs(i-j);
        }
    }
    d[x-1][y-1]=1;
    d[y-1][x-1]=1;
  
    for(ll i=0;i<n; i++){
    	for(ll j=i+1;j<n;j++){
        	d[i][j]=min(d[i][j],d[i][x-1]+d[j][y-1]+1);
        }
    }
    for(ll i=0;i<n; i++){
    	for(ll j=i+1;j<n;j++){
        	K[d[i][j]-1]++;
        }
    }
	for(ll i=0;i<n-1;i++){
    	cout << K[i] << endl;
    }
}

Measured memory_bytes: 31488
// AtCoder Beginner Contest 115 - Problem C: Christmas Eve (https://atcoder.jp/contests/abc115/tasks/abc115_c)
#include <bits/stdc++.h>

using namespace std;

using ll = long long;
using ii = pair<ll, ll>;

#define REP(i, a, b) for (int (i) = (a); (i) <= (b); (i)++)
#define REPN(i, N) for (int (i) = 0; (i) < N; (i)++)
#define DEC(i, b, a) for (int (i) = (b); (i) >= (a); (i)--)
#define DECN(i, N) for (int (i) = N - 1; (i) >= 0; (i)--)

#define LOG(var, sep) (cerr << #var << " = " << (var) << (sep))
#define LOGM(msg) (cerr << (msg))
#define LOGV(vec, sep) { cerr << #vec << " ="; for (const auto& v : (vec)) cerr << " " << v; cerr << (sep); }
#define LOGA(arr, N, sep) { cerr << #arr << " ="; for (int i = 0; i < N; ++i) cerr << " " << (arr)[i]; cerr << (sep); }
#define LOGA2(arr, N, M, sep) { cerr << #arr << " =\n"; for (int i = 0; i < N; ++i) { for (int j = 0; j < M; ++j) cerr << (arr)[i][j] << " "; cerr << endl; } cerr << (sep); }

ostream& operator<<(ostream& os, const ii& p)
{
    os << "(" << p.first << ", " << p.second << ")";
    return os;
}

const int MAX { 100010 };
const int oo { 2000000010 };

int hs[MAX];

void solve(int N, int K)
{
    sort(hs, hs + N);

    auto ans = oo;

    REPN(i, N - K + 1)
        ans = min(ans, hs[i + K - 1] - hs[i]);

    cout << ans << endl;
}

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

    int N, K;
    cin >> N >> K;

    REPN(i, N)
        cin >> hs[i];

    solve(N, K);

    return 0;
}


Measured memory_bytes: 640
#define _USE_MATH_DEFINES
#include <cassert>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <string>
#include <sstream>
#include <vector>
#include <queue>
#include <stack>
#include <list>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <algorithm>
#include <complex>
#include <cmath>
#include <numeric>
#include <bitset>
#include <functional>

using namespace std;

#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
  cerr << name << ": " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
  const char* comma = strchr(names + 1, ',');
  cerr.write(names, comma - names) << ": " << arg1 << " |";
  __f(comma + 1, args...);
}

typedef long long int64;
typedef pair<int, int> ii;
const int INF = 1 << 29;
const int MOD = 1e9 + 7;

int main() {
  int n, k;
  cin >> n >> k;
  if (k == 0) {
    cout << (int64)n * n << endl;
    return 0;
  }
  int64 ret = 0;
  for (int b = k + 1; b <= n; ++b) {
    int rem = min((n - k) % b + 1, b - k);
    int s = (n - k) / b;
    ret += (int64)(s + 1) * rem;
    int r = k + rem;
    if (r < b) {
      s = (n - r) / b;
      ret += (int64)(s + 1) * (b - r);
    }
  }
  cout << ret << endl;
  return 0;
}


Measured memory_bytes: 256
import sys


def main():
    input = sys.stdin.buffer.readline
    n = int(input())
    a = list(map(int, input().split()))
    b = [0] * (10 ** 6)
    ans = 0
    for i in range(n):
        if i - a[i] > 0:
            ans += b[i - a[i]]
        if i + a[i] < 10 ** 6:
            b[i + a[i]] += 1
    print(ans)


if __name__ == "__main__":
    main()


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

int main() {
  string N;
  cin >> N;
  if (N.at(0) == '7' || N.at(1) == '7' || N.at(2) == '7')
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
  
}


Measured memory_bytes: 3564
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define REP(i,n) for (int64_t i=0; i<(n); ++i)
#define P pair<int,int>
using ll=int64_t;
using namespace std;
#define ketasuu(n) fixed<<setprecision(n)
#define btoe(p) p.begin(),p.end()
#define etob(p) p.rbegin(),p.rend()
#define chmax(x,y) x=max(x,y)



int main(){
    int h,w; cin>>h>>w;
    vector<string> s(h);
    rep(i,h) cin>>s[i];
    rep(i,h){
        rep(j,w){
            int a, b, cnt=0;
            if(s[i][j]=='#') continue;
            for(int dx=-1; dx<2; ++dx){
                for(int dy=-1; dy<2; ++dy){
                    if(dx==0 && dy==0){
                        continue;
                    }
                    a=i+dx; b=j+dy;
                    if(0<=a && a<h && 0<=b && b<w){
                        if(s[a][b]=='#') cnt++;
                    }
                }
            }
            s[i][j]=cnt+'0';
        }
    }
    rep(i,h){
        cout<<s[i]<<endl;
    }
}

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

long double POW(long double x,int n){
    long double res = 1;
    while(n){
        if(n%2) res *= x;
        x *= x;
        n >>= 1;
    }
    return res;
}

int main(){
    long double N,K;
    cin >> N >> K;
    long double ans = 0;

    for(int i=1;i<=N;i++){
        if(i < K) {
            int k = i;
            int cnt = 0;
            while(K > k){
                k *= 2;
                cnt++;
            }
            ans += POW(0.5, cnt);
        }
        else ans += 1.0;
    }

    ans /= N;

    cout << setprecision(9) << ans << endl;
}


Measured memory_bytes: 256
#include <cstdio>

int main() {
  int factors[] = { 1, 2, 3, 4, 5, 6, 7, 8, 9 };
  for (auto i : factors) {
    for (auto j : factors) {
      std::printf("%dx%d=%d\n", i, j, i * j);
    }
  }
  return 0;
}

Measured memory_bytes: 912
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
#define LLINF 9223372036854775807
#define MOD ll(1e9+7)
#define all(x) (x).begin(),(x).end()
#define dbg(x) cerr<<#x<<": "<<x<<endl


int main(){
    int a, b;
    cin >> a >> b;
    if(a>=2*b-1){
        cout << "YES" << endl;
    }else{
        cout << "NO" << endl;
    }

    return 0;

}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#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()
#define RALL(A) A.rbegin(),A.rend()
typedef long long ll;
typedef pair<ll,ll> P;
const ll mod=1000000007;
const ll LINF=1LL<<60;
const int INF=1<<30;

int main(){
	int n,k;
	cin >> n >> k;
	int x;
	set<int> s;
	vector<ll> a(200001,0);
	for(int i = 0; i < n; i++) {
		cin >> x;
		s.emplace(x);
		a[x]++;
	}

	sort(ALL(a));
	a.erase(remove(ALL(a),0),a.end());//値が0のものをすべて削除
	ll ans = 0;
	if (s.size() > k){
		for(int i = 0; i < s.size() - k; i++) {
			ans += a[i];
		}
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 11136
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;

/**
 * Built using CHelper plug-in Actual solution is at the top
 */

public class Main {
	public static void main(String[] args) {
		InputStream inputStream = System.in;
		OutputStream outputStream = System.out;
		InputReader in = new InputReader(inputStream);
		PrintWriter out = new PrintWriter(outputStream);
		Task solver = new Task();
		solver.solve(1, in, out);
		out.close();
	}

	static class Task {
		public void solve(int testNumber, InputReader in, PrintWriter out) {
			int X = in.nextInt();
			int t = in.nextInt();
			if(X > t) {
				out.println(X - t);
			} else {
				out.println(0);
			}
		}
	}
	
	static class InputReader {
		public BufferedReader reader;
		public StringTokenizer tokenizer;

		public InputReader(InputStream stream) {
			reader = new BufferedReader(new InputStreamReader(stream), 32768);
			tokenizer = null;
		}

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

		public int nextInt() {
			return Integer.parseInt(next());
		}
	}
}

Measured memory_bytes: 21460
#include <bits/stdc++.h>
#define rep(i,n) for (ll i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int,int>;
 
int main(){
    string s;
    cin >> s;
    if(s == "ABC"){
        cout << "ARC" << endl;
    }else{
        cout << "ABC" << endl;
    }
    return 0;
}

Measured memory_bytes: 3628
#include <stdio.h>

int main(){
    int dif,min = 753;
    long int s;
    scanf("%ld",&s);
    while(s>99){
        dif = s%1000 - 753;
        if(dif < 0){
            dif = -dif;
        }
        if(dif<min){
            min = dif;
        }
        s /= 10;
    }
    printf("%d",min);
    return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
typedef unsigned long long ull;
typedef long long ll;
typedef pair<int, int> P;
map <int,int> mp;
vector<int> V;
list<int> L;
stack<int> S;
queue<int> Q;
deque<int> dq;
#define INF (1<<30)
#define INFLL (1ll<<60)
#define EPS (1e-10)
static const int MAX=1e5;
static const int MOD=1e9+7;
static const int NMAX=50;
static const int MMAX=50;

bool f[MAX+1];//篩　iが素数ならf[i]はfalse
void prime(){
    for(int i=2;i<=MAX;i++){
        if(f[i])continue;
        for(int j=i*2;j<=MAX;j+=i) f[j]=true;
    }
}

int main(){
    cin.tie(0);  ios::sync_with_stdio(false);
    int N;cin>>N;
    prime();
    int p=2;
    for(int i=0;i<N;i++){
        while(1){
            if(f[p]||p%5!=1){
                p++;
                continue;
            }
            cout<<(i?" ":"")<<p;
            p++;
            break;
        }
    }
    cout<<"\n";
    
    return 0;
}


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

main(){
  vector<pair<int,pair<string,int> > >v;
  int i=0,j,n,m,k;
  string s;
loop:
  v.clear();
  if(cin>>n>>m,!n)return 0;
  for(i=0;i<n;i++){
    cin>>s>>k;
    for(j=0;s[j]=='*';j++);
    v.push_back(make_pair(k,make_pair(s,j)));
  }
  for(k=0;m;m--){
    cin>>s;
    for(i=0;i<n;i++)
      if(s.substr(v[i].second.second)==v[i].second.first.substr(v[i].second.second))k+=v[i].first;
  }
  cout<<k<<endl;
goto loop;
}

Measured memory_bytes: 932
N = gets.to_i
S = gets.chomp.split("")

min = N

for i in 0...N do
  leader = i
  if leader == 0 then
    turner_to_e = 0
    turner_to_w = S[1...N].count("E")
  elsif leader == N - 1
    leaders_west = leader - 1
    if S[leaders_west] == "W" then
      turner_to_e += 1
    end
    if S[leader] == "E" then
      turner_to_w -= 1
    end
  else
    leaders_west = leader - 1
    leaders_east = leader + 1
    
    if S[leaders_west] == "W" then
      turner_to_e += 1
    end
    if S[leader] == "E" then
      turner_to_w -= 1
    end
  end
  # p "leader:" + i.to_s
  # p turner_to_e.to_s + " " + turner_to_w.to_s
  min = [min, turner_to_e + turner_to_w].min
end

p min

Measured memory_bytes: 30492
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i<(n); i++)
#define reps(i,s,n) for(int i=(s); i<(n); i++)
#define all(v) v.begin(),v.end()
#define outve(v) for(auto i : v) cout << i << " ";cout << endl
#define outmat(v) for(auto i : v){for(auto j : i) cout << j << " ";cout << endl;}
#define in(n,v) for(int i=0; i<(n); i++){cin >> v[i];}
#define out(n) cout << (n) << endl
#define fi first
#define se second
#define pb push_back
#define mod 1000000007
#define infi 1900000000
#define infl 1100000000000000000
#define cyes cout << "Yes" << endl
#define cno cout << "No" << endl
#define csp << " " <<
#define outset(n) cout << fixed << setprecision(n);
using namespace std;
using ll = long long;
using ld = long double;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vs = vector<string>;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;
using pii = pair<int,int>;
using pll = pair<ll,ll>;
using vvp = vector<vector<pair<int,int>>>;
template<typename T> using ve = vector<T>;
template<typename T> using pq2 = priority_queue<T>;
template<typename T> using pq1 = priority_queue<T,vector<T>,greater<T>>;
template<typename T> bool chmax(T &a, T b) {if(a < b) {a = b;return 1;}return 0;}
template<typename T> bool chmin(T &a, T b) {if(a > b) {a = b;return 1;}return 0;}




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

    int N;
    cin >> N;
    ll K;
    cin >> K;
    vi A(N);
    in(N,A);
    
    vi a(N+1,0);
    vi b;
    
    int n = 1;
    a[n] = 0;
    
    K++;
    while (a[n] != 1) {
        K--;
        if(K == 0) {
            cout << n << endl;
            return 0;
        }
        a[n] = 1;
        b.pb(n);
        n = A[n-1];
    }
    
    int m = 0;
    while (b[m] != n) {
        m++;
    }
    
    //cout << m csp K << endl;
    vi c;
    reps(i,m,int(b.size())) c.pb(b[i]);
    
    //outve(b);
    //outve(c);
    
    ll bb = ll(c.size());
    K %= bb;
    if(K-1 == -1) cout << c[bb-1] << endl;
    else cout << c[K-1] << endl;
    
    
    
    
    

    return 0;
}


Measured memory_bytes: 6840
#include <bits/stdc++.h>
#define mset(a, b) memset(a, b, sizeof(a))
#define mcpy(a, b) memcpy(a, b, sizeof(a))
#define rg register
using namespace std;
typedef long long LL;
const int MAXN = 500005;
const int MOD = 998244353;

template <typename T> inline void read(T &AKNOI) {
	T x = 0, flag = 1;
	char ch = getchar();
	while (!isdigit(ch)) {
		if (ch == '-') flag = -1;
		ch = getchar();
	}
	while (isdigit(ch)) {
		x = x * 10 + ch - '0';
		ch = getchar();
	}
	AKNOI = flag * x;
}

namespace ModCalculator {

inline void Inc(int &x, int y) {
	x += y; if (x >= MOD) x -= MOD;
}
inline void Dec(int &x, int y) {
	x -= y; if (x < 0) x += MOD;
}
inline int Add(int x, int y) {
	Inc(x, y); return x;
}
inline int Sub(int x, int y) {
	Dec(x, y); return x;
}
inline int Mul(int x, int y) {
	return 1LL * x * y % MOD;
}

}
using namespace ModCalculator;

inline int ksm(int x, int k) {
	int ret = 1;
	while (k) {
		if (k & 1) ret = Mul(ret, x);
		x = Mul(x, x);
		k >>= 1;
	}
	return ret;
}

int n, m;
int fac[MAXN], finv[MAXN], npw[MAXN], mpw[MAXN];

inline int C(int x, int y) {
	return Mul(fac[x], Mul(finv[y], finv[x - y]));
}

void init() {
	read(n); read(m);
	if (n > m) swap(n, m);
	fac[0] = 1;
	for (int i = 1; i <= m; ++i) {
		fac[i] = Mul(fac[i - 1], i);
	}
	finv[m] = ksm(fac[m], MOD - 2);
	for (int i = m - 1; i >= 0; --i) {
		finv[i] = Mul(finv[i + 1], i + 1);
	}
	npw[0] = mpw[0] = 1;
	for (int i = 1; i <= m; ++i) {
		npw[i] = Mul(npw[i - 1], n + 1);
	}
	for (int i = 1; i <= n; ++i) {
		mpw[i] = Mul(mpw[i - 1], m + 1);
	}
}

void solve() {
	int ans = 0;
	for (int i = 0; i <= n; ++i) {
		int tmp = Mul(Mul(Mul(C(n, i), C(m, i)), fac[i]), Mul(npw[m - i], mpw[n - i]));
		(i & 1)? Dec(ans, tmp) : Inc(ans, tmp);
	}
	printf("%d\n", ans);
}

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


Measured memory_bytes: 8064
data class Double2D(val x: Double, val y: Double) {
  operator fun plus(o: Double2D) = Double2D(x + o.x, y + o.y)
  operator fun minus(o: Double2D) = Double2D(x - o.x, y - o.y)
  operator fun times(o: Double) = Double2D(x * o, y * o)
  fun norm2() = x * x + y * y
  fun norm() = Math.sqrt(x * x + y * y)
}

fun cross(v1: Double2D, v2: Double2D) = v1.x * v2.y - v1.y * v2.x

fun dot(v1: Double2D, v2: Double2D) = v1.x * v2.x + v1.y * v2.y

fun ccw(p: Double2D, q: Double2D, r: Double2D): Int {
  val vq = q - p
  val vr = r - p
  if (cross(vq, vr) > 0)   return +1     // counter clockwise
  if (cross(vq, vr) < 0)   return -1     // clockwise
  if (dot(vq, vr) < 0)     return +2     // r-p-q on line
  if (vq.norm2() < vr.norm2()) return -2 // p-q-r on line
  return 0
}

fun compareDouble2D(p1: Double2D, p2: Double2D): Int {
  if (p1.x != p2.x) {
    return java.lang.Double.compare(p1.x, p2.x)
  }
  return java.lang.Double.compare(p1.y, p2.y)
}

fun convexHull(inputPs: List<Double2D>): List<Double2D> {
  // Kotlin 1.0 workaround: Kotlin Comparator is not implemented. Use Java Comparator instead.
  val ps = inputPs.sortedWith(java.util.Comparator { p1, p2 -> compareDouble2D(p1, p2) })
  val n = ps.size
  val qs = mutableListOf<Double2D>()
  for (i in 0 until n) {
    while (qs.size >= 2 &&
        // Use "<= 0" here to exclude a point on an edge.
        ccw(qs[qs.size - 2], qs[qs.size - 1], ps[i]) == -1) {
      qs.removeAt(qs.size - 1)
    }
    qs.add(ps[i])
  }
  val lowerHullSize = qs.size
  for (i in n - 2 downTo 0) {
    while (qs.size >= lowerHullSize &&
        // Use "<= 0" here to exclude a point on an edge.
        ccw(qs[qs.size - 2], qs[qs.size - 1], ps[i]) == -1) {
      qs.removeAt(qs.size - 1)
    }
    qs.add(ps[i])
  }
  qs.removeAt(qs.size - 1)
  return qs
}

fun main(args: Array<String>) {
  val n = readLine()!!.toInt()
  // Kotlin 1.0 workaround: List(size, init) doesn't work.
  val ps = Array(n, {
    val (x, y) = readLine()!!.split(" ").map(String::toInt)
    Double2D(x.toDouble(), y.toDouble()) })
      .asList()
  val qs = convexHull(ps)
  val m = qs.size
  val args = mutableMapOf<Double2D, Double>()
  for (i in qs.indices) {
    val q0 = qs[i]
    val q1 = qs[(i + 1) % m]
    val q2 = qs[(i + (m - 1)) % m]
    val v1 = q1 - q0
    val v2 = q2 - q0
    val cosTheta = dot(v1, v2) / v1.norm() / v2.norm()
    val theta = Math.acos(cosTheta)
    args[qs[i]] = Math.PI - theta
  }
  for (p in ps) {
    if (args.containsKey(p)) {
      val arg = args[p]!!
      println(String.format("%.9f", arg / (2.0 * Math.PI)))
    } else {
      println(0.0)
    }
  }
}

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

string FMT_F = "%.15f";

static string[] s_rd;
T RD(T = long)() { while(!s_rd.length) s_rd = readln.chomp.split; string res = s_rd[0]; s_rd.popFront; return res.to!T; }
string RDR()() { return readln.chomp; }
T[] ARR(T = long)(in string str, T fix = 0) { auto r = str.split.to!(T[]); r[] += fix; return r; }
T[] RDA(T = long)(T fix = 0) { auto r = readln.chomp.split.to!(T[]); r[] += fix; return r; }
T[][] RDA2(T = long)(size_t n, T[] fix = []) { auto r = new T[][](n); foreach (i; 0..n) { r[i] = readln.chomp.split.to!(T[]); foreach (j, e; fix) r[i][j] += e; } return r; }
size_t[] MAKE_IDX(alias less = "a < b", Range)(Range range) { auto idx = new size_t[](range.length); makeIndex!(less)(range, idx); return idx;}
size_t MIN_POS(alias less = "a < b", Range)(Range range) { auto r = minPos!(less)(range); return range.length - r.length; }

bool inside(T)(T x, T b, T e) { return x >= b && x < e; }
long lcm(long x, long y) { return x * y / gcd(x, y); }

long mod = 10^^9 + 7;
//long mod = 998244353;
//long mod = 1_000_003;
void moda(ref long x, long y) { x = (x + y) % mod; }
void mods(ref long x, long y) { x = ((x + mod) - (y % mod)) % mod; }
void modm(ref long x, long y) { x = (x * y) % mod; }

struct UnionFind
{
	void init(int n) { par = new int[](n); foreach (i; 0..n) par[i] = i; cnt = new int[](n); fill(cnt, 1); }
	int root(int i) { return par[i] == i ? i : (par[i] = root(par[i])); }
	bool same(int i, int j) { return root(i) == root(j); }
	void unite(int i, int j) { i = root(i); j = root(j); if (i == j) return; par[i] = j; cnt[j] += cnt[i]; }
	int size(int i) { return cnt[root(i)]; }
	int[] par, cnt;
}

void main()
{
	auto N = RD;
	auto xy = new long[][](N);
	foreach (i; 0..N)
	{
		xy[i] = [RD, RD];
	}
	auto index1 = xy.MAKE_IDX!"a[0] < b[0]"();
	auto index2 = xy.MAKE_IDX!"a[1] < b[1]"();
	long[3][] edges;
	foreach (ii; 1..N)
	{
		auto i = index1[ii-1];
		auto j = index1[ii];
		auto d = xy[j][0] - xy[i][0];
		edges ~= [i, j, d];
	}
	foreach (ii; 1..N)
	{
		auto i = index2[ii-1];
		auto j = index2[ii];
		auto d = xy[j][1] - xy[i][1];
		edges ~= [i, j, d];
	}
	edges.sort!"a[2] < b[2]"();

	long ans;
	UnionFind uf;
	uf.init(cast(int)N);
	foreach (edge; edges)
	{
		auto i = cast(int)edge[0];
		auto j = cast(int)edge[1];
		auto d = edge[2];
		if (uf.same(i, j)) continue;
		uf.unite(i, j);
		ans += d;
	}

	writeln(ans);
	stdout.flush();
	debug readln();
}

Measured memory_bytes: 24444
#include <bits/stdc++.h>
#define ll long long int
#define Max 100007

using namespace std;

struct m{
    ll a, b;
};

bool cmp(m a, m b){
    return a.a + a.b > b.a + b.b;
}

ll n;
m x[Max];

int main() {
    ios::sync_with_stdio(false);
    cin >> n;

    for(ll i = 0 ; i < n ; i++)
        cin >> x[i].a >> x[i].b;

    sort(x,x+n,cmp);

    ll ta = 0, ao = 0;
    bool f = false;
    for(ll i = 0 ; i < n ; i++){
        if(!f)
            ta += x[i].a;
        else
            ao += x[i].b;
        f = !f;
    }
    cout << ta - ao;

    return 0;
}


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

int main(){
	int a,b,c;
	cin>>a>>b>>c;
	if(b>c) swap(b,c);
	if(a>c) swap(a,c);
	if(a>b) swap(a,b);

	cout <<a<<" "<<b<<" "<<c<<endl;
	return 0;
}

Measured memory_bytes: 3092
#include <stdio.h>

int main( void )
{
	int n;
	int number[ 5000 ];
	int i;
	int j;
	
	int max;
	int ans;
	
	while( 1 )
	{
		scanf( "%d", &n );
		if( n == 0 )break;
		max = 0;
		
		for( i = 0; i < n; i++ )
		{
			scanf( "%d", &number[i] );
			max += number[i];
		}
		for( i = 0; i < n; i++ )
		{
			ans = 0;
			for( j = i; j < n; j++ )
			{
				ans += number[j];
				if( ans > max )
				{
					max = ans;
				}
			}
		}
		printf( "%d\n", max );
		
	}
	
	return (0);
}

Measured memory_bytes: 616
#include<map>
#include<set>
#include<list>
#include<cmath>
#include<queue>
#include<stack>
#include<cstdio>
#include<string>
#include<vector>
#include<complex>
#include<cstdlib>
#include<cstring>
#include<climits>
#include<numeric>
#include<sstream>
#include<iostream>
#include<algorithm>
#include<functional>

#define MP make_pair
#define PB push_back
#define ALL(x) (x).begin(),(x).end()
#define REP(i,n) for(int i=0;i<(n);i++)
#define REP1(i,n) for(int i=1;i<(n);i++)
#define REP2(i,d,n) for(int i=(d);i<(n);i++)
#define RREP(i,n) for(int i=(n);i>=0;i--)
#define CLR(a)      memset((a),0,sizeof(a))
#define MCLR(a)     memset((a),-1,sizeof(a))
#define RANGE(x,y,maxX,maxY) (0 <= (x) && 0 <= (y) && (x) < (maxX) && (y) < (maxY))

using namespace std;

typedef long long LL;
typedef unsigned long long ULL;
typedef vector<int> VI;
typedef vector<VI > VVI;
typedef vector<string> VS;
typedef vector<LL> VLL;
typedef pair<int,int> PII;

const int INF = 0x3f3f3f3f;
const LL INFL = 0x3f3f3f3f3f3f3f3fLL;
const double EPS = 1e-9;

const int DX[]={1,0,-1,0},DY[]={0,-1,0,1};

int main(){
	int n;
	cin >> n;
	int sum=0;
	REP(i,n+1)
		sum+=i;
	cout << sum << endl;

	return 0;
}



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 N;
    cin >> N;
    vector<ll> a(3 * N);
    rep(i, 3*N) cin >> a[i];
    sort(a.begin(), a.end(), greater<ll>());
    rep(i, N) a.pop_back();
    ll ans = 0;
    rep(i, 2*N){
        if(i % 2 == 1){
            ans += a[i];
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 2560
#![allow(unused_imports)]
// use itertools::Itertools;
use proconio::{input, marker::*};

fn main() {
    input! {
        a: usize,
        b: usize,
        c: usize,
        d: usize,
    };
    println!("{}", std::cmp::max(a * b, c * d));
}


Measured memory_bytes: 2104
import heapq
INFTY = 10**6
N,M = map(int,input().split())
G = {i:[] for i in range(1,N+1)}
for _ in range(M):
    a,b = map(int,input().split())
    G[a].append(b)
    G[b].append(a)
dist = [INFTY for _ in range(N+1)]
hist = [0 for _ in range(N+1)]
heap = [(0,1)]
dist[1] = 0
hist[1] = 1
pre = {1:0}
while heap:
    d,x = heapq.heappop(heap)
    if d>dist[x]:continue
    for y in G[x]:
        if hist[y]==0:
            if dist[y]>d+1:
                dist[y] = d+1
                pre[y] = x
                heapq.heappush(heap,(d+1,y))
flag = 0
for i in range(1,N+1):
    if dist[i]>=INFTY:
        flag = 1
        break
if flag==1:
    print("No")
else:
    print("Yes")
    for i in range(2,N+1):
        print(pre[i])

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

ll N;


int main(){
	cin >> N;
	ll result = 0;
	
	if ( N % 2 == 0 ){
		ll ct = N / 10;
		result += ct;
		while ( ct ){
			ct /= 5;
			result += ct;
		}
	}
	else
		result = 0;
	
	cout << result << endl;
	
	return 0;
}



Measured memory_bytes: 256
#[allow(unused_imports)]
use std::char::*;
#[allow(unused_imports)]
use std::cmp::*;
use std::io::*;
use std::str::FromStr;
#[allow(unused_imports)]
use std::collections::*;

#[allow(unused_macros)]
macro_rules! debug {
    ($($a:expr),*) => {
        eprintln!(concat!($(stringify!($a), " = {:?}, "),*), $($a),*);
    }
}

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

#[derive(PartialEq, PartialOrd)]
pub struct Total<T>(pub T);

impl<T: PartialEq> Eq for Total<T> {}

impl<T: PartialOrd> Ord for Total<T> {
    fn cmp(&self, other: &Total<T>) -> std::cmp::Ordering {
        self.0.partial_cmp(&other.0).unwrap()
    }
}

pub trait LexicalPermutation {
    fn next_permutation(&mut self) -> bool;
    fn prev_permutation(&mut self) -> bool;
}

impl<T> LexicalPermutation for [T] where T: Ord {
    fn next_permutation(&mut self) -> bool {
        if self.len() < 2 { return false; }
        let mut i = self.len() - 1;
        while i > 0 && self[i-1] >= self[i] {
            i -= 1;
        }
        if i == 0 {
            return false;
        }
        let mut j = self.len() - 1;
        while j >= i && self[j] <= self[i-1]  {
            j -= 1;
        }
        self.swap(j, i-1);
        self[i..].reverse();
        true
    }

    fn prev_permutation(&mut self) -> bool {
        if self.len() < 2 { return false; }
        let mut i = self.len() - 1;
        while i > 0 && self[i-1] <= self[i] {
            i -= 1;
        }
        if i == 0 {
            return false;
        }
        self[i..].reverse();
        let mut j = self.len() - 1;
        while j >= i && self[j-1] < self[i-1]  {
            j -= 1;
        }
        self.swap(i-1, j);
        true
    }
}

//const MAX:usize = 100006;
//const INF:u64 = u64::max_value();

fn main() {
    let a:Vec<i32> = (0..5).map(|_| read()).collect();

    let mut b:Vec<i32> = vec![];
    for el in a.iter() {
        b.push(
            if el%10 == 0 { *el }
            else {*el + 10 - (*el%10)}
        );
    }
    let mut ans:i32 = b.iter().sum();
    for (i, el) in a.iter().enumerate() {
        let sum:i32 = b.iter().enumerate().filter(|&(j,_x)| j!=i).map(|(_j,x)| x).sum();
        //debug!(i,el,sum);
        ans = min(ans, sum+el);
    }

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


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

using namespace std;
using ll = long long;

#pragma region Macros
#define FOR(i, m, n) for (ll i = (ll)(m); i < (ll)(n); i++)
#define rep(i, n) FOR(i, 0, n)

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

template <class T> string join(const T &v, const string delim = ",")
{
    if (v.empty())
        return "";

    ostringstream res;
    res << v[0];
    for (int i = 1; i < v.size(); i++)
    {
        res << delim << v[i];
    }
    return res.str();
}

#ifdef LOCAL
#define dbg(x) cerr << __LINE__ << ":" << #x << " = " << (x) << endl;
#else
#define dbg
#endif

#pragma endregion Macros

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

    vector<ll> a(N+2);
    rep(i, N) cin >> a[i+1];

    ll ans = 0;

    for (int i = 1; i <= N; i++) {
        // a[i-1]との和がxより大きい場合、a[i]を減らす
        if(a[i-1]+a[i] > x){
            ll tmp = (a[i - 1] + a[i])-x;
            ans += tmp;
            a[i] -= tmp;
        }

        // a[i+1]との和がxより大きい場合、a[i+1]から減らせるだけ減らす
        // 減らせなくなったらa[i]から減らす
        if(a[i+1] + a[i] > x){
            ll tmp = (a[i + 1] + a[i])-x;

            if (a[i + 1] >= tmp){
                a[i + 1] -= tmp;
            }else{
                a[i] -= (tmp - a[i + 1]);
                a[i + 1] = 0;
            }
            ans += tmp;
        }
    }

    cout << ans << endl;
}


Measured memory_bytes: 3992
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <queue>
#include <stack>
#include <set> 
#include <map>
#include <bitset>
#include <cctype>
#include <cmath>
#include <cstring>
#include <iomanip>
#define REP(i,n) for(int i=0; i<(n); ++i)
#define FOR(i,a,b) for(int i=(a); i<(b); ++i)
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
const int INF = 100100100;
const ll INFLL = 1001001001001001001;  // > 10^18
const int MOD = (int)1e9 + 7;
const ll MODLL = (ll)1e9 + 7;
const double EPS = 1e-9;

int main () {

    int n; cin >>n;
    vector<ll> a(n); REP(i,n) cin >> a[i];

    vector<ll> x(n, 0);
    for (int i = 0; i < n; i++) {
        if (i % 2 == 0) {
            x[0] += a[i];
        } else {
            x[0] -= a[i];
        } 
    }

    for (int i = 1; i < n; i++) {
        x[i] = 2*a[i-1] - x[i-1];
    }

    for (int i = 0; i < n; i++) {
        cout << x[i];
        if (i < n -1) {
            cout << " ";
        } 
    }
    cout << endl;

    return 0;
}



Measured memory_bytes: 2944
#include "bits/stdc++.h"
using namespace std;
vector<int> g[101010];

int dfs(int v, int prev) {
        int res = 0;
        for (int u : g[v]) if (u != prev) res ^= dfs(u, v) + 1;
        return res;
}

int main() {
        int n, a, b;
        cin >> n;
        for (int i = 0; i < n - 1; i ++) {
                cin >> a >> b;
                a --, b --;
                g[a].push_back(b);
                g[b].push_back(a);
        }
        cout << (dfs(0, -1) == 0 ? "Bob" : "Alice") << endl;
        return 0;
}



Measured memory_bytes: 10368
#include <bits/stdc++.h>
using namespace std;
#define MOD 1000000007

int main() {
    int N;
    cin >> N;
    vector<int> B(N-1);
    for(int i=0;i<N-1;i++){
        cin >> B.at(i);
    }
    int ans = B.at(0);
    for(int i=1; i<N-1; i++){
        if(B.at(i-1) >= B.at(i)){
            ans += B.at(i);
        }
        else{
            ans += B.at(i-1);
        }
    }
    ans += B.at(N-2);

    cout << ans << endl;
}



Measured memory_bytes: 256
from heapq import heappush, heappop

money = 10**15
N, M, s, t = map(int, input().split())
s -= 1; t -= 1
graph = [[[] for i in range(N)] for _ in range(2)]
for i in range(M):
  u, v, a, b = map(int, input().split())
  u -= 1; v -= 1
  graph[0][u].append((v, a)); graph[0][v].append((u, a))
  graph[1][u].append((v, b)); graph[1][v].append((u, b))


def dijkstra(s, mode):
  dist = [-1] * N
  dist[s] = 0
  e = []
  for child, cost in graph[mode][s]:
    heappush(e, (cost, child))
  while e:
    cost, node = heappop(e)
    if dist[node] >= 0:
      continue
    dist[node] = cost
    for child, c in graph[mode][node]:
      if dist[child] >= 0:
        continue
      heappush(e, (cost+c, child))
  return dist
  
dist = [dijkstra(s, 0), dijkstra(t, 1)]  
value = [dist[0][i]+dist[1][i] for i in range(N)]

ans = []
cost = []
for i in range(N-1, -1, -1):
  heappush(cost, value[i])
  ans.append(money - cost[0])

print(*(ans[::-1]), sep='\n')

Measured memory_bytes: 123900
#include <bits/stdc++.h>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace __gnu_pbds; 
#define ordered_set tree < pairs ,  null_type , greater<pairs>,  rb_tree_tag ,  tree_order_statistics_node_update > 
#define ll long long
#define lld long double
#define vc vector<ll>
const ll MOD=(1e9 +7);
typedef pair<ll,ll>pairs;
ll power(ll a, ll b){ll res=1;a=a%MOD;while(b>0){if(b&1){res=(res*a)%MOD;b--;}a=(a*a)%MOD;b>>=1;}
    return res;}

int main() {
	// your code goes here
	std::ios::sync_with_stdio(false);
	cin.tie(NULL);cout.tie(NULL);
	ll t,a,b,n,i,j,k,c,f;
	cin>>a>>b;
	ll mn,mx;
	mn=min(a,b);mx=max(a,b);
	ll cnt=max(-mn,0ll)-max(-mx+1,0ll);
	if(mx>=0&&mn<=0)cout<<"Zero";
	else if(cnt&1)cout<<"Negative";
	else cout<<"Positive";
	return 0;
}


Measured memory_bytes: 3596
#define _USE_MATH_DEFINES
#include <iostream>
#include <string>
#include <vector>
#include <math.h>
#include <algorithm>
using namespace std;

int main() {
	
	int A, B, X;

	cin >> A >> B;

	X = A * B;

	cout << X;
	
	return 0;
	
}

Measured memory_bytes: 3644
#include <cstdio>
#include <iostream>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <climits>
#include <cfloat>
#include <functional>
#include <cctype>

using namespace std;

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

string X, Y;

void solve(int x_size, int y_size)
{
	vector< vector<int> > dp(x_size + 1, vector<int>(y_size + 1));

	for(int i = 0; i < x_size; ++i) {
		for(int j = 0; j < y_size; ++j) {
			if(X[i] == Y[j]) {
				dp[i + 1][j + 1] = dp[i][j] + 1;
			}
			else {
				dp[i + 1][j + 1] = max(dp[i][j + 1], dp[i + 1][j]);
			}
		}
	}

	cout << dp[x_size][y_size] << endl;
}

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

	int n;
	cin >> n;
	REP(i, n) {
		cin >> X >> Y;
		solve(X.size(), Y.size());
	}
	return 0;
}

Measured memory_bytes: 5044