akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
void Main();

using i8  = int8_t;   /* -128 ~ 127 */
using u8  = uint8_t;  /* 0 ~ 255 */
using i16 = int16_t;  /* -32,768 ~ 32,767 */
using u16 = uint16_t; /* 0 ~ 65,535 */
using i32 = int32_t;  /* -2,147,483,648 ~ 2,147,483,647 */
using u32 = uint32_t; /* 0 ~ 4,294,967,295 */
using i64 = int64_t;  /* -9,223,372,036,854,775,808 ~ 9,223,372,036,854,775,807 */
using u64 = uint64_t; /* 0 ~ 18,446,744,073,709,551,615 */
using f32 = float;    /* (-3.4 * 10^38) ~ (3.4 * 10^38) */
using f64 = double;   /* (-1.7 * 10^308) ~ (1.7 * 10^308) */
using f80 = __float80;
template <class T> using Vec = vector<T>;
constexpr i64 INF = 1010000000000000017;
constexpr i64 MOD = 1e9 + 7;
constexpr f64 EPS = 1e-12;
constexpr f64 PI = 3.14159265358979323846;
#define YN(y, n, b) (b? y : n)
#define ALL(v) v.begin(), v.end()
#define GCD(a, b) __gcd(a, b) /* 最大公約数 */
#define LCM(a, b) a / __gcd(a, b) * b /* 最小公倍数 */

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

void Main() {
    i32 K;
    cin >> K;
    string acl = "ACL";
    for (i32 i = 0; i < K; i++) {
        cout << acl;
    }
    cout << endl;
}


Measured memory_bytes: 3612
#include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp make_pair
#define sqr(a) ((a) * (a))
#define io() ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define co() cout.precision(10);
#define F for(li i=0;i<n;i++)
#define fo(i,a,n) for(i=a;i<n;i++)
#define ne cout<<"\n";
#define nec cout<<'\n';continue;
#define all(v) v.begin(),v.end()
#define allr(v) v.rbegin(),v.rend()
#define test int t;cin>>t;while(t--)
//#define oj #ifndef ONLINE_JUDGE freopen("input.txt","r",stdin); freopen("output.txt","w",stdout); #endif
//memset(arr, 0, sizeof arr);
typedef long long li;
typedef long double ld;

const li mod = 1000000007;

int main()
{
    io();
    li n;
    cin>>n;
    if(n<2)
    cout<<0;
    else
    {
    	li i,x=1,y=1;
    	for(i=1;i<=n;i++)
    	{
    		x=x*9*1LL;
    		x=x%mod;
		}
		x=x*2*1LL;
		x=x%mod;
		//cout<<x<<" ";
		for(i=1;i<=n;i++)
    	{
    		y=y*8*1LL;
    		y=y%mod;
		}
		//cout<<y<<" ";
		li ans=x-y;
		if(ans<0)
		{
			ans+=mod;
			ans=ans%mod;
		}
		//ans=ans*2;
		//ans=ans%mod;
		x=1;
		for(i=1;i<=n;i++)
    	{
    		x=x*10*1LL;
    		x=x%mod;
		}
		li res=x-ans;
		if(res<0)
		{
			res+=mod;
			res=res%mod;
		}
		cout<<res;
	}
}


Measured memory_bytes: 3636
import sys
input = lambda: sys.stdin.readline().rstrip("\r\n")

def solve():
    n = int(input())
    a = [int(x) for x in input().split()]

    from collections import defaultdict

    dp = defaultdict(lambda : -float('inf'))
    dp[(0, 0, 0)] = 0

    for i in range(1, n + 1):
        max_j = i//2 if i % 2 == 0 else i//2 + 1
        min_j = n//2 - (n - i)//2 if (n - i) % 2 == 0 else n//2 - ((n - i)//2 + 1)
        for j in range(min_j, max_j + 1):
            dp[(i, j, 0)] = max(dp[(i - 1, j, 0)], dp[(i - 1, j, 1)])
            dp[(i, j, 1)] = dp[(i - 1, j - 1, 0)] + a[i - 1]
    print(max(dp[(n, n//2, 0)], dp[(n, n//2, 1)]))
solve()




Measured memory_bytes: 308448
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <climits>
#include <cmath>
#include <map>
using namespace std;
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++ )
#define repf(i,m,n) for(int (i)=m;(i)<n;(i)++)
#define all(v) (v).begin(), (v).end()
#define ll long long
#define vec(name,num,init) vector<ll> name((num),(init));
#define op(i) cout<<(i)<<endl;
#define ip(i) cin>>(i);
#define opN cout<<"No"<<endl;
#define opY cout<<"Yes"<<endl;
#define mat(name,fnum,snum,init); vector<vector<ll>> name((fnum),vector<ll>((snum),(init)));
#define debugP int debug_point; cin>>debug_point;
template <typename T>
void putv(vector<T>& V){
	// cout << "The elements in the vector are: " << endl;
	for(auto x: V)
		cout << x << " ";
	cout << endl;
}
template <class T>
vector<T> getv(int n){
	vector<T> Vector_temp;
	rep(i,n){
		T input;
		cin >> input;
		Vector_temp.emplace_back(input);
	}
	return Vector_temp;
}
/* <3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3*/

int main(){
    int n;
    cin>>n;
    vec(a,n,0);
    a=getv<ll>(n);
    sort(all(a));
    ll b=0;
    ll c=0;
    int cnt=0;
    for(int i=n-2;i>=0;i--){
        if(a[i]==a[i+1]){
            if(cnt==0){
                cnt++;
                b=a[i];
                i--;
            }else {
                c=a[i];
                break;
            }
        }
    }

    cout<<b*c<<endl;
    return 0;
}

Measured memory_bytes: 2168
#include <bits/stdc++.h>
#include <algorithm>
#include <stdio.h>
#include <math.h>
using namespace std;

#define INF 1.1e9
#define LINF 1.1e18
#define FOR(i,a,b) for (int i = (a); i < (b); ++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(), (v).end()
#define pb push_back
#define pf push_front
#define fi first
#define se second
#define BIT(x,n) bitset<n>(x)

typedef long long ll;
typedef pair<int,int> P;
typedef pair<P,int> PP;

struct edge {
	int to,cost;
	edge(int t,int c):to(t),cost(c) {}
};

int dx[]={1,-1,0,0},dy[]={0,0,1,-1};
int ddx[]={1,1,1,0,-1,-1,-1,0},ddy[]={1,0,-1,-1,-1,0,1,1};

ll mypow(ll x,ll n,ll m) {	//xのn乗をmで割った余り
	if(n==0) return 1;
	if(n%2==0) return mypow(x*x%m,n/2,m);
	else return x*mypow(x,n-1,m)%m;
}

//-----------------------------------------------------------------------------

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

	int n; cin>>n;
	cout<<(1+n)*n/2<<endl;

	return 0;
}


Measured memory_bytes: 256
class Quicksort:
    def quicksort(self, a, p, r):
        if p < r:
            q = self.partion(a, p, r)
            self.quicksort(a, p, q - 1)
            self.quicksort(a, q + 1, r)
        return(a)

    def partion(self, a, p, r): 
        x = a[r][1]
        i = p - 1
        for j in range(p, r):
            if a[j][1] <= x:
                i += 1
                a[i], a[j] = a[j], a[i]
        a[i + 1], a[r] = a[r], a[i + 1]
        return(i+1)

def bubbleSort(a, n):
    flag = 1
    while flag == 1:
        flag = 0
        for j in range(n-1, 0, -1):
            if a[j][1] < a[j - 1][1]:
                a[j], a[j-1] = a[j-1], a[j]
                flag = 1
    return(a)

if __name__ == '__main__':
    n = int(input().rstrip())
    cards = []
    for i in range(n):
        tmp = input().rstrip().split(" ")
        tmp[1] = int(tmp[1])
        cards.append(tmp)
    a = cards[:]
    b = cards[:]
    x = Quicksort()
    a = x.quicksort(a, 0, n-1)
    b = sorted(b, key=lambda i: i[1])
    
    if a == b:
        print("Stable")
    else:
        print("Not stable")
    
    for i in a:
        i[1] = str(i[1])
        print(" ".join(i))

Measured memory_bytes: 35912
n = int(input())
line = [map(int, input().split()) for _ in range(n)]
x, y = [list(i) for i in zip(*line)]

def f(x,y):
  return x-y

def g(x,y):
  return x+y
  
print(max(max([f(x[i],y[i]) for i in range(n)])-min([f(x[i],y[i]) for i in range(n)]), max([g(x[i],y[i]) for i in range(n)])-min([g(x[i],y[i]) for i in range(n)])))

Measured memory_bytes: 121512
#include <bits/stdc++.h>
using namespace std;
#define int long long 
void print(int arr[], int n){
     for(int i=0;i<n;++i)
     cout<<arr[i]<<" ";
     cout<<endl;
}
int gcd(int a,int b){
    if(a==0)
    return b;
    return gcd(b%a,a);
}
int32_t main()
{
     int n,c=1;
     cin>>n;
     int arr[n];
     for(int i=0;i<n;++i)
     cin>>arr[i];
     int mx=arr[0];
     for(int i=1;i<n;++i){
         if(arr[i]>=mx){
             mx=arr[i];
             c++;
         }
     }
     cout<<c;
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define f(i,a,b) for(int(i)=int (a);i<=int (b);i++)
#define ff(i,a,b) for(int(i)=int (a);i<int (b);i++)
#define F(i,a,b) for(int(i)=int (a);i>=int (b);i--)
#define foreach(i,x) for(typeof((c).begin()) i=(c).begin();i!=(c).end();i++)
#define pb push_back
#define eb emplace_back
#define fi first
#define se second
#define vt vector
#define ll long long
#define lower(p,x) lower_bound(all(p),x)
#define upper(p,x) upper_bound(all(p),x)
#define ms(a,x) memset(a,x,sizeof a)
typedef pair<int,int> ii;
typedef pair<int,ii> iii;
const double pi=acos(-1.0);//NOTE:PI
const double eps=1e-5;
const int INF=1e9,mod=1e9+7,N=1e6+1;
string s;
int main(){
	cin>>s;
	int ans=0;
	ff(i,0,s.size()-1){
		if(s[i]!=s[i+1]) ans++;
	}
	cout<<ans;
}

Measured memory_bytes: 512
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
const int INF = 1e9;
const ll LINF = 1e18;

/*
<url:https://cf16-final-open.contest.atcoder.jp/tasks/codefestival_2016_final_c>
問題文============================================================
 問題文
 ある星には M 種類の言語があり、1[sim]M の番号が付けられています。
 
 この星のある年のCODE FESTIVALには星中から N 人の参加者が集まりました。
 
 i(1≦i≦N) 人目の参加者は Ki 種類の言語 Li,1,Li,2,…,Li,Ki を話すことが出来ます。
 
 ある 2 人は以下のいずれかの条件を満たすときに限り、コミュニケーションを取ることが出来ます。
 
 2 人ともが話すことの出来る言語が存在する。
 ある人 X が存在して、 2 人ともが X とコミュニケーションを取ることが出来る。
 
 このとき、N 人すべての参加者が他のすべての参加者とコミュニケーションを取ることが出来るかどうかを判定してください。
 
 制約
 2≦N≦105
 1≦M≦105
 1≦Ki≦M
 Kiの総和≦105
 1≦Li,j≦M
 Li,1,Li,2,…,Li,Ki は相異なる。
=================================================================

解説=============================================================
UnionFind
 
 問題条件より、結果的に参加者達が全域木のように結ばれればいいということが分かる
 よってunion Find を用いて、コミュニケーション可能か集団の集合を構築し、
 その集合の数によって判定すれば良い
================================================================
*/

struct UnionFind {
    vector<int> data;
    UnionFind(int size) : data(size, -1) { }
    bool unionSet(int x, int y) {
        x = root(x); y = root(y);
        if (x != y) {
            if (data[y] < data[x]) swap(x, y);
            data[x] += data[y]; data[y] = x;
        }
        return x != y;
    }
    bool findSet(int x, int y) {
        return root(x) == root(y);
    }
    int root(int x) {
        return data[x] < 0 ? x : data[x] = root(data[x]);
    }
    int size(int x) {
        return -data[root(x)];
    }
};
int main(void) {
	cin.tie(0); ios::sync_with_stdio(false);
    ll N,M; cin >> N >> M;
    vector<vector<ll>> lang(M);
    for(int i = 0; i < N;i++){
        ll K; cin >> K;
        for(int j = 0; j < K;j++){
            ll L; cin >> L;
            L--; lang[L].push_back(i);
        }
    }
    UnionFind uf(N);
    for(int i = 0; i < M;i++){
        for(int j = 0; j < (int)lang[i].size() - 1;j++){
            uf.unionSet(lang[i][j],lang[i][j+1]);
        }
    }
    set<ll> s;
    for(int i = 0; i < N;i++){
        s.insert(uf.root(i));
    }
    if(s.size() == 1){
        cout << "YES" << endl;
    }else{
        cout << "NO" << endl;
    }
	return 0;
}


Measured memory_bytes: 4736
#include <iostream>
#include <vector>

using namespace std;

int main() {

	std::cin.tie(nullptr); std::ios::sync_with_stdio(false);

	int N, M; cin >> N >> M;

	vector<int> count(N, 0);

	for (int i = 0; i < M; i++) {
		int a, b; cin >> a >> b;
		count[a - 1]++; count[b - 1]++;
	}

	for (int i = 0; i < N; i++)cout << count[i] << endl;

	return 0;

}

Measured memory_bytes: 256
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <fstream>
#include <sstream>
#include <set>
#include <map>
#include <vector>
#include <list>
#include <algorithm>
#include <cstring>
#include <cmath>
#include <string>
#include <queue>
#include <bitset>     //UWAGA - w czasie kompilacji musi byc znany rozmiar wektora - nie mozna go zmienic
#include <cassert>
#include <iomanip>        //do setprecision
#include <ctime>
#include <complex>
using namespace std;

#define FOR(i,b,e) for(int i=(b);i<(e);++i)
#define FORQ(i,b,e) for(int i=(b);i<=(e);++i)
#define FORD(i,b,e) for(int i=(b)-1;i>=(e);--i)
#define REP(x, n) for(int x = 0; x < (n); ++x)

#define ST first
#define ND second
#define PB push_back
#define MP make_pair
#define LL long long
#define ULL unsigned LL
#define LD long double

const double pi = 3.141592653589793238462643383279502884197169399375105820974944592307816406286208998628034825342;
const int mod=1000000007;

int main(){
	int ans[30303]={},c=0,n,tmpn;
	cin>>n;
	tmpn=n;
	if(n==3){
		ans[0]=2;
		ans[1]=5;
		ans[2]=63;
	}else{
		ans[0]=2;
		ans[1]=3;
		ans[2]=9;
		ans[3]=4;
		int idx=4;
		n-=4;
		FOR(i,1,4999){
			if(n<=1)break;
			ans[idx++]=6*i+9;
			i++;
			ans[idx++]=6*i+9;
			n--;
			n--;
		}
		FOR(i,8,29999){
			if(n<=1)break;
			ans[idx++]=i;
			ans[idx++]=i+2;
			n--;
			n--;
			i+=5;
		}
		FORQ(i,1,5000){
			if(n<=0)break;
			ans[idx++]=i*6;
			n--;
		}
	}

	FOR(i,0,tmpn-1){
		cout<<ans[i]<<" ";
	}
	cout<<ans[tmpn-1]<<endl;
    return 0;
}


Measured memory_bytes: 512
// Ver19.03
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#define INF (1 << 29) * 2
#define LLINF 4545454545454545454
#define MOD 1000000007
#define ll long long
#define ull unsigned long long
#define MAX(a, b) ((a) > (b) ? (a) : (b))
#define MIN(a, b) ((a) < (b) ? (a) : (b))
int upll(const void *a, const void *b) { return *(ll *)a < *(ll *)b ? -1 : *(ll *)a > *(ll *)b ? 1 : 0; }
int downll(const void *a, const void *b) { return *(ll *)a < *(ll *)b ? 1 : *(ll *)a > *(ll *)b ? -1 : 0; }
void sortup(ll *a, int n) { qsort(a, n, sizeof(ll), upll); }
void sortdown(ll *a, int n) { qsort(a, n, sizeof(ll), downll); }

int main()
{
  int r;
  scanf("%d", &r);
  printf("%d\n", 3 * r * r);
}

Measured memory_bytes: 128
import java.math.BigInteger;
import java.util.Scanner;
public class Main {
	public static void main(String[] args){
		Scanner sc=new Scanner(System.in);
		while(sc.hasNext()){
			String str=sc.next();
			boolean flag=false;
			for(int i=0;i<=9;i++){
				char[] cArray=str.replace("X",Integer.toString(i)).toCharArray();
				String[] strArray=new String[3];
				for(int j=0;j<3;j++){
					strArray[j]="";
				}
				int ptr=0;
				for(int j=0;j<cArray.length;j++){
					if(Character.isDigit(cArray[j])){
						strArray[ptr]+=cArray[j]+"";
					}else{
						ptr++;
					}
				}
				if(strArray[0].charAt(0)=='0'&&strArray[0].length()>=2||strArray[1].charAt(0)=='0'&&strArray[1].length()>=2||strArray[2].charAt(0)=='0'&&strArray[2].length()>=2){
					continue;
				}
				BigInteger[] a=new BigInteger[3];
				for(int j=0;j<3;j++){
					a[j]=new BigInteger(strArray[j]);
				}
				if(a[0].add(a[1]).equals(a[2])){
					System.out.println(i);
					flag=true;
					break;
				}
			}
			if(!flag){
				System.out.println("NA");
			}
		}
	}
}

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

int main(void) {
  string s, t;
  cin >> s >> t;
  int n = s.size();

  int result = 0;
  for (int i = 0; i < n; i++) {
    if (s[i] != t[i]) result++;
  }

  cout << result << endl;
  return 0;
}

Measured memory_bytes: 3912
n, m = map(int, input().split())
ka = []
ans = [0] * (m+1)
for i in range(n):
    tmp = list(map(int, input().split()))
    ka.append(tmp)

for i in range(n):
    for j in range(1, ka[i][0]+1):
        ans[ka[i][j]] += 1
cnt = 0
for i in range(1, m+1):
    if ans[i] == n:
        cnt += 1

print(cnt)


Measured memory_bytes: 3064
#include<iostream>
#include<cstdio>
#include<cmath>
#include<cstring>
#include<string>
#include<stack>
#include<queue>
#include<vector>
#include<algorithm>
#include<iomanip>
#include<utility>
#include<cassert>

typedef long long int ll;
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n) for(int i=0;i<signed(n);i++)
#define EREP(i,n) for(int i=1;i<=signed(n);i++)
#define ALL(a) (a).begin(),(a).end()
using std::cout;
using std::vector;
using std::endl;
using std::cin;
using std::string;
using std::max;
using std::min;
using std::abs;
//#define EVEL 1
#ifdef EVEL
#define DEB(X) cout << #X << ":" <<X<<" " ;
#define TF(f) f ? cout<<"true  " : cout<<"false ";
#define END cout<<"\n";
#else
#define DEB(X) {}
#define TF(f) {}
#define END {}
#endif
const int MOD = 1000000007;
const ll INF = 5000000000000;
//typedef std::pair<int, int> P;
struct edge { int to;double cost; };
#define VMAX 1010

     ll N,M;
     ll A,B,C;
     ll K[11],P[11];
     ll ans;
     char S[100];
int main() {
    cin>>A>>B>>C;
    cout<<(4*A*B<(C-(A+B))*(C-(A+B))&&(C-A-B)>=0?"Yes":"No")<<endl;

	return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
#include<algorithm>
#include<string.h>
#include<map>
using namespace std;
int main()
{
    map<int,int> m;
    int n,k,q;
    scanf("%d%d%d",&n,&k,&q);
    for(int i=0;i<q;i++)
    {
        int p;
        scanf("%d",&p);
        m[p]++;
    }
    for(int i=1;i<=n;i++)
    {
        if(k-q+m[i]>0)
            printf("Yes\n");
        else
            printf("No\n");
    }
    return 0;
}


Measured memory_bytes: 5376
answer = 0
n,m,c = map(int,input().split())
b = list(map(int,input().split()))

for i in range(n):
	result = c
	a = list(map(int,input().split()))
	for j in range(m):
		result += a[j] * b[j]
	if result > 0:
		answer += 1

print(answer)

Measured memory_bytes: 62200
#include <algorithm>
#include <cassert>
// #include <chrono>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <iostream>
#include <map>
#include <memory>
#include <queue>
// #include <random>
#include <set>
#include <stack>
#include <string>
#include <utility>
#include <vector>

/*
unsigned seed1 = std::chrono::system_clock::now().time_since_epoch().count();
mt19937 g1.seed(seed1);
*/
using namespace std;

const double PI = 2 * acos(0);

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef pair<pii, pii> ppiipii;
typedef pair<int, ppiipii> pippiipii;
typedef pair<int, pii> pipii;
typedef pair<pii, int> ppiii;
typedef pair<int, ppiii> pippiii;
typedef pair<int, ll> pill;
typedef pair<int, double> pid;
typedef pair<double, double> pdd;
typedef pair<double, pdd> pddd;
typedef pair<string, string> pss;
// note to self, the below two triggers someone
typedef pair<ll, ll> pll;
typedef pair<ll, int> plli;
typedef long double ld;

int main() {
    int a, b;
    scanf("%d%d", &a, &b);
    printf("%d\n", (a-1)*(b-1));
}


Measured memory_bytes: 256
/**
 *    author: codeforces-yuhongtao 
**/
#include<iostream>
#include<string>
#include<cstdio>
#include<cmath>
#include<algorithm>
#include<deque>
#include<cstdlib>
#include<cstring>
#include<vector>
#include<queue>
#include<set>
#include<map>
#include<stack>
#include<iomanip>
#include<sstream>
using namespace std;
#define pi acos(-1.0) 
#define ms(x,n) memset(x,n,sizeof(x));
#define pb push_back
typedef long long ll;//string::npos
typedef long long iint;
ll gcd(ll a,ll b){ return a%b==0?b:gcd(b,a%b); }
const int inf=0x3f3f3f3f;
const int maxn=5e5+5;
const int mod=1e9+7;
//priority_queue<ll,vector<ll>,greater<ll> > q;//小根堆 
//vector<int> vt[205];
//pair<int,int> p;
//map<int,int> m,sum,dt;
int main(){
	ios::sync_with_stdio(false);
	string a,b;
	cin>>a>>b;
	bool f = true;
	int len = a.length();
	for(int i=0;i<len;i++){
		if(a[i]!=b[i]){
			f=false;break;
		}
	}
	if(f){
		cout<<"Yes\n";
	}else{
		cout<<"No\n";
	}
}

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

void fnInput(int& rnLen)
{
  cin >> rnLen;
}
  
double fnMaxVolGet(int nLen)
{
  double nDiv3 = nLen / 3.0;
  return nDiv3 * nDiv3 * nDiv3;
}
  
int main()
{
  int nLen;

  fnInput(nLen);
  cout << fixed << setprecision(10) << fnMaxVolGet(nLen) << endl;

  return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        
        Scanner sc = new Scanner(System.in);            
//        int num = sc.nextInt();
        //int count = 0;
//        int y = 1;
//?´???°??????????????°??????        
//        for(int i = 0; i < num; i ++) {
//            //num = sc.nextInt();
//            if(num % y != 0) {
//                y ++;
                //count ++;
//            }else if(num % y == 0){
                //count ++;                
//                System.out.println(y);
//                y ++;
//            }
//        }

//?????????????????´??°a??????b?????§?????´??°????????????????????????????????°??????
//        int a = sc.nextInt();
//        int b = sc.nextInt();
        
//          for(int i = 0; i <= b; i++) {
//              if(i < a) {
//                  continue;
//              }else if(i >= a) {
//                  System.out.print(i +" ");
//              }else if(i == b) {
//                  System.out.print(i);
//              }
//          }
//?????????????????´??°a??????b?????§?????´??°????????????????????????????????°??????
        int a = sc.nextInt();
        int b = sc.nextInt();
        int c = sc.nextInt();
        int count = 0;
        int y = 1;
        
          for(int i = 0; i <= b; i++) {
//              if(1 <= a && a <= 10000 &&
//                 1 <= b && b <= 10000 &&
//                 1 <= c && c <= 10000 && a <= b) {
                  
              if(i < a) {
                  continue;
              }else if(i >= a && i < b) {
                  //System.out.print(i +" ");
                  //if a == ?´???°????????????????????¢??????
                  if(c % i == 0) {
                      count ++;
                      }                  
              }else if(i == b) {
                  //System.out.print(i);
                  if(c % i == 0) {
                      count ++;
                      }
                  }
//                }else {
//                  break;
//              }
            }
          if(1 <= a && a <= 10000 &&
             1 <= b && b <= 10000 &&
             1 <= c && c <= 10000 && a <= b) {
              System.out.println(count);
          }
    }
          
        //System.out.println(count);
}

Measured memory_bytes: 26272
#include <bits/stdc++.h>
using i64 = long long;

long long *fact, *inv;

template <class T>
T pow(T x, T n, T mod) {
    T ret = 1;
    while(n > 0) {
        if ((n & 1) == 1) ret = (ret * x) % mod;
        x = (x * x) % mod;
        n >>= 1;
    }
    return ret;
}

template <class T>
T inverse(T x, T p) { return pow(x, p - 2, p); }

void init_factorial(int n, long long mod) {
    fact = new long long[n + 1];
    inv = new long long[n + 1];
    fact[0] = 1;
    for (long long i = 1; i <= n; i++) fact[i] = fact[i - 1] * i % mod;
    inv[n] = inverse(fact[n], mod);
    for (long long i = n; i > 0; i--) inv[i - 1] = inv[i] * i % mod;
}

int main() {
    int q;
    constexpr i64 mod = 1000003;
    std::cin >> q;
    init_factorial(mod - 1, mod);
    while (q--) {
        i64 x, d, n;
        std::cin >> x >> d >> n;
        if (d == 0) {
            std::cout << pow(x, n % (mod - 1), mod) << std::endl;
            continue;
        }
        auto t = x * inverse(d, mod) % mod;
        if (t + n - 1 >= mod || t == 0) std::cout << 0 << std::endl;
        else std::cout << fact[t + n - 1] * inv[t - 1] % mod * pow(d, n % (mod - 1), mod) % mod << std::endl;
    }

    return 0;
}


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

int main(void){
   ll N,P;
   cin >> N;
   ll cnt=0;
   ll c=1000000000;
   
   rep(i,N){
       cin >> P;
       if(min(c,P)==P){
           cnt++;
       }
       c=min(c,P);
   }
   cout << cnt << endl;
}


Measured memory_bytes: 3592
# include <stdio.h>
int main()
{
    long long int t,a,i,p,m=1000000007,r;

    while(scanf("%lld %lld",&a,&p)==2)
    {
        r = 1;

        while(p)
        {
            if(p%2)
                r = (r*a)%m;
            a = (a*a)%m;
            p/=2;
        }

        printf("%lld\n",r);
    }

    return 0;
}

Measured memory_bytes: 1028
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

public class Main {
    char[][] css;

    public static void main(String args[]) {
        new Main().run();
    }

    void run() {
        FastReader sc = new FastReader();
        css = new char[2][3];
        for (int i = 0; i < 2; i++) {
            css[i] = sc.next().toCharArray();
        }
        solve();
    }

    void solve() {
        if (css[0][0] == css[1][2] && css[0][1] == css[1][1] &&
                css[0][2] == css[1][0]) {
            System.out.println("YES");
        } else {
            System.out.println("NO");
        }
    }

    static class FastReader {
        BufferedReader br;
        StringTokenizer st;

        public FastReader() {
            br = new BufferedReader(new
                    InputStreamReader(System.in));
        }

        String next() {
            while (st == null || !st.hasMoreElements())
            {
                try
                {
                    st = new StringTokenizer(br.readLine());
                }
                catch (IOException e)
                {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

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

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

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

        String nextLine() {
            String str = "";
            try
            {
                str = br.readLine();
            }
            catch (IOException e)
            {
                e.printStackTrace();
            }
            return str;
        }
    }
}


Measured memory_bytes: 20052
#include <iostream>
#include <stdio.h>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <iomanip>
#include <queue>
#include <deque>
#include <map>
#include <unordered_map>
#define rep(i,n) for(int i=0;i<n;i++)
#define repn(i,n) for(int i=1;i<=n;i++)
#define repr(e,x) for(auto& e:x)
using namespace std;
typedef long long ll;
typedef long double ld;
//typedef pair<ll,ll> P;
//ll const INF=1001001001;
//ll const INF=1001001001001001001;
ll const MOD=1000000007;

int M;

int main(){
    cin>>M;

    cout<<(24-M)+24<<endl;
}

Measured memory_bytes: 3636
#include <iostream>
#include <math.h>
#include <algorithm>
#include <string>
#include <vector>

#include <cstring>
#include <set>
#include <map>
#include <queue>
#include <utility>

using namespace std;

typedef long long LL;

#define dump(c) { for (auto it = c.begin(); it != c.end(); ++it) if (it == c.begin()) cout << *it; else cout << ' ' << *it; cout << endl; } 


int main()
{
    const int mod = 2019;

    int L, R;
    cin >> L >> R;

    int lr = L % mod;
    int rr = R % mod;

    int ans = 0;

    if (lr < rr && L / mod == R / mod) {
        ans = (lr * rr) % mod;
        for (int i = lr; i < rr; ++i) {
            for (int j = i+1; j <= rr; ++j) {
                ans = min(ans, (i * j) % mod);
            }
        }
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256
import java.util.Arrays;
import java.util.Scanner;

public class Main {
	static Scanner sc = new Scanner(System.in);
	static int N = sc.nextInt();
	static long[] A = new long[N];
	static long[] B = new long[N];
	static long[] D = new long[N];
	static {
		Arrays.setAll(A, i->sc.nextLong());
		Arrays.setAll(B, i->sc.nextLong());
	}
	public static void main(String[] args) {
		for (int i = 0; i < N; i++) {
			D[i] = A[i] - B[i];
		}
		if (Arrays.stream(D).sum() < 0) {
			System.out.println(-1);
			return;
		}
		if (Arrays.stream(D).allMatch(i-> i >= 0)) {
			System.out.println(0);
			return;
		}
		long ans = Arrays.stream(D).filter(i-> i < 0).count();
		long shortage = Arrays.stream(D).filter(i-> i < 0).sum();
		long[] remains = Arrays.stream(D).filter(i-> i > 0).sorted().toArray();
//		System.out.println(Arrays.toString(remains));
		for (int i = remains.length - 1; i >= 0; i--) {
			shortage += remains[i];
			ans++;
			if (shortage >=0 ) {
				break;
			}
		}
		System.out.println(ans);
	}
}

Measured memory_bytes: 91352
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
using namespace std;

const int INF = 1 << 28;
const int MAX_HP = 100000;
int enemy[110];
int dp[2][MAX_HP + 10];

void calc(int idx, vector<int> cst, vector<int> dmg) {
    int N = cst.size();
    fill(dp[idx], dp[idx] + MAX_HP + 1, INF);
    dp[idx][0] = 0;

    for(int i=0; i<N; i++) {
        for(int j=0; j<=MAX_HP; j++) {
            if(dp[idx][j] == INF) continue;
            int nj = min(MAX_HP, j+dmg[i]);
            dp[idx][nj] = min(dp[idx][nj], dp[idx][j] + cst[i]);
        }
    }
}

int main() {
    int N, M;
    while(cin >> N) {
        if(N == 0) break;
        for(int i=0; i<N; i++) cin >> enemy[i];
        cin >> M;

        vector<int> cst1, cst2, dmg1, dmg2;
        for(int i=0; i<M; i++) {
            string s, target;
            int cost, damage;
            cin >> s >> cost >> target >> damage;
            damage = min(damage, MAX_HP);
            if(target == "Single") {
                cst1.push_back(cost);
                dmg1.push_back(damage);
            }
            else {
                cst2.push_back(cost);
                dmg2.push_back(damage);
            }
        }

        calc(0, cst1, dmg1);
        calc(1, cst2, dmg2);
        for(int j=MAX_HP-1; j>=0; j--) {
            dp[0][j] = min(dp[0][j], dp[0][j+1]);
        }

        int ans = INF;
        // 全体攻撃によるダメージ
        for(int dmg=0; dmg<=MAX_HP; dmg++) {
            int tmp = dp[1][dmg];
            if(tmp == INF) continue;
            bool ok = true;
            for(int i=0; i<N; i++) {
                if(enemy[i] <= dmg) continue;
                if(dp[0][enemy[i] - dmg] == INF) ok = false;
                tmp += dp[0][enemy[i] - dmg];
            }
            if(ok) ans = min(ans, tmp);
        }
        cout << ans << endl;
    }
    return 0;
}


Measured memory_bytes: 3824
#include <iostream>
#include <algorithm>
using namespace std;
int n, a[9], p[9]; char c[9];
int main() {
	cin >> n;
	for (int i = 0; i < n; i++) {
		for (int j = 0; j < 9; j++) cin >> a[j], p[j] = j;
		for (int j = 0; j < 9; j++) cin >> c[j];
		int f = 0;
		do {
			int g = 1;
			for (int j = 0; j < 9; j += 3) {
				if (!(c[p[j]] == c[p[j + 1]] && c[p[j]] == c[p[j + 2]])) { g = 0; break; }
				int b[3] = { a[p[j]], a[p[j + 1]], a[p[j + 2]] };
				sort(b, b + 3);
				if ((b[1] - b[0]) != (b[2] - b[1]) || (b[1] - b[0]) >= 2) { g = 0; break; }
			}
			if (g) { f = 1; break; }
		} while (next_permutation(p, p + 9));
		cout << f << endl;
	}
	return 0;
}

Measured memory_bytes: 3040
int main(){
  int n, i, score = 0;
  scanf("%d", &n);
  int a[n], b[n], c[n-1];
  
 
  for(i = 0;i < n;i++){
    scanf("%d", &a[i]);
  }
  for(i = 0;i < n;i++){
    scanf("%d", &b[i]);
  }
  for(i = 0;i < n - 1;i++){
    scanf("%d", &c[i]);
  }
  
  score += b[a[0] - 1];
  
  for(i = 1;i < n;i++){
    score += b[a[i] - 1];
    if(a[i] == a[i - 1] + 1){
      score += c[a[i - 1] - 1];
    }
  }
  
  printf("%d", score);    
    
  return(0);
}

Measured memory_bytes: 128
#include <stdio.h>

int ban[8][8];

void queen(int,int,int*,int*,int*,int*);

int main(){
  int i,j,n,key1,key2,row[8],col[8],dpos[15],dneg[15];

  scanf("%d",&n);

  for(i=0;i<8;i++){
    for(j=0;j<8;j++){
      ban[i][j]=0;
    }
    row[i]=col[i]=dpos[2*i]=dpos[2*i+1]=dneg[2*i]=dneg[2*i+1]=0;
  }
  
  for(i=0;i<n;i++){
    scanf("%d%d",&key1,&key2);

    ban[key1][key2]=1;
    row[key1]=1;
    col[key2]=1;
    dpos[key1+key2]=1;
    dneg[key1-key2+7]=1;
  }

  queen(0,8,row,col,dpos,dneg);


  return 0;
}

void queen(int i,int n,int *row,int *col,int *dpos,int *dneg){
  int j;

 
    
  if(i==n){
    for(i=0;i<8;i++){
      for(j=0;j<8;j++){
        if(ban[i][j]) printf("Q");
        else printf(".");
      }
      printf("\n");
    }
  
      return;
    }



  if(row[i]){
    
    queen(i+1,n,row,col,dpos,dneg);
  }
  else{
    for(j=0;j<n;j++){

      if(col[j] || dpos[i+j] || dneg[i-j+7]) continue;

      ban[i][j]=1;
      row[i]=j;
      col[j]=dpos[i+j]=dneg[i-j+7]=1;

      queen(i+1,n,row,col,dpos,dneg);

      col[j]=dpos[i+j]=dneg[i-j+7]=ban[i][j]=0;
    }
    row[i]=0;
  }

}

  
    



Measured memory_bytes: 2104
#include <stdio.h>

#define N 100

void swap(int *, int *);

int main()
{
  int i, j, count = 0, n, flag = 1, A[N], tmp = 0;

  scanf("%d", &n);

  for(i = 0; i < n; i++)
    scanf("%d", &A[i]);

  /*ここからが挿入ソート*/
  while(flag == 1){
    flag = 0;
    for(j = n - 1; j >= 1; j--){
      if(A[j] < A[j - 1]){
	swap(&A[j], &A[j - 1]);
	  flag = 1;
	count++;
      }
    }
  }
  for(i = 0; i < n; i++){
    if(i != 0)
  printf(" ");
  printf("%d", A[i]);
  }
  printf("\n%d\n", count);
  
  return 0;
}

void swap(int *x, int *y)
{
  int tmp = 0;
  tmp = *y;
  *y = *x;
  *x = tmp;
}





Measured memory_bytes: 2084
#include <stdio.h>
#include <stdlib.h>
#define MAX 1000

int main(){
  int MATRIX[MAX][MAX]; //0??§??????????????????
  int n, from, to, deg, i, j;
  
  /* number of size */
  scanf("%d", &n);
  
  /* create matrix */
  for(i=0;i<n;i++){
    scanf("%d %d", &from, &deg);
    from--; //????????????0????????????????????????
    for(j=0;j<deg;j++){
      scanf("%d", &to);
      to--; //????????????0????????????????????????
      MATRIX[from][to] = 1; //u??¨v?????????????????????
    }
  }
  
  /* print */
  for(i=0;i<n;i++){
    for(j=0;j<n;j++){
      if(j){
        printf(" ");
      }
      printf("%d", MATRIX[i][j]);
    }
    printf("\n");
  }
  
  return 0;
}

Measured memory_bytes: 992
#include<iostream>
#include<string>
#include<vector>
#include<math.h>
#include<cmath>
#include<stack>
#include <algorithm>
#include <functional>
//#include<stdlib.h>
using namespace std;
int main() {
	int n,t=0;
	cin >> n;
	int p = n / 2;
	vector<int>c(n);
	for (int a = 0; a < n; a++) { cin >> c[a]; }
	std::sort(c.begin(), c.end());
	 cout << (c[p]-c[p-1]); 
	return 0;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
 
using ll=long long;
 
#define rng(i,a,b) for(int i=int(a);i<int(b);i++)
#define rep(i,b) rng(i,0,b)
#define gnr(i,a,b) for(int i=int(b)-1;i>=int(a);i--)
#define per(i,b) gnr(i,0,b)
#define pb push_back
#define eb emplace_back
#define a first
#define b second
#define bg begin()
#define ed end()
#define all(x) x.bg,x.ed
const int MOD = 1000000007; 

int main() {
    int n, t; 
    cin >> n >> t;
    int et = t, st = 0, ret=0;
    rep(i, n) {
        int ti; cin >> ti;
        if (et < ti) {
            ret += et - st;
            st = ti;
        } 
        et = t + ti;
    } 
    ret += et - st;
    cout << ret << endl;
    return 0;
}

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

int main() {
int a,b,c,d,e;
cin>>a>>b>>c>>d>>e;
if(a==0)  cout  <<  "1"  <<  endl;
else if(b==0)cout<<"2"<<endl;
else if(c==0)cout<<"3"<<endl;
else if(d==0)cout<<"4"<<endl;
 else cout<<"5"<<endl;
}

Measured memory_bytes: 3588
#include <iostream>
#include <string>
#include <sstream>
#include <algorithm>
#include <vector>
#include <utility>
#include <functional>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
 
using namespace std;
 
#define rep(i,n) for(int i=0; i<(n); i++)
#define repc(i,s,e) for(int i=(s); i<(e); i++)
#define pb(n) push_back((n))
#define mp(n,m) make_pair((n),(m))
#define all(r) r.begin(),r.end()
#define fi first
#define se second
 
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vii;
typedef vector<ll> vl;
typedef vector<vl> vll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
 
 
const int INF = 10000000;
const int mod = 1e9 + 7;
const double EPS = 1e-9;
 

int main(){
	int n, l;
	cin>>n>>l;
	vi v(n, 0);
	rep(i, n) cin>>v[i];
	vi t(n, 0);
	int cnt = 0;
	int tmp;
	while(1){
		for(int i = 0; i < n; i++){
			if(t[i] > 0) continue;
			if(i > 0 && v[i] <= v[i-1]) continue;
			if(i < n-1 && v[i] <= v[i+1]) continue;
			cnt++;
			tmp = 0;
			if(i > 0) tmp = max(tmp, t[i-1]);
			if(i < n-1) tmp = max(tmp, t[i+1]);
			t[i] = tmp + l-v[i];
			v[i] = 0;
			//cnt++;
			if(cnt == n) break;
		}
		if(cnt == n) break;
	}
	int ans = 0;
	for(int i = 0; i < n; i++){
		ans = max(ans, t[i]);
	}
	cout<<ans<<endl;
}

Measured memory_bytes: 1796
#include<iostream>
#include<math.h>
using namespace std;
int isPrime(int n){
    if(n<2)return 0;
    double sqrtn= sqrt(n);
    for(int i=2;i<=sqrtn;i++){
        if(n%i==0)return 0;
    }
    return 1;
}
int main(void){
    int n=1;
    while(n){
        cin>>n;
        for(int i=n;i>0;i--){
            if(isPrime(i)*isPrime(i-2)){
                cout<<i-2<<" "<<i<<endl;
                break;
            }
        }
    }
    return 0;
}


Measured memory_bytes: 3088
# coding: utf-8
import collections
N=int(input())
S=[]
for i in range(N):
    S.append(input())

c = collections.Counter(S)

values, counts = zip(*c.most_common())

ans=[]
cnt=0
m=counts[0]
for i in range(len(values)):
    if counts[i]==m:
        ans.append(values[i])
        cnt+=1
    else:
        break
ans.sort()
for i in range(cnt):
    print(ans[i])

Measured memory_bytes: 127184
#include <bits/stdc++.h>
#define rep(i, a, n) for (int i = a; i < n; i++)
#define repr(i, a, n) for (int i = n - 1; i >= a; i--)
using namespace std;
using ll = long long;
using P = pair<int, int>;
template <typename T> void chmin(T &a, T b) { a = min(a, b); }
template <typename T> void chmax(T &a, T b) { a = max(a, b); }

ll gcd(ll a, ll b) {
  if (b > a)
    return gcd(b, a);
  if (b == 0)
    return a;
  return gcd(b, (a % b));
}

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

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

  int n;
  cin >> n;

  ll ans = 1;
  rep(i, 0, n) {
    ll t;
    cin >> t;
    ans = lcm(ans, t);
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
using namespace std;
int dp[1001][1001];
string s,t;
int n,m,a,ans;
int main(){
  cin>>a;
  for(int k=0;k<a;k++){
    cin>>s>>t;
    for(int i=0;i<=1000;i++)
      for(int j=0;j<=1000;j++)
    dp[i][j]=0;
    m=s.size();
    n=t.size();
    ans=0;
    for(int i=1;i<=m;i++){
      for(int j=1;j<=n;j++){
    if(s[i-1]==t[j-1]){
      dp[i][j]=dp[i-1][j-1]+1;
    }else{
      dp[i][j]=max(dp[i-1][j],dp[i][j-1]);
    }
      }
    } 
    cout<<dp[m][n]<<endl;
  }
  return 0;
}



Measured memory_bytes: 7100
#include<stdio.h>
int main() {
	int n, i, a[10000], min=1000000, max=-1000000;
	long long int sum=0;
	scanf("%d\n", &n);
	for (i = 0;i < n;i++) {
		scanf("%d", &a[i]);
	}
		for (i = 0;i < n;i++) {
			if (a[i] < min) {
				min = a[i];
			}
			if (a[i] > max) {
				max = a[i];
	}
			sum = sum + a[i];
		}
		printf("%d %d %lld\n", min, max, sum);
		return 0;
}

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

int main(){
    int N,K; cin >> N >> K;
    if(N==K){
        cout << 1 << endl;
        return 0;
    }
    K--;
    int l,r;
    l=r=0;
    for(int i=0;i<N;i++){
        int A;
        cin >> A;
        if(A!=1) l++;
        if(A==1) break;
    }
    r=(N-1)-l;
    int ans=(r+l+(K-1))/K;
    cout << ans << endl;
}

Measured memory_bytes: 256
#include <cstdio>
#include <cmath>
#include <vector>
using namespace std;

typedef vector<double> point;
typedef const point &rpoint;

point add(rpoint p1, rpoint p2){
	point p(3);
	for(int i = 0; i < 3; ++i)
		p[i] = p1[i] + p2[i];
	return p;
}

point sub(rpoint p1, rpoint p2){
	point p(3);
	for(int i = 0; i < 3; ++i)
		p[i] = p1[i] - p2[i];
	return p;
}

point mul(double t, rpoint p2){
	point p(3);
	for(int i = 0; i < 3; ++i)
		p[i] = t * p2[i];
	return p;
}

double abs(rpoint p){
	double s = 0.0;
	for(int i = 0; i < 3; ++i)
		s += p[i] * p[i];
	return sqrt(s);
}

int main(){
	int n;
	point p(3);

	while( scanf("%d", &n), n != 0 ){
		vector<point> v;
		v.reserve(n);

		for(int i = 0; i < n; ++i){
			for(int j = 0; j < 3; ++j){
				scanf("%lf", &p[j]);
			}
			v.push_back(p);
		}
		
		double mv = 0.5;
		double minr;
		while( mv > 1e-8 ){
			for(int k = 0; k < 100; ++k){
				minr = -1.0;
				int mini = -1;
				
				for(int i = 0; i < n; ++i){
					double r = abs(sub(v[i], p));
					if( minr < r ){
						minr = r;
						mini = i;
					}
				}
				
				p = add(p, mul(mv, sub(v[mini], p) ) );
			}
			
			mv *= 0.5;
		}
		
		printf("%.10f\n", minr);
	}
}

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

int main()
{
  int N;

  cin >> N;

  int div=(double)N/1.08;
  int ans;
  bool flag=false;
  
  for (int i = 0; i < 2; i++)
  {
    if(N==(int)((double)(div+i)*1.08)){
      flag=true;
      ans=div+i;
      // cout << (double)(div+i)*1.08 << endl;
      // cout << div << endl;
    }
  }
  if(flag){
    cout << ans << endl;
  }else{
    cout << ":(" << endl;
  }
  return 0;
}

Measured memory_bytes: 256
import sys

N, K = map(int, sys.stdin.readline().split())
H =list(map(int, sys.stdin.readline().split()))

sH = sorted(H, reverse = True)

sum = 0
if K > N:
    print(0)
else:
    for i in range(K, N):
        sum += sH[i]
    print(sum)

Measured memory_bytes: 26372
#include <stdio.h>
int main(){
  int n, x, r=1<<29;
  for(scanf("%d", &n);n--;){
    int r0=0;
    scanf("%d", &x);
    for(;x%2<1;x/=2)r0++;
    if(r>r0)r=r0;
  }
  printf("%d\n", r);
  return 0;
}

Measured memory_bytes: 1732
import java.util.*;
import java.io.*;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Collections;
import java.util.StringTokenizer;
public class Main{
	static FastScanner fs=new FastScanner();
	static PrintWriter pw=new PrintWriter(System.out);
	static void Solve(long the){
		int n=fs.nextInt();
		int[] count=new int[10005];
		for(int i=0;i<10005;i++){
			count[i]=0;
		}
		for(int i=1;i<=100;i++){
			for(int j=1;j<=100;j++){
				for(int k=1;k<=100;k++){
					int x=(i*i)+(j*j)+(k*k)+(i*j)+(j*k)+(k*i);
					if(x>10000)	continue;
					count[x]++;
				}
			}
		}
		for(int i=1;i<=n;i++){
			pw.println(count[i]);
		}


		
	}
	public static void main(String args[]){
		long t=1;
		// t=fs.nextInt();
		for(long i=1;i<=t;i++){
			Solve(i);
		}
		pw.close();
	}
	static class FastScanner {
		BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
		StringTokenizer st=new StringTokenizer("");
		String next(){
			while((!st.hasMoreTokens()) || (st==null)){
				try{
					st=new StringTokenizer(br.readLine());
				}
				catch(IOException e){
					e.printStackTrace();
				}
			}
			return st.nextToken();
		}
		int nextInt(){
			return Integer.parseInt(next());
		}
		int[] readArray(int n){
			int[] a=new int[n];
			for(int i=0;i<n;i++)	a[i]=nextInt();
			return a;
		}
		long nextLong(){
			return Long.parseLong(next());
		}
		double nextDouble(){
			return Double.parseDouble(next());
		}
		String nextLine(){
			String str="";
			try{
				str=br.readLine();
			}
			catch(IOException e){
				e.printStackTrace();
			}
			return str;
		}
	}
}

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

void Solve()
{
    int n, k;
    string s;
    cin >> n >> k;
    cin >> s;
    s[k - 1] = tolower(s[k - 1]);
    cout << s << endl;
}

int main()
{
    Solve();
    return 0;
}

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

int main() {
    int n,j,i,k;cin>>n>>k;
    vector<int> a(n),dp(n,INT_MAX);
    for(i=0;i<n;i++) cin>>a[i];
    dp[0]=0;
    for(i=1;i<n;i++){
        for(j=1;j<=k;j++){
            if(i-j<0) break;
            dp[i]=min(abs(a[i]-a[i-j])+dp[i-j],dp[i]);
        }
    }
    cout<<dp[n-1];
}


Measured memory_bytes: 4004
def main() -> None:
    N = int(input())
    S = input()
    m = 0
    for i in range(len(S)):
        l1 = S[0:i]
        l2 = S[i:]
        if m < len(set(sorted(l1)) & set(sorted(l2))):
            m = len(set(sorted(l1)) & set(sorted(l2)))
    
    print(m)


if __name__ == '__main__':
    main()


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

int main(void){
    string S;
    cin >> S;
    int cnt=0;
    char flag=S[0];

    for(int i=0; i<S.size(); i++){
        if(flag=='B' and S[i]=='W'){
            cnt++;
            flag='W';
        }
        if(flag=='W' and S[i]=='B'){
            cnt++;
            flag='B';
        }
    }

    cout << cnt << endl;
    return 0;
} 

Measured memory_bytes: 512
// Leviathan-R
#include <bits/stdc++.h>
#define maxN 200005
#define inf (int) 1e9
#define FOR(i, a, b) for(int i = a; i <= b; i++)
#define REP(i, a, b) for(int i = a; i >= b; i--)

using namespace std;

int n;
char a[maxN];
int s[maxN];

void enter() {
    cin >> n;
    FOR(i, 1, n) cin >> a[i];
    FOR(i, 1, n)
       s[i] = s[i - 1] + (a[i] == 'R');
}

void solve() {
    int S = 0, ans = inf;
    REP(i, n, 1) S += (a[i] == 'R') ? 1 : 0;
    ans = min(S, n - S);
    FOR(i, 1, S) {
        int res = 0;
        res += i - s[i] + S - i;
        ans = min(ans, res);
    }
    cout << ans;
}

int main() {
    //freopen("main.inp", "r", stdin);
    enter();
    solve();
}


Measured memory_bytes: 4568
#include<bits/stdc++.h>
#define int long long
using namespace std;
#define deb(x) cout<<#x<<" = "<<x<<"\n";
int dp[3001][3001];

signed main()
{
	//freopen("input.txt", "r", stdin);
	string s, t;
	cin>>s>>t;
	int n = s.length();
	int m = t.length();
	
	for(int i=0; i<=n; i++) dp[i][0] = 0;
	for(int j=0; j<=m; j++) dp[0][j] = 0;
	for(int i=1; i<=n; i++)
	{
		for(int j=1; j<=m; j++)
		{
			if(s[i-1] == t[j-1])
				dp[i][j] = 1 + dp[i-1][j-1];
			else 
				dp[i][j] = max(dp[i-1][j], dp[i][j-1]);
		}
	}
	string ans = "";
	
	int i = n, j = m;
	while(i>0 && j>0)
	{
		if(s[i-1] == t[j-1])
		{
			ans += s[i-1];
			i--; j--;
		}
		else
		{
			if(dp[i][j-1] > dp[i-1][j])
				j--;
			else 
				i--;
		}
		
	}
	reverse(ans.begin(), ans.end());
	cout<<ans;
}

Measured memory_bytes: 70656
#include<iostream>
#include<cmath>
using namespace std;
const int maxn = 1e7+ 10;
const int inf = 0x3f3f3f3f;
int height[maxn];
long long dp[maxn][5];
long long a[maxn][4];

int main(){
    int n;
    scanf("%d", &n);
    for (int i = 1; i <= n;i++)
        scanf("%lld%lld%lld", &a[i][1], &a[i][2], &a[i][3]);
    dp[1][1] = a[1][1];
    dp[1][2] = a[1][2];
    dp[1][3] = a[1][3];
    for (int i = 2; i <= n;i++){
        dp[i][1] += max(dp[i - 1][2], dp[i - 1][3]) + a[i][1];
        dp[i][2] += max(dp[i - 1][1], dp[i - 1][3]) + a[i][2];
        dp[i][3] += max(dp[i - 1][1], dp[i - 1][2]) + a[i][3];
    }
    printf("%lld", max(dp[n][3],max(dp[n][1],dp[n][2])));
    return 0;
}

Measured memory_bytes: 10856
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")
    };
}

use std::collections::HashMap;

fn solve(as_: Vec<i64>) -> i64 {
    let mut m = HashMap::new();
    for a in as_ {
        *m.entry(a).or_insert(0) += 1;
    }

    let even = m.values().fold(0, |acc, x| if x % 2 == 0 { acc + 1 } else {acc} );
    m.len() as i64 - even % 2
}

fn main() {
    input!{
        n: usize,
        as_: [i64; n],
    }
    println!{"{}", solve(as_)};
}


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

using namespace std;


int main() {
    long long H, W;
    cin >> H >> W;
    if (H == 1 || W == 1) {
        cout << 1 << endl;
    }else{
        cout << ( (H * W) + 1 ) / 2 << endl;
    }

}

Measured memory_bytes: 256
#素数でない数
#   1
#   ２以外の２の倍数
#   二乗してもnumberを超えない奇数で割り切れない数
#素数でない数以外は全て素数
def checkPrime(number)
  if number == 2
    return true
  elsif number % 2 == 0
    return false
  else
    i = 3
    while (i * i < number + 1)
      if number % i == 0
        return false
      end
      i += 2
    end
    return true;
  end
end

#入力バッファ
numPrime = Array.new(1000000)
input = ""
counter = 0

#あらかじめ素数の数を求めておく
numPrime[0] = 0
numPrime[1] = 0
for i in 2...numPrime.size
  numPrime[i] = numPrime[i - 1]
  if checkPrime(i)
    numPrime[i] += 1
  end
end

#メインルーチン
while input = gets
  p numPrime[input.to_i]
end

Measured memory_bytes: 13904