akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
using book = tuple<int, string, int>;

bool comp(const book& a, const book& b)
{
    string a_s, b_s;
    int a_i, b_i;
    tie(ignore, a_s, a_i) = a;
    tie(ignore, b_s, b_i) = b;
    if (a_s == b_s) {
        return a_i > b_i;
    } else {
        return a_s < b_s;
    }
}

int main()
{
    int n;
    cin >> n;
    vector<book> arr(n);
    for (auto&& v : arr) {
        static int no, rank;
        string city;
        cin >> city >> rank;
        v = make_tuple(++no, city, rank);
    }
    sort(arr.begin(), arr.end(), comp);
    for (auto&& v : arr) {
        int no;
        tie(no, ignore, ignore) = v;
        cout << no << endl;
    }
}


Measured memory_bytes: 256
import java.util.ArrayList;
import java.util.Scanner;

public class Main {

	Scanner sc = new Scanner(System.in);
	public void run() {
		while(sc.hasNext()){
			int n = sc.nextInt();
			int w = sc.nextInt();
			int d = sc.nextInt();
			if(n == 0 && w == 0 && d == 0)break;
			else calc(n, w, d);
			
		}
	}
	public void calc(int n, int w, int d){
		//最終的にnピースできる
		ArrayList<int[]> list = new ArrayList<int[]>();
		list.add(new int[]{w, d});
		for(int i = 0; i < n; i++){
			int p = sc.nextInt();
			int s = sc.nextInt();
			
			int[] peace = list.get(p-1);
			list.remove(p-1);
			
			int nw = 0;
			int nd = 0;
			
			while(true){
				if(s < peace[0]) {
					nw = s;
					break;
				}
				else s -= peace[0];
				
				if(s < peace[1]){
					nd = s;
					break;
				}
				else s -= peace[1];
			}
			
			if(nw == 0){
				int nd2 = peace[1] - nd;
				if(nd < nd2){
					list.add(new int[]{peace[0], nd});
					list.add(new int[]{peace[0], nd2});
				}
				else{
					list.add(new int[]{peace[0], nd2});
					list.add(new int[]{peace[0], nd});
				}
			}
			else{
				int nw2 = peace[0] - nw;
				if(nw < nw2){
					list.add(new int[]{nw, peace[1]});
					list.add(new int[]{nw2, peace[1]});
				}
				else{
					list.add(new int[]{nw2, peace[1]});
					list.add(new int[]{nw, peace[1]});
				}
			}
		}
		
		list = mergesort(list);
		for(int i = 0; i < list.size(); i++){
			if(i != 0) System.out.print(" ");
			System.out.print(list.get(i)[0] * list.get(i)[1]);
		}
		System.out.println();
	}

	public ArrayList<int[]> mergesort(ArrayList<int[]> list){
		if(list.size() > 1){
			int n = list.size() / 2;
			int m = list.size() - n;
			ArrayList<int[]> a1 = new ArrayList<int[]>();
			ArrayList<int[]> a2 = new ArrayList<int[]>();
			for(int i = 0; i < n; i++) a1.add(list.get(i));
			for(int i = 0; i < m; i++) a2.add(list.get(i + n));

			a1 = mergesort(a1);
			a2 = mergesort(a2);
			return merge(a1, a2);
			
		}
		else return list;
	}
	
	public ArrayList<int[]> merge(ArrayList<int[]> a1, ArrayList<int[]> a2){
		int i = 0;
		int j = 0;
		ArrayList<int[]> a = new ArrayList<int[]>();
		while(i < a1.size() || j < a2.size()){
			if(j >= a2.size() || (i < a1.size() && a1.get(i)[0] * a1.get(i)[1] < a2.get(j)[0] * a2.get(j)[1])){
				a.add(a1.get(i));
				i++;
			}
			else {
				a.add(a2.get(j));
				j++;
			}
		}
		return a;
	}
	
	public static void main(String[] args) {
		new Main().run();
	}
}

Measured memory_bytes: 85752
#include<algorithm>
#include<iostream>
#include<cstdlib>
#include<cstring>
#include<cctype>
#include<cstdio>
#include<string>
#include<queue>
#include<stack>
#include<cmath>
#include<map>
#include<set>
using namespace std;
const int inf=0x7fffffff;
const double eps=1e-10;
const double pi=acos(-1.0);
//char buf[1<<15],*S=buf,*T=buf;
//char getch(){return S==T&&(T=(S=buf)+fread(buf,1,1<<15,stdin),S==T)?0:*S++;}
inline int read(){
	int x=0,f=1;char ch;ch=getchar();
	while(ch<'0'||ch>'9'){if(ch=='-') f=0;ch=getchar();}
	while(ch>='0'&&ch<='9'){x=(x<<1)+(x<<3)+(ch&15);ch=getchar();}
	if(f)return x;else return -x;
}
using namespace std;
const int N=300005;
int n,L,ans=1,cnt,ok;
int x[N],t[N];
bool r[N],l[N];
int main(){
	n=read();L=read()<<1;
	for(int i=1;i<=n;i++)x[i]=read()<<1;
	for(int i=1;i<=n;i++)t[i]=read();
	for(int i=1;i<=n;i++){
		int v=t[i]%L;//v：火车从商场 i出发后，到购物完成，与商场i的距离。 
		ans+=(1ll*t[i]+L-1)/L;//ans记录跑了其中多少个来回。 
		if(!v)continue;
		r[i]=(v<=x[i]);//r[i] 若车从右边来，那么会从右边离开，否则从左边离开。
		l[i]=(v<=L-x[i]);//l[i] 若车从左边来，那么会从左边离开，否则从右边离开。 
	}
	for(int i=1;i<n;i++)
		if(cnt&&l[i]){if(r[i])++ok;--ans;--cnt;}
		else if(r[i]) ++cnt;
		else if(l[i]&&ok) --ok,++cnt;
	if(l[n])ans--;
	printf("%lld\n",1ll*ans*L);
	return 0;
}


Measured memory_bytes: 3200
#include<iostream>
#include<algorithm>
#include<array>
using namespace std;
const int N=2e5+10;
long long d[N],n,f,l;
array<int,2> a[N];
int main(){
	cin>>n>>f>>l;
	for(int i=0;i<n;i++) cin>>a[i][0]>>a[i][1];
	sort(a,a+n);
	long long ans=0;
	for(int i=0,j=0;i<n;i++){
		while(j<n&&a[j][0]-2*f<=a[i][0]) j++;
		long long tmp=max((a[i][1]-d[i]*l+l-1)/l,0LL);
		d[i]+=tmp;
		d[j]-=tmp;
		ans+=tmp;
		d[i+1]+=d[i];
	}
	cout<<ans;
	return 0;
}


Measured memory_bytes: 3328
#include <iostream>
#include <vector>
#include <numeric>

using namespace std;

vector<int> parent, urank;

int root(int x) { return (parent.at(x) == x ? x: parent.at(x) = root(parent.at(x))); }

bool in_same(int x, int y) { return root(x) == root(y); }
void unite(int x, int y) {
    x = root(x);
    y = root(y);
    if (x != y) {
        if (urank.at(x) < urank.at(y)) parent.at(x) = y;
        else {
            parent.at(y) = x;
            if (urank.at(x) == urank.at(y)) ++(urank.at(x));
        }
    }
}

int main() {
    parent.resize(13);
    urank.resize(13);
    iota(parent.begin(), parent.end(), 0);
    unite(1, 3);
    unite(3, 5);
    unite(5, 7);
    unite(7, 8);
    unite(8, 10);
    unite(10, 12);
    unite(4, 6);
    unite(6, 9);
    unite(9, 11);
    int x, y;
    cin >> x >> y;
    cout << (in_same(x, y) ? "Yes" : "No") << endl;
    return 0;
}


Measured memory_bytes: 256
/* ----------------------- reclone_rk -------------------------*/ 
#include<bits/stdc++.h>
using namespace std;
#define int long long int
const int mod=1e9+7;

int gcd(int a, int b){ if(a == 0) return b; return gcd(b%a, a);}
int MOD(int n){ return ((n%mod)+mod)%mod;}
int power(int a,int b){ if(b==0)return 1LL;int s=power(a,b/2LL);s*=s;s%=mod;if(b&1LL)return (s*a)%mod;return s;}
int inv(int a){return power(a,mod-2);}
int nCr(int n,int r){if(r>n)return 0LL;if(n-r<r)r=n-r;int ans=1;for(int i=0;i<r;i++){ans*=(n-i);ans=MOD(ans);ans*=inv(i+1);ans=MOD(ans);}return ans;}


signed main()
{
	string s, t;
	cin>>s>>t;
	int flag = 0;
	for(int i=0; i<s.length(); i++)
	{
		if(s[i] != t[i])
		{
			flag = 1;
			break;
		}
	}
	if(flag == 0)
		cout<<"Yes"<<endl;
	else
		cout<<"No"<<endl;
	return 0;
}



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

struct Node{
        int key;
        Node *parent, *left, *right;
};

static Node *root;

void insert(int v, Node *t){
        if(!root) {
                Node *a = new Node();
                a->key = v;
                a->parent = NULL;
                a->left = NULL;
                a->right = NULL;
                root = a;
        }else if(v<=t->key){
                if(!t->left) {
                        Node *a = new Node();
                        a->key = v;
                        a->parent = t;
                        a->left = NULL;
                        a->right = NULL;
                        t->left = a;
                }else{
                        insert(v, t->left);
                }
        }else{
                if(!t->right) {
                        Node *a = new Node();
                        a->key = v;
                        a->parent = t;
                        a->left = NULL;
                        a->right = NULL;
                        t->right = a;
                }else{
                        insert(v, t->right);
                }
        }
}
void print_preorder(Node *i){
        if(!i) return;
        cout<<" "<<i->key;
        print_preorder(i->left);
        print_preorder(i->right);
}

void print_inorder(Node *i){
        if(!i) return;
        print_inorder(i->left);
        cout<<" "<<i->key;
        print_inorder(i->right);
}

int main(){
        int n,v;
        string s;
        cin>>n;
        root = NULL;
        for(int i=0;i<n;i++){
                cin>>s;
                if(s=="insert") {
                        cin>>v;
                        insert(v,root);
                }else if(s=="print"){
                        print_inorder(root);
                        cout<<endl;
                        print_preorder(root);
                        cout<<endl;
                }
        }
        return 0;
}



Measured memory_bytes: 26640
#pragma gcc optimize("Ofast")
#include <bits/stdc++.h>

using namespace std;
using ll = long long;

#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(V) (V).begin(),(V).end()
#define SORT(V) sort(ALL(V)) //小さい方からソート
#define REV(V) reverse(ALL(V)) //リバース
#define RSORT(V) SORT(V);REV(V) //大きい方からソート
#define NPN(V) next_permutation(ALL(V)) //順列
#define pb(n) push_back(n)
#define endl '\n'
#define Endl '\n'
#define DUMP(x)  cout << #x << " = " << (x) << endl
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define Yay(n) cout << ((n) ? "Yay!": ":(") << endl
#define RAPID cin.tie(0);ios::sync_with_stdio(false)
#define VSUM(V) accumulate(ALL(V), 0)
#define MID(a,b,c) (a) < (b) && (b) < (c)
#define MIDe(a,b,c) (a) <= (b) && (b) <= (c)
#define IN(n) cin >> n
#define IN2(a,b) cin >> a >> b
#define IN3(a,b,c) cin >> a >> b >> c 
#define IN4(a,b,c,d) cin >> a >> b >> c >> d
#define VIN(V) for(int i = 0; i < (V).size(); i++) {cin >> (V).at(i);}
#define OUT(n) cout << n << endl
#define VOUT(V) REP(i, (V).size()) {cout << (V)[i] << endl;}
#define VOUT2(V) REP(i, (V).size()) {cout << (V)[i] << " ";} cout<<endl;

// 型マクロ定義
#define int long long
#define P pair<ll,ll>
#define Vi vector<ll>
#define Vd vector<double>
#define Vs vector<string>
#define Vc vector<char>
#define M map<ll,ll>
#define S set<ll>
#define PQ priority_queue<ll>
#define PQG priority_queue<ll,V,greater<ll>
//

const int MOD = 1000000007;
const int INF = 1061109567;
const double EPS = 1e-10;
const double PI  = acos(-1.0);

int gcd(int a,int b){return b != 0 ? gcd(b, a % b) : a;} //最大公約数
int lcm(int a, int b){return a * b / gcd(a, b);}
string toStrUp(string str){char diff = 'A'-'a';REP(i,str.size()) str[i] += diff;return str;}
string gCh(string str, int key){return str.substr(key,1);}

signed main() {
  RAPID;
  // デフォルト変数定義
  int n=0,m=0,a=0,b=0,c=0,d=0,x=0,y=0,z=0;
  string s="",t="";
  //

  // ここから
  IN(s);
  REP(i,s.size()){
    x += stoll(gCh(s,i));
  }
  y = stoll(s);
  Yes(y%x==0);
}

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

int f(int x){
  int sum;
  while(x > 0){
  sum += x % 10;
  x = x / 10;
  }
  return sum;
}

int main(){
  int n;
  cin >> n;
  if(n % f(n) == 0){
   cout << "Yes" << endl;
  }else{
   cout << "No" << endl;
  }
  
  
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <cassert>
#include <algorithm>
#include <functional>

using namespace std;
int gcd(int a,int b){
    if(b==0){
       return a; 
    }else{
        return gcd(b,a%b);
    }
}
int main(){
    int n,x;
    cin >> n >> x;
    vector<int> dis(n);
    for(int i=0;i<n;i++){
        int X;
        cin >> X;
        dis[i]=abs(x-X);
    }
    int GCD=dis[0];
    for(int i=1;i<n;i++){
        GCD=gcd(dis[i],GCD);
    }
    cout <<GCD<<endl;
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
struct edge {
    int to;     // 辺の行き先
    int weight; // 辺の重み
    edge(int t, int w) : to(t), weight(w) { }
};
using Graph = vector<vector<int>>;
using dou =long double;
string yes="yes";
string Yes="Yes";
string YES="YES";
string no="no";
string No="No";
string NO="NO";

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
#define rep(i, n)         for(int i = 0; i < (int)(n); i++)
#define brep(n)           for(int bit=0;bit<(1<<n);bit++)
#define erep(i,container) for (auto i : container)
#define irep(i, n)        for(int i = n-1; i >= (int)0; i--)
#define rrep(i,m,n) for(ll i = m; i < (ll)(n); i++)
#define reprep(i,j,h,w) rep(i,h)rep(j,w)
#define all(x) (x).begin(),(x).end()
#define VEC(type,name,n) std::vector<type> name(n);rep(i,n)std::cin >> name[i];
#define pb push_back
#define pf push_front
#define lb lower_bound
#define ub upper_bound
#define fi first
#define se second
#define itn int
#define mp make_pair
#define sum(a) accumulate(all(a),0ll)
#define keta fixed<<setprecision
#define vvector(name,typ,m,n,a)vector<vector<typ> > name(m,vector<typ> (n,a))
#define vvvector(name,t,l,m,n,a) vector<vector<vector<t> > > name(l, vector<vector<t> >(m, vector<t>(n,a)));
#define vvvvector(name,t,k,l,m,n,a) vector<vector<vector<vector<t> > > > name(k,vector<vector<vector<t> > >(l, vector<vector<t> >(m, vector<t>(n,a)) ));
#define case std::cout <<"Case #" <<qqq+1<<": "
#define res resize
#define as assign
#define ffor for(;;)
#define ppri(a,b) std::cout << a<<" "<<b << std::endl
#define pppri(a,b,c) std::cout << a<<" "<<b <<" "<< c<<std::endl
#define aall(x,n) (x).begin(),(x).begin()+(n)
 
typedef long long ll;
typedef pair<int,int> P;
//typedef long long T;
const int INF = 2000000000;
const ll INF64 = 922337203685477580ll;
const ll MOD = 1000000007ll;
const dou pi=3.141592653589793;

int main(){
    int n,k;
    std::cin >> n>>k;
    ll ans=0;
    rrep(i,1,n+1){
        ans+=max(0ll,i-k)*(n/i);
        if(k==0)ans+=max(0ll,(n%i)-k);
        else ans+=max(0ll,(n%i)-k+1);
    }
    std::cout << ans << std::endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)
#define rep2(i, a, n) for(ll i = a; i < (ll)(n); i++)
#define memi cout << endl
#define kono(n) cout << fixed << setprecision(n)
#define all(c) (c).begin(), (c).end()
#define pb push_back
#define hina cout << ' '
#define in(n) cin >> n
#define in2(n, m) cin >> n >> m
#define in3(n, m, l) cin >> n >> m >> l
#define out(n) cout << n
const ll mei = (ll)1e9 + 7;

int main(){
  ll a, b, q, k;
  string s, u, v, w;
  v = w = "";
  in2(s, q);
  a = 0;
  rep(i, q){
    in(b);
    if(b == 1)
      a++;
    else{
      in2(k, u);
      if(k == 1){
        if(a % 2 == 0){
          v = u + v;
        }
        else
          w = w + u;
      }
      else{
        if(a % 2 == 0)
          w = w + u;
        else
          v = u + v;
      }
    }
  }
  string t;
  if(a % 2 == 0){
    t = v + s + w;
    out(t);
  }
  else{
    rep(i, w.size())
      out(w[w.size() - 1 - i]);
    rep(i, s.size())
      out(s[s.size() - 1 - i]);
    rep(i, v.size())
      out(v[v.size() - 1 - i]);
  }
  memi;
}

Measured memory_bytes: 1464
#include<iostream>

int main(){
 int a,b,c;
 std::cin >> a >> b;
 c=a;
 if(b>9 && b<=99)
    c=c*100+b;
 else if(b==100)
    c=c*1000+b;
 else
    c=c*10+b;

bool f=0;
 for(int i=1;i<=1000;i++){
    if(i*i==c){
        f=1;
        break;
    }
 }
 //std::cout << c << "\n";
f==1?std::cout << "Yes" : std::cout << "No";
 return 0;
}


Measured memory_bytes: 3584
import sys, os, math, bisect, itertools, collections, heapq, queue, copy, array

# from scipy.sparse.csgraph import csgraph_from_dense, floyd_warshall
# from decimal import Decimal
# from collections import defaultdict, deque

sys.setrecursionlimit(10000000)

ii = lambda: int(sys.stdin.buffer.readline().rstrip())
il = lambda: list(map(int, sys.stdin.buffer.readline().split()))
fl = lambda: list(map(float, sys.stdin.buffer.readline().split()))
iln = lambda n: [int(sys.stdin.buffer.readline().rstrip()) for _ in range(n)]

iss = lambda: sys.stdin.buffer.readline().decode().rstrip()
sl = lambda: list(map(str, sys.stdin.buffer.readline().decode().split()))
isn = lambda n: [sys.stdin.buffer.readline().decode().rstrip() for _ in range(n)]

lcm = lambda x, y: (x * y) // math.gcd(x, y)

MOD = 10 ** 9 + 7
INF = float('inf')


def main():
    if os.getenv("LOCAL"):
        sys.stdin = open("input.txt", "r")

    N = ii()
    D, X = il()
    ret = X

    for n in range(N):
        A = ii()
        ret += (D - 1) // A + 1
    print(ret)


if __name__ == '__main__':
    main()


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

bool check(int n) {
    int reversed = 0;
    int _n = n;
    int digit;
    while (_n) {
        digit = _n%10;
        reversed = reversed*10 + digit;
        _n /= 10;
    }
    if (reversed == n) {
        return true;
    } else {
        return false;
    }
}

int main() {
    int A, B; cin >> A >> B;
    int cnt = 0;
    for (int i = A; i <= B; i++) {
        if (check(i)) {
            cnt++;
        }
    }
    cout << cnt << endl;
    return 0;
}

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

int main(void) {
  int n, k, l[100];
  cin >> n >> k;
  rep(i, n) cin >> l[i];
  
  sort(l, l + n);
  
  int ans = 0;
  rep(i, k) ans += l[n - 1 - i];
  
  cout << ans << endl;
  
  return 0;
}
  

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int n,m,q,ans,a[55],b[55],c[55],d[55],arry[15];
void cal()
{
    int tmp=0;
    for(int i=1;i<=q;i++)
    {
        if(arry[b[i]]-arry[a[i]]==c[i])tmp+=d[i];
    }
    //printf("%d--\n",tmp);
    ans=max(ans,tmp);
}
void dfs(int p)
{
    if(p==n+1)
    {
        cal();
        return;
    }
    for(int i=arry[p-1];i<=m;i++)
    {
        arry[p]=i;
        dfs(p+1);
    }
}
int main()
{
    scanf("%d %d %d",&n,&m,&q);
    for(int i=1;i<=q;i++)scanf("%d %d %d %d",&a[i],&b[i],&c[i],&d[i]);
    arry[0]=1;
    dfs(1);
    printf("%d\n",ans);
    return 0;
}

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


int main() {
    int N, K;
    cin >> N >> K;
    vector<int> L(N);
    for (int i = 0; i < N; ++i) {
        cin >> L.at(i);
    }

    sort(L.begin(), L.end());
    reverse(L.begin(), L.end());

    int ans = 0;
    for (int i = 0; i < K; ++i) {
        ans += L.at(i);
    }

    cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
#define rrep(i,n) for(int i=1;i<=n;i++)
# define ALL(x) (x).begin(), (x).end()
# define SZ(x) ((int)(x).size())
# define pb push_back
using namespace std;
 
int main(){
    string o,e;
    cin>>o>>e;
    rep(i,e.size()) cout<<o.at(i)<<e.at(i);
    if (o.size()>e.size()) cout<<o.at(o.size()-1)<<endl;
    else cout<<""<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
const int64_t MOD = 1e9+7;
int a[1000][1000];
int64_t m[1000][1000];
int main() {
    #ifdef DEBUG
    std::ifstream in("/home/share/inputf.in");
    std::cin.rdbuf(in.rdbuf());
    #endif
    int H, W;
    cin >> H >> W;
    for(int i = 0; i < H; i++) {
        string tmp;
        cin >> tmp;
        for(int j = 0; j < W; j++) {
            a[i][j] = tmp[j] == '#';
            m[i][j] = 0;
        }
    }
    m[0][0] = 1;
    for(int i = 0; i < H; i++) {
        for(int j = 0; j < W; j++) {
            if(a[i][j]) continue;
            if(j > 0) {
                m[i][j] += m[i][j - 1];
            }
            if(i > 0) {
                m[i][j] += m[i - 1][j];
            }
            m[i][j] %= MOD;
        }
    }
    cout << m[H - 1][W - 1] << endl;
    return 0;
}

Measured memory_bytes: 11904
import math

n, k = map(int, input().split(" "))

count = 0
max_count = math.ceil(math.log2(k))
total = n * (2 ** max_count)

for i in range(1, n+1):
    if k >= i:
        t = math.ceil(math.log2(k/i))
        count += 2 ** (max_count - t)
    else:
        count += 2 ** max_count

print(count / total)

Measured memory_bytes: 3064
using System;
using System.Collections.Generic;
using System.Linq;

class Program
{
    static void Main(string[] args)
    {
        var inputs = Console.ReadLine().Split(' ');

        var N = long.Parse(inputs[0]);
        var K = long.Parse(inputs[1]);

        long num = 0;

        if (K % 2 == 0)
        {
            long harf = 0;

            for (var i = 1; i < N + 1; i++)
            {
                if (i % K == K / 2)
                {
                    harf++;
                }
            }

            if (harf != 0)
            {
                if (N >= K)
                {
                    num = (long)Math.Pow((double)(N / K), 3) + (long)Math.Pow((double)harf, 3);
                }
                else
                {
                    num = (long)Math.Pow((double)harf, 3);
                }
            }
        }
        else
        {
            if (N >= K)
            {
                num = (long)Math.Pow((double)(N / K), 3);
            }
        }

        Console.WriteLine(num);
        Console.Read();
    }
}



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

vector<pair<ll,int>> factorize(ll n) {
  vector<pair<ll,int>> res;
  for (ll i = 2; i*i <= n; ++i) {
    if (n % i) continue;
    res.emplace_back(i,0);
    while (n%i == 0) {
      n /= i;
      res.back().second++;
    }
  }
  if (n != 1) res.emplace_back(n,1);
  return res;
}

int main() {
  int n;
  cin >> n;
  int ans = 0;
  rep(i,(n+1)/2) {
    vector<pair<ll,int>> A = factorize(2*i+1);
    int res = 1;
    for (auto x : A) {
      res *= (x.second + 1);
    }
    if (res == 8) ans++;
  }
  cout << ans << endl;
  return 0;
}

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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<ll, ll> P;

#define EACH(i,a) for (auto& i : a)
#define FOR(i,a,b) for (ll i=(a);i<(b);i++)
#define RFOR(i,a,b) for (ll i=(b)-1;i>=(a);i--)
#define REP(i,n) for (ll i=0;i<(n);i++)
#define RREP(i,n) for (ll i=(n)-1;i>=0;i--)
#define debug(x) cout<<#x<<": "<<x<<endl
#define pb push_back
#define ALL(a) (a).begin(),(a).end()

const ll linf = 1e18;
const int inf = 1e9;
const double eps = 1e-12;
const double pi = acos(-1);

template<typename T>
istream& operator>>(istream& is, vector<T>& vec) {
	EACH(x,vec) is >> x;
	return is;
}
/*
template<class... T>
ostream& operator<<(ostream& os, tuple<T...>& t) {
	for (size_t i = 0; i < tuple_size< tuple<T...> >::value; ++i) {
		if (i) os << " ";
		os << get<0>(t);
	}
	return os;
}
*/
template<typename T>
ostream& operator<<(ostream& os, vector<T>& vec) {
	REP(i,vec.size()) {
		if (i) os << " ";
		os << vec[i];
	}
	return os;
}
template<typename T>
ostream& operator<<(ostream& os, vector< vector<T> >& vec) {
	REP(i,vec.size()) {
		if (i) os << endl;
		os << vec[i];
	}
	return os;
}

ll gcd(ll a, ll b) {
	if (b == 0) return a;
	return gcd(b, a%b);
}

int main() {
	std::ios::sync_with_stdio(false);
	std::cin.tie(0);
	ll a, b;
	while ( cin >> a >> b ) {
		ll g = gcd(a, b);
		cout << g << " " << a/g*b << endl;
	}
}

Measured memory_bytes: 3092
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cmath>
using namespace std;
typedef long long LL;
LL vis[200001];
char s[200010];
int main() {
	scanf("%s",s);
	int len=strlen(s);
	for (int i=0;i<len;i++) vis[s[i]-97]++;
	LL ans=0;
	for (int i=0;i<26;i++)
		ans+=vis[i]*(len-vis[i]);
	ans/=2;
	ans++;
	printf("%lld\n",ans);
	return 0;
}

Measured memory_bytes: 1016
N,M=map(int,input().split())
from collections import defaultdict,deque
branch=defaultdict(dict)
for i in range(M):
    a,b,c=map(int,input().split())
    branch[a-1][b-1]=c
inf=10**15
dist=[(-inf,set())]*N
dist[0]=(0,{0})
check={0}
while len(check)>0:
    now=check.pop()
    for nex,s in branch[now].items():
        if dist[nex][0]>=inf:
            continue
        if nex not in dist[now][1]:
            dist[nex]=(dist[now][0]+s,dist[now][1]|{nex})
            check|={nex}
        elif dist[now][0]+s>dist[nex][0]:
            dist[nex]=(inf,dist[now][1]|{nex})
            check|={nex}
if dist[N-1][0]>=inf:
    print('inf')
else:
    print(dist[N-1][0])

Measured memory_bytes: 36084
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <map>
#include <set>
#include <bitset>
#include <cmath>
#include <string>
#define FI first
#define SE second
#define VE vector<int>
#define PF push_front
#define PB push_back
#define POF pop_front
#define POB pop_back
#define MA make_pair
#define LL long long
#define FOR(i,a,b) for(int i=a;i<b;i++)
#define ROF(i,a,b) for(int i=b-1;i>=a;i--)
#define YES(i) cout<<(i?"YES":"NO")<<endl
#define Yes(i) cout<<(i?"Yes":"No")<<endl
using namespace std;
//
const int INF=1e9+7;
//
int eulerphi(int N){
  if(N==0){
    return 0;
  }
  int ans=N;
  for(int i=2;i*i<=N;i++){
    if(N%i==0){
      ans-=ans/i;
      while(N%i==0){
        N/=i;
      }
    }
  }
  if(N>1){
    ans-=ans/N;
  }
  return ans;
}
int main(){
  int N;
  cin>>N;
  cout<<eulerphi(N)<<endl;
  return 0;
}


Measured memory_bytes: 3096
#ifdef _MSC_VER
#define _CRT_SECURE_NO_WARNINGS
#endif

#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <cassert>
#include <string.h>
#include <unordered_set>
#include <unordered_map>

using namespace std;

typedef long long int64;
typedef unsigned long long uint64;
#define two(X) (1<<(X))
#define twoL(X) (((int64)(1))<<(X))
#define contain(S,X) (((S)&two(X))!=0)
#define containL(S,X) (((S)&twoL(X))!=0)
const double pi=acos(-1.0);
const double eps=1e-11;
template<class T> inline void ckmin(T &a,T b){if(b<a) a=b;}
template<class T> inline void ckmax(T &a,T b){if(b>a) a=b;}
template<class T> inline T sqr(T x){return x*x;}
typedef pair<int,int> ipair;
#define SIZE(A) ((int)A.size())
#define LENGTH(A) ((int)A.length())
#define MP(A,B) make_pair(A,B)
#define PB(X) push_back(X)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,a) for(int i=0;i<(a);++i)
#define ALL(A) A.begin(),A.end()

const int maxn=200000+16;

int n;
vector<int> g[maxn];
int d1[maxn],d2[maxn];

void dfs(int p,int last,int d,int wd[])
{
	wd[p]=d;
	for (int x:g[p]) if (x!=last) dfs(x,p,d+1,wd);
}
int main()
{
#ifdef _MSC_VER
	freopen("input.txt","r",stdin);
#endif
	std::ios::sync_with_stdio(false);
	while (cin>>n)
	{
		REP(i,n) g[i].clear();
		REP(i,n-1)
		{
			int x,y;
			cin>>x>>y;
			--x;
			--y;
			g[x].push_back(y);
			g[y].push_back(x);
		}
		dfs(0,-1,0,d1);
		dfs(n-1,-1,0,d2);
		int ret=0;
		REP(i,n)
			if (d1[i]<=d2[i]) ++ret;
			else --ret;
		if (ret>0)
			printf("Fennec\n");
		else
			printf("Snuke\n");
#ifndef _MSC_VER
		break;
#endif
	}
	return 0;
}



Measured memory_bytes: 15104
def r(a, b, c, d, e, f):
    return a * (d-f) + c * (f-b) + e * (b-d) > 0
  
while True:
    try: line = list(map(float, input().split()))
    except: break
      
    x1, y1, x2, y2, x3, y3, xp, yp = line
    abc = r(x1, y1, x2, y2, x3, y3)
    pab = r(xp, yp, x1, y1, x2, y2)
    pbc = r(xp, yp, x2, y2, x3, y3)
    pca = r(xp, yp, x3, y3, x1, y1)
  
    print('YES' if abc == pab == pbc == pca else 'NO')



Measured memory_bytes: 5584
#include<bits/stdc++.h>
using namespace std;
#include <numeric> 
 
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);
#define endl "\n"
#define int long long int
#define mod 1000000007
#define INT_BITS 16
#define test int t;cin>>t;while(t--)
#define INF 10000000
#define pi 3.141592
#define watch(x) cout<<(#x)<<"="<<(x)<<"\n" 
#define pb push_back
//#include "debug.cpp"
//__builtin_popcount

int32_t main()
{
    fast
    #ifndef ONLINE_JUDGE
    freopen("input.txt","r",stdin);
    //freopen("output.txt","w",stdout);
    #endif
    
    string s,t;
    cin>>s>>t;
    int mx=INT_MAX;
    for (int i = 0; i < s.length(); ++i)
    {
        string temp=s;
        int count=0;
        if(s.length()-i >= t.length())
        {
            for(int j=0;j<t.length();j++)
            {
                if(temp[i+j]!=t[j])
                    count++;

            }
            mx=min(count,mx);
        }
    }
    cout<<mx<<endl;
}


Measured memory_bytes: 3656
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define stoi stoll
using pii=pair<int,int>;
using vi = vector<int>;
using vvi = vector<vi>;
#define all(c) begin(c),end(c)
#define rall(c) rbegin(c),rend(c)
#define fore(x,c) for(auto &&x:c)
#define rep(i,a,n) for(int i=a,i##len=(int)(n);i<i##len;++i)
#define rrep(i, a, n) for(int i=(int)(n-1);i>=a;--i)
#define sz(c) ((int)c.size())
#define contains(c,x) (c.find(x)!=end(c))
#define inseg(l,x,r) ((l)<=(x)&&(x)<(r))
#define dump(...)
#define pb push_back
#define _ 0
const signed INF_=1001001001; const long long INF=1001001001001001001LL;
const int DX[9]={0,1,0,-1,1,1,-1,-1,0},DY[9]={-1,0,1,0,-1,1,1,-1,0};
template<class T> ostream& operator<<(ostream &os,const vector<T> &v) {
    for (auto i = begin(v); i != end(v); i++) os<<*i<<(i==end(v)-1?"":" ");return os;}
template<class T> istream& operator>>(istream &is,vector<T> &v) {
    for (auto i = begin(v); i != end(v); i++) is>>*i;return is;}
template<class T,class U> istream& operator>>(istream &is, pair<T,U> &p) {
    is>>p.first>>p.second;return is;}
template<class T, class U> bool chmax(T &a,const U &b){return a<b?a=b,1:0;}
template<class T, class U> bool chmin(T &a,const U &b){return a>b?a=b,1:0;}
template <class T> void psum(T& c) {partial_sum(begin(c), end(c), begin(c));}
template<class T> using heap=priority_queue<T,vector<T>,greater<T>>;
struct before_main_function {
    before_main_function() {
        cin.tie(nullptr); ios::sync_with_stdio(0);
        cout << setprecision(15) << fixed;
        // #define endl "\n"
    }
} before_main_function;
//------------------8<------------------------------------8<--------------------

signed main() {
    int N, M, L;
    cin >> N >> M >> L;
    vvi G(N, vi(N, INF));
    rep(i, 0, N) G[i][i] = 0;
    rep(i, 0, M) {
        int a, b, c;
        cin >> a >> b >> c;
        a--, b--;
        G[a][b] = G[b][a] = c;
    }
    vvi dist = G;
    rep(l, 0, 3) rep(i, 0, N) rep(j, 0, N) rep(k, 0, N) chmin(dist[i][j], dist[i][k] + dist[k][j]);
    
    vvi G2(N, vi(N, INF));
    rep(i, 0, N) G2[i][i] = 0;

    rep(i, 0, N) {
        rep(j, 0, N) {
            if (dist[i][j] <= L) {
                G2[i][j] = G2[j][i] = 1;
            }
        }
    }

    vvi dist2 = G2;
    rep(l, 0, 3) rep(i, 0, N) rep(j, 0, N) rep(k, 0, N) chmin(dist2[i][j], dist2[i][k] + dist2[k][j]);

    

    int Q;
    cin >> Q;
    while (Q--) {
        int s, t;
        cin >> s >> t;
        s--, t--;
        int ans = dist2[s][t] - 1;
        if (ans > N) {
            cout << -1 << endl;
        } else {
            cout << ans << endl;
        }
    }
    
    return (0^_^0);
}



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

using namespace std;

#define rep(i, n) for (int i = 0; i < (int)n; ++i)
#define REP(i, a, b) for (int i = (int)a; i < (int)b; ++i)
#define each(i,c) for(__typeof((c).begin()) i = (c).begin(); i != (c).end(); ++i)
#define all(v) v.begin(), v.end()
#define mset(a, n) memset(a, n, sizeof(a))

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

const int INF = 1000000000;
const int MOD = 1000000007;
const double eps = 1e-9;

int col[9] = {400, 800, 1200, 1600, 2000, 2400, 2800, 3200, 4801};

int main(int argc, char *argv[]) {
    // cin.tie(0);
    // ios::sync_with_stdio(false);
    int n; cin >> n;
    vector<int> v(9, 0);
    rep(i, n) {
        int a; cin >> a;
        rep(j, 9) if (a < col[j]) {
            v[j] += 1;
            break;
        }
    }

    int amin = 0, amax = 0;
    rep(i, 9) if (v[i] > 0) amin++, amax++;

    if (amin > 1 && v[8] > 0) amin--;
    if (v[8] > 0) amax += v[8] - 1;
    cout << amin << " " << amax << endl;
    return 0;
}

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

int main(){
	string S;
	cin >> S;
	bool flag=true;
	
	if(S[0]!='A') flag = false;

	int num=0;
	for(int i=2;i<S.length()-1;i++){
		if(S[i]=='C') num++;
	}
	if(num!=1) flag = false;

	num=0;
	for(int i=1;i<S.length();i++){
		if(isupper(S[i])) num++;
	}
	if(num!=1) flag = false;

	if(flag) cout << "AC" << endl;
	else cout << "WA" << endl;

	return 0;
}


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


struct point{
    int x,y;
};

struct line{
    point s,t;
};
struct bec{
    int x,y;
};

int n,q;
point g[100];

bool kousa(point p1,point p2,point t){
    bec a,b;
    a.x = p2.x-p1.x; a.y = p2.y-p1.y;
    b.x = t.x-p1.x; b.y = t.y-p1.y;
    double d1 = sqrt((double)a.x*(double)a.x + (double)a.y*(double)a.y), d2 = sqrt((double)b.x*(double)b.x + (double)b.y*(double)b.y);
    if(d2==0) return true;
    double c = ((double)a.x*(double)b.x+(double)a.y*(double)b.y)/(d1*d2);
    int ga = a.x*b.y - a.y*b.x;
    int na = a.x*b.x + a.y*b.y;
    if(ga ==0 && na>0 && d1 > d2) return true;
    else return false;
}

int kyori(point p,line l){
    bec p1,p2,bl;
    p1.x = p.x-l.s.x; p1.y=p.y-l.s.y;
    p2.x = p.x-l.t.x; p2.y=p.y-l.t.y;
    bl.x = l.t.x-l.s.x; bl.y = l.t.y-l.s.y;
    double d1,d2,c;
    int c2;
    d1=sqrt((double)p1.x*(double)p1.x+(double)p1.y*(double)p1.y);
    d2=sqrt((double)bl.x*(double)bl.x+(double)bl.y*(double)bl.y);
    c= ((double)p1.x*(double)bl.x+(double)p1.y*(double)bl.y)/(d1*d2);
    c2=(c*100000000000+0.0000000005)/100000000000;
    if(d1==0||sqrt((double)p2.x*(double)p2.x+(double)p2.y*(double)p2.y)==0) return 1;
    else if(c2==1 && d1<=d2) return 1;
    else return 0;
}

int kou(line l,line m){
    long ta,tb,tc,td;
    ta=(m.s.x-m.t.x)*(l.s.y-m.s.y)+(m.s.y-m.t.y)*(m.s.x-l.s.x);
    tb=(m.s.x-m.t.x)*(l.t.y-m.s.y)+(m.s.y-m.t.y)*(m.s.x-l.t.x);
    tc=(l.s.x-l.t.x)*(m.s.y-l.s.y)+(l.s.y-l.t.y)*(l.s.x-m.s.x);
    td=(l.s.x-l.t.x)*(m.t.y-l.s.y)+(l.s.y-l.t.y)*(l.s.x-m.t.x);
    if(tc*td<0 && ta*tb<0){
        return 1;
    }
    else{
        if(kyori(l.s,m)==1||kyori(l.t,m)==1||kyori(m.s,l)==1||kyori(m.t,l)==1) return 1;
        else return 0;

    }

}


int solve(point t){
    int k=0;
    for(int i=0;i<n;i++){
        if(i!=n-1){
            if(kousa(g[i],g[i+1],t)) return 1;
        }
        else{
            if(kousa(g[i],g[0],t)) return 1;
        }
    }

    bec a,b;
    point g1,g2;
    for(int i=0;i<n;i++){
        if(i!=n-1){
            g1=g[i];
            g2=g[i+1];
        }
        else{
            g1=g[i];
            g2=g[0];
        }
        if(g1.y>g2.y){
            a.x = g2.x-t.x; a.y = g2.y-t.y;
            b.x = g1.x-t.x; b.y = g1.y-t.y;
        }
        else{
            a.x = g1.x-t.x; a.y = g1.y-t.y;
            b.x = g2.x-t.x; b.y = g2.y-t.y;
        }

        long ga = a.x*b.y-a.y*b.x;

        line l,m;
        l.s = g1; l.t = g2;

        m.s = t;
        m.t.x = 10001;
        m.t.y = t.y;

        if(kou(l,m)==1 &&ga >0 && min(g1.y,g2.y)!= t.y) k++;

    }

    int ans =k%2;
    if(ans==1) return 2;
    else return 0;


}

int main(){
    cin>>n;
    int x,y;
    for(int i=0;i<n;i++){
        cin>>x>>y;
        g[i].x = x;
        g[i].y = y;
    }

    cin>>q;
    for(int i=0;i<q;i++){
        point t;
        cin>>x>>y;
        t.x = x;
        t.y = y;
        cout<<solve(t)<<endl;
    }
}


Measured memory_bytes: 3112
#include<bits/stdc++.h>
using namespace std;
int cc[105];
int n,T,t,c,cnt=0;
bool flag=false;
int main()
{
	cin>>n>>T;
	for(int i=1;i<=n;i++){
		cin>>c>>t;
		if(t<=T){
			flag=true;
			cc[++cnt]=c;
		}
	}
	if(!flag){
		cout<<"TLE"<<endl;
		return 0;
	}
	sort(cc+1,cc+cnt+1);
	cout<<cc[1];
	return 0;
}

Measured memory_bytes: 256
s = input()
n = len(s)

s1 = s[:int((n-1)/2)]
s2 = s[int((n+1)/2):]

s1_rev = s1[::-1]
s2_rev = s2[::-1]

if s == s[::-1]:
    if s1 == s1_rev and s2 == s2_rev:
        print('Yes')
    else:
        print('No')
else:
    print('No')



Measured memory_bytes: 3060
// exec clang-format
#include <bits/stdc++.h>
#define rep(i, n) for (lli i = 0; i < (n); i++)
#define rrep(i, n) for (lli i = (n)-1; i >= 0; i--)
using namespace std;
using lli = long long int;
lli sort_until[200005];
lli a[200005];

template <class T> class segtree {
public:
  lli n;
  vector<T> dat;
  function<T(T, T)> func;
  T dummy;
  segtree<T>(lli _n, T ini, function<T(T, T)> f, T dummy)
      : func(f), dummy(dummy) {
    n = 1;
    while (n < _n) {
      n = n * 2;
    }
    dat.assign(2 * n - 1, ini);
  }
  void update(lli k, T a) {
    k += n - 1;
    dat[k] = a;
    while (k > 0) {
      k = (k - 1) / 2;
      dat[k] = func(dat[k * 2 + 1], dat[k * 2 + 2]);
    }
  }
  T query(int a, int b) { return query(a, b, 0, 0, n); }
  // [a,b)の何かを求める.
  T query(int a, int b, int k, int l, int r) {
    //交差しないときはダミー
    if (r <= a || b <= l)
      return dummy;
    if (a <= l && r <= b)
      return dat[k];
    else {
      T vl = query(a, b, k * 2 + 1, l, (l + r) / 2);
      T vr = query(a, b, k * 2 + 2, (l + r) / 2, r);
      return func(vl, vr);
    }
  }
  T get(int a) { return query(a, a + 1, 0, 0, n); }
};

int n, k;
lli f(int u) {
  if (u == n)
    return 0;
  if (sort_until[u])
    return sort_until[u];
  lli &ret = sort_until[u];
  if (a[u] < a[u + 1]) {
    ret = f(u + 1) + 1;
  } else {
    ret = 1;
  }
  return ret;
}
bool isSame(int i, int j, segtree<lli> &rmin, segtree<lli> &rmax) {
  if (i + k - 1 < j) {
    return sort_until[i] >= k && sort_until[j] >= k;
  }
  int l = j - i;
  if (rmax.query(i, j) < rmin.query(j, i + k) &&
      rmax.query(j, i + k) < rmin.query(i + k, j + k)) {
    if (sort_until[i] >= l && sort_until[i + k] >= l)
      return true;
  }
  return false;
}
int main() {
  cin >> n >> k;
  using p = lli;
  auto fmin = [](p a, p b) -> p { return min(a, b); };
  auto fmax = [](p a, p b) -> p { return max(a, b); };

  segtree<lli> rmin(n, 1e18, fmin, 1e18);
  segtree<lli> rmax(n, 0, fmax, 0);

  rep(i, n) {
    cin >> a[i];
    rmin.update(i, a[i]);
    rmax.update(i, a[i]);
  }
  bool flag = false;
  int i = 0;
  int cnt = 0;
  rep(i, n) f(i);
  // rep(i, n - 1) sort_until[i] -= 1;
  //  rep(i, n) cout << sort_until[i] << endl;
  while (i + k - 1 < n) {
    if (sort_until[i] >= k) {
      flag = true;
      i++;
      continue;
    }
    lli up = i + k - 1;
    lli low = i;
    while (up - low > 1) {
      lli mid = (up + low) / 2;
      if (isSame(i, mid, rmin, rmax)) {
        low = mid;
      } else {
        up = mid;
      }
    }
    i = up;
    //    cout << "To " << up << endl;
    ;
    cnt++;
  }
  if (flag)
    cnt++;
  cout << cnt << endl;
}


Measured memory_bytes: 14720
<?php
class DigitalGifts {
    var $N, $x, $u;

    function __construct() {
        define('BTC_RATE', 380000);
        fscanf(STDIN, "%d", $this->N);
        for ($i = 0; $i < $this->N; $i++) {
            fscanf(STDIN, "%f %s", $this->x[$i], $this->u[$i]);
        }
    }
    
    function __invoke() {
        $answer = 0;
        for ($i = 0; $i < $this->N; $i++) {
            switch ($this->u[$i]) {
                case "JPY":
                    $answer += $this->x[$i];
                    break;
                    
                case "BTC":
                    $answer += $this->x[$i] * BTC_RATE;
                    break;
            }
        }
        return $answer;
    }
}

$DigitalGifts = new DigitalGifts();
echo $DigitalGifts();


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

using namespace std;

#define endl "\n"
#define lln long long int
#define IOS ios::sync_with_stdio(0);cin.tie(0);

int main(){
    IOS;
    int n;
    cin >> n;
    if(n > 29) cout << "Yes\n";
    else cout << "No\n";
}

Measured memory_bytes: 3648
program honest_or_unkinf2
    implicit none
    integer(4):: i,j,k, ans
    integer(4):: n, a, x, y
    integer(4), allocatable:: testimony(:,:), assumption(:)
    logical:: is_satisfied

    read*, n
    allocate(testimony(n,n), assumption(n))
    testimony(:,:) = -1

    do i=1, n
        read*, a
        do j=1, a
            read*, x, y
            testimony(x,i) = y
        end do
    end do

    ! do i=1,n
    !     print*, testimony(:,i)
    ! end do
    ans = 0
    do i =0, lshift(1,n)-1
        assumption=0
        do j=1,n
            if (btest(i,j-1)) assumption(j) = 1
        end do
        ! print*, assumption(:)
        is_satisfied = .true.
        do j=1, n
            if (assumption(j) == 0) cycle
            do k=1, n
                if(testimony(k,j) == -1) cycle
                if(testimony(k,j) /= assumption(k)) is_satisfied = .false.
            end do
        end do
        if (is_satisfied) ans = max(ans, sum(assumption(:)))
    end do

    print*, ans
    
end program honest_or_unkinf2

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define REP(i,a,b) for(int i=a;i<=b;i++)
using namespace std;

const int maxn=2e3;
const int dx[]={0,0,1,-1},dy[]={1,-1,0,0};

int A[maxn+10][maxn+10],B[maxn+10][maxn+10];
int DP[maxn+10][maxn+10][4];
int sum[maxn+10][maxn+10][4];

int SUM(int a,int b,int c,int d,int e){
	return sum[c][d][e]-sum[a-1][d][e]-sum[c][b-1][e]+sum[a-1][b-1][e];
}

int main(){
	int n,m,q;
	scanf("%d%d%d",&n,&m,&q);
	REP(i,1,n)REP(j,1,m){
		char c;
		scanf(" %c",&c);
		A[i][j]=c-'0';
	}
	REP(i,1,n)REP(j,1,m)if(A[i][j])
		REP(k,0,3)DP[i][j][k]=A[i+dx[k]][j+dy[k]];
	REP(k,0,3)REP(i,1,n)REP(j,1,m)
		sum[i][j][k]=sum[i-1][j][k]+sum[i][j-1][k]-sum[i-1][j-1][k]+DP[i][j][k];
	REP(i,1,n)REP(j,1,m)B[i][j]=B[i-1][j]+B[i][j-1]-B[i-1][j-1]+A[i][j];
	
	while(q--){
		int x,y,xx,yy;
		scanf("%d%d%d%d",&x,&y,&xx,&yy);
		int ans=B[xx][yy]-B[x-1][yy]-B[xx][y-1]+B[x-1][y-1],t=0;
		REP(i,0,3)t+=SUM(x,y,xx,yy,i);
		t-=SUM(x,y,x,yy,3),t-=SUM(x,y,xx,y,1);
		t-=SUM(xx,y,xx,yy,2),t-=SUM(x,yy,xx,yy,0);
		printf("%d\n",ans-t/2);
	}
	return 0;
}


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

int main() {
    
    string inp; cin >> inp;
    set<char> count;
    for(int i=0; i < inp.size(); i++)
    {
        count.insert(inp[i]);
    }
    if(count.size() == inp.size())
        cout << "yes" << endl;
    else
        cout << "no" << endl;
    return 0;
}


Measured memory_bytes: 256
from functools import reduce
N = int(input())
A = list(map(int, input().split()))

def gcd(A, B):
    P = max(A, B)
    Q = min(A, B)
    while P%Q!=0:
        R = P%Q
        P = Q
        Q = R
    return Q

ans = reduce(gcd, A)
print(ans)

Measured memory_bytes: 14596
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <cstdio>
#include <cmath>
#include <tuple>
#include <iomanip>
#include <numeric>
#include <unordered_map>
#include <sstream>   
#include<limits.h>
#include<float.h>
#include<list>
#include <array>
#include <complex>
using namespace std;
#define i64  long long
#define int  long long
 
#define I32_MAX 2147483647
#define I64_MAX 9223372036854775807LL
#define I64_MAX2 1223372036854775807LL
#define INF I64_MAX2
#define MOD 1000000007
#define MEM_SIZE 10000
#define DEBUG_OUT true
#define ALL(x) (x).begin(),(x).end()
// int DP[MEM_SIZE][MEM_SIZE] = {0};
// int GMEM[MEM_SIZE][MEM_SIZE] = {0};
template<typename T> void DEBUG(T e){if(DEBUG_OUT == false)return;std::cout << e << std::endl;}
template<typename T> void DEBUG(const std::vector<T>& v){if(DEBUG_OUT == false)return;for(const auto& e : v){ std::cout << e << " "; } std::cout << std::endl;}
template<typename T> void DEBUG(const std::vector<std::vector<T> >& vv){if(DEBUG_OUT == false)return;for(const auto& v : vv){ DEBUG(v); } }
template<class T,class X> void DEBUG(X d, T e){if(DEBUG_OUT == false)return;std::cout <<d<<" ";DEBUG(e);};
template <class T> void corner(bool flg, T hoge) {if (flg) {cout << hoge << endl; exit(0);}}
template< typename T1, typename T2 > inline bool chmax(T1 &a, T2 b) { return a < b && (a = b, true); }
template< typename T1, typename T2 > inline bool chmin(T1 &a, T2 b) { return a > b && (a = b, true); }

//CODE

void solve(void)
{
  int A,B;
  cin>>A>>B;
  int K;
  cin>>K;
  int ANS = -1;
  int COUNT = 0;
  for (int i = min(A,B); i >= 1; i--)
  {
    if(A%i == 0 && B%i == 0)
    {
      COUNT++;
      // DEBUG(i);
      if(COUNT == K)
      {
        ANS = i;
      }
    }
  }
  
  cout<<ANS<<endl;
  

  
  return;
}


int32_t main(int32_t argc, const char *argv[])
{
  std::ios::sync_with_stdio(false);
  std::cin.tie(0);

  std::cout << std::fixed;
  std::cout << std::setprecision(9);
  solve();
  

 
  return 0;
}


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

int main(){
	int N; cin>>N;
	int n = 0, r = 0;
	vector<int> A(N);
	rep(i, N){ cin>>A[i]; n = max(n, A[i]); }
	rep(i, N) if(abs(n - r*2) >= abs(n - A[i]*2)) r = A[i];
	// rep(i, N) if(abs(n - r*2) > abs(n - A[i]*2)) r = A[i];
	// rep(i, N) if(abs(n/2 - r) > abs(n/2 - A[i])) r = A[i];
	cout<< n <<" "<< r <<endl;
}


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

#define INPUT1(n, a)                                                           \
    int n;                                                                     \
    std::cin >> n;                                                             \
    std::vector<int> a(n);                                                     \
    for(int i = 0; i < n; i++) {                                               \
        std::cin >> a[i];                                                      \
    }

#define INPUT2(x, y, field)                                                    \
    int x, y;                                                                  \
    std::cin >> x >> y;                                                        \
    std::vector<std::vector<int>> field(x, std::vector<int>(y));               \
    for(int i = 0; i < x; i++) {                                               \
        for(int j = 0; j < y; j++) {                                           \
            std::cin >> field[i][j];                                           \
        }                                                                      \
    }

void print() { std::cout << std::endl; }
template <class Head, class... Tail> void print(Head &&head, Tail &&... tail) {
    std::cout << head;
    if(sizeof...(tail) != 0)
        std::cout << " ";
    print(std::forward<Tail>(tail)...);
}
template <class T> void print(std::vector<T> &vec) {
    for(auto &a : vec) {
        std::cout << a;
        if(&a != &vec.back())
            std::cout << " ";
    }
    std::cout << std::endl;
}
template <class T> void print(std::vector<std::vector<T>> &df) {
    for(auto &vec : df) {
        print(vec);
    }
}

int main() {
    int n, a, b;
    cin >> n >> a >> b;

    int train = n * a;
    int taxi = b;
    (train < taxi) ? print(train) : print(taxi);

    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<string.h>
#include<stdio.h>
#include<queue>
using namespace std;

int a[100000+100];
int main()
{
    int n,x;
    cin>>n;
    for(int i=0;i<n;i++)
    {
        cin>>x;
        a[x]=i+1;
    }
    for(int i=1;i<n;i++)
        cout<<a[i]<<" ";
    cout<<a[n];
    return 0;
}


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

def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))

def main():
    mod=10**9+7
    X,Y,A,B,C=MI()
    p=LI()
    q=LI()
    r=LI()
    p.sort(reverse=True)
    q.sort(reverse=True)
    r.sort(reverse=True)
    sp=sum(p[:X])
    sq=sum(q[:Y])
    np=X-1
    nq=Y-1
    nr=0
    p.append(10**10)
    q.append(10**10)
    r.append(-1)
    
    
    while True:
        pp=p[np]
        qq=q[nq]
        rr=r[nr]
        if rr>pp and rr>qq:
            if pp>qq:
                sq=sq-qq+rr
                nr+=1
                nq-=1
            else:
                sp=sp-pp+rr
                nr+=1
                np-=1
        elif rr>pp:
            sp=sp-pp+rr
            nr+=1
            np-=1
        elif rr>qq:
            sq=sq-qq+rr
            nr+=1
            nq-=1
        else:
            break
        
    print(sp+sq)
            
            
    
    
    

main()


Measured memory_bytes: 92516