akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
typedef pair<int, P> P1;
typedef pair<P, P> P2;
#define pu push
#define pb push_back
#define mp make_pair
#define eps 1e-7
#define INF 1000000000
#define fi first
#define sc second
#define rep(i, x) for (long long i = 0; i < x; i++)
#define repn(i, x) for (long long i = 1; i <= x; i++)
#define SORT(x) sort(x.begin(), x.end())
#define ERASE(x) x.erase(unique(x.begin(), x.end()), x.end())
#define POSL(x, v) (lower_bound(x.begin(), x.end(), v) - x.begin())
#define POSU(x, v) (upper_bound(x.begin(), x.end(), v) - x.begin())
vector<pair<string, P> > vec;
// vector<vector<int>> data(3, vector<int>(4));

void solve(string S) {
    vector<ll> sum(200005);
    vector<ll> ten(200005, 1);
    repn(i, 200000) ten[i] = ten[i - 1] * 10 % 2019;
    ll n = S.length();
    repn(i, n) { sum[i] = (sum[i - 1] + (S[n - i] - '0') * ten[i - 1]) % 2019; }
    // repn(i, n) cout << sum[i] << endl;
    map<ll, ll> m;
    ll res = 0;
    m[0]++;
    repn(i, n) {
        res += m[sum[i]];
        m[sum[i]]++;
    }
    cout << res << endl;
}

int main() {
    string S;
    cin >> S;
    solve(S);
    return 0;
}


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

// 型定義
typedef long long ll;
typedef pair<ll, ll> P;

// forループ
#define REP(i,n) for(ll i=0; i<(ll)(n); ++i)

// 定数宣言
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;

// グラフ表現
using Graph = vector<vector<int>>;

// グラフの辺表現
using Edge = map<pair<int,int>,int>;

// n次元配列の初期化。第２引数の型のサイズごとに初期化していく。
template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
    std::fill( (T*)array, (T*)(array+N), val );
}

int main()
{
    cout << fixed << setprecision(15);
    ll N;
    cin >> N;

    vector<ll> A(N);

    ll minA = INF;
    ll ans = 0;
    ll micount = 0;
    REP(i, N){
        cin >> A[i];
        ans += abs(A[i]);
        minA = min(minA, abs(A[i]));
        if(A[i] < 0) micount++;
    }
    if(micount%2 == 0){
        cout << ans << endl;
    }
    else{
        cout << ans - 2*minA<< endl;
    }
    return 0;
}

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

int main(){
string S,T;
cin >> S >> T;
int a = 0;
for(int i =0; i<S.length();i++){
    if(S[i] == T[i]){
        a++;
    }
}

if(a == S.length()){
    cout << "Yes" << endl;
}
else{
    cout << "No" << endl;
}
}

Measured memory_bytes: 3628
w,h,xs,ys,xg,yg,c;
m[102][102];
C(x,y){
	if(m[x][y]==c){
		m[x][y]=-1;
		x>1&&C(x-1,y);
		x<w&&C(x+1,y);
		y>1&&C(x,y-1);
		y<h&&C(x,y+1);
	}
}
main(){
	int n,d,x,y,i,j;
	for(;scanf("%d%d%d%d%d%d%d",&w,&h,&xs,&ys,&xg,&yg,&n),w;){
		memset(m,0,sizeof(m));
		for(;n--;){
			scanf("%d%d%d%d",&c,&d,&x,&y);
			for(i=0;i<(d?2:4);i++)
				for(j=0;j<(d?4:2);j++)
					m[x+i][y+j]=c;
		}
		c=m[xs][ys];
		C(xs,ys);
		puts(m[xg][yg]==-1?"OK":"NG");
	}
	exit(0);
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
using namespace std;
int main(void)
{
  int a,b;
  cin >> a >> b;
  
  int p,i,x;
  
  p = a+b;
  i = a-b;
  x = a*b;
  
  cout << max(p,max(i,x));
  
  return 0;
}


Measured memory_bytes: 256
import heapq
X, Y, A, B, C = map(int, input().split())
P = list(map(int, input().split()))
Q = list(map(int, input().split()))
R = list(map(int, input().split()))
P.sort(reverse=True)
Q.sort(reverse=True)
R.sort(reverse=True)
PQ = P[:X] + Q[:Y]
heapq.heapify(PQ)
i = 0
for r in R:
    if PQ[0] < r:
        heapq.heappop(PQ)
        heapq.heappush(PQ, r)
        i += 1
        if i == (X + Y):
            break
print(sum(PQ))


Measured memory_bytes: 108912
import java.util.*;

public class Main {
    public static void main(String[] args) {
        try(Scanner scn = new Scanner(System.in)) {
            int n;
            while((n = scn.nextInt()) > 0) {
                double sum = 0, sd = 0;
                double[] s = new double[n];

                for(int i = 0; i < n; i++) {
                    s[i] = scn.nextDouble();
                    sum += s[i];
                }
                double avg = sum / n;
                for(int i = 0; i < n; i++) {
                    sd += Math.pow((s[i] - avg), 2);
                }
                System.out.println(Math.sqrt(sd / n));
            }
        }
    }
}

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

typedef unsigned long long ull;
int dp[45] = {0};

ull fib(int n) {
  // ???????????????
  if(dp[n] != 0)return dp[n];
  if(n == 1 || n == 0)return 1;
  return dp[n] = fib(n - 2) + fib(n - 1);
}

int main(void) {
  int n;
  cin >> n;
  cout << fib(n) << endl;
  return 0;
}

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

using namespace std;

u_int64_t a[100'000];
u_int64_t pSum[100'001];
map<u_int64_t, u_int64_t> eqCount;

int main()
{

    int N;
    u_int64_t M;
    cin >> N >> M;

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

    for (int i = 0; i <= N; i++)
    {
        if (i == 0)
        {
            pSum[i] = 0;
            continue;
        }

        pSum[i] = pSum[i - 1] + a[i - 1];
        pSum[i] %= M;
    }

    u_int64_t wholeCount = 0;
    for (int i = 0; i <= N; i++)
    {
        wholeCount += eqCount[pSum[i]];
        eqCount[pSum[i]]++;
    }

    cout << wholeCount << endl;
    return 0;
}

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

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

    string s;
    cin >> s;
    
    int cnt_a = 0;
    int cnt_b = 0;
    int cnt_c = 0;
    
    for(int i = 0; i < (int)s.size(); i++){
        if(s[i] == 'a') cnt_a++;
        if(s[i] == 'b') cnt_b++;
        if(s[i] == 'c') cnt_c++;
    }
    
    bool flag = true;
    
    if(abs(cnt_a - cnt_b) > 1) flag = false;
    if(abs(cnt_b - cnt_c) > 1) flag = false;
    if(abs(cnt_c - cnt_a) > 1) flag = false;
    
    if(flag) cout << "YES" << endl;
    else cout << "NO" << endl;
}


Measured memory_bytes: 512
let () =
  let s = read_line () in
  Array.init (String.length s) (fun i -> s.[i])
  |> Array.fold_left (fun s c ->
      match s, c with
      | _, '0' -> '0' :: s
      | _, '1' -> '1' :: s
      | [], 'B' -> []
      | _ :: s, 'B' -> s) []
  |> (fun s -> List.rev_append s ['\n'])
  |> List.iter print_char;

Measured memory_bytes: 384
#include <iostream>

#include <vector>
#include <map>
#include <algorithm>
#include <fstream>
#include<cstdio>
#include<iomanip>
#include<stack>
#include<queue>
#include<string>
#include <cstdlib>
#include <typeinfo>

#define REP(i, n) for(int i=0;i<n;i++)
#define REP2(i, s, n) for(int i=s;i<n;i++)
#define REP_1(i, n) for(int i=1;i<n+1;i++)
#define bitSearch(bit, n) for(int bit = 0; bit < (1 << N); bit++)
using namespace std;

template<class T>
void print(const T &value) {
    std::cout << value << std::endl;
}

void yesno(bool a) { if (a)cout << "Yes" << endl; else cout << "No" << endl; }

void YESNO(bool a) { if (a)cout << "YES" << endl; else cout << "NO" << endl; }

typedef long long ll;
typedef unsigned long ul;
typedef long double ld;

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

//ll INF = 10000000;
//ll mod = 1000000007;//10^9+7

//using Graph = vector<vector<int>>;




//番号ズレ注意！！
int main() {
    int N, Y;
    cin >> N >> Y;
    int can = false;
    int x, y, z = 0;
    REP(i, N+1) {
        REP(j, N - i + 1) {
            if (10000 * i + 5000 * j + 1000 * (N - i - j) == Y) {
                can = true;
                x = i, y = j, z = N - i - j;
            }
            if (can)break;
        }
        if (can)break;
    }
    if (!can) { x = -1, y = -1, z = -1; }
    cout << x << " " << y << " " << z << endl;
}


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

// Description: ????????????
// Verifyed: various problem 
using namespace placeholders;
using R=long double;
const R EPS=1e-9L; // [-1000,1000]->EPS=1e-8 [-10000,10000]->EPS=1e-7
inline int sgn(const R& r){return(r > EPS)-(r < -EPS);}
inline R sq(R x){return sqrt(max(x,0.0L));}

const R INF = 1E40L;
const R PI = acos(-1.0L);
using P=complex<R>;
using L=struct{P s,t;};
using VP=vector<P>;
using C=struct{P c;R r;};

auto& operator >> (istream& is,P& p){ R x,y; is >> x >> y,p=P(x,y); return is;}
auto& operator << (ostream& os,P& p){ os << real(p) << " " << imag(p); return os;}

inline R dot(P o,P a,P b){return real(conj(a-o)*(b-o));}
inline R det(P o,P a,P b){return imag(conj(a-o)*(b-o));}
inline P vec(L l){return l.t-l.s;}
auto sdot = bind(sgn,bind(dot,_1,_2,_3));
auto sdet = bind(sgn,bind(det,_1,_2,_3));

//projection verify AOJ CGL_1_A
P proj(L l,P p){ R u=real((p-l.s)/vec(l)); return (1-u)*l.s+u*l.t;}

//reflection verify AOJ CGL_1_B
P refl(L l,P p){return 2.0L*proj(l,p)-p;}

// CCW verify AOJ CGL_1_C
enum CCW{ LEFT = 1,RIGHT = 2,BACK = 4,FRONT = 8,ON = 16};
inline int ccw(P o,P a,P b) {
	if(sdet(o,a,b) > 0) return LEFT;    // counter clockwise
	if(sdet(o,a,b) < 0) return RIGHT;   // clockwise
	if(sdot(o,a,b) < 0) return BACK;    // b--base--a on line
	if(sgn(norm(a-o)-norm(b-o)) < 0) return FRONT;   // base--a--b on line
	return ON; // base--b--a on line  semnet determination betwenn a and b 
}

int main(void){
	P a,b,p;
	int n;
	cin >> a >> b >> n;
	L l={a,b};
	cout.precision(20);
	rep(i,n){
		cin >> p;
		P ans=refl(l,p);
		cout << fixed << ans << endl;
	}
	return 0;
}

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

int main() {
    int a, b;
    cin >> a >> b;
    if(b%a==0) cout << a+b << endl;
    else cout << b-a << endl;
    return 0;
}

Measured memory_bytes: 3608
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
const ll INF = 1e18+5;
void min_self(ll &a,ll b)
{
	a=min(a,b);
}
int main()
{
    ll n,W;
    cin>>n>>W;
    vector<int>weight(n),value(n);
    for(int i=0;i<n;i++)cin>>weight[i]>>value[i];
    int sum_value=0;
    for(int x:value)sum_value+=x;
    vector<ll>dp(sum_value+1,INF);
    dp[0]=0;
    for(ll item=0;item<n;++item)
    {
    	for(int value_already=sum_value-value[item];value_already>=0;--value_already)
    	{
          min_self(dp[value_already+value[item]],dp[value_already]+weight[item]);
    	}
    }
    ll answer=0;
    for(ll i=0;i<=sum_value;i++)
    {
      if(dp[i]<=W)answer=max(answer,(ll)i);
    }

  cout<<answer;
}

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

int main() {
  int N;
  string S, T;
  cin >> N >> S >> T;
  rep(i, N){
    cout << S.at(i) << T.at(i);
  }
  cout << endl;
}

Measured memory_bytes: 256
#include <iostream>

int main(){
    std::string s;
    std::cin >> s;

    for(int i = 0; i < s.size() - 1; ++i){
        if("AC" == s.substr(i, 2)){
            std::cout << "Yes" << std::endl;
            return 0;
        }
    }

    std::cout << "No" << std::endl;
    return 0;
}

Measured memory_bytes: 384
import numpy as np

class UnionFind:
    def __init__(self, sz: int):
        self._par: np.array = np.full(sz + 1, -1)

    def root(self, a: int):
        if self._par[a] < 0:
            return a
        self._par[a] = self.root(self._par[a])
        return self._par[a]
    
    def size(self, a: int):
        return -self._par[self.root(a)]
    
    def unite(self, a, b):
        a = self.root(a)
        b = self.root(b)
        if a != b:
            if self.size(a) < self.size(b):
                a, b = b, a
            self._par[a] += self._par[b]
            self._par[b] = a
    
if __name__ == '__main__':
    N, M = map(int, input().split())
    uf = UnionFind(N + 1)
    for i in range(M):
        a, b = map(int, input().split())
        uf.unite(a, b)
    ans = 1
    for i in range(1, N + 1):
        ans = max(ans, uf.size(i))
    print(ans)

Measured memory_bytes: 28208
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(n);i++)
using ll = long long;
using P = pair<int,int>;
int main(void) {
    int n; cin >> n;
    vector<int> a(n);
    rep(i, n) cin >> a[i];
    sort(a.begin(), a.end());
    cout << a[n-1] - a[0];
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define all(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
const int MOD = 1000000007;

int main(void)
{
    int takaHP, takaSTR, aokiHP, aokiSTR;
    cin >> takaHP >> takaSTR >> aokiHP >> aokiSTR;

    while (true)
    {
        aokiHP -= takaSTR;
        if (aokiHP < 1)
        {
            cout << "Yes" << endl;
            return 0;
        }
        takaHP -= aokiSTR;
        if (takaHP < 1)
        {
            cout << "No" << endl;
            return 0;
        }
    }
    return 0;
}

Measured memory_bytes: 3632
<?php

$input = explode(' ', trim(fgets(STDIN)));
$n = (int)$input[0];
$k = (int)$input[1];
$heights = [];
for ($i=0; $i < $n; $i++) { 
	$heights[] = (int)trim(fgets(STDIN));
}
sort($heights);
$min = null;
for ($i=0; $i <= $n-$k; $i++) { 
	$hmin = $heights[$i];
	$hmax = $heights[$i + $k -1];
	if (is_null($min)) {
		$min = $hmax - $hmin;
	}else{
		$min = min($min, $hmax - $hmin);
	}
}

echo $min;

Measured memory_bytes: 10744
#include <cstdio>

int main() {

	int a; scanf("%d", &a);

	int d[4];
	d[0] = a % 10;
	a /= 10;
	d[1] = a % 10;
	a /= 10;
	d[2] = a % 10;
	a /= 10;
	d[3] = a % 10;

	if ((d[0] == d[1] && d[1] == d[2]) || (d[1] == d[2] && d[2] == d[3]))
		puts("Yes");
	else
		puts("No");


	return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define in insert
#define PI 3.1415926535897932384626433832795
#define MOD 100000007
#define F first
#define S second
#define aLL(str) (str).begin(), (str).end()
#define IOS                \
  ios::sync_with_stdio(0); \
  cin.tie(0);              \
  cout.tie(0)
#define ll long long
#define ld long double
#define lcm(a, b) (a * b) / __gcd(a, b)
#define flu(i, a, b) for (ll i = a; i < b; i++)
#define blu(i, a, b) for (ll i = a; i >= b; i--)
#define upper(s) transform(s.begin(), s.end(), s.begin(), ::toupper)
#define lower(s) transform(s.begin(), s.end(), s.begin(), ::tolower)
#define Unique(X) (X).erase(unique(all(X)), (X).end())
#define all(v) v.begin(), v.end()
typedef vector<ll> vl;
typedef map<ll, ll> ml;
typedef vector<string> vs;
typedef vector<vector<int>> vvi;
char e = '\n';
ll i, j, le;

ll func(int n)
{
  int c = 0, i = 1;
  for (i = 1; i <= sqrt(n); i++)
  {
    if (n % i == 0)
    {
      if (i == n / i)
        c++;
      else
        c += 2;
    }
  }
  return c;
}
int main()
{
  IOS;
  int t, t1;
  //cin >> t;
  t = 1;
  flu(t1, 0, t)
  {
    ll n, t = 1, tot = 0, nn, c = 0;
    cin >> n;
    for (i = 1; n - i >= 1; i++)
    {

      c += func(n - i);
    }
    cout << c << endl;
  }
  return 0;
}


Measured memory_bytes: 3692
#include<queue>
#include<cmath>
#include<ctime>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<iostream>
#include<algorithm>
#define mem(a,b) memset(a,b,sizeof a)
#define  For(i,a,b) for(int i=a,i##end=b;i<=i##end;++i)
#define rFor(i,a,b) for(int i=a,i##end=b;i>=i##end;--i)
using namespace std;
typedef long long LL;
const int N=100010;
template<typename T>inline T chkmax(T _A,T _B){return _A>_B?_A:_B;}
template<typename T>inline T chkmin(T _A,T _B){return _A<_B?_A:_B;}
template<typename T>void read(T&x)
{
    x=0;int _f(0);char ch=getchar();
    while(!isdigit(ch))_f|=(ch=='-'),ch=getchar();
    while( isdigit(ch))x=x*10+ch-'0',ch=getchar();
    x=_f?-x:x;
}
inline void file()
{
#ifndef ONLINE_JUDGE
    freopen("in.txt","r",stdin);
    freopen("out.txt","w",stdout);
#endif
}
int n;
LL a[N],A,B,Max;
inline bool check(LL x)
{
	LL cnt=0;
	For(i,1,n)
	{
		LL now=a[i]-x*B;
		if(now<=0)continue;
		if(now%(A-B)==0)cnt+=now/(A-B);
		else cnt+=now/(A-B)+1;
	}
	return cnt<=x;
}
inline LL solve()
{
	LL l=1,r=Max/B+1,ans=1;
	while(l<=r)
	{
		LL mid=(l+r)>>1;
		if(check(mid))ans=mid,r=mid-1;
		else l=mid+1;
	}
	return ans;
}
int main()
{
	read(n),read(A),read(B);
	For(i,1,n)
	{
		read(a[i]);
		Max=chkmax(Max,a[i]);
	}
	printf("%lld\n",solve());
	return 0;
}


Measured memory_bytes: 1024
n,m=map(int,input().split())
mise=[]
for i in range(n):
  mise.append(list(map(int,input().split())))
ans=0
mise.sort()
i=0
while m>mise[i][1]:
  ans+=mise[i][0]*mise[i][1]
  m-=mise[i][1]
  i+=1
ans+=m*mise[i][0]
print(ans)

Measured memory_bytes: 27756
using System;
using System.Collections.Generic;
using System.Linq;
using System.IO;
using System.Text;
using static System.Math;
using static System.Array;


namespace AtCoder
{
    class AC
    {
        const int mod = 1000000007;
        const int INF = int.MaxValue / 2;
        const long SINF = long.MaxValue / 2;


        static void Main(string[] args)
        {
            //var sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
            //Console.SetOut(sw);
            var cin = new Scanner();

            var p = cin.SplitReaderL();
            long A = p.Max();
            long B = p.Min();

            long g = GetGcdL(A, B);

            var h = new HashSet<long>();
            h.Add(1);

            for(var i = 2; i <= Sqrt(g); i++)
            {
                while (g % i == 0)
                {
                    g /= i;
                    h.Add(i);
                }
            }
            h.Add(g);

            Console.WriteLine(h.Count());
            
            //Console.Out.Flush();
        }

        struct Edge
        {
            public int _to;
            public long _distance;

            public Edge(int t, long d)
            {
                _to = t;
                _distance = d;
            }
        }

        public static long GetGcdL(long a, long b)
        {
            if (b == 0)
            {
                return a;
            }
            return GetGcdL(b, a % b);
        }


    }
    public class Scanner
    {
        public int[] SplitReader()
        {
            int[] array = Console.ReadLine().Split().Select(int.Parse).ToArray();
            return array;
        }
        public long[] SplitReaderL()
        {
            long[] array = Console.ReadLine().Split().Select(long.Parse).ToArray();
            return array;
        }
    }

   public static class Tool
        {
            static public void Initialize<T>(ref T[] array, T initialvalue)
            {
                for (var i = 0; i < array.Length; i++)
                {
                    array[i] = initialvalue;
                }
            }
            static public long ModuloP(long value, long mod)
            {
                long r = value % mod;

                if (r * mod < 0)
                {
                    r += mod;
                }
                return r;
            }

        }

   struct Pair<T> : IComparable<Pair<T>> where T : IComparable<T>
   {
        public T variable;
        public int index;

        public Pair(T val, int i)
        {
            variable = val;
            index = i;
        }

        public int CompareTo(Pair<T> otherPair)
        {
            return variable.CompareTo(otherPair.variable);
        }

        public int CompareIndex(Pair<T> otherPair)
        {
            return index.CompareTo(otherPair.index);
        }
   }

    


}






Measured memory_bytes: 13536
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>

#include <iostream>
#include <complex>
#include <string>
#include <algorithm>
#include <numeric>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>

#include <functional>
#include <cassert>

typedef long long ll;
using namespace std;

#ifndef LOCAL
#define debug(x) ;
#else
#define debug(x) cerr << __LINE__ << " : " << #x << " = " << (x) << endl;

template <typename T1, typename T2>
ostream &operator<<(ostream &out, const pair<T1, T2> &p) {
  out << "{" << p.first << ", " << p.second << "}";
  return out;
}

template <typename T>
ostream &operator<<(ostream &out, const vector<T> &v) {
  out << '{';
  for (const T &item : v) out << item << ", ";
  out << "\b\b}";
  return out;
}
#endif

#define mod 1000000007 //1e9+7(prime number)
#define INF 1000000000 //1e9
#define LLINF 2000000000000000000LL //2e18
#define SIZE 200010

map<string, int> lbs;
map<string, int> ubs;

typedef vector<int> Number;

Number add(Number &a, Number &b) {
  Number res(256);

  for (int i=0; i<256; i++)
    for (int j=0; j<256; j++)
      if (a[i] && b[j]) res[(i+j)%256] = 1;

  return res;
}

Number sub(Number &a, Number &b) {
  Number res(256);

  for (int i=0; i<256; i++)
    for (int j=0; j<256; j++)
      if (a[i] && b[j]) res[(i-j+256)%256] = 1;

  return res;
}

Number mul(Number &a, Number &b) {
  Number res(256);

  for (int i=0; i<256; i++)
    for (int j=0; j<256; j++)
      if (a[i] && b[j]) res[(i*j)%256] = 1;

  return res;
}

Number div(Number &a, Number &b) {
  Number res(256);

  if (b[0]) {
    puts("error");
    exit(0);
  }

  for (int i=0; i<256; i++)
    for (int j=0; j<256; j++)
      if (a[i] && b[j]) res[(i/j)%256] = 1;

  return res;
}

bool isNumber(string s) {
  for(char c : s) {
    if (!isdigit(c)) return false;
  }
  return true;
}

Number create(int l, int r) {
  Number res(256);
  for (int i=l; i<=r; i++) res[i] = 1;
  return res;
}


int main(){
  int N, M;

  cin >> M;

  for (int i=0; i<M; i++) {
    string name;
    int lb, ub;
    cin >> name >> lb >> ub;
    lbs[name] = lb;
    ubs[name] = ub;
  }

  cin >> N;

  stack<Number> st;

  for (int i=0; i<N; i++) {
    string e;
    cin >> e;

    if (e == "+" || e == "-" || e == "*" || e == "/") {
      Number b = st.top(); st.pop();
      Number a = st.top(); st.pop();

      if (e == "+") st.push(add(a, b));
      if (e == "-") st.push(sub(a, b));
      if (e == "*") st.push(mul(a, b));
      if (e == "/") st.push(div(a, b));
    } else if (isNumber(e)){
      int num = stoi(e);
      st.push(create(num, num));
    } else {
      st.push(create(lbs[e], ubs[e]));
    }
  }

  puts("correct");

  return 0;
}



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

int main(){
	int k,s;
	cin >> k >> s;
	int count=0;
	for(int x=0;x<=k;x++){
		for(int y=0;y<=k;y++){
			int z=s-x-y;
			if(z>=0&&z<=k){
				count++;
			}
		}
	}
	cout << count << "\n";
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
ll MOD = (1e9)+7;
void fastIO(){
  ios_base::sync_with_stdio(0); cin.tie(0);
}

bool check(string s){
	for(int i=0;i<s.length()/2;i++){
		if(s[i]!=s[i+s.length()/2]){
			return false;
		}
	}
	return true;
}
int main(){
  fastIO();
  string s;
  cin>>s;
  int best = 0;
  for(int size=2;size<s.length();size+=2){
  	for(int i=0;i<s.length()-size+1;i++){
  		if(check(s.substr(i,i+size))){
  			best=size;
  		}
  	}
  }
  cout<<best<<endl;
} 




Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
#define ll           long long
#define all(v)       (v).begin() , (v).end()
#define vi           vector <ll>
#define vii          vector <pair<ll,ll>>
#define ii           pair<ll,ll>
#define sz(v)	     ((int)((v).size()))
#define lp(i,a,b)    for(int i=a;i<b;i++)
#define pb           push_back
#define pf           push_front
#define F            first
#define S            second
#define endl         "\n"
#define IOS          ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
const double PI = 3.14159265358979323846;
const ll inf=1e18,MOD=1e9+7,MAX=2e5+2;



int main() {
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
    IOS
    int a,b;
    cin>>a>>b;
    cout<<(a+b)%24;
}

Measured memory_bytes: 3612
/*Function Template*/
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair<ll,ll> pint;
const int MAX = 510000;
const int MOD = 1000000007;
#define rep(i, n) for(ll i = 0; i < (n); i++)
#define Rep(i, n) for(ll i = 1; i < (n); i++)
#define ALL(a)  (a).begin(),(a).end()
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define PI 3.14159265358979323846
ll fac[MAX], finv[MAX], inv[MAX];


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;
}
// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (ll i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }

}
ll Len(ll n) {
  ll s=0;
  while(n!=0) s++, n/=10;
  return s;
}


ll Sint(ll n) {
  ll m=0,s=0,a=n;
  while(a!=0) s++, a/=10;
  for(ll i=s-1;i>=0;i--) m+=n/((ll)pow(10,i))-(n/((ll)pow(10,i+1)))*10;
  return m;
}


ll Svec(vector<ll> v){
  ll n=0;
  for(ll i=0;i<v.size();i++) n+=v[i];
  return n;
}


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


ll LCM(ll a,ll b){
  return a/GCD(a,b)*b;
}


ll Factorial(ll n){
  ll m=1;
  while(n>=1) m*=n,n--;
  return m;
}

void runlength(string s,vector<pair<char,ll>> &p){
  ll x=1;
  if(s.size()==1){
    p.push_back(pair<char,ll>(s[0],1));
  }
  for(ll i=0;i<s.size()-1;i++){
    if(s[i]==s[i+1]){
      x++;
      if(i==s.size()-2){
        p.push_back(pair<char,ll>(s[i],x));
      }
    }else{
      p.push_back(pair<char,ll>(s[i],x));
      x=1;
      if(i==s.size()-2){
        p.push_back(pair<char,ll>(s[s.size()-1],x));
      }
    }
  }
}

ll COM(ll n,ll k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

ll modpow(ll a, ll n, ll mod) {
    ll res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}

string Toupper(string s){
  string ans="";
  rep(i,s.size()){
    if('a'<=s[i] && s[i]<='z') ans+=(char)s[i]-32;
    else ans+=s[i];
  }
  return ans;
}
string Tolower(string s){
  string ans="";
  rep(i,s.size()){
    if('A'<=s[i] && s[i]<='Z') ans+=(char)s[i]+32;
    else ans+=s[i];
  }
  return ans;
}


const int MAX_N=100010;
vector<bool> sieve_of_eratosthenes(){
  vector<bool> isPrime(MAX_N+1,true);
  for(int i=2;i<=MAX_N;i++){
    if(isPrime[i]){
      for(int j=2*i;j<=MAX_N;j+=i){
        isPrime[j]=false;
      }
    }
  }
  return isPrime;
}

vector<pint> prime_factorize(ll n){
  vector<pint> ans;
  for(ll p=2;p<=sqrt(n);p++){
    if(n%p!=0) continue;
    ll cnt=0;
    while(n%p==0){
      n/=p;
      cnt++;
    }
    ans.push_back(make_pair(p,cnt));
  }
  if(n!=1) ans.push_back(make_pair(n,1));
  return ans;
}

/*bool cmp(pint a, pint b) { return a.second < b.second; }*/

/*↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓*/
int main() {
  IOS;
  int h,a;
  cin>>h>>a;
  cout<<(h+a-1)/a<<endl;
}

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


n, m, q = map(int, input().split())
DP = [[0]*n for _ in range(n)]

for i in range(m):
    start, end = map(int, input().split())
    DP[start-1][end-1] += 1

for y in range(n):
    for x in range(y, n-1):
        DP[y][x+1] += DP[y][x]

for x in range(n):
    for y in range(x, 0, -1):
        DP[y-1][x] += DP[y][x]

for i in range(q):
    left, right = map(int, input().split())
    print(DP[left-1][right-1])


Measured memory_bytes: 9660
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(n);i++)
#define sz(x) int(x.size())
#define pb push_back
#define eb emplace_back
using ll=long long;
using P = pair<int,int>;
using LP=pair<ll,int>;
#define chmax(x,y) x = max(x,y)
#define chmin(x,y) x = min(x,y)
const ll MOD=1000000007,MOD2=998244353;



int main() {
    int N,K;
    string S;
    cin>>N>>S>>K;
    rep(i,N){
        if(S.at(K-1)==S.at(i)){
            cout<<S.at(i);
        }
        else{
            cout<<"*";
        }
    }
    cout<<endl;
}

Measured memory_bytes: 3628
#include<cstdio>
#include<algorithm>
#define N 100005
using namespace std;
int f[N][35];//2的30次方 
int a[N];
int n,wl,jd;
int main()
{
	scanf("%d",&n);
	for(int i=1;i<=n;i++)
	scanf("%d",a+i);
	scanf("%d%d",&wl,&jd);
	for(int i=1;i<=n;i++)
	{
        int nowd = (int)(upper_bound(a,a+n, a[i]+wl)-a-1);
		if(a[i]+wl>=a[n])//过了这个点 
		f[i][0]=n;
		else
		f[i][0]=nowd;
	}
	for(int j=1;j<=30;j++)
	for(int i=1;i<=n;i++)
	f[i][j]=f[f[i][j-1]][j-1];
	for(int q=0;q<jd;q++)
	{
		int x,y;
		scanf("%d%d",&x,&y);
		if(x>y)
		swap(x,y);
		int ans=0,cur=x;
		for(int i=30;i>=0;i--)
		{
			if(f[cur][i]<y)
			{
			ans+=(1<<i);
			cur=f[cur][i];
			}
		}
		printf("%d\n",ans+1);
	}
}

Measured memory_bytes: 14848
#define _USE_MATH_DEFINES
#include <iostream>
#include <complex>
#include <algorithm>
#include <vector>
#include <stack>
#include <string>
#include <queue>
#include <cmath>
#include <math.h>
#include <numeric>
#include <list>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <climits>
#include <set>
#include <memory.h>
#include <memory>
#include <cstdio>
#include <cstdlib>
#include <cctype>
#include <cassert>
#include <map>
#include <cassert>
#include <time.h>
#include <ctime>

using namespace std;

typedef complex<double> xy_t;
typedef pair<xy_t, xy_t> line;
typedef long long ll;
typedef pair<int, int> P;
typedef pair<int , P> PP;
typedef pair<int, string> Ps;
typedef vector<int> vec;
typedef vector<vec> mat;
const int INF = 1 << 27;
const double EPS = 1e-9;
const double PI = 3.1415926535897932384626433832795;
const int CLK = CLOCKS_PER_SEC;

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

double grow[100][100];
double dp[101][101];

int main(){
	int n, m;
	while(cin >> n >> m && (n || m)){
		fill(&dp[0][0], &dp[100][100] + 1, 0.0);
		rep(i, n)rep(j, n)cin >> grow[i][j];
		m--;
		rep(i, n) dp[0][i] = 1.0;
		rep(i, m){
			rep(j, n){
				rep(k, n){
					dp[i+1][j] = max(dp[i+1][j], dp[i][k] * grow[k][j]);
				}
			}
		}
		double res = 0.0;
		rep(i, n) res = max(res, dp[m][i]);
		cout << fixed << setprecision(2) << res << endl;
	}
}

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

int main()
{
   string s;
   cin>>s;
   bool ataken = false;
   int len = 0;
   int ans =0;
   for(int i=0;i<s.length();i++)
   {
       if(s[i]=='A' && !ataken )
       {
           len = 0;
           ataken = true;
       }
       if( ataken)
           len++;
       if( s[i] == 'Z')
           ans = len;
   }
   cout<<ans;
}

Measured memory_bytes: 3752
//#include <bits/stdc++.h>
//#include <stdio.h>
#include<iostream>
#include<cstdio>
#include<bitset>
#include<algorithm>
#include<vector>
#include<list>
#include<queue>
#include<stack>
#include<string>
#include<string.h>
#include<cmath>
#include<utility>
#include<functional>
#include<map>
#include<set>
#include<cctype>
#include<fstream>


#define FOR(i, a, b) for( int i=(a);i<=(b);i++)
#define RFOR(i, a, b) for( int i=(a);i>=(b);i--)
#define LFOR(i, a, b) for( long long int i=(a);i<=(b);i++)
#define LRFOR(i, a, b) for(long long int i=(a);i>=(b);i--)
#define MOD 1000000007
#define INF 1000000000 //2000000000
#define LLINF 1000000000000000000 //9000000000000000000
#define PI 3.14159265358979
#define MAXI 7500000

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

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



int main(void) {
	double t, x;

	cin >> t >> x;

	cout << t/x << endl;


	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define nl '\n'
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
const int INFI = 0x3f3f3f3f;
const ll INFLL = 0x3f3f3f3f3f3f3f3f;
const int MAXN = 302;
int N, freq[4];
double ex[MAXN][MAXN][MAXN];
bool vis[MAXN][MAXN][MAXN];
double solve(int a, int b, int c){
	if(vis[a][b][c])return ex[a][b][c];
	vis[a][b][c] = true;
	double pc = (double)(a+b+c)/(double)(N);
	double exc = (1.0)/pc, tot = 0.0;
	if(a>0){
		double p = (double)(a)/(double)(a+b+c);
		tot+=p*(solve(a-1, b+1, c)+exc);
	}
	if(b>0){
		double p = (double)(b)/(double)(a+b+c);
		tot+=p*(solve(a, b-1, c+1)+exc);
	}
	if(c>0){
		double p = (double)(c)/(double)(a+b+c);
		tot+=p*(solve(a, b, c-1)+exc);
	}
	return ex[a][b][c] = tot;
}
int main(){
	cin.tie(0);
	cin.sync_with_stdio(0);
	cin >> N;
	for(int i = 0, x;i<N;i++){cin >> x; freq[x]++;}
	cout << fixed << setprecision(9) << solve(freq[3], freq[2], freq[1]) << nl;
	
	return 0;
}

Measured memory_bytes: 241920
#include<cstdio>
#include<iostream>
#include<algorithm>
#include<cstring>
#include<cmath>
typedef long long ll;
using namespace std;
inline int max(int a,int b){return a>b?a:b;}
inline int min(int a,int b){return a<b?a:b;}
inline int rd(){
	int res=0,sign=1;char ch;
	while((ch=getchar())<'0'||ch>'9')if(ch=='-')sign=-1;res=res*10+ch-48;
	while((ch=getchar())>='0'&&ch<='9')res=res*10+ch-48;
	return res*sign;
}
int n;
int f[200001];
int main(){
    cin>>n;
    for(int i=1;i<=n;i++)cin>>f[i];
    sort(f+1,f+n+1);
	for(int i=1;i<=n;i++){
		if(f[i]!=f[i+1])continue;
		else {
	     	puts("NO");	
	     	return 0;
		}
	} 
	puts("YES");
	return 0;
}

Measured memory_bytes: 1024
#include<iostream>

#define MAX(a,b) (a>b? a:b)
#define MIN(a,b) (a>b? b:a)
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define lint long int

using namespace std;

int main(){
	lint a,b;
	cin >> a >> b;
    if(b%a==0) cout << a+b << endl;
    else cout << b-a << endl;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long
#define ld long double
#define all(v) v.begin(),v.end()
#define sz size()
#define mp make_pair
#define pb push_back
#define rep(p,a,b) for(ll p=a ; p<b ; p++)
#define F first
#define S second
using namespace std;

typedef vector <ll> vl;
typedef pair< ll, ll > pll;


int main()
{
    ll t,i,j,k,ans,n;

    //cin>>t;
    t=1;
    while(t--)
    {
        cin>>n;
        vl v(n);
        rep(p, 0, n)cin>>v[p];

        cout<<(*max_element(all(v)))-(*min_element(all(v)));
    }
    
    return 0;
}


Measured memory_bytes: 3580
#include<bits/stdc++.h>
using namespace std;
const int N=13;
typedef unsigned long long ull;
ull base=233,inv=7204522363551799129;
int n,m;
char s[N][N];
unordered_map<ull,int>vis;
bool judge(int x)
{
    vector<int>v1,v2;
    for(int i=1;i<=n;i++)
        if(x>>i-1&1)
        v1.push_back(i);
    else v2.push_back(i);
    while(true)
    {
        if(m&1)
        {
            for(int k=1;k<=m;k++)
            {
                ull hs1=0,hs2=0;
                for(int j=0;j<v1.size();j++)
                    hs1=hs1*base+s[v1[j]][k]-'a'+1;
                for(int j=0;j<v2.size();j++)
                    hs1=hs1*base+s[v2[j]][k]-'a'+1;
                for(int j=v2.size()-1;j>=0;j--)
                    hs2=hs2*base+s[v2[j]][k]-'a'+1;
                for(int j=v1.size()-1;j>=0;j--)
                    hs2=hs2*base+s[v1[j]][k]-'a'+1;
                if(hs1==hs2)
                {
                    vis.clear();
                    int tot=0;
                    for(int i=1;i<=m;i++)
                    {
                        if(i==k) continue;
                        ull hs=0;
                        for(int j=0;j<v1.size();j++)
                            hs=hs*base+s[v1[j]][i]-'a'+1;
                        for(int j=0;j<v2.size();j++)
                            hs=hs*base+s[v2[j]][i]-'a'+1;
                        if(vis[hs])
                            tot++,vis[hs]--;
                        else
                        {
                            hs=0;
                            for(int j=v2.size()-1;j>=0;j--)
                                hs=hs*base+s[v2[j]][i]-'a'+1;
                            for(int j=v1.size()-1;j>=0;j--)
                                hs=hs*base+s[v1[j]][i]-'a'+1;
                            vis[hs]++;
                        }
                    }
                    if(tot==m/2) return true;
                }
            }
        }
        else
        {
            vis.clear();
            int tot=0;
            for(int i=1;i<=m;i++)
            {
                ull hs=0;
                for(int j=0;j<v1.size();j++)
                    hs=hs*base+s[v1[j]][i]-'a'+1;
                for(int j=0;j<v2.size();j++)
                    hs=hs*base+s[v2[j]][i]-'a'+1;
                if(vis[hs])
                    tot++,vis[hs]--;
                else
                {
                    hs=0;
                    for(int j=v2.size()-1;j>=0;j--)
                        hs=hs*base+s[v2[j]][i]-'a'+1;
                    for(int j=v1.size()-1;j>=0;j--)
                        hs=hs*base+s[v1[j]][i]-'a'+1;
                    vis[hs]++;
                }
            }
            if(tot==m/2) return true;
        }
        if(!next_permutation(v2.begin(),v2.end())) break;
    }
    return false;
}
int main()
{
    scanf("%d%d",&n,&m);
    for(int i=1;i<=n;i++)
        scanf("%s",s[i]+1);
    int up=1<<n;
    for(int i=0;i<up;i++)
        if(__builtin_popcount(i)==n/2&&judge(i))
        {
            printf("YES\n");return 0;
        }
    printf("NO\n");
}


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

int main() {
	int n;
	cin >> n;
	long s = 100000;
	for (int i = 0; i<n; i++) {
		s = s * 1.05;
		int s1 = s % 1000;
		if (s1 != 0) {
			s = s - s1 + 1000;
		}
	}
	cout << s << "\n";
	return 0;
}

Measured memory_bytes: 3080
import sys

import bisect

# from collections import Counter, deque, defaultdict
# import copy
# from heapq import heappush, heappop, heapify
# from fractions import gcd

import itertools

# from operator import attrgetter, itemgetter
# import math

# import numpy as np

readline = sys.stdin.readline
MOD = 10 ** 9 + 7
INF = float('INF')
sys.setrecursionlimit(10 ** 5)


def main():
    x, y, z, k = list(map(int, readline().split()))
    a = list(map(int, readline().split()))
    b = list(map(int, readline().split()))
    c = list(map(int, readline().split()))

    ab = [0] * x * y

    ab = [i + j for i, j in itertools.product(a, b)]
    ab.sort(reverse=True)
    c.sort(reverse=True)

    ab = ab[:k]

    abc = [i + j for i, j in itertools.product(ab, c)]
    abc.sort(reverse=True)

    print(*abc[:k],sep="\n")

if __name__ == '__main__':
    main()


Measured memory_bytes: 149744
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;
typedef long long ll;
int main(){
    int n,k,q;
    cin >> n >> k >> q;
    vector<int> point(n,k-q);
    for(int i=0;i<q;i++){
        int win;
        cin >> win;
        point.at(win-1)++;
    }
    for(int i=0;i<n;i++){
        if(point.at(i)>0) printf("Yes\n");
        else printf("No\n");
    }
}


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

namespace AtCoder
{
    class Program
    {
        static void Main(string[] args)
        {
            int n = int.Parse(Console.ReadLine());
            int x = 0;
            foreach (char c in n.ToString())
            {
                x += c - '0';
            }
            Console.WriteLine(n % x == 0 ? "Yes" : "No");
        }
    }
}

Measured memory_bytes: 11220
#include<bits/stdc++.h>
using namespace std;
int main()
{
  int sx,sy,tx,ty,i;
    cin>>sx>>sy>>tx>>ty;
    for(i=0;i<abs(tx-sx);i++)
        cout<<"R";
    for(i=0;i<abs(ty-sy);i++)
        cout<<"U";
    for(i=0;i<abs(tx-sx);i++)
        cout<<"L";
    for(i=0;i<abs(ty-sy);i++)
        cout<<"D";
    cout<<"D";
    for(i=0;i<abs(tx-sx+1);i++)
        cout<<"R";
    for(i=0;i<abs(ty-sy+1);i++)
        cout<<"U";
    cout<<"L";
    cout<<"U";
    for(i=0;i<abs(tx-sx+1);i++)
        cout<<"L";
    for(i=0;i<abs(ty-sy+1);i++)
        cout<<"D";
    cout<<"R";
    
return 0;
}

Measured memory_bytes: 256
from collections import defaultdict
N, M = list(map(int, input().split()))
count = defaultdict(int)
for _ in range(M):
    a, b = list(map(int, input().split()))
    count[a] += 1
    count[b] += 1

for i in range(1, N + 1):
    print(count[i])

Measured memory_bytes: 3316
#include <iostream>
#include <math.h>
#include <algorithm>
#include <vector>
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define INF 2e9
#define ALL(v) v.begin(), v.end()
#define ll long long int
#define PI 3.141592653589793
using namespace std;

int main(void){
    string N,ans;

    cin >> N;
    if(N[0] == N[2]) ans = "Yes";
    else ans = "No";
    
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
 
using namespace std;
typedef unsigned long long ull;
typedef long long ll;
typedef pair<ll, ll> pii;
 
#define REP(a,b,c) for(ll (a)=(b);(a)<(c);(a)++)
#define PER(a,b,c) for(ll (a)=(b);(a)>=(c);(a)--)
 
void ii(ll &x){ cin >> x; }
void is(string &x){ cin >> x; }
void oi(ll x){ cout << x << " "; }
void os(string x){ cout << x; }
void oie(ll x){ cout << x << endl; }
void ose(string x){ cout << x << endl; }
void oe(){ cout << endl; }
 
ll INF = 1e9+7;

ll n;
void dfs(string s, char c){
    if(s.length()==n){
        ose(s);
    }else{
        for(char cc='a'; cc<=c; cc++){
            if(c==cc){
                dfs(s+cc,c+1);
            }else{
                dfs(s+cc,c);
            }
        }
    }
}

int main(){
    ii(n);
    dfs("",'a');    
    return 0;
}

Measured memory_bytes: 1536
#include<bits/stdc++.h>
#define int long long
#define rep(i,n) for(int i=1;i<n;i++)
using namespace std;
signed main(){
	int a,b,c,d,e,f,g,h,i;
	cin>>a>>b>>c;
	cin>>d>>e>>f;
	cin>>g>>h>>i;
	if(a-b==d-e&&d-e==g-h&&b-c==e-f&&e-f==h-i)cout<<"Yes"<<endl;
	else cout<<"No"<<endl;
}


Measured memory_bytes: 256
N, M = map(int, input().split(" "))
Hs = list(map(int, input().split(" ")))
candidate = set(range(1, N+1))
for _ in range(M):
    i, j = map(int, input().split(" "))
    if Hs[i - 1] >= Hs[j - 1]:
        # jは良い展望台ではない
        candidate.discard(j)
    if Hs[j - 1] >= Hs[i - 1]:
        # iは良い展望台ではない
        candidate.discard(i)
print(len(candidate))


Measured memory_bytes: 22456
#include "bits/stdc++.h"
using namespace std;
#define fst first
#define scd second
int main()
{
	int a, b;
	scanf("%d%d", &a, &b);
	for(int i = 1; i < 1000000; ++i)
	{
		if(a == (int)(((double)i) * 0.08) && b == (int)(((double)i) * 0.10))
		{
			printf("%d\n", i);
			return 0;
		}
	}
	printf("-1\n");
}

Measured memory_bytes: 256
#ifndef BZ
#pragma GCC optimize "-O3"
#endif
#include <bits/stdc++.h>

#define FASTIO

#ifdef FASTIO
#define scanf abacaba
#define printf abacaba
#endif

typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;

using namespace std;


/*
ll pw(ll a, ll b) {
	ll ans = 1; while (b) {
		while (!(b & 1)) b >>= 1, a = (a * a) % MOD;
		ans = (ans * a) % MOD, --b;
	} return ans;
}
*/

string s;

int blen = 0;
int bans = 0;

int dp[21][1 << 20];
int tr[21][1 << 20];

void upd(int len, int ans) {
	if (len < blen)
		return;
	if (len > blen) {
		blen = len, bans = ans;
	}
	else if (len == blen && ans < bans) {
		bans = ans;
	}
}

int n, k;

int main() {
#ifdef FASTIO
	ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);
#endif
	cin >> n >> k;
	for (int i = 0; i <= n; ++i) {
		cin >> s;
		for (int j = 0; j < (1 << i); ++j) {
			if (s[j] == '1') {
				++dp[i][j];
			}
		}
	}
	for (int i = 1; i <= n; ++i)
		for (int j = 0; j < (1 << i); ++j) {
			int x = (j >> (i - 1)) & 1;
			int ans = 0;
			while (ans < i && ((j >> (i - ans - 1)) & 1) == x)
				++ans;
			if (ans == i)
				tr[i][j] = -1;
			else
				tr[i][j] = ans;
		}
	for (int l = 0; l <= n; ++l) {
		for (int i = l + 1; i <= n; ++i) {
			int msk = (1 << (i - l)) - 1;
			for (int j = 0; j < (1 << i); ++j) {
				dp[l][j >> (i - l)] += dp[i][j];
				int x = tr[i - l][j & msk];
				if (x != -1) {
					dp[i - x][((j >> (i - l)) << (i - l - x)) + (j & ((1 << (i - l - x)) - 1))] += dp[i][j];
				}
			}
		}
		for (int i = 0; i < (1 << l); ++i)
			if (dp[l][i] >= k)
				upd(l, i);
	}
	for (int i = blen - 1; i >= 0; --i) {
		cout << ((bans >> i) & 1);
	}
	cout << "\n";
	return 0;
}




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

int gcd(int n,int m)
{
        if(m==0)
                return n;
        else
                return gcd(m,n%m);
}

int tgcd(int a, int b, int c)
{
    return gcd(gcd(a,b),c);
}

int main()
{
    ios_base::sync_with_stdio(false);
    int k;
    cin >> k;
    unsigned long long sum = 0;
    for (int c = 1; c <= k; ++c) {
        for (int b = 1; b <= k; ++b) {
            for (int a = 1; a <= k; ++a) {
                sum += tgcd(a,b,c);
            }
        }
    }
    cout << sum << endl;
}



Measured memory_bytes: 3652
#include <cstdio>
#include <cstring>
#include <iostream>
#include <string>
#include <cmath>
#include <bitset>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <algorithm>
#include <complex>
#include <unordered_map>
#include <unordered_set>
#include <random>
#include <cassert>
#include <fstream>
#include <utility>
#include <functional>
#define popcount __builtin_popcount
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;

template<typename Monoid, typename OperatorMonoid=Monoid>
struct LazySegmentTree{
	using F=function<Monoid(Monoid, Monoid)>;
	using G=function<Monoid(Monoid, OperatorMonoid, int)>;
	using H=function<OperatorMonoid(OperatorMonoid, OperatorMonoid)>;
	int sz;
	vector<Monoid> data;
	vector<OperatorMonoid> lazy;
	const F f;
	const G g;
	const H h;
	const Monoid e1;
	const OperatorMonoid e0;

	LazySegmentTree(int n, const F f, const G g, const H h, const Monoid &e1, const OperatorMonoid &e0): f(f), g(g), h(h), e1(e1), e0(e0){
		sz=1;
		while(sz<n) sz<<=1;
		data.resize(2*sz-1, e1);
		lazy.resize(2*sz-1, e0);
	}

	void build(vector<Monoid> v){
		for(int i=0; i<v.size(); i++) data[i+sz-1]=v[i];
		for(int i=sz-2; i>=0; i--) data[i]=f(data[2*i+1], data[2*i+2]);
	}

	void eval(int k, int l, int r){
		if(lazy[k]!=e0){
			data[k]=g(data[k], lazy[k], r-l);
			if(k<sz-1){
				lazy[2*k+1]=h(lazy[2*k+1], lazy[k]);
				lazy[2*k+2]=h(lazy[2*k+2], lazy[k]);
			}
		}
		lazy[k]=e0;
	}

	void update(int a, int b, const OperatorMonoid &x, int k, int l, int r){
		eval(k, l, r);
		if(r<=a || b<=l) return;
		if(a<=l && r<=b){
			lazy[k]=h(lazy[k], x);
			eval(k, l, r);
		}else{
			update(a, b, x, 2*k+1, l, (l+r)/2);
			update(a, b, x, 2*k+2, (l+r)/2, r);
			data[k]=f(data[2*k+1], data[2*k+2]);
		}
	}
	void update(int a, int b, const OperatorMonoid &x){
		return update(a, b, x, 0, 0, sz);
	}

	Monoid find(int a, int b, int k, int l, int r){
		eval(k, l, r);
		if(b<=l || r<=a) return e1;
		if(a<=l && r<=b) return data[k];
		else return f(find(a, b, 2*k+1, l, (l+r)/2), find(a, b, 2*k+2, (l+r)/2, r));
	}
	Monoid find(int a, int b){
		return find(a, b, 0, 0, sz);
	}
};
const int INF=1e9+7;
int main()
{
	int n, q;
	scanf("%d %d", &n, &q);
	auto f=[](int a, int b){ return min(a, b);};
	auto g=[](int a, int x, int len){ return a+x;};
	auto h=[](int x, int y){ return x+y;};
	LazySegmentTree<int> seg(n, f, g, h, INF, 0);
	vector<int> a(n);
	seg.build(a);
	for(int z=0; z<q; z++){
		int p; scanf("%d", &p);
		if(p==0){
			int s, t, x;
			scanf("%d %d %d", &s, &t, &x);
			seg.update(s, t+1, x);
		}else{
			int s, t;
			scanf("%d %d", &s, &t);
			printf("%d\n", seg.find(s, t+1));
		}
	}
	return 0;
}


Measured memory_bytes: 5792
#include <stdio.h>
#include <stdlib.h>
#include <math.h>


int main(void){
	unsigned long i,o,t,j,l,s,z;
	unsigned long k=0;
	
	scanf("%lu %lu %lu %lu %lu %lu %lu",&i,&o,&t,&j,&l,&s,&z);
	
	k+=o;
	unsigned long wa=i+j+l;
	
	if((i%2==1 && j%2==1 && l%2==1) || (i%2==0 && j%2==0 && l%2==0)){
		k+=wa;
	}
	else if(wa!=2){
		k+=(wa-1);
	}
	
	printf("%lu\n",k);
	return 0;
}

Measured memory_bytes: 128
#include<stdio.h>

int main(){

  int n;
  int i,j,k;
  int flag;

  scanf("%d",&n);

  int Adj[n+1][n+2];

  for(i=1;i<=n;i++){
    scanf("%d",&Adj[i][0]);
    scanf("%d",&Adj[i][1]);
    for(j=0;j<Adj[i][1];j++){
      scanf("%d",&Adj[i][j+2]);
    }
  }

  for(i=1;i<=n;i++){
    for(j=1;j<=n;j++){
      flag=0;
      for(k=0;k<Adj[i][1];k++){
	if(j == Adj[i][k+2]){
	  printf("1");
	  flag=1;
	  break;
	}
      }
      if(!flag) printf("0");
      if(j<n) printf(" ");
    }
    printf("\n");
  }

  return 0;
}



Measured memory_bytes: 2056