akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define double long double
#define rep(i,n) for(int i=0;i<n;i++)
#define mod 1000000007 // 10^9+7
#define INF 99999999999
#define P pair<int,int>
int n,a[5],mint;
signed main(){
    cin>>n;
    rep(i,5)cin>>a[i];
    sort(a,a+5);
    if(n>a[0]){
        mint=(n+a[0]-1)/a[0];
    }
    else mint=1;
    cout<<mint+4<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <queue>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <fstream>
#include <stdio.h>
#include <complex>
#include <cstdint>
#include <tuple>

#define M_PI       3.14159265358979323846

using namespace std;

//conversion
//------------------------------------------
inline int toInt(string s) { int v; istringstream sin(s); sin >> v; return v; }
template<class T> inline string toString(T x) { ostringstream sout; sout << x; return sout.str(); }
inline int readInt() { int x; scanf("%d", &x); return x; }

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef pair<int, PII> TIII;
typedef long long LL;
typedef unsigned long long ULL;
typedef vector<LL> VLL;
typedef vector<VLL> VVLL;

//container util

//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define SQ(a) (a*a)
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())

//repetition
//------------------------------------------
#define FOR(i,s,n) for(int i=s;i<(int)n;++i)
#define REP(i,n) FOR(i,0,n)
#define MOD 1000000007

int main() {
	string str;
	cin >> str;
	str[5] = ' ';
	str[13] = ' ';
	cout << str << endl;
	return 0;
}


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

#define FIN ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define ll long long
#define pb push_back
#define fore(i,a,b) for(int i = a; i < b; i++)
#define rfor(i, a, b) for(int i = a - 1; i >= b; i--)

ll n,W,dp[110][100010],wt[110],val[110];

ll knapSack(ll W,ll n) { 
    fore(i,0,n+1) { 
        fore(w,0,W+1) { 
            if (i==0 || w==0) 
                dp[i][w] = 0; 
            else if (wt[i-1] <= w) 
                    dp[i][w] = max(val[i-1] + dp[i-1][w-wt[i-1]], dp[i-1][w]); 
            else
                    dp[i][w] = dp[i-1][w]; 
        } 
    } 

    return dp[n][W]; 
} 

int main(){
    cin>>n>>W;
    fore(i,0,n)cin>>wt[i]>>val[i];

    cout<<knapSack(W,n)<<endl;
    return 0;
}

Measured memory_bytes: 80128
#include <iostream>
#include <cmath>
#include <iomanip>
using namespace std;

int main(){
  double x,h;
  while(cin>>x>>h&&(x||h)){
    cout<<fixed<<setprecision(6)<<x*x+2*x*sqrt(h*h+(x*x)/4)<<endl;
  }
  return 0;
}

Measured memory_bytes: 1276
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 b[] = new int[n];
        int c[] = new int[n-1];

        for (int i = 0; i < n; i++) {
            a[i] = sc.nextInt();
        }
        for (int i = 0; i < n; i++) {
            b[i] = sc.nextInt();
        }
        for (int i = 0; i < n-1; i++) {
            c[i] = sc.nextInt();
        }

        int sum = 0;

        for (int i = 0; i < n; i++) {
            sum += b[i];
        }
        for (int i = 0; i < n-1; i++) {
            if (a[i] == a[i+1]-1) {
                sum += c[a[i]-1];
            }
        }

        System.out.println(sum);
	}
}


Measured memory_bytes: 23764
s=input()


result=[]
for i in range(len(s)):
  if s[i]=="B":
    if len(result) != 0:
    	result.pop(-1)
        
  else :
    result.append(s[i])
    

mojiretu = ' '
 
for x in result:
    mojiretu += x
    
print(mojiretu)

Measured memory_bytes: 2940
#include<stdio.h>

int main(){
  int n,a[3000],sum=0;
  
  scanf("%d",&n);
  
  int i;
  for(i=0;i<n;i++){
    scanf("%d",&a[i]);
    sum+=a[i];
  }
  
  printf("%d",sum-n);
  
  return 0;
}


Measured memory_bytes: 128
package main

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

const size = 1000000
var reader = bufio.NewReaderSize(os.Stdin,size)
func NextLine() string {
  var line,buffer []byte
  var isPrefix bool = true
  var err error
  for ;isPrefix; {
    line,isPrefix,err = reader.ReadLine()
    if err != nil { panic(err) }
    buffer = append(buffer,line...)
  }
  return string(buffer)
}
func NextInt() int {
  var n int
  n,_ = strconv.Atoi(NextLine())
  return n
}
func NextIntArray() []int {
  var s []string = strings.Split(NextLine()," ")
  var n int = len(s)
  var a []int = make([]int,n)
  for i:=0;i<n;i++ {
    a[i],_ = strconv.Atoi(s[i])
  }
  return a
}

func main() {
  var n int = NextInt()
  var d []int = NextIntArray()
  var m int = NextInt()
  var t []int = NextIntArray()
  c := map[int]int{}
  for i:=0;i<n;i++ {
    c[d[i]]++
  }
  for i:=0;i<m;i++ {
    if c[t[i]] == 0 {
      fmt.Println("NO")
      os.Exit(0)
    }
    c[t[i]]--
  }
  fmt.Println("YES")
}

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

using namespace std;

#define rep(i, n) for (ll i = 0; i < (n); ++i)
#define rrep(i, n) for (ll i = (n - 1); i >= 0; --i)
#define blank(ans) cout << (ans) << " ";
#define mp(p, q) make_pair(p, q)
#define mt(p, q, r) make_tuple(p, q, r)
#define pb(n) push_back(n)
#define all(a) a.begin(), a.end()

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef string str;

typedef vector<ll> vll;
typedef vector<ld> vd;
typedef vector<bool> vb;
typedef vector<char> vc;
typedef vector<str> vs;
typedef vector<vector<ll>> vvll;
typedef vector<vector<ld>> vvd;
typedef vector<vector<bool>> vvb;
typedef vector<vector<char>> vvc;
typedef vector<vector<str>> vvs;
typedef vector<pair<ll, ll>> vpll;
typedef vector<tuple<ll, ll, ll>> vtlll;

const ld PI = acos(-1.0);
const ll MAX = 9000000000000000000;
const ll MIN = -9000000000000000000;
const ld DMAX = 4500;
const ld DMIN = -4500;
const ll MOD = 1000000007;

template <typename T>
void fin(T a)
{
  cout << a << endl;
  exit(0);
}

//実行部
void Main()
{
  ll n; cin >> n;
  vll d(n); rep(i, n) cin >> d[i];
  ll m; cin >> m;
  vll t(m); rep(i, m) cin >> t[i];
  map<ll, ll> D;
  rep(i, n)
  {
    if(D.count(d[i])) D[d[i]]++;
    else D[d[i]] = 1;
  }
  rep(i, m)
  {
    if(D.count(t[i]))
    {
      D[t[i]]--;
      if(D[t[i]] == 0) D.erase(t[i]);
    }
    else
    {
      fin("NO");
    }
  }
  fin("YES");
  return;
}

//前処理
int main()
{
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout << fixed << setprecision(20); //高精度少数表示
  Main();
  return 0;
}

/*
//test時
  g++ test.cpp -o test;./test
*/


Measured memory_bytes: 15872
#include <iostream>
#include <string>

using namespace std;

string map[21];
int w,h;
int dx[] = { -1, 1 , 0 , 0 };
int dy[] = { 0 , 0 , -1, 1 };

void check(int x , int y){
	int mx,my;

	//ãº¶EÌSûüÉ²×é
	for(int i=0 ; i<4 ; i++){
		mx = x + dx[i];
		my = y + dy[i];
		//tB[hOÉoÄ¢È¯êÎ²×é(0ÈãE³Èà)
		if(mx>=0 && mx<w && my>=0 && my<h){
			if(map[my][mx]=='.'){//^C¾Á½çhèÂÔµÄÄA
				map[my][mx] = 'f';
				check( mx , my );
			}
		}
	}
}

int main(){
	int sx,sy,count;

	while(1){
		//ÏÌú»
		count = 0;

		//E³ÌüÍ
		cin >> w >> h;
		
		if(w==0 && h==0)break;//0 0ªüÍ³ê½çI¹

		//üÍµ½lðmap[][]Éãü
		for(int y=0 ; y<h ; y++){
			cin >> map[y];
		}

		for(int y=0 ; y<h ; y++){
			for(int x=0 ; x<w ; x++){
				if(map[y][x]=='@'){//@¾Á½çX^[gn_
					sy = y;
					sx = x;
					map[y][x] = 'f';
				}	
			}
		}
		
		check( sx , sy );//X^[gn_Ìx,yÀWðnµÄ²×é

		//^CÌJEg(fÌÂð¦é)
		for(int y=0 ; y<h ; y++){
			for(int x=0 ; x<w ; x++){
				if(map[y][x]=='f')count++;
			}
		}

		//¦ÌoÍ
		cout << count << endl;
	}

	return 0;
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)
#define all(c) c.begin(),c.end()
#define pb push_back
#define fs first
#define sc second
#define show(x) cout << #x << " = " << (x) << endl
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)
using namespace std;
template<class S,class T> ostream& operator<<(ostream& o,const pair<S,T> &p){
	return o<<"("<<p.fs<<","<<p.sc<<")";
}
template<class T> ostream& operator<<(ostream& o,const vector<T> &vc){
	o<<"{";
	for(const T& v:vc) o<<v<<",";
	o<<"}";
	return o;
}
using ll = long long;
template<class T> using V = vector<T>;
template<class T> using VV = vector<vector<T>>;
struct CHT{
	using D = ll;
	typedef pair<D,D> P;
	vector<P> deq;
	int s,sd,t;
	void init(int N){
		deq.resize(N);
		s=0,sd=0,t=0;
	}
	void add(D a,D b){		//add ax+b     a:(広義)単調減少!!!
		P p(a,b);
		while(s+1<t&&check(deq[t-2],deq[t-1],p)) t--;
		deq[t++]=p;
	}
	D incr_query(D x){		//x:単調増加の時,これを繰り返し呼ぶ(間にaddが挟まるのはOK)
		while(s+1<t&&f(deq[s],x)>=f(deq[s+1],x)) s++;
		return f(deq[s],x);
	}
	D decr_query(D x){		//x:単調減少の時,これを繰り返し呼ぶ(間にaddが挟まるのはOK)
		if(sd>=t) sd=t-1;
		while(sd+1<t&&f(deq[sd],x)>=f(deq[sd+1],x)) sd++;
		while(sd>0&&f(deq[sd],x)<f(deq[sd-1],x)) sd--;
		return f(deq[sd],x);
	}
	D query(D x){
		int lb=s-1,ub=t-1;
		while(ub-lb>1){
			int m=(lb+ub)/2;
			if(isright(deq[m],deq[m+1],x)) lb=m;
			else ub=m;
		}
		return f(deq[ub],x);
	}

	bool isright(P& a,P& b,D x){
		return f(a,x)>=f(b,x);
	}
	bool check(P& a,P& b,P& c){
		return (b.fs-a.fs)*(c.sc-b.sc)>=(b.sc-a.sc)*(c.fs-b.fs);
	}
	D f(P &p,int x){
		return p.fs*x+p.sc;
	}
}cht;

int N;
ll C;
ll h[200010];

int main(){
	cin>>N>>C;
	rep(i,N) cin>>h[i];
	cht.init(N);

	cht.add(-2*h[0],h[0]*h[0]+C);
	rep1(i,N-1){
		ll mn = cht.incr_query(h[i]) + h[i]*h[i];
		if(i==N-1){
			cout<<mn<<endl;
			return 0;
		}
		cht.add(-2*h[i],h[i]*h[i]+C+mn);
	}
}

Measured memory_bytes: 4992
S = input()
char1 = S[0]
char2 = 'none'
count1 = 0
count2 = 0
for i in range(1, 4):
  if S[i] == char1:
    count1 += 1
  elif char2 == 'none':
    char2 = S[i]
  elif S[i] == char2:
    count2 += 1
if count1 == 1 and count2 == 1:
  print('Yes')
else:
  print('No')

Measured memory_bytes: 3064
#include <iostream>
#include <cstdio>
#include <vector>
#include <cmath>
#include <cstring>
#include <numeric>
#include <algorithm>
#include <functional>
#include <array>
#include <map>
#include <queue>
#include <limits.h>
#include <set>
#include <stack>
#include <random>
#include <complex>
#include <unordered_map>
#include <nmmintrin.h>
#include <chrono>
#define rep(i,s,n) for(int i = (s); (n) > i; i++)
#define REP(i,n) rep(i,0,n)
#define RANGE(x,a,b) ((a) <= (x) && (x) <= (b))
#define DUPLE(a,b,c,d) (RANGE(a,c,d) || RANGE(b,c,d) || RANGE(c,a,b) || RANGE(d,a,b))
#define INCLU(a,b,c,d) (RANGE(a,c,d) && (b,c,d))
#define PW(x) ((x)*(x))
#define ALL(x) (x).begin(), (x).end()
#define MODU 1000000007
#define bitcheck(a,b)   ((a >> b) & 1)
#define bitset(a,b)      ( a |= (1 << b))
#define bitunset(a,b)    (a &= ~(1 << b))
#define MP(a,b) make_pair((a),(b))
#define Manh(a,b) (abs((a).first-(b).first) + abs((a).second - ((b).second))
#define pritnf printf
#define scnaf scanf
#define itn int
#ifdef _MSC_VER
#define __builtin_popcount _mm_popcnt_u32
#define __builtin_popcountll _mm_popcnt_u64
#endif
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
ll gcd(ll a, ll b) {
	if (b == 0) return a;
	return gcd(b, a%b);
}
template<typename A, size_t N, typename T>
void Fill(A(&array)[N], const T &val) {
	std::fill((T*)array, (T*)(array + N), val);
}

#define int ll

int n, wsum;
int w[101], v[101];
int dp[101][301][101];
int base;

int func(int cur,int wc, int cou) {
	if (dp[cur][wc][cou] != -1) return dp[cur][wc][cou];
	if (cur == n) {
		if (wc > (wsum - base*cou))
			return INT_MIN;
		return 0;
	}
	int ret = INT_MIN;
	ret = max(ret,func(cur+1, wc,cou));
	ret = max(ret,func(cur+1, wc + w[cur], cou + 1) + v[cur]);

	return dp[cur][wc][cou] = ret;
}

signed main() {
	scanf("%lld %lld", &n, &wsum);
	REP(i, n) {
		scanf("%d %d", &w[i], &v[i]);
		if (!i)base = w[0];
		w[i] -= base;
	}
	Fill(dp,-1);
	printf("%lld\n", func(0, 0, 0));

	return 0;
}

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

typedef long long ll;
typedef pair<ll, ll> P;

#define pb push_back
#define rep(i, n) for(int i = 0; i < (n); i++)
#define FOR(i, a, n) for(int i = a; i < (n); i++)
#define mod (ll)(1e9+7)
#define int ll

__attribute__((constructor))
void initial() {
  cin.tie(0);
  ios::sync_with_stdio(false);
}

signed main() {
	string s;
  cin >> s;
  if (s.size() == 2 && s[0] == s[1]) {
    cout << 1 << " " << 2 << endl;
    return 0;
  }
  for(int i = 1; i < s.size() - 1; i++) {
    if (s[i - 1] == s[i]) {
      cout << i << " " << i + 1 << endl;
      return 0;
    } else if (s[i] == s[i + 1]) {
      cout << i + 1 << " " << i + 2 << endl;
      return 0;
    } else if (s[i - 1] == s[i + 1]) {
      cout << i << " " << i + 2 << endl;
      return 0;
    }
  }

  cout << "-1 -1" << endl;
	return 0;
}

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

int main() {
  int n;
  cin>>n;
  int t[n+1]={},x[n+1]={},y[n+1]={};
  for(int i=1;i<=n;i++)
    cin>>t[i]>>x[i]>>y[i];
  bool ans=true;
  
  for(int i=1;i<=n;i++){
    int tt,s;
    s=abs(x[i]-x[i-1])+abs(y[i]-y[i-1]);
    tt=t[i]-t[i-1];
    if(tt%2!=s%2 || s>tt)
      ans=false;
  }
  
  if(ans)
    cout<<"Yes";
  else cout<<"No";
  

}

Measured memory_bytes: 1408
# -*- coding: utf-8 -*-
"""
Created on Sat May  9 16:05:56 2020

@author: shinba
"""


n = int(input())
s,t = map(str,input().split())

ans = ""
for i in range(n):
    ans += s[i]
    ans += t[i]
    
print(ans)

Measured memory_bytes: 2940
#include <iostream>
#include <sstream>
#include <stdio.h>
#define _USE_MATH_DEFINES
#include <math.h>
#include <set>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
#include <cmath>
#include <limits>
#include <bitset>
#include <stack>
#include <queue>
#include <ctype.h>

typedef long long int lli;
#define rep(i,s,N) for(int i=s;i<N;i++)
#define MOD 1000000007
#define more(a,b) (((a)>(b))?(a):(b))
#define less(a,b) (((a)<(b))?(a):(b))

using namespace std;

int main(void)
{
	int N; cin >> N;
	vector<lli> S(N + 1, 0);
	rep(i, 1, N + 1) {
		lli A; cin >> A;
		S[i] = S[i - 1] + A;
	}
	map<lli, lli> cnt;
	rep(i, 0, N + 1)cnt[S[i]]++;
	lli ans = 0;
	for (map<lli, lli>::iterator it = cnt.begin(); it != cnt.end(); it++)
		ans += (it->second) * (it->second - 1) / 2;
	
	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 14336
n,k = map(int,input().split())
x = list(map(int,input().split()))
res = 10**10
for i in range(0,n-k+1):
    l = x[i]
    r = x[i+k-1]
    lrsmall = min(abs(l),abs(r))
    res = min(r-l+lrsmall,res)
print(res)


Measured memory_bytes: 14224
using System;
using System.Linq;
using System.Text;
using System.Collections.Generic;

public class Hello{
    
    private static string board;
    private static int[] memo;
    
    public static void Main(){
        board = Console.ReadLine();
        int N = board.Length;
        var result = new int[N];
        memo = new int[N];
        for(int i=0;i<N;i++){
            int roopStart = 0;
            int roopEnd = 0;
            char LR = board[i];
            int num = SearchRoop(i,LR,0);
            if(LR=='R'){
                roopStart = i + num;
                roopEnd = roopStart - 1;
            }else{
                roopStart = i - num;
                roopEnd = roopStart + 1;
            }
            if(num%2==0){
                result[roopStart]++;
            }else{
                result[roopEnd]++;
            }
        }
        Console.WriteLine(string.Join(" ",result));
    }
    private static int SearchRoop(int index, char LR, int num){
        if(board[index]!=LR){
            return num;
        }
        if(memo[index]!=0){
            return memo[index] + num;
        }
        int newNum = 0;
        if(LR=='R'){
            newNum = SearchRoop(index+1,LR,num+1);
        }else{
            newNum = SearchRoop(index-1,LR,num+1);
        }
        memo[index] = newNum - num;
        return newNum;
    }
}

Measured memory_bytes: 17596
import itertools
import math

N = int(input())
li = [list(map(int, input().split())) for k in range(N)]
r = []

total = []

for i in itertools.permutations(range(N)):
  r.append(i)


for i in r:
  count = 0
  for s in range(len(i)):
    if s + 1 > len(li) - 1:
      break

    town = i[s]
    nextTown = i[s+1]

    count += math.sqrt(((li[nextTown][0] - li[town][0]) ** 2) + ((li[nextTown][1] - li[town][1]) ** 2))

  total.append(count)

print(sum(total) / len(total))

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

using namespace std;

const int mod = 1e9 + 7;

int a[110];
long long dp[110][100100];
int n, k;

int main(){
    cin >> n >> k;
    for(int i = 0; i < n; i++) cin >> a[i];
    dp[0][0] = 1;
    for(int i = 0; i < n; i++){
        for(int j = 1; j <= k; j++) 
            dp[i][j] = (dp[i][j] + dp[i][j - 1]) % mod;
        for(int j = 0; j <= k; j++){
            dp[i + 1][j] = dp[i][j];
            if(j - a[i] - 1 >= 0) dp[i + 1][j] += mod - dp[i][j - a[i] - 1];
            dp[i + 1][j] %= mod;
        }
    }
    cout << dp[n][k] << '\n';
}

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

typedef long long ll;

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

    string s,t,u;
    int a,b;
    cin >> s >> t >> a >> b >> u;
    if(s==u) cout << a-1 << ' ' << b << endl;
    else cout << a << ' ' << b-1 << endl;
    return 0;
}

Measured memory_bytes: 256
import java.io.IOException;
import java.util.Scanner;

import com.sun.org.apache.xml.internal.utils.SuballocatedByteVector;

public class Main {

	public static void main(String[] args) throws IOException {

		Scanner scan = new Scanner(System.in);

		String S = scan.next();

		String left4 = S.substring(0, 4);
		String right = S.substring(4);

		System.out.println("2018".concat(right));
	}

	//***********************以下共通関数************************************************
	/**
	 * 文字列を反転して返す
	 * @param pStr 文字列
	 * @return 反転した文字列
	 */
	public static String myReverse(String pStr) {
		if (pStr.length() < 1) {
			return "";
		}

		StringBuffer sb = new StringBuffer(pStr);
		return sb.reverse().toString();
	}

	/**
	 * 余りを求める。
	 * @param a
	 * @param b
	 * @return 余り。余りがマイナスの時はプラスで返す。
	 */
	public static long myMod(long a, long b) {
		long ret = 0;

		ret = a % b;

		if (ret < 0) {
			ret += b;
		}

		return ret;
	}

	/**
	 * 乗数を求める ※mod対応
	 * @param kisu 基数
	 * @param josu 乗数
	 * @param primeNumMod_0 法 mod値 使わない場合は「0」
	 * @return
	 */
	public static long myPowWithMod(long kisu, long josu, long primeNumMod_0) {

		long ans = 1;

		//乗数が0の場合→1
		if (josu == 0)
			return 1;

		if (primeNumMod_0 == 0) {
			//modを使わないとき

			while (josu > 0) {

				if (josu % 2 == 0) {
					//累乗が偶数の時

					kisu *= kisu;
					josu = josu / 2;
				} else {
					//累乗が奇数の時
					ans *= kisu;
					josu--;
				}
			}

			return ans;

		} else {
			//modを使うとき

			//初めに桁を落とす
			kisu = myMod(kisu, primeNumMod_0);

			while (josu > 0) {

				if (josu % 2 == 0) {
					//累乗が偶数の時

					kisu *= myMod(kisu, primeNumMod_0);
					josu = josu / 2;

				} else {
					//累乗が奇数の時
					ans *= myMod(kisu, primeNumMod_0);
					josu--;

				}
			}

			return myMod(ans, primeNumMod_0);

		}

	}

}


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

using namespace std;

typedef unsigned long long ull;
typedef long long ll;

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

	vector<int> d(n+1, 1);
	vector<bool> b(n+1, false);
	b[1]=true;

	for(int i=0; i<m; i++){
		int x, y;
		cin >> x >> y;
		if(b[x]) b[y]=true;
		d[x]--;
		d[y]++;
		if(d[x]==0) b[x]=false;
	}

	int ans=0;
	for(int i=1; i<=n; i++){
		if(b[i]) ans++;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 640
#include <stdio.h>

int main(){
	int count;
	while(1){
		int max=0,min=999999;
		scanf("%d",&count);
		if(!count)break;
		int i,j;
		int a,sum;
		for(i=0;i<count;i++){
			sum=0;
			for(j=0;j<5;j++){
				scanf("%d",&a);
				sum+=a;
			}
			if(min>sum){
			min=sum;
			}
			if(max<sum){
				max=sum;
			}
		}
		printf("%d %d\n",max,min);
	}
	return 0;
}

Measured memory_bytes: 600
#include<iostream>
#include<cstdlib>
#include<string>
#include<vector>
#include<queue>
#include<algorithm>
using namespace std;
using ll = long long int;
const int mod = 1e9 + 7;
#define rep(i, a, b) for(int i = a;i < b; i++)

int main() {

	int n, maxi = 0, count = 0;
	cin >> n;

	vector<int> h(n);
	cin >> h[0];
	rep(i, 1, n) {
		cin >> h[i];
		if (h[i - 1] >= h[i]) {
			count++;
		}
		else {
			maxi = max(maxi, count);
			count = 0;
		}
	}

	maxi = max(maxi, count);

	cout << maxi << endl;

	return 0;
}

Measured memory_bytes: 640
#include <cstdio>
#include <cstring>
#include <vector>
#include <queue>
#include <string>
#include <algorithm>
#include <iostream>
#include <string>
#include <map>
#include <set>
#include <functional>
#include <iostream>
#define MOD 1000000007LL
using namespace std;
typedef long long ll;
typedef pair<int,int> P;

int n,m;
int cnt[100001];

int main(void){
	scanf("%d%d",&n,&m);
	for(int i=0;i<m;i++){
		int a,b;
		scanf("%d%d",&a,&b);
		cnt[a]++;
		cnt[b]++;
	}
	bool flag=true;
	for(int i=1;i<=n;i++){
		if(cnt[i]%2==1){
			flag=false;
		}
	}
	printf("%s\n",flag?"YES":"NO");
	return 0;
}


Measured memory_bytes: 640
#include<stdio.h>
#include<bits/stdc++.h>
using namespace std;
const int INF=1e9;
int n,p[100000];
int main(){
    scanf("%d",&n);
    for(int i=0;i<n;i++){
        scanf("%d",&p[i]);
        p[i]--;
    }
    int ans=0;
    for(int i=0;i<n-1;i++){
        if(p[i]==i){
            swap(p[i],p[i+1]);
            ans++;
        }
    }
    if(p[n-1]==n-1)ans++;
    printf("%d\n",ans);
    return 0;
}

Measured memory_bytes: 640
import java.util.Scanner;

public class Main {
	public static void main(String[] args){
		Scanner stdIn = new Scanner(System.in);
		while(true){
			int n = stdIn.nextInt();
			if(n==0){
				break;
			}
			int[] s = new int[n];
			double a = 0;
			double ans = 0;
			for(int i=0;i<n;i++){
				s[i] = stdIn.nextInt();
				a += s[i];
			}
			a = a / n;
			for(int i=0;i<n;i++){
				ans += Math.pow(s[i]-a,2);
			}
		
		ans = ans/(double)n;
		System.out.println(Math.sqrt(ans));
		}
	}
}

Measured memory_bytes: 23720
#define _USE_MATH_DEFINES
#include <cstdio>
#include <iostream>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <complex>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <limits>
#include <climits>
#include <cfloat>
#include <functional>
#include <iterator>
using namespace std;

const int INF = INT_MAX / 2;

int main()
{
    int n, t;
    cin >> n >> t;
    vector<int> a(n);
    for(int i=0; i<n; ++i)
        cin >> a[i];

    int aMin = INF;
    int diffMax = -INF;
    int cnt = 0;
    for(int i=0; i<n; ++i){
        int diff = a[i] - aMin;
        if(diff == diffMax){
            ++ cnt;
        }
        else if(diffMax < diff){
            diffMax = diff;
            cnt = 1;
        }
        aMin = min(aMin, a[i]);
    }
    cout << cnt << endl;

    return 0;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
#define ll long long
#define ull unsigned long long
#define MAX_INF 0x7f
#define MAX_INF_VAL 0x7f7f7f7f
#define pi 3.141592653589
#define eps 1e-6
//#define p 2173412051LL
#define sz 2

using namespace std;

ll fac[ 200010 ], fac_inv[ 200010 ];

void pre( ll );
ll pow_mod( ll, ll, ll );
ll cnm( ll, ll, ll );

int main() {
	ll n, m;
	ll ans = 0, p = 1000000007;
	pre( p );
	scanf( "%lld%lld", &n, &m );
	if( m > 1 )
		ans = 1;
	for( int i = 1; i <= min( n - 1, m ); ++i ) {
		ans += cnm( n, i, p ) * cnm( n - 1, n - i - 1, p ) % p;
		ans %= p;
	}
	printf( "%lld", ans );
	return 0;
}

void pre( ll p ) {
	fac_inv[ 0 ] = fac[ 0 ] = 1;
	for( int i = 1; i <= 200000; ++i ) {
		fac[ i ] = fac[ i - 1 ] * i;
		fac[ i ] %= p;
		fac_inv[ i ] = pow_mod( fac[ i ], p - 2, p );
	}
}

ll cnm( ll n, ll m, ll p ) {
	ll res = 1, a, b, c;
	if( n < m )
		return 0;
	if( n == m )
		return 1;

	a = fac[ n ];
	b = fac_inv[ m ];
	c = fac_inv[ n - m ];
	res = ( a * b % p ) * c % p;

	return res;
}

ll pow_mod( ll x, ll y, ll p ) {
	ll res = 1;
	while( y ) {
		if( y & 1 ) {
			res *= x;
			res %= p;
		}
		x *= x;
		x %= p;
		y >>= 1;
	}
	return res;
}

Measured memory_bytes: 3328
//#include "pch.h"
#include <iostream>
#include <string>
#include <string.h>
#include <algorithm>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <cmath>
#include <stdio.h>
#include <vector>
#include <time.h>
#include <iomanip>
#include <thread>
#include <atomic>
#include <mutex>
#include <future>
#define double long double
#define int long long
#define mii map<int,int>
#define pii pair<int,int>
#define low lower_bound
#define upp upper_bound
#define mod 1000000007 //10^9+7
#define inf 100000000000 //10^11
#define rep(i,n) for(int i=0;i<n;i++)
#define all(vec) vec.begin(),vec.end()
#define vsort(vec) sort(all(vec))
#define vrever(vec) reverse(all(vec));
#define vunsort(vec) vsort(vec); vrever(vec);
#define bisea binary_search
#define cend cout<<endl;
#define F first
#define S second
using namespace std;
signed main() {
	string s;
	cin >> s;
	int n = s.size();
	stack<char>st;
	rep(i, n) {
		if (i != 0 && !st.empty() && st.top() != s[i]) {
			st.pop();
		}
		else {
			st.push(s[i]);
		}
	}
	cout << n-st.size() << endl;
}


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

typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<string> vs;

#define rep(i,n) for(int i=0;i<(n);i++)
#define rep1(i,n) for(int i=1;i<=(n);i++)
#define all(x) (x).begin(),(x).end()
constexpr auto INF = 5000000000000000;
constexpr auto MOD = 1000000007;

int main() {

	int n;
	cin >> n;

	string s = "";
	s += to_string(n * n * n);

	cout << s << endl;
}

Measured memory_bytes: 256
#include"bits/stdc++.h"
#include<boost/multi_array.hpp>
#include<boost/optional.hpp>
#include<boost/range/irange.hpp>
#include<boost/range/algorithm.hpp>
#include<boost/range/adaptors.hpp>
using namespace std;
namespace adaptor = boost::adaptors;

#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define rep3(i,m,n) for(int (i)=m;(i)<=(n);(i)++)
#define rep3rev(i,m,n) for(int (i)=m;(i)>=(n);(i)--)
#define all(a) (a.begin()),(a.end())
#define rall(a) (a.rbegin()),(a.rend())
#define fi first
#define se second

typedef long long ll;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef pair<int, int> pii;

/*** chmax, chmin ***/
// a < b ならば a を b で更新
// 更新されたら true を返す
template <typename T>
bool chmax(T &a, const T &b) {
	if (a < b) {
		a = b; 
		return true;
	}
	return false;
}
// a > b ならば a を b で更新
// 更新されたら true を返す
template <typename T>
bool chmin(T &a, const T &b) {
	if (a > b) {
		a = b; 
		return true;
	}
	return false;
}
/*** chmax, chmin ここまで ***/

void Main()
{
	int n,k;
  	cin >> n >> k;
	vector<double> p(n);
  	rep(i,n) {
    	cin >> p[i];
      	p[i] = (1+p[i])/2;
    }
  	double mx = 0;
  	double temp = 0;
  	rep(i,k){
    	temp += p[i];
    }
  	mx = temp;
  	rep(i,n-k){
    	temp += (p[i+k] - p[i]);
      	chmax(mx, temp);
    }
  	
  	cout << mx << endl;
	return;
}

int main()
{
	cin.tie(nullptr);
	ios_base::sync_with_stdio(false);
	cout << fixed << setprecision(15);
	Main();
	return 0;
}


Measured memory_bytes: 1792
s = input()

max_score = 0
score = 0
for i in range(len(s)):
  if s[i] == 'A' or s[i] == 'T' or s[i] == 'G' or s[i] == 'C':
    score += 1
    if max_score <= score:
      max_score = score
  else:
    if max_score <= score:
      max_score = score
    score = 0
  
 
      
print(max_score)

Measured memory_bytes: 3064
#include<iostream>
#include<vector>
void print(std::vector<std::vector<int>> v){
  for(int i=0;i<v.size();i++){
    for(int j=0;j<v[0].size();j++){
	std::cout<<v[i][j]<<" ";
      }
      std::cout<<'\n';
    }
}
int find_max(std::vector<int> v){
  int max=0;
  for(int i=0;i<v.size();i++){
    if(v[i]>max)max=v[i];
  }
  return max;
}


int main(){
  int n,m;
  std::cin>>n;
  std::vector<int> a(n);
  for(int i=0;i<n;i++){
    std::cin>>a[i];
  }

  std::cin>>m;
  std::vector<int> weights(m);
  for(int i=0;i<m;i++){
    std::cin>>weights[i];
  }
  int max=find_max(weights);
  std::vector<std::vector<int>> dp(n,std::vector<int>(max+1,0));
  for(int i=0;i<n;i++){
    dp[i][a[0]]++;
    dp[i][0]++;
  }

  for(int i=1;i<n;i++){
    for(int j=a[i];j<=max;j++){
      if(dp[i-1][j]>=1 or dp[i-1][j-a[i]]>=1 or j==a[i]){
	for(int k=i;k<n;k++){
	  dp[k][j]++;
	}
      }
    }
  }
  int cnt;
  for(int i=0;i<m;i++){
    cnt=0;
    for(int j=0;j<n;j++){
      cnt+=dp[j][weights[i]];
    }
    if(cnt>0)std::cout<<"yes\n";
    else std::cout<<"no\n";
  }
  return 0;
}


Measured memory_bytes: 3160
#include <stdio.h>

int main()
{
   int total ,x ,y, a, b ,c ;
   a = 300000;
   b = 200000;
   c = 100000;
scanf("%d",&x);  
    if(x==1){
        x = a;
    }
    else if(x==2){
        x= b;
    }
    else if(x==3){
        x = c;
    }else {
        x=0;
    }
    scanf("%d",&y); 
if(y==1){
        y= a;
    }
    else if(y==2){
        y= b;
    }
     else if(y==3){
        y= c;
    }
    else{
        y=0;
    }
    if(x==a && y ==a) {
        total = (a*2)+400000;
    }
    else{
        total= x+y;
    }
   printf("%d", total);
    return 0;
}

Measured memory_bytes: 128
import math
answer = 0
score = list(map(int,input().split()))
Alist = []
for i in range(2000):
    if math.floor((i+1)*0.08) == score[0]:
        Alist.append(i+1)
for j in range(2000):
    if math.floor((j+1)*0.10) == score[1]:
        if j+1 in Alist:
            print(j+1)
            answer = 1
            break
if answer == 0:
    print(-1)

Measured memory_bytes: 64552
#include <bits/stdc++.h>
using namespace std;
#define ll long long 
ll a[1000007];
int main() {
    ll i, j, k, l, test, n;
    cin>>n;
    for(i=1;i<=n;i++) cin>>a[i];
    
    map<ll,ll> m;
    for(i=1;i<=n;i++) {
        m[(a[i]-i)]++;
    }
    ll sum=0;
    for(i=1;i<=n;i++) {
        sum+=m[-(a[i]+i)];
    }
    cout<<sum<<"\n";
}


Measured memory_bytes: 27812
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <set>
#include <map>
#include <vector>
#include <queue>
#include <deque>

#define mp make_pair
#define x first
#define y second
#define pb push_back
using namespace std;

int n, m; int64_t sum;
priority_queue<int> H;

int main()
{
    cin >> n >> m;
    for(int i=1; i<=n; ++i) {
        int a; scanf("%d",&a);
        H.push(a);
    }
    for(int i=1; i<=m; ++i) {
        H.push(H.top()>>1);
        H.pop();
    }
    for(int i=1; i<=n; ++i) {
        sum += H.top();
        H.pop();
    }
    cout << sum;
}


Measured memory_bytes: 892
#include <bits/stdc++.h>
#define rep(i, x, y) for(int i = x; i <= y; i ++)
#define rrep(i, x, y) for(int i = x; i >= y; i --)
#define ll long long
#define X first
#define Y second
#define pb push_back
#define mp make_pair
#define pii pair<int, int>
#define ls rt << 1
#define rs rt << 1 | 1
#define mod 1000000007
#define sz(x) (int)(x).size()
#define ALL(x) (x).begin(), (x).end()
#define vi vector<int>
using namespace std;
inline int read()
{
	int x = 0, f = 1; char ch = getchar();
	while (ch < '0' || ch > '9') { if (ch == '-') f = -1; ch = getchar(); }
	while (ch >= '0' && ch <= '9') { x = x * 10 + ch - '0'; ch = getchar(); }
	return x * f;
}
const int N = 100010;
int n, a[N];
int main()
{
	n = read();
	ll l = 2, r = 2;
	rep(i, 0, n - 1) a[i] = read();
	rrep(i, n - 1, 0)
	{
		if((l - 1) / a[i] == r / a[i])
		{
			puts("-1");
			return 0;
		}
		l = ((l - 1) / a[i]) * a[i] + a[i];
		r = (r / a[i]) * a[i] + a[i] - 1;
	}
	cout << l << " " << r;
	return 0;
}


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

// #define TEST_CASES
using ll = long long;
#define ff first
#define ss second
const int N = 1e5 + 10;

void solve()
{
	int a, b, c;
	cin>>a>>b>>c;
	int r = a - b;
	if (r >= c) cout<<0<<endl;
	else cout<<c - r<<endl; 
}

int main()
{
	int t = 1;
#ifdef TEST_CASES
	cin>>t;
#endif
	while(t--)
	{
		solve();
	}
}



Measured memory_bytes: 256
process.stdin.resume();
process.stdin.setEncoding('utf8');

var _HEIGHT = 8;
//入力
var input_string = '';
process.stdin.on('data', function(chunk) {
    input_string += chunk.toString();
});

//main処理
process.stdin.on('end', function() {
    //入力 -> Array
    var lines = input_string.split('\n');
    lines = lines.filter(function(val) {
        return val !== '';
    });
    // ８個ずつ
    while (lines.length >= _HEIGHT) {
        judge(lines.splice(0, _HEIGHT));
    }
});

function judge(ary) {
    tmpAry = ary.filter(function(val) {
       return val.indexOf('1') >= 0; 
    });
    
    compShape(tmpAry);
}

function compShape(ary) {
    switch (ary.length) {
        case 1:
            console.log('C')
            break;
        case 2:
            case2(ary);
            break;
        case 3:
            case3(ary);
            break;
        case 4:
            console.log('B')
            break;
        default:
            console.log('Error');
    }
}

function case2(ary) {
    ind0 = ary[0].indexOf('1');
    ind1 = ary[1].indexOf('1');
    
    if (ind0 < ind1) {
        console.log('E');
    }
    else if (ind0 > ind1) {
        console.log('G');
    }
    else {
        console.log('A');
    }
}

function case3(ary) {
    ind0 = ary[0].indexOf('1');
    ind1 = ary[1].indexOf('1');
    
    if (ind0 > ind1) {
        console.log('D');
    }
    else {
        console.log('F');
    }
}


Measured memory_bytes: 16260
#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>
using namespace std;
#define N 8005
#define ll long long
#define mod 998244353
void Read(int &p)
{
	p = 0;
	char c = getchar();
	for (; c < '0' || c > '9'; c = getchar());
	for (; c >= '0' && c <= '9'; c = getchar())p = p * 10 + c - '0';
}
int k, n, fac[N], inv[N];
int Pow(int a, int k)
{
	if (!k)
		return 1;
	int p = Pow(a, k / 2);
	if (k & 1)
		return (ll)p * p % mod * a % mod;
	return (ll)p * p % mod;
}
int C(int n, int m)
{
	if (n < m)return 0;
	if (m < 0)return 0;
	return (ll)fac[n] * inv[m] % mod * inv[n - m] % mod;
}
int main()
{
	fac[0] = 1;
	for (int i = 1; i <= 8000; i++)
		fac[i] = (ll)fac[i - 1] * i % mod;
	inv[8000] = Pow(fac[8000], mod - 2);
	for (int i = 8000; i >= 1; i--)
		inv[i - 1] = (ll)inv[i] * i % mod;
	Read(k), Read(n);
	for (int i = 2; i <= 2 * k; i++)
	{
		int a, b;
		//printf("%d: ", i);
		if (i & 1)
		{
			if (i <= k + 1)
				a = (i - 1) / 2, b = k - i + 1;
			else
				a = (2 * k - i + 1) / 2, b = i - k - 1;
		}
		else
		{
			if (i <= k + 1)
				a = i / 2 - 1, b = k - i + 1;
			else
				a = (2 * k - i) / 2, b = i - k - 1;
		}
		//printf("(Pairs: %d, Single: %d) ", a, b);
		int ans = 0;
		for (int j = 0; j <= a; j++)
		{
			ans = (ans + (ll)Pow(2, j) * C(a, j) % mod * C(n + b - 1, b + j - 1)) % mod;
			if (!(i & 1))
				ans = (ans + (ll)Pow(2, j) * C(a, j) % mod * C(n + b - 2, b + j - 1)) % mod;
		}
		printf("%d\n", ans);
	}
}
//

Measured memory_bytes: 384
#include <algorithm>
#include <cassert>
#include <iostream>
#include <queue>
#include <utility>
#include <vector>
#include <tuple>

using namespace std;

typedef vector<vector<char> > Field;
typedef vector<vector<bool> > LocationMap;
typedef vector<vector<int> > LocationLevel;

typedef pair<int, int> Location;
typedef queue<Location> LocationQueue;

inline int solve(int h, int w, Field &field,
                 LocationQueue &que, LocationMap& visited, LocationLevel& levels) {
  /*
  cout << h << " " <<  w << " " << endl;
  for(int i = 0; i < h; i++){
    for(int j = 0; j < w; j++){
      cout << field[i][j];
    }
    cout << endl;
  }
  */
  Location loc;
  Location nloc;
  int i, j, level;
  int max_level = 0;
  int dx[4] = {-1, 1, 0, 0};
  int dy[4] = { 0, 0, 1,-1};

  while(que.size()){
    loc = que.front(); que.pop();
    level = levels[loc.first][loc.second];

    for(int n = 0; n < 4; n++){
        i = loc.first  + dx[n];
        j = loc.second + dy[n];

        if (i >= 0 && i <= h - 1 && j >= 0 && j <= w -1 && !visited[i][j] && (field[i][j] == '.')) {
          nloc = make_pair(i,j);
          field[i][j] = '#';
          visited[i][j] = true;
          que.push(make_pair(i,j));
          levels[i][j] = level + 1;
          max_level = max(max_level, level+1);
        }
    }
  }

  return max_level;
}

int main(int argc, char const *argv[]) {
  int h, w;
  char c;
  Field field;
  LocationQueue que;
  LocationMap visited;
  LocationLevel levels;

  cin >> h;
  cin >> w;

  for (int i = 0; i < h; i++) {
    vector<char> row;
    vector<bool> brow;
    vector<int>  lrow;

    for (int j = 0; j < w; j++) {
      cin >> c;
      row.push_back(c);
      lrow.push_back(0);
      if (c == '#') {
        que.push(make_pair(i, j));
        brow.push_back(true);
      } else {
        brow.push_back(false);
      }
    }

    field.push_back(row);
    visited.push_back(brow);
    levels.push_back(lrow);
  }

  cout << solve(h, w, field, que, visited, levels);

  return 0;
}


Measured memory_bytes: 14096
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef long double ld;
typedef pair<ll,ll> p2;
void solve(){
	ll n,m;
	cin>>n>>m;
	vector<ll> h(n+1,0),vis(n+1,1);
	for(ll i=1;i<=n;i++)
	cin>>h[i];
	for(ll i=0;i<m;i++){
		ll x,y;
		cin>>x>>y;
		if(h[x]==h[y]){
			vis[x]=vis[y]=0;
			continue;
		}
		if(h[x]>h[y])
		swap(x,y);
		vis[x]=0;
	}
	ll res=0;
	for(ll i=1;i<=n;i++)
	if(vis[i])
	res++;
	cout<<res;
}
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    ll qc=1;
    for(ll i=1;i<=qc;i++)
    solve();
}


Measured memory_bytes: 4784
#include<algorithm>
#include<cmath>
#include<cstdio>
#include<iostream>
#include<map>
#include<numeric>
#include<queue>
#include<sstream>
#include<stack>
#include<string>
#include<unordered_set>
#include<vector>

#define ll long long
#define P pair<int,int>
#define FOR(i,N) for(int i=0;i<(int)N;i++)
#define FORIN(i,a,b) for(int i=a;i<(int)b;i++)
#define ALL(x) (x).begin(),(x).end()
#define LAST(x) (x)[(x).size()-1]
#define GI(name) int (name);scanf("%d",&(name))
#define GI2(name1,name2) int (name1),(name2);scanf("%d %d",&(name1),&(name2))
#define GI3(name1,name2,name3) int (name1),(name2),(name3);scanf("%d %d %d",&(name1),&(name2),&(name3))
#define GVI(name,size) vector<int> (name)(size);FOR(i,(size))scanf("%d",&(name)[i])
#define MOD 1000000007

using namespace std;

string to_hex(int x){
    stringstream ss;
    ss<<hex<<x;
    return ss.str();
}

inline int get_int(){
    int ret;
    scanf("%d",&ret);
    return ret;
}

inline vector<int> get_ints(int n){
    vector<int> ret(n);
    FOR(i,n){
        scanf("%d",&ret[i]);
    }
    return ret;
}

inline string get_str(){
    string ret;
    cin>>ret;
    return ret;
}

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

vector<P> prime_division(int n){
    vector<P> ret;
    int s=sqrt(n)+1;
    int c=0;
    for(int i=2;i<=n;++i){
        if(n%i==0){
            c=0;
            do{
                ++c;
                n/=i;
            }while(n%i==0);
            ret.push_back(P(i,c));
        }
    }
    return ret;
}

struct UnionFind{
    vector<int> data;
    UnionFind(int size){
        data=vector<int>(size,-1);
    }
    bool union_set(int x,int y){
        x=root(x);
        y=root(y);
        if(x!=y){
            if(data[y]<data[x])swap(x,y);
            data[x]+=data[y];
            data[y]=x;
        }
        return x!=y;
    }
    bool find(int x,int y){
        return root(x)==root(y);
    }
    int root(int x){
        return data[x]<0?x:data[x]=root(data[x]);
    }
    int size(int x){
        return -data[root(x)];
    }
};

string to_string(string s){
    return s;
}

template<class T>
string to_string(vector<T> v){
    string ret="{";
    FOR(i,v.size()-1){
        ret+=to_string(v[i])+",";
    }
    if(v.size()>0){
        ret+=to_string(LAST(v));
    }
    ret+="}";
    return ret;
}

void debug_print(){
    cerr<<endl;
}

template<class Head,class... Tail>
void debug_print(Head head,Tail... tail){
    cerr<<to_string(head)<<" ";
    debug_print(tail...);
}

template<class... T>
void debug(T... args){
    cerr<<"["<<__LINE__<<"]: ";
    debug_print(args...);
}

void print(){
    cout<<endl;
}

template<class Head,class... Tail>
void print(Head head,Tail... tail){
    cout<<to_string(head);
    print(tail...);
}

int main(){
    GI3(a,b,c);
    print(a+b+c-max({a,b,c}));
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define pii pair<int,int>
#define fi first
#define se second
#define int long long
#define pb push_back
#define mod 1000000007
#define pll pair<long long,long long>
using namespace std;
long long power(long long a,long long b){
    long long ans=1;
    while(b>0){
        if(b&1){ans=(ans*a)%mod;}
                a=(a*a)%mod;
                b>>=1;
        }
    return ans;
        
}
bool prime(int n){
    for(int i=2;i*i<=n;i++){
        if(n%i==0)return false;
    }
    return true;
}
int32_t main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    int x,y,k;
    cin>>x>>y>>k;
    if(k>=x){
        if(y>=k-x)cout<<0<<" "<<(y-(k-x));
        else cout<<0<<" "<<0;
    }
    else{
        cout<<x-k<<' '<<y;
    }
    return 0;
}

Measured memory_bytes: 3652
#include <iostream>
#include <vector>
#include <set>
#include <algorithm>
#define ll long long

using namespace std;

int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int n, k;
    cin >> n >> k;
    vector<int> lol(n);
    for (int i = 0; i < n; i++) {
        cin >> lol[i];
    }
    sort(lol.begin(), lol.end(), greater<int>());
    int sum = 0;
    for (int i = 0; i < k; i++) {
        sum += lol[i];
    }
    cout << sum;
}

Measured memory_bytes: 3640
import std.stdio;

void main() {
	int cnt, max;
	foreach(c;readln) {
		if (c == 'A' || c == 'C' || c == 'T' || c == 'G') {
			++cnt;
			if (cnt > max) max = cnt;
		}
		else {
			cnt = 0;
		}
	}
	max.write;
}


Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include <iostream>
#include <sstream>
#include <string>
#include <list>
#include <vector>
#include <queue>
#include <algorithm>
#include <climits>
#include <cstring>
#include <cmath>
#include <stack>
#include <iomanip>
#include <tuple>
#include <functional>
#include <cfloat>
#include <map>
#include <set>
#include <array>
#include <stdio.h>
#include <string.h>
#include <random>
using ll = long long;
using ull = unsigned long long;
using namespace std;
#define int long long
#define CONTAINS_VEC(v,n) (find((v).begin(), (v).end(), (n)) != (v).end())
#define SORT(v) sort((v).begin(), (v).end())
#define RSORT(v) sort((v).rbegin(), (v).rend())
#define ARY_SORT(a, size) sort((a), (a)+(size))
#define REMOVE(v,a) (v.erase(remove((v).begin(), (v).end(), (a)), (v).end()))
#define REVERSE(v) (reverse((v).begin(), (v).end()))
#define ARY_REVERSE(v,a) (reverse((v), (v)+(a)))
#define REP(i, n) for (int (i)=0; (i) < (n); (i)++)
#define REPE(i, n) for (int (i)=0; (i) <= (n); (i)++)
#define CONTAINS_MAP(m, a) (m).find((a)) != m.end()
#define CONTAINS_SET(m, a) (m).find((a)) != m.end()
void YesNo(bool b) { cout << (b ? "Yes" : "No") << endl; }
//void YESNO(bool b) { cout << (b ? "YES" : "NO") << endl; }
void Yes() { cout << "Yes" << endl; }
void No() { cout << "No" << endl; }




//---------- 1000000007 ----------
const int MOD = 1000000007;
int m_add(int a, int b)
{
	return (a + b) % MOD;
}
int m_sub(int a, int b)
{
	return (a + MOD - b) % MOD;
}
int m_mul(int a, int b)
{
	return (a * b) % MOD;
}
int m_pow(int x, int n)
{
	if (n == 0) return 1;
	ll res = m_pow((x * x) % MOD, n / 2);
	if (n & 1) res = (res * x) % MOD;
	return res;
}
int m_div(int a, int b)
{
	return m_mul(a, m_pow(b, MOD - 2));
}
int m_comb(int n, int r)
{
	int i;
	int p = 1;
	for (i = 1; i <= r; i++)
	{
		p = m_mul(p, (n - i + 1));
		p = m_div(p, i);
	}
	return p;
}
int m_comb_with_rep(int n, int r)
{
	return m_comb(n + r - 1, r);
}
int m_perm(int n, int r)
{
	int a = 1;
	for (int i = n; i > n - r; i--)
	{
		a = m_mul(a, i);
	}
	return a;
}



int ans = 0;
int dp[2001];

int func(int n)
{
	if (n <= 5) return 1;
	if (dp[n] >= 0) return dp[n];

	int k = 1;
	for (int i = 3; i <= n - 3; i++)
	{
		int j = n - i;

		int b = func(j);
		k = m_add(k, b);
	}
	dp[n] = k;
	return k;
}


signed main()
{
	int S;
	cin >> S;

	if (S <= 2)
	{
		cout << "0" << endl;
		return 0;
	}

	memset(dp, -1, sizeof(dp));

	cout << func(S) << endl;
}




Measured memory_bytes: 3656
#include<stdio.h>
int main(void){
  int a,b,c,d,m=0,s=0;
  scanf("%d",&a);
  scanf("%d",&b);
  a=a+b;
  scanf("%d",&c);
  a=a+c;
  scanf("%d",&d);
  a=a+d;
  m=a/60;
  s=a%60;
  printf("%d\n",m);
  printf("%d\n",s);
  return(0);
}

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

using namespace std;

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

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

  if(n>=m) {cout << 0 << endl;
           return 0;}

  vector<long> x(m);
  rep(i,0,m) cin >> x[i];
  
  sort(x.begin(),x.end());
  
  vector<long> l(m-1);
  rep(i,0,m-1) l[i]=x[i+1]-x[i];

  sort(l.begin(),l.end(),greater<long>());
  
  long res=x[m-1]-x[0];
  
  rep(i,0,n-1) res-=l[i];
  
  cout << res << endl;
  
   

}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
using pp=pair<int,int>;
using ll=long long;

int main() {
  int N, p;
  cin >> N;
  vector<pp> V(N);
  for (int i=0; i<N; i++) {
    cin >> p;
    V[i]=pp(p,i);
  }
  sort(V.begin(), V.end());
  for (int i=0; i<N; i++) {
    cout << V[i].second+1;
    if (i==N-1) {break;}
    cout << " ";
  }
  cout << endl;
}

Measured memory_bytes: 4032
#include<bits/stdc++.h>
using namespace std;
long long a[200005],mp[2100],ans;
int main(){
	string s;
	cin>>s;
	reverse(s.begin(),s.end());
	long long y=1;
	for(int i=0;i<s.size();i++){
		a[i]=(y*(s[i]-'0'))%2019;
		y=(y*10)%2019;
	}
	y=0;
	for(int i=0;i<s.size();i++){
		y=(y+a[i])%2019;
		mp[y]++;
	}
	for(int i=0;i<2019;i++)
		ans+=mp[i]*(mp[i]-1)/2;
	ans+=mp[0];
	cout<<ans;
	return 0;
}

Measured memory_bytes: 5304
n = input().split()
count = 0
if int(n[0]) > int(n[1]):
  count +=int(n[0])
  if int(n[0])-1 > int(n[1]):
    count +=int(n[0])-1
  else:
    count +=int(n[1])
else:
  count +=int(n[1])
  if int(n[1])-1 > int(n[0]):
	  count +=int(n[1])-1
  else:
	  count +=int(n[0])

print(count)      
  

Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define rep(i,n) for (int i=0; i<n; i++)
typedef long long ll;
using namespace std;
 
int main(){
    int N; cin >> N;
    vector <int> A(N);
    rep(i,N) cin >> A[i];
    int ans=0;
    
    rep(i,N-1){
        for(int j=i+1; j<N; j++){
            ans+=(A[i]*A[j]);
        }
    }
    cout << ans;
}

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

set<int> hamming;
void make_hamming() {
  for(int i=0; i<100; i++)
    for(int j=0; j<100; j++)
      for(int k=0; k<100; k++) {
	int temp = pow(2.0, i)*pow(3.0, j)*pow(5.0, k);
	hamming.insert(temp);
      }
}

int main() {
  make_hamming();
  int m, n;
  while(cin >> m >> n && m) {
    set<int>::iterator it = hamming.begin();
    int cnt = 0;
    for(it; it!=hamming.end(); it++) {
      if(m<=*it && *it <=n) cnt ++;
    }
    cout << cnt << endl;
  }
  return 0;
}

Measured memory_bytes: 1276