akhauriyash/Code-Regression huggingface dataset:
#include<stdio.h>
#define MAX 20000
#define INFTY 100000000

int n, box[MAX][MAX];

void dij() {
	int i, j,minv, u, v, sum;
	int d[MAX], p[MAX], t[MAX];
	
	for ( i = 0; i < n; i++ ) {
		d[i] = INFTY;
		t[i] = 0;
	}
	
	d[0] = 0;
	
	while(1){
		minv = INFTY;
		u = -1;
		for ( i = 0; i < n; i++ ){
			if ( minv > d[i] && !t[i] ){
				u = i;
				minv = d[i];
			}
		}
		
		if ( u == -1 ) break;
		t[u] = 1;
			for ( v = 0; v < n; v++ ){
			if ( !t[v] && box[u][v] != INFTY ){
				if ( d[v] > d[u] + box[u][v] ){
					d[v] = d[u] + box[u][v];
				}
			}
		}	
	}
	
	for ( i = 0; i < n; i++ ) {
	printf("%d %d\n", i, (d[i] == INFTY? -1: d[i]));
	}
}

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


	scanf("%d", &n);
	for ( i = 0; i< n; i++ ){
		for ( j = 0; j < n; j++ ){
			box[i][j] = INFTY;
		}
	}

	for ( i = 0; i < n; i++ ){
		scanf("%d %d", &a, &b);
		for ( j = 0; j < b; j++ ){
			scanf("%d %d", &c, &d);
			box[a][c] = d;
		}
	}
	
	dij();
	
	return 0;
}



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

using namespace std;

#define rep(i, n) for (ll i = 0; i < (n); ++i)
#define fin(ans) cout << (ans) << endl;
#define blank(ans) cout << (ans) << " ";
#define mp(p, q) make_pair(p, q)
#define pb(n) push_back(n)
#define all(a) a.begin(), a.end()

typedef long long ll;
typedef long long lli;
typedef unsigned long long ull;
typedef long double ld;
typedef string str;

typedef vector<char> vc;
typedef vector<bool> vb;
typedef vector<ld> vd;
typedef vector<str> vs;
typedef vector<ll> vll;
typedef vector<pair<ll, ll>> vpll;
typedef vector<pair<ll, str>> vpls;
typedef vector<tuple<str, ll, ll>> vtsl;
typedef vector<vector<ll>> vvll;
typedef vector<vector<char>> vvc;
typedef vector<vector<str>> vvs;

const ld PI = acos(-1.0);
const ll MAX = 9000000000000000000;
const ll MIN = -9000000000000000000;
const ld DMAX = 4500;
const ld DMIN = -4500;
const ll MOD = 1000000007;

//実行部
void Main()
{
  ll x, a, b; cin >> x >> a >> b;
  fin(min(b, x * a))
}

//前処理
int main()
{
  //ios::sync_with_stdio(false);
  //cin.tie(0);
  cout << fixed << setprecision(20); //高精度少数表示
  Main();
  return 0;
}


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

int main()
{
	int n;
	cin >> n;
	long long aRuiseki[n];
	cin >> aRuiseki[0];
	for(int i = 1; i < n; i++){
		int tmp;
		cin >> tmp;
		aRuiseki[i] = tmp + aRuiseki[i-1];
	}

	long long ans = llabs(aRuiseki[n-1] - aRuiseki[0] * 2);
	for(int i = 1; i <= n-2; i++){
		long long difference = llabs(aRuiseki[n-1] - aRuiseki[i] * 2);
		ans = min(ans, difference);
	}

	cout << ans << "\n";

	return 0;
}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
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;
}

#ifdef DEBUG
void debug() { cerr << "\n"; }
template <class T> void debug(const T &x) { cerr << x << "\n"; }
template <class T, class... Args> void debug(const T &x, const Args &... args) {
    cerr << x << " ";
    debug(args...);
}
template <class T> void debugVector(const vector<T> &v) {
    for(const T &x : v) {
        cerr << x << " ";
    }
    cerr << "\n";
}
#else
template <class T, class... Args>
void debug(const T &x, const Args &... args) {}
template <class T> void debugVector(const vector<T> &v) {}
#endif

using ll = long long;
#define ALL(v) (v).begin(), (v).end()
#define RALL(v) (v).rbegin(), (v).rend()
const double EPS = 1e-7;
const int INF = 1 << 30;
const ll LLINF = 1LL << 60;
constexpr int MOD = 1000000007;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

//-------------------------------------

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    string s, t;
    cin >> s >> t;
    int ans = INF;
    int sn = s.size();
    int tn = t.size();
    for(int i = 0; i < sn - tn + 1; i++) {
        string tmp = s.substr(i, tn);
        int cnt = 0;
        for(int j = 0; j < tn; j++) {
            if(tmp[j] != t[j]) {
                cnt++;
            }
        }
        chmin(ans, cnt);
    }
    cout << ans << endl;
}

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

int main() {
  int A[5];

  for (int i = 0; i < 5; i++) cin >> A[i];

  int ans = 0;
  int offset = 10;
  for (int i = 0; i < 5; i++) {
    int a = A[i] % 10;
    if (a == 0) {
      ans += A[i];
    } else {
      ans += A[i] + (10 - a);
      offset = min(offset, a);
    }
  }

  if (offset != 10) ans += -10 + offset;

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 256
#include <ctype.h>
#include <float.h>
#include <inttypes.h>
#include <limits.h>
#include <signal.h>
#include <stdarg.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <unistd.h>
#include <math.h>
#ifdef __cplusplus
#include <bits/stdc++.h>
#endif
#pragma GCC target("avx2")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")

//char rbuf[]; int rbufl;
//#define getchar() rbuf[rbufl++]
#define getchar getchar_unlocked
#define putchar putchar_unlocked
int32_t nextint(void){ char c=getchar(); while(c!='-'&&(c<'0'||'9'<c)) c=getchar(); bool s=false; if(c=='-'){s=true;c=getchar();} uint32_t x=0; while('0'<=c && c<='9'){ x=x*10+c-'0'; c=getchar(); } return s?-x:x; }
int64_t nextlong(void){ char c=getchar(); while(c!='-'&&(c<'0'||'9'<c)) c=getchar(); int s=0; if(c=='-'){s=1;c=getchar();} uint64_t x=0; while('0'<=c && c<='9'){ x=x*10+c-'0'; c=getchar(); } return s?-x:x; }
uint32_t nextstr(char *s){ char c=getchar(); while(c==' '||c=='\n') c=getchar(); uint32_t len=0; while(c!=' '&&c!='\n'){ *s++=c; len++; c=getchar(); } *s='\0'; return len; }
void printint(int32_t x){ if(x<0){x=-x; putchar('-');}else if(x==0){putchar('0');} int d=0; char s[10]; while(x){ s[d]='0'+x%10; x/=10; d++; } for (int i=d-1; i>=0; i--) putchar(s[i]); putchar('\n'); }
void rsorta_d32(void *base, const int count, const int size, const int index){
	typedef int32_t rsort_t;
	rsort_t (*a)[size] = (rsort_t(*)[size])base;
	rsort_t (*b)[size] = (rsort_t(*)[size])malloc(count*size*sizeof(rsort_t));
	int c[0x100];
	for(int k=0; k<4; k++){
		memset(c, 0, sizeof(c)); for(int i=0; i<count; i++){ c[(a[i][index]>>(k<<3))&0xFF]++; } for(int i=1; i<0x100; i++) c[i]+=c[i-1]; for(int i=count-1; i>=0; i--){ int to=--c[(a[i][index]>>(k<<3))&0xFF]; for(int j=0; j<size; j++){ b[to][j]=a[i][j]; } }{rsort_t(*t)[size]=a; a=b; b=t;}
	}
	free(b);
}

inline int min(const int a, const int b){return a>b?b:a;}

int da[2][524288];
int m=262144;

void init(void){
	for(int i=0; i<524288; i++){
		da[0][i]=da[1][i]=INT_MAX;
	}
}

void update(int P, int k, int x){
	k+=m-1;
	da[P][k]=min(da[P][k], x);
	while(k>0){
		k=(k-1)/2;
		da[P][k]=min(da[P][k*2+1], da[P][k*2+2]);
	}
}

// q(a, b, 0, 0, m)
// [a, b)
int query(int P, int a, int b, int k, int l, int r){
	if(r<=a || b<=l) return INT_MAX;
	if(a<=l && r<=b) return da[P][k];
	int m=(l+r)/2;
	int vl = query(P, a, b, k*2+1, l, m);
	int vr = query(P, a, b, k*2+2, m, r);
	return min(vl, vr);
}

inline int q(int P, int l, int r){
	return query(P, l, r, 0, 0, m);
}

int main(void){
	init();
	int n=nextint();
	int p=nextint();
	update(0, n, n);
	update(1, n, n);
	long ans=(long)(n-2)*(n-2);
	while(p-->0){
		int Q=nextint()-1;
		int x=nextint();
		if(Q==0){
			int now = q(0, x, n+1);
			if(now>2) ans-=now-2;
			update(1, now, x);
		}else{
			int now = q(1, x, n+1);
			if(now>2) ans-=now-2;
			update(0, now, x);
		}
	}
	printf("%ld\n", ans);
}


Measured memory_bytes: 5708
meal = [int(input()) for i in range(5)]
mod = [meal[i]%10 for i in range(5)]
time = 0
if max(mod) == 0:
  for i in range(5):
    time += meal[i]
  print(time)
else:
  min = 0
  for i in range(5):
    if mod[i] != 0:
      time += meal[i] + (10-mod[i])
      if min < 10 - mod[i]:
        min = 10-mod[i]
    else:
      time += meal[i]
  print(time - min)

Measured memory_bytes: 3064
N = int(input())

s = []
t = []
i = 1
while len(s) < N :
    if i in t or any(i + s_ in t for s_ in s) :
        i += 1
        continue
    
    t.append(i)
    for s_ in s :
        t.append(i+s_)
    
    s.append(i)
    i += 1

w = [[0] * 10 for _ in range(10)]
w[0][1] = w[1][0] = 1

M = 1
for n in range(3, N + 1) :
    M += 1
    for i in range(n-1) :
        w[i][n-1] = w[n-1][i] = M * s[i]
        
    M += w[n-1][n-2] + w[n-1][n-3] - w[n-2][n-3] - 1
    
for i in range(N) :
    print(' '.join([str(j) for j in w[i][:N]]))

Measured memory_bytes: 38256
X,K,D=map(int,input().split())
m=min(abs(X)%D, abs(abs(X)%D-D))
f=-1 if abs(X)%D-D<0 else 1

if abs(X)-D*K>m:
    print(abs(X)-D*K)
elif (K-(abs(X)-m*f)//D)%2==0:
    print(m)
else:
    print(abs(min(m+D,m-D)))

Measured memory_bytes: 9212
n=int(input())
a=list(map(int,input().split()))
num=[0,0,0]
for i in range(n):
    if a[i]%4==0:
        num[2]+=1
    elif a[i]%2==0:
        num[1]+=1
    else:
        num[0]+=1
if num[1]==0:
    if num[0]>num[2]+1:
        print("No")
    else:
        print("Yes")
elif num[0]>num[2]:
    print("No")
else:
    print("Yes")


Measured memory_bytes: 20080
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int a = Integer.parseInt(sc.next());
        int b = Integer.parseInt(sc.next());
        int c = Integer.parseInt(sc.next());
        int x = Integer.parseInt(sc.next());
        int count = 0;
        for(int i = 0; i <= a; i++) {
            if(500 * i > x) {
                break;
            }
            for(int j = 0; j <= b; j++) {
                if(500 * i + 100 * j > x) {
                    break;
                }
                for(int k = 0; k <= c; k++) {
                    if(500 * i + 100 * j + 50 * k > x) {
                        break;
                    }
                    int sum = 500 * i + 100 * j + 50 * k;
                    if(sum == x) {
                        count++;
                    }
                }
            }
        }
        System.out.println(count);
    }
}

Measured memory_bytes: 21972
/*
 * main.c
 *
 *  Created on: 2019/02/21
 *      Author: family
 */


#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>

typedef struct {
	long long int x;
	long long int y;
	long long int h;
} info_t;

info_t data[100] = {0};

long long int max(long long int a, long long int b)
{
	if (a > b) {
		return a;
	} else {
	}
	return b;
}

void get_center_pos(long long int* cx, long long int *cy, int n, int ref)
{
	long long int i = 0;
	long long int j = 0;
	long long int h1 = 0;
	long long int h2 = 0;
    int k = 0;
	for( i = 0; i <= 100; i++) {
		for( j = 0; j <= 100; j++) {
			h1 = data[ref].h + abs(data[ref].x - i) + abs(data[ref].y - j);
			for( k = 0; k < n; k++) {
				h2 = max(h1 - abs(data[k].x - i) - abs(data[k].y - j), 0);
				if (data[k].h == h2) {
				} else {
					break;
				}
			}
			if( k == n ) {
				*cx = i;
				*cy = j;
				return;
			}
		}
	}
	return;
}

int main()
{
	int n_info_count = 0;
	int i = 0;
	int ref = 0;
	long long int x,y,h;
	scanf("%d", &n_info_count);
	for(i = 0; i < n_info_count; i++) {
		scanf("%lld %lld %lld", &x, &y, &h);
		data[i].x = x;
		data[i].y = y;
		data[i].h = h;
	}

	for(i = 0; i < n_info_count; i++) {
		if (data[i].h != 0) {
			ref = i;
			break;
		}
	}

	get_center_pos(&x, &y, n_info_count, ref);
	h = data[ref].h + abs(data[ref].x - x) + abs(data[ref].y - y);
	printf("%lld %lld %lld\n", x, y, h);
	return 0;
}


Measured memory_bytes: 128
#include<iostream>
#include<algorithm>
using namespace std;
int main()
{
		int n;
		cin>>n;
		double a[n];
		for(int i=0;i<n;i++)
		{
				cin>>a[i];
		}
		sort(a,a+n);
		double p=(a[0]+a[1])/2;
		for(int i=2;i<n;i++)
		{
				p=(p+a[i])/2;
		}
		cout<<p;
}


Measured memory_bytes: 256
let n=Int(readLine()!)!
var arr:[Int]=[]
var max_1 = 0
var max_2 = 0
var tmp = 0
for _ in 0..<n {
    tmp = Int(readLine()!)!
    arr.append(tmp)
  	if( tmp > max_1 ) {
      max_2 = max_1
      max_1 = tmp
    }
  	else if( tmp > max_2 ) {
      max_2 = tmp
    }
}

for i in 0..<n {
  	if( arr[i] != max_1 ) {
      print( max_1 )
    } else {
		print(max_2)
    }
}

Measured memory_bytes: 3940
#include <iostream>

using namespace std;

int main(){
    int x, y;

    cin >> x >> y;

    for(int i = 0; i <= x; i++){
        if(y == (x-i) * 2 + i * 4){
            cout << "Yes" << endl;
            return 0;
        }
    }

    cout << "No" << endl;

    return 0;
}

Measured memory_bytes: 3556
#include <iostream>
#include <string>
using namespace std;
struct info{
    string word[10];
    int m;
};

struct tag{
    string a;
    int id;
    int counter[10000];
};

void check(void);
void Pair(void);
void count(int name,int infomation);
void dictionary(int one,int two);


int n,f,tag_l;
int ans,filing;
tag t[1000];
info str[100];
string k,ans_file[10000];

int main(void){
    cin>>n>>f;
    for(int i=0;i<n;i++){
        cin>>str[i].m;
        for(int j=0;j<str[i].m;j++){
            cin>>str[i].word[j];
        }
    }
    check();
    Pair();
    
    k=' ';
    
    ans=0;
    
    for(int i=0;i<tag_l;i++){
        for(int j=0;j<tag_l;j++){
            if(i==j)continue;
            if(t[i].counter[j]>=f){
                ans++;
                t[j].counter[i]=0;
            }
        }
    }
    
    cout<<ans<<endl;
    filing=0;
    if(ans!=0){
        for(int i=0;i<tag_l;i++){
            for(int j=0;j<tag_l;j++){
                if(i==j)continue;
                if(t[i].counter[j]>=f){
                    dictionary(i,j);
                }
            }
        }
    }
    
    string sub;
    
    for(int i=0;i<filing-1;i++){
        for(int j=i;j<filing;j++){
            if(ans_file[i]>ans_file[j]){
                sub=ans_file[i];
                ans_file[i]=ans_file[j];
                ans_file[j]=sub;
            }
        }
    }
    
    for(int i=0;i<filing;i++){
        cout<<ans_file[i]<<endl;
    }
    /*
    for(int i=0;i<tag_l;i++){
        cout<<t[i].a<<' '<<t[i].id<<' ';
    }cout<<endl;
    
    for(int i=0;i<tag_l;i++){
        cout<<t[i].a<<endl;
        for(int j=0;j<tag_l;j++){
            cout<<t[i].counter[j]<<endl;
        }
    }cout<<endl;
    cout<<ans<<endl;
    */
}


void check(void){
    tag_l=0;
    for(int i=0;i<n;i++){
        for(int j=0;j<str[i].m;j++){
            if(tag_l==0){t[tag_l].a=str[i].word[j]; t[tag_l].id=tag_l; tag_l++;}
            else{
                for(int k=0;k<tag_l;k++){
                    if(t[k].a==str[i].word[j]){
                        break;
                    }
                    if(k==tag_l-1){t[tag_l].a=str[i].word[j]; t[tag_l].id=tag_l; tag_l++;}
                }
            }
        }
    }
}

void Pair(void){
    for(int h=0;h<tag_l;h++){
        for(int i=0;i<n;i++){
            for(int j=0;j<str[i].m;j++){
                if(str[i].word[j]==t[h].a){
                    count(h,i);
                }
            }
        }
    }
}

void count(int name,int infomation){
    for(int j=0;j<str[infomation].m;j++){
        for(int i=0;i<tag_l;i++){
            if(str[infomation].word[j]==t[i].a){
                t[name].counter[t[i].id]++;
            }
        }
    }
}

void dictionary(int one,int two){
    if(t[one].a>t[two].a){
        ans_file[filing]=t[two].a+k+t[one].a;
        
    }
    else{
        ans_file[filing]=t[one].a+k+t[two].a;
    }
    filing++;
}



Measured memory_bytes: 9592
N, M = map(int, input().split())
a = [0 for i in range(M)]
b = [0 for i in range(M)]
c = []
d = []
flag = 0
for i in range(M):
    a[i], b[i] = map(int, input().split())
    if a[i] == 1:
        c.append(b[i])
        if b[i] == N:
            flag = 1
    if b[i] == N:
        d.append(a[i])
        if a[i] == 1:
            flag = 1
e = set(c) | set(d)
if len(c) + len(d) == len(e):
    flag = 0
else:
    flag = 1

if flag == 0:
    print("IMPOSSIBLE")
else:
    print("POSSIBLE")


Measured memory_bytes: 40444
#include<iostream>
#include<iomanip>
#include<cassert>
#include<math.h>
#include<complex>
#include<algorithm>
#include<utility>
#include<queue>
#include<string.h>
#include<string>
#include<set>
#include<map>
#include<unordered_map>
#include<functional>
#include<vector>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
const ll INF=2e18;
const ll MOD=1e9+7;

ll N,M;
vector<ll> edgeList[100010];
bool isInPath[100010]={};
void MakePath(ll n,vector<ll>& pathVec){
	isInPath[n]=true;
	pathVec.push_back(n);
	for(auto to:edgeList[n]){
		if(!isInPath[to]){
			MakePath(to,pathVec);
			break;
		}
	}
}
int main(){
    cin>>N>>M;
	for(ll i=0;i<M;i++){
		ll a,b;
		cin>>a>>b;
		edgeList[a].push_back(b);
		edgeList[b].push_back(a);
	}
	vector<ll> v1,v2;
	MakePath(1,v1);
	MakePath(1,v2);
	reverse(v1.begin(),v1.end());
	cout<<v1.size()+v2.size()-1<<endl;
	for(auto v:v1){
		cout<<v<<" ";
	}
	for(ll i=1;i<v2.size();i++){
		cout<<v2[i]<<" ";
	}cout<<endl;
    return 0;
}

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

#define sz(a) ((int)a.size())
#define forn(i,n) for(int i=0;i<(int)n;i++)
#define forse(i,s,e) for(int i=(int)s;i<(int)e;i++)
#define all(v) (v).begin(),(v).end()
#define pb push_back
#define mp make_pair
#define fi first
#define se second

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

dbl PI=3.141592653589793;


void solve(){
	string s,t;
	cin >> s >> t;
	int ans=0;
	forn(i,sz(s)){
		ans+=(s[i]!=t[i]);
	}
	cout << ans;
}

int main() {
	ios::sync_with_stdio(0);
	cin.tie(0); 
	int T=1;
//	cin >> T;
	for(int c=1;c<=T;c++){
		solve();
	}
}


Measured memory_bytes: 3824
import sys,collections as cl,bisect as bs
sys.setrecursionlimit(100000)
input = sys.stdin.readline
mod = 10**9+7
Max = sys.maxsize
def l(): #intのlist
    return list(map(int,input().split()))
def m(): #複数文字
    return map(int,input().split())
def onem(): #Nとかの取得
    return int(input())
def s(x): #圧縮
    a = []
    if len(x) == 0:
        return []
    aa = x[0]
    su = 1
    for i in range(len(x)-1):
        if aa != x[i+1]:
            a.append([aa,su])
            aa = x[i+1]
            su = 1
        else:
            su += 1
    a.append([aa,su])
    return a
def jo(x): #listをスペースごとに分ける
    return " ".join(map(str,x))
def max2(x): #他のときもどうように作成可能
    return max(map(max,x))
def In(x,a): #aがリスト(sorted)
    k = bs.bisect_left(a,x)
    if k != len(a) and a[k] ==  x:
        return True
    else:
        return False

def pow_k(x, n):
    ans = 1
    while n:
        if n % 2:
            ans *= x
        x *= x
        n >>= 1
    return ans

"""
def nibu(x,n,r):
    ll = 0
    rr = r
    while True:
        mid = (ll+rr)//2

    if rr == mid:
        return ll
    if (ここに評価入れる):
        rr = mid
    else:
        ll = mid+1
"""

n = onem()

a = l()

a.sort()

su = 0

po = a[0]

for i in range(1,n):
    if 2 * po < a[i]:
        su = i
    po += a[i]



print(n - su)





Measured memory_bytes: 59632
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
typedef pair<int, int> PII;

LL solve1(char s[]) {
  stack<LL> a;
  stack<char> o;
  for (int i = 0; s[i]; ++ i) {
    if (s[i] >= '0' && s[i] <= '9') a.push(s[i] - '0');
    else {
      if (s[i] == '+') {
        while (!o.empty() && o.top() == '*') {
          LL x = a.top(); a.pop();
          LL y = a.top(); a.pop();
          a.push(x * y); o.pop();
        }
        o.push('+');
      }
      else o.push(s[i]);
    }
  }
  while (!o.empty()) {
    LL x = a.top(); a.pop();
    LL y = a.top(); a.pop();
    if (o.top() == '+') a.push(x + y);
    else a.push(x * y);
    o.pop();
  }
  return a.top();
}

LL solve2(char s[]) {
  LL r(0), p(0);
  for (int i = 0; s[i]; ++ i) {
    if (s[i] >= '0' && s[i] <= '9') {
      if (p) r = r * (s[i] - '0');
      else r += s[i] - '0';
    }
    else {
      p = s[i] == '*';
    }
  }
  return r;
}

int main() {
  char s[100]; int n;
  while (scanf("%s%d", s, &n) == 2) {
    LL r1 = solve1(s);
    LL r2 = solve2(s);
    if (r1 == n && r2 == n) puts("U");
    else if (r1 == n && r2 != n) puts("M");
    else if (r1 != n && r2 == n) puts("L");
    else puts("I");
  }
  return 0;
}

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

struct dice{
  int num[10];
};

dice d[110], t, z;

dice hoge(dice d){
  int temp = d.num[6];
  d.num[6] = d.num[2];
  d.num[2] = d.num[1];
  d.num[1] = d.num[5];
  d.num[5] = temp;
  return d;
}

dice fuga(dice d){
  int temp = d.num[6];
  d.num[6] = d.num[3];
  d.num[3] = d.num[1];
  d.num[1] = d.num[4];
  d.num[4] = temp;
  return d;
}

dice foo(dice d){
  int temp = d.num[2];
  d.num[2] = d.num[3];
  d.num[3] = d.num[5];
  d.num[5] = d.num[4];
  d.num[4] = temp;
  return d;
}

bool equal(dice a, dice b){
  for(int i = 1; i <= 6; i++){
    if(a.num[i] != b.num[i]) return false;
  }
  return true;
}


bool same(dice a, dice b){
  for(int i = 0; i < 4; i++){
    a = hoge(a);
    for(int j = 0; j < 4; j++){
      a = foo(a);
      if(equal(a,b))return true;
    }
  }
  a = fuga(a);
  for(int j = 0; j < 4; j++){
    a = foo(a);
    if(equal(a,b))return true;
  }
  a = fuga(a);
  a = fuga(a);
  for(int j = 0; j < 4; j++){
    a = foo(a);
    if(equal(a,b))return true;
  }
  
  return false;
}

int main(){
  int n, q, a;

  string s;

  cin>>n;

  for(int i = 0; i < n; i++){
    for(int j = 1; j <= 6; j++){
      cin>>d[i].num[j];
    }
  }

  for(int i = 0; i < n; i++){
    for(int j = i+1; j < n; j++){
      if(same(d[i],d[j])){
	cout<<"No"<<endl;
	return 0;
      }
    }
  }

  cout<<"Yes"<<endl;
  
  return 0;
}



Measured memory_bytes: 3104
#!/usr/bin/env python3
from collections import deque
k = int(input())
for digit in range(1,11):#最大で10桁まである
    q = []
    cnt = 0
    for i in range(10):#1の位は0~9
        s = str(i)
        if digit == 1:
            if s[0] != "0":
                cnt += 1
                if cnt == k:
                    print(s)
                    exit()
            continue
        plus = 1
        stack = deque(s)
        while len(stack[0]) < digit:
            t = stack.popleft()
            top = int(t[0])
            for j in [top-1,top,top+1]:
                if j >= 0 and j <= 9:
                    l = str(j) + t
                    stack.append(l)
        while stack:
            t = stack.popleft()
            if t[0] != "0":
                cnt += 1
                q.append(t)
    q.sort()
    #print(q,cnt)
    if k > cnt:
        k -= cnt
    else:
        print(q[k-1])
        exit()            

    


Measured memory_bytes: 65628
#include<bits/stdc++.h>
using namespace std;
const int N=2000002;
struct node{
	int to,ne;
}e[N<<1];
int h[N],tot,x[N],y[N],z[N],dis[N],n,m,fa[N],i,u,v,now,xx,Q[N],mx,cnt;
queue<int>q;
vector<int>vec[N];
void add(int x,int y){e[++tot]={y,h[x]},h[x]=tot;}
void ADD(int x,int y){add(x,y),add(y,x);}
int find(int x){return x==fa[x]?x:fa[x]=find(fa[x]);}
void uni(int x,int y){
	int rx=find(x),ry=find(y);
	if (rx!=ry) fa[rx]=ry;
}
int main(){
	scanf("%d%d",&n,&m);
	for (i=1;i<=m;i++) scanf("%d%d%d",&x[i],&y[i],&z[i]),vec[z[i]].push_back(i),mx=max(mx,z[i]);
	now=n;
	for (i=1;i<=mx;i++){
		for (auto j:vec[i]) fa[x[j]]=x[j],fa[y[j]]=y[j];
		for (auto j:vec[i]) uni(x[j],y[j]);
		cnt=0;
		for (auto j:vec[i]) Q[++cnt]=find(x[j]);
		sort(Q+1,Q+cnt+1);
		cnt=unique(Q+1,Q+cnt+1)-Q-1;
		for (auto j:vec[i]){
			xx=lower_bound(Q+1,Q+cnt+1,find(x[j]))-Q;
			ADD(x[j],now+xx),ADD(y[j],now+xx);
		}
		now+=cnt;
	}
	memset(dis,63,sizeof(dis));
	q.push(1),dis[1]=0;
	while (!q.empty()){
		u=q.front(),q.pop();
		for (i=h[u];i;i=e[i].ne)
			if (dis[v=e[i].to]>1e9) dis[v]=dis[u]+1,q.push(v);
	}
	printf("%d",dis[n]>1e9?-1:dis[n]/2);
}

Measured memory_bytes: 84096
import sys
input = sys.stdin.readline


N = int(input())
A = list(map(int, input().split()))
graph = [[] for _ in range(N)]
for _ in range(N-1):
    a, b = map(int, input().split())
    graph[a-1].append(b-1)
    graph[b-1].append(a-1)


def check():
    stack = [0]
    checked = [False]*N
    need = [[] for _ in range(N)]
    Parent = [-1]*N
    while stack:
        p = stack.pop()
        if p >= 0:
            checked[p] = True
            stack.append(~p)
            for np in graph[p]:
                if not checked[np]:
                    Parent[np] = p
                    stack.append(np)
        else:
            p = ~p
            if len(need[p]) == 0:
                need[Parent[p]].append(A[p])
            elif len(need[p]) == 1:
                if need[p][0] != A[p]:
                    return False
                need[Parent[p]].append(A[p])
            else:
                kmax = sum(need[p])
                kmin = max(max(need[p]), (kmax+1)//2)
                if not kmin <= A[p] <= kmax:
                    return False
                if p == 0 and kmax-2*(kmax-A[p]) != 0:
                    return False
                need[Parent[p]].append(kmax-2*(kmax-A[p]))
    return True

print("YES" if check() else "NO")

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

int main()
{
  int n;
  cin >> n;
  string s;
  cin >> s;
  char pre = ' ';
  int cnt = 0;
  for (char c : s) {
    if (pre != c) {
      cnt++;
    }
    pre = c;
  }
  cout << cnt << '\n';
  return 0;
}


Measured memory_bytes: 512
n = int(input())
xy = [list(map(int, input().split())) for _ in range(n)]

if n == 1:
    print(1)
    exit()
    
pq = []
for i in range(n):
    for j in range(n):
        if i != j:
            pq.append((xy[i][0] - xy[j][0] ,xy[i][1] - xy[j][1]))

ans = float("inf")
for p, q in pq:
    tmp = 0
    for i in range(n):
        for j in range(n):
            if i != j and (p, q) == (xy[i][0] - xy[j][0] ,xy[i][1] - xy[j][1]):
                tmp += 1
        ans = min(ans, n - tmp)
            
print(ans)

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

using namespace std;

int main()
{

    double n, a, t, h[1500], minvl, idx = 1;
    cin >> n >> t >> a;
    for(int i = 1; i <= n; i++)
    {
        cin >> h[i];
        h[i] = t-(h[i]*0.006);
        h[i] = abs(a-h[i]);
    }

    minvl = h[1];
    for(int i = 2; i <= n; i++)
    {
        if(h[i] < minvl)
        {
            minvl = h[i];
            idx = i;
        }
    }

    cout << idx;

    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
using namespace std;
#define REP(i, n) for(LL i=0; i<(n); i++)
typedef long long LL;

LL gcd(LL n, LL m) {
	if (m == 0)return n;
	return gcd(m, n%m);
}
LL lcm(LL n, LL m) {
	LL g = gcd(n, m);
	return n / g * m;
}
int main() {
	LL n, ans = 1;
	cin >> n;
	vector<LL> t(n);
	REP(i, n)cin >> t[i];
	REP(i, n) {
		ans = lcm(ans, t[i]);
	}
	cout << ans << endl;
}

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

int main() {
    int K, A, B;
    cin >> K >> A >> B;

    int ans = 0;    
    for (int i = A; i <= B; i++) {
        if (i%K == 0) {
            ans++;
        }
    }

    if (ans == 0) {
        cout << "NG" << endl;
    } else {
        cout << "OK" << endl;
    }
}

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

int main(){
  int W, H, N;  cin >> W >> H >> N;
  int xmi = 0, xma = W, ymi = 0, yma = H;
  for(int i = 0; i < N; i++){
    int x, y, a;  cin >> x >> y >> a;
    if(a == 1) xmi = max(xmi, x);
    if(a == 2) xma = min(xma, x);
    if(a == 3) ymi = max(ymi, y);
    if(a == 4) yma = min(yma, y);
  }
  cout << max(0, xma - xmi) * max(0, yma - ymi) << endl;
}

Measured memory_bytes: 256
import math
def distance(x1,y1,x2,y2):
    x = pow(abs(x1-x2),2)
    y = pow(abs(y1-y2),2)
    return math.sqrt(x+y)

import itertools
# 順列生成
def permutation(list_):
    return list(itertools.permutations(list_))

def main():
    n = int(input())
    x,y = [0 for _ in range(n)],[0 for _ in range(n)]
    for i in range(n):
        x[i],y[i] = map(int,input().split())
    
    can = permutation(list(range(n)))

    all_path = 0
    for ls in can:
        path = 0
        for i in range(1,len(ls)):
            path += distance(x[ls[i-1]],y[ls[i-1]],x[ls[i]],y[ls[i]])
        all_path += path
    
    print(all_path/len(can))

if __name__=='__main__':
    main()

Measured memory_bytes: 47472
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner scan= new Scanner(System.in);
		int n=scan.nextInt();
		if(n%2==0) {
			n/=2;
			System.out.println(n*n);
		}
		else {
			int a=n/2;
			System.out.println((a*a)+(n/2));
		}

	}

}


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

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<pair<int, int> > vpii;
typedef vector<pair<ll, ll> > vpll;

#define pll pair<ll,ll>
#define pii pair<int, int>
#define all(x) x.begin(), x.end()
#define F first
#define S second
#define rep(i,n) for (int i = 0; i < n; ++i) 
#define REP(i,k,n) for (int i = k; i <= n; ++i) 
#define REPR(i,k,n) for (int i = k; i >= n; --i)
#define pb push_back
#define watch(x) cout << (#x) << " is " << (x) << endl
#define sz(a) int((a).size())
#define endl '\n' // remove for interactive

const int INF = 1e9;
const ll mod = 1e9 + 7;
ll powmod(ll a,ll b) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}



void solve()
{
    int n; cin>>n;
    vi v;
    rep(i, n)
    {
        int x; cin>>x;
        v.pb(x);
    }
    int cnt = 0;
    rep(i, n)
    {
        REP(j, i+1, n-1)
        {
            REP(k, j+1, n-1)
            {
                int a,b,c;
                a = v[i]; b = v[j]; c = v[k];
                if(a+b > c && b+c > a && a + c > b && a !=b && a!=c && b != c) cnt++;
            }
        }
    }
    cout<<cnt;
}

int main()
{
    // clock_t start, end;
    // start = clock();
    ios_base::sync_with_stdio(0); //cant use scanf, printf
    cin.tie(0);cout.tie(0); // no longer auto flush cout before each cin, remove for interactive
    int t = 1;
    // cin>>t;
    REP(i, 1, t)
    {
        solve();
        
    }
    // end = clock();
    // double time_taken = double(end - start) / double(CLOCKS_PER_SEC); 
    // watch(time_taken);
    ll x = INF; x++;
    return 0;
    
}



/*before sub
TEST: 0, 1, equal, -ve, bounds(random and ez)
ERR/WA: loop vars, out of bounds, endl, finish taking inputs, large doubles, larger INF, corr mod, t
RE: double dec, integer overflow(ll or 1LL mult)
*/





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

int main()
{
	int n, W;
	cin >> n>> W;
	// previous dp[i][j] = max(dp[i-1][j],dp[i-1][j-wt[i]])
	vector<ll> dp(W+1,0);// dp[i] = maximum value with total weight exactly equal to i
	ll ans = 0;
	for(int i=0;i<n;++i){
		int wt, val;
		cin >> wt>> val;
		for(int j=W;j>=0;--j){
			if(j-wt>=0){
				dp[j] = max(dp[j], dp[j-wt]+val);
			}
			ans = max(ans, dp[j]);
		}
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 1024
#include<algorithm>
#include<cmath>
#include<cstdio>
#include<functional>
#include<iomanip>
#include<iostream>
#include<map>
#include<numeric>
#include<queue>
#include<set>
#include<string>
#include<utility>
#include<vector>

using namespace std;
typedef long long ll;
typedef unsigned long long ull;
const ll MOD = 1000000007;
#define rep(i,n) for(int i=0;i<n;i++)
#define repl(i,s,e) for(int i=s;i<e;i++)
#define reple(i,s,e) for(int i=s;i<=e;i++)
#define revrep(i,n) for(int i=n-1;i>=0;i--)
#define all(x) (x).begin(),(x).end()

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

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

	vector<ll> A(N);
	rep(i, N) cin >> A[i];
	sort(all(A));

	vector<ll> B(N);
	rep(i, N) cin >> B[i];
	sort(all(B));

	vector<ll> C(N);
	rep(i, N) cin >> C[i];
	sort(all(C));

	ll ans = 0;

	for (auto b : B)
	{
		auto ita = lower_bound(all(A), b);
		auto itc = upper_bound(all(C), b);

		ans += distance(A.begin(), ita) * (N - distance(C.begin(), itc));
	}

	cout << ans << endl;

	return 0;
}

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

int h, w, n, a, squares[100][100], x, y;
bool isRightward = true;

int main() {
    cin >> h >> w >> n;
    for (int i = 1; i <= n; i++) {
        scanf("%d", &a);
        while (a--) {
            squares[y][x] = i;
            if (isRightward) {
                x++;
                if (x == w) {
                    x = w - 1;
                    y++;
                    isRightward = false;
                }
            } else {
                x--;
                if (x == -1) {
                    x = 0;
                    y++;
                    isRightward = true;
                }
            }
        }
    }

    for (int i = 0; i < h; i++) {
        for (int j = 0; j < w; j++) {
            if (j) cout << " ";
            cout << squares[i][j];
        }
        cout << endl;
    }

    return 0;
}

Measured memory_bytes: 384
#include "bits/stdc++.h"

#define REP(i,num) for(ll i=0;i<(num);++i)
#define LOOP(i) while(i--)
#define ALL(c) c.begin(),c.end()
#define PRINTALL(c) for(auto pitr=c.begin();pitr!=c.end();++pitr){cout<<*pitr;if(next(pitr,1)!=c.end())cout<<' ';}cout<<endl;
#define PAIRCOMP(c,comp) [](const pair<ll,ll>& lhs,const pair<ll,ll>& rhs){return lhs.c comp rhs.c;}

using namespace std;
using ll = long long;

constexpr ll atcoder_mod = 1e9+7;

template<typename T=ll>
T in(){T x; cin >> x; return (x);}
template<typename T=ll,typename C=vector<T>>
C vecin(int N){C x(N);REP(i,N){x[i]=in<T>();}return move(x);}

void vout(){cout << endl;}
template<typename Head,typename... Tail>
void vout(Head&& h,Tail&&... t){cout << ' ' << h;vout(forward<Tail>(t)...);}
void out(){cout << endl;}
template<typename Head,typename... Tail>
void out(Head&& h,Tail&&... t){cout << h;vout(forward<Tail>(t)...);}

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	cout<<fixed<<setprecision(10);

	while(true){
		int N=in(),X=in();
		if(!N && !X) break;

		int sum=0;
		for(int i=1;i<=N;i++){
			for(int j=i+1;j<=N;j++){
				for(int k=j+1;k<=N;k++){
					if(i+j+k==X) sum++;
				}
			}
		}
		out(sum);
	}
	return 0;
}



Measured memory_bytes: 3100
#include<iostream>
#include<stdio.h>
#include<string.h>
using namespace std;

int main()
{

	char t[1001],w[11];
	char c[12]={'E','N','D','_','O','F','_','T','E','X','T'};
	int i,tl,wl,ch,count,tc,wc;
	
	count=0;
	
	cin >> w;
	wl=strlen(w);

	
	while(1){
		cin >> t;
		tl=strlen(t);
		ch=0;
		for(i=0;i<tl;i++){
			if(tl==11 && t[i]==c[i]) ch++;
		}
		if(ch==11) break;
		
		ch=0;
		for(i=0;i<wl;i++){
			tc=0;
			wc=0;
			tc=t[i]-'A';
			tc=tc%32;
			wc=w[i]-'A';
			wc=wc%32;
			if(tc==wc) ch++;
		}
		if(ch == wl && tl==wl) count++;
	}
	
	cout << count << endl;
	
	return 0;
}

Measured memory_bytes: 1140
import           Control.Monad
import qualified Data.ByteString.Char8 as BS
import           Data.Maybe

readInt = fst . fromJust . BS.readInt
readIntList = map readInt . BS.words
getInt = readInt <$> BS.getLine
getIntList = readIntList <$> BS.getLine

main = do
  [n, m] <- getIntList
  let c1 = if n > 1 then n * (n-1) else 0
      c2 = if m > 1 then m * (m-1) else 0
      ans = (c1 + c2) `div` 2
  print ans

Measured memory_bytes: 380
#include<iostream>
#include<cstdio>

using namespace std;

struct P{int i,j;};

int a[300][300],b[100][100],c[100][100],n,m;


P ok(void){
  P res;

  for(int i=1;i<=n;i++){
    for(int j=1;j<=n;j++){
      int fg=0;
      res.i=res.j=1000;
      for(int k=0;k<m;k++){
	for(int l=0;l<m;l++){
	  if(c[k][l]>=0 && a[i+k][j+l]!=c[k][l]){
	    fg=1;
	    break;
	  }
	}
	if(fg==1)break;
      }
      if(fg==0){
	for(int k=0;k<m;k++){
	  for(int l=0;l<m;l++){
	    if(c[k][l]>=0){
	      res.i=k+i;
	      res.j=l+j;
	      return res;
	    }
	  }
	}
      }
    }
  }
  return res;
}

int main(void){

  while(cin >> n >> m,n|m){

    for(int i=0;i<100;i++)
      for(int j=0;j<100;j++)
	b[i][j]=c[i][j]=-1;

    for(int i=0;i<300;i++)
      for(int j=0;j<300;j++)
	a[i][j]=-2;

    P res,ans;
    res.i=res.j=ans.i=ans.j=1000;

    for(int i=1;i<=n;i++)
      for(int j=1;j<=n;j++)
	cin >> a[i][j];
    
    for(int i=0;i<m;i++)
      for(int j=0;j<m;j++)
	cin >> b[i][j];

    for(int i=0;i<m;i++)
      for(int j=0;j<m;j++)
	c[i][j]=b[i][j];

    res=ok();
    if(ans.i>res.i)ans=res;
    else if(ans.i==res.i && ans.j>res.j)ans=res;
    
    for(int i=m-1;i>=0;i--)
      for(int j=0;j<m;j++)
	c[j][m-i-1]=b[i][j];
    
    res=ok();
    if(ans.i>res.i)ans=res;	
    else if(ans.i==res.i && ans.j>res.j)ans=res;

    for(int i=m-1;i>=0;i--)
      for(int j=m-1;j>=0;j--)
	c[m-i-1][m-j-1]=b[i][j];

    res=ok();
    if(ans.i>res.i)ans=res;
    else if(ans.i==res.i && ans.j>res.j)ans=res;

    for(int i=0;i<m;i++)
      for(int j=m-1;j>=0;j--)
	c[m-j-1][i]=b[i][j];
    
    res=ok();
    if(ans.i>res.i)ans=res;
    else if(ans.i==res.i && ans.j>res.j)ans=res;

    if(ans.i<1000)cout << ans.j <<" "<<ans.i << endl;
    else cout << "NA" << endl;
  }

  return 0;
}

Measured memory_bytes: 1592
#include <iostream>
#include <vector>
#include <cmath>
#include <queue>
#include <deque>
#include <set>
#include <string>
#include <map>
#include <algorithm>
#include <stack>
#include <cstdlib>
#include <iomanip>
#include <ctime>
using namespace std;

using ll = long long;
using ull = unsigned long long;
using ld = long double;
#define ff first
#define ss second

vector<int> tree, d;
int sz;

void init(int n){
  sz = 1;
  while (sz < n) 
    sz *= 2;
  tree.assign(2 * sz - 1, 0);
}

void st(int i, int v, int x, int lx, int rx) {
  if (rx - lx == 1) {
    tree[x] = v;
    return;
  }
  int m = (rx + lx) / 2;
  if (i < m) {
    st(i, v, 2 * x + 1, lx, m); 
  }
  else {
    st(i, v, 2 * x + 2, m, rx);
  }
  tree[x] = max(tree[2 * x + 1], tree[2 * x + 2]);
}   

void st(int i, int v) {
  st(i, v, 0, 0, sz);
}

int mx(int l, int r, int x, int lx, int rx) {
  if (l >= rx || lx >= r) {
    return -2e9;
  }    
  if (rx <= r && lx >= l) {
    return tree[x];
  }
  int m = (lx + rx) / 2;
  int m1 = mx(l, r, 2 * x + 1, lx, m);
  int m2 = mx(l, r, 2 * x + 2, m, rx);
  return max(m1, m2);
}

int mx(int l, int r) {
  return mx(l, r, 0, 0, sz); 
}	

int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int n, k;
  	cin >> n >> k;
  	vector<int> a(n);
  	int m = -1;
  	for (int i = 0; i < n; i++) {
      	cin >> a[i];
      	a[i] += k;
      	m = max(m, a[i]);
    }
  	init(m + k + 1);
  	d.resize(m + 1);
  	for (int i = 0; i < n; i++) {
      	int cur = mx(a[i] - k, a[i] + k + 1) + 1;
      	if (cur > d[a[i]]) {
    		st(a[i], cur);
          	d[a[i]] = cur;
        }
    }
  	int ans = 0;
  	for (int i = 0; i < n; i++) {
    	ans = max(ans, d[a[i]]);
    }
  	cout << ans;
    return 0;
}

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

int main()
{
  int n; cin >> n;
  vector<int> x(n);
  vector<int> y(n);
  for (int i = 0; i < n; i++)
  {
    cin >> x[i];
    y[i] = x[i];
  }
  sort(y.begin(), y.end());
  int mean1 = y[n/2 - 1];  
  int mean2 = y[n/2];  
  for (auto && a : x)
  {
    if (a <= mean1)
    {
      cout << mean2 << endl;
    }
    else
    {
      cout << mean1 << endl;
    }
  }
    
}

Measured memory_bytes: 4816
#include<iostream>
#include<stdio.h>
#include<string.h>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<set>
#include<iomanip>



#define REP(i,n) for (int i = 0; (i) < (n); ++ (i))

using namespace std;
int a,b,c,d;
int k1,k2;
string s;

int main(){
  cin >> s;
  REP(i,3){
    if(s[i]=='a'){
      REP(j,3){
        if(s[j]=='b'){
          REP(k,3){
            if(s[k]=='c'){
              cout << "Yes" << endl;
              return 0;
            }
          }
        }
      }
    }
  }
  cout << "No" << endl;
  return 0;
}



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

#define int long long
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define rep(i,n) for(int i=0;i<n;++i)
#define rep1(i,n) for(int i=1;i<n;++i)
#define exrep(i, a, b) for(ll i = a; i < b; i++)
#define out(x) cout << x << endl
#define EPS (1e-7)
#define gearup ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);

typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<char> vc;
typedef vector<bool> vb;
typedef vector<double> vd;
typedef vector<string> vs;
typedef vector<pair<int,int> > vpii;
typedef vector<vector<int> > vvi;
typedef vector<vector<char> > vvc;
typedef vector<vector<bool> > vvb;
typedef vector<vector<double> > vvd;
typedef vector<vector<string> > vvs;
typedef vector<ll> vl;
typedef vector<vector<ll> > vvl;
typedef vector<vector<vector<ll> > > vvvl;
ll MOD = 1000000007;
const long long L_INF = 1LL << 60;
const int INF = 2147483647; // 2^31-1
const double PI = acos(-1);
//cout<<fixed<<setprecision(10);

template<class T> inline bool chmin(T& a, T b) {if (a > b) {a = b;return true;}return false;}
template<class T> inline bool chmax(T& a, T b) {if (a < b) {a = b;return true;}return false;}
template<class T> void debug(T v){rep(i,v.size()) cout<<v[i]<<" ";cout<<endl;}
const ll dx[8] = {1, 1, 0, -1, -1, -1, 0, 1};
const ll dy[8] = {0, 1, 1, 1, 0, -1, -1, -1};
//以降 cin の入力元が 'input.txt' になる
//std::ifstream in("input.txt");
//std::cin.rdbuf(in.rdbuf());


signed main()
{
    gearup;
    string s; cin >> s;
    if(s[0] == s[2])out("Yes");
    else out("No");
}

Measured memory_bytes: 3572
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
 
using namespace std;
 
struct uf {
  vector<int> par;
  uf(int N) : par(N) {
    for(int i = 0; i < N; i++) par[i] = i;
  }
  int root(int x) {
    if (par[x] == x) return x;
    return par[x] = root(par[x]);
  }
  void unite(int x, int y) {
    int rx = root(x);
    int ry = root(y);
    if (rx == ry) return;
    par[rx] = ry;
  }
 
  bool same(int x, int y) {
    int rx = root(x);
    int ry = root(y);
    return rx == ry;
  }
};
 
int main() {
    int N, M;
    cin >> N >> M;
    vector<int> P(N);
    for(int i = 0; i < N; i++){
        cin >> P[i];
    }
 
    uf tree(N);
    for(int i = 0; i < M; i++) {
        int x, y;
        cin >> x >> y;
        tree.unite(x-1, y-1);
    }
    int cnt = 0;
    for(int i = 0; i < N; i++) {
        if (tree.same(i, P[i]-1)) {
            cnt++;
        }
    }
    cout << cnt << endl;
    return 0;
}

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

int main(){

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

    int q;
    cin >> q;
    for(int i = 0; i < q; ++i){
        int k;
        cin >> k;
        cout << binary_search(vec.begin(), vec.end(), k) << endl;
    }

    return 0;
}


Measured memory_bytes: 3104
#include <algorithm>
#include <iostream>
#include <random>
#include <string>
#include <vector>

int main()
{
    std::string s;
    std::cin >> s;
    std::vector<char> cvec;
    bool boolarray[127];
    for (int i = 0; i < 127; i++) { boolarray[i] = false; }

    for (char ch : s) { boolarray[ch] = true; }

    for (int i = 97; i < 123; i++)
    {
        if (!boolarray[i]) { cvec.push_back((char)i); }
    }

    if (!cvec.size())
    {
        std::cout << "None" << std::endl;
        return 0;
    }

    std::sort(cvec.begin(), cvec.end());
    std::cout << cvec[0] << std::endl;

    return 0;
}

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

#define MAX 2000000
#define INF 90000000

 int H,A[MAX+1],time=0;

void maxHeapify(int i){
  int temp,l,r,large;
  l=2*i;
  r=2*i+1;


  if(l <= H && A[l] > A[i])large = l;
  else large = i;
  if(r <= H && A[r] > A[large]) large = r;

  if(large != i){
    temp = A[i];
    A[i]=A[large];
    A[large] = temp;
    maxHeapify(large);
  }
}

int extract(){
  int maxv;
  if(H < 1) return -INF;
  maxv = A[1];
  A[1] = A[H--];
  maxHeapify(1);
  return maxv;
}


void increaseKey(int i, int key){
  int temp;
  if(key < A[i])return;
  A[i] = key;
  while(i > 1 && A[i/2] < A[i]){
    //swap(A[i],A[i/2]);
    temp = A[i];
    A[i] = A[i/2];
    A[i/2] = temp;
    i = i/2;
  }
}


void insert(int key){
  H++;
  A[H] = -INF;
  increaseKey(H,key);
}

int main(){
  int key;
  char s[100];

  while(1){
    time++;
    scanf("%s",s);
    if(s[0] == 'e' && s[1] == 'n')break;
    if(s[0] == 'i'){
      scanf("%d",&key);
      insert(key);
    }
    else printf("%d\n",extract());
  }
  
  return 0;
}



Measured memory_bytes: 5672
def toggle_case(char)
  ord = char.ord
  return char if ord < 65 || (90 < ord) && (ord < 97) || 122 < ord
  return (ord - 32).chr if 97 <= ord
  (ord + 32).chr
end

line = gets.chomp.split("")
puts line.map{|c| toggle_case(c)}.join("")

Measured memory_bytes: 8620
#include<bits/stdc++.h>
using namespace std;
int main(){
  int N;
  cin>>N;
  vector<bool> A(55560,true);
  A[0]=false,A[1]=false;
  for(int i=2;i<=55555/i;i++){
    if(!A[i])continue;
    for(int j=i*2;j<=55555;j+=i)
      A[j]=false;
  }
  vector<int> B(0);
  for(int i=1;i<=55555;i+=5)
    if(A[i])B.push_back(i);
  for(int i=0;i<N;i++){
    cout<<B[i];
    if(i==N-1)
      cout<<'\n';
    else
      cout<<' ';
  }
}

Measured memory_bytes: 3556
/*
	author: Ibrahim-Elsayed (Codeforces Handle)
	date: 9/4/2020
*/

#include <bits/stdc++.h>
using namespace std;
#define pb push_back
typedef long long ll;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
const double PI = acos(-1);

template<class T> void PrintVector(T& vec) {
	cout << "\n";
	cout << "{";
	cout << vec[0];
	for(int i = 1; i < vec.size(); i++) {
		cout << ", " << vec[i];
	}
	cout << "}" << "\n";
}

ll BinExp(ll a, ll b) {
	ll res = 1;
	while(b > 0) {
		if(b&1) {
			res = res * a;
		}
		a = a*a;
		b >>= 1;
	}
	return res;
}

void solve() {
	int a, b, c;
	cin >> a >> b >> c;
	cout << ((c >= ((a+b-1)/b)) ? "Yes\n" : "No\n");
}

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

	solve();

	return 0;
}


Measured memory_bytes: 3612
#include <iostream>
using namespace std;
int main(){
    
    int N, sum = 0, mx = 0;
    cin >> N;
    for (int i = 0; i < N; i++){
        int x;
        cin >> x;
        sum += x;
        if(mx < x)mx = x;
    }
    if(sum - mx > mx)cout << "Yes" << endl;
    else cout << "No" << endl;
    
    return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>

#include <iostream>
#include <complex>
#include <string>
#include <algorithm>
#include <numeric>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>

#include <functional>
#include <cassert>

typedef long long ll;
using namespace std;

#ifndef LOCAL
#define debug(x) ;
#else
#define debug(x) cerr << __LINE__ << " : " << #x << " = " << (x) << endl;

template <typename T1, typename T2>
ostream &operator<<(ostream &out, const pair<T1, T2> &p) {
  out << "{" << p.first << ", " << p.second << "}";
  return out;
}

template <typename T>
ostream &operator<<(ostream &out, const vector<T> &v) {
  out << '{';
  for (const T &item : v) out << item << ", ";
  out << "\b\b}";
  return out;
}
#endif

#define mod 1000000007 //1e9+7(prime number)
#define INF 1000000000 //1e9
#define LLINF 2000000000000000000LL //2e18
#define SIZE 2010

char A[2][SIZE][SIZE];

int main(){
  int H, W;

  scanf("%d%d", &H, &W);

  for(int k=0; k<2; k++)
    for(int i=0; i<H; i++)
      scanf("%s", A[k][i]);

  int ans = 0;

  for(int i=0; i<H; i++) {
    for(int j=0;j<W; j++) {
      ans += A[0][i][j] != A[1][i][j];
    }
  }

  cout << ans << endl;

  return 0;
}



Measured memory_bytes: 10972
N,M = map(int,input().split())
if N==1 and M==1:
    ans = 1
elif N==1 or M==1:
    ans = max(N-2,M-2)
elif N==2 or M==2:
    ans = 0
else:
    ans = N*M-2*(N+M-2)
print(ans)

Measured memory_bytes: 38384
#include<bits/stdc++.h>
#define fi first
#define se second
#define rep(i, n) for(int (i) = 0; (i) < (n); (i)++)
#define rrep(i, n) for (int (i) = 1; (i) <= (n); (i++))
#define rng(a) a.begin(),a.end()
#define rrng(a) a.rbegin(),a.rend()
#define pb push_back
#define eb emplace_back
#define yn {puts("Yes");}else {puts("No");}
#define printd(x) printf("%.20f\n", x);
template<class T> bool chmin(T& a, const T& b) {if (a > b) {a = b; return 1;} return 0;}
template<class T> bool chmax(T& a, const T& b) {if (a < b) {a = b; return 1;} return 0;}
using namespace std;
using ll = long long;

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

	if (x >= 30)yn
	
	return 0;
}


Measured memory_bytes: 3592