akhauriyash/Code-Regression huggingface dataset:
/*
* One Possible Answer 
* 栈 Q2
* Yuzixuan 2019/5/28 Luogu Judge AC Score : 100
* <C> Copyright yuzixuan 2005-2019 All rigts reserved.
*/
#include<bits/stdc++.h>
using namespace std;
string s;
int main()
{
	cin>>s;
	for(int i=0;i<s.size();i++)
	{
		if(s[i]=='C')
		{
			for(int j=i;j<s.size();j++)
			if(s[j]=='F')
			{
				cout<<"Yes";
				return 0;
			}
			break;
		}
	}
	cout<<"No";
	return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<iostream>
#include<cmath>
using namespace std;  
int N;
int lcd(int a,int b)
{	int c;
	while(b!=0)  
	{
	 	c=a%b;
		a=b;
		b=c;
	} 
    return a;
}

int numoft(int n)
{
    int c=0;
    while(n&1^1)
    {
        ++c;
        n>>=1;
    }
    return c;
}
    int main()     
    {   
       int i,j;
       int a[205];
       cin>>N;
       for(i=0;i<N;i++)
       scanf("%d", &a[i]); 
       j=a[0];
       for(i=0;i<N;i++)
           j=lcd(a[i],j);
       printf("%d",numoft(j));  
    }

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

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

Measured memory_bytes: 256
# -*- coding: utf-8 -*-


'''

'''

import numpy as np

N, M = map(int, input().split())
a = list(map(int, input().split()))
a = np.array(a)
s = int(a.sum())
level = 1 / (4 * M)
# print(a)
# print(level)

cnt = (a >= level * s).sum()

if cnt >= M:
    print('Yes')
else:
    print('No')


Measured memory_bytes: 12508
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cassert>
#include<cmath>
#include<vector>
#include<map>
#include<set>
#include<string>
#include<queue>
#include<stack>
using namespace std;
#define MOD 1000000007
#define MOD2 998244353
#define INF ((1<<30)-1)
#define LINF (1LL<<60)
#define EPS (1e-10)
typedef long long Int;
typedef pair<Int, Int> P;


Int dp[110000];
Int n, h[110000], k;

int main(){
    cin >> n >> k;
    for(int i = 0;i < n;i++)cin >> h[i];

    dp[0] = 0;
    for(int i = 1;i < n;i++){
        dp[i] = LINF;
        for(int j = 1; j <= k;j++){
            if(i-j >= 0)
                dp[i] = min(dp[i], dp[i-j] + abs(h[i] - h[i-j]));            
        }
    }
    cout << dp[n-1] << endl;
    return 0;
}

Measured memory_bytes: 1792
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;

namespace AtCoder
{
    static class Program
    {
        static void Main()
        {
            //ここから

            var vs = IO.ReadLineToIntList();
            var a = vs[0];
            var b = vs[1];
            var x = vs[2];

            double ans=0;
            if (x > a * a * b / 2)
            {
                ans = 90.0 - Math.Atan(a/(2.0*b-(2.0*x/(a*a)))).ToAngle();
            }
            else
            {
                ans = 90.0 - Math.Atan((x*2.0)/(a*b*b)).ToAngle();
            }


            //ここまで
            Console.WriteLine(ans);
            Console.ReadKey();
        }

        public static double ToAngle(this double radian)
        {
            return (double)(radian * 180 / Math.PI);
        }

        public static double ToRadian(this double angle)
        {
            return (double)(angle * Math.PI / 180);
        }
    }

    static class Func
    {
        static long mod = 1000000007;
        static public void Swap<T>(ref T a, ref T b) { T temp = a; a = b; b = temp; }
        static public long GCD(long a, long b) { return b != 0 ? GCD(b, a % b) : a; }
        static public long LCM(long a, long b) { return (long)a * b / GCD(a, b); }
        static public int Factorial(int a) { return a == 1 ? a : a * Factorial(a - 1); }

        static public long Conbination(int n,int m)
        {
            if (m == 0) return 1;
            if (n == 0) return 0;
            return n * Conbination(n - 1, m - 1) / m;
        }

        static public void Factoring(long num, ref long[] vs)
        {
            if (num == 1)
            {
                vs[1]++;
            }
            for (long i = 2; i < (long)Math.Sqrt(num); i++)
            {
                if (num % i == 0)
                {
                    vs[i]++;
                    Factoring(num / i, ref vs);
                }
            }
            vs[1]++;
        }
    }

    static class IO
    {
        static public string ReadLineToString() { return Console.ReadLine(); }
        static public int ReadLineToInt() { return int.Parse(Console.ReadLine()); }
        static public long ReadLineToLong() { return long.Parse(Console.ReadLine()); }
        static public List<string> ReadLineToStringList() { return Console.ReadLine().Split(' ').ToList(); }
        static public List<int> ReadLineToIntList() { return Console.ReadLine().Split(' ').Select(int.Parse).ToList(); }
        static public List<long> ReadLineToLongList() { return Console.ReadLine().Split(' ').Select(long.Parse).ToList(); }

        static public void WriteStrings(object[] strings) { foreach (var o in strings) { Console.Write(o + " "); } }
    }
}

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

int main() {
  int n;
  cin >> n;
  vector <int> vec(n);
  for (int i = 0; i < n; i++) {
    cin >> vec.at(i);
  }
  
  int ans = 0;
  for (int i = 0; i < n; i++) {
    for (int j = i+1; j < n; j++) {
      int a = vec.at(i);
      int b = vec.at(j);
      if (a < b) {
        int tmp = a;
        a = b;
        b = tmp;
      }
      if (ans < a-b) {
        ans = a-b;
      }
    }
  }
  cout << ans << endl;
}

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

int main()
{
   int x, y, z;
   scanf ("%d %d",&x,&z);
   if(x>0 && x<10){
        y = (10-x)*100;
   }
   else{
        y = 0;
   }
   z = z + y;
   printf("%d",z);
}

Measured memory_bytes: 1664
#include<stdio.h>
int main()
{
	int n;
	scanf("%d",&n);
	int i;
	int a[102];
	for(i=0;i<n;i++)
		scanf("%d",&a[i]);
	int ans=2000000000;
	int x,j;
	for(i=-100;i<=100;i++)
	{
		x=0;
		for(j=0;j<n;j++)
			x+=(i-a[j])*(i-a[j]);
		if(x<ans)
			ans=x;
	}
	printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 128
#include<iostream>
#include<vector>
#include<cstring>
using namespace std;
bool is_p[1000000];

void erast(int n, vector<int> &p){
  is_p[0] = is_p[1] = 1;
  p.push_back(1);
  for (int i = 2; i <= n; i++) {
    if(is_p[i] == 1)continue;
    is_p[i] = 1;
    p.push_back(i);
    for (int j = 2*i; j <= n; j += i) {
      is_p[j] = 1;
    }
  }
}
  
int main(int argc, char *argv[]){
  int n;
  while(cin >> n, n){
    memset(is_p, 0, sizeof(is_p));
    vector<int> p;
    erast(n, p);
    for (int i = p.size() - 1; i > 0; i--) {
      if(p[i] - p[i - 1] == 2){
        std::cout << p[i - 1] << " " << p[i] << std::endl;
        break;
      }
    }
  }
  return 0;
}

Measured memory_bytes: 2216
## 以下だめだった。
S = list(input())

# 重要：アルファベットの配列を生成
alphabets = [chr(ord('a') + i) for i in range(26)]

# 除外文字を配列に入れる
excludeS = []
flag = True
for i in range(len(alphabets)):
    if alphabets[i] not in S and all(97<=ord(elem)<=122 for elem in S):
        excludeS.append(alphabets[i])
        flag = False

if flag:
    print('None')
else:
    # 辞書順に並び変えて一番小さい文字を求める
    sortedExcludeS = sorted(excludeS)
    print(sortedExcludeS[0])

# ## これが正答
# S = list(input())
 
# flg = True

# #aからzに対応する
# for i in range(ord('a'), ord('z') + 1):
#     # chr(i)に対応するアルファベットの個数がS内で0だった場合の処理
#     if S.count(chr(i)) == 0:
#         flg = False
#         ans = chr(i)
#         break
 
# print("None" if flg else ans)

Measured memory_bytes: 3956
#include <bits/stdc++.h>
#define ll long long

using namespace std;

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

    int a, b;
    cin>>b>>a;

    if (b>12)
        cout<<a;
    else if (b>5)
        cout<<a/2;
    else
        cout<<0;
}


Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(){
char b;
char a;
cin >> a;
b = a;
 if(b=='a' or b =='i' or b=='u' or b=='e' or b=='o'){
  cout << "vowel" << endl;
  }
 else{
 cout << "consonant" << endl;
 }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < (n); i++)
#define all(a) a.begin(), a.end()
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; }
using namespace std;
typedef long long ll;

int dp[5010][5010]; //st : i, en : j

// AtCoder Beginner Contest 141
int main(){

    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);

    int n;
    cin >> n;

    string s;
    cin >> s;
    
    rep(i, n)rep(j, i)if(s[i] == s[j])dp[j][i]++;

    rep(i, n){
        rep(j, i){
            if(i - 1 == j)continue;
            int l = dp[j][i - 1];
            if(l == 0)continue;
            if(s[j + 1] == s[i]){
                if(j + 1 < i - l)chmax(dp[j + 1][i], l + 1);
            }
        }
    }

    int ans = 0;
    rep(i, n)rep(j, i)chmax(ans, dp[j][i]);
    cout << ans << endl;

}


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

int main() {
    int N;
    std::cin >> N;

    int64_t sum = 0;
    for (int i = 1; i <= N; ++i) {
        if ((i % 3) != 0 && (i % 5 != 0)) {
            sum += i;
        }
    }

    std::cout << sum << std::endl;

    return 0;
}


Measured memory_bytes: 3636
import Data.List
import qualified Data.ByteString.Char8 as B

main = breads >>= print . solve

solve :: [Int] -> Int
solve [a, b, c, d]
    | b <= c || d <= a = 0
    | otherwise = min d b - max a c

breads :: IO [Int]
breads = unfoldr uff <$> B.getLine
    where
        uff b = check <$> B.readInt b
        check (a, b)
            | B.null b = (a, b)
            | otherwise = (a, B.tail b)


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

using ll = long long;
using ull = unsigned long long;
using namespace std;
constexpr int inf = 1<<30;
constexpr int mo = 1e9+7;
constexpr ll infl = 1ll<<60;

int main(){
    cin.tie(nullptr);
    std::ios::sync_with_stdio(false);
    
    int n;
    cin>>n;
    ll v = 0;
    ll e = 0;
    for(int i=1;i<=n;++i){
        v += 1ll*i*(n-i+1);
    }
    for(int i=0;i<n-1;++i){
        int u,v;
        cin>>u>>v;
        if(u > v)swap(u,v);
        e += 1ll*u*(n-v+1);
    }
    v -= e;
    cout << v << endl;
    return 0;
    
}

Measured memory_bytes: 3660
#include<bits/stdc++.h>
using namespace std;
int main()
{
   int x=0,n,i,j,res=0,maxi=0;
   string a;
    cin>>n>>a;
    for(i=0;i<n;i++)
    {
        if(a[i]=='I')
        {
            x++;
            maxi=max(maxi,x);
        }
        else
            x--;

           // cout<<x<<endl;
    }
    res=max(res,maxi);
    cout<<res<<endl;

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,c) for(int i=0;i<c;++i)
int main(){
 int a,b;
 cin >> a>>b;
 if(a==b){
    cout << b << endl;
 }else if(a>b){
    cout << a-1<< endl;
 }else{
    cout << a<< endl;
 }
 return 0;
}

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

int main(){
  int h, n, sum = 0;
  cin >> h >> n;
  vector<int> a(n);
  for (int i=0 ; i<n ; i++){
    cin >> a.at(i);
    sum += a.at(i);
  }
  
  if (sum >= h)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
}

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

inline void Yes(){
    cout << "Yes" << "\n";
}
inline void No(){
    cout << "No" << "\n";
}
typedef pair<int,int> P;

int main(){
    int h,a;
    cin >> h >> a;
    cout << ceil((double)h/a) << "\n";
}

Measured memory_bytes: 256
rd()
{
	int x=0,k;
	for(;;)
	{
		k=getchar_unlocked();
		if(k<'0'||k>'9')break;
		x=x*10+k-'0';
	}
	return x;
}
wt(int x)
{
	int s=0;
	char f[10];
	while(x)
	{
		f[s++]=x%10;
		x/=10;
	}
	if(!s)f[s++]=0;
	while(s--)putchar_unlocked(f[s]+'0');
	putchar_unlocked('\n');
}
sum[3<<17],cnt[3<<17],ans[3<<17];
N,i,acc,t;
main()
{
	N=rd();
	for(i=0;i<N;i++)
	{
		++sum[cnt[rd()]++];
	}
	i=0;
	for(t=N;t>0;t--)
	{
		while(acc>=i*t)acc+=sum[i++];
		ans[t]=i-1;
	}
	for(i=1;i<=N;i++)wt(ans[i]);
}

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

using namespace std;

int main() {
	int n;
	cin >> n;
	int res = 0;
	for (int i = 0; i < n; i++) {
		int l, r;
		cin >> l >> r;
		res += r - l + 1;
	}
	cout << res << endl;
	return 0;
}

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

/* 大文字を小文字に変換 */
char tolower(char c) {return (c + 0x20);}
/* 小文字を大文字に変換 */
char toupr(char c) {return (c - 0x20);}

// if('A'<=s[i] && s[i]<='Z') s[i] += 'a'-'A';

/*
string s = "abcdefg"
s.substr(4) "efg"
s.substr(0,3) "abc"
s.substr(2,4) "cdef"

// イテレータ要素のインデックス
distance(A.begin(), itr);
*/

int main()
{
    int n; cin >> n;
    string s; cin >> s;

    map<char, set<int> > m;
    rep(i,n) m[s[i]].insert(i);


    int q; cin >> q;
    rep(_,q){
        int que; cin >> que;
        if(que == 1){
            int i; char c; cin >> i >> c;
            --i;
            m[s[i]].erase(i);
            s[i] = c;
            m[c].insert(i);
        }else{
            int l, r; cin >> l >> r;
            --l, --r;
            int cnt = 0;
            for(char moji='a'; moji<='z'; moji++){
                if(!m[moji].empty()){
                    auto it = m[moji].lower_bound(l);
                    if(it != m[moji].end() && *it <= r) ++cnt;
                }
            }
            cout << cnt << endl;
        }
    }
}

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

#define min(x,y) ((x<y)?x:y)
#define max(x,y) ((x>y)?x:y)

typedef long long ll;

const ll INF = 1e9;
int N; ll W,V,out;

int main ()
{
	cin >> N >> W;
	vector<ll> weight(N), value(N);
	
	for(int i=0; i<N; i++) { cin >> weight[i] >> value[i]; V += value[i]; }
	
	vector<ll> dp(V+1);
	for(int i=1; i<=V; i++) dp[i]=INF; dp[0]=0;
	
	// dp[i] = minimum weight achievable with value i
	
	for(int item=0; item<N; item++)
	{
		int w = weight[item], v = value[item];
		for(int i = V; i>=v; i--) dp[i] = min(dp[i],dp[i - v] + w);
	}
		
	for(int i=V; i>=0; i--) if(dp[i]<=W) { cout << i; break; }
}

Measured memory_bytes: 1024
# include <cmath>
# include <iostream>
# include <queue>
# include <set>
# include <stack>
# include <string>
# include <vector>


using namespace std;


int main() {
    int n; cin >> n;
    string s; cin >> s;

    if (s.substr(0, n/2) ==s.substr(n/2, n)) cout << "Yes" << endl;
    else cout << "No" << 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);
		
		long N = sc.nextInt();
		int K = sc.nextInt();
		
		long ans = (N/K)*(N/K)*(N/K);
		if(K%2==0) {
			ans += ((N+K/2)/K)*((N+K/2)/K)*((N+K/2)/K);
		}
		
		System.out.println(ans);
		
		sc.close();
	}
}


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

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)   FOR(i,0,n)
#define LL long long

class UnionFind{
private:
  std::vector<int> par;
  std::vector<int> rnk;
public:
  UnionFind(int n):par(n),rnk(n){
    for(int i=0;i<n;i++){
      par[i]=i;
      rnk[i]=0;
    }
  }
  
  int find(int x){
    if(par[x] == x)
      return x;
    else
      return find(par[x]);
  }

  void unite(int x,int y){
    x=find(x);
    y=find(y);
    if(x==y)
      return;
      
    if(rnk[x] < rnk[y])
      par[x] = y;
    else{
      par[y] = x;
      if(rnk[x]==rnk[y]) rnk[x]++;
    }
  }

  bool same(int x,int y){
    return find(x) == find(y);
  }
};

int n,m;

int main(){
  cin>>n>>m;
  int tmp,tmp2;
  UnionFind un(2*n);
  REP(i,n){
    cin>>tmp;
    un.unite(i,n+tmp-1);
  }
  REP(i,m){
    cin>>tmp>>tmp2;
    un.unite(tmp-1,tmp2-1);
  }
  LL ret=0;
  REP(i,n)ret+=(un.same(i,n+i))?1:0;
  cout<<ret<<endl;
  return 0;
}


Measured memory_bytes: 1792
#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;
typedef pair<int, int> P;
const int INF = 1001001001;


int main() {
  int a,b;
  cin >> a >>b;
  if (a > b) {
  cout << "a > b" << endl;
  } else if (a < b) {
  cout << "a < b" << endl;
  } else {
  cout << "a == b" << endl;
  }
  return 0;
}



Measured memory_bytes: 3092
import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    int K = sc.nextInt();
    int X = sc.nextInt();
    int Y = sc.nextInt();
    
    if (N <= K) {
      System.out.println(N*X);
    } else {
      System.out.println(K*X + (N-K)*Y);
    }
  }
}

Measured memory_bytes: 21716
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
main(){
    ll n,k,ans=-9999999999999999;
    cin>>n;
    ll a[n*3],sum1[n+1],sum2[n+1];
    priority_queue<ll> a1;
    priority_queue<ll,vector<ll>,greater<ll>> a2;
    
    for(int i=0;i<n*3;i++){
        cin>>a[i];
    }

    sum1[0]=0;
    for(int i=0;i<n;i++){
        a2.push(a[i]);
        sum1[0]+=a[i];
    }

    for(int i=1;i<n+1;i++){
        if(a2.top()<a[n-1+i]){
            sum1[i]=sum1[i-1]-a2.top()+a[n-1+i];
            a2.pop();
            a2.push(a[n-1+i]);
        }
        else{
            sum1[i]=sum1[i-1];
        }
    }

    sum2[n]=0;
    for(int i=n*2;i<3*n;i++){
        a1.push(a[i]);
        sum2[n]+=a[i];
    }

    for(int i=n-1;i>-1;i--){
        if(a1.top()>a[n+i]){
            sum2[i]=sum2[i+1]-a1.top()+a[n+i];
            a1.pop();
            a1.push(a[n+i]);
        }
        else{
            sum2[i]=sum2[i+1];
        }
    }

    /*for(int i=0;i<n+1;i++){
        cout<<sum1[i]<<" "<<sum2[i]<<endl;
    }*/

    for(int i=0;i<n+1;i++){
        if(ans<sum1[i]-sum2[i])ans=sum1[i]-sum2[i];
    }

    cout<<ans;
}

Measured memory_bytes: 6260
d = input().split(' ')
w = int(d[0])
h = int(d[1])
a = int(d[2])
b = int(d[3])

s1 = ''
s2 = ''
for j in range(h):
  if j < a:
    s1 = s1 + '1'
    s2 = s2 + '0'
  else:
    s1 = s1 + '0'
    s2 = s2 + '1'

k = []
for i in range(w):
  if i < b:
    print(s1)
  else:
    print(s2)


Measured memory_bytes: 3956
n = int(input())
a = list(map(int, input().split()))
inc = False
dec = False
ans = 1

for i in range(n-1):
    if a[i+1] > a[i]:
        if dec:
            ans += 1
            dec = False
        else:
            inc = True
    elif a[i+1] < a[i]:
        if inc:
            ans += 1
            inc = False
        else:
            dec = True

print(ans)

Measured memory_bytes: 14252
#include <bits/stdc++.h>
using namespace std;
const int N = 200010;
int a[N];
int cnt[N];
long long ans;
int main()
{
	int n;scanf("%d", &n);
	for (int i = 0;i < n;++i)
	{
		scanf("%d", a + i);
		++cnt[a[i]];
	}
	for (int i = 1;i <= n;++i)
	{
		ans += (long long)cnt[i] * (cnt[i] - 1) / 2;
	}
	for (int i = 0;i < n;++i)
	{
		printf("%lld\n", ans - cnt[a[i]] + 1);
	}
	return 0;
}


Measured memory_bytes: 3712
#include <bits/stdc++.h>
#define ll long long
#define INF 1000000005
#define MOD 1000000007
#define EPS 1e-10
#define rep(i,n) for(int i=0;i<(int)(n);++i)
#define rrep(i,n) for(int i=(int)(n)-1;i>=0;--i)
#define srep(i,s,t) for(int i=(int)(s);i<(int)(t);++i)
#define each(a,b) for(auto& (a): (b))
#define all(v) (v).begin(),(v).end()
#define len(v) (int)(v).size()
#define zip(v) sort(all(v)),v.erase(unique(all(v)),v.end())
#define cmx(x,y) x=max(x,y)
#define cmn(x,y) x=min(x,y)
#define fi first
#define se second
#define pb push_back
#define show(x) cout<<#x<<" = "<<(x)<<endl
#define spair(p) cout<<#p<<": "<<p.fi<" "<<p.se<<endl
#define sar(a,n) cout<<#a<<":";rep(pachico,n)cout<<" "<<a[pachico];cout<<endl
#define svec(v) cout<<#v<<":";rep(pachico,v.size())cout<<" "<<v[pachico];cout<<endl
#define svecp(v) cout<<#v<<":";each(pachico,v)cout<<" {"<<pachico.first<<":"<<pachico.second<<"}";cout<<endl
#define sset(s) cout<<#s<<":";each(pachico,s)cout<<" "<<pachico;cout<<endl
#define smap(m) cout<<#m<<":";each(pachico,m)cout<<" {"<<pachico.first<<":"<<pachico.second<<"}";cout<<endl

using namespace std;

typedef pair<int,int> P;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<double> vd;
typedef vector<P> vp;
typedef vector<string> vs;

const int MAX_N = 200005;

vector<int> vec[2][29];

int main()
{
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n;
	cin >> n;
	vi a(n),b(n);
	rep(i,n){
		cin >> a[i];
	}
	rep(i,n){
		cin >> b[i];
	}
	rep(i,29){
		int mask = (1 << i) - 1;
		rep(j,n){
			vec[(b[j] >> i) & 1][i].pb(b[j] & mask);
		}
		sort(all(vec[0][i]));
		sort(all(vec[1][i]));
	}
	int ans = 0;
	rep(i,29){
		int mask = (1 << i) - 1;
		ll cnt = 0;
		rep(j,n){
			int cri = (a[j] & mask);
			int board = (1 << i) - cri;
			if((a[j] >> i) & 1){
				int x = upper_bound(all(vec[0][i]),board-1) - vec[0][i].begin();
				int y = lower_bound(all(vec[1][i]),board) - vec[1][i].begin();
				cnt += x+(len(vec[1][i])-y);
			}else{
				int x = lower_bound(all(vec[0][i]),board) - vec[0][i].begin();
				int y = upper_bound(all(vec[1][i]),board-1) - vec[1][i].begin();
				cnt += (len(vec[0][i])-x)+y;
			}
		}
		if(cnt % 2){
			ans += (1 << i);
		}
	}
	cout << ans << "\n";
	return 0;
}

Measured memory_bytes: 30532
n, k = gets.split(' ').map(&:to_i)

x = []
x = gets.split(' ').map(&:to_i)
min = 10000000000
for i in 0...(n - k + 1)
	l = x[i].abs + (x[i + k - 1]-x[i]).abs;
	r = x[i + k - 1].abs + (x[i]-x[i + k - 1]).abs;
	min = l if min > l
	min = r if min > r
end

p min

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

int main() {
  int H1,M1,H2,M2,K;
  cin >> H1 >> M1 >> H2 >> M2 >> K;
  cout << (H2 * 60 + M2) - (H1 * 60 + M1) - K<< endl;
}

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

int main()
{
	string x, y; cin >> x >> y;
	
	char ans;
	
	if (x[0] == y[0]) ans = '=';
	else if (x[0] < y[0]) ans = '<';
	else ans = '>';
	
	cout << ans << endl;
	
	return 0;		
}

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


int main() {
  int N;
  cin>>N;
  vector<int> vec(N);
  
  for(int x=0;x<N;x++){
    cin>>vec.at(x);
  }
  int one=0;
  for(int x=0;x<N;x++){
    if(vec.at(x)>=one) one=vec.at(x);
  }
  
  int two=0;
  for(int x=0;x<N;x++){
    if(vec.at(x)==one) continue;
    if(vec.at(x)>=two) two=vec.at(x);
  }
  int kai=0;
  for(int x=0;x<N;x++){
    if(vec.at(x)==one) kai++;
  }
  
  if(kai>=2){
    for(int x=0;x<N;x++){
    cout<<one<<endl;
    }
  }
    
  else{
    for(int x=0;x<N;x++){
      if(vec.at(x)!=one) cout<<one<<endl;
      else cout<<two<<endl;
    }
  } 
  
}

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

#define fastio 			ios::sync_with_stdio(0);	cin.tie(0); cout.tie(0);  cout<<fixed;  cout<<setprecision(12);	
#define randomINT 		mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());
#define	newl 			cout<<"\n"
#define DISP(as)		for(auto it : as) cout<<it<<" ";newl;
#define all(x)         	(x).begin(),(x).end()
#define mset(x,val)    	memset(x,val,sizeof(x))
#define newl           	cout<<"\n"
#define pb             	push_back
#define mp             	make_pair
#define f 				first
#define s 				second
#define dline          cerr<<"///REACHED///\n";
#define deb1(x)        cerr<<#x<<" = "<<x<<'\n';
#define deb2(x,y)      cerr<<'['<<#x<<','<<#y<<"] = "<<'['<<x<<','<<y<<']'<<'\n';
#define deb3(x,y,z)    cerr<<'['<<#x<<','<<#y<<','<<#z<<"] = "<<'['<<x<<','<<y<<','<<z<<']'<<'\n';

typedef long long 				ll;
typedef long double 			ld;
typedef vector<ll> 				vll;
typedef pair<ll ,ll> 			pll;
typedef pair<ld,ld> 			pld;
typedef unordered_map<ll,ll> 	um;
typedef vector<pll> 			vpll;

const ll 	MAX5 	= 	1e+5+7;
const ll 	MAX7 	= 	1e+7+7;
const ll 	MAXN 	= 	MAX7;
const ll   	INF   	=  	0x7f7f7f7f7f7f7f7f;
const int  	INFi 	=  	0x7f7f7f7f;
const ll 	MOD		=  	1e+9+7;
const ll 	N 		= 	2*1e6;

vll adj[MAXN];ll visit[MAXN]={};
int dx8[]={0,1,1,1,0,-1,-1,-1}, dy8[]={1,1,0,-1,-1,-1,0,1};
int dx4[]={0,1,0,-1}, dy4[]={1,0,-1,0};

// <------------- Declare Variables Here ------------> //

ll T=1;
ll n,x,y,m,q,k;
string s,t;
vll a;
// <------------- Implement Functions Here ----------> //

// <------------- Start of main() -------------------> //

void MAIN() {
	cin >> n >> k;
	a = vll(n);
	vll dp(n,INF);
	for(ll i=0;i<n;i++) cin>>a[i];	
	
	dp[0] = 0;
	dp[1] = abs(a[1] - a[0]);
	

	for(ll i=2;i<n;i++) {
		for(ll j=1;j<=k;j++)
			if(i-j >= 0)
				dp[i] = min(dp[i-j]+abs(a[i]-a[i-j]), dp[i]);
	}
	//DISP(dp);
	cout<<dp[n-1]; 
}

int main() {
	fastio;randomINT;
	//cin>>T;
	while(T--) {
		MAIN();
	}
	return 0;
}



Measured memory_bytes: 239228
#include<cstdio>
#include<cmath>
#include<algorithm>
#include<numeric>

#define REP(i,s,n) for(int i=s;i<n;i++)
#define rep(i,n) REP(i,0,n)

using namespace std;

int T,N,boat[1010];

int main(){
  // POJ 1700
  //scanf("%d",&T);
  //while( T-- ) {
    scanf("%d",&N);
    rep(i,N) scanf("%d",boat+i);
    sort(boat,boat+N);
    int ans = 0;
    while( N > 3 ){
      int cost_a = boat[0] * 2 + boat[N-1] + boat[N-2];
      int cost_b = ( boat[1] * 2 + boat[0] ) + boat[N-1];
      N -= 2;
      ans += min(cost_a,cost_b);
    }
    if( N == 3 ) ans += accumulate(boat,boat+N,0);
    else ans += boat[N-1];
    printf("%d\n",ans);
    //}
  return 0;
}


Measured memory_bytes: 1048
n,k=map(int,input().split())
x=list(map(int,input().split()))
lis=[]
for i in range(n-k+1):
  if x[i]<=0 and x[i+k-1]>=0:
    lis.append(min(x[i+k-1]-2*x[i],abs(x[i])+2*x[i+k-1]))
  elif x[i]>0 and x[i+k-1]<0:
    lis.append(min(x[i]-2*x[i+k-1],abs(x[i+k-1])+2*x[i]))
  else:
    lis.append(max(abs(x[i]),abs(x[i+k-1])))
print(min(lis))


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

int main()
{
	ll n;
	ll ans=0;
	cin>>n;
//	for(int i=1,j=n; i<=n,j>=1; j--,i++)
//		ans+=i%j;
	for(int i=1; i<=n; i++)
		ans+=i;
	cout<<ans-n;
	return 0;
}
//
//1   2   3   4   5   6   7   8   9   10   11   12   13
//13  12  11  10  9   8   1   2	3	4	 5	  6		7	
//1	2	3	4	5   6	0	0	0	2	1	  0		6

Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
#include<vector>
#include<functional>
#include<algorithm>
#include<stdlib.h>
#include<string>
#include<string.h>
#define _USE_MATH_DEFINES
#include<math.h>
#include<deque>
#include<set>
#include<map>
#include<queue>
#include<list>
#include<iostream>
#include <bitset>
using namespace std;
typedef long long ll;
#define rep(i,a,b) for(auto i=a;i<b;i++)
#define all(_x) _x.begin(), _x.end()
#define r_sort(_x) sort(_x.begin(), _x.end(), std::greater<int>())
#define vec_cnt(_a, _n) (upper_bound(all(_a), _n) - lower_bound(all(_a), _n))
#define vec_unique(_a) _a.erase(std::unique(all(_a)), _a.end());
ll gcd(ll a, ll b) { return a % b == 0 ? b : gcd(b, a % b); }
//ll lcm(ll a, ll b) { return (a / gcd(a, b)) * b; }
#define INF 1 << 30
const int mod = 998244353;
ll power(ll x, ll p) { ll a = 1; while (p > 0) { if (p % 2 == 0) { x *= x; p /= 2; } else { a *= x; p--; } }return a; }
ll mpower(ll x, ll p) { ll a = 1; while (p > 0) { if (p % 2 == 0) { x = x * x % mod; p /= 2; } else { a = a * x % mod; p--; } }return a; }
ll c(ll n, ll k) { ll a = 1; rep(i, 1, k) { a *= n - i + 1; a /= i; }return a; }
ll mc(ll n, ll m) { ll k = 1, l = 1; rep(i, n - m + 1, n + 1) k = k * i % mod; rep(i, 1, m + 1) l = l * i % mod; l = mpower(l, mod - 2); return k * l % mod; }
int t[26];
#define DIV 4
ll dp[10001];
int main(void) {
	int n;
	ll s = 0, s2 = 0;
	cin >> n;
	vector<int> a(n);
	rep(i, 0, n)cin >> a[i];
	sort(all(a));
	if (n % 2 == 0) {
		rep(i, 0, n / 2 - 1)s -= a[i] * 2;
		rep(i, n / 2 + 1, n)s += a[i] * 2;
		s += a[n / 2] - a[n / 2 - 1];
	}
	else {
		rep(i, 0, n / 2 - 1)s -= a[i] * 2;
		rep(i, n / 2 + 1, n)s += a[i] * 2;
		s += -a[n / 2] - a[n / 2 - 1];
		rep(i, 0, n / 2)s2 -= a[i] * 2;
		rep(i, n / 2 + 2, n)s2 += a[i] * 2;
		s2 += a[n / 2] + a[n / 2 + 1];
	}
	printf("%lld\n", max(s, s2));
	return 0;
}

Measured memory_bytes: 640
#include<iostream>
#include<list>
#include<stdlib.h>
  
using namespace std;

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

  list<int> v;

  int N, x;
  string str;
  cin >> N;
  for(int i = 0; i < N; i++){
    cin >> str;
    if (str == "insert") {
      cin >> x;
      v.push_front(x);
    } else if (str == "delete") {
      cin >> x;
      for (list<int>::iterator it = v.begin(); it != v.end(); it++) {
        if (*it == x) {
          v.erase(it);
          break;
        }
      }
    } else if (str == "deleteFirst") {
      v.pop_front();
    } else {
      v.pop_back();
    }
  }

  int i = 0;
  for (list<int>::iterator it = v.begin(); it != v.end(); it++) {
    if (i++) {
      cout << ' ';
    }
    cout << *it;
  }
  cout << endl;
}


Measured memory_bytes: 34372
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <string>

using ll = long long;

using namespace std;

#define LIMIT ((ll)1e18)

int main() {
    int n;
    cin >> n;
    ll ans = 1;
    bool overFlow = false;
    for (int i=0; i<n; i++) {
        ll ai; cin >> ai;
        if (ai == 0) {
            cout << 0 << '\n';
            return 0;
        }
        if (ans > LIMIT / ai + 1) {
            overFlow = true;
        }
        if (!overFlow)
            ans *= ai;
    }
    cout << ((ans <= LIMIT && !overFlow) ? ans : -1) << '\n';
    return 0;
}

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

using namespace std;
typedef long long ll;

#define MOD (long long)(1e9+7)
#define INF (1LL<<60)
#define rep(i,n) for(ll i = 0; i < (n); i++)
#define rep1(i,n) for(ll i = 1; i <= (n); i++)

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;
}


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

// mod m a 
ll modinv(ll a, ll m) {
  ll b = m, u = 1, v = 0;
  while (b) {
    ll t = a / b;
    a -= t * b; swap(a, b);
    u -= t * v; swap(u, v);
  }
  u %= m;
  if (u < 0) u += m;
  return u;
}

// 
vector<pair<ll, ll>> prim;
void pf(ll n)
{
  ll s = sqrt(n);
  ll r = 0;
  for(ll i = 2; i <= s; i++) {
    if((n % i) == 0) {
      r = 0;
      do {
	r++;
	n = n / i;
      } while((n % i) == 0);
      prim.push_back({i, r});
    }
  }
  if(n > s) {
    prim.push_back({n, 1});
  }
}

void solve()
{
  // ll N; cin >> N;
  // ll N, K; cin >> N >> K;
  // ll x, y, z; cin >> x >> y >> z;
  // ll a, b, c; cin >> a >> b >> c;
  string s; cin >> s;
  string t; cin >> t;
  // vector<ll> a(N); rep(i, N) cin >> a[i];
  
  ll ans = 0;
  rep(i, s.size()) {
    if(s[i] != t[i]) ans++;
  }
  // bool ok = false;

  cout << ans << endl;
  // cout << (ok?"Yes":"No") << endl;
}


int main(void)
{
  // ll t; cin >> t; rep(i, t)
  solve();
}


Measured memory_bytes: 3976
#include <iostream>
#include <string>
#define repi(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,a) repi(i,0,a)
#define all(a) (a).begin(), (a).end()

std::string S;

int main()
{
  std::cin >> S;

  std::cout << (S <= "2019/04/30" ? "Heisei" : "TBD") << std::endl;

  return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String[] args){

		Scanner sc = null;

		try {
			sc = new Scanner(System.in);
			//??´??°????????°???????????????
			int loop = sc.nextInt();

			//??????????????¨?????°
			int count = 0;

			//??\??????????????????(?????????)
			for (int i = 0; i < loop; i++) {
				int num = sc.nextInt();

				//?´???°????????§??????
				boolean check = true;
				double border = Math.sqrt(num);
				if (num == 2 || num % 2 != 0) {

					//1??¨????????°??\?????§???????????????????????§??????
					for (int j = 3; j <= border; j+=2) {
						if ((num % j) == 0) {
							check = false;
							break;
						}
					}
				}else {
					check = false;
				}

				//?´???°??????????????????
				if (check) {
					count++;
				}
			}
			//????????????
			System.out.println(count);
		}catch (Exception e) {
			System.out.println(e);
		} finally {
			if (sc != null) {
				sc.close();
			}
		}
	}
}

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

using namespace std;

const int N=1e6+3;

const double eps=0.000000001;

#define pb push_back
#define all(x) (x).begin(),(x).end()
typedef long long ll;

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

const int inf=1e9;

int n,m,a[N],b[N],k,q,u,v,x,y,tc,c,l,r,ans;

char s[N];

void IO(){
	ios::sync_with_stdio(false);
	cin.tie(0);cout.tie(0);
	#ifndef ONLINE_JUDGE
		freopen("test.txt","r",stdin);
	#endif
}


int main(){
	//IO();
	ll ans=4e18;
	scanf("%d%d",&n,&m);
	for(int i=0;i<n;i++)
		scanf("%d %d",&a[i],&b[i]);
	for(int i=0;i<n;i++){
		for(int j=0;j<n;j++){
			for(int k=0;k<n;k++){
				for(int l=0;l<n;l++){
					int min_x=min(min(a[i],a[j]),min(a[k],a[l]));
					int max_x=max(max(a[i],a[j]),max(a[k],a[l]));
					int min_y=min(min(b[i],b[j]),min(b[k],b[l]));
					int max_y=max(max(b[i],b[j]),max(b[k],b[l]));
					int cnt=0;
					for(int ii=0;ii<n;ii++)
						if (! (a[ii]>max_x || a[ii]<min_x || b[ii]>max_y || b[ii]<min_y) )
							cnt++;
					if (cnt>=m)
						ans=min(ans,(ll)(max_x-min_x)*(max_y-min_y));
				}
			}
		}
	}
	printf("%lld\n",ans);
}


Measured memory_bytes: 2432
#include <bits/stdc++.h>
#define REP(i,n) for (int i = 0; i < (n); i++)
#define RREP(i, s, n) for (int i = s; i < (n); i++)
#define ALL(a) a.begin(), a.end()
#define RALL(a) a.rbegin(), a.rend()
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; }
using namespace std;
using ll = long long;
typedef pair<int, int> pint;
typedef pair<ll, ll> pll;
const ll MOD = 1000000007;
const ll INF = MOD * MOD;
const int inf = (1<<29);

int main() {

    string s;
    cin >> s;
    
    if (s[0] == '7' || s[1] == '7' || s[2] == '7') cout << "Yes" << endl;
    else cout << "No" << endl;

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

Measured memory_bytes: 3608
#include<iostream>
#include<sstream>
#include<vector>
#include<algorithm>
#include<string>
#include<stdexcept>
#include<stdio.h>
#include<queue>
#include<numeric>
using namespace std;
typedef long long ll;
 vector<pair<ll,ll>> P;
//最大公約数欲しい！！！！！！！！！
 
 int gcd(int a,int b){
   while(b!=0){
     a%=b;
     if(a==0) return b;
     b%=a;
   }
   return a;
 }
int main(){
   int n; cin >> n;
   int a[n];
   for(int i=0;i<n;i++) cin >> a[i];
   int ans=a[0];
   for(int i=0;i<n;i++){
     ans=gcd(ans,a[i]);
   }
   cout << ans << endl;
 }

Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<bool> vb;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef map<int,int> mii;
typedef map<ll,ll> mll;
typedef vector<pii> vii;
typedef vector<pll> vll;
#define fi first
#define se second
#define pi 3.141592653589793
#define mod 1e9 + 7
#define pb push_back
#define all(v) v.begin(),v.end()
#define rall(v) v.begin(), v.end(), greater<ll>()
#define tc int t;cin>>t;while(t--)
#define pqmax priority_queue<int>
#define pqmin priority_queue<int,vi,greater<int>>
#define fast_io ios_base::sync_with_stdio(0), cin.tie(NULL)
#define tc_g int tt;cin>>tt;for(int ti=1;ti<=tt;ti++)
#define case_g "Case #"<<ti<<": "
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
typedef tree<int, null_type, less_equal<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_multiset;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
typedef tree<int, int, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_map;
using namespace std;
int main() {
    string ss;
    int N;
    cin >> N;
    cin >> ss;
    string ans = "";
    for(int i = 0; i < ss.size(); ++i) {
        ans = ans + char(((ss[i] - 'A' + N)%26) + 'A');
    }
    cout << ans;
}


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

ll f(ll b, ll n) {
  if (n < b) {
    return n;
  }
  return f(b, n / b) + (n % b);
}

ll solve(ll n, ll s) {
  ll b = 2;
  while (n / b >= b) {
    if (f(b, n) == s) {
      return b;
    }
    ++b;
  }
  for (ll k = n / b; k >= 1; k--) {
    ll rem = s - k;
    if (rem < 0) {
      continue;
    }
    ll sb = n / (k + 1) + 1;
    ll sm = n % sb;
    if (rem > sm || (sm - rem) % k != 0) {
      continue;
    }
    return sb + (sm - rem) / k;
  }
  if (s == n) {
    return n + 1;
  }
  return -1;
}

int main() {
  ll n, s;
  cin >> n >> s;
  cout << solve(n, s) << endl;
  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<cstdlib>
#include<cstring>
#include<climits>
#include<vector>
#include<list>
#include<functional>
#include<algorithm>
#include<string>
#include<cmath>
#include<complex>
#include<set>
#include<map>
#include<stack>
#include<queue>
#include<deque>
#include<tuple>
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n) for(int i=0;i<(n);i++)
using namespace std;
typedef long long ll;
typedef pair<int, int> P;



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

	int N;
	cin >> N;
	int res;
	for (int i = 0;i*i <= N;i++) res = i * i;
	cout << res << "\n";

	return 0;
}

Measured memory_bytes: 256
package main

import (
  "fmt"
)

func main() {
  var s string
  fmt.Scanf("%s", &s)
  
  ans := "Good"
  for i := 0; i < 3; i++ {
    if s[i:i+1] == s[i+1:i+2] {
      ans = "Bad"
    }
  }
  
  fmt.Printf("%s\n", ans)
}

Measured memory_bytes: 1828
#include<stdio.h>
int main(){
    unsigned long ulW_D_inact[100][100];    /* 行列Ａの格納用変数 */
    unsigned long ulW_D_act[100];           /* 行列Ｂの格納用変数 */
    unsigned long ulW_D_ans[100];           /* 積の格納用変数 */
    unsigned short usW_D_row, usW_D_col;          /* 行列の要素数の格納用変数 */
    unsigned short usW_C_i, usW_C_j;              /* ループ変数 */

    /* 配列の初期化 */
    for(usW_C_i = 0;usW_C_i < 100;usW_C_i++){
        for(usW_C_j = 0;usW_C_j < 100;usW_C_j++){
            ulW_D_inact[usW_C_i][usW_C_j] = 0;
        }
        ulW_D_act[usW_C_i] = 0;
        ulW_D_ans[usW_C_i] = 0;
    }

    /* 行列の要素数の入力 */
    scanf("%d %d", &usW_D_row, &usW_D_col);

    /* 行列Ａの入力 */
    for(usW_C_i = 0;usW_C_i < usW_D_row;usW_C_i++){
        for(usW_C_j = 0;usW_C_j < usW_D_col;usW_C_j++){
            scanf("%d", &ulW_D_inact[usW_C_i][usW_C_j]);
        }
    }

    /* 行列Ｂの入力 */
    for(usW_C_i = 0;usW_C_i < usW_D_col;usW_C_i++){
        scanf("%d", &ulW_D_act[usW_C_i]);
    }

    /* ＡとＢの積の計算 */
    for(usW_C_i = 0;usW_C_i < usW_D_row;usW_C_i++){
        for(usW_C_j = 0;usW_C_j < usW_D_col;usW_C_j++){
            /* i番目の積の計算 */
            ulW_D_ans[usW_C_i] += ulW_D_inact[usW_C_i][usW_C_j] * ulW_D_act[usW_C_j];
        }
    }
    /* 積の出力 */
    for(usW_C_i = 0;usW_C_i < usW_D_row;usW_C_i++){
        /* i番目の積の出力 */
        printf("%d\n", ulW_D_ans[usW_C_i]);
    }
    return 0;
}


Measured memory_bytes: 2100
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <bitset>
#include <algorithm>
#include <complex>
#include <array>
#include <functional>
using namespace std;
 
#define REP(i,n) for(int i=0; i<n; ++i)
#define FOR(i,a,b) for(int i=a; i<=b; ++i)
#define FORR(i,a,b) for (int i=a; i>=b; --i)
#define ALL(c) (c).begin(), (c).end()
 
typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<double> VD;
typedef vector<VI> VVI;
typedef vector<VL> VVL;
typedef vector<VD> VVD;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;

template<typename T> void chmin(T &a, T b) { if (a > b) a = b; }
template<typename T> void chmax(T &a, T b) { if (a < b) a = b; }

int in() { int x; scanf("%d", &x); return x; }
ll lin() { ll x; scanf("%lld", &x); return x; }

const ll mod = 1000000007;

int main() {
    int n;
    cin >> n;
    VI a(n);
    REP(i,n) a[i] = in();
    ll ans = 1;
    VI cnt(3);
    REP(i,n){
        VI c;
        REP(j,3){
            if (cnt[j] == a[i]){
                c.push_back(j);
            }
        }
        if (c.empty()){
            cout << 0 << endl;
            return 0;
        }
        ans = (ans * (ll)c.size()) % mod;
        cnt[c[0]]++;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 640
#include<iostream>
#include<math.h>
#include<iomanip>

using namespace std;

void Solution()
{
    double x1, y1, x2, y2;
    
    cin>>x1>>y1>>x2>>y2;
    
    cout<<fixed<<setprecision(5)<<sqrt((x2 - x1) * (x2 - x1) + (y2 - y1) * (y2 - y1))<<endl;
}

int main()
{
    Solution();
    return 0;
}

Measured memory_bytes: 1280
#include <bits/stdc++.h>
#define REP(i,n) for (int i=0; i<(n); ++i)
#define REPR(i,n,m) for (int i=(n); i>=(m); --i)
using namespace std;
using LL = long long;
using LD = long double;
using PLL = pair<long long, long long>;
using PLD = pair<long double, long double>;
using VLL = vector<long long>;
using VLD = vector<long double>;
using VPLL = vector<PLL>;
using VPLD = vector<PLD>;

int main() {
  
    string s;
    cin >> s;

    if (s[int(s.size())-1] == 's') {
        cout << s << "es" << endl;
    }
    else {
        cout << s << "s" << endl;
    }

    return 0;
}


Measured memory_bytes: 3628
from collections import Counter
N = int(input())
N_ = int(N**0.5)+2

counter = Counter()
for x in range(1,N_):
    for y in range(1,N_):
        if N <= x**2+y**2+x*y:
            break
        for z in range(1,N_):
            tmp = x**2+y**2+z**2+x*y+y*z+z*x
            if N < tmp:
                break
            counter[tmp] += 1

for i in range(1,N+1):
    print(counter[i])


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

long long sum(long long a){
	long long A = 0;
	for (long long i = 0; i < a; i++)
		A += i+1;
	return A;
}

int main(){
	int N, M;
	long long ans = 0;
	cin >> N >> M;
	vector<long long> box(N+1);
	for (int i = 1; i < N+1; i++)
		cin >> box.at(i);
	for (int i = 1; i < N+1; i++)
		box.at(i) += box.at(i-1);
	/*for (int i = 0; i < N+1; i++)
		cout << box.at(i) << endl;*/
	map<long long,long long> mp;
	for (int i = 0; i < N+1; i++)
		mp[box.at(i) % M]++;
	/*for (auto itr = mp.begin(); itr != mp.end(); itr++)
		cout << itr->first << ',' << itr->second << endl;*/
	for (auto itr = mp.begin(); itr != mp.end(); itr++){
		itr->second = sum(itr->second - 1);
		ans += itr->second;
	}
	cout << ans << endl;
	return 0;
} 

Measured memory_bytes: 4992
#include<iostream>
#include<algorithm>
#include<map>
#include<set>
#include<string>
#include<vector>
using namespace std;
using ll = long long;
using lli = long long int;
ll MM = 1000000000;
ll mod = MM + 7;
#define INF (ll)1e18
int main(){
    string s; cin >> s;
    ll n = s.size();
    vector<ll> a;
    ll count = 0;
    for(ll i = 0; i < n; i++){
        if(s[i] == 'B'){
            a.push_back(i+1);
        }
    }
    reverse(a.begin(), a.end());
    ll m = a.size();
    for(ll i = 0; i < m; i++){
        count += n-a[i];
        n--;
    }
    cout << count << endl;
}

Measured memory_bytes: 2680
#include<iostream>
#include<string>
#include<vector>
#include <algorithm>
using namespace std;
int main() {
    string s;
    cin >> s;
    int size = s.size() ;
    string new_s;
    for(int i=0;i<size;i++){
        if(i%2==0){
            new_s.push_back(s[i]) ;
        }
    }
    cout << new_s << endl;
}

Measured memory_bytes: 3692
N,M=map(int,input().split())
sc=[]
for _ in range(M):
    sc.append(list(map(int,input().split())))
sc.sort()
out=False
for i in range(0,M):
    for j in range(0,M):
        if i==j:
            continue
        else:
            if sc[i][0]==sc[j][0] and sc[i][1]!=sc[j][1]:
                out=True
    if N!=1 and sc[i]==[1,0]:
        out=True
if out:
    print(-1)
else:
    digit=[-1]*N
    for i in range(0,M):
        digit[sc[i][0]-1]=sc[i][1]
    if N==1 and M==0:
        digit=[0]
    for i in range(0,N):
        if digit[i]==-1:
            if i != 0:
                digit[i]=0
            else:
                digit[i]=1
        print(digit[i],end="")

Measured memory_bytes: 3064
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
typedef long long int ll;

constexpr ll mod=1e9+7;

ll mod_pow(ll a,ll b){
	if(b==0)return 1;
	if(b==1)return a;
	ll res=mod_pow(a,b/2)%mod;
	res*=res; res%=mod;
	if(b%2)res*=a;
	return res%mod;
}

struct perm{
private:
	int sz;
	vector<ll> p,invp;
public:
	perm(int n){
		sz=n+1;
		p.resize(sz),invp.resize(sz);
		p[0]=1;
		for(int i=1;i<=sz-1;i++){
			p[i]=p[i-1]*i%mod;
		}
		invp[sz-1]=mod_pow(p[sz-1],mod-2);
		for(int i=sz-2;i>=0;i--){
			invp[i]=invp[i+1]*(i+1)%mod;
		}
	}
	ll comb(ll x,ll y){
		if(x<y||y<0)return 0;
		return (p[x]*invp[x-y]%mod)*invp[y]%mod;
	}
};
perm p(1<<21);

int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int k; cin >> k;
    string s; cin >> s;
    int n=s.size();
    ll a=mod_pow(26,k+n)%mod;
    ll b=0;
    for(int i=0;i<=n-1;i++){
    	(b+=p.comb(n+k,i)*mod_pow(25,n+k-i)%mod)%=mod;
    }
    cout << ((a-b)%mod+mod)%mod << endl;
}




Measured memory_bytes: 36980
n, k = map(int, input().split())
mod = 10**9+7
ans = 0
# k以上n+1以下のi個の数を選ぶ
for i in range(k, n+2):
    ans += ((n-i+1)+n)*i//2-(i-1)*i//2+1

print(ans % mod)


Measured memory_bytes: 9164
#include <stdio.h>

int main(){
	char bball[3];
	int i,x=0;
	
	scanf("%s",bball);
	
	for(i=0;i<3;i++){
		if(bball[i]=='1'){
			x++;
		}
	}
	printf("%d",x);
	return 0;
}

Measured memory_bytes: 128
#include <stdio.h>

int main(void)
{
	int r;
	scanf("%d",&r);
	
	if(r<1200){
		printf("ABC\n");
	}else if(r<2800){
		printf("ARC\n");
	}else{
		printf("AGC\n");
	}
	
	return 0;
}

Measured memory_bytes: 128
# intervals on the tree
N = int(input())
ans = 0
for _ in range(N-1):
    a, b = map(int, input().split())
    a, b = min(a, b), max(a, b)
    ans -= (N+1-b)*(a)
for i in range(1, N+1):
    ans += i*(i+1)//2
print(ans)

Measured memory_bytes: 9056
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
#define INF 100000000
#define rep(i,s,n) for (int i = (int)(s); i < (int)(n); i++)
#define repp(i,n,s) for (int i= (int)(n); i >= (int)(s); i--)
#define mp make_pair
ll mod = 1000000007;
ll mod2 = 998244353;

ll modpow(ll a, ll b){
    ll r = 1;
    while(b){
        r = r*((b%2)?a:1)%mod;
        a = a*a%mod;
        b>>=1;
    }
    return r;
}

ll comb(ll N_, ll C_) {
	const int NUM_=1000201;
	static ll fact[NUM_+1],factr[NUM_+1],inv[NUM_+1];
	if (fact[0]==0) {
		inv[1]=fact[0]=factr[0]=1;
		for (int i=2;i<=NUM_;++i) inv[i] = inv[mod % i] * (mod - mod / i) % mod;
		for (int i=1;i<=NUM_;++i) fact[i]=fact[i-1]*i%mod, factr[i]=factr[i-1]*inv[i]%mod;
	}
	if(C_<0 || C_>N_) return 0;
	return factr[C_]*fact[N_]%mod*factr[N_-C_]%mod;
}


int main(){
	cin.tie(0);
    ios::sync_with_stdio(false);
    ll x,y;cin>>x>>y;
    ll ans = 0;
    if ((2*y-x)%3!=0 || (2*x-y)%3!=0){
        cout<<0<<endl;
        return 0;
    }
    ll x1 = (2*y-x)/3;
    ll x2 = (2*x-y)/3;
    ans = comb(x1+x2,x1);
    cout<<ans<<endl;
}

Measured memory_bytes: 27064
n = int(input())
a = [input() for i in range(n)]
d = {"M": [], "A": [], "R":[], "C":[], "H":[]}
for i in range(n):
    if a[i][0] in ("M", "A", "R", "C", "H"):
        d[a[i][0]].append(a[i])
n1 = len(d["M"])
n2 = len(d["A"])
n3 = len(d["R"])
n4 = len(d["C"])
n5 = len(d["H"])
print(n1*n2*(n3+n4+n5) + n1*n3*(n4+n5) + n1*n4*n5 + n2*n3*(n4+n5) + n2*n4*n5 + n3*n4*n5)



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

int main() {
  int N;
  cin>>N;
  vector<int> d(N);
  for (int i = 0; i < N; i++) {
    cin >> d.at(i);
  }
  sort(d.begin(), d.end());
 
    cout <<d.at(N/2)-d.at(N/2-1)<<endl;
  
}

Measured memory_bytes: 640