akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <map>
#include <vector>
#include <cmath>
#include <string>
#include <cstring>
#include <algorithm>
#include <climits>
#include <stack>
#include <queue>
#include <set>
#include <cctype>
#include <bitset>
#include <type_traits>

#include <list>
using namespace std;

#define REP(i, n) for (int i = 0; i < (n); ++i)
#define rep(i, a, b) for (int i = a; i < (b); ++i)
#define YES(j) cout << (j ? "YES" : "NO") << endl;
#define Yes(j) std::cout << (j ? "Yes" : "No") << endl;
#define yes(j) std::cout << (j ? "yes" : "no") << endl;

int main(void)
{
    int n, k;
    cin >> n >> k;
    int a[n];
    int l, r, mi;
    mi = 1e9;
    REP(i, n)
    {
        cin >> a[i];
        if (mi > a[i])
        {
            mi = a[i];
            l = i;
            r = n - i - 1;
        }
    }
    int lc = l / (k - 1);
    int lest = l - lc * (k - 1);
    int ans;
    if (lest == 0)
    {
        ans = lc;
    }
    else
    {
        r -= (k - 1) - lest;
        ans = lc + 1;
    }

    if (r <= 0)
    {
        cout << ans << endl;
    }
    else
    {
        //(a + b - 1) / b
        int rc = (r + k - 1 - 1) / (k - 1);
        ans += rc;
        cout << ans << endl;
    }
}

Measured memory_bytes: 640
from itertools import combinations

n = int(input())
yes = [i*(i-1)//2 for i in range(2, 448)]
if n in yes:
    print('Yes')
    len_s = yes.index(n) + 1
    print(len_s+1)
    res = [[] for _ in range(len_s+1)]
    for i, v in enumerate(combinations(range(len_s+1), 2)):
        res[v[0]].append(str(i+1))
        res[v[1]].append(str(i+1))
    for r in res:
        print(' '.join([str(len_s)] + r))        
else:
    print('No')

Measured memory_bytes: 17140
#A
N,A,B = map(int,input().split())
if (B-A)%2 == 0:
    print((B-A)//2)
else:
    right = N-B
    left = A-1
    
    ans1 = right+1+(N-(A+right+1))//2
    ans2 = left+1+(B-left-2)//2
    
    print(min(ans1,ans2))
    

Measured memory_bytes: 2940
N, K = [int(_) for _ in input().split()]
TD = [[int(_) for _ in input().split()] for i in range(N)]

# print(TD)

xs = sorted(TD, key=lambda x:-x[1])

#print(xs)

baset = 0
ts = set([])
ds = []

for t, d in xs[:K]:
    baset += d
    if not t in ts:
        ts.add(t)
    else:
        ds.append(d)

result = baset + len(ts) ** 2
r = result

#print(r, ts, ds)

for t, d in xs[K:]:
    if not ds:
        break
    if not t in ts:
        r += 2 * len(ts) + 1
        r += d - ds.pop()
        ts.add(t)
        result = max(result, r)
        #print(r, ts, ds)

#print(r, ts, ds)

print(result)


Measured memory_bytes: 26880
def abc135c():
    n = int(input())
    a = list(map(int, input().split()))
    b = list(map(int, input().split()))
    ans = 0
    for i in range(n):
        v = min(b[i], a[i])
        ans += v
        b[i] -= v
        vv = min(a[i+1], b[i])
        a[i+1] -= vv
        ans += vv
    print(ans)
abc135c()

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

int main()
{
	int array[4] = { 0, 0, 0, 0 };

	string S, T;
	cin >> S >> T;

	int diff = 0;
	for (unsigned int i = 0; i < S.length(); i++)
	{
		if (S[i] != T[i])
		{
			diff++;
		}
	}

	cout << diff << endl;

	return 0;
}

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

int main(){
  int n, m;
  cin >> n >> m;
  unsigned long long ans = 0;

  if(n==1){
    if(m==1){
      ans = 1;
    }
    else if(m==2){
      ans = 0;
    }
    else{
      ans = m-2;
    }
  }
  else if(n==2){
    if(m==1){
      ans = 0;
    }
    else if(m==2){
      ans = 0;
    }
    else{
      ans = 0;
    }
  }
  else{
    if(m==1){
      ans = n-2;
    }
    else if(m==2){
      ans = 0;
    }
    else{
      ans = (unsigned long long)(n-2)*(m-2);
    }
  }

  cout << ans << endl;

  return 0;
}


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

#define loop(s, e, i) for (int i = s; i < e; ++i)
#define print(s) cout << s << endl;
#define DIV 1000000007
#define ll long long
using namespace std;

/*
浮動小数点の入力
cout << fixed << setprecision(9) << endl;
*/

ll bsearch_a(vector<ll> &v, ll key) {
  int left = -1;
  int right = v.size();

  while(right - left > 1) {
    int mid = left + (right - left)/2;
    if (v[mid] >= key) right = mid;
    else left = mid;
  }
  return right;
}

ll bsearch_c(vector<ll> &v, ll key) {
  int left = -1;
  int right = v.size();

  while(right - left > 1) {
    int mid = left + (right - left)/2;
    if (v[mid] > key) right = mid;
    else left = mid;
  }
  return right;
}

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

  int N;
  cin >> N;
  vector<ll> A(N);
  vector<ll> B(N);
  vector<ll> C(N);
  loop(0, N, i) cin >> A[i];
  loop(0, N, i) cin >> B[i];
  loop(0, N, i) cin >> C[i];
  sort(A.begin(), A.end());
  sort(B.begin(), B.end());
  sort(C.begin(), C.end());

  ll total = 0;
  loop(0, N, i) {
    ll bi = B[i];
    ll a = bsearch_a(A, B[i]);
    ll c = bsearch_c(C, B[i]);
    if (a < 0) a = 0;
    total += a * (N-c);
  }
  print(total);
}


Measured memory_bytes: 5456
#include<bits/stdc++.h>
#define N 200000
using namespace std;
typedef long long LL;
pair<int,int> x[N+1];
int ans[N+1];
int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);

	int n; cin >> n;
	for(int i = 0; i < n; i++)
	{
		int a; cin >> a;
		x[i] = {a,i};
	}
	sort(x,x+n);

	for(int i = 0; i < n/2; i++)
		ans[x[i].second] = x[n/2].first;
	for(int i = n/2; i < n; i++)
		ans[x[i].second] = x[n/2-1].first;

	for(int i = 0; i < n; i++)
		cout<<ans[i]<<endl;
	
	return 0;
}

Measured memory_bytes: 4608
#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 ll  long long
#define PI  acos(-1)
#define pb  push_back
#define ins insert
#define INF 1000000000000000007 //1e18+7
#define mk  make_pair
#define lb(v,x) lower_bound(all(v),x)
#define ub(v,x)  upper_bound(all(v),x)
#define ff  first
#define ss  second
#define rev reverse
#define endl "\n"
#define max3(x,y,z)  max(x,max(y,z))
#define min3(x,y,z)  min(x,min(y,z))
#define sz(a) (ll)a.size()
#define double long double
#define minpq  priority_queue <ll,vector<ll>,greater<ll> > 
#define coud(a,b) cout<<fixed << setprecision((b)) << (a)
#define mset(x,y)  memset(x,y,sizeof(x))
#define all(x)   (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define bp(n)  __builtin_popcountll(n)
#define mxt(a)  *(max_element(a.begin(),a.end()))
#define mnt(a)  *(min_element(a.begin(),a.end()))
#define unique_sort(c) (sort(all(c)), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define rep(i,a,b) for(ll i=(a);i<=(b);++i)
#define trav(a, x) 	  for(auto &a : x)
#define re(i,n)       for(ll i=0;i<n;++i) 
#define int2Bin(x,y)  bitset <y> z=x; cout<<z.to_string()<<endl;
const double eps=1e-7;
const string alpha = "abcdefghijklmnopqrstuvwxyz";
// int dx[8]={+1, +1, +1, 0, 0, -1, -1, -1};
// int dy[8]={+1, 0, -1, +1, -1, +1, 0, -1};
int dx[]={0,0,1,-1};
int dy[]={1,-1,0,0};
ll power(ll x,ll y){ll res=1;x=x;while(y>0){if(y&1)res=(res*x);y=y>>1;x=(x*x);}return res;}
ll sqr(ll x) { return x * x;}
template <typename T> T gcd(T a,T b){ if(a==0) return b; return gcd(b%a,a); }
template <class T> inline void chmax(T &x,T y){ x = max((x), (y));}
template <class T> inline void chmin(T &x,T y){ x = min((x), (y));}
template <class T> T abs(T x) { return x>0 ? x : -x;}
template <typename T> T powm(T a,T b, ll m){T cnt=1; while(b>0){ if(b%2==1) cnt=(cnt*a)%m; b/=2; a=(a*a)%m; }return cnt%m;}
typedef pair<int,int>  pii;
typedef pair<ll,ll>  pll;
typedef vector<pll>  vpii;
typedef vector<ll>   vll;
typedef vector<int>  vii;
///template <typename T> using orderset = tree <T, null_type, less<T>, rb_tree_tag,tree_order_statistics_node_update>;
///*X.find_by_order(k) //returns the kth largest element.(0-based)
///X.order_of_key(val) //returns the no. of values less than val.
ll ncr(ll n,ll r){ll res=1;if(r>n)return 0;if(r>n-r)r=n-r;for(ll i=0;i<r;i++){res*=(n-i);res/=(i+1);}return res;}
const int MOD=1000000007;	
const int N=5005;
void prec(){
	
}
void run(){
	ll n,ans=0,m;cin>>n;
	vll a(n);
	m=n-2;
	trav(it,a) cin>>it;
	sort(all(a));
	rev(all(a));
	ans+=a[0];
	int i=1;
	while(m){
		if(m>=2) ans+=(a[i]*2),m-=2,i++;
		else if(m>=1) ans+=a[i],m-=1;
	}
	cout<<ans;
}						
int32_t main()
{
    cin.sync_with_stdio(0);cin.tie(0);
	cin.exceptions(cin.failbit);
    int tc=1;
    //cin>>tc;
    prec();
    re(i,tc)
    	run();
    return 0; 
}

Measured memory_bytes: 4744
D,G = map(int,input().split())
src = [tuple(map(int,input().split())) for i in range(D)]

ans = 10**20
for b in range(2**D):
    score = ac = 0
    for i in range(D):
        if b&(1<<i)==0: continue
        ac += src[i][0]
        score += src[i][1] + (i+1)*100*src[i][0]
    if score >= G:
        ans = min(ans,ac)
        continue
    i = D-1
    while i >= 0:
        if b&(1<<i):
            i -= 1
            continue
        p,c = src[i]
        n = (i+1)*100
        if score + (p-1)*n < G:
            score += (p-1)*n
            ac += p-1
        else:
            rem = G - score
            add = -(-rem//n)
            ac += add
            score += add*n
        if score >= G:
            break
        i -= 1
    else:
        continue
    if score >= G:
        ans = min(ans, ac)
print(ans)

Measured memory_bytes: 3064
//  @ /\/\ BESH //

#include <bits/stdc++.h>
#define inp_out_work ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define testCase    int T; cin>>T; while(T--)
#define fr(i,n) for(int i=0;i<n;i++)
#define fro(i,s,e) for(int i=s;i<=e;i++)
#define endl '\n'
#define debug(P) cout<<#P<<" = "<<P<<endl;
#define pb push_back
#define FILE freopen("in.txt","r",stdin); freopen("out.txt","w",stdout);

using namespace std;

typedef long long ll;
typedef long double ld;

const int MAXN = 100001;
const int mod = 1000000007;

const int SZ = 21;

ll dp[SZ][1<<SZ];

int main(){
    int n;
    cin>>n;
    int a[n][n];
    fr(i,n)fr(j,n)cin>>a[i][j];

    int LIM = 1<<n;

    fr(i,n)fr(j,LIM)dp[i][j] = 0;

    fr(j,n){
        if(a[0][j])dp[0][1<<j] = 1;
    }

    vector<int> spl[n];

    for(int mask = 1; mask < LIM; mask++){
        int cnt = 0;
        for(int j = 0; j < n; j++)if(mask&(1<<j))cnt++;
        spl[cnt-1].push_back(mask);
    }

    for(int i = 1; i < n; i++){
        for(int mask : spl[i]){
            for(int j = 0; j < n; j++){
                if((mask&(1<<j)) && a[i][j]){
                    dp[i][mask] = (dp[i][mask] + dp[i-1][mask^(1<<j)])%mod;
                }
            }
        }
    }

    cout<< dp[n-1][LIM-1] << endl;

}


Measured memory_bytes: 354240
k = int(input())
q = [1,2,3,4,5,6,7,8,9]
count = 0
if k <= 9:
    print(k)
else:
    while not count == k:
        count += 1
        x = q.pop(0)
        if x % 10 == 9:
            q.append(x * 10 + x % 10 -1)
            q.append(x * 10 + x % 10)
        elif x % 10 == 0:
            q.append(x * 10 + x % 10)
            q.append(x * 10 + x % 10 + 1)
        else:
            q.append(x * 10 + x % 10 - 1)
            q.append(x * 10 + x % 10)
            q.append(x * 10 + x % 10 + 1)
    print(x)

Measured memory_bytes: 18636
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for (int i = 0; i < n; i++)
using P = pair <int, 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; }
ll gcd(ll a,ll b) {return  b ? gcd(b,a%b) : a;}
const long long INF = 1LL << 60;
const int mod = 1000000007;
const double PI = acos(-1.0);
int dx[]={1,0,-1,0};
int dy[]={0,1,0,-1};


int main () {
     int n,m;
     cin >> n >> m;
     vector<int>d;
     for(int i = 1;i*i<=m;++i){
          if(m%i==0) {
               d.push_back(i);
               if(m/i!=i) d.push_back(m/i);
          }
     }
     sort(d.begin(),d.end());
     auto iter = upper_bound(d.begin(),d.end(),m/n)-d.begin();
     cout << d[iter-1] <<endl;

}

Measured memory_bytes: 3604
from collections import defaultdict, Counter
from heapq import heapify, heappop, heappush
from sys import stdin


def main():
    n = int(input())
    a = [int(x) for x in input().split()]
    if n % 2 == 0:
        if n == 2:
            print(max(a))
            return
        v = [[None for j in range(2)] for i in range(n)]
        v[0][0] = a[0]
        v[1][1] = a[1]
        for i in range(2, n):
            for j in range(2):
                c = []
                if v[i-2][j] is not None:
                    c.append(v[i-2][j])
                if j >= 1 and i >= 3:
                    if v[i-3][j-1] is not None:
                        c.append(v[i-3][j-1])
                if len(c) == 0:
                    continue
                v[i][j] = max(c) + a[i]
        c = [v[n-1][j] for j in range(2) if v[n-1][j] is not None]
        print(max(c))
    else:
        if n == 3:
            print(max(a))
            return
        v = [[None for j in range(3)] for i in range(n)]
        v[0][0] = a[0]
        v[1][1] = a[1]
        v[2][0] = a[0]+a[2]
        v[2][2] = a[2]
        for i in range(3, n):
            for j in range(3):
                c = []
                if v[i-2][j] is not None:
                    c.append(v[i-2][j])
                if j >= 1:
                    if v[i-3][j-1] is not None:
                        c.append(v[i-3][j-1])
                if j >= 2 and i >= 4:
                    if v[i-4][j-2] is not None:
                        c.append(v[i-4][j-2])
                if len(c) == 0:
                    continue
                v[i][j] = max(c) + a[i]
        c = [v[n-1][j] for j in range(1, 3) if v[n-1][j] is not None]
        print(max(c))


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


main()


Measured memory_bytes: 54188
import sys

n = int(input())

def main():
    for i in range(1, 3500):
        for j in range(1, 3500):
            z = 4 * i * j - n * i - n * j
            if z > 0:
                x = n * i * j / z
                if x == int(x):
                    print(i, j, int(x))
                    sys.exit()


main()


Measured memory_bytes: 39280
n,m=map(int,input().split())
G=[[0]*n for i in range(n)]
for i in range(m):
    a,b=map(int,input().split())
    G[a-1][b-1]=G[b-1][a-1]=1
V=[0]*n
c=0
def dfs(v):
    global c
    if sum(V)==n:
        c+=1
        return
    for v2 in range(n):
        if G[v][v2]==1 and V[v2]==0:
            V[v2]=1
            dfs(v2)
            V[v2]=0
    return
V[0]=1
dfs(0)
print(c)

Measured memory_bytes: 3064
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N=1200005,M=998244353;
int ne[N],tot,b[N],a[N],fac[N],fi[N],zz[N],sl[N],miu[N],cnt,flag[N],fa[N],f[N],g[N],n;
char s[N];
inline int ksm(int x,int y){
	int ans=1;
	for (;y;y>>=1,x=(ll)x*x%M)
		if (y&1)ans=((ll)ans*x)%M;
	return ans;	
}
inline void jb(int x,int y,int z){
	ne[++tot]=fi[x];
	fi[x]=tot;
	zz[tot]=y;
	sl[tot]=z;
}
inline void dfs(int x){
	flag[x]=1;
	for (int i=fi[x];i;i=ne[i])
		if (!flag[zz[i]]){
			flag[zz[i]]=1;
			a[zz[i]]=(a[x]+sl[i])%2;
			dfs(zz[i]);
		}
}
void init(){
	miu[1]=1;
	for (int i=2;i<N;i++){
		if (!flag[i]){
			b[++tot]=i;
			miu[i]=-1;
		}
		for (int j=1;j<=tot;j++){
			int k=b[j]*i;
			if (k>=N)break;
			flag[k]=1;
			if (i%b[j]==0){
				miu[k]=0;
				break;
			}
			miu[k]=-miu[i];
		}
	}
}
signed main(){
	init();fac[0]=1;
	scanf("%lld",&n);
	for (int i=1;i<=2*n;i++)fac[i]=fac[i-1]*2%M;
	scanf("%s",s);
	for (int i=n;i<2*n;i++)s[i]=s[i-n]^1;
	int kk=n,p=1;
	while (kk%2==0)p++,kk>>=1;
	for (int A=1;A<=2*n;A++)
		if (n%A!=0&&(2*n)%A==0){
			memset(fi,0,sizeof fi);
			memset(flag,0,sizeof flag);
			memset(a,0,sizeof a);
			tot=cnt=0;
			for (int i=0;i<2*n;i++)jb(i,(i+A)%(2*n),0),jb((i+A)%(2*n),i,0);
			for (int i=0;i<n;i++)jb(i,i+n,1),jb(i+n,i,1); 
			for (int i=0;i<2*n;i++)
				if (!flag[i]){
					dfs(i);
					cnt++;
				}
			memset(a,0,sizeof a);
			memset(flag,0,sizeof flag);	
			for (int i=0;i<2*n;i++){
				if (i==n){
					f[A>>p]++;
					break;
				}
				if (flag[i]&&a[i]>s[i]-'0')break;
				else if (flag[i]&&a[i]<s[i]-'0'){
					(f[A>>p]+=fac[cnt])%=M;
					break;
				}
				else if (flag[i])continue;
				cnt--;
				if (s[i]=='0'){
					a[i]=0;
					dfs(i);
				}
				else {
					(f[A>>p]+=fac[cnt])%=M;
					a[i]=1;
					dfs(i);
				} 
			}
		}
	n<<=1;n>>=p;	
	for (int i=1;i<=n;i++)
		if (f[i])for (int j=1;j*i<=n;j+=2)
			if ((2*n)%(i*j)==0)(g[i*j]+=(ll)miu[j]*f[i]%M)%=M;
	int ans=0;		
	for (int i=1;i<=n;i++)(ans+=(ll)g[i]*i%M)%=M;
	printf("%lld\n",(ll)ksm(2,p)*(ans+M)%M);			
	return 0;
}

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

using namespace std;

bool isPal(string &str) {
  int n = str.size();
  for (int i = 0; i < n; i++) {
    if (str[i] != str[n - i - 1]) return false;
  }
  return true;
}

int main() {
  string str;
  cin >> str;
  string x, y;
  int n = str.size();
  x = str.substr(0, ((n - 1) / 2));
  y = str.substr(((n + 3) / 2) - 1);
  //cout << x << ' ' << y << ' ' << isPal(str) << endl;
  if (isPal(str) && isPal(x) && isPal(y)) {
    cout << "Yes\n";
  }  
  else {
    cout << "No\n";
  }
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{
    ios_base::sync_with_stdio(false),cin.tie(NULL),cout.tie(NULL);

    int n;

    cin >> n;

    map <string, int> mp;
    map <string, int> :: iterator it;


    while(n--)
    {
        string s;

        cin >> s;

        mp[s]++;

    }

    int mx = INT_MIN;

    for(it=mp.begin(); it!=mp.end(); it++)
    {
        int z = (*it).second;

        mx = max(mx, z);
    }

    vector <string> v;

    for(it=mp.begin(); it!=mp.end(); it++)
    {
        if((*it).second == mx)
        {
            v.push_back((*it).first);
        }
    }

    sort(v.begin(), v.end());

    for(int i=0; i<v.size(); i++)
    {
        cout << v[i] << endl;
    }




}










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

using namespace std;

#define FOR(i,s,e) for(int i=(s);(i)<(int)(e);(i)++)
#define REP(i,e) FOR(i,0,e)
#define each(it,c) for(__typeof((c).begin()) it=(c).begin();it!=(c).end();it++)
#define all(o) (o).begin(), (o).end()
#define pb(x) push_back(x)
#define mp make_pair
#define mt make_tuple
#define t0(t) get<0>((t))
#define t1(t) get<1>((t))
#define t2(t) get<2>((t))

typedef long long ll;
const int N = 8;
int n, m;
int g[N][N];

int main() {
  fscanf(stdin, "%d%d ", &n, &m);
  REP(i,m) {
    int a, b;
    fscanf(stdin, "%d%d ", &a, &b);
    a--; b--;
    g[a][b] = g[b][a] = 1;
  }
  int res = 0;
  vector<int> p(n);
  REP(i,n) p[i] = i;
  do {
    if (p[0]) continue;
    int ok = 1;
    REP(i,n-1) if (!g[p[i]][p[i+1]]) ok = 0;
    if (ok) res++;
  } while (next_permutation(all(p)));
  fprintf(stdout, "%d\n", res);
  return 0;
}


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

using namespace std;

int main()
{
	int a,b,c;
	cin>>a;
	cin>>b;
	if ((a==1)&&(b==2))
	{
		c=3;
	}
		if ((a==2)&&(b==3))
	{
		c=1;
	}
		if ((a==1)&&(b==3))
	{
		c=2;
	}
		if ((a==3)&&(b==1))
	{
		c=2;
	}
		if ((a==2)&&(b==1))
	{
		c=3;
	}
		if ((a==3)&&(b==2))
	{
		c=1;
	}
	
	cout<<c;
	
	
	
	return 0;
}

Measured memory_bytes: 256
#!/usr/bin/env python3
import sys
sys.setrecursionlimit(10**8)
INF = float("inf")


def solve(K: int, S: str):
    if len(S) <= K:
        print(S)
    else:
        print(S[:K]+"...")
    return


def main():

    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    K = int(next(tokens))  # type: int
    S = next(tokens)  # type: str
    solve(K, S)


if __name__ == '__main__':
    main()


Measured memory_bytes: 9192
open System

[<AutoOpen>]
module Cin =
    let read f = stdin.ReadLine() |> f
    let reada f = stdin.ReadLine().Split() |> Array.map f

let isOk txy =
    let t,x,y = txy
    t % 2 = (x+y) % 2

let isOk2 txy cur =
    let t,x,y = txy
    let ct,cx,cy = cur
    let dt,dx,dy = t-ct |> abs, x-cx |> abs, y-cy |> abs
    dt >= dx + dy

[<EntryPoint>]
let main _ =
    let N = read int
    let txy = Array.zeroCreate (N+1)
    txy.[0] <- (0,0,0)
    for i in 1..N do
        let [|t;x;y|] = reada int
        txy.[i] <- (t,x,y)

    let mutable ans = true
    for i in 0..N-1 do
        if isOk txy.[i] |> not || isOk txy.[i+1] |> not || isOk2 txy.[i] txy.[i+1] |> not then
            ans <- false

    if ans then "Yes" else "No"
    |> printfn "%s"
    0


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

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

    long long int n, a, b, c, d, e;
    cin >> n >> a >> b >> c >> d >> e;
    
    long long int mn = min({a, b, c, d, e});
    
    if (mn >= n)
        cout << "5\n";
    else
        cout << n / mn + 5 + ((n % mn == 0) ? -1 : 0) << '\n';

    return 0;
}


Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#include<bits/stdc++.h>
#define INF         1e9
#define EPS         1e-9
#define REP(i,n)    for(lint i=0,i##_len=(n);i<i##_len;++i)
#define REP1(i,n)   for(lint i=1,i##_len=(n);i<=i##_len;++i)
#define REPR(i,n)   for(lint i=(n)-1;i>=0;--i)
#define REPR1(i,n)  for(lint i=(n);i>0;--i)
#define REPC(i,obj) for(auto i:obj)
#define R_UP(a,b)   (((a)+(b)-1)/(b))
#define ALL(obj)    (obj).begin(),(obj).end()
#define SETP        cout << fixed << setprecision(8)
using namespace std;
using lint = long long;
template<typename T = lint>inline T in() { T x; cin >> x; return x; }

signed main() {
	int n = in();
	vector<int>a(n);
	REP(i, n) {
		a[i] = in();
	}
	int m = in();
	vector<int>b(m);
	REP(i, m) {
		b[i] = in();
	}
	vector<int>result;
	set_difference(a.begin(), a.end(), b.begin(), b.end(), inserter(result, result.end()));
	REPC(i, result) {
		cout << i << endl;
	}
}


Measured memory_bytes: 5404
import math
from math import gcd,pi,sqrt
INF = float("inf")

import sys
sys.setrecursionlimit(10**6)
import itertools
from collections import Counter,deque
def i_input(): return int(input())
def i_map(): return map(int, input().split())
def i_list(): return list(i_map())
def i_row(N): return [i_input() for _ in range(N)]
def i_row_list(N): return [i_list() for _ in range(N)]
def s_input(): return input()
def s_map(): return input().split()
def s_list(): return list(s_map())
def s_row(N): return [s_input for _ in range(N)]
def s_row_str(N): return [s_list() for _ in range(N)]
def s_row_list(N): return [list(s_input()) for _ in range(N)]

def main():
    n = i_input()
    a = i_list()

    a.sort()

    l = []
    start = a[0]
    cnt = 1
    for i in a:
        if i == start:
            cnt += 1
        else:
            start = i
            cnt = 1
        if cnt == 2:
            l.append(i)
            cnt = 0
    if cnt == 2:
        l.append(i)
    if len(l) < 2:
        print(0)
    else:
        print(l[-1]*l[-2])



if __name__=="__main__":
    main()


Measured memory_bytes: 20680
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
const int INF = (1<<30);
const ll INFLL = (1ll<<60);
const ll MOD = (ll)(1e9+7);

#define l_ength size

void mul_mod(ll& a, ll b){
	a *= b;
	a %= MOD;
}

void add_mod(ll& a, ll b){
	a = (a<MOD)?a:(a-MOD);
	b = (b<MOD)?b:(b-MOD);
	a += b;
	a = (a<MOD)?a:(a-MOD);
}

int n,m;
ll s[100100];

ll calc(int d){
	int l = 0, r = m, k=0;
	ll ret = -INFLL, tmp = 0ll;
	while(l<n && r>d){
		if((r%d==0 && r/d<=k)){
			break;
		}
		tmp += (s[l]+s[r]);
		ret = max(ret, tmp);
		l += d;
		r -= d;
		++k;
	}
	return ret;
}

int main(void){
	int i,d;
	ll ans=0ll;
	cin >> n; m = n-1;
	for(i=0; i<n; ++i){
		cin >> s[i];
	}
	for(d=1; d<n; ++d){
		ans = max(ans,calc(d));
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 1024
s=input()
l=len(s)
mod=10**9+7
dp=[[0 for j in range(13)] for i in range(l+1)]
dp[0][0]=1
for i in range(1,l+1):
  if s[i-1]=='?':
    for j in range(10):
      for k in range(13):
        dp[i][(k*10+j)%13]+=dp[i-1][k]%mod
  else:
    for k in range(13):
      dp[i][(k*10+int(s[i-1]))%13]+=dp[i-1][k]%mod
print(dp[-1][5]%mod)


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

int main() {
	char a[10], b[10], c[10];
  cin >> a >> b >> c;
  if (a[strlen(a)-1]==b[0] && b[strlen(b)-1] == c[0])
    cout << "YES";
  else cout << "NO";
}

Measured memory_bytes: 256
ii = lambda : int(input())
mi = lambda : map(int,input().split())
li = lambda : list(map(int,input().split()))



def main():
    n = ii()
    a = [0 for i in range(n+1)]
    shougen = [[] for i in range(n+1)]

    for i in range(1,n+1):
        a[i] = ii()
        for j in range(a[i]):
            x,y = mi()
            shougen[i].append([x,y])
    

    ans = 0
    for itr in range(2**n):
        ilist = [0]
        tmp = itr
        while tmp > 0:
            ilist.append(tmp%2)
            tmp//=2
        if len(ilist) < n+1:
            for i in range(n+1-len(ilist)):
                ilist.append(0)
        flag = True
#        print(ilist)
        for i in range(n+1):
            if ilist[i] == 0:
                continue
            else:
                for hatugen in shougen[i]:
                    if not ilist[hatugen[0]] == hatugen[1]:
                        flag = False
                        break
            if not flag:
                break
        if flag:
            ans = max(ans,sum(ilist))
    print(ans)

        


main()


Measured memory_bytes: 3064
package main

import "fmt"

func remove(numbers []int, search int) []int {
	result := []int{}
	for _, num := range numbers {
		if num != search {
			result = append(result, num)
		}
	}
	return result
}

func main() {
	var n, x int
	fmt.Scan(&n, &x)

	a := []int{1, 2, 3}
	a = remove(a, n)
	a = remove(a, x)
	fmt.Println(a[0])
}


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

#define rep(i,n) for(i = 0;i < n;++i)
#define all(v) v.begin(), v.end()
using ll = long long;

int main()
{
    ll i,j;
    ll n,x,m;
    cin >> n >> x >> m;
    vector<ll> spare(m, -1);
    ll now = x;
    rep(i,m){
        if(spare[now] != -1) break;
        else{
            spare[now] = i;
            now = now*now%m; 
        }
    }
    ll start = spare[now];
    ll end = i;
    ll shuuki = end-start;
    now = x;
    ll ans = 0;
    for(i = 0;i < start;++i){
        ans += now;
        now = now*now%m;
        --n;
        if(n == 0){
            cout << ans << endl;
            return 0;
        }
    }
    ll kurikaesi = 0;
    for(i = start;i < end;++i){
        kurikaesi += now;
        now = now*now % m;
    }
    ans += n/shuuki*kurikaesi;
    n %= shuuki;
    while(n){
        ans += now;
        now = now*now%m;
        --n;
    }
    cout << ans << endl;

    return 0;
}


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

#define inf 0x3f3f3f3f
#define pb push_back
#define fi first
#define se second

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef vector <int> vi;
typedef vector <ll> vl;
typedef vector <ull> vu;
typedef vector <vector <int>> vvi;
typedef pair <int, int> pi;
typedef vector <pair <int, int>> vpi;

int n, m;

vi v;

void read() {
  cin >> n >> m;

  for(int i = 0; i < m; ++i) {
    int x;
    cin >> x;
    v.pb(x);
  }
}

bool cmp(int a, int b) {
  return a > b;
}

void solve() {
  if (n >= m) {
    cout << 0;
    return;
  }

  sort(v.begin(), v.end());

  vi dif;
  for(int i = 1; i < m; ++i) {
    int x = v[i] - v[i - 1];
    dif.pb(x);
  }
  sort(dif.begin(), dif.end(), cmp);

  int sum = 0;
  for(int i = n - 1; i < m; ++i) {
    sum += dif[i];
  }

  cout << sum << "\n";
}

int main() {
  ios :: sync_with_stdio(false);
  cin.tie(nullptr);
  int t = 1;
//  cin >> t; //please do not forget to comment this if there are no queries
  while(t) {
    --t;
    read();
    solve();
  }
  return 0;
}


Measured memory_bytes: 1400
#include <bits/stdc++.h>
using namespace std;
 
#define ll long long
#define mod 1000000007
#define pb push_back
#define pi pair<int,int>
#define vi vector<int>
#define vpi vector< pi >
const int N=200010;
int a[N],r1[N],r2[N],o[N],e[N];
int main()
{
	int n,r=2*N;
	cin>>n;
	for(int i=1;i<=n;i++)
	{
		cin>>a[i];
		if(i%2) r1[a[i]]++;
		else r2[a[i]]++;
	}
	o[0]=N;e[100001]=N;
	for(int i=1;i<=100000;i++)
	{
		o[i]=N;e[i]=N;
		o[i]=min(o[i-1],n/2-r1[i]);
	}
	for(int i=100000;i>0;i--)
	{
		e[i]=min(e[i+1],n/2-r2[i]);
		r=min(r,o[i-1]+e[i]);
	}
	e[0]=N;o[100001]=N;
	for(int i=1;i<=100000;i++)
	{
		e[i]=N;o[i]=N;
		e[i]=min(e[i-1],n/2-r2[i]);
	}
	for(int i=100000;i>0;i--)
	{
		o[i]=min(o[i+1],n/2-r1[i]);
		r=min(r,e[i-1]+o[i]);
	}
	cout<<r;
	return 0;
}

Measured memory_bytes: 2176
#include <iostream>
#include <sstream>
#include <algorithm>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <memory>
#include <complex>
#include <numeric>
#include <cstdio>
#include <iomanip>
#include <random>

#define REP(i,m,n) for(int i=int(m);i<int(n);i++)
#define RREP(i,m,n) for(int i=int(n)-1;i>=int(m);--i)
#define EACH(i,c) for (auto &(i): c)
#define all(c) begin(c),end(c)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort(begin(c),end(c))
#define pb emplace_back
#define MP make_pair
#define SZ(a) int((a).size())
//#define int long long

#ifdef LOCAL
#define DEBUG(s) cout << (s) << endl
#define dump(x)  cerr << #x << " = " << (x) << endl
#define BR cout << endl;
#else
#define DEBUG(s) do{}while(0)
#define dump(x) do{}while(0)
#define BR 
#endif
using namespace std;

using UI = unsigned int;
using UL = unsigned long;
using LL = long long;
using ULL = unsigned long long;
using VI = vector<int>;
using VVI = vector<VI>;
using VLL = vector<LL>;
using VVLL = vector<VLL>;
using VS = vector<string>;
using PII = pair<int,int>;
using VP = vector<PII>;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

constexpr int MOD = 1'000'000'007;

long long power(long long x, long long n, long long mod = MOD) {
    if (n == 0) return 1;
    if (n % 2 == 0) return power(x * x % mod, n/2, mod);
    else return x * power(x, n-1, mod) % mod;
}

void solve() {
    int n;
    cin >> n;
    VLL a(n);
    REP(i,0,n) cin >> a[i];
    LL ans = 0;
    VLL revj(n+1);
    REP(i,0,n+1) revj[i] = power(i+1, MOD-2);
    REP(i,1,n+1) revj[i] = (revj[i] + revj[i-1]) % MOD;
    REP(i,0,n-1) {
        /*
        REP(j,0,i+1) {
            LL p = power(j+1, MOD-2);
            ans += (p * (a[i+1] - a[i])) % MOD;
            if (ans >= MOD) ans -= MOD;
        }
        */
        LL psum = revj[i];
        ans += (psum * (a[i+1] - a[i])) % MOD;
        if (ans >= MOD) ans -= MOD;
    }
    REP(i,2,n) ans = (ans * i) % MOD;
    cout << ans << endl;
}

signed main() {
    solve();
    
    return 0;
}

Measured memory_bytes: 1792
using System;
using System.Collections.Generic;
using System.Linq;
using BitArray = System.Collections.BitArray;
using BigInteger = System.Numerics.BigInteger;

namespace AtCoderProject
{
    public class Program
    {
        public object Calc()
        {
            //var line = consoleReader.SplitInt32();
            var N = consoleReader.Int32();
            var points = consoleReader.RepeatSplitInt32(N).Select(l => new Point { x = l[0], y = l[1], h = l[2] }).ToArray();

            for (int i = 0; i <= 100; i++)
                for (int j = 0; j <= 100; j++)
                {
                    var lookup = points
                        .Where(p => p.h > 0)
                        .ToLookup(p => p.h + Math.Abs(p.x - i) + Math.Abs(p.y - j));
                    if (lookup.Count == 1)
                    {
                        var H = lookup.First().Key;
                        if (points.Where(p => p.h <= 0)
                            .All(p => p.h == Math.Max(0,H - Math.Abs(p.x - i) - Math.Abs(p.y - j))))
                            return $"{i} {j} {H}";
                    }
                }

            return 0;
        }
        struct Point
        {
            public int x;
            public int y;
            public int h;
        }

        public const int mod = 1000000007;
        private readonly ConsoleReader consoleReader;
        public Program() : this(new ConsoleReader()) { }
        public Program(ConsoleReader consoleReader) { this.consoleReader = consoleReader; }
        static void Main() => Console.WriteLine(new Program().Calc());
        public static string MultiLine<T>(IEnumerable<T> source) => string.Join("\n", source);
    }

    public class ConsoleReader { public virtual string String() => Console.ReadLine(); public int Int32() => int.Parse(String()); public long Int64() => long.Parse(String()); public ulong UInt64() => ulong.Parse(String()); public double Double() => double.Parse(String()); public string[] Split() => String().Split().ToArray(); public int[] SplitInt32() => String().Split().Select(int.Parse).ToArray(); public long[] SplitInt64() => String().Split().Select(long.Parse).ToArray(); public ulong[] SplitUInt64() => String().Split().Select(ulong.Parse).ToArray(); public double[] SplitDouble() => String().Split().Select(double.Parse).ToArray(); public IEnumerable<string> Repeat(int count) { for (int i = 0; i < count; i++) yield return String(); } public IEnumerable<int> RepeatInt32(int count) { for (int i = 0; i < count; i++) yield return Int32(); } public IEnumerable<long> RepeatInt64(int count) { for (int i = 0; i < count; i++) yield return Int64(); } public IEnumerable<string[]> RepeatSplit(int count) { for (int i = 0; i < count; i++) yield return Split(); } public IEnumerable<int[]> RepeatSplitInt32(int count) { for (int i = 0; i < count; i++) yield return SplitInt32(); } }
}

Measured memory_bytes: 17844
N,T = map(int,input().split())
c = [0] * N
t = [0] * N
for i in range(N):
    c[i],t[i] = map(int,input().split())
    
ans = 1001
for i in range(N):
    if t[i] <= T:
        if c[i] < ans:
            ans = c[i]
            
if ans == 1001:
    print('TLE')
else:
    print(ans)


Measured memory_bytes: 3060
H, W = map(int, input().split())
h, w = map(int, input().split())
ans = 0

grid = [[0]*W for i in range(H)]

for i in range(h):
    grid.pop(0)
for j in range(w):
    for i in range(len(grid)):
        grid[i].pop(0)

for k in grid:
    ans += len(k)

print(ans)

Measured memory_bytes: 3060
# coding:utf-8

INF = float('inf')


def inpl(): return list(map(int, input().split()))


def gcd(x, y):
    if x % y == 0:
        return y
    else:
        x, y = y, x % y
        return gcd(x, y)


N, S = inpl()
X = inpl()
X = [abs(X[i] - S) for i in range(N)]

if len(X) == 1:
    ans = X[0]
else:
    X.sort()
    ans = gcd(X[0], X[1])
    for i in range(2, N):
        ans = gcd(ans, X[i])

print(ans)

Measured memory_bytes: 14484
def upper_bound(arr, v)
  l = -1
  r = arr.size
  while l + 1 < r
    m = (l + r) / 2
    if arr[m] <= v then l = m
    else r = m
    end
  end
  r
end
 
EPS = 1e-9
factorial = (1..50).each_with_object([1]) { |i, arr| arr << arr[-1] * i }
 
n, m, l = gets.split.map(&:to_i)
p, t, v = n.times.map{ gets.split.map(&:to_f) }.transpose
time_set = n.times.map{ [0] * (m + 1) }
prob_set = n.times.map{ [0] * (m + 1) }
n.times do |i|
  s = l / v[i]
  (m + 1).times do |j|
    time_set[i][j] = s + t[i] * j
    prob_set[i][j] = (p[i] / 100.0) ** j * (1 - p[i] / 100.0) ** (m - j) * factorial[m] / factorial[m - j] / factorial[j]
  end
end
prob_sum = prob_set.map{ |ps| (0..m).map{ |i| ps[i..-1].reduce(:+) } }
 
n.times do |i|
  ret = 0
  (m + 1).times do |j|
    prob = prob_set[i][j]
    n.times do |k|
      next if i == k
      idx = upper_bound(time_set[k], time_set[i][j] + EPS)
      if idx == m + 1
        prob = 0
        break
      end
      prob *= prob_sum[k][idx]
    end
    ret += prob
  end
  puts '%.8f' % ret
end

Measured memory_bytes: 9172
import sys
from math import *
readline = sys.stdin.readline
def isPrime(x):
    if x == 2 or x == 3:
        return True
    elif x % 2 == 0 or x % 3 == 0:
        return False
    s = ceil(sqrt(x))
    for i in range(5, s + 1, 2):
        if x % i == 0:
            return False
    return True
print(sum(isPrime(int(readline())) for _ in range(int(input()))))



Measured memory_bytes: 5688
#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")
 
#include <bits/stdc++.h>
 
using namespace std;
 
typedef long long ll;
typedef long double ld;
typedef complex<ld> cd;
 
typedef pair<int, int> pi;
typedef pair<ll,ll> pl;
typedef pair<ld,ld> pd;
 
typedef vector<int> vi;
typedef vector<ld> vd;
typedef vector<ll> vl;
typedef vector<pi> vpi;
typedef vector<pl> vpl;
typedef vector<cd> vcd;
 
#define F0r(i, a, b) for(int i=a; i<(b); i++)
#define For(i, a)    for(int i=0; i<(a); i++)
#define F0rd(i,a,b)  for(int i = (b)-1; i >= a; i--)
#define Ford(i,a)    for(int i = (a)-1; i >= 0; i--)

void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}

template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifndef ONLINE_JUDGE
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define debug(x...)
#endif

#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define f first
#define s second
#define lb lower_bound
#define ub upper_bound
#define setbits(x)  __builtin_popcountll(x)
#define zrobits(x)  __builtin_ctzll(x)
#define all(x) x.begin(), x.end()
#define ins insert
 
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
 
const int MOD = 1000000007;
const char nl = '\n';
 
int main() {
	ios_base::sync_with_stdio(0); cin.tie(0);    
	ll x;
	cin >> x;
	ll arr[4000] = {0};
	arr[0] = 100; 
	for(int i = 1 ;i < 4000 ; i++){
			arr[i] = arr[i-1] + (ll)(( arr[i-1] * 1) / 100);
			if(arr[i] >= x){
				cout << i;
				return 0;
			}
	}
	return 0;
}


Measured memory_bytes: 3652
#include <iostream>
#include <sstream>
#include <fstream>
#include <string>
#include <vector>
#include <deque>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <algorithm>
#include <functional>
#include <utility>
#include <bitset>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <cstdio>
#include <numeric>
#include <string.h>
using namespace std;
const double PI = 3.14159265358979323846;
const double EPS = 1e-12;
const int INF = 1<<29;
const long long  INFL = 1e18;
const int MOD = 1000000007;
const int MAX = 210000;
int H,W,h,w;
void solve() {
    cin >> H >> W;
    cin >> h >> w;
    if ((H == h) && (W == w)) {
        cout << 0 << endl;
        return;
    }
    int sum, A, B, rest;
    sum = H * W;
    A = h * W;
    B = w * H;
    rest = (h * (W - (W - w)));
    cout << sum - (A + B - rest) << endl;
    return;
}
//逆元を求める関数
long long fac[MAX], finv[MAX], inv[MAX];
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++) {
      fac[i] = fac[i-1] * i % MOD;
      inv[i] = MOD - inv[MOD%i] * (MOD/i) % MOD;
      finv[i] = finv[i-1] * inv[i] % MOD;
    }
}
//組み合わせ
long long COM (int n, int k) {
    if(n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n-k] % MOD) % MOD;
}
int main(int args, char* argv[]) {
    solve();
}

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

int main()
{
    int a, b, d, r;
    double f;
    cin >> a >> b;

    d = a / b;
    r = a % b;
    f = (double)a / b;
    cout << d << " " << r << " " ;
    printf("%.8f\n", f);
    return 0;
}



Measured memory_bytes: 3224
import java.util.*;
import java.io.*;
public class Main {
    public static void main(String[] $) {
        int n=sc.nextInt();
        TreeMap<String,HashSet<Integer>> tm=new TreeMap<>();
        String[] s=new String[n+1];
        int[] p=new int[n+1];
        for (int i = 1; i < n + 1; i++) {
            s[i]=sc.next();
            p[i]=sc.nextInt();
            if(tm.get(s[i])==null){
                HashSet<Integer> set=new HashSet<>();
                set.add(i);
                tm.put(s[i],set);
            }else {
                HashSet<Integer> set=tm.get(s[i]);
                set.add(i);
                tm.put(s[i],set);
            }
        }
        for (String key:tm.keySet()){
            HashSet<Integer> set=tm.get(key);
            TreeMap<Integer,Integer> TM=new TreeMap<>(Comparator.reverseOrder());
            for (Integer restaurant:set){
                TM.put(p[restaurant],restaurant);
            }
            while (!TM.isEmpty()){
                out.println(TM.pollFirstEntry().getValue());
            }
        }
        out.close();
    }

    static PrintWriter out = new PrintWriter(System.out);

    static class sc {
        static Scanner s = new Scanner(System.in);

        static String next() {
            return s.next();
        }

        static String nextLine() {
            return s.nextLine();
        }

        static int nextInt() {
            return Integer.parseInt(s.next());
        }

        static long nextLong() {
            return Long.parseLong(s.next());
        }

        static double nextDouble() {
            return Double.parseDouble(s.next());
        }

        static boolean hasNext() {
            return s.hasNext();
        }
    }
}

Measured memory_bytes: 23252
#include <bits/stdc++.h>
using namespace std;
int h,w,n;
int arr[100009];
int ans[109][109];
int main(){
    cin>>h>>w>>n;
    for(int i=0;i<n;i++)cin>>arr[i];
    int x = 0 , y = 0;
    bool dir = 0;
    for(int i=0;i<n;i++){
        while(arr[i]>0){
            ans[x][y] = i+1;
            if(!dir){
                y++;
                if(y == w){
                    x++;
                    y--;
                    dir = 1;
                }
            }
            else{
                y--;
                if(y == -1){
                    x++;
                    y++;
                    dir = 0;
                }
            }
            arr[i] --;
        }
    }
    for(int i=0;i<h;i++){
        for(int j=0;j<w;j++){
            cout<<ans[i][j]<<" ";
        }
        cout<<endl;
    }
}


Measured memory_bytes: 384
#include<bits/stdc++.h>
#define fi first
#define se second
#define pb push_back
#define ppb pop_back
#define pii pair<int, int> 
#define pll pair<long , long>
#define all(a) a.begin(), a.end()
#define int long long
#define ll long long
#define mod 998244353
#define endl "\n"
//#define int long long
#define loop(i,a,b) for(int i=a;i<b;i++)
#define bloop(i,a,b) for(int i=a;i>=b;i--)

using namespace std;


int32_t main() {
	//code
	int t=1;
	// cin>>t;
	while(t--)
	{
        int n;
        cin>>n;
        set<string>s;
        vector<string> vect(n);
        for(int i=0;i<n;i++)	
        {
            cin>>vect[i];
            s.insert(vect[i]);
        }
        int x=s.size();
        cout<<x<<endl;
	}
	return 0;
	
}

Measured memory_bytes: 25084
#include<stdio.h>
#include<string.h>

int LCSLength(char *,char *);

int main(){
  int q,i;
  char X[1000];
  char Y[1000];
  int LCS[150];
  scanf("%d",&q);
  for(i=0;i<q;i++){
    scanf("%s",X);
    scanf("%s",Y);
    LCS[i]=LCSLength(X,Y);
  }

  for(i=0;i<q;i++){
    printf("%d\n",LCS[i]);
  }

  return 0;
}

int LCSLength(char *X, char *Y){
  int m,n,i,j;
  int c[1001][1001];
  m = strlen(X);
  n = strlen(Y);
  for(i=1;i<=m;i++){
    c[i][0]= 0;
  }
  for(j=0;j<=n;j++){
    c[0][j]= 0;
  }
  
  for(i=1;i<=m;i++){
   for(j=1;j<=n;j++){ 
     if(X[i-1]==Y[j-1]) c[i][j]=c[i-1][j-1]+1;
     else if(c[i-1][j]>=c[i][j-1]) c[i][j]=c[i-1][j];
     else c[i][j]=c[i][j-1];
    }
   }
   return c[m][n];
  }

Measured memory_bytes: 4520
import itertools
N,M=map(int,raw_input().split())
data=[map(float,raw_input().split()) for i in range(N)]
maxV=0.0
for comb in itertools.combinations(range(N),M):
    dist=0.0
    for i in range(M-1):
        for j in range(i+1,M):
            t=comb[i]
            s=comb[j]
            dist+=pow(data[t][0]-data[s][0],2)+pow(data[t][1]-data[s][1],2)+pow\
(data[t][2]-data[s][2],2)
    maxV=max(maxV,dist)
print maxV

Measured memory_bytes: 4436
import itertools

n = int(input())
tlist = list(map(int, input().split()))
k = tlist[0]
tlist.remove(tlist[0])

if k == 0:
    print("0:")
    exit()

combslist = []
for i in range(1, k+1):
    combs = list(itertools.combinations(tlist, i))
    for comb in combs:
        combslist.append(comb)

sumlist = []
for comb in combslist:
    sum = 0
    for c in comb:
        sum += pow(2, c)
    sumlist.append(sum)

z = zip(sumlist, combslist)
z = sorted(z)

sumlist, combslist = zip(*z)

print("0:")
for sum, comb in zip(sumlist, combslist):
    c_str = (' '.join(str(c) for c in comb))
    print(str(sum) + ": " + c_str)



Measured memory_bytes: 91604
#include <bits/stdc++.h>
using namespace std;
#define ll long long
int main() {
    ll a, b;
    cin >> a >> b;
    ll x = a / 2019, y = b / 2019;
    if(a % 2019 == 0) x--;
    if(y - x) cout << 0;
    else {
        ll mn = LONG_LONG_MAX;
        for(ll i = a; i <= b - 1; i++) {
            for(ll j = i + 1; j <= b; j++) mn = min(((i % 2019) * (j % 2019) % 2019), mn);
        }
        cout << mn;
    }
}


Measured memory_bytes: 256
n = int(input())
w = list(map(int,input().split()))

min = 100

for i in range(n-1):
    jsum = 0
    ksum = 0
    for j in range(0,i+1):
        jsum += w[j]
    for k in range(i+1,n):
        ksum += w[k]
    if(abs(jsum-ksum) < min):
        min = abs(jsum-ksum)

print(min)


Measured memory_bytes: 3060
#include <iostream>

using namespace std;

int main(int argc, char *argv[]) {
	int K, S;
	cin >> K >> S;

	int ans = 0;
	for (int X = 0; X <= K; X++) {
		for (int Y = 0; Y <= K; Y++) {
			int Z = S - X - Y;
			if (0 <= Z && Z <= K) ans++;
		}
	}

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

Measured memory_bytes: 256