akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;
using P = pair<int,int>;
const int MOD = 1000000007;

int main() {
    int n;
    cin>>n;
    ll ans=1;
    map<int,int> mp;
    rep(i,n) {
        int temp;
        cin>>temp;
        mp[temp]++;
    }
    for (auto v:mp) {
        if (v.first==0&&v.second!=1) {
            ans=0;
            break;
        } else if(v.first==0) continue;
        else if(v.second!=2) {
            ans=0;
            break;
        } else {
            ans*=2;
            ans%=MOD;
        }
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 3200
//#include <fsociety>
#include <cmath>
#include <deque>
#include <algorithm>
#include <iterator>
#include <list>
#include <map>
#include <unordered_map>
#include <queue>
#include <set>
#include <unordered_set>
#include <stack>
#include <string>
#include <vector>
#include <iostream>
//end of libraries ;
#define INF 99999999999
#define N 300003
#define F first
#define S second
#define pb push_back
#define ll long long
#define fcin ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0);
using namespace std;
int n;
string s , s1;
map<string,int>mp;
bool ok = 1;
int main(){
fcin;
	cin>>n;
	cin>>s;
	mp[s] = 1;
	for(int i = 0 ;i  < n - 1; i++){
		cin>>s1;
		if(mp[s1]==1) ok = 0; 
		if(s[s.length()-1]!=s1[0]) ok = 0;
		mp[s1]++;
		s = s1;
	}
	if(ok) cout<<"Yes\n";
	else cout<<"No\n";

}

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

int d[11][11];
int mx[110][110];

int main() {
	int A,B;
	scanf("%d %d", &A, &B);
	for (int i=1;i<=A;i++) {
		for (int j=1;j<=B;j++) {
			scanf("%d", &d[i][j]);
		}
	}

	for (int i = 0; i <= 100; i++) {
		for (int j = 0; j <= 100; j++) {
			// x간선 i개, y간선 j개
			
			for (int x = 1; x <= A; x++) {
				for (int y = 1; y <= B; y++) {
					mx[i][j] = max(mx[i][j], d[x][y] - x*i - y*j);
				}
			}
		}
	}
	

	for (int x = 1; x <= A; x++) {
		for (int y = 1; y <= B; y++) {

			int mi = 100 + 1;
			for (int i = 0; i <= 100; i++) {
				for (int j = 0; j <= 100; j++) {
					mi = min(mi, mx[i][j] + x*i + y*j);
				}
			}

			if (mi != d[x][y]) {
				puts("Impossible");
				return 0;
			}
		}
	}


	vector<int> a, b;
	for(int i=1;i<=101;i++)
		a.push_back(i);
	for(int i=102;i<=202;i++)
		b.push_back(i);

	int n, m;
	n = 202;
	m = 100*2 + 101*101;
	int S = a[0], T = b.back();

	puts("Possible");
	printf("%d %d\n", n, m);

	for (int i = 0; i < 100; i++) {
		printf("%d %d X\n", a[i], a[i+1]);
		printf("%d %d Y\n", b[i], b[i+1]);
	}

	for (int i = 0; i <= 100; i++) {
		for (int j = 0; j <= 100; j++) {
			printf("%d %d %d\n", a[i], b[j], mx[i][100-j]);
		}
	}

	printf("%d %d\n", S, T);
	return 0;
}

Measured memory_bytes: 384
#include<iostream>
#include<stdio.h>
//#include <bits/stdc++.h>
#include<vector>
#include<float.h>
#include<iomanip>
#include<algorithm>
#include<string>
#include<cstring>
#include<math.h>
#include<cmath>
#include<sstream>
#include<set>
#include<map>
#include<queue>
#include <cassert>
#include <cmath>
#include<cstdint>

#define INF 1e9
#define rep(i,n)for(int i=0;(i)<(int)(n);i++)
#define REP(i,a,b)for(int i=(int)(a);(i)<=(int)(b);i++)
#define VEC(type, c, n) std::vector<type> c(n);for(auto& i:c)std::cin>>i;
#define vec(type,n) vector<type>(n)
#define vvec(m,n) vector<vector<int>> (int(m),vector<int>(n))
#define ALL(a)  (a).begin(),(a).end()

using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
using P = pair<int,int>;

vector<int>bitSearch(int bit,int n){
    vector<int>S;
    rep(i,n)if(bit&(1<<i))S.push_back(i);
    return S;
}



int main(){
    int n,t;cin>>n>>t;
    vector<P>p;
    rep(i,n){
        int a,b;cin>>a>>b;
        p.emplace_back(a,b);
    }
    sort(ALL(p));
    rep(i,n){
        P pr = p[i];
        if(pr.second>t)continue;
        cout<<pr.first;
        return 0;
    }
    cout<<"TLE";
}



Measured memory_bytes: 256
#include <algorithm>
#include <functional>
#include <iostream>
#include <set>

template <typename C>
void print_container(const C &c, const std::string &name)
{
  std::cout << name << ": ";
  std::for_each(c.cbegin(), c.cend(),
                [](auto &x) { std::cout << x << ", "; });
  std::cout << std::endl;
}

template <typename Map>
void chomp(Map &x, uint64_t k)
{
  auto it = x.begin();
  uint64_t i = 0;
  uint64_t min = *x.begin();
  while(it != x.end()) {
    if(k <= i && *it != min) {
      it = x.erase(it);
    } else {
      min = *it;
      it++;
    }
    i++;
  }
}

int main()
{
  uint64_t X, Y, Z, K;
  std::cin >> X >> Y >> Z >> K;
  std::multiset<uint64_t, std::greater<uint64_t> > A, B, C;
  for(uint64_t i=0; i<X; i++) {
    uint64_t t; std::cin >> t;
    A.insert(t);
  }
  for(uint64_t i=0; i<Y; i++) {
    uint64_t t; std::cin >> t;
    B.insert(t);
  }
  for(uint64_t i=0; i<Z; i++) {
    uint64_t t; std::cin >> t;
    C.insert(t);
  }

  // chmop after K-element
  chomp(A, K);
  // print_container(A, "A");
  chomp(B, K);
  // print_container(B, "B");
  chomp(C, K);
  // print_container(C, "C");

  // calc A+B top-K
  std::multiset<uint64_t, std::greater<uint64_t> > AB;
  uint64_t min = *A.begin() + *B.begin();
  for(auto a: A) {
    for(auto b: B) {
      auto ab = a + b;
      if(AB.size() < K) {
        AB.insert(ab);
        min = *AB.rbegin();
      } else if(min < ab) {
        AB.erase(--AB.end());
        AB.insert(ab);
        min = *AB.rbegin();
      }
    }
  }
  // print_container(AB, "AB");

  std::multiset<uint64_t, std::greater<uint64_t> > ABC;
  min = *AB.begin() + * C.begin();
  for(auto ab: AB) {
    for(auto c: C) {
      auto abc = ab + c;
      if(ABC.size() < K) {
        ABC.insert(abc);
        min = *ABC.rbegin();
      } else if(min < abc) {
        ABC.erase(--ABC.end());
        ABC.insert(abc);
        min = *ABC.rbegin();
      }
    }
  }
  // print_container(ABC, "ABC");

  uint64_t i = 0;
  for(auto abc: ABC) {
    if(i == K) break;
    std::cout << abc << std::endl;
    i++;
  }

  return 0;
}


Measured memory_bytes: 4032
#include<algorithm>
#include<complex>
#include<ctype.h>
#include<iomanip>
#include<iostream>
#include<fstream>
#include<map>
#include<math.h>
#include<numeric>
#include<queue>
#include<set>
#include<stack>
#include<stdio.h>
#include<string>
#include<string>
#include<vector>

using namespace std;
typedef long long ll;

#define FOR(i,a,b) for(ll i=(a);i<(b);++i)
#define ALL(v) (v).begin(), (v).end()
#define p(s) cout<<(s)<<endl
#define p2(s, t) cout << (s) << " " << (t) << endl
#define br() p("")
#define pn(s) cout << (#s) << " " << (s) << endl
#define p_yes() p("Yes")
#define p_no() p("No")

const ll mod = 1e9 + 7;
const ll inf = 1e18;

template < typename T >
void vprint(T &V){
	for(auto v : V){
    	cout << v << " ";
	}
	cout << endl;
}

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

    // input
    ll N;
    cin >> N;

    vector<ll> A(N);
    FOR(i, 0, N){
        cin >> A.at(i);
    }

    vector<ll> B(N);
    FOR(i, 0, N){
        cin >> B.at(i);
    }

    // 高さ確定の部分にはその値を入れる
    // 未確定部分には「h以下」という情報として -h を入れる
    vector<ll> C(N);
    ll height = 0;
    FOR(i, 0, N){
        if(height!=A[i]){
            C[i] = A[i];
        }else{
            C[i] = -height;
        }
        height = A[i];
    }

    // 逆方向から
    vector<ll> D(N);
    height = 0;
    for(int i=N-1; i>=0; i--){
        if(height!=B[i]){
            D[i] = B[i];
        }else{
            D[i] = -height;
        }
        height = B[i];
    }

    // マージ
    vector<ll> E(N);
    FOR(i, 0, N){
        if(C[i]<0 && D[i]>0){
            if(-C[i] < D[i]){
                p(0);
                return 0;
            }
            E[i] = D[i];
        }
        else if(D[i]<0 && C[i]>0){
            if(-D[i] < C[i]){
                p(0);
                return 0;
            }
            E[i] = C[i];
        }
        else if(C[i]<0 && D[i]<0){
            E[i] = max(C[i], D[i]);
        }
        // 以降は正
        else if(C[i]>0 && D[i]>0 && C[i]!=D[i]){
            // 矛盾
            p(0);
            return 0;
        }
        else if(C[i]>0 && D[i]>0 && C[i]==D[i]){
            E[i] = C[i];
        }
        else{
            //p("考慮漏れ");
        }
    }

    ll answer = 1;
    height = E[0];
    FOR(i, 1, N-1){
        if(E[i]<0){
            answer *= -E[i];
            answer %= mod;
        }
    }

    p(answer);

    return 0;
}

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

typedef long long int ll;
#define INF 1999999999
#define MODA 1000000007

int main()
{
    // freopen("input.txt", "r", stdin);
    // freopen("output.txt", "w", stdout);
    ios::sync_with_stdio(false);
    cin.tie(0);
    int a, b;
    cin >> a >> b;
    if(a > 0 && a < 10 && b > 0 && b < 10)
    {
        cout << a*b << endl;
    }
    else
    {
        cout << -1 << endl;
    }

    return 0;
}


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

using namespace std;

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

const ll MOD = 1000 * 1000 * 1000 + 7;
const ll INF = (ll)1e18;

pair<pll, pll> combine(pair<pll, pll> a, const pll& b) {
    if (a.first == b || a.second == b)
        return a;
    if (b > a.first) {
        a.second = a.first;
        a.first = b;
    } else if (b > a.second) {
        a.second = b;
    }
    return a;
}

pair<pll, pll> combine(const pair<pll, pll>& a, const pair<pll, pll>& b) {
   auto m = combine(a, b.first);
   return combine(m, b.second);
}

ll eval(const pair<pll, pll>& a) {
    return a.first.first + a.second.first;
}

int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(nullptr);

    int n;
    cin >> n;
    int m = 1 << n;
    vector<ll> a(m);
    for (auto& x : a) {
        cin >> x;
    }
    vector<pair<pll, pll>> dp(m);
    ll ans = 0;
    for (int mask = 0; mask < m; mask++) {
        dp[mask] = combine(dp[mask], pll{a[mask], mask});
        for (int b = 0; b < n; b++)
            if (mask & (1 << b))
                dp[mask] = combine(dp[mask], dp[mask ^ (1 << b)]);
        ans = max(ans, eval(dp[mask]));
        if (mask > 0)
            cout << ans << "\n";
    }
}

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

int main(){
    int a,b, digi[5], quo, count;
    scanf("%d %d", &a, &b);

    for(int i = a; i <= b; ++i){
        quo = i;
        int igual = 1;
        //printf("%d\n", i);
        for(int j = 0; j < 5; ++j){
            digi[j] = quo%10;
            quo = quo/10;
        }
        for(int j = 0; j < 2; ++j){
            if(digi[j] != digi[4-j]) igual = 0;
        }
        if (igual) ++count;
    }
    printf("%d\n",count);

    return 0;
}


Measured memory_bytes: 128
import math
short, lon, hour, minute = map(int, input().split()) 
time = hour * 60 + minute
lon_angle = minute * 6
short_angle = time * 0.5
angle = abs(lon_angle - short_angle)
angle = math.radians(angle)
ans = short**2 + lon**2 -2*short*lon*math.cos(angle)
print(math.sqrt(ans))

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

const int MAX = 1000000;
const int MOD = 1000000007;

long long fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit() {
    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;
    }
}

// 二項係数計算
long long COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

int main() {
    // 前処理
    COMinit();

    int x, y;
    long long int bunbo = 1, bunsi = 1, ans = 1;
    cin >> x >> y;
    if((x+y)%3 != 0 || abs(x-y) > min(x, y)) {
        cout << 0 << '\n';
        return 0;
    } else {
        int n = (x+y)/3, k = abs(min(x,y) - n);
        cout << COM(n, k) << '\n';
    }
}


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

using namespace std;

#define int long long
#define endl '\n'
#define maxn 100010
const int MOD = 1000000007;

void solve() {
    int h, w, a, b;
    cin >> h >> w >> a >> b;

    for (int i = 0; i < h; cout << endl, i++)
        for (int j = 0; j < w; j++) {
            if (i < b and j < a)cout << 0;
            else if (i < b and j >= a)cout << 1;
            else if (i >= b and j < a)cout << 1;
            else cout << 0;
        }
}

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

    int t = 1;
//    cin >> t;

    while (t--)
        solve();
    return 0;
}

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

using namespace std;

map <int, int> AC;
map <int, int> WA;

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

    int ACs = 0, P = 0;

    for (int i = 0; i < m; i++) {
        int x;  cin >> x;
        string v;   cin >> v;

        if (AC[x] == 1) continue;

        if (v == "AC") {
            AC[x] = 1;
            ACs++;
            P += WA[x];
        } else {
            WA[x]++;
        }
    }

    cout << ACs << ' ' << P << '\n';

    return 0;
}

Measured memory_bytes: 9600
//libraries
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/detail/standard_policies.hpp>

//namespace
using namespace std;
using namespace __gnu_pbds;

//typedef
//typedef tree<long long,null_type,less<long long>,rb_tree_tag,tree_order_statistics_node_update> ordered_set;
//typedef tree<long long,null_type,greater<long long>,rb_tree_tag,tree_order_statistics_node_update> ordered_set1;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef pair<long long,long long> pll;

//define
#define i(X) cin>>X;
#define o(X) cout<<X<<endl;
#define pb push_back
#define pf push_front
#define fi first
#define se second
#define line cout<<"\n";
#define pbp(a,b) push_back(make_pair(a,b));
#define vll(A) vector<long double> A;
#define ivect(A,n,p) vector<long long> A(n,p);
#define vst(A) sort(A.begin(),A.end());
#define rvst(A) sort(A.rbegin(),A.rend());
#define forin(i,a,b) for(long long i=a;i<=b;i++)
#define forde(i,a,b) for(long long i=a;i>=b;i--)
#define fio ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);

const long long inf=(long long)1e18;
const long long mod=(long long)(1e9+7);

ll power(ll x, ll y, ll p) 
{ 
    ll res = 1;      // Initialize result 
  
    x = x % p;  // Update x if it is more than or 
                // equal to p 
  
    while (y > 0) 
    { 
        // If y is odd, multiply x with result 
        if (y & 1) 
            res = (res*x) % p; 
  
        // y must be even now 
        y = y>>1; // y = y/2 
        x = (x*x) % p; 
    } 
    return res; 
} 
ll modInverse(ll a,ll p)
{
   return power(a,p-2,p);
}

int main()
{
    // #ifndef ONLINE_JUDGE
    //    freopen ("input.txt" , "r" , stdin);
	// 	// freopen ("OUTPUT.txt" , "w" , stdout);
	// #endif
    fio;
    ll testcase=1;
    //i(testcase);
    while(testcase--)
    {
        ll x,y;
        i(x);i(y);
        ll e=0;
        if(!(y%2))
        {
            if((y-2*x)%2==0 && y>=2*x && 4*x>=y)
            {
                e++;
            }
        }
        if(e)
        {
            cout<<"Yes";
        }
        else
        {
            cout<<"No";
        }
        line;
        
    }
    return 0;
}

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

bool dp[2000001];
int main(){
    int n,a,b;
    while(cin>>n>>a>>b,n){
        int cnt=0;
        memset(dp,0,sizeof(dp));
        dp[a]=dp[b]=true;
        rep(i,n+1){
            if(dp[i]){
                ++cnt;
                dp[i+a]=dp[i+b]=true;
            }
        }
        cout<<n-cnt<<endl;
    }
    return 0;
}

Measured memory_bytes: 4912
#include <bits/stdc++.h>
#define SORT(a) sort(a.begin(), a.end())
#define RSORT(a) sort(a.rbegin(), a.rend())
#define REP(i, n) for (int i = 0; i < n; i++)
#define RREP(i, n) for (int i = n; 0 <= i; i--)
#define FOR(i, start, end) for (int i = start; i < end; i++)
#define FORSTEP(i, start, end, step) for (int i = start; i < end; i += step)
#define RFOR(i, start, end) for (int i = start; end <= i; i--)
#define ALL(a) a.begin(), a.end()
#define MOD(a) a %= 1000000007
typedef long long ll;
using namespace std;
template <class T> inline bool chmin(T &a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template <class T> inline bool chmax(T &a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}

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

    int N, K;
    cin >> N >> K;
    vector<int> V(N);
    REP(i, N) cin >> V[i];

    ll ans = (int)-1E9;

    REP(l, K + 1) {
        REP(r, K + 1) {
            if (min(K, N) < l + r)
                break;
            vector<int> a;
            REP(i, l) { a.push_back(V[i]); }
            REP(i, r) { a.push_back(V[N - i - 1]); }
            SORT(a);
            ll sum = 0;
            REP(i, a.size()) {
                if (a[i] < 0 && i < K - r - l) {
                } else {
                    sum += a[i];
                }
            }
            chmax(ans, sum);
        }
    }

    std::cout << ans << '\n';

    return 0;
}

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

using namespace std;

char c[5][5];

int main()
{
    for (int i=1;i<=3;i++)
    for (int j=1;j<=3;j++)
    cin >> c[i][j];
    cout << c[1][1] << c[2][2] << c[3][3];
}

Measured memory_bytes: 256
N, M, Q=list(map(int, input().split()))
LR=[]
for i in range(M):
  LR.append(list(map(int, input().split())))
pq=[]
for i in range(Q):
  pq.append(list(map(int, input().split())))

ans=[[0 for i in range(N)] for j in range(N)]

for i in range(M):
  ans[LR[i][0]-1][LR[i][1]-1] +=1
  
ans_sum=[[0 for i in range(N)] for j in range(N)]
  
for l in range(N):
  for r in range(N):
    if N-1-l > r:
      ans_sum[N-1-l][r] = 0
    elif N-1-l == r:
      ans_sum[N-1-l][r]=ans[N-1-l][r]
    else:
      ans_sum[N-1-l][r]=ans_sum[N-l][r]+ans_sum[N-1-l][r-1]-ans_sum[N-l][r-1]+ans[N-1-l][r]

for i in range(Q):
  print(ans_sum[pq[i][0]-1][pq[i][1]-1])




Measured memory_bytes: 112344
#!usr/bin/env python3
from collections import defaultdict,deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())
def LS():return [list(x) for x in sys.stdin.readline().split()]
def S():
    res = list(sys.stdin.readline())
    if res[-1] == "\n":
        return res[:-1]
    return res
def IR(n):
    return [I() for i in range(n)]
def LIR(n):
    return [LI() for i in range(n)]
def SR(n):
    return [S() for i in range(n)]
def LSR(n):
    return [LS() for i in range(n)]

sys.setrecursionlimit(1000000)
mod = 1000000007

#A
def A():
    s = S()
    k = I()
    n = len(s)
    for i in range(n):
        if s[i] != s[0]:
            break
    else:
        print((k*n)>>1)
        return
    s += s
    t = s[i-1]
    for j in range(n)[::-1]:
        if s[j] != t:
            break
    s = s[i:j+1]
    ans = (i>>1)+((n-1-j)>>1)+((n-1-j+i)>>1)*(k-1)
    i = 0
    n = len(s)
    while i < n:
        t = s[i]
        l = 0
        while i < n and t == s[i]:
            i += 1
            l += 1
        ans += (l >> 1)*k
    print(ans)
    return

#B
def B():

    return

#C
def C():

    return

#D
def D():

    return

#E
def E():

    return

#F
def F():

    return

#Solve
if __name__ == "__main__":
    A()


Measured memory_bytes: 39152
#include <iostream>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <string>
#include <iomanip>
using namespace std;
int h,w;
char a[1000][1000];
bool b[1000][1000]={};
int d[1000][1000]={};
int main(){
	cin>>h>>w;
	queue<pair<int,int> > que;
	for(int i=0;i<h;i++){
		for(int j=0;j<w;j++){
			cin>>a[i][j];
			if(a[i][j]=='#'){
				que.push(make_pair(i,j));
				b[i][j]=1;
				d[i][j]=0;
			}
		}
	}
	int dx[4]={-1,0,1,0},dy[4]={0,-1,0,1};
	while(!que.empty()){
		pair<int,int> now=que.front();
		int x=now.first;
		int y=now.second;
		que.pop();
		for(int i=0;i<4;i++){
			int nx=x+dx[i],ny=y+dy[i];
			if(0<=nx&&nx<h&&0<=ny&&ny<w&&!b[nx][ny]){
				b[nx][ny]=1;
				d[nx][ny]=d[x][y]+1;
				que.push(make_pair(nx,ny));
			}
		}
	}
	int ans=0;
	for(int i=0;i<h;i++){
		for(int j=0;j<w;j++){
			ans=max(ans,d[i][j]);
		}
	}
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 14352
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>

typedef struct{
	std::string word;
	std::vector<int> page;
}Index;

bool operator<(const Index& x, const Index& y) { return x.word < y.word ;}


int main(void){
	int i, page;
	std::string word;

	std::vector<Index> Books;

	int NoW = 0;
	while(std::cin >> word >> page){
		for(i=0;i<NoW;i++){
			if(Books[i].word==word){
				Books[i].page.insert(Books[i].page.end(), page);
				break;
			}
		}
		if(i==NoW){
			Index temp;
			temp.word = word;
			temp.page.insert(temp.page.begin(), page);
			Books.insert(Books.end(), temp);
			NoW++;
		}
	}
	
	std::sort(Books.begin(), Books.end());

	for(unsigned int i=0;i<Books.size();i++){
		std::sort(Books[i].page.begin(), Books[i].page.end());
	}

	for(unsigned int i=0;i<Books.size();i++){
		std::cout << Books[i].word << std::endl;
		for(unsigned int j=0;j<Books[i].page.size();j++){
			std::cout << Books[i].page[j];
			if(j!=Books[i].page.size()-1){
				std::cout << " ";
			}
		}
		std::cout << std::endl;
	}

	return 0;
}



Measured memory_bytes: 3192
def resolve():
    '''
    code here
    '''
    N, K = [int(item) for item in input().split()]
    As = [int(item) for item in input().split()]

    if K == 2:
        print(N-1)
    elif N == K:
        print(1)
    else:
        if (N-1) % (K-1) == 0:
            print((N-1)//(K-1))
        else:
            print((N-1)//(K-1) + 1)

if __name__ == "__main__":
    resolve()


Measured memory_bytes: 20020
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;

public class Main {
	public static void main(String[] a) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		ArrayList<String> al = new ArrayList<String>();

		String str;
		// 1???????????\?????????????????????????????????
		while ((str = br.readLine()) != null) {
			if (str.length() == 0) {
				break;
			}
			al.add(str);
		}

		int[][] gcdLcm = new int[al.size()][2];

		for (int i = 0; i < al.size(); i++) {
			String[] buf = al.get(i).split(" ");
			int m = Integer.parseInt(buf[0]);
			int n = Integer.parseInt(buf[1]);
			gcdLcm[i][0] = gcd(m, n);
			gcdLcm[i][1] = lcm((long)m, (long)n, (long)gcdLcm[i][0]);
		}

		//??????
		for(int i=0;i<gcdLcm.length;i++){
			System.out.println(gcdLcm[i][0]+" "+gcdLcm[i][1]);
		}
	}

	// GCD????¨????
	private static int gcd(int m, int n) {
		return n == 0 ? m : gcd(n, m % n);
	}

	// LCM????¨????
	private static int lcm(long m, long n, long gcd) {
		return (int)(m * n / gcd);
	}
}

Measured memory_bytes: 24176
n=int(input())
a=list(map(int,input().split()))

cnt=0
for i in range(n):
    minj=i
    for j in range(i,n):
        if a[j]<a[minj]:
            minj=j
            
    if minj!=i:
        ab=a[i]
        a[i]=a[minj]
        a[minj]=ab
        cnt+=1

def convert(list):
    res=" ".join(map(str, list))
    return res
print(convert(a))
print(cnt)


Measured memory_bytes: 5600
N = int(input())
A = list(input())
B = list(input())
C = list(input())
score = 0

#val_arrayを作成
val_array = [{} for _ in range(N)]
for i in range(N):
    val_array[i][A[i]] = 0
    val_array[i][B[i]] = 0
    val_array[i][C[i]] = 0

#val_arrayに値を格納
for i in range(N):
    val_array[i][A[i]] += 1
    val_array[i][B[i]] += 1
    val_array[i][C[i]] += 1

#i文字目の候補の内,一番valueが大きいものを取り出し，3との差を取って評価値とする
for i in range(N):
    score += 3 - max(val_array[i].values())

print(score)

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

#define rep(X,N) for(ll X = 0LL; X < (N); X++)
#define ALL(V) (V).begin(),(V).end()
#define endl "\n"

using namespace std;
typedef long long ll;

const double PI = 3.1415926535897932384626;
const ll MODN = 1000000007;
const ll MODN2 = 998244353;
const double EPS = 1e-10;

int main(){

    int n;
    cin >> n;

    vector<ll> a(n);

    rep(i, n){
        cin >> a[i];
    }

    ll money = 1000;
    ll stock = 0;

    rep(i, n - 1){
        //buy
        if(a[i] < a[i + 1]){
            ll tmpstock = money / a[i];
            stock += tmpstock;
            money -= tmpstock * a[i];
        }else if(stock > 0 && a[i] > a[i + 1]){
            money += stock * a[i];
            stock = 0;
        }
    }

    money += stock * a[n - 1];

    cout << money << endl;

    return 0;
}


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

int main(void){
  double x,y;
  int n;
  double vx,vy;
  double r;
  while(1){
    scanf("%d",&n);
    if(n==-1)break;
    x=1;
    y=0;
    for(int i=0;i<n-1;i++){
      vx=-y;
      vy=x;
      r=sqrt(x*x+y*y);
      vx=vx/r;
      vy=vy/r;
      x+=vx;
      y+=vy;
    }
    printf("%lf\n%lf\n",x,y);
  }
  return 0;
}



Measured memory_bytes: 2064
#include <stdio.h>
#include <string.h>
#include <math.h>
#include <stdlib.h>
#define MOD 1000000007
#define MAX(a,b) (a>b?a:b)
#define MAX3(a,b,c) MAX(a,MAX(b,c))
#define MIN(a,b) (a<b?a:b)
#define MIN3(a,b,c) MIN(a, MIN(b,c))
typedef long long lli;
int cmp(const void *a, const void *b) {
    if((*(lli*)b - *(lli*)a) > 0) {
        return 1;
    } else if((*(lli*)b - *(lli*)a) < 0) {
        return -1;
    }
    return 0;
}

int main()
{
    int x, y, z, k, i, j;
    lli a, b, c;
    scanf("%d%d%d%d",&x,&y,&z,&k);
    lli *d = (lli*)malloc((x*y) * sizeof(lli));
    for(i=0; i<x; i++) {
        scanf("%lld",&a);
        for(j=0; j<y; j++) {
            d[i + j*x] = a;
        }
    }
    for(j=0; j<y; j++) {
        scanf("%lld",&b);
        for(i=0; i<x; i++) {
            d[i + j*x] += b;
        }
    }
    qsort(d,x*y,sizeof(lli),cmp);
    int l = MIN(k, x*y);
    // for(i=0; i<l; i++) printf("d=%lld\n",d[i]);
    // free(d+l);
    lli *e = (lli*)malloc((l*z) * sizeof(lli));
    for(i=0; i<z; i++) {
        scanf("%lld",&c);
        for(j=0; j<l; j++) {
            e[i + j*z] = c + d[j];
        }
    }
    qsort(e,l*z,sizeof(lli),cmp);
    // free(e+k);
    for(i=0; i<k; i++) {
        printf("%lld\n",e[i]);
    }
    return 0;
}


Measured memory_bytes: 54900
using System;
using System.Linq;//リストの使用
using System.Collections.Generic;
using System.Text;//テキストの高速出力に必要
class Program
{
	static void Main()
	{
		long n = long.Parse(Console.ReadLine());//long.Parseはstringをlongに変換。
		long[] nums = Array.ConvertAll(Console.ReadLine().Split(' '),long.Parse);
    Array.Sort(nums);
    long memo = nums[0];
    long count = 1;
    long answer = 0;

    for(int i = 1; i < n; i++)
    {
      if(memo == nums[i]) count++;
      else
      {
        if(count >= memo) answer += count - memo;
        else answer += count;
        
        count = 1;
        memo = nums[i];
      }
    }
    if(count >= memo) answer += count - memo;
    else answer += count;
    
		Console.WriteLine(answer);//WriteLineをWriteとすると、改行なしで出力。
	}
}

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

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

const long long MOD = 1000000007;

int main(){
  int k,x;
  cin >> k >> x;
  int l=x-k+1,r=x+k-1;
  for(int i=l;i<r+1;i++){
    cout << i << endl;
  }
  cout << endl;
}


Measured memory_bytes: 256
# 2019/12/29
# ランレングス

n,k=map(int,input().split())
point=list(map(int,input().split()))
t=input()

rsp={'r':0,'s':1,'p':2}

ls=[[] for _ in range(k)]

for i in range(n):
    ls[i%k].append(t[i])    
ans=0
for e in ls:
    cnt=1
    for i in range(1,len(e)):
        if e[i-1]==e[i]:
            cnt+=1
        else:
            pp=(rsp[e[i-1]]-1+3)%3
            ans+=-(-cnt//2)*point[pp]
            cnt=1
    pp=(rsp[e[-1]]-1+3)%3
    ans+=-(-cnt//2)*point[pp]


print(ans)

Measured memory_bytes: 13436
#[allow(unused_macros)]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };

    ($next:expr, mut $var:ident : $t:tt $($r:tt)*) => {
        let mut $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

#[allow(unused_macros)]
macro_rules! debug {
    ($($a:expr),*) => {
        #[cfg(debug_assertions)]
        writeln!(&mut std::io::stderr(), concat!("[DEBUG] ", $(stringify!($a), "={:?} "),*), $($a),*);
    }
}

#[allow(unused_imports)]
use std::cmp::{min, max};

#[allow(unused_imports)]
use std::io::Write;

fn main() {
    input!{
      n: i64,
      a: i64,
      b: i64,
      c: i64,
      d: i64,
      e: i64,
    }
    let m = min(min(a, min(min(b, c), d)),e);
    let delay = (n+m-1)/m;
    println!("{}", 5+delay-1);
}


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

using namespace std;

#define rep(i,n) for(int i=0;i<(n);i++)
#define repr(i,x,n) for(int i=(x);i<(n);i++)
#define INT_MAX 2147483647
#define sort(a) sort(a.begin(),a.end())

typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<vl> vvl;

int main(){
    
    int n;
    cin >> n;
    vi a(n),b(n);
    rep(i,n){
        cin >> a[i];
        b[i] = a[i];
    }

    sort(a);

    rep(i,n){
        if(b[i] == a[n-1]){
            cout << a[n-2] << endl;
        }else{
            cout << a[n-1] << endl;
        }
    }

    return 0;
}



Measured memory_bytes: 3200
h, w = map(int, input().split())
l = []
for i in range(h):
  s = input()
  a = []
  for j in range(w):
    a.append(s[j])
  l.append(a)
arr = []
for i in range(h):
 
  line = ''
  for j in range(w):
    if l[i][j] == "#":
        line += "#"
    else:
        k = 0
        if 0 <= i - 1 < h:
            if 0 <= j - 1 < w:
                if l[i - 1][j - 1] == "#":
                    k += 1
            if l[i - 1][j] == "#":
                k += 1
            if 0 <= j + 1 < w:
                if l[i - 1][j + 1] == "#":
                    k += 1

        if 0 <= j - 1 < w:
            if l[i][j - 1] == "#":
                k += 1
        if 0 <= j + 1 < w:
            if l[i][j + 1] == "#":
                k += 1        

        if 0 <= i + 1 < h:
            if 0 <= j - 1 < w:
                if l[i + 1][j - 1] == "#":
                    k += 1
            if l[i + 1][j] == "#":
                k += 1
            if 0 <= j + 1 < w:
                if l[i + 1][j + 1] == "#":
                    k += 1
        line += str(k)
  arr.append(line)

for e in arr:
  print(e)

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

int main() {
  int N;
  cin >> N;
  
  vector<int> d(N);
  for (int i = 0; i < N; i++) {
    cin >> d.at(i);
  }
  
  int ans = 0;
  for (int i = 0; i < N; i++) {
    if (d.at(i) == 0) {
      continue;
    }
    else {
      ans += 1;
      if (i != N - 1) {
        for (int j = i+1; j < N; j++) {
          if (d.at(i) == d.at(j)) {
            d.at(j) = 0;
          }
        }
      }
    }

  }
  cout << ans << endl;
  
  
}

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

int main(){
    long long int n,k,ans=0;
    cin >> n >> k;
    vector<long long int> h(n);
    for(long long int i=0;i<n;i++){
        cin >> h.at(i);
    }
    sort(h.begin(),h.end());

    for(long long int i=0;i<n-k;i++){
        ans+=h.at(i);
    }

   cout << ans << endl;


}

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

int main()
{
	int n;
    int k;

	cin >> n;
    cin >> k;

	vector<int> h(n);
	REP(i, n) {
		cin >> h.at(i);
	}	

    vector<long> dp(n, 10000000000);
    dp.at(0) = 0;
    dp.at(1) = abs(h.at(1) - h.at(0));

    for (int i = 2; i < n; i++) {
        for (int j = 1; j < k+1; j++) {

            if (i < j)      break;

            long tmp_dp = dp.at(i-j) + abs(h.at(i) - h.at(i-j));
            if (tmp_dp < dp.at(i))      dp.at(i) = tmp_dp;
            
        }
    }

    cout << dp.at(n-1) << endl;
}


Measured memory_bytes: 1408
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {
    public static void main(String[] args) throws IOException {
        BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
        String line = in.readLine();
        int input = Integer.valueOf(line);
        int a = input % 10;
        String ans = "";
        switch (a) {
            case 2:
            case 4:
            case 5:
            case 7:
            case 9:
                ans = "hon";
                break;
            case 0:
            case 1:
            case 6:
            case 8:
                ans = "pon";
                break;
            case 3:
                ans = "bon";
                break;
        }
        System.out.println(ans);


    }
}

Measured memory_bytes: 32564
#include <iostream>
using namespace std;
#include <vector>
#include <algorithm>
int main(){
  int count,n;
  cin >> n;
  vector<int> p(n);
  for(int i;i<n;i++){
    cin >> p[i];
  }
  sort(p.begin(),p.end());
  auto ptr=p.begin();
  while(ptr!=p.end()){
    int cc=*ptr,f=0;
    while(cc == *ptr && ptr != p.end())f++,ptr++;
    count+=f%2;
  }
  cout << count;
}


Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
const int large = 100000;
int main(){
    string S, T;
    int temp = 0, t = large;
    cin >> S >> T;
    for(int i = 0; i < S.size() - T.size() + 1; i++){
        temp = 0;
        for(int j = 0; j < T.size(); j++){
            if(S.at(j + i) != T.at(j)){
                temp++;
            }
        }
        t = min(temp, t);
    }
    cout << t << endl;
    return 0;
}

Measured memory_bytes: 3616
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <cmath>
#include <map>
#include <queue>
#include <iomanip>
#define MOD 1000000007
typedef long long ll;
using namespace std;

int N,M;
vector<int> g[770];
bool used[770];
int color[770];

pair<int,int> dfs(int now,int col){
    used[now]=true;
    color[now]=col;
    pair<int,int> res;
    if(col==1) res.first++;
    else res.second++;

    for(int i=0;i<g[now].size();i++){
        int u=g[now][i];
        if(color[u]==col){
            cout<<-1<<endl;
            exit(0);
        }
        if(used[u]) continue;
        pair<int,int> tp=dfs(u,-col);
        res.first+=tp.first;
        res.second+=tp.second;
    }
    return res;
}

int main(){
  cin>>N>>M;
  bool edge[N+1][N+1]={};
  for(int i=0;i<M;i++){
      int a,b;
      cin>>a>>b;
      a--;
      b--;
      edge[a][b]=true;
      edge[b][a]=true;
  }
  for(int i=0;i<N;i++){
      for(int j=0;j<N;j++){
          if(i==j) continue;
          if(!edge[i][j]) g[i].push_back(j);
      }
  }

  vector<pair<int,int>> v;
  for(int i=0;i<N;i++){
      if(used[i]) continue;
      pair<int,int> tp=dfs(i,1);
      v.push_back(tp);
  }
  
  int dp[N+1][N+1]={};
  dp[0][0]=1;
  for(int i=0;i<v.size();i++){
      for(int j=0;j<N;j++){
          if(dp[i][j]==0) continue;
          dp[i+1][j+v[i].first]=1;
          dp[i+1][j+v[i].second]=1;
      }
  }

  int ans=MOD;
  for(int i=0;i<=N;i++){
      if(dp[v.size()][i]>0){
          int z=i*(i-1)/2;
          int w=(N-i)*(N-i-1)/2;
          ans=min(ans,z+w);
      }
  }
  cout<<ans<<endl;

  return 0;
}


Measured memory_bytes: 3584
#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=5e18;

int main() {
  ll n,m;
  cin >> n >> m;
  if(n>1&&m>1) {
    cout << (n-2)*(m-2) << endl;
  }
  if((n==1&&m>1)||(n>1&&m==1)) {
    cout << max(n-2,m-2) << endl;
  }
  if(n==1&&m==1) {
    cout << 1 << endl;
  }
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		int N = scanner.nextInt();
		int x = scanner.nextInt();
		long count = 0;
		int[] a = new int[N];
		for(int i=0; i<N;i++) {
			a[i] = scanner.nextInt();
			if(a[0]>x) {
				count += a[0]-x;
				a[0] = x;
			}
			if(i>=1) {
				if(a[i-1]+a[i]>x) {
					count += a[i-1]+a[i]-x;
					a[i] -= a[i-1]+a[i]-x;
				}
			}
		}
		System.out.println(count);
		scanner.close();
	}

}


Measured memory_bytes: 49336
#include<bits/stdc++.h>
using namespace std;
typedef pair<long long, long long> pll;

int n,k;

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

    cin >> n >> k;
    int cnt = n*(n-1)/2 - k;
    if(cnt < n - 1){puts("-1"); return 0;}
    cout << cnt << '\n';
    for(int i=1;i<=n;i++){
        for(int j=i+1;j<=n;j++){
            cout << i << " " << j << '\n';
            cnt--;
            if(cnt == 0){
                return 0;
            }
        }
    }


    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

int main() {
  int n,w,h,s,t;
  int board[100][100];
  int i,j;
  int x,y;
  int max,cnt;

  while(scanf("%d",&n),n){
  	scanf("%d%d",&w,&h);

  	for(i = 0;i < 100;i++){
  		for(j = 0;j < 100;j++){
  			board[i][j] = 0;
  		}
  	}

    for(i = 0;i < n;i++){
      scanf("%d%d",&x,&y);
      board[y][x] = 1;
    }

    scanf("%d%d",&s,&t);
    for(max = 0,y = 1; y <= h; y++){
      for(x = 1; x <= w; x++){
        for(cnt = 0,i = 0; i < t; i++){
          if(y + i > h)break;
          for(j = 0; j < s; j++){
            if(x + j > w)break;
            cnt += board[y + i][x + j];
            if(cnt > max)max = cnt;
          }
        }
      }
    }
    printf("%d\n",max);
  }
  return 0;
}

Measured memory_bytes: 640
#include <iostream>
#include <vector>
#include <cstdio>
#include <string>
#include <cmath>
#include <algorithm>
#include <climits>
#define ll long long
#define MAX 25 * 1e13
#define N  200010

#define SIZE(A) ((int)A.size())
#define LEN(A) ((int)A.length())
#define MP(A,B) make_pair(A,B)
#define PB(X) push_back(X)
#define EB(X) emplace_back(X)
#define REP(i,a) for(int i=0;i<(a);++i)
#define rep(i, n) for (int i = 0; i < (n); i++)
#define repr(i, n) for (int i = (n) - 1; i >= 0; i--)
#define range(a) a.begin(), a.end()
#define VI vector<int>;

using namespace std;
int MOD = 1000000007;


int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n;
  cin >> n;
  ll ret = 0;
  for (ll i=1 ; i <= n ; i++ ){
    if( i % 3 != 0 && i % 5 != 0 )
      ret += i;
  }
  cout << ret << endl;

  return 0;
}



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

signed main() {
  int N;
  cin >> N;
  string S;
  cin >> S;
  if( N % 2 == 1 ){
    cout << "No" << endl;
    return 0;
  }
  if( S.substr( 0, N/2 ) == S.substr(N/2) ){
    cout << "Yes" << endl;
  }else{
    cout << "No" << endl;
  }
  

      
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
typedef long long int lint;

#define PI acos(-1)
#define INF64 1LL << 60
#define INF32 1 << 29
#define LIMIT(d_in, d_min, d_max) max(d_min, min(d_max, d_in))
#define all(a) (a).begin(), (a).end()
#define INV ((long long int)1000000007)

using namespace std;

void execute()
{
	lint A, B, K;
	cin >> A >> B >> K;

	if (A + B <= K)
	{
		cout << "0 0" << endl;
	}
	else if (A <= K)
	{
		cout << "0 " << B - (K - A) << endl;
	}
	else
	{
		cout << A - K << " " << B << endl;
	}

	return;
}

int main()
{
	cin.tie(0);
	ios_base::sync_with_stdio(false);
	std::cout << std::fixed << std::setprecision(15);
	execute();

	int stop;
	cin >> stop;

	return 0;
}

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

int main()
{
  string s;
  cin >> s;
  string ans = "yes";
  bool b[26];
  rep(i, 26) b[i] = false;
  rep(i, s.size()){
    if(b[s[i] - 'a']) ans = "no";
    b[s[i] - 'a'] = true;
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 3592
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;
int main() {
    int a, b, c, k; cin >> a >> b >> c >> k;
    int cnt = 0;
    while (a >= b) {
        b *= 2;
        cnt++;
    }
    while (b >= c) {
        c *= 2;
        cnt++;
    }

    if (cnt <= k) cout << "Yes";
    else cout << "No";
}


Measured memory_bytes: 3640
#define _USE_MATH_DEFINES

#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <cmath>
#include <algorithm>
#include <vector>
#include <queue>
#include <map>
#include <list>

using namespace std;

typedef pair<double, double> P;
long long int INF = 1e18;
long long int MOD = 1e9 + 7;

int N;
P A[500001];

bool compare_y(P a, P b){
	return a.second < b.second;
}

// 最近２点間距離を求める
double closest_pair(P *a, int n){
	if(n <= 1){
		return INF;
	}
	int m = n / 2;
	double x = a[m].first;
	double d = min(closest_pair(a, m), closest_pair(a + m, n - m));
	inplace_merge(a, a + m, a + n, compare_y);
	
	vector<P> b;
	for(int i = 0; i < n; i++){
		if(fabs(a[i].first - x) >= d){
			continue;
		}
		for(int j = 0; j < b.size(); j++){
			double dx = a[i].first - b[b.size() - j - 1].first;
			double dy = a[i].second - b[b.size() - j - 1].second;
			if(dy >= d){
				break;
			}
			d = min(d, sqrt(dx * dx + dy * dy));
		}
		b.push_back(a[i]);
	}
	return d;
}

int main(){
	
	cin >> N;
	
	for(int i = 0; i < N; i++){
		cin >> A[i].first >> A[i].second;
	}
	
	sort(A, A + N);
	
	printf("%.10f\n", closest_pair(A, N));
	
	return 0;
}


Measured memory_bytes: 14164
#include<bits/stdc++.h>
const int INF = 1e9;
const int MOD = 1e9+7;
using LL = long long;
const LL LINF = 1e18;
using namespace std;
#define COUT(v) cout<<(v)<<endl
#define CIN(n)  int(n);cin >> (n)
#define LCIN(n) LL(n);cin >> (n)
#define SCIN(n) string(n);cin >> (n)
#define YES(n) cout<<((n)? "YES" : "NO")<<endl
#define Yes(n) cout<<((n)? "Yes" : "No")<<endl
#define POSSIBLE(n) cout << ((n) ? "POSSIBLE" : "IMPOSSIBLE"  ) << endl
#define Possible(n) cout << ((n) ? "Possible" : "Impossible"  ) <<endl

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) for(int i=0;i<(n);++i)
#define REPR(i,n) for(int i=n;i>=0;i--)

#define FOREACH(x,a) for(auto& (x) : (a) )

#define ALL(obj) (obj).begin(),(obj).end()

#define P pair<int,int>
#define I vector<int>
#define S set<int>
#define pb(v) push_back(v)
#define V vector
#define rt return
#define rmsame(a) sort(ALL(a)),a.erase(unique(ALL(a)), a.end())

typedef string::const_iterator State;
class PalseError {};
class Edge{
public:
    int from,to,value;
    Edge(int a,int b,int c){
        from = a;
        to = b;
        value = c;
    }
    Edge(int a,int b){
        from = a;
        to = b;
    }
};
int count_a[1000000];
int moke[1000000];
int main(){
   string str;cin >> str;
   string s;
   int ruiseki[1000000];
   ruiseki[0]=0;
   FOREACH(a,str){
       if(a != 'x'){
           s.pb(a);
       }
   }
   string t = s;
   reverse(ALL(s));

    if(s==t){
        int w = 0;
        for(int a = 0;a < str.size();a++){
            if(str.at(a)=='x'){
                count_a[w]++;
            }else{
                w++;
            }
        }
        w = 0;
        for(int a = 0;a < str.size();a++){
            int itr = str.size()-a-1;
            if(str.at(itr)=='x'){
                moke[w]++;
            }else{
                w++;
            }
        }
        w = 0;
        int ans = 0;
        for(int a = 0;a < s.size()/2+1;a++){
           // cout<<count_a[a]<<" "<<moke[a]<<endl;
            ans += abs(count_a[a]-moke[a]);
        }
        COUT(ans);
    }else{
        COUT(-1);
    }
    return 0;
}


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

int main() {
	
	string s;
	cin >> s;
	bool flg;
	auto t = s;
	reverse(t.begin(),t.end());
	int n = s.size();
	auto s1 = s.substr(0,(n-1)/2);
	auto s2 = s.substr((n+3)/2-1);
	auto t1 = s1;
	auto t2 = s2; 
	reverse(t1.begin(),t1.end());
	reverse(t2.begin(),t2.end());
	cout << (s==t&&s1==t1&&s2==t2 ? "Yes":"No") << endl;
}

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

int gcd(int a, int b) {
    if (a < b) swap(a, b);
    while (b) {
        a %= b;
        swap(a, b);
    }
    return a;
}

int main() {
    int N;
    cin >> N;
    vector<int> A(N);
    for (int i = 0; i < N; i++)
        cin >> A[i];
    
    int ans = gcd(A[0], A[1]);
    for (int i = 2; i < N; i++) {
        if (ans == 1) break;
        ans = gcd(ans, A[i]);
    }
    cout << ans << endl;
    return 0;
}    
    

Measured memory_bytes: 640
#include <iostream>
#include <iomanip> // << fixed << setprecision(xxx)
#include <algorithm> // do { } while ( next_permutation(A, A+xxx) ) ;
#include <vector>
#include <string> // to_string(nnn) // substr(m, n) // stoi(nnn)
#include <complex>
#include <tuple> // get<n>(xxx)
#include <queue>
#include <stack>
#include <map> // if (M.find(key) != M.end()) { }
#include <set> // S.insert(M);
// if (S.find(key) != S.end()) { }
// for (auto it=S.begin(); it != S.end(); it++) { }
// auto it = S.lower_bound(M);
#include <random> // random_device rd; mt19937 mt(rd());
#include <cctype>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstdlib> // atoi(xxx)
using namespace std;

#define DEBUG 0 // change 0 -> 1 if we need debug.
// insert #if<tab> by my emacs. #if DEBUG == 1 ... #end

typedef long long ll;

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

// const int C = 1e6+10;
const int infty = 1000000007;

int N, M, R;
int r[10];
int dist[210][210];
int A[100010];
int B[100010];
int C[100010];

int main () {
  cin >> N >> M >> R;
  for (auto i = 0; i < R; ++i) {
    cin >> r[i];
    r[i]--;
  }
  for (auto i = 0; i < M; ++i) {
    cin >> A[i] >> B[i] >> C[i];
    A[i]--;
    B[i]--;
  }
  fill(&dist[0][0], &dist[0][0]+210*210, infty);
  for (auto i = 0; i < N; ++i) {
    dist[i][i] = 0;
  }
  for (auto i = 0; i < M; ++i) {
    dist[A[i]][B[i]] = C[i];
    dist[B[i]][A[i]] = C[i];
  }
  for (auto k = 0; k < N; ++k) {
    for (auto i = 0; i < N; ++i) {
      if (k == i) continue;
      for (auto j = 0; j < N; ++j) {
        if (i == j) continue;
        if (k == j) continue;
        dist[i][j] = min(dist[i][j], dist[i][k] + dist[k][j]);
        // cerr << "dist[" << i << "][" << j << "] = " << dist[i][j] << endl;
      }
    }
  }
  sort(r, r+R);
  int ans = infty;
  do {
    int res = 0;
    for (auto i = 0; i < R-1; ++i) {
      res += dist[r[i]][r[i+1]];
    }
    ans = min(ans, res);
  } while (next_permutation(r, r+R));
  cout << ans << endl;
}


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

int main(void) {
    int n;
    long long sumt = 0, suma = 0;
    cin >> n;
    for (int i = 0; i < n; i++) {
        int t, a;
        cin >> t >> a;
        if (i == 0) sumt = t, suma = a;
        else {
            sumt = t * max((sumt + t - 1) / t, (suma + a - 1) / a);
            suma = a * max((sumt + t - 1) / t, (suma + a - 1) / a);
        }
    }
    cout << sumt + suma << endl;
}


Measured memory_bytes: 256