akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <string>
#include <vector>
using namespace std;

int main(int argc, char const *argv[]) {
	int h,w;
	std::vector<std::vector<char> > array;
	string line;

	std::cin >> h >> w;
	cin.ignore();
	array.resize(h);
	for (size_t i = 0; i < h; i++) {
		getline(cin,line);
		array[i].resize(w);
		for (size_t j = 0; j < w; j++) {
			array[i][j] = line[j];
		}
	}
	for (size_t i = 0; i < w+2; i++) {
		std::cout << '#';
	}
	std::cout << '\n';
	for (size_t i = 0; i < h; i++) {
		std::cout << '#';
		for (size_t j = 0; j < w; j++) {
			std::cout << array[i][j];
		}
		std::cout << '#' << '\n';
	}
	for (size_t i = 0; i < w+2; i++) {
		std::cout << '#';
	}
	std::cout << '\n';
	return 0;
}


Measured memory_bytes: 256
def sum_digits(n, m):
    r = 0
    while n:
        r = r + n % m
        n = n // m
    return r

N = int(input())

ans = 100000
for i in range(N + 1):
    ans = min(ans, sum_digits(i, 6)+sum_digits(N - i, 9))

print(ans)

Measured memory_bytes: 3060
#include<iostream>
#include<algorithm>
#include<string>
#include<cstdlib>
#include<vector>
using namespace std;

int main()
{
    int n;
    int i, j, now, ans = 0;
    
    cin >> n;
    
    int a1[n], a2[n];
    int route1[n], route2[n];
    
    for(i = 0; i < n; i++) {
        cin >> a1[i];
        
        if(i == 0) {
            route1[i] = a1[i];
        } else {
            route1[i] = a1[i] + route1[i-1];
        }
    }
    
    for(j = 0; j < n; j++) {
        cin >> a2[j];
        
        if(j == 0) {
            route2[j] = a2[j];
        } else {
            route2[j] = a2[j] + route2[j-1];
        }
    }
    
    for(i = 0; i < n; i++) {
        
        if(i == 0) {
            now = route1[i] + route2[n-1];
        } else {
            now = route1[i] + (route2[n-1] - route2[i-1]);
        }
        
        if(now > ans) {
            ans = now;
        }
    }
    
    cout << ans << endl;
    
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < n; i++)
#define EPS (1e-10)
#define equals(a, b) (fabs((a) - (b)) < EPS)
const int COUNTER_CLOCKWISE = 1;
const int CLOCKWISE = -1;
const int ONLINE_BACK = 2;
const int ONLINE_FRONT = -2;
const int ON_SEGMENT = 0;

class Point
{
public:
  double x, y;
  Point(double x = 0, double y = 0) : x(x), y(y) {}

  Point operator+(Point p)
  {
    return Point(x + p.x, y + p.y);
  }
  Point operator-(Point p)
  {
    return Point(x - p.x, y - p.y);
  }
  Point operator*(double a)
  {
    return Point(a * x, a * y);
  }
  Point operator/(double a)
  {
    return Point(x / a, y / a);
  }

  double abs()
  {
    return sqrt(norm());
  }
  double norm()
  {
    return x * x + y * y;
  }

  bool operator<(const Point &p) const
  {
    return x != p.x ? x < p.x : y < p.y;
  }
  bool operator==(const Point &p) const
  {
    return equals(x, p.x) && equals(y, p.y);
  }

  void print()
  {
    printf("%.10f %.10f\n", x, y);
  }
};

typedef Point Vector;

double dot(Vector a, Vector b)
{
  return a.x * b.x + a.y * b.y;
}
double cross(Vector a, Vector b)
{
  return a.x * b.y - a.y * b.x;
}

struct Segment
{
  Point p1, p2;
};

typedef Segment Line;

class Circle
{
public:
  Point c;
  double r;
  Circle(Point c = Point(), double r = 0) : c(c), r(r) {}
};

typedef vector<Point> Polygon;

Point projection(Line l, Point p)
{
  return l.p1 + (l.p2 - l.p1) * (dot(p - l.p1, l.p2 - l.p1) / (l.p2 - l.p1).norm());
}

Point reflection(Line l, Point p)
{
  Point x = projection(l, p);
  return p + (x - p) * 2;
}

int ccw(Point p0, Point p1, Point p2)
{
  Vector a = p1 - p0, b = p2 - p0;
  if (cross(a, b) > EPS)
  {
    return COUNTER_CLOCKWISE;
  }
  if (cross(a, b) < -EPS)
  {
    return CLOCKWISE;
  }
  if (dot(a, b) < -EPS)
  {
    return ONLINE_BACK;
  }
  if (a.norm() < b.norm())
  {
    return ONLINE_FRONT;
  }
  return ON_SEGMENT;
}

bool is_parallel(Line l1, Line l2)
{
  Vector a = l1.p2 - l1.p1, b = l2.p2 - l2.p1;
  return equals(cross(a, b), 0);
}

bool is_orthogonal(Line l1, Line l2)
{
  Vector a = l1.p2 - l1.p1, b = l2.p2 - l2.p1;
  return equals(dot(a, b), 0);
}

bool intersect(Segment s1, Segment s2)
{
  Point p0 = s1.p1, p1 = s1.p2, p2 = s2.p1, p3 = s2.p2;
  return (ccw(p0, p1, p2) * ccw(p0, p1, p3) <= 0) && (ccw(p2, p3, p0) * ccw(p2, p3, p1) <= 0);
}

Point intersection(Segment s1, Segment s2)
{
  Point p0 = s1.p1, p1 = s1.p2, p2 = s2.p1, p3 = s2.p2;
  double a0 = fabs(cross(p2 - p0, p3 - p0)), a1 = fabs(cross(p2 - p1, p3 - p1));
  return (p0 * a1 + p1 * a0) / (a0 + a1);
}

int main()
{
  int q;
  cin >> q;
  vector<bool> ans;
  rep(i, q)
  {
    double x0, y0, x1, y1, x2, y2, x3, y3;
    cin >> x0 >> y0 >> x1 >> y1 >> x2 >> y2 >> x3 >> y3;
    Segment s1 = {Point{x0, y0}, Point{x1, y1}}, s2 = {Point{x2, y2}, Point{x3, y3}};
    Point p = intersection(s1, s2);
    p.print();
  }
}


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

int main() {
    long long a, v, b, w;

    cin >> a >> v >> b >> w;

    long long t;

    cin >> t;

    if (t * (v - w) >= abs(a - b)) {
        puts("YES");
    } else puts("NO");

    return 0;
}


Measured memory_bytes: 3636
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;
const int INF=INT_MAX,MOD=1e9+7;

int main(){
    string s; cin>>s;
    int ans=INF;
    for(char i='a';i<='z';i++){
        int cnt=0,tmp=0;
        for(int j=0;j<(int)s.size();j++){
            if(s[j]==i){
                cnt=max(cnt,tmp);
                tmp=0;
            }else{
                tmp++;
            }
        }
        cnt=max(cnt,tmp);
        ans=min(ans,cnt);
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,a,b) for(int i = a; i < b; ++i)
#define trav(x, v) for(auto &x : v)
#define all(v) v.begin(), v.end()
#define sz(v) int(v.size())
typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> pii;
typedef vector<vi> vvi;

int main(){
	cin.tie(0);
	cin.sync_with_stdio(0);
	cin.exceptions(cin.failbit);

	string s;
	cin >> s;

	ll ans = 0;
	int as = 0;
	for(int ix = 0; ix < sz(s);){
		if(s[ix] == 'A'){
			++as;
			++ix;
		} else if(s[ix] == 'B' && ix+1 < sz(s) && s[ix+1] == 'C'){
			ans += as;
			ix += 2;
		} else {
			as = 0;
			++ix;
		}
	}
	cout << ans << endl;
}


Measured memory_bytes: 720
#include <cstring>
#include <cmath>
#include <algorithm>
#include <string>
#include <iostream>
#include <vector>
#include <queue>
#include <unordered_map>
#include <random>
#include <stack>
#include <set>
#include <unordered_set>

#define bug(x) cout<<"zdongdebug1: "<<x<<endl;
#define bug2(x, y) cout<<"zdongdebug2: "<<x<<" "<<y<<endl;
#define bug3(x, y, z) cout<<"zdongdebug3: "<<x<<" "<<y<<" "<<z<<endl;
using namespace std;
typedef long long ll;
const int maxn = 200005;
const int mod = 1000000007;

int a[maxn];
int vis[maxn];

int main() {
#ifdef suiyuan2009
  freopen("/Users/suiyuan2009/CLionProjects/icpc/input.txt", "r", stdin);
  //freopen("/Users/suiyuan2009/CLionProjects/icpc/output.txt", "w", stdout);
#endif
  int n;
  ll m;
  cin>>n>>m;
  for(int i=1;i<=n;i++)cin>>a[i];
  int pos = 0;
  int cur = 1;
  int cnt = 0;
  while(1){
    if(vis[cur]){
      pos = cur;
      break;
    }
    vis[cur] = ++cnt;
    cur = a[cur];
  }
  if(m<=cnt){
    cur = 1;
    while(m--){
      cur = a[cur];
    }
    cout<<cur<<endl;
  } else {
    m-=cnt;
    int len = cnt - vis[pos]+1;
    m%=len;
    cur = pos;
    while(m--){
      cur = a[cur];
    }
    cout<<cur<<endl;
  }
  return 0;
}

Measured memory_bytes: 5152
#include <iostream>
#include <stdlib.h>
#include <stdio.h>      /* printf */
#include <math.h>       /* pow */
#include <vector>
#include <queue>
#include <algorithm>
#include <string>

/*void print_array(std::queue<std::pair<std::string, int> > list)
{
  for(int i = 0; i < list.size(); ++i){
    std::cout << list[i].first << " " << list[i].second<< std::endl;
  }
}*/

void roundRobin(std::queue<std::pair<std::string, int> > &list, int quantum){
    int timeSpent = 0;
    while (!list.empty()) {
        if (list.front().second<=quantum) {
            timeSpent += list.front().second;
            std::cout << list.front().first << " " << timeSpent << std::endl;
            
        } else {
            timeSpent += quantum;
            list.front().second -= quantum;
            list.push(list.front());
        }
        list.pop();
    }
        //print_array(list);
        //std::cout << i << std::endl;
}


int main(void){

    int num;
    std::cin >> num;
/*    if (num>100000) {
        std::cout << "too many processes" << std::endl;
        return 1;
    }
*/    
    int quantum;
    std::cin >> quantum;
/*    if (num>1000) {
        std::cout << "too long quantum" << std::endl;
        return 1;
    }    
  */  
    std::queue<std::pair<std::string, int> > list;

    int totalTime =0;
    for(int i = 0; i < num; i++){
    std::string value;
    std::cin >> value;
    /*if (value.size()>10) {
        std::cout << "Process name too long" << std::endl;
        return 1;
    } */   
    int timeNeeded;
    std::cin >> timeNeeded;
    /*if (timeNeeded>50000) {
        std::cout << "Process time too long" << std::endl;
        return 1;
    } */   
    list.push(std::make_pair(value,timeNeeded));
    totalTime += timeNeeded;
    }

/*    if (totalTime>1000000) {
        std::cout << "All Processes time too long" << std::endl;
        return 1;
    }    
*/ 
    //print_array(list);
    roundRobin(list,quantum);

    return 0;
}

Measured memory_bytes: 4404
#include<map>
#include<cmath>
#include<stack>
#include<queue>
#include<cstdio>
#include<vector>
#include<cstring>
#include<iostream>
#include<algorithm>
using namespace std;
typedef long long ll;
template<class Read>void in(Read &x){
    x=0;
    int f=0;
    char ch=getchar();
    while(ch<'0'||ch>'9'){
        f|=(ch=='-');
        ch=getchar();
    }
    while(ch>='0'&&ch<='9'){
        x=(x<<1)+(x<<3)+(ch^48);
        ch=getchar();
    }
    x=f?-x:x;
    return;
}
int a,b;
int main(){
	in(a);in(b);
    if(b==1){
        puts("0");
        return 0;
    }
    int x=1;
    while(1){
        if(a>=b){
            printf("%d\n",x);
            return 0;
        }
        b-=(a-1);
        x++;
    }
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
   
using namespace std;
#define ll long long
#define ld long double
#define pll pair<long long,long long>
#define vll vector<long long>
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define deb(x) cout << #x << "=" << x << endl
#define F(i,a,b) for(ll i=a;i<=b;i++)
#define RF(i,a,b) for(ll i=a;i>=b;i--)
#define in(a,n) F(i,0,n-1)cin>>a[i]
#define vi vector<int>
#define out(a,n) F(i,0,n-1)cout<<a[i]<<" ";cout<<endl
#define mod 1000000007
#define int long long
set < ll> primes;
 int dx[]={0,0,1,-1};
int dy[]={1,-1,0,0};
int n;
bool isvalid(int x,int y){
  return (x>=0 and x<n and y>=0 and y<n);
}
void Sieve(ll n) 
{ 
    bool prime[n+1];
	for(ll i=0;i<n+1;++i)
		prime[i]=true;
    for (ll p=2;p*p<=n;++p) 
    {
        if (prime[p] == true) 
        {  
            for (ll i=2*p; i<=n; i += p) 
                prime[i] = false; 
        } 
    }  
    for(ll p=2; p<=n; p++) 
       if (prime[p]) 
		primes.insert(p);  
}

ll gcd(ll a, ll b) 
{ 
    if (a == 0) 
        return b; 
        return gcd(b % a, a); 
} 
ll powermod(ll x, ll y){
    if(y==0)
    return 1;
        
    if(y%2==0)
    return (powermod(x,y/2)*powermod(x,y/2))%mod;
    else
    return (((powermod(x,y/2)*powermod(x,y/2))%mod)*x)%mod;
}

 
 

int32_t main()
{
	ios::sync_with_stdio(false);
    cin.tie(NULL);
    
    int n,m;
    cin>>n>>m;
    int ans=0;
    
    ans+=((n)*(n-1))/2;
    n=m;
    ans+=((n)*(n-1))/2;
    
    cout<<ans;
   
}

Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <sstream>
#include <iomanip>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cctype>
#include <cstring>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <algorithm>
#include <iterator>
#include <bitset>
#include <ctime>
#include<complex>
using namespace std;

#define FOR(i,a,b) for (int i = (a); i < (b); i++)
#define RFOR(i,b,a) for (int i = (b)-1; i >= (a); i--)
#define ITER(it,a) for (__typeof(a.begin()) it = a.begin(); it != a.end(); it++)
#define FILL(a,value) memset(a, value, sizeof(a))

#define SZ(a) (int)a.size()
#define ALL(a) a.begin(), a.end()
#define PB push_back
#define MP make_pair

typedef long long LL;
typedef long long __int1288;
typedef vector<int> VI;
typedef pair<int, int> PII;

const double PI = acos(-1.0);
const int INF = 1000 * 1000 * 1000 + 7;
const LL LINF = INF * (LL)INF;

const int MAX = 3 * 1000 + 47;
const int MAX1 = 1000 * 100 + 47;

__int1288 A[MAX1];
int P[MAX];
__int1288 L[MAX];
int sz;

map<__int1288, int> mapp;

void norm(__int1288& a)
{
	FOR(i, 0, sz)
	{
		__int1288 l = L[i] * L[i] * L[i];
		while (a % l == 0)
		{
			a /= l;
		}
	}
}

int main()
{
	//freopen("in.txt", "r", stdin);
	//freopen("out.txt", "w", stdout);
	ios::sync_with_stdio(false); cin.tie(0);
	FOR(i, 2, MAX)
	{
		if (!P[i])
		{
			L[sz++] = i;
			int j = i;
			while (j < MAX)
			{
				if (P[j] == 0) P[j] = i;
				j += i;
			}
		}
	}

	int n;
	cin >> n;
	FOR(i, 0, n)
	{
		LL l;
		cin >> l;
		norm(l);
		mapp[l]++;
	}

	int ans = 0;
	for (auto i = mapp.begin(); i != mapp.end(); i++)
	{
		__int1288 a = i->first;
		__int1288 b = a * a;
		norm(b);
		if (a == 1 && mapp[a] != 0)
		{
			ans++;
			mapp[a] = 0;
			continue;
		}

		ans += max(mapp[a], mapp[b]);
		mapp[a] = 0;
		mapp[b] = 0;
	}

	cout << ans << endl;
}

Measured memory_bytes: 18688
N=int(input())
A=[int(i) for i in input().split()]
B=[int(i) for i in input().split()]
C=[int(i) for i in input().split()]

score=sum(B)
before = -1
for a in A:
    #print(a, before, score)
    if before+1 == a:
        score+=C[a-2]
    before = a

print(score)

Measured memory_bytes: 3064
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.HashMap;
import java.util.StringTokenizer;

public class Main {
	static PrintWriter out;

	static HashMap<Integer, Integer> happyC;
	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		out = new PrintWriter(System.out);
		
		int n = sc.nextInt();
		int m = sc.nextInt();
		int[] c = new int[m+1];
		for (int i = 0; i < n; i++) {
			int j = sc.nextInt();
			for (int j2 = 0; j2 < j; j2++) {
				c[sc.nextInt()]++;
			}
		}
		int ans = 0;
		for (int i = 0; i < m+1; i++) {
			if(c[i] == n )
				ans++;
		}
		out.println(ans);
		out.flush();	
	}
	
}
	
class Scanner {
	StringTokenizer st;
	BufferedReader br;

	public Scanner(InputStream system) {
		br = new BufferedReader(new InputStreamReader(system));
	}

	public String next() throws IOException {
		while (st == null || !st.hasMoreTokens())
			st = new StringTokenizer(br.readLine());
		return st.nextToken();
	}

	public String nextLine() throws IOException {
		return br.readLine();
	}

	public int nextInt() throws IOException {
		return Integer.parseInt(next());
	}

	public double nextDouble() throws IOException {
		return Double.parseDouble(next());
	}

	public char nextChar() throws IOException {
		return next().charAt(0);
	}

	public Long nextLong() throws IOException {
		return Long.parseLong(next());
	}

	public boolean ready() throws IOException {
		return br.ready();
	}

	public void waitForInput() throws InterruptedException {
		Thread.sleep(3000);
	}

}


Measured memory_bytes: 23508
#include<iostream>
#include <algorithm>
#include<string>
#include <bitset>
#include <vector>
#include <functional>
#include <climits>
#include <iomanip>
#include <utility>
using namespace std;
typedef pair <int, int> pii;
int main()
{

	//int a = 0, b = 0, c = 0, d = 0, e = 0, f = 0, g = 0, h = 0, ans = 0;
	long long a = 0, b = 0, c = 0, d = 0, e = 0, f = 0, g = 0, h = 0, i = 0, j = 0, k = 0, l = 0, ans = 0;
	//cout << LONG_MAX << endl;
	//string s, t;
	//long long n, A[1000000000];
	long long n, m;
	//int   y[100001], z[100001], x[10001] = {};
	//pii y[100001];
	//pair<int, float> pii[100001];
	int x[100];
	cin >> a >> b;

	////std::cout << std::fixed;
	//cout << std::setprecision(20) << << endl;
	//cout << d+1 << endl;

	cout << a*b-a-b+1 << endl;

	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n,k;
  cin >> n >> k;
  vector<long long> a(n);
  for(int i = 0;i < n;i++){
    cin >> a[i];
  }
  for(int i = 0;i < n - k;i++){
    if(a[i] < a[i + k])cout << "Yes" << endl;
    else cout << "No" << endl;
  }
}

Measured memory_bytes: 4808
from itertools import combinations

results = []
while 1:
    n, x = map(int, input().split())
    if n == 0 and x == 0:
        break
    count = 0
    for a, b, c in combinations(range(1, n+1), 3):
        if a + b + c == x:
            count += 1
    results.append(count)
print('\n'.join(map(str, results)))


Measured memory_bytes: 5640
//agrawal117
//chahatagrawal117
#include<bits/stdc++.h>
#define endl '\n'
#define mod 1000000007
typedef long long int ll;
using namespace std;
#define MAX 100005
const ll oo=1e18;
int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    ll n; cin>>n;
    ll ans=1;
    vector<ll> v;
    for(int i=1;i<=n;i++){
        ll a; cin>>a;
        v.push_back(a);
        if(a==0) { cout<<0; return  0; }
        
    }
    for(int i=0;i<v.size();i++){
        ll a=v[i];
        if(ans>oo/a) {cout<<-1; return 0 ;}
        ans*=a;
        
    }
    cout<<ans<<endl;
}

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

int main(void) {
  	int n, m;
	cin >> n >> m;
  	int l[m], r[m];
  	for (int i=0;i<m;i++) {
    	cin >> l[i] >> r[i];
      	if (i>0) {
          l[0] = max(l[i], l[0]);
          r[0] = min(r[i], r[0]);
        }
    }
    int distance;
    distance = (r[0] >= l[0]) ? (r[0]-l[0]+1) : 0;
  	cout << distance  << endl;
  	return 0;
}

Measured memory_bytes: 1024
use strict;
use warnings;
package ZAlgorithm;
sub z_algorithm(@){
	my$n=@_;
	return()if$n==0;
	my@z=(0);
	my$j=0;
	for my$i(1..$n-1){
		$z[$i]=$j+$z[$j]<=$i?0:$j+$z[$j]-$i<$z[$i-$j]?$j+$z[$j]-$i:$z[$i-$j];
		$z[$i]++while$i+$z[$i]<$n&&$_[$z[$i]]eq$_[$i+$z[$i]];
		$j=$i if$j+$z[$j]<$i+$z[$i];
	}
	$z[0]=$n;
	return@z;
}
package main;
my$N=<>;
my@A=map int,split$",<>;
my@B=map int,split$",<>;
my@T;
for(0..$N-1){
	$T[$_]=$B[$_]^$B[($_+1)%$N];
	$T[$_+$N]=$T[$_+2*$N]=$A[$_]^$A[($_+1)%$N];
}
my@z=ZAlgorithm::z_algorithm(@T);
for(0..$N-1){
	print$_,$",$A[$_]^$B[0],$/if$z[$_+$N]>=$N;
}


Measured memory_bytes: 134276
N = int(input())
S = list(input())

count = 1
result = []
for i in range(N) :
  if i == 0 :
    before = S[i]
    continue
  if before == S[i] :
    count += 1
  else :
    result.append(count)
    count = 1
    before = S[i]

result.append(count)
print(len(result))

Measured memory_bytes: 4652
import java.util.Scanner;

class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        String S = sc.next();
        char A[] = S.toCharArray();

        int count = 0;
        for(int i = 0;i < 3;i++){
            if(A[i] == A[i+1]){
                count++;
            }
        }
        if(count > 0){
            System.out.println("Bad");
        }else{
            System.out.println("Good");
        }

    }
}

Measured memory_bytes: 22996
import java.util.*;

public class Main{
    public static void main(String[]args){
	Scanner sc = new Scanner(System.in);
	int N = sc.nextInt();
	sc.nextLine();
	//System.out.println();
	int count[] = new int[4];
	String s[] = new String[N];
	for(int i=0; i<N; i++){
	    s[i]= sc.nextLine();
	    switch(s[i]){
	    case "AC":
		count[0]++;
		break;
	    case "WA":
		count[1]++;
		break;
	    case "TLE":
		count[2]++;
		break;
	    case "RE":
		count[3]++;
		break;
	    }
	}
	System.out.println("AC x "+count[0]);
	System.out.println("WA x "+count[1]);
	System.out.println("TLE x "+count[2]);
	System.out.println("RE x "+count[3]);
    }
}

Measured memory_bytes: 66196
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
constexpr int di[] = { 0, 1, 0, -1 }, dj[] = { 1, 0, -1, 0 };
#define rep(i, n) for (int i = 0; i < n; i++)
#define repr(i, n) for (int i = n; i >= 0; i--)
#define SORT(v) sort((v).begin(), (v).end())
#define SORTR(v) sort((v).rbegin(), (v).rend())
#define all(v) (v).begin(), (v).end()
#define vmax 10000
constexpr ll inf = 100000000000000;
/*cout<<fixed<<setprecision(20);cin.tie(0);ios::sync_with_stdio(false);*/

int main(){
    int n,a,b;
    cin>>n>>a>>b;
    if(n==1){
        cout<<"Hello World"<<endl;
    }else{
        cout<<a+b<<endl;
    }
    return 0;
}



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

using namespace std;

#define int long long
#define all(v) (v).begin(), (v).end()
#define resz(v, ...) (v).clear(), (v).resize(__VA_ARGS__)
#define reps(i, m, n) for(int i = (int)(m); i < (int)(n); i++)
#define rep(i, n) reps(i, 0, n)

template<class T1, class T2> void chmin(T1 &a, T2 b){if(a>b)a=b;}
template<class T1, class T2> void chmax(T1 &a, T2 b){if(a<b)a=b;}

using Pi = pair<int, int>;
using Tapris = tuple<int, int, int>;
using vint = vector<int>;

const int inf = 1LL << 55;
const int mod = 1e9 + 7;

signed main() {
  cin.tie(0);
  ios_base::sync_with_stdio(0);
  cout << fixed << setprecision(12);

  int n;
  cin >> n;
  vint a(n);
  rep(i, n) cin >> a[i];
  int mx = *max_element(all(a));
  int ans = inf;
  rep(i, n) {
    if(mx == a[i]) continue;
    if(mx%2) {
      if(abs(ans-mx/2) > abs(a[i]-mx/2)) ans = a[i];
      else if(abs(ans-mx/2) == abs(a[i]-mx)/2 && (a[i] == mx/2 || a[i] == (mx+1)/2)) ans = a[i];
    } else {
      if(abs(ans-mx/2) > abs(a[i]-mx/2)) ans = a[i];
    }
  }
  cout << mx << " " << ans << endl;

  return 0;
}


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

ll gcd(ll m, ll n){
    ll tmp;
    while(m%n){
        tmp = n;
        n = m % n;
        m = tmp;
    }
    return n;
}

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

    int n;
    cin >> n;
    ll res;
    rep(i, n) {
        ll a;
        cin >> a;

        if(i) res = gcd(res, a);
        else res = a;
    }
    cout << res << endl;



}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define rep(i,n) for(ll i=0;i<n;++i)
#define P pair<ll,ll>
#define Graph vector<vector<P>>
#define fi first
#define se second
constexpr ll mod=1000000007;
constexpr ll INF=(1ll<<60);
constexpr double pi=3.14159265358979323846;
template<typename T> inline bool chmax(T& a,T b){if(a<b){a=b;return 1;} return 0;}
template<typename T> inline bool chmin(T& a,T b){if(a>b){a=b;return 1;} return 0;}

int main(){
    ll n;cin>>n;
    vector<ll> h(n);
    ll MAX=0,MIN=INF;
    rep(i,n){
        cin>>h[i];
    }

    rep(i,n-1){
        if(i==0){
            h[i]--;
            continue;
        }
        if(h[i-1]<h[i]) h[i]--;
    }

    bool can=true;
    rep(i,n-1){
        if(h[i]>h[i+1]) can=false;
        //cout<<h[i]<<" ";
    }
    //cout<<h[n-1]<<endl;

    if(can) cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
    
    return 0;
}

Measured memory_bytes: 3964
// Author : Nachiket Kanore
// Institute : PICT, Pune

/* It does not matter how slowly you go as long as you do not stop.*/

#include <bits/stdc++.h>

using namespace std;

#define int long long
#define endl '\n'
#define rep(x,s,e) for(int x=s;x<=(e);x++)
#define repn for(int x=0;x<n;x++)
#define rep1n for(int x=1;x<=n;x++)
#define rep1m for(int y=1;y<=m;y++)
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(), x.rend()
#define precise(x) cout << fixed << setprecision(x)
#define bits(x) __builtin_popcount(x)
#define pb push_back
#define mp make_pair
#define test int t; cin>>t; while(t--)
#define FAST                          \
    ios_base::sync_with_stdio(false); \
    cin.tie(NULL);                    \
    cout.tie(NULL)

typedef vector<int> vi;
typedef vector<pair<int,int>> vii;
typedef pair<int,int> pii;


void __print(int x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}


template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifndef ONLINE_JUDGE
#define see(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define see(x...)
#endif

const int inf = 1e18;
const int N = 1005;


int32_t main(){
    FAST;

    double n;   cin >> n;
    precise(12);
    double odd = ceil(n/2);

    double ans = odd / n;
    cout << ans << endl;


    return 0;
}




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

#define REP(i,n) for(int (i)=0; i<(int)(n); i++)

const int MAXN = 1000000007;
int dp[1010][1010];
char a[1010][1010];

int main(void){
    int N,M;
    cin >> N >> M;
    REP(i,N) REP(j,M)
		cin>>a[i][j];
    dp[0][0]=1;
    REP(i,N) REP(j,M)
		if((i+j) > 0 && a[i][j] != '#')
			dp[i][j] = ((i>0?dp[i-1][j]:0)\
			+(j>0?dp[i][j-1]:0))%MAXN;
    cout << dp[N-1][M-1] << endl;
    return 0;
}


Measured memory_bytes: 5248
#![allow(unused_imports, unused_macros, dead_code)]

macro_rules! min {
    (.. $x:expr) => {{
        let mut it = $x.iter();
        it.next().map(|z| it.fold(z, |x, y| min!(x, y)))
    }};
    ($x:expr) => ($x);
    ($x:expr, $($ys:expr),*) => {{
        let t = min!($($ys),*);
        if $x < t { $x } else { t }
    }}
}
macro_rules! max {
    (.. $x:expr) => {{
        let mut it = $x.iter();
        it.next().map(|z| it.fold(z, |x, y| max!(x, y)))
    }};
    ($x:expr) => ($x);
    ($x:expr, $($ys:expr),*) => {{
        let t = max!($($ys),*);
        if $x > t { $x } else { t }
    }}
}


macro_rules! ewriteln {
    ($($args:expr),*) => { let _ = writeln!(&mut std::io::stderr(), $($args),*); };
}
macro_rules! trace {
    ($x:expr) => { ewriteln!(">>> {} = {:?}", stringify!($x), $x) };
    ($($xs:expr),*) => { trace!(($($xs),*)) }
}
macro_rules! put {
    (.. $x:expr) => {{
        let mut it = $x.iter();
        if let Some(x) = it.next() { print!("{}", x); }
        for x in it { print!(" {}", x); }
        println!("");
    }};
    ($x:expr) => { println!("{}", $x) };
    ($x:expr, $($xs:expr),*) => { print!("{} ", $x); put!($($xs),*) }
}

const M: i64 = 1_000_000_007;

fn search(ls: &[i32], sub: i32) -> usize {
    let n = ls.len();
    if n == 0 { return 0 }
    if ls[0] > sub { return n }
    if ls[n - 1] <= sub { return 0 }
    let mut left = 0;  // ls[left] <= sub
    let mut right = n - 1;  // ls[right] > sub
    for _ in 0..100 {
        let mid = (left + right) / 2;
        if ls[mid] <= sub {
            left = mid;
        } else {
            right = mid;
        }
    }
    n - left - 1
}

fn main() {
    let mut sc = Scanner::new();
    let n: usize = sc.cin();
    let mut ls: Vec<i32> = sc.vec(n);
    ls.sort();
    let mut ans = 0;
    for i in 0..n {
        for j in 0..i {
            let sub = (ls[i] - ls[j]).abs();
            let count = search(&ls[j + 1..i], sub);
            ans += count;
        }
    }
    put!(ans);
}

use std::io::{self, Write};
use std::str::FromStr;
use std::collections::VecDeque;

struct Scanner { stdin: io::Stdin, buffer: VecDeque<String>, }
impl Scanner {
    fn new() -> Self { Scanner { stdin: io::stdin(), buffer: VecDeque::new() } }
    fn cin<T: FromStr>(&mut self) -> T {
        while self.buffer.len() == 0 {
            let mut line = String::new();
            let _ = self.stdin.read_line(&mut line);
            for w in line.split_whitespace() {
                self.buffer.push_back(String::from(w));
            }
        }
        self.buffer.pop_front().unwrap().parse::<T>().ok().unwrap()
    }
    fn chars(&mut self) -> Vec<char> {
        self.cin::<String>().chars().collect()
    }
    fn vec<T: FromStr>(&mut self, n: usize) -> Vec<T> {
        (0..n).map(|_| self.cin()).collect()
    }
}


Measured memory_bytes: 4476
#include <cstdio>
#include <map>
#include <set>
#include <algorithm>
#include <utility>
#include <functional>

std::pair<int, int> count[100000];
std::map<int, int> edges[100000];

void dfs(int s, int last)
{
  int col = 1;
  for (auto &p : edges[s])
  {
    if (p.second == last)
    {
      continue;
    }
    if (col == last) ++col;
    edges[s][p.first] = col;
    edges[p.first][s] = col;
    dfs(p.first, col);
    ++col;
  }
}

int main()
{
  int n;
  scanf("%d", &n);
  std::pair<int, int> indexed[100000];
  for (int i = 0; i < n; ++i)
  {
    count[i].second = i;
  }
  for (int i = 0; i < n - 1; ++i)
  {
    int a, b;
    scanf("%d%d", &a, &b);
    --a, --b;
    edges[a][b] = 0;
    edges[b][a] = 0;
    indexed[i] = {a, b};
    count[a].first++;
    count[b].first++;
  }
  std::sort(count, count + n, std::greater<std::pair<int, int>>());
  int k = count[0].first;
  dfs(0, -1);
  printf("%d\n", k);
  for (int i = 0; i < n - 1; ++i)
  {
    printf("%d\n", edges[indexed[i].first][indexed[i].second]);
  }
  return 0;
}


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

#define M 1000000007
#define MM 998244353 
#define ll long long 
#define pb push_back
#define mem0(a) memset(a,0,sizeof(a))
#define mem1(a) memset(a,-1,sizeof(a))
#define memf(a) memset(a,false,sizeof(a))
#define all(v) v.begin(),v.end()
#define sz(a) (ll)a.size()
#define F first
#define S second
#define INF 2000000000000000000
#define endl "\n"
#define _time_ 1.0 * clock() / CLOCKS_PER_SEC
#define popcount(x) __builtin_popcountll(x)
#define pll pair<ll,ll> 
#define ld long double

const long double PI = acos(-1);

ll power(ll b,ll e,ll m)
{
    if(e==0) return 1;
    if(e&1) return b*power(b*b%m,e/2,m)%m;
    return power(b*b%m,e/2,m);
}
ll power( ll b, ll e)
{
    if(e==0) return 1;
    if(e&1) return b*power(b*b,e/2);
    return power(b*b,e/2);
}
template<typename T, typename U> static inline void amin(T &x, U y){ if(y<x) x=y; }
template<typename T, typename U> static inline void amax(T &x, U y){ if(x<y) x=y; }
template<typename T, typename U> ostream& operator<<(ostream &os, const pair<T, U> &p)
{ 
    return os<<'('<<p.F<< ","<<p.S<<')'; 
}

int _runtimeTerror_()
{
    ll n;
    cin>>n;
    vector<ll> a(n);
    for(auto &j:a)
        cin>>j;
    ll x=0;
    for(int i=0;i<n;++i)
        x^=a[i];
    if(x==0)
    {
        cout<<0<<'\n';
        return 0;
    }
    if(a[0]==1)
    {
        cout<<-1;
        return 0;
    }
    ll s=a[0]+a[1];
    ll y=x^a[0]^a[1];
    if(y%2!=s%2)
    {
        cout<<-1;
        return 0;
    }
    ll z=(s-y)/2;
    ll a1=0,a2=0;
    bool mark[40];
    memf(mark);
    for(int i=0;i<40;++i)
    {
        if(y&(1LL<<i))
        {
            if(z&(1ll<<i))
            {
                cout<<-1;
                return 0;
            }
            mark[i]=true;

        }
        else
        {
            if(z&(1ll<<i))
                a1+=1LL<<i,a2+=1ll<<i;
        }
    }
    ll ans=INF;
    if(a1<=a[0])
    {
        ll xx=a[0]-a1;
        for(int i=39;i>=0;--i)
            if(mark[i] && (1ll<<i)<=xx)
                xx-=1ll<<i;
        amin(ans,xx);
    }
    // if(a2<=a[0])
    // {
    //     ll xx=a[0]-a2;
    //     for(int i=39;i>=0;--i)
    //         if(mark[i] && (1ll<<i)<=xx)
    //             xx-=1ll<<i;
    //     amin(ans,xx);
    // }
    cout<<(ans==INF || ans==a[0]?-1:ans);
    return 0;
}

int main()
{
    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    #ifdef runSieve
        sieve();
    #endif
    #ifdef NCR
        initialize();
    #endif
    int TESTS=1;
    //cin>>TESTS;
    while(TESTS--)
        _runtimeTerror_();
    return 0;
}


Measured memory_bytes: 3560
//include <bits/stdc++.h>
// Headder {{{
#pragma GCC optimize("O3")
#include <complex>
#include <cstdint>
#include <iostream>
#include <utility>
#include <vector>
#include <string>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <unordered_map>
#include <algorithm>
#include <functional>
#include <numeric>
#include <cstring>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cassert>
#include <climits>
// }}}
using namespace std;
#define int long long
#define read cin >>
#define echo cout <<
#define fin << '\n'
#define _ << ' ' <<
#define in :
#define var auto&&

#define complex complex<long double>

complex xy[64];
int n;

long double predictTheoremA ( long double a, long double b, long double c ) {
    return ( b*b + c*c - a*a ) / ( 2.0 * b * c );
}

long double check ( complex centre ) {
    long double rec = 0;
    for ( int i = 0; i < n; i++ ) {
        complex vec = centre - xy[i];
        rec = max ( rec, abs(vec) );
    }
    return rec;
}

signed main ( ) {

    read n;
    for ( int i = 0; i < n; i++ ) {
        int x, y;
        cin >> x >> y;
        complex tmp(x, y);
        xy[i] = tmp;
    }

    long double ans = 1e8;
    for ( int i = 0; i < n; i++ ) {
        for ( int j = i+1; j < n; j++ ) {
            for ( int k = j+1; k < n; k++ ) {
                complex a = xy[i];
                complex b = xy[j];
                complex c = xy[k];
                complex vecAB = b - a;
                complex vecAC = c - a;
                complex vecBC = c - b;
                long double lenA = abs(vecBC);
                long double lenB = abs(vecAC);
                long double lenC = abs(vecAB);
                long double AcosA = lenA * predictTheoremA ( lenA, lenB, lenC);
                long double BcosB = lenB * predictTheoremA ( lenB, lenA, lenC);
                long double CcosC = lenC * predictTheoremA ( lenC, lenA, lenB );
                complex out = ( a * AcosA + b * BcosB + c * CcosC )
                            / ( AcosA + BcosB + CcosC );

                if ( check(out) == 0 ) {
                    /*
                    echo "a: " _ a fin;
                    echo "b: " _ b fin;
                    echo "c: " _ c fin;
                    echo "lenA: " _ lenA fin;
                    echo "lenB: " _ lenB fin;
                    echo "lenC: " _ lenC fin;
                    echo "AcosA: " _ AcosA fin;
                    echo "BcosB: " _ BcosB fin;
                    echo "CcosC: " _ CcosC fin;
                    echo "vecBC=a: " _ vecBC fin;
                    echo "vecAC=b: " _ vecAC fin;
                    echo "vecAB=c: " _ vecAB fin;
                    puts("");
                    */
                }
                else ans = min ( ans, check(out) );

            }
        }
    }
    for ( int i = 0; i < n; i++ ) {
        for ( int j = i+1; j < n; j++ ) {
            ans = min ( ans, check((xy[i]+xy[j])/(long double)2));
        }
    }

    printf("%0.15Lf\n", ans);

    return 0;
}

Measured memory_bytes: 256
n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))

ans = 0
for i in reversed(range(n)):
    if b[i] <= a[i+1]:
        ans += b[i]
    else:
        ans += a[i+1]
        b[i] -= a[i+1]
        if a[i] >= b[i]:
            a[i] -= b[i]
            ans += b[i]
        else:
            ans += a[i]
            a[i] = 0

print(ans)

Measured memory_bytes: 18624
n, x = map(int, input().split())
a = list(map(int, input().split()))
count = 0
remain = x
a.sort()

for i in range(len(a)):
    if sum(a) == x:
        while n > 0:
            count += 1
            n -= 1
        continue
    remain -= a[i]
    if remain >= 0 and i != len(a)-1:
        count += 1
    else:
        break

print(count)

Measured memory_bytes: 3064
N, M = map(int, input().split())

ans = 0

if N >= 3 and M >= 3:
  ans = (N - 2) * (M - 2) 
elif N == 2 or M == 2:
  ans = 0
elif N == 1 or M == 1:
  if N == 1 and M == 1:
    ans = 1
  else:
    ans = max(N, M) - 2
  
print(ans)

Measured memory_bytes: 9192
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll INF = 1LL << 60;

int main() {
    int k;
    cin >> k;
    int ans = 1;
    int mod10 = 10 % (9 * k);
    set<int> tbl;
    bool flag = false;
    if (k % 2 == 0 or k % 5 == 0) {
        ans = -1;
        flag = true;
    } else if (k == 1 or k == 7) {
        flag = true;
    }
    while (!flag) {
        if ((7 * (mod10 * 10 - 1)) % (9 * k) == 0) {
            ans++;
            flag = true;
        } else if (tbl.count((7 * (mod10 * 10 - 1)) % (9 * k))) {
            flag = true;
            ans = -1;
        } else {
            tbl.insert((7 * (mod10 * 10 - 1)) % (9 * k));
            ans++;
            mod10 = (mod10 * 10) % (9 * k);
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 50412
#include<bits/stdc++.h>
using namespace std;
#define fs first
#define sc second
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define ALL(A) A.begin(),A.end()
#define RALL(A) A.rbegin(),A.rend()
typedef long long LL;
typedef pair<int,int> P;
const LL mod=998244353;
const LL LINF=1LL<<62;
const int INF=1<<20;



int main(){
    int a,b;cin >> a >> b;
    if(b%a==0) cout << a+b;
    else cout << b-a << endl;
    return 0;
}



Measured memory_bytes: 256
/*
このコード、と～おれ!
Be accepted!
∧＿∧　
（｡･ω･｡)つ━☆・*。
⊂　　 ノ 　　　・゜+.
　しーＪ　　　°。+ *´¨)
 　　　　　　　　　.· ´¸.·*´¨) ¸.·*¨)
		  　　　　　　　　　　(¸.·´ (¸.·'* ☆
					*/

#include <stdio.h>
#include <algorithm>
#include <string>
#include <cmath>
#include <cstring>
#include <vector>
#include <numeric>
#include <iostream>
#include <random>
#include <map>
#include <unordered_map>
#include <queue>
#include <regex>
#include <functional>
#include <complex>
#include <list>
/*多倍長整数/cpp_intで宣言
#include <boost/multiprecision/cpp_int.hpp>
using namespace boost::multiprecision;
*/

//#pragma GCC target ("avx2")
//#pragma GCC optimization ("O3")
//#pragma GCC optimization ("unroll-loops")
#define rep(i, n) for(int i = 0; i < (n); ++i)
#define rep1(i, n) for(int i = 1; i <= (n); ++i)
#define rep2(i, n) for(int i = 2; i < (n); ++i)
#define repr(i, n) for(int i = n; i >= 0; --i)
#define reprm(i, n) for(int i = n - 1; i >= 0; --i)
#define printynl(a) printf(a ? "yes\n" : "no\n")
#define printyn(a) printf(a ? "Yes\n" : "No\n")
#define printYN(a) printf(a ? "YES\n" : "NO\n")
#define printin(a) printf(a ? "possible\n" : "imposible\n")
#define printdb(a) printf("%.50lf\n", a)//少数出力
#define printdbd(a) printf("%.16lf\n", a)//少数出力(桁少なめ)
#define prints(s) printf("%s\n", s.c_str())//string出力
#define all(x) (x).begin(), (x).end()
#define allsum(a, b, c) ((a + b) * c / 2)//等差数列の和、初項,末項,項数
#define pb push_back
#define priq priority_queue
#define rpriq priq<int, vector<int>, greater<int>>
#define deg_to_rad(deg) (((deg)/360.0)*2.0*PI)
#define rad_to_deg(rad) (((rad)/2.0/PI)*360.0)
#define Please return
#define AC 0
#define addf(T) [](T a, T b){return (a + b);}
#define minf(T) [](T a, T b){return min(a, b);}
#define maxf(T) [](T a, T b){return max(a, b);}


using ll = long long;

constexpr int INF = 1073741823;
constexpr int MINF = -1073741823;
constexpr ll LINF = ll(4661686018427387903);
constexpr ll MOD = 1000000007;
const long double PI = acos(-1.0L);

using namespace std;

void scans(string& str) {
	char c;
	str = "";
	scanf("%c", &c);
	if (c == '\n')scanf("%c", &c);//最初の改行対策
	while (c != '\n' && c != -1) {
		str += c;
		scanf("%c", &c);
	}
}

void scanc(char& str) {
	char c;
	scanf("%c", &c);
	if (c == -1)return;
	while (c == '\n') {
		scanf("%c", &c);
	}
	str = c;
}

double acot(double x) {
	return PI / 2 - atan(x);
}

ll gcd(ll a, ll b) {
	if (b == 0) return a;
	return gcd(b, a % b);
}

ll lcm(ll number1, ll number2) {//lcmを求める
	return number1 / gcd(number1, number2) * number2;
}

ll LSB(ll n) { return (n & (-n)); }

/*-----------------------------------------ここからコード-----------------------------------------*/



int main() {

	int h, n;
	scanf("%d", &h);
	scanf("%d", &n);
	vector<int> a(n);
	rep(i, n)scanf("%d", &a[i]);
	printyn(h <= accumulate(all(a), 0));

	Please AC;
}


Measured memory_bytes: 888
#include <algorithm>
#include <bits/stdc++.h>
#include <bitset>
#include <cassert>
#include <cstring>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <math.h>
#include <memory>
#include <queue>
#include <set>
#include <stack>
#include <utility>
#include <vector>
using namespace std;
#define REP(i, n) for (int64_t i = 0; i < (int64_t)n; i++)
#define REP_FOR(i, a, b) for (int64_t i = (int64_t)a; i < (int64_t)b; i++)
#define REP_REV(i, a, b) for (int64_t i = (int64_t)a; i > (int64_t)b; i--)
#define FORALL(v) (v).begin(), (v).end()
#define mp(a, b) make_pair(a, b)
#define eb(x) emplace_back(x)
#define F first
#define S second
typedef long long ll;
typedef long double ld;
typedef pair<int64_t, int64_t> pii;
typedef pair<ll, ll> pll;
typedef pair<ld, ld> pdd;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef vector<int64_t> vii;
typedef vector<vii> vvii;
const ll mod = 1e9 + 7;
const int64_t infi = 1147483600;
const ll infl = 4e18 + 5;
const char EOL = '\n';
//cout << fixed << setprecision(17) << res << endl;
const ll MOD = 998244353;
 
int main() {
    ll a, b;
    cin >> a >> b;
    cout << (6 - a - b) <<endl;
}


Measured memory_bytes: 256
#[allow(unused_macros)]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

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

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

#[allow(unused_macros)]
macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

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

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

    ($next:expr, bytes) => {
        read_value!($next, String).into_bytes()
    };

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

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

fn main() {
    input! {
        m: usize,
        dc: [(i8, usize); m],
    }

    let mut keta: usize = 0;
    let mut sum: i64 = 0;
    for (d, c) in dc {
        keta += c;
        sum += d as i64 * c as i64;
    }

    let ans = (keta - 1) as i64 + (sum - 1) / 9;

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


Measured memory_bytes: 8444
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
 
using namespace std;
 
namespace Mylib{
 
}
int main(void){
    //A先攻
    int Battle[4];
    for(int i=0;i<4;i++)cin >> Battle[i];//設定
    int Winplayer=0;
    while(Battle[0]>0&&Battle[2]>0){
        
        Battle[2]-=Battle[1];
        
        if(Battle[3]<1){
            Winplayer=1;
            break;
        }
        
        Battle[0]-=Battle[3];
        
        if(Battle[0]<1){
            Winplayer=2;
            break;
        }
    }
    
    if(Battle[2]<1){
        cout << "Yes" << endl;
        
    }else if(Battle[0]<1){
        cout << "No" << endl;
    }
    
    
    return 0;
 
}

Measured memory_bytes: 3624
#pragma comment(linker, "/STACK:102400000,102400000")
#include<bits/stdc++.h>
using namespace std;
# define ll long long
# define inf 0x3f3f3f3f
# define ll_inf (1ll<<60)
# define lson l,mid,rt<<1
# define rson mid+1,r,rt<<1|1
const int maxn = 2e5+10;
const int  N = 15;
const int mod = 1e9+7;
int a[maxn];
map<int,int>vis_odd;
map<int,int>vis_even;
vector<int>sto1;
vector<int>sto2;
int main()
{
    int n;
    scanf("%d",&n);
    int maxx_odd=0,maxx_even=0;
    int even=0,odd=0;
    for(int i=1; i<=n; i++)
    {
        scanf("%d",&a[i]);
        if(i&1)
        {
            vis_odd[a[i]]++;
            if(vis_odd[a[i]]>maxx_odd)
            {
                maxx_odd=vis_odd[a[i]];
                odd=a[i];
            }
        }
        else
        {
            vis_even[a[i]]++;
            if(vis_even[a[i]]>maxx_even)
            {
                maxx_even=vis_even[a[i]];
                even=a[i];
            }
        }
    }
    int maxx=0,even_second;
    for(int i=1; i<=100000; i++)
    {
        if(i==even)
            continue;
        if(maxx<vis_even[i])
        {
            maxx=vis_even[i];
            even_second=i;
        }
    }
    int minn=inf ;
    for(int i=1; i<=100000; i++)
    {
        if(i!=even)
        {
            minn=min(minn,n-vis_even[even]-vis_odd[i]);
        }
        else
        {
            minn=min(minn,n-vis_even[even_second]-vis_odd[i]);
        }
    }
    printf("%d\n",minn);
    return 0;
}





Measured memory_bytes: 10112
fun Int.isOdd() : Boolean = this % 2 != 0
fun Int.isEven() : Boolean = this % 2 == 0

/**
 * @author karayuu
 */
fun main(args: Array<String>) {
  val n = readLine()!!.toInt()
  val a = readLine()!!.split(" ").map { it.toInt() }

  println(a.filterIndexed { index, i -> index.isEven() && i.isOdd() }.count())
}

Measured memory_bytes: 36432
N,A,B=map(int,raw_input().split())
S=raw_input()

winner=0
ab_winner=0
return_list=[]

for i in range(N):
    if S[i]=='a':
        if winner<A+B:
            return_list.append('Yes')
            winner+=1
        else:
            return_list.append('No')
            
    elif S[i]=='b':
        if winner<A+B:
            if ab_winner<B:
                return_list.append('Yes')
                winner+=1
                ab_winner+=1
            else:
                return_list.append('No')
        else:
            return_list.append('No')
    else:
        return_list.append('No')

for i in range(N):
    print return_list[i]


Measured memory_bytes: 7088
#include <stdio.h>

int main(void){
	char w[128], ch = 'a' , y_n[4];
	int ct=0,i=0;
	
	scanf("%s", w);
	
	while(1){
		while(w[i] != NULL){
			if(w[i] == ch) ct++;
			i++;
		}
		if(ct%2 == 1){
			printf("No\n");
			break;
		}
		else if(ch == 'z'){
			printf("Yes\n");
			break;
		}
		ct = 0;
		i = 0;
		ch++;
	}
	
	return 0;
}	


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

int main(){
    int N;
    cin >> N ;
    vector<int> vec(N,0);
    int counter=0;
    for(int i=0;i<N;i++){
        cin >> vec.at(i);
        if(vec.at(i)!=i+1) counter++;
    }
    if(counter==0||counter==2){cout << "YES" << endl;}
    else{ cout << "NO" << endl;}
}

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

int main() {
    int W, H, N;
    cin >> W >> H >> N;
    int left_x = 0;
    int right_x = W;
    int below_y = 0;
    int top_y = H;
    rep(i, N) {
        int x, y, a;
        cin >> x >> y >> a;
        if (a == 1) {
            left_x = max(x, left_x);
        }
        else if (a == 2) {
            right_x = min(x, right_x);
        }
        else if (a == 3) {
            below_y = max(y, below_y);
        }
        else if (a == 4) {
            top_y = min(y, top_y);
        }
    }
    if (top_y <= below_y || right_x <= left_x) {
        cout << 0 << endl;
    }
    else {
        cout << (top_y-below_y)*(right_x-left_x) << endl;
    }
}

Measured memory_bytes: 256