akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <cmath>
#include <algorithm>
#include <vector>
using namespace std;
int main() {
    int N; cin >> N;
    vector<int> a(N, 0);
    for (int i = 0; i < N; ++i) cin >> a[i];
    sort(a.begin(), a.end());
    int x = 0, y = 0, f = 0;
    for (int i = N - 1; i >= 0; --i) {
        if (f == 0) x += a[i], f++;
        else y += a[i], f--;
    }
    printf("%d\n", x - y);
}


Measured memory_bytes: 3672
#include <iostream>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <iomanip>
#include <queue>
#include <unordered_map>
#define rep(i,n) for(int i=0;i<n;i++)
#define repn(i,n) for(int i=1;i<=n;i++)
using namespace std;
typedef long long ll;

int s;
unordered_map<int,int> m;

int main(){
    cin>>s;

    int ans;
    int i=0;
    while(true){
        i++;
        if(m[s]==0){
            m[s]++;
        }else{
            ans=i;
            break;
        }

        if(s%2==0){
            s/=2;
        }else{
            s=3*s+1;
        }
    }

    cout<<ans<<endl;
}

Measured memory_bytes: 512
import scala.io.StdIn

object Main extends App {
  val out = new java.io.PrintWriter(System.out)

  val n = StdIn.readLine.toInt
  val st = Iterator.continually(StdIn.readLine)
          .take(n-1)
          .map(_.split(" ").map(_.toInt))
          .toArray

  for(i <- 0 until n) {
    var t = 0
    for(j <- i until n-1) {
      t = if(t < st(j)(1)) st(j)(1)
        else if (t%st(j)(2) == 0) t
        else t + st(j)(2) - t % st(j)(2)
      t += st(j)(0)
    }
    out.println(t)
  }

  out.flush
}


Measured memory_bytes: 25604
#include <iostream>
#include <algorithm>
#include <string>
#include <stdio.h>
#include <vector>
using namespace std;
typedef vector<string> vs;
 
int main() {
	int n, l;
	cin >> n >> l;
	vs v(n);
	for (int i = 0; i < n; i++) cin >> v[i];
	sort(v.begin(), v.end());
	for (auto s : v) cout << s;
	cout << endl;
   return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
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;
}
typedef long long int ll;

#define EPS (1e-7)
#define INF (1e9)
#define LLINF (1e18)
#define PI (acos(-1))
#define MOD (1000000007)
#define ALL(v) (v).begin(), (v).end()
#define RALL(v) (v).rbegin(), (v).rend()
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

//-------------------------------------

using data = tuple<int, int, int, int>;

vector<data> ans;

void coinMove(int x, int y, int h, int w, vector<vector<int>> &a)
{
    if (h % 2 == 1)
    {
        if (x == w - 1 && y == h - 1)
        {
            return;
        }
    }
    else
    {
        if (x == 0 && y == h - 1)
        {
            return;
        }
    }
    if (y % 2 == 0)
    {
        if (a[y][x] % 2 == 1)
        {
            if (x == w - 1)
            {
                a[y][x]--;
                a[y + 1][x]++;
                ans.push_back(data(y, x, y + 1, x));
            }
            else
            {
                a[y][x]--;
                a[y][x + 1]++;
                ans.push_back(data(y, x, y, x + 1));
            }
        }
    }
    else
    {
        if (a[y][x] % 2 == 1)
        {
            if (x == 0)
            {
                a[y][x]--;
                a[y + 1][x]++;
                ans.push_back(data(y, x, y + 1, x));
            }
            else
            {
                a[y][x]--;
                a[y][x - 1]++;
                ans.push_back(data(y, x, y, x - 1));
            }
        }
    }
}

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int h, w;
    cin >> h >> w;
    vector<vector<int>> a(h, vector<int>(w));
    for (int i = 0; i < h; i++)
    {
        for (int j = 0; j < w; j++)
        {
            cin >> a[i][j];
        }
    }
    for (int y = 0; y < h; y++)
    {
        if (y % 2 == 0)
        {
            for (int x = 0; x < w; x++)
            {
                coinMove(x, y, h, w, a);
            }
        }
        else
        {
            for (int x = w - 1; x >= 0; x--)
            {
                coinMove(x, y, h, w, a);
            }
        }
    }
    cout << (int)ans.size() << endl;
    for (auto p : ans)
    {
        cout << get<0>(p) + 1 << " " << get<1>(p) + 1 << " " << get<2>(p) + 1 << " " << get<3>(p) + 1 << endl;
    }
}

Measured memory_bytes: 5236
#include<iostream>
#include<cstdio>
#include<cstring>
#include<cstdlib>
using namespace std;
int S[1000];
int top=0;
void push(int x)
{
    S[++top]=x;
}
int pop()
{
    top--;
    return S[top+1];
}
int main()
{
	char s[1];
	int a,b;
	while(scanf("%s",s)!=EOF)
    {
        if(s[0]=='+')
        {
            a=pop();
            b=pop();
            push(a+b);
        }
        else if(s[0]=='-')
        {
            a=pop();
            b=pop();
            push(b-a);
        }
        else if(s[0]=='*')
        {
            a=pop();
            b=pop();
            push(a*b);
        }
        else
            push(atoi(s));
    }
    cout<<pop()<<endl;
	return 0;
}

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

vector<int>E[100000];
deque<int>que{ 0 };
bool used[100000];
void dfs(int u) {
	used[u] = 1;
	for (int v : E[u]) {
		if (!used[v]) {
			que.push_front(v); dfs(v); break;
		}
	}
}
void rdfs(int u) {
	used[u] = 1;
	for (int v : E[u]) {
		if (!used[v]) {
			que.push_back(v); rdfs(v); break;
		}
	}
}
int main() {
	int n, m; scanf("%d%d", &n, &m);
	rep(i, m) {
		int a, b; scanf("%d%d", &a, &b); a--; b--;
		E[a].push_back(b); E[b].push_back(a);
	}
	dfs(0); rdfs(0);
	printf("%d\n", que.size());
	rep(i, que.size()) {
		if (i)printf(" ");
		printf("%d", que[i] + 1);
	}
	printf("\n");
}

Measured memory_bytes: 6784
import heapq
import bisect
N=int(input())
A=[]

for i in range(N):
  a=int(input())
  A.append(a)
h=[]
c=0
for i in range(N-1,-1,-1):
  p=bisect.bisect_right(h,A[i])
  if p==len(h):
    h.append(A[i])
    c+=1
  else:
    h[p]=A[i]
print(c)

Measured memory_bytes: 13696
import sys
input = sys.stdin.readline

N = int(input())
As = [int(input()) for _ in range(N)]

ans = As[0]-1
M = 1
for A in As[1:]:
    if A == M+1:
        M += 1
    else:
        if A > M+1:
            ans += (A-(M+2))//(M+1) + 1

print(ans)


Measured memory_bytes: 7852
import sys
S = input()

if S[0] == "A":
    if S[2:-1].count("C") == 1 and S[1] != "C" and S[-1] != "C":
        S_A = S.replace("A", "", 1)
        S_AC = S_A.replace("C", "")
        if S_AC.islower() == True:
            print("AC")
            sys.exit()


print("WA")

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

int main(){
    double total = 0;
    int n; cin >> n;
    string s;
    double money;
    for (int i = 0; i < n; i++){
        cin >> money >> s;
        if (s == "JPY"){
            total += money;
        }else{
            total += 380000.0*money;
        }
    }
    cout << total << endl;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int N = scanner.nextInt();
        int[] a = new int[N];
        int[] b = new int[N];
        int[] c = new int[N];
        for (int i = 0; i < N; i++) {
            a[i] = scanner.nextInt();
            b[i] = scanner.nextInt();
            c[i] = scanner.nextInt();
        }
        int res = vacation(N, a, b, c);
        System.out.println(res);
    }

    private static int vacation(int n, int[] a, int[] b, int[] c) {
        // subproblem:
        // s1(k) = max points of first k days ending with a
        // s2(k) = max points of first k days ending with b
        // s3(k) = max points of first k days ending with c
        // max{ s1(n), s2(n), s3(n) }

        // s*(0) = 0
        // s*(1) = a/b/c[0]
        // s1(k) = max{ s2(k-1), s3(k-1) } + a[k-1]
        // s2(k) = max{ s1(k-1), s3(k-1) } + b[k-1]
        // s3(k) = max{ s1(k-1), s2(k-1) } + c[k-1]
        int[] f1 = new int[n+1];
        int[] f2 = new int[n+1];
        int[] f3 = new int[n+1];
      	f1[0] = 0;
      	f2[0] = 0;
      	f3[0] = 0;
        for (int k = 1; k <= n; k++) {
            f1[k] = a[k-1] + Math.max(f2[k-1], f3[k-1]);
            f2[k] = b[k-1] + Math.max(f1[k-1], f3[k-1]);
            f3[k] = c[k-1] + Math.max(f1[k-1], f2[k-1]);
        }
        return Math.max(f1[n], Math.max(f2[n], f3[n]));
    }
}

Measured memory_bytes: 92660
#include<stdio.h>

int main(int argc, char const *argv[])
{
  int r, D, x, i;

  scanf("%d", &r);
  scanf("%d", &D);
  scanf("%d", &x);
  
  for ( i = 1; i <= 10; i++)
  {
    x = r*x-D;
    printf("%d\n", x);
  }
  
  

  return 0;
}


Measured memory_bytes: 128
#include<iostream>
#include<algorithm>
#include<cmath>
using namespace std;
int n,ans=0,a,b,c;
string s;
int main()
{
	cin>>s;
	for(int i=0;i<s.length();i++)
	{
		if(s[i]=='1')ans++;
	}
	cout<<ans<<endl;
}

Measured memory_bytes: 256
M, D = map(int, input().split())
cnt = 0
for m in range(1, M + 1):
    for dd in range(1, D + 1):
        if dd < 10:
            continue
        d1 = dd % 10
        d2 = (dd - d1) // 10
        if d1 > 1 and d2 > 1 and d1 * d2 == m:
            cnt += 1
print(cnt)

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
using pii = pair<int,int>;
using pll = pair<long long, long long>;
const long long INF = 1<<29;

const int MOD = 1000000007;
long long ruizyou(long long m,long long n){
  if(m == 0)return 0;
  if(m == 1)return 1;
  long long ans = 1;
  long long tmp = m;
  for(int i=0;i<=30;i++){
    if(n & (1<<i)){
      ans *= tmp;
      ans %= MOD;
    }
    tmp *= tmp;
    tmp %= MOD;
  }
  return ans;
}
long long kaizyou(long long x){
  if(x == 0)return 1;
  return x * kaizyou(x-1) % MOD;
}
long long comb(long long x,long long y){
  long long bunsi = kaizyou(x);
  long long bunbo = kaizyou(x-y) * kaizyou(y) % MOD;
  return bunsi * ruizyou((int)bunbo,MOD-2) % MOD;
}
struct unionfind{
  vector<int> par;
  vector<int> hukasa;
  unionfind(int n){
    par = vector<int>(n);
    hukasa = vector<int>(n,0);
    for(int i=0;i<n;i++){
      par.at(i) = i;
    }
  }
  int root(int x){
    if(par.at(x) == x)return x;
    return root(par.at(x));
  }
  void unite(int x,int y){
    int rx = root(x);
    int ry = root(y);
    if(rx == ry)return;
    if(hukasa.at(rx) >= hukasa.at(ry)){
      par.at(ry) = rx;
      hukasa.at(rx) = max(hukasa.at(ry) + 1,hukasa.at(rx));
    }
    else{
      par.at(rx) = ry;
    }
  }
  bool same(int x,int y){
    return root(x) == root(y);
  }
};
int ctoi(char a){
  return a - '0';
}
long long gcd(long long a,long long b){
  long long c = max(a,b);
  long long d = min(a,b);
  if(d % c == 0)return c;
  return gcd(c,d%c);
}
long long lcm(long long a,long long b){
  return a * b / gcd(a,b);
}
int main(){
  int x,y,a,b,c;
  cin >> x >> y >> a >> b >> c;
  vector<int> p(a),q(b),r(c);
  for(int i=0;i<a;i++)cin >> p.at(i);
  for(int i=0;i<b;i++)cin >> q.at(i);
  for(int i=0;i<c;i++)cin >> r.at(i);
  sort(p.begin(),p.end());
  reverse(p.begin(),p.end());
  sort(q.begin(),q.end());
  reverse(q.begin(),q.end());
  sort(r.begin(),r.end());
  reverse(r.begin(),r.end());
  int aa = x-1,bb = y-1,cc = 0;
  while(cc < c){
    if(aa>=0 && bb>=0){
      if(r.at(cc) > min(p.at(aa),q.at(bb))){
        cc++;
        if(p.at(aa) < q.at(bb))aa--;
        else bb--;
      }
      else break;
    }
    else if(bb >= 0){
      if(r.at(cc) > q.at(bb)){
        cc++;
        bb--;
      }
      else break;
    }
    else if(aa >= 0){
      if(r.at(cc) > p.at(aa)){
        cc++;
        aa--;
      }
      else break;
    }
    else break;
  }
  long long ans = 0;
  for(int i=0;i<=aa;i++)ans += p.at(i);
  for(int i=0;i<=bb;i++)ans += q.at(i);
  for(int i=0;i<cc;i++)ans += r.at(i);
  cout << ans << endl;
}

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

int main(void){
  int a, b;
  int sum, max;
  cin >> a;
  cin >> b;
  sum = a + b;
  if (sum <= a * b) {
    sum = a * b;
  }
  if(sum <= a - b){
    sum = a - b;
  }
  cout << sum;
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using ll=long long;
#define fr(i,n) for(int i=0;i<(n);++i)
#define Fr(i,n) for(int i=1;i<=(n);++i)
#define ifr(i,n) for(int i=(n)-1;i>=0;--i)
#define iFr(i,n) for(int i=(n);i>0;--i)
 
int main(void) {
  ll x;cin>>x;
  ll ans = 0;
  Fr(i, x) if(i%3!=0&&i%5!=0) ans += i;
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 3636
#include <stdio.h>

void scanlln(long long *n,long long t[])
{
    long long tmp,i;
    scanf("%lld",&tmp);
    for (i = 0; i < tmp; i++)scanf("%lld",&t[i]);
    *n = tmp;
    return;
}
long long gcd(long long a,long long b){long long r,tmp;if(a < b){tmp = a;a = b;b = tmp;}r = a % b;while(r != 0){a = b;b = r;r = a % b;}return b;}
long long lcm(long long a,long long b){long long r;r = gcd(a,b);r = a / r * b;return r;}

int main()
{
    long long n,t[100],i,j;

    scanlln(&n,t);

    long long r = 1;
    for (i = 0; i < n; i++)
    {
        r = lcm(r,t[i]);
    }
    printf("%lld",r);
}

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

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

using ll = long long;

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

int main() {
  int N;
  cin>>N;
  vector<vector<int>> graph(N);
  for(int i = 0; i < N-1; i++) {
    int x,y;
    cin>>x>>y;
    graph[x-1].push_back(y-1);
    graph[y-1].push_back(x-1);
  }
  priority_queue<ll> point;
  ll cnt = 0LL;
  for(int i = 0; i < N; i++) {
    ll x;
    cin>>x;
    point.push(x);
    cnt+=x;
  }
  queue<int> dfs;
  vector<bool> seen(N,false);
  vector<ll> ans(N);
  dfs.push(0);
  seen[0]=true;
  ans[0]=point.top();
  point.pop();
  cnt-=ans[0];
  while(!dfs.empty()){
    int x = dfs.front();
    dfs.pop();
    for(auto nx:graph[x]){
      if(seen[nx]) continue;
      seen[nx]=true;
      dfs.push(nx);
      ans[nx]=point.top();
      point.pop();
    }
  }
  cout<<cnt<<endl;
  for(auto x:ans) cout<<x<<endl;
}

Measured memory_bytes: 1152
N = int(input())
if  111 >= N:
    print('111')
elif 111 < N <= 222:
    print('222')
elif 222 < N <= 333:
    print('333')
elif 333 < N <= 444:
    print('444')
elif 444 < N <= 555:
    print('555')
elif 555 < N <= 666:
    print('666')
elif 666 < N <= 777:
    print('777')
elif 777 < N <= 888:
    print('888')
elif 888 < N <= 999:
    print('999')

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

typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<double> vd;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
typedef pair<int,int> pii;
typedef pair<double, double> pdd;
typedef pair<ll, ll> pll;
typedef vector<pii> vii;
typedef vector<pll> vll;
typedef vector<pdd> vdd;

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define mem(a,b) memset(a, b, sizeof(a) )
#define all(x) (x).begin(),(x).end()
#define INF 1000000000000
#define MOD 1000000007
#define PB push_back
#define MP make_pair
#define F first
#define S second

inline void normal(ll &a) { a %= MOD; (a < 0) && (a += MOD); }
inline ll modMul(ll a, ll b) { a %= MOD, b %= MOD; normal(a), normal(b); return (a*b)%MOD; }
inline ll modAdd(ll a, ll b) { a %= MOD, b %= MOD; normal(a), normal(b); return (a+b)%MOD; }
inline ll modSub(ll a, ll b) { a %= MOD, b %= MOD; normal(a), normal(b); a -= b; normal(a); return a; }
inline ll modPow(ll b, ll p) { ll r = 1; while(p) { if(p&1) r = modMul(r, b); b = modMul(b, b); p >>= 1; } return r; }
inline ll modInverse(ll a) { return modPow(a, MOD-2); }
inline ll modDiv(ll a, ll b) { return modMul(a, modInverse(b)); }

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

int ctoi(char c) {
	if (c >= '0' && c <= '9') {
		return c - '0';
	}
	return 0;
}

int main(){
    ll n,m;cin>>n>>m;
    if(n==1&&m==1){
        cout<<1<<endl;
        return 0;
    }
    if(n<=2&&m<=2){
        cout<<0<<endl;
        return 0;
    }
    if(n==2||m==2){
        cout<<0<<endl;
        return 0;
    }
    if(n==1||m==1){
        cout<<max(n,m)-2<<endl;
        return 0;
    }
    cout<<(n-2)*(m-2)<<endl;
}


Measured memory_bytes: 256
/**
 * @Author: yujirotakahashi
 * @Date:   2020-05-17T20:21:41+09:00
 * @Last modified by:   yujirotakahashi
 * @Last modified time: 2020-05-22T23:42:35+09:00
 */

#include<bits/stdc++.h>
using namespace std;

/*******  All Required define Pre-Processors and typedef Constants *******/
#define all(cont) cont.begin(), cont.end()
#define rall(cont) cont.end(), cont.begin()
#define rep(i,n) for(int i=0; i<(n); ++i)
#define rep1(i,n) for(int i=1; i<=(n); ++i)
#define Dcout(a) cout << setprecision(20) << a << endl
#define MP make_pair
#define PB push_back
#define EPS 1e-9
#define PI 3.1415926535897932384626433832795
#define MOD 1000000007
//const ll INF = (1LL << 60);
//const double pi=acos(-1.0);
using ll = long long;
using PAIR = pair<int, int>;
#define debug cout << "line : " << __LINE__ << " debug" << endl
/****** Template of some basic operations *****/
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
/**************************************/

/******** User-defined Function *******/
using Graph = vector<vector<int>>;
int n;
int m[100][100];
int color[100],d[100],f[100],tt;

int nt[100];

//color while-1 Gray-2 Black-3
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(int r){
    rep(i,n) nt[i] = 0;

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

    while(!S.empty()){
        int u = S.top();
        int v = next(u);
        if(v != -1){
            if(color[v] == 0){
                color[v] = 1;
                d[v] = ++tt;
                S.push(v);
            }
        }else{
            S.pop();
            color[u] = 2;
            f[u] = ++tt;
        }
    }
}
/**************************************/

/********** Main()  function **********/
int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);

  cin >> n;
  rep(i,n)rep(j,n) m[i][j] = 0;

  rep(i,n){
      int u,k; cin >> u >> k;
      u--;
      rep(j,k){
          int v; cin >> v;
          v--;
          m[u][v] = 1;
      }
  }

  //dfs

  rep(i,n){
       color[i] = 0;
       nt[i] = 0;
   }
  tt = 0;

  rep(u,n){
      if(color[u] == 0) dfs(u);
  }

  //出力
  rep(i,n){
      cout << i+1 << " " << d[i] << " " << f[i] << endl;
  }

  return 0;
}
/********  Main() Ends Here *************/



Measured memory_bytes: 3192
#include<bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define rng(i,a,b) for(int i=int(a);i<int(b);i++)
#define rep(i,b) rng(i,0,b)
#define gnr(i,a,b) for(int i=int(b)-1;i>=int(a);i--)
#define per(i,b) gnr(i,0,b)
#define bg begin()
#define ed end()
#define all(x) x.bg,x.ed
#define pb push_back
#define eb emplace_back
using namespace std;
typedef long long ll;
template<class t,class u> void chmax(t&a,u b){if(a<b)a=b;}
template<class t,class u> void chmin(t&a,u b){if(b<a)a=b;}
template<class t> using vc=vector<t>;
template<class t> using vvc=vc<vc<t>>;
using pi=pair<int,int>;
using vi=vc<int>;
void yes(){ cout << "Yes" << endl; }
void no(){ cout << "No" << endl; }
int SIZE(string s){ return (int)s.size(); }

int main(){
    cout << fixed << setprecision(20);
    ll n,a,b; cin >> n >> a >> b;
    n--; a--; b--;
    if((b-a) % 2 == 0) cout << (b-a)/2 << endl;
    else {
        // 1かnで待って戻る方法の存在あり
        cout << min(a,n-b) + 1 + (b-a-1)/2 << endl;
    }
    return 0;
}

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

#define endl "\n"
#define int long long
#define vec(x) vector<x>
#define pb push_back
#define pii pair<int,int>
#define vi vector<int>
#define vii vector<pair<int,int>>
#define matrix(x) vector<vector<x>>
#define all(v) v.begin(),v.end()
#define mem(a,b) memset(a, b, sizeof a)
#define setBits(n) __builtin_popcountll(n)
#define prec(n) fixed<<setprecision(n)
#define ff first
#define ss second
#define print(x) for(auto it:x) cout<<it<<" ";
#define dbg(x) cerr<<#x<<" :: "<<x<<endl;
#define dbg2(x,y) cerr<<#x<<" :: "<<x<<"\t"<<#y<<" :: "<<y<<endl;
const int INF = 1e9;
const int MOD = 1e9 + 7; 
const double pi = acos(-1);
int power(int a,int b,int m=MOD)
{int ans=1;while(b>0){if(b&1)ans=(ans*a)%m;a=(a*a)%m;b>>=1;}
return ans;}
int dir[]={-1, 0, 1, 0, -1};
int dx[]={1,1,0,-1,-1,-1, 0, 1};
int dy[]={0,1,1, 1, 0,-1,-1,-1};

const int N = 1e5+1;

void solve()
{
	int a;
	string s;
	cin>>a>>s;
	int b=(s[0]-'0')*100+(s[2]-'0')*10+(s[3]-'0');
	int ans=(a*b)/100;
	cout<<ans<<endl;
}

int32_t main()
{
	ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
	int t;
	t=1;
	//cin>>t;
	while(t--)
		solve();
}

Measured memory_bytes: 3656
function main(input) {
    var N = input[0]-0;
    var list = input[1].split(" ").map(v=>v-0);
    var ans = 0;
    var min = Infinity;
    for(var i=0;i<N;i++){
        if(min>list[i]){
            min = list[i];
            ans++;
        }
    }
    console.log(ans);
}
main(require('fs').readFileSync('/dev/stdin', 'utf8').trim().split("\n"))


Measured memory_bytes: 22224
#include <iostream>
using namespace std;
int main(void){
    // Your code here!
    int x,y;
    while(1){
        cin>>x>>y;
        if(x==0 && y==0) break;
        
        if(x>=y)
            cout<<y<<' '<<x<<endl;
        else
            cout<<x<<' '<<y<<endl;
    }
    return 0;
}



Measured memory_bytes: 3080
#include <algorithm>
#include <cassert>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <vector>

#include <limits.h>

using namespace std;

typedef long long ll;

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

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

int main(void) {
    int A, B, K;
    cin >> A >> B >> K;

    set<int> ans;
    for (int i = A; i <= min(A + (K - 1), B); i++) {
        ans.insert(i);
    }
    for (int i = B; i >= max(A, B - (K - 1)); i--) {
        ans.insert(i);
    }

    for (auto x : ans) {
        cout << x << endl;
    }

    return 0;
}


Measured memory_bytes: 3604
#define _USE_MATH_DEFINES

#include <iostream>
#include <string>
#include <sstream>
#include <iomanip>
#include <cmath>
#include <algorithm>
#include <utility>
#include <vector>
#include <numeric>

using namespace std;

void bubbleSort(vector<string> &a)
{
	for (int i = 0; i < a.size(); i++)
	{
		for (int j = 0; j < a.size() - i - 1; j++)
		{
			if (a.at(j).substr(1, 1) > a.at(j + 1).substr(1, 1))
			{
				swap(a.at(j), a.at(j + 1));
			}
		}
	}
}

void SelectionSort(vector<string> &a)
{
	for (int i = 0; i < a.size(); i++)
	{
		int mini = i;
		for (int j = i + 1; j < a.size(); j++)
		{
			if (a.at(j).substr(1, 1) < a.at(mini).substr(1, 1))
			{
				mini = j;
			}
		}

		swap(a.at(i), a.at(mini));
	}
}

int main()
{
	int n;

	vector<string> a;

	for (cin >> n; n--;)
	{
		string s;
		cin >> s;

		a.push_back(s);
	}

	vector<string> a0 = a;
	vector<string> a1 = a;

	bubbleSort(a0);
	SelectionSort(a1);

	for (int i = 0; i < a0.size(); i++)
	{
		cout << a0.at(i) << (i == a0.size() - 1 ? "" : " ");
	}
	cout << endl;
	cout << "Stable" << endl;

	bool stable = true;
	for (int i = 0; i < a1.size(); i++)
	{
		cout << a1.at(i) << (i == a1.size() - 1 ? "" : " ");

		if (stable)
		{
			if (a0.at(i) != a1.at(i))
			{
				stable = false;
			}
		}
	}

	cout << endl;
	cout << (stable ? "Stable" : "Not stable") << endl;
}


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

#define TLong long long 

int main(int argc, char const *argv[]){
	int player = 0,turn[3] = {0,-1,-1};
	char card[3][120];
	scanf("%s %s %s",card[0],card[1],card[2]);
	for (int i = 0; i < strlen(card[0]) + strlen(card[1]) + strlen(card[2]); ++i){
		switch(card[player][turn[player]]){
			case 'a':
				player = 0;
				break;
			case 'b':
				player = 1;
				break;
			case 'c':
				player = 2;
				break;
		}
		if(++turn[player] > strlen(card[player])){
			printf("%c\n", (player + 0x41));
			return 0;
		}
	}
	printf("%c\n", (player + 0x41));
	return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
ll ans = 0;
const ll mo = 1000000007;

ll mypow(ll a, ll b){
  ll res = 1;
  a %= mo;
  while (b)
  {
    if (b & 1)
      res = res * a % mo;
    a = a * a % mo;
    b >>= 1;
  }
  return res;
}
int main()
{
ll n ;
cin >> n ;
vector<ll> a(n);
rep(i, n){
  cin >> a[i];
}
vector<ll> v(n);
rep(i,n){
  v[i]=mypow(i+1,mo-2);
  if(i!=0)v[i]+=v[i-1];
  v[i]%=mo;
}
rep(i,n){
  ans+=(v[i]+v[n-i-1]-1)*a[i];
  ans%=mo;
}
rep(i,n){
  ans*=(i+1);
  ans%=mo;
}
cout << ans << endl;
return 0;
}


Measured memory_bytes: 1792
#include <iostream>
#include <algorithm>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
#include <queue>
#include <cmath>
#include <bitset>
#include <complex>
#include <functional>
#include <numeric>

// output
#define SPBR(w, n) std::cout<<(w + 1 == n ? '\n' : ' ');
#define YES cout << "YES" << endl
#define Yes cout << "Yes" << endl
#define NO cout << "NO" << endl
#define No cout << "No" << endl
// utility
#define ALL(i) (i).begin(), (i).end()
#define FOR(i, a, n) for(int i=(a);i<(n);++i)
#define RFOR(i, a, n) for(int i=(n)-1;i>=(a);--i)
#define REP(i, n) for(int i=0;i<int(n);++i)
#define RREP(i, n) for(int i=int(n)-1;i>=0;--i)
#define IN(a, x, b) (a<=x && x<b)
#define OUT(a, x, b) (x<a || b<=x)
template<class T> inline T chmax(T & a, const T b) { return a = (a < b) ? b : a; }
template<class T> inline T chmin(T& a, const T b) { return a = (a > b) ? b : a; }

// type/const
#define int ll
using ll = long long;
using ull = unsigned long long;
using ld = long double;
const int MOD = 1000000007;
/* const int MOD = 998244353; */
const int INF = 1e18;
const double PI = acos(-1);

using namespace std;


signed main() {
  int N; 
  cin >> N;

  vector<int> A(N);
  REP(i, N) cin >> A[i];

  int ans = 0;
  int right = 0;
  int sum = 0;
  REP(left, N){
    while(right < N && sum+A[right] == (sum^A[right])){
      sum += A[right];
      right++;
    }
    ans += right-left;
    sum -= A[left];
  }

  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 1792
#[allow(unused_imports)]
use std::io::Write;

// {{{
#[allow(unused)]
macro_rules! debug {
    ($($format:tt)*) => (write!(std::io::stderr(), $($format)*).unwrap());
}
#[allow(unused)]
macro_rules! debugln {
    ($($format:tt)*) => (writeln!(std::io::stderr(), $($format)*).unwrap());
}


macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let mut s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};

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

macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };

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

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

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

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

fn main() {
    input! {
        n: usize,
        k: usize,
        h: [usize; n],
    }

    if k >= n {
        println!("0");
        return;
    }

    let mut h = h;
    h.sort();
    let sum: usize = (&h[0..(n - k)]).iter().sum();
    println!("{}", sum);
}


Measured memory_bytes: 9464
#include<bits/stdc++.h>
using namespace std;
#define MN 100055
char ch[MN];
int f[MN],tot[MN];
int Find(int a){
	return a==f[a]?a:(f[a]=Find(f[a]));
}
int main(){
	scanf("%s",ch+1);
	int n=strlen(ch+1);
	for(int i=1;i<=n;++i)f[i]=i;
	for(int i=1;i<=n;++i){
		if(ch[i]=='L')f[i]=Find(i-1);
		if(ch[i]=='R'&&ch[i+1]=='R')f[i]=Find(i+1);
	}
	for(int i=1;i<=n;++i){
		if(ch[i]=='L')f[i]=Find(i-1);
		if(ch[i]=='R'&&ch[i+1]=='R')f[i]=Find(i+1);
		int ans=((abs(f[i]-i))&1)?(f[i]+1):f[i];
		tot[ans]++;
	}
	for(int i=1;i<=n;++i)printf("%d ",tot[i]);
	return 0;
} 


Measured memory_bytes: 2432
#include<algorithm>
#include<complex>
#include<ctype.h>
#include<iomanip>
#include<iostream>
#include<map>
#include<math.h>
#include<numeric>
#include<queue>
#include<set>
#include<stack>
#include<stdio.h>
#include<string>
#include<string>
#include<vector>

using namespace std;
typedef long long ll;

#define FOR(i,a,b) for(ll i=(a);i<(b);++i)
#define ALL(v) (v).begin(), (v).end()
#define p(s) cout<<(s)<<endl
#define p2(s, t) cout << (s) << " " << (t) << endl
#define br() p("")
#define pn(s) cout << (#s) << " " << (s) << endl
#define p_yes() p("YES")
#define p_no() p("NO")

template < typename T >
void vprint(T &V){
	for(auto v : V){
    	cout << v << " ";
	}
	cout << endl;
}

const ll mod = 1e9 + 7;
const ll inf = 1e18;

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

    // input
    string s;
    cin >> s;

    s[3] = '8';
    p(s);
    
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define F first
#define S second
#define pii pair<int, int>
#define eb emplace_back
#define all(v) v.begin(), v.end()
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rep3(i, l, n) for (int i = l; i < (n); ++i)
#define sz(v) (int)v.size()
const int inf = 1e9 + 7;
const ll INF = 1e18;
int mod = 1000000007;
#define abs(x) (x >= 0 ? x : -(x))
#define lb(v, x) (int)(lower_bound(all(v), x) - v.begin())
#define ub(v, x) (int)(upper_bound(all(v), x) - v.begin())
template<typename T1, typename T2> inline bool chmin(T1 &a, T2 b) { if (a > b) { a = b; return 1; } return 0; }
template<typename T1, typename T2> inline bool chmax(T1 &a, T2 b) { if (a < b) { a = b; return 1; } return 0; }
template<typename T> T gcd(T a, T b) { if (b == 0) return a; return gcd(b, a % b); }
template<typename T> T lcm(T a, T b) { return a / gcd(a, b) * b; }
ll pow(ll a, int b) { return b ? pow(a * a, b / 2) * (b % 2 ? a : 1) : 1; }
ll modpow(ll a, ll b, ll _mod) { return b ? modpow(a * a % _mod, b / 2, _mod) * (b % 2 ? a : 1) % _mod : 1; }
template<class T> ostream& operator << (ostream& os, const vector<T>& vec) { for (auto &vi: vec) os << vi << " "; return os; }
template<class T, class U> ostream& operator << (ostream& os, const pair<T, U>& p) { os << p.F << " " << p.S; return os; }
template<typename T >inline istream& operator >> (istream& is, vector<T>& v) { rep(j, sz(v)) is >> v[j]; return is; }
template<class T> inline void add(T &a, int b) { a += b; if (a >= mod) a -= mod; }


void solve();

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cout << fixed << setprecision(10);

  int T;
  // cin >> T;
  T = 1;

  while (T--) {
    solve();
  }
}

void solve() {
  int n, m;
  cin >> n >> m;
  vector<int> a(m);
  cin >> a;
  a.eb(inf); // debuged
  vector<int> dp(100005);
  dp[0] = 1;
  rep(i, 100001) {
    if (*lower_bound(all(a), i) == i) continue;
    add(dp[i + 1], dp[i]);
    add(dp[i + 2], dp[i]);
  }
  cout << dp[n] << endl;
}


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

using namespace std;

int main()
{
	int t;
	t=1;
	while(t--)
	{
	int l,r,d,i,j;
	
	int n;
	cin>>n;
	l=1;
	r=n;
	j=0;
	for(i=l;i<=r;i++)
	{
		cin>>d;
		if(d%2!=0)
		{
		   if(i%2!=0)
		   j++;
			
		}
		
	}
	
	cout<<j<<endl;
	
	}



}


Measured memory_bytes: 3636
#include<iostream>
#include<algorithm>
#include<numeric>
#include<iomanip>
using namespace std;
bool myfunction(int i, int j) { return (i > j); }
int main()
{
	int N, M, value[101] = { 0 }, max = 0,pass=1;
	cin >> N >> M;
	for (int i = 1; i < N+1; i++)
	{
		cin >> value[i];
		max+= value[i];
	}
	sort(value+1, value + N+1, myfunction);
	for (int i = 1; i < M + 1;i++)
	{
		if (value[i] < max / (4.0 * M))
		{
			//cout << "X"<<endl;
			pass = 0;
		}
		else
		{
			//cout << "O" << endl;
		}

		//cout << value[i] << " " << max / (4.0 * M) << endl;
	}
	/*
	cout << "max" << max<<endl;
	cout << "select" << value[M] << endl;
	cout << "select" << max / (4 * M) << endl;*/
	if (pass)
	{
		cout << "Yes";
	}
	else
	{
		cout << "No";
	}
}






Measured memory_bytes: 256
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using ld=long double;
using st=string;
using ch=char;
typedef pair<ll,ll> P;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<P> vP;
typedef vector<ch> vc;
typedef vector<vc> vvc;
#define FOR(i,a,b) for(ll i=a;i<b;i++)
#define rep(i,n) FOR(i,0,n)
#define ROF(i,a,b) for(ll i=a;i>=b;i--)
#define per(i,a) ROF(i,a,0)
#define pb push_back
#define mp make_pair
const ll MOD=1000000007;
const ll MOD2=998244353;
const ld PI=acos(-1);
const ll INF=1e18;
st abc="abcdefghijklmnopqrstuvwxyz";
st ABC="ABCDEFGHIJKLMNOPQRSTUVWXYZ";
struct edge{ll to,cost;};

int main() {
    ll x,y;
    cin >> x >>y;
    if(y%2==0){
        if(2*x<=y&&y<=4*x){
            cout << "Yes" << endl;
            return 0;
        }
    }
    cout << "No" << endl;
}

Measured memory_bytes: 3592
#include<bits/stdc++.h>
using namespace std;
#define MP make_pair
#define x first
#define y second
#define bcnt(S) __builtin_popcountll(S)

const int N = 510;
const int M = 1e9 + 7;
const int MN = 1e5 + 1000;
const double eps = 1e-10;

typedef long long ll;
typedef pair<int, int> PII;

map<int, int, greater<int> >x;
map<int, int, greater<int> >::iterator it;

int main ()
{
	int n, a;
	scanf("%d", &n);
	for(int i = 0; i < n; i++){
		scanf("%d", &a);
		x[a]++;
	}
	
	int cnt = 0;
	ll sum = 0;
	for(it = x.begin(); it != x.end(); it++){
		while(it->y >= 2){
			cnt++;
			if(cnt > 1){
				sum *= it->x; break;
			}else sum = it->x;
			it->y -= 2;
		}
		if(cnt > 1) break;
	}
	
	if(cnt != 2) sum = 0;
	printf("%lld\n", sum);
	
	return 0;
}

Measured memory_bytes: 4992
#include <set>
#include <map>
#include <cmath>
#include <queue>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <algorithm>
using namespace std;
#define x first
#define y second
#define pb push_back
#define ppb pop_back
#define pf push_front
#define ppf pop_front
#define ll long long
#define ld long double
#define ii pair<int,int>
#define ull unsigned long long
#define all(k) k.begin(),k.end()
#define rall(k) k.rbegin(),k.rend()
#define db(x) cerr<<#x<<" = "<<x<<endl
#define len(v) ((int)v.size())
#define endl '\n'



void solve(){
  int n,m;
  cin>>n>>m;
  vector<int> a(n,-1);
  vector<ii> regras;
  while(m--){
    int s,c;
    cin>>s>>c;
    regras.pb({s,c});
    a[s-1]=c;
  }

  for(auto &p : regras){
    if(a[p.x-1]!=p.y){
      cout<<-1<<endl;
      return;
    }
  }

  if(a[0]==-1) a[0]= n>1?1:0;
  for(int i=1;i<n;i++) if(a[i]==-1) a[i]=0;

  if(a[0]==0 and n!=1){
    cout<<-1<<endl;
    return;
  }

  for(auto &v : a) cout<<v;
  cout<<endl;

}
int32_t main(){
  ios::sync_with_stdio(0); cin.tie(0);
  int t; 
#ifdef TESTCASE
  cin>>t;
#else 
  t = 1;
#endif
  while(t--) solve();
}


Measured memory_bytes: 256
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let mut s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};

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

macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };

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

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

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

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

// x ** n % mods を求める
pub fn mod_pow(x: i64, n: i64, mods: i64) -> i64 {
    if n == 0 {
        return 1;
    }
    let mut res = mod_pow(x * x % mods, n / 2, mods);
    if n % 2 == 1 {
        res = res * x % mods;
    }
    return res;
}

// (1/n) % mods を求める
pub fn mod_inv(n: i64, mods: i64) -> i64 {
    return mod_pow(n, mods-2, mods);
}

// nCk % mods を求める
pub fn mod_comb(n: i64, k: i64, mods: i64) -> i64 {
    let sum1 = (n-k+1..n+1).fold(1, |ac, x| ac * x % mods);
    let sum2 = (1..k+1).fold(1, |ac, x| ac * x % mods);
    return sum1 * mod_inv(sum2, mods) % mods;
}


fn main() {
    input!{
        x: usize,
        y: usize,
        z: usize,
    }
    println!("{} {} {}", z, x, y);
}


Measured memory_bytes: 4352
#include <bits/stdc++.h> 
using namespace std;
#define int long long
#define ld long double
#define fi first
#define se second
#define pb push_back
#define pii pair<int,int>
#define all(x) (x).begin(), (x).end()
const int MOD = 1e9+7;
int mpow(int a,int b,int p=MOD){a=a%p;int res=1;while(b>0){if(b&1)res=(res*a)%p;a=(a*a)%p;b=b>>1;}return res%p;}
const int N=1e3+2;

int32_t main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	#ifdef LOCAL
	freopen("input.txt", "r", stdin);
	// freopen("out10.txt","w",stdout);
	#endif
	string s;
	cin>>s;
	if(s[2]==s[3]&&s[4]==s[5])
	{
		cout<<"Yes\n";
	}
	else cout<<"No\n";
}
// Don't be afraid to fail. Be afraid not to try.
// "Become grindian instead of greendian" - aryanc403
// When you want to succeed as bad as you want to breathe, only then you’ll Be Successful!
// No Matter,How Fast You Are Driving If You Are Driving in a Wrong Direction You Will Never Reach Your Destination
// When failures hit you, you hit the failures back with Bounce Back!
// When you face failures, Don’t change your goal, Change your strategy!

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

#define rep(i,n) for(int i = 0 ; i < n ; i++) 
#define MAX 300
typedef pair<int,int> P;

class Dice{
private:
  int tmp;
public:
  int d[6];

  Dice(){
    for(int i = 0 ; i < 6 ; i++){
      d[i] = i+1;
    }
  } 

  void rollN(){
    tmp = d[0];
    d[0] = d[1];
    d[1] = d[5];
    d[5] = d[4];
    d[4] = tmp;
  }
  
  void rollE(){
    tmp = d[0];
    d[0] = d[3];
    d[3] = d[5];
    d[5] = d[2];
    d[2] = tmp;
  }
 
  void rollS(){
    tmp = d[0];
    d[0] = d[4];
    d[4] = d[5];
    d[5] = d[1];
    d[1] = tmp;
  }
 
  void rollW(){
    tmp = d[0];
    d[0] = d[2];
    d[2] = d[5];
    d[5] = d[3];
    d[3] = tmp;
  }

  void rotation(){
    tmp = d[1];
    d[1] = d[3];
    d[3] = d[4];
    d[4] = d[2];
    d[2] = tmp;
  }

  void change(int top,int front){
    rep(i,3){
      rollN();
      if(top == d[0]){
        break;
      }
      rollW();
      if(top == d[0]){
        break;
      }
    }
    rep(i,3){
      if(front == d[1]){
        break;
      }
      rotation();
    }
  }
};

map<P,int> num;
int field[MAX][MAX];

void init(){
  num.clear();
  for(int i = 0 ; i < MAX ; i++){
    for(int j = 0 ; j < MAX ; j++){
      field[i][j] = -1;
    }
  }
}

bool check(P a, P b){
  return num[a] > num[b];
}

int main(){
  int N;
  const int dx[] = {0,1,-1,0};
  const int dy[] = {1,0,0,-1};
  while(cin >> N, N){
    int t, f;
    Dice dice;
    init();
    for(int i = 0 ; i < N ; i++){
      int x = 150, y = 150;
      cin >> t >> f;
      dice.change(t, f);
      if(i == 0){
        num[P(y,x)]++;
        field[y][x] = dice.d[0];
      }else{
        while(true){
          int pos = 0, max = 0;
          for(int j = 1 ; j < 5 ; j++){
            if(dice.d[j] < 4) continue;
            int nx = x + dx[j-1];
            int ny = y + dy[j-1];
            if(max < dice.d[j] && check(P(y,x),P(ny,nx))){
              max = std::max(max,dice.d[j]);
              pos = j-1;
            }
          }
          if(max == 0){
            num[P(y,x)]++;
            field[y][x] = dice.d[0];
            break;
          }

          x += dx[pos];
          y += dy[pos];

          switch(pos){
          case 0:
            dice.rollS();
            break;
          case 1:
            dice.rollE();
            break;
          case 2:
            dice.rollW();
            break;
          case 3:
            dice.rollN();
            break;
          }
        }
      }
    }
    int cnt[6] = {0};
    for(int i = 0 ; i < MAX ; i++){
      for(int j = 0 ; j < MAX ; j++){
        if(field[i][j] != -1){
          cnt[field[i][j]-1]++;
        }
      }
    }
    for(int i = 0 ; i < 6 ; i++){
      if(i == 5) cout << cnt[i] << endl;
      else cout << cnt[i] << " ";
    }
  }

  return 0;
}

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

int main(void) {
    int m, f, r;
    int sum;

    while(true) {
        cin >> m >> f >> r;
        if(m == -1 && f == -1 && r == -1) {
            break;
        }
        sum = m + f;
        if(m == -1 || f == -1) {
            cout << 'F' << endl;
        } else {
            if(sum >= 80) {
                cout << 'A' << endl;
            } else if(sum >= 65) {
                cout << 'B' << endl;
            } else if(sum >= 50) {
                cout << 'C' << endl;
            } else if(sum >= 30) {
                if(r >= 50) {
                    cout << 'C' << endl;
                } else {
                    cout << 'D' << endl;
                }
            } else {
                cout << 'F' << endl;
            }
        }
    }
    return 0;
}



Measured memory_bytes: 3108
from sys import stdin
nii=lambda:map(int,stdin.readline().split())
lnii=lambda:list(map(int,stdin.readline().split()))

n=int(input())
s=input()

x=0
ans=0
for i in s:
  if i=='I':
    x+=1
  else:
    x-=1
  ans=max(ans,x)

print(ans)

Measured memory_bytes: 9188
using System;
using System.Collections.Generic;
using System.Linq;

public class AtCoderA
{
    static void Main()
    {
        int a;
        int b;
        {
            var line = Console.ReadLine();
            var words = line.Split(' ');
            a = int.Parse(words[0]);
            b = int.Parse(words[1]);
        }

        Console.WriteLine((a >= 10 || b >= 10) ? -1 : a * b);
    }
}

Measured memory_bytes: 13140
#include<stdio.h>
int main(){
    char str[1001]={};
    int i,len;
   
   
   // for(i=0;str[i]!=('\n');i++)
     //   scanf("%c",str[i]);
   
    
    
    while(1){
        scanf("%s",str);
        len=strlen(str);
        int sum=0;
        int A[1001]={};
        if(len==1&&str[0]=='0')
            break;

        for(i=0;i<len;i++)
            A[i]=str[i]-'0';
    
 
    
        for(i=0;i<1001;i++)
            sum+=A[i];
        
        printf("%d\n",sum);
    
    }
        
}



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

int main(){
  int N, count = -1;
  cin >> N;
  
  vector<int> vec(N);
  bool conti = true;
  for (int i = 0; i < N; i++){
    cin >> vec.at(i);
  }
  
  while (conti){
    count++;
    for (int i = 0; i < N; i++){
      if(vec.at(i) % 2 == 1){
        conti = false;
        break;
      }
      vec.at(i) /= 2;
    }
  }
  
  cout << count << endl;
  
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <cassert>
#include <cstdlib>
using namespace std;

int n;
int s[100];
bool dp[101][10001];

signed main() {
	int i, j;
	
	cin >> n;
	for (i = 0; i < n; i++) cin >> s[i];
	
	dp[0][0] = true;
	for (i = 0; i < n; i++) {
		for (j = 0; j <= 9900; j++) {
			dp[i + 1][j] |= dp[i][j];
			dp[i + 1][j + s[i]] |= dp[i][j];
		}
	}
	
	for (j = 10000; j > 0; j--) {
		if (dp[n][j] && j % 10 != 0) {
			cout << j << endl;
			return 0;
		}
	}
	cout << 0 << endl;
	return 0;
}

Measured memory_bytes: 1280
#include<iostream>
#include<fstream>
#include<string>
using namespace std;
int main()
{
    long long a, b, c;
    cin >> a;
    cin >> b;
    cin >> c;
    if(a%2 == 0 || b%2 == 0 || c%2 == 0)
        cout << 0 << endl;
    else
        cout << min(min(a*b, b*c), a*c) << endl;
    return 0;
}

Measured memory_bytes: 256
package main

import (
	"bufio"
	"fmt"
	"math"
	"os"
	"sort"
	"strconv"
	"strings"
)

var sc = bufio.NewScanner(os.Stdin)

func oneInt() int {
	var a int
	fmt.Scan(&a)
	return a
}
func oneStr() string {
	var a string
	fmt.Scan(&a)
	return a
}

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

func scanNums() (nums []int) {
	s := nextLine()
	numStr := strings.Split(s, " ")

	for _, n := range numStr {
		i, _ := strconv.Atoi(n)
		nums = append(nums, i)
	}
	return nums
}

func scanStrings() (strs []string) {
	s := nextLine()
	list := strings.Split(s, " ")
	strs = append(strs, list...)
	return strs
}

func abs(a int) int {
	return int(math.Abs(float64(a)))
}

func pow(p, q int) int {
	return int(math.Pow(float64(p), float64(q)))
}

func min(nums ...int) int {
	if len(nums) == 0 {
		panic("funciton min() requires at least one argument.")
	}
	res := nums[0]
	for i := 0; i < len(nums); i++ {
		res = int(math.Min(float64(res), float64(nums[i])))
	}
	return res
}

func max(nums ...int) int {
	if len(nums) == 0 {
		panic("funciton max() requires at least one argument.")
	}
	res := nums[0]
	for i := 0; i < len(nums); i++ {
		res = int(math.Max(float64(res), float64(nums[i])))
	}
	return res
}

func strSearch(a []string, b string) bool {
	for i := 0; i < len(a); i++ {
		if a[i] == b {
			return true
		}
	}
	return false
}

func sortAsc(a []int) []int {
	sort.Ints(a)
	return a
}

func sortDesc(a []int) []int {
	sort.Sort(sort.Reverse(sort.IntSlice(a)))
	return a
}

func gcd(a, b int) int {
	if b == 0 {
		return a
	}
	return gcd(b, a%b)
}

func lcm(a, b int) int {
	if a == 0 && b == 0 {
		return 0
	}
	return a * b / gcd(a, b)
}


func main() {
	X := oneInt()
	A := oneInt()
	if X < A {
		fmt.Print(0)
	} else {
		fmt.Print(10)
	}
}

Measured memory_bytes: 640
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <cstring>
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include <cmath>
#include <numeric>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
typedef unsigned long long ll;


int main(){
	ll X; cin >> X;
	ll B = 100;
	int count = 0;
	while(true){
		if(B >= X){
			break;
		}
		count++;
		B += B / 100;
	}
	cout << count << endl;
}

Measured memory_bytes: 3636