akhauriyash/Code-Regression huggingface dataset:
import collections

k = int(input())

lst = [k + 1] * k

q = collections.deque([1])
lst[1] = 1

while q:
    a = q.pop()
    if lst[a * 10 % k] > lst[a]:
        lst[a * 10 % k] = lst[a]
        q.append(a * 10 % k)
    if lst[(a + 1) % k] >= lst[a] + 1:
        lst[(a + 1) % k] = lst[a] + 1
        q.appendleft((a + 1) % k)

print(lst[0])

Measured memory_bytes: 6084
def warshal_floyd(d, n):
    for k in range(n):
        for i in range(n):
            for j in range(n):
                d[i][j] = min(d[i][j], d[i][k]+d[k][j])
    return d


H, W = list(map(int, input().split()))
maze = [[0 for _ in range(W)] for _ in range(H)]
location = []
for i in range(H):
    for j, s in enumerate(list(input())):
        s = 1 if s == '.' else 0
        maze[i][j] = s
        location.append((i,j))

# 隣接行列
d = [[float('inf') for _ in range(H*W)] for _ in range(H*W)]

# 隣接行列の作成
for i in range(H*W):
    for j in range(H*W):
        # iからjへ行けたら1とする
                 
        # i == j は0とする
        if i == j:
            d[i][j] = 0

        # i, jの情報
        x_i, y_i = location[i]
        x_j, y_j = location[j]
        # 上下左右以外は考慮しない
        if abs(x_i - x_j) + abs(y_i - y_j) == 1 and abs(x_i - x_j) * abs(y_i - y_j) == 0:
            # どちらも.であればOK
            if maze[x_i][y_i] == 1 and maze[x_j][y_j] == 1:
                d[i][j] = 1

d = warshal_floyd(d, H*W)

m = 0
for i in range(H * W):
    for j in range(H * W):
        if d[i][j] != float('inf'):
            m = max(m, d[i][j])

print(m)
    

            


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

#define ul unsigned long long
#define ll long long

int main()
{
  int gra[8][8];
  fill(gra[0],gra[0]+64,0);
  size_t n,m,ca,cb;
  cin>>n>>m;
  for (size_t i = 0; i < m; i++)
  {
    cin>>ca>>cb;
    ca--,cb--;
    gra[ca][cb] = 1;
    gra[cb][ca] = 1;
  }

  size_t pat[8]={0,1,2,3,4,5,6,7};
  ul ct=0;
  do {
    ul cj=1;
    for (size_t i = 1; i < n; i++)
    {
      if (!gra[pat[i-1]][pat[i]]) {
        cj=0;
        break;
      }
    }
    ct+=cj;
  } while (next_permutation(&pat[1],pat+n));

  cout<<ct<<endl;

  return 0;
}


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

int main(){
    int N,M;cin >> N >> M;
    vector<pair<LL,LL>> vec;
    for(int a = 0;a < N;a++){
        int b,c;cin >> b >> c;
        vec.push_back({b,c});
    }
    LL ans = 0;
    LL now = 0;
    sort(vec.begin(),vec.end());
    for(auto a : vec){
        if(now + a.second >= M){
            ans += a.first*(M-now);
            break;
        }else{
            ans += a.first*a.second;
            now += a.second;
        }
    }
    cout<<ans<<endl;
}



Measured memory_bytes: 2548
import sys,collections,math;sys.setrecursionlimit(10**7)
def Is(): return [int(x) for x in sys.stdin.readline().split()]
def Ss(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def S(): return input()

n,m = Is()
Xs = sorted(Is())
dist = []
if n > m:
    print(0)
    exit()
for i in range(m-1):
    dist.append(Xs[i+1]-Xs[i])
print(sum(sorted(dist)[:m-n]))

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

using namespace std;

using ll = long long;
using pii = pair<int,int>;
using pll = pair<ll,ll>;
using vi = vector<int>;
using vl = vector<ll>;

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

#define CHMIN(a,b) (a)=min((a),(b))
#define CHMAX(a,b) (a)=max((a),(b))
#define ALL(v) (v).begin(),(v).end()

#define DEBUG(x) cerr<<#x<<": "<<(x)<<endl
#define DEBUG_VEC(v) cerr<<#v<<": ";REP(__i,(v).size())cerr<<((v)[__i])<<", ";cerr<<endl

const ll MOD = 1000000007ll;

int n,W;
int pr[125];
vector<pii> g[125];
int sz[125];
int hchild[125];

bool used[125];

int szdfs(int p, int bef){
    sz[p] = 1;
    hchild[p] = -1;
    for(pii P : g[p]){
        int to = P.first;
        if(to==bef)continue;
        if(used[to])continue;
        int ss = szdfs(to,p);
        sz[p] += ss;
        if(hchild[p]==-1 || ss > sz[hchild[p]]){
            hchild[p] = to;
        }
    }
    return sz[p];
}
int r,root;
void grdfs(int p, int bef){
    int x = sz[root] - sz[p];
    for(pii P : g[p]){
        int to = P.first;
        if(to==bef)continue;
        if(used[to])continue;
        grdfs(to,p);
        CHMAX(x, sz[to]);
    }
    if(2*x <= sz[root]){
        r = p;
    }
}

ll answer = 0;

vl dfs(int p, int bef, int w, vl X){
    if(sz[p]==1){
        int s = X.size();
        int ns = min(W,s-1+w);
        vl ret(ns+1,0);
        REP(i,s)if(i+w<=ns)ret[i+w] = X[i]+pr[p];
        return ret;
    }else{
        vl ret = X;
        for(pii P : g[p]){
            int to = P.first;
            if(to==bef)continue;
            if(used[to])continue;
            int nw = P.second;
            vl V = dfs(to,p,nw,ret);
            while(ret.size() < V.size())ret.push_back(0);
            REP(i,ret.size())CHMAX(ret[i], V[i]);
        }
        int s = ret.size();
        int ns = min(W,s-1+w);
        vl tret(ns+1,0);
        REP(i,s)if(i+w<=ns)tret[i+w] = ret[i]+pr[p];
        return tret;
    }
}

void ddfs(int p, int bef){
    szdfs(p,bef);
    root=p; r = p;
    grdfs(p,bef);
    vl init(1,0);
    vl ans = dfs(r,-1,0,init);
    used[r] = true;
    CHMAX(answer, *max_element(ALL(ans)));
    for(pii P : g[r]){
        int to = P.first;
        if(to==bef)continue;
        if(used[to])continue;
        ddfs(to,r);
    }
}

int main(){
    scanf("%d%d",&n,&W);
    REP(i,n)scanf("%d",pr+i);
    REP(i,n-1){
        int u,v,c;
        scanf("%d%d%d",&u,&v,&c);
        --u; --v;
        g[u].push_back(pii(v,c));
        g[v].push_back(pii(u,c));
    }
    REP(i,n)CHMAX(answer, (ll)pr[i]);
    // int root = 0;
    // szdfs(root,-1);
    ddfs(0,-1);
    printf("%lld\n", answer);
    return 0;
}



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

int main() {
  string s;
  cin >> s;
  int x, y;
  cin >> x >> y;
  int i = 0;
  while (i <= s.size()) {
    if (i == s.size() || s[i] == 'T') {
      x -= i;
      break;
    }
    i++;
  }
  vector<int> dist[2];
  int idx = 0;
  int cur_dist = 0;
  while (i < s.size()) {
    if (s[i] == 'T') {
      if (cur_dist != 0) {
        dist[idx].push_back(cur_dist);
      }
      idx = 1 - idx;
      cur_dist = 0;
    } else {
      cur_dist++;
    }
    i++;
  }
  if (cur_dist != 0) {
    dist[idx].push_back(cur_dist);
  }
  bool feasible = true;
  for (int j = 0; j < 2; j++) {
    vector<bool> possible(16001, false);
    possible[0 + 8000] = true;
    for (int k = 0; k < dist[j].size(); k++) {
      vector<bool> possible2(16001, false);
      int offset = dist[j][k];
      for (int l = -8000; l <= 8000; l++) {
        if (possible[l + 8000]) {
          if (l - offset >= -8000) {
            possible2[l - offset + 8000] = true;
          }
          if (l + offset <= 8000) {
            possible2[l + offset + 8000] = true;
          }
        }
      }
      possible = possible2;
    }
    if (j == 0 && (x < -8000 || x > 8000 || !possible[x + 8000])) feasible = false;
    if (j == 1 && !possible[y + 8000]) feasible = false;
  }
  if (feasible) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
  return 0;
}

Measured memory_bytes: 256
import sys
n, x, y = [int(x) for x in input().split()]
ks = [0] * n
m = (x + y) // 2
for i in range(1, x + 1):
    for j in range(i + 1, n + 1):
        if j <= x:
            ks[j - i] += 1
        elif x < j < y:
            ks[min(j - i, y - j + 1 + x - i)] += 1
        else:
            ks[j - y + 1 + x - i] += 1
for i in range(x + 1, y + 1):
    for j in range(i + 1, n + 1):
        if j <= y:
            ks[min(j - i, i - x + y - j + 1)] += 1
        else:
            ks[min(j - i, i - x + 1 + j - y)] += 1
for i in range(y + 1, n + 1):
    for j in range(i + 1, n + 1):
        ks[j - i] += 1
for c in ks[1:]:
    print(c)


Measured memory_bytes: 3572
#include <iostream>
#include <sstream>
#include <cstdio>
#include <iomanip>
#include <cmath>
#include <cstring>
#include <cctype>
#include <string>
#include <vector>
#include <list>
#include <set>
#include <unordered_set>
#include <map>
#include <unordered_map>
#include <queue>
#include <iterator>
#include <stack>
#include <algorithm>
#include <functional>
using namespace std; 
#define DEBUG(x) cout << '>' << #x << ':' << x << endl;
#define REP(i,n) for(int i=0;i<(n);i++)
#define FOR(i,a,b) for(int i=(a);i<=(b);i++)
#define FORD(i,a,b) for(int i=(a);i>=(b);i--)
#define ff first
#define ss second
#define END "\n"
#define pb push_back
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
inline bool EQ(double a, double b) { return fabs(a-b) < 1e-9; }
const int INF = 1<<29;
typedef long long ll;
typedef vector<int> vi;
typedef unsigned long long ull;
typedef pair<int,int> ii;
typedef vector<ii> vii;
inline int two(int n) { return 1 << n; }
inline int test(int n, int b) { return (n>>b)&1; }
inline void set_bit(int & n, int b) { n |= two(b); }
inline void unset_bit(int & n, int b) { n &= ~two(b); }
inline int last_bit(int n) { return n & (-n); }
inline int ones(int n) { int res = 0; while(n && ++res) n-=n&(-n); return res; }
template<class T> void chmax(T & a, const T & b) { a = max(a, b); }
template<class T> void chmin(T & a, const T & b) { a = min(a, b); }
/////////////////////////////////////////////////////////////////////
int main()
{
    fast
    int n, i, j;
    long double p[3000], ans = 0;
    long double dp[3000][3000] = {0};
    cin >> n;
    dp[0][0] = 1;
    dp[0][1] = 0;
    for (i = 1; i <= n; i++)
    {
        cin >> p[i];
        dp[i][0] = dp[i - 1][0] * (1 - p[i]);
    }
    // for (i = 0; i < n; i++)
    // cout << p[i] << " ";
    for (i = 0; i <= n; i++)
    {
        for (j = 1; j <= i; j++)
        {
            dp[i][j] = p[i] * dp[i - 1][j - 1] + (1 - p[i]) * dp[i - 1][j];
        }
    }
    // for (i = 0; i <= n; i++)
    // {
    //     for (j = 0; j <= n; j++)
    //     {
    //         cout << dp[i][j] << " ";
    //     }
    //     cout << END;
    // }
    for (i = 0; i <= n; i++)
    {
        if (i > (n / 2))
        {
            ans += dp[n][i];
        }
    }
    cout << setprecision(10);
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 140928
#include<iostream>
using namespace std;
int main(){
    int n, m, l, a, b;
    int A[101][101] = {};
    int B[101][101] = {};
    long C[101][101] = {};
    
    cin >> n >> m >> l;
    for(int i = 1; i <= n; i++){
        for(int j = 1; j <= m; j++){
            cin >> a;
            A[i][j] = a;
        }
    }
    for(int i = 1; i <= m; i++){
        for(int j = 1; j <= l; j++){
            cin >> b;
            B[i][j] = b;
        }
    }
    for(int i = 1; i <= l; i++){
        for(int j = 1; j <= n; j++){
            for(int k = 1; k <= m; k++){
                C[j][i] += A[j][k] * B[k][i];
            }
            
        }
    }
   
    for(int i = 1; i <= n; i ++){
        for(int j = 1; j <= l; j++){
            if( j != 1){
                cout << " ";
            }
            cout << C[i][j];
        }
        cout << endl;
    }
    
    return 0;
}


Measured memory_bytes: 3272
K = int(input())

a = [7 % K]
if a[-1] == 0:
    print(1)
    exit()

for i in range(1, K+1):
    n = a[-1] * 10 + 7
    r = n % K
    a.append(r)
    if r == 0:
        print(i+1)
        exit()
print(-1)
exit()


Measured memory_bytes: 140620
#include <bits/stdc++.h>
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define maxn	500005
#define inf		int(21e8)
#define mod		int(1e9+7)
#define db		double
#define ll		long long
#define si 		stack<int>
#define qi 		queue<int>
#define vi 		vector<int>
#define pi 		pair<int, int>
#define pq  	priority_queue< int, vector<int>, greater<int> >
using namespace std;
ll powmod(ll a, ll b) {
	ll res = 1; a %= mod;
	for (; b; b >>= 1)
		res = (res * ((b & 1) ? a : 1)) % mod,
		a = a * a % mod;
	return res;
}
ll gcd(ll a, ll b) {
	return b ? gcd(a, b) : a;
}
int main() {
	ll n, num, ans = 0;
	cin >> n;
	for(int i = 1; i <= n; i ++) {
		num = 1ll * n / i;
		ans += (i + i * num) * num / 2;
	}
	cout << ans << endl;
	system("pause");
	return 0;
}

Measured memory_bytes: 3696
package main

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

func main() {
	sc := NewScanner()

	a := sc.NextInt()
	if a%2 == 0 {
		fmt.Printf("%+v\n", (a/2)*(a/2)) // output for debug
		return
	}
	fmt.Printf("%+v\n", (a+1)/2*(a-1)/2) // output for debug
	return

}

type Scanner struct {
	r   *bufio.Reader
	buf []byte
	p   int
}

func NewScanner() *Scanner {
	rdr := bufio.NewReaderSize(os.Stdin, 1000)
	return &Scanner{r: rdr}
}
func (s *Scanner) Next() string {
	s.pre()
	start := s.p
	for ; s.p < len(s.buf); s.p++ {
		if s.buf[s.p] == ' ' {
			break
		}
	}
	result := string(s.buf[start:s.p])
	s.p++
	return result
}
func (s *Scanner) NextLine() string {
	s.pre()
	start := s.p
	s.p = len(s.buf)
	return string(s.buf[start:])
}
func (s *Scanner) NextInt() int {
	v, _ := strconv.Atoi(s.Next())
	return v
}

func (s *Scanner) NextIntArray() []int {
	s.pre()
	start := s.p
	result := []int{}
	for ; s.p < len(s.buf); s.p++ {
		if s.buf[s.p] == ' ' {
			v, _ := strconv.Atoi(string(s.buf[start:s.p]))
			result = append(result, v)
			start = s.p + 1
		}
	}
	v, _ := strconv.Atoi(string(s.buf[start:s.p]))
	result = append(result, v)

	return result
}

func (s *Scanner) NextMap() map[int]bool {
	s.pre()
	start := s.p
	mp := map[int]bool{}
	for ; s.p < len(s.buf); s.p++ {
		if s.buf[s.p] == ' ' {
			v, _ := strconv.Atoi(string(s.buf[start:s.p]))
			mp[v] = true
			start = s.p + 1
		}
	}
	v, _ := strconv.Atoi(string(s.buf[start:s.p]))
	mp[v] = true

	return mp
}

func (s *Scanner) pre() {
	if s.p >= len(s.buf) {
		s.readLine()
		s.p = 0
	}
}
func (s *Scanner) readLine() {
	s.buf = make([]byte, 0)
	for {
		l, p, e := s.r.ReadLine()
		if e != nil {
			panic(e)
		}
		s.buf = append(s.buf, l...)
		if !p {
			break
		}
	}
}


Measured memory_bytes: 640
N = int(input())
t,a = map(int,input().split(" "))
for i in range(N-1):
	T,A = map(int,input().split(" "))
	if a % A == 0:
		pla = a // A
	else:
		pla = (a + (A - a % A)) // A

	if t % T == 0:
		plt = t // T
	else:
		plt = (t + (T - t % T)) // T
	t = max(pla,plt) * T
	a = max(pla,plt) * A

print(t+a)


Measured memory_bytes: 3060
import java.util.Scanner;

class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		while(true){
			int n = sc.nextInt();
			if(n==0)break;
			int asum = 0;int bsum = 0;
			for(int i = 0;i < n;++i){
				int a = sc.nextInt();
				int b = sc.nextInt();
				if(a<b){
					bsum += (a+b);
				}
				else if(a>b){
					asum +=(a+b);
				}
				else{
					asum += a;
					bsum += b;
				}
			}
			System.out.println(asum+" "+bsum);
		}
	}
}

Measured memory_bytes: 59764
// Author: droftware
#include <bits/stdc++.h>

#define forn(i,a,n) for(int i=a;i<(int)n;i++)
#define DRT()  int t; cin>>t; while(t--)

#define TRACE
#ifdef TRACE
#define trace1(x)                cerr << #x << ": " << x << endl;
#define trace2(x, y)             cerr << #x << ": " << x << " | " << #y << ": " << y << endl;
#define trace3(x, y, z)          cerr << #x << ": " << x << " | " << #y << ": " << y << " | " << #z << ": " << z << endl;
#define trace4(a, b, c, d)       cerr << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " << c << " | " << #d << ": " << d << endl;
#define trace5(a, b, c, d, e)    cerr << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " << c << " | " << #d << ": " << d << " | " << #e << ": " << e << endl;
#define trace6(a, b, c, d, e, f) cerr << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " << c << " | " << #d << ": " << d << " | " << #e << ": " << e << " | " << #f << ": " << f << endl;
#else
#define trace1(x)
#define trace2(x, y)
#define trace3(x, y, z)
#define trace4(a, b, c, d)
#define trace5(a, b, c, d, e)
#define trace6(a, b, c, d, e, f)
#endif
using namespace std;

const int N = 3e3+5;

double dp[N][N];
double p[N];
int main(){
	ios_base::sync_with_stdio(0);
	cin.tie(NULL);
	int n;
	cin>>n;
	forn(i,1,n+1){
		cin>>p[i];
	}
	dp[1][0] = 1 - p[1];
	dp[1][1] = p[1];
	forn(i,2,n+1){
		forn(j,0,i+1){
			dp[i][j] = dp[i-1][j]*(1-p[i]) + (j-1 >= 0 ? dp[i-1][j-1]*p[i] : 0);
		}
	}
	double res = 0;
	forn(i,n/2+1,n+1){
		res += dp[n][i];
	}
	cout<<setprecision(10)<<res<<endl;

}
	
	



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

const int maxn = 2e5 + 10;

int n;
int a[maxn];

long long calc(int id) {
	long long res = 0;
	for (int i = 1; i <= n; ++i) res += abs(a[i] - a[id]);
	return res;
}

int main() {
	ios_base::sync_with_stdio(0); cin.tie(NULL);
	cin >> n;
	for (int i = 1; i <= n; ++i) {
		cin >> a[i];
		a[i] -= i;
	}
	sort(a + 1, a + n + 1);
	long long total = min(calc(n / 2), calc((n + 1) / 2));
	cout << total << "\n";
	return 0;
}

Measured memory_bytes: 1024
#!/usr/bin/env python3
# -*- coding: utf-8 -*-


def main():
    N = int(input())
    A = list(map(int, input().split()))
    for a in A:

        if a % 2 == 0:
            if a % 3 == 0 or a % 5 == 0:
                continue
            else:
                print('DENIED')
                exit(0)

    print('APPROVED')


if __name__ == "__main__":
    main()


Measured memory_bytes: 2940
import heapq
n,m=map(int,input().split())
ab=[[0]*2 for _ in range(n)]


for i in range(n):
    ab[i]=list(map(int,input().split()))
ab.sort()
hq=[]
tmp=0
ans=0
for i in range(1,m+1):
    while tmp<n and ab[tmp][0]==i:
        heapq.heappush(hq,-ab[tmp][1])
        tmp+=1
    if hq:
        ans-=heapq.heappop(hq)
print(ans)


Measured memory_bytes: 78444
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxx = 2e5 + 7;
const int Inf = 1 << 30;
const ll INF = 1ll << 60;
char s[maxx];

int main() {
	scanf("%s", s + 1);
	int n = strlen(s + 1);
	bool flg = 1;
	for(int i = 1; i <= n; i++) {
		if(s[n - i + 1] != s[i]) {
			flg = 0;
			break;
		}
	}
	for(int i = 1; i <= (n - 1) / 2; i++) {
		int id = (n - 1) / 2 - i + 1;
		if(s[i] != s[id]) {
			flg = 0;
			break;
		}
	}
	for(int i = (n + 3) / 2; i <= n; i++) {
		int id = n - i + (n + 3) / 2;
		if(s[i] != s[id]) {
			flg = 0;
			break;
		}
	}
	if(flg) puts("Yes");
	else puts("No");
	return 0;
}

Measured memory_bytes: 256
//----->|try=0; while(!success) try++;|<------
//----->|Belief Yourself,Respect Yourself|<----
//----->|Be Proud Of Yourself,You're Doing Your best|<-----
#include<bits/stdc++.h>
using namespace std;
#define uniq(x)  x.erase(unique(x.begin(),x.end()), x.end()) //Unique value find from vector
#define upper(arr,n,fixed) upper_bound(arr,arr+n,fixed)-arr  //Upper value search;
#define lower(arr,n,fixed) upper_bound(arr,arr+n,fixed)-arr  //Lower value search;
#define max3(a,b,c) max(max(a,b),c)//maximum value find three value;
#define min3(a,b,c) min(min(a,b),c)//minimum value find three value;
#define rep(i,intial,n) for(int i=intial; i<(n) ; i++)
#define REP(i,intial,n) for(int i=intial; i<=(n) ; i++)
#define PI acos(-1.0)//PI Calculation
#define LL long long
#define AND(a,b) ((a) & (b))
#define OR(a,b) ((a)|(b))
#define XOR(a,b) ((a) ^ (b))
#define MP make_pair
#define sqr(x) ((x)*(x))
#define sqrt(x) sqrt(1.0*(x))
#define INF_MAX 2147483647
#define INF_MIN -2147483647
#define MX 1000005
#define MOD 1000000007
template<typename T> T POW(T b,T p)          //Pow calculation
{
    T r=1;
    while(p)
    {
        if(p&1)r=(r*b);
        b=(b*b);
        p>>=1;
    }
    return r;
}

template<typename T> T BigMod(T b,T p,T m) //BigMod Calculation
{
    T r=1;
    while(p)
    {
        if(p&1)r=(r*b)%m;
        b=(b*b)%m;
        p>>=1;
    }
    return r;
}

//||--------------------------->||Main_Code_Start_From_Here||<---------------------------------||
int main()
{
    //freopen("a.in", "r", stdin);
    //freopen("a.out", "w", stdout);
    string s;
    while(cin>>s) cout<<s.substr(0,5)<<" "<<s.substr(6,7)<<" "<<s.substr(14,5)<<endl;

}


Measured memory_bytes: 256
#include <iostream>
#include <cstring>
#include <algorithm>
#include <vector>
#include <string>
#include <math.h>
#include <iomanip>
#include <limits>
#include <list>
#include <queue>
#include <tuple>
#include <map>
using namespace std;
#define MOD (long long int)(1e9+7)
#define ll long long int
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define reps(i,n) for(int i=1; i<=(int)(n); i++)
#define REP(i,n) for(int i=n-1; i>=0; i--)
#define REPS(i,n) for(int i=n; i>0; i--)
#define INF (int)(1123456789)
#define LINF (long long int)(112345678901234567)
#define chmax(a, b) a = (((a)<(b)) ? (b) : (a))
#define chmin(a, b) a = (((a)>(b)) ? (b) : (a))
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
#define PB push_back
#define SP << " " <<

typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<ll> VL;
typedef vector<VL> VLL;

__attribute__((constructor))
void initial(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed <<setprecision(15);
}


int main(void){
	int N;
    VL X, L;
    VLL RL;
    cin >> N;
    rep(i,N){
        ll x,l;
        VL rl;
        cin >> x >> l;
        X.PB(x);
        L.PB(l);
        rl.PB(x+l);
        rl.PB(x-l); 
        RL.PB(rl);
    }

    
    sort(all(RL));

    int ans = 1;
    ll a = RL[0][0];

    rep(i,N){
        if(RL[i][1] >= a){
            ans ++;
            a = RL[i][0];
        }
    }

    /*rep(i,N){
        cout << RL[i][0] SP RL[i][1] << endl;
    }*/
    cout << ans << endl;  



    return 0;
}


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

//int _; 

int n;
long long cnt[10000000],ans=0;

int main()
{
	//for(scanf("%d",&_);_;_--)
	scanf("%d",&n);
	for(int i=1;i<n;i++)
		cnt[i]=0;
	for(int i=1;i <= 1e7;i++)
		for(int j=i;j <= 1e7;j += i)
			if(j <= n)
				cnt[j-1]++;
	for(int i=0;i<n;i++)
		ans += cnt[i]*(i+1);
	printf("%lld\n",ans);
	return 0;
}





Measured memory_bytes: 81932
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define ll long long
#define rep(i,l,r)for(ll i=(l);i<(r);i++)
#define repp(i,l,r,k)for(ll i=(l);i<(r);i+=(k))
#define INF ((1LL<<62)-(1LL<<31))
#define max(p,q)((p)>(q)?(p):(q))
#define min(p,q)((p)<(q)?(p):(q))
#define bit(n,m)(((n)>>(m))&1)
int upll(const void*a, const void*b){return*(ll*)a<*(ll*)b?-1:*(ll*)a>*(ll*)b?1:0;}
int downll(const void*a, const void*b){return*(ll*)a<*(ll*)b?1:*(ll*)a>*(ll*)b?-1:0;}
void sortup(ll*a,int n){qsort(a,n,sizeof(ll),upll);}
void sortdown(ll*a,int n){qsort(a,n,sizeof(ll),downll);}
ll pom(ll a,ll n,int m){ll x=1;for(a%=m;n;n/=2)n&1?x=x*a%m:0,a=a*a%m;return x;}
//#define MOD 998244353
#define MOD 1000000007
#define invp(a,p)pom(a,p-2,p)
//辺の情報を個別に持つタイプ

ll n,m;
ll a[99];
int main(){
	scanf("%lld%lld",&n,&m);
	rep(i,0,m){
		ll k;
		scanf("%lld",&k);
		ll s=0;
		rep(j,0,k){
			ll temp;
			scanf("%lld",&temp);
			s^=1<<(temp-1);
		}
		a[i]=s;
	}
	ll ss=0;
	rep(i,0,m){
		ll temp;
		scanf("%lld",&temp);
		ss^=temp<<i;
	}
	
	ll ans=0;
	rep(i,0,1<<n){
		ll flag=1;
		rep(j,0,m){
			ll s=0;
			rep(k,0,n)if(bit(a[j],k)&&bit(i,k))s^=1;
			if(s!=bit(ss,j))flag=0;
		}
		ans+=flag;
	}
	printf("%lld",ans);
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
#define FOR(i,a,b) for(ut i=(a);i<(ut)(b);i++)
#define REP(i,b) FOR(i,0,b)
#define ALL(c) c.begin(),c.end()
#define PB push_back
#define cat //cout << __LINE__ << endl;
using namespace std;
typedef long long LL;
typedef double ld;
typedef LL ut;
typedef vector<ut> VI;
typedef pair<ut,ut> pr;
typedef vector<pr> Vpr;
typedef pair<ut,ut> prs;
const int SIZE=1e5;
int minium[SIZE];
int main(){
	int N;
	cin >> N;
	string s;	
	REP(i,'z'-'a'+1) minium[i]=1000;
	REP(i,N){
		int now[30]={};
		cin >> s;
		REP(j,s.size()){
			now[s[j]-'a']++;
		}
		REP(j,'z'-'a'+1){
			minium[j]=min(minium[j],now[j]);
		}
	}
	string ans;
	REP(i,'z'-'a'+1){
		REP(j,minium[i])
		ans+=i+'a';
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <cmath>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <string>
#include <string.h>
#include <vector>

using namespace std;

#define REP(i,x) for(int i{ 0 }; i < (int)(x); i++)
#define REPC(i,x) for(int i{ 0 }; i <= (int)(x); i++)
#define RREP(i,x) for(int i{ (int)(x) - 1 }; i >= 0 ;i--)
#define RREPC(i,x) for(int i{ (int)(x)}; i >= 0; i--)
#define REP1O(i,x) for(int i{ 1 }; i < (int)(x); i++)
#define REP1C(i,x) for(int i{ 1 }; i <= (int)(x); i++)
#define REPIT(i,x) for(auto i{(x).begin()}; i != (x).end(); i++)

#define PB push_back
#define MP make_pair
#define SZ(x) ((int)(x).size())
#define ALL(x) (x).begin(),(x).end()

typedef int64_t ll;
typedef double dbl;
typedef vector<bool> Vb;
typedef vector<int> Vi;
typedef vector<ll> Vl;
typedef vector<string> Vs;
typedef vector<vector<int> > VVi;
typedef vector<vector<ll> > VVl;

template<class T> inline bool chmax(T& a, const T& b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, const T& b) { if (b < a) { a = b; return 1; } return 0; }
inline void swap(ll& a, ll& b) { a ^= b; b ^= a; a ^= b; }
inline void swap(int& a, int& b) { a ^= b; b ^= a; a ^= b; }
inline void YES() { cout << "YES" << endl; } inline void Yes() { cout << "Yes" << endl; }
inline void NO() { cout << "NO" << endl; } inline void No() { cout << "No" << endl; }

const int inf = 1 << 28;
const ll linf = 1LL << 60;
const int MOD = 1000000007;



int main()
{
	int a, b;
	cin >> a >> b;
	if (a > 9 || b > 9 || a < 1 || b < 1)
	{
		cout << -1 << endl;
		return 0;
	}

	cout << a * b << endl;
}


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

int main()
{
  int x;
  cin >> x;
  if(x>=400 && x<=599)
    cout << "8" << endl;
  else if(x>=600 && x<=799)
    cout<< "7" << endl;
  else if(x>=800 && x<=999)
    cout<< "6" << endl;
  else if(x>=1000 && x<=1199)
    cout<< "5" << endl;
  else if(x>=1200 && x<=1399)
    cout<< "4" << endl;
  else if(x>=1400 && x<=1599)
    cout<< "3" << endl;
  else if(x>=1600 && x<=1799)
    cout<< "2" << endl;
  else if(x>=1800 && x<=1999)
    cout<< "1" << endl;
  
  return 0;
}

Measured memory_bytes: 3668
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <climits>
#include <ctime>
#include <cassert>
using namespace std;

#define rep(i,a,n) for(int (i)=(a); (i)<(n); (i)++)
#define repq(i,a,n) for(int (i)=(a); (i)<=(n); (i)++)
#define repr(i,a,n) for(int (i)=(a); (i)>=(n); (i)--)
#define all(v) begin(v), end(v)
#define pb(a) push_back(a)
#define fr first
#define sc second
#define INF 2000000000

#define X real()
#define Y imag()
#define EPS (1e-10)
#define EQ(a,b) (abs((a) - (b)) < EPS)
#define EQV(a,b) ( EQ((a).X, (b).X) && EQ((a).Y, (b).Y) )
#define LE(n, m) ((n) < (m) + EPS)
#define LEQ(n, m) ((n) <= (m) + EPS)
#define GE(n, m) ((n) + EPS > (m))
#define GEQ(n, m) ((n) + EPS >= (m))

typedef vector<int> VI;
typedef vector<VI> MAT;
typedef pair<int, int> pii;
typedef long long ll;

typedef complex<double> P;
typedef pair<P, P> L;
typedef pair<P, double> C;

int dy[]={0, 0, 1, -1};
int dx[]={1, -1, 0, 0};
int const MOD = 1000000007;

namespace std {
    bool operator<(const P& a, const P& b) {
        return a.X != b.X ? a.X < b.X : a.Y < b.Y;
    }
}

// ?§?????????¨????????¨???????????????????¨???????????§???????
template <typename T>
struct Edge {
    int from, to;
    T cost;
    Edge(int s, T d) : to(s), cost(d) {}
    Edge(int f, int s, T d) : from(f), to(s), cost(d) {}

    bool operator<(const Edge &e) const {
        return cost < e.cost;
    }
    bool operator>(const Edge &e) const {
        return cost > e.cost;
    }
};

template <typename T>
vector<T> dijkstra(vector< vector< Edge<T> > > &G, int s) {
    int V = G.size();
    vector<T> d(V); fill(d.begin(), d.end(), INF);
    priority_queue<pii, vector<pii>, greater<pii> > que;
    d[s] = 0;
    que.push(pii(0,s));

    while(!que.empty()) {
        pii p = que.top(); que.pop();
        int v = p.second;
        if(d[v] < p.first) continue;
        for(int i=0; i<G[v].size(); i++) {
            Edge<T> e = G[v][i];
            if(d[e.to] > d[v] + e.cost) {
                d[e.to] = d[v] + e.cost;
                que.push(pii(d[e.to], e.to));
            }
        }
    }
    return d;
}

template <typename T>
vector<T> treeHeight(vector< vector< Edge<T> > > &G) {
    int n = G.size();
    vector<T> v1, v2, v3, ret(n);
    int p1, p2;
    v1 = dijkstra<T>(G, 0);
    p1 = max_element(v1.begin(), v1.end()) - v1.begin();

    v2 = dijkstra<T>(G, p1);
    p2 = max_element(v2.begin(), v2.end()) - v2.begin();

    v3 = dijkstra<T>(G, p2);
    for(int i=0; i<n; i++) ret[i] = max(v2[i], v3[i]);
    return ret;
}

signed main() {
    int n; cin >> n;
    vector< vector< Edge<int> > > G(n);
    int s, t, w;
    rep(i,0,n-1) {
        cin >> s >> t >> w;
        G[s].pb(Edge<int>(t,w));
        G[t].pb(Edge<int>(s,w));
    }

    vector<int> ans = treeHeight<int> (G);
    rep(i,0,ans.size()) cout << ans[i] << endl;
    return 0;
}

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

int main(void){
    string a;
    int b=0;
    cin >> a ;

    if (a[0]  == '1') b++;
    if (a[1] == '1') b++;
    if (a[2] == '1') b++;
        cout << b << endl;
}


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

using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;

ll C[20000];

int main(){
    ll N;
    cin >> N;
    for(int x=1;x<=100;x++){
        for(int y=1;y<=100;y++){
            for(int z=1;z<=100;z++){
                ll t = x*x+y*y+z*z+x*y+y*z+z*x;
                if(t<=15000) C[t]++;
            }
        }
    }
    for(int i=1;i<=N;i++) cout << C[i] << endl;
    return 0;
}

Measured memory_bytes: 3712
#include<bits/stdc++.h>
#define MAX 10
#define inf 1<<29
#define linf 1e16
#define eps (1e-8)
#define mod 1000000007
#define pi acos(-1)
#define phi (1.0+sqrt(5))/2.0
#define f first
#define s second
#define mp make_pair
#define pb push_back
#define all(a) (a).begin(),(a).end()
#define pd(a) printf("%.10f\n",(double)(a))
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define RFOR(i,a,b) for(int i=(a)-1;(b)<=i;i--)
#define equals(a,b) (fabs((a)-(b))<eps)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef pair<int,double> pid;
typedef pair<double,int> pdi;
typedef vector<int> vi;
typedef vector<pii> vpi;
const int dx[8]={1,0,-1,0,1,1,-1,-1};
const int dy[8]={0,1,0,-1,1,-1,1,-1};

int n,m;
vector<int> g[MAX];
int ans=0;

void dfs(int v,int bits){
  if(bits==(1<<n)-1)ans++;
  else {
    FOR(i,0,g[v].size()){
      int next=g[v][i];
      if(bits&(1<<next))continue;
      dfs(next,bits|(1<<next));
    }
  }
}

int main()
{
  cin>>n>>m;
  FOR(i,0,m){
    int a,b;
    cin>>a>>b;
    a--;b--;
    g[a].pb(b);
    g[b].pb(a);
  }
  dfs(0,1);
  cout<<ans<<endl;
  return 0;
}



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

typedef pair<int, int> P;

int main() {
	int K;
	bool B[100000] = {};
	deque<P> DQ;
	cin >> K;
	DQ.push_back(P(1, 1));
	while (1) {
		P p = DQ.front();
		DQ.pop_front();
		B[p.first] = true;
		if (p.first % K == 0) {
			cout << p.second;
			return 0;
		}
		if (!B[(p.first * 10) % K]) DQ.push_front(P((p.first * 10) % K, p.second));
		if (!B[(p.first + 1) % K]) DQ.push_back(P((p.first + 1) % K, p.second + 1));
	}
}

Measured memory_bytes: 896
#include<cstdio>
#include<vector>
#define MAXN 100000
int n,m;
int fa[MAXN+5];
long long dist[MAXN+5];
void Init()
{
	for(int i=1;i<=n;i++)
		fa[i]=i;
}
int Find(int x)
{
	if(fa[x]==x)
		return x;
	int y=-1;
	if(fa[fa[x]]!=fa[x])
		y=fa[x];
	fa[x]=Find(fa[x]);
	if(y!=-1)
		dist[x]+=dist[y];
	return fa[x];
}
void UnionSet(int i,int j,int w)
{
	int x=Find(i),y=Find(j),a=dist[i],b=dist[j];
	dist[y]=a+w-b;
	fa[y]=x;
}
bool Same(int i,int j)
{
	return Find(i)==Find(j);
}
int main()
{
	scanf("%d%d",&n,&m);
	Init();
	int u,v,w;
	for(int i=0;i<m;i++)
	{
		scanf("%d%d%d",&u,&v,&w);
		if(Same(u,v))
		{
			if(dist[v]-dist[u]!=w)
			{
				printf("No\n");
				return 0;
			}
		}
		else UnionSet(u,v,w);
	}
	printf("Yes\n");
}

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

# define REP(i,n) for (int i=0;i<(n);++i)
# define PER(i,n) for (int i=(N-1);i>=0;--i)
# define rep(i,a,b) for(int i=a;i<(b);++i)
# define p(s) std::cout << s ;
# define pl(s)  std::cout << s << endl;
# define printIf(j,s1,s2) cout << (j ? s1 : s2) << endl;
# define YES(j) cout << (j ? "YES" : "NO") << endl;
# define Yes(j) std::cout << (j ? "Yes" : "No") << endl;
# define yes(j) std::cout << (j ? "yes" : "no") << endl;
# define all(v) v.begin(),v.end()
# define showVector(v) REP(i,v.size()){p(v[i]);p(" ")} pl("")
template<class T> inline bool chmin(T &a, T b){ if(a > b) { a = b; return true;} return false;}
template<class T> inline bool chmax(T &a, T b){ if(a < b) { a = b; return true;} return false;}
typedef long long int ll;
typedef pair<ll,ll> P_ii;
typedef pair<double,double> P_dd;

template<class T>
vector<T> make_vec(size_t a){
    return vector<T>(a);
}

template<class T, class... Ts>
auto make_vec(size_t a, Ts... ts){
  return vector<decltype(make_vec<T>(ts...))>(a, make_vec<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);
}


const int MOD = 1000000007;
const int inf=1e9+7;
const ll longinf=1LL<<60 ;

void addM(long long &a, long long b) {
    a += b;
    if (a >= MOD) a -= MOD;
}

void mulM(long long &a, long long b) {
    a = ((a%MOD)*(b%MOD))%MOD ;
}

const int MAX = 510000;
long long fac[MAX], finv[MAX], inv[MAX];

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

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

vector<pair<long long, long long> > prime_factorize(long long n) {
    vector<pair<long long, long long> > res;
    for (long long p = 2; p * p <= n; ++p) {
        if (n % p != 0) continue;
        int num = 0;
        while (n % p == 0) { ++num; n /= p; }
        res.push_back(make_pair(p, num));
    }
    if (n != 1) res.push_back(make_pair(n, 1));
    return res;
}

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

    int N = 0;
    while(pow(2, N) <= L) N++;

    vector<int> a, b, c;
    for(int i = 1; i < N; i++){
        a.push_back(i);
        b.push_back(i + 1);
        c.push_back(0);

        a.push_back(i);
        b.push_back(i + 1);
        c.push_back(pow(2, i - 1));
    }

    for(int i = N - 1;i >= 1; i--){
        if(pow(2, N - 1) <= L - pow(2, i - 1)) {
            a.push_back(i);
            b.push_back(N);
            c.push_back(L - pow(2, i - 1));

            L -= pow(2, i - 1);
        }
    }

    cout << N << " " << a.size() << endl;
    REP(i, a.size()) printf("%d %d %d\n", a[i], b[i], c[i]);

    return 0;
}

Measured memory_bytes: 256
import java.util.*;
import java.io.*;
public class Main{
/// functions
static long gcd(long a,long b){if(b==0){return a;}return gcd(b,a%b);}
static long Modpow(long a,long p,long m){if(p==1){return a;}long x=Modpow(a,p/2,m);x=(x*x)%m;return (p&1l)!=0? (x*a)%m:x;}
static long Modmul(long a,long b,long m){return ((a%m)*(b%m))%m;}
static long ModInv(long a,long m){return Modpow(a,m-2,m);}
static long nck(int n,int r,long m){if(r>n){return 0l;}return Modmul(f[n],ModInv(Modmul(f[n-r],f[r],m),m),m);}
// end
static long[] f;
static long help(long k){
	if(k<=1){return 1;}
	long x=help(k/2);
	return 2*x+1;
}
public static void main(String[] args) throws FileNotFoundException, IOException{
       Scanner s=new Scanner(System.in);
       StringBuilder sb=new StringBuilder();
       BufferedWriter out=new BufferedWriter(new OutputStreamWriter(System.out));
       int n=s.nextInt(),k=s.nextInt();
        int[] arr=new int[n+1];
        for(int i=1;i<=n;i++){arr[i]=s.nextInt();}
        	Arrays.sort(arr);
        long res=0;
        for(int i=1;i<=Math.max(n-k,0);i++){
        	res+=arr[i];
        }
       out.write(res+"");
        out.flush();
  }
}


Measured memory_bytes: 64952
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ull unsigned long long
#define pii pair<int, int>
#define pb push_back
#define mk make_pair
#define fi first
#define se second
#define ALL(A) A.begin(), A.end()
#define sqr(x) ((x)*(x))
#define sc(x) scanf("%d", &x)
#define pr(x) printf(">>>"#x":%d\n", x)
#define fastio ios::sync_with_stdio(0),cin.tie(0)
#define debug cout<<">>>STOP"<<endl
template<class T> T gcd(T a, T b){if(!b)return a;return gcd(b,a%b);}
const int maxn = 1e5+10;
int a[maxn];

int main()
{
    int n; sc(n);
    for(int i = 1; i <= n; i++)sc(a[i]);
    int ans = 0;
    for(int i = 1; i <= n;){
        int j = 1;
        while(i+j <= n && a[i] == a[i+j])j++;
        ans += j/2;
        i += j;
    }
    printf("%d\n", ans);
    return 0;
}



Measured memory_bytes: 256
#include <iostream>


using namespace std;

long long dp[101][100001];
 
int main() {
    
    int N,W;
    int w[101], v[101];
    cin >> N >> W;
    for(int i=1; i<=N; ++i) cin >> w[i] >> v[i];
    
    for(int j=0; j<=W; ++j) dp[0][j] = 0;
    
    for(int i=1; i<=N; ++i) {
        for(int j=0; j<=W; ++j) {
            if(j >= w[i]) dp[i][j] = max(dp[i-1][j], dp[i-1][j-w[i]] + v[i]);
            else dp[i][j] = dp[i-1][j];
        }
    }
    cout << dp[N][W] << endl;
    
    return 0;
}

Measured memory_bytes: 79104
#include<bits/stdc++.h>
using namespace std;
int main()
{
  int k,n;
  cin>>k>>n;
vector<int>a(n);
int i,ma=0,mi;
  for(i=0;i<n;i++)
    cin>>a[i];
  for(i=1;i<n;i++)
  {
    if(a[i]-a[i-1]>ma)
      ma=a[i]-a[i-1];
  }
  if(k+a[0]-a[n-1]>ma)
    ma=k+a[0]-a[n-1];
  cout<<k-ma;
    
}


Measured memory_bytes: 1152
N, M, K = map(int, input().split())
ok = False
for i in range(N + 1):
    for j in range(M + 1):
        num = (i * M) + (j * N) - i * j * 2
        if num == K:
            ok = True
if ok:
    print('Yes')
else:
    print('No')


Measured memory_bytes: 2940
#include <stdio.h>

int main() {

    int n, r, ans;

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

    if(n < 10) {
        ans = r + 100 * (10 - n);
        printf("%d\n", ans);
    }
    else {
        printf("%d\n", r);
    }
    
    return 0;
}

Measured memory_bytes: 128
// Dmitry _kun_ Sayutin (2019)

#include <bits/stdc++.h>

using std::cin;
using std::cout;
using std::cerr;

using std::vector;
using std::map;
using std::array;
using std::set;
using std::string;

using std::pair;
using std::make_pair;

using std::tuple;
using std::make_tuple;
using std::get;

using std::min;
using std::abs;
using std::max;
using std::swap;

using std::unique;
using std::sort;
using std::generate;
using std::reverse;
using std::min_element;
using std::max_element;

#ifdef LOCAL
#define LASSERT(X) assert(X)
#else
#define LASSERT(X) {}
#endif

template <typename T>
T input() {
    T res;
    cin >> res;
    LASSERT(cin);
    return res;
}

template <typename IT>
void input_seq(IT b, IT e) {
    std::generate(b, e, input<typename std::remove_reference<decltype(*b)>::type>);
}

#define SZ(vec)         int((vec).size())
#define ALL(data)       data.begin(),data.end()
#define RALL(data)      data.rbegin(),data.rend()
#define TYPEMAX(type)   std::numeric_limits<type>::max()
#define TYPEMIN(type)   std::numeric_limits<type>::min()

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

    // code here
    int n, m, k;
    cin >> n >> m >> k;

    int r, c;
    cin >> r >> c;

    --r, --c;

    string s, t;
    cin >> s >> t;
    
    for (char dir: {'L', 'R', 'U', 'D'}) {
        int pos, dim;
        char antidir;
        
        if (dir == 'R')
            pos = c, dim = m, antidir = 'L';
        else if (dir == 'L')
            pos = m - 1 - c, dim = m, antidir = 'R';
        else if (dir == 'D')
            pos = r, dim = n, antidir = 'U';
        else if (dir == 'U')
            pos = n - 1 - r, dim = n, antidir = 'D';
        else
            assert(false);

        for (int i = 0; i != k; ++i) {
            if (s[i] == dir)
                ++pos;

            if (pos == dim) {
                cout << "NO\n";
                return 0;
            }

            if (t[i] == antidir)
                pos = max(0, pos - 1);
        }
    }

    cout << "YES\n";
    
    return 0;
}


Measured memory_bytes: 920
#include<iostream>

using namespace std;

int main(){
  int temp=0;
  int ans=1;
  int n,x,l[101];
  
  cin >> n >> x;
  
  for(int i=0;i<n;i++){
    cin >> l[i];
    temp += l[i];
    if(x >= temp) ans ++;
  }
  
  
  cout << ans << endl;
  
  return 0;
}

Measured memory_bytes: 256
import java.util.*;
public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    int[] a = new int[n];
    int count = 0;
    for(int i = 0;i<n;i++){
      a[i] = sc.nextInt();
      while(a[i]%2==0){
        a[i]/=2;
        count++;
      }
    }
    System.out.println(count);
  }
}


Measured memory_bytes: 48736
#include<cstdio>
#include<cmath>
#include<stdlib.h>
#include<algorithm>
#include<string> 
#include<iostream>

using namespace std;

int main(){
	int n,t=1;
	string num,ans;
	scanf("%d",&n);cin.ignore();
		for(int gv=0;gv<n;gv++){
			getline(cin,num);
			t=1;
   				 	for(int a=0;a<26&&t;a++){
   				 	if((a+1)%2==0&&a!=13){
   				 	for(int b=0;b<26&&t;b++){
   				 		ans.erase(ans.begin(),ans.end());
   				 		for(int i=0;num[i]!='\0';i++){
   				 			if(num[i]>='a'&& num[i]<='z'){
   				 				ans.push_back((a*(num[i]-'a')+b)%26+'a');
							}
							else{
								ans.push_back(num[i]);
							}
						}
   				 		 ans.push_back('\0');
						t=1;
						for(int i=0;ans[i]!='\0';i++){
     			           if(ans[i]=='t' && ans[i+1]=='h'){
                    			if(ans[i+2]=='i'&&ans[i+3]=='s')t=0;
                 				if(ans[i+2]=='a'&&ans[i+3]=='t')t=0;
                 			}
                 		}
					 }}}
   			for(int i=0;ans[i]!='\0';i++){
   				printf("%c",ans[i]);
			}printf("\n");
	}
	return 0;
}

Measured memory_bytes: 3196
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <ctime>
#include <cstring>
#include <functional>
#include <iostream>
#include <iomanip>
#include <limits>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <regex>
#include <vector>

#define fix(n)          cout<<fixed<<setprecision(n)
#define rep(i,n)        for (int i = 0; i < (n); ++i)
#define all(a)          (a).begin(), (a).end()
#define sort(a)         sort(all(a))
#define uniq(a)         sort(a);(a).erase(unique(all(a)), (a).end())
#define reverse(a)      reverse(all(a))
#define ctos(c)         string(1, (c))
#define out(d)          cout << (d)
#define outl(d)         std::cout<<(d)<<"\n"
#define YES()           cout << "YES" << endl
#define NO()            cout << "NO" << endl
#define Yes()           cout << "Yes" << endl
#define No()            cout << "No" << endl
#define ceil(x, y)      ((x + y - 1) / (y))
#define debug(x)        cerr << #x << ": " << (x) << '\n'
#define debug2(x, y)    cerr << #x << ": " << (x) << ", " << #y << ": " << (y) << '\n'
#define debug3(x, y, z) cerr << #x << ": " << (x) << ", " << #y << ": " << (y) << ", " << #z << ": " << (z) << '\n'
#define dbg(v)          for (size_t _ = 0; _ < v.size(); ++_){ cerr << #v << "[" << _ << "] : " << v[_] << '\n'; }
#define pb              push_back
#define fst             first
#define int             long long
#define INF             __LONG_LONG_MAX__

using namespace std;
using ll = long long;
using ld = long double;
using P = pair<ll,ll>;

const ll MOD = 1000000007; // 10^9 + 7
const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};

struct UnionFind {
  vector<int> par;
    
  UnionFind(int n) : par(n, -1) { }

  int root(int x) {
    if (par[x] < 0) return x;
    else return par[x] = root(par[x]);
  }
    
  bool same(int x, int y) {
    return root(x) == root(y);
  }
  
  void merge(int x, int y) {
    x = root(x); y = root(y);
    if (x == y) return;
    if (par[x] > par[y]) swap(x, y); // merge technique
    par[x] += par[y];
    par[y] = x;
  }
    
  int size(int x) {
    return -par[root(x)];
  }
};

template<class T>
void outvo(vector<T> v) {
  if (v.size() == 0) return;
  cout << v[0];
  for (int i = 1; i < v.size(); i++)
    cout << " " << v[i];
  cout << endl;
}

void solve() {
  ll N, M, K; cin >> N >> M >> K;
  UnionFind uf(N);
  vector<set<ll>> dame(N);

  rep(i, M) {
    ll a, b; cin >> a >> b;
    a--; b--;
    dame[a].insert(b);
    dame[b].insert(a);
    uf.merge(a, b);
  }
  rep(i, K) {
    ll c, d; cin >> c >> d;
    c--; d--;
    if (uf.same(c, d)) {
      dame[c].insert(d);
      dame[d].insert(c);
    }
  }

  vector<ll> ans(N);
  rep(i, N) ans[i] = uf.size(i) - dame[i].size() - 1;

  outvo(ans);
}

signed main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  srand((unsigned)time(NULL));
  fix(12);

  solve();
}


Measured memory_bytes: 24320
import sys
sys.setrecursionlimit(10**5)
n, m = list(map(int, input().split()))
ab = [list(map(int, input().split())) for i in range(m)]

ans = n * (n - 1) // 2
result = [ans]
leader = [-1] * n
size = [1] * n


def leader_check(i):
    if leader[i] == -1:
        return i
    ln = leader_check(leader[i])
    leader[i] = ln
    return ln

for a, b in ab[:0:-1]:
    a, b = a - 1, b - 1
    la = leader_check(a)
    lb = leader_check(b)
    if la != lb:
        leader[la] = lb
        ans -= size[la] * size[lb]
        size[lb] += size[la]
    result.append(ans)

for i in result[::-1]:
    print(i)


Measured memory_bytes: 46624
production = True

import sys, math, collections

def input(input_format = 0, multi = 0):

    if multi > 0: return [input(input_format) for i in range(multi)]
    else:
        next_line = sys.stdin.readline()[:-1]

        if input_format >= 10:
            use_list = False
            input_format = int(str(input_format)[-1])
        else: use_list = True

        if input_format == 0: formatted_input = [next_line]
        elif input_format == 1: formatted_input = list(map(int, next_line.split()))
        elif input_format == 2: formatted_input = list(map(float, next_line.split()))
        elif input_format == 3: formatted_input = list(next_line)
        elif input_format == 4: formatted_input = (lambda x: [x[0], list(map(int, x[1:]))])(next_line.split())
        elif input_format == 5: formatted_input = (lambda x: [x[0], list(map(float, x[1:]))])(next_line.split())
        elif input_format == 6: formatted_input = next_line.split()
        else: formatted_input = [next_line]

        return formatted_input if use_list else formatted_input[0]


def out(output_line, output_format = 0, newline = True):

    formatted_output = ""

    if output_format == 0: formatted_output = str(output_line)
    elif output_format == 1: formatted_output = " ".join(map(str, output_line))
    elif output_format == 2: formatted_output = "\n".join(map(str, output_line))

    print(formatted_output, end = "\n" if newline else "")


def log(*args):
    if not production:
        print("$$$", end = "")
        print(*args)

enum = enumerate

#
#   >>>>>>>>>>>>>>> START OF SOLUTION <<<<<<<<<<<<<<
#


def solve():

    a = input(3)
    b = input(3)

    c = 0

    for i, j in zip(a, b):
        if i != j:
            c += 1

    out(c)

    return


#for i in range(input(11)): solve()
solve()

#
#   >>>>>>>>>>>>>>>> END OF SOLUTION <<<<<<<<<<<<<<<
#


Measured memory_bytes: 84524
import heapq

from collections import deque

N,M = list(map(int, input().split()))
A = list(map(lambda i: -i, map(int, input().split())))


heapq.heapify(A)

for _ in range(M):
    a = heapq.heappop(A)
    #print(a)
    heapq.heappush(A,-((-a)//2))

print(-sum(A))


Measured memory_bytes: 72216