akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
 
#define ll long long 
#define inf 0x3f3f3f3f
#define infll 0x3f3f3f3f3f3f3f3f
#define all(x) (x).begin(),(x).end()
#define pb push_back

#define F_OR(i, a, b, s) for (int i=(a); (s)>0?i<(b):i>(b); i+=(s))
#define F_OR1(e) F_OR(i, 0, e, 1)
#define F_OR2(i, e) F_OR(i, 0, e, 1)
#define F_OR3(i, b, e) F_OR(i, b, e, 1)
#define F_OR4(i, b, e, s) F_OR(i, b, e, s)
#define GET5(a, b, c, d, e, ...) e
#define F_ORC(...) GET5(__VA_ARGS__, F_OR4, F_OR3, F_OR2, F_OR1)
#define FOR(...) F_ORC(__VA_ARGS__)(__VA_ARGS__)
#define EACH(x, a) for (auto& x: a)
 
// debug templates 
#define debug(x)       cerr<< #x <<" : "<< x << endl;
#define debuga(A,N)    cerr<< #A <<" : [";for(int i = 0; i<N;i++) cerr<<A[i]<<" "; cerr<<"]\n";
#define debuga2(A,N,M) cerr<< #A << " : \n"; for(int i=0;i<N;i++){cerr<<"[";for(int j=0;j<M;++j) cerr<<A[i][j]<<" ";cerr<<"]\n";}
#define debugp(p)      cerr<< #p <<" : "<<"("<<(p).first<<","<<(p).second<<")\n";
#define debugv(v)      cerr<< #v <<" : "<<"[";for(int i = 0; i< (v).size(); i++) cerr<<v[i]<<" "; cerr<<"]\n";
#define debugv2(v)     cerr<< #v << " : \n"; for(int i=0;i<v.size();i++){cerr<<"[";for(int j=0;j<(v[0].size());++j) cerr<<v[i][j]<<" ";cerr<<"]\n";}
#define debugs(m)      cerr<< #m <<" : [ "; for(auto itr = m.begin(); itr!=m.end();itr++) cerr<<*itr<<" "; cerr<<"]\n";
#define debugm(m)      cerr<< #m <<" : [ "; for(auto itr = m.begin();itr!=m.end(); itr++) cerr<<"("<<itr->first<<","<<itr->second<<") ";cerr<<"]\n";
 

void solve(){
	int n,k; string s; cin >> n >> k >> s;
	--k;
	s[k] = tolower(s[k]);
	cout << s;
}
 
int main(){
	ios::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	
	solve();
	return 0;
}
 


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

using namespace std;

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

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

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

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



int n, m, a[101010];
int cnt[101010];
P p[101010];
string ans[101010];
string output(int a){
	int c = 100000;
	string re;
	while(c > 0){
		re += (char)('0'+a/c);
		a %= c;
		c /= 10;
	}
	return re;
}
void solve(){
	cin >> n >> m;
	for(int i = 0; i < m; i++){
		int b;
		cin >> a[i] >> b;
		p[i] = {b,i};
	}
	sort(p,p+m);
	
	for(int i = 0; i < m; i++){
		int j = p[i].second;
		cnt[a[j]]++;
		ans[j] += output(a[j]);
		ans[j] += output(cnt[a[j]]);
	}
	for(int i = 0; i < m; i++){
		cout << ans[i] << endl;
	}
}

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


Measured memory_bytes: 9344
#include<iostream>
using namespace std;
int gcd(int,int);
int main(){
    int a,b,c;
    cin>>a>>b;
    c=gcd(a,b);
    cout<<c<<endl;
    return 0;
}
int gcd(int x,int y){
    int r;
    if(x<y){
        int z=x;
        x=y;
        y=z;
    }
    r=x%y;
    while(r!=0){
        x=y;
        y=r;
        r=x%y;
    }
    return y;
}

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

using namespace std;

using int64 = long long;

const int INF = 1 << 30;

int main() {
  int N, A[200000];
  cin >> N;
  for(int i = 0; i < N; i++) cin >> A[i];

  int64 ret = 0;
  vector< int > last[30];
  for(int i = 0; i < N; i++) {
    int sx = 0;
    for(int j = 0; j < 30; j++) {
      if((A[i] >> j) & 1) {
        last[j].emplace_back(i);
      }
    }
    for(int j = 0; j < 30; j++) {
      if(last[j].size() >= 2) {
        sx = max(sx, last[j][last[j].size() - 2] + 1);
      }
    }
    ret += i - sx + 1;
  }
  cout << ret << endl;
}

Measured memory_bytes: 9024
#include<iostream>
#include<vector>
#include<queue>
#include<algorithm>
//#include<operator>

using namespace std;


class UFT{
public:
  int P[10010];//その頂点の親を格納する

  //初めは全ての頂点はバラバラで違うグループに属する
  void init(int N){
    for(int i=0;i<N;i++) P[i]=i;
  }

  int root(int a){
    if(P[a]==a) return a;
    return root(P[a]);
  }

  bool is_same_set(int a,int b){
    return root(a)==root(b);
  }

  void unite(int a,int b){
    //aのルートだったもののルートをbのルートにする
    P[root(a)]=root(b);
  }
};

bool is_same_set_all(UFT a,int n){
  for(int i=0;i<n-1;i++){
    if(!(a.is_same_set(i,i+1))){return false;}
  }
  return true;
}

class edge{
public:
  int from_Node;
  int to_Node;
  int cost;
};

//本来は<さえオーバーロードすれば大丈夫が四つのオペレータをオーバロードしなければならなかった(何故？？)
bool operator< (const edge& e1,const edge& e2){
  return e1.cost < e2.cost;
}


bool operator> (const edge& e1,const edge& e2){
  return e1.cost > e2.cost;
}


bool operator<= (const edge& e1,const edge& e2){
  return e1.cost <= e2.cost;
}

bool operator>= (const edge& e1,const edge& e2){
  return e1.cost >= e2.cost;
}


int main(){
  #if 0
  このようにデバッグができる(比較演算子のオーバーロード)
  edge a={0,1,2},b={1,2,3};
  if(a<b){cout << "a<b" << endl;}
  if(b<a){cout << "b<a" << endl;}
  if(a>b){cout << "a>b" << endl;}
  if(a<=b){cout << "a<=b" << endl;}
  #endif


  int n;cin >> n;
  priority_queue<
  edge,//要素の型
  vector<edge>,//内部コンテナはvectorで(デフォ)
  greater<edge>//昇順
  > ve;
  for(int i=0;i<n;i++){
    for(int j=0;j<n;j++){
      edge e;int c;
      cin >> c;
      if(c!=-1 and i<j){
        e.from_Node=i;e.to_Node=j;e.cost=c;
        ve.push(e);
      }
    }
  }
  UFT G;G.init(n);
  int co=0;
  while(!(is_same_set_all(G,n))){
    if(!(G.is_same_set(ve.top().from_Node,ve.top().to_Node))){
      G.unite(ve.top().from_Node,ve.top().to_Node);
      co+=ve.top().cost;
      ve.pop();
    }else{
      ve.pop();
    }
  }
  cout << co << endl;

}



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

int main()
{
	string s;
	std::cin >> s;
	string rslt;
	for (int i = 0; i < s.length(); i++) {
		if (i % 2 == 0)rslt += s[i];
	}
	std::cout << rslt;
	return 0;
}


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

//頂点は0からn-1
struct UnionFind {
    //par[i]はiの親で根のときは自分自身
    vector<int> par;

    //すべてが根として初期化
    //ここの書き方がわからない
    UnionFind(int N) : par(N) {
        for(int i = 0; i < N; i++) par[i] = i;
    }
    
    // データxが属する木の根を再帰で得る：root(x) = {xの木の根}
    int root(int x) {
        if (par[x] == x) return x;
        return par[x] = root(par[x]);
    }

    // 木の併合
    void unite(int x, int y) {
        int rx = root(x);
        int ry = root(y);
        if (rx == ry) return;
        par[rx] = ry; //xとyの根が同じでない時：xの根rxをyの根ryにつける
    }
    
    // x, yが属する木が同じか判定
    bool same(int x, int y) {
        int rx = root(x);
        int ry = root(y);
        return rx == ry;
    }
};

int main() {
    int ans=0;

    int V,E;
    cin >> V >> E;
    int x[55], y[55];
    for(int i=0; i<E; i++){
        int p,q;
        cin >> p >> q;
        x[i] = p-1;
        y[i] = q-1;
    }

    for(int k=0; k<E; k++){
        UnionFind tree(V);
        for(int i=0; i<E; i++){
            if(i == k) continue;
            tree.unite(x[i], y[i]);
        }
        bool connected=true;
        for(int i=0; i<V; i++){
            if(!tree.same(0,i)) connected=false;
        }
        if(!connected) ans++;
    }

    cout << ans << endl;
}

Measured memory_bytes: 3596
#include<stdio.h>
using namespace std;
int main()
{
    int A, B, ad, time;
    scanf("%d %d", &A, &B);
    if(A>=0 && B >=0 && A <=23 && B <= 23){
        ad=A+B;
        if(ad >= 24){
            time=ad - 24;
        }
        else{
            time = ad;
        }
        printf("%d\n", time);
    }
   return 0;
}

Measured memory_bytes: 128
import sys

read = sys.stdin.buffer.read
INF = 1 << 60


def main():
    N, M, *AB = map(int, read().split())

    Q = [[] for _ in range(N - 1)]
    for a, b in zip(*[iter(AB)] * 2):
        Q[a - 1].append(b - 2)

    min_y = INF
    ans = 0
    for i, ys in enumerate(Q):
        if ys:
            min_y = min(min_y, min(ys))
        if i == min_y:
            ans += 1
            min_y = INF

    print(ans)
    return


if __name__ == '__main__':
    main()


Measured memory_bytes: 30176
//by yjz
#include<bits/stdc++.h>
using namespace std;
#define FF first
#define SS second
#define PB push_back
#define MP make_pair
#define bged(v) (v).begin(),(v).end()
#define foreach(it,s) for(__typeof((s).begin()) it=(s).begin();it!=(s).end();it++)
typedef long long ll;
const int Imx=2147483647;
const ll Lbig=2e18;
const int mod=998244353;
//My i/o stream
struct fastio
{
	char s[100000];
	int it,len;
	fastio(){it=len=0;}
	inline char get()
	{
		if(it<len)return s[it++];it=0;
		len=fread(s,1,100000,stdin);
		if(len==0)return EOF;else return s[it++];
	}
	bool notend()
	{
		char c=get();
		while(c==' '||c=='\n')c=get();
		if(it>0)it--;
		return c!=EOF;
	}
}_buff;
#define geti(x) x=getnum()
#define getii(x,y) geti(x),geti(y)
#define getiii(x,y,z) getii(x,y),geti(z)
#define puti(x) putnum(x),putchar(' ')
#define putii(x,y) puti(x),puti(y)
#define putiii(x,y,z) putii(x,y),puti(z)
#define putsi(x) putnum(x),putchar('\n')
#define putsii(x,y) puti(x),putsi(y)
#define putsiii(x,y,z) putii(x,y),putsi(z)
inline ll getnum()
{
	ll r=0;bool ng=0;char c;c=_buff.get();
	while(c!='-'&&(c<'0'||c>'9'))c=_buff.get();
	if(c=='-')ng=1,c=_buff.get();
	while(c>='0'&&c<='9')r=r*10+c-'0',c=_buff.get();
	return ng?-r:r;
}
template<class T> inline void putnum(T x)
{
	if(x<0)putchar('-'),x=-x;
	register short a[20]={},sz=0;
	while(x)a[sz++]=x%10,x/=10;
	if(sz==0)putchar('0');
	for(int i=sz-1;i>=0;i--)putchar('0'+a[i]);
}
inline char getreal(){char c=_buff.get();while(c<=32)c=_buff.get();return c;}
ll qpow(ll x,ll k){return k==0?1:1ll*qpow(1ll*x*x%mod,k>>1)*(k&1?x:1)%mod;}
int n;
ll A,B,K,fac[300111],ifac[300111];
ll C(ll x,ll y){return x<y?0:fac[x]*ifac[y]%mod*ifac[x-y]%mod;}
int main()
{
	fac[0]=1;
	for(int i=1;i<=300000;i++)fac[i]=fac[i-1]*i%mod;
	ifac[300000]=qpow(fac[300000],mod-2);
	for(int i=299999;i>=0;i--)ifac[i]=ifac[i+1]*(i+1)%mod;
	cin>>n>>A>>B>>K;
	ll ans=0;
	for(int i=0;i<=n&&i*A<=K;i++)
	{
		if((K-i*A)%B==0)
		{
			int j=(K-i*A)/B;
			//cerr<<i<<" "<<j<<endl;
			if(j<=n)
			{
				ans+=C(n,i)*C(n,j)%mod;
			}
		}
	}
	cout<<(ans%mod+mod)%mod<<endl;
	return 0;
}


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

using namespace std;
typedef long long ll;

int main() {
    int n, m;
    cin >> n >> m;
    vector<ll> beauty(n);
    vector<ll> tastiness(n);
    vector<ll> popularity(n);
    for (int i = 0; i < n; ++i) {
        cin >> beauty[i];
        cin >> tastiness[i];
        cin >> popularity[i];
    }
    vector<ll> sum(n);
    ll ans = 0;
    ll cur;
    for (int i = -1; i <= 1; i += 2) {
        for (int j = -1; j <= 1; j += 2) {
            for (int k = -1; k <= 1; k += 2) {
                cur = 0;
                for (int x = 0; x < sum.size(); ++x) {
                    sum[x] = i * beauty[x] + j * tastiness[x] + k * popularity[x];
                }
                sort(sum.begin(), sum.end(), greater<ll>());
                for (int p = 0; p < m; ++p) {
                    cur += sum[p];
                }
                ans = max(cur, ans);
            }
        }
    }
    cout << ans << endl;
    return 0;
}

static int speedUp = []() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    return 0;
}();

Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>
#define M 1046527
#define NIL (-1)
#define L 14

char H[M][L];

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

long long getKey(char str[]){
	long long sum=0, p = 1, i;
	for (i=0;i < strlen(str); i++){
		sum += p*(getChar(str[i]));
		p *=5;
	}
	return sum;
}

int h1(int key){return key % M;}
int h2(int key){return 1 + (key % (M-1));}

int find(char str[]){
	long long key,i,h;
	key=getKey(str);
	for(i=0;;i++){
		h = (h1(key) + i * h2(key)) % M;
		if (strcmp(H[h],str)==0) return 1;
		else if ( strlen(H[h]) == 0) return 0;
	}
	return 0;
}

int insert(char str[]){
	long long key,i,h;
	key=getKey(str);
	for(i=0;;i++){
		h = (h1(key) + i * h2(key)) % M;

		if (strcmp(H[h],str)==0) return 0;
		else if ( strlen(H[h]) == 0) {
		  strcpy(H[h],str);
		  return 0;
	}
	}
	return 0;
}

int main(){
	int i,n,h;
	char str[L],com[9];
	for(i=0;i<M;i++) H[i][0]='\0';
	scanf("%d",&n);
	for(i=0;i<n;i++){
		scanf("%s %s",com,str);
		if (com[0] == 'i'){
			insert(str);
		}else{
			if (find(str)){
				printf("yes\n");
			}else{
				printf("no\n");
			}
		}
	}
}

Measured memory_bytes: 16984
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define INF 2e9
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
int main()
{
    string S,X,Y,C,TS,ES;
    ll Q,T,TX=0,F;
    cin >> S >>Q;
    REP(i,Q){
        cin >> T;
        if(T ==1){
            TX += 1;
        }else{
            cin >> F >> C;
            if((F+TX) % 2 ==1){
                TS = TS+C;
            }else{
                ES = ES + C;
            }
        }
    }
    if(TX%2 == 1){
        string tmp;
        tmp = TS;
        TS = ES;
        ES= tmp;
        reverse(S.begin(), S.end()); 
    }
    reverse(TS.begin(), TS.end()); 
    cout <<TS <<S<< ES<<endl;

    return 0;    
}

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

#define fastIO ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
typedef long long ll ;
typedef long double ld ;

const ll MOD = 1E9 + 7, INF = 2E18 + 5 ;
const double PI = 2 * acos(0.0) ;
const long double EPS = 1.0E-14 ;

char mat[7][7], matAlt[7][7] ;
ll row, col, val ;
vector <ll> vecRow, vecCol ;

bool check()
{
    for (int i = 0; i < row; i++) {
        for (int j = 0; j < col; j++) {
            matAlt[i][j] = mat[i][j] ;
        }
    }
    for (int i = 0; i < vecRow.size(); i++) {
        for (int j = 0; j < col; j++) {
            matAlt[vecRow[i]][j] = 'R' ;
        }
    }
    for (int i = 0; i < vecCol.size(); i++) {
        for (int j = 0; j < row; j++) {
            matAlt[j][vecCol[i]] = 'R' ;
        }
    }
    ll black = 0 ;
    for (int i = 0; i < row; i++) {
        for (int j = 0; j < col; j++) {
            if (matAlt[i][j] == '#')    black++ ;
        }
    }
    if (black == val)   return true ;
    else    return false ;
}

int main()
{
    ll ans = 0 ;
    cin >> row >> col >> val ;

    for (int i = 0; i < row; i++) {
        for (int j = 0; j < col; j++) {
            cin >> mat[i][j] ;
        }
    }

    for (int i = 0; i < (1LL << row); i++) {
        vecRow.clear() ;
        for (int j = 0; j < row; j++) {
            if (i & (1LL << j)) {
                vecRow.push_back(j) ;
            }
        }
        for (int p = 0; p < (1LL << col); p++) {
            vecCol.clear() ;
            for (int j = 0; j < col; j++) {
                if (p & (1LL << j)) {
                    vecCol.push_back(j) ;
                }
            }
            if (check())    ans++ ;
        }
    }

    cout << ans ;

    return 0 ;
}


Measured memory_bytes: 3608
import java.util.*;

public class Main {
    public static void main(String args[]) {
        Scanner sc = new Scanner(System.in);
        
        int num_1 = sc.nextInt();
        int num_2 = sc.nextInt();
        
        int ans = num_1 * num_1 - num_2;
        System.out.println(ans);
    }
}

Measured memory_bytes: 21716
def f(x, n, k, count, wa, a)
  if count == n then
    return (wa == k*a ? 1 : 0)
  else
    ans = 0
    ans += f(x, n, k+1, count+1, wa+x[count], a)
    ans += f(x, n, k, count+1, wa, a)
    return ans
  end
end

def f2(dp, x, j, k, s)
  return 1 if j == 0 && k == 0 && s == 0
  return dp[j][k][s] if dp[j][k][s] != -1
  if j >= 1 && s < x[j-1] then
    dp[j][k][s] = f2(dp,x,j-1,k,s)#dp[j-1][k][s]
  elsif j >= 1 && k >= 1 && s >= x[j-1] then
    dp[j][k][s] = f2(dp,x,j-1,k,s) + f2(dp,x,j-1,k-1,s-x[j-1])#dp[j-1][k][s] + dp[j-1][k-1][s-x[j-1]]
  else
    dp[j][k][s] = 0
  end
  return dp[j][k][s]
end

N, A = gets.split.map(&:to_i)
x = gets.split.map(&:to_i)

#puts f(x, N, 0, 0, 0, A)-1 if N <= 20

X = x.max < A ? A : x.max
dp = Array.new(N+1){Array.new(N+1){Array.new(N*X+1,-1)}}
dp[0][0][0] = 1

ans = 0
(1..N).each do |k|
  ans += f2(dp,x,N,k,k*A)
end

#p dp
puts ans


Measured memory_bytes: 52604
A=[]
A1=list(map(int,input().split()))
A2=list(map(int,input().split()))
A3=list(map(int,input().split()))
A=[A1,A2,A3]
N=int(input())
B=[]
for _ in range(N):
    B.append(int(input()))
X=[[0,0,0],[0,0,0],[0,0,0]]
for b in B:
    for a in A:
        for i in range(3):
            if a[i]==b:
                X[A.index(a)][i]=1
bin=False
if [1,1,1] in X:
    bin =True
if X[0][0] == X[1][0] and X[2][0] == X[1][0] and X[0][0]==1:
    bin=True
if X[0][1] == X[1][1] and X[2][1] == X[1][1] and X[0][1]==1:
    bin=True
if X[0][2] == X[1][2] and X[2][2] == X[1][2] and X[0][2]==1:
    bin=True
if X[0][0] == X[1][1] and X[2][2] == X[1][1] and X[0][0]==1:
    bin=True
if X[2][0] == X[1][1] and X[2][0] == X[1][1] and X[2][0]==1:
    bin=True
print('Yes' if bin else 'No')


Measured memory_bytes: 3188
// #define DEBUGGING
#include <bits/stdc++.h>
using namespace std;
#define endl '\n'
#define ALL(V) (V).begin(), (V).end()
#define ALLR(V) (V).rbegin(), (V).rend()
template <typename T> using V = std::vector<T>;
template <typename T> using VV = V<V<T>>;
using ll = std::int64_t;
using ull = std::uint64_t;
using PLL = std::pair<ll, ll>;
using TLL = std::tuple<ll, ll, ll>;
template <typename T> const T& var_min(const T &t) { return t; }
template <typename T> const T& var_max(const T &t) { return t; }
template <typename T, typename... Tail> const T& var_min(const T &t, const Tail&... tail) { return std::min(t, var_min(tail...)); }
template <typename T, typename... Tail> const T& var_max(const T &t, const Tail&... tail) { return std::max(t, var_max(tail...)); }
template <typename T, typename... Tail> void chmin(T &t, const Tail&... tail) { t = var_min(t, tail...); }
template <typename T, typename... Tail> void chmax(T &t, const Tail&... tail) { t = var_max(t, tail...); }
template <typename T> const T& clamp(const T &t, const T &low, const T &high) { return std::max(low, std::min(high, t)); }
template <typename T> void chclamp(T &t, const T &low, const T &high) { return t = clamp(t, low, high); }
namespace init__ { struct InitIO { InitIO() { std::cin.tie(nullptr); std::ios_base::sync_with_stdio(false); std::cout << std::fixed << std::setprecision(30); } } init_io; }
#define mv_rec make_v(init, tail...)
template <typename T> T make_v(T init) { return init; }
template <typename T, typename... Tail> auto make_v(T init, size_t s, Tail... tail) { return V<decltype(mv_rec)>(s, mv_rec); }
#undef mv_rec
#ifdef DEBUGGING
#include "../../debug/debug.cpp"
#else
#define DEBUG(...) 0
#define DEBUG_SEPARATOR_LINE 0
#endif

bool solve() {
    ll N;
    cin >> N;
    V<ll> A(N), B(N);
    for(ll &e : A) cin >> e;
    for(ll &e : B) cin >> e;
    {
        V<PLL> bi;
        for(ll i = 0; i < N; i++) bi.emplace_back(B[i], i);
        sort(ALL(bi));
        V<ll> cpy(N);
        for(ll i = 0; i < N; i++) {
            ll f, s;
            tie(f, s) = bi[i];
            cpy[i] = A[s];
            B[i] = f;
        }
        A = move(cpy);
    }

    auto sa = A;
    sort(ALL(sa));
    for(ll i = 0; i < N; i++) if(!(sa[i] <= B[i])) return false;
    for(ll i = 0; i < N - 1; i++) {
        ll a1 = sa[i], a2 = sa[i + 1];
        ll b1 = B[i], b2 = B[i + 1];
        if(a1 <= b2 && a2 <= b1) return true;
    }
    
    map<ll, ll> idx;
    for(ll i = 0; i < N; i++) {
        ll e = A[i];
        auto ite = lower_bound(ALL(sa), e);
        idx[e] = i;
    }

    for(auto ele : idx) DEBUG(ele);
    ll rest = N - 2;
    for(ll i = 0; i < N - 1; i++) {
        if(idx[sa[i]] == i) return true;
        ll swap_i = idx[sa[i]];
        swap(A[i], A[swap_i]);
        idx[A[i]] = i;
        idx[A[swap_i]] = swap_i;
        rest--;
    }

    return 0 <= rest;
}

int main() {
    cout << (solve() ? "Yes" : "No") << endl;
    return 0;
}


Measured memory_bytes: 8780
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		double t = sc.nextDouble();
		double a = sc.nextDouble();
		int answer = 0;
		double answertempdiff = Integer.MAX_VALUE;
		for(int i =1;i <= n;i++) {
			double temp = t - (sc.nextDouble() * 0.006);
			if(Math.abs(a - temp) < answertempdiff) {
				answer = i;
				answertempdiff = Math.abs(a - temp);
			}
		}
		System.out.println(answer);
	}
}

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

#define cn count
#define pb push_back
#define in insert
#define fs first
#define sc second
#define sz size
#define len length
#define forn(i, n) for (ll i = 0; i < (ll) (n); ++i)
#define forni(i, n) for (ll i = 1; i < (ll) (n); ++i)
#define IO ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0)

using namespace std;
using ll = long long;
const ll inf = 1e9+7; 
const double PI =  3.141592653589793;

int main(){
	IO;
	string n;
	cin>>n;
	ll sum = 0;
	forn(i,n.len()){
		sum+=n[i]-'0';
	}
	cout<<(sum%9==0 ? "Yes\n" : "No\n");
	return 0;
}


// _   .-')                .-. .-')                 .-')                                               
//( '.( OO )_              \  ( OO )               ( OO ).                                             
// ,--.   ,--.).-'),-----. ,--. ,--.  .-'),-----. (_)---\_) ,--. ,--.     .-----.  ,-.-')  .-'),-----. 
// |   `.'   |( OO'  .-.  '|  .'   / ( OO'  .-.  '/    _ |  |  | |  |    '  .--./  |  |OO)( OO'  .-.  '
// |         |/   |  | |  ||      /, /   |  | |  |\  :` `.  |  | | .-')  |  |('-.  |  |  \/   |  | |  |
// |  |'.'|  |\_) |  |\|  ||     ' _)\_) |  |\|  | '..`''.) |  |_|( OO )/_) |OO  ) |  |(_/\_) |  |\|  |
// |  |   |  |  \ |  | |  ||  .   \    \ |  | |  |.-._)   \ |  | | `-' /||  |`-'| ,|  |_.'  \ |  | |  |
// |  |   |  |   `'  '-'  '|  |\   \    `'  '-'  '\       /('  '-'(_.-'(_'  '--'\(_|  |      `'  '-'  '
// """    """     """""""" """  """"      """""""  """""""  """"""""      """"""   """         """""""
 


Measured memory_bytes: 3736
# include <algorithm>
# include <cassert>
# include <cctype>
# include <cstdio>
# include <cstdlib>
# include <cstring>
# include <cmath>
# include <iostream>
# include <map>
# include <queue>
# include <set>
# include <sstream>
# include <stack>
# include <string>
# include <vector>
# include <iomanip>

# define rep(i, n) for (int i = 0; i < (int)(n); i++)
# define irep(i, n) for (int i = int(n) - 1; i >= 0; i--)
# define FOR(i, m, n) for (int i = int(m); i < (int)(n); i++)

using namespace std;
typedef long long ll;

void solve(string s) {
  rep (i, s.size() - 1) {
    if (s[i] == s[i+1]) {
      cout << i+1 << " " << i+2 << endl;
      return ;
    }

    if (i < s.size() - 2) {
      if (s[i] == s[i+2]) {
        cout << i+1 << " " << i+3 << endl;
        return ;
      }
    }
  }
  cout << "-1 -1" << endl;
}

int main() {
  string s;
  cin >> s;

  solve(s);
}


Measured memory_bytes: 512
/*** author: yuji9511 ***/
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> lpair;
const ll MOD = 1e9 + 7;
const ll INF = 1e18;
#define rep(i,m,n) for(ll i = (m); i < (n); i++)
#define rrep(i,m,n) for(ll i = (m); i >= (n); i--)
#define print(x) cout << (x) << endl;
#define print2(x,y) cout << (x) << " " << (y) << endl;
#define printa(x,n) for(ll i = 0; i < n; i++){ cout << (x[i]) << " \n"[i==n-1];};
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll N,K;
    cin >> N >> K;
    ll A[2010];
    rep(i,0,N) cin >> A[i];
    ll ans = 0;
    ll cnt[2010] = {}, cnt_after[2010] = {};
    rep(i,0,N){
        rep(j,0,N){
            if(A[i] > A[j]) cnt[i]++;
        }
    }
    rep(i,0,N){
        rep(j,i,N){
            if(A[i] > A[j]) cnt_after[i]++;
        }
    }
    rep(i,0,N){
        ans += cnt_after[i] * K % MOD;
        ans %= MOD;
        ll v = K * (K-1) / 2;
        v %= MOD;
        ans += (cnt[i] * v) % MOD;
        ans %= MOD;
    }
    print(ans);



    
}

Measured memory_bytes: 256
#include <iostream>
#include <string>

using namespace std;

void solve()
{
	int A, B;
	while(cin >> A >> B, A || B)
	{
		int sum = B - A;
		int thousand, fiveHundred, hundred;
		thousand = sum / 1000;
		sum %= 1000;
		fiveHundred = sum / 500;
		sum %= 500;
		hundred = sum / 100;
		cout << hundred << " " << fiveHundred << " " << thousand << endl;
	}
}

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

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

#define int long long
typedef pair <int, int> pii;

const int N = 1e5 + 10;
int n, a, b;
pii ar[N];

int32_t main() {
	cin >> n;
	for (int i = 0; i < n; i++)
		cin >> ar[i].first >> ar[i].second;
	sort(ar, ar + n, [&] (pii p1, pii p2) { return p1.first + p1.second > p2.first + p2.second; });
	
	for (int i = 0; i < n; i++)
		if (i & 1)
			b += ar[i].second;
		else
			a += ar[i].first;
	cout << a - b;
}

Measured memory_bytes: 1792
#include<bits/stdc++.h>
using namespace std;
struct node
{
	int c,t;
};
struct node z[1005];
bool cmp(node a,node b)
{
	 return a.c<b.c;
}
int main()
{int n,t;
cin>>n>>t;
	for(int i=0;i<n;i++)
	{
		 cin>>z[i].c>>z[i].t;
	}
	sort(z,z+n,cmp);
   for(int i=0;i<n;i++)
	{
		 if(z[i].t<=t)
		 {cout<<z[i].c;
		 return 0;
		 }
	}
	printf("TLE");
 } 

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

public class Main {
	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		StringTokenizer st = new StringTokenizer(br.readLine());
		int N = Integer.parseInt(st.nextToken());
		int A = Integer.parseInt(st.nextToken());
		int B = Integer.parseInt(st.nextToken());
		if((A+B)%2==1) {
			System.out.println("Borys");
		}else {
			System.out.println("Alice");
		}
	}
}


Measured memory_bytes: 21076
#include<bits/stdc++.h>
using namespace std;
const int pi=3.1415926535897932384626433832795;
const int dx[]={0,1,0,-1};
const int dy[]={1,0,-1,0};
#define ll long long
#define inf int(1e9+7)
#define pb push_back
#define mp make_pair
char s[100005];
char t[100005];
int a[100005],n;
int main()
{
	cin>>n>>s;
	for(int i=0;i<2;i++)
		for(int j=0;j<2;j++)
		{
			if(i==0)
				a[0]=0;
			else
				a[0]=1;
			if(j==0)
				a[1]=0;
			else
				a[1]=1;
			for(int k=2;k<n;k++)
			{
				if(s[k-1]=='o')
				{
					if(a[k-1]==0)
						a[k]=a[k-2];
					else
						a[k]=1-a[k-2];
				}
				else
				{
					if(a[k-1]==0)
						a[k]=1-a[k-2];
					else
						a[k]=a[k-2];
				}
			}
			if(s[n-1]=='o')
			{
				if(a[n-1]==0)
				{
					if(a[n-2]!=a[0])
						continue;
				}
				else
				{
					if(a[n-2]==a[0])
						continue;
				}
			}
			else
			{
				if(a[n-1]==0)
				{
					if(a[n-2]==a[0])
						continue;
				}
				else
				{
					if(a[n-2]!=a[0])
						continue;
				}
			}
			if(s[0]=='o')
			{
				if(a[0]==0)
				{
					if(a[n-1]!=a[1])
						continue;
				}
				else
				{
					if(a[n-1]==a[1])
						continue;
				}
			}
			else
			{
				if(a[0]==0)
				{
					if(a[n-1]==a[1])
						continue;
				}
				else
				{
					if(a[n-1]!=a[1])
						continue;
				}
			}
			for(int k=0;k<n;k++)
			{
				if(a[k]==0)
					t[k]='S';
				else
					t[k]='W';
			}
			cout<<t;
			return 0;
		}
	puts("-1");
	return 0;
}

Measured memory_bytes: 896
#include <bits/stdc++.h> //C++の標準ライブラリを一行で一括でインクルードする
#include <math.h> //数学関数と数学定数を利用する
#define rep(i,n) for (int i = 0; i < (n); i++)
using namespace std;
typedef long long ll;
template<class T> void chmax(T &a,T b) { if (a<b) a=b;}
template<class T> void chmin(T &a,T b) { if (a>b) a=b;}

int main(){
  int n;
  cin >> n;
  vector<pair<int,int>> x;
  vector<pair<int,int>> med;
  
  rep(i,n){
    int tmp;
    cin >> tmp;
    x.push_back(make_pair(tmp,i));
  }
  
  sort(x.begin(),x.end());
  
  rep(i,n){
    if (i < x.size()/2){
      med.push_back(make_pair(x[i].second,x[x.size()/2].first));
    }else{
      med.push_back(make_pair(x[i].second,x[x.size()/2-1].first));
    }
  }
  
  sort(med.begin(),med.end());
  
  for(auto a:med){
    cout << a.second << endl;
  }
  return 0;
}

Measured memory_bytes: 5488
import java.io.InputStream

private val input = FastScanner()

fun main(args: Array<String>) = input.run {
    val n = nextInt()
    val p = nextInt()
    val a = nextInts(n)

    val c = arrayOf(0, 0)
    a.forEach {
        c[it % 2]++
    }

    val binom = PascalTriangle(50)

    var ans = 0L
    (p..c[1] step 2).forEach {
        ans += binom[c[1], it]
    }

    ans *= (1L shl c[0])

    println(ans)
}

class PascalTriangle(maxN: Int, mod: Int = 0) {
    private val a = Array(maxN + 1) { LongArray(it + 1) }

    init {
        assert(mod == 0 || mod > 1)

        a.forEachIndexed { n, row ->
            row[0] = 1
            if (n > 0) {
                row[n] = 1
                (1 until n).forEach { m ->
                    row[m] = a[n - 1][m] + a[n - 1][m - 1]
                }
            }
            if (mod > 0) {
                row.indices.forEach { row[it] %= mod.toLong() }
            }
        }
    }

    operator fun get(n: Int, m: Int): Long = if (m <= n) a[n][m] else 0
}

class FastScanner(private val input: InputStream = System.`in`) {
    private val sb = StringBuilder()
    private val buffer = ByteArray(4096)
    private var pos = 0
    private var size = 0

    fun nextLong(): Long {
        var c = skipWhitespace()

        val sign = if (c == '-'.toInt()) {
            c = read()
            -1
        } else 1

        var ans = 0L

        while (c > ' '.toInt()) {
            ans = ans * 10 + c - '0'.toInt()
            c = read()
        }

        return sign * ans
    }

    fun nextInt() = nextLong().toInt()

    fun nextInts(n: Int) = IntArray(n) { nextInt() }

    private fun skipWhitespace(): Int {
        while (true) {
            val c = read()
            if (c > ' '.toInt() || c < 0) return c
        }
    }

    private fun read(): Int {
        while (pos >= size) {
            if (size < 0) return -1
            size = input.read(buffer, 0, buffer.size)
            pos = 0
        }
        return buffer[pos++].toInt()
    }
}

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

int main() {
    long n, k, tmp;
    unordered_map<long, long> dest;
    unordered_map<long, long> visited;
    long count = 0;
    long town = 1;

    long loopOffset = 0;
    long loopSize = 0;

    cin >> n >> k;
    for (long i = 1; i <= n; ++i) {
        cin >> tmp;
        dest[i] = tmp;
    }

    while (k) {
        // loop detected
        if (visited.count(town)) {
            loopOffset = visited[town];
            loopSize = count - visited[town];
            break;
        }

        visited[town] = count;
        town = dest[town];
        k--;
        count++;
    }

    if (k) {
        long remains = k % loopSize;
        while (remains--)
            town = dest[town];
    }

    cout << town << '\n';

    return 0;
}


Measured memory_bytes: 18496
/* Preprocess */
#include <bits/stdc++.h>

#define pow(n) (n)*(n)
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(v) v.begin(), v.end()


/* Field */
using namespace std;


/* Function */

int main (void) 
{

  /* Variable_Proclamation */
  int M;      // input
  int grace;  // input （猶予）


  /* Input, Initialize */
  cin >> M;
  grace = 24*2; // two days


  /* Calculation */
  grace = grace - M;


  /* Output */
  cout << grace << endl;


  return 0;

}




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

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

	int d[1000];
	int i = 1;
	int ans = 0;
	bool result = false;

	d[0] = 0;
	while(i < N * 2) {
		cin >> d[i] >> d[i + 1];
		if (d[i] == d[i + 1]) {
			if (ans > 0) {
				ans++;
			}
			else {
				ans = 1;
			}
		}
		else {
			ans = 0;
		}
		if (ans == 3) {
			result = true;
		}
		i += 2;
	}

	if (result) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}
}

Measured memory_bytes: 3640
import java.util.*;

public class Main {
  public static void main(String[] args ) throws Exception {
    Scanner sc = new Scanner(System.in);
    int Age = sc.nextInt();
    int Fee = sc.nextInt();
    
    if(Age<6){
    	Fee=0;
    }else if(Age<13){
      Fee=Fee/2;
    }
    System.out.println(Fee);
  }
}


Measured memory_bytes: 23764
#include "bits/stdc++.h"
using namespace std;
#define FOR(i,a,b) for(int i =(a);i<(b);i++)
#define REP(i,n) for(int i=0;i<(n);i++)
#define REPm(i,n) for(int i=(n)-1;i>=0;i--)
#define REP1(i,n) for(int i=1;i<=(n);i++)
typedef long long ll;
int main(){
    int N,M,K;
    cin >> N >> M >> K;
    REP(i,N+1){
        REP(j,M+1){
            if(i*M+j*N-2*i*j == K){
                cout << "Yes" << endl;
                return 0;
            }
        }
    }
    cout << "No" << endl;
    return 0;
}


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

vector<int> to[200005];
vector<int> ans;

void dfs(int v, int p = -1) {
  for (int u : to[v]) {
    if (u == p)
      continue;
    ans[u] += ans[v];
    dfs(u, v);
  }
}

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

  rep(i, N - 1) {
    int a, b;
    cin >> a >> b;
    --a, --b;
    to[a].push_back(b);
    to[b].push_back(a);
  }
  ans.resize(N);

  rep(i, Q) {
    int p, x;
    cin >> p >> x;
    --p;
    ans[p] += x;
  }

  dfs(0);
  rep(i, N) { cout << ans[i] << endl; }
  return 0;
}

Measured memory_bytes: 23424
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll mod=1e9+7;
const ll INF=mod*mod;
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define all(x) (x).begin(),(x).end()
ll min(ll a,ll b){
  if(a>b){
    return b;
    }
      else{
        return a;
      }
  }
  
  ll max(ll a,ll b){
    if(a>b){
      return a;
    }
    else{
      return b;
    }
  }

ll power(ll a,ll b){
 ll ans=1;
 for(ll i=1;i<=b;i++){
ans*=a;
  }
  return ans;
}

 ll gcd(ll m,ll n){
 	if(n==0){
       return m;
     }
   return gcd(n,m%n);
 }
ll lcm(ll a,ll b){
  ll g=gcd(a,b);
  return a/gcd(a,b)*b;
		

}
int main(){
  ll H,W;
  cin>>H>>W;
  
  vector<vector<char>>S(H,vector<char>(W));
  vector<vector<ll>>s(H,vector<ll>(W));
  
  rep(i,H){
rep(j,W){
  cin>>S[i][j];
}
  }

  //右方向
  rep(i,H){
    ll sum=-1;
    rep(j,W){
      if(S[i][j]!='#'){
        sum++;
        s[i][j]+=sum;
      }
      else{
        sum=-1;
        
      }
    }
  }
  
    //左方向
  for(ll i=H-1;i>=0;i--){
    ll sum=-1;
    for(ll j=W-1;j>=0;j--){
      if(S[i][j]!='#'){
        sum++;
        s[i][j]+=sum;
      }
      else{
        sum=-1;
        
      }
    }
  }

  //下方向
  rep(i,W){
    ll sum=-1;
rep(j,H){
  if(S[j][i]!='#'){
    sum++;
s[j][i]+=sum;
  }
  else{
    sum=-1;
  }
}
  }
  
  //上方向
  for(ll i=W-1;i>=0;i--){
    ll sum=-1;
for(ll j=H-1;j>=0;j--){
  if(S[j][i]!='#'){
    sum++;
s[j][i]+=sum;
  }
  else{
    sum=-1;
  }
}
  }
ll big=0;
  rep(i,H){
rep(j,W){
  big=max(big,s[i][j]);
}
  }

  cout<<big+1<<endl;
  
}




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

using namespace std; 

int main(){ 
  int n,m;
  cin>>n>>m;
  vector<vector<char>> data(n, vector<char>(n)); 

for (int i = 0; i <n ; i++) { 
  for (int j = 0; j < n; j++) { 

cin >> data.at(i).at(j); 

}
} 
  vector<vector<char>> data2(m, vector<char>(m)); 

for (int i = 0; i <m; i++) { 

for (int j = 0; j < m; j++) { 

cin >> data2.at(i).at(j); 

}
} 
  bool y=false;
  for(int i=0;i<n-m+1;i++){
    for(int j=0;j<n-m+1;j++){
      bool x=true;
      for(int a=0;a<m;a++){
        for(int b=0;b<m;b++){
          if(data.at(i+a).at(j+b)!=data2.at(a).at(b)){
            x=false;
            break;
          }
        }
        if(x==false){
          break;
        }
        }
      if(x==true){
        y=true;
        break;
      }
    }
    if(y==true){
      break;
    }
  }

  if(y==false) cout<<"No";
  else cout<<"Yes";
}
  

Measured memory_bytes: 256
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<cmath>
#include<vector>
#define SF scanf
#define PF printf
#define MAXN 100010
using namespace std;
pair<int,int> dp[MAXN][12];
int n,m,q;
vector<int> a[MAXN];
int main(){
	SF("%d%d",&n,&m);
	int u,v;
	for(int i=1;i<=m;i++){
		SF("%d%d",&u,&v);
		a[u].push_back(v);
		a[v].push_back(u);
	}
	SF("%d",&q);
	int d,c;
	for(int i=1;i<=q;i++){
		SF("%d%d%d",&v,&d,&c);
		dp[v][d]=make_pair(i,c);
	}
	for(int k=9;k>=0;k--)
		for(int i=1;i<=n;i++){
			dp[i][k]=max(dp[i][k],dp[i][k+1]);
			for(int j=0;j<int(a[i].size());j++){
				v=a[i][j];
				dp[i][k]=max(dp[i][k],dp[v][k+1]);
			}
		}
	for(int i=1;i<=n;i++)
		PF("%d\n",dp[i][0].second);
}

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

int main(){
    string s;
    int count=0;
    cin >> s;
    if(s.substr(0,1)==s.substr(1,1)){
        count++;
    }
    if(s.substr(0,1)==s.substr(2,1)){
        count++;
    }
    if(s.substr(0,1)==s.substr(3,1)){
        count++;
    }
    if(s.substr(1,1)==s.substr(2,1)){
        count++;
    }
    if(s.substr(1,1)==s.substr(3,1)){
        count++;
    }
    if(s.substr(2,1)==s.substr(3,1)){
        count++;
    }
    
    if(count==2){
        cout<<"Yes";
    }else{
        cout << "No";
    }
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ff first
#define ss second
#define mp make_pair
#define pb push_back
#define nl '\n'
#define INF 2147483647
#define si(i) scanf("%d", &i)
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;

int n, ma, ans;

int main(){
    cin >> n;
    for( int i = 0 ; i < n ; i++ ){
        int ct; cin >> ct;
        ans+= ct;
        ma = max( ct, ma );
    }
    ans -= ma/2;
    cout << ans;
}

Measured memory_bytes: 256
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <ctime>
#include <cstring>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <bitset>
#include <numeric>
#include <utility>
#include <iomanip>
#include <algorithm>
#include <functional>
#include <unordered_map>
using namespace std;

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> vector<T> make_vec(size_t a) { return vector<T>(a); }
template<class T, class... Ts> auto make_vec(size_t a, Ts... ts) {
  return vector<decltype(make_vec<T>(ts...))>(a, make_vec<T>(ts...));
}
template<class T, class V>
typename enable_if<is_class<T>::value == 0>::type fill(T &t, const V &v) {
    t = v;
}
template<class T, class V>
typename enable_if<is_class<T>::value != 0>::type fill(T &t, const V &v){
    for (auto &e : t) fill(e, v);
}

#define COUT(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl
template<class T1, class T2> ostream& operator << (ostream &s, pair<T1,T2> P)
{ return s << '<' << P.first << ", " << P.second << '>'; }
template<class T> ostream& operator << (ostream &s, vector<T> P)
{ for (int i = 0; i < P.size(); ++i) { if (i > 0) { s << " "; } s << P[i]; } return s; }
template<class T> ostream& operator << (ostream &s, vector<vector<T> > P)
{ for (int i = 0; i < P.size(); ++i) { s << endl << P[i]; } return s << endl; }

#define EACH(i, s) for (__typeof__((s).begin()) i = (s).begin(); i != (s).end(); ++i)
template<class T> ostream& operator << (ostream &s, set<T> P)
{ EACH(it, P) { s << "<" << *it << "> "; } return s << endl; }
template<class T1, class T2> ostream& operator << (ostream &s, map<T1,T2> P)
{ EACH(it, P) { s << "<" << it->first << "->" << it->second << "> "; } return s << endl; }



int main() {
    long long A, B, T;
    while (cin >> A >> B >> T) {
        long long num = T / A;
        cout <<  num * B << endl;
    }
}   

Measured memory_bytes: 256
#include<algorithm>
#include<iostream>
#include<vector>
#include<string>
#include<queue>
#include<stack>
#include<cmath>
#include<list>
#include<set>
#include<map>

using namespace std;
long long MOD = 1000000007LL;
const double PI = 3.14159265358979323846;
#undef INT_MIN
#undef INT_MAX
#define INT_MIN -2147483648
#define INT_MAX 2147483647
#define endl "\n"

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

	vector<long long> A(N);
	vector<long long> B(M);

	for (long long i = 0; i < N; ++i) {
		cin >> A[i];
		if (i != 0) {
			A[i] += A[i - 1];
		}
	}
	for (long long i = 0; i < M; ++i) {
		cin >> B[i];
		if (i != 0) {
			B[i] += B[i - 1];
		}
	}

	int count = 0;
	int preJ = M - 1;

	for (int i = 0; i < N; ++i) {
		if (A[i] <= K) {
			count = max(count, i + 1);
			for (int j = preJ; 0 <= j; --j) {
				if (A[i] + B[j] <= K) {
					count = max(count, i + j + 2);
					break;
				}
				else {
					preJ = j;
				}
			}
		}
		else {
			break;
		}
	}

	for (int i = 0; i < M; ++i) {
		if (B[i] <= K) {
			count = max(count, i + 1);
		}
		else {
			break;
		}
	}

	cout << count << endl;
	return 0;
}

Measured memory_bytes: 6424
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>	
#include<map>
#include<set>
#include<utility>
#include<cmath>
#include<cstring>
#include<queue>
#include<stack>
#include<cstdio>
#include<sstream>
#include<iomanip>
#include<assert.h>
#define loop(i,a,b) for(int i=a;i<b;i++) 
#define rep(i,a) loop(i,0,a)
#define pb push_back
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)
using namespace std;
//kaewasuretyuui
typedef long long ll;
typedef int Def;
typedef pair<Def,Def> pii;
typedef vector<Def> vi;
typedef vector<vi> vvi;
typedef vector<pii> vp;
typedef vector<vp> vvp;
typedef vector<string> vs;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef pair<Def,pii> pip;
typedef vector<pip>vip;
//#define mt make_tuple
//typedef tuple<double,int,double> tp;
//typedef vector<tp> vt;
template<typename A,typename B>bool cmin(A &a,const B &b){return a>b?(a=b,true):false;}
template<typename A,typename B>bool cmax(A &a,const B &b){return a<b?(a=b,true):false;}
const double PI=acos(-1);
const double EPS=1e-7;
Def inf=sizeof(Def)==sizeof(long long)?2e18:1e9;
int dx[]={0,1,0,-1};
int dy[]={1,0,-1,0};
struct edge{int to,cap,rev;};//ikisaki youryou gyakuhen
class MF{//max flow
	public:
	int n;
	vector<vector<edge> >G;//[MAX];
	vi level,iter;//[MAX];
	MF(int size){
		n=size;
		G=vector<vector<edge> >(n);
	}
	void add_edge(int from, int to, int cap){
		edge q={to,cap,int(G[to].size())};
		G[from].push_back(q);
		q={from,0,int(G[from].size()-1)};
		G[to].push_back(q);
	}
	void bfs(int s){
		level=vi(n,-1);
		queue<int>q;
		level[s]=0;
		q.push(s);
		while(!q.empty()){
			int v=q.front();q.pop();
			for(int i=0;i<G[v].size();i++){
				edge &e=G[v][i];
				if(e.cap>0&&level[e.to]<0){
					level[e.to]=level[v]+1;
					q.push(e.to);
				}
			}
		}
	}
	int dfs(int v,int t, int f) {
		if(v==t)return f;
		for(int &i=iter[v];i<G[v].size();i++){
			edge &e=G[v][i];
			if(level[v]>=level[e.to]||e.cap<=0) continue;
			int d =dfs(e.to,t,min(f,e.cap));
			if(d>0){
				e.cap-=d;
				G[e.to][e.rev].cap+=d;
				return d;
			}
		}
		return 0;
	}
	int mf(int s,int t) {//from s to t,ford_fulkerson
		int flow=0;
		while(1){
			bfs(s);
			if(level[t]<0)return flow;
			iter=vi(n);
			int f;
			while((f=dfs(s,t,inf))>0)flow+=f;
		}
	}
};
int main(){
	int n;
	cin>>n;
	MF mf(2*n+4);
	int s=2*n+2,t=s+1;
	rep(i,n+1)mf.add_edge(s,i,1);
	rep(i,n+1)mf.add_edge(n+i+1,t,1);
	int sum=0;
	rep(i,n){
		int a;cin>>a;
		mf.add_edge(a,n+i+2,1);
		mf.add_edge(i+1,n+a+1,1);
		sum+=mf.mf(s,t);
		cout<<sum/2<<endl;
	}
}

Measured memory_bytes: 3980
#include <bits/stdc++.h>
using namespace std;
bool check(int num, vector<int> v) {
  for(auto& itr : v) if(num == itr) return true;
  return false;
}
int main() {
  int n; cin >> n;
  n %= 10;
  if(n == 3) cout << "bon";
  else if(check(n, {0,1,6,8})) cout << "pon";
  else cout << "hon";
  cout << "\n";
  return 0;
}

Measured memory_bytes: 3592
#include<stdio.h>
#include <string.h>
int main(void){
int A,i;
  scanf("%d",&A);
char B[A];
int cnt=1;
  scanf("%s",B);
    for (i=0;i<A-1;i++){
  if(B[i] != B[i+1] ){
  cnt++;
  }
  }
  printf("%d",cnt);
  return 0;
}

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

#define MOD 1000000007

long long int power(long long int x, long long int y) 
{
    
    if (y == 0){
        return 1;
    }
    
    long long int ans = power(x, y/2);
    ans = (ans * ans) % MOD;

    if(y % 2) ans = (ans * x) % MOD;
    return ans;
}

int main(){
    long long int n;

    cin >> n;

    if (n < 2){
        cout << 0 << endl;
        return 0;
    }

    if (n == 2){
        cout << 2 << endl;
        return 0;
    }

    long long int temp1 = power(10, n);
    long long int temp2 = power(8, n);
    long long int temp3 = power(9, n);

    long long int ans = 0;
    ans = (ans + temp1 + MOD)%MOD;
    ans = (ans + temp2 + MOD)%MOD;
    ans = (ans - temp3 + MOD)%MOD;
    ans = (ans - temp3 + MOD)%MOD;

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 3560
#include <iostream>

using namespace std;
long long dp[110][100010] = {},mod = 1000000007,a[110];
int main(){
	int i,j,n,k;
	cin >> n >> k;
	dp[0][0] = 1;
	for(i=1;i<=n;i++) cin >> a[i];
	for(i=1;i<=n;i++){
		for(j=0;j<=k;j++){
			(dp[i][j] += dp[i-1][j]) %= mod;
			if(j+a[i]+1<=k) (dp[i][j + a[i] + 1] += mod - dp[i-1][j]) %= mod;
		}
		for(j=1;j<=k;j++){
			(dp[i][j] += dp[i][j-1]) %= mod;
		}
	}
	cout << dp[n][k] << endl;
}

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

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  string a, b, c;
  cin >> a >> b >> c;
  if(a[a.size() - 1] == b[0] && b[b.size() - 1] == c[0]) {
    cout << "YES" << endl;
  } else {
    cout << "NO" << endl;
  }
  return 0;
}

Measured memory_bytes: 384
#include<cstdio>
#include<cstring>
#include<algorithm>
#define N 100010
#define ll long long
using namespace std;
int n, a[N];
inline int gcd(int a, int b){return b?gcd(b, a%b):a;}
inline int solve(){
	ll s=0; int sum, p, g;
	for(int i=1; i<=n; i++)s+=a[i];
	s-=n; if(s&1)return 1;
	sum=p=0; for(int i=1; i<=n; i++)if(a[i]&1){sum++; p=i;}
	if(sum>=2)return 0;
	if(a[p]==1)return 0;
	a[p]--; g=0;
	for(int i=1; i<=n; i++)g=gcd(g, a[i]);
	for(int i=1; i<=n; i++)a[i]/=g;
	return solve()^1;
}
int main(){
	scanf("%d", &n);
	for(int i=1; i<=n; i++)scanf("%d", &a[i]);
	if(solve())printf("First"); else printf("Second");
	return 0;
}

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

int ans,sum,n,a,b,c,pp;
vector <int> piza;

int main(){

    cin >> n >> a >> b >> c;

    for(int i=0;i<n;i++){
        int d;
        cin>>d;
        piza.push_back(d);
    }

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

    sum=piza[n-1]+c;
    ans=sum/(a+b);
    pp=2;

    for(int i=n-2;i>=0;i--){
        sum+=piza[i];
        if(ans<=sum/(a+b*(pp)))ans=sum/(a+b*(pp++));
        else break;
    }

    cout << ans << endl;



return 0;
}

Measured memory_bytes: 1220
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define loop(i,a,b) for (int i=a; i<b; ++i)
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll N;
    cin >> N;
    vector <ll> X(N);
    loop(i,0,N)cin >> X[i];
    sort(X.begin(), X.end());
    loop(i,0,N-1)
    {
        if (X[i]==X[i+1]) {
            cout << "NO\n";
            return 0;
        }
    }
    cout << "YES\n";
    return 0;
}

Measured memory_bytes: 1792
#include <iostream>
#include <sstream>
#include <stdio.h>
#include <cstring>
#include<vector>
#include<climits>
#include<algorithm>
#include<bitset>
#include<cmath>
#include<functional>
#include <numeric>
#include <map>
#include <tuple>
#include <string>
#define FORi(N) for(int i=0;i<N;++i)
#define FORj(N) for(int j=0;j<N;++j)
#define FORk(N) for(int k=0;k<N;++k)
using namespace std;
using ll = long long;
using ull = unsigned long long;
using ld = long double;
ll gcd(ll m,ll n){
  if(n==0)return abs(m);
  return(gcd(n,m%n));
}
void putYN(bool b){
  if(b){
    cout<<"Yes"<<endl;
  }else{
    cout<<"No"<<endl;
  }
}
void swap(ll &a,ll &b){
  ll tmp=a;
  a=b;
  b=tmp;
}
int main(){
  ll N,K;
  cin>>N>>K;
  if(K==1){
    cout<<0<<endl;
  }else{
    cout<<N-K<<endl;
  }
  return 0;
}


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

int main(){
  int n, k;
  cin >> n >> k;
  vector<bool>a(n, false);
  rep(i,k){
    int d;
    cin >> d;
    rep(j, d){
      int m;
      cin >> m;
      a.at(m-1) = true;
    }
  }
  int ans = 0;
  rep(i, n){
    if(a.at(i) == false){
      ans++;
    }
  }
  cout << ans << endl;


}


Measured memory_bytes: 3544