akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#include <unordered_map>
#include <queue>
#include <deque>
#define MOD 1000000007
#define REP(i,num)for(int i=0;i<(num);++i)
#define ll long long
using namespace std;

struct Edge {
    int x,y,v;
};

int main() {
    ios::sync_with_stdio(false);
    int L,x=2,v=1,longV=0,n;
    cin>>L;
    vector<Edge> edges;
    while (L>=(1<<(x-1))) {
        Edge e1,e2;
        e1.x=x-1;e1.y=x;e1.v=0;
        e2.x=x-1;e2.y=x;e2.v=(1<<(x-2));
        edges.push_back(e1);
        edges.push_back(e2);
        x++;
    }
    longV=(1<<(x-2));
    n=--x;
    if (L!=(1<<(x-1))) {
        L-=(1<<(x-1));
        x=n;
        while (L>0) {
            --x;
            if(L>=(1<<(x-1))){
                L-=(1<<(x-1));
                Edge e;
                e.x=x;e.y=n;e.v=longV;
                edges.push_back(e);
                longV+=(1<<(x-1));
            }
        }
    }
    
    cout<<n<<" "<<edges.size()<<endl;
    for(auto edge: edges){
        cout<<edge.x<<" "<<edge.y<<" "<<edge.v<<endl;
    }
    return 0;
}


Measured memory_bytes: 256
typedef long long ll;
#include <bits/stdc++.h>
using namespace std;
template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
    std::fill( (T*)array, (T*)(array+N), val );
}

int main() {
    string s;
    std::cin >> s;
    stack<char> ss;
    ll result  = 0;
    for (int i = 0; i < s.length(); i++) {
        if( ss.empty() ){
            ss.push(s[i]);
        }else{
            if( ss.top() == s[i] ){
                ss.push(s[i]);
            }else{
                ss.pop();
                result+=2;
            }
        }
    }
    std::cout << result << std::endl;
}

Measured memory_bytes: 512
#include<bits/stdc++.h>
using namespace std;
int main()
{
  int d,i,c,a[10000];
  int sum=0;
  cin>>d;
  for(i=0;i<d;i++)
  {
    cin>>a[i];
  }
  sort(a,a+d);
  for(i=0;i<d;i++)
  {
    
   
    if(i==d-1)
    {
      int z=a[i];
      c=(int)z/2;
      sum=sum+c;
      break;
    }
    sum=sum+a[i];
  }

  cout<<sum<<endl;
  return 0;
}


Measured memory_bytes: 3616
#include <bits/stdc++.h>
using namespace std;
int main(){
  int n;
  cin >> n;
  string s;
  cin >> s;
  int countR = 0;
  int countW = 0;
  for(int i = 0;i < n;i++){
    if(s.at(i) == 'R') countR++;
    else countW++;
  }
  int count = 0;
  for(int i = 0;i < countR;i++){
    if(s.at(i) == 'W') count++;
  }
  cout << count << endl;
}


Measured memory_bytes: 3728
//
//  main.cpp
//  3
//
//  Created by RISHAV SINGH MEHTA on 29/12/19.
//  Copyright © 2019 RISHAV SINGH MEHTA. All rights reserved.
//

#include<iostream>
using namespace std;
int a[10001000];
int i,j;
int n;
void pk()
{
    int maxn=10000000;
    a[2]=1;
    for(i=3; i<=maxn; i++)
    {
        if(i%2==1)
            a[i]=1;
    }
    for(i=3; i<=maxn; i+=2)
    {
        if(a[i]==1)
        {
            for(j=3*i; j<=maxn; j+=2*i)
            {
                a[j]=0;
            }
        }
    }
    
}
int main()
{
    pk();
    cin>>n;
    {
        if(a[n]!=0)
            cout<<n<<endl;
        else {
            int i=n;
            while(a[i]==0){
                i++;
            }
            cout<<i<<endl;
        }
    }
}


Measured memory_bytes: 39296
#include<iostream>
#include<vector>
using namespace std;
int a;
int main()
{
  cin>>a;
  vector<bool> expo(a + 5);
  expo[1] = 1;
  for (int i = 2;i<=31;i++)
  {
    int v = i * i;
    while(v<=a)
    {
      expo[v] = 1;
      v *= i;
    }
  }
  for (int i = a; i >= 1; i--)
  {
    if(expo[i])
    {
      cout << i << endl;
      return 0;
    }
  }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
 
vector<vector<int>> anser;
int n;
bool input(){
  cin>>n;
  if(n == 0)return false;
  return true;
}
 
void solve(){
  int c = n/2;
  int h = n/2+1;
  anser.clear();
  anser.resize(n);
  for(int i = 0;i < n;i ++){
    anser[i].resize(n);
  }
  int count = 1;
  while(1){
    if(anser[h][c]==0){
      anser[h][c] = count;
    }else{
      h=(h+n+1)%n;
      c=(c+n-1)%n;
      anser[h][c] = count;
    }
    count++;
    h=(h+n+1)%n;
    c=(c+n+1)%n;
    if(count == 1+n*n)return ;
  }
}
 
void output(){
  const auto ans = anser;
  for(int i = 0;i < ans.size(); i++){
    for(int j = 0 ;j < ans[i].size(); j++){
      printf("%4d", ans[i][j]);
    }cout<<endl;
  }
}
 
int main(){
  while(input()){
    solve();
    output();
  }
}

Measured memory_bytes: 3260
#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <string>
#include <algorithm>
#include <map>
#include <vector>
#include <deque>
#include <stack>
#include <queue>
#include <set>
#include <unordered_map>
#define mod 1e9+7
#define ll long long
using namespace std;
int T;
int main() {
    char a[100],b[100];
    scanf("%s",a);
    getchar();
    scanf("%s",b);
    int n=strlen(a);
    for(int i=0;i<n;i++)
    {
        if(a[i]!=b[i])
        {
            printf("No");
            return 0;
        }
    }
    printf("Yes");
//    for (cin >> T; T; T--) {
//    }
}

Measured memory_bytes: 3228
#include<stdio.h>

int main()
{
	int a,b,c,d,e,f,g;

	scanf("%d",&a);
	b=a/60;
	c=b/60;
	a=a-b*60;
	b=b-c*60;

	printf("%d:%d:%d\n",c,b,a);
}


Measured memory_bytes: 2108
#include<bits/stdc++.h>
#define fi first
#define se second
#define pb push_back
using namespace std;
typedef long long LL;
typedef pair<int, int> pii;
const int MOD=1e9+7;
bool adj[22][22];
int memo[21][(1 << 21)];
int n;
int solve(int ix, int mask)
{
	if(mask==(1 << n)-1) return 1;
	if(ix >= n) return 0;
	int ret=0;
	if(memo[ix][mask]!=-1) return memo[ix][mask];
	for(int a=0;a<n;a++)
	{
		if(!adj[ix][a]) continue;
		if((mask & (1 << a)) > 0) continue;
		ret+=solve(ix+1, mask|(1 << a));
		ret%=MOD;
	}
	return memo[ix][mask]=ret;
}
int main()
{
	scanf("%d", &n);
	for(int a=0;a<n;a++)
	{
		for(int b=0;b<n;b++)
		{
			scanf("%d", &adj[a][b]);
		}
	}
	memset(memo, -1, sizeof(memo));
	int hasil=solve(0, 0);
	hasil%=MOD;
	printf("%d\n", hasil);
	return 0;
}

Measured memory_bytes: 172288
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>

#include <iostream>
#include <string>

#include <algorithm>
#include <deque>
#include <map>
#include <queue>
#include <set>
#include <vector>

#define PB push_back
#define MP make_pair

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

#define ALL(v) (v).begin(),(v).end()

using namespace std;

typedef long long LL;
typedef unsigned long long ULL;

typedef pair<int, int> PII;

typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef vector<PII> VPII;

const int MOD = 1000000007;
const int INF = 1e9;

const double EPS = 1e-9;
const double PI = acos(-1.0);

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

int N, M;
int s[6], c[6];

string t = "000";
int num[4] = {-1, -1, -1};

int main() {
    cin >> N >> M;
    REP (i, M) {
        cin >> s[i] >> c[i];
        if (num[s[i] - 1] == -1) {
            num[s[i] - 1] = c[i];
        }
        else {
            if (num[s[i] - 1] != c[i]) {
                cout << -1 << endl;
                return 0;
            }
        }
    }
    if (N > 1 && num[0] == 0) {
        cout << -1 << endl;
        return 0;
    }
    if (N == 1 && num[0] == 0) {
        cout << 0 << endl;
        return 0;
    }
    if (N == 1 && M == 0) {
        cout << 0 << endl;
        return 0;
    }
    bool enc = false;
    REP (i, N) {
        if (num[i] > -1) {
            if (!enc && num[i] == 0) {
                num[0] = 1;
                FOR (j, 1, i) {
                    num[j] = 0;
                }
            }
            enc = true;
        }
        else {
            if (i == 0) {
                num[i] = 1;
            }
            else {
                num[i] = 0;
            }
        }
    }
    REP (i, N) {
        cout << num[i];
    }
    cout << endl;
    return 0;
}


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

using namespace std;
const int N = 1e6+5;
int n,p[N],a[N];

void init(){
	for(int i=2;i<N;i++){
		if(p[i]) continue;
		for(int j=i;j<N;j+=i) p[j]=i;
	}
}

int main(){
	init();
	cin>>n;
	for(int i=1;i<=n;i++) cin>>a[i];
	vector<set<int>>div(n+1);
	for(int i=1;i<=n;i++){
		for(int j=a[i];p[j]!=0;j/=p[j]){
			div[i].insert(p[j]);
//			cout<<div[i].size()<<'\n';
		}
	}
	map<int,int>cnt;
//	int cnt[N];
	bool flag1=1; 
	for(int i=1;i<=n;i++){
		for(const auto &x : div[i]){
//			cout<<x<<'\n';
			if(++cnt[x]>=2){
				flag1=0;
			}
		}
	}
	bool flag2=1;
	int gcd=a[1];
	for(int i=2;i<=n;i++){
		gcd=__gcd(gcd,a[i]);
	}
	if(gcd!=1) flag2=0;
	if(flag1) cout<<"pairwise coprime\n";
	else if(flag2) cout<<"setwise coprime\n";
	else cout<<"not coprime\n";
	
	return 0;
} 

Measured memory_bytes: 294896
#include <iostream>
#include <string>
#include <deque>
#include <vector>
#include <map>
#include <algorithm>
using namespace std;

typedef long long ll;

int main() {
    string s;
    int a, b, c;
    int Min, Max;
    a = 0;
    b = 0;
    c = 0;

    cin >> s;
    for (int i = 0; i < s.size(); i++) {
        if (s[i] == 'a') {
            a++;
        } else if (s[i] == 'b') {
            b++;
        } else {
            c++;
        }
    }
    Min = min({a, b, c});
    Max = max({a, b, c});

    if (Max-Min<=1) {
        cout << "YES" << endl;
    } else {
        cout << "NO" << endl;
    }
}


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

using namespace std;

typedef long long ll;

int H, W;

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


	cin >> H >> W;

	vector<string> S(H);
	rep(i, H) cin >> S[i];

	vector<vector<int>> hs(H, vector<int>(W+1, 0));
	vector<vector<int>> ws(H+1, vector<int>(W, 0));

	rep(i, H){
		rep(j, W){
			if(S[i][j] == '.'){
				hs[i][j+1] = 1;
				ws[i+1][j] = 1;
			}
		}
	}

	rep(i, H){
		rep(j, W){
			if(S[i][j] == '.') hs[i][j+1] += hs[i][j];
		}
	}

	rep(i, H){
		for(int j = W-1; j > 0; j--){
			if(hs[i][j] > 0 && hs[i][j+1] > 0) hs[i][j] = hs[i][j+1];
		}
	}

	// // print
	// rep(i, H){
	// 	rep(j, W+1){
	// 		cout << hs[i][j] << ",";
	// 	}
	// 	cout << endl;
	// }

	rep(i, W){
		rep(j, H){
			if(S[j][i] == '.') ws[j+1][i] += ws[j][i];
		}
	}

	rep(i, W){
		for(int j = H-1; j > 0; j--){
			if(ws[j][i] > 0 && ws[j+1][i]) ws[j][i] = ws[j+1][i];
		}
	}

	// // print
	// rep(i, H+1){
	// 	rep(j, W){
	// 		cout << ws[i][j] << ",";
	// 	}
	// 	cout << endl;
	// }

	ll ans = 0;
	rep(i, H){
		rep(j, W){
			ll t = hs[i][j+1] + ws[i+1][j] - (S[i][j] == '.' ? 1 : 0);
			ans = max(ans, t);
		}
	}

	cout << ans << endl;
}


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

template<long long mod>
class modint{
private:
  long long a;
public:
  constexpr modint(const long long x = 0) noexcept : a(x%mod) {}
  constexpr long long& value() noexcept { return a; }
  constexpr const long long& value() const noexcept { return a; }
  constexpr modint operator+(const modint rhs) const noexcept {
    return modint(*this) += rhs;
  }
  constexpr modint operator-(const modint rhs) const noexcept {
    return modint(*this) -= rhs;
  }
  constexpr modint operator*(const modint rhs) const noexcept {
    return modint(*this) *= rhs;
  }
  constexpr modint operator/(const modint rhs) const noexcept {
    return modint(*this) /= rhs;
  }
  constexpr modint& operator+=(const modint rhs) noexcept {
    a += rhs.a;
    if(a >= mod) a -= mod;
    return *this;
  }
  constexpr modint &operator-=(const modint rhs) noexcept {
    if(a < rhs.a) a += mod;
    a -= rhs.a;
    return *this;
  }
  constexpr modint& operator*=(const modint rhs) noexcept {
    a = a*rhs.a%mod;
    return *this;
  }
  constexpr modint& operator/=(modint rhs) noexcept {
    long long k = mod-2;
    while(k > 0){
      if(k&1){
        *this *= rhs;
      }
      rhs *= rhs;
      k /= 2;
    }
    return *this;
  }
  friend ostream& operator<<(ostream &os, const modint &X){
    return os << X.a;
  }
  friend istream& operator>>(istream &is, modint &X){
    is >> X.a;
    X.a %= mod;
    if(X.a < 0) X.a += mod;
    return is;
  }
};

using mint = modint<(int)1e9+7>;

template<typename T>
T power(T x, long long k){
  T ret{1};
  while(k > 0){
    if(k&1) ret *= x;
    x *= x;
    k /= 2;
  }
  return ret;
}

int main(){
  int N;
  cin >> N;
  vector<long long> C(N);
  for(int i = 0; i < N; ++i) cin >> C[i];
  sort(C.begin(), C.end());
  mint ans = 0;
  for(int i = 0; i < N; ++i){
    int n = N-i-1;
    ans += power<mint>(2,N+n-1+i)*(n+2)*C[i];
  }
  cout << ans << endl;
}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
#define rep(X,N) for(ll X = 0; X < (N); X++)
#define PI (acos(-1.0))
#define pback push_back
#define mpair make_pair
#define MODN 1000000007
#define ALL(V) (V).begin(),(V).end()

typedef long long ll;

using namespace std;



int main(){

    int n;
    cin >> n;

    int ans = 0;

    rep(i,n){
        int k = i + 1;

        int mindigit = k % 10;
        int maxdigit;

        int tmp = k;

        while(tmp >= 10){
            tmp  =  tmp / 10;
        }

        maxdigit = tmp;

        if(mindigit != 0 && maxdigit != 0){

            int p = 10;

            if(mindigit == maxdigit) ans++;

            while(mindigit * p + maxdigit <= n){

                int plus = p/10;

                int tmp2 = mindigit * p + maxdigit + p - 10;

                while(tmp2 > n){
                    plus--;
                    tmp2 = tmp2 - 10;
                }

                ans = ans + plus;
                p *= 10;
            }
            
        }
        
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
// #pragma GCC target("avx2")  // CPU 処理並列化
// #pragma GCC optimize("O3")  // CPU 処理並列化
// #pragma GCC optimize("unroll-loops")  // 条件処理の呼び出しを減らす
#include<stdio.h>
#include<math.h>
#include<algorithm>
#include<queue>
#include<deque>
#include<stack>
#include<string>
#include<string.h>
#include<vector>
#include<set>
#include<map>
#include<bitset>
#include<stdlib.h>
#include<cassert>
#include<time.h>
#include<bitset>
#include<numeric>
using namespace std;
const long long mod=1000000007;
const long long inf=mod*mod;
const long long d2=(mod+1)/2;
const double EPS=1e-10;
const double INF=1e+10;
const double PI=acos(-1.0);
const int C_SIZE = 3121000;
long long fact[C_SIZE];
long long finv[C_SIZE];
long long inv[C_SIZE];
long long Comb(int a,int b){
 	if(a<b||b<0)return 0;
 	return fact[a]*finv[b]%mod*finv[a-b]%mod;
}
void init_C(int n){
	fact[0]=finv[0]=inv[1]=1;
	for(int i=2;i<n;i++){
		inv[i]=(mod-(mod/i)*inv[mod%i]%mod)%mod;
	}
	for(int i=1;i<n;i++){
		fact[i]=fact[i-1]*i%mod;
		finv[i]=finv[i-1]*inv[i]%mod;
	}
}
long long pw(long long a,long long b){
	if(a<0LL)return 0;
	if(b<0LL)return 0;
	long long ret=1;
	while(b){
		if(b%2)ret=ret*a%mod;
		a=a*a%mod;
		b/=2;
	}
	return ret;
}
int ABS(int a){return max(a,-a);}
long long ABS(long long a){return max(a,-a);}
double ABS(double a){return max(a,-a);}
int sig(double r) { return (r < -EPS) ? -1 : (r > +EPS) ? +1 : 0; }
// ここから編集しろ
int p[110];
long long dp[110][110][256];
int main(){
	init_C(300);
	int a,b;scanf("%d%d",&a,&b);
	for(int i=0;i<a;i++)scanf("%d",p+i);
	dp[0][0][0]=1;
	for(int i=0;i<a;i++)for(int j=0;j<=i;j++)for(int k=0;k<256;k++){
		dp[i+1][j][k]=(dp[i+1][j][k]+dp[i][j][k])%mod;
		dp[i+1][j+1][k^p[i]]=(dp[i+1][j+1][k^p[i]]+dp[i][j][k])%mod;
	}
	long long ret=0;
	for(int i=1;i<=a;i++){
		ret=(ret+fact[i]*dp[a][i][b])%mod;
	}
	printf("%lld\n",ret);
}


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

#define ll long long
#define fast_io ios::sync_with_stdio(0); cin.tie(0)
#define infl 1e18L+9
#define inf 1e9L+9
#define sz(a) ((int)a.size())
#define all(a) a.begin(),a.end()

const int mod=1e9L+7; 

void solve(){
  ll n; cin>>n; 
  cout<<n*(n-1)/2<<endl; 
}

int main()
{
	fast_io;
	clock_t beg=clock(); 
	solve(); 
	clock_t end=clock(); 
	fprintf(stderr,"%.2lf sec\n",(double)(end-beg)/CLOCKS_PER_SEC); 
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> ii;
const int N=2e5+5;
string s; 
int n,preB[N],sufW[N];
int main(){
	ios::sync_with_stdio(false);cin.tie(0);
	
	cin>>n>>s;
	// ....### 
	int len=s.length();
	for(int i=0;s[i];i++){
		if(i==0)	preB[i]=(s[i]=='#');
		else	preB[i]=preB[i-1]+ (s[i]=='#');
	} 
	for(int i=len-1;i>=0;i--)	sufW[i]=sufW[i+1]+(s[i]=='.');
	
	int res=1e9;
	for(int i=0;i<len;i++)	res=min(res,preB[i]+sufW[i+1]);
	res=min(res,sufW[0]);
	cout<<res<<'\n';
	return 0;
}

Measured memory_bytes: 2196
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
  
int main(void){
    int n;
    cin >> n;
    
    vector<int> a(n+1);
    vector<int> b(n+1);
    vector<int> c(n);
    a[0] = 0;
    b[0] = 0;
    c[0] = 0;
    
    for(int i=1; i<=n; i++) cin >> a[i];
    for(int i=1; i<=n; i++) cin >> b[i];
    for(int i=1; i<=n-1; i++) cin >> c[i];

    
    int sum = 0;
    for (int i=1; i<=n; i++) {
        sum += b[a[i]];
        if (a[i] == a[i-1] + 1) sum += c[a[i-1]];
    }

    cout << sum << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int an[55566];
void search() {
    an[0] = 1,an[1] = 1;
    for(int i=2;i<=55555;i++){
        if(!an[i]){
            for(int j=2;j*i<=55555;j++){
                an[i*j] = 1;
            }
        }
    }
}
int main() {
  int n, count = 2;
  search();
  cin >> n;
  int prime[n];
  for (int i = 0; i < n;) {
    if ( !an[count] && count % 5 == 1) {
      prime[i] = count;
      i++;
    }
    count++;
  }
  for (int i = 0; i < n; i++) {
    cout << prime[i] <<" ";
  }
  cout<<endl;
  return 0;
}

Measured memory_bytes: 512
#include<iostream>
#include<cstdio>
int main()
{
int a,b,c;
scanf("%d%d%d",&a,&b,&c);
int max = std::max(std::max(a,b),c);
int min = std::min(std::min(a,b),c);
int mid = a+b+c-max-min;
int ans = max-mid+mid-min;
printf("%d",ans);
return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define inf INT_MAX
#define INF LLONG_MAX
#define ll long long
#define ull unsigned long long
#define M (int)(1e9+7)
#define P pair<int,int>
#define PLL pair<ll,ll>
#define FOR(i,m,n) for(int i=(int)m;i<(int)n;i++)
#define RFOR(i,m,n) for(int i=(int)m;i>=(int)n;i--)
#define rep(i,n) FOR(i,0,n)
#define rrep(i,n) RFOR(i,n,0)
#define all(a) a.begin(),a.end()
#define IN(a,n) rep(i,n){ cin>>a[i]; }
const int vx[4] = {0,1,0,-1};
const int vy[4] = {1,0,-1,0};
#define PI 3.14159265
#define F first
#define S second
#define PB push_back
#define EB emplace_back
#define int ll
#define vi vector<int>
#define IP pair<int,P>
#define PP pair<P,P>

int x,y,z,k;
int a[1100],b[1100],c[1100];

signed main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout<<fixed<<setprecision(20);

  cin>>x>>y>>z>>k;
  rep(i,x){
    cin>>a[i];
  }
  rep(i,y){
    cin>>b[i];
  }
  rep(i,z){
    cin>>c[i];
  }

  vi ab;
  rep(i,x){
    rep(j,y){
      ab.PB(a[i]+b[j]);
    }
  }
  sort(all(ab));
  reverse(all(ab));

  vi abc;
  for(int i=0;i<x*y&&i<3001;i++){
    rep(j,z){
      abc.PB(ab[i]+c[j]);
    }
  }

  sort(all(abc));
  reverse(all(abc));

  rep(i,k){
    cout<<abc[i]<<endl;
  }

}

Measured memory_bytes: 43364
#include <stdio.h>

int A;
int B;
int T;

int main(){
    scanf("%d%d%d", &A, &B, &T);
    if(A < 1 || 20 < A || B < 1 || 20 < B || T < 1 || 20 < T){
        return 0;
    }
    B *= (int)(((double)T + 0.5)/(double)A);
    printf("%d\n", B);
    return 0;
}

Measured memory_bytes: 128
a,b,n = map(int,input().split())

from math import floor

def f_ans(X):
  return floor(a*X/b) - a * floor(X/b)

temp = n // b
temp = temp * b
if b == 1:
  print(0)
elif temp > 0:
  print(f_ans(temp-1))
else:
  print(f_ans(n))

# for i in range(1,n+1):
#   print(str(i) + ':' + str(f_ans(i)))


Measured memory_bytes: 9008
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define pb push_back

const int n = 1000000;
const int MAX = 1000001; 
  
// array to store prime factors 
int factor[MAX] = { 0 }; 
  
// function to generate all prime factors 
// of numbers from 1 to 10^6 
void generatePrimeFactors() 
{ 
    factor[1] = 1; 
  
    // Initializes all the positions with their value. 
    for (int i = 2; i < MAX; i++) 
        factor[i] = i; 
  
    // Initializes all multiples of 2 with 2 
    for (int i = 4; i < MAX; i += 2) 
        factor[i] = 2; 
  
    // A modified version of Sieve of Eratosthenes to 
    // store the smallest prime factor that divides 
    // every number. 
    for (int i = 3; i * i < MAX; i++) { 
        // check if it has no prime factor. 
        if (factor[i] == i) { 
            // Initializes of j starting from i*i 
            for (int j = i * i; j < MAX; j += i) { 
                // if it has no prime factor before, then 
                // stores the smallest prime divisor 
                if (factor[j] == j) 
                    factor[j] = i; 
            } 
        } 
    } 
} 
  
// function to calculate number of factors 
int calculateNoOFactors(int n) 
{ 
    if (n == 1) 
        return 1; 
  
    int ans = 1; 
  
    // stores the smallest prime number 
    // that divides n 
    int dup = factor[n]; 
  
    // stores the count of number of times 
    // a prime number divides n. 
    int c = 1; 
  
    // reduces to the next number after prime 
    // factorization of n 
    int j = n / factor[n]; 
  
    // false when prime factorization is done 
    while (j != 1) { 
        // if the same prime number is dividing n, 
        // then we increase the count 
        if (factor[j] == dup) 
            c += 1; 
  
        /* if its a new prime factor that is factorizing n,  
           then we again set c=1 and change dup to the new  
           prime factor, and apply the formula explained  
           above. */
        else { 
            dup = factor[j]; 
            ans = ans * (c + 1); 
            c = 1; 
        } 
  
        // prime factorizes a number 
        j = j / factor[j]; 
    } 
  
    // for the last prime factor 
    ans = ans * (c + 1); 
  
    return ans; 
} 

int32_t main(){
	#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
	#endif
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    generatePrimeFactors();
    int N,sm=0;
    cin>>N;
    for(int i=1;i<N;i++){
        sm+=calculateNoOFactors(i);
    }
    cout<<sm;
    return 0;
}


Measured memory_bytes: 11460
(defun main ()
  (let* ((n (read))
         (a-list (loop for i below n collect (read)))
         (a-sorted-list (sort a-list #'>)))
    (format t "~a~%"
            (loop for i below n
                  for a in a-sorted-list
                  with alice = 0
                  with bob = 0
                  finally (return (- alice bob))
                  do (if (zerop (rem i 2))
                         (setf alice (+ alice a))
                         (setf bob (+ bob a)))))))
(main)

Measured memory_bytes: 14568
#include <bits/stdc++.h>
#define int long long
#define ll long long
using ull = unsigned long long;
using namespace std;
#define dump(x)                             \
    if (dbg) {                              \
        cerr << #x << " = " << (x) << endl; \
    }
#define overload4(_1, _2, _3, _4, name, ...) name
#define FOR1(n) for (ll i = 0; i < (n); ++i)
#define FOR2(i, n) for (ll i = 0; i < (n); ++i)
#define FOR3(i, a, b) for (ll i = (a); i < (b); ++i)
#define FOR4(i, a, b, c) for (ll i = (a); i < (b); i += (c))
#define FOR(...) overload4(__VA_ARGS__, FOR4, FOR3, FOR2, FOR1)(__VA_ARGS__)
#define FORR(i, a, b) for (int i = (a); i <= (b); ++i)
#define bit(n, k) ((n >> k) & 1) /*nのk bit目*/
namespace mydef {
const int INF = 1ll << 60;
const int MOD = 1e9 + 7;
template <class T>
bool chmin(T& a, const T& b) {
    if (a > b) {
        a = b;
        return 1;
    } else
        return 0;
}
template <class T>
bool chmax(T& a, const T& b) {
    if (a < b) {
        a = b;
        return 1;
    } else
        return 0;
}
void Yes(bool flag = true) {
    if (flag)
        cout << "Yes" << endl;
    else
        cout << "No" << endl;
}
void No(bool flag = true) {
    Yes(!flag);
}
void YES(bool flag = true) {
    if (flag)
        cout << "YES" << endl;
    else
        cout << "NO" << endl;
}
void NO(bool flag = true) {
    YES(!flag);
}
template <typename A, size_t N, typename T>
void Fill(A (&array)[N], const T& val) {
    std::fill((T*)array, (T*)(array + N), val);
}
bool dbg = false;
}  // namespace mydef
using namespace mydef;
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define lb lower_bound
#define ub upper_bound
#define all(v) (v).begin(), (v).end()
#define SZ(x) ((int)(x).size())
#define vi vector<int>
#define vvi vector<vector<int>>
#define vp vector<pair<int, int>>
#define vvp vector<vector<pair<int, int>>>
#define pi pair<int, int>
//#define P pair<int, int>
//#define V vector<int>
//#define S set<int>
#define asn ans

int N, x, ans[201010];
int used[201011];

void solve() {
}

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

    cin >> N >> x;
    if (x == 1 || x == N * 2 - 1) {
        No();
        return 0;
    }
    Yes();
    if (N == 2) {
        cout << 1 << endl
             << 2 << endl
             << 3 << endl;
        return 0;
    }
    ans[N] = x;
    used[x] = 1;
    if (x >= N) {
        ans[N - 1] = N * 2 - 1;
        ans[N - 2] = 1;
        ans[N + 1] = 2;
        used[2 * N - 1] = 1;
        used[1] = 1;
        used[2] = 1;
    } else {
        ans[N - 1] = 1;
        ans[N - 2] = N * 2 - 1;
        ans[N + 1] = N * 2 - 2;
        used[N * 2 - 1] = 1;
        used[N * 2 - 2] = 1;
        used[1] = 1;
    }

    int now = 1;
    for (int i = 1; i <= N * 2 - 1; i++) {
        if (ans[i] == 0) {
            while (used[now])
                now++;
            used[now] = 1;
            ans[i] = now;
        }
    }

    for (int i = 1; i <= N * 2 - 1; i++)
        cout << ans[i] << endl;

    solve();
    return 0;
}


Measured memory_bytes: 6712
#include<iostream>
#include<stdio.h>
#include<algorithm>
#include<string>
#include<math.h>
#include<vector>
#include<iomanip>
using namespace std;

long long int gcd(long long int x, long long int y)
{
	if (y == 0) { return x; }
	return gcd(y, x % y);
}

int main(void)
{
	int a, b;
	cin >> a >> b;
	if (a == 1) { if (b == 2) { cout << 3 << endl; } else { cout << 2 << endl; }}
	else if (a == 2) { if (b == 1) { cout << 3 << endl; } else { cout << 1 << endl; }}
	else { if (b == 1) { cout << 2 << endl; } else { cout << 1 << endl; } }
	return 0;
}


Measured memory_bytes: 256
import std.stdio, std.string, std.conv;
import std.range, std.algorithm, std.array;

void main() {
    int n, m;
    scan(n, m);

    auto uf = WeightedUnionFind!(int)(n + 1);
    bool ok = 1;

    foreach (i ; 0 .. m) {
        int l, r, d;
        scan(l, r, d);

        if (uf.same(l, r)) {
            if (uf.diff(l, r) != d) {
                ok = 0;
            }
        }
        else {
            uf.merge(l, r, d);
        }
    }

    writeln(ok ? "Yes" : "No");
}



struct WeightedUnionFind(T) {
    private {
        int[] _parent, _rank;
        T[] _diff;
    }

    this(int N) {
        _parent = new int[](N);
        _rank = new int[](N);
        _diff = new T[](N);

        foreach (i ; 0 .. N) {
            _parent[i] = i;
        }
    }

    int findRoot(int x) {
        if (_parent[x] != x) {
            int r = findRoot(_parent[x]);
            _diff[x] += _diff[_parent[x]];
            _parent[x] = findRoot(r);
        }

        return _parent[x];
    }

    bool same(int x, int y) {
        return findRoot(x) == findRoot(y);
    }

    T weight(int x) {
        findRoot(x);
        return _diff[x];
    }

    // x と y が異なるグループに属すならinf(十分大きい値)を返す
    T diff(int x, int y) {
        return same(x, y) ? weight(y) - weight(x) : T.max;
    }

    import std.algorithm : swap;

    // weight(y) = weight(x) + w
    bool merge(int x, int y, T w) {
        w += weight(x) - weight(y);

        int u = findRoot(x);
        int v = findRoot(y);

        // x と y　が既に同じグループであるなら距離の更新はしない
        if (u == v) return false;

        if (_rank[u] < _rank[v]) {
            swap(u, v);
            w = -w;
        }

        if (_rank[u] == _rank[v]) {
            _rank[u]++;
        }

        _parent[v] = u;
        _diff[v] = w;

        return true;
    }
}



void scan(T...)(ref T args) {
    import std.stdio : readln;
    import std.algorithm : splitter;
    import std.conv : to;
    import std.range.primitives;

    auto line = readln().splitter();
    foreach (ref arg; args) {
        arg = line.front.to!(typeof(arg));
        line.popFront();
    }
    assert(line.empty);
}



void fillAll(R, T)(ref R arr, T value) {
    static if (is(typeof(arr[] = value))) {
        arr[] = value;
    }
    else {
        foreach (ref e; arr) {
            fillAll(e, value);
        }
    }
}


Measured memory_bytes: 4476
#include <iostream>
#include <algorithm>
#include <tuple>
#include <vector>
#include <string>
#include <queue>

using namespace std;

int main()
{
    int k, n;
    cin >> k >> n;
    vector<int> a(n, 0);
    int len=0;
    for(int i = 0; i<n; i++){
        cin >> a[i];
        if(i != 0){
            len = max(len, a[i]-a[i-1]);
        }
    }
    len = max(len, k-a[n-1] + a[0]);

    cout << k-len << endl;
    return 0;
}

Measured memory_bytes: 1024
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define ALL(v) v.begin(), v.end()
typedef long long ll;

#include <bits/stdc++.h>
using namespace std;


int main(){
  int n,q;
  cin>>n;
  
  int S[100010],T[50010];
  rep(i,n) cin>>S[i];
  
  cin>>q;
  rep(i,q) cin>>T[i];
  
  ll ans=0;
  rep(i,q){
    if(binary_search(S,S+n,T[i])) ans++;
  }
  cout<<ans<<endl;
  
  return 0;
}


Measured memory_bytes: 3656
n = int(input())
S = list(map(int, input().split()))
q = int(input())
T = list(map(int, input().split()))
S.sort()
ans = 0
for t in T:
    l = -1
    r = n
    while r-l > 1:
        mid = (r+l)//2
        if S[mid] <= t:
            l = mid
        else:
            r = mid
    if l != -1 and S[l] == t:
        ans += 1
print(ans)



Measured memory_bytes: 16708
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int x = sc.nextInt();
        int y = sc.nextInt();
        int z = sc.nextInt();

        int ans = 0;

        int quo = (x - z) / (y + z);
        ans = quo;

        System.out.println(ans);
    }
}


Measured memory_bytes: 23636
import java.io.*;
import java.util.*;
class Main{
	static final long MOD = 1_000_000_007; // 10^9+7
    static final int MAX = 2_147_483_646; // intMax 
    static final int INF = 1_000_000_000; // 10^9  
    public static void main(String[] args) throws Exception {
		hayami saori = new hayami();
		int r = saori.saori_hayami();
		int g = saori.saori_hayami();
		int b = saori.saori_hayami();
		System.out.println((r*100+g*10+b) % 4 == 0 ? "YES" : "NO");
		saori.close();
    }
}

class hayami implements Closeable {
	private final InputStream in = System.in;
	private final byte[] hayami = new byte[1024];
	private int Hayami = 0;
	private int saori = 0;
	private boolean HayamiSaori() {
		if (Hayami < saori) {
			return true;
		}else{
			Hayami = 0;
			try {
				saori = in.read(hayami);
			} catch (IOException e) {
				e.printStackTrace();
			}
			if (saori <= 0) {
				return false;
			}
		}
		return true;
	}
	private int SaoriHayami() { 
		if (HayamiSaori()) {
            return hayami[Hayami++];
         }else{
             return -1;
         }
	}
	private static boolean hayami_saori(int hayami) { 
		return 33 <= hayami && hayami <= 126;
	}
	public boolean hayamisaori() { 
		while(HayamiSaori() && !hayami_saori(hayami[Hayami])) Hayami++; return HayamiSaori();
	}
	public String nextHayami() {
		if (!hayamisaori()) throw new NoSuchElementException();
		StringBuilder hayamin = new StringBuilder();
		int saori = SaoriHayami();
		while(hayami_saori(saori)) {
			hayamin.appendCodePoint(saori);
			saori = SaoriHayami();
		}
		return hayamin.toString();
	}
	public long saorihayami() {//nextLong
		if (!hayamisaori()) throw new NoSuchElementException();
		long hayami = 0;
		boolean misao = false;
		int saori = SaoriHayami();
		if (saori == '-') {
			misao = true;
			saori = SaoriHayami();
		}
		if (saori < '0' || '9' < saori) {
			throw new NumberFormatException();
		}
		while(true){
			if ('0' <= saori && saori <= '9') {
				hayami *= 10;
				hayami += saori - '0';
			}else if(saori == -1 || !hayami_saori(saori)){
				return misao ? -hayami : hayami;
			}else{
				throw new NumberFormatException();
			}
			saori = SaoriHayami();
		}
	}
	public int saori_hayami() {//nextInt
		long hayami = saorihayami();
		if (hayami < Integer.MIN_VALUE || hayami > Integer.MAX_VALUE) throw new NumberFormatException();
		return (int) hayami;
	}
	public double Hayamin() { //nextDouble
		return Double.parseDouble(nextHayami());
	}
	public void close() {
		try {
			in.close();
		} catch (IOException e) {
		}
    }
    
}

Measured memory_bytes: 22484
// atcoder/abc126/A/main.cpp
// author: @___Johniel
// github: https://github.com/johniel/

#include <bits/stdc++.h>

#define each(i, c) for (auto& i : c)
#define unless(cond) if (!(cond))

using namespace std;

typedef long long int lli;
typedef unsigned long long ull;
typedef complex<double> point;

template<typename P, typename Q> ostream& operator << (ostream& os, pair<P, Q> p) { os << "(" << p.first << "," << p.second << ")"; return os; }
template<typename P, typename Q> istream& operator >> (istream& is, pair<P, Q>& p) { is >> p.first >> p.second; return is; }
template<typename T> ostream& operator << (ostream& os, vector<T> v) { os << "("; each (i, v) os << i << ","; os << ")"; return os; }
template<typename T> istream& operator >> (istream& is, vector<T>& v) { each (i, v) is >> i; return is; }

template<typename T> inline T setmax(T& a, T b) { return a = std::max(a, b); }
template<typename T> inline T setmin(T& a, T b) { return a = std::min(a, b); }

int main(int argc, char *argv[])
{
  ios_base::sync_with_stdio(0);
  cin.tie(0);

  string s;
  int n, k;
  while (cin >> n >> k >> s) {
    s[k - 1] = tolower(s[k - 1]);
    cout << s << endl;
  }

  return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
#include<stdbool.h>
#include<string.h>
#include<math.h>
#include<stdlib.h>
#define rep(i,n) for(int i=0; i <(n); i++)
int main(){
  int h1,m1,h2,m2,k;
  scanf("%d%d%d%d%d",&h1,&m1,&h2,&m2,&k);
  int num = h2*60+m2-h1*60-m1;
  printf("%d\n",num-k);
  return 0;
}


Measured memory_bytes: 1736
//============================================================================
// Name        : Hello5.cpp
// Author      :
// Version     :
// Copyright   : Your copyright notice
// Description : Hello World in C++, Ansi-style
//============================================================================

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




int main() {
	string s;
	cin>>s;
	int ans=0;

rep(i,s.size()){
	int j=s.size();
if(s[i]!=s[j-1-i]){
	ans++;
}
}
cout<<ans/2<<endl;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
//#include <iomanip>
//#include <string>
//#include <vector>
#include <algorithm>
#include <utility>
#include <set>
#include <map>
//#include <queue>
//#include <deque>
//#include <bitset>
//#include <math.h>
using namespace std ;
using ll = long long ;
//using ld = long double ;
//using vll = vector<ll> ;
//using vvll = vector<vll> ;
//using vc = vector<char> ;
//using vvc = vector<vc> ;
//using vb = vector<bool> ;
//using vvb = vector<vb> ;
using pll = pair<ll,ll> ;
//#define all(v) v.begin(),v.end()
ll mod = 1000000007 ;
//long double pie = acos(-1) ;
//ll INF = 1000000000000 ;

//void yorn(bool a){if(a) cout << "Yes" << endl ; else cout << "No" << endl ;}
//void YorN(bool a){if(a) cout << "YES" << endl ; else cout << "NO" << endl ;}
ll gcd(long long a,long long b){if(b==0) return a ; return gcd(b,a%b) ;}
//ll lcm(long long a,long long b){return a/gcd(a,b)*b ;}
//ll sa(long long a,long long b){if(a>b) return a-b ; return b-a ;}
//void fix_cout(){cout << fixed << setprecision(20) ;}

ll modpow(ll a,ll b){
	ll res = 1 ;
	while(b>0){
		if(b&1) res = res*a%mod ;
		b >>= 1 ;
		a = a*a%mod ;
	}
	return res ;
}

int main(){
	ll n ; cin >> n ;
	set<pll> s ;
	map<pll,ll> m ;
	pll ins ;
	ll C=0 ;
	for(int i=0;i<n;i++){
		ll a,b ;
		cin >> a >> b ;
		if(a==0&&b==0){
			C++ ;
			continue ;
		}
		if(a==0){
			b = 1 ;
		}
		if(b==0){
			a = 1 ;
		}
		ll g = gcd(abs(a),abs(b)) ;
		a /= g ;
		b /= g ;
		if(a<0){
			a *= -1 ;
			b *= -1 ;
		}
		ins.first = a ;
		ins.second = b ;
		s.insert(ins) ;
		m[ins]++ ;
	}
	set<pll> t ;
	ll ans = 1 ;
	for(auto p:m){
		ll a = p.first.first ;
		ll b = p.first.second ;
		ins.first = a ;
		ins.second = b ;
		if(t.count(ins)) continue ;
		ll sub = modpow(2,p.second)-1 ;
		ll c,d ;
		if(a==0&&b==1){
			c = 1 ;
			d = 0 ;
		}
		if(a==1&&b==0){
			c = 0 ;
			d = 1 ;
		}
		if(a!=0&&b!=0){
			c = b ;
			d = -a ;
			if(c<0){
				c *= -1 ;
				d *= -1 ;
			}
		}
		ins.first = c ;
		ins.second = d ;
		if(s.count(ins)){
			sub += modpow(2,m[ins])-1 ;
			sub %= mod ;
			t.insert(ins) ;
		}
		sub++ ;
		sub %= mod ;
		ans = ans*sub%mod ;
	}
	ans = (ans-1+C+mod)%mod ;
	cout << ans << endl ;
}


Measured memory_bytes: 28460
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define zero_pad(num) setfill('0') << std::right << setw(num)
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<int, int>;

int main() {
    int n;
    cin >> n;
    vector<char> s(n);
    rep(i, n) cin >> s[i];

    bool four = false;
    rep(i, n) if(s[i] == 'Y') four = true;
    if(four) cout << "Four" << endl;
    else cout << "Three" << endl;
}

Measured memory_bytes: 256
import qualified Data.Text as T
import qualified Data.Text.IO as T
import qualified Data.Text.Read as T
import Data.List (unfoldr)
import Data.Maybe (catMaybes)

main :: IO ()
main = do
  let
    primeFactors :: Int -> [(Int, Int)]
    primeFactors = catMaybes . unfoldr next . (,) 2
      where
        next :: (Int, Int) -> Maybe (Maybe (Int, Int), (Int, Int))
        next (_, 1)             = Nothing
        next (d, m) | m < d * d = Just (Just (m, 1), (0, 1))
                    | otherwise = Just . ((,) <$> fmap ((,) d) . fst <*> (,) (succ d) . snd) $ ord d m
        ord :: Int -> Int -> (Maybe Int, Int)
        ord d = go 0
          where
            go :: Int -> Int -> (Maybe Int, Int)
            go c m | r == 0 = go (succ c) m'
              where
                (m', r) = m `divMod` d
            go 0 m = (Nothing, m)
            go c m = (Just c, m)
    f :: Int -> Int
    f m = until ((<= 2 * m) . ((*) <$> id <*> succ)) pred 8
  n <- unsafeTextToInt <$> T.getLine :: IO Int
  print . sum . map (f . snd) . primeFactors $ n

unsafeTextToInt :: T.Text -> Int
unsafeTextToInt s = case T.signed T.decimal s of
  Right (n, _) -> n
{-# INLINE unsafeTextToInt #-}


Measured memory_bytes: 4828
#include <algorithm>
#include <cstdio>
#include <iostream>
#include <map>
#include <cmath>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
#include <stdlib.h>
#include <stdio.h>
#include <bitset>
#include <cstring>
#include <deque>
using namespace std;
#define FOR(I,A,B) for(int I = (A); I < (B); ++I)
#define CLR(mat) memset(mat, 0, sizeof(mat))
typedef long long ll;
typedef pair<int, int> P;
int N, M;
int a[100005];
bool used[100005];
priority_queue<P, vector<P>, greater<P> > Q[100005]; // グループiについて、重み, 頂点番号
priority_queue<P, vector<P>, greater<P> > QALL; // 値、グループ

// union - find tree !!!!!!!!!!!!!!!!!!!!!!!!!
vector<int> par; //oya
vector<int> rnk; //ki no hu ka sa
// n要素で初期化
void init(int n){
    par.resize(n);
    rnk.resize(n);
    FOR(i, 0, n){par[i] = i;rnk[i] = 0;}
}
//木の根を求める
int find(int x){
    if(par[x] == x) return x;
    else return par[x] = find(par[x]);
}
//xとyの属する集合を併合
void unite(int x, int y, int z){
    x = find(x);y = find(y);
    if(x == y) return;
    if(z == 0) {
      if(rnk[x] < rnk[y]) par[x] = y;
      else{
        par[y] = x;
        if(rnk[x] == rnk[y]) rnk[x]++;
      }
    }
    else if(z == 1) par[y] = x;
    else par[x] = y;
    return;
}

int main()
{
  ios::sync_with_stdio(false);
  cin.tie(0);
  cin >> N >> M;
  init(100005);
  FOR(i, 0, N) cin >> a[i];
  // グループ分け
  FOR(i,0,M) {
    int x, y;
    cin >> x >> y;
    unite(x, y, 0);
  }
  int numg = 0;
  set<int> SET;
  FOR(i,0,N) {
    int g = find(i);
    if(SET.count(g) == 0) {
      numg++;
      SET.insert(g);
    }
    Q[g].push(P(a[i], i));
    QALL.push(P(a[i], i));
  }
  int must = 2 * (numg - 1);
  if(must == 0) {
    cout << 0 << endl;
    return 0;
  }
  ll ans = 0;
  for(auto s : SET) {
    P p = Q[s].top();
    ans += p.first;
    used[p.second] = true;
    must--;
  }
  while(!QALL.empty()) {
    if(must == 0) {
      cout << ans << endl;
      return 0;
    }
    P p = QALL.top(); QALL.pop();
    if(used[p.second]) continue;
    ans += p.first;
    must--;
  }
  if(must == 0) cout << ans << endl;
  else cout << "Impossible" << endl;
  return 0;
}

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

using namespace std;

int main(int argc, const char *argv[]) {
  int x[1000], N, C[1000], S[1000], F[1000];

  scanf("%d", &N);
  for (int i = 0; i < N - 1; i++) {
    scanf("%d %d %d", &C[i], &S[i], &F[i]);
    x[i] = 0;
  }

  for (int s = N - 1; s >= 0; s--) {
    for (int r = s - 1; r >= 0; r--) {
      int ofs = N - 1 - s;
      // printf("r,s,x,C,S,F : %d,%d,%d,%d,%d,%d\n", r, s, x[r], C[r + ofs], S[r + ofs], F[r + ofs]);
      x[r] = max(((x[r] / F[r + ofs]) + bool(x[r] % F[r + ofs])) * F[r + ofs], S[r + ofs]) + C[r + ofs];
    }
  }

  for (int i = 0; i < N; i++) printf("%d\n", x[i]);
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using pint = pair<int, int>;
using ll = long long;
using ull = unsigned long long;
using vll = vector<long long>;
using pll = pair<ll, ll>;
#define FOR(i, begin, end) \
    for (int i = (begin), i##_end_ = (end); i < i##_end_; i++)
#define IFOR(i, begin, end) \
    for (int i = (end)-1, i##_begin_ = (begin); i >= i##_begin_; i--)
#define REP(i, n) FOR(i, 0, n)
#define IREP(i, n) IFOR(i, 0, n)
#define VREP(s, ite) for (auto ite = s.begin(); ite != s.end(); ++ite)
#define FI first
#define SE second
#define ALL(v) v.begin(), v.end()
//#define endl "\n"
#define ciosup  \
    cin.tie(0); \
    ios::sync_with_stdio(false);
#define eb emplace_back
#define vint vector<int>
constexpr ll INF = 1e15 + 7LL;
constexpr ll MOD = 1e9 + 7LL;
template <typename T>
istream &operator>>(istream &is, vector<T> &v) {
    for (int i = 0; i < v.size(); ++i) {
        is >> v[i];
    }
    return is;
}
template <typename T>
ostream &operator<<(ostream &os, const vector<T> &v) {
    for (int i = 0; i < v.size() - 1; ++i) {
        os << v[i] << " ";
    }
    if (v.size() > 0) {
        os << v[v.size() - 1] << endl;
    }
    return os;
}

int main() {
    int x,n;
    cin>>x>>n;
    vint p(n);
    cin >> p;
    unordered_set<int> se;
    REP(i, n) { se.insert(p[i]); }
    int minv = 101, ans = 101;
    IREP(i, 102) {
        if (se.find(i) == se.end()){
            if (abs(i - x) <=  minv){
                minv = abs(i-x);
                ans = i;
            }
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 3604
#include <stdio.h>
#define N 45

int main()
{
	int n,i,F[N];

	F[0] = 1;
	F[1] = 1;

	scanf("%d",&n);

	for(i = 2;i < N;i++)
	{
		F[i] = F[i-2] + F[i-1];
	}

	printf("%d\n",F[n]);

	return 0;
}

Measured memory_bytes: 596
#include<bits/stdc++.h>
using namespace std;
unsigned long long k;//要求第k位的lunlun数 
unsigned long long q[5000001],f=1,e=0;
int main()
{
	cin>>k;
	for(int i=1;i<=9;i++)q[++e]=i;//进队列 
	for(long long i=1;i<=k+1;i++)
	{
		long long m=q[f]%10;
		if(m<0||m>9)break;
		if(m-1>=0)//末尾可以添加数字 
			q[++e]=10*q[f]+m-1;
		q[++e]=10*q[f]+m;
		if(m+1<=9)//末尾可以添加数字 
			q[++e]=10*q[f]+m+1;
		f++;
	}
	cout<<q[k]<<endl;
	return 0;
}

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

int main(){
    int i = 0;
    char s[100001];
    char c[2];

    scanf("%s", s);

    while(i < 26){
        c[0] = 'a' + i;
        if(strstr(s, c) == NULL){
            printf("%c\n", c[0]);
            return 0;
        }
        i++;
    }
    printf("None\n");

    return 0;
}

Measured memory_bytes: 256
X = gets.chomp.to_i

def calc_b(a)
  b5 = (a**5 - X)
  if b5 >= 0
    b5.pow(1.0/5).to_i
  else
    (-b5).pow(1.0/5).to_i * -1
  end
end

def val(a, b)
  a**5 - b**5
end

a = 1
b = calc_b(a)

until (v = val(a, b)) == X
  a += 1
  b = calc_b(a)
end

puts [a, b].join(" ")


Measured memory_bytes: 14820
#include <stdio.h>
#include <iostream>
#include <iomanip>
#include <vector>
#include <cstdlib>
#include <cmath>
#include <numeric>
#include <algorithm>
#include <sstream>
#include <string>
#include <map>
#include <set>
#include <stack>
#include <deque>
#include <bitset>
using namespace std;

#define rep(i, n) for (int i=0; i<int(n); i++)
#define ARRAY_LENGTH(array) (sizeof(array) / sizeof(array[0]))
using ll = long long;


int main() {
	int n, k;
	cin >> n >> k;
	double P[n];
	rep(i, n) {
		cin >> P[i];
	}
	double E[n];
	double S[n+1];
	rep(i, n) {
		E[i] = (1 + P[i])/2;
		S[i+1] = S[i] + E[i];
	}

	double max_exp = 0;
	rep(i, n) {
		if (i+k > n) break;
		double exp;
		if (i==0) exp = S[i+k];
		else exp = S[i+k] - S[i];
		max_exp = max(exp, max_exp);
	}
	cout << fixed << setprecision(12);
	cout << max_exp << endl;
}

Measured memory_bytes: 8424
/*  -*- coding: utf-8 -*-
 *
 * 2892.cc: Shiritori Compression
 */

#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<set>
#include<stack>
#include<list>
#include<queue>
#include<deque>
#include<algorithm>
#include<numeric>
#include<utility>
#include<complex>
#include<functional>
 
using namespace std;

/* constant */

const int MAX_N = 100000;
const int INF = 1 << 30;

/* typedef */

/* global variables */

char s[1000000 + 4];
int as[MAX_N], dp[MAX_N + 1], maxds[26];

/* subroutines */

inline void setmin(int &a, int b) { if (a > b) a = b; }

/* main */

int main() {
  int n;
  scanf("%d", &n);

  for (int i = 0; i < n; i++) {
    scanf("%s", s);
    as[i] = s[0] - 'a';
  }

  dp[0] = 0;
  fill(dp + 1, dp + n + 1, INF);
  fill(maxds, maxds + 26, INF);

  for (int i = 0; i < n; i++) {
    setmin(dp[i + 1], dp[i] + 1);

    if (maxds[as[i]] < INF) setmin(dp[i + 1], maxds[as[i]]);
    setmin(maxds[as[i]], dp[i + 1]);
  }

  printf("%d\n", dp[n]);
  return 0;
}



Measured memory_bytes: 3984
#include <bits/stdc++.h>
#include <stdlib.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef pair<ll,ll> llP;

int main() {
  ll n,m;
  cin>>n>>m;
  llP memo[n];
  for(int i=0;i<n;i++){
    ll a,b;
    cin>>a>>b;
    memo[i]=make_pair(a,b);
  }
  sort(memo,memo+n);
  ll ans=0;
  for(int i=0;i<n;i++){
    ll a=min(m,memo[i].second);
    ans+=memo[i].first*a;
    m-=a;
    if(m==0) break;
  }
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 1792
//By Zank100
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ull unsigned long long
#define mod 1000000007
#define din(t) long long t;cin>>t;
#define in(t) cin>>t;
int main() 
{
	ios_base::sync_with_stdio(false); cin.tie(NULL);
	din(n);
	ll a[n][3];
	for(ll i=0;i<n;i++)
	{
	    for(ll j=0;j<3;j++)
	    {
	        in(a[i][j]);
	    }
	}
	ll dp[n][3];
	for(ll i=0;i<3;i++)
	{
	    dp[0][i]=a[0][i];
	}
	for(ll i=1;i<n;i++)
	{
	    dp[i][0]=a[i][0]+max(dp[i-1][1],dp[i-1][2]);
	    dp[i][1]=a[i][1]+max(dp[i-1][0],dp[i-1][2]);
	    dp[i][2]=a[i][2]+max(dp[i-1][1],dp[i-1][0]);
	}
	ll ans;
	ans=max(dp[n-1][0],max(dp[n-1][1],dp[n-1][2]));
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 4992
import java.util.Scanner;

public class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        int x = sc.nextInt();
        System.out.println((x >= a && x  <= a + b) ? "YES" : "NO");
    }
}


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

int main() {
    int S; cin >> S;
    int h, m, s;
    s = S % 60;
    int mnt = S / 60;
    m = mnt % 60;
    h = mnt / 60;
    cout << h << ":" << m << ":" << s << endl;
}


Measured memory_bytes: 3076