akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<vector>
#include<algorithm>
#include<cctype>
#include<utility>
#include<string>
#include<cmath>
#include<cstring>
#include<queue>
#include<map>
#include<set>
#include<climits>

#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define llong long long
#define pb(a) push_back(a)

using namespace std;

typedef long long int ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;


template<typename T>
vector<T> make_v(size_t a) { return vector<T>(a); }
template<typename T, typename... Ts>
auto make_v(size_t a, Ts... ts) {
	return vector<decltype(make_v<T>(ts...))>(a, make_v<T>(ts...));
}
template<typename T, typename V>
typename enable_if<is_class<T>::value == 0>::type
fill_v(T& t, const V& v) { t = v; }
template<typename T, typename V>
typename enable_if<is_class<T>::value != 0>::type
fill_v(T& t, const V& v) {
	for (auto& e : t) fill_v(e, v);
}


#define ARRAY_MAX 100005
const int INF = INT32_MAX / 3;
const ll MOD = 1e9 + 7;

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


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



int main() {

	int a;
	string s;
	cin >> a >> s;
	if (a >= 3200) {
		cout << s << endl;
	}
	else
	{
		cout << "red" << endl;
	}




	




	return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include <list>
#include<stack>
#include<queue>
#include <vector>
#include <set>
#include<algorithm>
#include<math.h>
#include<stdlib.h>
#include<string>
#include <functional>
#include<fstream>

#define FOR(k,m,n) for(int (k)=(m);(k)<(n);(k)++)
#define REP(i,n) FOR((i),0,(n))
#define LL long long
#define CLR(a) memset((a),0,sizeof(a))
#define SZ(x) (int((x).size()))
#define WAITING(str) int str;std::cin>>str;
#define DEBUGING(str) cout<<str<<endl
using namespace std;

const LL MOD = 1000000007;// 10^9+7
const int INF = (1 << 30);
using ld = long double;

struct point {
	const ld esp = 1e-9;
	ld x, y;

	bool operator < (const point& r) const {
		if (abs(this->x - r.x) > esp) {
			return (this->x) < r.x;
		}
		else if(abs(this->y - r.y)>esp){
			return (this->y) < r.y;
		}
		else {
			return false;
		}
	}
};


//http://imagingsolution.blog.fc2.com/blog-entry-137.html
point cross(
	point p1, 
	point p2,
	point p3, 
	point p4)
{
	point tmp;
	tmp.x = p2.x;
	tmp.y = p2.y;
	p2.x = p3.x;
	p2.y = p3.y;
	p3.x = tmp.x;
	p3.y = tmp.y;

	ld s1 = (p4.x - p2.x)*(p1.y - p2.y) - (p4.y - p2.y)*(p1.x - p2.x);
	ld s2 = (p4.x - p2.x)*(p2.y - p3.y) - (p4.y - p2.y)*(p2.x - p3.x);
	s1 /= 2;
	s2 /= 2;

	point res;
	res.x = p1.x + (p3.x - p1.x)*s1 / (s1 + s2);
	res.y = p1.y + (p3.y - p1.y)*s1 / (s1 + s2);
	return res;
	/*
	ld dev = (p2.y - p1.y)*(p4.x - p3.x) - (p2.x - p1.x)*(p4.y - p3.y);
	if (abs(dev) < p1.esp)return { INF,INF };

	ld s1=(p4.x-p2.x)*

	ld d1 = p3.y*p4.x - p3.x*p4.y;
	ld d2 = p1.y*p2.x - p1.x*p2.y;
	
	point res;
	res.x = d1 * (p2.x - p1.x) - d2 * (p4.x - p3.x);
	res.x /= dev;
	res.y = d1 * (p2.y - p1.y) - d2 * (p4.y - p3.y);
	res.y /= dev;
	return res;

	*/
}

bool in(point p)
{
	if (p.x<-100 + p.esp)return false;
	if (p.y<-100 + p.esp)return false;
	if (100 - p.esp<p.x)return false;
	if (100 - p.esp<p.y)return false;
	return true;
}

//計算
void calc(vector<pair<point, point>> edge)
{
	int res = 1;
	set<point> inter;

	REP(i, edge.size()){
		int cnt = 1;
		FOR(j, i + 1, edge.size()) {
			auto l = edge[i];
			auto r = edge[j];
			auto cr = cross(l.first, l.second, r.first, r.second);
			if (in(cr)) {
				if (inter.find(cr)==inter.end()) {
					inter.insert(cr);
					cnt++;
				}
			}
		}
		inter.clear();
		res += cnt;
	}
	cout << res << endl;
}


//デバッグ
void debug()
{
	int N;
	cin>>N;
}


//メイン関数
int main()
{
	while (true) {
		int n;
		vector<pair<point, point>> edge;
		cin >> n;
		if (n == 0)break;

		REP(i, n) {
			ld a, b, c, d;
			point l, r;
			cin >> l.x >> l.y >> r.x >> r.y;
			
			edge.push_back({ l,r });
		}
		calc(edge);
	}

	debug();
	
	return 0;
}



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

using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define MIN(a, b) ((a) > (b) ? (b) : (a))
#define MAX(a, b) ((a) < (b) ? (b) : (a))

const long long INF = 1LL << 60;
typedef long long ll;
const long long MOD = 1000000000 + 7;

int main()
{
    int n;
    cin >> n;
    vector<ll> a(n);
    ll ans = 0;
    ll min_val = 1e10;
    ll cnt_minus = 0;
    rep(i, n)
    {
        cin >> a[i];
        ans += abs(a[i]);
        min_val = min(min_val, abs(a[i]));
        if (a[i] < 0)
            cnt_minus++;
    }
    if (cnt_minus % 2 == 1)
        cout << ans - min_val * 2 << endl;
    else
        cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3984
class Node:

    def __init__(self, key: int) -> None:
        self.key = key
        self.parent = None
        self.left = None
        self.right = None


def input_line() -> (str, int):
    line = input().split()
    if line[0] == 'insert':
        return 'insert', int(line[1])
    else:
        return line[0], None


def preorder(tree: Node) -> None:
    """先行順巡回。"""
    print(f' {tree.key}', end='')
    if tree.left is not None:
        preorder(tree.left)
    if tree.right is not None:
        preorder(tree.right)


def inorder(tree: Node) -> None:
    """中間順巡回。"""
    if tree.left is not None:
        inorder(tree.left)
    print(f' {tree.key}', end='')
    if tree.right is not None:
        inorder(tree.right)


def insert(new_node: Node) -> None:
    """二分探索木に挿入する。"""
    global root  # rootはglobalに共有する。
    parent = None
    x = root

    # new_nodeを付け加える節(parent)を探索。
    while x is not None:
        parent = x
        if new_node.key < x.key:
            x = x.left
        else:
            x = x.right
    new_node.parent = parent

    # new_nodeの子供を設定。
    if parent is None:  # treeが空だった場合は、rootにnew_nodeを設定。
        # print(f'key: {new_node.key} op: new node')
        root = new_node
    elif new_node.key < parent.key:
        # print(f'key: {new_node.key} op: left')
        parent.left = new_node
    else:
        # print(f'key: {new_node.key} op: right')
        parent.right = new_node


root = None  # treeの根を表す。初期値はNone。
N = int(input())
for _i in range(N):
    order, val = input_line()
    if order == 'insert':
        node = Node(val)
        insert(node)
    else:
        inorder(root)
        print()
        preorder(root)
        print()





Measured memory_bytes: 104980
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <cmath>
#include <algorithm>
#include <vector>
#include <numeric>
#include <queue>
#include <stack>
#include <map> 
#include <set>
#include <string>
#include <functional>
#include <list>
#include <random>
#include <time.h>
#include <iomanip>
#include <assert.h>
#include <numeric>
#include <new>
#include <sstream>
#include <complex>
#define BIT(nr) (1ULL << (nr))
#define int long long
#define ll long long
#define double complex<long double>
#define mod 1000000007
#define MAXN (int)1e+5 * 2+1
#define LL_MAX 9223372036854775807	
#define LL_HALFMAX 9223372036854775807 / 2	
#define MIN -(9223372036854775807 / 2)
#define REP(i,a,n) for(int i=(a); i<(int)(n); i++)
#define rep(i,n) REP(i,0,n)
#define FOR(it,c) for(__typeof((c).begin()) it=(c).begin(); it!=(c).end(); ++it)
#define ALLOF(c) (c).begin(), (c).end()
#define REPS(i,x) for(int i=1;i<=(int)(x);i++)
#define RREP(i,x) for(int i=((int)(x)-1);i>=0;i--)
#define RREPS(i,x) for(int i=((int)(x));i>0;i--)
#define repl(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define mp make_pair
template<typename T1, typename T2> inline void chmin(T1 & a, T2 b) { if (a > b) a = b; }
template<typename T1, typename T2> inline void chmax(T1& a, T2 b) { if (a < b) a = b; }

using namespace std;

int G[15][15];

signed main() {
	map<int, int> x, y, d1, d2;
	// d1: 和が一定 d2: 差が一定
	int k;
	cin >> k;
	vector<string> ans(8, "........"), fans(8, "........");
	rep(i, k) {
		int r, c;
		cin >> r >> c;
		ans[r][c] = 'Q';

		y[r] = 1;
		x[c] = 1;
		d1[r + c] = 1;
		d2[c - r] = 1;
	}

	function<void(int)> dfs = [&](int xPos) {
		if (xPos == 8) {
			fans = ans;
			return;
		}
		// 既に置いてあったらNG
		if (x[xPos] == 1) {
			dfs(xPos+1);
		}

		rep(yPos, 8) {
			if (y[yPos] == 1) {
				continue;
			}
			if (d1[xPos + yPos] == 1) {
				continue;
			}
			if (d2[xPos - yPos] == 1) {
				continue;
			}

			y[yPos] = 1;
			d1[xPos + yPos] = 1;
			d2[xPos - yPos] = 1;
			ans[yPos][xPos] = 'Q';

			dfs(xPos + 1);

			y[yPos] = 0;
			d1[xPos + yPos] = 0;
			d2[xPos - yPos] = 0;
			ans[yPos][xPos] = '.';
		}
	};

	dfs(0);

	rep(i, 8) {
		cout << fans[i] << "\n";
	}

	return 0;
}


Measured memory_bytes: 3228
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int[] A = new int[N];
        int[] B = new int[N];
        for (int i=0;i<N;i++) {
            A[i] = sc.nextInt();
            B[i] = sc.nextInt();
        }
        Arrays.sort(A);
        Arrays.sort(B);

        if (N%2 == 1) {
            int left = A[N/2];
            int right = B[N/2];
            System.out.println(right-left+1);
        } else { // N%2 == 0
            double left = ((double)A[N/2-1]+A[N/2])/2;
            double right = ((double)B[N/2-1]+B[N/2])/2;
            System.out.println((long)((right-left)/(0.5))+1);
        }
    }
}

Measured memory_bytes: 61772
#include<cstdio>
#include<iomanip>
#include<cmath>
#include<cstdlib>
#include<vector>
#include<cctype>
#include<cstring>
#include<algorithm>
#include<iostream>
#define rep(i,n) for(int i = 1; i <= n; i++)
#define c(ans) cout<<ans<<endl;
using namespace std;
typedef long long ll;
typedef vector<int> v;

int main(){
	int n;
	while(cin>>n){
		if (n<3) cout<<"0"<<endl;
		else{
			cout<<n/3<<endl;
		}
	}
	return 0;
}

Measured memory_bytes: 764
#!/usr/bin/env python3
N, K = map(int, input().split())
H = list(map(int, input().split()))

dp = [float('inf') for i in range(N+K+1)]


if K>=N:
    print(abs(H[0]-H[-1]))
    exit()


dp[0] = 0
for i in range(1, K+1):
    dp[i] = abs(H[i]-H[0])


for i in range(0, N):
    for j in range(i+1, i+K+1):
        if j < N:
            dp[j] = min(dp[i] + abs(H[i] - H[j]), dp[j])
print(dp[N-1])


Measured memory_bytes: 56928
#include<stdio.h>
int main(){
    int S, h, m, s;
    scanf("%d", &S);
    h = S / 3600;
    m = S / 60 - h * 60;
    s = S - m * 60 - h * 3600;
    printf("%d:%d:%d\n", h, m, s);
    return 0;
}


Measured memory_bytes: 2052
#include <bits/stdc++.h>
typedef long long int ll;

using namespace std;
const double PI = 3.14159265358979323846;


int main()
{
    ll K;
    cin >> K;


    ll count=0;


    ll n=7;

    for(int i=0;i<K;i++){


        ll a = n%K;


        count++;



        if(a==0){


            cout << count << endl;

            return 0;

        }



        n= a*10 +7;

    }


    cout << -1 << endl;
    return 0;




}

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

using namespace std;
using ll = long long;
using ld = long double;
using uint = unsigned int;
using ull = unsigned long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;

/* [💭] [💡] [🎈] */

bool has[101][101];

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

    int n, k;
    cin >> n >> k;

    for (int i = 0; i < k; i++) {
        int d;
        cin >> d;
        while (d--) {
            int x;
            cin >> x;
            has[x - 1][i] = true;
        }
    }

    int c = 0;
    for (int i = 0; i < n; i++) {
        bool flag = false;
        for (int j = 0; j < k; j++) {
            if (has[i][j]) flag = true;
        }
        if (!flag)c++;
    }
    cout << c;

    return 0;
}

Measured memory_bytes: 3640
x,y=map(int,input().split())
t=0
if(y>4*x or y<2*x):
  print("No")
elif(y==2*x or y==4*x):
  print("Yes")
elif(y%2!=0):
    print("No")
else:  
  for i in range(1,x):
    j=x-i
    if((2*i+4*j)==y):
      break
    else:
      t=t+1
  if(t==x-1):
    print("No")
  else:
      print("Yes")

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

using namespace std;

int main() {
    string s;
    cin>>s;
    int count = 0, maxcount = 0;
    for(int i = 0; i < s.length(); i++) {
        if(s.at(i) == 'R') {
            count++; 
        } else {
            maxcount = max(maxcount, count);
            count = 0;
        }
    }
    maxcount = max(maxcount, count);
    cout<<maxcount<<endl;
    return 0;
}

Measured memory_bytes: 3620
#include <stdio.h>
#include <string.h>
int main()
{
    char S[150];
    int i,len;
    gets(S);
    len = strlen(S);
    for(i=0;i<=(len-1);i++)
    {
        S[i]='x';
    }
    printf("%s\n",S);
    return 0;
}


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

#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++)

using namespace std;
const long long INF = 1LL << 61;

void printVec(vector<int> vec) {
	rep(i, vec.size())cout << vec[i] << " ";
}

using Graph = vector<vector<int>>;

void BFS(vector<vector<int>> G, vector<int> score, vector<int>& ans) {
	queue<pair<int, int>> que;
	que.push(make_pair(1, 0));
	map<int, int> mp;
	mp[1]++;

	while (!que.empty()) {
		int num = que.front().first;
		int totalScore = que.front().second + score[num - 1];
		que.pop();
		++mp[num];
		//cout << totalScore << " ";
		ans[num - 1] = totalScore;
		rep(i, G[num - 1].size()) {
			if (mp[G[num - 1][i]] == 0)que.push(make_pair(G[num - 1][i], totalScore));
		}
	}
}

int main() {
	int N, Q; cin >> N >> Q;
	Graph G(N, vector<int>(0));
	rep(i, N - 1) {
		int a, b; cin >> a >> b;
		G[a - 1].push_back(b);
		G[b - 1].push_back(a);
	}
	vector<int> score(N);
	rep(i, Q) {
		int p, x;
		cin >> p >> x;
		score[p - 1] += x;
	}
	vector<int> ans(N);
	BFS(G, score, ans);
	rep(i, N)cout << ans[i] << " ";
}

Measured memory_bytes: 37108
#include <algorithm>
#include <cassert>
#include <cfloat>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <deque>
#include <iomanip>
#include <iostream>
#include <limits>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <tuple>
#include <vector>

#define FOR(i,k,n) for (int (i)=(k); (i)<(n); ++(i))
#define rep(i,n) FOR(i,0,n)
#define pb push_back
#define all(v) begin(v), end(v)
#define debug(x) cerr<< #x <<": "<<x<<endl
#define debug2(x,y) cerr<< #x <<": "<< x <<", "<< #y <<": "<< y <<endl

using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<vector<int> > vvi;
typedef vector<ll> vll;
typedef vector<vector<ll> > vvll;
template<class T> using vv=vector<vector< T > >;

vector<string> player = {"First\n", "Second\n"};

int n;
vi a;
void execute_gcd() {
  int ret = a[0];
  FOR (i, 1, n) {
    ret = __gcd(ret, a[i]);
  }
  rep (i, n) {
    a[i] /= ret;
  }
}

void judge(int turn) {
  int odd, even;
  odd = even = 0;
  rep (i, n) {
    if ((a[i]&1) == 1) {
      odd += 1;
    } else {
      even += 1;
    }
  }
  if ((even&1) == 1) {
    cout << player[turn];
    exit(0);
  }
  if (odd > 1) {
    cout << player[1 - turn];
    exit(0);
  }
  rep (i, n) {
    if ((a[i]&1) == 1) {
      if (a[i] == 1) {
        cout << player[1 - turn];
        exit(0);
      }
      a[i] -= 1;
      execute_gcd();
      return;
    }
  }
}

int main() {
  scanf("%d", &n);
  a.resize(n);
  rep (i, n) {
    scanf("%d", &a[i]);
  }

  int turn = 0;
  while (true) {
    judge(turn);
    turn = 1 - turn;
  }

  return 0;
}


Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i=0; i<n; i++)
typedef long long ll;
typedef pair<int, int> P;
 
int main(){
  string n; 
  cin >> n;
  rep(i, 3){
    if(n.at(i)=='7'){
      cout << "Yes" << endl;
      return 0;
    }
  }

  cout << "No" << endl;
  return 0;
}


Measured memory_bytes: 3584
#ARC007-B
if False:
    N,M=map(int,input().split())
    case=[i for i in range(N+1)]
    for _ in range(M):
        now=int(input())
        i=case.index(now)
        case[i]=case[0]
        case[0]=now
        # print(case)
    for i in range(1,N+1):
        print(case[i])

#ABC004-C (0408)
if False:
    N=int(input())-1
    N=N%30
    ans=list(range(1,7))
    for i in range(N+1):
        ans[i%5],ans[i%5+1]=ans[i%5+1],ans[i%5]
        # print(ans)
    print(''.join(map(str,ans)))

#AGC011-A (0408)
if True:
    N,C,K=map(int,input().split())
    T=[int(input()) for _ in range(N)]
    T.sort()
    cnt=1
    pas=1 # 乗客数
    tim=K+T[0] # departure time
    # print(T)
    for i in range(1,N):
        t=T[i]
        if tim<t or pas>=C:
            cnt+=1
            tim=t+K
            pas=1
        else:
            pas+=1
        # print(tim,pas,cnt)
    print(cnt)




Measured memory_bytes: 7508
#include<iostream>
#include<cmath>
#define rep(i,n) for(int i=0; i<(n); i++)
using namespace std;
typedef long long ll;

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

Measured memory_bytes: 256
#include <iostream>
using namespace std;
void swap(int idx1, int idx2, int* a)
{
	int f = a[idx1];
	a[idx1] = a[idx2];
	a[idx2] = f;
}
//クイックソート安定度×速さnlogn
void quickSort(int left, int right, int*a)
{
	int pl = left;
	int pr = right;
	float pivot_f = a[(pl + pr) / 2];
	do
	{
		while (a[pl] < pivot_f)
		{
			pl++;
		}
		while (a[pr] > pivot_f)
		{
			pr--;
		}
		if (pl <= pr)
		{
			swap(pl++, pr--, a);
		}
	} while (pl <= pr);
	if (left < pr) quickSort(left, pr, a);
	if (pl <= right) quickSort(pl, right, a);
}

int main()
{
	int n;
	int a[10000];
	long long sum = 0;
	cin >> n;
	for (int i = 0; i < n; i++)
	{
		cin >> a[i];
		sum += a[i];
	}
	quickSort(0, n-1 , a);

	cout << a[0] << " " << a[n - 1] << " " << sum << endl;
	return 0;
}



Measured memory_bytes: 3120
#include<stdio.h>
int main()
{
	int a,b,c,d;
	scanf("%d %d %d",&a,&b,&c);
	if(a>b)
	{
		d=b;b=a;a=d;
	}
	if(a>c)
	{
		d=c;c=a;a=d;
	}
	if(b>c)
	{
		d=c;c=b;b=d;
	}
	
	printf("%d %d %d\n",a,b,c);
	return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
template <class T> inline bool chmax(T &a, T b) {
    if(a < b) {
        a = b;
        return 1;
    }
    return 0;
}
template <class T> inline bool chmin(T &a, T b) {
    if(a > b) {
        a = b;
        return 1;
    }
    return 0;
}
using ll = long long;

#define ALL(v) (v).begin(), (v).end()
#define RALL(v) (v).rbegin(), (v).rend()
#define endl "\n"
const double EPS = 1e-7;
const int INF = 1 << 30;
const ll LLINF = 1LL << 60;
const double PI = acos(-1);
constexpr int MOD = 1000000007;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

//-------------------------------------

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    string s;
    cin >> s;
    int a = 0, b = 0;
    for(int i = 0; i < s.size(); i++) {
        if(s[i] == 'A') {
            a++;
        } else {
            b++;
        }
    }
    if((a == 1 && b == 2) || (a == 2 && b == 1)) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
}

Measured memory_bytes: 256
import java.io.*;
import java.util.Arrays;
class Main{
    public static void main(String[] args) throws IOException {
        int i,j,tmp;
        int[][] A = new int[101][101];
        int[] n = new int[990];
        String s;
        String[] str = new String[990];
        StringBuilder out = new StringBuilder();
        BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
        str = in.readLine().split(" ");
        for(i=0;i<2;i++){
            n[i]=Integer.parseInt(str[i]);   
        } 
        for(i=0;i<n[0];i++){
            s = in.readLine();
            str = s.split(" ");
            for(j=0;j<n[1];j++){
                tmp = Integer.parseInt(str[j]);
                A[n[0]][j]+=tmp; A[i][n[1]]+=tmp; A[n[0]][n[1]]+=tmp;
            }
            out.append(s+" "+A[i][n[1]]+"\n");
        }
        for(i=0;i<=n[1];i++){
            if(i!=0) out.append(" ");
            out.append(A[n[0]][i]);
        }    
        System.out.println(out);     
        System.out.flush();
    }
}

Measured memory_bytes: 27456
def sell(rate,kabu):
    money = rate * kabu
    return money
    
def buy(rate,money):
    kabu = money//rate
    otsuri = money % rate
    return kabu,otsuri
    
N,*A = map(int,open(0).read().split())
max_money = 1000
have_money = 1000
have_kabu = 0
for i in range(N-1):
    if A[i] < A[i+1] and have_money > A[i]: #買う
        have_kabu,have_money = buy(A[i],have_money)
    if A[i] > A[i+1]: #売る
        have_money += sell(A[i],have_kabu)
        have_kabu = 0
        max_money = max(max_money,have_money)
have_money += sell(A[-1],have_kabu)    
max_money = max(max_money,have_money)
print(max_money)        

Measured memory_bytes: 62076
#include<bits/stdc++.h>
using namespace std;
void format(int a[]){
  for(int i=0;i<5;i++){
    if(i==0||i==2)
      a[i]=5;
    else
      a[i]=7;
  }
}
int main(){
  int n;
  while(cin>>n,n!=0){
    string word[n];
    for(int i=0;i<n;i++)
      cin>>word[i];
    int cnt[n];
    format(cnt);
    for(int j=0;j<n;j++){
      int flag=0;
      format(cnt);
      int pointer=0;
      for(int i=j;i<n;i++){
	cnt[pointer]-=word[i].size();
	if(cnt[pointer]<0)
	  break;
	else if(cnt[pointer]==0&&pointer==4){
	  cout<<j+1<<endl;flag=1;break;
	}else if(cnt[pointer]==0)
	  pointer++;
      }
      if(flag==1)
	break;
    }
  }
  return 0;
}

Measured memory_bytes: 3152
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define rrep(i,j,n) for(int i=j;i<n;i++)
#define REP(i,n) for(int i=1;i<n;i++)
#define rev(i,n) for(int i=n-1;i>=0;i--)
#define all(v) v.begin(),v.end()
#define P pair<int,int>
#define len(s) (int)s.size()

template<class T> inline bool chmin(T &a, T b){
	if(a>b){a=b;return true;}
	return false;
}
template<class T> inline bool chmax(T &a, T b){
	if(a<b){a=b;return true;}
	return false;
}
constexpr int mod = 998244353;
constexpr int inf = 3e18;

/*
i,j i<j
A[i],A[j]

j-i=A[i]+A[j]
j-A[j]=i+A[i]
*/
int N;
map<int,int>mp; //i+A[i]
signed main(){
	cin>>N;
	int ans=0;
	rep(i,N){
		int A;cin>>A;
		ans+=mp[i-A];
		mp[i+A]++;
	}
	cout<<ans<<endl;
}

Measured memory_bytes: 26252
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
typedef long long ll;
#define rep(i,n) for (int i = 0; i < (n); i++)
#define repe(i,n) for (int i = 0; i <= (n); ++i)
#define repe1(i,n) for (int i = 0; i <= (n); ++i)
#define all(x) (x).begin(),(x).end()
#define pb(x) push_back(x)
#define eb(k,v) emplace_back(k,v)
#define ct(res) cout << res << "\n";
#define vi vector<int>
#define vl vector<ll>
using namespace std;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
const int INF = 1e9;
const ll MOD = 1000000007;
using Graph = vector<vector<int>>;
ll gcd(ll a, ll b) {return (a%b) ? gcd(b, a%b) : b;}
ll modPow(ll x, ll n) {
    if(n==0) return 1;
    ll res = modPow(x*x%MOD, n/2);
    if(n&1) res=res*x%MOD;
    return res;
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    bool j = true;
    int i = 1;
    while(true) {
        int x,y; cin >> x >> y;
        if (x==0 && y==0) {
            return 0;
        }
        if (x<y) {
            cout << x << " " << y << "\n";
        } else {
            cout << y << " " << x << "\n";
        }
    }
}



Measured memory_bytes: 3168
#include <stdio.h>

int a[2000001];
int b[2000001];

void Counting_sort(int x[], int y[], int k, int n) {
  int c[10001];
  for (int i = 0; i <= k; i++)
    c[i] = 0;

  for (int j = 1; j <= n; j++)
    c[x[j]]++;

  for (int i = 1; i <= k; i++)
    c[i] = c[i] + c[i - 1];

  for (int j = n; j >= 1; j--) {
    y[c[x[j]]] = x[j];
    c[x[j]]--;
    }
}

int main(void) {
  int n;
  int max = 0;

  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    scanf("%d", &a[i]);
    if (max < a[i])
      max = a[i];
  }

  Counting_sort(a, b, max, n);
  
  for (int i = 1; i <= n; i++) {
    printf("%d", b[i]);
    if (i != n)
      printf(" ");
  }
  printf("\n");
  return 0;
}



Measured memory_bytes: 17452
import java.util.Scanner;
import java.util.HashMap;
import java.util.List;
import java.util.Arrays;
import java.util.ArrayList;
import java.lang.Math;

public class Main {

    static Scanner sc = new Scanner(System.in);

    public static void main(String[] args) {
        int n = sc.nextInt();
        int m = sc.nextInt();
        String[] a = new String[n];
        String[] b = new String[m];
        for (int i = 0; i < n; i++) {
            a[i] = sc.next();
        }
        for (int i = 0; i < m; i++) {
            b[i] = sc.next();
        }
        for (int i = 0; i <= n - m; i++) {
            for (int j = 0; j <= n - m; j++) {
                boolean flag = true;
                for (int k = 0; k < m; k++) {
                    for (int l = 0; l < m; l++) {
                        if (a[i+k].charAt(j+l) != b[k].charAt(l)) {
                            flag = false;
                        }
                    }
                }
                if (flag) {
                    System.out.println("Yes");
                    System.exit(0);
                }
            }
        }
        System.out.println("No");
    }

}


Measured memory_bytes: 21844
#include<iostream>
#include<string>
#include<algorithm>
using namespace std;
typedef long long ll;
const int Max = 1e6 + 7;

int main()
{
	string str1, str2;
	cin >> str1 >> str2;
	if (str1 == str2)cout << "EQUAL";
	else if (str1.size() > str2.size())cout << "GREATER";
	else if (str1.size() < str2.size())cout << "LESS";
	else
	{
		for (int i = 0; i <= max(str1.size() - 1, str2.size() - 1); i++)
		{
			int a = str1[i] - '0';
			int b = str2[i] - '0';
			if (a == b)continue;
			if (i > str2.size()-1)
			{
				cout << "GREATER"; break;
			}
			if (i > str1.size()-1)
			{
				cout << "LESS"; break;
			}
			if (a > b) {
				cout << "GREATER"; break;
			}
			else
			{
				cout << "LESS"; break;
			}
		}
	}
}

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

using namespace std;

#define FOR(i,a,b) for(int i=a;i<b;i++)
#define REP(i,b) FOR(i,0,b)
#define MP make_pair
#define PB push_back

typedef unsigned int uint;
typedef long long ll;
typedef pair<int,int> pii;

int read(){
	int i;
	scanf("%d",&i);
	return i;
}

ll buf[2][51][2501];

int main(){
	int n=read(),a=read();
	auto w=buf[0];
	auto x=buf[1];
	REP(i,51)
		REP(j,2501)
			w[i][j]=0;
	w[0][0]=1;
	REP(_,n){
		int v=read();
	REP(i,51)
		REP(j,2501)
			x[i][j]=w[i][j]+(i>=1&&j>=v?w[i-1][j-v]:0);
		swap(w,x);
	}
	ll ans=0;
	FOR(i,1,51)
		ans+=w[i][i*a];
	cout<<ans<<endl;
}


Measured memory_bytes: 2176
#include<bits/stdc++.h>
///...................................*****.................................................///
///        Author :  MD. Rakibul Islam ( mmdrakibul2912@gmail.com )                         ///
///                  Department of Computer Science                                         ///
///                  & Engineering,                                                         ///
///                  Comilla University , Bangladesh.                                       ///
///...................................*****.................................................///
using namespace std;
int main()
{
    int n, m, i, j, k, l, sum=0;
    cin>>n;
    int a[n+2];
    for(i=0; i<n; i++)
    {
        cin>>a[i];
        sum+=a[i];
    }
    cin>>m;
    while(m--)
    {
        int x, y;
        cin>>x>>y;
        int nsum;
        nsum=sum-a[x-1]+y;
        cout<<nsum<<endl;
    }
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
using namespace std;
const int MAX_N = 1e6;
int n, q;
int c[MAX_N], qs[MAX_N];

int dat[MAX_N * 2 - 1]; 

void init(int n_) {
  n = 1;
  while (n_ > n) {
    n *= 2;
  }
  
  for (int i = 0; i < n; i++) {
    dat[i] = 0;
  }
}

void add(int a, int v) {
  int b = a + n - 1;
  dat[b] += v;
  while (b > 0) {
    b = (b - 1) / 2;
    dat[b] += v;
  }
}

int query(int a, int b, int k, int l, int r) {
  if (a >= r || b <= l) return 0;
  
  if (a <= l && r <= b) return dat[k];
  else {
    int lv = query(a, b, k * 2 + 1, l, (l + r) / 2);
    int rv = query(a, b, k * 2 + 2, (l + r) / 2, r);
    return lv + rv;
  }
}

int main() {
  cin >> n >> q;
  int no = n; //オリジナルのn
  n += 1; //1オリジンのため葉の数を1増やす
  init(n);
  
  for (int i = 1; i <= no; i++) cin >> c[i];
  
  vector<int> qs[MAX_N]; //i番目が右端であるクエリの左端の一覧
  vector<int> qid[MAX_N]; //i番目が右端のクエリの順番（０オリジン）
  for (int i = 0; i < q; i++) {
    int l, r;
    cin >> l >> r;
    qs[r].push_back(l);
    qid[r].push_back(i);
  }
  
  int a[MAX_N]; // iが最後に出てきた場所を記録
  int ans[MAX_N];
  for (int i = 0; i <= no; i++) a[i] = 0;
  for (int i = 1; i <= no; i++) {
    if (a[c[i]] > 0) add(a[c[i]], -1);
    add(i, 1);
    a[c[i]] = i;
    for (int j = 0; j < qs[i].size(); j++) {
      ans[qid[i][j]] = query(qs[i][j], i + 1, 0, 0, n);
    }
  }
  
  for (int i = 0; i < q; i++) cout << ans[i] << endl;
}

Measured memory_bytes: 78516
#include<iostream>
#include<cstdio>
#include<cmath>
#include<cstdlib>
#include<climits>
#include<string>
#include<algorithm>
#include<vector>
#include<queue>
#include<stack>
#include<numeric>
#include<map>
#include<set>
#include<bitset>
using namespace std;
#define REP(i,m,n) for(int i = m; i < n; i++)
#define rep(i,n) REP(i,0,n)
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a)  (a).rbegin(),(a).rend()
#define PI 3.14159265359
typedef long long LL;

template<class T> inline void chmax(T& a, T b) { if (a < b) { a = b; } }
template<class T> inline void chmin(T& a, T b) { if (a > b) { a = b; } }
template<class T> void print_vector(vector<T> vec) {
	cout << "[ ";
	for (int i = 0; i < vec.size(); i++) {
		cout << vec[i] << " ";
	}
	cout << "]" << endl;
}
template<class T> void print_pair_vector(vector<pair<T, T> > vec) {
	cout << "[ ";
	for (int i = 0; i < vec.size(); i++) {
		cout << "(" << vec[i].first << "," << vec[i].second << ") ";
	}
	cout << "]" << endl;
}

const int INF = 1 << 30;

int main(void) {
	int n, m;
	cin >> n >> m;
	cout << (n - 1) * (m - 1) << endl;

	return 0;
}

Measured memory_bytes: 256
def mul_mod(mod: int, *args)->int:
    ret = 1
    for a in args:
        ret = (ret * a) % mod
    return ret


def rectangles(n: int, m: int, X: list, Y: list)->int:
    MOD = 10**9 + 7

    DX = []
    x0 = X[0]
    for x in X[1:]:
        DX.append((x-x0) % MOD)
        x0 = x

    DY = []
    y0 = Y[0]
    for y in Y[1:]:
        DY.append((y-y0) % MOD)
        y0 = y

    dx_sum = sum(mul_mod(MOD, i+1, n-1-i, dx) for i, dx in enumerate(DX))
    dy_sum = sum(mul_mod(MOD, i+1, m-1-i, dy) for i, dy in enumerate(DY))

    return (dx_sum * dy_sum) % MOD


if __name__ == "__main__":
    n, m = map(int, input().split())
    X = [int(s) for s in input().split()]
    Y = [int(s) for s in input().split()]
    ans = rectangles(n, m, X, Y)
    print(ans)


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

int main() {
	int dice[6];
	for (int i = 0; i < 6; ++i) {
		cin >> dice[i];
	}
	
	string dir;
	cin >> dir;
	for (int j = 0; j < dir.size(); ++j) {
		if (dir[j] == 'E') {
			int a = dice[0];
			dice[0] = dice[3];
			dice[3] = dice[5];
			dice[5] = dice[2];
			dice[2] = a;
		}
		else if (dir[j] == 'N') {
			int b = dice[0];
			dice[0] = dice[1];
			dice[1] = dice[5];
			dice[5] = dice[4];
			dice[4] = b;
		}
		else if (dir[j] == 'S') {
			int c = dice[0];
			dice[0] = dice[4];
			dice[4] = dice[5];
			dice[5] = dice[1];
			dice[1] = c;
		}
		else if (dir[j] == 'W') {
			int d = dice[0];
			dice[0] = dice[2];
			dice[2] = dice[5];
			dice[5] = dice[3];
			dice[3] = d;

		}
	}

	cout << dice[0] << endl;
}



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

using namespace std;
using ll = long long;
ll dp[3001][6001][3];
constexpr long long MOD = 998244353;
int main() {
    int n, s;
    cin >> n >> s;
    vector<ll> A(n);
    for(auto &x : A) {
        cin >> x;
    }
    dp[0][0][0] = 1;
    for(ll i = 0; i < n; i++) {
        for(ll j = 0; j <= s; j++) {

            (dp[i + 1][j][0] += dp[i][j][0]) %= MOD;
            (dp[i + 1][j + A[i]][1] += dp[i][j][0] * (i + 1)) %= MOD;
            (dp[i + 1][j + A[i]][2] += dp[i][j][0] * (i + 1) * (n - i)) %= MOD;

            (dp[i + 1][j][1] += dp[i][j][1]) %= MOD;
            (dp[i + 1][j + A[i]][1] += dp[i][j][1]) %= MOD;
            (dp[i + 1][A[i] + j][2] += dp[i][j][1] * (n - i)) %= MOD;

            (dp[i + 1][j][2] += dp[i][j][2]) %= MOD;
        }
    }
    cout << dp[n][s][2] << endl;
}

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

#define deb(x)        cerr << #x << " = " << x << "\n";
#define deb2(x, y)    cerr << #x << " = " << x << ", " << #y << " = " << y << "\n";
#define deb3(x, y, z) cerr << #x << " = " << x << ", " << #y << " = " << y << ", " << #z << " = " << z << "\n";

#define pb push_back
#define mp make_pair
#define ins insert
#define lb lower_bound
#define ub upper_bound
#define f  first
#define s  second

#define sortall(x) sort(x.begin(), x.end());
#define sz(x) (int)x.size()

typedef long long         ll  ;

typedef vector < ll >     vl  ;
typedef vector < int >    vi  ;

typedef pair < ll, ll >   pl  ;
typedef pair < int, int > pi  ;

typedef vector < pl >     vpl ;
typedef vector < pi >     vpi ;

void solve() {
    ll n, temp;
    cin >> n;

    if (n >= 30)
    	cout << "Yes";
    else cout << "No";
}

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

//  freopen ("in.txt", "r", stdin);
//  freopen ("err.txt", "w", stderr); 
//  freopen ("out.txt", "w", stdout);

    ll tc = 1;
    //cin >> tc;

    while(tc--) {
        solve();
        cout << '\n';
    }

    return 0;
}

Measured memory_bytes: 3648
#include <stdio.h>
 
int main(void) {
    int a,b,c,i;
    int count;
    scanf("%d %d %d\n", &a, &b, &c);
    for(i=a,count=0;i<=b;i++) {
        if(c%i==0) count ++;
    }
    printf("%d\n", count);
     
    return 0;
}

Measured memory_bytes: 600
#include<stdio.h>
#include<algorithm>
#include<functional>
#include<cmath>
#include<numeric>
#include<queue>
#include<string>
#include<vector>
#define ll long long
#define rep(i,n) for(int i=0;i<n;i++)
ll mod = 1000000007;
using namespace std;
priority_queue<ll int>A;//きゅー
int gcd(int a, int b)
{
	if (a < b) {
		a ^= b;
		b ^= a;
		a ^= b;
	}

	return b ? gcd(b, a % b) : a;
}
int main(void)
{
	int N, X,ans=0;
	int A[100010];
	scanf("%d%d", &N, &X);
	for (int i = 0; i < N; i++) {
		scanf("%d", &A[i]);
		A[i] = abs(A[i] - X);
	}
	sort(A, A + N);
	ans = A[N - 1];
	for (int i = N-2; i >= 0; i--) {
		ans = gcd(A[i], ans);
	}
	printf("%d", ans);
	return 0;
}

Measured memory_bytes: 640
#define _USE_MATH_DEFINES
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <climits>
#include <cstdlib>
#include <vector>
#include <queue>
#include <unordered_map> 
#include <iomanip>
using namespace std;
#define ALL(a) (a).begin(),(a).end()
#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define RFOR(i,a,b) for (int i=(b)-1;i>=(a);i--)
#define REP(i,n) for (int i=0;i<(n);i++)
#define RREP(i,n) for (int i=(n)-1;i>=0;i--)
#define INF (INT_MAX/3)
#define PSB push_back
#define PN 1000000007
typedef long long LL;
//#define int long long


//booooooooooooost
//#include <boost/multiprecision/cpp_int.hpp>
//#include <boost/multiprecision/cpp_dec_float.hpp>
//namespace mp = boost::multiprecision;	//多倍長整数(mp::cpp_int), 多倍長小数(mp::cpp_dec_float_100)



LL inv_mod(LL a, LL m)
{
	LL b, x, u, q, tmp;

	b = m; x = 1; u = 0;
	while (b > 0) {
		q = a / b;
		tmp = u; u = x - q * u; x = tmp;
		tmp = b; b = a - q * b; a = tmp;
	}

	return (x < 0) ? m + x : x;
}




signed main() {

	LL A, B, C;
	cin >> A >> B >> C;

	cout << min({ A * B * (C % 2), B * C * (A % 2), C * A * (B % 2) }) << endl;
	





	return 0;
}

Measured memory_bytes: 256
n=int(input())
l=[list(map(int,input().split())) for i in range(n)]
a=[]
b=[]
for i in range(n):
  a.append(l[i][0]+l[i][1])
  b.append(l[i][0]-l[i][1])
print(max(max(a)-min(a),max(b)-min(b)))

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

int main(){
  int n,m;
  cin >> n >> m;
  vector<long long> A(n),B(m);
  for(int i=0;i<n;i++){
    cin >> A[i];
  }
  for(int j=0;j<m;j++){
    cin >> B[j];
  }
  auto C = convolution(A,B);
  for(auto c:C){
    cout << c << " ";
  }
  return 0;
}

Measured memory_bytes: 27260
import qualified Data.ByteString.Char8 as B
import qualified Data.Sequence as SQ

main :: IO ()
main = do
    s <- B.getLine :: IO B.ByteString
    q <- readLn :: IO Int

    let
        solve :: (SQ.Seq Char, SQ.Seq Char) -> Int -> Int -> IO (SQ.Seq Char, SQ.Seq Char, Int)
        solve (sqx,sqy) n cnt
            | n == 0 = return (sqx,sqy,cnt) 
            | otherwise = do
                xs <- words <$> getLine :: IO [String]
                case (length xs) of
                    1 -> do
                        solve (sqx,sqy) (n-1) (cnt+1)
                    _ -> do
                        let [_,f,[c]] = xs
                        case (f, even cnt) of
                            ("1", True) -> solve ((SQ.<|) c sqx, sqy) (n-1) cnt
                            ("1", False) -> solve (sqx, (SQ.|>) sqy c) (n-1) cnt
                            ("2", True) -> solve (sqx, (SQ.|>) sqy c) (n-1) cnt
                            ("2", False) -> solve ((SQ.<|) c sqx, sqy)  (n-1) cnt
        
        out :: SQ.Seq Char -> IO ()
        out sq =
            case SQ.viewl sq of
                c SQ.:< sq' -> do
                    putChar c
                    out sq'
                SQ.EmptyL -> return ()


    (sqx,sqy,cnt) <- solve (SQ.empty, SQ.empty) q 0

    if (even cnt)
        then do
            out sqx
            B.putStr s
            out sqy
            putStrLn ""
        else do
            out $ SQ.reverse sqy
            B.putStr $ B.reverse s
            out $ SQ.reverse sqx
            putStrLn ""

Measured memory_bytes: 21884
#include <cstdio>
#include <cstdlib>
#include <iomanip>
#include <iostream>
#include <list> 
#include<algorithm>
#include<cmath>
#include<map>
#include<vector>
#include<string>
#include<fstream>
#include<set>
#define fastio ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)
#define forl(i,a,n) for(int i=a;i<n;i++)
#define rfor(i,n,a) for(int i=n;i>=a;i--)
#define ll long long
#define ull unsigned long long
#define ld long double
#define pb push_back
#define ld long double
#define vi vector<int>
#define vll vector<long long>
#define pi pair<int,int>
#define pll pair<long long,long long>
#define mp make_pair
#define B begin()
#define E end()
#define S size()
#define m9 1000000007
#define endl "\n"
using namespace std;
 
 

 
ll gcd(ll x,ll y)
{
    if(x==0) return y;
    return gcd(y%x,x);
}

ll powmod(ll x, ll y, ll m) 
{ 
    if (y == 0) 
        return 1; 
    ll p = powmod(x, y/2, m) % m; 
    p = (p * p) % m; 
    return (y%2 == 0)? p : (x * p) % m; 
} 

 
ll mul_inv(ll a, ll b) {
    ll b0 = b, t, q;
    ll x0 = 0ll, x1 = 1ll;
    if (b == 1ll) return 1ll;
    while (a > 1ll) {
        q = a / b;
        t = b, b = a % b, a = t;
        t = x0, x0 = x1 - q * x0, x1 = t;
    }
    if (x1 < 0ll) x1 += b0;
    return x1;
}
 
 
#define p0(a) cout << a << " "
#define p1(a) cout << a << endl
#define p2(a, b) cout << a << " " << b << endl
#define p3(a, b, c) cout << a << " " << b << " " << c << endl
#define p4(a, b, c, d) cout << a << " " << b << " " << c << " " << d << endl
#define pin(a) for(auto x:a)cout<<x<<" ";cout<<endl
#define fck(a) cout<<a;exit(0)
#define vvll vector<vector<ll> >
#define A(b) b.begin(),b.end()
#define vpi std::vector<pll>
#include <array>
#include <stack>
#define arr2 array<ll,2>
#define arr3 array<ll,3>
#define varr2 vector<array<ll,2> >
#define varr3 vector<array<ll,3> >
//include<bits/stdc++.h>
 
 
bool fa(vll &x,vll &y){return x[0]<y[0];}
bool fa1(vll &x,vll &y){return x[1]<y[1];}
bool f1(pll &x,pll &y){return x.second>y.second;}
bool f2(pll &x,pll &y){
    return x.first>y.first;
}
 
 
bool f3(ll &x,ll &y){
    return x>y; 
    }


const ll maxn=2e5+2;





int main()
{ fastio;
//freopen("input.txt, "r", stdin); 
//freopen("output.txt", "w", stdout);

ll n;cin>>n;
if(n==1){
    cout<<0;exit(0);
}
ll ans=powmod(10ll,n,m9);
ll x=powmod(9ll,n,m9);
ll y=powmod(8ll,n,m9);
x=x+x;
x%=m9;
ans-=x;
ans+=y;
while(ans<0){
    ans+=m9;
}
ans%=m9;
p1(ans);



return 0;
}





  







Measured memory_bytes: 3640
#include <bits/stdc++.h> // header file includes every Standard library
using namespace std;
#define mod 1000000007
//finding root of an element.
int root (int Arr[ ] ,int i)
    {
        while(Arr[ i ] != i)
        {
            Arr[ i ] = Arr[ Arr[ i ] ] ;
    i = Arr[ i ];
        }
    return i;
    }

/*modified union function where we connect the elements by changing the root of one of the element */

void unionn(int Arr[] ,int A ,int B)
{
    int root_A = root(Arr, A);
    int root_B = root(Arr, B);
    Arr[ root_B ] = root_A ;       //setting parent of root(A) as root(B).
}


int main()
{

   int n,m,a,b;
   cin>>n>>m;
   int parent[n+1];
   for(int i=0;i<=n;i++)
    parent[i]=i;
   while(m--)
   {
       cin>>a>>b;
       //if(a<b)
        unionn(parent,a,b);
        //else
            //unionn(parent,b,a);

   }

   unordered_map<int,long> mapp;
   for(int i=1;i<=n;i++)
        {
            //cout<<parent[i]<<endl;;
            mapp[root(parent,i)]++;
        }
   long ans=0;
   for(auto it=mapp.begin();it!=mapp.end();it++)
   {

       ans=max(ans,it->second);
   }
   cout<<ans;
}


Measured memory_bytes: 12252
#include <iostream>

using namespace std;

using ll = long long;

int main()
{
    int N;
    cin >> N;
    ll t = 1, a = 1;
    for (int i = 0; i < N; i++) {
        ll T, A;
        cin >> T >> A;
        ll x = max(t / T + (t % T > 0), a / A + (a % A > 0));        
        t = x * T;
        a = x * A;
    }
    cout << t + a << endl;
    return 0;
}


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

int main() {
  int N;
  cin >> N;
  vector<int> A(N);
  for (int& a : A) cin >> a;
  int ans = 0;
  while (true) {
    bool done = false;
    for (int& a : A) {
      if (a % 2 == 0) {
        a /= 2;
        done = true;
        break;
      }
    }
    if (done) ans++;
    else break;
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
import java.util.*;

public class Main{
	public static void main(String args[]){
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int len[] = new int[N];
		for(int i = 0; i < N; i++){
			len[i] = sc.nextInt();
		}
		
		Arrays.sort(len);
		
		int result = 0;
		for(int a = 0; a < N - 2; a++){
			for(int b = a + 1; b < N - 1; b++){
				
				//b - a < c
				int ok = N;
				int ng = b;
				
				while(Math.abs(ok - ng) > 1){
					int mid = (ok + ng) / 2;
					if(len[b] - len[a] < len[mid]){
						ok = mid;
					}
					else{
						ng = mid;
					}
				}
				int cleft = ok;
				
				//c < a + b
				ok = b;
				ng = N;
				
				while(Math.abs(ok - ng) > 1){
					int mid = (ok + ng) / 2;
					if(len[mid] < len[a] + len[b]){
						ok = mid;
					}
					else{
						ng = mid;
					}
				}
				int cright = ok;
				result += Math.max(0, (cright - cleft+1));
			}
		}
		System.out.println(result);
	}
}

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

typedef long long ll;

int main(){
  int H,W,A,B; cin >> H >> W >> A >> B;
  
  for(int i = 0; i < H; i++){
    for(int j = 0; j < W; j++){
      if( j < A ){
        if( i < B){ cout << 0;}
        else{ cout << 1;}
      }
      else{
        if( i < B){ cout << 1;}
        else{ cout << 0;}
      }
      if( j == W-1){ cout << endl;}
    }
  }
  
  return 0;
}
     

Measured memory_bytes: 1280
#[allow(unused_imports)]
use std::cmp::max;
#[allow(unused_imports)]
use std::cmp::min;
#[allow(unused_imports)]
use std::fmt;
#[allow(unused_imports)]
use std::fmt::Debug;
#[allow(unused_imports)]
use std::io;
#[allow(unused_imports)]
use std::str::FromStr;

fn main() {
    let input = get_vec_input();
    let a: u64 = input[0];
    let b: u64 = input[1];
    let c: u64 = input[2];
    let x: u64 = input[3];
    let y: u64 = input[4];

    if (a + b) / 2 < c {
        println!("{}", a * x + b * y);
    } else {
        let c_count = if x < y { x } else { y };
        let rest_ammount = if x < y {
            let b = (y - x) * b;
            let c = (y - x) * c * 2;
            if b < c {
                b
            } else {
                c
            }
        } else {
            let a = (x - y) * a;
            let c = (x - y) * c * 2;
            if a < c {
                a
            } else {
                c
            }
        };
        println!("{}", c_count * c * 2 + rest_ammount);
    }
}

#[allow(dead_code)]
fn check_prime(value: i64) -> bool {
    if value == 2 {
        return true;
    }
    if value % 2 == 0 {
        return false;
    }
    for i in 3..(value as f64).sqrt().floor() as i64 {
        if value % i == 0 {
            return false;
        }
    }
    return true;
}

#[allow(dead_code)]
fn get_digit(value: i64) -> i64 {
    let mut digit = 0i64;
    let mut value = value;
    while value != 0 {
        value /= 10;
        digit += 1;
    }
    digit
}

#[allow(dead_code)]
fn sum_digit2(value: String) -> u32 {
    return value.chars().fold(0u32, |a, b| a + b.to_digit(10).unwrap());
}

#[allow(dead_code)]
fn sum_digit(value: i64) -> i64 {
    if value < 10 {
        return value;
    }
    return sum_digit(value / 10) + value % 10;
}

#[allow(dead_code)]
fn update_max<T>(left: &mut T, right: T)
where
    T: std::cmp::Ord + std::clone::Clone,
{
    if *left < right {
        *left = right.clone();
    }
}

#[allow(dead_code)]
fn update_min<T>(left: &mut T, right: T)
where
    T: std::cmp::Ord + std::clone::Clone,
{
    if *left > right {
        *left = right.clone();
    }
}

#[allow(dead_code)]
fn get_vec_input<T>() -> Vec<T>
where
    T: FromStr,
    T::Err: Debug,
{
    let mut input = String::new();
    io::stdin()
        .read_line(&mut input)
        .expect("Failed to read line");
    let vec: Vec<T> = input
        .split_whitespace()
        .map(|x| x.parse().unwrap())
        .collect();
    vec
}

#[allow(dead_code)]
fn get_tuple_input() -> (u64, f32) {
    let mut s = String::new();
    io::stdin().read_line(&mut s).expect("");
    let mut iter = s.trim().split_whitespace();
    let c: u64 = iter.next().unwrap().parse().unwrap();
    let n: f32 = iter.next().unwrap().parse().unwrap();
    (c, n)
}

#[allow(dead_code)]
fn get_string_input() -> String {
    let mut s = String::new();
    io::stdin().read_line(&mut s).expect("");
    s.trim().to_string()
}


Measured memory_bytes: 4352
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {

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

  private void run() {

    try(BufferedReader br = new BufferedReader(new InputStreamReader(System.in))) {

      int heapSize = Integer.parseInt(br.readLine());
      String[] keys = br.readLine().split(" ");
      int[] mHeap = new int[heapSize+1];
      mHeap[0] = heapSize;
      for(int i=1; i<=heapSize; i++)
        mHeap[i] = Integer.parseInt( keys[i-1] );

      buildMaxHeap(mHeap);

      StringBuilder buf = new StringBuilder();
      for(int i=1; i<mHeap.length; i++) 
        buf.append(" ").append(mHeap[i]);

      System.out.println(buf);
    } catch(IOException e) {
      System.out.println("IOException!");
    }
  }
  private void buildMaxHeap(int[] heap) {
    for(int i= heap[0]/2; i>0; i--)
      maxHeapify(heap, i);
  }
  private void maxHeapify(int[] heap, int node) {
    int t,left,right,largest;
    left  = node*2;
    right = left+1;

    if( (left <= heap[0]) && (heap[left] > heap[node]) )
      largest = left;
    else
      largest = node;
    if( (right <= heap[0]) && (heap[right] > heap[largest]) )
      largest = right;

    if( largest != node ) {
      t = heap[node]; heap[node] = heap[largest]; heap[largest] = t;

      maxHeapify(heap, largest);
    }
  }
}


Measured memory_bytes: 75480