akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <vector>
#include <iomanip>
#include <stack>
#include <array>
#include <deque>
#include <forward_list>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <algorithm>
#include <iterator>
#include <string>
#include <cstring>
#include <fstream>
#include <random>
#include <time.h>
#include <complex>
#include <cmath>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
#define INF (1<<21)
#define rep(i,n) for(int (i)=0;(i)<n;(i)++)
#define Rrep(i,n) for(int i=n;i>0;i--)
#define arep(a,i,n) for(int i=a;i<n;i++)
#define SORT(v) sort((v).begin(),(v).end())
#define TEMP(type,x,y) do {temp temp=x,x=y,y=temp}while(0)

int main() {

	int A, B;
	cin >> A >> B;

	if ((B - 1) % (A- 1) == 0) {
		cout << (B - 1) / (A - 1) << endl;
	}
	else {
		cout << (B - 1) / (A - 1) + 1 << endl;
	}
	

	return 0;

}

Measured memory_bytes: 256
import sys
stdin = sys.stdin

sys.setrecursionlimit(10**5) 
 
def li(): return map(int, stdin.readline().split())
def li_(): return map(lambda x: int(x)-1, stdin.readline().split())
def lf(): return map(float, stdin.readline().split())
def ls(): return stdin.readline().split()
def ns(): return stdin.readline().rstrip()
def lc(): return list(ns())
def ni(): return int(stdin.readline())
def nf(): return float(stdin.readline())

n = ni()
a = list(li())

print(min([bin(ai)[::-1].index("1") for ai in a]))

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

// input
int N, A, B;
vector<int> H;


void input() {
    cin >> N >> A >> B;
    H = vector<int>(N);
    rep(i, N) cin >> H[i];
}


bool judge(int x) {
    ll n = 0;
    rep(i, N) {
        ll s = max(ll(0), H[i] - ll(x) * B);
        if (s > 0) n += (s - 1) / (A - B) + 1;
    }
    if (n <= x) return true;
    else return false;
}


int main() {
    input();
    int l = 0;
    int r = 1e9;
    while (r - l > 1) {
        int x = (l + r) / 2;
        if (judge(x)) r = x;
        else l = x;
    }
    cout << r << endl;
}


Measured memory_bytes: 3704
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int mod=1e9+7;
const int N=2e6+6;
ll r1,c1,r2,c2;
ll fac[N],infac[N];
ll sq(ll a){
	return (a*a)%mod;
}
ll pw(ll a,ll b){
	if(b==0)return 1;
	if(b==1)return a%mod;
	if(b&1) return (a*sq(pw(a,b>>1)))%mod;
	return sq(pw(a,b>>1))%mod;
}
ll ncr(ll n,ll r){
	if(n==r)return 1;
	if(n<r)return 0;
	ll res=fac[n];
	res*=infac[r];
	res%=mod;
	res*=infac[n-r];
	res%=mod;
	return res;
}
int main(){
	infac[1]=infac[0]=fac[0]=fac[1]=1;
	for(int i=1;i<N;i++){
		fac[i]=fac[i-1]*i;
		fac[i]%=mod;
		infac[i]=pw(fac[i],mod-2);
	}
	cin>>r1>>c1>>r2>>c2;
	ll ans=0;
	for (ll i=c1;i<=c2;i++){
        ll tmp=ncr(r2+i+1,i+1)-ncr(r1+i,i+1);
        tmp+=mod;tmp%=mod;
        ans+=tmp;ans%=mod;
    }
	cout<<ans;
	return 0;
}

Measured memory_bytes: 34852
#include <bits/stdc++.h>
using namespace std;
int main(){
  int x;
  cin >> x;
  int ans=1;
  for(int i=2;i<32;i++){
    int n=i*i;
    while(n<=x){
      ans=max(ans,n);
      n*=i;
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cassert>
#include <cstdint>
#include <iostream>
#include <iomanip>
#include <string>
#include <stack>
#include <queue>
#include <vector>
#include <map>
#include <set>
#include <algorithm>
#include <numeric>
#include <bitset>

using namespace std;

using ll =  long long;
using Pll = pair<ll, ll>;
using Pii = pair<int, int>;

constexpr ll MOD = 1000000007;
constexpr long double EPS = 1e-10;
constexpr int dyx[4][2] = {
    { 0, 1}, {-1, 0}, {0,-1}, {1, 0}
};

int calc_ans(int n, vector<int> &d) {
    int ans = 12;
    for(int i=0;i<n;++i) {
        for(int j=i+1;j<n;++j) {
            int diff = abs(d[j]-d[i]);
            ans = min(ans, min(diff, 24-diff));
        }
    }
    return ans;
}

int main() {
    std::ios::sync_with_stdio(false); cin.tie(nullptr);
    int n, dd;
    cin >> n;
    vector<int> used_cnt(13, 0);
    used_cnt[0] = 2;
    used_cnt[12] = 0;
    bool zero = false;
    for(int i=0;i<n;++i) {
        cin >> dd;
        ++used_cnt[dd];
        if(used_cnt[dd] > 2 || (dd == 12 && used_cnt[12] > 1)) zero = true;
    }
    if(zero) {
        cout << 0 << endl;
        return 0;
    }

    vector<int> d;
    for(int t=1;t<=12;++t) {
        if(used_cnt[t] == 1) d.push_back(t);
    }
    int m = d.size();

    int ans = 0;
    for(int bi=0;bi<(1<<m);++bi) {
        int tmp_ans = 12;
        vector<int> tmp_d(d);
        for(int i=0;i<m;++i) {
            if(bi & (1<<i)) tmp_d[i] = 24 - tmp_d[i];
        }
        for(int t=1;t<=12;++t) {
            if(used_cnt[t] == 2) {
                tmp_d.push_back(t);
                tmp_d.push_back(24-t);
            }
        }
        tmp_d.push_back(0);
        tmp_d.push_back(24);
        sort(tmp_d.begin(), tmp_d.end());
        for(int i=0;i<tmp_d.size()-1;++i) {
            tmp_ans = min(tmp_ans, tmp_d[i+1] - tmp_d[i]);
        }
        // cerr << bitset<10>(bi) << ": " << tmp_ans << endl;
        ans = max(ans, tmp_ans);
    }

    cout << ans << endl;

}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
const int INF=2E9;
typedef pair<int,int> Pair;
typedef long long LL;
#define btc 380000.0


int main(){
    int N;
    cin >> N;
    string tmp;
    long double tmp2;
    long double sum=0;
    for(int i=0;i<N;i++){
        cin >> tmp2 >> tmp;
        sum+=(tmp=="BTC" ? btc*tmp2 : tmp2 );
    }
    cout << sum;
    return 0;
}

Measured memory_bytes: 256
import java.io.*;
import java.util.*;
import java.lang.reflect.Array;
import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;
import java.util.Scanner;
import java.util.Stack;


class Main {
	public static void main(String[] a) throws IOException {
		Scanner scan = new Scanner(System.in);
		int num[] = new int [10];
		String sentences = scan.nextLine();
		String[] kaiseki = sentences.split(" ");
		int often = 0;
		int longest = 0;
		int ofteni = 0;
		int longesti = 0;
		for(int i = 0; i < kaiseki.length;i++){
			int nagasa = kaiseki[i].length();
			if(nagasa > longest){
				longest = nagasa;
				longesti = i;
			}
		}
		int count = 0;
		for(int i = 0;i < kaiseki.length;i++){
			count = 0;
			for(int k = 0;k < kaiseki.length;k++){
				if(kaiseki[i].equals(kaiseki[k])){
					count = count + 1;	
				}
				if(count > often){
				often = count;
				ofteni = i;
			}

		}
			
		}
		System.out.println(kaiseki[ofteni]+ " "+ kaiseki[longesti]);
		
 }
}

Measured memory_bytes: 26020
s = gets.chomp
f, c = 0, 0
p = []
0.upto(s.size - 1) do |i|
  if s[i] == 'R' && f == 1
    f = 0
    p.push(c)
    c = 0
  elsif s[i] == 'L' && f == 0
    f = 1
    p.push(c)
    c = 0
  end
  c += 1
  p.push(c) if s.size - 1 == i
end
ans = Array.new(s.size, 0)
pos = 0
while p.size > 0
  x = p.shift
  y = p.shift
  if (x + y).even?
    pos += x
    ans[pos - 1] = (x + y) / 2
    ans[pos] = (x + y) / 2
    pos += y
  elsif (x.even?)
    pos += x
    ans[pos - 1] = (x + y) / 2
    ans[pos] = (x + y) / 2 + 1
    pos += y
  else
    pos += x
    ans[pos - 1] = (x + y) / 2 + 1
    ans[pos] = (x + y) / 2
    pos += y
  end
end
puts ans.join(' ')

Measured memory_bytes: 5244
#include <iostream>
using namespace std;
void ABC150(void);
void ABC151(void);
void ABC152(void);
void ABC153(void);
void ABC154(void);
void ABC155(void);
void ABC156(void);
void ABC157(void);
void ABC158(void);
void ABC159(void);

int main(void){
    ABC156();
}

void ABC156(){
    int n,r;
    cin>>n>>r;
    if(n>=10)cout<<r<<endl;
    else cout<<r+100*(10-n)<<endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <functional>
#include <sstream>
#include <utility>

using namespace std;
#define rep(i,n)	for(int i = 0;i < n;i++)
#define For(i,a,n)	for(int i = a;i < n;i++)
#define int long long
const int INF = 1e18;
template<class T> inline string tostr(T n){ stringstream ss; ss << n; return ss.str(); }

signed main(){

	int n;
	cin >> n;
	string s = "";
	rep(j, n){
		char t;
		cin >> t;
		s += t;
	}
	for (int i = 0;; i++){
		auto t = tostr(i);
		bool ok = false;
		rep(j, n){
			auto q = s.substr(j, t.size());
			if (q == t){
				ok = true;
				break;
			}
		}
		if (!ok){
			cout << i << endl;
			break;
		}
	}

	return 0;
}

Measured memory_bytes: 3236
from collections import deque,defaultdict,Counter
from itertools import accumulate
import bisect
from heapq import heappop,heappush
from fractions import gcd
from copy import deepcopy
import math
Mod = 1000000007



def main(): #startline-------------------------------------------
    A,B = map(int,input().split())
    if A == B or A == -B:
        print(0)
    else:
        if (A+B) % 2 == 0:
            print((A+B)//2)
        else:
            print("IMPOSSIBLE")
if __name__ == "__main__":
    main() #endline===============================================




def sieve_of_eratosthenes(n):
    if not isinstance(n,int):
        raise TypeError("n is not int")
    if n<2:
        raise ValueError("n < 2 is not effective")
    prime = [1]*(n+1)
    for i in range(2,int(math.sqrt(n))):
        if prime[i] == 1:
            for j in range(2*i,n):
                if j%i == 0:
                    prime[j] = 0
    res = []
    for i in range(2,n):
        if prime[i] == 1:
            res.append(i)
    return res

class UnionFind:
    def __init__(self,n):
        self.parent = [i for i in range(n+1)]
        self.rank = [0 for i in range(n+1)]
    
    def findroot(self,x):
        if x == self.parent[x]:
            return x
        else:
            y = self.parent[x]
            y = self.findroot(self.parent[x])
            return y
    
    def union(self,x,y):
        px = self.findroot(x)
        py = self.findroot(y)
        if px < py:
            self.parent[py] = px
        else:
            self.parent[px] = py

    def same_group_or_no(self,x,y):
        return self.findroot(x) == self.findroot(y)

Measured memory_bytes: 5676
#include <cstdio>
#include <vector>
#include <queue>
#include <cstring>
#include <cmath>
#include <map>
#include <set>
#include <string>
#include <iostream>
#include <algorithm>
#include <iomanip>
#include <stack>
#include <queue>
using namespace std;
#define sd(n) scanf("%d", &n)
#define sdd(n, m) scanf("%d%d", &n, &m)
#define sddd(n, m, k) scanf("%d%d%d", &n, &m, &k)
#define pd(n) printf("%d\n", n)
#define pc(n) printf("%c", n)
#define pdd(n, m) printf("%d %d\n", n, m)
#define pddd(n, m, z) printf("%d %d %d\n", n, m, z)
#define pld(n) printf("%lld\n", n)
#define pldd(n, m) printf("%lld %lld\n", n, m)
#define plddd(n, m, z) printf("%lld %lld %lld\n", n, m, z)
#define sld(n) scanf("%lld", &n)
#define sldd(n, m) scanf("%lld%lld", &n, &m)
#define slddd(n, m, k) scanf("%lld%lld%lld", &n, &m, &k)
#define sf(n) scanf("%lf", &n)
#define sc(n) scanf("%c", &n)
#define sff(n, m) scanf("%lf%lf", &n, &m)
#define sfff(n, m, k) scanf("%lf%lf%lf", &n, &m, &k)
#define ss(str) scanf("%s", str)
#define rep(i, a, n) for (int i = a; i <= n; i++)
#define per(i, a, n) for (int i = a; i >= n; i--)
#define mem(a, n) memset(a, n, sizeof(a))
#define debug(x) cout << #x << ": " << x << endl
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define fi first
#define se second
#define ce i == n ? '\n' : ' '
#define mod(x) ((x) % MOD)
#define gcd(a, b) __gcd(a, b)
#define lowbit(x) (x & -x)
typedef pair<int, int> PII;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
const int MOD = 1e9 + 7;
const double eps = 1e-9;
const ll INF = 0x3f3f3f3f3f3f3f3fll;
const int inf = 0x3f3f3f3f;
inline int read()
{
	int ret = 0, sgn = 1;
	char ch = getchar();
	while (ch < '0' || ch > '9')
	{
		if (ch == '-')
			sgn = -1;
		ch = getchar();
	}
	while (ch >= '0' && ch <= '9')
	{
		ret = ret * 10 + ch - '0';
		ch = getchar();
	}
	return ret * sgn;
}
inline void Out(int a) //ê?3?ía1ò
{
	if (a > 9)
		Out(a / 10);
	putchar(a % 10 + '0');
}

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

ll lcm(ll a, ll b)
{
	return a * b / gcd(a, b);
}
///快速幂m^k%mod
ll qpow(ll x, ll n, ll mod)
{
	ll res = 1;
	while (n)
	{
		if (n & 1)
			res = (res * x) % mod;
		x = x * x % mod, n >>= 1;
	}
	return res;
}

const int N = 2e5 + 10;

int main()
{
	int r;
	sd(r);
	double ans = 2.0 * r * 3.1415926;
	cout << ans << endl;
	return 0;
}


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

dist_list = []
start_num = int(0)

while start_num!=n-1:
  for index in range(start_num+1,n):
    dist_list.append( ((coord[start_num][0]-coord[index][0])**2+(coord[start_num][1]-coord[index][1])**2)**0.5 )
  start_num+=1

print(sum(dist_list)*(n-1)/len(dist_list))

Measured memory_bytes: 3188
#include <stdio.h>
int main(void){
    long long a,b,i,j,ans=2019;
    scanf("%lld%lld",&a,&b);
    if(b-a>=2019) ans=0;
    else{
        for(i=a;i<b;i++){
            for(j=i+1;j<=b;j++){
                if(ans>i*j%2019) ans=i*j%2019;
            }
        }
    }
    printf("%lld",ans);
    return 0;
}

Measured memory_bytes: 128
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace B
{
    class Program
    {
        static void Main(string[] args)
        {
            var hw = Console.ReadLine().Split(' ');
            UInt64 h = UInt64.Parse(hw[0]);
            UInt64 w = UInt64.Parse(hw[1]);
            if(h == 1 || w == 1)
            {
                Console.WriteLine("1");
            } else
            {
                Console.WriteLine((h * w + 1) / 2);
            }
            //Console.ReadKey();
        }
    }
}


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

int main()
{
    int n, w;
    cin >> n >> w;
    vector<pair<int, int>> item(n + 1);
    for (int i = 1; i <= n; i++)
        cin >> item[i].first >> item[i].second;

    sort(item.begin(), item.end());
    vector<vector<ll>> dp(n + 1, vector<ll>(w + 1, 0));
    for (int i = 1; i <= n; i++)
    {
        for (int j = 0; j <= w; j++)
        {
            if (j >= item[i].first)
                dp[i][j] = max(dp[i - 1][j], dp[i - 1][j - item[i].first] + item[i].second);
            else
                dp[i][j] = dp[i - 1][j];
        }
    }
    cout << dp[n][w] << endl;
}

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

int main() {
    int N; cin >> N;
    long long A[N];
    rep(i,N) cin >> A[i];
    long long sum = 0;
    rep(i,N) sum += A[i];
    for (long long i = sum-N*(N-1); ; i++) {
        sum = 0;
        rep(j,N) sum += (A[j]+i+1)/(N+1);
        if (sum <= i) {cout << i << endl; return 0;}
    }
}

Measured memory_bytes: 3600
/**
 *    author:  N_O_E_l
 *        
**/
#include <bits/stdc++.h>

using namespace std;

#define fRead(x) freopen(x, "r", stdin);
#define fWrite(x) freopen(x, "w", stdout);

#define ll long long
#define ull unsigned long long
#define vi vector<int>
#define vll vector<long long>
#define si set<int>
#define sll set<long long>
#define pb push_back
#define pop pob_back()
#define eb emplace_back
#define PI acos(-1.0)
#define mp make_pair
#define pii pair<int, int>
#define pll pair<long, long>
#define Min(a, b, c)  min(a, min(b, c))
#define all(x) x.begin(), x.end()
#define aall(x, n) x, x+n
#define fast_input ios_base :: sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);

/** -------------------------------- TEMPLATE---------------------------------- **/

void solve(void)
{
	int N;

	cin >> N;

	cout << (int)ceil(N/1000.0)*1000 - N << endl;
}

int main(void)
{
	fast_input
	
    solve();
	return 0;
}


Measured memory_bytes: 3644
#include <bits/stdc++.h>
 
#define _overload(_1,_2,_3,name,...) name
#define _rep(i,n) _range(i,0,n)
#define _range(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define rep(...) _overload(__VA_ARGS__,_range,_rep,)(__VA_ARGS__)
 
#define _rrep(i,n) _rrange(i,n,0)
#define _rrange(i,a,b) for(int i=(int)(a)-1;i>=(int)(b);--i)
#define rrep(...) _overload(__VA_ARGS__,_rrange,_rrep,)(__VA_ARGS__)
 
#define _all(arg) begin(arg),end(arg)
#define uniq(arg) sort(_all(arg)),(arg).erase(unique(_all(arg)),end(arg))
#define bit(n) (1LL<<(n))
 
// #define DEBUG
 
#ifdef DEBUG
    #define dump(...) fprintf(stderr, __VA_ARGS__)
#else
    #define dump(...)
#endif
 
template<class T>bool chmax(T &a, const T &b) { return (a<b)?(a=b,1):0;}
template<class T>bool chmin(T &a, const T &b) { return (b<a)?(a=b,1):0;}
 
using namespace std;
using ll=long long;
using vi=vector<int>;
using vll=vector<ll>;
 
const double EPS = 1e-10;
const double PI = acos(-1.0);
const int inf = INT_MAX;
const ll INF = LLONG_MAX;
const ll MOD = 1000000007LL;
const int dx[4]={1,0,-1,0};
const int dy[4]={0,1,0,-1};
 
ll extgcd(ll a,ll b,ll& x,ll& y){x=1,y=0;ll g=a;if(b!=0) g=extgcd(b,a%b,y,x),y-=a/b*x;return g;}
ll ADD(const ll &a, const ll &b, const ll mod=MOD) { return (a+b)%mod;}
ll SUB(const ll &a, const ll &b, const ll mod=MOD) { return (a-b+mod)%mod;}
ll MUL(const ll &a, const ll &b, const ll mod=MOD) { return (1LL*a*b)%mod;}
ll DIV(const ll &a, const ll &b, const ll mod=MOD) {ll x,y; extgcd(b,mod,x,y);return MUL(a,(x+mod)%mod,mod);}
 
int main(void){
    cin.tie(0);
    ios::sync_with_stdio(false);

    string S, T; cin >> S >> T;
    int n = S.size(), m = T.size();

    const int M = 26;
    vector<set<int>> tbl(M);
    rep(i, n){
        char c = S[i];
        tbl[c - 'a'].insert(i);
    }

    ll res = 0LL;
    int i = 0;
    rep(j, m){
        char c = T[j];
        auto& s = tbl[c - 'a'];

        auto itr = s.lower_bound(i);
        if(itr == end(s)){
            if(i == 0){
                res = -1LL;
                break;
            }
            i = 0;
            j--;
            res += n;
        }
        else {
            i = *itr + 1;
        }
    }
    res += i;

    cout << res << endl;

    return 0;
}


Measured memory_bytes: 5200
pattern=['S','H','C','D']
number=[i for i in range(1,14)]
Trunp=[]
for p in range(len(pattern)):
    for n in range(len(number)):
        Trunp+=[pattern[p]+' '+str(number[n])]

cnt=int(input())
for i in range(cnt):
    card=input()
    if card in Trunp:
        Trunp.remove(card)

for i2 in range(len(Trunp)):
    print(Trunp[i2])



Measured memory_bytes: 5600
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for (int i = (a); i <= (b); i++)
#define FORD(i,a,b) for (int i = (a); i >= (b); i--)
#define REP(i,a) FOR(i,0,(int)(a)-1)
#define reset(a,b) memset(a,b,sizeof(a))
#define BUG(x) cout << #x << " = " << x << endl
#define PR(x,a,b) {cout << #x << " = "; FOR (_,a,b) cout << x[_] << ' '; cout << endl;}
#define CON(x) {cout << #x << " = "; for(auto i:x) cout << i << ' '; cout << endl;}
#define mod 1000000007
#define pi acos(-1)
#define eps 0.00000001
#define pb push_back
#define sqr(x) (x) * (x)
#define _1 first
#define _2 second

int n, val, ans;

int main() {
  ios::sync_with_stdio(false);
  cin >> n;
  while (n--) {
  	cin >> val;
  	ans += val % 2;
  }
  if (ans & 1) cout << "NO";
  else cout << "YES";
}

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

using namespace std;

int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    long double N, D, ans=0; 
    cin >> N >> D;
    for (int i = 0; i<N; ++i) {
        long double x, y;
        cin >> x >> y;
        if (sqrt(x*x + y*y) <= D) ++ans;
    }
    cout << ans;
}

Measured memory_bytes: 3864
use proconio::{input, fastout};
use std::collections::HashMap;

#[fastout]
fn main() {
    input! {
        n: usize,
        aa: [usize; n],
    }

    let mut ff = vec![];
    let mut is_pairwise = true;
    let mut g = aa[0];

    let max = aa.iter().copied().max().unwrap();
    let primes = sieve((max as f64).sqrt().ceil() as usize);

    for &a in aa.iter() {
        g = gcd(g, a);
        ff.push(factors(a, &primes));
    }

    let mut used = vec![false; 1_000_001];
    for f in ff.iter() {
        for (&k, _) in f.iter() {
            if used[k] {
                is_pairwise = false;
            }
            used[k] = true;
        }
    }


    if g != 1 {
        println!("not coprime");
    } else if is_pairwise {
        println!("pairwise coprime");
    } else {
        println!("setwise coprime");
    }
}

fn factors(n: usize, primes: &[usize]) -> HashMap<usize, usize> {
    let mut factors = HashMap::new();
    let mut r = n;
    for &i in primes.iter() {
        while r % i == 0 {
            *factors.entry(i).or_insert(0) += 1;
            r /= i;
        }
    }
    if r > 1 {
        *factors.entry(r).or_insert(0) += 1;
    }

    factors
}

fn sieve(n: usize) -> Vec<usize> {
    let mut primes = vec![];
    let mut is_prime = vec![true; n + 1];
    for i in 2..n+1 {
        if !is_prime[i] {
            continue;
        }
        primes.push(i);
        for j in i..n/i+1 {
            is_prime[i * j] = false;
        }
    }
    primes
}

fn gcd(a: usize, b: usize) -> usize {
    if a % b == 0 {
        b
    } else {
        gcd(b, a % b)
    }
}


Measured memory_bytes: 227960
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define all(x) x.begin(), x.end()
#define MOD 1000000007
#define vi vector < int >
#define pii pair < int, int >
#define INF (int)1e9
#define pb push_back
#define fastIO ios::sync_with_stdio(0); cin.tie(0);

vector < vi > skills;
int n, m, x;

int dpSol(int i, bool ch, vi &gain)
{
    if(i > n)
    {
        for(int j = 1; j <= m; ++j)
            if(gain[j] < x)
                return INT_MAX;
        return 0;
    }
    
    if(ch == 0)
        return min(dpSol(i + 1, 0, gain), dpSol(i + 1, 1, gain));
    
    for(int j = 1; j <= m; ++j)
        gain[j] += skills[i][j];
       
    int temp = min(dpSol(i + 1, 0, gain), dpSol(i + 1, 1, gain));
    if(temp == INT_MAX)
    {
        for(int j = 1; j <= m; ++j)
            gain[j] -= skills[i][j];
        return INT_MAX;
    }
    // cout << i << " " << ch << " ";
    // for(int j = 1; j <= m; ++j)
    //     cout << gain[j] << " ";
    // cout << endl;
    // cout << endl;
    
    for(int j = 1; j <= m; ++j)
        gain[j] -= skills[i][j];
    return skills[i][0] + temp;
}

int main()
{
    fastIO
    
    cin >> n >> m >> x;
    skills = vector < vi >(n + 1, vi(m + 1));
    
    for(int i = 1; i <= n; ++i)
        for(int j = 0; j <= m; ++j)
            cin >> skills[i][j];
        
    vi gain(13);
    int ans = min(dpSol(1, 0, gain), dpSol(1, 1, gain));
    if(ans == INT_MAX)
        cout << "-1";
    else
        cout << ans;

    return 0;
}

Measured memory_bytes: 3656
// ConsoleApplication1.cpp : アプリケーションのエントリ ポイントを定義します。
//

//#include "stdafx.h"

#include <iostream>
#include <string>
#include <cmath>
#include <algorithm>
#include <functional>

//088 B

using namespace std;
int main()
{
	int N;
	int a[100];
	cin >> N;
	for (int i = 0; i < N; ++i) cin >> a[i];

	sort(a, a + N, greater<int>());
	int Alice = 0;
	int Bob = 0;
	for (int i = 0; i < N; ++i) {
		if (i % 2 == 0) {
			Alice += a[i];
		}
		else Bob += a[i];
	}
	cout << Alice - Bob << endl;

	return 0;
}



Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(){
	double a, b;
	cin >> a >> b;
	
	double num = (a + b) / 2.0;
	int ans = (a + b) / 2;
	
	if(num - ans != 0){
		ans++;
	}
	cout << ans << endl;
}

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

#define repd(i,a,b) for (int i=(a);i<(b);i++)
#define rep(i,n) repd(i,0,n)
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; }
typedef long long ll;

const long long INF = 1LL << 60;

int main()
{
    string S;
    cin >> S;
    bool flag = true;
    repd(i, 1, S.size()) {
        if (S[i] == S[i-1]) {
            flag = false;
            break;
        }
    }

    cout << (flag ? "Good" : "Bad") << endl;
    return 0;
}

Measured memory_bytes: 256
/*
 * cpp_filepath
 */

// C++ 14
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cstring> // memset
#include <cassert>
using namespace std;
#define ll long long
#define loop(__x, __start, __end) for(int __x = __start; __x < __end; __x++)
template <class T> ostream & operator << (ostream & out, vector<T> const & v) {
  for (auto &&a: v) out << a << " "; out << endl; return out;
}
template <class T> void dump(T &a) { cout << a << endl; }
void solve();
int main() { solve(); return 0; }


void solve() {
  cout.precision(15); cout << fixed;
  int n;
  cin >> n;
  if (n==1) {
    cout << 1 << endl;
    return;
  }
  
  if (n%2 == 0) {
    cout << 0.5 << endl;
    return;
  }
  
  double o = (double)(n+1)/2;
  cout << o/(double)n << endl;  
}


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

int main() {
  vector<long long> l(87);
  l[0] = 2;
  l[1] = 1;
  
  for(int i=2; i<=86; i++){
    l[i] = l[i-1] + l[i-2];
  }
  
  int n;
  cin >> n;
  
  cout << l[n] << endl;
	return 0;
}


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

int N;
int A[100000];

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

	cin >> N;
	map<int, int> m;
	for(int i = 0; i < N; i++){
		cin >> A[i];
		m[A[i] - 1]++;
		m[A[i]]++;
		m[A[i] + 1]++;
	}

	int ans = 0;
	for(auto v : m){
		ans = max(ans, v.second);
	}
	cout << ans << endl;
}


Measured memory_bytes: 5120
#include <bits/stdc++.h>
using namespace std;
#define modulo 998244353
#define mod(mod_x) ((((long long)mod_x+modulo))%modulo)
#define Inf 1000000000


int main(){
	
	double X;
	cin>>X;
	double eps = 1e-8;
	
	int ans = 0;
	double now = 0.0;
	double PI = acos(-1.0);
	
	double nx = 0.0,ny = 0.0;
	for(int i=0;true;i++){
		nx += cos(now);
		ny += sin(now);
		if(abs(nx)<eps&&abs(ny)<eps){
			cout<<i+1<<endl;
			return 0;
		}
		now += X / 180.0 * PI;
	}
	
	return 0;
}

Measured memory_bytes: 4096
/*
 * http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ALDS1_3_A&lang=jp
 */
import java.util.*;

public class Main {
	void run() {
		Scanner scan = new Scanner(System.in);
		int[] stack = new int[200];
		int sp = 0;
		while (scan.hasNext()) {
			String tok = scan.next();
			if (tok.equals("+")) {
				int b = stack[--sp];
				int a = stack[--sp];
				stack[sp++] = a + b;
			} else if (tok.equals("-")) {
				int b = stack[--sp];
				int a = stack[--sp];
				stack[sp++] = a - b;
			} else if (tok.equals("*")) {
				int b = stack[--sp];
				int a = stack[--sp];
				stack[sp++] = a * b;
			} else {
				int x = Integer.parseInt(tok);
				stack[sp++] = x;
			}
			//System.out.println(sp);
		}
		System.out.println(stack[0]);
	}
	public static void main(String[] args) {
		new Main().run();
	}
}



Measured memory_bytes: 26264
#include <stdio.h>

int main(void)
{
	int x, n;
	int i,j,k;
	int count=0;

	while(1){
		scanf("%d %d", &n, &x);
		if(n==0 && x == 0)
			break;
		for(i=1; i<n-1; i++){
			for(j=i+1; j<n; j++){
				for(k=j+1; k<=n; k++){
					if(i+j+k == x)
						count++;
				}
			}
		}
		printf("%d\n", count);
		count =0;
	}
	return 0;
}

Measured memory_bytes: 600
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		while(true) {
			String[] x = sc.nextLine().split("");
			
			if(x[0].equals("0")){
				break;
			}
			
			int sum = 0;
			for(int i=0; i<x.length; i++){
				sum += Integer.parseInt(x[i]);
			}
			
			System.out.println(sum);
		}
	}

}

Measured memory_bytes: 27352
import sys

read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
MOD = 1000000007


def main():
    N = int(readline())

    def rec(vec):
        if vec and int(''.join(vec)) > N:
            return 0
        ans = 0
        if all(c in vec for c in '357'):
            ans += 1
        for c in '357':
            vec.append(c)
            ans += rec(vec)
            vec.pop()
        return ans

    ans = rec([])
    print(ans)
    return


if __name__ == '__main__':
    main()


Measured memory_bytes: 9132
#include <bits/stdc++.h>
 
#ifndef LOCAL_
#define fprintf if( false ) fprintf
#endif // LOCAL_
#define dump() fprintf(stderr, "#%s.%d\n", __func__, __LINE__);
#define dumpl(x1) fprintf(stderr, "#%s.%d (%s) = (%ld)\n", __func__, __LINE__, #x1, x1);
#define dumpll(x1, x2) fprintf(stderr, "#%s.%d (%s, %s) = (%ld, %ld)\n", __func__, __LINE__, #x1, #x2, x1, x2);
#define dumplll(x1, x2, x3) fprintf(stderr, "#%s.%d (%s, %s, %s) = (%ld, %ld, %ld)\n", __func__, __LINE__, #x1, #x2, #x3, x1, x2, x3);
#define dumpd(x1) fprintf(stderr, "#%s.%d (%s) = (%lf)\n", __func__, __LINE__, #x1, x1);
#define dumpdd(x1, x2) fprintf(stderr, "#%s.%d (%s, %s) = (%lf, %lf)\n", __func__, __LINE__, #x1, #x2, x1, x2);
#define loop for(;;)
typedef int64_t Int;
typedef std::vector<Int> LI;
const double pi = 3.14159265358979323846264338;
const Int mod = 1000000007;
 
template<typename T> void scan1(T& x) { fprintf(stderr, "unknown type\n"); }
template<> void scan1(Int& x) { if( scanf("%" PRId64, &x) < 0 ) exit(0); }
template<> void scan1(std::string& x) { if( not ( std::cin >> x ) ) exit(0); }
template<> void scan1(LI& xs) { for(Int &x : xs) scan1(x); }
void scan() {}
template<typename Head, typename... Tail>
void scan(Head& x, Tail&... xs) {
  scan1(x); scan(xs...);
}
 
template<typename T>
struct Maybe {
   T x;
   bool valid;
   Maybe() : valid(false) {}
   Maybe(T x_) : x(x_), valid(true) {}
   operator T() const {
      assert( valid );
      return x;
   }
};
 
struct Solver {
   Solver() { fprintf(stderr, "--------Solver begin--------\n"); }
   ~Solver() { fprintf(stderr, "--------Solver end--------\n"); }
   void solve() {
      Int n, k; scan(n, k);
      Int xs[16];
      xs[0] = 1;
      for(Int i = 1; i < 16; ++i) {
         xs[i] = std::min(xs[i-1] * 2, xs[i-1] + k);
      }
      printf("%ld\n", xs[n]);
   }
};
 
int main() {
   loop std::unique_ptr<Solver>(new Solver())->solve();
}
 


Measured memory_bytes: 384
// https://atcoder.jp/contests/abc138/tasks/abc138_c
//
#![allow(unused_imports)]
use std::io::*;
use std::fmt::*;
use std::str::*;
use std::cmp::*;
use std::collections::*;

macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};

    ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($iter, $t);
        input_inner!{$iter $($r)*}
    };
}

macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };

    ($iter:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
    };

    ($iter:expr, chars) => {
        read_value!($iter, String).chars().collect::<Vec<char>>()
    };

    ($iter:expr, usize1) => {
        read_value!($iter, usize) - 1
    };

    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}

#[allow(unused_macros)]
macro_rules! dvec {
    ($t:expr ; $len:expr) => {
        vec![$t; $len]
    };

    ($t:expr ; $len:expr, $($rest:expr),*) => {
        vec![dvec!($t; $($rest),*); $len]
    };
}

#[allow(unused_macros)]
macro_rules! debug {
    ($($a:expr),*) => {
        println!(concat!($(stringify!($a), " = {:?}, "),*), $($a),*);
    }
}

fn main() {
    input! {
        n: usize, v: [i64; n]
    };

    let mut v = v;
    v.sort();
    let v = v.into_iter().map(|z| z as f64).collect::<Vec<_>>();

    let mut total = v[0];
    for i in 1..n {
        total = (total + v[i]) / 2.0f64;
    }
    println!("{:.9}", total);
}


Measured memory_bytes: 4352
#include<stdio.h>
int main(void){
long long int H, W;
scanf("%lld%lld",&H, &W);
if(H==1 || W==1){
printf("1\n");
}else if(H%2==1 && W%2==1 ){
printf("%lld\n", (H*W)/2+1);
}else{
printf("%lld\n", (H*W)/2);   
}
return 0;
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
void rd(int &x){
  int k, m=0;
  x=0;
  for(;;){
    k = getchar_unlocked();
    if(k=='-'){
      m=1;
      break;
    }
    if('0'<=k&&k<='9'){
      x=k-'0';
      break;
    }
  }
  for(;;){
    k = getchar_unlocked();
    if(k<'0'||k>'9'){
      break;
    }
    x=x*10+k-'0';
  }
  if(m){
    x=-x;
  }
}
void wt_L(int x){
  char f[10];
  int m=0, s=0;
  if(x<0){
    m=1,
    x=-x;
  }
  while(x){
    f[s++]=x%10,
    x/=10;
  }
  if(!s){
    f[s++]=0;
  }
  if(m){
    putchar_unlocked('-');
  }
  while(s--){
    putchar_unlocked(f[s]+'0');
  }
}
int ketawa(int x){
  int ret=0;
  while (x){
    ret += x%10;
    x /= 10;
  }
  return ret;
}
int main(){
  int a, ans=0, b, i, n;
  rd(n);
  rd(a);
  rd(b);
  for(i=0;i<n+1;i++){
    if (a <= ketawa(i) && ketawa(i) <= b){
      ans += i;
    }
  }
  wt_L(ans);
  putchar_unlocked('\n');
  return 0;
}
// cLay varsion 20170910-1

// --- original code ---
// int ketawa(int x) {
//   int ret = 0;
//   while (x) {
//     ret += x%10;
//     x /= 10;
//   }
//   return ret;
// }
// {
//   int n, a, b;
//   rd(n, a, b);
//   int ans = 0;
//   rep(i,n+1) {
//     if (a <= ketawa(i) && ketawa(i) <= b) ans += i;
//   }
//   wt(ans);
// }

Measured memory_bytes: 256
#include <iostream>
using namespace std;
#define MAX 500000
#define SENTINEL 2000000000

int L[MAX/2+2], R[MAX/2+2];
int cnt;

void merge(int A[], int n, int left, int mid, int right){
	int n1 = mid - left;
	int n2 = right - mid;
	for(int i = 0; i < n1; i++)L[i] = A[left + i];
	for(int i = 0; i < n2; i++)R[i] = A[mid + i];
	L[n1] = R[n2] = SENTINEL;
	int i = 0, j = 0;
	for(int k = left; k < right; k++){
		cnt++;
		if(L[i] <= R[j]){
			A[k] = L[i++];
		}else{
			A[k] = R[j++];
		}
	}
}

void mergeSort(int A[],int n,int left, int right){
	if(left+1 < right){
		int mid = (left + right) / 2;
		mergeSort(A, n, left, mid);
		mergeSort(A, n, mid, right);
		merge(A, n, left, mid, right);
	}
}

int main(){
	int A[MAX], n,i;
	cnt = 0;
	
	cin >> n;
	for(i = 0; i < n; i++)cin >>A[i];
	
	mergeSort(A, n, 0, n);
	
	for(i = 0; i < n; i++){
		if(i)cout << " ";
		cout << A[i];
	}
	cout << endl;
	
	cout << cnt << endl;
	
	return 0;
}





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

long long MOD=1000000007;

int main(){
  long long N; cin >> N;
  //A=0, C=1, G=2, T=3として64通り
  long long dp[64][110]={};
  
  for(int i=0; i<64; i++){
    //N=3のとき
    //ACG,AGC,GACは除く
    if(i==6||i==9||i==33) dp[i][3]=0;
    else dp[i][3]=1;
  }
  
  for(int len=4; len<=N; len++){
    for(int i=0; i<64; i++){
      dp[i][len]=0;
      if(!(i==6||i==9||i==33)){ //ACG,AGC,GACは除く
        //*GCのとき、A*GCを除く
        //G*Cのとき、AG*Cを除く
        //それ以外、普通に足す
        if(i%16==9||(i/16==2&&i%4==1)){
          int ii=i/4;
          for(int j=1; j<4; j++){
            dp[i][len]+=dp[j*16+ii][len-1];
            dp[i][len]%=MOD;
          }
        }else{
          int ii=i/4;
          for(int j=0; j<4; j++){
            dp[i][len]+=dp[j*16+ii][len-1];
            dp[i][len]%=MOD;
          }
        }
      }
    }
  }
  
  long long result=0;
  for(int i=0; i<64; i++){
    result+=dp[i][N];
    result%=MOD;
  }
  cout << result << endl;
}

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

typedef long long ll;
typedef vector<long long> VLL;
typedef vector<pair<int,int>> VP;
#define INF (int)(1e9)
#define MAXX 1.1529215e+18
#define inf 999999
#define EPS (1e-7)
#define MOD (1e9+7)
#define rep(i,n) for(int i=0; i<(int)(n);i++)
#define REP(i,n) for(int i=1;i<=(int)(n);i++)
#define FOR(i,k,n) for(int i=(k);i<(int)(n);i++)
#define ALL(a)  a.begin(),a.end()
#define RALL(a) a.begin(),a.end(),greater<int>()
#define ROT(a) a.begin(),a.begin()+1,a.end()
#define RROT(a) a.begin(),a.end()-1,a.end()
#define PB push_back
#define MP make_pair
#define PI acos(-1.0)
template<typename T1, typename T2> inline bool chmin(T1 &a, T2 b) { if (a > b) { a = b; return 1; } return 0; }
template<typename T1, typename T2> inline bool chmax(T1 &a, T2 b) { if (a < b) { a = b; return 1; } return 0; }
template<typename T> T gcd(T a, T b) { if (b == 0) return a; return gcd(b, a % b); }
/*--------------------------------------------*/


ll n;
int dim;
int ans = 0;

void dfs(int d,int x,int c3,int c5,int c7,int c0){
  if(d == dim){
    if(x <= n && c3*c5*c7 != 0){
      ans++;
    }
  }else{
    if(c0==d) dfs(d+1,0,c3,c5,c7,c0+1);
  	dfs(d+1,10*x+3,c3+1,c5,c7,c0);
  	dfs(d+1,10*x+5,c3,c5+1,c7,c0);
  	dfs(d+1,10*x+7,c3,c5,c7+1,c0);
  }
}


int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
    
  cin >> n;
  
  dim = to_string(n).size();

 
  dfs(0,0,0,0,0,0);
  
  cout << ans << endl;
  
  
}
  
  


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using P = pair<int, int>;

const int M = 1000000007;

int main() {
    int w, h, n;
    cin >> w >> h >> n;
    vector<P> p(n + 2);
    for (int i = 0; i < n; ++i) {
        cin >> p[i].first >> p[i].second;
    }
    int S = n, T = n + 1;
    p[S] = P(1, 1);
    p[T] = P(w, h);
    priority_queue<pair<int, P>, vector<pair<int, P>>, greater<pair<int, P>>> q;
    vector<vector<int>> dists(n + 2, vector<int>(1010, 2000));
    dists[S][0] = 0;
    q.push(make_pair(0, P(S, 0)));
    while (!q.empty()) {
        pair<int, P> pp = q.top();
        q.pop();
        int c = pp.first;
        int i = pp.second.first;
        int r = pp.second.second;
        for (int j = 0; j < n; ++j) {
            if (i == j) continue;
            int nr = max(0, abs(p[i].first - p[j].first) + abs(p[i].second - p[j].second) - r);
            if (i < n && nr > 0) {
                --nr;
            }
            if (dists[j][nr] > c + nr) {
                dists[j][nr] = c + nr;
                q.push(make_pair(c + nr, P(j, nr)));
            }
        }
    }
    vector<vector<int>> distt(n + 2, vector<int>(1010, 2000));
    distt[T][0] = 0;
    q.push(make_pair(0, P(T, 0)));
    while (!q.empty()) {
        pair<int, P> pp = q.top();
        q.pop();
        int c = pp.first;
        int i = pp.second.first;
        int r = pp.second.second;
        for (int j = 0; j < n; ++j) {
            if (i == j) continue;
            int nr = max(0, abs(p[i].first - p[j].first) + abs(p[i].second - p[j].second) - r);
            if (i < n && nr > 0) {
                --nr;
            }
            if (distt[j][nr] > c + nr) {
                distt[j][nr] = c + nr;
                q.push(make_pair(c + nr, P(j, nr)));
            }
        }
    }
    int ans = 2000;
    for (int i = 0; i < n; ++i) {
        for (int j = 0; j < 1010; ++j) {
            if (j > 0) {
                dists[i][j] = min(dists[i][j], dists[i][j - 1] + 1);
                distt[i][j] = min(distt[i][j], distt[i][j - 1] + 1);
            }
            ans = min(ans, dists[i][j] + max(0, abs(p[T].first - p[i].first) + abs(p[T].second - p[i].second) - j));
            ans = min(ans, distt[i][j] + max(0, abs(p[S].first - p[i].first) + abs(p[S].second - p[i].second) - j));
        }
    }
    for (int i = 0; i < n; ++i) {
        for (int j = 0; j < n; ++j) {
            if (i == j) continue;
            int d = abs(p[i].first - p[j].first) + abs(p[i].second - p[j].second) - 1;
            for (int k = 0; k <= d; ++k)
                ans = min(ans, dists[i][k] + distt[j][d - k]);
        }
    }
    cout << ans << "\n";
    return 0;
}



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

int main(){
    int n,ans = 0;
    cin >> n ;
    vector<int> risa(n);
    for (int i = 0;i < n;i++){
        cin >> risa.at(i) ;
    }
    int risassa = risa.at(0);
    for(int i = 0;i <n;i++){
        if(risassa >= risa.at(i)){
            ans++;
        }
        if(risassa > risa.at(i)){
            risassa = risa.at(i);
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 1024
import java.util.List;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Scanner;
import java.util.stream.Collectors;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        long H = sc.nextLong();
        sc.close();
        long count = atackEnemy(H);

        System.out.println(count);
    }

    public static long atackEnemy(Long H) {
        if (H.equals(1L)) {
            return 1;
        } else {
            long newHp = H / 2;
            return 2 * atackEnemy(newHp) + 1;
        }
    }

}

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

#define pb push_back
#define mp make_pair
#define f1 first
#define s2 second

#define fastio ios :: sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define debug(x...) cerr << "[" << #x << "]: " << x << "\n";

typedef long long ll;
typedef long double ld;
typedef pair<int, int> ii;
typedef pair<ll, ll> pl;

ld const PI = 4*atan((ld)1);

int main()
{
	fastio;

	int n;
	cin >> n;

	int ar[107];
	for (int i = 0; i < n; ++i)
		cin >> ar[i];
	sort(ar, ar+n);

	int res = 0;
	for (int i = 0; i < n; ++i)
	{
		for (int j = i+1; j < n; ++j)
		{
			for (int k = j+1; k < n; ++k)
			{
				if (ar[i] != ar[j] && ar[i] != ar[k] && ar[j] != ar[k] && ar[i] + ar[j] > ar[k])
					res++;
			}
		}
	}
	cout << res << '\n';

	return 0;
}


Measured memory_bytes: 3668
# coding: utf-8

import sys
import math
import collections
import itertools
import bisect
INF = 10 ** 13
MOD = 10 ** 9 + 7
def input() : return sys.stdin.readline().strip()
def gcd(x, y) : return x if y == 0 else gcd(y, x%y)
def lcm(x, y) : return (x * y) // gcd(x, y)
def I() : return int(input())
def LI() : return [int(x) for x in input().split()]
def RI(N) : return [int(input()) for _ in range(N)]
def LRI(N) : return [[int(x) for x in input().split()] for _ in range(N)]
def LS() : return input().split()
def RS(N) : return [input() for _ in range(N)]
def LRS(N) : return [input().split() for _ in range(N)]
def PL(L) : print(*L, sep="\n")
def YesNo(B) : print("Yes" if B else "No")
def YESNO(B) : print("YES" if B else "NO")

X = LI()
print(X.index(0)+1)


Measured memory_bytes: 67204
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
#define mfill(x,y) memset(x,y,sizeof(x))
#ifdef LOCAL
#define eprintf(...) fprintf(stderr,__VA_ARGS__)
#else
#define eprintf(...) 42
#endif
#define y0 y12345
#define y1 y54321
typedef unsigned long ul;
typedef long long ll;
//typedef pair<int, int> mpair;
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(a>b){a=b;return 1;}return 0;}
using namespace std;

int main() {
	cin.tie(0);
   	ios::sync_with_stdio(false);
   	ul w,h,x,y;
	cin>>w>>h>>x>>y;
	if(2*x == w && 2*y == h){
		cout << (double)w*(double)h /2.0 << " 1" << endl;
	}else{
		cout << (double)w*(double)h /2.0 << " 0" << endl;
	}
	
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define sz(x) ((int) (x).size())
#define forn(i,n) for (int i = 0; i < int(n); ++i)
typedef long long ll;
typedef long long i64;
typedef long double ld;
const int inf = int(1e9) + int(1e5);
const ll infl = ll(2e18) + ll(1e10);

const int maxn = 100100;
int a[maxn];

int main() {
    #ifdef LOCAL
    assert(freopen("b.in", "r", stdin));
    #else
    #endif
    int n, k;
    cin >> n >> k;
    forn (i, k) {
        cin >> a[i];
    }
    sort(a, a + n);
    int x = a[n - 1];
    int y = n - x;
    if (x > y + 1) {
        cout << (x - y - 1) << '\n';
    } else
        cout << 0 << '\n';
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n; ++i)
#define REPR(i, n) for (int i = n - 1; i >= 0; --i)
#define FOR(i, a, b) for (int i = a; i < b; ++i)
#define FORR(i, a, b) for (int i = b - 1; i >= a; --i)
#define SORT(v) sort(v.begin(), v.end())
#define SORTR(v) sort(v.rbegin(), v.rend())
#define REV(v) reverse(v.begin(), v.end())
#define ITER(itr, v) for (auto itr = v.begin(); itr != v.end(); ++itr)
#define LB(v, x) (lower_bound(v.begin(), v.end(), x) - v.begin())
#define UB(v, x) (upper_bound(v.begin(), v.end(), x) - v.begin())
#define SZ(v) (int)v.size()
using namespace std;
using ll = long long;
using P = pair<int, int>;

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

	int A, B, H, M;
	cin >> A >> B >> H >> M;
	double theta = abs(H * 30 + 30 * M / 60.0 - M * 6);
	double pi = atan(1) * 4;
	theta *= pi / 180;
	double res = sqrt(A * A + B * B - 2 * A * B * cos(theta));
	cout << fixed << setprecision(15) << res << endl;

	return 0;
}


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

using namespace std;
typedef long long ll;

#define REP(i, n) for (ll i = 0; i < (n); i++)
#define REPR(i, n) for (ll i = (n); i >= 0; i--)
#define FOR(i, m, n) for (ll i = (m); i < (n); i++)
#define FORR(i, m, n) for (ll i = (m); i >= (n); i--)
#define INF 1e9
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) ((ll)(x).size())
#define SORT(x) sort((x).begin(), (x).end())
#define dump(x) cerr << #x << " = " << (x) << endl
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" \
                      << " " << __FILE__ << endl

int main(int argc, char const *argv[])
{
    ll H, W, h, w;
    cin >> H >> W;
    cin >> h >> w;
    cout << (H - h) * (W - w) << endl;
    return 0;
}


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

#define ff first
#define ss second
#define PI acos(-1)
#define pb push_back
#define int long long
#define ld long double
#define sp fixed<<setprecision
#define bp __builtin_popcountll
#define all(x) x.begin(),x.end()
#define pii pair<long long,long long>
#define FAST ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);

const int M = (1e9)+7;
const int N = 1e6+5;

signed main()
{
    FAST
    int tc=1;
    //cin>>tc;
    for(int ti=1;ti<=tc;ti++)
    {
        string s;
        cin>>s;
        int ans = 0;
        for(int i=0;i<3;i++)ans += s[i]== 'R';
        if(ans == 2 && s[1] == 'S')ans--;
        cout<<ans<<endl;
    }
    return 0;
}


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

int main(){
  int a, b[20], c[20], ans;
  cin >> a;
  for ( int i = 0; i < a; i++ ) {
    cin >> b[i];
  }
  for ( int i = 0; i < a; i++ ) {
    cin >> c[i];
  }
  ans = 0;
  for ( int i = 0; i < a; i++ ) {
    if (b[i] > c[i]) {
      ans += b[i] - c[i];
    }
  }
  
  cout << ans << endl;
}

Measured memory_bytes: 256
from collections import deque


def main():
    n = int(raw_input())
    xs = (int(x) for x in raw_input().split())

    side = 0
    q = deque()

    for x in xs:
        if side == 0:
            q.append(x)
        else:
            q.appendleft(x)

        side = not side

    while q:
        if side == 0:
            print q.popleft(),
        else:
            print q.pop(),


if __name__ == "__main__":
    main()




    



Measured memory_bytes: 57564