akhauriyash/Code-Regression huggingface dataset:
s = int(input())

def func(n):
    if n % 2 == 0:
        return n / 2
    else:
        return 3*n + 1


a_list = [s]
i = 1
while True:
    if i == 1:
        pass
    else:
        n = a_list[i-2]
        a_list.append(func(n))
    i += 1
    if len(a_list) != len(set(a_list)):
        print(len(a_list))
        break


Measured memory_bytes: 2940
/*
 * main.c
 *
 *  Created on: 2019/07/21
 *      Author: family
 */

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>

typedef long long int ll;

ll A[200001] = {0};
ll a[200001] = {0};
ll b[200001] = {0};

int main()
{
	ll N = 0, i = 0, sum = 0, ans = 0, sumr = 0, j = 0;
	scanf("%lld", &N);
	for (i = 0; i < N; i++) {
		scanf("%lld", &A[i]);
		sum += A[i];
		a[i] = sum;
	}
	for (i = N-1; i >= 0; i--) {
		sumr += A[i];
		b[(N-1) - i] = sumr;
	}
	i = 0;
	while(1) {
		if ((sum/2) <= a[i]) {
//			printf("i=%lld\n", i);
			break;
		}
		i++;
	}
	j = 0;
	while(1) {
		if ((sum/2) <= b[j]) {
//			printf("j=%lld\n", j);
			break;
		}
		j++;
	}
	ll a1 = sum - a[i];
	ll a2 = abs(a[i] - a1);
	ll b1 = sum - b[j];
	ll b2 = abs(b[j] - b1);
//	printf("a1 %lld b1 %lld\n", a1, b1);
	if (b2 > a2) {
		ans = a2;
	} else {
		ans = b2;
	}
	printf("%lld\n", ans);


    return 0;
}


Measured memory_bytes: 4864
import copy
h,w,v=map(int,input().split())
c=[list(input()) for _ in range(h)]
ans=0
for i in range(2**w):
  a=copy.deepcopy(c)
  tr1=bin(i)[2:].zfill(w)
  for k in range(w):
    if tr1[k]=='1':
      for l in range(h):
        a[l][k]='.'   
  for j in range(2**h):
    tr2=bin(j)[2:].zfill(h)
    cnt=0
    for k in range(h):
      if tr2[k]=='1':
          cnt+=a[k].count('#')
    if cnt==v:ans+=1
print(ans)

Measured memory_bytes: 9348
package main
 
import "fmt"
 
func main () {
  var n int
  fmt.Scan(&n)
  var h int
  h = n/2
  if n % 2 == 1 {
    h = h + 1
  }
  var p float64
  p = float64(h)/float64(n)
  fmt.Printf("%f", p)
} 

Measured memory_bytes: 512
import java.util.*;

public class Main{
	public static void main(String arga[]){
		
		Scanner sc = new Scanner(System.in);
		String a = sc.next(); 
		String b = "ABC";
		String c = "ARC";
		
		if(a.equals(b)){
			System.out.println("ARC");
		}
		else if(a.equals(c)){
			System.out.println("ABC");
		}
		
	}
}
		

Measured memory_bytes: 35672
#include <iostream>
#include <fstream>
#include <vector>
#include <algorithm>
#include <queue>
#include <map>
#include <random>
#include <cstdio>
#include <cstring>
#include <cmath>

// for i in f..<t { as swift
#define forin(i, f, t) for(auto i = f; i < t; i++)

using namespace std;
using ll = long long;

const int MAX_N = 100000;

struct Edge {
    int to;
    int cost;
};

vector<Edge> node[MAX_N + 1];
int weight[MAX_N + 1];

bool dfs(int idx, int cost) {
    if (weight[idx] != int(INFINITY))
        return weight[idx] == cost;
    weight[idx] = cost;
    for(auto e : node[idx])
    if (!dfs(e.to, cost + e.cost)) return false;
    return true;
}

int main() {
    forin(i, 0, MAX_N + 1) weight[i] = INFINITY;
    int n, m;
    cin >> n >> m;
    int l, r, d;
    forin(i, 0, m) {
        cin >> l >> r >> d;
        node[l].push_back(Edge{r, d});
        node[r].push_back(Edge{l, -d});
    }
    bool rec = true;
    forin(i, 1, n + 1) {
        if (node[i].size() > 0 && weight[i] == int(INFINITY)) rec &= dfs(i, 0);
    }
    cout << (rec ? "Yes" : "No") << endl;
}



Measured memory_bytes: 11008
import java.io.BufferedReader;
import java.io.FileReader;
import java.io.InputStreamReader;

class Elem {
	Elem next;
	Elem prev;
	int key;
	
	Elem(int key) {
		this.key = key;
	}
}

class DoubleyLinkedList {
	Elem head;
	
	DoubleyLinkedList() {
		head = new Elem(-1);
		head.next = head;
		head.prev = head;
	}
	
	void insert(int key) {
		Elem e = new Elem(key);
		e.next = head.next;
		e.prev = head;
		e.next.prev = e;
		head.next = e;
	}
	
	void delete(int key) {
		for (Elem e = head.next; e != head; e = e.next) {
			if (e.key == key) {
				e.prev.next = e.next;
				e.next.prev = e.prev;
break;
			}
		}
	}
	
	void deleteFirst() {
		Elem e = head.next;
		e.next.prev = head;
		head.next = e.next;
	}
	
	void deleteLast() {
		Elem e = head.prev;
		e.prev.next = head;
		head.prev = e.prev;
	}
	
	public String toString() {
		StringBuilder sb = new StringBuilder();
		for (Elem e = head.next; e != head; e = e.next) {
			sb.append(e.key);
			sb.append(' ');
		}
		sb.deleteCharAt(sb.length() - 1);
		sb.append('\n');
		return sb.toString();
	}
}

public class Main {
	public static void main(String[] args) throws Exception {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		// BufferedReader br = new BufferedReader(new FileReader("in1.txt"));
		// BufferedReader br = new BufferedReader(new FileReader("in2.txt"));
		int n = Integer.parseInt(br.readLine());

		DoubleyLinkedList list = new DoubleyLinkedList();
		for (int i = 0; i < n; i++) {
			String[] line = br.readLine().split(" ");
			if (line[0].equals("insert")) {
				list.insert(Integer.parseInt(line[1]));
			} else if (line[0].equals("delete")) {
				list.delete(Integer.parseInt(line[1]));
			} else if (line[0].equals("deleteFirst")) {
				list.deleteFirst();
			} else if (line[0].equals("deleteLast")) {
				list.deleteLast();
			}
		}
		System.out.print(list.toString());
	}
}

Measured memory_bytes: 562532
#include <bits/stdc++.h>
//#define int long long

using namespace std;
using LL = long long;
using P = pair<int, int>;

#define FOR(i, a, n) for(int i = (int)(a); i < (int)(n); ++i)
#define REP(i, n) FOR(i, 0, n)

#define pb(a) push_back(a)
#define all(x) (x).begin(),(x).end()

const int INF = (int)1e9;
const LL INFL = (LL)1e19;
const int MOD = 1e9 + 7;

int dp[100005];

int dfs(vector<vector<int>> &tree, int cur)
{
    if (tree[cur].empty()) 
    {
        dp[cur] = 0;
        return 0;
    }

    vector<int> child;
    for (auto c : tree[cur])
    {
        child.push_back(dfs(tree, c));
    }

    sort(all(child));
    REP(i, child.size()) child[i] += child.size() - i;
    sort(all(child), greater<int>());

    dp[cur] = child[0];
    return child[0];
}

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

    int n;
    cin >> n;
    vector<int> a(n-1);
    REP(i, n-1) cin >> a[i];

    vector<vector<int>> tree(n+1);
    REP(i, n-1){
        tree[a[i]].push_back(i+2);
    }

    cout << dfs(tree, 1) << endl;
    //REP(i, n) cout << dp[i+1] << endl;
}

Measured memory_bytes: 15872
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <list>
#include <iostream>
#include <algorithm>
using namespace std;

int main(int argc , char **argv)
{
	(void)argc;
	(void)argv;
	list<int> ls;

	int N;
	cin >> N;
	for(int i=0;i<N;i++)
	{
		int a;
		cin >> a;
		if (i%2==0){
			ls.push_front(a);
		}else{
			ls.push_back(a);
		}
	}

	if (N%2==1){
		// 要素を先頭から順番に表示
		for_each(ls.cbegin(), ls.cend(), [](int x){
			cout << x << " ";
		});
	}else{
		// 要素を末尾側から順番に表示
		for_each(ls.crbegin(), ls.crend(), [](int x){
			cout << x << " ";
		});
	}
	cout << endl;

	return 0;
}


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

using namespace std;
#define rep(i, n) for (ll i = 0; i < (n); ++i)
//#define rep(i, n) for (int i = 0; i < (n); ++i)
#define sz(x) ll(x.size())
typedef long long ll;
//typedef pair<int, int> P;
//typedef pair<ll, ll> P;
//const double INF = 1e10;
//const ll INF = 10e15;
const ll MINF = -10e10;
const int INF = INT_MAX;
#define cmin(x, y) x = min(x, y)
#define cmax(x, y) x = max(x, y)


//ifstream myfile("C:\\Users\\riku\\Downloads\\0_00.txt");
//ofstream outfile("log.txt");
//outfile << setw(6) << setfill('0') << prefecture << setw(6) << setfill('0') << rank << endl;
// std::cout << std::bitset<8>(9);

//typedef priority_queue<P, vector<P>, greater<P>> PQ_ASK;
const int mod = 1000000007;
typedef pair<int, char> P;

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

    map<int, int> counter;

    rep(i, n) {
        int a;
        cin >> a;
        counter[a]++;
    }

    vector<int> list;
    for (auto e : counter) {
        list.push_back(e.second);
    }
    sort(list.begin(), list.end());
    if (list.size() <= k) {
        cout << 0 << endl;
        return 0;
    }

    int ans = 0;
    for (int i = 0; i < list.size() - k; i++) {
        ans += list[i];
    }

    cout << ans << endl;

}

Measured memory_bytes: 10748
import java.util.ArrayList;
import java.util.Scanner;

public class Main {
	public static void main(String[] args){
		Scanner s = new Scanner(System.in);
		ArrayList<Integer> a = new ArrayList<Integer>();

		while(true){
			int m = s.nextInt();
			if(m == 0){
				break;
			}

			int change = 1000 - m;

			a.add(count(change));
		}

		for(int i = 0; i < a.size(); i++){
			System.out.println(a.get(i));
		}

	}

	static int count(int change){
		int c = 0;
		while(change != 0){
			if(change >= 500){
				change -= 500;
				c++;
			}
			else if(change >= 100){
				change -= 100;
				c++;
			}
			else if(change >= 50){
				change -= 50;
				c++;
			}
			else if(change >= 10){
				change -= 10;
				c++;
			}
			else if(change >= 5){
				change -= 5;
				c++;
			}
			else if(change >= 1){
				change -= 1;
				c++;
			}
		}
		return c;
	}

}

Measured memory_bytes: 17184
#include <iostream>
#include <iomanip>
#include <math.h>
#include <float.h>
using namespace std;

#ifndef M_PI
#define M_PI (4.0*atan(1.0))
#endif

int main() {
	// your code goes here
	
	int n,x,min=1000000+1,max=-1000000-1;
	long int sum=0;
	std::cin>>n;
	for(int i; i<n; i++){
		std::cin>>x;
		if(x>max){
			max=x;
		}
		if(x<min){
			min=x;
		}
		sum+=x;
	}
	std::cout<<setprecision(16)<<min<<" "<<max<<" "<<sum<<std::endl;
	return 0;
}

Measured memory_bytes: 3104
#include <bits/stdc++.h>
  
using namespace std;
  
#define rep(i,n) REP(i,0,n)
#define REP(i,s,e) for(int i=(s); i<(int)(e); i++)
#define repr(i, n) REPR(i, n, 0)
#define REPR(i, s, e) for(int i=(int)(s-1); i>=(int)(e); i--)
#define pb push_back
#define all(r) (r).begin(),(r).end()
#define rall(r) (r).rbegin(),(r).rend()
#define fi first
#define se second
  
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
 
const int INF = 1e9;
const ll MOD = 1e9 + 7;
double EPS = 1e-8;

int main(){
#ifdef LOCAL_TEST
    freopen("in", "r", stdin);
    freopen("out", "w", stdout);
#endif
    int h, w;
    cin >> h >> w;
    vector<vector<ll>> d(10, vl(10));
    rep(i, 10) rep(j, 10) cin >> d[i][j];
    rep(k, 10) rep(i, 10) rep(j, 10) d[i][j] = min(d[i][j], d[i][k] + d[k][j]);
    int ans = 0;
    rep(i, h) rep(j, w) {
        int a;
        cin >> a;
        if(a == -1) continue;
        ans += d[a][1];
    }
    cout << ans << endl;
    return 0;
}

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

int main(){
	string s, t;
	cin>>s>>t;
	int n1 = s.size(), n2 = t.size(), fl = 0;
	long long int cnt = 0, rem = 0, ans;
	int a[26];
	set<int > se[26];
	set<int >::iterator s1;
	for(int i=0;i<26;i++)
		a[i] = -1;
	for (int i=0;i<n1;i++){
		int ind = s[i] - 97;
		if (a[ind] == -1){
			a[ind] = i+1;
		}
		se[ind].insert(i+1);
	}
	for (int i=0;i<n2;i++){
		int l = t[i] - 97;
		if(a[l] == -1){
			cout<<"-1";
			fl =1;
			break;
		}
		s1 = se[l].lower_bound(rem+1);
		if(s1 != se[l].end()){
			rem = *s1;
		}
		else{
			cnt++;
			rem = a[l];
		}
		// cout<<i<<" - "<<cnt<<" "<<rem<<"\n";
	}
	if (!fl){
		ans = cnt*n1 + rem;
		cout<<ans;
	}
}

Measured memory_bytes: 5760
n,k=map(int,input().split())
H=list(map(int,input().split()))
 
dp=[float('inf') for _ in range(n)]
dp[0]=0
for i,hi in enumerate(H[1:],1):
  s=max(0,i-k)
  dp[i]=min([aj + abs(hi-hj) for hj,aj in zip(H[s:i],dp[s:i])])
print(dp[-1])

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

using int64 = long long;

int main() {
  int64 n;
  cin >> n;
  unordered_map<int64,int64> L;
  unordered_map<int64,int64> R;
  for (int64 i = 0; i < n; ++i) {
    int64 a;
    cin >> a;
    L[i + a] = L[i + a] + 1;
    R[i - a] = R[i - a] + 1;
  }
  int64 ret = 0;
  for (auto& li : L) {
    ret += li.second * R[li.first];
  }
  cout << ret << "\n";

  return 0;
}



Measured memory_bytes: 33320
#include <iostream>
#include <string>
#include <cstdio>
#include <cstdlib>
#include <vector>
#include <deque>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <utility>
#include <algorithm>
#include <tuple>
#include <cmath>
#include <iomanip>
#define ll long long
#define rep(i,n) for(int i=0;i<n;i++)
#define Rep(i,a,b) for(int i=a;i<b;i++)
#define REP(i,a,b) for(int i=a;i<=b;i++)
#define rev(i,n) for(int i=n-1;i>=0;i--)
#define vi vector<int>
#define pb push_back
#define pi pair<int,int>
#define vp vector<pair<int,int> >
#define mp make_pair
#define all(v) (v).begin(),(v).end()
#define fi first
#define se second
#define INF 1000000000
#define eps 1e-7
#define mod 1000000007
using namespace std;

string S;

int main(void) {
    cin >> S;
    string target = "keyence";
    int Slen=(int)S.size();
    int inserted = Slen-7;
    if (inserted < 0) {
        cout << "NO" << endl;
        return 0;
    } else if (inserted == 0) {
        if (target == S) {
            cout << "YES" << endl;
        } else {
            cout << "NO" << endl;
        }
        return 0;
    } else {
        int i;
        for (i=0; i<Slen-inserted; i++) {
            if (S.substr(0, i) + S.substr(i+inserted, Slen-(i+inserted)) == target) {
                cout << "YES" << endl;
                return 0;
            }
        }
        if (i==Slen-inserted) {
            cout << "NO" << endl;
            return 0;
        }
    }
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define int long
#define ll long long
#define rep(i, n) for(int i = 0; i < n; i++)
using namespace std;
int gcd(int a,int b){return b ? gcd(b,a%b) : a;}
int lcm(int a,int b){return a/gcd(a,b)*b;}


//可読性最悪
main() {
    string S; cin >> S; int ans=0;
    if(S.size()==1){
        cout << S << endl;
    }
    else {
        bool can = false;
        rep(i,S.size()){
            if(can) {ans+=9;}
            else if(i==0){
                if(S[0]!='9' && S[1]!='9'){
                    ans+=S[0]-'1'; can=true;
                }
                else ans+=S[0]-'0'; 
            }
            else {
                if(S[i]=='9') ans+=9;
                else {ans+=8;
                can = true;}
            }
        }
        cout << ans << endl;
    }

    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<iomanip>
#include<algorithm>
#include<cmath>
#include<cstdio>

#define REP(i,s,n) for(int i=s;i<n;i++)
#define rep(i,n)   REP(i,0,n)
#define inf (1<<29)
#define MAX 3000
using namespace std;
typedef long double ld;

int N,T;
char en[MAX];
ld dp[MAX][2];

int main()
{
  while(scanf("%d %d",&N,&T), N|T)
    {
      getchar();
      rep(i,N)scanf("%c",&en[i]);

      rep(i,N)rep(j,2)dp[i][j] = 0;
      dp[0][0] = 1;
      rep(phase,T)
	{
	  rep(cur,N)rep(k,6)
	    dp[(cur+k+1)%N][(phase+1)&1] += dp[cur][phase&1]*(1.0/6);
	  
	  rep(i,N)dp[i][phase&1] = 0;
	}

      ld ans = 0;
      rep(sp,N)
	{
	  ld cost = 0;
	  rep(i,N)
	    {
	      if(en[(sp+i)%N] == 'R')cost += dp[i%N][T&1];
	    }
	  ans = max(ans,cost);
	}

      cout << setiosflags(ios::fixed) << setprecision(10) << ans << endl;

    }
  return 0;
}

Measured memory_bytes: 1340
import sys
input=sys.stdin.readline
ns=input().rstrip()
ans=0
l=[]
ls=len(ns)
for i in range(ls):
    l.append(int(ns[ls-1-i]))
for i in range(10**6+1-ls):
    l.append(0)
for i in range(10**6+1):
    if 0<=l[i]<=4:
        ans+=l[i]
    elif 6<=l[i]<=9:
        ans+=10-l[i]
        l[i+1]+=1
    elif l[i]==10:
        l[i+1]+=1
    elif l[i]==5:
        ans+=5
        if 0<=l[i+1]<=4:
            pass
        else:
            l[i+1]+=1
print(ans)








Measured memory_bytes: 117160
#include<iostream>
#include<string>
#include<algorithm>
#include<bits/stdc++.h>
using namespace std;

int main(){
  int N,sum=0,a=0;
  cin >> N;
  string S;
  cin >> S;
  for(int i=0; i<S.size(); i++){
    if(S[i]=='I'){
      sum = sum+1;
     a=max(a,sum);
    }else{
      sum = sum-1;
    }
  }if(a<=0){
    cout << '0' << endl;
  }else{
  cout << a << endl;
}
}

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

bool binarySearch(int key, int A[], int n) {
	int left = 0;
	int right = n;
	int middle;

	while (left < right) {
		int middle = (left + right) / 2;
		if (A[middle] == key) {
			return true;
		}
		else if (A[middle] < key) {
			left = middle + 1;
		}
		else {
			right = middle;
		}
	}
	return false;
}

int main() {
	int A[100000];
	int n;
	int q;
	int sum = 0;

	cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> A[i];
	}
	cin >> q;
	for (int i = 0; i < q; i++) {
		int key;
		cin >> key;
		if (binarySearch(key, A, n)) sum++;
	}

	cout << sum << endl;
	
	return 0;
}

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

#define REP(type, i, a, b) for( type i = a; i < b; i++ )
typedef long long ll;

using namespace std;

int main (void) {
    ll N, ans;
    scanf("%lld", &N);
    REP(int, i, 1, 10){
        REP(int, j, 1, 10){
            if ( N == (i * j) ){
                printf("Yes\n");
                return 0;
            }
        }
    }
    printf("No\n");
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
std::string m[12];
void d(int x,int y){
	if(x>0&&m[y][x-1]-48)m[y][x-1]=48,d(x-1,y);
	if(x<11&&m[y][x+1]-48)m[y][x+1]=48,d(x+1,y);
	if(y>0&&m[y-1][x]-48)m[y-1][x]=48,d(x,y-1);
	if(y<11&&m[y+1][x]-48)m[y+1][x]=48,d(x,y+1);
	return ;
}
main(){
	while(1){
		int y=12,r=0;
		for(;y;y--)std::cin>>m[y-1];
		if(std::cin.eof())return 0;
		for(;y<12;y++)for(int x=0;x<12;x++)if(m[y][x]-48)r++,m[y][x]=48,d(x,y);
		std::cout<<r<<'\n';
	}
}

Measured memory_bytes: 0
/* winners never quit and quitters never win.
      #swap                                 */
      
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp> 
using namespace std;
using namespace __gnu_pbds;
#pragma GCC optimize ("-O3")
using ll = long long;
using ld = long double;
const ll mod = 1000000007;
const ll inf = 1000000000000000000;
const ll rk = 256;

typedef tree<
int,
null_type,
less<int>,
rb_tree_tag,
tree_order_statistics_node_update>
ordered_set;

#define pb push_back
#define mp make_pair
#define vc vector
#define fs first
#define sec second
#define pq priority_queue
#define lb lower_bound
#define ub upper_bound
#define pll pair<ll,ll> 
#define pls pair<ll,string>
#define psl pair<string,ll>
#define plc pair<ll,char>
#define pcl pair<char,ll>
#define pss pair<string,string>
#define all(v) v.begin(),v.end()
#define tol(s) transform(s.begin(),s.end(),s.begin(),::tolower);
#define tou(s) transform(s.begin(),s.end(),s.begin(),::toupper);

#define error(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }

void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
	cerr << *it << " = " << a << endl;
	err(++it, args...);
}

#define rep(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
#define T ll t=0;cin>>t;for(ll test=0;test<t;test++)


int32_t main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);cout.tie(0);
	//isprime();
	//coeff();
	/*freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);*/
    ll n,m;
    cin>>n>>m;
    ll sum=0;
    ll x[n];
    rep(a,0,n)
    {
        cin>>x[a];
    }
    sort(x,x+n);
    if(m>=n)
        cout<<"0\n";
    else
    {
        for(ll a=0;a<n-m;a++)
            sum+=x[a];
        cout<<sum<<endl;
    }
	return 0;
}

Measured memory_bytes: 1792
#include<bits/stdc++.h>
using namespace std;
#define rep(i,x,y) for(int i=x;i<y;i++)
#define range(a) (a).begin(),(a).end()
#define print(A,x,n) rep(i,0,n){cout<<(i ? " ":"")<<A[i]x;}cout<<endl;
#define pprint(A,y,m,n) rep(j,0,m){print(A[j],y,n);}
const long mod=1e9+7;
const int siz=2e5;
const long inf=1e9;
int main(){
	int X; cin>>X;
	cout<<10 - X/200<<endl;
}

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

ab.sort(key=lambda ab:ab[1])
ans=[ab[0]]
for i in range(1,m):
    if ans[-1][1]<=ab[i][0]:
        ans.append(ab[i])
print(len(ans))

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


int main() {
  int n, k, c;
  string s;
  cin>>n>>k>>c;
  cin>>s;

  vector<int> pos;
  for (int i=0; i<n; i++) {
    if (s[i] == 'o') {
      pos.push_back(i);
    }
  }
  map<int, int> left, right;
  for (int i: pos) {
    if (i - c - 1 < 0) {
      left[i] = 1;
    } else {
      auto it = left.upper_bound(i - c - 1);
      if (it == left.begin()) {
        left[i] = 1;
      } else {
        --it;
        left[i] = (*it).second + 1;
      }
    }
  }
  reverse(pos.begin(), pos.end());
  for (int i: pos) {
    if (i + c + 1< 0) {
      right[i] = 1;
    } else {
      auto it = right.lower_bound(i + c + 1);
      if (it == right.end()) {
        right[i] = 1;
      } else {
        right[i] = (*it).second + 1;
      }
    }
  }
  reverse(pos.begin(), pos.end());
  for (int i=0; i<pos.size(); i++) {
    int p = pos[i];
    if (left[p] + right[p] - 1 > k) {
      continue;
    }
    if (i > 0 && left[p] == left[pos[i-1]]) {
      continue;
    }
    if (i < pos.size() - 1 && right[p] == right[pos[i+1]]) {
      continue;
    }
    cout<<p+1<<endl;
  }
}

Measured memory_bytes: 21240
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <vector>
#include <map>
#include <functional>

using namespace std;
typedef long long int ll;

#define repi(i,a,b) for(ll i=a;i<b;i++)
#define rep(i,a) repi(i,0,a)
#define rrep(i,a) for(ll i=a-1;i>=0;i--)
#define MOD 1000000007

int main(){
  string S;
  cin >> S;
  S = "_" + S + "_";
  ll n = S.size();

  ll ABC = 0;
  ll A[n] = {}, q_f[n] = {}, AB[n] = {}, Aq_qB[n] = {}, qq_f[n] = {};
  ll C[n] = {}, q_b[n] = {}, BC[n] = {}, Bq_qC[n] = {}, qq_b[n] = {};

  repi(i, 1, n){
    ll a = S[i] == 'A';
    ll b = S[i] == 'B';
    ll c = S[i] == 'C';
    ll q = S[i] == '?';
    A[i] = A[i-1] + a;
    q_f[i] = q_f[i-1] + q;
    AB[i] = (AB[i-1] + A[i-1] * b) % MOD;
    Aq_qB[i] = (Aq_qB[i-1] + A[i-1] * q + q_f[i-1] * b) % MOD;
    qq_f[i] = (qq_f[i-1] + q_f[i-1] * q) % MOD;
    ABC = (ABC + AB[i-1] * c) % MOD;
  }

  rrep(i, n-1){
    ll b = S[i] == 'B';
    ll c = S[i] == 'C';
    ll q = S[i] == '?';
    C[i] = C[i+1] + c;
    q_b[i] = q_b[i+1] + q;
    BC[i] = (BC[i+1] + C[i+1] * b) % MOD;
    Bq_qC[i] = (Bq_qC[i+1] + b * q_b[i+1]  + q * C[i+1]) % MOD;
    qq_b[i] = (qq_b[i+1] + q_b[i+1] * q) % MOD;
  }

  ll pow_q = 1;
  rep(i, q_b[0]){
    if(i < q_b[0]-3) pow_q = pow_q * 3 % MOD;
    else pow_q *= 3;
  }
  ABC = ABC * pow_q % MOD;
  repi(i, 1, n-1){
    if(S[i] != '?') continue;
    ABC = (ABC + BC[i+1] * (pow_q / 3)) % MOD;
    ABC = (ABC + A[i-1] * C[i+1] * (pow_q / 3)) % MOD;
    ABC = (ABC + AB[i-1] * (pow_q / 3)) % MOD;
    ABC = (ABC + A[i-1] * q_b[i+1] * (pow_q / 9)) % MOD;
    ABC = (ABC + Bq_qC[i+1] * (pow_q / 9)) % MOD;
    ABC = (ABC + qq_b[i+1] * (pow_q / 27)) % MOD;
  }
  cout << ABC << endl;
  return 0;
}


Measured memory_bytes: 8316
#include<bits/stdc++.h>
using namespace std;
int n,i,j,a,c;
string s;
int main()
{
  for(i=1,cin>>n;i<=n;i++){
    for(c=0,j=i;j!=0;j/=10)c++;
    if(c&1)a++;
  }
  cout<<a;
}

Measured memory_bytes: 256
#include <stdio.h>
 
int main()
{
  int N;
  scanf("%d", &N);

  long long ans = 0;
  if ((N % 2) == 0)
  {
    ans = N / 2;
    ans *= (N-1);
  }
  else
  {
    ans = (N-1) / 2;
    ans *= N;
  }

  printf("%lld\n", ans);
  return 0;  
}

Measured memory_bytes: 128
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <cmath>
#include <vector>
#include <queue>
#include <ctime>
#include <stack>
#include <map>
#include <set>

using namespace std;

#define mian main
#define Max(x,y) (x>y ? x : y)
#define Min(x,y) (x<y ? x : y)
typedef long long ll;

int main()
{
	int n,r;
	scanf("%d%d",&n,&r);
	if(n>=10) printf("%d",r);
	else printf("%d",r+100*(10-n)); 
	return 0;
}











Measured memory_bytes: 256
#include <stdio.h>
#include <vector>
#include <algorithm>
#include <math.h>
#include <stack>

using namespace std;

struct Info{
	Info(){ left = height = 0;}
	Info(int arg_left,int arg_height){
		left = arg_left;
		height = arg_height;
	}
	int left,height;
};

int main(){

	int H,W,max_s,tmp,tmp_h;

	int** table = new int*[501];
	char** data = new char*[501];
	for(int i = 0; i < 501; i++){
		table[i] = new int[501];
		data[i] = new char[501];
	}

	stack<Info> S;
	Info work;

	while(true){
		scanf("%d %d",&H,&W);
		if(H == 0 && W == 0)break;

		for(int i = 0; i < W+1; i++)table[0][i] = 0;
		for(int i = 0; i < H+1; i++)table[i][W] = 0;

		max_s = 0;

		for(int i = 1; i <= H; i++){
			scanf("%s",data[i]);

			for(int k = 0; k < W; k++){
				if(data[i][k] == '.'){
					table[i][k] = table[i-1][k] + 1;
				}else{
					table[i][k] = 0;
				}
			}

			tmp_h = table[i][0];
			S.push(Info(0,tmp_h));

			for(int k = 1; k < W+1; k++){
				if(table[i][k] > tmp_h){
					S.push(Info(k,table[i][k]));
					tmp_h = table[i][k];
				}else if(table[i][k] == tmp_h){
					//Do nothing
				}else{
					while(S.empty() == false && S.top().height >= table[i][k]){
						work = S.top();
						S.pop();
						tmp = (k - work.left)*work.height;
						max_s = (max_s >= tmp)?max_s:tmp;
					}
					tmp_h = table[i][k];
					S.push(Info(work.left,table[i][k]));
				}
			}
		}
		while(!S.empty())S.pop();

		printf("%d\n",max_s);
	}
	return 0;
}

Measured memory_bytes: 3940
import java.util.Scanner;

public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int A = sc.nextInt();
		int B = sc.nextInt();
		int ans =A -(B*2);
		if(ans<0) {
		System.out.println(0);
		}else {
		System.out.println(ans);
		}
	}
}

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

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

Measured memory_bytes: 256
#define rep(x,y)for(int x=0;x<y;x++)
n,k,a[200009];
main(){
 scanf("%d%d",&n,&k);
 rep(i,n)scanf("%d",a+i);
 if(k>=50||k>=n){rep(i,n)printf("%d ",n);return 0;}
 while(k--){
  int b[200009]={0},s=0;
  rep(i,n){b[(i-a[i]>0?i-a[i]:0)]++;b[(n-1>i+a[i]?i+a[i]:n-1)+1]--;}
  rep(i,n){s+=b[i];a[i]=s;}
 }
 rep(i,n)printf("%d ",a[i]);
}

Measured memory_bytes: 3260
#include <bits/stdc++.h>
#define all(vec) vec.begin(), vec.end()
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
constexpr ll INF = (1LL << 40) - 1LL;
constexpr ll LINF = (1LL << 60) - 1LL;
constexpr double eps = 1e-9;
constexpr ll MOD = 1000000007LL;
template <typename T>
bool chmin(T& a, T b) {
    if(a > b) {
        a = b;
        return true;
    }
    return false;
};
template <typename T>
bool chmax(T& a, T b) {
    if(a < b) {
        a = b;
        return true;
    }
    return false;
};
template <typename T>
ostream& operator<<(ostream& os, vector<T> v) {
    for(int i = 0; i < v.size(); i++) {
        os << v[i] << (i + 1 == v.size() ? "\n" : " ");
    }
    return os;
}
template <typename T>
vector<T> make_v(size_t a) {
    return vector<T>(a);
}
template <typename T, typename... Ts>
auto make_v(size_t a, Ts... ts) {
    return vector<decltype(make_v<T>(ts...))>(a, make_v<T>(ts...));
}
template <typename T, typename V>
typename enable_if<is_class<T>::value == 0>::type fill_v(T& t, const V& v) {
    t = v;
}
template <typename T, typename V>
typename enable_if<is_class<T>::value != 0>::type fill_v(T& t, const V& v) {
    for(auto& e : t) {
        fill_v(e, v);
    }
};
int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int p, q, r;
    cin >> p >> q >> r;
    cout << p + q + r - max({p, q, r}) << endl;
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
using namespace std;
#define MAX_NODE 30

typedef struct Node {
    int Right, Left, Parent;
} Tree;

Tree T[MAX_NODE];
int n, D[MAX_NODE], H[MAX_NODE];

int getRoot(){
    Tree x = T[0];
    int id = 0;
    while(x.Parent != -1){
        id = x.Parent;
        x = T[id];
    }
    return id;
}

int getSibling(int i){
    if (T[i].Parent == -1) return -1;
    int par = T[i].Parent;
    if(T[par].Right != i) {
        return T[par].Right;
    }
	return T[par].Left;
}

int getDegree(int i){
    int cnt = 0;
    if(T[i].Right!=-1) cnt++;
    if(T[i].Left!=-1) cnt++;
    return cnt;
    return 0;
}

void setDepth(int id, int d){
    D[id] = d;
    if(T[id].Left != -1) setDepth(T[id].Left,d+1);
    if(T[id].Right != -1) setDepth(T[id].Right,d+1);
}

int setHeight(int id){
    int l,r;
    l = r = 0;
    if(T[id].Left != -1) l = setHeight(T[id].Left)+1;
    if(T[id].Right != -1) r = setHeight(T[id].Right)+1;
    return H[id] = max(l,r);
}

int main() {
    int i, j, idx;
    int root;
    cin >> n;
    for(i=0;i<n;i++) T[i].Parent = T[i].Left = T[i].Right = -1;
    for(i=0;i<n;i++) {
        cin >> idx;
        cin >> T[idx].Left >> T[idx].Right;
        if(T[idx].Left != -1) T[T[idx].Left].Parent = idx;
        if(T[idx].Right != -1) T[T[idx].Right].Parent = idx;
    }

    T[getRoot()].Parent = -1;
    root = getRoot();
    setDepth(root, 0);
    setHeight(root);
    
	for(i=0;i<n;i++){
		cout << "node " << i << ": ";
		cout << "parent = " << T[i].Parent << ", ";
		cout << "sibling = " << getSibling(i) << ", ";
		cout << "degree = " << getDegree(i) << ", ";
		cout << "depth = " << D[i] << ", ";
		cout << "height = "<< H[i] << ", ";
		if (T[i].Parent == -1){
			cout << "root";
		}else if(T[i].Left == -1 && T[i].Right == -1) {
			cout << "leaf";
		}else {
			cout << "internal node";
		}
        cout << endl;
	}

    return 0;
}

Measured memory_bytes: 3088
#define rep(i, n) for (int i = 0; i < (n); i++)
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int, int>;
const int MOD = 1000000007;
// MAX int 2,147,483,647 -> 10桁
// MAX ll 9,223,372,036,854,775,807 -> 19桁
// MAX O(n) 10^8 -> 8回
// double pi = M_PI or acos(-1)
// printf("%.10f\n", ans);

int main() {
    int n, k, q;
    cin >> n >> k >> q;
    vector<int> p(n, k - q);
    rep(i, q) {
        int a;
        cin >> a;
        --a;
        p[a]++;
    }
    rep(i, n) {
        if (p.at(i) <= 0) puts("No");
        else puts("Yes");
    }
    return 0;
}


Measured memory_bytes: 3776
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

		int a = 0;
		int[] c = new int[4];

		for (int i = 0; i < 6; i++) {
			a = sc.nextInt();

			if (a == 1)
				c[0]++;
			if (a == 2)
				c[1]++;
			if (a == 3)
				c[2]++;
			if (a == 4)
				c[3]++;
		}

		if (c[0] == 3 || c[1] == 3 || c[2] == 3 || c[3] == 3)
			System.out.println("NO");
		else
			System.out.println("YES");
	}

}


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

#include <math.h>
#include <stdlib.h>


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


int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    
    string s, t; cin >> s >> t;
    int a, b; cin >> a >> b;
    string u; cin >> u;
    if(u == s) a--;
    else b--;

    printf("%d %d\n", a, b);


    return 0;
}


Measured memory_bytes: 256
#pragma optimize ("O3")
#include <bits/stdc++.h>

using namespace std;

using ll = long long;

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

vector<int> divisor(int n) {
    vector<int> res;
    for (int i = 1; i * i <= n; i++) {
        if (n % i == 0) {
            res.emplace_back(i);
            if (i != n / i) res.emplace_back(n / i);
        }
    }
    return res;
}

map<int, int> prime_factor(int n) {
    map<int, int> res;
    for (int i = 2; i * i <= n; i++) {
        while (n % i == 0) {
            ++res[i];
            n /= i;
        }
    }
    if (n != 1) res[n] = 1;
    return res;
}

vector<int> sieve(int n) {
    vector<int> res;
    vector<bool> is_prime(n + 1, true);
    is_prime[0] = false;
    is_prime[1] = false;
    for (int i = 2; i <= n; i++) {
        if (!is_prime[i]) continue;
        res.emplace_back(i);
        for (int j = 2 * i; j <= n; j += i) is_prime[j] = false;
    }
    return res;
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    vector<ll> s(n);
    for (int i = 0; i < n; i++) {
        cin >> s[i];
    }

    vector< vector<int> > vv(n);
    //int counter = 0;
    for (int i = 1; i < n - 1; i++) {
        for (int j = i; j < n; j += i) {
            vv[j].push_back(i);
            //counter++;
        }
    }
    //cerr << counter << endl;

    ll ans = 0;
    for (int x = 1; x < n - 2; x++) {
        int y = x;
        ll sum = 0;
        while (y < n) {
            int z = n - 1 - y;
            int a = z, b = z - x;
            if (b <= 0 || a <= b || (a % x == 0 && a / x <= (n - 1 - a) / x)) break;
            sum += s[y] + s[z];
            ans = max(ans, sum);
            y += x;
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 11392
#ifndef _WIN32
#include<iostream>
#endif
#include<string>
#include<vector>
#include<algorithm>
#include<queue>
using namespace std;

#define FOR(i,bg,ed) for(int i=(bg);i<(ed);i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(),(v).end()
typedef vector<string> VS;
VS wrap(VS v,char c) {
	int R = v.size(), C = v[0].size();
	VS ret(R + 2, string(C + 2, c));
	REP(i, R)REP(j, C)ret[i + 1][j + 1] = v[i][j];
	return ret;
}
int res ;
const int dr[] = { 0,0,1,-1 };
const int dc[] = { 1,-1,0,0 };

void f(int r, int c,VS&x) {
	if (x[r][c] == '#')return;
	res++;
	x[r][c] = '#';
	REP(i, 4) {
		f(r + dr[i], c + dc[i], x);
	}
}
int main() {
	int R, C;
	while (cin >> C >> R, R + C) {
		VS in(R);
		REP(i, R)cin >> in[i];
		in = wrap(in, '#');
		int sr, sc;
		REP(i, R + 2)REP(j, C + 2)if (in[i][j] == '@')sr = i, sc = j;
		res = 0;
		f(sr, sc, in);
		cout << res << endl;

	}
}

Measured memory_bytes: 3128
#!/usr/bin/python3
# -*- coding: utf-8 -*-
x = input()
if x == "a":
    print("b")
if x == "b":
    print("c")
if x == "c":
    print("d")
if x == "d":
    print("e")
if x == "e":
    print("f")
if x == "f":
    print("g")
if x == "g":
    print("h")
if x == "h":
    print("i")
if x == "i":
    print("j")
if x == "j":
    print("k")
if x == "k":
    print("l")
if x == "l":
    print("m")
if x == "m":
    print("n")
if x == "n":
    print("o")
if x == "o":
    print("p")
if x == "p":
    print("q")
if x == "q":
    print("r")
if x == "r":
    print("s")
if x == "s":
    print("t")
if x == "t":
    print("u")
if x == "u":
    print("v")
if x == "v":
    print("w")
if x == "w":
    print("x")
if x == "x":
    print("y")
if x == "y":
    print("z")

Measured memory_bytes: 3064
#include <iostream>
#include <stdio.h>
#include <algorithm>
#include <vector>
#include <queue>
#include <numeric>
#include <string>
#include <string.h>
#include <map>
#include <set>
#include <functional>
#include <complex>

using namespace std;

const int INF = (1<<30) - 1;


int main(){
    //ios::sync_with_stdio(false);
    //cin.tie(0);
    const int MAX_N = 300000;
    bool is_prime[MAX_N];
    vector<int> primes;
    memset(is_prime, true, sizeof(is_prime));
    for(int i=6; i<MAX_N; i++){
        if((i%7 == 1 || i%7 == 6) && is_prime[i]){
            primes.push_back(i);
            for(int j=i*2; j<MAX_N; j+=i)
                is_prime[j] = false;
        }
    }
    
    int N;
    while(cin>>N, N!=1){
        cout << N << ":";
        for(auto p: primes){
            if(N%p == 0)
                cout << " " << p;
        }
        cout << endl;
    }
    return 0;
}

Measured memory_bytes: 1644
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int n[] = new int[a];
		for(int i = 0; i < a; i++){
			n[i] = sc.nextInt();
		}
		int b[] = new int[a];
		int cnt;
		int m = 0;
		for(int i = a - 1; i >= 0; i--){
			cnt = 0;
			for(int j = 2; (i+1) * j <= a; j++){
				if(b[((i+1) * j)-1] == 1){
					cnt++;
				}
			}
			if((cnt + n[i]) % 2 == 0){
				b[i] = 0;
			}
			else{
				b[i] = 1;
				m++;
			}
		}
		System.out.println(m);
		for(int i = 0; i < a; i++){
			if(b[i] == 1){
				System.out.print(i+1 + " ");
			}
		}
	}
}


Measured memory_bytes: 86864
#include <bits/stdc++.h>
using namespace std;
/*{{{*/  //template
#define REP(i,n) for(int i=0;i<n;i++)
#define rep(i,n) for(int i=0;i<n;i++)
#define INF 1<<29
#define LINF LLONG_MAX/3
#define MP make_pair
#define PB push_back
#define EB emplace_back
#define ALL(v) (v).begin(),(v).end()
#define all(v) ALL(v)
#define debug(x) cerr<<#x<<":"<<x<<endl
#define debug2(x,y) cerr<<#x<<","<<#y":"<<x<<","<<y<<endl
#define CININIT cin.tie(0),ios::sync_with_stdio(false)
template<typename T> ostream& operator<<(ostream& os,const vector<T>& vec){ os << "["; for(const auto& v : vec){ os << v << ","; } os << "]"; return os; }
template<typename T,typename U> ostream& operator<<(ostream& os,const pair<T,U>& p){ os << "(" << p.first << ","<< p.second <<")"; return os; }
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
ll gcd(ll a,ll b){ if(b==0) return a; else return gcd(b,a%b); }
 
constexpr ll mod = 1e9+7;
const int dx[]={1,0,-1,0} ,dy[] = {0,1,0,-1};
/*}}}*/

int main(){
    string s;
    cin>>s;
    for(int i=0;i<s.size();i++){
        if(i==5 or i==13){
            s[i] = ' ';
        }
    }
    cout << s << endl;
}


Measured memory_bytes: 256
use std::io::*;
use std::str::FromStr;

fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char) 
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

fn main() {
    let N: i32 = read();
    let A: i32 = read();
    let B: i32 = read();

    let mut ans = 0;

    for i in 1..N+1 {
        let mut tmp = 0;
        let mut t = i;
        while t > 0 {
            tmp += t%10;
            t /= 10;
        }
        if A <= tmp && tmp <= B {
            ans += i;
        }
    }

    println!("{}", ans);
}


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

int main(){
	int N,K,h;
  	cin >> N >> K;
  	int cnt=0;
  	for(int i=0; i<N; i++){
    	cin >> h;
      	if(h>=K){
        	cnt++;
        }
    }
    cout << cnt << endl;
}

Measured memory_bytes: 3576
#include<bits/stdc++.h>
using namespace std;
typedef		long long       ll;
typedef		vector<ll>      vll;
#define		pb              push_back
string intostr(int x)
{
    stringstream ss;
    ss << x;
    string str = ss.str();
    return str;
}

char Uplowch(char ch){if(ch >= 'A' &&  ch <= 'Z') ch += 32; return ch;}
char Lowupch(char ch){if(ch >= 'a' &&  ch <= 'z') ch -= 32; return ch;}
bool Isalpha(char ch){if((ch >= 'A' && ch <= 'Z') || (ch >= 'a' && ch <= 'z')) return true; return false;}
int Strtoint(string str){stringstream ss(str);int x = 0;ss >> x ;return x ;}
string Intostr(int x){stringstream ss; ss << x; string str = ss.str(); return str;}

#define		PB              pop_back
#define		nn              "\n"
#define		all(p)          p.begin(),p.end()
#define		zz(v)           (ll)v.size()
#define		ss              ' '
#define 	S(a)            scanf("%lld",&a)
#define 	SS(a,b)         scanf("%lld %lld",&a,&b)
#define 	SSS(a,b,c)      scanf("%lld %lld %lld",&a,&b,&c)
#define		gcd(a,b)        __gcd(a,b)
#define		lcm(a,b)        (a*b)/gcd(a,b)
#define		pi              acos(-1.0)

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

int dx[] = {0 , 0 , -1 , 1} ; // right , left , forward , backward
int dy[] = {1 , -1 , 0 , 0} ;

//bool check(int x , int y) {
//    if(x <= n && y <= m && x >= 1 && y >= 1)
//        return 1 ;
//    return 0 ;
//}

int main()
{
     //freopen("in.txt","r",stdin);

     ios::sync_with_stdio(0);
	cin.tie(0);

	ll n;
	ll flag=0;
	cin>>n;
	ll ans=0;
	for(ll i=1;i<=n;i++)
    {
        if(i%3!=0&&i%5!=0) ans+=i;
    }
    cout<<ans<<nn;




}



Measured memory_bytes: 3660
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <deque>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <iomanip>
#include <bitset>
#include <set>
#include <map>
#include <stdio.h>
#include <numeric>
#include <cstring>

#define rep(i,n) for (int i = 0; i < (n); i++)
#define rep1(i,n) for (int i = 1; i < (n); i++)
#define FOR(i,a,b) for (int i=(a); i < (b); i++)
#define MOD 1000000007 //10^9+7
#define ALL(a)  (a).begin(),(a).end()
using namespace std;
using ll = long long;
using PII = pair<int, int>;
using PLL = pair<long long, long long>;
const int INF = numeric_limits<int>::max();
constexpr ll TEN(int n) { return (n==0) ? 1 : 10*TEN(n-1); }

// 負の数にも対応した % 演算
long long mod(long long val, long long m) {
    long long res = val % m;
    if (res < 0) res += m;
    return res;
}

//greatest common divisor
long long gcd(ll a, ll b) 
{
    if (a % b == 0) {
        return b;
    } else {
        return gcd(b, a % b);
    }
}

//least common multiple
long long lcm(ll a, ll b)
{
    return a / gcd(a, b) * b ;
}

bool is_prime(ll n) {
    for (ll i = 2; i * i <= n; i++) {
        if (n % i == 0) return false;
    }
    return n != 1;
}

vector<vector<int>> d(10, vector<int>(10, 1000000));

void warshall_floyd(int n) {
    rep(k,n) rep(i,n) {
        rep(j,n) {
            d[i][j] = min(d[i][j], d[i][k]+d[k][j]);
        }
    }
}

int main()
{
    int n, tmp; cin >> n;
    vector<PLL> a;
    rep(i,n) {
        cin >> tmp;
        a.push_back(make_pair(tmp, i));
    }

    sort(a.begin(), a.end());
    ll ans = 0, mindiff = INF;
    rep(i,n-1) {
        tmp = abs((a[n-1].first+1)/2 - a[i].first);
        if (tmp < mindiff) {
            mindiff = tmp;
            ans = a[i].first;
        }
    }

    cout << a[n-1].first << " " << ans << endl;
    return 0;
}


Measured memory_bytes: 5380
#include <iostream>
#include <fstream>
#include <string>
#include <unordered_map>
#include <stdio.h>
#include <list>
#include <vector>
#include <algorithm>
#include <stack>
#include <climits>
#include <cmath>
#include <map>
#include <queue>
using namespace std;
#define rep(i, n) for(int i = 0; i < n; ++i)
#define ALL(v) v.begin(), v.end()
typedef long long ll;

int main()
{
	int n;
	cin >> n;
	vector<int> h(n);
	rep(i,n)cin>>h[i];
	
	int ans = 0;
	rep(i,n)
	{
		int mi = 101;
		int m;
		rep(j,n)if(h[j]>0)if(h[j]<mi){mi=h[j];m=j;};
		//cout<<m<<endl;
		if(mi!=101)ans += mi;
		for(int j = m-1;j>=0;j--)
		{
			if(h[j]-h[m]>=0)
			{
				h[j]-=h[m];
			}
			else break;
		}
		for(int j = m + 1;j<n;j++)
		{
			if(h[j]-h[m]>=0)
			{
				h[j]-=h[m];
			}
			else break;
		}
		h[m]=0;

		//rep(i,n)cout<<h[i]<<' ';cout<<endl;
	}
	
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
strn = input()
n = int(strn)
head = strn[0]
if(n <= int(head*len(strn))):
    print(int(head*len(strn)))
elif(int(head) <= 8):
    print(int(str(int(head)+1)*len(strn)))
else:
    print(int("1"*(len(strn)+1)))

Measured memory_bytes: 3060
#include<cstdio>
#include<iostream>
#include<cstring>
#include<algorithm>
#include<queue>
#include<stack>
#include<vector>
#include<map>
#include<set>
#define MAX 300005
using namespace std;

typedef long long ll;
int a[MAX];
int main()
{
	int a,b;
	cin>>a>>b;
	if(b%a==0)
	{
		cout<<a+b<<endl;
	}
	else
	{
		cout<<b-a<<endl;
	}
	return 0;
 } 

Measured memory_bytes: 256
class Monster:
    def __init__(self, name, life, attack):
        self.name = name
        self.life = life
        self.attack = attack

    def damaged(self, a):
        self.life -= a
        return self.life > 0

#return Winner
def battle(A, B):
    while True:
        if not B.damaged(A.attack):
            return A.name
        if not A.damaged(B.attack):
            return B.name

def main():
    a, b, c, d = map(int, input().split())
    A = Monster('takahashi', a, b)
    B = Monster('aoki', c, d)
    Winner = battle(A, B)
    ans = 'Yes' if Winner == 'takahashi' else 'No'
    print(ans)

if __name__ == '__main__':
    main()

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

using namespace std;

int n,m,i,j,a[200005],cnt[200005],p[200005];

int main(){
	scanf("%d%d", &n, &m);
	
	for(i = 1; i <= n; i++){
		scanf("%d", &a[i]);
		cnt[a[i]]++;
	}
	
	int res = 0;
	
	for(i = 1; i <= n; i++){
		for(j = 0; j < cnt[i]; j++){
			int to = i - j;
			if(to <= 0) continue;
			p[to]++;
		}
	}
	
	for(i = 1; i <= n; i++){
		if(p[i] == 0)
		res++;
	}
	
	for(i = 0; i < m; i++){
		int x,y;
		scanf("%d%d", &x, &y);
		
		cnt[a[x]]--;
	
		if(a[x] - cnt[a[x]] > 0){
			p[a[x] - cnt[a[x]]]--;
			if(p[a[x] - cnt[a[x]]] == 0)
			res++;
		}
		
		a[x] = y;
		
		if(a[x] - cnt[a[x]] > 0){
			if(p[a[x] - cnt[a[x]]] == 0)
			res--;
			p[a[x] - cnt[a[x]]]++;
			
		}
		cnt[a[x]]++;
		
		printf("%d\n", res);
	}
}


Measured memory_bytes: 3712
using System;
using System.Linq;

class Program {
    static void Main(string[] args) {
        int W = Cin.Ni();
        int a = Cin.Ni();
        int b = Cin.Ni();

        Console.WriteLine(Math.Max(Math.Max(a, b) - (Math.Min(a, b) + W), 0));

    }
}


public class Cin {
    private static string[] s = new string[0];
    private static int i = 0;

    private static char[] cs = new char[] { ' ' };

    public static string Next() {
        if (i < s.Length) return s[i++];
        string st = Console.ReadLine();
        while (st == "") st = Console.ReadLine();
        s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
        i = 0;
        return Next();
    }

    public static int Ni() {
        return int.Parse(Next());
    }

    public static long NextLong() {
        return long.Parse(Next());
    }

    public static double NextDouble() {
        return double.Parse(Next());
    }

}


Measured memory_bytes: 11092
#include<bits/stdc++.h>
using namespace std;
int main(){
ios_base::sync_with_stdio(0);
cin.tie(NULL);

int N,K;
cin>>N>>K;

  vector<int> hr(N);
  long long ans=0;
  if(K>N){ cout<<ans; return 0;}
  
  
  for(int i=0;i<N;i++){
    int input;
    cin>>input;
    hr[i] = input;
  }
  
  sort(hr.begin(),hr.end());
  // 0 1 2 3 4
  for (int i = 0; i < N-K; i++)
  {
      ans += hr[i];
  }
  
  cout<<ans;
  return 0;
}

Measured memory_bytes: 1024
#include <iostream>
#include <vector>
#include <cstdlib>

using namespace std;

int main(int argc, const char * argv[]) {
    vector<int> v;  //長さが0のベクトル
    int a, b ;
    int c;
    int count = 0;
    int big;
    int x;
    
    cin >> a >> b;
    
    for (int i = 0; i < 1000; i++) {
        v.push_back(i);
        v[i] = (count+=i);
    }
    c = abs(a - b);
    if (a > b) {
        big = a;
    }
    else {
        big =b;
    }
    x = abs(v[c] - big);
    cout << x << endl;
    
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define N 
#define pii pair<int,int>
#define fi first
#define se second
#define mp make_pair
#define pb push_back
using namespace std;
template<typename T>
inline void in(T &x)
{
	x=0;
	char c=getchar();
	bool fu=0;
	while(c<'0'||c>'9'){if(c=='-')fu=1;c=getchar();}
	while(c>='0'&&c<='9')x=(x<<1)+(x<<3)+(c^48),c=getchar();
	x=fu?-x:x;
}
int n,m;
string s;
int main()
{
	cin>>s;
	if(s=="RRR")puts("3");
	else if(s=="RRS"||s=="SRR")puts("2");
	else if(s=="SSS")puts("0");
	else puts("1");
	return 0;
}

Measured memory_bytes: 3588
N = int(input())
H = list(map(int, input().split()))
l = 0
ans = 0
while l < N:
    r = l+1
    now = H[l]
    tmp = 0
    while r < N and now >= H[r]:
        tmp += 1
        now = H[r]
        r += 1
        
    l = r
    ans = max(ans, tmp)
print(ans)

Measured memory_bytes: 14252