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

using namespace std;

int main()
{
	int a, b, c;
	cin >> a >> b >> c;

	int x;
	cin >> x;

	int result = 0;

	for (int i = 0; i <= a; i++) {
		for (int j = 0; j <= b; j++) {
			for (int k = 0; k <= c; k++) {
				int sum = 500 * i + 100 * j + 50 * k;
				if (sum == x) {
					result++;
				}
			}
		}
	}

	cout << result << endl;
	return 0;
}


Measured memory_bytes: 256
N = int(input())
a = [0]
a.extend(list(map(int, input().split())))
b = [0 for _ in range(N+1)]

for i in reversed(range(1, N+1)):
    total = 0
    for j in range(i+i, N+1, i):
        total ^= b[j]
    b[i] = total ^ a[i]

ans_n = 0
ans_l = []
for i in range(N+1):
    if b[i]:
        ans_n += 1
        ans_l.append(str(i))

print(ans_n)
print(' '.join(ans_l))


Measured memory_bytes: 72924
#include <cstdio>
#include <algorithm>
#include <iostream>
#include <string>
#include <cstring>
#include <vector>
#include <set>
#include <map>
using namespace std;

int len, root, n, k, m;
int sum[1100000], dd[1100000], son[1100000][26], to[1100000], fa[1100000];
char S[410000];

void ins(char *S, int id) {
	int l = strlen(S);
	int now = root;
	for (int i = 0; i < l; i++) {
		sum[now] += 1;
		if (!son[now][S[i] - 'a'])
			son[now][S[i] - 'a'] = ++len;
		now = son[now][S[i] - 'a'];
	}
	sum[now] += 1;
	dd[now] += 1;
	to[id] = now;
}

void dfs(int k, int &ss) {
	for (int i = 0; i < 26; i++)
		if (son[k][i]) {
			dfs(son[k][i], son[k][i]);
			if (sum[son[k][i]] == sum[k])
				ss = son[k][i];
		}
}

int query(int k) {
	int ans = 0;
	while (k != root) {
		int kk = fa[k];
		for (int i = 0; i < 26; i++)
			if (son[kk][S[i] - 'a'] == k)
				break;
			else
				ans += sum[son[kk][S[i] - 'a']];
		ans += dd[kk];
		k = kk;
	}
	return ans + 1;
}

void ddd(int xx) {
	// printf("%d\n", xx);
	for (int i = 0; i < 26; i++)
		if (son[xx][i])
			fa[son[xx][i]] = xx, 
			ddd(son[xx][i]);
}

int main() {
	root = len = 1;
	scanf("%d", &n);
	for (int i = 1; i <= n; i++)
		scanf("%s", S), ins(S, i);
	dfs(root, root);
	ddd(root);
	// for (int i = 1; i <= len; i++)
	// 	for (int j = 0; j < 26; j++)
	// 		if (son[i][j])
	// 			fa[son[i][j]] = i;
	scanf("%d", &m);
	for (int i = 0; i < m; i++) {
		scanf("%d%s", &k, S);
		printf("%d\n", query(to[k]));
	}
}


Measured memory_bytes: 68736
#include <iostream>
#include <set>
#include <map>
#include <vector>
#include <algorithm>
#include <iomanip>
#include <climits>
#include <numeric>
#include <cmath>
#include <queue>
#include <sstream>
#include <string.h>
#include <bitset>

using namespace std;
typedef long long ll;

int main() {
  int N;
  cin >> N;
  
  vector<vector<int>> list(N, vector<int>(3));
  for (int i = 0; i < N; i++) {
    for (int j = 0; j < 3; j++) {
      cin >> list[i][j];
    }
  }
  
  ll dp[N + 1][3];
  for (int i = 0; i <= N; i++) {
    for (int j = 0; j < 3; j++) {
      dp[i][j] = 0;
    }
  }
  
  for (int i = 0; i < N; i++) {
    for (int j = 0; j < 3; j++) {
      for (int k = 0; k < 3; k++) {
        if (j == k) {
          continue;
        }
        dp[i + 1][k] = max(dp[i + 1][k], dp[i][j] + list[i][k]);
      }
    }
  }
  cout << max(dp[N][0], max(dp[N][1],dp[N][2])) << endl;
  return 0;
}


Measured memory_bytes: 8064
#include<stdio.h>

int main(void){
  double a,b,c,d,e,f;
  double x,y;

  while(scanf("%lf%lf%lf%lf%lf%lf",&a,&b,&c,&d,&e,&f)!=EOF){
    y=(c*d-a*f)/(b*d-a*e);
    if(d==0)
      x=(c-(b*y))/a;
    else
      x=(f-(e*y))/d;
    if(x==-0)
      x=0;
    printf("%.3f %.3f\n",x,y);
  }
  return(0);
}

Measured memory_bytes: 0
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<climits>
#include<iostream>
#include<sstream>
#include<utility>
#include<map>
#include<vector>
#include<queue>
#include<algorithm>
#include<set>
#include<stack>
using namespace std;

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<double,double> pdd;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vi> vvi;
typedef set<int> si;
typedef map<int, int> mii;
#define INF (1<<29)


int main(){
    int n,tmp;
    vi num(4);
    cin>>n;
    for(int i=0; i<4; i++){
        num[i]=n%10;
        n /= 10;
    }
    if(num[0]==num[1]&&num[0]==num[2]){
        cout<<"Yes"<<endl;
    }else if(num[1]==num[2]&&num[2]==num[3]) {
        cout<<"Yes"<<endl;
    }else{
        cout<<"No"<<endl;
    }
    return 0;
}


Measured memory_bytes: 256
import java.util.*;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        long X = sc.nextLong();
        sc.close();

        int A = -118;
        int B = -119;
        boolean isOK = false;
        for (; A <= 119; A++) {
            if (A == 0) {
                System.out.println("");
            }
            B = -119;
            for (; B <= 119; B++) {
                if (B == 0) {
                    System.out.println("");
                }
                long result = (long) (Math.pow((double) A, 5) - Math.pow((double) B, 5));
                if (result == X) {
                    isOK = true;
                    break;
                }
            }
            if (isOK) {
                break;
            }
        }

        System.out.println(String.valueOf(A) + " " + String.valueOf(B));
    }

}


Measured memory_bytes: 39084
#import sys
#import math
#import numpy as np
'''a,b= map(int,input().split())'''
#a, b, c = [list(map(int, input().split())) for _ in range(3)]
#li0= [int(x) for x in input().split()]
#n,l= map(int, input().split())
#x = [list(map(int, input().split())) for _ in range(n)] 
a=int(input())
li=[int(x) for x in input().split()]
count=10**9

for i in range(len(li)):
  count=min(count,abs(sum(li[:i])-sum(li[i:])))
print(count)

Measured memory_bytes: 3060
#include<stdio.h>
#include<stdlib.h>
#include<math.h>
#define MOD 998244353
void merge_sort (int *array, int *array2,int *work,int *work2,int left, int right) {
  int i, j, k, mid;
  if (left < right) {
    mid = (left + right)/2;
    merge_sort(array, array2,work,work2,left, mid);
    merge_sort(array, array2,work,work2,mid+1, right);
    for (i = mid; i >= left; i--) {
        work[i] = array[i]; 
        work2[i]=array2[i];
        } 
    for (j = mid+1; j <= right; j++) {
        work[right-(j-(mid+1))] = array[j];
        work2[right-(j-(mid+1))] = array2[j];
    }
    i = left; j = right;
    for (k = left; k <= right; k++) {
      if (work[i] < work[j]) { array[k] = work[i]; array2[k]=work2[i];i++;}
      else                   { array[k] = work[j]; array2[k]=work2[j];j--;}
    }
  }
}
int search(int *array, int n, int left ,int right){
    int mid=(left+right)/2;
    if(left < right){
        if(n <= array[mid])search(array, n, left, mid);
        else search(array, n, mid+1, right);
    }else{
        if(n<=array[right]) return right-1;
        else return right;
    }
}
void init(int *tree,int size){
    for (int i = 0; i < 2*size-1; i++)tree[i]=0;    
}
int max(int a,int b){
    if(a<b)return b;
    else return a;
}
void update(int *tree,int size,int a,int x){
    a+=size-1;
    tree[a]=x;
    while(a>0){
        a=(a-1)/2;
        tree[a]=max(tree[2*a+1],tree[2*a+2]);
    }
}
int query(int *tree,int a,int b,int k,int l,int r){
    if(a==b)return a;
    if(b<=l||r<=a)return 0;
    if(a<=l&&r<=b)return tree[k];
    int vl=query(tree,a,b,2*k+1,l,(l+r)/2);
    int vr=query(tree,a,b,2*k+2,(l+r)/2,r);
    return max(vl,vr);
}
int main(){
    int n;
    scanf("%d",&n);
    int *x,*d,*work,*work2;
    x=(int*)malloc(sizeof(int)*n);
    d=(int*)malloc(sizeof(int)*n);
    work=(int*)malloc(sizeof(int)*n);
    work2=(int*)malloc(sizeof(int)*(n+1));
    for (int i = 0; i < n; i++)scanf("%d %d",&x[i],&d[i]);
    merge_sort(x,d,work,work2,0,n-1);

    int size=pow(2,(int)ceil(log2(n)));
    int *tree;
    tree=(int*)malloc(sizeof(int)*(2*size-1));
    init(tree,size);
    for (int i = n-1; i >= 0; i--)
    {
        update(tree,size,i,i);
        update(tree, size, i ,query(tree,i,search(x,x[i]+d[i],i,n-1),0,0,size-1));
    }
    work2[n]=1;
    for (int i = n-1; i >= 0; i--)
    {
        work2[i]=(work2[i+1]+work2[tree[i+size-1]+1])%MOD;
    }
    
    printf("%d\n",work2[0]);
    
    return 0;
 }


Measured memory_bytes: 5376
#define _GLIBCXX_DEBUG
#define SIZE_OF_ARRAY(array) (sizeof(array)/sizeof(array[0]))
#include <bits/stdc++.h>
using namespace std;

int main() {
  int N, K, Q;
  cin >> N >> K >> Q;
  int A[Q], B[N], C[N];
  
  for(int i=0; i<Q; i++) cin >> A[i];
  for(int i=0; i<N; i++){
    B[i]=K;
    C[i]=0;
  }
  
  for(int i=0; i<Q; i++){
    C[A[i]-1]++;
  }
  
  for(int i=0; i<N; i++){
    if(B[i]-Q+C[i] > 0) cout << "Yes" << endl;
    else cout << "No" << endl;
  }
  
  
  return 0;
}

Measured memory_bytes: 4744
#include<cstdio>
#include<cmath>
#include<vector>
#include<algorithm>

using namespace std;

bool func(pair<pair<int, int>, int> &a, pair<pair<int, int>, int> &b)
{
	return a.first.first < b.first.first || a.first.first == b.first.first&&a.first.second < b.first.second;
}

bool func2(pair<pair<int, int>, int> &a, pair<pair<int, int>, int> &b)
{
	return a.second < b.second;
}

int main()
{
	int n, m;
	vector<pair<pair<int, int>, int>> city;
	vector<pair<pair<int, int>, int>> id;
	int i;
	int input1, input2;
	int cnt = 1;


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

	for(i=0;i<m;i++)
	{
		scanf("%d %d", &input1, &input2);

		city.push_back(pair<pair<int, int>, int>(pair<int, int>(input1, input2), i + 1));
	}

	sort(city.begin(), city.end(), func);

	id.push_back(pair<pair<int, int>, int>(pair<int, int>(city[0].first.first, 1), city[0].second));

	for (i = 1; i < m; i++)
	{
		if (city[i].first.first != city[i - 1].first.first)
		{
			cnt = 1;
		}

		else
		{
			cnt++;
		}

		id.push_back(pair<pair<int, int>, int>(pair<int, int>(city[i].first.first, cnt), city[i].second));
	}

	sort(id.begin(), id.end(), func2);

	for (i = 0; i < m; i++)
	{
		printf("%06d%06d\n", id[i].first.first, id[i].first.second);
	}

	return 0;
}

Measured memory_bytes: 3956
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef vector<ll> vl;
typedef vector<pair<ll,ll>> vp;
typedef pair<ll,ll> Pair;
#define rep(i,n) for(ll i = 0; i < ll(n); i++)
#define ALL(x) (x).begin(), (x).end()
#define inputv(v,n) rep(i,n){\
    ll x;\
    cin>>x;\
    v.push_back(x);\
    }

const ll INF=99999999999999;
const ll MOD=1000000007;

using Edge = pair<ll,ll>;  //　1つ目は結んでいるノード、2つ目はその辺の重みを指す
using Graph = vector<vector<Edge> >;  //隣接リスト

void dijkstra(const Graph &G, vl &dist, ll s){  // sを始点とする最短経路
  priority_queue<Pair, vector<Pair>, greater<Pair> > que; //secondが頂点、firstがその頂点への暫定最小コストを表す
  dist[s] = 0;  //sへの距離は0
  
  que.emplace(0, s);
  
  while(!que.empty()){
    Pair p = que.top(); //キューから辺を取り出す
    que.pop(); //取り出した辺は破棄
    ll v = p.second;  
    if(dist[v] < p.first) continue; //辺の行き先の距離が辺のコスト未満なら、そのまま
    for(auto e : G[v]){  //頂点vから出る各辺について
      if(dist[e.first] > dist[v] + e.second){  //辺Eを通るとコストが改善される場合
        dist[e.first] = dist[v] + e.second;  //更新
        que.emplace(Pair(dist[e.first], e.first));  //キューにその頂点を格納
      }
    }
  }
}
 
int main() {
  ll n;
  cin >> n;
  Graph g(n);
  vl dist(n,INF);
  rep(i,n-1){
    ll a,b,c;
    cin >> a >> b >> c;
    g[a-1].push_back(Edge(b-1,c));
    g[b-1].push_back(Edge(a-1,c));
  }
  ll q,k;
  cin >> q >> k;
  vl x(q),y(q);
  rep(i,q) cin >> x[i] >> y[i];
  dijkstra(g,dist,k-1);
  rep(i,q){
    cout << dist[x[i]-1] + dist[y[i]-1] << endl;
  }
 return 0;
}


Measured memory_bytes: 12656
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include<bits/stdc++.h>
using namespace __gnu_pbds;
using namespace std;
#define int long long
#define ll  long long
#define ull unsigned long long 
#define ff first 
#define ss second
#define eb(x) emplace_back(x)
#define pb(x) push_back(x)
#define pf(x) push_front(x)
#define start_routine() int begtime = clock();
#define end_routine() int endtime = clock(); \
                      cerr << "" << "Time elapsed: " << \
                      (endtime - begtime)*1000/CLOCKS_PER_SEC << " ms\n\n"; \
                      return 0
#define testcase(t) int t;cin>>t;while(t--)
#define mp(x,y) make_pair(x,y)
#define in(x) insert(x)
#define rep(i,a,b)  for (__typeof((b)) i=(a);i<=(b);i++)
#define nrep(i,a,b)  for (__typeof((b)) i=(b);i>=(a);i--)
#define PI 1.0*acos(-1.0)
#define SP(x) setprecision(x)
#define reflex ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define M  1000000007
#define sz(a) (int)a.size()
#define endl "\n"
#define all(v) v.begin(), v.end()
#define UNIQUE(x) x.resize(distance(x.begin(), unique(all(x))))
#define mem(arr,val) memset(arr,val,sizeof(arr)) //For "0" and "-1"                  
#define inp0(a,n) rep(i,0,n-1) cin>>a[i];
#define inp1(a,n) rep(i,1,n) cin>>a[i]; 
#define prll(x) printf("%lld",x)
#define nth_ele(v,n) nth_element(v.begin(), v.begin()+n ,v.end())//O(N)
#define DEBUG(x) cerr << (#x) << ": " << (x) << endl
#define DEBUGV(x) for(auto IT:x) cerr<<IT<<" "<<endl; cerr<<endl;
#define DEBUGMP(x) for(auto IT:x) cerr<<IT.ff<<" "<<IT.ss<<endl; cerr<<endl;
#define minheap priority_queue <int, vector<int>, greater<int>>

typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef tree< int, null_type, less_equal<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
//member functions :1. order_of_key(k) : number of elements strictly lesser than k. find_by_order(k) : k-th element in the set
int gcd(int a, int b, int& x, int& y){if(b == 0){x = 1;y = 0;return a;}int x1, y1;int d = gcd(b, a % b, x1, y1);x = y1;y = x1 - y1 * (a / b);return d;}

ll powerM(ll a,ll b){if(b==0) return 1LL;  if(b==1) return a%M; ll x=powerM(a,b/2)%M; if(b&1){return ((((a%M)*(x%M))%M)*(x%M))%M;}return ((x%M)*(x%M))%M;}
ll power(ll a,ll b){if(b==0) return 1;  if(b==1) return a; ll x=power(a,b/2); if(b&1){return ((((a)*(x)))*(x));}return ((x)*(x));}
 
const ll INF = (ll)2e18+77; 
const int SIZE = 200005;

int ans[SIZE];
int n;
int a[SIZE];
        
int func(int k){
    if(ans[k]!=-1)
        return ans[k];

    rep(i,0,n-1){
        if(a[i]<=k){
            if(func(k-a[i])==2)
                return ans[k] = 1;
        }
    }

    ans[k]=2;
    return ans[k];
}

void sam_mit(){ 
    int k;
    cin>>n>>k;
    inp0(a,n)
    mem(ans, -1);
    ans[0] = 2;
    if(func(k) == 1)
        cout<<"First\n";
    else
        cout<<"Second\n";

}

signed main()
{
    reflex;
    // testcase(T){   
        sam_mit();
    // }
}



Measured memory_bytes: 8284
#include <iostream>

using namespace std;

int main() {
  int n;
  long a[200020];
  long mod = 1000000007;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  int ans = 0;
  long long x = 0;
  for (int i = 0; i < n; i++) {
    ans = (ans + a[i] * x) % mod;
    x = (x + a[i]) % mod;
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 4720
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {

		try {
			BufferedReader bf = new BufferedReader(new InputStreamReader(System.in));
			String[] input = bf.readLine().split(" ");
			
			int n = Integer.parseInt(input[0]);
			int m = Integer.parseInt(input[1]);
			
			int l0=0;
			int r0=100000;
			String in;
			
			while( (in = bf.readLine()) != null ){
				if ( in.trim().length() ==  0 ) break;
				input = in.split(" ");
				int l = Integer.parseInt(input[0]);
				if (l>l0) l0=l;
				int r = Integer.parseInt(input[1]);
				if (r<r0) r0=r;
			}
			if(r0-l0+1<0){
				System.out.println(0);
			}else{
				System.out.println(r0-l0+1);
			}
		}
		catch(Exception e){
			e.printStackTrace();
		}
	}
}

Measured memory_bytes: 46340
from heapq import heappop, heappush
import sys
input = sys.stdin.readline
H, W, K = map(int, input().split())
x1, y1, x2, y2 = map(lambda x: int(x)-1, input().split())
S = [input()[:-1] for _ in [0]*H]

def geth(x, y, z):
    return (x*W+y)*4+z

def push(x, y, z, d):
    h = geth(x, y, z)
    if D[h] <= d:
        return
    D[h] = d
    heappush(q, (d, h))

INF = 10**10
MAX = H*W*4
D = [INF]*MAX
dirs = [(-1, 0), (0, -1), (1, 0), (0, 1)]

q = []
for z in range(4):
    heappush(q, (0, geth(x1, y1, z)))

while q:
    d, h = heappop(q)
    z = h % 4
    x, y = divmod((h//4), W)

    if d > D[h]:
        continue
    D[h] = d

    for _z, (dx, dy) in enumerate(dirs):
        if _z == z:
            _x, _y = x+dx, y+dy
            if 0 <= _x < H and 0 <= _y < W and S[_x][_y] == '.':
                push(_x, _y, z, d+1)
        else:
            _h = geth(x, y, _z)
            _d = (d+K-1)//K*K
            push(x, y, _z, _d)

g = geth(x2, y2, 0)
ans = min(D[g:g+4])
if ans == INF:
    print(-1)
else:
    ans = (ans-1+K)//K
    print(ans)

Measured memory_bytes: 222740
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)*}
    };
}

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

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")
    };
}
fn main() {
    input! {
    s: chars,
    }
    let mut y = "2018".chars().collect::<Vec<char>>();
    y.extend_from_slice(&s[4..]);
    for i in y {
        print!("{}", i);
    }
}


Measured memory_bytes: 4352
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> P;
typedef pair<ll, ll> Pll;
using Graph = vector<vector<int>>;
using Graphl = vector<vector<ll>>;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define Rep(i, k, n) for (int i = k; i < (int)(n); i++)
#define RRep(i, k, n) for (int i = k; i > (int)(n); i--)
#define FOR(itr, v) for (auto itr = (v).begin(); itr != (v).end(); ++itr)
#define COUT(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl
#define ALL(a)  (a).begin(),(a).end()
#define rALL(a)  (a).rbegin(),(a).rend()
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
template<class T> void PrintVector(const vector<T> &vec) {for (auto val : vec) cout << val << " "; cout << endl;}
const long long INF = 1LL << 60;
const long long minusINF = -(1LL << 40);
const int MOD = 1000000007;
const double PI = acos(-1); //3.14~
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

int main()
{
    int n; cin >> n;
    string ans;
    if (n <= 999) ans = "ABC";
    else ans = "ABD";
    cout << ans << endl;
}

Measured memory_bytes: 3628
#include <iostream>
#include <string>
#include <algorithm>
#include <cstdlib>
#include <cmath>
#include <vector>
using namespace std;
int main(){
	int n;
	cin>>n;
	int c=0;
	for(int i=n;i>0;i/=10){
		c+=i%10;
	}
	if(n%c==0)cout<<"Yes"<<endl;
	else cout<<"No"<<endl;
	return 0;
}

Measured memory_bytes: 256
//http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0515
#include <iostream>
#include <vector>
#define ll long long
using namespace std;
int main() {
	cin.tie(0); ios::sync_with_stdio(false);
	while (true) {
		int a, b; cin >> a >> b;
		if (a == 0 && b == 0)break;
		int n; cin >> n;
		vector<vector<ll>> f(a + 1, vector<ll>(b + 1, false));
		vector<vector<ll>> dp(a + 1, vector<ll>(b + 1, 0));
		for (int i = 0; i < n;i++) {
			int A, B; cin >> A >> B;
			f[A][B] = true;
		}
		dp[1][1] = 1;
		for (int i = 1; i <= a;i++) {
			for (int j = 1; j <= b;j++) {
				if (i == 1 && j == 1)continue;
				if (!f[i][j]) dp[i][j] = dp[i - 1][j] + dp[i][j - 1];
			}
		}
		cout << dp[a][b] << endl;
	}
}

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

long long burger(int n, long long x) {
  if (n == 0) return 1;
  long long len = (1LL << (n + 1)) - 3;
  long long p = (1LL << n) - 1;
  if (x == 1)
    return 0;
  else if (x <= len + 1)
    return burger(n - 1, x - 1);
  else if (x == len + 2)
    return p + 1;
  else if (x <= 2 * len + 2)
    return p + 1 + burger(n - 1, x - 2 - len);
  else
    return 2 * p + 1;
}

int main() {
  int n;
  long long x;
  cin >> n >> x;

  long long ans;

  ans = burger(n, x);

  cout << ans;
}

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

int main() {
    int N; cin >> N;
    map<int, int> MAP;
    for (int i = 0; i < N; i++) {
        int a; cin >> a;
        MAP[a] ++;
    }
    ll ans = 0;
    for (auto t : MAP) {
        if (t.second < t.first) ans += t.second;
        else ans += t.second-t.first;
    }
    cout << ans << endl;
}

Measured memory_bytes: 4736
#include <iostream>
#include <algorithm>
#include <cmath>
#include <climits>
#include <vector>

typedef long long ll;

using namespace std;

int main(void) {
    ll N, M;
    cin >> N >> M;

    ll count = 0;

    // cout << N << " " << M << endl;
    count += min(N, M / 2);
    M -= 2 * count;
    count += M / 4;
    cout << count << endl;
}


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

int main()
{
	int N, K;
	cin >> N >> K;
	vector<int> A( N );
	for( int i = 0; i < N; i++ ) {
		cin >> A[i];
	}

	int aSum = 0;
	for( int i = 0; i < N; i++ ) {
		aSum += A[i];
	}
	vector<int> D;
	for( int i = 1; i * i <= aSum; i++ ) {
		if( aSum % i == 0 ) {
			D.push_back( i );
			if( aSum / i != i ) D.push_back( aSum / i );
		}
	}
	sort( D.begin(), D.end(), greater<int>() );
	int ans = 1;
	for( int d : D ) {
		vector<int> R( N );
		for( int i = 0; i < N; i++ ) {
			R[i] = A[i] % d;
		}
		sort( R.begin(), R.end(), greater<int>() );
		int rSum = 0;
		for( int i = 0; i < N; i++ ) {
			rSum += R[i];
		}
		int rn = rSum / d;
		int kSum = 0;
		for( int i = 0; i < rn; i++ ) {
			kSum += d - R[i];
		}
		if( kSum <= K ) {
			ans = d;
			break;
		}
	}

	cout << ans << endl;
}


Measured memory_bytes: 256
package main

import (
	"fmt"
)

func dama(n, y int) (int, int, int) {
	d := make([]int, n+1)
	a, b, c := -1, -1, -1
	for i := range d {
		for j := range d {
			k := n - i - j
			if k < 0 {
				continue
			}
			if y == 10000*i+5000*j+1000*k {
				a = i
				b = j
				c = k
				return a, b, c
			}
		}
	}
	return a, b, c
}

func main() {
	var n, y int
	fmt.Scan(&n, &y)
	fmt.Println(dama(n, y))
}


Measured memory_bytes: 512
#include<iostream>
#include<algorithm>
#include<cstring>

int main(){

	int d, n;
	std::cin >> d >> n;

	int data[201][2];
	int dp[201][2];
	int t[201];

	for (int i = 0; i < 201; i++){
		data[i][0] = -1;
		data[i][1] = 10000000;

		dp[i][0] = 0;
		dp[i][1] = 0;
	}

	for (int i = 0; i < d; i++){
		std::cin >> t[i];
	}

	for (int i = 0; i < n; i++){
		int a, b, c;
		std::cin >> a >> b >> c;

		for (int j = 0; j < d; j++){
			if (a <= t[j] && t[j] <= b){
				data[j][0] = std::max(data[j][0], c);
				data[j][1] = std::min(data[j][1], c);
			}
		}
	}

	for (int i = 1; i < d; i++){
		for (int j = 0; j < 2; j++){
			dp[i][j] = std::max(std::abs(data[i - 1][0] - data[i][j]) + dp[i - 1][0], std::abs(data[i - 1][1] - data[i][j]) + dp[i - 1][1]);
		}
	}

	std::cout << std::max(dp[d - 1][0], dp[d - 1][1]) << std::endl;
	return 0;
}

Measured memory_bytes: 1164
#include<cstdio>
#include<iostream>
using namespace std;
int main()
{
	int i,j;
	for(i=1;i<=9;i++)
	{
		for(j=1;j<=9;j++)
		{
			cout<<i<<"x"<<j<<"="<<(i*j)<<endl;
		}
	}
	return 0;
}

Measured memory_bytes: 3040
#include<stdio.h>

int main(void){
  int n;
  int i,j;
  int id[4000];
  long long int value[4000],num[4000],sale[4000];
  int c;

  while(1){
    scanf("%d",&n);
    if(!n)break;

    for(i=0;i<n;i++){
      scanf("%d %lld %lld",&id[i],&value[i],&num[i]);
      sale[i] = value[i] * num[i];
      for(j=0;j<i;j++)if(id[j] == id[i])break;
      if(j!=i){
	sale[j] += sale[i];
	i--;
	n--;
      }
    }

    c = 0;
    for(i=0;i<n;i++){
      if(1000000.0 - sale[i] < 1e-10){
	printf("%d\n",id[i]);
	c++;
      }
    }	 
    if(!c)printf("NA\n");

  }
 return 0;
}

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

int main() {
  int a,b,x;
  cin >> a >> b >> x;
  if(x<a){
    cout << "NO" << endl;
  }else if((x-a)>b){
    cout << "NO" << endl;
  }else{
    cout << "YES" << endl;
  }
}


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

using ll=long long;

using vi=vector<int>;
using vll=vector<ll>;
using vvi=vector<vi>;

int main() {
  string S; cin >>S;
  string ans=S.substr(0,(S.size()-8));
  cout <<ans <<endl;
  return 0;
}


Measured memory_bytes: 3544
#include <stdio.h>

int main(void)
{
  int i, j, k, n, x, count;
  while (1)
    {
      scanf(" %d %d", &n, &x);
      if (n == 0 && x == 0)
	return 0;
      count = 0;
      for (i = 1; i <= n - 2; i++)
	for (j = i + 1; j <= n - 1; j++)
	  for (k = j + 1; k <= n; k++)
	    if (i + j + k == x)
	      count++;
      printf("%d\n", count);
    }
  return 0;
}



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


int main(){
    long long n;
    cin >> n;
    long long ans =  n-1;
    long long divider = 1;
    while(divider*divider<=n){
        if(n%divider!=0) ;
        else{
            long long tmp = divider + n/divider - 2;
            ans = min(tmp,ans);
        }
        divider ++;
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
class Array
  def swap!(a, b)
    self[a], self[b] = self[b], self[a]
    self
  end
end

def bubble_sort(array)
  isSorted = false
  count = 0
  index = 0
  until isSorted do
    swaped = false
    (array.length - 1).downto(index) do |comp_index|
      break if comp_index.zero?
      if array[comp_index] < array[comp_index - 1]
        array.swap! comp_index, (comp_index - 1)
        count += 1
        swaped = true
      end
    end
    isSorted = true unless swaped
    index += 1
  end
  [array, count]
end

n = gets.to_i
array = gets.split(' ').map(&:to_i)
result_array, count = bubble_sort array
puts result_array.join ' '
puts count



Measured memory_bytes: 6872
#[allow(unused_imports)]
use proconio::{fastout, input};

#[fastout]
fn main() {
    input!(n: usize, m: usize, lr: [[usize; 2]; m]);

    let mut result_vec = vec![0 as isize; n + 1];
    for v in lr {
        result_vec[v[0] - 1] += 1;
        result_vec[v[1]] -= 1;
    }

    let mut ruiseki = Vec::new();
    ruiseki.push(result_vec[0]);
    for i in 1..result_vec.len() {
        ruiseki.push(ruiseki[i - 1] + result_vec[i]);
    }

    println!("{}", ruiseki.iter().filter(|r| **r == m as isize).count());
}


Measured memory_bytes: 9452
#include <iostream>
#include <iomanip>
#define _USE_MATH_DEFINES
#include <math.h>

using namespace std;
void swap(int &a, int &b);

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

	int **matrixA, **matrixB;
	matrixA = new int*[n]();
	for (int i = 0; i < n; ++i)
		matrixA[i] = new int[m]();

	matrixB = new int*[m]();
	for (int i = 0; i < m; ++i)
		matrixB[i] = new int[l]();

	for (int i = 0; i < n; ++i)
	{
		for (int j = 0; j < m; ++j)
		{
			cin >> matrixA[i][j];
			
		}
	}

	for (int i = 0; i < m; ++i)
	{
		for (int j = 0; j < l; ++j)
		{
			cin >> matrixB[i][j];
			
		}
	}
	
	unsigned long  **matrixC = new unsigned long *[n]();
	for (int i = 0; i < n; ++i)
		matrixC[i] = new unsigned long [l]();

	for (int i = 0; i < n; ++i)
	{
		for (int j = 0; j < l; ++j)
		{
			matrixC[i][j] = 0;
		}
	}

	//cout << "Processing " << endl;

	for (int i = 0; i < n; ++i)
	{
		for (int j = 0; j < l; ++j)
		{
			for (int k = 0; k < m; ++k)
			{
				matrixC[i][j] += matrixA[i][k] * matrixB[k][j];
			}
		}
	}


	//for (int i = 0; i < n; ++i)
	//{
	//	for (int j = 0; j < m; ++j)
	//	{
	//		for (int k = 0; k < l; ++k)
	//		{
	//			cout << "CC : " << matrixC[i][k] << endl;
	//			matrixC[i][k] += matrixA[i][j] * matrixB[j][k];
	//			if (matrixC[i][k] < 0)
	//			{
	//				cout << "A : " << matrixA[i][j] << "  B : " << matrixB[j][k] << endl;
	//				cout << "C : " << matrixC[i][k] << endl;
	//				cout << "ERROR" << endl;
	//				return 0;
	//			}
	//		}
	//	}
	//}

	for (int i = 0; i < n; ++i)
	{
		for (int j = 0; j < l; ++j)
		{
			cout << matrixC[i][j];
			if (j != l - 1)
				cout << " ";
		}
		cout << endl;
	}






	return 0;
}




Measured memory_bytes: 3252
import java.util.*;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		while (true) {
			int h = sc.nextInt();
			int w = sc.nextInt();
			if ((h | w) == 0)
				break;
			String[] field = new String[h];
			for (int i = 0; i < h; i++) {
				field[i] = sc.next();
			}
			String result = "";
			Set<String> set = new HashSet<String>(0);
			for (int i = 0; i < h; i++)
				for (int j = 0; j < w; j++) {
					int[] dx = { 1, 1, 0, -1, -1, -1, 0, 1 };
					int[] dy = { 0, 1, 1, 1, 0, -1, -1, -1 };
					int px = j;
					int py = i;
					for (int k = 0; k < 8; k++) {
						StringBuilder s = new StringBuilder("");
						do {
							s.append(field[py].charAt(px));
							px = (px + dx[k] + w) % w;
							py = (py + dy[k] + h) % h;
							if (s.length() >= Math.max(2, result.length())
									&& !set.add(s.toString())
									&& (result.length() < s.length() || (result
											.length() == s.length() && result
											.compareTo(s.toString()) > 0))) {
								result = s.toString();
							}
						} while (!(px == j && py == i));
					}
				}
			if (result.length() < 2)
				System.out.println(0);
			else
				System.out.println(result);
		}
		sc.close();
	}
}

Measured memory_bytes: 125204
#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 n,k;
    string s;
    cin >> n >> k >> s;
    int ans = 0;
    rep(i,n-1) {if (s[i]==s[i+1]) ans += 1;}
    ans = min(ans+2*k,n-1);
    cout << ans << endl;
    
}

Measured memory_bytes: 512
#include <iostream>
#include <queue>
#include <cmath>
using namespace std;
int main(void){
    
    long long H;
    long long count = 0;
    cin >> H;
    
    queue<long long> que;
    
    if(H == 0){
        cout << 1 << endl;
        return 0;
    }
    
    que.push(H);
    while(!que.empty()){
        
        // 値を取り出す
        long long A = que.front();
        que.pop();
        
        // 攻撃した
        count++;
        A /= 2;
        
        // 攻撃後の結果
        if(A == 0) continue;
        que.push(A);
        //que.push(A);
    }
    
    long long ans = 0;
    
    for(int i = 0; i < count; i++) ans += pow(2,i);
    cout << ans << endl;
    
}


Measured memory_bytes: 256
a,b,c,d,e,f=gets.split.map(&:to_i)
a*=100
b*=100
as,bs,cs,ds=[a,b,c,d].map{ |x| (f/x+1).times.map{ |n| x*n}}
ws=as.product(bs).map{ |w| w[0]+w[1]}.select{ |w| w<=f && w!=0}.uniq.sort
ss=cs.product(ds).map{ |s| s[0]+s[1]}.select{ |s| s<=f}.uniq.sort
fs=ws.product(ss).select{ |r| r[0]+r[1]<=f}.select{ |r| r[1].fdiv(r[0]+r[1])<=e.fdiv(100+e)}
ans=fs.sort{ |l,r| r[1].fdiv(r[0]+r[1])<=>l[1].fdiv(l[0]+l[1])}.first
puts [ans[0]+ans[1],ans[1]]*" "


Measured memory_bytes: 34296
#include <iostream>
#include <cmath>
#include <iomanip>

using namespace std;

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

    double ans = 0;
    for(int i = 1; i <= N; i++)
    {
        double tmp = 1.0 / N;

        long long val = i;
        while(val < K)
        {
            val *= 2;
            tmp *= 0.5;
        }

        ans += tmp;
    }

    cout << fixed << setprecision(10) << ans << endl;
    return 0;
}

Measured memory_bytes: 256
n =int(input())
a = list(map(str,input().split()))
from collections import defaultdict
d = defaultdict(int)


if n%2==0:
    for i in range(n):
        d[a[i]]+=1
    if all(int(x)==2 for x in d.values()):
        print((2**(n//2))%(10**9+7))
        exit()
    else:
        print(0)
        exit()

else:
    d["0"]+=1
    for i in range(n):
        d[a[i]]+=1
    if all(int(x)==2 for x in d.values()):
        print((2**((n-1)//2))%(10**9+7))
        exit()
    else:
        print(0)
        exit()





Measured memory_bytes: 55276
#!/usr/bin/env python3
import sys


def solve(K: int, A: int, B: int):

    if A % K == 0:
        print("OK")
        return

    a = A // K

    if (a + 1) * K <= B:
        print("OK")
    else:
        print("NG")

    return


# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    K = int(next(tokens))  # type: int
    A = int(next(tokens))  # type: int
    B = int(next(tokens))  # type: int
    solve(K, A, B)

if __name__ == '__main__':
    main()


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

ll gcd(ll a,ll b){
  if(b == 0) return a;
  return gcd(b, a % b);
}
const ll P =  1000000007;
ll factorial(ll n){
   ll ans = 1;
   for(int i = n;i>=1;i--){
     ans *= i;
     ans %= P;
   }
   return ans;
}
using Graph = vector<vector<int>>;

ll kzyou(ll a,ll k){//aのk乗を返す
    ll zyou = 1;
    for(ll i = 1;i<=k;i++){
        zyou *= a;
    }
    return zyou;
}

int main(){
  int N,M;
  cin >> N >> M;
  if(N == M) cout << "Yes" << endl;
  else cout << "No" << endl;

 }

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

int main() {
    int n,ans=0;cin>>n;
    int a[n],b[n],c[n-1];
    
    for(int i=0;i<n;++i){
        cin>>a[i];
    }
    for(int i=0;i<n;++i){
        cin>>b[i];
        ans+=b[i];
    }
    for(int i=0;i<n-1;++i){
        cin>>c[i];
    }
    for(int i=0;i<n-1;++i){
        if(a[i+1]-a[i]==1)ans+=c[a[i]-1];
    }
    cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 256
def resolve():
    '''
    code here
    '''
    import collections

    N = int(input())
    A_list = [int(item) for item in input().split()]

    cnt_dict = collections.Counter(A_list)

    ans = [0 for _ in range(N+1)]
    for i, v in cnt_dict.items():
        ans[i] += v

    for i in ans[1:]:
        print(i)

if __name__ == "__main__":
    resolve()


Measured memory_bytes: 35484
#include <iostream>
#include <string>
#include <algorithm>
#include <cstring>
#include <cstdio>

std::string get_input(void) {
    std::string str;
    std::getline(std::cin, str);
    return str;
}

std::string convert(std::string str) {
    char c;
    for (std::string::iterator i = str.begin(); i != str.end(); i++) {
        c = *i;
        switch(c) {
            case ' ':
                break;
            case '.':
                break;
            default:
                *i = toupper(c);
                break;
        }
    }
    return str;
}

int main(void) {
    std::string str = get_input();
    std::cout << convert(str) << std::endl;
    return 0;
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
using namespace std;
int main()
{
int n;
cin>>n;
int x[n],y[n],z[n];
for(int i=0;i<n;i++)
cin>>x[i]>>y[i]>>z[i];
for(int j=0;j<n-1;j++)
{long long ans=0;
int a=x[j],b=y[j],c=z[j];
ans=a+b;                 
for(int i=j+1;i<n-1;i++)
{
a=x[i],b=y[i],c=z[i];

    if(ans>b)
    {
        while(ans%c)
        {
            ans++;
        }
        ans+=a;
    }
    else 
    ans=b+a;
}

cout<<ans<<endl;
}
cout<<0;

return 0;
}
 


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

// 插入此處

int main() {
    int q;
    cin >> q;
    while (q--) {
        LL a, b;
        cin >> a >> b;
        LL p = a * b - 1;

        LL x = sqrt((long double)p);

        LL ans = x + p / (x + 1);

        ans -= 1;
        
        if (a == b) {
            ans++;
        }

        cout << ans << endl;;

    }
}


Measured memory_bytes: 3624
#include <bits/stdc++.h>
 
using namespace std;
 
#define sf(n) scanf("%d", &n)
#define pd(n) printf("%.12lf", n)
#define pf(n) printf("%d", n)
#define p() printf("\n")
#define ps() printf(" ")
#define ll long long
#define ull unsigned long long
#define MAX 1e9
const int mod = 1000 * 1000 * 1000 + 7;
#define ex 1e18
#define dbl 2e09
#define qu(q) queue<int> q
#define pqu(q) priority_queue<int> q
#define len(s) s.length()
#define sz(x) int(x.size())
#define pb(x) push_back(x)
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define F first
#define S second
#define clr(x) x.clear()
#define LOG(x) std::cout << x << std::endl;
 
const int INF = 0x3f3f3f3f;
const ll LL_INF = 0x3f3f3f3f3f3f3f3f;
const double PI = 3.14159265359;
 
int dx[4] = {1, -1, 0, 0};
int dy[4] = {0, 0, 1, -1};


int main(){
   int a,b;
   cin>>a>>b;
   for(int i=1;i<=10000;++i){
      int x=i*0.08;
      int y=i*0.1;
      if(x==a and b==y)
         return cout<<i<<endl,0;
   }
   cout<<-1<<endl;
   return 0;
}

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

//#pragma GCC optimize("Ofast")
//#pragma comment(linker, "/stack:200000000")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4"

#define mp make_pair
#define pb push_back
#define f first
#define s second
#define ll long long
//#define int ll
#define forn(i, a, b) for(int i = (a); i <= (b); ++i)
#define forev(i, b, a) for(int i = (b); i >= (a); --i)
#define VAR(v, i) __typeof( i) v=(i)
#define forit(i, c) for(VAR(i, (c).begin()); i != (c).end(); ++i)
#define all(x) (x).begin(), (x).end()
#define sz(x) ((int)(x).size())
#define file(s) freopen(s".in","r",stdin); freopen(s".out","w",stdout);
 
using namespace std;
 
const int maxn = (int)500;
const int mod = (int)1e9 + 7;
 
#define inf mod
 
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;   
typedef vector<ll> Vll;               
typedef vector<pair<int, int> > vpii;
typedef vector<pair<ll, ll> > vpll;

int n, a[22][22], dp[22][(1 << 21)], m[22];
int main () {
  scanf("%d", &n);
  forn(i, 0, n-1)
    forn(j, 0, n - 1)
      scanf("%d", &a[i][j]);
  dp[0][0] = 1;
  forn(i, 0, n-1){
    forn(j, 0, (1 << n) - 1){
      if(!dp[i][j])continue;
      forn(k,0,n-1)
        if(a[i][k]&&!((j>>k)&1))
          dp[i+1][j+(1<<k)]=(dp[i][j]+dp[i+1][j+(1<<k)])%mod;
    }  
  }
  printf("%d", dp[n][(1 << n) - 1]);
}

Measured memory_bytes: 162048
#include "bits/stdc++.h"
#define rep(i,a,n) for(int i = a;i < n;i++)
typedef unsigned long long ull;
typedef long long ll;
using namespace std;

int main(){
    int n,q;
    cin >> n >> q;
    
    vector<priority_queue<int> > vec(n);
    
    int a,b,c;
    
    rep(i,0,q){
        cin >> a;
        
        if(a == 0){
            cin >> b >> c;
            vec[b].push(c);
        }
        else if(a == 1){
            cin >> b;
            if(!vec[b].empty()) cout << vec[b].top() << endl;
        }
        else{
            cin >> b;
            if(!vec[b].empty()) vec[b].pop();
        }
        
    }
    
    return 0;
}


Measured memory_bytes: 4052
#include <iostream>
#include <cassert>
#include <vector>
#include <cmath>
#include <ctime>
#include <cstdlib>
#include <fstream>
#include <string>
#include <sstream>
#include <iterator>
#include <map>
#include <algorithm>
#include <memory>
#include <iomanip>
#include <limits>
#include <typeinfo>
 
#include <stdio.h>
#include <string.h>
 
 
using namespace std;
 
int main(int argc, char* argv[])
{

	string S;
	char wrk[27]={0};
	bool ret;

	cin >> S;

	for(unsigned i=0;i<S.length();i++){
		wrk[S[i]-'a']++;
	}

	ret=true;
	for(unsigned i=0;i<27;i++){
		if(wrk[i]>1){
			ret = false;
		}
	}


	cout << (ret ? "yes" : "no") << endl;

	return 0;

}


Measured memory_bytes: 256
N,M=gets.chomp.split.map(&:to_i)
e1 = Array.new(N+1).map{Array.new}
M.times do
  u,v=gets.chomp.split.map(&:to_i)
  e1[u] << v
end
s,t=gets.chomp.split.map(&:to_i)
e2 = Array.new(N*3+1).map{Array.new}
1.upto(N) do |i|
  e1[i].each do |j|
    e2[i] << N+j
    e2[N+i] << 2*N+j
    e2[2*N+i] << j
  end
end

d = Array.new(3*N+1,10**10)

def bfs(s, t, e, d, depth)
  que = []
  que.push(s)
  d[s] = depth

  while(que.size != 0)
    n = que.shift
    e[n].each do |v|
      next if d[v] <= d[n] + 1
      d[v] = d[n] + 1
      que.push(v)
    end
  end

end

bfs(s,t,e2,d,0)

if d[t] != 10**10
  puts d[t] / 3
else
  puts -1
end


Measured memory_bytes: 26476
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
using namespace std;
typedef long long lng;
typedef unsigned long long ulng;
#define FOR(i,a,b) for(int i=(a); i<=(b); ++i)
#define FORD(i,b,a) for(int i=(b); i>=(a); --i)
#define REP(i,n) FOR(i,0,n-1)
#define ALL(a) (a).begin(), (a).end()
#define UNIQUE(a) a.erase(unique(ALL(a)), a.end()) //ATTENTION: <a> must be sorted in advance

lng power(lng b, lng n) {lng sol=1; while(n>0) {if(n&1) {sol=sol*b;} n>>=1; b*= b;} return sol;} //calculate b^n

const int MOD = 1000000007; //10^9+7


/*********** variables ************/
int X, t;
/**********************************/

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

    cout << max(X-t, 0) << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <cmath>
using namespace std;
using ll = long long;
 
int main() {
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    cin.tie(0);
 
    int h, w;
    cin >> h >> w;
 
    int k[2000] = {}, m[2000] = {};
    int r = 0;
 
    for (int i = 0; i < h; i++) {
        char s[2001];
        cin >> s;
 
        int l = 0;
        for (int j = 0; j < w; j++) {
            if (s[j] == '.') {
                if (l == 0) {
                    int t = j + 1;
                    while (t < w && s[t] == '.') t++;
                    l = t - j;
                }
                k[j]++;
                m[j] = max(m[j], l);
 
            } else {
                r = max(r, k[j] + m[j]);
                l = 0;
                k[j] = 0;
                m[j] = 0;
            }
        }
    }
    for (int j = 0; j < w; j++) {
        r = max(r, k[j] + m[j]);
    }
 
    cout << r - 1 << endl;
 
    return 0;
}

Measured memory_bytes: 384
n,q = map(int,input().split())
s = input()
ac = []
for i in range(n):
    if i == 0:
        ac.append(0)
    elif s[i-1:i+1] == "AC":
        ac.append(ac[i-1] + 1)
    else:
        ac.append(ac[i-1])
for i in range(q):
    l,r = map(int,input().split())
    print(ac[r-1]-ac[l-1])

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

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

  int A[100100] = {0};
  int max_a = 0;
  for (int i = 0; i < N; ++i) {
    int a;
    cin >> a;
    ++A[a];
    max_a = max(max_a, a);
  }

  int ans = A[0] + A[1];
  for (int i = 1; i <= max_a; ++i) {
    ans = max(ans, A[i-1] + A[i] + A[i+1]);
  }

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
#define ALL(v) v.begin(), v.end()
#define MAX 510000
#define rrep(i, n) for(ll i = 0; i < (ll)(n); i++)
#define rep(i, n) for(ll i = 1; i <= (ll)(n); i++)
#define dcout cout<<fixed<<setprecision(15);
#define mp make_pair
#define pb push_back

using namespace std;
typedef long long int  ll;
typedef pair<ll, ll> P;

constexpr int MOD = 1e9 + 7;
constexpr ll inf = 1LL << 60;

template< typename S, typename T >
inline void chmax(S &a, const T &b) { if(a < b) a = b; }
 
template< typename S, typename T >
inline void chmin(S &a, const T &b) { if(a > b) a = b; }
 

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

//a^n mod p//
ll modpow(ll a, ll n, ll p) {
	if(n==0) return (ll)1;
  if (n == 1) return a % p;
  if (n % 2 == 1) return (a * modpow(a, n - 1, p)) % p;
  ll t = modpow(a, n / 2, p);
  return (t * t) % p;
}

//inversemod//
ll modinv(ll a, ll m) {
	if(m==0)return (ll)1;
	ll b = m, u = 1, v = 0;
	while (b) {
		ll t = a / b;
		a -= t * b; swap(a, b);
		u -= t * v; swap(u, v);
	}
	u %= m;
	if (u < 0) u += m;
	return u;
}

//Cmonp//
ll 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;
	}
}

// 
ll COM(ll n, ll k) {
	if (n < k) return 0;
	if (n < 0 || k < 0) return 0;
	return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

//LARGE n
ll com(ll n,ll m){
    if(n<m || n<=0 ||m<0){
		return 0;
	}
	if( m==0 || n==m){
		return 1;
	}
	ll k=1;
	for(ll i=1;i<=m;i++){
       k*=(n-i+1); 
	   k%=MOD;
	   k*=modinv(i,MOD);
	   k%=MOD;
	}
	return k;
}

//radP
ll rad(ll u, ll p){
ll cnt=0;
	while(u%p==0){
		u/=p;
		cnt++;
	}
	return cnt;
}


////////////////////////////////////////////////////////////////////

int main() {
 ios::sync_with_stdio(false);

ll a,v;
cin>>a>>v;
ll b,w;
cin>>b>>w;
ll t;
cin>>t;
ll dis=abs(a-b);

if(dis>t*(v-w)){
	cout<<"NO"<<endl;
}
else{cout<<"YES"<<endl;}



return 0;
}




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

int main() {
  int A,B,C,D;
  cin >> A >> B >> C >> D;

  if ( A+B>C+D ) {
    cout << "Left" << endl;
  }
  
  else if ( A+B<C+D ){
    cout <<"Right"<< endl;
  }
  
  else{
    cout<<"Balanced"<<endl;
  }
  
}

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

int main() {
	int a, b, c, k;
    std::vector<int> x;

	std::cin >> a >> b >> k;
  
  	c = a < b ? a : b;

	for (int i = c; i > 0; i--) {
    	if (a % i == 0 && b % i == 0) x.push_back(i);
    }

	std::cout << x.at(k - 1) << std::endl;
	
	return 0;
}

Measured memory_bytes: 256
import sys

read = sys.stdin.buffer.read
input = sys.stdin.buffer.readline
inputs = sys.stdin.buffer.readlines


#mod=10**9+7
# rstrip().decode('utf-8')
# map(int,input().split())
#import numpy as np


def main():
	n=int(input())
	x=[]
	y=[]
	for _ in range(n):
		xin,yin=map(int,input().split())
		x.append(xin)
		y.append(yin)
	
	li=[[0]*n for _ in range(n)]
	
	for i in range(n):
		for j in range(n):
			if i>j:
				li[i][j]=((x[i]+x[j])/2,(y[i]+y[j])/2,(((x[j]-x[i])**2)+(y[j]-y[i])**2)**0.5)
				li[j][i]=(-(y[j]-y[i]),(x[j]-x[i]))
	l=0
	h=1000
	
	
	for ii in range(100):
		m=(l+h)/2
		ko=[]
		for i in range(n):
			for j in range(n):
				if i>j:
					k=4*(m**2)-(li[i][j][2])**2
					if k>0:
						k=k/(4*(li[i][j][2])**2)
						k=k**0.5
						ko.append((li[i][j][0]+k*li[j][i][0],li[i][j][1]+k*li[j][i][1]))
						ko.append((li[i][j][0] - k * li[j][i][0], li[i][j][1] - k * li[j][i][1]))
		if len(ko)==0:
			l=m
			continue
		
		for point in ko:
			f=0
			for i in range(n):
				length=((point[0]-x[i])**2+(point[1]-y[i])**2)**0.5
				if length-0.0000000000001>m:
					f=1
					break
			if f==0:
				h=m
				break
		else:
			l=m
		
		
	print(l)
	
		
		
		
		
		
		
		
		
		
	
	
	
	
	
	
	
	


if __name__ == "__main__":
	main()


Measured memory_bytes: 45164
#include <stdio.h>
#include <string.h>

typedef struct {
	const char* mozi;
	int mozinum;
} button_t;

const button_t button[9]={
	{"',.!?",5},
	{"abcABC",6},
	{"defDEF",6},
	{"ghiGHI",6},
	{"jklJKL",6},
	{"mnoMNO",6},
	{"pqrsPQRS",8},
	{"tuvTUV",6},
	{"wxyzWXYZ",8}
};

int main(void) {
	int i,length;
	int status;
	int count;
	char input[10004];
	while(scanf("%s",input)==1) {
		status=0;
		count=0;
		length=strlen(input);
		for(i=0;i<length;i++) {
			if(input[i]>='1' && input[i]<='9') {
				if(status!=input[i]-'0') {
					if(status!=0)putchar(button[status-1].mozi[count]);
					status=input[i]-'0';
					count=0;
				} else {
					count++;
					if(count>=button[status-1].mozinum)count=0;
				}
			} else if(input[i]=='0') {
				if(status!=0) {
					putchar(button[status-1].mozi[count]);
					status=0;
					count=0;
				} else {
					putchar(' ');
				}
			}
		}
		if(status!=0)putchar(button[status-1].mozi[count]);
		putchar('\n');
	}
	return 0;
}

Measured memory_bytes: 0