akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define int long long
const int MOD=1e9+7;

int N,X,Y,Z;
int dp[50][1234567];
int pw(int n,int k){
  if(k<0)return pw(n,k+MOD-1);
  int res=1;
  while(k){
    if(k&1)res*=n;res%=MOD;
    n*=n;n%=MOD;
    k>>=1;
  }
  return res;
}
bool f(int k,int a){
  k>>=a;
  return k&1;
}

signed main(){
  memset(dp,0,sizeof(dp));
  dp[0][0]=1;
  cin>>N>>X>>Y>>Z;
  int A=X+Y+Z,B=Y+Z,C=Z;
  for(int i=0;i<N;i++){
    for(int k=0;k<(1<<A);k++){
      if(f(k,A-1)&&f(k,B-1)&&f(k,C-1))continue;
      for(int j=1;j<=10;j++){
        int tmp=k;
        tmp<<=j;tmp+=(1<<(j-1));
        tmp&=(1<<A)-1;
        dp[i+1][tmp]+=dp[i][k];dp[i+1][tmp]%=MOD;
      }
    }
  }
  int ans=0;
  for(int k=0;k<(1<<A);k++){
    if(f(k,A-1)&&f(k,B-1)&&f(k,C-1))continue;
    ans+=dp[N][k];ans%=MOD;
  }
  cout<<(pw(10,N)-ans+MOD)%MOD<<endl;
}


Measured memory_bytes: 482560
#include<bits/stdc++.h>
using namespace std;
int x[101];
int main(){
	int n, k;
	cin >> n >> k;
	for(int i=1; i<=k; i++){
		int d, v;
		cin >> d;
		for(int j=1; j<=d; j++){
			cin >> v;
			x[v] = 1;
		}
	}
	int a = 0;
	for(int i=1; i<=n; i++){
		if(!x[i]) a++;
	}
	cout << a;
	return 0;
}


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

int main() {
	
	ll n, k; cin >> n >> k;
	ll ans = 0;
	for (ll i = 1; i <= n ; i++) {
		ll quo = n / i;
		ll mod = n % i;
		ans +=quo * max(0LL, i - k);
		ans += max(0LL, mod - k + 1);
	}
	if(k == 0) ans -= n;
	cout << ans << endl;
    return 0;
}

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

using namespace std;

int main() {
  string s;
  int n = 0;
  cin >> s;
  for(int i = 0; i < 15; i++) {
    if(s[i] == 'x') {
      n += 1;
    }
  }
  if(n < 8) {
    cout << "YES" << endl;
  } else {
    cout << "NO" << endl;
  }
  return 0;
}


Measured memory_bytes: 256
/**
 * Created by hiramekun at 20:44 on 2019-12-08.
 */
#include <bits/stdc++.h>

using namespace std;
using ll = long long;
#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)

int main() {
    ll h, w;
    cin >> h >> w;
    vector<vector<ll>> a(h, vector<ll>(w)), b(h, vector<ll>(w));
//    int a[h][w], b[h][w];
    rep(i, h) rep(j, w) cin >> a[i][j];
    rep(i, h) rep(j, w) cin >> b[i][j];

    ll max_diff = 2 * 80 * 160;
//    vector<vector<vector<bool>>> dp(h, vector<vector<bool>>(w, vector<bool>(max_diff)));
    bool dp[h][w][max_diff];
    rep(i, h) rep(j, w) rep(l, max_diff) dp[i][j][l] = false;

    ll mid = max_diff / 2;
    dp[0][0][b[0][0] - a[0][0] + mid] = true;
    dp[0][0][-b[0][0] + a[0][0] + mid] = true;

    rep(i, h) {
        rep(j, w) {
            rep(l, max_diff) {
                if (!dp[i][j][l]) continue;
                if (i + 1 <= h - 1) {
                    dp[i + 1][j][l + b[i + 1][j] - a[i + 1][j]] = true;
                    dp[i + 1][j][l - b[i + 1][j] + a[i + 1][j]] = true;
                }
                if (j + 1 <= w - 1) {
                    dp[i][j + 1][l + b[i][j + 1] - a[i][j + 1]] = true;
                    dp[i][j + 1][l - b[i][j + 1] + a[i][j + 1]] = true;
                }
            }
        }
    }
    ll ans = 1e18;
    rep(i, max_diff) {
        if (dp[h - 1][w - 1][i]) ans = min(ans, abs(i - mid));
    }
    cout << ans << '\n';
}

Measured memory_bytes: 160892
//#include "pch.h"
#include <stdio.h>
#include <string.h>
#include <algorithm>
#include <iostream>
#include <string>
#include <vector>
#include <functional>
#include <map>
#include <iomanip>
#include <math.h> 
#include <stack>
#include <queue>
#include <bitset>
#include <cstdlib>
#include <tuple>
#include <cctype>
#include <ctype.h>
#include <set>
#include <sstream>
#include <time.h>
#include <numeric>
using namespace std;
//#define int long long
#define rep(i,s,n) for(int i = s;i<n;i++)
#define repe(i,s,n) for(int i = s;i<=n;i++)
#define rrep(i,s,n) for(int i = (n)-1;i>=(s);i--)
#define all(v) (v).begin(),(v).end()
#define pb push_back
#define fi first
#define se second
#define chmin(a,b) a=min((a),(b))
#define chmax(a,b) a=max((a),(b))
#define l1 list[index]
#define l2 list[index - 1]
#define l3 list[index + 1]
#define iif(i,j) ((i<0 && j<0) || (i>0 && j>0)) ? true : false 
typedef long long ll;
typedef pair<int, int>pint;
typedef vector<int>vint;
typedef vector<pint>vpint;
typedef pair<pint, int> P1;
typedef pair<int, pint> P2;
typedef pair<pint, pint> PP;
static const ll maxLL = (ll)1 << 62;
const ll MOD = 1000000007;
const ll INF = 1e18;
const double PI = 3.14159265359;
int ca[12] = { 31,28,31,30,31,30,31,31,30,31,30,31 };




signed main() {
	ll K, N;
	vector<ll>list;
	vector<ll>salist;

	cin >> K >> N;
	
	for (int i = 0; i < N; i++) {
		ll num;
		cin >> num;
		list.push_back(num);
	}

	for (int i = 1; i < list.size(); i++) {
		salist.push_back(list[i] - list[i - 1]);
	}

	salist.push_back(K - list[list.size() - 1] + list[0]);


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

	cout << K - salist[salist.size() - 1] << endl;



	return 0;
}

Measured memory_bytes: 4848
#include<bits/stdc++.h> 
using namespace std;
int main()
{
	int a,b,c1,c2,c3,t;
	cin>>a>>b;
	c1=a+b;
	c2=a-b;
	c3=a*b;
	t=c1;
	if(t<c2)
	t=c2;
	if(t<c3)
	t=c3;
	cout<<t;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define int long long
using namespace std;
signed main()
{
	ios::sync_with_stdio(0);
    cin.tie(0);cout.tie(0);
	int a,b;
	cin>>a>>b;
	if(a>b)swap(a,b);
	if(a<=0&&b>=0)cout<<"Zero\n";
	else if(a<0&&b<0&&(b-a+1)&1)cout<<"Negative\n";
	else cout<<"Positive\n";
    return 0;
}


Measured memory_bytes: 3608
import Data.Array

solve :: Int -> Int -> Mint
solve n k = sum $ map (\(i,a) -> M i*a) $ assocs arr where
  arr = array (1, k) [ (i, M (div k i) ^ n - sum ext) |
    i <- [k, k-1 .. 1],
    let ext = [arr!(i*m) | m <- [2..div k i] ] ]

main = do
  [n, k] <- map read.words <$> getLine
  print $ solve n k

modulus = 10^9 + 7
newtype Mint = M Int
instance Num Mint where
  (M a) + (M b)
    | a + b < modulus = M $ a + b
    | otherwise = M $ a + b - modulus
  (M a) * (M b) = M $ mod (a * b) modulus
  negate (M 0) = M 0
  negate (M a) = M $ modulus - a
  fromInteger a = M $ mod (fromInteger a) modulus
  abs = id
  signum _ = M 1
instance Show Mint where
  show (M a) = show a

fastSum :: [Mint] -> Mint
fastSum = M . (`mod` modulus) . sum . map (\(M a) -> a)

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

#define ll long long int
#define pb push_back
#define RONALDO ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
#define pii pair<int,int>
#define ff first
#define ss second


//LOVE U MESSI && CR7 !!

//MY STAR MICHAEL PHELPS && USAIN BOLT !!

// the question is not how but when???...#DARK

int main()
{
  RONALDO;
  ll n;
  cin>>n;
  if(n>=30)
    cout<<"Yes";
  else
    cout<<"No";  
}

Measured memory_bytes: 3612
using System.Collections.Generic;
using static System.Console;

class Program {
    static void Main() {
        var n = NextInt();
        var pre = -1;
        var ans = 0;

        for (var i = 0; i < n; i++) {
            var a = NextInt();
            if (a == pre) {
                ans++;
                pre = -1;
            } else {
                pre = a;
            }
        }
        WriteLine(ans);
    }

    static int NextInt() {
        return int.Parse(NextString());
    }

    static string NextString() {
        var result = new List<char>();
        while (true) {
            int next = Read();
            if (next < 0)
                break;
            var nextChar = (char)next;
            if (!char.IsWhiteSpace(nextChar))
                result.Add(nextChar);
            else if (nextChar != '\r')
                break;
        }
        return string.Join("", result);
    }
}

Measured memory_bytes: 13268
#include <iostream>
#include <vector>
using namespace std;
int main(void) {
	int n, k;
	cin >> n >> k;
	vector<int> candles(n);
	for (int i = 0; i < n; ++i) cin >> candles[i];
	int ans = 1e9;
	for (int i = k - 1; i < n; ++i) {
		int left = candles[i - k + 1], right = candles[i];
		int a = abs(right) + abs(left - right);
		int b = abs(left) + abs(right - left);
		ans = min(ans, min(a, b));
	}
	cout << ans << "\n";
	return 0;
}

Measured memory_bytes: 640
def read():
    return int(input())

def reads(sep=None):
    return list(map(int, input().split(sep)))

def main():
    m = 10**9 + 7
    n = read()
    t = reads()
    a = reads()
    if (t != sorted(t)) or (a != sorted(a, reverse=True)) or (max(t) != max(a)):
        print(0)
        return
    if len([1 for ti,ai in zip(t, a) if ti==ai]) == 0:
        print(0)
        return
    
    b = [0] * n
    o = -1
    for i in range(0, n):
        if o != t[i]:
            b[i] = 1
            o = t[i]
            if a[i] < t[i]:
                print(0)
                return
    o = -1
    for i in range(n-1, -1, -1):
        if o != a[i]:
            b[i] = 1
            o = a[i]
            if t[i] < a[i]:
                print(0)
                return
    r = 1
    for i in range(0, n):
        if b[i] == 0:
            r = (r * min(t[i], a[i])) % m
    print(r)

main()


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



int main() {
  ll n, m;
  cin >> n >> m;
  vector<pair<ll, ll>> vec(n);
  rep(i, n) {
    cin >> vec[i].first >> vec[i].second;
  }
  sort(all(vec));
  ll cnt = 0, sum = 0;
  for (int i = 0; i < n; i++) {
    if (cnt + vec[i].second >= m) {
      sum += vec[i].first * (m-cnt);
      cout << sum << endl;
      return 0;
    } else {
      sum += vec[i].first * vec[i].second;
      cnt += vec[i].second;
    }
  }
}

Measured memory_bytes: 1792
#include<bits/stdc++.h>
using namespace std;
const int N=1000005,E=262144;
const int M=998244353;
int n,m,i,j,s,a[N],dp[6005][12005];
long long dfs(int i,int j)
{
	if(i<0)
		return 0;
	if(i==0)
		if(j>=0&&j%3==0)
			return 1;
		else
			return 0;
	if(dp[i][j+6000]!=-1)
		return dp[i][j+6000];
	long long s=dfs(i-1,j+1);
	s+=dfs(i-2,j-1)*(i-1);
	s+=dfs(i-3,j)*(i-1)*(i-2);
	return dp[i][j+6000]=s%m;
}
int main()
{
	scanf("%d %d",&n,&m);
	memset(dp,-1,sizeof(dp));
	cout<<dfs(n*3,0);
}


Measured memory_bytes: 283264
#include <bits/stdc++.h>
using namespace std;
int GCD(int a, int b)
{
   if (a%b == 0)
   {
       return(b);
   }
   else
   {
       return(gcd(b, a%b));
   }
}

int LCM(int a, int b)
{
   return a * b / gcd(a, b);
}



int main() {
   int K,ans=0;
   cin >> K;
  for(int i=1; i<=K; i++){
   for(int j=1; j<=K; j++){
     for(int k=1; k<=K; k++){
       ans += (GCD (k,(GCD(i,j))));
     }
   }
  }
  cout << ans << endl;
}


Measured memory_bytes: 3644
def main():
    mod = 10**9+7
    n, k = map(int, input().split())
    a = list(map(int, input().split()))
    a.sort(key=lambda x: -abs(x))
    kouho = []
    minus = 0
    last_plus = None
    last_minus = None
    if k == 1:
        print(max(a))
        return
    for i in range(k):
        kouho.append(a[i])
        if a[i] >= 0:
            last_plus = a[i]
        if a[i] < 0:
            minus += 1
            last_minus = a[i]
    if minus % 2 == 0:
        ans = 1
        for i in kouho:
            ans = ans*i % mod
        print(ans)
        return
    change_plus = None
    change_minus = None
    if last_plus != None:
        # マイナスを追加する
        for i in range(k, n):
            if a[i] <= 0:
                change_plus = a[i]
                break
    if last_minus != None:
        # マイナスを追加する
        for i in range(k, n):
            if a[i] >= 0:
                change_minus = a[i]
                break

    # print(kouho)
    #print(last_plus, change_plus)
    #print(last_minus, change_minus)

    if change_plus == None and change_minus == None:
        ans = 1
        for i in range(k):
            ans = ans*a[-i-1] % mod
    elif change_plus == None:
        ans = change_minus
        for i in kouho:
            ans = ans*i % mod
        ans = ans*pow(last_minus, mod-2, mod) % mod
    elif change_minus == None:
        ans = change_plus
        for i in kouho:
            ans = ans*i % mod
        ans = ans*pow(last_plus, mod-2, mod) % mod
    else:
        if abs(change_plus*last_minus) < abs(change_minus*last_plus):
            ans = change_minus
            for i in kouho:
                ans = ans*i % mod
            ans = ans*pow(last_minus, mod-2, mod) % mod
        else:
            ans = change_plus
            for i in kouho:
                ans = ans*i % mod
            ans = ans*pow(last_plus, mod-2, mod) % mod
    print(ans)


main()


Measured memory_bytes: 115484
#!/usr/bin/env python3
import sys, math, itertools, collections, bisect
input = lambda: sys.stdin.buffer.readline().rstrip().decode('utf-8')
inf = float('inf') ;mod = 10**9+7
mans = inf ;ans = 0 ;count = 0 ;pro = 1

n,mod = map(int,input().split())
S = list(map(int,input()))
if mod == 2:
  for i in range(n):
    if S[i] % 2 == 0:
      ans += i+1
elif mod == 5:
  for i in range(n):
    if S[i] % 5 == 0:
      ans += i + 1
else:
  tenpow = 1
  for i in range(n-1,-1,-1):
    S[i] = S[i] * tenpow % mod
    tenpow = tenpow * 10 % mod
  acum = [0]*(n+1)
  for i in range(n):
    acum[i+1] = (acum[i]+S[i]) % mod
  C = collections.Counter(acum)
  for key,item in C.items():
    ans += (item-1) * item //2


print(ans)


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

int main() {
    vector<int> num{1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
    int k;
    cin >> k;
    cout << num[k - 1] << endl;
}

Measured memory_bytes: 256
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        int c = sc.nextInt();
        System.out.println(c + " " + a + " " + b);
    }


}

// x * 3 <= 16

Measured memory_bytes: 20948
#define DEBUG 0
#include <bits/stdc++.h>
#define loop(n) for (lint ngtkana_is_a_genius = 0; ngtkana_is_a_genius < lint(n); ngtkana_is_a_genius++)
#define rep(i, begin, end) for (lint i = lint(begin); (i) < lint(end); i++)
#define all(v) v.begin(), v.end()
#define rand(l, r) std::uniform_int_distribution<>(l, r)(mt)
using lint = long long;
auto mt = std::mt19937_64(std::random_device{}());
auto cmn = [](auto&& a, auto b){ if (a > b) {a = b; return true;} return false; };
auto cmx = [](auto&& a, auto b){ if (a < b) {a = b; return true;} return false; };
void debug_impl() { std::cerr << std::endl; }
template <typename Head, typename... Tail>
void debug_impl(Head head, Tail... tail) { std::cerr << " " << head; debug_impl(tail...); }
#if DEBUG
#define debug(...)\
  do {\
    std::cerr << std::boolalpha << "[" << #__VA_ARGS__ << "]:";\
    debug_impl(__VA_ARGS__);\
    std::cerr << std::noboolalpha;\
  } while (false)
#else
#define debug(...) {}
#endif

template < typename Container, typename Value = typename Container::value_type, std::enable_if_t<!std::is_same< Container, std::string >::value, std::nullptr_t> = nullptr>
std::istream& operator>> (std::istream& is, Container& v)
  { for (auto & x : v) { is >> x; } return is; }

template < typename Container, typename Value = typename Container::value_type, std::enable_if_t<!std::is_same< Container, std::string >::value, std::nullptr_t> = nullptr >
std::ostream& operator<< (std::ostream& os, Container const& v) {
 os << "{";
  for (auto it = v.begin(); it != v.end(); it++)
    {os << (it != v.begin() ? "," : "") << *it;}
  return os << "}";
}

template < class Value >
bool bat(Value x, std::size_t pos) { return (x >> pos) & Value{1}; }

int main() {
  std::cin.tie(0); std::cin.sync_with_stdio(false);
  int n, k; std::cin >> n >> k;
  std::vector<lint> a(n); std::cin>>a;
  std::vector<lint> A;
  rep(l,0,n) {
    lint sum = a.at(l);
    rep(r,l+1,n+1) {
      A.emplace_back(sum);
      if (r==n) break;
      sum += a.at(r);
    }
  }
  std::sort(all(A));
  a = std::move(A);
  debug(a);

  auto cal = [&] (auto&& cal, auto&& a, lint p) -> lint {
    if (p==-1) return 0ll;
    debug(a,p);
    int count = 0;
    for (lint x : a) {
      count += bat(x,p);
    }
    lint P = 1ll<<p;
    lint ans = 0;
    if (k <= count) {
      ans += P;
      for (lint & x : a) {
        if (!bat(x,p)) {
          x = 0;
        }
      }
    }
    lint mask = P - 1;
    for (lint & x : a) {
      x &= mask;
    }
    ans += cal(cal, a, p - 1);
    return ans;
  };
  lint ans = cal(cal, a, 61);
  std::cout << ans << std::endl;
  return 0;
}

/*
まずはすべての美しさを前計算です。
最上位 bit が建てられる条件は、それが K 個以上あることです。

立てられるときは、立てましょう。このとき、この bit の立っていないものは使わないので 0 にしましょう。
立てられないときは、あきらめましょう。配列をそのまま転送です。
いずれにしても、この bit はすべておろしておくと良いです。
*/

Measured memory_bytes: 6512
#include <bits/stdc++.h>
#define mp make_pair
#define pb push_back
#define LL long long
#define zeros(x) x^(x-1)&x
#define pint pair<int,int>
#define inf 2e9
using namespace std;

int n,x,res;
map<int,int> M;

int main()
{

    cin>>n;
    for (int i=1;i<=n;i++)
    {
        cin>>x;
        M[x]++;
    }
    for (auto it : M)
    {
        if (it.second>=it.first)
        {
            res += it.second-it.first;
        }
        else
            res += it.second;
    }
    cout<<res;

    return 0;
}


Measured memory_bytes: 4736
// https://atcoder.jp/contests/abc052/tasks/arc067_a
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define REP(i, n) FOR(i, 0, n)
#define REPR(i, n) for (int i = n - 1; i >= 0; i--)
#define FOR(i, s, n) for (int i = (s), i##_len = (n); i < i##_len; ++i)
#define ALL(obj) (obj).begin(), (obj).end()
#define ALLR(obj) (obj).rbegin(), (obj).rend()
const int MOD = 1e9 + 7;

// 素因数分解 (第2引数は参照渡しして戻り値として利用)
void enumpr(int n, unordered_map<int, int> &V) {
    for (int i = 2; i * i <= n; i++) {
        while (n % i == 0) {
            V[i]++;
            n /= i;
        }
    }
    if (n > 1)
        V[n]++;
}

signed main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int N;
    cin >> N;
    unordered_map<int, int> V;
    // 素因数分解を2〜Nまで行う
    for (int i = 2; i <= N; i++) {
        enumpr(i, V);
    }
    int ans = 1;
    for (auto &x : V) {
        // 因数(x.first)が0個〜x.second個までの(x.second + 1)通り
        ans *= (x.second + 1);
        ans %= MOD;
    }
    cout << ans << endl;

    return 0;
}


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

void input(llong& rnNum)
{
  cin >> rnNum;
}

int calcDigits(int nDividend)
{
  int nDgtCnt = 1;

  while (nDividend /= 10)
    nDgtCnt++;

  return nDgtCnt;
}

int isMultiple(llong nNum)
{
  int nDivisor = sqrt(nNum);

  while (nNum % nDivisor)
    nDivisor--;

  int nDividend = nNum / nDivisor;
  return calcDigits(nDividend);  
}

int main()
{
  llong nNum;
  
  input(nNum);
  cout << isMultiple(nNum) << endl;

  return 0;
}

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

using namespace std;

using ll = long long;

template<typename T> using V = std::vector<T>;
using Vi = V<int>;
using VVi = V<V<int>>;
using Vl = V<ll>;
using VVl = V<V<ll>>;
using Vs = V<string>;

template<typename T1, typename T2> using P = std::pair<T1, T2>;
using Pii = P<int, int>;
using Pll = P<ll, ll>;
using Pdd = P<double, double>;

template<typename T1, typename T2> using M = std::map<T1, T2>;
using Mii = M<int, int>;
using Msi = M<string, int>;

#define REP(i,n) for(int i=0;i<(int)(n);++i)
#define REP2(i,s,e) for(int i=(int)(s);i<(int)(e);++i)
#define RREP(i,s,e) for(int i=(int)(s);i>=(int)(e);--i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin(),ie=(c).end();i!=ie;++i)
#define ALL(c) (c).begin(), (c).end()

const double PI = acos(-1);
const ll MOD = 1e9+7;

ll n;
string s;

int main() {
    cin >> n;
    std::cout << n*(n-1)/2 << '\n';

    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<cmath>
#include<tuple>

using namespace std;
int main(int argc, char const *argv[])
{
    int n, d, t;
    cin >> n >> d;
    std::vector<std::vector<int>> v;

    for(int i=0; i<n; ++i) {
        std::vector<int> tmp;
        for(int j=0; j<d; ++j) {
            cin >> t;
            tmp.push_back(t);
        }
        v.push_back(tmp);
    }

    int ret = 0;
    for(int i=0; i<n-1; ++i) {
        for(int j=i+1; j<n; ++j) {
            // check
            double dist = 0;
            for(int k=0; k<d; ++k) {
                dist += pow(v[i][k] - v[j][k], 2);
            }
            //cout << i << ", " << j << ", " << dist << endl;
            double dd = sqrt(dist);
            if (dd - static_cast<int>(dd) == 0) {
                ret+=1;
            }
        }
    }

    cout << ret << endl;
    return 0;
}


Measured memory_bytes: 256
import java.util.Comparator;
import java.util.PriorityQueue;
import java.util.Scanner;

//Descrete Speed
public class Main{

	public static int n;
	public static int m;
	public static int start;
	public static int goal;

	public static double[][][] dist;
	public static int[][] r;
	public static int[][] limit;

	public static double dijkstra(){
		for(int i=0;i<=n;i++){
			for(int j=0;j<=n;j++){
				for(int k=0;k<31;k++)
					dist[i][j][k] = Integer.MAX_VALUE;
			}
		}
		dist[start][0][1] = 0;
		PriorityQueue<int[]> q = new PriorityQueue<int[]>(n, new Comparator<int[]>(){
			public int compare(int[] a, int[] b) {
				return dist[a[0]][a[1]][a[2]]-dist[b[0]][b[1]][b[2]]<0?-1:dist[a[0]][a[1]][a[2]]-dist[b[0]][b[1]][b[2]]>0?1:0;
			}
		});
		for(int i=1;i<=n;i++){
			if(r[start][i]!=0){
				double nc = r[start][i]/1.0;
				dist[i][start][1] = nc;
				q.add(new int[]{i,start,1});
			}
		}
		while(!q.isEmpty()){
			int[] uu = q.poll();
			int u = uu[0];
			int pre = uu[1];
			int v = uu[2];
			if(u==goal&&v==1)return dist[u][pre][v];
			for(int i=1;i<=n;i++){
				if(i!=pre && r[u][i]!=0){
					for(int x=v-1;x<=v+1;x++){
						if(x<=0)continue;
						if(x>limit[u][i])continue;
						double nc = dist[u][pre][v] + r[u][i]*1.0/x;
						if(nc < dist[i][u][x]){
							dist[i][u][x] = nc;
							q.add(new int[]{i, u, x});
						}
					}
				}
			}
		}
		return -1;
	}

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		while(true){
			n = sc.nextInt();
			m = sc.nextInt();
			if(n==0&&m==0)break;
			dist = new double[n+1][n+1][31];
			r = new int[n+1][n+1];
			limit = new int[n+1][n+1];
			start = sc.nextInt();
			goal = sc.nextInt();
			for(int i=0;i<m;i++){
				int u = sc.nextInt();
				int v = sc.nextInt();
				int d = sc.nextInt();
				int l = sc.nextInt();
				r[u][v] = r[v][u] = d;
				limit[u][v] = limit[v][u] = l;
			}
			double ans = dijkstra();
			if(ans==-1)System.out.println("unreachable");
			else System.out.printf("%.5f\n", ans);
		}
	}
}

Measured memory_bytes: 15000
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
typedef pair<P,ll> Pll;
typedef pair<P,P> PP;
#define rep(i,a,n) for(int i = a;i < n;i++)
#define LINF (ll)1e17
#define INF 1e9
#define MOD 1e9+7
#define sMOD 1e5
#define fs first
#define sc second

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


signed main(){
	
	
	ll cnt1 = 0,cnt2 = 0;
	string s;
	
	cin >> s;
	
	rep(i,0,s.size()){
		if(i % 2){
			if(s[i] == '0') cnt1++;
			if(s[i] == '1') cnt2++;
		}
		else{
			if(s[i] == '0') cnt2++;
			if(s[i] == '1') cnt1++;
		}
		
	}
	
	cout << min(cnt1,cnt2) << endl;
	
	return 0;

}

Measured memory_bytes: 512
#include <iostream>
#include <cmath>
#include <vector>
#include <algorithm>
#include <string>
#define vector std::vector
#define string std::string
typedef long long ll;
#define all(v) (v).begin(), (v).end()
#define rep(i, n) for (int i = 0; i < (n); i++)
#define min(a, b) std::min(a, b)
#define max(a, b) std::max(a, b)
#define abs(x) std::abs(x)

template <class T = int>
T in() { T x; std::cin >> x; return x; }
#define output(e) std::cout << e << '\n'

#ifdef LOCAL
#define db std::cout << "L" << __LINE__ <<
#define de << "\n"
#define dv(x) << " " << #x << "->" << x
#else
#define db
#define de
#define dv(x)
#endif

//
// Implementation
//

int main() {
  int A = in();
  int B = in();
  int C = in();
  int D = in();
  if (A*B > C*D) {
    output(A*B);
  } else {
    output(C*D);
  }
}


Measured memory_bytes: 256
import java.io.*;

public class Main{
    public static void main(String[]args) throws NumberFormatException, IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
       
        int n = Integer.parseInt(br.readLine());
        String[] str = br.readLine().split(" ");
        String [] num =new String[n];
        int count=n-1;
        String res="";
        for(int i=0;i<n;i++){
            if(count==0){
                num[i]=(str[count]);
                
                res+=num[i];
            }else{
                num[i]=(str[count]);
                count--;
                res+=num[i]+" ";
            }
        }
        System.out.println(res);
    }

}

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

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

    for (int i = 0; i < S.size(); i++) {
        if (S[i] == ',') {
            S[i] = ' ';
        }
        cout << S[i];
    }
    cout << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <vector>
#include <queue>
#include <string>
#include <cmath>
#include <algorithm>

using namespace std;

#define pb push_back
#define mp make_pair
#define X first
#define Y second

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

const int MOD = 998244353;
const int INF = 2e9;
const int MAX_N = 300000;

ll factorial[MAX_N+1];
ll inverse[MAX_N+1];
 
// 繰り返し２乗法による冪乗(x^n)計算 O(log(n))
int exponentiation(ll x, int n) {
  int res = 1;
  while (0 < n) {
    if (n & 1) {
      res = x * res % MOD;
    }
    x = x * x % MOD;
    n >>= 1;
  }
  return res;
}
 
// 組み合わせ nCr の計算 O(1)
ll combination(int n, int r) {
  if (n-r==0 || r==0) return 1;
  static bool flag = true;
  if (flag) {
    // 階乗と階乗の逆数の初期化 O(n)
    factorial[0] = 1; inverse[0] = 1;
    for (int i=1; i<=MAX_N; i++) {
      factorial[i] = factorial[i-1] * i % MOD;
      inverse[i] = exponentiation(factorial[i], MOD-2);
    }
    flag = false;
  }
  return factorial[n] * inverse[n-r] % MOD * inverse[r] % MOD;
}

int main() {
  ll N, A, B, K, ans = 0;
  vii XYs;
  cin >> N >> A >> B >> K;
  for (int x = 0; x <= N; x++) {
    if (A * x > K) { continue; }
    if ((K - A*x) % B != 0) { continue; }

    ll y = (K - A*x) / B;
    if (y <= N) {
      // cout << x << ", " << y << endl;
      ans += (combination(N, x) % MOD) * (combination(N, y) % MOD);
      ans %= MOD;
    }
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 4992
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

int main() {
    int n,m,c;
    cin >> n >> m >> c;
    vector<int> b(m);
    for (int i=0; i<m; i++) cin >> b[i];

    int ans = 0;
    for (int i=0; i<n; i++) {
        int sum = 0;
        for (int i=0; i<m; i++) {
            int a;
            cin >> a;
            sum += a*b[i];
        }
        if (sum > -c) ans++;
    }

    cout << ans << endl;
}


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

template<class T> inline bool chmin(T& a, T b)
{
	if (a > b){
		a = b;
		return true;
	}
	return false;
}

const long long INF = 1LL << 60;
long long dp[100010];
int n, k;
int h[100010];
int main()
{
	cin >> n >> k;
	for (int i = 0; i < n; i++) cin >> h[i];
	for (auto &x : dp) x = INF;
	dp[0] = 0;
	for (int i = 0; i < n; i++){
		for (int j = 1; j <= k and i+j < n; j++){
			chmin(dp[i+j], dp[i]+abs(h[i]-h[i+j]));
		}
	
	}
	cout << dp[n-1] << endl;
}



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

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

  int N, M; cin >> N >> M;
  string A, B;
  string addA = "";
  string addB = "";

  reps(i, 1, N) {
    cin >> A;
    if( i % 2 == 0 ) reverse(all(A));
    addA += A;
  }

  reps(i, 1, M) {
    cin >> B;
    if( i % 2 == 0 ) reverse(all(B));
    addB += B;
  }

  if( addA.find(addB) + 1 ) cout << "Yes" << endl;
  else cout << "No" << endl;

  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long int LL;
LL red(LL s, LL c, LL b){
	LL ret=(s-c)/b*b;
	ret=max(ret,0ll);
	if ((s-c)%b!=0)ret+=b;
	ret=max(ret,b);
	return ret;
}
LL gcd(LL a, LL b){
	LL ret=1;
	while (ret>0){
		ret=a%b;
		a=b;
		b=ret;
	}
	return a;
}
int main(){
	int tc;
	cin>>tc;
	while (tc--){
		LL a,b,c,d;
		cin>>a>>b>>c>>d;
		if (d<b){
			printf ("No\n");
		}
		else{
			LL rep=gcd(b,d);
			LL init=a-red(a,c,b);
			LL low=c+rep;
			if (low-b<0||init<0)printf ("No\n");
			else printf ("Yes\n");
		}
	}
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;
int main() {
	int n, total;
	total = 100000;
	cin >> n;
	for(int i = 0; i < n; i++) {
		total *= 1.05;
		if(total % 1000 != 0) {
			total = total - total % 1000;
			total += 1000;
		}
	}
	cout << total << endl;

	return 0;
}

Measured memory_bytes: 1156
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>


using namespace std;

int main(){
int N; cin >> N;
  vector<pair<string,pair<int,int>>> vec(N);
  for(int i = 0; i < N; i++){
   cin >> vec[i].first >> vec[i].second.first;
    vec[i].second.first *= -1; vec[i].second.second = i + 1;}
  
  sort(vec.begin(),vec.end());
  
  for(int i = 0; i < N; i++){
    cout << vec[i].second.second << endl;} return 0;}

Measured memory_bytes: 256
import math
A, B = map(int, input().split())

def gcd(A, B):
  if A < B:
    A, B = B, A
  while B > 0:
    temp = A % B
    A = B
    B = temp
  return A

gcd_num = gcd(A, B)

def prime(a):
  max_a = 1 + int(math.sqrt(a))
  d = dict()
  d[1] = 1
  i = 2
  while a != 1:
    if i > max_a:
      d[a] = 1
      break
    if a % i == 0:
      a = a // i
      if i in d:
        d[i] += 1
      else:
        d[i] = 1
    else:
      i += 1
  return d
d = prime(gcd_num) 

print(len(d))

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

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

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
template<class T1, class T2> ostream& operator << (ostream &s, pair<T1,T2> P)
{ return s << '<' << P.first << ", " << P.second << '>'; }
template<class T> ostream& operator << (ostream &s, vector<T> P)
{ for (int i = 0; i < P.size(); ++i) { if (i > 0) { s << " "; } s << P[i]; } return s; }
template<class T> ostream& operator << (ostream &s, vector<vector<T> > P)
{ for (int i = 0; i < P.size(); ++i) { s << endl << P[i]; } return s << endl; }
template<class T> ostream& operator << (ostream &s, set<T> P)
{ EACH(it, P) { s << "<" << *it << "> "; } return s << endl; }
template<class T1, class T2> ostream& operator << (ostream &s, map<T1,T2> P)
{ EACH(it, P) { s << "<" << it->first << "->" << it->second << "> "; } return s << endl; }



string S;

int main() {
    while (cin >> S) {
        for (int i = 0; i < S.size(); ++i) {
            if (S[i] == '/') S[i] = ' ';
        }
        istringstream sin(S);
        int y, m, d;
        sin >> y >> m >> d;

        if (make_pair(y, make_pair(m, d)) <= make_pair(2019, make_pair(4, 30)))
            puts("Heisei");
        else
            puts("TBD");
    }
}


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

ll n;
ll comb[2005][2005] = {};
const ll MOD = 1000000007;

int main() {
    ios::sync_with_stdio(0), cin.tie(0);
    cin >> n;
    if (n < 3) {
        cout << 0 << endl;
        return 0;
    }

    comb[0][0] = 1;
    comb[1][0] = 1;    
    comb[1][1] = 1;
    for (int i = 2; i <= 2000; i++){
        comb[i][0] = 1;
        for (int j = 1; j <= 2000; j++){
            comb[i][j] = (comb[i - 1][j - 1] + comb[i - 1][j]) % MOD;
         }
    }

    ll k = n / 3;
    ll ans = 0;
    for (int i = 1; i <= k; i++) {
        ans = (ans + comb[n - 2 * i - 1][i - 1]) % MOD;
    }
    cout << ans << endl;
}

Measured memory_bytes: 34960
#include <bits/stdc++.h>
#define mp make_pair
#define ff first
#define ss second
 
using namespace std;
using vi=vector<int>;
using pii=pair<int, int>;
using ull=unsigned long long;
using ll=long long;
 
int main()
{
	int n, x; cin >> n >> x;
	vi m(n);
	int sum = 0, ans = -1;
	int mn = 999999;
	for (int i = 0; i < n; i++)
	{
		cin >> m[i];
		if (m[i] < mn)
			mn = m[i];
	}

	for (int i = 0; i < n; i++)
	{
		if ((sum + m[i]) <= x)
		{
			sum += m[i];
			ans++;
		}
	}

	while (sum <= x){
		ans++;
		sum += mn;
	}

	cout << ans << "\n";

}


Measured memory_bytes: 3608
/*
このコード、と～おれ!
Be accepted!
∧＿∧　
（｡･ω･｡)つ━☆・*。
⊂　　 ノ 　　　・゜+.
　しーＪ　　　°。+ *´¨)
 　　　　　　　　　.· ´¸.·*´¨) ¸.·*¨)
		  　　　　　　　　　　(¸.·´ (¸.·'* ☆
					*/

#include <stdio.h>
#include <algorithm>
#include <string>
#include <cmath>
#include <cstring>
#include <vector>
#include <numeric>
#include <iostream>
#include <random>
#include <map>
#include <unordered_map>
#include <queue>

#pragma GCC optimize("Ofast")
#define rep(i, n) for(int i = 0; i < (n); ++i)
#define rep1(i, n) for(int i = 1; i < (n); ++i)
#define rep2(i, n) for(int i = 2; i < (n); ++i)
#define repr(i, n) for(int i = n; i >= 0; --i)
#define reprm(i, n) for(int i = n - 1; i >= 0; --i)
#define printynl(a) printf(a ? "yes\n" : "no\n")
#define printyn(a) printf(a ? "Yes\n" : "No\n")
#define printYN(a) printf(a ? "YES\n" : "NO\n")
#define printin(a) printf(a ? "possible\n" : "inposible\n")
#define printdb(a) printf("%.16f\n", a)//少数出力
#define prints(s) printf("%s\n", s.c_str())//string出力
#define all(x) (x).begin(), (x).end()
#define allsum(a, b, c) ((a + b) * c / 2)//等差数列の和、初項,末項,項数
#define pb push_back
#define priq priority_queue

using ll = long long;

const int INF = 1073741823;
const int MINF = -1073741823;
const ll LINF = ll(4661686018427387903);
const ll MOD = 1000000007;
const double PI = acos(-1);

using namespace std;

#include <iostream>

using namespace std;

void scans(string & str) {
	char c;
	scanf("%c", &c);
	while (c != '\n' && c != -1) {
		str += c;
		scanf("%c", &c);
	}
}

/*-----------------------------------------ここからコード-----------------------------------------*/


int main() {

	int n, m;
	scanf("%d%d", &n, &m);
	map<int, int> a;
	int tmp;
	rep(i, n) {
		scanf("%d", &tmp);
		++a[tmp];
	}
	priq<int, vector<int>, greater<int>> aa;
	for (auto aaa : a) {
		aa.push(aaa.second);
	}
	ll ans = 0;
	int len = a.size() - m;
	rep(i, len) {
		ans += aa.top();
		aa.pop();
	}
	printf("%lld\n", ans);

 	return 0;
}


Measured memory_bytes: 10748
#include <iostream>
#include <vector>
#include<iomanip>
#include <algorithm>
using namespace std;
typedef long long ll;
#define rep(i,n) for(int i=0;i<(n);i++)

int main(int argc, const char * argv[]) {
    string S;
    cin >> S;
    cout << "2018" << S.substr(4) << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <cmath>

using namespace std;

const int MAXN = 200000 + 1000;
const int MAXM = 1048576;
const int MAXK = 20;

#define next __next
#define prev __prev

int n, m, V;
int a[MAXN], v[MAXK];
int f[MAXM], g[MAXM];
int next[MAXN][MAXK], prev[MAXN][MAXK];
int ans[MAXN];

void yes()
{
	cout << "Possible" << endl;
}

void no()
{
	cout << "Impossible" << endl;
}

void init()
{
	for(m = 0; V; V /= 2, m++)
		v[m] = V;
	v[m++] = 0;

	for(int i = 0; i <= m - 1; i++)
		next[n + 1][i] = next[n][i] = n;
	for(int i = n - 1; i >= 1; i--)
		for(int j = 0; j <= m - 1; j++)
			next[i][j] = (a[i + 1] - a[i] <= v[j] ? next[i + 1][j] : i);

	for(int i = 0; i <= m - 1; i++)
		prev[0][i] = prev[1][i] = 1;
	for(int i = 2; i <= n; i++)
		for(int j = 0; j <= m - 1; j++)
			prev[i][j] = (a[i] - a[i - 1] <= v[j] ? prev[i - 1][j] : i);
}

void work()
{
	f[0] = 0;
	for(int i = 1; i < (1 << m); i++)
	{
		f[i] = 0;
		for(int j = 0; j < m; j++)
			if((i >> j) & 1)
				f[i] = max(f[i], next[f[i ^ (1 << j)] + 1][j]);
	}
	g[0] = n + 1;
	for(int i = 1; i < (1 << m); i++)
	{
		g[i] = n + 1;
		for(int j = 0; j < m; j++)
			if((i >> j) & 1)
				g[i] = min(g[i], prev[g[i ^ (1 << j)] - 1][j]);
	}

	for(int i = 0; i < (1 << m); i++)
	{
		int s1 = i, s2 = ((1 << m) - 1) ^ i;
		s1 = s1 & ~1, s2 = s2 & ~1;
		int p = f[s1], q = g[s2];
		if(p + 1 > q - 1)
		{
			for(int j = 1; j <= n; j++)
				yes();
			return ;
		}
		if(next[p + 1][0] >= q - 1)
			ans[p + 1] += 1, ans[q - 1 + 1] -= 1;
	}
	for(int i = 1; i <= n; i++)
		ans[i] += ans[i - 1];
	for(int i = 1; i <= n; i++)
		ans[i] > 0 ? yes() : no();
	// for(int i = 1; i <= n; i++)
	// 	cerr << ans[i] << endl;
}

int main()
{
	ios::sync_with_stdio(false);
	// freopen("1.in", "r", stdin);
	// freopen("1.out", "w", stdout);

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

	init();
	work();

	return 0;
}


Measured memory_bytes: 43520
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<math.h>
#include<algorithm>
#include<queue>
#include<iostream>
#include<set>
#include<map>
using namespace std;
#define mp make_pair
#define ll long long
#define re register
typedef pair<int,int> pii;
#define file(a) freopen(a".in","r",stdin);freopen(a".out","w",stdout)
inline int gi()
{
	int f=1,sum=0;char ch=getchar();
	while(ch>'9'&&ch<'0'){if(ch=='-')f=-1;ch=getchar();}
	while(ch>='0'&&ch<='9'){sum=(sum<<3)+(sum<<1)+ch-'0';ch=getchar();}
	return f*sum;
}
const int N=200010;
int n,a[N],b[N],p[N];
int main()
{
	n=gi();
	for(int i=1;i<=n;i++)a[i]=gi(),b[i]=gi();
	ll lm=0,rm=0;
	for(int i=1;i<=n;i++)p[i]=a[i];
	sort(p+1,p+n+1);
	if(n&1)lm=p[(n+1)/2]*2ll;else lm=p[n/2]+p[n/2+1];
	for(int i=1;i<=n;i++)p[i]=b[i];
	sort(p+1,p+n+1);
	if(n&1)rm=p[(n+1)/2]*2ll;else rm=p[n/2]+p[n/2+1];
	printf("%lld\n",(rm-lm+1)/((n&1)?2:1)+(n&1)*(rm-lm+1&1));
	return 0;
}


Measured memory_bytes: 6108
// include
// ------------------------------------------------
#include <bits/stdc++.h>
#include <vector>
#include <algorithm>
#include <math.h>

using namespace std;

// func
// ------------------------------------------------
int CalcSumOfDigit(int n);      // 各桁の和を計算する。
string upper(string str);       // 英字を大文字に変換する。
string lower(string str);       // 英字を小文字に変換する。

// define
// ------------------------------------------------
#define all(a)        (a).begin(),(a).end()
#define rall(a)       (a).rbegin(),(a).rend()
#define pb            push_back
#define sz(a)         int((a).size())
#define rep(i,n)      for(int(i)=0;(i)<(n);(i)++)
#define repe(i,n)     for(int(i)=0;(i)<=(n);(i)++)
#define vsort(v)      sort((v).begin(),(v).end())
#define rvsort(v)     sort(rall((v)))
#define vi            vector<int>

const int INF = 1e9;

// code
// ------------------------------------------------
int main() {

  char x,y;
  cin >> x >> y;

  if( x < y)cout << '<';
  else if(y < x) cout << '>';
  else cout << '=';

  return 0;
}

// funcの実体
// ------------------------------------------------
int CalcSumOfDigit(int n)
{
  int s = 0;
  while(n)
  {
    s += n % 10;
    n = n / 10;
  }
  return s;
}

string upper(string str)
{
  for(auto itr = str.begin();itr != str.end() ; itr++)
  {
    if(97 <= *itr && *itr <= 122)
    {
      *itr = *itr - 32;
    }
  }
  return str;
}

string lower(string str)
{
  for(auto itr = str.begin();itr != str.end() ; itr++)
  {
    if(65 <= *itr && *itr <= 90)
    {
      *itr = *itr + 32;
    }
  }
  return str;
}


Measured memory_bytes: 256
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}
macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}
macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

#[allow(non_snake_case)]
fn main() {
    input!{
        N: usize,
        SP: [[String;2];N],
    };
    let mut S = vec![];
    let mut P = vec![];
    for i in SP {
        S.push(i[0].clone());
        P.push(i[1].parse::<usize>().unwrap());
    }
    let mut sorted = S.clone();
    sorted.sort();
    sorted.dedup();

    let mut ret: Vec<Vec<usize>> = vec![];
    let idx = 0;
    let l = sorted.len();
    for i in 0..l {
        let ref s = sorted[i];
        let mut tmp = vec![];
        for j in 0..N {
            if &*s != &*S[j] {continue;}
            tmp.push((j+1, i, P[j]));
        }
        tmp.sort_by_key(|&(a,b,c)|c);
        tmp.reverse();
        for r in tmp {
            println!("{}", r.0);
        }
    }
}



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

int main() {
	int n = 5;
	int x[n];
	for (int i = 0; i < n; i++) {
		cin >> x[i];
	}
	int k;
	cin >> k;
	bool b = true;
	for (int i = 0; i < n - 1; i++) {
		for (int j = i + 1; j < n; j++) {
			if (abs(x[i] - x[j]) > k) {
				b = false;
				break;
			}
		}
	}
	cout << (b ? "Yay!" : ":(") << endl;
}



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

#define F first
#define S second
#define PB push_back

using namespace std;

typedef long long LL;
typedef pair<int, int> PII;
typedef priority_queue<int> HEAP;
typedef priority_queue<int, vector<int>, greater<int> > RHEAP;

const int N = 100010, M = 2 * N, mod = 1e9 + 7;

int n, m, max_d;
int h[N], e[M], ne[M], idx;
int fact[N], infact[N];
vector<int> cnt[N];

void add(int a, int b)
{
	e[idx] = b, ne[idx] = h[a], h[a] = idx ++ ;
}

int qp(int a, int b)
{
	int res = 1;
	while (b)
	{
		if (b & 1) res = (LL)res * a % mod;
		a = (LL)a * a % mod;
		b >>= 1;
	}
	return res;
}

void init(int n)
{
	fact[0] = infact[0] = 1;
	for (int i = 1; i <= n; i ++ )
	{
		fact[i] = (LL)fact[i - 1] * i % mod;
		infact[i] = (LL)infact[i - 1] * qp(i, mod - 2) % mod;
	}
}

void dfs(int u, int fa, int depth)
{
	int sum = 0;
	for (int i = h[u]; ~i; i = ne[i])
	{
		int j = e[i];
		if (fa == j) continue;
		
		sum ++ ;
		dfs(j, u, depth + 1);
	}
	cnt[depth + 1].PB(sum);
	max_d = max(max_d, depth);
}

int main()
{
	memset(h, -1, sizeof h);
	
	scanf("%d%d", &n, &m);
	
	init(m);
	for (int i = 0; i < n - 1; i ++ )
	{
		int a, b;
		scanf("%d%d", &a, &b);
		add(a, b), add(b, a);
	}
	
	dfs(1, -1, 1);
	
	int res = m;
	for (int i = 2; i <= max_d; i ++ )
		for (auto u : cnt[i])
			if (i == 2) res = (LL)res * fact[m - 1] % mod * infact[m - 1 - u] % mod;
			else res = (LL)res * fact[m - 2] % mod * infact[m - 2 - u] % mod;
	
	printf("%d\n", res);
	return 0;
}

Measured memory_bytes: 12288
#include <iostream>
#include <vector>
#include <string>
#include <numeric>
#include <iostream>
#include <cmath>
#include <algorithm>
#include <iomanip>
#include <queue>

#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;

int main() {
  int N, K;
  cin >> N >> K;
  vector<long long> v;
  rep(i, N) {
    long long tmp;
    cin >> tmp;
    v.push_back(tmp);
  }
  
  vector<long long> Lv, Rv;
  Lv.push_back(0);
  Rv.push_back(0);
  long long tmpLv=0, tmpRv=0;
  rep(i, N){
    tmpLv += v[i];
    tmpRv += v[N-i-1];
    Lv.push_back(tmpLv);
    Rv.push_back(tmpRv);
  }
  
  long long ans = 0;
  
  rep(b, K) { // 戻すor何もしない 回数
//    cout << "b " << b << endl;
//    cout << "L" << min(K-b, N)+1 << " ";

    rep(l, min(K-b, N)+1) { // 左から取り出す個数
      long long val = 0;
      priority_queue<long long> gomi;
      val = Lv[l] + Rv[min(K-b-l, N-l)];
      //cout << "temp Val " << val << " " ;
      
      rep(i, l) {
        gomi.push( max((int)-v[i],0) );
      }
      rep(i, min(K-b-l, N-l)) {
        gomi.push( max((int)-v[N-i-1],0) );
      }
      // 戻す
      rep(i, min(min(b,N), K-b)) {
        val += gomi.top();
        gomi.pop();
      }
      //cout << "val: " << val << endl;
      
      if(val>ans) {
        ans = val;
      }
    }
  }
  
  cout << ans << endl;
  
  return 0;
}

Measured memory_bytes: 256
import java.util.*;

import java.math.*; 
public class Main {
     Scanner sc = new Scanner(System.in);
	
	
	void run(){ // kokonikaku
		int a[] = new int[5];
		for(int i=0;i<5;i++){
			a[i]=sc.nextInt();
		}
		
		int ans=0;
		for(int i=0;i<5;i++){
			int y=0;
			 y=a[i];
			if(y%10>0)y+=10;
			y=y/10*10;
			ans+=y;
		}
		int sa=0;
		for(int i=0;i<5;i++){
			int y=a[i];
			if(y%10==0) continue;
			sa=Math.max(sa,10-y%10);
		}
		
			System.out.println(ans-sa);
		
		
		
    
	}

	
	public static void main(String[] args) {
		new Main().run();
        
    }
}

Measured memory_bytes: 22868
#include<bits/stdc++.h>
using namespace std;
using LL = long long;
using ULL = unsigned long long;
#define rep(i,n) for(int i=0; i<(n); i++)

int main() {
    int N; cin >> N;
    vector<int> P;
    for (int i = 2; i <= N; i++) {
        bool ok = true;
        for (int p : P) if (i % p == 0) ok = false;
        if (ok)P.push_back(i);
    }

    vector<int> I(P.size());
    rep(i, P.size()) {
        int n = N, p = P[i];
        while (n >= p) { I[i] += n / p; n /= p; }
    }

    int ans = 0;

    rep(i, I.size()) rep(j, I.size()) rep(k, I.size()) {
        if (i == j || j == k || i == k) continue;
        if (I[i] < 4 || I[j] < 4 || I[k] < 2) continue;
        if (i > j) continue;
        ans++;
    }
    rep(i, I.size()) rep(j, I.size()){
        if (i == j) continue;
        if (I[i] < 14 || I[j] < 4) continue;
        ans++;
    }
    rep(i, I.size()) rep(j, I.size()) {
        if (i == j) continue;
        if (I[i] < 24 || I[j] < 2) continue;
        ans++;
    }
    rep(i, I.size()) {
        if (I[i] < 74) continue;
        ans++;
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 3596