akhauriyash/Code-Regression huggingface dataset:
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii =  pair<int, int>;
using pll =  pair<long long, long long>;
constexpr char ln =  '\n';
constexpr long long MOD = 1000000007LL;
constexpr long long INF = 1001001001LL;
#define all(x) (x).begin(),(x).end()
#define rep(i,n) for(int i=0;i<(n);i++)
#define fo(i, j, n) for(int i=(j); i<(n); i++)
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; }


int main() { 
   string s; cin >> s;
   map<char, vector<int>> mp;
   rep(i, s.size()) mp[s[i]].push_back(i);

   int a = -1, b = -1;
   for(auto m: mp){
       vector<int>& v = m.second;
       rep(i, v.size()-1){
           if(v[i+1]-v[i]<=2){
               a=v[i]+1, b=v[i+1]+1;
           }
       }
    }
    cout << a << " " << b << ln;
}








Measured memory_bytes: 1148
import java.io.IOException;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) throws IOException {

		Scanner scan = new Scanner(System.in);

		int M = scan.nextInt();

		System.out.println(24 - M + 24);
	}

	//***********************以下共通関数************************************************
	/**
	 * 文字列を反転して返す
	 * @param pStr 文字列
	 * @return 反転した文字列
	 */
	public static String myReverse(String pStr) {
		if (pStr.length() < 1) {
			return "";
		}

		StringBuffer sb = new StringBuffer(pStr);
		return sb.reverse().toString();
	}

	/**
	 * 余りを求める。
	 * @param a
	 * @param b
	 * @return 余り。余りがマイナスの時はプラスで返す。
	 */
	public static long myMod(long a, long b) {
		long ret = 0;

		ret = a % b;

		if (ret < 0) {
			ret += b;
		}

		return ret;
	}

	/**
	 * 乗数を求める ※mod対応
	 * @param kisu 基数
	 * @param josu 乗数
	 * @param primeNumMod_0 法 mod値 使わない場合は「0」
	 * @return
	 */
	public static long myPowWithMod(long kisu, long josu, long primeNumMod_0) {

		long ans = 1;

		//乗数が0の場合→1
		if (josu == 0)
			return 1;

		if (primeNumMod_0 == 0) {
			//modを使わないとき

			while (josu > 0) {

				if (josu % 2 == 0) {
					//累乗が偶数の時

					kisu *= kisu;
					josu = josu / 2;
				} else {
					//累乗が奇数の時
					ans *= kisu;
					josu--;
				}
			}

			return ans;

		} else {
			//modを使うとき

			//初めに桁を落とす
			kisu = myMod(kisu, primeNumMod_0);

			while (josu > 0) {

				if (josu % 2 == 0) {
					//累乗が偶数の時

					kisu *= myMod(kisu, primeNumMod_0);
					josu = josu / 2;

				} else {
					//累乗が奇数の時
					ans *= myMod(kisu, primeNumMod_0);
					josu--;

				}
			}

			return myMod(ans, primeNumMod_0);

		}

	}

}


Measured memory_bytes: 26960
n=int(input())
a=[int(i) for i in input().split()]
b=[int(i) for i in input().split()]
ans=0
for i in range(n):
    if a[i]>=b[i]:
        ans+=b[i]
    else:
        ans+=a[i]
        if b[i]-a[i]>=a[i+1]:
            ans+=a[i+1]
            a[i+1]=0
        else:
            ans+=b[i]-a[i]
            a[i+1]-=b[i]-a[i]

print(ans)

Measured memory_bytes: 19648
N=int(input())
A=[]
pairs=[]
for i in range(N):
    a=int(input())
    A.append(a)
    pair=[]
    for j in range(a):
        x,y=map(int,input().split())
        pair.append([x-1,y])
    pairs.append(pair)

def judge(bit):
    for i in range(N):
        if bit&(1<<i)==False: #決め打ち時に不親切の場合
            continue
        for j in range(A[i]): #親切な人の発言検証
            tmpx=pairs[i][j][0]
            tmpy=pairs[i][j][1]
            if tmpy==1  and (bit&(1<<tmpx)==False):
                return False
            if tmpy==0 and (bit&(1<<tmpx)):
                return False
    return True

ans=0
for bit in range((1<<N)):
    if judge(bit):
        count=0
        for i in range(N):
            if (bit&(1<<i)):
               count+=1
        ans=max(ans,count)

print(ans)

Measured memory_bytes: 3064
N, M = map(int, input().split())
AB = [list(map(int, input().split())) for _ in range(M)]

ab = sorted(AB, key=lambda x:x[1])

#print(ab)

count, last = 0, None
for a, b in ab:
	if not last:
		last = b
		count += 1
	if last <= a:
		last = b
		count += 1
print(count)


Measured memory_bytes: 30208
#include <iostream>
#include <cmath>
#include <climits>
#include <algorithm>
#include <list>
#include <queue>

using namespace std;
#define MAX 1000000
#define INF (INT_MAX/2)

vector<int> G[MAX];
list<int> out;
bool V[MAX];
int N;
int indeg[MAX];

void bfs(int s){
  queue<int> que;
  que.push(s);
  V[s] = true;
  while(!que.empty()){
    int u = que.front(); que.pop();
    out.push_back(u);
    for(int i = 0; i < G[u].size(); i++){
      int v = G[u][i];
      indeg[v]--;
      if(indeg[v] == 0 && !V[v]){
        V[v] = true;
        que.push(v);
      }
    }
  }
}

void topological_sort(){
  for(int i = 0; i < N; i++){
    indeg[i] = 0;
  }

  for(int u = 0; u < N; u++){
    for(int i = 0; i < G[u].size(); i++) indeg[G[u][i]]++;
  }

  for(int u = 0; u < N; u++) if(indeg[u] == 0 && !V[u]) bfs(u);

  for(list<int>::iterator it = out.begin(); it != out.end(); it++){
    cout << *it << endl;
  }
}

int main(void){
  ios_base::sync_with_stdio(0);
  int s, t, M;
  cin >> N >> M;

  for(int i = 0; i < N; i++) V[i] = false;

  for(int i = 0; i < M; i++){
    cin >> s >> t;
    G[s].push_back(t);
  }

  topological_sort();
  return 0;
}

Measured memory_bytes: 28256
#if !defined(__clang__) && defined(__GNUC__)
#include <bits/stdc++.h>
#else
#include <cstdlib>
#include <climits>
#include <iostream>
#include <cstdint>
#include <vector>
#include <string>
#include <complex>
#include <bitset>
#include <queue>
#include <deque>
#include <stack>
#include <utility>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <regex>
#endif //  !defined(__clang__) && defined(__GNUG__)
#include <boost/lexical_cast.hpp>
#include <boost/algorithm/string.hpp>
#include <boost/multi_array.hpp>
#include <boost/optional.hpp>
#include <boost/math/common_factor_rt.hpp>

using namespace std;




int main()
{
    int64_t H, W, N;
    std::cin >> H >> W >> N;

    std::map<std::pair<int64_t, int64_t>, int64_t> m;

    for (decltype(N) i = 0; i < N; ++i) {
        int64_t x, y;
        std::cin >> y >> x;
        x--; y--;

        for (int64_t dx = -2; dx <= 0; ++dx) {
            for (int64_t dy = -2; dy <= 0; ++dy) {
                auto xx = x + dx;
                auto yy = y + dy;
                if (0 <= xx && xx < W-2 && 0 <= yy && yy < H-2) {
                    m[std::make_pair(xx, yy)] += 1;
                }
            }
        }
    }

    std::vector<int64_t> ans(11);

    for (auto mm: m) {
        ans[mm.second]++;
    }

    std::cout << (H-2)*(W-2) - m.size() << std::endl;
    for (size_t i = 1; i <= 9; ++i) {
        std::cout << ans[i] << std::endl;
    }

    return 0;
}


Measured memory_bytes: 56448
#!/usr/bin/env python3

import sys
sys.setrecursionlimit(300000)


def solve(N: int):
    ret = (N + 1) // 2 
    print(ret)
    return

def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    solve(N)

if __name__ == '__main__':
    main()


Measured memory_bytes: 3316
/*A - Harmony*/
#include <bits/stdc++.h>

using namespace std;

int main(){

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

	int ans = 0;
	int a;
	int b;

	cin >> a >> b;

	int lim = 1000000000;

	for (int i = 1; i <= lim; ++i)
	{
		if( abs(a - i) == abs(b - i)){
			ans = i;
			break;
		}
	}

	if(ans)
		cout << ans;
	else
		cout << "IMPOSSIBLE";

	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N=2e6+6;
const ll MOD=1e9+7;
const int Seed=1e7+7;
template <class T>
bool sf(T &ret){ //Faster Input
    char c; int sgn; T bit=0.1;
    if(c=getchar(),c==EOF) return 0;
    while(c!='-'&&c!='.'&&(c<'0'||c>'9')) c=getchar();
    sgn=(c=='-')?-1:1;
    ret=(c=='-')?0:(c-'0');
    while(c=getchar(),c>='0'&&c<='9') ret=ret*10+(c-'0');
    if(c==' '||c=='\n'){ ret*=sgn; return 1; }
    while(c=getchar(),c>='0'&&c<='9') ret+=(c-'0')*bit,bit/=10;
    ret*=sgn;
    return 1;
}
ll a[N];
int main(){
    int n,x;
    sf(n);sf(x);
    for(int i=1;i<=n;i++)   sf(a[i]);
    n++;a[n]=x;
    sort(a+1,a+1+n);
    ll ans=0;
    for(int i=2;i<=n;i++){
        ans=__gcd(ans,a[i]-a[i-1]);
    }
    cout << ans << endl;
//    int index;
//    for(int i=1;i<=n;i++){
//        if(a[i]==x){
//            index=i;break;
//        }
//    }


    return 0;
}


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

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

    vector<int> A(N);
    rep(i,N) {
        cin >> A.at(i);
    }

    int total = 0;
    rep(i,N) {
        total += A.at(i);
    }
  
    //cout << total << endl;

    sort(A.begin(),A.end());
    reverse(A.begin(),A.end());

    int cnt = 0;
    //int check = 0;

    double num = (double)(total)/(4*M);
  	//cout << num << endl;

    rep(i,N) {
        if(A.at(i)>=num) {
        	//cout << A.at(i) << endl;
            cnt += 1;
        } else {
        break;  
        }
      
        if(cnt==M) {
            break;
        }  
    }

    if(cnt==M) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }

}

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

LL w = 1e9 + 7;

LL RepeatSquaring(LL N, LL P, LL M){
    if(P==0) return 1;
    if(P%2==0){
        LL t = RepeatSquaring(N, P/2, M);
        return t*t % M;
    }
    return N * RepeatSquaring(N, P-1, M);
}

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


LL comb(LL n,LL a){
	LL ans = 1;
	LL wari = 1;
	for(LL i=n;i>=n-a+1;i--){
		ans = ans * i % w;
	}
	for(LL i=1;i<=a;i++){
		wari = wari * i % w;
	}
	return ans*modinv(wari,w)%w;
}

int main(){
	// sengen
	LL n,a,b,ans = 1;
	// nyuryoku
	cin >> n >> a >> b;
	// keisan
	if(n == 2){
		cout << '0' << endl;
		return 0;
	}
	ans = RepeatSquaring(2,n,w);
	ans = ans -1 - comb(n,a) - comb(n,b);
	ans %= w;
	if(ans < 0) ans += w;
	
	// syutsuryoku
	cout << ans << endl;
}

Measured memory_bytes: 3572
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String a = sc.nextLine();
		String b = a + a;
		String c = sc.nextLine();
		if (b.contains(c))
			System.out.println("Yes");
		else
			System.out.println("No");

	}
}


Measured memory_bytes: 26260
import java.util.*

fun main(args: Array<String>) {
	val (n, t) = readLine()!!.split(" ").map { it.toLong() }
	val arr = readLine()!!.split(" ").map { it.toLong() }
	var ans = 0L
	var fin = 0L
	for (v in arr) {
		if (v <= fin) {
			val diff = fin - v
			ans += (t - diff)
			fin = v + t
		} else {
			ans += t
			fin = v + t
		}
	}
	println(ans)
}


Measured memory_bytes: 83348
import java.util.*;
public class Main{
    public static void main(String[]args){
        Scanner scan = new Scanner(System.in);
        scan.useDelimiter("\\s");
        int a = scan.nextInt();
        int b = scan.nextInt();
        if(a<b){
        System.out.println("a < b");
        }else if (a>b){
            System.out.println("a > b");
        }else {
            System.out.println("a == b");
        }
    }
}


Measured memory_bytes: 26180
#include<stdio.h>

#define MOD 1000000007

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

    long long int sum=0;
    long long int initial=0;
    for(int i=0;i<n-1;i++){
        initial+=a[i]%MOD;
        sum+=(initial%MOD)*(a[i+1]%MOD);
        sum%=MOD;
    }
    printf("%lld\n",sum);
    return 0;
}

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

int main(){
  string sa,sb,sc;
  cin >> sa >> sb >> sc;
  reverse(sa.begin(),sa.end());
  reverse(sb.begin(),sb.end());
  reverse(sc.begin(),sc.end());
  char next='a';
  while(true){
    if(next=='a'){
      if(sa.length()==0){
        cout << 'A';
        break;
      }
      next=sa[sa.length()-1];
      sa.pop_back();
    }
    if(next=='b'){
      if(sb.length()==0){
        cout << 'B';
        break;
      }
      next=sb[sb.length()-1];
      sb.pop_back();
    }
    if(next=='c'){
      if(sc.length()==0){
        cout << 'C';
        break;
      }
      next=sc[sc.length()-1];
      sc.pop_back();
    }
  }
}
      



Measured memory_bytes: 256
N=int(input())
S=list()
for i in range(N):
  S.append(input())
M=int(input())
T=list()
for i in range(M):
  T.append(input())
ans=0
for i in S:
  v=S.count(i)-T.count(i)
  if v>ans:
    ans=v
print(ans)

Measured memory_bytes: 9180
#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 pair<ll,ll> pll;

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 DEBUG_VEC(v) cout<<#v<<":";REP(i,v.size())cout<<" "<<v[i];cout<<endl
#define ALL(a) (a).begin(),(a).end()

#define CHMIN(a,b) a=min((a),(b))
#define CHMAX(a,b) a=max((a),(b))

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

// floating
typedef double Real;
const Real EPS = 1e-11;
#define EQ0(x) (abs(x)<EPS)
#define EQ(a,b) (abs(a-b)<EPS)
typedef complex<Real> P;

int main(){
  int a,b,c;
  cin>>a>>b>>c;
  cout<<(a+b+c-max({a,b,c}))<<endl;
  return 0;
}


Measured memory_bytes: 256
#!/usr/bin/env python3
import sys


def solve(N: int):
    counter = 0
    for i in range(1, N+1):
        if (i % 3 != 0) and (i % 5 != 0):
            counter += i
    print(counter)
    return


# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    solve(N)

if __name__ == '__main__':
    main()

Measured memory_bytes: 72680
MOD=10**9+7
N,M=map(int,input().split())

def invmod(a):
  return pow(a,MOD-2,MOD)

fact_list=[1]
fact_inv_list=[1]
for i in range(1,M+1):
  fact_mod=(fact_list[-1]*i)%MOD
  fact_list.append(fact_mod)
  fact_inv_list.append(invmod(fact_mod))
def comb_mod_table(n,r):
  if 0<=r<=n:
    return fact_list[n]*fact_inv_list[r]*fact_inv_list[n-r]
  else:
    return 0
def perm_mod_table(n,r):
  if 0<=r<=n:
    return fact_list[n]*fact_inv_list[n-r]
  else:
    return 0
  
answer=0
for i in range(N+1):  
  term=comb_mod_table(N,i)*pow(-1,i)*perm_mod_table(M,i)*perm_mod_table(M-i,N-i)*perm_mod_table(M-i,N-i)
  answer=(answer+term)%MOD
  
print(answer)

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


#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(long long int i=0;i<(n);++i)
typedef long long int ll;

class DChatInACircle {
public:
	void solve(std::istream& in, std::ostream& out) {
        int n;
        in >> n;
        vector<ll> a(n);
        rep(i,n){
            in >> a[i];
        }
        sort(a.begin(),a.end(),greater<ll>());
        ll ans = a[0];
        for(int i=2;i<=n-1;i++){
            ans+=a[i/2];
        }
        out << ans << endl;
	}
};


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


Measured memory_bytes: 4824
// This amazing code is by Eric Sunli Chen.
#include <algorithm>
#include <bitset>
#include <cmath>
#include <cstring>
#include <cstdio>
#include <cstdlib>
#include <ctime>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <utility>
#include <vector>
using namespace std;
template<typename T> bool get_int(T &x)
{
	char t=getchar();
	bool neg=false;
	x=0;
	for(; (t>'9'||t<'0')&&t!='-'&&t!=EOF; t=getchar());
	if(t=='-')neg=true,t=getchar();if(t==EOF)return false;
	for(; t<='9'&&t>='0'; t=getchar())x=x*10+t-'0';
	if(neg)x=-x;return true;
}
template<typename T> void print_int(T x)
{
	if(x<0)putchar('-'),x=-x;
	short a[20]= {},sz=0;
	while(x>0)a[sz++]=x%10,x/=10;
	if(sz==0)putchar('0');
	for(int i=sz-1; i>=0; i--)putchar('0'+a[i]);
}
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define get1(a) get_int(a)
#define get2(a,b) (get1(a)&&get1(b))
#define get3(a,b,c) (get1(a)&&get2(b,c))
#define printendl(a) print_int(a),puts("")
typedef long long LL;
typedef unsigned long long uLL;
typedef pair<int,int> pii;
const int inf=0x3f3f3f3f;
const LL Linf=1ll<<61;
const double pi=acos(-1.0);

struct SGT
{
	int mx[600111];
#define lson (t<<1)
#define rson ((t<<1)|1)
	void clear(){for(int i=0;i<600111;i++)mx[i]=-inf;}
	SGT(){clear();}
	void maxi(int ql,int qr,int v,int l,int r,int t=1)
	{
		if(ql>r||l>qr)return;
		if(ql<=l&&r<=qr){mx[t]=max(mx[t],v);return;}
		int mid=(l+r)>>1;
		maxi(ql,qr,v,l,mid,lson);maxi(ql,qr,v,mid+1,r,rson);
	}
	int query(int p,int l,int r,int t=1)
	{
		if(l==r)return mx[t];
		int mid=(l+r)>>1,ret=mx[t];
		if(p<=mid)ret=max(ret,query(p,l,mid,lson));
		else ret=max(ret,query(p,mid+1,r,rson));
		return ret;
	}
}sgt;
int n,b[200111],pre[200111],q,dp[200111];
vector<int> qs[200111];
int main()
{
	get1(n);
	for(int i=1;i<=n;i++)
	{
		get1(b[i]);
		pre[i]=pre[i-1]+b[i];
	}
	get1(q);
	for(int i=1,l,r;i<=q;i++)
	{
		get2(l,r);
		qs[r].pb(l);
	}
	for(int i=1;i<=n;i++)
	{
		sort(qs[i].begin(),qs[i].end());reverse(qs[i].begin(),qs[i].end());
		dp[i]=dp[i-1]+(b[i]==0);
		for(auto v:qs[i])
		{
			int cur=max(sgt.query(v,1,n,1),dp[v-1]-pre[v-1]);
			dp[i]=max(dp[i],cur+pre[i]);
			sgt.maxi(v+1,min(n,i+1),cur,1,n,1);
		}
	}
	printendl(n-dp[n]);
	return 0;
}

Measured memory_bytes: 15104
#include <iostream>
using namespace std;
int main(void){
    int a,b,c,d,e;
    cin>>a>>b>>c>>d>>e;
    if(a<0){
        cout<<b*e+d-(a*c)<<endl;
    }
    else{
        cout<<b*e-a*e<<endl;
    }
}


Measured memory_bytes: 3116
#include<bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define sz(a) (a).size() 
#define all(c) (c).begin(),(c).end()
#define rep(i,n) for(int i=0;i<n;i++)
#define forn(i,n) for(int i=1;i<=n;i++)
#define ford(i,n) for(int i=n;i>=0;i--) 
#define REP(i,a,n) for(int i=a;i<n;i++)
#define foreach(itr,c) for(__typeof((c).begin(),(c).end())itr=c.begin();itr!=c.end();itr++) 
#define fill(a,b) memset(a,b,sizeof(a))
#define re return
#define INF 1e9
#define LINF 1e18
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pi;
typedef vector<int> vi;
typedef vector<pi > vpi; 
int main(){
	string s,t;
	cin>>s>>t;
	int ans=INF,cnt=0;
	for(int i=0;i+t.size()<=s.size();i++){
		cnt=0;
		for(int j=0;j<t.size();j++){
			if(s[i+j]!=t[j]){
				cnt++;
			}
		}
		ans=min(ans,cnt);
	}
	cout<<ans;
	re 0;
}

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

#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;

#define ll          long long
#define pb          push_back
#define vi          vector<ll int>
#define all(a)      (a).begin(),(a).end()
#define F           first
#define S           second
#define rs(v,n)     v.resize(n)
#define hell        1000000007
#define peak        9123372036854775807
#define pii         acos(-1)
#define clr(a,x)    memset(a,x,sizeof(a))
#define ios         ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
using namespace std;
template<typename T>
using ordered_set = tree<T,null_type,less<T>,rb_tree_tag,tree_order_statistics_node_update>;
template<class x,class y> x sum(x a,y b){return a+b;}
template<class x,class y> x mul(x a,y b){return a*b;}
template<class x,class y> x sub(x a,y b){return a-b;}
template<class x,class y> x divi(x a,y b){return a/b;}

template<class x,class y>
istream &operator>>(istream &in,pair<x,y> &p) 
{ 
    in>>p.F>>p.S;
    return in;
}
template<class x>
istream &operator>>(istream &in,vector<x> &v) 
{
    for(auto& i:v)
        in>>i;
    return in;
}
template<class x,class y>
ostream &operator<<(ostream &out,pair<x,y> &p) 
{ 
    out<<"("<<p.F<<","<<p.S<<") ";
    return out; 
}
template<class x>
ostream &operator<<(ostream &out,vector<x> &v) 
{ 
    out<<v.size()<<endl;
    for(auto i:v)
        out<<i<<" ";
    out<<endl;
    return out; 
}
#define N  1000005

int main()
{
    ios;
    ll tt=1;
    // cin>>tt;
    while(tt--)
    {
    	ll i,j,k,l,r,m,n;
    	ll a,b;
    	cin>>l>>r>>a>>b;
    	ll tot=r-l+1;
    	ll diva=(r/a)-((l-1)/a);
    	ll divb=(r/b)-((l-1)/b);
    	ll x=(a*b)/(__gcd(a,b));
    	ll divx=(r/x)-((l-1)/x);
    	ll ans=tot-diva-divb+divx;
    	cout<<ans;
    }
    return 0;
}

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

int main() {
    int N; cin >> N;
    map<int, int> m;
    ll ans1=0, ans2=0;
    for (int i = 0; i < N; i++){
        ll a; cin >> a;
        m[a]++;
        if(m[a]==2){
            m[a] = 0;
            if(a>ans1) swap(a,ans1);
            if(ans1>ans2) swap(ans1, ans2);
        }
    }

    cout << ans1 * ans2 << endl;
}

Measured memory_bytes: 4992
#include <bits/stdc++.h>
using namespace std;
#define REP(i,n) for(int i=0; i<(n); i++)
#define REP2(i,x,n) for(int i=x; i<(n); i++)
#define ALL(n) begin(n),end(n)
struct cww{cww(){ios::sync_with_stdio(false);cin.tie(0);}}star;
const long long INF = numeric_limits<long long>::max();
int main()
{
    int N, M, X, Y;
    cin >> N >> M >> X >> Y;
    vector<int> x( N ), y( M );
    for( auto &a : x )
    {
        cin >> a;
    }
    for( auto &b : y )
    {
        cin >> b;
    }
    int xmax = *max_element( ALL( x ) ), ymin = *min_element( ALL( y ) );
    REP( i, 100 )
    {
        if( i > xmax && i <= ymin )
        {
            if( X < i && i <= Y )
            {
                cout << "No War" << endl;
                return 0;
            }
        }
    }
    cout << "War" << endl;
    return 0;
}

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

int n, a, b, h[100000];
ll inf = 0, sup = 1e9, mid, c;

int main() {
	cin >> n >> a >> b;
	a -= b;
	for (int i = 0; i < n; ++i)
		cin >> h[i];
	while (sup - inf > 1) {
		mid = (inf + sup) / 2;
		c = 0;
		for (int i = 0; i < n; ++i)
			c += (max(0ll, h[i] - b * mid) + a - 1) / a;
		if (c <= mid)
			sup = mid;
		else
			inf = mid;
	}
	cout << sup << endl;
}

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

int main() {
  int n, h=0;
  cin >> n;
  unsigned long long int ans=1;
  for(int i=0;i<n;i++){
    unsigned long long int a;
    cin >> a;
    if(a==0){
      cout << 0 << endl;
      return 0;
    }
    if(ans>1000000000000000000/a){
      h=1;
    }
    ans *= a;
  }
  if(h==1){
        cout << -1 << endl;
      return 0;
  }
  else if(h==0)
    cout << ans << endl;
}


Measured memory_bytes: 3604
#include <iostream>
#include <iomanip>
#include <vector>
#include <set>
#include <string>
#include <queue>
#include <algorithm>
#include <map>
#include <cmath>
#include <numeric>
#include <list>
#include <stack>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <tuple>
#include <deque>
#include <complex>

using namespace std;

/*
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int, int> pii;
typedef vector<pii> vpii;
*/

typedef long long ll;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef pair<long long, long long> pll;
typedef vector<pll> vpll;

typedef long double ld;
typedef vector<ld> vld;

typedef vector<bool> vb;

#define rep(i, n) for (ll i = 0; i < (n); i++)
#define reps(i, n) for (ll i = 1; i <= (n); i++)
#define rrep(i, n) for (ll i = (n) - 1; i >= 0; i--)
#define rreps(i, n) for (ll i = (n); i >= 1; i--)
#define all(v) (v).begin(), (v).end()

template <class T> void chmin(T& a, T b) { a = min(a, b);}
template <class T> void chmax(T& a, T b) { a = max(a, b);}

constexpr int INF = 1 << 30;
constexpr ll INFL = 1LL << 60;
constexpr ll MOD = 1000000007;
constexpr ld EPS = 1e-12;
ld PI = acos(-1.0);

void get_enum(vll& a, vpll& va) {
    for(ll i = 0; i < (1ll << a.size()); i++) {
        ll sa = 0;
        for(ll j = 0; j < a.size(); j++) {
            if(!(i & (1ll << j))) continue;
            sa += a[j];
        }
        va.push_back(make_pair(__builtin_popcountl(i), sa));
    }
    return;
}

void solve() {
    ll n, k, l, r;
    cin >> n >> k >> l >> r;
    vll a, b;
    for(ll i = 0; i < n; i++) {
        ll t; cin >> t;
        if(i < n / 2) a.push_back(t);
        else b.push_back(t);
    }
    vpll va, vb;
    get_enum(a, va);
    get_enum(b, vb);
    sort(va.begin(), va.end());
    ll ans = 0;
    for(auto p : vb) {
        ll kb = p.first, sb = p.second;
        ll il = lower_bound(va.begin(), va.end(), make_pair(k - kb, l - sb)) - va.begin();
        ll ir = upper_bound(va.begin(), va.end(), make_pair(k - kb, r - sb)) - va.begin();
        ans += ir - il;
    }
    cout << ans << endl;
    return;
}

int main() {
    std::cin.tie(nullptr);
    std::ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    solve();
}


Measured memory_bytes: 43780
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize("unroll-loops")
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<math.h>
#include<iomanip>
#include<set>
#include<numeric>
#include<cstring>
#include<cstdio>
#include<functional>
#include<bitset>
#include<limits.h>
#include<cassert>
#include<iterator>
#include<complex>
#include<stack>
#include<unordered_map>
#include<unordered_set>
#include<time.h>
#include<random>

using namespace std;

#define REP(i, n) for(int i = 0;i < n;++i)
#define REPR(i, n) for(int i = n-1;i >= 0;--i)
#define FOR(i, m, n) for(int i = m;i < n;++i)
#define FORR(i, m, n) for(int i = m-1;i >= n;--i)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define REVERSE(v,n) reverse(v,v+n);
#define VREVERSE(v) reverse(v.begin(), v.end())
//#define ll long long
#define pb(a) push_back
#define print(x) cout<<(x)<<endl
#define pe(x) cout<<(x)<<" "
#define DEBUG(x) cout<<#x<<": "<<x<<endl
#define lb(v,n) lower_bound(v.begin(), v.end(), n)
#define ub(v,n) upper_bound(v.begin(), v.end(), n)
//#define int long long
#define all(x) (x).begin(), (x).end()
#define print_space(v) REP(i,v.size())cout << v[i] << ((i == v.size() - 1) ? "\n" : " ")
template<typename T1, typename T2> inline void chmin(T1 & a, T2 b) { if (a > b) a = b; }
template<typename T1, typename T2> inline void chmax(T1& a, T2 b) { if (a < b) a = b; }
typedef pair<int, int>P;
const int MOD = 1e9 + 7; const int MAX = 200020;
const double pi = acos(-1); const double EPS = 1e-12;
const int INF = 1e9;
int dx[4] = { 0,0,-1,1 }, dy[4] = { 1,-1,0,0 };

int H, W;
int dp[303][303];
vector<int>v[2][303];
int calc(const string &S,const string &T) {
	REP(i, 2)REP(j, H)v[i][j].clear();
	REP(i, H) {
		FOR(j, i, H) {
			if (S[i] == T[j]) {
				v[0][j - i].push_back(H - i - 1);
			}
		}
	}
	REP(j, H) {
		FOR(i, j, H) {
			if (T[j] == S[i]) {
				v[1][i - j].push_back(H - j - 1);
			}
		}
	}
	REP(i, H) {
		VSORT(v[0][i]);
		VSORT(v[1][i]);
	}
	REP(i, H + 1) {
		REP(j, H + 1)dp[i][j] = INF;
	}
	dp[0][0] = 0;
	REP(i, H + 1)REP(j, H + 1) {
		if (i >= j) {
			int cnt = 0;
			int M = v[0][i - j].size();
			cnt = v[0][i - j].end() - lb(v[0][i - j], i);
			dp[i + 1][j] = min(dp[i + 1][j], dp[i][j] + cnt);
			dp[i][j + 1] = min(dp[i][j + 1], dp[i][j] + cnt);
		}
		else {
			int cnt = 0;
			cnt = v[1][j - i].end() - lb(v[1][j - i], j);
			dp[i + 1][j] = min(dp[i + 1][j], dp[i][j] + cnt);
			dp[i][j + 1] = min(dp[i][j + 1], dp[i][j] + cnt);
		}
	}
	return dp[H][H];
}
char C[303][303];
string S[303];
void solve() {
	cin >> H >> W;
	REP(i, H)REP(j, W) {
		cin >> C[i][j];
		S[j] += C[i][j];
	}
	int ans = 0;
	REP(j, W - 1) {
		//print(calc(S[j], S[j + 1]));
		ans += calc(S[j], S[j + 1]);
	}
	print(ans);
}

signed main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	//int q;cin>>q;
	//while(q--)
	solve();
}




Measured memory_bytes: 1408
#include <bits/stdc++.h>
using namespace std;
int main() {
  int N,count = 0;
  cin >> N;
  vector<int> p(N);
  for(int i = 0; i < N; i++) {
    cin >> p.at(i);
  }
  for(int i = 0; i < N; i++) {
    p.at(i) = p.at(i) - (i + 1);
    if(p.at(i) != 0) {
      count = count + 1;
    }
  }
  if(count == 2 || count == 0) {
    cout << "YES" << endl;
  }
  else {
    cout << "NO" << endl;
  }
  
}


Measured memory_bytes: 256
import sys
sys.setrecursionlimit(10**9)
import math

X = int(input())
def f(N):
    ret = int(math.floor(N*1.08))
    return ret

r = 5*10**4+1
l = 0
while (r-l)>1:
    mid = (r+l)//2
    ret = f(mid)
    if ret > X:
        r = mid
    elif ret == X:
        print(mid)
        exit()
    else:
        l = mid

print(":(")

Measured memory_bytes: 38384
import bisect
# python template for atcoder1
import sys
sys.setrecursionlimit(10**9)
input = sys.stdin.readline

key_R = []
S = input()[:-1]
prev = ""
for i, c in enumerate(S):
    if prev == "R" and c == "L":
        prev = c
        key_R.append(i-1)
    else:
        prev = c

ans = [0]*len(S)
for i, c in enumerate(S):
    if c == "R":
        ind = bisect.bisect_left(key_R, i)
        val = key_R[ind]
        if (val-i) % 2 == 0:
            ans[val] += 1
        else:
            ans[val+1] += 1
    else:  # c=="L"
        ind = bisect.bisect_left(key_R, i)-1
        val = key_R[ind]
        if (i-val) % 2 == 0:
            ans[val] += 1
        else:
            ans[val+1] += 1

print(*ans)


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

int main()
{
	int n, runner, out, score;
	string s;
	cin>>n;
	runner = 0;
	out = 0;
	score = 0;
	while (cin>>s) {
		if (s=="HIT") runner++;
		if (s=="OUT") out++;
		if (s=="HOMERUN") {
			score += runner+1;
			runner = 0;
		}
		if (out==3) {
			if (runner >= 4) score += runner-3;
			cout<<score<<endl;
			runner = 0;
			out = 0;
			score = 0;
		}
	}

	return 0;
}

Measured memory_bytes: 0
// D - Patisserie ABC
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rp(i,s,e) for(int i=(s);i<(e);++i)

int main(){
	int N,M; cin>>N>>M;
	vector<ll> X(N),Y(N),Z(N), S(N);
	rp(i, 0, N) cin>>X[i]>>Y[i]>>Z[i];
	ll ans = 0;
	rp(bits, 0, 8){
		rp(i, 0, N) S[i] = X[i]*(bits&1?1:-1) + Y[i]*(bits&2?1:-1) + Z[i]*(bits&4?1:-1);
		sort(S.rbegin(), S.rend());
		ll s = 0; rp(i, 0, M) s += S[i];
		ans = max(ans, s);
	}
	cout<< ans <<endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	string s;
	cin>>s;
	long ans=0;
	char ch='R';
	long count=0;
	for(int i=0;i<3;i++){
		if(s[i]==ch){
			count++;
		}else{
			ans=max(ans,count);
			count=0;
		}
	}
	ans=max(ans,count);
	cout<<ans<<"\n";
}

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

#define ll long long
#define vvi vector<vector<int>>
#define vec vector
#define pq priority_queue
#define all(v) (v).begin(), (v).end()
#define uniqueV(x) sort(x.begin(), x.end()); x.erase(unique(x.begin(), x.end()), x.end());
#define rep(i, n) for (int (i) = (0); (i) < (n); ++(i))
#define repp(i, m, n) for (int (i) = (m); (i) < (n); ++(i))
#define debug(x) cerr << #x << ": " << x << endl;
#define debug2(x, y) cerr<<"("<<#x<<", "<<#y<<") = "<<"("<<x<<", "<<y<<")"<<endl;
#define debug3(x, y, z) cerr<<"("<<#x<<", "<<#y<<", "<<#z<<") = "<<"("<<x<<", "<<y<<", "<<z<<")"<<endl;
#define debugB(value, size) cerr<<#value<<": "<<bitset<size>(value) << endl;
#define line() cerr << "---------------" << endl;

const int dx[] = {1, -1, 0, 0};
const int dy[] = {0, 0, -1, 1};
const double PI = 3.14159265358979323846;

template<typename T>
void printA(vector<T> &printArray, char between = ' ') {
   int paSize = printArray.size();
   for (int i = 0; i < paSize; i++) { cerr << printArray[i] << between;}
   if (between != '\n') {cerr << endl;}
}

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

int N;
int C[555], S[555], F[555];

int main() {
   cin >> N;
   rep (i, N-1) {
      cin >> C[i] >> S[i] >> F[i];
   }

   rep (i, N) { // スタート
      int t = 0; // 今の時間
      repp (j, i, N-1) {
         if (t < S[j]) {
            t = S[j];
         } else if (t % F[j] == 0) {

         } else {
            t = t + F[j] - t % F[j];
         }
         t += C[j];
      }
      cout << t << endl;
   }

   return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cassert>
#include <functional>
#include <algorithm>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <stack>
using namespace std;
using llong = long long;

llong n, k;

int main() {
    cin >> n >> k;

    cout << min(n % k, llabs(k - n % k)) << endl;

    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define pb push_back
int main()
{
    int k;
    cin>>k;
    string s;
    cin>>s;
    if(s.size()<=k)
        cout<<s;
    else
    {
        for(int i=0;i<k;i++)
            cout<<s[i];
        cout<<"...";
    }
}   


Measured memory_bytes: 3624
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
// #define int long long

template <class T>
bool INRANGE(T x, T a, T b) { return a <= x && x <= b; }
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;
}

#define REP(i, n) for (int i = 0; i < (n); ++i)
#define RREP(i, n) for (int i = (n); i >= 0; --i)
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define RFOR(i, a, b) for (int i = (a); i >= (b); --i)
#define ALL(v) (v).begin(), (v).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" \
                      << " " << __FILE__ << endl;

typedef vector<int> vi;
typedef vector<string> vs;
typedef vector<vi> vvi;
typedef pair<int, int> pii;

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

    char a;
    cin >> a;

    int n = (int) a;
    if (INRANGE(n, 65, 90)) cout << "A" << endl;
    else cout  << "a" << endl;

    return 0;
}


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

//#define int long long
typedef long long ll;
const int INF = 2e9;
//const ll INF = 9e18;


signed main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int D;
    cin >> D;
    vector<int> c(26);
    for (int i=0;i<26;i++) cin >> c[i];
    vector<vector<int>> s(D,vector<int>(26));
    for (int i=0;i<D;i++){
        for (int j=0;j<26;j++){
            cin >> s[i][j];
        }
    }
    vector<int> t(D);
    //初期t[i]の決定
    for (int i=0;i<D;i++) {
        t[i] = i % 26;
    }

    ll oldsum = -INF;
    for (int m=0;m<100000;m++){
        //ここでt[i]を更新していく
        int dd = rand()%D;
        int mx = 0;
        int qq = 0;
        for (int i=0;i<26;i++){
            if (s[dd][i] > mx){
                mx = s[dd][i];
                qq = i;
            }
        }
        int oldval = t[dd];
        t[dd] = qq;
        //=======================
        ll sum = 0;
        vector<int> last(26);
        for (ll i=0;i<D;i++){
            sum += s[i][t[i]];
            last[t[i]] = i+1;
            for (int j=0;j<26;j++){
                sum -= c[j]*(i+1-last[j]);
            }
        }
        if (sum > oldsum) {
            oldsum = sum;
        } else {
            t[dd] = oldval;
        }
    }
    for (int i=0;i<D;i++){
        cout << t[i]+1 << "\n";
    }
}

Measured memory_bytes: 3696
N = int(input())
S = [int(input()) for _ in range(N)]

su = sum(S)
if su % 10 != 0:
    print(su)
else:
    T = [s for s in S if s % 10 != 0]
    if len(T) == 0:
        print(0)
    else:
        print(su - min(T))


Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define INF 1LL<<62
#define inf 1000000007

int main() {
	string s,t,u;
	ll a,b;
	cin>>s>>t>>a>>b>>u;
	if(u==s){
		a--;
	}
	else{
		b--;
	}
	cout << a<<" "<<b;
	// your code goes here
	return 0;
}

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

struct Trip { int a, b; };

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

bool operator>(const Trip &a, const Trip &b)
{
    if(a.a == b.a) {
        return a.b < b.b;
    } else {
        return a.a > b.a;
    }
}

int main()
{
    int n, m;
    while(cin >> n >> m && n && m) {
        
        vector<Trip> vp(m);
        for(int i = 0; i < m; i++)
            vp[i] = (Trip){0, i + 1};

        int k;
        for(int j = 0; j < n; j++) {
            for(int i = 0; i < m; i++) {
                cin >> k;
                vp[i].a += k;
            }
        }

        stable_sort(vp.begin(), vp.end(), greater<Trip>());
        for(int i = 0; i < m; i++) {
            cout << vp[i].b;
            if(i != m - 1)
                cout << " ";
        }
        cout << endl;
    }
}

Measured memory_bytes: 916
#include<cstdio>
#include<cstring>
#include<vector>
#include<queue>
#include<algorithm>
#include<cmath>
#include<climits>
#include<string>
#include<set>
#include<map>
#include<iostream>
using namespace std;
#define rep(i,n) for(int i = 0;i<((int)(n));i++)
#define reg(i,a,b) for(int i = ((int)(a));i<=((int)(b));i++)
#define irep(i,n) for(int i = ((int)(n)-1);i>=0;i--)
#define ireg(i,a,b) for(int i = ((int)(b)-1);i>=((int)(a));i--)
typedef long long int lli;
typedef pair<int, int> mp;
#define fir first
#define sec second
#define IINF INT_MAX
#define LINF LLONG_MAX
#define eprintf(...) fprintf(stderr,__VA_ARGS__)
#define pque(type) priority_queue<type,vector<type>,greater<type> >
#define memst(a,b) memset(a,b,sizeof(a))

int main(void){
	int w,a,b; cin >> w >> a >> b;
	
	if(a+w < b) cout << b-a-w << endl;
	else if(b+w < a) cout << a-b-w << endl;
	else cout << 0 << endl;
	
	return 0;
}

Measured memory_bytes: 256
// Created by Nandu Vinodan
#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 rep(i,a,n) for(int i=a;i<=(n);++i)
#define repD(i,a,n) for(int i=a;i>=(n);--i)
#define pb(a) push_back(a)
#define eb(a) emplace_back(a)
#define vi vector<int>
#define pi pair<int, int>
#define INF INT_MAX
#define _INF INT_MIN
#define TC 0

using namespace std;
using ll = long long;


int v[33] = {0, 1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
void testcase() {
    int k; cin >> k;

    cout << v[k] << "\n";
}

int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int t=1;
    if (TC)
        cin>>t;
    while(t--) {
        testcase();
    }
    return 0;
}

Measured memory_bytes: 256
/*
　　　  ∧＿∧　やあ
　　 （´・ω・｀)　　　　　/　　　　　ようこそ、バーボンハウスへ。
　　 ／∇y:::::＼　　　 [￣]　　　　　このテキーラはサービスだから、まず飲んで落ち着いて欲しい。
　　 |:⊃:|:::::|　　　|──|
￣￣￣￣￣￣￣￣￣￣￣￣￣￣￣￣￣|　うん、「また」なんだ。済まない。
￣￣￣￣￣￣￣￣￣￣￣￣￣￣￣|￣　  仏の顔もって言うしね、謝って許してもらおうとも思っていない。
￣￣￣￣￣￣￣￣￣￣￣￣￣￣／|
　　　　∇　∇　∇　∇　　　／.／|　　　でも、この提出を見たとき、君は、きっと言葉では言い表せない
　　　　┴　┴　┴　┴　／ ／　  |　　　「ときめき」みたいなものを感じてくれたと思う。
￣￣￣￣￣￣￣￣￣￣|／　　  |　　　殺伐としたコンテストの中で、そういう気持ちを忘れないで欲しい
￣￣￣￣￣￣￣￣￣￣　　　　 |　　　そう思って、この提出を投げたんだ。
　　　(⊆⊇)　(⊆⊇)　(⊆⊇)　　|
　    ||　　 ||　　||　　|　　　 じゃあ、判定を聞こうか。
　　.／|＼　／|＼ ／|＼
*/

#include <iostream>
#include <cstdlib>
#include <algorithm>
#include <array>
#include <bitset>
#include <climits>
#include <cmath>
#include <cstdio>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <string>
#include <vector>
using namespace std;
#define fst first
#define snd second
#define ALL(obj) (obj).begin(),(obj).end()
#define debug(x) cerr << #x << " -> " << x << " (line:" << __LINE__ << ")" << '\n';
#define debugpair(x, y) cerr << "(" << #x << ", " << #y << ") -> (" << x << ", " << y << ") (line:" << __LINE__ << ")" << '\n';
typedef long long lint;
typedef priority_queue<int> p_que;
typedef priority_queue<int, vector<int>, greater<int>()> p_que_rev;
// const int INF = INT_MAX;
const lint LINF = LLONG_MAX;
const lint MOD = 1000000000 + 7;
const double EPS = 1e-9;
const double PI = acos(-1);
const int di[]{0, -1, 0, 1, -1, -1, 1, 1};
const int dj[]{1, 0, -1, 0, 1, -1, -1, 1};


int main()
{
    cin.tie(0);
    ios_base::sync_with_stdio(false);
    int a, b, t;
    cin >> a >> b >> t;
    int ans = (t / a) * b;
    cout << ans << endl;
    return 0;
}

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

const int MAX_N = 123456 * 2 + 1;

int main(){
	bool list[MAX_N];
	for(int i = 0;i < MAX_N;i++) list[i] = true;
	list[0] = list[1] = false;
	
	for(int i = 0;;i++){
		if(list[i]){
			for(int j = i * 2;j < MAX_N;j += i) list[j] = false;
			if(i * i > MAX_N) break;
		}
	}
	
	while(1){
		int n;
		cin >> n;
		if(n == 0) break;
		int ans = 0;
		for(int i = n + 1;i <= n * 2;i++){
			if(list[i]) ans++;
		}
		cout << ans << endl;
	}
	
	return 0;
}

Measured memory_bytes: 0
n, a, b = map(int, input().split())  
sList = input()
cnt = 0
cnt_b = 0
for i, s in enumerate(sList):
    if s == 'a':
        #国内の学生は、現在予選の通過が確定した参加者がA+B人に満たなければ、予選を通過する
        if cnt < a+b:
            cnt += 1
            print('Yes')
        else:
            print('No')
    elif s == 'b':
        #さらに海外の学生の中での順位がB位以内なら、予選を通過する
        if (cnt < a+b) & (cnt_b < b):
            cnt += 1
            cnt_b += 1
            print('Yes')
        else:
            print('No')
    else:
        print('No')

Measured memory_bytes: 9308
K = int(input())

ans = [[] for _ in range(12)]
ans2 = [1,2,3,4,5,6,7,8,9]
ans[0] = [1,2,3,4,5,6,7,8,9]
count = 9

for i in range(12):
    if i == 0:
        pass
    else:
        for j in ans[i-1]:
            k = int(str(j)[-1])
            if k == 0:
                ans[i].append(j * 10 + k)
                ans[i].append(j * 10 + k + 1)
                ans2.append(j * 10 + k)
                ans2.append(j * 10 + k + 1)
                count += 2
            elif k == 9:
                ans[i].append(j * 10 + k - 1)
                ans[i].append(j * 10 + k)
                ans2.append(j * 10 + k - 1)
                ans2.append(j * 10 + k)
                count += 2
            else:
                ans[i].append(j * 10 + k - 1)
                ans[i].append(j * 10 + k)
                ans[i].append(j * 10 + k + 1)
                ans2.append(j * 10 + k - 1)
                ans2.append(j * 10 + k)
                ans2.append(j * 10 + k + 1)
                count += 3

            if count >= K:
                print(ans2[K-count-1])
                exit()


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

using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#define ll long long int
#define INF 1000000007
// cin.eof() 入力個数の問題
int main(){
ll n;
cin>>n;
ll ans=0;
rep(i,n){
ans+=i;
}
cout<<ans<<endl;

  return 0;
}


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


int N;

void read() {
    cin >> N;
}


void work() {
    while (N >= 0) {
        if (N % 4 == 0) {
            cout << "Yes" << endl;
            return;
        }
        N -= 7;
    }
    cout << "No" << endl;
}


int main() {
    read();
    work();
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(void){
    // Your code here!
    int h,m,s,S;
    
    cin >> S;
    
    h = S / 3600;
    m = (S - h * 3600) /60;
    s = S - (h * 3600 + m * 60);
    
    cout << h << ":" << m << ":" << s << endl;
    
    return 0;

}




Measured memory_bytes: 3096
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
vector<string> S;
vector<int> C;
bool f(string s0, string s1, string s2) {
	if (s0.empty()) s0 = s2; else { s1 = s2; reverse(s1.begin(), s1.end()); }
	auto x = min(s0.length(), s1.length());
	return s0.substr(0, x) == s1.substr(0, x);
}
pair<string,string> g(string s0, string s1, string s2) {
	if (s0.empty()) s0 = s2; else { s1 = s2; reverse(s1.begin(), s1.end()); }
	auto x = min(s0.length(), s1.length());
	s0 = s0.substr(x);
	s1 = s1.substr(x);
	auto s = s1;
	reverse(s.begin(), s.end());
	s = s0 + s;
	auto t = s;
	reverse(s.begin(), s.end());
	if (s == t) return {"", ""};
	return {s0, s1};
}
int main() {
	int N;
	cin >> N;
	S.resize(N);
	C.resize(N);
	for (int i = 0; i < N; ++ i) {
		cin >> S[i] >> C[i];
	}
	map<pair<string,string>, ll> dist;
	priority_queue<pair<ll,pair<string,string>>> Q;
	const auto INF = 1LL<<60;
	dist[{"",""}] = INF;
	Q.push({0,{"",""}});
	while (!Q.empty()) {
		auto d0 = -Q.top().first;
		auto s0 = Q.top().second.first;
		auto s1 = Q.top().second.second;
		Q.pop();
		if (d0 != 0 && dist[{s0,s1}] != d0) continue;
		if (s0 == "" && s1 == "" && d0 > 0) {
			cout << d0 << endl;
			return 0;
		} else {
			for (int i = 0; i < N; ++ i) {
				if (f(s0, s1, S[i])) {
					auto p = g(s0, s1, S[i]);
					auto d = d0 + C[i];
					if (!dist.count(p) || d < dist[p]) {
						dist[p] = d;
						Q.push({(ll)-d, p});
					}
				}
			}
		}
	}
	cout << -1 << endl;
}


Measured memory_bytes: 3648
#include<bits/stdc++.h>
using namespace std;
/*******  All Required define Pre-Processors and typedef Constants *******/
#define SCD(t) scanf("%d",&t)
#define SCLD(t) scanf("%ld",&t)
#define SCLLD(t) scanf("%lld",&t)
#define SCC(t) scanf("%c",&t)
#define SCS(t) scanf("%s",t)
#define SCF(t) scanf("%f",&t)
#define SCLF(t) scanf("%lf",&t)
#define mem(a, b) memset(a, (b), sizeof(a))
#define rep(i, j, k) for (int i = j ; i < k ; ++i)
#define rrep(i, j, k) for (int i = j; i > k; --i)
#define all(cont) cont.begin(), cont.end()
#define rall(cont) cont.end(), cont.begin()
#define foreach(i, a) for(auto i: a)
#define forEach(it, l) for (auto it = l.begin(); it != l.end(); it++)
#define in(A, B, C) assert( B <= A && A <= C)
#define mp make_pair
#define pb push_back
#define endl "\n"
#define inf (int) (1e9 + 7)
#define epsi 1e-9
#define PI 3.1415926535897932384626433832795
#define mod 1000000007
#define read(type) readInt<type>()
#define io ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define ll long long int
#define left tuyiuoi
#define right fgjhk
#define ss second
#define ff first
#define debug(a) cout << #a << ": " << a << endl
#define debuga1(a, l, r) rep(i, l, r) cout << a[i] << " "; cout << endl
#define Flag(n) cout << "here " << n << endl
const double pi=acos(-1.0);
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vl> vll;
typedef pair<ll, ll> pll;
typedef vector<string> vs;
typedef vector<pii> vii;
typedef vector<pll> vpll;
typedef vector<vi> vvi;
typedef map<int,int> MPII;
typedef set<int> SETI;
typedef multiset<int> MSETI;
typedef long int int32;
typedef unsigned long int uint32;
typedef long long int int64;
typedef unsigned long long int  uint64;
 
 
int main() {
    io;
    ll n;
    cin>>n;
    ll arr[n][3];
    rep(i,0,n) cin>>arr[i][0]>>arr[i][1]>>arr[i][2];
    ll dp[n][3]={0};
    rep(i,0,3) dp[0][i] = arr[0][i];

    rep(i,1,n){
        dp[i][0]=max(dp[i-1][1],dp[i-1][2])+arr[i][0];
        dp[i][1]=max(dp[i-1][0],dp[i-1][2])+arr[i][1];
        dp[i][2]=max(dp[i-1][1],dp[i-1][0])+arr[i][2];
    }
    cout<<max({dp[n-1][0],dp[n-1][1],dp[n-1][2]})<<endl;
    
    return 0;
}

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

int main()
{
  int n;
  cin >> n;
  vector<string> S(n);
  vector<vector<int>> alpha(n, vector<int>(26));
  vector<int> ans(26, 1000000);
  for (int i = 0; i < n; i++)
  {
    cin >> S.at(i);
    for (int j = 0; j < S.at(i).size(); j++)
    {
      alpha.at(i).at(S.at(i).at(j) - 'a')++;
    }
  }

  for (int i = 0; i < n; i++)
  {
    for (int j = 0; j < alpha.at(i).size(); j++)
    {
      ans.at(j) = min(ans.at(j), alpha.at(i).at(j));
    }
  }

  for (int i = 0; i < ans.size(); i++)
  {
    if (ans.at(i) != 0)
    {
      for (int j = 0; j < ans.at(i); j++)
      {
        cout << (char)('a' + i);
      }
    }
  }
  cout << endl;
}


Measured memory_bytes: 3632