akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;

using ll = long long;
using vi = vector<int>;
using vi2 = vector<vector<int>>;
#define MP(a,b) make_pair((a),(b))
#define MT(...) make_tuple(__VA_ARGS__)

#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,x) for(int i=0;i<(int)(x);i++)
#define REPS(i,x) for(int i=1;i<=(int)(x);i++)
#define RREP(i,x) for(int i=((int)(x)-1);i>=0;i--)
#define RREPS(i,x) for(int i=((int)(x));i>0;i--)

#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl;
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl;
#define gcda(x,y) gcd(abs(x),abs(y))

#define DCOUT(x,n) cout << fixed << setprecision(n) << (x) << endl;

#define sz(x) (int)(x).size()
#define HOGE cout << "hoge" << endl;
using P = pair<ll,ll>;

template<typename T>inline istream& operator>>(istream&i,vector<T>&v)
{REP(j,sz(v))i>>v[j];return i;}

const int INF = 1e9;

int main(){
    string s, t;
    cin >> s >> t;
    ll l = s.size();
    ll ans = 0;
    REP(i,l){
        if(s[i]!=t[i]) ans++;
    }
    cout << ans << endl;
}


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

using namespace std;

typedef long long int llint;
typedef pair<int, int> pii;
typedef pair<llint, llint> pll;
typedef vector<int> vi;
typedef vector<llint> vl;
typedef vector<pii> vii;
typedef vector<pll> vll;

#define ci cin
#define co cout
#define en endl
#define ln cout<< '\n'
#define rep(i, n) for(int i = 0; i < n; i++)
#define outl(x) cout<< (x) << '\n'
#define pb push_back
#define fi first
#define se second
#define MOD 1000000007

template<typename Tn> Tn gcd(Tn a, Tn b)
{
	return (b ? gcd(b, a % b) : a);
}

template<typename Tn> Tn lcm(Tn a, Tn b)
{
	return a / gcd(a, b) * b;
}

string IntToString(int number)
{
	stringstream ss;
	ss << number;
	return ss.str();
}

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

int main()
{
    int n;
    int l[100];

    ci >> n;
    rep(i, n) ci >> l[i];

    sort(l, l + n);

    int sum = 0;
    rep(i, n - 1) sum += l[i];

    if(l[n - 1] < sum) co << "Yes" << en;
    else co << "No" << en;
  
    return 0;
}









Measured memory_bytes: 256
#include<iostream>
#include<math.h>
#include<cstdio>
#include<string>
#include<cstring>
#include<iomanip>
using namespace std;
int main()
{
	
	ios::sync_with_stdio(false);
	int a, b, c;
	cin >> a >> b >> c;
	if ((b - a) == (c - b))cout << "YES";
	else cout << "NO";
	return 0;
}

Measured memory_bytes: 256
let () =
  let s = Scanf.scanf "%s" (fun x -> x) in
  let len = (String.length s) in
  let len_bytes = Bytes.of_string (string_of_int (len - 2)) in
  let first_char = String.get s 0 in
  let last_char = String.get s (len - 1) in
  let first_char_bytes = Bytes.make 1 first_char in
  let last_char_bytes = Bytes.make 1 last_char in
  let concat_bytes = Bytes.concat
                       Bytes.empty
                       [first_char_bytes; len_bytes; last_char_bytes] in
  let ans = Bytes.to_string concat_bytes in
  Printf.printf "%s\n" ans


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

using namespace std;

int n, k;
int a[100010];
long long summ;

int main(void)
{
	scanf("%d %d", &n, &k);
	
	for(int i = 0 ; i < k ; i++)
	{
		scanf("%d", &a[i]);
		
		summ += a[i];
	}
	
	if(summ >= n)
	{
		printf("Yes");
	}
	
	else
	{
		printf("No");
	}
	
	return 0;
}

Measured memory_bytes: 640
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.InputMismatchException;
import java.io.IOException;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        FastReader in = new FastReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        ACircle solver = new ACircle();
        solver.solve(1, in, out);
        out.close();
    }

    static class ACircle {
        public void solve(int testNumber, FastReader s, PrintWriter out) {
            int r = s.nextInt();
            out.println(r * r);
        }

    }

    static class FastReader {
        private InputStream stream;
        private byte[] buf = new byte[1024];
        private int curChar;
        private int numChars;
        private FastReader.SpaceCharFilter filter;

        public FastReader(InputStream stream) {
            this.stream = stream;
        }

        public int read() {
            if (numChars == -1) {
                throw new InputMismatchException();
            }
            if (curChar >= numChars) {
                curChar = 0;
                try {
                    numChars = stream.read(buf);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }
                if (numChars <= 0) {
                    return -1;
                }
            }
            return buf[curChar++];
        }

        public int nextInt() {
            int c = read();
            while (isSpaceChar(c)) {
                c = read();
            }
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            int res = 0;
            do {
                if (c < '0' || c > '9') {
                    throw new InputMismatchException();
                }
                res *= 10;
                res += c - '0';
                c = read();
            } while (!isSpaceChar(c));
            return res * sgn;
        }

        public boolean isSpaceChar(int c) {
            if (filter != null) {
                return filter.isSpaceChar(c);
            }
            return isWhitespace(c);
        }

        public static boolean isWhitespace(int c) {
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

        public interface SpaceCharFilter {
            public boolean isSpaceChar(int ch);

        }

    }
}



Measured memory_bytes: 21460
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <numeric>
using namespace std;
typedef long long int ll;

#define EPS (1e-7)
#define INF 1e18
#define max(p,q)((p)>(q)?(p):(q))
#define min(p,q)((p)<(q)?(p):(q))
#define PI (acos(-1))

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


int main() {

    int N;
    cin >> N;

    vector<int> A(N), B(N), C(N-1);

    REP(i, N) {
        cin >> A[i];
        A[i]--;
    }
    REP(i, N) cin >> B[i];
    REP(i, N-1) cin >> C[i];

    int tmp = -3, sum = 0;
    REP(i, N){
        sum += B[A[i]];
        if (tmp + 1 == A[i]) sum += C[tmp];
        tmp = A[i];
    }
    cout << sum << endl;
    return 0;
}

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

class AOJ
{
    static void Main(string[] args)
    {
        int n = int.Parse(Console.ReadLine());
        Console.WriteLine(fact(n));
    }
    static long fact(int n)
    {
        if (n == 0) return 1;
        return n * fact(n - 1);
    }
}

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

typedef long long ll;
const int MOD = 1000000007;

int main() {
    int N; cin >> N;
    vector<int> memo{0, 0, 0};
    ll ans = 1;
    for (int i = 0; i < N; i++) {
        int c; cin >> c;
        int t = 0;
        bool f = true;
        for (int j = 0; j < 3; j++) {
            if (memo[j] == c) {
                if (f) {
                    f = false;
                    memo[j]++;
                }
                t++;
            }
        }
        ans = ans * t % MOD;
    }
    cout << ans << endl;
}

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

int main() {
  int N,K; cin >>N>>K;
  long long kotae=K;
  if(N==1){
    cout<<K<<endl;
    return 0;
  }else{
    int a=1;
    while(a<N){
      kotae*=(K-1);
      a++;
    }
    cout<<kotae<<endl;
  }
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<set>
#include<map>
#include<deque>
#include<cmath>
#include<algorithm>
using namespace std;
#define int long long int
#define mod 1000000007		
int32_t main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	int h,w,m;
	cin>>h>>w>>m;
	int rows[h+1]={0};
	int cols[w+1]={0};
	int j;
	vector<int> vec[w+1];
	for(j=0;j<m;j++)
	{
		int x,y;
		cin>>x>>y;
		rows[x]++;
		cols[y]++;
		vec[y].push_back(x);
	}
	int answer=0;
	multiset<int> st;
	for(j=1;j<=h;j++)
	{
		st.insert(rows[j]);
	}
	int i;
	for(i=1;i<=w;i++)
	{
		multiset<int> st2;
		for(int x:vec[i])
		{
			int val=rows[x];
			auto it=st.find(val);
			if(it!=st.end())
			{
				st.erase(it);
			}
			st2.insert(val);
		}
		int here=cols[i];
		int val=0;
		if(st2.size()!=0)
		{
			auto it=st2.end();
			it--;
		    int temp=*it;
		    temp--;
		    val=max(val,temp);
		}
		if(st.size()!=0)
		{
			auto it=st.end();
			it--;
			int temp=*it;
			val=max(val,temp);
		}
		here+=val;
		answer=max(answer,here);
		for(int x:st2)
		{
			st.insert(x);
		}
	}
	cout<<answer<<endl;
}


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

int main() {
  long long h,w,a,b,c,ans=0;
  cin>>h>>w;
  if(h%3==0||w%3==0)cout<<0<<endl;
  else {
    ans=min(h,w);
    ans=min(ans,((w/3)+1)*h-(w-1-(w/3))*(h/2));
    ans=min(ans,((h/3)+1)*w-(h-1-(h/3))*(w/2));
    ans=min(ans,(h-(h/3))*(w-(w/2))-(h/3)*w);
    ans=min(ans,(w-(w/3))*(h-(h/2))-(w/3)*h);
    cout<<ans<<endl;
  }
}


Measured memory_bytes: 256
#include <cstdio>

int N;
int arr[100005];

int main()
{
	int ans = 0;
	int cnt = 0;
	scanf("%d", &N);
	for (int i = 1; i <= N; i++) {
		scanf("%d", &arr[i]);
	}
	arr[0] = -1;
	for (int i = 1; i <= N; i++) {
		if (arr[i] == i)
			cnt++;
		else
			cnt = 0;
		if (cnt % 2 == 1)
			ans++;		
	}
	printf("%d\n", ans);
}

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

#define all(x) (x).begin(), (x).end()
#define sz(x) (int)(x).size()

typedef long long ll;
typedef array<int, 3> tri;
typedef long double ld;

template <class T> istream& operator>>(istream& I, vector<T>& v) {for (T &e: v) I >> e; return I;}
template <class T> ostream& operator<<(ostream &O, const vector<T>& v) {for (const T &e: v) O << e << ' '; return O;}



void _main() {
        int n; cin >> n;

        int ans = 0;
        int mx_x = INT_MIN, mx_y = INT_MIN;
        int mn_x = INT_MAX, mn_y = INT_MAX;
        for (int i = 0; i < n; i++) {
                int x, y; cin >> x >> y;
                int a = x + y;
                int b = y - x;
                mx_x = max(mx_x, a);
                mn_x = min(mn_x, a);
                mx_y = max(mx_y, b);
                mn_y = min(mn_y, b);
        }

        cout << max(abs(mx_x - mn_x), abs(mx_y - mn_y));
}



signed main() {
        ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
//        freopen("input.txt", "r", stdin);
        int _t = 1;
//        cin >> _t;
        while (_t--) _main();
        return 0;
}

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

#define rep(i,n)  for(int i=0; i<n; i++)

int main(){
  int n, r;
  while(true){
    cin>>n>>r;
    if(n==0 && r==0)break;
    int ans=n;
    stack<pair<int, int> > st;
    rep(i,r){
      int p, c;
      cin>>p>>c;
      st.push(pair<int, int>(p, c));
    }
    while(!st.empty()){
      pair<int, int> tmp=st.top(); st.pop();
      if(ans>(n-tmp.second)){ans-=(tmp.first-1);}//オレンジ
      else if(ans>(n-tmp.first-tmp.second+1)){ans+=tmp.second;}//ブルー
    }
    cout<<ans<<endl;
  }
  return 0;
}

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

int main(){
	cin.tie(0),ios::sync_with_stdio(false);
	int64_t a,b,c,d; cin>>a>>b>>c>>d;
	cout<<max({a*c,b*d,a*d,b*c})<<"\n"s;
}


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


int a,b,c;
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cin>>a>>b>>c;
    if ((a==b)&&(c!=a)) cout<<"Yes";
    else if ((a==c)&&(b!=c)) cout<<"Yes";
    else if ((b==c)&&(a!=c)) cout<<"Yes";
    else cout<<"No";
    
    
    
    
    return 0;
}

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

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

  int X = stoi(N.substr(N.size() - 1));

  if (X == 2 || X == 4 || X == 5 || X == 7 || X == 9)
    cout << "hon" << endl;
  else if (X == 0 || X == 1 || X == 6 || X == 8)
    cout << "pon" << endl;
  else
    cout << "bon" << endl;
}

Measured memory_bytes: 3628
#include <bits/stdc++.h>
#define fi first
#define se second
#define pii pair<int,int>
#define mp make_pair
#define pb push_back
#define space putchar(' ')
#define enter putchar('\n')
#define eps 1e-10
#define MAXN 100005
//#define ivorysi
using namespace std;
typedef long long int64;
typedef unsigned int u32;
typedef double db;
template<class T>
void read(T &res) {
    res = 0;T f = 1;char c = getchar();
    while(c < '0' || c > '9') {
	if(c == '-') f = -1;
	   c = getchar();
    }
    while(c >= '0' && c <= '9') {
    	res = res * 10 +c - '0';
    	c = getchar();
    }
    res *= f;
}
template<class T>
void out(T x) {
    if(x < 0) {x = -x;putchar('-');}
    if(x >= 10) {
    	out(x / 10);
    }
    putchar('0' + x % 10);
}
int N,A,B;
char s[MAXN];
void Solve() {
    read(N);read(A);read(B);
    scanf("%s",s + 1);
    int r = 1,all = 0;
    for(int i = 1 ; i <= N ; ++i) {
        if(s[i] == 'a') {
            if(all < A + B) {puts("Yes");++all;}
            else puts("No");
        }
        else if(s[i] == 'b') {
            if(all < A + B && r <= B) {puts("Yes");++all;++r;}
            else puts("No");
        }
        else {
            puts("No");
        }
    }
}
int main() {
#ifdef ivorysi
    freopen("f1.in","r",stdin);
#endif
    Solve();
    return 0;
}


Measured memory_bytes: 768
#include "bits/stdc++.h"
using namespace std;
using ll = long long;
using Pii = pair<int, int>;
using Pll = pair<ll, ll>;
#define rep(i, begin, n) for (int i = begin; i < n; i++)
#define repe(i, begin, n) for (int i = begin; i <= n; i++)
#define repr(i, begin, n) for (int i = begin; i > begin - n; i--)
#define repre(i, begin, end) for (int i = begin; i >= end; i--)

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

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

const int inf = INT_MAX;
const int MOD = 1000000007;
const long long INF = LLONG_MAX;
const long long MINF = LLONG_MIN;

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

string s;
int x, y;
vector<int> mvx, mvy;
int tcnt;

int main() {
  cin >> s;
  cin >> x >> y;

  int cur = 0;
  while (s[cur] == 'F') {
    ++cur;
  }

  int initx = cur;

  int dx = 0, dy = 0;
  for (int i = cur; i < s.size(); ++i) {
    char c = s[i];
    if (c == 'T') {
      if (tcnt % 2 == 0) {
        mvx.push_back(dx);
        dx = 0;
      } else {
        mvy.push_back(dy);
        dy = 0;
      }
      ++tcnt;
    } else {
      if (tcnt % 2 == 0) {
        ++dx;
      } else {
        ++dy;
      }

      if (i == s.size() - 1) {
        if (tcnt % 2 == 0) {
          mvx.push_back(dx);
          dx = 0;
        } else {
          mvy.push_back(dy);
          dy = 0;
        }
        break;
      }
    }
  }

  set<int> canx;
  canx.insert(initx);
  for (auto mvxe : mvx) {
    set<int> newcanx;
    for (auto e : canx) {
      newcanx.insert(e + mvxe);
      newcanx.insert(e - mvxe);
    }
    canx = newcanx;
  }

  set<int> cany;
  cany.insert(0);
  for (auto mvye : mvy) {
    set<int> newcany;
    for (auto e : cany) {
      newcany.insert(e + mvye);
      newcany.insert(e - mvye);
    }
    cany = newcany;
  }

  bool okx = false;
  for (auto e : canx) {
    if (e == x) {
      okx = true;
    }
  }

  bool oky = false;
  for (auto e : cany) {
    if (e == y) {
      oky = true;
    }
  }

  if (okx && oky) {
    cout << "Yes";
  } else {
    cout << "No";
  }
}


Measured memory_bytes: 4096
#include<bits/stdc++.h>
using namespace std ;
 int main()
 {
    int n;
    cin>>n;
    int c=n;int x=0;
    while(c!=0)
    {
        c=c/10;x++;
    } int ans=0;
    if(x%2==0)
    { x=x-1;
        for(int i=x;i>=1;i=i-2)
        {
     ans=ans+9*(pow(10,i-1));
        }
    }
    else
    {
        ans=ans+(n-pow(10,x-1))+1;x=x-2;
        for(int i=x;i>=1;i-=2)
        {
            ans=ans+9*pow(10,i-1);
        }
    }
    cout<<ans<<endl;
 }

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

int main() {
    int W,H,x,y,r;
    cin >> W >> H >> x >> y >> r;
    if (x+r > W || x-r < 0 || y+r > H || y-r < 0) {
    cout << "No" << endl;
    } else {
       cout << "Yes" << endl;
    }
    return 0;
}
    


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

#define REP(i, n ,N) for(ll i = (n); i < (N); i++)
#define RREP(i, n ,N) for(ll i = (N-1); i >= 0; i--)
#define p(s) cout<<(s)<<endl
#define p2(a, b) cout<<(a)<<" "<<(b)<<endl
using namespace std;
typedef long long ll;
ll mod = 998244353;
ll inf = 1e18;

ll N;
ll D[100010];
ll ans;
long long fast_power(long long a, long long b) {
	long long ret = 1;
	// aが負の場合
	if (a < 0) {
		a = -a;
		if (b % 2 == 1) ret = -1;
	}
	// 累乗計算
	while (b>0) {
		if (b & 1) {
			ret *= a;
		}
		a *= a;
		a %= mod;
		ret %= mod;
		b >>= 1;
	}
	return ret;
}

int main(){
	cin >> N;
	ll d;
	cin >> d;
	if(d == 0){
		D[0]=1;
		REP(i,0,N-1){
			cin >> d;
			D[d]++;
		}
		if(D[0] == 1){
			bool warn = false;
			ans = 1;
			REP(d, 1, N){
				if (warn && D[d] > 0){
					ans = 0;
					break;
				}
				if (D[d] == 0){
					warn = true;
				}else{
					ans *= fast_power(D[d-1], D[d]);
					ans %= mod;
				}
			}
		}
	}

	p(ans);

	return 0;
}

Measured memory_bytes: 1024
//Security
#include<stdio.h>
int main(){
    char s[4];
    scanf("%s",s);
    for(int i=0;i<3;i++){
        if(s[i]==s[i+1]){
            printf("Bad\n");
            return 0;
        }
    }
    printf("Good\n");
    return 0;
}

Measured memory_bytes: 128
n,k = map(int,input().split())
p = list(map(int,input().split()))
q = [0]*n
for i in range(n):
  q[i] = (1+p[i])/2
s = [0]*(n+1)
for j in range(n):
  s[j+1]=s[j]+q[j]
t = k+1
answer = s[k]-s[0]
while(t<=n):
  answer = max(answer,s[t]-s[t-k])
  t +=1
print(answer)

Measured memory_bytes: 32460
N, Y = gets.chomp.split.map(&:to_i)

ans = "-1 -1 -1"
for i in 0..N do
  for j in 0..(N - i) do
    k = N - i - j
    ans = "#{i} #{j} #{k}" if Y == i * 10000 + j * 5000 + k * 1000
  end
end

puts ans

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

Measured memory_bytes: 128
H, W = map(int,input().split())
map = [[str(i) for i in input()] for j in range(H)]
delList1 = []
delList2 = []
for k in range(H):
    if "#" not in map[k]:
        delList1.append(k)

for l in reversed(delList1):
    del map[l]

for m in range(W):
    if "#" not in [n[m] for n in map]:
        delList2.append(m)

for o in reversed(delList2):
    for p in range(len(map)):
        map[p].pop(o)

for q in map:
    print("".join(q))

Measured memory_bytes: 3064
// warm heart, wagging tail,and a smile just for you!
//                                                                     ███████████   
//                                                                   ███╬╬╬╬╬╬╬╬╬╬███
//                                                                ███╬╬╬╬╬████╬╬╬╬╬╬███
//                                            ███████████       ██╬╬╬╬╬████╬╬████╬╬╬╬╬██
//                                      █████████╬╬╬╬╬████████████╬╬╬╬╬██╬╬╬╬╬╬███╬╬╬╬╬██
//                               ████████╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬█████████╬╬╬╬╬╬██╬╬╬╬╬╬╬██
//                             ████╬██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬█████████╬╬╬╬╬╬╬╬╬╬╬██
//                           ███╬╬╬█╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██╬╬███╬╬╬╬╬╬╬█████
//                         ███╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██╬╬╬████████╬╬╬╬╬██
//                       ███╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬███╬╬╬╬╬╬╬╬╬███
//                     ███╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬█████╬╬╬╬╬╬╬██
//                 ████╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬████╬╬╬╬╬████
//     █████████████╬╬╬╬╬╬╬╬██╬╬╬╬╬████╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬█████╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬███╬╬╬╬██████
//   ████╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██╬╬██████╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██████╬╬╬╬╬╬╬███████████╬╬╬╬╬╬╬╬██╬╬╬██╬╬╬██
// ███╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬████╬╬╬╬╬╬╬╬╬╬╬█╬╬╬╬╬╬╬██╬╬╬╬╬╬╬╬██
// ██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██╬╬╬╬▓▓▓▓▓▓╬╬╬████╬╬████╬╬╬╬╬╬╬▓▓▓▓▓▓▓▓██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██╬╬╬╬╬╬╬███
// ██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██████▓▓▓▓▓▓▓╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬▓▓▓▓▓▓▓██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██╬╬╬╬█████
// ███╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬███╬╬╬╬╬██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬█████╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬████████
//   ███╬╬╬╬╬╬╬╬╬╬╬╬╬█████╬╬╬╬╬╬╬╬██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬███╬╬██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██
//       ██████████████  ████╬╬╬╬╬╬███████████████████████████╬╬╬╬╬██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬████
//                         ███████                           █████  ███████████████████  
#include "bits/stdc++.h"
using namespace std;
#define MOD 1000000007
#define INF (1LL<<60)
#define fs first
#define sc second
#define pb push_back
#define int long long
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define RFOR(i,a,b) for(int i = (b-1);i>=a;i--)
#define REP(i,n)  FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define ITR(itr,mp) for(auto itr = (mp).begin(); itr != (mp).end(); ++itr)
#define RITR(itr,mp) for(auto itr = (mp).rbegin(); itr != (mp).rend(); ++itr)
#define range(i,a,b) ((a)<=(i) && (i)<(b))
#define debug(x)  cout << #x << " = " << (x) << endl;
#define SP << " " << 
typedef pair<int,int> P;
typedef vector<vector<P> > Graph;
typedef vector<int> vec;
typedef vector<vector<int>> mat;

signed main(){
  ios::sync_with_stdio(false);
  cin.tie(0);  
  //問題文を読む時間をケチらない！！
  //未定義動作に気を付ける！！
  //DPや二分探索の範囲に気をつける！！

  string s;
  cin >>s;

  string t = "2019/04/30";

  if(s > t) cout << "TBD" << endl;
  else cout << "Heisei" << endl;


  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(long long i=0; i<n; i++)
#define Rep(i,n) for(long long i=1; i<n; i++)
#define ll long long
#include <math.h>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <numeric>
#include <queue>
#include <set>
#include <vector>


using namespace std;
#define PI acos(-1)
using P =pair<ll,ll>;

ll ketasu(ll a){
   ll num=1;
   while(a/10){
       num++;
       a/=10;
   }
   return num;
}

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

ll kosuu(ll a){
    ll sum=0;
    for(ll i=1;i*i<=a;i++){
        if(a%i==0){
            if(a!=1&&i*i!=a){
            sum+=2;
            }else{
             sum++;   
            }
        }
    }
    return sum;
}






ll di[]={1,0,-1,0};
ll dj[]={0,-1,0,1};

struct UnionFind {
    vector<int>d;
    UnionFind(int n=0):d(n,-1){}
    int find(int x){
        if((d[x])<0)return x;
        return d[x]=find(d[x]);
    }
    bool unite(int x,int y){
        x =find(x);y=find(y);
        if(x==y)return false;
        if(d[x]>d[y])swap(x,y);
        d[x]+=d[y];
        d[y]=x;
        return true;
    }
    bool same(int x,int y){return find(x)==find(y);};
    int size(int x){return -d[find(x)];};
};




// auto mod int
// https://youtu.be/L8grWxBlIZ4?t=9858
// https://youtu.be/ERZuLAxZffQ?t=4807 : optimize
// https://youtu.be/8uowVvQ_-Mo?t=1329 : division
const int mod = 1000000007;
struct mint {
  ll x; // typedef long long ll;
  mint(ll x=0):x((x%mod+mod)%mod){}
  mint operator-() const { return mint(-x);}
  mint& operator+=(const mint a) {
    if ((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += mod-a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator*=(const mint a) { (x *= a.x) %= mod; return *this;}
  mint operator+(const mint a) const { return mint(*this) += a;}
  mint operator-(const mint a) const { return mint(*this) -= a;}
  mint operator*(const mint a) const { return mint(*this) *= a;}
  mint pow(ll t) const {
    if (!t) return 1;
    mint a = pow(t>>1);
    a *= a;
    if (t&1) a *= *this;
    return a;
  }

  // for prime mod
  mint inv() const { return pow(mod-2);}
  mint& operator/=(const mint a) { return *this *= a.inv();}
  mint operator/(const mint a) const { return mint(*this) /= a;}
};
istream& operator>>(istream& is, mint& a) { return is >> a.x;}
ostream& operator<<(ostream& os, const mint& a) { return os << a.x;}

mint f(int n) {
    if(n==0)return 1;
    mint x=f(2/n);
    x*=x;
    if(n%2==1)x*=2;
    return x;
}

mint choose(int n,int a){
    mint x =1,y=1;
    rep(i,a){
      x*=n-i;
      y*=a+i;
    }
    return x/y;
}

vector<ll>to[1000000];
const ll inf=10000000007;


mint f(ll n){
 if(n==0)return 1;
 mint x =f(n/2);
 x*=x;
 if(n%2==1)x*=2;
 return x;
}

mint choose(ll n,ll a){
    mint x=1;mint y=1;
    rep(i,a){
        x*=n-i;
    }
    Rep(i,a+1){
        y*=i;
    }
    return x/y;
}


ll m=1000000007;

int main()
{
 ll a;
 cin>>a;
 if(a){
     cout<<0<<endl;
     return 0;}
 cout<<1<<endl;
}
 


 

 




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

const int mod = 1e9 + 7;

const int MAX = 2e3;

int dp[MAX + 1][MAX + 1];

void init() {
	dp[0][0] = 1;
	for (int i = 0; i <= MAX; i++) {
		for (int j = 0; j <= MAX; j++) {
			if (i + 1 <= MAX) (dp[i + 1][j] += dp[i][j]) %= mod;
			if (j + 1 <= MAX) (dp[i][j + 1] += dp[i][j]) %= mod;
		}
	}
}

int comb(int n, int k) {
	if (k < 0 || n < k) return 0;
	return dp[n - k][k];
}

int main()
{
	init();
	int N, K;
	cin >> N >> K;
	int R = N - K;
	for (int i = 1; i <= K; i++) {
		int res = 1LL * comb(R - (i - 1) + i, i) * comb(K - i + i - 1, i - 1) % mod;
		printf("%d\n", res);
	}
	return 0;
}


Measured memory_bytes: 15872
H,W = map(int, input().split())
L = []
for i in range(H):
    L.append([int(a) for a in input().split()])
    
p = 0
cnt = 0
for i in range(H):
    for j in range(W):
        if L[i][j]%2 == 1:
            cnt += 1
            p = [i, j]
ans_list = []
temp = 0
for i in range(H):
    if i%2 == 0:
        for j in range(W):
            if L[i][j]%2 == 0:
                if temp != 0:
                    if j != 0:
                        ans_list.append([i+1, j, i+1, j+1])
                    else:
                        ans_list.append([i, j+1, i+1, j+1])
            else:
#                if cnt%2 == 1 and [i, j] == p:
#                    break
                if temp == 0:
                    temp = [i, j]
                else:
                    if j != 0:
                        ans_list.append([i+1, j, i+1, j+1])
                    else:
                        ans_list.append([i, j+1, i+1, j+1])
                    temp = 0
    else:
        for j in range(W):
            j = W-1-j
            if L[i][j]%2 == 0:
                if temp != 0:
                    if j == W-1:
                        ans_list.append([i, j+1, i+1, j+1])
                    else:
                        ans_list.append([i+1, j+2, i+1, j+1])
            else:
#                if cnt%2 == 1 and [i, j] == p:
#                    break
                if temp == 0:
                    temp = [i, j]
                else:
                    if j == W-1:
                        ans_list.append([i, j+1, i+1, j+1])
                    else:
                        ans_list.append([i+1, j+2, i+1, j+1])
                    temp = 0
                        

N = len(ans_list)
print(N)
for i in range(N):
    for j in range(4):
        ans_list[i][j] = str(ans_list[i][j])
    print(" ".join(ans_list[i]))

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

int main() {
  string s;
  getline(cin,s);
  stringstream ss;
  ss << s;
  bool ck=false;
  while(ss >> s) {
    if(s[s.size()-1]==',' || s[s.size()-1]=='.') {
      s=s.substr(0,s.size()-1);
    }
    if(s.size()>2 && s.size()<7) {
      if(ck) cout << " ";
      cout << s;
      if(!ck) ck=true;
    }
  }
  cout << endl;
  return 0;
}


Measured memory_bytes: 1204
#include <iostream>
#include <vector>
#include <string>
#include <cmath>
#include <set>
#include <algorithm>
#include <array>
#include <complex>
#include <string>
#include <utility>
#include <map>
#include <queue>
#include <list>
#include <functional>
#include <numeric>
#include <stack>
#include <tuple>

using namespace std;
int dx[4] = { -1,0,1,0 };
int dy[4] = { 0,1,0,-1 };
const int INF = 100000000;
const long long LINF = 1000000000000000000;
const int MOD = (int)1e9 + 7;
const double EPS = 1e-6;
using pii = std::pair<int, int>;
using ll = long long;
using pLL = std::pair<ll, ll>;
#define SORT(v) std::sort(v.begin(), v.end())

int extgcd(int a, int b, int &x, int &y) {
    if (b == 0) {
        x = 1;
        y = 0;
        return a;
    }
    int d = extgcd(b, a%b, y, x);
    y -= a / b * x;
    return d;
}
int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int a,b;
    cin >> a >> b;
    int x, y;
    extgcd(a, b, x, y);
    cout << x << " " << y << endl;
    return 0;
}



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

typedef long long ll;
const int INF = 1e9;
const ll MOD = 1e9 + 7;
const ll LINF = 1e18;
#define y0 y3487465
#define y1 y8687969
#define j0 j1347829
#define j1 j234892
#define next asdnext
#define prev asdprev
#define PB push_back //vectorヘの挿入
#define MP make_pair //pairのコンストラクタ
#define F first //pairの一つ目の要素
#define S second //pairの二つ目の要素
#define dump(x)  cout << #x << " = " << (x) << endl;	//debug
#define SZ(x) ((ll)(x).size())
#define FOR(i, a, b) for (ll i = (a); i <= (b); i++)
#define RFOR(i, a, b) for (ll i = (a); i >= (b); i--)
#define ps(s) cout << #s << endl;
#define pv(v) cout << (v) << endl;
#define pvd(v) cout << setprecision(16) << (v) << endl;
#define ALL(a)  (a).begin(),(a).end()
#define RANGE(a, l, r)  (a).begin()+(l),(a).begin()+(r)

const int mod = 1000000007;
class mint {
public:
	long long x;
	mint(long long x = 0) : x((x%mod + mod) % mod) {}
	mint operator-() const {
		return mint(-x);
	}
	mint& operator+=(const mint& a) {
		if ((x += a.x) >= mod) x -= mod;
		return *this;
	}
	mint& operator-=(const mint& a) {
		if ((x += mod - a.x) >= mod) x -= mod;
		return *this;
	}
	mint& operator*=(const  mint& a) {
		(x *= a.x) %= mod;
		return *this;
	}
	mint operator+(const mint& a) const {
		mint res(*this);
		return res += a;
	}
	mint operator-(const mint& a) const {
		mint res(*this);
		return res -= a;
	}
	mint operator*(const mint& a) const {
		mint res(*this);
		return res *= a;
	}
	mint pow(ll t) const {
		if (!t) return 1;
		mint a = pow(t >> 1);
		a *= a;
		if (t & 1) a *= *this;
		return a;
	}
	// for prime mod
	mint inv() const {
		return pow(mod - 2);
	}
	mint& operator/=(const mint& a) {
		return (*this) *= a.inv();
	}
	mint operator/(const mint& a) const {
		mint res(*this);
		return res /= a;
	}

	friend ostream& operator<<(ostream& os, const mint& m) {
		os << m.x;
		return os;
	}
};


int main() {
	ll x, y;
	cin >> x >> y;
	ll a = 0, b = 0;
	if (x > y) {
		b += x - y;
		x -= 2 * b;
		y -= b;
	}
	else if (x < y) {
		a += y - x;
		x -= a;
		y -= 2 * a;
	}

	if (x < 0 || x%3!=0) {
		ps(0);
		return(0);
	}
	a += x / 3;
	b += x / 3;
	mint A = mint(a);
	mint B = mint(b);
	mint bunbo = mint(1);
	mint bunshi= mint(1);
	FOR(i, 0, a-1) {
		bunshi *= (A+B-mint(i));
		bunbo *= (A - mint(i));
	}
	mint res = bunshi / bunbo;
	pv(res)
	return(0);
}

Measured memory_bytes: 256
#include <iostream>
#include <cstring>
#include <cmath>
#include <vector>
#include <algorithm>
#include <stdio.h>
#include <math.h>
#include <stdlib.h>
#include <set>
#include <map>
#include <iterator>
#include <stack>
#include <string.h>
#include <cstdlib>
#include <queue>
#include <list>
#include <string>

using namespace std;

int yakusu(int n)
{
    int ans = 0;
    for (int i = 1;i <= n;i++){
        if (n%i == 0){
            ans++;
        }
    }
    return ans;
}

int main()
{
    int n;
    int ans = 0;
    cin >> n;
    for (int i = 1;i <= n;i+=2){
        if (yakusu(i) == 8){
            ans++;
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <stdio.h>
#include <cmath>
#include <algorithm>
#include <climits>
#include <vector>
#include <iomanip>
#include <string>
#include <queue>
#include <numeric>
#include <functional>
#include <array>
#include <map>
using namespace std;

long long mod = 1000000007;

//繰り返し二乗法
long long CalcPow(long long num, long long power) {
	if (power == 0)return 1;
	if (power % 2 == 0) {
		long long half = CalcPow(num, power / 2);
		return (half * half) % mod;
	}
	else return (num * CalcPow(num, power - 1)) % mod;
}

//コンビネーション
long long CalcCombination(long long all,long long select) {
	long long bunbo=1;
	long long bunshi=1;
	for (int i = 0; i < select;++i) {
		bunbo = (bunbo*(all - i)) % mod;
		bunshi = (bunshi*(i + 1)) % mod;
	}
	return (bunbo*CalcPow(bunshi,mod-2))%mod;
}

int main() {
	int N; long long M;
	cin >> N >> M;

	long long ans = 1;

	long long m = M;
	for (long long i = 2; i * i <= m;++i) {
		long long count = 0;
		while (m%i == 0) {
			m /= i;
			count++;
		}
		if (0 < count) ans = (ans * CalcCombination(count + (N - 1), N - 1)) % mod;
	}
	if(m != 1)ans = (ans * CalcCombination(1 + (N - 1), N - 1)) % mod;
	cout << ans << endl;
}


Measured memory_bytes: 384
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int a =sc.nextInt();
		int b =sc.nextInt();
		int c= 0;
		//aとbを合成してcを確定
		if(b == 100){
			c = a*1000 +b;
		}
		else if(b>=10){
			c = a*100+b;
		}
		else {
			c =a*10+b;
		}
		//cの平方根を１未満になるまでディクリメントして０になっているか判定する。
		double d= Math.sqrt(c);
		while(d>=1) {
			d = d-1;
		}
		if(d==0.0) {
			System.out.println("Yes");
		}else {
			System.out.println("No");
		}
	}
}


Measured memory_bytes: 21844
#include <bits/stdc++.h>
using namespace std;
#define vsort(vec) sort(vec.begin(), vec.end())
#define vreverse(vec) reverse(vec.begin(), vec.end())
using ll =long long;
const ll INF =1001001001;

//最大公約数
ll gcd(ll a, ll b){
   if (a%b==0){
       return(b);
   }else{
       return(gcd(b,a%b));
   }
}
//最小公倍数
ll lcm(ll a, ll b){
   return a*b/gcd(a,b);
}

//素数判定
ll isprime(ll n){
  bool prime=true;
  for(int i=2;i<n;i++){
    if(n%i==0){
      prime=false; break;
    }
  }
if(prime){cout<<n<<" is prime"<<endl;
         }else{cout<<n<<" is not prime"<<endl;}

}
//階乗　20くらいが限界
ll factorial(ll n){
  ll a=1;ll b=n;
  for(int i=0;i<n;i++){
    a*=b;
    b--;
  }
  return a;
}

//組み合わせ　nCr
ll comb(ll a,ll b){
  ll c;
  c=factorial(a)/(factorial(a-b)*factorial(b));
  return c; 
}




/*10億7。　　　100000007
2*2行列 H*W
vector<vector<int>> vec(H,vector<int>(W));
for(int i=0;i<H;i++){
for(int j=0;j<W;j++){
cin>>vec[i][j];
  }
}

文字列→数列
string S;int A=atoi(S.c_str());
数列→文字列
int A;string S=to_string(A);
数字判定　isdigit(a)
pair宣言　pair<int,int> p(5,7);
ソート　sort(vec.begin(),vec.end());
*/

int main(){
cout<<fixed<<setprecision(10);

int A,B;
  char op;
  cin>>A>>op>>B;
  if(op=='+'){
    cout<<A+B<<endl;
  }else{
    cout<<A-B<<endl;
  }

  

}




Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>

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

using namespace std;
typedef long long ll;


void solve(long long r){
  printf("%lld\n", 3 * r * r);
}

int main(){
  long long r;
  scanf("%lld",&r);
  solve(r);
  return 0;
}


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

#define int long long int
#define ff first
#define ss second
#define pb push_back


int bexp(int a, int b, int mod)
{
    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;
    return gcd(b, a % b);
}

#define N 100010
#define MOD 1000000007

struct comp {
    bool operator() (const pair<int, int> a, const pair<int, int> b) const
    {
        return a.ss > b.ss;
    }
};

int32_t main()
{
    ios::sync_with_stdio(false);
    cin.tie(NULL);
    cout.precision(10);

    int n;
    cin >> n;
    int a[n][3];

    for (int i = 0; i < n; ++i)
    {
        for (int j = 0; j < 3; ++j)
            cin >> a[i][j];
    }

    int dp[n][3] = {};
    dp[0][0] = a[0][0];
    dp[0][1] = a[0][1];
    dp[0][2] = a[0][2];

    for (int i = 1; i < n; ++i)
    {
        for (int j = 0; j < 3; ++j)
        {
            dp[i][j] = a[i][j] + max(dp[i - 1][(j + 1) % 3], dp[i - 1][(j + 2) % 3] );
        }
    }

    cout << *max_element(dp[n - 1], dp[n - 1] + 3);
    return 0;
}

Measured memory_bytes: 8284
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
const ll MOD=(ll)1e9+7;
const ll INF=(ll)1e18+10;
const double PI=acos(-1);

template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }
int dy[]={-1,1,0,0};
int dx[]={0,0,-1,1};

int main() {
    int L; cin>>L;
    int a=pow(L,3);
    double ans=(double)a/27.0;
    printf("%.10f\n",ans);

    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

#define N 100

int main( void )
{
    int n, i, j, u, k, v;
    int table[N*N] = {0};
    scanf( "%d", &n );

    for( i=0; i<n; ++i ) {
        scanf( "%d %d", &u, &k );
        for( j=0; j<k; ++j ) {
            scanf("%d", &v);
            table[((u-1)*N)+(v-1)] = 1;
        }
    }

    for( i=0; i<n; ++i ) {
        for( j=0; j<n; ++j ) {
            if ( j>0 )
                printf(" ");
            printf("%d", table[i*N+j]);
        }
        printf("\n");
    }

    return 0;
}

Measured memory_bytes: 648
(function() {
  var a, b;

  a = [1, 2, 3, 4, 5, 6, 7, 8, 9];

  b = a;

  a.forEach(function(n) {
    return b.forEach(function(m) {
      return console.log(n + "x" + m + "=" + (n * m));
    });
  });

}).call(this);

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

int main() {
  vector<int> v(3);
  cin >> v[0] >> v[1] >> v[2];
  sort(v.begin(), v.end());
  if(v[0] == v[1]) {
    cout << v[2] << "\n";
  } else {
    cout << v[0] << "\n";
  }
}

Measured memory_bytes: 3620
#include <iostream>
#include <math.h>
#include <vector>

typedef long long ll;

#define FOR(i,a,b) for(ll i = (a);i < (b);++i)
#define REP(i,n) FOR(i,0,n)

#define debug(x) cout << #x << "=" << x << endl;

using namespace std;

int main(void){

    string str;
    int N;
    cin >> N;
    cin >> str;

    vector< pair <int,int>> a(N);

    a[0].first = 0;
    a[N-1].second = 0;

    int wcnt = 0;
    int ecnt = 0;

    REP(i,N){
        if(str[i] == 'W') wcnt++;
        if(str[i] == 'E') ecnt++;
    }

    REP(i,N){
        if(i == 0){
            a[0].second = (str[0] == 'E') ? ecnt-1 : ecnt;
        }else if (i == N-1) {
            a[N-1].first = (str[N-1] == 'W') ? wcnt-1 : wcnt;
        }else {
            a[i].first  = (str[i-1] == 'W') ? (a[i-1].first+1) : a[i-1].first;
            a[i].second = (str[i] == 'E') ? (a[i-1].second-1) : (a[i-1].second);
        }
    }

    int ans = (int)1e+9;
    REP(i,N) {
        ans = min(ans, a[i].first + a[i].second);
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 3076
// Template from https://techracho.bpsinc.jp/jhonda/2019_08_05/78537

// input macro for competive-programming from https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8
#[allow(unused_macros)]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        input_inner!{$s, $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};

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

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

#[allow(unused_macros)]
macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };

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

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

    ($iter:expr, bytes) => {
        read_value!($iter, String).into_bytes()
    };

    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}

fn main() {
    use std::io::Read;
    let mut s = String::new();
    std::io::stdin().read_to_string(&mut s).unwrap();

    println!("{}", solve(&s));
}

macro_rules! test {
    ($($exp_input:expr => $output:expr),* $(,)*) => {
        #[test]
        fn solve_test() {
            $(
                let start = std::time::Instant::now();
                let input = solve($exp_input);
                let end = start.elapsed();
                assert_eq!(input, $output, "{}.{:03}", end.as_secs(), end.subsec_millis());
                assert!(end.as_secs() <= 2, "expected_sec: {}sec, actual_sec: {}sec", 2, end.as_secs());
                assert!(end.as_secs() <= 1, "expected_sec: {}sec, actual_sec: {}sec", 1, end.as_secs());
                assert!(end.subsec_millis() <= 10, "expected_ms: {}ms, actual_ms: {}ms", 10, end.subsec_millis());
                assert!(end.subsec_millis() <= 2, "expected_ms: {}ms, actual_ms: {}ms", 2, end.subsec_millis());
            )*
        }
    };
}

test! {
r#"2 3"# => r#"6"#,
}

fn lcm(a: usize, b: usize) -> usize {
    let z = a * b;

    let (mut x, mut y) = if a < b { (b, a) } else { (a, b) };

    let mut r = x % y;
    while r != 0 {
        x = y;
        y = r;
        r = x % y;
    }

    z / y
}

fn solve(src: &str) -> String {
    let mut src_iter = src.split_whitespace();
    input! {
        source = src_iter,
        a: usize,
        b: usize,
    }
    lcm(a, b).to_string()
}

Measured memory_bytes: 4352
L,R = gets.split.map(&:to_i)

min = 2019
done = false
(L...R).each do |i|
  (i+1..R).each do |j|
    mod = (i * j) % 2019
    min = mod if mod < min
    if mod == 0
      done = true
      break
    end
  end
  break if done
end

puts min

Measured memory_bytes: 1788
#include <bits/stdc++.h>
typedef long long int ll;
typedef long double ld;
using namespace std;
const long long int INF = 1e18;
const long long int mod = 1e9+7;

typedef pair<ll, ll> pairs;
typedef vector<pairs> p;

struct edge{
    ll to, cost;
};


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

ll lcm(ll a, ll b){
    return a / gcd(a, b) * b;
}

ll keta(ll N){
    int tmp{};
    while( N > 0 ){
        tmp += ( N % 10 );
        N /= 10;
    }
    N = tmp;
    return N;
}

// 回文
bool kai(string S){
    bool flag = true;
    for(ll i=0;i<S.size()/2;++i){
        if(S[i] != S[S.size()-i-1]){
            flag = false;
            break;
        }
    }
    return flag;
}
// ---------------------------------------------

int main(){
    ll n;
    cin>>n;
    vector<ll> a(n);
    ll sum = 0;
    map<ll, ll> ma;
    for(ll i=0;i<n;++i){
        cin>>a[i];
        sum += a[i];
        ma[a[i]]++;
    }
    ll q;
    cin>>q;
    vector<pair<ll, ll>> p(q);
    for(ll i=0;i<q;++i){
        ll b, c;
        cin>>b>>c;
        p[i] = make_pair(b, c);
    }

    vector<ll> ans(q);
    for(ll i=0;i<q;++i){
        ll x = p[i].first;
        ll y = p[i].second;
        if(ma[x] == 0){
            ans[i] = sum;
        }else{
            sum += (y - x) * ma[x];
            ans[i] = sum;
            ma[y] += ma[x];
            ma[x] = 0;
        }
    }

    for(ll i=0;i<q;++i){
        cout<<ans[i]<<endl;
    }
}

Measured memory_bytes: 12152
import java.util.Scanner;

public class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int bigger ;
        int a[] = new int[N];
        int i,j,k,x ;
        int count =0;
        for (x =0 ; x < N ; x++){
            a[x] = sc.nextInt();
        }
        for (i = 0; a.length > i;i++ ){
            for(j=N-1;j>=i+1;j--){
                if(a[j] <a[j-1]){
                    bigger = a[j-1];
                    a[j-1] = a[j];
                    a[j] = bigger;
                    count++;
                }
            }
        }
        for(k=0; k<N-1;k++){
            System.out.print(a[k]+ " ");
        }
        if(k == N-1){
            System.out.println(a[k]);
        }
        System.out.println(count);
    }

}

Measured memory_bytes: 26348
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <array>
#include <tuple>
#include <random>

using namespace std;
typedef long long int ll;

#define _overload3(_1, _2, _3, name, ...) name
#define _rep(i, n) repi(i, 0, n)
#define repi(i, a, b) for(int i = int(a); i < int(b); i++)
#define rep(...) _overload3(__VA_ARGS__, repi, _rep,)(__VA_ARGS__)
#define all(x) (x).begin(), (x).end()

#define inf 10000000000

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

    ll a, b;
    cin >> a >> b;
    cout << (a - 1) * (b - 1) << endl;
}

Measured memory_bytes: 256
rangeNum = input().split()
ansNum = []

# a*c, a*d
ansNum.append(int(rangeNum[0])*int(rangeNum[2]))
ansNum.append(int(rangeNum[0])*int(rangeNum[3]))

# b*c b*d
ansNum.append(int(rangeNum[1])*int(rangeNum[2]))
ansNum.append(int(rangeNum[1])*int(rangeNum[3]))

print(max(ansNum))

Measured memory_bytes: 9196
#include <iostream>
#include <vector>
#include <array>
#include <list>
#include <queue>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <string>
#include <sstream>
#include <algorithm>
#include <random>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <cmath>
#include <cassert>
#include <climits>
#include <bitset>
#include <functional>
#include <iomanip>

#define FOR_LT(i, beg, end) for (int i = beg; i < end; i++)
#define FOR_LE(i, beg, end) for (int i = beg; i <= end; i++)
#define FOR_DW(i, beg, end) for (int i = beg; end <= i; i--)

using namespace std;

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

	int n; cin >> n;

	int s = 1;
	int ans = 0;
	FOR_LT(i, 0, n) {
		int a; cin >> a;
		if (s != a) ans++;
		else s++;
	}
	if (s == 1) {
		cout << -1 << endl;
	}
	else {
		cout << ans << endl;
	}

	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(void){
    long int N,K,t;
    
    scanf("%ld%ld",&N,&K);
    t=N%K;
    if (t<(K-t)) {
        printf("%ld\n",t);
    }
    else{
        printf("%ld\n",(K-t));
    }
    return 0;
}


Measured memory_bytes: 128
#include<iostream>
#include<algorithm>
#include<string>
#include<cmath>
#include<vector>
#include<queue>
#include<functional>
#include<map>
using namespace std;
#pragma warning(disable: 4996)
int n, m, a[10000], b[10000], col[10000], cnt, ret; vector<int>x[100];
void dfs(int pos) {
	if (col[pos] >= 1)return;
	col[pos] = cnt;
	for (int j = 0; j < x[pos].size(); j++)dfs(x[pos][j]);
}
int main() {
	cin >> n >> m;
	for (int i = 0; i < m; i++)cin >> a[i] >> b[i];
	for (int i = 0; i < m; i++) {
		for (int j = 0; j <= n; j++) { x[j].clear(); col[j] = 0; }
		for (int j = 0; j < m; j++) { if (i != j) { x[a[j]].push_back(b[j]); x[b[j]].push_back(a[j]); } }
		cnt = 0;
		for (int j = 1; j <= n; j++) { if (col[j] >= 1)continue; cnt++; dfs(j); }
		if (cnt >= 2)ret++;
	}
	cout << ret << endl;
	return 0;
}

Measured memory_bytes: 256