akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
using namespace std;
int main(void){
    int a, b, k;
    cin >> a >> b;
    if((a+b) % 2 == 0){
        k=(a+b)/2;
        cout << k << endl;
    }else{
        cout << "IMPOSSIBLE" << endl;
    }
    return 0;
}



Measured memory_bytes: 384
// clang-format off
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
#define rep(i,n) for(ll i=0, i##_len=(n); i<i##_len; ++i)
#define rep1(i,n) for(ll i=1, i##_len=(n); i<=i##_len; ++i)
#define rrep(i,n) for(ll i=n-1; i>=0; --i)
#define rrep1(i,n) for(ll i=n; i>0; --i)
#define all(x) (x).begin(),(x).end()
#define SORT(x) sort(all(x))
#define SORT_DESC(x) sort((x).rbegin(),(x).rend())
#define pb push_back
#define mp make_pair
#define coutl cout<<fixed<<setprecision(10)
#define ANS(ans) cout<<ans<<endl;
const ll LINF = (1LL << 62) - 1;
const int INF = (1 << 30) - 1;
template<class T>bool chmax(T &a, const T &b){if (a<b){a=b;return 1;}return 0;}
template<class T>bool chmin(T &a, const T &b){if (b<a){a=b;return 1;}return 0;}
// clang-format on

void solve(long long K, long long A, long long B) {
  ll l = (B / K) * K;
  ANS((A <= l ? "OK" : "NG"));
}

// clang-format off
int main() {
  long long K;
  scanf("%lld",&K);
  long long A;
  scanf("%lld",&A);
  long long B;
  scanf("%lld",&B);
  solve(K, A, B);
  return 0;
}


Measured memory_bytes: 3688
#include <iostream>
#include <string>
#include <cmath>
#include <limits>
int main()
{
    std::string S;
    std::cin >> S;

    int max = std::numeric_limits<int>::max();
    for (size_t i = 0; i < S.size() - 2; i++) {
        if (std::abs((S.at(i) - '0') * 100 + (S.at(i + 1) - '0') * 10 + (S.at(i + 2) - '0') - 753) < max) {
            max = std::abs((S.at(i) - '0') * 100 + (S.at(i + 1) - '0') * 10 + (S.at(i + 2) - '0') - 753);
        }
    }
    std::cout << max << std::endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main()
{
	int n;
	string s, t;
	cin >> n >> s >> t;

	int cnt = 0;
	for (int i = 0; i < n; i++)
	{
		string subs = s.substr(i, n - i); //後半を抽出
		string subt = t.substr(0, n - i); //前半を抽出
		if (subs == subt) //抽出した部分がもし重複したら
			cnt = max(cnt, n - i); //重複部分がながければ長いほど最小になるので、長いものをキープ
	}
	cout << 2 * n - cnt << endl; //最大のときは2n。2nから一番長い重複を引く
}

Measured memory_bytes: 3536
import java.util.Scanner;

class Main {

  public static void main(String[] args){

    Scanner sc = new Scanner(System.in);
    int ans = 0;
    int n = sc.nextInt();

    for (int j = 0; j < n; j++){
      if (isPrime(sc.nextInt())) ans++;
    }
    System.out.println(ans);
  }

  public static boolean isPrime(int x){

    /* 引数が２ならtrue */
    if (x == 2)
      return true;
    if (x % 2 == 0)
      return false;

    int i = 3;
    while (i <= Math.sqrt(x)){
      if (x % i == 0)
        return false;
      i += 2;
    }
    return true;
  }

}


Measured memory_bytes: 41412
#include <stdio.h>
class Dice {
  private:
    int dev[6],tmp;
  
  public:
    Dice() {
      for (int i = 0; i < 6; i++) dev[i] = 6;
    }
    void setNum(int i, int num) {
      dev[i] = num;
    }
    int getNum(int i) {
      return dev[i];
    }
    void e() {
      tmp = dev[0];
      dev[0] = dev[3];
      dev[3] = dev[5];
      dev[5] = dev[2];
      dev[2] = tmp;
    }
    void n() {
      tmp = dev[0];
      dev[0] = dev[1];
      dev[1] = dev[5];
      dev[5] = dev[4];
      dev[4] = tmp;
    }
    void s() {
      tmp = dev[0];
      dev[0] = dev[4];
      dev[4] = dev[5];
      dev[5] = dev[1];
      dev[1] = tmp;
    }
    void w() {
      tmp = dev[0];
      dev[0] = dev[2];
      dev[2] = dev[5];
      dev[5] = dev[3];
      dev[3] = tmp;
    }
};
bool check(Dice dice1, Dice dice2) {
  for (int i = 0; i < 6; i++) {
    if (dice1.getNum(i) != dice2.getNum(i)) return false;
  }
  return true;

}
int main() {
  int a,num,flag = 0;
  char order;
  scanf("%d", &num);
  Dice d1[num];
  for (int i = 0; i < num; i++) {
    for (int j = 0; j < 6; j++) {
      scanf("%d", &a);
      d1[i].setNum(j,a);
    }
  }
  for (int k = 0; k < num; k++) {
    for (int l = k + 1; l < num; l++) {
      for (int i = 0; i < 6; i++) {
        for (int j = 0; j < 4;j++) {
          if (check(d1[k],d1[l])) break;
          d1[l].w();
        }
        if (check(d1[k],d1[l])) break;
        if (i == 3) d1[l].w();
        else if (i == 4) d1[l].s();
        d1[l].s();
      }
      if (check(d1[k],d1[l]))  {
        flag = 1;
        break;
      }
    }
    if (flag == 1) break;
  }
  if (flag == 1) printf("No\n");
  else printf("Yes\n");
  return 0;
}



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

int main() {
  int N,Y;
  cin >> N;
  string color;
  for (int i = 0; i < N; i++){
    cin >> color;
    if (color == "Y") {
      Y = true;
      break;
    }
    Y = false;
  }
  if (Y)
    cout << "Four" << endl;
  else
    cout << "Three" << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define oo 0x3f3f3f3f

int main()
{
    ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    ll a,b,c,d;
    cin>>a>>b>>c>>d;
    ll res = max({a*c,a*d,b*c,b*d});
    if(a <=0 && b >=0)res=max(res,0ll);
    if(c <=0 && d >=0)res=max(res,0ll);
    cout<<res;
}


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


int N, M , Q;
vector<int> a, b ,c, d;
int ans;

void dfs(vector<int> A){
  if(A.size() == N+1) {
    int now = 0;
    rep(i, Q){
      if(A[b[i]] - A[a[i]] == c[i]){
        now += d[i];
      }
    }
    if(ans < now) ans = now;
    return ;
  }
  A.push_back(A.back());
  while(A.back() <= M){
    dfs(A);
    A.back()++;
  }
}

int main(){

  cin >> N >> M >> Q;
  a.resize(Q); b.resize(Q); c.resize(Q); d.resize(Q);

  rep(i, Q){
    cin >> a[i] >> b[i] >> c[i] >> d[i];
  }

  dfs(vector<int>(1, 1));
  cout << ans << endl;
}


Measured memory_bytes: 3600
in_list = list(map(int,input().split()))

if in_list[0] == in_list[1] + in_list[2] or in_list[1] == in_list[2] + in_list[0] or in_list[2] == in_list[1] + in_list[0]:
    print ('Yes')
else:
    print ('No')


Measured memory_bytes: 2940
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>

int qsort_comp(const void* x,const void* y) {
	int a=*((const int*)x);
	int b=*((const int*)y);
	if(a>b)return 1;
	if(a<b)return -1;
	return 0;
}

int getkahan(const char* str,int length) {
	if(isdigit(*str))return (atoi(str)+1)/2;
	int* hlist=malloc(sizeof(int)*3400);
	int hlist_num=0;
	int i;
	for(i=0;i<length;) {
		int next,level=1;
		for(next=i+1;level>0;next++) {
			if(str[next]=='[')level++;
			else if(str[next]==']')level--;
		}
		hlist[hlist_num++]=getkahan(&str[i+1],next-i-2);
		i=next;
	}
	qsort(hlist,hlist_num,sizeof(int),qsort_comp);
	int sum=0;
	for(i=0;i<(hlist_num+1)/2;i++)sum+=hlist[i];
	free(hlist);
	return sum;
}

int main(void) {
	int n,i;
	scanf("%d",&n);
	for(i=0;i<n;i++) {
		char input[20000];
		scanf("%s",input);
		printf("%d\n",getkahan(&input[1],(int)strlen(input)-2));
	}
	return 0;
}

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

using namespace std;

#define endl '\n'
#define ll long long
#define mod 1000000007

void solve(){
    int n;
    cin>>n;
    int c = 0;
    while(n--){
        int x,y;
        cin>>x>>y;
        if(x == y){
            c++;
        }else{
            c = 0;
        }
        if(c == 3){
            cout<<"Yes";
            return;
        }
    }
    cout<<"No";
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    int t = 1;
    while(t--){
        solve();
    } 
    return 0;
}

Measured memory_bytes: 3640
#define _USE_MATH_DEFINES
#include "bits/stdc++.h"
using namespace std;
#define FOR(i,j,k) for(int (i)=(j);(i)<(int)(k);++(i))
#define rep(i,j) FOR(i,0,j)
#define each(x,y) for(auto &(x):(y))
#define mp make_pair
#define MT make_tuple
#define all(x) (x).begin(),(x).end()
#define debug(x) cout<<#x<<": "<<(x)<<endl
#define smax(x,y) (x)=max((x),(y))
#define smin(x,y) (x)=min((x),(y))
#define MEM(x,y) memset((x),(y),sizeof (x))
#define sz(x) (int)(x).size()
#define RT return
using ll = long long;
using pii = pair<int, int>;
using vi = vector<int>;
using vll = vector<ll>;

void solve() {
    int N, K;
    cin >> N >> K;
    vi H(N);
    rep(i, N)cin >> H[i];
    const int INF = INT_MAX / 2;
    vi dp(N + 1, INF);
    dp[0] = 0;
    rep(i, N - 1) {
        for (int j = i + 1; j <= min(i + K, N - 1); ++j) {
            smin(dp[j], dp[i] + abs(H[i] - H[j]));
        }
    }
    cout << dp[N - 1] << endl;
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << fixed << setprecision(15);
    solve();
    return 0;
}


Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
#ifdef LOCAL_DEBUG
  #include "LOCAL_DEBUG.hpp"
#endif
#define int long long
const int MOD = 1e9 + 7;

signed main(){

  int n; cin >> n;
  vector<int> a(n);
  for(int i = 0; i < n; i++){
    cin >> a[i];
  }

  vector<int> b(100001, 0);
  for(int i = 0; i < n; i++){
    b[a[i]]++;
  }

  bool judge = true;
  if(n%2 == 1){
    if(b[0] != 1) judge = false;
    for(int i = 2; i < n; i+=2){
      if(b[i] != 2) judge = false;
    }
  }else {
    for(int i = 1; i < n; i+=2){
      if(b[i] != 2) judge = false;
    }
  }

  if(!judge){
    cout << 0 << endl;
    return 0;
  }

  int ans = 1, t = n / 2;
  while(t--) ans = (ans * 2) % MOD;
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 1920
import java.util.Scanner;

/**
 * Combinatorial - 0-1 Knapsack Problem
 */
public class Main {

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

		int N = sc.nextInt();
		int W = sc.nextInt();
		int[] vs = new int[N + 1];
		int[] ws = new int[N + 1];
		int[][] dp = new int[N + 1][W + 1];

		for (int i = 1; i <= N; i++) {
			vs[i] = sc.nextInt();
			ws[i] = sc.nextInt();
		}

		for (int i = 1; i <= N; i++) {
			for (int j = 0; j <= W; j++) {
				if (j < ws[i]) {
					dp[i][j] = dp[i - 1][j];
				} else {
					dp[i][j] = Math.max(dp[i - 1][j], dp[i - 1][j - ws[i]] + vs[i]);
				}
			}
		}

		System.out.println(dp[N][W]);

	}
}

Measured memory_bytes: 31028
#include<bits/stdc++.h>
#define int long long
using namespace std;
int a[300005];
int f[300005];

main()
{
    int n,k;

    cin>>n>>k;
    for(int i=0;i<n;i++)
    {
        cin>>a[i];
        f[i]=LLONG_MAX;
    }
    f[0]=0;
    for(int i=0;i<n;i++)
    {
        for(int j=i;j>=max(i-k,0LL);j--)
            f[i]=min(f[i],f[j]+abs(a[i]-a[j]));
    }
    cout<<f[n-1];
}


Measured memory_bytes: 3072
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG //これつけるとA[N]でもいいらしい
//for文のマクロ
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define big 1000000007
#define all(a) sort((a).begin(),(a).end()) //ソートのマクロ
#define Re(a) reverse((a).begin(),(a).end())
int main(){
    int n;
    cin>>n;
    vector<string> s(n);
    rep(i,n){
        cin>>s[i];
        sort(s[i].begin(),s[i].end());
    }
    sort(s.begin(),s.end());
    map<string,int> p;
    rep(i,n){
        p[s[i]]++;
    }
    int64_t sum=0;
    for(auto c:p){
        int64_t cnt = c.second;
        sum += cnt*(cnt-1)/2;
    }
    cout<<sum<<endl;
}

Measured memory_bytes: 13568
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N = 3e5+10;
const ll M = 1e9+7;

ll a[N]; 

int main()
{
	int n;
	scanf("%d",&n);
	for(int i = 1;i <= n;++i) scanf("%lld",&a[i]);
	
	ll ans = 0;
	for(int i = 0;i < 60;++i){
		ll sum = 0;
		ll k = (1ll << i);
		for(int j = 1;j <= n;++j){
			if(k & a[j]) sum++;
		}
		ans += k%M*sum%M*(n-sum)%M;
		ans %= M;
	}
	
	printf("%lld\n",(ans+M)%M);
	return 0;
} 

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

int main()
{
    int n;
    cin >> n;
    ll a[n];
    for(int i = 0; i < n; i++){
        cin >> a[i];
    }
    sort(a,a+n);
    int cnt = 1,k = 0;
    ll ans = 1;
    for(int i = n-1; i >= 1; i--){
        if(a[i] == a[i-1]){
            cnt++;
        }else{
            cnt = 1;
        }
        if(cnt % 2 == 0){
            ans *= a[i-1];
            k++;
        }
        if(k == 2){
            cout << ans << endl;
            return 0;
        }
    }
    cout << 0 << endl;
}

Measured memory_bytes: 1024
import sys
from collections import Counter
def main():
    n, k = map(int, input().split())
    a = tuple(map(int, input().split()))

    col = max(0, len(set(a)) - k)
    if col == 0:
        print(0)
        sys.exit()

    ac = Counter(a)
    acl = ac.most_common()[::-1]
    acll = [ace[1] for ace in acl[:col]]

    r = sum(acll)
    print(r)

if __name__ == '__main__':
    main()


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

using namespace std;
# define pi 3.14159265358979323846
using ll = long long;

int main(){
    double a, b, h, m;
    cin >> a >> b >> h >> m;
    double ang, ang1;
    ang = (double)360 / (double)12 * h + (double)360 / (double)12 * (m / (double)60);
    ang1 = (double)360 / (double)60 * m;
    ang = abs(ang - ang1);
    ang = min(360 - ang, ang);
    cout << fixed;
    cout << setprecision(20) <<sqrt(a * a +  b * b -(double) 2 * a * b * cos((pi / (double)180) * ang));

}


Measured memory_bytes: 4136
import java.util.*;

public class Main {
	public static void main(String[] args) {
		Integer list[] = { 111, 222, 333, 444, 555, 666, 777, 888, 999 };

		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int ret = 0;
		for (int i = n; true; i++) {
			if (Arrays.asList(list).contains(i)) {
				ret = i;
				break;
			}
		}

		System.out.println(ret);

		sc.close();
	}
}

Measured memory_bytes: 21972
#include <iostream>
#include <bits/stdc++.h>
#include <math.h>
using namespace std;
#define IOS ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define ull unsigned long long 
#define int long long 
#define pb push_back 
#define mp make_pair
#define ff first
#define ss second
#define lb lower_bound
#define ub upper_bound
#define endl "\n"
#define Max(x,y,z) max(x,max(y,z))
#define Min(x,y,z) min(x,min(y,z))
#define MAX 1e18
#define PI 3.14159265
const int mod = 1e9 + 7;

int power(int x, int y) 
{ 
   int res = 1;      
  
   
    while (y > 0) 
    { 
       
        if (y & 1) 
            res = (long long)(res*x); 
  
 
        y = y>>1; 
 
        if (x<=100000000)
        x = (long long)(x*x);
 
        //cout<<x<<'\n'; 
    } 
    return res; 
} 


void solve()
{
   int x,y;
   cin>>x>>y;
   int a;
   int flag=0;
   for(a=0;a<=x;a++){
    if(2*a+4*(x-a)==y){
        
        flag=1;
        break;
    }
    else{
        ;
    }
   }
   if(flag){
    cout<<"Yes"<<endl;
}
    else
        cout<<"No"<<endl;
   
    return;
}
   
int32_t main()
{
    solve();
    return 0;
}

Measured memory_bytes: 3620
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define vd(T) vector<vector<T>>
#define v(T) vector<T>
#define mod (ll)(1e9+7)
#define pp(T) pair<T,T>
#define pb push_back
#define mp make_pair
#define NN 100005
#define IO ios_base::sync_with_stdio(NULL),cin.tie(0),cout.tie(0)
#define loop(i,a,b) for(ll i=a;i<b;i++)
#define DEBUG cout<<"***********DEBUGGING***********"<<endl
#include <ext/pb_ds/assoc_container.hpp> // Common file 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace __gnu_pbds; 
typedef tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update> ordered_set; 
ll power(ll a,ll b){ if(b==0) return 1; ll s=power(a,b/2); s*=s;if(b&1) return s*a; return s;}
ll powermod(ll a,ll b,ll m){ if(b==0) return 1; ll s=power(a,b/2);s*=s; s%=m; if(b&1) return (s*a)%m; return s;}
inline int add(ll a,ll b,ll m=0){
    if(m==0) return a+b;
    return (a%m+b%m)%m;
}

inline int sub(ll a,ll b ,ll m=0){
    if(m==0) return a-b;
    return ((a%m-b%m)%m+m)%m;
}

inline int mul(ll a,ll b,ll m=0){
    if(m==0)return (a*b);
    return ((a%m)*(b%m))%m;
}

inline int div(ll a,ll b,ll m=0){
    if(m==0) return a/b;
    return ((a%m)*(powermod(a,b,m-2)%m))%m;
}

bool isopen(char c){
    return ((c=='(')||(c=='{')||(c=='['));
}

ll longest_balanced_parenthesis(string a,ll n){
    stack<char> s;
    ll start=0;
    ll ans=0,m=0;
    for(ll i=0;i<n;i++){
        if(isopen(a[i])){
            s.push(a[i]);
        }
        else{
            if(isopen(a[i])|| s.empty()){
                m=max(m,ans);
                continue;
            }
            else{
                s.pop();
                ans+=2;
                m=max(ans,m);
            }
        }
    }

    return m;

}

ll setup_k(ll *a,ll k){
  ordered_set x;
  // Now , insert and then check number of integers less than k by just using x.order_of_key(k+1)
}

bool isPossible(ll *a,ll n,ll k){
    ll b[n];
    if(k%2){
        return false;
    }
    b[0]=a[0];
    for(ll i=1;i<n;i++){
        b[i]=-b[i-1]+2*a[i-1];
    }
    if(b[n-1]+b[0]==2*a[n-1]){
        return true;
    }
    return false;
}

int main() {

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

    ll b[n];
    
    ll x=0;
    for(ll i=0;i<n;i++){
        if(i%2==0){
            x+=a[i];
        }
        else{
            x-=a[i];
        }
    }

    b[0]=x;
    cout<<b[0]<<" ";
    for(ll i=1;i<n;i++){
        b[i]=-b[i-1]+a[i-1]*2;
        cout<<b[i]<<" ";
    }

    cout<<endl;
}

Measured memory_bytes: 2944
#include <iostream>

using namespace std;

int main(int argc, char* argv[]) {
 int a, b; cin >> a >> b;

 if (a == b) cout << "a == b" << endl;
 else if (a > b) cout << "a > b" << endl;
 else cout << "a < b" << endl;
 
 return 0;
}

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

int main() {
	long n, m;
	cin >> n >> m;
	if (n * 2 > m) {
		cout << m / 2 << endl;
		return 0;
	}
	long ans = n;
	long tmp = m - n * 2;
	ans += tmp / 4;
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <vector>
#include <string>
#include <bitset>
#include <cstring>
#include <map>
#include <math.h>
#include <queue>
#include <set>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
#define rep(i,n) for (int i = 0; i < n; i++)
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define fi first
#define se second
#define pb push_back
#define mp make_pair
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const int INF = 1<<30;
const ll LINF = 1LL<<58;
const int mod = 1000000007;


int main(){
    int n;
    cin >> n;
    vector<int> H(n);
    rep(i,n){
        cin >> H[n-i-1];
    }
    bool ans = true;
    rep(i,n-1){
        if(H[i+1] > H[i])H[i+1]--;
        if(H[i+1] > H[i])ans = false;
    }
    if(ans) cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}


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

using namespace std;

#define rep(i, n) for(int i = 0; i < (int)n; ++i)
#define FOR(i, a, b) for(int i = a; i < (int)b; ++i)
#define rrep(i, n) for(int i = ((int)n - 1); i >= 0; --i)

using ll = long long;
using ld = long double;

const ll INF = 1e18;
const int Inf = 1e9;
const double EPS = 1e-9;
const ll MOD = 1e9 + 7;

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(0);
	int n, m;
	cin >> n >> m;
	priority_queue<int> pq;
	vector<vector<int> > job(m + 1);
	rep (i, n) {
	  int a, b;
	  cin >> a >> b;
	  if (a > m) continue;
	  job[m - a].push_back(b);
	}
	int res = 0;
	rrep (i, m + 1) {
	  for (int j = 0; j < job[i].size(); ++j) pq.push(job[i][j]);
	  int f = 0;
	  if (!pq.empty()) {
		f = pq.top();
		pq.pop();
	  }
	  res += f;
	}
	cout << res << endl;
    
    return 0;
}



Measured memory_bytes: 8436
#include<stdio.h>

int serch(int x) {
	int count = 0;
	int sum = x;
	do {
		count++;
	} while ((sum /= 10) != 0);
	return count;
}

int main() {
	int a, b;
	while (scanf("%d %d", &a, &b) != EOF) {
		printf("%d\n", serch(a + b));
	}
	return 0;
}


Measured memory_bytes: 600
#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(){
    int a,b,c,d,e,f;
    cin>>a>>b>>c>>d>>e>>f;
    
    double dens,mdens = 0;
    int msol=100*a,msug=0;
    for(int i=0; 100*a*i<=f; i++){
        for(int j=0; 100*a*i + 100*b*j<=f; j++){
            for(int k=0; 100*a*i + 100*b*j + c*k<=f && c*k<=(a*i+b*j)*e; k++){
                for(int l=0; 100*a*i + 100*b*j + c*k + d*l<=f && c*k+d*l<=(a*i+b*j)*e; l++){
                    dens = (double)(c*k+d*l)/(100*a*i + 100*b*j + c*k + d*l);
                    if(dens>mdens){
                        mdens = dens;
                        msol = 100*a*i + 100*b*j + c*k + d*l;
                        msug = c*k + d*l;
                    }
                }
            }
        }
    }
    
    cout << msol <<" "<< msug << endl;
    
    return 0;
}



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

#define MAX_COST 200

int main()
{
    int h,w;
    cin >> h >> w;
    vector<vector<char>> mat(h,vector<char>(w));
    vector<vector<int>> ans(h,vector<int>(w));
    for(int i = 0; i < h; ++i)
    {
        for(int j = 0; j < w; ++j)
        {
            cin >> mat[i][j];
        }
    }

    for(int i = 0; i < h; ++i)
    {
        for(int j = 0; j < w; ++j)
        {
            int u = MAX_COST;
            int l = MAX_COST;

            if(i == 0 && j == 0)
            {
                if(mat[i][j] == '#')
                {
                    ans[i][j] += 1;
                }
                continue;
            }
            if(i != 0)
            {
                u = ans[i-1][j];
                if(mat[i-1][j] == '.'
                && mat[i][j] == '#')
                {
                    u += 1;
                }
            }
            if(j != 0)
            {
                l = ans[i][j-1];
                if(mat[i][j-1] == '.'
                && mat[i][j] == '#')
                {
                    l += 1;
                }
            }
            
            ans[i][j] = min(u,l);
        }
    }
    cout << ans[h-1][w-1] << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <unordered_set>
#include <map>
#include <unordered_map>
#include <cmath>
#include <limits>
#include <climits>
#include <utility>
#include <algorithm>
#include <numeric>

using namespace std;

using ll = long long;
using ull = unsigned long long;

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

    if (X == 7 || X == 5 || X == 3) {
        cout << "YES" << endl;
    } else {
        cout << "NO" << endl;
    }

    return 0;
}


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

int main(){
	ios::sync_with_stdio(false);
	cin>>c;
	if(c>='A'&&c<='Z')
		cout<<"A";
	else
		cout<<"a";
	
	
	return 0;
}

Measured memory_bytes: 3648
#include <stdio.h>

int main() {
  int N, i;
  long long int La = 2LL, Lb = 1LL, tmp;
  
  scanf("%d", &N);
  
  if(N==0){
    printf("2\n");
    return 0;
  }else if(N==1){
 	printf("1\n");
    return 0;
  }
  
  for(i=2;i<=N;i++){
  	tmp = Lb;
    Lb += La;
    La = tmp;
  }
  printf("%lld", Lb);
  
  return 0;
}


Measured memory_bytes: 128
import std.stdio, std.algorithm, std.range, std.conv, std.string, std.math, std.container, std.typecons;
import core.stdc.stdio;
// foreach, foreach_reverse, writeln

void main() {
	int n, k;
	scanf("%d%d", &n, &k);
	int[] a = new int[n];
	foreach (i ; 0..n) scanf("%d", &a[i]);
	int s = 10^^9;
	foreach (x ; a) s = min(s, x);
	int ans = 0;
	int i = 0;
	while (i < n) {
		if (a[i] == s) {
			i++;
			continue;
		}
		ans++;
		int cnt = 0;
		int ti = min(n, i+k);
		foreach (j ; i..ti) {
			if (a[j] == s) cnt++;
		}
		if (cnt == 0 && ti == i+k) {
			i = ti-1;
		} else {
			i = ti;
		}
	}
	writeln(ans);
}

Measured memory_bytes: 2556
#include <bits/stdc++.h>
#define rep(i, n) for (ll i = 0; i < (ll)n; i++)
#define rep1(i, n) for (ll i = 1; i <= (ll)n; i++)
#define PI 3.14159265358979323846
#define vll vector<long long>
#define vvll vector<vector<long long>>
#define pll pair<long long, long long>
using namespace std;
using ll = long long;
using ld = long double;

// グローバル変数（入力）
ll d,c[26],s[365][26];

void input() { 
  cin >> d;
  rep(i,26){
    cin >> c[i];
  }
  rep(i,d){
    rep(j,26){
      cin >> s[i][j];
    }
  }
}

void solve() {
  // 満足度を下げないよう1〜26をループで開催する．c[i]=0だったらコンテストiは開催しない
  ll contest=0;
  rep(i,d){
    if (c[contest]!=0){
      cout << contest+1 << endl;
    } else {
      i--;
    }
    contest = (contest + 1) % 26;
  }
}

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


Measured memory_bytes: 3704
#include <iostream>

int main() {
    using namespace std;
    unsigned long a, b;
    cin >> a >> b;

    unsigned long dif = b - a, sum = 0;

    for(int i = 1; i < dif; i++) {
        sum += i;
    }
    cout << sum - a << endl;

    return 0;
}


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

// Macros
#define F  first
#define S  second
#define PB push_back

// Rename Datatypes
using ll  = long long;
using ld  = long double;
using pii = pair<int,int>;

// Common Functions
ll fastpow(ll a, ll ex){ ll res = 1; while(ex){ if(ex & 1) res *= a; a *= a; ex >>= 1; } return res; }
ll fastpow(ll a, ll ex, ll m){ a %= m; ll res = 1; while(ex){ if(ex & 1) res = (a*res) % m; a = (a*a) % m; ex >>= 1; } return res; }
ll modinverse(ll a, ll m){ ll m0 = m, y = 0, x = 1; while (a > 1){ ll q = a / m; a %= m; swap(a,m); x -= q*y; swap(x,y); } if(x < 0) x += m0; return x; }

// HELPERS
//  Tedious Grid Movements
vector<pii> moves_grid = { {0,1} , {0,-1} , {1,0} , {-1,0} };
inline bool move_okay(int x, int y, int n, int m) { return 0 <= x and x < n and 0 <= y and y < m; }
//  Remember:
//   * vec.assign() GOOD; vec.resize() BAD
//   * comparator uses <

// Output, Common Containers
template <typename T> ostream& operator << (ostream &os, const vector<T> &v) { for (T i : v) os << i << ' '; return os; }
template <typename T> ostream& operator << (ostream &os, const set<T> &v)    { for (T i : v) os << i << ' '; return os; }
template <typename T, typename S> ostream& operator << (ostream &os, const pair<T,S> &v) { os << "(" << v.F << "=>" << v.S << ") "; return os; }
template <typename T, typename S> ostream& operator << (ostream &os, const map<T,S> &v)  { for (auto i : v) os << i << ' '; return os; }

// Debugging
#ifdef SANYAM1101
	#define trace(args...) do{ cerr << "TRACE ON! (Line: " << __LINE__ << ")\n"; auto _stream = istringstream{string{#args}}; d_f(_stream, args); } while(0)
	void d_f(__attribute__((unused)) istringstream& _stream) {}
	template<typename Head, typename... Tails> void d_f(istringstream& _stream, Head H, Tails... T) { string _name; _stream >> _name; if(_name.back() == ',') _name.pop_back(); cerr << "\t" << _name << " <=> [" << H << "]\n"; d_f(_stream, T...); }
#else
	#define trace(args...)
#endif


// CODE STARTS HERE

void solve(){
	int n;
	cin >> n;

	vector<int> arr(n);
	for(auto& i: arr) cin >> i;

	int su = accumulate(arr.begin(), arr.end(), 0);

	if(su % 10 == 0){
		int mi = 1000;
		for(auto i: arr) if(i % 10) mi = min(mi, i);

		if(mi != 1000) su -= mi;
	}

	cout << (su % 10 == 0 ? 0 : su) << "\n";
}

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

	// Set Fixed Notation (default sucks), High Precision for Floating-Point Output
	cout << fixed << setprecision(20);

	// Multiple TCs
	int tt = 1;
	// cin >> tt;
	while(tt--) solve();
}


Measured memory_bytes: 3616
#include <iostream>
#include <string>
#include <set>
using namespace std;
int main(){
  int N;
  cin>>N;
  string prev="";
  set<string> a;
  for(int i=0;i<=N;i++){
    string v;
    getline (cin, v);
    if((prev.length()!=0 && prev.back()!=v.front())||a.count(v)>0){
      cout<<"No\n";
      return 0;
    }
    prev=v;
    a.insert(v);
  }
  cout<<"Yes\n";
  return 0;
}

Measured memory_bytes: 256
N = int(input())
A = input().split()
sum_Alice = 0
sum_Bob = 0

for i in range(N):
  A[i] = int(A[i])
A.sort()
A.reverse()

for i in range(N):
  if(i%2 == 0):
    sum_Alice += A[i]
  else:
    sum_Bob += A[i]
    
print(sum_Alice - sum_Bob)
      

Measured memory_bytes: 3060
# -*- coding: utf-8 -*-

import math

# 整数の入力
N = int(input())

sN = math.floor(math.sqrt(N))
      
for i in range(sN) :
  if N % (sN - i) == 0 :
    print( int((sN - i - 1) + ((N / (sN - i)) - 1)) )
    break

Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pb insert
#define lb lower_bound
#define ub upper_bound
#define sz(v) ((ll)v.size())
#define mp make_pair
#define all(a) (a).begin(),(a).end()
#define F first
#define S second
#define pii pair<ll,ll> 
const ll mod = 1000000007;
const ll mod1= 1000000009;
const ll base= 2323233;
const ll base1=3424424;
#define MAXN 2000004
#define trace1(x)                cerr << #x << ": " << x << "\n";
#define trace2(x, y)             cerr << #x << ": " << x << " | " << #y << ": " << y << "\n";
#define trace3(x, y, z)          cerr << #x << ": " << x << " | " << #y << ": " << y << " | " << #z << ": " << z << "\n";
#define trace4(a, b, c, d)       cerr << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " << c << " | " << #d << ": " << d << "\n";
ll v[100002];
set<ll> in[100002];
vector<ll> out[100002];
ll ha[300002];

ll expo(ll x,ll y,ll m){
  ll res=1;
  while(y){
    if(y&1) res=(res*x)%m;
    x=(x*x)%m;
    y>>=1;
  }
  return res;
}
inline ll get(ll l,ll r){
  return (ha[r]-ha[l-1]*expo(1007,r-l+1,mod)%mod+mod)%mod;
}
ll n;
ll check(ll m){
  set<ll> s;
  for(ll i=1;i<=n;i++){
     if(i+m-1<=n) {
      if(s.find(get(i,i+m-1))!=s.end()) return 1;
     }
     if(i-m+1>=0) s.insert(get(i-m+1,i));
  }
  return 0;
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin>>n;
  string s;
  cin>>s;
  ll lo=0,hi=n;
  ha[0]=0;
  for(ll i=1;i<=n;i++) ha[i]=(ha[i-1]*1007ll+s[i-1])%mod;
  while(hi-lo>1){
    ll m=(hi+lo)>>1;
    if(check(m)) lo=m;
    else hi=m;
  }
  cout<<lo;
  return 0;
} 

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

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

    if(s == "A"){
        cout << "T" << endl;
    }else if(s == "T"){
        cout << "A" << endl;
    }else if(s == "G"){
        cout << "C" << endl;
    }else{
        cout << "G" << endl;
    }
}

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

int main() {
  int A, B, C, D;
  cin >> A >> B >> C >> D ;
 
  if(A + B > C + D){
    cout << "Left" << endl;
  }
  else if(A + B == C + D){
    cout << "Balanced" << endl;
  }
  else{
    cout << "Right" << endl;
  }
}
  

Measured memory_bytes: 3596
#include <iostream>
#include <string>
#include <set>
#include <algorithm>

using namespace std;

int main(void){
	int n;
	string str,sub1,sub2;

	cin >> n;

	for(int i=0;i<n;i++){
		set<string>	val;
		cin >> str;
		for(int j=1;j<str.length();j++){
			sub2=str.substr(j);
			sub1=str.substr(0,j);

			val.insert(sub1+sub2);
			val.insert(sub2+sub1);
			reverse(sub2.begin(),sub2.end());
			val.insert(sub1+sub2);
			val.insert(sub2+sub1);
			reverse(sub1.begin(),sub1.end());
			reverse(sub2.begin(),sub2.end());
			val.insert(sub1+sub2);
			val.insert(sub2+sub1);
			reverse(sub2.begin(),sub2.end());
			val.insert(sub1+sub2);
			val.insert(sub2+sub1);
		}
		cout << val.size() << endl;
	}

	return 0;
}

Measured memory_bytes: 1288
n, k = map(int, input().split())
P = list(map(int, input().split()))
kitai = [(p+1)/2 for p in P]
kitai_cum = [kitai[0]] * (n + 1)
for i in range(n):
    kitai_cum[i+1] = kitai_cum[i] + kitai[i]
ans = 0
for i in range(n-k+1):
    ans = max(ans, kitai_cum[i+k]-kitai_cum[i])
print(ans)

Measured memory_bytes: 24804
#include<iostream>
#include<vector>
#include<stack>
using namespace std;
static const int MAX = 100000;
static const int NIL = -1;

int n;
vector<int> G[MAX];
int color[MAX];

void dfs(int r, int c) {
  stack<int> S;
  S.push(r);
  color[r] = c;
  while ( !S.empty() ) {
    int u = S.top(); S.pop();
    for (int i = 0; i < G[u].size(); i++) {
      int v = G[u][i];
      if ( color[v] == NIL ) {
        color[v] = c;
        S.push(v);
      }
    }
  }
}

void assignColor() {
  int id = 1;
  for (int i = 0; i < n; i++)  color[i] = NIL;
  for (int u = 0; u < n; u++) {
    if (color[u] == NIL) dfs(u, id++);
  }
}

int main() {
  int s, t, m, q;

    cin >> n >> m;

  for (int i = 0; i < m; i++) {
    cin >> s >> t;
    G[s].push_back(t);
    G[t].push_back(s);
  }

  assignColor();

 cin >> q;

  for (int i = 0; i < q; i++) {
    cin >> s >> t;
    if (color[s] == color[t]) {
      cout << "yes" << endl;
    } else {
      cout << "no" << endl;
    }
  }

 return 0;
}

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

signed main() {
    int N;
    string S;
    cin >> N >> S;

    vector<int> cnt(26, 1);
    for (char c : S) cnt[c - 'a']++;

    const int mod = 1e9 + 7;
    int ans = 1;
    for (int x : cnt) ans = ans * x % mod;
    cout << ans - 1 << endl;
}


Measured memory_bytes: 512
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);i++)
#define PI acos(-1)
typedef  long long ll;
ll gcd(ll x,ll y){
   if(y==0) return x;
   else return gcd(y,x%y);
}
ll lcm(ll x,ll y){
   return x/gcd(x,y)*y;
}
using namespace std;

int main(){
   ll n,t;
   cin>>n>>t;
   vector<ll> a(n,0);
   rep(i,n){
      cin>>a[i];
   }
   ll ans=0;
   ll now=0;
   rep(i,n-1){
      ll x=min(t,(a[i+1]-now));
      ans+=x;
      if(x==t) now=a[i+1];
      else now+=x;

      
   }
   ans+=t;
   cout<<ans;
return 0;
}



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

typedef long long ll;
int main()
{
    ll x;
    cin >> x;
    for (ll q = -200; q <= 200; q++)
    {
        for (ll w = -200; w <= 200; w++)
        {
            if (q * q * q * q * q - w * w * w * w * w ==x)
            {
                cout << q << " " << w;
                return 0;
            }
        }
    }
    return 0;
}


Measured memory_bytes: 3624
import java.util.*;

class Longest {
	int longc(char[] X, char[] Y, int x, int y) {
		int L[][] = new int[x + 1][y + 1];
		for (int i = 0; i <= x; i++) {
			for (int j = 0; j <= y; j++) {
				if (i == 0 || j == 0)
					L[i][j] = 0;
				else if (X[i - 1] == Y[j - 1])
					L[i][j] = L[i - 1][j - 1] + 1;
				else
					L[i][j] = max(L[i - 1][j], L[i][j - 1]);
			}
		}
		return L[x][y];

	}

	int max(int p, int q) {
		if (p > q) {
			return p;
		} else {
			return q;
		}
	}
}

public class Main {
	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		Longest longs = new Longest();
		int l = in.nextInt();
		in.nextLine();
		char[] X, Y;
		for (int i = 0; i < l; i++) {
			X = in.nextLine().trim().toCharArray();
			Y = in.nextLine().trim().toCharArray();
			System.out.println(longs.longc(X, Y, X.length, Y.length));
		}
		in.close();
	}
}


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

#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define repi(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define all(x) (x).begin(),(x).end()
#define foreach(u,v) for(auto (u) : (v))
#define pb push_back
#define mp make_pair
#define mt make_tuple

typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<ll, ll> pll;
typedef vector<ll> vl;

const int inf = 1e9;
const ll linf = 1LL<<60;
const ll mod = 1e9 + 7;
const double eps = 1e-9;

/*
*/

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

  int n = 0, pow = 1;
  while(pow <= L) pow *= 2, n++;

  vector<tuple<int, int, int>> ans;
  rep(i, n-1){
    ans.pb(mt(i+1, i+2, 0));
    ans.pb(mt(i+1, i+2, 1<<i));
  }

  int cur = 1<<(n-1);
  for(int i = n-2; i >= 0; i--){
    if(L & 1<<i){
      ans.pb(mt(i+1, n, cur));
      cur += (1<<i);
    }
  }

  printf("%d %d\n", n, (int)ans.size());
  for(auto u : ans){
    int a, b, c;
    tie(a, b, c) = u;
    printf("%d %d %d\n", a, b, c);
  }

  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, a, n) for(int i = a; i < n; i++)
#define repb(i, a, b) for(int i = a; i >= b; i--)
#define all(a) a.begin(), a.end()
#define o(a) cout << a << endl
#define int long long
#define fi first
#define se second
using namespace std;
typedef pair<int, int> P;

int w, h;
int c[4];
int s[31][31];
int dy[4] = {-1, 0, 1, 0};
int dx[4] = {0, 1, 0, -1};

struct S{
    int y, x, st, dis;
    bool operator>(const S &s) const{
        return dis > s.dis;
    }
};

bool contain(int y, int x){
    return (0 <= y && y < h && 0 <= x && x < w);
}

const int INF = 1e9;

signed main(){
    while(1){
        cin >> w >> h;
        if(w + h == 0) break;
        rep(i, 0, h) rep(j, 0, w) cin >> s[i][j];
        rep(i, 0, 4) cin >> c[i];
        int d[31][31][4];
        rep(i, 0, h) rep(j, 0, w) rep(k, 0, 4) d[i][j][k] = INF;
        queue<S> q;
        q.push((S){0, 0, 1, 0});
        d[0][0][1] = 0;
        while(!q.empty()){
            S p = q.front(); q.pop();
            // if(p.dis > d[p.y][p.x][p.dir]) continue;
            rep(i, 0, 4){
                int dir = (p.st + i) % 4;
                int ny = p.y + dy[dir];
                int nx = p.x + dx[dir];
                int ndis = p.dis;
                if(!contain(ny, nx)) continue;
                if(s[p.y][p.x] != i){
                    ndis += c[i];
                }
                if(ndis < d[ny][nx][dir]){
                    d[ny][nx][dir] = ndis;
                    q.push((S){ny, nx, dir, ndis});
                }
            }
        }
        int ans = INF;
        rep(i, 0, 4) ans = min(ans, d[h - 1][w - 1][i]);
        cout << ans << endl;
    }
}

Measured memory_bytes: 3320
#include <algorithm>
#include <bitset>
#include <cmath>
#include <functional>
#include <iomanip>
#include <iostream>
#include <limits>
#include <map>
#include <queue>
#include <set>
#include <tuple>
#include <vector>

using namespace std;

#define rep(i, n) for (int64_t i = 0; i < (int64_t)(n); i++)
#define irep(i, n) for (int64_t i = 0; i <= (int64_t)(n); i++)
#define rrep(i, n) for (int64_t i = (n)-1; i >= 0; i--)
#define rirep(i, n) for (int64_t i = n; i >= 0; i--)

int main() {
  int N, A, B;
  cin >> N >> A >> B;

  cout << ((B - A) % 2 == 0 ? "Alice" : "Borys") << endl;
  return 0;
}

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

using namespace std;

int main(int argc, const char *argv[]) {
  int n, k;
  cin >> n >> k;
  vector<int> vh(n);
  for (auto &h : vh) {
    cin >> h;
  }

  int ans = 0;
  for (auto &h : vh) {
    if (h >= k) {
      ans++;
    }
  }

  cout << ans << '\n';
  return 0;
}

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

int main(){
    double w,h,x,y;
    cin>>w>>h>>x>>y;
    double ans=w*h/2;
    int a=0;
    if(w/2==x&&h/2==y)a=1;
    cout<<ans<<" "<<a<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <cmath>
#include <string>
#include <vector>
#include <iostream>
#include <algorithm>
#include <functional>
using namespace std;
int main() {
	cin.tie(0);
	ios_base::sync_with_stdio(false);
	int N;
	cin >> N;
	function<void(int, string)> calc = [&](int mx, string s) {
		if (s.size() == N) {
			cout << s << '\n';
			return;
		}
		for (int i = 0; i <= mx; ++i) {
			calc(max(mx, i + 1), s + char(i + 'a'));
		}
	};
	calc(0, string());
	return 0;
}

Measured memory_bytes: 1536
Alphabet=["a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"]
al=input()
for i in  Alphabet :
	if i==al:
		aa=Alphabet.index(al)+1
		print(Alphabet[aa])
          
 

Measured memory_bytes: 3060
s = input()
n = len(s)
ans1 = 0
for i in range(n):
    if i%2 == 0:
        if s[i] != "0":
            ans1 += 1
    else:
        if s[i] != "1":
            ans1 += 1
ans2 = 0
for i in range(n):
    if i%2 == 0:
        if s[i] == "0":
            ans2 += 1
    else:
        if s[i] == "1":
            ans2 += 1

print(min(ans1,ans2))

Measured memory_bytes: 40688
#include <stdio.h>

int main(){
  
  int i, j, k,n,m,l;
  int a[100][100], b[100][100];
  long c[100][100];
  
  scanf ("%d%d%d",&n,&m,&l);
    
  for (i = 0;i < n;i++){
    for (j = 0;j < m;j++){
      scanf ("%d",&a[i][j]);	
    }
  }
  
  for (i = 0;i < m;i++){
    for (j = 0;j < l;j++){
      scanf ("%d",&b[i][j]);
    }
  }
  
  
  for(i = 0;i < n;i++){
    for(j = 0;j < l;j++){
      
      c[i][j] = 0;
      
      for (k = 0;k < m;k++){
	c[i][j] += a[i][k] * b[k][j];
      }
    }
  }
  
  for(i = 0;i < n;i++){
    for(j = 0;j < l-1;j++){
      printf("%ld ",c[i][j]);
    }
    printf ("%ld\n",c[i][j]);
  }
  
  return 0;
}



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

using namespace std;



// Complete the cipher function below.


int main()
{
    
    long long int h,w,sum=0,n1,n2;
    cin>>h>>w;
    if(h==1 || w==1)
    sum =1;
    else if(h%2!=0&&w%2!=0)
    {
        n1=h/2;
        n2=n1+1;
        sum=(n1*(w/2))+(n2*((w/2)+1));
    }
    else if(h%2==0)
    {
        sum=(h/2)*w;
        
    }
    else
    sum=(w/2)*h;
    cout<<sum;
    




   
    return 0;
}



Measured memory_bytes: 256
#include <iostream>
#include <boost/range/irange.hpp>
#include <boost/range/numeric.hpp>
#include <algorithm>
#include <vector>
using namespace std;


int main() {
    int n;
    cin >> n;
    vector<int> vec(n);
    for (int i : boost::irange(0, n, 1)) {
        cin >> vec.at(i);
    } 
    sort(vec.begin(), vec.end());
    int sum = boost::accumulate(vec, 0);
    cout << sum - (vec.at(vec.size()-1) / 2) << endl;
    return 0;

}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vb=vector<bool>;
using vvb=vector<vb>;
using vd=vector<double>;
using vvd=vector<vd>;
using vi=vector<int>;
using vvi=vector<vi>;
using vl=vector<ll>;
using vvl=vector<vl>;
using pll=pair<ll,ll>;
using tll=tuple<ll,ll>;
using tlll=tuple<ll,ll,ll>;
using vs=vector<string>;
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define rep(i,n) range(i,0,n)
#define rrep(i,n) for(ll i=(n)-1;i>=0;i--)
#define range(i,a,n) for(ll i=(a);i<(n);i++)
#define LINF ((ll)1ll<<60)
#define INF ((int)1<<30)
#define EPS (1e-9)
#define MOD (1000000007ll)
#define fcout(a) cout<<setprecision(a)<<fixed
#define fs first
#define sc second
#define PI (3.1415926535897932384)

int dx[]={1,0,-1,0,1,-1,-1,1},dy[]={0,1,0,-1,1,1,-1,-1};
template<class T>bool chmax(T&a,T b){if(a<b){a=b; return true;}return false;}
template<class T>bool chmin(T&a,T b){if(a>b){a=b; return true;}return false;}
template<class S>S sum(vector<S>&a){return accumulate(all(a),S());}
template<class S>S max(vector<S>&a){return *max_element(all(a));}
template<class S>S min(vector<S>&a){return *min_element(all(a));}
ll max(int a,ll b){return max((ll)a,b);} ll max(ll a,int b){return max(a,(ll)b);}
int sgn(const double&r){return (r>EPS)-(r<-EPS);} // a>0  : sgn(a)>0
int sgn(const double&a,const double&b){return sgn(a-b);} // b<=c : sgn(b,c)<=0

template<class T>void puta(T&&t){cout<<t<<"\n";}
template<class H,class...T>void puta(H&&h,T&&...t){cout<<h<<' ';puta(t...);}
template<class S,class T>void tf(bool b,S t,T f){if(b)puta(t);else puta(f);}
void YN(bool b){tf(b,"YES","NO");}
void Yn(bool b){tf(b,"Yes","No");}
void yn(bool b){tf(b,"yes","no");}
template<class S,class T>ostream&operator<<(ostream&os,pair<S,T>p){os<<"["<<p.first<<", "<<p.second<<"]";return os;};
template<class S>auto&operator<<(ostream&os,vector<S>t){bool a=1;for(auto s:t){os<<(a?"":" ")<<s;a=0;}return os;}
template<class S>auto&operator>>(istream&is,vector<S>&t){for(S&a:t)cin>>a;return is;}

/*他のライブラリを入れる場所*/
constexpr ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
constexpr ll lcm(ll a,ll b){return a/gcd(a,b)*b;}

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll n,m;
    cin>>n>>m;
    vl a(n);cin>>a;
    ll c=0;
    rep(i,n)c+=a[i]/2%2;
    if(c%n){puta(0);return 0;}
    ll ans=1, g=a[0];
    rep(i,n){
        ans=lcm(ans, a[i]/2);
        if(ans>m){puta(0);return 0;}
    }
    rep(i,n)if(ans/(a[i]/2)%2==0){puta(0);return 0;}
    puta(m/ans-m/(ans*2));
    return 0;
}


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

// エイリアス
using  ll = long signed long;
using ull = long unsigned long;
using  ld = long double;
using   P = pair<int, int>;
using llP = pair<ll, ll>;
using DoP = pair<double, double>;

// 汎用マクロ
#define ALL(a) (a).begin(), (a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define rep(i, n) for (int i = 0; i < n; ++i)
#define FOREACH(i,q) for (auto &i : q)
#define UNIQUE(v) do { sort((v).begin(), (v).end()); (v).erase(unique((v).begin(), (v).end()), (v).end()); } while (false)
#define SZ(x) ((int)(x).size())
template <class T>inline bool chmin(T &a, const T b) {if (a > b) { a = b; return true;} return false;}
template <class T>inline bool chmax(T &a, const T b) {if (a < b) { a = b; return true;} return false;}
template <class T>inline void line_out(const vector<T> vec) {int n = SZ(vec); rep(i, n) { cout << vec[i]; if(i < n-1) cout << " ";}cout << endl;}
const int di[] = {0, 1, 0, -1, 1, 1, -1, -1};
const int dj[] = {1, 0, -1, 0, 1, -1, 1, -1};
const int INF = 1 << 28;
const ll INF64 = 1ll << 62;
const int mod = 1000000007;
//const int mod = 998244353;
struct mint
{
  ll x; // typedef long long ll;
  mint(ll x = 0) : x((x % mod + mod) % mod) {}
  mint operator-() const { return mint(-x); }
  mint &operator+=(const mint a)
  {
    if ((x += a.x) >= mod)
      x -= mod;
    return *this;
  }
  mint &operator-=(const mint a)
  {
    if ((x += mod - a.x) >= mod)
      x -= mod;
    return *this;
  }
  mint &operator*=(const mint a)
  {
    (x *= a.x) %= mod;
    return *this;
  }
  mint operator+(const mint a) const
  {
    mint res(*this);
    return res += a;
  }
  mint operator-(const mint a) const
  {
    mint res(*this);
    return res -= a;
  }
  mint &operator++()
  {
    if ((x += 1) >= mod)
      x -= mod;
    return *this;
  }
  mint &operator--()
  {
    if ((x += mod - 1) >= mod)
      x -= mod;
    return *this;
  }
  mint operator*(const mint a) const
  {
    mint res(*this);
    return res *= a;
  }
  mint pow(ll t) const
  {
    if (!t)
      return 1;
    mint a = pow(t >> 1);
    a *= a;
    if (t & 1)
      a *= *this;
    return a;
  }

  // for prime mod
  mint inv() const
  {
    return pow(mod - 2);
  }
  mint &operator/=(const mint a)
  {
    return (*this) *= a.inv();
  }
  mint operator/(const mint a) const
  {
    mint res(*this);
    return res /= a;
  }
};

int main()
{
  int n; cin >> n;
  vector<set<int>> red(2*n);
  rep(i, n) {
    int a, b; cin >> a >> b;
    red[a].insert(b);
  }
  vector<P> blue(n);
  rep(i, n) cin >> blue[i].first >> blue[i].second;
  sort(ALL(blue));
  int ans = 0;
  for(auto x : blue) {
    int c = x.first, d = x.second;
    int max_b = -INF;
    P use;
    for(int a = 0; a < c; ++a) {
      for(auto b : red[a]) {
        if(b < d && max_b < b) {
          max_b = b;
          use = P(a, b);
        }
      }
    }
    if(max_b != -INF) {
      ++ans;
      red[use.first].erase(use.second);
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 3612
S = list(input())
tmp = "NWSE"
n = False
w = False
s = False
e = False
for i in range(len(S)):
    if S[i] == "W":
        w = True
    elif S[i] == "N":
        n = True
    elif S[i] == "E":
        e = True
    else:
        s = True

if w and e:
    if n:
        if s:
            print("Yes")
        else:
            print("No")
    elif s:
        print("No")
    else:
        print("Yes")
elif w or e:
    print("No")
else:
    if n and s:
        print("Yes")
    elif n or s:
        print("No")
    else:
        print("Yes")


Measured memory_bytes: 3188
#include <bits/stdc++.h>
 
using namespace std;
 
#define SWAP(x,y,z) {if ( y > z ) swap(y,z); if ( x > y ) swap(x,y); if (y > z) swap(y,z);}
typedef long long ll;
typedef unsigned long long ull;
 
double const eps = 1e-6;
double const pi = 3.1415926535;
ll const mod = 1e9+7;
 
ll a[100005];
 
int main()
{
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
 
    int n;
    ll k;
    cin >> n >> k;
    for ( int i = 1; i <= n; i++ )
    {
        int x,y;
        cin >> x >> y;
        a[x] += y;
    }
 
    for ( int i = 1; i <= 100000; i++ )
    {
        if ( k-a[i] <= 0 )
        {
            cout << i << '\n';
            break;
        }
         k -= a[i];
    }
 
 
    return 0;
}

Measured memory_bytes: 1024