akhauriyash/Code-Regression huggingface dataset:
using System;
using System.IO;
using System.Linq;
using System.Numerics;
using System.Collections.Generic;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using static System.Math;
using Debug = System.Diagnostics.Debug;

static class P
{
    static void Main()
    {
        long k = int.Parse(Console.ReadLine());
        var xy = Console.ReadLine().Split().Select(int.Parse).ToArray();
        bool isNegativeX = xy[0] < 0;
        bool isNegativeY = xy[1] < 0;
        long X = Abs(xy[0]);
        long Y = Abs(xy[1]);
        if ((X + Y) % 2 == 1 && k % 2 == 0)
        {
            Console.WriteLine(-1);
            return;
        }
        List<Tuple<long, long>> moves = new List<Tuple<long, long>>();
        //アプローチ diffが2k以下で、かつ偶数のときに2stepでゴールできる
        long currentX = 0;
        long currentY = 0;
        while (!(Abs(Y - currentY) + Abs(X - currentX) <= 2 * k && (Abs(Y - currentY) + Abs(X - currentX)) % 2 == 0))
        {
            long remainMove = k;
            if (currentX < X)
            {
                var move = Min(X - currentX, remainMove);
                currentX += move;
                remainMove -= move;
            }
            currentY += remainMove;
            moves.Add(new Tuple<long, long>(currentX, currentY));
        }
        if (X == currentX && Y == currentY) goto end;
        //調整
        
        var xDiff = Abs(X - currentX);
        var yDiff = Abs(Y - currentY);
        if (xDiff < yDiff)
        {
            var ymove = ((xDiff + yDiff) / 2 - xDiff) * (Y < currentY ? -1 : 1);
            var xmove = k - Abs(ymove);
            moves.Add(new Tuple<long, long>(currentX + xmove, currentY + ymove));
        }
        else
        {
            var xmove = (xDiff + yDiff) / 2 - yDiff;
            var ymove = k - xmove;
            moves.Add(new Tuple<long, long>(currentX + xmove, currentY + ymove));
        }
        moves.Add(new Tuple<long, long>(X, Y));
    end:;
        Console.WriteLine(moves.Count);
        Console.WriteLine(string.Join("\n", moves.Select(x => $"{(isNegativeX ? -x.Item1 : x.Item1)} {(isNegativeY ? -x.Item2 : x.Item2)}")));
    }
}


Measured memory_bytes: 31552
#include<iostream>
#include<queue>
#include<cstring>
using namespace	 std;


const int Max = 1005;
const int INF = 1000000000;
typedef pair<int,int>p;

p factory[15];

char a[Max][Max];
int b[Max][Max];
int h, w, n;

void initmartix(){
	for( int i = 0; i < h; i++)
		for(int j = 0; j < w; j++)
			b[i][j] = INF;
}

bool judge(int x, int y){
	if (x >= 0 && x < h && y>= 0 && y < w && a[x][y] != 'X' && b[x][y] == INF)
		return true;
	return false;
}
		
int bfs(p ps, p pe){
	queue<p> que;
	initmartix();
	b[ps.first][ps.second] = 0;
	que.push(ps);
	
	while (que.size()){
		p top = que.front();
		que.pop();
		if (top == pe) break;
		int dx[4] = {0, 1, 0, -1};
		int dy[4] = {1, 0, -1, 0};
		for (int i = 0; i < 4; i++){
			int nx = top.first + dx[i];
			int ny = top.second + dy[i];
			if (judge(nx, ny)){
				b[nx][ny] = b[top.first][top.second] + 1;
				que.push(p(nx, ny));
			}
		}
	}
	return b[pe.first][pe.second];
}
		
void solve(){
	int sum = 0;
	for (int i = 0; i < n; i++){
		int time = bfs(factory[i], factory[i+1]);
		if (time != INF)	
			sum += time;

	}
	cout << sum << endl;
}
//读取。
int main(){
	cin >> h >> w >> n;
	for (int i = 0; i < h; i++){
		for (int j = 0; j < w; j++){
			cin >> a[i][j];
			char tmp = a[i][j];
			if (tmp != '.' && tmp != 'X'){
				
				if (a[i][j] == 'S'){
					factory[0] = p(i, j);
				}
				else{
					factory[tmp - '0'] = p(i, j);
				}
			}
		}
	}
//解题。
	solve();
	return 0;
}




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

#define x first
#define y second

using namespace std;

typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int,int> ii;
typedef pair<ll,ll> pll;

int N,M;
//set<ii> al[100000];
int dist[100000];
queue<int> q;
//set<int> vis;

vector<pair<ii,int>> al[100000];

bool vis[100000];
void dfs(int i,int k,int di) {
	if (vis[i]) return;
	vis[i]=1;
	if (dist[i]==INT_MAX) {
		dist[i]=di;
		q.push(i);
	}
	//auto U=upper_bound(al[i].begin(),al[i].end(),ii{k,INT_MAX});
	int ct=lower_bound(al[i].begin(),al[i].end(),pair<ii,int>({k,0},0))-al[i].begin();
		for (;ct<al[i].size() && al[i][ct].x.x==k && al[i][ct].y==0;ct++) {
		//	it!=al[i].end() && it->x.x==k;it++) {
	//for (auto it=lower_bound(al[i].begin(),al[i].end(),ii{k,0});it!=U;) {
		int j=al[i][ct].x.y;
		//cout << al[i].size() << endl;;
		//al[i].erase(prev(++it));
		//cout << al[i].size();
		//cout << "ho" << endl;
		al[i][ct].y=1;
		dfs(j,k,di);
		//cout << "hi" << endl;
	}
	vis[i]=0;
}

int main() {
	ios::sync_with_stdio(0);
	cin >> N >> M;
	fill(dist+1,dist+N,INT_MAX);
	for (int c=0;c<M;c++) {
		int i,j,k;
		cin >> i >> j >> k;
		i--;j--;
		al[i].push_back({{k,j},0});
		al[j].push_back({{k,i},0});
	}

	for (int i=0;i<N;i++) sort(al[i].begin(),al[i].end());

	q.push(0);
	while (!q.empty()) {
		int i=q.front();q.pop();
		//while (!al[i].empty()) {
			//cout << "Helle" << endl;
			for (int c=0;c<al[i].size();c++) if (al[i][c].y==0)
				dfs(i,al[i][c].x.x,dist[i]+1);
			//vis.clear();
		//}
	}

	if (dist[N-1]==INT_MAX) cout << -1 << endl;
	else cout << dist[N-1] << endl;
}

Measured memory_bytes: 11776
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <vector>
#include <string>
#include <unordered_set>

#define REP(i, s, e) for (ll i = s; i < e; ++i)

using namespace std;
using ll = long long;
using ld = long double;

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

    int A, B;
    cin >> A >> B;
    cout << A * B - A - B + 1 << endl;

    return 0;
}


Measured memory_bytes: 256
for e in iter(input,'0 0 0'):
 d=[2]*-~sum(map(int,e.split()))
 f=[]
 for _ in[0]*int(input()):
  s,t,u,v=map(int,input().split())
  if v:d[s]=d[t]=d[u]=1
  else:f+=[(s,t,u)]
 for s,t,u in f:
  if d[t]*d[u]==1:d[s]=0
  if d[u]*d[s]==1:d[t]=0
  if d[s]*d[t]==1:d[u]=0
 print(*d[1:],sep='\n')


Measured memory_bytes: 5716
'''
B - Boxes
時間制限 : 2sec / メモリ制限 : 256MB

配点 : 500 点

問題文
http://agc010.contest.atcoder.jp/tasks/agc010_b
問題文
N 個の箱が円環状に並んでおり、i 番目の箱には Ai 個の石が入っています。

以下の操作を繰り返して、全ての石を取り除くことができるか判定してください。

箱を一か所選ぶ。それを i 番目としたとき、1 から N の各 j に対して、i+j 番目の箱から石をちょうど j 個取り除く。
ただし、N+k 番目と表される箱は k 番目の箱と同一視するものとする。
各操作において、取り除きたい個数の石がない箱があるときは、その操作を行えないことに注意してください。

制約
1≦N≦105
1≦Ai≦109
'''
import numpy as np
import sys
import time

def gel(N,s):
	a=np.arange(1,N+1)
	return a[[(i-s) % N for i in range(N)]]

def dx(arr):
	n=arr.size
	b=[(s+1)%n for s in range(n)]
	return arr[b]-arr
	
N=int(input())
b=np.fromstring(input(),dtype=int,sep=' ')

U=int((N+1)*N/2)
m=b.sum()//U
r=b.sum()%U

if r!=0 or b.min()<m:
	print('NO')
else:
	k=(dx(b)-m)%N
	if k.min()==0 and k.max()==0:
		print('YES')
	else:
		print('NO')


Measured memory_bytes: 26612
#include<iostream>

using namespace std;

int main(){
  int W,H,N; cin >> W >> H >> N;
  int cnt1 = 0; int cnt2 = W; int cnt3 = 0; int cnt4 = H;
  for(int i = 0; i < N; i++){
    int x,y,a; cin >> x >> y >> a;
    if( a == 1){ cnt1 = max(cnt1,x);}
    else if( a == 2){cnt2 = min(cnt2,x);}
    else if( a == 3){cnt3 = max(cnt3,y);}
    else if( a == 4){cnt4 = min(cnt4,y);}}
  
  if( cnt1 < cnt2 && cnt3 < cnt4){
    cout << ( cnt2 - cnt1) * (cnt4 - cnt3) << endl;}
  else{cout << 0 << endl;}
  return 0;}


Measured memory_bytes: 256
a,b,k=map(int,input().split())
def co(x, y):
	x //= 2
	y += x
	return x, y

for i in range(k):
	if i % 2 == 0:
		a,b = co(a,b)
	else:
		b,a = co(b,a)
print(a,b)

Measured memory_bytes: 9144
#include <iostream>

using namespace std;

int main() {
  int n;
  cin >> n;
  int res = 0;
  for (int i = 1; i <= n; ++i) {
    if (i % 2 == 0) continue;

    int num = 0;
    for (int j = 1; j <= i; ++j) {
      if (i % j == 0) ++num;
    }

    if (num == 8) ++res;
  }
  cout << res << endl;
  return 0;
}

Measured memory_bytes: 3600
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int sum = 0;
		int max = 0;
		for(int i = 0; i < N; i++) {
			int tmp = sc.nextInt();
			sum += tmp;
			max = Math.max(max, tmp);
		}
		sum -= max;
		if(max < sum) {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}
	}

}


Measured memory_bytes: 21972
import std.stdio, std.string, std.conv, std.range, std.array, std.algorithm;
import std.uni, std.math, std.container, std.typecons, std.typetuple;
import core.bitop, std.datetime;

immutable long mod = 10^^9 + 7;
immutable int inf = mod;

void main(){
    int n, m;
    readVars(n, m);
    auto c = readln.split.to!(int[]);
    c.sort();

    auto dp = new int[](n + 1);
    dp[] = inf;
    dp[0] = 0;

    foreach(i ; 1 .. n + 1){
        foreach(cj ; c){
            if (i - cj < 0) break;

            dp[i] = min(dp[i], dp[i - cj] + 1);
        }
    }

    writeln(dp[n]);
}

void readVars(T...)(auto ref T args){
    auto line = readln.split;
    foreach(ref arg ; args){
        arg = line.front.to!(typeof(arg));
        line.popFront;
    }
    if(!line.empty){
        throw new Exception("args num < input num");
    }
}

Measured memory_bytes: 2724
import math
H, N = list(map(int, input().split()))
 
AB = [list(map(int, input().split())) for _ in range(N)]
 
dp = [float('inf')] *(H+1)
dp[H] = 0
for a,b in AB:
    for i in range(H,-1,-1):
        if i <= H - a:
            dp[i] = min(dp[i], dp[i+a] + b)
    dp[0] = min(dp[0], min(dp[:a+1]) + b) # if hp is not just 0
print(dp[0])


Measured memory_bytes: 51036
//////AGC039-B//////
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define For(i,n,k) for(ll i=(n);i<(k);i++)
void Main(){
    string s;cin>>s;
    if(s.size()==3) reverse(s.begin(),s.end());
    cout<<s<<endl;
}
int main(){
    Main();
    return 0;
}


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

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

Measured memory_bytes: 3636
#include <iostream>

using namespace std;

int main()
{
	int N, A, B;
	cin >> N >> A >> B;

	for (;;) {
		if (A + 1 < B) {
			A++;
		}
		else if (1 < A) {
			A--;
		}
		else {
			cout << "Borys" << endl;
			break;
		}
		if (A < B - 1) {
			B--;
		}
		else if (B < N) {
			B++;
		}
		else {
			cout << "Alice" << endl;
			break;
		}
	}
}


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

using namespace std;

#define rep(i, n) for (int i = 0; i < (int)n; ++i)
#define FOR(i, a, b) for (int i = a; i < (int)b; ++i)
#define rrep(i, n) for (int i = ((int)n - 1); i >= 0; --i)

using ll = long long;
using ld = long double;

const ll INF = 1e18;
const int Inf = 1e9;
const double EPS = 1e-9;
const ll MOD = 1e9 + 7;

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(0);
    string s, t;
    cin >> s >> t;
    int res = 0;
    rep (i, s.size()) if (s[i] != t[i]) res++;
    cout << res << endl;
    
    return 0;
}



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

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

  vector<string> a(n);
  for (auto&& e : a) cin >> e;
  sort(begin(a), end(a));

  int mx = 0;
  int cnt = 0;
  queue<string> q;

  for (int i = 0; i < n; i++) {
    cnt++;
    if (i + 1 < n && a[i] == a[i + 1]) continue;
    if (cnt > mx) {
      while (!q.empty()) q.pop();
      q.push(a[i]);
      mx = cnt;
    } else if (cnt == mx) {
      q.push(a[i]);
    }
    cnt = 0;
  }

  while (!q.empty()) {
    cout << q.front() << endl;
    q.pop();
  }
}


Measured memory_bytes: 16000
// Ver19.03
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#define INF (1 << 29) * 2
#define LLINF 4545454545454545454
#define MOD 1000000007
#define ll long long
#define ull unsigned long long
#define MAX(a, b) ((a) > (b) ? (a) : (b))
#define MIN(a, b) ((a) < (b) ? (a) : (b))
int upll(const void *a, const void *b) { return *(ll *)a < *(ll *)b ? -1 : *(ll *)a > *(ll *)b ? 1 : 0; }
int downll(const void *a, const void *b) { return *(ll *)a < *(ll *)b ? 1 : *(ll *)a > *(ll *)b ? -1 : 0; }
void sortup(ll *a, int n) { qsort(a, n, sizeof(ll), upll); }
void sortdown(ll *a, int n) { qsort(a, n, sizeof(ll), downll); }

typedef struct
{
  ll hoge;
  ll fuga;
} monster;

int upll2(const void *a, const void *b) { return ((monster *)a)->hoge < ((monster *)b)->hoge ? -1 : ((monster *)a)->hoge > ((monster *)b)->hoge ? 1 : 0; }

int main()
{
  monster mons[100005];
  ll n, m, cnt, ans = 0;
  scanf("%lld%lld", &n, &m);
  for (int i = 0; i < n; i++)
  {
    scanf("%lld%lld", &mons[i].hoge, &mons[i].fuga);
  }
  qsort(mons, n, sizeof(monster), upll2);
  for (int i = 0; i < n; i++)
  {
    if (cnt + mons[i].fuga < m)
    {
      ans += mons[i].hoge * mons[i].fuga;
      cnt += mons[i].fuga;
    }
    else
    {
      ans += mons[i].hoge * (m - cnt);
      break;
    }
  }
  printf("%lld\n", ans);
  return 0;
}


Measured memory_bytes: 3324
#include <iostream>
#include <string>
#include <vector>
#include <unordered_map>
#include <unordered_set>
using namespace std;
unordered_map<int, int> map;

void createnode(int node)
{
  map[node] = node;
}

int findparent(int node)
{
  if (node == map[node])
    return node;
  map[node] = findparent(map[node]);
  return map[node];
}

void mergenodes(int node1, int node2)
{
  int a = findparent(node1);
  int b = findparent(node2);
  if (a == b)
    return;
  if ( a > b)
    swap(a, b);
  map[b] = a;
}

int main() {
    int n, m;
  	cin >> n >> m;  	
  	int x = m;
  	while (x)
    {
      x -= 1;
      int a, b;
      cin >> a >> b;
      if (map.find(a) == map.end())
      	createnode(a);
      if (map.find(b) == map.end())
        createnode(b);
      mergenodes(a, b);
    }
  	unordered_set<int> s1;
  	for(int i=1; i<=n; i++)
    {
      if (map.find(i) == map.end())
        s1.insert(i);
      else{
      int a = findparent(i);
      s1.insert(a);
      }
    }
  	cout<<s1.size()-1;  	
  
}

Measured memory_bytes: 6940
#include<iostream>
#include<cmath>
#include<numeric>
#include<functional>
#include<string>
#include<algorithm>
#include<vector>
#include<map>
#include<iomanip>
#include<queue>
#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<n;i++)
#define ll long long
#define INF 2147483647
using namespace std;
using Graph=vector<vector<int>>;

int main(){
  ll n,d; cin>>n>>d;
  ll x[n],y[n];
  rep(i,n){
    cin>>x[i]>>y[i];
  }
  ll count=0;
  rep(i,n){
    if(x[i]*x[i]+y[i]*y[i]<=d*d){
      count++;
    }
  }
  cout<<count;
}


Measured memory_bytes: 6756
using System;
using System.Linq;
using System.Collections.Generic;
using static System.Console;
using static System.Math;
 
public class Hello{
    public static void Main(){
        string[] input = ReadLine().Split(' ');
        int n = int.Parse(input[0]);
        int m = int.Parse(input[1]);
        int a = int.Parse(input[2]);
        int b = int.Parse(input[3]);
//        string temp = ReadLine();
//        int a = int.Parse(ReadLine());
//        int b = int.Parse(ReadLine());
//        string a = ReadLine();
//        string b = ReadLine();
        if(n+m > a+b){
            WriteLine("Left");
        }else if(n+m == a+b){
            WriteLine("Balanced");
        }else{
            WriteLine("Right");
        }
    }
}

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

int main()
{
  int n, m, p, s, g;
  int t[8], edge[30][30];
  double dp[1 << 8][30];
  const double INF = 1e8;

  while(scanf("%d %d %d %d %d", &n, &m, &p, &s, &g), n){
    fill_n( *edge, 30 * 30, -1);
    fill_n( *dp, (1 << 8) * 30, INF);
    s--, g--;

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

    for(int i = 0; i < p; i++){
      int a, b, c;
      scanf("%d %d %d", &a, &b, &c);
      a--, b--;
      edge[a][b] = c;
      edge[b][a] = c;
    }

    for(int i = 0; i < 1 << n; i++){
      dp[i][s] = 0.0;
    }

    double ret = INF;
    for(int i = (1 << n) - 1; i >= 0; i--){ //今のチケット
      ret = min( ret, dp[i][g]);
      for(int j = 0; j < m; j++){ //今の街
        if(dp[i][j] != INF){
          for(int k = 0; k < n; k++){ //使うチケット
            if(i >> k & 1){
              for(int l = 0; l < m; l++){ //次の街
                if(edge[j][l] != -1){
                  dp[i & ~(1 << k)][l] = min( dp[i & ~(1 << k)][l], dp[i][j] + (double)edge[j][l] / t[k]);
                }
              }
            }
          }
        }
      }
    }
    if(ret == INF) puts("Impossible");
    else printf("%.8f\n", ret);
  }
  return 0;
}

Measured memory_bytes: 1292
import sys
import os
import math
import string

ii = lambda: int(sys.stdin.buffer.readline().rstrip())
il = lambda: list(map(int, sys.stdin.buffer.readline().split()))
fl = lambda: list(map(float, sys.stdin.buffer.readline().split()))
iln = lambda n: [int(sys.stdin.buffer.readline().rstrip()) for _ in range(n)]

iss = lambda: sys.stdin.buffer.readline().decode().rstrip()
sl = lambda: list(map(str, sys.stdin.buffer.readline().decode().split()))
isn = lambda n: [sys.stdin.buffer.readline().decode().rstrip() for _ in range(n)]

lcm = lambda x, y: x * y / math.gcd(x, y)

MOD = 10 ** 9 + 7
MAX = float('inf')


def main():
    if os.getenv("LOCAL"):
        sys.stdin = open("input.txt", "r")

    N = ii()
    S = isn(N)
    print(len(set(S)))


if __name__ == '__main__':
    main()


Measured memory_bytes: 36496
n,m,q=map(int,input().split())
h=[[0]*(n) for _ in range(n)]
for i in range(m):
    l,r=map(int,input().split())
    l-=1
    r-=1
    h[n-1-l][r]+=1
ans=0
for i in range(n):
    for j in range(n-1):
        h[i][j+1] += h[i][j]
 
for j in range(n):
    for i in range(n-1):
        h[i+1][j] += h[i][j]
 
for i in range(q):
    x,y=map(int,input().split())
    x-=1
    y-=1
    print(h[n-1-x][y])

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

int main(){
  int n,m;
  int v[100];
  int w[10000];
  int dp[100+10][10000+10]={};
  int maxi;

  cin >> n >> m;

  for(int i=0;i < n;i++) cin >> v[i] >> w[i];

  for(int i=n-1;i >= 0;i--){
    for(int j=0;j <= m;j++){
      if(j < w[i])
	{
	  dp[i][j] = dp[i+1][j];
	}
      else
	{
	  dp[i][j] = max(dp[i+1][j],dp[i+1][j-w[i]] + v[i]);
	}
    }
  }
  cout << dp[0][m] << endl;
  return 0;
}
  
  



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

using namespace std; 

typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef vector<PII> VPII;
typedef long long LL;
typedef priority_queue<int> PQ_DESC;
typedef priority_queue<int, vector<int>, greater<int>> PQ_ASC;
typedef priority_queue<PII> PQ_DESC_PII;
typedef priority_queue<PII, vector<PII>, greater<PII>> PQ_ASC_PII;

#define ALL(c) (c).begin(),(c).end()
#define PB push_back
#define MP make_pair
#define SORT_ASC(c) sort(ALL(c))
#define SORT_DESC(c) sort(ALL(c), greater<typeof(*((c).begin()))>())
#define SIZE(a) int((a).size())

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define ROF(i,a,b) for(int i=(b-1);i>=(a);--i)
#define REP(i,n) FOR(i,0,n)
#define REP(i,n) FOR(i,0,n)
#define PER(i,n) ROF(i,0,n)

const double EPS = 1e-10;
const double PI  = acos(-1.0);
const int LARGE_INT = 1e9+100;
const int INF = 2e9+100;
const LL INF_LL = (LL)INF * 300 * 300;
const int MOD = 1e9+9;

//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

LL my_pow(int x, int y){
	LL a=1;
	REP(i,y){
		a *= x;
		a %= MOD;
	}
	return a % MOD;
}
void Main()
{
	LL a,b,k;
	cin >> a >> b >> k;

	if(a <= k){
		k -= a;
		a = 0;
	}
	else{
		a -= k;
		k = 0;
	}

	//dump(k)

	if(b <= k){
		b = 0;
	}
	else{
		b -= k;
	}
	cout << a << " " << b << endl;


	return;
}

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

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

long a[111111], s;
int main() {
    int n, q;
    cin >> n;
    for(int i = 0; i < n; i++)
        cin >> q, a[q]++, s += q;
    cin >> q;
    for(int i = 0; i < q; i++) {
        int b, c;
        cin >> b >> c;
        s += a[b] * (c - b);
        a[c] += a[b];
        a[b] = 0;
        cout << s << '\n';
    }
    return 0;
}


Measured memory_bytes: 4368
#include <bits/stdc++.h>
using namespace std;
/*{{{*/  //template
#define rep(i,n) for(int i=0;i<(int)(n);i++)
constexpr int INF = numeric_limits<int>::max()/2;
constexpr long long LINF = numeric_limits<long long>::max()/3;
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define fi first
#define se second
#define all(v) (v).begin(),(v).end()
#define sz(x) (int)(x).size()
#define debug(x) cerr<<#x<<":"<<x<<endl
#define debug2(x,y) cerr<<#x<<","<<#y":"<<x<<","<<y<<endl
//struct fin{ fin(){ cin.tie(0); ios::sync_with_stdio(false); } } fin_;
struct Double{ double d; explicit Double(double x) : d(x){} };
ostream& operator<<(ostream& os,const Double x){ os << fixed << setprecision(20) << x.d; return os; }
template<typename T> ostream& operator<<(ostream& os,const vector<T>& vec){ os << "["; for(const auto& v : vec){ os << v << ","; } os << "]"; return os; }
template<typename T,typename U> ostream& operator<<(ostream& os,const pair<T,U>& p){ os << "(" << p.first << ","<< p.second <<")"; return os; }
template<typename T> ostream& operator<<(ostream& os,const set<T>& st){ os<<"{"; for(T v:st) os<<v<<","; os <<"}"; return os; }
template<typename T,typename U> inline void chmax(T &x,U y){ if(y>x) x = y; }
template<typename T,typename U> inline void chmin(T &x,U y){ if(y<x) x = y; }
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
ll gcd(ll a,ll b){ if(b==0) return a; else return gcd(b,a%b); }
//constexpr double eps = 1e-14; 
constexpr double eps = 1e-10; 
constexpr ll mod = 1e9+7;
const int dx[]={1,0,-1,0} ,dy[] = {0,1,0,-1};
/*}}}*/

class UnionFind{
    public:
        std::vector<int> r,p;
        UnionFind(int n) : r(n,0) , p(n){
            for(int i=0;i<n;i++) p[i]=i;
        }
        int root(int x){
            if(p[x]==x) return x;
            else p[x]=root(p[x]);
        }
        void unite(int x,int y){
            x=root(x);
            y=root(y);
            if(x==y) return;
            if(r[x]<r[y]) p[x]=y;
            else{
                p[y]=x;
                if(r[x]==r[y]) r[x]++;
            }
        }
        bool same(int x,int y){
            return root(x)==root(y);
        }
};

const string yes = "YES";
const string no = "NO";

int N,M;
bool visited[300005];
vector<vector<int>> G;

void dfs(int cur,int par){
    visited[cur] = true;
    for(int nxt : G[cur]){
        if(nxt == par) continue;
        if(visited[nxt]) continue;
        dfs(nxt,cur);
    }
}

int main(){
    cin >> N >> M;
    G.resize(N+M);
    rep(i,N){
        int K;cin >> K;
        rep(j,K){
            int L;
            cin >> L;
            L--;
            L += N;
            G[i].push_back(L);
            G[L].push_back(i);
        }
    }

    dfs(0,0);
    bool ok = true;
    for(int i=0;i<N;i++){
        if(!visited[i]){
            cout << no << endl;
            return 0;
        }
    }
    cout << yes << endl;
    return 0;
}


Measured memory_bytes: 8568
#include<algorithm>
#include<cstring>
#include<cstdio>
#include<cmath>
#define LD double
#define LL long long
#define Re register int
using namespace std;
const int N=1e4+3,P=998244353;
int n,m,T,ans,cnt1,cnt2,jc[N],dp[N][N];char A[N],B[N];
inline void in(Re &x){
    int f=0;x=0;char c=getchar();
    while(c<'0'||c>'9')f|=c=='-',c=getchar();
    while(c>='0'&&c<='9')x=(x<<1)+(x<<3)+(c^48),c=getchar();
    x=f?-x:x;
}
inline int mi(Re x,Re k){
	Re s=1;
	while(k){
		if(k&1)s=(LL)s*x%P;
		x=(LL)x*x%P,k>>=1;
	}
	return s;
}
inline int inv(Re x){return mi(x,P-2);}
inline int C(Re m,Re n){return (LL)jc[n]*inv(jc[m])%P*inv(jc[n-m])%P;}
int main(){
//	freopen("123.txt","r",stdin);
	scanf("%s%s",A+1,B+1),n=strlen(A+1),jc[0]=1;
	for(Re i=1;i<=n;++i)cnt1+=(A[i]=='1'&&B[i]=='1'),cnt2+=(A[i]=='1'&&B[i]=='0'),jc[i]=(LL)jc[i-1]*i%P;
	for(Re j=0;j<=cnt2;++j)dp[0][j]=(LL)jc[j]*jc[j]%P;
	for(Re i=1;i<=cnt1;++i)
		for(Re j=1;j<=cnt2;++j)
			dp[i][j]=((LL)dp[i-1][j]*i%P*j%P+(LL)dp[i][j-1]*j%P*j%P)%P;
	Re ans=0;
	for(Re i=0;i<=cnt1;++i)
		(ans+=(LL)dp[cnt1-i][cnt2]*jc[i]%P*jc[i]%P*C(i,cnt1)%P*C(i,cnt1+cnt2)%P)%=P;
	printf("%d\n",ans);
}

Measured memory_bytes: 387712
def main():
    N = int(input())
    D = [int(n) for n in input().split()]
    M = int(input())
    T = [int(n) for n in input().split()]
    d_dict = {}
    t_dict = {}
    for i in D:
        d_dict[i] = d_dict.get(i, 0) + 1
    for i in T:
        t_dict[i] = t_dict.get(i, 0) + 1

    ok = True
    for k in t_dict.keys():
        if d_dict.get(k, 0) < t_dict[k]:
            ok = False
            break

    if ok:
        print('YES')
    else:
        print('NO')


if __name__ == '__main__':
    main()


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

int main() {
  string S;
  cin >> S;
  int res = 0, tmp = 0;
  for (int i = 0; i < S.size(); i++) {
    if (S[i] == 'A' || S[i] == 'C' || S[i] == 'G' || S[i] == 'T') {
      tmp++;
    }
    else {
      if (res < tmp) res = tmp;
      tmp = 0;
    }
  }
  if (res < tmp) res = tmp;
  cout << res << endl;
}


Measured memory_bytes: 256
import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
		Scanner stdIn=new Scanner(System.in);
		int N=stdIn.nextInt();
		String S=stdIn.next();
		int black[]=new int[N];
		int white[]=new int[N];
		int z=0,b=0,w=0,min=N*2;
		while(z<N){
			if(S.charAt(z)=='#')
				w++;
			if(S.charAt(N-1-z)=='.')
				b++;
			white[z]=w;
			black[N-1-z]=b;
			z++;
		}z=0;b=0;
		while(z<N){
			if(z==0)
				b=black[z];
			if(z==N-1)
				b=white[z];
			if(z!=0&&z!=N-1){
				b=white[z]+black[z+1];
			}
			if(b<min)
				min=b;
			z++;
		}
		if(N==1)
			min=0;
		if(N==2&&S.equals(".#"))
			min=0;
		System.out.println(min);
	}
}

Measured memory_bytes: 32060
#include <iostream>
#include <string>

using namespace std;

int N, A, B, total;
string S;

int main() {
	cin >> N >> A >> B >> S;
	for(char c : S) {
		switch(c) {
		case 'a':
			if(A+B > 0) {
				cout << "Yes" << endl;
				if(A>0) A--;
				else B--;
			} else
				cout << "No" << endl;
			break;
		case 'b':
			if(B > 0) {
				cout << "Yes" << endl;
				B--;
			} else
				cout << "No" << endl;
			break;
		case 'c':
			cout << "No" << endl;
			break;
		}
	}
    return 0;
}

Measured memory_bytes: 896
#include <bits/stdc++.h>
#define ll long long
#define us unsigned short int
#define fin freopen("/home/imtiaz/Desktop/in.txt", "r", stdin)
#define fout freopen("/home/imtiaz/Desktop/out.txt","w", stdout)
#define dbg(x) cerr << #x << ": " << x << endl
#define fastio ios::sync_with_stdio (false); cin.tie (0);
using namespace std;


int main(){
    ll a;
    cin>>a;
    ll res=a+a*a+a*a*a;
    cout<<res<<endl;
    return 0;
}

Measured memory_bytes: 3628
#include<bits/stdc++.h>
using namespace std;
#define rep0(i,n) for(i=0;i<n;i++)
#define test(a) cout << "*" << a << endl
int main(){
  int a,b;
  int kAns;
  int k=0;
  int i;
  int aBig,aSmall;
  int maxYakusuu;
  
  cin >> a >> b >> kAns;

    aBig = max(a,b);
    aSmall = min(a,b);
 
  for(i=aSmall;i>0;i--){
    if(aBig%i==0 && aSmall%i==0){
      maxYakusuu = i;
      break;/*ちゅうい*/
    }
  }
  //test(maxYakusuu);
  for(i=maxYakusuu;i>0;i--){
    if(maxYakusuu%i==0)
      k++;
    if(k==kAns){
      cout << i << endl;
      break;
    }
  }

}

Measured memory_bytes: 256
A=[0]*5
A[0]=int(input())
A[1]=int(input())
A[2]=int(input())
A[3]=int(input())
A[4]=int(input())
hikubun=0
for i in range(5):
    hikubun=max(-A[i]%10,hikubun)
    A[i]=(A[i]//10+(A[i]%10!=0))*10
    
ans=sum(A)-hikubun
print(ans)
   

Measured memory_bytes: 38384
//In His Name
#include<bits/stdc++.h>
using namespace std;
vector<pair<int,int> >e;
vector<int>adj[100100],c[100100];
int n,m,minlvl[100100],lvl[100100],par[100100],t[100100];
bool mark[100100];
void dfs(int x,int p){
    mark[x]=true;
    minlvl[x]=lvl[x];
    par[x]=p;
    for(int i=0;i<adj[x].size();i++){
        int v=adj[x][i];
        if(!mark[v]){
            lvl[v]=lvl[x]+1;
            dfs(v,x);
            minlvl[x]=min(minlvl[x],minlvl[v]);
            t[x]++;
            c[x].push_back(v);
        }
        else if(v!=p) minlvl[x]=min(minlvl[x],lvl[v]);
    }
}
int main(){
    ios_base::sync_with_stdio(0);
    cin>>n>>m;
    for(int i=0;i<m;i++){
        int x,y;
        cin>>x>>y;
        if(x>y) swap(x,y);
        adj[x].push_back(y);
        adj[y].push_back(x);
        e.push_back(make_pair(x,y));
    }
    for(int i=0;i<n;i++)
        if(!mark[i]) dfs(i,i);
    for(int i=0;i<n;i++){
        bool f=true;
        for(int j=0;j<c[i].size();j++){
            int x=c[i][j];
            if(x==par[i]||adj[i].size()==1) continue;
            if(minlvl[x]>=lvl[i]&&!(par[i]==i&&t[i]==1))f=false;
            if(t[i]>1&&i==par[i]&&minlvl[x]>=lvl[i]) f=false;
            if(i!=par[i]&&t[i]!=0&&minlvl[x]>=lvl[i]) f=false;
        }
        if(!f) cout<<i<<endl;
    }
    return -0;
}

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

int main() {
  string a, b, c;
  int n;
  cin >> n >> a >> b >> c;
  int ans = 0;
  for(int i = 0; i < n; i++) {
  	int var;
    if(a[i] == b[i] && b[i] == c[i]) {
      var = 0;
    } else if (a[i] == b[i] || b[i] == c[i] || a[i] == c[i]) {
      var = 1;
    } else {
      var = 2;
    }
    ans += var;
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
using namespace std;
int main(){
long i,j,k,n;
string s="that",t="this",ss;
cin>>n;getline(cin,ss);
for(;n>0;n--){
getline(cin,ss);
for(i=1;i<26;i+=2){
if(i==13)continue;
for(j=0;j<26;j++){
t[0]=t[3]=s[0]=(i*19+j)%26+97;
t[1]=s[1]=(i*7+j)%26+97;
t[2]=(i*0+j)%26+97;
s[2]=(i*8+j)%26+97;
s[3]=(i*18+j)%26+97;
if(ss.find(t)!=string::npos)goto L1;
if(ss.find(s)!=string::npos)goto L1;
}
}
L1:
if(i==3)i=9;
else if(i==5)i=21;
else if(i==7)i=15;
else if(i==9)i=3;
else if(i==11)i=19;
else if(i==15)i=7;
else if(i==17)i=23;
else if(i==19)i=11;
else if(i==21)i=5;
else if(i==23)i=17;
for(k=0;k<ss.size();k++)
if(96<ss[k]&&ss[k]<123)ss[k]=(i*(ss[k]-97+26-j))%26+97;
cout<<ss<<endl;
}
return 0;
}

Measured memory_bytes: 1216
import java.util.*;
import java.util.regex.*;

import static java.lang.Math.*;
import static java.lang.System.out;

// AOJ
public class Main {
	private static final Scanner sc=new Scanner(System.in);
	public static void main(String[] args) {
		new Main().AOJ0021();
	}
	
	void AOJ0021(){
		int N=sc.nextInt();
		for(int I=1; I<=N; I++){
			double[] x=new double[4], y=new double[4];
			for(int i=0; i<4; i++){
				x[i]=sc.nextDouble();
				y[i]=sc.nextDouble();
			}
			if((y[0]-y[1])/(x[0]-x[1]) == (y[2]-y[3])/(x[2]-x[3]))	out.println("YES");
			else	out.println("NO");
		}
	}
	
	void AOJ0145(){
		int n=sc.nextInt();
		
	}
	
	void AOJ0141(){
		int N=sc.nextInt();
		for(int I=1; I<=N; I++){
			int n=sc.nextInt();
			char[][] c=new char[n+4][n+4];
			int[] vx={0, 1, 0, -1};
			int[] vy={-1, 0, 1, 0};
			c=solve141(2, n+1, n, c, vx, vy);
			for(int j=2; j<=n+1; j++){
				for(int i=2; i<=n+1; i++)	out.print(c[i][j]);
				out.println();
			}
			out.println();
		}
	}
	char[][] solve141(int x, int y, int n, char[][] c, int[] vx, int[] vy){
		//範囲を超えていないか
		if(x<2&&x>n+1 && y<2&&y>n+1)	return c;
		//周りが#
		//return c;
		
		c[x][y]='#';
		
		// 1周目
		if(x==2){
			if(y!=2)	solve141(x, y-1, n, c, vx, vy);
			else	solve141(x+1, y, n, c, vx, vy);
		}
		if(y==2){
			if(x!=n+1)	solve141(x+1, y, n, c, vx, vy);
			else	solve141(x, y+1, n, c, vx, vy);
		}
		if(x==n+1){
			if(y!=2)	solve141(x, y+1,n,c,vx,vy);
			else	solve141(x-1, y,n,c,vx,vy);
		}
		if(y==n+1){
			if(x!=3)	solve141(x-1,y,n,c,vx,vy);
			else	solve141(x,y-1,n,c,vx,vy);
		}
		
		// それ以降
		for(int i=0; i<4; i++){
			if(c[x+vx[i]][y+vy[i]]!='#'){
				solve141(x+vx[i], y+vy[i],n,c,vx,vy);
			}
		}

		return c;
	}
	
	
	void AOJ0139(){
		int N=sc.nextInt();
		final Pattern ap=Pattern.compile("^>'(=+)#(=+)~$");
		for(int i=1; i<=N; i++){
			String s=sc.next();
			Matcher m=ap.matcher(s);
			if(m.matches()){
				if(m.group(1).length()==m.group(2).length()){
					out.println("A");
					continue;
				}
			}else if(Pattern.compile("^>\\^(Q=)+~~$").matcher(s).matches()){
				out.println("B");
				continue;
			}
			out.println("NA");
		}
	}
	
	void AOJ0137(){
		int N=sc.nextInt();
		for(int i=1; i<=N; i++){
			long s=sc.nextLong();
			out.println("Case "+i+":");
			for(int j=0; j<10; j++){
				s*=s;	s/=100;	s%=10000;
				out.println(s);
			}
		}
	}
	
	ArrayList<Integer> Sieve2(int N){
	    ArrayList<Integer> prime = new ArrayList<Integer>();
	    boolean[] list = new boolean[N+1];
	    Arrays.fill(list, true);
	    list[1]=false;
	    for (int i=2; i<=N; i++) {
	        if(list[i]) {
	            prime.add(i);
	            for (int j=i+i; j<=N; j+=i)    list[j] = false;
	        }
	    }
	    return prime;
	}

	boolean[] Sieve(int N){
	    boolean[] list = new boolean[N+1];
	    Arrays.fill(list, true);
	    list[1]=false;
	    for(int i=2; i<=N; i++) {
	        if(list[i]) {
	            for (int j=i+i; j<=N; j+=i)     list[j] = false;
	        }
	    }
	    return list;
	}
	
	boolean isPrime(int n){
	    for(int i=2; i*i<=n; i++){
	        if(n%i==0)     return false;
	    }
	    return true;
	}
	
	int gcd(int x, int y){
		if(y==0)	return x;
		else	return gcd(y, x%y);
	}
}

Measured memory_bytes: 12000
use proconio::{fastout, input};

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

    let mut x = 1;

    for _ in 0..n {
        if x < k {
            x *= 2;
        } else {
            x += k;
        }
    }

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


Measured memory_bytes: 2164
#include <bits/stdc++.h>
using namespace std;
using ll = int64_t;
#define rep(i, n) for (int i = 0; i < ((int)(n)); i++) // 0-indexed昇順

int main()
{
    string A, B, C;
    cin >> A >> B >> C;
    cout << "A" << B[0] << "C" << endl;
}

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

int main(){
  int h,w,count;
  char a,d='.',b='#';
  cin >> h >> w;
  string s,z,y ;

      for (int i_1 = 0; i_1 < h; i_1 ++ ){
        cin >> s;
        for (int i_2 = 0; i_2 < w; i_2 ++) z += s.at(i_2);
      }//zは横一列にした文字列

  for (int i_3 = 0; i_3 < h*w; i_3 ++){
    count = 0;

    if(w ==1){
      //if((i_3 -w-1)>=0 && z.at(i_3 -w-1) == b )count ++;
      if((i_3 -w)>=0 && z.at(i_3 -w) == b) count ++;
      //if((i_3 -w+1)>=0 && z.at(i_3 -w+1) == b) count ++;
      //if((i_3 -1)>=0 && z.at(i_3 -1) == b) count ++;
      //if(((i_3 +1)%w)<h*w && z.at(i_3 +1) == b) count ++;
      //if((i_3 +w-1)<h*w && z.at(i_3 +w-1) == b) count ++;
      if((i_3 +w)<h*w && z.at(i_3 +w) == b) count ++;
      //if((i_3 +w+1)<h*w && z.at(i_3 +w+1) == b) count ++;
    }


    else if((i_3+1)%w == 1){
      //if((i_3 -w-1)>=0 && z.at(i_3 -w-1) == b )count ++;
      if((i_3 -w)>=0 && z.at(i_3 -w) == b) count ++;
      if((i_3 -w+1)>=0 && z.at(i_3 -w+1) == b) count ++;
      //if((i_3 -1)>=0 && z.at(i_3 -1) == b) count ++;
      if(((i_3 +1)%w)<h*w && z.at(i_3 +1) == b) count ++;
      //if((i_3 +w-1)<h*w && z.at(i_3 +w-1) == b) count ++;
      if((i_3 +w)<h*w && z.at(i_3 +w) == b) count ++;
      if((i_3 +w+1)<h*w && z.at(i_3 +w+1) == b) count ++;
    }

    else if((i_3+1)%w ==0){
      if((i_3 -w-1)>=0 && z.at(i_3 -w-1) == b )count ++;
      if((i_3 -w)>=0 && z.at(i_3 -w) == b) count ++;
      //if((i_3 -w+1)>=0 && z.at(i_3 -w+1) == b) count ++;
      if((i_3 -1)>=0 && z.at(i_3 -1) == b) count ++;
      //if(((i_3 +1)%w)<h*w && z.at(i_3 +1) == b) count ++;
      if((i_3 +w-1)<h*w && z.at(i_3 +w-1) == b) count ++;
      if((i_3 +w)<h*w && z.at(i_3 +w) == b) count ++;
      //if((i_3 +w+1)<h*w && z.at(i_3 +w+1) == b) count ++;
    }
    else{
      if((i_3 -w-1)>=0 && z.at(i_3 -w-1) == b )count ++;
      if((i_3 -w)>=0 && z.at(i_3 -w) == b) count ++;
      if((i_3 -w+1)>=0 && z.at(i_3 -w+1) == b) count ++;
      if((i_3 -1)>=0 && z.at(i_3 -1) == b) count ++;
      if(((i_3 +1)%w)<h*w && z.at(i_3 +1) == b) count ++;
      if((i_3 +w-1)<h*w && z.at(i_3 +w-1) == b) count ++;
      if((i_3 +w)<h*w && z.at(i_3 +w) == b) count ++;
      if((i_3 +w+1)<h*w && z.at(i_3 +w+1) == b) count ++;
    }

    if(z.at(i_3)==d)cout<<count;
    else cout << z.at(i_3);

    if ((i_3 +1) % w ==0)cout << endl;

  }

}


Measured memory_bytes: 256
#include <algorithm>
#include <cstring>
#include <iostream>
#include <vector>
#include <cmath>
#include <math.h>
#include <stdio.h>
#include <iomanip>
#include <stack>
#include <queue>

using namespace std;

typedef long long int ll; 
typedef pair<int,int> Pii;
typedef pair<ll,ll> Pll;

void floatOutPutSetup(){
    cout << fixed;
    cout << setprecision(10);
}

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

    for (int i = 0; i < n; i++)
    {
        cin>>tmp;
        if(tmp%2==0){
            if(tmp%3==0||tmp%5==0){
                
            }else
            {
            goto NO;
            }
            
        }
    }

    cout<<"APPROVED";
    goto END;
    NO:
    cout<<"DENIED";

    END:
    return 0;
}

Measured memory_bytes: 256
import math
import copy
import sys
import fractions
import numpy as np
from functools import reduce
import statistics


# ===FUNCTION===

def getInputInt():
    inputNum = int(input())
    return inputNum


def getInputListInt():
    outputoData = []
    inputData = input().split()
    outputData = [int(n) for n in inputData]

    return outputData


def getSomeInputInt(n):
    outputDataList = []
    for i in range(n):
        inputData = int(input())
        outputDataList.append(inputData)

    return outputDataList


def getSomeInputListInt(n):
    inputDataList = []
    outputDataList = []
    for i in range(n):
        inputData = input().split()
        inputDataList = [int(n) for n in inputData]
        outputDataList.append(inputDataList)

    return outputDataList


# ===CODE===

def getInputStr():
    inputNum = str(input())
    return inputNum

n = getInputInt()

s = getInputStr()

tmplist = list(s)
listA = tmplist[0: int(len(s)/2)]
listB = tmplist[int(len(s)/2) : len(s)]

if listA == listB:
    print("Yes")
else:
    print("No")


Measured memory_bytes: 22464
import Control.Monad
import Data.Maybe
import qualified Data.ByteString.Char8 as BS
import Data.List

readInt = fst . fromJust . BS.readInt
readIntList = map readInt . BS.words
getInt = readInt <$> BS.getLine
getIntList = readIntList <$> BS.getLine

main = do
    [r,g,b,n] <- getIntList
    print $ length [()| r' <- [0..(n `div` r)], g' <- [0..((n-r*r') `div` g)], (n - r*r' - g*g') `mod` b == 0]

Measured memory_bytes: 508
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int n,a[100];
	cin>>n;
	cin>>a[0];
	for(int i=1;i<n;i++){
		cin>>a[i];
	}
	int minn=1e9;
	for(int i=1;i<=100;i++){
		int cost=0;
		for(int j=0;j<n;j++){
			cost=cost+(a[j]-i)*(a[j]-i);
		}
       if(cost<minn) minn=cost;
	}
	cout<<minn;
	return 0;
} 

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int n;
 	int sum=0;
	scanf("%d",&n);
	while(n--)
	{
		int num;
		scanf("%d",&num);
		sum+=(num-1);
	}
	printf("%d\n",sum);
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
ll f(ll b,ll n)
{
    if(n>=b)
    {
        return f(b,(n/b))+(n%b);
    }
    return n;
}
int main()
{
    ll n,s;
    cin>>n>>s;
    if(n==s)
    {
        cout<<(n+1)<<endl;
        return 0;
    }
    else if(n<s)
    {
        cout<<-1<<endl;
        return 0;
    }
    ll MinAns=INT_MAX;
    for(ll i=2;i*i<=n;i++)
    {
        if(f(i,n)==s)
        {
            cout<<i<<endl;
            return 0;
        }
    }
    for(ll j=sqrt(n);j>=1;j--)
    {
        if((n-s)%j==0)
        {
            ll i=((n-s)/j)+1;
            if(f(i,n)==s)
            {
                //MinAns=min(MinAns,i);
                cout<<i<<endl;
                return 0;
            }
        }
    }
    cout<<-1<<endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vin=vector<int>;
using vll=vector<long long>;
using vvin=vector<vector<int>>;
using vvll=vector<vector<long long>>;
using vstr=vector<string>;
using vvstr=vector<vector<string>>;
using vch=vector<char>;
using vvch=vector<vector<char>>;
using vbo=vector<bool>;
using vvbo=vector<vector<bool>>;
using vpii=vector<pair<int,int>>;
using pqsin=priority_queue<int,vector<int>,greater<int>>;
#define mp make_pair
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep2(i,s,n) for(int i=(s);i<(int)(n);i++)
#define all(v) v.begin(),v.end()
#define decp(n) cout<<fixed<<setprecision((int)n)
const ll inf=1e9+7;
const ll INF=1e18;

int main(){
    ll n;cin>>n;
    if(n%2)cout<<0<<endl;
    else{
        n/=2;
        ll ans=(ll)0;
        ll c=5;
        while(c<=n){
            ans+=n/c;
            c*=5;
        }
        cout<<ans<<endl;
    }
}

Measured memory_bytes: 3580
#include <bits/stdc++.h>
using namespace std;
string str;int a,b;
int main(){
	cin>>str;
	for(int i=0;i<str.length();i++)	if(str[i]-'0'== i%2 )   a++;
	for(int i=0;i<str.length();i++)	if(str[i]-'0'!= i%2 )   b++;
	cout<<min(a,b);
}

Measured memory_bytes: 512
a = [1,3,5,7,8,10,12]
b = [4,6,9,11]
c = [2]

x,y = map(int,input().split())
if x in a and y in a:
	print("Yes")
elif x in b and y in b:
	print("Yes")
elif x in c and y in c:
	print("Yes")
else:
	print("No")

Measured memory_bytes: 9096
import collections

n = int(input())
polls = [input() for i in range(n)]

c = collections.Counter(polls)
maxval = c.most_common()[0][1]

values, counts = zip(*c.most_common())

ans = []

for i in c.most_common():
    if i[1] == maxval:
        ans.append(i[0])
    else:
        break

ans.sort()

for i in ans:
    print(i)

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

int main(){
    int N ;
    cin >> N ;
    vector<int> A(N),B(N),C(N);
    rep(i,N) cin >> A[i];
    rep(i,N) cin >> B[i];
    rep(i,N) cin >> C[i];
    sort(A.begin(),A.end());
    sort(B.begin(),B.end());
    sort(C.begin(),C.end());
    vector<long long> num(N,0);
    for(int i= 0;i<N;i++){
        long long now_number = B[i];
        int l = -1 ;
        int r = N ;
        while(r - l > 1){
            int m = (l + r)/ 2; 
            if(now_number >= C[m]) l = m ;
            else r = m ; 
        }
        if(i == 0) num[i]  = N - (l + 1) ;
        else num[i] = num[i - 1] + (N - l - 1);
    }
    //rep(i,N) cout << num[i] << " ";
    long long ans = 0 ;
    for(int i=0;i<N;i++){
        long long now = A[i];
        int l = -1 ;
        int r = N ;
        while(r - l > 1 ){
            int m = (l + r) / 2 ;
            if(now >= B[m]) l = m ;
            else r = m ;
        }
        if (l == -1) ans += num[N-1];
        else ans += (num[N-1] - num[l]);
    }
    cout << ans  << "\n";

}

Measured memory_bytes: 2176
let () =
  Scanf.scanf "%d\n" @@ fun n ->
  let xrr = Array.init n @@ fun _ -> Scanf.scanf "%d " @@ fun d -> d in
  let p = (Array.fold_left (+) 0 xrr) / n in
  Printf.printf "%d\n" (min 
    (Array.fold_left (fun sum x -> sum + (x-p) * (x-p)) 0 xrr) 
    (Array.fold_left (fun sum x -> sum + (x-p-1) * (x-p-1)) 0 xrr))

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

const int N = 320;

int f[N][N], g[N][N], n, m, mod, C[N][N];

int main() {
  scanf("%d%d%d", &n, &m, &mod);
  for (int i = 0; i < N; i ++) {
    C[i][0] = 1;
    for (int j = 1; j <= i; j ++)
      C[i][j] = (C[i - 1][j - 1] + C[i - 1][j]) % mod;
  }
  for (int i = 0; i <= m; i ++)
    f[1][i] = 1, g[1][i] = m - i + 1;
  for (int i = 2; i <= n + 1; i ++) {
    for (int k = 0; k <= m; k ++) {
      long long tot = 0;
      for (int j = 1; j < i; j ++)
        tot += 1ll * f[i - j][k] * g[j][k + 1] % mod * C[i - 2][j - 1] % mod;
      f[i][k] = tot % mod;
    }
    for (int k = m; k >= 0; k --)
      g[i][k] = (g[i][k + 1] + f[i][k]) % mod;
  }
  printf("%d\n", f[n + 1][0]);
  return 0;
}

Measured memory_bytes: 1408
//为郝尚诚写亦！！
//勿hack余，否则君必悔之！！若如此，请寄言，吾望得！！下为正文：
#include <iostream>
#include <iomanip>
#include <sstream>
#include <algorithm>
#include <string>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <cctype>
#include <cstdlib>
#include <cstring>
#include <climits>
using namespace std;
#define rep(i,n) for (int i=0;i<(n);i++)
#define all(a) (a).begin(),(a).end()
#define reunique(v) v.erase(unique(all(v)),v.end())
#define RET(p,x) return p<<x<<endl,0;
#define Debug(x) cerr<<#x<<" = "<<x<<endl
typedef long long ll;
typedef unsigned long long ull;
ull rdtsc(){ull ret=0;asm volatile("rdtsc" : "=A" (ret) : :);return ret;}
const int inf=1e9;
const ll infl=1e18;
int n,a,b;
signed main()
{
	rdtsc();
	ios_base::sync_with_stdio(0);cin.tie();cout.tie();
	cout<<setprecision(10);
	cin>>n>>a>>b;
	int x=abs(a-b);
	if (x&1) cout<<"Borys";
	else cout<<"Alice";
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long
#define mp make_pair
#define F first
#define S second
#define db double
#define pb push_back
#define rep(i,a,b)  for(ll i=a;i<=b;i++)
#define all(a) a.begin(),a.end()
using namespace std;
 
 ll mod=1e9 +7;
 
ll expo(ll base,ll exponent,ll mod){
    ll ans=1;
    while(exponent!=0){
        if(exponent&1) ans=(1LL*ans*base)%mod;
        base=(1LL*base*base)%mod;
        exponent>>=1;
    }
    return ans%mod;
}
 
vector<bool>  prime(90000002,true);
void Sieve() 
{ 
   
    for (int p=2; p*p<=90000001; p++) 
    { 
        // If prime[p] is not changed, then it is a prime 
        if (prime[p] == true) 
        { 
            for (int i=p*p; i<=90000001; i += p) 
                prime[i] = false; 
        } 
    } 
}

const ll M=200006;
ll f[M],inv[M];

void compute(){
    f[0]=1;
    rep(i,1,M-1){
        f[i]=(1LL*i*f[i-1])%mod;
    }
    inv[M-1]=expo(f[M-1],mod-2,mod);
    for(ll i=M-2;i>=0;i--){
        inv[i]=(1LL*(i+1)*inv[i+1])%mod;
    }
}
ll C(ll n,ll r){
    return (1LL*((1LL*f[n]*inv[r])%mod)*inv[n-r])%mod;
}

ll n,m;
vector<ll> graph[100005];
ll ans[100005]={0};
ll vis[100005]={0};
ll dis[100005];
void bfs()
{
  queue<pair<ll,ll>>q;
  q.push({1LL,0LL});
  vis[1]=1;
  dis[1]=0;
  while(!q.empty())
  {
    pair<ll,ll>p=q.front();
    q.pop();
    for(auto x:graph[p.first])
    {
      if(vis[x]==0)
      {
      vis[x]=1;
      dis[x]=p.second+1;
      q.push({x,p.second+1LL});
      }
    }
  }
}


int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    // compute();
    // Sieve();
    ll tests=1;
    // cin>>tests;
    while(tests--)
    {
      ll i,j;
      cin>>n>>m;
      rep(i,0,m-1)
      {
        ll a,b;
        cin>>a>>b;
        graph[a].pb(b);
        graph[b].pb(a);
      }
      for(i=0;i<=n;i++) {vis[i]=0;dis[i]=500000;}
      // dfs(1,-1,0);
        bfs();
      bool flag=true;
      for(i=1;i<=n;i++)
      {
        if(vis[i]==0) {flag=false;break;}
      }
      if(!flag) {cout<<"No";return 0;}

      for(i=2;i<=n;i++)
      {
        for(auto x:graph[i])
        {
          if(dis[x]<dis[ans[i]]) ans[i]=x;
        }
      }
      cout<<"Yes"<<"\n";
      for(i=2;i<=n;i++) cout<<ans[i]<<"\n";
      
    }
    return 0;
   }

Measured memory_bytes: 25728
#include <iostream>
#include <vector>
#include <algorithm>
#include <functional>
#include <string>
#include <cmath>
#include <map>
#include <tuple>
#include <queue>

#define MOD (1000000007)
using namespace std;

typedef long long ll;

typedef tuple<ll, ll> tup; // mp, tairyoku

bool check(char c) {
    return c == 'A' || c == 'C' || c == 'G' || c =='T';
}

int main() {
    string S;
    cin >> S;

    int c_max = 0;
    int c_value = 0;
    for(int i = 0; i < S.length(); i++) {
        if(check(S[i])){
            c_value++;
        } else {
            c_value = 0;
        }
        c_max = max(c_max, c_value);
    }

    cout << c_max << endl;

    return 0;
}

Measured memory_bytes: 256
# 初めが白か黒か

S = list(input())
N = len(S)
ans0 = 0
ans1 = 0
# 0 偶数
for i in range(N):
    if i % 2 == 0:
        if S[i] == '0':
            pass
        else:
            ans0 += 1
    else:
        if S[i] == '1':
            pass
        else:
            ans0 += 1


for i in range(N):
    if i % 2 == 1:
        if S[i] == '0':
            pass
        else:
            ans1 += 1
    else:
        if S[i] == '1':
            pass
        else:
            ans1 += 1

print(min(ans0, ans1))


Measured memory_bytes: 3956