akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
#define rep(i,m,n) for(int i=(int)(m);i<(int)(n);++i)
#define rREP(i,m,n) for(int (i)=(n)-1; (i)>=(m);--(i))
#define all(x) (x).begin(),(x).end()
#define out(y,x,h,w) (y)<0||(x)<0||(y)>=(h)||(x)>=(w)
constexpr int INF = 1000000001;
constexpr ll mod = 1000000007;
constexpr double PI = 3.1415926535897932;

template<class T>inline bool chmin(T& a, T b) {
	if (a > b) {
		a = b;
		return true;
	}
	return false;
}
template<class T>inline bool chmax(T& a, T b) {
	if (a < b) {
		a = b;
		return true;
	}
	return false;
}
inline void init() {
	cin.tie(nullptr); cout.tie(nullptr);
	ios::sync_with_stdio(false);
	cout << fixed << setprecision(15);
}

int main() {
	init();
	
	int N, M; cin >> N >> M;
	vector<int>A(N);
	int cnt = 0;
	rep(i, 0, N) {
		int a; cin >> a;
		A[i] = a;
		cnt += a;
	}
	int ans = 0;
	rep(i, 0, N) {
		if (4 * M * A[i] >= cnt)ans++;
	}
	cout<<(ans >= M ? "Yes" : "No") << "\n";

	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>

/* ソートの時につかうやつ
int sort(const void *a, const void *b){
    return *(int*)a-*(int*)b ;
}
    qsort (data,sizeof(data),sizeof(int),sort);
*/

int main(void){
    int n,sum=0;
    scanf("%d",&n);
    int a[n+2];
    a[0]=0;
    a[n+1]=0;
    for (int i=1; i<n+2; i++){
        if (i<n+1){
            scanf("%d",&a[i]);
        }
        sum+=abs(a[i]-a[i-1]);
    }
    for (int i=1; i<n+1 ;i++){
        int ans=sum;
        ans-= abs(a[i-1]-a[i])+abs(a[i]-a[i+1]);
        ans+= abs(a[i-1]-a[i+1]);
        printf ("%d\n",ans);
    }
    return 0 ;
}

Measured memory_bytes: 1536
#include<iostream>
#include<vector>
#include<algorithm>
#include<cmath>

using namespace std;

#define rep(i, n) for(int (i) = 0; (i) < (n); (i)++)
#define repn(i, n) for(int (i) = 1; (i) <= (n); (i)++)
#define repr(i, n) for(int (i) = (n-1); (i) >= 0; (i)--)
#define all(x) (x).begin(), (x).end()
#define lint long long

int main(){
    int r; cin >> r;
    string ans;
    if(r < 1200) ans = "ABC";
    else if(r < 2800) ans = "ARC";
    else ans = "AGC";
    cout << ans << endl;
}

Measured memory_bytes: 256
# 左から歩いてN-1区間スキップ
import numpy as np
N,M = map(int,input().split())
X = np.array(input().split(), dtype=np.int64)
X.sort()
X = np.diff(X)
X.sort()
if M-N >= 0:
  answer = X[:M-N].sum()
else:
  answer = 0
print(answer)

Measured memory_bytes: 22468
#include <bits/stdc++.h>
#define rep(i,m,n) for(int i=m;i<n;i++)
#define c(n) cin>>n
#define c2(n,m) cin>>n>>m
#define c3(n,m,k) cin>>n>>m>>k
#define c4(n,m,k,l) cin>>n>>m>>k>>l
#define co(n) cout<<n<<endl
using namespace std;

int main(){
  int a,b,c,d,e=1,n=1;
  c(a);
  while(n<a){
    e++;
    n+=e;
  }
  co(e);
  
  
  return 0;
}


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

using namespace std;

#define lli long long int
#define REP(i,s,n) for(int i=s;i<n;i++)
#define MOD 1000000007
#define NUM 2520
#define INF (1LL<<50)
#define DEBUG 1
#define mp(a,b) make_pair(a,b)
#define SORT(V) sort(V.begin(),V.end())
#define PI (3.141592653589794)

bool compareHeight(const pair<lli,lli> &a,const pair<lli,lli> &b){
	return a.first < b.first;
}

signed main(){

	lli n,d,a;
	cin>>n>>d>>a;

	vector<pair<lli,lli>> v;
	REP(i,0,n){
		lli x,h;
		cin>>x>>h;
		v.push_back({x,h});
	}
	sort(v.begin(),v.end(),compareHeight);

	queue<lli> xQ;
	queue<lli> bomQ;

	lli bom=0;
	lli ans = 0;
	REP(i,0,n){
		lli nowX = v[i].first;
		lli nowHP = v[i].second;
		//bomCheck
		while(xQ.size()!=0 && xQ.front() < nowX){
			bom -= bomQ.front();
			xQ.pop();
			bomQ.pop();
		}
		//bom action!
		nowHP -= a * bom;

		//bom add
		if(nowHP>0){
			lli addBom = (nowHP-1)/a + 1;
			bom += addBom;
			bomQ.push(addBom);
			xQ.push(nowX + 2*d);
			ans += addBom;
		}
	}
	cout<<ans<<endl;

	return 0;
}

Measured memory_bytes: 6384
#include<cstdio>
#include<queue>
#include<utility>
#include<cstring>
#include<stack>
#include<algorithm>
#include<cmath>
#include<iostream>
#define INF 2147483647
#define REP(i,n) for(int i=0;i<(int)(n);i++)
int dx[4] = {1,0,0,-1};
int dy[4] = {0,1,-1,0};
using namespace std;
int main()
{
  long long int count=0;
  int N,A[200001],l,r,sum;
  cin >> N;
  REP(i,N) cin >> A[i];
  l = 0;
  r = 0;
  sum = 0;
  while(l < N){
    if(r == N){
      count += r-l-1;
      l++;
    }else{
      if( (sum ^ A[r]) == (sum + A[r])){
        sum = sum ^ A[r];
        count++;
        r++;
      }else{
        count += r-l-1;
        sum = sum ^ A[l];
        l++;
      }
    }
  }
  cout << count << endl;
  return 0;
}


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

long long check(string s) {
    long long ret = 0;
    for (int i = 1; i < s.size(); i++) {
        if (s[i] == s[i-1]) {
            i++; ret++;
        }
    }
    return ret;
}

int main() {
    string s; cin >> s;
    int k; cin >> k;
    string ss = s + s;
    string sss = s + s + s;
    auto ns = check(s);
    auto nss = check(ss);
    auto nsss = check(sss);
    if (k & 1) {
        cout << ns + (nsss - ns) * (k/2) << endl;
    } else {
        cout << nss + (nsss - ns) * ((k-2) / 2) << endl;
    }
    return 0;
}

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(){
  string s;
  cin >> s;
  if(s[0]==s[1] && s[1]==s[2]) cout << "No" << endl;
  else cout << "Yes" << endl;
}

Measured memory_bytes: 3568
#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(){
    string s;
    cin >> s;
    vector<int> n0(2019);
    vector<int> n1(2019);
    vector<int> nm(2019);
    vector<int> na(2019);
    rep(i, 2019){ n0.at(i) = 0; na.at(i) = 0; nm.at(i) = 0;}
    rep(i, s.size()){
        rep(j, 2019) nm.at(j) = n1.at(j);
        rep(j, 2019) n1.at(j) = 0;
        rep(j, 2019) n1.at((j*10 + (s.at(i)-'0'))%2019) = nm.at(j);
        n1.at(s.at(i)-'0')++;
        rep(j, 2019) n0.at(j) += n1.at(j);
//        rep(j, 2019) na.at(j) += n0.at(j);
/*        rep(j, 2019) cout << n0.at(j) << ' ';
        cout << " n0" << endl;
        rep(j, 2019) cout << n1.at(j) << ' ';
        cout << " n1" << endl;*/
/*        rep(j, 2019) cout << nm.at(j) << ' ';
        cout << " nm" << endl;
        rep(j, 2019) cout << nm.at(j) << ' ';
        cout << " na" << endl;
        cout << endl;*/
    }
    cout << n0.at(0) << endl;
    return 0;
}

Measured memory_bytes: 3756
i = list(map(int, input().split())) #i_1 i_2を取得し、iに値を入れる

A = i[0]
B = i[1]
C = i[2]

K = int(input())
count = 0

for i in range(K):
  if B<=A:
    B = B*2
    count = count + 1
  if B>A:
    break
    

for i in range(K-count):
  if C<=B:
    C = C*2
  if C>B:
    print("Yes")
    break

if A>=B:
  print("No")
elif B>=C:
  print("No")

Measured memory_bytes: 9200
n,m = gets.split.map(&:to_i)
students = n.times.map{gets.split.map(&:to_i)}
points = m.times.map{gets.split.map(&:to_i)}

students.each do |s|
  min_d = 10**10
  ans = 0
  points.each_with_index do |p, i|
    dist = (s[0]-p[0]).abs + (s[1]-p[1]).abs
    if dist < min_d
      min_d = dist
      ans = i+1
    end
  end
  puts ans
end

Measured memory_bytes: 1788
#include<bits/stdc++.h>
#define fu(i,r,t) for(int i=r;i<=t;i++)
#define fd(i,r,t) for(int i=r;i>=t;i--)
#define IOS ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define int long long
#define INF 1e10
#define lson l,m,rt<<1
#define rson m+1,r,rt<<1|1
#define ll rt<<1
#define rr rt<<1|1
#define MM int m=(l+r)>>1;
#define len (r-l+1)
using namespace std;
const int maxn = 1e5+10;
int n,m,a[maxn],b[maxn];
int32_t main(){
    IOS;
    int x,y,z;
    int ans=0;
    cin>>x>>y>>z>>n;
    for (int i = 0; i <= n; i+=x) {
        for(int j=0;i+j<=n;j+=y)
        {
            int sheng=n-i-j;
            if(sheng/z*z==sheng)ans++;
        }
    }
    cout<<ans;
    return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

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

		String n = sc.next();

		for (int i = 0; i < n.length(); i++) {
			char c = n.charAt(i);
			System.out.print(c == '1' ? '9' : '1');
		}

		System.out.println();

		sc.close();

	}
}



Measured memory_bytes: 22868
#include <bits/stdc++.h>
#define st first
#define nd second
#define mp make_pair
#define pb push_back
#define sol (k+k)
#define sag (k+k+1)
#define orta ((bas+son)/2)
#define ort ((bas+son+1ll)/2ll)
#define coc g[node][i]
#define mod 1000000007
#define inf 1000000009
#define N 1000005
using namespace std;
 
typedef long long ll;
typedef pair < int , int > ii;
 
int x,y;
int main() {
	
	cin >> x >> y; 
	if(x + y == 3) cout << "3";
	else if (x + y == 4) cout << "2";
	else
	 cout << "1";
	 
	return 0;
}


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

int main() {
  int n,W;
  cin >> n >> W;
  ll w[n], v[n];
  for(int i = 0; i < n; i++){
    cin >> w[i] >> v[i];
  }
  ll dp[n+1][100010]={};
  for(int i = 0; i <= n; i++){
    for(int j = 0; j <= 100000; j++){
      dp[i][j] = 1000000000000;
    }
  }
  dp[0][0] = 0;
  for(int i = 0; i < n; i++){
    for(int j = 0; j <= 100000; j++){
      if(j >= v[i]){
        dp[i+1][j] = dp[i][j-v[i]] + w[i];
      }
      dp[i+1][j] = min(dp[i+1][j], dp[i][j]);
    }
  }

  ll ans = 0;
  for(int i = 0; i <= 100000; i++){
    if(dp[n][i] <= W) ans = i;
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 79104
n = int(input())
root = set(range(n))
nodes = [0 for i in range(n)]
for i in range(n):
    node = list(map(int, input().split()))
    children = node[1:3]
    root -= set(children)
    nodes[node[0]] = children

def preorder(id):
    if(id == -1):
        return
    order.append(id)
    preorder(nodes[id][0])
    preorder(nodes[id][1])

def inorder(id):
    if(id == -1):
        return
    inorder(nodes[id][0])
    order.append(id)
    inorder(nodes[id][1])

def postorder(id):
    if(id == -1):
        return
    postorder(nodes[id][0])
    postorder(nodes[id][1])
    order.append(id)

order = []
preorder(list(root)[0])
print('Preorder')
print(' ', end='')
print(*order)
order = []
inorder(list(root)[0])
print('Inorder')
print(' ', end='')
print(*order)
order = []
postorder(list(root)[0])
print('Postorder')
print(' ', end='')
print(*order)



Measured memory_bytes: 5616
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<numeric>
#include<utility>

using namespace std;

typedef long long int ll;
const int INF = 1<<30;
const long long LINF = 1LL<<60;

int main(){
    int n, ans = 0;
    cin >> n;
    vector<string> s(n);
    vector<int> t(n);
    for(int i = 0; i < n; i++){
        cin >> s[i] >> t[i];
    }
    string x;
    cin >> x;
    int c = 0;
    while(x != s[c]){ c++; }
    c++;
    while(c < n){
        ans += t[c];
        c++;
    }
    cout << ans << endl;
    return 0;
}


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

int cnt[100009];

int main()
{
    //cout<<cnt[1000000000]<<endl;

    int n;
    scanf("%d",&n);
    int a[100009];
    int uniq[100009];

    int i=0;
    for( i=0; i<n; i++)
    {
        scanf("%d",&a[i]);
        //cnt[a[i]]++;
    }

    sort(a,a+n);
    int j =0;
    cnt[j]=1;
    uniq[j] = a[0];
    for( i=1; i<n; i++)
    {
        if(a[i]!=a[i-1])
        {
            j++;
            cnt[j]=1;
            uniq[j]=a[i];
        }
        else cnt[j]++;
    }
    int ans =0;
    i=0;
    for(int i=0; i<=j; i++)
    {
        if(cnt[i]<uniq[i]) ans+=cnt[i];
        else if(cnt[i]>uniq[i]) ans+= cnt[i]-uniq[i];
    }
    printf("%d\n",ans);
    //main();

    return 0;
}


Measured memory_bytes: 1408
#include <bits/stdc++.h>
#define REP(i,n) for (int i = 0; i <(n); ++i)
#define ALL(v) v.begin(), v.end()
using namespace std;
using ll = long long;
using P = pair<int,int>;
static const double PI = acos(-1);



int main(){
  int n;
  cin >> n;
  vector<int> h(n);
  REP(i,n) cin >> h[i];

  int MXSTEP = 0;
  int cnt = 0;

  for(int i = 1; i < n; i++){
    if(h[i] <= h[i-1]){
      cnt++;
    }
    else{
      MXSTEP = max(MXSTEP, cnt);
      cnt = 0;
    }
  }

  MXSTEP = max(MXSTEP, cnt);

  cout << MXSTEP << endl;
  return 0;
}

Measured memory_bytes: 3764
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define all(v) v.begin(), v.end()
using namespace std;
typedef long long ll;

int main() {
	int a[5] = {0};
	rep(i, 5) cin >> a[i];
	int ans = 0;
	
	rep(i, 5) {
		if(a[i]%10 == 0) ans += a[i];
		else ans += a[i] + (10 - a[i]%10); 
	}
	int mn = 10;
	rep(i, 5) {
		if(a[i]%10 == 0) continue;
		mn = min(mn, a[i]%10);
	}
	if(mn != 0) {
		ans -= 10 - mn;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include <vector>
#include<algorithm>
#include<cmath>
#include<iomanip>
using namespace std;
using vi = vector<int>;
using vii = vector<vi>;
using vs = vector<string>;
using pii = pair<int, int>;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define vsort(v) sort(v.begin(), v.end())
#define rv(v) reverse(v.begin(), v.end())
#define ll long long
const ll MOD = 1e9 + 7;

int main() {
	int n;
	cin >> n;
	vi d(n);
	rep(i, n) cin >> d[i];
	vsort(d);
	int c = 1;
	rep(i, n - 1) if (d[i] != d[i + 1]) c++;
	cout << c << endl;
}

Measured memory_bytes: 256
#解説読んだ

import math

N, L = list(map(int, input().split()))
T = [int(input()) for _ in range(N)]

x, y = 0, 0
for i in range(N - 1):
  for j in range(i + 1, N):
    a = (T[i] + T[j]) / 2
    b = a + L / 2
    t = j - i - 1
    k = N - 2 - t
    x += k * math.cos(2 * math.pi * a / L)
    x += t * math.cos(2 * math.pi * b / L)
    y += k * math.sin(2 * math.pi * a / L)
    y += t * math.sin(2 * math.pi * b / L)
x /= N * (N - 1) * (N - 2) / 3 / 2
y /= N * (N - 1) * (N - 2) / 3 / 2
print(x, y)


Measured memory_bytes: 46488
// 5/13 過去問ガリガリ
#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>;
using Graph = vector<vector<int>>;

int main() {
    ll N, K;
    cin >> N >> K;

    vector<ll> H(N);
    rep(i, N) cin >> H[i];

    sort(H.begin(), H.end());

    ll ans = 0;

    rep(i, N) {
        if (K > 0) {
            // ans++;
            K--;
        } else {
            ans += H[N - i - 1];
        }
    }

    cout << ans << endl;
}


Measured memory_bytes: 4844
//
#include <vector>
#include <set>
#include <map>
#include <array>
#include <iostream>
#include <algorithm>
#include <numeric>
#include <bitset>
#include <cstdio>
#include <cstdint>
#include <cmath>
//
using ll = long long;
using ld = long double;
using namespace std;
#define rep(i,n) for(ll i=0;i<(n);++i)
inline void yes(bool cond) { cond ? puts("Yes") : puts("No"); }
template<typename Type> inline void chmin(Type& a, Type b) { if (a > b) a = b; }
template<typename Type> inline void chmax(Type& a, Type b) { if (a < b) a = b; }
template<typename Type> inline void sort(Type& arr) { std::sort(arr.begin(), arr.end()); }
template<typename Type> inline Type nth(vector<Type>& arr, size_t pos) { std::nth_element(arr.begin(), arr.begin() + pos, arr.end()); return arr[pos]; }
constexpr ll BIGP = 1000000007L;
constexpr ll INF_I = std::numeric_limits<ll>::max();
constexpr ld INF_F = std::numeric_limits<float>::infinity();
constexpr ld PI = 3.14159265358979323846L;
//
int main()
{
    cin.tie(0); ios::sync_with_stdio(false);
    string S;
    cin >> S;
    S[1] = S[1] ^ 'R' ^ 'B';
    cout << S;

    return 0;
}

Measured memory_bytes: 3004
using System;
using System.Collections;
using System.Collections.Generic;
using System.Text;
using System.Linq;
using static MyIO;


public class A
{
	public static void Main()
	{
		long A = GetLong();
		long P = GetLong();

		Console.WriteLine((3 * A + P)/2);
	}
}


public static class MyIO
{
	private static string[] args = null;
	private static int num = -1;
	private static int used = -1;

	private static string getArg()
	{
		if(used == num)
		{
			args = Console.ReadLine().Split(' ');
			num = args.Length;
			used = 0;
		}
		return args[used++];
	}

	public static int GetInt(){ return int.Parse(getArg()); }
	public static long GetLong(){ return long.Parse(getArg()); }
	public static double GetDouble(){ return double.Parse(getArg()); }
	public static string GetString(){ return getArg(); }
}

Measured memory_bytes: 13140
-- https://github.com/minoki/my-atcoder-solutions
{-# LANGUAGE BangPatterns #-}
import Data.Char (isSpace)
import Data.List (unfoldr, intersperse)
import Control.Monad
import qualified Data.Vector as V
import qualified Data.Vector.Unboxed as U
import qualified Data.ByteString.Char8 as BS
import Data.Array.Unboxed
import Data.Array.ST

main = do
  [h,w,k] <- unfoldr (BS.readInt . BS.dropWhile isSpace) <$> BS.getLine
  matrix <- V.replicateM h BS.getLine
  let result :: UArray (Int,Int) Int
      result = runSTUArray $ do
        a <- newArray ((0,0),(h-1,w-1)) 0
        let go !i0 !i !n
              | i == h = do
                  forM_ [i0+1..h-1] $ \i' -> do
                    forM_ [0..w-1] $ \j -> do
                      v <- readArray a (i0,j)
                      writeArray a (i',j) v
              | BS.all (== '.') (matrix V.! i) = go i0 (i+1) n
              | otherwise = do
                  let row = matrix V.! i
                  let go2 !j0 !j !n
                        | j == w = do
                            forM_ [j0+1..w-1] $ \j' -> do
                              writeArray a (i,j') (n-1)
                            return n
                        | row `BS.index` j == '.' = go2 j0 (j+1) n
                        | otherwise = do
                            forM_ [j0+1..j] $ \j' -> do
                              writeArray a (i,j') n
                            go2 j (j+1) (n+1)
                  n' <- go2 (-1) 0 n
                  forM_ [i0+1..i-1] $ \i' -> do
                    forM_ [0..w-1] $ \j -> do
                      v <- readArray a (i,j)
                      writeArray a (i',j) v
                  go i (i+1) n'
        go (-1) 0 1
        return a
  forM_ [0..h-1] $ \i -> do
    putStrLn $ concat $ intersperse " " [show (result ! (i,j)) | j <- [0..w-1]]


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

int main()
{
  int n,x;
  cin >> n >> x;
  int a[100]={};
  int l=0;
  while(n!=0||x!=0)
    {
      for(int i=1;i<=n;i++)
	{
	  if(x<i)break;
	  for(int j=1;j<i;j++)
	    {
	      if(x<j)break;
	      for(int k=1;k<j;k++)
		{
		  if(x<k)break;
		  if(i+j+k==x)a[l]+=1;
		}
	    }
	}
      l++;
      cin >> n >> x;
    }

  for(int i=0;i<l;i++)
    cout << a[i] << endl;

  return 0;
}

Measured memory_bytes: 1160
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<cmath>
#include<map>
#include<cstdio>
#include<stack>
#include<queue>
#include<fstream>
#include<cstdio>
#include<deque>
#include<iomanip>
#include <numeric>
//#include<bits/stdc++.h>

using namespace std;
#define ok1 printf("ok1\n");
#define ok2 printf("ok2\n");
#define M 1000000000000000000LL
#define rep(i,n) for(int i=0;i<n;++i)
#define REP(i,s,n) for(int i=(s);i<(n);++i)
#define repr(i,n) for(int i=n-1;i>=0;--i)
#define REPR(i,s,n) for(int i=(s);i>=(n);--(i))
#define all(a) (a).begin(),(a).end()
#define reall(a) (a).rbegin(),(a).rend()
#define pb push_back
#define pf push_front
#define MIN(a,b) a=min((a),(b))
#define MAX(a,b) a=max((a),(b))
#define SIZE(v) (int)v.size()
const double pi = acos(-1.0);

typedef vector<int> vi;
typedef vector<string> vs;
typedef long long ll;
typedef vector<ll> vll;
typedef vector<vi> vvi;
typedef vector<vll> vvll;
typedef vector<char> vc;
typedef vector<double> vd;
typedef vector<bool> vb;
typedef deque<ll> dll;
typedef pair<ll, ll> P;
typedef vector<P> vP;
using Edge = pair<int, ll>;
using Graph = vector<vector<Edge> >;
const ll mod = 1e9 + 7;
ll dx[4] = { 1,0,-1,0 };
ll dy[4] = { 0,1,0,-1 };

void printvll(vll v) {
	cout << "------------------------------------------------\n";
	rep(i, v.size()) cout << v[i] << " ";
	cout << endl;
	cout << "------------------------------------------------\n";
}
void printvvll(vvll v) {
	cout << "------------------------------------------------\n";
	rep(i, v.size()) {
		rep(j, v[i].size()) {
			cout << v[i][j] << " ";
		}
		cout << endl;
	}
	cout << "------------------------------------------------\n";
}

void prints(string s) {
	cout << "------------------------------------------------\n";
	rep(i, s.size()) cout << s[i] << " ";
	cout << endl;
	cout << "------------------------------------------------\n";
}

void printvs(vs s) {
	cout << "------------------------------------------------\n";
	rep(i, s.size()) {
		rep(j, s[i].size()) {
			cout << s[i][j] << " ";
		}
		cout << endl;
	}
	cout << "------------------------------------------------\n";
}

void Yes(bool x) {
	if (x) cout << "Yes\n";
	else cout << "No\n";
}

void YES(bool x) {
	if (x) cout << "YES\n";
	else cout << "NO\n";
}

void yes(bool x) {
	if (x) cout << "yes\n";
	else cout << "no\n";
}

ll  d, n, r, l, k, ans = 0, ret = M;
bool flag = false, flag2 = false, flag3 = false;
string s, t;
ll c1, c2, c3;
int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	ll x, y, z;
	cin >> x >> y >> z >> k;
	vll a(x), b(y), c(z);
	rep(i, x) cin >> a[i];
	rep(i, y) cin >> b[i];
	rep(i, z) cin >> c[i];
	sort(reall(a));
	sort(reall(b));
	sort(reall(c));
	vll ansx;
	rep(i, x) {
		rep(j, y) {
			rep(l, z) {
				if ((i + 1)*(j + 1)*(l + 1) > k) break;
				else ansx.pb(a[i] + b[j] + c[l]);
			}
		}
	}
	sort(reall(ansx));
	rep(i, k)cout << ansx[i] << endl;
}


Measured memory_bytes: 1404
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
//template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
//template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
 
/* attention
    long longのシフト演算には気をつけよう
    タイポした時のデバッグが死ぬほどきつくなるので変数名は最低3字くらい使った方がいいかも
    sizeは(int)とキャストしよう
    ごちゃごちゃ場合分けを考える前に全探索は考えましたか？
*/

const ll mod = 1000000007;

int main(){
    int N, M; cin >> N >> M;
    vector<ll> dp(N+5, 0);
    vector<bool> danger(N+5, false);
    for(int i=0; i<M; i++){
        int a; cin >> a;
        danger[a] = true;
    }

    dp[0] = 1;
    if(danger[1]) dp[1] = 0;
    else dp[1] = 1;

    for(int i=2; i<=N; i++){
        if(danger[i]) dp[i] = 0;
        else{
            dp[i] = dp[i-1]+dp[i-2];
            dp[i] %= mod;
        }
    } 

    cout << dp[N] << endl;
    
}

Measured memory_bytes: 1024
def main():
    import sys 
    from fractions import gcd 
    input = sys.stdin.readline 

    def init(init_val):
        for i in range(n):
            seg[i+num-1] = init_val[i]
        for i in range(num-2,-1,-1):
            seg[i] = gcd(seg[2*i+1], seg[2*i+2])

    def update(k, x):
        k += num - 1
        seg[k] = x 
        while k:
            k = (k-1)//2
            seg[k] = gcd(seg[2*k+1], seg[2*k+2])

    def query(p, q):
        if q <= p:
            return 0
        p += num - 1
        q += num - 2
        res = 0
        while q - p > 1:
            if p & 1 == 0:
                res = gcd(res, seg[p])
            if q & 1 == 1:
                res = gcd(res, seg[q])
                q -= 1
            p //= 2
            q = (q - 1)//2

        if p==q:
            res = gcd(res, seg[p])
        else:
            res = gcd(gcd(res, seg[p]), seg[q])
        return res
         
    n= int(input())
    a = tuple(map(int, input().split()))
    num = 2**(n-1).bit_length()
    seg = [0]*2*num
    init(a)    
                
    ans = -1
    for i in range(n):
        ans = max(ans, gcd(query(0,i), query(i+1,n)))
    print(ans) 

if __name__ == '__main__':
    main()

Measured memory_bytes: 88324
#include <iostream>
#include <string>
#include <cstdio>
#define MAX_N 105

using namespace std;
int n,h,w;
int area[MAX_N][MAX_N];
string s[MAX_N];

void move(int h,int w){
	if(area[h][w]==1){
		cout << "LOOP" << endl;
		return;
	}
	area[h][w]=1;
	
	switch(s[h][w]){

		case'>':
		move(h,w+1);
		return;
		break;

		case'<':
		move(h,w-1);
		return;
		break;

		case'v':
		move(h+1,w);
		return;
		break;

		case'^':
		move(h-1,w);
		return;
		break;

		case'.':
		cout << w<< " "<<h<<endl;
		return;
		break;
	}
	return;
}

int main(){
	while(1){
		cin >> h >> w;
		if(h==0&&w==0)break;

		for(int i=0;i<h;i++){
			for(int j=0;j<w;j++){
				area[i][j]=0;
			}
		}

		for(int i=0;i<h;i++){
			cin >> s[i];
		}
		move(0,0);

	}
	return 0;
}

Measured memory_bytes: 3104
#include <bits/stdc++.h>
using namespace std;
typedef pair<int, int> P;

int main() {
    int N, M;
    cin >> N >> M;

    P lis[100000];

    for (int i = 0; i < M; i++) {
        int a, b;
        cin >> a >> b;
        lis[i] = P(b, a);
    }

    sort(lis, lis+M);

    int now = -1;
    int ans = 0;

    for (int i = 0; i < M; i++) {
        if (lis[i].second >= now) {
            now = lis[i].first;
            ans++;
        }
    }

    cout << ans << endl;
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
#define pb push_back
#define ll long long
#define f(i,a,b) for(int i=a;i<b;i++)
#define f1(i,a,b) for(int i=a;i<=b;i++)
using namespace std;
int main(){
	ll l;
	cin>>l;
	double z=(double)(l*l*l)/27;
	cout<<fixed<<setprecision(12)<<z<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#include <algorithm>
#include <climits>
#include <vector>
#include <string>
#include <set>
#include <iomanip>
#define REP(i,n) for (int i=0;i<(n);++i)
using namespace std;

int main(){
    vector<int> c(9);
    REP(i, 9) cin >> c[i];

    vector<int> a(3);
    vector<int> b(3);

    for(a[0] = 0; a[0] <= 100; ++a[0]){
        b[0] = c[0] - a[0], b[1] = c[1] - a[1], b[2] = c[2] - a[2];
        a[1] = c[3] - b[0], a[2] = c[6] - b[0];

        if(c[0] == a[0] + b[0] && c[1] == a[0] + b[1] && c[2] == a[0] + b[2]
            && c[3] == a[1] + b[0] && c[4] == a[1] + b[1] && c[5] == a[1] + b[2]
            && c[6] == a[2] + b[0] && c[7] == a[2] + b[1] && c[8] == a[2] + b[2]){
            cout << "Yes" << endl;
            return 0;
        }
    }
    cout << "No" << endl;
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main()
{
  int n,m,c;
  cin>>n>>m>>c;
  int b[m];
  int a[n][m];
  for(int i=0;i<m;i++)
  {
    cin>>b[i];
  }
  for(int i=0;i<n;i++)
  {
    for(int j=0;j<m;j++)
    {
      cin>>a[i][j];
    }
  }
  int count =0,sum=0;
  for(int i=0;i<n;i++)
  {
    sum=0;
      for(int j=0;j<m;j++)
      {
        sum +=a[i][j]*b[j] ;
      }
      sum+=c;
      if(sum>0)
      {
        count++;
      }
   }
  cout<<count;
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int const dx[]={-1,0,1,0},dy[]={0,1,0,-1};
int dis[505][505],c[505][505];
void extend(int x,int y)
{
    for(int j=0;j<4;j++)
    {
        int nx=x+dx[j],ny=y+dy[j];
        if(dis[nx][ny]>dis[x][y]+c[nx][ny])
            dis[nx][ny]=dis[x][y]+c[nx][ny],
            extend(nx,ny);
    }
}
int main()
{
    int n,a,x,y;
    scanf("%d",&n);
    for(int i=1;i<=n;i++)
        for(int j=1;j<=n;j++)
            dis[i][j]=min(min(i,j),min(n-i+1,n-j+1)),c[i][j]=1;
    int ans=0;
    for(int i=1;i<=n*n;i++)
    {
        scanf("%d",&a);
        x=(a-1)/n+1,y=a%n;
        if(!y)y=n;
        //cout<<x<<" "<<y<<" "<<dis[x][y]<<" ";
        ans+=dis[x][y]-1;
        c[x][y]=0;
        for(int j=0;j<4;j++)
        {
            int nx=x+dx[j],ny=y+dy[j];
            dis[x][y]=min(dis[x][y],dis[nx][ny]);
        }
        extend(x,y);
    }
    printf("%d",ans);
    return 0;
}

Measured memory_bytes: 20924
#include "bits/stdc++.h"
using namespace std;
#define dbg(var) cout<<#var<<"="<<var<<" "
#define nl cout<<"\n"
#define fr(i,n) for(int i=0;i<n;i++)
#define rep(i,a,n) for(int i=a;i<=n;i++)
#define vi vector<int>
#define vvi vector<vi>
#define pb push_back
#define fa(v) for(auto &i:v)
#define all(v) v.begin(),v.end()
#define sz(v) (int)(v.size())
#define int long long
const int mod=1e9+7,MX=105;
int mult(int a,int b){return (1ll*a*b)%mod;}
int fact[MX],inv[MX],invfact[MX];
void init_INV(){
	fact[0] = invfact[0] = fact[1] = invfact[1] = inv[1] = 1;
    for (int i = 2; i < MX; i++) {
        fact[i] = mult(fact[i - 1], i);
        inv[i] = mult(inv[mod % i], mod - mod / i);
        invfact[i] = mult(invfact[i - 1], inv[i]);
    }
}
int ncr(int n,int r){
	int ret = 1;
	for(int i=n,cur = 1; i>r; i--){
		ret = ret * i % mod;
		ret = ret * inv[cur++] % mod;
	}
	return ret;
}
void solve(){
  int n; cin >> n;
  if(n < 5){
  	return void(cout << "0\n");
  }
  n -= 5;
  int ans = 0;
  rep(i,0,11){
  	int r = n - i;
  	if(r < 0) break;
  	if(r & 1) continue;
  	r /= 2;
  	ans = (ans + ncr(11,i)*ncr(15+r,r)%mod) %mod;
  }
  cout << ans << "\n";
}
int32_t main()
{
	init_INV();
   ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
   int tst; cin >> tst; while(tst--){
   	solve();
   }
}

Measured memory_bytes: 3652
#define _USE_MATH_DEFINES
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <vector>
#include <algorithm>
#include <stack>
#include <map>
#include <functional>
#include <cstring>
#include <queue>
#include <cmath>
#include <deque>
#include <list>
#include <iomanip>
#include <fstream>
#include <string>
#include <iterator>
#include <set>
#include <bitset>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair <int, int> pii;
#define mp make_pair
#define pb push_back
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, N) FOR(i, 0, N)
#define SZ(x) ((int)(x).size())

const int MAXN = 507, MAXK = 12, MOD = 100000000;

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

int main()
{
	int n;
	ll t, ans = 1;
	cin >> n;
	REP(i, n){
		cin >> t;
		ans = ans/gcd(ans, t)*t;
	}
	cout << ans;
	//cout << endl; system("pause");//please
	return 0;
}

Measured memory_bytes: 256
package main

import "fmt"

func main() {
	var H int
	var N int
	fmt.Scan(&H, &N)
	sum := 0
	for i := 0; i < N; i++ {
		var tmp int
		fmt.Scan(&tmp)
		sum += tmp
	}

	if H <= sum {
		fmt.Println("Yes")
	} else {
		fmt.Println("No")
	}
}


Measured memory_bytes: 5504
#pragma region template
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
using ld = long double;
using vi = vector<int>;
using vvi = vector<vi>;
using vvvi = vector<vvi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using vvvll = vector<vvll>;
using vld = vector<ld>;
using vvld = vector<vld>;
using vvvld = vector<vvld>;
using vs = vector<string>;
using pll = pair<ll, ll>;
using vp = vector<pll>;
template <typename T>
using pqrev = priority_queue<T, vector<T>, greater<T>>;
#define rep(i, n) for (ll i = 0, i##_end = (n); i < i##_end; i++)
#define repb(i, n) for (ll i = (n)-1; i >= 0; i--)
#define repr(i, a, b) for (ll i = (a), i##_end = (b); i < i##_end; i++)
#define reprb(i, a, b) for (ll i = (b)-1, i##_end = (a); i >= i##_end; i--)
#define ALL(a) (a).begin(), (a).end()
#define SZ(x) ((ll)(x).size())
//*
constexpr ll MOD = 1e9 + 7;
/*/
constexpr ll MOD = 998244353;
//*/
constexpr ll INF = 1e+18;
constexpr ld EPS = 1e-12L;
constexpr ld PI = 3.14159265358979323846L;
constexpr ll GCD(ll a, ll b) { return b ? GCD(b, a % b) : a; }
constexpr ll LCM(ll a, ll b) { return a / GCD(a, b) * b; }
template <typename S, typename T>
inline bool chmax(S &a, const T &b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <typename S, typename T>
inline bool chmin(S &a, const T &b) {
  if (b < a) {
    a = b;
    return 1;
  }
  return 0;
}
#ifdef OJ_LOCAL
#include "dump.hpp"
#else
#define dump(...) ((void)0)
#endif
template <typename T>
bool print_(const T &a) {
  cout << a;
  return true;
}
template <typename T>
bool print_(const vector<T> &vec) {
  for (auto &a : vec) {
    cout << a;
    if (&a != &vec.back()) {
      cout << " ";
    }
  }
  return false;
}
template <typename T>
bool print_(const vector<vector<T>> &vv) {
  for (auto &v : vv) {
    for (auto &a : v) {
      cout << a;
      if (&a != &v.back()) {
        cout << " ";
      }
    }
    if (&v != &vv.back()) {
      cout << "\n";
    }
  }
  return false;
}
void print() { cout << "\n"; }
template <typename Head, typename... Tail>
void print(Head &&head, Tail &&... tail) {
  bool f = print_(head);
  if (sizeof...(tail) != 0) {
    cout << (f ? " " : "\n");
  }
  print(forward<Tail>(tail)...);
}
#pragma endregion

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(20);
  deque<char> dq;
  string s;
  cin >> s;
  rep(i, SZ(s)){
    dq.emplace_back(s[i]);
  }
  ll q;
  cin >> q;
  int rev = 0;
  while(q--){
    ll ty;
    cin >> ty;
    if(ty == 1){
      rev = !rev;
    }else{
      ll f;
      char c;
      cin >> f >> c;
      f--;
      if(rev ^ f){
        dq.emplace_back(c);
      }else{
        dq.emplace_front(c);
      }
    }
  }
  dump(SZ(dq));
  while(SZ(dq)){
    if(rev){
      cout << dq.back();
      dq.pop_back();
    }else{
      cout << dq.front();
      dq.pop_front();
    }
  }
  cout << endl;
}


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

template<typename T>
struct Segtree {
    int n;
    T e;
    vector<T> dat;
    typedef function<T(T a, T b)> Func;
    Func f;

    Segtree(){}
    Segtree(int n_input, Func f_input, T e_input){
        initialize(n_input, f_input, e_input);
    }
    void initialize(int n_input, Func f_input, T e_input){
        f = f_input;
        e = e_input;
        n = 1;
        while(n < n_input) n <<= 1;
        dat.resize(2*n-1, e);
    }

    void update(int k, T a){
        k += n - 1;
        dat[k] = a;
        while(k > 0){
            k = (k - 1)/2;
            dat[k] = f(dat[2*k+1], dat[2*k+2]);
        }
    }

    T get(int k){
        return dat[k+n-1];
    }

    T between(int a, int b){
        return query(a, b+1, 0, 0, n);
    }

    T query(int a, int b, int k, int l, int r){
        if(r<=a || b<=l) return e;
        if(a<=l && r<=b) return dat[k];
        T vl = query(a, b, 2*k+1, l, (l+r)/2);
        T vr = query(a, b, 2*k+2, (l+r)/2, r);
        return f(vl, vr);
    }
};

int main(){
    int N, K;
    cin >> N >> K;
    vector<int> P(N);
    for(int i=0; i<N; i++) cin >> P[i];

    Segtree<int> stPmax(N, [](int a, int b){return max(a, b); }, -1);
    Segtree<int> stPmin(N, [](int a, int b){return min(a, b); }, N);
    Segtree<int> stL(N, [](int a, int b){return max(a, b); }, -1);
    Segtree<int> stR(N, [](int a, int b){return min(a, b); }, N);
    for(int i=0; i<N; i++){
        stPmax.update(P[i], i);
        stL.update(i, stPmax.between(P[i]+1, N-1));
    }
    for(int i=N-1; i>=0; i--){
        stPmin.update(P[i], i);
        stR.update(i, stPmin.between(0, P[i]-1));
    }

    set<pair<int, int>> ans;
    for(int l=0; l+K<=N; l++){
        int r = l+K-1;
        int lok = l-1, lng = r;
        while(abs(lok-lng)>1){
            int mid = (lok+lng)>>1;
            (stR.between(l, mid) > r ? lok : lng) = mid;
        }
        int rok = r+1, rng = l;
        while(abs(rok-rng)>1){
            int mid = (rok+rng)>>1;
            (stL.between(mid, r) < l ? rok : rng) = mid;
        }
        if(lng <= rng){
            ans.insert({lng, rng});
        }else{
            ans.insert({-1, -1});
        }
    }
    cout << ans.size() << endl;
    return 0;
}


Measured memory_bytes: 18560
n = int(raw_input())
A = map(int, raw_input().split())
B = [0] * n

def CountingSort(A, B, k):
    C = [0] * (k+1)
    for j in xrange(n):
        C[A[j]] += 1
    for i in xrange(1,k+1):
        C[i] = C[i] + C[i-1]
    for j in xrange(n-1,-1,-1):
        B[C[A[j]]-1] = A[j]
        C[A[j]] -= 1
    return 0

def main():
    CountingSort(A, B, 10000)
    print ' '.join(map(str,B))
    return 0

main()

Measured memory_bytes: 202552
A=[1,3,5,7,8,10,12]
B=[4,6,9,11]
C=[2]
x,y=map(int,input().split())
if A.count(x)==1:
    X=A
elif B.count(x)==1:
    X=B
else:
    X=C
if A.count(y)==1:
    Y=A
elif B.count(y)==1:
    Y=B
else:
    Y=C
if X==Y:
    print('Yes')
else:
    print('No')

Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
int n;
string s,t;

int main()
{
    cin>>n;
    cin>>s>>t;
    string ans="";
    for (int i=0;i<n;++i){
        ans+=s[i];
        ans+=t[i];
    }

    cout<<ans<<endl;
}

Measured memory_bytes: 3612
#include <bits/stdc++.h>
using namespace std;
typedef long long lint;
typedef pair<int,int> P;
const int INF=(int)1e9;
const int MOD=(int)1e9+7;
struct Accelerate_Cin{
    Accelerate_Cin(){
        cin.tie(0); ios::sync_with_stdio(0); cout<<fixed<<setprecision(20);
    };
};



int main(){
  int N,a[3005];
  cin>>N;
  int sum=0;
  for(int t=1;t<=N;t++){
    int temp;
    cin>>temp;
    sum+=temp-1;
  }

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


Measured memory_bytes: 256
#include <iostream>
#include <cmath>
using namespace std;
int main(){
  int a,b,c;
  cin >> a >> b >> c;
  int x[3]={};
  x[0]=abs(a-b);
  x[1]=abs(a-c);
  x[2]=abs(b-c);
  int max=0;
  int sum=0;
  for(int i=0;i<3;i++){
    sum+=x[i];
    if(x[i]>max){
      max=x[i];
    }
  }
  cout << sum-max << endl;
  return 0;
}

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

#define rep(i,n) for(int i=0; i<n; i++)
#define rept(i,a,b) for(int i=a; i<b; i++)
#define all(x) (x).begin(),(x).end()

typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> P;

const int MOD = 1e9 + 7;


int main() {
	ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);

    int n, m;
    cin >> n >> m;

    if (n == m){
        cout << "Yes" << endl;
    }
    else{
        cout << "No" << endl;
    }




    return 0;
}



Measured memory_bytes: 256
N = int(input())
S = 'E' + input() + 'W'
rcnt = []
lcnt = []

prercnt = 0
prelcnt = 0
for i in range(N+2): #0~N+1
  if S[i] == 'W': prelcnt += 1
  else: prercnt += 1
  rcnt.append(prercnt)
  lcnt.append(prelcnt)
    
#1~Nをリーダーにした時の向く方向が変わる人数の配列
print(min([lcnt[i-1] + rcnt[-1] - rcnt[i] for i in range(1, N+1)]))

Measured memory_bytes: 30156
#include <bits/stdc++.h>
using namespace std;
#define REP(i,a,n) for(int i=(a); i<(int)(n); i++)
#define rep(i,n) REP(i,0,n)
#define FOR(it,c) for(__typeof((c).begin()) it=(c).begin(); it!=(c).end(); ++it)
#define ALLOF(c) (c).begin(), (c).end()
typedef long long ll;
typedef unsigned long long ull;

int main(){
  int N;
  cin >> N;
  vector<int> v;
  rep(i,N){
    int a;
    cin >> a;
    v.push_back(a);
  }

  sort(ALLOF(v));
  auto result = unique(ALLOF(v));
  
  cout << result-v.begin() << endl;
  
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
const int MAXN=1e5+5;
char s[MAXN];
int at[MAXN];
vector<int> ans;
int n;
bool judge()
{
	for(int i=1;i<n;i++)
	{
		int la=(i-1+n)%n,nxt=(i+1)%n;
		if((s[i]=='o'&&!at[i])||(at[i]&&s[i]=='x'))
		{
			if(nxt==0&&at[la]!=at[nxt])
				return false;
			at[nxt]=at[la];
		}
		else
		{
			if(nxt==0&&at[la]==at[nxt])
				return false;
			at[nxt]=at[la]^1;
		}
	}
	if((s[0]=='o'&&!at[0])||(at[0]&&s[0]=='x'))
	{
		if(at[1]!=at[n-1])
			return false;
	}
	else
	{
		if(at[1]==at[n-1])
			return false;
	}
	return true;
}
int main()
{
	//freopen("in.txt","r",stdin);
	//freopen("out.txt","w",stdout);
	scanf("%d",&n);
	scanf("%s",s);
	at[0]=0,at[1]=0;
	if(judge())
	{
		for(int i=0;i<n;i++)
		{
			printf("%c",at[i]?'W':'S');
		}
		printf("\n");
		return 0;
	}
	at[0]=1,at[1]=0;
	if(judge())
	{
		for(int i=0;i<n;i++)
		{
			printf("%c",at[i]?'W':'S');
		}
		printf("\n");
		return 0;
	}
	at[0]=0,at[1]=1;
	if(judge())
	{
		for(int i=0;i<n;i++)
		{
			printf("%c",at[i]?'W':'S');
		}
		printf("\n");
		return 0;
	}
	at[0]=1,at[1]=1;
	if(judge())
	{
		for(int i=0;i<n;i++)
		{
			printf("%c",at[i]?'W':'S');
		}
		printf("\n");
		return 0;
	}
	printf("-1\n");
	return 0;
}

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

int main() {
    int n;
    cin >> n;
    vector<int> v(n);
    for (int i = 0; i<n-1; i++) {
        int x;
        cin >> x;
        v[x-1]++;
    }
    for (int i = 0; i<n; i++) {
        cout << v[i] << '\n';
    }
    return 0;
}


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

using namespace std;

int inc(int x);

map<int,int> mp;

int main(){
	ios::sync_with_stdio(false);                     
	cin.tie(0);
	int m,n;
	cin >> m >> n;
	vector <int> v(n);
	mp[0] = 0;
	for (auto &x : v){
		cin >> x;
		mp[x]++;
	}     
	while (inc(m)){
		++m;	
	}
	cout << m;
	return 0;
}

int inc(int x){
	while (x){
		if (mp[x%10]){
			return 1;
		}
		x/=10;
	}	
	return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

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

        int N = sc.nextInt();

        System.out.println(solve(N));

        sc.close();
    }

    static int solve(int N) {
        return (N % 2 == 0) ? N : (N * 2);
    }
}

Measured memory_bytes: 21716
#include <algorithm>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <functional>
#include <iostream>
#include <limits>
#include <list>
#include <numeric>
#include <queue>
#include <sstream>
#include <string>
#include <tuple>
#include <type_traits>
#include <utility>
#include <vector>

#define REP(i, n) for(int i = 0, i##_MACRO = (n); i < i##_MACRO; i++)
#define RANGE(i, a, b) for(int i = (a), i##_MACRO = (b); i < i##_MACRO; i++)
#define EACH(e, a) for(auto&& e : a)
#define ALL(a) (a).begin(), (a).end()
#define AALL(a, n) (a), ((a) + (n))
#define FILL(a, n) memset((a), n, sizeof(a))
#define FILLZ(a) FILL(a, 0)
#define MODNUM (static_cast<int>(1e9 + 7))
#define MOD(x) ((x) % MODNUM)

using namespace std;

using ll = long long;
using VI = vector<int>;
using VI2D = vector<vector<int>>;

const int INF = 2e9;
const double EPS = 1e-10;
const double PI = acos(-1.0);

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

inline int toInt(string s) {
	int v;
	istringstream sin(s);
	sin >> v;
	return v;
}

class UnionFind {
	std::vector<size_t> parents;
	std::vector<size_t> rank;

	public:
	UnionFind(size_t size) : parents(size), rank(size, 0) {
		std::iota(this->parents.begin(), this->parents.end(), 0);
	}

	bool merge(size_t a, size_t b) {
		size_t ar = this->root(a);
		size_t br = this->root(b);
		if(ar == br) {
			return false;
		}
		if(this->rank[ar] < this->rank[br]) {
			std::swap(ar, br);
		}
		if(this->rank[ar] == this->rank[br]) {
			this->rank[ar]++;
		}
		return this->parents[br] = ar;
	}
	bool unite(size_t a, size_t b) { return this->merge(a, b); }

	bool is_same(size_t a, size_t b) { return this->root(a) == this->root(b); }
	bool is_union(size_t a, size_t b) { return this->is_same(a, b); }

	private:
	size_t root(int n) {
		if(this->parents[n] == n) {
			return n;
		}

		return this->root(this->parents[n]);
	}
};

int main() {
	int n, q;
	scanf("%d %d", &n, &q);
	VI s(n);
	VI com(q);
	VI x(q);
	VI y(q);
	REP(i, q) { scanf("%d %d %d", &com[i], &x[i], &y[i]); }

	UnionFind uf(n);
	REP(i, q) {
		if(com[i]) {
			printf("%d\n", static_cast<int>(uf.is_same(x[i], y[i])));
		} else {
			uf.merge(x[i], y[i]);
		}
	}
	return 0;
}


Measured memory_bytes: 4340
import java.util.*; import java.io.*; import java.math.*;
public class Main{
	//Don't have to see. start------------------------------------------
	static class InputIterator{
		ArrayList<String> inputLine = new ArrayList<String>(1024);
		int index = 0; int max; String read;
		InputIterator(){
			BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
			try{
				while((read = br.readLine()) != null){
					inputLine.add(read);
				}
			}catch(IOException e){}
			max = inputLine.size();
		}
		boolean hasNext(){return (index < max);}
		String next(){
			if(hasNext()){
				return inputLine.get(index++);
			}else{
				throw new IndexOutOfBoundsException("There is no more input");
			}
		}
	}
	static HashMap<Integer, String> CONVSTR = new HashMap<Integer, String>();
	static InputIterator ii = new InputIterator();//This class cannot be used in reactive problem.
	static PrintWriter out = new PrintWriter(System.out);
	static void flush(){out.flush();}
	static void myout(Object t){out.println(t);}
	static void myerr(Object t){System.err.print("debug:");System.err.println(t);}
	static String next(){return ii.next();}
	static boolean hasNext(){return ii.hasNext();}
	static int nextInt(){return Integer.parseInt(next());}
	static long nextLong(){return Long.parseLong(next());}
	static double nextDouble(){return Double.parseDouble(next());}
	static ArrayList<String> nextStrArray(){return myconv(next(), 8);}
	static ArrayList<String> nextCharArray(){return myconv(next(), 0);}
	static ArrayList<Integer> nextIntArray(){
		ArrayList<String> input = nextStrArray(); ArrayList<Integer> ret = new ArrayList<Integer>(input.size());
		for(int i = 0; i < input.size(); i++){
			ret.add(Integer.parseInt(input.get(i)));
		}
		return ret;
	}
	static ArrayList<Long> nextLongArray(){
		ArrayList<String> input = nextStrArray(); ArrayList<Long> ret = new ArrayList<Long>(input.size());
		for(int i = 0; i < input.size(); i++){
			ret.add(Long.parseLong(input.get(i)));
		}
		return ret;
	}
	static String myconv(Object list, int no){//only join
		String joinString = CONVSTR.get(no);
		if(list instanceof String[]){
			return String.join(joinString, (String[])list);
		}else if(list instanceof ArrayList){
			return String.join(joinString, (ArrayList)list);
		}else{
			throw new ClassCastException("Don't join");
		}
	}
	static ArrayList<String> myconv(String str, int no){//only split
		String splitString = CONVSTR.get(no);
		return new ArrayList<String>(Arrays.asList(str.split(splitString)));
	}
	public static void main(String[] args){
		CONVSTR.put(8, " "); CONVSTR.put(9, "\n"); CONVSTR.put(0, "");
		solve();flush();
	}
	//Don't have to see. end------------------------------------------
	static void solve(){//Here is the main function
      int N = nextInt();
      myout(N * (N + 1) / 2);
	}
	//Method addition frame start


  
	//Method addition frame end
}


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

int main() {
  int n;
  cin >> n;
  int ans = 0, hi = 0;
  for (int i = 0; i < n; i++) {
    int p;
    cin >> p;
    hi = max(hi, p);
    ans += p;
  }
  ans -= hi / 2;
  cout << ans << endl;
  return 0;
}


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

#define rep(i, n) for (int i = 0; i < (n); i++)
#define repr(i, n) for (int i = (n)-1; i >= 0; i--)

using namespace std;
using ll = long long;
typedef pair<int, int> Pair;

int main() {
  int N, n;
  cin >> N;
  n = (N - 1) / 2;

  if (N % 2 == 0) {
    cout << 0.5 << endl;
  } else if (N == 1) {
    cout << 1.0 << endl;
  } else {
    cout << (double)(n + 1) / N << endl;
  }
}

Measured memory_bytes: 256
import java.util.*;
import java.util.stream.*;

class Main{
	public static void main(String[] $){
		Scanner s=new Scanner(System.in);
		String v=s.next();
		System.out.println(IntStream.range(0,v.length()-2)
				.map(i->Math.abs(753-Integer.parseInt(v.substring(i,i+3))))
				.min().getAsInt());
	}
}


Measured memory_bytes: 26836
#include <cstdio>
#include <iostream>
#include <string>
#include <list>
#include <vector>
#include <queue>
#include <math.h>

using namespace std;

int main(void){
  long long int a, b, t;
  cin >> a >> b >> t;

  cout << t/a*b << endl;
  
  return 0;
}




Measured memory_bytes: 256