akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>

#define int long long
#define fast_io(); ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define loop(i,a,b) for(int i=a;i<b;i++)
#define all(x) x.begin(),x.end()
#define us unordered_set
#define um unordered_map
#define ms multiset
#define mm multimap
#define pb push_back
#define pf push_front
#define ins insert
#define mp make_pair
#define mt make_tuple
#define fi first
#define se second
#define _max max_element
#define _min min_element
#define tc(T) int T; cin>>T; while(T--)
#define q(q) int q; cin>>q; while(q--)
#define pi 3.1415926535897932384626433832
const int pinf=((int)2e18);
const int ninf=((int)-2e18);
const int mod=1000000007;

using namespace std;

int power(int x,int n,int M)
{
    if(n==0)
        return 1;
    else if(n%2 == 0)
        return power((x*x)%M,n/2,M);
    else
        return (x*power((x*x)%M,(n-1)/2,M))%M;
}

bool vowel(char c)
{
    return(c=='a' or c=='e' or c=='i' or c=='o' or c=='u' or c=='A' or c=='E' or c=='I' or c=='U' or c=='O');
}

int32_t main()
{
    fast_io();

    //FILE *fptr1=freopen("in.txt","r",stdin);
    //FILE *fptr2=freopen("out.txt","w",stdout);

    int n,x;
    cin>>n;
    map <int,int> m;
    loop(i,0,n)
    {
        cin>>x;
        m[x]++;
        if(m[x]>1)
        {
            cout<< "NO";
            return 0;
        }
    }
    cout<< "YES";

    return 0;
}


Measured memory_bytes: 16116
game_count = int(input())
point_p1 = 0
point_p2 = 0

for _ in range(game_count):
    card_p1, card_p2 = input().split()
    
    if card_p1 < card_p2:
        point_p2 += 3
    elif card_p1 > card_p2:
        point_p1 += 3
    else:
        point_p1 += 1
        point_p2 += 1

print(point_p1, point_p2)


Measured memory_bytes: 5600
N = input()
dic = {}
for i in range(N):
	s = raw_input()
	if s not in dic.keys():
		dic[s] = 0
	dic[s] += 1
	

M = input()
for i in range(M):
	t = raw_input()
	if t not in dic.keys():
		dic[t] = 0
	dic[t] -= 1
print max(0, max(dic.values()))




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

using namespace std;

int main(){
	string s; cin >> s;
	int sum = 0;
	for(int i = 0; i < s.size(); i++) {
		sum += s[i] - '0';
	}
	if(sum % 9 == 0) cout << "Yes\n";
	else cout << "No\n";
	
	return 0;
}


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

int main() {
  int A, B;
  cin >> A >> B;
  int ans = 1;
  
  if (B == 1){
    ans = 0;
    cout << ans << endl;
  }  
  else {
    while ((A*ans-ans+1) < B){
      ans++;
    }
    cout << ans << endl;
  }
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <iomanip>
#include <vector>
#include <queue>
#include <set>
#include <map>

using namespace std;
typedef long long ll;

int N, K;
ll A[200000];
ll imos[200001];
bool all_n(){
    for(int i = 0; i < N; i++){
        if(A[i] != N) return false;
    }
    return true;
}

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << setprecision(10) << fixed;
    cin >> N >> K;
    for(int i = 0; i < N; i++){
        cin >> A[i];
    }
    for(int i = 0; i < K; i++){
        for(int j = 0; j <= N; j++) imos[j] = 0;
        for(int j = 0; j < N; j++){
            int l = max((ll)0, j-A[j]);
            int r = min((ll)N-1, j+A[j]);
            imos[l]++;
            imos[r+1]--;
        }
        
        for(int j = 1; j <= N; j++) imos[j] += imos[j-1];
        for(int j = 0; j < N; j++){
            A[j] = min((ll)N, imos[j]);   
        }
        if(all_n()) break;
    }
    for(int i = 0; i < N; i++) cout << A[i] << ' ';
    cout << endl;
}

Measured memory_bytes: 6824
#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <cstring>
#include <cmath>
#include <climits>
#include <deque>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <array>
#include <bitset>
#include <cstring>
#include <deque>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
using namespace std;
#define io() ios_base::sync_with_stdio(false); cin.tie(nullptr)
#define ll long long
#define ull unsigned long long
#define ui unsigned int
#define us unsigned short
#define fi first
#define se second
#define IN(i,l,r) (l<i&&i<r)
#define LINR(i,l,r) (l<=i&&i<=r)
#define LIN(i,l,r) (l<=i&&i<r)
#define INR(i,l,r) (l<i&&i<=r)
#define v(T) vector<T>
#define p(T, N) pair<T, N>
#define tp(A, B, C) tuple<A, B, C>
#define ii p(int, int)
#define vi v(int)
#define vii v(p(int, int))
#define vvi v(v(int))
#define vl v(long long)
#define vll v(p(long long, long long))
#define si set<int>
#define msi map<string, int>
#define rsz(a) resize(a)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define qsort(a) sort(all(a))
#define qsortd(a) sort(all(a), greater<>())
#define qsortf(a, f) sort(all(a), f)
#define qsortsi(v) sort(v.begin(), v.end(), [](pair<int, int> a, pair<int, int> b){return a.se < b.se;})
#define pb(n) push_back(n)
#define eb(n) emplace_back(n)
#define pp(a, b) emplace_back(make_pair(a, b))
#define pt(a, b, c) emplace_back(make_tuple(a, b, c))
#define elif else if
#define fori(i, n) for(ll i = 0; i < n; ++i)
#define foris(i, a, b) for(ll i = a; i < b; ++i)
#define forise(i, a, b) for(ll i = a; i <= b; ++i)
#define ford(i, n) for(ll i = n; i >= 0; --i)
#define fords(i, a, b) for(ll i = a; i >= b; --i)
#define fordse(i, a, b) for(ll i = a; i > b; --i)
#define fora(i, a) for (auto &i: a)
#define rev(a) reverse(a.begin(), a.end())
#define revf(a, b, c) (reverse(a.begin() + b, a.begin() + c))
#define umap unordered_map
#define uset unordered_set
#define pq(T) priority_queue<T>
#define rpq(T) priority_queue<T, vector<T>, greater<T> >
#define nl '\n'
#define fileio(in, out) freopen(in, "r", stdin); freopen(out, "w", stdout)
const int mod = 1000000007;
int digits(int n) {
  n = abs(n);
  if(n < 10) return 1;
  elif(n < 100) return 2;
  elif(n < 1000) return 3;
  elif(n < 10000) return 4;
  elif(n < 100000) return 5;
  elif(n < 1000000) return 6;
  elif(n < 10000000) return 7;
  elif(n < 100000000) return 8;
  elif(n < 1000000000) return 9;
  else return 10;
}


int main() {
  io();
  
  int n; cin >> n;
  map<string, int> arr;
  int maxi = 0;
  fori(i, n) {
  	string s;
    cin >> s;
    if(arr.find(s) == arr.end()) {
    	arr[s] = 1;
    }
    else {
    	++arr[s];
      	maxi = max(arr[s], maxi);
    }
  }
  for (auto i = arr.begin(); i != arr.end(); ++i) {
  	if(i->second >= maxi) {
    	cout << i->first << nl;
    }
  }
  
  
  return 0;
}

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

int main() {
  string S, T; cin >> S >> T;

  rep(j, S.size()){
    char sub = S[S.size() - 1];
    rep(i, S.size()) {
      char tmp = S[i];
      S[i] = sub;
      sub = tmp;
    }

    if (S==T) {
      cout << "Yes" << endl;
      return 0;
    }
  }
  
  cout << "No" << endl;
}


Measured memory_bytes: 764
parseInt(x::String) = parse(Int, x)
parseInt(x::SubString{String}) = parse(Int, x)
parseInt(x::Char) = parse(Int, x)
parseInt(x::Float64) = trunc(Int, x)
parseFloat(x::String) = parse(Float64, x)
parseFloat(x::Int) = trunc(Float64, x)
parseFloat(x::SubString{String}) = parse(Float64, x)
parseFloat(x::Char) = parse(Float64, x)
parseMap(x::Array{SubString{String},1}) = map(parseInt, x)

function main()
    s=chomp(readline())
    n=length(s)
    for i in 1:n
        if i%2==1
            print(s[i])
        end
    end
end
main()

Measured memory_bytes: 168508
#include<iostream>
#include<iomanip>
#include<queue>
#include<string>
#include<stack>
#include<cstdio>
#include<cstdlib>
#include<cmath>
#include<cstring>
#include<cassert>
#include<ctime>
#include<algorithm>
#include<utility>
#include<map>
#include<set>
#include<vector>
#include<functional>

using namespace std;

typedef  long long           ll;
typedef  unsigned            ui;
typedef  unsigned long long  ull;
typedef  pair<int,int>       i_i;
typedef  pair<ll,int>        ll_i;
typedef  pair<ll,ll>         ll_ll;
typedef  pair<double,int>    d_i;
typedef  pair<double,double> d_d;

#ifdef DEBUG
#define dprintf      printf
#define dputs        puts
#define dout(x)      cout<<#x" = "<<(x)<<endl
#define darray(x,n)  {int i;rep(i,n)cout<<#x"["<<i<<"] = "<<*((x)+i)<<endl;}
#define dloop(i,s,g) for(int (i)=(s);(i)<(g);(i)++)
#define drep(i,n)    for(int (i)=0;(i)<(n);(i)++)
#define dstop()      scanf("%*c")
#else
#define dprintf      (1)?0:printf
#define dputs        (1)?0:puts
#define dout(x)
#define darray(x,n)
#define dloop(i,s,g) if(int i=0){}else
#define drep(i,n)    if(int i=0){}else
#define dstop()
#endif

#define F    first
#define S    second
#define pb   push_back
#define mp   make_pair

#define loop(i,s,g) for((i)=(s);(i)<(g);(i)++)
#define rep(i,n)    for((i)=0;(i)<(n);(i)++)
#define all(x)      (x.begin(),x.end())
#define in(T,...) T __VA_ARGS__; impl(__VA_ARGS__)
#define array(T,id,n) T id[(n)]; for(int i=0;i<(n);i++)cin>>id[i]
#define putv(n)     cout<<(n)<<endl

//#define int long long
#ifndef int
#define INF __INT32_MAX__
#else
#define INF __INT64_MAX__
#endif

void impl(){};
template <typename T,typename... TS >
void impl(T &head,TS &... tail)
{
  cin>>head;
  impl(tail ...);
}

signed main(void)
{
  in(int,a,b);
  if(a==b)
    putv(0);
  else if(a==0 && b!=0)
    {
      if(b<0)
	putv(-b+1);
      else
	putv(b);
    }
  else if(b==0 && a!=0)
    {
      if(a<0)
	putv(-a);
      else
	putv(a+1);
    }
  else if(a>0 && b>0)
    {
      if(a>b)
	putv(a-b+2);
      else
	putv(b-a);
    }
  else if(a==-b)
    {
      putv(1);
    } 
  else if(a>0 && b<0)
    {
      if(abs(a)<abs(b))
	putv(-b-a+1);
      else
	putv(b-(-a)+1);
    }
  else if(a<0 && b>0)
    {
      if(abs(a)<abs(b))
	putv(b-(-a)+1);
      else
	putv(-b-a+1);
    }
  else
    {
      if(a<b)
	putv(b-a);
      else
	putv(a-b+2);
    }
  
  return 0;
}


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

using namespace std;

#define INF 1000000007
#define LINF (1LL << 62)
#define PI 3.14159265358979

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

inline i64 mod(i64 a, i64 m) { return (a % m + m) % m; }

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



i64 a,b,c,d;
void solve(){
	cin >> a >> b >> c >> d;
	
	bool ok = 0;
	if(c*2 == a && d*2 == b) ok = 1;
	printf("%.10f %d\n", (double)a*b/2.0, ok);
}

int main(){
	std::cin.tie(0);
	std::ios::sync_with_stdio(false);
	int t = 1;
	//cin >> t;
	while(t--){
		solve();
	}
	
	return 0;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
// Begin Header {{{
#define all(x)          (x).begin(), (x).end()
#define rep(i, s, n)    for (i64 i = (s), i##_limit = (n); i < i##_limit; ++i)
#define repr(i, s, t)   for (i64 i = (s), i##_limit = (t); i >= i##_limit; --i)
#define var(type, ...)  type __VA_ARGS__; read(__VA_ARGS__);
#ifndef DBG
#define dump(...)
#endif
using namespace std;
using i64 = int_fast64_t;
using pii = pair<i64, i64>;
template <class T, class U> inline bool chmax(T &a, const U &b) { return b > a && (a = b, true); }
template <class T, class U> inline bool chmin(T &a, const U &b) { return b < a && (a = b, true); }
constexpr int INF  = 0x3f3f3f3f;
constexpr i64 LINF = 0x3f3f3f3f3f3f3f3fLL;

template <class T>
inline vector<T> makeV(const T &initValue, size_t sz) {
    return vector<T>(sz, initValue);
}

template <class T, class... Args>
inline auto makeV(const T &initValue, size_t sz, Args... args) {
    return vector<decltype(makeV<T>(initValue, args...))>(sz, makeV<T>(initValue, args...));
}

template <class T>
inline istream& operator>> (istream &is, vector<T> &vec) {
    for (auto &e : vec) is >> e;
    return is;
}

inline void read() {}

template <class Head, class... Tail>
inline void read(Head &head, Tail&... tail) { cin >> head; read(tail...); }

inline void print() { cout << "\n"; }

template <class Head, class... Tail>
inline void print(Head &&head, Tail&&... tail) {
    cout << head;
    if (sizeof...(tail)) cout << ' ';
    print(forward<Tail>(tail)...);
}

template <class T>
inline ostream& operator<< (ostream &os, const vector<T> &vec) {
    static constexpr const char *delim[] = { " ", "" };
    for (const auto &e : vec) os << e << delim[&e == &vec.back()];
    return os;
}

template <class Container>
struct Rev {
    Container &x_;
    inline Rev(Container &x): x_(x) {}
    inline auto begin() { return rbegin(x_); }
    inline auto end() { return rend(x_); }
};
// }}} End Header

vector<vector<int>> G;
vector<vector<int>> id;
vector<int> deg;

vector<int> ans;
bool visited[100010];

void dfs(int u, int color) {
    visited[u] = true;
    int c = 1;
    rep(i, 0, G[u].size()) {
        if (visited[G[u][i]]) continue;
        if (c == color) ++c;
        ans[id[u][i]] = c;
        dfs(G[u][i], c);
        ++c;
    }
    return;
}


signed main() {
    ios_base::sync_with_stdio(false); cin.tie(nullptr);

    var(int, N);
    G.resize(N);
    id.resize(N);
    deg.resize(N);
    ans.resize(N - 1);

    rep(i, 0, N-1) {
        var(int, a, b);
        --a, --b;
        G[a].push_back(b);
        G[b].push_back(a);
        id[a].push_back(i);
        id[b].push_back(i);
        deg[a] += 1;
        deg[b] += 1;
    }


    vector<int> nodes(N);
    iota(all(nodes), 0);
    sort(all(nodes), [](int u, int v) { return deg[u] > deg[v]; });

    rep(i, 0, N) {
        dump(id[i]);
    }

    const int R = nodes[0];
    const int K = deg[R];

    int color = 1;
    rep(i, 0, G[R].size()) {
        ans[id[R][i]] = color;
        visited[R] = true;
        dfs(G[R][i], color);
        ++color;
    }

    print(K);
    rep(i, 0, N-1) {
        print(ans[i]);
    }

    return 0;
}



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

int main() {
	int ans = 0;
	string s; cin >> s;
	char tmp = s[0];
	for (int i = 1; i < s.length(); i++) {
		if (tmp != s[i]) {
			ans++;
			tmp = s[i];
		}
	}

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 512
n=int(input())
ans=[0]*(n+1)
for i in range(1,n+1):
    ans[i] = ans[i-1]+1
    m6 = 6
    m9 = 9
    while i>=m6:
        ans[i] = min(ans[i],ans[i-m6]+1)
        m6 *= 6
    while i>=m9:
        ans[i] = min(ans[i],ans[i-m9]+1)
        m9 *= 9
print(ans[-1])

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

int main() {
  int A, B;
  cin >> A >> B;
  int x, y, z;
  x = A + B;
  y = A - B;
  z = A * B;
  if (x > max(y, z)){
    cout << x << endl;
  }
  else {
    cout << max(y, z) << endl;
  }
}



Measured memory_bytes: 256
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include <cstring>
#include <climits>
#include <sstream>
using namespace std;
static const double EPS = 1e-5;
typedef long long ll;


int f(int a,int b,int i){
	int idx=0;
	int s=0;
	a=a-a/b*b;
	while(idx<i){
		a*=10;
		s+=a/b;
		++idx;
		a=a-a/b*b;
	}
	return s;
}

main(){
	int a,b,n;
	while(cin>>a>>b>>n){
		cout<<f(a,b,n)<<endl;
	}
}

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

using namespace std;
typedef long long ll;

#define REP(i, n) for (ll i = 0; i < (ll)(n); i++)
#define REPD(i, n) for (ll i = (ll)(n)-1; i >= 0; i--)
#define FOR(i, a, b) for (ll i = (a); i <= (b); i++)
#define FORD(i, a, b) for (ll i = (a); i >= (b); i--)
#define ALL(x) (x).begin(), (x).end()
#define SIZE(x) ((ll)(x).size())
#define MAX(x) *max_element(ALL(x))
#define MIN(x) *min_element(ALL(x))
#define INF 1000000000000
#define MOD 1000000007
#define PB push_back
#define MP make_pair
#define F first
#define S second

void solve() {
  string s;
  cin >> s;
  if (s[2] == s[3] && s[4] == s[5]) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
}

signed main() {
  solve();

  return 0;
}

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

int main(void) {
    ll N;
    ll ans = 0;
    int i = 0;
    cin >> N;
    while (true) {
        i++;
        ans = i * i;
        if (N < ans) break;
    }
    cout << (i-1)*(i-1) << endl;
    return 0;
}


Measured memory_bytes: 256
import sys
from sys import exit
from collections import deque
from copy import deepcopy
from bisect import bisect_left, bisect_right, insort_left, insort_right
from heapq import heapify, heappop, heappush
from itertools import product, permutations, combinations, combinations_with_replacement
from functools import reduce
from math import gcd, sin, cos, tan, asin, acos, atan, degrees, radians

sys.setrecursionlimit(10**6)
INF = 10**20
eps = 1.0e-20
MOD = 10**9+7

def lcm(x,y):
    return x*y//gcd(x,y)
def lgcd(l):
    return reduce(gcd,l)
def llcm(l):
    return reduce(lcm,l)
def powmod(n,i,mod=MOD):
    return pow(n,mod-1+i,mod) if i<0 else pow(n,i,mod)
def div2(x):
    return x.bit_length()
def div10(x):
    return len(str(x))-(x==0)
def intput():
    return int(input())
def mint():
    return map(int,input().split())
def lint():
    return list(map(int,input().split()))
def ilint():
    return int(input()), list(map(int,input().split()))
def judge(x, l=['Yes', 'No']):
    print(l[0] if x else l[1])
def lprint(l, sep='\n'):
    for x in l:
        print(x, end=sep)
def ston(c, c0='a'):
    return ord(c)-ord(c0)
def ntos(x, c0='a'):
    return chr(x+ord(c0))
class counter(dict):
    def __init__(self, *args):
        super().__init__(args)
    def add(self,x,d=1):
        self.setdefault(x,0)
        self[x] += d
    def list(self):
        l = []
        for k in self:
            l.extend([k]*self[k])
        return l
class comb():
    def __init__(self, n, mod=None):
        self.l = [1]
        self.n = n
        self.mod = mod
    def get(self,k):
        l,n,mod = self.l, self.n, self.mod
        k = n-k if k>n//2 else k
        while len(l)<=k:
            i = len(l)
            l.append(l[i-1]*(n+1-i)//i if mod==None else (l[i-1]*(n+1-i)*powmod(i,-1,mod))%mod)
        return l[k]
def pf(x,mode='counter'):
    C = counter()
    p = 2
    while x>1:
        k = 0
        while x%p==0:
            x //= p
            k += 1
        if k>0:
            C.add(p,k)
        p = p+2-(p==2) if p*p<x else x
    if mode=='counter':
        return C
    S = set([1])
    for k in C:
        T = deepcopy(S)
        for x in T:
            for i in range(1,C[k]+1):
                S.add(x*(k**i))
    if mode=='set':
        return S
    if mode=='list':
        return sorted(list(S))

######################################################

N=intput()
F=[lint() for _ in range(N)]
P=[lint() for _ in range(N)]
ans=-INF
for c in product([0,1],repeat=10):
    if c==(0,0,0,0,0,0,0,0,0,0):
        continue
    tmp=0
    for i in range(N):
        count=0
        for j in range(10):
            count+=c[j]&F[i][j]
        tmp+=P[i][count]
    ans=max(ans,tmp)
print(ans)

Measured memory_bytes: 73948
#include <vector>
#include <iostream>
#include <cmath>
#include <map>
#include <algorithm>
#include <fstream>
#include <unistd.h>
#include <string>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<string> vs;
const int INF = 1001001001;
const ll LINF = 1e18;

template <typename T>
T gcd(T a, T b) {
    if(a < b) gcd(b, a);
    T r;
    while((r=a%b)) {
        a = b; b = r;
    }
    return b;
}

ll twoMod(ll in){
    ll count = 0;
    while(in % 2 == 0){
        count++;
        in /= 2;
    }
    return count;
}

int main() {
    string s; ll K; cin >> s >> K;
    vs subs;
    for (ll i = 1; i <= K; i++) {
        for (ll j = 0; j + i <= s.size(); j++) {
            subs.push_back(s.substr(j, i));
        }
    }
    sort(subs.begin(), subs.end(), less<string>());
    subs.erase(unique(subs.begin(), subs.end()), subs.end());
    cout << subs[K - 1] << endl;
    return 0;
}



Measured memory_bytes: 1660
#include<iostream>
#include<algorithm>
using namespace std;
int main(){

	int a,b,c;

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


Measured memory_bytes: 3080
#include<bits/stdc++.h>
using namespace std;
#define FOR(i,l,r) for(long long i=(l);i<(r);++i)
#define REP(i,n) FOR(i,0,n)
#define REPS(i,n) FOR(i,1,n+1)
#define int long long
#define mp make_pair
#define pb push_back
#define eb emplace_back
const int MOD=1e9+7;
const int INF=1e18;
const int MAX=3000;

signed main(){
    int N,T;cin>>N>>T;
    int A[N];
    REP(i,N)cin>>A[i];
    int B[N];
    REP(i,N){
        if(i==0){
            B[i]=A[N-1];
        }
        else{
            B[i]=max(A[N-1-i],B[i-1]);
        }
    }
    map<int,int>memo;
    REP(i,N-1) memo[-(B[N-1-i]-A[i])]++;
    auto it=memo.begin();
    cout<<it->second<<endl;
}

Measured memory_bytes: 8064
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> // Common file
#include <ext/pb_ds/tree_policy.hpp> // Including tree_order_statistics_node_update
#define ll long long
#define PI 3.141592653589
#define IO ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define EPS 1e-7
#define ff first
#define ss second
#define print(val) "[ " << #val ": " << (val) << " ]\n"
using namespace std;
using namespace __gnu_pbds;
typedef tree<int, null_type, less<int>, rb_tree_tag,
             tree_order_statistics_node_update>
    ordered_set;
constexpr ll MOD = 998244353;
const int RANDOM = chrono::high_resolution_clock::now().time_since_epoch().count();
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
int random_int(int l,int r){return uniform_int_distribution<int>(l,r)(rng);}
struct Debug;
template<typename T, typename C = std::ostream&>
struct hasPrint : false_type{};
template<typename T>
struct hasPrint<T, decltype(cout << declval<T>())>: true_type{};
struct Debug{
    template<typename T>
    typename enable_if<hasPrint<T>::value, Debug&>::type operator << (const T& t){
        cerr << t;
        return *this;
    }
    template<typename T>
    typename enable_if<!hasPrint<T>::value, Debug&>::type operator << (const T& t){
        auto ed = t.end();
        *this << "[";
        for(auto it = t.begin(); it != ed; it++){
            if(next(it) == ed){
                *this << *it; continue;
            }
            *this << *it << ", ";
        }
        *this << "]";
        return *this;
    }
    template<typename T, typename C>
    Debug& operator << (const pair<T,C>& t){
        *this << "[ " << t.first << ", " << t.second << " ]";
        return *this;
    }
};
constexpr ll fast_power(ll x, ll p){
    ll res = 1;
    while(p > 0){
        if(p & 1){
            res = (res * x)%MOD;
        }
        p = p >> 1;
        x = (x*x)%MOD;
    }
    return res;
}
ll getRange(int l ,int r, vector<ll>& prefix){

    return prefix[r] - ((l > 0) ? prefix[l-1] : 0);
}
int main() {
    IO;
    int n;
    cin >> n;
    vector<int> v(n);
    for(int i = 0; i < n; i++){
        cin >> v[i];
    }
    vector<ll> prefix(n);
    vector<vector<ll>> dp(n, vector<ll>(n, LLONG_MAX));
    prefix[0] = v[0];
    for(int i = 1; i < n; i++){
        prefix[i] = prefix[i-1] + v[i];
    }
    //Debug{} << print(precomp);
    for(int i = 0; i < n; i++){
        for(int j = 0; j < n; j++){
            if(i == 0){
                dp[j][j] = 0;
            }
            if(j-i < 0){
                continue;
            }
            for(int k = 0; k < i; k++){
                int left= i-k;
                dp[j-i][j] = min(dp[j-k][j]+dp[j-k-left][j-k-1], dp[j-i][j]);
                //Debug{} << print(dp[j-i][j]);
            }
            if(j-i != j){
                dp[j-i][j] += getRange(j-i, j , prefix);
            }
            //Debug{} << print(dp[j-i][j]);
        }
    }
    cout << dp[0][n-1];
    return 0;
}


Measured memory_bytes: 1536
#include <bits/stdc++.h>
int g[200][200];
using namespace std;

int main(){
  int N;
  cin>>N;
  int l,r;
  for(int i=0;i<200;i++)for(int j=0;j<200;j++)g[i][j]=0;
  for(int i=0;i<N;i++){
    cin>>l>>r;
    g[l][r]=1;
  }
  for(int i=0;i<N;i++){
    cin>>l>>r;
    g[l][r]=2;
  }
  int ans=0;
  for(int j=0;j<2*N;j++){
    for(int i=0;i<2*N;i++){
      if(g[i][j]==2){
        int out=1;
        for(int ii=i;ii>=0&&out;ii--){
          for(int jj=j;jj>=0&&out;jj--){
            if(g[ii][jj]==1){
              g[ii][jj]=0;
              ans++;
              out--;
            }
          }
        }
      }
    }
  }
  cout<<ans<<endl;
}


Measured memory_bytes: 384
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#define rep(i, n) for(int i=0; i<n; ++i)
using namespace std;
using ll = int64_t;
using vi = vector<int>;
using vvi = vector<vi>;

int main() {
    int n;
    cin >> n;
    vi p(n);
    rep(i, n) {
        cin >> p[i];
        --p[i];
    }


    int ans=0;
    rep(i, n) {
        if(p[i] == i) {
            if(i != n-1 && p[i+1] == i+1) {
                ++i;
            }
            ans++;
        } 
    }

    cout << ans << endl;
}

Measured memory_bytes: 640
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <cmath>
#include <iomanip>
#include <stack>
#include <queue>
#include <numeric>
#include <map>
#include <unordered_map>
#include <set>
#include <fstream>
#include <chrono>
#include <random>
#include <bitset>
#define rep(i,n) for(int i=0;i<(n);i++)
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define sz(x) ((int)(x).size())
#define pb push_back
using ll = long long;
using namespace std;
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; }
ll gcd(ll a, ll b) {return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b) {return a/gcd(a,b)*b;}

int main(){
  string S, T; cin >> S >> T;
  int ans = 0;
  rep(i,sz(S)){
    if(S[i]!=T[i]) ans++;
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 3920
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vec;
typedef vector<vec> mat;
typedef pair<ll,ll> pll;
const ll mod=1e9+7;
//const ll mod=998244353;
const ll inf=1LL<<61;

ll mpow(ll x, ll n) {
  ll ans=1;
  while(n>0) {
    if(n&1) {
      ans=ans*x%mod;
    }
    x=x*x%mod;
    n>>=1;
  }
  return ans;
}

int main() {
  ll n,k;
  cin >> n >> k;
  vector<pll> a(n);
  vec p,m;
  ll z=0;
  for(ll i=0;i<n;i++) {
    ll tmp;
    cin >> tmp;
    ll f=0;
    if(tmp>0) f=1;
    else if(tmp<0) f=-1;
    a[i]={abs(tmp),f};
    if(f==1) {
      p.push_back(abs(tmp));
    }
    else if(f==-1) {
      m.push_back(abs(tmp));
    }
    else z++;
  }
  sort(p.rbegin(),p.rend());
  sort(m.rbegin(),m.rend());
  sort(a.rbegin(),a.rend());
  ll ans=1;
  ll idp=0,idm=0;
  for(ll i=0;i<k;i++) {
    ans=ans*a[i].first%mod;
    if(a[i].second==1) {
      idp++;
    }
    if(a[i].second==-1) {
      idm++;
    }
  }
  if(ans==0) {
    cout << ans << endl;
    return 0;
  }
  if(idm%2) {
    if(idm<m.size()&&idp) {
      if(idp<p.size()) {
        if(m[idm]*m[idm-1]>p[idp]*p[idp-1]) {
          ans=ans*mpow(p[idp-1],mod-2)%mod*m[idm]%mod;
        }
        else {
          ans=ans*mpow(m[idm-1],mod-2)%mod*p[idp]%mod;
        }
        cout << ans << endl;
      }
      else {
        ans=ans*mpow(p[idp-1],mod-2)%mod*m[idm]%mod;
        cout << ans << endl;
      }
    }
    else {
      if(idp<p.size()) {
        ans=ans*mpow(m[idm-1],mod-2)%mod*p[idp]%mod;
        cout << ans << endl;
      }
      else {
        if(z) {
          cout << 0 << endl;
        }
        else {
          ans=1;
          sort(a.begin(),a.end());
          for(ll i=0;i<k;i++) {
            ans=ans*a[i].first%mod;
          }
          ans=(mod-ans)%mod;
          cout << ans << endl;
        }
      }
    }
  }
  else {
    cout << ans << endl;
  }
}


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

//C++14 (GCC 5.4.1)

#define LLINF (1LL<<60)
typedef long long ll;
#define mod 1000000007

#define repd(i,a,b) for (int i=(a);i<(b);i++)
#define rep(i,n) repd(i,0,n)
#define rrepd(i,a,b) for(int i=(a);i>=(b);i--)
#define lower_bound_idx(V,c) distance(V.begin(),lower_bound(V.begin(),V.end(),c))

template<typename T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<typename T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

template < typename T > inline string toString( const T &a ) { ostringstream oss; oss << a; return oss.str(); }

#define dbg_v1(i,V) do{cout<<"-v1----\n";rep(i,V.size())cout<<" "<<i<<"\t:"<<V[i]<<endl;cout<<endl;}while(0)
#define dbg_v2(i,k,V) do{cout<<"-v2----\n";rep(i,V.size()){rep(k,V[0].size())cout<<" "<<V[i][k];cout<<endl;}}while(0)

int main() {
    ios::sync_with_stdio(false);//stdoutとcoutの同期解除
    cin.tie(nullptr);//cinとcoutの同期解除
    
    int N;
    cin >>N;

    vector<ll> A(N),B(N),C(N);
    rep(i,N) cin >> A[i];
    rep(i,N) cin >> B[i];
    rep(i,N) cin >> C[i];
    sort(A.begin(),A.end());
    sort(B.begin(),B.end());
    sort(C.begin(),C.end());
    vector<ll> Bd(N),Cd(N);
    rep(i,N){
        Bd[i]=lower_bound_idx(A,B[i]);
        if(i!=0)Bd[i]+=Bd[i-1];
    }
    ll ans=0,t;
    rep(i,N){
        t=lower_bound_idx(B,C[i])-1;
        if(0<=t)ans+=Bd[t];
    }
    cout << ans <<endl;
    return (0);
}

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

int main() {

  long long int n;
  cin >> n;

  long long int sum = 0;
  long long int mi, ma;

  for ( long long int i = 0; i < n; i++ ) {

    long long int in;
    cin >> in;
    if ( i == 0 ) {
      mi = in;
      ma = in;
    }
    mi = min( mi, in );
    ma = max( ma, in );
    sum += in;

  }

  cout << mi << " " << ma << " " << sum << endl;

  return 0;

}

Measured memory_bytes: 1160
#include <bits/stdc++.h>
using namespace std;
 
#define mp make_pair
#define mt make_tuple
#define pb push_back
#define CONTAINS(a, x) (a.find(x) != a.end())
#define ALL(x) x.begin(), x.end()
#define SZ(x) (int)x.size()
#define nl cout << endl
#define F first
#define S second
 
#define what_is(x) cout << #x << " = " << x << endl
#define boost ios::sync_with_stdio(false);cin.tie(NULL)
#define CASET int ___T, case_n = 1; cin >> ___T; while (___T-- > 0) 
 
 
#define rep(it, st, en) for(ll it = st; it < en; it++)
#define rep1(it, st, en) for(ll it = st; it <= en; it++)
#define per(it, st, en) for(ll it = en - 1; it >= st; it--)
 
typedef long long ll;
typedef pair<int, int> ii;
typedef pair<ll,ll> pll;
 
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<bool> vb;
typedef vector<ii> vii;
typedef vector<vi> vvi;
 
ll INF = 1E9;
ll M = 1E9 + 7;
 
inline ll max_(ll a, ll b) { return (a>b)?a:b; }
inline ll min_(ll a, ll b) { return (a<b)?a:b; }
 
inline ll power (ll a,ll p){
    ll res = 1, x = a;
    while ( p ) {
        if ( p & 1 ) res = ( res * x );
        x = ( x * x ); p >>= 1;
    }
    return res;
}
 
template <typename T> ostream& operator<<(ostream& os, const vector<T> &p){os << "[ "; for (T x: p) os << x << " "; os << "]" << endl; return os;}
template <typename T> ostream& operator<<(ostream& os, const set<T> &p){os << "{ "; for (T x: p) os << x << " "; os << "}" << endl; return os;}
template <typename Tk, typename Tv> ostream& operator<<(ostream& os, const map<Tk, Tv> &p){os << "{ "; for (pair<Tk, Tv> x: p) os << x << " "; os << "}" << endl; return os;}
template <typename Tk, typename Tv> ostream& operator<<(ostream& os, const pair<Tk, Tv> &p){os << "{" << p.first << ',' << p.second << "}";return os;}
 
int main() {
    boost;
    if(fopen("inp.txt", "r")){
      freopen("inp.txt", "r", stdin);
      freopen("outp.txt", "w", stdout);
    }
 
    ll n;
    cin>>n;
 
    ll a[n+1],i;
    for (i=1;i<=n;i++)
        cin>>a[i];
 
    ll l=1,h=1,ans=0;
 
    while (h<=n) {
        if (a[h]==h) {
            h++;
        }
 
        else {
 
            if (l!=h) {
                ll curr=(h-l);
                ans+=(ll)ceil(curr/2.0);
            }
 
            h++;
            l=h;
        }
    }
 
    if (l!=h) {
        ll curr=(h-l);       
        ans+=(ll)ceil(curr/2.0);;
    }
 
 
    cout<<ans;
 
    return 0;
}

Measured memory_bytes: 1024
import sys

stdin = sys.stdin

ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline()

D, G = na()
p = []
c = []
for i in range(D):
    x, y = na()
    p.append(x)
    c.append(y)

ans = 99999999
for i in range(1<<D):
    ct = 0
    score = 0
    for j in range(D):
        if i>>j&1:
            score += c[j]
            score += p[j] * (j+1) * 100
            ct += p[j]
    for j in range(D-1, -1, -1):
        if i>>j&1: continue
        if score >= G: break
        g = (j+1)*100
        got = (G-score+g-1)//g
        score += min(got, p[j]) * g
        ct += min(got, p[j])
    ans = min(ans, ct)
print(ans)


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

int main(){
    int n;
    cin>>n;
    char c[n];
    cin>>c;
    bool flag = true;

    for(int i=0; i<n/2; i++){
        if(c[i] != c[n/2+i])flag = false;
    }
    if(n%2 != 0) flag = false;

    if(flag)cout<<"Yes"<<endl;
    else cout<<"No"<<endl;

    return 0;
}

Measured memory_bytes: 256
import numpy as np
n,m,c=map(int, input().split())
b=np.array(list(map(int, input().split())))
count=0
for i in range(n):
  a=np.array(list(map(int, input().split())))
  if sum(a*b)+c>0:
    count+=1

print(count)

Measured memory_bytes: 12392
a,b,k=map(int,input().split())
li1 = range(a,a+k)
li2 = range(b-k+1,b+1)
se1=set(li1)
se2=set(li2)
se=sorted(se1|se2)
for i in se:
    if a<=i<=b:
        print(i)

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

int main() {
  string S,T;
  int count;
  cin >> S >> T;
  for (int i=0; i<3;i++){
     if (S.at(i)==T.at(i)){
        count++;
     }
  }
  cout << count << endl;
}

Measured memory_bytes: 256
/**
 * Created by hiramekun at 17:22 on 2019-10-16.
 */
#include <bits/stdc++.h>

using namespace std;

using ll = long long;
using vl = vector<ll>;
using vvl = vector<vl>;
using vb = vector<bool>;
using P = pair<ll, ll>;
template<typename T> using pq = priority_queue<T>;
template<typename T> using minpq = priority_queue<T, vector<T>, greater<T>>;
template<typename T, typename K> using ump = unordered_map<T, K>;
const ll dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};
const ll mod = 1000000007;
const ll inf = ll(1e9);
const ll e5 = ll(1e5);
const ll ll_inf = ll(1e9) * ll(1e9);

#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)
#define repr(i, n) for(ll i = ll(n - 1); i >= 0; i--)
#define each(i, mp) for(auto& i:mp)
#define eb emplace_back
#define F first
#define S second
#define all(obj) (obj).begin(), (obj).end()

template<class T>
ostream &operator<<(ostream &out, const vector<T> &list) {
    ll n = list.size();
    rep(i, n) out << list[i] << ' ';
    return out;
}

template<class T>
istream &operator>>(istream &in, vector<T> &list) {
    ll n = list.size();
    rep(i, n) in >> list[i];
    return in;
}

template<class T>
ostream &operator<<(ostream &out, const vector<vector<T>> &list) {
    ll n = list.size();
    rep(i, n) out << list[i] << '\n';
    return out;
}

/* ------------- ANSWER ------------- */
/* ---------------------------------- */

void solve() {
    ll n;
    cin >> n;
    vl a(n);
    cin >> a;

    vl times(n);
    bool invalid = (a[0] != 0);
    rep(i, n - 1) {
        if (a[i + 1] - a[i] > 1) invalid = true;
    }
    if (invalid) cout << -1 << '\n';
    else {
        rep(i, n) times[i - a[i]] = a[i];
        cout << accumulate(all(times), 0LL) << '\n';
    }
}

int main() {
#ifdef MY_DEBUG
    while (true) {
#endif
        solve();
#ifdef MY_DEBUG
    }
#endif
    return 0;
}

Measured memory_bytes: 3328
sub f{$p[$_]=$_-(local$_=$p[$_])?&f:$_}map{@p=0..$`;$p[f$_=$']=f$_=<>=~$"*$`for 1..$_;@{$|--}=map f,@p}<>=~/ \d+/g;print$$_,$/for map{++${$t=\${$0[$_]}{$1[$_]}};$t}1..$`

Measured memory_bytes: 163712
/*
  GOOD is not Enough
  You've got to be GREAT.
*/
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
// #include<boost/multiprecision/cpp_int.hpp>
// using namespace boost::multiprecision;
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 dbg(x) cout << (#x) << " is " << (x) << '\n' 
#define F first
#define S second
#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,m;
    cin >> n >> m;
 vector<int> v[n+1];
 int h[n+1];
 fp(i,1,n)
    cin >> h[i];
 while(m--)
 {
     int x,y;
     cin >> x>>y;
     v[x].pb(y);
     v[y].pb(x);
 }
 int ans=0;
 fp(i,1,n)
 {
     if(v[i].empty())
        ans++;
     else
     {
         int flg=1;
         for(auto x:v[i])
         {
             if(h[i]<=h[x])
                {flg=0;break;}
         }
         ans+=flg;
     }
 }
 cout << ans << '\n';
  return;
}

signed main()
{
  FAST
  int T=1;
//   cin >> T;
  while(T--)
  {
    solve();
  }
  return 0;
}


Measured memory_bytes: 10276
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int>P;
const double eps = 1e-8;
const int NINF = 0xc0c0c0c0;
const int INF  = 0x3f3f3f3f;
const ll  mod  = 1e9 + 7;
const ll  maxn = 1e6 + 5;
const int N = 1e5 + 5;

int n,m;
vector<int> G[N];
set<int>s;
int h[N];

int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	cin>>n>>m;
	for(int i=1;i<=n;i++){
		cin>>h[i];
	}
	for(int i=1;i<=m;i++){
		int u,v;cin>>u>>v;
		G[u].push_back(v);
		G[v].push_back(u);
	}
	int ans=0;
	for(int i=1;i<=n;i++){
		if(G[i].empty()) s.insert(i);
		bool flag=true;
		for(auto c:G[i]){
			if(h[c]>=h[i]){flag=false;break;}
		}
		if(flag) s.insert(i);
	}
	cout<<s.size()<<'\n';
	return 0;
}

Measured memory_bytes: 12240
#define  _CRT_SECURE_NO_WARNINGS
#include "bits/stdc++.h"
#pragma comment (linker, "/STACK:526000000")

using namespace std;
typedef string::const_iterator State;
#define eps 1e-11L
#define MAX_MOD 1000000007LL
#define GYAKU 500000004LL

#define MOD 998244353LL
#define seg_size 262144*2LL
#define pb push_back
#define mp make_pair
typedef long long ll;
#define REP(a,b) for(long long (a) = 0;(a) < (b);++(a))
#define ALL(x) (x).begin(),(x).end()

unsigned long xor128() {
	static unsigned long x = 123456789, y = 362436069, z = 521288629, w = time(NULL);
	unsigned long t = (x ^ (x << 11));
	x = y; y = z; z = w;
	return (w = (w ^ (w >> 19)) ^ (t ^ (t >> 8)));
}

void init() {
	iostream::sync_with_stdio(false);
	cout << fixed << setprecision(20);
}

#define int ll
void solve() {
	while (true) {
		int n, m;
		cin >> n >> m;
		if (n == 0) return;
		vector<int> inputs[200];
		REP(i, n) {
			int a, b;
			cin >> a >> b;
			inputs[a].push_back(b);
		}
		int ans = 0;
		for (int i = 1; i <= m; ++i) {
			sort(ALL(inputs[i]));
			ans += inputs[i].back();
		}
		cout << ans << endl;
	}
}
#undef int
int main() {
	init();
	solve();
}


Measured memory_bytes: 3112
def main():
    n = int(input())

    alphabets = 'zabcdefghijklmnopqrstuvwxy'
    answer_reversed = ''
    for i in range(100):
        idx = n % 26
        answer_reversed += alphabets[idx]
        if idx == 0:
            n -= 26
        else:
            n -= idx
        if n:
            n = n // 26
        else:
            break
    print(answer_reversed[::-1])


if __name__ == '__main__':
    main()


Measured memory_bytes: 9172
#if 1
#include <iostream>
#include <fstream>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <queue>
#include <stack>
#include <array>
#include <deque>
#include <algorithm>
#include <utility>
#include <cstdint>
#include <functional>
#include <iomanip>
#include <numeric>
#include <assert.h>
#include <bitset>
#include <list>
#include <cmath>

auto& in = std::cin;
auto& out = std::cout;
#define all_range(C) std::begin(C), std::end(C)
const double PI = 3.141592653589793238462643383279502884197169399375105820974944;

int64_t N;

int main()
{
	using std::endl;
	in.sync_with_stdio(false);
	out.sync_with_stdio(false);
	in.tie(nullptr);
	out.tie(nullptr);

	for (;;)
	{
		in >> N;
		if (N == 0) { break; }

		for (int64_t n = std::sqrt(N)*2+10; n >= 1; --n)
		{
			auto tmp = (N - (n - 1) * n / 2);
			if (tmp >= n && tmp % n == 0) {
				out << tmp / n << ' ' << n << endl;
				break;
			}
		}
	}

	return 0;
}
#endif



Measured memory_bytes: 3012
<?php
//$N = (int)trim(fgets(STDIN));
$S = trim(fgets(STDIN));
$T = trim(fgets(STDIN));
//list($N,$A,$B,$C) = array_map('intval',explode(" ",trim(fgets(STDIN))));
//$s = trim(fgets(STDIN));
//$A = array_map('intval',explode(" ",trim(fgets(STDIN))));

if ($S == substr($T,0,-1)) {
  printf("Yes\n");
}
else {
  printf("No\n");
}


Measured memory_bytes: 15976
#include <stdio.h>
#include <string>
#include <cstring>
#include <stdlib.h>
#include <math.h>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <list>
#include <iterator>
#pragma warning(disable:4996)
 
typedef long long ll;
#define MIN(a, b) ((a)>(b)? (b): (a))
#define MAX(a, b) ((a)<(b)? (b): (a))
#define LINF 9223300000000000000
#define INF 2140000000
#define MOD 1000000007
using namespace std;


int main(int argc, char* argv[])
{
    long n;
    scanf("%ld", &n);

    vector<long> a(n);
    long sum=0;
    long i;
    for(i=0; i<n; i++) {
        scanf("%ld", &a[i]);
        sum+=a[i];
    }

    long min=INF;
    long mini=-1;
    for(i=0; i<n; i++) {
        long tmp=abs(a[i]*n -sum);
        if(min>tmp) {
            min=tmp;
            mini=i;
        }
    }
    printf("%ld\n", mini);

    return 0;
}


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

using ll=long long;
#define int ll

#define FOR(i,a,b) for(int i=int(a);i<int(b);i++)
#define REP(i,b) FOR(i,0,b)
#define MP make_pair
#define PB push_back
#define ALL(x) x.begin(),x.end()
#define REACH cerr<<"reached line "<<__LINE__<<endl
#define DBG(x) cerr<<"line "<<__LINE__<<" "<<#x<<":"<<x<<endl

using pi=pair<int,int>;
using vi=vector<int>;
using ld=long double;

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

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

int read(){
	int i;
	scanf("%lld",&i);
	return i;
}

void printSpace(){
	printf(" ");
}

void printEoln(){
	printf("\n");
}

void print(int x,int suc=1){
	printf("%lld",x);
	if(suc==1)
		printEoln();
	if(suc==2)
		printSpace();
}

string readString(){
	static char buf[3341919];
	scanf("%s",buf);
	return string(buf);
}

char* readCharArray(){
	static char buf[3341919];
	static int bufUsed=0;
	char* ret=buf+bufUsed;
	scanf("%s",ret);
	bufUsed+=strlen(ret)+1;
	return ret;
}

template<class T,class U>
void chmax(T& a,U b){
	if(a<b)
		a=b;
}

template<class T,class U>
void chmin(T& a,U b){
	if(a>b)
		a=b;
}

template<class T>
T Sq(const T& t){
	return t*t;
}

const int inf=LLONG_MAX/3;

signed main(){
	int n=read();
	vi a;
	REP(i,n)
		a.PB(read());
	vi convex,ci;
	int mx=-inf;
	REP(i,n){
		if(a[i]>mx){
			convex.PB(a[i]);
			ci.PB(i);
			mx=a[i];
		}
	}
	vi sum(convex.size(),0);
	vi ans(n,0);
	REP(i,n){
		int t=lower_bound(ALL(convex),a[i])-convex.begin();
		if(t==0){
			ans[ci[0]]+=a[i];
		}else{
			ans[ci[t]]+=a[i]-convex[t-1];
			sum[t-1]++;
		}
	}
	for(int i=int(sum.size())-1;i>=0;i--){
		ans[ci[i]]+=sum[i]*(convex[i]-(i==0?0:convex[i-1]));
		if(i>0)
			sum[i-1]+=sum[i];
	}
	REP(i,n)
		print(ans[i]);
}


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

using namespace std;

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

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

    int n, k;

    cin >> n >> k;
    vector<Point> p(n);
    vector<int> x(n), y(n);

    for (int i = 0; i < n; ++i) {
        cin >> x[i] >> y[i];
        p[i] = make_pair(x[i], y[i]);
    }

    sort(x.begin(), x.end());
    sort(y.begin(), y.end());

    ll min_area = (ll)(y[n - 1] - y[0]) * (ll)(x[n - 1] - x[0]);
    for (int lx = 0; lx < n; ++lx) {
        for (int rx = lx + 1; rx < n; ++rx) {
            for (int by = 0; by < n; ++by) {
                for (int ty = by + 1; ty < n; ++ty) {
                    int cnt = 0;
                    for (int i = 0; i < n; ++i)
                        if (x[lx] <= p[i].first && p[i].first <= x[rx] &&
                            y[by] <= p[i].second && p[i].second <= y[ty])
                            ++cnt;

                    if (k <= cnt)
                        min_area = min(min_area, (ll)(y[ty] - y[by]) * (ll)(x[rx] - x[lx]));
                }
            }
        }
    }

    cout << min_area << endl;

    return 0;
}


Measured memory_bytes: 384
def main():
    """
    input:
        1 <= N <= 50
        1 <= X <= レベル N バーガーの層の総数

    レベル L バーガー
        バン 1枚
        レベル L−1バーガー
        パティ 1枚
        レベル L−1バーガー
        バン 1枚
    この順に下から積み重ねたもの

    output:
        N! の約数のうち、七五数 は何個
        七五数とは約数をちょうど 75個持つ正の整数
    """
    N, X = map(int, input().split())

    ans = f(N, X)
    print(ans)


def layers(N):
    layer = [0] * (N + 1)
    layer[0] = 1
    p_layer = [0] * (N + 1)
    p_layer[0] = 1

    for i in range(1, N+1):
        layer[i] = 1 + layer[i-1] + 1 + layer[i-1] + 1
        p_layer[i] = p_layer[i-1] + 1 + p_layer[i-1]

    return layer, p_layer


def f(N, X):
    """
    差分は4から始まって2倍になる
    2^32 < layer 50 < 2^64

    下からX層を食べるので端から考える
    """
    layer, p_layer = layers(N)

    def patty(N, X):
        if N <= 0:
            return 0

        ans = 0
        # L下のバン
        if X >= 1:
            X -= 1
            # print("L下", N, X, ans)
            if X >= layer[N-1]:
                X -= layer[N-1]
                ans += p_layer[N-1]
                # print("L-1下バーガー", N, X, ans)
                if X >= 1:
                    X -= 1
                    ans += 1
                    # print("Lパティ", N, X, ans)
                    if X >= layer[N-1]:
                        X -= layer[N-1]
                        ans += p_layer[N-1]
                        # print("L-1上バーガー", N, X, ans)
                    else:
                        ans += patty(N-1, X)
            else:
                ans += patty(N-1, X)

        return ans

    ans = patty(N, X)
    return ans


if __name__ == '__main__':
    main()


Measured memory_bytes: 3064
#include<iostream>
int main(){int h,b,i,j;std::string r,a;while(std::cin>>r>>a,r!="0"&&a!="0"){for(h=b=i=0;i<4;i++)for(j=4;j-->0;)if(a[i]==r[j])i==j?h++:b++;printf("%d %d\n",h,b);}}

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

using namespace std;

struct edge{
	int to;
	int id;
};
vector<vector<edge>> g;

int main(void){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n;
	cin >> n;
	g.resize(n);
	vector<int> ans(n-1);
	rep(i,n-1){
		int a,b;
		cin >> a >> b;
		--a;--b;
		g[a].push_back((edge){b,i});
		g[b].push_back((edge){a,i});
	}
	queue<int> q;
	vector<int> used(n);
	q.push(0);
	used[0] = 1;
	while(!q.empty()){
		int v = q.front();q.pop();
		int c = -1;
		
		for(int i=0;i<g[v].size();i++){
			int u = g[v][i].to;
			int ei= g[v][i].id;
			if(used[u]){
				c = ans[ei];
				break;
			}
		}
		int k = 1;
		rep(i,g[v].size()){
			int u = g[v][i].to;
			int ei= g[v][i].id;
			if(ans[ei])continue;
			if(k==c)k++;
			ans[ei] = k;
			k++;
			q.push(u);
			used[u] = 1;
		}
	}
	int mx = 0;
	rep(i,n)mx = max(mx,int(g[i].size()));
	cout << mx << endl;
	rep(i,n-1)cout << ans[i] << endl;
}

Measured memory_bytes: 7424
#include <stdio.h>

int main(void)
{
    int i, N;
    int count = 0;
    scanf("%d", &N);
    char s[N];
    scanf("%s", s);
    for (i = 1; i < N; i++)
    {
        if (s[i - 1] == 'A' && s[i] == 'B' && s[i + 1] == 'C')
        {
            count++;
        }
    }
    printf("%d\n", count);
}

Measured memory_bytes: 128