akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define MAX 1000000007
#define MAXN 100005
bool sortby1column(vector<ll> &v1,vector<ll> &v2){
 return v1[0]<v2[0];
}
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    /*#ifndef ONLINE_JUDGE
        freopen("input.txt", "r", stdin);
        freopen("output.txt", "w", stdout);
    #endif*/
    int t=1;
    //cin>>t;
    for(int cc=1;cc<=t;cc++){
        //cout<<"Case #"<<cc<<":\n";
        ll ans=0,k;
        cin>>k;
        for(ll i=1;i<=k;i++){
            for(ll j=1;j<=k;j++){
                ll gc = __gcd(i,j);
                for(ll l=1;l<=k;l++)
                    ans+=(__gcd(gc,l));
            }
        }
        cout<<ans<<endl;
    }
}

Measured memory_bytes: 3688
import collections

n=int(input())

alls=[]
for i in range(n):
  s=list(input())
  s.sort()
  s="".join(s)
  alls.append(s)
  
c = collections.Counter(alls)

#print(c.most_common())
aa=c.most_common()
n=len(aa)
allans=0
for j in range(n):
  num=aa[j][1]
  if num!=1:
    ans=num*(num-1)//2
    allans+=ans
print(allans)

Measured memory_bytes: 24460
import collections
n = int(input())
l=[input() for i in range(n)]
ans = []
cnt=0
c = collections.Counter(l)
for i in c.most_common():
    if i[1] >= cnt:
        ans.append(i[0])
        cnt = i[1]
ans.sort()
for j in ans:
    print(j)

Measured memory_bytes: 45040
import sys

read = sys.stdin.buffer.read
input = sys.stdin.buffer.readline
inputs = sys.stdin.buffer.readlines


# rstrip().decode('utf-8')
# INF=float("inf")
#MOD=10**9+7
# sys.setrecursionlimit(2147483647)
# import math
#import numpy as np
# import operator
#import bisect
# from heapq import heapify,heappop,heappush
#from math import gcd
# from fractions import gcd
#from collections import deque
#from collections import defaultdict
# from collections import Counter
#from itertools import accumulate
# from itertools import groupby
# from itertools import permutations
# from itertools import combinations
# from scipy.sparse import csr_matrix
# from scipy.sparse.csgraph import floyd_warshall
# from scipy.sparse.csgraph import csgraph_from_dense
# from scipy.sparse.csgraph import dijkstra
# map(int,input().split())


def main():
	n,*l=map(int,read().split())
	lmax=max(l)
	lsum=sum(l)
	ans="No"
	if lmax<lsum-lmax:
		ans="Yes"
	print(ans)
	
	
	
	
	
if __name__ == "__main__":
		main()


Measured memory_bytes: 38568
import java.util.Scanner;


public class Main {

	public long calcBalance(long first, int weeks) {
		if (weeks == 0) { return first;
		} else {
			return calcBalance((long)(1000*Math.ceil((first*1.05)/1000.0)), weeks-1);
		}
	}

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

		System.out.println((new Main()).calcBalance(100000, sc.nextInt()));

	}
}

Measured memory_bytes: 17156
K = int(input())

mod_even = K % 2
mod_fifth = K % 5
mod_seven = K % 7
if mod_even == 0:
  print(-1)
elif mod_fifth == 0:
  print(-1)    
else:
  kk = 0
  if mod_seven == 0:
    kk = int(9*K/7)
  else:
    kk = int(9*K)
  count = 0
  remainder = 0
  kazu = int(10)
  while(1):
    count = count + 1
    remainder = kazu % kk
    if remainder == 1:
      print(count)
      break
    else:
      kazu = int(remainder*10)

Measured memory_bytes: 9216
#include <algorithm>
#include <iostream>
#include <cstring>
#include <cstdio>
#include <cstdio>
#define N 604
using namespace std;

int n, m, a[N][N], num[6];

inline void work(int d, int op) {
    int c = 0;
    while (d % 4 == 0) d >>= 2, ++c;
    for (int i = 0; i < n; ++i)
        for (int j = 0; j < n; ++j) {
            if ((d & 1) == 0) a[i][j] = op * a[i][j] + ((i >> c) & 1);
            else a[i][j] = op * a[i][j] + (((i >> c) + (j >> c)) & 1);
        }
}

int main() {
#ifdef whyqx
    freopen("work.in", "r", stdin);
    freopen("work.out", "w", stdout);
#endif

    int d1, d2;
    cin >> n >> d1 >> d2, m = n * n, n <<= 1;
    work(d1, 0), work(d2, 2);

    for (int i = 0; i < n; ++i)
        for (int j = 0; j < n; ++j)
            ++num[a[i][j]];

    int id = 0;
    while (num[id] < m) ++id;

    for (int i = 0; i < n; ++i)
        for (int j = 0; j < n; ++j)
            if (m && a[i][j] == id) printf("%d %d\n", i, j), --m;

    return 0;
}


Measured memory_bytes: 2304
n = int(input())
s = list(input())
cnt = {
    "R": 0,
    "G": 0,
    "B": 0
}

for i, c in enumerate(s):
    cnt[c] += 1

ans = cnt["R"] * cnt["G"] * cnt["B"]
d = 0
for i in range(n-2):
    for j in range(i + 1, n - 1):
        k = j + (j - i)
        if (k < n):
            if (s[i] != s[j])and(s[j] != s[k]) and (s[k] != s[i]):
                d += 1

print(ans-d)


Measured memory_bytes: 9208
n = int(input())
n_list = list(map(int, input().split()))

max_difference = 0

for i, n1 in enumerate(n_list):
  for j, n2 in enumerate(n_list):
    if i == j:
      continue
    diff = n2 - n1
    max_difference = max(max_difference, diff)

print(max_difference)


Measured memory_bytes: 2940
#include<bits/stdc++.h>
using namespace std;
int main(){
	int n,m,p;
	while(1){
		cin >> n >> m >> p;
		if(n==0 && m==0){
			if(p==0) break;
		}
		int x[n+1],sum=0;
		for(int i=1;i<=n;i++){
			cin >> x[i];
			sum+=x[i];
		}
		sum*=100;
		if(x[m]==0){
			cout << 0 << endl;
		}else{
			sum=sum*100;
			sum=sum-(sum/100*p);
			sum=sum/100;
			sum=sum/x[m];
			cout << sum << endl;
		}
	}
}
		
		


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

using namespace std;

#define DUMP(x) std::cout << (#x) << " = " << (x) << "\n"
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define ALL(r) r.begin(), r.end()

using ll = long long;
using vint = vector<int>;
using pint = pair<int, int>;

void Main() {
    int a, b;
    cin >> a >> b;
    int ans = max({a + b, a - b, a * b});
    cout << ans << endl;
}

int main() {
    std::cin.tie(nullptr);
    std::ios_base::sync_with_stdio(false);
    std::cout << std::fixed << std::setprecision(15);
    Main();
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<unordered_set>
#include<unordered_map>
using namespace std;
#define REP(i,m,n) for(int i=(m);i<(n);i++)
#define rep(i,n) REP(i,0,n)
#define pb push_back
#define all(a) a.begin(),a.end()
#define rall(c) (c).rbegin(),(c).rend()
#define mp make_pair
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
const int inf=1e9+7;
const int mod=998244353;
int main(){
    ll ans=0;
    ll x,y,z;cin>>x>>y>>z;
    x-=z;
    ans+=x/(y+z);
    cout<<ans<<endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<limits>
#define ll long long
#define F first
#define S second
#define pb push_back
#define oo 1e18
#define endl '\n'
#define si size()
#define all(v) v.begin(),v.end()
#define FASTIO ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
#define Matrix vector< vector < long long > >
#define vi vector<int>
#define vll vector<ll>
#define vd vector<double>
#define vs vector<string>



using namespace std;

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

const long double Pi=acos(-1),e=2.718;
const int N=1e2+10,mod=1e9+7;
int main ()
{
    FASTIO
    long double a , b ,h , m ;
    cin >> a >> b >> h >> m;
    long double theta1 = 360*h/12 + (360*m/60/12);
    long double theta2 = 360*m/60;
    long double theta = theta1-theta2;
    long double c = sqrt(a*a+b*b-2*a*b*cos(theta*Pi/180.0));
    cout << fixed << setprecision(12) << c << endl;
    return 0;
}
/**

*/


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

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

    int N, W;
    cin >> N >> W;
    vector<int> w(N), v(N);
    REP(i, N) cin >> w[i] >> v[i];

    vector<vector<ll> > dp(N + 1, vector<ll>(W + 1, 0));

    REP(i, N) REP(j, W + 1) {
        if (j - w[i] >= 0)
            dp[i + 1][j] = max(dp[i + 1][j], dp[i][j - w[i]] + v[i]);
        dp[i + 1][j] = max(dp[i + 1][j], dp[i][j]);
    }

    cout << dp[N][W] << '\n';
    return 0;
}

Measured memory_bytes: 80256
#include <bits/stdc++.h>
#define PI 3.14159265359
using namespace std;
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;
}
const long long INF = 1LL << 60;
using pll = pair<long long, long long>;

int main() {
  // 標準入力が早くなる。Cスタイルの入出力とC++スタイルの入出力を混合させてはならない。
  cin.tie(nullptr);
  ios_base::sync_with_stdio(false);

  string S;

  cin >> S;
  string reverseS = S;
  reverse(reverseS.begin(), reverseS.end());

  int res = 0;

  for (int i = 0; i < S.length(); i++) {
    if (S[i] != reverseS[i]) {
      ++res;
    }
  }

  if (res > 0) {
    cout << res / 2 << endl;
  } else {
    cout << res << endl;
  }

  return 0;
}


Measured memory_bytes: 256
#include <vector>
#include <math.h>
#include <iostream>
#include <string>
#include <algorithm>
#include <queue>
#include <iomanip>
#include <deque>
#include <cctype>
#include <unordered_map>

using namespace std;
using uint = unsigned int;
using ll = long long;
using ull = unsigned long long;
using pii = pair<int,int>;
using pll = pair<long, long>;
template <class T> using V = vector<T>;
template <class T> using VV = V<V<T>>;
#define rep(i, n) for(int i = 0; i<n; i++)
#define rep_s(i, start, n) for(int i= start;  i<n; i++)
#define rep_down(i, n) for(int i = n-1; i>=0; i--)
#define rep_down_s(i, n, start) for(int i = n-1; i>=start; i--)
#define ALL(a) (a).begin(), (a).end()
#define ALL_str(a) (a).cbegin(), (a).cend()

string alphabet_upper = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
string alphabet_lower  = "abcdefghijklmnopqrstuvwxyz";
string numbers = "0123456789";
/*
for (iterator = hash.begin(); iterator != hash.end(); iterator++)
{
// ここで、要素毎の操作を行います。
std::pair<std::string, CMyClass> element = *iterator;

}
*/
/*
using edge = struct {int to; ll cost;};
vector<edge> tree[limit];
ll depth[limit];

void dfs(int v, int p, ll d){
  depth[v] = d;
  //cout <<"v: " << v << endl;
  for (auto &e: tree[v]){
    //cout << "e.to: " << e.to << endl;
    if (e.to == p) continue;
    dfs(e.to, v, d+e.cost);
  }
}
*/
int keta_sum(int num){
  int dig, sum = 0;
  while(num){
    dig = num % 10;
    sum = sum + dig;
    num = num / 10;
  }
  return sum;
}

ll binary_search(ll left_key, ll border, ll low, ll high) {
     // 配列 a の左端と右端
    ll mid = (low+high)/2;
    while (high > low+1) {
       mid = (low+high)/2;
        if (left_key*mid>border) high = mid;
        else if (left_key*mid<border) low = mid;
        else {
          mid =mid-1;
          break;
        }
    }
    return mid;
}

bool IsPrime(ll a){
  ll b = sqrt(a);
  b++;
  while(b-->=2){
    if (a%b==0) return false;
  }
  return true;
}

ll gcd(ll a, ll b){
  ll tmp;
  if(a<b){
    tmp = a;
    a = b;
    b = tmp;
  }

  ll r = a % b;
  while(r!=0){
    a = b;
    b = r;
    r = a % b;
  }
  return b;
}

struct UnionFind {
    vector<int> par; // par[i]:iの親の番号　(例) par[3] = 2 : 3の親が2

    UnionFind(int N) : par(N) { //最初は全てが根であるとして初期化
        for(int i = 0; i < N; i++) par[i] = i;
    }

    int root(int x) { // データxが属する木の根を再帰で得る：root(x) = {xの木の根}
        if (par[x] == x) return x;
        return par[x] = root(par[x]);
    }

    void unite(int x, int y) { // xとyの木を併合
        int rx = root(x); //xの根をrx
        int ry = root(y); //yの根をry
        if (rx == ry) return; //xとyの根が同じ(=同じ木にある)時はそのまま
        par[rx] = ry; //xとyの根が同じでない(=同じ木にない)時：xの根rxをyの根ryにつける
    }

    bool same(int x, int y) { // 2つのデータx, yが属する木が同じならtrueを返す
        int rx = root(x);
        int ry = root(y);
        return rx == ry;
    }
};

int main(void){
  ll N, M, A, B, C, D, E, F, K,L, W, H, P, Q, R, X, Y;
  ll ans;
  string S, T;
  cin >> N;
  ll a[N];
  
  rep(i, N) cin>>a[i];
  ll gcd_num = gcd(a[0], a[1]);
  rep_s(i, 2, N) gcd_num = gcd(gcd_num, a[i]);
  

  cout << gcd_num << endl;

}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define LOOP(n) for (int _i = 0; _i < (n); _i++)
#define REP(i, n) for (int i = 0; i < (n); ++i)
#define RREP(i, n) for (int i = (n); i >= 0; --i)
#define FOR(i, r, n) for (int i = (r); i < (n); ++i)
#define ALL(obj) begin(obj), end(obj)
using namespace std;
int main() {
    int N, Q;
    string S;
    cin >> N >> S >> Q;
    set<int> s[26];  // 0:a, 1:b, 2:c, ..., 25:z
    REP(i, N) { s[(int)(S[i] - 'a')].insert(i); }
    vector<int> ans;
    for (int i = 0; i < Q; i++) {
        int q;
        cin >> q;
        if (q == 1) {
            int i;
            char c;
            cin >> i >> c;
            i--;
            s[(int)(S[i] - 'a')].erase(i);
            s[(int)(c - 'a')].insert(i);
            S[i] = c;
        } else if (q == 2) {
            int l, r;
            cin >> l >> r;
            l--, r--;
            int sum = 0;
            REP(i, 26) {
                auto it = s[i].lower_bound(l);
                if (it != s[i].end()) {
                    if (*it <= r) {
                        sum++;
                    }
                }
            }
            ans.push_back(sum);
        }
    }
    for (auto i : ans) {
        cout << i << endl;
    }
    return 0;
}


Measured memory_bytes: 24452
import sys


def solve(inp):
    N = int(inp.readline().strip())

    r = 1001001001001
    for i in range(1, min(1000000, N) + 1):
        if N % i != 0:
            continue
        r = min(r, i + int(N / i) - 2)

    return str(r)


def main():
    result = solve(sys.stdin)
    if result:
        print(result)


if __name__ == '__main__':
    main()


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

long long modpow(long long a, long long n, long long mod) {
    long long res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}

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

    string S;
    cin >> S;

    ll ans = 0;

    vector<ll> dp(2019);

    ll c = 0;

    dp[0] = 1;

    for(int i = S.length() - 1; i >= 0; i--) {
        c += int(S[i] - '0') * modpow(10, S.length() - 1 - i, 2019);
        c %= 2019;
        dp[c]++;
    }

    for(int i = 0; i < 2019; i++) {
        ans += dp[i] * (dp[i] - 1) / 2;
    }

    cout << ans << endl;
}

Measured memory_bytes: 3756
n, k = map(int, input().split())
a = list(map(int, input().split()))
test_pos = 1
sub = 0
loop = 0
city = [0 for i in range(n)]
while True:
    test_pos = a[test_pos-1]
    city[test_pos-1] += 1
    sub += 1
    if city[test_pos-1] == 2:
        loop_start = test_pos
        break

while True:
    test_pos = a[test_pos-1]
    loop += 1
    if test_pos == loop_start:
        break
if k > sub:
    k -= sub
    k %= loop
    pos = loop_start
    for i in range(k):
        pos = a[pos-1]
    print(pos)
else:
    pos = 1
    for i in range(k):
        pos = a[pos - 1]
    print(pos)


Measured memory_bytes: 32308
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
#ifdef ENABLE_DEBUG
#define dump(a) cerr<<#a<<"="<<a<<endl
#define dumparr(a,n) cerr<<#a<<"["<<n<<"]="<<a[n]<<endl
#else
#define dump(a) 
#define dumparr(a,n) 
#endif
#define FOR(i, a, b) for(ll i = a;i < b;i++)
#define For(i, a) FOR(i, 0, a)
#define REV(i, a, b) for(ll i = b-1;i >= a;i--)
#define Rev(i, a) REV(i, 0, a)
#define REP(a) For(i, a)
#define SIGN(a) (a==0?0:(a>0?1:-1))

typedef long long int ll;
typedef unsigned long long ull;
typedef unsigned int uint;
typedef pair<ll, ll> pll;
typedef pair<ll,pll> ppll;
typedef vector<ll> vll;
typedef long double ld;
typedef pair<ld,ld> pdd;

const ll INF=(1LL<<50);
#if __cplusplus<201700L
ll gcd(ll a, ll b) {
  if(a < b) return gcd(b, a);
  ll r;
  while ((r=a%b)) {
    a = b;
    b = r;
  }
  return b;
}
#endif

template<class S,class T>
std::ostream& operator<<(std::ostream& os,pair<S,T> a){
  os << "(" << a.first << "," << a.second << ")";
  return os;
}
template<class T>
std::ostream& operator<<(std::ostream& os,vector<T> a){
  os << "[ ";
  REP(a.size()){
    os<< a[i] << " ";
  }
  os<< " ]";
  return os;
}


void solve(long long H){
  ll i=0,ans=0;
  while(H>0){
    ans+=(1LL<<i);
    ++i;
    H/=2;
  }
  cout<<ans<<endl;
}

int main(){
  cout<<setprecision(1000);
  cin.tie(0);
  ios::sync_with_stdio(false);
    long long H;
    scanf("%lld",&H);
    solve(H);
    return 0;
}


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

bool IsPrime(ll x) {
	if (x == 2) return true;
	if (x < 2 || x % 2 == 0)return false;
	ll i = 3;
	while (i <= pow(x, 0.5))
	{
		if (x%i == 0)return false;
		i = i + 2;
	}
	return true;
}

int main() {
	ll N;
	cin >> N;
	ll count = 0;
	rep(i,N) {
		ll a;
		cin >> a;
		if (IsPrime(a)) {
			count++;
		}
	}
	cout << count << endl;
	return 0;
}





Measured memory_bytes: 3236
h, w = map(int, input().split())
a = [list(map(int, input().split())) for _ in range(h)]

cnt = 0
history = []
for i in range(h):
    range_j = range(w) if i%2 == 0 else range(w)[::-1]
    for j in range_j:
        if i == h-1 and j == range_j[-1]:    # 最終セルなら離脱
            break

        if a[i][j] % 2 == 0:
            continue
        
        next_cell = None
        if i%2 == 0:    # 右進行
            if j+1 >= w:    # 右端
                next_cell = (i+1, j)
                a[i][j] -= 1
                a[i+1][j] += 1
            else:
                next_cell = (i, j+1)
                a[i][j] -= 1
                a[i][j+1] += 1
        else:           # 左進行
            if j-1 < 0: # 左端
                next_cell = (i+1, j)
                a[i][j] -= 1
                a[i+1][j] += 1
            else:
                next_cell = (i, j-1)
                a[i][j] -= 1
                a[i][j-1] += 1
        history.append(map(str, [i+1, j+1, next_cell[0]+1, next_cell[1]+1]))
        cnt += 1

print(cnt)
for h in history:
    print(" ".join(h))

Measured memory_bytes: 75612
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, srt, end) for (long long i = (srt); i < (long long)(end); i++)

int main(){
    ll L, R;
    cin >> L >> R;
    ll ans = 2018;
    rep(l, L, min(L+2019, R)){
        rep(r, l+1, min(L+2020, R+1)){
            ll t = l * r;
            t %= 2019;
            ans = min(ans, t);
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <cstring>
#include <math.h>
#include <cmath>
#include <limits.h>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <functional>
#include <stdio.h>
using namespace std;

long long MOD = 1000000007;

int popcount( int a ) {
    int ret = 0;
    for ( int i = 0; i < 32; i++ ) {
        if ( a & ( 1 << i  ) ) { ret++; } 
    }
    return ret;
}

int main() {
    
    string S;
    cin >> S;
    
    vector<int> hash(S.length());
    
    for ( int i = 0; i < S.length(); i++ ) {
        if ( !i ) { hash[i] = ( 1 << (S[i]-'a' ) ); }
        else { hash[i] = hash[i-1] ^ ( 1 << (S[i]-'a') ); }
    }
    
    
    vector<int> dp( 1<<26 );
    for ( int i = 0; i < (1<<26); i++ ) {
        dp[i] = INT_MAX-1;
    }
    
    
    
    for ( int i = 0; i < S.length(); i++ ) {
        if ( popcount( hash[i] ) <= 1 ) {
            dp[hash[i]] = 1; 
            continue;
        }
        
        for ( int j = 0; j < 26; j++ ) {            
            dp[hash[i]] = min( dp[hash[i]], dp[ hash[i] ^ ( 1 << j ) ] + 1 );
        } 
    }
    
    cout << dp[hash[S.length()-1]] << endl;
    
    /* N^2 */    
    // vector<int> opt(S.length());
    // fill( opt.begin(), opt.end(), INT_MAX );
    // opt[0] = 1;
    
    // for ( int i = 1; i < S.length(); i++ ) {
        // if ( popcount( hash[i] ) <= 1 ) { opt[i] = 1; continue; }
        
        // for ( int j = 0; j < i; j++ ) {
            // if ( popcount( hash[i] ^ hash[j] ) <= 1 ) {
                // opt[i] = min( opt[i], opt[j] + 1 );
            // }
            // opt[i] = min( opt[i], opt[i-1]+1 );
        // }
    // }
    
    // cout << opt[S.length()-1] << endl;
    
    /* for debug */
    // for ( auto& a : hash ) {
        // string str;
        // for ( int i = 0; i < 26; i++ ) {
            // if ( a & ( 1 << i ) ) { str += "1"; }
            // else { str += "0"; }
        // }
        // cout << str << endl;
    // }
    
    return 0;
}

Measured memory_bytes: 263556
# coding: utf-8

import sys
import math

import array
import bisect
import collections
from collections import Counter, defaultdict
import fractions
import heapq
import re

sys.setrecursionlimit(1000000)


def array2d(dim1, dim2, init=None):
    return [[init for _ in range(dim2)] for _ in range(dim1)]

def argsort(l, reverse=False):
    return sorted(range(len(l)), key=lambda i: l[i], reverse=reverse)

def argmin(l):
    return l.index(min(l))

def YESNO(ans, yes="YES", no="NO"):
    print([no, yes][ans])

II = lambda: int(input())
MI = lambda: map(int, input().split())
MIL = lambda: list(MI())
MIS = lambda: input().split()


def main():
    s = input()
    y, m = int(s[:2]), int(s[2:])
    if 1 <= y <= 12 and 1 <= m <= 12:
        return "AMBIGUOUS"
    if 1 <= y <= 12:
        return "MMYY"
    if 1 <= m <= 12:
        return "YYMM"
    return "NA"


if __name__ == "__main__":
    print(main())


Measured memory_bytes: 5644
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N,digit1,digit2,digit3,digit4;
  cin >> N;
	digit1 = N % 10;
	digit2 = N % 100 / 10;
	digit3 = N % 1000 / 100;
	digit4 = N % 10000 / 1000;

  if ((digit1 == digit2 && digit2 == digit3) ||
      (digit2 == digit3 && digit3 == digit4)){
  cout << "Yes" << endl;
  }else{
  cout << "No" << endl;
  }
}

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

#define MAX_N 12

int main()
{
  int n, m, x;
  cin >> n >> m >> x;
  
  int column_count = m + 1; // c, A0, ..., Am
  vector<vector<int>> rows(n, vector<int>(column_count));
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < column_count; j++) {
      cin >> rows.at(i).at(j);
    }
  }
  
  int min_price = -1;
  for (int tmp = 0; tmp < (1 << MAX_N); tmp++) {
    bitset<MAX_N> bit(tmp);
    
    // ビットが立っている位置の要素の合計をとる
    vector<int> sum(column_count, 0);
    for (int i = 0; i < n; i++) {
      if (!bit.test(i)) {
        continue;
      }
      
      for (int j = 0; j < column_count; j++) {
        sum.at(j) += rows.at(i).at(j);
      }
    }
    
    // 全ての理解度がX以上か判定する
    bool satisfied = true;
    for (int i = 1; i < column_count; i++) {
      if (sum.at(i) < x) {
        satisfied = false;
        break;
      }
    }
    
    if (satisfied) {
      if (min_price == -1) {
        min_price = sum.at(0);
      } else if (sum.at(0) < min_price) {
        min_price = sum.at(0);
      }
    }
    
    if (bit.count() == n) {
      // 全て調べ終わったので抜ける
      break;
    }
  }
  
  cout << min_price << endl;
}


Measured memory_bytes: 3644
a = input()
s = list(a)
s_int = [int(i) for i in s ]
t = len(s_int)
i = 0
c0 = s_int.count(0)
c1 = s_int.count(1)
if c0 > c1:
    print(2*c1)
else:
    print(2*c0)


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

#define rep2(x,fr,to) for(int (x)=(fr);(x)<(to);(x)++)
#define rep(x,to) for(int (x)=0;(x)<(to);(x)++)
#define repr(x,fr,to) for(int (x)=(fr);(x)>=(to);(x)--)
#define all(c) (c).begin(),(c).end()
#define sz(v) (int)(v).size()

using namespace std;
typedef long long ll; typedef vector<int> VI; typedef pair<ll,int> pii;
const int MD = (int)1e9 + 7; typedef vector<ll> VL;
void dbg(){ cerr << "\n"; }  template <class T, class ...T2>
void dbg(const T& fst, const T2&...rst){ cerr << fst << ": "; dbg(rst...); }


int main() {
	//cin.tie(0); ios_base::sync_with_stdio(false);
	int n, t;
	cin >>n >>t;
	VI a(n), b(n);
	rep(i, n) cin >>a[i] >>b[i];
	vector<pii> vp(n);
	rep(i, n) vp[i] = pii(a[i], b[i]);
	sort(vp.begin(), vp.end());
	rep(i, n) tie(a[i], b[i]) = vp[i];
	VL dp(6020);
	
	rep(i, n) repr(j, t-1, 0) if(dp[j] >0 || j==0){
		dp[j + a[i]] = max(dp[j+a[i]], dp[j] + b[i]);
	}
	
	//for(auto x :dp) cerr<<x<<" "; cerr<<"\n";
	
	cout << *max_element(all(dp)) <<"\n";
	return 0;
}


Measured memory_bytes: 384
#include<stdio.h>

#define M 100
#define NIL -1
#define INF 1000000000

int G[M][M];
int D[M];
int P[M];
int C[M]={};

void ISS(int a){
  int i;
  for(i=0;i<a;i++){
    D[i]=INF;
    P[i]=NIL;
  }
  D[0]=0;
}

void DKs(int a){
  int i,j,u,v,mcos;
  ISS(a);
  while(1){
    mcos=INF;
    for(i=0;i<a;i++){
      if(C[i]!=1 && D[i]<mcos){
	mcos=D[i];
	u=i;
      }
    }
      if(mcos==INF)break;
      C[u]=1;
      for(j=0;j<a;j++){
	if(G[u][j]!=NIL){
	  v=j;
	  if(C[v]!=1 && D[u]+G[u][v]<D[v]){
	    P[v]=u;
	    D[v]=D[u]+G[u][v];
	    //printf("%d\n",D[v]);
	  }
	}
      }
  }
}

int main(){
  int a,b,c,i,j,u,v;
  
  scanf("%d",&a);
  for(i=0;i<a;i++)for(j=0;j<a;j++)G[i][j]=NIL;
  for(i=0;i<a;i++){
    scanf("%d %d",&u,&b);
    for(j=0;j<b;j++){scanf("%d",&v);scanf("%d",&G[u][v]);}
  }
  DKs(a);
  for(i=0;i<a;i++)printf("%d %d\n",i,D[i]);
  
}



Measured memory_bytes: 2052
n,c,k = map(int, input().split())
T = []
for i in range(n):
    T.append(int(input()))
T.sort()
ans = 1
last_t = T[0]
passengers = 0
for t in T:
    if last_t +k >= t and passengers < c:
        passengers += 1
    else:
        last_t = t
        passengers = 1
        ans += 1

print(ans)





Measured memory_bytes: 7384
object MainKt {
  @JvmStatic fun main(args:Array<String>) {
    val N=readLine()!!.toInt()
    val s=readLine()!!.toString()
    val t=readLine()!!.toString()
    val sl=s.length;
    val tl=t.length;
    val l:Int=arrayOf(sl,tl).min()!!
    var suml=sl+tl;
    var common=0;
    for (i in 0..(l-1))
    {
      var andl=0
      for (j in 0..i)
      {
        
        if (s[l-1-i+j]==t[j])
        {
          andl++
        }
        else 
        {
          break
        }
      }
      if (suml-andl<N) break
      common = if (andl>common) andl else common
    }
    println(suml-common)
  }
}


Measured memory_bytes: 21096
#pragma region Macros
#include <bits/stdc++.h>
using namespace std;

// debug methods
// usage: debug(x,y);
#define CHOOSE(a) CHOOSE2 a
#define CHOOSE2(a0,a1,a2,a3,a4,x,...) x
#define debug_1(x1) cout<<#x1<<": "<<x1<<endl
#define debug_2(x1,x2) cout<<#x1<<": "<<x1<<", "#x2<<": "<<x2<<endl
#define debug_3(x1,x2,x3) cout<<#x1<<": "<<x1<<", "#x2<<": "<<x2<<", "#x3<<": "<<x3<<endl
#define debug_4(x1,x2,x3,x4) cout<<#x1<<": "<<x1<<", "#x2<<": "<<x2<<", "#x3<<": "<<x3<<", "#x4<<": "<<x4<<endl
#define debug_5(x1,x2,x3,x4,x5) cout<<#x1<<": "<<x1<<", "#x2<<": "<<x2<<", "#x3<<": "<<x3<<", "#x4<<": "<<x4<<", "#x5<<": "<<x5<<endl
#ifdef LOCAL
    #define debug(...) CHOOSE((__VA_ARGS__,debug_5,debug_4,debug_3,debug_2,debug_1,~))(__VA_ARGS__)
    #define eprintf(...) fprintf(stderr, __VA_ARGS__)
#else
    #define debug(...) 42
    #define eprintf(...) 42
#endif

#define PI 3.1415926535897932384626433832795
#define INF 2e9
#define SINV(t) greater<t>()
#define REP(i, n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define REPR(i, n) for(int i=(n); i>=0; --i)
#define FOR(i, n, m) for(int i=(m), i##_len=(n); i<i##_len; ++i)
#define FOREACH(i, v) for(auto i=(v).begin(); i!=(v).end(); ++i)
#define ALL(x) (x).begin(),(x).end()

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

typedef long long ll;
#define vv(t) vector<t>

#define CHC(mp, x) if(mp.end() != mp.find(x))

template<typename T>
inline T lcm(T a, T b) {return a / __gcd(a, b) * b;}

#pragma endregion

template<typename T>
void SV(vector<T> v){
    REP(i,v.size()){
        #ifdef LOCAL
            cout << i << " : " << v[i] << endl;
        #endif
    }
}
int bitCount(int bits) {
    bits = (bits & 0x55555555) + (bits >> 1 & 0x55555555);
    bits = (bits & 0x33333333) + (bits >> 2 & 0x33333333);
    bits = (bits & 0x0f0f0f0f) + (bits >> 4 & 0x0f0f0f0f);
    bits = (bits & 0x00ff00ff) + (bits >> 8 & 0x00ff00ff);
    return (bits & 0x0000ffff) + (bits >> 16);
}

int main(void){
    int N;
    cin >> N;
    vv(int) A(N);
    vv(ll) memo(N);
    REP(i, N){
        cin >> A[i];
    }
    ll cnt = 0;
    REP(i, N){
        if(i-A[i]>=0){
            cnt+=memo[i-A[i]];
        }
        if(i+A[i]<N){
            memo[i+A[i]]++;
        }
    }
    cout << cnt << endl;
    return 0;
}


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


int main(){
    
    int a,b;
    cin >> a >> b; 
    if ( (a+b)%2 == 0 ){
        cout << (a+b)/2 << endl;
    }
    else{
        cout << "IMPOSSIBLE" << endl;
    }


    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0;i<n;i++)
#define rep1(i,n) for(int i = 1;i<n;i++)
typedef long long ll;
#define vint vector<int>
#define vstring vector<string>
#define vll vector<ll>
#define vbool vector<bool>
#define INF 100000000


int main(){
  int n;
  cin >> n;
  vint A(n);
  vint B(n);
  vint C(n);

  rep(i,n) cin >> A[i];
  rep(i,n) cin >> B[i];
  rep(i,n) cin >> C[i];

  sort(A.begin(),A.end());
  sort(B.begin(),B.end());
  sort(C.begin(),C.end()); 
  ll ans = 0;
  rep(i,n){
    auto down = lower_bound(A.begin(),A.end(),B[i]);
    auto up = upper_bound(C.begin(),C.end(),B[i]);
    size_t downpos = distance(A.begin(),down);
    size_t uppos = distance(C.begin(),up);
    //cout << downpos << " " << uppos << endl;
    ans += (n-uppos)*downpos;
  }
  cout << ans << endl;
}

Measured memory_bytes: 1408
using System;
using System.Collections.Generic;
using System.Linq;
using static System.Math;

namespace CSharp
{
    static class Program
    {
        static void Main(string[] args)
        {
            long h = ReadLong();
            long answer = Solve(h, new Dictionary<long, long>());
            Console.WriteLine(answer);
        }

        static long Solve(long h, Dictionary<long, long> memo)
        {
            long answer;
            if (memo.TryGetValue(h, out answer))
            {
                return answer;
            }

            if (h == 1)
            {
                return 1;
            }

            return memo[h] = 1 + Solve(h / 2, memo) * 2;
        }

        #region Helpers

        static int[] ReadIntArray() => Console.ReadLine().Split().Select(s => int.Parse(s)).ToArray();
        static long[] ReadLongArray() => Console.ReadLine().Split().Select(s => long.Parse(s)).ToArray();

        static int[] ReadLineIntArray(int count) => Enumerable.Repeat(0, count).Select(_ => int.Parse(Console.ReadLine())).ToArray();
        static long[] ReadLineLongArray(int count) => Enumerable.Repeat(0, count).Select(_ => long.Parse(Console.ReadLine())).ToArray();

        static string ReadString() => Console.ReadLine();
        static int ReadInt() => int.Parse(Console.ReadLine());
        static long ReadLong() => long.Parse(Console.ReadLine());

        static void ReadInt(out int first)
        {
            var array = ReadIntArray();
            first = array[0];
        }

        static void ReadInt(out int first, out int second)
        {
            var array = ReadIntArray();
            first = array[0];
            second = array[1];
        }

        static void ReadInt(out int first, out int second, out int third)
        {
            var array = ReadIntArray();
            first = array[0];
            second = array[1];
            third = array[2];
        }

        static void ReadInt(out int first, out int second, out int third, out int fourth)
        {
            var array = ReadIntArray();
            first = array[0];
            second = array[1];
            third = array[2];
            fourth = array[3];
        }

        static void ReadLong(out long first)
        {
            var array = ReadLongArray();
            first = array[0];
        }

        static void ReadLong(out long first, out long second)
        {
            var array = ReadLongArray();
            first = array[0];
            second = array[1];
        }

        static void ReadLong(out long first, out long second, out long third)
        {
            var array = ReadLongArray();
            first = array[0];
            second = array[1];
            third = array[2];
        }

        static void ReadLong(out long first, out long second, out long third, out long fourth)
        {
            var array = ReadLongArray();
            first = array[0];
            second = array[1];
            third = array[2];
            fourth = array[3];
        }

        #endregion
    }
}

Measured memory_bytes: 13276
let partition (a : int array) p r =
  let swap i j = let tmp = a.(i) in a.(i) <- a.(j); a.(j) <- tmp in
  let rec doit = function
    | (i, j) when j = r -> swap i r; i
    | (i, j) when a.(j) <= a.(r) -> swap i j; doit (i + 1, j + 1)
    | (i, j) -> doit (i, j + 1) in
  doit (p, p)

let () =
  let n = read_int () in
  let a = Array.init n (fun _ -> Scanf.scanf "%d " (fun i -> i)) in
  let k = partition a 0 (n - 1) in
  Array.iteri (fun i e -> if i = 0 then print_int e else if i = k then (print_string " ["; print_int e; print_string "]") else (print_string " "; print_int e)) a;
  print_newline ()

Measured memory_bytes: 5220
#pragma GCC optimize "03"
#include "bits/stdc++.h"
using namespace std;
 
#define ll long long int
#define ld long double
#define pi pair<int, int>
#define pb push_back
#define fi first
#define se second
#define IOS ios::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#ifndef LOCAL
#define endl '\n'
#endif
 
const int N = 6e5 + 5;
const int B = 19;
const int mod = 1e9 + 7;
const int inf = 1e9 + 9;
 
int p[B], a[N];
vector<int> v[N];

bool cmp(int x, int y){
    return a[x] < a[y];
}

signed main() {
    IOS;
    #ifdef LOCAL
        freopen("input.txt","r", stdin);
        freopen("output.txt","w",stdout);
    #endif
    p[0] = 1;
    for(int i = 1; i < B; i++)
        p[i] = (p[i-1] << 1);
    int n, ans = 0;  cin >> n;
    for(int i = 0; i < p[n]; i++){
        int x;  cin >> x;
        a[i] = x;
        v[i].push_back(i);
        sort(v[i].begin(), v[i].end(), cmp);
        v[i].erase(unique(v[i].begin(), v[i].end()), v[i].end());
        reverse(v[i].begin(), v[i].end());
        /*cout << i << endl;
        for(auto j: v[i])
            cout << a[j] << " ";
        cout << endl;*/
        while(v[i].size() > 2)
            v[i].pop_back();
        for(int b = 0; b < B; b++){
            if(!(p[b]&i)){
                v[p[b]+i].push_back(v[i][0]);
                v[p[b]+i].push_back(v[i][1]);
            }
        }
        if(i >= 1){
            ans = max(ans, a[v[i][0]] + a[v[i][1]]);
            cout << ans << endl;
        }
    }
    return 0;
}

Measured memory_bytes: 62336
#include <stdio.h>
#include <bits/stdc++.h>
#include <iostream>

using namespace std;

int main()
{
  char a[27]="abcdefghijklmnopqrstuvwxyz";

  //char s[1];
  char s;
  scanf("%c", &s);

  for(int i=0; i<27; i++){
    if(a[i]==s){
      printf("%c\n", a[i+1]);
      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() {

  int N,Ans=0;
  string S;
  cin>>N>>S;
  
  rep(i,N-2){if(S.at(i)=='A'){if(S.at(i+1)=='B'){if(S.at(i+2)=='C'){Ans++;}}}}
  cout<<Ans<<endl;
}

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

using namespace std;

#define lp(i,n) for(int i = 0; i <n;i++)
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define MP make_pair
#define SZ(v) ((int)((v).size()))
typedef long long ll;

const ll MOD = 1e9 + 7;
const int OO = (int)1e6;
const int N = (int)1e7;

void init(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
}
int n;
bool vis[N];
int col[N];
vector<vector<pair<int,int>>>adj;
void dfs(int parent ,int cur,int color){
    if(vis[cur])return;
    vis[cur]=1;
    col[cur]=color;
    for(int i=0;i<adj[cur].size();i++){
        auto node = adj[cur][i];
        if(node.first==parent)continue;
        dfs(cur,node.first,color^node.second);
    }
}
int main() {
	#   ifdef LOCAL_PROJECT
        freopen("in.txt", "r", stdin);
    #   endif
    scanf("%d",&n);
    adj=vector<vector<pair<int,int>>>(n);
    for(int i=1;i<n;i++){
        int from,to,w;
        scanf("%d%d%d",&from,&to,&w);
        from--;
        to--;
        adj[from].push_back({to,w%2});
        adj[to].push_back({from,w%2});
    }
    dfs(-1,0,0);
    for(int i=0;i<n;i++){
        printf("%d\n",col[i]);
    }
    return 0;
}

Measured memory_bytes: 10240
#include <stdio.h>
#include <math.h>

#define SIZE 1000000
int prime[SIZE];

int sosu ( int n ) {
	int i , lim = (int)(sqrt(n));
	for ( i = 2; i <= lim; i++ ) {
		if ( n % i == 0 ) return 0;
	}
	return 1;
}

void tmp(void) {
	int i;
	prime[0] = prime[1] = 0;
	for ( i = 2; i < SIZE; i++ ) {
		prime[i] = sosu(i);
	}
	return;
}

int main (void) {
	int n , i;
	tmp();
	
	while ( scanf("%d",&n) != EOF ) {
		int count = 0;
		for ( i = 0; i <= n; i++ ) {
			if ( prime[i] ) count++;
		}
		printf("%d\n",count);
	}
	return 0;
}

Measured memory_bytes: 4308
#include <bits/stdc++.h>
using namespace std;
#define ALL(obj) obj.begin(),obj.end()
#define pb(obj) push_back(obj)
#define REP(i,N) for(ll i=0;i<N;i++)
typedef long long ll;
ll const MOD=1000000007;
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N,C;
    cin>>N>>C;
    vector<vector<int>>D(C+1,vector<int>(C+1));
    for(int i=1;i<=C;i++){
        for(int j=1;j<=C;j++){
            cin>>D[i][j];
        }
    }
    vector<int>zero(C+1,0);
    vector<int>one(C+1,0);
    vector<int>two(C+1,0);
    int c;
    REP(i,N){
        REP(j,N){
            cin>>c;
            if((i+j+2)%3==0)zero[c]++;
            if((i+j+2)%3==1)one[c]++;
            if((i+j+2)%3==2)two[c]++;
        }
    }
    int sub=1000000000;
    for(int i=1;i<=C;i++){//zero
        for(int j=1;j<=C;j++){//one
            for(int k=1;k<=C;k++){//two
                if(i==j||j==k||k==i)continue;
                int sum=0;
                for(int l=1;l<=C;l++){
                    sum+=D[l][i]*zero[l]+D[l][j]*one[l]+D[l][k]*two[l];
                }
                sub=min(sum,sub);
            }
        }
    }
    cout<<sub<<endl;
}

Measured memory_bytes: 256
#include <cstdio>
#include <iostream>
#include <cmath>
#include <ctype.h>
#include <string>
#include <sstream>
#include <iostream>
#include <algorithm>
#include <cstdlib>
#include <map>
#include <queue>
#include <utility>
#include <vector>
#include <set>
#include <list>
#include <cstring>
#include <stack>

using namespace std;

#define mod 1000000007

vector<pair<int, int> > numtoplace(1000001);
vector<pair<int, int> > result;
map<pair<int, int>, int> placetonum;

void getplace()
{
	numtoplace[1] = make_pair(0, 0);
	placetonum[make_pair(0, 0)] = 1;
	for(int i = 1; i <= 500; i++){
		int tmp = 2 * i - 1;
		int x = numtoplace[tmp * tmp].first;
		int y = numtoplace[tmp * tmp].second;
		int nx = x;
		int ny = y;
		int dx[4] = {-1, 0, 1, 0};
		int dy[4] = {0, -1, 0, 1};
		for(int j = 0; j < 4; j++){
			for(int k = 1; k <= 2 * i; k++){
				if(tmp * tmp + 2 * i * j + k > 1000001){
					j = 5;
					i = 501;
					break;
				}
				if(j == 0 && k == 1){
					ny++;
				} else {
					nx += dx[j];
					ny += dy[j];
				}
				// cout << tmp * tmp + 2 * i * j + k << " " << nx << " " << ny << endl;
				numtoplace[tmp * tmp + 2 * i * j + k] = make_pair(nx, ny);
				placetonum[make_pair(nx, ny)] = tmp * tmp + 2 * i * j + k;
			}
		}
	}
}

bool isprime(int n)
{
	if(n == 1) return false;
	if(n == 2) return true;
	for(int i = 2; i * i <= n; i++){
		if(n % i == 0) return false;
	}
	return true;
}

pair<int, int> getresult(int n, int m)
{
	if(n > m) return make_pair(0, 0);
	if(result[n] != make_pair(-1, -1)) return result[n];
	int dokutsunum = 0;
	int lastprime = 0;
	int x = numtoplace[n].first;
	int y = numtoplace[n].second;
	for(int i = -1; i < 2; i++){
			if(placetonum.find(make_pair(x + 1, y + i)) == placetonum.end()) continue;
			pair<int, int> tmp = getresult(placetonum[make_pair(x + 1, y + i)], m);
			if(tmp.first > dokutsunum){
				dokutsunum = tmp.first;
				lastprime = tmp.second;
			} else if(tmp.first == dokutsunum){
				lastprime = max(lastprime, tmp.second);
			}
	}
	if(isprime(n)){
		dokutsunum++;
		if(lastprime == 0) lastprime = n;
	}
	result[n] = make_pair(dokutsunum, lastprime);
	return result[n];
}

int main()
{
	getplace();
	int n, m;
	while(1){
		cin >> m >> n;
		if(n == 0 && m == 0) break;
		result = vector<pair<int, int> >(m + 1, make_pair(-1, -1));
		pair<int, int> tmp = getresult(n, m);
		cout << tmp.first << " " << tmp.second << endl;
	}
}

Measured memory_bytes: 88796
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author
 */

#include <iostream>
#include <fstream>

#include <bits/stdc++.h>


using namespace std;
typedef long long unsigned int ll;

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))

class AEatingSymbolsEasy {
public:
void solve(std::istream& cin, std::ostream& cout) {
    //int a,b;
    int ans = 0;
    //string ans = "";
    string a;
    cin >> a;
    int count;
    for(int i=0;i<4;i++){
        if(a[i]=='+') { ans++; }
        else{ ans--; }
    }

    cout << ans << endl;
}
};


int main() {
	AEatingSymbolsEasy solver;
	std::istream& in(std::cin);
	std::ostream& out(std::cout);
	solver.solve(in, out);
	return 0;
}


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

int main()
{
	string s;
	int ans=0;
	cin >> s;
	for (int i = 0; i < s.size(); i++) {
		if (i % 2 == 0 && s[i] == 'L') break;
		if (i % 2 == 1 && s[i] == 'R') break;
		if (i == s.size() - 1) ans = 1;
}
	if (ans == 1) cout << "Yes" << endl;
	else cout << "No" << endl;
	return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

class Problem {
    private int N;
    private int W;
    private int[] weights;
    private int[] values;
    private long[][] dp;

    Problem() {
        Scanner sc = new Scanner(System.in);

        N = sc.nextInt();
        W = sc.nextInt();

        weights = new int[N];
        values = new int[N];
        for (int i = 0; i < N; i++) {
            weights[i] = sc.nextInt();
            values[i] = sc.nextInt();
        }
    }

    private long maximize(int n, int w) {
        if (n >= N || w <= 0) {
            return 0;
        }

        if (dp[n][w] != -1) return dp[n][w];

        long ret = -1;
        if (weights[n] > w) {
            ret = maximize(n + 1, w);
        } else {
            ret = Math.max(
                    maximize(n + 1, w),
                    maximize(n + 1, w - weights[n]) + (long) values[n]
            );
        }

        dp[n][w] = ret;

        return ret;
    }

    long solve() {
        dp = new long[N][W+1];
        for (int i = 0; i < N; i++) {
            for (int j = 0; j <= W; j++) {
                dp[i][j] = -1;
            }
        }

        return maximize(0, W);
    }
}

public class Main {
    public static void main(String[] args) {
        long ans = new Problem().solve();
        System.out.println(ans);
    }
}


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

long long f1[100000][2];


int main() {
    ios_base::sync_with_stdio(false);
//   freopen("a.in", "r", stdin);

    int n;
    cin >> n;
    vector<int> V;
    for(int i = 0;i < n;++i){
        int a;
        cin >> a;
        V.push_back(a);
    }
    int cnt = 1;
    int ans = 0;
    for(int i = 1;i < n;++i){
        if(V[i] == V[i - 1]) cnt++;
        else{
            ans = ans + (cnt) / 2;
            cnt = 1;
        }
    }
    ans = ans + cnt / 2;
    cout << ans;
    return 0;
}

Measured memory_bytes: 256
#include <assert.h>
#include <bits/stdc++.h>
#include <math.h>
#include <string.h>
#include <algorithm>
#include <bitset>
#include <fstream>
#include <unordered_map>
#include <iostream>
#include <list>
#include <set>
#include <stack>
#include <string>
#include <vector>

 
using namespace std;

typedef string str;
typedef long long ll;
typedef long double ld;
typedef complex<ld> cd;
typedef long long ll;
typedef pair<int, int> pi;
typedef pair<ll, ll> pl;
typedef vector<int> vi;
typedef vector<ll> vl;

#define mp make_pair
#define pb push_back
#define sz(x) (int)x.size()
#define f first
#define s second
#define lb lower_bound
#define ub upper_bound
#define trav(a, x) for (auto &a : x)
#define F0R(i, a) for (int i = 0; i < (a); i++)
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define FORd(i, a, b) for (int i = (b)-1; i >= (a); i--)
#define F0Rd(i, a) for (int i = (a)-1; i >= 0; i--)
#define MAX(a, b) ((a) > (b) ? (a) : (b))
#define MIN(a, b) ((a) < (b) ? (a) : (b))
#define PRINT_ARRAY(a, N)        \
  F0R(z, N) cout << a[z] << " "; \
  cout << "\n"
 
const int MOD = 1000000007;  // 998244353;
const ll INF = 1e18;
const ld PI = 4 * atan((ld)1);


int main() {
		ll N;
		cin >> N;
		if (N % 10 == 2 || N % 10 == 4 || N % 10 == 5 || N % 10 == 7 || N % 10 == 9) {
				cout << "hon" << endl;
		} else if (N % 10 == 3) {
				cout << "bon" << endl;
		} else {
				cout << "pon" << endl;
		}
}


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

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	ll T;
	cin >> T;
	if(T%1000 != 0)
	cout << 1000-T%1000<<endl;
	else
	{
		cout <<0<<endl;
	}
	
}


Measured memory_bytes: 3644
/* author: jeetganatra */

#include<bits/stdc++.h>
using namespace std;
 
#define ff              first
#define ss              second
#define int             long long
#define pb              push_back
#define mp              make_pair
#define fo(i,n)         for(int i=0;i<n;i++)
#define Fo(i,k,n)       for(int i=k;k<n?i<n:i>n;k<n?i+=1:i-=1)
#define tr(it, a)       for(auto it = a.begin(); it != a.end(); it++)
#define pii             pair<int,int>
#define vi              vector<int>
#define mii             map<int,int>
#define pqb             priority_queue<int>
#define pqs             priority_queue<int,vi,greater<int> >
#define setbits(x)      __builtin_popcountll(x)
#define zrobits(x)      __builtin_ctzll(x)
#define mod             998244353
#define inf             1e18
#define ps(x,y)         fixed<<setprecision(y)<<x
#define mk(arr,n,type)  type *arr=new type[n];
#define w(x)            int x; cin>>x; while(x--)
#define pw(b,p)         pow(b,p) + 0.1
#define deb(x)          cout << #x << "=" << x << endl
#define deb2(x, y)      cout << #x << "=" << x << "," << #y << "=" << y << endl
#define all(x)          x.begin(), x.end()
#define clr(x)          memset(x, 0, sizeof(x))
#define sortall(x)      sort(all(x))
#define endl            "\n"
#define PI              3.14159265
mt19937                 rng(chrono::steady_clock::now().time_since_epoch().count());

 
void jpg()
{
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
}

int mpow(int base, int exp); 


                                                                                                                                                                                                                             
int32_t main()
{
	jpg();
	char a;
	cin>>a;
	int n=a;
	if (n>=65&&n<=90)
		cout<<'A'<<endl;
	else
		cout<<'a'<<endl;
}


int mpow(int base, int exp) {
  base %= mod;
  int result = 1;
  while (exp > 0) {
    if (exp & 1) result = ((int)result * base) % mod;
    base = ((int)base * base) % mod;
    exp >>= 1;
  }
  return result;
}



Measured memory_bytes: 3636