akhauriyash/Code-Regression huggingface dataset:
package main

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

const (
	initialBufSize = 1024
	maxBufSize     = 1e6
)

var (
	scanner = bufio.NewScanner(os.Stdin)
)

func main() {
	scanner.Split(bufio.ScanWords)
	n, k := scanInt(), scanInt()
	if n < k {
		fmt.Println(0)
		return
	}

	mon := make([]int, n)
	hpSum := 0
	for i := 0; i < n; i++ {
		hp := scanInt()
		mon[i] = hp
		hpSum += hp
	}

	sort.Ints(mon)
	lastIdx := len(mon) - 1
	for i := 0; i < k; i++ {
		hpSum -= mon[lastIdx-i]
	}

	fmt.Println(hpSum)
}

func scanInt() int {
	i, _ := strconv.Atoi(scanText())
	return i
}

func scanInts(size int) []int {
	ints := make([]int, size)
	for i := 0; i < size; i++ {
		ints[i] = scanInt()
	}
	return ints
}

func scanFloat64() float64 {
	f, _ := strconv.ParseFloat(scanText(), 64)
	return f
}

func scanFloat64s(size int) []float64 {
	f := make([]float64, size)
	for i := 0; i < size; i++ {
		f[i] = scanFloat64()
	}
	return f
}

func scanText() string {
	scanner.Scan()
	return scanner.Text()
}

func scanTexts(size int) []string {
	s := make([]string, size)
	for i := 0; i < size; i++ {
		s[i] = scanText()
	}
	return s
}

func abs(n int) int {
	return int(math.Abs(float64(n)))
}

func pow(x, y int) int {
	return int(math.Pow(float64(x), float64(y)))
}

func min(n []int) (min, idx int) {
	min = math.MaxInt64
	for i := 0; i < len(n); i++ {
		if n[i] < min {
			min = n[i]
			idx = i
		}
	}
	return
}

func max(n []int) (max, idx int) {
	max = math.MinInt64
	for i := 0; i < len(n); i++ {
		if n[i] > max {
			max = n[i]
			idx = i
		}
	}
	return
}


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

int main()
{
	string c[3];
	for (int i = 0; i < 3; i++)
	{
		cin >> c[i];
	}

	for (int i = 0; i < 3; i++)
	{
		cout << c[i][i];
	}
	return 0;
}

Measured memory_bytes: 256
def resolve():
    N, K = map(int, input().split())
    P = list(map(int, input().split()))
    C = list(map(int, input().split()))
    for i in range(N):
        P[i] -= 1

    ans = -1e18
    for i in range(N):
        n = P[i]
        score = C[n]
        t = [score]
        while n != i:
            n = P[n]
            score += C[n]
            t.append(score)

        total = t[-1]
        l = len(t)
        for i in range(min(K, l)):
            temp_score = t[i]
            if total > 0 and K > l:
                e = int((K-(i+1))/l)
                temp_score += total*e
            ans = max(ans, temp_score)

    print(ans)


if __name__ == "__main__":
    resolve()

Measured memory_bytes: 83160
from collections import Counter
n = int(input())
ns = list(map(int, input().split()))
rslt = 0
a = 10 ** 9 + 7
cnt = Counter(ns)
if n % 2 == 0:
    for i in range(1, n, 2):
        if cnt[i] != 2:
            print(0)
            exit()
    rslt = pow(2, n // 2, a)
else:
    for i in range(2, n, 2):
        if cnt[i] != 2:
            print(0)
            exit()
    if cnt[0] == 1:
        rslt = pow(2, n // 2, a)
print(rslt)

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



int main() {   
    
    ios_base::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);

    #ifndef ONLINE_JUDGE   
    freopen("input.txt", "r", stdin);   
    freopen("output.txt", "w", stdout);   
    #endif   
  	
  	int n;
  	cin>>n;
  	
  	int n1 = n%1000;

  	if(n1==0)
  		cout<<0;
  	else
  		cout<<1000-n1;



    
return 0;


}  

Measured memory_bytes: 3628
import math
import sys

def isprime(n):
    if n % 2 == 0:
        return False
    nn = int(math.sqrt(n))+1
    for k in range(3,nn+1,2):
        if n % k == 0:
            return False
    return True

X = int(input())
if X == 2:
    print(2)
    sys.exit()
for x in range(X,2*(10**5)):
    if isprime(x):
        print(x)
        sys.exit()


Measured memory_bytes: 3060
import java.util.*;
 
public class Main {
    public static void main(String[] args) throws Exception {
        
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        double t = sc.nextDouble();
        int a = sc.nextInt();
        int[] h = new int[n];
        for(int i = 0; i < n; i++){
            h[i] = sc.nextInt();
        }
        double ans = 10000;
        int ans_no = 0;
        for(int i = 0; i < n; i++){
            double temp = t - h[i] * 0.006;
            if(ans > Math.abs(a - temp)){
                ans_no = i + 1;
                ans = Math.abs(a - temp);
            }
        }
        System.out.println(ans_no);
    }
}

Measured memory_bytes: 27232
#include <stdio.h>
void swap(int*t,int*s)
{
    int temp=*t;
        *t=*s;
        *s=temp;
}
void sort3(int*a,int*b,int*c)
{
        if(*a>*b) swap(a,b);
        if(*b>*c) swap(b,c);
        if(*a>*b) swap(a,b);
}
int main(void){
    int x,y,z;
    scanf("%d",&x);
    scanf("%d",&y);
    scanf("%d",&z);
    
    sort3(&x,&y,&z);
    
    printf("%d %d %d\n",x,y,z);
    
    return 0;
}



Measured memory_bytes: 2044
# abc148_c.py
from sys import stdin

def gcd(a,b):
  while b!=0:
    a,b=b,a%b
  return a
def lcm(a,b):
	return a*b//gcd(a,b)
A, B = [int(x) for x in stdin.readline().rstrip().split()]
print(lcm(A,B))




Measured memory_bytes: 2940
#include<stdio.h>
int main(){
	int h,w,i,r,t,ny,nx,a=0,y[3000],x[3000],c[60][60]={};
	int X[]={0,1,0,-1};
	int Y[]={1,0,-1,0};
	char s[60][60]={};
	scanf("%d %d",&h,&w);
	for(i=0;i<h;i++)scanf("%s",s[i+1]+1);
	for(i=0;i<h*w;i++){
		if(s[i/w+1][i%w+1]=='.')a++;
	}//printf("%d\n",a);
	x[0]=y[0]=r=c[1][1]=1;
	s[1][1]='#';
	c[h][w]=a+1;
	for(t=0;r-t;t++){//printf("%d %d\n",y[t],x[t]);
		for(i=0;i<4;i++){
			ny=y[t]+Y[i];
			nx=x[t]+X[i];
			if(s[ny][nx]-'.')continue;
			c[ny][nx]=c[y[t]][x[t]]+1;
			s[y[r]=ny][x[r]=nx]='#';
			r++;
		}
	}
	printf("%d\n",a-c[h][w]);
	return 0;
}

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

using namespace std;
using ll = long long;
using vec = vector<ll>;
using mat = vector<vec>;

#define INF (1LL << 60)
#define MOD 1000000007
#define PI 3.14159265358979323846

#define REP(i,m,n) for(ll (i)=(m),(i_len)=(n);(i)<(i_len);++(i))
#define FORR(i,v) for(auto (i):v)
#define ALL(x) (x).begin(), (x).end()
#define PR(x) cout << (x) << endl
#define PS(x) cout << (x) << " "
#define SZ(x) ((ll)(x).size())
#define MAX(a,b) (((a)>(b))?(a):(b))
#define MIN(a,b) (((a)<(b))?(a):(b))
#define ASC(x) sort(ALL((x)))
#define DESC(x) sort(ALL((x)),greater<ll>())
#define pb push_back

int main()
{
    ll N, K;
    cin >> N >> K;

    mat C(2001, vec(2001, 0));
    C[0][0] = 1;
    REP(i,1,2001) {
        C[i][0] = 1;
        REP(j,1,i+1) {
            C[i][j] = (C[i-1][j-1] + C[i-1][j]) % MOD;
        }
    }
    REP(i,1,K+1) PR((C[K-1][i-1]*C[N-K+1][i])%MOD);

    return 0;
}

/*



*/

Measured memory_bytes: 31616
n, m = map(int, input().split())

#グラフをリストにする
#リストの第i番目の集合は、頂点iが繋がっている頂点の集合である
l = [[] for _ in range(n+1)]
for _ in range(m):
  a, b = map(int, input().split())
  l[a].append(b)
  l[b].append(a)
  
#解（道しるべとなる点）を保存するリストを作る
ans = [-1] * (n+1)
ans[1] = 0

#解（道しるべとなる点）を書き込んでいく
#深さdの点の集合をxに、d＋１の集合をyとする
#yの要素は、l[i]と一致する
x = [1]
y = []
while x != []:
  for i in x:
    for j in l[i]:
      if ans[j] == -1:
        ans[j] = i
        y.append(j)
  x = y
  y = []
print('Yes')
for i in range(2, n+1):
  print(ans[i])

Measured memory_bytes: 33900
#include <iostream>
#include <string>
#include <vector>
#include <cstring>
#include <cstdio>
using namespace std;

typedef  vector<bool> vb;

vector<vb > map_;

int tox[4]={1,-1,0,0};
int toy[4]={0,0,1,-1};


int work(vector<vb> map_,int n,int m)
{
  int len_[54][54];
  memset(len_,0x3f,sizeof(len_));
  int s[50*50+100][4];
  int h=0;
  int t=1;
  s[1][0]=1;
  s[1][1]=1;
  s[1][2]=0;
 // map_[1][1]=false;
  while (h!=t)
  {
   h++;
    for (int i=0;i<4;i++)
    {
      if (map_[s[h][1]+toy[i]][s[h][0]+tox[i]])
      {
       if (len_[s[h][1]+toy[i]][s[h][0]+tox[i]]>s[h][2]+1)
       {
        len_[s[h][1]+toy[i]][s[h][0]+tox[i]]=s[h][2]+1;
        t++;
        s[t][2]=s[h][2]+1;
        s[t][0]=s[h][0]+tox[i];
        s[t][1]=s[h][1]+toy[i];
       }

      }
    }
  }
  return len_[n][m];
}

int main()
{
    int n,m;
    int inc=0;;
    //memset(map_,false,sizeof(map_));
    map_.resize(54);
    cin>>n>>m;
    for (int i=1;i<=n;i++)
    {
     map_[i].resize(54,false);
     for (int j=1;j<=m;j++)
    {
     char te;
     cin>>te;
     if (te=='.')
     {
      map_[i][j]=true;
      inc++;
     }
    }
    }
    int result=work(map_,n,m);
    if (result<50*50)
    cout<<inc-result-1<<endl;
    else cout<<-1<<endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
using namespace std;
 
void func(int,int,int);
void swap(int&,int&);
int euclidean(int,int);
 
int main(){
    int a,b,c;
    cin >> a >> b >> c;
    if(c==1){
        cout << euclidean(a,b) << "\n";
        return 0;
    } 
    func(a,b,c);
    
    return 0;
}

void func(int a,int b,int c){
    int n = euclidean(a,b);
    //cout << n << "\n";
    if(n == 1) {
        cout << 1 << "\n";
        return;
    }
    //cout << n << "\n";
    int count = 1;
    for(int i = n-1;; i--)
    {
        if(i == 0){
            cout << 1 << "\n";
            return;
        }
        if(n%i==0){
            //cout << i << "\n";
            count++;
            if(count == c) {
                cout << i << "\n";
                return;
            }
        }
    }
}
 
int euclidean(int a,int b){
    if(a<b) swap(a,b);
    int r;
    while((r=a%b)!=0){
        if(r==1) return 1;
        //cout << a << "," << b << "," << r << "," << "\n" ;
        a = b;b = r;
    }
    return b;
}
 
void swap(int& a,int& b){
    int tmp = a;
    a = b;b = tmp;
}

Measured memory_bytes: 256
#line 2 "/Users/kaage/Desktop/ProgrammingWorkspace/library/other/template.hpp"
#define _CRT_SECURE_NO_WARNINGS
#pragma target("avx2")
#pragma optimize("O3")
#pragma optimize("unroll-loops")
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <ctime>
#include <deque>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <list>
#include <map>
#include <memory>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <string.h>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#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 all(V) V.begin(),V.end()
typedef unsigned int uint;
typedef long long lint;
typedef unsigned long long ulint;
typedef std::pair<int, int> P;
typedef std::pair<lint, lint> LP;
constexpr int INF = INT_MAX/2;
constexpr lint LINF = LLONG_MAX/2;
constexpr double eps = DBL_EPSILON;
constexpr double PI=3.141592653589793238462643383279;
template<class T>
class prique :public std::priority_queue<T, std::vector<T>, std::greater<T>> {};
template <class T, class U>
inline bool chmax(T& lhs, const U& rhs) {
	if (lhs < rhs) {
		lhs = rhs;
		return 1;
	}
	return 0;
}
template <class T, class U>
inline bool chmin(T& lhs, const U& rhs) {
	if (lhs > rhs) {
		lhs = rhs;
		return 1;
	}
	return 0;
}
inline lint gcd(lint a, lint b) {
	while (b) {
		lint c = a;
		a = b; b = c % b;
	}
	return a;
}
inline lint lcm(lint a, lint b) {
	return a / gcd(a, b) * b;
}
bool isprime(lint n) {
	if (n == 1)return false;
	for (int i = 2; i * i <= n; i++) {
		if (n % i == 0)return false;
	}
	return true;
}
template<typename T>
T mypow(T a, lint b) {
	T res(1);
	while(b){
		if(b&1)res*=a;
		a*=a;
		b>>=1;
	}
	return res;
}
lint modpow(lint a, lint b, lint m) {
	lint res(1);
	while(b){
		if(b&1){
			res*=a;res%=m;
		}
		a*=a;a%=m;
		b>>=1;
	}
	return res;
}
template<typename T>
void printArray(std::vector<T>& vec) {
	rep(i, vec.size()){
		std::cout << vec[i];
		std::cout<<(i==(int)vec.size()-1?"\n":" ");
	}
}
template<typename T>
void printArray(T l, T r) {
	T rprev = std::prev(r);
	for (T i = l; i != rprev; i++) {
		std::cout << *i << " ";
	}
	std::cout << *rprev << std::endl;
}
LP extGcd(lint a,lint b) {
	if(b==0)return {1,0};
	LP s=extGcd(b,a%b);
	std::swap(s.first,s.second);
	s.second-=a/b*s.first;
	return s;
}
LP ChineseRem(const lint& b1,const lint& m1,const lint& b2,const lint& m2) {
	lint p=extGcd(m1,m2).first;
	lint tmp=(b2-b1)*p%m2;
	lint r=(b1+m1*tmp+m1*m2)%(m1*m2);
	return std::make_pair(r,m1*m2);
}
template<typename F>
inline constexpr decltype(auto) lambda_fix(F&& f){
	return [f=std::forward<F>(f)](auto&&... args){
		return f(f,std::forward<decltype(args)>(args)...);
	};
}
#line 2 "main.cpp"
int main(){
	std::string n;
	std::cin>>n;
	int sum=0;
	rep(i,n.size())sum+=n[i]-'0';
	if(sum%9==0)puts("Yes");
	else puts("No");
	return 0;
}

Measured memory_bytes: 3748
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int n;
pair<string,pair<int,int> > s[105];
bool cmp(pair<string,pair<int,int> > x,pair<string,pair<int,int> > y){
	if(x.first!=y.first)return x.first<y.first;
	return x.second.first>y.second.first;
}
int main(){
	cin >> n;
	for(int i=0;i<n;i++){
		cin >> s[i].first >> s[i].second.first;
		s[i].second.second=i;
	}
	sort(s,s+n,cmp);
	for(int i=0;i<n;i++)
		cout << s[i].second.second+1 << endl;
	return 0;
}

Measured memory_bytes: 256
#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 int long long
#define REP(i,n) for(int i = 0;i < (int)(n);i++)
#define RREP(i,n) for(int i = (int)n-1;i >= 0;i--)
#define FOR(i,s,n) for(int i = s;i < (int)n;i++)
#define RFOR(i,s,n) for(int i = (int)n-1;i >= s;i--)
#define ALL(a) a.begin(),a.end()
#define IN(a, x, b) (a<=x && x<b)
template<class T>inline bool CHMAX(T&a,T b){if(a<b){a = b;return true;}return false;}
template<class T>inline bool CHMIN(T&a,T b){if(a>b){a = b;return true;}return false;}
template<class T>istream&operator >>(istream&is,vector<T>&vec){for(T&x:vec)is>>x;return is;}
template<class T>inline void in(T&t){cin>>t;}
template<class T,class... Ts>inline void in(T&t,Ts&...ts){cin>>t;in(ts...);}
template<class T>inline void out(T t){cout<<t<<"\n";}
template<class T,class... Ts>inline void out(T t,Ts... ts){cout<<t<<" ";out(ts...);}
template<typename T=int>vector<T>mv(size_t a){return vector<T>(a);}
template<typename T=int,typename... Ts>auto mv(size_t a,Ts... ts){return vector<decltype(mv<T>(ts...))>(a,mv<T>(ts...));}
template<typename T,typename V>typename enable_if<is_class<T>::value==0>::type fill(T&t,const V&v){t=v;}
template<typename T,typename V>typename enable_if<is_class<T>::value!=0>::type fill(T&t,const V&v){for(auto &e:t)fill(e,v);}
constexpr long long INF = 1e18;
 
signed main(){
	int N,M,V,P;
	in(N,M,V,P);
	auto a = mv(N);
	REP(i,N){
		cin>>a[i];
	}
	sort(ALL(a));
	reverse(ALL(a));
	auto f =[&](int x)->bool{
		auto b = a;
		int X = M * V;
		int border = b[x];
		REP(i,N){
			if(i < P - 1){
				X -= M;
				b[i]+=M;
			}else if(b[i] <= border){
				X -= M;
				b[i]+=M;
			}else{
				int t = min(M,border + M - b[i]);
				t = max(0ll,t);
				X -= t;
				b[i] += t;
			}
		}
		sort(ALL(b));
		reverse(ALL(b));
		int flg = (X <= 0) && (border + M >= b[P-1]);
		return flg;
	};
	int l = 0, r = N;
	while(r - l > 1){
		int c = (l + r) / 2;
		if(f(c)) l = c;
		else r = c;
	}
	cout << l + 1 << endl;
}

Measured memory_bytes: 1792
#include<iostream>
#include<vector>
#include<queue>
#include <string>
#include <sstream>
using namespace std;

int main()
{
  long n;
  string a, b;

  cin >> a;
  cin >> b;

  string ans="";
  for (int i = 0; i < a.size()+b.size(); ++i)
  {
    ans += (i%2==0?a[i/2]:b[i/2]);
  }


  cout <<ans;


  return 0;
}






Measured memory_bytes: 256
#include<stdio.h>

int main()
{
	int w,n,sav;/*縦、横、一時保存*/
	int i;
	int pos[30],x[30],y[30];/*位置、入れ替え*/
	char c;

	while(1)
	{
		scanf("%d",&w);
		scanf("%d",&n);
		if((w<1 || w>30)||(n<1 || n>30))
			continue;

		for(i=0;i<n;i++)
		{
			scanf("%d%c%d",x+i,&c,y+i);
			if((x[i]<1 || x[i]>w)||(y[i]<1 || y[i]>w))
				i--;
		}
		break;
	}

	for(i=0;i<w;i++)
	{
		pos[i]=i+1;
	}

	for(i=0;i<n;i++)
	{
		sav=pos[x[i]-1];/*預ける*/
		pos[x[i]-1]=pos[y[i]-1];
		pos[y[i]-1]=sav;
	}

	for(i=0;i<w;i++)
		printf("%d\n",pos[i]);

	return 0;
}

Measured memory_bytes: 596
#include <bits/stdc++.h>
#include <iostream>
#include <string>
#include <math.h>

using namespace std;
int abs(int x){
    if(x<0) return -x;
    else return x;
}
int findSumOfDigits(int n) {
  int sum = 0;
  while (n > 0) { // n が 0 になるまで
    sum += n % 10;
    n /= 10;
  }
  return sum;
}
int main() {
    int n,a,b;
    cin>>n>>a>>b;
    int ans=0;
    for(int i=1;i<=n;i++){
         int sum = findSumOfDigits(i);
        if(a<=sum and sum<=b) ans+=i;
    }
    cout<<ans<<endl;
    
}

Measured memory_bytes: 3644
import sys
import collections


def solve():
    input = sys.stdin.readline
    mod = 10 ** 9 + 7
    n = int(input().rstrip('\n'))
    ts = collections.defaultdict(list)
    tc = collections.defaultdict(int)
    for i in range(n-1):
        ta, te, ttc = list(map(int, input().rstrip('\n').split()))
        ts[ta - 1] += [te - 1]
        ts[te - 1] += [ta - 1]
        tc[ta - 1, te - 1] = ttc
        tc[te - 1, ta - 1] = ttc

    q, k = list(map(int, input().rstrip('\n').split()))
    ql = [[0, k-1]]
    ql = collections.deque(ql)
    fq = collections.defaultdict(int)
    while True:
        if len(ql) != 0:
            cost, p = ql.popleft()
            for v in ts[p]:
                if v not in fq:
                    n_cost = tc[p, v]
                    ql.append([cost + n_cost, v])
                    fq[v] = cost + n_cost
                else:
                    n_cost = tc[p, v]
                    if n_cost + cost < fq[v]:
                        ql.append([cost + n_cost, v])
                        fq[v] = cost + n_cost
        else:
            break
    for i in range(q):
        x, y = list(map(int, input().rstrip('\n').split()))
        print(fq[x-1] + fq[y-1])


if __name__ == '__main__':
    solve()


Measured memory_bytes: 120088
N,K = map(int,input().split())

lis = [True] * N

for i in range(K):

    d = int(input())

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

    for j in A:
        lis[j-1] = False

ans = 0
for i in range(N):

    if lis[i]:
        ans += 1
print (ans)


Measured memory_bytes: 67560
#include <bits/stdc++.h>
using namespace std;
int main()
{
	int arr[3];
	for(int i=0;i<3;i++)cin>>arr[i];
	int a=arr[0];
	int b=arr[1];
	int c=arr[2];
	int ans1=0;
	int ans2=0;
	int ans3=0;
	for(int i=0;i<3;i++)
	{
		if(arr[i]==a)ans1++;
		else if(arr[i]==b)ans2++;
		else if(arr[i]==c)ans3++;
	}
	if(ans1==2||ans2==2||ans3==2)cout<<"Yes"<<endl;
	else cout<<"No"<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
using namespace std;
int a[100000];
int main (void){
	int n;cin>>n;
	int k;cin>>k;
	for(int i=0 ; i < n ;i++){
		cin>>a[i];
	}
	sort (a, a+n);
	int ans=1000000000;
	for(int i=0;i<n-k+1;i++){
		if(a[i+k-1]-a[i]<ans){
			ans=a[i+k-1]-a[i];
		}
	}
	cout << ans;
}

Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
#define ll         long long
#define mod        1000000007
#define setbits(x) __builtin_popcountll(x)
#define zrobits(x) __builtin_ctzll(x)
#define inf        1e18
#define ps(x,y)    fixed<<setprecision(y)<<x

int main() {

#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif

	ll int x;
	cin >> x;
	ll int a, b;

	for (ll i = -150; i <= 150; i++)
	{
		for (ll j = -150; j <= 150; j++)
		{
			a = i * i * i * i * i;
			b = j * j * j * j * j;
			if (a == x + b)
			{
				cout << i << " " << j;
				return 0;
			}
		}
	}
}

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

#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define rep3(i,m,n) for(int (i)=m;(i)<=(n);(i)++)
#define rep3rev(i,m,n) for(int (i)=m;(i)>=(n);(i)--)
#define all(a) (a.begin()),(a.end())
#define rall(a) (a.rbegin()),(a.rend())
#define fi first
#define se second
#define pb push_back
#define eb emplace_back

using ll = long long;
using vll = vector<ll>;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using P = pair<int, int>;

void Main() {
    int a, b, t; cin >> a >> b >> t; 
    cout << b * (t/a) << endl;
    return;
}

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


Measured memory_bytes: 3624
#include <iostream>
#include <iomanip>
#include <vector>
#include <string>
#include <algorithm>
#include <cmath>
using namespace std;

int main(){
    string s;
    cin >> s;
    if (s == "SUN") cout << "7" << endl;
    else if (s == "MON") cout << "6" << endl;
    else if (s == "TUE") cout << "5" << endl;
    else if (s == "WED") cout << "4" << endl;
    else if (s == "THU") cout << "3" << endl;
    else if (s == "FRI") cout << "2" << endl;
    else cout << "1" << endl;
}

Measured memory_bytes: 256
from operator import itemgetter

def main():
    N,K = map(int,input().split())
    S = [int(s) for s in input()] + [1]
    used = [0]*(N + 3)
    right = -1
    ans = 0
    for left in range(N):
        if S[left] + S[left - 1] == 0:
            continue
        while right < N and used[right] - used[left-1] <= K:
            right += 1
            if S[right]:
                used[right] = used[right - 1]
            else:
                if S[right-1]:
                    used[right] = used[right - 1] + 1
                else:
                    used[right] = used[right - 1]
        ans = max(ans,right - left)
    print(ans)
    return 

if __name__ == "__main__":
    main()

Measured memory_bytes: 6208
#include<cstdio>
#include <iostream>
#include<algorithm>
#include<string>
#include<queue>
#include<vector>
#include<functional>
#include<cmath>
#include<map>
#include<stack>
#include<set>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;

int A, B, C;
map<int, int> m;

int main()
{
	cin >> A >> B >> C;
	
	int m = A;
	int flag = 0;
	for (int i = 0; i < 1000; i++) {
		if (A%B == C) {
			flag = 1;
			break;
		}
		A += m;
	}
	if (flag)cout << "YES" << endl;
	else cout << "NO" << endl;
return 0;
}

Measured memory_bytes: 256
#include<iostream>

#define rep(i,n) for(int i=0; i<(n); ++i)
#define ll long long

int main(){
    int d,t,s; std::cin >> d >> t >> s;
    std::cout << (s*t < d ? "No" : "Yes") << std::endl;
    return 0;
}

Measured memory_bytes: 3596
/*==============================================*\
Codeforces ID:    mdshihab
                                                  |
Name:     Md. Shihabul Minhaz                     |
Study:      CSE, JKKNIU                           |
Address:  Trishal, Mymensingh, Bangladesh         |
                                                  |
 mail:   mdshihabul20171@gmail.com                |
 FB  :   fb.com/mdshihabul.minhaz.7               |
 github: Shihabulminhaz                           |
stopstalk :  mdshihab                             |
                                                  |
@uthor   Md. Shihabul Minhaz (shihab)             |
\*===============================================*/


#include<bits/stdc++.h>
using namespace std;
#define fi(a) scanf("%d",&a);
#define fli(a) scanf("%ld",&a);
#define fll(a) scanf("%lld",&a);
#define pi(a) printf("%d\n",a);
#define ppi(i,a) printf("Case %d: %d\n",i,a);
#define ll long long
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
int shihab;
void FI()
{
#ifndef ONLINE_JUDGE
    freopen("C:\\Users\\SHIHAB\\Desktop\\input.in","r",stdin);
#endif // ONLINE_JUDGE
}

int main()
{
    fast
  //  FI(); /// skip this line for compile
    int arr[]= {1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51
               };
    int n;
    cin >> n;
    cout << arr[n-1] << endl;
    return 0;
    //code end
}
//okbye


Measured memory_bytes: 3540
import java.io.*;
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n =sc.nextInt();
        String s[] = new String[n];
        HashSet<String> set = new HashSet<String>();
        for(int i=0;i<n;i++) {
        	s[i] = sc.next();
        	set.add(s[i]);
        }
        System.out.println(set.size());
    }
}

Measured memory_bytes: 79200
//Ruthless Coding 
#include <bits/stdc++.h>

#define uni(x)      (x).resize(unique(all(x)) - (x).begin())
#define fprint(v)   for(auto x : v) cout << x << ' '
#define ALL(x)      (x).begin(), (x).end()
#define MP(x, y)    make_pair(x, y)
#define PII         pair<int, int>
#define SZ(x)       int((x).size())
#define PB(x)       push_back(x)
#define ll          long long
#define S           second 
#define F           first
#define nl          '\n'

using namespace std;
void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}

template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifndef ONLINE_JUDGE
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define debug(x...)
#endif
mt19937_64 rnd;

const int N = 2e5 + 5;

int main() {
    ios_base::sync_with_stdio(0);cin.tie(0);
    ll n, a, b;
    cin >> n >> a >> b;
    if((b - a) % 2 == 0){
        cout << (b - a) / 2;
    }else{
        cout << min(a - 1, n - b) + 1 + (b - a - 1) / 2;
    }
    return 0;
}
/*
    *** Most Impo.. -> check base case always
    1. Overflow Check (*, +)
    2. Index check (0 - based or 1 - based)
    3. Check for n = 1, 2, 3, 4....
    4. Corner Cases
*/

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

using namespace std;

string a;
int L;

int toint(string s) {
	int ret = 0;
	for (int i = 0; i < L; i++) ret = 10 * ret + (s[i] - '0');
	return ret;
}

string tostr(int i) {
	stringstream s; s << i;
	return s.str();
}

void add0(string& s) {
	while ((int)s.size() != L) s = '0' + s;
}

void solve() {
	vector<int> avec;
	avec.push_back(toint(a));
	
	int cnt = 0;
	while (1) {
		cnt++;
		
		sort(a.begin(), a.end());
		int mina = toint(a);
		
		sort(a.begin(), a.end(), greater<char>());
		int maxa = toint(a);
		
		int next = maxa - mina;
		a = tostr(next);
		add0(a);
				
		for (int i = 0; i < (int)avec.size(); i++) {
			if (avec[i] == next) {
				cout << i << " " << next << " " << cnt - i << endl;
				return;
			}
		}
		
		avec.push_back(toint(a));
	}
}

int main() {
	while (1) {
		cin >> a >> L; if (L == 0) break;
		add0(a);
		solve();
	}
	
	return 0;
}

Measured memory_bytes: 1248
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define f(i,n) for(ll i=0;i<n;i++)
#define fa(i,a,b) for(ll i=a;i<=b;i++)
#define fr(i,n) for(ll i=n-1;i>=0;i--)
#define endl "\n"
#define sync ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define ms(array,value) memset(array,value,sizeof(array))
#define test(t) ll t;cin>>t;while(t--)
#define en cout<<endl;
#define mod 1000000007
#define vi vector<int>
#define vll vector<ll>
#define vvi vector<vector<int> >
#define pb push_back
#define all(a) a.begin(),a.end()
#define pi pair<int,int>
#define mod2  998,244,353

int main()
{
    int n; cin>>n;
    ll sum=0;
    fa(i,1,n)
    {
        if(i%3!=0 && i%5!=0) sum+=i;
    }
    cout<<sum<<endl;
}


Measured memory_bytes: 3640
/**
 *    author:  FromDihPout
 *    created: 2020-08-25
**/

#include <bits/stdc++.h>
using namespace std;

#define f first
#define s second

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    
    int h, w, m;
    cin >> h >> w >> m;
    vector<pair<int,int>> rows(h), cols(w);
    set<pair<int,int>> targets;
    for (int i = 0; i < m; i++) {
        int r, c;
        cin >> r >> c;
        r--; c--;
        targets.insert({r, c});
        rows[r].f++;
        rows[r].s = r;
        cols[c].f++;
        cols[c].s = c;
    }
    sort(rows.begin(), rows.end(), greater<pair<int,int>>());
    sort(cols.begin(), cols.end(), greater<pair<int,int>>());
    
    int ans = 0;
    int p1 = 0, p2 = 0;
    while (p1 < h) {
        if (rows[p1].f + cols[p2].f > ans) {
            bool extra = targets.count({rows[p1].s, cols[p2].s});
            ans = max(ans, rows[p1].f + cols[p2].f - extra);
            p2++;
            if (p2 >= w) {
                p1++;
                p2 = 0;
            }
        }
        else if (p1 + 1 >= h || rows[p1+1].f + cols[0].f <= ans) {
           break;
        }
        else {
            p1++;
            p2 = 0;
        }
    }
    cout << ans << '\n';
    return 0;
}

Measured memory_bytes: 21944
#include <bits/stdc++.h>
#define P pair<int,int>
#define All(v) (v).begin(), (v).end()
#define pb(x) push_back(x)
typedef long long ll;
using namespace std;
const int INF = 1e9 + 7, MOD = 1e9 + 7;
const ll LINF = 1e18;
const int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};
int main() {
	int n, d, x, tmp = 0;
	cin >> n >> d >> x;
	int a[n];
	for (int i = 0; i < n; i++) {
		cin >> a[i];
	}
	for (int i = 0; i < n; i++) {
		for (int j = 1; j <= d; j++) {
			if ((j - 1) % a[i] == 0) {
				tmp++;
			}
		}
	}
	cout << x + tmp << endl;
	return 0;
}

Measured memory_bytes: 256
def divisors(n,x)
  i = 0
  while n % x == 0
    n = n / x
    i += 1
  end
  i
end
N = gets.to_i
a = N.times.map{gets.to_f}
arr = Array.new(13){Array.new(4){Hash.new(0)}}
a.each do |xx|
  bit = 9
  x = ((xx+0.00000000001) * (10 ** 9)).floor
  while x % 10 == 0
    bit -= 1
    x /= 10
  end
  if x % 5 == 0
    arr[bit%13][2][divisors(x,5)] += 1
  elsif x % 2 == 0
    arr[bit%13][1][divisors(x,2)] += 1
  else
    arr[bit%13][0][0] += 1
  end
  arr[bit%13][3][0] += 1
end
cnt = 0
(-3).upto(9) do |i|
  i.upto(9) do |j|
    if i + j <= 0
      if i == j
        cnt += arr[i%13][3][0] * (arr[i%13][3][0]-1) / 2
      else
        cnt += arr[i%13][3][0] * arr[j%13][3][0]
      end
    else
      if i == j
        inum = 0
        jnum = 0
        arr[i%13][1].each do |k,v|
          if k >= i+j
            inum += v
          end
        end
        arr[i%13][2].each do |k,v|
          if k >= i+j
            jnum += v
          end
        end
        cnt += inum * jnum
      else
        inum = 0
        arr[i%13][1].each do |k,v|
          if k >= i+j
            inum += v
          end
        end
        jnum = 0
        arr[j%13][2].each do |k,v|
          if k >= i+j
            jnum += v
          end
        end
        cnt += inum * jnum
        inum = 0
        arr[i%13][2].each do |k,v|
          if k >= i+j
            inum += v
          end
        end
        jnum = 0
        arr[j%13][1].each do |k,v|
          if k >= i+j
            jnum += v
          end
        end
        cnt += inum * jnum
      end
    end
  end
end
puts cnt

Measured memory_bytes: 16028
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
// ReSharper disable PossibleNullReferenceException
// ReSharper disable AssignNullToNotNullAttribute

namespace ProCon
{
    class Program
    {
        static void Main(string[] args)
        {
            var nkq = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
            var n = nkq[0];
            var k = nkq[1];
            var q = nkq[2];
            var seikai = new int[n];
            for (int i = 0; i < q; ++i)
            {
                var a = int.Parse(Console.ReadLine());
                seikai[a - 1]++;
            }
            for (int i = 0; i < n; ++i)
            {
                var miss = q - seikai[i];
                bool result = k - miss > 0;
                Console.WriteLine(result?"Yes":"No");
            }
        }
    }
}


Measured memory_bytes: 18012
#include <bits/stdc++.h>
using namespace std;
/*#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
template<typename T> using gpp_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
template<typename T, typename L> using gpp_map = tree<T, L, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
template<typename T> using gpp_multiset = tree<T, null_type, less_equal<T>, rb_tree_tag, tree_order_statistics_node_update>;*/
struct fast_ios { fast_ios(){ cin.tie(0); ios::sync_with_stdio(false); cout << fixed << setprecision(20); }; } fast_ios_;
#define FOR(i, begin, end) for(int i=(begin);i<(end);i++)
#define REP(i, n) FOR(i,0,n)
#define IFOR(i, begin, end) for(int i=(end)-1;i>=(begin);i--)
#define IREP(i, n) IFOR(i,0,n)
#define Sort(v) sort(v.begin(), v.end())
#define Reverse(v) reverse(v.begin(), v.end())
#define all(v) v.begin(),v.end()
#define SZ(v) ((int)v.size())
#define Lower_bound(v, x) distance(v.begin(), lower_bound(v.begin(), v.end(), x))
#define Upper_bound(v, x) distance(v.begin(), upper_bound(v.begin(), v.end(), x))
#define Max(a, b) a = max(a, b)
#define Min(a, b) a = min(a, b)
#define bit(n) (1LL<<(n))
#define bit_exist(x, n) ((x >> n) & 1)
#define debug(x) cout << #x << "=" << x << endl;
#define vdebug(v) { cout << #v << "=" << endl; REP(i_debug, v.size()){ cout << v[i_debug] << ","; } cout << endl; }
#define mdebug(m) { cout << #m << "=" << endl; REP(i_debug, m.size()){ REP(j_debug, m[i_debug].size()){ cout << m[i_debug][j_debug] << ","; } cout << endl;} }
#define Return(ans) { cout << (ans) << endl; return 0; }
#define pb push_back
#define f first
#define s second
#define int long long
#define INF 1000000000000000000
template<typename T> istream &operator>>(istream &is, vector<T> &v){ for (auto &x : v) is >> x; return is; }
template<typename T> ostream &operator<<(ostream &os, vector<T> &v){ for(int i = 0; i < v.size(); i++) { cout << v[i]; if(i != v.size() - 1) cout << endl; }; return os; }
template<typename T1, typename T2> ostream &operator<<(ostream &os, pair<T1, T2> p){ cout << '(' << p.first << ',' << p.second << ')'; return os; }
template<typename T> void Out(T x) { cout << x << endl; }
template<typename T1, typename T2> void Ans(bool f, T1 y, T2 n) { if(f) Out(y); else Out(n); }

using vec = vector<int>;
using mat = vector<vec>;
using Pii = pair<int, int>;
using PiP = pair<int, Pii>;
using PPi = pair<Pii, int>;
using bools = vector<bool>;
using pairs = vector<Pii>;

//int dx[4] = {1,0,-1,0};
//int dy[4] = {0,1,0,-1};
//char d[4] = {'D','R','U','L'};

const int mod = 1000000007;
//const int mod = 998244353;
//#define Add(x, y) x = (x + (y)) % mod
//#define Mult(x, y) x = (x * (y)) % mod



signed main(){

    int X; cin >> X;
    int now = 100;
    int d = 0;
    while(true){
        d++;
        now += now / 100;
        if(now >= X){
            Out(d);
            break;
        }
    }

    return 0;
}


Measured memory_bytes: 3652
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll INF = 1e18;
const ll mod = 1000000007;

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
template<class T> inline bool chmax(T& a, T b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template<class T> inline bool chmin(T& a, T b) {
  if (a > b) {
    a = b;
    return 1;
  }
  return 0;
}
int ctoi(char c) {
  if (c >= '0' && c <= '9') {
    return c - '0';
  }
  return 0;
}
ll factorial(ll n) {
  if (n == 1) {
    return 1;
  }
  ll ans = factorial(n-1);
  return ans*n;
}
ll gcd(ll a, ll b) {
  if (a < b) {
    ll tmp = a;
    a = b;
    b = tmp;
  }
  ll r = a%b;
  while(r != 0) {
    a = b;
    b = r;
    r = a%b;
  }
  return b;
}
ll lcm(ll a, ll b) {
  return (a/gcd(a, b))*b;
}

int main() {
  ll a, b;
  string s;
  cin >> a >> b >> s;
  string ans = "Yes";
  rep(i, a+b+1) {
    if (i == a) {
      if (s.at(i) != '-') ans = "No";
    } else {
      ll n = s.at(i) - '0';
      if (n<0 || 9<n) ans = "No";
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<cmath>
#include<iomanip>
#include<set>
#include<map>
#include<queue>
#include<vector>
using namespace std;
typedef long long ll;
const int MOD=1e9+7;
int main() {
  int n;
  double x[8]={},y[8]={},cnt=0,a=1;
  cin >> n;
  for(int i=0; i<n; i++) {
    cin >> x[i] >> y[i];
  }
  for(int i=1; i<=n; i++) {
    a*=i;
  }
  for(int i=0; i<n; i++) {
    for(int j=0; j<n; j++) {
      if(i!=j) {
        cnt+=sqrt(abs(x[i]-x[j])*abs(x[i]-x[j])+abs(y[i]-y[j])*abs(y[i]-y[j]));
      }
    }
  }
  cout << fixed << setprecision(10) << cnt/n << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MAX = 1e5 + 5;
ll N, A[MAX];

bool check(int x){
    unordered_map<ll, ll> mp;
    ll piv = 0, sum = 1, ret = 0;
    mp[0] = 1;
    for(int i = 0; i < N; i++){
        if(A[i] >= x){
            piv++;
            sum += mp[piv];
        }
        else{
            sum -= mp[piv];
            piv--;
        }
        ret += sum;
        mp[piv]++;  sum++;
    }
    return (2LL * ret < N * (N + 1) / 2);
}

int main(){
    scanf("%lld", &N);
    vector<ll> vt;
    for(int i = 0; i < N; i++){
        scanf("%lld", A + i);
        vt.push_back(A[i]);
    }
    if(N == 1){
        cout <<A[0] <<endl;
        return 0;
    }
    sort(vt.begin(), vt.end());
    vt.erase(unique(vt.begin(), vt.end()), vt.end());
    ll l = 0, r = vt.size() - 1;
    while(l < r){
        int mid = (l + r + 1) / 2;
        if(check(vt[mid])){
            r = mid - 1;
        }
        else{
            l = mid;
        }
    }
    cout << vt[l] << endl;
    return 0;
}


Measured memory_bytes: 5272
#include <iostream>
#include <fstream>
#define MOD 1000000007
using namespace std;
unsigned int N, M, d[1005][1005];

int main() {
    int i, j;
    char c[1005][1005];
    //ifstream cin("grid.in");
    cin >> N >> M;
    for (i = 1; i <= N; i++)
        for (j = 1; j <= M; j++)
            cin >> c[i][j];
    d[1][1] = 1;
    for (i = 1; i <= N; i++)
        for (j = 1; j <= M; j++) {
            if (i != 1 || j != 1) {
                if (c[i][j] == '.')d[i][j] = (d[i - 1][j] + d[i][j - 1])%MOD;
                else d[i][j] = 0;
            }
        }
    cout<<d[N][M];
}

Measured memory_bytes: 5120
#pragma GCC optimize("Ofast")
#include"bits/stdc++.h"
using namespace std;

int main() {
	string S;
	cin >> S;
	if (S == "Sunny") {
		cout << "Cloudy" << endl;
	}
	else if (S == "Cloudy") {
		cout << "Rainy" << endl;
	}
	else if (S == "Rainy") {
		cout << "Sunny" << endl;
	}
}


Measured memory_bytes: 256
from heapq import heappush, heappop
from collections import deque
import itertools
from itertools import permutations
import sys
import bisect
sys.setrecursionlimit(10**6)
def MI():
    return map(int,input().split())
def I():
    return int(input())
def LI():
    return [int(i) for i in input().split()]
YN=['Yes','No']
YNeos='YNeos'
mo=10**9+7
imp='IMPOSSIBLE'


n,m=MI()
ans=(n+m)//2 if (n-m)%2==0 else imp

print(ans)


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

int main() {
  int d;
  while( cin >> d ) {
    int result = 0;
    for ( int i = 1; d*i <= 600-d; i++ ) {
      result += (i*d)*(i*d)*d;
    }
    cout << result  << endl;
  }
  return 0;
}

Measured memory_bytes: 1160
#include <ctype.h>
#include <float.h>
#include <inttypes.h>
#include <limits.h>
#include <signal.h>
#include <stdarg.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <unistd.h>
#include <math.h>
#ifdef __cplusplus
#include <bits/stdc++.h>
#endif
#pragma GCC target("avx2")
#pragma GCC optimize("O3")
//#pragma GCC optimize("unroll-loops")

//char rbuf[]; int rbufl;
//#define getchar() rbuf[rbufl++]
#define getchar getchar_unlocked
#define putchar putchar_unlocked
int32_t nextint(void){ char c=getchar(); while(c!='-'&&(c<'0'||'9'<c)) c=getchar(); bool s=false; if(c=='-'){s=true;c=getchar();} uint32_t x=0; while('0'<=c && c<='9'){ x=x*10+c-'0'; c=getchar(); } return s?-x:x; }
int64_t nextlong(void){ char c=getchar(); while(c!='-'&&(c<'0'||'9'<c)) c=getchar(); int s=0; if(c=='-'){s=1;c=getchar();} uint64_t x=0; while('0'<=c && c<='9'){ x=x*10+c-'0'; c=getchar(); } return s?-x:x; }
uint32_t nextstr(char *s){ char c=getchar(); while(c==' '||c=='\n') c=getchar(); uint32_t len=0; while(c!=' '&&c!='\n'){ *s++=c; len++; c=getchar(); } *s='\0'; return len; }
void printint(int32_t x){ if(x<0){x=-x; putchar('-');}else if(x==0){putchar('0');} int d=0; char s[10]; while(x){ s[d]='0'+x%10; x/=10; d++; } for (int i=d-1; i>=0; i--) putchar(s[i]); putchar('\n'); }
void rsorta_d32(void *base, const int count, const int size, const int index){
	typedef int32_t rsort_t;
	rsort_t (*a)[size] = (rsort_t(*)[size])base;
	rsort_t (*b)[size] = (rsort_t(*)[size])malloc(count*size*sizeof(rsort_t));
	int c[0x100];
	for(int k=0; k<4; k++){
		memset(c, 0, sizeof(c)); for(int i=0; i<count; i++){ c[(a[i][index]>>(k<<3))&0xFF]++; } for(int i=1; i<0x100; i++) c[i]+=c[i-1]; for(int i=count-1; i>=0; i--){ int to=--c[(a[i][index]>>(k<<3))&0xFF]; for(int j=0; j<size; j++){ b[to][j]=a[i][j]; } }{rsort_t(*t)[size]=a; a=b; b=t;}
	}
	free(b);
}

long a[2001];
int main(void){
	int n=nextint();
	a[0]=1;
	for(int i=3; i<=n; i++){
		for(int j=0; j<=i-3; j++){
			a[i]+=a[j];
		}
		a[i]%=1000000007;
	}
	printf("%d\n", a[n]);
}


Measured memory_bytes: 1608
#include <iostream>
#include <fstream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <chrono>

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

typedef pair<int, int> pi;
typedef pair<ll,ll> pl;
typedef pair<ld,ld> pd;

typedef vector<int> vi;
typedef vector<ld> vd;
typedef vector<ll> vl;
typedef vector<pi> vpi;
typedef vector<pl> vpl;

//#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define loop(x,n) for(int x = 0; x < n; ++x)
#define FORd(i,a,b) for (int i = (b)-1; i >= (a); i--)
#define F0Rd(i,a) for (int i = (a)-1; i >= 0; i--)
#define trav(a, x) for (auto& a : x)

#define mp make_pair
#define pb push_back
#define ff first
#define ss second
#define lb lower_bound
#define ub upper_bound

#define sz(x) (int)x.size()
#define beg(x) x.begin()
#define en(x) x.end()
#define all(x) beg(x), en(x)
#define resz resize

const int MOD = 1000000007; // 998244353
const ll INF = 1e18;
const int MX = 100001;

string get_str() {
    string temp;
    cin >> temp;
    return temp;
}
int get_int() {
    int temp;
    cin >> temp;
    return temp;
}




int main() {
    
    string s, t;
    cin >> s >> t;

    int ans = 0;

    loop(i, s.length()) {
        if(s[i] != t[i]) ans++;
    }

    cout << ans << endl;

}

Measured memory_bytes: 3860
#include <algorithm>
#include <cmath>
#include <iostream>
#include <map>
#include <string>
using namespace std;

int main() {
    int a,b,c,x,y,z;
    cin >> a >> b >> c >> x >> y;
    if (a > 2*c) {
        if (b > 2*c) {
            z = max(x, y);
        }
        else {
            z = x;
        }
    }
    else {
        if (b > 2*c) {
            z = y;
        }
        else {
            if (a+b > 2*c) {
                z = min(x,y);
            }
            else {
                z = 0;
            }
        }
    }
    x = max(x-z, 0);
    y = max(y-z, 0);
    z *= 2;

    cout << a*x+b*y+c*z << endl;
    return 0;
}

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

int main()
{
    vector<long long> v;
    long long sum = 0;
    long long MOD = 1e9+7;
    int num;
    long long current, currentsum, ans=0;

    cin >> num;
    for(int i=0;i<num;i++){
        cin >> current;
        v.push_back(current);
        sum += current;
    }
    for(int i=0;i<num;i++){
        sum -= v[i];
        currentsum = sum % MOD;
        ans += v[i] * currentsum;
        ans %= MOD;
    }
    cout << ans << endl;
    return 0;
}

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

#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;
typedef long long ll;
const int INF = 1e9;

int main() {
  ll n, x, a, b, ans = 1;
  cin >> n;
  vector<ll> av(n);
  rep(i, n) cin >> av[i];
  a = av[0];
  for (int i = 1; i < n; ++i) {
    b = av[i];
    if (a == b) continue;
    if (x == 1 & b > a || x == -1 && a > b) ans++, x = 0;
    else x = a < b ? -1 : 1;
    a = b;
  }

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


Measured memory_bytes: 1024
let n, a, b, c = Scanf.scanf " %d %s %s %s" @@ fun a b c d -> a, b, c, d
let ans = ref 0
let f a b c = if a = b && b = c then 0 else if a <> b && b <> c && c <> a then 2 else 1
let _ = String.iteri (fun i x -> ans := !ans + f x b.[i] c.[i]) a; Printf.printf "%d\n" !ans

Measured memory_bytes: 2432
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vin=vector<int>;
using vll=vector<long long>;
using vvin=vector<vector<int>>;
using vvll=vector<vector<long long>>;
using vstr=vector<string>;
using vvstr=vector<vector<string>>;
using vch=vector<char>;
using vvch=vector<vector<char>>;
using vbo=vector<bool>;
using vvbo=vector<vector<bool>>;
using vpii=vector<pair<int,int>>;
using pqsin=priority_queue<int,vector<int>,greater<int>>;
#define mp make_pair
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep2(i,s,n) for(int i=(s);i<(int)(n);i++)
#define all(v) v.begin(),v.end()
#define decp(n) cout<<fixed<<setprecision((int)n)
#define _GLIBCXX_DEBUG
//vector<vector<vector<int>>> dp(101, vector<vector<int>>(101, vector<int>(101)));  
int main(){
    int n,W;cin>>n>>W;
    vin v(n),w(n);
    rep(i,n)cin>>v[i]>>w[i];
    vvin dp(n+1,vin(W+1,0));
    rep(i,n){
        rep(j,W+1){
            if(j<w[i])dp[i+1][j]=dp[i][j];
            else dp[i+1][j]=max(dp[i][j],dp[i+1][j-w[i]]+v[i]);
        }
    }
    cout<<dp[n][W]<<endl;
}


Measured memory_bytes: 6868
#include <stdio.h>

int N, M;
int X[100000], D[99999];

void merge_sort(int *a, int n) {
    if (n <= 1) return;
    int m = n / 2;
    merge_sort(a, m);
    merge_sort(a + m, n - m);
    static int a_[100000];
    for (int i = 0; i < n; i++) {
        a_[i] = a[i];
    }
    int i = 0;
    int j = m;
    int k = 0;
    while (i < m || j < n) {
        if (j == n || (i < m && a_[i] <= a_[j])) {
            a[k++] = a_[i++];
        } else {
            a[k++] = a_[j++];
        }
    }
}

int main() {
    scanf("%d %d", &N, &M);
    for (int i = 0; i < M; i++) {
        scanf("%d", &X[i]);
    }
    merge_sort(X, M);
    int ans = 0;
    for (int i = 0; i + 1 < M; i++) {
        D[i] = X[i + 1] - X[i];
        ans += D[i];
    }
    merge_sort(D, M - 1);
    int k = M - 2;
    while (k >= 0 && N >= 2) {
        ans -= D[k--];
        N--;
    }
    printf("%d\n", ans);
    return 0;
}



Measured memory_bytes: 1280
#include<iostream>
using namespace std;
int main(){
  int n,i,a,b,c,aa,bb,cc;
  cin>>n;
  for(i=0;i<n;i++){
    cin >>a>>b>>c;
    aa=a*a;bb=b*b;cc=c*c;
    if(aa+bb==cc || bb+cc==aa || cc+aa==bb)cout <<"YES"<<endl;
    else cout <<"NO"<<endl;
  }
  return 0;
}

Measured memory_bytes: 1152