akhauriyash/Code-Regression huggingface dataset:
using System;
using System.Collections.Generic;
using System.Linq;

namespace PaizaTest
{
    class Program
    {
        static void Main(string[] args)
        {
            var x = int.Parse(Console.ReadLine());

            // 素数を求める
            var max = 110000;

            var list = new List<int>();
            for (int i = 2; i < max; i++)
            {
                if (list.Any(s => i % s == 0))
                {
                    continue;
                }

                list.Add(i);
            }
            var value = list.First(i => i >= x);
            Console.WriteLine(value);
        }
        //static void Main(string[] args)
        //{

        //var nk = Console.ReadLine().Split(' ').Select(int.Parse).ToList();
        //// 2 <= n <= 10^5
        //// 1 <= k <= n - 1

        //// グーの勝利点: r
        //// チョキの勝利点: s
        //// パーの勝利点: p
        //var rsp = Console.ReadLine().Split(' ').Select(int.Parse).ToList();
        //var t = Console.ReadLine();
        //var score = 0;
        //var rScore = rsp[0];
        //var sScore = rsp[1];
        //var pScore = rsp[2];
        //var myHandHistory = new List<int>();
        //// r = 1;
        //// s = 2;
        //// p = 3;

        //for (int i = 0; i < nk[0]; i++)
        //{
        //    var enemyHand = t[i];
        //    switch (enemyHand)
        //    {
        //        case 'r':
        //            myHandHistory.Add(3);
        //            if (myHandHistory.Count - 1 > nk[1] && myHandHistory[i - nk[1]] != 3)
        //            {
        //                score += pScore;
        //            }
        //            break;
        //        case 's':
        //            myHandHistory.Add(1);
        //            if (myHandHistory.Count - 1 > nk[1] && myHandHistory[i - nk[1]] != 1)
        //            {
        //                score += rScore;
        //            }
        //            break;
        //        case 'p':
        //            myHandHistory.Add(2);
        //            if (myHandHistory.Count - 1 > nk[1] && myHandHistory[i - nk[1]] != 2)
        //            {
        //                score += sScore;
        //            }
        //            break;
        //        default:
        //            break;
        //    }
        //}
        //Console.WriteLine(score);
        //}
    }
}


Measured memory_bytes: 17332
S_list=list(str(input()))
S_set=list(set(S_list))
n1=0
n2=0

if len(S_set) == 2:
    for ii in range(0,len(S_list)):
        if S_list[ii] == S_set[0]:
            n1 += 1
        elif S_list[ii] == S_set[1]:
            n2 += 1
    ans = "Yes" if n1 == 2 and n2 == 2 else "No"
else:
    ans = "No"

print(ans)


Measured memory_bytes: 3060
import sys
import os
import copy

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

    N = int(sys.stdin.readline().rstrip())
    A = [int(sys.stdin.readline().rstrip()) for _ in range(N)]
    B = copy.copy(A)
    A.sort(reverse=True)
    f = A[0]
    s = A[1]

    for n in range(N):
        t = B[n]
        if f == t:
            print(s)
        else:
            print(f)


if __name__ == '__main__':
    main()


Measured memory_bytes: 14584
#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 FOR(i, a, b) for (int i=a; i<(b); i++)
#define F0R(i, a) for (int i=0; i<(a); i++)
#define FORd(i,a,b) for (int i = (b)-1; i >= a; i--)
#define F0Rd(i,a) for (int i = (a)-1; i >= 0; i--)
#define trav(a,x) for (auto& a : x)
 
#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 all(x) x.begin(), x.end()
#define ins insert

template<class T> bool ckmin(T& a, const T& b) { return b < a ? a = b, 1 : 0; }
template<class T> bool ckmax(T& a, const T& b) { return a < b ? a = b, 1 : 0; }
 
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
 
const int MOD = 1000000007;
const char nl = '\n';
const int MX = 100001; //check the limits, dummy
 
int main() {
	ios_base::sync_with_stdio(0); cin.tie(0);    
	
    int N; cin >> N;
    vi a(N); F0R(i, N) cin >> a[i];
    int ans = 0;
    for (int i = 1; i <= N; ++i) {
		if (i % 2 && a[i-1] % 2) ++ans;
	}
	cout << ans << nl;
	
	return 0;
}
 
// read the question correctly (ll vs int)
// template by bqi343



Measured memory_bytes: 3632
import java.util.*;
import java.util.Map.Entry;
public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

		int n = sc.nextInt();
		Map<String, Integer> map = new TreeMap<String, Integer>();
		for(int i=0;i<n;i++) {
			String s = sc.next();
			if(map.containsKey(s))
				map.put(s, map.get(s)+1);
			else
				map.put(s, 1);
		}
		
		int max = 0;
		for(Entry<String, Integer> e: map.entrySet()) {
			String key = e.getKey();
			int vote = e.getValue();
			if(vote>max)
				max = vote;
		}
		
		StringBuilder ans = new StringBuilder();
		for(Entry<String, Integer> e: map.entrySet()) {
			String key = e.getKey();
			int vote = e.getValue();
			if(vote==max)
				ans.append(key+"\n");
		}
		
		System.out.print(ans);
	}
}

Measured memory_bytes: 87516
#include "bits/stdc++.h"
using namespace std;

// Inserted snippets: io, root
#define rep(i, a, b) for(int i = a; i < (b); ++i)
#define all(x) begin(x), end(x)
#define sz(x) (int)(x).size()
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
template<typename H> bool chmin(H& v1, const H v2) { if (v1 > v2) { v1 = v2; return true; } return false; }
template<typename H> bool chmax(H& v1, const H v2) { if (v1 < v2) { v1 = v2; return true; } return false; }
template<typename H> void read(H& head) { cin >> head; }
template<typename H, typename ...T> void read(H& head, T& ...tail) { cin >> head; read(tail...); }
template<typename H> void write(H head) { cout << head << '\n'; }
template<typename H, typename ...T> void write(H head, T ...tail) { cout << head << " "; write(tail...); }
template<typename ...T> void die(T ...tok) { write(tok...); exit(0); }
// End snippets

int main() {
	cin.tie(0)->sync_with_stdio(0);
	cin.exceptions(cin.failbit);

	int n; read(n);
	vector<int> v(n + 1);
	rep(i, 1, n + 1) read(v[i]);
	int a = 0;
	rep(i, 1, n + 1) if (i % 2 == 1 && v[i] % 2 == 1) a++;
	write(a);
}


Measured memory_bytes: 3644
import math
from functools import reduce
from functools import lru_cache

@lru_cache(maxsize=10000)
def gcd(*numbers):
    return reduce(math.gcd, numbers)

# 整数を一つ入力
N = int(input())

res = 0

for a in range(1,N+1):
    for b in range(1,N+1):
        gcdab = gcd(a,b)
        for c in range(1,N+1):
            res += gcd(gcdab,c)

print(res)

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

int main(){
  int N,sum=0;
  cin >> N;
  vector<int> S(N,0);
  for(int i=0;i<N;i++){
    cin >> S[i];
    sum += S[i];
  }
  sort(S.begin(),S.end());
  if(sum%10>0){
    cout << sum << endl;
    return 0;
  }
  for(int i=0;i<N;i++){
    if(S[i]%10>0){
      cout << sum - S[i] << endl;
      return 0;
    }
  }
  cout << 0 << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<cstring>
#include<iomanip>
#include<cmath>
#define ll long long
using namespace std;



int main() {
    std::ios::sync_with_stdio(false);
    std::cin.tie(NULL);
    std::cout.tie(NULL);

    int n,m;
    cin>>n;
    if(n%2==0)
        cout<<"0.5000000000"<<endl;
    else {
        cout << fixed << setprecision(10) <<double(n+1)/(2*n)<< endl;
    }

    return 0;
}



Measured memory_bytes: 256
/*
 * Author : Sadi
 * Mon 06/07/2020
 * 14:32:03.56
 */
#include <iostream>
#include <cstdio>
#include <climits>
#include <string>
#include <sstream>
#include <algorithm>
#include <utility>
#include <vector>
#include <deque>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#include <cassert>

using namespace std;

#define    watch(x); cout << "\n" <<  #x << " is: " << x << "\n";
#define    all(a) (a).begin(), (a).end()
#define    fi first
#define    se second

template<class A, class B>
ostream& operator << (ostream& output, const pair<A, B>& p) {
    output << "(" << p.first << ", " << p.second << ")";
    return output;
}

template<class A>
ostream& operator << (ostream& output, const vector<A>& a) {
    output << "[";
    for(auto it = a.begin(); it != a.end(); ++it) {
        if(it != a.begin()) {
            output << ", ";
        }
        output << *it;
    }
    output << "]";
    return output;
}

using lld = long long;
using pii = pair<int, int>;
using pll = pair<lld, lld>;

//const int inf = 1e9;
//const int mod = 1e9 + 7;
//const double PI = acos(-1.0);
//const int mx = 1e5 + 5;



int main()
{
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
#ifndef ONLINE_JUDGE
//    freopen("input.txt", "r", stdin);
//    freopen("output.txt", "w", stdout);
#endif // ONLINE_JUDGE

	int n;
	cin >> n;
	vector<int> v(n);
	for(int i = 0; i < n; ++i) {
		cin >> v[i];
	}	 
	int count = 0;   
	for(int i = 1; i < n - 1; ++i) {
		if(v[i] > v[i - 1] && v[i] < v[i + 1]) {
			count++;
		}
		else if(v[i] > v[i + 1] && v[i] < v[i - 1]) {
			count++;
		}
	}
	cout << count << endl;
    return 0;
}


Measured memory_bytes: 3608
# joisinoお姉ちゃんは、劇場の受付を担当しています。
# この劇場には、席 1 から席 100000 までの、100000 個の席があります。
# 彼女のメモ書きによると、今までの間に N 組の団体が来て、
# i 組目の団体は席 li から席 ri までの連続した席に座っています。
# 今、劇場の席には何人座っているか求めてください。

n = gets.to_i

l = Array.new
r = Array.new

n.times do
  input_line = gets.chomp.split
  l << input_line[0].to_i
  r << input_line[1].to_i
end

sum = 0

n.times do |i|
  sum += r[i] - l[i] + 1
end

puts sum


Measured memory_bytes: 1788
# coding: utf-8
# Your code here!

import queue

S = input()
K = int(input())

char2index= dict([(x, i) for i, x in enumerate('abcdefghijklmnopqrstuvwxyz')])
index2char= dict([(i, x) for i, x in enumerate('abcdefghijklmnopqrstuvwxyz')])
indices = [[] for _ in range(len(char2index))]


substrings = set()
K_substring = []
count = -1
def recursive(char, indices):
    global count
    count += 1
    if count == K:
        K_substring.append(char)
        return
    
    new_indices = [[] for _ in range(len(char2index))]
    
    for i in indices:
        if i + 1 < len(S):
            new_indices[char2index[S[i + 1]]].append(i + 1)
         
    for i, index in enumerate(new_indices):
        if len(index) > 0:
            recursive(index2char[i], index)
            if count == K:
                K_substring.append(char)
                break
            
    return

indices = list(range(-1, len(S)-1))
recursive('', indices)
    
print(''.join(K_substring[::-1]))


Measured memory_bytes: 5068
import math

S = int(input())

sqrtS = math.ceil(math.sqrt(S))
rest = sqrtS*sqrtS - S

X1,Y1 = 0,0
X2,Y2 = sqrtS, 1
X3,Y3 = rest, sqrtS
print("{} {} {} {} {} {}".format(X1,Y1,X2,Y2,X3,Y3))



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

#define ll long long
#define endl "\n"
#define vi vector<int>
#define pb push_back
#define F first
#define S second

void solve() {

}

int main() {
#ifndef ONLINE_JUDGE
	freopen("manish.txt", "r", stdin);
	//freopen("ps.txt", "w", stdout);
#endif
	int t;
	//cin >> t;
	t = 1;
	while (t--) {
		int n;
		cin >> n;
		if (n == 1) cout << "0\n";
		else cout << "1\n";
	}
	return 0;
}

Measured memory_bytes: 3648
/*
ID: Aman Raj
LANG: C++
TASK: preface
*/
#include<iostream>
#include <stdio.h>
//#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
#include<math.h>
typedef  long long int ll;
#include <bits/stdc++.h>
#include <vector>
#include <set>
#include <map>
#include <string>
#include <cstdio>
#include <cstdlib>
#include <climits>
#include <utility>
#include <algorithm>
#include <cmath>
#include <queue>
#include <stack>
#include <iomanip>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
//setbase - cout << setbase (16); cout << 100 << endl; Prints 64
//setfill -   cout << setfill ('x') << setw (5); cout << 77 << endl; prints xxx77
//setprecision - cout << setprecision (14) << f << endl; Prints x.xxxx
//cout.precision(x)  cout<<fixed<<val;  // prints x digits after decimal in val

using namespace std;
using namespace __gnu_pbds;

#define f(i,a,b) for(i=a;i<b;i++)
#define rep(i,n) f(i,0,n)
#define fd(i,a,b) for(i=a;i>=b;i--)
#define pb push_back
#define mp make_pair
#define vi vector< int >
#define vl vector< ll >
#define ss second
#define ff first
//#define ll long long
#define pii pair< int,int >
#define pll pair< ll,ll >
#define sz(a) a.size()
#define inf (1000*1000*1000+5)
#define all(a) a.begin(),a.end()
#define tri pair<int,pii>
#define vii vector<pii>
#define vll vector<pll>
#define viii vector<tri>
#define mod (1000*1000*1000+7)
#define pqueue priority_queue< int >
#define pdqueue priority_queue< int,vi ,greater< int > >
//#define flush fflush(stdout)
#define primeDEN 727999983
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
#include <fstream>
// find_by_order()  // order_of_key
typedef tree<
	int,
	null_type,
	less<int>,
	rb_tree_tag,
	tree_order_statistics_node_update>
	ordered_set;

	   //vector<ll > vten(7),vfive(7),vfifty(7),vhundred(7),vfivehundred(7),vthousand(7);
	   string s1,s2;
	   vector<vector<ll> > dp;
	   string sans;
	   ll ans;
	   void visit(ll i,ll j)
	   {   if(ans==0)return ;
	       if(i<0||j<0)return ;
	       if(dp[i][j]==ans&&s1[i]==s2[j]){ans--;sans+=s1[i];visit(i-1,j-1);}

	       else
           { if(i>0) if(dp[i-1][j]==ans){visit(i-1,j);return;}
            if(j>0)if(dp[i][j-1]==ans){visit(i,j-1);return ;}
              //else visit(i-1,j-1);

           }
	   }
    ll aman(ll a2,ll b2)
    {     if(a2<0||b2<0)return 0;

         if(dp[a2][b2]==-1)
        {if(s1[a2]==s2[b2]){ dp[a2][b2]=1+aman(a2-1,b2-1);    }
        else
        {dp[a2][b2]=max(aman(a2-1,b2),aman(a2,b2-1));


        } }
        return dp[a2][b2];


    }
  int main()
 {
      ifstream fin("tcase.txt");
      //ofstream fout("tcase.txt");
     //string s1,s2;
     cin>>s1>>s2;
  //cout<<s1<<endl<<s2<<endl;
    //vector<vector<ll> > v(s2.size());
    dp.resize(s1.size());
    for(ll i=0;i<s1.size();i++)dp[i].resize(s2.size(),-1);

   ans=aman(s1.size()-1,s2.size()-1);
   //cout<<ans;
//cout<<s5.size();
  //reverse(all(s5));
   //sans+=s5.second;
  //for(ll i=0;i<dp.size();i++){for(auto x:dp[i])cout<<x<<" ";cout<<endl;}cout<<endl;
    visit(s1.size()-1,s2.size()-1);
    reverse(all(sans));
  cout<<sans;
	return 0;
 }




Measured memory_bytes: 71040
N=int(input())
A=[]
for i in range(N):
  x,y=map(int,input().split())
  A.append((x,y,i))
A=sorted(A)
B=sorted(A,reverse=False, key=lambda x: x[1]) 
#print(A,B)
E=[[]for i in range(N)]
for i in range(N-1):
  x1,x2=A[i][2],A[i+1][2]
  y1,y2=B[i][2],B[i+1][2]
  E[x1].append((x2,A[i+1][0]-A[i][0]))
  E[x2].append((x1,A[i+1][0]-A[i][0]))
  E[y1].append((y2,B[i+1][1]-B[i][1]))
  E[y2].append((y1,B[i+1][1]-B[i][1]))
G=E
# G[v] = [w, ...]
#     グラフG上で頂点vが隣接する辺集合

from heapq import heappush, heappop, heapify
used = [0]*N
que = [(c, w) for w, c in G[0]]
used[0] = 1
heapify(que)

ans=0
while que:
    cv,v=heappop(que)
    if used[v]:
        continue
    used[v]=1
    ans+=cv
    for w,c in G[v]:
        if used[w]:
            continue
        heappush(que,(c,w))
print(ans)

Measured memory_bytes: 82256
#include <stdio.h>

int main(void) {

    int a, b;

    scanf("%d%d", &a, &b);

    if (a < b) {
        printf("a < b\n");
    } else if (b < a) {
        printf("a > b\n");
    } else {
        printf("a == b\n");
    }

    return 0;

}

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

template<class T> void chmax(T &a, T b) {
    if (a < b) a = b;
}

int main() {
    int N, W;
    cin >> N >> W;
    vector<int> weight(N), value(N);
    for (int i = 0; i < N; ++i) cin >> weight[i] >> value[i];

    // N のところを 2 にする
    vector<vector<long long>> dp(2, vector<long long>(W+1, 0));
    for (int i = 0; i < N; ++i) {
        for (int w = 0; w <= W; ++w) {
            chmax(dp[(i+1) % 2][w], dp[i % 2][w]);
            if (w + weight[i] <= W) {
                chmax(dp[(i+1) % 2][w + weight[i]], dp[i % 2][w] + value[i]);
            }
        }

        // 次回更新する配列を初期化 (ナップサックでは実は不要)
        dp[i % 2].assign(W+1, 0);
    }
    cout << dp[N % 2][W] << endl;
}


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

int main() {
    int N, M, X, Y;
    cin >> N >> M >> X >> Y;

    vector<int> x(N);
    vector<int> y(M);
    for(int i=0; i<N; i++) cin >> x[i];
    for(int i=0; i<M; i++) cin >> y[i];

    sort(x.begin(),x.end());
    sort(y.begin(), y.end());

    if(X >= Y) {
        cout << "War" << endl;
        return 0;
    }

    for(int i=X+1; i <= Y; i++) {
        if(i<=y[0] && i>x[N-1]) {
            cout << "No War" << endl;
            return 0;
        }
    }


    cout << "War" << endl;
}



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

using namespace std;

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

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

#define DEBUG(x) cout<<#x<<": "<<x<<endl
#define DEBUG_VEC(v) cout<<#v<<":";REP(i,v.size())cout<<" "<<v[i];cout<<endl
#define ALL(a) (a).begin(),(a).end()

#define CHMIN(a,b) a=min((a),(b))
#define CHMAX(a,b) a=max((a),(b))

// mod
const ll MOD = 998244353ll;

typedef bitset<300> bit;

int n,m;
bit a[325];

ll modpow(ll a, ll b){
  ll r = 1;
  while(b){
    if(b&1)r=r*a%MOD;
    a=a*a%MOD;
    b>>=1;
  }
  return r;
}

int main(){
  scanf("%d%d",&n,&m);
  REP(i,n){
    int x;
    REP(j,m){
      scanf("%d",&x);
      if(x==1)a[i].set(j);
    }
  }
  int cnt = 0;
  REP(pos,m){
    int tgt = -1;
    FOR(i,cnt,n)if(a[i][pos]){
      tgt = i; break;
    }
    if(tgt==-1)continue;
    swap(a[cnt], a[tgt]);
    REP(i,n)if(i != cnt && a[i][pos]){
      a[i] ^= a[cnt];
    }
    cnt++;
  }
  ll ans = (modpow(2ll, cnt) - 1 + MOD) * modpow(2ll, n-cnt) % MOD * modpow(2ll, m-1) % MOD;
  printf("%lld\n",ans);
  return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

int main(void)
{
	int a,s,d,f,g,z,x,c,v;
	scanf("%d%d%d%d%d",&a,&s,&d,&f,&g);
	z=a*g;
	if(d>=g)
	{
		x=s;
	}
	else
	{
		x=s+(g-d)*f;
	}
	if(z>=x)
	{
		printf("%d\n",x);
	}
	if(z<x)
	{
		printf("%d\n",z);
	}
	return 0;
}

Measured memory_bytes: 596
A,B,M = [int(x) for x in input().split()]
a = [int(x) for x in input().split()]
b = [int(x) for x in input().split()]
c = []
for _ in range(M):
    tmp = [int(x) for x in input().split()]
    c.append(tmp)

ans = min(a)+min(b)
for x in c:
    ans = min((a[x[0]-1]+b[x[1]-1]-x[2]),ans)

print(ans)

Measured memory_bytes: 32496
#include <iostream>
#include"cmath";
using namespace std;
int main(void) {
    int a, b;
    cin >> a >> b;
    double n;
    int sqrtn;
    if (b / 100 > 0) {
        n = 1000 * a + b;
    }
    else if (b / 10 > 0) {
        n = 100 * a + b;
    }
    else {
        n = 10*a + b;
    }
    sqrtn = sqrt(n) * 10;
    if (sqrtn % 10 == 0) { cout << "Yes" << endl; }
    else {
        cout << "No" << endl;
    }
    system("pause");
    return 0;
}

Measured memory_bytes: 504
#include <bits/stdc++.h>
#pragma GCC optimize("unroll-loops,no-stack-protector")
//#pragma GCC target("sse,sse2,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#define watch(x) cout << (#x) << " is " << (x) << endl

typedef long long ll;
typedef long double ld;
using namespace std;

const int MOD = 1e9 + 7;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n;
    cin >> n;
    cout << pow(n, 3);

    return 0;
}


Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main()
{
    int A, B, C, D, a, b;
    cin >> A >> B >> C >> D;

    do{
    a = C - B;
    if (a <= 0) cout << "Yes";
    else{       C = a;
    
        b = A - D;
        if (b <= 0) cout << "No";
        else        A = b;
        }
    }while (a > 0 && b > 0);
}

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

int main( void ) {
    
    int a, b;
    cin >> a >> b;
    
    if( a == 1 )
        a = 14;
    if( b == 1 )
        b = 14;
    
    if( a > b )
        cout << "Alice";
    else
    if( a < b )
        cout << "Bob";
    else
        cout << "Draw";
    
    return 0;
}

Measured memory_bytes: 256
import java.io.BufferedReader
import java.io.InputStream
import java.io.InputStreamReader
import java.io.PrintWriter
import java.lang.StringBuilder
import java.util.*

fun PrintWriter.solve(sc: FastScanner) {
    val n = sc.nextInt()
    val a = Array(n) { sc.nextInt() }
    var count = 0
    for (i in 0 until n) {
        var m = a[i]
        while (m % 2 == 0) {
            m /= 2
            count++
        }
    }
    println(count)
}

fun main(args: Array<String>) {
    val writer = PrintWriter(System.out, false)
    writer.solve(FastScanner(System.`in`))
    writer.flush()
}

class FastScanner(s: InputStream) {
    private var st = StringTokenizer("")
    private val br = BufferedReader(InputStreamReader(s))

    fun next(): String {
        while (!st.hasMoreTokens()) st = StringTokenizer(br.readLine())

        return st.nextToken()
    }

    fun nextInt() = next().toInt()
    fun nextLong() = next().toLong()
    fun nextLine() = br.readLine()
    fun nextDouble() = next().toDouble()
    fun ready() = br.ready()
}

Measured memory_bytes: 34164
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;
#define all(x) x.begin(),x.end()
#define rep(i,j,n) for (long long i = j; i < (long long)(n); i++)
#define _GLIBCXX_DEBUG
#define MOD 1000000007
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
//name[i][j]-> vvl name(i,vl(j))
//map<int,int>mp
//余りを切り上げる =>  (a + b - 1) / b 

signed main(){
	int r; cin>>r;
	if(r<1200) cout<<"ABC"<<endl;
	else if(r<2800) cout<<"ARC"<<endl;
	else cout<<"AGC"<<endl;
	
	return 0;
}

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

const int INF = 1e9 + 5;

int main(int argc, char const *argv[])
{
	int n;
	cin>>n;
	std::vector<int> v(n);
	for (int i = 0; i < n; ++i)
	{
		cin>>v[i];
	}
	std::vector<int> dp(n,INF);
	dp[0] = 0;
	for (int i = 0; i < n; ++i)
	{
		for (int j=i+1;j<i+3;j++)
		{
			if(j<n){
				dp[j] = min(dp[j],dp[i]+abs(v[i]-v[j]));
			}
		}
	}
	cout<<dp[n-1];
	return 0;
}

Measured memory_bytes: 1024
N = input()
K = int(input())

def search(d, k, isLess):
    if k == K:
        return 1
    if d == len(N):
        return 0

    ret = search(d + 1, k, isLess or int(N[d]) > 0)

    if k < K:
        if isLess:
            ret += search(d + 1, k + 1, True) * 9
        elif int(N[d]) > 0:
            ret += search(d + 1, k + 1, True) * (int(N[d]) - 1) + search(d + 1, k + 1, False)

    return ret

ans = search(0, 0, False)
print(ans)

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

int main() {
    int N;
    int K;

    cin >> N >> K;

    int result = 0;

    for (int i = 0; i < N; i++) {
        int x = 0; 
        cin >> x;
        if (x < K - x) {
            result += x * 2;
        } else {
            result += (K - x) * 2;
        }
    } 
    cout << result << endl; 
}

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

class Program
{
    static void Main(string[] args)
    {
        var input = Console.ReadLine().Split(" ");
        var X = long.Parse(input[0]);
        var K = long.Parse(input[1]);
        var D = long.Parse(input[2]);

        var numOfMove = Math.Abs(X) / D;

        long position = 0;
        if (numOfMove > K)
        {
            position = Math.Abs(X) - (K * D);
        }
        else
        {
            // 必要な移動回数と実際の移動回数が奇数同士or偶数同士なら最小の値が取れる
            if (numOfMove % 2 == 0 && K % 2 == 0) position = X % D;
            else if (numOfMove % 2 != 0 && K % 2 != 0) position = X % D;
            else
            {
                position = Math.Min(Math.Abs(X % D + D), Math.Abs(X % D - D));
            }
        }

        Console.WriteLine(Math.Abs(position));
    }
}


Measured memory_bytes: 27416
#include <algorithm>
#include <cmath>
#include <functional>
#include <iomanip>
#include <iostream>
#include <limits>
#include <map>
#include <queue>
#include <set>
#include <tuple>
#include <vector>

using namespace std;

#define rep(i, n) for (int64_t i = 0; i < (n); i++)
#define irep(i, n) for (int64_t i = 0; i <= (n); i++)
#define rrep(i, n) for (int64_t i = (n)-1; i >= 0; i--)
#define rirep(i, n) for (int64_t i = n; i >= 0; i--)

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

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

  vector<int> parent(n, -1);
  queue<int> q;
  q.push(0);
  while (!q.empty()) {
    int v = q.front();
    q.pop();

    for (auto e : edge[v]) {
      if (parent[e] < 0) {
        parent[e] = v;
        q.push(e);
      }
    }
  }

  cout << "Yes" << endl;
  rep(i, n - 1) { cout << parent[i + 1] + 1 << endl; }

  return 0;
}

Measured memory_bytes: 10112
#include<bits/stdc++.h>
using namespace std;
 
#define pb push_back
#define ll long long
#define maxn 300005
#define fr(i,j,k) for(int i=j;i<k;i++)
#define f(n) fr(i,0,n)
#define f1(n) fr(i,1,n+1)
#define ms(i) memset(i,0,sizeof(i));
#define ms1(i) memset(i,-1,sizeof(i));
#define F first
#define S second
#define all(x) x.begin(), x.end()
#define pii pair<int,int>
const int mod = 1e9 + 7;

vector<int>g[200005];
int v[200005];
int b[200005];
int ans[200005];
vector<pair<int,int>>op[200005];
vector<int>d;
int query(int x) {
    int ret = 0;
    while(x) {
        ret = max(ret,b[x]);
        x -= x & (-x);
    }
    return ret;
}
void update(int x,int tar,int id) {
    while(x <= (int)d.size()) {
       // cout << x <<' '<<tar <<endl;
        op[id].pb({x,b[x]});
        b[x] = max(b[x],tar);
        x += x & (-x);
    }
}
int getID(int x) {
    return lower_bound(all(d),x) - d.begin() + 1;
}
void dfs(int now, int pre) {
    int x = getID(v[now]);
    int nxt = query(x-1) + 1;
    update(x,nxt,now);
    ans[now] = query(d.size());
    //cout << x << endl;
    //cout << query(d.size()) << endl;
    //cout << now <<' '<<x<<' '<<nxt<<endl;
    for (auto i:g[now]) {
        if (i == pre)continue;
        dfs(i,now);
    }
    for (auto i:op[now]) {
        b[i.F] = i.S;
    }
}
int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    int n;
    cin >> n;
    f1 (n) {
        cin >> v[i];
        d.pb(v[i]);

    }
    sort(all(d));
    d.erase(unique(all(d)),d.end());
   // cout << d.size() << endl;
    f(n-1) {
        int x, y;
        cin >> x >> y;
        g[x].pb(y);
        g[y].pb(x);
    }
    dfs(1,0);
    f1(n) {
        cout << ans[i] << '\n';
    }
}

Measured memory_bytes: 51320
list = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
k = int(input())
print(list[k-1])

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i=0;i<(int)(n);i++)
#define rrep(i, n) for(int i=((int)(n));i>0;i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)	
#define SORT(c) sort((c).begin(),(c).end())
#define REVERSE(c) reverse((c).begin(),(c).end())
#define REVSORT(c) SORT(c);REVERSE(c)
#define ALL(x) (x).begin(),(x).end()
#define INF 1e9
const long long MOD = 1000000007;
typedef long long ll;

int main(){
	int N;
	cin >> N;
	vector<ll>  A(N);
	rep(i, N)cin >> A[i];
	int cnt = 0;
	bool JD = true;
	while(JD){
		rep(i, N){
			if(A[i] % 2 == 0)A[i] /= 2;
			else{
				JD = false;
				break;
			}
			if(i == N - 1)cnt++;
		}
	}
	cout << cnt << endl;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        long x = Math.abs(sc.nextLong());
        long k = sc.nextLong();
        long d = sc.nextLong();
        long mod = x % d;
        long count = x / d;
        if(count >= k) {
            System.out.println(x - (k * d));
            return;
        }

        if(count % 2 == k % 2) {
            System.out.println(mod);
        } else {
            System.out.println(Math.min(Math.abs(mod - d), mod + d));
        }
    }
}

Measured memory_bytes: 35676
S = input()
L = len(S)
S += "!"
c = 0
i = 0
count_of_A = 0
while i < L:
    if S[i] == 'A':
        count_of_A += 1
        i += 1
    elif S[i] == 'B' and S[i+1] == 'C':
        c += count_of_A
        i += 2
    else:
        count_of_A = 0
        i += 1

print(c)

Measured memory_bytes: 3500
#include <iostream>
#include <cstdio>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <iomanip>
#include <stdlib.h>
#include <string.h>
#include <cmath>
#include <map>
#include <queue>
#include <deque>
#include <stack>
#include <set>
const long long MOD = 1e9 + 7;
using namespace std;
typedef long long ll;

map<ll, int> mp;
int main() {
	string s;
	cin >> s;
	int P = 0;
	for (int i = 0; i < s.size(); i++) {
		if (s.at(i) == 'p') P++;
	}
	cout << floor(s.size() / 2) - P << endl;
	return 0;
}

Measured memory_bytes: 512
N,Y=map(int,input().split())
for x in range(N+1):
    for y in range(N-x+1):
        z=N-x-y
        if 0<=z<=2000 and 10000*x+5000*y+1000*z==Y:
            print(x,y,z)
            exit()
print(-1,-1,-1)

Measured memory_bytes: 41196
import sys
from io import StringIO
import unittest
import math

mod = 10**9+7

def pow_mod(a, b, mod):
    x = 1
    while b > 0:
        if b & 1:
            x = (x*a)%mod
        a = (a**2)%mod
        b //= 2
 
    return x

def modinv(a, mod):
    return pow_mod(a, mod-2, mod)

def comb(n,r,mod):
    combsum=1
    for i in range(n-r+1,n+1):
        combsum = (combsum * i)%mod

    for i in range(1,r+1):
        combsum = (combsum * inv[i])%mod

    return combsum

n,a,b = list(map(int,input().strip().split()))

a=min([a,n-a])
b=min([b,n-b])

maxab=max([a,b])

inv=[modinv(i,mod) for i in range(0,maxab+2)]

def resolve():

    ptn = pow_mod(2,n,mod)
    ptn -= 1

    comba=comb(n,a,mod)
    combb=comb(n,b,mod)

    ptn = (ptn-comba-combb)%mod

    print(ptn)

    return 

resolve()

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

#define all(x) begin(x), end(x)

using i64 = int_fast64_t;
using u64 = uint_fast64_t;
using f64 = double;
using p64 = pair<i64, i64>;

constexpr i64 INF = INT_FAST64_MAX / 2;

template<i64 M>
struct modint {
    i64 x;

    constexpr modint(const i64 y = 0) noexcept : x(y >= 0 ? y % M : (M - (-y) % M) % M) {}

    constexpr modint operator-() const noexcept { return modint(-x); }
    constexpr modint operator+(const modint &rhs) const noexcept { return modint(*this) += rhs; }
    constexpr modint operator-(const modint &rhs) const noexcept { return modint(*this) -= rhs; }
    constexpr modint operator*(const modint &rhs) const noexcept { return modint(*this) *= rhs; }
    constexpr modint operator/(const modint &rhs) const noexcept { return modint(*this) /= rhs; }

    constexpr modint &operator+=(const modint &rhs) noexcept {
        x += rhs.x;
        if (x >= M) x -= M;
        return *this;
    }

    constexpr modint &operator-=(const modint &rhs) noexcept {
        if (x < rhs.x) x += M;
        x -= rhs.x;
        return *this;
    }

    constexpr modint &operator*=(const modint &rhs) noexcept {
        x = x * rhs.x % M;
        return *this;
    }

    constexpr modint &operator/=(const modint &rhs) noexcept {
        i64 a = rhs.x, b = M, u = 1, v = 0;
        while (b > 0) {
            i64 t = a / b;
            swap(a -= t * b, b);
            swap(u -= t * v, v);
        }
        *this *= u;
        return *this;
    }

    friend ostream &operator<<(ostream &os, const modint &p) {
        return os << p.x;
    }

    friend istream &operator>>(istream &is, modint &a) {
        i64 t;
        is >> t;
        a = modint(t);
        return is;
    }
};

constexpr i64 MOD = 1 ? 1'000'000'007 : 998'244'353;
using m64 = modint<MOD>;
constexpr m64 operator"" _m(unsigned long long n) { return m64(n); }

i64 n;
vector<vector<i64>> a;
vector<vector<optional<m64>>> dp;

m64 dfs(i64 depth, i64 used) {
    if (depth == n) return used == (1 << n) - 1;
    if (dp[depth][used]) return *dp[depth][used];

    m64 res = 0;
    for (i64 i = 0; i < n; i++) {
        if ((used >> i) & 1) continue;
        if (!a[depth][i]) continue;
        res += dfs(depth + 1, used | (1 << i));
    }
    return dp[depth][used].emplace(res);
}

void solve() {
    cin >> n;
    a.resize(n, vector<i64>(n));
    for (auto& e : a) for (auto& f : e) cin >> f;
    dp.resize(n, vector<optional<m64>>(1 << n));
    cout << dfs(0, 0) << endl;
}

int main() {
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    solve();
}


Measured memory_bytes: 724168
from math import ceil, log
N,K=map(int, input().split())

ans=0
for i in range(1,N+1):
    n=ceil(log(K/i, 2))
    if n>=0:
        ans+=(1/(N*2**n))
    else:
        ans+=1/N
    #print(n)
print(ans)

Measured memory_bytes: 2940
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);++i)
#define rrep(i,n) for(int i=1;i<(n);++i)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define maxs(a, b) a = max(a, b)
#define mins(a, b) a = min(a, b)
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
const ll linf = (1ll << 61);
const int inf = 1001001001;
const int mod = 1000000007;

ll dp[100005];

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	ll n, a, b;
	cin >> n >> a >> b;
	vector<int> x(n);
	rep(i, n) cin >> x[i];
	rrep(i, n) {
		dp[i + 1] = min(dp[i] + a * ll(x[i] - x[i - 1]), dp[i] + b);
	}
	printf("%lld\n", dp[n]);
	return 0;
}


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

int main() {
  cin.tie(0);
  ios_base::sync_with_stdio(false);
  cout << fixed << setprecision(10);
  
  string c[3];
  for (int i = 0; i < 3; i++) {
    cin >> c[i];
  }
  for (int i = 0; i < 3; i++) {
    cout << c[i][i];
  }
  cout << endl;

  return 0;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main()
{
	int debt, n;

	cin >> n;

	debt = 100000;

	for (int i = 0; i < n; i++){
		debt *= 1.05;
		if (debt % 1000) {
			debt /= 1000;
			debt++;
			debt *= 1000;
		}
	}

	cout << debt << endl;
	return (0);
}

Measured memory_bytes: 3084
#include <bits/stdc++.h>
using namespace std;
#define st first
#define nd second
#define pb push_back
#define pf push_front
#define ppb pop_back
#define ppf pop_front
#define ll long long
#define ld long double
int main()
{
    //freopen("in.txt","r",stdin);
    int n;
    scanf("%d",&n);
    vector<ll> a;
    int i,t;
    ll Max=0;
    int idx;
    ll Min=1e6;
    int midx;
    for(i=0;i<n;i++)
    {
        scanf("%d",&t);
        a.pb(t);
        if(Max<t)
        {
            idx=i;
            Max=t;
        }
        if(Min>t)
        {
            Min=t;
            midx=i;
        }
    }
    bool ok=true;
    vector<pair<int,int> >ans;
    if(abs(Min)>Max)
    {
        Max=0;
    }
    if(Max>0)
    {
        for(i=1;i<n;i++)
        {
            while(a[i]<a[i-1])
            {
                ans.pb({idx+1,i+1});
                a[i]+=Max;
                if(a[i]>Max)
                {
                    Max=a[i];
                    idx=i;
                }
            }
        }
    }
    else
    {
        for(i=n-2;i>=0;i--)
        {
            while(a[i]>a[i+1])
            {
                a[i]+=Min;
                ans.pb({midx+1,i+1});
                if(Min>a[i])
                {
                    Min=a[i];
                    midx=i;
                }
            }
        }
    }
//    for(auto it:a)
//    {
//        cout<<it<<" ";
//    }
//    cout<<endl;
    printf("%d\n",ans.size());
    for(auto it:ans)
    {
        printf("%d %d\n",it.st,it.nd);
    }
    return 0;
}


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

#define ll long long
#define INF 99999999
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()

int main()
{
    ll N;
    cin >> N;
    vector<ll> A(N);
    vector<ll> ans(N);
    rep(i,N)
    {
        cin >> A[i];
        ans[i] = A[i];
    }
        
    sort(all(ans),greater<int>());

    //rep(i,ans.size()) cout << ans[i] << endl;
    rep(i,N)
    {
        bool flag = false;
        rep(j,N)
        {
            if(A[i] != ans[j] || flag)
            {
                cout << ans[j] << endl;;
                break;
            }
            else if(A[i] == ans[j]) flag = true;
        }
    }

    


}


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

int gcd(int p,int q){
  while(q!=0){
    int r=p%q;
    p=q;
    q=r;
  }
  return p;
}

int main(){
  int K,ans=0;
  cin>>K;
  
  for(int a=1;a<=K;++a)
    for(int b=1;b<=K;++b)
      for(int c=1;c<=K;++c)
        ans+=gcd(a,gcd(b,c));
  
  cout<<ans<<endl;
}

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

#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 hell        1000000007
#define rep(i,a,b)  for(int i=a;i<b;i++)
using namespace std;

void solve(){
    int a[5],k;
    rep(i,0,5) cin>>a[i]; cin>>k;
    sort(a,a+5);
    if(a[4]-a[0]<=k) cout<<"Yay!"<<endl;
    else cout<<":("<<endl;

}

signed main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int t=1;
    // cin>>t;
    while(t--){
        solve();
    }
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<stdio.h>
//#include <bits/stdc++.h>
#include<vector>
#include<float.h>
#include<iomanip>
#include<algorithm>
#include<string>
#include<cstring>
#include<math.h>
#include<cmath>
#include<sstream>
#include<set>
#include<map>
#include<queue>
#include <cassert>
#include <cmath>
#include<cstdint>

#define INF 1e9
#define rep(i,n)for(int i=0;(i)<(int)(n);i++)
#define REP(i,a,b)for(int i=(int)(a);(i)<=(int)(b);i++)
#define VEC(type, c, n) std::vector<type> c(n);for(auto& i:c)std::cin>>i;
#define vec(type,n) vector<type>(n)
#define vvec(m,n) vector<vector<int>> (int(m),vector<int>(n))
#define ALL(a)  (a).begin(),(a).end()

using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
using P = pair<int,int>;

vector<int>bitSearch(int bit,int n){
    vector<int>S;
    rep(i,n)if(bit&(1<<i))S.push_back(i);
    return S;
}


int d[3] = {-1,0,1};
int main(){
   int a,b;cin>>a>>b;
   if(a+b>=24)cout<<a+b-24;
   else cout<<a+b;
}



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

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

Measured memory_bytes: 256
n,l=[int(x) for x in input().split()]

a=[int(x) for x in input().split()]

j=-1
for i in range(n-1):
  if a[i]+a[i+1]>=l:
    j=i
    break
    
if j==-1:
  print("Impossible")
else:
  #print(j)
  print("Possible")
  for i in range(j):
    print(i+1)
  for i in range(n-1,j,-1):
    print(i)

Measured memory_bytes: 14056
use std::io::*;
use std::str::FromStr;

fn main(){
    let n: u32 = read();
    let mut ans = None;

    'outer: for i in (0..101){
        for j in (0..101){
            if i * 4 + j * 7 == n {
                ans = Some("Yes");
                break 'outer;
            }
        }
    }

    println!("{}", ans.unwrap_or("No"));
} 

fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char) 
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

Measured memory_bytes: 4352
#include "bits/stdc++.h"
using namespace std;
#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
  enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
  ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
  *this << "[";
  for (auto it = d.b; it != d.e; ++it)
    *this << ", " + 2 * (it == d.b) << *it;
  ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "
 
using ll = long long;
 
const int nax = 10123;
char k[nax];
const int mod = 1e9 + 7;
 
void add_self(int& a, int b) {
    a += b;
    if(a >= mod) {
        a -= mod;
    }
}
 
int modder(int x, int moddi)
{
	if (x >= moddi)
        return x % moddi;
    return x;
}
 
int main() {
    scanf("%s", k);
    int D;
    scanf("%d", &D);
    int len = strlen(k);
    vector<array<int,2>> dp(D, array<int,2>{});
    // dp[sum][smaller_already] - the number of ways to choose digits so far
    // such that the sum of digits modulo D is 'sum' and 'smaller_already'
    // says whether we already chosen some digit smaller than in K
    dp[0][0] = 1;
    for(int where = 0; where < len; ++where) {
        vector<array<int,2>> new_dp(D, array<int,2>{});
        for(int sum = 0; sum < D; ++sum) {
            int sum2 = sum % D;
            for(bool sm_already : {false, true}) {
                for(int digit = 0; digit < 10; ++digit) {
                    if(digit > k[where] - '0' && !sm_already) {
                        break;
                    }
                    add_self(new_dp[modder(sum2+digit,D)][sm_already || (digit < k[where]-'0')],
                        dp[sum][sm_already]);
                }
            }
        }
        dp = move(new_dp);
    }
    int answer = (dp[0][false] + dp[0][true]) % mod;
    --answer;
    if(answer == -1) {
        answer = mod - 1;
    }
    printf("%d\n", answer);
}

Measured memory_bytes: 256
#include <iostream>
#include <climits>
#include <string>
#include <string.h>
#include <stdlib.h>
#include <algorithm>
using namespace std;

int INF = 1<<29;
const int mod = 1000000007;
// memset(a,0,sizeof(a)); →全部０にする

int main(){
	int n,k,x,y;
	cin>>n>>k>>x>>y;
	if(n<=k){
		cout<<n*x<<endl;
	}else{
		cout<<k*x+(n-k)*y<<endl;
	}
	return 0;
}

Measured memory_bytes: 256
from collections import defaultdict,deque
import sys,heapq,bisect,math,itertools,string,queue,datetime
sys.setrecursionlimit(10**8)
INF = float('inf')
mod = 10**9+7
def inpl(): return list(map(int, input().split()))
def inpls(): return list(input().split())

N,x = inpl()
aa = inpl()
aa.sort()

if sum(aa) == x:
    print(N)
else:
    tmp = 0
    for a in aa:
        x -= a
        tmp += 1
        if x < 0:
            print(tmp-1)
            sys.exit()
    print(N-1)


Measured memory_bytes: 4464
#include<stdio.h>
#include<string.h>
int main (){
	char days[7][5]={"SUN","MON","TUE","WED","THU","FRI","SAT"};
	char S[4];
	gets(S);
	int i;
	int no=0;
	for (i=0;i<7;i++){
		if (strcmp(S,days[i])==0){
			no=7-i;
		}
	}
	printf("%d\n",no);
	return 0;
}


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

char alphas[26] = {'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'};

int N,x=0;

vector<string> a;

void dfs(string S,int n){
    if(S.size()==N){
        a.push_back(S);
    }else{
        for(int i=0;i<=n;i++){
            dfs(S+alphas[i],max(n,i+1));
        }
    }
}

int main(){
    cin >> N;
    dfs("a",1);
    sort(a.begin(),a.end());
    for(int i=0;i<a.size();i++){
        cout << a[i] << endl;
    }
}

Measured memory_bytes: 7796
#include<bits/stdc++.h>
using namespace std;
#define FASTIO ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define ll long long
#define pii pair<int,int>
#define pll pair<ll,ll>
#define pil pair<int,ll>
#define pli pair<ll,int>
#define mod 1000000007
#define mp make_pair
#define pb push_back
#define ff first
#define ss second
vector<vector<int> > d; 
ll power(ll a,int n){
  if(n==0)
    return 1;
  if((n%2)==0)
    return (power((a*a)%mod,n/2))%mod;
  else
    return (a*(power((a*a)%mod,n/2))%mod)%mod;    
}
int main(){
FASTIO
ll h,w;
cin>>h>>w;
ll a=h/2;
if((h%2)!=0){
  a++;
}
ll b=h/2;
ll c=w/2;
if((w%2)!=0){
    c++;
}
ll d=w/2;
if((h==1)||(w==1)){
  cout<<1;
}
else{
  cout<<a*c+b*d;
}
return 0;
}

Measured memory_bytes: 256
// #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>
#ifdef BOI
#include "debug.h"
#else
#define debug(args...)
#endif
#define endl '\n'
using ll = long long;
using namespace std;

const ll mod = 1e9 + 7;

int main() {
  ios_base::sync_with_stdio(false), cin.tie(nullptr);
  #ifdef BOI
  freopen("in.txt", "r", stdin);
  freopen("out.txt", "w", stdout);
  #endif
  ll n, k; cin >> n >> k;
  vector<ll> a(n);
  ll ans = 0;
  // map<ll, ll> inc;
  for(ll& it : a) cin >> it;
  for(ll i = 0; i < n; ++i) {
    ll temp = 0;
    for(ll j = i + 1; j < n; ++j) {
      temp += a[i] > a[j];
    }
    // temp = (temp*k)%mod;
    // temp = (temp*(k + 1))%mod;
    // temp = (temp/2)%mod;
    ll ntemp = ((k*(k + 1))/2)%mod;
    temp = (ntemp*temp)%mod;
    debug(temp);
    ans = (ans + temp)%mod;
    temp = 0;
    for(ll j = 0; j < i; ++j) {
      temp += a[i] > a[j];
    }
    // temp = (temp*k)%mod;
    // temp = (temp*(k - 1))%mod;
    // temp = (temp/2)%mod;
    ll xtemp = ((k*(k - 1))/2)%mod;
    temp = (xtemp*temp)%mod;
    debug(temp);
    ans = (ans + temp)%mod;
  }
  // debug(inc);
  // for(auto it : inc) {
  //   ll temp = k;
  //   temp = (temp*(k - 1))%mod;
  //   temp = (temp/2)%mod;
  //   ans = (ans + temp)%mod;
  // }
  cout << ans;
  return 0;
}

Measured memory_bytes: 3640
#include<bits/stdc++.h>
#include<string>
using namespace std;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
int main(void){
    // Your code here!
    int x;
    cin >> x;
    
    if(x >= 30){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
    
    
}

Measured memory_bytes: 3584
#include <bits/stdc++.h>
#define SpeeD ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
#define ll long long
#define endl '\n'
//pair<int, int> *p=new pair<int, int>[n];
//std::vector<pair<int,int>> vp;
//v.push_back(make_pair(x,y))
//pair<int, int> p[1000001];
//string *s=new string [n];
//int freq[e];
//freq[a[i]-'a']++; freq[a[i]]++;
 using namespace std;
ll n,t,m,c1,c2,c,x,y,sum,mn=999999999,avg,pos,dif,j,dis,mx,xi,yi,q;
vector<ll>v;
set<string>s;
map<ll , ll >mp;
bool PE(int x)
{
for (int i=2;i*i<=x;i++)
if (x%i==0)
return false;
return true;
}
bool PR(string s)
{
int n=s.length();
for(int i=0;i<n/2;i++)
if(s[i]!=s[n-i-1])
return false;
return true;
}

int main(void)
{ SpeeD;
cin>>t;
set<string>s;
while (t--)
{string ss;
cin>>ss;
    s.insert(ss);
}
cout<<s.size();
}


Measured memory_bytes: 19236
n = int(input())
sp = []
for i in range(n):
    s, p = input().split()
    p = int(p)
    sp.append([s, p, i+1])
sp.sort(key=lambda x:x[1], reverse=True)
sp.sort(key=lambda x:x[0])
for i in range(n):
    print(sp[i][2])

Measured memory_bytes: 3060