akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
using uint = unsigned int;
using ll = long long;
using ull = unsigned long long;

#define FOR(i,a,b) for (int i = a; i < b; ++i)
#define FORR(i,a,b) for (int i = b - 1; i >= a; --i)
#define REP(i,n) FOR(i,0,n)
#define REPR(i,n) FORR(i,0,n)

int main() {
	ll N;
	cin >> N;
	vector<ll> A(N);
	ll sum = 0;
	vector<ll> cnt(100001);
	REP(i, N) {
		cin >> A[i];
		cnt[A[i]] += 1;
		sum += A[i];
	}

	ll Q;
	cin >> Q;
	ll B, C;
	REP(i, Q) {
		cin >> B >> C;
		sum += (C - B) * cnt[B];
		cnt[C] += cnt[B];
		cnt[B] = 0;
		cout << sum << endl;
	}

	return 0;
}

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

#define deb(x) cout << #x << " " << x << "\n";
#define fo(i, n) for(int i=0; i<n; i++)
#define Fo(i, k, n) for(i=k; i<n; i++)
#define endl "\n"
#define ll long long
#define vi vector<int>

// memset(arr, value, size);

int main() {
#ifndef ONLINE_JUDGE
	freopen("input1.txt", "r", stdin);
	freopen("output1.txt", "w", stdout);
#endif
	ios::sync_with_stdio(0);
	cin.tie(0);

	int n, r = 0, ans;
	string s;
	cin >> n >> s;
	for (char c : s)
		if (c == 'R')
			r++;
	ans = r;
	for (int i = 0; i < ans; i++)
		if (s[i] == 'W')
			r--;
	cout << (ans - r);

	return 0;
}

Measured memory_bytes: 3728
#include<bits/stdc++.h>
using namespace std;
#define LL long long
int main()
{
	LL ans=0;
	int n;
	scanf("%d",&n);
	for(int i=1;i<n;i++)
	ans+=(n-1-i)/i+1;
	printf("%lld",ans);
}


Measured memory_bytes: 3824
import sys

read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
MOD = 1000000007


def main():
    N, *D = map(int, read().split())

    ans = 0
    for i in range(N):
        for j in range(i + 1, N):
            ans += D[i] * D[j]

    print(ans)
    return


if __name__ == '__main__':
    main()


Measured memory_bytes: 62968
#include <bits/stdc++.h>
#define sc1(a) scanf("%d",&a)
#define sc2(a,b) scanf("%d%d",&a,&b)
#define sc3(a,b,c) scanf("%d%d%d",&a,&b,&c)
#define sc4(a,b,c,d) scanf("%d%d%d%d",&a,&b,&c,&d)
using namespace std;
typedef long long LL;
int gcd(int a,int b){if (b == 0) return a; return gcd(b , a%b);}
int lcm(int a, int b){ return a/gcd(a,b)*b;}
inline int read(){
    int x=0,f=1;char ch=getchar();
    while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
    while(ch>='0'&&ch<='9'){x=(x<<3)+(x<<1)+(ch^48); ch=getchar();}
    return x*f;
}
int main(){
    int n,k;
    sc2(n, k);
    if (n % k == 0) cout << 0 << endl;
    else cout << 1 << endl;
    return 0;
}



Measured memory_bytes: 256
package main

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

func main() {
	sc = initScanner(os.Stdin)
	a, b := scanString(sc), scanString(sc)
	fmt.Println(resolve(a, b))
}

func resolve(a, b string) string {
	// 桁数で判定
	if len(a) > len(b) {
		return "GREATER"
	} else if len(a) < len(b) {
		return "LESS"
	}

	// 桁が同じであれば, 高位の値から比較
	as := strings.Split(a, "")
	bs := strings.Split(b, "")

	for i := 0; i < len(a); i++ {
		if as[i] > bs[i] {
			return "GREATER"
		} else if as[i] < bs[i] {
			return "LESS"
		}
	}
	return "EQUAL"
}

// --------------- BASE DEFINITIONS ---------------

const (
	initialBufSize = 100000
	maxBufSize     = 1000000
)

var sc *bufio.Scanner

func initScanner(r io.Reader) *bufio.Scanner {
	buf := make([]byte, initialBufSize)

	sc := bufio.NewScanner(r)
	sc.Buffer(buf, maxBufSize)
	sc.Split(bufio.ScanWords)
	return sc
}

func scanInt(sc *bufio.Scanner) int {
	sc.Scan()
	i, _ := strconv.Atoi(sc.Text())
	return i
}

func scanIntSlice(sc *bufio.Scanner, n int) []int {
	is := make([]int, n)
	for i := 0; i < n; i++ {
		is[i] = scanInt(sc)
	}

	return is
}

func scanString(sc *bufio.Scanner) string {
	sc.Scan()
	return sc.Text()
}

func scanStringSlice(sc *bufio.Scanner, n int) []string {
	ss := make([]string, n)
	for i := 0; i < n; i++ {
		sc.Scan()
		ss[i] = sc.Text()
	}

	return ss
}


Measured memory_bytes: 1788
import scala.io.StdIn._

object Main extends App {

  val arr = readLine().split(" ").map(_.toInt)
  val n = arr(0)
  val l = arr(1)
  val ajiArr: Array[Int] = Array.fill(n)(0)
  for(i <- 0 until n){ ajiArr(i) = l + i }
  val removedOne = if(ajiArr.contains(0)) 0
    else ajiArr(n-1) match {
      case i if i <  0 => i
      case _           => ajiArr(0)
    }
  val result = ajiArr.sum - removedOne
  println(result)
}

Measured memory_bytes: 25624
var
	i,ans,n,p,c:int64;
	j:Longint;
begin
	read(n,p);
	if n=1 then begin
		writeln(p);
		exit;
	end;
	i:=2;
	ans:=1;
	while i*i<=p do begin
		c:=0;
		while p mod i=0 do begin
			p:=p div i;
			inc(c);
		end;
		for j:=1 to c div n do ans:=ans*i;
		inc(i);
	end;
	writeln(ans);
end.


Measured memory_bytes: 128
#include <stdio.h>
#include <string.h>
#include <math.h>
#include <stdlib.h>
#include <limits.h>
#include <stdbool.h>

#define rep(i, n) for(int i=0; i<(n); ++i)
#define max  200001

//qsort(str, n, sizeof(int), up_comp);
int up_comp(const void *a, const void *b){return *(int*)a - *(int*)b;}
int down_comp(const void *a, const void *b){return *(int*)b - *(int*)a;}
int int_sort( const void * a , const void * b ) {return strcmp(( char * )a , ( char * )b );}
int count_digit(int a){int i=0;while(a!=0){a=a/10;i++;}return i;}
int euclid( int a, int b ){int temp;if(a<b){temp=a;a=b;b=temp;}if(b<1)return -1;if(a%b==0) return b;return euclid(b,a%b);}

int main(void){
 
    int n ,t, a;
    int h[max];
    int tmp=0, min=INT_MAX, ans;
    
    scanf("%d%d%d", &n, &t, &a);
    rep(i, n){
        scanf("%d", &h[i]);
        tmp=1000*t-h[i]*6;
        if (min>abs(tmp-a*1000)) {
            min=abs(tmp-a*1000);
            ans=i+1;
        }
    }
    
    printf("%d\n", ans);
    
    return 0;
}


Measured memory_bytes: 1740
#include<stdio.h>
#include<math.h>
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<complex>

#define rep(i,n) for(int i=0; i<n; i++)
#define rep1(i,n) for(int i=1; i<n+1; i++)
#define repr(i,n) for(int i=n-1; i>=0; i--)
typedef long long ll;

using namespace std;
const int V = 100005;
int INF = 1000000000;
int rec[100][100];

int main(){

int w,h,n;
cin >> w >> h >> n;
rep(i,n){
  int x,y,a;
  cin >> x >> y >> a;
  if (a == 1)rep(v,h)for(int xt = 0; xt<x; xt++)rec[xt][v] = 1;
  if (a == 2)rep(v,h)for(int xt = x; xt<w; xt++)rec[xt][v] = 1;
  if (a == 3)rep(xt,w)for(int v = 0; v<y; v++)rec[xt][v] = 1;
  if (a == 4)rep(xt,w)for(int v = y; v<h; v++)rec[xt][v] = 1;
}

int cnt = 0;

rep(i,w)rep(j,h)if(rec[i][j] ==0)cnt++;
cout << cnt << endl;


}


Measured memory_bytes: 256
#include <stdio.h>

#define MAX 50000000

int parent(int i) {return i / 2;}
int left(int i) {return 2*i;}
int right(int i){return 2*i + 1;}
int H;
int A[MAX];

void maxHeap(int idx){
    int l = left(idx);
    int r = right(idx);
    int large;
    if(l <= H && A[idx] < A[l]){
        large = l;
    } else {
        large = idx;
    }

    if(r <= H && A[large] < A[r]){
        large = r;
    }

    if(large != idx){
        int tmp = A[idx];
        A[idx] = A[large];
        A[large] = tmp;
        maxHeap(large);
    }

}

void exec(){
    for(int i = H/2; i >= 1; i--) maxHeap(i);
}

int main(){
    int i;
    scanf("%d", &H);
    for(i = 1; i <= H; i++){
        scanf("%d", &A[i]);
    }

    exec();

    for(i = 1; i <= H; i++){
        printf(" %d", A[i]);
    }

    printf("\n");

    return 0;
}



Measured memory_bytes: 3664
#include<iostream>
#include<cstring>
#include<cstdio>
#include<vector>
#include<algorithm>
#include<queue>
#include<string>
#include<map>
#include<set>
using namespace std;
typedef pair<int,int> P;
typedef pair<int,P> PP;
#define F first
#define S second
#define INF (10000000)
int N;
int X[100001];
int Y[100001];
int mp[]={1,-1,1,-1};
int mm[]={1,1,-1,-1};
int Used[100001];
priority_queue<P> Q[3][4];
inline int ab(int a){ return a>0?a:-a; }
int getk(int id1,int id2){
  return ab(X[id1] - X[id2]) + ab(Y[id1] - Y[id2]);
}
PP max_point(int id1,int id2){
  if(Q[id1][0].empty()) return PP(-1,P(-1,-1));
  if(Q[id2][0].empty()) return PP(-1,P(-1,-1));
  PP ret = PP(getk( Q[id1][0].top().S, Q[id2][3].top().S), 
	      P(Q[id1][0].top().S, Q[id2][3].top().S));
  ret = max( ret, PP(getk( Q[id1][1].top().S, Q[id2][2].top().S),
		     P(Q[id1][1].top().S, Q[id2][2].top().S)) );
  ret = max( ret, PP(getk( Q[id1][2].top().S, Q[id2][1].top().S),
		     P(Q[id1][2].top().S, Q[id2][1].top().S)) );
  ret = max( ret, PP(getk( Q[id1][3].top().S, Q[id2][0].top().S),
		     P(Q[id1][3].top().S, Q[id2][0].top().S)) );
  return ret;
}
int max_point_s(int id,int A){
  if(Q[id][0].empty()) return -1;
  int ret = 1;
  for(int i=0;i<2;i++)
    ret = max( ret, getk(Q[id][i].top().S,A));
  return ret;
}
void deleted_point(){
  for(int i=0;i<4;i++){
    while( !Q[0][i].empty() && Used[Q[0][i].top().S] ) Q[0][i].pop();
  }
}
int main(){
  scanf("%d",&N);
  for(int i=0;i<N;i++){
    scanf("%d %d",&X[i],&Y[i]);
    for(int j=0;j<4;j++){
      Q[0][j].push(P(mp[j]*X[i]+mm[j]*Y[i],i));
    }
  }  

  while( !Q[0][0].empty() ){
    PP h = max_point(0,0);
    PP p1 = max_point(0,1);
    PP p2 = max_point(0,2);
    if ( h.F > p1.F && h.F > p2.F ){
      int p1m = max( max_point_s(1,h.S.F), max_point_s(2,h.S.S));
      /*max ( max( max_point(1,1).F, max_point_s(1,h.S.F) ),
	max( max_point(2,2).F, max_point_s(2,h.S.S) ) );
      */
      int p2m = max( max_point_s(1,h.S.S), max_point_s(2,h.S.F));
      /*max ( max( max_point(1,1).F, max_point_s(1,h.S.S) ),
	max( max_point(2,2).F, max_point_s(2,h.S.F) ) );  
      */
      Used[h.S.F]=1;
      Used[h.S.S]=1;
      if( p1m > p2m ){
	for(int i=0;i<4;i++){
	  Q[1][i].push( P(mp[i]*X[h.S.S]+mm[i]*Y[h.S.S],h.S.S) );
	  Q[2][i].push( P(mp[i]*X[h.S.F]+mm[i]*Y[h.S.F],h.S.F) );
	}
      } else {
	for(int i=0;i<4;i++){
	  Q[2][i].push( P(mp[i]*X[h.S.S]+mm[i]*Y[h.S.S],h.S.S) );
	  Q[1][i].push( P(mp[i]*X[h.S.F]+mm[i]*Y[h.S.F],h.S.F) );
	}
      }
    } else if( p1 > p2){
      Used[ p1.S.F ] = 1;
      for(int i=0;i<4;i++)
	Q[2][i].push( P(mp[i]*X[p1.S.F]+mm[i]*Y[p1.S.F],p1.S.F) );
    } else {
      Used[ p2.S.F ] = 1;
      for(int i=0;i<4;i++)
	Q[1][i].push( P(mp[i]*X[p2.S.F]+mm[i]*Y[p2.S.F],p2.S.F) );
    }
    deleted_point();
  }
  printf("%d\n",max( max_point(1,1).F, max_point(2,2).F ) );
}

Measured memory_bytes: 9800
#include <iostream>
#include <cmath>
#include <algorithm>
#include <bitset>
#include <iomanip>
#include <cstdio>
#include <new>
#include <vector>
#include <cstdlib>
#include <string>
#include <set>

using namespace std;

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

    int size = S.size();
    int ans = 0;

   

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

    cout << ans << endl;
}


Measured memory_bytes: 3836
def solve_c(n, s):
    res = 1
    for i in range(1, n):
        if s[i] != s[i - 1]:
            res += 1
    return res


def main():
    n = int(input())
    s = input()
    res = solve_c(n, s)
    print(res)


def test():
    assert solve_c(10, "aabbbbaaca") == 5
    assert solve_c(5, "aaaaa") == 1
    assert solve_c(20, "xxzaffeeeeddfkkkkllq") == 10


if __name__ == "__main__":
    test()
    main()


Measured memory_bytes: 3316
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MOD = 1000000007;
//cout << setprecision(20) << 

int main() {
    ll d, t, s; cin >> d >> t >> s;
    if (t * s >= d) cout << "Yes" << endl;
    else cout << "No" << endl;
}

Measured memory_bytes: 3592
def distinct_or_not():
    N=input()
    A_n=list(map(int,input().split()))
    list.sort(A_n)
    for i in range(len(A_n)-1):
        if A_n[i]==A_n[i+1]:
            print('NO')
            exit()
    print('YES')
distinct_or_not()

Measured memory_bytes: 25172
X = int(input())

if X == 1:
    print(0, -1)
    exit()

def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    # divisors.sort()
    return divisors

def solve(num, X):
    a = 1
    for i in range(1, X+1):
        if (i * 100) ** 5 - (i * 100 - num) ** 5 >= X:
            break
    max_a = 100 * i
    a = max_a - 99
    while a <= max_a:
        if (a) ** 5 - (a -num) ** 5 == X:
            return True, a, a - num
        a += 1
    return False, 0, 0

arr = make_divisors(abs(X))
for num in arr:
    if (num - X) % 5:
        continue
    flag, a, b = solve(num , X)
    if flag:
        print(a, b)
        exit()
    #flag, a, b = solve(-num , X)
    #if flag:
    #    print(a, b)
    #    exit()

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

using namespace std;

#define pb push_back

const int maxi = 1e6+10;

int a[maxi];
int n,k;
int d[maxi];

int main()
{
  cin>>n>>k;

  for (int i = 1;i<=n;i++)
    scanf("%d",&a[i]);

   for (int w = 1;w<=min(k, 300);w++)
   {
      for (int i= 1;i<=n;i++)
        d[i] = 0;

      for (int i=1;i<=n;i++){
        d[max(i-a[i],1)]++;
        d[min(n, i + a[i]) + 1]--;
      }

      for (int i = 1;i<=n;i++)
      {
          d[i]+=d[i-1];
          a[i] = d[i];
      }

   }

   for (int i = 1;i<=n;i++)
    printf("%d ", a[i]);
}
//Moj mali posao za Bari
//cekam da se vrati, donijece mi stvari
//a kad se vrati, pune se ormari
//svima da se hvalim, korzo da zapalim


Measured memory_bytes: 5360
A,B,K = map(int,input().split())
L = []
for i in range(K) :
    a = A+i
    b = B-i
    if a <= B :
        L.append(a)
    if b >= A :
        L.append(b)
L = list(set(L))
ANSWER = sorted(L)
for j in range(len(ANSWER)) :
    print(ANSWER[j])

    

Measured memory_bytes: 3060
import java.util.*;

public class Main {

  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int r = sc.nextInt();

    if (r < 1200) {
      System.out.println("ABC");
      return;
    }

    if (r < 2800) {
      System.out.println("ARC");
      return;
    }

    System.out.println("AGC");
    return;

  }
}


Measured memory_bytes: 21716
package main

import "fmt"

func main() {
	var r, c int
	fmt.Scanf("%d %d", &r, &c)
	sheet := make([][]int, r+1)
	for i := 0; i <= r; i++ {
		sheet[i] = make([]int, c+1)
	}

	for i := 0; i < r; i++ {
		for j := 0; j < c; j++ {
			fmt.Scanf("%d", &sheet[i][j])
			sheet[r][j] += sheet[i][j]
			sheet[i][c] += sheet[i][j]
			sheet[r][c] += sheet[i][j]
		}
	}

	for i := 0; i <= r; i++ {
		for j := 0; j <= c; j++ {
			fmt.Print(sheet[i][j])
			if j != c{
				fmt.Print(" ")
			}
		}
		fmt.Println("")
	}
}



Measured memory_bytes: 1824
#include <bits/stdc++.h>
#include <string>
#include <algorithm>
#include <string.h>
using namespace std;
 
int main(){
    
    string S;
    int K;
    cin >> S >> K ;

    for(int i=0;i<=(K-1);i++){
        if(i==(K-1)){
            cout << S[i] <<endl;
            return 0;
        }else if(S[i]!='1'){
            cout << S[i] << endl;
            return 0;
        }
    }

    return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

  public static void main(String[] args) {

    Scanner sc = new Scanner(System.in);

    int n = sc.nextInt();
    int m = sc.nextInt();
    int nl = sc.nextInt();
    int nr = sc.nextInt();

    for (int i = 1; i < m; i++) {
      int l = sc.nextInt();
      int r = sc.nextInt();
      nl = Math.max(nl, l);
      nr = Math.min(nr, r);
    }

    System.out.println(Math.max((nr - nl) + 1, 0));

  }
}

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

using namespace std;
using ll=long long;

int main()
{
    int n,k;cin >> n >> k;
    int a[n];
    set<int>q;
    for(int i=0;i<n;i++){
        cin >>a[i];
        q.insert(a[i]);
    }
    sort(a,a+n);
    vector<int >s;
    int sd=1;
    for(int i=1;i<n;i++){
        if(a[i]==a[i-1]){
            sd++;
          }
          else {
            s.push_back(sd);
            sd=1;
          }
          if(i==n-1){
            s.push_back(sd);
          }
    }
    sort(s.begin(),s.end());
    int c=q.size();
    int l=c-k;
    int ans=0;
    if(l<0){
            cout << 0 << endl;
            return 0;
    }
    else {
        for(int i=0;i<l;i++){
            ans+=s[i];
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 11516
#include <bits/stdc++.h>
using namespace std;
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}
template<class T> inline T sqr(T x) {return x*x;}
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long ll;
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(v, n) sort(v, v+n)
#define VSORT(v) sort(v.begin(), v.end())
#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define INF 999999999
const double EPS = 1e-10;
const double PI  = acos(-1.0);
#define CLR(a) memset((a), 0 ,sizeof(a))
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

int main(){

    int n;
    cin >>n;
    VI v(n);
    REP(i,n)cin >> v[i];
    VSORT(v);
    double tmp = v[0];
    REP(i,n-1){
        tmp = (double)((double)tmp + v[i+1])/2;
    }
    cout << tmp << 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>

#pragma GCC target ("avx2")
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")
#pragma comment(linker, "/stack:200000000")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")

using namespace std;
using namespace __gnu_pbds;

typedef unsigned long long ll;
typedef string str;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector <pii> vpii;
typedef vector <pll> vpll;
typedef map <str,int> mapsi;
typedef map <str,int> :: iterator mapsitr;
typedef map <int , int> mint;
typedef map <ll , ll> mll;
typedef set <int> si;
typedef set <ll> sll;
typedef si :: iterator sitr;
typedef si :: reverse_iterator rsitr;
typedef sll :: iterator sltr;
typedef sll :: reverse_iterator rsltr;
#define mset multiset

typedef mset <int> msi;
typedef mset <ll> msll;
typedef msi :: iterator msitr;
typedef msi :: reverse_iterator msritr;
typedef msll :: iterator msltr;
typedef msll :: reverse_iterator mslritr;

#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
#define mp make_pair
#define pb push_back
#define pob pop_back
#define pf push_front
#define pof pop_front
#define fi first
#define se second
#define fs first.second
#define ss second.second
#define ff first.first
#define sf second.first
#define newl '\n'
#define fbo find_by_order
#define ook order_of_key

char to_upper (char x){
    if( 97 <= int(x) && int(x) <= 122)return char(x-32);
    else if( 65 <= int(x) && int(x) <= 90)return x;
}
char to_lower (char x){
    if( 97 <= int(x) && int(x) <= 122)return x;
    else if( 65 <= int(x) && int(x) <= 90)return char(x+32);
}
int numerize (char x){
    if(48 <= int(x) && int(x) <= 57)return int(x-'0');
    else if( 97 <= int(x) && int(x) <= 122)return int(x-96);
    else if( 65 <= int(x) && int(x) <= 90)return int(x-64);
}
bool isect (int l1, int r1, int l2, int r2){
    pii p1,p2;
    p1 = mp(l1,r1); p2 = mp(l2,r2);
    if(p1>p2)swap(p1,p2);
    if(p2.fi <= p1.se)return true;
    else return false;
}
ll quickpow (ll num1, ll num2, ll MOD){
    if(num2==0)return 1;
    else if(num2==1)return num1;
    else{
        ll temp = quickpow (num1,num2/2,MOD); ll res = ((temp%MOD) * (temp%MOD))%MOD;
        if(num2%2==1) res = ((res%MOD)*(num1%MOD))%MOD; return res;
    }
}
ll invmod (ll num, ll MOD){return quickpow (num,MOD-2,MOD);}
ll gcd (ll num1, ll num2){
    if(num1 < num2) swap(num1,num2); ll num3 = num1 % num2 ;
    while(num3 > 0){ num1 = num2; num2 = num3; num3 = num1 % num2;}
    return num2;
}
ll lcm (ll num1 , ll num2){return (ll) (num1/__gcd(num1,num2))*num2;}
// end of Template
ll n,ans;
int main(){

//    freopen("input.txt", "r", stdin);
//    freopen("output.txt", "w", stdout);

    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);

    cin>>n;
    if(n%2) ans = 0;
    else{
        n/=10;
        ans += n;
        for(ll i = 5; i <= n; i*=5){
            ans += n/i;
        }
    }
    cout<<ans<<newl;

}



Measured memory_bytes: 384
// Author : Sarthak Kapoor
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace std;
using namespace __gnu_pbds;
#define rep(i,n) for(int i=0;i<n;++i)
#define repa(i,a,n) for(int i=a;i<n;++i)
#define repr(i,n) for(int i=n-1;i>=0;--i)
#define repba(i,b,a) for(int i=b;i>=a;--i)
#define repab(i,a,b) for(int i=a;i<b;++i)
#define ll long long
#define pi pair<int,int> 
#define pii pair<pi,int>
#define ull unsigned long long
#define vi vector<int>
#define viip vector<pair<int,pair<int,int> > > 
#define mp make_pair
#define vip vector<pair<int,int> >
#define pb push_back 
#define fi first
#define sec second
#define all(v) v.begin(),v.end()
#define s(v) v.size()
ll mod = 1000000007;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());//use rng()%n for numbers in range [0,n-1]
ll gcd(ll a,ll b){
	if(b==0)return a;
	return gcd(b,a%b);
}
ll fastexp(ll x,ll a){
    ll res = 1;
    while(a>0){
        if(a&1){
            res = (res*x)%mod;
        }
        a=a>>1;
        x=(x*x)%mod;
    }
    return res;
}
ll inverse(ll n){
    return fastexp(n,mod-2);
}
template <typename T>
void add(T &a, T b){
	a += b;
	if(a >= mod)a -= mod;
}
template <typename T>
void sub(T &a, T b){
	a -= b;
	if(a < 0)a += mod;
}
template <typename T>
void mul(T &a, T b){
	a *= b;
	if(a >= mod)a %= mod;
}
int main() {
	ios::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	ll a,v;
	cin>>a>>v;
	ll b,w;
	cin>>b>>w;
	ll t;
	cin>>t;
	ll eff = (v-w);
	if(eff <= 0){
		cout<<"NO";
		return 0;
	}
	ll dis = abs(a-b);
	ll tp = dis/eff;
	if(dis % eff != 0)tp++;
	if(tp <= t){
		cout<<"YES";
	}
	else{
		cout<<"NO";
	}
	return 0;
}

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

int main() {
 int a,b ;
 cin >>a>>b;
 int ans = 0;
  if (a==b)
    ans =a*2;
  else
   ans +=max(a,b)*2-1;
  
  cout <<ans ;
  
  
  
}


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

int main() {
  vector<int> strs(100);
  string s;
  cin >> s;
  bool fl = false;
  for (int i = 0; i < 100; i++) strs[i] = 0;
  for (int i = 0; i < s.length(); i++) {
    strs[s[i]-90] += 1;
  }
  for (int i = 0; i < 100; i++) {
    if (strs[i] % 2 == 1) fl = true;
  }
  cout << (fl ? "No" : "Yes") << endl;
  return 0;
}


Measured memory_bytes: 256
#include<cstdio>
#include<iostream>
#include<cstring>

char s[101];

bool par(int l,int r) {
    for(int i = l;i <= r;i++)
        if(s[i] != s[r + l - i]) return false;
    return true;
}

int main() {
    std::cin >> (s + 1);
    int n = strlen(s + 1);
    std::puts(par(1,n) && par(1,(n - 1) / 2) && par((n + 3) / 2,n) ? "Yes" : "No");
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(void) {
  char a[9][9], i, j;

  while (scanf("%s", a[0]) != EOF) {
    for (i = 1; i < 8; i++)
      scanf("%s", a[i]);

    
    for (i = 0; i < 8; i++) {
      for (j = 0; j < 8; j++) {
	if (a[i][j] == '1') {
	  if (a[i][j+1] == '1' && j < 7) {
	    if (a[i][j+2] == '1' && j < 6) {
	      if (a[i][j+3] == '1' && j < 5) {
		printf("C\n");
		break;
	      }
	    }
	    else if (a[i+1][j] == '1' && i < 7) {
	      if (a[i+1][j+1] == '1') {
		printf("A\n");
		break;
	      }
	      else if (a[i+1][j-1] == '1' && j > 0) {
		printf("G\n");
		break;
	      }
	    }
	    else if (a[i+1][j+1] == '1' && i < 7)
	      if (a[i+1][j+2] == '1' && j < 6) {
		printf("E\n");
		break;
	      }
	  }
	  else if (a[i+1][j] == '1' && i < 7) {
	    if (a[i+2][j] == '1' && i < 6) {
	      if (a[i+3][j] == '1' && i < 5) {
		printf("B\n");
		break;
	      }
	    }
	    else if (a[i+1][j+1] == '1' && j < 7) {
	      if (a[i+2][j+1] && i < 6) {
		printf("F\n");
		break;
	      }
	    }
	    else if (a[i+1][j-1] == '1' && j > 0) {
	      if (a[i+2][j-1] && i < 6) {
		printf("D\n");
		break;
	      }
	    }
	  }
	}
      }
    }
  }
  return 0;
}

Measured memory_bytes: 524
#include <bits/stdc++.h>
using namespace std;
#define dhoom ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);  
typedef long long ll;
typedef long double ld;
const ll inf = 1e18;
const int nax = 2e6 + 7;
const ll mod = 1e9 + 7;
//ll tree[4 * nax];
//9uS-22RSwk7gQqh

int main()
{
	int n,k;
	cin >> n >> k;
	int a[n];
	for(int i = 0 ; i < n ; i++)
			cin >> a[i];
	sort(a , a + n);
	ll ans = 0;
	for(int i = n - 1 ; i >= n - k ; i--)
		ans += a[i];
	cout << ans << endl;
	return 0;
} 




Measured memory_bytes: 256
//https://atcoder.jp/contests/arc063/tasks/arc063_d

#include<bits/stdc++.h>
const int N = 6e5 + 5;
const int inf = 1e9;
using namespace std;

struct point{
    int x, y;

    bool operator < (const point& a) const{
        return x < a.x;
    }
} p[N];

int n, H, W, cnt, ans, Max[N << 2], lazy[N << 2], val[N];
int U[N], cntU, D[N], cntD;

void dolazy(int i, int l, int r){
    if (!lazy[i]) return;
    if (l != r){
        lazy[i << 1] += lazy[i];
        lazy[i << 1 | 1] += lazy[i];
    }
    Max[i] += lazy[i];
    lazy[i] = 0;
}

void init(int i = 1, int l = 1, int r = cnt){
    lazy[i] = 0;
    if (l == r){
        Max[i] = H - val[l];
        return;
    }
    int mid = (l + r) >> 1;
    init(i << 1, l, mid); init(i << 1 | 1, mid+1, r);
    Max[i] = max(Max[i << 1], Max[i << 1 | 1]);
}

void update(int i, int l, int r, int L, int R, int val){
    dolazy(i, l, r);
    if (L > r || l > R || L > R) return;
    if (L <= l && r <= R){
        lazy[i] = val;
        dolazy(i, l, r);
        return;
    }
    int mid = (l + r) >> 1;
    update(i << 1, l, mid, L, R, val); update(i << 1 | 1, mid+1, r, L, R, val);
    Max[i] = max(Max[i << 1], Max[i << 1 | 1]);
}

int get(int i, int l, int r, int L, int R){
    dolazy(i, l, r);
    if (L > r || l > R || L > R) return -inf;
    if (L <= l && r <= R) return Max[i];
    int mid = (l + r) >> 1;
    return max(get(i << 1, l, mid, L, R), get(i << 1 | 1, mid+1, r, L, R));
}

void solve(){
    sort(p+1, p+1+n);
    init();
    cntU = cntD = 0; p[0].x = p[0].y = 1;
    for (int i = 1; i <= n; i++){
        ans = max(ans, val[p[i].x] + get(1, 1, cnt, 1, p[i].x-1));
        int y = p[i].y;
        if (val[y] <= (H >> 1)){
            update(1, 1, cnt, p[D[cntD]].x, p[i].x-1, -val[y]);
            while (cntD && y >= p[D[cntD]].y){
                update(1, 1, cnt, p[D[cntD-1]].x, p[D[cntD]].x-1, -val[y] + val[p[D[cntD]].y]);
                cntD--;
            }
            D[++cntD] = i;
        }
        else{
            update(1, 1, cnt, p[U[cntU]].x, p[i].x-1, val[y]-H);
            while (cntU && y <= p[U[cntU]].y){
                update(1, 1, cnt, p[U[cntU-1]].x, p[U[cntU]].x-1, val[y] - val[p[U[cntU]].y]);
                cntU--;
            }
            U[++cntU] = i;
        }
    }
    ans = max(ans, max(val[p[1].x], W - val[p[n].x]) + H);
    ans = max(ans, W + get(1, 1, cnt, 1, cnt));
}

int main(){
    cin >> W >> H >> n;
    for (int i = 1; i <= n; i++) cin >> p[i].x >> p[i].y, val[++cnt] = p[i].x, val[++cnt] = p[i].y;
    sort(val+1, val+1+cnt);
    cnt = unique(val+1, val+1+cnt) - val - 1;
    for (int i = 1; i <= n; i++){
        p[i].x = lower_bound(val+1, val+1+cnt, p[i].x) - val;
        p[i].y = lower_bound(val+1, val+1+cnt, p[i].y) - val;
    }
    solve();
    swap(W, H);
    for (int i = 1; i <= n; i++) swap(p[i].x, p[i].y);
    solve();
    cout << (ans << 1);
}


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

#define rep(i, j, k) for(int i = (int) j; i < (int) k; ++i)
#define sz(x) ((int) (x).size())
#define ll long long
#define mp make_pair
#define pii pair<int, int >
#define fi first
#define se second
#define pb push_back
#define inf 0x3f3f3f3f
#define INF 0x3f3f3f3f3f3f3f3f
#define zero(x) memset((x), (0), sizeof (x))
#define zerox(x, y) memset((x), (y), sizeof (x))

using namespace std;
const int N = 100100;

int a[N];
int n;
int g[N];

int main()
{
#ifdef PIT
//freopen(".in", "r", stdin);
//freopen(".out", "w", stdout);
#endif //PIT

	ios_base::sync_with_stdio(false); cin.tie(0);
	cin >> n;
	zero(g);
	rep(i, 0, n) cin >> a[i], g[a[i]]++;
	int mx = 0;
	rep(i, 1, N-10) {
		mx = max(g[i+1]+g[i]+g[i-1], mx);
	} 
	cout << mx << endl;
	
#ifdef PIT
flush(cout);
cerr << endl << "Time: " << (clock() / double(CLOCKS_PER_SEC)) << endl;
#endif //PIT
	return 0;
}


Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
#define ff first
#define ss second
#define int ll
#define pb push_back
#define setbits(x)          __builtin_popcountll(x)
#define endl "\n"
typedef long long ll;
int32_t main()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int n,k;
cin>>n>>k;

int arr[n];
for(int i=0;i<n;i++)
    cin>>arr[i];
int ans=0;
if(k==n)
{
    cout<<1<<endl;
    return 0;
}
set<int> s;

for(int i=0;i<k-1;i++)
{
 if(arr[i]>arr[i+1])
 {
     ans+=1;
     break;
 }
}
/// find sorted.
int dp[n]={};
for(int i=1;i<n;i++)
{
    if(arr[i]>arr[i-1])
    {
        dp[i]=dp[i-1]+1;
    }
}
int cnt=0;
for(int i=0;i<n;i++)
{
    if(dp[i]>=k-1)
        cnt++;
}

for(int i=0;i<k;i++)
    s.insert(arr[i]);
    int ok=0;
for(int i=k;i<n;i++)
{
    set<int>::iterator  it=--(s.end());
    set<int>::iterator it1=s.begin();
    int j=i-k;
    if(arr[j]==*it1&&arr[i]>*it);
    else
    {

        if(dp[i]>=k-1)
         {ok=1;
           it1=s.find(arr[j]);
    s.erase(it1);
          s.insert(arr[i]);
         continue;
         }
        ans++;
    }
        if(dp[i]>=k-1)
        {
            ok=1;
        }
        it1=s.find(arr[j]);
    s.erase(it1);
    s.insert(arr[i]);

}

ans+=ok;
cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 12672
import sys
from math import ceil, floor
from collections import deque, Counter, defaultdict
from fractions import gcd
input = lambda: sys.stdin.readline().rstrip()

def eprint(s):
    sys.stderr.write('DEBUG: {}'.format(s))
    return

def main():
    pi = 3.14159265358979
    r = int(input())
    
    print(r*2*pi)
    return

if __name__ == '__main__':
    main()

Measured memory_bytes: 10368
import java.util.Scanner;

public class Main
{
	public static void main(String[] args)
	{
		Scanner sc = new Scanner(System.in);
		String str = sc.nextLine();
		sc.close();
		String ans = "ARC";
		if (str.compareTo(ans) == 0) {
			ans = "ABC";
		}
		System.out.println(ans);
	}
}


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

int main(){

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

	
	long long n, sum = 0;
	cin >> n;
	long long count[100005] = {0};
	for (int i = 1; i <= n; i++){
		int l;
		cin >> l;
		count[l]++;
		sum+=l;
	}

	
	int q;
	cin >> q;
	for (int i = 0; i < q; i++){
		int b, c;
		cin >> b >> c;
		sum-=b * count[b];
		sum+=c * count[b];
		count[c]+= count[b];
		count[b] = 0;
		cout << sum << endl;
	}
	

}

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

#define DUMP(x) cerr << #x << "=" << x << endl
#define DUMP2(x, y) cerr<<"("<<#x<<", "<<#y<<") = ("<<x<<", "<<y<<")"<< endl
#define BINARY(x) static_cast<bitset<16> >(x)

#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define REP(i,m,n) for (int i=m;i<(int)(n);i++)

#define in_range(x, y, w, h) (0<=(int)(x) && (int)(x)<(int)(w) && 0<=(int)(y) && (int)(y)<(int)(h))
#define ALL(a) (a).begin(),(a).end()

typedef long long ll;
const int INF   = 1e9;
const ll  INFLL = 1e18;
typedef pair<int, int> PII;
typedef vector<vector<int>> Graph;
int dx[4]={0, -1, 1, 0}, dy[4]={-1, 0, 0, 1};

class UnionFind {
private:
    vector<int> union_size, rank;

public:
    vector<int> par;
    UnionFind(int n) : union_size(vector<int>(n)), rank(vector<int>(n)), par(vector<int>(n)) { init(n); }

    void init(int n)
    {
        for (int i=0; i<n; i++) {
            par[i] = i;
            rank[i] = 0;
            union_size[i] = 1;
        }
    }
    
    // 木の根を求める
    int find(int x)
    {
        if (par[x] == x) {
            return x;
        } else {
            return par[x] = find(par[x]);
        }
    }

    // xとyの属する集合を併合する
    void merge(int x, int y)
    {
        x = find(x);
        y = find(y);
        if (x == y) return;

        union_size[x] += union_size[y];
        union_size[y] = union_size[x];

        if (rank[x] < rank[y]) {
            par[x] = y;
        } else {
            par[y] = x;
            if (rank[x] == rank[y]) rank[x]++;
        }
    }
    
    // xとyが同じ集合に属するか判定する
    bool is_same(int x, int y) { return find(x) == find(y); }
    // x が含まれる集合の要素数を返す
    int get_union_size(int x) { return union_size[find(x)]; }
};

int main()
{
    ios::sync_with_stdio(false);

    int N, M;
    cin >> N >> M;
    vector<int> P(N);
    rep(i, N) cin >> P[i];

    UnionFind uf(N);

    rep(i, M) {
        int X, Y; cin >> X >> Y;
        X--, Y--;
        uf.merge(X, Y);
    }

    vector<set<int>> idxs(N);
    rep(i, N) {
        idxs[uf.find(i)].insert(i);
#ifdef DEBUG
        DUMP2(i, uf.find(i));
#endif
    }

    int ans = 0;
    rep(i, N) {
        if (idxs[uf.find(i)].count(P[i]-1)) {
#ifdef DEBUG
            DUMP(P[i]);
#endif
            ans++;
        }
    }
    cout << ans << endl;

}

Measured memory_bytes: 11264
def main():
    row1 = list(map(int, input().split()))
    row2 = list(map(int, input().split()))
    row3 = list(map(int, input().split()))
    n = int(input())
    nums = []
    for _ in range(n):
        nums.append(int(input()))

    result = 'No'
    for num in nums:
        for i in range(3):
            if num == row1[i]:
                row1[i] = 0
        for i in range(3):
            if num == row2[i]:
                row2[i] = 0
        for i in range(3):
            if num == row3[i]:
                row3[i] = 0

    if row1.count(0) == 3:
        result = 'Yes'
    elif row2.count(0) == 3:
        result = 'Yes'
    elif row3.count(0) == 3:
        result = 'Yes'
    elif row1[0] == 0 and row2[0] == 0 and row3[0] == 0:
        result = 'Yes'
    elif row1[1] == 0 and row2[1] == 0 and row3[1] == 0:
        result = 'Yes'
    elif row1[2] == 0 and row2[2] == 0 and row3[2] == 0:
        result = 'Yes'
    elif row1[0] == 0 and row2[1] == 0 and row3[2] == 0:
        result = 'Yes'
    elif row1[2] == 0 and row2[1] == 0 and row3[0] == 0:
        result = 'Yes'
    print(result)


if __name__ == "__main__":
    main()


Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define mit map<int,int>::iterator
#define sit multiset<int>::iterator
#define itrm(g,x) for(mit g=x.begin();g!=x.end();g++)
#define itrs(g,x) for(sit g=x.begin();g!=x.end();g++)
#define ltype int
#define rep(i,j,k) for(ltype (i)=(j);(i)<=(k);(i)++)
#define rap(i,j,k) for(ltype (i)=(j);(i)<(k);(i)++)
#define per(i,j,k) for(ltype (i)=(j);(i)>=(k);(i)--)
#define pii pair<int,int>
#define fi first
#define se second
#define mpr make_pair
#define pb push_back
#define fastio ios::sync_with_stdio(false)
const int inf=0x3f3f3f3f,
mod=1000000007;
const double pi=3.1415926535897932,
eps=1e-6;
int n,q,b[200005],ans[200005],lx,ly;multiset<int> s;map<int,int> m;
struct work{int s,t,p;}a[200005];
bool cmp(work x,work y){return x.p<y.p;}
int main()
{
    scanf("%d%d",&n,&q);
    rep(i,1,n) scanf("%d%d%d",&a[i].s,&a[i].t,&a[i].p),a[i].s-=a[i].p,a[i].t-=a[i].p;
    sort(a+1,a+n+1,cmp);
    rep(i,1,q) scanf("%d",b+i),s.insert(b[i]),ans[i]=-1,m[b[i]]=i;
    rep(i,1,n){
        sit l=s.lower_bound(a[i].s);
        for(sit it=l;it!=s.end();) {if(*it>=a[i].t) break;ans[m[*it]]=a[i].p;s.erase(it++);}
    }
    rep(i,1,q) printf("%d\n",ans[i]);
    return 0;
}

Measured memory_bytes: 24576
#include <iostream>
#include <cstdio>
#include <vector>
using namespace std;

int main(){
    long long l, r, d;
    cin >> l >> r >> d;

    long long count = 0;

    for(long long i = l; i <= r; i++){
        if(i % d == 0){
            count++;
        }
    }

    cout << count << endl;
    return 0;
}

Measured memory_bytes: 3584
#include <iostream>
#include <string.h>
#include <algorithm>
#include <array>
#include <vector>
#include <cmath>

using namespace std;

int main( void ) {

    int N;
    cin >> N;

    vector<int> a(N);

    for ( int i = 0; i < N; i++ ) {
        cin >> a.at(i);
    }

    sort(a.begin(), a.end(), greater<int>());

    int A, B;
    A = B = 0;
    for ( int i = 0; i < N; i++ ) {
        if ( i % 2 == 0 ) {
            A += a.at(i);
        } else {
            B += a.at(i);
        }
    }

    cout << A - B << endl;
    

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using pint = pair<int, int>;
using ll = long long;
using ull = unsigned long long;
using vll = vector<long long>;
using pll = pair<ll, ll>;
#define FOR(i, begin, end) \
    for (int i = (begin), i##_end_ = (end); i < i##_end_; i++)
#define IFOR(i, begin, end) \
    for (int i = (end)-1, i##_begin_ = (begin); i >= i##_begin_; i--)
#define REP(i, n) FOR(i, 0, n)
#define IREP(i, n) IFOR(i, 0, n)
#define VREP(s, ite) for (auto ite = s.begin(); ite != s.end(); ++ite)
#define FI first
#define SE second
#define ALL(v) v.begin(), v.end()
//#define endl "\n"
#define ciosup  \
    cin.tie(0); \
    ios::sync_with_stdio(false);
#define eb emplace_back
#define vint vector<int>
constexpr ll INF = 1e15 + 7LL;
constexpr ll MOD = 1e9 + 7LL;
template <typename T>
istream &operator>>(istream &is, vector<T> &v) {
    for (int i = 0; i < v.size(); ++i) {
        is >> v[i];
    }
    return is;
}
template <typename T>
ostream &operator<<(ostream &os, const vector<T> &v) {
    for (int i = 0; i < v.size() - 1; ++i) {
        os << v[i] << " ";
    }
    if (v.size() > 0) {
        os << v[v.size() - 1] << endl;
    }
    return os;
}

int main() {
    int n;
    cin>>n;
    vint ans(n+1, 0);
    FOR(i, 1, 105) {
        FOR(j,1, 105){
            FOR(k,1,105){
                ll now = i * i + j * j + k * k + i * j + j * k + k * i;
                if (now <= n){
                    ans[now]++;
                }
            }
        }
    }
    REP(i, n) { cout << ans[i + 1] << endl; }
}

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

using namespace std;

int digitSum(int n) {
    int ret = 0;
    while(n > 0) {
        ret += n % 10;
        n /= 10;
    }
    return ret;
}

int main() {
    int N, ans = INT_MAX;

    scanf("%d", &N);

    int tmp = 0;
    for(int i = 1; i <= N / 2; i++) {
        tmp = digitSum(i) + digitSum(N - i);
        if(ans > tmp) {
            ans = tmp;
        }
    }

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

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main() {
    int h, n;
    cin >> h >> n;

    int a[n];
    for(int i = 0; i < n; ++i) {
        cin >> a[i];
    }

    sort(a, a + n, greater<int>());

    int re = h;
    for(int i = 0; i < n; i++) {
        re -= a[i];
        if(re <= 0) {
            cout << "Yes" << endl;
            return 0;
        }
    }
    cout << "No" << endl;

    return 0;
}


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

#define boost ios_base::sync_with_stdio(false), cin.tie(NULL);

using namespace std;
const int N = 1e6 + 41;
const int mod = 1e9 + 7;
const long long INF = 1e16;
const int inf = 1e9;

int main () {
	boost;
	int m, k;
	cin >> m >> k;
	if (!k) {
		for (int i = 0 ; i < (1 << m) ; ++ i) cout << i << " " << i << " ";
	} else {
		int x = 0;
		int a = -1, b = -1;
		for (int i = 0 ; i < (1 << m) ; ++ i) x ^= i;
		for (int i = 0 ; i < (1 << m) ; ++ i) if ((x ^ k ^ i) < (1 << m) && (x ^ k ^ i) >= 0 && (x ^ k ^ i) != i) a = i, b = (x ^ k ^ i);
		if (a == -1) return cout << -1, 0;
		for (int i = 0 ; i < (1 << m) ; ++ i) if (i != a && i != b) cout << i << " ";
		cout << a << " " << b << " ";
		for (int i = (1 << m) - 1 ; i >= 0 ; -- i) if (i != a && i != b) cout << i << " ";
		cout << b << " " << a;
	}
}


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

int main() {
  map<string, int> m;
  int N;
  string s;
  
  cin >> N;
  
  for(int i = 0; i < N; i++){
    cin >> s;
    if(!(m[s])){
      m[s]++;
    }
  }
       
  cout << m.size() << endl;          
  
  return 0;
}

Measured memory_bytes: 19120
#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>

using namespace std;

int getbin(int n)
{
	int cnt = 0,i = 1;
	while(i <= n)
	{
		i *= 2;
		cnt += 1;
	}
	return cnt - 1;
}

int bin[100050],num[100050];
bool st[100050];

int main()
{
	int N;
	scanf("%d",&N);
	long long ans = 0;
	int t = 0;
	for(int i = 1;i <= N; ++ i)
	{ 
		scanf("%d",&num[i]);
		bin[i] = getbin(num[i]);
		if((1 << bin[i]) != num[i])
			st[i] = 1;
	} 
	for(int i = 1;i <= N; ++ i)
	{
		if(t > bin[i])
			t = bin[i],st[i] = 0;
		else if(t < bin[i])
		{
			ans += bin[i] - t;
			t = bin[i];
		}
		if(st[i])
			ans++,t++;
	}
	printf("%lld\n",ans);
}

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

char judge(int num){
  if(num % 2 == 0){
    return '+';
  }
  else {
    return '-';
  }
}

int cal(int a, int b, char c){
  if(c == '+'){
    return a + b;
  }
  else {
	return a - b;
  }
}


int main(){
  string s;
  cin >> s;
  int a[4];
  
  for(int i = 0; i < 4; i++){
	a[i] = s[i] - '0';
  }
  
  char op1, op2, op3;
  int ans = 0;
  for(int i = 0; i < 2; i++){
    op1 = judge(i);
    for(int j = 0; j < 2; j++){
      op2 = judge(j);
      for(int k = 0; k < 2; k++){
        op3 = judge(k);
      	
        ans = cal(a[0], a[1], op1);
        ans = cal(ans, a[2], op2);
        ans = cal(ans, a[3], op3);
        //cout << ans << endl;
        if(ans == 7){
          cout << s[0] << op1 << s[1] << op2 << s[2] << op3 << s[3];
  		  cout << "=7" << endl;
          return 0;
        }
        ans = 0;
      }
    }
  }
  
  
}

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

bool is_prime(int num)
{
    for(int i=2; i*i <= num; i++)
    {
        if(num % i == 0)
        {
            return false;
        }
    }
    return true;
}

int main()
{
    int x;
    cin >> x;

    while(true)
    {
        if(is_prime(x))
        {
            cout << x << endl;
            break;
        }
        else
        {
            x++;
        }
    }

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
struct Fast {
    Fast() {
        cin.tie(0);
        ios::sync_with_stdio(false);
        cout << fixed << setprecision(20);
    }
} fast;
template <typename A, size_t N, typename T> void Fill(A (&array)[N], const T& val) {
    std::fill((T*)array, (T*)(array + N), val);
}
// long long mod = 998244353;
#define REP(i, n) for (long long i = 0; i < (n); i++)
#define rep(i, a, n) for (long long i = a; i < (n); i++)
typedef long long ll;
typedef pair<ll, ll> P;
long long mod = 1000000007;
long long modpow(long long m, long long n, long long modvalue) {
    if (n == 0) return 1;
    if (n % 2 == 0) {
        long long t = modpow(m, n / 2, modvalue);
        return t * t % modvalue;
    } else {
        return modpow(m, n - 1, modvalue) * m % modvalue;
    }
}

long long moddiv(long long a, long long b, ll modvalue) { return (a * modpow(b, mod - 2, modvalue)) % modvalue; }

const ll INF = 1LL << 60;

string change_binary(long long a) {
    string ret;
    for (int i = 31; i >= 0; i--) {
        ret += (a >> i & 1) + '0';
    }
    return ret;
}

ll nCkmod(ll n, ll k, ll modvalue) {
    ll numera = 1;
    for (int i = n; i > n - k; i--) {
        numera *= i;
        numera %= modvalue;
    }
    ll denomi = 1;
    REP(i, k) {
        denomi *= (i + 1);
        denomi %= modvalue;
    }
    return moddiv(numera, denomi, modvalue);
}

map<ll, ll> cnt;
void primeFactors(long long n) {
    while (n % 2 == 0) {
        cnt[2]++;
        n = n / 2;
    }
    for (int i = 3; i <= sqrt(n); i = i + 2) {
        while (n % i == 0) {
            cnt[i]++;
            n = n / i;
        }
    }
    if (n > 2) {
        cnt[n]++;
    }
}
int main() {
    ll n, k;
    cin >> n >> k;
    //cout << nCkmod(3, 5, mod) << endl;
    rep(i, 1, k + 1) {
        ll ans = 0;
        ans += (nCkmod(k - 1, i - 1, mod)) * (nCkmod(n - k + 1, i, mod));
        ans %= mod;
        cout << ans << endl;
    }
}

Measured memory_bytes: 3640
import java.util.*;

public class Main {

	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		if (n < 1200) {
			System.out.println("ABC");
		} else if (n < 2800) {
			System.out.println("ARC");
		} else{
			System.out.println("AGC");
		}
	}
}


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

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

    int cnt=0;
    for(int i=0;i<s.size()-1;i++){
        if(s[i]=='h'){
            if(s[i+1]=='i'){
                cnt++;
            }
        }
    }

    if((s.size()/2)==cnt && (s.size()%2)==0){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }

}

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

using ll = long long;
using pii  = pair<int, int>;
using pll = pair<ll, ll>;
#define ull unsigned long long
#define ld long double
#define vi vector<int>
#define vll vector<ll>
#define vc vector<char>
#define vs vector<string>
#define vpii vector<pii>
#define vpll vector<pll>

#define rep(i, n) for (int i = 0, i##_len = (n); i < i##_len; i++)
#define rep1(i, n) for (int i = 1, i##_len = (n); i <= i##_len; i++)
#define repr(i, n) for (int i = ((int)(n)-1); i >= 0; i--)
#define rep1r(i, n) for (int i = ((int)(n)); i >= 1; i--)

#define sz(x) ((int)(x).size())
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()

#define SORT(v, n) sort(v, v + n);
#define VSORT(v) sort(v.begin(), v.end());
#define RSORT(x) sort(rall(x));
#define pb push_back
#define mp make_pair

#define INF (1e9)
#define INF2 (1e18)
#define PI (acos(-1))
#define EPS (1e-7)

ull gcd(ull a, ull b) { return b ? gcd(b, a % b) : a; }
ull lcm(ull a, ull b) { return a / gcd(a, b) * b; }

int main(){
    ll s;
    cin >> s;
    ll m = (s + (ll)(1e9)-1) / (ll)(1e9), n = (ll)1e9;
    if (m == 1) n = s / m;
    ll r = m*n - s;
    vpll ans(3);
    ans[1].first = m;
    ans[2].second = n;
    if (r == 0) {
        rep(i, 3) printf("%lld %lld%c", ans[i].first, ans[i].second, (i<2?' ':'\n'));
    }
    else {
        ll a = 0, b = 0;
        for (ll i=1; i<=n; ++i) {
            if (r%i==0 && r/i<=m) {
                a = i;
                b = r / i;
                break;
            }
        }
        ans[1].second = -a;
        ans[2].first = m - b;
        rep(i, 2) ans[i].second += a;
        rep(i, 3) printf("%lld %lld%c", ans[i].first, ans[i].second, (i<2?' ':'\n'));
    }
    return 0;
}


Measured memory_bytes: 3724