akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define rep(i,n) for (int i = (0); i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(x) (x).begin(),(x).end()
#define rrng(x) (x).rbegin(),(x).rend()
#define limit(x,l,r) max(l,min(x,r))
#define lims(x,l,r) (x = max(l,min(x,r)))
#define isin(x,l,r) ((l) <= (x) && (x) < (r))
#define show(x) cout << #x << " = " << (x) << endl
#define show2(x,y) cout << #x << " = " << (x) << ", " << #y << " = " << (y) << endl
#define show3(x,y,z) cout << #x << " = " << (x) << ", " << #y << " = " << (y) <<  ", " << #z << " = " << (z) << endl
#define showv(v) rep(i,v.size()) printf("%d%c", v[i], i==v.size()-1?'\n':' ')
#define showv2(v) rep(j,v.size()) showv(v[j])
#define showt(t,n) rep(i,n) printf("%d%c", t[i], i==n-1?'\n':' ')
#define showt2(t,r,c) rep(j,r) showt(t[j],c)
#define showvp(p) rep(i,p.size()) printf("%d %d\n", p[i].first, p[i].second);
#define printv(v) rep(i,v.size()) printf("%d\n", v[i])
#define printt(t,n) rep(i,n) printf("%d\n", t[i])
#define incl(v,x) find(rng(v),x)!=v.end()
#define incls(s,c) s.find(c)!=string::npos
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
#define sz(x) (int)(x).size()
#define pcnt __builtin_popcountll
#define bit(n,k) ((n>>k)&1) // nのk bit目
#define bn(x) ((1<<x)-1)
#define dup(x,y) (((x)+(y)-1)/(y))
#define newline puts("")
#define uni(x) x.erase(unique(rng(x)),x.end())
#define SP << " " <<
#define v(T) vector<T>
#define vv(T) v(v(T))
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<string> vs;
typedef pair<int, int> P;
typedef tuple<int, int, int> T;
typedef vector<P> vp;
typedef vector<T> vt;
const int mod = 1000000007;
const double EPS = 1e-9;
const int INF = (1<<30)-1;
const ll INFLL = (1LL<<62)-1;
#define dame { puts("No"); return 0;}
#define yn {puts("Yes");}else{puts("No");}
inline int in() { int x; scanf("%d",&x); return x;}
template<typename T>inline ll suma(const v(T)& a) { ll res(0); for (auto&& x : a) res += x; return res;}
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 () {
  int n = in();
  set<int> st;
  rep(i,n) {
    int a = in();
    st.insert(a);
  }
  if (st.size() == n) puts("YES");
  else puts("NO");
  return 0;
}

Measured memory_bytes: 9600
#include <stdio.h>
#include <string.h>
#include <math.h>
int main(){
	int n, k;
	scanf("%d", &n);
	k = sqrt(n);
	while(k * k != n){
		k = sqrt(n);
		n--;
	}
	printf("%d\n", n);
	return 0;
}

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

typedef long long ll;

string itos(int x){
  string res;
  while(x)res+=x%10+'0',x/=10;
  reverse(res.begin(),res.end());
  return res;
}

ll dp[N][11];

int main(){

  while(1){
    
    ll a,b,p;

    cin>>a>>b>>p;

    if(!a&&!b&&!p) break;
    
    vector<string> v;
  
    for(int i=a;i<=b;i++) v.push_back(itos(i));
  
    ll n=b-a+1;
  
    sort(v.begin(),v.end());
  
    v.push_back("");
  
    memset(dp,0,sizeof(dp));
  
    for(int i=0;i<n;i++) dp[i][v[i].size()]=1;
  
    for(int i=0;i<n;i++){
    
      ll A=0;
      for(int j=0;j<v[i].size();j++) A=(A+dp[i][j])%p;
      dp[i][v[i].size()]=(dp[i][v[i].size()]+A)%p;
    
      for(int j=0;j<11;j++){
      
	if(v[i+1].size()==j) dp[i+1][j]=(dp[i+1][j]+(dp[i][j]*2)%p)%p;
	else dp[i+1][j]=(dp[i+1][j]+dp[i][j])%p;
      
      }
    
    }
  
    ll ans=0;
  
    for(int i=0;i<11;i++) ans=(ans+dp[n][i])%p;
  
    cout<<ans<<endl;
  } 
  return 0;
}

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

using namespace std;

int main() {

	int n;
	string s;
	cin >> n >> s;

	vector<int> l(n, 0);
	vector<int> r(n, 0);

	if (s[0] == 'W') { l[0] = 1; }
	else { l[0] = 0; }

	for (int i = 1; i < n; i++) {
		if (s[i] == 'W') {
			l[i] = l[i - 1] + 1;
		}
		else {
			l[i] = l[i - 1];
		}
	}

	if (s[n - 1] == 'E') { r[n - 1] = 1; }
	else { r[n - 1] = 0; }

	for (int i = n - 2; i >= 0; i--) {
		if (s[i] == 'E') {
			r[i] = r[i + 1] + 1;
		}
		else {
			r[i] = r[i + 1];
		}
	}

	int counter = 0;
	int mincount = n+1;
	for (int i = 1; i < n-1; i++) {
		counter = l[i-1]+r[i + 1]  ;
		mincount = min(counter, mincount);
	}
	cout << min(mincount, min(l[n-1],r[0])) << endl;;
	
}

Measured memory_bytes: 3076
use std::cmp;
use std::collections::BTreeMap;

fn main() {
    let s = std::io::stdin();
    let mut sc = Scanner { stdin: s.lock() };
    let n: usize = sc.read();
    let mut a: Vec<usize> = sc
        .vec::<usize>(n)
        .into_iter()
        .fold(BTreeMap::new(), |mut map, a| {
            *map.entry(a).or_insert(0) += 1;
            map
        })
        .into_iter()
        .map(|(_, v)| v)
        .collect();
    a.sort();

    let mut bricks = 0;
    let mut sum = a.iter().sum::<usize>();
    let mut ans = vec![0; n + 1];
    for height in (1..(n + 1)).rev() {
        while let Some(b) = a.pop() {
            if b >= height {
                sum -= b;
                bricks += 1;
            } else {
                a.push(b);
                break;
            }
        }
        let k = sum / height + bricks;
        ans[k] = cmp::max(ans[k], height);
    }

    for k in (0..n).rev() {
        ans[k] = cmp::max(ans[k], ans[k + 1]);
    }

    for i in 1..(n + 1) {
        println!("{}", ans[i]);
    }
}

pub struct Scanner<R> {
    stdin: R,
}

impl<R: std::io::Read> Scanner<R> {
    pub fn read<T: std::str::FromStr>(&mut self) -> T {
        use std::io::Read;
        let buf = self
            .stdin
            .by_ref()
            .bytes()
            .map(|b| b.unwrap())
            .skip_while(|&b| b == b' ' || b == b'\n')
            .take_while(|&b| b != b' ' && b != b'\n')
            .collect::<Vec<_>>();
        unsafe { std::str::from_utf8_unchecked(&buf) }
            .parse()
            .ok()
            .expect("Parse error.")
    }
    pub fn vec<T: std::str::FromStr>(&mut self, n: usize) -> Vec<T> {
        (0..n).map(|_| self.read()).collect()
    }
    pub fn chars(&mut self) -> Vec<char> {
        self.read::<String>().chars().collect()
    }
}


Measured memory_bytes: 16636
/*
　　　  ∧＿∧　やあ
　　 （´・ω・｀)　　　　　/　　　　　ようこそ、バーボンハウスへ。
　　 ／∇y:::::＼　　　 [￣]　　　　　このテキーラはサービスだから、まず飲んで落ち着いて欲しい。
　　 |:⊃:|:::::|　　　|──|
￣￣￣￣￣￣￣￣￣￣￣￣￣￣￣￣￣|　うん、「また」なんだ。済まない。
￣￣￣￣￣￣￣￣￣￣￣￣￣￣￣|￣　  仏の顔もって言うしね、謝って許してもらおうとも思っていない。
￣￣￣￣￣￣￣￣￣￣￣￣￣￣／|
　　　　∇　∇　∇　∇　　　／.／|　　　でも、この提出を見たとき、君は、きっと言葉では言い表せない
　　　　┴　┴　┴　┴　／ ／　  |　　　「ときめき」みたいなものを感じてくれたと思う。
￣￣￣￣￣￣￣￣￣￣|／　　  |　　　殺伐としたコンテストの中で、そういう気持ちを忘れないで欲しい
￣￣￣￣￣￣￣￣￣￣　　　　 |　　　そう思って、この提出を投げたんだ。
　　　(⊆⊇)　(⊆⊇)　(⊆⊇)　　|
　    ||　　 ||　　||　　|　　　 じゃあ、判定を聞こうか。
　　.／|＼　／|＼ ／|＼
*/

#include <iostream>
#include <cstdlib>
#include <algorithm>
#include <array>
#include <bitset>
#include <climits>
#include <cmath>
#include <cstdio>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <string>
#include <vector>
using namespace std;
#define fst first
#define snd second
#define ALL(obj) (obj).begin(),(obj).end()
#define debug(x) cerr << #x << " -> " << x << " (line:" << __LINE__ << ")" << '\n';
#define debugpair(x, y) cerr << "(" << #x << ", " << #y << ") -> (" << x << ", " << y << ") (line:" << __LINE__ << ")" << '\n';
typedef long long lint;
typedef priority_queue<int> p_que;
typedef priority_queue<int, vector<int>, greater<int>()> p_que_rev;
const int INF = INT_MAX;
const lint LINF = LLONG_MAX;
const int MOD = 1000000000 + 7;
const double EPS = 1e-9;
const double PI = acos(-1);
const int di[]{0, -1, 0, 1, -1, -1, 1, 1};
const int dj[]{1, 0, -1, 0, 1, -1, -1, 1};


int main()
{
    cin.tie(0);
    ios_base::sync_with_stdio(false);
    int x, a, b;
    cin >> x >> a >> b;
    x -= a;
    x = x % b;
    cout << x << "\n";
    return 0;
}

Measured memory_bytes: 256
N = int(input())
As = list(map(int, input().split()))
Bs = list(map(int, input().split()))
Cs = list(map(int, input().split()))

ans = 0
for i in range(N):
    k = As[i]
    ans += Bs[k-1]
    if i < N-1 and As[i+1] == k+1:
        ans += Cs[k-1]

print(ans)


Measured memory_bytes: 3060
#include<iostream>
#include<algorithm>
using namespace std;
int a[10001],n;
int main(void)
{
	scanf("%d",&n);
	for(int i = 1;i<=n;i++)
		scanf("%d",a+i);
	sort(a+1,a+1+n);
	double ans = a[1];
	for(int i = 2;i<=n;i++)
		ans = (ans + a[i])/2.0;
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 256
import time
import random
t1 = time.time()

D = int(input())

last_list = [0 for i in range(27)]
c_list = list(map(int, input().split()))
c_list = [0] + c_list
# max = 0
# max_c =
# for i in range(1,27):

# print(c_list)
S_list = [[]for i in range(D)]
P_list = [0 for i in range(27)]
max_list = [0 for i in range(D)]
max_list = [""] + max_list
for i in range(D):
    max = 0
    S_list[i] = list(map(int, input().split()))
    S_list[i] = [""] + S_list[i]
    for j in range(1,27):
        if max <= S_list[i][j]:
            max = S_list[i][j]
            max_list[i+1] = j
S_list = [""] + S_list
# print(S_list)


t_list = max_list
# for i in range(D):
#     t_list.append(random.randint(1,26))

for i in range(1,D+1):
    S = 0
    t = t_list[i]
    for j in range(1,27):
        if j == t:
            P_list[j] += S_list[i][j]
            last_list[j] = i
            # print(S_list[i][j])
        else:
            P_list[j] -= c_list[j] * (i-last_list[j])
    for i in range(1,27):
        S += P_list[i]
    # print(S)

t2 = time.time()
Time = t2 - t1
# print(M)
while t2 - t1 <= 1.8:
    last_list = [0 for i in range(27)]
    P_list = [0 for i in range(27)]
    C_A = random.randint(1,D)
    C_B = random.randint(1,26)
    t_new = t_list
    t_new[C_A] = C_B
    for i in range(1,D+1):
        S_new = 0
        t = t_new[i]
        for j in range(1,27):
            if j == t:
                P_list[j] += S_list[i][j]
                last_list[j] = i
                # print(S_list[i][j])
            else:
                P_list[j] -= c_list[j] * (i-last_list[j])
        for i in range(1,27):
            S_new += P_list[i]
    if S_new >= S:
        S = S_new
        t_list = t_new
    t2 = time.time()

for i in range(1,D+1):
    print(t_list[i])


Measured memory_bytes: 86208
#include <bits/stdc++.h>
#define mnm first
#define mxm second
using namespace std;

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

const int maxn = 2e5 + 3;
const int mod = 1e9 + 7;
const int inf = 1e9;

int a[maxn], lef[maxn], dp[maxn];
pii seg[4 * maxn];
int sum[4 * maxn];

pii merge(pii fi, pii se){
	if (fi.mnm == 0)
		fi.mnm = inf;
	if (se.mnm == 0)
		se.mnm = inf;
	return {min(fi.mnm, se.mnm), max(fi.mxm, se.mxm)};
}

pii get(int id, int L, int R, int l, int r){
	if (l <= L and R <= r)
		return seg[id];
	int mid = (L + R) >> 1;
	if (r <= mid)
		return get(2 * id + 0, L, mid, l, r);
	if (mid <= l)
		return get(2 * id + 1, mid, R, l, r);
	return merge(get(2 * id + 0, L, mid, l, r), get(2 * id + 1, mid, R, l, r));
}

void add(int id, int L, int R, int idx, int val){
	if (idx < L or R <= idx)
		return;
	if (seg[id].mnm == 0)
		seg[id].mnm = inf;
	seg[id].mnm = min(seg[id].mnm, val);
	seg[id].mxm = max(seg[id].mxm, val);
	if (L + 1 == R)
		return;
	int mid = (L + R) >> 1;
	add(2 * id + 0, L, mid, idx, val);
	add(2 * id + 1, mid, R, idx, val);
}

int get2(int id, int L, int R, int l, int r){
	if (r <= L or R <= l)
		return 0;
	if (l <= L and R <= r)
		return sum[id];
	int mid = (L + R) >> 1;
	return (get2(2 * id + 0, L, mid, l, r) + get2(2 * id + 1, mid, R, l, r)) % mod;
}

void add2(int id, int L, int R, int idx, int val){
	if (idx < L or R <= idx)
		return;
	sum[id] = (sum[id] + val) % mod;
	if (L + 1 == R)
		return;
	int mid = (L + R) >> 1;
	add2(2 * id + 0, L, mid, idx, val);
	add2(2 * id + 1, mid, R, idx, val);
}

int main(){
	ios_base::sync_with_stdio(false);
	int n;
	cin >> n;
	vector<pair<int,int> > v(n + 1);
	vector<int> cmp;
	for (int i = 1; i <= n; i++){
		int x, y;
		cin >> x >> y;
		v[i] = {x, y};
		cmp.push_back(y);
	}

	sort(v.begin(), v.end());
	sort(cmp.begin(), cmp.end());
	for (int i = 1; i <= n; i++)
		a[i] = lower_bound(cmp.begin(), cmp.end(), v[i].second) - cmp.begin();
	
	for (int i = 1; i <= n; i++)
		add(1, 0, n, a[i], i);
	memset(lef, -1, sizeof lef);
	for (int i = 1; i <= n; i++){
		int l = get(1, 0, n, a[i] + 0, n).mnm;
		int r = get(1, 0, n, 0, a[i] + 1).mxm;
		lef[r] = max(lef[r], l);
	}
	dp[0] = 1;
	add2(1, 0, n, 0, 1);
	dp[1] = 1 + (lef[1] == -1);
	int maxl = lef[1];
	add2(1, 0, n, 1, dp[1]);
	for (int i = 2; i <= n; i++){
		maxl = max(maxl, lef[i]);
		if (lef[i] == -1){
			dp[i] = 2ll * dp[i - 1] % mod;
			add2(1, 0, n, i, dp[i]);
			continue;
		}
		dp[i] = get2(1, 0, n, maxl - 1, i);
		if (i < n)
			add2(1, 0, n, i, dp[i]);
	}
	cout << dp[n] << endl;
}


Measured memory_bytes: 14580
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;

int main() {
    int D, T, S;
    cin >> D >> T >> S;
    if (S * T >= D) {
        cout << "Yes" << endl;
    }
    else {
        cout << "No" << endl;
    }
}

Measured memory_bytes: 3628
H, W = map(int, input().split())
S = [input() for _ in range(H)]

dp1 = [[0 for _ in range(W)] for _ in range(H)]
dp2 = [[0 for _ in range(W)] for _ in range(H)]

for i in range(H):
    for j in range(W):
        if dp1[i][j] == 0 and S[i][j] == '.':
            c = 0
            for k in range(i, H):
                if S[k][j] == '.':
                    c += 1
                else:
                    break
            for k in range(i, H):
                if S[k][j] == '.':
                    dp1[k][j] = c
                else:
                    break
for i in range(H):
    for j in range(W):
        if dp2[i][j] == 0 and S[i][j] == '.':
            c = 0
            for k in range(j, W):
                if S[i][k] == '.':
                    c += 1
                else:
                    break
            for k in range(j, W):
                if S[i][k] == '.':
                    dp2[i][k] = c
                else:
                    break

ans = max(
    dp1[i][j] + dp2[i][j] - 1
    for i in range(H)
    for j in range(W)
)
print(ans)


Measured memory_bytes: 128600
import sys
import math

a, b = map(int, input().split())

downera = math.ceil(100/8 * a)
uppera = math.floor(100/8 * (a+1))

downerb = 10 * b
upperb = 10 * (b+1)

if uppera < downerb or upperb < downera:
    print("-1")
    sys.exit()
for i in range(downera, uppera):
    if i >= downerb and i < upperb:
        print(i)
        sys.exit()

print("-1")


Measured memory_bytes: 3060
import math
a,b,c=(int(x) for x in input().split())

c=math.radians(c)
s=0.5*a*b*(math.sin(c))

l=a+b+(math.sqrt(a*a+b*b-2*a*b*math.cos(c)))

h=b*(math.sin(c))

print('{:.08f}'.format(s))
print('{:.08f}'.format(l))
print('{:.08f}'.format(h))


Measured memory_bytes: 5724
/*  -*- coding: utf-8 -*-
 *
 * c.cc: C - AB Substrings
 */

#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<set>
#include<stack>
#include<list>
#include<queue>
#include<deque>
#include<algorithm>
#include<numeric>
#include<utility>
#include<complex>
#include<functional>

using namespace std;

/* constant */

/* typedef */

/* global variables */

char s[16];

/* subroutines */

/* main */

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

  int cnt = 0, an = 0, bn = 0, ban = 0;
  for (int i = 0; i < n; i++) {
    scanf("%s", s);
    int l = strlen(s);
    for (int j = 1; j < l; j++)
      if (s[j - 1] == 'A' && s[j] == 'B') cnt++;

    if (s[0] == 'B' && s[l - 1] == 'A') ban++;
    else if (s[0] == 'B') bn++;
    else if (s[l - 1] == 'A') an++;
  }

  if (ban > 0) {
    cnt += ban - 1;
    if (an > 0) cnt++, an--;
    if (bn > 0) cnt++, bn--;
  }

  printf("%d\n", cnt + min(an, bn));
  return 0;
}


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

#define int long long
#define rep(i,l,r) for(int i=(int)(l);i<(int)(r);i++)
#define all(x) (x).begin(),(x).end()
#define sz(x) ((int)x.size())
template<class T>bool chmax(T &a,T b){if(a<b){a=b;return 1;}return 0;}
template<class T>bool chmin(T &a,T b){if(a>b){a=b;return 1;}return 0;}


/*{
}*/

using vi = vector<int>;
using vvi = vector<vi>;
using P = pair<int,int>;

//constexpr int mod = 1e9+7;
//constexpr int inf = 1LL<<60;

signed main() {
  string s;
  cin >> s;

  if(s == "SUN") cout << 7 << endl;
  if(s == "MON") cout << 6 << endl;
  if(s == "TUE") cout << 5 << endl;
  if(s == "WED") cout << 4 << endl;
  if(s == "THU") cout << 3 << endl;
  if(s == "FRI") cout << 2 << endl;
  if(s == "SAT") cout << 1 << endl;
  
  return 0;
}



Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<string>
#include<cstring>
#include<sstream>
#include<iomanip>
#include<limits>
#include<deque>
#include<map>
#include<list>
#include<set>
#include <unordered_set>
#include<vector>
#include<cmath>
#include<cstdio>
#include<memory>
#include<bitset>
#include <functional>
#include <queue>
#include <regex>

using namespace std;

constexpr int MOD = 1000000007;
constexpr int INF = 1050000000;

int main() {

	int n, k; cin >> n >> k;
	int x[100000];

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

	int ans = INF;

	for (int i = 0; i + k - 1 < n; i++) {
		int a = x[i];
		int b = x[i + k - 1];

		ans = min(ans, b - a + min(abs(a), abs(b)));
	}

	cout << ans << endl;











}

Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
using vi = vector<int>;
using vb = vector<bool>;
using vc = vector<char>;
using vs = vector<string>;
using vvi = vector<vector<int>>;
using vvc = vector<vector<char>>;
using pii = pair<int, int>;
#define fix10 cout << fixed << setprecision(10);
#define rep(i,n) for(int i=0; i<(int)(n);i++)
#define MOD 1000000007

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

int main(){
  int t;
  cin >> t;
  rep(i,t){
    long a,b,c,d;
    cin >> a >> b >> c >> d;
    long g = gcd(d,b);
    long r = a % b;
    if(a < b){
      cout << "No" << endl;
    }else if(d < b){
      cout << "No" << endl;
    }else if(b-1 <= c){
      cout << "Yes" << endl;
    }else if(g == 1){
      cout << "No" << endl;
    }else if(b - g + (r%g) > c){
      cout << "No" << endl;
    }else{
      cout << "Yes" << endl;
    }
  }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define maxN 1000001
#define mod 1000000007
#define maxLL 1000000000000000000
#define PI 3.14159265358979323846264338327950L
typedef long long ll;

//how to search mid = l+(r-l/2)

bool compared(int a,int b){
	return a < b;
}

int cmp(const void *a,const void *b){
	return(*(int*)b - *(int*)a);
}

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

int LCM(int a,int b){
	return a/__gcd(a,b)*b;
}

int main(){
//	freopen("input.txt","r",stdin);
//    freopen("output.txt","w",stdout);
	int n;
	cin>>n;
	int ac = 0,wa = 0,tle = 0,re = 0;
	for(int i=0;i<n;i++){
		string s;
		cin>>s;
		if(s == "AC"){
			ac++;
		}
		if(s == "WA"){
			wa++;
		}
		if(s == "TLE"){
			tle++;
		}
		if(s == "RE"){
			re++;
		}
	}
	cout<<"AC x "<<ac<<endl;
	cout<<"WA x "<<wa<<endl;
	cout<<"TLE x "<<tle<<endl;
	cout<<"RE x "<<re<<endl;
	return 0;
}

Measured memory_bytes: 3620
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <cassert>
#include <iostream>
#include <sstream>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <utility>
#include <numeric>
#include <algorithm>
#include <bitset>
#include <complex>
#include <array>
#include <list>
#include <stack>
#include <valarray>

using namespace std;

typedef unsigned uint;
typedef long long Int;
typedef unsigned long long UInt;

const int INF = 1001001001;
const Int INFLL = 1001001001001001001LL;

template<typename T> void pv(T a, T b) { for (T i = a; i != b; ++i) cout << *i << " "; cout << endl; }
template<typename T> void chmin(T& a, T b) { if (a > b) a = b; }
template<typename T> void chmax(T& a, T b) { if (a < b) a = b; }
int in() { int x; scanf("%d", &x); return x; }
double fin() { double x; scanf("%lf", &x); return x; }
Int lin() { Int x; scanf("%lld", &x); return x; }

char A[10050], B[10050];
Int fact[50050], inv[50050], finv[50050];
const Int MO = 998244353;

Int comb(int n, int r) {
  return fact[n] * finv[r] % MO * finv[n - r] % MO;
}

// Int dp[512][512];

Int U[10050], V[10050];

int main() {
  scanf("%s%s", A, B);
  const int N = strlen(A);

  inv[1] = 1;
  for (int i = 2; i < 50050; ++i) {
    inv[i] = MO - MO / i * inv[MO % i] % MO;
  }
  fact[0] = finv[0] = 1;
  for (int i = 1; i < 50050; ++i) {
    fact[i] = fact[i - 1] * i % MO;
    finv[i] = finv[i - 1] * inv[i] % MO;
  }

  int C = 0, E = 0;
  for (int i = 0; i < N; ++i) {
    if (A[i] == '1' && B[i] == '1') {
      ++C;
    } else if (A[i] == '1') {
      ++E;
    }
  }

  Int res = 0;
  U[0] = 1;
  for (int c = 0; c <= C; ++c) {
    memset(V, 0, sizeof(V));
    for (int e = 1; e <= E; ++e) {
      (U[e] += U[e - 1] * (E - (e - 1)) % MO) %= MO;
    }

    (res += U[E] * fact[E] % MO * comb(C, c) % MO * fact[c] % MO * fact[C - c] % MO * fact[C - c] % MO * comb(C + E, C - c) % MO) %= MO;

    for (int e = 0; e <= E; ++e) {
      (U[e] *= e) %= MO;
    }
  }

  // assert(N <= 500);

  // memset(dp, 0, sizeof(dp));
  // dp[0][0] = 1;
  // for (int c = 0; c <= C; ++c) {
  //   for (int e = 0; e <= E; ++e) {
  //     if (e < E) {
  //       for (int u = 0; c + u <= C; ++u) {
  //         (dp[c + u][e + 1] += (dp[c][e] * (E - e) % MO * comb(C - c, u) % MO * fact[u] % MO * comb(c + u + e + 1, u + 1) % MO)) %= MO;
  //       }
  //     }
  //   }
  // }

  // Int res = 0;
  // for (int c = 0; c <= C; ++c) {
  //   Int pat = fact[C - c] * fact[C - c] % MO;
  //   (res += dp[c][E] * pat % MO * comb(C + E, C - c) % MO) %= MO;
  // }

  printf("%lld\n", res);

  return 0;
}


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

#define rep(i,n) for(long long int (i)=0;(i)<(int)(n);(i)++)
#define rrep(i,a,b) for(long long int i=(a);i<(b);i++)
#define rrrep(i,a,b) for(long long int i=(a);i>=(b);i--)
#define all(v) (v).begin(), (v).end()
#define pb(q) push_back(q)
#define Abs(a,b) max(a,b)-min(a,b)
#define YES(condition) if(condition){cout << "YES" << endl;}else{cout << "NO" << endl;}
#define Yes(condition) if(condition){cout << "Yes" << endl;}else{cout << "No" << endl;}
#define Cout(x) cout<<(x)<<endl
#define POSSIBLE(condition) if(condition){cout << "POSSIBLE" << endl;}else{cout << "IMPOSSIBLE" << endl;}
#define Possible(condition) if(condition){cout << "Possible" << endl;}else{cout << "Impossible" << endl;}
#define possible(condition) if(condition){cout << "possible" << endl;}else{cout << "impossible" << endl;}
#define Size(n) (n).size()

typedef long long ll;


using namespace std;

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


long long int n,cnt=0,ans=INF,a,b,c,d,cmp,cmpp,m,h,w,x,y,sum=0,pos=0;
int dy[]={1,0,-1,0};
int dx[]={0,1,0,-1};
string alph("abcdefghijklmnopqrstuvwxyz"),s;
bool fl=true;
struct edge{int to,cost;};

//-------------------------↓↓↓↓↓↓------------------------

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

      
      cin>>s;
      for(char c='a';c<='z';c++){
        pos=0;
        rep(i,Size(s)){
          if(i==Size(s)-1){
            if(s[i]!=c)cnt++;
            pos=max(pos,cnt);
          }
          else{
          if(s[i]==c){
            pos=max(pos,cnt);
            cnt=0;
          }
          else{
          cnt++;
          }
        }
        }
       // cout<<c<<" "<<cnt<<"\n";
        ans=min(ans,pos);
        cnt=0;
      }
      Cout(ans);
     

       
return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> ii;
typedef vector<int> vi;
typedef vector<ii> vii;
typedef vector<vi> vvi;
typedef vector<vii> vvii;
typedef complex<int> ci;
typedef complex<double> cd;
#define fi first
#define se second
#define ALL(x) (x).begin(), (x).end()
#define RALL(x) (x).rbegin(), (x).rend()
#define pf push_front
#define eb emplace_back
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define ge(a, b) get<(b)>((a))
#define SZ(x) (x).size()
#define ft front()
#define bk back()
#define ins insert
#define endl '\n'
#define FOR(a, b, c) for (auto(a) = (b); (a) < (c); ++(a))
#define ROF(a, b, c) for (auto(a) = (b); (a) > (c); --(a))
#define F0R(a, b) FOR ((a), 0, (b))
#define R0F(a, b) ROF ((a), (b), -1)
#define FORI(a, b) for (auto(a) = (b).begin(); (a) != (b).end(); ++(a))
#define ROFI(a, b) for (auto(a) = (b).rbegin(); (a) != (b).rend(); ++(a))
#define CEIL(a, b) ((a) + (b)-1) / (b)
const int xd[4] = {0, 1, 0, -1}, yd[4] = {1, 0, -1, 0};
template <typename t>
bool ckmin(t& a, const t& b) {
    return a > b ? a = b, true : false;
}
template <typename t>
bool ckmax(t& a, const t& b) {
    return a < b ? a = b, true : false;
}

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

    int n, m;
    cin >> n >> m;
    vi a(n);
    F0R (i, n)
        cin >> a[i];
    int sum = accumulate(ALL(a), 0);
    sort(RALL(a));
    int t = m;
    for (int i = 0; t && a[i] * 4 * m >= sum; ++i) --t;
    cout << (t ? "No" : "Yes") << endl;
    return 0;
}


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

def popcount(ni):
    n_b = str(bin(ni))
    return n_b.count("1")

def ans(n,x):
    x_i = int(x, 2)
    x_orig = popcount(x_i)
    x_i_t = x_i % (x_orig+1)
    if x_orig != 1:
        x_i_b = x_i % (x_orig-1)
    else:
        x_i_b = x_i
    solve = 0
    for i in range(n):
        x_count = x_orig
        if x[i] == "0":
            x_count += 1
            solve = x_i_t + pow(2,n-1-i,x_count)
        else:
            x_count -= 1
            if x_count != 0:
                solve = x_i_b - pow(2,n-1-i,x_count)
            else:
                print(0)
                continue
        count = 0

        if x_count != 0 :
            solve = solve % x_count
            count+=1

        while solve > 0:
            solve = solve % popcount(solve)
            count+=1

        print(count)

    
ans(n,x)


Measured memory_bytes: 9612
#include<stdio.h>
#define INFINITY (1<<21)
#define MAX 100
#define WHITE 0
#define GRAY 1
#define BLACK 2

int n,M[MAX][MAX];

void dijkstra(){
  int minv,i,j,v,u;
  int d[MAX],color[MAX];
  for(i=0;i<n;i++){
    d[i]=INFINITY;
    color[i]=WHITE;
  }

  d[0]=0;
  color[0]=GRAY;
  while (1) {
    minv=INFINITY;
    u=-1;
    for(i=0;i<n;i++){
      if(minv>d[i] && color[i] != BLACK){
        u = i;
        minv = d[i];
      }
    }
    if (u == -1)break;
    color[u]=BLACK;
    for(v=0;v<n;v++){
      if(color[v] != BLACK && M[u][v] !=INFINITY){
        if( d[v] > d[u]+ M[u][v]){
          d[v] = d[u] + M[u][v];
          color[v] =GRAY;
        }
      }
    }
  }
  for(i=0;i<n;i++){
    printf("%d",i);
    if(d[i] == INFINITY)printf(" -1\n");
    else printf(" %d\n",d[i]);
  }
}

int main(){
  int i,j,v,c,u,k;
  scanf("%d",&n);
  for(i=0;i<n;i++){
    for(j=0;j<n;j++){
      M[i][j] = INFINITY;
    }
  }
  for(i=0;i<n;i++){
    scanf("%d %d",&u,&k);
    for(j=0;j<k;j++){
      scanf("%d %d",&v,&c);
      M[u][v] = c;
    }
  }

  dijkstra();

  return 0;
}





Measured memory_bytes: 2084
N = int(input())
P = list(map(int, input().split()))
LL = [0] + [i for i in range(N+1)]
RR = [i+1 for i in range(N+1)] + [N+1]

E = [(v, i+1) for i, v in enumerate(P)]
E.sort()
#print(E)
res = 0
for v, i in E:
  #ソートしてあるので、順列の最小値から参照されていく
  #ある要素に対して、その要素より大でありかつ最も近いものを右側と左側について考え、indexを保存
  #LL, RRは、見た要素をindexはそのままにして排除している
  #小さい方からやるのであれば、参照中の要素以上の値しか見れなくなるので好都合
  #indexテーブルの圧縮
  
  #l0 iから左にいてi以上のもの
  #l1 l0から左にいてl0以上のもの
  #r0, r1も同様
  l0 = LL[i]; l1 = LL[l0]
  r0 = RR[i]; r1 = RR[r0]
  #r0から見たら左にl0がいる
  #l0から見たら右にr0がいる
  LL[RR[i]], RR[LL[i]] = LL[i], RR[i]

  res += ((r1 - r0) * (i - l0) + (r0 - i) * (l0 - l1)) * v
print(res)



Measured memory_bytes: 62700
#include <stdio.h>

#define NMAX 300

int main() {
    int A[NMAX],n;
    scanf("%d", &n);
    for (int i=1;i<=n;i++) {
        scanf("%d",&A[i]);
    }
    int parent,left,right;
    for (int i=1;i<=n;i++) {
        parent=i/2;
        left=i*2;
        right=left+1;
        printf("node %d: ", i);
        printf("key = %d, ", A[i]);
        if(parent>=1){
            printf("parent key = %d, ", A[parent]);
        }
        if(left<=n) {
            printf("left key = %d, ", A[left]);
        }
        if(right<=n) {
            printf("right key = %d, ", A[right]);
        }
        printf("\n");
    }
        
    return 0;
}



Measured memory_bytes: 2732
import java.util.Scanner;

public class Main {
	
	
	void main() {
		try(Scanner sc = new Scanner(System.in)){
			for(;;) {
				int x = sc.nextInt();
				int y = sc.nextInt();
				if(x == 0 && y == 0) break;
				System.out.printf("%d %d\n", Math.min(x, y),Math.max(x, y));

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


}



Measured memory_bytes: 41612
#include<iostream>
#include<map>

using namespace std;

int main(){
    int N;
    cin >> N;
    string S[N];
    for(int i=0;i<N;i++){
        cin >> S[i];
    }
    std::map<string,int> map;
    for(int i=0;i<N;i++){
        auto iter = map.find((S[i]));
        if(iter!=map.end()){
            iter->second = iter->second+1;
        }else{
            map.insert(make_pair(S[i],1));
        }
    }

    int max = 0;

    for(auto iter = map.begin();iter!=map.end();iter++){
        max = std::max(max,iter->second);
    }

    for(auto iter = map.begin();iter!=map.end();iter++){
        if(iter->second==max){
            cout << iter->first << endl;
        }
    }
    return 0;
}

Measured memory_bytes: 26752
#include<iostream>
#include<iomanip>
#include<cmath>
using namespace std;

int main(){
  double n, x[100], y[100], sum1, sum2, sum3, max = 0;

  cin >> n;
  for(int i = 0; i < n; i++){ cin >> x[i];}
  for(int i = 0; i < n; i++){ cin >> y[i];}

  for(int i = 0; i < n; i++){
    sum1 += fabs(x[i] - y[i]);
    sum2 += pow(x[i] - y[i], 2);
    sum3 += pow(fabs(x[i] - y[i]), 3);
    max = fabs(x[i] - y[i]) > max ? fabs(x[i] - y[i]) : max;
  }
  cout
    << fixed << setprecision(6)
    << sum1 << endl
    << sqrt(sum2) << endl
    << pow(sum3, 1.0 / 3.0) << endl
    << max << endl;
}

Measured memory_bytes: 1324
using System;
using System.Collections.Generic;
using System.Numerics;
using System.Linq;
using static System.Math;

class MainClass
{

    public static void Main(string[] args)
    {
        var N = LnInt();
        var hun = N / 100;
        var ten = N %100/10;
        var one = N % 10;
      Console.WriteLine( (one==7||hun==7||ten==7)?"Yes":"No");
    }



    public static int[] LnInts()
    {
        var vs = Console.ReadLine().Trim().Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);
        var ins = new int[vs.Length];
        for (int i = 0; i < vs.Length; i++) ins[i] = int.Parse(vs[i]);
        return ins;
    }

    public static int LnInt()
    {
        var vs = Console.ReadLine().Trim();
        return int.Parse(vs);
    }

    public static string[] LnStrs()
    {
        var vs = Console.ReadLine().Trim().Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);
        return vs;
    }
    public static string LnStr()
    {
        var vs = Console.ReadLine().Trim();
        return vs;
    }
}

Measured memory_bytes: 27536
def solve():
    from heapq import heappush, heappop
    def dijkstra(start, goal):
        fare = [99000001] * n
        fare[start] = 0
        pq = [(0, start)]
        
        while pq:
            u_fare, u = heappop(pq)
                    
            if u == goal:
                return u_fare
            
            for f, v in adj[u]:
                new_fare = u_fare + f
                if new_fare < fare[v]:
                    fare[v] = new_fare
                    heappush(pq, (new_fare, v))
        return -1
        
    import sys
    file_input = sys.stdin
    
    while True:
        n, k = map(int, file_input.readline().split())
        if n == 0 and k == 0:
            break
        
        adj = [[] for i in range(n)]
        
        for i in range(k):
            line = file_input.readline()
            if line[0] == '0':
                a, b = map(int, line[2:].split())
                print(dijkstra(a - 1, b - 1))
            else:
                c, d, e = map(int, line[2:].split())
                adj[c - 1].append((e, d - 1))
                adj[d - 1].append((e, c - 1))

solve()


Measured memory_bytes: 6240
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

func main() {
	sc := bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanWords)

	N := scanInt(sc)
	W := scanInt(sc)
	v, w := make([]int, N), make([]int, N)
	for i := 0; i < N; i++ {
		v[i] = scanInt(sc)
		w[i] = scanInt(sc)
	}

	dp := make([][]int, N+1)
	for i := 0; i <= N; i++ {
		dp[i] = make([]int, W+1)
	}
	for i := 1; i <= N; i++ {
		for j := 0; j <= W; j++ {
			dp[i][j] = dp[i-1][j]
			if j >= w[i-1] {
				dp2 := dp[i-1][j-w[i-1]] + v[i-1]
				if dp[i][j] < dp2 {
					dp[i][j] = dp2
				}
			}
		}
	}
	fmt.Printf("%d\n", dp[N][W])
}

func scanInt(sc *bufio.Scanner) int {
	sc.Scan()
	v, _ := strconv.Atoi(sc.Text())
	return v
}



Measured memory_bytes: 9620
#include<algorithm>
#include<climits>
#include<cmath>
#include<iomanip>
#include<iostream>
#include<list>
#include<map>
#include<numeric>
#include<queue>
#include<set>
#include<stack>
#include<utility>
#include<vector>

#define lint long long
#define REP(i, x, n) for(int i = x ; i < n ; i++)
#define rep(i, n) REP(i, 0, n)
#define repr(i, n) for(int i = n - 1 ; i >= 0 ; i--)
#define SORT(c) sort((c).begin(), (c).end())
#define SORT_INV(c) sort((c).begin(), (c).end(), greater<int>())
#define IINF (int)(1e9+10)
#define LLINF (lint)(1e18+10)

using namespace std;

int main(){
    int N;
    lint W;
    cin >> N >> W;
    int w, v;
    cin >> w >> v;
    lint w1 = w, w2 = w+1, w3 = w+2, w4 = w+3;
    vector<int> wa, wb, wc, wd;
    wa.push_back(v);
    rep(i, N-1){
        cin >> w >> v;
        if(w == w1){
            wa.push_back(v);
        }else if(w == w2){
            wb.push_back(v);
        }else if(w == w3){
            wc.push_back(v);
        }else{
            wd.push_back(v);
        }
    }
    SORT_INV(wa);
    SORT_INV(wb);
    SORT_INV(wc);
    SORT_INV(wd);
    vector<int> sum1(wa.size()+1, 0), sum2(wb.size()+1, 0), sum3(wc.size()+1, 0), sum4(wd.size()+1, 0);
    rep(i, wa.size()){
        sum1[i+1] = sum1[i] + wa[i];
    }
    rep(i, wb.size()){
        sum2[i+1] = sum2[i] + wb[i];
    }
    rep(i, wc.size()){
        sum3[i+1] = sum3[i] + wc[i];
    }
    rep(i, wd.size()){
        sum4[i+1] = sum4[i] + wd[i];
    }
    int ans = 0;
    for(lint i = 0 ; i <= wa.size() ; i++){
        if(i*w1 > W){
            break;
        }
        for(lint j = 0 ; j <= wb.size() ; j++){
            if(i*w1 + j*w2 > W){
                break;
            }
            for(lint k = 0 ; k <= wc.size() ; k++){
                if(i*w1 + j*w2 + k*w3 > W){
                    break;
                }
                for(lint l = 0 ; l <= wd.size() ; l++){
                    if(i*w1 + j*w2 + k*w3 + l*w4 > W){
                        break;
                    }
                    ans = max(ans, sum1[i] + sum2[j] + sum3[k] + sum4[l]);
                }
            }
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
template <typename T>
T gcd(
  T a
  , T b
)
{
  T r;
  while (0 != (r = a%b))
  {
    a = b;
    b = r;
  }
  return b;
}

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

#include <algorithm>
#include <iostream>
using namespace std;

int main()
{
  int N;
  cin >> N;
  cout << lcm(std::max(2, N), std::min(2, N));
  return 0;
}


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

int main() {
  int N; 
  cin >> N; 
  int S = 0; 
  for (int i = 0; i < N; i++) {
  int a, b; 
  cin >> a >> b; 
  S += b - a + 1; 
  }
  cout << S << endl;
}

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

bool isPalindrome(string s) {
    string a = s;
    reverse(s.begin(), s.end());
    return a == s;
}

int main() {
    string s;
    cin >> s;
    int n = s.length();
    string s1 = s, s2 = s.substr(0, (n - 1) / 2), s3 = s.substr((n + 3) / 2 - 1, (n - 3) / 2 + 1);
    if(isPalindrome(s1) && isPalindrome(s2) && isPalindrome(s3))
        cout << "Yes" << endl;
    else
        cout << "No" << endl;
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <map>
#include <utility>
#include <iomanip>
#include <cmath>
using namespace std;
#define REP(i,n) for (int i=0;i<(n);++i)
#define rep(i,a,b) for(int i=a;i<(b);++i)
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;}
using ll = long long;
constexpr ll INF = 1LL << 60;
constexpr ll MOD = 1e9 + 7;


int main() {
    cin.tie(0); ios_base::sync_with_stdio(false);
    ll a,b;cin>>a>>b;
    ll ans = INF;
    if( a <=  b) chmin(ans,b-a);
    if(-a <=  b) chmin(ans,a+b+1);
    if( a <= -b) chmin(ans,-b-a+1);
    if(-a <= -b) chmin(ans,a-b+2);
    cout << ans << '\n';
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <vector>
 
using namespace std;
const double PI=3.14159265358979323846;
#define ll long long;
#define SIZE_OF_ARRAY(array) (sizeof(array)/sizeof(array[0]))
#define rep(i, n) for (int i = 0; i < (n); ++i)

int digitNum(int value, int dig) {
	rep(i, dig - 1) { 
		value /= 10;

	}
	return value % 10;
}

int main() {

	int n;
	cin >> n;

	string ans = "";

	for (int i = 0; i < (1 << 3); i++) {

		int sum = digitNum(n, 4);
		ans = to_string(sum);
		rep(j, 3) {

			if (i & (1 << j)) {
				sum += digitNum(n, 3 - j);
				ans += "+" + to_string(digitNum(n, 3 - j));
			} else {
				sum -= digitNum(n, 3 - j);
				ans += "-" + to_string(digitNum(n, 3 - j));
			}
		}

		if (sum == 7) {
			ans += "=7";
			printf("%8s\n", ans.c_str());
			return 0;
		}
	}
}

//printf("%ld\n", ans);

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

using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
#define a first
#define b second
#define sz size()
#define pb(x) push_back(x) 
#define bg begin()
#define ed end()
#define rep(i,n) for(ll i=0;i<n;i++)
#define rep1(i,n) for(ll i=1;i<=n;i++)
#define mp(x,y) make_pair(x,y)
const ll MOD=1000000007;

vector<ll> pw2(51,1);
vector<ll> pw10(19,1);

ll maxx(ll x,ll y,ll z){
	return max(max(x,y),z);
}
ll minn(ll x,ll y,ll z){
	return min(min(x,y),z);
}
ll gcd(ll x,ll y){
	if(x%y==0) return y;
    else return gcd(y,x%y);
}
ll lcm(ll x,ll y){
	return x*(y/gcd(x,y));
}
ll myceil(ll x,ll y){
	if(x<=y) return 1;
	else if(x%y==0) return x/y;
	else return x/y+1;
}

//a,b x
int main(){
	//rep1(i,50) pw2[i]=2*pw2[i-1];
	//rep1(i,18) pw10[i]=10*pw10[i-1];
	ll N,M; cin>>N>>M;
	char A[50][50];
	char B[50][50];
	rep(i,N){
		string tmp; cin>>tmp;
		rep(j,N) A[i][j]=tmp[j];
	}
	rep(i,M){
		string tmp; cin>>tmp;
		rep(j,M) B[i][j]=tmp[j];
	}
	//M<=N
	bool ans=true;
	rep(i,N-M+1){
		rep(j,N-M+1){
			//B[0][0]==A[i][j]
			rep(y,M)rep(x,M){
				if(B[x][y]==A[i+x][j+y]) continue;
				else ans=false;
			}
			if(ans){
				cout<<"Yes";
				return 0;
			}
			else ans=true;
		}
	}	
	cout<<"No";	
}

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

using namespace std;

int main()
{int N,M;
 cin >> N >> M;
 vector<int> A(N),B(N);
 for(int i = 0; i < N; i++)
 {cin >> A.at(i) >> B.at(i);}
 
 vector<pair<int,int>> AB(N);
 for(int j = 0; j < N; j++)
 {AB[j] = make_pair(A[j],B[j]);}
 
 sort(AB.begin(),AB.end());
 //ペアABを、Aが小さい順にソートした。
 long long sum = 0;
 int  buy;
 
 for(int i = 0; i < N; i++)
 { buy = min(M,AB.at(i).second);
   sum += (long long) buy*AB[i].first;
  M -=buy;}
 
 cout << sum <<endl;
}

Measured memory_bytes: 1792
import java.io.IOException;
import java.io.InputStream;
import java.util.*;
import java.lang.Math;
import java.math.*;

public class Main {
    public static void main(String[] args) {
        FS reader = new FS();
        // write reader
        String S = reader.next();
        int cnt = 0;
        for (int i=0; i<S.length()/2; i++) {
            if (S.charAt(i) != S.charAt(S.length()-i-1)) cnt++;
        }
        System.out.println(cnt);
    }

    // Read Class
    static class FS {
        private final InputStream in = System.in;
        private final byte[] buffer = new byte[1024];
        private int ptr = 0;
        private int buflen = 0;
        private boolean hasNextByte() {
            if (ptr < buflen) {
                return true;
            } else {
                ptr = 0;
                try {
                    buflen = in.read(buffer);
                } catch (IOException e) {
                    e.printStackTrace();
                }
                if (buflen <= 0) {
                    return false;
                }
            }
            return true;
        }
    
        private int readByte() { return hasNextByte() ? buffer[ptr++] : -1;}
        private boolean isPrintableChar(int c) {return 33 <= c && c <= 126;}
        private void skipUnprintable() {while(hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++;}
    
        public boolean hasNext() { skipUnprintable(); return hasNextByte();}
        public String next() {
            if (!hasNext()) throw new NoSuchElementException();
            StringBuilder sb = new StringBuilder();
            int b = readByte();
            while(isPrintableChar(b)) {
                sb.appendCodePoint(b);
                b = readByte();
            }
            return sb.toString();
        }
        public int nextInt() {
            return (int)nextLong();
        }
        public long nextLong() {
            if (!hasNext()) throw new NoSuchElementException();
            long n = 0;
            boolean minus = false;
            int b = readByte();
            if (b == '-') {
                minus = true;
                b = readByte();
            }
            if (b < '0' || '9' < b) {
                throw new NumberFormatException();
            }
            while(true) {
                if ('0' <= b && b <= '9') {
                    n *= 10;
                    n += b - '0';
                } else if(b == -1 || !isPrintableChar(b)) {
                    return minus ? -n : n;
                } else {
                    throw new NumberFormatException();
                }
                b = readByte();
            }
        }
    }
}



Measured memory_bytes: 20948
s = gets.chomp
count = 0
flag = true

while s.length > 2 && flag
	flag = false
	for i in 1 .. s.length-2
		if s[i-1] != s[i+1]
			s.slice!(i)
			count += 1
			flag = true
			break
		end
	end
end

if count % 2 == 1
	puts "First"
else
	puts "Second"
end

Measured memory_bytes: 2044
#include <iostream>
#include <iomanip>
#include <cmath>
#include <functional>
#include <algorithm>
#include <numeric>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <deque>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <boost/range/irange.hpp>
#include <boost/range/adaptor/reversed.hpp>
#include <boost/container/static_vector.hpp>
#include <boost/utility/string_ref.hpp>
#include <boost/multiprecision/cpp_int.hpp>
#include <boost/math/common_factor_rt.hpp>

template <class... Args>
struct tuple_input_impl;
template <std::size_t i, std::size_t... tail>
struct tuple_input_impl<std::index_sequence<i, tail...>>
{
    template <class... Args>
    static void f(std::tuple<Args...>& x)
    {
        std::cin >> std::get<i>(x);
        tuple_input_impl<std::index_sequence<tail...>>::f(x);
    }
};
template <>
struct tuple_input_impl<std::index_sequence<>>
{
    static void f(...) {}
};

template <class... Args>
std::istream& operator>>(std::istream& in, std::tuple<Args...>& x)
{
    tuple_input_impl<std::index_sequence_for<Args...>>::f(x);
    return in;
}
template <class T1, class T2>
std::istream& operator>>(std::istream& in, std::pair<T1, T2>& x) { return in >> x.first >> x.second; }

template <class T>
T read()
{
    T res;
    std::cin >> res;
    return res;
}
template <class T>
std::vector<T> read(std::size_t n)
{
    std::vector<T> res(n);
    for (std::size_t i = 0; i < n; ++i) std::cin >> res[i];
    return res;
}

template <class T>
void out_impl(T&& v) { std::cout << std::forward<T>(v); }
template <class T, class... Args>
void out_impl(T&& v, Args&&... args)
{
    std::cout << std::forward<T>(v) << ' ';
    out_impl(std::forward<Args>(args)...);
}
template <class... Args>
void out(Args&&... args)
{
    out_impl(std::forward<Args>(args)...);
    std::cout << '\n';
}
template <class... Args>
void out_noreturn(Args&&... args) { out_impl(std::forward<Args>(args)...); }

template <class T>
void print(const T& container)
{
    bool first = true;
    for (auto&& x : container) {
        if (!first) std::cout << ' ';
        std::cout << x;
        first = false;
    }
    std::cout << '\n';
}

void prog()
{
    int d;
    std::cin >> d;
    if (d == 25) {
        out("Christmas");
    }
    if (d == 24) {
        out("Christmas Eve");
    }
    if (d == 23) {
        out("Christmas Eve Eve");
    }
    if (d == 22) {
        out("Christmas Eve Eve Eve");
    }
}

int main()
{
    std::cin.tie(nullptr);
    std::ios::sync_with_stdio(false);
    std::cout << std::fixed << std::setprecision(15);
    prog();
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n - 1; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define FORR(i, m, n) for(int i = m; i >= n; i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define ll long long
#define pb(a) push_back(a)

ll mod = 1e09;

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

  char c[3][3];
  REP(i, 3){
    REP(j, 3){
      cin >> c[i][j];
      if(i == j) cout << c[i][j];
    }
  }
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define pb push_back 
#define pf push_front 
#define mp make_pair
#define fr first
#define sc second
#define Rep(i,n) for(int i=0;i<(n);i++)
#define All(v) v.begin(),v.end()
typedef pair<int, int> Pii; typedef pair<int, Pii> Pip;
const int INF = 1107110711071107;


main()
{
  int a, b, c;
  cin >> a >> b >> c;
  if( (a * 100 + b * 10 + c) % 4 == 0 ) cout << "YES" << endl;
  else cout << "NO" << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define rem(i, m, n) for (int i = m; i < (n); i++)
#define eps (1e-7)
#define inf (1e9)
#define pi (acos(-1))
typedef long long ll;
typedef vector<int> vi;
typedef vector<long long> vl;
typedef vector<double> vd;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

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

    int n, d;
    cin >> n >> d;
    vector<vector<int>> x(n, vector<int>(d));
    rep(i, n)
    {
        rep(j, d)
        {
            cin >> x[i][j];
        }
    }

    int count = 0;
    rep(i, n)
    {
        rem(j, i + 1, n)
        {
            double dis = 0;
            rep(k, d)
            {
                dis += (x[i][k] - x[j][k]) * (x[i][k] - x[j][k]);
            }
            dis = sqrt(dis);
            if (floor(dis) == dis)
                count++;
        }
    }

    cout << count << "\n";

    return 0;
}

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

public class Main{
	public static void main(String[] args)throws IOException{
		InputStreamReader isr = new InputStreamReader(System.in);
		BufferedReader reader = new BufferedReader(isr);
		double[] x = new double[20];
		double[] y = new double[20];
		int i = 0;
		String string;
		
		while((string = reader.readLine()) != null){
			x[i] = Double.valueOf(string.split(",")[0]);
			y[i] = Double.valueOf(string.split(",")[1]);
			i++;
		}
		
		double a = Math.hypot(x[1] - x[0], y[1] - y[0]);
		double b = Math.hypot(x[2] - x[0], y[2] - y[0]);
		double c = Math.hypot(x[2] - x[1], y[2] - y[1]);
		double z = (a + b + c) / 2;
		double S = Math.sqrt(z * (z - a) * (z - b) * (z - c));
		for(int j = 2; j < i - 1; j++){
			a = Math.hypot(x[j] - x[0], y[j] - y[0]);
			b = Math.hypot(x[j + 1] - x[0], y[j + 1] - y[0]);
			c = Math.hypot(x[j + 1] - x[j], y[j + 1] - y[j]);
			z = (a + b + c) / 2;
			S += Math.sqrt(z * (z - a) * (z - b) * (z - c));
		}
		System.out.println(S);
	}
}

Measured memory_bytes: 24256