akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <iomanip>
#include <cassert>
using namespace std;

#define GET_ARG(a,b,c,F,...) F
#define REP3(i,s,e) for (i = s; i <= e; i++)
#define REP2(i,n) REP3 (i,0,(int)(n)-1)
#define REP(...) GET_ARG (__VA_ARGS__,REP3,REP2) (__VA_ARGS__)
#define RREP3(i,s,e) for (i = s; i >= e; i--)
#define RREP2(i,n) RREP3 (i,(int)(n)-1,0)
#define RREP(...) GET_ARG (__VA_ARGS__,RREP3,RREP2) (__VA_ARGS__)
#define DEBUG(x) cerr << #x ": " << x << endl

const int INF = 1e8;

int e[10][10];

int main(void) {
    while (true) {
        int i, j, k, m;
        cin >> m;
        if (m == 0) break;
        REP (i,10) REP (j,10) e[i][j] = i == j ? 0 : INF;
        int n = 0;
        REP (i,m) {
            int a, b, c;
            cin >> a >> b >> c;
            e[a][b] = c;
            e[b][a] = c;
            n = max({n,a+1,b+1});
        }
        REP (k,n) REP (i,n) REP (j,n) e[i][j] = min(e[i][j],e[i][k] + e[k][j]);
        int mn = INF, mi;
        REP (i,n) {
            int sum = 0;
            REP (j,n) sum += e[i][j];
            if (mn > sum) {
                mn = sum;
                mi = i;
            }
        }
        cout << mi << " " << mn << endl;
    }
    return 0;
}

Measured memory_bytes: 3008
# -*- coding: utf-8 -*-
"""
http://abc063.contest.atcoder.jp/tasks/abc063_a

"""
import sys
from sys import stdin
input = stdin.readline


def main(args):
    A, B = map(int, input().split())
    if A + B >= 10:
        print('error')
    else:
        print(A + B)


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

Measured memory_bytes: 2940
#include <iostream>
#include<string>
#include<cmath>
#include<ciso646>
#include<cstring>
#include<iomanip>
#include<vector>
#include<algorithm>
#include<utility>
#include<map>
#include<math.h>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
using ll = long long;



int main()
{
	string s;
	cin >> s;
	if (s == "AAA" or s == "BBB")
		cout << "No";
	else
		cout << "Yes";
	

}


Measured memory_bytes: 3604
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define all(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
//約数列挙（因数分解）
vector<ll> divisor(ll n) {
  vector<ll> ret;
  for(ll i = 1; i * i <= n; i++) {
    if(n % i == 0) {
      ret.push_back(i);
      if(i * i != n) ret.push_back(n / i);
    }
  }
  sort(begin(ret), end(ret));
  return (ret);
}

int main() {
	ll n;
	cin >> n;
	auto v = divisor(n);
	ll ans = 1LL << 60;
	for(auto t: v) {
		ll now = t + n/t;
		ans = min(ans, now);
	}
	cout << ans-2 << endl;
	return 0;
}

Measured memory_bytes: 384
package main

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

var (
	readString func() string
	stdout     *bufio.Writer
)

func init() {
	readString = newReadString(os.Stdin)
	stdout = bufio.NewWriter(os.Stdout)
}

func newReadString(ior io.Reader) func() string {
	r := bufio.NewScanner(ior)
	r.Buffer(make([]byte, 1024), int(1e+11))
	r.Split(bufio.ScanWords)

	return func() string {
		if !r.Scan() {
			panic("Scan failed")
		}
		return r.Text()
	}
}

func readInt() int {
	return int(readInt64())
}

func readInt64() int64 {
	i, err := strconv.ParseInt(readString(), 0, 64)
	if err != nil {
		panic(err.Error())
	}
	return i
}

func readIntSlice(n int) []int {
	b := make([]int, n)
	for i := 0; i < n; i++ {
		b[i] = readInt()
	}
	return b
}

func readLengthAndSlice() []int {
	n := readInt()
	return readIntSlice(n)
}

func printf(f string, args ...interface{}) (int, error) {
	return fmt.Fprintf(stdout, f, args...)
}

func println(args ...interface{}) (int, error) {
	return fmt.Fprintln(stdout, args...)
}

func minInt(a, b int) int {
	if a < b {
		return a
	}
	return b
}

func minUint(a, b uint) uint {
	if a < b {
		return a
	}
	return b
}

func minInt64(a, b int64) int64 {
	if a < b {
		return a
	}
	return b
}

func minUint64(a, b uint64) uint64 {
	if a < b {
		return a
	}
	return b
}

func maxInt(a, b int) int {
	if a < b {
		return b
	}
	return a
}

func maxUint(a, b uint) uint {
	if a < b {
		return b
	}
	return a
}
func maxInt64(a, b int64) int64 {
	if a < b {
		return b
	}
	return a
}

func maxUint64(a, b uint64) uint64 {
	if a < b {
		return b
	}
	return a
}

func absInt(a int) int {
	if a < 0 {
		return -a
	}
	return a
}

func absInt64(a int64) int64 {
	if a < 0 {
		return -a
	}
	return a
}

// readString() string
// readInt() int
// readIntSlice(n int) []int
// readLengthAndSlice() []int
func main() {
	defer stdout.Flush()

	n := readInt()
	_ = readInt()
	s := make([]string, n)
	for i := range s {
		s[i] = readString()
	}
	sort.Strings(s)
	for _, t := range s {
		printf("%s", t)
	}
	println()
}


Measured memory_bytes: 640
s=list(input())
x,y=map(int,input().split())
P="A"
A=[]
X=[0]
Y=[0]

cnt=0
for i in range(len(s)):
    if P=="A":
        if s[i]=="F":
            cnt+=1
        else:
            A.append(cnt)
            cnt=0
            P="Y"
    elif P=="X":
        if s[i]=="F":
            cnt+=1
        else:
            X.append(cnt)
            cnt=0
            P="Y"
    else:
        if s[i]=="F":
            cnt+=1
        else:
            Y.append(cnt)
            cnt=0
            P="X"
if P=="A":
    A.append(cnt)
elif P=="X":
    X.append(cnt)
else:
    Y.append(cnt)
#print(A,X,Y)

DX1={}
DX1[0]=1
DX2={}
for i in X:
    for j in DX1:
        DX2[j+i]=1
        DX2[j-i]=1
    DX1=DX2
    DX2={}
#print(DX1)
if x-A[0] in DX1:
    flagx=1
else:
    flagx=0

DY1={}
DY1[0]=1
DY2={}
for i in Y:
    for j in DY1:
        DY2[j+i]=1
        DY2[j-i]=1
    DY1=DY2
    DY2={}
if y in DY1:
    flagy=1
else:
    flagy=0

if flagx*flagy==1:
    print("Yes")
else:
    print("No")

Measured memory_bytes: 74588
#include <algorithm>
#include <iostream>
#include <map>
#include <numeric>
#include <set>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#include <queue>
#define MOD (1000000007l)
#define rep(i, n) for(long i = 0; i < (n); i++)

using namespace std;

void solve() {
  long N, M;
  cin >> N >> M;

  long foo = M * 1900 + (N - M) * 100;
  long bar = 1;
  rep (i, M) bar *= 2;

  cout << foo * bar << endl;
}

int main(void) {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout.precision(12);
  solve();
  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include <ostream>
#include<cstdio>
#include<algorithm>
#include<iomanip>
#include<cstring>
#include<string>
#include<cmath>
#include<stack>
#include<queue>
#include<vector>
#include<set>
#include<map>
#define ll long long
#define dd double
#define mes(x,y) memset(x,y,sizeof(y))
using namespace std;

int main(){
	double a,b,t;
	while(cin>>a>>b>>t){
		cout<<(int)((int)((t+0.5)/a)*b)<<endl; 
	} 
}

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

int main() {
	int N,K;
	cin >>N>>K;
	vector<int> A(N+1);
	int p,q;
	for(int i=1;i<=N;i++){
		A[i]=0;
	}
	for(int i=1;i<=K;i++){
		cin >>p;
		for(int j=1;j<=p;j++){
			cin >>q;
			A[q]=1;
		}
	}
	int r=N;
	for(int i=1;i<=N;i++){
		r=r-A[i];
	}
	cout <<r;
	

}

Measured memory_bytes: 3596
/******************************

           AOJ 0000

******************************/

#include<stdio.h>

int main(void)
{
  int i, j;

  for (i = 1; i < 10; i++) {
	for (j = 1; j < 10; j++)
	  printf("%dx%d=%d\n", i, j, i*j);
  }

  return 0;
}

Measured memory_bytes: 524
# ABC131 D Megalomania
import itertools

n = int(input())
ab_list = [[None] * 2 for i in range(n)]
for i in range(n):
    ab_list[i] = list(map(int, input().split()))

ab_list.sort(key=lambda x:(x[1]))
ab_list_T = [list(x) for x in zip(*ab_list)]

cum_iter = itertools.accumulate(ab_list_T[0])

flag = True
for i,_ in enumerate(cum_iter):
    if _ > ab_list_T[1][i]:
        flag = False
    
if flag:
    print("Yes")
else:
    print("No")

Measured memory_bytes: 70760
/*Lucky_Glass*/
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;

typedef long long ll;
const int N=2e5;

char str[N+5];
ll lef,rig;
ll fib[200],cnt[200][30],calA[30],calB[30];
int pi[N+5];
int n,m;

void Calc(ll *res,ll pos){
    int p=m;
    while(pos>fib[0]){
        while(fib[p]>pos) p--;
        for(int i=0;i<26;i++)
            res[i]+=cnt[p][i];
        pos-=fib[p];
    }
    for(int i=0;i<pos;i++)
        res[str[i]-'a']++;
}
void Excalc(ll *res,ll pos){
    for(int i=0;i<n;i++)
        res[str[i]-'a']+=pos/n;
    for(int i=pos%n-1;i>=0;i--)
        res[str[i]-'a']++;
}
int main(){
    scanf("%s%lld%lld",str,&lef,&rig);
    n=strlen(str);
    n>>=1;
    for(int i=1;i<n;i++){
        int j=pi[i-1];
        while(j && str[i]!=str[j])
            j=pi[j-1];
        if(str[i]==str[j]) j++;
        pi[i]=j;
    }
    if(n%(n-pi[n-1])==0){
        Excalc(calA,lef-1);
        Excalc(calB,rig);
    }
    else{
        fib[0]=n;fib[1]=n+n-pi[n-1];
        for(int i=0;i<n;i++){
            cnt[0][str[i]-'a']++;
            cnt[1][str[i]-'a']++;
            if(i<n-pi[n-1]) cnt[1][str[i]-'a']++;
        }
        for(int i=2;i<87;i++){
            fib[i]=fib[i-1]+fib[i-2];
            if(fib[i]>=rig) break;
            m=i;
            //printf("%d:%lld\n",i,fib[i]);
            for(int j=0;j<26;j++)
            	cnt[i][j]=cnt[i-1][j]+cnt[i-2][j];
        }
        Calc(calA,lef-1);Calc(calB,rig);
    }
    for(int i=0;i<26;i++)
        printf("%lld%c",calB[i]-calA[i],i==25? '\n':' ');
    return 0;
}


Measured memory_bytes: 2280
#include<iostream>;
#include<algorithm>;
#include<vector>;

using namespace std;

int main(){
   int n,u,v,k;
   cin >> n;
   vector<int> a(n,0);
   vector<vector<int> > edges(n,a); 
   for(int i = 0;i < n;i++){
       cin >> u;
       cin >> v;
       for(int ii = 0;ii < v;ii++){
           cin >> k;
           edges[u-1][k-1] = 1;
       }
   }
   for(int i = 0;i < n;i++){
       for(int ii = 0;ii < n;ii++){
           if(ii == n-1){
               cout << edges[i][ii];
           }
           else{
               cout << edges[i][ii] << " ";
           }
       }
       cout <<"\n";
   }
}


Measured memory_bytes: 3212
#include <cassert>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>

#include <algorithm>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>

using namespace std;

#define cin_desync()                                                           \
    do {                                                                       \
        ios_base::sync_with_stdio(false);                                      \
        cin.tie(0);                                                            \
    } while (0)

#ifndef ONLINE_JUDGE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1> void __f(const char *name, Arg1 &&arg1) {
    cerr << name << " : " << arg1 << std::endl;
}
template <typename Arg1, typename... Args>
void __f(const char *names, Arg1 &&arg1, Args &&... args) {
    const char *comma = strchr(names + 1, ',');
    cerr.write(names, comma - names) << " : " << arg1 << " | ";
    __f(comma + 1, args...);
}

#else
#define trace(...)
#endif // ifndef ONLINE_JUDGE

typedef long double ld;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

const int max_N = 20;

int main() {
    int N; string S;

    cin >> N >> S;

    map< pair<string, string>, int > half;
    for (int mask = 0; mask < (1 << N); ++mask) {
        string red, blue;
        for (int i = 0; i < N; ++i) {
            if ((mask >> i) & 1) {
                red.push_back(S[i + N]);
            } else {
                blue.push_back(S[i + N]);
            }
        }
        reverse(blue.begin(), blue.end());
        half[{red, blue}]++;
    }

    ll ans = 0;
    for (int mask = 0; mask < (1 << N); ++mask) {
        string red, blue;
        for (int i = 0; i < N; ++i) {
            if ((mask >> i) & 1) {
                red.push_back(S[i]);
            } else {
                blue.push_back(S[i]);
            }
        }
        reverse(blue.begin(), blue.end());
        if (half.find({blue, red}) != half.end()) {
            ans += half[{blue, red}];
        }
    }

    cout << ans << endl;
}


Measured memory_bytes: 45696
#include <iostream>
using namespace std;
int main() {
    string s;
    cin>>s;
    for(int i=0; i<s.size(); i++){
        if(!((i%2==0 && s[i]=='R') || (i%2!=0 && s[i]=='L') || (s[i]=='U' || s[i]=='D'))){
            cout << "No\n";
            return 0;
        }
    }
    cout << "Yes\n";
    return 0;
}


Measured memory_bytes: 3632
// This file is a "Hello, world!" in C++ language by GCC for wandbox.
#include <iostream>
#include <cstdlib>
#include <algorithm>
#include <utility>
#include <string>
#include <vector>
#include <queue>
//this code is fake. I should have devided the arrays like two buffering. 

using namespace std;

//make some global variables that are shared with main() and other functions. 
int dx[4]={0,1,0,-1};
int dy[4]={1,0,-1,0};
int h,w;

int bfs(int x, int y, string *s){
    //make an array showing the distance from the start point (x,y)
    int dist[h][w];
    for(int i=0; i<h;i++){
        for(int j=0; j<w; j++)
            dist[i][j]=-1; //unchecked flag
    }
    
    queue <pair <int, int>> q;
    
    //starting initialization
    q.push({x,y});
    dist[x][y]=0;
    
    //bfs
    while(!q.empty()){
        pair<int, int> z = q.front();
        int u=z.first;
        int v=z.second;
        
        //delete the front
        q.pop();
        
        for(int i=0; i<4; i++){
            int next_x = u + dx[i];
            int next_y = v + dy[i];
            
            //check whether the next index is available or not
            if(0 <= next_x && next_x < h && 0 <= next_y && next_y < w){
                //check whether the content is new and sth to consider or not
                if(s[next_x][next_y]=='.' && dist[next_x][next_y]==-1){
                    dist[next_x][next_y] = dist[u][v] + 1;
                    q.push({next_x, next_y});
                }
            
            }

        }

    }
    
    //return the maximum distance
    int maxi=0;
    for(int i=0; i<h;i++){
        for(int j=0; j<w; j++)
            maxi = max(maxi, dist[i][j]);
    }
    
    return maxi;
    
}


int main()
{
    string str;
    cin >> h >> w;

    string s[h];
    string dist[h];
    int ans=0;
    
    //inputs
    //this array is fixed, i.e, showing the information of the input array
    for(int i=0; i<h;i++){
        cin >> str;
        s[i]=str;
    }
    
    //do search
    for(int i=0; i<h;i++){
        for(int j=0; j<w; j++){
            if(s[i][j]=='.')
                ans = max(ans, bfs(i,j,s));
        }
    }

    cout << ans <<  endl;
}

// GCC reference:
//   https://gcc.gnu.org/

// C++ language references:
//   https://cppreference.com/
//   https://isocpp.org/
//   http://www.open-std.org/jtc1/sc22/wg21/

// Boost libraries references:
//   https://www.boost.org/doc/


Measured memory_bytes: 256
def listToString(_list, split=""):
    maped_list = map(str, _list)  # mapで要素すべてを文字列に
    mojiretu = split.join(maped_list)
    return mojiretu


s = input()
out = []
for i in range(len(s)):
    if s[i] == "0":
        out.append("0")
    elif s[i] == "1":
        out.append("1")
    else:
        if len(out) > 0:
            out.pop()
print(listToString(out))

Measured memory_bytes: 3064
#define _LIBCPP_DEBUG 0
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
ll MOD = 1e9+7;

int main() {

    int N; cin>>N;
    int a[10][10]{};

    for (int i = 1; i <= N; ++i) {
        string s = to_string(i);
        a[s[0]-'0'][s[s.length()-1]-'0']++;
    }

    ll ans = 0;
    for (int i = 1; i < 10; ++i) {
        for (int j = 1; j < 10; ++j) {
            ans += a[i][j]*a[j][i];
        }
    }
    cout<<ans<<endl;

    return 0;

}

Measured memory_bytes: 256
#include <iostream>
#include<string>
#include<cmath>
#include<algorithm>
#include<cctype>
#include<queue>
#include<deque>
#include<regex>
#include<stack>
#include<stdio.h>
#include<vector>
#include<set>
#include<map>
#include<iomanip>
#define rep(i,n) for(int i=0;i<n;i++)

typedef int long long ll;
using namespace std;
typedef pair<int,int> P;
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
const ll MOD=1e9+7;
static const int MAX = 100;
static const int INF = (1<<23);
template<class T> T gcd(T a, T b){return b? gcd(b,a%b) : a;}
template<class T> T lcm(T a,T b){return a / gcd(a,b)*b;}

int main(){
    ll n;
    cin>>n;
    vector<ll> v1(n);
    vector<ll> v2(n);
    vector<pair<ll,int>> v3;


    rep(i,n){
        ll a,b;
        cin>>a>>b;
        v1[i]=a;
        v2[i]=b;
        v3.push_back({a+b,i});
    }
    sort(v3.rbegin(),v3.rend());
    ll ta=0,ao=0;
    rep(i,n){
        if(i%2==0){
           ta+= v1[v3[i].second];
        }else{
            ao+= v2[v3[i].second];
        }
    }
    cout<<ta-ao<<endl;





    return 0;
}


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

#define endl '\n'
#define ends ' '
#define die(x) return cout << x << endl, 0
#define all(v) v.begin(), v.end()
#define sz(x) (int)(x.size())
void debug_out() { cerr << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) { cerr << ends << H; debug_out(T...); }
#define debug(...) cerr << "{" << #__VA_ARGS__ << "}:", debug_out(__VA_ARGS__)
typedef long long ll;
typedef pair<int, int> pii;
const int INF = 1e9;
const ll MOD = 1e9 + 7;
 
////////////////////////////////////////////////////////////////////

const int N = 1e3 + 5, M = 5e3 + 5;

int A[N], B[N];
vector<int> G[N];

void DFS(int v) {
	bitset<M> DP; DP[0] = 1;
	int a = 0, b = 0;
	for (int u : G[v]) {
		DFS(u);
		int x = A[u], y = B[u];
		if (x < y) swap(x, y);
		a += y, b += x - y;
		DP |= (DP << (x - y));
	}
	if (a > A[v]) { cout << "IMPOSSIBLE" << endl; exit(0); }
	int d = A[v] - a;
	while (!DP[d]) d--;
	B[v] = b - d;
}

int main() {

	ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	mt19937 Rnd(time(0));

	int n; cin >> n;
	for (int i = 2; i <= n; i++) {
		int p; cin >> p;
		G[p].push_back(i);
	}
	for (int i = 1; i <= n; i++) cin >> A[i];
	DFS(1);
	cout << "POSSIBLE" << endl;

	return 0;
}


Measured memory_bytes: 1152
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define repit(it, li) for(auto it=li.begin(); it!=li.end(); it++)
using namespace std;
using ll = long long;
using P = pair<int,int>;

int main(){
	int h, w, m;
	cin>>h>>w>>m;
	map<int, int> mh, mw;
	vector<P> b;
	rep(i, m){
		int x, y;
		cin>>x>>y;
		b.push_back(make_pair(x, y));
		mh[x]++;
		mw[y]++;
	}

	int mx=0, i, tot=0;
	for(auto p : mh) mx=max(mx, p.second);
	tot+=mx;
	map<int, bool> mah, maw;
	int nmh=0, nmw=0;
	for(auto p : mh) if(p.second==mx){
		mah[p.first]=true;
		nmh++;
	}

	mx=0;
	for(auto p : mw) mx=max(mx, p.second);
	tot+=mx;
	for(auto p : mw) if(p.second==mx){
		maw[p.first]=true;
		nmw++;
	}

	int nix=0;
	for(P p : b){
		int x=p.first, y=p.second;
		if(mah[x] && maw[y]) nix++;
	}
	int nxh=0;
	for(auto p : mah) if(p.second) nxh++;
	int nxw=0;
	for(auto p : maw) if(p.second) nxw++;

	ll totx=(ll)nxh*nxw;

	if(nix==totx) tot--;

	cout<<tot<<endl;
	return 0;
}


Measured memory_bytes: 61776
#include <stdio.h>

int main() {
    int N,K,X,Y,M=0;
    scanf("%d\n",&N);
    scanf("%d\n",&K);
    scanf("%d\n",&X);
    scanf("%d",&Y);
    //1<=N,K<=10000,1<=Y<=X<=10000
    if(N>=K){
	
    M=X*K+Y*(N-K);
    printf("%d",M);
}
    else{
	M=X*N;
	printf("%d",M);
	} 
    return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
#define INF 2e9
using namespace std;
typedef long long ll;
typedef long double ld;
int main()
{
  cout<<fixed<<setprecision(10);
  int N,K,Q;
  int hoge;
  cin >> N >> K >> Q;
  vector<int> point(N);
  for(int i=0; i<Q; ++i) {
    cin >> hoge;
    point[hoge-1] += 1;
  }
  for(int i=0; i<N; ++i){
   	if(K-Q+point[i]<=0) cout << "No" << endl;
    else cout << "Yes" << endl;
  }
}

Measured memory_bytes: 1024
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main{
	public static void main(String[] args)throws IOException{
		InputStreamReader isr = new InputStreamReader(System.in);
		BufferedReader reader = new BufferedReader(isr);
		String string;
		double x1, y1, x2, y2, xq, yq, m, n, in1, in2, v1, v2, x, y;
		
		while((string = reader.readLine()) != null){
			x1 = Double.parseDouble(string.split(",")[0]);
			y1 = Double.parseDouble(string.split(",")[1]);
			x2 = Double.parseDouble(string.split(",")[2]);
			y2 = Double.parseDouble(string.split(",")[3]);
			xq = Double.parseDouble(string.split(",")[4]);
			yq = Double.parseDouble(string.split(",")[5]);
			
			if(x2 - x1 == 0){
				System.out.printf("%.6f %.6f\n", 2 * x1 - xq, yq);
			}else if(y2 - y1 == 0){
				System.out.printf("%.6f %.6f\n", xq, (2 * y1 - yq));
			}else{
				m = (y2 - y1) / (x2 - x1);
				n = -1 / m;
				in1 = y1 - m * x1;
				in2 = yq - n * xq;
				v1 = (in1 - in2) / (n - m);
				v2 = (n * in1 - m * in2) / (n - m);
				x = 2 * v1 - xq;
				y = 2 * v2 - yq;
				System.out.printf("%.6f %.6f\n", x, y);
			}
		}
	}
}

Measured memory_bytes: 24756
#include <bits/stdc++.h>
using namespace std;
#include <math.h>
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const int INF=1001001001;
vector<pair<int64_t,int64_t>>func(int64_t x){
  vector<pair<int64_t,int64_t>>p;
  for(int64_t i=2;i*i<=x;i++){
    int cnt=0;
    if(x%i==0){
    while(x%i==0){cnt++;x/=i;}
    p.push_back(make_pair(i,cnt));
    }
  }
  if(x!=1){p.push_back(make_pair(x,1));}
  return p;
}

int main() {
  int64_t N;
  cin>>N;
  bool ok=true;
  for(int64_t i=2;i*i<=N;i++){
    if(N%i==0){ok=false;}
  }
  if(ok==true){cout<<N-1<<endl;}
  else{
    int64_t ans=99999999999999;
   for(int64_t i=1;i*i<=N;i++){
     if(N%i!=0){continue;}
    int64_t b=N/i;
    int64_t dis=i+b-2;
    if(dis<ans){ans=dis;}
   }
    cout<<ans<<endl;
  }
  return 0;
}

Measured memory_bytes: 384
use proconio::input;
use std::collections::HashMap;

fn main() {
    input! {
        n: usize,
        xy: [(i64, i64); n],
    }

    if n == 1 {
        println!("1");
        return;
    }

    let mut map = HashMap::new();

    for a in xy.iter() {
        for b in xy.iter() {
            if a == b {
                continue;
            }
            *map.entry((a.0 - b.0, a.1 - b.1)).or_insert(0) += 1;
        }
    }

    let mut ans = None;
    for (key, val) in map {
        if let Some((key_max, val_max)) = ans.as_mut() {
            if *val_max < val {
                *key_max = key;
                *val_max = val;
            }
        } else {
            ans = Some((key, val));
        }
    }

    let ans = n - ans.unwrap().1;

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


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

#define REP(i, n) for (int i = 0; i < (n); i++)
#define FOR(i, init, n) for(int i = init; i < (n); i++)
#define ALL(obj) (obj).begin(), (obj).end()
#define fi first
#define se second

using namespace std;
using ll = long long int;
using P = pair<int, int>;
using T = tuple<int, int, int>;
using edge = struct
{
    int to, cost;
};

const int MOD = 1e9 + 7;
const int iINF = 1e9;
const long long int llINF = 1e18;
const double PI = acos(-1.0);

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

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

    int input;
    stack<int> sta;

    while(cin >> input)
    {
        if(input == 0)
        {
            cout << sta.top() << endl;
            sta.pop();
        }    
        else
        {
            sta.push(input);
        }
    }

    return 0;
}


Measured memory_bytes: 3116
//#include<bits/stdc++.h>
#include<iostream>
#include<iomanip>
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<string>
#include<numeric>
#include<vector>
#include<set>
#include<map>
#include<unordered_map>
#include<stack>
#include<queue>
#include<list>
using namespace std;

int main(){
  int n;
  cin >> n;
  int p[60000];
  for(int i=2;i<60000;i++){
    if(p[i] == 1) continue;
    int j = 2*i;
    while(j < 60000){
      p[j] = 1;
      j += i;
    }
  }
  int count = 0;
  int j = 0;
  for(int i=1;i<11111;i++){
    j = 5*i+1;
    if(p[j] == 0 && count < n){
      cout << j << " " << endl;
      count += 1;
    }
  }

  return 0;
}


Measured memory_bytes: 512
#include <iostream>
using namespace std;
void ABC120(void);
void ABC121(void);
void ABC122(void);
void ABC123(void);
void ABC124(void);
void ABC125(void);
void ABC126(void);
void ABC127(void);
void ABC128(void);
void ABC129(void);

int main(void){
    ABC123();
}

void ABC123(){
    int a,b,c,d,e,k;
    cin>>a>>b>>c>>d>>e>>k;
    if((e-a)<=k)cout<<"Yay!"<<endl;
    else cout<<":("<<endl;
}

Measured memory_bytes: 256
import java.util.Scanner;


public class Main {

    public static void main(String args[]) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt(); //入力の個数

        int minv = scanner.nextInt(); //1個目の値(以前r[0]に入れていたもの)
        int maxv = Integer.MIN_VALUE;
        for (int i = 1; i < n; i++) {
            int rt = scanner.nextInt();

            // 最大値の更新
            maxv = Math.max(maxv, rt - minv);


            
            // 最小値の更新
            minv = Math.min(minv, rt);

        }
        System.out.println(maxv);
    }
}



Measured memory_bytes: 99648
walklist=[]
a,b,c,d=map(int,input().split())
x_diff=c-a
y_diff=d-b
walklist.append("U"*y_diff)
walklist.append("R"*x_diff)
walklist.append("D"*y_diff)
walklist.append("L"*(x_diff+1))
walklist.append("U"*(y_diff+1))
walklist.append("R"*(x_diff+1))
walklist.append("D")
walklist.append("R")
walklist.append("D"*(y_diff+1))
walklist.append("L"*(x_diff+1))
walklist.append("U")
print("".join(walklist))


Measured memory_bytes: 38512
// Problem : D - Brick Break
// Contest : AtCoder Beginner Contest 148
// URL : https://atcoder.jp/contests/abc148/tasks/abc148_d
// Memory Limit : 1024.000000MB 
// Time Limit : 2000.000000milisec 
// Powered by CP Editor (https://github.com/coder3101/cp-editor2)

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
//#pragma GCC optimize("O3")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize("unroll-loops")
#define pb push_back
#define IOS                                                                    \
  ios_base::sync_with_stdio(false);                                            \
  cin.tie(0);                                                                  \
  cout.tie(0);cout<<fixed<<setprecision(16);
#define ll long long int
#define ld long double
#define el '\n'
#define El '\n'
#define PI (ld)3.141592653589793238462643383279502884197169399375105820974944
#define inf (ll)1000000000
#define mod (ll)1000000007
#define mod1 (ll)998244353
#define fo(i, n) for (long long i = 0; i < n; i++)
#define pll pair<ll, ll>
#define ml map<ll,ll>
#define vpl vector<pll>
#define vvl vector<vector<ll> >
#define vvpl vector< vector<pll> >
#define ff first
#define ss second
#define pqueue priority_queue< ll >
#define pdqueue priority_queue< ll,vl ,greater< ll > >
#define mem(a,b) memset(a,b,sizeof(a));
//mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
#define sz(a) (ll)a.size()
#define all(a) a.begin(),a.end()
#define vl vector<ll>


/*#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 x ff
//#define y ss
#define pt(a) for(auto it:a)cout<<it<<" ";cout<<endl;
unsigned seed = std::chrono::system_clock::now().time_since_epoch().count();
using namespace std;

using namespace __gnu_pbds;
 
typedef tree<pll,null_type,less<pll>,rb_tree_tag,tree_order_statistics_node_update> order_set;

// vector
template<class T> istream& operator >> (istream &is , vector<T> &v) { for(T &a : v) is >> a; return is; }
template<class T> ostream& operator << (ostream &os , const vector<T> &v) { for(const T &t : v) os << t<<" "; return os << endl; }
// pair
template<class T, class U> ostream& operator << (ostream &os , const pair<T, U> &v) { return os << v.first << " " << v.second ; }

double gcd(double a, double b) { return a < 0.01 ? b : gcd(fmod(b, a), a); }

long long bpow(long long a, long long b, long long m) {
  a %= m;
  long long res = 1;
  while (b > 0) {
    if (b & 1)res = res * a % m;
      a = a * a % m;
      b >>= 1;
  }
  return res;
}


ll kv;
ll t,n,x,y,h,k,z,p,q,w;
string s,s1,s2;
//vvl v;
//vl vis,d;

int main() {
    IOS;
    cin>>n;
	vl v(n);cin>>v;
	x=1;
	fo(i,n){
		if(v[i]==x)x++;
	}
	if(x==1)cout<<-1;
	else cout<<n+1-x;
    return 0;
}


Measured memory_bytes: 1792
#include <algorithm>
#include <iostream>

using namespace std;
using ll = long long;

int main() {
  ll Q, H, S, D, N, ans;
  cin >> Q >> H >> S >> D >> N;
  ll P = min({4 * Q, 2 * H, S});
  if (2 * P <= D) {
    ans = N * P;
  } else {
    ans = N / 2 * D + N % 2 * P;
  }
  cout << ans << endl;
}


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

#define ll long long
#define fornum(A,B,C) for(A=B;A<C;A++)
#define mp make_pair
#define pii pair<int,int>
#define pll pair<ll,ll>

using namespace std;

/////////////////////////////////////////////////////
int H,W;
int a, k;
int main(){
    scanf("%d%d", &a, &k);
    printf("%d", a - k+1);
    return 0;
}

Measured memory_bytes: 256
#include<cstdio>
#include<algorithm>

using namespace std;

int gcd(int a, int b){
	return b == 0 ? a : gcd(b, a % b);
}

int main(){
	int n, X; scanf("%d %d", &n, &X);
	int x; scanf("%d", &x);
	int res = abs(X - x);
	for(int i = 1; i < n; i++){
		scanf("%d", &x);
		res = gcd(res, abs(X - x));
	}
	printf("%d\n", res);
	return 0;
}

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


int main()
{
	int A,B,C;
	cin>>A>>B>>C;
	if(A<=C&&C<=B)
	{
		cout<<"Yes"<<endl;
	}
	else
	{
		cout<<"No"<<endl;
	}
	return 0;
}


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

using ll = long long;
using Vi = vector<int>;
using Vl = vector<ll>;
using Pii = pair<int, int>;
using Pll = pair<ll, ll>;

constexpr int I_INF = numeric_limits<int>::max();
constexpr ll L_INF = numeric_limits<ll>::max();

//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

string S;
ll N;

bool dfs(int idx) {
    if (idx == N) {
        return true;
    }

    bool res = false;
    if (idx <= N - 5 && S.substr(idx, 5) == "dream") {
        res |= dfs(idx + 5);
    }
    if (idx <= N - 7 && S.substr(idx, 7) == "dreamer") {
        res |= dfs(idx + 7);
    }
    if (idx <= N - 5 && S.substr(idx, 5) == "erase") {
        res |= dfs(idx + 5);
    }
    if (idx <= N - 6 && S.substr(idx, 6) == "eraser") {
        res |= dfs(idx + 6);
    }

    return res;
}

void solve() {
    cin >> S;
    N = (ll)S.size();

    bool ok = dfs(0);
    cout << (ok ? "YES\n" : "NO\n");
}

//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

int main() {
#ifdef FASTIO
    cin.tie(0), cout.tie(0);
    ios::sync_with_stdio(false);
#endif
#ifdef FILEINPUT
    ifstream ifs("./in_out/input.txt");
    cin.rdbuf(ifs.rdbuf());
#endif
#ifdef FILEOUTPUT
    ofstream ofs("./in_out/output.txt");
    cout.rdbuf(ofs.rdbuf());
#endif
    solve();
    cout << flush;
    return 0;
}

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

using namespace std;

#define llong long long int
#define rep(i, n) for (int i = 0; i < n; ++i) 
#define stl_rep(itr, x) for (auto itr = x.begin(); itr != x.end(); ++itr)
#define stl_repr(itr, x) for (auto itr = x.begin(); itr != x.end(); ++itr)
#define all(x) x.begin(), x.end()
#define allr(x) x.rbegin(), x.rend()

const static llong MOD = 1000000000 + 7;
const static int inf = INT_MAX / 2;
const static llong INF = 1LL << 31;
const static int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};

int main (int argc, char *argv[]) {
    cin.tie(0);
    ios::sync_with_stdio(false);

    int x, a;
    cin >> x >> a;
    if (x < a) cout << 0 << endl;
    else cout << 10 << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> iint;
typedef pair<ll,ll> llll;
#define ALL(x) (x).begin(),(x).end()
const ll zero = 0;
const ll INF = 3000000000000000000; //10^18
const int inINF = 1000000000; //10^9
const ll MOD = 1000000007; //10^9+7
const ll MOD2 = 998244353;
void Yes() {printf("Yes\n");}
void No() {printf("No\n");}
void YES() {printf("YES\n");}
void NO() {printf("NO\n");}

int main(){
    ll N, M; cin >> N >> M;
    ll ans = 0;
    ll tmp;
    vector<ll> fact(M+1);
    fact[0] = 1; fact[1] = 1;
    for (int i = 2; i < M+1; i++) {
        fact[i] = fact[i-1] * i % MOD;
    }   
    vector<ll> inv(M+1); inv[1] = 1;
    for (int i = 2; i < M+1; i++) {
        inv[i] = MOD - (MOD / i) * inv[MOD % i] % MOD;
    }   
    vector<ll> invfact(M+1);
    invfact[0] = 1; invfact[1] = 1;
    for (int i = 2; i < M+1; i++) {
        invfact[i] = invfact[i-1] * inv[i] % MOD;
    }   

    tmp = fact[M] * invfact[M-N] % MOD;
    ans = tmp;
    ll t = -1;
    for (ll i = 0; i < N; i++) {
        tmp = tmp * inv[M-i] % MOD;
        tmp = tmp * (N-i) % MOD;
        tmp = tmp * inv[i+1] % MOD;
        ans = (MOD + ans + tmp * t) % MOD;
        t = -t;
    }

    ans = ans * fact[M] % MOD;
    ans = ans * invfact[M-N] % MOD;

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

}

Measured memory_bytes: 14680
import numpy as np
n, m = map(int, input().split())
x = np.array(list(map(int, input().split())), dtype='int64')
y = np.array(list(map(int, input().split())), dtype='int64')

xsum = np.sum(x[:0:-1].cumsum() - x[n-2::-1] * np.arange(1,n))
ysum = np.sum(y[:0:-1].cumsum() - y[m-2::-1] * np.arange(1,m))

print((xsum % 1000000007) * (ysum % 1000000007) % 1000000007)

Measured memory_bytes: 24060
N,A,B = list(map(int, input().split()))

def sumdigits(i):
  return i%10 + i//10%10 + i//100%10 + i//1000%10 + i//10000%10

print(sum([i if A<=sumdigits(i)<=B else 0 for i in range(1, N+1)]))

Measured memory_bytes: 3288
n, x = map(int, input().split())

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


state = 0

ans = 0

for i in range(n-1):
    if a[i] + a[i+1] > x:
        if a[i] > x:
            ans += a[i] - x
            a[i] = x
        ans += a[i] + a[i+1] - x
        a[i+1] = x - a[i]

print(ans)


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

namespace AtCoder {
    class Program {
        static void Main(string[] args) {
            var h = IntInput();
            var w = IntInput();
            var n = IntInput();
            var max = Math.Max(h, w);
            var surplus = n  % max;
            if(surplus > 0) Output((n / max) + 1);
            else Output(n / max);
        }

        #region ReadLineメソッド
        /// <summary>
        /// 文字列をリストで返す
        /// </summary>
        static List<string> StringInput(char splitChar) {
            return Console.ReadLine().Split(splitChar).ToList();
        }

        /// <summary>
        /// 文字列を分割し、数字のリストで返す
        /// </summary>
        static List<int> IntInput(char splitChar) {
            return StringInput(splitChar).Select(str => int.Parse(str)).ToList();
        }

        /// <summary>
        /// 数字を1つ返す
        /// </summary>
        static int IntInput() {
            return int.Parse(Console.ReadLine());
        }
        #endregion

        #region　WriteLineメソッド
        /// <summary>
        /// string型を改行せずに出力する
        /// </summary>
        static void Output(string str) {
            Console.Write(str);
        }

        /// <summary>
        /// int型をそのまま出力する
        /// </summary>
        static void Output(int number) {
            Console.WriteLine(number);
        }

        /// <summary>
        /// int型のリストを改行して出力する
        /// </summary>
        static void Output(List<int> numList) {
            numList.ForEach(num => Console.WriteLine(num));
        }
        #endregion 
    }
}


Measured memory_bytes: 13140
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <math.h>
#define MOD 1000000007
typedef long long ll;
using namespace std;

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

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

  int used[m+1]={};
  int now[n+1]={};
  for(int i=0;i<n;i++) now[i]=0;

  int ans=n;
  for(int i=1;i<m;i++){
    int c[m+1]={};
    int ma=0;
    for(int i=0;i<n;i++){
      c[a[i][now[i]]]++;
    }

    int it=0;
    for(int i=1;i<=m;i++){
      if(ma<c[i]){
        ma=c[i];
        it=i;
      }
    }
    ans=min(ans,ma);

    used[it]=1;
    for(int i=0;i<n;i++){
      while(used[a[i][now[i]]]){
        now[i]++;
      }
    }

  }
  cout<<ans<<endl;

  return 0;
}


Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
int main()
{
     long int n,k=0,a=0,b=0,c=0;
     cin>>n;
     vector<string>v(n);
     for(int i=0;i<n;i++)
        cin>>v[i];
     for(int i=0;i<n;i++)
     { string s=v[i];
        if(s[0]=='B'&&s[s.length()-1]=='A')
         c++;
         else{
        if(s[s.length()-1]=='A')
            a++;
        if(s[0]=='B')
            b++;
         }
        for(int i=0;i<s.length()-1;i++)
        {  if(s[i]=='A'&&s[i+1]=='B')
              k++;
        }

     }
     //cout<<a<<" "<<b<<" "<<k<<" "<<c<<" ";
     if(c==0)
        k+=min(a,b);
     else
     {
     k+=c-1;
     if(a!=0)
     {
         k++;
         a--;
     }
     if(b!=0)
     {
        k++;
        b--;
     }
     k+=min(a,b);
     }
    cout<<k;
    return 0;
}


Measured memory_bytes: 768
#include <iostream>
using namespace std;
int main() {
    int l, m;
    while (cin >> l >> m)
    {
        if (l==0&&m==0) break;
        if (l>m)
        {
           cout << m << " " << l << endl; 
        }
        else
        {
            cout << l << " " << m << endl;
        }
    }

    
	return 0;
}


Measured memory_bytes: 3012
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
ll MOD = 1000000007;
ll f[1001010], rf[1001010];
ll inv(ll x) {
    ll res = 1;
    ll k = MOD - 2;
    ll y = x;
    while (k) {
        if (k & 1) res = (res * y) % MOD;
        y = (y * y) % MOD;
        k /= 2;
    }
    return res;
}
void init() {
    f[0] = 1;
    for(int i = 1; i < 1001010; i++) f[i] = (f[i - 1] * i) % MOD;
    for(int i = 0; i < 1001010; i++) rf[i] = inv(f[i]);
}
ll C(int n, int k) {
    if(n < k) return 0;
    ll a = f[n]; // = n!
    ll b = rf[n-k]; // = (n-k)!
    ll c = rf[k]; // = k!

    ll bc = (b * c) % MOD;

    return (a * bc) % MOD;
}
int main()
{
    init();
    int x, y;
    cin >> x >> y;
    int sum = x+y;
    if(sum % 3 != 0)
    {
        cout << 0 << endl;
        return 0;
    }
    int h = max(x, y);
    int l = min(x, y);
    int diff = h-l;
    int num = sum / 3;
    // num+diff, num-diff
    int ev = num-diff;
    ll ans = C(num, (ev/2)+diff);
    cout << ans << endl;
}


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

bool isprime(int x) {
	if (x == 1) return false;
	if (x == 2 || x == 3) return true;
	for (int i=2; i*i <= x+4; i++) {
		if (x % i == 0) return false;
	}
	return true;
}

int main() {

	
	int n;
	cin >> n;
	while (!isprime(n)) n++;
	cout << n << endl;
	
}


Measured memory_bytes: 256
#include<stdio.h>
int n;

void Matrix(int R[]){
  int M[101][101];
  int i,j,k,l,q;

  for(i=1;i<=n;i++){
    M[i][i]=0;
  }
  for(l=2;l<=n;l++){
    for(i=1;i<=n-l+1;i++){
      j=i+l-1;
      M[i][j]=111111;
      for(k=i;k<=j-1;k++){
	q=M[i][k]+M[k+1][j]+R[i-1]*R[k]*R[j];
	if(M[i][j]>q)M[i][j]=q;
      }
    }
  }
  printf("%d\n",M[1][n]);
}
int main(){
  int M[100][2];
  int R[100],i;

  scanf("%d",&n);
  for(i=1;i<=n;i++){
    scanf("%d%d",&R[i-1],&R[i]);
  }
  Matrix(R);
    return 0;
}

Measured memory_bytes: 632
awk 'function rest(z) {
    return int((z + 9) / 10) * 10 - z
}
BEGIN {
    FS = RS
    RS = ""
}
{
    for (i=1; i<6; ++i) {
        for (j=1; j<5; ++j) {
            if (rest($j) > rest($(j+1))) {
                tmp = $j
                $j = $(j+1)
                $(j+1) = tmp
            }
        }
    }
    for(i=1;i<5;++i)a+=rest($i)
    for(i=1;i<6;++i)a+=$i
    print a
}'


Measured memory_bytes: 552
s = input()
x = ""
intx = 0
ans = 999
count = 0
for i in s:
    if count == 2:
        x += i
        intx = int(x)
        ans = abs(753 - intx)
    elif count > 2:
        x += i
        x = x[1:]
        intx = int(x)
        if abs(753 - intx) < ans:
            ans = abs(753 - intx)
    else:
        x += i
    count += 1
print(ans)

Measured memory_bytes: 3064
s, = gets.split.map(&:to_i)
nums = gets.split.map(&:to_i)

count = 0
(s - 2).times do |i|
  count += 1 if (nums[i] < nums[i + 1] && nums[i + 1] <= nums[i + 2]) || (nums[i] >= nums[i + 1] && nums[i + 1] > nums[i + 2])
end

puts count


Measured memory_bytes: 1788
N,K = map(int,input().split())
R,S,P = map(int,input().split())
T = list(input())

for n in range(N-K):
  if T[n+K]==T[n]:
    T[n+K]=""
    
print(P*T.count("r")+R*T.count("s")+S*T.count("p"))

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

using ll = long long;
using ld = long double;
using Graph = vector<vector<int>>;

int main(void)
{
    ll x;
    cin >> x;
    if(x>=30)
    {
        cout << "Yes" << endl;
    }
    else
    {
        cout << "No" << endl;
    }
    
    return 0;
}


Measured memory_bytes: 3632
#include <iostream>
#include <complex>
#include <sstream>
#include <string>
#include <algorithm>
#include <deque>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <vector>
#include <set>
#include <limits>
#include <cstdio>
#include <cctype>
#include <cmath>
#include <cstring>
#include <cstdlib>
#include <ctime>
using namespace std;
#define REP(i, j) for(int i = 0; i < (int)(j); ++i)
#define FOR(i, j, k) for(int i = (int)(j); i < (int)(k); ++i)
#define SORT(v) sort((v).begin(), (v).end())
#define REVERSE(v) reverse((v).begin(), (v).end())
typedef complex<double> P;

int main() {
  int a, b;
  while(scanf("%d %d", &a, &b) != EOF) cout <<a + b <<endl;
  return 0;
}

Measured memory_bytes: 1208
#include "bits/stdc++.h"
using namespace std;
using ll = long long;

int main () {
	cin.tie(0);
	cin.sync_with_stdio(0);

	int n;
	cin >> n;
	map<int, int> cnt;
	cnt[1] = 0;
	for(int v = 2; v <= n; ++v) {
		int x = v;
		for(int i = 2; i*i <= x; ++i)
			if(x % i == 0) {
				int c = 0;
				while(x % i == 0)
					c++, x /= i;
				cnt[i] += c;
			}
		if(x > 1)
			cnt[x]++;
	}
	int ans = 1;
	int const M = 1'000'000'007;
	for(auto const& p : cnt)
		ans = 1ll * ans * (p.second + 1) % M;
	cout << ans;
}

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

int main()
{
    int N;
    const int rate_num = 8;
    int rate_upper[] = {399, 799, 1199, 1599, 1999, 2399, 2799, 3199};
    int color_num[] = {0, 0, 0, 0, 0, 0, 0, 0};
    int over_num = 0;
    int a;
    cin >> N;

    for (int i = 0; i < N; i++) {
        cin >> a;
        bool over_flag = true;
        for (int j = 0; j < rate_num; j++) {
            if (rate_upper[j] >= a) {
                color_num[j] = color_num[j] + 1;
                over_flag = false;
                break;
            }
        }
        if (over_flag) {
            over_num++;
        }
    }

    int color_min = 0;
    int color_max = 0;

    for (int i = 0; i < rate_num; i++) {
        if (color_num[i] != 0) {
            color_max++;
            color_min++;
        }
    }

    color_max += over_num;

    if (color_min == 0 && color_max != 0) {
        color_min = 1;
    }

    cout << color_min << " " << color_max << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <utility>
#include <stack>
#include <numeric>
#include <algorithm>
#include <stdio.h>
#include <bitset>
#include <limits.h>
#include <complex>
#include <iomanip>
using namespace std;
#define MM 1000000000
#define MOD MM+7
#define pi pair<int32,int32>
#define pl pair<int64,int64>
#define chmax(a,b) (a<b ? a=b:0)
#define chmin(a,b) (a>b ? a=b:0)
const long double PI = acos(-1);
const long long INF = 1e15;
int dx[8] = {-1,0,1,0,-1,-1,1,1};
int dy[8] = {0,-1,0,1,-1,1,1,-1};
template<typename T>
T GCD(T u,T v){
    return v ? GCD(v,u%v) : u;
}
int lcm(int x,int y){
    return x*y/GCD(x,y);
}
int main(){
    int n; cin >> n;
    int a[n];
    cin >> a[0];
    int res = a[0];
    for(int i = 1; i < n; i++){
        cin >> a[i];
        res = lcm(res,a[i]);
    }
    cout << res << endl;
}
  




Measured memory_bytes: 3136
#include <assert.h>
#include <limits.h>
#include <cmath>
#include <algorithm>
#include <bitset>
#include <cctype>
#include <complex>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>

using ll = long long;
using P = std::pair<ll, ll>;

#define rep(i, a, b) for (ll(i) = (a); i < (b); i++)
#define all(i) i.begin(), i.end()
#define debug(i) std::cout << i << "\n"

// const ll MOD = 998244353;
const ll MOD = 1000000007;

ll pow_mod(ll a, ll b) {
  if (a == 0) {
    return 0;
  }

  ll x = 1;

  while (b > 0) {
    if (b & 1) {
      x = (x * a);
    }
    a = (a * a);
    b >>= 1;
  }
  return x;
}

int main() {
  std::cin.tie(0);
  std::ios::sync_with_stdio(false);
  //問題文中の添え字が0-indexか1-indexか確認!

  ll a, b, q;
  std::cin >> a >> b >> q;
  std::vector<ll> s(a + 2), t(b + 2);
  rep(i, 0, a) std::cin >> s[i+1];
  rep(i, 0, b) std::cin >> t[i+1];
  s[0] = -pow_mod(10,11);
  t[0] = -pow_mod(10,11);
  s[a + 1] = pow_mod(10,11);
  t[b + 1] = pow_mod(10,11);
  rep(i, 0, q) {
    ll x,ans=pow_mod(10,11);
    std::cin >> x;
    auto shrine = std::lower_bound(all(s), x);
    auto temple = std::lower_bound(all(t), x);
    for (int j = (1 << 3) - 1; j >= 0;j--){
      auto temp1=shrine,temp2=temple;
      if ((j >> 0) & 1){
        temp1--;
      }

      if((j>>1)&1){
        temp2--;
      }

      if((j>>2)&1){
        std::swap(temp1,temp2);
      }

      ll xx=*temp1,yy=*temp2;
      ans=std::min(ans , std::abs(xx-x)+std::abs(yy-xx) ); 
    }
    std::cout<<ans<<"\n";
  }
  return 0;
}

Measured memory_bytes: 2944
<?php

fscanf(STDIN, "%d%d", $N, $K);

$p_list = array_map("intval", explode(" ", trim(fgets(STDIN))));
$f_list = array_map("intval", explode(" ", trim(fgets(STDIN))));
rsort($p_list);
sort($f_list);
//$max=10**12;//
//foreach($p_list as $key=>$value){
//    $max =max($max, $value * $f_list[$key]);
//}

$a = -1;
$b = 1000000000000;
//$ans = [-1,intdiv($max,2), $max];

while(($b-1) > $a){
    $mid = $a + (($b-$a) >> 1);

    if(check($mid, $K, $N, $p_list, $f_list)){
        $a = $mid;
//            $mid = $a + (($b-$a)>> 1);

    }else{
        $b = $mid;
    }

//    $mid = $a + (($b-$a) >> 1);
}

    echo $b;

function check($mid,$K, $N, $p_list, $f_list){
    //global $K, $N, $p_list, $f_list;
    $need = 0;
    for($i=0;$i<$N;$i++){
        $need += max($p_list[$i] - (int)($mid / $f_list[$i]), 0);
        if($need > $K){
//            $over = 1;
            break;
        }

    }
    return $need > $K ;
}

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

int main(void){
    long long int n,m,a,i,sum=0;
    cin>>n;
    for(i=1;i<=n;++i){
        if(i%3!=0&&i%5!=0)sum+=i;
    }
    cout<<sum<<endl;
}

Measured memory_bytes: 3632