akhauriyash/Code-Regression huggingface dataset:
import math
from collections import deque
from collections import defaultdict

import itertools as it

#自作関数群
def readInt():
	return int(input())
def readInts():
	return list(map(int, input().split()))
def readChar():
	return input()
def readChars():
	return input().split()
def factorization(n):
	res = []
	if n%2==0:
		res.append(2)
	for i in range(3,math.floor(n//2)+1,2):
		if n%i==0:
			c = 0
			for j in res:
				if i%j==0:
					c=1
			if c==0:
				res.append(i)
	return res
def fact2(n):
	p = factorization(n)
	res = []
	for i in p:
		c=0
		z=n
		while 1:
			if z%i==0:
				c+=1
				z/=i
			else:
				break
		res.append([i,c])
	return res
def fact(n):#階乗
	ans = 1
	m=n
	for _i in range(n-1):
		ans*=m
		m-=1
	return ans
def comb(n,r):#コンビネーション
	if n<r:
		return 0
	l = min(r,n-r)
	m=n
	u=1
	for _i in range(l):
		u*=m
		m-=1
	return u//fact(l)
def combmod(n,r,mod):
	return (fact(n)/fact(n-r)*pow(fact(r),mod-2,mod))%mod
def printQueue(q):
	r=copyQueue(q)
	ans=[0]*r.qsize()
	for i in range(r.qsize()-1,-1,-1):
		ans[i] = r.get()
	print(ans)
class UnionFind():
	def __init__(self, n):
		self.n = n
		self.parents = [-1]*n

	def find(self, x): # root
		if self.parents[x]<0:
			return x
		else:
			self.parents[x] = self.find(self.parents[x])
			return self.parents[x]

	def union(self,x,y):
		x = self.find(x)
		y = self.find(y)

		if x==y:
			return

		if self.parents[x]>self.parents[y]:
			x,y = y,x

		self.parents[x]+=self.parents[y]
		self.parents[y]=x

	def size(self,x):
		return -1*self.parents[self.find(x)]

	def same(self,x,y):
		return self.find(x)==self.find(y)

	def members(self,x): # much time
		root = self.find(x)
		return [i for i in range(self.n) if self.find(i)==root]

	def roots(self):
		return [i for i,x in enumerate(self.parents) if x<0]

	def group_count(self):
		return len(self.roots())

	def all_group_members(self):
		return {r: self.members(r) for r in self.roots()} # 1~n
def bitArr(n):#ビット全探索
	x = 1
	zero = "0"*n
	ans = []
	ans.append([0]*n)
	for i in range(2**n-1):
		ans.append(list(map(lambda x:int(x),list((zero+bin(x)[2:])[-1*n:]))))
		x+=1
	return ans;
def arrsSum(a1,a2):
	for i in range(len(a1)):
		a1[i]+=a2[i]
	return a1
def maxValue(a,b,v):
	v2 = v
	for i in range(v2,-1,-1):
		for j in range(v2//a+1): #j:aの個数
			k = i-a*j
			if k%b==0:
				return i
	return -1
def copyQueue(q):
	nq = queue.Queue()
	n = q.qsize()
	for i in range(n):
		x = q.get()
		q.put(x)
		nq.put(x)
	return nq
def get_sieve_of_eratosthenes(n):
	#data = [2]
	data = [0,0,0]
	for i in range(3,n+1,2):
		data.append(i)
		data.append(0)
	for i in range(len(data)):
		interval = data[i]
		if interval!=0:
			for j in range(i+interval,n-1,interval):
				data[j] = 0
	#ans = [x for x in data if x!=0]
	ans = data[:]
	return ans

ans = 0

n,d = readInts()
x = []
for i in range(n):
	x.append(readInts())

for i in list(it.combinations(range(0,n),2)):
	tmp = 0
	for j in range(d):
		tmp+=(x[i[0]][j]-x[i[1]][j])**2
	if tmp==(int(tmp**0.5))**2:
		ans+=1

print(ans)

Measured memory_bytes: 3444
#include <bits/stdc++.h>
 
using namespace std;
typedef long long ll;
typedef vector<int> VI;
ll mm=1000000000;ll MM=mm+7;
#define rep(i, n) for(int i=0;i<n;i++)
#define PI 3.141592653589793
 

 

 
int main(){
   int n;
   cin >> n;
   VI a(n);
   rep(i,n)cin >> a.at(i);
   ll sum=0;
   rep(i,n){
      sum+=a.at(i);
   }
   int dif=100000000;
   int ans=1000;
   rep(i,n){
      int x=a.at(i)*n;
      int y=abs(sum-x);
      if(y<dif){
         dif=y;
         ans=i;
      }
   }
   cout << ans << endl;
   


} 


Measured memory_bytes: 3588
#include "iostream"
#include "vector"
#include "string"
#include "algorithm"
#include "math.h"
#include "cstring"
#include "stack"
#include "queue"

using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<vector<int> > mat;

int main()
{
  string s;
  cin >> s;
  int size = s.size();
  if (size == 2)
  {
    if (s[0] == s[1])
    {
      cout << 1 << " " << 2 << "\n";
    }
    else
    {
      cout << -1 << " " << -1 << "\n";
    }
  }
  else
  {
    bool check = false;
    for (int i = 0; i < size - 2; i++)
    {
      if (s[i] == s[i + 1] || s[i] == s[i + 2] || s[i + 1] == s[i + 2])
      {
        cout << i + 1 << " " << i + 3 << "\n";
        check = true;
        break;
      }
    }
    if (!check)
    {
      cout << -1 << " " << -1 << "\n";
    }
  }
}

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

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, n) for (int i = 1; i <= (int)(n); i++)
using ll = long long;

/*
 string -> int : stoi(S);
 int -> string : to_string(N);
 Sのn文字以降をm文字取り出す : S.substr(n,m)

 int: -2,147,483,648 ～ 2,147,483,647 (2×10^9)
 ll: -9,223,372,036,854,775,808 ~ 9,223,372,036,854,775,807 (9×10^18)

*/

int main() {

 ll n, count=0, ans=1;
 ll h,w;
 cin >> h >> w;
 vector<string> s(h);
 
 
 vector<vector<ll>> a(h),b(w),c(h);
 rep(i,h){
   cin >> s[i];
 }

 rep(i,h){
   int left=0,right;
   rep(l,w){
     if(s[i].at(l)=='#'||l==w-1){
       right = l;

       if(l==w-1&&s[i].at(l)=='.'){
         for (int m = left; m <= right; m++){
          a[i].push_back(right-left+1);
         }
       }

       else {
         for (int m = left; m <= right; m++){
          if(m==right) a[i].push_back(0);
          else a[i].push_back(right-left);
         }
       }
       left=right+1;

     }
   }
 }

 rep(l,w){
   int left=0,right;
   rep(i,h){
     if(s[i].at(l)=='#'||i==h-1){
       right = i;

       if(i==h-1&&s[i].at(l)=='.'){
         for (int m = left; m <= right; m++){
          b[l].push_back(right-left+1);
         }
       }

       else {
         for (int m = left; m <= right; m++){
          if(m==right) b[l].push_back(0);
          else b[l].push_back(right-left);
         }
       }
       left=right+1;

     }
   }
 }
 

 rep(i,h){
   rep(l,w){
     ll d = (a[i][l]+b[l][i]-1);
     ans = max(d,ans);
   }
 }
 
 cout << ans << endl;
}

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

using namespace std;

#define lp(i,n) for(int i = 0; i <n;i++)
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define MP make_pair
#define SZ(v) ((int)((v).size()))
typedef long long ll;

const ll MOD = 1e9 + 7;
const int OO = (int)1e6;
const int N = (int)1e7;

void init(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
}
int s[100][100];
int main() {
	#   ifdef LOCAL_PROJECT
        freopen("in.txt", "r", stdin);
    #   endif
    int n,m;
    scanf("%d%d",&n,&m);
    vector<int>kk;
    for(int i=0;i<m;i++){
        int k;
        scanf("%d",&k);
        kk.push_back(k);
        for(int j=0;j<k;j++){
        scanf("%d",&s[i][j]);
        s[i][j]--;
        }
    }
    vector<int>p(m);
    for(int i=0;i<m;i++){
        scanf("%d",&p[i]);
    }
    ll cnt =0;
    for(int i=0;i<(1<<n);i++){
        bool f =true;
        for(int j=0;j<m;j++){
            int res =0;
            for(int k=0;k<kk[j];k++){
                if((i>>s[j][k])&1){
                    res++;
                }
            }
            res%=2;
            if(res!=p[j])
                f=false;
        }
        if(f)cnt++;
    }
    printf("%lld",cnt);
    return 0;
}

Measured memory_bytes: 256
Scanf.scanf "%d" (fun n ->
    let a = Array.init n (fun _ -> Scanf.scanf " %d" (fun a -> a)) in

    let rec loop i prev acc =
        if i = n then acc else
            if a.(i) >= prev then loop (i + 1) a.(i) acc else
                let d = prev - a.(i) in
                loop (i + 1) prev (acc + d)
    in
    loop 0 0 0 |> Printf.printf "%d\n"
)

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

int main()
{
  int a, b, c;

  cin >> a >> b >> c;

  int cnt = 0;
  for( int i = a; i <=b; i++ ) {
    if( c % i == 0 ) {
      cnt += 1;
    }
  }
  cout << cnt << endl;

  return 0;
}

Measured memory_bytes: 3096
#include <iostream>
#include <vector>
#include <algorithm>
#include <set>
#include <map>
#include <deque>
#include <queue>
#include <string>
#include <string.h>
#include <math.h>
#include <iomanip>
using namespace std;

#define int64 long long
#define pii pair <int64, int64>
#define fr first
#define sc second
#define heap priority_queue
struct piii{
    int64 fr, sc, th;
    bool operator < (const piii &b){
        if (fr != b.fr) return fr < b.fr;
        if (sc != b.sc) return sc < b.sc;
        return th < b.th;
    }
};
///////////////////////////////////////////////
///////////////////////////////////////////////

int n, res;
int a[100005];

int main(){
    cout << setprecision(2) << fixed;
    ios::sync_with_stdio(false), cin.tie(0);
    //freopen("input.txt", "r", stdin);
    cin >> n;
    for (int i = 0; i < n; i++) cin >> a[i];
    int cnt = 0;
    for (int i = n - 2; i >= 0; i--){
        if (a[i] < a[i + 1]) cnt = 0;
        else cnt++;
        res = max(res, cnt);
    }
    cout << res;
    return 0;
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
#define FOR(I,X,Y) for(long long (I)=(X);(I)<(Y);(I)++)
#define REP(I,X,Y) for(long long (I)=(Y)-1;(I)>=(X);(I)--)
#define ALL(X) (X).begin(),(X).end()
#define pb push_back
#define COUNT(V,X) upper_bound((V).begin(),(V).end(),X)-lower_bound((V).begin(),(V).end(),X)
#define debug(x0123456789) cerr<<#x0123456789<<':'<<x0123456789<<endl;
#define DEBUG(v) cerr<<#v<<':';for(auto x0123456789:v)cerr<<x0123456789<<' ';cerr<<endl;
#define INF 1000000007
#define LINF 1000000000000000007
#define EPS 1e-9
typedef long long ll;

struct Graph{
  long long V;
  long long E;
  //u,v,weight,cap
  vector<tuple<long long,long long,long long,long long>> edges;
  void add(long long u,long long v,long long weight,long long capacity){edges.push_back(make_tuple(u,v,weight,capacity));}
};

long long max_flow(const Graph &G,const long long &start,const long long &end){
  long long cf[G.V][G.V],ans=0;
  for(long long i=0;i<G.V;i++)for(long long j=0;j<G.V;j++)cf[i][j]=0;
  for(long long i=0;i<G.E;i++)cf[get<0>(G.edges[i])][get<1>(G.edges[i])]=get<3>(G.edges[i]);
  queue<long long> que;
  while(1){
    que.push(start);
    long long dmin[G.V];
    for(long long i=0;i<G.V;i++)dmin[i]=-1;
    dmin[start]=0;
    while(que.size()){
      long long n=que.front();
      for(long long i=0;i<G.V;i++){
        if(n!=i&&cf[n][i]>0&&dmin[i]==-1){
          dmin[i]=n;
          que.push(i);
        }
      }
      que.pop();
    }
    if(dmin[end]==-1)break;
    vector<long long> way;
    long long n=end;
    while(n!=start){
      way.push_back(n);
      n=dmin[n];
    }
    way.push_back(start);
    long long MIN=1000000007;
    for(long long i=0;i<way.size()-1;i++)MIN=min(MIN,cf[way[i+1]][way[i]]);
    for(long long i=0;i<way.size()-1;i++){
      cf[way[i]][way[i+1]]+=MIN;
      cf[way[i+1]][way[i]]-=MIN;
    }
    ans += MIN;
  }
  return ans;
}

signed main(){
    Graph G;
    cin >> G.V >> G.E;
    ll u,v,c;
    FOR(i,0,G.E){
        cin >> u >> v >> c;
        G.add(u,v,0,c);
    }
    cout << max_flow(G,0,G.V-1) << endl;
}


Measured memory_bytes: 3304
N,M = map(int, input().split())
Si = [0]*M
Ci = [0]*M
lastcheck = 1
precheck = 0
sum = 0
for i in range(M):
    Si[i], Ci[i] = map(int, input().split())
if N==1:
    for i in range (M):
        sum +=Ci[i]
        if Si[i]==1 and Ci[i]==0:
            sum =0
        for j in range(i+1,M):
            if Si[i]==Si[j]:
                sum-=int(Ci[i])
                if Ci[i] != Ci[j]:
                    lastcheck=0
elif N==2:
    for i in range (M):
        if Si[i] == 1:
            if Si[i]==1 and Ci[i]==0:
                lastcheck=0
            sum +=Ci[i]*10
            for j in range(i+1,M):
                if Si[i]==Si[j]:
                    sum-=int(Ci[i]*10)
                    if Ci[i] != Ci[j]:
                        lastcheck=0
        else:
            sum +=Ci[i]
            for j in range(i+1,M):
                if Si[i] == Si[j]:
                    sum-=int(Ci[i])
                    if Ci[i] != Ci[j]:
                        lastcheck=0
else:
    for i in range (M):
        if Si[i] == 1:
            if Si[i]==1 and Ci[i]==0:
                lastcheck=0
            sum+=int(Ci[i]*100)
            for j in range(i+1,M):
                if Si[i]==Si[j]:
                    sum-=int(Ci[i]*100)
                    if Ci[i] != Ci[j]:
                        lastcheck=0
        elif Si[i] == 2:
            sum +=Ci[i]*10
            for j in range(i+1,M):
                if Si[i] == Si[j]:
                    sum-=int(Ci[i]*10)
                    if Ci[i] != Ci[j]:
                        lastcheck=0
        else:
            sum +=Ci[i]
            for j in range(i+1,M):
                if Si[i] == Si[j]:
                    sum-=int(Ci[i])
                    if Ci[i] != Ci[j]:
                        lastcheck=0
for i in range(M):
    if Si[i] == 1:
        precheck+=1
if precheck == 0:
    if N == 3:
        sum +=100
    elif N == 2:
        sum +=10
    else:
        sum+=0
if lastcheck == 0:
    print('-1')
else:
    print(sum)

Measured memory_bytes: 3192
#pragma GCC optimize ("O3")
#include <bits/stdc++.h>
typedef long double ld;

using namespace std;

const int N = 105;

struct Pt {
  ld x, y, ang;
  Pt(ld _x=0, ld _y=0): x(_x), y(_y), ang(atan2(_y, _x)){
    if(ang < 0) ang += 2 * M_PI;
  };
  Pt operator+(const Pt &a) const {
    return Pt(x+a.x, y+a.y);
  }
  Pt operator-(const Pt &a) const {
    return Pt(x-a.x, y-a.y);
  }
  Pt operator*(const ld &a) const {
    return Pt(x*a, y*a);
  }
  Pt operator/(const ld &a) const {
    return Pt(x/a, y/a);
  }
  ld operator*(const Pt &a) const {
    return x*a.x + y*a.y;
  }
  ld operator^(const Pt &a) const {
    return x*a.y - y*a.x;
  }
  bool operator<(const Pt& ret) const {
    return ang < ret.ang;
  }
};
ld norm2(const Pt &a) {
  return a*a;
}
ld norm(const Pt &a) {
  return sqrt(norm2(a));
}

int n;
vector<Pt> v;

void init() {
  cin >> n;
  for(int i = 0 ; i < n ; ++i) {
    ld x, y; cin >> x >> y;
    v.push_back(Pt(x, y));
  }
}
void solve() {
  sort(v.begin(), v.end());
  ld ans = 0;
  v.insert(v.end(), v.begin(), v.end());
  for(int i = 0 ; i < (int)v.size() ; ++i) {
    for(int j = 1 ; j <= n ; ++j) {
      Pt now = {0, 0};
      for(int k = i ; k < i + j ; ++k) {
        now = now + v[k];
      }
      ans = max(ans, norm(now));
    }
  }
  cout << fixed << setprecision(15) << ans << '\n';
}

int32_t main() {
  ios_base::sync_with_stdio(0), cin.tie(0);
  init();
  solve();
}


Measured memory_bytes: 256
#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 INF = 1001001001;

int shortest_length(int sy, int sx, int gy, int gx, vector<string> field, char block) {
    int h = field.size();
    int w = field[0].size();
    vector<vector<int>> d(h, vector<int> (w, INF));
    d[sy][sx] = 0;
    queue<P> que;
    que.push(make_pair(sy, sx));
    while (que.size()) {
        P p = que.front();
        que.pop();
        int y = p.first;
        int x = p.second;
        if (x == gx && y == gy) break;
        for (int dx = -1, dy = 0, i = 0; i < 4; dx += dy, dy = dx - dy, dx = dy - dx, i++) {
            int ny = y + dy;
            int nx = x + dx;
            if (nx >= 0 && nx < w && ny >= 0 && ny < h && field[ny][nx] != block && d[ny][nx] == INF) {
                d[ny][nx] = d[y][x] + 1;
                que.push(make_pair(ny, nx));
            }
        }
    }
    if (d[gy][gx] == INF) return -1;
    return d[gy][gx];
}

int main() {
    int h, w;
    cin >> h >> w;
    vector<string> maze(h);
    int white = 0;
    rep(i,h) {
        cin >> maze[i];
        white += count(maze[i].begin(), maze[i].end(), '.');
    }
    int sl = shortest_length(0, 0, h-1, w-1, maze, '#') + 1;
    int ans;
    if (sl == 0) ans = -1;
    else ans = white - sl;
    cout << ans << endl;
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main(){
  int x=0,y=0,z=0;
  for(int i=0;i<3;i++){
    char c;
    cin >> c;
    if(c=='a') x=1;
    if(c=='b') y=1;
    if(c=='c') z=1;
  }
  if(x+y+z==3) cout << "Yes\n";
  else cout << "No\n";

  
  return 0;
}


Measured memory_bytes: 256
n, W = map(int, input().split())
w, v = [], []
for i in range(n):
    w_, v_ = map(int, input().split())
    w.append(w_)
    v.append(v_)
dp = [[float("inf")] * (10 ** 5 + 1) for i in range(n + 1)]
dp[0][0] = 0
for i in range(1, n + 1):
    for j in range(10 ** 5 + 1):
        if j - v[i - 1] >= 0:
            dp[i][j] = min(dp[i - 1][j], dp[i - 1][j - v[i - 1]] + w[i - 1])
        else:
            dp[i][j] = dp[i - 1][j]
for i in range(100000, -1, -1):
    if dp[n][i] <= W:
        break
print(i)

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

int num[12], cnt;

pair<ll, int> xx(int x) {
    ll ans = 0, f = 0;
    cnt = 0;
    while(x) {
        int c = x % 4; x /= 4;
        if (!c) { f |= 8; num[cnt++] = 0; }
        if (c == 1) { f |= 1; num[cnt++] = 3; }
        if (c == 2) { f |= 2; num[cnt++] = 5; }
        if (c == 3) { f |= 4; num[cnt++] = 7; }
    }
    for(int i = cnt - 1; ~i; --i) ans = ans * 10 + num[i];
    return make_pair(ans, f);
}

int main() {
    ios::sync_with_stdio(0);
    int n, ans = 0;
    cin >> n;
    for(int i = 0; ; i++) {
        pair<ll, int> c = xx(i);
        if(c.first > n) break;
        if(c.second == 7) ans++;
    }

    cout << ans << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <utility>
#include <functional>
#include <climits>
#include <cstring>
#include <cmath>
#include <cstdlib>

using namespace std;

#define int long long

#define rep(i, n) for (int i=0;i<(int)n;++i)
#define rep1(i, n) for (int i=1;i<=(int)n;++i)
#define unless(a) if(!(a))
#define all(a) begin(a),end(a)
#define fst first
#define scd second
#define PB emplace_back
#define PPB pop_back

using ll=long long;
using vi=vector<int>;
using pii=pair<int, int>;

constexpr ll TEN(int n) { return (n == 0) ? 1 : 10 * TEN(n - 1); };

bool chmin(int&a,int b){return a>b?(a=b,true):false;}
bool chmax(int&a,int b){return a<b?(a=b,true):false;}
int read(){int a;scanf("%lld",&a);return a;}

const int inf = TEN(18) + 10;
const int mod = TEN(9) + 7;

string s[55];
bool visited[55][55];
int dy[4] = {-1,0,1,0};
int dx[4] = {0,-1,0,1};

int done[100110];


struct UF {
	vi data;
	void init(int n)
	{
		data.resize(n);
		fill(all(data), -1);
	}
	int root(int x)
	{
		return data[x] < 0 ? x : data[x] = root(data[x]);
	}
	void unite(int x, int y)
	{
		x = root(x);
		y = root(y);
		if (x == y) return;
		if (size(x) < size(y)) swap(x, y);
		data[x] += data[y];
		data[y] = x;
	}
	bool same(int x, int y)
	{
		return root(x) == root(y);
	}
	int size(int x)
	{
		x = root(x);
		return -data[x];
	}
	bool is_root(int x)
	{
		return x == root(x);
	}
};


int N, M;
vector<pii> edges;

signed main()
{
	cin >> N >> M;

	rep(i, M) edges.PB(read()-1, read()-1);

	UF uf;
	uf.init(N);

	int sum = N * (N - 1) / 2;

	vi ans;

	for (int i = M - 1; i >= 0; --i) {
		ans.PB(sum);

		if (not uf.same(edges[i].fst, edges[i].scd)) {
			sum -= uf.size(edges[i].fst) * uf.size(edges[i].scd);
			uf.unite(edges[i].fst, edges[i].scd);
		}
	}

	reverse(all(ans));

	rep(i, M) cout << ans[i] << endl;
}


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

using namespace std;

#define ll long long 
#define REPL(i,n) for(ll i=0, i##_len=(n); i<i##_len; ++i)
#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define radrad(a)  180.0 * a / M_PI
#define pow(x) x*x
static const int MAX = 10010;
static const ll INFTY = 1e12;
static const ll NUMMAX = 1000000007;
static const ll MOD = 1000000007;
 #define LOOP 10000000



int main() {

  int a, b;

  cin >> a >> b;

  if( a > b ) swap(a, b);

  REP(i, b){
    cout << a;
  }
  cout << endl;

  return 0;
}
/*
                   _ooOoo_
                  o8888888o
                  88" . "88
                  (| -_- |)
                  O\  =  /O
               ____/`---'\____
             .'  \\|     |//  `.
            /  \\|||  :  |||//  \
           /  _||||| -:- |||||-  \
           |   | \\\  -  /// |   |
           | \_|  ''\---/''  |   |
           \  .-\__  `-`  ___/-. /
         ___`. .'  /--.--\  `. . __
      ."" '<  `.___\_<|>_/___.'  >'"".
     | | :  `- \`.;`\ _ /`;.`/ - ` : | |
     \  \ `-.   \_ __\ /__ _/   .-` /  /
======`-.____`-.___\_____/___.-`____.-'======
                   `=---='
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
         pass System Test!
*/


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

int X[3];

int solve(int n) {
	int cnt = 0;
	if (X[0] == X[2])
		return n + cnt;
	if (X[0] == X[1]) {
		cnt = X[2] - X[0];
		return n + cnt;
	}
	if (X[1] == X[2]) {
		cnt = (X[2] - X[0]) / 2;
		X[0] += 2 * cnt;
		if (X[0] != X[2])
			cnt += 2;
		return n + cnt;
	}
	else {
		if ((X[2] - X[1]) % 2 == 0) {
			cnt = (X[2] - X[1]) / 2;
			X[1] = X[2];
			return solve(n + cnt);
		}
		else {
			cnt = (X[2] - X[1]) / 2;
			X[1] += 2 * cnt;
			++X[1];
			++X[0];
			return solve(n + cnt + 1);
		}
	}
}

int main(void) {
	for (int i = 0; i < 3; ++i)
		cin >> X[i];

	sort(X, X + 3);
	int ans = solve(0);

	cout << ans << '\n';
	return 0;
}


Measured memory_bytes: 256
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <bitset>    // bitset
#include <cctype>    // isupper, islower, isdigit, toupper, tolower
#include <cstdint>   // int64_t, int*_t
#include <cstdio>    // printf
#include <deque>     // deque
#include <iomanip>
#include <iostream> // cout, endl, cin
#include <map>      // map
#include <math.h>
#include <numeric>
#include <queue>         // queue, priority_queue
#include <set>           // set
#include <stack>         // stack
#include <string>        // string, to_string, stoi
#include <tuple>         // tuple, make_tuple
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <utility>       // pair, make_pair
#include <vector>        // vector
using namespace std;
#define _GLIBCXX_DEBUG
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
#define chmin(x, y) x = min(x, y)
const int INF = 1001001001;
const int BG = 1000000007;

int main()
{
    int N;
    cin >> N;
    int a[100000][3];
    rep(i, N) cin >> a[i][0] >> a[i][1] >> a[i][2];

    int dp[N + 1][3];
    dp[0][0] = dp[0][1] = dp[0][2] = 0;
    for (int i = 1; i <= N; i++)
    {
        dp[i][0] = dp[i][1] = dp[i][2] = 0;
        for (int j = 0; j < 3; j++)
        {
            for (int k = 0; k < 3; k++)
            {
                if (j == k)
                    continue;
                dp[i][k] = max(dp[i][k], dp[i - 1][j] + a[i - 1][k]);
            }
        }
    }
    int maxi = max(max(dp[N][0], dp[N][1]), dp[N][2]);
    cout << maxi << endl;
}

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

using namespace std;

int main(){
  long long h;
  long long w;
  cin >> h >> w;
  long long ans = h*w;
  if(ans%2==1){
    ans = (ans/2) + 1;
  }
  else{
    ans = ans/2;
  }
  if(h==1 || w==1){
    cout << 1 << endl;
    return 0;
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
using System;
using System.IO;
using System.Linq;
using System.Numerics;
using System.Collections.Generic;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using static System.Math;
using Debug = System.Diagnostics.Debug;
using MethodImplOptions = System.Runtime.CompilerServices.MethodImplOptions;
using MethodImplAttribute = System.Runtime.CompilerServices.MethodImplAttribute;

static class P
{
    static void Main()
    {
        var a = NextInt;
        var b = NextInt;
        Console.WriteLine(Max(a + b, Max(a - b, a * b)));
    }


    static readonly TextReader In = Console.In;
    static int NextInt
    {
        [MethodImpl(MethodImplOptions.AggressiveInlining)]
        get
        {
            int res = 0;
            int next = In.Read();
            int rev = 1;
            while (45 > next || next > 57) next = In.Read();
            if (next == 45) { next = In.Read(); rev = -1; }
            while (48 <= next && next <= 57)
            {
                res = res * 10 + next - 48;
                next = In.Read();
            }
            return res * rev;
        }
    }
}


Measured memory_bytes: 11092
#include<iostream>
#include<string>
#include<vector>
#include<numeric>
#include<math.h>
#include<algorithm>
#include<iomanip>
#include<bitset>
#include<list>
using namespace std;

// ソートしたい値（A, B）で構成された構造体
struct Info {
	long long valA;
	long long valB;

	Info(long long A, long long B) {
		valA = A;
		valB = B;
	}
};

// 数値 A でソートするための比較演算子
bool cmpA(const Info& a, const Info& b) {
	return a.valA < b.valA;
}

// 数値 B でソートするための比較演算子
bool cmpB(const Info& a, const Info& b) {
	return a.valB < b.valB;
}

int main() {

	long long N;
	cin >> N;

	vector<Info> val(N, Info(0, 0));

	for (long long i = 0; i < N; i++) {
		cin >> val[i].valA >> val[i].valB;
	}

	sort(val.begin(), val.end(), cmpB);

	long long Aday = 0;
	long long Bday = 0;
	bool jdg = true;
	for (int i = 0; i < N; i++) {
		Aday += val[i].valA;
		if (Aday > val[i].valB) {
			jdg = false;
			break;
		}
	}

	if (jdg == true) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}

	return 0;
}


Measured memory_bytes: 3328
#include <iostream>
#include <vector>
#include <map>
#include <unordered_map>
#include <queue>
#include <set>
#include <algorithm>
#include <string>
#include <math.h>
#include <limits.h>
#include <stack>
#include <complex>
#include <stdlib.h>
#include <stdio.h>
#include <functional>
#include <cfloat>
#include <math.h>


#define fs first
#define sc second

using namespace std;


typedef long long ll;
typedef pair<ll, ll> P;


ll ret_sub(P x){
    return max(x.sc - x.fs, x.fs - x.sc);
}


int main(){
    ll N;
    ll g[2][3];

    cin >> N;
    for(int i = 0; i < 2; i++){
        for(int j = 0; j < 3; j++){
            cin >> g[i][j];
        }
    }

    vector<P> x, y;
    for(int i = 0; i < 3; i++){
        if(g[0][i] > g[1][i]){
            y.emplace_back(P(g[1][i], g[0][i]));
        }
        else if(g[0][i] < g[1][i]){
            x.emplace_back(P(g[0][i], g[1][i]));
        }
    }

    if(x.size() == 1){
        P p = x[0];
        N += (N / p.fs) * ret_sub(p);
    }
    else if(x.size() == 2){
        ll ma = 0;
        for(ll i = 0; i <= N/x[0].fs; i++){
            ll v1 = i * ret_sub(x[0]);
            ll v2 = (N - i * x[0].fs) / x[1].fs * (x[1].sc - x[1].fs);
            ma = max(v1+v2, ma);
        }
        N += ma;
    }
    else if(x.size() == 3){
        ll ma = 0;
        for(ll i = 0; i * x[0].fs <= N; i++){
            for(ll j = 0; i * x[0].fs + j * x[1].fs <= N; j++){
                ll v1 = i * ret_sub(x[0]);
                ll v2 = j * ret_sub(x[1]);
                ll v3 = (N - i * x[0].fs - j * x[1].fs) / x[2].fs * ret_sub(x[2]);
                ma = max(v1+v2+v3, ma);
            }
        }
        N += ma;
    }

    if(y.size() == 1){
        N += (N / y[0].fs) * ret_sub(y[0]);
    }
    else if(y.size() == 2){
        ll ma = 0;
        for(ll i = 0; i <= N/y[0].fs; i++){
            ll v1 = i * ret_sub(y[0]);
            ll v2 = (N - i * y[0].fs) / y[1].fs * ret_sub(y[1]);
            ma = max(v1+v2, ma);
        }
        N += ma;
    }
    else if(y.size() == 3){
        ll ma = 0;
        for(ll i = 0; i * y[0].fs <= N; i++){
            for(ll j = 0; i * y[0].fs + j * y[1].fs <= N; j++){
                ll v1 = i * ret_sub(y[0]);
                ll v2 = j * ret_sub(y[1]);
                ll v3 = (N - i * y[0].fs - j * y[1].fs) / y[2].fs * ret_sub(y[2]);
                ma = max(v1+v2+v3, ma);
            }
        }
        N += ma;
    }

    cout << N << endl;


    return 0;
}


Measured memory_bytes: 256
type t = {
  id : int;
  ch : char;
  num : int;
}

let rec partitoin a r = function
  | (i, j) when j = r ->
    let tmp = a.(i) in
    a.(i) <- a.(j);
    a.(j) <- tmp;
    i
  | (i, j) when a.(j).num <= a.(r).num ->
    let tmp = a.(i) in
    a.(i) <- a.(j);
    a.(j) <- tmp;
    partitoin a r (i + 1, j + 1)
  | (i, j) ->
    partitoin a r (i, j + 1)

let rec quick_sort a p r =
  if p < r then begin
    let q = partitoin a r (p, p) in
    quick_sort a p (q - 1);
    quick_sort a q r
  end

let rec stable_str a n i =
  if i = n then "Stable"
  else if a.(i-1).num = a.(i).num && a.(i-1).id > a.(i).id then "Not stable"
  else stable_str a n (i + 1)

let rec split str delim acc =
  let open String in
  match
    try Some (rindex str delim) with _ -> None
  with
  | None -> str :: acc
  | Some i -> split (sub str 0 i) delim (sub str (i + 1) (length str - i - 1) :: acc)

let () =
  let n = read_int () in
  let a = Array.init n (fun i ->
    match split (read_line ()) ' ' [] with
    | [c; d] -> { id = i; ch = c.[0]; num = int_of_string d }
    | _ -> exit 1) in
  quick_sort a 0 (n - 1);
  print_endline (stable_str a n 1);
  Array.iter (fun x -> Printf.printf "%c %d\n" x.ch x.num) a

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

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


int main() {
  // ofstream ofstr(".¥¥test.txt" );
  // streambuf* strbuf;
  // strbuf = std::cout.rdbuf( ofstr.rdbuf() );

  int A,B;
  cin >> A >> B;
  int s = min(A,B), l = max(A,B);
  vector<vector<char>> ans(100, vector<char>(100,'.'));
  s--;

  rep(i,25){
    rep(j,25) {
      if (l>0) {
        l--;
        rep(x,3)rep(y,3) ans[i*4+x][j*4+y] = '#';
        if (s>0) {s--;ans[i*4+1][j*4+1]='.';}
      }
    }
  }
  cout << 100 << ' ' << 100 << endl;
  rep(i,100){
    rep(j,100) {
      if (A>B) {
        if (ans[i][j]=='.') ans[i][j] = '#';
        else ans[i][j] = '.';
      }
      cout << ans[i][j];
    }
    cout << endl;
  }
  

  // cout.rdbuf( strbuf );
} 

Measured memory_bytes: 256
#include <stdio.h>
int main(int argc, char const *argv[]) {
  int h=0,x=0,ans=0,a=0;
  int max=0,maxu=0;
  scanf("%d %d",&h,&a);
  int d[a];
  for (int i = 0; i < a; i++) {
    scanf("%d",&d[i]);
  }
  for (int i = 0; i < a; i++) {
    max+=d[i];
  }
  if (max>=h) {
    printf("Yes\n");
  }else{
    printf("No\n");
  }
  return 0;
}


Measured memory_bytes: 512
import java.util.Scanner;
import java.math.BigInteger;
public class Main
{
	public static void main(String args[])
	{
		Scanner inp = new Scanner(System.in);
		BigInteger sum = BigInteger.valueOf(0);
		int max, min, n, t;
		n = inp.nextInt();
		t = inp.nextInt();
		max = t;
		min = t;
		sum = sum.add(BigInteger.valueOf(t));
		for(int i = 1; i < n; i++)
		{
			t = inp.nextInt();
			if(t > max)max = t;
			if(t < min)min = t;
			sum = sum.add(BigInteger.valueOf(t));
		}
		System.out.println(min + " " + max + " " + sum);
	}
}

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

using namespace std;
using LL = long long;
const LL LINF = 1e18;
const LL MOD = 1e9+7;



int main(){
    string s;
    cin >> s;
    int idx = 0;
    int ans = 0;
    for(int a = 0;a < s.size();a++){
        if(s.at(a) == 'A' || s.at(a) == 'T' || s.at(a) == 'C' || s.at(a) == 'G'){
            idx++;
        }else{
            ans = max(ans,idx);
            idx = 0;
        }
    }
    ans = max(ans,idx);
    cout<<ans<<endl;
}


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

using namespace std;

long long inf=1000000007;

int main(){
	int n,k;
	cin>>n>>k;
	vector<int> hoge(n);
	for(int i=0;i<n;i++) cin>>hoge.at(i);

	sort(hoge.begin(),hoge.end());

	long long ans=0;

	for(int i=0;i<k;i++) ans+=hoge.at(i);

	cout<<ans<<endl;

	return 0;
}


Measured memory_bytes: 3624
#include <iostream>

int main(){
   char S[4];
   for(int i=0; i<4; ++i)
      std::cin >> S[i];

   int n = 0;
   for(int i=0; i<4; ++i){
      if(S[i]=='+') ++n;
      else if(S[i]=='-') --n;
   }

   std::cout << n << std::endl;
   return 0;

}


Measured memory_bytes: 256
import numpy as np
from collections import defaultdict
from functools import reduce

n = int(input())
A = list(map(int, input().split()))

S = reduce(lambda x, y: abs(x)+abs(y), A)


if len(list(filter(lambda x: x<0, A)))%2 == 0:
    print(S)
else:
    print(S - 2*min(abs(x) for x in A))


Measured memory_bytes: 23356
x = input()
y = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z']
for i in range(26):
    if y[i] == x:
        print(y[i + 1])

Measured memory_bytes: 3060
N = int(input())
S = input()
charCnt = []
flag = {}
for c in S:
  if not c in flag:
    flag[c] = 1
    charCnt.append([c,1])
  else :
    flag[c] += 1
    for i in range(len(charCnt)):
      if charCnt[i][0] == c:
        charCnt[i][1] += 1
        break

cnt = 1
for i in range(len(charCnt)):
  cnt *= (charCnt[i][1]+1)
cnt -= 1
cnt %= 10**9+7
print(cnt)

Measured memory_bytes: 3188
from collections import defaultdict
from heapq import heappush, heappop
import math
import bisect
import random

def LI(): return list(map(int, input().split()))
def I(): return int(input())
def LIM(): return list(map(lambda x:int(x) - 1, input().split()))
def LS(): return input().split()
def S(): return input()
def IR(n): return [I() for i in range(n)]
def LIR(n): return [LI() for i in range(n)]
def LIRM(n): return [LIM() for i in range(n)]
def SR(n): return [S() for i in range(n)]
def LSR(n): return [LS() for i in range(n)]
mod = 1000000007



def main():
    n, k = LI()
    n_list = LI()
    i = n
    while True:
        flag = 0
        for j in n_list:
            if str(j) in str(i):
                flag = 1
        if flag == 0:
            break
        i += 1
    return i





print(main())

Measured memory_bytes: 41840
import itertools
n, m = map(int, input().split())
data = []
for i in range(m):
    tmp = list(map(int, input().split()))
    data.append([i, tmp[0], tmp[1:]])
ps = list(map(int, input().split()))
situ = list(itertools.product("01", repeat=n))
ans = 0
for one in situ:
    tmp1 = 0
    # 各ライトについて検査
    for light in data:
        tmp2 = 0
        # スイッチ入り確認
        for index in light[2]:
            if one[index - 1] == "1":
                tmp2 += 1
        if tmp2 % 2 == ps[light[0]]:
            tmp1 += 1
    if tmp1 == m:
        ans += 1
print(ans)


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

int main()
{
	int N;

	cin >> N;

	string word[N];
	for (int i = 0; i < N; ++i){
		cin >> word[i];
	}

	for (int i = 0; i < N; ++i){
		string compare = word[i];
		for (int j = i+1; j < N; ++j){
			if(compare == word[j]) {
				cout << "No" <<endl;
				return 0;
			}
		}
	}

	for (int i = 0; i < N-1; ++i){
		char last = word[i].at(word[i].size()-1);
		char top = word[i+1].at(0);
		if(last != top) {
			cout << "No" <<endl;
			return 0;
		}
	}

	cout << "Yes" <<endl;

	return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <cstring>

#define M 1046527

using namespace std;

char hash[M][15];

int getChar(char c) {
  if ( c == 'A' ) { return 1; }
  else if ( c == 'C' ) { return 2; }
  else if ( c == 'G' ) { return 3; }
  else if ( c == 'T' ) { return 4; }
  else return 0;
}

int getKey(char chars[]) {
  int key = 0, p = 1;
  for ( long long unsigned int i=0; i < strlen(chars); i++ ) {
    key += p * getChar(chars[i]);
    p *= 5;
  }
  return key;
}

int h1(int key) {
  return key % M;
}

int h2(int key) {
  return 1 + (key % (M - 1));
}

int find(char chars[]) {
  int key, h;
  key = getKey(chars);
  for ( int i = 0;; i++ ) {
    h = (h1(key) + i * h2(key)) % M;
    if ( strcmp( hash[h], chars ) == 0) {
      return 1;
    }
    else if ( strlen(hash[h]) == 0 ) {
      return 0;
    }
  }
}

int insert(char chars[]) {
  int key, h;
  key = getKey(chars);
  for ( int i = 0;; i++ ) {
    h = ( h1(key) + i * h2(key) ) % M;
    if ( strcmp( hash[h], chars ) == 0) {
      return 1; // already inserted
    }
    else if ( strlen(hash[h]) == 0 ) {
      strcpy( hash[h], chars );
      return 0;
    }
  }
}

int main() {
  int n;
  char command[10], chars[15];

  scanf("%d", &n);
  for ( int i = 0; i < n; i++ ) {
    scanf("%s %s", command, chars);
    if ( command[0] == 'i' ) {
      insert(chars);
    }
    else if ( command[0] == 'f' ) {
      if ( find(chars) ) {
        printf("yes\n");
      }
      else {
        printf("no\n");
      }
    }
  }
}


Measured memory_bytes: 17920
#include<bits/stdc++.h> 
#define ll long long 
#define pb push_back
#define vec vector<int>
#define fo(i,n) for (int i = 0; i < n; i++)
#define so(v) sort(v.begin(), v.end())
#define fi first
#define se second
using namespace std;  




int main()
{

string a;
cin>>a;
int sum = 0;
  for (int i = 0; i < a.length(); i++)
  {
    sum += (a[i] - '0');
  }
 
  if (sum % 9 == 0)
    cout << "Yes";
  else
    cout<<"No";
 
  return 0;
}



   

Measured memory_bytes: 3756
import sys
input = sys.stdin.readline
from itertools import accumulate
n = int(input())
a = list(map(int,input().split()))
if n == 0:
  if a[0] == 1:
    print(1)
  else:
    print(-1)
  exit()
if a[0] != 0:
  print(-1)
  exit()
ls = [0]*(n+1)
ls[0] = 1
sm = sum(a)
for i in range(1,n+1):
  if a[i] > (ls[i-1]-a[i-1])*2:
    print(-1)
    exit()
  if sm <= (ls[i-1]-a[i-1])*2:
    ls[i] = sm
    sm -= a[i]
  else:
    ls[i] = (ls[i-1]-a[i-1])*2
    sm -= a[i]
print(sum(ls))


Measured memory_bytes: 82896
// Problem : B - Minor Change
// Contest : AtCoder - AtCoder Beginner Contest 172
// URL : https://atcoder.jp/contests/abc172/tasks/abc172_b
// Memory Limit : 1024 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define endl '\n'
#define pb push_back
#define mod 1000000007
ll power(ll x, ll y) 
{ 
    if (y == 0) 
        return 1; 
    ll p = power(x, y/2) % mod; 
    p = (p * p) % mod; 
  
    return (y%2 == 0)? p : (x * p) % mod; 
} 
ll factorial[1000007];
void fact(ll n)
{
    memset(factorial,0,sizeof(factorial));
    factorial[0]=1;
factorial[1]=1;

    for(int i=1;i<n;i++)
    {
        factorial[i]=(factorial[i-1]*i)%mod;
    }
    
}
ll ncr(ll n,ll r)
{
    ll ans=1;
    ll i;
    ans=factorial[n];
    ll ans1=power(factorial[n-r],mod-2);
    ll ans2=power(factorial[r],mod-2);
    ans=((ans*ans1)%mod*ans2)%mod;
    return ans;
}
ll gcd(ll a, ll b) 
{ 
    if (b == 0) 
        return a; 
    return gcd(b, a % b);  
      
} 

bool prime[100000006];
void sieve(ll n){
    memset(prime,true,sizeof(prime));
	prime[1]=false; 
    for (ll p=2;p*p<=n;p++){
        if (prime[p]){  
            for (ll i=p*p;i<=n;i+=p)
                prime[i]=false;
        }
    }
}
void bfs(vector<int> v[],int o,int n,int dp[]){
	queue<int> q;
	q.push(o);
	dp[o]=0;
	bool visited[n+1]={0};
	visited[o]=true;
	while(q.empty()==false){
		int a=q.front();
		q.pop();
		for(int i=0;i<v[a].size();i++){
			if(visited[v[a][i]]==false){
				visited[v[a][i]]=true;
				q.push(v[a][i]);
				dp[v[a][i]]=dp[a]+1;
			}
		}
	}
}
int nov[1000001];
bool visited[1000001];
int dp[1000001];
int dfs(vector<int> v[],int o)
{
    if(visited[o]==0)
    {
        visited[o]=1;
        for(int i=0;i<v[o].size();i++)
        {
            if(visited[v[o][i]]==0)
            {
            dp[v[o][i]]=dp[o]+1;
            nov[o]+=dfs(v,v[o][i]);
            }
        }
        return nov[o]+1;
    }
    else
    return 0;
}
// string s=bitset<64>(n).to_string();
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
	string s1,s2;
	cin>>s1>>s2;
	ll cnt=0;
	for(int i=0;i<s1.size();i++)
	{
		if(s1[i]!=s2[i])
		cnt++;
	}
	cout<<cnt<<endl;
	return 0;
}


Measured memory_bytes: 3800
#! /usr/bin/python
# -*- coding: utf-8 -*-

MAX_Y = 12
MAX_X = 12

XY =  ((-1, 0), (1, 0), (0, -1), (0, 1))

def main():
    # input
    while(True):
        try:
            data = []
            for j in range(MAX_Y):
                input_list = map(int, raw_input())
                data.append(input_list)
            print(countIsland(data))
            raw_input()
        except EOFError:
            break

def countIsland(data):
    cnt = [0]
    def countIsland_(data):
        land = findIsland(data)
        if len(land) == 0:
            return cnt[0]
        else:
            data = sinkIsland(data, land)
            cnt[0] = cnt[0] + 1
            return countIsland_(data)

    return countIsland_(data)

# sink adjasent Island.
def sinkIsland(data, land):
    if isIn(*land):
        if not data[land[1]][land[0]] == 0:
            data[land[1]][land[0]] = 0
            lands = [(k[0] + land[0], k[1] + land[1]) for k in XY]
            for x in lands:
                data = sinkIsland(data, x)

    return data

def findIsland(data):
    for y in range(MAX_Y):
        for x in range(MAX_X):
            if data[y][x] == 1:
                return (x, y)
    else:
        return ()

# decision inner board.
def isIn(x, y):
    return 0<=x<MAX_X and 0<=y<MAX_Y

if __name__=='__main__':
    main()

Measured memory_bytes: 4360
import java.util.Scanner;

public class Main {
	public static void main(String[] args){
	    Scanner std = new Scanner(System.in);
	    int a = Integer.parseInt(std.next());
	    int b = Integer.parseInt(std.next());
	    int c = Integer.parseInt(std.next());
	    int divisor = 0;
	    for(int n = a; n <= b; n++ ){
	    	if(c%n==0){divisor++;}
	    }
	    System.out.println(divisor);
	}
}

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

// int main(){
//     int n, m;
//     cin >> n >> m;
//     int a[n];
//     rep(i, n){
//         cin >> a[i];
//     }
//     vector <pair <int, int>> p(m);
//     rep(i, m){
//         cin >> p[i].second;
//         cin >> p[i].first;
//     }

//     sort(a, a+n);
//     sort(p.begin(), p.end(), greater<pair<int, int>>());

//     int idx = 0;
//     rep(i, n){
//         if(a[i]<p[idx].first){
//             a[i] = p[idx].first;
//             p[idx].second--;
//         }else{
//             break;
//         }

//         if(p[idx].second==0){
//             idx++;
//         }
//         if(idx>m-1){
//             break;
//         }
//     }
//     ll sum = 0;
//     rep(i, n){    
//         sum += (ll) a[i];
//     }
//     printf("%lld\n", sum);
//     return 0;
// }

int main(){
    int N, M;
    cin >> N >> M;
    int A[N];
    rep(i, N){
        cin >> A[i];
    }
    int B[M], C[M];
    rep(i, M){
        cin >> B[i] >> C[i];
    }

    priority_queue <pair <int, int> > q;
    rep(i, N){
        q.push(make_pair(A[i], 1));
    }
    rep(i, M){
        q.push(make_pair(C[i], B[i]));
    }
    ll ans = 0;
    rep(i, N){
        auto p = q.top();
        q.pop();
        ans += p.first;
        if(p.second > 1){
            p.second--;
            q.push(p);
        }
    }
    printf("%lld\n", ans);
    return 0;
}

Measured memory_bytes: 3572
package main

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

var (
	scanner = bufio.NewScanner(os.Stdin)
)

func readInt() int {
	scanner.Scan()
	n, _ := strconv.Atoi(scanner.Text())
	return n
}

func main() {
	n := readInt()
	fmt.Println(n * n * n)
}

Measured memory_bytes: 640
#include<bits/stdc++.h>
#define pb push_back
using namespace std;
const int DN=1e5+5;
long long n,p,dp[(1<<16)+5],a[25][25],cost[(1<<16)+5],cnt;
void solve(int conf,int conf2,int poz)
{
    if(poz==n)
    {
        cnt++;
        if(conf2==0)
            return;
        dp[(conf|conf2)]=max(dp[(conf|conf2)],dp[conf]+cost[conf2]);
        return;
    }
    if(conf&(1<<poz))
    {
        solve(conf,conf2,poz+1);
        return;
    }
    solve(conf,conf2,poz+1);
    solve(conf,conf2+(1<<poz),poz+1);
}
int main()
{
    cin>>n;
    for(int i=0;i<n;i++)
        for(int j=0;j<n;j++)
            cin>>a[i][j];
    p=(1<<n)-1;
    for(int conf=0;conf<=p;conf++)
    {
        for(int i=0;i<n;i++)
            if(conf&(1<<i))
            {
                for(int j=i+1;j<n;j++)
                    if(conf&(1<<j))
                        cost[conf]+=a[i][j];
            }
        //cout<<cost[conf]<<'\n';
    }
    for(int conf=1;conf<=p;conf++)
        dp[conf]=-1e18;
    for(int conf=0;conf<=p;conf++)
        solve(conf,0,0);
    cout<<dp[p];
}


Measured memory_bytes: 1280
#include<stdio.h>
#include<stdlib.h>
#include<math.h>
int min(int n1,int n2)
{
	if(n1>n2)
		return n2;
	else
		return n1;
}

long int reach (int i,int a[],int memo[])
{
	if(i<2)
		return 100000;
	if(i==2)
		return 0;
	if(memo[i]!=-1)
		return memo[i];
	else
	{
		memo[i]=min(fabs(a[i]-a[i-1])+reach(i-1,a,memo),fabs(a[i]-a[i-2])+reach(i-2,a,memo));
		return memo[i];
	}
}
int main()
{
	int memo[1000009],i,a[1000009],n;
	a[0]=0;a[1]=0;
	scanf("%d",&n);
	for(i=2;i<=n+1;i++)
	{
		scanf("%d",&a[i]);
		memo[i]=-1;
	}
	printf("%ld\n",reach(n+1,a,memo));
	return 0;
}
	
	


Measured memory_bytes: 7424
import Control.Monad
import Control.Applicative

solver :: Int -> String
solver n
    | n < 1200  = "ABC"
    | n < 2800  = "ARC"
    | otherwise = "AGC"

main :: IO ()
main = do
    n <- (read :: String -> Int) <$> getLine
    putStrLn $ solver n


Measured memory_bytes: 508
//自称高知能系Vtuberの高井茅乃です。
//Twitter: https://twitter.com/takaichino
//YouTube: https://www.youtube.com/channel/UCTOxnI3eOI_o1HRgzq-LEZw

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

#define INF 1999999999
#define REP(i,n) for(int i=0;i<n;i++)
#define REP1(i,n) for(int i=1;i<=n;i++)
#define MODA 1000000007 

int main() {
    int ans = 0;
	string n;
	cin >> n;
	REP(i, 3){
		if(n[i] == '1') cout << "9";
		else cout << "1";
	}
    cout << endl;
}

Measured memory_bytes: 256
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.NoSuchElementException;

public class Main {

	public static void main(String[] args) {
		FastScanner sc = new FastScanner();
		PrintWriter out = new PrintWriter(System.out);

		int H = sc.nextInt();
		int W = sc.nextInt();
		int h = sc.nextInt();
		int w = sc.nextInt();

		if (H % h == 0 && W % w == 0) {
			out.println("No");
		} else {
			out.println("Yes");
			int[][] mat = new int[H][W];
			for (int i = 0; i < H; i += h) {
				for (int j = 0; j < W; j += w) {
					mat[i][j] = 114514;
				}
			}
			for (int i = h - 1; i < H; i += h) {
				for (int j = w - 1; j < W; j += w) {
					mat[i][j] = -114515;
				}
			}
			for (int i = 0; i < H; i++) {
				for (int j = 0; j < W - 1; j++) {
					out.print(mat[i][j] + " ");
				}
				out.println(mat[i][W - 1]);
			}
		}

		out.flush();
	}

}

class FastScanner {
	private final InputStream in = System.in;
	private final byte[] buffer = new byte[1024];
	private int ptr = 0;
	private int buflen = 0;

	private boolean hasNextByte() {
		if (ptr < buflen) {
			return true;
		} else {
			ptr = 0;
			try {
				buflen = in.read(buffer);
			} catch (IOException e) {
				e.printStackTrace();
			}
			if (buflen <= 0) { return false; }
		}
		return true;
	}

	private byte readByte() {
		if (hasNextByte()) {
			return buffer[ptr++];
		} else {
			return -1;
		}
	}

	private boolean isPrintableChar(int c) {
		return '!' <= c && c <= '~';
	}

	private void skipUnprintable() {
		while (hasNextByte() && !isPrintableChar(buffer[ptr])) {
			ptr++;
		}
	}

	public boolean hasNext() {
		skipUnprintable();
		return hasNextByte();
	}

	public int nextInt() {
		if (!hasNext()) { throw new NoSuchElementException(); }
		int n = 0;
		boolean minus = false;
		byte b = readByte();
		if (b == '-') {
			minus = true;
			b = readByte();
		}
		if (b < '0' || '9' < b) { throw new NumberFormatException(); }
		while (true) {
			if ('0' <= b && b <= '9') {
				n *= 10;
				n += b - '0';
			} else if (b == -1 || !isPrintableChar(b)) {
				return minus ? -n : n;
			} else {
				throw new NumberFormatException();
			}
			b = readByte();
		}
	}

}

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


Measured memory_bytes: 256