akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <cstdio>
#include <fstream>
#include <algorithm>
#include <cmath>
#include <deque>
#include <vector>
#include <queue>
#include <string>
#include <cstring>
#include <map>
#include <stack>
#include <set>
#include <list>
#define INF 0x3f3f3f3f
#define maxn 105000
#define maxnn 6000
#define juzheng 300
#define line cout << "-------------------------" << endl;
#define PI acos(-1.0)
#define mem(a,b) memset(a,b,sizeof(a))
#define fill_(a,b,n) fill(a,a + n,b)
#define esp 1e-9
 
#define ri(n) scanf("%d",&n)
#define ri2(a,b) scanf("%d %d",&a,&b)
#define ri3(a,b,c) scanf("%d %d %d",&a,&b,&c)
#define rd(n) scanf("%lf",&n)
#define rd2(a,b) scanf("%lf %lf",&a,&b)
#define rd3(a,b,c) scanf("%lf %lf %lf",&a,&b,&c)
#define rl(n) scanf("%lld",&n)
#define rl2(a,b) scanf("%lld %lld",&a,&b)
#define rl3(a,b,c) scanf("%lld %lld %lld",&a,&b,&c)
#define rui(n) scanf("%u",&n)
#define rui2(a,b) scanf("%u %u",&a,&b)
#define rui3(a,b,c) scanf("%u %u %u",&a,&b,&c)
#define rs(str) scanf("%s",str)
#define pr(n) cout << n << endl
#define debug(str,x) cout << str << ":" << x << endl
#define ll long long
#define int64 __int64
#define ui unsigned int

using namespace std;

const ll mod = 1e9 + 7;

//Date:2018-8-18
//Author：HarryBlackCat

int arr[maxn];

void init(){
	mem(arr,0);
	for(int i = 1;i <= 500;i += 2){
		int sum = 0;
		for(int j = 1;j <= i;j++){
			if(i % j == 0)
				sum++;
		}
		arr[i] = arr[i - 2] + (sum == 8 ? 1 : 0);
		arr[i + 1] = arr[i];
		//printf("i:%d arr:%d\n",i,arr[i]);
	}
}

int main() {
	//cin.sync_with_stdio(false);//降低cin，cout时间
	init();
	int x;
	while(~ri(x)){
		pr(arr[x]);
	}
	return 0;
}

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

int main() {
  int n,m;
  cin >> n >> m;
  
  if(n >= 13){
    cout << m << endl;
    return 0;
  }
  else if(n < 13 && n >= 6){
    cout << m/2 << endl;
    return 0;
  }
  else{
    cout << 0 << endl;
    return 0;
  }
}

Measured memory_bytes: 3648
package main

import (
	"bufio"
	"fmt"
	"os"
	"sort"
	"strconv"
)

type tile struct {
	color, num int
}

type tiles []tile

func (t tiles) Len() int {
	return len(t)
}
func (t tiles) Swap(i, j int) {
	t[i], t[j] = t[j], t[i]
}
func (t tiles) Less(i, j int) bool {
	return t[i].num < t[j].num
}

func main() {
	var h, w, n int
	fmt.Scan(&h, &w, &n)
	sc := bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanWords)
	ts := make([]tile, n)
	for i := range ts {
		var t int
		sc.Scan()
		t, _ = strconv.Atoi(sc.Text())
		ts[i].color = i + 1
		ts[i].num = t
	}
	sort.Sort(sort.Reverse(tiles(ts)))
	// fmt.Println("h", h, "w", w, "n", n, "ts", ts)
	mapout := make([][]int, h)
	for i := range mapout {
		mapout[i] = make([]int, w)
	}
	ci := 0
	for y := 0; y < h; y++ {
		for x := 0; x < w; x++ {
			if ts[ci].num == 0 {
				ci++
			}
			var tx int
			if y%2 == 0 {
				tx = x
			} else {
				tx = w - x - 1
			}
			mapout[y][tx] = ts[ci].color
			ts[ci].num--
		}
	}
	// fmt.Println(mapout)
	for y := 0; y < h; y++ {
		for x := 0; x < w; x++ {
			fmt.Print(mapout[y][x], " ")
		}
		fmt.Println()
	}
}


Measured memory_bytes: 1152
#include <stdio.h>
#include <iostream>
#include <vector>
#include <queue>
#include <stack>
#include <algorithm>

using ll = long long int;
const int INF = (1<<30);
const ll INFLL = (1ll<<60);
const ll MOD = (ll)(1e9+7);

#define l_ength size

void mul_mod(ll& a, ll b){
	a *= b;
	a %= MOD;
}

void add_mod(ll& a, ll b){
	a = (a<MOD)?a:(a-MOD);
	b = (b<MOD)?b:(b-MOD);
	a += b;
	a = (a<MOD)?a:(a-MOD);
}

int h[100100];
bool ans[100100];

int main(void){
	int n,a,b,i,m,ret=0;
	std::cin >> n >> m;
	std::fill(ans,ans+n,true);
	for(i=0; i<n; ++i){
		std::cin >> h[i];
	}
	for(i=0; i<m; ++i){
		std::cin >> a >> b;
		--a; --b;
		if(h[a] >= h[b]){
			ans[b] = false;
		}
		if(h[a] <= h[b]){
			ans[a] = false;
		}
	}
	for(i=0; i<n; ++i){
		if(ans[i]){
			++ret;
		}
	}
	std::cout << ret << std::endl;
	return 0;
}


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

using namespace std;

#define REP(i,n) for(ll (i) = (0);(i) < (n);++i)
#define REV(i,n) for(ll (i) = (n) - 1;(i) >= 0;--i)
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define FI first
#define SE second
#define SHOW1d(v,n) {REP(WW,n)cerr << v[WW] << ' ';cerr << endl << endl;}
#define SHOW2d(v,WW,HH) {REP(W_,WW){REP(H_,HH)cerr << v[W_][H_] << ' ';cerr << endl;}cerr << endl;}
#define ALL(v) v.begin(),v.end()
#define Decimal fixed<<setprecision(20)
#define INF 1000000000
#define LLINF 1000000000000000000LL
#define MOD 998244353
#define fastcin() cin.tie(0);ios::sync_with_stdio(false)

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

int main(){

	int n;cin >> n;
	vector<P> v(n);
	REP(i, n){
		cin >> v[i].FI;
		v[i].SE = i + 1;
	}

	sort(ALL(v),greater<P>());

	int now = n;
	stack<int> st;
	vector<char> ans;

	REP(i, n){
	//cout << "v " << v[i].FI << " " << v[i].SE << endl;
		while(now > 0 && now >= v[i].SE){
			ans.PB(')');
			st.push(now);
			now--;
		}
	//	cout << " " << now << " " << st.top() << endl;
		if(st.empty() || st.top() != v[i].SE){
			cout << ":(" << endl;
			return 0;
		}

		ans.PB('(');
		st.pop();
	}

	REP(i,ans.size())cout << ans[ans.size() - i - 1];
	cout << endl;


	return 0;
}



Measured memory_bytes: 4840
/*
 * main.c
 *
 *  Created on: 2019/01/27
 *      Author: family
 */


#include <stdio.h>
#include <stdlib.h>
#include <string.h>

char a[3][100] = {0};
int alp[26] = {0};

int char_count(int pos) {
	int loop = 0;
	int i = 1;
	int max = 0;
	memset(&alp[0], 0, sizeof(int) * 26);
	for(loop = 0; loop < 3; loop++) {
//		printf("%x ", a[loop][pos]);
		alp[(a[loop][pos]) - 0x61]++;
	}
	max = alp[0];
	for(i = 1; i < 26; i++) {
		if (alp[i] > max) {
			max = alp[i];
		}
	}
	//printf("max %d\n",max);
	return 3 - max;
}

int main()
{
	int n_len;
	int i = 0;
	int count = 0;

	scanf("%d", &n_len);
	for(i=0; i < 3; i++) {
		scanf("%s", &a[i][0]);
	}

	for(i = 0; i < n_len; i++) {
		count += char_count(i);
	}
	printf("%d",count);
	return 0;
}


Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define rep(i, n) for (ll i = 0; i < n; i++)
#define FOR(i, a, b) for (ll i = a; i < b; i++)
#define len(v) ll(v.size())

template <class T>
void cout_vec(const vector<T> &vec){
  for(auto itr:vec) cout<<itr<<' ';
  cout<<'\n';
}

typedef pair<ll,ll> P;
const ll mod=1e9+7;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll a,b,c,k;
    cin>>a>>b>>c>>k;
    if(k%2==0) cout<<a-b<<endl;
    else cout<<b-a<<endl;
}

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

using namespace std;
#define PI 3.1415926535897932384626433832795
#define MOD (1000000007)
#define EPS (1e-15)
#define rep(i, n) for (int i = 0; i < (n); i++)
#define repc(i, s, n) for (int i = (s); i <= (n); i++)
#define rrep(i, n) for (int i = (n) - 1; i >= 0; i--)
#define rrepc(i, s, n) for (int i = (s); i >= (n); i--)
#define bet(x, a, b) (a) <= (x) && (x) < (b)
typedef long long ll;
typedef unsigned long long ull;



int main()
{
	string W, S;
	int ans = 0;

	cin >> W;
	int len = W.length();
	rep(i, len) if ('A' <= W[i] && W[i] <= 'Z') W[i] += 0x20;

	while (true) {
		cin >> S;

		if (S == "END_OF_TEXT") break;
		if (len != W.length()) continue;

		rep(i, len) {
			if ('A' <= S[i] && S[i] <= 'Z') S[i] += 0x20;
		}

		if (S == W) ans++;
	}

	cout << ans << endl;




	return 0;
}



Measured memory_bytes: 3108
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define fi first
#define se second
#define pb push_back
#define sz(x) ((int)(x).size())
#define all(x) x.begin(),x.end()
#define dmp(x) cerr<<#x<<":"<<x<<endl
typedef pair<int,int> P;
typedef pair<int,P> PP; 
template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}
const int MOD = 1e9+7;

signed main(){
  int n;
  cin>>n;
  map<string,int> mp;
  for(int i=0;i<n;i++){
    string s;
    cin>>s;
    sort(all(s));
    mp[s]++;
  }
  int ans=0;
  for(auto a:mp){
    ans+=a.second*(a.second-1)/2;
  }
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 11136
#include<bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define PB push_back
#define MP make_pair
#define REP(i,a,b) for(inti=a;i<=b;i++)

#define MOD 1000000007
typedef long long int ll;
typedef vector<int>vi;
typedef pair<int,int>pi;



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

ll n ;
cin>>n;


ll arr[n];
for(ll index = 0 ;index < n;index++)
{
    cin>>arr[index];
    if(arr[index]%2)
    {
        cout<<0<<endl;
        return 0;
    }
}


int ans =INT_MAX;

for(ll index =0;index <n;index++)
{
    int div = 2;
    int curr=0;
    while(arr[index]%div==0)
    {
        curr++;
        div*=2;
    }
    ans =min(ans,curr);
}

cout<<ans<<endl;
 return 0;
}


Measured memory_bytes: 3580
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
int t=0;
int mentsu(int pi[12]){
  int i=1,m=1,r=0; 
  while(pi[m]==0&&m<10)m++;
  if(pi[m]!=0&&pi[m+1]!=0&&pi[m+2]!=0){
    pi[m]--;
    pi[m+1]--;
    pi[m+2]--;
    r=mentsu(pi);
    pi[m]++;
    pi[m+1]++;
    pi[m+2]++;      
  }
  if(pi[m]>2&&r==0){
    pi[m]-=3;
    r=mentsu(pi);
    pi[m]+=3;
  }
  if(t==0&&pi[m]>1&&r==0){
    if(pi[m]>1){
      pi[m]-=2;
      t=1;
      r=mentsu(pi);
      t=0;
      pi[m]+=2;
    }
    }
  if(m==10||r==1)return 1;
  else           return 0;
}

int main(){
  char s[14]={'\0'};
  int n[14],i,j,a;
  while(fgets(s,14,stdin)!=NULL){
    if(strlen(s)==13){
      a=0;
      for(i=1;i<10;i++){
	int pi[12]={0};
	for(j=0;j<13;j++){
	  pi[s[j]-'0']++;
	}
	pi[i]++;
	if(pi[i]<5){
	  if(mentsu(pi)){
	    if(a==1)printf(" ");
	    printf("%d",i);
	    a=1;
	  }
	}
      }
      if(a==0)printf("0");
      printf("\n");
    }
  }
  return 0;
}

Measured memory_bytes: 524
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
#define RI(a) scanf("%d",&a)
#define RII(a,b) scanf("%d%d",&a,&b)
#define RIII(a,b,c) scanf("%d%d%d",&a,&b,&c)
#define IOS ios_base::sync_with_stdio(0); cin.tie(0)
#define ALL(a) a.begin(),a.end()
#define F first
#define S second
#define REP(i,n) for(int i=0;i<(n);i++)
#define pb push_back
#ifdef leowang
#define debug(...) do{\
	fprintf(stderr,"%s - %d : (%s) = ",__PRETTY_FUNCTION__,__LINE__,#__VA_ARGS__);\
	_DO(__VA_ARGS__);\
}while(0)
template<typename I> void _DO(I&&x){cerr<<x<<endl;}
template<typename I,typename...T> void _DO(I&&x,T&&...tail){cerr<<x<<", ";_DO(tail...);}
#else
#define debug(...)
#endif
//}}}
const ll maxn=100005;
const ll maxlg=__lg(maxn)+2;
const ll INF64=8000000000000000000LL;
const int INF=2000000000;

int a,b,c,d,e,f;

bool water[3005];
bool sugar[3005];
double density[35];

void build(){
	for(int i=0;i<min(35,a*b);i+=a){
		for(int j=0;j+i<35;j+=b)
			water[i+j]=1;
	}
	for(int i=0;i<min(3005,c*d);i+=c){
		for(int j=0;j+i<3005;j+=d)
			sugar[i+j]=1;
	}	
}
void go(int t){
	if(!water[t]){
		density[t]=-1;
		return;
	}
	int tmp=min(t*e,f-100*t);
	while(!sugar[tmp]) tmp--;
	density[t]=1.0*tmp/t;
}

int main()
{
	cin>>a>>b>>c>>d>>e>>f;
	build();
	for(int i=1;i<31;i++){
		go(i);
	}
	int idx=1;
	for(int i=1;i<31;i++){
		if(density[idx]<density[i]) idx=i;
	}
	int tmp=(int) (density[idx]*idx+0.5);
	cout<<idx*100+tmp<<' '<<tmp;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using i64 = int64_t;
using vi = vector<i64>;
using vvi = vector<vi>;

i64 solve_knapsack_small_value(const vi &ws, const vi &vs, int MAX_VALUE, i64 W) {
    int n = ws.size();
    int V = n * MAX_VALUE;
    vi weight(V + 1, 1e18);
    weight[0] = 0;
    for (int i = 0; i < n; i++) {
        for (int j = V; j >= 0; j--) {
            if (j - vs[i] >= 0) {
                weight[j] = min(weight[j], weight[j - vs[i]] + ws[i]);
            }
        }
    }
    i64 nax = 0;
    for (int i = 0; i <= V; i++) {
        if (weight[i] <= W) {
            nax = max(nax, i64(i));
        }
    }
    return nax;
}

int main() {
    int n, w;
    cin >> n >> w;
    vi ws(n), vs(n);
    for (int i = 0; i < n; i++) {
        cin >> ws[i] >> vs[i];
    }
    cout << solve_knapsack_small_value(ws, vs, 1000, w) << endl;
}


Measured memory_bytes: 1024
// 2020-08-28 20:05:58
// clang-format off
#include<bits/stdc++.h>
#ifdef LOCAL
#include "lib/debug.hpp"
#else
#define debug(...) 1
#endif
#define ALL(a) (a).begin(), (a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define rep(i, n) REP(i, 0, (n))
#define repc(i, n) REPC(i, 0, (n))
#define REP(i, n, m) for (int i = (int)(n); i < (int)(m); i++)
#define REPC(i, n, m) for (int i = (int)(n); i <= (int)(m); i++)
#define REPCM(i, n, m) for (int i = (int)(n); i >= (int)(m); i--)
using namespace std;
using ll = long long;
using ld = long double;
using pr = pair<ll, ll>;
using vll = vector<ll>;
using vpr = vector<pr>;
using P = pair<int, int>;
template<class T> inline bool chmin(T& a, const T& b) { if (a > b) { a = b; return true; } else return false; }
template<class T> inline bool chmax(T& a, const T& b) { if (a < b) { a = b; return true; } else return false; }

// clang-format on
int b = 0;
struct Cake {
  ll x, y, z;
  Cake(ll x_, ll y_, ll z_) : x(x_), y(y_), z(z_) {}
  ll score() const {
    ll res = 0;
    if ((b >> 0) & 1)
      res += x;
    else
      res -= x;
    if ((b >> 1) & 1)
      res += y;
    else
      res -= y;
    if ((b >> 2) & 1)
      res += z;
    else
      res -= z;
    return res;
  }
  bool operator<(const Cake& rhs) const { return score() < rhs.score(); }
};

void answer() {
  int n, m;
  cin >> n >> m;
  vector<Cake> cs;
  rep(i, n) {
    ll x, y, z;
    cin >> x >> y >> z;
    cs.emplace_back(x, y, z);
  }
  ll ans = 0;
  for (b = 0; b < 8; b++) {
    sort(ALL(cs));
    ll nx = 0, ny = 0, nz = 0;
    rep(i, m) {
      nx += cs[i].x;
      ny += cs[i].y;
      nz += cs[i].z;
    }
    chmax(ans, abs(nx) + abs(ny) + abs(nz));
  }
  cout << ans << '\n';
}
int main() {
  std::ios::sync_with_stdio(false);
  std::cin.tie(0);
  answer();
  return 0;
}

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

#define reps(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n)   reps(i,0,n)
#define all(x) (x).begin(),(x).end()
#define INF (1000000000)
#define MOD (1000000007)
#define PI (acos(-1))

int D[60][60],H,W;//distance
char c[60][60];

void bfs(int sy,int sx){
  int vx[4] = {0,1,0,-1};
  int vy[4] = {1,0,-1,0};

  rep(i,60){
    rep(j,60){
      D[i][j] = -1;
    }
  }
  D[sy][sx] = 0;

  queue<pair<int,int> > Q;
  Q.push(make_pair(sy,sx));

  while(!Q.empty()){
    pair<int,int> cur = Q.front();
    Q.pop();

    rep(i,4){
      int tmpy = cur.first+vy[i];
      int tmpx = cur.second+vx[i];
      if(c[tmpy][tmpx] == '.' && D[tmpy][tmpx] == -1){
        D[tmpy][tmpx] = D[cur.first][cur.second]+abs(vy[i])+abs(vx[i]);
        Q.push(make_pair(tmpy,tmpx));
      }
    }

  }
}

int main(){
  cin >> H >> W;
  int cnt=0;
  rep(i,H+2){
    rep(j,W+2){
      if(i==0 || i==H+1 || j==0 || j==W+1){
        c[i][j] = '#';
        continue;
      }
      cin >> c[i][j];
      if(c[i][j] == '.')cnt++;
    }
  }

  bfs(1,1);

  /*rep(i,R){
    rep(j,C){
      cout << D[i][j] << " ";
    }
    cout << endl;
  }*/
  if(D[H][W]<0){
    cout << -1 << endl;
  }else{
    cout << cnt-D[H][W]-1 << endl;
  }
}

Measured memory_bytes: 256
#include<stdio.h>
int main(void)
{
	int a, b, c, d;
	scanf("%d %d",&a, &b);
	if(a<b){
		printf("a < b\n");
	}
	if(a>b){
		printf("a > b\n");
	}
	if(a==b){
		printf("a == b\n");
	}
	return 0;
}

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

m0 = 1
m1 = 1
max_i = []
for i in range(N):
    a = int(input())
    if a > m0:
        m1 = m0
        m0 = a
        max_i = []
        max_i.append(i)
    elif a == m0:
        m1 = a
    elif a > m1:
        m1 = a
for i in range(N):
    if i in max_i:
        print(m1)
    else:
        print(m0)

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

typedef long long ll;
typedef pair<ll,ll> P;
typedef pair<P,ll> PLL;
typedef pair<P,P> PP;
typedef vector<ll> VECLL;
typedef vector<P> VECP;
typedef priority_queue<P,VECP,greater<P> > PQP;
typedef priority_queue<ll, VECLL, greater<ll> > PQll;

#define rep(i,a,n) for(ll i = a;i < n;i++)   
#define rrep(i,a,n) for(ll i = n; i >= a;i--)
#define index_check(i,n) if(i > n-1 || i < 0) continue; 
#define LINF (ll)1e18
#define INF (int)1e9
#define fs first
#define sc second

const ll MOD = 1e9+7;

int main(){

    ll n;
    cin >> n;
    bool isprime[55556] = {};
    rep(i,2,55556) isprime[i] = true;

    for(ll i = 2; i * i < 55556; i++){
        for(ll j = i; i * j < 55556; j++){
            isprime[i*j] = false;
        }
    }

    vector<ll> primelist;
    rep(i,0,55556) if(isprime[i] && i % 5 == 1) primelist.push_back(i);

    rep(i,0,n){
        cout << primelist[i] << ((i != n-1)?" ":"\n");
    }
}


Measured memory_bytes: 3692
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];
        int left[] = new int[n+1]; //左からの累積GCD配列
        int right[] = new int[n+1]; //右からの累積GCD配列
        
        for(int i=0; i<n; i++){
            a[i] = sc.nextInt();
        }
        for(int i=0; i<n; i++){
            left[i+1] = gcd(left[i], a[i]);
        }
        for(int i=n-1; i >= 0; i--){
            right[i] = gcd(right[i+1], a[i]);
        }

        int gcd_max = 0;
        for(int i=0; i<n; i++){
            gcd_max = Math.max(gcd(left[i],right[i+1]),gcd_max);
        }
        System.out.println(gcd_max);
    }
    static int gcd(int a, int b){
        if(b==0) return a;
        else return gcd(b, a%b);
    }
}

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

int s(int n){
  int res=0;
  while(n>0){
    res+=n%10;
    n/=10;
  }
  return res;
}

double f(int n){
  return (double)n/s(n);
}

signed main(){
  vector<int> v;
  int b=1;
  for(int i=0;i<15;i++){
    for(int j=1;j<150;j++){
      v.push_back(b*(j+1)-1);
    }
    b*=10;
  }
  sort(v.begin(),v.end());
  v.erase(unique(v.begin(),v.end()),v.end());
  for(int i=0;i<v.size();i++){
    for(int j=i+1;j<v.size();j++){
      if(f(v[i])>f(v[j])){
	v.erase(v.begin()+i--);
	break;
      }
    }
  }
  int k;
  cin>>k;
  for(int i=0;i<k;i++)cout<<v[i]<<endl;
  return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

int main() {

 int a, b;
 scanf("%d %d", &a, &b);

 if(a > b) {
  printf("a > b\n");
 }

 else if(a < b) {
  printf("a < b\n");
 }

 else {
  printf("a == b\n");
 }
 
 return 0;
}

Measured memory_bytes: 1780
#include<iostream>
#include<algorithm>
using lint=int64_t;
using namespace std;

int main()
{
	string str;
	cin >> str;
	
	int y,m,s;
	y=1000*(str[0]-'0')+100*(str[1]-'0')+10*(str[2]-'0')+str[3]-'0';
	m=10*(str[5]-'0')+str[6]-'0';
	s=10*(str[8]-'0')+str[9]-'0';
	
	if(m<=4)
		cout << "Heisei";
	else 
		cout << "TBD";
	cout << endl;
	return 0;
}



Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <queue>
#include <utility>

using namespace std;

int lr[4]={1, 0, -1, 0};
int ud[4]={0, 1, 0, -1};

int main() {
    int H, W;
    cin >> H >> W;
    vector<vector<int> > A(H, vector<int>(W));
    for(int h=0; h<H; h++) {
        for(int w=0; w<W; w++) {
            cin >> A[h][w];
        }
    }
    int dir=0;
    queue<pair<int, int> > que;
    que.push(make_pair(0, 0));
    vector<vector<bool> > seen(H, vector<bool>(W, false));
    vector<pair<pair<int, int>, pair<int, int> > > ans;
    while(!que.empty()) {
        pair<int, int> hw=que.front(); que.pop();
        int curh=hw.first, curw=hw.second;
        seen[curh][curw]=true;
        bool flag=false;
        if(A[curh][curw]%2) {
            flag=true;
        }
        int tmpd=dir;
        while(tmpd-dir<4) {
            if(curh+ud[tmpd%4]<0 || curh+ud[tmpd%4]>=H || curw+lr[tmpd%4]<0 || curw+lr[tmpd%4]>=W) {
                tmpd++;
                continue;
            }
            if(seen[curh+ud[tmpd%4]][curw+lr[tmpd%4]]) {
                tmpd++;
                continue;
            }
            if(flag) {
                A[curh+ud[tmpd%4]][curw+lr[tmpd%4]]++;
                ans.push_back(make_pair(make_pair(curh, curw), make_pair(curh+ud[tmpd%4], curw+lr[tmpd%4])));
            }
            que.push(make_pair(curh+ud[tmpd%4], curw+lr[tmpd%4]));
            dir = tmpd%4;
            break;
        }
    }
    cout << ans.size() << endl;
    for(int i=0; i<ans.size(); i++) {
        cout << ans[i].first.first+1 << " " << ans[i].first.second+1 << " " << ans[i].second.first+1 << " " << ans[i].second.second+1 << endl;
    }

    return 0;
    
}

Measured memory_bytes: 6428
n = int(input())
P = [int(x) for x in input().split()]

count = 0
for i in range(1, n-1):
    p1 = P[i-1]
    p2 = P[i]
    p3 = P[i+1]
    if (p1 < p2 < p3) or (p3 < p2 < p1):
        count += 1
        
print(count)

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,n) for(int i=0;i<(int)n;i++)
#define rp(i,n) for(int i=1;i<=(int)n;i++)
int main(){
string s,t;cin>>s>>t;bool b=true;
for(int i=0;i<s.size();i++){
    if(s[i]!=t[i])b=false;
}
if(b)cout<<"Yes"<<endl;
else cout<<"No"<<endl;
}

Measured memory_bytes: 3548
#include<iostream>
#include<map>
#include<set>
#include<unordered_set>
#include<unordered_map>
#include<vector>
#include<cstring>
#include<sstream>
#include<algorithm>
//#include<bits/stdc++.h>
#include<cstdio>
using namespace std;

#define MOD 1000000007

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

    int l, r, d;
    cin >> l >> r >> d;

    int ret = 0;
    for (int i = l; i <= r; i++) {
        ret += (i%d == 0);
    }

    cout << ret << endl;

    return 0;
}


Measured memory_bytes: 3196
#include <iostream>
#include <string>
#include <algorithm>
#include <iomanip>
#include <vector>
#include <map>
#include <cmath>
#include <queue>
#include <utility>
#include <functional>
#include <numeric>
#include <limits>
#include <stdlib.h>

const long long int Z = 1000000007;
const long long int INF = 1 << 30;
const int V = 10;
struct edge { int to, cost; };
std::vector<edge>v[100];
typedef std::pair<int, int>p;

int main() {
	int n, s[100], ans = 0, min = 1000;
	std::cin >> n;
	for (int i = 0;i < n;i++) {
		std::cin >> s[i];
		ans += s[i];
		if (min > s[i]&&s[i]%10!=0) {
			min = s[i];
		}
	}
	if (ans % 10 != 0) {
		std::cout << ans << std::endl;
	}
	else {
		if (min != 1000) {
			std::cout << ans - min << std::endl;
		}
		else {
			std::cout << 0 << std::endl;
		}
	}
	return 0;
}

Measured memory_bytes: 256
#include <iostream>//cout<<right で右揃え
#include <iomanip>//cout<<setw(数字) で空白による桁揃え
#include <string>
#include <vector>
#include <queue>
#include <algorithm>
#include <cstdlib>//abs()で整数絶対値
#include <cmath>//abs()かfabs()で少数絶対値
#include <functional>//sort第三引数greater<型名>()で降順

using namespace std;
using ll = long long int;

int main(){
    int N,M,Q;cin>>N>>M>>Q;
    vector<int> A(N,1),a(Q),b(Q),c(Q),d(Q);
    for(int i=0;i<Q;i++){
        cin>>a[i]>>b[i]>>c[i]>>d[i];
    }
    int max = 0;
    do{
        for(int i=N-1;i>=1;i--){
            if(A[i]==M+1){
                A[i-1]++;
                for(int j=i;j<N;j++){
                    A[j] = A[i-1];
                }
            }
        }
        int sum = 0;
        for(int i=0;i<Q;i++){
            if(A[b[i]-1]-A[a[i]-1]==c[i]){
                sum += d[i];
            }
        }
        if(sum>max) max = sum;
        A[N-1]++;
    }while(A[0]!=M);
    cout << max << endl;
    return 0;
}

Measured memory_bytes: 3636
#include <bits/stdc++.h>
using namespace std;
#define endl "\n"
#define int long long

const int N=1005;
const int MOD=1e9+7;
 
 
int32_t main()
{
  
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  
  string s;
  cin>>s;
  int x=s.size();
  for(int i=0;i<x;i++)
  {
      cout<<"x";
  }
  
}



Measured memory_bytes: 256
//#include <bits/stdc++.h>
//#include <stdio.h>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <vector>
#include <map>
#include <unordered_map>
#include <set>
#include <tuple>
#include <string>
#include <algorithm>
#include <functional>
#include <queue>
#include <stack>
#include <cmath>
#include <bitset>

using namespace std;
using ll=long long;
using intpair=pair<int,int>;
using intpv=vector<intpair>;
using llpair=pair<ll,ll>;
using llpv=vector<llpair>;
using intvec=vector<int>;
using llvec=vector<ll>;
using intq=queue<int>;
using llq=queue<ll>;
using intmat=vector<intvec>;
using llmat=vector<llvec>;
using pairmat=vector<llpv>;

template<typename T>
using matrix=vector<vector<T>>;
template<typename T>
using pque=priority_queue<T>;
template<typename T>
using lpque=priority_queue<T,vector<T>,greater<T>>;

#define PI 3.141592653589793
#define INTINF 1<<30
#define LLINF 1LL<<60
#define MPRIME 1000000007
#define MPRIME9 998244353

#define len length()
#define pushb push_back
#define fi first
#define se second

#define setpr fixed<<setprecision(15)
#define all(name) name.begin(),name.end()
#define rall(name) name.rbegin(),name.rend()
#define gsort(vbeg,vend) sort(vbeg,vend,greater<>())
#define matin(mat,H,W) for(int i__=0; i__<H; i__++)for(int j__=0; j__<W; j__++) cin>>mat[i__][j__]
#define out(n) cout<<n<<endl

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

template<class T>
inline void outmat(T& a, int y, int x) {
	for(int i=0; i<y; i++) {
		for(int j=0; j<x; j++) cout<<a[i][j]<<" ";
		cout<<endl;
	}
}

template<class T>
inline void init(T& v) {
	for(auto &a__: v) cin>>a__;
}
template<class T, class N>
inline void init(T& v, N n) {
	v.resize(n);
	for(auto &a__: v) cin>>a__;
}

template<class N> void resiz(N n) {} // empty
template<class N, class T, class... U>
void resiz(N n, T&& hd, U&&... tl) {
	hd.resize(n);
	resiz(n,forward<U>(tl)...);
}

ll GCD(ll a, ll b) { //最大公約数
	if(a==0||b==0) return 0;
	if(a<b) swap(a,b);
	ll tmp = a%b;
	while(tmp!=0) {
		a = b;
		b = tmp;
		tmp = a%b;
	}
	return b;
}

ll binpow(ll a, ll ex, ll p) { //繰り返し二乗法
	ll result=1;
	while(ex>0) {
		if(ex&1) result=result*a%p;
		ex>>=1;
		a=a*a%p;
	}
	return result;
}

ll Fact(ll x, ll p) { //階乗
	ll f=1;
	for(ll i=2; i<=x; i++) {
		f*=i;
		f%=p;
	}
	return f;
}

int DigitNum(ll n) { //桁数
	int digit=0;
	ll div=1LL;
	while(n/div) {
		digit++;
		div*=10;
	}
	return digit;
}


string S;

void input() {
	cin>>S;
}

void solve() {
	for(int i=0; i<S.length(); i++) {
		if(S[i]=='?') cout<<'D';
		else cout<<S[i];
	}
	cout<<endl;
}

int main() {
	while(1) {
		input();
		solve();
		break;
	}
}


Measured memory_bytes: 3768
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>

using namespace std;

typedef long long ll;
typedef pair<ll, ll> P;
vector<P> v, u;
vector<P> diff;
map<P, ll> Point;


int main () {

    int n; cin >> n;

    
    ll x, y, x_b, y_b;
    for (int i = 0; i < n; i++) {
        x_b = x; y_b = y;
        cin >> x >> y;
        v.push_back(P(x, y));
    }


    for (int i = 0; i < n; i++) {
        for (int j = 0; j < n; j++) {
            if (i != j)
            Point[P(v[i].first - v[j].first, v[i].second - v[j].second)]++;
        }
    }

    if (n == 1) {
        cout << 1 << '\n';
        return 0;
    }

    ll ans = n;

    for (auto e : Point) {
        ans = min(ans, n - e.second);
    }

    cout << ans << '\n';


}



Measured memory_bytes: 384
//package hiougyf;

import java.util.*;;

public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		   //Reader sc=new Reader();
        Scanner sc =new Scanner(System.in);
     String s=sc.next();
      String t=sc.next();
      int n=s.length();
      int m=t.length();
      int min=Integer.MAX_VALUE;
     // if(n<m) System.out.println();
      for(int i=0;i<=(n-m);i++) {
    	  String c=s.substring(i,(i+m));
    	//  System.out.println(c);
    	  int h=find(c,t,m);
    	   min=Math.min(min, h);
      }
      System.out.println(min);
	}
      static int find(String s,String t,int n) {
    	  int ans=0;
    	  for(int i=0;i<n;i++) {
    		  if(s.charAt(i)!=t.charAt(i)) ans++;
    	  }
    	  return ans;
      }
    
         
  public static int gcd(int a, int b) 
    { 
        if (a == 0) 
            return b; 
          
        return gcd(b%a, a); 
    } 
   public static int lcm(int a, int b)  
  {  
     return (a*b)/gcd(a, b);  
	}

}


Measured memory_bytes: 35872
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define REP(i, n) for (int i = 1; i < (int)(n); i++)
#define Sort(a) sort(a.begin(), a.end())
typedef long long int ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vll;
template <class T> inline bool chmax(T& a,T b){if(a<b){a=b;return true;} return false;}
template <class T> inline bool chmin(T& a,T b){if(a>b){a=b;return true;} return false;}

int main(){
    long double a, b, c;
    cin >> a >> b >> c;
    long double x;
    x = pow(a*b, 0.5);
    //printf("%llf", x+a+b);
    if(a+b+2*x < c) {
        cout << "Yes" << endl;
    }
    else {
        cout << "No" << endl;
    }
    return 0;
}

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

int main(){
    string S;cin >> S;
    int count = 0;
    for (int i = 0; i < S.size()/2; i++)
    {
        if(S[i]!=S[S.size()-1-i]) count++;
    }
    cout << count << endl;
}

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

#define ll long long
#define rep(i, n) for (int i = 0; i < (int)(n); i++)

using namespace std;

int main() {
    int n, a, b;
    string s;
    cin >> n >> a >> b;
    cin >> s;

    int total = a + b;
    int count = 0;
    int foreign_count = 0;
    rep (i, n) {
        if (s[i] == 'a') {
            if (count < total) {
                cout << "Yes" << endl;
                count++;
            } else {
                cout << "No" << endl;
            }
        } else if (s[i] == 'b') {
            if (count < total && foreign_count < b) {
                cout << "Yes" << endl;
                count++;
                foreign_count++;
            } else {
                cout << "No" << endl;
            }
        } else {
            cout << "No" << endl;
        }
    }

    return 0;
}


Measured memory_bytes: 896
import java.util.Scanner;

public class Main {

	private static int N, K;
	private static int a[];

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		N = sc.nextInt();
		K = sc.nextInt();
		a = new int[N];
		for (int i = 0; i < N; i++) {
			a[i] = sc.nextInt();
		}
		int l = 0, h = 1000000000;
		while (l + 1 < h) {
			int m = (l + h) / 2;
			if (check(m))
				h = m;
			else
				l = m;
		}
		System.out.println(++l);
	}

	public static boolean check(int P) {
		int i=0,truck =0;
		while (i < N && truck < K) {
			for (int sum = 0; i < N && sum + a[i] <= P; i++) {
				sum += a[i];
			}
			truck++;
		}
		return i==N;
	}
}


Measured memory_bytes: 69748
MOD = 2019
L,R=map(int,input().split())
l = L % MOD
r = R % MOD

ans = 2019**2
if R - L >=2019:
   ans =0
elif l < r :
    for i in range(l,r+1):
        for j in range(i+1,r+1):
             ans = min(ans,i*j%MOD)
else :
    ans =0
print(ans)

Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
int main () {
	char a[10],b[10];
	cin>>a>>b; 
	strcat(a,b);
	int c=atoi(a);
	if((int)(sqrt(c))*(int)(sqrt(c))==c)
	puts("Yes");
	else puts("No");
	return 0;
}

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

typedef vector<int> veci;
typedef pair<int,int> pii;
typedef vector<pii> vecii;
typedef long long ll;
typedef pair<ll,ll> pll;
typedef vector<ll> vecl;
typedef vector<pll> vecll;
#define EPS (1e-9)
#define MOD (1e9+7)
#define fi first
#define se second
#define endl '\n'

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
#ifdef LOCAL_TEST    
    int tcs;
    cin >> tcs;
    while (tcs-->0)
#endif        
{
    int n, m;
    cin >> n >> m;

    vector<vecii> adj(n);

    int l, r, d;
    for (int i=0; i<m; ++i) {
        cin >> l >> r >> d;
        l--, r--;
        adj[l].push_back({r,d});
        adj[r].push_back({l,-d});
    }

    bool res = true;
    veci dp(n,0);
    veci vis(n,0);
    stack<int> s;

    for (int i=n-1; i>=0; --i) {
        if (!vis[i]) {
            s.push(i);

            while (!s.empty()) {
                int t = s.top();
                vis[t] = 1;
                s.pop();
                for (int k=int(adj[t].size()-1); k>=0; --k) {
                    pii u = adj[t][k];
                    if (!vis[u.fi]) {
                        dp[u.fi] = dp[t] + u.se;
                        s.push(u.fi);
                    } else {
                        if (dp[u.fi] != u.se + dp[t]) {
                            res = false;
                            while (!s.empty()) s.pop();
                            break;
                        }
                    }
                }
            }
        }
        if (!res)
            break;
    }

    cout << (res?"Yes":"No") << endl;
}}

Measured memory_bytes: 10112
#include <iostream>
#include <string>
#include <algorithm>

using namespace std;

int main() {
    int a, b;
    cin >> a >> b;
    if (abs(a - b) % 2 == 0) {
        cout << (a + b) / 2 << endl;
    } else {
        cout << "IMPOSSIBLE" << endl;
    }
    return 0;
}

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

using namespace std;
typedef long long ll;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<ll> VL;
typedef vector<VL> VVL;
typedef pair<int, int> PII;

#define FOR(i, a, n) for (ll i = (ll)a; i < (ll)n; ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(x) x.begin(), x.end()
#define IN(a, b, x) (a<=x&&x<b)
#define MP make_pair
#define PB push_back
#define MOD 1000000007
#define INF (1LL<<30)
#define LLINF (1LL<<60)
#define PI 3.14159265359
#define EPS 1e-12
//#define int ll

signed main(void)
{
	string s;
	getline(cin, s);

	REP(i, s.size()) {
		if('a' <= s[i] && s[i] <= 'z') {
			s[i] += 'A' - 'a';
		}
	}
	cout << s << endl;
	return 0;
}

Measured memory_bytes: 3132
from fractions import gcd
A,B,C,D = map(int,input().split())
def Num_div(num,div):
    return num//div
    
def NoDiv(num,div1,div2):
    return num-Num_div(num,div1)-Num_div(num,div2)+Num_div(num,div1*div2//gcd(div1,div2))
    
print(NoDiv(B,C,D)-NoDiv(A-1,C,D))

Measured memory_bytes: 5048
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <numeric>
#include <utility>
#include <sys/time.h>

using namespace std;

void solve(int n,long long t, vector<long long> T) {
    long long answer = t;
    for (int i = 0; i < n-1; i++) {
        if (t < T[i+1] - T[i]) {
            answer += t;
        } else {
            answer += T[i+1] - T[i];
        }
    }
    std::cout << answer << std::endl;
}

int main() {
    struct timeval start,end;
    long long span;
    int n;
    long long t;
    vector<long long> T;

    gettimeofday(&start,NULL);

    std::cin >> n >> t;
    for (int i = 0; i < n; i++) {
        long long tmp;
        std::cin >> tmp;
        T.push_back(tmp);
    }
    solve(n, t, T);

    gettimeofday(&end,NULL);
    span = (end.tv_sec -start.tv_sec)*1000000LL + (end.tv_usec - start.tv_usec);
    std::cerr << "--Total Time: " << span/1000 << "ms" << endl;
    return 0;
}


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

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

	lint a=0, b=1000, c=0, x, y, z;
	rep(i, N) {
		if (i == N-1) {
			b = b + a*v.at(i);
			a = 0;
		} else if (a == 0 && v.at(i+1) > v.at(i)) {
			a = b/v.at(i);
			b = b%v.at(i);
		} else if (v.at(i+1) < v.at(i)) {
			b = b + a*v.at(i);
			a = 0;
		}
	}
	std::cout << b << '\n';
}


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

using namespace std;

int main(){
    int s;
    cin>>s;
        vector<int> a(1000010);
        int tmp;
        int cnt=1;
        a[s]++;
    while(1){
        if(s%2==0){
            tmp = s/2;
            a[tmp]++;
            s/=2;
        }else{
            tmp = 3*s+1;
            a[tmp]++;
            s=3*s+1;
        }
        if(a[tmp]==2)
            break;

        cnt++;
    }
    cout<<cnt+1;
}


Measured memory_bytes: 4096
#include <iostream>
#include <unordered_map>

using namespace std;
struct _ { ios_base::Init i; _() { ios_base::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL); } } _;

int main() {

	long long n; cin >> n;
	unordered_map<long long, long long> freq;
	long long ans = 0;
	for (long long i = 1; i <= n; i++) {
		long long hi; cin >> hi;
		ans += freq[i - hi];
		freq[i + hi]++;
	}

	cout << ans;

	return 0;
}

Measured memory_bytes: 18512
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define ff first
#define ss second
#define inf 500000000
#define IOS ios_base::sync_with_stdio(0)
#define meM(y,a) memset(y,a,sizeof y)
#define sC(a) scanf("%d",&a)
#define alL(a) a.begin(),a.end()
#define prinT(a,sz)  cout<<a[0];for(int i=1;i<sz;i++)cout<<" "<<a[i];cout<<endl
#define ranD srand(chrono::steady_clock::now().time_since_epoch().count());
typedef pair<int,int>pi;
typedef pair<ll,ll>pll;
//int fx[]={0,0,1,-1};
//int fy[]={1,-1,0,0};
//int gx[]={0,0,1,1,1,-1,-1,-1};
//int gy[]={1,-1,0,1,-1,0,1,-1};
bool check(int n,int p){return (1<<p)&n;}
const int N=100010;
pi par[N];          ///first = parent ,second = distance
pi find(int x)
{
    if(par[x].ff==x)return par[x];
    int temp=par[x].ss;
    par[x]=find(par[x].ff);
    par[x].ss+=temp;
    return par[x];
}
int uni(int u,int v,int d)
{
    pi x=find(u);
    pi y=find(v);
//    cout<<x.ff<<" "<<x.ss<<"   "<<y.ff<<" "<<y.ss<<endl;
    if(x.ff!=y.ff)
    {
        par[x.ff]=y;
        par[x.ff].ss+=d-x.ss;
        return 1;
    }
    else
    {
        int dif=x.ss-y.ss;
        if(dif==d)return 1;
        else return 0;
    }
}
int main()
{
    IOS;
    int n,m;cin>>n>>m;
    for(int i=1;i<=n;i++)par[i]={i,0};
    bool ok=true;
    for(int i=0;i<m;i++)
    {
        int l,r,d;cin>>l>>r>>d;
        bool x=uni(l,r,d);
        if(x==0)ok=0;
    }
    if(ok)cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
}








Measured memory_bytes: 1152
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define llong long long
#define pb(a) push_back(a)g
#define INF 999999999
using namespace std;
typedef pair<int, int> P;
typedef pair<llong, llong> LP;
typedef pair<int, P> PP;
typedef pair<llong, LP> LPP;

struct Card{char suit,value;};

void bubble(struct Card A[], int N){
  REP(i,N){
    FORR(j,N-1,i +1){
      if(A[j].value < A[j-1].value){
        Card t = A[j]; A[j] = A[j-1]; A[j-1] = t;
      }
    }
  }
}

void selection(struct Card A[], int N){
  REP(i,N){
    int minj = i;
    FOR(j,i,N){
      if(A[j].value < A[minj].value) minj = j;
    }
    Card t = A[i]; A[i ]= A[minj]; A[minj] = t;
  }
}

void print(struct Card A[], int N){
  REP(i,N){
    if(i > 0) cout <<" ";
    cout <<A[i].suit <<A[i].value;
  }
  cout <<endl;
}

bool isStable(struct Card C1[],struct Card C2[], int N){
  REP(i,N){
    if(C1[i].suit != C2[i].suit) return false;
  }
  return true;
}

int main(){
  Card C1[100],C2[100];
  int N;
  char ch;

  cin >> N;
  REP(i,N){
    cin >>C1[i].suit >> C1[i].value;
  }

  REP(i,N)C2[i] = C1[i];

  bubble(C1,N);
  selection(C2,N);

  print(C1, N);
  cout<< "Stable" <<endl;
  print(C2,N);
  if(isStable(C1,C2,N)){
    cout <<"Stable"<<endl;
  }else{
    cout <<"Not stable"<<endl;
  }
  return 0;
}



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

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

    int ans = 0;
    for(int i = 0; i < 3; i++){
        if(s[i] == 'o') ans++;
    }

    ans = ans * 100 + 700;
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
import sys
def input(): return sys.stdin.readline().strip()
def mapint(): return map(int, input().split())
sys.setrecursionlimit(10**9)

b = input()
if b=='A':
    print('T')
elif b=='T':
    print('A')
elif b=='C':
    print('G')
else:
    print('C')

Measured memory_bytes: 61780
#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>
using namespace std;
#define N 200005
int n, k, l;
int tar[2 * N], nex[2 * N], fir[N], cnt;
int bel[N], sum[N], ans[N], stk[N], vis[N], top;
int Getbel(int x)
{
	if (!bel[x])
		return x;
	return bel[x] = Getbel(bel[x]);
}
void add(int a, int b)
{
	++cnt;
	tar[cnt] = b;
	nex[cnt] = fir[a];
	fir[a] = cnt;
}
void dfs(int r)
{
	vis[r] = 1;
	stk[++top] = r;
	for (int i = fir[r]; i; i = nex[i])
	{
		int v = tar[i];
		if (!vis[v])
			dfs(v);
	}
}
int main()
{
	scanf("%d%d%d", &n, &k, &l);
	for (int i = 1; i <= k; i++)
	{
		int a, b;
		scanf("%d%d", &a, &b);
		a = Getbel(a), b = Getbel(b);
		if (a != b)
			bel[a] = b;
	}
	for (int i = 1; i <= l; i++)
	{
		int a, b;
		scanf("%d%d", &a, &b);
		add(a, b), add(b, a);
	}
	for (int i = 1; i <= n; i++)
	{
		if (!vis[i])
		{
			dfs(i);
			for (int j = 1; j <= top; j++)
				sum[Getbel(stk[j])]++;
			for (int j = 1; j <= top; j++)
				ans[stk[j]] = sum[Getbel(stk[j])];
			for (int j = 1; j <= top; j++)
				sum[Getbel(stk[j])]--;
			top = 0;
		}
	}
	for (int i = 1; i <= n; i++)
		printf("%d%c", ans[i], i == n ? 10 : 32);
}


Measured memory_bytes: 7296
from __future__ import division, print_function
# import threading
# threading.stack_size(2**27)
# import sys
# sys.setrecursionlimit(10**7)
# sys.stdin = open('inpy.txt', 'r')
# sys.stdout = open('outpy.txt', 'w')
from sys import stdin, stdout
import bisect            #c++ upperbound
import math
import heapq
i_m=9223372036854775807
def inin():
    return int(input())
def stin():
    return input()
def spin():
    return map(int,stin().split())
def lin():                           #takes array as input
    return list(map(int,stin().split()))
def matrix(n):
    #matrix input
    return [list(map(int,input().split()))for i in range(n)]

################################################
def string2intlist(s):
    return list(map(int, s))

def calculate_sum(a, N): #sum of a to N
    # Number of multiples 
    m = N / a 
    # sum of first m natural numbers 
    sum = m * (m + 1) / 2
    # sum of multiples 
    ans = a * sum
    return ans
def series(N):
    return (N*(N+1))//2

def count2Dmatrix(i,list):
    return sum(c.count(i) for c in list)

def modinv(n,p):
    return pow(n,p-2,p)

def GCD(x, y): 
    x=abs(x)
    y=abs(y)
    if(min(x,y)==0):
        return max(x,y)
    while(y): 
        x, y = y, x % y 
    return x
def LCM (x, y):
    return (x * y) // GCD(x, y)
    
def Divisors(n) : 
    l = []  
    for i in range(1, int(math.sqrt(n) + 1)) :
        if (n % i == 0) : 
            if (n // i == i) : 
                l.append(i) 
            else : 
                l.append(i)
                l.append(n//i)
    return l
def isprime(n):
    for i in range(2, int(math.sqrt(n))+1):
        if n%i==0:
            return False
    return True
prime=[]
def SieveOfEratosthenes(n): 
    global prime
    prime = [True for i in range(n+1)] 
    p = 2
    while (p * p <= n): 
        if (prime[p] == True): 
            for i in range(p * p, n+1, p): 
                prime[i] = False
        p += 1
    f=[]
    for p in range(2, n): 
        if prime[p]: 
            f.append(p)
    return f
q=[]       
def dfs(n,d,v,c):
    global q
    v[n]=1
    x=d[n]
    q.append(n)
    j=c
    for i in x:
        if i not in v:
            f=dfs(i,d,v,c+1)
            j=max(j,f)
            # print(f)
    return j
# d = {}
 
"""*******************************************************"""
d, t, s = spin()
if s*t>=d:
    print("Yes")
else:
    print("No")

Measured memory_bytes: 63432
#include <bits/stdc++.h>
using namespace std;
int main()
{
	int a;
	cin>>a;
	if(a==111)
	cout<<"999";
	else if(a==119)
	cout<<"991";
	else if(a==199)
	cout<<"911";
	else if(a==911)
	cout<<"199";
	else if(a==991)
	cout<<"119";
	else if(a==999)
	cout<<"111";
	else if(a==191)
	cout<<"919";
	else
	cout<<"191";
	return 0;
 } 

Measured memory_bytes: 256
#include <algorithm>
#include <functional>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <string>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <vector>
#include <list>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <bitset>
#include <climits>

#define all(c) (c).begin(), (c).end()
#define rep(i,n) for(int i=0;i<(n);i++)
#define pb(e) push_back(e)
#define mp(a, b) make_pair(a, b)
#define fr first
#define sc second

const int INF=100000000;
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
using namespace std;
typedef pair<int ,int > P;
typedef long long ll;


bool ok(int p,int q,int m,int n) {
    int t1=m*m+n*n;
    if(t1<=0) return false;
    int t2=m*p+n*q;
    int t3=m*q-n*p;
    return (t2%t1==0)&&(t3%t1==0);
}
void solve() {
    int cnt=0;
    int p,q;
    cin>>p>>q;
    int t=p*p+q*q;
    rep(m,sqrt(t)+1) rep(n,sqrt(t)+1) {
        if(ok(p,q,m,n)) {
            // cout<<m<<","<<n<<endl;
            cnt++;
        }
    }
    // cout<<cnt<<endl;
    if(cnt*2<=8) cout<<"P"<<endl;
    else cout<<"C"<<endl;
}

int main() {
    int q;
    cin>>q;
    while(q-->0) {
        solve();
    }
    return 0;
}

Measured memory_bytes: 1152
A,B,K = map(int,input().split())
ans_list = []
for _ in range(1,101):
    if A % _ == 0 and B % _ == 0:
        ans_list.append(_)
#print(ans_list)
#print(len(ans_list)-K)
print(ans_list[len(ans_list)-K])


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

long int inf=100000*100000+100;
int main()
{
    int v,e,r;
    int s[500000];
    int t[500000];
    int d[500000];
    long int dis[100000];
    cin>>v>>e>>r;
    for(int i=0;i<e;i++)
    {
        cin>>s[i]>>t[i]>>d[i];
    }
    
    for(int i=0;i<v;i++)
    {
        dis[i]=inf;
    }
    dis[r]=0;
    
    while(true)
    {
        int end=1;
        for(int j=0;j<e;j++)
        {
            if(dis[t[j]]>dis[s[j]]+d[j])
            {
                dis[t[j]]=dis[s[j]]+d[j];
                end=0;
            }
        }
        
        if(end==1)
            break;
    }
    
    for(int i=0;i<v;i++)
    {
        if(dis[i]==inf)
            cout<<"INF"<<endl;
        else
            cout<<dis[i]<<endl;
    }
}

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

int main()
{
  typedef long long ll;
  ll H;
  cin >> H;
  H >>= 1;
  ll cnt = 1;
  ll _add = 1;
  while (0 < H)
  {
    H >>= 1;
    _add <<= 1;
    cnt += _add;
  }
  cout << cnt;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#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()
{
    int n;
    cin >> n;
    int ans;
    ans = pow(n, 3);
    cout << ans << endl; 
    return 0;
}

Measured memory_bytes: 3972