akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>

using namespace std;

/*  テンプレここから */
typedef long long ll;

#define rep(i, n) for(int i = 0; i < n; i++)
#define repi(i, start, end) for(int i = start; i < end; i++)
#define all(x) (x).begin(), (x).end()
#define INF (1e9)
#define add_mod(a, b, x) ( (ll)(a) + (ll)(b) ) % (ll)(x)
#define mul_mod(a, b, x) ( ((ll)(a) % (ll)(x)) * ((ll)(b) % (ll)(x)) ) % (ll)(x)
#define out(x) cout << (x) << endl;
#define outyes(bool_val) cout << (bool_val ? "yes" : "no") << endl;
#define outYes(bool_val) cout << (bool_val ? "Yes" : "No") << endl;
#define outYES(bool_val) cout << (bool_val ? "YES" : "NO") << endl;
#define outPossible(bool_val) cout << (bool_val ? "Possible" : "Impossible") << endl;
#define outPOSSIBLE(bool_val) cout << (bool_val ? "POSSIBLE" : "IMPOSSIBLE") << endl;

ll sub_mod(ll a, ll b, ll x){
    ll tmp = (a - b) % x;
    if(tmp < 0) tmp += x;
    return tmp;
}
ll gcd(ll a, ll b){
    if(b == 0) return a;
    else return gcd(b, a % b);
}

int dx[] = {0, 1, 0, -1};
int dy[] = {-1, 0, 1, 0};
/*  テンプレここまで */

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

    int n, m;
    cin >> n;

    int sum = 0;
    vector<int> drinks(n);
    rep(i, n) cin >> drinks[i];
    sum = accumulate(all(drinks), 0);

    cin >> m;
    rep(i, m){
        int p, x;
        cin >> p >> x;
        cout << sum - (drinks[p-1] - x) << endl;
    }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define range(i,a,b) for(int i = (a); i < (b); i++)
#define rep(i,b) for(int i = 0; i < (b); i++)
#define all(a) (a).begin(), (a).end()
#define debug(x) cout << "debug " << x << endl;
const int INF = 100000000;
using namespace std;

int main(){
    int ro, wo, c, r;
    while(cin >> ro >> wo >> c >> r, ro||wo||c||r){
        int x = 0;
        while(c * wo > ro + x * r) x++;
        cout << x << endl;
    }

}

Measured memory_bytes: 3104
#include<bits/stdc++.h>
using namespace std;
#define FIN ios::sync_with_stdio(0); cin.tie(0)
typedef long long ll;


int main(){
   FIN;
   int n;
  cin >> n;
  while(n){
    if(n%10 == 7) {
      cout <<"Yes";
      return 0;
    }
    n/=10;
  }
  cout << "No";
   return 0;
}

Measured memory_bytes: 3604
n = int(input())
a = list(map(int, input().split()))

if n % 2 == 0:
    for i in range(n):
        if i < int(n / 2):
            print(a[n - 2 * i - 1],'', end = '')
        else:
            print(a[2 * i - n],'', end = '')
else:
    for i in range(n):
        if i <= n // 2:
            print(a[n - 2 * i - 1],'', end = '')
        else:
            print(a[2 * i - n],'', end = '')
print()


Measured memory_bytes: 30676
#include <iostream>

int main(){
    int time, h, m, s;
    std::cin >> time;
    h = time/3600;
    m = (time - 3600*h) / 60;
    s = time % 60;
    std::cout << h << ":" << m << ":" << s << std::endl;
    return 0;
}

Measured memory_bytes: 3084
#include <iostream>
#include <cstdio>
#include <algorithm>

using namespace std;

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

int main() {
	int a, b, h;
	cin >> a >> b >> h;
	cout << (a + b) * h / 2 << endl;
	return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <cmath>
#include <complex>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <vector>
#include <functional>
#include <cstring>
#include <regex>
#include <random>
#include <cassert>
using namespace std;

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repr(i, s, n) for (int i = (s); i < (int)(n); i++)
#define revrep(i, n) for (int i = (n) - 1; i >= 0; i--)
#define revrepr(i, s, n) for (int i = (n) - 1; i >= s; i--)
#define debug(x) cerr << #x << ": " << x << "\n"

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

const long long MOD = 1e9+7;

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

template<class T>
istream& operator >>(istream &is, vector<T> &v) {
    for (int i = 0; i < (int)v.size(); i++) cin >> v.at(i);
    return is;
}

template<class T, class U>
ostream& operator <<(ostream &os, pair<T, U> p) {
    cout << '(' << p.first << ", " << p.second << ')';
    return os;
}

template<class T>
void print(const vector<T> &v, const string &delimiter) { rep(i, v.size()) cout << (0 < i ? delimiter : "") << v.at(i); cout << endl; }

template<class T>
void print(const vector<vector<T>> &vv, const string &delimiter) { for (const auto &v: vv) print(v, delimiter); }

int main() {
    int n;
    cin >> n;
    vector<ll> a(n);
    cin >> a;
    
    ll max_a = 0;
    vector<int> idxs;
    rep(i, n) if (chmax(max_a, a[i])) idxs.push_back(i);
    
    vector<ll> b(n);
    rep(i, n) b[i] = a[i];
    sort(b.rbegin(), b.rend());
    
    vector<ll> sum(n + 1);
    rep(i, n) sum[i + 1] = sum[i] + b[i];
    
    auto search = [&](int x){
        int ng = n;
        int ok = -1;

        while (abs(ok - ng) > 1) {
            int mid = (ok + ng) / 2;

            if (b[mid] > x) ok = mid;
            else ng = mid;
        }
        return ok;
    };
    
    vector<ll> ans_sum(idxs.size() + 1);
    ans_sum[0] = sum[n];
    rep(i, idxs.size()) {
        int u = search(a[idxs[i]]);
        //cout << u << endl;
        ans_sum[i + 1] = sum[u + 1] - a[idxs[i]] * (u + 1);
    }
    
    vector<ll> ans(n + 1);
    rep(i, idxs.size()) {
        ans[idxs[i]] = ans_sum[i] - ans_sum[i + 1];
    }
    rep(i, n) cout << ans[i] << endl;
}

Measured memory_bytes: 5496
#include <algorithm>
#include <cmath>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <vector>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vl = vector<ll>;
#define what(x) cerr << #x << " is " << x << endl;
const int INF = 1 << 28;

int main() {
    int N;
    cin >> N;
    vvi a(N, vi(3));
    for (int i = 0; i < N; ++i) {
        cin >> a[i][0] >> a[i][1] >> a[i][2];
    }
    vvi dp(N, vi(3, 0));
    dp[0] = a[0];
    for (int i = 1; i < N; ++i) {
        for (int j = 0; j < 3; ++j) {
            for (int k = 0; k < 3; ++k) {
                if (k != j)
                    dp[i][j] = max(dp[i][j], dp[i - 1][k] + a[i][j]);
            }
        }
    }
    cout << *max_element(dp[N - 1].begin(), dp[N - 1].end()) << endl;
    return 0;
}

Measured memory_bytes: 11136
# スペース区切りの整数入力
h,n = map(int, input().split())

#指定数分の2つの整数を順番に受けてリストに入力
a = [0]*n
b = [0]*n
for i in range(n):
    a[i],b[i] = map(int, input().split())

#下から順に最小の積み上げを作る
bsum=[0]
for i in range(1,h+1):
    min_bsum = 9999999999999
    for atk in range(n):
        min_bsum = min(min_bsum,bsum[max(0,i-a[atk])]+b[atk])
    bsum.append(min_bsum)
 
#指定のHのコストを表示
print(bsum[h])

Measured memory_bytes: 42332
#include <bits/stdc++.h>
using namespace std;
#define REP(i,a,n) for(int i=(a); i<(int)(n); i++)
#define rep(i,n) REP(i,0,n)
#define FOR(it,c) for(__typeof((c).begin()) it=(c).begin(); it!=(c).end(); ++it)
#define ALLOF(c) (c).begin(), (c).end()
typedef long long ll;
typedef unsigned long long ull;


int main(){
  double T, X;
  cin >> T >> X;

  printf("%.15lf\n", T/X);
  
  return 0;
}


Measured memory_bytes: 256
{
  const Main = (input: string) => {
    const inputArray: string[] = input.split(/ |\n/);
    const nums: number[] = inputArray.map(s => parseInt(s));
    const answer: number = nums[2] - (nums[0] - nums[1]);
    if (answer >= 0) {
      console.log(answer);      
    } else {
      console.log(0);
      
    }
  }
  Main(require("fs").readFileSync("/dev/stdin", "utf8"));
}


Measured memory_bytes: 7500
#include<bits/stdc++.h>
 
#define MP make_pair
#define PB push_back
#define ALL(x) (x).begin(),(x).end()
#define REP(i,n) for(int i=0;i<(n);i++)
#define REP1(i,n) for(int i=1;i<(n);i++)
#define REP2(i,d,n) for(int i=(d);i<(n);i++)
#define RREP(i,n) for(int i=(n);i>=0;i--)
#define CLR(a)      memset((a),0,sizeof(a))
#define MCLR(a)     memset((a),-1,sizeof(a))
#define RANGE(x,y,maxX,maxY) (0 <= (x) && 0 <= (y) && (x) < (maxX) && (y) < (maxY))
 
using namespace std;
 
typedef long long LL;
typedef unsigned long long ULL;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef vector<LL> VLL;
typedef pair<int,int> PII;
 
const int INF = 0x3f3f3f3f;
const LL INFL = 0x3f3f3f3f3f3f3f3fLL;
const double EPS = 1e-9;
 
const int DX[]={1,0,-1,0},DY[]={0,-1,0,1};
 
int main(){
    int N;
    cin >> N;
    int memo[2][100];
    int ans[2][100];

    REP(i, 2){
        REP(j, N){
            cin >> memo[i][j];
            ans[i][j] = 0;
        }
    }

    ans[0][0] = memo[0][0];
    ans[1][0] = memo[0][0] + memo[1][0];

    REP(i, 2){
        REP1(j, N){
            ans[i][j] = ans[i][j-1] + memo[i][j];
            if(i == 1) ans[i][j] = max(ans[i][j], memo[i][j] + ans[i-1][j]);
        }
    }
    cout << ans[1][N-1] << endl;
}


Measured memory_bytes: 256
#[derive(Debug)]
struct Monster {
    x: i64,
    h: i64,
}

fn main() {
    let (n, d, a) = read_tuple();
    let (d, a) = (d as i64, a as i64);
    let mut monsters: Vec<Monster> = (0..n).map(|_| {
        let tmp = read_vec();
        Monster { x: tmp[0], h: tmp[1] }
    }).collect();

    monsters.sort_by_key(|m| m.x);

    let mut effect = vec![0; n + 1];
    let mut ans = 0;
    let mut damage = 0;
    for i in 0..n {
        damage -= effect[i] * a;
        monsters[i].h -= damage;
        let Monster { x: xi, h: hi } = monsters[i];

        if hi > 0 {
            let attack_times = hi / a + if hi % a != 0 { 1 } else { 0 };
            ans += attack_times;
            damage += attack_times * a;

            let range = xi + 2 * d;
            let (mut l, mut h) = (0, n);
            while l < h - 1 {
                let m = (l + h) / 2;
                if monsters[m].x > range {
                    h = m;
                } else {
                    l = m;
                }
            }
            if l < n {
                effect[l + 1] += attack_times;
            }
        }
    }

    println!("{:?}", ans);
}
fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().split_whitespace()
        .map(|e| e.parse().ok().unwrap()).collect()
}
fn read_tuple<T: std::str::FromStr + Copy>() -> (T, T, T) {
    let temp = read_vec();
    (temp[0], temp[1], temp[2])
}



Measured memory_bytes: 12540
#include<bits/stdc++.h>
#define fi first
#define se second
#define mp make_pair
using namespace std;
main(){
	ios_base::sync_with_stdio(false); cin.tie(0);
	int h,w;
	cin>>h>>w;
	char arr[h][w];
	for(int i=0; i<h; i++) for(int j=0; j<w; j++) {cin>>arr[i][j];}
	int vis[h][w];
	memset(vis,-1,sizeof(vis));
	queue<pair<int,int> > bfs;
	for(int i=0; i<h; i++)for(int j=0; j<w; j++) if(arr[i][j]=='#')
	{bfs.push(mp(i,j)); vis[i][j]=0;}
	while(!bfs.empty()){
		int a=bfs.front().fi,b=bfs.front().se;
		bfs.pop();
		if(a-1>=0 && vis[a-1][b]==-1){
			vis[a-1][b]=vis[a][b]+1;
			bfs.push(mp(a-1,b));
		}
		if(b-1>=0 && vis[a][b-1]==-1){
			vis[a][b-1]=vis[a][b]+1;
			bfs.push(mp(a,b-1));
		}
		if(a+1<h  && vis[a+1][b]==-1){
			vis[a+1][b]=vis[a][b]+1;
			bfs.push(mp(a+1,b));
		}
		if(b+1<w  && vis[a][b+1]==-1){
			vis[a][b+1]=vis[a][b]+1;
			bfs.push(mp(a,b+1));
		}
		//for(int r=0; r<h; r++){for(int t=0; t<w; t++) cout<<vis[r][t]<<' ';
		//cout<<endl;}
		//cout<<endl;
	}
	int ans=0;
	for(int i=0; i<h; i++) for(int j=0; j<w; j++) ans=max(ans,vis[i][j]);
	cout<<ans<<endl;
}

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

#define rep(i, N) for (int i = 0; i < (N); i++)
#define all(a) (a).begin(), (a).end()
#define pb push_back

using ll = long long;
using i_i = tuple<int, int>;

int main() {
    int N; cin >> N;
    int A, B; cin >> A >> B;
    int x = 0, y = 0, z = 0;
    rep(i, N) {
        int p; cin >> p;
        if (p <= A) x++;
        if (A < p && p <= B) y++;
        if (B < p) z++;
    }
    cout << min({x, y, z}) << endl;
}


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

	public static void main(String[] args) throws Exception{
		int num = 998244353;

		// TODO Auto-generated method stub
 		BufferedReader bf = new BufferedReader(new InputStreamReader(System.in));
 		PrintWriter out = new PrintWriter(System.out);
 		long n = Long.parseLong(bf.readLine());
 		long prod = 26;
 		int count = 1;
 		while(n-prod > 0){
 			n-=prod;
 			prod*=26;
 			count++;	
 		}
 		n-=1;
 		String a = Long.toString(n, 26);
 		int len = a.length();
 		StringJoiner sj1 = new StringJoiner("");
 		StringJoiner sj = new StringJoiner("");
 		for(int i = 0;i<count-a.length();i++){
 			sj.add("0");
 		}
 		sj1.add(sj.toString());
 		sj1.add(a);
 		
 		String c = sj1.toString();
 		StringJoiner ans = new StringJoiner("");
 		for(int i = 0;i<c.length();i++){
 			if (Character.isDigit(c.charAt(i))){
 				ans.add((char)(Integer.parseInt(c.charAt(i)+ "") + 97)+"");
 			}
 			else{
 				ans.add((char)((int)(c.charAt(i))+10)+"");
 			}
 		}
 		
 		out.println(ans.toString());
 		out.close();
 	}
}
 	
 
//StringJoiner sj = new StringJoiner(" "); 
//sj.add(strings)
//sj.toString() gives string of those stuff w spaces or whatever that sequence is

 		
 		
 		
 		
	




Measured memory_bytes: 25444
#include <iostream>
#include <algorithm>
#include <vector>
#define rep(i,n) for(int i=0;i<n;++i)
#define rep1(i,n) for(int i=1;i<=n;++i)
using namespace std;
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(a > b){ a = b; return 1; } return 0; }
typedef long long ll;
const ll MOD = 998244353;
struct mint{
  ll x;
  mint(ll x=0):x(x%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;
  }
};


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

  int n = c - a, m = d - b;
  vector<vector<mint>> dp(n + 2, vector<mint>(m + 2));
  dp[0][0].x = 1;
  rep(i,n+1) {
    rep(j,m+1) {
      if(i > 0 && j > 0) {
	dp[i][j] -= dp[i-1][j-1] * (mint)((a + i - 1) * (b + j - 1));
      }
      dp[i+1][j] += dp[i][j] * (mint)(b + j);
      dp[i][j+1] += dp[i][j] * (mint)(a + i);
    }
  }
  cout << dp[n][m].x << "\n";
  
  return 0;
}


Measured memory_bytes: 73636
import sys

read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
MOD = 1000000007


def main():
    A, B, K = map(int, readline().split())

    if B - A + 1 < 2 * K:
        ans = list(range(A, B + 1))
    else:
        ans = list(range(A, A + K)) + list(range(B - K + 1, B + 1))

    print(*ans, sep='\n')

    return


if __name__ == '__main__':
    main()


Measured memory_bytes: 8908
from sys import stdin
def main():
    #入力
    readline=stdin.readline
    N=int(readline())
    A=list(map(int,readline().split()))

    li=[[0,0] for _ in range(N+1)]
    di=dict()
    for i in range(N):
        if A[i] not in di:
            di[A[i]]=1
        else:
            di[A[i]]+=1
    
    s=0
    for k,v in di.items():
        li[k][0]=v*(v-1)//2
        s+=v*(v-1)//2
        li[k][1]=(v-1)*(v-2)//2

    for i in range(N):
        print(s-li[A[i]][0]+li[A[i]][1])

if __name__=="__main__":
    main()

Measured memory_bytes: 43732
#include<stdio.h>

#include<math.h>


int main(void){


  double r,c,s;


  while(scanf("%lf",&r) !=EOF)


  {


    c = 2.0 * r * M_PI;


    s = r * r * M_PI;


    printf("%.61f %.61f\n", s, c);


  }


return 0;


}

Measured memory_bytes: 652
#include <bits/stdc++.h>
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  for(int i=0;i<(n);++i)
#define REPr(i,n) for(int i=(n)-1;i>=0; --i)
#define FORq(i, m, n) for(int i = (m);i <= (n);++i)
#define FORqr(i, m , n) for(int i = (n);i >=(m);--i)
#define SCD(n) scanf("%d",&n)
#define SCD2(m,n) scanf("%d%d",&m,&n)
#define SCD3(m,n,k) scanf("%d%d%d",&m,&n,&k)
#define SCLLD(n) scanf("%lld",&n)
#define SCLLD2(m,n) scanf("%lld%lld",&m,&n)
#define SCLLD3(m,n,k) scanf("%lld%lld%lld",&m,&n,&k)
#define PB push_back
#define MP make_pair
#define ARSCD(A,N) REP(i,N){SCD(A[i]);}
#define ARSCD1(A,N) FORq(i,1,N){SCD(A[i]);}
#define VSCD(v,N) REP(i,N){int (x); SCD(x); v.PB(x);}
#define VSCLLD(v,N) REP(i,N){long long (x); SCLLD(x); v.PB(x);}
#define PRINTD(n) printf("%d\n",n)
#define PRINTLLD(n) printf("%lld\n",n)
#define DEBUG printf("%s\n","debug")
#define fst first
#define snd second
#define SIN(x,S) (S.count(x) != 0)
#define M0(x) memset(x,0,sizeof(x))
#define FILL(x,y) memset(x,y,sizeof(x))
#define MM(x) memset(x,-1,sizeof(x))
#define ALL(x) (x).begin(),(x).end()
using namespace std;
typedef pair<int,int> PII;
typedef pair<long long,long long> PLL;
typedef vector<int> VI;
typedef vector < VI > VVI;
typedef vector<long long> VL;
typedef long long ll;
typedef long long integer;
///////////////////////////////////////////////
const ll MOD = 1000000007;
ll gcd(ll x,ll y){return y?gcd(y,x%y):x;}
///////////////////////////////////////////////
ll dic[3002][3002]= {};
ll a[3002] = {};
int N;

ll f(int i,int j){
	if (i > j) return 0;
	if (dic[i][j] > -10000000000000) return dic[i][j];
	int t = (N - (j-i+1)) % 2;
	if (t == 0) dic[i][j] = max(f(i+1,j) + a[i],f(i,j-1) + a[j]);
	else dic[i][j] = min(f(i+1,j) - a[i],f(i,j-1) - a[j]);
	return dic[i][j];
}

int main(){
	FORq(i,0,3001){
		FORq(j,0,3001){
			dic[i][j] = -10000000000000;
		}
	}

	SCD(N);
	FORq(i,1,N){
		cin >> a[i];
	}

	PRINTLLD(f(1,N));
}


Measured memory_bytes: 70784
#include <bits/stdc++.h>
#define endl '\n'
#define int long long
#define lint long long
#define pii pair<int, int>
#define FOR(i, a, b) for(int i = (a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(v) (v).begin(), (v).end()
#define SZ(v) ((int)v.size())
#define ZERO(a) memset(a, 0, sizeof(a))
#define MINUS(a) memset(a, 0xff, sizeof(a))
#define MINF(a) memset(a, 0x3f, sizeof(a))
#define POW(n) (1LL << (n))
#define POPCNT(n) (__builtin_popcount(n))
#define IN(i, a, b) (a <= i && i <= b)
using namespace std;
template <typename T> inline bool CHMIN(T& a,T b) { if(a>b) { a=b; return 1; } return 0; }
template <typename T> inline bool CHMAX(T& a,T b) { if(a<b) { a=b; return 1; } return 0; }
template <typename T> inline void SORT(T& a) { sort(ALL(a)); }
template <typename T> inline void REV(T& a) { reverse(ALL(a)); }
template <typename T> inline void UNI(T& a) { sort(ALL(a)); a.erase(unique(ALL(a)),a.end()); }
template <typename T> inline T LB(vector<T>& v, T a) { return *lower_bound(ALL(v),a); }
template <typename T> inline int LBP(vector<T>& v, T a) { return lower_bound(ALL(v),a) - v.begin(); }
template <typename T> inline T UB(vector<T>& v, T a) { return *upper_bound(ALL(v),a); }
template <typename T> inline int UBP(vector<T>& v, T a) { return upper_bound(ALL(v),a) - v.begin(); }
template <typename T1, typename T2> ostream& operator<< (ostream& os, const pair<T1,T2>& p) { os << p.first << " " << p.second; return os; }
template <typename T1, typename T2> istream& operator>> (istream& is, pair<T1,T2>& p) { is >> p.first >> p.second; return is; }
template <typename T> ostream& operator<< (ostream& os, const vector<T>& v) { REP(i,v.size()) { if (i) os << " "; os << v[i]; } return os; }
template <typename T> istream& operator>> (istream& is, vector<T>& v) { for(T& in : v) is >> in; return is; }
template <typename T = int> vector<T> make_v(size_t a) { return vector<T>(a); }
template <typename T, typename... Ts> auto make_v(size_t a, Ts... ts) { return vector<decltype(make_v<T>(ts...))>(a,make_v<T>(ts...)); }
template <typename T, typename V> typename enable_if<is_class<T>::value == 0>::type fill_v(T &t, const V &v) { t = v; }
template <typename T, typename V> typename enable_if<is_class<T>::value != 0>::type fill_v(T &t, const V &v) { for(auto &e : t) fill_v(e, v); }
const lint MOD = 1000000007;
const lint INF = 0x3f3f3f3f3f3f3f3f;
const double PI = 3.14159265358979323846;
const double EPS = 1e-10;

int N, M;
string s[110], t[110];
map<string, int> mp;

void _main() {
    cin >> N;
    REP (i, N) cin >> s[i], mp[s[i]]++;;
    cin >> M;
    REP (i, M) cin >> t[i], mp[t[i]]--;
    int ans = 0;
    for (auto p : mp) CHMAX(ans, p.second);
    cout << ans << endl;
}

signed main(signed argc, char **argv) {
    if (argc > 1) {
        if (strchr(argv[1], 'i')) freopen("input.txt", "r", stdin);
        if (strchr(argv[1], 'o')) freopen("output.txt", "w", stdout);
    }
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout << fixed << setprecision(10);
    _main();
    return 0;
}

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

namespace ABC130_C
{
    class Program
    {
        static void Main(string[] args)
        {
            var line = Console.ReadLine().Split().Select(double.Parse).ToArray();
            var W = line[0];
            var H = line[1];
            var x = line[2];
            var y = line[3];

            var flag = 2 * x == W && 2 * y == H ? 1 : 0;

            Console.WriteLine($"{W * H * 0.5} {flag}");
        }
    }
}


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

using namespace std;

int solve(const std::vector<int>& as) {
  int ret = 0;
  for (auto itr = as.begin(); itr != as.end();) {
    auto const nextItr = std::upper_bound(itr, as.end(), *itr);
    ret += (nextItr - itr) % 2;
    itr = nextItr;
  }
  return ret;
}

int main() {
  int n;
  std::cin >> n;
  std::vector<int> as(n);
  for (auto& a : as) {
    std::cin >> a;
  }
  std::sort(as.begin(), as.end());
  std::cout << solve(as) << std::endl;
  return 0;
}


Measured memory_bytes: 640
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <stack>
#include <queue>
#include <set>
#include <bitset>
#include <map>
#include <unordered_map>
#include <ctime>
#include <list>
#include <numeric>
#include <utility>
#include <ctime>
#define INF 1000000000
#define LINF 9000000000000000000
#define mod 1000000007

#define rep(i,n) for(int i=0;i<int(n);i++)
#define rrep(i,n) for(int i=n-1;i>=0;i--)
#define REP(i,a,b) for(int i=(a);i<int(b);i++)
#define all(x) (x).begin(),x.end()
#define pb push_back
#define mp make_pair
#define MOD(x) (x%(mod))

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef pair<int,int> pi;

int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
int ddx[8]={-1,-1,0,1,1,1,0,-1};
int ddy[8]={0,1,1,1,0,-1,-1,-1};
bool debug=false;

/*---------------------------------------------------*/

ll similarity_multiple(ll a,ll b){
  return (a / b * b + (a % b != 0 ? 1 : 0) * b);
}

int main(){
  ll n, a[100005], b[100005];
  cin >> n;
  rep(i, n){
    cin >> a[i] >> b[i];
  }
  ll ans = 0;
  for(int i = n - 1; i >= 0; i--){
    a[i] += ans;
    ll tmp = similarity_multiple(a[i], b[i]);
    ans += tmp - a[i];
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 1792
#include <iostream>

 

 

 

using namespace std;

 

 

 

int main() 
{
    int w, h, x, y, r;
    cin >> w >> h >> x >> y >> r;
    if(x-r >= 0 && y-r >= 0 && x+r <= w && y+r <= h)
        cout<< "Yes" << endl;
    else
        cout<< "No" << endl;
}


Measured memory_bytes: 3092
from collections import Counter
from collections import deque
from functools import reduce
from pprint import pprint
import bisect
import copy
import fractions
import itertools
import math
import queue
import random
import sys
import time
sys.setrecursionlimit(10**7)
INF = 10 ** 18
MOD = 10 ** 9 + 7
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def MI(): return map(int, sys.stdin.readline().split())
def II(): return int(sys.stdin.readline())
def IS(): return input()
def C(x): return Counter(x)
def GCD_LIST(numbers): return reduce(fractions.gcd, numbers)
def LCM_LIST(numbers): return reduce(LCM, numbers)
def LCM(m, n): return (m * n // fractions.gcd(m, n))


n = II()
w = LI()
mini = INF
for t in range(1, n):
    a = w[:t]
    b = w[t:]
    mini = min(mini, abs(sum(a) - sum(b)))
print(mini)



Measured memory_bytes: 67308
#include "bits/stdc++.h"
using namespace std;
#ifdef _DEBUG
#include "dump.hpp"
#else
#define dump(...)
#endif

//#define int long long
#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define rrep(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define all(c) begin(c),end(c)
const int INF = sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD = (int)(1e9) + 7;
const double PI = acos(-1);
const double EPS = 1e-9;
template<class T> bool chmax(T &a, const T &b) { if (a < b) { a = b; return true; } return false; }
template<class T> bool chmin(T &a, const T &b) { if (a > b) { a = b; return true; } return false; }

int dp[50][450][450];
signed main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	int N, Ma, Mb; cin >> N >> Ma >> Mb;
	vector<int> a(N), b(N), c(N); rep(i, 0, N) { cin >> a[i] >> b[i] >> c[i]; }
	memset(dp, 0x3f, sizeof(dp));
	dp[0][0][0] = 0;
	rep(i, 0, N) {
		rep(j, 0, 410)rep(k, 0, 410) {
			chmin(dp[i + 1][j][k], dp[i][j][k]);
			chmin(dp[i + 1][j + a[i]][k + b[i]], dp[i][j][k] + c[i]);
		}
	}
	int ans(INF);
	rep(i, 1, 410)rep(j, 1, 410)if (j*Ma == i*Mb)chmin(ans, dp[N][i][j]);
	cout << (ans==INF?-1:ans) << endl;
	return 0;
}

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

using namespace std;

#define rep(i, n) for(int i = 0; i < (int)n; ++i)
#define FOR(i, a, b) for(int i = a; i < (int)b; ++i)
#define rrep(i, n) for(int i = ((int)n - 1); i >= 0; --i)

using ll = long long;
using ld = long double;

const ll INF = 1e18;
const int Inf = 1e9;
const double EPS = 1e-9;
const ll MOD = 1e9 + 7;

int n;
vector<int> res;
vector<vector<int> > g;

void dfs(int s = 0, int p = -1) {
  for (auto e: g[s]) {
	if (e == p) continue;
	res[e] += res[s];
	dfs(e, s);
  }
}

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(0);
	int q;
	cin >> n >> q;
	res.resize(n);
	g.resize(n);
	rep (i, n - 1) {
	  int a, b;
	  cin >> a >> b;
	  g[a - 1].push_back(b - 1);
	  g[b - 1].push_back(a - 1);
	}
	rep (i, q) {
	  int p, x;
	  cin >> p >> x;
	  res[p - 1] += x;
	}
	dfs();
	rep (i, n) {
	  cout << res[i];
	  if (i == n - 1) cout << endl;
	  else cout << " ";
	}
    
    return 0;
}



Measured memory_bytes: 24208
#include <iostream>
#include <vector>
#include <algorithm>
#include <queue>

using namespace std;

int main()
{
	int n;
	cin >> n;
	int a,b;
	cin >> a >> b;
	if (n==1)
	{
		cout << "Hello World";
	}
	else cout << a+b;
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
#include<string>
#include<utility>
#include<algorithm>
#include<vector>
#include<math.h>
#include<bits/stdc++.h>
#include<stdio.h>
typedef long long ll;
 
int main(){
    int N;
    cin >> N;
    int sum=0;
    if(N%2==0){
        N=N/2-1;
        sum=N;
    }
    else{
        N=N+1;
        N=N/2-1;
        sum=N;
    }
    cout << sum;
}


Measured memory_bytes: 256
#include <stdio.h>

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

	return 0;
}

Measured memory_bytes: 580
// 1_6_C
#include<stdio.h>

int main(void)
{
	int n, b, r, f, v, i, j, k;
	int house[4][3][10] = {};
	scanf("%d", &n);

	for(i = 0; i < n; i++){
		scanf("%d %d %d %d", &b, &r, &f, &v);
		house[b-1][r-1][f-1] += v;
	}

	for(i = 0; i < 4; i++){
		for(j = 0; j < 3; j++){
			for(k = 0; k < 10; k++){
				printf(" %d", house[i][j][k]);
			}
			printf("\n");
		}
		if(i != 3){
			for(k = 0; k < 20; k++){
				printf("#");
			}
			printf("\n");
		}
	}

	return 0;
}

Measured memory_bytes: 600
#include <bits/stdc++.h>
using namespace std;
#define all(x) (x).begin(),(x).end()
using ll = long long;
using ld = long double;
#define vl vector<long long>
#define vvl vector<vector<long long>>
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define rep2(i, s, n) for (ll i = (s); i < (ll)(n); i++)
using pll = pair<long long,long long>;
#define cY cout<<"Yes"<<endl
#define cN cout<<"No"<<endl
const long long INF = 1LL << 60;
const long long MOD = 1000000007;
const long double pi = (acos(-1));
#define pb push_back
#define vs vector<string>

//最大最小の入れ替え
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;
}

//約数列挙
vector<long long> divisor(long long n) {
    vector<long long> ret;
    for (long long i = 1; i * i <= n; i++) {
        if (n % i == 0) {
            ret.push_back(i);
            if (i * i != n) ret.push_back(n / i);
        }
    }
    sort(ret.begin(), ret.end()); // 昇順に並べる
    return ret;
}
//コンビネーション
ll nCr(ll n, ll r) {
    ll ans = 1;
    for (ll i = n; i > n - r; --i) {
        ans = ans*i;
    }
    for (ll i = 1 ; i < r + 1; ++i) {
        ans = ans / i;
    }
    return ans;
}
//素因数分解
map< ll, ll > prime_factor(ll n) {
  map< ll, ll > ret;
  for(ll i = 2; i * i <= n; i++) {
    while(n % i == 0) {
      ret[i]++;
      n /= i;
    }
  }
  if(n != 1) ret[n] = 1;
  return ret;
}

//切り上げの割り算は(a + b - 1) / bでできる

//ここから
int main(){
    ll a,b,c;
    cin>>a>>b>>c;
    map<ll,ll> m;
    m[a]++;
    m[b]++;
    m[c]++;
    cout<<m.size()<<endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int c[101];
int main()
{
	int a,b,n,i;
	scanf("%d %d %d",&n,&a,&b);
	for(i=1;i<=n;i++)
	{
		c[i]=2;
	}
	c[a]=0;
	c[b]=1;
	while(1)
	{
		a++;
		if(c[a]==1)
		{
			printf("Borys");
			break;
		}
		c[a]=0;
		b--;
		if(c[b]==0)
		{
			printf("Alice");
			break;
		}
		c[b]=1;
	}
	return 0;
}

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

#define rep(i,n) for(int i=0;i<(n);i++)
#define dbg(S) { int f=1; for(auto x:S) cerr<<(f?"[":", ")<<x, f=0; cerr<<"]\n"; }

using namespace std;

int main(){
	int h,w,n; cin>>h>>w>>n;
	vector<pair<int,int>> a;
	rep(i,n){
		int x1,y1,x2,y2; cin>>y1>>x1>>y2>>x2;
		if((x1==0 || x1==w || y1==0 || y1==h)
		&& (x2==0 || x2==w || y2==0 || y2==h)){
			auto add=[&](int x,int y){
				if     (y==0) a.emplace_back(x,i);
				else if(x==w) a.emplace_back(w+y,i);
				else if(y==h) a.emplace_back(w+h+(w-x),i);
				else          a.emplace_back(w+h+w+(h-y),i);
			};
			add(x1,y1);
			add(x2,y2);
		}
	}

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

	stack<int> S;
	for(auto x:a){
		int i=x.second;
		if(S.empty() || S.top()!=i) S.push(i);
		else S.pop();
	}
	cout<<(S.empty()?"YES":"NO")<<endl;

	return 0;
}


Measured memory_bytes: 2420
#![allow(unused, non_snake_case, dead_code, non_upper_case_globals)]
use {
    proconio::{marker::*, *},
    std::{cmp::*, collections::*, mem::*},
};
fn main() {
    input! {//
        A:usize,B:usize,M:usize,
        a:[i64;A],
        b:[i64;B],
        xyc:[(Usize1,Usize1,i64);M],
    }
    let mut ans = INF;

    for wa in xyc {
        ans = min(ans, a[wa.0] + b[wa.1] - wa.2);
    }
    ans = min(ans, a.iter().min().unwrap() + b.iter().min().unwrap());
    println!("{}", ans);
}
const INF: i64 = 1 << 60;


Measured memory_bytes: 8664
package main
import (
  "bufio"
  "os"
  "strconv"
  "strings"
  "fmt"
)

var reader = bufio.NewReaderSize(os.Stdin, 1000000)
var writer = bufio.NewWriter(os.Stdout)
func NextLine() string {
  buffer := make([]byte, 0)
  for true {
    line, isPrefix, err := reader.ReadLine()
    if err != nil { panic(err) }
    buffer = append(buffer, line...)
    if !isPrefix { break }
  }
  return string(buffer)
}
func NextInt(A ...*int) {
  L := strings.Split(NextLine(), " ")
  for i, a := range A {
    *a, _ = strconv.Atoi(L[i])
  }
}
func NextIntVec(A *[]int) {
  L := strings.Split(NextLine(), " ")
  (*A) = make([]int, len(L))
  for i, l := range L {
    (*A)[i], _ = strconv.Atoi(l)
  }
}
func NextFloat(A ...*float64) {
  L := strings.Split(NextLine(), " ")
  for i, a := range A {
    *a, _ = strconv.ParseFloat(L[i], 64)
  }
}
func NextFloatVec(A *[]float64) {
  L := strings.Split(NextLine(), " ")
  (*A) = make([]float64, len(L))
  for i, l := range L {
    (*A)[i], _ = strconv.ParseFloat(l, 64)
  }
}
func Write(s interface{}) {
  fmt.Fprintln(writer, s)
}
func WriteIntVec(A []int) {
  S := make([]string, len(A))
  for i, a := range A {
    S[i] = strconv.Itoa(a)
  }
  Write(strings.Join(S, " "))
}
func Output() {
  _ = writer.Flush()
}

func MaxInt(A ...int) int {
  max := A[0]
  for _, a := range A {
    if max < a { max = a }
  }
  return max
}
func MinInt(A ...int) int {
  min := A[0]
  for _, a := range A {
    if a < min { min = a }
  }
  return min
}
func SumInt(A ...int) int {
  sum := 0
  for _, a := range A {
    sum += a
  }
  return sum
}
func AbsInt(x int) int {
  if x < 0 { x = -x }
  return x
}

func CombMod2(N, k int) int {
  if N & k == k { return 1 }
  return 0
}

func Solve() {
  var N int
  NextInt(&N)
  A := make([]int, N)
  for i, s := range NextLine() {
    A[i], _ = strconv.Atoi(string([]rune{s}))
  }
  B := make([]int, N - 1)
  for i := range B {
    B[i] = AbsInt(A[i] - A[i + 1])
  }
  cnt := 0
  for i, b := range B {
    cnt += CombMod2(N - 2, i) * (b % 2)
  }
  if cnt % 2 == 1 {
    Write(1)
    return
  }
  for i, b := range B {
    if b == 1 {
      Write(0)
      return
    }
    B[i] /= 2
  }
  cnt = 0
  for i, b := range B {
    cnt += CombMod2(N - 2, i) * b
  }
  if cnt % 2 == 1 {
    Write(2)
    return
  }
  Write(0)
}

func main() {
  Solve()
  Output()
}

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

int main() {
  int n,k;
  cin >> n >> k;
  vector<int> vec(n);
  for(int i=0;i<n;i++){
    cin >> vec.at(i);
  }
  sort(vec.begin(), vec.end());
 long long int answer=10000000000000000000000;
  int d;
  for(int i=0;i<n-k+1;i++){
    d=vec.at(i+k-1)-vec.at(i);
    if(d<answer){
      answer=d;
    }
  }
  cout << answer << endl;
}

Measured memory_bytes: 640
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define rep(i,a,b) for(int i=int(a);i<int(b);i++)
#define INF 1200000000



int main(){
    int A,B;
    cin>>A>>B;
    rep(i,1,4){
        if(i!=A && i!=B){
            cout<<i<<endl;
            break;
    }
    
}
}




Measured memory_bytes: 256
#include <stdio.h>
#define N 100000
#define NIL -1

struct Node{
  int parent;
  int left;
  int right;
};
struct Node T[25];
int C[25];
int H[25];

void getDepth(int, int);
int getHeight(int);

int main()
{
  int n, i, j, k, x, y, id, left, right, root;


  scanf("%d",&n);
  for( i=0 ; i<n ; i++ ){
    T[i].parent = NIL;
  }
  for( i=0 ; i<n ; i++ ){
    scanf("%d %d %d",&id,&left,&right);
    T[id].left = left;
    T[id].right = right;   
    T[left].parent = id;
    T[right].parent = id;
  }

  for( i=0 ; i<n ; i++ )
    if(T[i].parent==NIL) root = i;

  getDepth(root,0);
  getHeight(root);

  for( i=0 ; i<n ; i++ ){
    printf("node %d: parent = %d, sibling = ",i,T[i].parent);
    
    j=i;
    while(1){
      if(T[i].parent==NIL) {
        printf("%d",T[i].parent);
        break;
      }
      if(T[T[i].parent].left==j) {
        printf("%d",T[T[i].parent].right);
        break;
      }
      if(T[T[i].parent].right==j){
        printf("%d",T[T[i].parent].left);
        break;
      }
      j++;
    }
        
    printf(", degree = ");
    if(T[i].left==NIL && T[i].right==NIL) printf("0");
    else if(T[i].left==NIL && T[i].right!=NIL)printf("1");
    else if(T[i].left!=NIL && T[i].right==NIL)printf("1");
    else printf("2");

    printf(", depth = %d,",C[i]);

    printf(" height = %d,",H[i]);
    
    if(T[i].parent==NIL)
      printf(" root\n");
    else if(T[i].left==NIL && T[i].right==NIL)
      printf(" leaf\n");
    else
      printf(" internal node\n");
  }

  return 0;
}
void getDepth(int r, int d)
{
  if(r==NIL) return;
  C[r] = d;


  getDepth(T[r].right,d+1);

  getDepth(T[r].left,d+1);
}

int getHeight(int r)
{
  int x=0, y=0;

  if(T[r].right!=NIL)
    x = getHeight(T[r].right)+1;
  if(T[r].left!=NIL)
    y = getHeight(T[r].left)+1;
  if(x>y) H[r] = x;
  else H[r] = y;
  return H[r];
}

Measured memory_bytes: 616
a,b=gets.chomp.split.map(&:to_i);
sum1=a+b
sum2=a-b
sum3=a*b

if sum1>sum2
  if sum1>sum3
    puts sum1
  else 
    puts sum3
  end
else 
  if sum2>sum3
     puts sum2
  else
    puts sum3
  end
end
  

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

using namespace std;

const int maxn=1e7+10;
const int NIL=-1;

struct node{
    int location,p,l,r;
};

struct point{
    int id,x,y;
    friend bool operator <(const point &a,const point &b){
        return a.id<b.id;
    }
};

void print(point a)
{
    printf("%d\n",a.id);
}

int n,np;
point p[maxn];
node t[maxn];

bool lessx(const point p1,const point p2){return p1.x<p2.x;}
bool lessy(const point p1,const point p2){return p1.y<p2.y;}

int makekdtree(int l,int r,int depth)
{
    if(!(l<r)){
        return NIL;
    }
    int mid=(l+r)>>1;
    int T=np++;
    if(depth%2==0){
        sort(p+l,p+r,lessx);
    }else{
        sort(p+l,p+r,lessy);
    }
    t[T].location=mid;
    t[T].l=makekdtree(l,mid,depth+1);
    t[T].r=makekdtree(mid+1,r,depth+1);
    return T;
}

void find(int v,int sx,int tx,int sy,int ty,int depth,vector<point>&ans)
{
    int x=p[t[v].location].x;
    int y=p[t[v].location].y;
    if(sx<=x&&x<=tx&&sy<=y&&y<=ty){
        ans.push_back(p[t[v].location]);
    }
    if(depth%2==0){
        if(t[v].l!=NIL){
            if(sx<=x){
                find(t[v].l,sx,tx,sy,ty,depth+1,ans);
            }
        }
        if(t[v].r!=NIL){
            if(x<=tx){
                find(t[v].r,sx,tx,sy,ty,depth+1,ans);
            }
        }
    }else{
        if(t[v].l!=NIL){
            if(sy<=y){
                find(t[v].l,sx,tx,sy,ty,depth+1,ans);
            }
        }
        if(t[v].r!=NIL){
            if(y<=ty){
                find(t[v].r,sx,tx,sy,ty,depth+1,ans);
            }
        }
    }
}

int main()
{
    int x,y;
    scanf("%d",&n);
    for(int i=0;i<n;i++){
        scanf("%d%d",&x,&y);
        p[i].id=i;
        p[i].x=x;
        p[i].y=y;
        t[i].l=t[i].r=t[i].p=NIL;
    }
    np=0;
    int root=makekdtree(0,n,0);
    int q;
    scanf("%d",&q);
    int sx,tx,sy,ty;
    vector<point>ans;
    for(int i=0;i<q;i++){
        scanf("%d%d%d%d",&sx,&tx,&sy,&ty);
        ans.clear();
        find(root,sx,tx,sy,ty,0,ans);
        sort(ans.begin(),ans.end());
        for(int j=0;j<ans.size();j++){
            print(ans[j]);
        }
        printf("\n");
    }
    return 0;
}
/*
6
2 1
2 2
4 2
6 2
3 3
5 4
2
2 4 0 4
4 10 2 5
*/



Measured memory_bytes: 16440
/**Bismillahir Rahmanir Rahim.**/

/**
 *    author:  nasimnoob
**/

#include<bits/stdc++.h>
#include<stdlib.h>
#include<iostream>
#include<vector>
#include<math.h>
#include<cstring>
#include<cstdio>

using namespace std;

//----------------------------------------------------------//

typedef long long int                        ll;
typedef unsigned long long int              ull;
typedef long double                          ld;

//-----------------------------------------------------------//
#define      test                       int t; cin>>t;  while(t--)

#define      cube(x)                    (x*x*x)
#define      sqr(x)                     (x*x)

#define      sc1(x)                     scanf("%lld",&x);
#define      sc2(x,y)                   scanf("%lld %lld", &x, &y)
#define      scf1(x)                    scanf("%lf",&x)
#define      scf2(x,y)                  scanf("%lf %lf", &x, &y)

#define      INPUT                      freopen("input.txt", "r", stdin)
#define      OUTPUT                     freopen("output.txt", "w", stdout)

#define      srev                       reverse(s.begin(),s.end())
#define      sortstr                    sort(s.begin(), s.end());
#define      gtl(x)                     getline(cin, (x))
#define      dot(x)                     fixed << setprecision(x)

#define      PI                         acos(-1) // 3.1415926535897932
#define      MIN                        9999999

#define      Faster                     ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);


//scanf("%[^\n]%*c", str);
//sort(s,s+n,greater<int>());
//freopen("input.txt", "r", stdin);
//freopen("output.txt", "w", stdout);


//-----------------------------------------------------------//

int main()
{
    Faster;



    string s ;

    cin >> s ;

    int cnt = 1 ;

    int nai = 0;

    for (int i = 0 ; i < s.size() ; i++)
    {
        if (s[i] == 'R' && s[i+1] == 'R')
            cnt ++ ;
        if (s[i] == 'S')
            nai ++ ;
    }

    if (nai == 3)
        cout << 0 << endl;
    else
        cout << cnt << endl;



    return 0 ;
}







Measured memory_bytes: 3604
package main

import (
	"fmt"
)

// go run ./main.go < in

func main() {
	var a, b, c, x int
	fmt.Scan(&a, &b, &c, &x)

	count, sumA, sumB, sumC := 0, 0, 0, 0
	// sum := 0
	for i := 0; i <= a; i++ {
		sumA = 500 * i
		for j := 0; j <= b; j++ {
			sumB = 100 * j
			for k := 0; k <= c; k++ {
				sumC = 50 * k
				if sumA+sumB+sumC == x {
					count++
				}
			}
		}
	}
	fmt.Println(count)
}

Measured memory_bytes: 512
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
using namespace std;
signed main() {
  ios::sync_with_stdio(false); cin.tie(0);
  int n, m;
  cin >> n >> m;
  vector<int> a(m), b(m);
  for (int i = 0; i < m; i++) {
    cin >> a[i] >> b[i];
    a[i]--; b[i]--;
  }
  vector<int> v(n);
  vector<vector<int>> g(n);
  for (int i = 0; i < n; i++) {
    v[i] = i;
    g[i].push_back(i);
  }
  vector<long long> ans;
  ans.push_back(1LL * n * (n - 1) / 2);
  for (int i = m - 1; i > 0; i--) {
    int x = v[a[i]];
    int y = v[b[i]];
    ans.push_back(ans.back());
    if (x != y) {
      *prev(ans.end()) -= 1LL * g[x].size() * g[y].size();
      if (x < y) swap(x, y);
      for (int j : g[y]) v[j] = x;
      g[x].insert(g[x].end(), g[y].begin(), g[y].end());
      g[y].clear();
    }
  }
  reverse(ans.begin(), ans.end());
  for (int i = 0; i < m; i++) {
    cout << ans[i] << endl;
  }
  return 0;	  
}

Measured memory_bytes: 13428
#include<iostream>
using namespace std;
int main(){
	int n,p;
	while(cin>>n>>p){
		bool f=true;
		int d[55]={};
		int cn=p;
		if(n==0)break;
		while(f){
			for(int i=0;i<n;i++){
				if(cn>0){
					d[i]++;
					cn--;
				}
				else if(cn==0){
					cn=d[i];
					d[i]=0;
				}
				if(d[i]==p){
						cout<<i<<endl;
						f=false;
						break;
				}
			}
		}
	}
	return 0;
}

Measured memory_bytes: 1160
//-----------------------
// author : xyqkoala
// time : 2020-09-20
//-----------------------

#include<iostream>
#include<vector>
#include<string>
#include<deque>
#include<unordered_map>
#include<unordered_set>
#include<queue>
#include<algorithm>
#include<cmath>
#include<numeric>
using namespace std;

typedef long long LL;
const int MOD = 1e9+7;

void solve();


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


void solve(){
	string s;
	cin>>s;
	if(s.back()=='s'){
		cout<<s<<"es"<<endl;
	}else{
		cout<<s<<"s"<<endl;
	}
}


Measured memory_bytes: 3648
#include<stdio.h>
#include<string.h>

#define MID 1234567
#define LEFT 54

char H[MID][LEFT];

int Getchar(char);
int h1(int);
int h2(int);
int Insert(char[]);








long long Getkey(char str[]){
  long long goukei = 0, a = 1, i;
  for(i = 0 ; i < strlen(str) ; i++){
    goukei += a * (Getchar(str[i]));
    a *= 5;
  }
  return goukei;
}





int Find(char str[]){
  long long key, i, h;

  key = Getkey(str);
  for(i = 0 ; ; i++){
    h = (h1(key) + i * h2(key)) % MID;
    if(strcmp(H[h],str) == 0) return 1;
    else if(strlen(H[h]) == 0) return 0;
  }
  return 0;
}


int main(){
    int i=0, n, h;
    char str[LEFT], com[9];

    while(i<MID){
    H[i][0] = '\0';
    i++;
}
    scanf("%d", &n);
i=0;
    while(i<n){
      scanf("%s %s",com,str);

           if (com[0] == 'i'){
      Insert(str);
    }
    else{
      if (Find(str)) printf("yes\n");

      else printf("no\n");
    }
    i++;
  }

  return 0;
}

int Getchar(char c){
  if(c == 'A') return 1;
  else if(c == 'C') return 2;
  else if(c == 'G') return 3;
  else if(c == 'T') return 4;
  else return 0;
}






int h1(int x){
  return x % MID;
}

int h2(int x){
  return 1 + (x % (MID - 1));
}



int Insert(char str[]){
  long long k, i, h;

  k = Getkey(str);
  i=0;
  while(1){
    h = (h1(k) + i * h2(k)) % MID;
    if(strcmp(H[h],str) == 0) return 1;
    else if(strlen(H[h]) == 0){
      strcpy(H[h],str);
      return 0;
    }
    i++;
  }
  return 0;
}



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

void solve(std::istream &in, std::ostream &out);

int main() {
#ifdef LOCAL
  freopen("../IO/f.in", "r", stdin);
//  freopen("../IO/f.out", "w", stdout);
#else
  std::ios_base::sync_with_stdio(false);
  std::cin.tie(nullptr);
  std::cout.tie(nullptr);
#endif
  solve(std::cin, std::cout);
  return 0;
}


void solve(std::istream &in, std::ostream &out) {
  string s;
  in >> s;
  int n = s.size();
  const int P = 1'000'000'007;
  vector<int> a(3, 0);
  vector<vector<int>> b(4, vector<int>(n + 1));
  vector<int> ab(n + 1, 0);
  int ans = 0;
  for (int i = 0; i < n; ++i) {
    for (int j = 0; j < 4; ++j) b[j][i + 1] = b[j][i];

    (b[3][i + 1] += s[i] == '?') %= P;
    if (s[i] != '?') (b[s[i] - 'A'][i + 1] += 1) %= P;

    if (s[i] == 'A') {
      (a[0] += 1) %= P;
    } else if (s[i] == 'B') {
      (a[1] += a[0]) %= P;
    } else if (s[i] == 'C') {
      (a[2] += a[1]) %= P;
    }
    ab[i + 1] = a[1];
  }
  vector<int> p3(b[3][n] + 1, 1);
  for (int i = 1; i <= b[3][n]; ++i) {
    p3[i] = (int64_t) p3[i - 1] * 3 % P;
  }
  ans = (int64_t) a[2] * p3[b[3][n]] % P;
  fill(a.begin(), a.end(), 0);
  vector<int> bc(n + 1, 0);
  for (int i = n - 1; i >= 0; --i) {
    if (s[i] == 'C') {
      (a[0] += 1) %= P;
    } else if (s[i] == 'B') {
      (a[1] += a[0]) %= P;
    }
    bc[i] = a[1];
  }
  if (b[3][n] >= 3) {
    (ans += (int64_t) b[3][n] * (b[3][n] - 1) * (b[3][n] - 2) / 3 / 2 % P * p3[b[3][n] - 3] % P) %= P;
  }
  if (b[3][n] >= 2) {
    for (int i = 0; i < n; ++i) {
      if (s[i] == 'A') {
        int64_t k = b[3][n] - b[3][i];
        (ans += k * (k - 1) / 2 % P * p3[b[3][n] - 2] % P) %= P;
      } else if (s[i] == 'B') {
        int64_t k1 = b[3][i], k2 = b[3][n] - k1;
        (ans += k1 * k2 % P * p3[b[3][n] - 2] % P) %= P;
      } else if (s[i] == 'C') {
        int64_t k = b[3][i];
        (ans += k * (k - 1) / 2 % P * p3[b[3][n] - 2] % P) %= P;
      }
    }
  }
  if (b[3][n] >= 1) {
    for (int i = 0; i < n; ++i) {
      if (s[i] == '?') {
        int64_t k1 = b[0][i], k2 = b[2][n] - b[2][i];
        (ans += (int64_t) k1 * k2 % P * p3[b[3][n] - 1] % P) %= P;
        (ans += (int64_t) ab[i] * p3[b[3][n] - 1] % P) %= P;
        (ans += (int64_t) bc[i] * p3[b[3][n] - 1] % P) %= P;
      }
    }
  }
  out << ans << '\n';
}

Measured memory_bytes: 5984
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define endl '\n'
#define pb push_back
#define mp make_pair
#define SPEED ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define MOD 1000000007
signed main()
{
    SPEED;  
  	int x,i,j;
  	cin>>x;
  	for(i=1;i<=1000;++i)
    {
		for(j=-1000;j<=1000;++j)
        {
          if(powl(i,5)-powl(j,5)==x)
          {
            cout<<i<<" "<<j;
            return 0;
          }
        }
    }
}

Measured memory_bytes: 3648