akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <vector>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <algorithm>
#include <iomanip>
#include <numeric>
#include <queue>
#include <cmath>
using namespace std;

int main() {
	int a, b, c;
	cin >> a >> b >> c;
	cout << 9 * max(a, max(b, c)) + a + b + c << endl;
}


Measured memory_bytes: 3596
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <cmath>
using namespace std;
using ll = long long;

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

    string s;
    cin >> s;

    int r = 0;
    for (int j = 1; j < n; j++) {
        int p[256] = {};
        for (int i = 0; i < j; i++) {
            p[s[i]] |= 1;
        }
        for (int i = j; i < n; i++) {
            p[s[i]] |= 2;
        }
        int x = 0;
        for (int k = 0; k < 256; k++) {
            if (p[k] == 3) x++;
        }
        r = max(r, x);
    }

    cout << r << endl;

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll= long long;
using vi = vector<int>;
using vl= vector<ll>;
using vs=vector<string>;

ll gcd(ll a, ll b) { if (a == 0) return b; return gcd(b % a, a);}
ll max(ll a, ll b) {if (a > b) return a; else return b;}
ll min(ll a, ll b) {if (a < b) return a; else return b;}
ll power(ll a,ll b) {ll i,p=1; for(i=0;i<b;i++){p*=a;} return p;}
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int testcase=1;
    //cin>>testcase;
    for(int p=0;p<testcase;p++){
        ll a=0,b=0;
        cin>>a>>b;
        bool k=false;

	float c=a*12.5;
	float d=b*10;
	ll h=(int)min(c,d);
        //ll array[1010]={0};
        for(int i=h;i<1010;i++){
            if((floor(i*0.08))==a &&(floor(i*0.1)==b))
            {
                cout<<i;
                k=true;
                break;
            }
        }
        if(k==false)
        cout<<"-1";
        
        
        
        
        }

    return 0;
}


Measured memory_bytes: 3628
#include <iostream>
#include <iomanip>
#include <sstream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>
#include <climits>
#include <cfloat>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <bitset>
#include <algorithm>
#include <functional>
#include <utility>
#include <numeric>

using namespace std;

typedef unsigned int UI;
typedef long long LL;
typedef unsigned long long ULL;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int,int> PII;
typedef istringstream ISS;
typedef ostringstream OSS;

#define REP( i, m, n ) for ( int i = (int)( m ); i < (int)( n ); ++i )
#define EACH( v, c ) for ( auto &v : c )

#define ITER( c ) __typeof( (c).begin() )
#define IREP( c, it ) for ( ITER(c) it = c.begin(); it != c.end(); ++it )
#define ALL( c ) (c).begin(), (c).end()

#define PB( n ) push_back( n )
#define MP( a, b ) make_pair( ( a ), ( b ) )
#define EXIST( c, e ) ( (c).find( e ) != (c).end() )

#define fst first
#define snd second

#define DUMP( x ) cerr << #x << " = " << ( x ) << endl
#define DEBUG( x ) cerr << __FILE__ << ":" << __LINE__ << ": " << #x << " = " << ( x ) << endl

typedef vector< ULL > VLL;
typedef vector< VLL > VVLL;

int solve( vector< vector<bool> > days )
{
	const int N = days.size();

	VVLL dp( 32, VLL( N ) );

	REP( i, 0, N )
	{
		dp[0][i] = 1LL << i;
	}

	REP( d, 0, 31 )
	{
		REP( i, 0, N )
		{
			if ( dp[d][i] == ( 1LL << N ) - 1 )
			{
				return d;
			}
			
			ULL next = dp[d][i];

			REP( j, 0, N )
			{
				if ( !days[i][d] || !days[j][d] )
				{
					continue;
				}

				next |= dp[d][j];
			}

			dp[ d + 1 ][i] = next;
		}
	}

	return -1;
}

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

	while ( true )
	{
		int n;
		cin >> n;

		if ( !n )
		{
			break;
		}

		vector< vector<bool> > days( n, vector<bool>( 31, false ) );

		REP( i, 0, n )
		{
			int f;
			cin >> f;

			REP( j, 0, f )
			{
				int d;
				cin >> d;

				days[i][ d - 1 ] = true;
			}
		}

		cout << solve( days ) << endl;
	}

	return 0;
}

Measured memory_bytes: 1248
import sys
from collections import *
import heapq
import math
import bisect
from itertools import permutations,accumulate,combinations,product
from fractions import gcd
def input():
    return sys.stdin.readline()[:-1]
def ruiseki(lst):
    return [0]+list(accumulate(lst))
mod=pow(10,9)+7
al=[chr(ord('a') + i) for i in range(26)]

n,m=map(int,input().split())

tmp=n*(n-1)//2
tmp2=m*(m-1)//2
print(tmp+tmp2)

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

#define fio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define watch(x) cout << (#x) << " is " << (x) << endl
#define f(t) for(ll i =0;i<t;i++)
#define bs(a,x) binary_search(a.begin(),a.end(),x)
#define ll long long int
#define ul unsigned long int
#define ld long double
#define umpi unordered_map<int,int> 
#define umpl unordered_map<ll,ll> 
#define vi vector<int>
#define vl vector<ll>
#define fill(a,p) memset(a,p,sizeof(a))
#define pb push_back
#define mod 1000000007
#define N 200005
#define all(a) a.begin(),a.end()
#define point pair<ll,ll>
#define endl "\n"

const int inf = 1000000007;
const ll linf = 1ll * inf * inf;
const ll MAXIMUM =2005;

inline ll mul(ll a, ll b){ return (a * 1ll * b) % mod; }
inline ll sub(ll a, ll b){ ll c = a - b; if(c < 0) c += mod; return c; }
inline ll add(ll a, ll b){ ll c = a + b; if(c >= mod) c -= mod; return c; }
inline ll max(ll a, ll b){return a>b?a:b;}
inline ll minim(ll a, ll b){return a<b?a:b;}

struct hash_pair { 
    template <class T1, class T2> 
    size_t operator()(const pair<T1, T2>& p) const
    { 
        auto hash1 = hash<T1>{}(p.first); 
        auto hash2 = hash<T2>{}(p.second); 
        return hash1 ^ hash2; 
    } 
};

ll power(ll x, ll y,ll p) 
{ 
    ll res = 1;      
     x = x % p;    
    while (y > 0) 
    { 
        if (y & 1) 
            res = (res*x) % p; 
            y = y>>1;  
            x = (x*x) % p;   
    } 
    return res; 
}

ll modInverse(ll n,ll p) 
{ 
    return power(n, p-2, p); 
} 


ll lcm(ll a,ll b){
  return (a*b)/__gcd(a,b);
}

bool comp(const point &p1,const point &p2){
	if(p1.first!=p2.first)return p1.first<p2.first;
	else return p1.second<p2.second;
}

int main()
{
	fio;
	ll n;cin>>n;
	vector<vl> a(n,vl(3));
	f(n){
		cin>>a[i][0]>>a[i][1]>>a[i][2];
	}
	vector<vector<ll>> dp(n,vector<ll>(3,0));
	dp[0][0]=a[0][0],dp[0][1]=a[0][1],dp[0][2]=a[0][2];
	for(ll i=1;i<n;i++){
		for(ll j=0;j<3;j++){
			for(ll k=0;k<3;k++){
				if(j!=k){
					dp[i][k]=max(dp[i][k],a[i][k]+dp[i-1][j]);
				}
			}
		}
	}
	cout<<max({dp[n-1][0],dp[n-1][1],dp[n-1][2]})<<"\n";
}

Measured memory_bytes: 11136
//all possible//
#include<bits/stdc++.h>
using namespace std;
int main()
{
	string a,b,c,n;
	int i,j;
	char e,f,g,h;
	cin>>a>>b>>c;
	for(i=0;i<a.size();i++)
	{
		e=a[a.size()-1];

	}
	for(i=0;i<b.size();i++)
	{
		f=b[0];
		g=b[b.size()-1];
	}
	for(i=0;i<c.size();i++)
	{
		h=c[0];
	}
    if(e==f && g==h)
    cout<<"YES";
    else
    cout<<"NO";
    
}


Measured memory_bytes: 256
N,X,D=map(int,input().split())
r=N*(X!=0)+1
if D:
 f,c,r={},[0]*abs(D),0
 for x,y,z in sorted(((N-k)*k*j+~-k*k//2+k*X//D,j,k*X%D)for k in range(N+1) for j in[0,1]):
  if c[z]<2*y:
   r+=x-f[z]+1
  if c[z]+y<1:
   f[z]=x
  c[z]-=2*y-1
print(r)

Measured memory_bytes: 887772
#include <iostream>
#include <string>
#include <stack>
#include <utility>
#include <algorithm>

using namespace std;

void decode(string& str, int a, int b)
{
  str[a - 1] = (str[a - 1] + b - a - 0x61) % 26 + 0x61;
  str[b - 1] = (str[b - 1] + b - a - 0x61) % 26 + 0x61;

  swap(str[a - 1], str[b - 1]);
}

int main()
{
  int N;
  stack<pair<int, int> > st;
  
  while (1) {
    cin >> N;
    if (N == 0) break;

    string message;
    cin.ignore();
    cin >> message;
    
    while (N--) {
      pair<int, int> tmp;
      cin >> tmp.first >> tmp.second;
      st.push(tmp);
    }

    while(!st.empty()) {
      decode(message, st.top().first, st.top().second);
      st.pop();
    }

    cout << message << endl;
  }
}



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

using namespace std;

using ll = long long;
using ull = unsigned long long;
template<class T> using v = vector<T>;
template<class T, class U> using p = pair<T, U>;

#define REP(i, n) for(ll i = 0; i < n; ++i)
#define REP3(i, B, E) for(ll i = B; i <= E; ++i)

template<class T> T read() { T x{}; cin >> x; return x; }
template<class T> v<T> read(int N){ v<T> x(N); REP(i, N) cin >> x[i]; return x; }

template<class T>
void write(const T &x){ cout << x << endl; }
void write(double x){ printf("%.15f\n", x); }

template<class T> T& chmin(T &obj, T val){ return obj = min(obj, val); }
template<class T> T& chmax(T &obj, T val){ return obj = max(obj, val); }

// 二分探索 : [low, high) の範囲で述語 pred がtrue を返す最大の値を返す
template<class Pred>
ll bsearch(ll low, ll high, Pred pred){
    while(low + 1 < high){
        const ll mid = low + (high - low) / 2;
        if(pred(mid)){ low = mid; }
        else{ high = mid; }
    }
    return low;
}

const ll NMax = 100000 + 3;
v<v<ll>> graph(NMax);
v<bool> vis(NMax);
v<map<ll, ll>> color(NMax);

void dfs(ll node, ll col){
    vis[node] = true;
    
    ll c = 1;
    for(auto& n : graph[node]){
        if(vis[n]) continue;
        if(c == col) ++c;
        color[node][n] = color[n][node] = c;
        dfs(n, c); 
        ++c;
    }
}


int main() {
    
    auto N = read<ll>();
    v<p<ll, ll>> edge(NMax);
    REP(i, N-1){
        ll a = read<ll>();
        ll b = read<ll>();
        edge[i] = {a, b};
        graph[a].push_back(b);
        graph[b].push_back(a);
    }
    
    ll K = 0;
    for(auto& v: graph){ chmax(K, (ll)v.size()); }
    
    dfs(1, 0);
    
    write(K);
    REP(i, N-1){
        auto& e = edge[i];
        write(color[e.first][e.second]);
    }
}



Measured memory_bytes: 25216
#include <iostream>
#include <string>
#include <vector>
#include <deque>
#include <queue>
#include <algorithm>
#include <set>
#include <map>
#define vv(a, b, c, d) vector<vector<d> >(a, vector<d>(b, c))
#define vvi std::vector<std::vector<int> >
#define vvl std::vector<std::vector<ll> >
#define MODs 1000000007;
typedef long long int ll;
using namespace std;

////////////////////////////////
#define N_MAX 2000000
typedef long long int ll;
int P;
ll fac[N_MAX+1];
ll inv[N_MAX+1];
ll finv[N_MAX+1];

ll comb(ll n, ll k){
    return (((fac[n]*finv[n-k])%P)*finv[k])%P;
}

void init(){
    fac[0] = finv[0] = fac[1] = finv[1] = inv[1] = 1;
    for(int i = 2; i <= N_MAX; i++){
        fac[i] = (fac[i-1]*i)%P;
        inv[i] = ((-(P/i)*inv[P%i])%P+P)%P;
        finv[i] = (finv[i-1]*inv[i])%P;
    }
}
ll pmul(ll a, ll b){
  return (a * b)%P;
}
ll padd(ll a, ll b){
  return (a + b)%P;
}
ll psub(ll a, ll b){
  if(a - b < 0) return a - b + P;
  else return a - b;
}
ll pdiv(ll a, ll b){
  return (a*inv[b])%P;
}
//////////////////////////////////////
int main(int argc, char const *argv[]) {
  std::cin >> P;
  init();
  std::vector<ll> A(P);
  std::vector<ll> ans(P, 0), pmod(P);
  for(int i=0;i<P;i++) std::cin >> A[i];

  for(int i=0;i<P;i++){
    if(A[i]==1){
      std::vector<ll> Imod(P);
      for(int j=0;j<P;j++) Imod[j] = (j==0?1:pmul(Imod[j-1], i));
      ans[0] = padd(ans[0], 1);
      for(int j=0;j<P;j++){
        if(j%2==1) ans[P-1-j]= padd(ans[P-1-j], pmul(comb(P-1, j), Imod[j]));
        if(j%2==0) ans[P-1-j]= psub(ans[P-1-j], pmul(comb(P-1, j), Imod[j]));
      }
    }
  }
  for(int i=0;i<P;i++) std::cout << ans[i] << (i==P-1?"\n":" ");
  return 0;
}


Measured memory_bytes: 47232
import sys
n = int(input())
a = sorted(list(map(int, input().split())))
for i in range(n):
  if a[i] != (2 * ((i + 2 - n % 2) // 2) + n % 2 - 1):
    print(0)
    sys.exit()
print(pow(2, n // 2, 1000000007))


Measured memory_bytes: 13880
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>

int main(void)
{
long N, M;
  
  scanf("%ld %ld", &N, &M);
  if (N == M) {
    printf("Yes\n");
  } else {
    printf("No\n");
  }

  return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
#define rep(i, n, m) for (int i = (int)(n); i < (int)(m); i++)
#define repr(i, n, m) for (int i = (int)(n) - 1; i >= (int)(m); i--)
using namespace std;
using ll = int64_t;
const int MOD = 1000000007; // 10^9+7

int main() {
    int n, m;
    cin >> n >> m;
    vector<vector<int>> g(n);
    rep(i, 0, m) {
        int a, b;
        cin >> a >> b;
        g[a - 1].push_back(b - 1);
        g[b - 1].push_back(a - 1);
    }

    vector<int> ans(n, -1);
    queue<int> q;
    q.push(0);
    vector<bool> seen(n, false);
    seen[0] = true;

    while (!q.empty()) {
        int p = q.front();
        q.pop();
        for (auto &&i : g[p])
        {
            if (seen[i]) continue;
            q.push(i);
            ans[i] = p;
            seen[i] = true;
        }
    }

    cout << "Yes" << endl;
    for (int i = 1; i < n; i++)
    {
        cout << ans[i] + 1 << endl;
    }

}


Measured memory_bytes: 10116
#include <stdio.h>
#include <set>
#include<string.h>
#include <algorithm>
using namespace std;
#define N 100009
char a[N];
int len, b[N][2], nm, loc[N];
int change(char c) {
	return c == 'L' ? 1 : 2;
}
int main() {
	scanf("%s", &a);
	len = strlen(a);
	b[0][0] = change(a[0]), b[0][1] = 1;
	nm = 0;
	for (int i = 1; i < len; ++i) {
		int cc = change(a[i]);
		if (cc == b[nm][0]) {
			++b[nm][1];
		}
		else {
			++nm;
			b[nm][0] = cc, b[nm][1] = 1;
		}
	}
	int st = 0, ed = nm, numb = 0;
	if (b[0][0] == change('L')) {
		//b[0][1]개가 왼쪽, 즉 0번 위치에 갈 것이다.
		loc[0] = b[0][1];
		st = 1;
		numb = loc[0];
	}
	if (b[nm][0] == change('R')) {
		loc[len - 1] = b[nm][1];
		ed--;
	}
	//st부터 ed까지
	//'R'에서 시작해서 L까지
	for (int i = st; i <= ed; i += 2) {
		loc[numb + b[i][1] - 1] += ((b[i][1] + 1) / 2);
		loc[numb + b[i][1]] += ((b[i][1]) / 2);
		loc[numb + b[i][1] - 1] += ((b[i + 1][1]) / 2);
		loc[numb + b[i][1]] += ((b[i + 1][1] + 1) / 2);
		numb += (b[i][1] + b[i + 1][1]);
	}
	for (int i = 0; i < len; i++) {
		printf("%d ", loc[i]);
	}
}

Measured memory_bytes: 1664
#include <iostream>
#include <algorithm>
#include <cmath>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)

int main(void)
{
    int a[5000], n, ans, sum;
    
    while(true)
    {
        cin >> n;
        if(n == 0) break;
        rep(i,n)
            cin >> a[i];
        
        ans = a[0];
        rep(i,n)
        {
            sum = 0;
            for(int j=i; j<n; j++)
            {
                sum += a[j];
                ans = max(ans, sum);
            }
        }
        cout << ans << endl;
    }
    
    return 0;
}

Measured memory_bytes: 1176
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#define mod 1000000007
#define INF 1000000000000000000
typedef long long ll;
int main(){
    ll n,h;cin>>n>>h;
    vector<ll>b(n);
    ll ma=0;
    ll x,y;
    rep(i,n){
        cin>>x>>y;ma=max(ma,x);b[i]=y;
    }
    sort(b.begin(),b.end(),greater<ll>());
    int co=0;
    for(int i=0;i<n;i++){
        if(b[i]<=ma)break;
        co=i+1;
        h-=b[i];
        if(h<=0)break;
    }
    if(h<=0)cout<<co;
    else cout<<co+(h+ma-1)/ma;
}

Measured memory_bytes: 1024
#include <iostream>
#include <string>

using namespace std;

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

    int counter = 0;
    if (S[0] == 'R')
    {
        counter = 1;
    }
    else if (S[1] == 'R')
    {
        counter = 1;
    }
    else if (S[2] == 'R')
    {
        counter = 1;
    }

    char pre = S[0];
    for (int i = 1; i < 3; i++)
    {
        if ((S[i] == 'R') && (pre == 'R'))
        {
            counter++;
        }
        pre = S[i];
    }
    cout << counter << "\n";
}


Measured memory_bytes: 3196
#include<bits/stdc++.h>
using namespace std;
#define int long long
int n;
int vis[100005]={0};
vector<int> grph[100005];
vector<int> graph[100005];
int mo=1000000007;
int dp[100005];
int dp_parent[100005];
int soln[100005];
void dfs(int a,int p)
{
    if(vis[a]==0)
    {
        vis[a]=1;
        dp[a]=1;
        for(auto &k:grph[a])
        {
            if(k!=p)
            {
                graph[a].push_back(k);
                dfs(k,a);
                dp[a]=(dp[a]*(dp[k]+1))%mo;
            }
        }
    }
}

void dfs2(int a)
{
   // cout<<a<<" ";
    int prf[graph[a].size() + 3];
    int suff[graph[a].size() + 3];
    prf[0]=1;
    suff[graph[a].size() +1]= 1;
    for(int i=1;i<=graph[a].size();i++)
        prf[i]=(prf[i-1]*(dp[graph[a][i-1]]+1))%mo;
    for(int i=graph[a].size();i>=1;i--)
    {
        suff[i]=(suff[i+1]*(dp[graph[a][i-1]]+1))%mo;
        dp_parent[graph[a][i-1]]=(prf[i-1] * suff[i+1])%mo;
        //cout<<dp_parent[graph[a][i-1]]<<" "<<prf[i-1]<<" "<<suff[i+1]<<"\n";
        if(a!=1)
            dp_parent[graph[a][i-1]]=(dp_parent[graph[a][i-1]]*(dp_parent[a]+1))%mo;
        //cout<<graph[a][i-1]<<" "<<dp_parent[graph[a][i-1]]<<"\n";
    }
    if(a!=1)
    {
        soln[a]=1;
        for(auto &k:graph[a])
            soln[a]=(soln[a]*(dp[k]+1))%mo;
        soln[a]=(soln[a]*(dp_parent[a]+1))%mo;
    }
    for(auto &k:graph[a])
        dfs2(k);
}


int32_t main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    cin>>n>>mo;
    for(int i=0;i<(n-1);i++)
    {
        int x,y;
        cin>>x>>y;
        grph[x].push_back(y);
        grph[y].push_back(x);
    }
    dfs(1,0);
    soln[1]=dp[1];
    //cout<<dp[1];
    dfs2(1);
    for(int i=1;i<=n;i++)
        cout<<soln[i]<<"\n";
   /* pair<int,int> temp=dfs(1,0);
    soln[1][0]=dp[1].first;
    soln[1][1]=dp[1].second;
    dfs2(1,0);
    for(int i=1;i<=n;i++)
        cout<<soln[i][0]<<"\n";*/
}


Measured memory_bytes: 27780
fn getline() -> String{
	let mut __ret=String::new();
	std::io::stdin().read_line(&mut __ret).ok();
	return __ret;
}

fn main() {
    let line = getline();
    let mut a=0;
    let mut b=0;
    for c in line.chars() {
        if c  == '\r' || c == '\n' {
            break;
        }
        if c == '0'{
            a+=1;
        }else{
            b+=1;
        }
    }
    println!("{}", std::cmp::min(a,b)*2);
}

Measured memory_bytes: 4352
#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;
template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
 
#define int         long long
#define pb          push_back
#define pii         pair<int,int>
#define vi          vector<int>
#define vii         vector<pii>
#define mi          map<int,int>
#define mii         map<pii,int>
#define all(a)      (a).begin(),(a).end()
#define x           first
#define y           second
#define sz(x)       (int)x.size()
#define endl        '\n'
#define sd(t)       scanf("%d",&(t))
#define rep(i,a,b)  for(int i=a;i<b;i++)
#define hii         cout << "hii" << endl
#define okay        cout << "okay" << endl
#define hey         cout << "hey" << endl
const int INF = 1e12;
const int MOD = 1e9+7;
 
template <class T> ostream& operator << (ostream &os, const vector<T> &v) { for (T i : v) os << i << ' '; return os; }
template <class T> ostream& operator << (ostream &os, const set<T> &v) { for (T i : v) os << i << ' '; return os; }
template <class T, class S> ostream& operator << (ostream &os, const pair<T, S> &v) { os << v.x << ' ' << v.y; return os; }
template <class T, class S> ostream& operator << (ostream &os, const unordered_map<T, S> &v) { for (auto i : v) os << '(' << i.x << "=>" << i.y << ')' << ' '; return os; } 
 
 
#ifndef ONLINE_JUDGE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
    template <class Arg1> void __f(const char* name, Arg1&& arg1) { cerr << name << " : " << arg1 << endl; }
    template <class Arg1, class... Args>
    void __f(const char* names, Arg1&& arg1, Args&&... args) {
        const char* sep = strchr(names + 1, ',');
        cerr.write(names, sep - names) << " : " << arg1 << "  ";
        __f(sep + 1, args...);
    }
#else
#define trace(...) 
#pragma GCC optimize ("O3")
#pragma GCC optimize ("unroll-loops")
#pragma GCC target("avx2,sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#define _CRT_SECURE_NO_WARNINGS
#endif // ifndef ONLINE_JUDGE
 
clock_t time_p=clock();
void starboy1299()
{
    time_p=clock()-time_p;
    cerr<<"Time Taken : "<<(float)(time_p)/CLOCKS_PER_SEC<<"\n";
}
 
void fast()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    #ifndef ONLINE_JUDGE
        freopen("input.txt", "r", stdin);
        freopen("jjj.txt", "w", stdout);
    #endif
}

const int N = 5e5+5;
int arr[N];

void solve(){

    int k;
    cin >> k;
    int curr = 0;
    for(int i = 1; i <= 5000000; i++)
    {
        curr = curr * 10 + 7;
        curr %= k;
        if(curr == 0)
        {
            cout << i << endl;
            return;
        }
    }
    cout << -1 << endl;

}         

int32_t main(){
    fast();
    int t = 1;
    // cin>> t;
    for(int i=1; i<=t; i++){
        // cout << "Case #" << i << ": ";
        solve();
    }
    starboy1299();
}

Measured memory_bytes: 3780
#include<bits/stdc++.h>
#define REP(i,n) for(int i = 0; i < (n); ++i)
using namespace std;
typedef long long int ll;
const ll MOD = 1000000007;

int main() {
  string s;
  cin >> s;
  vector<char> vc;
  REP(i, s.length()) {
    if (s[i] == 'B') {
      if (vc.size() > 0) {
        vc.pop_back();
      }
    } else {
      vc.push_back(s[i]);
    }
  }
  REP(i, vc.size()) cout << vc[i];
  cout << endl;
  return 0;
}

Measured memory_bytes: 256
if __name__ == '__main__':
	n,x = map(int, input().split())
	while n + x != 0:
		num = list(range(1,n+1))
		c = 0
		for i in range(n):
			for j in range(i+1,n):
				for k in range(j+1,n):
					if num[i]+num[j]+num[k] == x:
						c += 1
		print(c)
		n,x = map(int, input().split())


Measured memory_bytes: 5596
import java.util.Scanner;

public class Main
{
    public static void main(String[] args) 
    {
        Scanner scanner = new Scanner(System.in);
        
        int W = scanner.nextInt();
        int H = scanner.nextInt();
        int x = scanner.nextInt();
        int y = scanner.nextInt();
        int r = scanner.nextInt();
     
//        if (x+r<=W && x+r<=H && y+r<-W && y+r<=H) { 
//           
//        }
        if (x+r>W || x+r>H || y+r>W || y+r>H || 0>x-r || 0>y-r ) {
            System.out.println("No") ; 
        } else { 
             System.out.println("Yes");
        }
      
        return;
    }
}


Measured memory_bytes: 26244
using System;
using System.Text;
using System.Linq;
using System.Collections;
using System.Collections.Generic;
using static System.Console;
using static System.Math;

namespace AtCoder
{
    public class Program
    {
        public static void Main(string[] args)
        {
            new Program().Solve(new ConsoleInput(Console.In, ' '));

            return;
        }

        public void Solve(ConsoleInput cin)
        {

            var A = cin.ReadLong;
            var B = cin.ReadLong;

            var ApB = A + B;
            var AmB = A - B;
            var AkB = A * B;

            var Ans = Max(ApB, Max(AmB, AkB));
            Console.WriteLine(Ans);

        }
    }

    public static class Extensions
    {
        public static string Reverse(this string sourse)
        {
            char[] chrAry = sourse.ToCharArray();
            Array.Reverse(chrAry);
            return new string(chrAry);
        }
    }

    public class ConsoleInput
    {
        private readonly System.IO.TextReader _stream;
        private char _separator = ' ';
        private Queue<string> inputStream;
        public ConsoleInput(System.IO.TextReader stream, char separator = ' ')
        {
            this._separator = separator;
            this._stream = stream;
            inputStream = new Queue<string>();
        }
        public string Read
        {
            get
            {
                if (inputStream.Count != 0) return inputStream.Dequeue();
                string[] tmp = _stream.ReadLine().Split(_separator);
                for (int i = 0; i < tmp.Length; ++i)
                    inputStream.Enqueue(tmp[i]);
                return inputStream.Dequeue();
            }
        }
        public string ReadLine { get { return _stream.ReadLine(); } }
        public int ReadInt { get { return int.Parse(Read); } }
        public long ReadLong { get { return long.Parse(Read); } }
        public double ReadDouble { get { return double.Parse(Read); } }
        public string[] ReadStrArray(long N) { var ret = new string[N]; for (long i = 0; i < N; ++i) ret[i] = Read; return ret; }
        public int[] ReadIntArray(long N) { var ret = new int[N]; for (long i = 0; i < N; ++i) ret[i] = ReadInt; return ret; }
        public long[] ReadLongArray(long N) { var ret = new long[N]; for (long i = 0; i < N; ++i) ret[i] = ReadLong; return ret; }
    }
}


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

using namespace std;

int main(int argc, const char * argv[]) {
    int A;
    int B;
    cin >> A;
    cin >> B;
    
    int ans = max(A,B);
    if (A == B) {
        ans = ans * 2;
    } else {
        ans = ans * 2 - 1;
    }
    
    cout << ans;
    
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;


using namespace std;

#define debug(x) cout << '>' << #x << ':' << x << endl;
#define loop(i,n) for(int i=0;i<(int)(n);i++)
#define foi(i,k,n) for(int i=(k); i<(int)(n); i+=1)
#define fod(i,n,k) for(int i=k; i>=(int)n; i-=1)
#define fast_io ios_base::sync_with_stdio(false) , cin.tie(NULL);
#define all(x) x.begin(), x.end()
#define tr(it, a) for(auto it = a.begin(); it != a.end(); it++)
#define endl "\n"

#define int long long
#define INF 0x3f3f3f3f
#define PI 3.1415926535897932384626433832795
#define MOD 1000000007

#define fir first
#define sec second
#define pb push_back
#define mp make_pair

typedef long long llint;
typedef pair<int, int> PII;
typedef vector<int> VI;
typedef vector<llint> VL;
typedef vector<string> VS;
typedef vector<PII> VII;
typedef vector<VI> VVI;
typedef map<int,int> MII;
typedef set<int> SI;
string tostr(int n) {stringstream rr;rr<<n;return rr.str();}
llint toint(string s) {stringstream ss(s); llint x; ss >> x; return x;}
//typedef tree<int, null_type, less_equal<int>, rb_tree_tag, tree_order_statistics_node_update> indexed_set;
//gp_hash_table<string, llint> table;


//int mpow(llint base, llint exp) {
  //base %= MOD;
  //llint result = 1;
  //while (exp > 0) {
    //if (exp & 1) result = ((llint)result * base) % MOD;
    //base = ((llint)base * base) % MOD;
    //exp >>= 1;
  //}
  //return result;
//}


//void makegraph(int n, int m){
	//int i, u, v;
	//while(m--){
		//cin>>u>>v;
		//u--, v--;
		//g[u].pb(v);
		//g[v].pb(u);
	//}
//}

//void dfs(int u, int par){
	//for(int v:g[u]){
		//if (v == par) continue;
		//dfs(v, u);
	//}
//}


// ------------------------------------------------------------------ILB----------------------------------------------------------------  //

int n;
string s;

//int fun(int idx, int rc, int wc, bool w){
	//if(idx == n){
		//return 0;
	//}
	//int ans = INF;
	//if(w) ans = min(ans, (s[idx] == 'R') + fun(idx + 1, rc, wc + 1, 1));
	//if(w && s[idx] == 'R') ans = min(ans, 1 + fun(idx + 1, rc + 1, wc, 1));
	//if(!w) ans = min(ans, fun(idx + 1, rc + (s[idx] == 'R'), wc + (s[idx] == 'W'), (s[idx] == 'W')));
	//if(!w && s[idx] == 'W') ans = min(ans, 1 + fun(idx + 1, rc + 1, wc, 0));
	//return ans;
//}


void solve(){
	cin >> n >> s;
 
	int white = count(all(s), 'W');
	int right = count(all(s), 'R');
	int ans = min(white, right);
	int r = right, w = 0;
 
	loop(i,n){
		if(s[i] == 'W') w++;
		else r--;
		int subans = max(w, r);
		ans = min(subans, ans);
	}
	cout << ans << endl;
}




int32_t main() {
	fast_io;
    int t = 1;
    //cin >> t;
    //int xx = 0
    while(t--) {
		//xx++;
		//cout << "Case ";
      solve();
    }
    return 0;
}



Measured memory_bytes: 3740
#include "iostream"
using namespace std;
 
int main(){
 
  long long X; 
  long long ans=0;
  long long m=100;
  
  cin >> X;
  
  while(1){
    
    ans++;
    m *= 1.01;
    
    if(X <= m){
      cout << ans;
      break;
    }
 
  }
  return 0;
}

Measured memory_bytes: 3636
import sys
 
if sys.platform =='ios':
    sys.stdin=open('input_file.txt')
 
 
H,A=map(int,input().split())

l=list(map(int,input().split()))

li=sorted(l)

for _ in range(min(H,A)):
	li.pop()
	
print(sum(li))

Measured memory_bytes: 25768
// Author : Hardik Upadhyay
// college: SVNIT 
// slogan : Ab to phod dunga
#include<bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp>
#define F first
#define S second
#define pb push_back
#define mp make_pair
#define rep(i,a,b) for(int i=a;i<=b;i++)
#define rrep(i,a,b) for(int i = a ; i >= b; i--)
#define debug(x) cout << '>' << #x << ':' << x << endl;
#define sq(a) (a)*(a)
#define nl "\n"
using namespace std;
//using namespace __gnu_pbds;
//typedef tree<int,null_type,less<int>,rb_tree_tag,
//tree_order_statistics_node_update> indexed_set;
typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> ii;
typedef vector<ii> vii;
const int MAXN = 100005;
ll mod=1000000007;

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	int k,a,b;
	cin>>k>>a>>b;
	if((a%k)){
		if( (a/k + 1)*k <= b){
			cout<<"OK"<<nl;
		}
		else{
			cout<<"NG"<<nl;
		}
	}
	else {
			cout<<"OK"<<nl;
	}
	return 0;
}



Measured memory_bytes: 3648
#include<bits/stdc++.h>
#define rep(m,x,r) for((m)=(x);(m)<(r);(m)++)
#define ll long long
using namespace std;
int main(){
    ll n,i,buf=0,sum=0;
    cin>>n;
    ll a[n],ans[n];
    rep(i,0,n){
        cin>>a[i];
        sum+=a[i];
        if(i>0&&i%2==1)buf+=a[i];
    }
    ans[0]=sum-2*buf;
    rep(i,1,n)ans[i]=2*a[i-1]-ans[i-1];
    rep(i,0,n)cout<<ans[i]<<" ";
    cout<<"\n";
}

Measured memory_bytes: 2816
#include<stdio.h>

int main(void){
	char str[1050];
	int i;
	scanf("%[^\n]",str);
	while(str[i]!='\0'){
		if(str[i]=='a'&&str[i+1]=='p'&&str[i+2]=='p'&&str[i+3]=='l'&&str[i+4]=='e'){
			printf("peach");i=i+5;
		}
		else if(str[i]=='p'&&str[i+1]=='e'&&str[i+2]=='a'&&str[i+3]=='c'&&str[i+4]=='h'){
			printf("apple");i=i+5;
		}
		else {printf("%c",str[i++]);}
	}
	printf("\n");
	return 0;
}

Measured memory_bytes: 524
N,A,B = map(int,input().split())
S = input()

FOR = 1
CNT = 0
for i,s in enumerate(list(S)):
    if s=="a" and CNT < A+B:
        print("Yes")
        CNT+=1
    elif s=="b" and CNT < A+B and FOR <=B:
        print("Yes")
        CNT+=1
        FOR+=1
    else:
        print("No")

Measured memory_bytes: 4784
from bisect import bisect_left,bisect
import math

N, K = map(int, input().split())
A = list(map(int, input().split()))
A.sort()

m = 0
M = max(A) + 1

while M - m > 1:
  temp = (M + m) // 2
  L = bisect(A, temp)
  cnt = 0
  for i in range(L, N):
    p, q = divmod(A[i], temp)
    if q == 0:
      cnt += p-1
    else:
      cnt += p
  if cnt > K:
    m = temp
  else:
    M = temp

print(M)

Measured memory_bytes: 94028
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <vector>

using namespace std;
#define PB push_back
#define MP make_pair
#define REP(i,n) for(int i=0;i<(n);i++)
int main(){
    int a,b,c;
    cin>>a>>b>>c;
    cout<<min(a+b,min(b+c,c+a))<<endl;
}

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

using namespace std;

using ll = long long;
using P = pair<ll, ll>;
using Graph = vector<vector<ll>>;
#define rep(i, n) for(ll i=0;i<(ll)(n);i++)
#define rep2(i, m, n) for(ll i=m;i<(ll)(n);i++)
#define rrep(i, n, m) for(ll i=n;i>=(ll)(m);i--)
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
const int ddx[8] = {0, 1, 1, 1, 0, -1, -1, -1};
const int ddy[8] = {1, 1, 0, -1, -1, -1, 0, 1};
const ll MOD = 1000000007;
const ll INF = 1000000000000000000L;
#ifdef __DEBUG

/**
 * For DEBUG
 * https://github.com/ta7uw/cpp-pyprint
 */
#include "cpp-pyprint/pyprint.h"

#endif

void Main() {
    int N; cin >> N; cout << 2 * N / __gcd(2, N) << endl;
}

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    Main();
    return 0;
}


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

int main() {
  int n;

  cin >> n;

  vector<int> p(n);

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

  for (int k = 1; k < n; k++) {
    if (p[k - 1] > p[k]) break;
    if (k == n - 1) {
      cout << "YES";
      return 0;
    }
  }

  for (int i = 0; i < n; i++) {
    for (int j = i + 1; j < n; j++) {
      int tmp = p[i];
      p[i] = p[j];
      p[j] = tmp;
      for (int k = 1; k < n; k++) {
        if (p[k - 1] > p[k]) break;
        if (k == n - 1) {
          cout << "YES";
          return 0;
        }
      }
      tmp = p[i];
      p[i] = p[j];
      p[j] = tmp;
    }
  }

  cout << "NO";

  return 0;
}


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

int main()
{
  string s;
  cin >> s;
  
  if ((s.at(2) == s.at(3)) && (s.at(4) == s.at(5))) cout << "Yes" << endl;
  else cout << "No" << endl;
  
  return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<map>
#include<set>
#include<string>
#include<algorithm>
#include<cmath>
#include<vector>
#include<queue>
#include<stack>
#include<limits>
#include<sstream> 
#include<unordered_map>      

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef int itn;

const int inf = numeric_limits<int>::max() >> 2;
const ll linf = numeric_limits<ll>::max() >> 2;
const ull ulinf = numeric_limits<ull>::max() >> 2;
const double pi = acos(-1);
const int dx[4]={1,0,-1,0};
const int dy[4]={0,1,0,-1};
const int dx8[8]={-1,0,1,-1,1,-1,0,1};
const int dy8[8]={-1,-1,-1,0,0,1,1,1};

#define p_queue(i) priority_queue<i> 
#define rp_queue(i) priority_queue<i, vector<i>, greater<i>> 
#define umap(i,j) unordered_map<i,j>
#define P(p) cout<<(p)<<endl
#define PS(p) cout<<(p)<< " "
#define PN cout << endl
#define rep(i,m,n) for(int i = (m); i < (int)(n); i++)
#define rrep(i,m,n) for(int i = (n-1); i >= (int)(m); i--)
#define inrep(n,a) for(int i = 0; i < (int)(n); i++)cin >> a[i];
#define mod(i) ((i)%(ll)(1e9 + 7))
#define divm(a,b) (mod(a * modpow((ll)b,(ll)(1e9+5))))
#define rsort(a,b,c) sort(a, b, greater<c>())
#define vsort(v) sort(v.begin(), v.end())
#define rvsort(v,c) sort(v.begin(), v.end(), greater<c>()) 
#define ft first
#define sd second
#define pb push_back
#define it insert
#define sz(x) ((int)(x).size())
#define lb(a,n,k) (lower_bound(a,a+n,k) - (a)) 
#define vlb(a,k)  (lower_bound(a.begin(),a.end(),k) - a.begin())
#define ub(a,n,k) (upper_bound(a,a+n,k) - (a)) 
#define vub(a,k)  (upper_bound(a.begin(),a.end(),k) - a.begin())
#define YES cout<<"YES"<< endl
#define NO cout<<"NO"<<endl
#define Yes cout<<"Yes"<<endl
#define No cout<<"No"<<endl  
#define yes cout<<"yes"<<endl
#define no cout<<"no"<<endl
#define ret return

/*
ll modpow(ll i,ll j){ ll tmp=1; while(j){ if(j%2)tmp=mod(tmp*i);i=mod(i*i);j/=2;}return tmp;}
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }
*/

/*
vector<string> split(const string &str, char sep){
    vector<string> v;
    stringstream ss(str);
    string buffer;
    while( getline(ss, buffer, sep) ) {
        v.push_back(buffer);
    }
    return v;
}
*/

/*
ll ncr[100][100];
ll nCr(int n, int r){if(n==r) ret ncr[n][r] = 1; if(r==0) ret ncr[n][r] = 1; if(r==1) ret ncr[n][r] = n;if(ncr[n][r]) ret ncr[n][r]; ret ncr[n][r] = nCr(n-1,r) + nCr(n-1,r-1);}

ll npr[100][100]={};
ll nPr(int n,int r){if(npr[n][r])ret npr[n][r];if(r==0)ret npr[n][r] = 1;if(r==1)ret npr[n][r] = n;ret npr[n][r] = n * nPr(n-1,r-1);}

ll nHr(int n,int r){ret nCr(n+r-1,r);}
*/

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



int main(){

    int a,b;
    cin >> a >> b;
    rep(i,1,4){
	if(i != a && i != b)P(i);

    }
    return  0;
}


Measured memory_bytes: 256
n = int(input())

def isprime(p):
  if p < 2:
    return False
  for i in range(2, p):
    if p % i == 0:
      return False
  return True

sol = []

for i in range(3, 55555+1, 10):
  if isprime(i):
    sol.append(i)
  if len(sol) >= n:
    break
print(*sol)

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

int main(){
  int H,W; cin>>H>>W;
  int h,w; cin>>h>>w;
  int white=H*W;
  int black=white-h*W-w*H+h*w;
  cout<<black<<endl;
  return 0;
}

Measured memory_bytes: 256
using System;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Text.RegularExpressions;
using System.Text;

namespace Fish.aizu
{
	public static class AizuOnlineJudge
	{
		public static int[] SplitToInts(string line)
		{
			return line.Split(' ').Select(x => int.Parse(x)).ToArray();
		}
		public static double[] SplitToDoubles(string line)
		{
			return line.Split(' ').Select(x => double.Parse(x)).ToArray();
		}
		public static long[] SplitToLongs(string line)
		{
			return line.Split(' ').Select(x => long.Parse(x)).ToArray();
		}
		public static int Main()
		{
			Compute(Console.In, Console.Out);
			return 0;
		}
		
		public static void Compute(TextReader reader, TextWriter writer)
		{
			var line = reader.ReadLine();
			var stringBuilder = new StringBuilder(1200);
			foreach (var c in line)
			{
				char cc = default(char);
				if (char.IsLower(c))
				{
					cc = char.ToUpper(c);
				}
				else 
				{
					cc = char.ToLower(c);
				}
				stringBuilder.Append(cc);
			}
			writer.WriteLine(stringBuilder.ToString());
		}
	}
}

Measured memory_bytes: 19964
#include <stdio.h>
#include <string.h>
 
    int h[24] = {0};
    int s1[128] = {0};
    int s2[128] = {0};
    int count1[24] = {0};
    int count[24]={0};
    int m,n;
    int i,j,k=0;
    int tmp;
    int people;
 
void change(int x,int y){
    tmp=x;
    x=y;
    y=tmp;
    
}
int judge(int x,int y){
    if(h[x]<h[y]){
        return (true);
    }
    else 
        return (false);
}
 
 
int main(){
    
    
    scanf("%d\n",&m);
    scanf("%d\n",&n);
    people = m;
    for(i=1;i<=n;i++){
        scanf("%d %d\n",&s1[i],&s2[i]);
    }
    
    for(i=1;i<=n;i++){
        tmp=s2[i];
        count[tmp]++;
    }
    do{
        for(i=1;i<=m;i++){
            if(count[i]==0){
                h[++k]=i;
                //printf("i=%d h[%d]=%d",i,i,h[i]);
                count[i]--;
                people--;
            }
        }
        for(i=1;i<=n;i++){
            for(j=1;j<=m;j++){
                
                if(count[j]==-1&&s1[i]==j){
                    tmp=s2[i];
                    count[tmp]--;
                    count1[j]=-1;
                }
            }
        
        }
        for(i=1;i<=m;i++){
            if(count1[i]==-1){
                count[i]=-2;
            }
        }
    }while(people!=0);
    
    for (i=1;i<=m;i++){
        printf("%d\n",h[i]);
    }
    return 0;
}

Measured memory_bytes: 1028
def hanntenn(n):
    if n=="0":
        return "1"
    else:
        return "0"
    
s = input()
lists = list(s)
ans1 = 0
ans2 = 0
flag = "1"
for ob in lists:
    if ob == flag:
        flag = hanntenn(flag)
        continue
    else:
        flag = hanntenn(flag)
        ans1 += 1
flag = "0"
for ob in lists:
    if ob == flag:
        flag = hanntenn(flag)
        continue
    else:
        flag = hanntenn(flag)
        ans2 += 1
print(min(ans1,ans2))

Measured memory_bytes: 3956
package main

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

const qA, qB, qC = 200, 300, 500
const pA, pB, pC = 380, 550, 850
const dA, dB, dC = 5, 4, 3

func main() {
	stdin := bufio.NewScanner(os.Stdin)
	for stdin.Scan() {
		q, _ := strconv.Atoi(stdin.Text())
		if q == 0 {
			break
		}

		// A 0袋から始める
		curPrice, newPrice := 0, 0
		// B
		for a := 0; a <= int(q/qA); a++ {
			for b := 0; b <= int((q-qA*a)/qB); b++ {
				// 残り
				rem := q - qA*a - qB*b
				if rem == 0 || ((rem > 0) && ((rem % qC) == 0)) {
					// ちょうど買える
					newPrice = amount(a, b, int(rem/qC))
					if curPrice == 0 || newPrice < curPrice {
						// println(a, b, int(rem/qC), newPrice)
						curPrice = newPrice
					}
				}
			}
		}
		fmt.Println(curPrice)
	}
}

func amount(a, b, c int) int {
	tA := int(float64(int(a/dA)*dA*pA)*0.8) + (a%dA)*pA
	tB := int(float64(int(b/dB)*dB*pB)*0.85) + (b%dB)*pB
	tC := int(float64(int(c/dC)*dC*pC)*0.88) + (c%dC)*pC
	// println("amount:", a, b, c, tA, tB, tC, tA+tB+tC)
	return tA + tB + tC
}



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

#define ff first
#define ss second
#define pb push_back
#define sz size()
#define mp make_pair
#ifndef ONLINE_JUDGE 
#include "/home/asif/Codes/Library/debug.h"
#endif
/*--------------------------------------------------------------------*/

const int N = 2e5 + 5;
const int MOD = 998244353;

namespace nCr {
  ll factorial[N], invFactorial[N];
  ll ncr(ll n, ll r){
    return (( (factorial[n] * invFactorial[r]) % MOD) * invFactorial[n - r]) % MOD;
  }
  void init(){
    invFactorial[1] = 1;
    for(int i = 2;i < N;i++)invFactorial[i] = MOD - (MOD / i) * invFactorial[MOD % i] % MOD;
    factorial[0] = factorial[1] = invFactorial[0] = 1;
    for(int i = 2; i < N; i++){
      factorial[i] = (factorial[i - 1] * i) % MOD;
      invFactorial[i] = (invFactorial[i - 1] * invFactorial[i]) % MOD;
    }
  }
}

ll bigmod(ll a, ll p){
  if(p == 0) return 1LL;
  ll ret = bigmod(a, p / 2);
  ret *= ret;
  ret %= MOD;
  if(p & 1) ret = (ret * a) % MOD;
  return ret;

}

int main() {

  ll n, m, k;
  cin >> n >> m >> k; 

  nCr::init();

  ll ans = 0LL;
  for(int i = 0; i <= k; i++){
    ans += (((nCr::ncr(n - 1, i) * bigmod(m - 1, n - i - 1)) % MOD) * m) % MOD;
    ans %= MOD;
  }
  cout << ans << endl;

  return 0;
}

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


using namespace std;

int a[55];

main(){
    int n;

    scanf("%d" , &n);

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

    double ans = a[0];
    for(int i = 1 ; i < n ; i ++){
        ans = (ans + 1.0*a[i]) / 2.0;
    }

    printf("%.9f\n" , ans);

    return 0;
}


Measured memory_bytes: 256
// This amazing code is by Eric Sunli Chen.
#include <algorithm>
#include <bitset>
#include <cmath>
#include <cstring>
#include <cstdio>
#include <cstdlib>
#include <ctime>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <utility>
#include <vector>
using namespace std;
template<typename T> void get_int(T &x)
{
	char t=getchar();
	bool neg=false;
	x=0;
	for(; (t>'9'||t<'0')&&t!='-'; t=getchar());
	if(t=='-')neg=true,t=getchar();
	for(; t<='9'&&t>='0'; t=getchar())x=x*10+t-'0';
	if(neg)x=-x;
}
template<typename T> void print_int(T x)
{
	if(x<0)putchar('-'),x=-x;
	short a[20]= {},sz=0;
	while(x>0)a[sz++]=x%10,x/=10;
	if(sz==0)putchar('0');
	for(int i=sz-1; i>=0; i--)putchar('0'+a[i]);
}
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define get1(a) get_int(a)
#define get2(a,b) get1(a),get1(b)
#define get3(a,b,c) get1(a),get2(b,c)
#define printendl(a) print_int(a),puts("")
typedef long long LL;
typedef unsigned long long uLL;
typedef pair<int,int> pii;
const int inf=0x3f3f3f3f;
const LL Linf=1ll<<61;
const double pi=acos(-1.0);

vector<int> g[100111];
bool done[100111][14];
int n,m,q,d[100111],v[100111],c[100111],mk[100111],dist[100111],ans[100111],que[100111],cur[100111];

int main()
{
	get2(n,m);
	for(int i=1,u,vv;i<=m;i++)
	{
		get2(u,vv);
		g[u].pb(vv);
		g[vv].pb(u);
	}
	get1(q);
	for(int i=1;i<=q;i++)get3(v[i],d[i],c[i]);
	
	memset(cur,-1,sizeof(cur));
	for(int i=q;i>=1;i--)
	{
		int&u=v[i],rr=1;mk[u]=i;dist[u]=d[i];que[0]=u;
		for(int fr=0,v;fr<rr;fr++)
		{
			v=que[fr];
			if(cur[v]>=dist[v])continue;
			cur[v]=dist[v];
			if(ans[v]==0)ans[v]=c[i];
			if(dist[v]==0)continue;
			
			for(int j=0;j<(int)g[v].size();j++)
				if(mk[g[v][j]]!=i)
				{
					mk[g[v][j]]=i;
					dist[g[v][j]]=dist[v]-1;
					que[rr++]=g[v][j];
				}
		}
	}
	for(int i=1;i<=n;i++)printendl(ans[i]);
	return 0;
}

Measured memory_bytes: 11000
n, m = map(int, input().split())
bs = [-1]
for i in range(m):
    bs.append(int(input()))
bs.append(n + 1)

cs = []
for i in range(m + 1):
    c = bs[i+1] - bs[i] - 2
    if (c < 0):
        print(0)
        exit()
    cs.append(bs[i+1] - bs[i] - 2)
mc = max(cs)

ds = [1, 1, 2]
for i in range(mc + 1):
    if i < 3:
        continue
    ds.append(ds[i-1] + ds[i-2])

r = 1
for c in cs:
    r *= ds[c]

print(r % 1000000007)

Measured memory_bytes: 460020
// finish date: 2018/01/21
#include <iostream>
#include <cmath>
#include <vector>
#include <bitset>
#include <algorithm>
#include <stack>
#include <map>
#include <climits>

using namespace std;

#define FOR(i, a, b) for(int (i)=a;(i)<(b);(i)++)
#define rep(i, n)  FOR(i,0,n)
#define ll long long
#define bigmod 1000000007
#define INF 500000000


int main() {
    int a,b;
    cin>>a>>b;
    if((a*b)%2==0) cout<<"Even"<<endl;
    else cout<<"Odd"<<endl;

    return 0;
}


Measured memory_bytes: 764
#include <iostream>
#include <vector>
 
int main(void) {
    u_int N;	// the number of integer
    std::vector<std::vector<u_long>> dp;
    std::vector<u_int> seq;
    
    std::cin >> N;
    seq.reserve(N);
    dp.resize(N);
    for (u_int i = 0; i < N; ++i) {
        u_int tmp;
        std::cin >> tmp;
        seq.push_back(tmp);
        dp[i].resize(21, 0);
    }
    
    // solve by dp
    dp[0][seq[0]] = 1;  // initialization
    for (u_int i = 1; i < N - 1; ++i) {
        for (u_int j = 0; j < 21; ++j) {
            if (dp[i - 1][j] > 0) {
                if (j + seq[i] <= 20) {
                    dp[i][j + seq[i]] += dp[i - 1][j];
                }
                if (j >= seq[i]) {
                    dp[i][j - seq[i]] += dp[i  -1][j];
                }
            }
        }
    }
    std::cout << dp[N - 2][seq[N - 1]] << std::endl;
 
    return 0;
}

Measured memory_bytes: 1208
#include <vector>
#include <list>
#include <map>
#include <set>
#include <stack>
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <cmath>
#include <string>

using namespace std;

//using
using VI = vector<int>;
using VVI = vector<VI>;
using VS = vector<string>;
using PII = pair<int, int>;
using LL = long long;

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

//constant
const int INF = 1 << 29;
const double EPS = 1e-10;
const double PI = acos(-1.0);

//debug
#define dump(x)  cout << #x << " = " << (x) << endl;

int main() {
  string S;
  string dream = "dream";
  string dreamer = "dreamer";
  string erase = "erase";
  string eraser = "eraser";
  cin >> S;
  reverse(S.begin(), S.end());
  int n = S.length();
  int i = 0;
  while(!S.empty()) {
    bool flag=false;
    if(S.substr(0,5)=="maerd"){
      flag=true;
      S.erase(0,5);
    }else if(S.substr(0,7)=="remaerd"){
      flag=true;
      S.erase(0,7);
    }else if(S.substr(0,5)=="esare"){
      flag=true;
      S.erase(0,5);
    }else if(S.substr(0,6)=="resare"){
      flag=true;
      S.erase(0,6);
    }
    if(!flag) break;
  }
  if(S.empty()) cout << "YES";
  else  cout << "NO";
  cout << endl;
  return 0;
}

Measured memory_bytes: 512
using System;
using System.Linq;//リストの使用
using System.Collections.Generic;
using System.Text;//テキストの高速出力に必要
class Program
{
	static void Main()
	{
		string[] input = Console.ReadLine().Split(' ');//Splitで区切り文字を指定して複数個受け取る。
		long n = long.Parse(input[0]);
		long p = long.Parse(input[1]);
    long pp = p;
		long answer = 1;
    long plusCount = 0;

    for(int i = 2; i <= 1000000; i++)
    {
      plusCount = 0;
      while(true)
      {
        if(p % i == 0)
        {
          p /= i;
          plusCount++;
          if(plusCount == n)
          {
            answer *= i;
            plusCount = 0;
          }
        }else break;
      }
    }

    if(n == 1) answer = pp;
    
		Console.WriteLine(answer);
	}
}

Measured memory_bytes: 11092
def main():
    # 下、右、上、左
    dy = [1, 0, -1, 0]
    dx = [0, 1, 0, -1]
    H, W = map(int, input().split())
    s = ["." * (W + 2)]
    s += ["." + input() + "." for i in range(H)]
    s.append("." * (W + 2))
    for y in range(1, H + 1):
        for x in range(1, W + 1):
            if s[y][x] == "#" and s[y + dy[0]][x + dx[0]] == "."\
                    and s[y + dy[1]][x + dx[1]] == "."\
                    and s[y + dy[2]][x + dx[2]] == "."\
                    and s[y + dy[3]][x + dx[3]] == ".":
                print("No")
                return
    print("Yes")
    return


main()


Measured memory_bytes: 3064