akhauriyash/Code-Regression huggingface dataset:
using System;
using System.Collections.Generic;
using System.Linq;
using static Atcoder;
using System.Threading.Tasks;
using System.ComponentModel;

public class Hello
{

    public static void Main()
    {
        int[] n = SpRead(' ').Select(a => int.Parse(a)).ToArray();
        string[] s = new string[n[0]];
        for (int i = 0; i < n[0]; i++) {
            s[i] = Console.ReadLine();
        }
        Array.Sort(s);
        for (int i = 0; i < n[0]; i++) {
            Console.Write(s[i]);
        }
        Console.WriteLine();
    }
}



public class Atcoder
{
    static void Swap<T>(ref T a, ref T b)
    {
        var t = a;
        a = b;
        b = t;
    }
    public static int LCM(int a, int b)
    {
        int c = a * b;
        if (a < b) Swap(ref a, ref b);
        int d = a % b;
        while (d != 0)
        {
            a = b;
            b = d;
            d = a % b;
        }
        return c / b;
    }
    public static string strReverce(string s)
    {
        return new string(s.Reverse().ToArray());
    }
    public static int Cin()
    {
        return int.Parse(Console.ReadLine());
    }
    public static bool IsPrime(int n)
    {
        if (n < 2) return false;
        if (n == 2) return true;
        if (n % 2 == 0) return false;

        //double sqrtNum = Math.Sqrt(n);
        for (int i = 3; i < n; i += 2)
        {
            if (n % i == 0) return false;
        }
        return true;
    }
    public static string[] SpRead(char c)
    {
        return Console.ReadLine().Split(c);
    }
}


Measured memory_bytes: 13536
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);
		StringBuilder sb = new StringBuilder();
		
		sb.append(sc.next().substring(0, 1));
		sb.append(sc.next().substring(0, 1));
		sb.append(sc.next().substring(0, 1));
		
		System.out.println(sb.toString().toUpperCase());
	}
}


Measured memory_bytes: 35544
#include<bits/stdc++.h>
#define int long long
using namespace std;
const int INF = 10000000000000000;
const int mod = 1000000007;
int iti[12345678], cnt[12345678], cost[4321][4321];
signed main() {
	int n, m, a = 0, b = 0, c = 0, ans = 0;
	string s; cin >> s;
	for (int h = 0; h < s.size(); h++) {
		if (s[h] == 'a') { a++; }
		if (s[h] == 'b') { b++; }
		if (s[h] == 'c') { c++; }
	}
	if (max(a, max(b, c)) - min(a, min(b, c)) >= 2) {
		cout << "NO" << endl;
	}
	else { cout << "YES" << endl; }
	cin >> n; return 0;
}

Measured memory_bytes: 512
while line = gets do
  a, b, c, d, e, f = line.split.map(&:to_i)
  ans1 = ((e*c-b*f)*1.0/(a*e-b*d)*1000).round/1000.0
  ans2 = ((a*f-d*c)*1.0/(a*e-b*d)*1000).round/1000.0
  printf("%.3f %.3f\n", ans1, ans2)
end

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

int main() {
  ll n,a,b,ans;
  cin >> n >> a >> b;
  ll sub = abs(a-b);
  if(sub%2==0) ans = sub/2;
  else ans = min(a-1,n-b) + 1 + (b-a-1)/2;
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> V;
#define rep(i,e) for(ll i=0;i<e;i++ )
typedef pair<ll,ll> P;
const ll mod = 1e9+7;
const ll INF = INT32_MAX;
ll co;
struct Dijkstra{
    vector<ll> cost;
    vector<vector<P>> hen;
    queue<ll> find;
    Dijkstra(ll N,ll K,ll S): cost(N),hen(K){
        for(ll i=0;i<N;i++)cost.at(i)=INF;
        cost.at(S)=0;
        find.push(S);
    }

    void search(){
        while(!find.empty()){
            ll f=find.front();
            find.pop();
            for(ll i=0;i<hen.at(f).size();i++){
                if(cost.at(hen.at(f).at(i).first)>cost.at(f)+hen.at(f).at(i).second){
                    find.push(hen.at(f).at(i).first);
                    cost.at(hen.at(f).at(i).first)=cost.at(f)+hen.at(f).at(i).second;
                }
            }
        }
    }
};

int main(){
    ll N,X,Y;
    cin>>N>>X>>Y;
    Dijkstra way(N,N,0);
    rep(co,N-1){
        way.hen.at(co).push_back(P(co+1,1));
        way.hen.at(co+1).push_back(P(co,1));
    }
    way.hen.at(X-1).push_back(P(Y-1,1));
    way.hen.at(Y-1).push_back(P(X-1,1));

    V ans(N,0);
    for(ll j=0;j<N;j++){
        for(ll i=0;i<N;i++)way.cost.at(i)=INF;
        way.cost.at(j)=0;
        if(way.find.empty())way.find.push(j);
        way.search();
        for(ll k=j+1;k<N;k++)ans.at(way.cost.at(k))++;
    }
    for(ll j=1;j<N;j++)cout<<ans.at(j)<<endl;

}


Measured memory_bytes: 384
from collections import Counter
c=Counter()
n=int(input())
lis=[]
for _ in range(n):
    lis.append(input())
for x in lis:
    c[x]+=1

max=0
for k,v in c.items():
    if max<v:
        max=v

lis=[]
for k,v in c.items():
    if max==v:
        lis.append(k)
lis.sort()
for x in lis:
    print(x)




Measured memory_bytes: 35572
#include <iostream>
#include <stdio.h>
using namespace std;

int main()
{ int row, col;
  int pilrow, pilcol;

  scanf("%d %d",&row,&col);
  scanf("%d %d",&pilrow,&pilcol);
  int total=(pilrow*col)+(pilcol*row);
  int kaburu=pilrow*pilcol;
 int akhir= total-kaburu;
  int tots=row*col;
  int y=tots-akhir;
  cout<<y;

    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <utility>
#include <map>
#include <vector>
#include <algorithm>
#include <queue>
#include <math.h>
#include <stack>
#include <set>
#include <deque>
#include <cmath>
#include <cassert>
#include <cstring>

using namespace std;
typedef long long ll;
ll mod = 1e9+7;
#define rep(i,n) for(int i = 0; i < (n); ++i)

int main() {
    int k, s;
    cin >> k >> s;
    ll ans = 0;
    rep(i, k+1) rep(j, k+1) {
        if (s - i - j <= k && s - i - j >= 0) {
            ++ans;
        }
    }
    cout << ans << endl;
    return 0;
}


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

int main() {
  int a,b,c,x;
  cin>>a>>b>>c>>x;
  int ans=0;
  int g=min(a,x/500);
  for(int i=0;i<=g;i++){
    int nokori=x-500*i;
    int h=min(b,nokori/100);
    for(int j=0;j<=h;j++){
      int nokoria=nokori-100*j;
      nokoria/=50;
      if(nokoria<=c) ans++;
    }
  }
  cout<<ans<<endl;
}


Measured memory_bytes: 256
n = int(input())
a = list(map(int, input().split()))
flag = True
odd = []
for i in a:
    if i % 2 == 0:
        if i % 3 == 0 or i % 5 == 0:
            continue
        else:
            flag = False
if flag:
    print("APPROVED")
else:
    print("DENIED")

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

const int mod = 1e9 + 7;

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	
	int H, W;
	cin >> H >> W;
	char a[H][W];
	for (int i = 0; i < H; i++) {
		for (int j = 0; j < W; j++) {
			cin >> a[i][j];
		}
	}
	vector<vector<ll>> dp(H, vector<ll> (W, 0));
	dp[0][0] = 1;
	for (int i = 0; i < H; i++) {
		for (int j = 0; j < W; j++) {
			if (i == 0 && j == 0) {
				continue;
			}
			if (a[i][j] != '.') {
				continue;
			}
			if (i - 1 >= 0) {
				dp[i][j] += dp[i - 1][j];
				if (dp[i][j] >= mod) {
					dp[i][j] -= mod;
				}
			}
			if (j - 1 >= 0) {
				dp[i][j] += dp[i][j - 1];
				if (dp[i][j] >= mod) {
					dp[i][j] -= mod;
				}
			}
		}
	}
	cout << dp[H - 1][W - 1];
	
	return 0;
}


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

int main() {
  int k,a,b;
  cin >> k >> a >> b;
  if (a % k == 0) { cout << "OK" << endl;return 0;}
  int aa = a / k;
  int bb = b / k;
  if(bb > aa){
    cout << "OK" << endl;
    return 0;
  }
  cout << "NG" <<endl;
  return 0;
}

Measured memory_bytes: 3620
using System;
using System.Collections.Generic;

class Program
{
	static void Main(string[] args)
	{
		string[] input = Console.ReadLine().Split(' ');
		long a = long.Parse(input[0]);
		decimal b = decimal.Parse(input[1]);
		decimal ans = (decimal)a * b;
		ans = Math.Floor(ans);
		Console.WriteLine((long)ans);


	}

}


Measured memory_bytes: 27484
#include <iostream>
#include <vector>
#include <cstring>
#include <algorithm>
#include <cassert>
#include <deque>
#include <map>
#include <queue>
#include <climits>
#include <set>
#include <stack>
#include <cmath>
#include <unordered_map>

using namespace std;

#define ll long long
#define MAX 3000
#define MAX1 10000
#define MAX2 100000
#define inf 1000000000
#define eps 1e-12
#define MOD 1000000007

int v[MAX + 5][MAX + 5], r, c;
ll dp[MAX + 5][MAX + 5][4];

ll solve(int x, int y, int d) {
    if (x == r and y == c) {
        return (d <= 2) * v[x][y];
    }
    ll &ret = dp[x][y][d];
    if (ret != -1) {
        return ret;
    }
    ret = 0;
    if (x + 1 <= r) {
        ret = max(ret, solve(x + 1, y, 0));
        if (d <= 2 and v[x][y] > 0) {
            ret = max(ret, solve(x + 1, y, 0) + v[x][y]);
        }
    }
    if (y + 1 <= c) {
        ret = max(ret, solve(x, y + 1, d));
        if (d <= 2 and v[x][y] > 0) {
            ret = max(ret, solve(x, y + 1, d + 1) + v[x][y]);
        }
    }
    return ret;
}

int main() {

    ios_base::sync_with_stdio(0);
    cin.tie(0);
#ifndef ONLINE_JUDGE
    freopen("in.txt", "r", stdin);
    freopen("out.txt", "w", stdout);
#endif

    int k, i, a, b;
    cin >> r >> c >> k;
    for (i = 1; i <= k; ++i) {
        cin >> a >> b;
        cin >> v[a][b];
    }
    memset(dp, -1, sizeof(dp));
    cout << solve(1, 1, 0);

    return 0;
}


Measured memory_bytes: 321524
#include<bits/stdc++.h>
using namespace std;
#define ll  long long
#define endl '\n'
#define FASTINOUT ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
const ll mod = 1000000007;
const double PI = 3.141592653589793238463;
const int N=3e5+10;
int main()
{
    FASTINOUT;
    int x;
    cin>>x;
    string s;
    cin>>s;
    string ans="";
    int open=0,close=0;
    int mn=0;
    for (int i=0;i<x;i++){
       if (s[i]=='(')
            open++;
       else
        close++;
       mn=min(mn,open-close);
    }
    for (int i=0;i<-mn;i++)
        ans+="(";
    for (int i=0;i<x;i++)
        ans+=s[i];
    for (int i=0;i<open-close-mn;i++)
        ans+=")";
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<ll, ll>;
using vll = vector<ll>;
using Graph = vector<vector<int>>;
const ll INF = 1e18;
#define pu push
#define pb push_back
#define mp make_pair
#define print(x) cout << (x) << endl;
#define rep(i,n) for(ll i = 0; i < (n); i++)
#define SORT(x) sort(x.begin(),x.end())
#define POSL(x,v) (lower_bound(x.begin(),x.end(),v)-x.begin())
#define POSU(x,v) (upper_bound(x.begin(),x.end(),v)-x.begin())
#define fi first
#define sc second

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N, M;
    int ans = -1;
    cin >> N >> M;
    if (N==1) {
        vector<bool> Num(10,true);
        rep(i,M) {
            int s, c;
            cin >> s >> c;
            rep(j,10) {
                if (j!=c) {
                    Num.at(j)=false;
                }
            }
        }
        rep(j,10) {
            if(Num.at(j)==true) {
                ans =  j;
                break;
            }
        }
    }
    if (N==2) {
        vector<bool> Num(90,true);
        rep(i,M) {
            int s, c;
            cin >> s >> c;
            if (s==2) {
                rep(j,90) {
                    if ((j+10)%10!=c) {
                        Num.at(j)=false;
                    }
                }
            }
            if (s==1) {
                rep(j,90) {
                    if ((j+10)/10!=c) {
                        Num.at(j)=false;
                    }
                }
            }
        }
        rep(j,90) {
            if(Num.at(j)==true) {
                ans = j+10;
                break;
            }
        }
    }
    if (N==3) {
        vector<bool> Num(900,true);
        rep(i,M) {
            int s, c;
            cin >> s >> c;
            if (s==3) {
                rep(j,900) {
                    if ((j+100)%10!=c) {
                        Num.at(j)=false;
                    }
                }
            }
            if (s==2) {
                rep(j,900) {
                    if (((j+100)/10)%10!=c) {
                        Num.at(j)=false;
                    }
                }
            }
            if (s==1) {
                rep(j,900) {
                    if ((j+100)/100!=c) {
                        Num.at(j)=false;
                    }
                }
            }
        }
        rep(j,900) {
            if(Num.at(j)==true) {
                ans = j+100;
                break;
            }
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include <cstdio>
#include <cstring>
#include <string>
#include <iostream>
#include <cmath>
#include <bitset>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <algorithm>
#include <complex>
#define INF 10000000000000000LL

using namespace std;
typedef long long int ll;

struct edge {int to; long long int cap; int rev;} ;
 
vector<edge> G[20002];
int level[20002];
int iter[20002];
 
void add_edge(int from, int to, long long int cap){
	edge e;
	e.to=to, e.cap=cap, e.rev=G[to].size();
	G[from].push_back(e);
	e.to=from, e.cap=0, e.rev=G[from].size()-1;
	G[to].push_back(e);
}
 
void bfs(int s){
	memset(level, -1, sizeof(level));
	queue<int> que;
	level[s]=0;
	que.push(s);
	while(!que.empty()){
		int v=que.front();
		que.pop();
		for(int i=0; i<G[v].size(); i++){
			edge e=G[v][i];
			if(e.cap>0 && level[e.to]<0){
				level[e.to]=level[v]+1;
				que.push(e.to);
			}
		}
	}
}
 
long long int dfs(int v, int t, long long int f){
	if(v==t) return f;
	for(int &i=iter[v]; i<G[v].size(); i++){
		edge &e=G[v][i];
		if(e.cap>0 && level[v]<level[e.to]){
			long long int d=dfs(e.to, t, min(f, e.cap));
			if(d>0){
				e.cap-=d;
				G[e.to][e.rev].cap+=d;
				return d;
			}
		}
	}
	return 0;
}
 
long long int max_flow(int s, int t){
	long long int flow=0;
	while(1){
		bfs(s);
		if(level[t]<0) return flow;
		memset(iter, 0, sizeof(iter));
		long long int f;
		while((f=dfs(s, t, INF))>0){
			flow+=f;
		}
	}
}

int main()
{
	int h, w;
	scanf("%d %d", &h, &w);
	char a[100][100];
	for(int i=0; i<h; i++){
		scanf("%s", a[i]);
	}
	int s, t, xs, ys, xt, yt;
	for(int i=0; i<h; i++){
		for(int j=0; j<w; j++){
			if(a[i][j]=='S') s=2*(i*w+j)+1, xs=i, ys=j;
			if(a[i][j]=='T') t=2*(i*w+j), xt=i, yt=j;
			if(a[i][j]=='o' || a[i][j]=='S'){
				if(a[i][j]=='o') add_edge(2*(i*w+j), 2*(i*w+j)+1, 1);
				for(int k=0; k<w; k++){
					if(k!=j && (a[i][k]=='o' || a[i][k]=='T')){
						add_edge(2*(i*w+j)+1, 2*(i*w+k), 1);
					}
				}
				for(int k=0; k<h; k++){
					if(k!=i && (a[k][j]=='o' || a[k][j]=='T')){
						add_edge(2*(i*w+j)+1, 2*(k*w+j), 1);
					}
				}
			}
		}
	}
	if(xs==xt || ys==yt){
		printf("%d\n", -1);
		return 0;
	}
	printf("%lld\n", max_flow(s, t));
	return 0;
}

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

#define INF 1e9
using namespace std;

#define REP(i, n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define ALL(a)  (a).begin(),(a).end()

template<class T>
bool chmin(T &a, const T &b) {
    if (b < a) {
        a = b;
        return 1;
    }
    return 0;
}

template<class T>
bool chmax(T &a, const T &b) {
    if (a < b) {
        a = b;
        return 1;
    }
    return 0;
}

typedef long long ll;


int main() {
    int N;
    cin >> N;
    string S;
    char before = '_';
    cin >> S;
    int ans=0;
    REP(i, N) {
        if (before == S[i]) continue;
        else {
            before = S[i];
            ans++;
        }
    }
    cout << ans << endl;
    return 0;
}


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


int main(){

	int t;
	cin >> t;
	string a[4]={"AC","WA","TLE","RE"};
	int b[4]{0};
	while(t--){
        string c;
        cin>>c;
        for(int i=0;i<4;i++){
            if(c==a[i]){
                b[i]++;
                break;
                }
        }
	}
	for(int i=0;i<4;i++){
            cout<<a[i]<<" x "<<b[i]<<"\n";
        }
        return 0;
}


Measured memory_bytes: 3616
#include<bits/stdc++.h>
using namespace std;
int main(){
  string s,t;
  cin>>s>>t;
  int x = stoi(s+t);
  for (int i=1; i<1000; i++){
    if (x == i*i){
      cout << "Yes";
      return 0;
    }
  }
  cout << "No";
}

Measured memory_bytes: 3644
H,W = map(int, input().split())

graph = [[] for _ in range(H+2)]
graph[0].extend(["." for i in range(W+2)])
for h in range(H):
    graph[h+1].append(".")
    graph[h+1].extend(list(input().rstrip()))
    graph[h+1].append(".")
graph[H+1].extend(["." for i in range(W+2)])

canAchieve = True
for h in range(1,H+1):
    for w in range(1,W+1):
        if graph[h][w] == '#':
            if graph[h+1][w] == "#":
                continue
            elif graph[h-1][w] == "#":
                continue
            elif graph[h][w+1] == "#":
                continue
            elif graph[h][w-1] == "#":
                continue
            
            canAchieve = False
            
if canAchieve:
    print("Yes")
else:
    print("No")

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

#define scd second
#define fst first
#define pb push_back
#define mkp make_pair
#define all(x) x.begin(), x.end()

using namespace std;

typedef long long int ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<int> vint;
typedef vector<ll> vlong;
typedef vector<pii> vpii;
typedef vector<pll> vpll;
typedef vector<vint> vvint;
typedef vector<vlong> vvlong;
typedef list<int> lint;
typedef list<ll> llong;
typedef list<pii> lpii;
typedef list<pll> lpll;
typedef list<lint> llint;
typedef list<llong> lllong;

int const N=1e6+100;
ll const LINF=numeric_limits<long long int>::max();
int const INF=numeric_limits<int>::max();
int const BN = 31;

ll gcd(ll a, ll b){
	return b ? gcd(b,a%b) : a;
}

ll pow_mod(ll a, ll e, ll m){
	ll res=1;
	while(e){
		if(e&1) res=res*a%m;
		a=a*a%m;
		e>>=1;
	}
	return res;
}

ll inv_mod(ll b, ll m){
	b%=m;
	ll x=0, y=1, r, q, a=m;
	while(b){
		q=a/b;
		r=a%b;
		a=b;
		b=r;
		r=x;
		x=y;
		y=r-q*y;
	}
	x+=m;
	return x%m;
}

void dfs(int r, vint gr[], vlong &xsum, vlong &ans, ll psum, vint &vst){
	psum+=xsum[r];
	ans[r]=psum;
	vst[r]=0;
	for(auto x : gr[r]){
		if(vst[x]==1){
			dfs(x,gr,xsum,ans,psum,vst);
		}
	}
}

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

	int n, m;
	cin>>n>>m;
	vpii arr;
	for(int i=0; i<n; i++){
		int a, b;
		cin>>a>>b;
		a=m-a;
		if(a>=0) arr.pb({a,-b});
	}
	sort(all(arr));
	ll ans=0, d=0;
	multiset<int> ss;
	for(auto x : arr){
		// cout<<x.fst<<" "<<abs(x.scd)<<" "<<d<<endl;
		if(x.fst>=d){
			ans+=abs(x.scd);
			ss.insert(abs(x.scd));
			d++;
		} else if(!ss.empty()){
			auto itr=ss.begin();
			if(*itr<abs(x.scd)){
				ans-=*itr;
				ss.erase(itr);
				ss.insert(abs(x.scd));
				ans+=abs(x.scd);
			}
		}
	}

	cout<<ans<<endl;
}

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

int main() {
    int a, b;
    cin >> a >> b;

    if ( a <= 5 ) {
        cout << 0 << endl;
    }
    else if ( a <= 12 ) {
        cout << b / 2 << endl;
    }
    else {
        cout << b << endl;
    }

    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
typedef long long ll;
#define pb push_back
#define mod 1000000007ll
const ll maxn = 9e18;
using namespace std;

void solve() {
	ll x;
	cin >> x;
	ll t  = x / 11;
	t = 2 * t;
	int r = x % 11;
	if(r == 0) ;
	else if(r <= 6) t++;
	else if(r <= 11) t += 2;
	cout << t << endl;
}
	

int main() {
	ios_base :: sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	cout.precision(35);
	solve();
	return 0;
}


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

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int n, m;
    cin >> n >> m;
    int L = 0;
    int R = 100001;

    for(int i = 0; i < m; ++i){
        int l, r;
        cin >> l >> r;
        if(L<l) L = l;
        if(R>r) R = r;
    }
    cout << max(0, R - L + 1) << endl;
}

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

using namespace std;

typedef long long ll;

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

	int n;
	cin >> n;

	int max_square = 1;

	for(int i = 1; i * i <= n; i++){
		max_square = i * i;
	}

	cout << max_square << endl;

}


Measured memory_bytes: 256
package main

import (
	"bufio"
	"fmt"
	"os"
)

func main() {
	stdin := bufio.NewScanner(os.Stdin)
	for stdin.Scan() {
		in := stdin.Text()
		out, _ := do(in)
		fmt.Println(out)
	}

}

func do(in string) (string, error) {
	if in == "000" {
		return "0", nil
	}
	if in == "100" || in == "010" || in == "001" {
		return "1", nil
	}
	if in == "110" || in == "101" || in == "011" {
		return "2", nil
	}
	return "3", nil
}


Measured memory_bytes: 640
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace _0257
{
    class Program
    {
        static void Main(string[] args)
        {
            string b1 = Console.ReadLine();
            if (b1 == "1 0 0" || b1 == "0 1 0" || b1 == "0 0 0")
                Console.WriteLine("Close");
            else
                Console.WriteLine("Open");
            Console.ReadLine();
        }
    }
}



Measured memory_bytes: 8960
#
# 6c
#


def main():
    A = [[[0 for i in range(10)] for j in range(3)] for k in range(4)]
    n = int(input())
    for i in range(n):
        b, f, r, v = map(int, input().split())
        A[b-1][f-1][r-1] += v
    for i in range(4):
        for j in range(3):
            print(" ", end="")
            print(*A[i][j])
        if i < 3:
            print("#" * 20)


if __name__ == '__main__':
    main()



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

signed main(){
  int N;
  cin>>N;
  vector<int> A(N);
  rep(i,N)cin>>A[i];
  rep(i,N){
    int G=A[i]%2;
    int H=A[i]%5;
    int K=A[i]%3;
    if(G==0){
      if(!(H==0||K==0)){
        cout<<"DENIED"<<endl;
        return 0;
      }
    }
  }
  cout<<"APPROVED"<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i<(n); i++)
#define reps(i,s,n) for(int i=(s); i<(n); i++)
#define all(v) v.begin(),v.end()
#define outve(v) for(auto i : v) cout << i << " ";cout << endl
#define outmat(v) for(auto i : v){for(auto j : i) cout << j << " ";cout << endl;}
#define in(n,v) for(int i=0; i<(n); i++){cin >> v[i];}
#define out(n) cout << (n) << endl
#define fi first
#define se second
#define pb push_back
#define mod 1000000007
#define infi 1900000000
#define infl 1100000000000000000
#define cyes cout << "Yes" << endl
#define cno cout << "No" << endl
#define csp << " " <<
#define outset(n) cout << fixed << setprecision(n);
using namespace std;
using ll = long long;
using ld = long double;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vs = vector<string>;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;
using pii = pair<int,int>;
using pll = pair<ll,ll>;
using vvp = vector<vector<pair<int,int>>>;
template<typename T> using ve = vector<T>;
template<typename T> using pq2 = priority_queue<T>;
template<typename T> using pq1 = priority_queue<T,vector<T>,greater<T>>;
template<typename T> bool chmax(T &a, T b) {if(a < b) {a = b;return 1;}return 0;}
template<typename T> bool chmin(T &a, T b) {if(a > b) {a = b;return 1;}return 0;}




int main(){
    int N,K;
    cin >> N >> K;
    vl p(N);
    
    in(N,p);
    ll sum = 0;
    rep(i,K) sum += p[i];
    ll res = sum;
    reps(i,K,N){
        sum += p[i];
        sum -= p[i-K];
        chmax(res,sum);
    }
    
    outset(10);
    cout << (ld)(res+(ll)K)/(ld)2 << endl;

    
    
    
    

    return 0;
}


Measured memory_bytes: 1792
#pragma region template
#include "bits/stdc++.h"
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
const long long MOD = 1e9 + 7, MAX = LLONG_MAX, larg = 1e5, INF = -1e9;
long long A, B, C, D, E, F, G, H, I, J, K, L, N, M, O, P, Q, R, S, T, U, V, W;
typedef long long ll;
typedef pair<ll, ll> Pa;

int main() {
    string s;
    cin >> s;
    if(s == "ABC") cout << "ARC";
    else cout << "ABC";
}


Measured memory_bytes: 3648
import sys
sys.setrecursionlimit(10**7)
n = int(input())
d = [int(input()) for _ in range(n)]
r = {v: i for i, v in enumerate(d)}
sz = [1] * n
dsorted = sorted(((di, i) for i, di in enumerate(d)), reverse=True)
ans = []
to = [[] for _ in range(n)]
for di, i in dsorted[:n-1]:
    nd = di + (sz[i] - 1) - (n - 2 - (sz[i] - 1))
    if not nd in r:
        print(-1)
        exit()
    p = r[nd]
    to[p].append(i)
    sz[p] += sz[i]
    ans.append((i+1, p+1))

root = dsorted[-1][1]
def dfs(u, cur=0):
    rv = cur
    for v in to[u]:
        rv += dfs(v, cur + 1)
    return rv

if dfs(root) != d[root]:
    print(-1)
    exit()

for u, v in ans:
    print(u, v)


Measured memory_bytes: 118480
//52行目から編集
#include <iostream>
#include <limits.h>
#include <algorithm>
#include <bitset>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <list>
#include <map>
#include <numeric>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#include <queue>
#include <unordered_map>
#include <unordered_set>
#include <cassert>

using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#define rrep(i,n) for(int i=n-1;i>=0;i--)
#define all(x) (x).begin(),(x).end()
#define mp make_pair
#define pb push_back
#define eb emplace_back

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vector<int> > vvi;
typedef vector<vector<ll> > vvl;
typedef pair<int,int> pi;
typedef pair<ll,ll> pl;

template<class T> bool chmin(T& a,T b){if(a > b){a = b;return true;}else return false;}
template<class T> bool chmax(T& a,T b){if(a < b){a = b;return true;}else return false;}
///////////////////////////////////////////////////////////
int n;
ll ans;
string s;
int pos_a[4010],pos_b[4010],pos_c[4010];

void calc_cum(){
    for(int i = 1;i <= n;i++){
       pos_a[i] = pos_a[i-1] + (s[i-1] == 'R'); 
       pos_b[i] = pos_b[i-1] + (s[i-1] == 'G'); 
       pos_c[i] = pos_c[i-1] + (s[i-1] == 'B'); 
    }
}
long long count_disj(int i,int j){
   int left = i + 1,right = j;
   bool r = 0,g = 0,b = 0;
   if(s[i] == 'R' or s[j] == 'R')r = 1;
   if(s[i] == 'G' or s[j] == 'G')g = 1;
   if(s[i] == 'B' or s[j] == 'B')b = 1;

   int x;
   if(!r)x = 0;
   if(!g)x = 1;
   if(!b)x = 2;

   if(x == 0){
        return pos_a[right] - pos_a[left] - ((j - i) % 2 == 0 && s[(i+j)/2] == 'R');
   }else if(x == 1){
        return pos_b[right] - pos_b[left] - ((j - i) % 2 == 0 && s[(i+j)/2] == 'G');
   }else{
        return pos_c[right] - pos_c[left] - ((j - i) % 2 == 0 && s[(i+j)/2] == 'B');
   }
}
int main(void){
   cin.tie(0);
   ios::sync_with_stdio(false);

   cin >> n >> s;
   calc_cum();
   for(int i = 0;i < n-2;i++){
        for(int j = i + 2;j < n;j++){
            if(s[i] != s[j]){
                ans += count_disj(i,j);
            } 
        }
   }
   cout << ans << '\n';
}


Measured memory_bytes: 3668
<?php

$s = str_split(trim(fgets(STDIN)));
$count = count($s);

$a = array("a" => 1,"b" => 2,"c" => 3,"d" => 4,"e" => 5,"f" => 6,"g" => 7,"h" => 8,"i" => 9,"j" => 10,"k" => 11,"l" => 12,"m" => 13,
"n" => 14,"o" => 15,"p" => 16,"q" => 17,"r" => 18,"s" => 19,"t" => 20,"u" => 21,"v" => 22,"w" => 23,"x" => 24,"y" => 25,"z" => 26);

$i = 0;
while($i < $count){
$num[$i] = strtr($s[$i],$a);
$d[$i] = 27 - $num[$i];
++$i;
}

$i = 0;
$K = trim(fgets(STDIN));
$n = 0;
while($i < $count){
    if($d[$i] != 26 && $d[$i] <= $K - $n){
        $num[$i] = 1;
        $n += $d[$i];
    }
++$i;
}
if($n != $K){
    $num[$count - 1] += $K - $n;
    $num[$count - 1] %= 26;
    if($num[$count - 1] == 0){
        $num[$count - 1] = 26;
    }
}

$i = 0;
while($i < $count){
    echo array_search($num[$i],$a);
    ++$i;
}
echo PHP_EOL;
?>

Measured memory_bytes: 59792
N=int(input())
n=0
a=0
L=sorted([sorted(list(input())) for _ in range(N)])
L.append("p")
for i in range(N):
  if L[i]!=L[i+1]:
    n+=(i-a)*(i-a+1)/2
    a=i+1
print(int(n))

Measured memory_bytes: 25420
#include <algorithm>
#include <array>
#include <cstddef>
#include <cstdint>
#include <iostream>
#include <map>
#include <set>
#include <vector>

using namespace std;

int main()
{
    string str;
    cin >> str;
    cout << count(str.begin(), str.end(), '1') << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
long long fac[4000010], inv[4000010], finv[4000010]; 
long long MOD = 1000000007; 
void COMinit(){
	fac[0] = fac[1] = 1;
	finv[0] = finv[1] = 1;
	inv[1] = 1;
	for(int i = 2; i < 4000005; i++) {
		fac[i] = fac[i - 1] * i % MOD;
		inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
		finv[i] = finv[i - 1] * inv[i] % MOD;
	}
}
long long COM(int n, int k) {
	if (n < k) return 0;
	if (n < 0 || k < 0) return 0;
	return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
int main(){
	int N, K; cin >> N >> K; 
	if(K == 1){
		cout << 1 << "\n"; return 0; 
	}
	COMinit(); 
	long long dp[2005][2005] = {}; // dp[i以上の数を並べ終わり][そこまでに0がj個含まれている]
	long long DP[2005][2005] = {}; // その累積和
	dp[N][0] = 1;
	DP[N][0] = 1; DP[N][1] = 1;
	for(int i = N-1; i >= 1; i--){	
		for(int j = 0; j <= N-i; j++){
			dp[i][j] = DP[i+1][j] * COM((N-i)*(K-1)+j+K-2, K-2) % MOD; 
		}
		DP[i][0] = dp[i][0]; 
		for(int j = 1; j <= N+1-i; j++){
			DP[i][j] = DP[i][j-1] + dp[i][j]; 
			if(DP[i][j] >= MOD) DP[i][j] -= MOD; 
		}
	}
	cout << (DP[1][N] * fac[N]) % MOD << "\n"; 
}

Measured memory_bytes: 160196
#include <iostream>
#include<vector>
#include<algorithm>
#include<bits/stdc++.h>
using namespace std;
int main() {
    cin.tie(NULL);
    ios_base::sync_with_stdio(false);
    string s;
    cin >> s;
    int n = s.size();
    bool  f = false;
    for(int i = 0 ; i < n ; i++){
        if(s[i] == '7')
            f = true;
    }
    if(f)
        cout<<"Yes";
    else
        cout<<"No";
}


Measured memory_bytes: 3648
import math

N,H = map(int, input().split())
A = 0
B = []
for i in range(N):
  a,b = map(int, input().split())
  A = max(A, a)
  B.append(b)

B.sort(reverse=True)

accum_B = [0] * (N+1)
for i in range(1, N+1):
  accum_B[i] = accum_B[i-1] + B[i-1]

ans = H+1
for i in range(N+1):
  if H - accum_B[i] <= 0:
    ans = min(ans, i)
  else:
    ans = min(ans, i + math.ceil((H - accum_B[i]) / A))

print(ans)


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

int main(){
  int a,b;
  cin >> a >> b;
  if(a%3==0 || b%3==0 || (a+b)%3==0){
    cout << "Possible" << endl;
  }else{
    cout << "Impossible" << endl;
  }
}

Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.*;

import static java.lang.Integer.parseInt;

/**
 * Look for the Winner!
 */
public class Main {

	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String line;
		String[] words;

		while ((line = br.readLine()) != null && !line.isEmpty()) {

			int n = parseInt(line);
			if (n == 0) break;

			line = br.readLine();

			Candidate[] idx = new Candidate['Z' - 'A' + 1];
			List<Candidate> list = new ArrayList<>();
			list.add(new Candidate('\0'));

			//solve
			Candidate c = null;
			int d = -1;

			for (int i = 0, j = 1; i < line.length(); i += 2, j++) {
				int _c = line.charAt(i) - 'A';
				if (idx[_c] == null) {
					idx[_c] = new Candidate((char) (_c + 'A'));
					list.add(idx[_c]);
				}
				idx[_c].vote++;

				Collections.sort(list, new Comparator<Candidate>() {
					@Override
					public int compare(Candidate o1, Candidate o2) {
						return Integer.compare(o2.vote, o1.vote);
					}
				});

				if (list.get(0).vote > list.get(1).vote + n - j) {
					c = list.get(0);
					d = j;
					break;
				}
			}

			if (c != null) {
				System.out.printf("%c %d%n", c.name, d);
			} else {
				System.out.println("TIE");
			}
		} //end while

	} //end main
}

class Candidate {
	char name;
	int vote = 0;

	Candidate(char name) {
		this.name = name;
	}
}

Measured memory_bytes: 35036
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <iomanip>
#include <cmath>
#include <cstdlib>
#include <map>
#define ll long long
#define REP(i, x) for(int (i) = 0; (i) < (x); (i) ++)
#define pi 3.1415926535
const int MOD = 1000000007;
using namespace std;

int main() {
	int n;
	vector<vector<int>>alp(n, vector<int>(26, 0));
	cin >> n;
	string s;
	REP(i, n) {
		cin >> s;
		REP(j, s.size()) {
			alp[i][s[j]-'a']++;
		}
	}
	int min[26];
	REP(i, 26){
		int m = 10000000;
		REP(j, n) {
			if (alp[j][i] < m) {
				m = alp[j][i];
				min[i] = alp[j][i];
			}
		}
	}
	REP(i, 26) {
		char c = 'a';
		REP(j, min[i]) {
			printf("%c", c + i);
		}
	}
	return 0;
}

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

using namespace std;

const int maxn=1e5+5;

typedef long long ll;

char s[maxn];

int main(){
	scanf("%s",s);
	if(s[0]=='S'){
		printf("Cloudy");
	}
	else if(s[0]=='R'){
		printf("Sunny");
	}
	else{
		printf("Rainy");
	}
	return 0;
} 

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <iomanip>
#include <cmath>
#include <map>
#include <ctype.h>
using namespace std;

typedef long long ll;

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

int main() {
  int d, n;
  cin >> d >> n;
  int res = n * pow(100, d);
  if (n == 100) res += pow(100, d);
  cout << res << endl;
  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<vector>
#include<stack>
#include<queue>
#include<cstdio>
#include<climits>
#include<cmath>
#include<cstring>
#include<string>
#include<complex>
#include<iomanip>

#define EPS (1e-10)
using namespace std;
#define PI (3.1415926535)

int main(){
	int i;
	bool b;
	string str;
	string word[3] = {"the", "this", "that"};

	while(getline(cin, str)){
		b = false;
		for(i = 0; i < 26 && !b; i++){
			for(int j = 0; j < str.size(); j++){
				if(str[j] >= 'a' && str[j] <= 'z'){
					str[j]++;
					if(str[j] > 'z'){
						str[j] -= 26;
					}
				}
			}
			for(int j = 0; j < 3; j++){
				if(str.find(word[j]) != -1){
					b = true;
					break;
				}
			}
		}
		cout << str << endl;
	}


	return 0;
}

Measured memory_bytes: 1188
import java.util.Scanner;

class Main {
    public static void main(String[] args) {
        Scanner s = new Scanner(System.in);
        String str = s.next();
        System.out.println(str.charAt(2) == str.charAt(3) && str.charAt(4) == str.charAt(5) ? "Yes" : "No");
    }
}

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

using namespace std;

bool debug = true;

struct food {
    string name;
    int w, s;
    bool operator<(const food& o) const {
        return w == o.w ? (s == o.s ? name < o.name : s < o.s) : w < o.w;
    }
};

int sum(vector<food> ns) {
    int ret = 0;
    for (int i = 0; i < ns.size(); i++) 
        ret += ns[i].w;
    return ret;
}

bool compare_result(const vector<food>& a, const vector<food>& b) {
    //for (int i = 0; i < a.size(); i++) cout << a[i].w << ' '; cout << endl;
    //for (int i = 0; i < b.size(); i++) cout << b[i].w << ' '; cout << endl;
    for (int i = 0; i < a.size(); i++) {
        if (a[i].w > b[i].w) return true;
        if (a[i].w == b[i].w) continue;
        else return false;
    }
    return true;
}

int n;
int main() {
    while (cin >> n, n != 0) {
        vector<food> foods(n);
        for (int i = 0; i < n; i++) {
            food f;
            cin >> f.name >> f.w >> f.s;
            foods[i] = f;
        }
        sort(foods.begin(), foods.end());
        int total_weight = sum(foods);
        vector<food> res(foods);
        do {
            //for (int i = 0; i < n; i++) cout << foods[i].name << ' '; cout << endl;
            int weight_above = total_weight;
            bool found = true;
            for (int i = 0; i < n; i++) {
                weight_above -= foods[i].w;
//                cout << foods[i].name << ' ' << foods[i].s << ' ' << weight_above << endl;
                if (foods[i].s < weight_above) {
                    found = false;
                    break;
                }
            }
            if (!found) {
                //cout << weight_above << endl;
                continue;
            } else {
                if (compare_result(foods, res)) {
                    res = foods;
                    //for (int i = 0; i < n; i++) cout << res[i].name << ' '; cout << endl;
                }
                //for (int i = 0; i < n; i++) 
                //    cout << foods[i].name << ' '
                //         << foods[i].w    << ' '
                //         << foods[i].s    << ' ' << endl;
                //if (debug) cout << endl;
            }
        } while (next_permutation(foods.begin(), foods.end()));
        for (int i = 0; i < n; i++) 
            //cout << res[i].name << ' '
            //     << res[i].w    << ' '
            //     << res[i].s    << ' ' << endl;
            cout << res[i].name << endl;
        
    }
    return 0;
}

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


int main() {
  int N;
  cin>>N;
  vector<int> vec(N);
  for(int i=0;i<N;i++){
    cin>>vec.at(i);
  }
  reverse(vec.begin(),vec.end());
  for(int i=1;i<N;i++){
    if(vec.at(i-1)+1<(vec.at(i))){
      cout<<"No"<<endl;
      return 0;
    }
    else if(vec.at(i-1)+1==vec.at(i)) vec.at(i)--;
  }
  cout<<"Yes"<<endl;
  
  
  
}

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

int main() {
    int n;
    string s;
    cin >> n >> s;
    int x = 0, x_max = 0;
    for (int i = 0; i < n; i++) {
        if (s[i] == 'I')
            x++;
        else
            x--;
        if (x > x_max) x_max = x;
    }
    cout << x_max << endl;
    return 0;
}

Measured memory_bytes: 3624
#include "bits/stdc++.h"
using namespace std;
using ll     = long long;
using pii    = pair<int, int>;
using pll    = pair<ll, ll>;
using vi     = vector<int>;
using vl     = vector<ll>;
using vvi    = vector<vi>;
using vvl    = vector<vl>;
const ll INF = 1LL << 60;
const ll MOD = 1000000007;
template <class T>
bool chmax(T &a, const T &b) {
    return (a < b) ? (a = b, 1) : 0;
}
template <class T>
bool chmin(T &a, const T &b) {
    return (b < a) ? (a = b, 1) : 0;
}
template <class C>
void print(const C &c, std::ostream &os = std::cout) {
    std::copy(std::begin(c), std::end(c), std::ostream_iterator<typename C::value_type>(os, " "));
    os << std::endl;
}

int main() {
    ll n, k;
    cin >> n >> k;
    vl a(n);
    ll ret = 0;
    for (int i = 0; i < n; ++i) {
        cin >> a[i];
        a[i] %= k;
        // if (a[i] == 1 && i != 0)
        //     ret++;
    }
    for (int i = 1; i < n; ++i) {
        a[i] = (a[i] + a[i - 1]) % k;
    }
    for (int i = 0; i < n; ++i) {
        a[i] = ((a[i] - i - 1) % k + k) % k;
    }
    map<ll, ll> cnt;
    cnt[0]++;
    for (int i = 0; i < n; ++i) {
        if (i == k-1)
            cnt[0]--;
        if (i >= k)
            cnt[a[i - k]]--;
        // int tag = 0;
        // if (a[i] == 0)
        //     tag = 0;
        // else if (a[i] == 1)
        //     tag = 3;
        // else if (a[i] == 2)
        //     tag = 2;
        // else if (a[i] == 3)
        //     tag = 1;
        ret += cnt[a[i]];
        cnt[a[i]]++;
    }
    cout << ret << "\n";
    return 0;
}

Measured memory_bytes: 14336
n = int(input())
h = list(map(int, input().split()))

dp = [0]*n
dp[1] = abs(h[1] - h[0])
for i in range(2,n):
  dp[i] = min(dp[i-1]+abs(h[i-1] - h[i]),dp[i-2]+abs(h[i-2] - h[i]))

print(dp[-1])

Measured memory_bytes: 13928
// https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8
#[allow(unused_macros)]
macro_rules! p {
    ($($x:expr),*) => {
        $(println!("{:?}", $x);)*
    };
}
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        #[allow(unused_mut)]
        let mut s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};

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

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

macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };

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

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

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

    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}
use std::cmp::max;
fn main(){
    input!{
        a:i32,
        b:i32
    }
    p!([a+b,a-b,a*b].iter().max().unwrap());
}

Measured memory_bytes: 4352
#include <bits/stdc++.h>
using namespace std;
int main() {
  int n,m,x,l=0,r=0; cin>>n>>m>>x;
  int a[m]; for(int i=0; i<m; i++) cin>>a[i];
  for(int i=0; i<m; i++){
    if(a[i]<x) l++;
    else r++;
  }
  cout<<min(l,r);
}


Measured memory_bytes: 256
typedef long long ll;
#include <bits/stdc++.h>
using namespace std;
template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
    std::fill( (T*)array, (T*)(array+N), val );
}

int main() {
    ll n,k;
    string s;
    std::cin >> n>>k;
    std::cin >> s;
    if(s[k-1] == 'A'){
        s[k-1] = 'a';
    }else if(s[k-1] == 'B'){
        s[k-1] = 'b';
    }else if(s[k-1] == 'C'){
        s[k-1] = 'c';
    }
    std::cout << s << std::endl;
    
}

Measured memory_bytes: 256
bingo = [list(map(int,input().split())) for i in range(3)]
n= int(input())
bs = [int(input()) for i in range(n)]

bingo.append([bingo[0][0], bingo[1][1], bingo[2][2]])
bingo.append([bingo[0][2], bingo[1][1], bingo[2][0]])
bingo.append([bingo[0][0], bingo[1][0], bingo[2][0]])
bingo.append([bingo[0][1], bingo[1][1], bingo[2][1]])
bingo.append([bingo[0][2], bingo[1][2], bingo[2][2]])


print("Yes" if any([len([j for j in k if j in bs])==3 for k in bingo]) else "No")

Measured memory_bytes: 3064
#include<iostream>
#include<algorithm>
#include<vector>
#include<stack>
#include<queue>
#include<string>
#include<cstring>
using namespace std;
typedef long long lng;
typedef unsigned long long ulng;

#define pb push_back
#define SZ(a) int((a).size())
#define ALL(a) (a).begin(), (a).end
#define FOR(i,a,b) for(int i=(a); i<=(b); ++i)
#define FORD(i,b,a) for(int i=(b); i>=(a); --i)
#define REP(i,n) FOR(i,0,n-1)
#define UNIQUE(a) a.erase(unique(ALL(a)), a.end())

lng power(lng b, lng e) {lng sol=1; while(e>0) {if(e&1) {sol=sol*b;} e>>=1; b*= b;} return sol;}



int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
  
 int N;
  cin >> N;
  int n2 = N;
  
  int hs = 0;
  while(n2 > 0) {
hs += n2%10;
    n2 /= 10;
  }
  if(N%hs) 
cout << "No" << endl;
    else
      cout << "Yes" << endl;
}


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


Measured memory_bytes: 7000
#073-C
def IL(): return list(map(int,input().split()))
def SL(): return input().split()
def I(): return int(input())
def S(): return input()
n=I()
a=[]
for i in range(n):
    t=I()
    a.append(t)
b=list(set(a))
c={}
cnt=0
for i in b:
    c[i]=0
for i in a:
    c[i]+=1
for i in c.keys():
    if c[i]%2==1:
        cnt+=1
print(cnt)

Measured memory_bytes: 19980
#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>;

const int INF = 1e8;
const int H = 50, W = 50;

int h, w;
char s[H][W];

int d[H][W];
int dx[4] = {1, -1, 0, 0}, dy[4] = {0, 0, 1, -1};

int main() {
  cin >> h >> w;
  rep(i, h) rep(j, w) cin >> s[i][j];
  rep(i, h) rep(j, w) d[i][j] = INF;
  queue<P> que;
  d[0][0] = 1;
  que.push(make_pair(0, 0));
  while (que.size()) {
    int x = que.front().first;
    int y = que.front().second;
    que.pop();
    rep(i, 4) {
      int nx = x + dx[i];
      int ny = y + dy[i];
      if (nx < 0 || nx >= h || ny < 0 || ny >= w) continue;
      if (s[nx][ny] == '#') continue;
      if (d[nx][ny] > d[x][y] + 1) {
        d[nx][ny] = d[x][y] + 1;
        que.push(make_pair(nx, ny));
      }
    }
  }
  if (d[h - 1][w - 1] == INF) {
    cout << -1 << endl;
    return 0;
  }
  int ans = -d[h - 1][w - 1];
  rep(i, h) rep(j, w) if (s[i][j] == '.') ans++;
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 3644
#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>
#include <functional>
using namespace std;
using namespace __gnu_pbds;

#define ll long long
#define mk make_pair

template <class key, class cmp = std::less<key>>
using ordered_set = tree<key, null_type, cmp, rb_tree_tag, tree_order_statistics_node_update>;
const ll mod = 1e9 + 7;

void solve()
{
    ll n;
    cin >> n;
    ll ans=0;
    for (int i = 1; i <= n; i++)
    {
        for (int j = 1; j <= n; j++)
        {
            for (int k = 1; k <= n; k++)
            {
                ans+=__gcd(i,__gcd(j, k));
            }
        }
    }
    cout<<ans<<endl;
}

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

    // ll t;
    // cin >> t;

    // while (t--)
    // {
    //     solve();
    // }
    solve();
    return 0;
}

Measured memory_bytes: 3652
use std::io;


/// https://beta.atcoder.jp/contests/arc076/tasks/arc076_a
fn main() {
    let (n, m) = {
        let i = read::<usize>();
        (i[0], i[1])
    };

    let md = 1_000_000_000 + 7;
    if (n as isize - m as isize).abs() > 1 { println!("0"); }
    else if (n as isize - m as isize).abs() == 1 { println!("{}", (fact(n) * fact(m)) % md); }
    else if n == m { println!("{}", 2 * ((fact(n) * fact(m)) % md) % md); }
}
 
fn fact(n: usize) -> usize {
    let m = 1_000_000_000 + 7;
    match n {
        1 => 1,
        _ => n * fact(n - 1) % m,
    }
}


#[allow(dead_code)]
fn read<T>() -> Vec<T>
where T:
    std::str::FromStr,
    T::Err: std::fmt::Debug {

    let mut buf = String::new();
    io::stdin().read_line(&mut buf).unwrap();
    buf.split_whitespace()
        .map(|s| s.trim().parse().unwrap())
        .collect()
}

#[allow(dead_code)]
fn read_one<T>() -> T
where T:
    std::str::FromStr,
    T::Err: std::fmt::Debug {

    let mut buf = String::new();
    io::stdin().read_line(&mut buf).unwrap();
    buf.trim().parse().unwrap()
}

Measured memory_bytes: 5884
from collections import deque
n = int(input())
q = deque()
for i in range(n):
    cmd = input().split()
    if cmd[0] == "insert":
        q.appendleft(cmd[1])
    elif cmd[0] == "delete":
        try:
            q.remove(cmd[1])
        except ValueError:
            pass
    elif cmd[0] == "deleteFirst":
        q.popleft()
    elif cmd[0] == "deleteLast":
        q.pop()
 
print(" ".join(q))

Measured memory_bytes: 71924
#include<iostream>
#include<cstdio>
#include<cstring>
using namespace std;
int main(){
  char str[11]={9};
  char data[11];
  int size=0;
  cin >> data;
  int len=strlen(data);
  for(int i=0;i<len;i++){
    if(data[i]=='0'){
      str[size]='0';
      size++;
    } else if(data[i]=='1'){
      str[size]='1';
      size++;
    } else if(data[i]=='B'){
      if(size != 0){
	size--;
	str[size]='9';
      }
    }
  }
  for(int i=0;i<size;i++){
    cout << str[i];
  }
  cout << endl;
  return 0;
}


Measured memory_bytes: 256