akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;

#define FOR(i, j, k) for(int i=j ; i<k ; i++)
#define REP(i, j) FOR(i, 0, j)
#define INF (1<<30)
typedef long long int ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vi> vvi;

int main() {

    int N; cin >> N;

    vi v;
    int a = 9;
    while ( a <= N ) {
        v.push_back(a);
        a *= 9;
    }

    int b = 6;
    while ( b <= N ) {
        v.push_back(b);
        b *= 6;
    }

    v.push_back(1);

    sort(v.begin(), v.end(), greater<int>());
//    REP(i, v.size()) cout << v[i] << " "; cout << endl;

    vi dp(N+1, INF);
    dp[0] = 0;
    REP(i, N+1) {
        REP(j, v.size()) {
            int index = i - v[j];
            if (index >= 0) dp[i] = min(dp[i], dp[index] + 1);
        }
    }

    cout << dp[N] << endl;


    return 0;
}


Measured memory_bytes: 640
n=int(input())
s=list(map(int,input().split()))

ans=[0]*n

i=n-1
j=1
f=0
while i!=-1:
    while True:
        try:
            b=i+(i+1)*j
            f+=ans[b]
            j+=1
        except:
            break
    f=f%2
    if (f-s[i])==0:
        ans[i]=0
    else:
        ans[i]=1
    j=1
    f=0
    i-=1
sad=[]
print(ans.count(1))
i=0
while i!=len(s):
    if ans[i]==1:
        sad.append(i+1)
    i+=1


print(' '.join(map(str, sad)))

Measured memory_bytes: 20532
#include <iostream>

using namespace std;

int main(){
	int prime[10001],p = 3,psum[10001],n;
	prime[1] = 2,prime[2] = 3;
	for(int i=5;p < 10001;i++){
		int f = 0;
		for(int j=1;prime[j]*prime[j] <= i;j++) if(i % prime[j] == 0) {f = 1;break;}
		if(!f) prime[p++] = i;
	}
	psum[1] = 2;
	for(int i=2;i < 10001;i++) psum[i] = psum[i-1] + prime[i];
	while(1){
		cin >> n;
		if(!n) break;
		cout << psum[n] << endl;
	}
		
	return 0;
}
	

Measured memory_bytes: 948
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <algorithm>
#include <numeric>
#include <functional>
#include <sstream>
#include <iostream>
#include <iomanip>
#define _USE_MATH_DEFINES
#include <cmath>
#include <climits>
#include <cstdlib>
#include <cstring>
#include <cfloat>
#include <cmath>
#include <ctime>
#include <cassert>
#include <cctype>
#include <cstdio>
#include <cassert>
using namespace std;

#define EPS 1e-12
#define ull unsigned long long
#define ll long long
#define VI vector<ll>
#define PII pair<ll, ll> 
#define VVI vector<vector<ll> >
#define VVVI vector<vector<vector<ll>>>
#define VVVVI vector<vector<vector<vector<ll>>>>
#define REP(i,n) for(ll i=0,_n=(n);(i)<(ll)_n;++i)
#define REPR(i,n) for(ll i=(ll)(n)-1;0<=(i);--i)
#define RANGE(i,a,b) for(ll i=(ll)a,_b=(ll)(b);(i)<_b;++i)
#define RANGER(i,a,b) for(ll i=(ll)(b)-1,_a=(ll)(a);(_a)<=i;--i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define ALL(c) (c).begin(), (c).end()
#define ALLR(c) (c).rbegin(), (c).rend()
#define PB push_back
#define MP(a, b) make_pair(a, b)
#define POPCOUNT __builtin_popcount
#define POPCOUNTLL __builtin_popcountll
#define CLEAR(table, v) memset(table, v, sizeof(table));
#define UNIFORM_DOUBLE(a, b) (((b-a)*(double)rand()/RAND_MAX)+a) // [a, b) 
#define UNIFORM_LL(a, b) (ll)UNIFORM_DOUBLE(a, b) // [a, b) 
#define IN(v, lo, hi) ((lo)<=(v) && (v)<(hi))
#define DD(v) cout<<#v<<": "<<v<<endl
#define FI first
#define SE second
template <typename T0, typename T1> std::ostream& operator<<(std::ostream& os, const map<T0, T1>& v) { for( typename map<T0, T1>::const_iterator p = v.begin(); p!=v.end(); p++ ){os << p->first << ": " << p->second << " ";} return os; }
template <typename T0, typename T1> std::ostream& operator<<(std::ostream& os, const pair<T0, T1>& v) { os << v.first << ": " << v.second << " "; return os; }
template <typename T> std::ostream& operator<<(std::ostream& os, const vector<T>& v) { for( int i = 0; i < (int)v.size(); i++ ) { os << v[i] << " "; } return os; }
template <typename T> std::ostream& operator<<(std::ostream& os, const set<T>& v) { vector<T> tmp(v.begin(), v.end()); os << tmp; return os; }
template <typename T> std::ostream& operator<<(std::ostream& os, const deque<T>& v) { vector<T> tmp(v.begin(), v.end()); os << tmp; return os; }
template <typename T> std::ostream& operator<<(std::ostream& os, const vector<vector<T> >& v) { for( int i = 0; i < (int)v.size(); i++ ) { os << v[i] << endl; } return os; }
template<typename T>void maxUpdate(T& a, T b) {a = max(a, b);}
template<typename T>void minUpdate(T& a, T b) {a = min(a, b);}
string YN(bool v) { return v ? "Yes":"No"; }
void uniq(VI& es) { sort(ALL(es)); es.erase(unique(ALL(es)), es.end()); }

#define INF (1LL<<60)

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	ll A,B;
	while(cin>>A>>B) {
		ll ans=0;
		RANGE(i, A, B+1) {
			string s=to_string(i);
			ll ok=1;
			REP(i, s.size()/2) if(s[i]!=s[s.size()-1-i])ok=0;
			if(ok)ans++;
		}
		cout<<ans<<endl;
	}
	
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
main()
{
	string s,s1,s2;
	cin>>s;
	s1="ABC";
	s2="ARC";
	if(s==s1)
	cout<<s2<<endl;
	else
	{
		cout<<s1<<endl;
	}
	
}

Measured memory_bytes: 3620
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
int a[100005],b[100005];
int v[100005];
int main()
{
    int n,ans1=0,ans11=0,ans2=0,ans22=0,t1=0,t2=0;
    scanf("%d",&n);
    for(int i=1;i<=n;i++)
        scanf("%d",&v[i]);
    for(int i=1;i<=n;i++)
    {
        if(i&1)
        {
            a[v[i]]++;
            if(a[v[i]]>ans1) ans1=a[v[i]],t1=v[i];
        }
        else
        {
            b[v[i]]++;
            if(b[v[i]]>ans2) ans2=b[v[i]],t2=v[i];
        }
    }
    int ans;
    if(t2==t1)
    {
        memset(a,0,sizeof(a));
        memset(b,0,sizeof(b));
        for(int i=1;i<=n;i++)
        {
            if(v[i]==t2) continue;
            if(i&1)
            {
                a[v[i]]++;
                if(a[v[i]]>ans11) ans11=a[v[i]];
            }
            else
            {
                b[v[i]]++;
                if(b[v[i]]>ans22) ans22=b[v[i]];
            }
        }
        ans=max(ans1+ans22,ans2+ans11);
        ans=n-ans;
    }
    else ans=n-ans1-ans2;
    printf("%d\n",ans);
}


Measured memory_bytes: 2864
import java.util.Scanner;

class Main {
    public static void main(String[] args) throws Exception {

        Scanner sc = new Scanner(System.in);

        int ans = 0;
        String s = sc.next();
        for (Character c : s.toCharArray()) {
            if (c.equals('1'))
                ans++;
        }

        System.out.println(ans);
        sc.close();
    }
}


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

int dp[5005][5005];

int main(){
    int n;
    string s;
    cin >> n >> s;
    for(int i = n-1; i >= 0; --i){
        for(int j = n-1; j >= 0; --j){
            if(s[i] == s[j]) dp[i][j] = dp[i+1][j+1] + 1;
        }
    }
    int ans = 0;
    rep(i,n)rep(j,n){
        if(i >= j) continue; /// i < j;
        int now = min(dp[i][j], j-i);
        ans = max(ans, now);
    }
    cout << ans << endl;
}


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

int main (){
  char mp[11][11];

  while(cin >> mp[0]) {

    for(int i=1;i<10;i++) 
      for(int j=i;j<10;j++) {
	mp[i][j] = ((mp[i-1][j]-'0'+mp[i-1][j-1]-'0')%10)+'0';
	//cout <<mp[i][j] <<" "<< mp[i-1][j] <<" "<<mp[i-1][j-1] << endl;
      }
    cout << mp[9][9]<<endl;

  }

  return 0;
}

Measured memory_bytes: 1132
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
const int mod = 1000000007;

int main() {
    ios::sync_with_stdio(false);
    int n, m, a, b, c[200005] = {}, d[200005] = {};
    cin >> n >> m;
    while (m--) {
        cin >> a >> b;
        if (a == 1) c[b] = 1;
        if (b == n) d[a] = 1;
    }
    for (int i = 1; i <= n; i++) if (c[i] && d[i]) {
        cout << "POSSIBLE";
        return 0;
    }
    cout << "IMPOSSIBLE";
}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
 
using namespace std;
using namespace __gnu_pbds;
 
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define fbo find_by_order
#define ook order_of_key
 
typedef long long ll;
typedef pair<ll,ll> ii;
typedef vector<int> vi;
typedef long double ld; 
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pbds;
typedef set<int>::iterator sit;
typedef map<int,int>::iterator mit;
typedef vector<int>::iterator vit;

int main()
{
	ios_base::sync_with_stdio(0); cin.tie(0);
	ll k,a,b; cin>>k>>a>>b;
	//odd
	if(a<=b)
	{
		if(a>=k)
		{
			cout<<1<<'\n';
		}
		else
		{
			cout<<-1<<'\n';
		}
		return 0;
	}
	ll tmp = 2LL*((max(k-a,0LL)+a-b-1)/(a-b))+1;
	ll tmp2 = 2LL*((k+a-b-1)/(a-b));
	cout<<min(tmp,tmp2)<<'\n';
}	


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

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

typedef long long ll;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> P;
typedef tuple<int,int,int> tpl;

#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define SORT(c) sort((c).begin(),(c).end())
#define REVERSE(c) reverse((c).begin(),(c).end())

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define RFOR(i,a,b) for(int i=(a)-1;i>=(b);--i)
#define RREP(i,n) RFOR(i,n,0)

const double EPS = 1e-9;
const double PI  = acos(-1.0);
const int INT_INF = 2147483647;
const long long LL_INF = 1LL<<60;
const long long MOD = 1000000007;

#define CLR(a) memset((a), 0 ,sizeof(a))

#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

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

int main(void){
    string s; cin >> s;
    
    string a = "keyence";
    REP(i,7){
        if(s.substr(0,i) == a.substr(0,i) && s.substr(s.size()-7+i,7-i) == a.substr(i)){
            cout << "YES" << endl;
            return 0;
        }
    }
    cout << "NO" << endl;
    return 0;
}

Measured memory_bytes: 256
n=int(input())
s=[input() for _ in range(n)]

res='Yes'

su=set(s)
if len(su)<n:
	res='No'

#print(res)   
    
for i in range(n-1):
	f=s[i][len(s[i])-1]
	#print(f)
	b=s[i+1][0]
	#print(b)
	if f!=b:
		#print(i)
		res='No'
		break

print(res)

Measured memory_bytes: 3064
#include <cstdio>
#include <cmath>

#define FOR( i, l, r) for(int i = (l)    ; i <  (r); i++)
#define FOR1(i, l, r) for(int i = (l)    ; i <= (r); i++)
#define REV( i, l, r) for(int i = (r) - 1; i >= (l); i--)
#define REV1(i, l, r) for(int i = (r)    ; i >= (l); i--)
#define INC( i, n) FOR( i, 0, n)
#define INC1(i, n) FOR1(i, 1, n)
#define DEC( i, n) REV( i, 0, n)
#define DEC1(i, n) REV1(i, 1, n)

typedef long long   signed int LL;
typedef long long unsigned int LU;

template<typename T> void swap(T &x, T &y) { T t = x; x = y; y = t; return; }
template<typename T> T abs(T x) { return (0 <= x ? x : -x); }
template<typename T> T max(T a, T b) { return (b <= a ? a : b); }
template<typename T> T min(T a, T b) { return (a <= b ? a : b); }
template<typename T> bool setmin(T &a, T b) { if(a <= b) { return false; } else { a = b; return true; } }
template<typename T> bool setmax(T &a, T b) { if(b <= a) { return false; } else { a = b; return true; } }
template<typename T> T gcd(T a, T b) { return (b == 0 ? a : gcd(b, a % b)); }
template<typename T> T lcm(T a, T b) { return a / gcd(a, b) * b; }

// ---- ----

char s[101];

int main() {
	scanf("%s", s);
	int i = 0;
	bool c = false, f = false;
	while(s[i] != '\0') {
		if(! c && s[i] == 'C') { c = true; }
		if(c && !f && s[i] == 'F') { f = true; }
		i++;
	}
	
	printf("%s\n", f ? "Yes" : "No");
	
	return 0;
}


Measured memory_bytes: 128
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
#define int ll
typedef pair<int,int> pii;
#define rep(i,n) for(ll i=0;i<(ll)(n);i++)
#define all(a) (a).begin(),(a).end()
#define pb emplace_back

signed main(){
    int h,w;
    cin>>h>>w;
    if(h<w)swap(h,w);
    
    if(w==1){
        if(h==1){
            cout<<1<<endl;
        }else{
            cout<<h-2<<endl;
        }
    }else{
        int ans = max<ll>((h-2)*(w-2),0);
        cout<<ans<<endl;
    }
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <cstring>
#include <string>
#include <vector>

using namespace std;

int main() {
    int N;
    int num = 1;
    cin >> N;
    int a[N];
    for (int i = 1; i <= N; i++) {
        cin >> a[i];
    }
    
    for (int i = 1; i <= N; i++) {
        if (a[num] == 2) {
            cout << i << endl;
            return 0;
        }
        num = a[num];
    }
    
    cout << -1 << endl;
    return 0;
}
        

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

int main(int argc, char const *argv[])
{
	string s,t;
	cin>>s>>t;
	int memo[s.size()][30];
	for (int i = 0; i < s.size(); ++i)
	{
		for (int j = 0; j < 30; ++j)
		{
			memo[i][j]=-1;
		}
	}
	for (int i = 0; i < 30; ++i)
	{
		int pos=-1;
		for (int j = 0; j < s.size(); ++j)
		{
			if (s.at(j)=='a'+i)
			{
				pos=j;
				break;
			}
		}
		if (pos!=-1)
		{
			int cnt=0;
			while (1)
			{
				--pos;
				if (pos==-1)
				{
					pos+=s.size();
				}
				++cnt;
				if (memo[pos][i]!=-1)
				{
					break;
				}
				memo[pos][i]=cnt;
				if (s.at(pos)=='a'+i)
				{
					cnt=0;
				}
			}
		}
	}
	long long ans=0LL;
	int pos=s.size()-1;
	for (int i = 0; i < t.size(); ++i)
	{
		ans+=(long long)memo[pos][t.at(i)-'a'];
		if (memo[pos][t.at(i)-'a']==-1)
		{
			cout<<"-1\n";
			return 0;
		}
		pos+=memo[pos][t.at(i)-'a'];
		pos%=s.size();
	}
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 12416
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i=0;i<n;i++)
#define rep0(i, b, s) for(int i=b;i<s;i++)
typedef long long ll;

struct drink{
    int val;
    int num;
};

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

    drink drinks[N];

    rep(i, N) cin >> drinks[i].val >> drinks[i].num;

    sort(drinks, drinks + N, [](const drink &a, const drink &b) {
        return a.val < b.val;
    });

    ll ans = 0;

    rep(i, N){
        ll value = drinks[i].val, num = drinks[i].num;
        ans += min(M, num) * value;
        M -= min(M, num);
        if(M==0) break;
    }

    cout << ans << endl;

}

Measured memory_bytes: 1024
# coding:utf-8

import sys
from collections import Counter, defaultdict, deque

INF = float('inf')
MOD = 10 ** 9 + 7
dy = (0, -1, 0, 1)
dx = (1, 0, -1, 0)

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def S(): return input()


H, W = LI()
B = [[1 if s == '#' else 0 for s in S()] for _ in range(H)]


def BFS(i, j):
    white = 0
    queue = deque([(i, j)])
    visited = set()
    visited_b = set()  # 連結されている黒マス
    while queue:
        y, x = queue.pop()
        color = B[y][x]

        if color == 0 and (y, x) not in visited:
            white += 1

        if color == 1:
            visited_b.add((y, x))
        visited.add((y, x))

        for k in range(4):
            ny = y + dy[k]
            nx = x + dx[k]
            if (ny, nx) in visited:
                continue

            if ny < 0 or ny >= H or nx < 0 or nx >= W:
                continue

            if B[ny][nx] == color:
                continue

            queue.append((ny, nx))

    return white, visited_b


ans = 0
visited_b = set()
for h in range(H):
    for w in range(W):
        if B[h][w] == 1 and (h, w) not in visited_b:
            tmp, v = BFS(h, w)
            ans += tmp * len(v)
            visited_b |= v

print(ans)


Measured memory_bytes: 44696
#include<stdio.h>
int main(Void)
{ 
   int a,b;
    scanf("%d %d",&a,&b);
    if(a<b)
{ 
       printf("a < b\n");
    } 
   if(a>b)
{ 
       printf("a > b\n"); 
   }  
  if(a==b)
{ 
       printf("a == b\n");    
}
}


Measured memory_bytes: 2100
#include <bits/stdc++.h>
#define to G[u][i].v
#define val G[u][i].s
#define N 100100
using namespace std;
typedef long long ll;

struct edge {int v;  ll s;  edge(int v,ll s):v(v),s(s) {}};
vector <edge> G[N];
int n, m, f[N], vis[N];
ll add[N], X;

void dfs(int u) {
	if (X == -1) return ;
	for (int i=0;i<G[u].size();i++) if (!vis[to]) {
		f[to] = -f[u];
		add[to] = val - add[u];
		vis[to] = 1;
		dfs(to);
	} else {
		if (f[u] != f[to]) {
			if (add[u] + add[to] != val) X = -1;
		} else {
			if ((val - add[to] - add[u]) % 2 != 0) X = -1;
			else {
				ll res;
				if (f[u] == 1) res = (val - add[to] - add[u]) / 2;
				else res = (add[u] + add[to] - val) / 2;
				if (res <= 0) X = -1;
				if (X > 0 && X != res) X = -1;
				if (X == 0) X = res;
			}
		}
	}
}

int main() {// freopen("_in.txt","r",stdin);
	scanf("%d%d",&n,&m);
	for (int i=1,u,v,s;i<=m;i++) {
		scanf("%d%d%d",&u,&v,&s);
		G[u].push_back(edge(v,s));
		G[v].push_back(edge(u,s));
	}
	f[1] = 1;  vis[1] = 1;
	dfs(1);
	if (X > 0) {
		for (int i=1;i<=n;i++) if (add[i] + X * f[i] <= 0) {puts("0");  return 0;}
		puts("1");  return 0;
	} else if (X == 0) {
		ll l = 1, r = 2e9;
		for (int i=1;i<=n;i++) {
			if (f[i] == 1) {
				l = max(l,-add[i]+1);
			} else {
				r = min(r,add[i]-1);
			}
		}
		if (0 < l && l <= r) {
			printf("%lld\n",r-l+1);
			return 0;
		}
	} puts("0");
}

Measured memory_bytes: 14080
#include<bits/stdc++.h>
using namespace std;
int n,k;
string s;
int main() 
{
    cin>>n>>k;
    cin>>s;
    int ans=1;
    int last=n-1,num_zero=(s[n-1]=='0');
    for (int first=n-2;first>=0;--first) {
        if (s[first]=='1'||(s[first]=='0'&&s[first+1]=='0')) 
		{
            ans=max(ans,last-first+1);
        }
        else 
		{
            ++num_zero;
            while(k<num_zero) 
			{
                while(s[last]=='1') 
					--last;
                while(s[last]=='0') 
					--last;
                --num_zero;
            }
            ans=max(ans,last-first+1);
        }
    }
    cout<<ans<<endl;
    return 0;
}

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


#define FOR(i, start, end) for(uint64_t i=start; i<end; i++)
#define REP(i, n) FOR(i, 0, n)

// 最大公約数gcd
// 最小公倍数lcm=m*n/gcd
uint64_t gcd(uint64_t m, uint64_t n) {
  uint64_t temp;
  while (m % n != 0){
    temp = n;
    n = m % n;
    m = temp;
  }
  return n;
}

uint64_t lcm(uint64_t m, uint64_t n) {
  return (m*n)/gcd(m,n);
}

void comb(vector<vector <uint64_t> > &v){
  for(uint64_t i = 0;i <v.size(); i++){
    v[i][0]=1;
    v[i][i]=1;
  }
  for(uint64_t k = 1;k <v.size();k++){
    for(uint64_t j = 1;j<k;j++){
      v[k][j]=(v[k-1][j-1]+v[k-1][j]);
    }
  }
}

// 掛け算オーバーフロー判定
bool is_product_overflow(uint64_t a, uint64_t b) {

	uint64_t prod = a * b;
	
	return (prod / b != a);
}

//素因数分解
void primeFactorization(uint64_t a, list<uint64_t> &factors){ //素因数分解を出力するプログラム
  long i,sq;
  if(a%2==0){ //偶数の場合
    factors.push_back(2);
    primeFactorization(a/2,factors); //2で割った値で再帰
    return;
  }
  sq = sqrt(a);
  for(i=3;i<=sq;i+=2){ //3以上√a以下の奇数の場合
	if(a%i==0){
	  factors.push_back(i);
      primeFactorization(a/i,factors); //割れた値で再帰
      return;
	}
  }
  //偶数でも3以上√a以下の奇数の場合でも割り切れない場合
  if(a!=1){ //aが1でないなら、a自身は素数
    factors.push_back(a);
  }
}

// 円周率
// M_PI

// #include <iomanip> // setprecisionを使用するのに必要
// cout << std::fixed << std::setprecision(15) << y << endl;

// 昇順
// priority_queue<int, vector<int>, greater<int> > queue;

signed main() {
  string s;
  while(true){
    cin >> s;
    if(s.compare("-")==0) break;
    int m,h;
    cin >> m;
    for(int i=0;i<m;i++){
      cin >> h;
      string newStr = s.substr(h);
      newStr += s.substr(0,h);
      s = newStr;
    }
    cout << s << endl;
  }
  
  return 0;
}


Measured memory_bytes: 3160
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		// 整数の入力
		int a = sc.nextInt();
		int b = sc.nextInt();
		int c = sc.nextInt();
		int d = sc.nextInt();
		int e = sc.nextInt();
		int k = sc.nextInt();
		if (e - a > k) {
			System.out.println(":(");          
        } else {
			System.out.println("Yay!");          
        }
	}
}

Measured memory_bytes: 22868
#include <cstdio>
#include <string>
#include <cmath>
#include <string>
#include <algorithm>
#include <iostream>
#include <map>
#include <vector>
#include <iomanip>
#include <tuple>
#include <queue>
using namespace std;
typedef long long ll;
#define rep(i, a, n) for (int i=a;i<n;++i)
#define repeq(i, a, n) for(int i=a;i<=n;++i)
#define repi(m, itr) for (auto itr = m.begin();itr != m.end();++itr)
#define per(i, a, n) for (int i=n-1; i>=a;--i)
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(), (x).end()

// 
string S, T;
string ans = "Yes";
map<char, int> s, t;

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

    rep(i, 0, S.size()){
        ++s[S[i]];
    }
    rep(i, 0, T.size()){
        ++t[T[i]];
    }
    
    int ss[26], tt[26];
    int tmp=0;
    for(char c='a';c<='z';c++){
        ss[tmp] = s[c];
        tt[tmp] = t[c];
        tmp++;
    }
    sort(ss, ss+26, greater<int>());
    sort(tt, tt+26, greater<int>());
    rep(i, 0, 26){
        if(ss[i] != tt[i]){
            ans = "No";
            break;
        }
    }

    cout << ans << endl;
    return 0;
}




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

ans = []
for i in ct:
    if i[1] <= T:
        ans.append(i[0])
if len(ans) == 0:
    print('TLE')
else:
    print(min(ans))

Measured memory_bytes: 3060
program j01;
const maxn=100086;
var h:array[0..maxn]of int64;
    n,i:longint;
    a,b,l,r,mid:int64;

function jud(k:int64):boolean;
var i:longint;tmp,kk,cnt:int64;
begin
  cnt:=0;
  for i:=1 to n do
  begin
    tmp:=h[i]-k*b;if tmp<=0 then continue;
    kk:=tmp div a;
    if kk*a=tmp then inc(cnt,kk) else inc(cnt,kk+1);
  end;
  exit(cnt<=k);
end;

begin
  readln(n,a,b);a:=a-b;
  for i:=1 to n do readln(h[i]);
  l:=1;r:=1000000000;
  while l<r do
  begin
    mid:=(l+r)div 2;
    if jud(mid)then r:=mid else l:=mid+1;
  end;
  writeln(l);
end.



Measured memory_bytes: 896
#include <string>
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<long long,long long> P;
typedef pair<long long,P> P1;
typedef pair<P,P> P2;
#define pu push
#define pb push_back
#define mp make_pair
#define eps 1e-7
#define INF 1000000000
#define mod 1000000007
#define fi first
#define sc second
#define rep(i,x) for(long long i=0;i<x;i++)
#define repn(i,x) for(long long i=1;i<=x;i++)
#define SORT(x) sort(x.begin(),x.end())
#define ERASE(x) x.erase(unique(x.begin(),x.end()),x.end())
#define POSL(x,v) (lower_bound(x.begin(),x.end(),v)-x.begin())
#define POSU(x,v) (upper_bound(x.begin(),x.end(),v)-x.begin())
long long n,h[100005];
ll dp[100005];
#define ALL(v)  (v).begin(),(v).end()
std::set<long long> st;
//#define MAX(a,b) if(a>b)
#define MAX(a,b) (((a)>(b))?(a):(b))
#define MIN(a,b) (((a)<(b))?(a):(b))

    /*  ペア関連
    //vector<pair<long long, long long> > pairs(N);
    for(long long i=0; i<N; i++){
        long long a, b;
        cin >> a >> b;
        pairs[i] = make_pair(a, b);
    }
    
    //sort(pairs.begin(), pairs.end(),greater<pair<long long,long long> >());
	sort(pairs.begin(), pairs.end());
    */

 	//stack<long long> sta;   
    //queue<long long> que;


int main(){
	
	double W,H,x,y;
	string s;
    long long sum,sum1;
	sum=0;
	sum1=0;
	long long flg,flg1,cnt,cnt1;
	flg=0;
	flg1=0;
	cnt=0;
	cnt1=0;
	long long max;
	long long max1;
	max=0;
	max1=0;
	long long min;
	long long min1;
	min=INF;
	min1=INF;

	long long work1,work2,work3,work4;
	work1=0;
	work2=0;
	work3=0;
	work4=0;
    
	std::cin >> W >> H >> x >> y;
    //std::cin >> N >> M;
    //std::cin >> N >> M >> K;
    
	//std::vector<long long> v(N);
	//std::vector<long long> w(N);
    //std::cin >> s;
    
    
    // 配列入力1
    /*
    for(long long i=0; i<N; i++){
		std::cin >> v[i];
	}
	*/
	// 配列入力2
	/*
	for(long long i=0; i<N; i++){
		std::cin >> w[i];
	}
	*/
    
	
	//通常
	/*
    for(long long i=0; i<N; i++){
		
	}
	*/
	

	//文字列入力
	/*
	for(long long i=0; i<s.length(); i++){
		
		if(s[i]!='1'){
	}
	*/

	
	
	//ソート
    //std::sort(v.begin(),v.end());//昇順ソート
    //std::sort(v.begin(),v.end(),std::greater<long long>());//降順ソート
    //std::sort(w.begin(),w.end());//昇順ソート
    //std::sort(w.begin(),w.end(),std::greater<long long>());//降順ソート
    /*
    
    //S.substr(i, 5);
    //S.size();
    
    for(long long i=0; i<N; i++){
		std::cin >> v[i];
		if(st.find(v[i])==st.end()){
			st.insert(v[i]);
		}
		else{
			st.erase(v[i]);
		}
	}
	*/


	/*
	long long a[4];
	long long value;
	value=0;
	
	a[0] = (value % 10); 
	value /= 10;// 1桁目を取り出す
	a[1] = (value % 10); 
	value /= 10;// 2桁目を取り出す
	a[2] = (value % 10); 
	value /= 10;// 3桁目を取り出す
	a[3] = (value % 10); 
	value /= 10;// 4桁目を取り出す
    work1=a[0]+10*a[1];
    work2=a[2]+10*a[3];
    */
	printf("%f ",W*H/2);
    if(x==W/2 && y==H/2){
    	//printf("%d",N);
    	//printf("%lld",N);
    	puts("1");
    	//printf("%d",st.size());
    	//文字列の出力
    	//std::cout << s << std::endl;
    	//printf("%.12f\n",ret);
    	//cout << sum << endl;
	}
	else{
		puts("0");
	}
	return 0;
}


Measured memory_bytes: 256
#include<cstdio>
#include<algorithm>
using namespace std;
int n,a,b,p;
int num1,num2,num3;
int main(){
  scanf("%d%d%d",&n,&a,&b);
  for(int i=1;i<=n;i++){
    scanf("%d",&p);
    if(p<=a)num1++;
    else if(p>b)num3++;
    else num2++;
  }
  printf("%d",min(num1,min(num2,num3)));
}

Measured memory_bytes: 128
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;

class Program
{
    static void Main(string[] args)
    {
        var input = Console.ReadLine().Split(' ');
        var a = long.Parse(input[0]);
        var b = long.Parse(input[1]);
        var c = long.Parse(input[2]);

        if (c - a - b > 0)
        {
            if (4 * a * b < (c - a - b) * (c - a - b))
            {
                Console.WriteLine("Yes");
            }
            else
            {
                Console.WriteLine("No");
            }
        }
        else
        {
            Console.WriteLine("No");
        }
    }
}

Measured memory_bytes: 13140
#include<stdio.h>
int main(void){
int a,b;
double c,d;
scanf("%d%d",&a,&b);
c=a;
d=b;
// printf("%.0f %.0d %f\n",a/b,c%d,a/b);
printf("%d %d %lf\n",a/b,a%b,c/d);
return 0;
}


Measured memory_bytes: 2092
import java.util.*;

public class Main{

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.next());
        int ans = 0;
        int max = 0;
        int tmp = 0;
        for(int i = 0;i<n;i++){
            tmp = Integer.parseInt(sc.next());
            if(max <= tmp){
                ans++;
                max = tmp;
            }
        }
        System.out.println(ans);
    }
}

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

#define REP(i,s,n) for(int i=s; i<n; ++i)
#define rep(i,n) REP(i,0,n)
#define SORT(c) sort((c).begin(),(c).end())
#define IINF INT_MAX
#define LLINF LLONG_MAX

typedef long long ll;
typedef pair<int, int> ii;

/*
class Node {
public:
  int num;
  int index;
  bool operator<(const Node& b) const {
    if(num < b.num) return (num < b.num);
    else return index > b.index;
  }

  Node(){
    num=0; index=0;
  }
  Node(int n, int i) : num(n), index(i){
  }
};
*/

string match = "CODEFESTIVAL2016";

int main(){

  string s;
  cin >>s;
  int ans = 0;
  rep(i, s.size()){
    if(s[i] != match[i]) ans++;
  }

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <iomanip>
#include <stdlib.h>
#include <string.h>
#include <cstring>
#include <cmath>
#include <map>
#include <queue>
#include <deque>
#include <stack>
#include <set>
#include <stdio.h>
#include <tuple>
#include <bitset>
#include <cfloat>
#include <fstream>
#include <limits.h>
#include <list>
#include <math.h>
#include <random>
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#include <numeric>
#include <utility>
#include <sstream>
#define int long long
#define rep(i, n) for (int i = 0; i < (n); i++)
#define P pair<int, int>
#define sz(x) x.size()
#define ALL(x) (x).begin(),(x).end()
#define ALLR(x) (x).rbegin(),(x).rend()
#define V vector<int>
template<class T> inline bool chmin(T& a, T b) {
	if (a > b) {
		a = b;
		return true;
	}
	return false;
}
template<class T> inline bool chmax(T& a, T b) {
	if (a < b) {
		a = b;
		return true;
	}
	return false;
}

using namespace std;
typedef long long ll;
using Graph = vector<vector<int>>;
ll gcd(ll a, ll b) {
	if (a < b)swap(a, b);
	if (b == 0) return a;
	return gcd(b, a % b);
}
ll lcm(ll a, ll b) {
	ll g = gcd(a, b);
	return a / g * b;
}
bool prime(int n) {
	for (int i = 2; i <= sqrt(n); i++) {
		if (n%i == 0)return false;
	}
	return n != 1;
}


const long long MOD = 1000000007;
const long long INF = 1LL << 50;

// pair -> vector<pair<int,int>> 
//		   AandB.push_back(make_pair(a[i],b[i]))


signed main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	int h, w; cin >> h >> w;
	vector<vector<string>>a(h, vector<string>(w));
	rep(i, h)rep(j, w)cin >> a[i][j];
	rep(i, h) {
		rep(j, w) {
			if (a[i][j] == "snuke") {
				cout << (char)('A' + j) << i + 1 << endl; return 0;
			}
		}
	}
	return 0;
}

Measured memory_bytes: 256
using System;
using System.Linq;

class ListOfTop3Hills
{
	static void Main()
	{
		var heightOrdered =
			from _ in Enumerable.Range( 0, 10 )
			select int.Parse( Console.ReadLine() ) into input
			orderby input descending
			select input;
		foreach( var h in heightOrdered.Take( 3 ) )
			Console.WriteLine( h );
	}
}

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

using namespace std;

typedef long long ll;
typedef pair<int,int> P;
constexpr double EPS = 1e-12;
constexpr int INF = numeric_limits<int>::max()/2;
constexpr int MOD = 1e9+7;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    string a,b,c;cin>>a>>b>>c;
    if(a[a.length()-1]==b[0] && b[b.length()-1]==c[0]) cout<<"YES"<<endl;
    else cout<<"NO"<<endl;
}


Measured memory_bytes: 256
import fractions
from functools import reduce

def lcm_b(a, b):
        #print("base",a,b)
        return (a * b) // fractions.gcd(a, b)

def lcm_o():
        global n
        return reduce(lcm_b, n)

def chk(v):
        global n
        for i in range(1,30):
                if v%2 == 1:break
                v = v//2
        t=2**(i-1)
        for j in range(len(n)):
                s=int(n[j]/t)
                if n[j] % t == 0 and s % 2 == 1:
                        n[j] = s

                else: return 0
        return int(t//2)

def mp(v):
        if v%2==1:v+=1
        return int(v//2)

N,M= [int(i) for i in input().split()]
n = [int(i) for i in input().split()]
n=sorted(set(n),reverse = True)
bs = n[0]//2

if len(n) > 1:
        c = chk(n[-1])
        if  c != 0:
                v = lcm_o()*c
                if v > M: print(0) 

                else:
                        #print(mp(M//v))
                        v = M//v
                        if v%2==1: v+=1
                        print(int(v//2))
        
        else: print(0)
        
elif len(n)==1:
        #print(mp(M//bs))
        v = M//bs
        if v%2==1: v+=1
        print(int(v//2))

Measured memory_bytes: 16308
#pragma GCC optimize("O4")
#include <bits/stdc++.h>
#define For(i,a,b) for(int i=a;i<=b;i++)
#define F first
#define S second
#define all(x) x.begin(),x.end()
#define sz(x) ((int)x.size())
//#define MOD (ll)(998244353)
#define MOD (ll)(1e9+7)
#define INF (1e17)
#define int ll
#define EPS (1e-6)
using namespace std;
using ll=long long;
using pii=pair<int,int>;

int gcd(int a,int b) { return b==0?a:gcd(b,a%b); }
int lcm(int a,int b) { return a/gcd(a,b)*b; }
int fpow(int b,int p){
	if(p==0) return 1;
	int h=fpow(b,p/2);
	if(p%2) return h*b%MOD*h%MOD;
	return h*h%MOD;
}

int32_t main() {
#ifdef LOCAL_TEST
	freopen("E:\\Jimmy\\2 Coding\\1 C++\\input.in","r",stdin);
	freopen("E:\\Jimmy\\2 Coding\\1 C++\\output.out","w",stdout);
	freopen("E:\\Jimmy\\2 Coding\\1 C++\\error.out","w",stderr);
#endif
	ios::sync_with_stdio(false);
	cin.tie(0);

	//code...
	int A,B,C,D,E,F; cin>>A>>B>>C>>D>>E>>F;
	bool wat[35];
	wat[0]=true;
	For(i,1,34){
		if(i>=A && wat[i-A]) wat[i]=true;
		else if(i>=B && wat[i-B]) wat[i]=true;
		else wat[i]=false;
	}
	bool sug[3050];
	sug[0]=true;
	For(i,1,3049){
		if(i>=C && sug[i-C]) sug[i]=true;
		else if(i>=D && sug[i-D]) sug[i]=true;
		else sug[i]=false;
	}
	int mxt=-INF,mxs=-INF;
	For(s,0,3000){
		For(w,1,30){
			if(s+w*100>F) continue;
			if(!wat[w] || !sug[s]) continue;
			if(s>E*w) continue;
			if(mxs*(w*100+s)<s*mxt){
				mxt=w*100+s;
				mxs=s;
			}
		}
	}
	cout<<mxt<<" "<<mxs<<"\n";
	return 0;
}

Measured memory_bytes: 256
import java.util.*;
import java.io.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int M = sc.nextInt();
        ArrayList<Integer>[] graphLink = new ArrayList[N];
        for(int n=0;n<N;n++) graphLink[n] = new ArrayList<Integer>();
        
        for(int m=0;m<M;m++){
        	int A = sc.nextInt()-1;
	int B = sc.nextInt()-1;// index fix

        	graphLink[A].add(B);
        	graphLink[B].add(A);
        }
        
        int[] ichimatsu = new int[N];
        for(int n=1;n<N;n++) ichimatsu[n]=0;
        ichimatsu[0]=1;
        /*paint the vertices
        //same color as vertex 0: ichimatsu[i] = 1
        //different color from v1:ichimatsu[i] = 2
        //not checked yet:        ichimatsu[i] = 0
        */

        LinkedList<Integer> unchecked = new LinkedList<Integer>();
        unchecked.add(0);
        while(!unchecked.isEmpty()){
        	int v1 = unchecked.removeFirst();
        	for(int v:graphLink[v1]){
        	    int newColor = 3 - ichimatsu[v1];
        	    if(ichimatsu[v]+newColor==3){//find an odd loop
        	        long ans = (long)N * (N-1) /2 - M;
        	        System.out.println(ans);
        	        System.exit(0);
        	    }else if(ichimatsu[v]==0){
        	        unchecked.add(v);
        	        ichimatsu[v] = newColor;
        	    }
        	}
        }
        int color1 = 0;
        int color2 = 0;
        for(int n=0;n<N;n++){
        	if(ichimatsu[n]==1) color1++;
        	else color2++;
        }
        long ans = (long)color1*color2-M;
        System.out.println(ans);
    }
}

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

#define REP(i, s, n) for (int i = s; i < n; ++i)
#define rep(i, n) REP(i, 0, n)
#define SORT(c) sort((c).begin(), (c).end())
#define IINF INT_MAX
#define LLINF LLONG_MAX
#define DEBUG false

int main()
{
    string a;
    string b;
    string c;
    cin>>a>>b>>c;
    cout<<a[0]<<b[0]<<c[0]<<endl;
    return 0;
}

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

#define MAX_N 64

using namespace std;

int64_t L[MAX_N]{};

int64_t f(int i) {
  if (i == 0) {
    return 2;
  }
  if (i == 1) {
    return 1;
  }
  if (L[i] == 0) {
    L[i] = f(i - 1) + f(i - 2);
  }
  return L[i];
}

int main() {
  int N;
  cin >> N;
  printf("%lld\n", f(N));
}


Measured memory_bytes: 3224
#include <iostream>
#include <algorithm>
#include <utility>
#include <string>
#include <vector>
#include <set>
#include <stack>
#include <queue>
#include <map>
#include <math.h>
#include <string.h>
#include <iomanip>
#include <numeric>
#include <cstdlib>
#include <cstdint>
#include <cmath>
#include <functional>
#include <limits>
#include <cassert>

using namespace std;

using ll = long long;
using pll = pair<ll, ll>;
using vl = vector<ll>;
using vll = vector<vl>;
using vpll = vector<pll>;

void debug_out() { std::cout << endl; }
 
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cout << H << " ";
  debug_out(T...);
}

#ifdef LOCAL
#define debug(...) cout << "debug: "; debug_out(__VA_ARGS__)
#else
#define debug(...) 
#endif

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rrep(i, n) for (int i = ((int)(n)-1); i >= 0; i--)
#define Rep(i, n) for (long long i = 0; i< (long long)(n); i++)
#define RRep(i,n) for (long long i = ((long long)(n)-1); i>=0; i--)
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()

struct Edge{
    int to;
    int weight;
    Edge(int t, int w) : to(t), weight(w){ }
};

struct edge{
    int from;
    int to;
    int weight;
    edge(int f,int t,int w) : from(f), to(t), weight(w){ }
};


using Graph = vector<vector<Edge>>;
using graph = vector<vector<int>>;
using edges = vector<edge>;

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

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

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

bool isPalindrome(string s){
    string t = s;
    reverse(all(t));
    return s==t;
}

constexpr ll INF = 1e9+7;

vector<int> dx = {-1,0,1,0};
vector<int> dy = {0,-1,0,1};

template<class T>
T binary(T key,const vector<T> &g){
    T ng = -1;
    T ok = (T)g.size();
    while(abs(ok-ng)>1){
        T mid = (ok+ng)/2;
        if(gcd(g[mid],key)==1){
            ok = mid;
        }
        else{
            ng = mid;
        }
    }
    return ok;
}

int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int n; cin >> n;
    int k = 1;
    while(2*n>k*(k+1)){
        k++;
    }
    int g = k*(k+1)/2 -n;
    for(int i = 1; i<=k; i++){
        if(i!=g){
            cout << i << endl;
        }
    }
}

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

using namespace std;

struct node {
	string mes;
	int depth;
};

node deldots( node n ) {
	node ret;
	int cnt = 0;
	for(int i = 0; i < n.mes.length(); i++) {
		if( n.mes[i] == '.' ) {
			ret.mes += " ";
			cnt ++;
		}
		else ret.mes += n.mes[i];
	}
	if( cnt > 0 )
		ret.mes[cnt-1] = '+';
	ret.depth = cnt - 1;
	return ret;
}

int main(void){

	while( 1 ) {
		int n;
		vector< node > v;
		bitset< 1 << 20 > b;
		b.reset();

		cin >> n;
		if( n == 0 ) break;
		
		for(int i = 0; i < n; i++) {
			node str;
			cin >> str.mes;
			str = deldots( str );
			v.push_back( str );
		}

		for(int i = 0; i < n; i++) {
			if( v[i].depth >= 0 ) {
				b.reset( v[i].depth );
				for(int j = 0; j < v[i].mes.length(); j++) {
					if( b[j] )
						cout << "|";
					else
						cout << v[i].mes[j];
				}
				cout << endl;
				for(int j = i + 1; j < n; j++) {
					if( v[i].depth > v[j].depth ) {
						break;
					} else if( v[i].depth == v[j].depth ) {
						b.set( v[i].depth );
					}
				}
			} else {
				cout << v[i].mes << endl;
			}
		}

		
	}
	return 0;
}

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

#define ALL(v) (v).begin(),(v).end()

using namespace std ;
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;




int main()
{
  int a, p ;
  cin >> a >> p ;
  cout <<(a*3+p)/2<<endl ;
  
    return 0 ;
}

/*　吾輩はやれば出来る子である。 
　　　　∩∩ 
　　　（´･ω･） 
　　 ＿|　⊃／(＿＿_ 
　／　└-(＿＿＿_／ 
　￣￣￣￣￣￣￣ 
　やる気はまだない 

　　 ⊂⌒／ヽ-、＿_ 
　／⊂_/＿＿＿＿ ／ 
　￣￣￣￣￣￣￣　　*/

Measured memory_bytes: 256
//#pragma GCC optimize "trapv"
//-D_GLIBCXX_DEBUG
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
#define pm(m) for(auto itr=(m).begin();itr!=(m).end();itr++){itr->first<<" "<<itr->second<<"\n";}
#define int long long int
#define all(x) x.begin(),x.end()
#define allr(x) x.rbegin(),x.rend()
#define ii pair<int,int>
#define Max 100000+5
#define IO ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define f first
#define s second
#define pb push_back
#define bug(x) cout<<(x)<<" ";exit(0);
int mod = 1000000007;
int mod1 = 998244353;
template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

int dis(string s, string t){
    int val=0;
    for(int i=0;i<t.length();i++){
        if(s[i]!=t[i])val++;
    }
    return val;
}
int32_t main(){
	IO
	//freopen("input.txt","r",stdin);
    	//freopen("output.txt","w",stdout);
	
	int n;
	cin>>n;
	vector<int> v(n),p(n);
	for(int i=0;i<n;i++){
	    cin>>v[i];
	}
	for(int i=n-1;i>=0;i--){
	    p[i] = ((i==n-1)?v[i]:v[i]+p[i+1]);
	    if(p[i]>mod)p[i]%=mod;
	}
	int ans=0;
	for(int i=0;i<n-1;i++){
	    ans+= (v[i]*p[i+1])%mod;
	    ans%=mod;
	}
	cout<<ans;
	
}

Measured memory_bytes: 6364
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int,int>;
 
const int INF = 1001001001;
vector<int> to[100005];
 
int main() {
  int n, m;
  cin >> n >> m;
  rep(i,m) {
    int a, b;
    cin >> a >> b;
    --a; --b;
    to[a].push_back(b);
    to[b].push_back(a);
  }
 
  queue<int> q;
  vector<int> dist(n, INF);
  vector<int> pre(n, -1);
  dist[0] = 0;
  q.push(0);
  while (!q.empty()) {
    int v = q.front(); q.pop();
    for (int u : to[v]) {
      if (dist[u] != INF) continue;
      dist[u] = dist[v]+1;
      pre[u] = v;
      q.push(u);
    }
  }
 
  cout << "Yes" << endl;
  rep(i,n) {
    if (i == 0) continue;
    int ans = pre[i];
    ++ans;
    cout << ans << endl;
  }
  return 0;
}

Measured memory_bytes: 10732
from collections import Counter,defaultdict,deque
from heapq import heappop,heappush,heapify
import sys,bisect,math,itertools,fractions
sys.setrecursionlimit(10**8)
mod = 10**9+7
INF = float('inf')
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))

n = inp()
now = 1
while True:
    if now*2 > n:
        print(now)
        break
    now *= 2



Measured memory_bytes: 5076
#include<stdio.h>
#include<math.h>
int main(void){
	#define PI 3.14159265
	int a,b;
	double s,l,h,rad,c;
	scanf("%d %d %lf",&a,&b,&c);
	
	rad=PI/(180.0/c);
	s=sin(rad)*a*b/2;
	
	l=sqrt(a*a+b*b-2*a*b*cos(rad))+a+b;
	
	h=b*sin(rad);
	
	printf("%lf\n%lf\n%lf\n",s,l,h);
	return 0;
}


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

int main() {
  ll a = 0, b = 0, k = 0;
  cin >> a >> b >> k;
  if(a <= k){
    k -= a;
    a = 0;
  } else{
    a -= k;
  }
  if(k - a >= 0) b -= k;
  b <= 0 ? b = 0: b = b;
  std::cout << a << " " << b << endl;
}

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

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

int main(){
  int x;
  cin >> x;
  cout << x*x*x << endl;
}



Measured memory_bytes: 3120
#include <stdio.h>

char s[13];
char ans[14];

int main() {
	scanf("%s", &s);
	for (int i = 0; i < 14; ++i) {
		if (i < 4) { ans[i] = s[i]; }
		else if (i == 4) {
			ans[i] = ' ';
		}
		else {
			ans[i] = s[i - 1];
		}
	}

	printf("%s\n", ans);

	return 0;
}

Measured memory_bytes: 128
//Love and Freedom.
#include<cstdio>
#include<cmath>
#include<algorithm>
#include<cstring>
#define ll long long
#define inf 20021225
using namespace std;

int main()
{
	int k,a,b;
	scanf("%d%d%d",&k,&a,&b);
	if(b-a<=2)
	{
		printf("%d\n",k+1);
		return 0;
	}
	else
	{
		if(a-1>=k)	printf("%d\n",k+1);
		else	printf("%lld\n",(ll)a+(ll)(k-a+1)/2*(ll)(b-a)+((k-a+1)&1));
	}
	return 0;
}


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

int main() {
    string s;
    cin >> s;
    int ans=0;
    if(s[1]=='R'){
        if(s[0]=='R' && s[2]=='R') cout << 3 << endl;
        else if(s[0]=='R' || s[2]=='R') cout << 2 << endl;
        else cout << 1 << endl;
    }
    else{
        if(s[0]=='R' || s[2]=='R') cout << 1 << endl;
        else cout << 0 << endl;
    }

    return 0;
}

Measured memory_bytes: 3592
#include<bits/stdc++.h>
using namespace std;
typedef complex<double> P;
typedef pair<P,P> L;

const double EPS = 1e-7;

double dot(P a, P b){ return real(conj(a)*b); }
double cross(P a, P b){ return imag(conj(a)*b); }

int ccw(P a, P b, P c){
  b -= a;
  c -= a;
  if(cross(b,c) > EPS) return 1;
  if(cross(b,c) < -EPS) return -1;
  if(dot(b,c) < -EPS) return 2;
  if(norm(b) < norm(c)) return -2;
  return 0;
}

P proj(P p, L l){
    return l.first + dot(p - l.first, l.second - l.first) / norm(l.second - l.first) * (l.second - l.first);
}

P reflect(P p, L l){
  return p + (proj(p,l) - p) * 2.0;
}

bool isIntersect(L s1, L s2){
  return ( ccw(s1.first,s1.second,s2.first) * ccw(s1.first,s1.second,s2.second) <= 0 &&
           ccw(s2.first,s2.second,s1.first) * ccw(s2.first,s2.second,s1.second) <= 0 );
}

P crossPoint(L l, L m){
  double A = cross(l.second - l.first, m.second - m.first);
  double B = cross(l.second - l.first, l.second - m.first);
  if(fabs(A) < EPS && fabs(B) < EPS) return m.first;
  else if(fabs(A) >= EPS) return m.first + B / A * (m.second - m.first);
}

L refL(L a,L b){
  return L(reflect(a.first,b),reflect(a.second,b));
}

int n;
L m[5];
int dm[5];
P g,s;
double ans;

double check(int d){
  vector<L> gm[8];
  L tp[5],tm[5];
  P gg=g;
  
  for(int i=0;i<n;i++)tp[i]=m[i];
  bool ff=0;
  if(d==2&&dm[0]==1&&dm[1]==0)ff=1;
  for(int i=0;i<d;i++){

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

      if(dm[i]==j) tm[i]=tp[j];
      else if(!i||dm[i-1]!=j)gm[i].push_back(tp[j]);

    }

    for(int j=0;j<n;j++)tp[j]=refL(tp[j],tm[i]);
    gg=reflect(gg,tm[i]);
  }
 
  for(int i=0;i<n;i++)
    if(!d||dm[d-1]!=i)gm[d].push_back(tp[i]);

  L sg=L(s,gg);
  double res=abs(s-gg);

  vector<P> v;

  v.push_back(s);
  for(int i=0;i<d;i++){
    if(!isIntersect(sg,tm[i]))res=1e9;
    v.push_back(crossPoint(sg,tm[i]));
  }
  
  v.push_back(gg);
  double dd=0;
  for(int i=0;i<=d;i++){
    L ww=L(v[i],v[i+1]);
    dd+=abs(v[i]-v[i+1]);
    for(int j=0;j<(int)gm[i].size();j++)
      if(isIntersect(ww,gm[i][j]))res=1e9;
  }
  if(abs(dd-res)>EPS)res=1e9;
  return res;
}

void dfs(int pr,int d){
  ans=min(ans,check(d));
  if(d==5)return;
  for(int i=0;i<n;i++){
    if(pr==i)continue;
    dm[d]=i;
    dfs(i,d+1);
  }
}

int main(){
  while(cin>>n,n){
    double x1,y1,x2,y2;
    for(int i=0;i<n;i++){
      cin>>x1>>y1>>x2>>y2;
      m[i]=L(P(x1,y1),P(x2,y2));
    }
    cin>>x1>>y1>>x2>>y2;
    g=P(x1,y1),s=P(x2,y2);
    ans=1e9;
    dfs(-1,0);
    printf("%f\n",ans);
  }
  return 0;
}

Measured memory_bytes: 3224
#include <stdio.h>

int main(void) {
	int num;
	double w, h, bmi;
	while(scanf("%d,%lf,%lf",&num,&w,&h) != EOF){
		bmi = w/h/h;
		if(bmi>=25.0)printf("%d\n",num);
	}
	
	return 0;
}

Measured memory_bytes: 628
stdin.ReadLine()
|> fun x -> x.Split(' ')
|> Array.map int
|> fun x -> (x.[0], x.[1], x.[2], x.[3], x.[4])
|> fun (a, b, c, x, y) ->
  [
    a * x + b * y
    (
      if x > y
      then a * (x - y) + c * 2 * y
      else b * (y - x) + c * 2 * x
    )
    c * 2 * (max x y)
  ]
  |> Seq.min
|> printfn "%d"


Measured memory_bytes: 14160