akhauriyash/Code-Regression huggingface dataset:
use std::*;

fn read<T: str::FromStr>() -> T {
    let mut buf = String::new();
    io::stdin().read_line(&mut buf).ok();
    buf.trim().parse().ok().unwrap()
}

fn read_vec<T: str::FromStr>() -> Vec<T> {
    read::<String>()
        .split_whitespace()
        .map(|a| a.parse().ok().unwrap())
        .collect()
}

fn read_vec2d<T: str::FromStr>(n: u32) -> Vec<Vec<T>> {
    (0..n).map(|_| read_vec()).collect()
}

fn main() {
    let _: u32 = read();
    let s: String = read();
    let mut count = 0;

    for i in 0..s.len() - 2 {
        let subs = &s[i..i + 3];
        if "ABC" == subs {
            count += 1;
        }
    }

    println!("{}", count);
}


Measured memory_bytes: 4476
N,M=map(int,input().split())
from collections import defaultdict
B=[tuple(map(int,input().split())) for i in range(M)]
dist=defaultdict(lambda : float('inf'))
for i,x in enumerate(B):
    a,b,c=x[0]-1,x[1]-1,x[2]
    dist[(a,b)]=c
    dist[(b,a)]=c
for i in range(N):
    dist[(i,i)]=0
for k in range(N):
    for i in range(N):
        for j in range(N):
            dist[(i,j)]=min(dist[(i,j)],dist[(i,k)]+dist[(j,k)])
            dist[(j,i)]=dist[(i,j)]
cnt=0
for x in B:
    a,b,c=x[0]-1,x[1]-1,x[2]
    if dist[(a,b)]!=c:
        cnt+=1
print(cnt)

Measured memory_bytes: 4728
using System;

namespace _097b
{
    class Program
    {
        static void Main(string[] args)
        {
            int X = int.Parse(Console.ReadLine());
            int ans = 1;
            for(var i = 2; i*i <= X; i++){//2乗フィルタ
                for(var j = i*i; j <=X; j*=i){//2乗以上フィルタ
                    ans = Math.Max(ans,j);
                }
            }
            Console.WriteLine(ans);
        }
    }
}

Measured memory_bytes: 11092
#include<iostream>
#include<string>
#include<string.h>
#include<algorithm>
#include<stdio.h>
#include<cmath>
#include<vector>
#include<utility>
#include<stack>
#include<queue>
#include<list>
#include<bitset>
#include<functional>

#define FOR(i, a, b) for(long long int i=(a);i<=(b);i++)
#define RFOR(i, a, b) for(long long int i=(a);i>=(b);i--)
#define MOD 1000000007
#define INF 1000000000 //2000000000
#define LLINF 1000000000000000000 //9000000000000000000
#define PI 3.14159265358979

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



int main(void) {
	int a, b, c, d;
	int p, q;

	cin >> a >> b >> c >> d;

	p = min(a, b);
	q = min(c, d);

	cout << p + q << endl;

	return 0;
}

Measured memory_bytes: 768
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>	
#include<map>
#include<set>
#include<utility>
#include<cmath>
#include<cstring>
#include<queue>
#include<cstdio>
#include<sstream>
#include<iomanip>
#define loop(i,a,b) for(int i=a;i<b;i++) 
#define rep(i,a) loop(i,0,a)
#define pb push_back
#define mp make_pair
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)
using namespace std;
//kaewasuretyuui
typedef long long ll;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<pii> vp;
typedef vector<vp> vvp;
typedef pair<int,pii> pip;
typedef vector<pip>vip;
const double PI=acos(-1);
const double EPS=1e-8;
const int inf=1<<30;
vvi in;
vi d;
void dfs(int a,int c){
	rep(i,in[a].size()){
		int to=in[a][i];
		if(d[to]>c+1){
			d[to]=c+1;
			dfs(to,c+1);
		}
	}
}
int main(){
	int n,m;
	cin>>n>>m;
	in=vvi(n);
	rep(i,n-1){
		int a,b;
		cin>>a>>b;
		a--;b--;
		in[a].pb(b);
		in[b].pb(a);
	}
	int out=inf;
	if(m%2==0){
		rep(i,n){
			d=vi(n,inf);
			d[i]=0;
			dfs(i,0);
			int co=0;
			rep(j,n)if(d[j]-m/2>0)co++;
			out=min(out,co);
		}
	}else{
		rep(i,n)rep(j,in[i].size()){
			int to=in[i][j];
			d=vi(n,inf);
			d[i]=d[to]=0;
			dfs(to,0);
			dfs(i,0);
			int co=0;
			rep(k,n)if(d[k]-m/2>0)co++;
			out=min(out,co);
		}
	}
	cout<<out<<endl;
}






Measured memory_bytes: 384
gets.to_i
A = gets.chomp.split(" ").map(&:to_i)

C = Array.new(9, 0)
A.each{|a|
  if a < 400 then
    C[0] += 1
  elsif a < 800 then
    C[1] += 1
  elsif a < 1200 then
    C[2] += 1
  elsif a < 1600 then
    C[3] += 1
  elsif a < 2000 then
    C[4] += 1
  elsif a < 2400 then
    C[5] += 1
  elsif a < 2800 then
    C[6] += 1
  elsif a < 3200 then
    C[7] += 1
  else
    C[8] += 1
  end
}
wk = C[0, 8].count{|c| c > 0}
(wk = 1; C[8] -= 1) if wk == 0

puts [wk, wk+C[8]].join(' ')


Measured memory_bytes: 1788
#include <iostream>
#include <string>
#include <cstring>
#include <algorithm>
#include <functional>
#include <cmath>
#include <set>
#include <queue>
#include <vector>
#include <climits>
#include <sstream>
#include <iomanip>
#include <map>
#include <stack>
using namespace std;
typedef unsigned long long ull;
typedef long long ll;

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

	auto result = 0ll;
	for (auto i = 1ll; i * i <= N; ++i)
	{
		if ((N - i) > 0
			&& (N - i) % i == 0
			&& (N % ((N - i) / i)) == i)
		{
			result += (N - i) / i;
		}
	}

	cout << result << endl;

	return 0;
}

Measured memory_bytes: 256
package main

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

func main() {
	var sc = bufio.NewScanner(os.Stdin)
	var h, w int
	if sc.Scan() {
		slice := strings.Split(sc.Text(), " ")
		h, _ = strconv.Atoi(slice[0])
		w, _ = strconv.Atoi(slice[1])
	}
	var blocks [][]rune
	ok := rune(46) // string(rune(46)) == "."
	for i := 0; i < h; i++ {
		sc.Scan()
		blocks = append(blocks, []rune(sc.Text()))
	}
	sa := [2000][2000]int{}
	yu := [2000][2000]int{}
	jo := [2000][2000]int{}
	ge := [2000][2000]int{}
	// sa
	for y := 0; y < h; y++ {
		for x := 0; x < w; x++ {
			if blocks[y][x] == ok {
				if x == 0 {
					sa[y][x] = 1
					continue
				}
				sa[y][x] = sa[y][x-1] + 1
			}
		}
	}
	// yu
	for y := h - 1; y >= 0; y-- {
		for x := w - 1; x >= 0; x-- {
			if blocks[y][x] == ok {
				if x == w-1 {
					yu[y][x] = 1
					continue
				}
				yu[y][x] = yu[y][x+1] + 1
			}
		}
	}
	// jo
	for y := 0; y < h; y++ {
		for x := 0; x < w; x++ {
			if blocks[y][x] == ok {
				if y == 0 {
					jo[y][x] = 1
					continue
				}
				jo[y][x] = jo[y-1][x] + 1
			}
		}
	}
	// ge
	for y := h - 1; y >= 0; y-- {
		for x := w - 1; x >= 0; x-- {
			if blocks[y][x] == ok {
				if y == h-1 {
					ge[y][x] = 1
					continue
				}
				ge[y][x] = ge[y+1][x] + 1
			}
		}
	}

	var maxxxxxx int
	var tmp int
	for h1 := 0; h1 < h; h1++ {
		for w1 := 0; w1 < w; w1++ {
			tmp = sa[h1][w1] + yu[h1][w1] + jo[h1][w1] + ge[h1][w1] - 3
			if tmp > maxxxxxx {
				maxxxxxx = tmp
			}
		}
	}
	fmt.Println(maxxxxxx)
}


Measured memory_bytes: 149776
#include <bits/stdc++.h>
using namespace std;
#define IOS ios::sync_with_stdio(false); cin.tie(0);
#define FOR(i,s,n) for(int i = s; i < (n); i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(n) (n).begin(), (n).end()
#define RALL(n) (n).rbegin(), (n).rend()
#define ATYN(n) cout << ( (n) ? "Yes":"No") << '\n';
#define CFYN(n) cout << ( (n) ? "YES":"NO") << '\n';
#define OUT(n) cout << (n) << '\n';
using ll = long long;
using ull = unsigned long long;
using pii = pair<int,int>;
using pll = pair<ll,ll>;

int main(void)
{
    IOS
    int n; cin >> n;
    string ans;
    if (n < 1200) ans = "ABC";
    else if (n < 2800) ans = "ARC";
    else ans = "AGC";

    cout << ans << '\n';

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <cmath>
#include<algorithm>
#include<stack>
#include<queue>
#include<map>
#include<iomanip>
#define _USE_MATH_DEFINES
#include <math.h>
#include <functional>
using namespace std;

#define rep(i,x) for(int i=0;i<x;i++)
#define repn(i,x) for(int i=1;i<=x;i++)

typedef long long ll;
const ll INF = 1e17;
const ll MOD = 1000000007;
const ll MAX = 1000000;

ll max(ll a, ll b) {
	if (a > b) { return a; }
	return b;
}

ll min(ll a, ll b) {
	if (a > b) { return b; }
	return a;
}

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




int main() {

	double A, B;
	cin >> A>>B;

	ll ans = ceil((B-1) / (A-1));
	cout << ans;
	

	system("PAUSE");
}


Measured memory_bytes: 504
#include <iostream>
#include <bits/stdc++.h>
#include <unordered_map>
#include <unordered_set>
#include <map>
#include <set>
#include <cmath>
#include <vector>
#include <string>
#include <queue>
#include <stack>
#include <utility>

using namespace std;

typedef long long int lli;

typedef pair<lli, lli> pii;
typedef vector<lli> vi;
typedef set<lli> si;
typedef unordered_map<lli, lli> umii;
typedef unordered_set<lli> usi;

lli mod = 1000000007;

void dispvec(si arr)
{
    si::iterator itr = arr.begin();
    while (itr != arr.end())
    {
        cout << *itr << " ";
        itr++;
    }
    cout << endl;
}

struct CustomCompare
{
    //stable sort by first then second both in increasing
    bool operator()(const pair<float, lli> &i, const pair<float, lli> &j)
    {
        return i.first < j.first;
    }
};

lli max(lli a, lli b)
{
    return a > b ? a : b;
}

void solve()
{
    int n;
    lli W;
    cin >> n;
    cin >> W;
    vi w(n + 1);
    vi v(n + 1);
    for (int i = 1; i <= n; i++)
        cin >> w[i] >> v[i];

    vector<vector<lli>> dp(n + 1, vector<lli>(W + 1, 0));
    for (int i = 1; i <= n; i++)
    {
        int flag = 0;
        for (int j = 1; j <= W; j++)
        {
            if (j - w[i] >= 0)
            {
                flag = 1;
                dp[i][j] = max(dp[i - 1][j], v[i] + dp[i - 1][j - w[i]]);
            }
            else
            {
                dp[i][j] = dp[i - 1][j];
            }
        }
    }
    cout << dp[n][W] << endl;
}

int main()
{
#ifndef ONLINE_JUDGE
    freopen("/home/mufaddal/Mufaddal/Programs/Competitive/input", "r", stdin);
    freopen("/home/mufaddal/Mufaddal/Programs/Competitive/output", "w", stdout);
#endif
    int t = 1;
    // cin >> t;
    int i = 1;
    while (i <= t)
    {
        solve();
        i++;
    }

    return 0;
}

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

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

    vector<int> ds;
    for (int i = 1; i * i <= M; i++) {
        if (M % i == 0) {
            ds.push_back(i);
            ds.push_back(M / i);
        }
    }

    int ans = 0;
    for (int d : ds) {
        if (M / d >= N) {
            ans = max(ans, d);
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < n; ++i)
#define REPP(i, n) for(int i = 1; i <= n; ++i)
#define REPR(i, n) for(int i = n; i >= 0; --i)
#define FOR(i, m, n) for(int i = m; i < n; ++i)
#define ALL(v) v.begin(), v.end()
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end());
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
const ll MOD = 1000000007;
const ll INF = 1000000000;

int main() {
    int n,h,w; cin >> n >> h >> w;
    int ans = 0;
    REP(i,n) {
        int a,b;cin >> a >> b;
        ans += (a>=h && b>=w);
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
//B - Picture Frame
//https://atcoder.jp/contests/abc062/tasks/abc062_b

#include <cstdio>

int main()
{
  int H, W;
  char a[101];

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

  for (int i = 0; i < W + 2; i++)
  {
    printf("#");
  }
  printf("\n");

  for (int i = 0; i < H; i++)
  {
    scanf("%s", a);
    printf("#%s#\n", a);
  }

  for (int i = 0; i < W + 2; i++)
  {
    printf("#");
  }
  printf("\n");
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
int main(){
    int n,ans=0;
    cin >> n;
    int a[3][n+10];
    for(int i=1;i<=2;i++){
        for(int j =1;j<=n;j++){
            cin >> a[i][j];
            // cerr << a[i][j];
        }
        // cerr << endl;
    }

    for(int i=1;i<=n;i++){
        int x=1,y=1,sum=0;
        for(int j=1;j<=n+1;j++){
            if(j==i){
                sum += a[x][y];
                x++;
            }else{
                sum += a[x][y];
                y++;
            }
            cerr << sum<<endl;
        }
        cerr << "sum"<<sum << endl;
        ans = max(ans,sum);
    }


    cout <<ans <<endl;
}

Measured memory_bytes: 256
class UnionFind():
    def __init__(self, n):
        self.parent = [i for i in range(n)]
        self.height = [0]*n

    def get_root(self, i):
        if self.parent[i] == i:
            return i
        else:
            self.parent[i] = self.get_root(self.parent[i])
            return self.parent[i]
        
    def unite(self, i, j):
        root_i = self.get_root(i)
        root_j = self.get_root(j)
        if root_i != root_j:
            if self.height[root_i] < self.height[root_j]:
                self.parent[root_i] = root_j
            else:
                self.parent[root_j] = root_i
                if self.height[root_i] == self.height[root_j]:
                    self.height[root_i] += 1
    
    def is_in_group(self, i, j):
        if self.get_root(i) == self.get_root(j):
            return True
        else:
            return False



def main():
    import sys

    def input(): return sys.stdin.readline().rstrip()

    n, m = map(int, input().split())
    edges = []
    for i in range(m):
        a, b = map(int, input().split())
        edges.append((a-1, b-1))
    
    cnt = 0
    for i in range(m):
        uf = UnionFind(n)
        for j in range(m):
            if i == j: continue
            a, b = edges[j]
            uf.unite(a, b)
        flag = 1
        for j in range(n):
            flag &= uf.is_in_group(0, j)
        if not flag: 
            cnt += 1
    print(cnt)
            
                
if __name__ == '__main__':
    main()

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

using namespace std;
#define ll long long int
int c[1000001] = {0};
int main()
{
   ll t;
   t = 1;	
   //cin t;
   while(t--){
             ll n;
             cin >> n;
             ll a[n];
             for(int i =0 ; i < n ; i ++ )
             {
                 cin >> a[i];
             }
             sort(a , a + n);
             int ans = 0;
             
             for(int i = 0; i < n ; i ++)
             {
                 
                 if(c[a[i]] == 1)
                 continue;

                    
                 ans ++;
                 if(i + 1 < n && a[i + 1] == a[i])
                 ans --;

                 c[a[i]] = 1;
                 for(int j = a[i] * 2; j <= a[n- 1] ; j += a[i])
                 c[j] = 1;
             }
             cout << ans << endl;
   }
}


Measured memory_bytes: 8848
import sys
input = lambda: sys.stdin.readline().strip()
n, m = [int(x) for x in input().split()]
can = [True for i in range(n + 1)]
for i in range(m):
    ai = int(input())
    can[ai] = False
C = [0 for i in range(n + 1)]
for i in range(n + 1):
    if i == 0:
        C[i] = 1
    else:
        C[i] = sum(C[j] if j >= 0 and can[j] else 0 for j in (i - 1, i - 2)) % (10**9 + 7)
print(C[n])

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

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

#define INF 1 << 29
#define REP(i,n) for(ll i=0; i<(int)(n); i++)
#define FOR(i,k,n) for(ll i=(k);i<(int)(n);i++)



vector<bool> gen_sosuu(vector<bool> sosuu){
  int size = sosuu.size();
  REP(i,size){
    sosuu[i] = true;
  }
  sosuu[0] = false;
  sosuu[1] = false;
  sosuu[2] = true;
  FOR(i,2,sqrt(size)+1){
    if(sosuu[i] == false) continue;
    for(int j = 2; i*j<size;j++){
      sosuu[i*j] =false;
    }
  }
  return sosuu;
}

int n;
vector<int> a;

int main(){
  cin >> n;
  REP(i,n){
    int x;
    cin >> x;
    a.push_back(x);
  }
  sort(a.begin(),a.end(),greater<int>());
  int ma = a[0];
  int mi = INT_MAX;
  int ans;
  FOR(i,1,n){
    if(mi > abs(ma/2-a[i])){
      mi = abs(ma/2-a[i]);
      ans = a[i];
    }
  }
  cout << ma << " " << ans << endl;
}


Measured memory_bytes: 892
use std::io::*;

fn main() {
    let stdin = stdin();

    let mut buf = String::new();
    stdin.read_line(&mut buf).ok();
    let (n, _m) = to_pair(&buf);

    let mut conflicts: Vec<(i32, i32)> =
        stdin.lock().lines().map(|l| to_pair(&l.unwrap())).collect();
    conflicts.sort_by_key(|t| t.1);
    let mut bridges = vec![false; (n - 1) as usize];

    for t in conflicts {
        let w = (t.0 - 1) as usize;
        let e = (t.1 - 1) as usize;
        if bridges[w..e - 1].iter().all(|&b| b == false) {
            bridges[e - 1] = true;
        }
    }

    println!("{}", bridges.into_iter().filter(|&b| b).count());
}

fn to_pair(s: &str) -> (i32, i32) {
    let v: Vec<_> = s.split_whitespace().map(|w| w.parse().unwrap()).collect();
    let (l, r) = (v[0], v[1]);
    (l, r)
}


Measured memory_bytes: 4352
// This is the start of  template//
#include<bits/stdc++.h>
using namespace std;
#define endl "\n"
#define int long long int
#define double long long double
#define vll vector<int>
#define pb push_back
#define pll pair<int,int>
#define mp(a,b) make_pair(a,b)
#define ff first
#define ss second
void input(){
#ifndef ONLINE_JUDGE 
freopen("input.txt","r",stdin);
freopen("output.txt","w",stdout); 
#endif
}
#define INF LONG_LONG_MAX
#define mod 1000000007
#define array(a,n) vll a(n); rep(i,0,n) cin>>a[i];
#define all(x) x.begin(),x.end()
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,a,b) for(int i=a;i>=b;i--)
#define cases int t; cin>>t; while(t--)
#define printall(a) rep(i,0,a.size()) cout<<a[i]<<" "; cout<<endl;

int32_t main()
{
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  input();
  int n ,k,t;
  cin>>n>>k>>t;
  cout<<((int)ceil(1.0*n/k)*t)<<endl;
  return 0;
}



Measured memory_bytes: 3728
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
using namespace __gnu_pbds;

#define ll          long long
#define fio         ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define pb          push_back
#define vi          vector<ll>
#define pp          push_pop
#define pll         pair<ll,ll>
#define in          insert
#define ini(a,n)    memset(a,n,sizeof(a))
#define ff          first
#define ss          second
#define inf         10000000000000000
#define all(p)      p.begin(), p.end()
#define que_max     priority_queue <int>
#define que_min     priority_queue <int, vi, greater<int>>
#define print(a)    for(auto i:a){cout<<i<<" ";}
#define print1(a)   for(auto i:a){cout<<i.ff<<" "<<i.ss<<endl;}

typedef tree<pll, null_type, less<pll>, rb_tree_tag, tree_order_statistics_node_update> Set;
unordered_map<ll,vi> g;
unordered_map<ll,ll> vis;

const ll mod = 1e9+7;

ll power(ll x,ll y,ll p){ll r=1;x=x%p;while(y>0){if(y&1)r=(r*x)%p;y=y>>1;x=(x*x)%p;}return r;}
const ll N = 2e5+10;
ll dx[4]={-1, +1, 0, 0};
ll dy[4]={0, 0, +1, -1};
bool imp = false;
bool isPowerOfTwo (ll x)
{
    return x && (!(x&(x-1)));
}

void solve() {
    map<ll,ll> mp;
    ll n;cin>>n;
    ll a[n+1];
    ll s=0;
    for(ll i=0;i<n;i++){
        cin>>a[i];
        mp[a[i]] += 1;
        s += a[i];
    }

    ll q;cin>>q;
    while(q--){

        ll x,y;cin>>x>>y;
        s -= mp[x]*x;
        s -= mp[y]*y;
        mp[y] = mp[y] + mp[x];
        mp[x] = 0;
        s += mp[y]*y;
        cout<<s<<endl;
    }

}

int main()
{
#ifndef ONLINE_JUDGE
    freopen("input.txt","r",stdin);
    freopen("output.txt","w",stdout);
#endif

    fio
    int t=1;
    if(imp) cin>>t;

    while(t--)
    {
        // cout<<"Case #"<<tc<<": ";
        g.clear();
        vis.clear();
        solve();
        // tc++;
    }

}


Measured memory_bytes: 10316
#include <bits/stdc++.h>
#define int long long
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define F first
#define S second

using namespace std;
using P = pair<int,int>;
using ivec = vector<int>;
using Graph = vector<vector<int>>;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }


const int MOD=1000000007;
int INF=100100100100100;
int dp[4][4][4][110];
char s[4]={'A','C','G','T'};
signed main(){
  int n;cin>>n;
  rep(i,64){
    int a=i/16,b=(i/4)%4,c=i%4;
    if(i!=6 && i!=9 && i!=33)dp[a][b][c][3]=1;
  }
  for(int i=3;i<n;i++){
    rep(a,4){
      rep(b,4){
        rep(c,4){
          (dp[b][c][0][i+1]+=dp[a][b][c][i])%=MOD;
          (dp[b][c][3][i+1]+=dp[a][b][c][i])%=MOD;
          if(b!=0 || c!=1)(dp[b][c][2][i+1]+=dp[a][b][c][i])%=MOD;
          //else cout<<s[a]<<s[b]<<s[c]<<s[2]<<endl;
          if(!(a==0 && c==2) && !(b==2 && c==0) && !(a==0 && b==2) && !(b==0 && c==2))(dp[b][c][1][i+1]+=dp[a][b][c][i])%=MOD;
         // else cout<<s[a]<<s[b]<<s[c]<<s[1]<<endl;
          
        }
      }
    }
  }
  int ans=0;
  rep(i,64){
    int a=i/16,b=(i/4)%4,c=i%4;
    (ans+=dp[a][b][c][n])%=MOD;
  }
  cout<<ans<<endl;
  return 0;
}

Measured memory_bytes: 3740
import core.bitop;
import std.algorithm;
import std.ascii;
import std.bigint;
import std.conv;
import std.functional;
import std.math;
import std.numeric;
import std.range;
import std.stdio;
import std.string;
import std.random;
import std.typecons;

alias sread = () => readln.chomp();
alias Point2 = Tuple!(long, "y", long, "x");

T lread(T = long)()
{
    return readln.chomp.to!T();
}

T[] aryread(T = long)()
{
    return readln.split.to!(T[])();
}

void scan(TList...)(ref TList Args)
{
    auto line = readln.split();
    foreach (i, T; TList)
    {
        T val = line[i].to!(T);
        Args[i] = val;
    }
}

void minAssign(T, U = T)(ref T dst, U src)
{
    dst = cast(T) min(dst, src);
}

void maxAssign(T, U = T)(ref T dst, U src)
{
    dst = cast(T) max(dst, src);
}

enum MOD = (10 ^^ 9) + 7;

void main()
{
    string[2] s;
    s[0] = sread();
    s[1] = sread();
    foreach (i; 0 .. s[0].length + s[1].length)
        write(s[i & 1][i / 2]);
    writeln();
}


Measured memory_bytes: 256
#include <stdio.h>

int main(void)
{
	int N;
	int max=0;
	int i=0;
	scanf("%d",&N);
	
	for(i=0;i*i<=N;i++){
		if(max<i*i) max=i*i;
	}
	
	printf("%d",max);
	
	return(0);
}


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

int main(){
  string N;
  cin>>N;
  if(N=="a"||N=="b"||N=="c"||N=="d"||N=="e"||N=="f"||N=="g"||N=="h"||N=="i"||N=="j"||N=="k"||N=="l"||N=="m"||N=="n"||N=="o"||N=="p"||N=="q"||N=="r"||N=="s"||N=="t"||N=="u"||N=="v"||N=="w"||N=="x"||N=="y"||N=="z"){
    cout<<"a"<<endl;
  }
  else{
    cout<<"A"<<endl;
  }
}
  

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


int main(){
  int verticals,horizontals,a,b;
  char comma; //commaを抜くための変数
  cin >> verticals;
  cin >> horizontals;

  int res[verticals];
  for(int i=0;i<verticals;i++) res[i] = i+1;
  for(int i=0;i<horizontals;i++){
    cin >> a >> comma >> b;   
    int tmp = res[a-1];
    res[a-1] = res[b-1];
    res[b-1] = tmp;
  }
  for(int i=0;i<verticals;i++) cout << res[i] << endl;
}

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

int main() {
    int k;
    cin >> k;
    vector<int> num = {1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
    cout << num.at(k - 1) << endl;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

bool solve(long long a, long long b, long long c)
{
	long long t = c - a - b;
	if (t < 0) {
		return false;
	}
	else {
		return 4 * a * b < t * t;
	}
}

int main()
{
	long long a, b, c;
	cin >> a >> b >> c;
	if (solve(a, b, c)) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n,m;
  while(1){
    cin>>n>>m;
    if(n==0 && m==0) break;
    int a[1001];
    for(int i=0;i<n;i++) cin>>a[i];
    int ans=0;
    for(int i=0;i<n;i++){
      for(int j=0;j<n;j++){
        if(i==j || a[i]+a[j]>m) continue;
        ans=max(ans,a[i]+a[j]);
      }
    }
    if(ans==0) cout<<"NONE"<<endl;
    else cout<<ans<<endl;
  }
  return 0;
}


Measured memory_bytes: 3020
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Console = System.Console;

namespace Atcoder
{
    class Program
    {
        static void Main(string[] args)
        {
            var abcd = ReadIntArray();
            Console.WriteLine(Math.Max(abcd[0] * abcd[1], abcd[2] * abcd[3]));
        }

        private static readonly Func<string> Read = () => Console.ReadLine();
        private static readonly Func<string[]> ReadStringArray = () => Console.ReadLine().Split();
        private static readonly Func<int> ReadInt = () => int.Parse(Console.ReadLine());
        private static readonly Func<long> ReadLong = () => long.Parse(Console.ReadLine());
        private static readonly Func<int[]> ReadIntArray = () => Console.ReadLine().Split().Select(int.Parse).ToArray();
        private static readonly Func<long[]> ReadLongArray = () => Console.ReadLine().Split().Select(long.Parse).ToArray();
        private static readonly Action<string> Cw = str => Console.WriteLine(str);
    }
}

Measured memory_bytes: 13396
S=list(input())
a=S[::2]
b='Yes'
for i in a:
  if i!='R' and i!='U' and i!='D':
    b='No'
    break
c=S[1::2]
for j in c:
  if j!='L' and j!='U' and j!='D':
    b='No'
    break
print(b)
  



Measured memory_bytes: 2940
#include<cstdio>
#include<iostream>
#include<algorithm>
#include<string>
#include<queue>
#include<vector>
#include<functional>
#include<cmath>
#include<map>
#include<stack>
#include<set>
#include<numeric>
#include<limits>

#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()

using namespace std;
typedef long long ll;
typedef pair<int, int> pi;
typedef pair<ll, ll> pl;
typedef pair<ll, char> plc;

int main()
{
	for (int i = 0; i < 4; i++) {
		int t, n;
		cin >> t >> n;
		if (t == 1) cout << 6000 * n << endl;
		if (t == 2) cout << 4000 * n << endl;
		if (t == 3) cout << 3000 * n << endl;
		if (t == 4) cout << 2000 * n << endl;
	}
	return 0;
}

Measured memory_bytes: 3096
import java.util.*;

public class Main{
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		Deque<Integer> stack = new ArrayDeque<Integer>();
		int data = sc.nextInt();
		for(int i=0; i<data; i++){
			String str = sc.next();
			int flag1 = 0, flag2 = 0, maxphase = 0;
			int[] count = new int[str.length()/3];
			for(int j=0; j<str.length(); j++){
				if(str.charAt(j)>='0'&&str.charAt(j)<='9'){
					int temp = str.charAt(j) - '0';
					while(str.charAt(j+1)>='0'&&str.charAt(j+1)<='9'){
						temp = 10*temp + (str.charAt(++j) - '0');
					}
					stack.push(temp);
					count[-1*flag1]++;
				}else if(str.charAt(j)==']'){
					flag2--;
					if(flag2 != flag1){
						int[] phase = new int[count[-1*flag1+1]];
						int k = 0;
						while(stack.peek()!=flag1+1){
							if(stack.peek()>0){
								phase[k++] = stack.pop();
							}else{
								stack.pop();
							}
						}
						Arrays.sort(phase);
						int sum = 0;
						for(k=0; k<=count[-1*flag1+1]/2; k++){
							if(-1*flag1+1==maxphase){
								sum += (phase[k]+1)/2;
							}else{
								sum += phase[k];
							}
						}
						stack.push(sum);
						count[-1*flag1+1] = 0;
						count[-1*flag1]++;
					}
					flag1++;
				}else{
					flag2 = flag1;
					stack.push(flag1--);
					if(maxphase<-1*flag1) maxphase = -1*flag1;
				}
			}
			System.out.println(stack.pop());
		}
	}
}

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

// 插入此處

int val[3005][3005];
LL dp[3005][3005][4];
bool vis[3005][3005][4];
int R, C, K;

LL solve(int r, int c, int x) {
    if (r > R || c > C) {
        return 0;
    }
    if (vis[r][c][x]) {
        return dp[r][c][x];
    }
    vis[r][c][x] = true;
    dp[r][c][x] = solve(r + 1, c, 3);
    dp[r][c][x] = max(dp[r][c][x], solve(r, c + 1, x));

    if (x > 0 && val[r][c] > 0) {
        dp[r][c][x] = max(dp[r][c][x], val[r][c] + solve(r, c + 1, x - 1));
        dp[r][c][x] = max(dp[r][c][x], val[r][c] + solve(r + 1, c, 3));
    }

    // printf("dp[%d][%d][%d] = %lld\n", r, c, x, dp[r][c][x]);

    return dp[r][c][x];
}

int main() {
    cin >> R >> C >> K;
    for (int i = 0; i < K; i++) {
        int r, c, v;
        cin >> r >> c >> v;
        val[r][c] = v;
    }
    cout << solve(1, 1, 3) << endl;
}


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

template<typename T_char>
T_char ToUpper(T_char cX){return toupper(cX);}

int main(){
  string w;
  cin >> w;
  int n = w.size();
  map<char,int> a;
  for(int i=0; i<n; ++i){
    a[w[i]]++;
  }
  for(int i=0; i<n; ++i){
    if(a[w[i]]>0){
      if(a[w[i]]%2!=0){
        cout << "No" << endl;
        return 0;
      }
    }
  }
  cout << "Yes" << endl;
  return 0;
}

Measured memory_bytes: 3628
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
using namespace std;
int main(){
  int n;
  cin>>n;
  for(int64_t i=1;i<n;++i){
    if(i*i>n){
      cout<<(i-1)*(i-1)<<endl;
      return 0;
    }
  }
  cout<<1<<endl;
}

Measured memory_bytes: 3640
//g++ -std=c++14 test.cpp -o test.out

#include <string.h>
#include <stdlib.h>
#include <math.h>
#include <cassert>
#include <algorithm>
#include <functional>
#include <iostream>
#include <iomanip>
#include <vector>
#include <queue>
#include <map> 
#include <utility>
#include <limits.h>
#include <bitset>
#include <set>
using namespace std;
 
#define LL long long int
const LL INF = (LL)(1e18)+1;
const int INF_INT = 2147483647-1e6-1;
const LL mod = 1000000007ll;
const int mod_int = 1000000007;

int N,P;
string S;
 
LL ans = 0;

void solve(){
	if(10%P==0){//Pが2,5,10のいずれか
		for(int i=0;i<N;i++){
			if((S[i]-0x30)%P==0){
				ans += i+1;
			}
		}
		return;
	}
	//S[i]でSのi+1桁目にアクセスできるようにする
	reverse(S.begin(),S.end());
	//10^iをPで割ったあまりをpow10[i]とおく
	vector<LL> pow10(N,1);
	for(int i=1;i<N;i++) pow10[i] = (pow10[i-1]*10)%P;

	//Sをi桁目(1<=i<=N)まで見た時、S[i]S[i-1]...S[0]
	//がPで割った時pであるような数値の個数をcounter[p]とおく
	vector<LL> counter(P,0);
	LL now_num = 0;
	counter[now_num]++;
	for(int i=0;i<N;i++){
		now_num += ((S[i]-'0')*pow10[i])%P;
		now_num %= P;
		counter[now_num]++;
	}

	for(int i=0;i<P;i++){
		ans += counter[i]*(counter[i]-1)/2;
	}
}
 
int main(){
    cin >> N >> P;
    cin >> S;
 
    solve();
 
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 2180
using System;
using System.Collections.Generic;
using System.Linq;
using static System.Console;

class Program
{
    static void Main()
    {
        var dt = DateTime.Now;
        var N = int.Parse(ReadLine());
        var A = Enumerable.Range(1, 55555).Where(IsPrime).Where(x => x % 5 == 1);
        WriteLine(string.Join(" ", A.Take(N)));
    }

    static bool IsPrime(int n)
    {
        if (n < 2) return false;
        var r = (int)Math.Sqrt(n);
        for (int i = 2; i <= r; i++) if (n % i == 0) return false;
        return true;
    }
}

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

int main(){
  int A,B,K;
  cin>>A>>B>>K;
  int temp=1;
  for(int i=0;i<K;i++){
    if(temp==1){
      if(A%2 == 1){
        A--;
      }
        B+=A/2;
        A=A/2;
      temp=temp*(-1);
      continue;
    }
    if(temp==(-1)){
      if(B%2 == 1){
        B--;
      }
        A+=B/2;
        B=B/2;

      temp=temp*(-1);
    }
  }
  cout<<A<<" "<<B<<endl;
  return 0;
}


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

using namespace std;

#define ALL(x) x.begin(),x.end()
#define _for(i,j,N) for(int i = (j); i < (N);i++)

const int maxn = 105;

int N;
struct P{
    int x,y;
    P(int x,int y):x(x),y(y){;}
    bool operator<(const P& p1){
        return (x < p1.x)||(x == p1.x && y < p1.y);
    }
    bool good(const P &p1){
        return (x < p1.x)&&(y < p1.y);
    }
};

vector<int> a;
vector<P> pa;
vector<P> pb;
int vis[maxn];

int main()
{
    memset(vis,0,sizeof(vis));
    scanf("%d",&N);
    for(int i = 0; i < N;i++){
        int x,y;
        scanf("%d %d",&x,&y);
        pa.push_back(P(x,y));
    }
    for(int i = 0;i < N;i++){
        int x,y;
        scanf("%d %d",&x,&y);
        pb.push_back(P(x,y));
    }
    sort(ALL(pa));sort(ALL(pb));
    int cnt = 0;
    _for(i,0,N){
        P red = pa[N-i-1];
        int index = -1;
        int min_y = 300;
        _for(j,0,N){
            if(vis[j]) continue;
            if(red.good(pb[j]) && min_y > pb[j].y){
                min_y = pb[j].y;
                index = j;
            }
        }
        if(index != -1){
            vis[index] = 1;
            cnt++;
            //printf("%d %d\n",i,index);
        }
    }

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

    return 0;
}

Measured memory_bytes: 256
import sys
 
h,w=[int(x) for x in input().rstrip().split()]
l=[]
black=0
for i in range(h):
  s=[x for x in input()]
  l.append(s)
  black+=sum(j.count("#") for j in s)
 
done=[[float('inf')]*w for i in range(h)]
def bfs():
  stack=[[0,0]]
  done[0][0]=0
  while(stack):
    x,y=stack.pop(0)
    move=[[x+1,y],[x-1,y],[x,y+1],[x,y-1]]
 
    for mx,my in move:
      if not(0<=my<=h-1) or not(0<=mx<=w-1) or l[my][mx]=="#" or done[my][mx]!=float('inf'):
        continue

      done[my][mx]=done[y][x]+1
      stack.append([mx,my])
      
      if my==h-1 and mx==w-1:
        print(h*w-done[my][mx]-black-1)
        sys.exit()
  print(-1)
 
if __name__=="__main__":
  bfs()

Measured memory_bytes: 3064
#include <stdio.h>
#include <stdlib.h>
#include "time.h"
#include "unistd.h"
#include "string.h"
#include <math.h>
int ans=0;
long long sort(long long d[],int NumberArrays,int up){
  int tmp;
  for (int i = 0; i < NumberArrays-1; i++) {
    if (up && d[i]<d[i+1]) {
      d[i]=tmp;
      d[i]=d[i+1];
      d[i+1]=tmp;
    }else if (d[i]>d[i+1]) {
      d[i]=tmp;
      d[i]=d[i+1];
      d[i+1]=tmp;
    }
  }
}
int main(int argc, char* argv[]){
	long long int a = 0, b = 0, c = 0,d[10000];
  char f[3];
	scanf("%lld",&a);
  for (long int i = 1; i < a+1; i++) {
    if (i%3!=0 && i%5!=0) {
      b+=i;
    }
  }
  printf("%lld\n",b);
}


Measured memory_bytes: 1736
//url:
//problem name:

#include <bits/stdc++.h>
#define REP(i,n) for (int i = 0; i < (n); ++i)
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;}
using namespace std;
using ll = long long;
using P = pair<int,int>;
using Pl = pair<long long,long long>;
using veci = vector<int>;
using vecl = vector<long>;
using vecveci = vector<vector<int>>;
using vecvecl = vector<vector<long long>>;

int main() {
    string S;
    cin >> S;
    int N = S.size();
    veci res(26);
    REP(i,N) {
        res[(int)S[i]-97]++;
    }
    REP(i,26) {
        if(res[i] == 0) {
            cout << char(i+97) << endl;
            return 0;
        }
    }
    cout << "None" << endl;
}


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

int main(void)
{
	int n,week=1;
	double sum=100.0;
	scanf("%d",&n);
	while(week!=n+1){
		sum=sum*(1.05);
		sum=ceil(sum);
		week++;
	}
	sum=ceil(sum);
	sum=sum*1000;
	printf("%.0lf\n",sum);
	
	return 0;
}

Measured memory_bytes: 632
import math

A, B = map(int, input().split())

ans = []
for i in range(1010): 
    ans8 = math.floor(i * 0.08)
    ans10 = math.floor(i * 0.1)
    if ans8 == A and ans10 == B:
        ans.append(i)
 
if len(ans) != 0:
    print(min(ans))
else:
    print(-1)

Measured memory_bytes: 3060
#include <bits/stdc++.h>
#define For(i, a, b) for (int(i) = (int)(a); (i) < (int)(b); ++(i))
#define rFor(i, a, b) for (int(i) = (int)(a)-1; (i) >= (int)(b); --(i))
#define rep(i, n) For((i), 0, (n))
#define rrep(i, n) rFor((i), (n), 0)
#define fi first
#define se second
using namespace std;
typedef long long lint;
typedef unsigned long long ulint;
typedef pair<int, int> pii;
typedef pair<lint, lint> pll;
template <class T>
bool chmax(T &a, const T &b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
template <class T>
bool chmin(T &a, const T &b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template <class T>
T div_floor(T a, T b) {
    if (b < 0) a *= -1, b *= -1;
    return a >= 0 ? a / b : (a + 1) / b - 1;
}
template <class T>
T div_ceil(T a, T b) {
    if (b < 0) a *= -1, b *= -1;
    return a > 0 ? (a - 1) / b + 1 : a / b;
}

constexpr lint mod = 1000000007;
constexpr lint INF = mod * mod;
constexpr int MAX = 200010;

typedef struct UnionFindTree {
    vector<int> par;

    UnionFindTree(int n) { par.resize(n, -1); }

    bool is_root(int x) { return par[x] < 0; }

    int find(int x) {
        if (is_root(x)) return x;
        return par[x] = find(par[x]);
    }

    int size(int x) { return -par[find(x)]; }

    bool unite(int x, int y) {
        x = find(x);
        y = find(y);
        if (x == y) return false;
        if (size(x) < size(y)) swap(x, y);
        par[x] += par[y];
        par[y] = x;
        return true;
    }

    bool same(int x, int y) { return find(x) == find(y); }
} UF;

int main() {
    int n, m;
    scanf("%d%d", &n, &m);
    UF uf(n);
    rep(_, m) {
        int a, b;
        scanf("%d%d", &a, &b);
        --a;
        --b;
        uf.unite(a, b);
    }
    int ans = 0;
    rep(i, n) if (uf.is_root(i)) { chmax(ans, uf.size(i)); }
    printf("%d\n", ans);
}

Measured memory_bytes: 4068
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.ArrayDeque;
import java.util.ArrayList;

public class Main {

	public static void main(String[] args) throws NumberFormatException, IOException {
		BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
		PrintWriter pw=new PrintWriter(System.out);
		int x=Integer.parseInt(br.readLine());
		ArrayDeque<Integer> list=new ArrayDeque<Integer>();
		for (int i = 0; i < x; i++) {
			String s=br.readLine();
			String[] v=s.split(" ");
			if(s.charAt(0)=='i'){
				int val=Integer.parseInt(v[1]);
				list.addFirst(val);
			}
			else if(s.charAt(6)==' '){
				int val=Integer.parseInt(v[1]);
				list.remove(val);
			}else if(s.charAt(6)=='F'){
				list.removeFirst();
			}else{
				list.removeLast();
			
			}
		}
		int size=list.size();
		int i=0;
		for (Integer integer : list) {
			pw.print(integer);
			if(i<size-1)
				pw.print(" ");
			i++;
		}
		pw.println();
		pw.close();
	}

}

Measured memory_bytes: 560868
N=int(input())
a=list(map(int,input().split()))
avg=0
for j in range(N):
    avg+=a[j]
avg=avg/N
t=int(avg)
if abs(t-avg)>abs(t+1-avg):
    t=t+1
cost=0
for j in range(N):
    cost+=(a[j]-t)**2
print(cost)

Measured memory_bytes: 3064
S = input()

count = 0
tmp = 0
for i in range(len(S)):
    if S[i] == 'A' or S[i] == 'C' or S[i] == 'G' or S[i] == 'T':
        tmp += 1
        if i == len(S) - 1:
            if count < tmp:
                count = tmp
                tmp = 0
    else:
        if count < tmp:
            count = tmp
            tmp = 0

print(str(count))

Measured memory_bytes: 3060
x,n = map(int,input().split())
p = list(map(int,input().split()))
p_ans = [200] * 2001
count = 0
for i in range(-1000,1001):
    if not(i in p):
        p_ans[count] = abs(x-i) 
    count += 1
p_min = min(p_ans)
for i in range(len(p_ans)):
    if p_min == p_ans[i]:
        print(i-1000)
        exit()

Measured memory_bytes: 9224
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define all(n) begin(n), end(n)

int a[1010];
int n;

string solve(){
    set<string> S;
    for(int i = 0; i < n; i++){
        string cur;
        for(int j = i; j < n; j++){
            cur += (char)(a[j]+'0');
            if(cur.size() > 10) continue;
            S.insert(cur);
        }
    }
    for(int i = 0; i < 1e9; i++){
        string s = to_string(i);
        if(S.find(s) != S.end()) continue;
        return s;
    }
    return "";
}

int main(){
    while(cin >> n){
        rep(i,n) cin >> a[i];
        cout << solve() << endl;
    }
}

Measured memory_bytes: 4012
// ######      ###      #######    #######    ##     #     #####        ###     ##### //
// #     #    #   #          #        #       # #    #    #     #      #   #     ###  //
// #     #   #     #        #         #       #  #   #   #       #    #     #    ###  //
// ######   #########      #          #       #   #  #   #           #########    #   //
// #     #  #       #     #           #       #    # #   #    ####   #       #    #   //
// #     #  #       #    #            #       #     ##   #    #  #   #       #        //
// ######   #       #   #######    #######    #      #    #####  #   #       #    #   //

// #pragma GCC optimize(2)
// #pragma GCC optimize(3)
// #pragma GCC optimize("Ofast,no-stack-protector,unroll-loops,fast-math,O3")
// #pragma GCC target("avx,avx2,fma")
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double lld;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef pair<ll, ll> ppl;
#define ain(a,n) for(ll i=0;i<(n);++i)	cin>>(a)[i];
#define DEBUG(x) cout << '>' << #x << ':' << x << endl;
#define loop(i,n) for(ll i=0;i<(n);++i)
#define FOR(i,a,b) for(ll i=(a);i<=(b);++i)
#define FORD(i,a,b) for(ll i=(a);i>=(b);--i)
#define cases ll T=0;cin>>T;while(T--)
#define ff first
#define ss second
#define all(v) v.begin(),v.end()
#define END "\n"
#define pb push_back
#define mp make_pair
#define go(c,itr) for(auto itr=(c).begin(); itr!=(c).end(); ++itr)
// #define back(c,itr) for(auto itr=(c).rbegin(); itr!=(c).rend(); ++itr)
#define PI 3.14159265359
#define inf 9e18
#define MOD 1000000007
#define MODU 998244353
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define MAXN 300005
const string alpha = "abcdefghijklmnopqrstuvwxyz";
const ll N = 200005;
const long double epsilon = 1e-9;
ll binexp(ll a, ll b, ll m) {
	a %= m;
	ll res = 1;
	while (b > 0) {
		if (b & 1)
			res = res * a % m;
		a = a * a % m;
		b >>= 1;
	}
	return res;
}
ll modinvfermat(ll a, ll m)
{
	return binexp(a, m - 2, m);
}
void task(bool flag)
{
	if (flag)
		cout << "YES\n";
	else
		cout << "NO\n";
}
ll lcm(ll a, ll b)
{
	return ((1LL * a * b) / (__gcd(a, b)));
}

signed main() {
// #ifndef ONLINE_JUDGE
// 	freopen("input.txt", "r", stdin);
// 	freopen("output.txt", "w", stdout);
// #endif
	fast
	ll n;
	cin >> n;
	if (n >= 30)
		cout << "Yes\n";
	else
		cout << "No\n";



// #ifndef ONLINE_JUDGE
// 	cout << "\nTime Elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " sec\n";
// #endif
	return 0;
}


Measured memory_bytes: 3652
#include <iostream>
#include <bits/stdc++.h>
using namespace std;
int main()
{   cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout.tie(0);cin.sync_with_stdio(0);cout.sync_with_stdio(0);
      int a,b,c,s;
      cin >> a >> b;
      cout << a*b <<endl;
    return 0;
}

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

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  
  int h, w;
  cin >> h >> w;
  
  string s;
  for (int i = 0; i < h; i++) {
    for (int j = 0; j < w; j++) {
      cin >> s;
      if (s == "snuke") {
        cout << (char) (j + 'A') << i + 1 << '\n';
        return 0;
      }
    }
  }
}

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

int main() {
  int n, m;
  cin >> n >> m;
  vector<int> v(n, 0);
  for (int i = 0; i < m; i++) {
  	int start, end;
    cin >> start >> end;
    v[start - 1]++;
    v[end - 1]++;
  }
  
  for (int i = 0; i < n; i++) {
  	cout << v.at(i) << endl;
  }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
 
using namespace std;
 
typedef long long ll;
typedef long double ld;
 
typedef pair<ll, ll> p;
 
#define MOD 1000000007
 
int main() {
	cin.tie(0);
    ios::sync_with_stdio(false);

    int N, M;
    cin >> N >> M;

    vector<vector<int> > v(N);

    for(int i = 0; i < M; i++) {
        int a, b;
        cin >> a >> b;
        a--;
        b--;
        v[a].push_back(b);
    }

    int S, T;
    cin >> S >> T;
    S--;
    T--;

    vector<vector<bool> > b(N, vector<bool>(3));

    queue<p> q;

    q.push(make_pair(S, 0));

    while(!q.empty()) {
        int x = q.front().first;
        int c = q.front().second;
        q.pop();
        if(b[x][c % 3]) continue;
        b[x][c % 3] = true;
        if(x == T && c % 3 == 0) {
            cout << c / 3 << endl;
            return 0;
        }
        c++;
        for(int i = 0; i < v[x].size(); i++) {
            q.push(make_pair(v[x][i], c));
        }
    }

    cout << -1 << endl;
}

Measured memory_bytes: 15588
#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")

#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>
#include <iomanip>


using namespace std;
using namespace __gnu_pbds;

typedef long long ll;
typedef long double ld;

typedef pair<int, int> pi;
typedef pair<ll,ll> pl;
typedef pair<ld,ld> pd;

typedef vector<int> vi;
typedef vector<ld> vd;
typedef vector<ll> vl;
typedef vector<pi> vpi;
typedef vector<pl> vpl;

#define rep(i, a, b) for (int i=a; i<(b); i++)
#define rp(i, a) for (int i=0; i<(a); i++)
#define repd(i,a,b) for (int i = (b)-1; i >= a; i--)
#define rpd(i,a) for (int i = (a)-1; i >= 0; i--)

#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define f first
#define s second
#define lb lower_bound
#define ub upper_bound
#define all(x) x.begin(), x.end()
#define shandom_ruffle random_shuffle

const int MOD = 1000000007;
const ll INF = 1e18;
const int MX = 100001; //check the limits, dummy

bool isEven(string s){
  if(s.length()%2 == 1) return false;
  rp(i,s.length()){
    if(s[i] != s[s.length()-1-i]) return false;
  }
  return true;
}

int main() {
    ios_base::sync_with_stdio(0); cin.tie(0);
    cout << std::setprecision(9);
    cout << std::fixed;

    ll n;
    cin >> n;
    ll a;
    ll ans[n];
    rep(i,1,n+1){
      cin >> a;
      if((n-i) %2 == 0) {
        ans[(n-i)/2] = a;
      }
      else {
        ans[i+(n-i-1)/2] = a;
      }

    }
    rp(i,n) cout << ans[i] << " ";
    cout << endl;
    return 0;
}

// read the question correctly (ll vs int)
// template by super1 derived from bqi343


Measured memory_bytes: 3840
//Zory-2018
#include<cmath>
#include<ctime>
#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<map>
#include<set>
#include<queue>
#include<deque>
#include<stack>
#include<bitset>
#include<vector>
#include<algorithm>
#include<iostream>
using namespace std;

namespace mine
{
	typedef long long ll;
	const int INF=0x3f3f3f3f;
	int qread()
	{
		int ans=0,f=1;char c=getchar();
		while(c<'0' or c>'9') {if(c=='-') f=-1;;c=getchar();}
		while(c>='0' and c<='9') ans=ans*10+c-'0',c=getchar();
		return ans*f;
	}

	const int MAX_N=1e6+10;
	int a[MAX_N];
	const double eps=1e-6;
	void main()
	{
		int n;scanf("%d",&n);
		int sum=0;
		for(int i=1;i<=n;i++) scanf("%d",&a[i]),sum+=a[i];
		double t=(double)sum/n;
		
		double tmp=1ll<<60;int pos=-1;
		for(int i=1;i<=n;i++)
		{
			double now=fabs(t-(double)a[i]);
			if(now<tmp-eps) tmp=now,pos=i;
		}
		printf("%d",pos-1);
	}
};
int main()
{
	srand(time(0));
	mine::main();
}


Measured memory_bytes: 256
#include <stdio.h>

#define QUEUE_SIZE 100000
#define NAME_LEN 10

typedef struct {
  char name[NAME_LEN];
  int time;
}process;

process Queue[QUEUE_SIZE];
int head, tail;

void print_process(process p)
{
  printf("%s %d\n", p.name, p.time);
  return;
}

void initialize(void)
{
  head = 0;
  tail = 0;
  return ;
}

process pop(void)
{
  process p;
  p = Queue[head];
  head = (head + 1) % QUEUE_SIZE;
  return p;
}

void append(process p)
{
  memcpy((void *)Queue[tail].name, (void *)p.name, NAME_LEN);
  Queue[tail].time = p.time;

  tail = (tail + 1) % QUEUE_SIZE;
  return;
}

int is_empty(void)
{
  return (head == tail);
}

int main(void)
{
  int n, q;
  int i;
  int time = 0;

  initialize();
  scanf("%6d %4d", &n, &q);

  for(i = 0; i < n; i++){
    process p;
    scanf("%10s %5d", p.name, &(p.time));
    append(p);
  }

  /* printf("%d\n", i); */

  while(!is_empty()){
    process p;
    int remain;
    p = pop();
    remain = p.time;
    p.time -= q;
    if(p.time <= 0){
      time += remain;
      printf("%s %d\n", p.name, time);
    }else{
      time += q;
      append(p);
    }
  }

  return 0;
}

Measured memory_bytes: 2160