akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define mod 998244353
#define IO ios::sync_with_stdio(false);cin.tie(0);cout.tie(0)
const int inf = 0x3f3f3f3f;
const ll INF = 0x3f3f3f3f3f3f3f3f;
const int maxn  = 1e5+5;
typedef struct node{
    int x, y;
}node;
node a[1000005];
int top,topp,h,w,cnt,toppp;
int vis[1005][1005];
char m[1005][1005];
void bfs(){
    topp=top; toppp=1;
    while(top<h*w){
        for(int i=toppp;i<=top;i++){
            if(!vis[a[i].x+1][a[i].y] && a[i].x+1<=h){
                vis[a[i].x+1][a[i].y]=1;
                a[++topp]=node{a[i].x+1,a[i].y};
            }
            if(!vis[a[i].x-1][a[i].y] && a[i].x-1>=1) {
                vis[a[i].x-1][a[i].y]=1;
                a[++topp]=node{a[i].x-1,a[i].y};
            }
            if(!vis[a[i].x][a[i].y+1] && a[i].y+1<=w){
                vis[a[i].x][a[i].y+1]=1;
                a[++topp]=node{a[i].x,a[i].y+1};
            }
            if(!vis[a[i].x][a[i].y-1] && a[i].y-1>=1){
                vis[a[i].x][a[i].y-1]=1;
                a[++topp]=node{a[i].x,a[i].y-1};
            }
        }
        toppp=top;
        top=topp;
        cnt++;
    }
    cout << cnt << endl;
}
int main(){
    cin >> h >> w;
    for(int i=1;i<=h;i++){
        for(int j=1;j<=w;j++){
            cin >> m[i][j];
            if(m[i][j]=='#') a[++top]=node{i,j},vis[i][j]=1;
        }
    }
    bfs();
    return 0;
}


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

int main() {
	int N, count;
	cin>>N>>count;
	int arr[N];
	for (int i=0; i<N; i++){
		cin >> arr[i];
	}
	sort (arr, arr+N);
	//string a = "abc";
	//reverse(a.begin(), a.end());
	//cout << a << endl;
	//for (int i=0; i<N; i++){
	//	cout << arr[i];
	//}cout << endl;
	int sum=0;
	for (int i=N-1; i>=N-count; i--){
		sum+=arr[i];
	}
	cout << sum << endl;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <string>
#include <algorithm>
#include <set>
#include <map>
#include <vector>
#include <iostream>
#include <math.h>
#include <bitset>
#include <iomanip>
#include <queue>
#include <cstring>
using namespace std;

int main() {
	int N,ans=0; cin >> N;
	vector<int> a(N);
	for (int i = 0; i < N; i++) {
		int z;
		cin >> z; a[i] = z;
	}
	int x=1,b=0;
	bool r = 0;
	for (int i = 0; i < N; i++) {
		if (a[i] == 1) {
			x = 1; b = 0; r = 1;
		}
		if (x == a[i]) {
			x++; b++;
			ans = max(b, ans);
		}
	}
	if(r==1)cout << N-ans << endl;
	else cout << -1 << endl;
}





Measured memory_bytes: 1024
#include<stdio.h>
#define min(x,y) (((x)<(y))?(x):(y))
int main (){
    long long int n,m,br=0,i;
    scanf ("%lld", &n);
    long long int a[n+1];
    long long int b [n];
    for (i=0;i<n+1;i++) 
        scanf("%lld", &a[i]);
    for (i=0;i<n;i++) 
        scanf ("%lld", &b[i]);
    for (i=0;i<n;i++){
        long long int x=min(a[i],b[i]);
        a[i]-=x;
        b[i]-=x;
        br+=x;
        
        x=min(a[i+1],b[i]);
        b[i]-=x;
        a[i+1]-=x;
        br+=x;
        


    }
    printf ("%lld", br);

    
    return 0;
}

Measured memory_bytes: 1664
#include <iostream>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <functional>
#include <bitset>

using namespace std;
using lint = long long int;
long long int INF = 1001001001001001LL;
int inf = 1000000007;
long long int MOD = 1000000007LL;
double PI = 3.1415926535897932;

template<typename T1,typename T2>inline void chmin(T1 &a,const T2 &b){if(a>b) a=b;}
template<typename T1,typename T2>inline void chmax(T1 &a,const T2 &b){if(a<b) a=b;}

#define ALL(a) a.begin(),a.end()
#define RALL(a) a.rbegin(),a.rend()

/* do your best */

int main() {
  
  int n; cin >> n;
  vector<lint> a(n);
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  sort(RALL(a));
  int cnt = n - 2;
  lint ans = a[0];
  for (int i = 1; i < n; i++) {
    if (cnt >= 2) {
      ans += a[i] * 2;
      cnt -= 2;
    } else if (cnt == 1) {
      ans += a[i];
      cnt--;
    } else {
      break;
    }
  }

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


Measured memory_bytes: 4840
#include<bits/stdc++.h>
#define ll long long
#define F(i,n) for(int i=0;i<n;i++)
#define pb push_back
#define i64 int64_t
#define fi first
#define se second
using namespace std;
int main()
{
	ios::sync_with_stdio(0);cin.tie(0);
	int n;
	cin>>n;
	if(n%2==0)
		cout<<(n/2);
	else
		cout<<(n/2+1);
}

Measured memory_bytes: 256
open System

[<EntryPoint>]
let main _argv =
    let _input = stdin.ReadLine()
    let inputNumbers = stdin.ReadLine().Split(' ') |> Array.map int |> Array.toList
    let rec divide count nums = 
        if (List.filter (fun x -> x % 2 > 0) nums).Length > 0 then count else List.map (fun x -> x / 2) nums |> divide (count + 1)
    divide 0 inputNumbers |> printf "%d"
    0
 

Measured memory_bytes: 14044
package main

import (
	"bufio"
	"bytes"
	"fmt"
	"log"
	"os"
	"sort"
	"strconv"
)

func main() {
	log.SetFlags(log.Lshortfile)
	N := nextInt()
	L := nextInt()
	S := make([]string, N)
	for i := 0; i < N; i++ {
		S[i] = nextString()
	}
	sort.Strings(S)
	log.Println(L)
	var out bytes.Buffer
	for i := 0; i < N; i++ {
		out.WriteString(S[i])
	}
	// out.WriteTo(os.Stdin)
	fmt.Println(out.String())
}
func Max(a ...int) int {
	r := a[0]
	for i := 0; i < len(a); i++ {
		if r < a[i] {
			r = a[i]
		}
	}
	return r
}
func Min(a ...int) int {
	r := a[0]
	for i := 0; i < len(a); i++ {
		if r > a[i] {
			r = a[i]
		}
	}
	return r
}
func Sum(a []int) (r int) {
	for i := range a {
		r += a[i]
	}
	return r
}
func Abs(a int) int {
	if a < 0 {
		return -a
	}
	return a
}

type Pair struct {
	a, b int
}

type Pairs []Pair

func (p Pairs) Len() int {
	return len(p)
}
func (p Pairs) Swap(i, j int) {
	p[i], p[j] = p[j], p[i]
}

func (p Pairs) Less(i, j int) bool {
	return p[i].b < p[j].b
}

var nextReader func() string

func init() {
	nextReader = NewScanner()
}

func NewScanner() func() string {
	r := bufio.NewScanner(os.Stdin)
	r.Buffer(make([]byte, 1024), int(1e+11))
	r.Split(bufio.ScanWords)
	return func() string {
		r.Scan()
		return r.Text()
	}
}
func nextString() string {
	return nextReader()
}
func nextInt64() int64 {
	v, _ := strconv.ParseInt(nextReader(), 10, 64)
	return v
}
func nextInt() int {
	v, _ := strconv.Atoi(nextReader())
	return v
}
func nextInts(n int) []int {
	r := make([]int, n)
	for i := 0; i < n; i++ {
		r[i] = nextInt()
	}
	return r
}
func nextFloat64() float64 {
	f, _ := strconv.ParseFloat(nextReader(), 64)
	return f
}


Measured memory_bytes: 768
#include <bits/stdc++.h>
#include <iostream>
#include <vector>
#include <algorithm>
#include <set>
#include <complex>
#include <tuple>

#define FAST ios_base::sync_with_stdio(false); cin.tie(0)
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=int(a);i<int(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define repr(i, a, b) for(int i=int(a); i>=int(b); i--)
#define reps(i,n) for(int i=1;i<=int(n);++i)
#define RREP(i,x) for(int i=((int)(x)-1);i>=0;i--)
#define RREPS(i,x) for(int i=((int)(x));i>0;i--)
#define iceil(x,y) (x+y-1)/y
#define FOR(it,c) for(__typeof((c).begin()) it=(c).begin(); it!=(c).end(); ++it)
#define all(x) (x).begin(),(x).end()
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() )
#define LF "\n"

template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}

int gcd(int a,int b){return b?gcd(b,a%b):a;}

using namespace std;
typedef long long int ll;
typedef unsigned long long int ull;
typedef pair<int, int> PII;
typedef pair<ll, ll> PLL;
typedef pair<int, PII> PP;

ll cl(ll n){
    ll ans=0;
    if(!(n&1)) n++,ans=n;
    ll num=(n+1ll)/2ll;
    if(num&1) ans^=1;
    return ans;
}

int main(){
	FAST;

    ll l,r;cin>>l>>r;

    cout<<(cl(l-1)^cl(r));

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define pi 3.14159265359
#define int long long
#define pii pair<int,int>
const int mod=1e9 + 7;
 
int dx[]={-1, 0, 1, 0};
int dy[]={0, -1, 0, 1};
 


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

 char c;
 cin>>c;
  cout<<(char)(c+1)<<"\n";

}

Measured memory_bytes: 256
import itertools
N, M, Q = map(int,input().split())
P = [list(map(int,input().split())) for i in range(Q)]

A = list(itertools.combinations_with_replacement(range(1,M+1), N))
number = len(A)

amount = 0
max_amount = 0
for i in range(number): #A
    
    for j in range(Q): # P
        bi = P[j][1]
        ai = P[j][0]
        if(A[i][bi-1] - A[i][ai-1] == P[j][2]):
            amount += P[j][3]
        
   # print(amount)
    
   # print(amount)
    if(amount >= max_amount):
        max_amount = amount
    
    amount = 0
    
print(max_amount)

Measured memory_bytes: 21624
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int n,p;
string s;
ll sol()
{
	ll cnt = 0;
	
	if(p == 2|| p == 5)
	{
		for(int i=n-1;i>=0;i--)
			if((int)(s[i] - '0')%p ==0)cnt +=i+1;
	}
	else
	{
		vector <int> pref(n+2);
		pref[n+1] = 0;
		ll b =1;
		for(int i=n;i>=1;i--)
		{
			pref[i] = ((int)(s[i-1]-'0')*b+pref[i+1])%p;
			b = b* 10%p; 
		}
		int rec[10002];
		memset(rec,0,sizeof(rec));
		rec[0] = 1;
		for(int i=n;i>=1;i--)
		{
			cnt +=rec[pref[i]];
			rec[pref[i]]++;
		 } 
		}
	return cnt;
}
int main()
{
	cin>>n>>p>>s;
	cout<<sol()<<endl;
	return 0;
}

Measured memory_bytes: 1412
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<ll,ll>;
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define rep2(i,m,n) for(int (i)=(m);(i)<(n);(i)++)
const ll INF = 1LL<<60;
const ll MOD = 1e9+7;


int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    ll h,w;cin>>h>>w;
    if(h==1||w==1)cout<<1<<endl;
    else cout<<(h*w+1)/2<<endl;
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<set>
#include<algorithm>
using namespace std;
int main()
{
	set<int> p;

	int n;
	cin >> n;
	while (n--)
	{
		int type;
		cin >> type;
		switch (type)
		{
			int num;
		case 0:
			cin >> num;
			p.insert(num);
			cout << p.size() << endl;
			break;
		case 1:
			cin >> num;
			cout << p.count(num) << endl;
			break;
		}
	}
}


Measured memory_bytes: 12356
#include<iostream>
#include<cstdio>
#include<cstring>
using namespace std;
int a,b,c,d,e,f,g,h,m,n,z,x,k[1001],l,o,s,ans,sum,maxa;
char st[11];
int main ( )
{
	gets(st);
	l=strlen(st);o=0;
	for(a=1;a<=l;a++)
	{
		if(st[a-1]=='0'||st[a-1]=='1')
		{
			o++;
			k[o]=st[a-1]-48;
		}
		else
		o=max(o-1,0);
	}
	for(a=1;a<=o;a++)
	cout<<k[a];
	return 0 ;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
  int n;
  long long int sum=0,sum2=0,ans=999999999999;
  cin>>n;
  int a[n];
  for(int i=0;i<n;i++)
  {
    cin>>a[i];
    sum+=a[i];
  }
  sum2=a[0];
  ans=min(ans,abs(sum-2*sum2));
  for(int i=1;i<n-1;i++)
  {
    sum2+=a[i];
    ans=min(ans,abs(sum-2*sum2));
  }
  cout<<ans;
}


Measured memory_bytes: 1024
n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
be = [-1] * n
la = [-1] * n
be2 = [-1] * n
la2 = [-1] * n
for i in range(n):
    if be[a[i] - 1] == -1:
        be[a[i] - 1] = i
    la[a[i] - 1] = i + 1
    if be2[b[i] - 1] == -1:
        be2[b[i] - 1] = i
    la2[b[i] - 1] = i + 1
l, r = 0, 2 * n
for i in range(n):
    if la[i] != -1 and la2[i] != -1:
        l = max(la[i] - be2[i], l)
        r = min(r, be[i] + n - la2[i])
if l > r:
    print('No')
else:
    print('Yes')
    print(*(b[n-l:] + b[:n-l]))


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

int main(void){
    int n;
    cin >> n;
    
    int a[100000], b[100000], c[100000];
    int i;
    for(i = 0; i < n; i++){
        cin >> a[i];
    }
    for(i = 0; i < n; i++){
        cin >> b[i];
    }
    for(i = 0; i < n; i++){
        cin >> c[i];
    }
    
    sort(a, a + n);
    sort(b, b + n);
    sort(c, c + n);
    
    
    long long ab[100000] = {0}, bc[100000] = {0};
    i = 0;
    int j = 0, k = 0;
    while(j < n){
        while(i < n && a[i] < b[j]){
            i++;
        }
        ab[j] = i;
        
        while(c[k] <= b[j]){
            k++;
            if(k == n){
                goto next;
            }
        }
        bc[j] = n - k;
        
        j++;
    }
    
    next:
    long long cnt = 0;
    for(i = 0; i < n; i++){
        cnt += ab[i] * bc[i];
    }
    
    cout << cnt << endl;
    
    return 0;
}


Measured memory_bytes: 3072
#include <bits/stdc++.h>
using namespace std;
int main(){
  int N;
  cin>>N;
  vector<double> x(N);
  vector<string> u(N);
  for(int i=0;i<N;i++){
    cin>>x.at(i)>>u.at(i);
  }
  double sum=0;
  for(int i=0;i<N;i++){
    if(u.at(i)=="JPY"){
      sum += x.at(i);
    }
    if(u.at(i)=="BTC"){
      sum += x.at(i)*380000.0;
    }
  }
  cout<<setprecision(15)<<sum<<endl;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main(int argc, char const *argv[]) {
  int a, b, c;
  cin >> a >> b >> c;

  if ((a + b) == c || (b + c) == a || (c + a) == b) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }

  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
       int t;
       int ct=0;
       cin>>t;
       int a[t],b[t];
       for(int i=0;i<t;i++){
            cin>>a[i]>>b[i];
       }
        for(int i=0;i<t;i++){
               if(a[i]==b[i]) {ct++;
                if(ct==3) break;
               }
                else
                    ct=0;
        }
       if(ct>2) cout<<"Yes"<<endl;
       else
        cout<<"No"<<endl;
}


Measured memory_bytes: 3632
'use strict';

const lines = require("fs").readFileSync("/dev/stdin", "utf8").trim().split("");
const ary = lines.map(str => Number(str));
const length = ary.length;

let sum = [];
for (let i=0; i<length; i++) {
  sum.push(calculator(i));
}
const result = sum.reduce((acc,b) => acc+b);
console.log(result);

function calculator(i) {
  let total = 0;
  if (i===length-1) {
    total += ary[length-1] * Math.pow(2,length-1);
  } else {
    for (let j=0; j<length-i-1; j++) {
      total += ary[i] * Math.pow(2,length-2-j) * Math.pow(10, j);
    }
    total += ary[i] * Math.pow(2, i) * Math.pow(10, length-i-1);
  }
  return total;
};


Measured memory_bytes: 21064
#include <iostream>
#include <algorithm>
#include <vector>

using namespace std;

int main()
{
    vector<int> v[26];
    int h, w;
    int ans[626] = {0};
    int sub = 0;
    int tmp;

    cin >> h >> w;

    for (int i = 0; i < h; i++) {
        for (int k = 0; k < w; k++) {
            cin >> tmp;
            v[i].push_back(tmp);
        }
    }

    for (int i = 0; i < h; i++) {
        for (int k = 0; k < w; k++) {
            vector<int> town[26] = v;

            for (int j = 0; j < h; j++) {
                town[j][k] = 0;
            }

            for (int l = 0; l < w; l++) {
                town[i][l] = 0;
            }

            for (int j = 0; j < h; j++) {
                for (int l = 0; l < w; l++) {
                    ans[sub] += town[j][l] * min(abs(i-j), abs(k-l));
                }
            }
            sub++;
        }
    }

    sort(ans, ans + sub);

    cout << ans[0] << endl;
}



Measured memory_bytes: 3180
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<long long> vll;
typedef vector<bool> vb;
#define pb push_back
#define fi first
#define se second
#define in insert
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define speed ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
const int mod = 1e9 + 7;
void solve(){
    int a, b, c;
    cin >> a >> b >> c;
    if (a == b && a != c) cout << "Yes";
    else if (b == c && a != b) cout << "Yes";
    else if (a == c && a != b) cout << "Yes";
    else cout << "No";
}
int main(){
    speed;
    int t = 1;
    //cin >> t;
    for (int i = 1; i <= t; ++i) {
        solve();
    }
}

Measured memory_bytes: 256
from sys import stderr
from functools import reduce
from collections import defaultdict as dd
from operator import add


def f():
    return [int(i) for i in input().split()]


def yes(n):
    print("Yes" if n else "No")


def debug(*x, sep=" ", end="\n"):
    for item in x:
        stderr.write(str(item))
        stderr.write(sep)
    stderr.write(end)


s = input()
t = input()
pos_s = dd(list)
pos_t = dd(list)

for i, char in enumerate(s):
    pos_s[char].append(i)
for i, char in enumerate(t):
    pos_t[char].append(i)

for key_s, item_s in pos_s.items():
    for key_t, item_t in pos_t.items():
        if item_s == item_t:
            pos_s[key_s] = []
            pos_t[key_t] = []

yes(
    all([len(p) == 0 for p in pos_s.values()]) and all([len(p) == 0 for p in pos_t.values()]))


Measured memory_bytes: 21280
#include<iostream>
#include<algorithm>
#include <iostream> 
#include <algorithm> 
#include<string>
#include<queue>
#include<utility>
#include<fstream>
#include<queue>
#include<set>
#include<stack>
#include<bits/stdc++.h>
#define ll long long int
#define ull unsigned long long int
#define I(a) scanf("%d",&a)
#define I2(a,b) scanf("%d%d",&a,&b)
#define I3(a,b,c) scanf("%d%d%d",&a,&b,&c)
#define L(a) scanf("%lld",&a)
#define L2(a,b) scanf("%lld%lld",&a,&b)
#define L3(a,b,c) scanf("%lld%lld%lld",&a,&b,&c)
#define PI(a) printf("%d",a)
#define PL(a) printf("%lld",a)
#define PT(t) printf("Case %d: ",t)
#define PB push_back
#define x first
#define y second
#define xx first.first
#define xy first.second
#define yx second.first
#define yy second.second
#define SC scanf
#define PC printf
#define NL printf("\n")
#define SET(a) memset(a,0,sizeof a)
#define SETR(a) memset(a,-1,sizeof a)
#define SZ(a) ((int)a.size())-1
#define f(i,a,b) for(int i=a;i<=b; i++)
#define fr(i,a,b) for(int i=a;i<=b; i++)
#define frr(i,a,b) for(int i=a;i>=b; i--)
#define frv(i,a)  for(int i=0;i<a.size();i++)
#define pi 2.0*acos(0.0)
#define R(a) freopen(a, "r", stdin);
#define W(a) freopen(a, "w", stdout);
#define CB(x) __builtin_popcount(x)
#define STN(a) stringtonumber<ll>(a)
#define lol printf("BUG\n")
#define Endl "\n"
#define mk make_pair
using namespace std;
template <class T> inline T BM(T p, T e, T M)
{
    ll ret = 1;
    for(; e > 0; e >>= 1)
    {
        if(e & 1) ret = (ret * p) % M;
        p = (p * p) % M;
    }
    return (T)ret;
}
template <class T> inline T gcd(T a, T b)
{
    if(b == 0)return a;
    return gcd(b, a % b);
}
template <class T> inline T mdINV(T a, T M)
{
    return BM(a, M - 2, M);
}
template <class T> inline T PW(T p, T e)
{
    ll ret = 1;
    for(; e > 0; e >>= 1)
    {
        if(e & 1) ret = (ret * p);
        p = (p * p);
    }
    return (T)ret;
}
 
 
template <class T>bool ISLEFT(T a, T b, T c)
{
    if(((a.xx - b.xx) * (b.yy - c.yy) - (b.xx - c.xx) * (a.yy - b.yy)) < 0.0)return 1;  //Uporer dike //A,b,c, x okkher ordera sorted
    else return 0;
}
 
 
typedef pair<int,int >P;
//////////////////////////
/////////////////////////
int main(){

    int x,y;
    cin>>x>>y;
    int res = max(x,y);
    if(x==res)x--;
    else y--;
    res += max(x,y);
    cout<<res<<Endl;

    return 0;
}

Measured memory_bytes: 256
def gcd(a, b):
    if b==0:
        return a
    else:
        return gcd(b, a%b)
a, b, c = map(int, input().split())
maxi = gcd(a,b)
num = []
for i in range(1,maxi+1):
    if maxi % i ==0:
        num.append(i)
print(num[-c])

Measured memory_bytes: 3060
// 2013/09/10 Tazoe

#include <iostream>
using namespace std;

int main()
{
	int p1, p2, p3, j1, j2;
	cin >> p1;
	cin >> p2;
	cin >> p3;
	cin >> j1;
	cin >> j2;

	int p = p1;
	if(p>p2){
		p = p2;
	}
	if(p>p3){
		p = p3;
	}

	int j = j1;
	if(j>j2){
		j = j2;
	}

	int s = p+j-50;

	cout << s << '\n';

	return 0;
}

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

#define REPZ(i, z, n) for (decltype(n) i = (z); i <= (n); i++)
#define REP(i, n) for (decltype(n) i = 0; i <= (n); i++)
#define ALL(v) v.begin(), v.end()
#define SIZE(v) ((ll)(v).size())
#define MAX(v) (*max_element(ALL(v)))
#define MIN(v) (*min_element(ALL(v)))
#define INF 1000000000000  // 1E+12

// 略
#define PB push_back
#define F first
#define S second
#define MP make_pair
#define READ cin >>
#define PRINT cout <<
#define PYES cout << "Yes" << endl;
#define POK cout << "OK" << endl;
#define PNO cout << "No" << endl;
#define PNG cout << "NG" << endl;

using namespace std;

// デバッグ用
void debug_out() { cout << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cout << H << " ";
  debug_out(T...);
}

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

#ifdef _DEBUG
#define debug(...) debug_out(__VA_ARGS__)
#else
#define debug(...)
#endif

// typedef
typedef long long ll;
typedef unsigned long long ul;
typedef long double ld;
typedef pair<ll, ll> pl;

// const
// 円周率
const ld pi = acos(-1);
// mod用
// 1E+9 +7
const ll mod = (ll)1e+9 + 7;
// 1s間で可能なループ回数2E+8回
// ll        最大値2147483647         〜2E+9
// long long  最大値9223372036854775807〜9E+18
// 総和accumulate
// 単純リストvector<type> push_back
// 連想配列map<key,value> insert,
// 集合set<type>
// pair キーとバリューを格納 firstとsecondでアクセス
// 小数点指定 cout << fixed << setprecision(15) << endl;
// to_string<->stoi
// stoll(longlong)
// stod(double)
// deep copy v1->v2 copy(v1.begin(), v1.end(), back_inserter(v2) );
// 大文字65-90(-32)
// 小文字97-122(+32)
//  priority_queue<pair<ll, ll>, vector<pair<ll, ll>>, greater<pair<ll, ll>>>
//  ba;
signed main() {
  // faster
  // C言語流の入出力は使用できない
  ios::sync_with_stdio(false);
  std::cin.tie(nullptr);
  ll n;
  cin >> n;
  vector<ll> a(n + 1);
  rep(i, n + 1) cin >> a[i];
  vector<ll> acopy(n + 1);
  rep(i, n + 1) acopy[i] = a[i];
  vector<ll> b(n);
  rep(i, n) cin >> b[i];

  rep(i, n) {
    ll bef = acopy[i];
    acopy[i] = max(acopy[i] - b[i], 0LL);
    if (acopy[i] == 0) {
      ll canattack = b[i] - bef;
      acopy[i + 1] = max(0LL, acopy[i + 1] - canattack);
    }
  }
  ll res = 0;
  rep(i, n + 1) res += abs(a[i] - acopy[i]);
  // rep(i, n + 1) debug(acopy[i]);
  cout << res << endl;
  return 0;
}


Measured memory_bytes: 2560
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;
int main() {
  int n;
  cin >> n;
  vector<pair<pair<string, int>, int>> sp;
  rep(i, n) {
    string s;
    int p;
    cin >> s >> p;
    pair<string, int> tmp;
    tmp.first = s;
    tmp.second = p;
    sp.emplace_back(tmp, i);
  }
  sort(sp.begin(), sp.end());
  // rep(i, n) {
  //  cout << sp[i].first << ' ' << sp[i].second << endl;
  //}
  rep(i, n) {
    rep(j, n) {
      if (sp[i].first.first == sp[j].first.first) {
        if (sp[i].first.second > sp[j].first.second) {
          pair<pair<string, int>, int> tmp = sp[i];
          sp[i] = sp[j];
          sp[j] = tmp;
        }
      }
    }
  }
  rep(i, n) cout << sp[i].second + 1 << endl;
  return 0;
}

Measured memory_bytes: 3632
#include <bits/stdc++.h>
using namespace std;
///////////////////////////////////////////
const long long int INF = INT64_MAX;
const long long int Mod = 1000000007;
using ll = long long int; using ci = const int;
using vi = vector<int>;
using Vi = vector<long long int>;
typedef pair<int, int> P; typedef pair<ll, ll> PLL;
#define pb(x) push_back(x)
#define mp(x,y) make_pair(x,y)
#define all(x) (x).begin(),(x).end()
#define rep(i,N) for(ll i=0;i<N;i++)
auto max(auto x,auto y){if(x>y){return x;}else{return y;}}
auto min(auto x,auto y){if(x>y){return y;}else{return x;}}
template<class T>bool chmax(T &former, const T &b) { if (former<b) { former=b; return true; } return false; }
template<class T>bool chmin(T &former, const T &b) { if (b<former) { former=b; return true; } return false; }
template<class T>T sqar(T x){ return x*x; }//sqrt(x)は平方根;
#define Sort(v) std::sort(v.begin(), v.end(), std::greater<decltype(v[0])>()) //降順でVをソート
typedef vector<vector<ll> > matrix;
void princ(auto x){cout<<x<<" ";}; void print(auto x){cout<<x<<"\n";};
///////////////////////////////////////////////////////////////////////////////////

ll n,m;
Vi a;
int mj[9];
vector<string> dp;
string calc(ll nu){
    if(!dp[nu].empty())return dp[nu];
    string ans,tmp;
    if(nu==0){
        ans.clear();
        return ans;
    }
    rep(i,9){
        if(mj[i]!=0){
            if(nu-i>=0){
                if(calc(nu-i).empty() && (nu-i)!=0)continue;
                tmp.assign(calc(nu-i));
                tmp += to_string(mj[i]);
                //cout<<"tmp"<<tmp<<endl;;
                if(ans.size()<tmp.size())ans = tmp;
                if(ans.size()== tmp.size() && ans < tmp)ans = tmp;
                tmp.clear();
            }
        }
    }
    dp[nu]=ans;
    return ans;
}

int main(){
    cin.tie(0);ios::sync_with_stdio(false);
    cin>>n>>m; a.resize(m);
    dp.resize(n+2);
    rep(i,m)cin>>a[i];
    sort(all(a));
    rep(i,9)mj[i]=0;
    rep(i,m){
        switch (a[i]){
            case 1: mj[2]=1;
                break;
            case 2: mj[5]=2;
                break;
            case 3: mj[5]=3;
                break;
            case 4: mj[4]=4;
                break;
            case 5: mj[5]=5;
                break;
            case 6: mj[6]=6;
                break;
            case 7: mj[3]=7;
                break;
            case 8: mj[7]=8;
                break;
            case 9: mj[6]=9;
                break;
        }
    }
    print(calc(n));
    return 0;
}

Measured memory_bytes: 40704
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        sc.close();

        s = s.replace("BC", "D");
        long counter = 0;
        int a_counter = 0;

        if (s.length() < 2) {
            counter = 0;
        } else {
            for(int i = 0; i<s.length();i++) { // O(N)
                if (s.charAt(i) == 'A') {
                    a_counter++;
                } else if (s.charAt(i) == 'D') {
                    counter += a_counter;
                } else {
                    a_counter = 0;
                }
            }
        }
        // 出力
        System.out.println(counter);
    }

}


Measured memory_bytes: 33396
package main

import (
	"fmt"
	"strings"
)

func main() {
	var n int
	fmt.Scan(&n)
	a := make([]int, n)
	b := make([]int, n)
	f := true
	x := n / 2
	for i := 0; i < n; i++ {
		fmt.Scan(&a[i])
		if f {
			b[x+i/2] = a[i]
			f = false
		} else {
			b[x-i/2-1] = a[i]
			f = true
		}	
	}
    if f {
		fmt.Println(strings.Trim(fmt.Sprint(b), "[]"))
	} else {
        c := make([]int,n)
        for i := 0; i < n; i++ {
            c[n-i-1]=b[i]
        }
        fmt.Println(strings.Trim(fmt.Sprint(c), "[]"))
	}
}


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

int main() {
    string S;
    cin >> S;
    
    int ao=0;
    int aka=0;

    for(int i=0; i<S.size(); i++){
        if(S[i] == '1') ao++;
        else aka++;
    }

    cout << 2* min(ao, aka) << endl;
}

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

int main(){
  int a,b,c;

  cin>>a>>b>>c;

  if(a<=b&&b<=c){cout<<a<<" "<<b<<" "<<c;}
  else if(a<=c&&c<b){cout<<a<<" "<<c<<" "<<b;}
  else if(b<=a&&a<c){cout<<b<<" "<<a<<" "<<c;}
  else if(b<=c&&c<a){cout<<b<<" "<<c<<" "<<a;}
  else if(c<a&&a<=b){cout<<c<<" "<<a<<" "<<b;}
  else if(c<b&&b<=a){cout<<c<<" "<<b<<" "<<a;}
  cout<<endl;

  return 0;
 
}


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

#define INF_LL (int64)1e18
//#define INF (int32)1e9
#define REP(i, n) for(int64 i = 0;i < (n);i++)
#define FOR(i, a, b) for(int64 i = (a);i < (b);i++)
#define all(x) x.begin(),x.end()
#define fs first
#define sc second

using int32 = int_fast32_t;
using uint32 = uint_fast32_t;
using int64 = int_fast64_t;
using uint64 = uint_fast64_t;
using PII = pair<int32, int32>;
using PLL = pair<int64, int64>;

const double eps = 1e-10;

template<typename A, typename B>inline void chmin(A &a, B b){if(a > b) a = b;}
template<typename A, typename B>inline void chmax(A &a, B b){if(a < b) a = b;}

template<typename T>
vector<T> make_v(size_t a){return vector<T>(a);}

template<typename T,typename... Ts>
auto make_v(size_t a,Ts... ts){
  return vector<decltype(make_v<T>(ts...))>(a,make_v<T>(ts...));
}

template<typename T,typename U,typename... V>
typename enable_if<is_same<T, U>::value!=0>::type
fill_v(U &u,const V... v){u=U(v...);}

template<typename T,typename U,typename... V>
typename enable_if<is_same<T, U>::value==0>::type
fill_v(U &u,const V... v){
  for(auto &e:u) fill_v<T>(e,v...);
}


constexpr int64 mod = 1e9+7;

int main(void) {
    int64 N;
    cin >> N;
    vector<int64> C(N), V(N);
    REP(i, N) {
        cin >> V[i];
    }
    REP(i, N) {
        cin >> C[i];
    }
    int64 res = 0;
    REP(i, N) {
        res += max((int64)0, V[i]-C[i]);
    }
    cout << res << endl;
}


Measured memory_bytes: 256
#pragma warning(disable:4996)

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <float.h>

#pragma region 定義
#define i_cin(X) scanf("%d", &X)
#define i_cin2(X,Y) scanf("%d %d",&X,&Y)
#define i_cin4(X,Y,Z,W) scanf("%d %d %d %d",&X,&Y,&Z,&W)
#define i_cin3(X,Y,Z) scanf("%d %d %d",&X,&Y,&Z)
#define l_cin(X) scanf("%ld",&X)
#define f_cin(X) scanf("%f",&X)
#define l_cin2(X,Y) scanf("%ld %ld",&X,&Y)
#define s_cin(X) scanf("%s",&X)
#define ll_cin(X) scanf("%lld", &X)
#define ull_cin(X) scanf("%llu", &X)

#define  i_cout(X) printf("%d\n",X)
#define  f_cout(X) printf("%g\n",X)
#define  i_cout2(X,Y) printf("%d %d\n",X,Y)
#define  l_cout(X) printf("%ld\n",X)
#define  s_cout(X) printf("%s\n",X)

#define  ll_cout(X) printf("%lld\n",X)
#define  ull_cout(X) printf("%llu\n",X)



typedef long long  ll;
typedef unsigned long long  ull;

#define rept(x, s, n) for (int x = s; x < n; x++)

#define S_RTN(S)  s_cout(S);return 0


#define _itoa(A,N) sprintf(A, "%d", N);

int i_cins(int n, int* A);
int l_cins2(int n, long* A, long* B);
int s_dsort(const void* a, const void* b);
int s_asort(const void* a, const void* b);

int  _gcd(int a, int b);
int  _swp(int* a, int* b);
int _cknum(char* a, int n);
int _atoi(char* s, int len);


int s_asorts(const void* a, const void* b);

//昇順
int s_asorts(const void* a, const void* b) {
	return(strcmp((char*)a, (char*)b));
}
int s_dsort(const void* a, const void* b) {
	return(*(int*)b - *(int*)a);
}
int s_asort(const void* a, const void* b) {
	return(*(int*)a - *(int*)b);
}
int l_cins2(int n, long* a, long* b) {
	int i;
	rept(i, 0, n) {
		l_cin2(*(a + i), *(b + i));
	}
	return 0;
}
int i_cins(int n, int* a) {
	int i;
	for (i = 0; i < n; i++) {
		i_cin(*(a + i));
	}

	return 0;
}
int _gcd(int a, int b) {
	int r, tmp;
	if (a < b) { tmp = a; a = b; b = tmp; }
	r = a % b;
	while (r) {
		if (!r) break;
		a = b; b = r;
		r = a % b;
	}
	return(b);
}

long _max(long a, long b) {
	return a > b ? a : b;
}
long _min(long a, long b) {
	return a < b ? a : b;
}
int _swp(int* a, int* b)
{
	int tmp;
	tmp = *b; *b = *a; *a = tmp;
	return 0;
}

int _cknum(char* a, int n) {
	int i;
	char t = '0';

	for (i = 0; i < n; i++) {
		if (a[i] < '0' || a[i]>'9') return 1;
	}
	return 0;
}


int _atoi(char* s, int len) {
	char tmp[20];
	memcpy(tmp, s, len);
	tmp[len] = 0x00;
	return (atoi(tmp));
}
#pragma endregion

static int s[101];
int main(void) {
	int n, k, d, a[101];
	int i, j,cnt=0;

	i_cin2(n,k);
	for (i = 0; i < k; i++) {
		i_cin(d);
		i_cins(d, a);
		for (j = 0; j < d; j++) {
			s[a[j] - 1]++;
		}
	}

	for (i = 0; i < n; i++) {
		if (s[i]) continue;
		cnt++;
	}
	i_cout(cnt);
	return 0;
	
}
	 

//
//int main(void)
//{
//	ull    a, b, n;
//	ull    y;
//
//	ull_cin(a);	ull_cin(b); ull_cin(n);
//
//	if (n == b||n == a) n--;
//	y = (a * n) / b - a * (n / b);
//
//	ull_cout(y);
//	return 0;
//}

//#define _N 1000000000

//int main(void)
//{
//
//	int  n,i;
//	ull   tmp=1;
//
//	i_cin(n);
//
//	for (i = 1; i <= n; i++) {
//		if (!(tmp % ((ull)_N + 7)))
//			tmp = 1;
//		tmp *= (ull)i;
//	}
//	tmp %= ((ull)_N + 7);
//		
//	ull_cout(tmp);
//	return 0;
//}



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

using namespace std;

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

#define REP(i, n) for(int i=0; i<(n); ++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 DEBUG(x) cout<<#x<<": "<<(x)<<'\n'
#define DEBUG_VEC(v) cout<<#v<<":";REP(i, v.size())cout<<' '<<v[i];cout<<'\n'
#define ALL(a) (a).begin(), (a).end()

template<typename T> inline void CHMAX(T& a, const T b) {if(a<b) a=b;}
template<typename T> inline void CHMIN(T& a, const T b) {if(a>b) a=b;}

constexpr ll MOD=1000000007ll;
// constexpr ll MOD=998244353ll;
#define FIX(a) ((a)%MOD+MOD)%MOD

const double EPS=1e-11;
#define EQ0(x) (abs((x))<EPS)
#define EQ(a, b) (abs((a)-(b))<EPS)

int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	// cout<<setprecision(10)<<fixed;
	int a, b;
  cin>>a>>b;
  if(a<=9 && b<=9){
    cout<<a*b<<'\n';
  }
  else{
    cout<<-1<<'\n';
  }
	return 0;
}


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

using namespace std;

int main(void) {
	int n, m, a;
	while(1) {
		cin >> n >> m >> a;
		if(n == 0 and m == 0 and a == 0) {
			break;
		}

		vector<priority_queue<pair<int, int>>> queue(n);
		for(int i = 0; i < m; i++) {
			int h, p, q;
			cin >> h >> p >> q;
			queue[p - 1].push(make_pair(h, q));
			queue[q - 1].push(make_pair(h, p));
		}

		int now, now_h;
		now = a;
		now_h = 1001;
		while(!queue[now - 1].empty()) {
			int tmp, tmp_h;
			while(1) {
				tmp = queue[now - 1].top().second;
				tmp_h = queue[now - 1].top().first;
				queue[now - 1].pop();
				if(tmp_h < now_h) {
					break;
				}
				if(queue[now - 1].empty()) {
					tmp = now;
					tmp_h = now_h;
					break;
				}
			}
			now = tmp;
			now_h = tmp_h;
		}
		cout << now << endl;
	}

	return 0;
}

Measured memory_bytes: 3104
#include <bits/stdc++.h>
#include <algorithm>
#include <math.h>
#include <cstring>

#define test(t) while(t--)
#define fo(i,k,n) for(int i=k;i<n;i++)
#define refl(a,x) for(auto& a:x)
#define MIN(a,b)  (a>b?b:a)
#define ll  long long int
#define MOD 1e9 + 7
#define in  cin>>
#define out cout<<
#define en "\n"
#define sp " "
#define fi first
#define se second
#define fast()  ios_base::sync_with_stdio(false);cin.tie(0);
#define pb push_back
#define lb lower_bound
#define ub upper_bound
//typedef pair<int,int> pai;
//typedef pair<char,int> pac;



/*bool f(int x,int y){

return x>y;
}*/


using namespace std;

void solve()
{ ll n;
  in n;
  ll cnt = 0;
  string s[n];
  unordered_map<string,ll>m;
  for(ll i=0;i<n;i++){

    in s[i];
    m[s[i]]+=1;

  }
  for(ll i=0;i<m.size();i++){
      if(m[s[i]]>0)
        cnt +=1;
  }
  out cnt<<en;
  //out m.size()<<sp<<m[s[0]]<<en;
}

int main(){ fast()
             //freopen("input.txt","r",stdin);
	         //freopen("output.txt","w",stdout);
             ll t=1;
            //cin>>t;
            test(t){
            solve();
            }
return 0;}


Measured memory_bytes: 23988
#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 getidx(ary,key) lower_bound(_all(ary),key)-begin(ary)
#define clr(a,b) memset((a),(b),sizeof(a))
#define bit(n) (1LL<<(n))
#define popcount(n) (__builtin_popcountll(n))

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;

const int dx[8]={1,0,-1,0,1,-1,-1,1};
const int dy[8]={0,1,0,-1,1,1,-1,-1};

int l[1010];

int main(void){
	int n;
	cin >> n;
	rep(i,2*n) cin >> l[i];
	sort(l,l+2*n);
	int ans=0;
	rep(i,n) ans+=min(l[2*i],l[2*i+1]);
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <string>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <iomanip>
#include <utility>
#include <tuple>
#include <functional>
#include <bitset>
#include <cassert>
#include <complex>
#include <time.h>
#define ll long long
#define double long double
#define itn int
#define endl '\n'
#define co(ans) cout<<ans<<endl;
#define COYE cout<<"YES"<<endl;
#define COYe cout<<"Yes"<<endl;
#define COye cout<<"yes"<<endl;
#define CONO cout<<"NO"<<endl;
#define CONo cout<<"No"<<endl;
#define COno cout<<"no"<<endl;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define FFOR(i,a,b) for(int i=(a);i<=(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define RREP(i,n)  FFOR(i,1,n)
#define ALL(V) ((V).begin(),(V).end())
#define SORT(V) sort((V).begin(),(V).end())
#define REVERSE(V) reverse((V).begin(),(V).end())
#define INF ((1LL<<62)-(1LL<<31))
#define EPS 1e-10
#define PI 3.141592653589793238
#define MOD 1000000007
#define MAX 5100000
template<class T>bool chmax(T &a,const T &b){if(a<b){a=b;return 1;}return 0;}
template<class T>bool chmin(T &a,const T &b){if(b<a){a=b;return 1;}return 0;}
using namespace std;

int main(){
  ll N,ans=0;
  cin>>N;
  
  for(int i=1; i<=N; ++i){
    if(i%3!=0 && i%5!=0) ans+=i;
  }
  
  cout<<ans<<endl;
  return 0;
}

Measured memory_bytes: 3672
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <cctype>
#include <cassert>
#include <climits>
#include <string>
#include <bitset>
#include <cfloat>
#include <unordered_set>
#pragma GCC optimize("Ofast")
using namespace std;
typedef long double ld;
typedef long long int ll;
typedef unsigned long long int ull;
typedef vector<int> vi;
typedef vector<char> vc;
typedef vector<bool> vb;
typedef vector<double> vd;
typedef vector<string> vs;
typedef vector<ll> vll;
typedef vector<pair<int,int> > vpii;
typedef vector<vector<int> > vvi;
typedef vector<vector<char> > vvc;
typedef vector<vector<string> > vvs;
typedef vector<vector<ll> > vvll;
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define irep(it, stl) for(auto it = stl.begin(); it != stl.end(); it++)
#define drep(i,n) for(int i = (n) - 1; i >= 0; --i)
#define fin(ans) cout << (ans) << '\n'
#define STI(s) atoi(s.c_str())
#define mp(p,q) make_pair(p, q)
#define pb(n) push_back(n)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define Sort(a) sort(a.begin(), a.end())
#define Rort(a) sort(a.rbegin(), a.rend())
#define MATHPI acos(-1)
#define itn int;
int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
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;}
struct io{io(){ios::sync_with_stdio(false);cin.tie(0);}};
const int INF = INT_MAX;
const ll LLINF = 1LL<<60;
const ll MOD = 1000000007;
const double EPS = 1e-9;




int main(void) {

    int r,g,b;
    cin>>r>>g>>b;
    if((r*100+g*10+b)%4==0)fin("YES");
    else fin("NO");
}

Measured memory_bytes: 256
#include <stdio.h>
 int main (void) {
 int i;
 int n;
 int a[100];
   
 scanf("%d",&n);
 for (i = 0; i < n; i++) {
   scanf("%d", &a[i]);
 }
 
 for (i = 0; i < n; i++) {
 if (a[i] % 2 == 0 && a[i] % 3 != 0 && a[i] % 5 != 0) {
   puts("DENIED");
 return 0;}
 }
 puts("APPROVED");
 
 return 0;
}

Measured memory_bytes: 128
#![allow(unused_imports, unused_macros, non_snake_case)]
use std::cmp::{max, min, Ordering};
use std::collections::{BTreeMap, BTreeSet, BinaryHeap, HashMap, HashSet, VecDeque};

//{{{ macros missing in 1.15.1
#[macro_use]
mod macros {
    macro_rules! eprint {
        ($($t:tt)*) => {{
            use ::std::io::Write;
            let _ = write!(::std::io::stderr(), $($t)*);
        }};
    }
    macro_rules! eprintln {
        () => { eprintln!(""); };
        ($($t:tt)*) => {{
            use ::std::io::Write;
            let _ = writeln!(::std::io::stderr(), $($t)*);
        }};
    }
    macro_rules! dbg {
        ($val:expr) => {
            match $val {
                tmp => {
                    eprintln!(
                        "[{}:{}] {} = {:#?}",
                        file!(),
                        line!(),
                        stringify!($val),
                        &tmp
                    );
                    tmp
                }
            }
        };
    }
}
//}}}

fn run() {
    let stdin = std::io::stdin();
    let mut sc = Scanner::new(stdin.lock());
    let n: usize = sc.read();
    let k: usize = sc.read();
    let a: Vec<u64> = sc.read_vec(n);
    let mut answer = 0;
    let MOD = 1_000_000_007;
    for i in 0..n {
        let mut s = 0;
        for j in 0..i {
            if a[j] > a[i] {
                s += 1;
            }
        }
        let mut all = 0;
        for j in 0..n {
            if a[j] > a[i] {
                all += 1;
            }
        }
        answer += k * s;
        let mut b = 1;
        b *= k - 1;
        b *= k;
        b /= 2;
        b %= MOD;
        b *= all;
        b %= MOD;
        answer += b;
        answer %= MOD;
    }
    println!("{}", answer);
}

fn main() {
    std::thread::Builder::new()
        .name("run".to_string())
        .stack_size(1024 * 1024 * 1024)
        .spawn(run)
        .unwrap()
        .join()
        .unwrap()
}

//{{{ Scanner
pub struct Scanner<R> {
    reader: R,
}

impl<R> Scanner<R> {
    pub fn new(r: R) -> Scanner<R> {
        Scanner { reader: r }
    }
}

fn is_whitespace(b: u8) -> bool {
    b == b' ' || b == b'\n' || b == b'\r' || b == b'\t'
}

impl<R: std::io::Read> Scanner<R> {
    pub fn read<T: std::str::FromStr>(&mut self) -> T {
        let buf = std::io::Read::bytes(self.reader.by_ref())
            .map(|b| b.expect("Read failed"))
            .skip_while(|&b| is_whitespace(b))
            .take_while(|&b| !is_whitespace(b))
            .collect::<Vec<_>>();
        unsafe { std::str::from_utf8_unchecked(&buf) }
            .parse()
            .ok()
            .expect("Parse error")
    }

    pub fn read_vec<T: std::str::FromStr>(&mut self, n: usize) -> Vec<T> {
        (0..n).map(|_| self.read()).collect()
    }

    pub fn read_chars(&mut self) -> Vec<char> {
        self.read::<String>().chars().collect()
    }
}
//}}}


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

using namespace std;
using ll = long long;

int main(){
  int n;
  cin>>n;
  ll d;
  cin>>d;
  int ans=0;
  for(int i = 0;i < n;++i) {
      ll x,y;
      cin>>x>>y;
      if(x*x+y*y<=d*d)++ans;
  }
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 3628
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using VI = vector<int>;
using VL = vector<ll>;
#define FOR(i,a,n) for(int (i)=(a);(i)<(n);(i)++)
#define eFOR(i,a,n) for(int (i)=(a);(i)<=(n);(i)++)
#define rFOR(i,a,n) for(int (i)=(n)-1;(i)>=(a);(i)--)
#define erFOR(i,a,n) for(int (i)=(n);(i)>=(a);(i)--)
#define SORT(i) sort((i).begin(),(i).end())
#define rSORT(i,a) sort((i).begin(),(i).end(),(a))
#define all(i) (i).begin(),(i).end()
constexpr ll INF = 1000000000;
constexpr ll LLINF = 1LL << 60;
constexpr ll mod = 1000000007;
constexpr ll MOD = 998244353;
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; }
inline void init() { cin.tie(nullptr); cout.tie(nullptr); cin.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(15); }
template<class T> inline istream& operator>>(istream& input, vector<T>& v) { for (auto& elemnt : v)input >> elemnt; return input; }

int main() {
    init();
    
    int a, b;
    cin >> a >> b;
    cout << b / a + (bool)(b % a) << "\n";
}


Measured memory_bytes: 3188
#include <iostream>
#include <stdio.h>
#include <vector>
#include <algorithm>
#include <cmath>
#include <map>
#define rep(i,cc,n) for(int i=cc;i<=n;++i)
#define drep(i,cc,n) for(int i=cc;i>=n;--i)
typedef long long ll;
using namespace std;
int main(){
    int n;
    cin>>n;
    int v[n];
    rep(i,0,n-1) cin>>v[i];
    sort(v,v+n);
    double hoge = (double)v[0];
    rep(i,1,n-1){
        hoge = (hoge + (double)v[i]) / 2.0;
    }
    cout<<hoge<<endl;
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
using namespace std;
int a,b,c;
int main()
{
    cin>>a>>b>>c;
    int x=min(min(a,b),c);
    int y=a+b+c-x-max(max(a,b),c);
    cout<<x+y;
    return 0;
}

Measured memory_bytes: 256
x,k,d=map(int,input().split())
if abs(k*d)<=abs(x):
    print(abs(x)-abs(k*d))
else:
    moves = abs(x//d)
    ans=abs(x%d)
    left=k-moves
    if left%2:
        print(abs(d-ans))
    else:
        print(ans)


Measured memory_bytes: 9192
import fractions
import sys
from functools import reduce
import math

input = sys.stdin.readline


def main():
    n, m = input_list()
    starts = []
    ends = []
    for _ in range(m):
        a, b = input_list()
        if a == 1:
            starts.append(b)
        elif b == n:
            ends.append(a)
    
    if set(starts) & set(ends):
        print('POSSIBLE')
    else:
        print('IMPOSSIBLE')

def get_camulative(l):
    import itertools
    # 累積和
    return [0] + list(itertools.accumulate(l))

def combinations_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))


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


def input_list_str():
    return list(map(str, input().split()))


def lcm_base(x, y):
    return (x * y) // fractions.gcd(x, y)


def lcm_list(numbers):
    return reduce(lcm_base, numbers, 1)


def gcd(*numbers):
    return reduce(fractions.gcd, numbers)


def gcd_list(numbers):
    return reduce(fractions.gcd, numbers)


if __name__ == "__main__":
    main()


Measured memory_bytes: 92504
import java.util.*;
public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner reader=new Scanner(System.in);
		int N=reader.nextInt();
		int A=reader.nextInt();
		int B=reader.nextInt();
		System.out.print(Math.min(A*N,B));
	}

}


Measured memory_bytes: 21844
#include<iostream>
#include<cstdio>
#include<string>
#include<vector>
#include<queue>
#include<cmath>
#include<algorithm>
#include<iomanip>
#include<functional>
#include<set>
#include<map>
#include<climits>
#include<utility>
#define ul unsigned long long int
#define ll long long int
#define MAX 1000000+1
using namespace std;
#define F first
#define S second
#define pi 2*acos(0.0)
#define PB push_back
#define CL clear()







int main()
{
    int e = 0 , w = 0;
    int n ;
    string s;
    cin >> n >> s;
    for(int i = 0; i < s.length(); i++) if(s[i]=='W') w++; else e++;
    int W = 0, E =0;
    int mx  = INT_MAX;
    for(int i = 0; i < n; i++)
    {
        if(s[i]=='W')
        {
            mx = min(mx, W + e - E);
            W++;
        }
        else
        {
            E++;
            mx = min(mx, W+ e-E);
        }

    }
    cout << mx;


    return 0;
}


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

using namespace std;

int main(){
    int N;
    cin >> N;
    double M = 1;
    double S = 0;
    vector<int> V;
    for ( int i = 0; i < N; i ++ ){
        double t;
        cin >> t;
        M *= t;
        V.push_back( t );
    }
    for ( int i = 0; i < N; i ++ ){
        S += M / V[i];
    }
    double ans;
    ans = M / S;
    cout << ans;
}


Measured memory_bytes: 256