akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
#define rep(i, from, to) for (int i = from; i < (to); ++i)
#define mp(x,y) make_pair(x,y)
#define all(x) (x).begin(),(x).end()
#define sz(x) (int)(x).size()
using ll = long long;
using vin=vector<int>;
using vll=vector<ll>;
using P = pair<int, int>;
const int inf=1e9+7;
const ll INF=1e18;
template <typename T> void chmin(T &a, T b) { a = min(a, b); }
template <typename T> void chmax(T &a, T b) { a = max(a, b); }

int main() {
  int a,b,c,d;
  cin>>a>>b>>c>>d;
  bool ok=false;
  if(abs(a-c)<=d)ok=true;
  if(abs(a-b)<=d &&abs(b-c)<=d) ok=true;
  if(ok)cout<<"Yes"<<endl;
  else{
    cout<<"No"<<endl; 
  }
}

Measured memory_bytes: 3576
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <cmath>
#include <queue>
#include <map>
#include <unordered_map>
#include <set>
#include <functional>
using namespace std;

typedef long long ll;

bool used[55558];

int main() {
	vector<int> primes;
	for (int i = 2; i <= 55555; i++) {
		if (used[i]) continue;
		int w = i;
		while (w <= 55555) {
			used[w] = true;
			w += i;
		}
		if (i % 5 == 1) primes.push_back(i);
	}

	int n; cin >> n;
	for (int i = 0; i < n; i++) cout << primes[i] <<(i == n - 1 ? "\n" : " ");
	return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
int main(){
	int a[2]={0},i,j,n;
	for(i=0;i<2;i++)for(j=0;j<4;j++){
		scanf("%d",&n);
		a[i]+=n;
	}
	if(a[1]>a[0])a[0]=a[1];
	printf("%d\n",a[0]);
	return 0;
}


Measured memory_bytes: 2064
#include <bits/stdc++.h>
#define debug(x) cerr << #x << ": " << x << '\n';
using namespace std;
using ll = long long;
using P = pair<int, int>;
const int INF = (int)1e9;

int main(void){
	string s; cin >> s;
	int w; cin >> w;
	for(int i = 0; i < (int) s.length(); i++){
		if(i%w == 0) cout << s[i];
	}

	cout << '\n';

	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  for(int i=0;i<(n);++i)
#define REPr(i,n) for(int i=(n)-1;i>=0; --i)
#define FORq(i, m, n) for(int i = (m);i <= (n);++i)
#define FORqr(i, m , n) for(int i = (n);i >=(m);--i)
#define SCD(n) scanf("%d",&n)
#define SCD2(m,n) scanf("%d%d",&m,&n)
#define SCD3(m,n,k) scanf("%d%d%d",&m,&n,&k)
#define SCLLD(n) scanf("%lld",&n)
#define SCLLD2(m,n) scanf("%lld%lld",&m,&n)
#define SCLLD3(m,n,k) scanf("%lld%lld%lld",&m,&n,&k)
#define PB push_back
#define MP make_pair
#define ARSCD(A,N) REP(i,N){SCD(A[i]);}
#define ARSCD1(A,N) FORq(i,1,N){SCD(A[i]);}
#define VSCD(v,N) REP(i,N){int (x); SCD(x); v.PB(x);}
#define VSCLLD(v,N) REP(i,N){long long (x); SCLLD(x); v.PB(x);}
#define PRINTD(n) printf("%d\n",n)
#define PRINTLLD(n) printf("%lld\n",n)
#define DEBUG printf("%s\n","debug")
#define fst first
#define snd second
#define SIN(x,S) (S.count(x) != 0)
#define M0(x) memset(x,0,sizeof(x))
#define FILL(x,y) memset(x,y,sizeof(x))
#define MM(x) memset(x,-1,sizeof(x))
#define ALL(x) (x).begin(),(x).end()
using namespace std;
typedef pair<int,int> PII;
typedef pair<long long,long long> PLL;
typedef vector<int> VI;
typedef vector < VI > VVI;
typedef vector<long long> VL;
typedef long long ll;
typedef long long integer;
///////////////////////////////////////////////
const ll MOD = 1000000007;
ll gcd(ll x,ll y){return y?gcd(y,x%y):x;}
 
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;
}
///////////////////////////////////////////////
int main(){
    int N; cin >> N;
    static ll M[200002] = {};

    vector<ll> C(N+2);
    vector<ll> C2;
    C[0] = -1;

    FORq(i,1,N){
        cin >> C[i];
    }

    ll prev = -1;
    C2.PB(-1);

    FORq(i,1,N){
        if (prev == C[i]) continue;
        C2.PB(C[i]);
        prev = C[i];
    }

    int N2 = C2.size();

    static ll dp[200002] = {};
    static ll mem[200002] = {};

    dp[0] = 1;
    FORq(i,1,N2-1){
        ll num = C2[i];
        if (mem[num] == 0){
            mem[num] = dp[i-1];
            dp[i] = dp[i-1];
            continue;
        }

        dp[i] = (dp[i-1] + mem[num]) % MOD;
        mem[num] = dp[i];

    }

    cout << dp[N2-1] << endl;

}






Measured memory_bytes: 6640
import java.util.*;
import java.lang.*;
import java.math.*;

public class Main {
	Scanner sc = new Scanner(System.in);

	void run() {
		for (; sc.hasNextLine();) {
			String buffer = sc.nextLine();
			String token[] = buffer.replace('=', ' ').replace('+', ' ')
					.split(" ");
			char ret = 0;
			boolean multi = false;
			boolean zeroable = true;
			if (token[0].startsWith("X")) {
				if (token[0].length() > 1) {
					zeroable = false;
				}
			}
			if (token[1].startsWith("X")) {
				if (token[1].length() > 1) {
					zeroable = false;
				}
			}if (token[2].startsWith("X")) {
				if (token[2].length() > 1) {
					zeroable = false;
				}
			}
			for (char i = '9' + 1; i-- > '0';) {
				if (i == '0' && !zeroable) {
					break;
				}
				BigInteger a = new BigInteger(token[0].replace('X', i));
				BigInteger b = new BigInteger(token[1].replace('X', i));
				BigInteger c = new BigInteger(token[2].replace('X', i));
				if (a.add(b).equals(c)) {
					if (ret == 0) {
						ret = i;
					} else {
						multi = true;
					}
				}
			}
			System.out.println(ret == 0 || multi ? "NA" : ret);
		}
	}

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

Measured memory_bytes: 12000
#include <iostream>
#include <cmath>
#include <vector>
#include <algorithm>
typedef long long  ll;
typedef std::pair<ll, ll> llpair;
using namespace std;

inline string FormattNumber(ll num)
{
    string num_str = to_string(num);
    auto remain_zeros = 6 - num_str.size();
    for(int i = 0; i < remain_zeros; i++)
        num_str = "0" + num_str;
    return num_str;
}

int main()
{
    ll N, M, pi, yi, idx = 0;
    cin >> N >> M;
    vector<llpair> p, y;
    while(cin >> pi >> yi){
        p.push_back(llpair(idx, pi));
        y.push_back(llpair(idx, yi));
        idx++;
    }

    vector<ll> number(M);
    auto classes = vector<vector<llpair>>(N + 1);
    for(ll i = 0; i < M; i++)
        classes[p[i].second].push_back(y[i]);
    
    for(ll i = 1; i <= N; i++)
    {
        sort(classes[i].begin(), classes[i].end(), [](const llpair t1, const llpair t2){return t1.second < t2.second;});
        for(ll j = 0; j < classes[i].size(); j++)
            number[classes[i][j].first] = j + 1;
    }
    
    for(ll i = 0; i < M; i++)
        cout << FormattNumber(p[i].second) + FormattNumber(number[i]) << endl;
    
    return 0;
}


Measured memory_bytes: 11108
using System;
using System.Linq;
public class Hello{
    public static void Main(){
        bool isCon = true;
        while(isCon){
            string tmp = System.Console.ReadLine();
            string[] ab = tmp.Split(' ');
            int a = Convert.ToInt32(ab[0]);
            int b = Convert.ToInt32(ab[1]);
            
            if(a == 0 && b == 0){
                isCon = false;
            }else{
                for(int i = 0; i<a;i++){
                    for(int j = 0; j < b; j++){
                        if(0<i && i<a-1 && 0<j && j<b-1){
                            Console.Write(".");
                        }else{
                            Console.Write("#");
                        }
                    }
                    Console.WriteLine();
                }
                Console.WriteLine();
                
            }
        }
    }
}

Measured memory_bytes: 8868
import math

N = int(input())
pos = [list(map(int, input().split())) for _ in range(N)]

dist = [[0] * N for _ in range(N)]


def pow(n):
    if n == 1:
        return 1
    else:
        return n * pow(n - 1)

def d(x1, y1, x2, y2):
    return math.sqrt((x1 - x2) ** 2 + (y1 - y2) ** 2)


sum_ = 0
p = pow(N - 1)
for i in range(N):
    for j in range(i, N):
        c = d(pos[i][0], pos[i][1], pos[j][0], pos[j][1])
        sum_ += c * p * 2

print(sum_ / pow(N))


Measured memory_bytes: 3064
#include <iostream>
#include <stdio.h>
#include <algorithm>
#include <math.h>
#include <vector>
#include <string>
#include <sstream>

#define rep(i, j) for(int i = 0; i < j; i++)
#define all(i) i.begin(), i.end()
#define ll long long
#define bl bool
#define nn printf("\n");
#define mod 1000000007

using namespace std;

string Num2Str(int num)
{
	stringstream ss;
	ss << num;
	return ss.str();
}
int main()
{
	cin.tie(0);
	ios::sync_with_stdio(false);

	int a = 0, b = 0;
	while (cin >> a >> b)
	{
		int sum = a + b;
		string str;
		str = Num2Str(sum);
		printf("%d\n", str.size());
	}
	return 0;
}

Measured memory_bytes: 1260
n = int(input())
s = []
for _ in range(n):
  s.append(input())
print("AC x " + str(s.count("AC")))
print("WA x " + str(s.count("WA")))
print("TLE x " + str(s.count("TLE")))
print("RE x " + str(s.count("RE")))

Measured memory_bytes: 79312
import java.util.Scanner;

class Main {

	public static void main(String[] args) {

		Scanner scan = new Scanner(System.in);
		int n = scan.nextInt();
		int m = scan.nextInt();
		int l = scan.nextInt();
		int[][] A = new int[n][m];
		int[][] B = new int[m][l];
		long[][] C = new long[n][l];

		for(int i=0; i<n; i++){
			for(int j=0; j<m; j++){
				A[i][j] = scan.nextInt();
			}
		}
		for(int i=0; i<m; i++){
			for(int j=0; j<l; j++){
				B[i][j] = scan.nextInt();
			}
		}
		for(int i=0; i<n; i++){
			for(int j=0; j<l; j++){
				for(int k=0; k<m; k++){
					C[i][j] += A[i][k] * B[k][j];
				}
				if(j == l-1)
					System.out.print(C[i][j]);
				else
					System.out.print(C[i][j] + " ");
			}
			System.out.print("\n");
		}
	}

}

Measured memory_bytes: 44648
#include <vector>
#include <stack>
#include <queue>
#include <list>
#include <bitset>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <algorithm>
#include <numeric>
#include <iostream>
#include <iomanip>
#include <string>
#include <chrono>
#include <random>
#include <cmath>
#include <cassert>
#include <climits>
#include <cstring>
#include <cstdlib>
#include <functional>
#include <sstream>

using namespace std;


int main(int argc, char** argv) {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << fixed << setprecision(12);

    int n;
    cin >> n;
    vector<int> A(n);
    for (int i = 0; i < n; ++i) {
        cin >> A[i];
    }
    sort(A.begin(), A.end());

    int res = 0;
    for (int i = 0; i < n; ++i) {
        int cnt = 1;
        while (i + 1 < n && A[i] == A[i + 1]) {
            ++cnt;
            ++i;
        }
        res += cnt & 1;
    }

    cout << res << '\n';


    return 0;
}

Measured memory_bytes: 3728
N,L=gets.split.map(&:to_i)

ap=Array.new(N)
N.times do |i|
  ap[i] = L+i
end
sum = ap.inject(:+)
ans = 0
t = Float::INFINITY
ap.each do |a|
  if t > a.abs
    t = a.abs
    ans = sum - a
  end
end
p ans

Measured memory_bytes: 1788
#define _USE_MATH_DEFINES
#include <cstdio>
#include <cstring>
#include <iostream>
#include <string>
#include <sstream>
#include <vector>
#include <queue>
#include <list>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <algorithm>
#include <complex>
#include <cmath>
#include <numeric>
#include <bitset>

using namespace std;

typedef long long int64;
typedef pair<int, int> ii;
const int INF = 1 << 30;

int main() {
  int x, y;
  scanf("%d%d", &x, &y);
  if (x == 1) x = 100;
  if (y == 1) y = 100;
  if (x > y) {
    puts("Alice");
  } else if (x < y) {
    puts("Bob");
  } else {
    puts("Draw");
  }
  return 0;
}


Measured memory_bytes: 768
import math
s=input()
n=len(s)
count_r=1
count_l=0
place=0
ans=[0]*(n)
for i in range(1,n):
    if s[i]=='R':
        count_r+=1
        if s[i-1]=='L':#...LR...
            ans[place]+=math.ceil(count_l/2)
            ans[place-1]+=math.floor(count_l/2)
            count_l=0
    if s[i]=='L':
        count_l+=1
        if s[i-1]=='R':#...RL...
            ans[i]+=math.floor(count_r/2)
            ans[i-1]+=math.ceil(count_r/2)
            count_r=0
            place=i
        if i==n-1:
            ans[place]+=math.ceil(count_l/2)
            ans[place-1]+=math.floor(count_l/2)
            count_l=0
print(*ans, sep=' ')

Measured memory_bytes: 6400
A,B=map(int,input().split())
import fractions 
import collections
GCD=fractions.gcd(A,B)
a=[]

while GCD % 2 ==0:
  a.append(2)
  GCD //= 2
f = 3
while f * f <= GCD:
  if GCD % f == 0:
    a.append(f)
    GCD //= f
  else:
    f += 2
if GCD != 1:
  a.append(GCD)
#print(a)
c = collections.Counter(a)
#print(c)
#print(sum(c.values())+1)
print(len(c)+1)

Measured memory_bytes: 5048
from collections import deque


n = int(input())
edges = [[] for i in range(n)]

for _ in range(n-1):
    a, b = map(int, input().split())
    edges[a-1].append(b-1)
    edges[b-1].append(a-1)

todo = deque([(0, 1), (n-1, 2)])

colors = [0] * n
colors[0] = 1
colors[-1] = 2

while todo:
    node, color = todo.popleft()
    for to in edges[node]:
        if colors[to]:
            continue
        else:
            colors[to] = color
            todo.append((to, color))

fennec_count = colors.count(1)
if fennec_count > n // 2:
    print('Fennec ')

else:
    print('Snuke ')


Measured memory_bytes: 23448
#include <algorithm>
#include <queue>
#include <iostream>
#include <string>
#include <set>
#include <map>
#include <ios>     // std::left, std::right
#include <iomanip> 
#define REP(i,n) for(ll i = 0; i < (ll)n; i++)
#define INF 1000000000000000
using namespace std;
typedef long long ll;
typedef double db;
typedef string str;
typedef pair<ll,ll> p;

int main(){
    ll N,M;cin>>N>>M;
    for(int i = M/N;i>=1;i--){
        //cout<<"i:"<<i<<endl;
        if(M%i==0){
            //iがMの約数の時
            ll divided = M/i;
            if(divided>=N){
                cout<<i<<endl;
                return 0;
            }
        }
    }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#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 equals(a, b) (fabs((a) - (b)) < EPS)
using namespace std;
typedef long long ll;
const ll mod = 1000000007;
const ll mod2 = 998244353;
const int INF = 1e9;
const long double EPS = 1e-10;

int main() {
  int n, c;
  cin >> n >> c;
  int d[c][c];
  rep(i, c) {
    rep(j, c) {
      cin >> d[i][j];
    }
  }
  int g[n][n];
  rep(i, n) {
    rep(j, n) {
      cin >> g[i][j];
    }
  }

  int sum[3][c];
  memset(sum, 0, sizeof(sum));
  rep(i, n) {
    rep(j, n) {
      sum[(i + j) % 3][g[i][j] - 1]++;
    }
  }

  int ans = INF;
  rep(i, c) {
    rep(j, c) {
      if (i == j) continue;
      rep(k, c) {
        if (i == k || j == k) continue;
        int res = 0;
        rep(l, c) res += sum[0][l] * d[l][i];
        rep(l, c) res += sum[1][l] * d[l][j];
        rep(l, c) res += sum[2][l] * d[l][k];
        ans = min(ans, res);
      }
    }
  }
  cout << ans << endl;




  
  return 0;
}

Measured memory_bytes: 1280
#include <iostream>
#include <vector>
#include <queue>

using namespace std;

int main() {
    while (true) {
        int r;
        cin >> r;
        if (r == 0)break;
        vector<vector<int>> v(2, vector<int>(r + 1));
        for (int _ = 0; _ < 2; _++) {
            int w, h, x, y;
            cin >> w >> h >> x >> y;
            vector<vector<int>> ban(h, vector<int>(w));
            for (int i = 0; i < h; i++) {
                for (int j = 0; j < w; j++)cin >> ban[i][j];
            }
            priority_queue<vector<int>, vector<vector<int>>, greater<vector<int>>> q;
            q.push({1, y, x});
            vector<vector<bool>> visited(h + 2, vector<bool>(w + 2));
            visited[y][x] = true;
            v[_][1] = 1;
            for (int i = 0; i <= h + 1; i++) {
                visited[i][0] = true;
                visited[i][w + 1] = true;
            }
            for (int i = 0; i <= w + 1; i++) {
                visited[0][i] = true;
                visited[h + 1][i] = true;
            }

            vector<vector<int>> move = {{1,  0},
                                        {-1, 0},
                                        {0,  1},
                                        {0,  -1}};
            for (int i = 2; i <= r; i++) {
                vector<int> a = q.top();
                q.pop();
                for (int j = 0; j < 4; j++) {
                    int c = a[1] + move[j][0];
                    int d = a[2] + move[j][1];
                    if (!visited[c][d]) {
                        visited[c][d] = true;
                        vector<int> aaa(3);
                        aaa[0] = ban[c - 1][d - 1];
                        aaa[1] = c;
                        aaa[2] = d;
                        q.push(aaa);
                    }
                }
                if (q.empty())break;
                v[_][i] = max(v[_][i - 1], q.top()[0]);
            }
        }
        int ret = 1145141919;
        for (int i = 0; i <= r; i++) {
            if ((i == 0 || v[0][i] != 0) && (r - i == 0 || v[1][r - i] != 0))
                ret = min(ret, v[0][i] + v[1][r - i]);
        }
        cout << ret << endl;
    }
    return 0;
}


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

using namespace std;

struct Block {
    int a, b, x;
    friend istream& operator>>(istream& in, Block& block) {
        int s, t;
        in >> s >> t >> block.x;
        block.a = 2*s-1-2*block.x;
        block.b = 2*t-1-2*block.x;
        return in;
    }
};

bool first_start(const Block& b1, const Block& b2) {
    return b1.a < b2.a;
}

bool first_end(const Block& b1, const Block& b2) {
    if (b1.b == b2.b) {
        return make_pair(b1.a, b1.x) < make_pair(b2.a, b2.x);
    }
    return b1.b < b2.b;
}

bool first_x(const Block& b1, const Block& b2) {
    if (b1.x == b2.x) {
        return make_pair(b1.a, b1.b) < make_pair(b2.a, b2.b);
    }
    return b1.x < b2.x;
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n, q;
    cin >> n >> q;
    vector<Block> blocks(n);
    for (auto& block : blocks) {
        cin >> block;
    }
    sort(blocks.begin(), blocks.end(), first_start);
    set<Block, function<bool (const Block&, const Block&)>> blocks_end(first_end);
    set<Block, function<bool (const Block&, const Block&)>> blocks_x(first_x);
    auto add = [&](Block& b) {
        blocks_end.insert(b);
        blocks_x.insert(b);
    };
    auto remove = [&](Block& b) {
        assert(blocks_end.find(b) != blocks_end.end());
        assert(blocks_x.find(b) != blocks_x.end());
        blocks_end.erase(blocks_end.find(b));
        blocks_x.erase(blocks_x.find(b));
    };
    int i = 0;
    while (q --> 0) {
        int d;
        cin >> d;
        d *= 2;
        while (i < n && blocks[i].a < d) {
            add(blocks[i]);
            ++i;
        }
        while (blocks_end.size() > 0 && blocks_end.begin()->b < d) {
            Block b = *blocks_end.begin();
            remove(b);
        }
        if (blocks_x.size() == 0) {
            cout << -1 << "\n";
        } else {
            cout << blocks_x.begin()->x << "\n";
        }
    }
    return 0;
}


Measured memory_bytes: 28672
#include <iostream>
using namespace std;
int main(void){
    // Your code here!
    string s;
    cin>>s;
    if(s == "SUN"){
        cout<< "7" <<endl;
    }
    else if(s == "MON"){
        cout<< "6" <<endl;
    }
    else if(s == "TUE"){
        cout<< "5" <<endl;
    }
    else if(s == "WED"){
        cout<< "4" <<endl;
    }
    else if(s == "THU"){
        cout<< "3" <<endl;
    }
    else if(s == "FRI"){
        cout<< "2" <<endl;
    }
    else{
        cout<< "1" <<endl;
    }
}


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

int main() {
  int n; cin >> n;
  int maxp = 0, sum = 0;
  for (int i = 0; i < n; i++) {
    int p; cin >> p;
    maxp = max(maxp, p);
    sum += p;
  }
  cout << sum - maxp / 2 << endl;
}

Measured memory_bytes: 256
//http://judge.u-aizu.ac.jp/onlinejudge/review.jsp?rid=2676345#1
//http://judge.u-aizu.ac.jp/onlinejudge/review.jsp?rid=2676345#1
#include <iostream>
#include<cstdlib>
#include<queue>
#include<set>
#include<vector>
#include<string>
#include<algorithm>
#include<stack>
#include<map>
#include<cstdio>
#include<fstream>
#include<cstring>
using namespace std;
#define rep(i,a) for(int i=0;i<a;i++)
#define mp make_pair
#define P pair<int,int>
#define ll __int64

int m,n;
int table[100][100];
bool used[100][100];
int  u[100][100];
int ans=0;
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};

int dfs(int y,int x){
	if(y<0||x<0||y>=n||x>=m||table[y][x]==0)return 0;
	if(u[y][x]==1)return 0;

	int ma=0;
	int ny,nx;

	table[y][x]=0;
	rep(i,4){
			ny=y+dy[i];
			nx=x+dx[i];
				ma=max(dfs(ny,nx)+1,ma);
	}
	table[y][x]=1;
	return ma;
}


int main(){
while(cin>>m>>n,n||m){
rep(i,100)memset(used[i],0,sizeof used[i]);
rep(i,100)memset(u[i],0,sizeof u[i]);
rep(i,100)memset(table[i],0,sizeof table[i]);

rep(i,n){
	rep(j,m)cin>>table[i][j];
}
int ans=0;

for(int i=0;i<n;i++){
	for(int j=0;j<m;j++){
			if(table[i][j]==0)continue;
			int now=dfs(i,j);
			ans=max(ans,now);
			//cout<<i<<" "<<j<<" "<<now<<endl;

	}
}
cout<<ans<<endl;
}

	return 0;
}




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

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

    ll ans = 0;
    for (int i=1; i<N; ++i) {
        ans++;
    }

    cout << ans/2 << endl;
}


Measured memory_bytes: 256
N = int(input())
l = []
for i in range(N):
  s, p = input().split()
  l.append([s, -int(p), i+1])

# 地名に関して辞書順に / (-点数)に関して昇順に（点数に関して降順に）並べる
l = sorted(l, key=lambda x:(x[0], x[1]))
for i in range(N):
  print(l[i][2])

Measured memory_bytes: 9184
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <string>
#include <cstring>
#include <utility>
#include <set>
#include <stack>
#include <climits>
#include <cmath>
#include <iomanip>
#include <unordered_map>
#include <map>
#include <boost/multiprecision/cpp_int.hpp>

#define rep(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define rep1(i,n) for(int i=1, i##_len=(n); i<=i##_len; ++i)
#define reps(i,s,n) for(int i=s, i##_len=(n); i<i##_len; ++i)
#define all(x) (x).begin(),(x).end()
#define MEMSET(v, h) memset((v), h, sizeof(v))
typedef long long ll;
typedef long double ld;
const char sp = ' ';
#define MOD 998244353


using namespace boost::multiprecision;
using namespace std;
ll dp[4000][4000];
int main(void){
    ll A, B, C, D;
    cin>>A>>B>>C>>D;
    
    MEMSET(dp, 0);
    dp[0][0]=1;
    rep(i, C-A+1) rep(j, D-B+1){
        if(i!=0 && j!=0) dp[i][j]+=MOD-(dp[i-1][j-1]*((A+i-1)*(B+j-1))%MOD)%MOD;
        dp[i][j]%=MOD;
        dp[i+1][j]+=(dp[i][j]*(B+j))%MOD;
        dp[i+1][j]%=MOD;
        dp[i][j+1]+=(dp[i][j]*(A+i))%MOD;
        dp[i][j+1]%=MOD;
    }
    cout<<dp[C-A][D-B]<<endl;
    return 0;
}


Measured memory_bytes: 128624
import java.io.BufferedReader;
import java.io.InputStreamReader;

public class Main {

	public static void main(String[] args) throws Exception {
		// TODO 自動生成されたメソッド・スタブ
		BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
		String W = in.readLine();
		int N = Integer.parseInt(W);

		W=in.readLine();
		String[] sW = W.split(" ");
		int[] t = new int[N];
		long sum = 0;
		for(int i=0;i<N;i++){
			t[i]=Integer.parseInt(sW[i]);
			sum+=t[i];
		}

		W=in.readLine();
		int M = Integer.parseInt(W);

		int[][] p = new int[M][2];
		for(int i=0;i<M;i++){
			W=in.readLine();
			sW = W.split(" ");
			p[i][0]=Integer.parseInt(sW[0]);
			p[i][1]=Integer.parseInt(sW[1]);
		}
		for(int i=0;i<M;i++){
			System.out.println(sum - t[p[i][0]-1]+p[i][1]);
		}
	}




}


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

int main(){
	long long n;
	long long cnt = 0;

	scanf("%lld", &n);

	long long sq = (long long)sqrt(n-1);
	long long k, tmp = n - 1;
	for(k=2; k<=sq; k++){
		if(tmp % k == 0){
			cnt += (k == sq) ? 1 : 2;
		}
	}
	if(n-1 != 1){
		cnt++; // n-1 % n-1 == 0
	}

	sq = (long long)sqrt(n);
	for(k=2; k<=sq; k++){
		if(n % k != 0){
			continue;
		}

		tmp = n;
		while(tmp % k == 0){
			tmp/= k;
		}
		if(tmp % k == 1){
			cnt++;
		}

		long long l = n / k;
		tmp = n;
		while(tmp % l == 0){
			tmp /= l;
		}
		if(tmp % l == 1){
			cnt++;
		}
	}
	cnt++; // (n / n) % n == 1

	printf("%lld", cnt);

	return 0;
}


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

const int MAXN = 1e5 + 5;

int N, M;
vector <int> inv[MAXN];
int dp[MAXN], dad[MAXN];
	
int dfs(int x) {
	if (dp[x] != -1)
		return dp[x];
	for (auto it : inv[x]) {
		int tmp = dfs(it);
		if (tmp > dp[x]) {
			dp[x] = tmp;
			dad[x] = it;
		}
	}
	return ++dp[x];
}

int main() {
	scanf("%d%d", &N, &M);
	for (int i = 1; i < N + M; i++) {
		int a, b;
		scanf("%d%d", &a, &b);
		inv[b].push_back(a);
	}
	
	memset(dp, -1, sizeof dp);
	for (int i = 1; i <= N; i++) {
		dfs(i);
		printf("%d\n", dad[i]);
	}
	
	return 0;
}

Measured memory_bytes: 9984
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<n ; ++i)
#define REP(i,a,b) for(int i=a; i<b; ++i)
typedef long long ll;
//プロトタイプ宣言
int gcd(int , int);
int GCD(int , int);


int main(){
    int a,b;
    cin >> a >> b;
    if(a<=9&&1<=a&&b<=9&&1<=b)cout << a*b << endl;
    else cout << -1 << endl;
}








































//以下、ライブラリ
//ユークリッドの互除法
int gcd(int a, int b){
    while(1){
        int remain = a % b;
        if(remain == 0) return b;
        else{
            a = b;
            b = remain;
        }
    }
}

int GCD(int a, int b) {
  return b ? GCD(b, a%b) : a;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
// iostream is too mainstream
#include <cstdio>
// bitch please
#include <iostream>
#include <algorithm>
#include <cstdlib>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <list>
#include <cmath>
#include <iomanip>
#include <time.h>
#define dibs reserve
#define OVER9000 1234567890
#define ALL_THE(CAKE,LIE) for(auto LIE =CAKE.begin(); LIE != CAKE.end(); LIE++)
#define tisic 47
#define soclose 1e-8
#define chocolate win
// so much chocolate
#define patkan 9
#define ff first
#define ss second
#define abs(x) (((x) < 0)?-(x):(x))
#define uint unsigned int
#define dbl long double
#define pi 3.14159265358979323846
using namespace std;
// mylittledoge

using cat = long long;

#ifdef DONLINE_JUDGE
	// palindromic tree is better than splay tree!
	#define lld I64d
#endif

int main() {
	cin.sync_with_stdio(0);
	cin.tie(0);
	cout << fixed << setprecision(10);
	int N;
	cin >> N;
	vector<int> A(N);
	for(int i = 0; i < N; i++) cin >> A[i];
	int ans = 0, a = 0;
	while(a < N-1) {
		if(A[a] != A[a+1]) {
			a++;
			continue;
		}
		ans++;
		a += 2;
	}
	cout << ans << "\n";
	return 0;
}

// look at my code
// my code is amazing


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
const int maxn = 5e5 + 5, inf = 0x3f3f3f3f;
int n, k;
int mn[maxn * 4], p[maxn], in[maxn], ans[maxn];
vector<int> G[maxn];
int read() {
	int x = 0, f = 1;
	char c = getchar();
	while(!isdigit(c)) {
		if(c == '-') {
			f = -1;
		}
		c = getchar();
	}
	while(isdigit(c)) {
		x = x * 10 + c - '0';
		c = getchar();
	}
	return x * f;
}
void update(int l, int r, int x, int p, int d) {
	if(l == r) {
		mn[x] = d;
		return;
	}
	int mid = (l + r) >> 1;
	if(p <= mid) {
		update(l, mid, x << 1, p, d);
	} else {
		update(mid + 1, r, x << 1 | 1, p, d);
	}
	mn[x] = min(mn[x << 1], mn[x << 1 | 1]);
}
int query(int l, int r, int x, int a, int b) {
	if(l > b || r < a) {
		return inf;
	}
	if(l >= a && r <= b) {
		return mn[x];
	}
	int mid = (l + r) >> 1;
	return min(query(l, mid, x << 1, a, b), query(mid + 1, r, x << 1 | 1, a, b));
}
int main() {
	n = read();
	k = read();
	memset(mn, inf, sizeof(mn));
	for(int i = 1; i <= n; ++i) {
		p[read()] = i;
	}
	for(int i = n; i; --i) {
		int t = query(1, n, 1, p[i] + 1, min(p[i] + k, n));
		if(t != inf) {
			G[p[i]].push_back(p[t]);
			++in[p[t]];
		}
		t = query(1, n, 1, max(1, p[i] - k + 1), p[i] - 1);
		if(t != inf) {
			G[p[i]].push_back(p[t]);
			++in[p[t]];
		}
		update(1, n, 1, p[i], i);
	}
	priority_queue<int, vector<int>, greater<int> > q;
	for(int i = 1; i <= n; ++i) {
		if(!in[i]) {
			q.push(i);
		}
	}
	while(!q.empty()) {
		int u = q.top();
		ans[u] = ++ans[0];
		q.pop();
		for(int i = 0; i < G[u].size(); ++i) {
			int v = G[u][i];
			if(!--in[v]) {
				q.push(v);
			}
		}
	}
	for(int i = 1; i <= n; ++i) {
		printf("%d\n", ans[i]);
	}
	return 0;
}

Measured memory_bytes: 44544
import java.util.*;
import java.math.RoundingMode;
import java.math.BigDecimal;
 
public class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int[] a = new int[n];
		long sum = 0;
		long b[] = new long[n];
		for (int i = 0; i < n; i++) {
			a[i] = sc.nextInt();
			b[a[i]-1]++;
		}
		for(int i = 0; i < n; i++) {
			sum+=b[i]*(b[i]-1)/2;
		}
		for(int i = 0; i < n; i++) {
			System.out.println(sum-b[a[i]-1]+1);
		}
		
	}
}

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

int main(){
	int r,g,b;

	cin >> r >> g >> b;
	int n = r * 100 + g * 10 + b;

	if(n % 4 == 0){
		cout << "YES" << endl;
	} else{
		cout << "NO" << endl;
	}

	return 0;
}

Measured memory_bytes: 256
from enum import Enum
import sys
import math
 
BIG_NUM = 2000000000
MOD = 1000000007
EPS = 0.000000001
 
A,B,DEGREE = map(int,input().split())
 
rad = math.radians(DEGREE)
 
S = A*B*math.sin(rad)/2.0
C = math.sqrt(A*A+B*B-2*A*B*math.cos(rad))
h = 2*S/A
 
print("%.10f %.10f %.10f"%(S,A+B+C,h))


Measured memory_bytes: 6428
package main

import "fmt"

func solve() {
	var s string
	fmt.Scan(&s)

	po := make([]bool, 26)

	for _, c := range s {
		po[c-'a'] = true
	}
	for i, c := range po {
		if !c {
			fmt.Println(string('a' + i))
			return
		}
	}
	fmt.Println("None")
}

func main() {
	solve()
}

func min(a, b int) int {
	if a < b {
		return a
	}
	return b
}

func max(a, b int) int {
	if a > b {
		return a
	}
	return b
}

func abs(a int) int {
	if a < 0 {
		return -a
	}
	return a
}


Measured memory_bytes: 1280
/*{{{*/
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<string>
#include<iostream>
#include<sstream>
#include<set>
#include<map>
#include<queue>
#include<bitset>
#include<vector>
#include<limits.h>
#include<assert.h>
#define SZ(X) ((int)(X).size())
#define ALL(X) (X).begin(), (X).end()
#define REP(I, N) for (int I = 0; I < (N); ++I)
#define REPP(I, A, B) for (int I = (A); I < (B); ++I)
#define FOR(I, A, B) for (int I = (A); I <= (B); ++I)
#define FORS(I, S) for (int I = 0; S[I]; ++I)
#define RS(X) scanf("%s", (X))
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define GET_POS(c,x) (lower_bound(c.begin(),c.end(),x)-c.begin())
#define CASET int ___T; scanf("%d", &___T); for(int cs=1;cs<=___T;cs++)
#define MP make_pair
#define PB push_back
#define MS0(X) memset((X), 0, sizeof((X)))
#define MS1(X) memset((X), -1, sizeof((X)))
#define LEN(X) strlen(X)
#define F first
#define S second
using namespace std;
typedef long long LL;
typedef unsigned long long ULL;
typedef long double LD;
typedef pair<int,int> PII;
typedef vector<int> VI;
typedef vector<LL> VL;
typedef vector<PII> VPII;
typedef pair<LL,LL> PLL;
typedef vector<PLL> VPLL;
template<class T> void _R(T &x) { cin >> x; }
void _R(int &x) { scanf("%d", &x); }
void _R(LL &x) { scanf("%lld", &x); }
void _R(double &x) { scanf("%lf", &x); }
void _R(char &x) { scanf(" %c", &x); }
void _R(char *x) { scanf("%s", x); }
void R() {}
template<class T, class... U> void R(T &head, U &... tail) { _R(head); R(tail...); }
template<class T> void _W(const T &x) { cout << x; }
void _W(const int &x) { printf("%d", x); }
void _W(const LL &x) { printf("%lld", x); }
void _W(const double &x) { printf("%.16f", x); }
void _W(const char &x) { putchar(x); }
void _W(const char *x) { printf("%s", x); }
template<class T,class U> void _W(const pair<T,U> &x) {_W(x.F); putchar(' '); _W(x.S);}
template<class T> void _W(const vector<T> &x) { for (auto i = x.begin(); i != x.end(); _W(*i++)) if (i != x.cbegin()) putchar(' '); }
void W() {}
template<class T, class... U> void W(const T &head, const U &... tail) { _W(head); putchar(sizeof...(tail) ? ' ' : '\n'); W(tail...); }
#ifdef HOME
 #define DEBUG(...) {printf("# ");printf(__VA_ARGS__);puts("");}
#else
 #define DEBUG(...)
#endif
int MOD = 1e9+7;
void ADD(LL& x,LL v){x=(x+v)%MOD;if(x<0)x+=MOD;}
/*}}}*/
const int SIZE = 1e6+10;

LL fac[SIZE],inv[SIZE];
LL mypow(LL x,LL y){
    LL res=1;
    while(y){
        if(y&1)res=res*x%MOD;
        y>>=1;
        x=x*x%MOD;
    }
    return res;
}
LL C(int x,int y){
    if(y<0||y>x)return 0;
    return fac[x]*inv[y]%MOD*inv[x-y]%MOD;
}
void build(){
    assert(MOD>=SIZE);
    fac[0]=1;
    REPP(i,1,SIZE)fac[i]=fac[i-1]*i%MOD;
    inv[SIZE-1]=mypow(fac[SIZE-1],MOD-2);
    for(int i=SIZE-2;i>=0;i--)inv[i]=inv[i+1]*(i+1)%MOD;
}
//TODO: build();
int main(){
    int N,K;
    build();
    R(N,K);
    FOR(i,1,K){
        if(K+i-1>N)W(0);
        else W(C(N-K+i-(i-1),i)*C(K-i+i-1,i-1)%MOD);
    }
    return 0;
}


Measured memory_bytes: 15872
#include<iostream>
#include<algorithm>
#include<math.h>
#include<cmath>
#include<vector>
#include<stack>
#include<queue>
#include<functional>
#include<map>
#include<set>
#include <string>
#include <numeric>

using namespace std;
#define rep(i,n) for(int i=0;i<(n);i++)
map<int, int> mp;
map<int, int>mm;
#define ll long long
#define ld long double
#define PI 3.14159265358979l

unsigned gcd(unsigned a, unsigned b) {
	if (a < b) gcd(b, a);
	unsigned r;
	while ((r = a % b)) {
		a = b;
		b = r;
	}
	return b;
}
char tolower(char c) {
	return (c + 0x20);
}
ld num(ld a,ld b) {
	ld c = 1;
	while (b > a) {
		a *= 2;
		c*=2;
	}
	return c;
}

int main() {
	int n, k;
	cin >> n >> k;
	if (k == 1)cout << 0 << endl;
	else {
		n = n - k;
		cout << n << endl;
	}
	cin >> n;

}

Measured memory_bytes: 256
#include <algorithm>
#include <climits>
#include <cmath>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#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++)
#define REPvec(itr, mp) for (auto itr = mp.begin(); itr != mp.endl(); itr++)
#define REPe(e, mp) for (auto& e : mp)
#define all(x) x.begin(), x.end()
#define MOD 1000000007  // 1e9+7
using namespace std;
using ll = long long int;
using vecint = vector<int>;
using vecll = vector<ll>;
using vec2int = vector<vector<int>>;
using P = pair<int, int>;
////////////////////////////////////////////////
vec2int b(2, vecint(3, 0));
vec2int c(3, vecint(2, 0));
vec2int G(3, vecint(3, -1));
////////////////////////////////////////////////
int main() {
  ////////////////////////////////////////////////
  cin.tie(nullptr);
  ios_base::sync_with_stdio(false);
  ////////////////////////////////////////////////
  int x, y, z, k;
  cin >> x >> y >> z >> k;
  vecll a(x), b(y), c(z);
  REPe(e, a) cin >> e;
  REPe(e, b) cin >> e;
  REPe(e, c) cin >> e;
  vecll ab(x * y, 0);
  int cnt = 0;
  REP(i, x) {
    REP(j, y) {
      ab[cnt] = a[i] + b[j];
      cnt++;
    }
  }
  sort(ab.rbegin(), ab.rend());
  int size = min(k, x * y);
  vecll abc(size * z);
  cnt = 0;
  REP(i, size) {
    REP(j, z) {
      abc[cnt] = ab[i] + c[j];
      cnt++;
    }
  }
  sort(abc.rbegin(), abc.rend());
  REP(i, k) { cout << abc[i] << endl; }
}


Measured memory_bytes: 31616
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <vector>
#include <string>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <algorithm>

using namespace std;

#define rep(i,j) REP((i), 0, (j))
#define REP(i,j,k) for(int i=(j);(i)<(k);++i)
#define BW(a,x,b) ((a)<=(x)&&(x)<=(b))
#define ALL(v) (v).begin(), (v).end()
#define LENGTHOF(x) (sizeof(x) / sizeof(*(x)))
#define AFILL(a, b) fill((int*)a, (int*)(a + LENGTHOF(a)), b)
#define MP make_pair
#define PB push_back
#define F first
#define S second
#define INF 1 << 30
#define EPS 1e-10

typedef pair<int, int> pi;
typedef pair<int, pi> pii;
typedef vector<int> vi;
typedef queue<int> qi;
typedef long long ll;

int p[1000], r[1000], N, M, B;

int main(){
  scanf("%d%d", &N, &M);
  rep(i, N) scanf("%d", p+i);
  rep(i, M){
    scanf("%d", &B);
    rep(j, N){
      if(p[j] > B) continue;
      r[j]++;
      break;
    }
  }

  int res = 0;
  rep(i, N){
    if(r[res] < r[i]) res = i;
  }

  printf("%d\n", res+1);
  return 0;
}

Measured memory_bytes: 1196
using System;
using System.Collections.Generic;
class Program
{
	static void Main(string[] args)
	{
		string[] s = Console.ReadLine().Split();
		int A = int.Parse(s[0]);
		int B = int.Parse(s[1]);
		int X = int.Parse(s[2]);
		string ans = "YES";
		if(A>X || A+B<X){
			ans = "NO";
		}
		Console.WriteLine(ans);
	}
}

Measured memory_bytes: 13140
///mAAria...
#include<bits/stdc++.h>
 
using namespace std;
 
#define int long long
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define all(v) v.begin(),v.end()
#define ld long double
#define ff first
#define ss second
#define pii pair<int,int>
#define pi 3.1415926535897932384626433832
#define mod 1000000007
#define inf 1000000000
#define pr1(a) cout << a << endl
#define pr2(a,b)cout << a <<  " " <<b<< endl
#define pr3(a,b,c) cout << a <<" " << b << " " << c << endl

const long double PI = acos(-1);

int powm(int a, int b) {
    int res=1;
    while(b) {
        if(b&1)
            res=(res*a)%mod;
        a=(a*a)%mod;
        b>>=1;
    }
    return res;
}

int gcd(int a, int b){
    if(b==0)return a;
    gcd(b,a%b);
}


void solve(){
    string s;
    cin >> s;
    int a =0, b= 0;
    for(int i = 0;i<3;i++){
        if(s[i]=='A')a++;
        else b++;
    }

    if(a&&b){
        cout << "Yes" << endl;
    }
    else cout << "No" << endl;

 
} 

signed main() 
{   
    IOS;
    int t = 1;
    //cin >> t;

    for(int i = 1;i<=t;i++){
        solve();
    }
    return 0;
} 

 


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define  ll   long long
int main() {


    ll n ; cin >>n ;
    ll Arr[n];
    map<ll,ll>mp;
    for(ll i =0 ; i < n; i++){
        cin>>Arr[i];
        if(mp[Arr[i]]==0){
            mp[Arr[i]]++;
        }else {
            cout<<"NO";
            return 0;
        }
    }
    cout<<"YES";

    return 0;
}

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

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

   int step = ceil(log2(H));
   ll ans;
   if (ceil(log2(H)) == log2(H)){
       ans = pow(2, step + 1) - 1;
   } else {
       ans = pow(2, step) - 1;
   }

   cout << ans << endl;
}

Measured memory_bytes: 256
n = int(input())

score = {}

for i in range(n):
    s, p = input().split()

    if s not in score:
        score[s] = []

    t = [i+1,int(p)]
    score[s].append(t)

city = sorted(score)
for key in city:
    score[key] = sorted(score[key], key=lambda x: x[1], reverse=True)

    for i in range(len(score[key])):
        print(score[key][i][0])
    


Measured memory_bytes: 3060
#include<stdio.h>
 int main(void){
     int a,b;
     char op;
     while(1){
        scanf("%d %c%d",&a,&op,&b);
        if(op=='?'){
         break;
        }
     if(op=='+'){
        printf("%d\n",a+b);
     }
     else if(op=='-'){
        printf("%d\n",a-b);
     }
     else if(op=='*'){
        printf("%d\n",a*b);
     }
     else{
        printf("%d\n",a/b);
     }
                          }
    return 0;
    }

Measured memory_bytes: 600
import sys
input = sys.stdin.readline
S = [0] + list(map(int, list(input())[: -1]))

dp = [[float("inf")] * 2 for _ in range(len(S) + 1)]
dp[-1][0] = 0
for i in range(len(dp) - 1, 0, -1):
  for j in range(2):
    if S[i - 1] + j <= 5:
      dp[i - 1][0] = min(S[i - 1] + j + dp[i][j], dp[i - 1][0])
    if S[i - 1] + j >= 5:
      dp[i - 1][1] = min(10 - (S[i - 1] + j) + dp[i][j], dp[i - 1][1])

print(min(dp[0]))

Measured memory_bytes: 226748
#include<cstdio>
#include<cstring>
#include<cmath>
#include<iostream>
#include<algorithm>
#include<map>
using namespace std;

int main()
{
	int a,b,ans;
	cin>>a>>b;
	if(b<10)
		ans=a*10+b;
	else if(b==100)
		ans=a*1000+b;
	else
		ans=a*100+b;
	int num=sqrt(ans);
	if(num*num==ans)
		printf("Yes\n");
	else
		printf("No\n");
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cassert>
#include <functional>
#include <algorithm>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <stack>
using namespace std;
using llong = long long;

llong n;

int main() {
    cin >> n;

    cout << n / 3 << endl;

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<int(n);++i)
#define all(a) (a).begin(),(a).end()
typedef long long ll;
#define rep1(i,n) for(int i=1;i<=int(n);++i)
#define lb(s,x) (lower_bound(all(s),x)-s.begin())
#define ub(s,x) (upper_bound(all(s),x)-s.begin())
#define uniq(a) a.erase(unique(all(a)),a.end())
#define bit(k) (1LL<<(k))
const int INF = 1e9;

#define debug(...) recursive_debug(#__VA_ARGS__, __VA_ARGS__)

void recursive_debug(string) { cerr << endl; }

template<class H,class... T>
void recursive_debug(string s, H h, T... t) {
    int comma = s.find(',');
    cerr << s.substr(0,comma) << " = " << h << ", ";
    recursive_debug(s.substr(comma+1), t...);
}

template<class T,class U>
ostream& operator<<(ostream& ost, const pair<T,U> &p) {
    ost << "(" << p.first << ", " << p.second << ")";
    return ost;
}

template<class T>
ostream& operator<<(ostream &ost, const vector<T> &v) {
    ost << "[";
    for(T t : v) ost << t << ",";
    ost << "]";
    return ost;
}

struct State {
    ll score;
    vector<int> last;
};


int main(void){
    int D;
    cin >> D;
    int M = 26;
    vector<ll> c(M);
    rep(m,M) cin >> c[m];
    vector<vector<ll>> s(D, vector<ll>(26));
    ll score = 0;

    rep(d,D) {
        rep(m,M){
            cin >> s[d][m];
        }
    }
    vector<int> last(M, -1);
    rep(d,D) {
        vector<int> turn_score(M);
        rep(m,M) {
            turn_score[m] = s[d][m];
            rep(i,M) if(i != m) {
                turn_score[m] -= c[i] * (d - last[i]);
            }
        }

        int t = 0;
        ll max_turn_score = -INF;
        rep(m,M){
            if (max_turn_score < turn_score[m]) {
                max_turn_score = turn_score[m];
                t = m;
            }
        }
        last[t] = d;
        score += max_turn_score;
        cout << t+1 << endl;
    }
    // debug(score);

    return 0;
}


Measured memory_bytes: 3692
#include<bits/stdc++.h>
using namespace std;
using ll=long long;
const ll MOD=1000000007;
int main(){
  ll N;
  cin>>N;
  ll res=0;
  vector<ll>data(N);
  for(ll i=0;i<N;i++)cin>>data[i];
  for(ll d=0;d<60;d++){
    ll zero=0,one=0;
    for(ll i=0;i<N;i++){
      if(data[i]>>d&1)one++;
      else zero++;
    }
    ll tmp=(1ll<<d)%MOD;
    ll ans=(zero*one)%MOD*tmp%MOD;
    res=(res+ans)%MOD;
  }
  while(res<0)res+=MOD;
  res=res%MOD;
  cout<<res<<endl;
}

Measured memory_bytes: 5580
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner stdIn = new Scanner(System.in);
		
		int N = stdIn.nextInt();
		int A = stdIn.nextInt();
		int B = stdIn.nextInt();
		
		if(N*A < B)
		{
			System.out.println(N*A);
		}
		else
		{
			System.out.println(B);
		}

	}

}


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

int main() {
  long long max = 1e18;
  long long n;
  cin >> n;

  long long ans = 1;

  long long a[n];
  for(int i=0;i<n;i++) {
    cin >> a[i];
    if(a[i] == 0) {
      cout << 0 << endl;
      return 0;
    }
  }

  for(int i=0;i<n;i++) {
    if(ans > max/a[i]) {
      cout << -1 << endl;
      return 0;
    }
    else {
      ans = ans * a[i];
    }

  }
  cout << ans << endl;

  return 0;
}


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

int main() {
	int y = 0, m = 0, d = 0;
	scanf("%d/%d/%d", &y, &m, &d);
	if (m <= 4) cout << "Heisei" << endl;
	else if (m > 4) cout << "TBD" << endl;
	return 0;
}

Measured memory_bytes: 256
import sys
input = sys.stdin.readline

n = int(input())
ab = [list(map(int, input().split())) for i in range(n)]
ab.sort(key=lambda x: x[1])
cnt = 0
for i in range(n):
    cnt += ab[i][0]
    if cnt > ab[i][1]:
        print('No')
        exit()
print('Yes')


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

struct Node {
    int key;
    struct Node *right, *left, *parent;
};
typedef struct Node Node;

Node *root, *NIL;

void insert(int k) {
    Node *y = NIL;
    Node *x = root;
    Node *z;
    
    z = (Node *)malloc(sizeof(Node));
    z->key   = k;
    z->left  = NIL;
    z->right = NIL;
    
    while(x != NIL) {
        y = x;
        if(z->key < x->key) {
            x = x->left;
        } else {
            x = x->right;
        }
    }
    
    z->parent = y;
    if(y == NIL) {
        root = z;
    } else {
        if( z->key < y->key) {
            y->left = z;
        } else {
            y->right = z;
        }
    }
}

void inorder(Node *u) {
    if(u == NIL) return;
    inorder(u->left);
    printf(" %d",u->key);
    inorder(u->right);
}
void preorder(Node *u) {
    if(u == NIL) return;
    printf(" %d",u->key);
    preorder(u->left);
    preorder(u->right);
}
    
int main(void) {
    int n, i, x;
    char com[16]; //2のｎ乗にしてみました☆
    scanf("%d",&n);
    
    for(i=0;i<n;i++) {
        scanf("%s",com);
        if(!strcmp(com,"insert")) {
            scanf("%d",&x);
            insert(x);
        } else if(!strcmp(com,"print")) {
            inorder(root);
            printf("\n");
            preorder(root);
            printf("\n");
        }
    }

    return 0;
}


Measured memory_bytes: 25156
#include <cassert>

#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>

// C++
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#include <array>
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
//#include <boost/foreach.hpp>
//#include <boost/range/algorithm.hpp>
#define rep(i,j,k) for(int i=(int)j;i<(int)k;i++)
#define ll long long
#define Sort(v) sort(all(v))
#define INF 1000000000
#define END return 0
#define pb push_back
#define se second
#define fi first
#define pb push_back
#define all(v) (v).begin() , (v).end()
#define MP make_pair
#define MOD 1000000007LL
using namespace std;
int day[12]={31,28,31,30,31,30,31,31,30,31,30,31};

int main (){
    int n;cin>>n;vector<int> v(n);rep(i,0,n)cin>>v[i];
    int q;
    cin>>q;
    rep(i,0,q){
        int a,b;cin>>a>>b;
        reverse(v.begin()+a,v.begin()+b);
    }

    rep(i,0,n){
        if(i)cout<<" ";
        cout<<v[i];
    }
    cout<<endl;
    
}



/*
1 2 3 4 5

6
*/



Measured memory_bytes: 3088
#include<iostream>
using namespace std;
bool vis[150];
int a[150];
int n,ans;
int main()
{
	cin>>n;
	for(int i=0;i<n;i++)
	  cin>>a[i];
	for(int i=0;i<n;i++)
	if(!vis[a[i]])
	{
		ans++;
		vis[a[i]]=true;
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 256