akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define int long long
#define f first
#define s second
using namespace std;
int32_t main(){
	if(fopen("input.txt", "r"))
	{
		freopen("input.txt", "r", stdin);
		freopen("output.txt", "w", stdout);
	}
	ios::sync_with_stdio(0),cin.tie(0);
	int h,n,sum=0;
	cin >> h >> n;
	int a[n];
	for(int i=0;i<n;i++){
		cin >> a[i];
		sum+=a[i];
	}
	if(sum>=h)cout << "Yes";
	else cout << "No";
}

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

int N;
string S;

int main(){
    cin >> N;
    cin >> S;
    for(int i=0;i<S.size();i++){
      char c = S[i];
      c += N;
      if(c >= '[') c = c - 26;
      cout << c;
    }
}

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

namespace AtTest.C_Challenge
{
    class ABC_059
    {
        static void Main(string[] args)
        {
            Method(args);
            Console.ReadLine();
        }

        static void Method(string[] args)
        {
            int n = int.Parse(Console.ReadLine());
            string[] input = Console.ReadLine().Split(' ');
            var array = new long[n];
            for (int i = 0; i < n; i++)
            {
                array[i] = long.Parse(input[i]);
            }

            long sum = 0;
            bool plus = true;
            long firstPlusCnt = 0;
            for(int i = 0; i < n; i++)
            {
                sum += array[i];
                if (plus && sum <= 0)
                {
                    firstPlusCnt += 1-sum;
                    sum = 1;
                }
                else if (!plus && 0 <= sum)
                {
                    firstPlusCnt += 1 + sum;
                    sum = -1;
                }
                plus = !plus;
            }

            sum = 0;
            plus = false;
            long firstMinusCnt = 0;
            for (int i = 0; i < n; i++)
            {
                sum += array[i];
                if (plus && sum <= 0)
                {
                    firstMinusCnt += 1-sum;
                    sum = 1;
                }
                else if (!plus && 0 <= sum)
                {
                    firstMinusCnt += 1 + sum;
                    sum = -1;
                }
                plus = !plus;
            }

            if (firstPlusCnt < firstMinusCnt)
            {
                Console.WriteLine(firstPlusCnt);
            }
            else
            {
                Console.WriteLine(firstMinusCnt);
            }
        }
    }
}


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


int main() {

 string S;
 cin >> S;

 int ans = 0;

 for(int i = 0;i < S.size() - 1;i++) {
     if(S.at(i) != S.at(i + 1)) ans++;
 }

 cout << ans << endl;
}



Measured memory_bytes: 512
K, S = map(int, input().split())

count = 0

for i in range(K+1):
    x = i
    for j in range(min(K+1,S-x+1)):
        y = j
        z = S-x-y
        if x + y + z == S and z <= K:
            count += 1

print(count)


Measured memory_bytes: 42204
#include<iostream>
#include<cstdio>
using namespace std;
int n,x,a,b;
int main(){
	scanf("%d%d%d%d",&n,&x,&a,&b);
	if(n<=x)printf("%d",a*n);
	else printf("%d",a*x+b*(n-x));
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int n,ans;
string a,b,c;
int main()
{
	cin>>n>>a>>b>>c;
	for(int i=0;i<n;i++)
	{
		char c1=a[i],c2=b[i],c3=c[i];
		set<char>st;
		st.insert(c1);
		st.insert(c2);
		st.insert(c3);
		if(st.size()==1)
		{
			continue;
		}
		if(st.size()==2)
		{
			ans+=1;
			continue;
		}
		if(st.size()==3)
		{
			ans+=2;
			continue;
		}
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
using namespace std;
typedef long long ll;
 
int main()
{

string s, start, end;
 bool revflag=false;
cin>>s;

int Q;
cin>>Q;

for(int i=1;i<=Q;i++)
    {
        int T;
       
        cin>>T;
        
        if(T==1){
            revflag=!revflag;
        }else{
            int F;
            char C;
            cin>>F>>C;
            if(F==1){
                if(!revflag)
                    start=C+start;
                else
                    end=end+C;
            }else{
                if(!revflag)
                end=end+C;
                else
                start=C+start;
            }
            
        }
            
        
    }
if(revflag){
    reverse(s.begin(),s.end());
    reverse(start.begin(),start.end());
    reverse(end.begin(),end.end());
        cout<<end+s+start<<endl;
}else
    cout<<start+s+end<<endl;


  
  return 0;
}

Measured memory_bytes: 1512
N, Q = map(int, input().split())
vws = [tuple(map(int, input().split())) for _ in range(Q)]

anss = []
if N == 1:
    anss = [min(v, w) for v, w in vws]
else:
    for v, w in vws:
        v, w = v-1, w-1
        while v != w:
            if v > w:
                v = (v-1)//N
            else:
                w = (w-1)//N
        anss.append(v + 1)

print('\n'.join(map(str, anss)))


Measured memory_bytes: 25432
#include <stdio.h>

int main(void)
{
	int m, x, y, w, h, n, cx, cy, cat;
	int i, j;

	
	scanf("%d", &m);
	for (i = 0; i < m; i++) {
		cat = 0;
		scanf("%d%d%d%d", &x, &y, &w, &h);
		scanf("%d", &n);
		for (j = 0; j < n; j++) {
			scanf("%d%d", &cx, &cy);
			if (cx >= x && cx <= x + w)
				if (cy >= y && cy <= y + h)
					cat++;
		}
		printf("%d\n", cat);
	}
	
	return 0;
}

			

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

string acgt = "ACGT";

bool check(char c) {
  for (int i = 0; i < 4; i++)
  {
    if (c == acgt[i]) return true;
  }
  return false;
}

int main(){
  string S;
  cin >> S;
  int N = S.size();
  int ans =0;
  for (int i = 0; i < N; i++)
  {
    int tmp =0;
    for (int j = i; j < N; j++)
    {
      if (check(S[j])) tmp++;
      else break;
    }
    ans = max(ans, tmp);
  }
  cout << ans << endl;
}

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

int main() {
  string s; cin >> s;
  sort(s.begin(), s.end());
  if(s.at(0)== s.at(1) && s.at(2) == s.at(3) && s.at(0) != s.at(2)){
    cout << "Yes" << endl;
  }  else{
    cout << "No" << endl;
  }
}

Measured memory_bytes: 3556
n,m,c=map(int,input().split())
b=list(map(int,input().split()))
List=[]
ans=0
for i in range(n):
    code=list(map(int,input().split()))
    List.append(code)
for i in range(n):
    add=0
    for j in range(m):
        add+=List[i][j]*b[j]
    if add+c>0:
        ans+=1
print(ans)

Measured memory_bytes: 9192
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
typedef long long unsigned int ll;
 
int main() {
 
  vector<int> a(3);
  cin >> a[0];
  cin >>a[1];
  cin >>a[2];
  sort(a.begin(),a.end());
  cout << a[0]+a[1] <<endl;
   return 0;
}


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

vector<int> G[maxn];
int dp[maxn];
int n, m;

int dfs(int x) {
    if(~dp[x]) return dp[x];
    dp[x] = 0;
    for(int y : G[x]) {
        dp[x] = max(dp[x], dfs(y) + 1);
    }
    return dp[x];
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    cin >> n >> m;
    for(int i = 0; i < m; i++) {
        int x, y; cin >> x >> y;
        G[x].push_back(y);
    }
    int ans = 0;
    memset(dp, -1, sizeof(dp));
    for(int i = 1; i <= n; i++) {
        ans = max(ans, dfs(i));
    }
    cout << ans << '\n';
    return 0;
}


Measured memory_bytes: 11464
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>

int main(){
  char a[100000];
  long n=0;
  int i;
  int j=0;
  int h=0;
    for(i=0;i<1;i++){
    scanf("%s",a);
  }
  //printf("%d\n", strlen(a));
  for(i=0;i<strlen(a);i++){
//printf("%c", a[i]);
    if(a[i]=='0'){
      j++;
    }else if(a[i]=='1'){
      h++;
    }
  }
if(j>h){
  printf("%d",h*2);
}else{
  printf("%d",j*2);
}



//   long b[a[1]];
//   long c[a[1]];
//   long d[a[1]];//番目
//   long *e;
//   e = (long *)malloc(sizeof(long) * a[0]*a[1]);
//   long *f;
//   f = (long *)malloc(sizeof(long) * a[0]*a[1]);
//   for(i=0;i<a[0]*a[1];i++){
//     e[i]=0;
//     f[i]=0;
//   }
//   long g[a[0]];
//     for(i=0;i<a[0];i++){
//     g[i]=0;
//   }
//   for(j=0;j<a[1];j++){
//     scanf("%ld",b+j);
//     scanf("%ld",c+j);
//     e[(b[j]-1)*a[1]+g[b[j]-1]]=c[j];
//     f[(b[j]-1)*a[1]+g[b[j]-1]]=j;
//     d[j]=1;
//     g[b[j]-1]++;
//     for(h=0;h<g[b[j]-1];h++){
//       if(e[(b[j]-1)*a[1]+h]==0){}
//       else if(e[(b[j]-1)*a[1]+h]<c[j]){
//         d[j]++;
//       }
//       else if(e[(b[j]-1)*a[1]+h]>c[j]){
//         d[f[(b[j]-1)*a[1]+h]]++;
//       }
//     }
//   }
// for(i=0;i<a[1];i++){
//   printf("%06d",b[i]);
//   printf("%06d\n",d[i]);
// }
// for(i=0;i<a[1]*a[0];i++){
//   printf("%d,",e[i]);
// }
}

Measured memory_bytes: 256
#include<stdio.h>

int selectionSort(int A[], int N){
  int i,j,t,sw = 0,mini;
  for(i =0; i < N - 1; i++){
    mini = i;
    for( j = i; j < N; j++){
      if(A[j] < A[mini] )mini = j;
    }
    t = A[i];
    A[i] = A[mini];
    A[mini] = t;
    if( i != mini) sw++;
  }
  return sw;
}

int main(){
  int A[100],N,i,sw;

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

  sw = selectionSort(A,N);

  for(i = 0; i < N; i++){
    if(i > 0)printf(" ");
    printf("%d",A[i]);
  }
  printf("\n");
  printf("%d\n",sw);
  return 0;
}



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

vector<int> divisor(int n) {
  vector<int> ret;
  for(int i = 1; i * i <= n; i++) {
    if(n % i == 0) {
      ret.push_back(i);
      if(i * i != n) ret.push_back(n / i);
    }
  }
  sort(begin(ret), end(ret));
  return (ret);
}

int main() {
  int n;
  cin >> n;
  vector<int> a(n);
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  vector<int> ans;
  map<int, int> m;
  for (int i = n - 1; i >= 0; i--) {
    if (a[i] == 1 && m[i + 1]%2 == 0) {
      ans.push_back(i + 1);
      vector<int> l;
      l = divisor(i + 1);
      for (int j = 0; j < l.size(); j++) {
        m[l[j]]++;
      }
      l.clear();
    }
    else if (a[i] == 0 && m[i + 1]%2 == 1) {
      ans.push_back(i + 1);
      vector<int> l;
      l = divisor(i + 1);
      for (int j = 0; j < l.size(); j++) {
        m[l[j]]++;
      }
      l.clear();
    }
  }
  cout << ans.size() << endl;
  if (ans.size() != 0) {
    for (int i = 0; i < ans.size() - 1; i++) {
      cout << ans[i] << " ";
    }
    cout << ans[ans.size() - 1] << endl;
  }
  return 0;
}

Measured memory_bytes: 11512
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
using namespace __gnu_pbds;

#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define fbo find_by_order
#define ook order_of_key

typedef long long ll;
typedef pair<ll,ll> ii;
typedef vector<int> vi;
typedef long double ld;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pbds;

int main(){
    ios_base::sync_with_stdio(0); cin.tie(0);
    int x,a,b;
    cin>>x>>a>>b;
    if(b-a>x){
        cout<<"dangerous"<<endl;
    }
    else if(a>=b){
        cout<<"delicious"<<endl;
    }
    else {
        cout<<"safe"<<endl;
    }
    return 0;
}


Measured memory_bytes: 256
# D - XOR World

A, B = map(int, input().split())

def rangeXOR(x, y):
    ret = x
    for i in range(x+1, y+1):
        ret ^= i
    return ret

left = rangeXOR(A, A+(3-A%4))
right = rangeXOR(B-(B%4), B)
    
if left==0:
    print(right)
elif right==0:
    print(left)
else:
    print(left^right)

Measured memory_bytes: 3064
import heapq
import math

N, M = map(int, input().split())
A = []
for a in map(int, input().split()):
    heapq.heappush(A, -a)

for _ in range(M):
    neg_a = heapq.heappop(A)
    heapq.heappush(A, -math.floor(-neg_a/2))

print(-sum(A))

Measured memory_bytes: 14536
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

var sc = bufio.NewScanner(os.Stdin)

func nextInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

func nextInts(n int) []int {
	ints := make([]int, n)
	for i := 0; i < n; i++ {
		ints[i] = nextInt()
	}
	return ints
}

func main() {
	var n int
	fmt.Scan(&n)
	sc.Split(bufio.ScanWords)
	a := nextInts(n)
	b := nextInts(n)
	c := nextInts(n - 1)

	res := 0
	before := -100
	for i := 0; i < n; i++ {
		index := a[i] - 1
		res += b[index]
		if index-before == 1 {
			res += c[index-1]
		}
		before = index
	}
	fmt.Println(res)
}


Measured memory_bytes: 640
S = int(input())

# (X1,Y1) = (0,0)
# (X2,Y2) = (10**9,1)
# S = 10**9*Y3 - X3

from math import ceil

Y3 = ceil(S/(10**9))
X3 = Y3*(10**9) - S

print(0,0,10**9,1,X3,Y3)

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

using namespace std;

#define REP(i,n) for(ll (i) = (0);(i) < (n);++i)
#define MOD 1000000007
typedef long long ll;

ll dp[63][1<<3];
void mod_add(ll &a, ll b){
	a += b;
	a %= MOD;
}

int main(){
	ll l, r;cin >> l >> r;
	dp[0][0] = 1;

	REP(i, 62){
		REP(j, (1LL<<3)){
			REP(x, 2)REP(y, 2){
				if(x == 1 && y == 0)continue;
				int nj = j;
				if(!(nj & 1)){
					int tmp = ((l & (1LL << (61-i))) != 0);
					if(x < tmp)continue;
					else if(x > tmp)nj |= 1;
				}
				if(!(nj & 2)){
					int tmp = ((r & (1LL << (61-i))) != 0);
					if(y > tmp)continue;
					else if(y < tmp)nj |= 2;
				}
				if(!(nj & 4)){
					if(x + y != 0 && x + y != 2)continue;
					if(x + y == 2)nj |= 4;
				}
				mod_add(dp[i+1][nj], dp[i][j]);
			}
		}
	}

	ll ans = 0;
	REP(i, 8)mod_add(ans, dp[62][i]);
	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <set>
#include <string>
#include <vector>

using namespace std;
using LLONG = long long;

int main()
{
    string S;
    cin >> S;

    if (S[0] == S[1] || S[1] == S[2] || S[2] == S[3])
    {
        cout << "Bad" << endl;
    }
    else
    {
        cout << "Good" << endl;
    }
}


Measured memory_bytes: 256
def solve():
    from math import sqrt
    from sys import stdin
    f_i = stdin
    
    def dfs(point, remain, elapsed):
        if not remain:
            return True
        
        next_c = set()
        for c in remain:
            new_elapsed = elapsed + adj[point][c]
            if new_elapsed >= from_d[c]:
                return False
            next_c.add((c, new_elapsed))
        
        for c, new_elapsed in next_c:
            remain.remove(c)
            if dfs(c, remain, new_elapsed):
                return True
            remain.add(c)
        
        return False
    
    while True:
        n, hx, hy, dx, dy = map(int, f_i.readline().split())
        if n == 0:
            break
        
        C = [tuple(map(int, f_i.readline().split())) for i in range(n)]
        from_d = tuple(sqrt((cx - dx) ** 2 + (cy - dy) ** 2) for cx, cy in C)
        C.append((hx, hy))
        adj = tuple(tuple(sqrt((px - qx) ** 2 + (py - qy) ** 2) for qx, qy in C) for px, py in C)
        
        if dfs(n, set(range(n)), 0):
            print("YES")
        else:
            print("NO")

solve()


Measured memory_bytes: 5808
n=int(input())
h=list(map(int,input().split()))
dp=[0]*n
dp[0]=0
dp[1]=abs(h[1]-h[0])
for i in range(2,n):
    dp[i]=min((dp[i-1]+abs(h[i]-h[i-1])),dp[i-2]+abs(h[i]-h[i-2]))
print(dp[n-1])

Measured memory_bytes: 52208
using System;
using System.Collections;
using System.Collections.Generic;
using System.Text;
using System.Linq;
using static MyIO;


public class C
{
	public static void Main() => (new Solver()).Solve();
}


public class Solver
{
	public void Solve()
	{
		int N = GetInt();

		int leftState = GetState(0);
		if(leftState == 0)
			return;

		int rightState = GetState(N - 1);
		if(rightState == 0)
			return;
		
		int left = 0;
		int right = N - 1;
		while(true)
		{
			int mid = (left + right) / 2;
			int midState = GetState(mid);
			if(midState == 0)
				return;

			bool inLeft = (((mid - left + 1) % 2) == 1) ^ (midState == leftState);
			if(inLeft)
			{
				right = mid;
				rightState = midState;
			}
			else
			{
				left = mid;
				leftState = midState;
			}
		}
	}

	private int GetState(int x)
	{
		Console.WriteLine(x);
		string S = GetString();
		return S.Equals("Vacant") ? 0 : S.Equals("Male") ? 1 : 2;
	}
}


public static class MyIO
{
	private static string[] args = null;
	private static int num = -1;
	private static int used = -1;

	private static string getArg()
	{
		if(used == num)
		{
			args = Console.ReadLine().Split(' ');
			num = args.Length;
			used = 0;
		}
		return args[used++];
	}

	public static int GetInt() => int.Parse(getArg());
	public static long GetLong() => long.Parse(getArg());
	public static double GetDouble() => double.Parse(getArg());
	public static string GetString() => getArg();
	public static char GetChar() => getArg()[0];
	public static int[] GetInts(int N) => Enumerable.Range(0, N).Select(_ => GetInt()).ToArray();
	public static long[] GetLongs(int N) => Enumerable.Range(0, N).Select(_ => GetLong()).ToArray();
	public static double[] GetDoubles(int N) => Enumerable.Range(0, N).Select(_ => GetDouble()).ToArray();
	public static string[] GetStrings(int N) => Enumerable.Range(0, N).Select(_ => GetString()).ToArray();
}


Measured memory_bytes: 13640
#include<bits/stdc++.h>
using namespace std;
long long sum,a[505],ans,a2[505];
int n,k,tot,n1;
int a1[10005][2];
inline void C(long long x)
{
	for(int i=1;i<=n1;i++)
		a2[i]=a[i]%x;
	sort(a2+1,a2+n1+1);
	int l=1,r=n1,cnt=0;
	while(l<r) {
		int dir=min(a2[l],x-a2[r]);
		cnt+=dir;
		a2[l]-=dir;
		a2[r]+=dir;
		if(a2[l]==0) l++;
		if(a2[r]==x) r--;
	}
	if(cnt<=k) ans=max(ans,x);
}
inline void dfs(int x,long long ml)
{
	if(x==tot+1)
	{
		if(ml>ans)
			C(ml);
		return;
	}
	dfs(x+1,ml);
	for(int i=1;i<=a1[x][1];i++)
	{
		ml*=a1[x][0];
		dfs(x+1,ml);
	}
}
int main()
{
	scanf("%d%d",&n,&k);
	n1=n;
	for(int i=1;i<=n;i++)
		scanf("%lld",&a[i]),sum+=a[i];
	for(int i=2;i*i<=sum;i++)
		if(sum%i==0)
		{
			a1[++tot][0]=i;
			while(sum%i==0)
				sum/=i,a1[tot][1]++;
		}
	a1[++tot][0]=sum;
	a1[tot][1]=1;
	if(sum!=1)
		a1[++tot][0]=1,a1[tot][1]=1;
	dfs(1,1);
	printf("%lld",ans);
}

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

using namespace std;

const int N = 1e5 + 10;
typedef long long ll;




char s[100];
int n;




int main()
{

    scanf("%d %s",&n,s);

    int cnt = 0;
    int len = strlen(s);
    for(int i = 0 ; i < n-2 ; ++i){
        if(s[i] == 'A' && s[i+1] == 'B' && s[i+2] == 'C')
            cnt++;
    }

    printf("%d\n",cnt);




    return 0;
}


Measured memory_bytes: 256
x = int(input())
a, b = 0,0
done = False
for i in range(-2000, 2000):
    for l in range(2000,-2000, -1):
        if((i**5)-(l**5)==x):
            a = i
            b = l
            print(a,b)
            done  = True
            break
    if(done):
        break

Measured memory_bytes: 65920
v,e = map(int,input().split()) #v:頂点, e:辺
graph = [[] for i in range(v)]
cost = [[float('inf')]*v for i in range(v)]
for i in range(e):
    x,y,z = map(int,input().split())
    cost[x][y] = z
dp = [[float('inf')]*v for i in range(1<<v)]
#(1<<v)-1 == 2**v-1
dp[(1<<v)-1][0] = 0 #全ての頂点を訪れて帰ってきた時（ここがゴール）
for i in range(2**v-2, -1, -1): #まだ見ていない頂点集合に対して
    for j in range(v): #現在いる頂点から
        for k in range(v): #次に行く頂点について
            if i>>k & 1 != 1: #まだ訪れていないならば
                dp[i][j] = min(dp[i][j], dp[i|1<<k][k]+cost[j][k])
            #dp[i|1<<k]は「kを訪れた状態」を指す。
            #視点を変える。「今kにいる状態からゴールに至るのに必要なコスト」+「j→kに必要なコスト」は、
            #「今jにいる状態からゴールに至るのに必要なコスト」になる（遡る）
            #これを「今0にいる状態からゴールに至るのに必要なコスト」まで遡って計算する。
if dp[0][0] != float('inf'):
    print(dp[0][0]) #まだどこも訪れていない状態から、ゴールである0を目指して進む
else:
    print(-1)



Measured memory_bytes: 20580
#include <bits/stdc++.h>
using namespace std;
// (setq-default c-basic-offset 2)
int main() {
  int a, b;
  cin >> a >> b;

  // find price
  // floor(price * 0.08) = a
  // floor(price * 0.10) = b

  // a * 100 <= price * 8  <= a * 100 + 99
  // b * 100 <= price * 10 <= b * 100 + 99

  // +

  // 100 * (a + b) <= 18 * price << 100 * (a + b) + 2*99

  int l = 100 * (a + b);
  int h = 100 * (a + b) + 2 * 99;

  for (int i = l; i <= h; ++i) {
    int p = i / 18;
    int t8 = (int)(0.08 * (double)(p));
    int t10 = (int)(0.1 * (double)(p));
    // cout << "trying " << (i);
    // cout << " <-> p = " << p << endl;
    // cout << "t8 = " << t8 << "   t10 = " << t10 << endl << endl;

    if (t8 == a and t10 == b) {
      cout << p << endl;
      return 0;
    }
  }
  cout << (-1) << endl;
  return 0;
}


Measured memory_bytes: 3616
a, b = map(int, input().split())

c1 = '#' if a < b else '.'
c2 = '.' if a < b else '#'

ans = []

WIDTH = 50
d = abs(a - b)
d1 = d % WIDTH
d2 = d // WIDTH
e = min(a, b) - 1
f = e % WIDTH
e = e // WIDTH
ans.append(c1*WIDTH*2)
ans.append((c2+c1)*f + c1 * 2 * (WIDTH - f))
ans.append(c1*WIDTH*2)
for i in range(e+1):
    if i % 2 == 0:
        ans.append((c1+c2)*WIDTH)
    else:
        ans.append((c2+c1)*WIDTH)
ans.append(c2*WIDTH*2)
ans.append((c1+c2)*f + c2 * 2 * (WIDTH-f))
ans.append(c2*WIDTH*2)

if d1 != 0:
    ans.append((c2+c1)*d1 + c2 * 2 * (WIDTH - d1))
    ans.append(c2*WIDTH*2)
for i in range(d2):
    ans.append((c2+c1)*WIDTH)
    ans.append(c2*WIDTH*2)


print(len(ans), WIDTH*2)
for ansi in ans:
    print(ansi)


Measured memory_bytes: 3064
package main

import (
	"bufio"
	"fmt"
	"math"
	"os"
	"strconv"
)

var (
	sc = bufio.NewReader(os.Stdin)
)

func main() {
	N := scanStr()

	s := 0
	for _, n := range N {
		a, _ := strconv.Atoi(string(n))
		s += a
	}
	if s%9 == 0 {
		fmt.Println("Yes")
	} else {
		fmt.Println("No")
	}
}

func abs(a int) int         { return int(math.Abs(float64(a))) }
func scan(a ...interface{}) { _, err := fmt.Fscan(sc, a...); pnc(err) }
func scanStr() (s string)   { scan(&s); return }
func scanInt() int          { i, err := strconv.Atoi(scanStr()); pnc(err); return i }
func scanFloat() float64    { f, err := strconv.ParseFloat(scanStr(), 64); pnc(err); return f }
func pnc(err error) {
	if err != nil {
		panic(err)
	}
}


Measured memory_bytes: 3204
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <unordered_set>
#include <unordered_map>
#include <cstdint>
#include <string.h>
#include <queue>

using namespace std;

int main()
{
    int N;
    cin >> N;
    int _max = 0;
    int sum = 0;
    for (int i = 0; i < N; ++i) {
        int p;
        cin >> p;
        sum += p;
        _max = max(_max, p);
    }
    sum -= _max / 2;
    cout << sum << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
vector<vector<pair<ll,ll>>> Z;
vector<ll> ans;
void dfs(ll now,ll pre,ll n){
  ans[now]=n;
  for(auto a: Z[now]){
    if(a.first!=pre)
      dfs(a.first, now, n^a.second);
  }
}
int main(){
  ll N;
  cin>>N;
  Z.assign(N+1,vector<pair<ll,ll>>());
  ans.assign(N+1,0);
  for(int i=0; i<N; i++){
    ll u,v,w;
    cin>>u>>v>>w;
    Z[u].emplace_back(make_pair(v,w%2));
    Z[v].emplace_back(make_pair(u,w%2));
    //u<vでswapはだめだ。1-4-2-5-3 とかのばあい、1-4で詰む
  }
  //各頂点間の距離をすべて出して、奇数があればその組み合わせを除外。
  //12OK 13NG 14OK 15NG 16NG=1,2,4が候補
  //23NG 24うんたら、
  //根つき木とか
  //1番目からの距離さえわかればいいのか
  //dfsっぽ
  //何を用意したらいいのか
  //1からいける場所、２からいける場所、３からいける場所を配列用意
  //その配列が空になるまでDFS
  //移動するたびwを加算してZ[1][x]に値をいれていくかんじ
  //再帰的なやつ
  //できたとおもたらTLEか。N^2の配列を使うのはダメぽ。
  //pairの配列つかう
  //1-2 3 2-1 3がはいったとして
  //2-1 4 2-3 4として、もどる場合は除外、か。
  //dfsの中は、（次いくばしょ、前の場所、0or1)
  dfs(1,0,0);
  for(int i=1; i<=N; i++)
    cout<<ans[i]<<endl;
}

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

typedef long long ll;
 
using tpl = tuple<int, int, int>;
typedef pair<int,int> pii;

void fastStream(){cin.tie(0);std::ios_base::sync_with_stdio(0);}

int N, K;
int main(){

    cin >> N >> K;
    if((N + 1) / 2 >= K){
        cout << "YES" << endl;
    }
    else{
        cout << "NO" << endl;
    }

    return 0;
}


Measured memory_bytes: 256
n = int(input())
 
def gcd(a,b):
  ma = max(a,b)
  mb = min(a,b)
  jy = ma % mb
  if jy == 0 :
    return mb
  else:
    return gcd(mb,jy)
sum = 0
for i in range(1,n+1):
  sum += i

for i in range(1,n):
  for j in range(i+1,n+1):
    sum += 6 * gcd(i,j)

for i in range(1,n-1):
  for j in range(i+1,n):
    for k in range(j+1,n+1):
      sum += 6 * gcd(i,gcd(j,k))
 
print(sum)


Measured memory_bytes: 78308
# -*- coding: utf-8 -*-

n,m,c=map(int, input().split())
b=list(map(int, input().split()))
a=[list(map(int, input().split())) for _ in range(n)]

ans=0
tmp=0
for i in range(n):
    for j in range(m):
        tmp+=a[i][j]*b[j]
    tmp+=c
    if tmp>0:
        ans+=1
    tmp=0

print(ans)

Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
const ll ZERO = 0;
const ll INF = 1e14;
const ll MOD = 1000000007;
const double PI = 3.1415926535897;

int main() {
    ll N;
    cin >> N;
    ll ret = 0;
    for(ll i = 1;i * i < N;i++) {
        if((N - i) / i * i == N - i && (N - i) / i > i) {
            ret += (N - i) / i;
        }
    }
    cout << ret << endl;
}

Measured memory_bytes: 256
#!usr/bin/env python3
from collections import defaultdict, deque
from heapq import heappush, heappop
from itertools import permutations, accumulate
import sys
import math
import bisect
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())
def LS():return [list(x) for x in sys.stdin.readline().split()]
def S():
    res = list(sys.stdin.readline())
    if res[-1] == "\n":
        return res[:-1]
    return res
def IR(n):
    return [I() for i in range(n)]
def LIR(n):
    return [LI() for i in range(n)]
def SR(n):
    return [S() for i in range(n)]
def LSR(n):
    return [LS() for i in range(n)]

sys.setrecursionlimit(1000000)
mod = 1000000007

def solve():
    k = I()
    s = input()
    if k < len(s):
        print(s[:k]+"...")
    else:
        print(s)
    return

#Solve
if __name__ == "__main__":
    solve()


Measured memory_bytes: 65472
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int i,j,k,a1,a2,a3,x;
    int a[50000];
    cin>>a1;
    cin>>a2;
    cin>>a3;
    cin>>x;
    for(i=0;i<=a1;i++)
      for(j=0;j<=a2;j++)
        for(k=0;k<=a3;k++)
        {
            a[i*500+j*100+k*50]++;
        }
    cout<<a[x]<<endl;
}

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



int main(){
	
	int M;
	cin>>M;
	
	cout<<24+(24-M)<<endl;
	
    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
int main(void)
{
  int i, j, seki;
  seki = 0;
  for(i = 1; i < 10; i++) {
    for(j = 1; j < 10; j++) {
      seki = i*j;
      printf("%dx%d=%d\n", i, j, seki);
    }
  }
  return 0;
}

Measured memory_bytes: 520
#pragma comment(linker, "/STACK:1024000000,1024000000")
#include<algorithm>
#include<iostream>
#include<cstring>
#include<fstream>
#include<bitset>
#include<cstdio>
#include<string>
#include<vector>
#include<cmath>
#include<queue>
#include<stack>
#include<map>
#include<set>
#define INF 0X3F3F3F3F
#define N 205
#define M 200005
#define LL long long
#define ULL unsigned long long
#define FF(i, a, b) for(int i = a; i <= b; ++i)
#define RR(i, a, b) for(int i = a; i >= b; --i)
#define FJ(i, a, b) for(int i = a; i < b; ++i)
#define SC(x) scanf("%d", &x)
#define SCC(x, y) scanf("%d%d", &x, &y)
#define SCCC(x, y, z) scanf("%d%d%d", &x, &y, &z)
#define SS(x) scanf("%s", x)
#define PR(x) printf("%d\n", x)
#define CL(a, x) memset(a, x, sizeof(a))
#define _P fd[rt]
#define _L fd[rt << 1]
#define _R fd[rt << 1 | 1]
#define MID int mid = ((l + r) >> 1)
#define lson rt<<1 ,l, mid
#define rson rt<<1 | 1, mid + 1, r
#define VI vector<int>
#define db double
#define PII pair<int, int>
#define PLL pair<unsigned long long, unsigned long long>
#define MP make_pair
#define PB push_back
#define IN freopen("in.txt", "r", stdin)
#define OUT freopen("out.txt", "w", stdout)
using namespace std;
const int MOD = 1000000007;
const double PI = acos(-1.0);
const double EPS = 1e-8;
inline void II(int &n){char ch = getchar(); n = 0; bool t = 0;
for(; ch < '0'; ch = getchar()) if(ch == '-') t = 1;
for(; ch >= '0'; n = n * 10 + ch - '0', ch = getchar()); if(t) n =- n;}
inline void OO(int a){if(a < 0) {putchar('-'); a = -a;}
if(a >= 10) OO(a / 10); putchar(a % 10 + '0');}
inline int sgn(double x){return (x > EPS) - (x < -EPS);}
int n, m, k;
int main(){
    //IN;
    SCC(n, m);
    SC(k);
    bool ok = 0;
    FF(i, 0, n){
        FF(j, 0, m){
            if(i * (m - j) + j * (n - i) == k){
                ok = 1;
                break;
            }
        }
        if(ok) break;
    }
    puts(ok ? "Yes" : "No");
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <fstream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <limits>
#include <queue>

using namespace std;
using ll = long long int;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef vector<vvll> vvvll;
const int MOD=1000000007;
const int INTMAX=1001001000;
const ll LLMAX=1010010010010010000;

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    
    ll N;
    cin>>N;
    cout<<N*(N-1)/2<<endl;
    
    return 0;
}


Measured memory_bytes: 256
import copy
n = int(input())
h = list(map(int, input().split()))

ans = 0
tmp = 0

for i in range(n):
    ans += h[i]
    tmp = copy.deepcopy(h)
    tmp_ = tmp[i]
    for j in range(i, n):
        if h[j] - tmp_ >= 0:
            h[j] -= tmp_
        else:
            tmp_ = tmp[j]
            h[j] = 0

print(ans)


Measured memory_bytes: 3444
#include <iostream>
#include <algorithm>
#include <set>
#include <cstring>
using namespace std;
typedef long long ll;
ll n,x,ans;
void dfs(ll a,ll b){
    if(a%b==0){
        ans+=(a/b*2-1)*b;
    }else{
        ans+=a/b*2*b;
        dfs(b,a%b);
    }
}
int main(void){
   scanf("%lld%lld",&n,&x);
   ans=n;
   dfs(max(x,n-x),min(x,n-x));
   printf("%lld\n",ans);
}

Measured memory_bytes: 256
N, K = map(int, input().split())
A = list(map(lambda x: int(x)-1, input().split()))
route = [0]
check = {0}
now = 0
while A[now] not in check:
    route.append(A[now])
    check.add(A[now])
    now = A[now]
start = route.index(A[now])
loop = len(route) - start

if K < len(route):
    print(route[K]+1)
else:
    K -= start
    K %= loop
    print(route[start+K]+1)


Measured memory_bytes: 32364
#include<cstdio>
static const int hNMax = 100000;
static const int hInfty = (1 << 29);

int main(){
	int N;
	scanf("%d", &N);
	int v[12];
	v[0] = 1;
	v[1] = 6;
	for (int i = 2; i < 7; ++i) v[i] = v[i - 1]*6;
	v[7] = 9;
	for (int i = 8; i < 12; ++i) v[i] = v[i - 1]*9;
	int T[hNMax + 1];
	for (int i = 0; i <= hNMax; ++i) T[i] = hInfty;
	T[0] = 0;
	for (int i = 0; i < 12; ++i){
		for (int j = 0; j + v[i] <= N; ++j)
			if(T[j] + 1 < T[j + v[i]]) T[j + v[i]] = T[j] + 1;
	}
	printf("%d\n", T[N]);
	return 0;
}

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

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    string s;
    cin >> s;
    for(int i=0;i<s.size();i++){
        for(int j=i+1;j<s.size();j++){
            if(s[i]==s[j]){
                cout << "no" << endl;
                return 0;
            }
        }
    }
    cout << "yes" << endl;

    return 0;
}

Measured memory_bytes: 256
import sys
input = lambda: sys.stdin.readline().rstrip()
tdlist = lambda i, j, value=0: [[value] * j for _ in range(i)]

s = input()
t = input()
n, m = len(s), len(t)
dp = tdlist(n+5, m+5)

for i in range(n):
    for j in range(m):
        dp[i+1][j+1] = dp[i][j] + 1 if s[i] == t[j] else max(dp[i+1][j], dp[i][j+1])

res = []
i, j = n, m
while i and j:
    if dp[i][j] == dp[i-1][j]: i -= 1
    elif dp[i][j] == dp[i][j-1]: j -= 1
    else:
        res.append(s[i-1])
        i -= 1; j -= 1

print("".join(res[::-1]))


Measured memory_bytes: 112476
#include<bits/stdc++.h>
using namespace std;
#define For(i,m,n) for(int i=m;i<n;i++)
#define FOR(n) for(int i=0;i<n;i++)
#define ll long long
ll mob=1000000007;
using namespace std;
int main()
{ 
int n;
cin>>n;
int a[n];
FOR(n) cin>>a[i];
int dp[n+1]={ };
dp[0]=0;
dp[1]=0;
dp[2]=abs(a[0]-a[1]);
for(int i=2;i<n;i++)
{
    dp[i+1]=min(abs(a[i]-a[i-1])+dp[i],abs(a[i]-a[i-2])+dp[i-1]);
}
cout<<dp[n];




return 0;
}


Measured memory_bytes: 1024
object Main {
  val sc = new java.util.Scanner(System.in)

  def main(args: Array[String]): Unit = {
    val sc = new java.util.Scanner(System.in)
    val N = sc.nextInt
    val Q = sc.nextInt
    val S = sc.next
    val list = Array.fill(Q, 2)(sc.nextInt)

    var dp = Array.fill(S.length)(0)

    for{
      end <- 1 until S.length
    } yield {
      dp(end) =
        if(S.charAt(end-1) == 'A' && S.charAt(end) == 'C'){
         dp(end-1) + 1
      } else {
        dp(end-1)
      }
    }

    list.foreach{ case Array(l, r) =>
        println(dp(r-1) - dp(l-1))
    }
  }
}

Measured memory_bytes: 110436
#include<iostream>
#include<string>
using namespace std;
int main(){
    int i,j,n;
    cin >>n;
    int a[n],b[n];
    for(i=0;i<n;i++){
        cin >> a[i];
        b[a[i]-1]=i+1;

    }
    for(i=0;i<n;i++){
        cout << b[i]<<" ";
    }
}

Measured memory_bytes: 1536
#include<iostream>
#include<string>

using namespace std;

int main() {
	int n, ans[100], max = 0;
	bool l, r;
	string s;

	cin >> n >> s;

	for (int i = 1; i < n; i++) { //すべての切り方をチェック
		ans[i] = 0;
		for (char x = 'a'; x <= 'z'; x++) { //すべての英字でチェック
			l = false; r = false;
			for (int j = 0; j < i; j++) { //切った左側に特定の英字があるかチェック
				if (s[j] == x) {
					l = true;
				}
			}
			for (int j = i; j < n; j++) { //切った右側に左側と同じ英字があるかチェック
				if (s[j] == x) {
					r = true;
				}
			}
			if (l&&r) { //両方に同じ英字がある場合にcount変数に+1する
				ans[i]++;
			}
		}
	}

	for (int i = 0; i < n; i++) {
		if (ans[i] > max) {
			max = ans[i];
		}
	}

	cout << max << endl;

	return 0;
}

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

#define ll long long
#define ii pair<int, int>
#define vi vector<int>
#define vl vector<ll>
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define mt make_tuple
#define ff first
#define ss second
#define pi 3.14159265
#define oo 1000000007
#define loo 10000000000000007

#define prime 1000000007

#define W(x) cerr << "\033[31m" << #x << " = " << x << "\033[0m" << "\n";
using namespace std;

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0); cout.tie(0);
    int m, k; cin >> m >> k;
    int y = (1 << m) - 1;
    if(k > y || (m == 1 && k == 1)){
    	cout << "-1\n";
    	return 0;
    }
    if(m == 1 && k == 0){
    	cout << "0 0 1 1\n";
    	return 0;
    }
    for (int i = 0; i <= y; ++i){
    	if(i == k) continue;
    	cout << i << " ";
    }
    cout << k << " ";
    for (int i = y; i >= 0; --i){
    	if(i == k) continue;
    	cout << i << " ";
    }
    cout << k << endl;

    return 0;
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
#define rep(i,a,b) for(int i = (a); i <= (b); i++)
#define rng(a) a.begin(), a.end()
#define ina(n,a) cin >> n; for(int i = 1; i <= n; i++) cin >> a[i]
#define sz(x) (int)(x).size()
#define se second
#define fi first
#define prev            coyhhhhhhyoc    
#define next          sdNNNmNNNNNNNmds  
#define y0           hNNNNy_yNNNNNN_sNh
#define y1          mNNNNNdtdNNNNNNtsNNm
#define yn          mNNNNNNNNy___smNNNms
#define tm            oooooosyysooooot 
#define read               tyhyt        
#define rank              ytmNmo         
#define index              yyy
#define pb push_back
#define pcnt __builtin_popcountll
#define rrep(i,a,b) for(int i = (b); i >= (a); i--)
#define rall(x,a) for(auto x : a)
#define MOD 1000000007
#define endl "\n"
typedef long long ll;
using namespace std;

signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    int n, m;
    cin >> n >> m;
    cout << (n == m ? "Yes" : "No") << endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <map>

template <int MOD>
struct ModInt {
    using lint = long long;
    int val;

    // constructor
    ModInt(lint v = 0) : val(v % MOD) {
        if (val < 0) val += MOD;
    };

    // unary operator
    ModInt operator+() const { return ModInt(val); }
    ModInt operator-() const { return ModInt(MOD - val); }
    ModInt inv() const { return this->pow(MOD - 2); }

    // arithmetic
    ModInt operator+(const ModInt& x) const { return ModInt(*this) += x; }
    ModInt operator-(const ModInt& x) const { return ModInt(*this) -= x; }
    ModInt operator*(const ModInt& x) const { return ModInt(*this) *= x; }
    ModInt operator/(const ModInt& x) const { return ModInt(*this) /= x; }
    ModInt pow(lint n) const {
        auto x = ModInt(1);
        auto b = *this;
        while (n > 0) {
            if (n & 1) x *= b;
            n >>= 1;
            b *= b;
        }
        return x;
    }

    // compound assignment
    ModInt& operator+=(const ModInt& x) {
        if ((val += x.val) >= MOD) val -= MOD;
        return *this;
    }
    ModInt& operator-=(const ModInt& x) {
        if ((val -= x.val) < 0) val += MOD;
        return *this;
    }
    ModInt& operator*=(const ModInt& x) {
        val = lint(val) * x.val % MOD;
        return *this;
    }
    ModInt& operator/=(const ModInt& x) { return *this *= x.inv(); }

    // compare
    bool operator==(const ModInt& b) const { return val == b.val; }
    bool operator!=(const ModInt& b) const { return val != b.val; }

    // I/O
    friend std::istream& operator>>(std::istream& is, ModInt& x) noexcept { return is >> x.val; }
    friend std::ostream& operator<<(std::ostream& os, const ModInt& x) noexcept { return os << x.val; }
};

constexpr int MOD = 1e9 + 7;
using mint = ModInt<MOD>;

std::map<int, int> factor(int x) {
    std::map<int, int> ret;

    for (int p = 2; p * p <= x; ++p) {
        if (x % p != 0) continue;
        ret[p] = 0;
        while (x % p == 0) {
            x /= p;
            ++ret[p];
        }
    }

    if (x > 1) ret[x] = 1;
    return ret;
}

void solve() {
    int n;
    std::cin >> n;

    std::vector<int> xs;
    std::vector<std::map<int, int>> facts(n);
    for (auto& fact : facts) {
        int x;
        std::cin >> x;
        fact = factor(x);
        xs.push_back(x);
    }

    std::map<int, int> lcm = facts[0];
    for (int i = 1; i < n; ++i) {
        for (auto p : facts[i]) {
            if (!lcm.count(p.first)) lcm[p.first] = 0;
            lcm[p.first] = std::max(lcm[p.first], p.second);
        }
    }

    mint l = 1;
    for (auto p : lcm) {
        l *= mint(p.first).pow(p.second);
    }

    mint ans = 0;
    for (auto x : xs) ans += l / x;
    std::cout << ans << std::endl;
}

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

    solve();

    return 0;
}


Measured memory_bytes: 3072
from sys import stdin
H,W = [int(x) for x in stdin.readline().rstrip().split()]
#print(H,W)

#1,3,5...行目で塗れるマス
n_odd = (1+W)//2
#2.4,6...行目で塗れるマス
n_even = W//2

if W == 1 or H == 1:
  print(1)
  exit()


if H%2 == 0:
  ans = int((n_odd + n_even) * (H/2))
else:
  ans = int((n_odd + n_even) * (H-1)/2 + n_odd)

print(ans)

Measured memory_bytes: 3064
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<iostream>
#include<string>
#include<vector>
#include<stack>
#include<bitset>
#include<cstdlib>
#include<cmath>
#include<set>
#include<list>
#include<deque>
#include<map>
#include<queue>
using namespace std;
typedef long long ll;
const double PI = acos(-1.0);
const double eps = 1e-6;
int X =0;
int A =0;
int B =0;

int main(void){
	scanf("%d",&X);
	scanf("%d",&A);
	scanf("%d",&B);
	int cur = X-A;
	int ans = cur - (cur/B)*B;
	printf("%d",ans);
	return 0;

}


Measured memory_bytes: 256
n,k = [int(i) for i in input().split()]
a = [int(i)for i in input().split()]
mod = 10**9+7
a.sort()
fact = [1]*(n+2)
inv = [1]*(n+2)
for i in range(2,n+2):
    fact[i]=(fact[i-1]*i)%mod
inv[n+1]=pow(fact[n+1],mod-2,mod)
for i in range(n,1,-1):
    inv[i] = (inv[i+1]*(i+1))%mod

ans = 0
for i in range(n-1,k-2,-1):
    ans = (ans + (((fact[i]*inv[i-k+1]*inv[k-1])%mod)*a[i])%mod)%mod
for i in range(n-k+1):
    N = n-1-i
    K = k-1
    ans = (ans - (((fact[N]*inv[N-K]*inv[K])%mod)*a[i])%mod)%mod
print(ans)

Measured memory_bytes: 14812
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		while(true){
			int n=sc.nextInt();
			int a=sc.nextInt();
			int b=sc.nextInt();
			int c=sc.nextInt();
			int x=sc.nextInt();
			if(n+a+b+c+x==0) break;
			int y[]=new int[n];
			for(int i=0; i<n; i++){
				y[i]=sc.nextInt();
			}
			int j=0;
			boolean flag=false;
			for(int i=0; i<=10000; i++){
				if(y[j]==x){
					y[j]=-1;
					j++;
				}
				if(check(y)){
					flag=true;
					System.out.println(i);
					break;
				}
				x=(a*x+b)%c;
			}
			if(!flag){
				System.out.println("-1");
			}
		}
	}
	static boolean check(int y[]){
		for(int i=0; i<y.length; i++){
			if(y[i]!=-1){
				return false;
			}
		}
		return true;
	}

}

Measured memory_bytes: 32000
n = int(input())
#a, b = map(int,input().split())
#l = list(map(int,input().split()))
#l = [list(map(int,input().split())) for i in range(n)]


def modpow(a, n, mod):
    # a^nをmodでわったあまり 二分累乗法O(logn)
    res = 1
    while n > 0:
        if n & 1:
            res = (res*a) % mod
        a = (a*a) % mod
        n = n >> 1
    return res


mod = 10**9 + 7
if n == 1:
    ans = 0
else:
    ans = modpow(10, n, mod)-2*modpow(9, n, mod)+modpow(8, n, mod)
    ans = ans % mod
print(ans)


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

namespace ConsoleApp15
{
    class Class362
    {
        static void Main()
        {
            var AB = Console.ReadLine().Split();
            var A = long.Parse(AB[0]);
            var B = (long.Parse(AB[1].Remove(AB[1].Length-3,1)));
            Console.WriteLine((A * B) / 100);
        }
    }
}


Measured memory_bytes: 27556
#include <iostream>
#include<string>
#include<queue>
#include<map>

using namespace std;

#define FOR(i,k,n) for(int i = (k); i < (n); i++)
#define REP(i,n) FOR(i,0,n)
#define INF 114514810
#define ELEM(array) (sizeof (array)/sizeof *(array))
#define MAX_N 100
typedef unsigned int UINT;
typedef long long ll;

char num;
string str;

int main()
{
	map<string, int> used;
	queue<string> zero;
	zero.push("01234567");

	while (!zero.empty())
	{
		string tmp;
		tmp = zero.front();
		zero.pop();

		int posi_zero = tmp.find("0");
		if (0 == tmp.find("0"))
		{
			int dx[] = { 1, 4 };
			REP(i, 2)
			{
				string tmp1 = tmp;
				swap(tmp1[0], tmp1[dx[i]]);
				if (used.find(tmp1) == used.end())
				{
					used[tmp1] = used[tmp] + 1;
					zero.push(tmp1);
				}

			}
		}
		else if (tmp.find("0") == 1 || posi_zero == 2)
		{
			int dx[] = { -1, 1, 4 };
			REP(i, 3)
			{
				string tmp1 = tmp;
				swap(tmp1[posi_zero], tmp1[posi_zero + dx[i]]);
				if (used.find(tmp1) == used.end())
				{
					used[tmp1] = used[tmp] + 1;
					zero.push(tmp1);
				}

			}
		}
		else if (tmp.find("0") == 3)
		{
			int dx[] = { -1, 4 };
			REP(i, 2)
			{
				string tmp1 = tmp;
				swap(tmp1[posi_zero], tmp1[posi_zero + dx[i]]);
				if (used.find(tmp1) == used.end())
				{
					used[tmp1] = used[tmp] + 1;
					zero.push(tmp1);
				}

			}
		}
		else if (tmp.find("0") == 4)
		{
			int dx[] = { 1, -4 };
			REP(i, 2)
			{
				string tmp1 = tmp;
				swap(tmp1[posi_zero], tmp1[posi_zero + dx[i]]);
				if (used.find(tmp1) == used.end())
				{
					used[tmp1] = used[tmp] + 1;
					zero.push(tmp1);
				}

			}
		}
		else if (tmp.find("0") == 5 || posi_zero == 6)
		{
			int dx[] = { -1, 1, -4 };
			REP(i, 3)
			{
				string tmp1 = tmp;
				swap(tmp1[posi_zero], tmp1[posi_zero + dx[i]]);
				if (used.find(tmp1) == used.end())
				{
					used[tmp1] = used[tmp] + 1;
					zero.push(tmp1);
				}

			}
		}
		else if (tmp.find("0") == 7)
		{
			int dx[] = { -1, -4 };
			REP(i, 2)
			{
				string tmp1 = tmp;
				swap(tmp1[posi_zero], tmp1[posi_zero + dx[i]]);
				if (used.find(tmp1) == used.end())
				{
					used[tmp1] = used[tmp] + 1;
					zero.push(tmp1);
				}

			}
		}

	}


	while (cin >> num)
	{
		str.push_back(num);
		REP(i, 7)
		{
			cin >> num;
			str.push_back(num);

		}
		cout << used[str] << endl;
		str.clear();
		
	}
	return 0;
}

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

int main() {
  char b;
  cin >> b;
  if (b == 'A') {
    cout << "T" << endl;
  }
  if (b == 'T') {
    cout << "A" << endl;
  }
  if (b == 'C') {
    cout << "G" << endl;
  }
  if (b == 'G') {
    cout << "C" << endl;
  }
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <cstdlib>
#include <math.h>
#include <set>

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

const long long INF = 1LL << 60;

#define MOD 1000000007

int kame = 4;
int tsuru = 2;

int main(){

    int X, Y;
    cin >> X >> Y;

    string res = "No";

    for(int i = 0; i <= 100 ; i++){
        for(int j = 0; j <= 100; j++){
            int sum = i*kame + j*tsuru;
            if(sum == Y && ((i+j)== X)){
                res = "Yes";
            }
        }
    }
    
    cout << res << endl;
}

Measured memory_bytes: 3620
def ii():return int(input())
def iim():return map(int,input().split())
def iil():return list(map(int,input().split()))
def ism():return map(str,input().split())
def isl():return list(map(str,input().split()))

n,h,w = iim()
ans = 0
for i in range(n):
    a,b = iim()
    if a >= h and b >= w:
        ans += 1
print(ans)

Measured memory_bytes: 3064
#include <algorithm>
#include <cfloat>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <limits.h>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <string.h>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,n) for(int i=1;i<=n;i++)
#define int long long
#define ll long long
#define eps LDBL_EPSILON
#define mod 1000000007
#define double long double
#define INF LLONG_MAX/1000
#define P pair<int,int>
#define prique priority_queue
using namespace std;
string s;
int mypow(int a, int b) {
	if (!b)return 1;
	if (b % 2)return mypow(a, b - 1) * a % mod;
	return mypow(a, b / 2) * mypow(a, b / 2) % mod;
}
signed main() {
	cin >> s;
	int ans = 0, cnt = 0;
	rep(i, s.size()) {
		if (s[i] == '1') {
			ans += mypow(2, cnt) * mypow(3, s.size() - i - 1) % mod;
			cnt++;
		}
	}
	cout << (ans + mypow(2, cnt)) % mod << endl;
	return 0;
}

Measured memory_bytes: 640
#include<bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (int) n; i++)
using ll = long long;
template <class T>
using vt = std::vector<T>;
using vvi = std::vector<vt<int>>;

int main(){
  int n,k;
  std::cin >> n >> k;

  ll ans = k;
  n--;
  k--;
  while(n > 0){
    ans *= k;
    --n;
  }
  std::cout << ans << '\n';
  return 0;
}


Measured memory_bytes: 256
while line = gets
  n = line.to_i
  count = 0
  0.upto(9) do |a|
    0.upto(9) do |b|
      0.upto(9) do |c|
        0.upto(9) do |d|
          count += 1 if a+b+c+d == n
        end
      end
    end
  end
  p count
end

Measured memory_bytes: 6096
#include<iostream>
#include<vector>
using namespace std;
int main() {
  int n; cin >> n;
  vector<double> A(n);
  vector<double> B(n);
  for(int i=0;i<n;i++){
    cin >> A[i];
    B[i] = 1/A[i];
  }
  double ssum=0.0;
  for(int i=0;i<n;i++) ssum += B[i];
  printf("%.12f",1/ssum);
  return 0;
}
  

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define int long long
using namespace std;
const int INF = 1e14;
const int ZERO = 0;
const double PI = 3.14159265359;
int MOD = 1000000007;
typedef pair<int,int> P;

int fac[1000010], finv[1000010], inv[1000010];

// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < 1000010; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

// 二項係数計算
long long COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

signed main() {
    int X,Y;
    cin >> X >> Y;
    if((X + Y) % 3 != 0) {
        cout << 0 << endl;
    }
    else {
        int A = (X + Y) / 3;
        int x = Y - A;
        int y = X - A;
        COMinit();
        cout << COM(A,x) << endl;
    }
}

Measured memory_bytes: 23680