akhauriyash/Code-Regression huggingface dataset:
#include<cstdio>
#include<algorithm>
#include<iostream>
#include<cstring>
using namespace std;
char field[101][101];
int dx[] = {1,-1,0,0},dy[] = {0,0,1,-1};
void func(int x,int y,char f){
	if(field[y][x] != f)return ;
	else field[y][x] = 0;
	for(int i = 0; i < 4; i++){
		int nx = x + dx[i],ny = y + dy[i];
		func(nx,ny,f);
	}
}
int main(){
	int h,w;
	while(cin >> h >> w,(h|w)){
		memset(field,0,sizeof(field));
		for(int i = 0; i < h; i++){
			scanf("%s",field[i]);
		}
		int cnt = 0;
		for(int i = 0; i < h; i++){
			for(int j = 0; j < w; j++){
				if(field[i][j] == 0)continue;
				cnt++;
				func(j,i,field[i][j]);
			}
		}
		printf("%d\n",cnt);
	}
	return 0;
}

Measured memory_bytes: 1652
#include <bits/stdc++.h>
#define FOR(i,a,b) for(ll i=(a);i<(b);++i)
#define rep(i,n) FOR(i,0,n)
#define all(x) (x).begin(),(x).end()
#define PRINT(V) cout << V << "\n"
#define SORT(V) sort((V).begin(),(V).end())
#define RSORT(V) sort((V).rbegin(), (V).rend())
using namespace std;
using ll = long long;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
const ll INF = 1e11;
int main(){
    string s;
    cin >> s;
    vector<int> a(30,0);
    rep(i,4){
        a[s[i] - 'A']++;
    }
    int c = 0;
    rep(i, 30)
    {
        if (a[i] == 2)
            c++;
    }
    if (c == 2)
        PRINT("Yes");
    else
        PRINT("No");
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cctype>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
using namespace std;
typedef long long unsigned int ll;

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define ALL(a)  (a).begin(),(a).end()

int main() {
    string s;
    cin>>s;
    bool flag=0;
    
    for(int i=0;i<s.size();i++){
        if(s[i]=='C')
            flag=1;
        if(s[i]=='F' && flag==1){
            cout<<"Yes"<<endl;
            return 0;
        }
    }
    cout<<"No"<<"\n";
    return 0;
}

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

int main() {
  int s, c=1, finish=0;
  cin >> s;
  vector<int> V;
  
  while (true) {
    V.push_back(s);
    if (s%2==0) {
      s/=2;
    }
    else {
      s=3*s+1;
    }
    c++;
    for (int i=0; i<(int)V.size(); i++) {
      if (V[i]==s) {
        finish=1;
        break;
      }
    }
    if (finish==1) {break;}
  }
  cout << c << endl;
}



Measured memory_bytes: 3568
function DoublyLink(value) {
    this.value = value;
    this.prev = null;
    this.next = null;
}

function DoublyLinkedList() {
    this.first = null;
    this.last = null;
}

DoublyLinkedList.prototype.insert = function(link) {
    if (this.first) {
        this.first.prev = link;
        link.next = this.first;
        this.first = link;
        return;
    }
    this.first = link;
    this.last = link;
};

DoublyLinkedList.prototype.delete = function(link) {
    var l = this.find(link);
    if (!l) {
        return;
    }
    var prev = l.prev;
    var next = l.next;

    if (l.prev) {
        l.prev.next = l.next;
        if (!l.next) {
            this.last = l.prev;
        }
    }
    if (l.next) {
        l.next.prev = l.prev;
        if (!l.prev) {
            this.first = l.next;
        }
    }
};

DoublyLinkedList.prototype.deleteFirst = function() {
    if (!this.first) {
        return;
    }
    if (!this.first.next) {
        this.first = null;
        this.last = null;
        return;
    }
    this.first.next.prev = null;
    this.first = this.first.next;
}

DoublyLinkedList.prototype.deleteLast = function() {
    if (!this.last) {
        return;
    }
    if (!this.last.prev) {
        this.first = null;
        this.last = null;
        return;
    }
    this.last.prev.next = null;
    this.last = this.last.prev;
}

DoublyLinkedList.prototype.find = function(link) {
    var l = this.first;
    while (l) {
        if (l.value === link.value) {
            return l;
        }
        l = l.next;
    }
    return null;
};

DoublyLinkedList.prototype.list = function() {
    var a = [];
    var l = this.first;
    while (l) {
        a.push(l);
        l = l.next;
    }
    return a;
};

(function(input) {
    var p = input.split('\n');
    var n = Number(p.shift());
    var cs = p.slice(0, n);
    var l = new DoublyLinkedList();
    cs.forEach(function(e) {
        l = command(l, e);
    });
    //console.log(l.list());
    console.log(l.list().map(function(e) {
        return e.value;
    }).join(' '));
})(require('fs').readFileSync('/dev/stdin', 'utf8'));

function command(list, c) {
    var a = c.split(' ');
    var com = a.shift();
    var arg = Number(a.shift());
    switch (com) {
        case 'insert':
            var l = new DoublyLink(arg);
            list.insert(l);
            break;
        case 'delete':
            var l = new DoublyLink(arg);
            list.delete(l);
            break;
        case 'deleteFirst':
            list.deleteFirst();
            break;
        case 'deleteLast':
            list.deleteLast();
            break;
    }
    return list;
}

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

using namespace std;

int main()
{
  vector<vector<int> >a(3, vector<int> (3));
  for(int i = 0; i < 3; i++) for(int j = 0; j < 3; j++)
    cin >> a[i][j];
  int n; cin >> n;
  for(int i = 0; i < n; i++)
  {
    int b; cin >> b;
    for(int j = 0; j < 3; j++) for(int k = 0; k < 3; k++)
    if(a[j][k] == b) a[j][k] = -1;
  }
  string ans = "No";
  for(int i = 0; i < 3; i++)
    if(a[i][0] == -1 && a[i][1] == -1 && a[i][2] == -1)
      ans = "Yes";
  for(int i = 0; i < 3; i++)
    if(a[0][i] == -1 && a[1][i] == -1 && a[2][i] == -1)
      ans = "Yes";
  if(a[0][0] == -1 && a[1][1] == -1 && a[2][2] == -1)
    ans = "Yes";
  if(a[0][2] == -1 && a[1][1] == -1 && a[2][0] == -1)
    ans = "Yes";
  cout << ans;

  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include <iostream>
#include <string>
using namespace std;
#define ll long long
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
#define FORR(i,a,b)for(ll i=(a);i<=(b);i++)
#define repR(i,n) for(ll i=n;i>=0;i--)
#define all(v)(v).begin(),(v).end()
#define rall(v)(v).rbegin(),(v).rend()
#define F first
#define S second
#define pb push_back
#define pu push
#define COUT(x) cout<<(x)<<endl
#define PQ priority_queue<ll>
#define PQR priority_queue<ll,vector<ll>,greater<ll>>
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define mp make_pair
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define sz(x) (int)(x).size()
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
const ll MOD = 1000000007LL;
const ll INF = 1LL << 60;
using vll = vector<ll>;
using vvll = vector<vll>;
using vstr = vector<string>;
using pll = pair<ll, ll>;
int main(){
  ll a,b,c;
  cin>>a>>b>>c;
  vll f(3);
  f[0]=a;
  f[1]=b;
  f[2]=c;
  sort(all(f));
  ll ans=0;
  ll s=f[2]-f[1];
  ll m=f[2]-f[0];
  if((s+m)%2==0){
    ans+=s;
    m-=s;
    ans+=m/2;
  }
  else{
    ans+=s;
    m-=s;
    ans+=(m+1)/2+1;
  }
  COUT(ans);
}

Measured memory_bytes: 256
/*
 *      ┌─┐       ┌─┐ + +
 *   ┌──┘ ┴───────┘ ┴──┐++
 *   │                 │
 *   │       ───       │++ + + +
 *   ███████───███████ │+
 *   │                 │+
 *   │       ─┴─       │
 *   │                 │
 *   └───┐         ┌───┘
 *       │         │
 *       │         │   + +
 *       │         │       Code is far away from bug with the animal protecting
 *       │         └──────────────┐
 *       │                        │
 *       │                        ├─┐
 *       │                        ┌─┘
 *       │                        │
 *       └─┐  ┐  ┌───────┬──┐  ┌──┘  + + + +
 *         │ ─┤ ─┤       │ ─┤ ─┤
 *         └──┴──┘       └──┴──┘  + + + +
 *                神兽保佑
 *               代码无BUG!
 */

#include<bits/stdc++.h>
using namespace std;
class IN{
public:
    template<typename T>
    IN& operator >>(T &x){read(x);return *this;}
    IN& operator >>(double &x){scanf("%lf",&x);return *this;}
    IN& operator >>(char *s){scanf("%s",s);return *this;}
    IN& operator >>(char &c){c=getchar();return *this;}
private:
    template<typename T>
    void read(T &x){
        T f=1;int c=getchar();x=0;
        while(c<'0'||c>'9'){if(c=='-')f=-1;c=getchar();}
        while(c>='0'&&c<='9')x=(x<<3)+(x<<1)+(c^48),c=getchar();
        x*=f;
    }
}in;
class NL{}nl;
class BK{}bk;
class OUT{
public:
    template<typename T>
    OUT& operator <<(T x){write(x);return *this;}
    OUT& operator <<(const char *s){printf("%s",s);return *this;}
    OUT& operator <<(char c){putchar(c);return *this;}
    OUT& operator <<(BK x){putchar(' ');return *this;}
    OUT& operator <<(NL x){putchar('\n');return *this;}
private:
    template<typename T>
    void write(T x){
        if(x<0)putchar('-'),x=-x;
        if(x>=10)write(x/10);
        putchar(x%10+48);
    }
}out;

#define pb(x) push_back(x)
#define fi first
#define se second
#define rep(i,a,n) for(int i=a;i<=n;++i)
#define per(i,n,a) for(int i=n;i>=a;--i)
#define mem(a,x) memset(a,x,sizeof(a))
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> PI;
typedef pair<ll,ll> PL;
typedef vector<int> VI;
typedef vector<ll> VL;
/*****************************************************************************************************/
ll Pow(ll a,ll b,ll mod){ll res=1;a%=mod;while(b){if(b&1)(res*=a)%=mod;(a*=a)%=mod;b>>=1;}return res%mod;}
ll inv(ll a,ll p){if(a==1)return 1;return (p-p/a)*inv(p%a,p)%p;}//p为素数,a<p
ll C(ll n,ll m,ll p){ll res=1;for(ll i=1,j=n-m+1;i<=m;++i,++j){res=res*inv(i,p)%p*j%p;}return res;}
/*****************************************************************************************************/
/*ll ask(int x){ll res=0;while(x)res+=c[x],x-=x&-x;return res;}
void add(ll v,int x){while(x<=n)c[x]+=v,x+=x&-x;}*/
const int p=1e9+7;
const int N=2e5+10;
char s[N];

int main(){
    in>>s;
    s[3]='\0';
    puts(s);
    return 0;
}


Measured memory_bytes: 3764
//#define _GLIBCXX_DEBUG

#include<bits/stdc++.h>
#define PI 3.14159265359
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
const int INF= 1e9+5;
typedef long long ll;
typedef vector<int> vi;
typedef vector<vector<int>>vvi;

int main(){
  int n;
  cin>>n;
  vector<ll>a(n);
  rep(i,n)cin>>a[i];
  rep(i,n)a[i]-=i+1;
  sort(a.begin(),a.end());
  ll med,mednext;
  if(n%2==1)med=a[n/2];
  else med=(a[n/2]+a[n/2-1])/2,mednext=(a[n/2]+a[n/2-1])/2+1;
  ll ans=0;
  rep(i,n){
    ans+=abs(a[i]-med);
  }
  if(n%2==0){
    ll nextans=0;
    rep(i,n){
      nextans+=abs(a[i]-mednext);
    }
    ans=min(nextans,ans);
  }
      
  cout<<ans<<endl;
}
    

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

using namespace std;

bool IsPrime(int num)
{
    if (num < 2) return false;
    else if (num == 2) return true;
    else if (num % 2 == 0) return false; // 偶数はあらかじめ除く

    double sqrtNum = sqrt(num);
    for (int i = 3; i <= sqrtNum; i += 2)
    {
        if (num % i == 0)
        {
            // 素数ではない
            return false;
        }
    }

    // 素数である
    return true;
}
int main(){
int X,l=0;
cin >> X;
if (X == 2)
{
  cout << 2;
}
else{
while(1){
if (IsPrime(X+l))
{
 cout<< X+l;
 break;
}
else{
  l++;
}

}


}



}

Measured memory_bytes: 256
import java.util.ArrayList;
import java.util.Arrays;
import java.util.LinkedList;
import java.util.List;
import java.util.Queue;
import java.util.Scanner;

//Mysterious Onslaught
public class Main{

	int[] d;
	int res, M = (0x1f)<<20;
	List<Integer>[] mask;
	
	void f(int S, int depth, int k){
		if((S&M)==0){
			res = Math.min(res, depth+d[S]);
			return;
		}
		if(res<=depth+d[(0xfffff)&S]|| k==5)return;
		for(int m:mask[k]){
			f(S^m, depth+1, k+1);
		}
		f(S, depth, k+1);
	}
	
	@SuppressWarnings("unchecked")
	void run(){
		d = new int[1<<20];
		int INF = 1<<28;
		Arrays.fill(d, INF);
		d[0] = 0;
		Queue<Integer> q = new LinkedList<Integer>();
		q.add(0);
		while(!q.isEmpty()){
			int S = q.poll();
			for(int i=0;i<4;i++)for(int j=0;j<5;j++)for(int h=i;h<4;h++)for(int w=j;w<5;w++){
				int ns = S;
				for(int y=i;y<=h;y++)for(int x=j;x<=w;x++)ns^=1<<(y*5+x);
				if(d[ns]==INF){
					d[ns] = d[S]+1;
					q.add(ns);
				}
			}
		}
		mask = new List[5];
		for(int j=0;j<5;j++){
			mask[j] = new ArrayList<Integer>();
			for(int h=4;h>=0;h--)for(int w=j;w<5;w++){
				int m = 0;
				for(int y=4;y>=h;y--)for(int x=j;x<=w;x++)m+=1<<(y*5+x);
				mask[j].add(m);
			}
		}
		Scanner sc = new Scanner(System.in);
		for(;;){
			int n = sc.nextInt();
			if(n==0)break;
			int x = 0;
			for(int i=0;i<n;i++)for(int j=0;j<n;j++)if(sc.nextInt()==1)x|=1<<(i*5+j);
			res = 9;
			if(n<=4)res=d[x];
			else f(x, 0, 0);
			while(res--!=0)System.out.print("myon");
			System.out.println();
		}
	}
	
	public static void main(String[] args) {
		new Main().run();
	}
}

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

int n,m;
int MAXIMUM=200000;
long INF = 1e18+7;
// W:未訪問
// G:訪問する候補
// B:訪問済み
int W=0,G=1,B=2;
vector<pair<long,long>> adj[200000];

int dijkstra(){
  priority_queue<pair<long,long>> PQ;
  long u;
  long d[MAXIMUM],color[MAXIMUM];
  // d[n]:Tに属する頂点と V - T に属する頂点をつなぐ辺の中で重みが最小の辺の重みを記録

  //初期化
  for(int i=0;i<n;i++){
    d[i]=INF;
    color[i]=W;
  }

  d[0]=0;
  PQ.push(make_pair(0,0));
  color[0] = G;

  while (!PQ.empty()) {
    pair<long,long> f = PQ.top();
    PQ.pop();
    u = f.second;
    // 頂点を訪問済に
    color[u] = B;
    //最小値を取り出し、それが最短でなければ無視
    if( d[u]<f.first*(-1)) continue;

    //訪問済みでないかつ辺がつながっている頂点の中でコストが最小の辺を選択
    for(int j=0;j<adj[u].size();j++){
      long v = adj[u][j].first;
      if(color[v]== B) continue;
      if(d[v]>d[u]+adj[u][j].second){
        d[v]=d[u]+adj[u][j].second;
        PQ.push(make_pair(d[v]*(-1),v));
        color[v]=G;
      }
    }
  }


    if(d[n-1]!=INF) cout<<d[n-1]<<endl;
    else cout<<-1<<endl;

}

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

  for(int i=0;i<m;i++){
    int l,r,c;
    cin>>l>>r>>c;
      adj[l-1].push_back(make_pair(r-1,c));
  }

  // d1<=d2<=...<=dn　
  // 1戻ることをコスト0とする
  // 1->3のコストが2であれば 1->2(1->3->2)のコストも2とできる
  // l->rのコストがcであれば　l->k(l<k<r)のコストもcとできる
  for(int i=1;i<n;i++){
      adj[i].push_back(make_pair(i-1,0));
  }

  dijkstra();

}


Measured memory_bytes: 12540
#include <stdio.h>
#include <stdlib.h>

#define MAX 1000

void initialize();
int isEmpty();
int isFull();
void  push(int x);
int pop();

int top;
int S[1000];

int main()
{
  int i,n,ans,n1,n2,n3;
  char c[100];

  initialize();

  while(1){
    if(scanf("%s",c)==EOF) break;

    if(c[0]=='+' || c[0]=='-' ||c[0]=='*'){
      n1 = pop();
      n2 = pop();
      if(c[0]=='+') n3 = n1 + n2;
      if(c[0]=='-') n3 = n2 - n1;
      if(c[0]=='*') n3 = n1 * n2;
      push(n3);
    }
      else{
	n = atoi(c);
	push(n);
      }
    }

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

  void initialize(){
    top = 0;
  }

  int isEmpty(){
    return top == 0;
  }

  int isFull(){
    return top >= MAX - 1;
  }

  void  push(int x){
    if (isFull()) fprintf(stderr,"overflow\n");
    top++;
    S[top] = x;
  }

  int pop(){
    if (isEmpty()) fprintf(stderr,"underflow\n");
    top--;
    return S[top+1];
  }

Measured memory_bytes: 984
package main

import (
	"fmt"
	"sort"
)

func main() {
	var n, h int
	fmt.Scan(&n, &h)
	b := make([]int, n)
	var a int
	maxA := 0
	for i := 0; i < n; i++ {
		fmt.Scan(&a, &b[i])
		if maxA < a {
			maxA = a
		}
	}
	sort.Sort(sort.Reverse(sort.IntSlice(b)))

	ans := 0
	for i := 0; i < n; i++ {
		bb := b[i]
		if bb <= maxA || h <= 0 {
			break
		}
		h -= bb
		ans++
	}
	if h > 0 {
		ans += (h + maxA - 1) / maxA
	}
	fmt.Println(ans)
}


Measured memory_bytes: 5504
a,b = list(map(int,input().split()))

a1 = str(a)
b1 = str(b)
a_b_1 = a1+b1
a_b = int(a_b_1)

for i in range(1,400):
    if a_b == i*i:
        print("Yes")
        exit()
print("No")

Measured memory_bytes: 3060
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <stack>
#include <queue>
#include <set>
#include <map>
using namespace std;

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

	if(A*B<C) cout << A*B << endl;
	if(A*B>C) cout << C << endl;
	if(A*B == C) cout << A*B << endl;
}

Measured memory_bytes: 256
import java.util.*;
public class Main {
    public static void main(String[] args) {
        Scanner s = new Scanner(System.in);
        long a = s.nextLong();
        long b = s.nextLong();
        long c = s.nextLong();
        long k = s.nextLong();
        long ans = 0;
        if(k >= (a+b)) {
            ans = a-(k-(a+b));
        } else if(k >= a) {
            ans = a;
        } else {
            ans = k;
        }
        System.out.println(ans);
    }
}


Measured memory_bytes: 35660
#include<stdio.h>

int main(){

	int N;
	long long Power=1;
	long long a = 1000000007;	
	long long b = 1;
	int threshold = 1;

	scanf("%d",&N);
/*	while(b <= a){
		b = b*threshold;
		threshold++;
	}

	printf("d",threshold);

	if(N <= threshold){*/

		for(int i=1; i<=N; i++){
			Power =  i * (Power % a);
		}

	printf("%d",Power % a);



	return 0;


}

Measured memory_bytes: 128
/****Author: Barish Namazov****/
#include <bits/stdc++.h>

using namespace std;

/***TEMPLATE***/
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()

#define F first
#define S second
#define pb push_back

#define endl '\n'

const int max4 = 10004;
const int maxx = 100005;
const int max6 = 1000006;
const int lg5 = 17;

const int INF = 2 * 1000000007;
const long long INFLL = 4LL * 1000000000 * 1000000000;

/***************/

int powmod (int a, int b, int mod) {
    int res = 1; a %= mod;
    for (; b; b >>= 1) {
        if (b & 1) {
            res = 1LL * res * a % mod;
        }
        a = 1LL * a * a % mod;
    }
    return res;
}
#define ll long long
ll gcd (ll a, ll b) {
    while (b > 0) {
        ll t = a % b;
        a = b, b = t;
    }
    return a;
}

int lcm (int a, int b) {
    return (a / gcd (a, b)) * b;
}

int is_prime (int n) {
    if (n <= 1 || n > 3 && (n % 2 == 0 || n % 3 == 0))
        return 0;
    for (int i = 5, t = 2; i * i <= n; i += t, t = 6 - t)
        if (n % i == 0)
            return 0;
    return 1;
}

/******Don't forget to use long long when needed!!******/

int main() {
    //freopen("in.txt","r",stdin);
    //freopen("out.txt","w",stdout);
    ios_base :: sync_with_stdio(0);
    cin.tie(0), cout.tie(0);
    int n, x; long long now = 0, res = 0;
    cin >> n;
    for (int i = 1; i <= n; i++) {
        cin >> x;
        if (x == 0) {
            res += now / 2;
            now = 0;
        } else {
            now += x;
        }
    } res += now / 2;
    cout << res << endl;
    return 0;
}


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

#define REP(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
#define ALL(c) c.begin(), c.end()
#define SZ(c) (int) c.size()
#define DBG1(x) cout<<#x<<" = "<<x<<"\n"
#if USE_CP_REDIR
#define CP \
    freopen("input.txt","r", stdin); \
    freopen("output.txt","w", stdout);
#endif

using ll = long long;
const ll MOD = 1'000'000'007;
const int MN = 1'000'000;

int main()
{
ios::sync_with_stdio(false);
#ifdef CP
    CP;
#endif
    double D, T, S;
    cin >> D >> T >> S;
    if(D/S <= T) cout << "Yes" << endl;
    else cout << "No" << endl;
}

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

int main(){
    int n;
    cin >> n;
    if(n < 30) cout << "No" << endl;
    else cout << "Yes" << endl;
    return 0;
}

Measured memory_bytes: 3632
const int LG = 21;
const int FN = 400005;
const long long MOD = 1e9 + 7;
const long long INF = 1e9;
const long long INFLL = 1e18;

#include <bits/stdc++.h>

const double PI = acos(-1);

using namespace std;

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

#define forn(i, n) for (int (i) = 0; (i) != (n); (i)++)
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define popcount(x) __builtin_popcount(x)
#define popcountll(x) __builtin_popcountll(x)
#define fi first
#define se second
#define re return
#define pb push_back
#define uniq(x) sort(all(x)); (x).resize(unique(all(x)) - (x).begin())

#ifdef LOCAL
#define dbg(x) cerr << __LINE__ << " " << #x << " " << x << endl
#define ln cerr << __LINE__ << endl
#else
#define dbg(x) void(0)
#define ln void(0)
#endif // LOCAL

int cx[4] = {-1, 0, 1, 0};
int cy[4] = {0, -1, 0, 1};
string Yes[2] = {"No", "Yes"};
string YES[2] = {"NO", "YES"};
string Psb[2] = {"Impossible", "Possible"};
string psb[2] = {"impossible", "possible"};

ll inq(ll x, ll y)
{
    if (!y) re 1 % MOD;
    ll l = inq(x, y / 2);
    if (y % 2) re l * l % MOD * x % MOD;
    re l * l % MOD;
}

ll rev(ll x)
{
    return inq(x, MOD - 2);
}

bool __precomputed_combinatorics = 0;
vector<ll> __fact, __ufact, __rev;

void __precompute_combinatorics()
{
    __precomputed_combinatorics = 1;
    __fact.resize(FN);
    __ufact.resize(FN);
    __rev.resize(FN);
    __rev[1] = 1;
    for (int i = 2; i < FN; i++) __rev[i] = MOD - __rev[MOD % i] * (MOD / i) % MOD;
    __fact[0] = 1, __ufact[0] = 1;
    for (int i = 1; i < FN; i++) __fact[i] = __fact[i - 1] * i % MOD, __ufact[i] = __ufact[i - 1] * __rev[i] % MOD;
}

ll fact(int x)
{
    if (!__precomputed_combinatorics) __precompute_combinatorics();
    return __fact[x];
}

ll cnk(int n, int k)
{
    if (k < 0 || k > n) return 0;
    if (!__precomputed_combinatorics) __precompute_combinatorics();
    return __fact[n] * __ufact[n - k] % MOD * __ufact[k] % MOD;
}

int ok(int x, int n)
{
    return 0 <= x && x < n;
}

signed main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    string s;
    ll k;
    cin >> s >> k;
    k--;
    if (k < s.size())
    {
        for (int i = 0; i <= k; i++)
        {
            if (s[i] != '1')
            {
                cout << s[i];
                return 0;
            }
        }
        cout << '1';
        return 0;
    }
    for (int i = 0; i < s.size(); i++)
    {
        if (s[i] != '1')
        {
            cout << s[i];
            return 0;
        }
    }
}

/* Note:
Check constants at the beginning of the code.
    N is set to 4e5 but be careful in problems with large constant factor.
    Setting N in every problem is more effective.
Check corner cases.
    N = 1
No def int long long for now.
Add something here.
*/


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm> // sort
#include <map> // pair
#include <numeric> // accumulate(begin,end,初期値)
#include <string>
#include <cstdio>
#include <queue>
#include <stack>
#include <set>
#include <cmath>

typedef long long ll;
using namespace std;

#define FALSE printf("false\n");
#define TRUE printf("true\n");
#define all(x) (x).begin(),(x).end()
#define print(x) cout<<x<<endl
#define rep(i,n) for(int i = 0;i < ((int)(n));++i)
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define SUM(vec) accumulate(all(vec),0)
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );
#define test(a) cout<<#a<<':'<<a<<endl

const ll INF = 1e9+7;

// 各桁の和
template<typename T>inline T digit(T num){T sum = 0;while(num){sum+=num%10;num/=10;}return sum;}
template<typename T>inline T gcd(T a,T b){if(b == 0)return a;return gcd(b,a%b);}
template<typename T>inline T lcm(T a, T b){T g = gcd(a,b);return a/g*b;}
template<typename T>inline T power(T a,T b){T tmp=1;rep(i,b){tmp*=a;}return tmp;}

int main() {
  cin.tie(0); ios::sync_with_stdio(0);
  int n;cin>>n;
  vector<int> a(n);rep(i,n)cin>>a[i];
  sort(all(a));
  
  int cnt = 0;
  int ans = 0;
  rep(i,n){
    cnt++;
    if((i == n-1) || a[i] != a[i+1]){
      int plus = cnt - a[i];
      if(plus < 0)plus = cnt;
      ans += plus;
      cnt = 0;
    }
  }
  print(ans);
  return 0;
} 

Measured memory_bytes: 640
#include <iostream>

using namespace std;

int main(int argc, char *argv[]) {
	char c;
	cin >> c;
	if (c == 'a' || c == 'o' || c == 'u' || c == 'e' || c == 'i') cout << "vowel" << endl;
	else cout << "consonant" << endl;
	return 0;
}

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

using namespace std;

int player[5];

int main()
{	
	while (cin >> player[0], player[0]){
		int a[2] = {0}, j = 0;
		int check[4] = {1, 1, 1, 1};

		check[player[0]] = -1;
		for (int i = 1; i < 5; i++){
			cin >> player[i];
			check[player[i]] = -1;
		}
		for (int i = 1; i < 4; i++){
			check[0] *= check[i];
			if (check[i] == -1){
				a[j++] = i;
			}
		}
		if (check[0] == -1){
			for (int i = 0; i < 5; i++){
				player[i] = 3;
			}
		}
		else if (check[3] == -1 && check[1] == -1){
			for (int i = 0; i < 5; i++){
				if (player[i] == 3)	player[i] = 1;
				else	player[i] = 2;
			}
		}
		else {
			for (int i = 0; i < 5; i++){
				if (player[i] == min(a[0], a[1]))	player[i] = 1;
				else 	player[i] = 2;
			}
		}
		for (int i = 0; i < 5; i++){
			cout << player[i] << endl;
		}
	}
	return (0);
}

Measured memory_bytes: 1160
#include <iostream>
#include<string>
#include<cstdio>
using namespace std;
int main(void){
    bool b[101]={};
    int n,d;
    int count=0;
    cin>>n;
    for(int i=0;i<n;i++){
        cin>>d;
        if(!b[d]){b[d]=1;count++;}
    }
    cout<<count<<endl;
    return 0;
}


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

int main() {
    int n, d, count;
    cin >> n >> d;

    n -=(2 * d + 1);
    count = 1;
    while(n > 0){
        n -= (2 * d + 1);
        count++;
    }
    cout << count << endl;
    return 0;
}

Measured memory_bytes: 256
package main

import "fmt"

func main() {
	var a, b, c, k int
	fmt.Scan(&a, &b, &c, &k)

	ans := 0
	if k <= a {
		ans += k
		fmt.Println(ans)
		return
	}
	ans += a
	k -= a
	if k <= b {
		fmt.Println(ans)
		return
	}
	k -= b
	ans -= k
	fmt.Println(ans)
}


Measured memory_bytes: 1756
//include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <fstream>
#include <complex>
#include <math.h>
#include <ctype.h>
using namespace std;

//conversion
//------------------------------------------
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

//math
//-------------------------------------------
template<class T> inline T sqr(T x) {return x*x;}

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef pair<long, long> PLL;
typedef long long LL;
//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())

//repetition
//------------------------------------------
#define FOR(i,a,b) for(long i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)

//constant
//--------------------------------------------

//clear memory
#define CLR(a) memset((a), 0 ,sizeof(a))

const long double EPS = 1e-12;
const double INF = 1e12;


int main(){
	string str;
	getline(cin,str);
	REP(i,SZ(str))str[i]=toupper(str[i]);
	cout<<str<<endl;
	return 0;
}

Measured memory_bytes: 1176
#include <iostream>
#include <set>
#include <vector>
#include <string>
using namespace  std;

void fnDictionary(set<string> &a_rsesKey, vector<string> &a_rvsFind)
{
  int iCommandCnt;
  cin >> iCommandCnt;

  for (int i = 0; i < iCommandCnt; i++)
  {
    string sCommand;
    string sKey;
    cin >> sCommand >> sKey;

    if (sCommand[0] == 'i')
      a_rsesKey.insert(sKey);
    else if (sCommand[0] == 'f')
    {
      auto itsesKey = a_rsesKey.find(sKey);
      if (itsesKey != end(a_rsesKey))
        a_rvsFind.push_back("yes");
      else
        a_rvsFind.push_back("no");
    }
  }
}

void fnResult(const vector<string> &a_cnrvsFind)
{
  for (int i = 0; i < a_cnrvsFind.size(); i++)
    cout << a_cnrvsFind[i] << endl;
}

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

  set<string> sesKey;
  vector<string> vsFind;

  fnDictionary(sesKey, vsFind);
  fnResult(vsFind);
  
  return 0;
}

Measured memory_bytes: 50624
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

const (
	defaultBufferSize = 1024
	maxBufferSize     = 1e6
	Mod               = 1e9 + 7
)

var sc = bufio.NewScanner(os.Stdin)

// sc.Buffer(make([]byte, defaultBufferSize), maxBufferSize)

func readInt() int {
	sc.Scan()
	i, err := strconv.Atoi(sc.Text())
	if err != nil {
		panic(err)
	}
	return i
}

func readString() string {
	sc.Scan()
	return sc.Text()
}

func readInt64() int64 {
	sc.Scan()
	i, err := strconv.ParseInt(sc.Text(), 10, 64)
	if err != nil {
		panic(err)
	}
	return int64(i)
}

func readfloat64() float64 {
	sc.Scan()
	f, err := strconv.ParseFloat(sc.Text(), 64)
	if err != nil {
		panic(err)
	}
	return f
}

func abs(a int) int {
	if a < 0 {
		return a * -1
	}
	return a
}

func min(a, b int) int {
	if a < b {
		return a
	}
	return b
}

func max(a, b int) int {
	if a > b {
		return a
	}
	return b
}

func gcd(x, y int) int {
	if y == 0 {
		return x
	}
	return gcd(y, x%y)
}

func ModComb(n, k int) int {
	if k == 0 {
		return 1
	}
	x, y := n, k
	for i := 1; i < k; i++ {
		x = x * (n - i) % Mod
		y = y * (k - i) % Mod
	}
	inv := ModInv(y)
	return x * inv % Mod
}

func ModFact(x int) int {
	fact := 1
	for i := 1; i <= x; i++ {
		fact = fact * i % Mod
	}
	return fact
}

func ModInv(x int) int {
	return ModPow(x, Mod-2)
}

func ModPow(a, n int) int {
	res := 1
	for n > 0 {
		if n%2 != 0 {
			res = res * a % Mod
		}
		a = a * a % Mod
		n /= 2
	}
	return res
}

func pow(a, n int) int {
	if n == 0 {
		return 1
	}

	ans := 0
	if n%2 == 0 {
		ans = pow(a*a, n/2)
	} else {
		ans = a * pow(a*a, (n-1)/2)
	}
	return ans
}

func intSliceReverse(slice []int) []int {
	for i, j := 0, len(slice)-1; i < j; i, j = i+1, j-1 {
		slice[i], slice[j] = slice[j], slice[i]
	}
	return slice
}

func stringReverse(str string) string {
	runes := []rune(str)
	for i, j := 0, len(runes)-1; i < j; i, j = i+1, j-1 {
		runes[i], runes[j] = runes[j], runes[i]
	}
	return string(runes)
}

func primeFactorization(x int) map[int]int {
	result := make(map[int]int, 0)
	for i := 2; i*i <= x; i++ {
		for x%i == 0 {
			result[i]++
			fmt.Println(x)

			x /= i
		}
	}
	if x != 1 {
		result[x]++
		fmt.Println(x)
	}
	return result
}

func isPrime(x int) bool {
	if x == 1 {
		return false
	}
	for i := 2; i*i <= x; i++ {
		if i == x {
			continue
		}
		if x%i == 0 {
			return false
		}
	}
	return true
}

func main() {
	sc.Split(bufio.ScanWords)
	n := readInt()

	a := make([]int, n)
	max := 0
	for i := 0; i < n; i++ {
		a[i] = readInt()
		if a[i] > max {
			max = a[i]
		}
	}
	count := make([]int, max+1)

	for _, ai := range a {
		for j := ai; j <= max; j += ai {
			count[j]++
		}
	}

	ans := 0
	for _, ai := range a {
		if count[ai] == 1 {
			ans++
		}
	}
	fmt.Println(ans)
}


Measured memory_bytes: 13108
from scipy.special import comb
ans=0
N,A,B=map(int,input().split())
L=list(map(int,input().split()))
#Aこの平均でよい
L=sorted(L,reverse=True)
if len(set(L))==1:
  print(L[0])
  for i in range(A,B+1):
    ans+= comb(N, i, exact=True)
  print(ans)
  exit()
print(sum(L[:A])/A)
R=list(L[:A])
c=L[A-1]
if len(set(R))==1:
  n=L.count(c)
  for i in range(A,min(n,B)+1):
    ans+= comb(n, i, exact=True)
  print(ans)
  exit()
a=L.count(c)
b=R.count(c)
print(comb(a,b,exact=True))

Measured memory_bytes: 42244
#include <bits/stdc++.h>
 
using namespace std;
int a[200005],lef[200005],rig[200005],pos[200005];
typedef long long ll;
int main() {
  int n;
 scanf("%d",&n);
    int i,x;
    for(i=1;i<=n;i++)
        {
        scanf("%d",&a[i]);
        pos[a[i]] = i;
    }
    for(i=0;i<=n+1;i++)
        {
        lef[i] = i-1;
        rig[i] = i+1;
    }
    ll ans = 0;
    for(i=n;i>=1;i--)
        {
        x = pos[i];
        ll fir,sec;
        fir = x - lef[x];
        sec = rig[x] - x;
        ans += i*fir*sec;
        rig[lef[x]] = rig[x];
        lef[rig[x]] = lef[x];
    }
    printf("%lld\n",ans);
  return 0;
}

Measured memory_bytes: 3328
#include <iostream>
#include <iomanip>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <algorithm>
#include <math.h>
#include <sstream>
#include <numeric>
#include <string>
#include <cassert>
#include <bitset>

using namespace std;
typedef long long ll;

int main() {
  int N;
  string S;
  cin >> N >> S;
  ll R = 0;
  ll G = 0;
  ll B = 0;
  for (int i = 0; i < N; ++i) {
    if (S[i] == 'R') ++R;
    else if (S[i] == 'G') ++G;
    else ++B;
  }
  ll ans = R * G * B;
  for (int i = 0; i < N; ++i) {
    for (int j = i + 1; j < N; ++j) {
      if (S[i] != S[j]) {
	int k = j + (j - i);
	if (k < N and (S[k] != S[i] and S[k] != S[j])) --ans;
      }
    }
  }
  cout << ans << endl;
  return 0;
}


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

int main()
{
  int64_t a;
  long double b;
  cin >> a >> b;
  
  int64_t b100 = (int64_t)(b * 100 + 0.001);
  
  cout << (int64_t)(a * b100) / 100 << endl;
}

Measured memory_bytes: 3712
#include <stdio.h>
#include "bits/stdc++.h"
using namespace std;
#define Rep(i,n) for(int i=0;i<(int)(n);i++)
#define For(i,n1,n2) for(int i=(int)(n1);i<(int)(n2);i++)
#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define RREP(i,n) for(ll i=((ll)(n)-1);i>=0;i--)
#define FOR(i,n1,n2) for(ll i=(ll)(n1);i<(ll)(n2);i++)
#define put(a) cout<<a<<"\n"
#define all(a)  (a).begin(),(a).end()
#define SORT(a) sort((a).begin(),(a).end())
#define oorret 0
#define oor(x) [&](){try{x;} catch(const out_of_range& oor){return oorret;} return x;}()
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> P;
template<typename T1,typename T2> inline bool chmin(T1 &a,T2 b){if(a>b){a=b;return 1;}return 0;}
template<typename T1,typename T2> inline bool chmax(T1 &a,T2 b){if(a<b){a=b;return 1;}return 0;}

void dfs(vector<vector<int>>& p, vector<int>& d,int pos,int dis=0){
    d[pos]=dis;
    REP(i,p[pos].size()){
        int to = p[pos][i];
        if(d[to]==INT_MAX){
            dfs(p,d,to,dis+1);
        }
    }
}

int diam(vector<vector<int>>& p,int n){
    int res;
    vector<int> d(n,INT_MAX);
    dfs(p,d,0);
    int maxd = *max_element(all(d));
    auto itr = find(all(d),maxd);
    int index = itr-d.begin();
    /*Rep(i,n){
        if(chmax(maxd, d[i])){
            index = i;
        }
    }*/
    vector<int> d2(n,INT_MAX);
    dfs(p,d2,index);
    res = *max_element(all(d2));
    return res;
}

int main(){
    int n;
    cin >> n;
    vector<int> a(n-1);
    vector<int> b(n-1);
    vector<vector<int>> p(n);
    REP(i,n-1){
        cin >> a[i] >> b[i];
        a[i]--;
        b[i]--;
        p[a[i]].push_back(b[i]);
        p[b[i]].push_back(a[i]);
    }
    int di = diam(p,n);
    if(di%3==1){
        put("Second");
    }else{
        put("First");
    }
    return 0;
}


Measured memory_bytes: 23680
# -*- coding: utf-8 -*-
"""



"""
import sys


def solve(N, M, cards):
    left, right = 1, N
    for l, r in cards:
        if l > left:
            left = l
        if r < right:
            right = r

    return max(0, right-left+1)


def main(args):
    N, M = map(int, input().split())
    cards = [[int(i) for i in input().split()] for _ in range(M)]
    ans = solve(N, M, cards)
    print(ans)


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


Measured memory_bytes: 21136
#include<iostream>
#include<vector>
#include<algorithm>
#include<iomanip>
#include<utility>
#include<iomanip>
#include<map>
#include<cmath>
#include<cstdio>
#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(){
    string n;
    cin >> n;
    int man= (n.size()+1)/2;
    for(int i=0; i<man/2;i++){
        if(n[i] != n[(man-2-i)]){
            cout << "No" << endl;
            return 0;
        }
        if(n[(man+i)] != n[n.size()-1-i]){
            cout << "No" << endl;
            return 0;
        }
    }
    for(int i=0;i<(n.size()+1)/2;i++){
        if(n[i] != n[n.size()-1-i]){
            cout << "No" << endl;
            return 0;
        }
    }
    cout << "Yes" << endl;
    return 0;
}

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

long gcd(long a, long b) {
    if (b == 0)
        return a;

    return gcd(b, a % b);
}

long lcm(long a, long b) {
    return a * b / gcd(a, b);
}



int main() {
  long a,b,c,d;
  cin >> a>>b>>c>>d;
  //long count=0;
  //for(long i=a;i<=b;i++){
  //  if (i%c!=0 && i%d!=0) count++;
  //}
  long divc = b/c - (a-1)/c;
  long divd = b/d - (a-1)/d;
  long cd = lcm(c,d);
  long divcd = b/(cd) - (a-1)/(cd);

 //cout<<divc<<endl;
  //cout<<divd<<endl;
  //cout<<divcd<<endl;


  long ans= (b-a+1) -(divc+divd-divcd);

cout<<ans<<endl;
  }


Measured memory_bytes: 256
// Template
#include <bits/stdc++.h>
#define rep_override(x, y, z, name, ...) name
#define rep2(i, n) for (int i = 0; i < (n); ++i)
#define rep3(i, l, r) for (int i = (l); i < (r); ++i)
#define rep(...) rep_override(__VA_ARGS__, rep3, rep2)(__VA_ARGS__)
#define all(x) (x).begin(), (x).end()
#define sz(x) (int)(x).size()
using namespace std;
using ll = long long;
constexpr int inf = 1001001001;
constexpr ll INF = 3003003003003003003;
template <class T> inline bool chmin(T &x, const T &y) {if (x > y) {x = y; return 1;} return 0;}
template <class T> inline bool chmax(T &x, const T &y) {if (x < y) {x = y; return 1;} return 0;}
struct IOSET {IOSET() {cin.tie(0); ios::sync_with_stdio(0); cout << fixed << setprecision(10);}} ioset;

// Union-Find
struct UnionFind {
    vector<int> par;
    UnionFind(int N) : par(N, -1) { }
    int root(int x) {
        if (par[x] < 0) 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;
        if (par[rx] > par[ry]) swap(rx, ry);
        par[rx] += par[ry];
        par[ry] = rx;
    }
    bool same(int x, int y) {
        return root(x) == root(y);
    }
    int size(int x) {
        return -par[root(x)];
    }
};

// Main Code
int main() {
    int n, m;
    cin >> n >> m;
    UnionFind uf(2 * n);
    vector<int> cnt(n, 0);
    rep(i, m) {
        int a, b;
        cin >> a >> b;
        --a; --b;
        uf.unite(a, b + n); uf.unite(a + n, b);
        ++cnt[a]; ++cnt[b];
    }
    
    vector<int> siz(2 * n, 0);
    rep(i, n, 2 * n) ++siz[uf.root(i)];
    ll ans = 0;
    rep(i, n) {
        ans += (siz[uf.root(i)] - cnt[i]);
        if (uf.same(i, n + i)) --ans;
    }
    cout << ans / 2 << "\n";
    return 0;
}


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

string s,t;

int main(){
    cin >> s >> t;

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

    if(s < t){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }

}

Measured memory_bytes: 256
import java.util.HashSet;
import java.util.Scanner;
public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        HashSet<String> set = new HashSet<String>();
        int n = sc.nextInt();
        for(int i = 0 ; i < n ; i++)
        {
            String str = sc.next();
            if(str.equals("insert"))
                set.add(sc.next());
            else
            {
                if(set.contains(sc.next()))
                    System.out.println("yes");
                else
                    System.out.println("no");
            }
        }
    }
}


Measured memory_bytes: 253524
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using ll = long long;
const ll M = 1e9 + 7;
int si[8] = {-1,0,1,-1,1,-1,0,1};
int sj[8] = {-1,-1,-1,0,0,1,1,1};

struct UnionFind {
  vector<int> d;
  // 子は親のIDを，根は木のサイズ*-1を持つ
  UnionFind(int n = 0): d(n,-1){}
  // rootを探索する
  int find(int x){
    if(d[x] < 0) return x;
    return d[x] = find(d[x]);
  }
  // 集合を統合する
  bool unite(int x, int y){
    x = find(x); y = find(y);
    if (x == y) return false;
    if (d[x] > d[y]) swap(x,y);
    d[x] += d[y];
    d[y] = x;
    return true;
  }
  // 同じ集合に属しているか判定
  bool same(int x, int y) {return find(x) == find(y);}
  // xの属している集合のサイズを返す
  int size(int x) {return -d[find(x)];}
};

int main() {
  int n, m;
  cin >> n >> m;
  vector<int> a(m), b(m);
  rep(i,m) cin >> a[i] >> b[i];

  UnionFind uf(n);
  rep(i,m){
    a[i]--; b[i]--;
    uf.unite(a[i], b[i]);
  }
  int ans = 0;
  rep(i,n) ans = max(ans, uf.size(i));
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 5588
#include<iostream>

using namespace std;

int bubbleSort(int a[],int n)
{
     int c,d,t,cont=0;
     for(c=0;c<(n-1);c++)
     {
          for(d=0;d<(n-c-1);d++)
          {
               if(a[d]>a[d+1])
               {
                 t=a[d];
                 a[d]=a[d+1];
                 a[d+1]=t;
                 cont++;
               }
          }
     }
     return cont;
}

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

    int m=bubbleSort(a,x);

    for(int i=0;i<x;i++)
    {
       cout<<a[i];
       if(i<x-1){cout<<" ";}
    }

    cout<<endl<<m<<endl;

return 0;
}

Measured memory_bytes: 1160
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, N) for (int i = 0; i < (int)N; i++)
#define all(a) (a).begin(), (a).end()

int A, B, C, D;

int main () {
  cin >> A >> B >> C >> D;
  if(A + B == C + D) {
    cout << "Balanced" << endl;
  } else if(A + B > C + D) {
    cout << "Left" << endl;
  } else {
    cout << "Right" << endl;
  }
  return 0;
}


Measured memory_bytes: 256
#最大公約数を求める再帰関数-->計算量O(log(max(x))
def gcd1(x, y):
    if x < y:
        x, y = y, x
    if y == 0:
        return x
    return gcd(x-y, y)

def gcd(x,y):
    if x<y:
        x,y=y,x
    #x>y
    if y==0:
        return x
    if x%y==0:
        return y
    else:
        return gcd(y,x%y)


#本文
N = int(input())
list_A = list(map(int, input().split()))

#配列初期化
list_gcd = [0] * N
list_gcd_rev = [0] * N

#以下　間違いを発見できず

##配列の最初のgcdを求める。定義
#list_gcd[0] = list_A[0]
#list_gcd_rev[N-1] = list_A[N-1]
##print (list_gcd, list_gcd_rev)

##配列にgcdを代入していく
#for i in range(1,N):
#    list_gcd[i] = gcd(list_gcd[i-1], list_A[i])
##print (list_gcd)
#for j in range(1,N):
#    list_gcd_rev[N-1-j] = gcd(list_gcd_rev[N-j], list_A[N-1-j])
##print (list_gcd_rev)

##print (list_gcd, list_gcd_rev)

##k番目までの両端からのgcdを求める
#if N == 2:
#    ans = gcd(list_gcd[0], list_gcd_rev[1])
#else:
#    ans = max(list_gcd[N-2], list_gcd_rev[1]) #両端の文字を除いたときの答え
##print (ans)
#for k in range(1,N-1):
#    a = list_gcd[k-1]
#    b = list_gcd_rev[k+1]
#    ans = max(ans, gcd(a, b))
#print (ans)

#以下、正答

for i in range(1,N):
    list_gcd[i]=gcd(list_gcd[i-1],list_A[i-1])
for i in range(N-1)[::-1]:
    list_gcd_rev[i]=gcd(list_gcd_rev[i+1],list_A[i+1])
Z = [gcd(list_gcd[i], list_gcd_rev[i]) for i in range(N)]
print (max(Z))

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

int main(){
    long long a, b, m;
    cin >> a >> b >> m;

    long long A[a], B[b];

    long long min_a = 1e9, min_b = 1e9;

    for(long long i = 0; i < a; i++){
        cin >> A[i];
        min_a = min(min_a, A[i]);
    }

    for(long long i = 0; i < b; i++){
        cin >> B[i];
        min_b = min(min_b, B[i]);
    }

    long long min_cost = min_a + min_b;

    for(long long i = 0; i < m; i++){
        long long x, y, c;
        cin >> x >> y >> c;
        min_cost = min(min_cost, A[x-1]+B[y-1]-c);
    }
    cout << min_cost << endl;
    return 0;
}

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

using namespace std;

struct Dice {
  int t, f;
  Dice(int t, int f):t(t), f(f){}
  int get_prim()
  {
    return (t != 1 && t != 6 ? 6 : 5);
  }
  int roll_prim()
  {
    int face = get_prim();
    if(face == f) return 0;
    if(7-face == f) return 1;
    if(t%2 && f < 4 || !(t%2) && f > 3) return 2;
    if(t%2 && f > 3 || !(t%2) && f < 4) return 3;
  }
  int get_seco()
  {
    return (t != 3 && t != 4 ? 4 : 5);    
  }
  int roll_seco()
  {
    int face = get_seco();
    if(face == f) return 0;
    if(7-face == f) return 1;
    if(t%2 && f > 3 || !(t%2) && f < 4) return 2;
    if(t%2 && f < 4 || !(t%2) && f > 3) return 3;    
  }
  void roll(int d, int e)
  {
    switch(d) {
    case 0: swap(f, t); t = 7 - t; break;
    case 1: swap(f, t); f = 7 - f; break;
    default: t = 7 - e; break;
    }
  }
};

int mas[100][100];
int hei[100][100];

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

void dice_fall(Dice die, int x, int y)
{
  int d[] = {die.roll_prim(), die.roll_seco()};
  int e[] = {die.get_prim(), die.get_seco()};
  for(int i = 0; i < 2; i++) {
    int nx = x + dx[d[i]], ny = y + dy[d[i]];
    if(hei[y][x] > hei[ny][nx]) {
      die.roll(d[i], e[i]);
      dice_fall(die, nx, ny);
      return;
    }
  }
  mas[y][x] = die.t;
  hei[y][x]++;
  return;
}

int main()
{
  int n;
  while(cin >> n, n) {
    memset(mas, 0, sizeof(mas));
    memset(hei, 0, sizeof(hei));
    for(int i = 0; i < n; i++) {
      int t, f; cin >> t >> f;
      dice_fall(Dice(t, f), 50, 50);
    }
 
    int ans[6] = {0};
    for(int i = 0; i < 100; i++) {
      for(int j = 0; j < 100; j++) {
	if(mas[i][j] == 0) continue;
	ans[mas[i][j]-1]++;
      }
    }
    for(int i = 0; i < 6; i++)  cout << ans[i] << (i!=5 ? ' ' : '\n');
  }
  return 0;
}

Measured memory_bytes: 3160