akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<vector>
#include<algorithm>
#include<cctype>

#define REP(n) for(int i = 0;i < n;i++)
typedef long long int ll;
using namespace std;
#define MAX_A 1000000005

int main(){

    string a,b;
    cin >> a >> b;
    int a_len = a.length();
    int b_len = b.length();

    if(a_len > b_len){
        cout << "GREATER" << endl;
    }else if(a_len < b_len){
        cout << "LESS" << endl;
    }else if(a > b){
        cout << "GREATER" << endl;
    }else if(a < b){
        cout << "LESS" << endl;
    }else{
        cout << "EQUAL" << endl;
    }


    return 0;
}

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

int main(){
  string s;
  cin >>s;
  if(s.size()==3) reverse(s.begin(), s.end());
  cout << s << endl;
  return 0;
}

Measured memory_bytes: 256
import sys
sys.setrecursionlimit(10**9)

n = int(input())
a = list(map(int, input().split()))
q = int(input())
m = list(map(int, input().split()))

dp = []
def solve(i, m):
    if i == n:
        dp.append(m)
        return
    solve(i+1, m)
    solve(i+1, m+a[i])
solve(0, 0)

for i in m:
    if i in dp:
        print("yes")
    else:
        print("no")


Measured memory_bytes: 43088
import math
N = int(input())
ss = []
ans = 0
def comb(l, r):
    if l == 0: return 0
    if l == 1: return 0
    return math.factorial(l)//(math.factorial(l-r)*math.factorial(r))

for _ in range(N):
    s = list(input())
    s.sort()
    ss.append(s)
ss.sort()

cnt = 1
for i in range(N-1):
    if ss[i] == ss[i + 1]:
        cnt += 1
    else:
        ans += comb(cnt,2)
        cnt = 1
ans += comb(cnt,2)        
print(ans)

Measured memory_bytes: 25512
#include<bits/stdc++.h>
using namespace std;
int n,m;

int main(){
	scanf("%d",&n);
	if(n&1){
		m=n*(n-1)/2-(n-1)/2;
		printf("%d\n",m);
		for(int i=1;i<=n;i++){
			for(int j=i+1;j<=n;j++){
				if(i+j==n) continue;
				printf("%d %d\n",i,j);
			}
		}
	}
	else{
		m=n*(n-1)/2-n/2;
		printf("%d\n",m);
		for(int i=1;i<=n;i++){
			for(int j=i+1;j<=n;j++){
				if(i+j==n+1) continue;
				printf("%d %d\n",i,j);
			}
		}
	}
	
	return 0;
}

Measured memory_bytes: 256
#include <vector>
#include <stack>
#include <queue>
#include <list>
#include <bitset>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <algorithm>
#include <numeric>
#include <iostream>
#include <iomanip>
#include <string>
#include <chrono>
#include <random>
#include <cmath>
#include <cassert>
#include <climits>
#include <cstring>
#include <cstdlib>
#include <functional>
#include <sstream>

using namespace std;

int main(int argc, char** argv) {
    ios::sync_with_stdio(false);
    cin.tie(0);

    int n;
    cin >> n;

    auto gcd = [&](int x, int y) {
        while (x != 0) {
            y %= x;
            swap(x, y);
        }
        return y;
    };

    long long res = 0;
    for (int i = 1; i <= n; ++i) {
        for (int j = 1; j <= n; ++j) {
            for (int k = 1; k <= n; ++k) {
                res += gcd(gcd(i, j), k);
            }
        }
    }

    cout << res << "\n";

    return 0;
}

Measured memory_bytes: 3640
#include <iostream>
#include <string>
#include <vector>
#include <sstream>
#include <set>
using namespace std;
int main() {
    int s;
    cin >> s;
    int temp;
    int m = -1;
    int sum = 0;
    for (int i = 0; i < s; i++){
        cin >> temp;
        sum += temp;
        if (temp > m)
            m = temp;
    }
    cout << sum - m + double(m)/2;
    return 0;
}

Measured memory_bytes: 256
import java.util.*;
public class Main{
  static class Store implements Comparable<Store>{
    long price, cans;
    Store(long price, long cans){
      this.price = price;
      this.cans = cans;
    }
    public int compareTo(Store obj){
      if(this.price > obj.price){return 1;}
      if(this.price < obj.price){return -1;}
      return 0;
    }
  }
  
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    long N = sc.nextLong();
    long M = sc.nextLong();
    List<Store> stores = new ArrayList<>();
    for(int i=0; i<N; i++){
      stores.add(new Store(sc.nextLong(), sc.nextLong()));
    }
    Collections.sort(stores);
    long sum = 0;
    for(int i=0; i<N; i++){
      Store si = stores.get(i);
      if(si.cans < M){
        sum += si.price*si.cans;
        M -= si.cans;
      }else{
        sum += si.price*M;
        break;
      }
    }
    System.out.print(sum);
  }
}


Measured memory_bytes: 91728
#include <bits/stdc++.h>
#include <iomanip>
 
using namespace std;
 
typedef long long LL;
typedef long double LD;
typedef pair<int, int> PII;
typedef pair<LL, LL> PLL;
typedef pair<LD, LD> PLDLD;
typedef vector<int> VI;
typedef vector<LL> VLL;
typedef vector<char> VB;
 
#define FOR(i,a,b) for(int i=(a);i<(int)(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define CLR(a) memset((a), 0 ,sizeof(a))
#define ALL(a) a.begin(),a.end()
 
const LD eps=1e-10;
const long long INFLL=(LL)(1e9)*(LL)(1e9);
const int INF=1e9;
 
template<class T>
void chmin(T& a, const T b)
{
	if(a>b)
		a=b;
}
template<class T>
void chmax(T& a, const T b)
{
	if(a<b)
		a=b;
}
 
const LL pow(const LL p, const LL q)
{
	LL t=1;
	for(int i=0;i<q;i++)
		t*=p;
	return t;
}

template <typename T>
struct has_iter
{
	private:
		template <typename U>
		static constexpr true_type check(typename U::iterator*);
		template <typename U>
		static constexpr false_type check(...);

	public:
		static constexpr bool value = decltype(check<T>(nullptr))::value;
};

template<typename T, typename U = typename T::iterator>
void print(const T& container)
{
		auto&& first=begin(container), last=end(container);
		auto&& back=prev(last);
		for(auto e=first; e!=last; e=next(e))
			cout<<*e<<" \n"[e==back];
}

extern void* enabler;
template<typename Head, typename enable_if<!has_iter<Head>::value>::type*& = enabler>
void print(const Head& head)
{
	cout<<head<<endl;
}

template<typename Head, typename... Tail>
void print(const Head& head, const Tail&... tail)
{
	cout<<head<<" ";
	print(tail...);
}

void io_speedup()
{
	cin.tie(0);
	ios::sync_with_stdio(false);
}

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

template<typename T>
vector<T> read(int n)
{
	vector<T> t(n);
	cin>>t;
	return t;
}

template<typename T>
T read()
{
	T t;
	cin>>t;
	return t;
}


int main()
{
	int n;
	cin>>n;
	vector<int> a(n+2);
	REP(i,n)
	{
		cin>>a[i+1];
	}
	vector<int> b(n+2);
	REP(i,n+1)
	{
		b[i+1]+=abs(a[i+1]-a[i]) + b[i];
	}
	REP(i,n)
	{
		print(b[n+1]-b[i+2] + b[i] + abs(a[i+2]-a[i]));
	}
}


Measured memory_bytes: 2048
#include <iostream>
#include <string>
#include <vector>
#include <cmath>
#include <algorithm>
 
using namespace std;
 
int main(){
 double N,M;
 cin>>N>>M;
 int count=0;
 vector<double> shina(1000);
 for(int i = 0;i<1000;i++){
     cin>>shina.at(i);
 }
  double sum=0;
  for(int i = 0;i<1000;i++){
    sum += shina.at(i);
  }
for(int i=0;i<1000;i++){
    if(shina.at(i)>=(sum/(4*M))){
        count++;
    }
}
if(count>=M)cout<<"Yes"<<endl;
else cout<<"No"<<endl;
}

Measured memory_bytes: 256
hp_a,at_a,hp_b,at_b = map(int, input().split())


b_death = ((hp_b-0.01) // at_a) + 1
a_death = ((hp_a-0.01) // at_b) + 1


if b_death > a_death:
  print("No")
else:
  print("Yes")

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

namespace ConsoleApp1
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] inputData = Console.ReadLine().Split(' ');
            int eight = int.Parse(inputData[0]);
            int ten = int.Parse(inputData[1]);

            for (int loop = 1; loop < 10000; loop++) {
                if ((int)(loop * 0.08) == eight && (int)(loop * 0.1) == ten) {
                    Console.WriteLine(loop);
                    return;
                }
            }
            Console.WriteLine("-1");
            Console.ReadLine();
        }
    }
}


Measured memory_bytes: 13140
// B - Varied

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
// const int INF = 2147483647;
// const ll INF = 9223372036854775807;
// const ll MOD = 1e9 + 7;

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

	sort(S.begin(), S.end());

	string ans = "yes";
	for (int i=0; i<S.size()-1; i++) {
		if (S[i] == S[i+1]) ans = "no";
	}

	cout << ans << endl;

	return 0;
}

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

int main() {
	int k, x;
	cin >> k>> x;
	int l = x-k+1;
	int r= k+x-1;
	l  = max(l,-1000000);
	r  = min(r, 1000000);
	int i;
	for(i=l;i<=r;i++) cout<<i<<" ";
	return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
int main(void){
    int N,i,k,j;
    int ans=0,V[20],C[20];
    scanf("%d",&N);
    for(i=0;i<N;i++){
        scanf("%d",&V[i]);
    }
    for(j=0;j<N;j++){
        scanf("%d",&C[j]);
    }
    for(k=0;k<N;k++){
      if(V[k]>C[k]){
        ans=ans+(V[k]-C[k]);
    }
    else {

    }
    }
    printf("%d",ans);
    return 0;
}
    





Measured memory_bytes: 128
#include <iostream>
#include <cmath>
#include <cstdio>
#include <vector>
#include <string>

using namespace std;

int main() {
    int a, b, c;
    cin >> a >> b >> c;
    if (a + b == c)
    {
        cout << "Yes" << endl;
    }
    else if(b + c == a)
    {
        cout << "Yes" << endl;
    }
    else if (a + c == b)
    {
        cout << "Yes" << endl;
    }
    else
    {
        cout << "No" << endl;
    }

    return 0;
}

Measured memory_bytes: 888
#include <bits/stdc++.h>
using namespace std;
int main(){
  int a,b,c;
  cin >> a>> b>> c;
  int ans=a*100+b*10+c;
  if(ans%4==0){
    cout << "YES" << "\n";
  }else{
    cout <<"NO" << "\n";
  }
}

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

#define endl '\n'

int const N=11, M = 11, Q= 51;
int n,m,q, a[Q], b[Q], c[Q], d[Q], ans=0, p[N];

void solve(int i, int num){
    p[i] = num;
    if (i < n){
        for (int j=num; j<=m; j++){
            solve(i+1, j);
        }
    } else{
        int tempans = 0;
        for (int i=0; i<q; i++){
            if (p[b[i]] - p[a[i]] == c[i]) tempans += d[i];
        }
        ans = max(tempans, ans);
    }
}

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

    cin >> n >> m >> q;
    for (int i=0; i<q; i++) cin >> a[i] >> b[i] >> c[i] >> d[i];

    solve(0, 1);
    cout << ans << endl;
}

Measured memory_bytes: 3652
IDENTIFICATION DIVISION.
       PROGRAM-ID. ABC046-B.
       DATA DIVISION.
       FILE SECTION.
       WORKING-STORAGE SECTION.
       77 STR PIC X(11).
       77 N PIC 9(4).
       77 K PIC 9(4).
       77 ANS PIC 9(10).
       77 ANSS PIC Z(9)9.

       PROCEDURE DIVISION.
       MAIN-PROCEDURE.
               ACCEPT STR FROM SYSIN.
               UNSTRING STR DELIMITED " "
                INTO N K.
               COMPUTE ANS = K * (K - 1) ** (N - 1).
               MOVE ANS TO ANSS.
               DISPLAY ANSS.
               STOP RUN.
       END PROGRAM ABC046-B.


Measured memory_bytes: 384
def getN():
    return int(input())
def getNM():
    return map(int, input().split())
def getList():
    return list(map(int, input().split()))

class UnionFind:
    def __init__(self, n):
        self.par = [i for i in range(n+1)]
        self.rank = [0] * (n+1)

    # 検索
    def find(self, x):
        if self.par[x] == x:
            return x
        else:
            self.par[x] = self.find(self.par[x])
            return self.par[x]

    # 併合
    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)
        if self.rank[x] < self.rank[y]:
            self.par[x] = y
        else:
            self.par[y] = x
            if self.rank[x] == self.rank[y]:
                self.rank[x] += 1

    # 同じ集合に属するか判定
    def same_check(self, x, y):
        return self.find(x) == self.find(y)

n,m = getList()
uf = UnionFind(n)
for i in range(m):
    x, y, _ = getList()
    if not uf.same_check(x,y):
        uf.union(x,y)
        
for i in range(n+1):
    uf.find(i)


print(len(list(set(uf.par[1:]))))

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

int main() {
  int N;
  cin >> N;
  if (N<600) {
    cout << 8 << endl;
  } else if (N<800) {
    cout << 7 << endl;
  } else if (N<1000) {
    cout << 6 << endl;
  } else if (N<1200) {
    cout << 5 << endl;
  } else if (N<1400) {
    cout << 4 << endl;
  } else if (N<1600) {
    cout << 3 << endl;
  } else if (N<1800) {
    cout << 2 << endl;
  } else {
    cout << 1 << endl;
  }
  
}

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

typedef long long ll;
const int INF = 1e9;
const ll MOD = 1e9 + 7;
const ll LINF = 1e18;
#define y0 y3487465
#define y1 y8687969
#define j0 j1347829
#define j1 j234892
#define next asdnext
#define prev asdprev
#define MP make_pair
#define F first
#define S second
#define PB push_back
#define dump(x)  cout << #x << " = " << (x) << endl;	//debug
#define SZ(x) ((ll)(x).size())
#define FOR(i, a, b) for (ll i = (a); i <= (b); i++)
#define RFOR(i, a, b) for (ll i = (a); i >= (b); i--)
#define ps(s) cout << #s << endl;
#define pv(v) cout << (v) << endl;
#define pvd(v) cout << setprecision(16) << (v) << endl;
#define ALL(a)  (a).begin(),(a).end()
#define RANGE(a, start_index, num)  (a).begin()+(start_index),(a).begin()+(num)

int n, a, b, c;
int L[8] = {};
int abc[8] = {};
int res = INF;

void dfs(int cnt, int tp) {
	abc[cnt] = tp;
	if (cnt == n - 1) {
		int la = 0, lb = 0, lc = 0;
		int na = 0, nb = 0, nc = 0;
		FOR(i, 0, n - 1) {
			if (abc[i] == 1) {
				la += L[i];
				na++;
			}
			if (abc[i] == 2) {
				lb += L[i];
				nb++;
			}
			if (abc[i] == 3) {
				lc += L[i];
				nc++;
			}
		}
		if (na == 0 || nb == 0 || nc == 0) {
			return;
		}
		int tmp = abs(a - la) + abs(b - lb) + abs(c - lc);
		if (na >= 2) tmp += (na - 1) * 10;
		if (nb >= 2) tmp += (nb - 1) * 10;
		if (nc >= 2) tmp += (nc - 1) * 10;
		res = min(res, tmp);
	}
	else {
		FOR(i, 0, 3) {
			dfs(cnt + 1, i);
		}
	}
}

int main() {
	cin >> n >> a >> b >> c;
	FOR(i, 0, n-1) {
		cin >> L[i];
	}
	FOR(i, 0, 3) {
		dfs(0, i);
	}
	pv(res)
	return 0;
}

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

typedef struct {
 long long a,b;
} reinoare;

bool cmp(const reinoare &a,const reinoare &b) {
 return (a.a + a.b) > (b.a + b.b);
}

int main() {
 int n;cin >> n;
 reinoare aa[n];
 for (int i = 0;i < n;i++) {
  cin >> aa[i].a >> aa[i].b;
 }
 long long ansT = 0,ansA = 0;
 bool nT = true;
 sort(aa,aa+n,cmp);
 for (int i = 0;i < n;i++) {
  reinoare next = aa[i];
  if (nT) {ansT += next.a;nT = false;}
  else {ansA += next.b;nT = true;}
 }
 cout << ansT - ansA << endl;
}

Measured memory_bytes: 1792
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <unordered_map>

using namespace std;

const int N = (int) 1e4 + 5;
const int M = (int) 1e9 + 7;

typedef long long ll;

string s;

bool pal(int l, int r, string &p) {
    if (r < l) return false;
    while (l < r && p[l] == p[r]) l++, r--;
    return p[l] == p[r];
}

int main() {
    cin >> s;

    int n = s.length();

    cout << ((pal(0, n - 1, s) && pal(0, n / 2 - 1, s) && pal(n / 2 + 1, n - 1, s)) ? "Yes" : "No") << endl;

    return 0;
}

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

using namespace std;
void Output(const vector<int>& List)
{
    for(std::size_t i = 0; i < List.size(); ++i){
        if(i) std::cout << " ";
        std::cout << List[i];
    }
    std::cout << std::endl;
}
int selectionSort(vector<int>& A){
    int count = 0;
    for(int i = 0; i < A.size(); i++){
        int minj = i;
        for(int j = i; j < A.size(); j++){
            if(A[j] < A[minj]){
                minj = j;
            }
        }
        count += i != minj;
        swap(A[i], A[minj]);
    }
    return count;
}
int main()
{
    int n;
    cin >> n;
    vector<int> A(n);
    for(int i = 0; i < n; i++){
        cin >> A[i];
    }
    int Count = selectionSort(A);
    Output(A);
    std::cout << Count << std::endl;
    return 0;
}

Measured memory_bytes: 3112
#include<bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (n); ++i)
using namespace std;
#define pri(str) cout << str << endl
using ll = long long;
using P = pair<int, int>;

const ll MX = 1e18;
const long double PI = acos(-1);

int main()
{
    int n, x, t; cin >> n >> x >> t;

    int ans = (n/x) * t;
    if( n % x != 0)
        ans += t;
    pri(ans);
    return 0;
}


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

void solve(long long A, long long B, long long Q, vector<long long> s, vector<long long> t, vector<long long> x){
	sort(s.begin(),s.end());
	sort(t.begin(),t.end());
	for (int i=0; i<Q; i++) {
		long long s1, s2, t1, t2, res;
		s1 = *lower_bound(s.begin(), s.end(), x[i]);
		if (lower_bound(s.begin(), s.end(), x[i]) != s.begin()) s2 = *(lower_bound(s.begin(), s.end(), x[i])-1); else s2 = s1;
		res = abs(s1-x[i])+ abs(*lower_bound(t.begin(), t.end(), s1)-s1);
		if (lower_bound(t.begin(), t.end(), s1) != t.begin()) res = min(res,abs(s1-x[i])+ abs(*(lower_bound(t.begin(), t.end(), s1)-1)-s1));
		res = min(res,abs(s2-x[i])+ abs(*lower_bound(t.begin(), t.end(), s2)-s2));
		if (lower_bound(t.begin(), t.end(), s2) != t.begin()) res = min(res,abs(s2-x[i])+ abs(*(lower_bound(t.begin(), t.end(), s2)-1)-s2));
		t1 = *lower_bound(t.begin(), t.end(), x[i]);
		if (lower_bound(t.begin(), t.end(), x[i]) != t.begin()) t2 = *(lower_bound(t.begin(), t.end(), x[i])-1); else t2 = t1; 
		res = min(res,abs(t1-x[i])+ abs(*lower_bound(s.begin(), s.end(), t1)-t1));
		if (lower_bound(s.begin(), s.end(), t1) != s.begin()) res = min(res,abs(t1-x[i])+ abs(*(lower_bound(s.begin(), s.end(), t1)-1)-t1));
		res = min(res,abs(t2-x[i])+ abs(*lower_bound(s.begin(), s.end(), t2)-t2));
		if (lower_bound(s.begin(), s.end(), t2) != s.begin()) res = min(res,abs(t2-x[i])+ abs(*(lower_bound(s.begin(), s.end(), t2)-1)-t2));
		// printf("%lld,%lld,%lld,%lld\n", s1,s2,t1,t2);
		printf("%lld\n", res);
	}

}

int main(){
	long long A;
	long long B;
	long long Q;
	scanf("%lld",&A);
	vector<long long> s(A-1+1);
	scanf("%lld",&B);
	vector<long long> t(B-1+1);
	scanf("%lld",&Q);
	vector<long long> x(Q-1+1);
	for(int i = 0 ; i <= A-1 ; i++){
		scanf("%lld",&s[i]);
	}
	for(int i = 0 ; i <= B-1 ; i++){
		scanf("%lld",&t[i]);
	}
	for(int i = 0 ; i <= Q-1 ; i++){
		scanf("%lld",&x[i]);
	}
	solve(A, B, Q, s, t, x);
	return 0;
}


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

int main() {
  int n;
  long long int r=0,g=0,b=0;
  cin>>n;
  string s;
  cin>>s;
  vector<int> rgb(4001,0);
  rep(i,0,n){
  	string tmp;
    tmp=s.substr(i,1);
    if(tmp=="R"){rgb[i]=1;r++;}
    if(tmp=="G"){rgb[i]=2;g++;}
    if(tmp=="B"){rgb[i]=3;b++;}
  }
  
  long long int ans=r*g*b;
  
  rep(i,0,n){
    rep(j,0,n){
      int k=(2*j)-i;
      if(k>=n||k<0){continue;}
      if(i>j||j>k){continue;}
      if(i==j||i==k||j==k){continue;}
      //cout<<i<<j<<k<<endl;
      if(rgb[i]==rgb[j]||rgb[i]==rgb[k]||rgb[k]==rgb[j]){continue;}
      if(j-i==k-j){ans--;}
    }
  }

  cout<<ans<<endl;
  
  return 0;
}


Measured memory_bytes: 3656
import std.stdio, std.conv;
import std.array, std.algorithm, std.range;

void main()
{
    foreach(s;stdin.byLine())
    {
        auto c = new int[](13);
        foreach(n;s.split(",").map!(x=>x.to!int()-1))
            ++c[n];
        auto a = c.filter!"a!=0"().array().sort!"a>b"();
        string r = "null";
        if(a[0]==4) r = "four card";
        else if(a[0]==3 && a[1]==2) r = "full house";
        else if(a[0]==3) r = "three card";
        else if(a[0]==2 && a[1]==2) r = "two pair";
        else if(a[0]==2) r = "one pair";
        else if(find(c,repeat(0,8)).length==12 || !find(c,repeat(1,5)).empty) r = "straight";
        else r = "null";
        writeln(r);
    }
}

Measured memory_bytes: 1116
#include <iostream>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <algorithm>
#include <functional>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <bitset>
#include <cassert>
#include <exception>
#include <numeric>
using namespace std;
typedef long long ll;
typedef string str;
typedef pair<ll, ll> P;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<char> vc;
typedef vector<str> vs;
typedef vector<P> vp;
typedef vector<bool> vb;
#define rep(i, a, n) for (ll i = (a); i < (n); ++i)
#define rrep(i, a, n) for (ll i = (a); i > (n); --i)
#define erep(i, a, n) for (ll i = (a); i <= (n); ++i)
#define rerep(i, a, n) for (ll i = (a); i >= (n); --i)
#define all(c) (c).begin(), (c).end()
#define pb push_back
#define mp make_pair
#define sz(x) ((int)x.size())
#define print(X) cout << (X) << "\n"
#define _ << " " <<
static const int INF = 1e+9+7;


int main(){
  int A, B;
  cin >> A >> B;
  if(A == 2 || B == 2) print("No");
  else print("Yes");

  return 0;
}




Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll MOD = 1e9 + 7;
//const ll MOD = 998244353;
//const ll MOD = ;
ll mod(ll A, ll M) {return (A % M + M) % M;}
const ll INF = 1LL << 60;
template<class T> bool chmin(T& a, T b) {if (a > b) {a = b; return true;} return false;}
template<class T> bool chmax(T& a, T b) {if (a < b) {a = b; return true;} return false;}
ll divceil(ll A, ll B) {return (A + (B - 1)) / B;}
ll myctoi(char C) {return C - '0';}
char myitoc(ll N) {return '0' + N;}
#define FINALANS(A) do {cout << (A) << '\n'; exit(0);} while (false)

int main()
{
  ll N, M;
  cin >> N >> M;
  vector<ll> K(M);
  vector<vector<ll>> S(M);
  for (ll i = 0; i < M; i++)
  {
    cin >> K.at(i);
    S.at(i).resize(K.at(i));
    for (ll j = 0; j < K.at(i); j++)
    {
      cin >> S.at(i).at(j);
      S.at(i).at(j)--;
    }
  }
  vector<ll> P(M);
  for (ll i = 0; i < M; i++)
  {
    cin >> P.at(i);
  }

  ll ans = 0;
  for (ll b = 0; b < (1LL << N); b++)
  {
    bitset<10> B = b;

    bool ok = true;
    for (ll i = 0; i < M; i++)
    {
      ll tmp = 0;
      for (ll j = 0; j < K.at(i); j++)
      {
        if (B.test(S.at(i).at(j)))
          tmp++;
      }
      if (tmp % 2 != P.at(i))
      {
        ok = false;
        break;
      }
    }
    if (ok)
      ans++;
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#include <cstdio>
#include <vector>
#include <string>
#include <iostream>
#include <algorithm>
#include <map>
#include <iterator>
#include <functional>
#include <set>
#include <stack>
#include <queue>
#include <deque>
#include <fstream>
#include <iomanip>
#include <unordered_map>
#include <unordered_set>
#include <numeric>
#include <cmath>
#include <list>
#include <sstream>

#define rep(i,m,n) for(ll i = (m); i < (n); i++)
#define rep0(i, n) for(ll i = (0); i < (n); i++)
#define repd(i,m,n) for(ll i=(m); i > (n); i--)
#define iter(el, arr) for(auto& el : arr)
#define FOR(i,a,b) for(ll i = (a); i < (b); ++i)
#define RFOR(i,b,a) for(ll i = (b) - 1; i >= (a); --i)
#define REPEAT(i) FOR(counter1234,0,i)
#define ALL(a) a.begin(), a.end()

#define ld long double
#define ll long long
#define ull unsigned ll
#define pii pair<ll,ll>
#define pll pair<ll,ll>
#define plli pair<pll,ll>
#define MP make_pair
#define SZ(a) ll((a).size())
#define X first
#define Y second

#define endl '\n'
#define PB push_back
#define has(i, m) (m.find(i) != m.end())

#define vi vector<int>
#define vll vector<ll>
#define vch vector<char>
#define vvi vector<vi>
#define vvll vector<vll>
#define vpii vector<pii>
#define vpll vector<pll>
#define vb vector<bool>
#define vvb vector<vb>
#define pdd pair<ld, ld>
#define vpll vector<pll>
#define vpdd vector<pdd>
#define pq priority_queue
#define mod 1000000007
using namespace std;

const ll INF = 1e18;
const ll MAXN = 100001;

int n, m;
vvi a;

vb is;
vi wanted;

bool check(int ans)
{	
	map<int, int> t;
	FOR(i, 0, n)
		if (wanted[i] != -1)
			t[wanted[i]]++;

	int ma = 0;
	for (auto i : t)
		ma = max(ma, i.second);

	if (ma <= ans)
		return true;

	for (auto i : t)
		if (i.second > ans)
			is[i.first] = false;

	int cc = 0;
	FOR(i, 0, m)
		if (is[i])
			cc++;

	if (cc == 0)
		return 0;

	bool ch;
	FOR(i, 0, n)
	{
		ch = false;
		if (wanted[i] != -1)
		{
			FOR(j, 0, m)
				if (is[a[i][j]])
				{
					wanted[i] = a[i][j];
					ch = true;
					break;
				}
			if (!ch)
				wanted[i] = -1;
		}
	}
	return check(ans);
}

int solve(int l, int r)
{
	is.assign(m, true);
	wanted.assign(n, 0);
	FOR(i, 0, n)
		wanted[i] = a[i][0];
	
	if (r - l <= 1)
		if (check(l))
			return l;
		else
			return r;
	int mi = (l + r) / 2;
	if (check(mi))
		return solve(l, mi);
	else
		return solve(mi, r);
}

int main()
{
	ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);
	//freopen("In.txt", "r", stdin);

	cin >> n >> m;
	vi vvv(m);
	a.assign(n, vvv);
	FOR(i, 0, n)
		FOR(j, 0, m)
		cin >> a[i][j], a[i][j]--;

	cout << solve(1, n);
	return 0;
}
//don't forget about MAXN, INF and mod

Measured memory_bytes: 768
def is_palindrome(s):
    slen = len(s)
    for i in range(int(slen / 2)):
        if s[i] != s[slen - 1 - i]:
            return False

    return True


s = input().rstrip()
slen = len(s)
result = is_palindrome(s)
if result:
    bottom = int((slen - 1) / 2)
    s1 = s[:bottom]
    result = is_palindrome(s1)

if result:
    top = int((slen + 3) / 2)
    s1 = s[top - 1:]
    result = is_palindrome(s1)

print('Yes' if result else 'No')



Measured memory_bytes: 3064
#include<cstdio>
#include<algorithm>
#define MN 110001
#define ll long long
using namespace std;

ll read_p,read_ca;
inline ll read(){
	read_p=0;read_ca=getchar();
	while (read_ca<'0'||read_ca>'9') read_ca=getchar();
	while (read_ca>='0'&&read_ca<='9') read_p=read_p*10+read_ca-48,read_ca=getchar();
	return read_p;
}
int n,a[MN];
char s[MN];
inline bool work(){
	register int i,j;
	for (i=2;i<n;i++) a[i]=((s[i-1]=='o')^a[i-1])^a[i-2];
	return (a[n-1]^a[1]==((s[0]=='o')^a[0]))&&(a[n-2]^a[0]==((s[n-1]=='o')^a[n-1]));
}
int main(){
	register int i;
	n=read();
	scanf("%s",s);
	for (a[0]=0;a[0]<2;a[0]++)
	for (a[1]=0;a[1]<2;a[1]++)
	if (work()) {for (i=0;i<n;i++) putchar(a[i]?'S':'W');return 0;}
	puts("-1");
}

Measured memory_bytes: 768
#include<cstdio>
#include<string>
#include<cstring>
#include<iostream>
#include<algorithm>
#include<queue>
#include<map>
#include<cmath>
#define LL long long 
using namespace std;
inline LL read() {
    LL d=0,f=1;char s=getchar();
    while(s<'0'||s>'9'){if(s=='-')f=-1;s=getchar();}
    while(s>='0'&&s<='9'){d=d*10+s-'0';s=getchar();}
    return d*f;
}
int main()
{
	int n=read();
	for(int i=1;i<=n;i++) printf("ACL");
	return 0;
}

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

using namespace std;

bool searchFromHead(string, string, const int);
bool searchFromTail(string, string, const int);

bool searchFromHead(string input, string sample, const int cnt)
{
    int sampleLen = sample.length();
    for (int i = 0; i < sampleLen; i++)
    {
        if (input[i] != sample[i])
        {
            if (cnt > 0)
                return searchFromTail(input, sample.substr(i, sampleLen - i), cnt - 1);
            else
                return false;
        }
    }
    return true;
}

bool searchFromTail(string input, string sample, const int cnt)
{
    int sampleLen = sample.length(), inputLen = input.length();
    for (int i = 0; i < sampleLen; i++)
    {
        if (input[inputLen - 1 - i] != sample[sampleLen - 1 - i])
        {
            if (cnt > 0)
                return searchFromHead(input, sample.substr(0, i + 1), cnt - 1);
            else
                return false;
        }
    }
    return true;
}

bool judge(string input)
{
    return input[0] == 'k' ? searchFromHead(input, "keyence", 1) : (input[input.length() - 1] == 'e' ? searchFromTail(input, "keyence", 1) : false);
}

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

    printf("%s\n", judge(input) ? "YES" : "NO");

    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<stdio.h>
#include<vector>
#include<algorithm>
#include<set>
#include<string>
#include<map>
#include<string.h>
#include<complex>
#include<math.h>
#include<queue>
#include <functional>
#include<time.h>
#include <stack>
#include<iomanip>
using namespace std;
#define rep(i,a,n) for(int i=(a);i<(n);i++)
#define ll long long
#define llint long long int
#define reverse(v)  reverse(v.begin(), v.end());
#define Yes(ans) if(ans)cout<<"Yes"<<endl; else cout<<"No"<<endl;
#define YES(ans) if(ans)cout<<"YES"<<endl; else cout<<"NO"<<endl;
#define hei(a) vector<a>
#define whei(a) vector<vector<a>>
#define UF  UnionFind 
#define Pint pair<int,int>
#define keta(a)  fixed << setprecision(a)
constexpr auto INF = 1000000000000000000;
constexpr auto mod = 1000000007;
//辞書順はnext_permutation( begin( v ), end( v ) );やで！
struct edge { int to, cost; };

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

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

// mod. m での a の逆元 a^{-1} を計算するよ！
long long modinv(long long a, long long m) {
	long long b = m, u = 1, v = 0;
	while (b) {
		long long t = a / b;
		a -= t * b; swap(a, b);
		u -= t * v; swap(u, v);
	}
	u %= m;
	if (u < 0) u += m;
	return u;
}


//aCbをmod.mで割った余りを求める
ll int c(ll int a, ll int b, ll int m) {
	ll int ans = 1;
	for (ll int i = 0; i < b; i++) {
		ans *= a - i;
		ans %= m;
	}
	for (ll int i = 1; i <= b; i++) {
		ans *= modinv(i, m);
		ans %= m;
	}
	return ans;
}
struct UnionFind {
	vector<int> par; // par[i]:iの親の番号　(例) par[3] = 2 : 3の親が2

	UnionFind(int N) : par(N) { //最初は全てが根であるとして初期化
		for (int i = 0; i < N; i++) par[i] = i;
	}
	int size(int a) {
		return par[root(a)];
	}

	int root(int x) { // データxが属する木の根を再帰で得る：root(x) = {xの木の根}
		if (par[x] == x) return x;
		return par[x] = root(par[x]);
	}

	void unite(int x, int y) { // xとyの木を併合
		int rx = root(x); //xの根をrx
		int ry = root(y); //yの根をry
		if (rx == ry) return; //xとyの根が同じ(=同じ木にある)時はそのまま
		par[rx] = ry; //xとyの根が同じでない(=同じ木にない)時：xの根rxをyの根ryにつける
	}

	bool same(int x, int y) { // 2つのデータx, yが属する木が同じならtrueを返す
		int rx = root(x);
		int ry = root(y);
		return rx == ry;
	}
};

int main() {
	char a;
	cin >> a;
	if (a >= 97)cout << "a" << endl;
	else cout << "A" << endl;
	return 0;
}

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

#define INF 1000000007
#define mem(dp,a) memset(dp,a,sizeof dp)
#define flash ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define rep(i,a,b) for(ll i=a;i<b;i++)
#define repb(i,a,b) for(ll i=a;i>=b;i--)
#define f(i,n) for (ll i=0;i<n;i++)
#define sieve(j,mp) for(ll j=2*i ; j<=mp ; j+=i)
#define pb(x) push_back(x)
#define mp(x,y) push_back(make_pair(x,y))
#define tr(c,it) for(((c).begin())it=(c).begin();it!=(c).end();it++)
#define test ll t=1;  while(t--)
#define F first
#define S second
main()
{
    flash
    clock_t launch=clock();
    test
    {
        ll n,k;
        cin>>n>>k;
        ll dp[n+1][k+1],psum[n+1][k+1],cd[n+1];
        mem(dp,0);mem(psum,0);
        f(i,k+1)psum[0][i]=1;
        rep(i,1,n+1) cin>>cd[i];
        rep(i,1,n+1)f(j,k+1)
        {
            if(j-cd[i]<=0) dp[i][j]=psum[i-1][j];
            else dp[i][j]=(INF+(psum[i-1][j]-psum[i-1][j-cd[i]-1]))%INF;
            if(j) psum[i][j]=(psum[i][j-1]+dp[i][j])%INF;
            else psum[i][j]=1;
        }
        cout<<dp[n][k]<<endl;
    }
    clog<<((long double)(clock()-launch)/CLOCKS_PER_SEC)<<"\n";
    return 0;
}


Measured memory_bytes: 158080
import math
def isprime(x):
    if x == 2:
        return True

    if x < 2 or x%2 == 0:
        return False

    for i in range(3, int(math.sqrt(x))+1, 2):
        if x % i == 0:
            return False

    return True


if __name__ == "__main__":
    n = int(input())
    ans = 0
    for i in range(n):
        if isprime(int(input())):
            ans += 1

    print(ans)


Measured memory_bytes: 5672
S_dash = list(input())
M = len(S_dash)

T = list(input())
N = len(T)

match = [False for _ in range(M)]

last_match = -100
for i in range(M - N + 1):
    for j in range(N):
        if S_dash[i+j] == "?":
            continue
        elif S_dash[i+j] == T[j]:
            continue
        elif S_dash[i+j] != T[j]:
            break
    else:
        match[i] = True
        last_match = i
S = S_dash

if last_match == -100:
    print("UNRESTORABLE")
else:
    for i in range(N):
        S[last_match+i] = T[i]
    for i in range(M):
        if S[i] == "?":
            S[i] = "a"
    print("".join(str(x) for x in (S)))

Measured memory_bytes: 38384
#[allow(unused_imports)]
use std::cmp;

// Input macro from https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8
macro_rules! input {
  (source = $s:expr, $($r:tt)*) => {
    let mut iter = $s.split_whitespace();
    input_inner!{iter, $($r)*}
  };
  ($($r:tt)*) => {
    #[allow(unused_mut)]
    let mut s = {
      use std::io::Read;
      let mut s = String::new();
      std::io::stdin().read_to_string(&mut s).unwrap();
      s
    };
    let mut iter = s.split_whitespace();
    input_inner!{iter, $($r)*}
  };
}

macro_rules! input_inner {
  ($iter:expr) => {};
  ($iter:expr, ) => {};

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

macro_rules! read_value {
  ($iter:expr, ( $($t:tt),* )) => {
    ( $(read_value!($iter, $t)),* )
  };

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

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

  ($iter:expr, usize1) => {
    read_value!($iter, usize) - 1
  };

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

fn main() {
  input! {
    n: i32,
    l: i32,
  }
  let mut sum = 0;
  let mut min_abs: i32 = 1 << 30;
  for i in 0 .. n {
    sum += l + i;
    if (l + i).abs() < min_abs.abs() {
      min_abs = l + i;
    }
  }

  println!("{}", sum - min_abs);
}


Measured memory_bytes: 4352
#include <stdio.h>
int main(void)
{
	int a,b,c,k=1,i,z=0;
	scanf("%d%d",&a,&b);
	for(i=b; i>0; i=i/10){
		k=k*10;
	}
	c=a*k+b;
	for(i=1; i<=c; i++){
		if(i*i==c){
			z=1;
		}
	}
	if(z==1){
		printf("Yes\n");
	}else if(z==0){
		printf("No\n");
	}
	return 0;
}

Measured memory_bytes: 128
import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, acos, atan, asin, log, log10, gcd
from itertools import permutations, combinations, product, accumulate, combinations_with_replacement
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
#from fractions import gcd
def debug(*args):
    if debugmode:
        print(*args)
def input(): return sys.stdin.readline().strip()
def STR(): return input()
def INT(): return int(input())
def FLOAT(): return float(input())
def MAP(): return map(int, input().split())
def S_MAP(): return map(str, input().split())
def LIST(): return list(map(int, input().split()))
def S_LIST(): return list(map(str, input().split()))
def lcm(a, b): return a * b // gcd(a, b)
sys.setrecursionlimit(10 ** 9)
inf = sys.maxsize
mod = 10 ** 9 + 7
dx = [0, 1, 0, -1, 1, -1, -1, 1]
dy = [1, 0, -1, 0, 1, -1, 1, -1]
debugmode = True

a, b = MAP()
print(a * b)

Measured memory_bytes: 68344
N, K = map(int, input().split())
A = [-1] + list(map(int, input().split()))

visited = set([1])
loop = [1]
now = 1

for _ in range(N):
    now = A[now]
    if now in visited:
        break
    else:
        loop.append(now)
        visited.add(now)

x = loop.index(now)

if K < x:
    print(loop[K])
else:
    K -= x
    loop = loop[x:]
    K %= len(loop)
    print(loop[K])


Measured memory_bytes: 32264
n = int(input())
A = [[int(i) for i in input().split()] for j in range(n)]

C = []
D = []
i = 0

for a, b in A:
    C.append((a + b, i))
    i += 1

C.sort(reverse=True)
ans = 0

for i, c in enumerate(C):
    if i % 2 == 0:
        ans += A[c[1]][0]
    else:
        ans -= A[c[1]][1]

print(ans)

Measured memory_bytes: 36864
import sys
from math import gcd

read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
MOD = 1000000007


def main():
    A, B, C, D = map(int, readline().split())

    G = C // gcd(C, D) * D
    c1, c2 = (A + C - 1) // C, B // C
    d1, d2 = (A + D - 1) // D, B // D
    g1, g2 = (A + G - 1) // G, B // G

    ans = (B - A + 1) - ((c2 - c1 + 1) + (d2 - d1 + 1) - (g2 - g1 + 1))
    print(ans)
    return


if __name__ == '__main__':
    main()


Measured memory_bytes: 9160
#include <iostream>
#include <vector>
#include <cmath>
#include <algorithm>

using namespace std;

#define INF 10000000

int main() {
	int n, m, c, s, g;
	while (cin >> n >> m >> c >> s >> g) {
		if (n == 0 && m == 0 && c == 0 && s == 0 && g == 0) {
			break;
		}
		vector< vector< vector<long long int> > > dist(c, vector< vector<long long int> >(n, vector<long long int>(n, INF)));

		for (int i = 0; i < c; i++) {
			for (int j = 0; j < n; j++) {
				dist[i][j][j] = 0;
			}
		}

		int x, y, cc;
		long long int d;
		for (int i = 0; i < m; i++) {
			cin >> x >> y >> d >> cc;
			dist[cc - 1][x - 1][y - 1] = min(dist[cc - 1][x - 1][y - 1], d);
			dist[cc - 1][y - 1][x - 1] = min(dist[cc - 1][y - 1][x - 1], d);
		}
		
		for (int i = 0; i < c; i++) {
			for (int l = 0; l < n; l++) {
				for (int j = 0; j < n; j++) {
					for (int k = 0; k < n; k++) {
						dist[i][j][k] = min(dist[i][j][k], dist[i][j][l] + dist[i][l][k]);
					}
				}
			}
		}

		vector<int> p(c);
		for (int i = 0; i < c; i++) {
			cin >> p[i];
		}
		vector< vector<long long int> > q(c);
		vector< vector<long long int> > r(c);
		long long int qq, rr;
		for (int i = 0; i < c; i++) {
			q[i].push_back(0);
			for (int j = 0; j < p[i] - 1; j++) {
				cin >> qq;
				q[i].push_back(qq);
			}
			q[i].push_back(INF);
			for (int j = 0; j < p[i]; j++) {
				cin >> rr;
				r[i].push_back(rr);
			}
		}
		vector< vector< vector<long long int> > > cost(c, vector< vector<long long int> >(n, vector<long long int>(n, INF)));
		for (int i = 0; i < c; i++) {
			for (int j = 0; j < n; j++) {
				for (int k = 0; k < n; k++) {
					if (dist[i][j][k] != INF) {
						long long int ccc = 0;
						for (int l = 1; l <= p[i]; l++) {
							if (dist[i][j][k] > q[i][l]) {
								ccc += (q[i][l] - q[i][l - 1])*r[i][l - 1];
							}
							else {
								ccc += (dist[i][j][k] - q[i][l - 1])*r[i][l - 1];
								break;
							}
						}
						cost[i][j][k] = ccc;
					}
				}
			}
		}
		vector< vector<long long int> > ans(n, vector<long long int>(n, INF));
		for (int i = 0; i < n; i++) {
			for (int j = 0; j < n; j++) {
				for (int k = 0; k < c; k++) {
					ans[i][j] = min(ans[i][j], cost[k][i][j]);
				}
			}
		}
		for (int k = 0; k < n; k++) {
			for (int i = 0; i < n; i++) {
				for (int j = 0; j < n; j++) {
					ans[i][j] = min(ans[i][j], ans[i][k] + ans[k][j]);
				}
			}
		}
		if (ans[s - 1][g - 1] == INF) {
			cout << -1 << endl;
		}
		else {
			cout << ans[s - 1][g - 1] << endl;
		}
	}
	return 0;
}

Measured memory_bytes: 6292
/*||>>>> Praveen Ojha <<<<>>>> 10 August 2019 <<<<>>>> 17:27:09 <<<<||*/
// #pragma GCC optimize("Ofast")
// #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
// #pragma GCC optimize("unroll-loops")
// #pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("O3")
#pragma GCC target ("sse4")
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define F first
#define S second
#define mod 1000000007
#define inf (int)1e18+5
#define sz(x) (int)x.size()
#define PI 3.141592653589793238510
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define __ ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define vi vector<int>
#define vpii vector<pair<int,int> > 
#define vvi vector<vector<int> >
#define PRINT_TIME cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s." <<endl;
#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename   enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
  ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
  *this << "[";
  for (auto it = d.b; it != d.e; ++it)
    *this << ", " + 2 * (it == d.b) << *it;
  ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "
typedef long double ld;
typedef pair<int,int> pii;
//Read Problems Carefully & Check for corner cases N=0,1 ?
///////////////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////
const int N=1000000;
int32_t main(){__
    int k,x;
    cin>>k>>x;
    for(int i=x-k+1;i<=x;i++){
        if(i>=-N && i<=N)
            cout<<i<<" ";
    }
    for(int i=x+1;i<x+k;i++){
        if(i>=-N && i<=N)
            cout<<i<<" ";
    }
    cout<<"\n";
return 0;
}

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

using namespace std;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n, k;
    cin >> n >> k;
    if (2*k > n+1) {
        cout << -1 << endl;
        return 0;
    }
    int d = (n+1)/2 - k;
    for (int i = 0; i < (n+1)/2; ++i) {
        cout << (k+2*i) << " " << (2*n-i - d) << " " << (k + 2*n + i) << "\n";
    }
    for (int i = 0; i < (n-1)/2; ++i) {
        cout << (k + 2*i + 1) << " " << (2*n + (n-1)/2 - i - d) << " " << (k + 2*n + (n+1)/2 + i) << "\n";
    }
    if (n % 2 == 0) {
        cout << (k+n-1) << " " << (k+n) << " " << (k+3*n-1) << endl;
    }
    return 0;
}


Measured memory_bytes: 2304
#include <bits/stdc++.h>
using namespace std;
const int INF=0x3f3f3f3f;
#define mem(a,n) memset(a,n,sizeof(a))
typedef long long ll;
const int N=50+5;
int a[N],ansx[2*N],ansy[2*N];
int main()
{
    int n,v=1,mv=0,tmp,x;
    while(~scanf("%d",&n))
    {
        for(int i=1;i<=n;i++)
        {
            scanf("%d",&tmp);
            if(abs(tmp)>mv) mv=abs(tmp),v=i,x=tmp<0 ? 1 : 0;
        }
        printf("%d\n",2*n-2);
        for(int i=1;i<=n;i++)
            if(i!=v) printf("%d %d\n",v,i);
        if(x)
            for(int i=n;i>1;i--)
            printf("%d %d\n",i,i-1);
        else
            for(int i=2;i<=n;i++)
            printf("%d %d\n",i-1,i);
    }
    return 0;
}


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

int main(){

    int h1, m1, h2, m2, k;
    cin >> h1 >> m1 >> h2 >> m2 >> k;

    if(m1>m2){
        m1+=60;
        h1--;
    }
    if(h1>h2) h1+=24;

    int time;
    time = (h2-h1)*60 + m2-m1;
    cout << time - k << endl;

}

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

int main() {
  int N,A;

  // 変数aで入力を受け取る
  cin >> N >> A;
  if (N % 500 <=A){
  cout << "Yes" << endl;
  }
  else{
    cout << "No" << endl;
  }
}

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

using namespace std;

int main()
{
	string input;
	vector<int> output(0);
	cin >> input;


	for (int i = 0; i < input.size(); i++) {
		switch (input.at(i)) {
		case '0':	output.push_back(0);	break;
		case '1':	output.push_back(1);	break;
		case 'B':	if (output.empty());
            		else output.pop_back();	break;
		}
	}
	for (int i : output)
		cout << i;
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
int main(){
  int b,i;vector <int> v;
  for(i=0;i<5;i++) {
    cin >> b;
    v.push_back(b);
  }
  sort(v.rbegin(),v.rend());
  cout << v[0];
  for(i=1;i<5;i++) cout << " " << v[i];
  cout << endl;
}


Measured memory_bytes: 3168
//#include "bits/stdc++.h"
#include <iostream>
#include <vector>
#include <map>
#include <utility>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <stack>
#include <queue>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <numeric>
#include <complex>
#include <bitset>
#include <functional>
#include <stack>
#include <regex>
#include <tuple>
#include <iomanip>


#define int long long
#define REP(i,l,r) REPEAT(i,l,r,true) // [l, r)
#define rep(i,n) REP(i,0,n)           // [0, n)
#define REPEAT(i,l,r,condition) for(int i=(condition)?l:r-1;(condition)?i<r:i>=l;(condition)?++i:--i) // false<-[l, r)->true
#define all(e) e.begin(),e.end()
#define rall(e) e.rbegin(),e.rend()
#define pb push_back
#define fs first
#define sc second
#ifdef LOCAL
#define show(...) cerr<<#__VA_ARGS__<<" = ";_DEBUG(__VA_ARGS__)
#define showlr(n,l,r) cerr<<#n<<" = ";for(int i=l;i<r;i++){cerr<<n[i]<<", ";}cerr<<endl // [l, r)
#else
#define show(...)
#define showlr(n,l,r)
#endif

#define YN(condition) puts((condition)?"YES":"NO")
#define Yn(condition) puts((condition)?"Yes":"No")
#define yn(condition) puts((condition)?"yes":"no")
#define YES puts("YES")
#define Yes puts("Yes")
#define yes puts("yes")
#define NO  puts("NO")
#define No  puts("No")
#define no  puts("no")

#define case(i) printf("Case #%lld: ",i)

using namespace std;

using vi=vector<int>;
using pint=pair<int,int>;

struct io{io(){cin.tie(0);ios::sync_with_stdio(false);cout.tie(0);cout<<fixed<<setprecision(20);}}io;

template<class T> istream& operator >>(istream &is, vector<T> &v){for(T &e:v)is>>e;return is;}
template<class T> ostream& operator <<(ostream &os, vector<T> v){os<<"{";for(T &e:v)os<<e<<(v.size()-(int)(&e-&v[0])>1?", ":"");os<<"}";return os;}

void _DEBUG(){}
template<typename H,typename... T> void _DEBUG(H a,T...b){cerr<<a<<(sizeof...(b)?",":"\n");_DEBUG(b...);}

inline void in(){}
template<typename H,typename... T>void in(H &a, T&... b){cin>>a;in(b...);}
inline void out(){}
template<typename H,typename... T> void out(H a, T... b){cout<<a<<(sizeof...(b)?" ":"\n");out(b...);}

template<class T> void resz(int n,T& v){v.resize(n);}
template<class H,class... T> void resz(int n,H& a,T&... b){a.resize(n);resz(n,b...);}

template<typename V,typename H> void resize(vector<V>& v,const H a){v.resize(a);}
template<typename V,typename H,typename... T> void resize(vector<V>& v,const H& a,const T... b){v.resize(a);for(auto &v:v) resize(v,b...);}

const int INF=1LL<<55;
const int MOD=1000000007;
const double EPS=1e-8;
/*------------end of definitions------------*/

int A,B,C;

signed main(){

    in(A,B,C);

    YN((100*A+10*B+C)%4==0);

    return 0;
}


Measured memory_bytes: 380