akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <cstdio>
#include <cstring>
#include <vector>
#include <queue>
#include <array>
#include <set>
#include <map>
#include <cmath>
#include <algorithm>
#include <numeric>
#include <cassert>
#include <utility>
#include <functional>

using namespace std;
using lli = long long int;
template<class T, class U> void init_n(vector<T>& v, size_t n, U x) 
{ v = vector<T>(n, x); }
template<class T> void init_n(vector<T>& v, size_t n) { init_n(v, n, T()); }
template<class T> void read_n(vector<T>& v, size_t n, size_t o = 0) 
{ v = vector<T>(n+o); for (lli i=o; i<n+o; ++i) cin >> v[i]; }
template<class T> void read_n(T a[], size_t n, size_t o = 0)
{ for (lli i=o; i<n+o; ++i) cin >> a[i]; }
template<class T> T gabs(const T& x) { return max(x, -x); }
#define abs gabs

/*
int memo[1000][1000];
bool rec(lli x, lli y) {
  if (memo[x][y]) return memo[x][y] - 1;
  if (x == 0 && y == 0) return false;
  bool res = false;
  for (lli i=2; i<=x; i+=2) {
    res = res || !rec(x-i, y+i/2);
  }
  for (lli i=2; i<=y; i+=2) {
    res = res || !rec(x+i/2, y-i);
  }
  memo[x][y] = int(res) + 1;
  return res;
}

lli x, y;
int main() {
  cin >> x >> y;
  rec(x, y);
  cout << boolalpha;
  for (lli i=0; i<=x; ++i) {
    for (lli j=0; j<=y; ++j) {
      cout << i << ',' << j << '\t' << rec(i, j) << endl;
    }
  }
  return 0;
}
*/

int main() {
  lli x, y; cin >> x >> y;
  lli d = x - y;
  if (-1 <= d && d <= 1) cout << "Brown\n";
  else cout << "Alice\n";
  return 0;
}



Measured memory_bytes: 256
S = input().strip()
mod = 10**9 + 7
d = [i*10%13 for i in range(13)]
dp = [[0]*13 for _ in range(len(S)+1)]
dp[0][0] = 1
for i, c in enumerate(S, 1):
    if c != '?':
        c = int(c)
        for j in range(13):
            dp[i][(d[j] + c) % 13] = dp[i-1][j]
    else:
        for c in range(10):
            for j in range(13):
                k = (d[j] + c) % 13
                dp[i][k] += dp[i-1][j]
        for j in range(13):
            dp[i][j] %= mod
print(dp[-1][5])

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

int main(){
    int n;
    cin>>n;
    int ans=0;
    int a[20],b[20],c[20];
    rep(i,n){
        cin>>a[i];
        a[i]--;
    }
    rep(i,n) cin>>b[i];
    rep(i,n-1) cin>>c[i];
    rep(i,n){
        ans+=b[a[i]];
        if(i!=n-1&&a[i]+1==a[i+1]){
            ans+=c[a[i]];
        }
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 3524
//include==============================================================================
  #define _GLIBCXX_DEBUG
  using namespace std;

  #include<iostream>
  #include<string>
  #include<vector>
  #include<algorithm>
  #include<cmath>//"M_PI"→円周率(小数点以下5桁)
  #include<iomanip>//fixed<<setprecision(15)<<
  #include<functional>
  #include<deque>



//略記=================================================================================
  //文字・定数
  #define EE "\n"
  #define BB " "
  #define PI 3.141592653589793
  #define fi first
  #define se second

  //変数
  typedef long long ll;
  typedef vector<ll> vl;
  typedef vector<vl> vl2;
  typedef vector<vl2> vl3;
  typedef vector<char> Vc;
  typedef vector<Vc> Vc2;
  typedef vector<Vc2> Vc3;
  typedef vector<string> Vs;
  typedef vector<Vs> Vs2;
  typedef vector<Vs2> Vs3;



//関数=================================================================================
#define REP(i,n) for(int i=0;i<(n);i++)
#define dREP(i,j,a,b) for(int i=0;i<a;i++)for(int j=0;j<b;j++)//総当たり
#define tREP(i,j,k,a,b,c) for(int i=0;i<a;i++)for(int j=0;j<b;j++)for(int k=0;k<c;k++)
#define xREP(i,x,n) for(int i=x;i<=(n);i++)//等号に注意
#define rev(a) reverse(a.begin(),a.end())
#define sor(a) sort(a.begin(),a.end())//vectorは要素数を明確に
#define sta_sor(a) stable_sort(a.begin(),a.end())//安定している
#define res(a,x) a.resize(x)
#define psbk(s,x) s.push_back(x)//付加
#define psfr(s,x) s.push_front(x)//付加
#define ppbk(s,x) s.pop_back(x)//削除
#define ppfr(s,x) s.pop_front(x)//削除



//解答=================================================================================
int main(){
  int a;cin>>a;
  cout<<a+a*a+a*a*a<<EE;
}

Measured memory_bytes: 3552
using System;
using System.Linq;
using System.Collections.Generic;

namespace ABC
{
    class ProgramC
    {
        static void Main(string[] args)
        {

            var inputs = Console.ReadLine().ToCharArray().Select(x => int.Parse(x.ToString())).ToArray();
            var a = (inputs[0]);
            var b = (inputs[1]);
            var c = (inputs[2]);
            var d = (inputs[3]);

            for (var i = 0; i < 2; i++)
            {
                for (var j = 0; j < 2; j++)
                {
                    for (var k = 0; k < 2; k++)
                    {
                        var r1 = i == 0 ? a + b : a - b;
                        var r2 = j == 0 ? r1 + c : r1 - c;
                        var r3 = k == 0 ? r2 + d : r2 - d;
                        if (r3 == 7)
                        {
                            Console.WriteLine(string.Format("{0}{1}{2}{3}{4}{5}{6}=7", a, getString(i), b, getString(j), c, getString(k), d));
                            return;
                        }
                    }
                }
            }
        }

        static string getString(int n)
        {
            return n == 0 ? "+" : "-";
        }
    }
}


Measured memory_bytes: 28292
#include<stdio.h>
int main(){
	int a,b,c,d,A,B,C,D,E,F,i,j,k,l,fz=0,fm=0,x=1,y=1;
	scanf("%d%d%d%d%d%d",&A,&B,&C,&D,&E,&F);
	for(i=0;i<=F/(100*A);i++){
		a=i*100*A;
		if(a>F) break;
		for(j=0;j<=F/(100*B);j++){
			b=j*100*B;
			if(a+b>F) break;
			for(k=0;k<F/C;k++){
				c=k*C;
				if(a+b+c>F) break;
				for(l=0;l<F/D;l++){
					d=l*D;
					if((a+b+c+d)>F||(c+d)>(a+b)/100*E) break;
					fz=(c+d);
					fm=(a+b);
					if(x*(fm+fz)<=fz*(y+x)) {x=fz;y=fm;}
					
				}
			}
		}
	}
	printf("%d %d",x+y,x);
	return 0;
}

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

using namespace std;



int main(int argc, char* argv[])
{
  ios::sync_with_stdio(false);
  cin.tie(nullptr);

  int N;
  cin >> N;

  struct info { int x; int y; int h; };
  vector<info> data(N);

  for (auto& i : data)
  {
    cin >> i.x >> i.y >> i.h;
  }

  int Cx = 0;
  int Cy = 0;
  int H = [&]()
  {
    for (Cx = 0; Cx <= 100; ++Cx)
    {
      for (Cy = 0; Cy <= 100; ++Cy)
      {
        int curH = 0;
        int maxH = 2e9;

        for (int i = 0; i < N; ++i)
        {
          // data[i].h = max(H - abs(data[i].x - Cx) - abs(data[i].y - Cy), 0)
          if (data[i].h == 0)
          {
            maxH = min(maxH, abs(data[i].x - Cx) + abs(data[i].y - Cy));
          }
          else
          {
            int hh = data[i].h + abs(data[i].x - Cx) + abs(data[i].y - Cy);
            if (!curH) curH = hh;
            if (hh != curH) { curH = 0; break; }
          }
        }
        if (curH && curH <= maxH) return curH;
      }
    }
    return 0;
  }();

  cout << Cx << " " << Cy << " " << H <<  "\n";

  return 0;
}


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

int main(){
  int a[3];
  cin >> a[0] >> a[1] >> a[2];
  
  int ans=0;
  sort(a, a+3);
  
  if(a[0]==a[2]){
    ans=1;
  }else if(a[0]==a[1]||a[1]==a[2]){
    ans=2;
  }else{
    ans=3;
  }
  
  cout << ans <<endl;
  
  return 0;
  
}

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

int main(){

    int N;
    cin >> N;
    vector<int> A(N);
    for(int i = 0; i < N; i++) cin >> A[i];

    long long sum = abs(A.front()) + abs(A.back());
    for(int i = 1; i < N; i++) sum += abs(A[i] - A[i - 1]);

    cout << sum - (abs(A[0]) + abs(A[1] - A[0])) + abs(A[1]) << endl;
    for(int i = 1; i < N - 1; i++){
        cout << sum - (abs(A[i] - A[i - 1]) + abs(A[i + 1] - A[i])) + abs(A[i + 1] - A[i - 1]) << endl;
    }
    cout << sum - (abs(A[N - 2] - A[N - 1]) + abs(A[N - 1])) + abs(A[N - 2]) << endl;

    return 0;
}

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

int main()
{
  string s;
  int n, ans = 0, l, r;
  bool flag = 1;
  ;
  cin >> s;
  while (flag and s.size() != 0)
  {
    flag = 0;
    n = s.size();
    for (int i = 0; i < n-1; i++)
    {
      if (s[i] != s[i + 1])
      {
        l = i;
        r = i + 1;
        flag = 1;
        while (l >= 0 and r < n and s[l] != s[r]) {
          ans += 2;
          l--;
          r++;
      	}
        s = s.substr(0, (l+1)) + s.substr(r, n);
		break;
      }
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 756
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int,int>;
 
int main(){
	int h, w;
    cin >> h >> w;
    vector<string> map(h);
    vector<vector<int>> itta(h, vector<int>(w));
    vector<vector<int>> hou(4, vector<int>(2));
    vector<vector<int>> mi(0, vector<int>(4));
    hou = {{0,1},{-1,0},{0,-1},{1,0}};
    rep(i, h) cin >> map.at(i);
    int x0, y0, x1, y1;
    int cou = 0;
    int max = 0;
    int zx = 0;
    int zy = 0;
    for(int i=0; i<h*w-1; i++){
      for(int j=i+1; j<h*w; j++){
        y0 = i/w;
        x0 = i%w;
        y1 = j/w;
        x1 = j%w;
        if(!(map.at(y0).at(x0) == '#' || map.at(y1).at(x1) == '#')) mi.push_back({x0,y0,x1,y1});
      }
    }
    int y0m = -1;
    int x0m = -1;
    for(int i=mi.size()-1; i>=0; i--){
        y0m = y0;
        x0m = x0;
        y0 = mi.at(i).at(1);
        x0 = mi.at(i).at(0);
        y1 = mi.at(i).at(3);
        x1 = mi.at(i).at(2);
        if(y0m != y0 || x0m != x0){
          rep(i0, h){
            rep(j0, w){
              itta.at(i0).at(j0) = 0;
            }
          }
        }
        if(itta.at(y1).at(x1) != 0) continue;
        rep(i0, h){
          rep(j0, w){
            itta.at(i0).at(j0) = 0;
          }
        }
        itta.at(y0).at(x0) = 1;
        cou = 1;
        int f = 0;
        while(itta.at(y1).at(x1) == 0){
          f = 0;
          cou++;
          rep(i0, h){
            rep(j0, w){
              if(itta.at(i0).at(j0) == cou-1){
                rep(k, 4){
                  zx = j0+hou.at(k).at(0);
                  zy = i0+hou.at(k).at(1);
                  if(!(zx<0 || zx>=w || zy<0 || zy>=h)){
                    if(map.at(zy).at(zx) == '.' && itta.at(zy).at(zx) == 0){
                      itta.at(zy).at(zx) = cou;
                      f = 1;
                    }
                  }
                }
              }
            }
          }
          if(f == 0) break;
        }
        if(max < cou && f == 1) max = cou;
    }
    cout << max-1 << endl;
}

Measured memory_bytes: 5428
#include <iostream>
#include <queue>

using namespace std;

int H, W;
char s[60][60];
int kind[60][60];

queue<pair<int, int>> q;

void push_queue(int x, int y, int kind_num) {
    if(x < 0 || y < 0 || x >= H || y >= W) return;
    if(s[x][y] == '#') return;
    if(kind[x][y] != -1) return;

    q.push(pair<int,int>(x,y));
    kind[x][y] = kind_num;
}

int BFS(int sx, int sy) {
    int kind_num = 0;
    push_queue(sx, sy, kind_num);
    while(q.size() > 0) {
        pair<int, int> p = q.front();q.pop();
        int x = p.first;
        int y = p.second;
        kind_num = kind[x][y];
        kind_num++;
        push_queue(x, y+1, kind_num);
        push_queue(x, y-1, kind_num);
        push_queue(x+1, y, kind_num);
        push_queue(x-1, y, kind_num);
    }
}


int main() {
    int white_count = 0;

    cin >> H >> W;
    for(int i = 0; i < H; i++) {
        for(int j = 0; j < W; j++) {
            cin >> s[i][j];
            kind[i][j] = -1;
            if(s[i][j] == '.') white_count++;
        }
    }

    BFS(0,0);
    if(kind[H-1][W-1] == -1) cout << kind[H-1][W-1] << endl;
    else cout << white_count - kind[H-1][W-1] - 1 << endl; //-1は0,0の白。
    return 0;
}



Measured memory_bytes: 256
N,L = [int(s) for s in input().split(' ')]
tastes = [(L + i -1) for i in range(1,N+1)]
tmp_tastes = [ abs(i) for i in tastes ]
min_index = tmp_tastes.index(min(tmp_tastes))
tastes.pop(min_index)
print(sum(tastes))

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

import sys

class Point_class():
    def __init__(self, x, y):
        self.x = x
        self.y = y

def is_same_side(p1, p2, p3, p4):
    a = -(p1.y-p2.y)
    b = p1.x-p2.x
    c = p2.x*p1.y-p2.y*p1.x
    if (a*p3.x+b*p3.y+c) * (a*p4.x+b*p4.y+c) >= 0:
        return True
    else:
        return False

for line in sys.stdin:
    x1, y1, x2, y2, x3, y3, x4, y4 = map(float, line.split(','))
    p1 = Point_class(x1, y1)
    p2 = Point_class(x2, y2)
    p3 = Point_class(x3, y3)
    p4 = Point_class(x4, y4)
    if is_same_side(p1, p3, p2, p4) or is_same_side(p2, p4, p1, p3):
        print "NO"
    else:
        print "YES"

Measured memory_bytes: 6360
n = int(input())
l = []
l2 = []

for i in range(n):
    a, b = list(map(int, input().split()))
    l.append([a,b])
l.sort()

for i in range(len(l)-1):
    for j in range(i+1, len(l)):
        dif1 = l[i][0] - l[j][0]
        dif2 = l[i][1] - l[j][1]
        l2.append(str(dif1) + ' ' + str(dif2))
##print(l2)

try:
    cnt = max(l2, key=l2.count)
except:
    cnt = "1000000 1000000"
x, y = list(map(int, cnt.split()))

ans = 0

for i in range(len(l)):
    if [l[i][0] + x, l[i][1] + y] in l:
        ans += 1

print(n - ans)


Measured memory_bytes: 3064
#include <iostream>
using namespace std;
int main(){
  int a, b, c;
  cin >> a >> b >> c;
  if(a > b && a > c){
    cout << b * c / 2 << endl;
  }else if(b > a && b > c){
    cout << a * c / 2 << endl;
  }else{
    cout << a * b / 2 << endl;
  }
  return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>

int main(){
    int N,M;
    std::cin >> N >> M;

    std::vector<long long> x(N);
    std::vector<long long> y(N);
    std::vector<long long> z(N);
    for (int i=0;i<N;i++) {
        std::cin >> x.at(i) >> y.at(i) >> z.at(i);
    }

    long long maxSum=0;
    long long sum=0;
    int signX,signY,signZ;
    std::vector<long long> cakes(N,0);
    for (int i=0;i<8;i++) {
        sum = 0;
        if (i<4) signX=1;
        else signX=-1;
        if (i%4<2) signY=1;
        else signY=-1;
        if (i%2==0) signZ=1;
        else signZ=-1;

        for (int j=0;j<N;j++) {
            cakes.at(j) = signX*x.at(j) + signY*y.at(j) + signZ*z.at(j);
        }
        std::sort(cakes.begin(),cakes.end());
        for (int j=1;j<=M;j++) sum+=cakes.at(N-j);

        maxSum = std::max(maxSum,sum);
    }

    std::cout << maxSum << '\n';
}

Measured memory_bytes: 256
import java.io.InputStream;
import java.io.PrintStream;
import java.util.Scanner;

public class Main {
	InputStream in = System.in;
	PrintStream out = System.out;

	public void _main(String[] args) {
		Scanner sc = new Scanner(in);

		long N = sc.nextLong();
		long M = sc.nextLong();

		sc.close();

		long ans = 0;

		if (N * 2 <= M) {
			ans += N;
			M -= N * 2;
			N = 0;
		} else {
			ans += M / 2;
			N -= M / 2;
			M = 0;
		}

		if (M > 0) {
			ans += M / 4;
		}

		out.println(ans);
	}

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

	@SuppressWarnings("unused")
	private int[] nextIntArray(Scanner sc, int n) {
		int[] result = new int[n];
		for (int i = 0; i < n; i++) {
			result[i] = sc.nextInt();
		}
		return result;
	}

	@SuppressWarnings("unused")
	private int[] nextIntArray1origin(Scanner sc, int n) {
		int[] result = new int[n + 1];
		for (int i = 1; i <= n; i++) {
			result[i] = sc.nextInt();
		}
		return result;
	}
}


Measured memory_bytes: 23636
#include <bits/stdc++.h>
#define ll long long
#define ii pair<ll, ll>
#define vi vector<ll>
#define vs vector<string>
#define si set<ll>
#define endl "\n"
#define pb(a) push_back(a)
#define x first
#define y second
//g++-9 -std=c++11 -Wall -Wextra -pedantic-errors main.cpp -o main
const ll ms = 1e4 + 5, base = 31, mod = 1e9 + 9;
using namespace std;

int main(){
	ios::sync_with_stdio(false), cin.tie(0);
	
	string a, b;
	cin >> a >> b;
	int A = stoi(a), B = stoi(b);
	
	for (int i = 1; i < B; i ++){
		a += a.substr(0,1);
	}
	
	for (int i = 1; i < A; i ++){
		b += b.substr(0,1);
	}
	if (a < b) cout << a;
	else cout << b;

	cout << endl;
	return 0;
}

Measured memory_bytes: 256
t=[0]
x=[0]
y=[0]
N=int(input())
for i in range(N):
    a,b,c=list(map(int,input().split()))
    t.append(a)
    x.append(b)
    y.append(c)
    
def cal(x_0,x_1,y_0,y_1,t_0,t_1):
    dis=abs(x_1-x_0)+abs(y_1-y_0)
    T=t_1-t_0
    if(T>=dis and abs(T-dis)%2==0):
        return 1
    return 0

for i in range(N):
    if(cal(x[i],x[i+1],y[i],y[i+1],t[i],t[i+1])==0):
        print("No")
        break
else:
    print("Yes") 

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

int main(){
	unsigned long l,m,n;
	unsigned long sum,month;
	bool flag = false;
	
	while(cin >> l,l){
		flag = false;
		month = 0;
		sum = 0;
		for(int i=0;i<12;i++){
			cin >> m >> n;
			sum += (m-n);
			if(sum >= l && flag == false){
				month = i + 1;
				flag = true;
			}
		}
		
		if(!month)	cout << "NA" << endl;
		else	cout << month << endl;
	}
	return 0;
}

Measured memory_bytes: 1156
#include<iostream>
using namespace std;
int x,y,z,a,b,c;
int main(){
 cin>>x>>y>>z;
 a=min(x,min(y,z));
 if(x>=y&&x<=z){
    b=x;
 }
  else if(x<=y&&x>=z){
    b=x;
 }
  else if(y>=x&&y<=z){
    b=y;
 }
  else if(y<=x&&y>=z){
    b=y;
 }else {
 b=z;}


 c=max(x,max(y,z));
 cout<<a<<" "<<b<<" "<<c<<endl;

}





Measured memory_bytes: 3080
/*
  Krishnakant Tiwari
  Problem Link:

 */
#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
#pragma GCC optimization ("unroll-loops")
using namespace std;
typedef long long ll;
#define _cin      ios_base::sync_with_stdio(0);  cin.tie(0);
#define endl "\n"
#define pb push_back
#define rep(i,a,b) for(ll i=a;i<b;++i)
#define repd(i,a,b) for(ll i=a;i>=b;--i)
#define mp make_pair
#define hell 1000000007
#define vvll vector<vector<ll> >
#define vll vector<ll>
#define mll map<ll,ll>
#define sz(x) (ll)x.size()
#define sll set<ll>
#define pll pair<ll,ll>
#define F first
#define S second
#define eb	emplace_back
#define ppb	pop_back
#define pf	push_front
#define ppf	pop_front
#define all(x) x.begin(), x.end()
#define clr(x) memset(x, 0, sizeof(x))
#define sortall(x) sort(all(x))
#define tr(it, a) for (auto it = a.begin(); it != a.end(); it++)
#define PI 3.1415926535897932384626
#define deb(x) cout << #x << "=" << x << endl
#define deb2(x, y) cout << #x << "=" << x << "," << #y << "=" << y << endl
#define precise(x)	cout<<fixed<<setprecision(x)
const ll MAX = 1000004;
const ll INF = 1e18L + 5;
template <class T, class U>
void chmin(T &t, const U &u)
{
    if (t > u) t = u;
}
template <class T, class U>
void chmax(T &t, const U &u)
{
    if (t < u) t = u;
}
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T)
{
    cerr << " " << H;
    debug_out(T...);
}
template <typename Arg1>
void pn(Arg1 &&arg1)
{
    cout << arg1 << "\n";
}
template <typename Arg1, typename... Args>
void pn(Arg1 &&arg1, Args &&... args)
{
    cout << arg1 << "\n";
    pn(args...);
}
template <typename Arg1>
void ps(Arg1 &&arg1)
{
    cout << arg1 << " ";
}
template <typename Arg1, typename... Args>
void ps(Arg1 &&arg1, Args &&... args)
{
    cout << arg1 << " ";
    ps(args...);
}
template <typename Arg1>
void read(Arg1 &&arg1)
{
    cin >> arg1;
}
template <typename Arg1, typename... Args>
void read(Arg1 &&arg1, Args &&... args)
{
    cin >> arg1;
    read(args...);
}

ll g[MAX];
ll a[MAX];

void solve()
{

    ll sum = 0;
    ll n;
    read(n);
    ll a[n];
    ll pre[n];
    rep(i, 0, n)
    {
        read(a[i]);
        sum+=a[i];
        if(i){
        	pre[i]=a[i]+pre[i-1];
        }else pre[i]=a[i];
    }
    ll ans=0;
    rep(i,0,n){
    	ans+=(a[i]%hell * (sum%hell -pre[i]%hell +hell)%hell);
    	ans%=hell;
    }
    pn(ans);

  

}


int main()
{

    _cin
#ifndef ONLINE_JUDGE
    // for getting input from input.txt
    freopen("input.txt", "r", stdin);
    // for writing output to output.txt
    freopen("output.txt", "w", stdout);
#endif
    // ll tc;
    // cin>>tc;
    // while(tc--){
    solve();
    // }

}


Measured memory_bytes: 6772
class Node:
    
    def __init__(self, parent = -1, left = -1, right = -1):
        self.parent = parent
        self.left = left
        self.right = right
    
    def get_degree(self):
        d = 0
        if self.left != -1:
            d += 1
        if self.right != -1:
            d += 1
        return d

class BinaryTree:
    
    def __init__(self, size):
        self.tree = [Node() for i in range(N)]
    
    def set(self, node_id, left, right):
        self.tree[node_id].left = left
        self.tree[node_id].right = right

        if left != -1:
            self.tree[left].parent = node_id
        if right != -1:
            self.tree[right].parent = node_id
    
    def get_depth(self, node_id):
        d = 0
        while self.tree[node_id].parent != -1:
            d += 1
            node_id = self.tree[node_id].parent
        return d
    
    def get_height(self, node_id):
        h_left = h_right = 0
        if self.tree[node_id].left != -1:
            h_left = self.get_height(self.tree[node_id].left) + 1
        if self.tree[node_id].right != -1:
            h_right = self.get_height(self.tree[node_id].right) + 1
        
        return max(h_left, h_right)
    
    def get_sibling(self, node_id):
        
        if self.tree[node_id].parent == -1:
            return -1
        
        parent_id = self.tree[node_id].parent
        parent = self.tree[parent_id]
        
        if parent.left != -1 and parent.left != node_id:
            return parent.left
        if parent.right != -1 and parent.right != node_id:
            return parent.right
        
        return -1
    
    def get_node_type(self, node_id):
        node = self.tree[node_id]
        
        if node.parent == -1:
            return 'root'
        
        if node.left == -1 and node.right == -1:
            return 'leaf'
        
        return 'internal node'
    
    def print(self):
        for i in range(len(self.tree)):
            node = self.tree[i]
            node_id = i
            parent = node.parent
            sibling = self.get_sibling(node_id)
            degree = node.get_degree()
            depth = self.get_depth(node_id)
            height = self.get_height(node_id)
            node_type = self.get_node_type(node_id)
            print('node %d: parent = %d, sibling = %d, degree = %d, depth = %d, height = %d, %s' % (node_id, parent, sibling, degree, depth, height, node_type))
            
N = int(input())

binary_tree = BinaryTree(N)

for _ in range(N):
    node_id, left, right = list(map(int, input().split()))
    binary_tree.set(node_id, left, right)

binary_tree.print()


Measured memory_bytes: 5620
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
#define ce(x) cerr << (x) << "\n"
#define cesp(x) cerr << (x) << " "
#define pb push_back
#define mp make_pair
#define Would
#define you
#define please

bool S[2001];

bool memo[4002];
int Sum[4002], n[4002], amari[4002];

pair<int, int> E[4002];
int Head[2001];
void dfs(int To, int from, int head) {
	if (memo[head]) return;
	memo[head] = true;
	int saidai = 0;
	for (int i = Head[To]; i; i = E[i].second) {
		if (E[i].first != from) {
			dfs(E[i].first, To, i);
			Sum[head] += Sum[i];
			n[head] += n[i];
			saidai = max(saidai, amari[i]);
		}
	}
	if (saidai + saidai < Sum[head]) amari[head] = (Sum[head] + 1) / 2;
	else amari[head] = saidai;
	if (S[To]) n[head]++;
	Sum[head] += n[head];
	amari[head] += n[head];
}

const int cm = 1 << 15;
char cn[cm], *ci = cn, ct;
inline int getint() {
	int A = 0;
	while ((ct = *ci++) >= '0') A = A * 10 + ct - '0';
	return A;
}

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

	fread_unlocked(cn, 1, cm, stdin);

	int N = getint();
	int kazu = 0;
	rep1(i, N) {
		if (*ci++ == '1') {
			kazu++;
			S[i] = true;
		}
	}
	if (kazu == 1) {
		co(0);
		return 0;
	}
	ci++;

	int Deg[2001] = {};
	for (int i = 1; i < 2 * N - 2; i += 2) {
		int a = getint(), b = getint();
		Deg[a]++;
		Deg[b]++;
		E[i] = mp(a, Head[b]);
		Head[b] = i;
		E[i + 1] = mp(b, Head[a]);
		Head[a] = i + 1;
	}

	bool OK = 0;
	int saishou = 1e9;
	queue<int> que;
	int kari = 0;
	rep1(i, N) if (Deg[i] > 1) kari = i;
	que.push(kari);
	while(que.size()) {
		int j = que.front();
		que.pop();
		if (Deg[j] > 1) {
			Deg[j] = 1;
			int s = 0;
			int saidai = 0;
			int Nsaidai = 0;
			for (int i = Head[j]; i; i = E[i].second) {
				dfs(E[i].first, j, i);
				s += Sum[i];
				saidai = max(saidai, amari[i]);
				Nsaidai = max(Nsaidai, n[i]);
			}
			if (saidai + saidai > s) {
				for (int i = Head[j]; i; i = E[i].second) {
					if (amari[i] == saidai) que.push(E[i].first);
				}
			}
			else {
				if ((s & 1) == 0) {
					OK = 1;
					saishou = min(saishou, s / 2);
				}
				if (OK && saishou <= s / 2) {
					if (Nsaidai + Nsaidai >= kazu - S[j]) {
						for (int i = Head[j]; i; i = E[i].second) {
							if (n[i] == Nsaidai) que.push(E[i].first);
						}
					}
				}
				else {
					for (int i = Head[j]; i; i = E[i].second) que.push(E[i].first);
				}
			}
		}
	}

	if (OK) co(saishou);
	else co(-1);

	Would you please return 0;
}

Measured memory_bytes: 512
import sys, math
from collections import defaultdict
from copy import deepcopy
import itertools
input = sys.stdin.readline
# 文字列の場合は普通のinput()を使うか下を使う
# input = sys.stdin.readline().rstrip()


N = int(input())
A = [0] + list(map(int, input().split()))
s = 0
destroyed = 0
for i in range(N + 1):
    if A[i] == s:
        s += 1
    else:
        destroyed += 1

if destroyed == N:
    print(-1)
else:
    print(destroyed)

Measured memory_bytes: 72688
#include<stdio.h>
#include<vector>
#include<algorithm>
using namespace std;
typedef long long ll;
ll mod = 1000000007;
ll dp[5555][5555];
ll zdp[5555];
ll p2[5555], ip2[5555];
int main()
{
	int hei, len;
	scanf("%d%d", &hei, &len);
	p2[0] = ip2[0] = 1;
	for (int i = 1; i <= 5050; i++)p2[i] = p2[i - 1] * 2 % mod, ip2[i] = ip2[i - 1] * ((mod + 1) / 2) % mod;
	dp[0][len] = 1;
	for (int i = 0; i < hei; i++)
	{
		for (int j = 1; j <= len; j++)zdp[j] = dp[i][j] * p2[j] % mod;
		for (int j = 1; j <= len; j++)zdp[j] = (zdp[j] + zdp[j - 1]) % mod;
		for (int j = 1; j <= len; j++)dp[i + 1][j] = (zdp[len] + mod - zdp[j])*ip2[j + 1] % mod*j%mod;
		for (int j = 1; j <= len; j++)dp[i + 1][j] = (dp[i + 1][j] + dp[i][j] * (j + 1)) % mod;
		//for (int j = 1; j <= len; j++)printf("%lld ", dp[i + 1][j]); printf("\n");
	}
	ll r = 0;
	for (int i = 1; i <= len; i++)r = (r + dp[hei][i]) % mod;
	printf("%lld\n", r);
}

Measured memory_bytes: 218444
#include <bits/stdc++.h>
using namespace std;
int main(){
  int x,y;
  cin>>x>>y;
  bool ok=false;
  for(int i=0;i<=x;i++){
    if(4*x-y==2*i)ok=true;
  }
  if(ok){
    cout<<"Yes"<<endl;
  }else{
    cout<<"No"<<endl;
  }
  return 0;
}

Measured memory_bytes: 3604
S = gets.chomp.chars

ans = (S.size - 2).downto(1)
.select(&:odd?)
.map { |i| S[0..i] }
.select do |s|
  s[0..(s.size / 2 - 1)] == s[(s.size / 2)..-1]
end
.map { |s| s.size }
.max
puts ans


Measured memory_bytes: 1788
while True:
    H,W=map(int,input().split())
    if H==W==0:
        break
    else:
        if H%2==0:
            for i in range (H//2):
                if W%2==0:
                    print("#."*(W//2))
                    print(".#"*(W//2))
                else:
                    print("#."*(W//2)+"#")
                    print(".#"*(W//2)+".")
            print()
        else:
            for i in range (H//2):
                if W%2==0:
                    print("#."*(W//2))
                    print(".#"*(W//2))

                else:
                    print("#."*(W//2)+"#")
                    print(".#"*(W//2)+".")
            if W%2==0:
                print("#."*(W//2))
            else:
                print("#."*(W//2)+"#")
            print()


Measured memory_bytes: 5608
N = int(input())
G = [[] for i in range(N+1)]
for i in range(N-1):
    a,b = map(int,input().split())
    G[a].append(b)
    G[b].append(a)
c = list(map(int,input().split()))
c.sort()
ans = sum(c) - max(c)
F = []
for i in range(1,N+1):
    n = len(G[i])
    if n == 1:
        F.append(i)
d = {}
i = 0
while i < N:
    x = F.pop(0)
    d[x] = c[i]
    i += 1
    if len(G[x]) > 0:
        y = G[x][0]
        G[y].remove(x)
        if len(G[y]) == 1:
            F.append(y)
ANS = []
for i in range(1,N+1):
    ANS.append(d[i])
print(ans)
print(*ANS)

Measured memory_bytes: 6580
#include <iostream>
using namespace std;
int main(){
	int a,b,c,d,e;
	cin>>a>>b>>c;
	if(b>a){
		d=b-a;
	}else{
		d=a-b;
	}
	if(c>a){
		e=c-a;
	}else{
		e=a-c;
	}
	if(d>e){
		cout<<"B";
	}else{
		cout<<"A";
	}
	
	return 0;
} 

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define PB push_back
#define MP make_pair
#define REP(i,a,b) for (int i = a; i <b; i++)
typedef long long ll;
#define int ll
typedef vector<int> vi;
typedef vector<long long> vl;
typedef pair<int,int> pi;
#define trace(x) cout<<#x<<"="<<x<<"\n";
#define sz(x) (int)(x.size())
#define mod 1000000007
#define endl "\n"
template < typename F, typename S >
ostream& operator << ( ostream& os, const pair< F, S > & p ) {
    return os << "(" << p.first << ", " << p.second << ")";
}

template < typename T >
ostream &operator << ( ostream & os, const vector< T > &v ) {
    os << "{";
    typename vector< T > :: const_iterator it;
    for( it = v.begin(); it != v.end(); it++ ) {
        if( it != v.begin() ) os << ", ";
        os << *it;
    }
    return os << "}";
}

template < typename T >
ostream &operator << ( ostream & os, const set< T > &v ) {
    os << "[";
    typename set< T > :: const_iterator it;
    for ( it = v.begin(); it != v.end(); it++ ) {
        if( it != v.begin() ) os << ", ";
        os << *it;
    }
    return os << "]";
}

template < typename F, typename S >
ostream &operator << ( ostream & os, const map< F, S > &v ) {
    os << "[";
    typename map< F , S >::const_iterator it;
    for( it = v.begin(); it != v.end(); it++ ) {
        if( it != v.begin() ) os << ", ";
        os << it -> first << " = " << it -> second ;
    }
    return os << "]";
}

#define deb(x) cerr << #x << " = " << x << endl;

bool comp1(pair<int, int> A, pair<int, int> B) {
    return A.first<B.first;
}
bool comp2(pair<int, int> A, pair<int, int> B) {
    return A.second<B.second;
}
int32_t main(){
    ios::sync_with_stdio(false);
    int n;
    cin>>n;
    vector<pair<int, int> > xy;
    // xy.resize(n);
    xy.clear();
    REP(i,0,n) {
        int X, Y;
        cin>>X>>Y;
        int A=(X+Y);
        int B=(X-Y);
        xy.push_back({A,B});
    }
    sort(xy.begin(), xy.end(), comp1);
    int ans = xy[n-1].first-xy[0].first;
    sort(xy.begin(), xy.end(), comp2);
    ans = max(ans, xy[n-1].second- xy[0].second);
    cout<<ans<<"\n";
    return 0;
}

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

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

    int pie = 0;
    int tasteAbsMin = INT_MAX;
    for (int i = 1; i <= N; ++i) {
        int taste = L + i - 1;
        pie += taste;
        if (abs(taste) < abs(tasteAbsMin)) {
            tasteAbsMin = taste;
        }
    }
    pie -= tasteAbsMin;
    cout << pie;

    return 0;
}


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

int main() {
  int a;
  cin >> a;
  int b[a];
  for(int i = 0; i < a; i++){
    cin >> b[i];
  }
  int count = 0;
  int max = 0;

  for(int i = 0; i < a-1; i++){
    if(b[i+1] <= b[i]){
      count++;
    }
    else{
      if(max < count){
        max = count;
      }
      count = 0;
    }
  }
  if(max < count){
    max = count;
  }
  cout << max << endl;
}

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

using namespace std;

const int MAX_N = 305;

int dp [MAX_N][MAX_N][MAX_N];

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

  int n, K;
  n = s.size();
  cin >> K;

  for (int i = 0; i < n; i++) {
    dp[i][i][0] = 1;
  }
  for (int i = 0; i < n - 1; i++) {
    if (s[i] == s[i + 1]) {
      dp[i][i + 1][0] = 2;
    } else {
      dp[i][i + 1][1] = 2;
    }
  }

  for (int i = 0; i < n; i++) {
    for (int l = 0; l + i < n; l++) {
      int r = l + i;
      for (int k = 0; k <= K; k++) {
        if (l != 0) dp[l - 1][r][k] = max(dp[l - 1][r][k], dp[l][r][k]);
        if (r != n) dp[l][r + 1][k] = max(dp[l][r + 1][k], dp[l][r][k]);
        if (l != 0 && r != n && s[l - 1] == s[r + 1]) {
          dp[l - 1][r + 1][k] = max(dp[l - 1][r + 1][k], dp[l][r][k] + 2);
        }
        if (l != 0 && r != n) {
          dp[l - 1][r + 1][k + 1] = max(dp[l - 1][r + 1][k + 1], dp[l][r][k] + 2);
        }
      }
    }
  }

  int ans = 0;
  for (int i = 0; i <= K; i++) {
    ans = max(ans, dp[0][n - 1][i]);
  }
  cout << ans << endl;
}


Measured memory_bytes: 110848
#include <bits/stdc++.h>
#include <queue>
#define REP(i, n) for (ll i = 1; i <= n; i++)
#define rep(i, n) for (ll i = 0; i < n; i++)
#define ll long long
#define ld long double
using namespace std;

int main()
{
    int x;
    cin >> x;
    if(x == 1) cout << 0 << endl;
    if(x == 0) cout << 1 << endl;
}

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

int main(){
    cin.tie(0);
    cout.tie(0);
    ios::sync_with_stdio(false);
    int n, q;
    cin >> n >> q;
    string s;
    cin >> s;
    vector<int> ac;
    ac.push_back(0);
    for(int i = 1; i < n; i++){
        if(s[i-1] == 'A' && s[i] == 'C'){
            ac.push_back(ac[i-1] + 1);
        }else{
            ac.push_back(ac[i-1]);
        }
    }
    for(int i = 0; i < q; i++){
        int l, r;
        cin >> l >> r;
        cout << ac[r-1] - ac[l-1] << endl;
    }
}

Measured memory_bytes: 1480
import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    long[] a = new long[n];
    for (int i = 0; i < n; i++) {
      a[i] = sc.nextInt();
    }
    long count1 = 0;
    long sum1 = 0;
    // 最初の和が正
    for (int i = 0; i < n; i++) {
      sum1 += a[i];
      if (i % 2 == 0 && sum1 <= 0) {
        count1 += (-sum1) + 1;
        sum1 = 1;
        // while (sum1 <= 0) {
        //   sum1++;
        //   count1++;
        // }
      } else if (i % 2 == 1 && sum1 >= 0) {
        count1 += sum1 + 1;
        sum1 = -1;
        // while (sum1 >= 0) {
        //   sum1--;
        //   count1++;
        // }
      }
    }
    long count2 = 0;
    long sum2 = 0;
    // 最初の和が負
    for (int i = 0; i < n; i++) {
      sum2 += a[i];
      if (i % 2 == 0 && sum2 >= 0) {
        count2 += sum2 + 1;
        sum2 = -1;
        // while (sum2 >= 0) {
        //   sum2--;
        //   count2++;
        // }
      } else if (i % 2 == 1 && sum2 <= 0) {
        count2 += (-sum2) + 1;
        sum2 = 1;
        // while (sum2 <= 0) {
        //   sum2++;
        //   count2++;
        // }
      }
    }
    long ans = Long.min(count1, count2);
    System.out.println(ans);
  }
}

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

int main()
{
    int N;
    cin >> N;
    if (N >= 1000) cout << "ABD" << endl;
    else cout << "ABC" << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
    int A;
    int B;
    cin >> A >> B;

    int result;
    result = A + B;
    if (result < A - B) {
        result = A - B;
    }
    if (result < A * B) {
        result = A * B;
    }

    cout << result << endl;
}

Measured memory_bytes: 256
#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef pair<int, int> pi;
#define debug(x) cerr << #x << ": " << x << endl;
#define debug2(x, y) debug(x) debug(y);
#define repn(i, a, b) for(int i = (int)(a); i < (int)(b); i++)
#define rep(i, a) for(int i = 0; i < (int)(a); i++)
#define all(v) v.begin(), v.end() 
#define mp make_pair
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define fi first
#define se second
#define sq(x) ((x) * (x))

template<class T> T gcd(T a, T b){ return ((b == 0) ? a : gcd(b, a % b)); }

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	//freopen("input.in", "r", stdin);
	//freopen("output.out", "w", stdout);
	int a, b, c, d;
	cin >> a >> b >> c >> d;
	int tot = 0;
	rep(i, 101) if(i >= a && i <= b && i >= c && i <= d) tot++;
	cout << tot - (tot > 0) << endl;
	return 0;
}
/*
Things to look out for:
	- Integer overflows
	- Array bounds
	- Special cases
Be careful!
*/


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,n) for(int i=0;i<n;i++)
#define Rep(i,n) for(int i=1;i<=n;i++)
const ll MOD = 1000000007;
long long modinv(long long a, long long m=MOD) {
    long long b = m, u = 1, v = 0;
    while (b) {
        long long t = a / b;
        a -= t * b; swap(a, b);
        u -= t * v; swap(u, v);
    }
    u %= m; 
    if (u < 0) u += m;
    return u;
    /*MODの割り算の際に
    a/＝b;
    を
    a *= modinv(b,MOD);
    とする。
        */
}
int main(){

    ll X,K,D;
    cin >> X >> K >> D;
    ll tmp;
    ll tmp_place;
    ll tmp_other;
    if(X>0){
        tmp = (X/D) + 1;
        tmp_place = X - tmp*D;
        tmp_other = X - (tmp-1)*D;
    }else {
        tmp = -(X/D) + 1;
        tmp_place = (-1*X) - tmp*D;
        tmp_other = (-1*X) - (tmp-1)*D;
    }
    if(tmp > K){
        if(X>0){
            cout << abs(X - K*D) << endl;
            return 0;
        }else{
            cout << abs(-1*(X)- K*D) << endl;
            return 0;
        }
    }
    if((K-tmp)%2==0){
        cout << abs(tmp_place) << endl;
    }else {
        cout<< abs(tmp_other) << endl;
    }
    return 0;
}

Measured memory_bytes: 3612
#include <bits/stdc++.h>
using namespace std;
main(){
  int N;
  cin>>N;
  vector<int> P(N);
  for(int i=0;i<N;i++){
    cin>>P.at(i);
  }
  int T=0;
  for(int i=0;i<N;i++){
    if(P.at(i)!=i+1){
      T++;
    }
  }
    if((T==2)||(T==0)){
      cout<<"YES"<<endl;
    }
    else{
      cout<<"NO"<<endl;
    }
  }

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(){
    int N,Y;
    cin >> N >> Y;
    int res10000 = -1,res5000 = -1,res1000 = -1;
    for(int a = 0;a <= N;++a){
        for(int b = 0;a + b <= N;++b){
            int c = N - a - b;
            if((10000*a + 5000*b + 1000*c) == Y){
                res10000 = a;
                res5000 = b;
                res1000 = c;
                break;
            }
        }
    }
    cout << res10000 << " " << res5000 << " " << res1000 << endl;
}


Measured memory_bytes: 256
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include<math.h>

int main(){
    int n,i;
    scanf("%d",&n);
  char str1[101];
  char str2[101];  

scanf("%s %s",str1,str2);

  
  for(i=0;i<n;i++){
    printf("%c%c",str1[i],str2[i]);
  }
  
  return 0;
}

Measured memory_bytes: 128
#include <iostream>
static const  int INFTY = 100000000;
static const  int WHITE =0;
static const  int GRAY= 10;
static const  int BLACK = 100;

using namespace std;

void  dijkstra(int n,int M[100][100]) {
	int color[100], d[100],p[100];
	for (int i = 0; i < n; i++) {
		color[i] = WHITE;
		d[i] = INFTY;
	}
	d[0] = 0;
	p[0] = -1;

	int u = -1;
	while (1) {
		int mincost = INFTY;
		for (int i = 0; i < n; i++) {
			if (d[i] < mincost &&color[i] != BLACK) {
				 u = i;
				 mincost = d[i];
			}
		}
		if (mincost == INFTY) break;
		color[u] = BLACK;

		for (int v = 0; v < n; v++) {
			if (color[v] != BLACK && M[u][v] != INFTY) {
				if (d[v] > d[u] + M[u][v]) {
					d[v] = d[u] + M[u][v];
					p[v] = u;
					color[v] = GRAY;
				}
			}
		}
	}
	for (int i = 0; i < n; i++) {
		cout << i << " " << (d[i] == INFTY ? -1 : d[i]) << endl;
	}
}


int main() {
	int  n,u, k, v,c;
	int M[100][100];
	cin >> n;

	for (int i = 0; i < n; i++) {
		for (int j = 0; j < n; j++) {
			M[i][j] = INFTY;
		}
	}
	for (int i = 0; i < n; i++) {
		cin >> u >> k;
		
		for (int j = 0; j < k; j++) {
			cin >> v >> c;;
			M[u][v] = c;
		}
	}

	dijkstra(n,M);
	return 0;
}

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

//#pragma gcc optimize("O3,unroll-loop")
//#pragma gcc target("sse,sse2,sse3,ssse3,sse4,avx,avx2,fma,abm,mmx,popcnt,tune=native")
//#define int long long
//#define double long double

int group[200001], cnt[200001];

int fnd(int a)
{
    if (a == group[a])
        return a;
    else
        return group[a] = fnd(group[a]);
}

void uni(int a, int b)
{
    int x = fnd(a), y = fnd(b);
    group[x] = y;
}

signed main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);

    int n, m;
    cin >> n >> m;

    for (int i = 1; i <= n; i++)
        group[i] = i;

    int a, b;
    while (m--)
        cin >> a >> b, uni(a, b);

    for (int i = 1; i <= n; i++)
        cnt[fnd(i)]++;

    int mx = 0;
    for (int i = 1; i <= n; i++)
        mx = max(mx, cnt[i]);
    cout << mx << '\n';

    return 0;
}

//      *   *  *****  *   *  *   *   ****  ****    ****     **    **
//     *   *  *      **  *  *   *  *      *   *  *        * *   * *
//    *****  *****  * * *  *   *  *      ****   *       *  *     *
//   *   *      *  *  **  *   *  *      *  *   *       *****    *
//  *   *  *****  *   *   ***    ****  *   *    ****     *   *****

//      *****  *****  *   *  *      *****  *   *  *****  *****
//        *   *   *  *   *  *        *    **  *    *    *   *
//       *   *   *  *****  *        *    * * *    *    *****
//   *  *   *   *    *    *        *    *  **    *    *
//  ****   *****    *    *****  *****  *   *    *    *


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

using namespace std;

int a[100000005];
int main(void) {
	ios::sync_with_stdio(false);
  cin.tie(0);
  string s;
  cin >> s;
  int n = (int) s.size();
  vector<int> a(n + 1);
  for (int i = 0; i < n; i++) {
    if (s[i] == '<') {
      a[i + 1] = max(a[i + 1], a[i] + 1);
    }
  }
  for (int i = n - 1; i >= 0; i--) {
    if (s[i] == '>') {
      a[i] = max(a[i], a[i + 1] + 1);
    }
  }
  long long ans = 0;
  for (int i = 0; i <= n; i++) {
    ans += a[i];
  }
  cout << ans << '\n';
  return 0;
}

Measured memory_bytes: 2844
#include<iostream>
#include<cstdio>
#include<vector>
#include<string>
#include<cstring>
#include<functional>
#include<stack>
#include<queue>
#include <iomanip>
#include<map>
#include<limits>
#include<cmath>
#include<algorithm>
#include<bitset>
#include<utility>
#include<complex>
#include<cstdlib>
#include<set>
#include<cctype>

#define DBG cerr << '!' << endl;
#define REP(i,n) for(int (i) = (0);(i) < (n);++i)
#define rep(i,s,g) for(int (i) = (s);(i) < (g);++i)
#define rrep(i,s,g) for(int (i) = (s);i >= (g);--(i))
#define PB push_back
#define MP make_pair
#define FI first
#define SE second
#define SHOW1d(v,n) {for(int W = 0;W < (n);W++)cerr << v[W] << ' ';cerr << endl << endl;}
#define SHOW2d(v,i,j) {for(int aaa = 0;aaa < i;aaa++){for(int bbb = 0;bbb < j;bbb++)cerr << v[aaa][bbb] << ' ';cerr << endl;}cerr << endl;}
#define ALL(v) v.begin(),v.end()
#define Decimal fixed<<setprecision(10)

using namespace std;

typedef long long ll;
typedef vector<int> iv;
typedef vector<iv> iiv;
typedef vector<string> sv;

int main()
{
	string str;cin >> str;
	
	REP(i,str.size())
	{
		if(i%2 == 0)
			cout << str[i];
	}
	cout << endl;
	
	
	return 0;
}

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


int main()
{


     ios_base::sync_with_stdio(false);
     cin.tie(NULL);
        int count;
     cin>>count;
     unordered_map<int,int>nish;
    //vector<int>num;
     long long int ans=0;

    for(int i=0;i<count;i++)
    {
      int first;
      cin>>first;
      nish[first]++;
      //num.push_back(first);
      ans+=first;
    }

    int q;
    cin>>q;

    while(q--)
    {
      int a,b;
      cin>>a>>b;
      int total=nish[a];
      long long int ans1=1LL*nish[a]*(b-a)+ans;
      ans=ans1;
      cout<<ans1<<endl;
      nish[a]=0;
      nish[b]+=total;
    }



    return 0;

}

Measured memory_bytes: 7048
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair<int,int> pii;
 
#define mem(dp,a)       memset(dp,a,sizeof dp)
#define ninja           ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define pb(x)           push_back(x)
#define mp(x,y)         make_pair(x,y)
#define all(c)          c.begin(), c.end()
#define ff              first
#define ss              second
#define nl              '\n'
#define inf             1e9+7 
 
set<int> adj[2005];
int n,k;

bool bs(int x){
    int lo=1,hi=k;
    while(lo<=hi){
        int mid = (lo+hi)/2;
        if(mid==x)return 1;
        else if(mid>x)
            hi=mid-1;
        else
            lo=mid+1;
    }
    return false;
}
int main()
{
    int x,y;
    cin>>n>>x>>y;
    for(int i=1;i<=n-1;i++){
        int c,d;c=i;d=i+1;
        adj[c].insert(d);
        adj[d].insert(c);
    }
    adj[x].insert(y);adj[y].insert(x);
    k=n-1;
    int res[2005];
    int dist[2005]; mem(res,0);
    bool vis[2005];
    for(int i=1;i<=n;i++)
    {
    mem(dist,200000);
    mem(vis,0);
    //int temp=1;
    queue<int> q;
    dist[i]=0;
    q.push(i);vis[i]=1;
    while(!q.empty()){
        int node=q.front();
        q.pop();
        for(auto j:adj[node]){
            if(!vis[j] ){
                dist[j]=min(dist[j],dist[node]+1);
                q.push(j);vis[j]=1;
                res[dist[j]]++;
            }
        }
       // temp++;
    }
    }

    for(int i=1;i<=k;i++)
        cout<<res[i]/2<<nl;
}


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

using namespace std;

using VI = vector<int>;
using VVI = vector<VI>;
using VB = vector<bool>;
using VVB = vector<VB>;
using VS = vector<string>;
using PII = pair<int, int>;
using VPII = vector<PII>;
using VL = vector<long long>;
using VVL = vector<VL>;

#define sz(var) (int)var.size()
#define REP(var, start, end) for(int var = start; var < (int)end; ++var)
#define CLEAR(var, with) memset(var, with, sizeof(var))
#define ALL(x) x.begin(), x.end()
#define LL long long
#define ULL unsigned long long

const LL INF = (LL)1e18;



int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(0);
#ifndef ONLINE_JUDGE
//	freopen("tmp.in", "r", stdin);
//	freopen("tmp.out", "w", stderr);
#endif
	int n, m;
    cin >> n >> m;
 
	VI a(m), b(m), c(m);
	REP(i, 0, m){
		cin >> a[i] >> b[i] >> c[i];
		c[i] = -c[i];
	}

	VL upper(n + 1, INF);
	VB neg(n + 1, false);
	upper[1] = 0;
	REP(i, 0, n)
	{
		REP(j, 0, m)
		{
			if(upper[b[j]] > upper[a[j]] + c[j])
			{
				upper[b[j]] = upper[a[j]] + c[j];
				if(i == n - 1)
					neg[b[j]] = true;
			}
		}
	}

	if(neg[n])
		cout << "inf" << endl;
	else
		cout << -upper[n] << endl;

	return 0;
}

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

int main(int argc, char const *argv[]) {
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	int a,b;
	string an, bn, u;
	cin>>an>>bn;
	cin>>a>>b;
	cin>>u;
	if (u==an) {
		cout<<a-1<<' '<<b<<'\n';
	}else{
		cout<<a<<' '<<b-1<<'\n';
	}
	return 0;
}

Measured memory_bytes: 256
n=int(input())
a = list(map(int,input().split()))
saifu = 1000
kaine = None
urine = None
for i in range(n):
  if kaine == None:
    kaine = a[i]
    continue
  if urine == None:
    if i < n - 1 and kaine < a[i]:
      urine = a[i]
      continue
    elif i < n - 1:
      kaine = a[i]
      continue
  if i < n - 1 and urine != None and urine <= a[i]:
    urine = a[i]
    continue
  if i == n - 1 and kaine < a[i]:
    urine = a[i]
  if kaine != None and urine != None:
    kabu = int(saifu / kaine)
    saifu += kabu * (urine - kaine)
    kaine = a[i]
    urine = None
print(saifu)

Measured memory_bytes: 9208