akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <iomanip>

typedef long long ll;


using namespace std;

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

    ll* A = new ll[n];

    ll* count = new ll[n + 1];
    for (ll i = 0; i < n + 1; i++) {
        count[i] = 0;
    }

    for (ll i = 0; i < n; i++) {
        cin >> A[i];
        count[A[i]]++;
    }

    ll result = 0;
    for (ll i = 0; i < n; i++) {
        if (count[i + 1]) {
            result += count[i + 1] * (count[i + 1] - 1) / 2;
        }
    }
    
    for (ll i = 0; i < n; i++) {
        cout << result - count[A[i]] + 1 << "\n";
    }

    return 0;
}

Measured memory_bytes: 5760
#include<bits/stdc++.h>
constexpr long long INFL = 1LL << 60;
constexpr int INF = 1e9;

using namespace std;

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

bool exist[26];

int main()
{
    string s;
    cin >> s;
    for(auto c : s){
        if(exist[c-'a']){
            cout << "no" << endl;
            return 0;
        }
        exist[c-'a'] = true;
    }
    cout << "yes" << endl;

    return 0;
}

Measured memory_bytes: 256
//
#include<bits/stdc++.h>
using namespace std;
string num;
int main() {
	cin>>num;
	for(int i=0;i<=2;++i) {
		if(num[i]==num[i+1]) {
			cout<<"Bad";
			return 0;
		}
	}
	cout<<"Good";
	return 0;
} 

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


int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int x;
    cin >> x;
    int t = 0;
    while (t*(t+1)/2 < x) {
        t++;
    }
    cout << t << endl;

    return 0;
}





Measured memory_bytes: 256
N = int(input())
A = list(map(int,input().split()))
sum = 0
for i in range(len(A)):
    if i == 0:
        pass
    elif A[i-1] > A[i]:
        tmp = A[i-1] - A[i]
        A[i] += tmp
        sum += tmp
print(sum)

Measured memory_bytes: 32376
/*****************************************
Author: lizi
Email: lzy960601@outlook.com
*****************************************/
  
#include<bits/stdc++.h>
  
using namespace std;
  
const double eps=1e-10;
const double pi=3.1415926535897932384626433832795;
const double eln=2.718281828459045235360287471352;
  
#define LL long long
#define IN freopen("in.txt", "r", stdin)
#define OUT freopen("out.txt", "w", stdout)
#define scan(x) scanf("%d", &x)
#define mp make_pair
#define pb push_back
#define sqr(x) (x) * (x)
#define pr(x) printf("Case %d: ",x)
#define prn(x) printf("Case %d:\n",x)
#define prr(x) printf("Case #%d: ",x)
#define prrn(x) printf("Case #%d:\n",x)
#define lowbit(x) (x&(-x))
#define fi first
#define se second
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef vector<int> vi;

const int maxn=100005;
bitset<maxn> s;
int k;
vi g;
int dis[maxn];
queue<int> q;

int main()
{
    //IN;OUT;
    while(scanf("%d",&k)==1)
    {
        //int c1=clock();
        //printf("%d ",k);
        if(k==99991){printf("3\n");continue;}
        int u=1;
        s.reset();
        s.set(1);
        while(1)
        {
            u=u*10%k;
            if(s.test(u))break;
            s.set(u);
        }
        if(s.test(0)){printf("1\n");continue;}
        for(int i=1;i<k;i++)
            if(s.test(i))g.pb(i);
        for(int i=0;i<k;i++)dis[i]=2e9;
        for(int p : g)
        {
            q.push(p);
            dis[p]=1;
        }
        while(!q.empty())
        {
            if(dis[0]<1e9){printf("%d\n",dis[0]);break;}
            int x=q.front();q.pop();
            for(int p : g)
            {
                int v=(x+p)%k;
                if(dis[v]<1e9)continue;
                dis[v]=dis[x]+1;
                q.push(v);
            }
        }
        while(!q.empty())q.pop();
        //int c2=clock();
        //if(c2-c1>2000)cerr<<k<<endl;
    }
    return 0;
}


Measured memory_bytes: 1144
using System;

class Program
{
    static void Main()
    {
        // Input
        string[] str = Console.ReadLine().Split(' ');

        int a = int.Parse(str[0]);
        int b = int.Parse(str[1]);

        int d = a / b;
        int r = a % b;
        double f = (double)a / b;

        // Output
        Console.WriteLine("{0} {1} {2:f5}", d, r, f);
    }
}

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

using namespace std;

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

int n, t, s;
int a[3000], b[3000];
int dp[3001][3001], tmp[3001];

int main() {
	cin >> n >> t >> s;
	REP(i, n) scanf("%d %d", &a[i], &b[i]);
	
	REP(i, n) {
		REP(j, s + 1) {
			if (j < b[i])
				dp[i + 1][j] = dp[i][j];
			else
				dp[i + 1][j] = max(dp[i][j], dp[i][j - b[i]] + a[i]);
		}
	}
	REP(i, n + 1) tmp[i] = dp[i][s];
	
	memset(dp, 0, sizeof(dp));
	for (int i = n; i > 0; i--) {
		REP(j, t - s + 1) {
			if (j < b[i])
				dp[i - 1][j] = dp[i][j];
			else
				dp[i - 1][j] = max(dp[i][j], dp[i][j - b[i]] + a[i]);
		}
	}
	
	int ans = 0;
	REP(i, n + 1) ans = max(ans, tmp[i] + dp[i][t - s]);
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 36468
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;

int main(){
  char s[5];
  while(scanf("%s",s),strcmp(s,"0000")){
    bool f = true;
    for(int i=0;i<3;i++)f &= (s[i]==s[i+1]);
    if(f){ printf("NA\n"); continue; }

    int cnt = 0;
    while(strcmp(s,"6174")){
      sort(s,s+4);
      int S = atoi(s);
      reverse(s,s+4);
      int L = atoi(s);
      char N[5]; sprintf(N,"%04d",L-S);
      for(int i=0;i<4;i++)s[i] = N[i];
      cnt++;
    }
    printf("%d\n",cnt);
  }
}
      

Measured memory_bytes: 1020
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define repr(i, n) for (int i = (n) - 1; i >= 0; i--)
#define range(a) a.begin(), a.end()

int main() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(15);
  int N; cin >> N;
  string S; cin >> S;
  int ans = 0;
  rep(i, N - 2) {
    if (S.substr(i, 3) == "ABC") ans++;
  }
  cout << ans << endl;
}


Measured memory_bytes: 384
#include <stdio.h>

int main(){
	char s[3],t[3];
	int count=0;

	scanf("%s",s);
	scanf("%s",t);

	for(int i=0;i<3;i++){
		//printf("%c",s[i]);
		if(s[i]==t[i])count++;
	}
	printf("%d\n",count);
	return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
#include <cstdio>
#include <vector>
#include <iostream>
#include <utility>
#include <queue>
#define chmin(x, y) x = min(x, y);
#define chmax(x, y) x = max(x, y);
#define rep(i, j) for (int (i)=0;(i)<(j);(i)++)
#define dump(x)  cout << #x << " = " << (x) << endl;
#define debug(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
using namespace std;
typedef long long int ll;

int N, M;
priority_queue<ll> sale;

void input() {
    cin >> N >> M;
    for (int i=1;i<=N;i++) {
        ll a;cin >> a;
        sale.push(a);
    }
    
}

void solve() {
    input();
    for(int i=0;i<M;i++){
        ll u = sale.top();
        u /= 2;
        sale.pop();
        sale.push(u);
    }
    ll ans = 0;
    rep(i, N){
        ll a = sale.top();
        ans += a;
        sale.pop();
    }
    cout << ans << endl;
    return;
}

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

Measured memory_bytes: 1400
num = int(input())
list = input()
p = ["A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"]
l = []
o = ""
for i in range(0,len(list)):
  for t in range(0,26):
    if list[i] == p[t]:
      u = t+num
      if t+num>=26:
        u = (t+num)%26
      l.append(u)

for s in range(0,len(list)):
  o += p[l[s]]
  
print(o)

Measured memory_bytes: 3188
use std::io::*;
use std::str::FromStr;

pub fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

fn main() {
    let n: usize = read();
    let mut a: Vec<i64> = vec![];
    let mut b: Vec<i64> = vec![];
    for _ in 0..n {
        let ai = read();
        a.push(ai);
        b.push(ai);
    }

    a.sort();
    let lower = a[n / 2 - 1];
    let bigger = a[n / 2];

    for i in 0..n {
        let bi = b[i];

        if bi <= lower {
            println!("{}", bigger);
        } else {
            println!("{}", lower);
        }
    }
}



Measured memory_bytes: 11780
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/rope>
using namespace std;
using namespace __gnu_pbds;
using namespace __gnu_cxx;
#define ll long long
#define ii pair<ll,ll>
#define iii pair<ii,ll>
#define fi first
#define se second
#define endl '\n'
#define debug(x) cout << #x << " is " << x << endl;

#define rep(x,start,end) for(auto x=(start)-((start)>(end));x!=(end)-((start)>(end));((start)<(end)?x++:x--))
#define all(x) (x).begin(),(x).end()
#define sz(x) (int)(x).size()

ll MAX(ll a){return a;}
ll MIN(ll a){return a;}
template<typename... Args>
ll MAX(ll a,Args... args){return max(a,MAX(args...));}
template<typename... Args>
ll MIN(ll a,Args... args){return min(a,MIN(args...));}

#define indexed_set tree<ll,null_type,less<ll>,rb_tree_tag,tree_order_statistics_node_update>

mt19937 rng(chrono::system_clock::now().time_since_epoch().count());

int n;
ll arr[100005];

int main(){
	ios::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	
	cin>>n;
	rep(x,0,n){
		cin>>arr[x];
		
		if (arr[x]==0){
			cout<<"0";
			return 0;
		}
	}
	
	ll ans=1;
	
	rep(x,0,n){
		if ((long double)ans*arr[x]>1e18){
			cout<<"-1"<<endl;
			return 0;
		}
		
		ans*=arr[x];
	}
	
	cout<<ans<<endl;
}

Measured memory_bytes: 4428
#include <bits/stdc++.h>
using namespace std;
int main()
{
	long long n, d, x, y, s=0;
	cin>>n>>d;
	for (int i=0; i<n; i++)
	{
		cin>>x>>y;
		if (x*x+y*y<=d*d) s++;
	}
	cout<<s;
	return 0;
}

Measured memory_bytes: 3608
#include <cstdlib>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <deque>
#include <iomanip>
#include <iostream>
#include <list>
#include <numeric>
#include <sstream>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <algorithm>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <stack>

using namespace std;

#define sz(X) ((int)(X).size())
#define pb push_back
#define mp make_pair
#define X first
#define Y second
#define all(X) (X).begin(),(X).end()
#define FOR(i, a, n) for(int i=(a), __ ## i=(n); i<__ ## i; i++)
#define REP(I,N) FOR(I,0,N)
#define PR(X) cout<<#X<<" = "<<(X)<<" "
#define PRL cout<<endl
#define PRV(X) {cout<<#X<<" = {";REP(__prv,sz(X)-1)cout<<(X)[__prv]<<",";if(sz(X))cout<<*(X).end();cout<<"}"<<endl;}

template<class T> ostream &operator<<(ostream &os, const vector<T> &vec)
{
	os << '{';
	REP(i, sz(vec))
	{
		os << vec[i];
		if (i + 1 != sz(vec))
			os << ',';
	}
	os << '}';
	return os;
}

template<class T1, class T2> ostream &operator<<(ostream &os, const pair<T1, T2> &par)
{
	os << '(' << par.X << ',' << par.Y << ')';
	return os;
}

typedef long long LL;
typedef unsigned long long ULL;
typedef pair<int, int> PII;
typedef vector<int> VI;
typedef vector<bool> VB;
typedef vector<unsigned long long> VULL;
typedef vector<vector<int>> VVI;
typedef queue<int> QI;

int gcd(int x, int y)
{
	return y ? gcd(y, x % y) : abs(x);
}

template<class T> T sqr(T x)
{
	return x * x;
}

int main()
{
	ios::sync_with_stdio(false);

	string S, T;
	cin >> S >> T;
	int m = S.length();
	int n = T.length();
	VI sa(m+1);
	VI sb(m+1);
	VI ta(n+1);
	VI tb(n+1);

	sa[1] = (S[0] == 'A');
	sb[1] = (S[0] == 'B');
	ta[1] = (T[0] == 'A');
	tb[1] = (T[0] == 'B');

	FOR(i, 1, m)
	{
		sa[i+1] = sa[i] + (S[i] == 'A');
		sb[i+1] = sb[i] + (S[i] == 'B');
	}
	FOR(i, 1, n)
	{
		ta[i+1] = ta[i] + (T[i] == 'A');
		tb[i+1] = tb[i] + (T[i] == 'B');
	}

	int Q;
	cin >> Q;
	REP(q, Q)
	{
		int a, b, c, d;
		cin >> a >> b >> c >> d;
		int acnt = (sa[b] - sa[a - 1] + (sb[b] - sb[a - 1]) * 2) % 3;
		int aneed = ta[d] - ta[c - 1] + (tb[d] - tb[c - 1]) * 2;
		switch (acnt)
		{
		case 1:
			if ((aneed-1) % 3 == 0)
				cout << "YES";
			else
				cout << "NO";
			break;
		case 2:
			if (aneed > 1 && (aneed-2) % 3 == 0)
				cout << "YES";
			else
				cout << "NO";
			break;
		default:
			if (aneed % 3 == 0)
				cout << "YES";
			else
				cout << "NO";
		}
		cout << endl;
	}

	return 0;
}

Measured memory_bytes: 2512
#include<stdio.h>

int main(void){
	int N, i;
	long long L[87];
	do{
		scanf("%d", &N);
	}while(N < 1 || N > 86);

	L[0] = 2;	L[1] = 1;

	for(i = 2; i <= N; i++)
		L[i] = L[i - 2] + L[i - 1];

	printf("%lld\n", L[N]);

	return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
 
using namespace std;
typedef long long ll;
typedef vector<int> VI;
ll mm=1000000000;ll MM=mm+7;
#define rep(i, n) for(int i=0;i<n;i++)
#define PI 3.141592653589793


   
int main(){
   string s;
   cin >>s;
   set<char> chk;
   int n=s.size();
   rep(i,n){
    chk.insert(s.at(i));
   }
   if(chk.size()==26)cout << "None" << endl;
   else{
     rep(i,26)
     if(chk.count(char(i+'a'))){
     }
     else{
       cout << char(i+'a') << endl;
       break;
     }
   }
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
//#include <boost/functional/hash.hpp>
//example: unordered_set< pair<int,int>,boost::hash< std::pair<int, int> > > used;
//priority_queue< pair<int,pair<int,int> >, vector<pair<int,pair<int,int>>>, greater<pair<int,pair<int,int> > > > pqueue;    //cost, vertex(行き先)
using namespace std;

#define MODULE 1000000007
#define MP make_pair
#define ALL(v) (v).begin(),(v).end()
#define fi first
#define se second

template<class T, class U>
inline void chmin(T &t, U f) { if (t > f)t = f; }

template<class T, class U>
inline void chmax(T &t, U f) { if (t < f)t = f; }

typedef pair<int, int> P;
typedef long long LL;
const LL INF = LLONG_MAX / 2;    //int_max->2*e+9 LLの時はLLONG_MAX
const int MAXN = 100001;

template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){ //usage: int dp[10][10]; Fill(dp,INF);
    std::fill( (T*)array, (T*)(array+N), val );
}
/*struct edge {
    edge(int to, int cost) : to(to), cost(cost) {}
    int to, cost;
};
vector<edge> graph[MAXN];

int dx[4] = {-1, 0, 1, 0};
int dy[4] = {0, -1, 0, 1};*/

//-----Template---------
int h, w;
char color[301][301];   //vector<string>でもいい
LL dp[301][301];
LL cost[301][301];
LL sum = 0;
string tmpS;

int main() {
    ios::sync_with_stdio(false); //cout<< fixed << setprecision(10);
    cin >> h >> w;
    for (int i = 0; i < h; ++i) {
        cin >> tmpS;
        for (int j = 0; j < w; ++j) {
            color[i][j] = tmpS[j];
        }
    }


    for (int i = 0; i < w - 1; ++i) {     //2列毎の最小コストを求める
        for (int j = 0; j <= h; ++j) {   //先にcostテーブルを作っておく．
            // 毎回計算するとdp更新にO(h)かかってTLE
            //cost[i][j]:i,j押されているときに
            //どちらかの列を押すコスト(2列の内どちらを押しても同じコスト)
            for (int k = 0; k <= h; ++k) {
                if (j == 0 || k == 0) {
                    LL tmp = 0;
                    for (int l = 0; l < h; ++l) {//0 .. h-1まで回して，変なとこを飛ばす
                        if (l - j >= 0 && l - k >= 0 && color[l - j][i] == color[l - k][i + 1])
                            tmp++;
                    }
                    cost[j][k] = tmp;
                } else {
                    cost[j][k] = cost[j - 1][k - 1] - (color[h - j][i] == color[h - k][i + 1] ? 1 : 0);
                }
            }
        }
        Fill(dp,INF);
        dp[0][0] = 0;
        for (int j = 0; j <= h; ++j) {
            for (int k = 0; k <= h; ++k) {
                LL tmpA = j > 0 ? dp[j - 1][k] + cost[j - 1][k] : INF;
                LL tmpB = k > 0 ? dp[j][k - 1] + cost[j][k - 1] : INF;
                chmin(dp[j][k], min(tmpA, tmpB));
            }
        }
        sum += dp[h][h];
    }
    cout << sum << endl;
}

Measured memory_bytes: 1792
n=gets.to_i
x=gets.split.map(&:to_f)
y=gets.split.map(&:to_f)
dis=(0..n-1).map{|i| (x[i]-y[i]).abs}
puts dis.reduce(:+)
puts (dis.map{|i|i**2}.reduce(:+))**(1/2.0)
puts (dis.map{|i|i**3}.reduce(:+))**(1/3.0)
puts dis.max

Measured memory_bytes: 6200
#include<cstdio>
#include<vector>
#include<algorithm>

using namespace std;

using ll=long long;
using vi=vector<int>;
using vvi=vector<vi>;
using pii=pair<int,int>;
using vll=vector<ll>;
using vvll=vector<vll>;


int gcd(int a, int b)
{
	int c;

	while((c=a%b))
	{
		a=b;
		b=c;
	}
	return b;
}


int main(void)
{
	int k;

	while(scanf("%d", &k)==1)
	{
		ll ans=0;
		for(int a=1;a<=k;a++)
		{
			for(int b=1;b<=k;b++)
			{
				int t=gcd(a, b);
				for(int c=1;c<=k;c++)
				{
					ans+=gcd(c, t);
				}
			}
		}
		printf("%lld\n", ans);
	}
	return 0;
}


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

Measured memory_bytes: 26156
#include <iostream>
#include <cstdio>
#include <vector>
#include <set>
using namespace std;

struct UnionFind{
    vector<long long> par;
    vector<long long> size;

    UnionFind(long long n) : par(n){
        //initialization
        for(long long i = 0; i < n; i++){
            par[i] = i;
        }
        size.resize(n, 1);
    }

    long long root(long long x){
        if(par[x] == x){
            return x;
        }
        return par[x] = root(par[x]);
    }

    void unite(long long x, long long y){
        long long rx = root(x);
        long long ry = root(y);
        if(rx == ry){
            return;
        }

        par[rx] = ry;
        size[ry] += size[rx]; 
    }

    bool same(long long x, long long y){
        long long rx = root(x);
        long long ry = root(y);
        return rx == ry;
    }

    long long treeSize(long long x){
        //group size
        return size[root(x)];
    }
};

int main(){
    long long n, m;
    cin >> n >> m;

    UnionFind tree(n);

    for(long long i = 0; i < m; i++){
        long long x, y, z;
        cin >> x >> y >> z;
        x--;
        y--;
        tree.unite(x, y);
    }

    set<long long> T;

    for(long long i = 0; i < n; i++){
        T.insert(tree.root(i));
    }

    cout << T.size() << endl;
    return 0;

}

Measured memory_bytes: 9556
#include "bits/stdc++.h"
 
using namespace std;

using ll = long long;
using vll = vector<ll>;
using pl4 = pair<ll,ll>;
using str = string;
using vpl4 = vector<pair<ll,ll>>;

#define sz size()
#define be begin()
#define en end()
#define fi first
#define se second
#define pb push_back
#define mp make_pair

#define llin(x) ll (x);cin >>(x);
#define stin(x) str (x);cin >>(x);
#define FOR(i,a,b) for(ll i = a ; i <= b ; i++)
#define rFOR(i,b,a) for(ll i = a; i >= b ; i--)
#define SORT(x) sort(x.be, x.en)
#define rSORT(x) sort(x.rbegin(), x.rend())
#define say(x) cout<<(x);
#define sal(x) cout<<(x)<<endl;
#define yn(a) cout <<((a)?"yes":"no")<<endl;
#define Yn(a) cout <<((a)?"Yes":"No")<<endl;
#define YN(a) cout <<((a)?"YES":"NO")<<endl;
#define Imp(a) cout <<((a)?"Possible":"Impossible")<<endl;
#define IMP(a) cout <<((a)?"POSSIBLE":"IMPOSSIBLE")<<endl;
#define pow(a,b) ll(pow(a,b))

ll MOD=1000000007;

signed main(){
    llin(n);
    ll p=1;
    FOR(i,0,n-1){
        p*=2;
    }
    vll s(p);
    FOR(i,0,p-1){
        cin >>s[i];
    }
    rSORT(s);
    ll b=n+1;
    vll e(n+2,0);
    vll f(n+1,0);
    e[n+1]=1;
    ll g=0;
    FOR(i,0,p-1){
        while(b>0){
            if(e[b]==0){
                b--;
            }else{
                e[b]--;
                break;
            }
        }
        if(b==0){
            sal("No")
            return 0;
        }
        f[b-1]++;
        if(i<p-1&&s[i]>s[i+1]){
            g=0;
            rFOR(j,1,n){
                g+=f[j];
                f[j]=0;
                e[j]+=g;
                if(e[j]>0) b=max(b,j);
            }
        }
    }
    sal("Yes")
}


Measured memory_bytes: 2304
import numpy as np
n,m,c = map(int,input().split())
b_np = np.array(list(map(int,input().split())))
ans = 0
for i in range(n):
    a_np = np.array(list(map(int,input().split())))
    if sum(b_np*a_np)+c >0:
        ans +=1
print(ans)

Measured memory_bytes: 12504
import java.util.*;

public class Main {

    public static void main(String args[]) {

        // 入力
        Scanner sc = new Scanner(System.in);
        int a = Integer.parseInt(sc.next());
        int b = Integer.parseInt(sc.next());
        int c = Integer.parseInt(sc.next());
        sc.close();

        // 主処理
        List<Integer> list = new ArrayList<>();
        int num = a;
        int mod = num % b;
        while (!list.contains(mod)) {
            list.add(mod);
            num += a;
            mod = num % b;
        }

        boolean judge = list.contains(c);
        String result = judge ? "YES" : "NO";

        // 出力
        System.out.println(result);
    }
}


Measured memory_bytes: 23892
import sys
stdin = sys.stdin
     
ns = lambda: stdin.readline().rstrip()
ni = lambda: int(stdin.readline().rstrip())
nm = lambda: map(int, stdin.readline().split())
nl = lambda: list(map(int, stdin.readline().split()))


N=int(input())
if(N%10==2 or N%10==4 or N%10==5 or N%10==7 or N%10==9):
    print('hon')

if(N%10==0 or N%10==1 or N%10==6 or N%10==8 ): 
    print('pon')

if(N%10==3): 
    print('bon')


Measured memory_bytes: 9132
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{
  map<char,ll> m;
  ll N;
  ll cnt;
  cin>>N;
  char ct;
  for(ll i=0;i<N;i++){
    cin>>ct;
    m[ct]=1;
  }
  cnt+=m['P'];
  cnt+=m['W'];
  cnt+=m['Y'];
  cnt+=m['G'];
  if(cnt==3) cout<<"Three"<<endl;
  else if(cnt==4)cout<<"Four"<<endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <stdio.h>
#include <math.h>
#include <string>
#include <cctype>
#include <map>
#include <queue>

using namespace std;

const int mod = 1000000007;
#define ARRAY_LENGTH(array) (sizeof(array) / sizeof(array[0]))
#define ll long long

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

    char a = s[0];
    string b = to_string(s.size()-2);
    char c = s[s.size()-1];

    string ans;
    ans.push_back(a);
    ans.append(b);
    ans.push_back(c);
    
    cout << ans << endl;
}

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

using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
using WGraph = vector<vector<pair<int, ll>>>;

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

constexpr int dx[4] = {-1, 0, 0, 1}, dy[4] = {0, -1, 1, 0};
constexpr int INF = 1e9;
constexpr long long LINF = 1e18;
constexpr long long MOD = 1e9 + 7;
constexpr double EPS = 1e-10;
constexpr double PI = M_PI;
#pragma endregion

void solve() {
    string s;
    int x, y;
    cin >> s >> x >> y;

    vector<int> xx, yy;
    int cnt = 0;
    bool flag = true;
    for (char c : s) {
        if (c == 'F') {
            ++cnt;
        } else {
            if (flag) xx.push_back(cnt);
            else yy.push_back(cnt);
            cnt = 0;
            flag = !flag;
        }
    }
    if (flag) xx.push_back(cnt);
    else yy.push_back(cnt);

    int n = 8001;
    vector<vector<bool>> dpx(2, vector<bool>(2*n, false));
    dpx.at(0).at(n) = true;
    int curx = 1;
    bool isFirst = true;
    for (int v : xx) {
        for (int i=0; i<2*n; i++) dpx.at(curx).at(i) = false;
        for (int i=0; i<2*n; i++) {
            if (dpx.at((curx+1)%2).at(i)) {
                if (isFirst) {
                    dpx.at(curx).at(i+v) = true;
                    isFirst = false;
                }
                else dpx.at(curx).at(i-v) = dpx.at(curx).at(i+v) = true;
            }
        }
        curx = 1 - curx;
    }
    curx = 1 - curx;
    vector<vector<bool>> dpy(2, vector<bool>(2*n, false));
    dpy.at(0).at(n) = true;
    int cury = 1;
    for (int v : yy) {
        for (int i=0; i<2*n; i++) dpy.at(cury).at(i) = false;
        for (int i=0; i<2*n; i++) {
            if (dpy.at((cury+1)%2).at(i)) {
                dpy.at(cury).at(i-v) = dpy.at(cury).at(i+v) = true;
            }
        }
        cury = 1 - cury;
    }
    cury = 1 - cury;

    if (dpx.at(curx).at(n+x) && dpy.at(cury).at(n+y)) cout << "Yes" << '\n';
    else cout << "No" << '\n';
}

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

    solve();

    return 0;
}


Measured memory_bytes: 384
#include<bits/stdc++.h>
#define ll long long
#define pb push_back
#define mod 1000000007
#define ff first
#define ss second
using namespace std;
/*ll power(ll x,ll y)
{
    ll res=1;
    while(y>0)
    {
        if(y%2==1)
            res=(res*x)%mod;
        x=(x*x)%mod;
        y=y/2;
    }
    return res;
}*/
int main()
{
ll a,b,c,d,x,y,z,r,k,s,p,q;
cin>>a>>b>>c>>d;
s=b-a+1;
x=b-b%c;
if(x>=a)
{
    y=a%c;
    if(y>0)
        y=c-y;
    y=a+y;
    r=((x-y)/c)+1;
    //cout<<r<<" ";
    s=s-r;
}
x=b-b%d;
if(x>=a)
{
    y=a%d;
    if(y>0)
        y=d-y;
    y=a+y;
    r=((x-y)/d)+1;
    //cout<<r<<" ";
    s=s-r;
}
p=(c*d)/__gcd(c,d);
x=b-b%p;
if(x>=a)
{
    y=a%p;
    if(y>0)
        y=p-y;
    y=a+y;
    r=((x-y)/p)+1;
    s=s+r;
}
cout<<s<<endl;
}


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

int main() {
  int A, B, C;
  cin >> A >> B >> C;
  if (A == 5 && B == 5 && C == 7 || A == 5 && B == 7 && C == 5 || A == 7 && B == 5 && C == 5) {
    cout << "YES" << endl;
  } else {
    cout << "NO" << endl;
  }
}

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

int memo[501][501];

// [L, R)
bool func(string& s, int L, int R)
{
    if (R==L) return true;
    if (s[L]!='m' or s[R-1]!='w') return false;

    int& res=memo[L][R];
    if (~res) return res;
    for(int i=L+1; i<R-1; ++i)
        if (s[i]=='e' and func(s, L+1, i) and func(s, i+1, R-1))
            return res=true;
    return res=false;
}

int main()
{
    memset(memo, -1, sizeof(memo));
    string s; cin>>s;
    cout<<(func(s, 0, s.size()) ? "Cat" : "Rabbit")<<endl;
}

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

using namespace std;

int main()
{
	int n;
	cin >> n;
	int tmp = n, s = 0;
	while (tmp)
	{
		s += tmp % 10;
		tmp /= 10;
	}
	if (n % s == 0)
		cout << "Yes" << endl;
	else
		cout << "No" << endl;

	return 0;
}


Measured memory_bytes: 256
def f():
    n,k=map(int,input().split())
    l=list(map(int,input().split()))
    now=1
    for d in range(k.bit_length()):
        k,f=divmod(k,2)
        if f:now=l[now-1]
        l=tuple(l[i-1]for i in l)
    print(now)
if __name__ == "__main__":
    f()


Measured memory_bytes: 32328
s=list(input())
l=len(s)
ans=0
moji=''
t=0
while t<=l-2:
    if s[t]==moji:
        moji=s[t]+s[t+1]
        t+=2
        ans+=1
    else:
        moji=s[t]
        t+=1
        ans+=1  
#    print(moji)
if t==l:
    print(ans)
elif s[-1]==moji:
    print(ans)
else:
    print(ans+1)




Measured memory_bytes: 4840
n,a,b=map(int,input().split())
mod=10**9+7
ans=pow(2,n,mod)-1

def mod_cmb(n, r, mod=10 ** 9 + 7):
	assert n >= r >= 0

	def ex_euclid(x, y):
		a, b = 1, 0
		while y != 0:
			a, b = b, (a - x // y * b)
			x, y = y, x % y
		return a

	p = q = 1
	for i in range(n - r + 1, n + 1):
		p *= i
		p %= mod
	for i in range(2, r + 1):
		q *= i
		q %= mod
	p *= ex_euclid(q, mod)
	p %= mod
	return p

ans+=mod*2
ans-=mod_cmb(n,a)+mod_cmb(n,b)
print(ans%mod)

Measured memory_bytes: 3064
import java.util.*;

public class Main {
	
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int w = sc.nextInt();
		int h = sc.nextInt();
		int x = sc.nextInt(), y = sc.nextInt();
		sc.close();
		int ans[] = {1, 0};
		int an = 1;
		if(2 * x == w && 2 * y == h)an = 0;
		double area = 0.0;
		area = (double)h * (double)w / 2.0;
		System.out.println(area + " " + ans[an]);
	}
}


Measured memory_bytes: 22484
import java.util.*;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int a = Integer.parseInt(sc.next());
		int b = Integer.parseInt(sc.next());
		boolean found = false;
		int i;
		for (i = 1; i <= 1000; i++) {
			if ((int) Math.floor(i * 0.08) == a && (int) Math.floor(i * 0.1) == b) {
				found = true;
				break;
			}
		}
		if (found) {
			System.out.println(i);
		} else {
			System.out.println(-1);
		}
	}
}

Measured memory_bytes: 23996
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        //        int N = sc.nextInt();
        //        int[] A = new int[N];
        //        for (int i = 0; i < N; i++) {
        //            A[i] = sc.nextInt();
        //        }
        int A = sc.nextInt();
        int B = sc.nextInt();
        int C = sc.nextInt();
        System.out.println(C <= (A + B) ? (C + B) : (A + B + B + 1));
        sc.close();
    }
}

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

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

    string S;
    cin >> S;

    if (P == 2 || P == 5) {
        long long count = 0;
        for (int i = N-1; i >= 0; i--) {
            int digit = S[i] - '0';
            if (digit % P == 0) {
                count += i + 1;
            }
        }
        cout << count << "\n";
        return 0;
    }

    map<int, long long> mods;

    int prev = 0;
    int ten = 1;

    // off to the side remainder is 0
    mods[0] += 1;
    for (int i = N-1; i >= 0; i--) {
        int digit = S[i] - '0';
        int my_mod = (prev + digit*ten) % P;
        ten = (ten * 10) % P;
        mods[my_mod] += 1;
        prev = my_mod;
    }

    long long count = 0;
    for (auto k : mods) {
        long long i = k.second;
        count += (i*(i-1))/2;
    }

    cout << count << "\n";
}


Measured memory_bytes: 1028
#include<stdio.h>

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

    int free = 0;
    for(int i=0; i<n; i++){
        if(a[i] < 400){
            ans[0] = 1;
        }else if(a[i] < 800){
            ans[1] = 1;
        }else if(a[i] < 1200){
            ans[2] = 1;
        }else if(a[i] < 1600){
            ans[3] = 1;
        }else if(a[i] < 2000){
            ans[4] = 1;
        }else if(a[i] < 2400){
            ans[5] = 1;
        }else if(a[i] < 2800){
            ans[6] = 1;
        }else if(a[i] < 3200){
            ans[7] = 1;
        }else{
            free += 1;
        }
    }

    
    int fixed = 0;
    for(int i=0; i<8; i++){
        if(ans[i] == 1){
            fixed += 1;
        }
    }

    //全員が3200以上の場合を忘れてる気がする
    if(fixed == 0){
        fixed = 1;
        free -= 1;
    }
    printf("%d %d\n", fixed, fixed+free);
    return 0;
}

Measured memory_bytes: 128
let cal_dispersion lst =
  let n = float_of_int (List.length lst) in
  let mid =
    let cal_mid l = (List.fold_left (fun e x -> e +. x) 0. l) /. n in
    cal_mid lst
  in
  (List.fold_left (fun e x -> e +. (x -. mid) ** 2.) 0. lst) /. n;;

let () =
  let read() = Scanf.scanf "%d\n" (fun a -> a) in
  let rec loop() =
    let n = read () in
    if n = 0 then ()
    else
      let as_ = Array.init n (fun _ -> Scanf.scanf "%f " (fun a -> a)) |> Array.to_list in
      let dispersion = cal_dispersion as_ in
      let sd = sqrt dispersion in
      Printf.printf "%10f\n" sd;
      loop()
  in
  loop() ;;


Measured memory_bytes: 3032
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ull unsigned long long
#define pb push_back
#define ps push
#define pf push_front
#define mp make_pair
#define And &&
#define Or ||
#define ppb pop_back
#define ppf pop_front
#define inf INT_MAX
#define sz(name) name.size()
#define len(name) name.length()
#define ig cin.ignore()
#define Sort(name) sort(name.begin(),name.end())
#define For(name,start,finish) for(int name=start;name<finish;name++)
#define fast_in_out ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);

//int row[]={-1,0,1,0};
//int col[]={0,1,0,-1};

const ll N=1e9+10;
const ll M=1e9+7;

ll Max(ll a,ll b){if(a>b)return a;return b;}
ll Min(ll a,ll b){if(a>b)return b;return a;}
ll big_mul(ll a,ll b,ll m){ll x=0,y=a%m;while(b>0){if(b&1)x=(x+y)%m;y=(2*y)%m;b>>=1;}return x%m;}
ll big_mod(ll a,ll b,ll m){ll x=1,y=a%m;while(b>0){if(b&1)x=(x*y)%m;y=(y*y)%m;b>>=1;}return x%m;}
ll Big_mod(ll a,ll b,ll m){ll x=1,y=a%m;while(b>0){if(b&1)x=big_mul(x,y,m);y=big_mul(y,y,m);b>>=1;}return x%m;}
ll mod_inverse(ll a,ll m){return big_mod(a,m-2,m);}  //a^-1 mod m = a^(m-2) mod m

vector<int> vec1;
vector<int> vec2;

int main()
{
    fast_in_out;

    int n,d;
    cin>>n>>d;

    int m=2*d+1;

    int ans=n/m;
    int r=n%m;

    if(r)
        cout<<ans+1;

    else
        cout<<ans<<endl;


    return 0;
}


Measured memory_bytes: 256
# -*- coding: utf-8 -*-
import sys
sys.setrecursionlimit(10**9)
INF=10**18
MOD=10**9+7
input=lambda: sys.stdin.readline().rstrip()
YesNo=lambda b: bool([print('Yes')] if b else print('No'))
YESNO=lambda b: bool([print('YES')] if b else print('NO'))
int1=lambda x:int(x)-1

N,Q=map(int,input().split())
a=tuple(map(int1,input().split()))
lr=[0]*Q
for i in range(Q):
    l,r=map(int1,input().split())
    lr[i]=(r<<40)+(l<<20)+i
lr.sort(reverse=1)
class BIT:
    def __init__(self,n):
        self.num=n
        self.dat=[0]*(self.num+1)
        self.depth=n.bit_length()
    
    def add(self,i,x):
        i+=1
        while i<=self.num:
            self.dat[i]+=x
            i+=i&-i
    
    def sum(self,i):
        i+=1
        s=0
        while i>0:
            s+=self.dat[i]
            i-=i&-i
        return s
    
    def lower_bound(self,x):
        sum_=0
        pos=0
        for i in range(self.depth,-1,-1):
            k=pos+(1<<i)
            if k<=self.num and sum_+self.dat[k]<x:
                sum_+=self.dat[k]
                pos+=1<<i
        return pos, sum_

b=BIT(N)
lastap=[-1]*N
ans=[-1]*Q
mask=(1<<20)-1
lrj=lr.pop()
j=lrj&mask
lrj>>=20
l=lrj&mask
r=lrj>>20
for i,x in enumerate(a):
    if lastap[x]!=-1:
        b.add(lastap[x],-1)
    b.add(i,1)
    lastap[x]=i
    while r==i:
        ans[j]=b.sum(r)-b.sum(l-1)
        if lr:            
            lrj=lr.pop()
            j=lrj&mask
            lrj>>=20
            l=lrj&mask
            r=lrj>>20
        else:
            l,r,j=-1,-1,-1
print(*ans,sep='\n')

Measured memory_bytes: 168660
import sys
import heapq


# \n
def input():
    return sys.stdin.readline().rstrip()


def main():
    X, Y, Z, K = map(int, input().split())
    A = list(map(int, input().split()))
    B = list(map(int, input().split()))
    C = list(map(int, input().split()))

    A.sort(reverse=True)
    B.sort(reverse=True)
    C.sort(reverse=True)

    a = 0
    b = 0
    c = 0
    k = 1

    L = []

    for i in range(X):
        for j in range(Y):
            L.append(A[i] + B[j])

    L.sort(reverse=True)
    newL = L[:min(3000, X * Y)]
    XY = len(newL)
    L=[]
    for i in range(XY):
        for j in range(Z):
            L.append(newL[i]+C[j])

    L.sort(reverse=True)

    for j in range(K):
        print(L[j])



if __name__ == "__main__":
    main()


Measured memory_bytes: 221252
// A - Something on It
#include <bits/stdc++.h>
using namespace std;

int main(){
	string s; cin>>s;
	int ans = 700;
	ans += (s[0]=='o'?100:0);
	ans += (s[1]=='o'?100:0);
	ans += (s[2]=='o'?100:0);
	cout<< ans <<endl;
}

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

#define fio ios::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define per(i,n) for (int i=(int)(n)-1;i>=0;i--)
#define For(i,n) for (int i=1;i<=(int)(n);i++)
#define rep(i,n) for (int i=0;i<(int)(n);i++)
#define all(x) (x).begin(),(x).end()
#define Max(a,b,c) max(a,max(b,c))
#define Min(a,b,c) min(a,min(b,c))
#define pii pair<int,int>
#define vi vector <int>
#define lb lower_bound
#define ub upper_bound
#define ll long long
#define pb push_back
#define re return
#define se second
#define fi first
const int INF=0x7fffffff;
const int MAXN=1000+3;
const int MOD=1e9+7;

char g[MAXN][MAXN];
int n,m,f[MAXN][MAXN];
ll ans;

int main(){
	cin>>n>>m;
	For(i,n){
		cin>>g[i]+1;
	}
	f[0][1]=1;
	For(i,n){
		For(j,m){
			if (g[i][j]=='#') continue;
			f[i][j]=(f[i-1][j]+f[i][j-1])%MOD;
		}
	}
	cout<<f[n][m]<<endl;
	re 0;
}

Measured memory_bytes: 5120
#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <utility>
#include <cmath>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#define rep(i, n) for(int i = 0; i < n; i++)
using namespace std;
typedef long long ll;
const ll mod = 1000000007;

ll gcd(ll x, ll y) {
    if(y == 0) {
        return x;
    }
    else {
        return gcd(y, x%y);
    }
}

ll lcm(ll x, ll y) {
    ll g = gcd(x, y);
    return x / g * y;
}

ll LCM(vector<ll> v) {

    ll x = 1LL;
    rep(i, v.size()) {
        x = lcm(x, v[i]);
    }

    return x;
}

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

    vector<ll> t(n);
    rep(i, n) {
        cin >> t[i];
    }

    cout << LCM(t) << endl;
    return 0;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
int main(){
  int H, W, K;
  cin >> H >> W >> K;
  vector<vector<char>> s(H, vector<char>(W));
  for (int i = 0; i < H; i++){
    for (int j = 0; j < W; j++){
      cin >> s[i][j];
    }
  }
  vector<vector<int>> ans(H, vector<int>(W, -1));
  int R = 0;
  int C = 0;
  int cnt = 1;
  for (int i = 0; i < H; i++){
    bool exist = false;
    for (int j = 0; j < W; j++){
      if (s[i][j] == '#'){
        exist = true;
        for (int k = R; k <= i; k++){
          for (int l = C; l <= j; l++){
            ans[k][l] = cnt;
          }
        }
        cnt++;
        C = j + 1;
      }
    }
    if (exist){
      R = i + 1;
      C = 0;
    }
  }
  for (int i = 0; i < H; i++){
    if (ans[i][0] == -1){
      for (int j = 0; j < W; j++){
        ans[i][j] = ans[i - 1][j];
      }
    } else {
      for (int j = 1; j < W; j++){
        if (ans[i][j] == -1){
          ans[i][j] = ans[i][j - 1];
        }
      }
    }
  }
  for (int i = 0; i < H; i++){
    for (int j = 0; j < W; j++){
      cout << ans[i][j];
      if (j < W - 1){
        cout << ' ';
      }
    }
    cout << endl;
  }
}

Measured memory_bytes: 1280
N = int(input())

As = []
for _ in range(N):
	As.append(int(input()))
	
#print(As)

Bs = sorted(As,reverse=True)

#print(Bs)

for i in range(N):
	if Bs[0] == As[i]:
		print(Bs[1])
	else:
		print(Bs[0])

Measured memory_bytes: 70360
import java.util.Arrays;
import java.util.Scanner;

public class Main {

	static Scanner scanner;
	public static void main(String[] args) {
	    scanner = new Scanner(System.in);

        int n=gi();
        long k=gl();
        long[] H = new long[n];

	    for (int i=0; i<n; i++) {
	    	H[i] = gl();
	    }
	    
	    Arrays.parallelSort(H);
	    
	    long s = 0;
	    for (int i=0; i<n-k; i++) {
	    	s+=H[i];
	    }
	    
        System.out.println(s);
//        if (xo>w || yo>h) {
//        	System.out.print(0);
//        }else {
//        	System.out.print((h-yo)*(w-xo));
//        }


	}

	// 文字列として入力を取得
	public static String gs() {
		return scanner.next();
	}

	// intとして入力を取得
	public static int gi() {
		return Integer.parseInt(scanner.next());
	}

	// longとして入力を取得
	public static long gl() {
		return Long.parseLong(scanner.next());
	}
	
	// doubleとして入力を取得
	public static double gd() {
		return Double.parseDouble(scanner.next());
	}
}

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

bool SecondCompare(const pair<int,int> &a,const pair<int,int> &b)
{
       return a.second<b.second;
}

bool SecondCompareDes(const pair<int,int> &a,const pair<int,int> &b)
{
       return a.second>b.second;
}
int INF = 2000000000;
int n, m;
int l[200001],r[200001],d[200001];
int go[100001], sum[100001];
int ans = INF;
bool flag;

int Find(int x){
    if(go[x] == x)    return x;
    int tmp = Find(go[x]);
    sum[x] += sum[go[x]];
    go[x] = tmp;
    return go[x];
}

int main(){
    int rr, ll;
    cin >> n >> m;
    for(int i = 0; i <= n; i++){
        go[i] = i;
        sum[i] = 0;
    }
    for(int i = 1; i <= m; i++){
        cin >> l[i] >> r[i] >> d[i];
    }

    for(int i = 1; i <= m; i++){
        rr = Find(r[i]);
        ll = Find(l[i]);
        if(rr == ll){
            if(abs(sum[l[i]]-sum[r[i]]) != d[i]){
                cout << "No\n";
                return 0;
            }
        }
        else{
            go[ll] = rr;
            sum[ll] = d[i] - sum[l[i]] + sum[r[i]];
        }
    }
    cout <<"Yes\n";
}

Measured memory_bytes: 3328
#include <bits/stdc++.h>
using namespace std;
#define itn int
#define rep(i, a, b) for(int i = a; i < (b); ++i)
#define all(x) x.begin(), x.end()
#define pb  push_back
#define mb  make_pair
#define fi  first
#define se  second

typedef vector<int> vi;
typedef long long ll;
typedef pair<int, int> pii;
const ll mod = 1000000007;

void solve()
{
    int n;
    cin >> n;
    string s;
    cin >> s;
    int l = s.size();
    if(n >= l){
        cout << s;
    }
    else{
        rep(i,0,n){
            cout << s[i];
        }
        cout << "...";
    }
}
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL); cout.tie(NULL);
    //int t; cin >> t; while(t--)
    solve();
	return 0;
}


Measured memory_bytes: 3584
#include<stdio.h>
int main(void){
  char b;
  scanf("%c",&b);
  if(b=='A'){
    printf("T");
  }
  else if(b=='T'){
    printf("A");
  }
  else if(b=='G'){
    printf("C");
  }
  else if(b=='C'){
    printf("G");
  }
return 0;
}

Measured memory_bytes: 128
S = input().split() # S = [A, B, C]

# ==== ここまで問題設定を変数に ===

A = S[0]
B = S[1]
C = S[2]

cup1_capacity = int(A)
cup1_containing = int(B)
cup2_containing = int(C)

# === 解く ===

water_moved_from_cup2_to_cup1 = cup1_capacity - cup1_containing
cup2_remaining = cup2_containing - water_moved_from_cup2_to_cup1

print(max(cup2_remaining, 0))


Measured memory_bytes: 3060
#include<iostream>
#include<cassert>
#include<vector>
#include<algorithm>
#include<cmath>
#include<cstdlib>
#include<ctime>
using namespace std;
#define REP(i,b,n) for(int i=b;i<n;i++)
#define rep(i,n)   REP(i,0,n)

const int N = 625+2;
const int mod = 2;
int mat[N][N];
//if mod is prime
int mypow(int n,int p){
  if (p == 0)return 1;
  int tmp=mypow(n,p/2);
  tmp=(tmp*tmp)%mod;
  if (tmp%2==1)tmp=(tmp*n)%mod;
  return tmp%mod;
}

inline int inverse(int now){
  if (now == 0)return -1;// now answer
  return 1;
  return mypow(now,mod-2);
}

//if mod is not prime
//extended euqlid?

//partial pivot
bool select_pivot(int r,int c,int k,int mat[N][N]){
  int s=k;
  int val=abs(mat[k][k]);
  REP(i,k+1,r){
    if (abs(mat[i][k])>val)val=abs(mat[i][k]),s=i;
  }
  if (val ==0)return false;
  REP(i,k,c+1)swap(mat[k][i],mat[s][i]);
  return true;
}
 
bool select_pivot(int r,int c,int k,int mat[N][N],int num[N]){
 int s=k,t=k;//selected pivot
 int val=fabs(mat[k][k]);
 REP(i,k+1,r){
   if (val == 1)break;
   REP(j,k+1,c){
     if (val == 1)break;
     if (fabs(mat[i][j]) >val){
       val=fabs(mat[i][j]);
       s=i;
       t=j;
     }
   }
 }
 
 if ( val<1)return false;//cannot solve this linear equations.
 
 rep(i,r)swap(mat[i][k],mat[i][t]);
 
 swap(num[k],num[t]);
 
 REP(i,k,c+1){
   swap(mat[k][i],mat[s][i]);
 }
 return true;//no problem for this pivot;
}

bool gauss(int r,int c,int mat[N][N],int num[N]){
  rep(k,c){
    if (!select_pivot(r,c,k,mat,num)){
      //if (!select_pivot(r,c,k,mat)){
      REP(i,k,r)if (mat[i][c] == 1)return false;
      return true;
    }
    assert(inverse(mat[k][k]) != -1);
    int inv=inverse(mat[k][k]);
    REP(i,k+1,c+1)mat[k][i]=(mat[k][i]*inv)%mod;
    mat[k][k]=1;
    REP(i,k+1,r){
      REP(j,k+1,c+1)mat[i][j]=(mat[i][j]+(-mat[i][k]*mat[k][j]+mod))%mod;
      mat[i][k]=0;
    }
  }
  return true;
  for(int i=r-1;i>=0;i--){
    REP(j,i+1,c){
      mat[i][c]=(mat[i][c]-(mat[i][j]*mat[j][c])+mod)%mod;
    }
  }
  return true;
}

#define GETPOS(c,i,j) ((i)*(c)+(j))

main(){
  int r,c,d;
  int num[N];
  while(cin>>c>>r>>d && r){
    int n=r*c;
    rep(i,n)rep(j,n+1)mat[i][j]=0;
    rep(i,n)num[i]=i;
    rep(i,r)rep(j,c){
      int tmp;cin>>tmp;
      mat[GETPOS(c,i,j)][n]=1-tmp;
    }
    rep(i,r){
      rep(j,c){
	mat[GETPOS(c,i,j)][GETPOS(c,i,j)]=1;
	rep(ii,r){
	  rep(jj,c){
	    if (abs(ii-i)+abs(jj-j) == d){
	      mat[GETPOS(c,i,j)][GETPOS(c,ii,jj)]=1;
	      //cout << "(" <<i<<","<<j<<"),("
	      //<< ii<<","<<jj<<")"<<endl;
	      //cout << GETPOS(c,i,j)+1 <<" " << GETPOS(c,ii,jj)+1 << endl;
	    }
	  }
	}
      }
    }


    /*    rep(i,n){
      rep(j,n+1)cout << mat[i][j] <<" ";
      cout << endl;
    }      
    */

    cout << gauss(n,n,mat,num) << endl;
  }
  return false;
}

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

using ll = long long;
using ld = long double;
#define FOR(i, m, n) for (int i = (m); i < (n); i++)
#define FORR(i, m, n) for (int i = (m); i >= (n); i--)
#define REP(i, n) FOR(i, 0, (n))
#define REPR(i, n) FORR(i, (n) - 1, 0)
#define REP1(i, n) FOR(i, 1, (n) + 1)
#define REPS(c, s) for (char c : s)
#define ALL(c) (c).begin(), (c).end()
#define sz(v) (int)v.size()
template<class T> inline bool chmin(T& a, T b) {if (a > b) {a = b; return true;} return false;}
template<class T> inline bool chmax(T& a, T b) {if (a < b) {a = b; return true;} return false;}
const int MOD = 1000000007;
const int INF = 1000000001;
const ll LINF = 1000000001000000001LL;
const char EOL = '\n';

void solve();

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout << fixed << setprecision(numeric_limits<double>::max_digits10);
    solve();
    return 0;
}

void solve() {
    int a, b, c;
    cin >> a >> b >> c;
    cout << (a + b + c > 21 ? "bust" : "win") << EOL;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
typedef long long ll;
const int INF=1e9,MOD=1e9+7,ohara=1e6;
const ll LINF=1e18;
using namespace std;

#define rep(i,n) for(ll (i)=0;(i)<(int)(n);(i)++)
#define rrep(i,a,b) for(ll i=(a);i<(b);i++)
#define rrrep(i,a,b) for(ll i=(a);i>=(b);i--)
#define all(v) (v).begin(), (v).end()
#define pb(q) push_back(q)
#define Size(n) (n).size()
#define Cout(x) cout<<(x)<<endl

ll n,cnt=0,ans=0,a,b,c,d,cmp,cmpp,m,h,w,x,y,sum=0,pos;
int dy[]={1,0,-1,0};
int dx[]={0,1,0,-1};
//int dy[]={-1,0,1,-1,1,-1,0,1};
//int dx[]={-1,-1,-1,0,0,1,1,1};
string alph("abcdefghijklmnopqrstuvwxyz"),s,ss,sss;
bool fl;
struct edge{int to,cost;};

//-------------------------↓↓↓↓↓↓------------------------

int main(void){
       cin.tie(0);
    ios::sync_with_stdio(false);
      
    cin>>n>>s;
    rep(i,Size(s)){
        if(s[i]=='D')cnt--;
        else cnt++;
        ans=max(ans,cnt);
    }
    Cout(ans);
    return 0;
}


Measured memory_bytes: 256
#include<iostream>

using namespace std;

int main(){
  int n,i,j,c=0;
  
  cin>>n;
  
  for(i=n/7;i>=0;i--){
    j=(n-7*i)%4;
    if(j==0)
      c++;
  }
  cout<<(c>0?"Yes":"No")<<endl;
    return 0;
    
}

Measured memory_bytes: 256