akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<queue>
#include<string>
#include<cmath>
#include<cstdio>
#include<cctype>
#include<cstring>
#include<iomanip>
#include<cstdlib>
#include<ctime>
#include<set>
#include<map>
#include<utility>
#include<vector>
#include<stack>
#include<sstream>
#include<algorithm>
using namespace std;
/****************************/
#define ll long long
#define vi vector<int>
#define vvi vector<vi>
#define pii pair<int,int>
#define vpii vector<pair<int,int> >
#define qi queue<int>
#define mii map<int,int>
#define msi map<string,int>
#define vs vector<string>
#define vc vector<char>
/****************************/
#define rep(i,n) for(ll i=0;i<(n);i++)
#define rep2(i,n) for(ll i=(n)-1;i>=0;i--)
#define rep3(i,a,n) for(ll i=(a);i<(n);i++)
#define rep4(i,a,n) for(ll i=(a)-1;i>=n;i--)
#define mp make_pair
#define pb push_back
#define st first
#define nd second
#define pi 3.1415926535897932384626433832795
#define zero(n) memset(n,0,sizeof(n));
#define SZ(n) n.size()
#define sn st.nd 
int dx[4]={1,-1,0,0};
int dy[4]={0,0,1,-1};
/****************************/
ll m,n;
int a[200020];
string s; 
int main()
{
	ll ans=0;
	cin>>n;
	rep(i,n)
	{
		cin>>a[i];
		ans^=a[i];
	}
	rep(i,n)
	{
		int ans2;
		ans2=ans^a[i];
		cout<<ans2<<" ";
	}
	return 0;
}

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

int main(){
    int c =0;
    string s,t;
    cin >> s >> t;

    for(int i=0; i<3 ; ++i){
        if(s[i] == t[i]){
            ++c;
        }
    }
    cout << c << endl;
}

Measured memory_bytes: 256
h = [0] * (M=2019)

h[0] = p10 = 1
ans = cur = 0
gets.to_s.chomp.bytes.reverse_each do |c|
  cur = ( cur + ( c - 48 ) * p10 ) % M # p '0'.ord 48
  ans += h[cur]
  h[cur] += 1
  p10 = p10 * 10 % M
end

puts ans

Measured memory_bytes: 16256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll e[1005][1005];
ll d[1005][1005];
ll n,m;
ll a[1005],b[1005],c;
ll ans;
int main(void){
	cin>>n>>m;
  for(int i=0;i<n;i++){
    for(int j=0;j<n;j++){
      if(i!=j)d[i][j]=1000000000;
    }
  }
	for(int i=0;i<m;i++){
		cin>>a[i]>>b[i]>>c;
		e[a[i]-1][b[i]-1]=c; e[b[i]-1][a[i]-1]=c;
		d[a[i]-1][b[i]-1]=c; d[b[i]-1][a[i]-1]=c;
	}
	for(int k=0;k<n;k++){
		for(int i=0;i<n;i++){
			for(int j=0;j<n;j++){
				d[i][j]=min(d[i][j],d[i][k]+d[k][j]);
			}
		}
	}
	for(int i=0;i<m;i++){
		if(d[a[i]-1][b[i]-1]<e[a[i]-1][b[i]-1]){
			ans++;
		}
	}
	cout<<ans<<endl;
	
}


Measured memory_bytes: 4864
{-# OPTIONS_GHC -O2 -funbox-strict-fields #-}
{-# LANGUAGE BangPatterns #-}
import qualified Data.ByteString.Char8 as BS
import           Data.List             (sortOn, transpose)
import           Data.Maybe            (fromJust)
import           Data.Ord              (Down (Down))

main :: IO ()
main = do
  [n, h] <- readInts <$> BS.getLine
  abs' <- map readInts . BS.lines <$>  BS.getContents
  print $ solve n h abs'

solve :: Int -> Int -> [[Int]] -> Int
solve _ h abs' = c + d where
  [as, bs] = transpose abs'
  maxA = maximum as
  (c, h') = throwSword (0, h) . sortOn Down $ filter (maxA <) bs
  d = (h' + maxA - 1) `div` maxA

throwSword :: (Int, Int) -> [Int] -> (Int, Int)
throwSword ch [] = ch
throwSword (!c, !h) (b:bs)
  | h <= 0 = (c, 0)
  | otherwise = throwSword (c + 1, h - b) bs

readInt :: BS.ByteString -> Int
readInt = fst . fromJust . BS.readInt

readInts :: BS.ByteString -> [Int]
readInts = map readInt . BS.words


Measured memory_bytes: 47484
#include<iostream>
using namespace std;
typedef long long ll;

int main() {
    cin.tie(0);
    cin.sync_with_stdio(0);
    
    ll a, b, x;
    cin >> a >> b >> x;

    ll st = a / x;
    ll end = b / x;

    if (a % x == 0) cout << end - st + 1 << endl;
    else cout << end - st << endl;

}

Measured memory_bytes: 3196
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <cmath>
#include <queue>
#include <set>
#include <map>
#include <iomanip>
#include <fstream>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
const int mod = 1000000007;

int main() {
    ios::sync_with_stdio(false);
    int n;
    ll z = 0;
    cin >> n;
    for (int i = 1; i <= n; i++) if (i % 3 && i % 5) z += i;
    cout << z;
}


Measured memory_bytes: 3616
#include<iostream>
#include<algorithm>
#include<set>
#include<map>
#include<vector>
#include<queue>
#include<cstring>
#include<cmath>
#include<cstdio>
#include<cstdlib>
using namespace std;

int main(){
  int n;
  string s;

  while (cin >> n >> s) {
    int mx = 0;
    for (int i = 0; i < s.size() - 1; i++) {
      set<char> stA, stB;
      for (int j = 0; j <= i; j++) {
        stA.insert(s[j]);
      }
      for (int j = i + 1; j < s.size(); j++) {
        stB.insert(s[j]);
      }

      int cnt = 0;
      for (char ch = 'a'; ch <= 'z'; ch++) {
        if (stA.find(ch) != stA.end() && stB.find(ch) != stB.end()) {
          cnt++;
        }
      }
      mx = max(mx, cnt);
    }

    cout << mx << endl;
  }
}


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

int main(){
    int a,b,h,m;
    cin >>a>>b>>h>>m;
    
    double rad = 2*M_PI*((60*h+m)/720.0 - m/60.0);
    
    double sq = a*a+b*b;
    sq -= 2*a*b*cos(rad);
    printf("%.10lf\n", sqrt(sq));
    return 0;
}

Measured memory_bytes: 4160
#include <cmath>
#include <iomanip>
#include <iostream>
using namespace std;
long double f(int x, int y) {
	return x * sqrtl(y * y - x * x / 4.0L) / 2;
}
int a, l, x;
int main() {
	while(cin >> a >> l >> x) {
		cout << fixed << setprecision(20) << f(a, l) + f(l * 2, l + x) / 2 << endl;
	}
}

Measured memory_bytes: 3152
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <ctime>
#include <cstring>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <bitset>
#include <numeric>
#include <utility>
#include <iomanip>
#include <algorithm>
#include <functional>
using namespace std;

#define COUT(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl
#define EACH(i, s) for (__typeof__((s).begin()) i = (s).begin(); i != (s).end(); ++i)

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; }
template<class T1, class T2> ostream& operator << (ostream &s, pair<T1,T2> P)
{ return s << '<' << P.first << ", " << P.second << '>'; }
template<class T> ostream& operator << (ostream &s, vector<T> P)
{ for (int i = 0; i < P.size(); ++i) { if (i > 0) { s << " "; } s << P[i]; } return s; }
template<class T> ostream& operator << (ostream &s, vector<vector<T> > P)
{ for (int i = 0; i < P.size(); ++i) { s << endl << P[i]; } return s << endl; }
template<class T1, class T2> ostream& operator << (ostream &s, map<T1,T2> P)
{ EACH(it, P) { s << "<" << it->first << "->" << it->second << "> "; } return s << endl; }

int a, b;
int main () {
    cin >> a >> b;
    cout << b * 2 - a << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int n ;
const int mxN=100,M=1e9+7;

int k,a[mxN+1];

//long long dp[mxN][mxN];
int main(){
	cin >> n >> k ;
    for(int i=0 ; i< n ;++i)cin>>a[i];

    vector<bool> dp(k+1);
    for(int i = 0 ; i< k+1 ; ++i){
        for(int j=0 ; j<n ;++j){
            if(a[j]<=i && !dp[i-a[j]]){
                dp[i]=1;
            }
        }
    }
    auto res= dp[k]?"First":"Second";
	cout << res;
}

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

#define int long long

#define CHOOSE(a) CHOOSE2 a
#define CHOOSE2(a0,a1,a2,a3,x,...) x
#define REP1(i, s, cond, cal) for (signed i = signed(s); i cond; i cal)
#define REP2(i, s, n) REP1(i, s, < signed(n), ++)
#define REP3(i, n) REP2(i, 0, n)
#define REP4(n) REP3(___, n)
#define rep(...) CHOOSE((__VA_ARGS__,REP1,REP2,REP3,REP4))(__VA_ARGS__)
#define rrep(i, s) rep(i, s, >= 0, --)

#define all(c) begin(c), end(c)
template<typename T>bool maxup(T& a, const T&& b) { if (a < b) { a = b; return true; }; }
template<typename T>bool maxup(T& a, const T& b) { if (a < b) { a = b; return true; }; }
template<typename T>bool minup(T& a, const T&& b) { if (a > b) { a = b; return true; }; }
template<typename T>bool minup(T& a, const T& b) { if (a > b) { a = b; return true; }; }

#define X first
#define Y second

using VV = vector<vector<int>>;
using V = vector<int>;
using P = pair<int, int>;
using IP = pair<int, P>;

template<typename T>
inline void input(vector<T>& v) { for (auto& x : v) cin >> x; }

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

	int n, m; cin >> n >> m;
	int ans = min(n, m / 2);
	if (m / 2 > n) {
		m -= n * 2;
		ans += m / 4;
	}
	cout << ans << endl;

	system("pause");
}

Measured memory_bytes: 504
package main

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

var sc = bufio.NewScanner(os.Stdin)
var out = bufio.NewWriter(os.Stdout)

func main() {
	sc.Split(bufio.ScanWords)
	defer out.Flush() // !!!!coution!!!! you must use Fprint(out, ) not Print()
	/* --- code --- */
	N, K := nextInt(), nextInt()
	snuke := map[int]int{}
	for i := 0; i < K; i++ {
		d := nextInt()
		for di := 0; di < d; di++ {
			snuke[nextInt()-1] = 0
		}
	}
	fmt.Println(N - len(snuke))

}

// -*-*-*-*-*-*-*-*-
// * I/O utilities *
// -*-*-*-*-*-*-*-*-

func next() string {
	sc.Scan()
	return sc.Text()
}

func nextInt() int {
	a, _ := strconv.Atoi(next())
	return a
}

func nextFloat64() float64 {
	a, _ := strconv.ParseFloat(next(), 64)
	return a
}

func nextInts(n int) []int {
	ret := make([]int, n)
	for i := 0; i < n; i++ {
		ret[i] = nextInt()
	}
	return ret
}
func nextFloats(n int) []float64 {
	ret := make([]float64, n)
	for i := 0; i < n; i++ {
		ret[i] = nextFloat64()
	}
	return ret
}
func nextStrings(n int) []string {
	ret := make([]string, n)
	for i := 0; i < n; i++ {
		ret[i] = next()
	}
	return ret
}

func split(s string) []string {
	ret := make([]string, len([]rune(s)))
	for i, v := range []rune(s) {
		ret[i] = string(v)
	}
	return ret
}

func PrintOut(src interface{}, joinner string) {
	switch reflect.TypeOf(src).Kind() {
	case reflect.Slice:
		s := reflect.ValueOf(src)
		for idx := 0; idx < s.Len(); idx++ {
			fmt.Fprintf(out, "%v", s.Index(idx))
			if idx < s.Len()-1 {
				fmt.Fprintf(out, "%s", joinner)
			} else {
				fmt.Fprintln(out)
			}
		}
	default:
		fmt.Fprintln(out, "fuck")
	}
}

// -*-*-*-*-*-*-*-*-
// * tool snippets *
// -*-*-*-*-*-*-*-*-
func duplicate2Int(base [][]int) (ret [][]int) {
	ret = make([][]int, len(base))
	for i, v := range base {
		ret[i] = append([]int{}, v...)
	}
	return
}

// -*-*-*-*-*-*-*-*-*-*-*-*-*-
// * Algorithms Utility Zone *
// -*-*-*-*-*-*-*-*-*-*-*-*-*-

// -*-*-*-*-*-*-*-
// * 1. nibutan  *
// -*-*-*-*-*-*-*-
func lower_bound(arr []int, target int) int {
	l, r := 0, len(arr)
	for l < r {
		mid := (l + r) / 2
		if arr[mid] < target {
			l = mid + 1
		} else {
			r = mid
		}
	}
	return l
}

func upper_bound(arr []int, target int) int {
	l, r := 0, len(arr)
	for l < r {
		mid := (l + r) / 2
		if target < arr[mid] {
			r = mid
		} else {
			l = mid + 1
		}
	}
	return l
}

// *-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-
// * math flavor typical theories *
// *-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-
func gcd(a, b int) int {
	if a > b {
		return gcd(b, a)
	}
	for a != 0 {
		a, b = b%a, a
	}
	return b
}

func pow(a, b int) (ret int) {
	ret = a
	// 10^2 = 100ってことは10に10を1回掛けることだね
	// なので初期値を含めると上限b-1未満
	for i := 0; i < b-1; i++ {
		ret *= a
	}
	return
}

func powMod(n, m, mod int) (ret int) {
	ret = 1
	for m > 0 {
		if m&1 == 1 {
			ret *= n
			ret %= mod
		}
		n *= n
		n %= mod
		m >>= 1
	}
	return ret
}


Measured memory_bytes: 1772
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define mp make_pair
#define pb push_back
#define fr first
#define sc second
#define Rep(i,n) for(int i=0;i<(n);i++)
#define Rrep(i, m, n) for(int i=(m);i<(n);i++)
#define All(v) v.begin(),v.end()
#define Uniq(v) v.erase(unique(All(v)),v.end())
typedef pair<int, int> Pii;
typedef pair<int, Pii> Pip;
typedef pair<string, int> Psi;
typedef vector<int> Vi;
const int INF = (1<<30);
const int dx[]={1,0,-1,0}, dy[]={0,-1,0,1};

int n, m;
int cost[101][101];
int mincost[101];
bool used[101];


int prim() {
  fill_n(mincost, 101, INF);
  fill_n(used, 101, false);

  mincost[0] = 0;
  int res = 0;

  while( 1 ) {
    int v = -1;
    Rep(u, n) {
      if( !used[u] && (v == -1 || mincost[u] < mincost[v]) ) v = u;
    }

    if( v == -1 ) break;
    used[v] = true;
    res += mincost[v];

    Rep(u, n) {
      mincost[u] = min(mincost[u], cost[v][u]);
    }
  }

  return res;
}

	  
int main()
{
  while( cin >> n >> m, n+m ) {
    fill_n(*cost, 101*101, INF);

    Rep(i, m) {
      int a, b, c;
      cin >> a >> b >> c;
      cost[a][b] = c;
      cost[b][a] = c;
    }

    cout << prim() << endl;
  }

}

Measured memory_bytes: 1200
#include <bits/stdc++.h>
using namespace std;
#define endl '\n'
#define pb push_back
#define all(x) x.begin(), x.end()
#define rep(i, n) for (int i = 0; i < n; ++i)
#define reps(i, m, n) for (int i = m; i <= n; ++i)
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
const int INF = 0x3f3f3f3f;
const ll LINF = 0x3f3f3f3f3f3f3f3fLL;
const int MOD = 1000000009;

signed main()
{
  ios::sync_with_stdio(false);
  cin.tie(0);
  int sum = 0;
  int s;
  rep(i, 10) { cin >> s; sum += s; }

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



Measured memory_bytes: 3212
import sys

def main():
    input = sys.stdin.readline
    S = str(input().strip())
    ans = []
    for s in S:
        if s == '0':
            ans.append('0')
        elif s == '1':
            ans.append('1')
        else:
            if len(ans) > 0:
                ans.pop()

    print(*ans, sep='')


if __name__ == '__main__':
    main()


Measured memory_bytes: 3060
/*input
6
40 1 30 2 7 20
*/
#include <bits/stdc++.h>
#pragma GCC optimize("unroll-loops,no-stack-protector")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef pair<double,double> pdd;
#define IOS ios_base::sync_with_stdio(0); cin.tie(0)
#define ALL(a) a.begin(),a.end()
#define SZ(a) ((int)a.size())
#define F first
#define S second
#define REP(i,n) for(int i=0;i<((int)n);i++)
#define pb push_back
#define MP(a,b) make_pair(a,b)
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define GET_POS(c,x) (lower_bound(c.begin(),c.end(),x)-c.begin())
#ifdef leowang
#define debug(...) do{\
	fprintf(stderr,"%s - %d : (%s) = ",__PRETTY_FUNCTION__,__LINE__,#__VA_ARGS__);\
	_DO(__VA_ARGS__);\
}while(0)
template<typename I> void _DO(I&&x){cerr<<x<<endl;}
template<typename I,typename...T> void _DO(I&&x,T&&...tail){cerr<<x<<", ";_DO(tail...);}
#else
#define debug(...)
#endif
template<typename T1,typename T2>
ostream& operator<<(ostream& out,pair<T1,T2> P){
	out<<'('<<P.F<<','<<P.S<<')';
	return out;
}
//}}}
const ll maxn=300005;
const ll maxlg=__lg(maxn)+2;
const ll INF64=8000000000000000000LL;
const int INF=0x3f3f3f3f;
const ll MOD=ll(1e9+7);
const double PI=acos(-1);
//const ll p=880301;
//const ll P=31;

ll mypow(ll a,ll b){
	ll res=1LL;
	while(b){
		if(b&1) res=res*a%MOD;
		a=a*a%MOD;
		
		b>>=1;
	}
	return res;
}
ll a[maxn];

int main()
{
	IOS;
	int n;
	cin>>n;
	REP(i,n) cin>>a[i];
	sort(a,a+n);

	int l=-1,r=n;
	while(l<r-1){
		int mid=(l+r)/2;
		ll sz=a[mid];
		bool flag=0;
		REP(i,n) if(i!=mid){
			if(a[i]>2*sz){
				flag=1;
				break;
			}
			sz+=a[i];
		}
		//cout<<mid<<' '<<a[mid]<<' '<<flag<<'\n';
		if(flag) l=mid;
		else r=mid;
	}
	cout<<n-r<<'\n';
	return 0;
}


Measured memory_bytes: 1152
#include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <cstring>
#include <map>
#include <queue>
#include <cmath>
#include <complex> // complex<double> a(1.2 , 2.3);// real(): 1.2, imag()2.3
using namespace std;

#define MOD 1000000007
#define ll long long
#define ld long double
#define FOR(i,a,b) for(ll i=(ll)a;i<(ll)b;i++)
#define rep(i,n) FOR(i,0,n)
#define pb push_back
#define mp make_pair
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define rmsame(a) sort(all(a)),a.erase(unique(all(a)), a.end())
#define rmvector(a,b) rep(i,a.size())rep(j,b.size())if(a[i]==b[j]){a.erase(a.begin()+i);i--;break;}
#define pq_pair_tB priority_queue <pair<ll,ll>, vector<pair<ll,ll> > , greater<pair<ll,ll> > > 
#define pq_pair_ts priority_queue <pair<ll,ll> > //第二成分の大きさが関係ない
template<typename X> bool exist(vector<X> vec, X item){return find(all(vec), item)!=vec.end();}
ll gcd(ll a, ll b){if(b==0)return a;return gcd(b,a%b);}
ll lcm(ll a, ll b){return a/gcd(a,b)*b;}

ll cal(ll a,ll b){
    ll ret = 100000000000;
    rep(i, a){
        ll j = b/2;
        ll k = b-j;
        
        ll a1 = i*b;
        ll a2 = j*(a-i);
        ll a3 = k*(a-i);
        
        ll m = min(a1, min(a2, a3));
        ll M = max(a1, max(a2, a3));
        ret = min(ret, M-m);
    }
    return ret;
}

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    ll a,b; cin >> a >> b;
    if((a%3 == 0)||(b%3 == 0)) {
        cout << "0" << endl;
        return 0;
    }
    if(a == 1 || b == 1){
        cout << 1 << endl;
        return 0;
    }
    
    ll ans = min(cal(a,b), cal(b,a)) ;
    ans = min(ans, a);
    ans = min(ans, b);
    
    cout << ans << endl;
    
    //cout << fixed << setprecision(16) << ans << endl;
    return 0;
}


Measured memory_bytes: 256
import java.util.*;

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

		int n = Integer.parseInt(sc.next());
		int k = Integer.parseInt(sc.next());
		int[] h = new int[n];
		long sum = 0;

		for (int i = 0; i < n; i++) {
			h[i] = Integer.parseInt(sc.next());
		}

		Arrays.sort(h);

		for (int i = 0; i < (Math.max(0,n - k)); i++) {
			sum += h[i];
		}
		System.out.println(sum);

		sc.close();
	}
}

Measured memory_bytes: 49132
//http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=2330

#include<iostream>
#include<map>
#include<vector>
#include<algorithm>
#include<cmath>
#include<climits>
#include<ctime>
#include<cstring>
#include<numeric>

#define ALL(v) (v).begin(),(v).end()
#define REP(i,p,n) for(int i=p;i<(int)(n);++i)
#define rep(i,n) REP(i,0,n)
#define dump(a) (cerr << #a << "=" << (a) << endl)
#define DUMP(list) cout << "{ "; for(auto nth : list){ cout << nth << " "; } cout << "}" << endl;

using namespace std;

typedef long long ll;

int main()
{
	ll N;
	cin >> N;
	
	int cnt;
	for(ll i=1; i<N; i*=3){
		cnt++;
	}

	cout << cnt << endl;

	return 0;
}

Measured memory_bytes: 1164
public class Main{
  static double e = 0.0000000001;
  public void run(java.io.InputStream in, java.io.PrintStream out){
    java.util.Scanner sc = new java.util.Scanner(in);
    double a, b;
    int[] l, r;
    int i;
    l = new int[4]; r = new int[4];
    for(;sc.hasNext();){
      a = sc.nextDouble(); b = sc.nextDouble();
      if(a >= 1.1 - e)l[0]++;
      else if(a >= 0.6 - e)l[1]++;
      else if(a >= 0.2 - e)l[2]++;
      else l[3]++;
      if(b >= 1.1 - e)r[0]++;
      else if(b >= 0.6 - e)r[1]++;
      else if(b >= 0.2 - e)r[2]++;
      else r[3]++;
    }
    for(i = 0;i < 4;i++)out.println(l[i] + " " + r[i]);

    sc.close();
  }
  public static void main(String[] args){
    (new Main()).run(System.in, System.out);
  }
}

Measured memory_bytes: 28336
S = input()
ng = False
for i, c in enumerate(S):
    if ((i + 1) % 2 == 0 and c == 'R') or ((i + 1) % 2 == 1 and c == 'L'):
        ng = True
        break
if ng:
    print('No')
else:
    print('Yes')


Measured memory_bytes: 8820
#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 rep2(i,j,n) for(int j=i;j<n;j++)
#define rep3(i,j,n) for(int j=i;j<=n;j++)
#define rrep(i,n) for(int i=n-1;i>=0;i--)
#define sp(n) cout << fixed << setprecision(n)
typedef long long ll;
using namespace std;
const ll inf = 1e+18+1;
struct edge {ll from,to,cost;};
edge es[2000];
ll d[1000];
int V,E;
vector<bool> neg(1000,false);
void vf(){
    rep(i,V) d[i]=inf;
    d[0]=0;
    rep(j,V){
        bool update=false;
        rep(i,E){
            edge e=es[i];
            if(d[e.from]!=inf&&d[e.to]>d[e.from]+e.cost){
                d[e.to]=d[e.from]+e.cost;
                update=true;
            }
        }
        if(!update)break;
    }
    return;
}
void solve(){
    rep(j,V){
        rep(i,E){
            edge e=es[i];
            if(d[e.from]!=inf&&d[e.to]>d[e.from]+e.cost){
                d[e.to]=d[e.from]+e.cost;
                if(e.to==V-1){
                    cout<<"inf"<<endl;
                    return;
                }
            }
        }
    }
    ll res=d[V-1];
    cout<<-res<<endl;
}
int main(void){
    cin>>V>>E;
    rep(i,E){
        int a,b;ll c;cin>>a>>b>>c;a--;b--;
        es[i].from=a;es[i].to=b;es[i].cost=-c;
    }
    vf();
    solve();
}

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

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout << setprecision(20) << fixed;
  int N, K;
  cin >> N >> K;
  long long count = 0;
  for(int i = 1; i <= N; i++){
    long long j = K - i % K;
    long long b = (N - j) / K + 1;
    if((j + j) % K == 0){
      count += b * b;
    }
  }
  cout << count <<endl;
}


Measured memory_bytes: 3692
#include <cassert>
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <algorithm>
#include <bitset>
#include <complex>

#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#define rep(i,n) for(int i=0;i<(n); ++i)
#define rep2(i,n) for(int i=1;i<=(n);++i)

using namespace std;
typedef long long ll;
typedef vector<int> vi;
const int NMAX = 100000;
const int MMAX = 100000;
const int k = 200000;
static const int INF = 1<<21;
static const int NIL = -1;

int dp[3001][3001];
ll gcd(ll a, ll b){
if(a<b) swap(a,b);
    if(b==0) return a;
    return gcd(b, a%b);
}

vector<vi> pre(NMAX+1);
vi dist(NMAX+1);
vector<bool> visited(NMAX+1);

void dfs(int v){
    visited[v]=true; //bool値　訪れたらtrue
    for(int vp:pre[v]){
        if(!visited[vp]){
            dfs(vp);
        }
        dist[v] = max(dist[v],dist[vp]+1);
    }
}

int main(){
    cin.tie(0);
    ios::sync_with_stdio(0); //この2行はより速度を向上させる


    int n,m,s,t,q;
    cin >> n >> m;
    int u,v;
    rep(i,m){
        cin >> u >> v;
        pre[v].push_back(u);
    }
    int ans=0;
    rep2(i,n){
        if(!visited[i]){
            dfs(i);
            ans=max(ans,dist[i]);
        }
    }
    cout << ans << endl;

return 0;
}

Measured memory_bytes: 10624
a=int(input())
moji=input()
r=[]
g=[]
b=[]
for i in range(a):
    if moji[i]=="R":
        r.append(i)
    elif moji[i]=="G":
        g.append(i)
    else:
        b.append(i)
res=len(r)*len(g)*len(b)
if len(r)==0 or len(g)==0 or len(b)==0:
    print(0)
else:
    min_len={0:r,1:g,2:b}
    if len(min_len[0])>len(min_len[1]):
        tmp=min_len[0]
        min_len[0]=min_len[1]
        min_len[1]=tmp
    if len(min_len[1])>len(min_len[2]):
        tmp=min_len[1]
        min_len[1]=min_len[2]
        min_len[2]=tmp
    if len(min_len[0])>len(min_len[1]):
        tmp=min_len[0]
        min_len[0]=min_len[1]
        min_len[1]=tmp
    a1=[]
    for i in range(3):
        a1.append(min_len[i])
    A=set(a1[0])
    B=set(a1[1])
    C=set(a1[2])
    for i in A:
        for j in B:
            if -abs(i-j)+min(i,j) in C:
                res-=1
            if abs(i-j)+max(i,j) in C:
                res-=1
            if abs(i-j)%2==0 and  int(abs(i-j)/2)+min(i,j) in C:
                res-=1
    print(res)


Measured memory_bytes: 74860
/*
*/

//#pragma GCC optimize("O3")
#define _CRT_SECURE_NO_WARNINGS
#include <fstream>
#include <iostream>
#include <string>
#include <complex>
#include <math.h>
#include <set>
#include <vector>
#include <map>
#include <queue>
#include <stdio.h>
#include <stack>
#include <algorithm>
#include <list>
#include <ctime>

#include <memory.h>
#include <assert.h>

#define y0 sdkfaslhagaklsldk

#define y1 aasdfasdfasdf
#define yn askfhwqriuperikldjk
#define j1 assdgsdgasghsf
#define tm sdfjahlfasfh
#define lr asgasgash
#define norm asdfasdgasdgsd
#define have adsgagshdshfhds
#define ends asdgahhfdsfshdshfd

#define eps 1e-8
#define M_PI 3.141592653589793
#define bsize 512

#define ldouble long double
using namespace std;

#define bs 1000000007

const int N = 400031;

int n,a[N],b[N];


long long ans;
long long reach[200];

bool can(long long mask){
	for (int i=0;i<=50;i++){
		reach[i]=(1ll<<i);
	}
	for (int bit=1;bit<=60;bit++){
		if (mask&(1ll<<bit)){
			for (int i=0;i<=50;i++){
				reach[i]|=reach[i%bit];
			}
		}
	}

	for (int i=1;i<=n;i++){
		if (!(reach[a[i]]&(1ll<<b[i])))
			return false;
	}
	return true;
}

bool check(long long mask){
	if (can(mask))
		return true;
	for (int i=0;i<=60;i++){
		if (mask&(1ll<<i)){
			long long V=0;
			for (int j=0;j<=60;j++){
				if (j<i){
					V+=(1ll<<j);
				}
				if (j>i){
					if (mask&(1ll<<j))
						V+=(1ll<<j);
				}
				if (can(V))
					return 1;
			}
			//cout<<mask<<" "<<V<<endl;
		}
	}
	return 0;
}
int main(){
//	freopen("apache.in","r",stdin);
//	freopen("apache.out","w",stdout);
	//freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);
	ios_base::sync_with_stdio(0);
//	cin.tie(0);

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

	ans=(1ll<<60);

	long long l,r;
	l=0;
	r=(1ll<<60);
	if (!check(r)){
		cout<<-1<<endl;
		return 0;
	}

	while (l<r){
		long long mid=l+r;
		mid/=2;
		if (check(mid))
			r=mid;
		else
			l=mid+1;
	}
	cout<<l<<endl;

//	cin.get(); cin.get();
	return 0;
}


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

using namespace std;
#define ll long long
#define ld long double

#define endl '\n'
#define FAST                      \
    ios_base::sync_with_stdio(0); \
    cin.tie(0);                   \
    cout.tie(0);
const ll mod = 1000000007;
const double PI = 3.141592653589793238463;
const int MAXN = 1e5 + 5;
ll fastPow(ll x, ll b)
{
    if (b == 0)
        return 1;
    else if (!(b & 1))
    {
        return fastPow(x * x, b / 2);
    }
    else
        return x * fastPow(x * x, (b - 1) / 2);
}
    //__builtin_popcount ();
    int main()
{
    FAST
  string h;
  cin>>h;
  for (int i = 0; i < h.length(); i++)
  {
      cout<<'x';
  }
  
    return 0;
}

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

int main() {
  string S;
  cin >> S;
  
  string d[4] = {"dream", "dreamer", "erase", "eraser"};
  reverse(S.begin(), S.end());
  for(int i=0; i<4; i++){reverse(d[i].begin(), d[i].end());}
  
  bool can = false;
  
  for(int i=0; i<S.size(); ){
    bool can2 = false;
    for(int j=0; j<4; j++){
      if(S.substr(i,d[j].size()) == d[j]){
        i += d[j].size();

        can2 = true;
        break;
      }
    }

    if(!can2) break;
    if (i == S.size()) can = true;
  }
  if(can) cout << "YES" << endl;
  else cout << "NO"<< endl;
}


Measured memory_bytes: 512
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<iostream>
#include<string>
#include<vector>
#include<stack>
#include<bitset>
#include<cstdlib>
#include<cmath>
#include<set>
#include<list>
#include<deque>
#include<map>
#include<queue>
using namespace std;
typedef long long ll;

int main(){
    int n;
    string s;
    while(cin>>n>>s){
        int w=n-1,r=0,cnt=0;
        while(w>r){
            if(s[w]=='R'&&s[r]=='W'){
                cnt++;
                r++;
                w--;
            }else if(s[w]=='R'){
                r++;
            }else if(s[r]=='W'){
                w--;
            }else{
                r++;
                w--;
            }
        }
        cout<<cnt<<endl;
    }
    return 0;
}

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

int n,s,ans = 0;

void dfs(int i,int sum,int num){
    
    if(num == n){
        
        if(sum == s){
            ans++;
        }
        return;
    }
    if(i == 10){
        return;
    }
    //not including i
    dfs(i+1,sum,num);
    //including i
    dfs(i+1,sum + i,num+1);
}

int main(){

    while(cin >> n >> s){
        if(n == 0 && s == 0){
            break;
        }
        dfs(0,0,0);
        cout << ans << endl;
        ans = 0;
    }

    return 0;
}

Measured memory_bytes: 3048
# include <iostream>
# include <algorithm>
# include <vector>
# include <string>
# include <set>
# include <map>
# include <cmath>
# include <iomanip>
# include <functional>
# include <utility>
# include <stack>
# include <queue>
# include <list>
constexpr int MOD = 1000000007;
constexpr int INF = 2000000000;
using namespace std;

int main() {
	int n;
	cin >> n;
	long long dp[100];
	dp[0] = dp[1] = 1;
	for (int i = 2; i <= n; i++) {
		dp[i] = dp[i - 1] + dp[i - 2];
	}
	cout << dp[n] << endl;
}

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

int main(){
  vector<vector<int>>sec(2,vector<int>(2));
  cin >>sec.at(0).at(0)>>sec.at(0).at(1)>>sec.at(1).at(0)>>sec.at(1).at(1);
  int tmp1=0,tmp2=0;
  int ans=0;
  for(int i=0;i<=100;i++){
    if(i>=sec.at(0).at(0)&&i>=sec.at(1).at(0)&&i<=sec.at(0).at(1)&&i<=sec.at(1).at(1)){
      tmp1=i;
      break;
    }
    if(i==100){
      cout <<0<<endl;
    return 0;
    }
  }
  for(int i=tmp1;i<=100;i++){
    if((i>=sec.at(0).at(1)&&i<=sec.at(1).at(1))||(i<=sec.at(0).at(1)&&i>=sec.at(1).at(1))){
      tmp2=i;
      break;
    }
  }
  cout <<tmp2-tmp1<<endl;
}

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

int main() {
	int K, S;
	cin >> K >> S;

	int count = 0;

	for( int X = 0; X <= K; ++X ) {
		for( int Y = 0; Y <= K; ++Y ) {
			int Z = S - (X + Y);

			if( Z >= 0 && Z <= K ) {
				count += 1;
			}
		}
	}

	cout << count << endl;
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<map>
#include<math.h>
#include<queue>
#include<deque>
#include<stack>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
const int INF = 1e9;
int main() {
	string S;
	cin >> S;
	int ans = INF;
	for (int i = 0; i < S.size()-2; ++i) {
		string s = S.substr(i, 3);
		int num = stoi(s);
		int X = abs(num - 753);
		ans = min(ans, X);
	}
	cout << ans << endl;
	return 0;
}

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

int main(){
  int n,w[200],s[200],hoge,mina,minn=0;
  cin >>n;
  for(int i=0;i<n;i++)cin>>w[i];
  s[0] = w[0];
  for(int i=0;i<n-1;i++)s[i+1]=w[i+1]+s[i];
  mina=abs(s[0]-s[n-1]+s[0]);
  for(int i=0;i<n-1;i++){
    hoge=abs(s[i]-s[n-1]+s[i]);
    if(mina>hoge){
      minn=i;
      mina=hoge;
    }
  }
  cout << mina << endl;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define FOR(i, m, n) for (int i = m; i < (n); i++)
#define RFOR(i, m, n) for (int i = (m - 1); i >= 0; i--)
#define REP(i, n) FOR(i, 0, n)
#define RREP(i, n) RFOR(i, n, 0)
#define ALL(v) v.begin(), v.end()
#define RALL(v) v.rbegin(), v.rend()
using namespace std;
typedef long long ll;
const int mod = 1e9 + 7;

int main() {
  ll n;
  cin >> n;
  n--;
  ll anser = (n * (n + 1)) / 2;
  cout << anser << endl;
  return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<cmath>


using namespace std;

int main(){

   int n;
   cin >> n;

   int a[n+1], v[n+1];
   int sum = 0;

   a[0] = 0;

   for(int i = 1; i <= n; i++){
       cin >> a[i];
       v[i-1] = abs(a[i] - a[i-1]);
       sum += v[i-1];

    }

   v[n] = abs(a[n]);
   sum += v[n];



   for(int i = 1; i <= n; i++){
       cout << (sum - (v[i-1] + v[i]) + abs(a[(i+1)%(n+1)] - a[i-1])) << '\n';
    }

    return 0;
}

Measured memory_bytes: 2048
#include <iostream>

using namespace std;

int main()
{
  int N,i;
  float count=0;
  cin>>N;

  for(i=1;i<=N;i++)
  {
      if(i==1||i%2!=0)
      {
          count++;
      }
  }
  cout<<float(count/N);
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <map>
#include <sstream>
#include <queue>
#include <deque>
#include <set>
#define ll long long
#define MP make_pair
#define PII pair<int, int>
#define PLL pair<ll, ll>
#define F first
#define S second
#define SHN 1e9
#define lSHN 1e18
using namespace std;
string s,t;
string res="zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz";
bool ok=0;
int main()
{
	cin >>s>>t;
	if (t.size()>s.size())
	{
		cout <<"UNRESTORABLE";
		return 0;
	}
	for (int i=0;i<=s.size()-t.size();i++)
	{
		bool fl=1;
		for (int j=i;j<i+t.size();j++)
		{
			if (s[j]=='?') continue;
			if (s[j]!=t[j-i])
			{
				fl=0;
				break;
			}
		}
		if (fl)
		{
			string r="";
			for (int j=0;j<i;j++)
			    r+=(s[j]=='?' ? 'a' : s[j]);
			r+=t;
			for (int j=i+t.size();j<s.size();j++)
			    r+=(s[j]=='?' ? 'a' : s[j]);
			res=min(res,r);
			ok=1;
		}
	}
	if (ok) cout <<res;
	else cout <<"UNRESTORABLE";
	return 0;
}

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

using namespace std;

using ll = long long;

#define rep(__name, __times) for (int __name = 0; __name < __times; __name++)
#define repFromUntil(__name, __from, __until) for (int __name = __from; __name < __until; __name++)
#define repFromTo(__name, __from, __to) for (int __name = __from; __name <= __to; __name++)
#define repr(__name, __times) for (int __name = __times - 1; __name >= 0; __name--)
#define reprFromTo(__name, __from, __to) for (int __name = __to; __name >= __from; __name--)


#define putint(__n) printf("%d\n", __n)
#define putintiter(__iter) do {for (auto __e : __iter) printf("%d ", __e); printf("\n");} while(false)
#define putintmatrix(__iter) do {for (auto __i : __iter) { \
  for (auto e : __i) printf("%d ", e); printf("\n"); \
} printf("\n"); } while(false)

#define F(__argdecl, __expr) [](__argdecl){ return (__expr); }

#define chmin(__var, __target) __var = min(__var, __target)
#define chmax(__var, __target) __var = max(__var, __target)

class Scanner {
  public:
    operator int() {
      int n;
      scanf("%d", &n);
      return n;
    }
    operator ll() {
      ll n;
      scanf("%lld", &n);
      return n;
    }
    operator float() {
      float x;
      scanf("%f", &x);
      return x;
    }
    operator double() {
      double x;
      scanf("%lf", &x);
      return x;
    }
    operator char() {
      char c;
      do {
        c = getchar();
      } while (isspace(c));
      return c;
    }
};
Scanner IN;

int main() {
  int N = IN, W = IN;
  vector<int> dp(W+1, 0);
  rep(i, N) {
    int v = IN, w = IN;
    repFromTo(j, w, W) chmax(dp[j], dp[j-w] + v);
  }
  printf("%d\n", dp[W]);
}


Measured memory_bytes: 3268
#include <bits/stdc++.h>
#define ll long long
const int mod=1e9+7;
const int maxn=1e5+5;
using namespace std;
int n,m,k,a[maxn],b[maxn],mi1=0x3f3f3f3f,mi2=0x3f3f3f3f,s,x,y,z;

int main()
{
	cin>>n>>m>>k;
    for(int i=1;i<=n;i++) {
        cin>>a[i];
        mi1=min(mi1,a[i]);
    }
    for(int i=1;i<=m;i++) {
        cin>>b[i];
        mi2=min(mi2,b[i]);
    }
    s=mi1+mi2;
    while(k--){
        cin>>x>>y>>z;
        s=min(s,a[x]+b[y]-z);
    }
    cout<<s<<endl;
    return 0;
}

Measured memory_bytes: 1024
#pragma GCC optimize("O3")

#include<bits/stdc++.h>
#define sp " "
#define endl "\n"
#define MAX 10e9
#define MAXN 100001
#define mod 1000000007
#define inf_int 2e9
#define inf_ll 2e18
#define e 1e-9
#define vi vector<int>
#define vl vector<ll>
#define vc vector<char>
#define vs vector<string>
#define vpl vector<pair<ll,ll>>
#define vpc vector<pair<char,char>>
#define adj_list vector<vl>
#define umap unordered_map<ll, ll>
#define pll pair<ll,pair<ll, ll>>
#define clr(x) memset(x,0,sizeof(x))
#define cy cout << "YES" << endl
#define cn cout << "NO" << endl
#define google cout << "Case #" << ++it << ": " << ans << endl;
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
using namespace std;
typedef long long int ll;

ll it = 0, ans = 0;

ll spf[MAXN];
void sieve()
{
    spf[1] = 1;
    for (auto i=2; i<MAXN; i++)
  		spf[i] = i;
  	for (auto i=4; i<MAXN; i+=2)
        spf[i] = 2;
    for (auto i=3; i*i<MAXN; i++)
    {
        if (spf[i] == i)
        {
            for (auto j=i*i; j<MAXN; j+=i)
                if (spf[j]==j)
                    spf[j] = i;
        }
    }
	return;
}

vl getFactorization(ll x)
{
    vl ret;
    while (x != 1)
    {
        ret.push_back(spf[x]);
        x = x / spf[x];
    }
    return ret;
}


void check()
{
	char x;
	cin >> x;
	if(x>='A' and x<='Z') cout << "A";
	else cout << "a";
    return ;
}

int32_t main()
{
    fastio
    ll t = 1;
    // cin >> t;
    while(t--)
        check();
    return 0;
}


Measured memory_bytes: 3620
#include<stdio.h>

int main(){
	int a[10],t,i,j;
	for(i=0;i<10;i++){
		scanf("%d",&a[i]);
	}
	for(i=0;i<10-1;i++){
		for(j=i+1;j<10;j++){
			if(a[j]>a[i]){
				t=a[j];
				a[j]=a[i];
				a[i]=t;
			}
		}
	}
	printf("%d\n%d\n%d\n",a[0],a[1],a[2]);
	return 0;
}

Measured memory_bytes: 600
#include<iostream>
#include<vector>
#include<math.h>
#include<algorithm>
using namespace std;
typedef long long ll;

ll gcd(ll a, ll b) { if (a % b == 0) { return b; } else { return gcd(b, a % b); } }
ll mod(ll a) { return a % 1000000007; }
#define K 1000000007


int main() {
	ll n;
	cin >> n;
	vector<ll> A(n);
	for (int i = 0; i < n; i++) cin >> A[i];
	ll sum = 0;
	for (int i = 0; i < n; i++) sum = (sum + A[i])%K;
	ll ans = 0;
	for (int i = 0; i < n - 1; i++) {
		sum = (sum - A[i])%K;
		ans = (ans + ((A[i]-K) * (sum-K))%K)%K;
	}
	cout << ans % K << endl;
	return 0;
}

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

using namespace std;

int main(void) {
    long int n, k, a, de;
    long int ans = 1000000000000000001;

    cin >> n >> k;

    
    while(!(ans == 0)){
        if(n >= k){
            de = n / k;
            a = abs(n - (k * de));

            ans = min(ans, a);
            n = a;
            
        }
        else{
            a = abs(n - k);
            if(ans < a){
                break;
            }
            ans = min(ans, a);
            n = a;
        }
    }

    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
  string n;
  cin >> n;
  int x = n.at(n.size()-1);
  if(x=='3'){
    cout << "bon" << endl;
    return 0;
  }
  if(x=='0' || x=='1' || x=='6' || x=='8'){
    cout << "pon" << endl;
    return 0;
  }
  else {
    cout << "hon" << endl;
    return 0;
  }
  }

Measured memory_bytes: 3624
#include <iostream>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <algorithm>
#include <functional>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <bitset>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll,ll> P;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<char> vc;
typedef vector<string> vs;
typedef vector<P> vp;
#define rep(i,a,n) for(ll i = (a);i < (n);i++)
#define per(i,a,n) for(ll i = (a);i > (n);i--)
#define lep(i,a,n) for(ll i = (a);i <= (n);i++)
#define pel(i,a,n) for(ll i = (a);i >= (n);i--)
#define clr(a,b) memset((a),(b),sizeof(a))
#define pb push_back
#define all(c) (c).begin(),(c).end()
#define sz size()
#define endl "\n"
#define print(X) cout << (X) << "\n"
// // #define input(X) getline(cin,X)
static const int INF = 1e+9+7;
static const ll INFL = 1e+18+7;
ll n,m,l;
string s,t;
ll d[200010],e[200010],dp[1001][1001];
char field[200][200];

int main(){
  cin >> n >> m >> l;
  print((n+m)*l/2);
  return 0;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main()
{
    int n, p[22], ans = 0;
    cin >> n;
    for (int i = 0; i < n; i++) cin >> p[i];
    for (int i = 2; i < n; i++)
    {
        if ((p[i - 2] > p[i - 1] && p[i - 1] > p[i]) || (p[i - 2] < p[i - 1] && p[i - 1] < p[i]))
        ans++;
    }
    cout << ans;
}

Measured memory_bytes: 384
#include <iostream>
#include <vector>
#include <string>

typedef long long ll;
using namespace std;



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

    for(int i = 0; i < m; i++){
        int sum = 0;
        int surv = t[p[i] - 1];//変更する数字を退避

        t[p[i] - 1] = x[i];
        for(int j = 0; j < n; j++){
            sum += t[j];
        }
        cout << sum << endl;
        t[p[i] - 1] = surv;
    }
    return 0;
}

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

int main () {
  int N;
  cin >> N;
  int K;
  cin >> K;
  int n[N];
  int i;
  int dis=0;
  for (i=0;i<N;++i) {
    cin >> n[i];
    if (K < n[i]) {
      dis += n[i]-K;
    } else if (K-n[i] > n[i]) {
      dis += n[i];
    } else {
      dis += K-n[i];
    }
  }
  dis *= 2;
  cout << dis << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#include<math.h>
#include<queue>
#include<numeric>
#include<string>
#define all(x) (x).begin(),(x).end()
typedef long long ll;
const ll MOD = 1000000007;
 
using namespace std;

int main()
{
    ll N, K;    cin >> N >> K;
    vector<int> v(N+1), c(N+1,0);
    for(int i=1; i<N+1; i++)  cin >> v[i];
    int now = 1, l, r;
    for(int i=1; i<=min(N+5,K); i++){
        now = v[now];
        if(c[now] > 0){
            l = i - c[now];
            r = (K - c[now])%l;
            for(int j=0; j<r; j++)  now = v[now];
            cout << now;
            return 0;
        }
        c[now] = i;
    }
    cout << now;
}

Measured memory_bytes: 4836
import java.io.BufferedReader
import java.io.InputStreamReader
import java.io.PrintWriter
import kotlin.math.abs
import kotlin.math.max
import kotlin.math.min

val br = BufferedReader(InputStreamReader(System.`in`))
val out = PrintWriter(System.out)

fun main() {
    br.use { out.use {
        solve()
        out.flush()
    } }
}

fun solve() {
    val (x, k) = readLongList()
    val tmp = x % k
    val ans = min(tmp, abs(tmp - k))
    out.println(ans)
}

fun readInteger() = Integer.parseInt(br.readLine())
fun readLong() = java.lang.Long.parseLong(br.readLine())
fun readStringList() = br.readLine()!!.split(' ')
fun readIntegerList() = readStringList().map(Integer::parseInt)
fun readLongList() = readStringList().map(java.lang.Long::parseLong)
fun readDoubleList() = readStringList().map(java.lang.Double::parseDouble)


Measured memory_bytes: 36380
R,D,X=input().split()
r=int(R)
d=int(D)
x0=int(X)
x1=r*x0-d
x2=r*x1-d
x3=r*x2-d
x4=r*x3-d
x5=r*x4-d
x6=r*x5-d
x7=r*x6-d
x8=r*x7-d
x9=r*x8-d
x10=r*x9-d
print(x1)
print(x2)
print(x3)
print(x4)
print(x5)
print(x6)
print(x7)
print(x8)
print(x9)
print(x10)

Measured memory_bytes: 3188
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <cmath>
#include <functional>
#define ll long long int
using namespace std;
int h[6], w[6];

int main() {
	int x, ans = 0;

	cin >> x;

	ans = x + x*x + x*x*x;

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 3608
from collections import deque
from bisect import bisect_right
from math import ceil

N, D, A = map(int, input().split())
monsters = []
for _ in range(N):
    x, h = map(int, input().split())
    monsters.append((x, h))
monsters.sort()
#print("monsters = {}".format(monsters))
"""
どうせ左端のモンスターはいつか倒さないといけない（かつ爆弾投下順は不問）ので、
左端のモンスターから順に、なるべく爆弾を右に寄せて落としていけば良い。

BITを使って区間に爆弾のダメージを追加して考えても良いが、
ここではimos法チックな回答を与える。

仮に全ての爆弾が前モンスターに攻撃を与えるとしよう。
すると各モンスターにどれだけ流れダメージが飛んできたかは累積和で求まる。->totalで累積ダメージを管理。
しかし今回は爆弾に有効範囲があるため、有効期限切れの爆弾ダメージはtotalから除く必要がある。
そこでキューに（爆弾のダメージが入る限界線、爆弾のダメージ）を追加していき、各モンスターを見たとき
爆弾の期限が切れていたらpopleftで期限切れ爆弾を捨てていく。
（それ以降のモンスターに対してもその爆弾は期限切れなので、永久に捨て去って問題ない）。

以下のサイトの解説が参考になりました↓
https://at274.hatenablog.com/entry/2020/02/01/060000
"""

total = 0
ans = 0
q = deque([])

for i in range(N):
    x, h = monsters[i]

    # 期限切れ爆弾を捨てていき、残ったまだ有効な爆弾分の累積ダメージをモンスターに与える
    while q and q[0][0] < x:
        total -= q[0][1]
        q.popleft()
    h -= total

    # まだモンスターも体力が残っていれば、爆弾で追加ダメージを与える
    if h > 0:
        # まずはモンスターをやっつける
        times = ceil(h / A)
        ans += times
        #print("ans+={} for monster {}".format(times, i))

        # その後後ろへの流れダメージをtotalに追加し、爆弾の有効範囲をキューに追加
        damage = times * A
        total += damage
        q.append((x + 2 * D, damage))

print(ans)


Measured memory_bytes: 76888
// ABC176B.cpp :

//#include "pch.h"
#include <iostream>
#include <string>

using namespace std;
int main()
{
	string s;
	cin >> s;
	char c;
	int ci;
	int nums = 0;
	for (int i = 0; i < s.length(); i++) {
		c = s.at(i);
		ci = c - '0';
		nums += ci;
	}
	if (nums % 9 == 0) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}
}


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

import array


class UnionFind(object):

    def __init__(self, number_of_nodes):
        self.par = array.array("I", range(number_of_nodes))
        self.rank = array.array("I", (0 for i in range(number_of_nodes)))

    def root(self, node):
        if self.par[node] == node:
            return node
        else:
            r = self.root(self.par[node])
            self.par[node] = r
            return r

    def in_the_same_set(self, node1, node2):
        return self.root(node1) == self.root(node2)

    def unite(self, node1, node2):
        x = self.root(node1)
        y = self.root(node2)
        if x == y:
            pass
        elif self.rank[x] < self.rank[y]:
            self.par[x] = y
        else:
            self.par[y] = x
            if self.rank[x] == self.rank[y]:
                self.rank[x] += 1


if __name__ == "__main__":
    n, q = map(int, input().split())
    uf = UnionFind(number_of_nodes=n)
    for i in range(q):
        c, x, y = map(int, input().split())
        if c == 0:
            uf.unite(x, y)
        elif c == 1:
            print(int(uf.in_the_same_set(x, y)))

Measured memory_bytes: 7964
#include<bits/stdc++.h>
using namespace std;
int main()
{
  	int a,b;
  	cin>>a>>b;
  	bool used[5];
  	for(int i=1;i<=3;i++)
      	used[i]=false;
  	used[a]=true;
  	used[b]=true;
  	for(int i=1;i<=3;i++)
      	if(!used[i])
          	cout<<i<<endl;
    return 0;
}

Measured memory_bytes: 3624
# coding: utf-8

import sys
import math
import collections
import itertools
import bisect
INF = 10 ** 13
MOD = 10 ** 9 + 7
def input() : return sys.stdin.readline().strip()
def gcd(x, y) : return x if y == 0 else gcd(y, x%y)
def lcm(x, y) : return (x * y) // gcd(x, y)
def I() : return int(input())
def LI() : return [int(x) for x in input().split()]
def RI(N) : return [int(input()) for _ in range(N)]
def LRI(N) : return [[int(x) for x in input().split()] for _ in range(N)]
def LS() : return input().split()
def RS(N) : return [input() for _ in range(N)]
def LRS(N) : return [input().split() for _ in range(N)]
def PL(L) : print(*L, sep="\n")
def YesNo(B) : print("Yes" if B else "No")
def YESNO(B) : print("YES" if B else "NO")

N, K = LI()
A = LI()

D = 60
to = [[-1] * N for _ in range(D)]
to[0] = [a-1 for a in A]

for i in range(D-1):
    for j in range(N):
        to[i+1][j] = to[i][to[i][j]]

now = 0
time = 0
while K > 0:
    if K&1:
        now = to[time][now]
    
    K >>= 1
    time += 1

print(now+1)


Measured memory_bytes: 176148