akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
#define pi 3.141592653589793238
#define int long long
using namespace __gnu_pbds;
using namespace std;
template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

const int mod=1e9+7;
int pre1[100005];
int pre2[100005];

signed main()
{

ios_base::sync_with_stdio(false);
cin.tie(NULL);  
cout.tie(0);   

#ifndef ONLINE_JUDGE
    if(fopen("INPUT.txt","r"))
    {
    freopen ("INPUT.txt" , "r" , stdin);
    freopen ("OUTPUT.txt" , "w" , stdout);
    }
#endif  

    string a,b;
    cin>>a>>b;
    int n=a.length();
    a="#"+a;
    b="#"+b;
    for(int i=1;i<=n;i++)
    {
        if(a[i]=='A')
            pre1[i]=pre1[i-1];
        else
            pre1[i]=pre1[i-1]+1;
    }
    n=b.length();
    n--;
    for(int i=1;i<=n;i++)
    {
        if(b[i]=='A')
            pre2[i]=pre2[i-1];
        else
            pre2[i]=pre2[i-1]+1;
    }

    int q;
    cin>>q;
    int x,y,z,w;
    while (q--)
    {
        cin>>x>>y>>z>>w;
        int tt=pre1[y]-pre1[x-1];
        int ans1=tt*2+(y-x+1)-tt;
        ans1%=3;
        tt=pre2[w]-pre2[z-1];
        int ans2=tt*2+(w-z+1)-tt;
        ans2%=3;
        if(ans1==ans2)
            cout<<"YES\n";
        else
            cout<<"NO\n";
    }
    

} 



Measured memory_bytes: 2540
s = input()

dp = [[0] * (len(s) + 1) for _ in range(4)]
dp[0][0] = 1

for i, c in enumerate(s):
  # use c
  if c == "A" or c == "?":
    dp[1][i+1] = dp[0][i]
  if c == "B" or c == "?":
    dp[2][i+1] = dp[1][i]
  if c == "C" or c == "?":
    dp[3][i+1] = dp[2][i]
  # not use c
  for j in range(4):
    if c == "?":
      dp[j][i+1] += dp[j][i] * 3  
    else:
      dp[j][i+1] += dp[j][i]
    dp[j][i+1] %= 10**9+7
print(dp[-1][-1])

Measured memory_bytes: 19060
#include<bits/stdc++.h>
#define cs ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
typedef long long ll;

using namespace std;
ll f(ll k){
    int t=k%4;
    switch(t){
        case 1:return 1;
        case 2:return k+1;
        case 3:return 0;
        default:return k;
    }
}
int main(){
    cs;
    ll a,b;
    cin>>a>>b;
  	if(!a) a++;
    cout<<(f(a-1)^f(b));
}

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

/*typedefs*/
typedef vector<int> vi;
typedef map<string,int> msi;
typedef complex<double> point;
typedef  long long ll;


#define all(v)			((v).begin()), ((v).end())
#define SIZE(v)			((int)((v).size()))
#define LOG(x)			log((double)x)
#define TOLOWER(x)          transform(all(x),x.begin(),::tolower)
#define TOUPPER(x)          transform(all(x),x.begin(),::toupper)
#define ROUND(x,m)			(round((double)x/m)*m)
#define DIGITS(x)			(floor(log10((double)x))+1)
#define READSTR(x)			getline(cin,x)
#define sort_g(a,b)              sort(a, b, greater<int>());
#define X real()
#define Y imag()
#define angle(a)                (atan2((a).imag(), (a).real()))
#define vec(a,b)                ((b)-(a))
#define same(p1,p2)             (dp(vec(p1,p2),vec(p1,p2)) < EPS)
#define dp(a,b)                 ( (conj(a)*(b)).real() )	// a*b cos(T), if zero -> prep
#define cp(a,b)                 ( (conj(a)*(b)).imag() )	// a*b sin(T), if zero -> parllel
#define length(a)               (hypot((a).imag(), (a).real()))
#define normalize(a)            (a)/length(a)
#define rotateO(p,ang)          ((p)*exp(point(0,ang)))
#define rotateA(p,ang,about)  (rotateO(vec(about,p),ang)+about)
#define reflectO(v,m)  (conj((v)/(m))*(m))
#define IOS() ios_base::sync_with_stdio(0);cin.tie(NULL);
#define REP(i, n) for (int i = 0; i < n; i++)
#define FILE_INPUT() 	freopen( "input.txt", "r", stdin)
#define FILE_OUTPUT()   freopen( "output.txt", "w", stdout)

bool myCmp(pair<int,int> &p1 , pair<int,int>&p2)
{
    return p1.first > p2.first;
}


unsigned long long
choose(unsigned long long n, unsigned long long k) {
    if (k > n) {
        return 0;
    }
    unsigned long long r = 1;
    for (unsigned long long d = 1; d <= k; ++d) {
        r *= n--;
        r /= d;
    }
    return r;
}
ll  OO = 10e12;
const int MAXN = 10e5;
static int arr[MAXN];
ll sm = 0;
int main() {
    IOS();
    int n,k;

    cin>>n>>k;
    REP(i,n) cin>>arr[i];
    sort(arr,arr+n,greater<int>());
    REP(i,k) arr[i] = 0;
    REP(i,n) sm+= arr[i];
    cout<<sm<<endl;
}


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

using namespace std;
#define rep(i, n) for (ll i = 0; i < (n); ++i)
#define sz(x) ll(x.size())
typedef long long ll;
typedef pair<int, int> P;
const ll INF = 1001001001;

const int mod = 1000000007;

struct mint {
    ll x; // typedef long long ll;
    mint(ll x = 0) : x((x % mod + mod) % mod) {}

    mint &operator+=(const mint a) {
        if ((x += a.x) >= mod) x -= mod;
        return *this;
    }

    mint &operator-=(const mint a) {
        if ((x += mod - a.x) >= mod) x -= mod;
        return *this;
    }

    mint &operator*=(const mint a) {
        (x *= a.x) %= mod;
        return *this;
    }

    mint operator+(const mint a) const {
        mint res(*this);
        return res += a;
    }

    mint operator-(const mint a) const {
        mint res(*this);
        return res -= a;
    }

    mint operator*(const mint a) const {
        mint res(*this);
        return res *= a;
    }

    mint pow(ll t) const {
        if (!t) return 1;
        mint a = pow(t >> 1);
        a *= a;
        if (t & 1) a *= *this;
        return a;
    }

    // for prime mod
    mint inv() const {
        return pow(mod - 2);
    }

    mint &operator/=(const mint a) {
        return (*this) *= a.inv();
    }

    mint operator/(const mint a) const {
        mint res(*this);
        return res /= a;
    }
};

mint dp[55][55][2605];

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

    dp[0][0][0] = 1;
    rep(i, n) {
        rep(j, i + 1) {
            rep(k, score + 1) {
                {
                    int nj = j;
                    dp[i + 1][nj][k + nj * 2] += dp[i][j][k];
                }
                {
                    int nj = j + 1;
                    dp[i + 1][nj][k + nj * 2] += dp[i][j][k];
                }
                {
                    int nj = j;
                    mint x = j * 2;
                    dp[i + 1][nj][k + nj * 2] += dp[i][j][k] * x;
                }
                if (j >= 1) {
                    int nj = j - 1;
                    mint x = j * j;
                    dp[i + 1][nj][k + nj * 2] += dp[i][j][k] * x;
                }
            }
        }
    }
    mint ans = dp[n][0][score];
    cout << ans.x << endl;

}



Measured memory_bytes: 61824
s = input()

def dfs(i,sen,num):
    if i == 3:
        if num == 7:
            print(sen+"=7")
            quit()
    else:
        dfs(i+1,sen+"+"+s[i+1],num+int(s[i+1]))
        dfs(i+1,sen+"-"+s[i+1],num-int(s[i+1]))

dfs(0,s[0],int(s[0]))
    


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

using namespace std;

#define INF 1000000007
#define LINF (1LL << 61)
#define PI 3.14159265358979

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

inline i64 mod(i64 a, i64 m) { return (a % m + m) % m; }

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; }



i64 a;
double b;
void solve(){
	cin >> a >> b;
	int c = 100*b+0.01;
	
	cout << (a * c)/100 << endl;
}

int main(){
	std::cin.tie(0);
	std::ios::sync_with_stdio(false);
	int t = 1;
	//cin >> t;
	while(t--){
		solve();
	}
	
	return 0;
}

Measured memory_bytes: 3740
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <fstream>
#include <sstream>
#include <set>
#include <map>
#include <vector>
#include <list>
#include <algorithm>
#include <cstring>
#include <cmath>
#include <string>
#include <queue>
#include <bitset>     //UWAGA - w czasie kompilacji musi byc znany rozmiar wektora - nie mozna go zmienic
#include <cassert>
#include <iomanip>        //do setprecision
#include <ctime>
#include <complex>
using namespace std;

#define FOR(i,b,e) for(int i=(b);i<(e);++i)
#define FORQ(i,b,e) for(int i=(b);i<=(e);++i)
#define FORD(i,b,e) for(int i=(b)-1;i>=(e);--i)
#define REP(x, n) for(int x = 0; x < (n); ++x)

#define ST first
#define ND second
#define PB push_back
#define MP make_pair
#define LL long long
#define ULL unsigned LL
#define LD long double

const double pi = 3.141592653589793238462643383279502884197169399375105820974944592307816406286208998628034825342;
const int mod=1000000007;

int main(){
	int n,m,v[111]={},w[111]={};
	int mem[5][111]={},sz[5]={};
	cin>>n>>m;
	FOR(i,0,n)cin>>w[i]>>v[i];
	int t=w[0];
	FOR(i,0,4){
		priority_queue<int> pq;
		FOR(j,0,n){
			if(t+i==w[j]){
				pq.push(v[j]);
			}
		}
		int idx=0;
		while(pq.size()){
			mem[i][idx]=pq.top();
			pq.pop();
			idx++;
		}
		sz[i]=idx;
	}

	FOR(i1,1,sz[0]){
		mem[0][i1]+=mem[0][i1-1];
	}
	FOR(i2,1,sz[1]){
		mem[1][i2]+=mem[1][i2-1];
	}
	FOR(i3,1,sz[2]){
		mem[2][i3]+=mem[2][i3-1];
	}
	FOR(i4,1,sz[3]){
		mem[3][i4]+=mem[3][i4-1];
	}
	LL ans=0;
	FOR(i1,0,sz[0]+1){
		FOR(i2,0,sz[1]+1){
			FOR(i3,0,sz[2]+1){
				FOR(i4,0,sz[3]+1){
					LL wei=1LL*i1*(t+0)+1LL*i2*(t+1)+1LL*i3*(t+2)+1LL*i4*(t+3);
					if(wei>m)continue;

					ans=max(ans,0LL+mem[0][i1-1]+mem[1][i2-1]+mem[2][i3-1]+mem[3][i4-1]);
				}
			}
		}
	}
	cout<<ans;
    return 0;
}


Measured memory_bytes: 888
import java.io.PrintWriter

val pw = PrintWriter(System.out)

fun main(args : Array<String>) {
    func()
    pw.flush()
}

fun func() {
    val n = nextInt()
    print(if (n > 999) "ABD" else "ABC")
}

fun next() = readLine()!!
fun nextInt() = next().toInt()

fun println(value : Any) {
    pw.println(value)
}

Measured memory_bytes: 31796
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <iomanip>

using namespace std;

#define PB push_back
#define ALL(v) (v).begin(), (v).end()
#define SZ size()
#define FOR(i, a, n) for(long long (i) = (a); (i) < (n); (i)++)
#define REP(i, n) FOR((i), 0, (n))
#define SHOW(v) cout << (v) << endl
#define SHOW2(a, b) cout << (a) << " " << (b) << endl
#define SHOW3(a, b, c) cout << (a) << " " << (b) << " " << (c) << endl
#define GET(v) cin >> (v)
#define GET2(a, b) cin >> (a) >> (b)
#define GET3(a, b, c) cin >> (a) >> (b) >> (c)
#define MOD 1000000007
template<class T> void GETV(T &v) { REP(i, v.size()) { GET(v[i]); } }
template<class T> void SHOWV(T &v) { REP(i, v.size()) { SHOW(v[i]); } }

typedef long long ll;

int main()
{
    int n;
    GET(n);
    
    vector<int> p(n);
    int max = 0;
    int ans = 0;
    for(int i = 0; i < n; i++) {
        cin >> p[i];
        if(max < p[i]) {
            max = p[i];
        }
        ans += p[i];
    }
    ans -= (max / 2);
    SHOW(ans);
    
    return 0;
}




Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(void){
   int a,b;
   cin>>a>>b;
  if(a>b){
      cout<<a-b<<endl;
  }
  else if(b>a){
      cout<<b-a<<endl;
  }
  else if(a==b){
      cout<<a-b<<endl;
  }
}



Measured memory_bytes: 3096
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <queue>
#include <stack>
#include <algorithm>
#include <fstream>
#include <sstream>

using namespace std;

int main(){
    string s,t;
    cin >> s >> t;
    int N,M;
    N=s.size();
    M=t.size();
    vector<vector<int> > dp(N+1,vector<int>(M+1,0));
    for(int i=1; i<=N; i++){
        for(int j=1; j<=M; j++){
            if(s[i-1]==t[j-1])dp[i][j]=dp[i-1][j-1]+1;
            else dp[i][j]=(dp[i-1][j]>dp[i][j-1]) ? dp[i-1][j] : dp[i][j-1];
        }
    }
    string ans="";
    while(dp[N][M]){
        if(dp[N][M]==dp[N][M-1]){
            M--;
        }else if(dp[N][M]==dp[N-1][M]){
            N--;
        }else{
            ans=s[N-1]+ans;
            N--;
            M--;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 35584
#include<bits/stdc++.h>
using namespace std;
typedef  long long ll;
using vll=vector<ll>;
using vvll=vector<vll>;
using vi=vector<int>;
using vvi=vector<vector<int>>;
using vb=vector<bool>;
using pii=pair<int,int>;
using vpii=vector<pair<int,int>>;
using plli=pair<ll,int>;
using vplli=vector<pair<ll,int>>;
using pllll=pair<ll,ll>;
using vpllll=vector<pair<ll,ll>>;

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

//pow(llpow,modpow)
template<class T> ll llpow(ll x,T n){ll ans=1;if(x==0)ans=0;while(n){if(n&1)ans*=x;x*=x;n>>=1;}return ans;}
long long modpow(long long a, long long n, long long mod) {long long res = 1;while (n > 0) {if (n & 1) res = res * a % mod;a = a * a % mod;n >>= 1;}return res;}
//最大公約数
template<class T> inline T gcd(T x,T y){if(y==0)return x; else {return gcd(y,x%y);}}
//最小公倍数
template<class T> inline T lcm(T x,T y){return x/gcd(x,y)*y;}
//逆元
long long modinv(long long a, long long m) {long long b = m, u = 1, v = 0;while (b) {long long t = a / b;a -= t * b; swap(a, b);u -= t * v; swap(u, v);}u %= m;if (u < 0) u += m;return u;}

#define rep(i, begin_i, end_i) for (ll i = (ll)begin_i; i < (ll)end_i; i++)
//試験導入
#define irep(i, end_i, begin_i) for (ll i = (ll)begin_i-1; i >= (ll)end_i; i--)

long long INF = 1LL<<60;
int main( ){
    ll N;
    cin>>N;
    vi C(N+1,1);
    rep(i,2,N+1){
        for(ll j=1;j*i<=N;j++){
            C[j*i]++;
        }
    }
    ll ans=0;
    rep(i,0,N+1)ans+=C[i]*i;
    cout<<ans<<endl;
    return 0;
}




Measured memory_bytes: 42256
import math


def main(a, b, h, m):
    # 短針の座標を取得
    rad1 = 2 * math.pi * (h + m / 60.0) / 12.0
    x1 = a * math.cos(rad1)
    y1 = a * math.sin(rad1)

    # 長針の座標を計算
    rad2 = 2 * math.pi * m / 60.0
    x2 = b * math.cos(rad2)
    y2 = b * math.sin(rad2)

    d = math.sqrt((x2 - x1) ** 2 + (y2 - y1) ** 2)
    print(d)


if __name__ == "__main__":
    a, b, h, m = map(int,input().split())
    main(a, b, h, m)


Measured memory_bytes: 9312
# -*- coding: utf-8 -*-
def inpl(): return map(int, input().split())
S = input()
K = int(input())
ans = set()

for s in sorted(set(S)):
    if len(ans) >= K:
        break
    for i in range(len(S)):
        if S[i] == s:
            for k in range(K):
                ans.add(S[i:i+k+1])

print(sorted(ans)[K-1])

Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define ALL(x) (x).begin(), (x).end()
typedef long long ll;
typedef pair<int, int> pii;
const int INF = 1e9;
const int MOD = 1000000007;
const double PI = acos(-1);
int dx[4] = {0,1,0,-1};
int dy[4] = {1,0,-1,0};

ll gcd(ll a, ll b) { return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b) { return a/gcd(a,b)*b;}

void solve() {
	int n, k;
	cin >> n >> k;
	vector<int> v(n);
	rep(i,n) cin >> v[i];
	int g = v[0];
	rep(i,n) g = gcd(g, v[i]);
	rep(i,n) {
		if (v[i] < k) continue;
		if ((v[i] - k) % g == 0) {
			cout << "POSSIBLE" << endl;
			return;
		}
	}
	cout << "IMPOSSIBLE" << endl;
}

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

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

int main() {
  
  int N;
  cin >> N;
  vector<int> l(N);
  for (int i = 0; i < N; i++){
    cin >> l.at(i);
  }
  
  int m = 1;
  for (int i = 0; i < N; i++){
    m = max(m, l.at(i));
  }
  
  int sum;
  for (int i = 0; i < N; i++){
    sum += l.at(i);
  }
  
  if(2*m<sum){cout << "Yes" << endl;}
  else {cout << "No" << endl;}

  
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
const int MAXN = 3010;

string s,t;
int dp[MAXN][MAXN],N,M;
stack<char> resposta;

int solve(int a,int b){

	if(a < 0 || b < 0) return 0;

	if(dp[a][b] != -1) return dp[a][b];

	if(s[a] == t[b]) return dp[a][b] = 1 + solve(a-1,b-1);

	return dp[a][b] = max(solve(a-1,b),solve(a,b-1));

}

void build(int a,int b){

	if(a < 0 || b < 0) return;

	if(s[a] == t[b]){
		resposta.push(s[a]);
		build(a-1,b-1);
		return;
	}

	if(solve(a-1,b) > solve(a,b-1)) build(a-1,b);
	else build(a,b-1);

}

int main(){

	memset(dp,-1,sizeof(dp));

	cin >> s;
	cin >> t;

	N = (int)s.size();
	M = (int)t.size();

	build(N-1,M-1);

	while(!resposta.empty()){
		cout << resposta.top();
		resposta.pop();
	}
	cout << endl;

	return 0;

}

Measured memory_bytes: 39276
#include <stdio.h>

int main()
{
    int a, b, c;
    scanf("%d %d %d", &a, &b, &c);
    if (a < b) 
    {
        if (b < c) 
        {
            printf("Yes\n");
            return 0;
        }
    }
    printf("No\n");
    return 0;
}


Measured memory_bytes: 2052
#include <iostream>

int main() {
    std::string s;
    std::cin >> s;
    int n = s.length();

    bool ans = true;
    for (int i = 0; i < n; i++) {
        if ((i % 2 == 0 && s[i] == 'L') || (i % 2 == 1 && s[i] == 'R')) {
            ans = false;
            break;
        }
    }

    if (ans) {
        std::cout << "Yes" << std::endl;
    } else {
        std::cout << "No" << std::endl;
    }

    return 0;
}


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

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

void solve() {
    ll n;
    cin >> n;
    cout << (powmod(10, n) - 2*powmod(9, n) + powmod(8, n) + 4*mod)%mod << "\n";
}

int main() {
    #ifdef LOCAL
    auto t1 = std::chrono::high_resolution_clock::now();
    #endif

    io;
    solve();

    #ifdef LOCAL
    auto t2 = std::chrono::high_resolution_clock::now();
    auto duration = std::chrono::duration_cast<std::chrono::milliseconds>( t2 - t1 ).count();

    std::cout << "Time Taken: " << duration << "\n";
    #endif

}
// check for edge cases in limits
// printing double may print 1.223232e9 like values, beware of that
// carefully observe simulation of test cases
// multiset erase is does not do what it is supposed to


Measured memory_bytes: 3684
#include <bits/stdc++.h>
using namespace std;
#define mp make_pair
#define pb push_back
#define mod 1000000007
#define int long long int
#define N 200005
void fast(){
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
}

main()
{
  int n;
  cin>>n;
  cout<<n*n<<endl;
}

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

int main(){
    int n;
    cin>>n;
    vector<long long> a(n),b(n);
    for(int i=0;i<n;++i){
        cin>>a[i]>>b[i];
    }

    sort(a.begin(),a.end());
    sort(b.begin(),b.end());
    if(n%2){
        long long r=b[n/2];
        long long l=a[n/2];
        cout<<r-l+1<<endl;
    }
    else{
        long long r=b[n/2-1]+b[n/2];
        long long l=a[n/2-1]+a[n/2];
        cout<<r-l+1<<endl;
    }
}

Measured memory_bytes: 6424
#pragma optimization_level 3
#pragma GCC optimize("Ofast,no-stack-protector,unroll-loops,fast-math,O3")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx")
#pragma GCC optimize("Ofast")   	//Comment optimisations for interactive problems (use endl)
#pragma GCC target("avx,avx2,fma")
#pragma GCC optimization ("unroll-loops")
#include<bits/stdc++.h>
 
using namespace std;
 
#define  fastio         ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);cout<<fixed;cout<<setprecision(10);
#define  randomINIT     mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());
#define ll long long
#define rep for(ll i=0;i<n;i++)

int main(){

    string s;
    cin>>s;
    if(s=="ABC") cout<<"ARC"<<endl;
    else cout<<"ABC"<<endl;
}

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

#define fr(i,n) _back
#define pb	push_back
#define eb	emplace_back
#define mk	make_pair
#define fi	first
#define se	second
#define endl	'\n'

typedef long long ll;
typedef pair<int,int> ii;
typedef vector<ii> vii;
const int INF = 0x3f3f3f3f;
const double PI = acos(-1.0);

const int T = 1e6 + 2;
const ll MOD = 1e9 + 7;

ll f[T];
ll sqr1[T];
ll sqr2[T];

ll expo(ll base, ll e) {
    ll ans = 1;
    while(e) {
        if(e&1) ans = (ans * base) % MOD;
        base = (base * base) % MOD;
        e >>= 1;
    }
    return ans;
}

ll fat(ll x) {
    if(~f[x]) return f[x];
    return f[x] = (x * fat(x-1)) % MOD;
}

ll choose(ll x, ll y) {
    return (fat(x+y)*expo(fat(x)*fat(y)%MOD, MOD-2))%MOD;
}

int main() {
    ios_base::sync_with_stdio(false);
    memset(f,-1,sizeof f);
    f[0] = f[1] = 1;
    f[2]  = 2;
    int h,w,a,b; cin >> h >> w >> a >> b;

    ll ans = 0;

    for(int i = b+1; i <= w; i++) {
        ll up = choose(h-a-1,i-1);
        ll down = choose(a-1,w-i);
        ans = (ans+(up*down)%MOD)%MOD;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 11776
#include <iostream>
#include <string>
#include <unordered_map>
using namespace std;

int main(){
    string w;
    cin >> w;
    unordered_map<char, int> freq;
    for (char c : w) freq[c] += 1;
    for (auto elem : freq){
        if (elem.second % 2){
            cout << "No" << endl;
            return 0;
        }
    }
    cout << "Yes" << endl;
    return 0;
}

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

#define ll long long
#define p_q priority_queue
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define MAX 1000000001



int main(){
    int a,b,m;
    cin>>a>>b>>m;
    
    vector<int> va(a);
    vector<int> vb(b);
    vector<int> x(m);
    vector<int> y(m);
    vector<int> c(m);
    
    int ma=99999999,mb=999999999;
    rep(i,a){
        cin>>va.at(i);
        ma=min(ma,va.at(i));
    }
    rep(i,b){
        cin>>vb.at(i);
        mb=min(mb,vb.at(i));
    }
    
    ma += mb;
    
    rep(i,m){
        cin>>x.at(i)>>y.at(i)>>c.at(i);
        if(ma>(va.at(x.at(i)-1)+vb.at(y.at(i)-1)-c.at(i)))ma=(va.at(x.at(i)-1)+vb.at(y.at(i)-1)-c.at(i));
    }
    cout<<ma<<endl;
    
    
}

Measured memory_bytes: 2176
program ABC142C
    implicit none
    integer:: N,i
    integer:: result=1
    character:: S*100000

    read (5,*) N
    read (5,*) S
    
    do i=1,N-1
        if(S(i:i)/=S(i+1:i+1)) then
            result=result+1
        end if
    end do

    print '(i0)',result
end program ABC142C

Measured memory_bytes: 700
#include <iostream>
#include<vector>
#include<algorithm>
#include<string>
using namespace std;
#define REP(i,n) for(int i=0;i<n;i++)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define INF 1000000000
int main(){
cin.tie(0);
ios::sync_with_stdio(false);

	int A,B;
	cin>>A>>B;
	cout<<max(A+B,max(A-B,A*B))<<endl;
	return 0;
}


Measured memory_bytes: 256
n = int(input())
def f(x):
  return ((x-2)//2)*"90"+"9"
if n < 10:
  print(n)
elif len(str(n)) % 2 == 0:
  print(f(len(str(n))))
else:
  print(int(f(len(str(n))-1))+n-10**(len(str(n))-1)+1)

Measured memory_bytes: 3060
#include <bits/stdc++.h>
#define pb push_back
#define REP(i, n) for (signed long long i = 0; i < (n); i++)
#define MOD 998244353
#define bitcnt(a) (ll) __builtin_popcount((a))
#define lb(a, b) lower_bound((a).begin(), (a).end(), (b))
#define ub(a, b) upper_bound((a).begin(), (a).end(), (b))
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
typedef pair<string, string> PS;

int main() {
  int a, b;
  cin >> a >> b;
  cout << a - b + 1 << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
using namespace std;
const int mod=1e9+7;
const int maxn=5e4+5;
int a,b,s,ss;

int main()
{
	cin>>a>>b;
    for(int i=min(a/0.08,b/0.1);i<=2000;i++){
        s=i*0.08;
        ss=i*0.1;
        if(s==a && ss==b){
            cout<<i<<endl;
            return 0;
        }
    }
    cout<<"-1"<<endl;
    return 0;
}

Measured memory_bytes: 384
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <stack>
#include <queue>
#include <set>
#include <map>
using namespace std;
//typedef __int64 LL;
//typedef long long int LL;
typedef pair<int,int> P;

const int MOD=1000000007;

int n;

void ans(vector<char> &v,int count)
{
	if(v.size()==n)
	{
		for(int i=0;i<v.size();i++)cout<<v[i];
		cout<<"\n";
	}
	else
	{
		for(int i=1;i<=count+1;i++)
		{
			char moji=(char)('a'+i-1);
			v.push_back(moji);
			if(i==count+1)ans(v,count+1);
			else ans(v,count);
			v.pop_back();
		}
	}
}
int main()
{
	cin>>n;
	vector<char> po;
	ans(po,0);
	return 0;
}

Measured memory_bytes: 1536
import math
import sys

def getinputdata():

    # 配列初期化
    array_result = []
    
    data = input()

    
    array_result.append(data.split(" "))

    flg = 1

    try:


        while flg:

            data = input()

            array_temp = []

            if(data != ""):
                
                array_result.append(data.split(" "))

                flg = 1

            else:

                flg = 0
    finally:


        return array_result





arr_data = getinputdata()

#品物の金額
n = arr_data[0][0]

#嫌いな数字の数
k = int(arr_data[0][1])

#arr=list(map(int, arr_data[1]))
arr=arr_data[1]

#print(n,k,arr)

chkflg=True

while chkflg:
    
    for v in n:
        
        if v in arr:
            
            n = str(int(n)+1) 
            break
            
    else:
        
        chkflg=False
        
print(n)
#
#for v in n:
#    
##    print(v)
##    print(v,v in arr)
#    
#    if v in arr:
#        
#        n = str(int(n)+1)
#        
#    else:
#        
        

Measured memory_bytes: 3188
// Created by ...
#include <bits/stdc++.h>

#define db1(x) cout<<#x<<"="<<x<<'\n'
#define db2(x,y) cout<<#x<<"="<<x<<","<<#y<<"="<<y<<'\n'
#define db3(x,y,z) cout<<#x<<"="<<x<<","<<#y<<"="<<y<<","<<#z<<"="<<z<<'\n'

#define vll vector< ll >
#define M 100000
#define MD 1000000007
#define pb push_back
#define rep(i,a,b) for(ll i = a; i <= b; ++i)
#define fo(i,a,b) for(int i = a; i<= b; ++i)
#define pii pair<ll,ll> 
#define vec(a) vector<a >
#define all(a) a.begin(),a.end()
#define se second
#define fi first
#define inf 0xffffffff
#define inchar getchar_unlocked
#define outchar(x) putchar_unlocked(x)
#define int long long
#define endl '\n'
#define IOS ios::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)

using namespace std;
using ll = long long;
ll md=MD;

ll exp(ll a,ll b){ll r=1ll;while(b>0){if(b&1){r=r*(a%md);r=(r+md)%md;}b>>=1;a=(a%md)*(a%md);a=(a+md)%md;}return (r+md)%md;}
ll gcd(ll a,ll b){if(b==0)return a;return gcd(b,a%b);}
ll Min(ll a,ll b){if(a<b)return a; return b;}
ll Max(ll a,ll b){if(a>b)return a; return b;}
int32_t main() {
    IOS;

        char c; cin>>c;
        if(c>='A' && c<='Z')cout<<"A";
        else cout<<"a";
        



        cout<<'\n';
    return 0;
}

Measured memory_bytes: 3664
package main

import (
	"fmt"
	"math"
)

func main() {
	var A, B, H, M float64
	fmt.Scan(&A, &B, &H, &M)

	ans := exec(A, B, H, M)
	fmt.Println(ans)
}

func exec(A, B, H, M float64) float64 {
	ang := math.Abs(H*30 + 0.5*M - M*6)
	v := A*A + B*B - (2 * A * B * math.Cos(ang*math.Pi/180))

	return math.Sqrt(v)
}


Measured memory_bytes: 1820
import java.util.*;
public class Main{

	public static void main(String[] args) {
		
		    Scanner sc = new Scanner(System.in);
		    int temp = sc.nextInt();
		    if(30 <= temp){
		      System.out.println("Yes");
		    }
		    else{
		      System.out.println("No");
		    }
	}
}

Measured memory_bytes: 35788
#include<stdio.h>
#include<vector>
#include<algorithm>
using namespace std;
#define SIZE 200001
class unionfind
{
public:
	int par[SIZE];
	int ran[SIZE];
	int ren[SIZE];
	void init()
	{
		for (int i = 0; i<SIZE; i++)
		{
			par[i] = i;
			ran[i] = 0;
			ren[i] = 1;
		}
	}
	int find(int a)
	{
		if (a == par[a])return a;
		else return par[a] = find(par[a]);
	}
	void unite(int a, int b)
	{
		a = find(a);
		b = find(b);
		if (a == b)return;
		if (ran[a]>ran[b])
		{
			par[b] = a;
			ren[a] += ren[b];
		}
		else
		{
			par[a] = b;
			ren[b] += ren[a];
		}
		if (ran[a] == ran[b])ran[b]++;
	}
};
unionfind uf;
int d[202020], x[202020], y[202020];
int main()
{
	int num, way;
	scanf("%d%d", &num, &way);
	for (int i = 0; i < way; i++)
	{
		scanf("%d%d", &x[i], &y[i]);
		x[i]--, y[i]--;
		d[x[i]]++, d[y[i]]++;
	}
	for (int i = 0; i < num; i++)if (d[i] % 2 != 0)goto l01;
	if (way - num <= 1)goto l01;
	if (way - num == 2)
	{
		int r = -1;
		for (int i = 0; i < num; i++)if (d[i] != 2)r = i;
		uf.init();
		int c = 0;
		for (int i = 0; i < way; i++)
		{
			if (x[i] != r&&y[i] != r&&uf.find(x[i]) != uf.find(y[i]))uf.unite(x[i], y[i]), c++;
		}
		if (c == num - 2)goto l01;
	}
	printf("Yes\n");
	if (false)
	{
	l01:;
		printf("No\n");
	}
}

Measured memory_bytes: 3968
#include <stdio.h>
#include <math.h>

int main(void)
{
	double x1, y1, x2, y2;
	double distance;

	/* ??\??? */
	scanf("%lf %lf %lf %lf", &x1, &y1, &x2, &y2);

	/* 2??????????????¢?¨???? */
	distance = sqrt(pow((x2 - x1), 2) + pow((y2 - y1), 2));

	printf("%.7f\n", distance);

	return 0;
}

Measured memory_bytes: 656
package main

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

const (
	initialBufSize = 1e4
	maxBufSize     = 1e6 + 7
)

var buf []byte = make([]byte, maxBufSize)
var sc = bufio.NewScanner(os.Stdin)

func init() {
	sc.Split(bufio.ScanWords)
	sc.Buffer(buf, maxBufSize)
}

func main() {
	N := nextInt()
	ans := 0
	AnCnt := make(map[int]int)
	// 普通の配列だといらないところを数えてしまうので、mapを使う
	for i := 0; i < N; i++ {
		AnCnt[nextInt()]++
	}
	for i, cnt := range AnCnt {
		if cnt > i {
			ans += cnt - i
		} else if cnt < i {
			ans += cnt
		}
	}
	fmt.Println(ans)
}

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

func nextInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}


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


int main(){
    int a,b; cin >> a >> b;
    if(a<b) swap(a,b); //a>b とする
    for(int i=0;i<a;i++){
        cout << b;
    }
    cout << endl;
    return 0;
}

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

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int,int> pii;

typedef int _loop_int;
#define REP(i,n) for(_loop_int i=0;i<(_loop_int)(n);++i)
#define FOR(i,a,b) for(_loop_int i=(_loop_int)(a);i<(_loop_int)(b);++i)
#define FORR(i,a,b) for(_loop_int i=(_loop_int)(b)-1;i>=(_loop_int)(a);--i)

#define DEBUG(x) cout<<#x<<": "<<x<<endl
#define DEBUG2(x,y) cout<<#x<<": "<<x<<" "<<#y<<": "<<y<<endl
#define DEBUG_VEC(v) cout<<#v<<":";REP(i,v.size())cout<<" "<<v[i];cout<<endl
#define ALL(a) (a).begin(),(a).end()

const ll MOD = 1000000007ll;
#define FIX(a) ((a)%MOD+MOD)%MOD


//1 周 K メートルの円形の湖があり、その周りに N 軒の家があります。
int main() {
    ios::sync_with_stdio(false); cin.tie(0);
    int k,n;
    cin>>k>>n;
    vi a;
    a.resize(n);
    REP(i,n) cin>>a[i];

    vi b(n);
    REP(i,n-1){
        b[i] = a[i+1]-a[i];
    }
    //b.emplace_back(k-a[n-1]+a[0]);
    b[n-1] = k-a[n-1]+a[0];
    //DEBUG_VEC(b);
    ll ans = accumulate(ALL(b), 0LL);
    int mx = 0;
    REP(i,n){
        if(mx < b[i]) mx = b[i];
    }

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

Measured memory_bytes: 1792
#include <iostream>
#include <climits>
#include <cmath>
#include <vector>
#include <map>
#include <set>
#include <algorithm>
 
using namespace std;
typedef long long int ll;
typedef unsigned long long int ull;

#define MOD 1000000007LL

int n;
vector<int> a, b;

int main()
{
  ll ans=0;

  cin >> n;
  a.resize(n); b.resize(n);
  for (int i=0; i<n; i++) {
    cin >> a[i] >> b[i];
  }
  sort(a.begin(), a.end()); sort(b.begin(), b.end());

  if (n%2) {
    ans = b[n/2] - a[n/2] + 1;
  } else {
    ans = (b[n/2]+b[n/2-1] - (a[n/2]+a[n/2-1])) + 1;
  }

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

/*
  入力例2
  X1 = [100]
  X2 = [10, 11, ... , 10000]
  X3 = [1, 2, ... , 1000000000]
  */


Measured memory_bytes: 4768
#include <bits/stdc++.h>
#define fo(a,b,c) for (a=b; a<=c; a++)
#define fd(a,b,c) for (a=b; a>=c; a--)
#define add(a,b) a=((a)+(b))%998244353
#define mod 998244353
#define ll long long
//#define file
using namespace std;

int n,i,j,k,l;
char a[101];

ll dg(char *a,int n)
{
	char A[101];
	ll f[101];
	int i,j,k,l;
	
	memset(f,0,sizeof(f));
	memset(A,0,sizeof(A));
	f[0]=1;
	fo(i,1,n)
	{
		f[i]=f[i-1]*(1+(a[i]=='1'))%mod;
		fd(j,i/2,1)
		{
			fo(k,i-j+1,i) A[i-k+1]=a[k];
			l=0;
			fd(k,i-j,1)
			{
				++l;A[l]=(a[k]=='0')?'0':A[l];
				if (l==j) add(f[i],f[k-1]*dg(A,j)),l=0;
			}
		}
	}
	return f[n];
}

int main()
{
	#ifdef file
	freopen("agc020E.in","r",stdin);
	#endif
	
	scanf("%s",a+1),n=strlen(a+1);
	printf("%lld\n",dg(a,n));
	
	fclose(stdin);
	fclose(stdout);
	return 0;
}

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

int main(){
    int t,n,i;
    for(i=0;i<4;i++){
        cin>>t>>n;
        if(t==1){
            cout<<6000*n<<endl;
        }else if(t==2){
            cout<<4000*n<<endl;
        }else if(t==3){
            cout<<3000*n<<endl;
        }else if(t==4){
            cout<<2000*n<<endl;
        }
    }
    return 0;
}


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

using namespace std;

template <class T>
using lim = numeric_limits<T>;

typedef long long ll;
typedef long double ld;

const int maxN = 10e5;
int a[maxN];
int b[maxN];

vector<int> tracker[maxN];
int isClose[maxN];
int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	
	memset(isClose, 0, sizeof isClose);
	int n, m; cin >> n >> m;
	for (int i = 0; i < m; i++){
		cin >> a[i] >> b[i];
		
		tracker[a[i]].push_back(i);

		isClose[b[i]]--;
	}
	
	vector<int> vis;
	int ans = 0;
	for (int i = 0; i < maxN; i++){
		if (isClose[i] < 0){
			ans++;
			for (int j = 0; j < (int) vis.size(); j++){
				isClose[b[vis[j]]]++;
			}
				
			vis.clear();
		}
		for (int j = 0; j < (int) tracker[i].size(); j++){
			vis.push_back(tracker[i][j]);
		}
	}
	cout << ans << endl;
}


Measured memory_bytes: 34432
#include <stdio.h>
#include <algorithm>
#include <vector>
using namespace std;
using ll = long long;

int n, a[10010], b[10010], c[10010], d[10010];
vector<int> e[10010];

int cnt[10010], par[10010];
void dfs(int x, int p) {
	par[x] = p;
	for (int chi : e[x])
		if (chi != p)
			dfs(chi, x), cnt[x]++;
}
int main() {
	scanf("%d", &n);
	for (int i = 0; i < n - 1; i++) {
		scanf("%d %d", a + i, b + i);
		a[i]--, b[i]--;
		e[a[i]].emplace_back(b[i]);
		e[b[i]].emplace_back(a[i]);
	}
	for (int i = 0; i < n; i++)
		scanf("%d", c + i);
	sort(c, c + n);

	vector<int> leaf;
	for (int i = 0; i < n; i++)
		if (e[i].size() == 1)
			leaf.emplace_back(i);

	for (int i = 0; i < n; i++)
		if (2 <= e[i].size()) {
			dfs(i, n);
			break;
		}

	int sum = 0;
	for (int i = 0; i < n; i++) {
		sum += c[i];
		d[leaf.back()] = c[i];
		int id = leaf.back();
		leaf.pop_back();
		if (--cnt[par[id]] == 0)
			leaf.emplace_back(par[id]);
	}
	printf("%d\n", sum - c[n - 1]);
	printf("%d", d[0]);
	for (int i = 1; i < n; i++)
		printf(" %d", d[i]);
	printf("\n");
}

Measured memory_bytes: 1408
/*
    Author: Nguyen Tan Bao
    Status:
    Idea:
*/
 
#include <bits/stdc++.h>
#define FI first
#define SE second
#define EPS 1e-9
#define ALL(a) a.begin(),a.end()
#define SZ(a) int((a).size())
#define MS(s, n) memset(s, n, sizeof(s))
#define FOR(i,a,b) for (int i = (a); i <= (b); i++)
#define FORE(i,a,b) for (int i = (a); i >= (b); i--)
#define FORALL(it, a) for (__typeof((a).begin()) it = (a).begin(); it != (a).end(); it++)
//__builtin_ffs(x) return 1 + index of least significant 1-bit of x
//__builtin_clz(x) return number of leading zeros of x
//__builtin_ctz(x) return number of trailing zeros of x
 
using namespace std;
using ll = long long;
using ld = double;
typedef pair<ll, ll> II;
typedef pair<II, ll> III;
typedef complex<ld> cd;
typedef vector<cd> vcd;
 
const ll MODBASE = 1000000007LL;
const int MAXN = 100010;
const int MAXM = 1000;
const int MAXK = 16;
const int MAXQ = 200010;

int n, a[MAXN];
ll m, s[MAXN];

ll calc(int k) {
    int dau = 1, cuoi = n, mid;
    while (dau <= cuoi) {
        mid = (dau + cuoi) >> 1;
        if (a[mid] >= k) cuoi = mid-1;
        else dau = mid+1;
    }
    return n - cuoi;
}

ll calc2(int k) {
    int dau = 1, cuoi = n, mid;
    while (dau <= cuoi) {
        mid = (dau + cuoi) >> 1;
        if (a[mid] >= k) cuoi = mid-1;
        else dau = mid+1;
    }
    return s[n] - s[cuoi];
}

ll check(int u) {
    ll res = 0;
    FOR(i,1,n) {
        int k = u - a[i];
        res += calc(k);
    }
    return res;
}

ll tinh(int u) {
    ll res = 0;
    FOR(i,1,n) {
        int k = u - a[i];
        res += calc(k) * a[i] + calc2(k);
    }
    return res;
}

int main() {
    ios::sync_with_stdio(0);
    cin.tie(nullptr);
    cin >> n >> m;
    FOR(i,1,n) cin >> a[i];
    sort(a+1, a+n+1);
    FOR(i,1,n) s[i] = s[i-1] + a[i];
    int dau = 2, cuoi = 200000, mid;
    while (dau <= cuoi) {
        mid = (dau + cuoi) >> 1;
        if (check(mid) >= m) dau = mid+1;
        else cuoi = mid-1;
    }
    ll p = m - check(dau);
    // cout << p << endl;
    ll res = p * cuoi;
    // cout << res << endl;
    res += tinh(dau);
    cout << res;
    return 0;
}


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

int main()
{
	ios::sync_with_stdio(false), cin.tie(0);
	int n, q;
	cin >> n;
	set<int> st;
	for (int i = 0; i < n; i++) {
		int si;
		cin >> si;
		st.insert(si);
	}
	int res = 0;
	cin >> q;
	for (int j = 0; j < q; j++) {
		int ti;
		cin >> ti;
		res += st.count(ti);
	}
	cout << res << endl;
	return 0;
}



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

int main(){
  int N,K,A=0;
  cin>>N>>K;
   
  for(int i=0;i<N;i++){
    int x;
    cin>>x;
    
    if(K>=2*x){
      A+=2*x;
    }
      
    else{
      A+=2*(K-x);
    }
   
  }
  
  cout<<A<<endl;
   
}

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

using namespace std;

int main () {
  vector<int> n(3);
  cin >> n.at(0) >> n.at(1) >> n.at(2);
  sort(n.begin(), n.end());
  cout << n.at(0) + n.at(1) + 10 * n.at(2);
}

/*
3つの数字の大小関係を，
$$A \leq B \leq C$$
と仮定しても一般性を失わない。

パネルの並べ方は次の$6$通り：
\begin{eqnarray}
    &[A][B][+][C] \label{a} \\
    &[A][C][+][B] \label{a_} \\
    &[B][A][+][C] \label{b} \\
    &[B][C][+][A] \label{b_} \\
    &[C][A][+][B] \label{c} \\
    &[C][B][+][A] \label{c_}
\end{eqnarray}
ここで，(\ref{a})と(\ref{a_})，(\ref{b})と(\ref{b_})，(\ref{c})と(\ref{c_})
が表す数式の値がそれぞれ互いに等しいことに注意すれば，ありうる数式の値は次の$3$通り：
\begin{eqnarray}
    &10A + B + C \\
    &A + 10B + C \\
    &A + B + 10C
\end{eqnarray}
並べ替え不等式より，最大値は$$A + B + 10C$$である。
*/


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<algorithm>
#include<map>
#include<set>
#include<utility>
#include<vector>
#include<cmath>
#include<cstdio>
#define loop(i,a,b) for(int i=a;i<b;i++) 
#define rep(i,a) loop(i,0,a)
#define pb push_back
#define mp make_pair
#define it ::iterator
#define all(in) in.begin(),in.end()
const double PI=acos(-1);
const double ESP=1e-10;
using namespace std;
int dp[1010][1010][3]={0};
int main(){
	char tmp[3]={'J','O','I'};
	int a,b,n;
	cin>>a>>b>>n;
	vector<string>in(a);
	rep(i,a)cin>>in[i];
	loop(i,1,a+1)loop(j,1,b+1)rep(k,3){
		dp[i][j][k]=dp[i-1][j][k]+dp[i][j-1][k]-dp[i-1][j-1][k];
		if((char)in[i-1][j-1]==tmp[k])dp[i][j][k]++;
	}
	rep(i,n){
		int a,b,c,d;
		cin>>a>>b>>c>>d;
		int out[3]={0};
		rep(j,3)out[j]=dp[c][d][j]-dp[c][b-1][j]-dp[a-1][d][j]+dp[a-1][b-1][j];
		cout<<out[0]<<" "<<out[1]<<" "<<out[2]<<endl;
	}
}

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

using namespace std;
namespace defines{
    typedef long long ll;
    typedef pair<ll,ll> P;
    #define FOR(i,a,b) for(ll i = a ; i < b ; i++) // for i in range(a,b)
    #define REP(i,n) for(ll i = 0 ; i < n ; i++) // for i in range(b)
    #define FORD(i,a,b) for(ll i = a ; i > b ; i--) // for i in range(a,b,-1)
    #define ALL(x) x.begin(),x.end()

    #define DEBUG(x) cerr << #x << ": " << x << '\n'
    #define DEBUGP(x) cerr << #x << ": (" << x.first << ", " << x.second << ")" << '\n' 
    #define DEBUGL(xl) dbgl_f(#xl,xl)
    #define DEBUGLP(xl) dbglp_f(#xl,xl)
    #define DEBUGLL(xll) dbgll_f(#xll,xll)
    #define DEBUGM(xl) dbgm_f(#xl,xl)
    template<class T> void dbgl_f(string name, vector<T> xl){cerr<<name<<": "; for(T x: xl) cerr<<x<<" "; cerr << '\n';}
    template<class T, class U> void dbgm_f(string name, map<T,U> xl){cerr<<name<<": ";for(auto x: xl)cerr<<"("<<x.first<<": "<<x.second<<") ";cerr<<'\n';}
    template<class T> void dbglp_f(string name, vector<T> xl){cerr<<name<<": ";for(T x: xl)cerr<<"("<<x.first<<", "<< x.second<<") ";cerr<<'\n';}
    template<class T> void dbgll_f(string name, vector<vector<T>> xll){
        cerr<< name << ": " << '\n'; 
        for(vector<T> xl: xll){
            for(T x : xl) cerr << x << " ";
            cerr << '\n';
        }
    }
}

using namespace defines;
const int IINF = 1'001'001'001;
const ll INF = 1'001'001'001'001'001'001ll;
const int MOD = 1'000'000'007;


void solve(){
    int n; cin >> n;
    ll tv = 1;
    ll av = 1;
    REP(i,n){
        ll t,a; cin >> t >> a;
        ll need_t = (tv-1)/t + 1;
        ll need_a = (av-1)/a + 1;
        ll multi = max(need_t, need_a);
        t *= multi;
        a *= multi;
        tv = t;
        av = a;
    }
    cout << tv+av << endl;
}

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

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

using namespace std;

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

	vector<bool> vis(105);
	for(int i = 0; i < n; ++i) {
		int v;
		cin >> v;
		vis[v] = true;
	}

	for(int i = 0; i <= 100; ++i) {
		if(!vis[x - i]) {
			cout << x - i << '\n';
			exit(0);
		}
		if(!vis[x + i]) {
			cout << x + i << '\n';
			exit(0);
		}
	}

	return 0;
}


Measured memory_bytes: 3628
#include <iostream>
#include <vector>
#include <algorithm>
#include <queue>
#include <cstring>
#include <cstdio>
#include <cmath>
#include <set>
#include <map>
#include <bitset>
#include <deque>
using namespace std;
using ll = long long;
using itn = int;
const ll MOD = 1000000007;
const ll INF = MOD * MOD;

int main() {

    int n;
    cin >> n;

    vector<ll> a(n+1);
    ll sum = 0;
    ll sum_g = 0;

    for (int i = 1; i <= n; i++) {
        cin >> a[i];
        sum += a[i];
        if (i % 2 == 0) sum_g += a[i];
    }

    vector<ll> dp(n+1);

    dp[1] = sum - 2*sum_g;

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

    for (int i = 1; i <= n; i++) {
        cout << dp[i] << " ";
    }

    return 0;
    
    

    /*
    vector<ll> dp(n+10);

    for (int i = 0; i <= a[1]; i++) {
        dp[0] = i;
        for (int j = 1; j <= n; j++) {
            dp[j] = a[j] - dp[j-1];
        }
        if (dp[n] == dp[0]) {
            for (int k = 0; k < n; k++) {
                cout << dp[k] * 2;
            }
            return 0;
        }
    }
    */
    
}

Measured memory_bytes: 2944
#include <iostream>
#include <limits>

#define R3 (1.732050807568877293527446341505872366942805253810380628)

using namespace std;

void koch(double x1, double y1, double x2, double y2, int n)
{
    if(n--==0) return;
    double sx, sy, tx, ty, ux, uy;
    sx=(x1*2+x2)/3;
    sy=(y1*2+y2)/3;
    tx=(x1+x2*2)/3;
    ty=(y1+y2*2)/3;
    ux=(x1+x2)/2-(y2-y1)*R3/6;
    uy=(y1+y2)/2+(x2-x1)*R3/6;
    koch(x1, y1, sx, sy, n);
    cout<<sx<<' '<<sy<<'\n';
    koch(sx, sy, ux, uy, n);
    cout<<ux<<' '<<uy<<'\n';
    koch(ux, uy, tx, ty, n);
    cout<<tx<<' '<<ty<<'\n';
    koch(tx, ty, x2, y2, n);
}

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n;
    cin>>n;
    cout.setf(ios::fixed);
    cout.precision(8);
    cout<<"0 0\n";
    koch(0.0, 0.0, 100.0, 0, n);
    cout<<"100 0\n";
    return 0;
}

Measured memory_bytes: 1288
#include<stdio.h>
main(){
  int o[105]={0};
  int n,i,max,m=0;
  while(scanf("%d",&n)!=EOF){
    o[n]++;
    if(m<n){
      m=n;
    }
  }
  max=o[1];
  for(i=2;i<=m;i++){
    if(max<o[i]){
      max=o[i];
    }
  }
  for(i=1;i<=m;i++){
    if(o[i]==max){
      printf("%d\n",i);
    }
  }
  return 0;
}

Measured memory_bytes: 596
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<cmath>
#include<bitset>
#include<deque>
#include<functional>
#include<iterator>
#include<map>
#include<set>
#include<stack>
#include<queue>
#include<utility>
using namespace std;
typedef long long ll;
#define a first
#define b second
#define sz(x) (ll)((x).size())
#define pb push_back
#define mp make_pair
#define bg begin()
#define ed end()
#define all(x) (x).bg,(x).ed
#define rep(i,n) for(ll i=0;i<(n);i++)
#define rep1(i,n) for(ll i=1;i<=(n);i++)
#define rrep(i,n) for(ll i=(n)-1;i>=0;i--)
#define rrep1(i,n) for(ll i=(n);i>=1;i--)
#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
const ll MOD=1000000007;
const ll INF=1000000000000000;
template<class T> inline bool chmin(T& a, T b){if(a>b){a=b;return true;}return false;}
template<class T> inline bool chmax(T& a, T b){if(a<b){a=b;return true;}return false;}
ll maxx(ll x,ll y,ll z){return max(max(x,y),z);}
ll minn(ll x,ll y,ll z){return min(min(x,y),z);}
ll gcd(ll x,ll y){if(x%y==0) return y;else return gcd(y,x%y);}
ll lcm(ll x,ll y){return x*(y/gcd(x,y));}
ll digsz(ll x){if(x==0) return 1;else{ll ans=0;while(x){x/=10;ans++;}return ans;}}
ll digsum(ll x){ll sum=0;while(x){sum+=x%10;x/=10;}return sum;}
vector<ll> pw2(62,1);vector<ll> pw10(19,1);


int main(){
    {rep1(i,61) pw2[i]=2*pw2[i-1];}
    {rep1(i,18) pw10[i]=10*pw10[i-1];}
    
    ll N,K,R,S,P; cin>>N>>K>>R>>S>>P;
    ll ans=0;
    string s; cin>>s;
    vector<ll> hand(sz(s),0);
    rep(i,sz(s)){
        //ぐ
        if(s[i]=='r'){
            //パー出す
            if(i<K || hand[i-K]!=2){
                ans+=P;
                hand[i]=2;
            }
            else if(i+K<sz(s)){
                if(s[i+K]=='p') hand[i]=0;
                else hand[i]=1;
            }
        }
        //ち
        else if(s[i]=='s'){
            //ぐー出す
            if(i<K || hand[i-K]!=0){
                ans+=R;
                hand[i]=0;
            }
            else if(i+K<sz(s)){
                if(s[i+K]=='r') hand[i]=1;
                else hand[i]=2;
            }
        }
        //ぱ
        else{
            //チョキ出す
            if(i<K || hand[i-K]!=1){
                ans+=S;
                hand[i]=1;
            }
            else if(i+K<sz(s)){
                if(s[i+K]=='r') hand[i]=0;
                else hand[i]=2;
            }
        }
    }
    cout<<ans<<endl;
}



Measured memory_bytes: 4316