akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <algorithm>
#include <cmath>
#include <map>
#include <vector>
#include <queue>
#include <functional>
#include <string>
#include <stack>
#include <set>
#include <sstream>
#include <iomanip>
#include <limits>
#include <cstring>

using namespace std;
using ll = long long;
typedef unsigned long long ull;
typedef pair<ll, ll> P;
typedef pair<double, double >pd;
typedef pair<string, string> sP;
typedef pair<ll, pair<ll, ll>> PP;


const ll mod = 1e4;
const ll MOD = 1e9 + 7;
const ll MOD2 = 998244353;
const ll INF = 1 << 30;
const ll INF2 = 9e18;
const double INF3 = 9e14;
const double eps = 1e-10;
const double PI = 3.14159265358979323846;
const int dx[4] = { 1,0,-1,0 }, dy[4] = { 0,1,0,-1 };
const int tx[8] = { -1,0,1,-1,1,-1,0,1 }, ty[8] = { -1,-1,-1,0,0,1,1,1 };

#define ALL(x) (x).begin(),(x).end()
#define ALLR(x) (x).rbegin(),(x).rend()
#define pb push_back
#define eb emplace_back
#define fr first
#define sc second

ll n, p[200010], cnt, l, t, x[200010];
vector<ll>place;


int main() {
	cin >> n >> l >> t;
	for (int i = 0;i < n;i++) {
		cin >> x[i] >> p[i];
	}

	for (int i = 0;i < n;i++) {//最終的な蟻の位置を求める
		if (p[i] == 1) {
			place.eb((x[i] + t) % l);
		}
		else {
			place.eb((x[i] - t + l * (ll)1e8) % l);
		}
	}
	sort(ALL(place));

	for (int i = 0;i < n;i++) {
		if (p[i] == 1) {
			cnt += (x[i] + t) / l;
		}
		else {
			cnt += (x[i] - t  - (l - 1)) / l;
		}
	}
	
	ll it1 = (cnt+n) % n;
	for (int i = it1;i < it1 + n;i++) {
		cout << place[(i + n) % n] << endl;
	}
	return 0;
}


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

int	main() {
	string S;
	cin >>S;
	if ("YAKI"==S.substr(0, 4))
		cout <<"Yes" <<endl;
	else
		cout <<"No" <<endl;
	return 0;
}



Measured memory_bytes: 256
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <deque>
#include <iomanip>
#include <iostream>
#include <queue>
#include <stack>
#include <utility>
#include <vector>
using std::cin;
using std::cout;
using std::endl;

struct Edge {
    int to;
    int64_t cost;
    Edge(int b, int64_t c) {
        to   = b;
        cost = c;
    }
};

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

    int n, m;
    cin >> n >> m;
    std::vector<Edge> edge[1001];
    for (int i = 0; i < m; i++) {
        int a, b, c;
        cin >> a >> b >> c;
        edge[a].push_back(Edge(b, c));
    }

    int64_t node[1001];
    node[1] = 0;
    for (int i = 2; i <= n; i++) {
        node[i] = -1 * std::pow(10, 13);
    }

    int64_t firstscore = 0, secondscore = 0;

    for (int i = 1; i <= 3 * n; i++) {
        for (int from = 1; from <= n; from++) {
            for (auto x : edge[from]) {
                int64_t before = node[x.to];
                int64_t after  = node[from] + x.cost;
                // cout << before << " " << after << endl;
                if (before < after) {
                    node[x.to] = after;
                }
            }
        }
        if (i == n - 1) {
            firstscore = node[n];
        } else if (i > n - 1) {
            if (node[n] > firstscore) {
                cout << "inf" << endl;
                return 0;
            }
        }
    }
    cout << node[n] << endl;

    return 0;
}


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

typedef long long int ll;
typedef pair<ll, ll> p_ll;
typedef vector<pair<ll, ll>> vec_p; //vector<pair<ll, ll>> pairs(n) ,pairs.at(i) = make_pair(i*i, i)

#define ture ture
#define flase false
#define falg flag

#define REP(i, x) for (ll i = 0; i < (ll)(x); i++)
#define REPS(i, x) for (ll i = 1; i <= (ll)(x); i++)
#define RREP(i, x) for (ll i = ((ll)(x)-1); i >= 0; i--)
#define RREPS(i, x) for (ll i = ((ll)(x)); i > 0; i--)
#define all(x) (x).begin(), (x).end()

const ll MOD = pow(10, 9) + 7;
const ll LLINF = pow(2, 61) - 1;//llの最大9*10^18
const int INF = pow(2, 30) - 1;

ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }

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

    ll N;
    string S;
    cin >>N ;

    vector<ll> a(N+1);
    REPS(i,N){
        cin >> a.at(i);
    }

    ll ans = 0;
    REPS(i, N)
    {
        if(a.at(i)%2==1&&i%2==1){
            ans++;
        }
    }

    cout << ans << endl;
}


Measured memory_bytes: 3612
#include <bits/stdc++.h>
#include <string.h>
#include <vector>
//s#define rep(i, n) for (int i = 0; i < (n); i++)
#define MAX 10000

using namespace std;

#define ll long long
#define pb push_back
#define mp make_pair
#define all(a) (a).begin(),(a).end()
#define rep(i,a,n) for(int i=a; i<n; i++)
#define r0 return 0
#define INF (int)1e15
#define MOD 1000000007

 int gcd(int a,int b){

   if(a%b == 0)
    return b;
   else
    return gcd(b,a%b);

 }

 int main(){

 long long a,b,c,k;
 int flag = 0,flag2=0;
 cin>>a>>b>>c;

 cin>>k;

 long long cnt=0;

  while(a>=b){
        b = b*2;
      cnt++;
    }

  while(b>=c){

   c*= 2;
    cnt++;
  }

   if(cnt<= k)
    cout<<"Yes"<<endl;
    else
        cout<<"No"<<endl;

  return 0;
 }

Measured memory_bytes: 3584
package main

import (
	"fmt"

)

func main() {

	var X int

	fmt.Scan(&X)

	cnt :=X


	for{

		okflg:=false

		for i:=2;i<cnt;i++{

			if cnt%i==0{

				okflg=true
				break
				
			}

		}

		if okflg ==false{

			fmt.Println(cnt)
			return

		}

		cnt++

	}

}

Measured memory_bytes: 512
#include<stdio.h>

int main(void){

unsigned long long a[101][101];
unsigned long long b[101][101];
unsigned long long c[101][101] = {0};
unsigned long long  n,m,l,k;

scanf("%lld %lld %lld",&n,&m,&l);

for(int i = 0; i<n; i++){
   for(int j =0; j<m; j++){
   scanf("%lld",&a[i][j]);
   }
}

for(int j = 0; j<m; j++){
    for(int k = 0; k<l; k++){
   scanf("%lld",&b[j][k]);
}
}

for(int i = 0; i < n; i++){
   for(int j = 0; j<m; j++){
       for(int k = 0; k<l; k++){
    c[i][k] += a[i][j] * b[j][k];
    
}
}
}
for(int i = 0; i<n; i++){
   for(k = 0; k<l-1; k++){
printf("%lld ",c[i][k]);
}
printf("%lld\n",c[i][l-1]);
}

return 0;
}




Measured memory_bytes: 2104
#include<iostream>
using namespace std;
int main(){
    int n,ans=0;
    cin>>n;
    int a[n],b[n],c[n-1];
    for(int i=0;i<n;i++)cin>>a[i];
    for(int i=0;i<n;i++)cin>>b[i];
    for(int i=0;i<n-1;i++)cin>>c[i];
    for(int i=0;i<n;i++){
        ans+=b[a[i]-1];
        ans+=(a[i]+1==a[i+1]?c[a[i]-1]:0);
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 256
package main

import "fmt"

const MAX int64 = 10000002

var prime [MAX]int64

func sieve() {
	var i int64 = 2
	for  ;i < MAX; i++{

		if prime[i] == int64(0){

			for j:=int64(2) ; i*j < MAX ; j++{
				if prime[i*j] == int64(0){
					prime[i*j] = i
				}
			}
		}

	}
}


func main() {

	sieve()
	//fmt.Printf("hello world\n")
	var n int64

	fmt.Scan(&n)
	ans := int64(0)
	for i:=int64(1) ;i<=n;i++{

		x := i
		count := int64(1)

		for x!=1{
			cur := int64(0)
			v := prime[x]
			if v==0{
				v = x
			}
			for x%v==0 {
				x = x / v
				cur++
			}
			cur++
			count = count*cur
		}

		//fmt.Printf("%v %v\n", i,count)
		ans += i*count
	}


	fmt.Printf("%v", ans)

}




Measured memory_bytes: 79992
def main():
    N = int(input())
    cnt = 0
    ab,a,b = 0,0,0
    for _ in range(N):
        s = input()
        for i in range(len(s)-1):
            if s[i:i+2]=="AB":
                cnt += 1
        if s[0]=="B" and s[-1]=="A":
            ab += 1
        elif s[0]=="B":
            b +=1
        elif s[-1]=="A":
            a +=1

    if ab==0:
        print(cnt+min(a,b))
    else:
        if a+b==0:
            print(cnt+ab-1)
        else:
            print(cnt+ab+min(a,b))

if __name__ == "__main__":
    main()

Measured memory_bytes: 55256
#include <stdio.h>
#include <stdlib.h>
#define H 2000002
#define K -2000000002
 
int left(int i){ return i*2; }
 
int right(int i){ return i*2 + 1; }
 
int parent(int i){ return i/2; }
 
void swap(int *x, int *y){
  int tmp;
  tmp = *x;
  *x = *y;
  *y = tmp;
}
 
int n;
 
void maxHeapify(int *arr, int i){
  int bigger;
  int l = left(i), r = right(i);
 

  if(l <= n && arr[l] > arr[i]) bigger = l;
  else bigger = i;
  if(r <= n && arr[r] > arr[bigger]) bigger = r;
 
  if(bigger != i){ // if arr[i]'s parent key larger than arr[i]'s key
    swap(&arr[i], &arr[bigger]);
    maxHeapify(arr, bigger);
  }
}
 
int extractMax(int *heap){
  if(n<1) printf("heap under flow\n");
 
  int max = heap[1];
  heap[1] = heap[n];
  n--;
  maxHeapify(heap,1);
  return max;
}
 
void increseKey(int *arr, int i, int key){
  if(key<arr[i]) printf("New key less than actual key\n");
  arr[i] = key;
  while(i>1 && arr[parent(i)]<arr[i]){
    swap(&arr[i],&arr[parent(i)]);
    i = parent(i);
  }
}
 
void heapInsert(int *heap, int key){
  n++;
  heap[n] = K;
  increseKey(heap,n,key);
}
 
int main(void){
  int k;
  int heap[H];
  char inst[10];
 
  while(1){
    scanf("%s", inst);
    if(inst[0] == 'e'){
      if(inst[1] == 'n') break;
      else printf("%d\n", extractMax(heap));
    }
    if(inst[0] == 'i'){
      scanf("%d", &k);
      heapInsert(heap, k);
    }
  }
  return 0;
}

Measured memory_bytes: 5204
use std::vec::Vec;
use std::cmp;

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

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

fn main() {
    let (a, b , c): (i64, i64, i64) = {
      let v = read_vec();
      (v[0], v[1], v[2])
    };
    let res = cmp::min(c, b / a);

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


Measured memory_bytes: 4352
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define pb push_back
#define fi first
#define se second
const int N = 3e5+6;
const int mod = 1e9+107;
const ll inf = 1e16;
void solve(){
   ll k,a,b,c;
   cin>>a>>b>>c>>k;
   ll ans = 0;
   ll z = min(a,k);
   ans+=z;
   k-=z;
   z = min(k,b);
   k-=z;
   z = min(k,c);
   ans-=z;
   k-=z;
   assert(k==0);
   cout<<ans<<endl;
}
int main(){
    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    int t=1;
//    cin>>t;
    while(t--)solve();
    return 0;
}


Measured memory_bytes: 3652
N = int(input())
S = input()

r = 0
g = 0
b = 0
for c in S:
    if c =="R":
        r +=1    
    if c =="G":
        g +=1
    if c =="B":
        b +=1
_avoid = 0
for i in range(N):
    for j in range(i,N):
        k = 2*j -i
        if k >= N:
            continue
        if k > j and not S[i] == S[j] and not S[i] == S[k] and not S[j] == S[k]:
            _avoid +=1
print(r*g*b-_avoid)

Measured memory_bytes: 9180
#include <bits/stdc++.h>
using namespace std;
#define ff first
#define ss second
#define pb push_back
#define debug(val) cerr << "The value of " << #val << " is = " << val << '\n';
typedef long long ll;
typedef unsigned long long ull;
const ll mod = 1e9 + 7;
const ll inf = 922337203685477;
const ll mininf = -922337203685477;
const ll nax = 2e5 + 5;

ll n, m, k, a[nax], b[nax], pref[nax];

int main(){
	ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
	
	cin >> n >> m >> k;
	for(ll i = 1; i <= n; i++){
		cin >> a[i];
	}
	for(ll i = 1; i <= m; i++){
		cin >> b[i];
	}
	ll ans = 0;
	for(ll i = 1; i <= m; i++){
		pref[i] = pref[i-1] + b[i];
		if(pref[i] <= k){
			ans = i;
		}
	}
	ll sum = 0;
	for(ll i = 1; i <= n; i++){
		sum += a[i];
		ll l = 0, r = m, ret = -1;
		while(l <= r){
			ll mid = (l + r) / 2;
			if(sum + pref[mid] <= k){
				ret = mid;
				l = mid + 1;
			}
			else{
				r = mid - 1;
			}
		}
		if(ret == -1){
			continue;
		}
		ans = max(ans, i + ret);
	}
	cout << ans << '\n';
}


Measured memory_bytes: 8368
INF  = 999999999
Node = Struct.new(:u, :d, :c, :p)

class Graph
  attr :nodes, :mat
  def initialize(n, matrix)
    @nodes = Array.new(n){ Node.new }
    @nodes.each_with_index{|node,idx| node.u = idx+1}
    @mat   = matrix.dup
  end

  def edge_exists?(row, col)
    #printf "  edge_exists?(#{row}, #{col}) => "
    row -= 1
    col -= 1
    result = if @mat[row][col] != -1 # or @mat[col][row] != -1
               true
             else
               false
             end
    #puts "#{result} => cost: #{@mat[row][col]}"
    result
  end

  def gen_uniq_edges()
    edges = []
    @nodes.each_with_index do |node,i|
      mat[i].map.with_index.select do |w,idx|
        w != -1
      end.each do |w,idx|
        edge = [node.u, idx+1].sort
        edges << edge
      end
    end
    edges.uniq
  end

  def dot_before_prim()
    puts "graph beforePrim {"
    gen_uniq_edges.each do |e|
      puts "  \"#{e.first}\" -- \"#{e.last}\" [label=#{mat[e.first-1][e.last-1]}]"
    end
    puts "}"
  end

  def prim(start = 1)
    @nodes = @nodes.each do |node|
      node.d = INF
      node.p = nil
      node.c = :white
    end
    start = (start-1).to_i
    @nodes[start].d = 0
    @nodes[start].p = -1
    next_u = nil

    while true
      mincost = INF

      @nodes.each do |node|
        if node.c != :black and node.d < mincost
          mincost = node.d
          next_u  = node.u
        end
      end
      #puts "mincost = #{mincost}, next_u = #{next_u}"

      break if mincost == INF

      @nodes[(next_u-1).to_i].c = :black

      @nodes = @nodes.map.with_index(1) do |node, v|
        if node.c != :black and edge_exists?(next_u, v) and mat[next_u-1][v-1] < node.d
          node.d = mat[next_u-1][v-1]
          node.p = next_u
          node.c = :gray
          #puts "  update: node(#{node.u}), d = #{node.d}, parent = #{next_u}"
          node
        else
          node
        end
      end
    end
  end
end

lines = $stdin.read
array = lines.split("\n")

N   = array[0].to_i
mat = Array.new(N).map{Array.new(N, 0)}

for i in 1..N
  row  = i - 1
  cols = array[i].split(" ").map(&:to_i)
  cols.each_with_index do |col, idx|
    mat[row][idx] = col
  end
end

graph = Graph.new(N, mat)
graph.prim(1)

sum = 0

graph.nodes.each_with_index do |n,i|
    if graph.nodes[i].p != -1
      sum += mat[i].detect do |e|
        e != -1 and e == n.d
      end
    end
end

#puts graph.dot_before_prim
puts sum

Measured memory_bytes: 9152
#include<iostream>
using namespace std;
int main(){
  int a,b,c,k;
  cin>>a>>b>>c>>k;
  if(a>=k)
    cout<<k;
  else if(k>a){
    if(k-a<=b)
    cout<<a;
    else if(k-a>b)
      cout<<2*a+b-k;
  }
}
 

Measured memory_bytes: 3636
#include <iostream>
#include <vector>
#include <string>
#include <queue>
#include <stack>
#include <unordered_set>
#include <unordered_map>

using namespace std;

int main() {

    string s;

    cin>>s;
    if(s=="ABC"){
        cout<<"ARC"<<endl;
    }else{
        cout<<"ABC"<<endl;
    }

    return 0;
}

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

// definition {{{ 1

// scaning {{{ 2
#define Scd(x) scanf("%d", &x)
#define Scd2(x,y) scanf("%d%d", &x, &y)
#define Scd3(x,y,z) scanf("%d%d%d", &x, &y, &z)

#define Scll(x) scanf("%llu", &x)
#define Scll2(x,y) scanf("%llu%llu", &x, &y)
#define Scll3(x,y,z) scanf("%llu%llu%llu", &x, &y, &z)

#define Scc(c) scanf("%c", &c);
#define Scs(s) scanf("%s", s);
#define Scstr(s) scanf("%s", &s);
// }}} 2

// constants {{{ 2
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
// }}} 2

// systems {{{ 2
#define Rep(x,y) for(int x = 0; x < y; x++)
#define Repe(x,y,z) for(int x = z; x < y; x++)
// }}} 2

// output {{{ 2
#define YesNo(a) (a)?printf("Yes\n"):printf("No\n");
// }}} 2

// }}} 1

bool compe( pair<ll,ll> A , pair<ll,ll> B ){
    if( A.second != B.second ) return A.second > B.second;
    else return A.first < B.first;
}

int main() {

    int N,K;
    Scd2(N,K);
    vector< pair<ll,ll> > t(N);
    Rep(i,N){
        Scll2(t[i].first,t[i].second);
    }
    sort(t.begin(),t.end(),compe);
    static ll sum[100002] = {};
    static ll resum[100002] = {};
    static bool hit[100002] = {};
    int k = 1;
    Rep(i,N){
        if( hit[ t[i].first ] ) continue;
        else{
            hit[ t[i].first ] = true;
            sum[k] += t[i].second;
            sum[k+1] = sum[k++];
        }
    }
    int l = 1;
    Rep(i,N){
        if( hit[ t[i].first ] ){
            hit[ t[i].first ] = false;
            continue;
        }
        resum[l] += t[i].second;
        resum[l] = resum[l++];
    }

    ll ans = 0;
    // i is eachSUM
    for( ll i = 0; i < K+1; i++ ){
        if( i > k-1 ) break;
        if( K-i+1 > l ) continue;
        // printf ("%llu\n", sum[i] + resum[K-i] + i*i );
        ans = max(ans, sum[i] + resum[K-i] + i*i );
    }
    printf ("%llu\n", ans);

    return 0;
}


/*
 *
 *
 * 1 2 3 3 3
 * 1 1 3 3 3
 * +3+3+3+0+0
 * 4 4 6 3 3
 *
 *
 */


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

const int INF = 1e8;

int bfs(int s, int t, vector< vector<pii> > &g){
  int n = g.size();
  vector<int> d(n,INF);
  d[s] = 0;
  deque<int> q;
  q.push_back(s);

  while(q.size()){
    int v = q.front(); q.pop_front();
    if(v==t)break;
    
    for(pii p : g[v]){
      int u = p.second;
      if(p.first == 0 && d[u]==INF){
	d[u] = d[v];
	q.push_front(u);
      }else if(p.first == 1 && d[u]==INF){
	d[u] = d[v]+1;
	q.push_back(u);
      }
    }
  }
  return d[t];
}

int main(){
  cin.tie(0); ios::sync_with_stdio(0);
  int n;
  while(cin >> n, n){
    int ns = 0;
    map<string,int> id;
    vector<pii> edges;
    vector<string> vs;

    rep(i,n){
      string s; cin >> s;
      vs.push_back(s);
      int p = s.find("-");
      string a = s.substr(0,p), b = s.substr(p+1);
      if(id.count(a)==0)id[a] = ns++;
      if(id.count(b)==0)id[b] = ns++;
      edges.push_back(pii(id[a],id[b]));
    }

    vector<vi> adj(ns,vi(ns,0));
    vector< vector<pii> > g(ns);
    for(pii e : edges){
      int u = e.first, v = e.second;
      adj[u][v] = 1;
      g[u].push_back(pii(1,v));
    }

    rep(i,ns)rep(j,i){
      int a = 0, b = 0, c = 0;
      rep(k,ns){
	if((adj[i][k] && adj[j][k]) || (adj[k][i] && adj[k][j]))a++;
	if(adj[i][k] && adj[k][j])b++;
	if(adj[j][k] && adj[k][i])c++;
      }
      if(a && !b && !c){
	g[i].push_back(pii(0,j));
	g[j].push_back(pii(0,i));
      }
    }
    cout << ns << endl;

    int m;
    cin >> m;
    rep(i,m){
      string s; cin >> s;
      vs.push_back(s);
      int p = s.find("-");
      string a = s.substr(0,p), b = s.substr(p+1);
      if(id.count(a)==0 || id.count(b)==0){
	cout << "NO" << endl; continue;
      }

      int d = bfs(id[a],id[b],g);
      if(d==INF || d%2==0)cout << "NO" << endl;
      else cout << "YES" << endl;
    }
  }
}

Measured memory_bytes: 1592
n = gets.chomp.to_i
a = gets.chomp.split(" ").map(&:to_i)
if n == 1 then
    puts 0
    exit
end
costs = Array.new(n).map{Array.new(201)}
a.each_with_index do |e, i|
    (-100..100).each do |j|
        costs[i][100+j] = (e-j)**2
    end
end

costs = costs.transpose
ans = []

costs.each do |arr|
    ans << arr.inject(:+)
end

puts ans.min

Measured memory_bytes: 2044
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <cmath>
#include <map>
#include <queue>
#include <iomanip>
#include <set>
#include <tuple>
#define mkp make_pair
#define mkt make_tuple
#define rep(i,n) for(int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;
const ll MOD=1e9+7;

int main(){
  int a,b;
  cin>>a>>b;
  
  for(int i=1;i<=3;i++){
    if(i!=a&&i!=b){
      cout<<i<<endl;
    }
  }

  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define MAX_N 200002
#define mod 1000000007
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
#define FOR(i, a, b) for(ll i=a; i<b; i++)
#define REP(i, n) for(ll i=0; i<n; i++)
#define REV(i, n) for(ll i=n-1; i>=0; i--)
#define ALL(v) v.begin(), v.end()
#define pb push_back
const ll INF = 9e18;
ll n, k, a[MAX_N];
ll used[MAX_N];

signed main(){
    cin >> n >> k;
    FOR(i, 1, n+1){
        cin >> a[i];
    }
    ll s = 1, cnt = 0;
    REP(i, n+1) used[i] = 0;
    used[1] = 1;
    bool once = true;

    ll i = 0;
    while(i < k){
        s = a[s];
        i++;
        if(used[s] == 1) cnt++;
        else if(used[s] == 2 && once){
            k = (k - i) % cnt + i;
            once = false;
        }
        used[s]++;
    }
    
    cout << s << endl;
    return 0;
}

Measured memory_bytes: 6764
n=int(input())
cnt = 0
cnt_i = 0
for i in range(1,n+1,2):
    for j in range(1,i+1):
        
        if i%j==0:
            cnt+=1
        

    if cnt==8:
        cnt_i+=1
        
    cnt = 0

print(cnt_i)

Measured memory_bytes: 3060
#include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <algorithm>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <regex>
#include <numeric>

using namespace std;


/*--- Macro ---*/
#define rep(i, n) for(int i=0; i<(int)n; i++)
#define rep1(i, n) for(int i=1; i<(int)n; i++)
#define mp make_pair
#define pb push_back


/*---  Type ---*/
typedef long long ll;


/*--- Constants ---*/
template <typename T> const T INF = numeric_limits<T>::max() / 10;
const int MOD = (int)1e9 + 7;

// 4-direction
int dy4[] = {0,  1, -1,  0};
int dx4[] = {1,  0,  0, -1};

// 8-direction
int dy8[] = {0,  1,  1,  1,  0, -1, -1, -1};
int dx8[] = {1,  1,  0, -1, -1, -1,  0,  1};

// Floating
const double EPS = 1e-11;
#define EQ0(x) (abs(x) < EPS)
#define EQ(x, y) (abs(a-b) < EPS)

/**
  辺
  to: 辺の行き先
  cost: 辺の重み
  T: 重みの型
*/
template <typename T = int>
struct Edge {
  int to;
  T cost;
  Edge(int to, T cost) : to(to), cost(cost) {}
};

/**
  n: 頂点数
  graph: グラフ本体
*/
template <typename T = int>
class Graph {
  public:
    int n;
    vector<vector<Edge<T>>> graph;

    Graph(int n) {
      this->n = n;
      this->graph.assign(n, vector<Edge<T>>());
    }

    void addEdge(int from, int to, T cost) {
      this->graph[from].push_back(Edge<T>(to, cost));
    }
};

class P {
  public:
    int n;
    vector<bool> visited;
    int now;

    P(int n) {
      this->n = n;
      this->visited.resize(n);
      fill(this->visited.begin(), this->visited.end(), false);
      visited[0] = true;
      this->now = 0;
    }

    bool allVisited() {
      rep(i, this->n) {
        if(!visited[i]) {
          return false;
        }
      }
      return true;
    }

    P copy() {
      P cp = P(this->n);
      vector<bool> cvisited(this->n);
      rep(i, this->n) cvisited[i] = this->visited[i];
      cp.visited = cvisited;
      cp.now = this->now;
      return cp;
    }
};

int main() {
  int n, m;
  cin >> n >> m;
  Graph<int> g = Graph<int>(n);
  rep(i, m) {
    int a, b;
    cin >> a >> b;
    g.addEdge(a-1, b-1, 1);
    g.addEdge(b-1, a-1, 1);
  }

  queue<P> Q;
  Q.push(P(n));

  int ans = 0;
  while(!Q.empty()) {
    P p = Q.front(); Q.pop();
    if(p.allVisited()) {
      ans++;
      continue;
    }

    for(auto e : g.graph[p.now]) {
      if(p.visited[e.to]) continue;
      P cp = p.copy();
      cp.visited[e.to] = true;
      cp.now = e.to;
      Q.push(cp);
    }
  }

  cout << ans << endl;


  return 0;
}

Measured memory_bytes: 640
#include<stdio.h>

int main(){
  int n, prc, each, cal, ecal[100], i, j, tmp, oprc, tmpprc;

  scanf("%d%d%d%d", &n, &prc, &each, &cal);
  oprc=cal/prc;
  for(i=0; i<n; i++){
    scanf("%d", &ecal[i]);
  }
  for(i=0; i<n-1; i++){
    for(j=i+1; j<n; j++){
      if(ecal[i]<ecal[j]){
	tmp=ecal[i];
	ecal[i]=ecal[j];
	ecal[j]=tmp;
      }
    }
  }
  
  for(i=0; i<n; i++){
    prc+=each;
    cal+=ecal[i];
    tmpprc=cal/prc;
    if(tmpprc>oprc){
      oprc=tmpprc;
    }
  }

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

  return 0;
}

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


#define mod                1000000000000000007
#define pi                 3.1415926535897932384626433832795
#define ll                 long long
#define pb                 push_back
#define pii                pair < int , int >
#define vecsort(v)         sort(v.begin(),v.end())
#define lcm(x,y)           (x/__gcd(x,y))*y
#define forn(i,n)          for(i = 0 ; i < n ; i++)
#define deb(x)             cout << #x << " " << x << endl;
#define vecsum(v)          accumulate(v.begin(), v.end(), 0)
#define T(t)               cout << "Case " << t <<": ";
#define fast_cin           ios_base::sync_with_stdio(false);cin.tie(NULL)


char a[10][10],b[10][10];
int n , m , k;

void copy_matrix(){

     for( int i = 0 ; i < n  ; i++ ){
         for( int j = 0 ; j < m ; j++ ){
             b[i][j] = a[i][j];
         }
     }

}

void color( int i , int j ){


    for( int x = 0 ; x < n ; x++ ){

        if( i & ( 1 << x) ){

            for( int y = 0 ; y < m ; y++ ){

                b[x][y] = '$';
            }
        }
    }

    for ( int x = 0; x < m ; x++ ){

        if( j & ( 1 << x) ){

            for( int y = 0 ; y < n  ; y++ ){

                b[y][x] = '$';
            }
        }
    }

    return ;
}


bool check(){

    int cnt = 0 ;
     for( int i  = 0 ; i < n ; i++ ){
         for( int j = 0 ; j < m ; j++ ){
             if( b[i][j] == '#' ){
                 cnt++;
             }
         }
     }
     if( cnt == k )return true;
     else return false;
}


void solve( ){

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

      for ( int i = 0 ; i < (1<<n) ; i++ ){
          for( int j = 0 ; j < (1<<m) ; j++){

               copy_matrix();
               color(i,j);
               if( check() ){
                   ans++;
               }
          }
      }
      cout << ans << endl;
}





int main() {

      solve();



    return 0;
}

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

// https://qiita.com/EqualL2/items/6e3de4d1d09e2e5f3611
ll euclidean_gcd(ll a, ll b) {
  if(a < b) return euclidean_gcd(b, a);
  ll r;
  while ((r=a%b)) {
    a = b;
    b = r;
  }
  return b;
}


int main() {
    ll a,b;
    std::cin >> a>>b;
    ll g = euclidean_gcd(a,b);
    set<ll> s;
    s.insert(1);
    for (int i = 2; i <= (ll)sqrt(g); i++) {
        while(g%i==0){
            s.insert(i);
            g /= i;
        }
    }
    s.insert(g);
    std::cout << s.size() << std::endl;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <iostream>
#include <string>
#include <stack>

using namespace std;

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

int main() {
    string S;
    cin >> S;

    stack<char> st;
    REP(0, i, S.size()){
        st.push(S[i]);
    }

    stack<char> ts;
    int count = 0;
    REP(0, i, S.size()){
        char c = st.top(); st.pop();

        if (!ts.empty()) {
            char d = ts.top(); ts.pop();

            if (c != d) {
                count += 2;
            } else {
                ts.push(d); ts.push(c);
            }
        } else {
            ts.push(c);
        }
    }

    cout << count << endl;

    return 0;
}


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

int main() {
    int N;
    cin >> N;
 
    // 奇数の個数が、偶数であればYES.
    int num_odd = 0;
    for (int i=0; i<N; i++) { 
        int tmp;
        cin >> tmp;
        if (tmp % 2 == 1) { num_odd++; }
    }

    if (num_odd % 2 == 0) { cout << "YES" << endl; }
    else { cout << "NO" << endl; }
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
#define ll long long int
#define rep(i,n) for( int i = 0; i < n; i++ )
#define rrep(i,n) for( int i = n; i >= 0; i-- )
#define REP(i,s,t) for( int i = s; i <= t; i++ )
#define RREP(i,s,t) for( int i = s; i >= t; i-- )
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define INF 2000000000
#define mod 1000000007
#define INF2 1000000000000000000


int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int H, W;
    cin >> H >> W;
    string S[51];
    rep(i, H) cin >> S[i];
    int ans[51][51] = {};
    rep(i, H) {
        rep(j, W) {
            rep(k, 9) {
                int x = i + k % 3 - 1;
                int y = j + k / 3 - 1;
                if(x < 0 || x >= H || y < 0 || y >= W) continue;
                if(S[x][y] == '#') ans[i][j]++;
            }
        }
    }
    rep(i, H) {
        rep(j, W) {
            if(S[i][j] == '#') cout << "#";
            else cout << ans[i][j];
        }
        cout << endl;
    }

    return 0;
}


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

int N;
string S;

int main() {
    cin >> N >> S;
    
    int ans = 0;
    for (int i = 0; i < N - 2; i++) {
        if (S.substr(i, 3) == "ABC") ans++;
    }

    cout << ans << endl;

    return 0;
}

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

int Euclidean(int x, int y){
    if (x < y) swap(x, y);
    int r = x % y;
    while (r != 0){
        x = y;
        y = r;
        r = x % y;
    }
    return y;
}
int main(){
    int K;
    cin >> K;
    int ans = 0;
    for (int a = 1; a <= K; a++){
        for (int b = 1; b <= K; b++){
            for (int c = 1; c <= K; c++){
                ans += Euclidean (a, Euclidean(b, c));
            }
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 3632
#include "bits/stdc++.h"
#define ALL(x) x.begin(),x.end()
#define rep(i,n) for(int i=0;i<n;++i)
#define END(x) (*(x.end()-1))
#define INF INT_MAX

using namespace std;
typedef long long ll;


template<typename T>
T gcd(T a, T b){
   if (a%b == 0){
       return(b);
   }
   else{
       return(gcd(b, a%b));
   }
}

template<typename T>
T lcm(T a,T b){
    return a/gcd(a,b)/b;
}

int main(void){
    ll n,k;
    cin>>n>>k;
    ll a_;
    vector<ll>a(n,0);
    rep(i,n){
        cin>>a_;
        a[a_-1]++;
    }
    sort(ALL(a));
    ll ans=0;
    rep(i,n-k){
        ans+=a[i];
    }
    cout<<ans;

}
/*

*/


Measured memory_bytes: 1792
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <bitset>
#include<vector>
#include<utility>
#include<fstream>
#include<queue>
#include <iomanip>
using namespace std;
typedef long long ll;
#define rep(i,k) for(i=0;i<k;i++)
#define P pair<ll,ll>
int s[2005];
int t[2005],u[200];

ll i, a, b, c,n,m, z=0;
int day[1005], pos[1005];
vector<int> ss;
vector<int> tt[100000];
int main() {
	cin >> n;
	a = -1; b = -1;
	rep(i, n) {
		cin >> b;
		if (b - a == 1)ss.push_back(a-1);
		a = b;
	}
	rep(i, n) {
		cin >> m;
		z += m;
	}
	rep(i, n - 1)cin >> u[i];
	rep(i, ss.size()) {
		z += u[ss[i]];
	}


	cout << z;
}

Measured memory_bytes: 2560
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <math.h>

using namespace std;

int main(int argc, char const *argv[]) {
  int n;
  int k;
  cin >> n >> k;
  vector<char> d(k);
  for (size_t i = 0; i < k; i++) cin >> d[i];
  sort(d.begin(), d.end());

  int ans = 0;

  while (true) {
    string s = to_string(ans);
    vector<char> data(s.begin(), s.end());
    sort(data.begin(), data.end());
    data.erase(unique(data.begin(), data.end()), data.end());
    vector<char> vec_inter;
    set_intersection(data.begin(), data.end(), d.begin(), d.end(), back_inserter(vec_inter));

    if (ans >= n && vec_inter.size()==0) break;
    else ans++;
  }

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 256
//Written by Zhu Zeqi
//Come on,baby
//Hack,please
#include<cmath>
#include<math.h>
#include<ctype.h>
#include<algorithm>
#include<bitset>
#include<cassert>
#include<cctype>
#include<cerrno>
#include<cfloat>
#include<ciso646>
#include<climits>
#include<clocale>
#include<complex>
#include<csetjmp>
#include<csignal>
#include<cstdarg>
#include<cstddef>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<ctime>
#include<cwchar>
#include<cwctype>
#include<deque>
#include<exception>
#include<fstream>
#include<functional>
#include<iomanip>
#include<ios>
#include<iosfwd>
#include<iostream>
#include<istream>
#include<iterator>
#include<limits>
#include<list>
#include<locale>
#include<map>
#include<memory>
#include<new>
#include<numeric>
#include<ostream>
#include<queue>
#include<set>
#include<sstream>
#include<stack>
#include<stdexcept>
#include<streambuf>
#include<string>
#include<typeinfo>
#include<utility>
#include<valarray>
#include<vector>
#include<string.h>
#include<stdlib.h>
#include<stdio.h>
#define CLR(x) memset(x,0,sizeof x)
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define pii pair<int,int>
#define vi vector<int>
#define MAX 1000000000000000000
#define MOD 1000000007
#define PI 3.141592653589793238462
#define INF 0x3f3f3f3f
typedef long long ll;
//orz yht
using namespace std;
string i_s(int x){
	if(x==0)
	return "0";
	string ret="";
	while(x){
		ret=ret+(char)(x%10+'0');
		x/=10;
	}
	reverse(ret.begin(),ret.end());
	return ret;
}
string add(string a,string b){
	if(a=="")
	a="0";
	if(b=="")
	b="0";
	if(a.length()<b.length())
	swap(a,b);
	while(b.length()<a.length()){
		b='0'+b;
	}
	for(int i=0;i<a.length();i++){
		a[i]=a[i]+(b[i]-'0');
	}
	bool big=false;
	for(int i=a.length()-1;i>=0;i--){
		if(big){
			a[i]++;
		}
		big=false;
		if(a[i]>'9'){
			a[i]=a[i]-10;
			big=true;
		}
	}
	if(big)
	a='1'+a;
	return a;
}
string mul(string a,string b){
	vector<int> va,vb;
	if(a=="0" || b=="0")
	return "0";
	string ans;
	for(int i=0;i<a.length();i++){
		va.push_back(a[i]-'0');
	}
	for(int i=0;i<b.length();i++){
		vb.push_back(b[i]-'0');
	}
	reverse(va.begin(),va.end());
	reverse(vb.begin(),vb.end());
	vector<int> res;
	res.clear();
	res.resize(1005);
	for(int i=0;i<a.length();i++){
		for(int j=0;j<b.length();j++){
			res[i+j]+=(va[i]*vb[j]);
		}
	}
	for(int i=0;i<1005;i++){
		if(res[i]>9){
			res[i+1]+=(res[i]/10);
			res[i]%=10;
		}
	}
	for(int i=0;i<1005;i++){
		ans+=(res[i]+'0');
	}
	reverse(ans.begin(),ans.end());
	int k=0;
	while(ans[k]=='0'){
		k++;
	}
	ans=ans.substr(k);
	return ans;
}
bool is_prime(int n){
	if(n<2)
    return false;
    for(int i=2;i*i<=n;i++)
    if(n%i==0)
    return false;
    return true;
}
int h,w,c[30],cnt1,cnt2,ans1,ans2;
string s;
int main(){
	//freopen("input.in","r",stdin);
	//freopen("output.out","w",stdout);
	cin>>h>>w;
	for(int i=0;i<h;i++){
		cin>>s;
		for(int j=0;j<w;j++)
		c[s[j]-'a']++;
	}
	for(int i=0;i<26;i++){
		if(c[i]%2)
		cnt1++;
		if(c[i]%4==2)
		cnt2++;
	}
	ans1=h*w%2;
	ans2=h%2*(w/2)+w%2*(h/2);
	if(cnt1!=ans1 || cnt2>ans2 || (ans2-cnt2)%2)
	cout<<"No";
	else
	cout<<"Yes";
	//system("pause");
	return 0;
}

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

int main()
{
  
  	int a, b, c, d;
    cin >> a>>b>>c>>d;
    
  	if(a+b > c+d) cout<<"Left"<<endl;
  	else if(a+b < c+d) cout<<"Right"<<endl;
 	else cout<<"Balanced"<<endl;
  
  return 0;
}


Measured memory_bytes: 3596
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vint;
typedef pair<int,int> pint;
typedef vector<pint> vpint;
#define rep(i,n) for(int i=0;i<(n);i++)
#define REP(i,n) for(int i=n-1;i>=(0);i--)
#define reps(i,f,n) for(int i=(f);i<(n);i++)
#define each(it,v) for(__typeof((v).begin()) it=(v).begin();it!=(v).end();it++)
#define all(v) (v).begin(),(v).end()
#define eall(v) unique(all(v), v.end())
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define chmax(a, b) a = (((a)<(b)) ? (b) : (a))
#define chmin(a, b) a = (((a)>(b)) ? (b) : (a))
const int MOD = 1e9 + 7;
const int INF = 1e9;
const ll INFF = 1e18;

int main(int argc, char const *argv[])
{
	int n, T; cin >> n >> T;
	vector<int> c(n), t(n); {
		rep(i, n) cin >> c[i] >> t[i];
	}

	vector<pair<int, int>> v; {
		rep(i, n) {
			if (t[i] <= T) v.pb(mp(c[i], i));
		}
	}
	sort(all(v));
	if (v.size() > 0) printf("%d\n", v[0].first);
	else printf("TLE\n");
	return 0;
}

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

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

  int r, D, x;
  cin >> r >> D >> x;
  rep(i, 0, 10) {
    int ans = r * x - D;
    cout << ans << endl;
    x = ans;
  }
}


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

int main() {
  int s, a, b, c;
  cin >> s;
  a = s%2;
  b = (s/10)%2;
  c = (s/100)%2;

  int ans = a+b+c;
  cout << ans << endl;
}

Measured memory_bytes: 3612
//minamoto
#include<bits/stdc++.h>
#define R register
#define fp(i,a,b) for(R int i=(a),I=(b)+1;i<I;++i)
#define fd(i,a,b) for(R int i=(a),I=(b)-1;i>I;--i)
#define go(u) for(int i=head[u],v=e[i].v;i;i=e[i].nx,v=e[i].v)
template<class T>inline bool cmax(T&a,const T&b){return a<b?a=b,1:0;}
template<class T>inline bool cmin(T&a,const T&b){return a>b?a=b,1:0;}
using namespace std;
const int N=5e5+5;
int cnt[N],c[N],sum[N],n,m,res;
int main(){
	scanf("%d%d",&n,&m);
	for(R int i=1,x;i<=n;++i)scanf("%d",&x),++c[x],++cnt[x%m];
	fp(i,1,1e5)sum[i%m]+=c[i]>>1;
	for(R int i=1,x;i<m-i;++i){
		x=min(cnt[i],cnt[m-i]);
		res+=x,cnt[i]-=x,cnt[m-i]-=x;
	}
	if(m&1^1)res+=cnt[m>>1]>>1,cnt[m>>1]&=1;
	if(cnt[0])res+=cnt[0]>>1,cnt[0]&=1;
	fp(i,0,m-1)res+=min(sum[i],cnt[i]>>1);
	printf("%d\n",res);
	return 0;
}

Measured memory_bytes: 2944
import java.util.Scanner;

class Main{
    
    public static void main(String[] args){
        
        Scanner sc = new Scanner(System.in);
        
        int a = sc.nextInt();
        int b = sc.nextInt();
        
        if(a == b){
            System.out.println("a == b");
        }else {
            if(a > b){
                System.out.println("a > b");
            }else if(a < b){
                System.out.println("a < b");
            }
        }
    }
}


Measured memory_bytes: 26408
#include<bits/stdc++.h>
using namespace std;
 
#define int             long long
#define ld              long double
#define fi              first
#define se              second
#define pb              push_back
#define mp              make_pair
#define fo(i,n)         for(i=0;i<n;i++)
#define fo1(i,n)        for(i=1;i<=n;i++)
#define foab(i,a,b)     for(i=a;i<=b;i++)
#define of(i,n)         for(i=n-1;i>=0;i--)
#define of1(i,n)        for(i=n;i>=1;i--)
#define ofab(i,a,b)     for(i=a;i>=b;i--)
#define sq(a)           (a)*(a)
#define all(x)          x.begin(),x.end()
#define rall(x)         x.rbegin(),x.rend()
#define sortall(x)      sort(all(x))
#define sortrall(x)     sort(rall(x))
#define clr(x)          memset(x,0,sizeof(x))
#define tr(it, a)       for(auto it=a.begin();it!=a.end();it++)
#define pii             pair<int,int>
#define mk(arr,n,type)  type *arr=new type[n];
#define vi              vector<int>
#define si              set<int>
#define usi             unordered_set<int>
#define mii             map<int,int>
#define umii            unordered_map<int,int>
#define pqmx            priority_queue<int>
#define pqmn            priority_queue<int,vi,greater<int>>
#define setbits(x)      __builtin_popcountll(x)
#define trailzrobits(x) __builtin_ctzll(x)
#define leadzrobits(x)  __builtin_clzll(x)
#define paritybits(x)   __builtin_parityll(x)
#define gcd             __gcd
#define lcm(x, y)       (x * y)/gcd(x,y)
#define endl            '\n'
#define sz(s)           (int)s.size()
#define sp(x,y)         fixed<<setprecision(y)<<x
const int mod = 1000000007;
const int inf = 1000000000000000000;
const ld PI = 3.1415926535897932384626;
const ld eps = 1e-12;
void __print(int32_t x) {cout<<x;}
void __print(int x) {cout<<x;}
void __print(double x) {cout<<x;}
void __print(ld x) {cout<<x;}
void __print(float x) {cout<<x;}
void __print(bool x) {cout<<(x?"true":"false");}
void __print(char x) {cout <<'\''<<x<<'\'';}
void __print(const char *x) {cout <<'\"' <<x<<'\"';}
void __print(const string &x) {cout<<'\"'<<x<<'\"';}
template<typename T,typename V>     void __print(const pair<T,V> &x) {cout<<'{';__print(x.first);cout<<',';__print(x.second);cout<<'}';}
template<typename T>                void __print(const T &x) {int f=0;cout<<'{';for(auto &i:x)cout<<(f++?",":""),__print(i);cout<<"}";}void _print(){cout<<"]\n";}
template <typename T,typename... V> void _print(T t, V... v) {__print(t);if(sizeof...(v))cout<<", ";_print(v...);}
#ifndef ONLINE_JUDGE
#define dbg(x...) cout<<"["<<#x<<"]=[";_print(x)
#else 
#define dbg(x...)
#endif
int power(int base,int exp) {int res=1;base%=mod;while(exp>0){if(exp&1)res=(res*base)%mod;base=(base*base)%mod;exp=exp>>1;}return res;}
int inv(int x) {return power(x,mod-2)%mod;}
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++




const int N=1e6+6,M=N;
int i,j;

void solve() {
    
    int x; cin>>x;
    if(x>=30) cout<<"Yes";
    else cout<<"No";
    
    
    
    
}




int32_t main() {
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    
    int t=1;
    // cin>>t;
    for(int i=1;i<=t;i++){
        // cout<<"case #"<<i<<": ";
        solve();
    }
    return 0;
}

Measured memory_bytes: 3656
#include <bits/stdc++.h>
#define be(v) (v).begin(),(v).end()
#define pb(q) push_back(q)
typedef long long ll;
using namespace std;
const ll mod=1000000007, INF=(1LL<<60);
#define doublecout(a) cout<<fixed<<setprecision(10)<<a<<endl;

int main() {
    cin.tie(0);
    cout.tie(0);
    ios::sync_with_stdio(false);
    ll x;
    cin >> x;
    ll a, b;
    for(a = -3000;a < 3000; a++){
        for(b = -3000; b < 3000;b++){
            if(a*a*a*a*a-b*b*b*b*b==x){
                cout << a << " " << b << endl;
                return 0;
            }
        }
    }
    return 0;
}


Measured memory_bytes: 3660
#include<stdio.h>

int main(void){
	int a[10], i, j, tmp;
        for(i = 0;i < 10 ; i++){
		scanf("%d", &a[i]);
	}
	for(i = 0; i < 9; i++){
		for(j = 9; j > i; j--){
			if(a[j - 1] < a[j]){
				tmp = a[j];
				a[j] = a[j - 1];
				a[j - 1] = tmp;
			}
		}
	}
	for(i = 0; i < 3; i++){
		printf("%d\n", a[i]);
	}
}

Measured memory_bytes: 1780
import java.util.Arrays;

public class Main {


  private static void solve() {
    int n = ni();
    long[] a = nal(n);
    Arrays.sort(a);
    
    long ret = 0;
    for (int i = 0; i < n / 2; i ++) {
      ret -= a[i] * 2;
    }
    
    for (int i = n / 2; i < n; i ++) {
      ret += a[i] * 2;
    }

    if (n % 2 == 0) {
      ret -= a[n / 2];
      ret += a[n / 2 - 1];
    } else {
      long x = ret - a[n / 2] - a[n / 2 + 1];
      long y = ret - a[n / 2] * 3 + a[n / 2 - 1];
      ret = Math.max(x, y);
    }
    System.out.println(ret);
  }

  public static void main(String[] args) {
    new Thread(null, new Runnable() {
      @Override
      public void run() {
        long start = System.currentTimeMillis();
        String debug = args.length > 0 ? args[0] : null;
        if (debug != null) {
          try {
            is = java.nio.file.Files.newInputStream(java.nio.file.Paths.get(debug));
          } catch (Exception e) {
            throw new RuntimeException(e);
          }
        }
        reader = new java.io.BufferedReader(new java.io.InputStreamReader(is), 32768);
        solve();
        out.flush();
        tr((System.currentTimeMillis() - start) + "ms");
      }
    }, "", 64000000).start();
  }

  private static java.io.InputStream is = System.in;
  private static java.io.PrintWriter out = new java.io.PrintWriter(System.out);
  private static java.util.StringTokenizer tokenizer = null;
  private static java.io.BufferedReader reader;

  public static String next() {
    while (tokenizer == null || !tokenizer.hasMoreTokens()) {
      try {
        tokenizer = new java.util.StringTokenizer(reader.readLine());
      } catch (Exception e) {
        throw new RuntimeException(e);
      }
    }
    return tokenizer.nextToken();
  }

  private static double nd() {
    return Double.parseDouble(next());
  }

  private static long nl() {
    return Long.parseLong(next());
  }

  private static int[] na(int n) {
    int[] a = new int[n];
    for (int i = 0; i < n; i++)
      a[i] = ni();
    return a;
  }

  private static char[] ns() {
    return next().toCharArray();
  }

  private static long[] nal(int n) {
    long[] a = new long[n];
    for (int i = 0; i < n; i++)
      a[i] = nl();
    return a;
  }

  private static int[][] ntable(int n, int m) {
    int[][] table = new int[n][m];
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < m; j++) {
        table[i][j] = ni();
      }
    }
    return table;
  }

  private static int[][] nlist(int n, int m) {
    int[][] table = new int[m][n];
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < m; j++) {
        table[j][i] = ni();
      }
    }
    return table;
  }

  private static int ni() {
    return Integer.parseInt(next());
  }

  private static void tr(Object... o) {
    if (is != System.in)
      System.out.println(java.util.Arrays.deepToString(o));
  }
}


Measured memory_bytes: 38260
import java.util.Scanner;

public class Main {
    public static void main(String args[]) {
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        String p = sc.next();
        String str = s + s;
        if(str.contains(p)){
            System.out.println("Yes");
        }else{
            System.out.println("No");
        }
    }
}


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

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define reprv(i, n) for (int i = n - 1; i >= 0; i--)
#define ll long long
using namespace std;


int main() {

    string s, t;

    cin >> s;
    cin >> t;
    if (equal(s.begin(),s.end(), t.begin(), t.end() - 1) == true ) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }

    return 0;
}


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

int main(){
  int N;
  cin>>N;
  vector<pair<double,double>> P(N);
  for(int i=0;i<N;++i){
    scanf("%lf %lf",&P.at(i).first,&P.at(i).second);
  }

  double ans;
  for(int i=0;i<N;++i){
    for(int j=i+1;j<N;++j){
      ans += sqrt(abs(P.at(i).first-P.at(j).first)*abs(P.at(i).first-P.at(j).first)+abs(P.at(i).second-P.at(j).second)*abs(P.at(i).second-P.at(j).second));
    }
  }
  ans *= 2;
  ans = ans/double(N);

  printf("%lf\n",ans);
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define f(i,n) for(int i=0;i<n;i++)
#define P pair<int,int>
#define F first
#define S second
#define int long long
#define mod 1000000007
#define mmod 998244353
#define all(v) v.begin(), v.end()
#define INF LLONG_MAX/3
using namespace std;
int mypow(int fa, int fb, int fc) {
	if (fb == 0)return 1;
	if (fb % 2)return mypow(fa, fb - 1, fc)*fa%fc;
	int z = mypow(fa, fb / 2, fc);
	return z * z%fc;
}
int k(int fa) {
	int x = 0;
	while (fa) {
		x++;
		fa /= 10;
	}
	return x;
}
int gcd(int fa, int fb) {
	if (fb == 0)return fa;
	return gcd(fb, fa%fb);
}
signed main() {
	int a, ans = 0;
	cin >> a;
	f(i, a) {
		f(j, a) {
			f(k, a) {
				ans += gcd(k + 1, gcd(i + 1, j + 1));
			}
		}
	}
	cout << ans << endl;
}

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

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

	int ans=0;
	while(true){
		int count=0;
		for(int i=0;i<N;i++){
			if(A[i]%2==0) count++;
		}
		if(count==N){
			for(int i=0;i<N;i++){
				A[i]/=2;
			}
			ans++;
		}
		else break;
	}
	
	cout << ans << endl;
}

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

int main(){
  string s;
  cin >>s;
  
  string ans="YES";
  int i=0;
  bool flag = true;
  while ( i < s.size() && flag){
    if (s.substr(i,6) == "eraser"){
      i += 6;
    }else if(s.substr(i,5) == "erase"){
      i += 5;
    }else if(s.substr(i,7) == "dreamer"){
      //cout << s.substr(i+5,6) <<"i: " <<i <<endl;
      if(s.substr(i+5,6) == "eraser"){
        i += 11;
        //cout <<"+11" <<endl;
      }else if(s.substr(i+5, 5) == "erase"){
        i += 10;
        //cout <<"+10" <<endl;
      }else{
        //cout <<"+07" <<endl;
        i += 7;
      }
    }else if (s.substr(i,5) == "dream"){
      i += 5;
    }else{
      //cout << s.substr(i,s.size());
      ans = "NO";
      flag = false;
    }
  }
  cout <<ans <<endl;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
typedef long long LL;
#define FOR(i,a,b) for(LL i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)

using namespace std;
LL p = 1000000007ll;

int main(void)
{
  LL r,d;
  vector<LL> x(20);
  cin >> r >> d >> x[0];
  REP(i,10) {
    x[i+1] = r*x[i] - d;
    cout << x[i+1] << endl;
  }
  return 0;
}


Measured memory_bytes: 256