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

#define ll long long
#define deb(x) cerr << #x << ":" << x << "\n"
#define all(x) x.begin(),x.end()

#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
#define int ll

void solve()
{
    int a,b,c,d;
    cin>>a>>b>>c>>d;
    cout<<max({a*c,b*d,a*d,b*c})<<"\n";
}

int32_t main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    int t = 1;
    // cin >> t;
    while (t--)
    {
        solve();
    }
    return 0;
}

Measured memory_bytes: 3644
// 0279
#include <iostream>
using namespace std;

int main(){
	while(1){
		int N, k, item=0, prize=0;
		
		cin>>N;
		if(N == 0)
			break;

		for(int i=0;i<N;i++){
			cin>>k;

			if(k == 1)
				item++;
			else if(k > 1)
				prize++;
		}

		if(prize == 0)
			cout<<"NA"<<endl;
		else
			cout<<item+prize+1<<endl;

	}
	return 0;
}

Measured memory_bytes: 1164
#include <algorithm>
#include <iostream>
#include <set>
#include <vector>
using namespace std;
typedef long long ll;
const int INF = 1 << 30;
const ll INFll = 1ll << 60;

int main() {
  int n;
  cin >> n;
  set<int> s;
  for (int i = 0; i < n; i++) {
    int a;
    cin >> a;
    s.insert(a);
  }
  cout << s.size() << endl;

  return 0;
}


Measured memory_bytes: 256
package main

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

func main() {
    var fp *os.File
    fp = os.Stdin
    reader := bufio.NewReaderSize(fp, 1024)
    S := readLine(reader)
    arr := []byte(S)

    first  := string(arr[0]) + string(arr[1])
    second := string(arr[2]) + string(arr[3])

    var num [2]int
    num[0], _ = strconv.Atoi(first)
    num[1], _ = strconv.Atoi(second)

    var flg_month int = 0
    var flg_month_f int = 0

    for k, v := range num {
        if v >= 1 && v <= 12 {
            flg_month++

            if k == 0 {
                flg_month_f = 1
            }
        }
    }

    if flg_month == 0 {
        fmt.Println("NA")
    } else if flg_month == 2 {
        fmt.Println("AMBIGUOUS")
    } else {
        if flg_month_f == 1 {
            fmt.Println("MMYY")
        } else {
            fmt.Println("YYMM")
        }
    }
}

func readLine(reader *bufio.Reader) string {
    buf := make([]byte, 0, 1000000)

    for {
        l, p, _ := reader.ReadLine()

        buf = append(buf, l...)

        if !p {
            break
        }
    }

    return string(buf)
}

Measured memory_bytes: 640
import sys
def main():
    input = sys.stdin.readline
    n=int(input())
    *A,=map(int, input().split())
    #mCr
    m,r=max(A),0
    maxd=0
    for a in A:
        if a>=m: continue
        d = min(a,m-a)
        if maxd<d:
            maxd=d
            r=a
    print(m,r)

if __name__ == '__main__':
    main()

Measured memory_bytes: 58864
using System;
using System.Collections.Generic;
using System.Linq;

namespace CSharpSample01
{
    

    class Program
    {


        

        static void Main(string[] args)
        {
            string strN = Console.ReadLine();
            int N = int.Parse(strN);

            int digi = strN.Length;
            int ans = 0;

            if(digi % 2 == 1)
            {
                ans += N - (int)Math.Pow(10, digi - 1) + 1;
                digi -= 2;
            }
            else
            {
                digi--;
            }
            
            while (true)
            {
                if (digi == -1) break;
                ans += 9 * (int)Math.Pow(10, digi - 1);
                digi -= 2;               
            }

            Console.WriteLine(ans);
        }
    }
}

Measured memory_bytes: 11092
#include <iostream> // cout, endl, cin
#include <cmath> //sqrt pow
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // dequef
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower

#define rep(i,n) for(int i = 0; i < n; i++)
#define vi vector<int>
#define vvi vector<vi>
#define pii pair<int, int>
#define all(a) (a).begin(), (a).end()
#define mod 1000000007
using ll = long long;
using namespace std;
int main(){
  int a,b;
  cin >> a >> b;
  if((a + b) % 2 == 0){
    cout << (a + b) / 2 << endl;
  }else cout << "IMPOSSIBLE" << endl;
}

Measured memory_bytes: 256
from sys import stdin
import sys
# sys.setrecursionlimit(10**8)

def nextLine(): return next(stdin)
def nextStrList(): return nextLine().split()
def nextIntList(): return [int(_) for _ in nextStrList()]

from collections import Counter

def main():
	n=int(nextLine())
	al=nextIntList()
	
	c=Counter()
	for i,a in enumerate(al):
		c[a]+=1
	for i in range(1,n+1):
		print(c[i])
		
	
if __name__=="__main__":
	main()


Measured memory_bytes: 35196
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int n;
	cin>>n;
	vector<int> v;
	for(int i=0;i<n;i++)
	{
		int x;
		cin>>x;
		v.push_back(x);
	}
	int mem[100005]={-1};
	mem[0]=0;
	mem[1]=abs(v[1]-v[0]);
	for(int i=2;i<n;i++)
	{
		mem[i]=min(abs(v[i]-v[i-1])+mem[i-1],abs(v[i]-v[i-2])+mem[i-2]);
	//	cout<<i<<" : "<<mem[i]<<endl;
	}
	cout<<mem[n-1]<<endl;
	return 0;
}

Measured memory_bytes: 1144
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(n);i++)
#define rep_lr(i,l,r) for(int i=(l);i<(r);i++)
#define all(x) (x).begin(),(x).end()
#define V vector
typedef V<int> vi;
typedef V<vi> vvi;
typedef long long ll;
typedef pair<ll, ll> P;
typedef tuple<int, int, int> T;
constexpr int INF = INT_MAX >> 1;
constexpr ll LINF = 5000000000000000LL;
constexpr int MOD = 1000000007;

P dp1[100], dp2[100];

int main() {

	int n;
	cin >> n;
	V<ll> a(n);
	rep(i, n)cin >> a[i];

	dp1[0] = P(1000, 0);
	dp2[0] = P(0, 1000);

	rep(i, n){
		dp1[i + 1] = max(dp1[i], P(dp2[i].second + dp2[i].first * a[i], 0));
		dp2[i + 1] = max(dp2[i], P(dp1[i].second + dp1[i].first / a[i], dp1[i].first - dp1[i].first / a[i] * a[i]));
	}
	cout << dp1[n].first << endl;
}

Measured memory_bytes: 3584
#include <stdio.h>

int main(void)
{
	int num;
	int x[200] = {0};
	int y[200] = {0};
	int tgt = 0;
	int drc = 0;

	int i;
	int k=0;
	int lwx=0,hix=0,lwy=0,hiy=0;

	int outh[1000] = {0};
	int outw[1000] = {0};

	while(1)
	{

		/*initialize*/
		for(i=0;i<200;i++)
		{x[i]=0;
		 y[i]=0;}
		lwx=0;
		hix=0;
		lwy=0;
		hiy=0;
		/*initialize*/

		scanf("%d",&num);
		if(num==0)break;

		for(i=1; i < num; i++)
		{
			scanf("%d",&tgt);
			scanf("%d",&drc);
		
			if(drc==0)
			{
				x[i] = x[tgt]-1;
				y[i] = y[tgt];
			}
			if(drc==2)
			{
				x[i] = x[tgt]+1;
				y[i] = y[tgt];
			}
			if(drc==1)
			{
				x[i] = x[tgt];
				y[i] = y[tgt]-1;
			}
			if(drc==3)
			{
				x[i] = x[tgt];
				y[i] = y[tgt]+1;
			}
		}

		for(i=0; i < num; i++)
		{
			if(x[i]<lwx)
				lwx=x[i];
			if(x[i]>hix)
				hix=x[i];
			if(y[i]<lwy)
				lwy=y[i];
			if(y[i]>hiy)
				hiy=y[i];
		}

		outw[k] = hix - lwx + 1;
		outh[k] = hiy - lwy + 1;
		k++;

	}

	for(i=0; i<k; i++)
	{
		printf("%d %d\n",outw[i],outh[i]);
	}

	return 0;
}

Measured memory_bytes: 0
N = int(input())

def dfs(s): # 文字列 s で始まる七五三数の個数
    if int(s) > N:
        return 0
    ret = 1 if all(s.count(c) > 0 for c in '753') else 0 # s 自体が七五三数なら +1
    for c in '753':
        ret += dfs(s + c)
    return ret

print(dfs('0')) # 本当は dfs('') と書きたいが 4 行目でのエラーを防ぐため仕方なく

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
using lint = long long;


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

  int n;
  string s;
  cin >> n >> s;
  if (s.size() <= n) {
    cout << s << "\n";
  } else {
    while (s.size() > n) s.pop_back();
    s.push_back('.');
    s.push_back('.');
    s.push_back('.');
    
    cout << s << "\n";
  }

}

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

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

    string s;
    int n;
    cin >> n >> s;

    if (n & 1) cout << "No\n";
    else{
        bool ok = true;
        for (int i=0; i<n/2; i++){
            if (s[i] != s[i+(n/2)]){
                ok = false;
                break;
            }
        }
        if (ok) cout << "Yes\n";
        else cout << "No\n";
    }
}

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

/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 *
 * @author Jiakang Chen
 */
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        
        int N = sc.nextInt();
        
        int L = sc.nextInt();
        Rope[] S = new Rope[N];
        
        for (int i = 0; i < N; i++) {
            S[i] = new Rope(i + 1, sc.nextInt());
        }
        
        int x = isValid(S, L);
        if (x != -1) {
            System.out.println("Possible");
            for (int i = 1; i < x; i++) {
                System.out.println(i);
            }
            
            for (int i = N - 1; i > x; i--) {
                System.out.println(i);
            }
            
            System.out.println(x);
        } else {
            System.out.println("Impossible");
        }
    }
    
    public static int isValid(Rope[] S, int L) {
        for (int i = 0; i < S.length - 1; i++) {
            if (S[i].l + S[i + 1].l >= L) {
                return S[i].i;
            }
        }
        
        return -1;
    }
}

class Rope implements Comparable<Rope> {
    public int i;
    public int l;
    
    public Rope(int index, int length) {
        i = index;
        l = length;
    }
    
    public int compareTo(Rope other) {
        return this.l - other.l;
    }
}

Measured memory_bytes: 67992
import java.util.*;

public class Main{

    public static void main(String args[]){

        Scanner sc = new Scanner(System.in);

        int N = sc.nextInt();
        int K = sc.nextInt();
        int p[] = new int[N];
        int sum = 0;

        for (int i = 0; i < N; i++){
            p[i] = sc.nextInt();
        }

        Arrays.sort(p);

        for (int i = 0; i < K; i++){
            sum += p[i];
        }

        System.out.println(sum);
    }
}



Measured memory_bytes: 38884
import Control.Applicative
import Control.Monad
import Data.List
import Data.Char
import Data.Maybe
strToInt s = (read :: String -> Int) s
strToInteger s = (read :: String -> Integer) s
strToDouble s = (read :: String -> Double) s

main :: IO ()
main = do
    -- スペース区切り整数の入力
    [a, b] <- map strToInt . words <$> getLine
    let soloPoker = 1 : [13,12..2]
        aliceHand = fromJust $ elemIndex a soloPoker
        bobHand = fromJust $ elemIndex b soloPoker
    -- 出力
    putStrLn $ case compare aliceHand bobHand of
        LT -> "Alice"
        EQ -> "Draw"
        GT -> "Bob"


Measured memory_bytes: 508
nums = input()
lines = [[]]*nums

for x in range(nums):
    lines[x] = map(int, raw_input().split(' '))


for li in lines:
    li.sort()

for li in lines:
    if li[0]**2 + li[1]**2 == li[2]**2 :
        print 'YES'
    else:
        print 'NO'

Measured memory_bytes: 4280
tr_dot::Int-> Int
tr_dot n = div (n*(n+1)) 2

ans::Int -> Int -> Int
ans s k = if (k <= s) && ((2*k) >= s) then (tr_dot (s+1)) - (3*(tr_dot (s-k)))
                                      else if (k > s) then   (tr_dot (s+1))
                                                      else  tr_dot (((3*k)-s)+1)
main::IO()
main = do
  ksc<-getLine
  let k:s:[] = map read (words ksc)::[Int]
  print (ans s k)

Measured memory_bytes: 508
#include<iostream>
#include<cmath>
#include<cstring>
#include<cstdio>
#include<algorithm>
using namespace std;

int gcd(int x,int y)
{
  if(y==0)
    return x;
  return gcd(y,x%y);
}

int lcm(int x,int y)
{
    return x/gcd(x,y)*y;
}

int main()
{
    //freopen("in.txt","r",stdin);
    //freopen("out.txt","w",stdout);
    int a,b;
    while(scanf("%d%d",&a,&b)!=EOF)
    {
      printf("%d %d\n",gcd(a,b),lcm(a,b));
    }
    //fclose(stdin);
    //fclose(stdout);
    return 0;
}

Measured memory_bytes: 1188
# -*- coding: utf-8 -*-
"""
A - Diverse Word
https://atcoder.jp/contests/agc022/tasks/agc022_a

"""
import sys


from string import ascii_lowercase

def solve(S):
    if len(S) < len(ascii_lowercase):
        remaining = sorted(set(ascii_lowercase) - set(S))
        return S + remaining[0]
    for p in range(len(S)-1, -1, -1):
        pre = S[:p]
        ch = chr(ord(S[p]) + 1)
        while 'a' <= ch <= 'z':
            if ch not in pre:
                return pre + ch
            ch = chr(ord(ch) + 1)
    return -1


def main(args):
    S = input()
    ans = solve(S)
    print(ans)


if __name__ == '__main__':
    main(sys.argv[1:])

Measured memory_bytes: 3772
a,b,c,x,y = map(int, input().split())

#a,b別々
ans = a * x + b * y

#全てabで作る
ans = min(ans, c * 2 * max(x,y))

if x - y > 0:
    # 残りをaで買う
    t = c * 2 * y
    t += a * (x - y)
    ans = min(ans, t)
else:
    # 残りをbで買う
    t = c * 2 * x
    t += b * (y - x)
    ans = min(ans, t)
print(ans)


Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
int n, m, ans;
int main()
{
    __int128_t x;
    int n;
    cin >> n;
    n %= 10;
    if (n == 3)
        cout << "bon" << endl;
    if (n == 0)
        cout << "pon" << endl;
    if (n == 1)
        cout << "pon" << endl;
    if (n == 6)
        cout << "pon" << endl;
    if (n == 8)
        cout << "pon" << endl;

    if (n == 2)
        cout << "hon" << endl;
    if (n == 4)
        cout << "hon" << endl;
    if (n == 5)
        cout << "hon" << endl;
    if (n == 7)
        cout << "hon" << endl;
    if (n == 9)
        cout << "hon" << endl;
    return 0;
}

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

using namespace std;

int main()
{
    int n;
    
    while (cin >> n, n) {
        vector<vector<int> > a(2, vector<int>(n));
        int cnt = 0;
        int f, t;

        f = 0;
        t = 1;
        for (int i = 0; i < n; i++)
            cin >> a[0][i];

        while (true) {
            for (int i = 0; i < n; i++) {
                int tmp = 0;
                for (int j = 0; j < n; j++)
                    if (a[f][i] == a[f][j])
                        tmp++;
                a[t][i] = tmp;
            }

            bool flag = true;
            for (int i = 0; i < n; i++)
                if (a[f][i] != a[t][i]) {
                    flag = false;
                    break;
                }
            if (flag)
                break;

            cnt++;
            f = 1 - f;
            t = 1 - t;
        }

        cout << cnt << endl;
        for (int i = 0; i < n - 1; i++)
            cout << a[t][i] << " ";
        cout << a[t][n - 1] << endl;
    }

    return 0;
}

Measured memory_bytes: 1216
#include <iostream>
#include <string>
#include <cstring>
#include <algorithm>
#include <queue>
using namespace std;

#define LL long long

const int MAXN = 2000000 + 5;

int a[MAXN];



bool ok(int N, int v, int K){
    int i;
    for (i = 0; i < N; i ++){
        if (a[i] > v){
            int t = a[i] / v;
            if (a[i] % v > 0){
                t ++;
            }
            K -= t - 1;
            if (K < 0){
                return false;
            }
        }
    }
    return true;
}

int solve(int N, int high, int K){
    int low, mid;
    int i, ret = high;
    low = 1;
    while(low <= high){
        mid = (low + high) / 2;
        if (ok(N, mid, K)){
            ret = mid;
            high = mid - 1;
        }
        else{
            low = mid + 1;
        }
    }
    return ret;
}

int main()
{
    int N, i, j, K, high;
    cin >> N >> K;
    high = 0;
    for (i = 0; i < N; i ++){
        cin >> a[i];
        if (a[i] > high){
            high = a[i];
        }
    }
    cout << solve(N, high, K);
    system("pause");
    return 0;
}

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

typedef long long ll;
typedef long double ld;

#define MOD 1000000007
#define all(x) (x).begin(),(x).end()
#define rep(i, n) for(int i = 0; i < (int)(n); i++)

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

int main(){

    ll a, b;

    cin >> a >> b;

    cout << (a <= b ? a : a - 1) << endl;

    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
int main()
{
  int n,c=0,i,j;
  scanf("%d",&n);
  char str[n+2];
  scanf("%s",str);
  for(i=0;i<=n-2;i++)
  {
    if(str[i]=='A'&&str[i+1]=='B'&&str[i+2]=='C')
      c++;
  }
  printf("%d",c);
  return 0;
}

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

int main(){
  int n;
  string s;
  cin >> n >> s;
  
  int cnt=0;
  for (int i = 1; i < n; i++)
  {
    if(s[i]=='E') cnt++;
  }

  int ans=cnt;
  for (int i = 1; i < n; i++)
  {
    if(s[i]=='E') cnt--;
    if(s[i-1]=='W') cnt++;
    ans = min(ans,cnt);
  }
  
  cout << ans << endl;
}

Measured memory_bytes: 900
#include <iostream>
using namespace std;
 
struct Card{
  char suit;
  char value;
};
 
void bubble_sort(struct Card A[], int N){
  Card temp;
  for(int i=0; i<N; i++){
    for(int j = 0; j < N - i -1; j++){
      if(A[j].value > A[j+1].value){
        temp = A[j];
        A[j] = A[j+1];
        A[j+1] = temp;
      }
    }
  }
}
 
void selection_sort(struct Card A[], int N){
  int minj;
  for(int i = 0; i< N-1; i++){
    minj = i;
    for(int j = i; j < N; j++){
      if (A[j].value < A[minj].value) {
        minj = j;
      }
    }
    Card t = A[i];
    A[i] = A[minj];
    A[minj] = t;
  }
}
 
void print(struct Card A[], int N){
  for(int i=0; i<N; i++){
    if (i) {
      cout << " ";
    }
    cout << A[i].suit << A[i].value ;
  }
  cout << endl;
}
 
bool isStable(struct Card A[], struct Card B[], int N){
  for(int i=0; i<N; i++){
    if(A[i].suit != B[i].suit)
      return false;
  }
  return true;
}
 
 
int main(int argc, char const *argv[]) {
  Card A[100], B[100];
  int N;
  char ch;
 
  cin >> N;
  for(int i=0; i<N; i++){
    cin >> A[i].suit >> A[i].value;
  }
 
  for(int i=0; i<N; i++)
    B[i] = A[i];
 
  bubble_sort(A, N);
  selection_sort(B, N);
 
  print(A, N);
  cout << "Stable" << endl;
  print(B, N);
  if (isStable(A, B, N)) {
    cout << "Stable" << endl;
  }else{
    cout << "Not stable" << endl;
  }
 
  return 0;
}

Measured memory_bytes: 3088
#include<algorithm>
#include<cmath>
#include<iomanip>
#include<iostream>
#include<map>
#include<numeric>
#include<queue>
#include<set>
#include<sstream>
#include<unordered_map>
#include<unordered_set>
#include<vector>
using namespace std;
using uint = unsigned int;
using ll = long long;
const int M = 1e9 + 7;
const ll MLL = 1e18L + 9;
#pragma unused(M)
#pragma unused(MLL)
#ifdef LOCAL
#include"rprint.hpp"
#else
template <ostream& out = cout, class... T> void prints(T&&...){ }
template <ostream& out = cout, class... T> void printd(T&&...){ }
template <ostream& out = cout, class... T> void printb(T&&...){ }
template <ostream& out = cout, class... T> void printArr(T&&...){ }
#endif

int main(){
    int n; cin >> n;
    int maxi = 0;
    vector<int> r(50);
    for(int i = 0; i < n; i++){
        int a; cin >> a;
        if(a >= 3200){
            maxi++;
        }else{
            r[a / 400] = 1;
        }
    }
    int acc = accumulate(r.begin(), r.end(), 0);
    cout << max(1, acc) << ' ' << maxi + acc << '\n';
    return 0;
}


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

#define f first
#define s second
#define mp make_pair
#define pb push_back
#define sz(x) (int)(x).size()
#define all(x) x.begin(),x.end()
#define mst(a,v) memset(a,v,sizeof(a))

typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef pair<int,int> pi;
typedef vector<pi> vpi;

const int N=100010;
const int mod=1e9+7;
const ld PI=acos(-1.0);
const int inf=0x3f3f3f3f;



int main()
{
#ifdef local
    //freopen("input.txt","r",stdin);
    //freopen("output.txt","w",stdout);
#endif
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    string s,t;
    cin>>s>>t;
    for(int i=0; t[i]; i++)
    {
        if(t[i]==s[0])
        for(int j=i,k=0; s[k]; k++,j=(j+1)%sz(t))
            if(s[k]!=t[j]) break;
            else if(k==sz(s)-1)
            {
                cout<<"Yes";
                return 0;
            }
    }
    cout<<"No";
    return 0;
}


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

int main() {
    int N;
    cin >> N;
    vector<int> A(N), B(N);
    for (int i = 0; i < N; i++) {
        cin >> A[i] >> B[i];
    }
    sort(A.begin(), A.end());
    sort(B.begin(), B.end(), greater<int>());

    if (N%2==1) {
        cout << B[(N-1)/2] - A[(N-1)/2] + 1 << endl;
    } else {
        cout << B[N/2] + B[N/2-1] - (A[N/2] + A[N/2-1]) + 1 << endl;
    }
    return 0;
}

Measured memory_bytes: 4848
#include "bits/stdc++.h"
#define rep(i, j) for (int i = 0; i < j; i++)
using namespace std;
using ll = long long;
using P = pair<int, int>;
using ull = unsigned long long;

int gcd(int x, int y);
int fac(ll n, vector<int> num);

const int INF = 1001001001;

//mint�p�̕ϐ� (10��9��)
const int mod = 1000000007;

struct mint {
    ll x; // typedef long long ll;
    mint(ll x = 0) :x((x% mod + mod) % mod) {}
    mint operator-() const { return mint(-x); }
    mint& operator+=(const mint a) {
        if ((x += a.x) >= mod) x -= mod;
        return *this;
    }
    mint& operator-=(const mint a) {
        if ((x += mod - a.x) >= mod) x -= mod;
        return *this;
    }
    mint& operator*=(const mint a) { (x *= a.x) %= mod; return *this; }
    mint operator+(const mint a) const { return mint(*this) += a; }
    mint operator-(const mint a) const { return mint(*this) -= a; }
    mint operator*(const mint a) const { return mint(*this) *= a; }
    mint pow(ll t) const {
        if (!t) return 1;
        mint a = pow(t >> 1);
        a *= a;
        if (t & 1) a *= *this;
        return a;
    }

    // for prime mod
    mint inv() const { return pow(mod - 2); }
    mint& operator/=(const mint a) { return *this *= a.inv(); }
    mint operator/(const mint a) const { return mint(*this) /= a; }
};
istream& operator>>(istream & is, const mint & a) { return is >> a.x; }
ostream& operator<<(ostream & os, const mint & a) { return os << a.x; }


int main() {
    string s;
    cin >> s;
    if (s[0] >= 'A' && s[0] <= 'Z')
    cout << 'A' << endl;
    else
    cout << 'a' << endl;
    return 0;
}

/*���C�u�����ő����*/
//���[�O���b�h�̌ݏ��@
int gcd(int x, int y) {
    int num[3];
    num[0] = (x > y) ? x : y;
    num[1] = (x <= y) ? x : y;
    num[2] = num[0] % num[1];

    while (num[2]) {
        num[0] = num[1];
        num[1] = num[2];
        num[2] = num[0] % num[1];
    }

    return num[1];
}

/*�f��������*/
//���색�C�u����
int fac(ll n, vector<int> num) {
    ll kazu = n;
    for (int i = 2; i <= sqrt(n); i++) {
        while (1) {
            if (kazu % i != 0) break;

            kazu /= i;
            num[i]++;
        }
    }
    if (kazu == n && n != 1) return 1;
    int ans = 0;
    if (kazu != 1) ans++;
    for (int i = 2; i <= sqrt(n); i++) {
        for (int j = 1; j <= num[i]; j++) {
            num[i] -= j;
            ans++;
        }
    }
    return ans;
}

Measured memory_bytes: 3716
import java.util.*;
import java.io.*;
class Main{
    public static void main(String[] args){
	try{
	    BufferedReader s = new BufferedReader(new InputStreamReader(System.in));
	    int x = 100000, n = Integer.valueOf(s.readLine());
	    for(int i=0; i<n; i++){
		x+=0.05*x;
		if(x%1000!=0)
		    x=1000*(x/1000+1);
	    }
	    System.out.println(x);
	}catch(Exception e){
	    System.out.println("Error");
	}
    }
}

Measured memory_bytes: 9188
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define repo(i,n) for(int i = 1; i < (int)(n); i++)
#define pb push_back
#define mp make_pair
#define np next_permutation
#define lb lower_bound
#define ub upper_bound
#define fi first
#define se second
#define all(x) (x).begin(),(x).end()
#define mod 1000000007
#define pi acos(-1.0)
const ll INF = 1LL<<61;
template<class T>bool chmax(T &a, const T &b) { 
  if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) {
  if (b<a) { a=b; return 1; } return 0; }
ll gcd(ll x, ll y) { return y ? gcd(y, x % y) : x; }
ll lcm(ll x, ll y) { return x / gcd(x, y) * y; }
ll jou(ll N, ll P){if(P==0) return 1;
  if(P%2==0){ll t = jou(N, P/2);return t*t % mod;
  }return (N * jou(N, P-1)) % mod;}  //jou(n,mod-2)で逆元
//intの最大値2147483647 ≒ 2×10^9
//long longの最大値9223372036854775807 ≒ 9×10^18
//'大文字'+=32;    で小文字に
//  cout << fixed << setprecision (20);   小数点以下2０桁まで
//実行時間制約2秒では２×10^8回くらいまで計算できる




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

  ll ans=0;
  rep(i,n){
    if(i%2==0&&s[i]=='p') ans--;
    if(i%2==1&&s[i]=='g') ans++;
  }

  cout << ans << endl;
}

Measured memory_bytes: 512
#include<cmath>
#include<cstdio>
#include<vector>
#include<cstring>
#include<iostream>
#include<algorithm>
using namespace std;
int vis[111][111];
int x[10101],y[10101];
int main()
{
	int n,i,j,cnt=0;
	scanf("%d",&n);
	if(n%2==0)
	{
		for(i=1;i<=n/2;i++)
			vis[i][n-i+1]=1;
		for(i=1;i<=n;i++)
			for(j=i+1;j<=n;j++)
			{
				if(vis[i][j])
					continue;
				cnt++,x[cnt]=i,y[cnt]=j;
			}
	}
	else
	{
		for(i=1;i<=(n-1)/2;i++)
			vis[i][n-i]=1;
		n--;
		for(i=1;i<=n;i++)
			for(j=i+1;j<=n;j++)
			{
				if(vis[i][j])
					continue;
				cnt++,x[cnt]=i,y[cnt]=j;
			}
		for(i=1;i<=n;i++)
				cnt++,x[cnt]=i,y[cnt]=n+1;
	}
	printf("%d\n",cnt);
	for(i=1;i<=cnt;i++)
		printf("%d %d\n",x[i],y[i]);
	//freopen(".in","r",stdin);
	//freopen(".out","w",stdout);
 	return 0;
}


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


public class Main {

	private static Scanner sc;
	private static Printer pr;

	private static void solve() {
		int n = sc.nextInt();

		int max = 0;
		int min = 1000;
		for (int i = 0; i < n; i++) {
			int a = sc.nextInt();

			max = Math.max(max, a);
			min = Math.min(min, a);
		}

		pr.println(max - min);
	}

	// ---------------------------------------------------
	public static void main(String[] args) {
		sc = new Scanner(System.in);
		pr = new Printer(System.out);

		solve();

		pr.close();
		sc.close();
	}

	private static class Printer extends PrintWriter {
		Printer(PrintStream out) {
			super(out);
		}
	}
}


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

int gcd(int x, int y);

const int INF = 1001001001;

/*struct mint {
    ll x; // typedef long long ll;
    mint(ll x = 0) :x((x% mod + mod) % mod) {}
    mint operator-() const { return mint(-x); }
    mint& operator+=(const mint a) {
        if ((x += a.x) >= mod) x -= mod;
        return *this;
    }
    mint& operator-=(const mint a) {
        if ((x += mod - a.x) >= mod) x -= mod;
        return *this;
    }
    mint& operator*=(const mint a) { (x *= a.x) %= mod; return *this; }
    mint operator+(const mint a) const { return mint(*this) += a; }
    mint operator-(const mint a) const { return mint(*this) -= a; }
    mint operator*(const mint a) const { return mint(*this) *= a; }
    mint pow(ll t) const {
        if (!t) return 1;
        mint a = pow(t >> 1);
        a *= a;
        if (t & 1) a *= *this;
        return a;
    }

    // for prime mod
    mint inv() const { return pow(mod - 2); }
    mint& operator/=(const mint a) { return *this *= a.inv(); }
    mint operator/(const mint a) const { return mint(*this) /= a; }
};
istream& operator>>(istream & is, const mint & a) { return is >> a.x; }
ostream& operator<<(ostream & os, const mint & a) { return os << a.x; }*/

int main() {
    ll n;
    cin >> n;
    ll ans = 0;
    ll num = 1;
    for (ll i = 2; i <= 17; i++) {
        if (n / (ll)pow(10, i - 1) != 0)
            num = i;
    }
    ans += (num - 1) * 9;
    ll num2 = n % (ll)pow(10, num - 1);

    if (num2 == ((ll)pow(10, num - 1) - 1))
        ans += n / (ll)pow(10, num - 1);
    else
        ans += n / (ll)pow(10, num -1) - 1;
    cout << ans << endl;
    return 0;
}

/*���C�u�����ő����*/
//���[�O���b�h�̌ݏ��@
int gcd(int x, int y) {
    int num[3];
    num[0] = (x > y) ? x : y;
    num[1] = (x <= y) ? x : y;
    num[2] = num[0] % num[1];

    while (num[2]) {
        num[0] = num[1];
        num[1] = num[2];
        num[2] = num[0] % num[1];
    }

    return num[1];
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < n; i++)
#define rep2(i, x, n) for(int i = x; i <= n; i++)
#define rep3(i, x, n) for(int i = x; i >= n; i--)
#define elif else if
#define sp(x) fixed << setprecision(x)
#define pb push_back
#define eb emplace_back
#define all(x) x.begin(), x.end()
#define sz(x) (int)x.size()
using ll = long long;
using ld = long double;
using pii = pair<int, int>;
using pil = pair<int, ll>;
using pli = pair<ll, int>;
using pll = pair<ll, ll>;
const ll MOD = 1e9+7;
//const ll MOD = 998244353;
const int inf = (1<<30)-1;
const ll INF = (1LL<<60)-1;
const ld EPS = 1e-10;
template<typename T> bool chmax(T &x, const T &y) {return (x < y)? (x = y, true) : false;};
template<typename T> bool chmin(T &x, const T &y) {return (x > y)? (x = y, true) : false;};

int main(){
    int X;
    cin >> X;
    cout << (X >= 30? "Yes" : "No") << endl;
}

Measured memory_bytes: 3528
import sys
input = sys.stdin.readline
n, m = map(int, input().split())
sc = [list(map(int, input().split())) for _ in range(m)]

f = 1
d = [0 for i in range(n)]
for s, c in sc:
    s -= 1
    if s == 0 and c == 0 and n > 1:
        f = 0
        break
    if s > n-1:
        f = 0
        break
    if d[s] == 0:
        d[s] = c
    else:
        if d[s] != c:
            f = 0
            break

if f:
    ans = [str(x) for x in d]
    f2 = n - 1
    for i in range(n):
        if f2 and ans[i] == "0":
            ans[i] = "1"
        f2 = 0
    print("".join(ans))
else:
    print(-1)


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

using namespace std;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int N, M;
  cin >> N >> M;
  vector<vector<int>> G(N + 1);
  vector<int> PC(N + 1, 0);
  for (int i = 0; i < N + M - 1; i++) {
    int a, b;
    cin >> a >> b;
    G[a].emplace_back(b);
    PC[b]++;
  }
  vector<int> P(N + 1);
  queue<int> que;
  for (int i = 1; i < N + 1; i++) {
    if (PC[i] == 0) {
      que.push(i);
      P[i] = 0;
      break;
    }
  }
  while (!que.empty()) {
    int u = que.front();
    que.pop();
    for (int v : G[u]) {
      if (PC[v] > 1) {
        PC[v]--;
      } else {
        P[v] = u;
        que.push(v);
      }
    }
  }
  for (int i = 1; i < N + 1; i++) {
    cout << P[i] << '\n';
  }
  return 0;
}


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

#define FOR(i,l,r) for(int i = (int) (l);i < (int) (r);i++)
#define ALL(x) x.begin(),x.end()
template<typename T> bool chmax(T& a,const T& b){ return a < b ? (a = b,true) : false; }
template<typename T> bool chmin(T& a,const T& b){ return b < a ? (a = b,true) : false; }
typedef long long ll;

int N;
list<int> edges [100000];

int dfs(int curr)
{
	vector<int> v;
	for(const auto& it : edges [curr]){
		v.push_back(dfs(it));
	}
	sort(ALL(v),greater<int>());
	int res = 0;
	FOR(i,0,v.size()){
		chmax(res,v [i] + i + 1);
	}
	return res;
}

int main()
{
	scanf("%d",&N);
	vector<int> A(N);
	FOR(i,1,N){
		scanf("%d",&A [i]);
		edges [A [i] - 1].push_back(i);
	}

	printf("%d\n",dfs(0));

	return 0;
}


Measured memory_bytes: 13184
#include <bits/stdc++.h>
using namespace std;
int main()
{
    int h,i,n;;
    cin>>h>>n;
    int A[n];
    for(i=0;i<n;i++)
    {
        cin>>A[i];
        h=h-A[i];
    }
    if(h<=0)
        cout<<"Yes";
    else
        cout<<"No";
}


Measured memory_bytes: 768
package main
import(
  "fmt"
)
func main(){
  var k, n, i, b, max int
  ans:=0
  fmt.Scan(&k, &n)
  a:=make([]int, n)
  for i=0;i<n;i++{
    fmt.Scan(&a[i])
    if i==1{
      max=a[1]-a[0]
    }
    if i!=0{
      b=a[i]-a[i-1]
      ans+=b
      if max<b{
        max=b
      }
    }
  }
  b=k-a[n-1]+a[0]
  ans+=b
  if max<b{
    ans-=b
  }else{
    ans-=max
  }
  fmt.Println(ans)
}


Measured memory_bytes: 5504
#include<stdio.h>
#include<iostream>
#include<vector>
#include<math.h>
#include<queue>
#include<map>
#include<algorithm>
#include<string.h>
#include<functional>
#include<limits.h>
#include<stdlib.h>
#include<cmath>
#include<cstring>
#include<set>
#include<climits>
#include<deque>
#include <iomanip>
#include<utility>
using namespace std;

#define intmax INT_MAX
#define lmax LONG_MAX
#define uintmax UINT_MAX
#define ulmax ULONG_MAX
#define llmax LLONG_MAX
#define ll long long
#define rep(i,a,N) for((i)=(a);(i)<(N);(i)++)
#define rrp(i,N,a) for((i)=(N)-1;(i)>=(a);(i)--)
#define llfor ll i,j
#define sc(a) cin>>a
#define pr(a) cout<<a<<endl
#define pY puts("YES")
#define pN puts("NO")
#define py puts("Yes")
#define pn puts("No")
#define pnn printf("\n")
#define all(a) a.begin(),a.end()
#define push(a,b) (a).push_back(b)
#define llvec vector<vector<ll>>
#define charvec vector<vector<char>>
#define size(a,b) (a,vector<ll>(b))
#define llpvec vector<pair<ll,ll>>
#define S 21 
llfor;ll mod=1000000007;
/*pi*/double pi=acos(-1);
/*繰り上げ除算*/ll cei(ll x,ll y){ll ans=x/y;if(x%y!=0)ans++;return ans;}
/*最大公約数*/ll gcd(ll x,ll y){return y?gcd(y,x%y):x;}
/*最小公倍数*/ll lcm(ll x,ll y){return x/gcd(x,y)*y;}
/*n乗*/ll llpow(ll x,ll n){ll ans=1;rep(i,0,n){ans*=x;ans%=mod;}return ans;}
/*階乗*/ll fact(ll x){ll ans=1;rep(i,0,x)ans*=(x-i);return ans;}
/*nCr*/ll ncr(ll n,ll r){return fact(n)*fact(n-r)/fact(r);}
/*nPr*/ll npr(ll n,ll r){return fact(n)/fact(n-r);}
/*primejudge*/bool prime(ll a){if(a<=1)return false;for(i=2;i*i<=a;i++){if(a%i==0)return false;}return true;}
/*Fibonacci数列*/ll fib(ll x){ll fibo[x+10];fibo[0]=1;fibo[1]=1;fibo[2]=1;rep(i,3,x+1)fibo[i]=fibo[i-1]+fibo[i-2];return fibo[x];}
/*桁数*/ll dig(ll n){ll d=1,tmp=n;while(tmp/10>0){tmp/=10;d++;}return d;}
/*行列のコピー*/void matcpy(ll a[S][S],ll b[S][S]){ll t=i;rep(i,0,S)rep(j,0,S)b[i][j]=a[i][j];/*(aをbに)*/i=t;}
/*行列のリセット*/void matrst(ll a[S][S]){ll t=i;rep(i,0,S)rep(j,0,S)a[i][j]=0;i=t;}
/*行列の2乗*/void matpow(ll a[S][S]){ll ans[S][S];matrst(ans);ll t=i,k;rep(i,0,S)rep(j,0,S)rep(k,0,S)ans[i][j]+=a[i][k]*a[k][j];matcpy(ans,a);i=t;}
/*行列の乗算*/void matmul(ll a[S][S],ll b[S][S], ll as[S][S]){ll t=i,k;matrst(as);rep(i,0,S)rep(j,0,S)rep(k,0,S)as[i][j]+=a[i][k]*b[k][j];i=t;}
//ll ans=0;
////////////////////////////////////////////////////////////
int main(){
 ll a,b;
 cin>>a>>b;
 ll x=dig(b);
 a*=llpow(10,x);
 ll n=a+b;
 ll y=sqrt(n);
 if(y*y==n)py; 
 else pn;
 //cout<<n<<" "<<y<<endl;
return 0;}

Measured memory_bytes: 3656
#include <bits/stdc++.h>
using namespace std;
typedef pair<int, int> pii;
typedef long long ll;
const int N = 2000010;
const int oo = 1e9;

int h , w, freq[200];
string k;
int main() {
	//freopen("input.txt", "r", stdin);
	cin >> h >> w;
	for (int i = 0; i < h; ++i) {
		cin >> k;
		for (int j = 0 ; j < k.size(); j++)
			freq[k[j] - 'a']++;
	}

	int needFour = (h / 2) * (w / 2);
	for (int i = 'a'; i <= 'z'; ++i) {
		while (freq[i - 'a'] >= 4 && needFour) {
			freq[i - 'a'] -= 4;
			needFour--;
		}
	}
	if (!needFour) {
		int needTwo = ((h % 2 == 1) ? w / 2 : 0 ) + ((w % 2 == 1) ? h / 2 : 0);
		for (int i = 'a'; i <= 'z'; ++i) {
			while (freq[i - 'a'] >= 2 && needTwo) {
				freq[i - 'a'] -= 2;
				needTwo--;
			}
		}
		if(!needTwo){
			puts("Yes");
			return 0;	
		}
	}
	puts("No");
	return 0;
}

Measured memory_bytes: 256
// </> : towhid1zaman

#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;typedef vector<ll> vll;
#define fill(a) memset(a, 0, sizeof (a))
#define all(v) (v).begin(),(v).end()
#define sp(k) cout<<setprecision(k)<<fixed;
#define rep(i,a) for(int i=0; i<a;i++)
#define rep1(i,a,b) for(int i=(a);i<=(b);++i)
#define irep(i,b,a) for(int i=(b);i>=(a);--i)
#define minv(v) *min_element(v.begin(),v.end())
#define maxv(v) *max_element(v.begin(),v.end())
#define each(it,s) for(auto it = s.begin(); it != s.end(); ++it)
#define unq(v) sort(all(v)),(v).erase(unique((v).begin(),(v).end()),(v).end())
#define _ios ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
#define sqr(a) ((a)*(a))
#define sz(a) int(a.size())
#define ff first
#define ss second
#define pb push_back
#define inf (1<<29)

const double pi = acos(-1.0);
const int mod = 1000000007; // (int)1e9+7
const int maxn = 2000100;

int main(){
        _ios;
        int a,b; cin >> a >> b;
        string A = "Alice";
        string B = "Bob";
        if(a==b){
            cout<<"Draw"<<endl;
            return 0;
        }
        if(a>b and b==1){
            cout<<B<<endl;
            return 0;
        }
        if(a<b and a==1){
            cout<<A<<endl;
            return 0;
        }
        if(a<b){
            cout<<B<<endl;
            return 0;
        }
        else cout<<A<<endl;




return 0;
}



Measured memory_bytes: 256
use std::cmp;
use std::collections::HashMap;
use std::collections::VecDeque;
use std::io::Read;
use std::usize::MAX;

macro_rules! input {(source = $s:expr, $($r:tt)*) => {let mut iter = $s.split_whitespace();let mut next = || { iter.next().unwrap() };input_inner!{next, $($r)*}};($($r:tt)*) => {let stdin = std::io::stdin();let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));let mut next = move || -> String{bytes.by_ref().map(|r|r.unwrap() as char).skip_while(|c|c.is_whitespace()).take_while(|c|!c.is_whitespace()).collect()};input_inner!{next, $($r)*}};}
macro_rules! input_inner {($next:expr) => {};($next:expr, ) => {};($next:expr, $var:ident : $t:tt $($r:tt)*) => {let $var = read_value!($next, $t);input_inner!{$next $($r)*}};}
macro_rules! read_value {($next:expr, ( $($t:tt),* )) => {( $(read_value!($next, $t)),* )};($next:expr, [ $t:tt ; $len:expr ]) => {(0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()};($next:expr, chars) => {read_value!($next, String).chars().collect::<Vec<char>>()};($next:expr, usize1) => {read_value!($next, usize) - 1};($next:expr, [ $t:tt ]) => {{let len = read_value!($next, usize);(0..len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()}};($next:expr, $t:ty) => {$next().parse::<$t>().expect("Parse error")};}

fn solve() {
    input! {
        n: usize,
        k: usize,
        c: usize,
        s: chars
    }

    let mut left_greed = vec![0; s.len()];
    let mut right_greed = vec![0; s.len()];

    // left
    let mut index = 0;
    let mut work_count = 1;
    while index < s.len() && work_count < (k + 1) {
        if s[index] == 'o' {
            left_greed[index] = work_count;
            work_count += 1;
            index += c;
        }
        index += 1;
    }

    // right
    let mut index = s.len() - 1;
    work_count -= 1;
    while index >= c && work_count > 1 {
        if s[index] == 'o' {
            right_greed[index] = work_count;
            work_count -= 1;
            index -= c;
        }
        index -= 1;
    }
    if s[index] == 'o' {
        right_greed[index] = work_count;
    }

    //println!("{:?} {:?}", left_greed, right_greed);

    for i in 0..s.len() {
        if left_greed[i] == right_greed[i] && left_greed[i] > 0 {
            println!("{}", i + 1);
        }
    }
    let mut ans = 0;
}

fn main() {
    let thd = std::thread::Builder::new().stack_size(104_857_600);
    thd.spawn(|| solve()).unwrap().join().unwrap();

    /*
    // 入力を一括で読み込む場合
    let mut buf = String::new();
    std::io::stdin().read_to_string(&mut buf).unwrap();
    let mut input = buf.split_whitespace();

    // inputに対しnext()で読み込んでいく
    let q: usize = input.next().unwrap().parse().unwrap();
    */
}

const LARGE_PRIME: u64 = 1_000_000_007;

// @〜でsnippet


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

#define PI 3.14159265359
#define INF 1e9
#define LINF 1e18
#define IMOD 1000000007 
#define irep(i,n) for(int  i = 0; i < n; i++)
#define irep2(i,a,n) for(int i = a; i <= n; i++)
#define lrep(i,n) for(long long  i = 0; i < n; i++)
#define lrep2(i,a,n) for(long long i = a; i <= n; i++)

typedef long long ll;
typedef std::vector<char> v_char;
typedef std::vector<double> v_double;
typedef std::vector<std::vector<double> > v2_double;
typedef std::vector<int> v_int;
typedef std::vector<std::vector<int> > v2_int;
typedef std::vector<ll> v_ll;
typedef std::vector<std::vector<ll> > v2_ll;
typedef std::vector<std::string> v_string;
typedef std::vector<std::vector<std::string> > v2_string;
typedef std::vector<bool> v_bool;
typedef std::vector<std::vector<bool> > v2_bool;
typedef std::pair<ll, ll> pll;
typedef std::pair<int, int> pii;

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

using namespace std;

int main(void)
{
    int n;
    cin >> n;
    ll ans = 0;

    irep(i, n) {
        int a = i+1;
        if(a % 3 != 0 && a % 5 != 0) {
            ans += a;
        }
    }

    cout << ans << endl;
    return 0;
}
/** atcoder **/


Measured memory_bytes: 3628
n,m=map(int,input().split())
a=list(map(int,input().split()))
bc=[list(map(int, input().split())) for _ in range(m)]

sorted_ab=sorted(bc, reverse=True, key=lambda x: x[1])
new_ab=[]
ans=[]

for i in range(m):
    if len(new_ab)<=n:
        tmp_l=[sorted_ab[i][1]]*sorted_ab[i][0]
        new_ab+=tmp_l
    else:
        break

final_list=a+new_ab
final_list.sort(reverse=True)
print(sum(final_list[:n]))

Measured memory_bytes: 38976
import sys
#sys.stdin=open("data.txt")
input=sys.stdin.readline
mii=lambda:map(int,input().split())

n=int(input())
a=list(mii())
b=list(mii())

need=0
ans=0
helper=[]
for i in range(n):
    if a[i]>=b[i]:
        helper.append(a[i]-b[i])
    else:
        need+=b[i]-a[i]
        ans+=1

helper.sort()
while need>0 and helper:
    need-=helper[-1]
    helper.pop(-1)
    ans+=1

if need>0: print(-1)
else: print(ans)


Measured memory_bytes: 18532
import sys

char = list(input())
if char[0] != 'A':
  print('WA')
  sys.exit()

count = 0
idx_C = 0
for i, x in enumerate(char[2:len(char) - 1]):
  if x == 'C':
    count += 1
    idx_C = i + 2

if count != 1:
  print('WA')
  sys.exit()

for i, x in enumerate(char):
  if i != 0 and i != idx_C and x.isupper():
    print('WA')
    sys.exit()
  
print('AC')


Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define MOD 1000000007
#define INF 1e9
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define all(x) (x).begin(),(x).end()

int main() {
    string s;
    cin>>s;
    if(s[2]==s[3] && s[4]==s[5]) cout<<"Yes"<<endl;
    else cout<<"No"<<endl;

}

Measured memory_bytes: 256
import java.io.IOException;
import java.util.LinkedList;
import java.util.List;
import java.util.ListIterator;
import java.util.Scanner;
import java.util.TreeMap;
 
 
public class Main{
	public static class File{
		int identifer;
		long start;
		long size;
		
		public File(int identifer, long start, long size) {
			super();
			this.identifer = identifer;
			this.start = start;
			this.size = size;
		}
		
		public String toString(){
			return this.identifer + " " + this.start + "->" + (this.start + this.size - 1);
		}
	}
	
    public static void main(String[] args) throws IOException {
    	Scanner sc = new Scanner(System.in);
    	
    	while(true){
    		final int N = sc.nextInt();
    		
    		if(N == 0){
    			break;
    		}
    		
    		LinkedList<File> files = new LinkedList<File>();
    		
    		for(int i = 0; i < N; i++){
    			String ops = sc.next();
    			
    			//System.out.println(files);
    			
    			if("W".equals(ops)){
    				final int l = sc.nextInt();
    				final int S = sc.nextInt();
    				
    				long rest = S;
    				long pos = 0;
    				for(ListIterator<File> iter = files.listIterator(); iter.hasNext(); ){
    					File file = iter.next();
    					
    					if(pos < file.start){
    						iter.previous();
    						final long size = Math.min(rest, file.start - pos);
    						iter.add(new File(l, pos, size));
    						rest -= size;
    						iter.next();
    					}
    					
    					if(rest <= 0){
    						break;
    					}
    					
    					pos = file.start + file.size;
    				}
    				
    				if(rest > 0){
    					files.add(new File(l, pos, rest));
    				}
    				
    			}else if("D".equals(ops)){
    				final int l = sc.nextInt();
    				
    				for(ListIterator<File> iter = files.listIterator(); iter.hasNext(); ){
    					File file = iter.next();
    					
    					if(file.identifer == l){
    						iter.remove();
    					}
    				}
    				
    			}else if("R".equals(ops)){
    				final int P = sc.nextInt();
    				
    				boolean found = false;
    				for(ListIterator<File> iter = files.listIterator(); iter.hasNext(); ){
    					File file = iter.next();
    					
    					if(file.start <= P && P < file.start + file.size){
    						System.out.println(file.identifer);
    						found = true;
    						break;
    					}else if(file.start > P){
    						break;
    					}
    				}
    				
    				if(!found){
    					System.out.println(-1);
    				}
    			}
    		}
    		
    		System.out.println();
    		
    	}
    	
    	
    	
    }
     
}

Measured memory_bytes: 65728
#include <stdio.h>
 int main() {
   int n;
   float tab[100];
   float som=0;
   scanf("%d",&n);
   for (int i = 0; i < n; i++) {
     scanf("%f",&tab[i]);
     som+=1/tab[i];
   }
   printf("%f",1/som);
   return 0;
 }


Measured memory_bytes: 128
import java.util.Arrays;
import java.util.HashMap;
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        // KEYENCE-B - Robot Arms

        Scanner sc = new Scanner(System.in);

        int n = sc.nextInt();

        int[] x = new int[n];
        int[] l = new int[n];

        HashMap<Integer,Integer> map = new HashMap<>();

        int p = 0;
        int cnt = 0;
        int max = 0;

        for (int i = 0; i < n; i++) {
            x[i] = sc.nextInt();
            l[i] = sc.nextInt();
            map.put(x[i],l[i]);
            if (max < x[i]) max = x[i];

        }

        Arrays.sort(x);

        for (int i = 0; i < n; i++) {
            if (cnt == 0 ||
                x[i] - map.get(x[i]) >= p + map.get(p)) {
                p = x[i];
                cnt++;
            } else if (p + map.get(p) > x[i] + map.get(x[i])) {
                p = x[i];
            }
        }

        System.out.println(cnt);
    }
}

Measured memory_bytes: 99328
#include<bits/stdc++.h>
using namespace std;
#define MOD 1000000007
#define rep(i,n) for(int i=0;i<n;++i)
typedef long long ll;
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;}

int main(){
   string s;
   cin >> s;
   bool ok=true;
   rep(i,s.length()){
      if((1+i)%2) {
         if(s[i]== 'L') ok = false;
      }
      else{
         if(s[i] ==  'R') ok =false;
      }
   }
   if(ok)cout << "Yes" << endl;
   else cout << "No" << endl;
   return 0;
}


Measured memory_bytes: 256
def solve(N, Xs):
    low = min(Xs)
    high = max(Xs)
    ans = sum([x**2 for x in Xs])

    for p in range(low, high + 1):
        cost = 0
        for x in Xs:
            cost += (x - p) ** 2
        ans = min(ans, cost)
    return ans

if __name__ == "__main__":
    N = int(input())
    Xs = list(map(int, input().split(" ")))
    print(solve(N, Xs))


Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
int main()
{
   long long a,b,c,st=0,op=0,ct=0;
   vector<long long>vc;
   cin>>a;
   while(a--)
   {
       cin>>b;
       vc.push_back(b);
       if(b%2==1)
        st=1;


   }
   if(st==1)
    cout<<op;
   else
   {
       while(1)
       {
           ct=0;
          for(long long i=0;i<=vc.size();i++)
       {

       //
         if(vc[i]%2==1)
         {cout<<op;
         st=1;
         break;


         }
         else
         {
             vc[i]=vc[i]/2;
             ct++;
         }


         if(ct==vc.size())
         op++;

       }
       if(st==1)
            break;
       }

   }
}


Measured memory_bytes: 256