akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
const int INF = 1000000000;
#define REP(i,s,n) for(int i=(int)(s);i<(int)(n);++i)
#define rep(i,n) REP(i, 0, n)

int w[101][101];
int N, M, ans;
vector<int> use;
void dfs(int depth) {
    if(depth == N) {
        if(use.size() < 2) return;
        int sum = 0;
        for(int k : use) {
            int mi = INF;
            for(int l : use) if(k != l)
              mi = min(mi, w[k][l]);
            sum += mi;
        }
        ans = max(ans, sum);
        return;
    }
    bool ok = true;
    for(int k : use) if(!w[k][depth]) ok = false;
    dfs(depth + 1);
    if(ok) {
        use.push_back(depth);
        dfs(depth + 1);
        use.pop_back();
    }
    return;
}
int main() {
    scanf("%d%d", &N, &M);
    int u_, v_, w_;
    memset(w, 0, sizeof(w));
    rep(i, M) {
        scanf("%d%d%d", &u_, &v_, &w_);
        --u_; --v_;
        w[u_][v_] = w[v_][u_] = w_;
    }
    ans = 0; 
    dfs(0);
    printf("%d\n", ans);
    return 0;
}

Measured memory_bytes: 3292
import scala.io.StdIn._

object Main extends App {
  private val MAX = 1_000_000

  val n = readInt
  val a = readLine.split(" ").map(_.toInt)
  val v = Array.fill(MAX + 10)(0)

  for (i <- 0 until n) {
    if (v(a(i)) > 0) {
      v(a(i)) = 2
    } else {
      (a(i) to MAX by a(i)).foreach(multiple => v(multiple) += 1)
    }
  }

  val ans = a.count { Ai => v(Ai) == 1 }
  println(ans)
}



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

vector<vector<int>> s;
vector<int> c, t;
vector<pair<int, int>> last;
vector<int64_t> b_score;
vector<vector<int64_t>> c_score;

int64_t calc_score() {
    b_score.assign(t.size(), 0);
    c_score.assign(t.size(), vector<int64_t>(26, 0));
    last.assign(26, {0, 0});
    for (auto i = 0; i < (int)t.size(); i++) {
        if(i != 0) {
            b_score[i] = b_score[i - 1];
            c_score[i] = c_score[i - 1];
        }
        b_score[i] += s[i][t[i]];
        last[t[i]] = {i + 1, last[t[i]].first};
        for (auto j = 0; j < 26; j++) {
            c_score[i][j] -= c[j] * (i + 1 - last[j].first);
        }
    }
    return accumulate(c_score[(int)t.size() - 1].begin(), c_score[(int)t.size() - 1].end(), b_score.back());
}

int64_t calc_score(pair<int, int> q) {
    last.assign(26, {0, 0});
    for (auto i = 0; i < (int)t.size(); i++) {
        if(i != 0) {
            b_score[i] = b_score[i - 1];
            c_score[i][q.first] = c_score[i - 1][q.first];
            c_score[i][q.second] = c_score[i - 1][q.second];
        } else {
            b_score[i] = 0;
            c_score[i][q.first] = 0;
            c_score[i][q.second] = 0;
        }
        last[t[i]] = {i + 1, last[t[i]].first};
        b_score[i] += s[i][t[i]];
        c_score[i][q.first] -= c[q.first] * (i + 1 - last[q.first].first);
        c_score[i][q.second] -= c[q.second] * (i + 1 - last[q.second].first);
    }
    return accumulate(c_score[(int)t.size() - 1].begin(), c_score[(int)t.size() - 1].end(), b_score.back());
}

int main(){
    int d; cin >> d;
    c.resize(26);
    for (auto i = 0; i < 26; i++) cin >> c[i];
    s.assign(d, vector<int>(26));
    for (auto i = 0; i < d; i++) {
        for (auto j = 0; j < 26; j++) cin >> s[i][j];
    }

    int64_t ans = 0;
    int index = 0;
    for (auto i = 0; i < d; i++) {
        t.resize(i + 1);
        for (auto j = 0; j < 26; j++) {
            t[i] = j;
            auto tmp = calc_score();
            if(tmp > ans) {
                ans = tmp; index = j;
            }
        }
        t[i] = index;
    }

    auto now = chrono::system_clock::now();
    auto end = chrono::system_clock::now() + chrono::milliseconds(1850);
    random_device seed;
    default_random_engine engine(seed());
    uniform_int_distribution<> day_dist(0, d - 1);
    uniform_int_distribution<> contest_dist(0, 25);
    int64_t score = calc_score();
    while(now < end) {
        int day = day_dist(engine);
        int contest = contest_dist(engine);
        int prev = t[day];
        t[day] = contest;
        auto tmp = calc_score(make_pair(prev, contest));
        if(score < tmp) score = tmp;
        else {
            t[day] = prev;
            calc_score(make_pair(contest, prev));
        }
        now = chrono::system_clock::now();
    }

    for (auto & elm : t) cout << elm + 1 << endl;
    return 0;
}

Measured memory_bytes: 3928
#include <iostream>
#include <vector>
#include <string>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <iomanip>
#include <assert.h>
#include <numeric>
#include <time.h>
#include <map>
#include <unordered_map>
#include <stack>
#include <queue>

using namespace std;
typedef long long ll;

#define rep(i, n) for (int i = 0; i < n; i++)
#define all(c) (c).begin(), (c).end()
#define P pair<int, int>
#define chmin(x, y) x = min(x, y)

int main()
{
  int n;
  cin >> n;
  int ans = 0;
  for (int a = 1; a < n; a++)
  {
    ans += (n - 1) / a;
  }
  cout << ans << endl;
}


Measured memory_bytes: 3628
import sys, os, math, bisect, itertools, collections, heapq, queue, copy, array

# from scipy.sparse.csgraph import csgraph_from_dense, floyd_warshall
# from decimal import Decimal
# from collections import defaultdict, deque

sys.setrecursionlimit(10000000)

ii = lambda: int(sys.stdin.buffer.readline().rstrip())
il = lambda: list(map(int, sys.stdin.buffer.readline().split()))
fl = lambda: list(map(float, sys.stdin.buffer.readline().split()))
iln = lambda n: [int(sys.stdin.buffer.readline().rstrip()) for _ in range(n)]

iss = lambda: sys.stdin.buffer.readline().decode().rstrip()
sl = lambda: list(map(str, sys.stdin.buffer.readline().decode().split()))
isn = lambda n: [sys.stdin.buffer.readline().decode().rstrip() for _ in range(n)]

lcm = lambda x, y: (x * y) // math.gcd(x, y)

MOD = 10 ** 9 + 7
INF = float('inf')


def main():
    if os.getenv("LOCAL"):
        sys.stdin = open("input.txt", "r")

    H, W = il()
    Ch, Cw = il()
    Dh, Dw = il()
    grid = [iss() for _ in range(H)]
    visited = [[INF] * W for _ in range(H)]
    move = [[-1, 0], [1, 0], [0, -1], [0, 1]]
    que = collections.deque()

    que.appendleft((Ch - 1, Cw - 1, 0))
    visited[Ch - 1][Cw - 1] = 0
    while que:
        h, w, c = que.popleft()
        for mh, mw in move:  # 移動A: 歩いて移動
            ch, cw = h + mh, w + mw
            if 0 <= ch < H and 0 <= cw < W and grid[ch][cw] != '#' and visited[ch][cw] > c:
                visited[ch][cw] = c
                que.appendleft((ch, cw, c))
        for wh in range(-2, 3):  # 移動B: ワープ魔法
            for ww in range(-2, 3):
                ch, cw = h + wh, w + ww
                if 0 <= ch < H and 0 <= cw < W and grid[ch][cw] != '#' and visited[ch][cw] > c + 1:
                    visited[ch][cw] = c + 1
                    que.append((ch, cw, c + 1))

    ret = visited[Dh - 1][Dw - 1]
    print(-1 if ret == INF else ret)


if __name__ == '__main__':
    main()


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

   typedef long long ll;
   typedef pair<ll, ll> Pii;
   typedef vector<ll> Vi;
   typedef vector<Vi> VVi;

   const double EPS = (1e-7);
   const ll INF =(1e13);
   const double PI = (acos(-1));
   const ll MOD = ll(1e9) + 7;

   #define REP(i, n) for(ll i = 0; i < (ll)(n); i++)
   #define REPR(i, n) for(ll i = n; i > -1; i--)
   #define FOR(i, a, b) for (ll i = (ll)(a); i < (ll)(b); i++)
   #define ALL(x) (x).begin(),(x).end()
   #define SORT(x) sort((x).begin(), (x).end())
   #define RSORT(x) sort((x).rbegin(), (x).rend())
   #define REVERSE(x) reverse((x).begin(), (x).end())
   #define SZ(x) ((ll)(x).size())
   #define pb push_back
   #define mp make_pair

   //chmax(a, b): a>bならaをbで更新　更新したときにtrueを返す
   //chmin(a, b): a<bならaをbで更新　更新したときにtrueを返す
   template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
   template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

   #define dump(x) cerr<< #x << "= " << (x) << endl;

   ll gcd(ll a, ll b){return b?gcd(b,a%b):a;}
   ll pow(ll a, ll b){if (b == 0) return 1; else if (b % 2 == 0) return pow(a * a, b / 2); else return pow(a * a, b / 2) * a;}
   ll pow(ll a, ll b, ll m){if (b == 0) return 1; else if (a == 0) return 0; else if (b % 2 == 0) return (pow((a * a) % m, b / 2, m) % m); else return (pow((a * a) % m, b / 2, m) * a) % m;}
   ll residue(ll a, ll m){return ((a % m) + m) % m;};

   ll dx[4]={1,0,-1,0};
   ll dy[4]={0,1,0,-1};

vector<string> a = {"dream", "dreamer", "erase", "eraser"};

bool hantei(string s){
   if(s == "") return true;
   for(auto& e : a){
      if(s.size() >= e.size() && 
         s.substr(s.size() - e.size(), e.size()) == e) {
            return hantei(s.substr(0, s.size() - e.size()));
      }
   }
   return false;
}

const ll MAX_len = 1e5;
bool dp[MAX_len + 1] = {};

int main(){
   string S; cin >> S;
   dp[0] = true;
   REP(i, S.size() + 1){
      for(auto &e : a){
         if(i >= e.size()
         && S.substr(i - e.size(), e.size()) == e){
            dp[i] += dp[i - e.size()];
         }
      }
   }
   (dp[S.size()]) ? cout << "YES" << endl : cout << "NO" << endl;
}


Measured memory_bytes: 512
#include<cstdio>
#include<algorithm>
using namespace std;
int n,l,r,ls,rs;
int Query(int ans){
    char ret[20];
    printf("%d\n", ans);
	fflush(stdout);
    scanf("%s", ret);
    if(ret[0] == 'V') exit(0);
    return ret[0] == 'M' ? 1 : 0;
}
int main()
{
	scanf("%d",&n);
	l=0;
	r=n-1;
	ls=Query(l);
	rs=Query(r);
	while(1)
	{
		int mid=(l+r)/2;
		int mids=Query(mid);
		if((mid+mids-ls-l)%2)
		{
			rs=mids;
			r=mid;
		}
		else
		{
			ls=mids;
			l=mid;
		}
	}
}

Measured memory_bytes: 760
N = int(input())
L = [1]
for i in range(N):
	if 6**(i+1) <=N:
		L.append(6**(i+1))
	if 9**(i+1) <= N:
		L.append(9**(i+1))
	if 6**(i+1) >N:
		break
L.sort(reverse =True)
dp = []
dp = [float("inf")]*(N+1)

dp[0] = 0

for i in range(N+1):
	for l in L:
		if i+l <= N:
			dp[i+l] = min(dp[i+l], dp[i]+1)

print(dp[N])


Measured memory_bytes: 46032
/*
 ____________________________________________________________
|                                                            |
|                   Author: ay2306                           |
|____________________________________________________________|

*/
#include <bits/stdc++.h>
//For ordered_set
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define MOD 1000000007
#define test int t; cin>>t; while(t--)
#define init(arr,val) memset(arr,val,sizeof(arr))
#define loop(i,a,b) for(int i=a;i<b;i++)
#define loopr(i,a,b) for(int i=a;i>=b;i--)
#define loops(i,a,b,step) for(int i=a;i<b;i+=step)
#define looprs(i,a,b,step) for(int i=a;i>=b;i-=step)
#define ull unsigned long long int
#define ll long long int
#define P pair
#define PLL pair<long long, long long>
#define PII pair<int, int>
#define PUU pair<unsigned long long int, unsigned long long int>
#define L list
#define V vector
#define D deque
#define ST set
#define MS multiset
#define M map
#define UM unordered_map
#define mp make_pair
#define pb push_back
#define pf push_front
#define MM multimap
#define F first
#define S second
#define IT iterator
#define RIT reverse_iterator
#define FAST ios_base::sync_with_stdio(false);cin.tie();cout.tie();
#define FILE_READ_IN freopen("input.txt","r",stdin);
#define FILE_READ_OUT freopen("output.txt","w",stdout);
#define all(a) a.begin(),a.end()
#define ord_set tree<ll,null_type,less<ll>,rb_tree_tag,tree_order_statistics_node_update>
using namespace std;
// For ordered_set
using namespace __gnu_pbds;
const ll maxn = 1e5;
V<V<int>> adj;
V<bool> vis;

void dfs(int s = 0, int p = -1){
    vis[s] = true;
    for(auto i: adj[s]){
        if(vis[i])continue;
        dfs(i,s);
    }
}

int main(){
    int n,m;
    cin >> n >> m;
    adj = V<V<int>>(n,V<int>());
    vis = V<bool> (n,false);
    loop(i,0,m){
        ll a,b,c;
        cin >> a >> b >> c;
        adj[a-1].pb(b-1);
        adj[b-1].pb(a-1);
    }
    int ans = 0;
    for(int i = 0; i < n; ++i){
        if(!vis[i]){
            ans++;
            dfs(i,-1);
        }
    }
    cout << ans;
    return 0;
}

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

int main(){
    string s;cin >> s;
    bool flag=false;
    if(s=="hi") flag=true;
    if(s=="hihi") flag=true;
    if(s=="hihihi") flag=true;
    if(s=="hihihihi") flag=true;
    if(s=="hihihihihi") flag=true;
    if(flag) cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<cmath>
using namespace std;
int main() {
  int n,a[10010],ans=0;
  cin >> n;
  for(int i=0; i<n; i++) {
    cin >> a[i];
    while(a[i]%2==0) {
      a[i]/=2;
      ans++;
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
import fractions
def lcm(x, y):
    return (x * y) // fractions.gcd(x, y)

a,b,c,d = map(int, input().split())
cd = lcm(c,d)
a -= 1
a_cnt = a - (a//c + a//d - a//cd)
b_cnt = b - (b//c + b//d - b//cd)
print(b_cnt - a_cnt)

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

#if debug
#include "printer.hpp"
#define dump(a) cerr << #a << "(" << __LINE__ << ") = " << a << endl;
#else
#define dump(...)
#endif

#define rep(i, a, b) for (int i = (a); i < (b); i++)
#define repr(i, a, b) for (int i = (b)-1; i >= a; i--)
#define all(x) (x).begin(), (x).end()

using namespace std;
typedef long long ll;
typedef vector<ll> vi;
typedef vector<vi> vvi;
typedef pair<ll, ll> pii;
const ll mod = 1000000007;

ll pow(ll x, ll y) {
  ll ret = 1, tmp = x;
  while (y) {
    if (y % 2) ret = ret * tmp % mod;
    tmp = tmp * tmp % mod;
    y /= 2;
  }
  return ret;
}

ll inverse(ll x) { return pow(x, mod - 2); }

int main() {
  string s, t;
  cin >> s >> t;
  cout << t + s << endl;
}


Measured memory_bytes: 256
/**
 * This line was copied from template
 * This is asol.cpp
 * 
 * @author: Nikolay Kalinin
 * @date: Sat, 23 Mar 2019 16:25:33 +0300
 */
#include <bits/stdc++.h>

using namespace std;

#ifdef LOCAL
    #define eprintf(...) fprintf(stderr, __VA_ARGS__)
#else
    #define eprintf(...) 42
#endif

using ll = long long;
using ld = long double;
using D = double;
using uint = unsigned int;
template<typename T>
using pair2 = pair<T, T>;
using pii = pair<int, int>;
using pli = pair<ll, int>;
using pll = pair<ll, ll>;

#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second

const int maxn = 105;

int a[maxn];

vector<int> ans;
int n;

int main()
{
    scanf("%d", &n);
    for (int i = 0; i < n; i++) scanf("%d", &a[i]);
    for (int IT = n - 1; IT >= 0; IT--)
    {
        bool found = false;
        for (int p = IT; p >= 0; p--) if (a[p] == p + 1)
        {
            ans.pb(a[p]);
            for (int t = p + 1; t <= IT; t++) a[t - 1] = a[t];
            found = true;
            break;
        }
        if (!found)
        {
            cout << -1 << endl;
            return 0;
        }
    }
    reverse(all(ans));
    for (auto t : ans) cout << t << "\n";
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <string>

using namespace std;

int main()
{ 
    int n, a, b;
    cin >> n >> a >> b;

    bool f[102] = {};
    f[0] = true; f[a] = true; f[b] = true; f[n + 1] = true;

    while (1) {
        if (!f[a + 1]) {
            f[a] = false;
            a++;
            f[a] = true;
        }
        else if (!f[a - 1]) {
            f[a] = false;
            a--;
            f[a] = true;
        }
        else {
            return cout << "Borys" << endl, 0;
        }

        if (!f[b - 1]) {
            f[b] = false;
            b--;
            f[b] = true;
        }
        else if (!f[b + 1]) {
            f[b] = false;
            b++;
            f[b] = true;
        }
        else {
            return cout << "Alice" << endl, 0;
        }
    }
    cout << "Draw" << endl;

    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
//long longをllと省略
#define ll long long
//ユークリッドの互除法
ll gcd(ll a, ll b){
  ll t = a%b;
  while(t > 0){
    a = b;
    b = t;
    t  = a%b;
  }
  return b;
}
    
int main(){
  ll A,B;
  cin >> A >>B;
  //ansは素因数分解で出た数字の数＋1
  int ans=1;
  ll N =gcd(A,B);
  //素因数分解を実施(i*iは、素因数は√N以下であるといういう性質から)
  for(ll i = 2;i*i <= N;i++){
    if(N%i==0){
      ans++;
      while(N%i==0){
        N/=i;
      }
    }
  }
  if(N>1)ans++;
  cout << ans << endl;
  
  
  
}

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

#define lp(i,a,b) for(int i=a;i<b;i++)
#define pii pair<int,int>
#define ll long long
#define ff first
#define ss second
#define pb push_back
#define mk make_pair

const int inf = 0x3f3f3f3f ;
const int MAXN = 18 ;

using namespace std ;

bool isOn(int m , int bit) { return ( (m&(1<<bit)) != 0 ); }

int n ;
ll dp[(1<<MAXN)] , mat[MAXN][MAXN] , s[ (1<<MAXN) ] ;

int main()
{
	scanf("%d", &n) ;
	lp(i,0,n)
		lp(j,0,n) 
			scanf("%lld", &mat[i][j]) ;
	lp(m,1,(1<<n))
		lp(i,0,n)
			lp(j,i+1,n)
				if( isOn(m,i) && isOn(m,j) )
					s[m] += mat[i][j] ;
	
	lp(m,1,(1<<n))
		for(int sub = m ; sub > 0 ; sub= ((sub-1)&m) )
			dp[m] = max(dp[ ( m&(~sub) ) ] + s[sub] , dp[m]) ;
	printf("%lld\n" , dp[(1<<n)-1]) ;
}


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

int nlist[110];

int main(){
  int N;
  cin>>N;
  for(int i=0;i<2*N;i++) cin>>nlist[i];
  sort(nlist,nlist+2*N);
  int ans = 0;
  for(int i=0;i<2*N;i+=2){
    ans += min(nlist[i],nlist[i+1]);
  }
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define INF 2e9
#define MOD 1000000007
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
  
int main()
{
  int A, B, C;
  cin >> A >> B >> C;

  int a = A%2;
  int b = B%2;
  int c = C%2;
  if(a==b&&b==c){
    int MAX = max(max(A,B),C);
    cout << (MAX-A+MAX-B+MAX-C)/2 << endl;
  }else if(a==b){
    int MAX = max(max(A+1,B+1),C);
    cout << (MAX-A-1+MAX-B-1+MAX-C)/2+1 <<endl;
  }else if(c==b){
    int MAX = max(max(A,B+1),C+1);
    cout << (MAX-A+MAX-B-1+MAX-C-1)/2+1<< endl;
  }else if(a==c){
    int MAX = max(max(A+1,B),C+1);
    cout << (MAX-A-1+MAX-B+MAX-C-1)/2+1 << endl;
  }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define F first
#define S second
#define REP(i, a, b, c) for (int i = a; i <= b; i += c)
#define pb push_back
#define int long long int
#define MOD 1000000007
using namespace std;


int32_t main()
{
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int t = 1;
  //cin >> t;
  for (int tt = 1; tt <= t; tt++)
  {
    int n;
    cin >> n;
    int a[n][2];
    int dp[n] = {0};
    for(int i = 0; i < n; i++)
      cin >> a[i][0] >> a[i][1];
    for(int i = 0; i < n; i++){
        if(i > 0 and a[i][0] == a[i][1])
          dp[i] = dp[i-1] + 1;
        else if(i == 0 and a[i][0] == a[i][1])
          dp[i] = 1;
    }
    if(*max_element(dp, dp+n) >= 3)
       cout <<"Yes\n";
    else
      cout << "No\n";
 }
}


Measured memory_bytes: 3612
using System;
using System.Collections.Generic;
using System.Linq;
using System.Diagnostics;

class Program
{
    static void Main(string[] args)
    {
        var sc = new Scanner();
        int n = sc.nextInt();

        var list = new List<Restaurant>();
        for (int i = 0; i < n; i++)
        {
            list.Add(new Restaurant(i + 1, sc.next(), sc.nextInt()));
        }

        list.Sort(Compare);

        for (int i = 0; i < n; i++)
        {
            Console.WriteLine(list[i].i);
        }
    }

    static int Compare(Restaurant x, Restaurant y)
    {
        if (x.s != y.s)
        {
            return x.s.CompareTo(y.s);
        }
        else
        {
            return y.p - x.p;
        }
    }
}

class Restaurant
{
    public string s;
    public int i, p;
    public Restaurant(int i, string s, int p) { this.i = i; this.s = s; this.p = p; }
}


// chokudai's Scanner
class Scanner
{
    string[] s;
    int i;

    char[] cs = new char[] { ' ' };

    public Scanner()
    {
        s = new string[0];
        i = 0;
    }

    public string next()
    {
        if (i < s.Length) return s[i++];
        string st = Console.ReadLine();
        while (st == "") st = Console.ReadLine();
        s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
        if (s.Length == 0) return next();
        i = 0;
        return s[i++];
    }

    public int nextInt()
    {
        return int.Parse(next());
    }

    public int[] ArrayInt(int N, int add = 0)
    {
        int[] Array = new int[N];
        for (int i = 0; i < N; i++)
        {
            Array[i] = nextInt() + add;
        }
        return Array;
    }

    public long nextLong()
    {
        return long.Parse(next());
    }

    public long[] ArrayLong(int N, long add = 0)
    {
        long[] Array = new long[N];
        for (int i = 0; i < N; i++)
        {
            Array[i] = nextLong() + add;
        }
        return Array;
    }

    public double nextDouble()
    {
        return double.Parse(next());
    }

    public double[] ArrayDouble(int N, double add = 0)
    {
        double[] Array = new double[N];
        for (int i = 0; i < N; i++)
        {
            Array[i] = nextDouble() + add;
        }
        return Array;
    }
}


Measured memory_bytes: 11360
import sys
from collections import deque
import copy
def main():
    N = int(input())
    MAX = 10 ** 15
    A = [int(i) for i in input().split()]
    dict_num = {}
    num_sum = 0
    for i in range(N):
        if dict_num.get(A[i]) is None:
            dict_num[A[i]] = 1
        else:
            dict_num[A[i]] += 1
        num_sum += A[i]
    Q = int(input())
    for i in range(Q):
        b, c = map(int, input().split())
        if dict_num.get(b) is None:
            print(num_sum)
        elif dict_num[b] == 0:
            print(num_sum)
        else:
            num_sum += (c - b) * dict_num[b]
            print(num_sum)
            if dict_num.get(c) is None:
                dict_num[c] = dict_num[b]
            else:
                dict_num[c] += dict_num[b]
            dict_num[b] = 0



if __name__ == '__main__':
    main()


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


public class A
{
	public static void Main()
	{
		string S = GetString();
		int[] tmp = new int[S.Length];
		for(int i = 0; i < S.Length; i++)
			tmp[i] = (int)(S[i] - 'a');

		if(S.Length < 26)
		{
			int flag = 0;
			for(int i = 0; i < S.Length; i++)
				flag |= (1 << (int)(S[i] - 'a'));

			Console.WriteLine(S + firstChar(flag).ToString());
			return;
		}
		else
		{
			int iPivot = S.Length - 2;
			for(; iPivot >= 0; iPivot--)
			{
				if(tmp[iPivot] <= tmp[iPivot + 1])
					break;
			}
			if(iPivot < 0)
			{
				Console.WriteLine(-1);
				return;
			}

			int pivot = tmp[iPivot];
			int replace = int.MaxValue;
			for(int i = iPivot + 1; i < S.Length; i++)
			{
				if(tmp[i] < pivot)
					continue;
				replace = Math.Min(replace, tmp[i]);
			}

			Console.WriteLine(S.Substring(0, iPivot) + 
				((char)(replace + 'a')).ToString());
		}
	}

	private static char firstChar(int flag)
	{
		for(int i = 0; i < 26; i++)
		{
			if(((flag >> i) & 1) == 1)
				continue;

			return (char)('a' + i);				
		}
		return '\0';
	}
}


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

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

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

Measured memory_bytes: 13140
import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;
import java.util.TreeMap;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int M = sc.nextInt();
        Map<Long, Integer> map = new TreeMap<>();
        for(int i = 0; i < N; i++) {
            long A = sc.nextLong();
            int B = sc.nextInt();
            if(map.containsKey(A)) {
                map.put(A, map.get(A)+B);
            } else {
                map.put(A,B);
            }
        }
        long res = 0;
        for(Map.Entry<Long, Integer> e : map.entrySet()) {
            if(e.getValue() <= M) {
                res += e.getKey()*e.getValue();
                M -= e.getValue();
            } else {
                res += M * e.getKey();
                break;
            }
        }
        System.out.println(res);

    }
}


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

int main() {
  string s;
  long k;
  cin >> s >> k;
  long ans = 0;
  long size = s.size();
  bool honma = 0;
  
  for (int i=0; i<s.size()-1; i++){
    if (s.at(i) != s.at(i+1)){
      honma = 1;
      break;
    }
  }
  
  if (honma){
  // 文字列の最初と最後が繋がってないやつ
  if (s.at(0) != s.at(size-1)){
    long check = 0; // チェックするのが文字列sのどこか
    
    while(check < size-1){ // 最後までチェックしたら終了
      long same = 1;
      for (long i=check+1; i<size; i++){
        if (s.at(check) == s.at(i)){
          check++; same++;
        }
        else{
          check++; break;
        }
      }
      ans += same/2;
    }
    cout << ans * k <<endl;
  }
  
  /*
  // 文字列の最初から最後まで全部繋がってるやつ
  bool flagsuru=1;
  bool flagsimasu=1;
  while(flagsuru){
    for (int i=0; i<size-1; i++){
      if (s.at(i) != s.at(i+1)){
        flagsuru = 0;
        flagsimasu = 0;
        break;
      }
    }
  }
  
  if (flagsimasu) {
    int answer = size * k / 2;
    cout <<answer <<endl;
  }
  */
  
  // 文字列の最初と最後が繋がってるやつ
  else if (s.at(0) == s.at(size-1)){
    long check = 0; // チェックするのが文字列sのどこか
    long check2 = 0;
    long check3 = size-1;
    long same2 = 1;
    long same3 = 1;
    long same999 = 0;
    
    for (long i=1; i<size; i++){
      if (s.at(check2) == s.at(i)){
        check2++; same2++;
      }
      else{
        check2++; break;
      }
    }
    for (long i=size-2; i>=check2; i--){
      if (s.at(check3) == s.at(i)){
        check3--; same3++;
      }
      else{
        check3--; break;
      }
    }
    if (same2+same3>s.size()) same2--;
    same999 = same2 + same3;
    // same2, same3：各々最初, 最後がどれだけ同じか
    // same999：最初と最後がどれだけ繋がってるか
    /* 00000000000000000000000000
                                ^
                              check2, check3
       0000000000000000012000000000000000000000
                        ^^
                   check2check3
       0000000000000000001000000000000000000000
                         ^
                   check2, check3
       
    */
    
    check = check2; // 最初チェックした分は飛ばす
    while(check < check3){ // チェックした所までチェックしたら終了
      long same = 1;
      for (long i=check+1; i<check3+1; i++){
        if (s.at(check) == s.at(i)){
          check++; same++;
        }
        else{
          check++; break;
        }
      }
      ans += same/2;
    }
    /* ここまでで確認したこと
        1.文字列の最初, 最後がどれだけ繋がっているか
        2.文字列の中間のans
       やるべきこと
        1.最初、最後、最初＋最後を各々2で割り、各々1, 1, k-1を
          かけて答えに足す
        2.中間のansにkをかけて答えに足す
    */
    
    long ans1 = same2 / 2 + same3 / 2 + same999 / 2 * (k-1);
    long ans2 = ans * k;
    long real_ans = ans1 + ans2;
    
    //cout << same2 / 2 <<" " << same3 / 2 <<" " <<same999 <<endl;
    //cout << ans1 <<endl;
    //cout << ans <<endl;
    cout << real_ans <<endl;
    /*cout << same2 <<" " <<same3 <<" " <<same999 <<endl;
    cout <<check2 <<" " <<check3 <<endl;
    cout << ans1 <<" " <<ans2 <<endl;
    */
  }
  }
  else{
    cout << s.size() * k / 2 <<endl;
  }
}


Measured memory_bytes: 256
/*
* @Author: wxyww
* @Date: 2020-03-27 15:45:46
* @Last Modified time: 2020-03-27 16:41:26
*/
#include<cstdio>
#include<iostream>
#include<cstdlib>
#include<cmath>
#include<ctime>
#include<bitset>
#include<cstring>
#include<algorithm>
#include<string>
#include<queue>
#include<vector>
using namespace std;
typedef long long ll;

ll read() {
	ll x=0,f=1;char c=getchar();
	while(c<'0'||c>'9') {
		if(c=='-') f=-1;
		c=getchar();
	}
	while(c>='0'&&c<='9') {
		x=x*10+c-'0';
		c=getchar();
	}
	return x*f;
}

int main() {
	int n = read(),m = 1;
	while(m - 1 <= n) m <<= 1;
	m = (m >> 1) - 1;
	if(n == m + 1 || n == 1) {
		puts("No");return 0;
	}
	puts("Yes");
	for(int i = 1;i < m;++i) printf("%d %d\n%d %d\n",i,i + 1,n + i,n + i + 1);
	printf("%d %d\n",m,n + 1);
	if(n != m) printf("1 %d\n%d %d\n",m + n + 1,m + 1,m + n + 2);

	for(int i = m + 2;i <= n;++i) printf("%d %d\n%d %d\n",i + n - 1,i ,i - m - 1,i + n);

	return 0;
}

Measured memory_bytes: 2688
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
using P = pair<ll,ll>;
const ll mod = 1e9+7;
#define ALL(x) (x).begin(),(x).end()
#define REP(i,n) for(ll (i)=0;(i)<(n);(i)++)
#define REPS(i,n) for(ll (i)=1;(i)<=(n);(i)++)
#define RREP(i,n) for(ll (i)=(n-1);(i)>=0;(i)--)
#define RREPS(i,n) for(ll (i)=(n);(i)>0;(i)--)
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define UNIQUE(v) v.erase(unique(ALL(v)),v.end());

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

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

signed main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout<<fixed<<setprecision(10);
    int K;
    cin >> K;
    cout << (K/2)*((K+1)/2) << "\n";
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <cmath>
#include <string>
#include <cctype>
#include <stack>
#include <queue>
#include <vector>
#include <cstdlib>
#include <list>
#define _USE_MATH_DEFINES
#include <math.h>

using namespace std;

static const int N = 100;
static const int WHITE = 0;
static const int GRAY = 1;
static const int BLACK = 2;

int n, M[N][N] = {0};
int color[N] = {0}, d[N], f[N], tt = 0;
int nt[N] = {0};

void dfs_visit(int r);
void dfs();
int next(int u);

int main() {

	int u, k, v;
	
	cin >> n;

	for (int i = 0; i < n; i++) {
		cin >> u >> k;
		u--;
		for (int j = 0; j < k; j++) {
			cin >> v;
			v--;
			M[u][v] = 1;
		}
	}

	dfs();

	return 0;
}

void dfs_visit(int r) {

	int u, v;

	stack<int> S;
	S.push(r);
	color[r] = GRAY;
	d[r] = ++tt;

	while (!S.empty()) {
		u = S.top();
		v = next(u);
		if (v != -1) {
			if (color[v] == WHITE) {
				color[v] = GRAY;
				d[v] = ++tt;
				S.push(v);
			}
		}
		else {
			S.pop();
			color[u] = BLACK;
			f[u] = ++tt;
		}
	}
}

int next(int u) {
	for (int v = nt[u]; v < n; v++) {
		nt[u] = v + 1;
		if (M[u][v])
			return v;
	}
	return -1;
}

void dfs() {
	
	for (int u = 0; u < n; u++) {
		if (color[u] == WHITE) {
			dfs_visit(u);
		}
	}

	for (int i = 0; i < n; i++) {
		cout << i + 1 << " " << d[i] << " " << f[i] << endl;
	}
}

Measured memory_bytes: 3152
#include<iostream>
using namespace std;
int main()
{
    int a,b,c,n=0; 
		while (cin>>a>>b)
		{
		
		c=a+b;
		while(c!=0)
		{
			c=c/10;
			n=n+1;
			
		}
		cout<<n<<endl;
		n=0;
	    }
} 

Measured memory_bytes: 1160
#include <iostream>
#include <set>
#include <string>

using namespace std;
using LLONG = long long;

int main()
{
    int N;
    cin >> N;
    set<int> radiuses;
    for (int i = 0; i < N; ++i)
    {
        int radius;
        cin >> radius;
        radiuses.insert(radius);
    }
    cout << radiuses.size() << endl;
    return 0;
}

Measured memory_bytes: 256
N,M = (int(T) for T in input().split())
List = [[] for T in range(0,M)]
for T in range(0,M):
    List[T] = [T]+[int(T) for T in input().split()]

CitySort = sorted(List,key=lambda List:(List[1],List[2]))
Disp = [[] for T in range(0,M)]
Rece = 0
for T in range(0,M):
    if CitySort[T][1]!=Rece:
        Rece = CitySort[T][1]
        Count = 1
        Disp[CitySort[T][0]] = str(Rece).zfill(6)+str(Count).zfill(6)
    else:
        Count += 1
        Disp[CitySort[T][0]] = str(Rece).zfill(6)+str(Count).zfill(6)
        
for T in range(0,M):
    print(Disp[T])

Measured memory_bytes: 37420
n, m = map(int,input().split())
#n = int(input())
#b = list(map(int,input().split()))
ls = [list(map(int,input().split()))[1:] for i in range(n)]
#s = input()
ans = 0

for i in range(1,m+1):
  tmp = [1 if j.count(i) == 1 else 0 for j in ls]
  if sum(tmp) == n:
    ans += 1

print(ans)

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

using namespace std;

#define rep(i, n) for (int i = 0; i < (int)n; ++i)
#define REP(i, a, b) for (int i = (int)a; i < (int)b; ++i)
#define each(i,c) for(__typeof((c).begin()) i = (c).begin(); i != (c).end(); ++i)
#define all(v) v.begin(), v.end()
#define mset(a, n) memset(a, n, sizeof(a))

typedef long long ll;

const int INF = 1000000000;
const int MOD = 1000000007;

ll gcd(ll a, ll b) {
  return b ? gcd(b, a%b) : a;
}
ll lcm(ll a, ll b){
    return a / gcd(a, b) * b;
}

int main(int argc, char *argv[]) {
    // cin.tie(0);
    // ios::sync_with_stdio(false);
    int n; cin >> n;
    ll ans = 1LL;
    rep (i, n) {
        ll t; cin >> t;
        ans = lcm (ans, t);
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <stdio.h>
#include <vector>
#include <algorithm>
#include <cmath>
#include <map>
#define rep(i,cc,n) for(int i=cc;i<=n;++i)
#define drep(i,cc,n) for(int i=cc;i>=n;--i)
typedef long long ll;
using namespace std;
int main(){
    ll n;
    cin>>n;
    ll h[n];
    rep(i,0,n-1) cin>>h[i];
    ll hoge = h[0];
    ll cnt = 0;
    ll max = 0;
    rep(i,1,n-1){
        if(h[i]<=hoge){
            cnt++;
            hoge = h[i];
        }
        else {
            hoge = h[i];
            if(max<cnt) max = cnt;
            cnt = 0;
        }
    }
    if(max<cnt) max = cnt;
    cout<<max<<endl;
    return 0;
}

Measured memory_bytes: 1024
#!/usr/bin/env python
# -*- coding:utf-8 -*-

from __future__ import division, print_function, absolute_import, unicode_literals
s = input()
cnt = 0
for a, b in zip(s[:-1], s[1:]):
    if a != b:
        cnt += 1
print(cnt)
# 11100
# WBWBWBWBWB
# 1010101010


Measured memory_bytes: 3444
import java.io.*;

public class Main {

	final static long MOD = 1000000007;
	public static void main(String[] args) throws Exception {
		// TODO 自動生成されたメソッド・スタブ

		BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
		String W = in.readLine();
		long H = Long.parseLong(W);;

		long X=H;
		long n=1;
		while(X!=1){
			X=X/2;

			n++;
		}
		System.out.println((long)Math.pow(2,n)-1);
	}
}


Measured memory_bytes: 22484
#include <bits/stdc++.h>
using i64 = int_fast64_t;
#define repeat(i, a, b) for(int i = (a); (i) < (b); ++(i))
#define rep(i, n) repeat(i, 0, n)

void solve() {
    int a, b;
    scanf("%d%d", &a, &b);
    if(a <= 8 and b <= 8) {
        std::cout << "Yay!" << std::endl;
    } else {
        std::cout << ":(" << std::endl;
    }
}

int main() {
    // std::ios::sync_with_stdio(false);
    std::cin.tie(nullptr);
    solve();
    return 0;
}

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

int main(){

    int K;
    cin >> K; 


    int num_even = K/2, num_odd;

    if( K % 2 == 0 ) num_odd = K/2;
    else num_odd = K/2 + 1;

    cout << num_even * num_odd << endl;

    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<cmath>
#include<iomanip>
#include<map>
using namespace std;
int main() {
  long long n,ans=0;
  cin >> n;
  int a[3*n]={};
  for(int i=0; i<3*n; i++) {
    cin >> a[i];
  }
  sort(a,a+3*n);
  reverse(a,a+3*n);
  for(int i=1; i<2*n; i+=2) {
    ans+=a[i];
  }
  cout << ans << endl;
}

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

int deg[60];

int main() {
    int n, m; cin >> n >> m;
    rep(i, 0, m) {
        int a, b; cin >> a >> b;
        deg[a - 1]++;
        deg[b - 1]++;
    }
    rep(i, 0, n) {
        cout << deg[i] << endl;
    }
}

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

int main() {
    int n;
    cin >> n;
    string ans = "Three";
    for (int i = 0; i < n; i++) {
        string s;
        cin >> s;
        if (s == "Y") {
            ans = "Four";
            break;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include <cstdio>
#include <cstring>
#include <cmath>
#include <utility>
#include <iostream>
#include <functional>
#include <bitset>
#include <algorithm>
#include <vector>
#include <forward_list>
#include <set>
#include <map>
#include <queue>
#include <deque>
#include <stack>
#include <tuple>
#include <numeric>
#define rep(i, s, g) for ((i) = (s); (i) < (g); ++(i))
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
const ll MOD = 998244353;
const ll INF = (1ll << 60);

int main(void)
{
    int n, k;
    cin >> n >> k;

    vector<ll> l(k), r(k), dp(n + 100, 0), s(n + 100, 0);

    for (int i = 0; i < k; i++)
    {
        cin >> l[i] >> r[i];
    }

    dp[0] = 1;
    s[1] = 1;

    for (int i = 1; i < n; i++)
    {
        for (int j = 0; j < k; j++)
        {
            ll x, y;

            if (i - l[j] < 0)
            {
                continue;
            }

            x = max(i - l[j], 0ll) + 1; //big
            y = max(i - r[j], 0ll);     //small

            dp[i] += s[x] - s[y] + MOD;
            dp[i] %= MOD;
        }

        s[i + 1] = s[i] + dp[i] + MOD;
        s[i + 1] %= MOD;
    }

    cout << dp[n - 1] << endl;
}


Measured memory_bytes: 6312
#include <iostream>

using namespace std;

int main(void) {

    char c;

    cin >> c;

    if(c == 'a' || c == 'i' || c == 'u' || c == 'e' || c == 'o') cout << "vowel" << endl;
    else cout << "consonant" << endl;

    return 0;

}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
class Program
{
    static void Main(string[] args)
    {
            System.Diagnostics.Stopwatch sw = new System.Diagnostics.Stopwatch();
            sw.Start();

            // 入力
            string[] sS = Console.ReadLine().Trim().Split(' ');
            int iN = int.Parse(sS[0]);
            int iK = int.Parse(sS[1]);
            List<int> lstInp = new List<int>();
            for (int i = 0; i < iN; i++) { lstInp.Add(0); }
            sS = Console.ReadLine().Trim().Split(' ');
            for (int i = 0; i < sS.Length; i++) { lstInp[int.Parse(sS[i]) - 1] += 1; }

            // 解析
            lstInp.RemoveAll(num => num == 0);
            lstInp.Sort();
            int iCnt = 0;
            for (int i = 0; i < (lstInp.Count - iK); i++)
            {
                iCnt += lstInp[i];
            }

            // 出力
            Console.WriteLine("{0}", iCnt.ToString().Trim());

            sw.Stop();
#if DEBUG
            Console.WriteLine();
            Console.WriteLine("{0}", sw.Elapsed.ToString());
            Console.WriteLine("続行するには何かキーを押してください．．．");
            Console.ReadKey();
#endif
    }
}


Measured memory_bytes: 32348
N = int(input())

def cnter(n):
    cnt = 0
    for i in range(1, n+1):
        if n % i == 0:
            cnt += 1
    return cnt

c = 0
for i in range(1, N+1):
    if cnter(i) == 8 and i % 2 != 0:
        c += 1

print(c)

Measured memory_bytes: 3064
n, m, c = [ int(v) for v in input().split() ]
b_list =  [ int(v) for v in input().split() ]

ans = 0
for i in range(n):
  a_list =  [ int(v) for v in input().split() ]
  if sum([ (a_list[i] * b_list[i]) for i in range(m) ]) + c > 0:
    ans += 1

print(ans)

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
int main(){
    int n;
    int ans =0;
    
  vector<vector<int>> data(3, vector<int>(3));//
  vector<vector<int>> b(3, vector<int>(3));
  for (int i = 0; i < 3; i++) {
    for (int j = 0; j < 3; j++) {
      cin >> data.at(i).at(j);//
    }
  }
  cin >>n;
  vector<int> a(n);
  for(int i=0; i<n; i++){
      cin >> a.at(i);
      for (int j = 0; j < 3; j++) {
    for (int k = 0; k < 3; k++) {
        if(a.at(i)== data.at(j).at(k)){//
        b.at(j).at(k) ++ ;}
    }
      }
  }

  if (b.at(0).at(0)==1 &&b.at(0).at(1)==1 &&b.at(0).at(2)==1 ){ans++; }
  else if(b.at(1).at(0)==1 &&b.at(1).at(1)==1 &&b.at(1).at(2)==1){ans++; }
  else if(b.at(2).at(0)==1 &&b.at(2).at(1)==1 &&b.at(2).at(2)==1){ans++; }
  else if(b.at(0).at(0)==1 &&b.at(1).at(0)==1 &&b.at(2).at(0)==1){ans++; }
  else if(b.at(0).at(1)==1 &&b.at(1).at(1)==1 &&b.at(2).at(1)==1){ans++; }
  else if(b.at(0).at(2)==1 &&b.at(1).at(2)==1 &&b.at(2).at(2)==1){ans++; }
  else if(b.at(0).at(0)==1 &&b.at(1).at(1)==1 &&b.at(2).at(2)==1){ans++; }
  else if(b.at(0).at(2)==1 &&b.at(1).at(1)==1 &&b.at(2).at(0)==1){ans++; }

  if(ans==1){
      cout<< "Yes" << endl;
  }
  else {
      cout << "No" << endl;
  }
}
  

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define LLMAX (1ll << 60) - 1
#define INTMAX (1 << 30) - 1
#define MOD 1000000007 
#define NMAX 1000*100+1
#define MSET(x,y) memset(x,y,sizeof(x))
#define gcd(a,b) __gcd(a,b)
#define all(x)  x.begin(),x.end()
#define vi vector<int>
#define print(x)    for(auto it=x.begin();it!=x.end();it++) cout<<*it<<' '; cout<<endl;
#define in(x,n)   for(int e=0;e<n;e++){int y;cin>>y;x.pb(y);}


int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int a,b;
    cin>>a>>b;
    if((a<10)&&(b<10)){
        cout<<a*b;
    }
    else{
        cout<<-1;
    }
    

    return 0;
}




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

int main() {
    ll n;
    ll two = 0;
    ll five = 0;
    cin >> n;
    if (n % 2 == 1) {
        cout << 0 << endl;
        return 0;
    }
    ll x = 2;
    while (n / x) {
        two += n / x;
        x *= 2;
    }
    while (n % 5 != 0) {
        n -= 2;
    }
    ll y = 10;
    while (n / y) {
        five += n / y;
        y *= 5;
    }
    cout << min(two, five) << endl;
}


Measured memory_bytes: 3612
#include <stdio.h>

int main(void){
	int n, flag;
	int player[3][201] = {}, score[201] = {};
	int i, j, k;
	
	scanf("%d", &n);
	
	for (i = 0; i < n; i++){
		scanf("%d %d %d", &player[0][i], &player[1][i], &player[2][i]);
	}
	
	for (i = 0; i < 3; i++){
		for (j = 0; j < n; j++){
			flag = 0;
			for (k = 0; k < n; k++){
				if (player[i][j] == player[i][k] && j != k){
					player[i][k] = 0;
					flag = 1;
				}
			}
			if (flag) player[i][j] = 0;
		}
	}
	
	for (i = 0; i < n; i++){
		for (j = 0; j < 3; j++){
			score[i] += player[j][i];
		}
	}
	
	for (i = 0; i < n; i++){
		printf("%d\n", score[i]);
	}
	
	return 0;
}

Measured memory_bytes: 600
use std::cmp;
use std::fmt::Debug;
use std::str::FromStr;
#[allow(dead_code)]
fn read_as_vec<T>() -> Vec<T>
where
    T: FromStr,
    <T as FromStr>::Err: Debug,
{
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).unwrap();
    s.trim()
        .split_whitespace()
        .map(|c| T::from_str(c).unwrap())
        .collect()
}

#[allow(dead_code)]
fn read_as_string() -> String {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).unwrap();
    s.trim().to_string()
}

fn main() {
    let s = read_as_string().chars().collect::<Vec<char>>();
    let t = read_as_string().chars().collect::<Vec<char>>();

    let mut ans = 0;
    for i in 0..s.len() {
        if s[i] != t[i] {
            ans += 1;
        }
    }

    println!("{}", ans);
}


Measured memory_bytes: 3948
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE BangPatterns #-}

import Control.Applicative
import Control.Monad
import Control.Arrow
import Data.List
import Data.Maybe
import Data.Char
import qualified Data.ByteString.Char8 as B
import Text.Printf

readInt = ( readLn :: IO Int )
readInts = map ( read :: String -> Int ) . words <$> getLine

getList = map ( fst . fromJust . B.readInt ) . B.words <$> B.getLine

which a b f = if f then a else b
mp [ a, b ] = ( a, b )

main = getLine >>= print . length . filter ( == '1' )


Measured memory_bytes: 380
// import std = require('tstl')

{
  type Print = void | string | number | string[] | number[]
  let outs: Print[] = []

  const main = (): Print => {
    const r = _io()
    const [S] = r.ss()

    return S.substr(0, 3)
  }

  const _io = (i = 0) => {
    const str = require('fs').readFileSync('/dev/stdin', 'utf8')
    const lines = str.trim().split('\n')
    const s = () => lines[i++] || ''
    const n = () => Number(s())

    const mn = (v: string[]) => v.map(Number)
    const sp = (v: string) => v.split(' ')

    const ss = () => sp(s())
    const nn = () => mn(ss())
    const nls = () => mn(lines.slice(i))
    const nnls = () => lines.slice(i).map((v) => mn(sp(v)))

    return { lines, s, n, ss, nn, nls, nnls }
  }

  outs.push(main())

  console.log(
    outs
      .map((line) => (typeof line === 'object' ? line.join(' ') : String(line)))
      .join('\n')
  )
}


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

int i, n;
vector<int> A;

bool exhaustiveSearch(int i, int sum) {
    if (sum == 0) return true;
    if (i >= n) return false;
    bool ret = exhaustiveSearch(i+1, sum) || exhaustiveSearch(i+1, sum-A[i]);
    return ret;
}

int main() {
    cin >> n;
    int t = 0;
    rep(i, n) {
        cin >> t;
        A.push_back(t);
    }
    int q;
    cin >> q;
    rep(i, q) {
        int m;
        cin >> m;
        if (exhaustiveSearch(0, m)) cout << "yes" << endl;
        else cout << "no" << endl;
    }

    return 0;
}



Measured memory_bytes: 3148
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N=1e5+5,mod=1e9+7;
int n,vis[N],a[N];
int main()
{
    scanf("%d",&n);
    for(int i=1;i<=n;i++) scanf("%d",&a[i]);
    vis[0]=3;
    ll ans=1;
    for(int i=1;i<=n;i++)
    {
        ans=ans*vis[a[i]]%mod;
        vis[a[i]]--;
        vis[a[i]+1]++;
    }
    printf("%lld\n",ans);
}


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

int main()
{
    int current_degree;

    cin >> current_degree;

    if(current_degree >= 30)
    {
        cout << "Yes" << endl;
    }
    else
    {
        cout << "No" << endl;
    }

    return 0;
}

Measured memory_bytes: 3560
#include <algorithm>
#include <iostream>
#include <iterator>
#include <numeric>
#include <set>
#include <string>
#include <utility>
#include <vector>
 
int main() {
  int n;
  int a[200000], inv[200000];
  std::set<int> s;
  long long ans = 0;
  std::cin >> n;
  for (int ni = 0; ni < n; ++ni) {
    std::cin >> a[ni];
    inv[a[ni] - 1] = ni;
  }
  for (int ni = 0; ni < n; ++ni) {
    auto pos = s.insert(inv[ni]).first;
    long long begin, end;
    if (pos == s.begin()) {
      begin = 0;
    } else {
      begin = *std::prev(pos) + 1;
    }
    if (std::next(pos) == s.end()) {
      end = n;
    } else {
      end = *std::next(pos);
    }
    ans += ((end - begin) * (end - begin + 1)
            - (inv[ni] - begin) * (inv[ni] - begin + 1)
            - (end - inv[ni] - 1) * (end - inv[ni])) / 2 * (ni + 1);
  }
  std::cout << ans << std::endl;
  return 0;
}

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

int main()
{
	int a, b;
	cin >> a >> b;
	if (a % b == 0) cout << 0;
	else cout << 1;
}

Measured memory_bytes: 256
#include <stdio.h>

int a, b, c;

int main(void) {
    int i, sum = 0;
    
    scanf("%d%d%d", &a, &b, &c);
    
    for (i = a; i <= b; ++i) {
        if (c % i == 0) ++sum;
    }
    
    printf("%d\n", sum);
    return 0;
}

Measured memory_bytes: 596