akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define ll long long
#define INF 1000000005
#define MOD 1000000007
#define EPS 1e-10
#define rep(i,n) for(int i=0;i<(int)(n);++i)
#define rrep(i,n) for(int i=(int)(n)-1;i>=0;--i)
#define srep(i,s,t) for(int i=(int)(s);i<(int)(t);++i)
#define each(a,b) for(auto& (a): (b))
#define all(v) (v).begin(),(v).end()
#define len(v) (int)(v).size()
#define zip(v) sort(all(v)),v.erase(unique(all(v)),v.end())
#define cmx(x,y) x=max(x,y)
#define cmn(x,y) x=min(x,y)
#define fi first
#define se second
#define pb push_back
#define show(x) cout<<#x<<" = "<<(x)<<endl
#define sar(a,n) cout<<#a<<":";rep(pachico,n)cout<<" "<<a[pachico];cout<<endl

using namespace std;

template<typename S,typename T>auto&operator<<(ostream&o,pair<S,T>p){return o<<"{"<<p.fi<<","<<p.se<<"}";}
template<typename T>auto&operator<<(ostream&o,set<T>s){for(auto&e:s)o<<e<<" ";return o;}
template<typename S,typename T,typename U>
auto&operator<<(ostream&o,priority_queue<S,T,U>q){while(!q.empty())o<<q.top()<<" ",q.pop();return o;}
template<typename K,typename T>auto&operator<<(ostream&o,map<K,T>m){for(auto&e:m)o<<e<<" ";return o;}
template<typename T>auto&operator<<(ostream&o,vector<T>v){for(auto&e:v)o<<e<<" ";return o;}
void ashow(){cout<<endl;}template<typename T,typename...A>void ashow(T t,A...a){cout<<t<<" ";ashow(a...);}

typedef pair<int,int> P;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
typedef vector<P> vp;
typedef vector<double> vd;
typedef vector<string> vs;

const int MAX_N = 100005;

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int m, K;
    cin >> m >> K;
    if(m == 1){
        if(K == 0){
            cout << "0 0 1 1\n";
        }else{
            cout << "-1\n";
        }
    }else{
        int n = (1 << m);
        if(K >= n){
            cout << "-1\n";
        }else{
            vi vec(2*n);
            vec[0] = vec[n] = K;
            rep(i,n){
                if(i != K){
                    int id = i+1;
                    if(id > K) id--;
                    vec[n+id] = vec[n-id] = i;
                }
            }
            rep(i,2*n){
                cout << vec[i] << " ";
            }
            cout << "\n";
        }
    }
    return 0;
}


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

#define rep(i,n) for(ll i=0;i<(n);++i)
using ll = long long;
using pll = pair<ll,ll>;
constexpr ll INF = (1LL<<60);
constexpr ll MOD = (1e9+7);
//constexpr ll MOD = (998244353);
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(a>b){a=b;return 1;}return 0;}
#if loc||debg||local||debug
void dump(){cerr<<endl;}
template<class T,class... Ts> void dump(T&& h, Ts&&... t){cerr<<h<<", ";dump(forward<Ts>(t)...);}
#else
template<class T,class... Ts> void dump(T&& h, Ts&&... t){}
#endif
template<class T> istream &operator>>(istream&is,vector<T>&v){for(auto &elemnt:v)is>>elemnt;return is;}
template<class T,class U> istream &operator>>(istream&is,pair<T,U>&p){is>>p.first>>p.second;return is;}
template<class T> ostream &operator<<(ostream& os,vector<T>const& v){for(auto const& vi:v)os<<vi<<" ";return os;}
template<class T>vector<T> vec(size_t a){return vector<T>(a);}
template<class T, class... Ts>auto vec(size_t a, Ts... ts){return vector<decltype(vec<T>(ts...))>(a, vec<T>(ts...));}
template<class T>vector<T> _vec(size_t a,T v){return vector<T>(a,v);}
template<class T, class... Ts>auto _vec(size_t a, Ts... ts){return vector<decltype(_vec<T>(ts...))>(a, _vec<T>(ts...));}

int main(){

  string s,t,u;
  int a,b;
  cin>>s>>t>>a>>b>>u;
  map<string,int> m;
  m[s]=a;
  m[t]=b;
  m[u]--;
  cout<<m[s]<<" "<<m[t]<<endl;

}

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

constexpr int M = 2010;

bool match(char a, char b) {
    return (a == b || a == '?' || b == '?');
}

int main() {
    string a, b, c; cin >> a >> b >> c;
    int A = a.length();
    int B = b.length();
    int C = c.length();
    vector<bool> ab(20000, true);
    for (int i = -M; i <= M; i++) {
        for (int j = i; j < i + B; j++) {
            if (0 <= j && j < A) {
                ab[10000 + i] = ab[10000 + i] && match(a[j], b[j-i]);
            }
        }
    }
    vector<bool> ac(20000, true);
    for (int i = -M; i <= M; i++) {
        for (int j = i; j < i + C; j++) {
            if (0 <= j && j < A) {
                ac[10000 + i] = ac[10000 + i] && match(a[j], c[j-i]);
            }
        }
    }
    vector<bool> bc(20000, true);
    for (int i = -M; i <= M; i++) {
        for (int j = i; j < i + C; j++) {
            if (0 <= j && j < B) {
                bc[10000 + i] = bc[10000 + i] && match(b[j], c[j-i]);
            }
        }
    }
    int ans = 1000000;
    for (int i = -M * 2; i <= M * 2; i++) {
        for (int j = -M * 2; j <= M * 2; j++) {
            if (ab[10000 + i] && ac[10000 + j] && bc[10000 - i + j]) {
                ans = min(ans, (max({A, i + B, j + C}) - min({0, i, j})));
            }
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cassert>
#include <cmath>

#include <iostream>
#include <iomanip>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <queue>
#include <stack>
#include <utility>
#include <vector>
#include <functional>
#include <algorithm>

using namespace std;

#define fast_cin() ios_base::sync_with_stdio(false)

typedef long double ld;
typedef long long ll;
typedef pair <int, int> pii;
typedef pair <ll, ll> pll;

int main()
{
	ll a, b, c;
	cin >> a >> b >> c;
	if (a % 2 == 0 || b % 2 == 0 || c % 2 == 0) {
		cout << 0 << endl;
	} else {
		cout << min(a * b, min(b * c, a * c)) << endl;
	}
}


Measured memory_bytes: 256
/* ---------- STL Libraries ---------- */
// IO library
#include <cstdio>
#include <fstream>
#include <iomanip>
#include <ios>
#include <iostream>

// algorithm library
#include <algorithm>
#include <cmath>
#include <numeric>
#include <random>

// container library
#include <array>
#include <bitset>
#include <deque>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <tuple>
#include <vector>

/* ---------- Namespace ---------- */
using namespace std;

/* ---------- Type Abbreviation ---------- */
using ll = long long;

/* ---------- Constants ---------- */
const ll MOD = 1e9 + 7;
// const int INF = 1 << 25;
// const ll INF = 1LL << 50;
// const double PI = acos(-1);
// const double EPS = 1e-10;
// mt19937 mert(LL(time(0)));

/* ---------- Short Functions ---------- */
template <typename T>
T gcd(T a, T b) {
    if (a > b) return gcd(b, a);
    return a == 0 ? b : gcd(b % a, a);
}

template <typename T, typename U>
T mypow(T b, U n) {
    if (n == 0) return 1;
    if (n == 1) return b /* % MOD */;
    if (n % 2 == 0) {
        return mypow(b * b /* % MOD */, n / 2);
    } else {
        return mypow(b, n - 1) * b /* % MOD */;
    }
}

/* v-v-v-v-v-v-v-v-v Main Part v-v-v-v-v-v-v-v-v */

int main() {
    int H, W;
    cin >> H >> W;

    char grid[H][W];
    for (int i = 0; i < H; i++) {
        string line;
        cin >> line;
        for (int j = 0; j < W; j++) {
            grid[i][j] = line[j];
        }
    }

    for (int i = 0; i < H; i++) {
        for (int j = 0; j < W; j++) {
            char c = grid[i][j];
            if (c == '.') continue;

            bool flag = false;

            for (int a = -1; a <= 1; a++) {
                for (int b = -1; b <= 1; b++) {
                    if ((a != 0 && b != 0) || a == 0 & b == 0) continue;
                    if (i + a < 0 || i + a >= H || j + b < 0 || j + b >= W) continue;

                    if (grid[i+a][j+b] == '#') {
                        flag = true;
                    }
                }
            }

            if (!flag) {
                cout << "No" << endl;
                return 0;
            }
        }
    }

    cout << "Yes" << endl;
    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
#define MAX 500001
#define SENTINEL 2000000000

 int count;

 int merge(int S[],int left,int right,int mid){
         int n1,n2,i,L[MAX/2+2],R[MAX/2+2],j,k;
         n1=mid-left;
         n2=right-mid;
         for(i=0;i<n1;i++){L[i]=S[left+i];}
         for(i=0;i<n2;i++){R[i]=S[mid+i];}
         L[n1]=R[n2]=SENTINEL;
         i=0;
         j=0;
         for(k=left;k<right;k++){
                        count++;
                        if(L[i]<=R[j]){S[k]=L[i];
                                      i++;
                                      }
                        else {S[k]=R[j];
                              j++;
                              }
                        }
          }
                                   
                    

 int mergesort(int S[],int left,int right){
        if(right-left>1){
             int mid=(left+right)/2;
             mergesort(S,left,mid);
             mergesort(S,mid,right);
             merge(S,left,right,mid);
             }
        }

 int main(){
        int i,n;
        count=0;
        int S[MAX];
        scanf("%d",&n);
        for(i=0;i<n;i++){
                   scanf("%d",&S[i]);
                   }
        
        mergesort(S,0,n);
        for(i=0;i<n;i++){
                   printf("%d%c",S[i],(i==n-1)?'\n':' ');
                   }
        printf("%d\n",count);
        return 0;
        }




Measured memory_bytes: 5648
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <cmath>
#include <sstream>
#include <numeric>
#include <queue>
#include <sstream>
#include <set>
using namespace std;

int64_t min(int64_t a,int64_t b) {
    if (a > b)
    {
        return b ;
    }else
    {
        return a ;
    }
}


int main(){
    int n ;
    cin >> n ;
    vector<int64_t> a(n) ;
    for (size_t i = 0; i < n; i++)
    {
        cin >> a.at(i) ;
    }
    vector<int64_t> s(n) ;
    s.at(0) = a.at(0) ;
    for (size_t i = 1; i < n; i++)
    {
        s.at(i) = s.at(i-1) + a.at(i) ;
    }
    int64_t ans = INT64_MAX;
    for (size_t i = 0; i < n-1; i++)
    {
        ans = min(ans,abs(2*s.at(i) -s.at(n-1) )) ;
    }
    cout << ans << endl ;
    
}


Measured memory_bytes: 3328
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <queue>
#include <numeric>

using namespace std;

typedef long long ll;

int main(void)
{
    int ans = 0;
    int a,b;
    
    cin >> a >> b;
    
    if (a > 9 || b > 9) ans = -1;
    else ans = a*b;
    
    cout << ans << endl;
    return 0;
}


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

#define rep(i, n) for(int i = 0, i##_len = (n); i < i##_len; ++i)
#define repp(i, m, n) for(int i = m, i##_len = (n); i < i##_len; ++i)
#define all(x) (x).begin(), (x).end()
#define clr(ar, val) memset(ar, val, sizeof(ar))
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; }
int gcd(int a,int b){return b?gcd(b,a%b):a;}
using namespace std;

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

int main(void)
{
	bool ok = false;
	char s[5];
	cin >> s;
	if(s[0] == s[3] && s[1] == s[2] && s[0] != s[1]) ok = true;
	if(s[0] == s[1] && s[2] == s[3] && s[0] != s[2]) ok = true;
	if(s[0] == s[2] && s[1] == s[3] && s[0] != s[1]) ok = true;
	cout << (ok ? "Yes" : "No") << endl;
	return 0;
}

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

using namespace std;

int main() {

    int n;
    cin >> n;

    int max = 1;
    int min = 100;

    std::vector<int> plots(n);
    int tmp;
    for (int i = 0; i < n; ++i) {
        cin >> tmp;
        if (max < tmp) {
            max = tmp;
        }
        if (min > tmp) {
            min = tmp;
        }
        plots[i] = tmp;
    }

    int ans = 0;
    for (int i = min; i <= max; ++i) {
        int sum = 0;
        for (int j = 0; j < n; ++j) {
            sum += pow(plots[j] - i, 2.0);
        }
        if ((ans == 0) || (ans > sum)) {
            ans = sum;
        }
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256
N = int(input())
a = [int(input()) - 1 for i in range(N)]

btn = 0
hist = set()
ans = 0
while True:
    if btn == 1:
        break

    if btn in hist:
        ans = -1
        break

    hist.add(btn)
    btn = a[btn]
    ans += 1

print(ans)


Measured memory_bytes: 13220
import sys
#template by uwi 
stdin = sys.stdin
 
ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline().rstrip()  # ignore trailing spaces
def convert(ar, st, ed):
    for i in range(st, st + (ed-st+1)//2):
        ar[i], ar[ed-i+st] = not ar[ed-(i-st)], not ar[i]
    if (ed-st+1) % 2 == 1:
        ar[st+(ed-st+1)//2] = not ar[st+(ed-st+1)//2]

n, k = na()
ar = [ True if x == 'R' else False for x in ns()]
st = 1 
ed = 2
#print("checking 0s")
while ed < n-1 and k > 0:
    while st < n and not (ar[st] == False and (st == 0 or ar[st-1] != ar[st])):  
        st += 1
    #st is 0 and one of (st, st-1) is unhappy
    ed = st+1
    while ed < n-1 and not(ar[ed] == False and (ed == n-1 or ar[ed+1] != ar[ed])):
        ed += 1
    if ed >= n-1:
        break
    #print(st, ed)
    #ed is 0 and one of (ed, ed+1) is unhappy
    convert(ar, st, ed)
    k-=1
    st = ed+2
    ed = st+1
#print("checking 1s")
st = 1
ed = 2
while k > 0 and ed < n-1:
    while st < n and not (ar[st] == True and (st == 0 or ar[st-1] != ar[st])):  
        st += 1
    #st is 1 and one of (st, st-1) is unhappy
    ed = st+1
    while ed < n-1 and not(ar[ed] == True and (ed == n-1 or ar[ed+1] != ar[ed])):
        ed += 1
    if ed >= n-1:
        break
    #print(st, ed)
    #ed is 1 and one of (ed, ed+1) is unhappy
    convert(ar, st, ed)
    k -= 1
    st = ed+2
    ed = st+1
#print("checking extremeties 0s")
st = 0
ed = 1
while ed < n and k > 0:
    while st < n and not (ar[st] == False and (st == 0 or ar[st-1] != ar[st])):  
        st += 1
    #st is 0 and one of (st, st-1) is unhappy
    ed = st+1
    while ed < n and not(ar[ed] == False and (ed == n-1 or ar[ed+1] != ar[ed])):
        ed += 1
    if ed >= n:
        break
    #print(st, ed)
    #ed is 0 and one of (ed, ed+1) is unhappy
    convert(ar, st, ed)
    k-=1
    st = ed+2
    ed = st+1
#print("checking extremeties 1s")
st = 0
ed = 1
while k > 0 and ed < n:
    while st < n and not (ar[st] == True and (st == 0 or ar[st-1] != ar[st])):  
        st += 1
    #st is 1 and one of (st, st-1) is unhappy
    ed = st+1
    while ed < n and not(ar[ed] == True and (ed == n-1 or ar[ed+1] != ar[ed])):
        ed += 1
    if ed >= n:
        break
    #print(st, ed)
    #ed is 1 and one of (ed, ed+1) is unhappy
    convert(ar, st, ed)
    k -= 1
    st = ed+2
    ed = st+1

#print(ar)
ans = 0
st = 0
cur = 0
for i in range(n):
    if ar[st] == ar[i]:
        cur += 1
    else:
        ans += cur-1
        cur = 1
        st = i
ans += cur-1 
print(ans)



Measured memory_bytes: 49568
import java.util.*;

public class Main {

	private void doit() {
		Scanner sc = new Scanner(System.in);
		while(sc.hasNext()){
			int [] a = new int[4];
			int [] b = new int[4];
			for(int i = 0; i < 4; i++){
				a[i] = sc.nextInt();
			}
			for(int i =0; i < 4; i++){
				b[i] = sc.nextInt();
			}
			int hit=0;
			int blow = 0;
			for(int i =0; i < 4; i++){
				for(int j =0; j < 4; j++){
					if(a[i] == b[j]){
						if(i == j)
							hit++;
						else{
							blow++;
						}
					}
				}
			}
			System.out.println(hit + " " + blow);
		}
	}

	public static void main(String[] args) {
		Main obj = new Main();
		obj.doit();
	}
}

Measured memory_bytes: 12000
s = input()

while True:
  if s[-5:] == 'dream': s = s[:-5]
  elif s[-7:] == 'dreamer': s = s[:-7]
  elif s[-5:] == 'erase': s = s[:-5]
  elif s[-6:] == 'eraser': s = s[:-6]
  else: break

if len(s) == 0: print('YES')
else: print('NO')

Measured memory_bytes: 9212
N, K = map(int, input().split())
h = []
hmin = None

for i in range(N):
    htmp = int(input())
    h.append(htmp)

h.sort(reverse = False)

for s in range(0, len(h)-(K-1)):
    hmintmp = h[s+(K-1)] - h[s]

    if hmin == None or hmin > hmintmp:
        hmin = hmintmp


print(hmin)

Measured memory_bytes: 7484
#include <bits/stdc++.h>
using namespace std;
#define M 1000000007
#define U 998244353
#define N 1000005
#define int long long
#define sz(c) (int)c.size()
#define fr first
#define ll long long 
#define sc second
#define pb push_back
#define mp make_pair
#define all(a) (a).begin(),(a).end()
#define rep(i,a,n) for(int i=a ; i<n ; i++)
#define r0 return 0;
#define endl '\n'
#define INF (int)1e15
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
	std::cerr << name << " : " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
	const char* comma = strchr(names + 1, ',');std::cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
int power(int x, unsigned int y, unsigned int m)
{
    if (y == 0)
        return 1;
    int p = power(x, y/2, m) % m;
    p = (p * p) % m;
    return (y%2 == 0)? p : (x * p) % m;
}
signed main()
{
	ios_base::sync_with_stdio(0);
	int TESTS=1;
	// cin>>TESTS;
	while(TESTS--)
	{   
		int n,m;
		cin >> n >> m;
		if(n==m) cout<<"Yes";
		else cout<<"No";
	}
}

Measured memory_bytes: 256
def main():
    from itertools import permutations
    n = int(input())
    p = tuple(map(int, input().split()))
    q = tuple(map(int, input().split()))

    a = 0
    b = 0
    for i, l in enumerate(permutations(list(range(1,n+1)))):
        if p == l:
            a = i
        if q == l:
            b = i
        if a != 0 and b!= 0:
            break
    print(abs(a-b))
if __name__ == '__main__':
    main()


Measured memory_bytes: 38640
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair<ll,ll> P;
int main() {
  string s;
  cin>>s;
  ll ans=700;
  for(int i=0;i<3;i++)if(s[i]=='o')ans+=100;
  cout<<ans<<endl;
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;
typedef long long ll;

void YesNo(bool x) {
    cout << (x ? "Yes" : "No") << endl;
}

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

    vector<int> v(n);
    for (int i = 0; i < m; i++) {
        int a, b;
        cin >> a >> b;
        a--, b--;
        if (a == 0)v[b]++;
        if (b == n - 1)v[a]++;
    }

    bool ret = false;
    for (int i = 0; i < n; i++) {
        if (v[i] == 2)ret = true;
    }
    cout << (ret ? "POSSIBLE" : "IMPOSSIBLE") << endl;
    return 0;
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef pair<ll,ll> Pl;
#define all(a) (a).begin(),(a).end()
#define rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(ll i=(a);i<(b);i++)
#define rrep(i,n) for(ll (i)=(n)-1;(i)>=0;i--)
#define SHOW(x) cout << #x << ": " << x << endl;
const ll INF=1e18;
const int iINF = 1e9;
int main(){
    int r;
    cin>>r;
    cout<<r*r<<endl;
}

Measured memory_bytes: 256
program caddi2018c
  implicit none
  integer(8) n, p, i, c, ans

  read *, n, p
  ans = 1
  i = 2
  do while (i**2.le.p)
     c = 0
     do while (mod(p, i).eq.0)
        p = p / i
        c = c + 1
     end do
     ans = ans * i**(c / n)
     i = i + 1
  end do
  if (n.eq.1) ans = ans * p
  print '(i0)', ans
end program caddi2018c


Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cstring>
#include <cstdlib>  
#include <cmath>   
#include<cctype>
#include<string>
#include <map>
#include<algorithm>
#include <functional>
#include<vector>
#include<climits>
#include<stack>
#include<queue>
#include <deque>
#include <utility> 

#define rep(i,m,n) for(int i = m;i < n;++i)
using namespace std;
using ll = long long;
using R = double;
const ll inf = 1LL << 50;
const int MOD = 1e9 + 7;









int main() {
	ll k, a, b;
	cin >> k >> a >> b;

	if (a+2 >= b) {
		cout << 1+k << endl;
	}
	else if(k <= a){
		cout << 1 + k << endl;
	}
	else if ((k - a) % 2 == 1) {
		cout << a + ((k - a + 1) / 2)*(b - a) << endl;
	}
	else if((k - a) % 2 == 0){
		cout << a + ((k - a) / 2)*(b - a) + 1 << endl;
	}


	return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		try (Scanner sc = new Scanner(System.in)) {
			int a = sc.nextInt();
			int b = sc.nextInt();
			int count = a - (2 * b);
			System.out.println(count < 0 ? 0 : count);
		}
	}
}


Measured memory_bytes: 22740
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <utility>
#include <tuple>
#include <cstdint>
#include <cstdio>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <deque>
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#include <cctype>
#include <functional>
#include <ctime>
#include <cmath>
#include <limits>
#include <numeric>
#include <type_traits>
#include <iomanip>
#include <float.h>
#include <math.h>
using namespace std;
using ll = long long;

unsigned euclidean_gcd(unsigned a, unsigned b) {
    if (a < b) return euclidean_gcd(b, a);
    unsigned r;
    while ((r = a % b)) {
        a = b;
        b = r;
    }
    return b;
}

ll ll_gcd(ll a, ll b) {
    if (a < b) return ll_gcd(b, a);
    ll r;
    while ((r = a % b)) {
        a = b;
        b = r;
    }
    return b;
}

class UnionFind {
public:
    vector <ll> par;
    vector <ll> siz;
    UnionFind(ll sz_) : par(sz_), siz(sz_, 1LL) {
        for (ll i = 0; i < sz_; ++i) par[i] = i;
    }
    void init(ll sz_) {
        par.resize(sz_);
        siz.assign(sz_, 1LL);
        for (ll i = 0; i < sz_; ++i) par[i] = i;
    }
    ll root(ll x) {
        while (par[x] != x) {
            x = par[x] = par[par[x]];
        }
        return x;
    }
    bool merge(ll x, ll y) {
        x = root(x);
        y = root(y);
        if (x == y) return false;
        if (siz[x] < siz[y]) swap(x, y);
        siz[x] += siz[y];
        par[y] = x;
        return true;
    }

    bool issame(ll x, ll y) {
        return root(x) == root(y);
    }

    ll size(ll x) {
        return siz[root(x)];
    }
};

long long modpow(long long a, long long n, long long mod) {
    long long res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}

long long modinv(long long a, long long mod) {
    return modpow(a, mod - 2, mod);
}

int main() {
    ll n, a, b;
    cin >> n >> a >> b;
    if (abs(a - b) % 2 == 0)cout << "Alice" << endl;
    else cout << "Borys" << endl;
}

Measured memory_bytes: 3632
from math import ceil
a, b = map(int, input().split())

a_min, a_max = ceil(a/0.08), ceil((a+1)/0.08)
b_min, b_max = ceil(b/0.1), ceil((b+1)/0.1)

l = set(range(a_min, a_max)) & set(range(b_min, b_max))
ans = '-1' if len(l) == 0 else min(l)
print(ans)


Measured memory_bytes: 9176
//Created by Kira

#include<bits/stdc++.h>
using namespace std;

#define IOS cin.sync_with_stdio(0);cin.tie(0); cout.tie(0);
#define all(x) x.begin(), x.end()
#define sz(x) (int)x.size()
#define pii pair<int,int> 
#define pb push_back
#define vi vector<int> 
using ll = long long;

const int mod = 1e9 + 7;

ll pwr(ll a, ll b);
    
const int N = 1e5 + 10;
vi g[N];

int ans; 

 vi a;



int main(){
   IOS

   int n, m; cin>>n>>m;
 
  
    a.resize(n);

    ans = 0;
   for(int & x : a)cin>>x;

    for(int i = 0; i < m; i++){
        int u, v; cin>>u>>v; u--, v--;
        g[u].pb(v);
        g[v].pb(u);
    }
    

    for(int i = 0; i < n; i++){
        bool flag = true;
        for(int j : g[i]){
            if(a[j] >= a[i])
                flag = false;
        }
        if(flag)ans++;
    }
    

    cout<<ans;







}

ll pwr(ll a, ll b){
   a %= mod;	//Remove mod if not required
   ll res = 1;
   while(b > 0){
    if(b&1)
        res = res * a % mod;
        a = a * a % mod;
    b >>= 1;
    }

    return res;
}



Measured memory_bytes: 8708
#include <bits/stdc++.h>
#define f first
#define s second
#define fore(i,a,b) for(int i = (a), ThxMK = (b); i < ThxMK; ++i)
#define pb push_back
#define all(s) begin(s), end(s)
#define lb(c, x) distance((c).begin(), lower_bound(all(c), (x)))
#define ub(c, x) distance((c).begin(), upper_bound(all(c), (x)))
#define _ ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define sz(s) int(s.size())
#define ENDL '\n'
#define vv(type, name, h, ...) vector<vector<type>> name(h, vector<type>(__VA_ARGS__))
#define vvv(type, name, h, w, ...) vector<vector<vector<type>>> name(h, vector<vector<type>>(w, vector<type>(__VA_ARGS__)))
using namespace std;
typedef long double ld;
typedef long long lli;
typedef pair<int,int> ii;
typedef vector<int> vi;
typedef vector<lli> vl;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
typedef vector<ii> vii;

#define deb(x) cout << #x": " << (x) << endl;

const int N = 1e3;
const lli INF = 1e18;
const lli MOD = 1e9+7;
const ld EPS = 1e-4;

vi primes(1,2);
vector<vector<ld>>nk;
void sieve(){
	vi m(N+1,0);
	for(int i = 4; i<N; i+=2)m[i]=1;
	for(int i = 3; i*i<=N; i+=2)if(!m[i])for(int j = i*i; j<N; j+=i)m[j]=1;
	for(int i = 3; i<N; i+=2)if(!m[i])primes.pb(i);
}

void pascal(){
	nk =vector<vector<ld>>(N,vector<ld>(N,0.0));
	fore(i,0,N)nk[i][0]=nk[i][i]=1.0;
	fore(i,1,N)fore(j,1,i)nk[i][j]=nk[i-1][j-1]+nk[i-1][j];
}

lli gcd(lli a, lli b){return (b?gcd(b,a%b):a);}

lli lcm(lli a, lli b){
	if(a<b)swap(a,b);
	lli c = gcd(a,b);
	a/=c;
	return a*b;
}

int popcount(lli x) { return __builtin_popcountll(x); }

lli poww(lli a, lli b){
	lli res =1;
	while(b){
		if(b&1) res = res * a;
		a = a*a;
		b/=2;
	}
	return res;
}

lli powm(lli a, lli b){
	lli res =1;
	while(b){
		if(b&1) res = (res * a)%MOD;
		a = (a*a)%MOD;
		b/=2;
	}
	return res;
}

bool isPrime(lli x){
	if(x==1)return 0;
	for(auto i:primes){
		if(i*i>x)return 1;
		if(x%i==0)return 0;
	}
	return 1;
}


lli SUM(lli a, lli b, lli mod=MOD){
	return (a+b+mod)%mod;
}

lli PROD(lli a, lli b, lli mod=MOD){
	a%=mod; b%=mod;
	return a*b % mod;
}

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

vvi graph(int n, int m){
	vv(int,v,n+1,0);
	fore(i,0,m){
		int a,b; cin>>a>>b;
		v[a].pb(b);
		v[b].pb(a);
	}
	return v;
}

// ---- コーディングはここから！ ('-')7


void solve(){
	int n; cin>>n;
	vi dp(n+1,1);
	dp[0]=dp[1]=dp[2]=0;
	fore(i,2,n+1)fore(j,3,i)dp[i]=SUM(dp[i],dp[i-j]);
	cout<<dp[n]<<ENDL;
}
int main(){_
	//int t; cin>>t; while(t--)

	solve();
}


Measured memory_bytes: 3656
FAST_IO = 0
if FAST_IO:
    import io, sys, atexit
    rr = iter(sys.stdin.read().splitlines()).next
    sys.stdout = _OUTPUT_BUFFER = io.BytesIO()
    @atexit.register
    def write():
        sys.__stdout__.write(_OUTPUT_BUFFER.getvalue())
else:
    rr = raw_input
rri = lambda: int(rr())
rrm = lambda: map(int, rr().split())

####

def solve(X):
    a = 100
    t = 0
    while a < X:
        a *= 1.01
        a = int(a)
        t += 1
    return t

print solve(rri())


Measured memory_bytes: 65848
A = list(list(map(int, input().split())) for i in range(3))
N = int(input())
B = [int(input()) for i in range(N)]
result = [[0]*3 for i in range(3)]
#print(A, N, B, result)

for i in range(3):
    for j in range(3):
        for k in range(N):
            #print(A[i][j], B[k])
            if A[i][j] == B[k]:
                result[i][j] = 1
                break
            else:
                result[i][j] = 0

if (result[0][0]==1 and result[0][1]==1 and result[0][2]==1) \
or (result[1][0]==1 and result[1][1]==1 and result[1][2]==1) \
or (result[2][0]==1 and result[2][1]==1 and result[2][2]==1) \
or (result[0][0]==1 and result[1][0]==1 and result[2][0]==1) \
or (result[0][1]==1 and result[1][1]==1 and result[2][1]==1) \
or (result[0][2]==1 and result[1][2]==1 and result[2][2]==1) \
or (result[0][0]==1 and result[1][1]==1 and result[2][2]==1) \
or (result[0][2]==1 and result[1][1]==1 and result[2][0]==1) :
    print('Yes')
else:
    print('No')


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

int64_t lcm(int64_t a, int64_t b){
  int64_t c = max(a, b), d = min(a, b), g;
  priority_queue<int64_t> pq;
  for(int i = 1; i <= pow(d, 0.5); ++i){
    if(d % i == 0){
      if(c % i == 0) g = i;
      if(c % (d / i) == 0){
        g = d / i;
        break;
      }
    }
  }
  return c / g * d;
}

int64_t div2(int64_t n){
  int64_t c = 0;
  while(n % 2 == 0){
    ++c;
    n /= 2;
  }
  return c;
}

int main() {
  int64_t n, m, d = 1;
  cin >> n >> m;
  bool b = 1;
  vector<int64_t> v(n);
  for(int i = 0; i < n; ++i){
    cin >> v[i];
    v[i] /= 2;
    if(div2(v[i]) != div2(v[0])){
      b = 0;
      break;
    }
    d = lcm(d, v[i]);
    if(d > m) break;
  }
  if(b) cout << ((m / d) + 1) / 2 << endl;
  else cout << 0 << endl;
}

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

ll gcd(ll a, ll b) {
  if(b == 0) return a;
  return gcd(b, a % b);
}

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  ll N;
  cin >> N;
  vector<ll> T(N);
  REP(i, N) cin >> T[i];
  ll ans = T[0];
  for(ll i = 1; i < N; i++) {
    ans = ans / gcd(ans, T[i]) * T[i];
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
import qualified Data.ByteString.Char8 as BC
import Data.Maybe
import qualified Data.IntMap as IM

type Map = IM.IntMap Int

readIntsLine :: IO [Int]
readIntsLine = map (fst . fromJust . BC.readInt) . BC.words <$> BC.getLine

countUp :: Int -> Int -> Map -> Map
countUp = IM.insertWithKey f
  where f _ new old = old + new

solve :: [Int] -> Map -> Map
solve [] m = m
solve (a:as) m = solve as next
  where next = countUp (a + 1) 1 $ countUp (a - 1) 1 $ countUp a 1 m

main :: IO ()
main = do
  getLine
  as <- readIntsLine
  print . maximum . map snd . IM.toList $ solve as IM.empty

Measured memory_bytes: 43388
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
#define REP(i,n) for (ll i = 0; i < (n); ++i)
#define RREP(i, n) for (ll i = (n) - 1; i >= 0; --i)
#define ALL(v) (v).begin(), (v).end()
template<class T>
using reverse_priority_queue = priority_queue<T, vector<T>, greater<T>>;


int main(){
    ll n;
    cin >> n;
    ll prev = 0;
    ll ans = 0;
    REP(i, n){
        ll ai;
        cin >> ai;
        ll step = max(prev - ai, 0LL);
        ans += step;
        prev = ai + step;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3628
#include <bits/stdc++.h>
using namespace std;
int main() {
 string R;
 int S,count=0;
 cin >> R ;
for(int i=0;i<(R.size()/2);i++){
   S=R.size()-i-1;
   if(R.at(i)!=R.at(S))
      ++count;
}
 cout << count << endl;
}

Measured memory_bytes: 256
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define rep2(i,n) for(int i=0;i<=n;i++)
#define repr(i,a,n) for(int i=a;i<n;i++)
#define all(a) a.begin(),a.end()
#define P pair<long long,long long>
#define uni(e) e.erase(unique(e.begin(),e.end()),e.end())
#define double long double
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; }
int INF=1e10;
int MOD=1e9+7;
template<class T> void out(T a){cout<<a<<'\n';}
template<class T> void yesno(T b){if(b)out("yes");else out("no");}
template<class T> void YesNo(T b){if(b)out("Yes");else out("No");}
template<class T> void YESNO(T b){if(b)out("YES");else out("NO");}
template<class T> void noyes(T b){if(b)out("no");else out("yes");}
template<class T> void NoYes(T b){if(b)out("No");else out("Yes");}
template<class T> void NOYES(T b){if(b)out("NO");else out("YES");}
int keta(int a){
  double b=a;
  b=log10(b);
  int c=b;
  return c+1;
}
int kurai(int a,int b){
  int m=pow(10,b),n=pow(10,b-1);
  return (a%m)/n;
}
int ketawa(int a){
  int k=0;
  rep(i,keta(a)){
  k+=kurai(a,i+1);
  }
  return k;
}
int gcd(int a,int b){
  if(a%b==0)
    return b;
  return gcd(b,a%b);
}
int lcm(int a,int b){
    return a/gcd(a,b)*b;
}
int mid(int a,int b,int c){
  vector<int> k(3);
  k[0]=a;k[1]=b;k[2]=c;
  sort(all(k));
  return k[1];
}
bool sosuu(int a){
  bool b=1;
  if(a<=1)
    return 0;
  else{
  rep1(i,sqrt(a)-1){
  if(a%(i+1)==0)
  b=0;
  }
  return b;
  }
}
int modpow(int a,int b,int m=MOD){
 if(!b)return 1; if(b&1)return modpow(a,b-1,m)*a%m;
 int memo = modpow(a,b>>1,m);
 return memo*memo%m;
}
int fact_mod(int n) {
    int f=1; 
for(int i=2;i<n+1;i++) f=f*(i%MOD)% MOD;
    return f;
}
int mod_pow(int x,int n) {
    int res=1;
    while(n>0){
        if(n&1) res=(res*x)%MOD; 
        x=(x*x)%MOD;        
n>>=1; 
    }
    return res;
}
int c_mod(int n, int r) {
    if(r>n-r) r=n-r;
    if(r==0) return 1;
    int a=1;
    rep(i,r) 
a=a*((n-i)%MOD)%MOD;
    int b=mod_pow(fact_mod(r), MOD-2);
    return (a%MOD)*(b%MOD)%MOD;
}
signed main(){
  int a;
  cin>>a;
  string b,c,d;
  cin>>b>>c>>d;
  int g=0;
  rep(i,a){
  if(b[i]==c[i]&&c[i]==d[i])
    g+=0;
  else if(b[i]!=c[i]&&c[i]!=d[i]&&d[i]!=b[i])
    g+=2;
    else
      g+=1;
  }
  out(g);
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define pq priority_queue
#define mp make_pair
#define cauto const auto &

#define REP(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i)
#define all(x) (x).begin(), (x).end()
#define SZ(x) ((int)(x).size())

#define clr(ar, val) memset(ar, val, sizeof(ar))

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

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

using namespace std;

typedef long long int64;
typedef long long lint;
typedef long long lli;
typedef long long ll;
typedef unsigned int uint;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef pair<ll, int> pli;
typedef pair<int, ll> pil;
typedef pair<ll, ll> pll;

const int iinf = 1 << 29;
const long long linf = 1ll << 61;

int h,w;
int main() {
    cin>>h>>w;
    char s[h][w];

    REP(i,h){
        REP(j,w){
            cin>>s[i][j];
        }
    }
    REP(i,h){
        REP(j,w){
            if(s[i][j]=='#'){
                bool adjacent=0;
                REP(k,4){
                    if(s[i+dx[k]][j+dy[k]]=='#') adjacent=1;
                }
                if(!adjacent){
                    cout<<"No"<<endl;
                    return 0;
                }
            }
        }
    }
    cout<<"Yes"<<endl;
    return 0;
    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <deque>
using namespace std;

int dist[100100];

int main()
{
	int K; scanf("%d", &K);
	for (int i=0;i<K;i++) dist[i] = 1000000;
	deque<int> Q;
	Q.push_back(1); dist[1] = 1;
	while (!Q.empty()){
		int x = Q.front(); Q.pop_front();
		int y = x * 10 % K;
		int z = (x + 1) % K;

		if (dist[y] > dist[x]){
			Q.push_front(y);
			dist[y] = dist[x];
		}

		if (dist[z] > dist[x] + 1){
			Q.push_back(z);
			dist[z] = dist[x] + 1;
		}
	}

	printf("%d\n", dist[0]);

	return 0;
}

Measured memory_bytes: 816
import math
N = int(input())
ans = 0
s = 0
primes = [2]
i = 3
while i <= N:
    all(i % p != 0 for p in primes) and primes.append(i)
    i += 2
l = [0] * len(primes)
for i, p in enumerate(primes):
    j = 1
    while p ** j <= N:
        l[i] += (N // (p ** j))
        j += 1
ans = 1
for n in l:
    ans *= (n + 1)
print(ans % (10 ** 9 + 7))

Measured memory_bytes: 3064
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <cstdio>
#include <cmath>
#include <tuple>
#define rep(i, n) for(i = 0; i < n; i++)
#define int long long
using namespace std;

//n以下の非負整数のうち、xで割り切れるものの個数
int f(int n, int x) {
	return n / x + 1;
}

int f(int a, int b, int x) {
	return f(b, x) - f(a - 1, x);
}

int gcd(int a, int b) {
	if (b == 0) return a;
	return gcd(b, a % b);
}

int lcm(int a, int b) {
	return a / gcd(a, b) * b;
}

signed main() {
	int a, b, c, d;
	
	cin >> a >> b >> c >> d;
	int cnt = f(a, b, c) + f(a, b, d) - f(a, b, lcm(c, d));
	int ans = b - a + 1 - cnt;
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
import sys
def cmb(n, r, mod):
    if ( r<0 or r>n ):
        return 0
    r = min(r, n-r)
    return g1[n] * g2[r] * g2[n-r] % mod
X,Y=map(int,input().split())
if (X+Y)%3!=0:
  print(0)
  sys.exit()
c=(X+Y)//3
if c>X or c>Y:
  print(0)
  sys.exit()
b=X-c
a=Y-c
mod = 10**9+7
N =a+b
g1 = [1, 1]
g2 = [1, 1]
inverse = [0, 1] 

for i in range( 2, N + 1 ):
    g1.append( ( g1[-1] * i ) % mod )
    inverse.append( ( -inverse[mod % i] * (mod//i) ) % mod )
    g2.append( (g2[-1] * inverse[-1]) % mod )
print(cmb(a+b,a,mod))

Measured memory_bytes: 88108
s = gets.chomp

case s
  when 'SUN' then
    puts 7
  when 'MON' then
    puts 6
  when 'TUE' then
    puts 5
  when 'WED' then
    puts 4
  when 'THU' then
    puts 3
  when 'FRI' then
    puts 2
  when 'SAT' then
    puts 1
end
    

Measured memory_bytes: 1788
#include <bits/stdc++.h>
#define re return
#define ull unsigned long long
#define ll long long
#define ld long double
#define oo 1e9
#define pi 3.1415926536
#define OO 1e18
#define EPS 1e-7
#define FX(n) fixed<<setprecision(n)
#define mm(o,k) memset(o,k,sizeof o)
#define Hossam_Yehia ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
using namespace std;
int n,p,x;
ll odd,even;
template <typename T>
T power(T base,T exp) {
    T result = 1;
    while (exp > 0) {
        if (exp & 1) result = (result * base);
        base = (base * base);
        exp >>= 1;
    }
    re result;
}
int main(){
    Hossam_Yehia;
    cin >> n >> p;
    while(n--){
        cin >> x;
        odd+=(x%2);
        even+=(x%2==0);
    }
    if(p&&!odd)re cout<<0,0;
    if(!odd)++odd;
    cout<<power(2LL,even)*power(2LL,odd-1)<<endl;
    re 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define FOR(i, a, b) for(int i=(a);i<(b);++i)
#define rep(i, n) FOR(i, 0, n)
#define rep1(i, n) FOR(i, 1, n+1)
#define rrep(i, n) for (int i = ((int)(n)-1); i >= 0; --i)
#define whole(x) (x).begin(),(x).end()
#define rwhole(x) (x).rbegin(), (x).rend()
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end())
#define P pair<int, int>
#define debug(var) cerr << "[" << #var << "] " << var << endl
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
const ll mod = 1000000007;
const int dx[] = {-1,0,1,0};
const int dy[] = {0,-1,0,1};


int main(){
    string s[3];
    rep(i, 3) cin >> s[i];
    int index[3] = {0, 0, 0};
    int now = 0;
    char ans;
    while (1) {
        if (index[now]==s[now].size()) {
            ans = 'A' + now;
            break;
        }
        int next = s[now][index[now]] - 'a';
        index[now]++;
        now = next;
    }
    
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3592
#include <bits/stdc++.h>
#define rep(i, a, n) for (int i = (a); i < n; i++)
#define print(x) cout << x << endl;
using namespace std;
typedef long long ll;

int calc_digit(int n, int k) {
    int res = 0;
    while(n > 0) {
        res++;
        n /= k;
    }
    return res;
}


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

    cout << calc_digit(N, K) << endl;

    return 0;
}

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

int main(){
    int N;
    cin >> N;
    vector<long long> A(N);
    for (int i = 0; i < N; i++){
        cin >> A.at(i);
    }
    map<long long, long> left;
    map<long long, long> right;
    for(int i = 0; i < N; i++){
        left[i - A.at(i)]++;
        right[i + A.at(i)]++;
    }
    long long ans = 0;
    for(int i = 0; i < N; i++){
        ans += left[i] * right[i];
    }
    cout << ans << endl;
}




Measured memory_bytes: 47376
#include<iostream>
#include<vector>
#include<map>
#include<string>

using namespace std;

int main(void){
	string s;
	int length=0,max=0;
	map<string,int> sen;
	vector<string> w;
	while(cin >>s){
		w.push_back(s);
		if(sen.find(s)!=sen.end()){
			sen[s]++;
		}else{
			sen.insert( pair<string, int>(s,1));
		}
	}
	map<string,int>::iterator p;
	for(p = sen.begin() ; p !=sen.end() ; p++){
		if( max < p->second) max = p->second;
	}
	for(p = sen.begin() ; p !=sen.end() ; p++){
		if( max == p->second){
			cout << p->first << " ";
			break;
		}
	}
	for(int i=0 ; i<w.size() ; i++){
		if( length < w[i].size() ) length = w[i].size();
	}
	for(int i=0 ; i<w.size() ; i++){
		if( length==w[i].size() ){
			cout << w[i] << endl;
			break;
		}
	}
    return 0;
}

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

#define max(a,b) ((a)>(b)?(a):(b))
#define min(a,b) ((a)<(b)?(a):(b))
#define abs(a) max((a),-(a))
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define repe(i,n) rep(i,(n)+1)
#define per(i,n) for(int i=(int)(n)-1;i>=0;i--)
#define pere(i,n) rep(i,(n)+1)
#define all(x) (x).begin(),(x).end()
#define SP <<" "<<
#define RET return 0
#define MOD 1000000007
#define INF 100000000000000000

typedef long long LL;
typedef long double LD;

struct miti{
  int t;
  int d;
  LL e;
};

struct edge{
  pair<int,int> t;
  LL e;
  bool operator<(const struct edge& r) const{
    return e>r.e;
  }
};

int main(){
  while(1){
    int n,m,l;
    cin >> n >> m >> l;
    if(n==0) return 0;
    vector<list<struct miti>> e(n);
    int a,b,d,ee;
    for(int i=0;i<m;i++){
      cin >> a >> b >> d >> ee;
      e[a-1].push_back({b-1,d,ee});
      e[b-1].push_back({a-1,d,ee});
    }
    vector<vector<LL>> dist(n,vector<LL>(l+1,INF));
    dist[0][l]=0;
    priority_queue<struct edge> dijk;
    for(auto ei:e[0]){
      if(l-ei.d>=0) dijk.push({{ei.t,l-ei.d},0});
      dijk.push({{ei.t,l},ei.e});
    }
    struct edge ed;
    while(!dijk.empty()){
      ed=dijk.top();
      dijk.pop();
      if(dist[ed.t.first][ed.t.second]==INF){
        dist[ed.t.first][ed.t.second]=ed.e;
        for(auto ei:e[ed.t.first]){
          if(ed.t.second-ei.d>=0){
            if(dist[ei.t][ed.t.second-ei.d]==INF){
              dijk.push({{ei.t,ed.t.second-ei.d},ed.e});
            }
          }
          if(dist[ei.t][ed.t.second]==INF){
            dijk.push({{ei.t,ed.t.second},ed.e+ei.e});
          }
        }
      }
    }
    LL ans=INF;
    for(int i=0;i<=l;i++){
      ans=min(ans,dist[n-1][i]);
    }
    cout << ans << endl;
  }
  return 0;
}



Measured memory_bytes: 9348
#include <bits/stdc++.h>
using namespace std;
int main()
{
    queue<long long>A;
    for (long long i = 1;i<=9;i++){
        A.push(i);
    }
    long long k;
    cin>>k;
    long long x;
    while (k--){
        x = A.front();
        A.pop();
        if ((x%10)!=0)
            A.push( 10 * x + (x % 10) - 1 );
        A.push(10*x+x%10);
        if ((x%10)!=9)
            A.push( 10 * x + (x % 10) + 1 );
    }
    cout<<x<<endl;
    return 0;
}

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

#define int long long

#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=(int)a, i##_len=(b); i<i##_len; i++)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)

#define all(box) box.begin(), box.end()

using namespace std;

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

const long long INF = LLONG_MAX/3;

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

struct UnionFind{
	std::vector<int> par,siz;
	void init(int n){
		par.resize(n);
		for(int i=0;i<n;i++)par[i]=i;
		siz.resize(n,1);
	}
	UnionFind(int n){
		init(n);
	}
	int root(int n){
		if(par[n]==n)return n;
		else return par[n]=root(par[n]);
	}
	bool issame(int x,int y){
		return (root(x)==root(y));
	}
	bool marge(int a,int b){
		if(issame(a,b))return false;
		else{
			a=root(a),b=root(b);
			if(siz[a]<siz[b])swap(a,b);
			siz[b]+=siz[a];
			par[a]=par[b];
			return true;
		}
	}
	int size(int n){
		return siz[root(n)];
	}
};

long long gcd(long long a,long long b){
    if(b==0)return a;
    return gcd(b,a%b);
}
long long lcm(long long i,long long j){
    return i*(j/gcd(i,j));
}

const int MOD=1e9+7;
long long fac[510000], finv[510000], inv[510000];
long long MAX=510000;
bool COMinited=false;
long long COM(int n, int k){
	if(COMinited==false){
		fac[0] = fac[1] = 1;
    	finv[0] = finv[1] = 1;
    	inv[1] = 1;
    	for (int i = 2; i < MAX; i++){
        	fac[i] = fac[i - 1] * i % MOD;
        	inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        	finv[i] = finv[i - 1] * inv[i] % MOD;
    	}
		COMinited=true;
	}
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
long long modpow(long long a, long long n, long long mod) {
    long long res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}
long long modinv(long long a, long long mod) {
    return modpow(a, mod - 2, mod);
}
template< typename T >
struct BinaryIndexedTree {
  vector< T > data;

  BinaryIndexedTree(int sz) {
    data.assign(++sz, 0);
  }

  T sum(int k) {
    T ret = 0;
    for(++k; k > 0; k -= k & -k) ret += data[k];
    return (ret);
  }

  void add(int k, T x) {
    for(++k; k < data.size(); k += k & -k) data[k] += x;
  }
};
signed main(){
	int n;
	cin>>n;
	int c[100010]={};
	rep(i,n){
		int a;
		cin>>a;
		c[a-1]++;
	}
	int s=0;
	rep(i,100010){
		if(c[i]>0)s+=c[i]-1;
	}
	cout<<n-(s+1)/2*2<<endl;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int INF = 0x3F3F3F3F;
const int maxn = 2e5 + 555;
const int MOD = 1e9 + 7;
int32_t main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    cout.precision(10);
    cout << fixed;
    string a, b;
    int ans = 0;
    cin >> a >> b;
    for (int i = 0; i < (int)a.size(); i++)
        ans += a[i] != b[i];
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3876
#include <iostream>

using namespace std;

int main() {
	char s1, s2, s3;
	cin >> s1 >> s2 >> s3;

	int count = 0;

	if (s1 == '1') {
		count++;
	}

	if (s2 == '1') {
		count++;
	}

	if (s3 == '1') {
		count++;
	}

	cout << count << endl;

}

Measured memory_bytes: 256
N,K=map(int, input().split())
A=[[0]*(2*K) for j in range(2*K)]
for i in range(N):
  x,y,a=input().split()
  x,y=int(x),int(y)
  if a=='B':
    y+=K
  x=x%(2*K)
  y=y%(2*K)
  A[y][x]+=1
def da_generate(h,w,a):
    da = [[0]*w for j in range(h)]
    da[0][0] = a[0][0]
    for i in range(1,w):
        da[0][i] = da[0][i-1]+a[0][i]
    for i in range(1,h):
        cnt_w = 0
        for j in range(w):
            cnt_w += a[i][j]
            da[i][j] = da[i-1][j]+cnt_w
    return da

#da_calc(p,q,x,y):(p,q)~(x,y)の長方形の和
def da_calc(p,q,x,y):
    if p > x or q > y:
        return 0
    if p == 0 and q == 0:
        return da[x][y]
    if p == 0:
        return da[x][y]-da[x][q-1]
    if q == 0:
        return da[x][y]-da[p-1][y]
    return da[x][y]-da[p-1][y]-da[x][q-1]+da[p-1][q-1]
f=2*K
da=da_generate(f,f,A)
ans=0
for i in range(K+1):
  for j in range(K+1):
    a=da_calc(j,i,j+K-1,i+K-1)   
    y1,y2,x1,x2=i,i+K-1,j,j+K-1
    if x1>0 and y1>0:
      a+=da_calc(0,0,x1-1,y1-1)
    if x1>0 and y2<f:
      a+=da_calc(0,y2+1,x1-1,f-1)
    if x2<f and y1>0:
      a+=da_calc(x2+1,0,f-1,y1-1)
    if x2<f and y2<f:
      a+=da_calc(x2+1,y2+1,f-1,f-1)
    ans=max(ans,a,N-a)
print(ans)

Measured memory_bytes: 139204