akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vs = vector<string>;
using msi = map<string, int>;
using mii = map<int, int>;
using psi = pair<string, int>;
using pii = pair<int, int>;
using vlai = valarray<int>;
#define rep(i,n) for(int i=0;i<n;i++)
#define range(i,s,n) for(int i=s;i<n;i++)
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define fs first
#define sc second
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define INF 1E9
#define EPS 1E-9
#define MOD (ll)(1E9+7)
#define PI 3.1415926535897932384

template <class T>ostream &operator<<(std::ostream &o, const vector<T> &v)
{
	rep(i, v.size()) {
		o << (i > 0 ? " " : "") << v[i];
	}
	return o;
}



int main() {
	int n, a, b, c, x,xini;
	while (1) {
		int frame=0,now=0;
		cin >> n >> a >> b >> c >> x;
		xini = x;
		if (n == 0) break;
		vi v(n, 0);
		rep(i, n) {
			cin >> v[i];
		}
		if(v[0]==x){
		    now++;
		}
		while(frame<=10001&&now<n){
		    if((a*x+b)%c==v[now]){
		        now++;
		    }
		    x=(a*x+b)%c;
		    frame++;
		}
		if(frame>=10001){
		    cout<<-1<<endl;
		}else{
		    cout<<frame<<endl;
		}
	}
}



Measured memory_bytes: 3076
#include<bits/stdc++.h>
#define INF 2000000000
#define MOD 1000000007
#define EPS (1e-10)

using namespace std;

void Eratosthenes(vector<int> &v){
	int N = pow(10,6);
	vector<int> arr(N,1);

	for(int i = 2; i < sqrt(N); i++){
		if(arr[i]){
			for(int j = 0; i * (j + 2) < N; j++){
				arr[i *(j + 2)] = 0;
			}
		}
	}

	for(int i = 2; i < N; i++){
		if(arr[i]){
			v.push_back(i);
		}
	}
}
int main(int argc, char *argv[]) {

	vector<int> primes;
	Eratosthenes(primes);

	int N; cin >> N;

	
	bool flag = false;
	for (int i = 0; i < primes.size(); i++) {
		if (N == primes[i]) {
			flag = true;	
		}
	}
	int pow_ten = 1;
	int repsept = 7;
	int cnt = 1;
	while(cnt < pow(10,6) and repsept % N != 0) {
		pow_ten *= 10;
		pow_ten %= N;
		int next = pow_ten * 7;
		next %= N;
		repsept %= N;
		repsept += next;
		cnt++;
	}
	if (cnt == pow(10,6)) {
		cout << -1 << endl;	
	}else {
		cout << cnt << endl;
	}

	return 0;
}


Measured memory_bytes: 7644
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll MOD = 1e9 + 7/*998244353*/;
const ll INF = 1LL << 60;
ll mod_pow(ll, ll, ll); ll mod_fact(ll, ll); ll mod_inv(ll, ll); ll gcd(ll, ll); ll lcm(ll, ll);
//
int main(){
    int h1, m1, h2, m2, k;
    cin >> h1 >> m1 >> h2 >> m2 >> k;
    cout << (h2 - h1) * 60 + (m2 - m1) - k << "\n";
}

Measured memory_bytes: 3632
//#include"pch.h"
//#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
#include<stdlib.h>
#include<cmath>
#include<math.h>
#include<string>
#include<algorithm>
#include<iostream>
using namespace std;
int main() {
	int a, b, c;
	cin >> a >> b >> c;
	if (a >= b && a >= c)cout << a * 10 + b + c;
	else if (b >= a && b >= c)cout << b * 10 + a + c;
	else cout << c * 10 + a + b;
	
	
	return(0);
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n;cin >> n;
  vector<int> a(n),c(32);
  c[0]=1;
  for(int i=1;i<32;i++){
    c[i]=c[i-1]*2;
  }
  map<int,int> mp;
  for(int i=0;i<n;i++){
    cin >> a[i];
    mp[a[i]]++;
  }
  int ans=0;
  sort(a.begin(),a.end(),greater<int>());
  for(int i=0;i<n;i++){
    for(int j=31;j>=0;j--){
      if(c[j]>a[i]&&mp[a[i]]&&mp[c[j]-a[i]]){
        if(a[i]==c[j]-a[i]){
          if(mp[a[i]]>=2){
            ans++;
            mp[a[i]]-=2;
          }
        }
        else{
          ans++;
          mp[a[i]]--;
          mp[c[j]-a[i]]--;
        }
      }
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 29824
#include<stdio.h>
#include<string.h>
int main(){
char S[10];
int b=0;
  scanf("%s",S);
  if(strcmp(S,"hi")==0)b=1;
  if(strcmp(S,"hihi")==0)b=1;
  if(strcmp(S,"hihihi")==0)b=1;
  if(strcmp(S,"hihihihi")==0)b=1;
  if(strcmp(S,"hihihihihi")==0)b=1;
  if(b==1)printf("Yes");
  else printf("No");
return 0;
}

Measured memory_bytes: 128
#include<iostream>
using namespace std;
#define INF 1000000000
typedef long long int ll;
int dp[1001][1001];
int main(){
	int n,m;
	int dis[1001],we[1001];
	cin >> n >> m;
	for(int i=0;i<n;i++){
		cin >> dis[i];
	}
	for(int i=0;i<m;i++){
		cin >> we[i];
	}
	for(int i=0;i<=m;i++){
		for(int j=0;j<=n;j++){
			dp[i][j] = INF;
		}
	}
	dp[0][0] = 0;
	for(int i=1;i<=m;i++){
		dp[i][0] = 0;
		for(int j=0;j<=n;j++){
			if(dp[i-1][j] == INF) continue;
			dp[i][j+1] = min(dp[i-1][j+1],dp[i-1][j]+dis[j]*we[i-1]);
		}
	}
	cout << dp[m][n] << endl;
}

Measured memory_bytes: 5080
#include<bits/stdc++.h>
using namespace std;
int main() {
  int N;
  cin >> N;
  vector<int> L(N);
  for (auto& x : L) cin >> x;
  int ans = 0;
  for (int i = 0; i < N; i++) {
    for (int j = i + 1; j < N; j++) {
      for (int k = j + 1; k < N; k++) {
        int a[3] = {L[i], L[j], L[k]};
        if (a[0] == a[1] || a[1] == a[2] || a[0] == a[2]) continue;
        sort(a, a + 3);
        ans += (a[0] + a[1] > a[2]);
      }
    }
  }
  cout << ans << endl;
}

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

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

    vector<pair<int, int>> vpii;
    for (int i = 0; i < N; i++) {
        int t;
        cin >> t;
        vpii.push_back(make_pair(t, i + 1));
    }
    sort(vpii.begin(), vpii.end());

    bool f = true;
    for (auto pii : vpii) {
        if (!f) {
            cout << " ";
        }
        f = false;
        cout << pii.second;
    }
    cout << "\n" << endl;

    return 0;
}


Measured memory_bytes: 1780
#include<stdio.h>

int main(){
  long i,j,k;
  long ans,X,Y,tmp;
  
  scanf("%ld %ld",&X,&Y);
  ans=1;
  while(X <= Y){
    tmp = X;
    X = tmp*2;
    ans++;
  }
  
  printf("%ld\n",ans-1);
  return 0;
}

Measured memory_bytes: 128
#include<iostream>
#include<cstdio>
#include<cstring>
using namespace std;
int main() 
{
    char str[1010],s=0;
    cin>>str; 
    for(int i=0;i<strlen(str);i++)
    {
        if(s==0) 
        {
            if(str[i]=='C') s++;
        }
        if(s==1) 
        {
            if(str[i]=='F') s++;
        }
    }    
    if(s==2) cout<<"Yes";
    else cout<<"No";
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h> 
using namespace std;
signed main(){
  int a=0;
  char s[16];
  string v="CODEFESTIVAL2016";
  for(int i=0;i<16;i++){
    cin>>s[i];
    if(s[i] != v[i])
      a++;
    }
  cout<<a<<endl;
  return(0);
}


Measured memory_bytes: 256
import java.io.*;
import java.util.*;

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

        System.out.println(Math.abs(sc.nextLong() - sc.nextLong()) <= 1 ? "Brown" : "Alice");

        out.flush();
        out.close();
    }

    static class Scanner {
        StringTokenizer st;
        BufferedReader br;

        public Scanner(InputStream s) {
            br = new BufferedReader(new InputStreamReader(s));
        }

        public Scanner (FileReader f) {br = new BufferedReader(f);}

        public String next() throws IOException {
            while (st == null || !st.hasMoreTokens())
                st = new StringTokenizer(br.readLine());
            return st.nextToken();
        }

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

        public long nextLong() throws IOException {
            return Long.parseLong(next());
        }

        public String nextLine() throws IOException {
            return br.readLine();
        }

        public double nextDouble() throws IOException {
            String x = next();
            StringBuilder sb = new StringBuilder("0");
            double res = 0, f = 1;
            boolean dec = false, neg = false;
            int start = 0;
            if (x.charAt(0) == '-') {
                neg = true;
                start++;
            }
            for (int i = start; i < x.length(); i++)
                if (x.charAt(i) == '.') {
                    res = Long.parseLong(sb.toString());
                    sb = new StringBuilder("0");
                    dec = true;
                } else {
                    sb.append(x.charAt(i));
                    if (dec)
                        f *= 10;
                }
            res += Long.parseLong(sb.toString()) / f;
            return res * (neg ? -1 : 1);
        }

        public boolean ready() throws IOException {
            return br.ready();
        }

    }
}

Measured memory_bytes: 21460
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main()
{
    ll n, a, b;
    cin >> n >> a >> b;
    
    cout << ( a % 2 == b % 2 ? (b - a) / 2 :(min(a - 1, n - b) + 1 + (b - a - 1) / 2))<< endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);++i)
#define ALL(A) A.begin(), A.end()

using namespace std;

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

void solve(string& t, string s){
	int N = (int)s.length();
	for (int j = 1; j < N - 2; ++j){
		if (t[j] == 'S'){
			if (s[j] == 'o'){
				t[j+1] = t[j-1];
			}else{ // if (s[j] == 'x')
				t[j+1] = (t[j-1] == 'S' ? 'W' : 'S');
			} // end if
		}else{ // if (t[j] == 'W')
			if (s[j] == 'o'){
				t[j+1] = (t[j-1] == 'S' ? 'W' : 'S');
			}else{ // if (s[j] == 'x')
				t[j+1] = t[j-1];
			} // end if
		} // end if
	} // end for
}

bool check(string t, string s){
	int N = (int)t.length();
	rep (i, N){
		if (s[i] == 'o'){
			if (t[i] == 'S'){
				if (t[(N-1+i)%N] != t[(i+1)%N]) return false;
			}else{ // if (t[i] == 'W')
				if (t[(N-1+i)%N] == t[(i+1)%N]) return false;
			} // end if
		}else{ // if (s[i] == 'x'){
			if (t[i] == 'S'){
				if (t[(N-1+i)%N] == t[(i+1)%N]) return false;
			}else{ // if (t[i] == 'W')
				if (t[(N-1+i)%N] != t[(i+1)%N]) return false;
			} // end if
		} // end if
	} // end rep
	return true;
}

int main()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	int N; cin >> N;
	string s; cin >> s;
/*
	assert(N < 20);

	rep (i, 1<<N){
		string t = "";
		rep (j, N){
			if (i & (1<<j)){
				t += 'S';
			}else{
				t += 'W';
			} // end if
		} // end rep
		string u = "";
		rep (j, N){
			if (t[(N + j - 1) % N] == t[(j + 1) % N]){
				u += (t[j] == 'S' ? 'o' : 'x');
			}else{
				u += (t[j] == 'S' ? 'x' : 'o');
			} // end if
		} // end rep
		if (s == u){
			cout << t << endl;
			return 0;
		} // end if
	} // end rep
*/
	string res = "";
	rep (i, (1<<3)){
		string t(N, '.');
		rep (j, 3){
			if (i & (1<<j)){
				t[(N - 1 + j) % N] = 'S';
			}else{
				t[(N - 1 + j) % N] = 'W';
			} // end if
		} // end rep
		if (s[0] == 'o'){
			if (t[0] == 'S'){
				if (t[N-1] != t[1]) continue;
			}else{ // if (t[0] == 'W')
				if (t[N-1] == t[1]) continue;
			} // end if
			solve(t,s);
			if (t[N-2] == 'S'){
				if (s[N-2] == 'o'){
					if (t[N-3] != t[N-1]) continue;
				}else{ // if (s[N-1] == 'x')
					if (t[N-3] == t[N-1]) continue;
				} // end if
			}else{ // if (t[N-1] == 'W')
				if (s[N-2] == 'o'){
					if (t[N-3] == t[N-1]) continue;
				}else{ // if (s[N-1] == 'x')
					if (t[N-3] != t[N-1]) continue;
				} // end if
			} // end if
			res = t;
		}else{ // if (s[0] == 'x')
			if (t[0] == 'S'){
				if (t[N-1] == t[1]) continue;
			}else{ // if (t[0] == 'W')
				if (t[N-1] != t[1]) continue;
			} // end if
			solve(t,s);
			if (t[N-2] == 'S'){
				if (s[N-2] == 'o'){
					if (t[N-3] != t[N-1]) continue;
				}else{ // if (s[N-1] == 'x')
					if (t[N-3] == t[N-1]) continue;
				} // end if
			}else{ // if (t[N-1] == 'W')
				if (s[N-2] == 'o'){
					if (t[N-3] == t[N-1]) continue;
				}else{ // if (s[N-1] == 'x')
					if (t[N-3] != t[N-1]) continue;
				} // end if
			} // end if
			res = t;
		} // end if
		if (!res.empty()){
			if (!check(res, s)){
				res = "";
				continue;
			}else{
				break;
			} // end if
		} // end if
	} // end rep

	cout << (res.empty() ? "-1" : res) << endl;

	return 0;
}

Measured memory_bytes: 880
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
#define sz(x) (int)(x).size()
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
using namespace std;
using ll = long long;
using P = pair<int, int>;
using vi = vector<int>;
using vc = vector<char>;
using vb = vector<bool>;
using vs = vector<string>;
using vll = vector<long long>;
using vp = vector<pair<int, int>>;
using vvi = vector<vector<int>>;
using vvc = vector<vector<char>>;
using vvll = vector<vector<long long>>;
template<class T> inline bool chmax(T &a, T b) { if (a<b) {a=b; return 1;} return 0;}
template<class T> inline bool chmin(T &a, T b) { if (b<a) {a=b; return 1;} return 0;}

int n;
vector<int> a;
vector<vector<long long>> dp;
const long long INF = 1LL<<60;


long long rec(int i, int j) {
    if (i == j) return 0;
    if (dp[i][j] != INF) return dp[i][j];
    long long res = 0;
    int k = i + (n-j);
    if (k % 2 == 0) {
        res = max(rec(i+1, j) + a[i], rec(i, j-1) + a[j-1]);
    } else {
        res = min(rec(i+1, j) - a[i], rec(i, j-1) - a[j-1]);
    }
    return dp[i][j] = res;
}

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

    cin >> n;
    a.resize(n);
    rep(i, n) cin >> a[i];
    dp.resize(n+1, vector<long long>(n+1, INF));
    cout << rec(0, n) << endl;
}


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

using namespace std;
int a[1000005][3];
int dp[1000005][3];
int main(){
	int n;
	cin>>n;
	for(int i=1;i<=n;i++)cin>>a[i][1]>>a[i][2]>>a[i][3];
	for(int i=1;i<=n;i++)dp[i][1]=a[i][1];
	for(int i=1;i<=n;i++){
		dp[i][1]=max(dp[i-1][2]+a[i][1],dp[i-1][3]+a[i][1]);
		dp[i][2]=max(dp[i-1][1]+a[i][2],dp[i-1][3]+a[i][2]);
		dp[i][3]=max(dp[i-1][1]+a[i][3],dp[i-1][2]+a[i][3]);
	}
	cout<<max(dp[n][1],max(dp[n][2],dp[n][3]));
	return 0;
}

Measured memory_bytes: 5504
x=input()
x0=x.split()
n=int(x0[0])
k=int(x0[1])
l=list()
z=0
for i in range(k):
    d=input()
    x=input()
    x0=x.split()
    l.extend(x0)
for p in range(n):
    c=str(p+1) in l
    if c==False:
        z=z+1
print(z)

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

#define CPP_STR(x) CPP_STR_I(x)
#define CPP_CAT(x,y) CPP_CAT_I(x,y)
#define CPP_STR_I(args...) #args
#define CPP_CAT_I(x,y) x ## y

using i8  = int8_t;
using u8  = uint8_t;
using i16 = int16_t;
using u16 = uint16_t;
using i32 = int32_t;
using u32 = uint32_t;
using i64 = int64_t;
using u64 = uint64_t;

using f32 = float;
using f64 = double;

#define FOR(i, start, end) for(i64 i = (start), CPP_CAT(i,xxxx_end)=(end); i < CPP_CAT(i,xxxx_end); ++i)
#define REP(i, n) FOR(i, 0, n)
#define REPS(i, n) for(i64 i = 1; i <= n; ++i)
#define RREP(i, n) for(i64 i = n - 1; i >= 0 ; --i)
#define RREPS(i, n) for(i64 i = n; i >= 1; --i)

#define ALL(f,c,...) (([&](decltype((c)) cccc) { return (f)(std::begin(cccc), std::end(cccc), ## __VA_ARGS__); })(c))

#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );

#define pb push_back
#define mp make_pair
#define F first
#define S second

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

template<typename C>
i64 SIZE(const C& c) { return static_cast<i64>(c.size()); }

template<typename T, size_t N>
i64 SIZE(const T (&)[N]) { return static_cast<i64>(N); }


struct ProconInit {
    static constexpr int IOS_PREC = 15;
    static constexpr bool AUTOFLUSH = false;

    ProconInit() {
        cin.tie(nullptr);
        ios::sync_with_stdio(false);
        cout << fixed << setprecision(IOS_PREC);
        if(AUTOFLUSH)
            cout << unitbuf;
    }
} PROCON_INIT;


#define MAX_N 100000
typedef pair<i64, i64> P; // <x人, i番目の生徒>
i64 N;
P A[MAX_N];

int main() {
  cin >> N;
  i64 a;
  REP(i, N) {
    cin >> a;
    A[i] = mp(a, i);
  }

  sort(A, A + N);

  P p;
  REP(i, N) {
    p = A[i];
    cout << (p.S + 1) << " ";
  }
  cout << endl;

  return 0;
}

Measured memory_bytes: 2432
import bisect
n , m , k = map(int, input().split())
a = list(map(int,input().split()))
b = list(map(int,input().split()))
ax = [0]*(n+1)
bx = [0]*(m+1)
for i in range(1,n+1):
    ax[i]=ax[i-1]+a[i-1]
for i in range(1,m+1):
    bx[i]=bx[i-1]+b[i-1]

c = bisect.bisect_right(ax,k)
ma = 0
for i in range(c):
    d = bisect.bisect_right(bx,k-ax[i])
    ma = max(ma,i+d-1)
print(ma)


Measured memory_bytes: 47392
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cmath>
using namespace std;
int x;
int main() {
    scanf("%d",&x);
    if (x<1200) cout<<"ABC"<<endl;
    else if (x<2800) cout<<"ARC"<<endl;
    else cout<<"AGC"<<endl;
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<vector>
#include<iomanip>
#include<algorithm>
#include<queue>
#include<stack>
#include<map>
using namespace std;
#define ll long long
int main(){
    ll N;
    cin >> N;
    pair<ll,ll> red[N];
    pair<ll,ll> blue[N];
    ll i,j;
    for(i=0;i<N;i++){
      cin >> red[i].first >> red[i].second;
    }
    for(i=0;i<N;i++){
      cin >> blue[i].second >> blue[i].first;
    }
    sort(red,red+N);
    sort(blue,blue+N);
    ll ans=0;
    ll blue_select[N];
    for(i=0;i<N;i++){
      blue_select[i]=0;
    }
    ll tmp=0;
    for(i=0;i<N;i++){
      tmp=-1;
      for(j=0;j<N;j++){
        if(red[N-1-i].first<blue[j].second&&red[N-1-i].second<blue[j].first&&blue_select[j]==0&&tmp==-1){
            tmp=j;
        }
      }
      if(tmp!=-1){
        blue_select[tmp]=1;
        ans++;
      }
    }
    cout << ans;
    return 0;
}


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

namespace B_Shift_only
{
    class Program
    {
        static void Main(string[] args)
        {
            var n = int.Parse(Console.ReadLine());
            var input = Console.ReadLine().Split(' ');
            var a = new List<int>();
            var b = 0;
            for (var i = 0; i < n; i++)
            {
                a.Add(int.Parse(input[i]));

            }
            while (a.Where(x => x % 2 == 0)
                .ToList().Count == n)
            {

                a = a.Select(x => x / 2)
                             .ToList();
                b++;

            }
            Console.WriteLine(b);
        }
    }
}

Measured memory_bytes: 13396
import java.io.*;
import java.util.*;
import java.math.*;
import java.util.concurrent.*;

public final class Main
{
    static BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
	static FastScanner sc=new FastScanner(br);
    static PrintWriter out=new PrintWriter(System.out);
	static Random rnd=new Random();
	
    public static void main(String args[]) throws Exception
    {
		String s=sc.next();
      
      	out.println(s.charAt(0)==s.charAt(2)?"Yes":"No");
      
      	out.close();
    }
}
class FastScanner
{
    BufferedReader in;
    StringTokenizer st;

    public FastScanner(BufferedReader in) {
        this.in = in;
    }
	
    public String nextToken() throws Exception {
        while (st == null || !st.hasMoreTokens()) {
            st = new StringTokenizer(in.readLine());
        }
        return st.nextToken();
    }
	
	public String next() throws Exception {
		return nextToken().toString();
	}
	
    public int nextInt() throws Exception {
        return Integer.parseInt(nextToken());
    }

    public long nextLong() throws Exception {
        return Long.parseLong(nextToken());
    }

    public double nextDouble() throws Exception {
        return Double.parseDouble(nextToken());
    }
}

Measured memory_bytes: 23124
#!/usr/bin/env python
# coding: utf-8

def ri():
    return int(input())

def rl():
    return list(input().split())

def rli():
    return list(map(int, input().split()))

def main():
    n, m = rli()
    bl, br = 1, n
    for i in range(m):
        l, r = rli()
        bl = max(bl, l)
        br = min(br, r)
    print(max(br-bl+1, 0))


if __name__ == '__main__':
    main()


Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(ll i=0;i<n;i++)
#define repl(i,l,r) for(ll i=(l);i<(r);i++)
#define per(i,n) for(ll i=n-1;i>=0;i--)
#define perl(i,r,l) for(ll i=r-1;i>=l;i--)
#define fi first
#define se second
#define pb push_back
#define ins insert
#define pqueue(x) priority_queue<x,vector<x>,greater<x>>
#define all(x) (x).begin(),(x).end()
#define CST(x) cout<<fixed<<setprecision(x)
#define vtpl(x,y,z) vector<tuple<x,y,z>>
#define rev(x) reverse(x);
using ll=long long;
using vl=vector<ll>;
using vvl=vector<vector<ll>>;
using pl=pair<ll,ll>;
using vpl=vector<pl>;
using vvpl=vector<vpl>;
const ll MOD=1000000007;
const ll MOD9=998244353;
const int inf=1e9+10;
const ll INF=4e18;
const ll dy[8]={1,0,-1,0,1,1,-1,-1};
const ll dx[8]={0,-1,0,1,1,-1,1,-1};
ll powmod(ll n, ll k, ll m) {
ll r=1;
 for(; k>0; k >>=1) {
   if(k&1) r=(r*n)%m;
   n=(n*n)%m;
 }
  return r;
}

ll fact(ll n) {
ll a=1;
rep(i,n) {
a=a*(n-i);
}
return a;
}

ll pow(ll a, ll b) {
ll x=1;
rep(i,b) {
x=x*a;
}
return x;
}

int main() {
ll A;
  ll B;
  ll C;
  ll K;
  cin >>A>>B>>C>>K;
  if(K<=A) {
cout<<K<<endl;
  }
else if((K>A) &&(K<=A+B)) {
  cout<<A<<endl;
}
else if(K>A+B) {
cout<<A-(K-A-B)<<endl;
}

  
}
  

Measured memory_bytes: 3600
#include <bits/stdc++.h>
using namespace std;
using i64 = long long;
#define endl "\n"

int main()
{
  string S;
  cin >> S;
  if (S[S.size() - 1] == 's')
    cout << S + "es" << endl;
  else
    cout << S + "s" << endl;
  return 0;
}


Measured memory_bytes: 3640
#include <stdio.h>
int main(void){
	int a, b, c;
	int k;
	int flg = 0;
	scanf("%d", &a);
	scanf("%d", &b);
	scanf("%d", &c);
	scanf("%d", &k);
	for(int i=0; i<k; i++){
		if(a >= b){
			b *= 2;
		} else if(b >= c){
			c *= 2;
		}
	}
	if(a < b && b < c){
		flg = 1;
	}
	if(flg == 0){
		printf("No\n");
	} else if(flg == 1){
		printf("Yes\n");
	}
	return 0;
}

Measured memory_bytes: 1648
//#define _GLIBCXX_DEBUG
#include <iostream>
#include <vector>
#include <stdio.h>
#include <bits/stdc++.h>


using namespace std;
#define ll long long
#define ld long double
#define  P pair<ll,ll>
#define FOR(i,n,m) for(ll i=n; i<(ll)m;i++)
#define FORa(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define FORr(i,m,n) for(ll i=n; i>=(ll)m; i--)
#define FORm(i,m) for(auto i=m.begin();i!=m.end();i++)
#define FORs(i,st) for(auto i : st)
#define REP(i,n) for(int i=0;i<(int)n;++i)
#define ALL(c) (c).begin(), (c).end()
#define VEC2(x,a,b) vector<vector<ll>> x = vector<vector<ll>>(a,vector<ll>(b,0))
#define sortAl(v) sort(v.begin(),v.end())
#define sortAlr(v) sort(v.begin(),v.end()); reverse(v.begin(),v.end())
#define cinv(v,n,m) FOR(i,n,m) cin>>v.at(i)
#define coutv(v,n,m) FOR(i,n,m) cout<<v.at(i) <<" "; cout<<endl
#define cout(n) cout<<fixed<<setprecision(n)

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

    map<string,ll> mp;

    ll q;
    cin>>q;
    while(q--){
      ll n;
      cin>>n;
      if(n==0){
        string s;
        ll key;
        cin>>s>>key;
        mp[s] = key;
      }
      else if(n==1){
        string s;
        cin>>s;
        cout<<mp[s]<<endl;


      }
      else{
        string s;
        cin>>s;
        mp[s] = 0;
      }
    }
}



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

int main(void) {
    char s[6]; cin >> s;

    int flag = 0;

    for(int i = 0; s[i + 1] != '\0'; i++){
        if(s[i] == 'A' && s[i+1] == 'C'){
            flag = 1;
        }
    }

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

}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <queue>
#include <algorithm>
#include <math.h>
#include <sstream>

using namespace std;

int main()
{
  int N;
  cin >> N;
  vector<int> v(N);
  for (int i = 0; i < N; ++i) {
    cin >> v[i];
  }
  sort(v.begin(), v.end());
  cout << v[N - 1] - v[0] << endl;
  return 0;
}


Measured memory_bytes: 256
MOD = 10 ** 9 + 7
n = gets.to_i
arr = Array.new(n+1,0)
arr[1] = 0
arr[2] = 0
arr[3] = 1
for i in 4..n
  arr[i] = (arr[i-1] + arr[i-3]) % MOD
end
puts arr[n]


Measured memory_bytes: 14380
N,Y = map(int,input().split())

count = 0
Y //= 1000
for x in range(N+1):
    for y in range(N+1):
        z = N - x - y
        if z < 0:
            break
        if x+5*y+10*z == Y:
            print(z,y,x)
            exit()
print(-1,-1,-1)

Measured memory_bytes: 3060
#include<iostream>
#include<vector>
#include<cmath>
using namespace std;
bool ok(vector<int> a,vector<int> b)
{
    int n = a.size();
    long long sum = 0;
    for(int i=0;i<n;++i)
        sum += (a[i]-b[i])*(a[i]-b[i]);
    long long sqrts = sqrtl(sum);
    return sqrts*sqrts == sum;
}
int main()
{
    int n,d;
    std::cin>>n>>d;
    vector<vector<int>> x(n,vector<int>(d));
    for(int i=0;i<n;++i)
    {
        for(int j=0;j<d;++j)
        {
            std::cin>>x[i][j];
        }
    }
    int ans = 0;
    for(int i=0;i<n;++i)
    {
        for(int j=i+1;j<n;++j)
        {
            if(ok(x[i],x[j]))
                ans++;
        }
    }
    std::cout<<ans<<std::endl;
}

Measured memory_bytes: 256
N, K = map(int,input().split())
L = [int(input()) for _ in range(N)]
A = [[] for _ in range(N)]
tmp = 0
A[0].append(L[0])
for num in L[1:]:
  for i in reversed(range(0,tmp+1)):
    for a in A[i]:
      if abs(a-num) <= K:
        A[i+1].append(num)
        tmp = max(tmp,i+1)
        break
    else:
      continue
    break
  else:
    A[0].append(num)
print(tmp+1)

Measured memory_bytes: 132060
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <set>
#include <map>
#include <queue>
#include<limits.h>
#include<iomanip>
#define rep(i, n) for(int i = 0; i < n; i++)
#define REP(i, m, n) for(int i = m; i < n; i++)
#define ALL(v) v.begin(),v.end()
#define RALL(v) v.rbegin(),v.rend()
#define check(v) rep(i,v.size()) cout << v[i] << " ";\
cout << endl
#define INF 1e8
typedef long long ll;
using namespace std;
//オーバーフローに気をつけろよおおおおおお
//確認忘れるなよおおおおおお

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    
    string s; cin >> s;
    int ans = 0;
    bool flag = false;
    REP(i,1,s.size()) {
        if(flag) s[i] = '9';
        else {
            if(s[i]!='9') {
                s[i-1] = (char)s[i-1]-1;
                s[i] = '9';
                flag = true;
            }
        }

    }
    rep(i,s.size()) {
        ans += s[i]-'0';
    }
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
int search(int A,int B,int K){
  int i;
  for(i = A;i<=B;i++){
    if(i % K == 0){
      return 0;}
  }
  return 1;
}
  

int main(void){
  int K,A,B,Answer;
  scanf("%d",&K);
  scanf("%d%d",&A,&B);
  Answer = search(A,B,K);
  if(Answer == 0)
    printf("OK");
  else
    printf("NG");
  return 0;
}

Measured memory_bytes: 1728
#include<iostream>
#include<algorithm>
#include<vector>
#include<map>
#include<queue>
#include<string>
#include<set>

#define ll long long

using namespace std;

int main(void) {
	string s;
	cin >> s;
	s.push_back('T');
	int x, y;
	cin >> x >> y;

	int i;
	for (i = 0; i < s.length(); i++) {
		if (s[i] == 'T') break;
		x--;
	}
	int dir = 1;
	map<int, int> xs;
	map<int, int> ys;
	int c = 0;
	for (; i < s.length(); i++) {
		if (s[i] == 'T') {
			if (c > 0) {
				if (dir == 1) xs[c]++;
				else ys[c]++;
				c = 0;
			}
			dir *= -1;
		}
		else c++;
	}
	
	set<int> px, py;
	px.insert(0);
	py.insert(0);

	for (auto itr = xs.begin(); itr != xs.end(); itr++) {
		while (itr->second > 0) {
			set<int> tmp;
			for (auto jtr = px.begin(); jtr != px.end(); jtr++) {
				tmp.insert(*jtr + itr->first);
				tmp.insert(*jtr - itr->first);
			}
			px = tmp;
			itr->second--;
		}
	}
	for (auto itr = ys.begin(); itr != ys.end(); itr++) {
		while (itr->second > 0) {
			set<int> tmp;
			for (auto jtr = py.begin(); jtr != py.end(); jtr++) {
				tmp.insert(*jtr + itr->first);
				tmp.insert(*jtr - itr->first);
			}
			py = tmp;
			itr->second--;
		}
	}

	if (px.find(x) != px.end() && py.find(y) != py.end()) cout << "Yes" << endl;
	else cout << "No" << endl;

	system("pause");
	return 0;
}

Measured memory_bytes: 1016
unittest
{
	assert( [ "1 2 2 2 1", "2 4", "5 1", "3" ].parse.expand.solve == 12 );
	assert( [ "2 2 2 2 2", "8 6", "9 1", "2 1" ].parse.expand.solve == 25 );
	assert( [ "2 2 4 4 4", "11 12 13 14", "21 22 23 24", "1 2 3 4" ].parse.expand.solve == 74 );
}



import std.algorithm;
import std.conv;
import std.range;
import std.stdio;
import std.typecons;

void main()
{
	stdin.byLineCopy.parse.expand.solve.writeln;
}

auto parse( Range )( Range input )
if( isInputRange!Range && is( ElementType!Range == string ) )
{
	auto xyabc = input.front.split.to!( long[] );
	input.popFront;
	auto ps = input.front.split.to!( long[] );
	input.popFront;
	auto qs = input.front.split.to!( long[] );
	input.popFront;
	auto rs = input.front.split.to!( long[] );
	return tuple( xyabc[ 0 ], xyabc[ 1 ], ps, qs, rs );
}

auto solve( long x, long y, long[] ps, long[] qs, long[] rs )
{
	ps.sort!( ( a, b ) => b < a );
	ps = ps.take( x );
	qs.sort!( ( a, b ) => b < a );
	qs = qs.take( y );
	rs.sort!( ( a, b ) => b < a );
	
	auto pt = ps.take( x ).sum;
	auto qt = qs.take( y ).sum;
	foreach( r; rs )
	{
		if( ps.empty || ( !qs.empty && qs.back < ps.back ) )
		{
			if( r <= qs.back ) break;
			qt += r - qs.back;
			qs.popBack;
		}
		else
		{
			if( r <= ps.back ) break;
			pt += r - ps.back;
			ps.popBack;
		}
	}
	return pt + qt;
}


Measured memory_bytes: 12528
#![allow(
    non_snake_case,
    unused_variables,
    unused_assignments,
    unused_mut,
    dead_code
)]
//use permutohedron::LexicalPermutation as _;
use proconio::input;
//use proconio::marker::*;
//use std::collections::HashSet;
//use std::collections::HashMap;
//use std::collections::BTreeMap;
//use std::cmp::*;
//use std::num;
//use petgraph::unionfind::UnionFind;

fn main() {
    input! {
        W:usize,H:usize,pq:[i64;W+H]
    }
    //let mut uf = UnionFind::new((W + 1) * (H + 1));
    let mut pq = pq.iter().enumerate().collect::<Vec<(usize, &i64)>>();
    pq.sort_by_key(|(i, val)| *val);

    // 点(i,j)の名前をi* (H+1) +j
    let mut a = W + 1;
    let mut b = H + 1;
    let mut ans = 0;
    for &(k, cost) in pq.iter() {
        if k < W {
            //let i = k;
            // 横の辺
            ans += cost * b as i64;
            a -= 1;
        } else {
            // 縦の辺
            //let j = k - W;
            ans += cost * a as i64;
            b -= 1;
        }
    }
    println!("{}", ans);
}


Measured memory_bytes: 10004
#include <bits/stdc++.h>
#define rua system("pause")
using namespace std;
typedef long long ll;
typedef long double db;
inline int read()
{
	int x = 0, f = 1; char c = getchar();
	while (!isdigit(c)) {if (c == '-') f = -1; c = getchar();}
	while (isdigit(c)) {x = x * 10 + c - '0', c = getchar();}
	return x * f;
}

int n, c, l[10], p[10];
db f[2][35][305], ans;

int main()
{
	n = read(), c = read();
	for (int i = 1; i <= n; i ++) l[i] = read();
	sort(l + 1, l + 1 + n);
	for (int i = 1; i < n; i ++) p[i] = i;
	do
	{
		memset(f, 0, sizeof f);
		int mx = (1 << (n - 1)), len = c * n;
		f[0][0][min(l[n] * n, len)] = 1;
		for (int i = 1; i < len; i ++)
		{
			int np = i & 1, p = np ^ 1;
			if (i % n == 0)
			{
				swap(f[np], f[p]);
				continue;
			}
			memset(f[np], 0, sizeof f[np]);
			for (int s = 0; s < mx; s ++)
				for (int j = i; j <= len; j ++)
					if (f[p][s][j])
					{
						db now = f[p][s][j];
						int cur = i % n;
						f[np][s][j] += now;
						if (s & (1 << (cur - 1))) continue;
						f[np][s | (1 << (cur - 1))][min(len, max(j, i + l[::p[cur]] * n))] += now;
					}
		}
		ans += f[(len - 1) & 1][mx - 1][len];
	} while (next_permutation(p + 1, p + n));
	db down = 1;
	for (int i = 1; i < n; i ++) down = down * i * c;
	ans /= down;
	printf("%.11lf\n", (double)ans);
	return 0;
}

Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
int gcd(int a,int b)
{
   int m=max(a,b);
   int n=min(a,b);
   if(n==0)
      return m;
    else
       return gcd(m%n,n);
}
int main()
{
  int k;
   cin>>k;
   long long sum=0;
  for(int i=1;i<=k;i++)
     {
	 for(int j=1;j<=k;j++)
     {
     	 for(int p=1;p<=k;p++)
     	 {
     	 	 sum+=gcd(i,gcd(j,p));
     	 	 
		  }
	 }
	 
    }
    cout<<sum<<endl;
  return 0;
}
       

Measured memory_bytes: 3640
import bisect,collections,copy,itertools,math,string
import sys
def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
def S(): return sys.stdin.readline().rstrip()
def LS(): return list(sys.stdin.readline().rstrip.split())
def main():
    n,x,t = LI()

    count = n//x + 1
    if n % x == 0:
        count -= 1
    time = count * t
    print(time)

main()

Measured memory_bytes: 68144
#include <iostream>
#include <time.h>

using namespace std;

template<typename T>
void Print(const T* pArray, int size)
{
	for (int i = 0; i < size; ++i)
		cout << pArray[i] << (i != size - 1 ? " " : "\n");
}

/**
 * T objects must provide operator>  and operator=
 */
template<typename T>
void InsertionSort(T* pArray, int size)
{
	Print(pArray, size);
	T key;
	// [0]..[i][j]..[size-1]
	// 前面是有序数据, j表示无序数据最前一位的索引
	// 最初值i表示有序数据最后一位的索引，i = j - 1
	// 0到i是有序数据,j到size-1是无序数据
	for (int j = 1; j < size; ++j)//要插入的无序数据
	{
		// 将当前的无序数据插入到之前的有序数据中
		key = pArray[j];
		// 将当前的无序数据和之前的有序数据比较，插入到合适的位置
		int i = j - 1;
		while (i >= 0 && pArray[i] > key)
		{
			// 当前的无序数据比有序数小，
			// 将有序数据向后偏移1位
			pArray[i + 1] = pArray[i];
			--i;
		}

		pArray[i + 1] = key;
		Print(pArray, size);
	}
}

int main()
{
	int n; cin >> n;
	int* pArray = new int[n];
	for (int i = 0; i < n; ++i) cin >> pArray[i];

	InsertionSort(pArray, n);
	
	delete[] pArray;

	return 0;
}


Measured memory_bytes: 3096
/* include c++ libraries */
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <unordered_map>
#include <map>
#include <queue>
#include <set>

/* include c-lang libraries */
#include <climits>
#include <cmath>

/* include my libraries */
//#include <show_vec.hh>

using namespace std;

#define DEBUG if(false)

using ll = long long;
#define LINE printf("LINE : %d\n", __LINE__);
#define loop(i, n) for(i = 0; i < n; i++)
template<class T> using vec = vector<T>;

const int MOD = 1000000007;

int main(){
  int x[5];
  for(int i = 0; i < 5; i++){
    cin >> x[i];
    if(x[i] == 0) cout << i+1 << endl;
  }
  return 0;
}


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

#define ll long long
#define mod 1000000007
#define mod2 998244353
#define pii pair<ll,ll>
#define pb push_back

#define debug(a) { cout << #a << " = " << a << endl;}

void sep() {
    cout << "-------------BLOCK-----------------\n";
}

template<typename T>
void debugv(vector<T> arr) {
    for (auto t: arr)
        cout << t << " ";
    cout << "\n";
}

template<typename T>
void debugarr(T arr, int n) {
    for (int i=0;i<n;i++) cout << arr[i] << " ";
    cout << "\n";
}

ll __min(ll a, ll b) {
    return a < b ? a : b;
}

ll __max(ll a, ll b) {
    return a > b ? a : b;
}

const int maxn = 1e5+1;
ll arr[maxn], n, m, t, k, q;
unordered_map<ll,ll> u;

int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    
    cin>>n;
    string a = "ACL";
    string res;
    while (n--) res += a;
    cout << res << endl;
}


Measured memory_bytes: 3656
temp = input().rstrip().split(" ")
N = int(temp[0])
M = int(temp[1])
X = int(temp[2])
Y = int(temp[3])
xi = []
yi = []
temp = input().rstrip().split(" ")
for i in range(N):
    xi.append(temp[i])
temp = input().rstrip().split(" ")   
for i in range(M):
    yi.append(temp[i])
count = 0
flag = 1
for i in range(X+1 , Y+1):
    Z = i
    flagX = 1
    flagY = 1
    for j in range(N):
        if int(xi[j]) >= Z:
            flagX = 0
    for j in range(M):
        if int(yi[j]) < Z:
            flagY = 0
    if flagX == 1 and flagY == 1:
        flag = 0
if flag == 0:
    print("No War")
else:
    print("War")

Measured memory_bytes: 3064
package main

import "fmt"

func main() {
	var N int
	fmt.Scan(&N)
	cnt := 1
	m := map[int]int{}
	for i := 2; i <= N; i++ {
		n := i
		for j := 2; j <= n; j++ {
			for n%j == 0 {
				m[j]++
				n /= j
			}
		}

	}
	for _, v := range m {
		cnt *= v + 1
		cnt %= 1000000007
	}
	fmt.Println(cnt)
}

Measured memory_bytes: 640
#include<iostream>
#include<cmath>
using namespace std;
long long a[200050];
int main(){

	int n,i,j;
	long long x=0,y=0,sum=0;
	cin>>n;
	for(i=0;i<n;i++){
		cin>>a[i];
		y+=a[i];
	}
	sum = abs(y-a[0]*2);
	for(i=0;i<n-1;i++){
		x+=a[i];
		y-=a[i];
		if(abs(x-y)<sum) sum=abs(x-y);
	}
	cout<<sum;
	return 0;
}

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

int main()
{
	int m, f, r;

	while (1)
	{
		cin >> m >> f >> r;
		if (m == -1 && f == -1 && r == -1) break;
		else if (m == -1 || f == -1) cout << "F" << endl;
		else if (m + f >= 80) cout << "A" << endl;
		else if (m + f >= 65 && m + f < 80) cout << "B" << endl;
		else if (m + f >= 50 && m + f < 65) cout << "C" << endl;
		else if ((m + f >= 30 && m + f < 50) && (r >= 50)) cout << "C" << endl;
		else if ((m + f >= 30 && m + f < 50) && (r < 50)) cout << "D" << endl;
		else if (m + f < 30 ) cout << "F" << endl;
		

	}
	
}


Measured memory_bytes: 3072
//#define _GLIBCXX_DEBUG
#include <iostream>
#include <bits/stdc++.h>
    
    
using namespace std;
#define ll long long
#define ld long double
#define  P pair<ll,ll>
#define FOR(i,n,m) for(ll i=n; i<(ll)m;i++)
#define FORr(i,m,n) for(ll i=n; i>=(ll)m; i--)
#define FORm(i,m) for(auto i=m.begin();i!=m.end();i++)
#define REV(v) reverse(v.begin(),v.end())
#define sortAl(v) sort(v.begin(),v.end())
#define sortAlr(v) sort(v.begin(),v.end()); reverse(v.begin(),v.end())
#define cout(n) cout<<fixed<<setprecision(n)
#define dout(n) cout<<# n<<" = "<<n<<endl;
#define v1out(v) FOR(j,0,v.size()){cout<<v[j]; if(j!=(ll)v.size()-1)cout<<" ";else cout<<endl; }
#define v2out(v) FOR(i,0,v.size())v1out(v[i]);
const int MOD = 1e9 + 7;

// a^b O(log b)
template <typename T>
T mypow(T a, T b) {
  if (b == 0) return 1;
  T tmp = mypow(a, b / 2);
  if (b % 2)
    return (((tmp * tmp) % MOD) * a) % MOD;
  else
    return (tmp * tmp) % MOD;
}

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll n,k; cin>>n>>k;
    vector<ll> func(k+2);
    FORr(i,1,k+1){
      func.at(i) = mypow(k/i,n);
      FOR(j,2,k+1){
        if(i*j>k)break;
        func.at(i) -= func.at(i*j);
        (func[i] += MOD) %= MOD;
      }
    }
    ll ans = 0;
    FOR(i,1,k+1) (ans+= (func[i]*i+MOD)%MOD) %=MOD;
    cout<<ans<<endl;
}

Measured memory_bytes: 3988
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define all(a) (a).begin(),(a).end()
#define overload4(_1, _2, _3, _4, name, ...) name
#define rep1(n) for(ll i = 0;i < (n);i++)
#define rep2(i,n) for(ll i = 0;i < (n);i++)
#define rep3(i,a,b) for(ll i = (a);i < (b);i++)
#define rep4(i,a,b,c) for(ll i = (a);i < (b);i += (c))
#define rep(...) overload4(__VA_ARGS__, rep4, rep3, rep2, rep1)(__VA_ARGS__)
#define rrep1(n) for(ll i = (n)-1;i >= 0;i--)
#define rrep2(i,n) for(ll i = (n)-1;i >= 0;i--)
#define rrep3(i,a,b) for(ll i = (a)-1;i >= (b);i--)
#define rrep4(i,a,b,c) for(ll i = (a)-1;i >= (b);i -= (c))
#define rrep(...) overload4(__VA_ARGS__, rrep4, rrep3, rrep2, rrep1)(__VA_ARGS__)
const ll INF=1e18,MOD = 1e9+7;
const int iINF = 1e9;

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

    string s,t;
    cin>>s>>t;
    int ans = 0;
    rep(i,s.size()){
        if(s[i] != t[i])ans++;
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 3796
// In the name of God

#include <bits/stdc++.h>
using namespace std;
const int N = 2*(int)1e5+5;
int mxl[N], mxr[N], a[N];

int main() {
	ios_base::sync_with_stdio(0), cin.tie(0);
	int n;
	cin >> n;
	for(int i=0; i<n; i++) cin >> a[i];
	mxl[0] = a[0];
	for(int i=1; i<n; i++) mxl[i] = max(mxl[i-1], a[i]);
	mxr[n-1] = a[n-1];
	for(int i=n-2; i>=0; i--) mxr[i] = max(mxr[i+1], a[i]);
	for(int i=0; i<n; i++) {
		if(i == 0) cout << mxr[i+1] << "\n";
		else if(i == n-1) cout << mxl[i-1] << "\n";
		else {
			cout << max(mxl[i-1], mxr[i+1]) << "\n";
		}
	}
	return 0;
}


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

const int MOD = 1000000007;

long long mod(long long val, long long m) {
  long long res = val % m;
  if (res < 0) res += m;
  return res;
}

int main() {
  int N, K; cin >> N >> K;
  vector<int> A(N);
  for (int i = 0; i < N; i++) cin >> A[i];
  // dp[i][j] := i 番目の子どもまでで j 個の飴を分け合う方法の総数
  vector<vector<long long>> dp(N+1, vector<long long>(K+1, 0));
  dp[0][0] = 1;
  for (int i = 0; i < N; i++) {
    for (int j = 0; j <= K; j++) {
      // dp[i+1][*] への遷移 : 区間 [j, j + a_i] に dp[i][j] を加算
      dp[i+1][j] += dp[i][j];
      dp[i+1][j] = mod(dp[i+1][j], MOD);
      if (j+A[i]+1 <= K) {
        dp[i+1][j+A[i]+1] -= dp[i][j];
        dp[i+1][j+A[i]+1] = mod(dp[i+1][j+A[i]+1], MOD);
      }
    }
    for (int j = 0; j < K; j++) {
      dp[i+1][j+1] += dp[i+1][j];
      dp[i+1][j+1] = mod(dp[i+1][j+1], MOD);
    }
  }
  cout << dp[N][K] << endl;
}

Measured memory_bytes: 80256
import java.io.*;
import java.util.*;

class Main {
    static Scanner scanner = new Scanner();
    static PrintWriter out = new PrintWriter(System.out);

    void solve() {
        int n = scanner.nextInt();
        String[] s = new String[n];

        System.out.println(0);
        s[0] = scanner.next();
        if (s[0].equals("Vacant")) {
            return;
        }

        int ok = 0, ng = n;
        while (Math.abs(ok - ng) > 1) {
            int mid = (ok + ng) / 2;

            System.out.println(mid);
            s[mid] = scanner.next();
            if (s[mid].equals("Vacant")) {
                return;
            }

            if (s[mid].equals(s[0]) == (mid % 2 == 0)) {
                ok = mid;
            } else {
                ng = mid;
            }
        }
    }

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

    static class Scanner {
        BufferedReader reader = new BufferedReader(new InputStreamReader(System.in), 32768);
        StringTokenizer tokenizer;

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

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

        long nextLong() {
            return Long.parseLong(next());
        }

        double nextDouble() {
            return Double.parseDouble(next());
        }
    }
}

Measured memory_bytes: 23716
#include <bits/stdc++.h>
using namespace std;
#define REP(i,n) for(int i=0;i<(n);i++)
#define N 100000
typedef long long ll;
#define ALL(v) (v).begin(),(v).end()
#define SZ(x) int(x.size())
#define OUT(a) cout<<(a)<<endl
const int MAX = 1000000;
const int MOD = 1000000007;

int main(){
	int n;
	cin>>n;
	int a[10][10]={0};
	for(int i=1;i<=n;i++){
			a[i/(int)pow(10,(int)log10(i))][i%10]++;
			//printf("%d,%d,%d\n",i/(int)pow(10,(int)log10(i)),i%10,i);
	}
	ll ans=0;
	for(int i=1;i<=9;i++){
		for(int j=1;j<=9;j++){
			ans+=a[i][j]*a[j][i];
		}
	}
	OUT(ans);
	return 0;
}

Measured memory_bytes: 256
use strict;
use warnings;
use List::Util qw(sum);

chomp(my $n = <>);

my @nums;

for (my $i = 1; $i <= $n; $i++) {
  if ($i%15 == 0) {
    next;
  }

  if ($i%5 == 0) {
    next;
  }

  if ($i%3 == 0) {
    next;
  }

  push(@nums, $i);
}

print sum(@nums)."\n";



Measured memory_bytes: 26260
#include <algorithm>
#include <bitset>
#include <cassert>
#include <chrono>
#include <climits>
#include <cmath>
#include <complex>
#include <cstring>
#include <deque>
#include <functional>
#include <iostream>
#include <iomanip>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#include <cstdint>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> pii;
#define MP make_pair
#define PB push_back
#define inf 1000000007
#define rep(i,n) for(int i = 0; i < (int)(n); ++i)
#define all(x) (x).begin(),(x).end()

template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
    std::fill( (T*)array, (T*)(array+N), val );
}
 
template<class T> inline bool chmax(T &a, T b){
    if(a<b){
        a = b;
        return true;
    }
    return false;
}

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

int main(){
    int n,a,b;
    cin >> n >> a >> b;
    a--;b--;
    vector<int> res(n);
    rep(i,n){
        queue<pair<int,int> > q;
        q.push(MP(i,0));
        vector<bool>flag(n);
        while(!q.empty()){
            auto k = q.front();
            int id = k.first;
            int d = k.second;
            q.pop();
            if(id<0||id>=n)continue;
            if(flag[id])continue;
            res[d]++;
            flag[id] = 1;
            if(id==a){
                q.push(MP(b,d+1));
            }
            if(id==b){
                q.push(MP(a,d+1));
            }
            q.push(MP(id+1,d+1));
            q.push(MP(id-1,d+1));
        }
    }
    rep(i,n-1){
        cout << res[i+1]/2 << "\n";
    }
    return 0;
}

Measured memory_bytes: 888
#include  <iostream>
#include  <stdio.h>
#include <algorithm>
#include <map>
#include <math.h>

using namespace std;
#include <vector>
#define rep(i,n) for (ll i = 0; i < (n) ; i++)
#define INF 1e9
#define llINF 1e18
#define base10_4 10000      //1e4
#define base10_5 100000     //1e5
#define base10_6 1000000    //1e6
#define base10_7 10000000   //1e7
#define base10_8 100000000  //1e8
#define base10_9 1000000000 //1e9

#define MOD 1000000007
#define pb push_back
#define ll long long
#define ull unsigned long long
#define vint vector<int>
#define vll vector<ll>

//#include <stack>
//#include <queue>

// #include <iomanip>
//  cout << fixed << setprecision(15) << y << endl;

string ans_Yes = "Yes"; 
string ans_No = "No"; 
string ans_yes = "yes"; 
string ans_no = "no"; 

ll A;
ll B;
ll C;
ll N;
ll M;
ll K;

ll ltmp;
string stmp;
double dtmp;
ll llmin(ll a,ll b){
    if(a>=b) return b;
    return a;
}
ll llmax(ll a,ll b){
    if(a<=b) return b;
    return a;
}
int main(){

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

    cin >> A;
    cin >> B;

    cout << llmax(0,A-B*2) << endl;

}

Measured memory_bytes: 3640