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

#define rep(i, j) for (int i = 0; i < j; i++)
#define all(obj) (obj).begin(), (obj).end()
#define rall(obj) (obj).rbegin(), (obj).rend()
typedef long long int ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vi> vvi;
typedef vector<pii> vpii;

// const unsigned long long B = 1000000007;
const unsigned long long B = 10000000000000061ULL;

int main() {

    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.precision(10);
    cout << fixed;

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

    int ans = 0;
    // (len, start idx) -> hash 
    // map<int, map<int, ll>> h;
    for (int i = 1; i < n; i++) {
        unordered_map<unsigned long long, pair<int, int>> h2;
        unsigned long long val = 0;
        unsigned long long t = 1;
        for (int j = 0; j < i; j++) t *= B;
        for (int k = 0; k < i; k++) val = val * B + s[k];
        h2[val] = {i, 0};
        // cout << "init " << val << endl;
        for (int j = 0; i + j < n; j++) {
            val = val * B + s[i + j];
            val -= t * s[j];
            // h[i][j + 1] = val;
            // cout << i << " " << j + 1 << " " << val << endl;
            auto it = h2.find(val);
            if (it != h2.end()) {
                // cout << val << endl;
                // cout << i << " " << j + 1 << " " << it->second.first << " " << it->second.second << endl;
                if (it->second.first + it->second.second <= j + 1) ans = max(ans, it->second.first);
            } else {
            // else {cout << i << " " << j << " val: " << val << endl;}
                h2[val] = {i, j + 1};
            }
            // auto it = h2.find(val);
            // if (it != h2.end()) ans = max(ans, it->second.first);
        }
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 604
#include<bits/stdc++.h>
using namespace std;
char a;
int main()
{
   //freopen(".in","r",stdin);
   //freopen(".out","w",stdout);>
   cin>>a;
   if(a=='a'||a=='e'||a=='i'||a=='o'||a=='u')
   {
   	cout<<"vowel";
   }
   else
   {
   	cout<<"consonant";
   }
   
   
   return 0;
}



Measured memory_bytes: 256
def d_iroha_and_a_grid(MOD=10**9 + 7):
    class Combination(object):
        """参考: https://harigami.net/contents?id=5f169f85-5707-4137-87a5-f0068749d9bb"""
        __slots__ = ["mod", "factorial", "inverse"]

        def __init__(self, max_n: int = 10**6, mod: int = 10**9 + 7):
            fac, inv = [1], []
            fac_append, inv_append = fac.append, inv.append

            for i in range(1, max_n + 1):
                fac_append(fac[-1] * i % mod)

            inv_append(pow(fac[-1], mod - 2, mod))

            for i in range(max_n, 0, -1):
                inv_append(inv[-1] * i % mod)

            self.mod, self.factorial, self.inverse = mod, fac, inv[::-1]

        def comb(self, n, r):
            if n < 0 or r < 0 or n < r:
                return 0
            return self.factorial[n] * self.inverse[r] * self.inverse[n - r] % self.mod

    H, W, A, B = [int(i) for i in input().split()]
    c = Combination(max_n=H + W)
    # 左上のマスの座標を(0,0)としたとき、B<=i<=W-1を満たすiについて、
    # (0,0)→(H-A-1,i)への行き方 * (H-A-1,i)→(H-A,i)への行き方(1通り) *
    # (H-A,i)→(H-1,W-1)への行き方 の値の総和を取る(10**9+7で剰余を取る)
    ans = sum([c.comb(H - A - 1 + i, H - A - 1)
               * c.comb(A - 1 + W - 1 - i, A - 1) for i in range(B, W)])
    return ans % MOD

print(d_iroha_and_a_grid())

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

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

	int ans = INT_MAX;
	for(int i=1; i<=100; i++)
	{
		int ss = 0;
		for(int j=0; j<n; j++)
		{
			ss = ss + (a[j]-i)*(a[j]-i);
		}
		ans = min(ans, ss);
	}
	cout<<ans<<endl;
	return 0;
}

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

int main() {
    ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);
    int n;
    string s;
    cin >> n >> s;
    for (int i = 0; i < s.size(); i++)
        s[i] = (s[i] - 'A' + n) % 26 + 'A';
    cout << s << "\n";
    return 0;
}

Measured memory_bytes: 256
import java.io.IOException;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) throws IOException {

		Scanner in = new Scanner(System.in);
		int q = in.nextInt();
		char[][] x = new char[q][];
		char[][] y = new char[q][];

		for (int i = 0; i < q; i++) {
			x[i] = in.next().toCharArray();
			y[i] = in.next().toCharArray();
		}

		for (int i = 0; i < q; i++) {
			// dp
			int[][] dp = new int[x[i].length+1][y[i].length+1];
			for (int j = 0; j < x[i].length; j++) {
				for (int l = 0; l < y[i].length; l++) {
					if (x[i][j] == y[i][l]) {
						dp[j+1][l+1] = dp[j][l]+1;
					} else {
						dp[j+1][l+1] = Math.max(dp[j+1][l], dp[j][l+1]);
					}
				}
			}
			System.out.println(dp[x[i].length][y[i].length]);
		}

	}
}



Measured memory_bytes: 64128
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = s; i < (int)(n); i++)
#define all(obj) obj.begin(), obj.end()
#define db(x) cerr << #x << ":" << x << " "
#define dbl(x) cerr << #x << ":" << x << "\n"
#define dbv(vec) cerr << #vec << ":"; for (auto e : vec) cerr << e << " "; cout << "\n"
#define dbvv(vv) cerr << #vv << ":\n"; for (auto vec : vv) { for (auto e : vec) cerr << e << " "; cerr << endl; }
#define YN(f) cout << (f ? "YES" : "NO") << endl
#define Yn(f) cout << (f ? "Yes" : "No") << endl
#define yn(f) cout << (f ? "yes" : "no") << endl
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using pii = pair<int, int>;

int main() {
	ll N, K; cin >> N >> K;
	vector<pair<ll, ll>> v;
	rep(i, N) {
		ll a, b; cin >> a >> b;
		pair<ll, ll> p(a, b);
		v.push_back(p);
	}
	sort(all(v));
	ll x = 0; // 累計個数
	rep(i, N) {
		x += v.at(i).second;
		// db(v.at(i).first); db(v.at(i).second); dbl(x);
		if (x >= K) {
			cout << v.at(i).first << endl;
			break;
		}
	}
}


Measured memory_bytes: 2420
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define sz(x) (int)(x.size())
#define fi first
#define se second
#define pii pair<int, int>
const int N = 2e5 + 10;

signed main() {
    ios::sync_with_stdio(false); cin.tie(nullptr);
    int n;
    cin >> n;
    int a[n];
    int b[n];
    for(int i = 0; i < n; i++) {
        cin >> a[i];
        b[i] = a[i];
    }
    sort(b , b + n);
    for(int i = 0; i < n; i++) {
        int mid = n / 2 - 1;
        if(a[i] <= b[mid]) {
            cout << b[mid + 1] << "\n";
        }else {
            cout << b[mid] << "\n";
        }
    }
}

Measured memory_bytes: 5376
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <utility>
#include <cstring>
#include <iomanip>
#include <numeric>
#include <limits>
#include <cmath>
#include <cassert>

using namespace std;
using ll = long long;

const int INF = 1<<30;
const int MOD = (int)1e9 + 7;
const int MAX_N = (int)1e5 + 5;
#define debug(x) cout << #x << ": " << x << endl

int N;

int compress(vector<int> &a, vector<int> &b, vector<int> &res)
{
    for(int i = 0; i < N; i++)
    {
        res.push_back(a[i]);
        res.push_back(b[i]);
    }
    sort(res.begin(), res.end());
    res.erase(unique(res.begin(), res.end()), res.end());
    for(int i = 0; i < N; i++)
    {
        a[i] = lower_bound(res.begin(), res.end(), a[i]) - res.begin();
        b[i] = lower_bound(res.begin(), res.end(), b[i]) - res.begin();
    }
    return res.size();
}

signed main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    cin >> N;
    vector<int> x1, y1, x2, y2;
    for(int i = 0; i < N; i++)
    {
        int a, b, c, d; cin >> a >> b >> c >> d;
        x1.push_back(a);
        y1.push_back(b);
        x2.push_back(c);
        y2.push_back(d);
    }

    vector<int> X, Y;
    int W = compress(x1, x2, X), H = compress(y1, y2, Y);
    int table[H + 1][W + 1] = {};
    for(int k = 0; k < N; k++)
    {
        for(int i = y1[k]; i < y2[k]; i++)
        {
            for(int j = x1[k]; j < x2[k]; j++) table[i][j] = true;
        }
    }

    ll ans = 0;
    for(int i = 0; i < H - 1; i++)
    {
        for(int j = 0; j < W - 1; j++)
        {
            if(not table[i][j]) continue;
            ans += ll(Y[i + 1] - Y[i]) * ll(X[j + 1] - X[j]);
        }
    }
    cout << ans << endl;
    return 0;
}




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

using namespace std;

int main(){

    int a, b;

    cin >> a >> b;

    if(a > 8 || b > 8){
        cout << ":(" << endl;
    }else{
        cout << "Yay!" << endl;
    }

    return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <algorithm>
#define maxn 100005

using namespace std;

inline long long read()
{
    long long x = 0;
    int f = 1;
    char ch = getchar();
    for(; ch < '0' || ch > '9'; ch = getchar())
        if(ch == '-')
            f = -1;
    for(; ch >= '0' && ch <= '9'; ch = getchar())
        x = x * 10 + (long long)ch - '0';
    return (long long)x * f;
}

int n, m, f[60][maxn];
long long k, er[60], p[maxn], d[maxn], a[maxn], b[maxn];

int getans(int x)
{
    for(register int i = 59; i >= 0; i -= 1)
        if(k & er[i])
            x = f[i][x];
    return x;
}

int main()
{
    int r;
    n = read();
    for(register int i = 1; i <= n; i += 1)
        p[i] = read(), d[i] = p[i] - p[i-1];
    m = read();
    k = read();
    for(register int i = 1; i <= n; i += 1)
        a[i] = i;
    for(register int i = 1; i <= m; i += 1)
        r = read(), swap(a[r], a[r+1]);
    for(register int i = 1; i <= n; i += 1)
        f[0][a[i]] = i;
    er[0] = 1;
    for(register int i = 1; i <= 59; i += 1)
        er[i] = er[i-1] * 2;
    for(register int i = 1; i <= 59; i += 1)
        for(register int j = 1; j <= n; j += 1)
            f[i][j] = f[i-1][f[i-1][j]];
    for(register int i = 1; i <= n; i += 1)
        a[i] = getans(i);
    for(register int i = 1; i <= n; i += 1)
        b[a[i]] = i;
    for(register int i = 1; i <= n; i += 1)
        p[i] = p[i-1] + d[b[i]], printf("%lld.0\n", p[i]);
    return 0;
}

Measured memory_bytes: 27904
#include<bits/stdc++.h>
using namespace std;
typedef pair<long long,long long>lp;
typedef pair<string,lp>P;
main(){
  long long j,y;
  cin>>j>>y;
  priority_queue<P,vector<P>,greater<P> > que;
  que.push(P("",lp(0,0)));
  while(!que.empty()){
    P now=que.top();
    que.pop();
    if(now.second.first==j&&now.second.second==y){
      cout<<now.first<<endl;
    }
    if(now.second.first<=5&&now.second.second<=5&&((now.second.first<=4&&now.second.second<=4)||(now.second.first>=4&&now.second.second>=4))){
      if(now.second.first+1<=j){
	que.push(P(now.first+"A",lp(now.second.first+1,now.second.second)));
      }
      if(now.second.second+1<=y){
	que.push(P(now.first+"B",lp(now.second.first,now.second.second+1)));
      }
    }
  }
}

Measured memory_bytes: 3172
input()
A = list(map(int, input().split()))
flag = True
cnt = 0

for j in range(999999):
  for i in A:
    if i % 2 != 0:
      flag = False
  if flag:
    A = [a/2 for a in A]
    cnt += 1
  else:
    break
print(cnt)

Measured memory_bytes: 3060
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

		//int a = sc.nextInt();
		//List<Integer> check=new ArrayList<Integer>();
		//array = new int[h+1][w+1];
		List<Integer> list=new ArrayList<Integer>();
		//List<String> list= new ArrayList<String>(Arrays.asList(s.split("")));
		//Collections.reverse(list);

		int a = sc.nextInt();

		int answer = (int)Math.pow(a, 2);

		System.out.println((int)3*answer);
	}

}


Measured memory_bytes: 21716
#include<bits/stdc++.h>
using namespace std;
const long long mo=1e9+7;
int n,m,a[2001],b[2001];
long long jp[2001][2001];
int main()
{
    cin>>n>>m;
    for(int i=1;i<=n;i++)
    cin>>a[i];
    for(int i=1;i<=m;i++)
    cin>>b[i];
    for(int i=1;i<=n;i++)
    for(int j=1;j<=m;j++)
    {   
        jp[i][j]=(jp[i-1][j]+jp[i][j-1]-jp[i-1][j-1])%mo;
        if(a[i]==b[j])
    	jp[i][j]+=(jp[i-1][j-1]+1),jp[i][j]%=mo;
    }
    cout<<(jp[n][m]%mo+1+mo)%mo;
    return 0;
}

Measured memory_bytes: 31488
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,sse3,sse4,popcnt,abm,mmx")

//#include<bits/stdc++.h>
#include <map>
#include <set>
#include <list>
#include <cmath>
#include <ctime>
#include <deque>
#include <queue>
#include <stack>
#include <string>
#include <bitset>
#include <cstdio>
#include <limits>
#include <vector>
#include <climits>
#include <cstring>
#include <cstdlib>
#include <fstream>
#include <numeric>
#include <sstream>
#include <cassert>
#include <iomanip>
#include <iostream>
#include <algorithm>
#include <unordered_set>
#include <unordered_map>

#define _USE_MATH_DEFINES
#define ll long long
#define ins Not Needed Thing
#define ull unsigned long long
#define ld long double
#define Accepted 0
#define pb push_back
#define pii pair<int,int>
#define pll pair<ll,ll>
#define mp make_pair
#define sz(x) (int)(x.size())
#define all(x) x.begin(),x.end()
#define F first
#define S second
#define SORRY FUL Accepted 
#define SpeedForce ios_base::sync_with_stdio(0), cin.tie(0)
#define Toktama Kazakhstan 

using namespace std;

const double eps = 0.000001;
const ld pi = acos(-1);
const int maxn = 1e7 + 9;
const int mod = 1e9 + 7;
const ll MOD = 1e18 + 9;
const ll INF = 1e18 + 123;
const int inf = 2e9 + 11;
const int mxn = 1e6 + 9;
const int N = 2e5 + 123;                                          
const int PRI = 555557;
const int pri = 997;

int tests = 1;
int t[N * 4];
int b[N];
int a[N];
int n;

void upd (int pos, int x, int v = 1, int tl = 1, int tr = n) {
	if (tl == tr) {
		t[v] += x;
		return ;
	}

	int tm = (tl + tr) >> 1;
	if (pos <= tm) upd (pos, x, (v << 1), tl, tm);
	else upd (pos, x, (v << 1) | 1, tm + 1, tr);

	t[v] = t[(v << 1)] + t[(v << 1) | 1];
}

int get (int kth, int v = 1, int tl = 1, int tr = n) {
	if (tl == tr) return tl;
	int tm = (tl + tr) >> 1;
	if (t[(v << 1)] >= kth) return get(kth, (v << 1), tl, tm);
	else return get(kth - t[(v << 1)], (v << 1) | 1, tm + 1, tr);
}

inline void Solve () {
	//easy
	cin >> n;
	for (int i = 1; i <= n; i ++) {
		cin >> a[i];
		b[i] = a[i];
	}	

	sort(b + 1, b + 1 + n);

	for (int i = 1; i <= n; i ++) {
		a[i] = lower_bound(b + 1, b + n + 1, a[i]) - b;
		upd (a[i], 1);
	}

	for (int i = 1; i <= n; i ++) {
		upd(a[i], -1);
		int kth = n - (n / 2);
		cout << b[get(kth)] << '\n';
		upd(a[i], 1);
	}
}

int main () {
	SpeedForce;
//	freopen(".in", "r", stdin);
//	freopen(".out", "w", stdout);	
	// cin >> tests;
	while(tests --) {
		Solve ();
		// Ee Zadrot
	}

	return Accepted; 
}

Measured memory_bytes: 6272
#include <iostream>
using namespace std;
int main(void){
    long long n,a,b,c=1,d=0;
    cin>>n>>b;
    for(int i=1;i<n;i++){
        cin>>a;
        if((a-b)*d<0){
            c++;
            d=0;
        }else if(d==0){
            d=a-b;
        }
        
        
        b=a;
    }
    cout<<c<<endl;
}


Measured memory_bytes: 256
#include <cstdio>
#include <cstring>
#include <string>
#include <cmath>
#include <cassert>
#include <iostream>
#include <algorithm>
#include <stack>
#include <queue>
#include <vector>
#include <set>
#include <map>
#include <bitset>
#include <functional>
#include <numeric>
using namespace std;

#define repl(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define rep(i,n) repl(i,0,n)
#define mp(a,b) make_pair((a),(b))
#define pb(a) push_back((a))
#define all(x) (x).begin(),(x).end()
#define dbg(x) cout<<#x"="<<((x))<<endl
#define fi first
#define se second

#define INF 2147483600
#define long long long

int main(){
  char c; scanf("%c", &c);
  if(c=='a' || c=='i' || c=='u' || c=='e' || c=='o') printf("vowel\n");
  else printf("consonant\n");

  return 0;
}


Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using static System.Convert;
using static System.Console;
using static System.Math;
class MainClass
{
	static void Main(string[] args)
	{
		Answer();
	}
	public static void Answer()
	{
      string[] arr = Console.ReadLine().Split(' ');
      var N = int.Parse(arr[0]);
      var X = int.Parse(arr[1]);
      var minM = 100000;
      var ans = 0;
      for(int i = 0; i < N; i++)
      {
        var tmpM = int.Parse(Console.ReadLine());
        X -= tmpM;
        ans++;
        if (tmpM < minM)
          minM = tmpM;
      }
      while (minM <= X)
      {
        X -= minM;
        ans++;
      }
      Console.WriteLine(ans);
	}
}

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

int main()
{
    vector<int> nums(3);
    for (int i = 0; i < 3; i++)
    {
        cin >> nums.at(i);
    }
    sort(nums.begin(), nums.end());

    int cnt = 0;
    while (true)
    {
        if (nums.at(0) == nums.at(1) && nums.at(1) == nums.at(2))
        {
            cout << cnt << endl;
            return 0;
        }

        if (nums.at(2) - nums.at(0) > 1)
        {
            nums.at(0) += 2;
        }
        else
        {
            nums.at(0) += 1;
            nums.at(1) += 1;
        }

        cnt++;

        sort(nums.begin(), nums.end());
    }
}

Measured memory_bytes: 768
N,M= list(map(int,input().split()))
dot=[1]*N
sw=[0] * N
sw[0]=1
for i in range(M):
   a,b=list(map(int,input().split()))
   a-=1;b-=1
   dot[a]-=1
   dot[b]+=1
   if sw[a]:
      sw[b]=1
   if dot[a] == 0:
      sw[a]=0
print(sw.count(1))

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

int main()
{
    ll n, ans = 0;

    cin >> n;

    if(n % 2 == 1 || n < 10){
        cout << 0 << endl;
        return 0;
    }

    ll a = 5;

    while((n / a) > 0){
        ll b = (n / a) - 1;
        ans += b / 2;

        if(b % 2 == 1) ans++;

        a *= 5;
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256
#include<cstdio>
#include<iostream>
#include<cmath>
#include<algorithm>
#include<string>
#include<cstring>
#include<cctype>
#include<queue>
#include<stack>
#include<map>
#include<set>
#include<iomanip>
#include<sstream>
#include<vector>
#include<cstdlib>
#include<ctime>
#include<list>
#include<deque>
#include<bitset>
#include<fstream>
#define ld double
#define ull unsigned long long
#define ll long long
#define pii pair<int,int >
#define iiii pair<int,pii >
#define mp make_pair
#define INF 1000000000
#define MOD 1000000007
#define rep(i,x) for(int (i)=0;(i)<(x);(i)++)
inline int getint(){
    int x=0,p=1;char c=getchar();
    while (c<=32)c=getchar();
    if(c==45)p=-p,c=getchar();
    while (c>32)x=x*10+c-48,c=getchar();
    return x*p;
}
using namespace std;
//ruogu
int n,m;
string s1,s2;
//
ll lcm(int x,int y){return 1ll*x*y/__gcd(x,y);}
int main(){
	n=getint();m=getint();
	cin>>s1>>s2;
	ll g=lcm(n,m);
	int p1=0,p2=0;
	while(p1<n&&p2<m){
		if(s1[p1]!=s2[p2])return !printf("%d\n",-1);
		p1+=g/m;
		p2+=g/n;
	}
	printf("%lld\n",g);
	return 0;
}

Measured memory_bytes: 768
#include<bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < n; ++i)
#define rrep(i,n) for (int i = n-1; i >= 0; i--)
#define rep2(i,s,n) for (int i = s; i < n; ++i)
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define tmax(a,b,c) max(a,max(b,c))
#define tmin(a,b,c) min(a,min(b,c))
#define pb push_back
#define eb emplace_back
#define vi vector<int>
#define vvi vector<vector<int>>
#define vl vector<ll>
#define vs vector<string>
#define vc vector<char>
#define vb vector<bool>
#define vp vector<P>
using namespace std;
using ll = long long;
using P = pair<int,int>;
using LP = pair<ll,ll>;
template<class T> istream& operator>>(istream& is,vector<T>& v) { for(T& t:v){is>>t;} return is; }
template<class T> ostream& operator<<(ostream& os,const vector<T>& v) { for(T t:v){os<<t<<" ";} os<<"\n"; return os; }
void Yes(bool b) { cout << (b ? "Yes" : "No") << endl; }
void YES(bool b) { cout << (b ? "YES" : "NO") << 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;}
const int inf = 1001001001;
const ll linf = 1001001001001001001;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr); cout.tie(nullptr);
    int w,h,x,y;
    cin >> w >> h >> x >> y;
    double ans = (ll)w*h/2.0;
    cout << ans << endl;
    if(w%2 == 0 && h%2 == 0 && w/2 == x && h/2 == y) {
        cout << 1 << endl;
    } else cout << 0 << endl;
}


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

int main() {
	int n;
	cin >> n;
	int count = 0, ans = 0;


	for(int i = 0; i < n; i++) {
		int x, y;
		cin >> x >> y;
		if(x == y) {
			count++;
		} else {
			count = 0;
		}
		if(count == 3) {
			ans = 1; 
		}
	}

	if(ans) {
		cout << "Yes" << endl;
	} else {
		cout << "No" << endl;
	}
	return 0;
}

Measured memory_bytes: 3600
#include<bits/stdc++.h>
using namespace std;
#define ll unsigned long long 
int main(){
  int n,k;
  cin>>n>>k;
  int arr[n];
  for(int i=0; i<n; i++)	cin>>arr[i];
  sort(arr, arr+n);
  ll sum=0;
 for(int i=0; i<k; i++){
 	sum+=arr[i];
 }
 cout<<sum;
  return 0;
}

Measured memory_bytes: 3576
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <iostream>
#include <vector>
#include <string>
#include <sstream>
#include <algorithm>
#include <utility>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <functional>

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> pii;
typedef vector<pii> vpii;

#define fst first
#define scd second
#define PB push_back
#define MP make_pair
#define rep(i,x) for(int i=0;i<(x);++i)
#define rep1(i,x) for(int i=1;i<=(x);++i)
#define rrep(i,x) for(int i=(x)-1;i>=0;--i)
#define rrep1(i,x) for(int i=(x);i>=1;--i)
#define FOR(i,a,x) for(int i=(a);i<(x);++i)
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()

#define omajinai ios::sync_with_stdio(false);cin.tie(0)

template<typename T>bool chmax(T&a,T b){if(a<b){a=b;return true;}return false;}
template<typename T>bool chmin(T&a,T b){if(a>b){a=b;return true;}return false;}
template<typename T>T get(){T a;cin>>a;return a;}
template<typename T>T rev(T a){reverse(all(a));return a;}
template<typename T>istream&operator>>(istream&is,vector<T>&vec){rep(i,vec.size())is>>vec[i];return is;}
template<typename T>vector<T>&sort(vector<T>&a){sort(all(a));return a;}

const int inf = 1e9;
const ll linf = 3e18;
const double eps = 1e-9;

double table[100][100];

double dp[100][100]; // dp[times][cur]

signed main()
{
    omajinai;

	int N, M;
	
	while (cin >> N >> M, N || M) {
		memset(dp, 0, sizeof(dp));

		rep(i, N) rep(j, N) cin >> table[i][j];

		rep(i, N) dp[0][i] = 1.0;

		for (int i = 1; i < M; ++i) {
			for (int j = 0; j < N; ++j) {
                for (int k = 0; k < N; ++k) {
                    dp[i][j] = max(dp[i][j], dp[i - 1][k] * table[k][j]);
                }
			}
		}

        double ans = 0;

        rep(i, N) ans = max(ans, dp[M - 1][i]);

        printf("%.2f\n", ans);
	}
}

Measured memory_bytes: 1428
N = int(input())
s1 = input()
s2 = input()
index = 0
ans = 3
def multi(x,y):
    return x*y % (10**9+7)
if s1[index] != s2[index]:
    ans = 6
    index += 2
else:
    index += 1
while index < N:
    if s1[index] == s2[index]:
        if s1[index-1] == s2[index-1]:
            ans = multi(ans, 2)
        index += 1
    else:
        if s1[index-1] == s2[index-1]:
            ans = multi(ans, 2)
        else:
            ans = multi(ans, 3)
        index += 2
print(ans)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
                using namespace std;
                typedef long long ll;
                #define INPUT()              freopen("input.txt", "r", stdin)
                #define OUTPUT()             freopen("output.txt", "w", stdout)
                #define F                    first
                #define S                    second
            //Templatefunctions
                template<typename T>T gcd(T x, T y) { if (y == 0)return x; else return gcd(y, x%y);}
                template <class T> T euclideanDistance(T x1 , T x2 , T y1 , T y2){return sqrt(( x1 - x2 ) * ( x1 - x2 ) + ( y1 - y2 ) * ( y1 - y2 ));}
                template <class T> T digitSum(T n){T sum = 0;while(n > 0)sum += n % 10,n /= 10;return sum;}
            //datatypes
                typedef long long int ll;
                typedef unsigned long long int ull;
                typedef long double ld;
            //constants
                const double INF = 1e+9;
                const double INFLL = 1e+18;
                const double EPS = 1e-9;
                const double PI = acos(-1);
                const int knightDir[8][2] = {{-2,-1},{-2,1},{-1,2},{1,2},{2,-1},{2,1},{-1,-2},{1,-2}};
                       //const int dx[]={0,0,0,1,1,1,-1,-1,-1};
                       //const int dy[]={-1,0,1,-1,0,1,-1,0,1};
                const int dx[] = {0 , 1 , 0 , -1};
                const int dy[] = {1 , 0 , -1 , 0};
            //helpers
                //#define MOD         1000000007LL
                #define MAX         1000005
                const ll MOD = 1000000000 + 7;
                int arr[MAX];
            //Global Variables


                int manhattanDis(int  x , int y , int x1 , int y1)
                {
                    return abs(x - x1) + abs(y - y1);
                }
                int main()
                {
                   int n,m;
                   scanf("%d%d",&n,&m);
                   int citi[55] = {0};
                   for(int i = 0 ; i < m ; i++)
                   {
                        int x , y;
                        scanf("%d%d",&x,&y);
                        citi[x]++;
                        citi[y]++;
                   }
                   for(int i = 1 ; i <= n ; i++)
                   {
                        printf("%d\n",citi[i]);
                   }
                }


Measured memory_bytes: 256
#include <bits/stdc++.h>
typedef long long ll;
#define REP(i,n) for(int i=0;i<n;i++)
#define ALL(x) (x).begin(),(x).end()
using namespace std;

//素因数分解
vector<pair<ll,int>> factorize(ll n){
    vector<pair<ll,int>>res;
    for(ll i=2;i*i<=n;i++){
        if(n%i)continue;
        res.emplace_back(i,0);
        while (n%i == 0)
        {
        n /= i;
        res.back().second++;
        }
        
    }
    if(n != 1) res.emplace_back(n,1);
    return res;
}

int main(){
    int N;
    cin >> N;
    if(N>999)cout << "ABD" << endl;
    else cout << "ABC" <<endl;
}


Measured memory_bytes: 256
Scanf.scanf "%d %d" (fun n x ->
    let a = Array.init n (fun _ -> Scanf.scanf " %d" (fun a -> a)) in
    Array.sort compare a;

    let rec loop i acc =
        if i = n then (if acc = x then i else i - 1) else
            if acc + a.(i) <= x then loop (i + 1) (acc + a.(i)) else i
    in
    loop 0 0 |> Printf.printf "%d\n"
)

Measured memory_bytes: 3848
import sys,collections as cl,bisect as bs
sys.setrecursionlimit(100000)
Max = sys.maxsize
def l():
    return list(map(int,input().split()))
def m():
    return map(int,input().split())
def onem():
    return int(input())
def s(x):
    a = []
    aa = x[0]
    su = 1
    for i in range(len(x)-1):
        if aa == x[i+1]:
            a.append([aa,su])
            aa = x[i+1]
            su = 1
        else:
            su += 1
    a.append([aa,su])
    return a
def jo(x):
    return " ".join(map(str,x))

n,m = m()

l = [l() for i in range(n)]
l.sort(key = lambda x:x[2])
ans = [-1]*m
ju = [-1]*m
d = [onem() for i in range(m)]
for s,t,x in l:
    ore = bs.bisect_left(d,s-x)
    o = bs.bisect_left(d,t-x)
    while (ore < o):
        k = ju[ore]
        if k == -1:
            ans[ore] = x
            ju[ore] = o
            ore += 1
        else:
            ore = k
for i in range(m):
    print(ans[i])


Measured memory_bytes: 74476
#include <cmath>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <iostream>
#define LL long long
using namespace std;

int n,p,a[100];
LL f[2][100][100];
int main(){
	scanf("%d%d",&n,&p);
	for(int i=1;i<=n;i++)
		scanf("%d",&a[i]);
	for(int i=1;i<=n;i++){
		if(a[i]&1)f[1][i][i]=1;
		else f[0][i][i]=1;
	}
	for(int len=2;len<=n;len++){
		for(int l=1;l+len-1<=n;l++){
			int r=l+len-1;
			f[0][l][r]=f[0][l][r-1]+f[0][r][r]+f[0][l][r-1]*f[0][r][r]+f[1][l][r-1]*f[1][r][r];
			f[1][l][r]=f[1][l][r-1]+f[1][r][r]+f[0][l][r-1]*f[1][r][r]+f[1][l][r-1]*f[0][r][r];
		}
	}
	printf("%lld",f[p][1][n]+(!p));
	return 0;
}

Measured memory_bytes: 384
# bcd[a][b] : aとbの最大公約数の値
K = int(input())
bcd=[[int(-1) for x in range(K+1)]for j in range(K+1)]


def retBcd(a,b):
    if bcd[a][b] != -1 :
        return bcd[a][b]
    if b == 0:
        bcd[a][b] = a
        bcd[b][a] = a
        return a
    else:
        ret = retBcd(b,a%b)
        bcd[a][b] = ret
        bcd[b][a] = ret
        return ret

sumTotal=0
for i in range(1,K+1):
    for j in range(1,K+1):
        for k in range(1,K+1):
            sumTotal += retBcd(retBcd(i,j),k)
print(sumTotal)


Measured memory_bytes: 74524
#include<iostream>
#include<math.h>
#include<algorithm>
#include<vector>
#include<string.h>
#include<cstdlib>
#include<map>
#include<fstream>
#include<string>
#include<sstream>
#include<iomanip>

using namespace std;



int main() {
	int n;
	cin >> n;
	int a[200001];
	int b[200001];
	for (int i = 0; i < n; i++) {
		cin >> a[i];
		b[i] = a[i];
	}
	sort(a, a + n);
	int maxer = 0;
	int niban = 0;
	for (int i = 0; i < n; i++) {
		if (maxer < a[i]) {
			niban = maxer;
			maxer = a[i];
		}
	}
	bool flag = false;
	bool okey = false;
	for (int i = 0; i < n; i++) {
		if (maxer == a[i]) {
			if (flag == true) {
				okey = true;
			}
			flag = true;
		}
	}

	for (int i = 0; i < n; i++) {
		if (okey == true) {
			cout << maxer << endl;
		} else {
			if (maxer == b[i]) {
				cout << niban << endl;
			} else {
				cout << maxer << endl;
			}
		}
	}

}

Measured memory_bytes: 3200
/*input
6
11 21 35 22 7 36 27 34 8 20 15 13 16 1 24 3 2 17 26 9 18 32 31 23 19 14 4 25 10 29 28 33 12 6 5 30
*/

#include <bits/stdc++.h>
#define ll long long

using namespace std;

vector<vector<int>> a, cost;

vector<int> dx = {0, 0, 1, -1};
vector<int> dy = {1, -1, 0, 0};

int n;

void update(int x, int y) {
	int tot = a[x][y] + cost[x][y];
	for(int i=0; i<4; i++) {
		int nx = x + dx[i], ny = y + dy[i];
		if(nx < 0 || ny < 0 || nx >= n || ny >= n)
			continue;
		if(a[nx][ny] > tot) {
			a[nx][ny] = tot;
			update(nx, ny);
		}
	}
}

void run() {
	int i, j, p;
	cin >> n;
	a.resize(n, vector<int>(n, 0));
	cost.resize(n, vector<int>(n, 1));
	for(i=0; i<n; i++)
		for(j=0; j<n; j++)
			a[i][j] = min({i, j, n - i - 1, n - j - 1});
	int ret = 0;
	for(i=0; i<n*n; i++) {
		cin >> p;
		int x = (p - 1) / n;
		int y = (p - 1) % n;
		ret += a[x][y];
		cost[x][y] = 0;
		update(x, y);
	}
	cout << ret << endl;
}

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


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

#define ll long long
#define rep(i,N) for(ll i=0; i<N; i++)
const int mx = 2e5;

int main(void){
  
  ll X;
  cin >> X;
  X -= 400;
  
  cout << 8 - X/200;

  return 0;
}

Measured memory_bytes: 3632
#include <iostream> // cin, cout, cerr
#include <algorithm> // minmax, sort, swap
#include <numeric> // iota
#include <cstdio> // printf, scanf
#include <string> // string, stoi, to_string
#include <vector> // vector
#include <queue> // queue, priority_queue
#include <deque> // deque
#include <map> // key-value pairs sorted by keys
#include <set> // set
#include <iomanip> // cout<<setprecision(n)
#include <functional> // function<void(int)>
#include <cmath>
#include <cassert>
#include <bitset>

#ifdef DEBUG
#include "debug.hpp"
#else
#define debug(...)
#endif

#define int long long // at least int64 > 9*10^18
#define EL '\n'
#define rep(i,n) for(int i = 0; i < (n); i++)
#define print(i) std::cout << (i) << '\n'
#define all(v) (v).begin(), (v).end()
/* libraries */

constexpr int MOD = 1e9+7;
struct mint
{
	int v;
	mint():v(0){}
	mint(int v):v((v+MOD)%MOD){}
	mint operator-()const{ return mint(0) - *this; }
	mint& operator+=(const mint& a){ if((v+=a.v)>=MOD) v-=MOD; return *this; }
	mint& operator-=(const mint& a){ if((v+=MOD-a.v)>=MOD) v-=MOD; return *this; }
	mint& operator*=(const mint& a){ (v*=a.v)%=MOD; return *this; }
	mint& operator/=(const mint& a){ (*this) *= a.inv(); return *this; }
	mint operator+(const mint& a)const{ return mint(*this) += a; }
	mint operator-(const mint& a)const{ return mint(*this) -= a; }
	mint operator*(const mint& a)const{ return mint(*this) *= a; }
	mint operator/(const mint& a)const{ return mint(*this) /= a; }
	bool operator<(const mint& a)const{ return v < a.v; }
	bool operator==(const mint& a)const{ return v == a.v; }
	mint pow(int k)const{ mint r(1),t(v); while(k){ if(k&1) r*=t; t*=t; k>>=1; } return r; }
	mint inv()const{ return pow(MOD-2); }
	static mint comb(int n, int k) {
		if(n-k<k) k=n-k;
		mint num(1), dom(1);
		for(int i=0;i<k;i++) { num*=n-i; dom*=i+1; }
		return num/dom;
	}
};
std::istream& operator>>(std::istream&i,mint&a){ int t; i>>t; a=mint(t); return i; }
std::ostream& operator<<(std::ostream&o,const mint&a){ o<<a.v; return o; }


signed main() {
	int n;
	std::cin >> n;
	std::vector<int> a(n);
	rep(i,n) std::cin >> a[i];
	std::map<int,int> map1,map2;
	rep(i,n) {
		map1[std::abs(i-(n-1-i))]++;
		map2[a[i]]++;
	}
	for(auto x:map1) {
		if(x.second!=map2[x.first]) {
			print(0);
			return 0;
		}
	}
	print(mint(2).pow(n/2));
	return 0;
}


Measured memory_bytes: 8064
#include<bits/stdc++.h>
#define MAXN 100005
typedef long long ll;
const ll MOD=1e9+7;
using namespace std;
ll inv[MAXN],pre[MAXN],A[MAXN],n,B[MAXN];
ll add(ll x, ll y) {
	x += y;
	if (x >= MOD) return x - MOD;
	return x;
}
ll sub(ll x, ll y) {
	x -= y;
	if (x < 0) return x + MOD;
	return x;
}
ll mult(ll x, ll y) {
	return (x * y) % MOD;
}
int main()
{
    inv[1]=pre[1]=1;
    for(int i=2;i<=MAXN;i++)
    {
        int a=MOD/i,b=MOD%i;
        inv[i]=((ll)inv[b]*(-a)%MOD+MOD)%MOD;
        pre[i]=add(pre[i-1],inv[i]);
    }
    scanf("%d",&n);
    for(int i=1;i<=n;i++)
    {
        scanf("%d",&A[i]);
    }
    for(int i=1;i<=MAXN;i++)
    {
        B[i]=add(pre[i],(pre[n-i+1]-1));
    }
    ll ans=0;
    for(int i=1;i<=n;i++)
    {
        ans=add(ans,mult(A[i],B[i]));
    }
    for(int i=1;i<=n;i++)
    {
        ans=mult(ans,i);
    }
    printf("%lld\n",ans);
}


Measured memory_bytes: 3328
#include<bits/stdc++.h>
#define int long long
#define P pair<int,int>
#define PP pair<int,P>
#define F first
#define S second
#define f(i,n) for(int i=0;i<(n);i++)
#define INF LLONG_MAX/3
#define eps LDBL_EPSILON
#define mod (int)(1000000007)
#define pie 3.141592653589793238462643383279
#define Bpri priority_queue
#define Spri priority_queue<P,vector<P>,greater<P>>
using namespace std;
int x[200010];
signed main(){
	string s;
	int a,b=0,ans=INF;
	cin>>a>>s;
	f(i,a){
		x[i]=b;
		if(s[i]=='#') b++;
	}
	x[a]=b;
	f(i,a+1){
		ans=min(ans,x[i]+a-x[a]-i+x[i]);
	}
	cout<<ans<<endl;
	return 0;
}


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

int main() {
  int N, M;
  cin >> N >> M;
  vector <int> array(N*M);
  for (int i=0; i<N*M; i++) {
    cin >> array.at(i);
  }
  
  vector <int> result(N, 0);
  for (int i=0; i<N; i++) {
    for (int j=0; j<N*M; j++) {
      if (i+1 == array.at(j)) {
        result.at(i)++;
      }
    }
  }
  
  for (int i=0; i<N; i++) {
    cout << result.at(i) << endl;
  }
  
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long LL;
typedef pair<LL,LL> P;
const LL mod=1000000007;

int main(){
    string s;
    cin >> s;
    LL c,f;
    c=s.find('C');
    f=s.rfind('F');
    if(c<f&&c!=string::npos&&f!=string::npos) puts("Yes");
    else puts("No");
    return 0;
}


Measured memory_bytes: 256
S = (input())
#N = int(input())
#N, M = map(int, input().split())
#A = list(map(lambda x: int(x)*(-1), input().split()))
#A = [int(input()) for i in range(N)]
#C = [list(map(int, input().split())) for i in range()]

if '7' in S:
    print('Yes')
else:
    print('No')

Measured memory_bytes: 9088
import java.util.*;
public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        String s = sc.next();
        char[] moji = s.toCharArray();

        for(int i = 0;i<s.length();i++){
            if(moji[i]+n>90){
                System.out.print((char)(((moji[i]+n)-26)));
            }else{
                System.out.print((char)(moji[i]+n));
            }
        }

        

      
    }
}


Measured memory_bytes: 26324
#[allow(unused_imports)]
use std::cmp::{max, min};
use std::io::{stdin, stdout, BufWriter, Write};

#[derive(Default)]
struct Scanner {
    buffer: Vec<String>,
}

impl Scanner {
    fn next<T: std::str::FromStr>(&mut self) -> T {
        loop {
            if let Some(token) = self.buffer.pop() {
                return token.parse().ok().expect("Failed parse");
            }
            let mut input = String::new();
            stdin().read_line(&mut input).expect("Failed read");
            self.buffer = input.split_whitespace().rev().map(String::from).collect();
        }
    }
}

fn solve(a: &[i32], m: usize) -> bool {
    let n = a.len();
    let mut dp = vec![vec![false; m+1]; n+1];
    dp[0][0] = true;
    for i in 0..n {
        for j in 0..m+1 {
            dp[i+1][j] = dp[i][j];
            if j as i32 >= a[i] {
                dp[i+1][j] |= dp[i][j - a[i] as usize]
            }
        }
    }
    dp[n][m]
}

/* Blute force
fn solve(a: &[i32], m: i32, sum: i32, ind: usize) -> bool {
    if sum == m {
        return true;
    }
    if sum > m || ind >= a.len() {
        return false;
    }
    solve (a, m, sum + a[ind], ind+1) || solve(a, m, sum, ind+1)
}
*/

fn main() {
    let mut scan = Scanner::default();
    let out = &mut BufWriter::new(stdout());

    let n = scan.next();
    let mut a = vec![0; n];
    for i in 0..n {
        a[i] = scan.next();
    }

    let q = scan.next();
    for _ in 0..q {
        let m = scan.next();
        if solve(&a[..], m) {
            writeln!(out, "yes").ok();
        } else {
            writeln!(out, "no").ok();
        }
    }
}



Measured memory_bytes: 5048
//高知能系Vtuberの高井茅乃です。
//Twitter: https://twitter.com/takaichino
//YouTube: https://www.youtube.com/channel/UCTOxnI3eOI_o1HRgzq-LEZw

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

#define INF INT_MAX
#define LLINF LLONG_MAX
#define REP(i,n) for(int i=0;i<n;i++)
#define REP1(i,n) for(int i=1;i<=n;i++)
#define MODA 1000000007 

template <typename T>
std::istream& operator>>(std::istream& is, std::vector<T>& vec) {
    for (T& x: vec) { is >> x; }
    return is;
}

int main() {
	ll ans = 0;
	ll tmp;
	int n, x, t; cin >> n >> x >> t;
	cout << (n+x-1) / x * t << endl;
}

Measured memory_bytes: 3620
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define fi first
#define se second
#define all(x) (x).begin(), (x).end()
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define repp(i, a, b) for (int i = a; i <= (b); ++i)
#define repr(i, a, b) for (int i = a; i >= (b); --i)
typedef long long ll;
const int INF = 1001001001;
const ll LINF = 1001001001001001001ll;
const int MOD = 1e9 + 7;

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

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

int main() {
  int A, B;
  cin >> A >> B;
  if (A % 2 == 1 && B % 2 == 1) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
int abs(int a){
	return a<0?-1*a:a;
}
int n,h[(int)1e5+1];
int main(){
	scanf("%d",&n);
	for(int i=1;i<=n;i++)
		scanf("%d",h+i);
	int ans=abs( h[n]-h[n-1] ),lans,next=ans,nnext=0;
	for(int i=n-2;i>0;i--){
		ans=min(abs(h[i]-h[i+1])+next,abs(h[i]-h[i+2])+nnext);
		nnext=next;
		next=ans;
		/*
		 *ans+=lans;
		 */
	}
	cout<<ans<<"\n";
	return 0;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
#define DUMP(x)  cout << #x << " = " << (x) << endl;
#define FOR(i, m, n) for(ll i = m; i < n; i++)
#define IFOR(i, m, n) for(ll i = n - 1; i >= m; i-- )
#define REP(i, n) FOR(i,0,n)
#define IREP(i, n) IFOR(i,0,n)
#define FOREACH(x,a) for(auto& (x) : (a) )
#define ALL(v) (v).begin(), (v).end()
#define SZ(x) ll(x.size())

int main(){
  ll n; cin >> n;
  double ans = 0.0;
  REP(i,n){
    ll a; cin >> a;
    ans += 1.0/a;
  }
  ans = 1.0/ans;
  cout << fixed << setprecision(10) << ans << endl;
}



Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cmath>
#include<cstring>
#include<string>
#include<stack>
#include<queue>
#include<vector>
#include<algorithm>
#include<iomanip>
typedef long long int ll;
using namespace std;
#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define REP(i,n) for (unsigned int i=0;i<(n);i++)
#define EREP(i,n) for (int i=1;i<=(n);i++)
#define ALL(a) (a).begin(),(a).end()
//#define EVEL 1

#ifdef EVEL
#define DEB(X) cout << #X << ":" <<X<<" " ;
#define TF(f) f ? cout<<"true  " : cout<<"false ";
#define END cout<<"\n";
#else
#define DEB(X) {}
#define TF(f) {}
#define END {}
#endif
const int MOD =  1000000007 ;
const int INF = 2000000000;


    ll A,B,C,D,N;
    ll ans=0;
    ll X[4];
    string S[4];
int main(){
    cin>>A>>B;
    if(A>12)ans=B;
    else if(A>=6)ans=B/2;
    cout<<ans<<endl;
    
    return 0;
}

Measured memory_bytes: 256
import java.io.PrintWriter
val pw = PrintWriter(System.out)

fun main(args : Array<String>) {
    func()
    pw.flush()
}

fun func() {
    val n = nextInt()
    val ss = listOfString()
    println(if (ss.contains("Y")) "Four" else "Three")
}

fun next() = readLine()!!
fun nextInt() = next().toInt()
fun listOfString() = next().split(" ")

fun println(value : Any) {
    pw.println(value)
}

Measured memory_bytes: 36240
#include<cstdio>
#include<iostream>
#include<map>
using namespace std;
int main()
{
	char a,b;
	cin>>a>>b;
	if(a>b) putchar('>');
	else if(a<b) putchar('<');
	else putchar('=');
	putchar('\n');
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <cmath>
#include <cstdio>
#include <string>
#include <map>
#include <set>
#include <queue>
#include <stack>
using namespace std;
#define MOD 1000000007
#define rep(i,n) for(int i = 0; i < (n); ++i)
typedef long long ll;


int main(void) {
  int N;
  cin >> N;
  vector<int> A(N+1);
  for(int i = 1; i <= N; ++i) {
    int a;
    cin >> a;
    A[a] = i;
  }
  for(int i = 1; i <= N; ++i) {
    printf("%d ", A[i]);
  }

  return 0;
}


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

int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int n, k;
  cin >> n >> k;
  vector<int> h(n);
  for (int i = 0; i < n; i++) {
    cin >> h[i];
  }
  vector<int> dp(n, INT32_MAX);
  dp[0] = 0;
  for (int i = 0; i < n; i++) {
    for (int j = 1; j <= k; j++) {
      if (i + j < n)
        dp[i + j] = min(dp[i + j], dp[i] + abs(h[i] - h[i + j]));
    }
  }
  cout << dp[n - 1];
}


Measured memory_bytes: 1024
import java.util.*;
import static java.lang.System.*;
 
class Main {
  public static final int MOD = 1000000007;
  public static final int INF = 1000000000;
  public static void main(String[] args) {
    Scanner sc = new Scanner(in);
    int N = sc.nextInt();
    int M = sc.nextInt();
    int P[] = new int[M];
    int Y[] = new int[M];
    List<List> A = new ArrayList<List>(N);
    for(int i=0; i<N; i++){
      List<Integer> B = new ArrayList<Integer>();
      A.add(B);
    }      
    for(int i=0; i<M; i++){
      P[i] = Integer.parseInt(sc.next());
      Y[i] = Integer.parseInt(sc.next());
      A.get(P[i]-1).add(Y[i]);
    }
    for(int i=0; i<N; i++){
      Collections.sort(A.get(i));
    }
    for(int i=0; i<M; i++){
      int x = Collections.binarySearch(A.get(P[i]-1), Y[i]) + 1;
      out.printf("%06d%06d\n",P[i],x);
    }
    
  }
 
  public static int gcd(int a, int b){
    if(b == 0) return a;
    return gcd(b, a%b);
  }
}

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

int main()
{
  int Q;scanf("%d",&Q);
  bool is_prime[100001],alike[100001];
  fill(is_prime,is_prime+100001,true);fill(alike,alike+100001,false);
  is_prime[0]=false,is_prime[1]=false;
  for(int i=2;i<100001;i++)
  {
    if(!is_prime[i])continue;
    for(int j=i*2;j<100001;j+=i)is_prime[j]=false;
  }
  for(int i=3;i<100001;i+=2)if(is_prime[(i+1)/2]&&is_prime[i])alike[i]=true;
  int count_prime[100001];fill(count_prime,count_prime+100001,0);
  for(int i=3;i<100001;i+=2)count_prime[i]=count_prime[i-2]+alike[i];
  for(int l,r,i=0;i<Q;i++)
  {
    scanf("%d %d",&l,&r);
    int ans=count_prime[r]-count_prime[l];
    if(alike[l])ans++;
    printf("%d\n",ans);
  }
}

Measured memory_bytes: 4392
n = int(input())
edge = [ [ int(v)-1 for v in input().split() ] for i in range(n-1) ]
num_list = sorted([ int(v) for v in input().split() ])
parent_list = [ None for i in range(n) ]
connect_list = [ [] for i in range(n) ]

for a, b in edge:
    connect_list[a].append(b)
    connect_list[b].append(a)

connect_point = [ len(i) for i in connect_list ]
p = connect_point.index(max(connect_point))

depth_list = [[p]]
search_list = [p]
parent_list[p] = -1

while search_list:
    new_search_list = []
    for i in search_list:
        for j in connect_list[i]:
            if parent_list[j] is None:
                parent_list[j] = i
                new_search_list.append(j)
    if new_search_list:
        depth_list.append(new_search_list)
    search_list = new_search_list

node = [ None for i in range(n) ]
q = 0

for i in depth_list[::-1]:
    for j in i:
        node[j] = num_list[q]
        q += 1

print(sum(num_list[:-1]))
print(*node)

Measured memory_bytes: 54872
#include <bits/stdc++.h>
    
#define int long long
    
#define REP(i,n) for(int i=0;i<n;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 pb(x) push_back(x)
#define mp(x, y) make_pair(x, y) 
#define SORT(x) sort((x).begin(),(x).end())
#define INF 99999999999
#define MOD (int)(1e9)+7
    
using namespace std;
    
int dy[4]={1, 0, -1, 0};
int dx[4]={0, 1, 0, -1};
    
int32_t main(){
    int n;
    cin >> n;
    
    if(n%2){
        cout << n/2*(n/2+1) << endl;
    }
    else{
        cout << n/2*n/2 << endl;
    }
}

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

void solve(long long N, long long K, std::string S){
    int score = 0;
    for(int i = 0; i < N - 1; ++i){
        if(S[i] == S[i+1]) score++;
    }
    int ans = min(score+2*K, N-1);
    cout << ans << endl;
}

int main(){
    long long N;
    scanf("%lld",&N);
    long long K;
    scanf("%lld",&K);
    std::string S;
    std::cin >> S;
    solve(N, K, S);
    return 0;
}


Measured memory_bytes: 3868
#include<iostream>
#include<iomanip>
#include<numeric>
#include<string>
#include<algorithm>
#include<vector>
#include<map>
#include<unordered_map>
#include<stack>
#include<queue>
#include<ctype.h>
#include<cstdlib>
#include<cstdio>
#include<cmath>
#include<utility>
#define For(a,b) for(int i=(a);i<(b);i++)
#define Rep(n) for(int i=0; i<(n); ++i)
int gcd(int a,int b){return b?gcd(b,a%b):a;}
int lcm(int a,int b){return a*b/gcd(a,b);}
using namespace std;
typedef long long ll;//int64
typedef unsigned long long ull;
//----------program from here----------

int main(){
    int ok=0;
    string s,t;
    cin >> s >> t;
    for(int i=0;i<3;++i)
        if(s[i]==t[i]) ++ok;
    cout << ok << endl;
}

Measured memory_bytes: 256
n, k, q = [int(i) for i in input().split()]

a = [int(input()) - 1 for _ in range(q)]
b = [k - q] * n
for i in a:
    b[i] += 1

for i in b:
    if i > 0:
        print("Yes")
    else:
        print("No")

Measured memory_bytes: 10452
n = int(input())
a = [int(_) for _ in input().split()]
nega = 0
for i in range(n):
    if a[i] < 0:
        nega += 1
        a[i] = -1*a[i]
a.sort()
if nega % 2 == 0:
    print(sum(a))
else:
    print(sum(a) - 2*a[0])


Measured memory_bytes: 14332