akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define fi first
#define se second
#define pb(x) push_back(x)
#define mp make_pair
#define sz(x) ((int)(x).size())
#define endl "\n"
#define fastio ios_base::sync_with_stdio(false); cin.tie(nullptr);
#define all(x) x.begin(),x.end()
#define y1 omg
#define INF 1000000010
#define FOR(x, n) for(int x=0; x<n; x++)
#define ini(x, n) memset(x, n, sizeof(x));
#define MOD ((int)1e9 + 7)
#define atoi(x) ((x)-'0')
using namespace std;
typedef long long ll;
typedef pair<int, int> ii;
typedef pair<int, ii> iii;
typedef vector<int> vi;
typedef vector<ii> vii;
typedef vector<vi> vvi;

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

int ans;
string a, b;

int main() {
	fastio;
	cin >> a >> b;
	FOR(i, sz(a)) {
		if (a[i] != b[i]) ans++;
	}
	cout << ans;
}

Measured memory_bytes: 3772
#include <iostream>
#include <string>
#include <vector>
#include <cstdlib>
#include <algorithm>
#include <cmath>
using namespace std;
using std::swap;

int main()
{	
	int x, y;
	string s;
	cin >> s;
	x = std::stoi(s.substr(0, 2));
	y = std::stoi(s.substr(2, 2));
	if (x > 0 && x <= 12 && y > 0 && y <= 12)cout << "AMBIGUOUS" << "\n";
	else if (x >= 0 && y > 0 && y <= 12)cout << "YYMM" << "\n";
	else if (y >= 0 && x > 0 && x <= 12)cout << "MMYY" << "\n";
	else cout << "NA" << "\n";
	return 0;
}

Measured memory_bytes: 256
s=input()
s=s[::-1]
while True:
    if s[0:5]=="maerd":
        s=s[5:]
    elif s[0:7]=="remaerd":
        s=s[7:]
    elif s[0:5]=="esare":
        s=s[5:]
    elif s[0:6]=="resare":
        s=s[6:]
    else:
        break
if s=="":
    print("YES")
else:
    print("NO")

Measured memory_bytes: 3188
import itertools
xx = int(input())

N = []
for i in range(xx):
    N.append(i+1)
    
X = [tuple(map(int,input().split())) for i in range(2)]

l = list(itertools.permutations(N,xx))
print(abs((l.index(X[1])+1) - (l.index(X[0])+1)) )

Measured memory_bytes: 8052
#include <iostream>
#include <stdio.h>
#include <string>
#include <vector>
#include <algorithm>
#include <utility>
#include <map>
#include <set>
#include <math.h>
#include <queue>
#define rep(i,n) for (int i = 0; i < (n); ++i)
typedef long long ll;
using namespace std;

int main() {
    int k;
    cin >> k;
    rep(i,k) cout << "ACL";
    cout << endl;
}

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

#define REP( i, n )     for( int (i) = 0; (i) < (n); (i)++ )
#define ALL( a )        (a).begin(), (a).end()

using namespace std;
using ll = long long;
using P = pair<int, int>;

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; }

const int INF = 1e9 + 1;
const ll LINF = 1e18;
const int MOD = 1e9 + 7;

int main(){
    int N; cin >> N;
    string s, t; cin >> s >> t;
    REP( i, N ){
        cout << s[i] << t[i];
    }
    cout << endl;
}

/*

*/

Measured memory_bytes: 256
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <cctype>
#include <string>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <algorithm>
#include <functional>
#include <iomanip>
using namespace std;

string to_string(string s) {
  return '"' + s + '"';
}

string to_string(const char* s) {
  return to_string((string) s);
}

string to_string(bool b) {
  return (b ? "true" : "false");
}

template <typename A, typename B>
string to_string(pair<A, B> p) {
  return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";
}

template <typename A>
string to_string(A v) {
  bool first = true;
  string res = "{";
  for (const auto &x : v) {
    if (!first) {
      res += ", ";
    }
    first = false;
    res += to_string(x);
  }
  res += "}";
  return res;
}

void debug_out() { cerr << endl; }

template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cerr << " " << to_string(H);
  debug_out(T...);
}

#ifndef ONLINE_JUDGE
#define show(...) cerr << "[" << #__VA_ARGS__ << "] :", debug_out(__VA_ARGS__)
#else
#define show(...) 42
#endif


#define f first
#define s second
#define endl "\n"
#define pb push_back
#define  oo 0x3f3f3f3f
#define limit 1000000007
#define two pair<int,int>
#define int long long int
#define mod(x,m) ((x%m+m)%m)
#define all(v) v.begin(),v.end()
#define max3(x,y,z) max(x,max(y,z))
#define min3(x,y,z) min(x,min(y,z))
#define fori(x,n) for(int i = x; i < n; i++)
#define forj(y,m) for(int j = y; j < m; j++)
#define fork(z,p) for(int k = z; k < p; k++)
#define fastio std::ios::sync_with_stdio(false)
#define watch(x) cout << (#x) << " is " << (x) << "\n"
#define input_from_file  freopen("input.txt", "r", stdin);

int dp[3005][7005];

signed main(){
  //input_from_file;
  memset(dp,0,sizeof dp);
  int n,t; cin>>n>>t;
  vector<two> p(n);
  for(int i=0;i<n;i++) cin>>p[i].f>>p[i].s;
  sort(all(p));
  vector<int> w(n+1);
  vector<int> val(n+1);
  fori(1,n+1) w[i] = p[i-1].f, val[i] = p[i-1].s;
  int ans = 0;
  for(int i=1;i<=n;i++)
  for(int j=1;j<=6000;j++){
    dp[i][j] = dp[i-1][j];
    if(j-w[i] >= 0 && j-w[i] < t) dp[i][j] = max(dp[i][j],dp[i-1][j-w[i]]+val[i]);
    ans = max(dp[i][j],ans);
  }
  cout<<ans<<endl;
}


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

int A,B,C;
int X,Y;

int main() {

  ios_base::sync_with_stdio(false);
  cin.tie(0); cout.tie(0);

  cin >> A >> B >> C;
  cin >> X >> Y;

  int AB = A + B;
  int C2 = 2 * C;

  ll pay = 0;
  int curMin = min(X,Y);
  
  // buy as many AB pizzas as possible
  if (C2 < AB) {
    pay += (C2 * curMin);
    X -= curMin;
    Y -= curMin;
  }

  if (C2 < A) pay += (C2 * X);
  else pay += (A * X);

  if (C2 < B) pay += (C2 * Y);
  else pay += (B * Y);

  cout << pay << endl;
  return 0;
}


Measured memory_bytes: 256
<?php

fscanf(STDIN, "%d %d", $n, $m);
$X = [];
$Y = [];
for ($i = 0; $i < $m; ++$i) {
    fscanf(STDIN, "%d %d", $p, $y);
    $X[] = [$p, $y];
    $Y[$p][] = $y;
}

foreach ($Y as $key => $arr) {
    sort($arr);
    $Y[$key] = $arr;
}

for ($i = 0; $i < $m; ++$i) {
    $p = $X[$i][0];
    $y = $X[$i][1];

    // この配列を2分探索して順位を求める。
    $ty = $Y[$p];

    $l = 0;
    $r = count($ty);
    while ($r - $l >= 1) {
        $mid = intdiv($l + $r, 2);
        if ($ty[$mid] >= $y) {
            $r = $mid;
        } else {
            $l = $mid + 1;
        }
    }

    echo sprintf("%06d%06d\n", $p, $r + 1);
}


Measured memory_bytes: 127860
using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Numerics;
using System.Text;
using System.Threading.Tasks;
 
namespace AtCorder
{
	public class Program
	{
		static void Main(string[] args)
		{
			string s = Console.ReadLine();
			int n = s.Length;

			long ans = 0;
			long aCount = 0;
			long bcCount = 0;
			char last = 'D';
			for (int i = 0; i < n; i++) {
				if (s[i] == 'A') {
					if (bcCount > 0) {
						ans += aCount * bcCount;
						bcCount = 0;
						if (last == 'B') {
							aCount = 0;
						}
					} else if (last != 'A') {
						aCount = 0;
					}

					++aCount;
				} else if (s[i] == 'B') {
					if (aCount > 0) {
						if (last == 'A' || last == 'C') {
						} else {
							ans += aCount * bcCount;
							if (i == n - 1 || s[i + 1] != 'A') {
								aCount = 0;
							}

							bcCount = 0;
						}
					}
				} else {
					if (aCount > 0) {
						if (last == 'B') {
							++bcCount;
						} else {
							ans += aCount * bcCount;
							if (last == 'A' || i == n - 1 || s[i + 1] != 'A') {
								aCount = 0;
							}

							bcCount = 0;
						}
					}
				}

				last = s[i];
			}

			ans += aCount * bcCount;

			Console.WriteLine(ans);
		}
	}
}

Measured memory_bytes: 13240
#include <iostream>
#include <vector>
#include <cstdlib>
int gcd(int x, int y){
  if(x < y) std::swap(x, y);
  while(x % y != 0){
    int t = x % y;
    x = y;
    y = t;
  }
  return y;
}
int main(){
  int N, X;
  std::cin >> N >> X;
  std::vector<int> x(N);
  for(int i = 0; i < N; i++) {
    std::cin >> x[i];
    x[i] = std::abs(x[i] - X);
  }
  int g = x[0];
  for(int i = 0; i < N; i++) g = gcd(g, x[i]);
  std::cout << g << std::endl;
}
  

Measured memory_bytes: 640
fun main(args: Array<String>) {
    val cards = listOf("S", "H", "C", "D").flatMap { s -> (1..13).map { i -> "$s $i" } }
    val n = readLine()!!.toInt()
    val taros = (1..n).map { readLine()!!.split(" ").joinToString(" ") }
    cards.subtract(taros).forEach(::println)
}


Measured memory_bytes: 32160
#include<cstdio>
#include<cstring>
#include<algorithm>
#define ll long long
#define N 100005
#define inf (1ll<<60)
#define rep(i,j,k) for (ll i=j;i<=k;++i)
#define per(i,j,k) for (ll i=j;i>=k;--i)
using namespace std;
inline ll read(){
	char ch=getchar(); ll x=0,f=1;
	while (ch<'0'||ch>'9') { if (ch=='-') f=-1; ch=getchar(); }
	while (ch>='0'&&ch<='9') { x=x*10+ch-'0'; ch=getchar(); }
	return x*f;
}
ll n,ans,sum[N],a[N],b[N],c[N];
int main(){
	n=read();
	rep(i,1,n) a[i]=read();
	rep(i,1,n) b[i]=read();
	rep(i,1,n) c[i]=read();
	sort(a+1,a+1+n);
	sort(b+1,b+1+n);
	sort(c+1,c+1+n);
	rep(i,1,n){
		ll pos=upper_bound(c+1,c+1+n,b[i])-c;
		if (pos<=n) sum[i]=n-pos+1;
	}
	per(i,n,1) sum[i]+=sum[i+1];
	rep(i,1,n){
		ll pos=upper_bound(b+1,b+1+n,a[i])-b;
		if (pos<=n) ans+=sum[pos];
	}
	printf("%lld",ans);
}

Measured memory_bytes: 3328
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i,n) for(int (i)=0;(i)<(int)(n);++(i))
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define fi first
#define se second
#define dbg(x) cout<<#x" = "<<((x))<<endl
template<class T,class U> ostream& operator<<(ostream& o, const pair<T,U> &p){o<<"("<<p.fi<<","<<p.se<<")";return o;}
template<class T> ostream& operator<<(ostream& o, const vector<T> &v){o<<"[";for(T t:v){o<<t<<",";}o<<"]";return o;}

/* 基本要素 */
typedef complex<double> Point;
typedef pair<Point, Point> Line;
typedef vector<Point> VP;
const double PI = acos(-1);
const double EPS = 1e-7; // 許容誤差^2
const double INF = 1e9;
#define X real()
#define Y imag()
#define LE(n,m) ((n) - (m) < EPS)
#define GE(n,m) (EPS > (m) - (n))
#define EQ(n,m) (abs((n)-(m)) < EPS)

// 点集合を含む最小の円の中心
Point minEnclosingCircle(const VP& ps) {
  Point c;
  double move = 0.5;
  rep(i,25) {  // 2^(-39-1) \approx 0.9e-12
    rep(t,40) {
      double max = 0;
      int k = 0;
      rep (j, ps.size()) if (max < norm(ps[j]-c)) {
        max = norm(ps[j]-c);
        k = j;
      }
      c += (ps[k]-c) * move;
    }
    move /= 2;
  }
  return c;
}

bool check(vector<double> &a, vector<double> &b){
    int A = a.size(), B = b.size();
    sort(all(a));
    sort(all(b));

    int j = 0;
    rep(i,A){
        while(j<B){
            if(LE(a[i],b[j])) break;
            ++j;
        }
        if(j==B) return false;
        ++j;
    }
    return true;
}


int main(){
    int n,m;
    scanf(" %d %d", &n, &m);

    vector<int> r(n);
    rep(i,n) scanf(" %d", &r[i]);

    vector<double> pr(m);
    rep(i,m){
        int p;
        scanf(" %d", &p);

        VP poly;
        rep(j,p){
            int x,y;
            scanf(" %d %d", &x, &y);
            poly.pb(Point(x,y));
        }

        Point c = minEnclosingCircle(poly);
        rep(j,p) pr[i] = max(pr[i], abs(c-poly[j]));
    }

    vector<bool> used(n);
    vector<int> ans(m,-1);

    rep(i,m){
        rep(j,n){
            if(used[j] || pr[i]>r[j]+EPS) continue;

            vector<double> a,b;
            for(int k=i+1; k<m; ++k) a.pb(pr[k]);
            rep(k,n)if(!used[k] && k!=j) b.pb(r[k]);

            if(check(a,b)){
                used[j] = true;
                ans[i] = j;
                break;
            }
        }

        if(ans[i]==-1){
            printf("NG\n");
            return 0;
        }
    }

    rep(i,m) printf("%d\n", ans[i]+1);
    return 0;
}



Measured memory_bytes: 3348
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <map>
#include <queue>
#include <cstdio>
#include <string.h>
#define rep(i,n) for (int i = 0; i < (int)n; i++)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pi;
typedef pair<pi, pi> pp;
typedef pair<ll, ll> pl;
double PI = 3.1415926535897932;
const double EPS = 1e-9;
const ll MOD = 1000000007;
const int inf = 1 << 30;
const ll linf = 1LL << 60;

int h, w, n;
int x, y;
string s, t;

int main() {
    cin >> h >> w >> n;
    cin >> x >> y;
    cin >> s >> t;
    int up = 0, right = w+1, down = h+1, left = 0;
    for (int i = n-1; i >= 0; i--) {
        if (t[i] == 'L') right = min(w+1, right+1);
        if (t[i] == 'R') left = max(0, left-1);
        if (t[i] == 'U') down = min(h+1, down+1);
        if (t[i] == 'D') up = max(0, up-1);

        if (s[i] == 'L') left = left+1;
        if (s[i] == 'R') right = right-1;
        if (s[i] == 'U') up = up+1;
        if (s[i] == 'D') down = down-1;


        if (down-up <= 1 || right-left <= 1) {
            cout << "NO" << endl;
            return 0;
        }
    }
    if (up >= x || x >= down || left >= y || y >= right) cout << "NO" << endl;
    else cout << "YES" << endl;
}

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

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
#define rep(i, n) for (int i = 0; i < n; i++)

int main() {
  ll A, B;
  cin >> A >> B;

  if (A % 2 == 1) {
    ll temp = (B - A) % 4;
    ll result = A;
    for (ll i = B - temp + 1; i < B + 1; i++) {
      result = (result ^ i);
    }
    cout << result << endl;
  } else {
    ll temp = (B - A + 1) % 4;
    ll result = 0;
    for (ll i = B - temp + 1; i < B + 1; i++) {
      result = (result ^ i);
    }
    cout << result << endl;
  }

  return 0;
}


Measured memory_bytes: 256
local mfl, mce, msq = math.floor, math.ceil, math.sqrt
local n = io.read("*n")

local function getprimes(x)
  local primes = {}
  local allnums = {}
  for i = 1, x do allnums[i] = true end
  for i = 2, x do
    if(allnums[i]) then
      table.insert(primes, i)
      local lim = mfl(x / i)
      for j = 2, lim do
        allnums[j * i] = false
      end
    end
  end
  return primes
end

local primes = getprimes(47)
local t = {}
for i = 1, 47 do
  t[i] = 0
end
for i = 1, #primes do
  local p = primes[i]
  local ctot = 0
  local c = mfl(n / p)
  while 0 < c do
    ctot = ctot + c
    c = mfl(c / p)
  end
  t[p] = ctot
end

local ov74, ov24, ov14, ov4, ov2 = 0, 0, 0, 0, 0
for i = 1, 47 do
  if 74 <= t[i] then ov74 = ov74 + 1 end
  if 24 <= t[i] then ov24 = ov24 + 1 end
  if 14 <= t[i] then ov14 = ov14 + 1 end
  if 4 <= t[i] then ov4 = ov4 + 1 end
  if 2 <= t[i] then ov2 = ov2 + 1 end
end
local ret = ov74 + ov24 * (ov2 - 1) + ov14 * (ov4 - 1) + mfl(ov4 * (ov4 - 1) / 2) * (ov2 - 2)
print(ret)


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

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

	vector<int> d(N);
	for (int i=0; i<N; i++){
		cin >> d.at(i);
	}

	int res;

	// 昇順ソート
	sort(d.begin(), d.end());

	res = d.at(N/2) - d.at(N/2-1);
	
	cout << res << endl;
	return 0;
}

Measured memory_bytes: 640
N = int(input())
A = [int(input()) for _ in range(N)]

# 最大値が２個以上あれば最大値を出力する
# 最大値が１個しか無ければ、最大値のアドレスでは２番めの値を出力する

max_value = max(A)
max_count = A.count(max_value)
max_address = A.index(max_value)

if max_count >= 2:
    for _ in range(N):
        print(max_value)
else:
    for i in range(N):
        if i == max_address:
            A.pop(max_address)
            print(max(A))
        else:
            print(max_value)


Measured memory_bytes: 12512
#参考 ： AtCoder # 14682107
s = input()
len = len(s)

if len == 1:
    print(0)
    exit()

even = s[::2]
odd = s[1::2]

#偶数番目に0が並ぶと仮定したときの異物の数
# 0101...
odd_zero = odd.count("0")
even_one = even.count("1")


#奇数番目に0が並ぶと仮定したときの異物の数
# 1010...
odd_one = odd.count("1")
even_zero = even.count("0")

print(min(odd_zero + even_one, odd_one + even_zero))

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

int main(void){
    ll n, x; cin >> n >> x;
    vector<ll> A(n);
    for(int i=0; i<n; i++) cin >> A[i];

    sort(A.begin(), A.end());
    ll rest = x;
    int ans = 0;
    for(int i=0; i<n; i++){
        if(i != (n-1)){
            if(A[i] <= rest){
                rest -= A[i];
                ans++;
            }
        }
        else{
            if(A[i] == rest) ans++;
        }
    }

    cout << ans << endl;
}


Measured memory_bytes: 256
tmp = list(map(int,input().split()))
n , a, b = tmp[0],tmp[1],tmp[2]
if a>b:
 print(0)
 quit()
if (n ==2):
  print(1)
elif (n == 1):
  if a != b:
    print(0)
  else:
    print(1)
else:
  print((b-a) * (n-2) + 1)

Measured memory_bytes: 3064
N, M = map(int, input().split())
X = [list(map(int, input().split())) for _ in range(M)]

def find(x):
    if par[x] == x:
        return x
    else:
        par[x] = find(par[x])
        return par[x]


def unite(x, y):
    x = find(x)
    y = find(y)
    if x == y:
        return
    
    if rank[x] == rank[y]:
        rank[x] += 1
    elif rank[x] < rank[y]:
        x, y = y, x
        
    par[y] = x
    size[x] += size[y]


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


par = list(range(N))
rank = [0] * N
size = [1] * N

ans = [N * (N - 1) // 2] * M
for i, (a, b) in enumerate(X[:0:-1]):
    if same(a - 1, b - 1):
        ans[i + 1] = ans[i]
        continue

    ans[i + 1] = ans[i] - size[find(a - 1)] * size[find(b - 1)]
    unite(a - 1, b - 1)

print(*ans[::-1], sep="\n")


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

const int MOD = 1000000007;

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define copy(from, to) copy(from.begin(), from.end(), back_inserter(to))
#define sort(a) sort(a.begin(), a.end())
#define reverse(s) reverse(s.begin(), s.end())
#define p(s) cout << (s) << endl

typedef long long ll;
using namespace std;

template<class T>
void load(vector<T> &v, int n) {
  for (int i = 0; i < n; ++i) {
    T t;
    cin >> t;
    v.push_back(t);
  }
}

template<class T>
T max(vector<T> &v) {
  return *max_element(v.begin(), v.end());
}

template<class T>
T min(vector<T> &v) {
  return *min_element(v.begin(), v.end());
}

void py(bool isUpper = false) {
  if (isUpper) {
    p("YES");
  } else {
    p("Yes");
  }
}

void pn(bool isUpper = false) {
  if (isUpper) {
    p("NO");
  } else {
    p("No");
  }
}

int main() {
  int n, m;
  cin >> n >> m;
  int a[40] = {0};

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

  int count = 0;
  for (int i = 1; i <= m; ++i) {
    if (a[i] == n) {
      count++;
    }
  }
  p(count);
}

Measured memory_bytes: 256
//Resting_Prince
#include<bits/stdc++.h>
#define ll long long int
#define ld long double
#define mod 1000000009
#define inf 1e18
#define PI 3.141592653589
#define fi first
#define se second 
#define all(v) v.begin(),v.end()
#define rep(i,a,b)    for(ll i=a;i<=b;i++)
#define repr(i,a,b) for(ll i=a;i>=b;i--)
#define pb push_back
#define mk make_pair
#define en '\n'
#define ios ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
using namespace std;
    ll dp[3010][3010]={0};
int main()
{

    string s,t;
    cin>>s>>t;
    for (int i = 0; i < s.size(); i++) {
        for (int j = 0; j < t.size(); j++) {
            if (s[i] == t[j]) dp[i+1][j+1] = max(dp[i+1][j+1], dp[i][j] + 1);
            dp[i+1][j+1] = max(dp[i+1][j+1], dp[i+1][j]);
            dp[i+1][j+1] = max(dp[i+1][j+1], dp[i][j+1]);
        }
    }
    ll m=s.size(),n=t.size();
    string z="";
    while(m>0 && n>0)
    {
        if(dp[m][n]==dp[m-1][n])m--;
        else if(dp[m][n]==dp[m][n-1])n--;
        else
        {   //cout<<"aha";
            z=s[m-1]+z;
            m--;n--;
        }
    }cout<<z;
    return 0;
}


Measured memory_bytes: 70784
#include <stdio.h>

int main(int argv, char *argc[]){
    int hex, wide, x, y;
    
    while(1){
        scanf("%d %d", &hex ,&wide);
        
        if(hex == 0 || wide == 0)break;
        
        for(y=0;y<hex;y++){
            for(x=0;x<wide;x++){
                if((!(0==y)) && (!((hex-1)==y)) &&
                    (!(0==x)) && (!((wide-1)==x))){
                    printf(".");
                    continue;
                }
                printf("#");
                 
            }
            printf("\n");
        }
        printf("\n");
        
    }
    return 0;
}

Measured memory_bytes: 572
#include <stdio.h>
 
int main(void) {
  int k,n,i,j,max;
  int a[200000];
  scanf("%d %d", &k, &n);
  for (i=0; i<n; i++) {
  	scanf("%d", &a[i]);
  }
  max = a[0]+k-a[n-1];
  for (i=0; i<n-1; i++) {
    j = a[i+1]-a[i];
    if (j>max) {
      max = j;
    }
  }
  printf("%d", k-max);
  return 0;
}

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

using namespace std;

int N,i,nr,a[10],b[10],A,B;
bool fol[10];
vector <int> t;

bool equ(int a[])
{
    for (int i=0; i<t.size(); i++)
        if (t[i]!=a[i+1]) return 0;
    return 1;
}

void check()
{
    nr++;
    if (equ(a)) A=nr;
    if (equ(b)) B=nr;
}

void back(int n)
{
    if (n>N) check(); else
    {
        for (int i=1; i<=N; i++)
        {
            if (!fol[i])
            {
                fol[i]=1;
                t.push_back(i);
                back(n+1);
                fol[i]=0;
                t.pop_back();
            }
        }
    }
}

int main()
{
    cin>>N;
    for (i=1; i<=N; i++)
        cin>>a[i];
    for (i=1; i<=N; i++)
        cin>>b[i];
    back(1);
    cout<<abs(A-B);
}


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

//struct edge {
//    int to;
//    int cost;
//};
//
//int dijkstra ( int l, int r, vector<vector<edge>> &g, int n ) {
//    vector<int> cost(n, 1e8);
//    priority_queue<pair<int, int>, vector<pair<int, int>>, greater<pair<int, int>>> que;
//    cost[l] = 0;
//    que.push(make_pair(0, l));
//    bool ok = false;
//    while(!que.empty()) {
//        pair<int, int> now = que.top();
//        cout << now.first << " " << now.second << endl;
//        que.pop();
//        int v = now.second;
//        if ( cost[v] < now.first ) continue;
//        for ( auto u : g[v] ) {
//            if ( u.cost + cost[v] < cost[u.to] ) {
//                cost[u.to] = u.cost + cost[v];
//                que.push(make_pair(cost[u.to], u.to));
//            }
//        }
//    }
//    return cost[r];
//}

//const int N = 1000002;
//int n, m;
//vector<bool> mark(N);
//vector<vector<pair<ll, ll>>> g(N);
//vector<ll> cost(N, 1e18);

void dfs ( ll v, vector<bool> &mark, vector<vector<pair<ll, ll>>> &g, vector<ll> &cost ) {
//void dfs ( ll v ) {
    mark[v] = true;
    for ( auto u : g[v] ) {
//    for ( int i = 0; i < g[v].size(); ++i ) {
        ll to = u.first;
        ll len = u.second;
//        ll to = g[v][i].first;
//        ll len = g[v][i].second;
        if ( cost[to] == 1e18 ) {
            cost[to] = cost[v] + len;
        }
        if ( cost[to] != cost[v] + len ) {
            cout << "No" << endl;
            exit(0);
        }
        if ( !mark[to] ) {
            dfs(to, mark, g, cost);
//            dfs(to);
        }
    }
}

int main(){
    int n, m;
    cin >> n >> m;
//    vector<vector<pair<ll, ll>>> g(n+1);
//    vector<bool> mark(n+1, false);
//    vector<ll> cost(n+1, 1e18);
    vector<vector<pair<ll, ll>>> g(n);
    vector<bool> mark(n, false);
    vector<ll> cost(n, 1e18);
    rep(i, m) {
        ll l, r, d;
        cin >> l >> r >> d;
        --l, --r;
        g[l].push_back({r, d});
        g[r].push_back({l, -d});
    }
    rep(i, n) {
//    for ( int i = 1; i <= n; ++i ) {
        if ( !mark[i] ) {
            cost[i] = 0LL;
            dfs(i, mark, g, cost);
//            dfs(i);
        }
    }
    cout << "Yes" << endl;
    return 0;
}


Measured memory_bytes: 18304
import sys
sys.setrecursionlimit(100000)

def ins(): return input().split()
def ii(): return int(input())
def iil(): return list(map(int,ins()))
def lin(): return list(input())
def iin(): return map(int,ins())

n = ii()
h = iil()
ans = 0
tmp = 0
for i in range(len(h)-1):
    if h[i]<h[i+1]:
        ans = max(ans,tmp)
        tmp = 0
    else:
        tmp += 1
ans = max(ans,tmp)
print(ans)

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

typedef long long ll;

int b[3003][3003];
int cnt[3003][3003];

int main() {
	int n, k; cin >> n >> k;
	int W = 2*k;
	for (int i = 0; i < n; ++i) {
		int xx, yy; char c;
		cin >> xx >> yy >> c;
		int posx = (xx + (c == 'W' ? k : 0)) % W, posy = yy % W;
		b[posx][posy] += 1;
	}
	for (int i = 0; i < W; ++i) {
		for (int j = 0; j < W; ++j) {
			int posi = (i - k + 1 + W) % W, posj = (j - k + 1 + W) % W;
			cnt[posi][posj] += b[i][j];
			cnt[posi][posj + k] -= b[i][j];
			cnt[posi + k][posj] -= b[i][j];
			cnt[posi + k][posj + k] += b[i][j];
			posi = (i + 1) % W, posj = (j + 1) % W;
			cnt[posi][posj] += b[i][j];
			cnt[posi][posj + k] -= b[i][j];
			cnt[posi + k][posj] -= b[i][j];
			cnt[posi + k][posj + k] += b[i][j];
		}
	}
	for (int i = 0; i < W + k; ++i) {
		for (int j = 1; j < W + k; ++j) {
			cnt[i][j] += cnt[i][j - 1];
		}
	}
	for (int j = 0; j < W + k; ++j) {
		for (int i = 1; i < W + k; ++i) {
			cnt[i][j] += cnt[i - 1][j];
		}
	}
	for (int i = 0; i < W + k; ++i) {
		for (int j = 0; j < W + k; ++j) {
			if (i < W && j < W) continue;
			cnt[i%W][j%W] += cnt[i][j];
		}
	}
	int ans = 0;
	for (int i = 0; i < W; ++i) {
		for (int j = 0; j < W; ++j) {
			ans = max(ans, cnt[i][j]);
		}
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 59648
from collections import deque

def MI():
    return map(int, input().split())

def LI():
    return list(map(int, input().split()))

N, M = MI()
room = [[] for _ in range(N)]

for _ in range(M):
    A, B = MI()
    room[A - 1].append(B - 1)
    room[B - 1].append(A - 1)

ans = [-1] * N
queue = deque([0])

while queue:
    u = queue.popleft()
    
    for r in room[u]:
        if ans[r] == -1:
            ans[r] = u + 1
            queue.append(r)

print("Yes")

for a in ans[1:]:
    print(a)

Measured memory_bytes: 94632
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int, int>;
const int INF = 1001001001;
const ll LINF = 1LL << 60;
const int MOD = 1000000007;

template <typename T>
void print(const T &v)
{
    for (int i = 0; i < v.size(); i++)
    {
        if (i)
            cout << ' ';
        cout << v[i];
    }
    cout << endl;
}

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 N;
string A[200010];
int p2[200010], p5[200010];
int cnt[61][31];

P f(string s)
{
    ll num = 0;
    bool flag = true;
    int root = 8;
    for (char c : s)
    {
        if (flag)
        {
            if (c != '.')
            {
                num += c - '0';
                num *= 10;
            }
            else
            {
                flag = false;
            }
        }
        else
        {
            num += c - '0';
            num *= 10;
            --root;
        }
    }
    num *= pow(10, root);
    if (num == 0)
    {
        return (make_pair(18, 18));
    }
    int p2 = 0, p5 = 0;
    while (num % 2 == 0)
    {
        ++p2;
        num /= 2;
    }
    while (num % 5 == 0)
    {
        ++p5;
        num /= 5;
    }

    return make_pair(p2, p5);
}

void solve()
{
    memset(cnt, 0, sizeof(cnt));
    for (int i = 0; i < N; i++)
    {
        auto ps = f(A[i]);
        p2[i] = ps.first;
        p5[i] = ps.second;
        ++cnt[p2[i]][p5[i]];
    }
    ll ans = 0;
    for (int i = 0; i < N; i++)
    {
        int need2 = max(18 - p2[i], 0);
        int need5 = max(18 - p5[i], 0);
        for (int j = need2; j <= 60; j++)
        {
            for (int k = need5; k <= 30; k++)
            {
                ans += cnt[j][k];
            }
        }
        // 自身の分を取り除く
        if (need2 <= p2[i] && need5 <= p5[i])
        {
            --ans;
        }
    }
    ans /= 2;
    cout << ans << endl;
    return;
}

void input()
{
    cin >> N;
    for (int i = 0; i < N; i++)
    {
        cin >> A[i];
    }
}

int main()
{
    input();
    solve();
}


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

int main() {
    string S, T;
    cin >> S >> T;

    int lenS = S.size();
    int lenT = T.size();
    int count, ans;
    for (int i = 0; i <= lenS - lenT; i++) {
        count = 0;
        for (int j = 0; j < lenT; j++) {
            if (S[i + j] != T[j]) {
                count++;
            }
        }
        if (i == 0) ans = count;
        ans = min(ans, count);
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3624
import sys, bisect, math, itertools, string, queue, copy
import numpy as np
import scipy
from collections import Counter,defaultdict,deque
from itertools import permutations, combinations
from heapq import heappop, heappush
# input = sys.stdin.readline
sys.setrecursionlimit(10**8)
mod = 10**9+7
def inp(): return int(input())
def inpm(): return map(int,input().split())
def inpl(): return list(map(int, input().split()))
def inpls(): return list(input().split())
def inplm(n): return list(int(input()) for _ in range(n))
def inplL(n): return [list(input()) for _ in range(n)]
def inplT(n): return [tuple(input()) for _ in range(n)]
def inpll(n): return [list(map(int, input().split())) for _ in range(n)]
def inplls(n): return sorted([list(map(int, input().split())) for _ in range(n)])

n = input()

sum = 0
for s in n:
    sum += int(s)

if sum % 9 == 0:
    print('Yes')
else:
    print('No')

Measured memory_bytes: 31504
import math
import sys
import bisect
input=sys.stdin.readline
#t=int(input())
t=1
for _ in range(t):
    n=int(input())
    #n,k=map(int,input().split())
    #l=list(map(int,input().split()))
    if n>=30:
        print('Yes')
    else:
        print('No')

Measured memory_bytes: 61976
using System;

class Program
{
    static void Main()
    {
        var a = int.Parse(Console.ReadLine());

        if (a % 2 == 0)
        {
            Console.WriteLine("0.5");
        }
        else
        {
            Console.WriteLine((a / 2 + 1.0) / a);
        }
    }
}


Measured memory_bytes: 11092
int main(void){
  int i,N;
  char S[100],T[100];
  
    scanf("%d",&N);
    
    for(i=0;i<N+1;i++)
    scanf("%c",&S[i]);
    
    for(i=0;i<N+1;i++)
    scanf("%c",&T[i]);
    
    for(i=0;i<N+1;i++){
        printf("%c",S[i]);
        printf("%c",T[i]);
    }
    
    printf("\n");
    return(0);
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
#define int long long
#define pb push_back
#define mp make_pair
using namespace std;
const int inf = 1e18 + 7;
const int N = 1e6 + 7;
const int md = 1e9 + 7;
void sol() {
  int f = 0;
  int m1, m2, d1, d2;
  cin >> m1 >> d1;
  cin >> m2 >> d2;
  if(m1 != m2) {
    if(d2 == 1) {
      f = 1;
    }
  }
  cout << f;
}

int32_t main() 
{
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int T = 1;
  //cin >> T; while(T--) 
  sol();
  return 0;
}


Measured memory_bytes: 256
import fractions
from functools import reduce
# Python3 program to compute LCM of 
# array elements modulo M
MAX = 10**6+1
mod = 1000000007
prime = [0 for i in range(MAX)] 
max_map = dict() 
# function to return a^n 
def power(a, n):
	if n == 0: 
		return 1
	p = power(a, n // 2) % mod
	p = (p * p) % mod
	if n & 1: 
		p = (p * a) % mod
	return p 

# function to find the smallest prime
# factors of numbers upto MAX
def sieve(): 
	prime[0], prime[1] = 1, 1
	for i in range(2, MAX): 
		if prime[i] == 0: 
			for j in range(i * 2, MAX, i): 
				if prime[j] == 0: 
					prime[j] = i 
			prime[i] = i 

# function to return the LCM modulo M 
def lcmModuloM(arr, n): 
	for i in range(n): 
		num = arr[i] 
		temp = dict() 
		# temp stores mapping of prime factors 
		# to its power for the current element 
		while num > 1:
			# factor is the smallest prime
			# factor of num
			factor = prime[num]
			# Increase count of factor in temp
			if factor in temp.keys():
				temp[factor] += 1
			else:
				temp[factor] = 1
			# Reduce num by its prime factor
			num = num // factor
		for i in temp:
			# store the higest power of every prime
			# found till now in a new map max_map
			if i in max_map.keys():
				max_map[i] = max(max_map[i], temp[i])
			else: 
				max_map[i] = temp[i]
	ans = 1
	for i in max_map:
		ans = (ans * power(i, max_map[i])) % mod
	return ans
# Driver code
sieve()
X = int(input())
A = list(map(int,input().split()))
N = max(A)
value = lcmModuloM(A, X)
ans = 0
for i in range(X):
    ans += value*pow(A[i], mod-2, mod)%mod
print(ans%mod)

Measured memory_bytes: 118248
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Console = System.Console;

namespace Atcoder
{
    class Program
    {
        static void Main(string[] args)
        {
            var N = ReadInt();
            long ret = 1;
            for (int i = 1; i <= N; i++)
            {
                ret = ret * i % 1000000007;
            }

            Console.WriteLine(ret);
        }
        private static readonly Func<string> Read = () => Console.ReadLine();
        private static readonly Func<string[]> ReadStringArray = () => Console.ReadLine().Split();
        private static readonly Func<int> ReadInt = () => int.Parse(Console.ReadLine());
        private static readonly Func<long> ReadLong = () => long.Parse(Console.ReadLine());
        private static readonly Func<int[]> ReadIntArray = () => Console.ReadLine().Split().Select(int.Parse).ToArray();
        private static readonly Func<long[]> ReadLongArray = () => Console.ReadLine().Split().Select(long.Parse).ToArray();
        private static readonly Action<string> Cw = str => Console.WriteLine(str);
    }
}

Measured memory_bytes: 11092
#include <iostream>
#include <algorithm>
#include <vector>
#include <map>
#include <set>
#include <string>
#include <cmath>
#include <iomanip>
#include <queue>
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#include <cassert>
#include <cstring>

using namespace std;

#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define REP(i, n) FOR(i, 0, n)
#define SORT(c) sort((c).begin(), (c).end())

typedef long long ll;
typedef pair<int, int> P;
typedef vector<int> V;
typedef map<int, int> M;

constexpr ll INF = 1e18;
constexpr ll MOD = 1e9 + 7;
constexpr double PI = 3.14159265358979323846;
constexpr int dx[] = {0, 0, 1, -1};
constexpr int dy[] = {1, -1, 0, 0};

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

    int n;
    string s, t;

    cin >> n >> s >> t;

    REP(i, n)
    {
        bool ok = true;

        for (int j = i; j < n; j++)
        {
            if (s[j] != t[j - i])
                ok = false;
        }

        if (ok)
        {
            cout << n + i << endl;
            return 0;
        }
    }

    cout << 2 * n << endl;

    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<cstdio>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
#include<cassert>
using namespace std;

typedef long long  ll;

typedef unsigned long long ul;
typedef unsigned int ui;
const ll mod = 1000000007;
typedef double ld;
typedef complex<ld> Point;
const ll INF = mod * mod;
typedef pair<int, int> P;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
const ld eps = 1e-8;
const ld pi = acos(-1.0);
typedef pair<ld, ld> LDP;
typedef pair<ll, ll> LP;
typedef vector<int> vec;

ll sup = 1000000000000000000;
const int mn = 2000;
ll pas[mn][mn];
void solve() {
	rep(i, mn) {
		rep(j, mn) {
			if (i == 0 || j == 0)pas[i][j] = 1;
			else {
				pas[i][j] = (pas[i - 1][j] + pas[i][j - 1]);
			}
		}
	}
	int d = 1;
	vector<ll> v;
	for (int i = 0; i < 650;i+=d) {
		if (pas[7][i] > sup)break;
		v.push_back(pas[7][i]);
		//cout << pas[7][i] << endl;
	}
	vector<int> c(v.size(),0);
	//cout << v.size() << endl;
	ll k; cin >> k;
	int sz = 0;
	per(i, v.size()) {
		if (v[i] <= k) {
			if (sz == 0)sz = i + 1;
			int cnt = 0;
			while (k >= v[i]) {
				cnt++; k -= v[i];
			}
			c[i] = cnt;
		}
	}
	string s;
	string t = "FESTIVA";
	rep(i, sz) {
		s += t;
		rep(j, c[i])s.push_back('L');
		rep(j, d - 1)s += t;
	}
	//cout << s.size() << endl;
	cout << s << endl;
}

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	//cout << fixed << setprecision(5);
	//while (cin >> n)solve();
	solve();
	//stop
	return 0;
}

Measured memory_bytes: 31488
from collections import deque
import numpy as np
S = input()
count = []
d = deque(list(S))
ans = [0] * len(S)
now = d.popleft()
cum = 1
for i in range(len(S)-1):
    popped = d.popleft()
    if popped == now:
        cum += 1
    else:
        count.append(cum)
        now = popped
        cum = 1
count.append(cum)
LR = [count[i:i+2] for i in range(0,len(count),2)]
cs = np.array(count).cumsum()
for i in range(len(LR)):
    if sum(LR[i]) % 2 == 0:
        ans[cs[2*i]-1] = ans[cs[2*i]] = sum(LR[i]) // 2
    else:
        if LR[i][0] > LR[i][1]:
            if LR[i][0] % 2 == 0:
                ans[cs[2*i]-1] = sum(LR[i]) // 2
                ans[cs[2*i]] = (sum(LR[i]) // 2) + 1
            else:
                ans[cs[2*i]-1] = sum(LR[i]) // 2 + 1
                ans[cs[2*i]] = (sum(LR[i]) // 2)
        else:
            if LR[i][1] % 2 == 0:
                ans[cs[2*i]-1] = sum(LR[i]) // 2 + 1
                ans[cs[2*i]] = (sum(LR[i]) // 2)
            else:
                ans[cs[2*i]-1] = sum(LR[i]) // 2
                ans[cs[2*i]] = (sum(LR[i]) // 2) + 1
print(*ans)

Measured memory_bytes: 22232
#include <bits/stdc++.h>
#define rep(i, a, b) for(int i = a; i < b; i++)
#define Rep(i, a, b) for(int i = a; i <= b; i++)
#define repr(i, a, b) for(int i = a; i >= b; i--)
#define _GLIBCXX_DEBUG
#define Vl vector<ll>
#define Vs vector<string>
#define Vp vector<pair<ll, ll>>
#define P pair<ll, ll>
using ll = long long;
#define ALL(v) (v).begin(),(v).end()
#define endl "\n"
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
#define co(x) cout << x << endl
#define coel cout << endl
#define pb push_back
#define sz(v) ((ll)(v).size())
using namespace std;  
const double pi = acos(-1.0);
const ll MOD = 1e9 + 7;
const ll INF = 1LL << 60;
#define pp pair<ll, pair<ll, ll>> 
#define fi first
#define se second

void print(Vl vec){
    rep(i, 0, sz(vec)){
        if(i) cout << " ";
        cout << vec[i];
    }
    coel;
}

////////////////////////////////////////////////////////

vector<Vl> G;
ll n, m;
ll color[55];
const int white = 0, black = 1;

void dfs(ll a, ll b, ll v){
    color[v] = black;
    rep(i, 0, G[v].size()){
        if(color[G[v][i]]) continue;
        if(v == a && b == G[v][i]) continue;
        if(v == b && a == G[v][i]) continue;
        dfs(a, b, G[v][i]);
    }
}

int main() {
    cin >> n >> m;
    G.resize(n+1);
    vector<pair<ll, ll>> M(m);
    rep(i, 0, m){
        ll a, b; cin >> a >> b;
        M[i].fi = a, M[i].se = b;
        G[b].push_back(a);
        G[a].push_back(b);
    }
    ll ans = 0;
    rep(i, 0, m){
        Rep(i, 1, n) color[i] = white;
        dfs(M[i].fi, M[i].se, 1);
        Rep(i, 1, n){
            if(color[i] == white){
                ans++;
                break;
            }
        }
    }
    co(ans);

    return 0;
}


Measured memory_bytes: 256
//B - Palindromic Numbers

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

bool funcx(int N);

int main()
{
    int A,B;
    int count=0;
    
    cin >> A >> B;
    
    for(int i=A;i<B+1;i++)
    {
        //文字列に分解して，回文か調べる関数
        if(funcx(i))
        {
            count++;
        }
    }
    cout << count << endl;
}

bool funcx(int N)
{
    bool flag = false;
    string X;

    X=to_string(N);
    if((X.at(0)==X.at(4))&&(X.at(1)==X.at(3)))
    {
        flag = true;
    }
    
    return flag;
}


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

#define ll long long int
#define rep(i, a, n) for (ll i = a; i < n; i++)
#define repm(i, a, n) for (ll i = a; i >= n; i--)
#define INF 1e9
#define LINF 1e17
#define MOD (int)(1e9 + 7)
#define mod (int)(1e9 + 7)
#define pi 3.141592653589
#define pii pair<int, int>
#define pll pair<ll, ll>
#define vi vector<int>
#define vll vector<ll>
#define vd vector<double>
#define vb vector<bool>
#define vs vector<string>
#define vii vector<vector<int>>
#define vllll vector<vector<ll>>
#define ALL(a) (a).begin(), (a).end()

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

void print(bool f)
{
    cout << (f ? "Yes" : "No") << endl;
}

void Print(bool f)
{
    cout << (f ? "YES" : "NO") << endl;
}

int main(void)
{
    int n;
    cin >> n;
    if (n % 10 == 2 || n % 10 == 4 || n % 10 == 5 || n % 10 == 7 || n % 10 == 9)
        cout << "hon" << endl;
    else if (n % 10 == 0 || n % 10 == 1 || n % 10 == 6 || n % 10 == 8)
        cout << "pon" << endl;
    else
        cout << "bon" << endl;
}

Measured memory_bytes: 3596
#include <iostream>
#include <vector>
#include <stack>
#define amax 2000
#define bmax 2000
#define nmax (amax + bmax)
using namespace std;
char honest[nmax+1];
std::stack<int, std::vector<int>> stac;
int ask(int f, int t)
{
    cout << "? " << f << ' ' << t << endl;
    char ans;
    cin >> ans;
    return (ans == 'Y');
}
int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(nullptr);
    int a, b;
    cin >> a >> b;
    if(a <= b){
      cout << "Impossible" << endl;
      return 0;
    }
    int n = a + b;
    for(int i = 0; i < n; ++i){
      if(stac.empty()) stac.push(i);
      else if(ask(stac.top(), i)) stac.push(i);
      else stac.pop();
    }
    int thehonestone = stac.top();
    honest[thehonestone] = '1';
    for(int i = 0; i < n; ++i) if(i != thehonestone)
      honest[i] = (ask(thehonestone, i)) ? '1' : '0';
    honest[n] = 0;
    cout << "! " << honest << endl;
    return 0;
}


Measured memory_bytes: 3744
#include <stdio.h>
#include <iostream>
#include <algorithm>
#include <iomanip>
#include <map>
#include <fstream>
#include <sstream>
#include <math.h>
#include <queue>
#include <stack>
#include <math.h>

using namespace std;

char translation_table[6][5] = {'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z','.','?','!',' '};

int main(){
    string input;
    while(cin>>input){
        if(input.length()%2!=0)cout<<"NA"<<endl;
        else{
            string ans;
            for(int i=0; i<input.length(); i++){
                int y = input[i]-'0';
                i++;
                int x = input[i]-'0';
                if(y<=6&&x<=5&&0<y&&0<x){
                    ans+=translation_table[y-1][x-1];
                }else{
                    ans = "NA";
                    break;
                }
            }
            
            cout<<ans<<endl;
        }
    }

}

Measured memory_bytes: 1188
#include <bits/stdc++.h>
using namespace std;
 
int main() {
    int a, b, c, d;

    cin >> a >> b >> c >> d;

    if (a+b < c+d)
    {
        cout << "Right" << endl;
    }
    else if(a+b > c+d)
    {
        cout << "Left" << endl;
    }
    else
    {
        cout << "Balanced" << endl;
    }
    
}

Measured memory_bytes: 256
# Author: cr4zjh0bp
# Created: Mon Mar  9 08:41:04 UTC 2020
import sys
 
stdin = sys.stdin
inf = 1 << 60
mod = 1000000007
 
ni = lambda: int(ns())
nin = lambda y: [ni() for _ in range(y)]
na = lambda: list(map(int, stdin.readline().split()))
nan = lambda y: [na() for _ in range(y)]
nf = lambda: float(ns())
nfn = lambda y: [nf() for _ in range(y)]
nfa = lambda: list(map(float, stdin.readline().split()))
nfan = lambda y: [nfa() for _ in range(y)]
ns = lambda: stdin.readline().rstrip()
nsn = lambda y: [ns() for _ in range(y)]
ncl = lambda y: [list(ns()) for _ in range(y)]
nas = lambda: stdin.readline().split()

N = ni()

def rec(i):
    if i > N:
        return False
    if i == N:
        return True
    if rec(i + 4):
        return True
    if rec(i + 7):
        return True
    return False

print("Yes" if rec(0) else "No")

Measured memory_bytes: 3064
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ABC
{
    class Program
    {
        static void Main(string[] args)
        {

            var split = Console.ReadLine().Split(' ');
            int N = int.Parse(split[0]);
            int K = int.Parse(split[1]);
            //準備完了
            long output = 0;
                
            





                for (int a = 1; a <= K; a++)
                {
                    int additional_one = (N % K >= a) ? 1 : 0;//余分に一周するか？

                    int firstB = K - a;//こいつがNを超えることはあるのか
                    if (firstB == 0) firstB = K;
                    int B_exists = (N - firstB) / K + 1;
                    if ((2 * a) % K == 0　&&  firstB<=N)
                    {
                    long multiply = B_exists;
                        multiply *=B_exists;
                    long multiply2 = N / K + additional_one;
                        output += multiply * multiply2;
                        

                    }


                    //何周する？3,2のときは1週+1  N/K周して、aがn%K以下だったらもう一周分あるとして足せばいい
                    //bのパターンは何通り？ K-aが最初で、Nを超えないような整数は  (N-K+a)/K + 1　個
                    //ほんでもし、2*aがKを超えないようならば、Cを選んで良くなるので、
                    //bは K-aが最初だが、0なら　困るので

                }
                //Console.WriteLine(N / K + "周して" + (N % K) + "まで");
                Console.WriteLine(output);
            
        }

    }
}


Measured memory_bytes: 11092
#include <stdio.h>
#include <string.h>

int main(void)
{
	char str[1024];
	const char *apple = "apple";
	const char *peach = "peach";
	int i;

	fgets(str, 1000, stdin);
	for (i = 0; str[i] != 0; i++){
		if (strncmp(&str[i], apple, 5) == 0){
			strncpy(str + i, peach, 5);
		}
		else if (strncmp(&str[i], peach, 5) == 0){
			strncpy(str + i, apple, 5);
		}
	}
	printf(str);

	return 0;
}

Measured memory_bytes: 524
import java.util.*;
class Main{

  public static void main(String[] args){
	 Scanner sc = new Scanner(System.in);	
    int a = sc.nextInt();
    String s = sc.next();
    if(a >= 3200){
    	System.out.println(s);
    } else{
    	System.out.println("red");
    }
  
	}
}

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

using namespace std;

int main() {
    int r, d, x;
    cin >> r >> d >> x;

    for (int i = 0; i < 10; i++)
    {
        cout << r * x - d << endl;
        x = r * x - d;
    }
    
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep0(i,n) for(ll (i) = 0; (i) < (n); ++(i))
#define rrep0(i,n) for(ll (i) = (n) - 1; (i) >= 0; --(i))
#define rep1(i,n) for(ll (i) = 1; (i) <= (n); ++(i))
#define rrep1(i,n) for(ll (i) = (n); (i) >= 1; --(i))
#define nfor(i,a,b) for(ll (i) = (a); (i) < (b); ++(i))
#define rfor(i,a,b) for(ll (i) = (a); (i) > (b); --(i))
#define ll long long
#define mod (1000000007)
#define pf(a) cout << (a) << endl;
#define all(x) (x).begin(),(x).end()

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

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

ll factorial(ll n){
    ll t = 1;
    rep1(i, n)t *= i;
    return t;
}

ll combinations(ll n, ll k) {
    ll r = 1;
    for (ll d = 1; d <= k; ++d) {
        r *= n--;
        r /= d;
    }
    return r;
}

int main()
{
    int m1,m2,d1,d2;
    cin >> m1 >> d1 >> m2 >> d2;
    m1++;
    if(m1 == 13)m1 = 1;
    if(m1 == m2 && d2 == 1)pf(1)
    else pf(0)
    return 0;
}


Measured memory_bytes: 256