akhauriyash/Code-Regression huggingface dataset:
#include "bits/stdc++.h"
using namespace std;

int h,w,cnt;
char c;
vector<int> ans;
int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);

	cin>>h>>w; 
	char bombs[h][w];
	for(int i=0;i<h;i++){
		for(int j=0;j<w;j++){
			cin>>c;
			if(c=='#'){
				bombs[i][j]='#';
			}
			else
				bombs[i][j]='.';
		}
	}
	for(int i=0;i<h;i++){
		for(int j=0;j<w;j++){
			cnt=0;
			if(bombs[i][j]=='.'){
				if(bombs[i+1][j]=='#' && i+1>=0 && i+1<h && j>=0 && j<w ){
					
					cnt++;
				}
				if(bombs[i-1][j]=='#' && i-1>=0 && i-1<h && j>=0 && j<w){
					cnt++;
				}
				if(bombs[i][j+1]=='#' && i>=0 && i<h && j+1>=0 && j+1<w){
					
					cnt++;
				}
				if(bombs[i][j-1]=='#' && i>=0 && i<h && j-1>=0 && j-1<w){
					
					cnt++;
				}
				if(bombs[i-1][j-1]=='#' && i-1>=0 && i-1<h && j-1>=0 && j-1<w){
					cnt++;
				}
				if(bombs[i-1][j+1]=='#' && i-1>=0 && i-1<h && j+1>=0 && j+1<w){
					cnt++;
				}
				if(bombs[i+1][j-1]=='#' && i+1>=0 && i+1<h && j-1>=0 && j-1<w){
					cnt++;
				}
				if(bombs[i+1][j+1]=='#' && i+1>=0 && i+1<h && j+1>=0 && j+1<w){
					cnt++;
				}
			}
			else if(bombs[i][j]=='#')
				cnt=-1;
			ans.push_back(cnt);
		}
	}
	int sum=0;
	for(int i=0;i<h;i++){
		for(int j=0;j<w;j++){
			if(ans[sum]==-1){
				cout<<'#';
			}
			else{
				cout<<ans[sum];
			}
			sum++;
		}
		cout<<endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include<map>
#include<cmath>
#include<stack>
#include<queue>
#include<cstdio>
#include<vector>
#include<cstring>
#include<iostream>
#include<algorithm>
using namespace std;
typedef long long ll;
template<class Read>void in(Read &x){
    x=0;
    int f=0;
    char ch=getchar();
    while(ch<'0'||ch>'9'){
        f|=(ch=='-');
        ch=getchar();
    }
    while(ch>='0'&&ch<='9'){
        x=(x<<1)+(x<<3)+(ch^48);
        ch=getchar();
    }
    x=f?-x:x;
    return;
}
const int M=1e9+7;
int n,m;
ll ans=1,f[1000005]={1},g[1000005]={1};
ll ksm(ll x,ll y){
    ll s=1;
    while(y){
        if(y&1)s=(s*x)%M;
        x=(x*x)%M;
        y>>=1;
    }
    return s;
}
ll work(int x,int y){
    return f[x]%M*g[y]%M*g[x-y]%M;
}
int main(){
	in(n);in(m);
    for(int i=1;i<=n;i++){
        f[i]=f[i-1]*i%M;
        g[i]=ksm(f[i],M-2);
    }
    int k=min(n-1,m);
    for(int i=1;i<=k;i++){
        ll x=work(n,i);
        ll y=work(n-1,i);
        ans=(ans+x*y%M)%M;
    }
    cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 3328
#include <cstdio>
#include <algorithm>
#include <vector>
#include <string>
#include <iostream>
#include <climits>
#include <cmath>
#include <functional>
#include <map>
#include <queue>
#include <set>

#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define INF 999999999
#define size_t long long
#define ll long long
#define REP(i,a) for(int i=0;i<(a);i++)
#define REPR(i,a) for(int i=(int)(a)-1;i>=0;i--)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define FORR(i,a,b) for(int i=(int)(b)-1;i>=a;i--)
#define ALL(a) a.begin(), a.end()
using namespace std;
// using ll = long long;
// using vi = vector<int>;
// using vvi = vector<vi>;
// using vl = vector<long long>;
// using vvl = vector<vl>;
// using vs = vector<string>;
int si() { int x; scanf("%d", &x); return x; }
long long sl() { long long x; scanf("%lld", &x); return x; }
string ss() { string x; cin >> x; return x; }
void pi(int x) { printf("%d ", x); }
void pl(long long x) { printf("%lld ", x); }
void pd(double x) { printf("%.15f ", x); }
void ps(const string &s) { printf("%s ", s.c_str()); }
void br() { putchar('\n'); }

const int MOD = 1e9 + 7;

struct mint {
    int n;
    mint(int n_ = 0) : n(n_) {}
};

mint operator+(mint a, mint b) { a.n += b.n; if (a.n >= MOD) a.n -= MOD; return a; }
mint operator-(mint a, mint b) { a.n -= b.n; if (a.n < 0) a.n += MOD; return a; }
mint operator*(mint a, mint b) { return (long long)a.n * b.n % MOD; }
mint &operator+=(mint &a, mint b) { return a = a + b; }
mint &operator-=(mint &a, mint b) { return a = a - b; }
mint &operator*=(mint &a, mint b) { return a = a * b; }

int main () {
  string S;
  int num_odd0=0,num_odd1=0,num_even0=0,num_even1=0,result;
  cin >> S;
  for (size_t i = 0; i < S.length(); i++) {
    if(i%2) {
      if(S[i] == '0') num_odd0++;
      else num_odd1++;
    } else {
      if(S[i]=='0') num_even0++;
      else num_even1++;
    }
    if(num_odd0+num_even1 < num_odd1+num_even0) result = num_odd0+num_even1;
    else result = num_odd1+num_even0;
  }
  pi(result); br();
}


Measured memory_bytes: 512
#define ll     long long int
#define db     double
#define   pb      push_back
#include<bits/stdc++.h>
using namespace std ;
int main()
{
      //ll q;cin>>q;while(q--)
      ll s,w,k;
      cin>>s>>w;
      if(w>=s)
        cout<<"unsafe"<<endl;
      else cout<<"safe"<<endl;





}



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

int main()
{
    string S;
    cin >> S;
    if (S == "ABC")
    {
        cout << "ARC" << endl;
    }
    else
    {
        cout << "ABC" << endl;
    }
}


Measured memory_bytes: 3592
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define per(i,n) for (int i = (n)-1; i >=0; --i)
using namespace std;
using ll = long long;
using vi = vector<int>;
using vv = vector<vi>;

int main(){
    ll n,c,k;cin>>n>>c>>k;
    vector<ll> t(n);
    rep(i,n)cin>>t[i];
    
    sort(t.begin(), t.end());
    
    queue<ll> q;
    rep(i,n)q.push(t[i]);
    int ans = 0;
    while(q.size()){
        ll dep = q.front() + k;
        ans++;
        ll count = 0;
        while(q.size() && count<c && q.front()<=dep ){
            q.pop();
            count++;
        }
    }
    
    cout << ans << endl;
    
    return 0;
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> lpair;
const ll MOD = 1e9 + 7;
const ll INF = 1e18;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
#define rREP(i,m,n) for(ll i = (m); i >= (n); i--)
#define print(x) cout << (x) << endl;
#define printa(x,n) for(ll i = 0; i < n; i++){ cout << (x[i]) << " ";} cout<<endl;
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    string a,b,c;
    cin >> a >> b >> c;
    cout << a[0] << b[0] << c[0]  << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <fstream>
#include <string> 
#include <cmath>  
#include <cstdlib>
#include <ctime>
#include <vector>
#include <algorithm>
#include <numeric>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <deque>
#include <functional>

using namespace std;
using ll = long long;
using ull = unsigned long long;

#define FOR(i, m, n) for(int i = int(m);i < int(n);i++)
#define REFOR(i, m, n) for(int i = int(n - 1);i >= int(m);i--)
#define REP(i,n) for(int i = 0; i < int(n); i++)
#define REREP(i,n) for(int i = int(n - 1); i >= 0; i--)
#define VI vector<int>
#define VVI vector<vector<int>>
#define VVVI vector<vector<vector<int>>>
#define VL vector<ll>
#define VVL vector<vector<ll>>
#define VB vector<bool>
#define VVB vector<vector<bool>>
#define PAIR pair<int,int>
#define MP make_pair
#define VP vector<pair<int,int>>
#define VS vector<string>
#define MAP map<int,int>
#define QUE queue<int>
#define DEQ deque<int>
#define PQUE priority_queue<int> //5,5,4,3,3,2,...
#define REPQUE priority_queue<int, vector<int>, greater<int>> //1,1,2,3,4,4,5,...
#define SUM(obj) accumulate((obj).begin(), (obj).end(), 0)
#define SORT(obj) sort((obj).begin(), (obj).end()) // 1,2,3,4,5...
#define RESORT(obj) sort((obj).begin(), (obj).end(), greater<int>()) // 5,4,3,2,1...
#define UB(obj,n) upper_bound((obj).begin(), (obj).end(), n) //itr > n
#define LB(obj,n) lower_bound((obj).begin(), (obj).end(), n) //itr>= n

const ll MOD = (ll)1e9 + 7;
const ll INF = (ll)1e17;

void ANS(bool flag){
	cout << ((flag) ? "YES" : "NO") << endl;
}

void Ans(bool flag) {
	cout << ((flag) ? "Yes" : "No") << endl;
}

void ans(bool flag) {
	cout << ((flag) ? "yes" : "no") << endl;
}

int main() {
	int N;
	cin >> N;
	bool flag = false;
	REP(i,N){
		char S;
		cin >> S;
		if (S == 'Y') flag = true;
	}
	cout << ((flag) ? "Four" : "Three") << endl;
	

	return 0;
}


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

using namespace std;

long findOptimalKnapsack(int N, long W, vector<int> &w, vector<int> &v, vector< vector<long> > &Knapsack)
{
	if(N < 1 || W < 1)
		return 0;
	if(Knapsack[N-1][W-1] != -1)
		return Knapsack[N-1][W-1];
	if(w[N-1] > W)
		return findOptimalKnapsack(N-1, W, w,v,Knapsack);
	int a =
	Knapsack[N-1][W-1] = max(v[N-1] + findOptimalKnapsack(N-1, W-w[N-1], w,v,Knapsack), findOptimalKnapsack(N-1,W,w,v,Knapsack));
	return Knapsack[N-1][W-1];
}

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

	int N,i;
	long W;
	cin>>N>>W;
	vector<int> w(N), v(N);
	for(i=0;i<N;i++)
		cin>>w[i]>>v[i];
	vector< vector<long> > Knapsack( N, vector<long>(W, -1));
	cout<<findOptimalKnapsack(N,W,w,v,Knapsack)<<endl;;
	return 0;
}


Measured memory_bytes: 79488
#include <bits/stdc++.h>
using namespace std;
int main(){
	int n;cin>>n;
	vector<pair<int,int>> mv;
for(int i=0;i<n;i++){
	int t;cin>>t;
	mv.push_back({t,i});
}
sort(mv.begin(),mv.end(),less<pair<int,int>>());
for(auto it:mv){
	cout<<it.second+1<<" ";
}
cout<<endl;
	return 0;
}

Measured memory_bytes: 1780
#include "bits/stdc++.h"
using namespace std;
#define F first
#define S second
#define show(x) cout<<#x<<" "<<x<<" ";
#define f(i,j,k) for(int i = j;i<=k;i++)
#define fr(i,j,k) for(int i = j;i>=k;i--)
#define ll long long
#define all(A)  A.begin(),A.end()  
#define FIO ios_base::sync_with_stdio(false);cin.tie(NULL);  
const int MSIZE = 1e2+5;
const int MOD = 1e9+7;


int arr[MSIZE];
ll dp[MSIZE][100005];

int main(){

    FIO
    int n, k ; cin>>n>>k;
    f(i,1,n)    cin>>arr[i];

    memset(dp,0,sizeof(dp));
    f(i,0,n)    dp[i][0] = 1;

    f(i,1,n)
        f(j,1,k) {
            dp[i][j] = (dp[i][j-1] + dp[i-1][j])%MOD;
            dp[i][j] = dp[i][j] - (j>arr[i]?dp[i-1][j-arr[i]-1]:0) + MOD;
            dp[i][j]%=MOD;
        }  
    
    cout<<dp[n][k]<<endl;
    return 0;

}
    


Measured memory_bytes: 82304
#include <stdio.h>

int main(void) {
	int H,W,a,b;
	while(1){
		scanf("%d %d",&H,&W);
		b=0;
		if(H==0&&W==0){
			break;
		}
		while(1){
			a=0;
			while(1){
				printf("#");
				a++;
				if(a==W){
					break;
				}
				printf(".");
				a++;
				if(a==W){
					break;
				}
			}	
			b++;
			printf("\n");
			if(b==H){
				break;
			}
			a=0;
			while(1){
				printf(".");
				a++;
				if(a==W){
					break;
				}
				printf("#");
				a++;
				if(a==W){
					break;
				}
			}	
			b++;
			printf("\n");
			if(b==H){
				break;
			}
		}
		printf("\n");
	}
	return 0;
}

Measured memory_bytes: 572
s=input()
l=len(s)
mod=10**9+7
dp=[[0 for j in range(13)] for i in range(l+1)]
dp[0][0]=1
for i in range(1,l+1):
  if s[i-1]=='?':
    for j in range(10):
      for k in range(13):
        dp[i][(k*10+j)%13]+=dp[i-1][k]%mod
  else:
    for k in range(13):
      dp[i][(k*10+int(s[i-1]))%13]+=dp[i-1][k]%mod
print(dp[-1][5]%mod)

Measured memory_bytes: 66012
import java.util.*;
import java.util.function.*;
import java.math.*;
public class Main {
    public static void main(String[] args){
		Scanner s = new Scanner(System.in);
		int A = Integer.valueOf(s.next());
		int B = Integer.valueOf(s.next());
		int C = Integer.valueOf(s.next());
		int K = Integer.valueOf(s.next());

		while(K > 0) {
			if(B <= A) {
				B *= 2;
			}else if(C <= B) {
				C *= 2;
			}
			
			if(B > A && C > B) {
				System.out.println("Yes");
				return;
				
			}
			K--;
		}
		System.out.println("No");
	}
}

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

using namespace std;


//repetition
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define euc_dis(x, y) sqrt(x*x + y*y)

#define pb push_back
#define mp make_pair
#define INF 999999999
#define MOD 1000000007
#define sp ' '


//typedef
typedef long long ll;
typedef pair<int, int> pint;
typedef pair<long, long> pll;
typedef map<int, int> mint;
typedef set<int> sint;
typedef vector<int> vint;
typedef vector<char> vchr;
typedef vector<long long> vll;
typedef vector<string> vstr;


ll mod(ll a, ll b){return (a%b+b)%b;}
ll gcd(ll a, ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b){return a*b/gcd(a,b);}
void Yes(){cout << "Yes" << endl;}
void No(){cout << "No" << endl;}
void Judge(bool b){b?Yes():No();}
void YES(){cout << "YES" << endl;}
void NO(){cout << "NO" << endl;}
void JUDGE(bool b){b?YES():NO();}
ll powMod(ll a, ll b, ll c){ll ans=1; rep(i, b){ans=ans*a%c;} return ans;}
double distance(ll x1, ll y1, ll x2, ll y2){return sqrt((x1-x2)*(x1-x2) + (y1-y2)*(y1-y2));}

template<typename T>
void ppp(T n){cout << n << endl;}
template<typename T>
void dpp(T n){cerr << n << endl;}
template<typename T>
void vpp(T a){rep(i,a.size()){cout << a[i] << endl;}}
template<typename T>
void vdp(T a){rep(i,a.size()){cerr << a[i] << endl;}}

const int dx[4]={1,0,-1,0};
const int dy[4]={0,1,0,-1};
const int ddx[8] = {1,0,-1,0,1,-1,-1,1};
const int ddy[8] = {0,1,0,-1,1,1,-1,-1};




template < typename T > std::string to_string( const T& n )
{
    std::ostringstream stm ;
    stm << n ;
    return stm.str() ;
}


vector<string> split(const string &str, char sep)
{
    vector<string> v;
    stringstream ss(str);
    string buffer;
    while( getline(ss, buffer, sep) ) {
        v.pb(buffer);
    }
    return v;
}




int main(){

    cin.tie(0);
    ios::sync_with_stdio(false);

    ll x, y;
    cin >> x >> y;

    ll cnt = abs(abs(x) - abs(y));
    if(x*y >= 0){
        if(x > y){
            cnt += 2;
        }
    }

    else{
        cnt++;
    }

    if(x == 0 and y >= 0)
        cnt = y;
    else if(x == 0 and y < 0){
        cnt = abs(y) + 1;
    }
    else if(x >= 0 and y == 0){
        cnt = x + 1;
    }
    else if(x < 0 and y == 0){
        cnt = abs(x);
    }




    ppp(cnt);


    return 0;
}


Measured memory_bytes: 256
// include
// ------------------------------------------------
#include <bits/stdc++.h>
#include <vector>
#include <algorithm>
#include <math.h>

using namespace std;

// func
// ------------------------------------------------
int CalcSumOfDigit(int n);      // 各桁の和を計算する。
string upper(string str);       // 英字を大文字に変換する。
string lower(string str);       // 英字を小文字に変換する。

// define
// ------------------------------------------------
#define all(a)        (a).begin(),(a).end()
#define rall(a)       (a).rbegin(),(a).rend()
#define sz(a)         int((a).size())
#define rep(i,n)      for(int(i)=0;(i)<(n);(i)++)
#define repe(i,n)     for(int(i)=0;(i)<=(n);(i)++)
#define vsort(v)      sort((v).begin(),(v).end())
#define rvsort(v)     sort(rall((v)))
#define vi            vector<int>
#define GCD(a,b)      __gcd((a),(b))
#define LCM(a,b)      (a)/GCD((a),(b))*(b)
#define kiriage(a,b)  ((a)+(b)-1)/(b)

const int INF = 1e9;

// code
// ------------------------------------------------
int main() {

  int a,b,k;
  cin >> a >> b >> k;

  for(int i = a; i <= b;i++)
  {
    if(i < a + k || b - k < i)
    {
      if(i != a)
        cout << " ";

      cout << i ;
    }
  }

  cout << endl;

  return 0;
}
// funcの実体
// ------------------------------------------------
int CalcSumOfDigit(int n)
{
  int s = 0;
  while(n)
  {
    s += n % 10;
    n = n / 10;
  }
  return s;
}

string upper(string str)
{
  for(auto itr = str.begin();itr != str.end() ; itr++)
  {
    if(97 <= *itr && *itr <= 122)
    {
      *itr = *itr - 32;
    }
  }
  return str;
}

string lower(string str)
{
  for(auto itr = str.begin();itr != str.end() ; itr++)
  {
    if(65 <= *itr && *itr <= 90)
    {
      *itr = *itr + 32;
    }
  }
  return str;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
int main() {
     int A, B, K;
     scanf("%d %d", &A, &B);
     if (A>B) {
        K=A;
        while (K--) {
        if ((A-K)==(K-B) || K==0) {
            break;
        }
     }
     }
     else {
        K=B;
        while (K--) {
            if ((B-K)==(K-A) || K==0) {
                break;
            }
        }
     }
     if (K!=0) {
        printf("%d\n", K);
     }
     else {
        printf("IMPOSSIBLE");
     }
    return 0;
}


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

int main(){
  int N,p;
  string s;
  scanf("%d",&N);
  vector<tuple<string,int,int>>T(N);
  for(int i =0;i < N; i++){
    cin >> s >> p;
    p *= -1;
    T[i] = make_tuple(s,p,i+1);
  }
  
  sort(T.begin(), T.end());
  
  for(int i = 0; i < N; i++){
    cout <<get<2>(T[i]) << endl;
  }
}

Measured memory_bytes: 3688
#include<iostream>
int main()
{
    using namespace std;
    int a,b,c;
    cin >> a>>b;
    c=a*b;
  //  cout << "Come up and C++ me some time.";
   // cout << endl;
   // cout << "You won't regret it!" << endl;
  //  cout << c<<endl;
    if(c%2==0) cout <<"Even";
    else cout <<"Odd";
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<math.h>
#include<string>
#include<map>
#include<vector>
#include<map>
#include<unordered_map>
#include<set>
#include<unordered_set>
#include<bitset>
#include<stack>
#include<algorithm>
#include<climits>
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL);
#define ll long long int
#define vii vector<ll>
#define mii map<ll, ll>
#define debug(x) cerr << #x << " is " << x << "\n";
#define debug1(x, y) cerr << #x << " is " << x << "\n" << #y << " is " << y << "\n";
#define w(x) ll x; cin >> x; while(x--)
#define endl "\n"
#define f first 
#define s second 
#define fo(n) for(ll i = 0LL; i < n; ++i) 
#define setbits(n) __builtin_popcount(n)
#define all(x) x.begin(), x.end()
#define sortAll(x) sort(x.begin(), x.end())
#define pb push_back
#define mk make_pair
#define PERMUTE next_permutation
#define RESET(a, b) memset(a, b, sizeof(a))
#define MOD 1000000007
using namespace std;
 
int main(){
    fast
    ll n;
    cin >> n;
    vector<vector<ll>> a(n, vector<ll>(3, 0)), dp(n, vector<ll>(3, 0));
    fo(n) cin >> a[i][0] >> a[i][1] >> a[i][2];
    dp[0][0] = a[0][0];
    dp[0][1] = a[0][1];
    dp[0][2] = a[0][2];
    for(int i = 1; i < n; ++i) {
        dp[i][0] = a[i][0] + max(dp[i - 1][1], dp[i - 1][2]);
        dp[i][1] = a[i][1] + max(dp[i - 1][0], dp[i - 1][2]);
        dp[i][2] = a[i][2] + max(dp[i - 1][1], dp[i - 1][0]);
    }
    cout << max(dp[n - 1][0], max(dp[n - 1][1], dp[n - 1][2])) << endl;
    return 0;
}

Measured memory_bytes: 14256
#include <iostream>
#include <string>
using namespace std;
int main()
{
	string x;
	char z[27];
	z[26]=0;
	int h[26],v=1,ab=0;
	for (int i=0;i<26;i++) z[i]=char('z'-i);
	for (int i=0;i<26;i++) h[i]=1;
	cin>>x;
	for (int u=0;u<26;u++) if (z[u]==x[u]) ab++;
	if (ab==26)
	{
		cout<<-1<<endl;
		system ("pause");
		return 0;
	}
	else
	{
		if (x.size()==26)
		{
			for (int i=24;i>=0;i--)
			{
				x[i]++;
			    for (x[i];x[i]<='z';x[i]++)
				{
					int ac=1;
				    for (int j=0;j<i;j++)
				    {
					    if (x[j]==x[i]) ac--;
				    }
				    if (ac==1)
				    {
					    for (int k=0;k<i;k++) cout<<x[k];
					    cout<<char(x[i])<<endl;
					    system ("pause");
					    return 0;
				    }
			    }
			}
		}
		else
		{
			for (char j='a';j<='z';j++)
			{
			    for (int i=0;i<x.size();i++)
			    {
			    	if (x[i]==j) h[int(j-'a')]--;
				}
		    }
		    for (int i=0;i<26;i++)
		    {
		    	if (h[i]!=0)
		    	{
		    		cout<<x<<char('a'+i)<<endl;
		    		system ("pause");
		    		return 0;
				}
			}
		}
	}
	system ("pause");
	return 0;
}

Measured memory_bytes: 504
#include<bits/stdc++.h>
using namespace std;
#define pii pair<int,int>
#define sfi(a) scanf("%d",&a)
#define m_p make_pair
#define inf 1e9
#define ff first
#define ss second
#define pi(x) pair<x,x>
#define mem(x) memset(x,-1,sizeof(x))
#define TEST_CASE(t) for(int z=1 ; z<=t ; z++)
#define read freopen("input.txt","r",stdin)
#define write freopen("output.txt","w",stdout)
#define FAST  ios_base::sync_with_stdio(0);cout.tie(0)

typedef long long int ll;
typedef unsigned long long int ull;
typedef long double ld;
const int maxn = 100010;
const ll M = 1e9+7;


int main()
{
    double l;
    cin >> l;
    double a = l/3.0;
    double ans = a*a*a;
    printf("%0.6f\n",ans);
    return 0;
}




Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
using namespace std;
typedef long long  ll;
#define rep(i,s,n)for(ll i=s;i<n;i++)
#define repe(i,s,n)for(ll i=s;i<=n;i++)
static const ll LL_MAX = (ll)1 << 55;

int main()
{
	ll n, a, b;
	scanf("%lld%lld%lld", &n, &a, &b);

	ll ans = 0;
	ll x[100001] = {};
	repe(i, 1, n) {
		cin >> x[i];
		if (i >= 2) ans += min((x[i] - x[i - 1])*a, b);
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
#define INFTY 200000000000
long long dp[310][310];
vector<long long> a(310);
int b;
const double PI=3.1415926535897932;
int main(){
    double r;
    cin >> r;
    printf("%.10lf",2*r*PI);
    return 0;
}

Measured memory_bytes: 3760
#include<algorithm>
#include<iostream>
#include<cstring>
#include<cstdio>
#include<cmath>
#define LL long long
#define INF 200000000
#define M 400020
using namespace std;
int read(){
	int nm=0,fh=1;char cw=getchar();
	for(;!isdigit(cw);cw=getchar()) if(cw=='-') fh=-fh;
	for(;isdigit(cw);cw=getchar()) nm=nm*10+(cw-'0');
	return nm*fh;
}
LL ans;
int n,m,fs[M],to[M],nt[M],D[M][2],F[M],G[M],sum[M],tmp,u,v;
void link(int x,int y){nt[tmp]=fs[x],fs[x]=tmp,to[tmp++]=y;}
char ch[M];
void DFS1(int x,int last){
	sum[x]=(ch[x]=='1'),F[x]=INF*(sum[x]^1);
	for(int i=fs[x];i!=-1;i=nt[i]){
		if(to[i]==last) continue;
		DFS1(to[i],x),sum[x]+=sum[to[i]];
		int maxn=D[to[i]][0]+1;
		if(maxn>=D[x][0]) D[x][1]=D[x][0],D[x][0]=maxn;
		else D[x][1]=max(D[x][1],maxn);
		if(sum[to[i]]) F[x]=min(F[x],maxn);
	}
}
void DFS2(int x,int last){
	if(last){
		G[x]=G[last]+1;
		if(D[last][0]==D[x][0]+1) G[x]=max(G[x],D[last][1]+1);
		else G[x]=max(G[x],D[last][0]+1);
		if(sum[x]!=sum[1]) F[x]=min(F[x],G[x]);
	}
	for(int i=fs[x];i!=-1;i=nt[i]) if(to[i]!=last) DFS2(to[i],x);
	if(G[x]>=D[x][0]) D[x][1]=D[x][0],D[x][0]=G[x];
	else D[x][1]=max(D[x][1],G[x]);
	ans+=max(0,min(D[x][0],D[x][1]+2)-F[x]);
}
int main(){
	n=read(),memset(fs,-1,sizeof(fs));
	for(int i=1;i<n;i++) u=read(),v=read(),link(u,v),link(v,u);
	scanf("%s",ch+1),DFS1(1,0),DFS2(1,0),printf("%lld\n",ans+(sum[1]>0));
	return 0;
}

Measured memory_bytes: 19328
n = int(input())
a = [int(input()) for i in range(n)]
now = a[0]
c = 1

if now == 2:
    print(1)
    exit()

for i in range(n):
    now = a[now-1]
    c += 1
    if now == 2:
        print(c)
        exit()
print(-1)


Measured memory_bytes: 7084
#include <iostream>
#include <algorithm>
#include <vector>
#include <numeric>
#include <functional>

using namespace std;

int main()
{
	int N;

	cin >> N;

	vector<long long> a(3 * N);
	for(int i = 0 ; i < 3 * N ; ++i)
		cin >> a[i];

	vector<long long> af(3 * N, -((long long)1) << 60);
	vector<long long> ab(3 * N, ((long long)1) << 60);

	long long ca;
	vector<long long> ha(N);
	for(int i = 0 ; i < N ; ++i)
		ha[i] = a[i];
	ca = accumulate(ha.begin(), ha.end(), (long long)0);
	make_heap(ha.begin(), ha.end(), greater<long long>());

	for(int i = N ; i < 3 * N ; ++i) {
		af[i] = ca;
		if(ha.front() < a[i]) {
			pop_heap(ha.begin(), ha.end(), greater<long long>());
			ca = ca - ha.back() + a[i];
			ha.back() = a[i];
			push_heap(ha.begin(), ha.end(), greater<long long>());
		}
	}

	for(int i = 0 ; i < N ; ++i)
		ha[i] = a[3*N-i-1];
	ca = accumulate(ha.begin(), ha.end(), (long long)0);
	make_heap(ha.begin(), ha.end());

	for(int i = N ; i < 3 * N ; ++i) {
		ab[3*N-i] = ca;
		if(ha.front() > a[3*N-i-1]) {
			pop_heap(ha.begin(), ha.end());
			ca = ca - ha.back() + a[3*N-i-1];
			ha.back() = a[3*N-i-1];
			push_heap(ha.begin(), ha.end());
		}
	}

	long long result = -(((long long)1) << 60);
	for(int i = 0 ; i < 3 * N ; ++i) {
		cerr << i << ": " << af[i] << " - " << ab[i] << " = " << (af[i] - ab[i]) << endl;
		result = max(result, af[i] - ab[i]);
	}

	cout << result << endl;
}


Measured memory_bytes: 10112
s1=input()
s2=input()
s3=input()
s_list=[s1, s2, s3]
next_item=0
while(1):
    if len(s_list[0])==0 and next_item==0:
        print("A")
        break
    elif len(s_list[1])==0 and next_item==1:
        print("B")
        break
    elif len(s_list[2])==0 and next_item==2:
        print("C")
        break
    temp=s_list[next_item][0]
    s_list[next_item]=s_list[next_item][1:]
    if(temp=='a'):
        next_item=0
    elif(temp=='b'):
        next_item=1
    else:
        next_item=2


Measured memory_bytes: 3064
n, k = map(int, input().split())
P = list(map(int,input().split()))
check = [0]*1001
tmp_p = []
for p in P:
    if check[p]!=0:
        tmp_p.append(check[p])
    else:
        tmp = ((1+p)*p/2)/p #期待値の計算
        tmp_p.append(tmp)
ans = sum(tmp_p[0:k])
tmp_ans = ans
for i in range(n-k):
    tmp_ans += (tmp_p[k+i]-tmp_p[i])
    ans = max(ans, tmp_ans)
print(ans)


Measured memory_bytes: 25060
#include <bits/stdc++.h>
#define ll long long int
#define yorn(f) cout<<((f)?"Yes":"No")<<endl;
#define YORN(f) cout<<((f)?"YES":"NO")<<endl;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define println(x) cout << x << endl;
using namespace std;
int main()
{
    int a, b;
    cin >> a >> b;
    cout << a * b - (a + b - 1) << endl;
    return 0;
}

Measured memory_bytes: 3584
class UnionFind():
    def __init__(self, n):
        self.n = n
        self.root = [-1]*(n+1)
        self.rnk = [0]*(n+1)
    
    def Find_Root(self, x):
        if self.root[x] < 0:
            return x
        else:
            self.root[x] = self.Find_Root(self.root[x])
            return self.root[x]
    
    def Unite(self, x, y):
        x = self.Find_Root(x)
        y = self.Find_Root(y)
        if x == y:
            return 
        elif self.rnk[x] > self.rnk[y]:
            self.root[x] += self.root[y]
            self.root[y] = x
        else:
            self.root[y] += self.root[x]
            self.root[x] = y
            if self.rnk[x] == self.rnk[y]:
                self.rnk[y] += 1
    
    def isSameGroup(self, x, y):
        return self.Find_Root(x) == self.Find_Root(y)
 
    def Count(self, x):
        return -self.root[self.Find_Root(x)]

N,M,K = list(map(int,input().split()))

uf = UnionFind(N)
fr = [0]*(N+1)

for i in range(M):
    [x_tmp,y_tmp] = list(map(int,input().split()))
    uf.Unite(x_tmp,y_tmp)
    fr[x_tmp] += 1
    fr[y_tmp] += 1

ans = [0]*(N+1)

for i in range(1,N+1):
    ans[i] = uf.Count(i) - fr[i] - 1
for j in range(K):
    [x_tmp,y_tmp] = list(map(int,input().split()))
    if uf.isSameGroup(x_tmp,y_tmp):
        ans[x_tmp] -= 1
        ans[y_tmp] -= 1

print(' '.join(list(map(str,ans[1:]))))

Measured memory_bytes: 16608
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i,n) for(int i=0; (i)<(n); ++(i))
#define rep1(i,n) for(int i=1; (i)<(n); ++(i))
#define maxi(v) distance(v.begin(), max_element(v.begin(), v.end()))
#define mini(v) distance(v.begin(), min_element(v.begin(), v.end()))
#define INF 1001001001
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; }
ll gcd(ll x, ll y){
  if(y==0) return x;
  else return gcd(y, x%y);
  }
int main(){
  int n, k; cin >> n >> k;
  int point;
  double ans = 0;
  rep1(i,n+1){
    point = i;
    int j = 0;
    while(1){
      if(point>=k) { ans += (1/(double)n)*pow(0.5,j); break; }
      else { point *= 2; j++; }
    }
  }
  printf("%.12lf",ans);
  return 0;
}
  

Measured memory_bytes: 640
#include <iostream>
#include <vector>

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

int main() {
  ll N, K, Q;
  std::cin >> N >> K >> Q;
  std::vector<ll> A(Q);
  rep(i,Q) std::cin >> A[i];
  ll res_point {0};
  std::vector<ll> Player(N, K);
  rep(i,Q) {
    if (Player[A[i] - 1] - res_point > 0) ++Player[A[i] - 1];
    ++res_point;
  }
  rep(i,N) {
    if (Player[i] - res_point > 0) std::cout << "Yes\n";
    else std::cout << "No\n";
  }
}


Measured memory_bytes: 2176
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N,M;
  cin >> N >> M;
  vector<int> x(M*2);
  vector<int> y(N);
  
  for(int i=0;i<x.size();i++){
    cin >> x.at(i);
  }
  
  for(int i=0;i<x.size();i++){
    
    for(int j=0;j<N;j++){
      
      if(x.at(i)==j+1){
        y.at(j)+=1;
        
      }
      
    }
    
  }
  
  for(int i=0;i<N;i++)
    cout << y.at(i) << endl;
  
}

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

#include <set>
#include <unordered_map>
#include <stack>
#include <map>

using namespace std;

#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define all(x) (x).begin(),(x).end()
using ll = long long;
template<class T>bool chmaxj(T &a, const T &b) { if (a < b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b < a) { a = b; return 1; } return 0; }
void YesNo(bool y) { cout << (y ? "Yes" : "No") << endl; } //true==yes


#define INF 21474836

//////////////////////////////////////////////////////////////



int main() {

	int A, B, C, D;
	cin >> A >> B >> C >> D;
	
	while (true)
	{
		C -= B;
		if (C <= 0) {
			cout << "Yes" << endl;
			break;
		}
		A -= D;
		if (A <= 0) {
			cout << "No" << endl;
			break;
		}
	}

}


Measured memory_bytes: 3136
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApp15
{
    class Class393
    {
        static string[] dw = new string[4] { "A", "C", "G", "T" };
        static readonly long mod = 1000000007;
        static void Main()
        {
            int N = int.Parse(Console.ReadLine());
            Dictionary<string, long> words = new Dictionary<string, long>
            {
                {"A",1 },
                {"C",1 },
                {"G",1 },
                {"T",1 }
            };
            for (int i = 1; i < N; i++)
            {
                Dictionary<string, long> newwords = new Dictionary<string, long>();
                foreach(var w in words.Keys)
                { 

                    for (int k = 0; k < 4; k++)
                    {
                        string nw = w + dw[k]; 

                        if (nw.Length >=3)
                        {
                            string sw = nw.Substring(nw.Length-3);
                            if (sw == "AGC" || sw == "GAC" || sw == "ACG")
                                continue;
                            if(nw.Length==4)
                                if ((nw[0] == 'A' && nw[2] == 'G' && nw[3] == 'C') || (nw[0] == 'A' && nw[1] == 'G' && nw[3] == 'C'))
                                    continue;

                            nw = sw;
                        }

                        if (newwords.ContainsKey(nw))
                        {
                            newwords[nw] += words[w];
                            newwords[nw] %= 1000000007;
                        }
                        else
                        {
                            newwords[nw] = words[w];
                        }
                    }
                }
                words = new Dictionary<string, long>(newwords);
            }
            long ans = 0;
            foreach(long i in words.Values)
            {
                ans += i;
                ans %= 1000000007;
            }
            Console.WriteLine(ans);
        }
    }
}


Measured memory_bytes: 30236
W, H, N = list(map(lambda n: int(n), input().split(" ")))
xmin = [0] # a = 1
xmax = [W] # a = 2
ymin = [0] # a = 3
ymax = [H] # a = 4
for i in range(N):
  tmp = input().split(" ")
  if tmp[2] == "1":
    xmin.append(int(tmp[0]))
  elif tmp[2] == "2":
    xmax.append(int(tmp[0]))
  elif tmp[2] == "3":
    ymin.append(int(tmp[1]))
  elif tmp[2] == "4":
    ymax.append(int(tmp[1]))

S = max([min(xmax) - max(xmin), 0]) * max([min(ymax) - max(ymin), 0])
print(S)
  

Measured memory_bytes: 9208
#include <cstdio>
#include <iostream>
#include <string>
#include <vector>
#include <sstream>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <typeinfo>
#include <numeric>
#include <functional>
#include <unordered_map>
#include <bitset>


using namespace std;
using ll = long long;
using ull = unsigned long long;

const ll INF = 1e16;
const ll MOD = 1e9 + 7;

#define REP(i, n) for(ll i = 0; i < n; i++)





int main() {
    ll n, k;
    cin >> n >> k;
    
    ll mn = INF, mn_i = 0;
    REP(i, n){
        ll a;
        cin >> a;
        
        if(mn > a){
            mn = a;
            mn_i = i;
        }
    }
    
    if(n <= k){
        cout << 1 << endl;
        return 0;
    }
    
    ll s = INF;
    if((n - k) % (k - 1) == 0){
        s = (n - k) / (k - 1) + 1;
    }
    else{
        s = (n - k) / (k - 1) + 2;
    }
    
    cout << min(((mn_i % (k - 1) == 0)? mn_i / (k - 1) : mn_i / (k - 1) + 1) + (((n - mn_i - 1) % (k - 1) == 0)? (n - mn_i - 1) / (k - 1) : (n - mn_i - 1) / (k - 1) + 1), s)<< endl;
}

Measured memory_bytes: 256
/**
 * @author torith
 * @date 2018-10-21
 */

#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

int main(){

    cin.tie(0);
    ios::sync_with_stdio(false);

    int N;
    cin >> N;
    int A[100001];
    A[0] = 0;
    int sum = 0;
    for (int i = 1; i < N+1; ++i) {
        cin >> A[i];
        sum += abs(A[i] - A[i-1]);
    }
    A[N+1] = 0;
    sum += abs(A[N+1] - A[N]);

    for (int i = 1; i < N+1; ++i) {
        cout << sum - abs(A[i] - A[i-1]) - abs(A[i+1] - A[i]) + abs(A[i+1] - A[i-1]) << "\n";
    }
    return 0;
}



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

using namespace std;

#define PB push_back
void parr(int *arr, int n){ for (int i = 0; i < n; i++) cout << arr[i] << " "; cout << endl; }
typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> pi;

ll n,a,b;
ll m;
const int N = 1e8;
ll h[N];

bool OK(ll x){
    ll s = x;
    for (int i = 0; i < n; i++){
        if (h[i]-(x*b) <= 0) {
            continue;
        }
        if (h[i]-(s*a + ((x-s)*b)) > 0) {
            return false;
        }
        ll k;
        ll l = 1;
        ll r = s;
        while (l < r){
            k = (l+r)/2;
            if (h[i]-((k*a)+((x-k)*b)) > 0) {
                l = k+1;
            } else {
                r = k;
            }
        }
        s -= r;
    }
    return true;
}

int main(){
#ifdef LOCAL
    freopen("d.in", "r", stdin);
#endif

    cin >> n >> a >> b;
    
    for (int i = 0; i < n; i++){
        cin >> h[i];
        if (h[i] > m) {
            m = h[i];
        }
    }

    ll l = 1, r = 1 + ((m-1) / b), k;
    while (l<r){
        k = (l+r)/2;
        if (OK(k)) {
            r = k;
        } else {
            l = k +1;
        }
    }
    cout << r << endl;

    return 0;
}


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

using namespace std;

#define REP(i, n) for (int i=0; i<(n); ++i)
#define RREP(i, n) for (int i=(int)(n)-1; i>=0; --i)
#define FOR(i, a, n) for (int i=(a); i<(n); ++i)
#define RFOR(i, a, n) for (int i=(int)(n)-1; i>=(a); --i)

#define SZ(x) ((int)(x).size())
#define ALL(x) (x).begin(),(x).end()

#define DUMP(x) cerr<<#x<<" = "<<(x)<<endl
#define DEBUG(x) cerr<<#x<<" = "<<(x)<<" (L"<<__LINE__<<")"<<endl;

template<class T>
ostream &operator<<(ostream &os, const vector <T> &v) {
    os << "[";
    REP(i, SZ(v)) {
        if (i) os << ", ";
        os << v[i];
    }
    return os << "]";
}

template<class T, class U>
ostream &operator<<(ostream &os, const pair <T, U> &p) {
    return os << "(" << p.first << " " << p.second << ")";
}

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

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

using ll = long long;
using ull = unsigned long long;
using ld = long double;
using P = pair<int, int>;

using vi = vector<int>;
using vll = vector<ll>;
using vvi = vector<vi>;
using vvll = vector<vll>;

const ll MOD = 1e9 + 7;
const int INF = INT_MAX / 2;
const ll LINF = LLONG_MAX / 2;
const ld eps = 1e-9;


int main() {

    int n; cin >> n;
    map<int,int> mp;
    ll sum = 0;
    REP(i, n) {
        int a; cin >> a;
        sum += a;
        ++mp[a];
    }

    int q; cin >> q;
    while (q--) {
        ll b, c; cin >> b >> c;
        sum -= b * mp[b];
        sum += c * mp[b];
        mp[c] += mp[b];
        mp.erase(b);
        cout << sum << endl;
    }

    return 0;
}



Measured memory_bytes: 6580
import fractions
import math
a,b = map(int, input().split())
g = fractions.gcd(a,b)
ans = 1

for i in range(2, int(math.sqrt(g))+1):
  if g%i == 0:
    ans += 1
    while True:
      g //= i
      if g%i != 0:
        break
if (g != 1):
  ans += 1
print(ans)

Measured memory_bytes: 5048
#include<stdio.h>
#include <stdlib.h>
#include <string.h>
int main()
{
	long long a, b;
	char c;
	scanf("%lld %c %lld", &a, &c, &b);
	if(c=='+')
	printf("%lld", a+b);
	if (c == '-')
		printf("%lld", a - b);
	return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
#define inf 0x3f3f3f3f3f3f3f3f
#define debug(...) fprintf(stderr, __VA_ARGS__)
#define inv(x) Power(x, mod - 2)
#define fi first
#define se second
#define N 200005

using namespace std;
typedef pair<int,int> Pair;
typedef long long ll;

const long double Pi = 3.14159265358979323846l;
const int mod = 1e9 + 7;
inline int add(int x, int y) { return (x += y) - (x >= mod ? mod : 0); }
inline void inc(int &x, int y) { (x += y) -= (x >= mod ? mod : 0); }
inline int mul(int x, int y) { return 1ll * x * y % mod; }
inline int Power(int x, int y) {
	int res = 1;
	while (y) {
		if (y & 1) res = mul(res, x);
		x = mul(x, x), y >>= 1;
	} return res;
}

template <class T> inline T	input() {
	T x; char ch; while (!isdigit(ch = getchar()));
	for (x = ch ^ 48; isdigit(ch = getchar()); x = x * 10 + (ch ^ 48));
	return x;
}

template <class T> inline void chkmin(T &x, T &y) { x = x < y ? x : y; }
template <class T> inline void chkmax(T &x, T &y) { x = x > y ? x : y; }

struct {
	inline operator int () { return input<int>(); }
	inline operator long long () { return input<long long>(); }
	template <class T> inline void operator () (T &x) { x = *this; }
	template<class T, class ...A> inline void operator () (T &x, A &...a)
	{ x = *this; this -> operator ()(a...); }
} read;

bool flag;
long double ans;
int n, tot, xa, xb, ya, yb;
int a[N], f[N];
Pair b[N];

int main() {
	read(xa, ya, xb, yb);
	if (xa > xb) swap(xa, xb), swap(ya, yb);
	if (ya > yb) swap(ya, yb), flag = true;
	ans = 100ll * (yb - ya + xb - xa);

	read(n);
	for (int i = 1, x, y; i <= n; ++i) {
		read(x, y);
		if (x < xa || x > xb || y < ya || y > yb) continue;
		b[++tot] = make_pair(x, y);
	}

	n = tot, sort(b + 1, b + n + 1);
	for (int i = 1; i <= n; ++i) a[i] = b[i].se;
	if (flag) reverse(a + 1, a + n + 1);

	f[tot = 0] = -1;
	for (int i = 1; i <= n; ++i) {
		if (a[i] > f[tot]) f[++tot] = a[i];
		else *lower_bound(f + 1, f + tot + 1, a[i]) = a[i];
	}

	if (tot == min(xb - xa, yb - ya) + 1)
		ans += Pi * 10 - 20 + (Pi * 5 - 20) * (tot - 1);
	else ans += (Pi * 5 - 20) * tot;
	printf("%.15Lf\n", ans);
	return 0;
}


Measured memory_bytes: 3328
#include <iostream>
#include <array>
#include <map>
#include <algorithm>
#include <cmath>
#include <vector>
#include <fstream>
#include <string>
#include <random>
#include <queue>
#include <iomanip>
#include <functional>
#include <climits>
#include <tuple>
#include <unordered_map>
#include <limits>
#include <functional>
#include <cassert>

#define FOR(x,n) for(int x = 0; x < n; x++)
#define PUT(x) cout << x << endl
#define DPUT(x) printf("%.15lf\n",x)
#define GET(x,y) std::get<x>(y)
#define CHMAX(x,y) x = std::max(x,y)
#define CHMIN(x,y) x = std::min(x,y)

using namespace std;

using ll = long long int;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using vll = std::vector<ll>;
using vpll = std::vector<pll>;
using vpii = std::vector<pii>;
using vi = std::vector<int>;
using vvi = std::vector<vi>;
using vvpii = std::vector<vpii>;
using vch = std::vector<char>;
using vvch = std::vector<vch>;
using tiii = std::tuple<int, int, int>;

const ll mod197 = 1000000007LL;
const ll INF = 10000000000LL;

const double PI11 = 3.14159265359;

const int dis[5] = { 0,1,0,-1,0 };

const int disD[4] = { 0,1,1,0 };




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

	if ((b - a) % 2 == 0) {
		cout << "Alice" << endl;
	}
	else {
		cout << "Borys" << endl;
	}

	return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using ll=long long;
using namespace std;
int main(){
  ll n,k,i,x=0;
  cin>>n>>k;
  for(i=1;i<=n;i++)x+=max((ll)0,(n/i)*(i-k))+max((ll)0,n%i-k+1);
  if(k==0)cout<<n*n;
  else cout<<x;
}


Measured memory_bytes: 256
k,x=map(int,input().split())
if(x==-1000000):
    for i in range(k):
        print(x+i,end=" ")
elif(x==1000000):
    for i in range(k-1,-1,-1):
        print(x-i,end=" ")
else:
    for i in range(k-1,-1,-1):
        print(x-i,end=" ")
    for i in range(1,k):
        print(x+i,end=" ")

Measured memory_bytes: 3064
l = list(input().rstrip())
ops = ['+', '-']
for a in ops:
    for b in ops:
        for c in ops:
            s = l[0] + a + l[1] + b + l[2] + c + l[3]
            if eval(s) == 7:
                print(s + '=7')
                exit()

Measured memory_bytes: 2940
# print('input >>')
N = input()
As = list(map(int,(input().split())))

money = 1000
kab = 0

for i in range(len(As)-1):
    if As[i+1] >= As[i]:
        kounyu = money // As[i]
        kab += kounyu
        money -= kounyu * As[i]
    elif As[i+1] < As[i]:
        money += kab * As[i]
        kab = 0
    # print(money, kab)

money += kab * As[-1]

# print('-----output-----')
print(money)

Measured memory_bytes: 9204
#include <iostream>
#include <utility>
#include <map>
#include <vector>
#include <algorithm>
#include <queue>
#include <math.h>
#include <stack>
#include <set>
#include <deque>
#include <cmath>

using namespace std;
typedef long long ll;
ll mod = 1e9+7;
//ll mod = 998244353;
#define rep(i,n) for(int i = 0; i < (n); ++i)

int main() {
    string s;
    int k;
    cin >> s >> k;
    int n = s.size();
    set<string> st;
    bool flg = false;
    rep(j, n) {
        rep(l, k) {
            if (j + l >= n) break;
            st.insert(s.substr(j, l+1));
        } 
    }    
    int cnt = 0;
    for (auto ans: st) {
        if (cnt == k -1) {
            cout << ans << endl;
            return 0;
        }
        ++cnt;
    }
    return 0;
}


Measured memory_bytes: 4784
a = input().split()
 
b = [int(x) for x in input().split()]
 
c = input()
 
if c == a[0]:
  b[0]-=1
elif c == a[1]:
  b[1]-=1
 
if b[0] < 0:
  b[0] = 0
if b[1] < 0:
  b[1] = 0
print("{} {}".format(*b))


Measured memory_bytes: 3060
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n; i++)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define ll long long int
const int INF = 2147483647;

using namespace std;

int main()
{
  string s;
  int k;
  vector<string> ans;

  cin >> s;
  cin >> k;
  REP(i, s.length())
  {
    if (ans.size() >= k)
    {
      if (s[i] > ans[ans.size() - 1][0])
      {
        continue;
      }
    }
    FOR(j, i, s.length())
    {
      bool flag = false;
      string sub = s.substr(i, j - i + 1);
      if (!ans.empty() && ans.size() >= k && sub > ans[ans.size() - 1])
        continue;
      REP(l, ans.size())
      {
        if (ans[l] == sub)
          flag = true;
      }
      if (flag)
        continue;
      if (ans.size() < k)
      {
        ans.push_back(sub);
        sort(ans.begin(), ans.end());
      }
      else
      {
        REP(l, ans.size())
        {
          if (sub < ans[l])
          {
            ans.insert(ans.begin() + l, sub);
            if (ans.size() >= k)
              ans.pop_back();
            break;
          }
        }
      }
    }
  }
  cout << ans[k - 1] << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
#define ce(x) cerr << (x) << "\n"
#define cesp(x) cerr << (x) << " "
#define pb push_back
#define mp make_pair
#define Would
#define you
#define please


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


	int N, M;
	cin >> N >> M;
	int S[2000], T[2000];
	rep(i, N) cin >> S[i];
	rep(i, M) cin >> T[i];

	ll mod = 1e9 + 7;
	ll dp[2001];
	ll dp2[2001] = {};

	rep(i, M + 1) dp[i] = 1;
	rep1(i, N) {
		rep1(j, M) {
			if (S[i - 1] == T[j - 1]) {
				dp2[j] = dp[j];
				dp[j] = dp[j - 1] + dp[j];
			}
			else {
				dp[j] = dp[j - 1] + dp2[j];
			}
		}
		rep1(j, M) dp[j] %= mod;
	}
	co(dp[M] % mod);

	Would you please return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;
public class Main {
	void run() {
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt(); 
		System.out.println((a*b) + " " + (a+a+b+b));
	}
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		new Main().run();
	}

}



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


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

    long long int amari = N % K;

    long long int a = K - amari;

    if(amari > a){
        cout << a;
    }
    else{
        cout << amari;
    }

    

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <unordered_map>
#include <set>
#include <fstream>
#include <cstring>
#include <climits>
#include <algorithm>
#include <math.h>
#include <vector>
using namespace std;

#define ll long long
#define mod 1000000007

int main() {

	int r;
	cin >> r;
	cout << setprecision(14) << 2.0 * 22 / 7 * (double)r;

	return 0;
}

Measured memory_bytes: 3768
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <cstring>
#include <string>
#include <vector>
#include <random>
#include <bitset>
#include <queue>
#include <cmath>
#include <stack>
#include <set>
#include <map>
typedef long long ll;
using namespace std;
const ll MOD = 1000000007LL;
typedef pair <string, int> P;

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

    int n;
    cin >> n;

    map <string, vector <int> > mp;
    map <P, int> idx;
    for (int i = 0; i < n; i++) {
        string s;
        int p;
        cin >> s >> p;
        idx[P(s, p)] = i + 1;
        mp[s].push_back(p);
    }

    for (auto itr = mp.begin(); itr != mp.end(); itr++) {
        sort(itr->second.begin(), itr->second.end(), greater<int>());
        for (int i = 0; i < itr->second.size(); i++) {
            P p = P(itr->first, itr->second[i]);
            cout << idx[p] << '\n';
        }
    }

    return 0;
}

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

int main(){
int n,m;
while(1){
cin>>n>>m;
if(n==0&&m==0) break;
if(n>m) cout<<m<<" "<<n<<endl;
else if(n<m) cout<<n<<" "<<m<<endl;
else cout<<n<<" "<<m<<endl;
}
}

Measured memory_bytes: 3080
#include<iostream>
#include<cstdio>
#include<vector>
#include<map>
#include<string>
#include<algorithm>
#include<math.h>

using namespace std;

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

int main(){
	string s;
	cin >> s;
	map<char, int> mp;
	int L = s.length();
	for (int i = 0; i < L; i++){
		if (mp.count(s[i]) == 0){
			mp[s[i]] = 1;
		}
		else{
			mp[s[i]]++;
		}
	}
	for (auto elm : mp){
		if (elm.second % 2 != 0){
			cout << "No" << endl;
			return 0;
		}
	}
	cout << "Yes" << endl;
	return 0;
}

Measured memory_bytes: 384