akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>

typedef long long ll;
typedef long double ld;

#define n1		      "\n"
#define B                     begin()
#define E                     end()
#define F                     first
#define S                     second
#define pb                    push_back
#define pf                    push_front
#define popb                  pop_back()
#define popf                  pop_front()

const int BIG=1e5+55;
const int BIGG=1e9+7;
const ll BIGGE=1e12+55;
const double SML=(1e-7);

using namespace std;

    int n,l;
    ll a[2*BIG];
    ll ans;
    /** 5 5 5 4 3 2
      3 5 2
    5       5
        4 */

int main()
{
    ios::sync_with_stdio(false); cin.tie(NULL);
    cout.tie(NULL);
    cin >>n;
    l = n-2;
    for (int i=0; i<n; i++)
        cin >>a[i];
    sort(a , a+n , greater<ll> ());
    ans += a[0];
    for (int i=1; i<n; i++) {
        if (l > 1) {
            ans += a[i]*2;
            l -= 2;
        }
        else if (l > 0) {
            ans += a[i];
            l--;
        }
    }
    cout <<ans;




    return 0;
}


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

#define ll long long
const int MOD = 1e9 + 7;
#define INF 2e9

#define REPS(i, a, n) for (ll i = (a); i < (ll)(n); ++i)
#define REP(i, n) REPS(i, 0, n)
#define RREP(i, n) REPS(i, 1, n + 1)
#define DEPS(i, a, n) for (ll i = (a); i >= (ll)(n); --i)
#define DEP(i, n) DEPS(i, n, 0)
#define EACH(i, n) for (auto&& i : n)

#define MATCH(_str, _ptn) regex_match(_str, regex(_ptn))
#define REPLACE(_str, _ptn, _replacement) regex_replace(_str, regex(_ptn), _replacement)

# define pb push_back

# define INIT() cin.tie(0); ios::sync_with_stdio(false); cout << fixed << std::setprecision(20)

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


int main() {
    INIT();
    ll n,d,cnt = 0;

    cin >> n >> d;
    for(ll i = 0; i < n; i++) {
        ll x,y;
        cin >> x >> y;
        if(sqrt(x * x + y * y) <= d) {
            cnt++;
        }
    }
    cout << cnt;
}

Measured memory_bytes: 3668
H, W = [int(x) for x in input().split()]

grid = []
for h in range(H):
    a = input()
    if '#' in a:
        grid.append(a)

white = set()
for w in range(W):
    if all(l[w] == '.' for l in grid):
        white.add(w)

H = len(grid)

for l in grid:
    print("".join(l[w] for w in range(W) if w not in white))





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

int main()
{
  double x1,y1, x2,y2;
  cin >> x1 >> y1 >> x2 >> y2;
  double result;
  result = sqrt( (x1-x2)*(x1-x2) + (y1-y2)*(y1-y2) );
  printf("%.8lf\n", result);
}

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

int main(){
    string s;
    cin >> s;
    for (int bit = 0; bit < (1<<3); ++bit){
        int ans = s[0] - '0';
        rep(j, 3){
            if (bit & (1<<j)) ans += s[j + 1] - '0';
            else ans -= s[j + 1] - '0';
        }
        if (ans == 7){
            rep(j, 3){
                cout << s[j];
                if (bit & (1<<j)) cout << '+';
                else cout << '-';
            }
            cout << s[3]  << "=7" << endl;
            break;
        }
    }
    return 0;
}

Measured memory_bytes: 256
n = int(input())

t, a = map(int, input().split())
x = list(map(int, input().split()))
mini = abs(a - (t - x[0] * 0.006))
ans = 1
for i in range(0, n):
    if mini > abs(a - (t - x[i] * 0.006)):
        mini = abs(a - (t - x[i] * 0.006))
        ans = i + 1

print(ans)

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

int main()
{
    int n;
    std::cin >> n;
    std::vector<std::pair<int,int>> red(n), blue(n);
    for(int i = 0; i < n; i++)std::cin >> red[i].first >> red[i].second;
    for(int i = 0; i < n; i++)std::cin >> blue[i].first >> blue[i].second;
    std::sort(red.begin(),red.end());
    std::sort(blue.begin(),blue.end());

    int cnt = 0;
    for(int b = 0; b < n; b++){
        auto itr = std::lower_bound(red.begin(),red.end(),std::make_pair(blue[b].first , 0));
        int max = -1;
        auto max_itr = red.end();
        for(auto i = red.begin(); i != itr; i++){
            if(i->second > max && i -> second < blue[b].second){
                max = i -> second;
                max_itr = i;
            }
        }
        if(max_itr == red.end())continue;
        red.erase(max_itr);
        cnt++;
    }
    std::cout << cnt << std::endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <sstream>
#include <set>
#include <map>
#include <iostream>
#include <utility>
#include <cctype>
#include <queue>
#include <stack>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <unordered_set>
#include <unordered_map>
#include <limits.h>
#include <cstring>
#include <tuple>
#include <cassert>
#include <numeric>
using namespace std;
// type alias
typedef long long LL;
typedef vector < int > VI;
typedef unordered_map < int, int > MAPII;
typedef unordered_set < int > SETI;
typedef pair< int , int > II;
typedef tuple< int, int, int > III;
// repetition
#define FORE(i,a,b) for(int i=(a);i<=(b);++i)
#define REPE(i,n)  for(int i=0;i<=(n);++i)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  for(int i=0;i<(n);++i)
#define FORR(x,arr) for(auto& x:arr)
#define SZ(a) int((a).size())
// DP
#define MINUS(dp) memset(dp, -1, sizeof(dp))
#define ZERO(dp) memset(dp, 0, sizeof(dp))
// minmax
#define SMAX(a,b) a = max(a,b)
#define SMIN(a,b) a = min(a,b)
// debug cerr
#define TRACE true
#define dump(x) if(TRACE) { cerr << #x << " = " << (x) << endl; }
#define dump2(x,y) if(TRACE) { cerr << #x << " = " << (x) << ", " << #y << " = " << (y) << endl; }
#define dump3(x,y,z) if(TRACE) { cerr << #x << " = " << (x) << ", " << #y << " = " << (y) << ", " << #z << " = " << (z) << endl; }
#define dump4(x,y,z,a) if(TRACE) { cerr << #x << " = " << (x) << ", " << #y << " = " << (y) << ", " << #z << " = " << (z) << ", " << #a << " = " << (a) << endl; }
#define dumpAR(ar) if(TRACE) { FORR(x,(ar)) { cerr << x << ','; } cerr << endl; }

/*

 6/23/2018 ARC099
 
 21:00-21:17 ACC
 
 Editorials:
  - https://img.atcoder.jp/arc099/editorial.pdf
  - https://youtu.be/aTMRqHCZHaA?t=1265
  - http://drken1215.hatenablog.com/entry/2018/06/24/003500
  - http://hamko.hatenadiary.jp/entry/2018/06/23/232445

 Tweets:
  - https://togetter.com/li/1240118
  - https://twitter.com/satanic0258/status/1010518785072091136
  - https://twitter.com/evima0/status/1010519641666404353
  - https://twitter.com/tanakh/status/1010520181586608128
  - https://twitter.com/beet_aizu/status/1010517902158487552
  - https://twitter.com/btk15049/status/1010518530146496512
  - https://twitter.com/hagyu_aya/status/1010518079690792960
  - https://twitter.com/rickytheta/status/1010518108178542592
  - https://twitter.com/_TTJR_/status/1010518888969166848
  - https://twitter.com/hamko_intel/status/1010518895038361600
 
*/

// $ g++ -std=c++14 -Wall -O2 -D_GLIBCXX_DEBUG x.cpp && ./a.out
// 9:17 AC
const int MAX_N=1e5+1;
LL A[MAX_N];
int N,K;

void solve_org() {
  int res=N;
  int p=-1;
  REP(i,N) if(A[i]==1) p=i;
  assert(p!=-1);
  
  FOR(i,p-K,p) {
    int l=max(0,i+1),r=max(0,N-(i+K)-1);
    int a=(l+K-2)/(K-1),b=(r+K-2)/(K-1);
    SMIN(res,a+b+1);
  }
  cout<<res<<endl;
}

void solve() {
  int res=(N-1+K-2)/(K-1);
  cout<<res<<endl;
}

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  
  cin>>N>>K;
  REP(i,N) cin>>A[i];
  solve();
  
  return 0;
}


Measured memory_bytes: 1024
#include<cstdio>

int ball[11], B[11], C[11];
int cnt1, cnt2;
bool flagb, flagc, flag;

void dfs(int cur) {
    if (flag)return;
    if (cur ==10) {
        flagb = 1, flagc = 1;
        if (cnt1 > 1) {
            for (int i = 0; i < cnt1 - 1; i++)
                if (B[i] > B[i + 1]) {
                    flagb = 0;
                    break;
                }
        }
        if (cnt2 > 1) {
            for (int i = 0; i < cnt2 - 1; i++)
                if (C[i] > C[i + 1]) {
                    flagc = 0;
                    break;
                }
        }

        if (flagb && flagc) {
            flag = 1;
            return;
        }
        return;
    }
    B[cnt1++] = ball[cur];
    dfs(cur + 1);
    cnt1--;
    C[cnt2++] = ball[cur];
    dfs(cur + 1);
    cnt2--;
}

void solve() {
    flag = 0;
    dfs(0);
    if (flag)printf("YES\n");
    else printf("NO\n");
}

int main() {
    int t;
    scanf("%d", &t);
    while (t--) {
        cnt1 = 0, cnt2 = 0;
        for (int i = 0; i < 10; i++)
            scanf("%d", &ball[i]);
        solve();
    }
    return 0;
}

Measured memory_bytes: 1008
import java.util.Scanner;

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

		while(true) {
			if(x == 2 || x == 3 || x == 5) {
				break;
			} else if(x%2 == 0 || x%3 == 0 || x%5 == 0) {
				x++;
				continue;
			}
			boolean sosu = false;
			for(int i = 7; i <= x; i++) {
				if(x%i == 0 && i != x) {
					// 自身以外の数で割り切れた場合は素数ではない
					x++;
					break;
				} else if(x%i == 0 && i == x) {
					sosu = true;
					break;
				}
			}
			if(sosu) {
				break;
			}
		}
		System.out.println(x);
	}
}

Measured memory_bytes: 22996
#include<algorithm>
#include<iostream>
#include<vector>
using namespace std;
typedef long long lint;
typedef vector<int>vi;
typedef pair<int,int>pii;
#define rep(i,n)for(int i=0;i<(int)(n);++i)

int main(){
  int n;
  cin>>n;
  int ans=0;
  while(1){
    ans=max(ans,__builtin_popcount(n));
    n++;
    n&=n-1;
    n--;
    if(n<0)break;
  }
  cout<<ans<<endl;
}



Measured memory_bytes: 3100
from numpy import *
n,M=map(int,input().split())
l=n*3+1
r=roll
d=zeros((l,n*5),int64)
d[0][0]=1
for i in range(1,l):j,k=i-1,i-2;d[i]=(d[i-3]*k*j+r(d[k],-1)*j+r(d[j],1))%M
print(d[-1][:l].sum()%M)


Measured memory_bytes: 481496
import collections
import math

def combination(n, m):
    return math.factorial(n) / (math.factorial(n - m) * math.factorial(m))

N = int(input())
S = []
for n in range(N):
    S.append(str(input()))

ans = 0
Y=[]
for s in S:
    X = []
    for w in s:
        X.append(w)
        X.sort()
        y = ''.join(X)
    Y.append(y)

c = collections.Counter(Y)
C = c.most_common()
len_C = len(C)

for n in range(len_C):
    if C[n][1] > 1:
        ans += combination(C[n][1], 2)
    else:
        pass

print(round(ans))

Measured memory_bytes: 31680
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;

int main(){

    ll A;
    string B;
    cin >> A >> B;

    int C[3];
    C[0] = B[0] - '0';
    C[1] = B[2] - '0';
    C[2] = B[3] - '0';

    ll D[3];
    D[0] = A * C[0] * 100;
    D[1] = A * C[1] * 10;
    D[2] = A * C[2];

    ll res = (D[0] + D[1] + D[2]) / 100;
    cout << res;
    return 0;
}

Measured memory_bytes: 3648
while True:
    w, h = map(int, input().split())
    if w == 0:
        break
    # タイルの情報を文字列配列として受け取る
    tile = [""] * h
    for i in range(h):
        tile[i] = input()
    # スタート地点探索
    ok = False
    for y in range(h):
        for x in range(w):
            if tile[y][x] == "@":
                s_x = x
                s_y = y
                ok = True
                break
        if ok:
            break
    # 幅優先探索
    count = 0
    check = [[s_x, s_y]]
    check_map = [[False for j in range(w)] for i in range(h)]
    while len(check) > 0:
        x, y = check.pop(0)
        if x in range(w) and y in range(h):
            if check_map[y][x] == False:
                if tile[y][x] == "." or tile[y][x] == "@":
                    check_map[y][x] = True
                    count += 1
                    check.append([x, y-1])
                    check.append([x, y+1])
                    check.append([x+1, y])
                    check.append([x-1, y])
    print(count)



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

const int N = 505;

int k;
int res[N][N];
int id[2*N], cur = 1;

int get(int i){
    if(id[i] == 0) return id[i] = cur++;
    else return id[i];
}

int main(){
    cin >> k;
    if(k == 1) return !printf("1\n1\n");
    int n = (k + 1) / 2;
    if(n % 2 != 0) n++;
    for(int i = 0; i < n; i++){
        for(int j = 0; j < n; j++){
            if(i % 2 == 1) res[i][j] = (i + j) % n;
            else res[i][j] = (i + j) % n + n;
        }
    }
    int cnt = 0;
    while(k < 2 * n){
        for(int i = 0; i < n; i++) res[i][(cnt-i + n) % n] = cnt;
        k++;
        cnt++;
    }
    cout << n << endl;
    for(int i = 0; i < n; i++){
        for(int j = 0; j < n; j++) cout << get(res[i][j]) << "\t";
        cout << endl;
    }
}

Measured memory_bytes: 2176
//https://atcoder.jp/contests/abc148/tasks/abc148_a
#include <bits/stdc++.h>
#if LOCAL
#include "dump.hpp"
#else
#define dump(...)
#endif
using namespace std;
using ll=long long;
#define FOR(i,a,b) for(ll i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
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;}
int main() {
    ll A,B; cin>>A>>B;    
    FOR(i,1,4){
        if(A!=i&&B!=i){
            cout<<i<<endl;
            break;
        }
    }
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <array>
#define repeat_reverse(i, n) for (int i = (n)-1; (i) >= 0; --(i))
using ll = long long;
using namespace std;

int main() {
    string s; cin >> s;
    int n = s.size();
    array<int, 26> cnt = {};
    ll result = 1;
    repeat_reverse (i, n) {
        char c = s[i] - 'a';
        cnt[c] += 1;
        result += n - i - cnt[c];
    }
    cout << result << endl;
    return 0;
}


Measured memory_bytes: 888
/**
*    created: 28.06.2020 01:44:53
**/
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#define int long long
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define pcnt(bit) __builtin_popcountll(bit)
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;}
const int mod = 1000000007;
const long double pi = acos(-1.0);
const int inf = 1LL << 60;

signed main() {

    cin.tie(0);
    ios_base::sync_with_stdio(false);

    int n;
    cin >> n;
    vector<int> a(n);
    rep(i,n) cin >> a[i];
    rep(i,n) a[i] -= i+1;
    sort(all(a));
    int ans = 0;
    if (n % 2 == 1) {
        int q = a[(n+1)/2-1];
        rep(i,n) ans += abs(q-a[i]);
        cout << ans << endl;
    }
    else {
        int l = a[n/2-1];
        int r = a[n/2];
        int p;
        int sum = inf;
        for (int i = l; i <= r; i++) {
            if (abs(i-l)+abs(i-r) < sum) {
                sum = abs(i-l)+abs(i-r);
                p = i;
            }
        }
        rep(i,n) ans += abs(p-a[i]);
        cout << ans << endl;
    }
    return 0;
}

Measured memory_bytes: 4788
s = list(input())
n = len(s)
k = int(input())
if k > n:
    K = n
else:
    K = k
anset = set()
for lenght in range(1,K+1):
    for i in range(n - lenght + 1):
        anset.add("".join(s[i:i+lenght]))
anset = list(anset)
anset.sort()
print(anset[k-1])     

Measured memory_bytes: 40048
#include <iostream>
#include <vector>
#include <array>
#include <deque>
#include <queue>
#include <list>
#include <map>
#include <set>
#include <algorithm>
#include <numeric>
#include <utility>
#include <cmath>

using namespace std;
using i64=long long int;

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

    int sum = 0;
    int maxv = 0;
    for (int i = 0; i < N; ++i) {
        int v;
        cin >> v;
        maxv = max(maxv, v);
        sum += v;
    }

    cout << sum-maxv/2 << endl;

    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
using namespace std;
int main(void){
  string S;
  cin >> S;
  int N = S.size();
  
  string S_rev = S;
  reverse(S_rev.begin(),S_rev.end());
  
  int n1 = (N-1) / 2;
  string S1 = S.substr(0,n1);
  string S1_rev = S1;
  reverse(S1_rev.begin(),S1_rev.end());
  
  int n2 = (N+3) / 2;
  n2--;
  string S2 = S.substr(n2);
  string S2_rev = S2;
  reverse(S2_rev.begin(),S2_rev.end());
  
  string answer = "No";
  if(S==S_rev && S1==S1_rev && S2==S2_rev){
    answer = "Yes";
  }

  cout << answer << endl;
}


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

ll pow2[100];
ll x[200];
ll n,idx,looknum;
ll i;

void pow_init(){

	pow2[0] = 1;
	for(int i=1;i<=60;i++){
		pow2[i] = pow2[i - 1] * 2;
	}
	
	return;
}

ll allL(ll n,ll looknum){

	ll mannaka = pow2[n-1];
	ll pos = looknum;
	ll up = 0,down = 0;
	while(1){
		if(mannaka == 0)break;
		if(pos <= mannaka){
			ll tmp = down;
			down = (up + down + 1) + up;
			up = tmp;
			pos = mannaka + 1 - pos;
		}else{
			up += (up + down + 1);
			pos -= mannaka;
		}
		if(mannaka == 1)break;
		mannaka /= 2;

	}
	return up + 1;
}

void encode(ll n,ll idx_simple,ll idx_aim){
	ll mannaka = pow2[n-1];
	ll cnt = 0;
	while(1){

		if(idx_simple <= mannaka && idx_aim <= mannaka){
			//cout << 0 << endl;
		}else if(idx_simple > mannaka && idx_aim > mannaka){
			//cout << 0 << endl;
			idx_simple -= mannaka;
			idx_aim -= mannaka;
		}else{
			x[cnt] = 1;
			//cout << 1 << endl;
			idx_simple = mannaka * 2 + 1 - idx_simple;
			if(idx_simple > mannaka){
				idx_simple -= mannaka;
				idx_aim -= mannaka;
			}
		}
		if(mannaka == 1)break;
		mannaka /= 2;
		cnt++;
	}
	return ;
}

void decode(ll n){
	ll tmp = 0;
	for(int i=n-1;i>=0;i--){
		if((x[i] + tmp) % 2 == 1){
			cout << "R";
		}else{
			cout << "L";
		}
		if(x[i])tmp++;
	}
	cout << endl;
	return ;

}

bool solve(){
	cin >> n >> idx >> looknum;
	if(n == 0 && looknum == 0){
		return false;
	}
	for(i=0;i<=2*n + 10;i++){
		x[i] = 0;
	}
	ll idx_simple = allL(n,looknum);
	//cout << idx_simple << endl;
	encode(n,idx_simple,idx);
	decode(n);
	return true;
}


int main(){
	pow_init();
	while(solve()){};
}


Measured memory_bytes: 3084
H,W,D = map(int,input().split())
px = [0]*90001
py = [0]*90001
for i in range(H):
    A = list(map(int,input().split()))
    for j in range(len(A)):
        px[A[j]] = i+1
        py[A[j]] = j+1
d = [0]*90001
Q = int(input())
for i in range(D+1,H*W+1,1):
    d[i] = d[i-D] + abs(px[i]-px[i-D]) + abs(py[i]-py[i-D])
for _ in range(Q):
    l,r = map(int,input().split())
    print(d[r]-d[l])

Measured memory_bytes: 79160
#include <bits/stdc++.h>
#define IOS ios::sync_with_stdio(false);
#define Accepted 0
using namespace std;
typedef long long ll;
const int maxn = 1000000 + 10;
const int INF = 1e9 + 7;
const int MOD = 1e9 + 7;
const double eps = 1e-10;
const double pi = acos(-1);
int T, cases, n, m;
struct node
{
    char t, d;
}a[maxn];
string s;
int judge(int x)
{
    for(int i = 1; i <= m; i++)
    {
        if(s[x] == a[i].t)
        {
            if(a[i].d == 'R')x++;
            else x--;
            if(x == -1)return -1;
            if(x == n)return 1;
        }
    }
    return 0;
}
int main()
{
    IOS;
    cin >> n >> m >> s;
    for(int i = 1; i <= m; i++)cin >> a[i].t >> a[i].d;
    int l = 0, r = n - 1;
    int tmp = -1;
    while(l <= r)
    {
        int mid = (l + r) / 2;
        if(judge(mid) == -1)tmp = mid, l = mid + 1;
        else r = mid - 1;
    }
    int ans = tmp + 1;
    l = 0, r = n - 1;
    tmp = n;
    while(l <= r)
    {
        int mid = (l + r) / 2;
        if(judge(mid) == 1)tmp = mid, r = mid - 1;
        else l = mid + 1;
    }
    ans += n - tmp;
    ans = n - ans;
    cout<<ans<<endl;
    return Accepted;
}


Measured memory_bytes: 976
#include<stdio.h>

int keta(int num){
		int cnt = 0;

		while( num > 0){
				num /= 10;
				cnt++;
		}
		return cnt;
}

int main(void){
		int a;
		int b;

		while( scanf("%d %d",&a ,&b) != EOF){
				printf("%d\n",keta(a + b));
		}

		return 0;
}

Measured memory_bytes: 600
n = int(input())
a = tuple(map(int, input().split()))

a = tuple(a[i]+i for i in range(n))

d = {}
ret = 0
for i in range(n):
    q = i*2 - a[i]
    if q in d:
        ret = ret + d[q]
    if a[i] in d:
        d[a[i]] = d[a[i]] + 1
    else:
        d[a[i]] = 1

print(ret)


Measured memory_bytes: 34444
package main

import (
    "fmt"
)

var mp map[int]map[int]bool
var chk map[int]bool

func main() {
    var n, m int
    fmt.Scan(&n, &m)

    mp = make(map[int]map[int]bool)
    chk = make(map[int]bool)

    for i := 0; i < m; i++ {
        var x, y, z int
        fmt.Scan(&x, &y, &z)
        x--
        y--
        if _, ok := mp[x]; !ok {
            mp[x] = make(map[int]bool)
        }
        mp[x][y] = true
        if _, ok := mp[y]; !ok {
            mp[y] = make(map[int]bool)
        }
        mp[y][x] = true
    }

    var sum int
    for i := 0; i < n; i++ {
        sum += search(i)
    }
    fmt.Println(sum)
}

func search(pos int) int {
    if b, ok := chk[pos]; ok && b {
        return 0
    }
    chk[pos] = true
    for k, _ := range mp[pos] {
        search(k)
    }
    return 1
}


Measured memory_bytes: 57088
from itertools import groupby

s = input()
k = int(input())
a, b = [], []
count1, count2 = 0, 0

for key, group in groupby(s):
  a.append(list(group))

if len(a) == 1:
  if len(s)%2==1 and k%2==1:
    print(len(s)//2 + len(s)*(k-1)//2 )
  else:
    print(len(s)*k//2)
else:
  for key, group in groupby(s*2):
    b.append(list(group))  

  for i in a:
    count1 += len(i) // 2

  for i in b:
    count2 += len(i) // 2

  c = count2 - count1

  print(count1 + c*(k-1))


Measured memory_bytes: 3064
#include <algorithm>
#include <iostream>
#include <map>
#include <vector>

using namespace std;

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

  map<int, int> mp;
  for (int i = 0; i < n; i++) {
    int a;
    cin >> a;
    mp[a]++;
  }
  vector<pair<int, int>> vec;
  for (auto it = mp.begin(); it != mp.end(); it++) {
    int len = it->first;
    int cnt = it->second;
    if (cnt >= 2) {
      vec.push_back(make_pair(len, cnt));
    }
  }
  sort(vec.begin(), vec.end(), greater<pair<int, int>>());

  if (vec.size() == 0) {
    cout << 0 << endl;
    return 0;
  }

  long long len = vec[0].first;
  long long cnt = vec[0].second;

  if (cnt >= 4) {
    cout << len * len << endl;
  } else if (vec.size() < 2) {
    cout << 0 << endl;
  } else {
    cout << len * vec[1].first << endl;
  }

  return 0;
}

Measured memory_bytes: 4992
# -*- coding: utf-8 -*-
import sys
import copy
import collections
from bisect import bisect_left
from bisect import bisect_right
from collections import defaultdict
from heapq import heappop, heappush, heapify
import math
import itertools
import random
 
# NO, PAY-PAY
#import numpy as np
#import statistics
#from statistics import mean, median,variance,stdev
 
INF = float('inf')
def inputInt(): return int(input())
def inputMap(): return map(int, input().split())
def inputList(): return list(map(int, input().split()))
 
def main():
    s = list(input())
    ans = 0
    ss = -1
    e = -1
    for i,val in enumerate(s):
        if val == "A":
            ss = i
            break
            
    s = s[::-1]
    for i,val in enumerate(s):
        if val == "Z":
            e = i
            break
            
    #print("{} {} {}".format(len(s),e,ss))
    print((len(s)-e)-ss)
            
            
if __name__ == "__main__":
	main()


Measured memory_bytes: 56700
#include <cmath>
#include <iostream>
#include <vector>

static bool primes[1000010];

int main()
{
    long long n, ans = 0, ip = 2;
    std::cin >> n;
    bool one = n == 1;
    long long size = std::sqrt(n) + 10;
    long long div, cp;
    bool test = true;
    while (n != 1 && ip < size) {
        if (test) {
            div = ip;
            while (div <= n && n % div == 0) {
                n /= div;
                div *= ip;
                ans++;
            }
            while (n % ip == 0) {
                n /= ip;
            }
        }
        for (long long i = ip; i < size; i += ip) {
            primes[i] = true;
        }
        cp = ip;
        for (long long i = ip + 1; i < size; i++) {
            if (!primes[i]) {
                ip = i;
                test = n % i == 0;
                break;
            }
        }
        if (cp == ip) {
            break;
        }
    }

    if (one) {
        std::cout << "0\n";
    } else if (ip == cp) {
        if (n == 1) {
            std::cout << "1\n";
        } else {
            std::cout << ans + 1 << "\n";
        }
    } else {
        std::cout << ans << "\n";
    }

    return 0;
}


Measured memory_bytes: 4656
#include <stdio.h>
#include <assert.h>
#include <fstream>
#include <iostream>
#include <algorithm>
#include <array>
#include <vector>
#include <queue>
#include <set>
#include <cmath>
//#include <unordered_map>
//#include <unordered_set>
//#include <boost/container/static_vector.hpp>
//#include <boost/unordered_set.hpp>
//#include <boost/unordered_map.hpp>
//#include <unistd.h>

//#include <cv.h>
//#include <highgui.h>
#include <stdlib.h>
#include <time.h>

#include <string>

std::string s;
int K;

int main(int argc, char **argv) {
    std::cin >> s;
    std::cin >> K;

    std::vector<std::string> vec;
    
    for (int i = 0; i < s.size(); i++) {
        for (int j = 1; j <= K; j++) {
            if (i + j <= s.size()) {
                vec.push_back(s.substr(i, j));
            }
        }
    }

    std::sort(vec.begin(), vec.end());

    std::string ret = "";
    int cnt = 0;
    for (int i = 0; i < vec.size() && cnt < K; i++) {
        if (vec[i] != ret) {
            ret = vec[i];
            cnt++;
        }
    }

    std::cout << ret << std::endl;

    return 0;
}

Measured memory_bytes: 1660
import java.util.Scanner;
public class Main {
	static int dfs(int total, int addv, int target, int n){ return n == 0 ? total == target ? 1 : 0 : addv > 9 ? 0 : dfs(total + addv, addv + 1, target, n - 1) + dfs(total, addv + 1, target, n); }
	public static void main(String[] args) {
		try(Scanner sc = new Scanner(System.in)){
			while(true){ int n = sc.nextInt(), s = sc.nextInt(); if(n == 0 && s == 0) break; System.out.println(dfs(0, 0, s, n)); }
		}
	}
}

Measured memory_bytes: 26244
N = int(input())
mod = 998244353
# DP ナップサックぽいやつ
# DP[i][j] := a_0からa_iまでの部分集合で和がjになるものの個数
# 配るDPの方が場合分けがなくて簡潔に書ける 計算量増えるかも
# DP[i-1][j]→DP[i][j]とDP[i][j + a_i ]に配る

aaa = [int(input()) for _ in range(N)]
sum_aaa = sum(aaa)

sum_now = 0
DP = [[0] * (sum_aaa+1) for i in range(N)]
DP2 = [[0] * (sum_aaa+1) for i in range(N)]

a = aaa[0]
DP[0][0] = 2
DP[0][a] = 1

DP2[0][0] = 1
DP2[0][a] = 1

sum_now += a

for i in range(1, N):
	a = aaa[i]
	sum_now += a
	for j in range(sum_now + 1):

		if (j >= a):
			DP[i][j] = DP[i-1][j]*2 + DP[i-1][j-a]
		else:
			DP[i][j] = DP[i-1][j]*2

		while (DP[i][j] > mod):
			DP[i][j] -= mod

	for j in range(min(sum_now + 1, int(sum_aaa /2)+1)):
		if (j >= a):
			DP2[i][j] = DP2[i-1][j] + DP2[i-1][j-a]
		else:
			DP2[i][j] = DP2[i-1][j]

		while (DP2[i][j] > mod):
			DP2[i][j] -= mod

# print(DP2)
minimum_invalid_length = int((sum_now+1)//2)
num_too_long = sum (DP[N-1][minimum_invalid_length:])
if (sum_aaa %2 == 0):
	num_too_long -= DP2[N-1][int(sum_aaa /2)]
# print(num_too_long)
# print(sum(aaa))
print((3** N - num_too_long * 3) % mod )


Measured memory_bytes: 457608
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include<math.h>
#define PI 3.141592653589793
#define MOD 1000000007

int main(){
	int n, m;
	scanf("%d%d", &n, &m);
	int au[50][50], bi[50][50];
	char ai[50];
	for(int i=0; i<n; i++){
		scanf("%s", ai);
		for(int j=0; j<n; j++){
			if(ai[j] == '.') au[i][j] = -1;
			else if(ai[j] == '#') au[i][j] = 1;
			else au[i][j] = 0;
		}
	}
	for(int i=0; i<m; i++){
		scanf("%s", ai);
		for(int j=0; j<m; j++){
			if(ai[j] == '.') bi[i][j] = -1;
			else bi[i][j] = 1;
		}
	}

	/*
	for(int i=0; i<n; i++){
		for(int j=0; j<n; j++){
			printf("%d ", au[i][j]);
		}
		printf("\n");
	}
	printf("\n");
	for(int i=0; i<m; i++){
		for(int j=0; j<m; j++){
			printf("%d ", bi[i][j]);
		}
		printf("\n");
	}
	*/

	int judge = m*m, answer=0;;
	for(int i=0; i<=n-m; i++){
		for(int j=0; j<=n-m; j++){
			if(bi[0][0] == au[i][j]){
				int count = 0;
				for(int k=0; k<m; k++){
					for(int l=0; l<m; l++){
						if(bi[k][l] == au[i+k][j+l]) count++;
					}
				}
				if(count == judge) answer = 1;
			}
		}
	}

	if(answer == 1) printf("Yes\n");
	else printf("No\n");

	return 0;
}

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

const int DIM = 2e5 + 5;

int arr[DIM];
bitset<DIM> aux, oki;

int main(void) {
    int n;
    cin >> n;
    
    for (int i = 1; i <= (n << 1) - 1; ++i)
        cin >> arr[i];
    
    int pos = -1;
    for (int le = 1, ri = (n << 1) - 1; le <= ri; ) {
        int md = (le + ri) >> 1; bool ok = false;
        
        for (int i = 1; i <= (n << 1) - 1; ++i) {
            aux[i] = (arr[i] >= md); oki[i] = false;
            
            if (i >= 2 and aux[i] == aux[i - 1])
                oki[i] = oki[i - 1] = true;
        }
        
        int mxl = -1e9;
        for (int i = n; i >= 1; --i)
            if (oki[i]) { mxl = i; break; }
        
        int mnr = 1e9;
        for (int i = n; i <= (n << 1) - 1; ++i)
            if (oki[i]) { mnr = i; break; }
        
        if (mxl == -1e9 and mnr == 1e9)
            ok = aux[1];
        else
            ok = (n - mxl <= mnr - n) ? aux[mxl] : aux[mnr];
        
        if (ok)
            le = md + 1, pos = md;
        else
            ri = md - 1;
    }
    
    cout << pos;
    return 0;
}

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

int main() {
    int n; cin>>n;
    int last=n%10;
    if(last==2 || last==4 || last==5 || last==7 || last==9) cout<<"hon"<<endl;
    else if(last==0|| last==1||last==6||last==8) cout<<"pon"<<endl;
    else if(last==3) cout<<"bon"<<endl;
}

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

#define REP(i, n) for (int i = 0; i < n; i++)
#define FOR(i, n, m) for (int i = n; i < m; i++)
#define ll long long int

using namespace std;

int main()
{
  int n,k;
  int h[100000];
  cin >> n >> k;
  REP(i,n) {
    cin >> h[i];
  }
  sort(h, h+n);

  int result = abs(h[n-1] - h[0]);
  REP(i,n) {
    if(i+k > n) break;
    result = min(result, abs(h[i+k-1] - h[i]));
  }
  cout << result << endl;
}


Measured memory_bytes: 640
#include <iostream>
#include <cstdio>
#include <cmath>
#define double long double
using namespace std;

double marume( double x ){
	long long t = x * 1000 + ((x > 0) ? 1 : -1) * 0.5;
	return t/1000.0;
}

int main(){
	int n;
	double tx, ty, x1, y1, x2, y2;
	
	cin >> n;
	while(n--){
		cin >> tx >> ty >> x1 >> y1 >> x2 >> y2;
		x1 -= tx; y1 -= ty;
		x2 -= tx; y2 -= ty;
		
		double dist1 = x1 * x1 + y1 * y1;
		double dist2 = x2 * x2 + y2 * y2;
		x1 *= 2; y1 *= 2;
		x2 *= 2; y2 *= 2;
		
		double detA = x1 * y2 - y1 * x2;
		double detX = dist1 * y2 - y1 * dist2;
		double detY = x1 * dist2 - dist1 * x2;
		double x = detX / detA; //if(x < 0){ x -= 1e-5; } else { x += 1e-5; }
		double y = detY / detA; //if(y < 0){ y -= 1e-5; } else { y += 1e-5; }
		double r = hypot(x, y) + 1e-7;
		
		x += tx;
		y += ty;
		
		x = marume(x);
		y = marume(y);
		r = marume(r);
		printf("%.3Lf %.3Lf %.3Lf\n", x, y, r);
	}
	return 0;
}

Measured memory_bytes: 1256
import java.util.*;


public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int W = sc.nextInt();
        int H = sc.nextInt();
        int x = sc.nextInt();
        int y = sc.nextInt();
        int r = sc.nextInt();
        
        if((x - r >= 0 && x + r <= W)&&(y - r >= 0 && y + r <= H)){
            System.out.println("Yes");
        }else{
            System.out.println("No");
        }
    }
}


Measured memory_bytes: 26300
n = int(input())
t = [0]*n
a = [0]*n
for i in range(n): t[i],a[i] = map(int,input().split())
tcnt = t[0]
acnt = a[0]
for i in range(1,n):
    x = max((tcnt+t[i]-1)//t[i],(acnt+a[i]-1)//a[i])
    tcnt = t[i]*x
    acnt = a[i]*x
print(tcnt+acnt)

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

int n;
int w, h;
int s, t;
int imos[101][101];

int main() {
  while (1) {
    scanf("%d", &n);
    if (n == 0) return 0;

    scanf("%d%d", &w, &h);
    for (int i=1; i<=h; i++) {
      for (int j=1; j<=w; j++) {
        imos[i][j] = 0;
      }
    }

    for (int i=0; i<n; i++) {
      int x, y;
      scanf("%d%d", &x, &y);
      imos[y][x] = 1;
    }

    for (int i=1; i<=h; i++) {
      for (int j=1; j<=w; j++) {
        imos[i][j] += imos[i][j-1];
      }
    }

    for (int j=1; j<=w; j++) {
      for (int i=1; i<=h; i++) {
        imos[i][j] += imos[i-1][j];
      }
    }

    scanf("%d%d", &s, &t);
    
    int ans = 0;
    for (int i=0; i+t<=h; i++) {
      int ni = i+t;
      for (int j=0; j+s<=w; j++) {
        int nj = j+s;
        int t = imos[ni][nj] - imos[i][nj] - imos[ni][j] + imos[i][j];
        ans = max(ans, t);
      }
    }

    printf("%d\n", ans);
  }
}

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

typedef long long ll;
const ll MOD = 1e9+7;

int main()
{
    ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
    ll l,r;
    cin>>l>>r;

    if(r-l+1>=2019){
        cout<<0;
        return 0;
    }

    ll ans=2020LL;
    for(ll i=l;i<=r;i++){
        for(ll j=i+1;j<=r;j++){
            ans=min(ans,i*j%2019LL);
        }
    }

    cout<<ans;
    return 0;
}


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

using namespace std;

int a[5];

int main() {
	for (int i = 0; i < 5; i++) scanf("%d", &a[i]);
	
	int res = 0;
	int mx = 0;
	
	for (int i = 0; i < 5; i++) {
		if (a[i] % 10 == 0) {
			res += a[i];
		}
		else {
			res += (a[i] / 10 + 1) * 10;
			mx = max(mx, 10 - a[i] % 10);
		}
	}
	
	printf("%d\n", res - mx);
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1000000007;
const long long INF = 9999999999999999;
using ll = long long;
int main(){
  int N;
  cin>>N;
  int a[N];
  int b[N];
  int c[N-1];
  for(int i = 0;i<N;i++){
    cin>>a[i];
  }
  for(int i = 0;i<N;i++){
    cin>>b[i];
  }
  for(int i = 0;i<N-1;i++){
    cin>>c[i];
  }
  int ans = 0;
  for(int i = 0;i<N;i++){
    ans += b[a[i]-1];
    if(i != N-1 && (a[i+1]-a[i]) == 1){
      ans += c[a[i]-1];
    }
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
#ifdef LOCAL
#define _GLIBCXX_DEBUG
#endif
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;++i)
#define rrep(i,n) for(int i=n-1;i>=0;--i)
#define reps(i,a,b) for(int i=a;i<b;++i)
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
#define sz(x) (int)(x).size()
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
using namespace std;
using ll = long long;
using P = pair<int, int>;
template<typename T> inline bool chmax(T &a,T b){if(a<b){a=b;return 1;}return 0;}
template<typename T> inline bool chmin(T &a,T b){if(b<a){a=b;return 1;}return 0;}
template<typename T> vector<T> make_vec(size_t a){return vector<T>(a);}
template<typename T,typename... Ts>
auto make_vec(size_t a,Ts... ts){return vector<decltype(make_vec<T>(ts...))>(a,make_vec<T>(ts...));}
template<typename T,typename U,typename... V>
typename enable_if<is_same<T,U>::value>::type fill_v(U &u,const V... v){u=U(v...);}
template<typename T,typename U,typename... V>
typename enable_if<!is_same<T,U>::value>::type fill_v(U &u,const V... v){for(auto &e:u)fill_v<T>(e,v...);}

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

    int w, h, x, y, r;
    cin >> w >> h >> x >> y >> r;
    if (x-r < 0 || w < x+r || y-r < 0 || h < y+r) puts("No");
    else puts("Yes");
}



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

int main(){
    using namespace std;
    unsigned long N;
    cin >> N;
    vector<unsigned long> a(N);
    for(auto& i : a)cin >> i;
    puts(~N & 1 && *min_element(a.begin(), a.end()) & 1 ? "First" : accumulate(a.begin(), a.end(), 0UL) & 1 ? "First": "Second");
    return 0;
}


Measured memory_bytes: 4416
import itertools
import numpy as np

N = int(input())
X = []
Y = []
for i in range(N):
    x, y = list(map(int, input().split()))
    X.append(x)
    Y.append(y)

lst = []
for I in list(itertools.permutations(range(N))):
    kyori = 0
    for i in range(N-1):
        kyori = kyori + ((X[I[i]]-X[I[i+1]])**2 +
                         (Y[I[i]]-Y[I[i+1]])**2) ** 0.5
    lst.append(kyori)

print(np.average(lst))

Measured memory_bytes: 18260
#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 ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
int N, A, B, C;
ll ANS = INF;


void dfs(int c, vector<int> &seq, vector<int> &vec) {
  if (c == N) {
    vector<int> res(4, 0);
    ll ans = 0;
    set<int, greater<int>> val;
    REP(i, N) {
      if (seq[i] == 3) {
        continue;
      }
      val.insert(seq[i]);
    }
    if (val.size() < 3) {
      return;
    }
    REP(i, N) {
      if (seq[i] == 3) {
        continue;
      }
      if (res[seq[i]] > 0) {
        ans += 10;
      }
      res[seq[i]] += vec[i];
    }
    ans += abs(A - res[0]);
    ans += abs(B - res[1]);
    ans += abs(C - res[2]);
    ANS = min(ANS, ans);
    return;
  }
  REP(i, 4) {
    seq[c] = i;
    dfs(c+1, seq, vec);
  }
}

int main()
{
  cin >> N >> A >> B >> C;
  vector<int> vec(N, 0);
  vector<int> seq(N, 0);
  REP(i, N) {
    cin >> vec[i];
  }
  dfs(0, seq, vec);
  cout << ANS << endl;
  return 0;
}

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

int main(void){
    int n;
    cin >> n;
    int m = n+1;
    int cnt = 0;
    rep(i,n) {
        int p;
        cin >> p;
        if (m >= p) {
            m = p;
            cnt++;
        }
    }
    cout << cnt << endl;
    return 0;
}


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

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int a, b, c, d;
	cin >> a >> b >> c >> d;
	if(a+b < c+d) cout << "Right" << endl;
	else if(a+b > c+d) cout << "Left" << endl;
	else cout << "Balanced" << endl;
	return 0;
}

Measured memory_bytes: 3652
import java.util.*; 

class Main{
public static void main(String[] args){
	Scanner sc=new Scanner(System.in);
        int n=sc.nextInt();
      	long ans=0;

  		char[][] ch=new char[n][10];
  		String[] s=new String[n];
		for(int c=0;c<n;c++){
    		ch[c]=sc.next().toCharArray();
          	Arrays.sort(ch[c]);
          	s[c]=String.valueOf(ch[c]);	
    	}
  		Arrays.sort(s);
  		long count=0;
  		int d=0;
  		while(d<n){
    	for(int e=d+1;e<n;e++){
 		if(s[d].equals(s[e])){
    		count++;
    	}else{
     		break;
   		 }
        }
           ans+=count*(count+1)/2;
           d+=count+1;
           count=0;
        }
    	System.out.println(ans);
    }
}

Measured memory_bytes: 59132
#include<bits/stdc++.h>
using namespace std;
int main()
{
    
    int a,b;
    cin>>a>>b;
    if(a<=5)
    cout<<"0"<<"\n";
    else if(a>=6 && a<=12)
    cout<<b/2<<"\n";
    else
    cout<<b<<"\n";
    
    
    return 0;
}

Measured memory_bytes: 256
using System;


namespace Abc083
{
    class Program
    {
        static void Main(string[] args)
        {
            var rStr = Console.ReadLine();

            uint N = uint.Parse(rStr.Split(' ')[0]);
            uint A = uint.Parse(rStr.Split(' ')[1]);
            uint B = uint.Parse(rStr.Split(' ')[2]);
            uint result = 0;
            for (uint i = 1; i <= N; i++)
            {
                uint t = i;
                uint re = 0;

                while (true)
                {
                    var m = t % 10;
                    re = re + m;

                    if (t / 10 == 0)
                    {
                        break;
                    }
                    else
                    {
                        t = t / 10;
                    }
                }

                if (A <= re && re <= B)
                {
                    result = result + i;
                }
            }
            Console.WriteLine(result);
        }
    }
}


Measured memory_bytes: 27552
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <queue>
#include <algorithm>
#include <vector>
#include <cstring>
#include <stack>
#include <cctype>
#include <utility>
#include <map>
#include <string>
#include <climits>
#include <set>
#include <sstream>
#include <utility>
#include <ctime>
#include <cassert>
#include <fstream>
using namespace std;
typedef long long LL;
#define MS(A) memset(A, 0, sizeof(A))
#define MSV(A,a) memset(A, a, sizeof(A))
#define MAX(a,b) ((a >= b) ? (a) : (b))
#define MIN(a,b) ((a >= b) ? (b) : (a))
#define ABS(a) (((a) > 0) ? (a) : (-a))
#define MP make_pair
#define PB push_back
#define getcx getchar_unlocked
#define INF (int(1e9))
#define INFL (LL(1e18))
#define EPS 1e-12
#define chkbit(s, b) (s & (1<<b))
#define setbit(s, b) (s |= (1<<b))


int main() {	

	int a,b;
	cin>>a>>b;
	cout<<a*b<<endl;

	return 0;
}

Measured memory_bytes: 3636
#include <iostream>

#include <vector>
#include <map>
#include <algorithm>
#include <fstream>
#include<cstdio>
#include<iomanip>
#include<stack>
#include<queue>
#include<string>
#include <cstdlib>
#include <typeinfo>

#define REP(i, n) for(int i=0;i<n;i++)
#define REP2(i, s, n) for(int i=s;i<n;i++)
#define REP_1(i, n) for(int i=1;i<n+1;i++)
#define bitSearch(bit, n) for(int bit = 0; bit < (1 << N); bit++)
using namespace std;

template<class T>
void print(const T &value) {
    std::cout << value << std::endl;
}

void yesno(bool a) { if (a)cout << "Yes" << endl; else cout << "No" << endl; }

void YESNO(bool a) { if (a)cout << "YES" << endl; else cout << "NO" << endl; }

typedef long long ll;
typedef unsigned long ul;
typedef long double ld;

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

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

//ll INF = 10000000;
//ll mod = 1000000007;//10^9+7

//using Graph = vector<vector<pair<int, int>>>;
//Graph G(100100);


//番号ズレ注意！！
int main() {
    int N;
    cin >> N;
    int odd = 0;
    REP(i, N) {
        int a;
        cin >> a;
        if (a % 2 == 1) { odd++; }
    }
    YESNO(odd % 2 == 0);
}


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

using namespace std;

using ll = long long;

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

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

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

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

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

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

    int now = 1;
    int cnt = 0;
    REP(i, n) {
        int a;
        cin >> a;
        if (a == now) {
            now++;
        } else {
            cnt++;
        }
    }

    if (now == 1) {
        std::cout << -1 << '\n';
    } else {
        std::cout << cnt << '\n';
    }

    return 0;
}


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

using namespace std;

#define INF 1000007
#define MOD 1000000007
#define maxn 10001
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define rep(i, n) FOR(i, 0, n)
#define int long long
const double PI = acos(-1);
typedef pair<int, int> P;

int gcd(int a, int b)
{
    return b ? gcd(b, a % b) : a;
}

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

int mpow(int N, int P, int M) //繰り返し自乗法
{
    if (P == 0)
        return 1;
    if (P % 2 == 0)
    {
        int t = mpow(N, P / 2, M);
        return t * t % M;
    }
    return N * mpow(N, P - 1, M) % M;
}

int counter(int x) //bit計算
{
    if (x == 0)
        return 0;
    return counter(x >> 1) + (x & 1);
}

vector<bool> prime(maxn + 1, true); //素数テーブル
void prime_table(void)
{
    prime[0] = false;
    prime[1] = false;
    for (int i = 2; i * i <= maxn; i++)
    {
        if (!prime[i])
        {
            continue;
        }
        for (int j = i + i; j <= maxn; j += j + i)
        {
            prime[j] = false;
        }
    }
}

bool IsPrime(int num) //素数判定
{
    if (num < 2)
        return false;
    else if (num == 2)
        return true;
    else if (num % 2 == 0)
        return false;

    double sqrtNum = sqrt(num);
    for (int i = 3; i <= sqrtNum; i += 2)
    {
        if (num % i == 0)
        {
            return false;
        }
    }

    return true;
}
vector<int> divisor(int n) //約数列挙
{
    vector<int> ret;
    for (int i = 1; i * i <= n; i++)
    {
        if (n % i == 0)
        {
            ret.push_back(i - 1);
            if (i * i != n)
            {
                ret.push_back((n / i) - 1);
            }
        }
    }
    sort(ret.begin(), ret.end());
    return (ret);
}

signed main()
{
    int D;
    cin >> D;
    switch (D)
    {
    case 25:
        cout << "Christmas" << endl;
        break;
    case 24:
        cout << "Christmas Eve" << endl;
        break;
    case 23:
        cout << "Christmas Eve Eve" << endl;
        break;
    case 22:
        cout << "Christmas Eve Eve Eve" << endl;
        break;
    }
}

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

using namespace std;

int main() {
	string s,ans;
	cin >> s;
	for (int i = 0; i < s.size(); i++) {
		if (s[i] == 'B') {
			if (ans.size())ans.erase(--ans.end());
		}else {
			ans.push_back(s[i]);
		}
	}
	cout << ans << endl;
}


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

#define Pii pair<int,int>

int main(){
  int n;
  cin >> n;
  
  vector<Pii> t(n);
  for(int i = 0;i < n;i++){
    cin >> t[i].first >> t[i].second;
  }
  
  sort(t.begin(),t.end(),
       [](const Pii& a, const Pii& b){return a.second < b.second;}
       );
  
  string ret = "Yes";
  long long cur = 0;
  for(int i = 0;i < n;i++){
    if(cur + t[i].first > t[i].second){
      ret = "No";
    }else{
      cur += t[i].first;
    }
  }
  
  cout << ret << endl;
}



Measured memory_bytes: 1792
const createStripe = function(length, pattern) {
    var stripe = '';
    for (var i = 0; i < length; i++) {
        stripe += pattern[i % pattern.length];
    }
    return stripe;
};

const createChessboard = function (h, w) {
    const pattern = ['#', '.'];
    const lines = [createStripe(w, pattern) + '\n', createStripe(w, pattern.reverse()) + '\n'];
    return createStripe(h, lines);
};

const isZero = function (a) {return 0 === a;};

const chunk = require('fs').readFileSync('/dev/stdin', 'utf8');
const lines = chunk.split('\n');

lines.some(function (line) {
    var hw = line.split(' ').map(Number);
    if (hw.every(isZero)) {
        return true;
    }
    console.log(createChessboard(hw[0], hw[1]));
});

Measured memory_bytes: 15476