akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
using namespace std::chrono;
#define idfc ios_base::sync_with_stdio(false),cin.tie(nullptr),cout.tie(nullptr)
//#define ll long long
#define pb emplace_back
#define mp make_pair
#define nt _ll128
#define ld long double
long double PI =3.14159265358979323846;
using ll = long long;



const ll modo=1e9+7;
const ll inf=LONG_LONG_MAX;
const ll ms=(2e5)+5;



int main()
{
    idfc;

 //   freopen("inptf1.txt","r",stdin);

    ll n,m,k;
    cin>>n>>m>>k;
    ll x1,y1,x2,y2;
    cin>>x1>>y1>>x2>>y2;
    ll i,j;
    vector<vector<ll>>  ar(n+1,vector<ll>(m+1));
    vector<vector<ll>>  dis(n+1,vector<ll>(m+1));
    //  ll ar[n+1][m+1];
    //  ll dis[n+1][m+1];

    char e;
    string s;
    cin.ignore();
    for(i=1;i<=n;i++)
    {
        getline(cin,s);
        for(j=1;j<=m;j++)
        {
            e=s[j-1];
            // cout<<e<<" ";
            dis[i][j]=inf;

            if(e=='.')ar[i][j]=1;
            else ar[i][j]=0;
        }
        //    cout<<"\n";
    }

    set<pair<ll,pair<ll,ll>>> ss;
    dis[x1][y1]=0;
    ss.insert({0,{x1,y1}});
    ll d;
    ll x,y;

    while(!ss.empty())
    {
        x1=ss.begin()->second.first;
        y1=ss.begin()->second.second;
        ss.erase(*ss.begin());
        d=dis[x1][y1];
        d++;

        for(i=1;i<=k;i++)
        {
            y=i+y1;
            if(y<=m&&(dis[x1][y]>=d)&&ar[x1][y])
            {
                ss.erase({dis[x1][y],{x1,y}});
                dis[x1][y]=d;
                ss.insert({dis[x1][y],{x1,y}});
            }
            else break;
        }

        for(i=1;i<=k;i++)
        {
            y=y1-i;
            if(y>=1&&(dis[x1][y]>=d)&&ar[x1][y])
            {
                ss.erase({dis[x1][y],{x1,y}});
                dis[x1][y]=d;
                ss.insert({dis[x1][y],{x1,y}});
            }
            else break;
        }


        for(i=1;i<=k;i++)
        {
            x=x1+i;
            if(x<=n&&(dis[x][y1]>=d)&&ar[x][y1])
            {
                ss.erase({dis[x][y1],{x,y1}});
                dis[x][y1]=d;
                ss.insert({dis[x][y1],{x,y1}});
            }
            else break;
        }

        for(i=1;i<=k;i++)
        {
            x=x1-i;
            if(x>=1&&(dis[x][y1]>=d)&&ar[x][y1])
            {
                ss.erase({dis[x][y1],{x,y1}});
                dis[x][y1]=d;
                ss.insert({dis[x][y1],{x,y1}});
            }
            else break;
        }
    }


    if(dis[x2][y2]==inf)cout<<"-1";
    else cout<<dis[x2][y2]<<"\n";

    return 0;
}


Measured memory_bytes: 42204
#include <bits/stdc++.h>
#define F first
#define S second
#define all(a) a.begin(),a.end()
#define setDP(arr) memset(arr,-1,sizeof arr)
#define Clear(arr) memset(arr,0,sizeof arr)
#define oo 2000000000
#define inf 1000000000000000000
#define P1 31
#define P2 37
#define M  1000000007
#define M2 1000000009
#define pii pair<ll,ll>
typedef long long ll;
using namespace std;
const int N = 255001;
const int SQRTN = 320;
const int LOGN = 20;
const long double PI = acos(-1);
const long double TAU = 2*PI;

ll n , a[N], b[N] , ctr ,tmp;

signed main(){
    cin >> n;
    for(int i = 0 ; i < n ; i++){
        scanf("%lld%lld",&a[i],&b[i]);
    }
    ctr=0;
    for(int i = n-1 ; i>=0 ; i--){
        tmp = a[i]+ctr;
        tmp %=b[i];
        if(tmp==0)continue;
        tmp=b[i]-tmp;
        ctr+=tmp;

    }
    cout << ctr << endl;


}



Measured memory_bytes: 1792
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <cstdlib>
#include <cmath>
#include <cstring>
#include <string>
#define LL long long
using namespace std;
const int maxn=2e5+10;
int n;
LL a[maxn];
LL sum,x;
int main(){
    cin>>n;
    for (int i=1;i<=n;i++) {cin>>a[i];a[i]-=i;}
    sort(a+1,a+1+n);
//    if (n&1) x=a[(n+1)/2]; else x=(a[(n+1)/2]+a[(n-1)/2])/2;
    x=a[(n+1)/2];
    for (int i=1;i<=n;i++) sum+=abs(a[i]-x);
    cout<<sum<<endl;
    return 0;
}


Measured memory_bytes: 1792
import numpy as np
N,M = map(int, input().split())
H = np.array(list(map(int, input().split())))
box = [[] for _ in range(N)]
for im in range(M):
  a,b = map(int, input().split())
  box[a-1].append(b)
  box[b-1].append(a)
ans = 0
for n in range(N):
  index=np.array(box[n],dtype=int)-1
  if len(index)==0:
    ans += 1
    continue
  if H[n]>np.max(H[index]):
    ans += 1
print(ans)

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

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


Measured memory_bytes: 256
import sys
def input(): return sys.stdin.readline().rstrip()
INF = 10000000000000
N,M,X = map(int,input().split())

C = []
A = []
for i in range(N):
    vec = list(map(int,input().split()))
    C.append(vec[0])
    A.append(vec[1:])

ans = INF

for bit in range(1 << N):
    sum = 0
    skill = [0] * M
    for n in range(N):
        if bit & (1 << n):
            for i, s in enumerate(A[n],0):
                skill[i] += s
            sum += C[n]

    flag = True
    for i in range(M):
        if skill[i] < X:
            flag = False
            break
    if flag:
        ans = min(ans,sum)

if ans == INF:
    print(-1)
else:
    print(ans)

Measured memory_bytes: 9224
#include<cstdio>
#define NIF -1
#define MAX 30
struct Node{
	int parent = NIF;
	int left = NIF;
	int right = NIF;
};

Node T[MAX];
int D[MAX];
int H[MAX];

void setDepth(int u, int p)
{
	if(u == NIF) return;
	D[u] = p;
	setDepth(T[u].left, p+1);
	setDepth(T[u].right, p+1);
}

int setHeight(int u)
{
	int h1 = 0;
	int h2 = 0;
	if(T[u].left != NIF)
		h1 = setHeight(T[u].left) + 1;
	if(T[u].right != NIF)
		h2 = setHeight(T[u].right) + 1;
	return H[u] = (h1 > h2 ? h1 : h2);
}

int getSibling(int u)
{
	if(T[u].parent == NIF) return NIF;
	
	if(T[T[u].parent].left != u && T[T[u].parent].left != NIF)
		return T[T[u].parent].left;
	if(T[T[u].parent].right != u && T[T[u].parent].right != NIF)
		return T[T[u].parent].right;

	return NIF;
}
int getDegree(int u)
{
	int degree = 0;
	if(T[u].left != NIF) degree++;
	if(T[u].right != NIF) degree++;

	return degree;
}
void print(int u)
{
	printf("node %d: ", u);
	printf("parent = %d, ", T[u].parent);
	printf("sibling = %d, ",getSibling(u));
	printf("degree = %d, ",getDegree(u));
	printf("depth = %d, ",D[u]);
	printf("height = %d, ",H[u]);
	if(T[u].parent == NIF) printf("root\n");
	else if(T[u].left == NIF && T[u].right == NIF) printf("leaf\n");
	else printf("internal node\n");

}

int main()
{
	int n;
	int id,l,r;
	scanf("%d", &n);
	for(int i=0; i<n; i++)
	{
		scanf("%d%d%d", &id, &l, &r);
		T[id].left = l;
		T[id].right = r;
		if(l != NIF) T[l].parent = id;
		if(r != NIF) T[r].parent = id;
	}
	int root = -1;
	for(int i=0; i<n; i++)
		if(T[i].parent == NIF)
			root = i;
	setDepth(root,0);

	setHeight(root);

	for(int i=0; i<n; i++)
		print(i);

	return 0;

}


Measured memory_bytes: 2624
A,B,C,D = list(map(int,input().rstrip()))


for i in range(8):
    op1=1 if i%2 ==0 else -1
    op2=1 if (i//2)%2==0 else -1
    op3=1 if (i//4)%2==0 else -1
    #print(op1,op2,op3)
    if A + op1*B + op2*C + op3*D == 7:
        print(str(A)+ ("+" if op1==1 else "-")
              +str(B)+ ("+" if op2==1 else "-")
               + str(C) +( "+" if op3==1 else "-")
              +str(D)+"=7"
                )
        exit()


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

int main()
{
	int a, b;
	cin >> a >> b;
	if ((a == 0 || b == 0) || (a > 0 && b < 0) || (a < 0 && b > 0))
	{
		cout << "Zero" << endl;
	}
	else if (a > 0 && b > 0)
	{
		cout << "Positive" << endl;
	}
	else
	{
		cout << (abs(a-b)%2==0?"Negative":"Positive") << endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main() {
  int A, B, C, D;
  cin >> A >> B >> C >> D;
  for (int i = 0; ; ++i) {
    if (i % 2 == 0) {
      C -= B;
      if (C <= 0) {
        cout << "Yes" << endl;
        break;
      }
    } else {
      A -= D;
      if (A <= 0) {
        cout << "No" << endl;
        break;
      }
    }
  }
}

Measured memory_bytes: 3620
import java.util.Scanner;

/**
 * Created by Administrator on 2017/4/22.
 */
public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        if (n <= 2) System.out.println(1);
        else {
            int res = 0;
            int pre = scanner.nextInt();
            boolean isupper = true;
            int count = 1;
            for (int i = 1; i < n; i ++) {
               int cur = scanner.nextInt();
                if (isupper && cur < pre) {
                    isupper= false;
                    if (count >= 2) {
                        res ++;
                        count = 1;
                        pre = cur;
                        continue;
                    }
                }else if (!isupper && cur > pre) {
                    isupper = true;
                    if (count >= 2) {
                        res ++;
                        count = 1;
                        pre = cur;
                        continue;
                    }
                }
                if (pre == cur && count < 2) {
                    while (pre == cur && i < n) {
                        pre = cur;
                        cur = scanner.nextInt();
                        count ++;
                        i ++;
                    }
                    if (i == n) {
                        break;
                    }
                    isupper = cur > pre;
                }

                count ++;
                pre = cur;

            }
            System.out.println(res + 1);
        }

    }
}


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

double n, x, t;

int main() {
  cin >> n >> x >> t;
  cout << (int)(ceil(n/x) * t) << endl;
  return 0;
}


Measured memory_bytes: 3716
#include <bits/stdc++.h>
#define ll long long
using namespace std;
 
const long long MAXVAL = (long long) 1e18 + 1;
const long long MOD = 1000000007ll;
//const long long MOD = 998244353ll;
const int INF = 1000000001;
 
long long poww(int x, long long pow) {
  if (pow == 0ll ) return 1;
  if (pow == 1ll) return x % MOD;
  long long ans = poww(x, pow >> 1) % MOD;
  ans = (ans * ans) % MOD;
  if ((pow & 1) == 1) {
    ans = (ans * x ) % MOD;
  }
  return ans % MOD;
}
 
ll gcd(ll x, ll y) {
  if (x == 0) return y;
  while (y) {
    x %= y;
    swap(x, y);
  }
  return x;
}

 
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  int q = 1;
  //cin >> q;
  while (q-- >0) {
    int n;
    cin >> n;
    int p[n];
    for (int i = 0; i < n; ++i) cin >> p[i];
    ll curstocks = 0;
    ll curmoney = 1000;
    for (int i = 0 ; i + 1 < n; ++i) {
      if (p[i + 1] > p[i]) {
        curstocks += curmoney / p[i];
        curmoney = curmoney % p[i];
        curmoney  += curstocks * p[i + 1];
        curstocks =  0;
      }
    }
    cout << curmoney << "\n";
  }

 
  return 0;
}


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

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 n,q,l,r;
int p[100100];
int sum[100100], len[100100];
bool use[100100];
const ll mod = 1e9+7;
int par_sum[50][100100];

ll n_, c[1<<20];

void init(int n){
  n_ = 1;
  while(n_<n)n_*=2;

  for(int i=n_-1;i<2*n_-1;i++){
    if(i-n_+2<=n)c[i] = len[i-n_+2];
    else c[i] = 1;
  }

  for(int i=n_-2;i>=0;i--){
    c[i] = lcm(c[2*i+1],c[2*i+2]);
  }
}

ll query(int a,int b,int k,int l,int r){
  if(r<=a || b<=l)return 1;
  if(a<=l && r<=b)return c[k];
  ll vl = query(a,b,k*2+1,l,(l+r)/2);
  ll vr = query(a,b,k*2+2,(l+r)/2,r);
  return lcm(vl,vr);
}

int main(){
  scanf("%d%d",&n,&q);
  for(int i=1;i<=n;i++)scanf("%d",p+i);

  memset(use,0,sizeof(use));

  for(int i=1;i<=n;i++){
    if(!use[i]){
      int now = p[i];
      int tmplen = 1, tmpsum = i;
     
      while(now!=i){
	tmplen++; (tmpsum += now) %= mod;
	now = p[now];
      }

      now = i;
      while(!use[now]){
	use[now] = true;
	len[now] = tmplen;
	sum[now] = tmpsum;
      }
    }
  }

  for(int i=1;i<=40;i++){
    par_sum[i][0] = 0;
    for(int j=1;j<=n;j++){
      if(len[j]==i)par_sum[i][j] = (par_sum[i][j-1] + sum[j]) % mod;
      else par_sum[i][j] = par_sum[i][j-1];
    }
  }

  init(n);

  for(int i=0;i<q;i++){
    scanf("%d%d",&l,&r);
    ll cycle = query(l-1,r,0,0,n_);

    ll res = 0;
    for(int i=1;i<=40;i++){
      res += (((cycle/i)%mod)*(((par_sum[i][r]-par_sum[i][l-1])%mod+mod)%mod))%mod;
      res %= mod;
    }

    cout << res << endl;
  }
}

Measured memory_bytes: 24092
#include <stdio.h>

int cmp_int(const void *a, const void *b) {
    return *(int*)a - *(int*)b;
}

int main(void) {
    int N, i, j, e[3];

    scanf("%d", &N);

    for (i = 0; i < N; i++) {
        for (j = 0; j < 3; j++) {
            scanf("%d", &e[j]);
        }
        qsort(e, 3, sizeof(int), cmp_int);

        if (e[0]*e[0] + e[1]*e[1] == e[2]*e[2]) {
            puts("YES");
        }
        else {
            puts("NO");
        }
    }

    return 0;
}

Measured memory_bytes: 584
# coding: utf-8
# Your code here!
H,W = map(int,input().split())
grid = []
for i in range(H):
    S = input()
    grid.append(S)

#print(grid)
left = [[0 for i in range(W)] for j in range(H)]   #そのマスからあとどれだけ左にいったら壁かを表す
right = [[0 for i in range(W)] for j in range(H)]
up = [[0 for i in range(W)] for j in range(H)]
down = [[0 for i in range(W)] for j in range(H)]

#iは行、jは列を表す

for i in range(H):
    cur = 0
    for j in range(W):
        if grid[i][j] == "#":
            cur = 0
        else:
            cur += 1
        left[i][j] = cur

for i in range(H):
    cur = 0
    for j in reversed(range(W)):
        if grid[i][j] == "#":
            cur = 0
        elif grid[i][j] == ".":
            cur += 1
        right[i][j] = cur

for j in range(W):       
    cur = 0
    for i in range(H):
        if grid[i][j] == "#":
            cur = 0
        else:
            cur += 1
        up[i][j] = cur

for j in range(W):       
    cur = 0
    for i in reversed(range(H)):
        if grid[i][j] == "#":
            cur = 0
        else:
            cur += 1
        down[i][j] = cur

res = 0
for i in range(H):
    for j in range(W):
        res = max([res, (left[i][j] + right[i][j] + up[i][j] + down[i][j] - 3)])
print(res)

Measured memory_bytes: 185988
using System;
using System.Collections.Generic;
using System.Linq;
using static System.Math;

namespace ConsoleApp1
{
    class Program
    {
        static void Main(string[] args)
        {
            A();
        }

        static void A()
        {
            var NM = ReadSplitInt();
            var N = NM[0];
            var M = NM[1];
            var a = new int[N+1];
            for (int i = 0; i < M; i++) a[ReadInt()] = 1;

            var  dp = new long[N + 1];
            for (int i = N; i >= 0; i--)
            {
                if (a[i] == 1 && i == N) break;

                if (i == N)
                {
                    dp[N] = 1;
                    continue;
                }
                if (a[i] == 1) continue;
                if (i == N - 1)
                {
                    dp[i] = dp[i + 1];
                    continue;
                }

                dp[i] = (dp[i + 1] + dp[i + 2]) % 1000000007;
            }

            Println(dp[0]);
        }

        static IEnumerable<int> Range(int start, int stop)
        {
            if (start < 0 || stop < 0 || start > stop || (start <= 0 && stop <= 0))
                return new List<int>();

            return Enumerable.Range(start, stop - start);
        }

        static bool IsDigit(string str)
        {
            var i = 0;
            return int.TryParse(str, out i);
        }

        static int SumDigits(long num)
        {
            return num.ToString().Select(x => x.ToString()).Sum(int.Parse);
        }

        static int[] ToIntArray(string str)
        {
            return str.Select(x => x.ToString()).Select(int.Parse).ToArray();
        }

        static int Gcd(int a, int b) => b == 0 ? a : Gcd(b, a % b);

        static bool IsPrime(int x)
        {
            if (x <= 1 || (x != 2 && x % 2 == 0)) return false;
            if (x == 2) return true;

            for (int i = 3; i < x; i += 2)
                if (x % i == 0) return false;

            return true;
        }

        static string Read() => Console.ReadLine();
        static int ReadInt() => int.Parse(Read());
        static long ReadLong() => long.Parse(Read());

        static List<string> ReadSplit() => Read().Split().ToList();
        static List<int> ReadSplitInt() => Read().Split().Select(int.Parse).ToList();
        static List<long> ReadSplitLong() => Read().Split().Select(long.Parse).ToList();

        static void Print(object value) => Console.Write(value.ToString());
        static void Println(object value) => Console.WriteLine(value.ToString());

        static string Join<T>(IEnumerable<T> list) => string.Join("", list);
    }

    public static class MyExtensions
    {
        public static string Slice(this string str, int start = 0, int stop = 0)
        {
            if (start > str.Length || stop > str.Length || start < 0 || stop < 0)
                return "";

            if (stop == 0) stop = str.Length;
            return str.Substring(start, stop - start);
        }
    }
}


Measured memory_bytes: 14304
a = int(input())
vote_dict = {}
for i in range(a):
    s = input()
    if s in vote_dict:
        vote_dict[s] += 1
    else:
        vote_dict[s] = 1
dic2 = sorted(vote_dict.items(), key=lambda x:x[1])
max_count = dic2[-1][1]
choose_list = []
for candidate in dic2:
    if(max_count == candidate[1]):
        choose_list.append(candidate[0])
print("\n".join(str(e) for e in sorted(choose_list)))

Measured memory_bytes: 48348
#include <iostream>
#include <math.h>
#include <stdio.h>
using namespace std;

int main(){
  double r;
  const double pi = M_PI;
  cin >> r;
  double area = r * r * pi;
  double circumference = 2 * r * pi;
  //cout << area << ' ' << circumference << endl;
  printf("%.8lf %.8lf\n",area,circumference);
  return 0;
}



Measured memory_bytes: 3168
#include <bits/stdc++.h>
using namespace std;
using ll = long long ;
int main(){
int n,l;
  cin >> n >> l;

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

  sort(s.begin(),s.end());
for(int i=0 ; i<n ;i++)
{
    cout << s[i];
}
 return 0  ;
}


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

#define debug(x) cerr << x << " = "(x) << endl;
#define ll long long
#define rep(i,x,y) for(int i=x;i<y;i++)
#define rel(i,x,y) for(int i=x-1;i>=y;i--)
#define all(x) x.begin(),x.end()

int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    ll n; cin >> n;
    int a[n];
    rep(i,0,n) cin >> a[i];
    ll l=a[0],r=0;
    rep(i,1,n) r += a[i];
    ll ans = abs(l-r);
    rep(i,1,n-1){
        l+=a[i];
        r-=a[i];
        ans = min(ans,abs(l-r));
    }
    cout << ans << endl;
}

Measured memory_bytes: 1024
#include <stdio.h>

int main(){
  int x,y;
  int tmp;
  int r;

  scanf("%d %d",&x,&y);

  if(x<y){
    tmp=x;
    x=y;
    y=tmp;
  }
  
  r=x%y;
  while(r!=0){
    x=y;
    y=r;
    r=x%y;

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



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

int main()
{
    int N; cin>>N;
    const int K=8;
    vector<int> pos(K,-1);
    for(int i=0;i<N;i++){
        int r,c; cin>>r>>c;
        pos[r]=c;
    }
    
    vector<int> p(K);
    for(int i=0;i<K;i++) p[i]=i;

    do{
        bool ok=true;
        for(int i=0;i<K;i++) if(pos[i]!=-1 and p[i]!=pos[i]) ok=false;
        for(int i=0;i<K-1;i++) for(int j=i+1;j<K;j++){
            if(abs(i-j)==abs(p[i]-p[j])) ok=false;
        }
        if(ok) break;
    }while(next_permutation(p.begin(),p.end()));

    vector<string> ans(K,string(K,'.'));
    for(int i=0;i<K;i++) ans[i][p[i]]='Q',cout<<ans[i]<<endl;
    return 0;
}


Measured memory_bytes: 3212
// Lets go to the next level 
// AIM CM at CF *__* asap 
// Hit A,B,C and D faster and reach Candidate Master
// Remember you were also a novice when you started, 
// hence never be rude to anyone who wants to learn something
// Never open a ranklist untill and unless you are done with solving problems, wastes 3/4 minuts 
// Donot treat CP as a placement thing, love it and enjoy it, you will succeed for sure.  


#include <bits/stdc++.h>
using namespace std;
#define mod (int)1000000007
#define MOD (int)10000000007
// Big two primes 
#define X 1001100011100001111ll
#define M 26388279066623ll
#define all(a) a.begin(),a.end()
#define for0(i, n) for (int i = 0; i < n; i++)
#define for0e(i, n) for (int i = 0; i <= n; i++)
#define for1(i, n) for (int i = 1; i <= n; i++)
#define loop(i,a,b) for (int i = a; i < b; i++)
#define bloop(i,a,b) for (int i = a ; i>=b;i--)
#define tc(t) int t; cin >> t; while (t--)
#define int long long 
#define ll long long
#define pb emplace_back
#define fio ios_base::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL)
#define in(x) scanf("%d", &x)
#define rr return 0
#define prec(n) fixed<<setprecision(n)
#define maxpq priority_queue<int>
#define minpq priority_queue<int, vector<int>, greater<int> >
#define inf (int)(1e18)
#define ini(a, i) memset(a, i, sizeof(a))
#define vi vector<int> 
#define F first
#define S second
#define pi pair<int, int>
#define ppi pair<pair<int,int> , int >
#define vii vector<pi>
const int MAXN = (int)((1e5) + 100);
int gcd(int a,int b) { if (a == 0) return b; return gcd(b%a, a);}
int max(int a,int b){if(a>b) return a; else return b;}
int min(int a,int b){if(a<b) return a; else return b;}  
int cbrt(int x){ int lo=1,hi=min(2000000ll,x);while(hi-lo>1){int mid=(lo+hi)/2;if(mid*mid*mid<x){lo=mid;}else hi=mid;}if(hi*hi*hi<=x) return hi;else return lo;} 
const int dx[4] = {-1, 1, 0, 0};
const int dy[4] = {0, 0, -1, 1};
const int N =  (int)(1e6+5); 


signed main(){
  fio;
    int h,w,n;
    cin>>h>>w>>n;
    int m = max(h,w);
    int ans = n/m;
    if(n%m != 0){
        ans++;
    }
    cout<<ans<<endl;

  rr;
}

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

int main() {
  ll n;
  cin >> n;
  string s = "";
  while(n){
    n--;
    s.push_back('a'+n%26);
    n /= 26;
  }
  reverse(s.begin(),s.end());
  cout << s << endl;
}

Measured memory_bytes: 3624
#include <iostream>

using namespace std;

int main()
{
    int m,f,r,sum;
    while (true){
    cin >> m >> f >> r;
    sum=(m+f);
     if(m==-1&&f==-1&&r==-1){
            break;
    }
    if(m==-1||f==-1){
        cout << "F" <<endl;
    }
    else if(sum>=80){
        cout << "A"<<endl;
    }
    else if(sum>=65){
       cout << "B"<<endl;
    }
    else if(sum>=50){
        cout << "C"<<endl;
    }
    else if(r>=50){
        cout <<"C"<<endl;
    }
    else if (sum>=30){
        cout << "D"<<endl;
    }

    else {
        cout << "F"<< endl;
    }

    }
    return 0;
}



Measured memory_bytes: 3116
n=int(input())
a=sorted([input()for i in range(2)])
s,t=len(a[0]),len(a[1])
c=[]
for i in range(n):
    if (n-i*t)%s==0:
        c.append(a[0]*((n-i*t)//s)+a[1]*i)
        break
for i in range(n):
    if (n-i*s)%t==0:
        c.append(a[1]*((n-i*s)//t)+a[0]*i)
        break
print(sorted(c)[0])

Measured memory_bytes: 4084
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const double pai=3.14159265358979;
const int N=1e6+7;
int n;
double a[N];
double ans[N];
struct ju{
	int x,y;
}e[N];
double cal(int p,int q){
	return sqrt((e[p].x-e[q].x)*(e[p].x-e[q].x)+(e[p].y-e[q].y)*(e[p].y-e[q].y));
}
double cross(double X1,double Y1,double X2,double Y2){
	return (X1*Y2)-(X2*Y1);
}
double compare(ju a,ju b,ju c){
	return cross(b.x-a.x,b.y-a.y,c.x-a.x,c.y-a.y);
}

int main(){
	scanf("%d",&n);
	for(int i = 1;i<=n;i++){
		cin>>e[i].x>>e[i].y;
	}
	for(int i = 1;i<=n;i++){
		int cnt=0;
		double maxx=0.0;
		for(int j = 1;j<=n;j++){
			if(j!=i){
				a[++cnt]=atan2(e[j].y-e[i].y,e[j].x-e[i].x);
			}
		}
		sort(a+1,a+cnt+1);
		for(int j = 1;j<cnt;j++){
			maxx=max(maxx,a[j+1]-a[j]-pai);
		}	
		maxx=max(maxx,pai-(a[cnt]-a[1]));
		ans[i]=(maxx)/(2.0*pai);
	}
	for(int i = 1;i<=n;i++){
		printf("%.10f\n",ans[i]);
	}
	return 0;
}

Measured memory_bytes: 4480
#include <cmath>
#include<iostream>
#include<vector>
#include<algorithm>
#include<functional>
#include<queue>
#include<set>
#include<tuple>
#include<bitset>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
ll inf = 1000000007;
vector<string>s;
int dx[4] = { 1,-1,0,0 };
int dy[4] = { 0,0,1,-1 };
bool seen[1005][1005];
ll nub = 0;
ll nuw = 0;
int h, w;
void dfs(ll y, ll x) {
    seen[y][x] = true;
    if (s[y][x] == '#') {
        nub++;
    }
    else {
        nuw++;
    }
    for (int i = 0; i < 4; i++) {
        int newy = y + dy[i];
        int newx = x + dx[i];
        if (newy >= 0 && newy < h && newx >= 0 && newx < w && seen[newy][newx] != true&&s[y][x]!=s[newy][newx]) {
            
            dfs(newy, newx);
        }
    }
}
int main(void) {
    cin >> h >> w;
    s.resize(h);
    for (int i = 0; i < h; i++) {
            cin >> s[i];
    }
    ll count = 0;
    for (int i = 0; i < h; i++) {
        for (int j = 0; j < w; j++) {
            if (s[i][j] == '.')continue;
            if (seen[i][j])continue;
            nub = nuw = 0;
            dfs(i, j);
            count += nub * nuw;
        }
    }
    cout << count << endl;
    return 0;
}



Measured memory_bytes: 16660
c1=list(map(int, input().split())) 
c2=list(map(int, input().split())) 
c3=list(map(int, input().split())) 

if c1[0]-c2[0]==c1[1]-c2[1]==c1[2]-c2[2] and c1[0]-c3[0]==c1[1]-c3[1]==c1[2]-c3[2]:
    print('Yes')
else:
    print('No')

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

int main() {
    ll h,n;
    std::cin >> h>>n;
    ll sum=0;
    for (int i = 0; i < n; i++) {
        ll tmp;
        std::cin >> tmp;
        sum+=tmp;
    }
    if(h<=sum){
        std::cout << "Yes" << std::endl;
    }else{
        std::cout << "No" << std::endl;
    }
}

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

void solve(){

	int n ;
	cin>>n ;

	unordered_map<string,int> mp ;

	rep(i,n){
		string s ;
		cin>>s ;

		sort(s.begin(),s.end()) ;

		mp[s]++ ;

	}

	ll sum=0 ;

	for(auto x: mp){

		sum+=((ll)x.second*((ll)x.second-1))/2 ;

	}

	cout<<sum ;

}

int main(){
	
	int y ;

	y=1 ;
	//cin>>y ;

	while(y--)
	{	
		solve() ;
	}

}

Measured memory_bytes: 10216
# -*- coding: utf-8 -*-
"""
B - Cut and Count

"""
import sys
from sys import stdin
input = stdin.readline


def solve(N, S):
    ans = 0
    for n in range(N):
        left = set(S[:n])
        right = set(S[n:])
        ans = max(ans, len(left & right))
    return ans


def main(args):
    N = int(input())
    S = input().strip()
    ans = solve(N, S)
    print(ans)


if __name__ == '__main__':
    main(sys.argv[1:])


Measured memory_bytes: 3064
N,Y = map(int,input().split())
ans_10000 = -1
ans_5000 = -1
ans_1000 = -1

for i in range(N+1):
    for j in range(N-i+1):
        if 10000 * i + 5000 * j + 1000 * (N - i - j) == Y:
            ans_10000 = i
            ans_5000 = j
            ans_1000 = N - i - j
print(ans_10000,ans_5000,ans_1000)

Measured memory_bytes: 3060
#include <iostream>
#include <vector>
#include <deque>
#include <algorithm>
#include <numeric>
#include <string>
#include <cstring>
#include <list>
#include <unordered_set>
#include <tuple>
#include <cmath>
#include <limits>
#include <type_traits>
#include <iomanip>
#include <map>
#include <unordered_map>
#include <queue>
#include <stack>
#include <set>
#include <bitset>
#include <regex>
#include <random>
#include<bits/stdc++.h>

using namespace std;

typedef long long ll;
#define rep(i,n)for(ll i=0;i<n;++i)
#define exout(x) printf("%.10f\n", x)
const double pi = acos(-1.0);
const ll MOD = 1000000007;
const ll INF = 1e16;
const ll MAX_N = 1010;

//最大公約数
ll gcd(ll x, ll y) {
	return y ? gcd(y, x % y) : x;
}

ll lcm(ll x, ll y) {
	if (x == 0 || y == 0)return 0;
	return (x / gcd(x, y) * y);
}

ll dx[4] = { 0,0,-1,1 };
ll dy[4] = { -1,1,0,0 };
ll dp[101010];
ll a[201010];

//long longしか使わない
//素数は1より大きい
int main() {
	ll n;
	cin >> n;
	vector<ll>a(n);
	rep(i, n) {
		cin >> a[i];
	}
	vector<ll>cnt(1010101);
	rep(i, n) {
		if (cnt[a[i]] != 0) {
			cnt[a[i]] = 2;
			continue;
		}
		for (ll j = a[i];j < 1010101;j += a[i])cnt[j]++;
	}
	ll ans = 0;
	rep(i, n) {
		if (cnt[a[i]] == 1)ans++;
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 12684
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main() {
	int x;
	for (int i = 1; true; i++) {
		cin >> x;
		if (x == 0)break;
		cout << "Case " << i << ": " << x << endl;
	}
	return 0;
}


Measured memory_bytes: 3108
#include<iostream>
#include<algorithm>
#include<string>
#include<sstream>
using namespace std;
int main() {
  long n,m;
  cin >> n >> m;
  int* a = new int[100000];
  int* b = new int[100000];
  for(int i=0;i<m;i++){
    cin >> a[i];
    cin >> b[i];
    a[i]--;
    b[i]--;
  }
  long* ans = new long[100000];
  int* g = new int[100000];
  long* num = new long[100000];
  for(int i=0;i<n;i++) g[i] = i;
  for(int i=0;i<n;i++) num[i] = 1;
  for(int i=m-1;i>=0;i--){
    if(i==m-1){
      ans[i] = n * (n-1);
    } else ans[i] = ans[i+1];
    int ga = a[i];
    int gb = b[i];
    while(ga!=g[ga]) ga = g[ga];
    while(gb!=g[gb]) gb = g[gb];
    if(ga==gb) continue;
    if(ga>gb) g[ga] = gb;
    else g[gb] = ga;
    int mi = min(ga,gb);
    int ma = max(ga,gb);
    ans[i] -= (n-num[mi])*num[mi];
    ans[i] -= (n-num[ma])*num[ma];
    num[mi] += num[ma];
    ans[i] += (n-num[mi])*num[mi];
  }
  for(int i=1;i<m;i++) cout << ans[i]/2 << endl;
  cout << n * (n-1)/2 << endl;

  return 0;
}


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

int main() {
  ll n,k;
  cin >> n >> k;

  vector<pair<ll, ll>> a(n);
  for (int i = 0; i < n; i++) {
    cin >> a[i].first >> a[i].second;
  }
  sort(a.begin(),a.end());
  int ans = 0;
  ll minv = 0, maxv = 0;
  for (int i = 0; i < n; i++) {
    maxv += a[i].second;
    if(k >= minv && k <= maxv) {
      ans = a[i].first;
      break;
    }
    minv = maxv;
  }
  cout << ans << '\n';
}

Measured memory_bytes: 1792
n = int(input())
blue_words = [input() for i in range(n)]
m = int(input())
red_words = [input() for i in range(m)]

ans = 0
for w in set(blue_words):
  tmp = blue_words.count(w) - red_words.count(w)
  if tmp > ans:
    ans = tmp

print(ans)

Measured memory_bytes: 9180
class csr:
    def __init__(self,N,edges):
        self.start = [0]*(N+1)
        self.elist = [0]*len(edges)
        for e in edges:
            self.start[e[0]+1] += 1
        for i in range(1,N+1):
            self.start[i] += self.start[i-1] 
        counter = self.start[:]
        for e in edges:
            self.elist[counter[e[0]]] = e[1]
            counter[e[0]] += 1

class scc_graph:
    def __init__(self,N):
        self.N = N
        self.edges = []
    
    def add_edge(self,v,w):
        self.edges.append((v,w))

    def scc_ids(self):
        N = self.N
        g = csr(N,self.edges)
        now_ord = group_num = 0
        visited = []
        low = [0]*N
        order = [-1]*N
        ids = [0]*N
        parent = [-1]*N
        stack = []
        for i in range(N):
            if order[i] == -1:
                stack.append(i)
                stack.append(i)
                while stack:
                    v = stack.pop()
                    if order[v] == -1:
                        low[v] = order[v] = now_ord
                        now_ord += 1
                        visited.append(v)
                        for i in range(g.start[v],g.start[v+1]):
                            to = g.elist[i]
                            if order[to] == -1:
                                stack.append(to)
                                stack.append(to)
                                parent[to] = v
                            else:
                                low[v] = min(low[v],order[to])
                    else:
                        if low[v] == order[v]:
                            while True:
                                u = visited.pop()
                                order[u] = N
                                ids[u] = group_num
                                if u == v:
                                    break
                            group_num += 1
                        if parent[v] != -1:
                            low[parent[v]] = min(low[parent[v]],low[v])
        for i,x in enumerate(ids):
            ids[i] = group_num-1-x

        return group_num,ids
    
    def scc(self):
        group_num,ids = self.scc_ids()
        groups = [[] for _ in range(group_num)]
        for i,x in enumerate(ids):
            groups[x].append(i)
        return groups
    
import sys
readline = sys.stdin.buffer.readline
read = sys.stdin.buffer.read
N,M = map(int,readline().split())
ab = list(map(int,read().split()))
sg = scc_graph(N)

it = iter(ab)
for a,b in zip(it,it):
    sg.add_edge(a,b)

scc = sg.scc()
print(len(scc))
for group in scc:
    print(str(len(group))+' '+' '.join(map(str,group)))


Measured memory_bytes: 212964
#include<bits/stdc++.h>
using namespace std;
#define p 48

int main(){
  char a,b,c,d;
  scanf("%c%c%c%c",&a,&b,&c,&d);
  a-=p;b-=p;c-=p;d-=p;
  if(a+b+c+d==7) printf("%c+%c+%c+%c=7\n",a+p,b+p,c+p,d+p);
  else if(a+b+c-d==7) printf("%c+%c+%c-%c=7\n",a+p,b+p,c+p,d+p);
  else if(a+b-c+d==7) printf("%c+%c-%c+%c=7\n",a+p,b+p,c+p,d+p);
  else if(a+b-c-d==7) printf("%c+%c-%c-%c=7\n",a+p,b+p,c+p,d+p);
  else if(a-b+c+d==7) printf("%c-%c+%c+%c=7\n",a+p,b+p,c+p,d+p);
  else if(a-b+c-d==7) printf("%c-%c+%c-%c=7\n",a+p,b+p,c+p,d+p);
  else if(a-b-c+d==7) printf("%c-%c-%c+%c=7\n",a+p,b+p,c+p,d+p);
  else if(a-b-c-d==7) printf("%c-%c-%c-%c=7\n",a+p,b+p,c+p,d+p);
  return 0;
}

Measured memory_bytes: 384
# AOJ 0060 Card Game

while line = gets
  cards = (1..10).to_a
  c1, c2, c3 = line.split.map {|v| v.to_i}
  cards -= [c1, c2, c3]
  my_sum = c1 + c2

  total = 0
  no_overflow = 0

  cards.each do |c4|
    rest = cards - [c4]

    total += rest.length
    other_sum = c3 + c4
    max = 20 - my_sum
    no_overflow += rest.select {|c| c <= max}.length
  end

  puts (no_overflow.to_f / total >= 0.5) ? "YES" : "NO"
end

Measured memory_bytes: 6128
//#include <bits/stdc++.h>
#include <iostream>
#include <fstream>
#include <vector>
#include <string>
#include <cmath>
#include <algorithm>
#include <map>
#include <iomanip>
#include <stdlib.h>
#include <stdio.h>
#include <queue>
#include <deque>
#include <set>
#include <stack>
#include <time.h>
 
using namespace std;
 
typedef long long ll;
typedef long double ld;
typedef pair<int, int> Pii;
typedef pair<int, ll> Pil;
typedef pair<ll, ll> Pll;
typedef pair<ll, int> Pli;

#define fi first
#define se second

const ll MOD = 1e9 + 7;
const ll MOD2 = 998244353;
const ll MOD3 = 1812447359;
const ll INF = 1ll << 62;
const double PI = 2 * asin(1);

void yes() {printf("yes\n");}
void no() {printf("no\n");}
void Yes() {printf("Yes\n");}
void No() {printf("No\n");}
void YES() {printf("YES\n");}
void NO() {printf("NO\n");}

int main(){
  int N, Y; cin >> N >> Y;
  Y /= 1000;

  for (int i = 0; i <= N; i++){
    for (int j = 0; i + j <= N; j++){
      int now = 10 * i + 5 * j + (N - i - j);
      if (now == Y){
        printf("%d %d %d\n", i, j, N - i - j);
        return 0;
      }
    }
  }
  printf("-1 -1 -1\n");

  return 0;
}


Measured memory_bytes: 3732
import sys
sys.setrecursionlimit(10**7)

n = int(input())
flag = [-1 for _ in range(n)]
la=[[] for _ in range(n)]
for _ in range(n-1):
    a,b = map(int,input().split())
    la[a-1].append(b-1)
    la[b-1].append(a-1)

def dfs(s,d):
    global flag
    global la
    flag[s] = d + 1
    for g in la[s]:
        if flag[g] == -1:
            dfs(g,flag[s])

def main():
    global n
    global flag
    dfs(0,-1)
    distf = flag[:]
    flag = [-1 for _ in range(n)]
    dfs(n-1,-1)
    dists = flag[:]
    res = 0
    for i in range(n):
        if distf[i] <= dists[i]:
            res += 1
        else:
            res -= 1
    if res > 0:
        return "Fennec"
    else:
        return "Snuke"



print(main())

Measured memory_bytes: 118128
#include<iostream>
#include<algorithm>
#include <string>
#include<cstdio>
#include<stack>
#include<cstring>
#include<vector>
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define EREP(i,n) for(int i=(n-1);i>=0;--i)
#define D(n,retu) REP(i,n){cin>>retu[i];}
#define mod 1000000007
using namespace std;
typedef long long ll;
template<typename T>
void fill_all(T& arr, const T& v) {
	arr = v;
}
template<typename T, typename ARR>
void fill_all(ARR& arr, const T& v) {
	for (auto& i : arr) { fill_all(i, v); }
}

//------------------変数-----------------------//
ll n, x,a[100000],cnt=0;
//-------------------関数----------------------//

int main() {
	cin >> n >> x;
	REP(i, n) {
		cin >> a[i];
	}
	REP(i, n - 1) {
		ll karix = a[i]+a[i+1];
		if (a[i] > x) {
			cnt += a[i] - x;
			karix -= a[i] - x;
		}
		if (karix - x > 0) {
			cnt += karix - x;
			a[i + 1] -= karix - x;
		}
	}
	cout << cnt << endl;
}

Measured memory_bytes: 1024
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.*;

import static java.util.Arrays.binarySearch;

public class Main {

    public static void main(String[] args) throws Exception {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;

        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);

        Task solver = new Task();
        solver.solve(1, in, out);
        out.close();
    }
}

class Task {

    private static int mod = 1000000007;

    public void solve(int testNumber, InputReader in, PrintWriter out) {
        int n = in.nextInt();
        int m = in.nextInt();
        int A = in.nextInt();
        int B = in.nextInt();
        int C = in.nextInt();
        Apple[] apples = new Apple[A + B + C];
        readArrays(in, A, 1, apples, 0);
        readArrays(in, B, 2, apples, A);
        readArrays(in, C, 0, apples, A + B);
        Arrays.sort(apples, new Comparator<Apple>() {
            @Override
            public int compare(Apple o1, Apple o2) {
                return o2.del - o1.del;
            }
        });
        int r = 0, g = 0, c = 0;
        long ans = 0;
        for (int i = 0; i < A + B + C; i++) {
            if (r + g + c >= n + m) {
                break;
            }
            int col = apples[i].col;
            int del = apples[i].del;
            if (col == 1 && r < n) {
                ans += del;
                r++;
            } else if(col == 2 && g < m) {
                ans += del;
                g++;
            } else if (col == 0){
                ans += del;
                c++;
            }
        }
        out.println(ans);
    }

    private void readArrays(InputReader in, int n, int col, Apple[] apples, int cur) {
        for (int i = 0; i < n; i++) {
            int x = in.nextInt();
            apples[cur++] = new Apple(x, col);
        }
    }

    class Apple {
        int del;
        int col;

        public Apple(int del, int col) {
            this.del = del;
            this.col = col;
        }
    }

}

class InputReader {

    private final BufferedReader reader;
    private StringTokenizer tokenizer;

    public InputReader(InputStream stream) {
        reader = new BufferedReader(new InputStreamReader(stream));
        tokenizer = null;
    }

    public String nextLine() {
        try {
            return reader.readLine();
        } catch (IOException e) {
            throw new RuntimeException(e);
        }
    }

    public String next() {
        while (tokenizer == null || !tokenizer.hasMoreTokens()) {
            tokenizer = new StringTokenizer(nextLine());
        }
        return tokenizer.nextToken();
    }

    public int nextInt() {
        return Integer.parseInt(next());
    }

    public long nextLong() {
        return Long.parseLong(next());
    }

    public double nextDouble() {
        return Double.parseDouble(next());
    }

}


Measured memory_bytes: 57112
let nil = -1

type tree = {
  mutable parent : int;
  mutable child : int;
  mutable bro : int;
  mutable depth : int;
}

let make () = { parent = nil; child = nil; bro = nil; depth = nil }

let set_depth t n =
  let rec root i =
    if i = n then nil
    else if t.(i).parent = nil then i
    else root (i + 1)
  in
  let rec doit i d =
    t.(i).depth <- d;
    if t.(i).bro <> nil then doit t.(i).bro d;
    if t.(i).child <> nil then doit t.(i).child (d + 1);
  in
  doit (root 0) 0

let print_tree t =
  let print i =
    print_string "node "; print_int i;
    print_string ": parent = "; print_int t.(i).parent;
    print_string ", depth = "; print_int t.(i).depth;
    print_string (if t.(i).parent = nil then ", root, " else if t.(i).child = nil then ", leaf, " else ", internal node, ");
    print_string "[";
    let rec print_children c =
      if c <> nil then begin
        if c <> t.(i).child then print_string ", ";
        print_int c;
        print_children t.(c).bro
      end
    in
    print_children t.(i).child;
    Printf.printf "]\n";
  in
  Array.iteri (fun i _ -> print i) t

let () =
  let n = Scanf.scanf "%d " (fun i -> i) in
  let t = Array.init n (fun _ -> make ()) in
  let rec read i =
    if i < n then begin
      let id, k = Scanf.scanf "%d %d " (fun id k -> id, k) in
      let rec read_node j left_child =
        if j < k then begin
          let c = Scanf.scanf "%d " (fun i -> i) in
          t.(c).parent <- id;
          if j = 0 then t.(id).child <- c else t.(left_child).bro <- c;
          read_node (j + 1) c
        end
      in
      read_node 0 0;
      read (i + 1)
    end
  in
  read 0;
  set_depth t n;
  print_tree t

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

int main(){
    string s;
    cin>>s;
    vector<int>a(26);
    bool flag=true;
    for(int i=0;i<s.size();i++){
        a[s[i]-'a']++;
        if(a[s[i]-'a']>1)flag=false;
    }
    if(flag)cout<<"yes"<<endl;
    else cout<<"no"<<endl;
    return 0;
}

Measured memory_bytes: 3576
import java.util.*;
 
public class Main {
 
    public static void main(String[] args) {
        Scanner st = new Scanner(System.in);
        int A = st.nextInt();
        int B = st.nextInt();
        int C = st.nextInt();
        st.close();
 
        if (A == B && B != C) {
            System.out.println("Yes");
        } else if(A == C && B != C) {
            System.out.println("Yes");
        } else if(B == C && A != C) {
            System.out.println("Yes");
        } else {
            System.out.println("No");
        }
    }
}

Measured memory_bytes: 21844
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define inf 1001001001
#define mod 1000000007
#define pi 3.141592653589793

ll gcd(ll a,ll b){
    if(b>a) swap(a,b);
    if(b==0) return a;
    return gcd(b,a%b);
}
ll lcm(ll a,ll b){
    ll g=gcd(a,b);
    return a/g*b;
}

int main (){
    int n;
    cin >> n;
    ll ans;
    rep(i,n){
        ll t;
        cin >> t;
        if(i==0) ans=t;
        else ans=lcm(ans,t);
    }
    cout << ans << endl;
    return 0;
}



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

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

#define pb push_back
#define eb emplace_back
#define mp make_pair
#define fi first
#define se second
#define rep(i,n) rep2(i,0,n)
#define rep2(i,m,n) for(int i=m;i<(n);i++)
#define ALL(c) (c).begin(),(c).end()

const int MX = 200010;

vi vec[MX];

int main() {
	int H, W, N; cin >> H >> W >> N;
	rep(i, N) {
		int x, y;
		cin >> x >> y; --x; --y;
		vec[x].pb(y);
	}

	rep(i, H) sort(ALL(vec[i]));

	int r = 0;

	rep(i, H-1) {
		if (i > 0 && !binary_search(ALL(vec[i]), r + 1)) {
			r++;
		}
		if (vec[i+1].size() && vec[i+1][0] <= r) {
			cout << i + 1 << endl;
			return 0;
		}		
	}

	cout << H << endl;

	return 0;
}

Measured memory_bytes: 11136
def main2(n,k,p):
    maxVal = 0
    #期待値リスト
    kitai = [0] * n
    for i in range(n):
        kitai[i] = (p[i] + 1) / 2
    #先頭からK個の合計
    val = sum(kitai[:k])
    #kとnが同じ場合return
    if k == n:
        return val
    for i in range(k,n):
        #次の値は現在のvalにkitai[i]を足して、kitai[i-k]を引いた値
        val = val + kitai[i] - kitai[i-k]
        maxVal = max(maxVal, val)
    return maxVal

n,k = map(int, input().split())
p = list(map(int,input().split()))
print(main2(n,k,p))

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

using namespace std;

int main() {
    int n, x;
    cin >> n >> x;
    vector<int> l(n);
    for (int i = 0; i < n; ++i) {
        cin >> l.at(i);
    }
    int position = 0;
    int ans = 1;
    for (int j = 0; j < n; ++j){
        position += l.at(j);
        if (position <= x) ans++;
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
n = int(input())
a = input().split()
alist = set()
adic = {}
su = 0

for i in a:
    su += int(i)
    if int(i) in alist:
        adic[int(i)] = adic[int(i)] + 1
    else:
        alist.add(int(i))
        adic[int(i)] = 1

q = int(input())
ans = []

for i in range(q):
    s = input().split()
    b = int(s[0])
    c = int(s[1])
    if b in alist:
        if not(c in alist):
            adic[c] = 0
            alist.add(c)
        adic[c] = adic[c] + adic[b]
        su = su + (c * adic[b]) - (b * adic[b])
        adic[b] = 0

    ans.append(su)
for i in range(len(ans)):
    print(ans[i])

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

using namespace std;

typedef pair<double, string> P;

int main()
{
  int n;
  while(cin >> n, n){
    vector<P> vec(n);
    for(int i = 0; i < n; i++){
      string l;
      int p, a, b, c, d, e, f, s, m;
      cin >> l >> p >> a >> b >> c >> d >> e >> f >> s >> m;
      double sumTime = a + b + c + (d + e) * m;
      double sumIncom = f * m * s - p;
      double efficiency = sumIncom / sumTime;
      vec[i] = make_pair(-efficiency, l);
    }
    sort(vec.begin(), vec.end());
    for(int i = 0; i < n; i++) cout << vec[i].second << endl;
    cout << "#" << endl;
  }
  return 0;
}

Measured memory_bytes: 1224
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<math.h>
#include<time.h>
#define FOR(i,n) for(int i=0;i<n;i++)
#define PRN(n) printf("%d\n",n)
#define PRF(n) printf("%lf\n",n)
#define PRL(n) printf("%lld\n",n)
#define PRS(s) printf("%s\n",s)
#define PRC(c) printf("%c",c)
#define INI(n) scanf("%d",&n)
#define INL(n) scanf("%lld",&n)
#define INF 10000000000
#define mod 1000000007
#define X 100000
#define N 20
#define M 46
typedef long long int ll;
ll finv[X];
ll fac[X];
ll inv[X];
ll usort(const void *a, const void *b){return *(ll*)a-*(ll*)b;}
ll dsort(const void *a, const void *b){return *(ll*)b-*(ll*)a;}
ll ssort(const void *a, const void *b){return strcmp((char*)a,(char*)b);}
void Iswap(int *a,int *b){
  int t=*a;
  *a=*b;
  *b=t;
}
void Fswap(double *a,double *b){
  double t=*a;
  *a=*b;
  *b=t;
}
void Lswap(ll *a,ll *b){
  ll t=*a;
  *a=*b;
  *b=t;
}
ll min(ll a,ll b){
  if(a>b)return b;
  return a;
}
ll max(ll a,ll b){
  if(a>b)return a;
  return b;
}
ll z(ll a){return max(a,-a);}
ll gcd(ll a,ll b){if(!b){return a;}else{return gcd(b,a%b);}}
ll lcm(ll a,ll b){return a*b/gcd(a,b);}
ll kt(ll a){
  ll sum=0;
  while(a){
    a/=10;
    sum++;
  }
  return sum;
}
ll ks(ll a){
  ll sum=0;
  while(a){
    sum+=a%10;
    a/=10;
  }
  return sum;
}
void nCrReady(){
  fac[0]=fac[1]=1;
  finv[0]=finv[1]=1;
  inv[1]=1;
  for (ll i=2;i<X;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;
  }
}
ll nCr(ll n,ll k){return fac[n]*(finv[k]*finv[n-k]%mod)%mod;}
ll modpow(ll a,ll n){
  ll res=1;
  while(n>0){
    if(n&1)res=res*a%mod;
    a=a*a%mod;
    n>>=1;
  }
  return res;
}
int main(void){
  ll a;
  INL(a);
  int ans=0;
  ll i=100;
  while(1){
    ans++;
    i+=i/100;
    if(i>=a)break;
  }
  PRN(ans);
  return 0;
}

Measured memory_bytes: 1720