akhauriyash/Code-Regression huggingface dataset:
n, y = map(int, input().split())
 
f = True
 
for i in range(y // 10000 + 1):
    for j in range((y - 10000 * i) // 5000 + 1):
        if 10000 * i + 5000 * j + 1000 * (n - i - j) == y:
            ans = "{} {} {}".format(i, j, n - i - j)
            print(ans)
            f = False
            exit()
        else:
            pass
 
if f:
   print("-1 -1 -1")

Measured memory_bytes: 9040
#include <bits/stdc++.h>
using namespace std;
#define mod 1000000007
#define ll long long int
ll n,m;
ll dp[6500][6500]={0};

void solve(ll *s, ll *t){
    memset(dp, 0,sizeof dp);
    for(ll i=1;i<=n;i++){
        for(ll j=1;j<=m;j++){
            if(s[i-1]==t[j-1])
                dp[i][j] = (1 + dp[i-1][j]%mod + dp[i][j-1]%mod)%mod;
            else
            dp[i][j] = ((dp[i-1][j]%mod + dp[i][j-1])%mod - dp[i-1][j-1]%mod + mod) %mod;
        }
    }
    // return dp[n][m];
}

int main() {
    cin>>n>>m;
    ll s[n],t[m];
    for(ll i=0;i<n;i++)cin>>s[i];
    
    for(ll i=0;i<m;i++)cin>>t[i];
    solve(s,t);
    cout<< (dp[n][m] + 1) %mod; 
    return 0;
}


Measured memory_bytes: 330368
// /usr/local/bin/g++ Main.cpp -std=c++14
#include <bits/stdc++.h>

#define INF 4000001
using namespace std;

// Input parameter
int N, M, A, B, C;
// Rosen list
struct edge {int to, co;};
vector<edge> g[100010];
// The shortest distance list @station
int dis[100010];
// Temporary company list @station
set<int> disc[100010];

int main() {
	ios::sync_with_stdio(0);
	cin.tie(0);
	cin >> N >> M;
	// Create Rosen List
	// g[STATION] -> {toStation, Company}
	for (int i = 0; i < M; i++) {
		cin >> A >> B >> C;
		g[A].push_back({B, C});
		g[B].push_back({A, C});
	}

	// Initialize distance list (cost list)
	dis[1] = 0;
	for (int i = 2; i <= N; i++) {
		dis[i] = INF;
	}
	// Initialize iteration queue ({distance(cost), station})
	priority_queue<pair<int, int> > q;
	q.push({-dis[1], 1});

	// q            : {distance, station}
	// dis[Station] : distance
	// disc[Station]: Company List
	while(q.size()) {
		int now = q.top().second;
		int d = -q.top().first;
		q.pop();
		if (dis[now] < d) continue;
		for (edge j : g[now]) {
			int nd = dis[now];
			if (!disc[now].count(j.co)) nd++;
			if (nd < dis[j.to]) {
				dis[j.to] = nd;
				disc[j.to].clear();
				disc[j.to].insert(j.co);
				q.push({-dis[j.to], j.to});
			} else if (nd == dis[j.to]) {
				disc[j.to].insert(j.co);
			}
		}
	}

	if (dis[N] == INF) {
		cout << -1 << endl;
	} else {
		cout << dis[N] << endl;
	}
}

Measured memory_bytes: 23412
#include<bits/stdc++.h>
#define taskname "A"
#define pb push_back
#define mp make_pair

using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> ii;
const int maxn = 2e5 + 5;
ll a[maxn];
int n , q;
ii res[maxn];
int lab[maxn];
int FindLab(int u){return lab[u] < 0 ? u : lab[u] = FindLab(lab[u]);}

void Connect(int u , int v){
    u = FindLab(u),v = FindLab(v);
    if(u == v)return;
    if(lab[u] > lab[v])swap(u , v);
    lab[u] += lab[v];
    lab[v] = u;
    res[u].first += res[v].first;
    res[u].second += res[v].second;
}

int main(){
    if(fopen(taskname".INP","r")){
        freopen(taskname".INP","r",stdin);
        freopen(taskname".OUT","w",stdout);
    }
    cin >> n;
    fill_n(lab,maxn,-1);
    for(int i = 1 ; i <= 1e5 ; ++i){
        res[i] = mp(1 , 0);
        res[i + (int)1e5] = mp(0 , 1);
    }
    for(int i = 1 ; i <= n ; ++i){
        int x , y;cin >> x >> y;
        Connect(x , y + 1e5);
    }
    ll ans = 0;
    for(int i = 1 ; i < maxn ; ++i){
        if(lab[i] < 0){
            ans += (ll)res[i].first * res[i].second;
//            cout << res[i].first << " " << res[i].second << endl;
        }
    }
    cout << ans - n;
}



Measured memory_bytes: 2560
#include<bits/stdc++.h>
using namespace std;
int main()
{
 string s;
 int flag=0;
 int q=0;
 cin>>s;
 int l=s.length();
 for(int i=0;i<=l-1;i++)
     {if(s[i]=='C')
         flag=1;
      if(flag==1&&s[i]=='F')
         q=1;
     }
 if(flag+q==2)
   cout<<"Yes"<<endl;
 else
   cout<<"No"<<endl;
 return 0;
}

Measured memory_bytes: 256
n=int(input())
a=list(map(int,input().split()))
c=0
for i in range(n):
    if a[i]<0:
        c+=1
        a[i]=-1*a[i]
aa=list(map(abs,a))
if c%2==0:
    print(sum(aa))
else:
    print(sum(aa)-2*min(aa))


Measured memory_bytes: 14412
# coding: utf-8
# Your code here!
import sys
sys.setrecursionlimit(10**9)

def dfs(loc,num):
    root[loc]=num
    for item in plan[loc]:
        if root[item]==-1:
            dfs(item,num)
    return 0

N,M=map(int,input().split())

P=list(map(int,input().split()))

plan=[[]for i in range(N)]
root=[-1]*N

for _ in range(M):
    a,b=map(int,input().split())
    plan[a-1].append(b-1)
    plan[b-1].append(a-1)

for i in range(N):
    if root[i]==-1:
        dfs(i,i)

ans=0
for i in range(N):
    if root[i]==root[P[i]-1]:
        ans+=1
#print(root)
print(ans)

Measured memory_bytes: 83044
import java.util.Scanner;

public class Main 
{
	public static void main(String arg[])
	{
		Scanner scan = new Scanner(System.in);
		int n = scan.nextInt();
		int de = 100000;

		for(int i=0; i<n; i++)
		{
			de = de / 100;
			de = de * 105;
			if(de%1000 != 0)
				de += 1000;
			de = de/1000;
			de = de*1000; 
		}
		System.out.println(de);
	}

}

Measured memory_bytes: 11000
N = int(input())
Y = []
for _ in range(N):
    Y.append(list(map(int, input().split())))  # Y = [[3, 9, 7], [10, 3, 2]]
dp = [[0] * 3 for _ in range(N)]  # 初期化
dp[0] = Y[0]  # 初期化

# A, B, C の3パターン以外にも対応
for i in range(N-1):
    for j in range(3):
        for k in range(3):
            if j == k:
                continue
            dp[i+1][j] = max(dp[i+1][j], dp[i][k] + Y[i+1][j])
print(max(dp[N-1]))

Measured memory_bytes: 47352
#include <iostream>

using namespace std;

int main(){
    char c;
    int a[26] = {};
    while(cin >> c){
        if(c >= 'A' && c <= 'Z') c += - 'A' + 'a';
        a[c - 'a']++;
    }
    for(int i = 0; i < 26; i++){
        cout << char(i + 'a') << " : " << a[i] << endl;
    }
    return 0;
}



Measured memory_bytes: 3092
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include<math.h>
#define int long long
using namespace std;
const int INF = 10000000000000;//5000000000000000

signed main() {
	int N, K;
	cin >> N >> K;
	int half = 0;
	if (K == 1) cout << "0" << endl;
	else {
		if (K % 2 == 1) half = K / 2 - 1;
		else half = K / 2;
		while (N > half) {
			if (N < K) N = K - N;
			else N %= K;
		}
		cout << N << endl;
	}
}

Measured memory_bytes: 3632
#include<iostream>
#include<cstdio>
#include<cmath>
#include<vector>
#include<queue>
#include<map>
#include<algorithm>
#include<set>
#include<complex>
#include<string>
#include<cstring>
using namespace std;
#define rep2(x,from,to) for(long long x=(from);(x)<(to);(x)++)
#define rep(x,to) rep2(x,0,to)
#define INF 100000000
#define debug(x) cout<<#x<<": "<<x<<endl

#define all(x) x.begin(),x.end()
typedef pair<long long,long long> P;
typedef pair<long long,P> PP;
typedef pair<long long,PP> PPP;
long long x,y,z,K;
long long a[1006];
long long b[1006];
long long c[1006];
priority_queue<PPP> que;
PPP p;
PPP before;
long long f;
int main()
{
	f=1;
	cin>>x>>y>>z>>K;
	rep(i,x)cin>>a[i];
	rep(i,y)cin>>b[i];
	rep(i,z)cin>>c[i];
	sort(a,a+x);
	sort(b,b+y);
	sort(c,c+z);
	que.push(PPP(a[x-1]+b[y-1]+c[z-1],PP(x-1,P(y-1,z-1))));
	while(!que.empty())
	{
		
		p=que.top();que.pop();
		if(!f&&before==p)continue;
		cout<<p.first<<endl;K--;
		if(K==0)break;
		long long xx=p.second.first;
		long long yy=p.second.second.first;
		long long zz=p.second.second.second;
		//cout<<p.first<<"--"<<p.second.first<<"--"<<p.second.second.first<<"--"<<p.second.second.second<<endl;
		if(xx>0) que.push(PPP(a[xx-1]+b[yy]+c[zz],PP(xx-1,P(yy,zz))));
		if(yy>0) que.push(PPP(a[xx]+b[yy-1]+c[zz],PP(xx,P(yy-1,zz))));
		if(zz>0) que.push(PPP(a[xx]+b[yy]+c[zz-1],PP(xx,P(yy,zz-1))));
		before=p;f=0;
	}
	return 0;
}

Measured memory_bytes: 512
#include <iostream>

using namespace std;

#define int long long

int32_t main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);    
  string s, t;
  cin >> s >> t;
  int n = s.length();
  int k = t.length();
  int ans = 1e9;
  for (int i = 0; i + k <= n; ++i) {
    int c = 0;
    for (int j = i; j < i + k; ++j) {
      c += s[j] != t[j - i];
    }
    ans = min(ans, c);
  }
  cout << ans;
  return 0;
}


Measured memory_bytes: 3176
#include <iostream>
#include <cmath>
using namespace std;
using ll = long long;

int main() {
  int n, m;
  cin >> n >> m;
  if (n % 2 == 0) {
    for (int i = 0; i < m; i++) {
      if (2 * i + 1 < n / 2)
        cout << i + 1 << " " << n - i << endl;
      else
        cout << i + 1 << " " << n - i - 1 << endl;
    }
  }
  if (n % 2 == 1) {
    for (int i = 0; i < m; i++) {
      cout << i + 1 << " " << n - i << endl;
    }
  }
  return 0;
}

Measured memory_bytes: 3636
# -*- coding: utf-8 -*-
import sys
import math
from bisect import bisect_left
from bisect import bisect_right
from collections import defaultdict
from heapq import heappop, heappush
import itertools
import random
from decimal import *

input = sys.stdin.readline

def inputInt(): return int(input())
def inputMap(): return map(int, input().split())
def inputList(): return list(map(int, input().split()))
def inputStr(): return input()[:-1]

inf = float('inf')
mod = 1000000007

#-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-
#-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-

def main():
	N = inputInt()

	for i in range(100000):
		tmp = i * 1000
		#print(tmp)
		ans = tmp-N
		if ans >= 0:
			print(ans)
			sys.exit()

	print(N)

#-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-
#-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-
if __name__ == "__main__":
	main()


Measured memory_bytes: 83628
/*痛みを受け取れ，痛みを知れ*/
#include<bits/stdc++.h>
#define f(i,a,b) for(register int i=a;i<=b;++i)
#define ff(i,a,b) for(register int i=a;i>=b;--i)
#define debug(x) cerr << #x << " : " << x << " " << endl
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<string, string> pss;
const ll mod = 1000007;
const int inf = 0x3f3f3f3f;
const double tiaohe = 0.57721566490153286060651209;
ll oula(ll x) { ll res = x;f(i, 2, x / i) { if (x % i == 0) { res = res / i * (i - 1);while (x % i == 0) x /= i; } }if (x > 1) res = res / x * (x - 1);return res; }
ll quickmod(ll a, ll n, ll m) { ll s = 1;while (n) { if (n & 1) { s = s * a % m; }a = (a*a) % m;n = n / 2; }return s; }
ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }
void ex_gcd(ll a, ll b, ll &x, ll &y, ll &d) { if (!b) { d = a, x = 1, y = 0; } else { ex_gcd(b, a % b, y, x, d);y -= x * (a / b); } }
ll inv(ll t, ll p) { ll d, x, y;ex_gcd(t, p, x, y, d);return d == 1 ? (x % p + p) % p : -1; }
bool isPrime(ll x) { if (x == 2)return true;if (x % 2 == 0)return false;for (ll i = 2;i*i <= x;i++) if (x % i == 0)return false; return true; }
//double a = log(n) +tiaohe + 1.0 / (2 * n);
double eqa = (1 + sqrt(5.0)) / 2.0;
const int N = 6e5 + 5;

int main()
{
	//freopen("in.txt", "r", stdin);
	int n;
	string s, t;
	while (cin >>n>>s>>t)
	{
		int fg = 0;
		int l = 0, r = 0;
		while (fg <= n + n - 1)
		{
			fg++;
			if (fg & 1)
			{
				printf("%c", s[l++]);
			}
			else
			{
				printf("%c", t[r++]);
			}
		}
	}
	return 0;
}


Measured memory_bytes: 3536
# -*- coding: utf-8 -*-

def main():
    N = int(input())
    d = list(map(int,input().split()))
    Ans = 0
    for i in range(N):
        for j in range(i+1,N):
            Ans += d[i] * d[j]
    print(Ans)




if __name__ == "__main__":
    main()


Measured memory_bytes: 2940
#include<stdio.h>
#include<stdlib.h>
#define MAX 100000
int A[MAX+1],n;
int partition(int p,int r){
  int x,i,j,temp=0;
  x=A[r];
  i=p-1;
  for(j=p;j<r;j++){
    if(A[j]<=x){
      i=i+1;
      temp=A[i];
      A[i]=A[j];
      A[j]=temp;
    }
  }
  temp=A[i+1];
  A[i+1]=A[r];
  A[r]=temp;
  return i+1;
}

int main(){
  int i,q;

  scanf("%d",&n);
  for(i=0;i<n;i++){
    scanf("%d",&A[i]);
  }

  q=partition(0,n-1);
  for(i=0;i<n;i++){
    if(i>0)printf(" ");
    if(i==q)printf("[");
    printf("%d",A[i]);
    if(i==q)printf("]");
  }printf("\n");
  return 0;
}



Measured memory_bytes: 2108
#include <stdio.h>
#define N 2000000
#define MAX 10000

void CountingSort(int *,int);
int n;

int main(){
  int i,*A;

  scanf("%d",&n);

  A = malloc(sizeof(int)*n+1);

  for(i=0;i<n;i++) scanf("%d",&A[i]);

  CountingSort(A,MAX);

  for(i=0;i<n-1;i++) printf("%d ",A[i]);
  printf("%d\n",A[n-1]);

  return 0;
}

void CountingSort(int *A,int k){
  int i,*B,C[k+1];

  B = malloc(sizeof(int)*n+1);

  for(i=0;i<=k;i++) C[i]=0;
  for(i=0;i<n;i++) C[A[i]]++;
  for(i=1;i<=k;i++) C[i]+=C[i-1];

  for(i=n-1;i>=0;i--){
    B[C[A[i]]-1]=A[i];
    C[A[i]]--;
  }

  for(i=0;i<n;i++) A[i]=B[i];
}

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

neigh = [-1, 0, 1]

for i in range(h):
    for j in range(w):
        cnt = 0
        flag = False
        if s[i][j] == '.':
            for k in neigh:
                for l in neigh:
                    if k==l==0 or i+k < 0 or i+k >= h or j+l < 0 or j+l >= w:
                        continue
                    elif s[i+k][j+l] == '#':
                        cnt += 1
            s[i] = s[i][:j] + str(cnt) +s[i][j+1:]
    print(s[i])


Measured memory_bytes: 9156
#include<iostream>
#include<stdio.h>
using namespace std;
int main(){
    int a,b,d,r;
    double f;
    cin>>a>>b;
    d = a/b;
    r = a%b;
    f = (double)a/(double)b;
    cout<<d<<" "<<r<<" ";
    printf("%6lf\n",f);
    return 0;
}


Measured memory_bytes: 3220
import java.util.Arrays;
import java.util.Scanner;

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

	public void run() {
		Scanner sc = new Scanner(System.in);
		int n=sc.nextInt();
		int m=sc.nextInt();
		int x[]=new int[m];
		for(int i=0; i<m; i++) {
			x[i]=sc.nextInt();
		}
		Arrays.sort(x);
		int l[] = new int[m-1];
		for(int i=1; i<m; i++) {
			l[i-1]=x[i]-x[i-1];
		}
		Arrays.sort(l);

		if(n>=m) {
			System.out.println(0);
			sc.close();
			return;
		}
		int ans = Math.abs(x[m-1]-x[0]);
		for(int i=0; i<n-1; i++) {
			ans -= l[m-2-i];
		}
		System.out.println(ans);
		sc.close();
	}

}


Measured memory_bytes: 49632
#include <bits/stdc++.h>
 
#ifndef LOCAL_
#define fprintf if( false ) fprintf
#endif // LOCAL_
#define dumpl(x1) fprintf(stderr, "#%s.%d (%s) = (%ld)\n", __func__, __LINE__, #x1, x1);
#define dumpll(x1, x2) fprintf(stderr, "#%s.%d (%s, %s) = (%ld, %ld)\n", __func__, __LINE__, #x1, #x2, x1, x2);
#define dumpd(x1) fprintf(stderr, "#%s.%d (%s) = (%lf)\n", __func__, __LINE__, #x1, x1);
#define dumpdd(x1, x2) fprintf(stderr, "#%s.%d (%s, %s) = (%lf, %lf)\n", __func__, __LINE__, #x1, #x2, x1, x2);
#define loop for(;;)
 
struct S002 {
  int n;
  S002& operator > (long& x) {
    n = x;
    return *this;
  }
  S002& operator > (long&& x) {
    n = x;
    return *this;
  }
  S002& operator >= (long& x) {
    if( scanf("%ld", &x) <= 0 ) exit(0);
    return *this;
  }
  S002& operator >= (double& x) {
    if( scanf("%lf", &x) <= 0 ) exit(0);
    return *this;
  }
  S002& operator >= (std::string& s) {
    if( not (std::cin >> s) ) exit(0);
    return *this;
  }
  template<typename a>
  S002& operator >= (std::vector<a>& v) {
    v.resize(n);
    for(long i = 0; i < n; ++i) {
      *this >= v[i];
    }
    return *this;
  }
  template<typename a, std::size_t s>
  S002& operator >= (std::array<a, s>& x) {
    for(long i = 0; i < (long)s; ++i) {
      *this >= x[i];
    }
    return *this;
  }
};

struct Solver {
  long n;
  std::string x, y;
  Solver() {
    S002 reader;
    reader >= n >= x >= y;
  }
  void solve() {
    for(long i = 0; i < n; ++i) {
      bool flag = true;
      for(long j = 0; j < n - i; ++j) {
        if( x[i+j] != y[j] ) {
          flag = false;
        }
      }
      if( flag ) {
        printf("%ld\n", n + i);
        return;
      }
    }
    printf("%ld\n", n + n);
  }
};
 
int main() {
  loop std::unique_ptr<Solver>(new Solver())->solve();
  return 0;
}

Measured memory_bytes: 256
import numpy as np
import math
n, m, q = map(int,input().split())
max = 0
j = []
for i in range(q):
    aa,b,c,d = map(int,input().split())
    j.append([aa,b,c,d])

a = [0 for k in range(11)]
for i1 in range(1,11):
    a[1] = i1
    for i2 in range(i1,m+1):
        a[2] = i2
        for i3 in range(i2,m+1):
            a[3] = i3
            for i4 in range(i3,m+1):
                a[4] = i4
                for i5 in range(i4,m+1):
                    a[5] = i5
                    for i6 in range(i5,m+1):
                        a[6] = i6
                        for i7 in range(i6,m+1):
                            a[7] = i7
                            for i8 in range(i7,m+1):
                                a[8] = i8
                                for i9 in range(i8,m+1):
                                    a[9] = i9
                                    for i10 in range(i9,m+1):
                                        a[10] = i10
                                        s = 0
                                        for i in j:
                                            if a[i[1]]-a[i[0]] == i[2]:
                                                s += i[3]
                                        if max < s:
                                            max = s

print(max)



Measured memory_bytes: 26980
////////////////////////////////////////////////////////////////////
// This source code is for Visual Studio
////////////////////////////////////////////////////////////////////
#include <iostream>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <map>
#include <set>
#include <algorithm>
#include <sstream>
#include <iterator>
#include <stack>
#include <functional>
#include <iomanip>
#include <string>
#include <cstring>
#include <deque>
#include <math.h>

#define	numberof(a)	(sizeof(a) / sizeof(a[0]))
#define	INF		UINT64_MAX
#define Rep(i,n) for(int i = 0; i < (n); ++i )

using namespace std;

typedef vector< vector<int> > MAT;
typedef pair<int, int> PINT;
typedef long long ll;
typedef uint32_t u32;
typedef uint64_t u64;
typedef int32_t s32;
typedef int64_t s64;

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI  = acos(-1.0);

int main()
{
	ll N = 0;
	ll Y = 0;
	ll x = -1;	// \10,000
	ll y = -1;	// \5,000
	ll z = -1;	// \1,000

	cin >> N >> Y;

	for (ll tmp_x = 0; tmp_x <= N; ++tmp_x ) {
		for (ll tmp_y = 0; tmp_y <= (N - tmp_x); ++tmp_y) {
			ll tmp_z = N - tmp_x - tmp_y;

			if (Y == tmp_x * 10000 + tmp_y * 5000 + tmp_z * 1000) {
				x = tmp_x;
				y = tmp_y;
				z = tmp_z;
			}
		}
	}

	cout << x << " " << y << " " << z << endl;

	return 0;
}





Measured memory_bytes: 384
X=int(input())

sosu=[1]*(10**5+4)
sosu[0]=0
sosu[1]=0
for i in range(2, 10**5+3):
  for j in range(i, 10**5+4-i, i):
    sosu[i+j]=0
    
print(X+sosu[X:].index(1))

Measured memory_bytes: 4596
#include <iostream>
#include <vector>
using namespace std;
int main(){
  int n; cin >> n;
  vector<int> h(n);
  for(int i = 1;i <= n;i++){
    cin >> h[i];
  }
  int max = 0;
  int count = 0;
  for(int i = 1;i <= n;i++){
    if(h[i] >= max){
      max = h[i];
      count++;
    }
  }
  cout << count << endl;
}

Measured memory_bytes: 256
S = list(map(int,list(input())))
N = len(S)
A_list = []
B_list = []
for i in range(N):
  if i % 2 == 0:
    A_list.append(0)
    B_list.append(1)
  else:
    A_list.append(1)
    B_list.append(0)

A_count = 0
B_count = 0
for i in range(N):
  if S[i] == A_list[i]:
    A_count += 1
  if S[i] == B_list[i]:
    B_count += 1

print(min(A_count,B_count))

Measured memory_bytes: 6552
#include<bits/stdc++.h>
using namespace std;
long long answer[10];
int main(){
    long long h, w, n; map<pair<int,int>, int> cubes;
    cin>>h>>w>>n;
    for(int i=0; i<n; i++){
        int a, b; cin>>a>>b;
        for(int j=0; j<3; j++){
            for(int z=0; z<3; z++)
                cubes[{a-2+j,b-2+z}]++;
        }
    }

    answer[0]=(h-2)*(w-2); 
    for(auto a:cubes){
        if(a.first.first>=1&&a.first.first<=h-2&&a.first.second>=1&&a.first.second<=w-2) {answer[a.second]++; answer[0]--;}
    }
    for(int i=0; i<10; i++){
        cout<<answer[i]<<endl;
    }
    return 0;
}

Measured memory_bytes: 56448
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <deque>
#include <complex>
#include <stack>
#include <queue>
#include <cstdio>
#include <cctype>
#include <cstring>
#include <ctime>
#include <iterator>
#include <bitset>
#include <numeric>
#include <list>
#include <iomanip>
#include <cassert>

#if __cplusplus >= 201103L
#include <array>
#include <tuple>
#include <initializer_list>
#include <unordered_set>
#include <unordered_map>
#include <forward_list>

#define cauto const auto&
#define ALL(v) begin(v),end(v)
#else
#define ALL(v) (v).begin(),(v).end()
#endif

using namespace std;


namespace{
typedef long long LL;
typedef pair<int,int> pii;
typedef pair<LL,LL> pll;

typedef vector<int> vint;
typedef vector<vector<int> > vvint;
typedef vector<long long> vll, vLL;
typedef vector<vector<long long> > vvll, vvLL;

#define VV(T) vector<vector< T > >

template <class T>
void initvv(vector<vector<T> > &v, int a, int b, const T &t = T()){
	v.assign(a, vector<T>(b, t));
}
template <class T> inline T &chmin(T &x, const T &y){ return x = min(x, y); }
template <class T> inline T &chmax(T &x, const T &y){ return x = max(x, y); }
template <class F, class T>
void convert(const F &f, T &t){
	stringstream ss;
	ss << f;
	ss >> t;
}


#define REP(i,n) for(int i=0;i<int(n);++i)
#define RALL(v) (v).rbegin(),(v).rend()


#define MOD 1000000007LL
#define EPS 1e-8


void mainmain(){
	int n, k, c;
	string s;
	cin >> n >> k >> c >> s;

	vector<int> dp(n + 1);
	VV(pii) from(n + 1);
	auto update = [&](int i, int j, int d){
		if(dp[j] < dp[i] + d){
			dp[j] = dp[i] + d;
			from[j].clear();
		}
		if(dp[j] == dp[i] + d){
			from[j].emplace_back(i, d);
		}
	};
	for(int i = 0; i < n; ++i){
		if(s[i] == 'o'){
			update(i, min(i + c + 1, n), 1);
		}
		update(i, i + 1, 0);
	}
	vector<int> ans;
	if(dp[n] == k){
		set<int> st;
		st.insert(n);
		while(!st.empty()){
			auto it = --st.end();
			int u = *it;
			st.erase(it);
			if(st.empty() && from[u].size() == 1 && from[u][0].second == 1){
				ans.push_back(from[u][0].first + 1);
			}
			for(cauto p : from[u]){
				st.insert(p.first);
			}
		}
	}
	sort(ALL(ans));
	for(int x : ans){
		cout << x << '\n';
	}
}



}
int main() try{
	ios::sync_with_stdio(false); cin.tie(0);
	cout << fixed << setprecision(10);
	cerr << fixed << setprecision(4);
	mainmain();
}
catch(...){
	throw;
}


Measured memory_bytes: 14476
#include <iostream>

using namespace std;

int main(void){
    int n;
    int a[200000];
    int leftmax[200001] = {-1};
    int rightmax[200001] = {-1};
    int ans[200000] = {-1};

    cin >> n ;
    for(int i=0; i<n; i++){
        cin >> a[i]; 
    }

    for(int i= (n-1) ; i>=0; i--){
        if(i== (n-1)) {
            rightmax[i] = a[n-1];
        }else{
            ( rightmax[i+1] > a[i] ) ? rightmax[i] = rightmax[i+1] :  rightmax[i] = a[i];
        }
//cout << rightmax[i] << " " ;
    }
//cout<<endl;

    for(int i= 0 ; i<n; i++){
        if(i== 0) {
            leftmax[i] = a[0];
        }else{
            ( leftmax[i-1] > a[i] ) ? leftmax[i] = leftmax[i-1] :  leftmax[i] = a[i];
        }
//cout << leftmax[i] << " " ;
    }
//cout<<endl;


    for(int i=0; i<n; i++){
        if(i==0){ans[i] = rightmax[1]; }
        else if(i==(n-1)){ans[i] = leftmax[n-2]; }
        else{
            if(rightmax[i+1] > leftmax[i-1] ){
                ans[i] =rightmax[i+1];
            }else{
                ans[i] = leftmax[i-1];
            }

        }
    }

    for(int j=0;j<n;j++){
        cout << ans[j] << endl;
    }

    return 0;
}

Measured memory_bytes: 4736
#include <iostream>
using namespace std;
int main(void){
    char n[4];
    for(int i=0;i<4;i++){
        cin>>n[i];
    }
    if(n[1]==n[2]){
        if((n[0]==n[1])||(n[2]==n[3])){
            cout<<"Yes"<<endl;
            return 0;
        }
    }
    cout<<"No"<<endl;
    return 0;
}


Measured memory_bytes: 256
alps = 'abcdefghijklmnopqrstuvwxyz'

def dfs(last, curr_s, sl, n):
    if len(curr_s) == n:
        sl.append(curr_s)
        return

    for i in range(0,last+2):
        s = curr_s + alps[i]
        dfs(max(last,i), s, sl, n)


def main():
    n = int(input())
    sl = []
    dfs(0, 'a', sl, n)
    for s in sl: print(s)


if __name__ == "__main__":
    main()

Measured memory_bytes: 17332
#include <bits/stdc++.h>
#include <vector>
#include <numeric>
#define PI 3.14159265358979323846
#define MAXINF (1e18L)
#define INF (1e9L)
#define EPS (1e-9)
#define MOD ((ll)(1e9+7))
#define REP(i, n) for(int i=0;i<int(n);++i)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define RREP(i, n) for(int i=int(n)-1;i>=0;--i)
#define ALL(v) v.begin(),v.end()
#define FIND(v,x) (binary_search(ALL(v),(x)))
#define SORT(v) sort(ALL(v))
#define RSORT(v) sort(ALL(v));reverse(ALL(v))
#define DEBUG(x) cerr<<#x<<": "<<x<<endl;
#define DEBUG_VEC(v) cerr<<#v<<":";for(int i=0;i<v.size();i++) cerr<<" "<<v[i]; cerr<<endl
#define Yes(n) cout<<((n)?"Yes":"No")<<endl
#define YES(n) cout<<((n)?"YES":"NO")<<endl
#define pb push_back
#define fi first
#define se second
using namespace std;
template<class A>void pr(A a){cout << (a) << endl;}
template<class A,class B>void pr(A a,B b){cout << a << " "  ;pr(b);}
template<class A,class B,class C>void pr(A a,B b,C c){cout << a << " " ;pr(b,c);}
template<class A,class B,class C,class D>void pr(A a,B b,C c,D d){cout << a << " " ;pr(b,c,d);}
template<class T> inline bool chmin(T& a, T b){return a>b ? a=b, true : false;}
template<class T> inline bool chmax(T& a, T b){return a<b ? a=b, true : false;}
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll,ll> pll;

int main(void)
{
    int N;
    cin >> N;
    int ans = 0;
    pr((N+1)/2-1);
}

Measured memory_bytes: 256
#include<stdio.h>
#include<math.h>
int main(void){
    int i,j,n,a[10000],cnt=0;
    scanf("%d",&n);
    for(i=0;i<n;i++){
        scanf("%d",&a[i]);
        for(j=2;j<=sqrt(a[i]);j++){
            if(a[i]%j==0){
                break;
            }    
        }
        if(j>sqrt(a[i])){
            cnt++;
        }
    }
    printf("%d\n",cnt);
	return 0;		
}


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

int main() {
	vector<int> alpha(26);
	char	c;
	while (cin >> c)
	{
		if (isupper(c))
			c = tolower(c);
		if (isalpha(c))
			alpha.at(c - 'a')++;
	}
	rep(i, alpha.size())
		cout << (char)(i + 'a') << " : " << alpha.at(i) << endl;
}



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

int main(){
    int a,b;cin>>a>>b;
    int ans = 0;
    for(int i = 0; i < 2 ;i++){
        if(a>b){
            ans += a;
            a--;
        }else{
            ans += b;
            b--;
        }
    }
    cout << ans << endl;

}

Measured memory_bytes: 256
from collections import deque
while 1:
    W,H = map(int,input().split())
    if W==0 and H==0:break
    tizu = []
    for i in range(H):
        row = input()
        if "@" in row:
            start = (i,row.index("@"))#h,w の順
        tizu.append(row)
    went = [[False]*W for i in range(H)]
    went[start[0]][start[1]] = True
    ans = 1
    queue = deque()#append,popleft
    queue.append(start)
    while queue:
        curh,curw = queue.popleft()
        for dh,dw in ((0,1),(0,-1),(1,0),(-1,0)):
            newh = curh + dh
            neww = curw + dw
            if 0<=newh<H and 0<=neww<W:
                if tizu[newh][neww] == "." and not went[newh][neww]:
                    went[newh][neww] =True
                    queue.append((newh,neww))
                    ans += 1
    print(ans)



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

// {U}{INT,LONG,LLONG}_{MAX,MIN}
#define ALPHABET    (26)
#define INF         INT_MAX
#define MOD         (1000000007LL)
#define EPS         (1e-10)
#define EQ(a, b)    (abs((a)-(b)) < EPS)

using P   = pair<int, int>;
using LL  = long long;
// }}}

int main() {
    std::ios::sync_with_stdio(false);
    int n, k;cin >> n >> k;
    map<char, int> m;
    for(int i=0;i<n;i++){
        string p;cin >> p;
        m[p[0]]++;
    }
    priority_queue<int> pq;
    for(auto kv : m) pq.push(kv.second);
    int ans = 0;
    bool flag = true;
    while(flag){
        vector<int> v;
        for(int i=0;i<k;i++){
            if(pq.empty()){
                flag = false;
                break;
            }
            int vv = pq.top();
            pq.pop();
            if(--vv == 0) continue;
            v.push_back(vv);
        }
        if(!flag) break;
        ans++;
        for(auto vv : v) pq.push(vv);
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(ll i=0;i<(n);++i)
#define sayyes cout<<"Yes"<<endl;
#define sayno cout<<"No"<<endl;
using namespace std;
typedef long long ll;
const double PI=acos(-1);
typedef pair<int,int>P;
const int mod =1e9+7;

int main()
{
    ll a,b,c;
    cin>>a>>b>>c;
    vector<ll>pa(2),pb(2),pc(2);
    if(a%2!=0 || b%2!=0 || c%2!=0)
    {
        cout<<0;
        return 0;
    }
    pa[0]=a,pb[0]=b,pc[0]=c;
    if((b+c)%2!=0 || (a+c)%2!=0 || (a+b)%2!=0)
    {
        cout<<1;
        return 0;
    }
    pa[1]=(b+c)/2;
    pb[1]=(a+c)/2;
    pc[1]=(a+b)/2;
    ll count=1;
    while(1)
    {
        ll ta,tb,tc;
        ta=pa[0]+pa[1];
        tb=pb[0]+pb[1];
        tc=pc[0]+pc[1];
        if(ta%2!=0 || tb%2!=0 || tc%2!=0)
        {
            break;
        }
        ta/=2,tb/=2,tc/=2;
        if(ta==pa[0] && tb==pb[0] && tc==pc[0])
        {
            count=-1;
            break;
        }
        count++;
        pa[0]=pa[1];
        pb[0]=pb[1];
        pc[0]=pc[1];
        pa[1]=ta;
        pb[1]=tb;
        pb[1]=tb;
    }
    cout<<count;
}


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

#define ll long long
#define ld long double

#define rep(i,a,b) for(ll i=a;i<b;i++)
#define repb(i,a,b) for(ll i=a;i>=b;i--)
#define repA(i,A)   for(auto i:A)

#define err() cout<<"=================================="<<endl;
#define errA(A) for(auto i:A)   cout<<i<<" ";cout<<endl;
#define err1(a) cout<<#a<<" "<<a<<endl
#define err2(a,b) cout<<#a<<" "<<a<<" "<<#b<<" "<<b<<endl
#define err3(a,b,c) cout<<#a<<" "<<a<<" "<<#b<<" "<<b<<" "<<#c<<" "<<c<<endl
#define err4(a,b,c,d) cout<<#a<<" "<<a<<" "<<#b<<" "<<b<<" "<<#c<<" "<<c<<" "<<#d<<" "<<d<<endl

#define mp make_pair
#define pb push_back
#define all(A)  A.begin(),A.end()
#define allr(A)	A.rbegin(),A.rend()
#define ft first
#define sd second

#define pll pair<ll,ll>
#define V vector<ll>
#define S set<ll>
#define VV vector<V> 
#define Vpll vector<pll>

#define endl "\n"

const ll logN = 20;
const ll N = 100005;
const ll M = 1000000007;
const ll INF = 1e12;
#define PI 3.14159265

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

int main(){
    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    ll a,b;
    cin>>a>>b;
    ll ans = max(a+b,max(a-b,a*b));
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h> 
using namespace std;
 
#define hs ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
typedef long long ll;

void solve(){
  ll n;
  cin>>n;
  if(n%2 == 0){
    cout<<"-1";
    return ;
  }
  ll k = 7;
  ll cnt = 1;
  while(true){
    if(k%n == 0){
      cout<<cnt;
      break;
    }
    if(cnt > n){
      cout<<"-1";
      break;
    }
    k = (k%n)*10 +7;
    ++cnt;
  }
}
int main(){ 
  hs;
  ll t;
  t=1;
  for (int i=1; i<=t; i++){
    solve();
  }
  return 0; 
}         

Measured memory_bytes: 3648
#include <bits/stdc++.h>
#define all(v) v.begin(), v.end()
typedef long long ll;

using namespace std;

int main(){
	int h,n;
	cin >> h >> n;
	int sum = 0;
	for(int i = 0 ; i < n; i++){
		int a;
		cin >> a;
		sum+= a;
	}
	if(sum >= h){
		cout << "Yes";
	}else{
		cout << "No";
	}
}


Measured memory_bytes: 384
//#include <bits/stdc++.h>
#include <iostream>
#include <vector>
#include <string>
#include <cmath>
#include <algorithm>
#include <map>
#include <iomanip>
#include <stdlib.h>
#include <queue>

using namespace std;

const int nmax = 1e9 + 7;
const long long INF = 1e18;
const double PI = 2 * asin(1);
typedef long long ll;


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

  ll F[N][10];
  for (int i = 0; i < N; i++){
    for (int j = 0; j < 10; j++){
      cin >> F[i][j];
    }
  }
  
  ll P[N][11];
  for (int i = 0; i < N; i++){
    for (int j = 0; j < 11; j++){
      cin >> P[i][j];
    }
  }
  
  ll ans = -1e16;

  for (int i = 1; i < 1024; i++){
    int num = i;
    vector <int> now(10);
    for (int j = 0; j < 10; j++){
      now[j] = num % 2;
      num /= 2;
    }

    vector <ll> cnt(N);
    for (int j = 0; j < N; j++){
      for (int k = 0; k < 10; k++){
        if (F[j][k] == 1 && F[j][k] == now[k]){
          cnt[j]++;
        }
      }
    }
    
    ll sum = 0;
    for (int j = 0; j < N; j++){
      sum += P[j][cnt[j]];
    }
    
    ans = max(ans, sum);
  }

  cout << ans << endl;
  
  return 0;
}


Measured memory_bytes: 256
import sys
from io import StringIO
import unittest

class TestClass(unittest.TestCase):
    def assertIO(self, input, output):
        stdout, stdin = sys.stdout, sys.stdin
        sys.stdout, sys.stdin = StringIO(), StringIO(input)
        resolve()
        sys.stdout.seek(0)
        out = sys.stdout.read()[:-1]
        sys.stdout, sys.stdin = stdout, stdin
        self.assertEqual(out, output)
    def test_入力例_1(self):
        input = """3 3 5
#.#
.#.
#.#"""
        output = """1 2 2
1 3 4
5 5 4"""
        
        self.assertIO(input, output)
    def test_入力例_2(self):
        input = """3 7 7
#...#.#
..#...#
.#..#.."""
        output = """1 1 2 2 3 4 4
6 6 2 2 3 5 5
6 6 7 7 7 7 7"""
        self.assertIO(input, output)
    def test_入力例_3(self):
        input = """13 21 106
.....................
.####.####.####.####.
..#.#..#.#.#....#....
..#.#..#.#.#....#....
..#.#..#.#.#....#....
.####.####.####.####.
.....................
.####.####.####.####.
....#.#..#....#.#..#.
.####.#..#.####.#..#.
.#....#..#.#....#..#.
.####.####.####.####.
....................."""
        output = """12 12 23 34 45 45 60 71 82 93 93 2 13 24 35 35 17 28 39 50 50
12 12 23 34 45 45 60 71 82 93 93 2 13 24 35 35 17 28 39 50 50
12 12 56 89 89 89 60 104 82 31 31 46 13 24 35 35 61 61 39 50 50
12 12 67 67 100 100 60 9 9 42 42 57 13 24 6 72 72 72 72 72 72
12 12 78 5 5 5 20 20 20 53 68 68 90 24 6 83 83 83 83 83 83
16 16 27 38 49 49 64 75 86 97 79 79 90 101 6 94 94 105 10 21 21
16 16 27 38 49 49 64 75 86 97 79 79 90 101 6 94 94 105 10 21 21
32 32 43 54 65 65 80 11 106 95 22 22 33 44 55 55 70 1 96 85 85
32 32 43 54 76 76 91 11 106 84 84 4 99 66 66 66 81 1 96 74 74
14 14 3 98 87 87 102 11 73 73 73 4 99 88 77 77 92 92 63 63 63
25 25 3 98 87 87 7 29 62 62 62 15 99 88 77 77 103 19 30 52 52
36 36 47 58 69 69 18 29 40 51 51 26 37 48 59 59 8 19 30 41 41
36 36 47 58 69 69 18 29 40 51 51 26 37 48 59 59 8 19 30 41 41"""
        self.assertIO(input, output)

def resolve():
    H,W,K=(int(i) for i in input().split())
    s=[input() for i in range(H)]
    sbf=["#" in i  for i in s]
    mp=[[0 for _ in range(W)] for _ in range(H)]
    st=0

    while not sbf[st]:
        st+=1

    count=1
    for i in range(st,H):
        if not sbf[i]:
            mp[i]=mp[i-1]
            continue

        for j in range(W):
            mp[i][j]=count
            if s[i][j]=='#':
                count+=1
        if s[i][-1]==".":
            tt=W-1
            while s[i][tt]=='.':
                mp[i][tt]=count-1
                tt-=1
            

    for i in range(st-1,-1,-1):
        mp[i]=mp[i+1]
    for i in mp:
        print(' '.join([str(j) for j in i]))
    
            



if __name__ == "__main__":
    resolve()

Measured memory_bytes: 54376
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<ll,ll>;
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define rep2(i,m,n) for(int (i)=(m);(i)<(n);(i)++)
const ll INF = 1LL<<60;
const ll MOD = 1e9+7;

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    ll n; cin>>n;
    vector<P> a(n);
    rep(i,n){
        ll t;cin>>t;
        a[i] = P(t-1,i);
    }
    sort(a.begin(),a.end());
    rep(i,n)cout<<a[i].second+1<<" ";
    return 0;
}

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

int main() {
  rep(i,10000){
    int x;
    cin >> x;
    if(x){
      cout << "Case "<<i+1<<": " << x << endl;
    }
    else return 0;
  }
  return 0;
}


Measured memory_bytes: 3016
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
using namespace std;
priority_queue<int> A,B,C;
vector<int> AA, BB, CC;
 
int main()
{
    int x, y, a, b, c;long long ans = 0;
    cin >> x >> y >> a >> b >> c;
    for (int i = 0; i < a; ++i) {
        int t; cin >> t;
        AA.push_back(t);
    }
    for (int i = 0; i < b; ++i) {
        int t; cin >> t;
        BB.push_back(t);
    }
    for (int i = 0; i < c; ++i) {
        int t; cin >> t;
        CC.push_back(t);
    }
    sort(AA.begin(), AA.end(), greater <int>());
    sort(BB.begin(), BB.end(), greater <int>());
    sort(CC.begin(), CC.end(), greater <int>());
 
    int cp = 0; x--; y--;
    while (1) {
        int who = 0, min = 99999999;
        if (x >= 0) {
            who = 1; min = AA[x];
        }
        if (y >= 0 && BB[y] < min) {
            who = 2; min = BB[y];
        }
 
        // cout << "Cc" << CC[cp] << " " << min << " " << AA[x] << ' ' << BB[y] << endl;
        if (cp < CC.size() && CC[cp] > min) {
            ans += CC[cp];
            cp++;
            // cout << "who" << who << endl;
            if (who == 1) x--;
            if (who == 2) y--;
        } else break;
    }
// cout << x << ' ' << y << endl;
    while (x >= 0) ans += AA[x--];
    while (y >= 0) ans += BB[y--];
 
    // for (int i = 0; i < a; ++i) 
    // { int t; cin >> t; A.push(t);}
    // for (int i = 0; i < b; ++i)
    // { int t; cin >> t; B.push(t);}
    // for (int i = 0; i < c; ++i) 
    //    { int t; cin >> t; C.push(t);}
 
    // int ans = 0;
    // while (x > 0 || y > 0) {
    //     int who = 0, mmax = -1;
    //     if (x > 0 && !A.empty()) {
    //         who = 1; mmax = A.top();
    //     }
    //     if (y > 0 && !B.empty() && B.top() > mmax){
    //         who = 2; mmax = B.top();
    //     } 
    //     if (!C.empty() && C.top() > mmax){
    //         who = 3; mmax = C.top();
    //     } 
 
    //     if (who == 1) {
    //         x--; A.pop();
    //     }
    //     if (who == 2) {
    //         y--; B.pop();
    //     }
    //     if (who == 3) {
    //         C.pop();
    //     }
    //     ans += mmax;
    // }
 
 
    cout << ans;
    
    return 0;
}

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

typedef long long ll;
typedef pair<ll, ll> l_l;
typedef pair<int, int> i_i;

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 ll INF = 1e18;
const ll MOD = 998244353;
const ll MX = 1000001;

string S;

void solve() {
    cin >> S;
    if (S == "ABC") cout << "ARC";
    else cout << "ABC";
}

int main() {
	cin.sync_with_stdio(0); cin.tie(0);
    ll T = 1; // cin >> T;
    while (T--) solve();
    return 0;
    // You should actually read the stuff at the bottom
}

/* Stuff to Look For
 * -----------------
 * Int overflow, array bounds
 * Initializing all variables, avoid weird behavior
 * Edge cases(n = 0, n = 1)
 * Just return 0 after result
 */


Measured memory_bytes: 3612
"use strict";
    
const main = arg => {
    arg = arg.trim().split("\n");
    const S = arg[0].split("");
    
    const hasA = S.filter(n=>n==="a").length > 0;
    const hasB = S.filter(n=>n==="b").length > 0;
    const hasC = S.filter(n=>n==="c").length > 0;
    
    if(hasA && hasB && hasC) {
        console.log("Yes");
    } else {
        console.log("No");
    }
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));

Measured memory_bytes: 7372
import java.util.*;

public class Main {
	public static void main(String args[]) {
		Scanner sc = new Scanner(System.in);
		int H = Integer.parseInt(sc.next());
		int W = Integer.parseInt(sc.next());
		String s[][] = new String[H][W];
		for(int i = 0; i < H; i++) {
			String temp = sc.next();
			for(int j = 0; j < W; j++) {
				s[i][j] = temp.substring(j, j + 1);
			}
		}
		int maze_cnt[][] = new int[H][W];
		int white_cnt = 0;
		for(int i = 0; i < H; i++) {
			for(int j = 0; j < W; j++) {
				maze_cnt[i][j] = 0;
				if(s[i][j].equals(".")) {
					white_cnt++;
				}
			}
		}
		
		int now_x = 0;
		int now_y = 0;
		Queue<Integer> queue_x = new ArrayDeque<Integer>();
		Queue<Integer> queue_y = new ArrayDeque<Integer>();
		queue_x.add(0);
		queue_y.add(0);
		int dx[] = {-1, 0, 1, 0};
		int dy[] = {0, 1, 0, -1};
		while(queue_x.size() != 0) {
			now_x = queue_x.poll();
			now_y = queue_y.poll();
			for(int i = 0; i < 4; i++) {
				if(i == 0 && now_x == 0) continue;
				if(i == 1 && now_y == H - 1) continue;
				if(i == 2 && now_x == W - 1) continue;
				if(i == 3 && now_y == 0) continue;
				
				if(s[now_y + dy[i]][now_x + dx[i]].equals(".")) {
					queue_x.add(now_x + dx[i]);
					queue_y.add(now_y + dy[i]);
					s[now_y + dy[i]][now_x + dx[i]] = "#";
					maze_cnt[now_y + dy[i]][now_x + dx[i]] = maze_cnt[now_y][now_x] + 1;
				}
			}
		}
		if(maze_cnt[H - 1][W - 1] == 0) {
			System.out.println(-1);
		} else {
			System.out.println(white_cnt - maze_cnt[H - 1][W - 1] - 1);
		}
	}
}


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

int main(){
  int D, N; cin >> D >> N;
 
	int S = pow(100,D);
    //for (int i = 0; i < D; i++) S *= 100;
	if(N == 100){
      N ++;
    }
   cout << N * S << endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#define rep(i, n) for(int i = 0; i < n; i++)
#define rep2(i, s, n) for(int i = s; i < n; i++)
using namespace std;

int main(){
  int n;
  cin >> n;
  vector<int> d(n);
  rep(i, n) cin >> d[i];
  int sum = 0;
  rep(i, n-1)rep2(j, i+1, n){
    sum += d[i] * d[j];
  }
  cout << sum << endl;
  
  return 0;
}

Measured memory_bytes: 3636
N = int(input())
ad_list = list(map(int, input().split()))
ave_ad = sum(ad_list) / len(ad_list)
r_ave_ad = round(ave_ad)

ans = 0
for i in range(N):
    tmp = (ad_list[i] - r_ave_ad) ** 2
    ans += tmp
print(ans)

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

int main() {
	long long N; cin >> N;
    long long ans = 0;
    for (long long i = 1; i <= N; i++) {
        ans += (N / i) * (N / i + 1) * i / 2;
    }
    cout << ans << endl;
}

Measured memory_bytes: 3612
#include <iostream>
#include <algorithm>
#include <functional>
#include <string>
#include <climits>
#include <vector>
#include <numeric>
#include <complex>
#include <map>
#include <bitset>
#include <stack>
#include <queue>
#include <set>
using namespace std;

#define __int64 long long
#define long __int64
#define REP(i,a,b) for(int i=a;i<b;i++)
#define rep(i,n) REP(i,0,n)
const int Vec = 4;
const int Vecy[Vec] = {0,-1,0,1};
const int Vecx[Vec] = {1,0,-1,0};
const int Modd = 1000000007;

string s[2000];
vector<int> xBlock[2000];
vector<int> yBlock[2000];


int ansX[2000][2000] = {0}; // 横方向のスコア
int ansY[2000][2000] = {0}; // 縦方向のスコア
int main(){
    int h,w;
    cin >> h >> w;
    rep(i,h){
        cin >> s[i];
    }

    for(int ix=0; ix<w; ix++){
        xBlock[ix].push_back(-1);
    }

    for(int iy=0; iy<h; iy++){
        yBlock[iy].push_back(-1);
    }

    for(int iy=0; iy<h; iy++){
        for(int ix=0; ix<w; ix++){
            if(s[iy][ix] == '#'){
                xBlock[ix].push_back(iy);
                yBlock[iy].push_back(ix);
            }
        }
    }

    for(int ix=0; ix<w; ix++){
        xBlock[ix].push_back(h);
    }

    for(int iy=0; iy<h; iy++){
        yBlock[iy].push_back(w);
    }

    // 横方向のスコアを求める
    for(int iy=0; iy<h; iy++){
        for(int i=1; i<yBlock[iy].size(); i++){
            int distance = yBlock[iy][i] - yBlock[iy][i-1] - 1;
            for(int ix=yBlock[iy][i-1]+1; ix<yBlock[iy][i]; ix++){
                ansY[iy][ix] = distance;
            }
        }
    }

    // 縦方向のスコアを求める
    for(int ix=0; ix<w; ix++){
        for(int i=1; i<xBlock[ix].size(); i++){
            int distance = xBlock[ix][i] - xBlock[ix][i-1] - 1;
            for(int iy=xBlock[ix][i-1]+1; iy<xBlock[ix][i]; iy++){
                ansX[iy][ix] = distance;
            }
        }
    }

    // 最大値を求める
    int ans = 0;
    for(int iy=0; iy<h; iy++){
        for(int ix=0; ix<w; ix++){
            ans = max(ans, ansX[iy][ix] + ansY[iy][ix] - 1);
        }
    }

    cout << ans << endl;
}

Measured memory_bytes: 69760
fn solve() {
    let s = std::io::stdin();
    let mut sc = Scanner { stdin: s.lock() };
    let n: usize = sc.read();
    let mut cnts = vec![vec![0; 10]; 10];
    for a in 1..n + 1 {
        let a: Vec<char> = a.to_string().chars().collect();
        //println!("{:?}", a);
        let p1 = a[0] as usize - 48;
        let p2 = a[a.len() - 1] as usize - 48;
        cnts[p1][p2] += 1;
    }
    let mut result: i64 = 0;
    for a in 1..n + 1 {
        let a: Vec<char> = a.to_string().chars().collect();
        //println!("{:?}", a);
        let p1 = a[0] as usize - 48;
        let p2 = a[a.len() - 1] as usize - 48;
        result += cnts[p2][p1];
    }
    println!("{}", result);
}

fn main() {
    std::thread::Builder::new()
        .stack_size(64 * 1024 * 1024) // 64MB
        .spawn(|| solve())
        .unwrap()
        .join()
        .unwrap();
}

//snippet from kenkoooo
pub struct Scanner<R> {
    stdin: R,
}

impl<R: std::io::Read> Scanner<R> {
    pub fn read<T: std::str::FromStr>(&mut self) -> T {
        use std::io::Read;
        let buf = self
            .stdin
            .by_ref()
            .bytes()
            .map(|b| b.unwrap())
            .skip_while(|&b| b == b' ' || b == b'\n' || b == b'\r')
            .take_while(|&b| b != b' ' && b != b'\n' && b != b'\r')
            .collect::<Vec<_>>();
        unsafe { std::str::from_utf8_unchecked(&buf) }
            .parse()
            .ok()
            .expect("Parse error.")
    }
    pub fn read_line(&mut self) -> String {
        use std::io::Read;
        let buf = self
            .stdin
            .by_ref()
            .bytes()
            .map(|b| b.unwrap())
            .skip_while(|&b| b == b'\n' || b == b'\r')
            .take_while(|&b| b != b'\n' && b != b'\r')
            .collect::<Vec<_>>();
        unsafe { std::str::from_utf8_unchecked(&buf) }
            .parse()
            .ok()
            .expect("Parse error.")
    }
    pub fn vec<T: std::str::FromStr>(&mut self, n: usize) -> Vec<T> {
        (0..n).map(|_| self.read()).collect()
    }

    pub fn chars(&mut self) -> Vec<char> {
        self.read::<String>().chars().collect()
    }
}


Measured memory_bytes: 8572
#include <iostream>

int main()
{
    int X,Y;
    std::cin >> X >> Y ;
    
    if(Y>=2*X && Y<=4*X && Y%2==0){
        std::cout << "Yes" <<std::endl;
    }
    else{
        std::cout << "No" <<std::endl;
    }  
}

Measured memory_bytes: 3572