akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#include <regex>
#ifdef _DEBUG
#include "debug.h"
#endif
#define int ll
#define FOR(i, s, e) for (int i = int(s); i < int(e); ++i)
#define REP(i, e) FOR(i, 0, e)
#define all(v) (v).begin(),(v).end()
#define mkpr make_pair
#define mktp make_tuple
#define tv(tp, i) get<(i)>(tp)
#define CLEAR(obj) obj = decltype(obj)()
#define var auto
#define OUT(type) type &
#define IN(type) const type &
#define self (*this)
#define in :
#define True true
#define False false
using namespace std; using int32 = int32_t; using str = string; using cstr = const str;
using ll = long long; using ull = unsigned long long; using cint = const int; using cll = const ll;
using vi = vector<int>; using vvi = vector<vi>; using vl = vector<ll>; using vvl = vector<vl>;
using vb = vector<bool>; using vvb = vector<vb>; using vd = vector<double>; using vvd = vector<vd>;
using vc = vector<char>; using vvc = vector<vc>; using vs = vector<string>;
using pii = pair<int, int>; using pll = pair<ll, ll>; using pdd = pair<double, double>; using psl = pair<string, ll>;
using tiii = tuple<int, int, int>; using tlll = tuple<ll, ll, ll>;
static const int MGN = 10; static const int ARYSZ_MAX = (int)1e7;
static const ll LINF = LLONG_MAX/2;
#ifdef int
static const int INF = LINF;
#else
static const int INF = INT_MAX/2;
#endif
static double EPS = 1e-9;
#define FASTCIN() cin.tie(0);ios::sync_with_stdio(false);
#ifdef IMPORT_SAMPLE
#define DEBUG_IMPORT(file) vs args(argv, argv+argc);str sample = make_sample(args, file);ifstream ifs(sample); cin.rdbuf(ifs.rdbuf());
#else
#define DEBUG_IMPORT(file)
#endif
static inline bool DBLEQ(double a, double b) {return abs(a - b) < EPS;}
static inline void EPR(str msg) {cerr << msg << endl;}
static inline void AST(bool exp, str msg) {if(!exp){EPR(msg);} assert(exp);}
static inline void TAST(bool exp, str msg) {if(!exp){EPR(msg);} while(!exp){}}


int bs_cond_opcl(IN(vl) Ar, int l, int r, int A, int B){
    cint N = Ar.size();
    var _is_condition = [&](IN(vl) Ar, int m){
        vi h = Ar;

        REP(i,N)
            h[i] -= B*m;

        int cnt = 0;
        REP(i,N)
            if (h[i] > 0)
                cnt += (h[i] + A-B-1)/ (A-B);

        return cnt <= m ? True : False;
    };
    while (l+1 < r) {
        int m = (l+r) / 2;
        if (_is_condition(Ar, m) == True)
            r = m;
        else
            l = m;
    }
    return r;
}


int32 main(int32 argc, char* argv[]) {
    FASTCIN();
    DEBUG_IMPORT("sample-1");


    int N,A,B; cin>>N>>A>>B;
    vi H(N); REP(i,N) cin>>H[i];

    sort(all(H));

    int ans = bs_cond_opcl(H, 0, (int)1e9, A, B);

    cout << ans << endl;


    return 0;
}


Measured memory_bytes: 1792
from collections import Counter
from collections import defaultdict
import math
import random
import heapq as hq
from math import sqrt
import sys
from functools import reduce

sys.setrecursionlimit(10000000)
def input():
    return sys.stdin.readline().strip()


def iinput():
    return int(input())


def tinput():
    return input().split()


def rinput():
    return map(int, tinput())


def rlinput():
    return list(rinput())


mod = int(1e9)+7


def factors(n):
    return set(reduce(list.__add__,
                      ([i, n//i] for i in range(1, int(n**0.5) + 1) if n % i == 0)))


# ----------------------------------------------------

def dfs(i):
    visited[i] = True
    for node in g[i]:
        if not visited[node]:
            dfs(node)
        dp[i] = max(dp[i], 1+ dp[node])



if __name__ == "__main__":
    n, m = rinput()
    g = defaultdict(list)
    for i in range(m):
        x, y = rinput()
        g[x].append(y)
    dp = [0]*(n+1)
    visited = [False]*(n+1)
    for i in range(1, n+1):
        if not visited[i]:
            dfs(i)
            # print('-=============================')
    # print(dp)
    print(max(dp))


# 5 3
# 2 3
# 2 4
# 5 2
# 5 1
# 1 4
# 4 3
# 1 3

Measured memory_bytes: 123012
#include <cstdio>
#define repi(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,a) repi(i,0,a)
#define all(a) (a).begin(), (a).end()

int N, K;

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

  int ans = 0;
  while( N > 0 )
  {
    ++ans;
    N /= K;
  }

  printf( "%d\n", ans );

  return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include<algorithm>
using namespace std;
#define ll long long int
int main()
{
    ll n,k;
    cin>>n>>k;
    ll a[n];
    ll i;
    for(i=0;i<n;i++){
        cin>>a[i];
    }
    sort(a,a+n);
    ll sum=0;
    for(i=0;i<k;i++){
        sum = sum+a[i];
    }
    cout<<sum;
}


Measured memory_bytes: 3636
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;
#define int         long long
#define mod         1000000007
#define FAST        ios::sync_with_stdio(0),cin.tie(0),cout.tie(0);
#define f(i,n)      for(int i=0;i<n;i++)
#define fp(i,k,n)   for(int i=k;i<=n;i++)
#define fr(i,k,n)   for(int i=k;i>=n;i--)
#define pb          push_back
#define pii         pair<int,int>
#define vi          vector<int>
#define vii         vector<pii>
#define dbg(x)      cout << (#x) << " is " << (x) << '\n' 
#define F           first
#define S           second
#define sz(x)       (int)(x).size()
#define lb          lower_bound
#define ub          upper_bound
#define mems(x)     memset(x,0,sizeof(x))
#define all(a)      a.begin(),a.end()
typedef tree<int,null_type,less_equal<int>,rb_tree_tag,tree_order_statistics_node_update>ordered_set;

/*---------------------------------------------------------------------------------------------------*/

void solve()
{
  int n;
  cin >> n;
  vi v1,v2,v3,v4;
  f(i,n)
  {
	  int x,y;
	  cin >> x >> y;
	  v1.pb(x+y);
	  v2.pb(x-y);
	  v3.pb(y-x);
	  v4.pb(-x-y);
  }
  sort(all(v1));
  sort(all(v2));
  int ans=max(v1[sz(v1)-1]-v1[0],v2[sz(v2)-1]-v2[0]);
  sort(all(v3));
  sort(all(v4));
  int ans2=max(v3[n-1]-v3[0],v4[n-1]-v4[0]);
  ans=max(ans,ans2);
  cout << ans << '\n';
  return;
} 

signed main()
{
  // freopen("input.txt","r",stdin);
  // freopen("output.txt","w",stdout);
  FAST
  int T=1;
  // cin >> T;
  while(T--)
  {
    solve();
  }
  return 0;
}


Measured memory_bytes: 9728
import java.util.Scanner;

    class Main {
    	public static void main(String[] args){
    		Scanner sc = new Scanner(System.in);
    		int r = sc.nextInt();
    		int g = sc.nextInt();
    		int b = sc.nextInt();
    		int n = r * 100 + g * 10 + b;
    		if(n%4==0){
    			System.out.println("YES");
    		} else {
    			System.out.println("NO");
    		}
    	}
    }

Measured memory_bytes: 20820
#include<bits/stdc++.h>
#define allof(a)        a.begin(),a.end()
#define fi              first
#define se              second
#define pb              push_back
#define F(i,a,b)        for(int i=a;i<=b;i++)
#define D(i,a,b)        for(int i=a;i>=b;i--)
#define inf             0x3f3f3f3f3f3f3f3f
#define mn              3001
#define task            "holiday"
using namespace std;
const int mod=          1e9+7;
typedef pair<int,int>   ii;
typedef pair<int,ii>    ip;

template<typename _t>
bool ckmax(_t& target,_t value)
    {return value>target ? target=value,1 : 0;}

template<typename _t>
bool ckmin(_t& target,_t value)
    {return value<target ? target=value,1 : 0;}

int n,m;
int a[mn];
int t[mn];
int r[mn];
int dp[mn][mn];

int32_t main()
{
    ios::sync_with_stdio(0);
    #ifdef _TPR_
        freopen("t.inp","r",stdin);
        freopen("t.out","w",stdout);
    #endif
    cin>>n>>m;
    string s;cin>>s;
    F(i,1,n)a[i]=s[i-1]-'0';
    F(i,1,n)t[i]=t[i-1]+a[i];
    F(i,1,m)
    {
        int u,v;cin>>u>>v;
        ckmax(r[u],v);
    }
    dp[0][0]=1;
    F(i,1,n)
    {
        ckmax(r[i],max(i,r[i-1]));
        if(t[r[i]]<r[i]-i+1)dp[i][0]=dp[i-1][0];
        F(j,1,i)
        {
            if(t[r[i]]-j<r[i]-i+1)dp[i][j]+=dp[i-1][j];
            if(t[r[i]]-j>=0)dp[i][j]+=dp[i-1][j-1];
            dp[i][j]%=mod;
        }
    }
    int res=0;
    F(j,0,n)res=(res+dp[n][j])%mod;
    cout<<res;
}

Measured memory_bytes: 31176
#include <cstdio>
#include <vector>
#include <algorithm>
using namespace std;

const int mod = 1e9 + 7;
typedef long long i64;

int main()
{
	int n, k;
	vector<vector<int>> comb;

	scanf("%d%d", &n, &k);

	int cn = n * 2 + 10;

	comb.resize(cn);
	for(auto& c : comb) {
		c.resize(cn, 0);
	}
	for(int i = 0; i < cn; i++) {
		comb[i][0] = 1;
	}
	for(int i = 1; i < cn; i++) {
		for(int j = 1; j < cn; j++) {
			comb[i][j] = (comb[i - 1][j - 1] + comb[i - 1][j]) % mod;
		}
	}

	for(int x = 1; x <= k; x++) {

		int blue = k - x;
		int red = (n - k) - (x - 1);

		if(red < 0) {
			printf("0\n");
			continue;
		}

		int ans = (i64)comb[blue + x - 1][x - 1] * comb[red + x][x] % mod;
		printf("%d\n", ans);
	}


	return 0;
}


Measured memory_bytes: 63232
N = int(input())
num = 1
flag = 0
c=[int(i) for i in input().split()]
for i in c:
    if i == 0:
        flag = 1
        print("0")
if flag == 0:
    for i in c:
        num *= i
        if num > 1000000000000000000:
            print("-1")
            flag =1
            break
if flag == 0:
    
    print(num)

Measured memory_bytes: 21720
#include <bits/stdc++.h>
#define FOR(i, x, y) for (int i = x; i < y; i++)
typedef long long ll;
using namespace std;

int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    string s;
    cin >> s;
    cout << (s == "ABC" ? "ARC" : "ABC");
    return 0;
}

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

int main(){
	int n;
	int total=0,before_total=0;
	cin>>n;

	while(total<n){
		total+=1000;
	}

	cout<<total-n<<endl;

	return 0;
}

Measured memory_bytes: 3608
#include <iostream>
#include <string>
#include <vector>
using namespace std;
const int INF = 2 * 1e9;

int main(){
    int n, k; cin >> n >> k;
    vector<int> h(n);
    for(auto& v:h){
        cin >> v;
    }
    vector<int> dp(n, INF);
    dp[0] = 0;
    for(int i=1; i<n; i++){
        for(int j=0; j<min(k,i); j++){
            dp[i] = min(dp[i], dp[i-j-1]+abs(h[i]-h[i-j-1]));
        }
    }
    cout << dp[n-1] << "\n";
    return 0;
}

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

int main(){
    int N,Q;
    cin >> N >> Q;
    string s;
    cin >> s;
    int lr[Q][2];
    for(int i =0; i < Q; i++){
        cin >> lr[i][0] >> lr[i][1];
    }
    vector<int> v(N+10);
    for(int i = 2; i < N+1; i++){
        if(s.at(i-1) == 'C' && s.at(i - 2)=='A'){
            v[i] = v[i-1] + 1;
        }
        else{
            v[i] = v[i-1];
        }
    }
    for(int i =0; i < Q; i++){
        int l,r;
        l = lr[i][0];
        r = lr[i][1];
        if(v[l] == v[l-1]){
            cout << v[r] - v[l -1] << endl;
        }
        else{
            cout << v[r] - v[l -1] -1 << endl;
        }
    }
}

Measured memory_bytes: 2176
#include<stdio.h>
#include<stdlib.h>
#include<math.h>
#include<string.h>
#include <time.h>
typedef long long ll;
typedef long double ld;
#define INF (1LL<<60)
#define MOD1 1000000007
/*swap 交換*/
void swap(ll *a, ll *b){ll c;c=*b;*b=*a;*a=c;}
/*2つのうち大きい数を返す*/
ll max2(ll a,ll b){return a>=b?a:b;}
/*2つのうち小さい数を返す*/
ll min2(ll a,ll b){return a>=b?b:a;}
/*絶対値*/
ll ABS(ll a){return a>=0?a:(-a);}
typedef struct{
    ll aa;
    ll bb;
}frequent;
// 小大
int compare(const void *a, const void *b){
    return *(ll *)a>*(ll *)b?1:*(ll *)a<*(ll *)b?-1:0;}
/*GCD*/
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
/*LCM*/
ll lcm(ll a,ll b){return a/gcd(a,b)*b;}

int main(void){
    ll n,m,i;
    scanf("%lld%lld",&n,&m);
    char s[n+1],t[m+1];
    scanf("%s%s",s,t);
    ll p=gcd(n,m)-1;

    for(i=0;i<=p;i++){
        ll a=lcm(n,m)/m*i, b=lcm(n,m)/n*i;
        if(s[a]!=t[b]){
            printf("-1\n");
            return 0;
        }
    }
    printf("%lld\n",lcm(n,m));
    return 0;
}

Measured memory_bytes: 384
#include <cstdio>
int main() {
    double xA,yA,xB,yB,xC,yC,xD,yD;
    while (scanf("%lf%lf%lf%lf%lf%lf%lf%lf",&xA,&yA,&xB,&yB,&xC,&yC,&xD,&yD)!=EOF) {
        if ((xA-xB)*(xC-xD)+(yA-yB)*(yC-yD)==0) {
            puts("YES");
        } else {
            puts("NO");
        }
    }
}

Measured memory_bytes: 0
import sys
n = int(input())
an = list(map(int, input().split()))
condition = an.count(0)
if condition > 0:
    print(0)
    sys.exit()
a0 = an[0]
for i in range(len(an) - 1):
    a0 = a0 * an[i+1]
    if a0 > 10 ** 18:
        a0 = -1
        break
print(a0)

Measured memory_bytes: 21592
import java.util.Scanner;
class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    while(sc.hasNext()) {
      int n = sc.nextInt();
      int counter = 0;
      for (int i = 0; i < 10; i++) {
        for (int j = 0; j < 10; j++) {
          for (int k = 0; k < 10; k++) {
            for (int l = 0; l < 10; l++) {
              if(i+j+k+l == n) {
                counter++;
              }
            }
          }
        }
      }
      System.out.println(counter);
    }
  }
}

Measured memory_bytes: 12000
t1, t2 = [ int(v) for v in input().split() ]
a1, a2 = [ int(v) for v in input().split() ]
b1, b2 = [ int(v) for v in input().split() ]

if a1*t1 + a2*t2 == b1*t1 + b2*t2:
    ans = -1
else:
    if a1*t1 + a2*t2 < b1*t1 + b2*t2:
        a1, b1 = b1, a1
        a2, b2 = b2, a2

    mind = a1*t1 - b1*t1
    if mind > 0:
        ans = 0
    else:
        lastd = a1*t1 + a2*t2 - b1*t1 - b2*t2
        mind = abs(mind)
        if mind % lastd == 0:
            ans = 2 * (mind // lastd) 
        else:
            ans = 2 * (mind // lastd) + 1
    
print(ans if ans != -1 else "infinity")

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

vector <pair<double, double>> arr;
double f_ans = 0;
double dist(int l, int r);

int main()
{
    int n;
    cin>>n;
    double x,y;
    double fact = 1;
    for(int i=0; i<n; i++)
    {
        fact *= (i+1);
        cin>>x>>y;
        arr.push_back(make_pair(x,y));
    }
    
    string str = "";
    for(int i=1; i<=n; i++)
        str += ('0'+ i);
      
    do
    {
        double ans = 0;
        for(int i=1; i<n; i++)
        {
            int l = str[i-1] - '0';
            int r = str[i] - '0';
            
            ans += dist(l-1, r-1);
        }
        
        f_ans += ans;
    }while(next_permutation(str.begin(), str.end()));
    
    
    printf("%.8f", f_ans/fact);
    return 0;
}

double dist(int l, int r)
{
    double x1 = arr[l].first, x2 = arr[r].first;
    double y1 = arr[l].second, y2 = arr[r].second;

    double x = ((x2-x1)*(x2-x1));
    double y = ((y2-y1)*(y2-y1));
    return sqrt(x+y);
}

        
    
    

Measured memory_bytes: 256
import java.io.*;
import java.util.*;

class Main
{
    public static void main(String[] args)
    {
        Scanner sc = new Scanner(System.in);
        
        int n = sc.nextInt();
        int m = sc.nextInt();
        
        int[][] A = new int[n][m];
        int[] B = new int[m];
        
        for (int i = 0; i < n ; i++) {
            for (int j = 0; j < m; j++) {
                A[i][j] = sc.nextInt();
            }
        }
        
        for (int i = 0; i < m; i++) {
            B[i] = sc.nextInt();
        }
        
        int[] result = new int[n];
        
        
        for (int i = 0; i < n; i++) {
            for (int j = 0; j < m; j++) {
                result[i] += A[i][j] * B[j];
            }
        }
        
        
        for (int i = 0; i < n; i++) {
            System.out.println(result[i]);
        }
    }
}

Measured memory_bytes: 41160
N = int(input())
A = [int(x) for x in input().split()]
 
x=0
for i in A:

  if i%2==0:
    if not i%3==0 and not i%5==0:
      print("DENIED")
      x=1
      break
    else:
      continue
    
  else:
   	continue
  break
if x ==0:
	print("APPROVED")

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

#define INF 12345678900
#define ll long long
#define MOD 1000000007

int S;
ll dp[2020][2020];
ll SS[2020];

int main()
{
	ios::sync_with_stdio(0); cin.tie(0);
	cin >> S;
	dp[0][0] = 1;
	for(int i=1; i<=S/3; i++)
	{
		SS[0] = dp[i-1][0];
		for(int j=1; j<=S; j++)
		{
			SS[j] = SS[j-1] + dp[i-1][j];
			SS[j] %= MOD;
		}
		for(int j=0; j<=S; j++)
		{
			if (j >= 3)
				dp[i][j] = SS[j-3];
			else
				dp[i][j] = 0;
		}
	}
	ll res = 0;
	for(int i=1; i<=S/3; i++)
		res += dp[i][S];
	res %= MOD;
	cout << res;
	return 0;
}

Measured memory_bytes: 14060
N=int(input())
L=list(map(int,input().split()))
ans = 0
for i in range(len(L)):
    for j in range(len(L)):
        for k in range(len(L)):
            if L[i] < L[j] and L[j] < L[k]:
                if L[i]+L[j] > L[k] and L[j]+L[k] > L[i] and L[i]+L[k] > L[j]:
                    ans += 1
print(ans)


Measured memory_bytes: 73496
#include<bits/stdc++.h>
using namespace std;
 int main()
{
   long long int a,b,n;
   cin>>a>>b>>n;
   long long int mn=min(n,b-1);
   long long int ans=(double)floor((a*mn)/b)-a*floor((double)mn/b);
   cout<<ans<<endl;
}


Measured memory_bytes: 3620
#include <iostream>
#include <sstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <climits>
#include <cfloat>
using namespace std;

int main()
{
    int dy[] = {-1, -1, 0, 1, 1, 0};
    int dx[] = {0, 1, 1, 0, -1, -1};

    int n;
    cin >> n;
    cin.ignore();

    while(--n >= 0){
        string s1, s2;
        getline(cin, s1);
        getline(cin, s2);
        if(s1.size() != s2.size()){
            cout << "false" << endl;
            getline(cin, s1);
            continue;
        }

        int m = s1.size();
        vector<pair<int, int> > egg1(m+1, make_pair(0, 0));
        for(int i=0; i<m; ++i){
            egg1[i+1].first = egg1[i].first + dy[s1[i]-'a'];
            egg1[i+1].second = egg1[i].second + dx[s1[i]-'a'];
        }
        sort(egg1.begin(), egg1.end());
        for(int i=m; i>=0; --i){
            egg1[i].first -= egg1[0].first;
            egg1[i].second -= egg1[0].second;
        }

        bool ret = false;
        for(int i=0; i<6; ++i){
            vector<pair<int, int> > egg2(m+1, make_pair(0, 0));
            for(int j=0; j<m; ++j){
                egg2[j+1].first = egg2[j].first + dy[s2[j]-'a'];
                egg2[j+1].second = egg2[j].second + dx[s2[j]-'a'];
            }
            sort(egg2.begin(), egg2.end());
            for(int j=m; j>=0; --j){
                egg2[j].first -= egg2[0].first;
                egg2[j].second -= egg2[0].second;
            }
            if(egg1 == egg2){
                ret = true;
                break;
            }
            rotate(dy, dy+1, dy+6);
            rotate(dx, dx+1, dx+6);
        }

        if(ret)
            cout << "true" << endl;
        else
            cout << "false" << endl;
        getline(cin, s1);
    }

    return 0;
}

Measured memory_bytes: 0
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define pi 3.141592653589793238
#define fast ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define pb push_back
#define bg begin()
#define end end()
#define sz size()
#define vi vector<int>
#define vl vector<long long int>
int main(){
	fast;
	ll A;
	cin>>A;
	string ch={'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'};
    string ans="";
    while(A){
        if(A%26){
        ans+=ch[abs(A%26 - 1)];
        A=A/26;}
        else
        {
            ans+="z";
            A/=26;
            A--;
        }
    }
    int n = ans.length();
    for (int i = 0; i < n / 2; i++) 
        swap(ans[i], ans[n - i - 1]);
    cout<<ans;
	return 0;
}



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

int main()
{
	int S, W;
	string str;
	cin >> S >> W;
	if (S <= W)
		cout << "unsafe";
	else
		cout << "safe";
	return 0;
}

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

int main() {
    int d[10];
    bool ans = true;

    for (int i = 0; i < 6; ++i) cin >> d[i];

    int num[10] = {0}; 

    for (int i = 0; i < 6; ++i) {
        num[d[i]]++;      }

    int res = 0;
    for (int i = 1; i < 5; ++i) {
        if (num[i]==0 || num[i]>2) { 
            ans = false;
        }
    }
    if(ans==true)
        cout << "YES" << endl;
    else
        cout << "NO" << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define endl '\n'

using namespace std;

string s, t;

int ans;

int main() {
    ios_base::sync_with_stdio(0);

    cin >> s >> t;

    for(int i=0; i < s.size(); ++i) {
        ans += (s[i] != t[i]);
    }
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 3776
#include <bits/stdc++.h>
using namespace std;
const int maxn = 2e5 + 7;
int head[maxn], cnt = 1, inq[maxn], n, m, d[maxn], flag;
struct Node {int v, nxt, w;} G[maxn << 1];
void ins(int u, int v, int w) {G[cnt] = (Node) {v, head[u], w}; head[u] = cnt++;}
void spfa(int x, int col) {
	if(flag) return;
	inq[x] = col;
	for (int i = head[x]; i; i = G[i].nxt) {
		int v = G[i].v;
		if(d[v] > d[x] + G[i].w) {
			d[v] = d[x] + G[i].w;
			if(!inq[v]) spfa(v, col);
			if(flag) return;
			else if(inq[v] == col) {flag = 1; return;}
		}
	}
	inq[x] = 0;
}
int main() {
	scanf("%d%d", &n, &m);
	for (int i = 1; i <= m; ++i) {
		int x, y, z; scanf("%d%d%d", &x, &y, &z); ins(y, x, -z); ins(x, y, z);
	}
	memset(d, 0, sizeof d); 
	for (int i = 1; i <= n; ++i) {
	    d[i] = 0;
		spfa(i, i);
		if(flag) {puts("No"); break;}
	}
	if(!flag) puts("Yes");
	return 0;
}

Measured memory_bytes: 11392
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
#define pb push_back
#define mp make_pair
#define rep(i,n) for(int i=0;i<(n);++i)

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n,k;cin >> n >> k;
	vector<int> a(k);
	rep(i,k) cin >> a.at(i);
	for(int i=n;i<=100000;++i){
		int x=i;
		bool flg=true;
		while(x>0){
			rep(j,k){
				if(x%10==a.at(j)){
					flg=false;
				}
			}
			x/=10;
		}
		if(flg){
			cout << i << endl;
			break;
		}
	}
}

Measured memory_bytes: 256
#a, b, c, d = (int(i) for i in input().split())  
#W = [int(i) for i in input().split()] 
import math

X, A = (int(i) for i in input().split())
if X >= A:
    print(10)
else:
    print(0)
    # flag = 0
# a_list = []

Measured memory_bytes: 2940
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <numeric>
#include <utility>
#include <string>

using namespace std;

using VI = vector<int>;
using VVI = vector<VI>;
using VVVI = vector<VVI>;

void show(VVI &vv) {
	cout << "------" << endl;
	for (auto v: vv) {
		for (auto x: v) {
			printf("%2d ", x);
		}
		printf("\n");
	}
}

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

	int ns = s.size();
	int nt = t.size();

	VVI dp(ns+1, VI(nt+1, 0));

	for (int i = 0; i < ns; i++) {
		for (int j = 0; j < nt; j++) {
			dp[i+1][j+1] = max(dp[i+1][j], dp[i][j+1]);
			if (s[i] == t[j]) {
				dp[i+1][j+1] = max(dp[i+1][j+1], dp[i][j] + 1);
			}
		}
	}

// show(dp);

	string ans;
	int r = ns;
	int c = nt;

	while (r > 0 && c > 0) {
		int v = dp[r][c];
		int to1 = dp[r-1][c];
		int to2 = dp[r][c-1];
		int to3 = dp[r-1][c-1];

		if (to1 == to2 && to2 == to3) {
			if (v > to1) {
				r--;
				c--;
				ans += s[r];
			} else {
				r--;
			}
		} else if (to1 >= to2) {
			r--;
		} else {
			c--;
		}
	}
	reverse(ans.begin(), ans.end());
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 35584
import scala.annotation.tailrec
//https://onlinejudge.u-aizu.ac.jp/challenges/sources/JAG/Prelim/2883
object Main extends App {
  import scala.io.StdIn._
  solve
  @tailrec def solve: Unit = {
    val expresssion = readLine.trim.toList
    if (expresssion == '.'::Nil) return
    val password = new Password(readLine.trim.toInt)
    expresssion match{
      case hash Hash Nil ⇒ {
        val checkSum = hash.calHash(password)
        println(
          s"$checkSum ${(0 until 10000).count{p ⇒ hash.calHash(new Password(p)) == checkSum}}"
        )
      }
      case _ ⇒ throw new Exception
    }
    solve
  }

  case class Password(a: Int, b: Int, c: Int, d:Int) {
    def this(password: Int){
      this(password / 1000, (password / 100) % 10, (password / 10) % 10, password % 10)
    }
  }
  sealed trait HashFunc{
    def calHash(password: Password): Int
  }
  object Hash {
    def unapply(arg: List[Char]): Option[(HashFunc, List[Char])] = arg match {
      case '['::Operator(op, hashA Hash (hashB Hash ']'::t)) ⇒ Some(op.operation(hashA, hashB), t)
      case l Letter t ⇒ Some(l, t)
      case _ ⇒ None
    }
  }
  class Hash(private val func:(Password)⇒ Int) extends HashFunc {
    override def calHash(password: Password): Int = func(password)
  }
  sealed trait Letter extends HashFunc
  object Letter {
    def unapply(arg: List[Char]): Option[(Letter, List[Char])] = arg match {
      case c::t if ('a' to 'd').contains(c) ⇒ Some(new ReadLetter(c), t)
      case _ ⇒ None
    }
  }
  class ReadLetter(private val char: Char) extends Letter {
    override def calHash(password: Password): Int = char match {
      case 'a' ⇒ password.a
      case 'b' ⇒ password.b
      case 'c' ⇒ password.c
      case 'd' ⇒ password.d
      case _ ⇒ throw new Exception
    }
  }
  sealed trait Operator {
    def operation(hashA: HashFunc, hashB: HashFunc): HashFunc
  }
  object Operator {
    def unapply(arg: List[Char]): Option[(Operator, List[Char])] = arg match {
      case '+'::t ⇒ Some(OrOp, t)
      case '*'::t ⇒ Some(AndOp, t)
      case '^'::t ⇒ Some(XorOp, t)
      case _ ⇒ None
    }
  }
  object AndOp extends Operator {
    override def operation(hashA: HashFunc, hashB: HashFunc): HashFunc = new Hash({p ⇒ hashA.calHash(p) & hashB.calHash(p)})
  }
  object OrOp extends Operator {
    override def operation(hashA: HashFunc, hashB: HashFunc): HashFunc = new Hash({p ⇒ hashA.calHash(p) | hashB.calHash(p)})
  }
  object XorOp extends Operator {
    override def operation(hashA: HashFunc, hashB: HashFunc): HashFunc = new Hash({p ⇒ hashA.calHash(p) ^ hashB.calHash(p)})
  }
}



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

int main() {
  ll L,R;
  cin >> L >> R;
  int ans = 2019;
  if(R-L < 2019){
    for(ll i=L; i<R+1; i++){
      for(ll j=L; j<R+1; j++){
        if(i*j%2019 < ans && i != j){
          ans = i*j%2019;
        }
      }
    }
  }
  else{
    ans = 0;
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define Pct puts("------ Yes ------");
#define rep(a, b, c) for(int a = (b); a <= (c); ++ a)
#define per(a, b, c) for(int a = (b); a >= (c); -- a)
#define fir first
#define sec second
#define ls son[u][0]
#define rs son[u][1]
#define eps 1e-8
#define PI acos(-1.0)
using namespace std;
template <class T> void rd(T &x){ x = 0; int f = 1; char ch = getchar(); while(ch < '0' || ch > '9'){ if(ch == '-') f = -1; ch = getchar(); } while(ch >= '0' && ch <= '9') x = (x << 3) + (x << 1) + ch - '0', ch = getchar(); x *= f; }

int main(){
	int n, k;
	rd(n), rd(k);
	puts(n >= (2 * k - 1) ? "YES" : "NO");
	return 0;
}

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

using namespace std;

#define FOR(i,a,b) for(int i = (a); i < (b); ++i)
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()

inline int toInt(string s) {int v; istringstream sin(s);sin>>v; return v;}

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector< vector<int> > Mat;
typedef tuple<int, int, int, int> T;

const int MOD = (int)1e9+7;
const int INF = (int)1e9;
const int dx[] = {0, 1, 0, -1};
const int dy[] = {1, 0, -1, 0};
const int ddx[] = {0, 1, 1, 1, 0, -1, -1, -1};
const int ddy[] = {1, 1, 0, -1, -1, -1, 0, 1};


int main(){
	int H, W;
	cin >> H >> W;
	Mat a(H, vi(W));
	rep(i, H) rep(j, W) cin >> a[i][j];

	vector<T> ans;
	rep(i, H){
		rep(j, W){
			if (a[i][j] & 1) {
				if (j + 1 < W) {
					ans.emplace_back(i + 1, j + 1, i + 1, j + 2);
					--a[i][j];
					++a[i][j + 1];
				}
				else if (i + 1 < H) {
					ans.emplace_back(i + 1, j + 1, i + 2, j + 1);
					--a[i][j];
					++a[i + 1][j];
				}
			}
		}
	}
    
	cout << ans.size() << endl;
	for(auto q : ans) {
		int px, py, qx, qy;
		tie(px, py, qx, qy) = q;
		cout << px << ' ' << py << ' ' << qx << ' ' << qy << endl;
	}

	return 0;
}

Measured memory_bytes: 5232
import core.bitop;
import std.algorithm;
import std.ascii;
import std.bigint;
import std.conv;
import std.functional;
import std.format;
import std.math;
import std.numeric;
import std.range;
import std.stdio;
import std.string;
import std.random;
import std.typecons;

alias sread = () => readln.chomp();
alias Point2 = Tuple!(long, "y", long, "x");

T lread(T = long)()
{
    return readln.chomp.to!T();
}

T[] aryread(T = long)()
{
    return readln.split.to!(T[])();
}

void scan(TList...)(ref TList Args)
{
    auto line = readln.split();
    foreach (i, T; TList)
    {
        T val = line[i].to!(T);
        Args[i] = val;
    }
}

enum MOD = (10 ^^ 9) + 7;

void main()
{
    long H, W;
    scan(H, W);
    if (H % 3 == 0 || W % 3 == 0)
    {
        writeln(0);
        return;
    }
    long solve(long A, long B)
    {
        long ans = long.max;
        foreach (a; 1 .. A)
        {
            long S1 = a * B;
            {
                long S2 = (A - a) * (B / 2);
                long S3 = (A - a) * ((B + 1) / 2);
                long tmp = max(S1, S2, S3) - min(S1, S2, S3);
                // writefln("%d %d %d %d", S1, S2, S3, tmp);
                ans = ans.min(tmp);
            }
            {
                long S2 = ((A - a) / 2) * B;
                long S3 = ((A - a + 1) / 2) * B;
                long tmp = max(S1, S2, S3) - min(S1, S2, S3);
                ans = ans.min(tmp);
            }
        }
        return ans;
    }

    min(solve(H, W), solve(W, H)).writeln();
}


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

using ll = long long int;

const int MAX = (int)(1e5 + 5);
const ll INF = (ll)(1e10 + 5);

const int MAX_N = (int)(1e5 + 5);
const int MAX_M = (int)(1e5 + 5);

/////////////////////////////////////////////////////////
// node in { 0, ... }
class UnionFind {
 public:
  static const int MAX_N_LIB = (int)(2e5 + 100);

  int uf_par[MAX_N_LIB];
  int uf_rank[MAX_N_LIB];
  int uf_size[MAX_N_LIB];

  UnionFind(int n) { init(n); }

  void init(int n) {
    for (int i = 0; i < n; ++i) {
      uf_par[i] = i;
      uf_rank[i] = 0;
      uf_size[i] = 1;
    }
  }

  int find(int x) {
    if (uf_par[x] == x)
      return x;
    else {
      return uf_par[x] = find(uf_par[x]);
    }
  }

  void unite(int leaf_x, int leaf_y) {
    int x = find(leaf_x);
    int y = find(leaf_y);

    if (x == y) return;

    if (uf_rank[x] < uf_rank[y]) {
      uf_par[x] = y;
      uf_size[y] += uf_size[x];
    } else if (uf_rank[x] > uf_rank[y]) {
      uf_par[y] = x;
      uf_size[x] += uf_size[y];
    } else {
      uf_par[y] = x;
      uf_size[x] += uf_size[y];
      uf_rank[x] += 1;
    }
  }

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

  int size(int x) { return uf_size[find(x)]; }
};
/////////////////////////////////////////////////////////

int n, m;

int p[MAX_N];

map<int, set<int>> target_map;
map<int, set<int>> goal_map;

UnionFind uf(MAX_N);

int ans;

int main(void) {
  // Here your code !
  scanf("%d %d", &n, &m);

  for (int i = 1; i <= n; ++i) {
    scanf("%d", &(p[i]));
  }

  for (int i = 0; i < m; ++i) {
    int x, y;
    scanf("%d %d", &x, &y);
    uf.unite(x, y);
  }

  for (int i = 1; i <= n; ++i) {
    int key = uf.find(i);
    target_map[key].insert(p[i]);
    goal_map[key].insert(i);
  }

  ans = 0;

  for (auto &e : target_map) {
    for (auto &d : e.second) {
      if (goal_map[e.first].find(d) != goal_map[e.first].end()) ans += 1;
    }
  }

  printf("%d\n", ans);

  return 0;
}


Measured memory_bytes: 29952
#include<stdio.h>

int main(){
        int d,n;
        int i,t = 1;

        scanf("%d %d",&d,&n);
        for(i = 0;i < d; ++i)   t *= 100;
        if(n != 100)    printf("%d\n",t * n);
        else printf("%d\n",t * (n + 1));
        return 0;
}


Measured memory_bytes: 128
M,D=(int(x) for x in input().split())
if D<=21:
    print(0)
else:
    c=0
    for n in range(22,D+1):
        d1=n%10
        d2=n//10
        if d1>=2:
            if d2>=2:
                if d1*d2<=M:
                    c=c+1
    print(c)


Measured memory_bytes: 3060
#include<stdio.h>
#include<stdlib.h>

typedef struct node{
  int key;
  struct node *parent,*left,*right;
}Node;

Node *root,*NIL;
void insert(int k){
  Node *y=NIL, *x=root, *z;

  z=(Node*)malloc(sizeof(Node));

  z->key=k;z->left=NIL;z->right=NIL;

  while(x!=NIL){
    y=x;
    if(k < x->key)x=x->left;
    else x=x->right;
  }
  z->parent=y;

  if(y==NIL)root=z;
  else{
    if(k < y->key)y->left = z;
    else y->right=z;
  }
}

void inOrder(Node* x){
  if(x==NIL)return;
  inOrder(x->left);
  printf(" %d",x->key);
  inOrder(x->right);
}
void preOrder(Node* x){
  if(x==NIL)return;
  printf(" %d",x->key);
  preOrder(x->left);
  preOrder(x->right);
}
int main(){
  int i,n,x;scanf("%d",&n);
  char com[10];

  for(i=0;i<n;i++){
    scanf("%s",com);
    if(com[0]=='i'){
      scanf("%d",&x);
      insert(x);
    }
    else{
      inOrder(root);
      printf("\n");
      preOrder(root);
      printf("\n");
    }
  }

  return 0;
}



Measured memory_bytes: 25176
#include<iostream>
#include<string>
#include<algorithm>
#include<cmath>
#include<vector>
#include<list>
#include<map>
#include<numeric>
#define REP(i,m,n) for(int i=(int)(m);i<(int)(n);i++)
#define rep(i,n) REP(i,0,n)
#define ll long long

using namespace std;

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

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 1792
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n; cin>>n;
  for(int i=1;i<10&&i*i<=n;i++){
    if(n%i==0&&n/i<10) { cout<<"Yes"<<endl; return 0; }
  }
  cout<<"No"<<endl; 
  return 0;
}

Measured memory_bytes: 3592
#include <iostream>
#include <map>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <sstream>
#include <cmath>
#include <math.h>
#include <string>
using namespace std;
          

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int w , h , n , a , b , c , e = 0;
    cin >> w >> h >> n;
    int d[w][h];
    for ( int i = 0 ; i < w ; i++ ) {
        for ( int j = 0 ; j < h ; j++ ) {
            d[i][j] = 0;
        }
    }
    for ( int i = 0 ; i < n ; i++ ) {
        cin >> a >> b >> c;
        if ( c == 1 ) {
            for ( int i = 0 ; i < a ; i++ ) {
                for ( int j = 0 ; j < h ; j++ ) {
                    d[i][j] = 1;
                }
            }
        } else if ( c == 2 ) {
            for ( int i = a ; i < w ; i++ ) {
                for ( int j = 0 ; j < h ; j++ ) {
                    d[i][j] = 1;
                }
            }
        } else if ( c == 3 ) {
            for ( int i = 0 ; i < w ; i++ ) {
                for ( int j = 0 ; j < b ; j++ ) {
                    d[i][j] = 1;
                }
            }
        } else {
            for ( int i = 0 ; i < w ; i++ ) {
                for ( int j = b ; j < h ; j++ ) {
                    d[i][j] = 1;
                }
            }
        }
    }
    for ( int i = 0 ; i < w ; i++ ) {
        for ( int j = 0 ; j < h ; j++ ) {
            if ( d[i][j] == 0 ) e++;
        }
    }
    cout << e;
}

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

struct node{
    int key;
    node *p,*l,*r;
};

int n;
node *N;

void in(node *r){
    if(r->l!=NULL)in(r->l);
    cout<<" "<<r->key;
    if(r->r!=NULL)in(r->r);
}

void pre(node *r){
    cout<<" "<<r->key;
    if(r->l!=NULL)pre(r->l);
    if(r->r!=NULL)pre(r->r);
}

void print(){
    node *r=N;
    in(r);
    cout<<endl;
    pre(r);
    cout<<endl;
}

void tree_insert(node *z){
    node *y=NULL;
    node *x=N;
    while(x!=NULL){
        y=x;
        if(x->key>z->key)x=x->l;
        else x=x->r;
    }
    z->p=y;

    if(y==NULL)N=z;
    else if(y->key<z->key)y->r=z;
    else y->l=z;
}

int main()
{
    N=NULL;
    cin>>n;
    int i,j;
    for(i=0;i<n;i++){
        string s;int num;
        cin>>s;
        if(s=="insert"){
            cin>>num;
            node *z=new node();
            z->key=num;z->p=z->l=z->r=NULL;
            tree_insert(z);
        }
        if(s=="print"){
            print();
        }
    }
    return 0;
}

Measured memory_bytes: 26640
#include <algorithm>
#include <fstream>
#include <iomanip>
#include <iostream>
#include <map>
#include <math.h>
#include <set>
#include <stdio.h>
#include <string>
#include <utility>
#include <vector>

using namespace std;

long long P = 1000000007;

int main() {
  int h, w, k;
  cin >> h >> w >> k;
  // dp[位置][段目] := 1から辿ってそこにいけるような構成数
  long long dp[102][8] = {0};
  // dp2[i] := i番目で終わってるあみだ
  long long dp2[10] = {0}, sumdp2[11] = {0};
  sumdp2[1] = dp2[0] = 1;
  dp2[1] = 0;
  sumdp2[2] = 1;
  for (int i = 2; i < 10; i++) {
    dp2[i] = sumdp2[i - 1];
    sumdp2[i + 1] = sumdp2[i] + dp2[i];
  }
  dp[0][0] = 1;
  for (int i = 0; i < h; i++) {
    for (int j = 0; j < w; j++) {
      dp[i + 1][j] += (dp[i][j] * ((sumdp2[j + 1] * sumdp2[w - j]) % P)) % P;
      dp[i + 1][j] %= P;
      if (j > 0) {
        dp[i + 1][j - 1] += (dp[i][j] * ((sumdp2[j] * sumdp2[w - j]) % P)) % P;
        dp[i + 1][j - 1] %= P;
      }
      if (j < w - 1) {
        dp[i + 1][j + 1] +=
            (dp[i][j] * ((sumdp2[j + 1] * sumdp2[w - j - 1]) % P)) % P;
        dp[i + 1][j + 1] %= P;
      }
    }
  }
  cout << dp[h][k - 1] << endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define repo(i,n) for(int i = 1; i < (int)(n); i++)
#define pb push_back
#define mp make_pair
#define np next_permutation
#define lb lower_bound
#define ub upper_bound
#define fi first
#define se second
#define all(x) (x).begin(),(x).end()
#define mod 1000000007
#define pi acos(-1.0)
const ll INF = 1LL<<61;
ll gcd(ll x, ll y) { return y ? gcd(y, x % y) : x; }
ll lcm(ll x, ll y) { return x / gcd(x, y) * y; }
ll jou(ll N, ll P){if(P==0) return 1;
  if(P%2==0){ll t = jou(N, P/2);return t*t % mod;
  }return (N * jou(N, P-1)) % mod;}  //jou(n,mod-2)で逆元
//intの最大値2147483647 ≒ 2×10^9
//long longの最大値9223372036854775807 ≒ 9×10^18
//'大文字'+=32;    で小文字に
//  cout << fixed << setprecision (20);   小数点以下2０桁まで
//実行時間制約2秒では２×10^8回くらいまで計算できる




int main() {
  string s;
  cin >> s;
  int n=s.size();

  reverse(all(s));

  while(s.size()>0){
    if(s.substr(0,5)=="maerd"){
      if(s.size()>5) s=s.substr(5);
      else {
        cout <<"YES" << endl;
        return 0;
      }    }
    else if(s.substr(0,7)=="remaerd"){
      if(s.size()>7) s=s.substr(7);
      else {
        cout <<"YES" << endl;
        return 0;
      }    }
    else if(s.substr(0,5)=="esare"){
      if(s.size()>5) s=s.substr(5);
      else {
        cout <<"YES" << endl;
        return 0;
      }    }
    else if(s.substr(0,6)=="resare"){
      if(s.size()>6) s=s.substr(6);
      else {
        cout <<"YES" << endl;
        return 0;
      }
    }    
    else {
      cout << "NO" << endl;
      return 0;
    }
  }
  

}

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

void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}

template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifdef LOCAL
#define debug(x...) cerr <<"at line "<< __LINE__<<": [" << #x << "] = ["; _print(x)
#else
#define debug(x...)
#endif
 
/*
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;


template<class T> 
using ordered_set= tree<T, null_type, 
		less<T>, 
		rb_tree_tag, tree_order_statistics_node_update> ;

template<class T> 		
using ordered_mset= tree<T, null_type, 
		less_equal<T>, 
		rb_tree_tag, tree_order_statistics_node_update> ;
		
*/
 
/*
 
PBDS
-------------------------------------------------
			0 based indexing
-------------------------------------------------			 
1) insert(value)
2) erase(value)
3) order_of_key(value) // Number of items strictly smaller than value
4) *find_by_order(k) : K-th element in a set (counting from zero)
 
*/
 
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
 
//mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());	

void solve()
{
	char a;
	cin>>a;
	
	if(a>='a' && a<='z') cout<<"a";
	else cout<<"A";
}		

int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0); cout.tie(0);
	
	solve();
	
	#ifdef LOCAL
	cerr<<"\nTime elapsed: " << 1000.0 * clock() / CLOCKS_PER_SEC << " ms\n";
	#endif
	
	
	return 0;
}


Measured memory_bytes: 3664
// C - Poll
#include <bits/stdc++.h>
using namespace std;
#define rp(i,s,e) for(int i=(s);i<(e);++i)
template<class T>bool chmax(T &a, const T &b){if(a<b){a=b;return 1;}return 0;}
template<class T> vector<T> inarr(int s,int e, T init){
	vector<T> v;T x;
	for(int i=0;i<s;++i)v.push_back(init);
	for(int i=s;i<e;++i){cin>>x;v.push_back(x);}
	return v;
}

int N;
using VS = vector<string>;
VS S;

VS solve(){
	VS ans;
	map<string, int> M;
	int limit = 0;
	rp(i,0,N) chmax(limit, ++M[S[i]]);
	for(auto m:M) if(limit == m.second) ans.push_back(m.first);
	return ans;
}

int main(){
	cin>>N;
	S = inarr<string>(0,N,"");
	for(auto a:solve()) cout<< a <<endl;
}

Measured memory_bytes: 28400
#include <stdio.h>
#include <math.h>

int main(void){
    int n;
    scanf("%d", &n);
    int x[n];
    double sum = 0;
    for(int i = 0; i < n; i++){
        scanf("%d", &x[i]);
        sum = sum + x[i];
    }

    int ave;
    ave = (int)(sum / n + 0.5);

    int min = 0;
    for(int i = 0; i < n; i++){
        int m;
        m = pow((x[i] - ave), 2);
        min = min + m;
    }

    printf("%d", min);


}

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

//typedef
//------------------------------------------
typedef pair<int, int> PII;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef vector<bool> VB;
typedef vector<PII> VP;


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

//container util
//------------------------------------------
#define pb(a) push_back(a)
#define fst first
#define snd second
#define SORT(V) sort((V).begin(),(V).end())
#define REV(V) reverse((V).begin(),(V).end())

//constant
//------------------------------------------
const int MOD = 1000000007;
const int INF = 1061109567;
const double EPS = 1e-10;
const double PI  = acos(-1.0);
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};

//grobal variable
//------------------------------------------

//def function, class
//------------------------------------------


//main
//------------------------------------------
signed main(){
  int N;
  cin >> N;
  VP task(N);
  //fstに締め切り時刻を入れる
  REP(i, N) cin >> task[i].snd >> task[i].fst;
  SORT(task);

  int now=0;

  REP(i, N){
    now += task[i].snd;
    if(now > task[i].fst){
      cout << "No" << endl;
      return 0;
    }
  }
  cout << "Yes" << endl;
  return 0;
}


Measured memory_bytes: 3328
function parseInt(x) parse(Int, x) end

function main()
    n = readline() |> parseInt
    a = readline() |> split |> x -> parseInt.(x)
    s = map(i->a[i]-i, eachindex(a))
    m = median(s)
    ms = sum(x->abs(x-m),s)
    println(round(Int,ms))
end

main()



Measured memory_bytes: 186204
import sys
input = lambda: sys.stdin.readline().rstrip()

def main():
    a, b, c = map(int, input().split())
    k = int(input())
    for _ in range(k):
        if a >= b:
            b *= 2
        elif b >= c:
            c *= 2
    if a < b and b < c:
        print('Yes')
    else:
        print('No')
            
if __name__ == '__main__':
    main()

Measured memory_bytes: 9128
#include <iostream>
#include <numeric>
#include <algorithm>
#include <vector>
#include <array>
#include <string>
#include <queue>
#include <cmath>
#include <iterator>
#include <math.h>
#include <cstdio>
#include <map>
#include <set>
#include <unordered_map>
#include <sstream>
#include <tuple>

using namespace std;
using lli = long long int;
using ulli = unsigned long long int;

namespace atcoder{
    void judge_outer(bool judge_exp,string ok = "Yes",string ng = "No"){
        if(judge_exp){
            cout << ok << endl;
        }else{
            cout << ng << endl;
        }
    }
    
    int ncr(int left,int right){
        right = min(left - right,right);
        int ans =1;
        for(int i=1;i<=right;i++){
            ans = ans * (left-right+i)/i;
        }
        return ans;
    }
    
    [[maybe_unused]] const int LIMIT = 1000000256;
    [[maybe_unused]] const int tenfive = 100000;
    
    
}

using namespace atcoder;

int main(void){
    int a,b,c,d;
    cin >> a >> b >> c >> d;
    if(abs(a-c) <= d){
        cout << "Yes" << endl;
    }else{
        if(abs(a-b) <= d && abs(b-c) <= d){
            cout << "Yes" << endl;
        }else{
            cout << "No" << endl;
        }
    }
    
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
using namespace std;
const int MAXN=100005;
int n,k;
bool a[MAXN];
int ans=0;

int main()

{
	ios::sync_with_stdio(false);
	cin>>n>>k;
	for (int i=1;i<=n;i++){
		char c;
		cin>>c;
		a[i]=c=='L';
	}
	a[0]=!a[1];
	a[n+1]=!a[n];

	for (int i=1;i<=n;i++){
		if (a[i+(a[i]?-1:1)]==a[i]) ans++;
	}

	ans=min(ans+2*k,n-1);
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 512
#include<stdio.h>
#include<stdlib.h>

struct node{
  struct node *right;
  struct node *left;
  struct node *parent;
  int key;
};
typedef struct node * Node;
#define NIL NULL

Node root;

Node treeMinimum(Node x){


}

Node treeMaximum(Node x){
}

Node treeSearch(Node u, int k){

  if (u == NIL || k == u->key)
    return u;

  if(k < u->key)
    return treeSearch(u->left, k);
else
  return treeSearch(u->right, k);
  }

Node treeSuccessor(Node x){
}

void treeDelete(Node z){
  Node y; // node to be deleted
  Node x; // child of y



}
void insert(int k){
  Node y = NIL;
  Node x = root;
  Node z;

  z = malloc(sizeof(struct node));
  z->key = k;
  z->left = NIL;
  z->right = NIL;

  while(x != NIL){
    y=x;
    if(z->key < x->key)
      x=x->left;
    else
      x=x->right;
  }
  z->parent=y;
   

  if (y == NIL)
    root=z;
  else if (z->key < y->key)
    y->left=z;
  else
    y->right=z;
}

void inorder(Node u){
  if( u != NIL){
    inorder(u->left);
    printf(" %d",u->key);
    inorder( u->right);
  }
}

void preorder(Node u){
  if( u != NIL){
    printf(" %d",u->key);
    preorder(u->left);
    preorder(u->right);
  }
}


  int main(){
  int n, i, x;
  char com[20];
  scanf("%d", &n);

  for ( i = 0; i < n; i++ ){
    scanf("%s", com);
    if ( com[0] == 'f' ){
      scanf("%d", &x);
      Node t = treeSearch(root, x);
      if ( t != NIL ) printf("yes\n");
      else printf("no\n");
    } else if ( com[0] == 'i' ){
      scanf("%d", &x);
      insert(x);
    } else if ( com[0] == 'p' ){
      inorder(root);
      printf("\n");
      preorder(root);
      printf("\n");
    } else if ( com[0] == 'd' ){
      scanf("%d", &x);
      treeDelete(treeSearch(root, x));
    }
  }

  return 0;
}

Measured memory_bytes: 24036