akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
int main() {
	int n, k; cin >> n >> k;
	int pre[n + 1] = {};
	int a[n + 1] = {};
	for (int i = 1; i <= n; i++) {
		cin >> a[i];
		pre[i] = pre[i - 1] + a[i];
	}
	int mx = 0, bg = 0;
	for (int i = k; i <= n; i++) {
		if (pre[i] - pre[i - k] > mx) {
			bg = i - k + 1;
			mx = pre[i] - pre[i - k];
		}
	}
	double ans = 0.0;
	for (int i = 0; i < k; i++)
		ans += (a[bg + i] + 1) / 2.0;
	printf("%.6f\n", ans);
}

Measured memory_bytes: 1792
#include<iostream>
 
int main()
{
	const int dayMaxSum[13] = 
	{
		0,
		31,
		60,
		91,
		121,
		152,
		182,
		213,
		244,
		274,
		305,
		335,
		366
	};

	int month=1,day=0,daySum=0;//month=0で終了するため1で初期化

	while(std::cin >> month >> day && month!=0)
	{
		daySum = dayMaxSum[month-1]+day;

		switch(daySum%7)
		{
		case 1:
			std::cout << "Thursday";
			break;
		case 2:
			std::cout << "Friday";
			break;
		case 3:
			std::cout << "Saturday";
			break;
		case 4:
			std::cout << "Sunday";
			break;
		case 5:
			std::cout << "Monday";
			break;
		case 6:
			std::cout << "Tuesday";
			break;
		case 0:
			std::cout << "Wednesday";
			break;
		}
		std::cout << '\n';

		daySum=0;
	}
}

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


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

	vector<int> a;
	for (int i = 0;i < n;i++) {
		int b;
		cin >> b;
		a.push_back(b);
	}
	int max = *max_element(a.begin(), a.end());
	int c = count(a.begin(),a.end(), max);
	if (c != 1) {
		for (int i = 0;i < n ;i++) {
			cout << max << endl;
		}
	}
	else {
		for (int i = 0;i < n;i++) {
			if (max == a[i]) {
				a[i] = 0;
				cout << *max_element(a.begin(), a.end()) << endl;
			}
			else {
				cout << max << endl;
			}
		}
	}

	return 0;
}

Measured memory_bytes: 2548
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;
using ll = long long;
const int INF = (1<<30)-1;
const long long LINF = (1LL<<62)-1;
const int dx[] = {-1, 0, 1, 0};
const int dy[] = {0, 1, 0, -1};
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

const int MOD = 1000000007;
const int MAX = 510000;
long long fac[MAX], finv[MAX], inv[MAX];
void init_comb() {
  fac[0] = fac[1] = 1;
  finv[0] = finv[1] = 1;
  inv[1] = 1;
  for (int i = 2; i < MAX; i++) {
    fac[i] = fac[i - 1] * i % MOD;
    inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
    finv[i] = finv[i - 1] * inv[i] % MOD;
  }
}
long long comb(int n, int r) {
  if (n < r) return 0;
  if (n < 0 || r < 0) return 0;
  return fac[n] * (finv[r] * finv[n - r] % MOD) % MOD;
}

template< int mod >
struct ModInt {
  int x;
  ModInt() : x(0) {}
  ModInt(long long y) : x(y >= 0 ? y % mod : (mod - (-y) % mod) % mod) {}
  ModInt &operator+=(const ModInt &p) {
    if((x += p.x) >= mod) x -= mod;
    return *this;
  }
  ModInt &operator-=(const ModInt &p) {
    if((x += mod - p.x) >= mod) x -= mod;
    return *this;
  }
  ModInt &operator*=(const ModInt &p) {
    x = (int) (1LL * x * p.x % mod);
    return *this;
  }
  ModInt &operator/=(const ModInt &p) {
    *this *= p.inverse();
    return *this;
  }
  ModInt operator-() const { return ModInt(-x); }
  ModInt operator+(const ModInt &p) const { return ModInt(*this) += p; }
  ModInt operator-(const ModInt &p) const { return ModInt(*this) -= p; }
  ModInt operator*(const ModInt &p) const { return ModInt(*this) *= p; }
  ModInt operator/(const ModInt &p) const { return ModInt(*this) /= p; }
  bool operator==(const ModInt &p) const { return x == p.x; }
  bool operator!=(const ModInt &p) const { return x != p.x; }
  ModInt inverse() const {
    int a = x, b = mod, u = 1, v = 0, t;
    while(b > 0) {
      t = a / b;
      swap(a -= t * b, b);
      swap(u -= t * v, v);
    }
    return ModInt(u);
  }
  ModInt pow(long long n) const {
    ModInt ret(1), mul(x);
    while(n > 0) {
      if(n & 1) ret *= mul;
      mul *= mul;
      n >>= 1;
    }
    return ret;
  }
  friend ostream &operator<<(ostream &os, const ModInt &p) {
    return os << p.x;
  }
  friend istream &operator>>(istream &is, ModInt &a) {
    long long t;
    is >> t;
    a = ModInt< mod >(t);
    return (is);
  }
  static int get_mod() { return mod; }
};
using mint = ModInt< MOD >;

signed main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  init_comb();
  int n, k;
  cin >> n >> k;
  mint ans = 0;
  rep(i, min(k+1, n)) {
    mint res = 1;
    int rem = n-i;
    res *= comb(n, i);
    res *= comb(i+rem-1, i);
    ans += res;
  }
  cout << ans << endl;
  return 0;
}

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

int main(){
  int N;
  cin >> N;
  int64_t A , B , C;
  A = 2;
  B = 1;
  C = 1;
  
  for(int i = 0 ; i < N - 1;i++){
    C = A + B;
    A = B;
    B = C;
  }
  
  cout << C << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include<numeric>
#include<cmath>
#include<map>
#include<iomanip>
#include<queue>
#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 INF 2e9
#define ALL(v) v.begin(), v.end()
using namespace std;
using ll = long long;
using P = pair<int,int>;
using pll = pair<ll,ll>;
using pdd = pair<double,double>;
using vvi = vector<vector<int> >;
using vvll =  vector<vector<ll> >;
vector<vector<int> > G;

void bfs(vector<int>& maze, int start){ 
    maze[start] = 0;
    queue<int> que;
    que.push(start);
    while(!que.empty()){
        int now = que.front();
        que.pop();
        REP(i,G[now].size()){
            int next = G[now][i];
            if(maze[next] == -1){
                maze[next] = maze[now] + 1;
                que.push(next);
            }
        }
    }
}

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

    int N,u,v; cin >>N>>u>>v;  //uが逃げる人,vが鬼
    u--; v--;
    G.resize(N);
    REP(i,N-1){
        int a,b;
        cin >>a>>b;
        a--; b--;
        G[a].push_back(b);
        G[b].push_back(a);
    }
    vector<int> bfsnige(N,-1),bfsoni(N,-1);

    bfs(bfsnige, u);
    bfs(bfsoni, v);

    vector<P> far;
    REP(i,N){
        if(bfsnige[i] < bfsoni[i]){
            far.push_back(P(bfsoni[i], i));
        }
    }

    sort(ALL(far),greater<P>());
    int farest = far[0].second;
    //cout << farest << endl;
    
    int ans;
    if((bfsoni[farest] - bfsnige[farest]) % 2){
        ans = bfsoni[farest] - 1;
    }
    else{ans = bfsoni[farest] - 1;}

    cout << ans << endl;
}



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

using namespace std;

#define int long long
#define PB push_back
typedef pair<int, int> pii;
static const int INF = 1LL<<61;

int w, h, field[105][105];
int dx[][6] = {{-1, -1, 0, 1, 0, -1}, {-1, 0, 1, 1, 1, 0}};
int dy[] = {0, 1, 1, 0, -1, -1};

void dfsEmp(int x, int y) {
  field[x][y] = 0;

  for (int i = 0; i < 6; ++i) {
    int tx = x + dx[y % 2][i], ty = y + dy[i];
    if (tx < 0 || w + 1 < tx || ty < 0 || h + 1 < ty || field[tx][ty] != 1) continue;
    dfsEmp(tx, ty);
  }
}

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

  cin >> w >> h;
  for (int y = 1; y <= h; ++y) {
    for (int x = 1; x <= w; ++x) {
      int t;
      cin >> t;
      field[x][y] = t + 1;
    }
  }
  for (int x = 0; x <= w + 1; ++x) {
    dfsEmp(x, 0);
    dfsEmp(x, h + 1);
  }
  for (int y = 0; y <= h + 1; ++y) {
    dfsEmp(0, y);
    dfsEmp(w + 1, y);
  }

  int ans = 0;
  for (int x = 1; x <= w; ++x) {
    for (int y = 1; y <= h; ++y) {
      if (field[x][y] != 2) continue;
      for (int i = 0; i < 6; ++i) {
        int tx = x + dx[y % 2][i], ty = y + dy[i];
        if (field[tx][ty] == 0) ans++;
      }
    }
  }

  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 1516
#include <iostream>
#include <vector>
#include <set>
#include <map>
#include <algorithm>
#include <numeric>

#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;
using ll = long long;
using P = pair<int, int>;

// int A, B, F, H, I, J, K, L, M, N, S, T, U;
// ll A, B, F, H, I, J, K, L, M, N, S, T, U;
string S;
char C;
int Q, T, F, N = 0;
string ans;

vector<char> front;
vector<char> back;

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

	cin >> S >> Q;

	vector<char> s;
	rep (i, S.length()) {
		s.push_back(S[i]);
	}

	rep (i, Q) {
		cin >> T;
		if (T == 1) {
			N++;
		}
		if (T == 2) {
			cin >> F >> C;
			if (F == 1) {
				if (N % 2 == 0) {
					front.push_back(C);
				} else {
					back.push_back(C);
				}
			} else {
				if (N % 2 == 0) {
					back.push_back(C);
				} else {
					front.push_back(C);
				}
			}
		}
	}

	if (N % 2 == 0) {
		for (auto it = front.rbegin(); it != front.rend(); it++) {
			ans += *it;
		}
		ans += S;
		for (auto it = back.begin(); it != back.end(); it++) {
			ans += *it;
		}
	} else {
		for (auto it = back.rbegin(); it != back.rend(); it++) {
			ans += *it;
		}
		for (auto it = s.rbegin(); it != s.rend(); it++) {
			ans += *it;
		}
		for (auto it = front.begin(); it != front.end(); it++) {
			ans += *it;
		}
	}

	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 1576
#include <stdio.h>
#include <math.h>

int isPrime(int);
int main()
{
    int a[10000], i, count = 0, N;
    scanf("%d", &N);
    for (i = 0; i < N; i++) {
        scanf("%d", &a[i]);
        if (isPrime(a[i]) == 1) {
            count++;
        }
    }
    printf("%d\n", count);
    return 0;
}

int isPrime(int x)
{
    int i;
    if (x == 2) {
        return 1;
    } else if (x % 2 == 0) { //前のifで2は除外
        return 0;
    }
    i = 3;
    while (i <= sqrt(x)) {
        if (x % i == 0) {
            return 0;
        }
        i = i + 2;
    }
    return 1;
}


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

void Main()
{
  int N;
  cin >> N;
  vector<int> h(N);
  rep(i,N) {cin >> h[i];}
  int idx = 0;
  int cnt = 0;
  while (idx < N) {
    while (h[idx] == 0) {
      idx++;
      if (idx == N) break;
    }
    if (idx == N) break;
    for (int j = idx; j < N; j++) {
      if (h[j] == 0) break;
      else h[j]--;
    }
    cnt++;
    idx = 0;
  }
  cout << cnt << endl;
}

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

Measured memory_bytes: 256
import java.util.PriorityQueue;
import java.util.Scanner;

public class Main {

	static Scanner sc = new Scanner(System.in);
	static int[] DX = { 0, 1, 1, 0, -1, -1, 0 };
	static int[] DY = { 1, 0, -1, -1, -1, 0, 0 };

	public static void main(String[] arg) {
		int sx = sc.nextInt();
		int sy = sc.nextInt();
		int gx = sc.nextInt();
		int gy = sc.nextInt();
		int N = sc.nextInt();
		int[] ox = new int[N];
		int[] oy = new int[N];
		for (int i = 0; i < N; ++i) {
			ox[i] = sc.nextInt();
			oy[i] = sc.nextInt();
		}
		int LX = sc.nextInt();
		int LY = sc.nextInt();
		sx += LX;
		sy += LY;
		gx += LX;
		gy += LY;
		boolean[][] obst = new boolean[2 * LX + 1][2 * LY + 1];
		for (int i = 0; i < N; ++i) {
			obst[ox[i] + LX][oy[i] + LY] = true;
		}
		boolean[][][] visited = new boolean[6][2 * LX + 1][2 * LY + 1];
		PriorityQueue<State> q = new PriorityQueue<State>();
		q.add(new State(0, sx, sy, 0));
		while (!q.isEmpty()) {
			State cur = q.poll();
			int x = cur.x;
			int y = cur.y;
			int t = cur.t;
			if (visited[t][x][y]) continue;
			visited[t][x][y] = true;
			if (x == gx && y == gy) {
				System.out.println(cur.d);
				return;
			}
			int d = Math.abs((x - LX) * (y - LY) * t) % 6;
			int nt = (t + 1) % 6;
			for (int k = 0; k < 7; ++k) {
				int add = k == d ? 0 : 1;
				int nx = x + DX[k];
				int ny = y + DY[k];
				if (k % 3 != 0 && (x - LX) % 2 != 0) ny++;
				if (0 <= nx && nx <= 2 * LX && 0 <= ny && ny <= 2 * LY && !obst[nx][ny] && !visited[nt][nx][ny]) {
					q.add(new State(cur.d + add, nx, ny, nt));
				}
			}
		}
		System.out.println(-1);
	}

	static class State implements Comparable<State> {
		int d, x, y, t;

		public State(int d, int x, int y, int t) {
			this.d = d;
			this.x = x;
			this.y = y;
			this.t = t;
		}

		public int compareTo(State o) {
			return this.d - o.d;
		}
	}

}

Measured memory_bytes: 54412
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace __gnu_pbds;
using namespace std;
 
#define ff                  first
#define ss                  second
#define endl                "\n"
#define loop(i,s,e)         for(int i=s;i<e;i++)
#define int                 long long
#define vi                  vector<int> 
#define S(v)                sort(v.begin(),v.end())
#define RS(v)               sort(v.rbegin(),v.rend())
#define R(v)                reverse(v.begin(),v.end())
#define mxpq(T)             priority_queue <T>
#define mnpq(T)             priority_queue<T,vector<T>,greater<T>>
#define prv(v)              for(auto &x : v)cout << x << " ";
#define piirv(v)            for(auto &x : v)cout << x.ff << " " << x.ss << endl;
#define prvv(v)             for(auto &x : v)for(auto &y : x.ss)cout << y << " ";
#define mp                  make_pair
#define pii                 pair<int,int>
#define mset(a,f)           memset(a , f , sizeof(a))
#define pb                  push_back
#define inf                 INT_MAX
#define INF                 LLONG_MAX
typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> oset;
 
const int N = 2e6 + 6;
const int M = 1e9+7;
int A[N];
int n , m;

void solve()
{
	int r , g , b;

	cin >> r >> g >> b;

	int k;
	cin >> k;

	int cnt = 0;

	while(g <= r)
	{
		g = g*2;
		cnt++;
	}

	while(b <= g)
	{
		b *= 2;
		cnt++;
	}
	if(cnt <= k)
	{
		cout << "Yes";
	}
	else
	{
		cout << "No";
	}
}			
 
int32_t main()
{
 
cout<<fixed<<setprecision(16);
 
ios_base:: sync_with_stdio(false);
cin.tie(NULL); cout.tie(NULL);
 	
 
 	int t = 1;
 	// cin >> t;
 	while(t--)solve();
  
}

Measured memory_bytes: 3628
import java.util.Scanner;

public class Main{

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner scanner = new Scanner(System.in);
		while(scanner.hasNext()) {
			int n = scanner.nextInt();
			int a, b, c, d, cnt =0;
			for(a = 0; a < 10; a++) {
				for(b = 0; b < 10; b++) {
					for(c = 0; c < 10; c++) {
						for(d = 0; d < 10; d++) {
							if(a + b + c + d == n) {
								cnt++;
								continue;
							}
						}
					}
				}
			}
			System.out.println(cnt);
		}

		scanner.close();
	}

}



Measured memory_bytes: 26548
import java.util.Scanner;

class Main {

	public static void main(String[] args){

		Scanner sc = new Scanner(System.in);
		
		int a = sc.nextInt();
		int b = sc.nextInt();
		int c = sc.nextInt();


		if(a < b && b < c)
			System.out.println("Yes");
		else
			System.out.println("No");
	}

}


Measured memory_bytes: 26268
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
int main()
{
    ll t=0;
    string s,s1;
    cin>>s>>s1;
    for(int i = 0;i < s.size();i++)
    {
        if(s[i]==s1[i])
        {
            t++;
        }
    }
    cout<<t<<endl;
}


Measured memory_bytes: 256
# AtCoder DP C
def f(A, B, C):
    n = len(A)
    a, b, c = 0, 0, 0 # last activity ending with a/b/c
    for i in range(n):
        a_ = max(b + A[i], c + A[i])
        b_ = max(a + B[i], c + B[i])
        c_ = max(a + C[i], b + C[i])
        a, b, c = a_, b_, c_
    return max(a, b, c)

assert f([10, 20, 30], [40, 50, 60], [70, 80, 90]) == 210

n = int(input())
A, B, C = [], [], []
for _ in range(n):
    a, b, c = map(int, input().split())
    A.append(a)
    B.append(b)
    C.append(c)
ans = f(A, B, C)
print(ans)


Measured memory_bytes: 15012
#include<stdio.h>
#include<math.h>
#include<algorithm>
#include<queue>
#include<deque>
#include<string>
#include<string.h>
#include<vector>
#include<set>
#include<map>
#include<stdlib.h>
#include<cassert>
using namespace std;
const long long mod=1000000007;
const long long inf=mod*mod;
const long long d2=500000004;
const double EPS=1e-6;
const double PI=acos(-1.0);
int ABS(int a){return max(a,-a);}
long long ABS(long long a){return max(a,-a);}
char in[10];
int main(){
	scanf("%s",in);
	int ret=0;
	for(int i=0;i<6;i++)ret+=in[i]-'0';
	printf("%d\n",ret);
}

Measured memory_bytes: 128
#include <iostream>
#include <string.h>
#include <cstring>
#include <math.h>
#include <algorithm>
#include <functional>
#include <stack>
#include <queue>
#include <vector>
#include <map>
using namespace std;

#define cio ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)
#define ll long long
#define ii pair < int, int >
#define iii pair < int, ii >
#define INF 987654321
#define LINF 987654321987654321

ll arr[200005];
ll nu_b[200005];

ll bin(int st, int en, ll val)
{
    if (en - st <= 1)
        return st;

    int mi = (st + en) / 2;
    ll look = nu_b[mi];

    if (look == val)
        return mi;
    else if (look < val)
        return bin(mi, en, val);
    else
        return bin(st, mi, val);
}

int main()
{
    cio;
    ll n, m, k;
    cin >> n >> m >> k;

    for (ll i = 1; i <= n; i++)
        cin >> arr[i];
    for (ll i = 1; i <= m; i++)
    {
        ll inp;
        cin >> inp;
        nu_b[i] = nu_b[i - 1] + inp;
    }

    ll ma = 0;
    ll nu_a = 0;
    for (ll i = 0; i <= n; i++)
    {
        nu_a += arr[i];

        if (nu_a > k)
            break;

        ma = max(ma, i + bin(0, m + 1, k - nu_a));
    }

    cout << ma;
}


Measured memory_bytes: 6248
#include<bits/stdc++.h>
#define all(v) v.begin(), v.end()
#define mp make_pair
using namespace std;

using ll = long long;
using ii = pair<int, int>;
const int INF = (int)10e9;
int N, W;
ll dp[105][100005];

int main() {
    std::ios::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    cin >> N >> W;
    vector<int> w(N), v(N);
    for(int i = 0; i < N; i++) {
        cin>>w[i]>>v[i];
    }

    for(int i = 0; i < N; i++) {
        for(int j = 0; j <= W; j++) {
            if(i == 0) { if(j >= w[i]) dp[i][j] = v[i];}
            else if(j - w[i] >= 0) dp[i][j] = max(v[i] + dp[i-1][j-w[i]], dp[i-1][j]);
            else dp[i][j] = dp[i-1][j];
        }
    }

    cout<<dp[N-1][W]<<endl;

    return 0;
}

Measured memory_bytes: 81668
#include "bits/stdc++.h"
using namespace std;

int main(){
    int n;
    long x;
    cin >> n >> x;
    long *a = new long[n];
    for (int i=0;i<n;i++){
        cin >> a[i];
    }
    sort(a,a+n);
    long sum=0;
    long count = 0;
    for(long i=0;i<n;i++){
        sum += a[i];
        if(sum > x){
            break;
        }
        count++;
    }
    if(count==n && sum!=x) count--;
    cout << count << endl;
}

Measured memory_bytes: 256
#include <cstdio>
#include <vector>
#include <algorithm>
#pragma warning(disable : 4996)
using namespace std;
void reader(int *x) {
	int k = getchar_unlocked(); *x = k - '0';
	while (1) {
		k = getchar_unlocked();
		if (k < '0' || k > '9') break;
		*x = ((*x) << 1) + ((*x) << 3) + k - '0';
	}
}
int N, L, a[100009], dp[100009]; vector<int> x[50009];
int main() {
	reader(&N); reader(&L);
	for (int i = 0; i < N; i++) {
		reader(&a[i]);
		x[a[i]].push_back(i + 1);
	}
	for (int i = L - 1; i >= 1; i--) {
		for (int j : x[i]) {
			dp[j] = max(dp[j - 1], dp[j + 1]) + (L - a[j - 1]);
		}
	}
	printf("%d\n", *max_element(dp, dp + N + 1));
	return 0;
}

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

int main(){
  int N;
  string S;
  cin>>N>>S;
  for(char i:S){
    char a=(char)(int)i+N;
    if(a>'Z')
      a=a-('Z'-'A'+1);
    cout<<a;
  }
  cout<<endl;
}

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

fun main(args: Array<String>) {
    val br = BufferedReader(InputStreamReader(System.`in`))
    val (a, b) = br.readLine().split(' ').map { it.toInt() }
    val c = a*b
    println(if (c % 2 == 0) "Even" else "Odd")
}

Measured memory_bytes: 35420
#include<bits/stdc++.h>
using lint=long long;
int main(){
    std::cin.tie(nullptr);std::ios_base::sync_with_stdio(false);
    std::cout.setf(std::ios_base::fixed);std::cout.precision(15);
    std::string s;std::cin>>s;
    std::string ans;
    for(char c:s){
        if(c=='B'){
            if(!ans.empty())
            ans.pop_back();
        }
        else ans.push_back(c);
    }
    std::cout<<ans<<'\n';
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef unsigned long long ll;
typedef long long ull;
typedef long double ld;
#define in_arr(name,size) for(int i = 0;i<size;i++)\
cin >> name[i];
#define QUICK ios_base::sync_with_stdio(0);cout << fixed;
#define MOD 1e9+7

int main(){
    QUICK

    int i,j,k;
    cin >> i >> j >> k;
    vector<vector<char>>ch(i,vector<char>(j));
    for(int m = 0;m<i;m++){
        for(int n = 0;n<j;n++)
        {
            cin >> ch[m][n];
        }
    }
    int ans = 0;
    for(int m = 0;m<(1<<i);m++){
        for(int n = 0;n<(1<<j);n++){
            int cnt = 0;
            for(int a = 0;a<i;a++){
                for(int b = 0;b<j;b++){
                    if(((m>>a)&1)==0&&((n>>b)&1)==0&&ch[a][b]=='#')
                        cnt++;
                }
            }
            if(cnt==k)
                ans++;
        }
    }
        cout << ans;
   return 0;
}


Measured memory_bytes: 3656
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
#define lower(s) transform(s.begin(), s.end(), s.begin(), ::tolower)
using namespace std;
using ll = long long;
int INF = 1001001001;

int main()
{
  int k;
  cin >> k;
  set<int> s;
  int i = 1;
  int x = 7 % k;
  while (s.count(x) == 0)
  {
    s.insert(x);
    if (s.count(0) != 0)
    {
      cout << i << endl;
      return 0;
    }
    x = (10 * x + 7) % k;
    i++;
  }
  cout << -1 << endl;
  return 0;
}

Measured memory_bytes: 50400
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
typedef long long ll;
using less_set = tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update>;
using great_set = tree<int, null_type, greater<int>, rb_tree_tag, tree_order_statistics_node_update>;
#define FIO ios_base::sync_with_stdio(0);cin.tie(0);
const int N = 2e3+69;
#define ALL(x) begin(x),end(x)
#define sz(x) (ll)x.size()
const int OO = 0x3f3f3f3f;
const int mod = 998244353;


ll n, s;
ll arr[3069];

ll mem[3069][3069];
ll solve(int idx, int sum)
{
    ll op1, op2;
    if(idx == n)
    {
        if(sum == s)
            return 1;
        else
            return 0;
    }
    if(mem[idx][sum] != -1)
        return mem[idx][sum];
    op1 = op2 = 0;
    if(sum + arr[idx] <= s)
        op1 = solve(idx+1, sum+arr[idx])%mod;
    op2 = (2*solve(idx+1, sum))%mod;

    return mem[idx][sum] = (op1 + op2)%mod;
}


int main()
{
    FIO
    memset(mem, -1, sizeof mem);
    cin >> n >> s;
    for(int i = 0; i< n; i++)
        cin >> arr[i];
    cout << solve(0, 0)%mod << "\n";
    return 0;
}


Measured memory_bytes: 77384
#include <bits/stdc++.h>
#define Int uint64_t

using namespace std;

void solve() {
	Int N, A, B, C, D;
	cin >> N >> A >> B >> C >> D;

	Int ans = 1e18;
	using P = pair<Int, Int>;
	priority_queue<P, vector<P>, greater<P>> que;
	que.emplace(0, N);
	map<Int, Int> mp;
	auto insert = [&](Int n, Int cost) {
		if (!mp.count(n) || mp[n] > cost) {
			que.emplace(cost, n);
		}
	};

	while (!que.empty()) {
		auto p = que.top(); que.pop();
		Int cost = p.first, n = p.second;
		if (mp.count(n) && mp[n] <= cost) { continue; }
		mp[n] = cost;
		if (n == 0) {
			ans = min(ans, cost);
			continue;
		}

		{
			if (n % 2 == 0) {
				Int add = min(A, n / 2 * D);
				insert(n / 2, cost + add);
			} else {
				Int add = min(A, n / 2 * D) + D;
				insert(n / 2, cost + add);
				add = min(A, (n + 1) / 2 * D) + D;
				insert((n + 1) / 2, cost + add);
			}
		}
		{
			if (n % 3 == 0) {
				Int add = min(B, n / 3 * 2 * D);
				insert(n / 3, cost + add);
			} else {
				Int m = n % 3;
				Int add = min(B, n / 3 * 2 * D) + m * D;
				insert(n / 3, cost + add);
				add = min(B, (n + 2) / 3 * 2 * D) + (3 - m) * D;
				insert((n + 2) / 3, cost + add);
			}
		}
		{
			if (n % 5 == 0) {
				Int add = min(C, n / 5 * 4 * D);
				insert(n / 5, cost + add);
			} else {
				Int m = n % 5;
				Int add = min(C, n / 5 * 4 * D) + m * D;
				insert(n / 5, cost + add);
				add = min(C, (n + 4) / 5 * 4 * D) + (5 - m) * D;
				insert((n + 4) / 5, cost + add);
			}
		}
	}
	cout << ans << endl;
}

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

	int T;
	cin >> T;
	while (T--) {
		solve();
	}

	return 0;
}


Measured memory_bytes: 4172
#include <iostream>
#include <vector>
#include <algorithm>
#include <queue>
#include <set>
using namespace std;

#define REP(i, n) for(int i = 0; i < (int)(n); ++i)
#define FOR(i, m, n) for(int i = (int)(m); i < (int)(n); ++i)

void addGames(queue<pair<int,int>>& q, set<pair<int,int>>& games, int i, 
              vector<vector<int>>& A, vector<int>& next_game, int N){
    if(next_game[i] == N-1) return;
    int enemy = A[i][next_game[i]];
    auto p = make_pair(min(i,enemy), max(i, enemy));
    if(A[enemy][next_game[enemy]] == i and games.find(p) == games.end()){
        games.insert(p);
        q.push(p);
    }
}

int main()
{
    int N;
    cin >> N;
    vector<vector<int>> A(N, vector<int>(N-1));
    REP(i, N){
        REP(j, N-1){
            cin >> A[i][j];
            --A[i][j];
        }
    }

    vector<int> next_game(N, 0);
    queue<pair<int,int>> q;
    set<pair<int,int>> games;
    REP(i, N){
        addGames(q, games, i, A, next_game, N);
    }
        
    int ans = 0;
    while(!q.empty()){
        ++ans;
        int num_games = q.size();
        REP(i, num_games){
            auto tmp = q.front(); q.pop();
            ++next_game[tmp.first], ++next_game[tmp.second];
            addGames(q, games, tmp.first, A, next_game, N);
            addGames(q, games, tmp.second, A, next_game, N);
        }
    }
    REP(i, N){
        if(next_game[i] != N-1){
            cout << -1 << endl;
            return 0;
        }
    }
    cout << ans << endl;
    
    return 0;
}

Measured memory_bytes: 27648
package main

import "fmt"

func main() {
	var s string
	fmt.Scan(&s)
	f := s[0]
	for i := 1; i < 4; i++ {
		if f == s[i] {
			fmt.Println("Bad")
			return
		}
		f = s[i]
	}
	fmt.Println("Good")
}


Measured memory_bytes: 512
#include <iostream>

using namespace std;

#define INFTY 1000000001

int count = 0;

void merge(int A[], int left, int mid, int right) {
	int i, j, k;
	int n1 = mid - left;
	int n2 = right - mid;
	int L[n1 + 1], R[n2 + 1];

	for (i = 0; i < n1; i++) {
		L[i] = A[left + i];
	}
	for (i = 0; i < n2; i++) {
		R[i] = A[mid + i];
	}
	L[n1] = R[n2] = INFTY;

	i = j = 0;
	for (k = left; k < right; k++) {
		count++;
		if (L[i] <= R[j]) {
			A[k] = L[i];
			i++;
		}
		else {
			A[k] = R[j];
			j++;
		}
	}
}

void mergeSort(int A[], int left, int right) {
	if (left + 1 < right) {
		int mid = (left + right) / 2;
		mergeSort(A, left, mid);
		mergeSort(A, mid, right);
		merge(A, left, mid, right);
	}
}

int main() {
	int n, num[500000];
	cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> num[i];
	}
	mergeSort(num, 0, n);

	for (int i = 0; i < n - 1; i++) {
		cout << num[i] << " ";
	}
	cout << num[n - 1] << endl;
	cout << count << endl;

	return 0;
}

Measured memory_bytes: 5064
#include<cstdio>
#include<cstring>
#include<vector>
#include<queue>
#include<algorithm>
#include<cmath>
#include<climits>
#include<string>
#include<set>
#include<numeric>
#include<map>
#include<iostream>
using namespace std;
#define rep(i,n) for(int i = 0;i<((int)(n));i++)
#define reg(i,a,b) for(int i = ((int)(a));i<=((int)(b));i++)
#define irep(i,n) for(int i = ((int)(n)-1);i>=0;i--)
#define ireg(i,a,b) for(int i = ((int)(b));i>=((int)(a));i--)
typedef long long ll;
typedef pair<ll, ll> mp;

ll A,B,C,D,E,F;
ll water=0,sugar=0;
ll w,s;

int main(void){
	cin>>A>>B>>C>>D>>E>>F;
	water = A*100;
	reg(a,0,int(double(F)/100/A)){
		reg(b,0,int(double(F)/100/B)){
			w = 100*(A*a+B*b);
			if(w==0)continue;
			reg(c,0,w/100*E/C){
				reg(d,0,w/100*E/D){
					s = C*c+D*d;
					if(w+s <= F
						&& w/100*E >= s
						&& sugar*(s+w) < s*(water+sugar)
						){
						water = w;
						sugar = s;
						// printf("%lld %lld,%lf\n", water,sugar,conc);
					}
				}
			}
		}	
	}
	printf("%lld %lld\n", water+sugar,sugar);
	return 0;
}

Measured memory_bytes: 256
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=(ll)(n)-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=(a);i<=(b);i++)
#define FORD(i,a,b) for(ll i=(a);i>=(b);i--)
#define ALL(x) (x).begin(),(x).end() //sortなどの引数を省略したい
#define SIZE(x) ((ll)(x).size()) //sizeをsize_tからllに直しておく
#define MAX(x) *max_element(ALL(x))
#define INF 1001001001
#define MOD 10000007
#define PB push_back
#define MP make_pair
#define F first
#define S second
int main() {
    int d,t,s;cin>>d>>t>>s;
    if(s*t >= d) cout<<"Yes" <<endl;
    else cout<<"No"<<endl;
}

Measured memory_bytes: 3636
//by kcz 1552920354@qq.com
//if you find any bug in my code
//please tell me
#include<bits/stdc++.h>
using namespace std;

template <typename T> void chmin(T &x,const T &y)
{
	if(x>y)x=y;
}
template <typename T> void chmax(T &x,const T &y)
{
	if(x<y)x=y;
}
typedef unsigned int u32;
typedef long long s64;
typedef unsigned long long u64;
typedef pair<int,int> pii;
#define rep(i,l,r) for(int i=l;i<=r;++i)
#define per(i,r,l) for(int i=r;i>=l;--i)
#define pb push_back
#define mp make_pair
#define gc (c=getchar())
char readc()
{
	char c;
	while(gc<'-');
	return c;
}
int read()
{
    char c;
    while(gc<'-');
    if(c=='-')
    {
        int x=gc-'0';
        while(gc>='0')x=x*10+c-'0';
        return -x;
    }
    int x=c-'0';
    while(gc>='0')x=x*10+c-'0';
    return x;
}
#undef gc

const int N=2e5+5;
int n;s64 c;
s64 x[N],s[N];int v[N];
s64 ans=0;
void solve()
{
	priority_queue<s64>a,b;
	rep(i,n+1,n*2){x[i]=x[i-n]+c;v[i]=v[i-n];}
	rep(i,1,n*2)s[i]=s[i-1]+v[i];
	rep(i,n+1,n*2)a.push(-x[i]+s[i]);
	per(i,n,1)
	{
		a.push(-x[i]+s[i]);
		b.push(-x[n+i]+s[n+i]);
		while(!b.empty()&&a.top()==b.top()){a.pop();b.pop();}
		chmax(ans,a.top()+x[i]-s[i-1]-min(x[i],c-x[i]));
	}
}

int main()
{
	cin>>n>>c;
	rep(i,1,n)scanf("%lld%d",x+i,v+i);
	solve();
	rep(i,1,n)x[i]=c-x[i];
	reverse(x+1,x+n+1);
	reverse(v+1,v+n+1);
	solve();
	cout<<ans;
}



Measured memory_bytes: 8256
#include "bits/stdc++.h"
using namespace std;
using ll = long long;
using vi = vector<int>;
using vb = vector<bool>;
using vvi = vector<vector<int>>;
using vll = vector<long long>;
using vpi = vector<pair<int, int>>;
using pii = pair<int, int>;
using pll = pair<long long, long long>;

#define F first
#define S second
#define pb push_back
#define sz(x) (int)x.size()
#define all(x) x.begin(), x.end()

#define FOR(i, a, b) for (int i = (a); i <= (b); ++i)
#define F0R(i, a) for (int i = 0; i < (a); ++i)
#define RFOR(i, a, b) for (int i = (a); i >= (b); --i)

const char nl = '\n';
const ll MOD = 1e9 + 7;
const ll INF = 1e18;

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

    int N, W; cin >> N >> W;
    vi w(N), v(N);
    F0R (i, N) cin >> w[i] >> v[i];
    int V = 0;
    F0R (i, N) V += v[i];

    // least weight to get certain value (max val = 1e5)
    // dp[i][j] = least weight to get value j with first i items
    // dp[i][j] = dp[i - 1][j - val[i]] (if j - val[i] != INF)
    vector<vll> dp(N + 1, vll(V + 1, INF));
    F0R (i, N + 1) {
        dp[i][0] = 0;
    }
    F0R (i, N) {
        FOR (j, 1, V) {
            dp[i + 1][j] = dp[i][j];
            if (v[i] <= j) {
                ll val = w[i] + dp[i][j - v[i]];
                if (val <= W) {
                    dp[i + 1][j] = min(dp[i][j], val);
                }
            }
        }
    }
    RFOR (i, V, 0) {
        if (dp[N][i] != INF) {
            cout << i << endl;
            break;
        }
    }

    return 0;
}


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

int main(){
	int N, D;
	cin >> N >> D;
	int X[N][D];
	rep(i,N)rep(j,D) cin >> X[i][j];
	int ans = 0;

	for (int i = 0; i < N; i++) {
		for (int j = i+1; j < N; j++) {
			int d2 = 0;
			rep(k,D) d2 += (X[i][k]-X[j][k])*(X[i][k]-X[j][k]);
			int d = sqrt(d2);
			if (d2 == d*d) ans++;
		}
	}

	cout << ans << endl;

	return 0;
}


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

int main() {
	ll n,a[110],ans=0;
	cin>>n;
	for(int i=0;i<n;i++)cin>>a[i];
	for(int i=0;i<n;i++)for(int j=i+1;j<n;j++)ans+=a[i]*a[j];
	cout<<ans;
	return 0;
}


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

#define rep(i, k, n) for(int i = (k); i < (n); i++)
#define irep(i, k, n) for(int i = (k); i > (n); i--)
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
using namespace std;
using ll = long long;

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

  rep(i, 0, s.size()){
    if((i+1)%2){
      if(s[i] == 'L'){
        cout << "No" << endl;
        return 0;
      }
    }else{
      if(s[i] == 'R'){
        cout << "No" << endl;
        return 0;
      }
    }
  }
  cout << "Yes" << endl;
  return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(void)
{
	long long n,a,b,c,d,i;
	scanf("%lld",&n);
	scanf("%lld",&a);
	c=a;
	d=a;
	for(i=1;i<=n-1;i++)
	{
		scanf("%lld",&b);
		if(b>a)
		{
			a=b;
		}
		if(c>b)
		{
			c=b;
		}
		d=d+b;
	}
	printf("%lld %lld %lld\n",c,a,d);
	return 0;
}

Measured memory_bytes: 600
N, k = map(int, input().split())
a = list(map(int, input().split()))

a.sort()

result = 0
mod = 10**9+7

 
def cmb(n, r, mod=mod):
    if ( r<0 or r>n ):
        return 0
    r = min(r, n-r)
    return g1[n] * g2[r] * g2[n-r] % mod
mod = 10**9+7 #出力の制限
n = 10**5+1
g1 = [1, 1] # 元テーブル
g2 = [1, 1] #逆元テーブル
inverse = [0, 1] #逆元テーブル計算用テーブル
 
for i in range( 2, n+1 ):
    g1.append( ( g1[-1] * i ) % mod )
    inverse.append( ( -inverse[mod % i] * (mod//i) ) % mod )
    g2.append( (g2[-1] * inverse[-1]) % mod )


if k==1:
    print(0)
else:
    result = 0
    for i in range(N-k+1):
        result += (a[N-i-1]-a[i])*cmb(N-1-i, k-1)
        result %= mod

    print(result%mod)

Measured memory_bytes: 77092
#include "iostream"
#include "climits"
#include "list"
#include "queue"
#include "stack"
#include "set"
#include "functional"
#include "algorithm"
#include "string"
#include "map"
#include "unordered_map"
#include "unordered_set"
#include "iomanip"
#include "cmath"
#include "random"
#include "bitset"
#include "cstdio"
#include "numeric"
#include "cassert"
#include "ctime"
using namespace std;
int main()
{
  int s, w;
  cin>>s>>w;
  if(s>w)
  {
    cout<<"safe";
  }
  else
  {
    cout<<"unsafe";
  }
}

Measured memory_bytes: 3580
#include <stdio.h>

int main(void)
{
	int x, y, tmp;

	while (1) {
		scanf("%d %d", &x, &y);
		if (x == 0 && y == 0) break;

		if (x > y) {
			tmp = y;
			y = x;
			x = tmp;
		}

		printf("%d %d\n", x, y);
	}

	return 0;
}

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

using namespace std;
typedef long long ll;
#define MOD 1000000007
#define N 10000

ll fact[N], inv[N], finv[N];

ll C(int a, int b) {
    if(a < b || b < 0) return 0;
    return fact[a] * (finv[b] * finv[a - b] % MOD) % MOD;
}

signed main(signed argc, char *argv[]) {
    fact[0] = 1;
    fact[1] = 1;
    inv[1] = 1;
    finv[1] = finv[0] = 1;
    for(int i = 2; i < N; ++i) {
        fact[i] = fact[i - 1] * i % MOD;
        inv[i] = MOD - (MOD / i) * inv[MOD % i] % MOD;
        finv[i] = finv[i -1] * inv[i] % MOD;
    }

    ll n, k;
    cin >> n >> k;

    ll max_i = min(k, n - k + 1);

    ll a, b;
    for(int i=1; i<k+1; i++) {
        if(i <= max_i) {
            a = C(k-1, i-1);
            b = C(n-k+1, i);
            cout << a % MOD * b % MOD << endl;
        } else {
            cout << 0 << endl;
        }
    }

    return 0;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
#define lli long long int
#define rep(i, n) ;for (int i = 0;i < (int)(n);i++)
#define rep2(i, s, n) ;for (int i = s; i < (int)(n);i++)
#define ALL(vec)  (vec).begin(),(vec).end()
#define pi 3.1415926535897932384626433832795
#define MAX_INF 9223372036854775807
#define MIN_INF (922337203685477587+1)
#define sosuu 1000000007

int main() {
  int a,b,c;
  cin >>a>>b>>c;
  cout << c <<" "<< a<<" "<< b<<endl;
}


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

int main() {
    int N;
    long long K;
    cin >> N >> K;
    vector<long long> A(N);
    for (int i = 0; i < N; i++) cin >> A[i];
    long long MOD = 1e9 + 7;

    long long count1 = 0;
    long long count2 = 0;
    for (int i = 0; i < N; i++) {
        for (int j = i + 1; j < N; j++) {
            if (A[i] > A[j]) count1++;
        }
    }
    for (int i = 0; i < N; i++) {
        for (int j = 0; j < N; j++) {
            if (A[i] > A[j]) count2++;
        }
    }

    long long ans = 0;
    long long cal = K * (K - 1) / 2 % MOD;
    ans += count1 * K % MOD;
    ans %= MOD;
    ans += count2 * cal % MOD;
    ans %= MOD;
    cout << ans << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<unordered_map>
#include<math.h>

using namespace std;
typedef long long ll;

#define INF 10e+11 + 7
int ans = 0;
void calc(int A){
}
int main(){
	vector<int> A(5);
	cin>>A[0]>>A[1]>>A[2]>>A[3]>>A[4];
	vector<int> a(5);
	a[0] = A[0] % 10;
	a[1] = A[1] % 10;
	a[2] = A[2] % 10;
	a[3] = A[3] % 10;
	a[4] = A[4] % 10;
	int temp , TEMP;
	for(int i = 0; i < 4; i++){
		for(int j = 4; j > i; j--){
			if(a[j - 1] > a[j]){
				temp = a[j - 1];
				TEMP = A[j - 1];
				a[j - 1] = a[j];
				A[j - 1] = A[j];
				a[j] = temp;
				A[j] = TEMP;
			}
		}
	}
	//cout<<A[0]<<A[1]<<A[2]<<A[3]<<A[4];
	int time = 0;
	vector<int> s;
	for(int i = 4; i >= 0; i--){
		if(a[i - 1] == 0 && s.empty()){
			s.push_back(A[i]);
			continue;
		}
		time += A[i];
		if(i > 0 && time % 10 != 0){
		time += 10;
		time /= 10;
		time *= 10;
		
		}
	}
	if(!s.empty()){
		time += s[0];
	}
	cout<<time<<endl;
	return 0;
	
}










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

using namespace std;

int gcd( int a, int b ){
    int t;
    int x = min(a, b);
    int y = max(a, b);
    while( y%x != 0 ){
        t = y - x;
        y = max(x, t);
        x = min(x, t);
    }
    return x;
}

int lcm( int a, int b ){
    int x = a;
    int y = b;
    while( x != y ){
        if(x<y)
            x += a;
        else
            y += b;
    }
    return x;
}

int main()
{
    int a, b;
    while( cin >> a >> b ){
        cout << gcd(a, b) << " " << lcm(a, b) << endl;
    }
    return 0;
}

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


bool check(int a){
  int num=a%10;
  a/=10;
  while(a){
    if(a%10!=num-1) return 0;
    num=a%10;
    a/=10;
  }
  return 1;
}

int main(){
  int n;
  cin>>n;
  int a[1001];
  for(int i=0;i<n;i++) cin>>a[i];
  
  int ans=-1;
  for(int i=0;i<n;i++)
    for(int j=i+1;j<n;j++)
      if(check(a[i]*a[j])) ans=max(ans,a[i]*a[j]);

  cout <<ans<<endl;
  return 0;
}

Measured memory_bytes: 3112
/*
 * RD
*/
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#include <bits/stdc++.h>
using namespace std;
#ifndef rd
#define endl '\n'
#endif
#define deb cout<<"Line: "<<__LINE__<<" plz "
#define pb push_back
#define fi first
#define se second
#define int long long
typedef long long ll;
#define pii pair<int,int>
#define sz(x) ((int)x.size())
#define fr(a,b,c) for(int a=b; a<=c; a++)
#define all(con) con.begin(),con.end()
const ll inf=1e18;
const int mod=1000000007;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
ll powm(ll a, ll b, ll m);

int dsu[405*405];

string a[400];
inline int g(int i, int j)
{
	return i*400+j;
}
int fpar(int i)
{
	if(dsu[i]==i) return i;
	return dsu[i]=fpar(dsu[i]);
}
void solve()
{
	int h,w;
	cin>>h>>w;
	for(int i=0; i<h; i++)
		cin>>a[i];
	for(int i=0; i<h; i++)
		for(int j=0; j<w; j++)
			dsu[g(i,j)]=g(i,j);
	for(int i=1; i<h; i++)
		for(int j=0; j<w; j++)
			if(a[i][j]!=a[i-1][j])
			{
				int te=fpar(g(i,j));
				int te1=fpar(g(i-1,j));
				dsu[te1]=te;
			}
	for(int i=0; i<h; i++)
		for(int j=1; j<w; j++)
			if(a[i][j]!=a[i][j-1])
			{
				int te=fpar(g(i,j));
				int te1=fpar(g(i,j-1));
				dsu[te1]=te;
			}
	map<int,int> nums,nums2;
	for(int i=0; i<h; i++)
		for(int j=0; j<w; j++)
		{
			dsu[g(i,j)]=fpar(g(i,j));
			if(a[i][j]=='#')
				nums[dsu[g(i,j)]]++;
			else
				nums2[dsu[g(i,j)]]++;
		}
	ll ans=0;
	for(auto te:nums)
	{
		ans+=nums[te.fi]*nums2[te.fi];
	}
	cout<<ans<<endl;
}
signed main()
{
	ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
	srand(chrono::steady_clock::now().time_since_epoch().count());
	auto clk=clock();
	int t=1;
//	cin>>t;
	while(t--)
		solve();
#ifdef rd
	cout<<endl<<endl<<(double)(clock()-clk)/CLOCKS_PER_SEC<<endl;
#endif
	return 0;
}
ll powm(ll a,ll b, ll m) {
	ll te=1;
	while(b) {
		if(b&1) te=(te*a)%m;
		a=(a*a)%m;
		b>>=1;
	}
	return te;
}


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

int n, m, ans=0;
bool path[51][51] = {};
vector<int> a(51), b(51);

void dfs(int k, bool *visited) {
    visited[k] = true;
    for (int t=1; t<=n; t++)
        if (path[k][t] && !visited[t])
            dfs(t, visited);
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cin >> n >> m;
    for (int i=0; i<m; i++) {
        cin >> a[i] >> b[i];
        path[a[i]][b[i]] = path[b[i]][a[i]] = true;
    }
    for (int i=0; i<m; i++) {
        path[a[i]][b[i]] = path[b[i]][a[i]] = false;
        bool visited[n+1] = {};
        dfs(a[i], visited);
        for (int j=1; j<=n; j++)
            if (!visited[j]) {
                ans++;
                break;
            }
        path[a[i]][b[i]] = path[b[i]][a[i]] = true;
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
/**
*     => Md. Sajjat Hosen
*     => Department of Computer Science and Engineering
*     => Bangabandhu Sheikh Mujibur Rahman Science and Technology University
**/

/*..................! TRY ONCE MORE !..................*/

/*...Part - 01...*/

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

/*...Part - 02...*/

typedef long long               ll ;
typedef long double             ld ;
typedef unsigned long long      ull ;
typedef pair<int,int>           pii ;
typedef pair<ll,ll>             pll ;
typedef vector<int>             vi ;
typedef vector<ll>              vll ;
typedef vector<vector<int>>     vvi ;

int Int(){int x ; scanf("%d",&x) ; return x ;}
ll Long(){ll x ; scanf("%lld",&x) ; return x ;}
float Float(){float x ; scanf("%f",&x) ; return x ;}
double Double(){double x ; scanf("%lf",&x); return x;}

/*...Part - 03...*/
/*....Debugger....*/

#define error(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }
void err(istream_iterator<string> it) {cout << endl ;}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
    cerr << *it << " = " << a << ' ' ;
    err(++it, args...);
}

/*...Part - 04...*/
/*...Needed to change according to problem requirements...*/

const int N          = (int)2e5 + 5 ;
const int maxN       = (int)1e6 + 6 ;
const ll  Mod        = (ll)1e9 + 7 ;
const int inf        = (int)2e9 ;
const ll  Inf        = (ll)1e18 ;

/*..........................................................*/
/*...Part - 05...*/

#define     debug(x)    cerr << #x << " = " << x << '\n' ;
#define     rep(i,b,e)  for(__typeof(e) i = (b) ; i != (e + 1) - 2 * ((b) > (e))  ; i += 1 - 2 * ((b) > (e)))
#define     Int         Int()
#define     Long        Long()
#define     Float       Float()
#define     Double      Double()
#define     all(x)      x.begin() , x.end()
#define     sz(x)       (int)x.size()
#define     ff          first
#define     ss          second
#define     pb          push_back
#define     eb          emplace_back
#define     mem(a)      memset(a , 0 ,sizeof a)
#define     memn(a)     memset(a , -1 ,sizeof a)

/*...Part - 06...*/
/*...... ! Code start from here ! ......*/



int main(){
    //freopen("input.txt","r",stdin);
    int test = 1 , tc = 0 ;
    ll h, a, n, sum = 0, i;
    while(test--){
        h = Long;
        a = Long;
        ll x[a];
        for(i = 0; i < a; i++){
            x[i] = Long;
            sum += x[i];
        }
        if(sum >= h)
            printf("Yes\n");
        else
            printf("No\n");

    }
    return 0 ;
}

/*...Always look at the part - 04...*/
/*...............END................*/


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

int main(){
    string S;
    for (int i=0; i<4; i++) cin >> S[i];
    
    if (S[0]==S[1] || S[1]==S[2] || S[2]==S[3] ) cout << "Bad";
    else  cout << "Good";
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
  int D,A=26;
  scanf("%d",&D);
  vector<int> C(A);
  for(int i=0;i<A;i++){
    scanf("%d",&C[i]);
  }
  vector<vector<int>> S(D,vector<int>(A));
  for(int i=0;i<D;i++){
    for(int j=0;j<A;j++){
      scanf("%d",&S[i][j]);
    }
  }
  vector<int> X(A,0);
  vector<int> XX(A,0);
  vector<vector<pair<int,int>>> Q(D,vector<pair<int,int>>(A));
  for(int i=0;i<D;i++){
    for(int j=0;j<A;j++){
      X[j]+=C[j];
      XX[j]+=X[j];
      Q[i][j]=make_pair(-S[i][j]-X[j],j);
    }
    sort(Q[i].begin(),Q[i].end());
    XX[Q[i][0].second]-=X[Q[i][0].second];
    X[Q[i][0].second]=0;
  }
  vector<vector<int>> P(D,vector<int>(A));
  for(int i=0;i<D;i++){
    for(int j=0;j<A;j++){
      P[i][j]=Q[i][j].second;
    }
  }
  int SC=0,SC2;
  for(int i=0;i<D;i++){
    SC+=S[i][P[i][0]];
  }
  vector<int> Y;
  vector<int> YY;
  int Z;
  int SX,SY;
  int z=-1;
  for(int l=0;l<75;l++){
    for(int k=0;k<25;k++){
      while(k==z){
        k=rand()%25;
      }
      z=k;
      for(int i=0;i<D;i++){
        SC2=SC;
        YY=XX;
        Y=X;
        SC2-=S[i][P[i][0]];
        SC2+=S[i][P[i][k+1]];
        for(int j=0;j<A;j++){
          Y[j]=0;
        }
        YY[P[i][0]]=0;
        YY[P[i][k+1]]=0;
        for(int j=0;j<D;j++){
          if(i==j){
            Z=P[j][k+1];
          }else{
            Z=P[j][0];
          }
          Y[P[i][0]]+=C[P[i][0]];
          Y[P[i][k+1]]+=C[P[i][k+1]];
          Y[Z]=0;
          YY[P[i][0]]+=Y[P[i][0]];
          YY[P[i][k+1]]+=Y[P[i][k+1]];
        }
        SX=0;
        SY=0;
        for(int j=0;j<A;j++){
          SX+=XX[j];
          SY+=YY[j];
        }if((SC2-SY+(rand()%3600))>(SC-SX)){
          P[i].insert(P[i].begin(),P[i][k+1]);
          P[i].erase(P[i].begin()+k+2,P[i].begin()+k+3);
          XX=YY;
          SC=SC2;
        }
      }
    }
  }
  for(int l=0;l<50;l++){
    for(int k=0;k<25;k++){
      while(k==z){
        k=rand()%25;
      }
      z=k;
      for(int i=0;i<D;i++){
        SC2=SC;
        YY=XX;
        Y=X;
        SC2-=S[i][P[i][0]];
        SC2+=S[i][P[i][k+1]];
        for(int j=0;j<A;j++){
          Y[j]=0;
        }
        YY[P[i][0]]=0;
        YY[P[i][k+1]]=0;
        for(int j=0;j<D;j++){
          if(i==j){
            Z=P[j][k+1];
          }else{
            Z=P[j][0];
          }
          Y[P[i][0]]+=C[P[i][0]];
          Y[P[i][k+1]]+=C[P[i][k+1]];
          Y[Z]=0;
          YY[P[i][0]]+=Y[P[i][0]];
          YY[P[i][k+1]]+=Y[P[i][k+1]];
        }
        SX=0;
        SY=0;
        for(int j=0;j<A;j++){
          SX+=XX[j];
          SY+=YY[j];
        }if((SC2-SY)>(SC-SX)){
          P[i].insert(P[i].begin(),P[i][k+1]);
          P[i].erase(P[i].begin()+k+2,P[i].begin()+k+3);
          XX=YY;
          SC=SC2;
        }
      }
    }
  }
  /*
  int uku=0;
  for(int i=0;i<A;i++){
    X[i]=0;
  }
  for(int i=0;i<D;i++){
    uku+=S[i][P[i][0]];
    for(int j=0;j<A;j++){
      X[j]+=C[j];
    }
    X[P[i][0]]=0;
    SX=0;
    for(int i=0;i<A;i++){
      SX+=X[i];
    }
    uku-=SX;
  }
  cout<<uku<<endl;
  */
  for(int i=0;i<D;i++){
    cout<<P[i][0]+1<<"\n";
  }
}

Measured memory_bytes: 3924
#include <bits/stdc++.h>
#define ll unsigned long long
using namespace std;
ll n,a,b;

int main()
{
  ios::sync_with_stdio(false);
  cin.tie(0); 
  cin>>n>>a>>b;
  ll num=n/(a+b);
  ll rem=n%(a+b);
  ll ans=num*(a);
  if(rem>=a)
  {
      ans+=a;
  }
  else ans+=rem;

  cout<<ans<<endl;


}

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

int n,f[200009],cnt[200009];

int main()
{
	cin >> n;
	for(int i = 2,fa;i<=n;i++)cin >> fa,cnt[fa]++;
	for(int i = 1;i<=n;i++)cout << cnt[i] << endl;
	return 0;
}

Measured memory_bytes: 4376