akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <cstdio>
#include <vector>
using namespace std;

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

    long long count_ac = 0, count_wa = 0, count_tle = 0, count_re = 0;

    for(long long i = 0; i < n; i++){
        string s;
        cin >> s;

        if(s == "AC"){
            count_ac++;
        }
        else if(s == "WA"){
            count_wa++;
        }
        else if(s == "TLE"){
            count_tle++;
        }
        else if(s == "RE"){
            count_re++;
        }
    }

    printf("AC x %lld\n", count_ac);
    printf("WA x %lld\n", count_wa);
    printf("TLE x %lld\n", count_tle);
    printf("RE x %lld\n", count_re);

    return 0;
}

Measured memory_bytes: 3724
N, X = map(int, input().split())
M = sorted([int(input()) for _ in range(N)])

if X >= sum(M):
    min_M = min(M)
    ans = (X - sum(M)) // min_M + N
else:
    current = 0
    for i, m in enumerate(M, start=1):
        current += m
        if current > X:
            ans = i
print(ans)


Measured memory_bytes: 9116
#include<bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n ; i++)
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define whole(f, x, ...) ([&](decltype((x)) whole) { return (f)(begin(whole), end(whole), ## __VA_ARGS__); })(x) // decltypeで型取得、引数があればva_argsのところに入れる
using namespace std;
typedef long long ll; // long longをllでかけるようにした
const int INF = 1e9;

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

    vector<ll> city[100010];
    vector<pair<ll, ll>> num(0);

    REP(i, m){
        int pre, year; cin >> pre >> year;
        num.push_back(make_pair(pre, year));
        city[pre].push_back(year);
    }
    REP(i, n) whole(sort, city[i + 1]);

    REP(i, m){
        cout << setw(6) << setfill('0') << num[i].first;
        cout << setw(6) << setfill('0') << distance(city[num[i].first].begin(), whole(lower_bound, city[num[i].first], num[i].second)) + 1 << endl;
    }



}

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

int n, A[50];

int solve(int i, int m) {
    if (m == 0) return 1;
    if (i >= n) return 0;
    int res = solve(i + 1, m) || solve(i + 1, m - A[i]);
    return res;
}

int main() {
    int q, M, i;

    scanf("%d", &n);
    for (i = 0; i < n; i++) scanf("%d", &A[i]);

    scanf("%d", &q);
    for (i = 0; i < q; i++) {
        scanf("%d", &M);
        if ( solve(0, M) ) printf("yes\n");
        else printf("no\n");
    } 

    return 0;
}

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

void main (void)
{
  int index, ac, wa, tle, re, ret;
  index = ac = wa = tle = re = ret = 0;
  char c[3];
  ret = scanf("%d", &index);
  for (int i = 0; i < index; i++) {
    ret = scanf("%s", c);
    if (strcmp(c, "AC")==0) {
      ++ac;
    } else if (strcmp(c, "WA")==0) {
      ++wa;
    } else if (strcmp(c, "TLE")==0) {
      ++tle;
    } else {
      ++re;
    }
  }
  printf("AC x %d\nWA x %d\nTLE x %d\nRE x %d\n", ac, wa, tle, re);
  return;
}

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

int main(void){
    
    int a,b,c; cin >> a >> b >> c;
    
    if(a>b) swap(a,b);
    if(b>c) swap(b,c);
    if(b<a) swap(b,a);
    
    cout << a << " " << b << " " << c << endl;
    
    return 0;
    
}


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

using namespace std;

int main () {
	int n, m;
	string s;
	map<string, int> cards;

	cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> s;
		auto it = cards.find(s);
		if (it == cards.end()) {
			cards[s] = 1;
		} else {
			it->second += 1;
		}
	}
	cin >> m;
	for (int i = 0; i < m; i++) {
		cin >> s;
		auto it = cards.find(s);
		if (it == cards.end()) {
			cards[s] = -1;
		} else {
			it->second -= 1;
		}
	}

	auto mx = max_element(cards.begin(), cards.end(), [](const pair<string, int>& p1, const pair<string, int>& p2) {
        return p1.second < p2.second;
    	});
	int p = (mx->second > 0) ? mx->second : 0;
	cout << p << endl;

	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <cstring>
#include <cstdio>
#include <cmath>
#include <cctype>
#include <map>
#include <vector>

using namespace std;

int BubSort(int x[], int n)
{
	int i, j, temp;

	for (i = 0; i < n - 1; i++) {
		for (j = n - 1; j > i; j--) {
			if (x[j - 1] > x[j]) {  /* 前の要素の方が大きかったら */
				temp = x[j];        /* 交換する */
				x[j] = x[j - 1];
				x[j - 1] = temp;
			}
		}
	}
	return 0;
}

int main()
{
	int n = 0;
	int a[1000];
	cin >> n;
	for (int i = 0; i < n; i++)
	{
		cin >> a[i];
	}

	BubSort(a, n);
	cout << a[n-1] - a[0] << endl;
	return 0;

}

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

typedef long long LL;
typedef unsigned long long ULL;

#define debug printf("fuck %d\n", __LINE__);

inline LL read() {
	LL res = 0, bo = 1; char ch = getchar();
	while(ch < '0' || ch > '9') { if (ch == '-') bo = -1; ch = getchar(); }
	while(ch >= '0' && ch <= '9') { res = (res << 1) + (res << 3) + ch - '0'; ch = getchar(); }
	return bo * res;
}

template<typename T> void read(T &x) { x = read(); }
template<typename T, typename ...Argv> void read(T &a, Argv &...argv) { read(a); read(argv...); }

const int N = 3005;
std::vector<int> to[N];

int f[N][N], fa[N][N], ans;

void dfs(int root, int x, int fa) {
	::fa[root][x] = fa;
	for (auto v : to[x]) {
		if (v == fa) continue;
		dfs(root, v, x);
	}
}

void work(int u, int v) {
	if (f[u][v] == v || f[v][u] == u) return;
	if (f[u][v] != u) { work(f[u][v], v); return; }
	if (f[v][u] != v) { work(u, f[v][u]); return; }
	f[u][v] = v; f[v][u] = u;
	std::queue<int> q;
	std::vector<std::pair<int, int> > e;
	q.push(v);
	while (q.size()) {
		int x = q.front(); q.pop();
		for (auto y : to[x]) {
			if (y == fa[u][x]) continue;
			if (f[u][y] == u) f[u][y] = v, q.push(y);
			else e.push_back(std::make_pair(v, y));
		}
	}
	q.push(u);
	while (q.size()) {
		int x = q.front(); q.pop();
		for (auto y : to[x]) {
			if (y == fa[v][x]) continue;
			if (f[v][y] == v) f[v][y] = u, q.push(y);
			else e.push_back(std::make_pair(u, y));
		}
	}
	for (auto x : e) work(x.first, x.second);
}

void dfs(int x, int fa, int r, int v) {
	if (x != r && f[v][x] == x) ++ ans, v = x;
	for (auto y : to[x]) {
		if (y == fa) continue;
		dfs(y, x, r, v);
	}
}

int main() {
	int n = read(), m = read();
	for (int i = 1; i < n; ++ i) {
		int u = read(), v = read();
		to[u].push_back(v), to[v].push_back(u);
	}
	for (int i = 1; i <= n; ++ i) {
		dfs(i, i, i);
		for (int j = 1; j <= n; ++ j) f[i][j] = i;
	}
	for (int i = 1; i <= m; ++ i) {
		int u = read(), v = read();
		work(u, v);
	}
	for (int i = 1; i <= n; ++ i) dfs(i, i, i, i);
	std::cout << (ans >> 1) << std::endl;
	return 0;
}

Measured memory_bytes: 50048
#include <bits/stdc++.h>
using namespace std;
#define min(a,b) ((a)<(b)?(a):(b))
#define max(a,b) ((a)>(b)?(a):(b))
#define REP(i,n) for(int i=0;i<n;i++)
#define FOR(i,n1,n2) for(int i=n1;i<n2;i++)
#define bFOR(i,n1,n2) for(int i=n1;i>=n2;i--)
#define speed_up    ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);

typedef long long int ll;
typedef pair<ll,ll> Pi;
const int INF=(ll)(1LL<<30)-1;
const double INFd=100000000000.0;
const ll INFl=(ll)9223372036854775807;
const int MAX=10000;
const ll MOD=(ll)1e9+7;
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 dx[4]={0,1,0,-1},dy[4]={-1,0,1,0};

template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
    std::fill( (T*)array, (T*)(array+N), val );
}

int w,h;
char a[55][55];
int wa[55][55];
int ba[55][55];

void bdfs(int y,int x){
	REP(i,4){
		int ny=y+dy[i];
		int nx=x+dx[i];
		if(0<=ny&&ny<h&&0<=nx&&nx<w&&ba[ny][nx]==0&&a[ny][nx]=='.'){
			ba[ny][nx]=1;
			bdfs(ny,nx);
		}
	}
	return;
}
void wdfs(int y,int x){
	REP(i,4){
		int ny=y+dy[i];
		int nx=x+dx[i];
		if(0<=ny&&ny<h&&0<=nx&&nx<w&&wa[ny][nx]==0&&a[ny][nx]=='.'){
			wa[ny][nx]=-1;
			wdfs(ny,nx);
		}
	}
	return;
}
int main(){
	while(1){
		cin>>w>>h;
		if(w==0&&h==0)break;
		REP(i,55)
			REP(j,55){
				wa[i][j]=0;
				ba[i][j]=0;
			}
		REP(i,h)
			REP(j,w)
				cin>>a[i][j];
		
		REP(i,h)
			REP(j,w){
				if(a[i][j]=='W'){
					wdfs(i,j);
				}else if(a[i][j]=='B'){
					bdfs(i,j);
				}
			}
		
		int bans=0;
		int wans=0;
		REP(i,h)
			REP(j,w){
				if(wa[i][j]+ba[i][j]==1)bans++;
				if(wa[i][j]+ba[i][j]==-1)wans++;
			}
		cout<<bans<<" "<<wans<<endl;
	}
	return 0;
}


Measured memory_bytes: 3124
#include<stdio.h>
int main()
{
  int n,i,sum=0,count=0;
  scanf("%d",&n);
  int arr[n];
   for(i=0;i<n;i++)
   {
     scanf("%d",&arr[i]);
   }
  for(i=0;i<n;i++)
  {
    if(arr[i]%2==0)
      {
      sum++;
    
      if(arr[i]%3==0||arr[i]%5==0)
      {
        count++;
      }
    }
  }
  if(sum==count)
  {
    printf("APPROVED");
  }
  else
  {
    printf("DENIED");
  }
  return 0;
}


Measured memory_bytes: 128
#include <iostream>
#include <string>

using namespace std;

int main(){
	string str;
	cin >> str;
	int z=0,o=0;
	for(int i=0;i<str.length();i++){
		if(str[i]=='0'){
			z++;
		}else if(str[i]=='1'){
			o++;
		}
	}
	if(z<o){
		cout << z*2 << endl;
	}else{
		cout << o*2 << endl;
	}


	return 0;
}

Measured memory_bytes: 512
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long LL;
typedef long double ld;
typedef vector<ll>VI;
typedef pair<ll,ll>P;
#define VV(T) vector<vector<T>>
#define sz(x) int(x.size())
#define PI 3.1415926535897932384626433832795
#define rep(i, n) for (ll i = 0; i < (ll)n; i++)
#define ALL(a)  (a).begin(),(a).end()
#define rALL(a) (a).rbegin(),(a).rend()
#define c_max(a, b) (((ll)a)>((ll)b)?(a):(b))
#define c_min(a,b) (((ll)a)<((ll)b)?(a):(b))
#define chmax(x,a) x=max(x,a)
#define chmin(x,a) x=min(x,a)
#define vmax(v) *max_element(ALL(v))
#define vmin(v) *min_element(ALL(v))
#define $(x) {cout<<#x<<" = " <<(x)<<endl;}
#define fi first
#define se second
#define MAX 100100//5
#define MAX2 200100
#define MAX6 1001001//6
#define MAX7 10010010//7
#define SENTINEL 2000000000//9
const int MOD = 1000000007;
#define INF 1<<30
#define INFTY 1LL<<61
#define MAX_INT INT_MAX
#define Endl '\n'
#define CLR(mat) memset(mat, 0, sizeof(mat))
inline ll GCD(ll a,ll b){return b?GCD(b,a%b):a;}
inline ll lcm(ll a,ll b){return a*b/GCD(a,b);}
template<class T> bool contain(const std::string& s, const T& v) {
   return s.find(v) != std::string::npos;
}
using Edge=pair<int,ll>;
using Graph=vector<vector<ll> >;//ll or Edge
//const int dx[4]={1,0,-1,0},dy[4]={0,1,0,-1};
// sort_reverse -> greater<long long>()
// vector型から重複を削除 list.erase(unique(ALL(list)),list.end());
// g++ -o a a.cpp -Wall -lm -std=c++17
//push_back -> emplace_back
string S;
void add(ll &a,ll b){
   a+=b;
   if(a>=MOD)a-=MOD;
}
ll dp[MAX][4];
int main(){
   cin>>S;
   memset(dp,0,sizeof(dp));
   dp[0][0]=1;
   rep(i,sz(S)){
      rep(j,4){
         if(S[i]!='?')add(dp[i+1][j],dp[i][j]);
         else add(dp[i+1][j], dp[i][j]*3%MOD);
         dp[i+1][j]%=MOD;
      }
      if(S[i]=='A')dp[i+1][1]+=dp[i][0];
      if(S[i]=='B')dp[i+1][2]+=dp[i][1];
      if(S[i]=='C')dp[i+1][3]+=dp[i][2];
      if(S[i]=='?'){
         for(int j=1;j<=3;j++)dp[i+1][j]+=dp[i][j-1];
      }
      rep(j,4)dp[i+1][j]%=MOD;
   }
   cout<<dp[sz(S)][3]<<endl;
}

Measured memory_bytes: 6848
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{
    set<ll> ss;
    ll a, b;
    cin>>a>>b;
    ll val = __gcd(a, b);
    ll cc = 0;
    ll n = val;
    while (n % 2 == 0)
    {
        ss.insert(2);
        n = n/2;
    }

    // n must be odd at this point. So we can skip
    // one element (Note i = i +2)
    for (ll i = 3; i <= sqrt(n); i = i + 2)
    {
        // While i divides n, print i and divide n
        while (n % i == 0)
        {
            ss.insert(i);
            n = n/i;
        }
    }

    // This condition is to handle the case when n
    // is a prime number greater than 2
    if (n > 2)
        ss.insert(n);

    cout<<ss.size()+1<<endl;
    return 0;
}


Measured memory_bytes: 256
import Foundation

let input_line: String = readLine()!
//let split: [String] = input_line.components(separatedBy: " ")
//let a = Int(split[0])!
//let b = Int(split[1])!
let x = Int(input_line)!
var money : Int64 = 100
var i : Int64 = 0
while(true) {
    if money >= x {
        print(i)
        break
    }
    money += (money / 100)
    i += 1
}


Measured memory_bytes: 13076
import java.util.*;
import java.io.*;

public class Main {
	public static void main (String[] args) {
		InputReader in = new InputReader(System.in);
	    int a = in.readInt();
	    int b = in.readInt(); 
	    int k = in.readInt(); 
	    for(int i = Math.min(a, b); i>=1; i--) {
	    	if(a % i == 0 && b % i == 0) {
	    		k--; 
	    		if(k == 0) {
	    			System.out.println(i);
	    			return ; 
	    		}
	    	}
	    }
	}
}

class InputReader {

	private InputStream stream;
	private byte[] buf = new byte[1024];
	private int curChar;
	private int numChars;
	private SpaceCharFilter filter;

	public InputReader(InputStream stream) {
		this.stream = stream;
	}

	public int read() {
		if (numChars == -1)
			throw new InputMismatchException();
		if (curChar >= numChars) {
			curChar = 0;
			try {
				numChars = stream.read(buf);
			} catch (IOException e) {
				throw new InputMismatchException();
			}
			if (numChars <= 0)
				return -1;
		}
		return buf[curChar++];
	}

	public int readInt() {
		int c = read();
		while (isSpaceChar(c))
			c = read();
		int sgn = 1;
		if (c == '-') {
			sgn = -1;
			c = read();
		}
		int res = 0;
		do {
			if (c < '0' || c > '9')
				throw new InputMismatchException();
			res *= 10;
			res += c - '0';
			c = read();
		} while (!isSpaceChar(c));
		return res * sgn;
	}

	public String readString() {
		int c = read();
		while (isSpaceChar(c))
			c = read();
		StringBuilder res = new StringBuilder();
		do {
			res.appendCodePoint(c);
			c = read();
		} while (!isSpaceChar(c));
		return res.toString();
	}

	public long readLong() {
		int c = read();
		while (isSpaceChar(c)) {
			c = read();
		}
		int sgn = 1;
		if (c == '-') {
			sgn = -1;
			c = read();
		}
		long res = 0;
		do {
			if (c < '0' || c > '9') {
				throw new InputMismatchException();
			}
			res *= 10;
			res += c - '0';
			c = read();
		} while (!isSpaceChar(c));
		return res * sgn;
	}
	
	public boolean isSpaceChar(int c) {
		if (filter != null)
			return filter.isSpaceChar(c);
		return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
	}

	public String next() {
		return readString();
	}

	public interface SpaceCharFilter {
		public boolean isSpaceChar(int ch);
	}
}


Measured memory_bytes: 21076
#include <stdio.h>

int main()
{
  int a,b,c,d;

  scanf("%d %d",&a,&b);
  if(a<b){
    c=a;
    a=b;
    b=c;
  }
  
  d=a%b;

  
  while(d!=0){
    a=b;
    b=d;
    d=a%b;
  }


  printf("%d\n",b);
  

  return 0;
}
  
    
  
  



Measured memory_bytes: 2104
#include <iostream>
#include <cstdio>
#include <queue>
#include <cstring>

char buf[1<<21], *p1, *p2;
#define getc() (p1 == p2 && (p2 = (p1 = buf) + fread(buf, 1, 1<<21, stdin)), p1 == p2 ? EOF : *p1++)
#define lint long long
#define pii pair<int, int>
#define mp(x, y) make_pair((x), (y))
#define isnum(x) ('0' <= (x) && (x) <= '9')
template<typename tint>
inline void readint(tint& x) {
	int f = 1; char ch = getc(); x = 0;
	for(; !isnum(ch); ch = getc()) if(ch == '-') f = -1;
	for(; isnum(ch); ch = getc()) x = x * 10 + ch - '0';
	x *= f;
}
using namespace std;
const int maxn = 1e5 + 10;

// 倍数问题扩展到剩余系下考虑
int n;

priority_queue<pii, vector<pii>, greater<pii> > q;
int dist[maxn];

void dijkstra() {
	memset(dist, 0x3f, sizeof(int) * n);
	dist[1] = 1, q.push(mp(dist[1], 1));
	while(!q.empty()) {
		pii now = q.top(); q.pop();
		if(now.second > dist[now.first]) continue;
		int x = now.first;

		int y = (x * 10) % n;
		if(dist[y] > dist[x]) dist[y] = dist[x], q.push(mp(y, dist[y]));
		y = (x + 1) % n;
		if(dist[y] > dist[x] + 1) dist[y] = dist[x] + 1, q.push(mp(y, dist[y]));
	}
}

int main() {
	readint(n);
	dijkstra();
	cout << dist[0] << endl;
	return 0;
}


Measured memory_bytes: 2804
<?php
fscanf(STDIN, "%s", $s);
fscanf(STDIN, "%d", $q);
$r=-1;
$head='';
$tail='';
for ($i=0;$i<$q;$i++) {
  fscanf(STDIN, "%d %d %s", $t, $f, $c);
  if ($t == 1) {
    $r *= -1;
  } elseif ($f == 1 && $r == -1 || $f == 2 && $r == 1) {
    $head = $c . $head;
  } else {
    $tail .= $c;
  }
}
echo $r == -1 ? $head.$s.$tail : strrev($tail).strrev($s).strrev($head);

Measured memory_bytes: 4856
#include <bits/stdc++.h>
using namespace std;
#define rep(it,st,en) for(int it=(st);it<(int)(en);++it)
#define all(c) (c).begin(), (c).end()
#define debug(x) cerr << #x << " = " << x << endl
#define eb emplace_back
#define X first
#define Y second
typedef long long int ll; 
typedef long double ld;
typedef vector<int> vi;
typedef pair<int,int> pii;

int main(){
    ios::sync_with_stdio(false);
    cin.tie(NULL);
    int n,m;
    cin>>n>>m;
    string s;
    cin>>s;
    vector<vi> g(n);
    rep(i,0,m) {
      int a,b;
      cin>>a>>b;
      --a,--b;
      g[a].eb(b);
      g[b].eb(a);
    }
    string X = "AABB";
    vector<vi> vis(n, vi(4,0));
    bool works = false;
    function<void(int,int)> dfs = [&](int x, int pos) {
      if(s[x] != X[pos]) return;
      if(vis[x][pos] == 1) works = true;
      if(vis[x][pos]) return;
      vis[x][pos] = 1;
      for(int y:g[x]) dfs(y, (pos+1)%4);
      vis[x][pos] = 2;
    };
    rep(pos,0,4) rep(x,0,n) dfs(x, pos);
    if(works) cout << "Yes" << endl;
    else      cout << "No" << endl;
    return 0;
}


Measured memory_bytes: 27344
#include<stdio.h>
#include <stdbool.h>
#define MAX 999999

int main(void)
{
	int n;
	int i,j;
	int count;
	bool tmp[MAX]={};

	while(1){
		if((scanf("%d",&n))!=EOF){
			count=0;
			for(i=1;i<n;i++){
				tmp[i-1]=false;
			}
			
			for(i=2;i*i<=n;i++){
				if(tmp[i-1]==false){
					for(j=2;j<=n/i;j++){
						tmp[j*i-1]=true;
					}
				}
			}
			for(i=2;i<=n;i++){
				if(tmp[i-1]==false){
					count++;
//					printf("%d,",i);
				}
			}
			printf("%d\n",count);
		}
		else break;
	}
	return 0;
}

Measured memory_bytes: 1580
#include <bits/stdc++.h>
      
#define FOR(i,a,b) for( ll i = (a); i < (ll)(b); i++ )
#define REP(i,n) FOR(i,0,n)
#define YYS(x,arr) for(auto& x:arr)
#define ALL(x) (x).begin(),(x).end()
#define SORT(x) sort( (x).begin(),(x).end() )
#define REVERSE(x) reverse( (x).begin(),(x).end() )
#define UNIQUE(x) (x).erase( unique( ALL( (x) ) ) , (x).end() )
#define PW(x) (1LL<<(x))
#define SZ(x) ((ll)(x).size())
#define SHOW(x) cout << #x << " = " << x << endl

#define pb emplace_back
#define fi first
#define se second
     
using namespace std;

typedef long double ld;
typedef long long int ll;
typedef pair<int,int> pi;
typedef pair<ll,ll> pl;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<bool> vb;
typedef vector<ld> vd;
typedef vector<pi> vpi;
typedef vector<pl> vpl;
typedef vector<vpl> gr;
typedef vector<vl> ml;
typedef vector<vd> md;
typedef vector<vi> mi;
     
const ll INF = (ll)1e9 + 10;
const ll INFLL = (ll)1e18 + 10;
const ld EPS = 1e-12;
const ll MOD = 1e9+7;
     
template<class T> T &chmin( T &a , const T &b ){ return a = min(a,b); }
template<class T> T &chmax( T &a , const T &b ){ return a = max(a,b); }
template<class T> inline T sq( T a ){ return a * a; }

ll in(){ ll x; scanf( "%lld" , &x ); return x; }
char yuyushiki[1000010]; string stin(){ scanf( "%s" , yuyushiki ); return yuyushiki; }

// head


int n, m;

int cnt[100010];
bool f[100010];

int main(){

  n = in();
  m = in();

  REP( i , n ){
    cnt[i] = 1;
  }
  f[0] = true;

  REP( i , m ){
    int x = in() - 1;
    int y = in() - 1;
    cnt[x]--;
    cnt[y]++;
    if( f[x] ){
      f[y] = true;
    }
    if( cnt[x] == 0 ){
      f[x] = false;
    }
  }

  int ans = 0;
  REP( i , n ){
    if( f[i] ){
      ans++;
    }
  }

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


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

int main(){
  string s,t,u ;
  cin >> s >> t >> u ;
  cout << (char)(s.at(0)-'a'+'A') << (char)(t.at(0)-'a'+'A') << (char)(u.at(0)-'a'+'A') << endl ;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        while (true) {
            int n = sc.nextInt();
            if (n == 0) break;

            Boolean points[][] = new Boolean[21][21];
            Boolean positions[][] = new Boolean[21][21];
            for (int i = 0; i < 21; i++) {
                for (int j = 0; j < 21; j++) {
                    points[i][j] = false;
                    positions[i][j] = false;
                }
            }

            int currentX=10,currentY = 10;
            positions[currentX][currentX] = true;


            for (int i = 0; i < n; i++) {
                points[sc.nextInt()][sc.nextInt()] = true;
            }

            int m = sc.nextInt();
            for (int i = 0; i < m; i++) {
                String direction = sc.next();
                int distance = sc.nextInt();
                if (direction.endsWith("N")){
                    for (int j = 0; j < distance; j++ ){
                        currentY +=1;
                        positions[currentX][currentY] = true;
                    }
                }else if (direction.endsWith("E")){
                    for (int j = 0; j < distance; j++ ){
                        currentX +=1;
                        positions[currentX][currentY] = true;
                    }
                }else if (direction.endsWith("S")) {
                    for (int j = 0; j < distance; j++) {
                        currentY -= 1;
                        positions[currentX][currentY] = true;
                    }
                }else if (direction.endsWith("W")){
                    for (int j = 0; j < distance; j++ ){
                        currentX -=1;
                        positions[currentX][currentY] = true;
                    }
                }
            }

            int get_count = 0;
            for (int i = 0; i < 21; i++) {
                for (int j = 0; j < 21; j++) {
                    if (points[i][j] && positions[i][j]){
                        get_count +=1;
                    }
                }
            }

            if (get_count == n){
                System.out.println("Yes");
            }else{
                System.out.println("No");
            }
        }
    }
}


Measured memory_bytes: 47076
#include <iostream>
#include <string>
using namespace std;
int main(){
	string str;
	cin >> str;
	int count1=0;
	int count2=0;
	for(int i=0;i<str.size();i++){
		if(str[i]=='A'){
			count1=i;
			break;
		}
	}
	for(int i=str.size();i>=0;i--){
		if(str[i]=='Z'){
			count2=i;
			break;
		}
	}
	cout << count2-count1+1 <<endl;
	return 0;
}

Measured memory_bytes: 640
H = []
W = []

while True:
    h, w = map(int, input().split())
    if h == w and h == 0:
        break
    H.append(h)
    W.append(w)

for i in range(len(H)):
    for j in range(H[i]):
        if j % 2 != 0:
            if W[i] % 2 == 0:
                print('.#' * (W[i] // 2))
            else:
                print('.#' * (W[i] // 2) + '.')
        else:
            if W[i] % 2 == 0:
                print('#.' * (W[i] // 2))
            else:
                print('#.' * (W[i] // 2) + '#')
    print('')



Measured memory_bytes: 5628
def read_i
  gets.chomp.split(' ').map(&:to_i)
end

def from_zero(n)
  if n % 2 == 0
    (n / 2 % 2) ^ n
  else
    (((n + 1) / 2) % 2)
  end
end

def f(a, b)
  from_zero(a-1) ^ from_zero(b)
end

def naive(a, b)
  tmp = a
  ans = a
  loop do
    tmp += 1
    return ans if tmp > b
    ans = ans ^ tmp
  end
end

def check(a, b)
  a1 = naive(a, b)
  a2 = f(a, b)
  puts "#{a1 == a2 ? :ok : :ng}: naive(#{a}, #{b}) = #{a1} <-> f = #{a2}"
  if a1 != a2
    a.upto(b) do |n|
      puts "%4s" % n.to_s(2)
    end
    raise
  end
end

# 1.upto(10) do|a|
#   1.upto(10) do |d|
#     b = a + d
#     check(a, b)
#   end
# end

a, b = read_i
puts f(a, b)


Measured memory_bytes: 1788
#include "bits/stdc++.h"
 
using namespace std;

using ll = long long;
using ull = unsigned long long;
using ld = long double;

#define REP(i,n) for(int i=0; i<int(n); i++)
#define REREP(i,n) for(int i=int(n-1); i>=0; i--)
#define FOR(i,m,n) for(int i=int(m); i<int(n); i++)
#define REFOR(i,m,n) for(int i=int(n-1); i>=int(m); i--)
#define ALL(obj) (obj).begin(),(obj).end()
 
#define VI vector<int>
#define VVI vector<vector<int>>
#define VVVI vector<vector<vector<int>>>
#define VD vector<double>
#define VVD vector<vector<double>>
#define VVVD vector<vector<vector<double>>>
#define VL vector<ll>
#define VVL vector<vector<ll>>
#define VVVL vector<vector<vector<ll>>>
#define VB vector<bool>
#define VVB vector<vector<bool>>
#define VVVB vector<vector<vector<bool>>>
#define VS vector<string>
#define VVS vector<vector<string>>
#define VVVS vector<vector<vector<string>>>
 
#define PII pair<int,int>
#define PDD pair<double,double>
#define PLL pair<ll,ll>
#define VPII vector<pair<int,int>>
#define VVPII vector<vector<pair<int,int>>>
#define VVVPII vector<vector<vector<pair<int,int>>>>
#define VPLL vector<pair<ll,ll>>
#define VVPLL vector<vector<pair<ll,ll>>>
#define VVVPLL vector<vector<vector<pair<ll,ll>>>>
 
#define SUMI(obj) accumulate((obj).begin(), (obj).end(), 0)
#define SUMD(obj) accumulate((obj).begin(), (obj).end(), 0.)
#define SUML(obj) accumulate((obj).begin(), (obj).end(), 0LL)
#define SORT(obj) sort((obj).begin(), (obj).end()) // 1,2,3,4,5...
#define RESORT(obj) sort((obj).begin(), (obj).end(), greater<int>()) // 5,4,3,2,1...
#define UB(obj,n) upper_bound((obj).begin(), (obj).end(), n) //itr > n
#define LB(obj,n) lower_bound((obj).begin(), (obj).end(), n) //itr>= n

#define PB push_back
#define Cout(str) cout << str << endl

const ll MOD = (ll)1e9 + 7;
const ll HINF = (ll)1e18;
const ll LINF = (ll)1e9;
const ll EPS = (ll)1e-8;

int main(){
	int n,m;
	int a,b,c,d;
	int sum;
	string str;
	string s,t;
	char ch;
	VI vi;
	vector<char> vc;
	VS vs;
	int reserve_vi = 100;
	map<int, int> table; 
	string str2, str3;
	map<char, string> vowel;
	vector<char> vowel_vec = {'a', 'e', 'i', 'o', 'u'};

	//cin >> n >> m;
	//cin >> a >> b;
	//cin >> a >> b >> c;
	cin >> a >> b >> c >> d;
	//cin >> str;
	//cin >> str >> str2 >> str3;
	//cin >> n;
	
	//cin >> s >> t;
	//cin >> ch;
	//cin >> a >> ch >> b;
	

	if(a*b > c*d) cout << a*b << endl;
	else cout << c*d << endl;

	//cout << accumulate(vi.begin(), vi.begin()+n, 0) << endl;
	//replace(ALL(str), ',', ' ');

	//swap(a, b);
	//vi.resize(N);
	//fill(vi.begin(), vi.end(), 1);
	//vi.reserve(reserve_vi);
	//vi.PB(n);

	//vc.resize(5);
	//vc[i] = (str[i]);

	//sort(vc.begin(), vc.end(), greater<char>());
	//sort(vc.begin(), vc.end());

	//for(auto itr = table.begin(); itr != table.end(); ++itr) {
	return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
#define bug(x) cout << #x << " = " << x << endl
#define fr(x) freopen(x,"r",stdin)
#define fw(x) freopen(x,"w",stdout)
#define all(x) x.begin(),x.end()
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define reset(x) memset(x,0,sizeof(x))
#define up(i,l,r) for(int i=l;i<=r;i++)
#define down(i,r,l) for(int i=r;i>=l;i--)
using namespace std;
typedef long long int ll;
int n,k,x,Ti=0;
int main(){
	ios_base::sync_with_stdio(0);
	cin>>n>>k;
	up(i,1,n){
        cin>>x;
        Ti+=min(x*2,2*abs(k-x));
	}
	cout<<Ti<<endl;
	return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#include<iomanip>
#include<utility>
#include<map> 
#define rep(i,n) for(int i=0; i<(n); ++i)
using namespace std;
using ll =long long;
using P = pair<int,int>;

int main(){
    int n;
    cin >> n;
    vector<int> p(n),q(n);
    rep(i,n) cin >> p[i];
    rep(i,n) cin >> q[i];
    vector<int> a(n);
    rep(i,n) a[i] = i+1;

    map<vector<int>, int> mp;
    do{
        mp[a] = mp.size();
    }while(next_permutation(a.begin(), a.end()));

    int ans = abs(mp[p]-mp[q]);
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 5248
using System;
using static System.Console;
using System.Collections.Generic;
using System.Linq;
 
namespace Atcoder
{
    class Program
    {
        static void Main(string[] args)
        {
            var a = InputNumList();
            
            WriteLine(a.Sum() - a.Max());
        }
 
        static int InputNum()
        {
            return int.Parse(ReadLine());
        }
        static List<int> InputNumList()
        {
            return ReadLine().Split(' ').Select(int.Parse).ToList();
        }
    }
}

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

int main() {
  int a, b;
  cin >> a >> b;
  
  if ((a + b) % 2 == 0)
    cout << (a + b) / 2 << endl;
  else
    cout << (a + b) / 2 + 1 << endl;
}

Measured memory_bytes: 256
/**
*    author:  souzai32
*    created: 15.08.2020 21:05:28
**/

#include <bits/stdc++.h>
#define all(x) (x).begin(),(x).end()
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using ll = long long;
typedef long long ll;
using namespace std;

int main() {

    int n;
    cin >> n;
    vector<int> l(n);
    rep(i,n) cin >> l.at(i);
    sort(all(l));
    int ans=0;

    for(int i=0; i<n-2; i++){
        for(int j=i+1; j<n-1; j++){
            if(l.at(i)==l.at(j)) continue;
            for(int k=j+1; k<n; k++){
                if(l.at(j)==l.at(k)) continue;
                if(l.at(i)+l.at(j)>l.at(k)) ans++;
            }
        }
    }
    cout << ans << endl;

    return 0;
}

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

using namespace std;
typedef long long int lld;

vector<pair<int,int> > v,v2;
string a;
int rr = 0,pl = 0,mi = 0;
bool tmr(pair<int,int> a,pair<int,int> b){
	if(a.second!=b.second) return a.second>b.second;
	return a.first > b.first;
}
bool tmr2(pair<int,int> a,pair<int,int> b){
	if(a.second!=b.second) return a.second < b.second;
	return a.first > b.first;
}
int main(void){
	int n;
	scanf("%d",&n);
	for(int e=0;e<n;e++){
		cin >> a;
		int vv = 0, vv2 = 1e9;
		for(int p=0;p<(int)a.size();p++){
			if(a[p]=='(') vv++;
			else vv--;
			vv2 = min(vv2,vv);
		}
		rr += vv;
		if(vv2==0&&vv==0) continue;
		if(vv2>0&&vv>0) pl += vv;
		else if(vv>0&&vv2<0) v.push_back(make_pair(vv,vv2));
		else if(vv!=vv2) v2.push_back(make_pair(vv,vv2));
	}
	if(rr!=0) printf("No");
	else{
		sort(v.begin(),v.end(),tmr);
		for(int p=0;p<v.size();p++){
			if(pl<-v[p].second){
				printf("No");
				return 0;
			}
			pl += v[p].first;
		}
		sort(v2.begin(),v2.end(),tmr2);
		for(int p=0;p<v2.size();p++){
			if(pl<-v2[p].second){
				printf("No");
				return 0;
			}
			pl += v2[p].first;
		}
		printf("Yes");
	}
	return 0;
}


Measured memory_bytes: 5412
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = s; i < (int)(n); i++)
#define chmax(a, b) a = max(a, b)
#define chmin(a, b) a = min(a, b)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()

using namespace std;
using ll = long long;
using pii = pair<int, int>;

//const ll INF = 1e18L + 5;
//const int INF = 1e9 + 5;
//const double pi = 3.14159265358979323846;

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

	string s;
	getline(cin, s);
	for (char c : s) {
		if (isupper(c))
			cout << (char)tolower(c);
		else if (islower(c))
			cout << (char)toupper(c);
		else
			cout << c;
	}
	cout << endl;
}


Measured memory_bytes: 3252
n,k = map(int,input().split())
ans = 0

if k == 0:
    print(n**2)
    exit()

for b in range(k+1, n+1):
    x = n // b
    y = n % b
    ans += (b - k) * x + max(0, y - k + 1)

print(ans)


Measured memory_bytes: 2940
import sys
N, K = map(int, input().split())
if N == 0 or K == 1 or N == K:
    print(0)
    sys.exit()

if N > K:
    N = N%K
# elif N < K:
#     print(N)
#     sys.exit()

ans = [N]
for _ in range(100):
    ans.append(abs(N-K))
    N = abs(N-K)

print(min(ans))


Measured memory_bytes: 3060
from collections import defaultdict


def main():
    n = int(input())
    fact = defaultdict(int)
    for i in range(2, n + 1):
        j = i
        while j % 2 == 0:
            j //= 2
            fact[2] += 1
        k = 3
        while k * k <= j:
            if j % k:
                k += 2
            else:
                j //= k
                fact[k] += 1
        if j != 1:
            fact[j] += 1
    fact = list(fact.items())
    length = len(fact)
    ans = 0
    for i in range(length):
        if fact[i][1] >= 74:
            ans += 1
    product = set()
    for small_p, large_p in [[2, 24], [4, 14]]:
        for i in range(length):
            for j in range(length):
                if i == j:
                    continue
                now = pow(fact[i][0], large_p) * pow(fact[j][0], small_p)
                if fact[i][1] >= large_p and fact[j][1] >= small_p and now not in product:
                    ans += 1
                    product.add(now)
    for i in range(length):
        for j in range(length):
            for k in range(length):
                if i == j or j == k or i == k:
                    continue
                now = pow(fact[i][0], 4) * pow(fact[j][0], 4) * pow(fact[k][0], 2)
                if fact[i][1] >= 4 and fact[j][1] >= 4 and fact[k][1] >= 2 and now not in product:
                    ans += 1
                    product.add(now)
    print(ans)


if __name__ == '__main__':
    main()


Measured memory_bytes: 9472
#include <bits/stdc++.h>
using namespace std;
     
int main() {
  int N;
  cin >> N;
  vector<int> v(N);
  vector<int> u(N);
  for(int i = 0; i < N; i++){
    cin >> v.at(i);
  }
  
  for(int i = 0; i < N; i++){
    u.at(i) = v.at(i);
  }
  
  sort(u.begin(), u.end());
  int i = 0;
  
  while(i < u.size() - 1){
    if(u.at(i) == u.at(i + 1)){
      u.erase(u.begin() + i);
    }
    else{
      i++;
    }
  }
  
  int a = v.size() - u.size();
  
  if(a % 2 == 0){
    cout << u.size() << endl;
    return 0;
  }
  
  cout << u.size() - 1 << endl;
  
}

Measured memory_bytes: 1024
import sys
import numpy as np
input = sys.stdin.readline
n = int(input())
G = np.array([list(map(int, input().split())) for _ in range(n)], dtype=float)
G2 = G
for i in range(n):
    G2[i,i] = np.inf
use = np.ones((n,n),dtype=bool)
impossible = np.zeros((n,n),dtype=bool)
for w in range(n):
    D = sum(np.meshgrid(G2[w], G2[w]))
    use &= ~(G == D)
    impossible |= G > D
if impossible.sum() > n:
    print(-1)
else:
    print(int(np.sum(G[use]) / 2))

Measured memory_bytes: 17776
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <cmath>
#include <algorithm>
#include <functional>
#include <stack>
#include <numeric>
typedef long long ll;
using namespace std;
const int MOD = (int)1e9 + 7;
const ll INF = (ll)1e18 + 7;
#define int long long

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

	string S, T;
	cin >> S >> T;

	for (int i = S.size() -T.size(); i >= 0; i--)
	{
		bool flg = true;
		for (int j = 0; j < T.size(); j++)
		{
			if (S[i+j] == '?')continue;
			if (S[i+j] != T[j])flg = false;
		}
		if (flg) {
			for (int j = 0; j < T.size(); j++)
			{
				S[i + j] = T[j];
			}
			goto Last;
		}
	}

	cout << "UNRESTORABLE" << endl;
	return 0;

Last:
	for (int i = 0; i < S.size(); i++)
	{
		if (S[i] == '?')S[i] = 'a';
	}

	cout << S << endl;

	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <fstream>
#include <cmath>  
#include <cstdlib>
#include <ctime>
#include <algorithm>
#include <numeric>
#include <functional>
#include <string> 
#include <vector>
#include <bitset>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <deque>

using namespace std;
using ll = long long;

#define REP(i,n) for(long long i = 0; i < (n); i++)
#define FOR(i, m, n) for(long long i = (m);i < (n); ++i)
#define ALL(obj) (obj).begin(),(obj).end()

template<class T> using V = vector<T>;
template<class T, class U> using P = pair<T, U>;

const ll MOD = (ll)1e9 + 7;
const ll MOD2 = 998244353;
const ll LLINF = (ll)1e18;
const ll INTINF = (ll)1e9;
const long double PI = 3.1415926535897932384626433;

template <class T> void corner(bool flg, T hoge) {if (flg) {cout << hoge << endl; exit(0);}}
template <class T, class U>ostream &operator<<(ostream &o, const map<T, U>&obj) {o << "{"; for (auto &x : obj) o << " {" << x.first << " : " << x.second << "}" << ","; o << " }"; return o;}
template <class T>ostream &operator<<(ostream &o, const set<T>&obj) {o << "{"; for (auto itr = obj.begin(); itr != obj.end(); ++itr) o << (itr != obj.begin() ? ", " : "") << *itr; o << "}"; return o;}
template <class T>ostream &operator<<(ostream &o, const vector<T>&obj) {o << "{"; for (int i = 0; i < (int)obj.size(); ++i)o << (i > 0 ? ", " : "") << obj[i]; o << "}"; return o;}
template <class T, class U>ostream &operator<<(ostream &o, const pair<T, U>&obj) {o << "{" << obj.first << ", " << obj.second << "}"; return o;}
template <template <class tmp>  class T, class U> ostream &operator<<(ostream &o, const T<U> &obj) {o << "{"; for (auto itr = obj.begin(); itr != obj.end(); ++itr)o << (itr != obj.begin() ? ", " : "") << *itr; o << "}"; return o;}
void print(void) {cout << endl;}
template <class Head> void print(Head&& head) {cout << head;print();}
template <class Head, class... Tail> void print(Head&& head, Tail&&... tail) {cout << head << " ";print(forward<Tail>(tail)...);}
template <class T> void chmax(T& a, const T b){a=max<T>(a,b);}
template <class T> void chmin(T& a, const T b){a=min<T>(a,b);}
void YN(bool flg) {cout << ((flg) ? "YES" : "NO") << endl;}
void Yn(bool flg) {cout << ((flg) ? "Yes" : "No") << endl;}
void yn(bool flg) {cout << ((flg) ? "yes" : "no") << endl;}

int main() {
	int N,M; cin >>N >> M;
	V<int> node(N,0);
	V<V<int>> edge(N);
	REP(i,M){
		int a,b; cin >> a >> b;
		a--,b--;
		edge[a].push_back(b);
		edge[b].push_back(a);
	}
	int l = 0,r = edge[l][0];
	node[l] = node[r] = 1;
	deque<int> dq;
	dq.push_back(l);
	dq.push_back(r);
	
	while(1){
		int flg = 0;
		for(auto e:edge[l]){
			if(node[e]) continue;
			else{
				node[e] = 1;
				l = e;
				dq.push_front(l);
				flg = 1;
				break;
			}
		}
		if(flg) continue;
		break;
	}
	while(1){
		int flg = 0;
		for(auto e:edge[r]){
			if(node[e]) continue;
			else{
				node[e] = 1;
				r = e;
				dq.push_back(r);
				flg = 1;
				break;
			}
		}
		if(flg) continue;
		break;
	}
	cout << dq.size() << endl;
	for(auto e:dq) cout << e+1 << " ";
	cout << endl;
	return 0;
}


Measured memory_bytes: 7040
def gets; ARGF.gets; end

def main
  n, m, q = gets.split.map(&:to_i)

  # 区間を2次元座標上にマッピングする
  # range_map[L][R]
  # ※l,r は1以上なので 0行/0列 は全て0のまま
  range_map = Array.new(n+1) {Array.new(n+1, 0)}
  m.times do
    l, r = gets.split.map(&:to_i)
    range_map[l][r] += 1
  end

  # 2次元累積和を求める
  1.upto(n) do |l|
    row_sum = 0
    1.upto(n) do |r|
      row_sum += range_map[l][r]
      range_map[l][r] = range_map[l-1][r] + row_sum
    end
  end
  # pp range_map

  # 問題解決
  q.times do
    p, q = gets.split.map(&:to_i)
    ans = range_map[q][q] - range_map[p-1][q] - range_map[q][p-1] + range_map[p-1][p-1]
    puts ans
  end
end

if __FILE__ == $0
  main
end


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

int main(){
	int n;
  	cin>>n;
  	int a[1000];
  	for(int i=1;i<=n;i++){
    	cin>>a[i];
      	if(a[i]%2==0){
        	if(a[i]%3!=0){
              	if(a[i]%5!=0){
                	cout<<"DENIED";
                  	return 0;
                }
            }
        }
    }
  	cout<<"APPROVED";
  	return 0;
}

Measured memory_bytes: 256
#125_D
N=int(input())
A=list(map(int,input().split()))
abs_A=[abs(a) for a in A]
sum_abs_A=sum(abs_A)

neg=0
for i in range(N):
    if A[i]<0:
        neg+=1

print(sum_abs_A if neg%2==0 else sum_abs_A-2*min(abs_A))

Measured memory_bytes: 14212
#include <bits/stdc++.h>
 
using namespace std;
typedef long long ll;
 
int main() {
  ios::sync_with_stdio(0); 
  cin.tie(0); 

  int n, k;
  cin >> n >> k;

  int res = 1;
  for (int i = 0; i < n; ++i) {
    if (res * 2 < res + k) res *= 2;
    else res += k;
  }
  cout << res << "\n";
}


Measured memory_bytes: 3636
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		int[] f = new int[26];
		for(int i = 0; i < 26; i++) {
			f[i] = 0;
		}
		
		for(int i = 0; i < s.length(); i++) {
			f[s.charAt(i) - 'a']++;
		}
		
		for(int i = 0; i < 26; i++) {
			if(f[i] != 0 && f[i] !=1) {
				System.out.println("no");
				System.exit(0);
			}
		}
		System.out.println("yes");
	}

}


Measured memory_bytes: 21716
// Problem : D - Replacing
// Contest : AtCoder - AtCoder Beginner Contest 171
// URL : https://atcoder.jp/contests/abc171/tasks/abc171_d
// Memory Limit : 1024 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define endl '\n'
#define pb push_back
#define mod 1000000007
ll power(ll x, ll y) 
{ 
    if (y == 0) 
        return 1; 
    ll p = power(x, y/2) % mod; 
    p = (p * p) % mod; 
  
    return (y%2 == 0)? p : (x * p) % mod; 
} 
ll factorial[1000007];
ll fact(ll n)
{
    memset(factorial,0,sizeof(factorial));
    factorial[0]=1;
factorial[1]=1;

    for(int i=1;i<n;i++)
    {
        factorial[i]=(factorial[i-1]*i)%mod;
    }
    
}
ll ncr(ll n,ll r)
{
    ll ans=1;
    ll i;
    ans=factorial[n];
    ll ans1=power(factorial[n-r],mod-2);
    ll ans2=power(factorial[r],mod-2);
    ans=((ans*ans1)%mod*ans2)%mod;
    return ans;
}
ll gcd(ll a, ll b) 
{ 
    if (b == 0) 
        return a; 
    return gcd(b, a % b);  
      
} 

bool prime[100000006];
void sieve(ll n){
    memset(prime,true,sizeof(prime));
	prime[1]=false; 
    for (ll p=2;p*p<=n;p++){
        if (prime[p]){  
            for (ll i=p*p;i<=n;i+=p)
                prime[i]=false;
        }
    }
}
void bfs(vector<int> v[],int o,int n,int dp[]){
	queue<int> q;
	q.push(o);
	dp[o]=0;
	bool visited[n+1]={0};
	visited[o]=true;
	while(q.empty()==false){
		int a=q.front();
		q.pop();
		for(int i=0;i<v[a].size();i++){
			if(visited[v[a][i]]==false){
				visited[v[a][i]]=true;
				q.push(v[a][i]);
				dp[v[a][i]]=dp[a]+1;
			}
		}
	}
}
int nov[1000001];
bool visited[1000001];
int dp[1000001];
int dfs(vector<int> v[],int o)
{
    if(visited[o]==0)
    {
        visited[o]=1;
        for(int i=0;i<v[o].size();i++)
        {
            if(visited[v[o][i]]==0)
            {
            dp[v[o][i]]=dp[o]+1;
            nov[o]+=dfs(v,v[o][i]);
            }
        }
        return nov[o]+1;
    }
    else
    return 0;
}
// string s=bitset<64>(n).to_string();
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
	ll n;
	cin>>n;
	ll a[n];
	map<ll,ll> mp;
	ll sum=0;
	for(int i=0;i<n;i++)
	{
		cin>>a[i];
		mp[a[i]]++;
		sum+=a[i];
	}
	ll q;
	cin>>q;
	while(q--)
	{
		ll x,y;
		cin>>x>>y;
		sum=sum-mp[x]*x;
		if(mp.find(y)==mp.end())
		mp[y]=mp[x];
		else
		mp[y]+=mp[x];
		sum+=mp[x]*y;
		mp.erase(mp.find(x));
		cout<<sum<<endl;
	}
	return 0;
}


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

int D;
const int M = 26;
vector<int> C;
vector<vector<int>> S;
vector<int> T;

const int INF = 1<<30;

template<class T> inline bool chmax(T &a, T b)
{
    if(a < b)
    {
        a = b;
        return true;
    }
    return false;
}

std::mt19937 mt{ std::random_device{}() };

int randint(int lower, int upper)
{
    std::uniform_int_distribution<int> dist(lower, upper);
    return dist(mt);
}

int calc_score(int N=D)
{
    assert(N <= D);
    int ans = 0;
    vector<int> last(M, -1);
    for(int i=0; i<N; i++)
    {
        if(T[i] != -1)
        {
            ans += S[i][T[i]];
            last[T[i]] = i;
        }
        for(int j=0; j<M; j++)
        {
            ans -= C[j] * (i - last[j]);
        }
    }
    return ans;
}

int main()
{
    auto stime = clock();
    ios::sync_with_stdio(false);
    cin.tie(0);
    cin >> D;
    C.resize(M);
    for(int i=0; i<M; i++) cin >> C[i];
    S.resize(D);
    for(int i=0; i<D; i++)
    {
        S[i].resize(M);
        for(int j=0; j<M; j++)
        {
            cin >> S[i][j];
        }
    }

    int fscore = -INF;
    T.resize(D);
    for(int i=0; i<D; i++)
    {
        T[i] = randint(0, M-1);
    }

    while(1. * (clock() - stime) / CLOCKS_PER_SEC < 1.95)
    {
        int d1 = randint(0, D-1);
        int temp1 = T[d1];
        T[d1] = randint(0, M-1);

        int d2 = randint(0, D-1);
        int d3 = d2 + randint(-16, 16);
        if(d3 < 0) d3 = 0;
        if(d3 >= D) d3 = D-1;
        swap(T[d2], T[d3]);

        if(chmax(fscore, calc_score())) continue;
        swap(T[d2], T[d3]);
        T[d1] = temp1;
    }
    for(int i=0; i<D; i++)
    {
        cout << T[i] + 1 << '\n';
    }
    return 0;
}


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

using namespace std;

int n;
long long MOD = 1e9+7;
typedef vector<vector<long long> > vll;
vll mult(vll a, vll b) {
  vll ret(n, vector<long long>(n, 0));
  for(int i = 0; i<n; ++i) {
    for(int j = 0; j<n; ++j) {
      for(int k = 0; k<n; ++k) {
        ret[i][j] = (ret[i][j] + a[i][k] * b[k][j]) % MOD;
      }
    }
  }
  return ret;
}

int main() {
  // R: I know that you can just take the adjacency matrix
  // and raise it to the power K to get a matrix with the
  // number of paths from i to j, so the answer would be
  // the sum of all of the elements of A^K
  //
  // which means some fun matrix exponentiation, I guess...
  // it's like N^3 per square, and there's <100 squares involved
  // so it should totally fit in time
  // just pretty gross to code...

  cin.tie(0);
  cin.sync_with_stdio(0);
  cin >> n;
  long long k; cin >> k;
  vector<vector<long long> > a(n, vector<long long>(n)), r(n, vector<long long>(n));
  for(int i = 0; i<n; ++i) {
    for(int j = 0; j<n; ++j) {
      cin >> a[i][j];
      r[i][j] = 0;
    }
    r[i][i] = 1;
  }

  while(k) {
    if(k % 2) {
      r = mult(a, r);
    }
    a = mult(a, a);
    k /= 2;
  }
  long long ret = 0;
  for(int i = 0; i<n; ++i) {
    for(int j = 0; j<n; ++j) {
      ret = (ret + r[i][j]) % MOD;
    }
  }
  cout << ret << endl;
}


Measured memory_bytes: 384
function Main(input) {
  const N = input.trim()
  const Narray = N.split('').map(Number)

  const tmp = Narray.reduce((acc,value) => acc + value);
  tmp % 9 === 0 ? console.log("Yes") : console.log('No')
  }

  Main(require("fs").readFileSync("/dev/stdin", "utf8"));

Measured memory_bytes: 35296
#include<stdio.h>
int main(void)
{
	int a, b;
	int i, j, k;
	int ans;
	while (1) {
		scanf("%d %d", &a, &b);
		if (a == 0 && b == 0) {
			break;
		}
		ans = 0;
		for (i = 1; i < a - 1; i++) {
			for (j = i + 1; j < a; j++) {
				for (k = j + 1; k < a + 1; k++) {
					if (i + j + k == b) ans++;
				}
			}
		}
		printf("%d\n", ans);
	}

	return(0);
}


Measured memory_bytes: 2068
#include<stdio.h>

int main(){
  int i,w,n,a,b,y,x[30];


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

  for(i=0;i<w;i++){
    printf("%d\n",x[i]);
}
return 0;
}

Measured memory_bytes: 0
parseInt(x)=parse(Int,x)
parseMap(x::Array{SubString{String},1})=map(parseInt,x)


function root(uf::Array{Int,1},x)
	s=x
	while uf[s]>0
		s=uf[s]
	end
	s
end
function same(uf::Array{Int,1},x,y)
	root(uf,x)==root(uf,y)?true:false
end
function unite(uf::Array{Int,1},x,y)
	l = root(uf,x)
	r = root(uf,y)
	if l < r
		uf[l] += uf[r]
		uf[r] = l
	else
		uf[r] += uf[l]
		uf[l] = r
	end
end


function main()
	n,m = readline() |> split |> parseMap
	e = Array{Int}(2,m)
	total = binomial(n,2)
	for i in 1:m
		e[:,i] = readline() |> split |> parseMap
	end
	uf = Int[-1 for i in 1:n]
	ans = Array{Int}(m)
	ans[m] = total
	for i in 1:m-1
		if !same(uf,e[1,m-i+1],e[2,m-i+1])
			s = -uf[root(uf,e[1,m-i+1])]
			t = -uf[root(uf,e[2,m-i+1])]
			unite(uf,e[1,m-i+1],e[2,m-i+1])
			ans[m-i] = ans[m-i+1]-s*t
		else
			ans[m-i] = ans[m-i+1]
		end
	end
	for i in 1:m
		println(ans[i])
	end
end
main()

Measured memory_bytes: 157632