akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
using ll = long long;
using P = pair<ll, ll>;
const long double PI = acos(-1.0L);
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; }

// auto mod int
const int mod = 1000000007;
// const int mod = 998244353;
struct mint {
    ll x; // typedef long long ll;
    mint(ll x=0):x((x%mod+mod)%mod){}
    mint operator-() const { return mint(-x);}
    mint& operator+=(const mint a) {
      if ((x += a.x) >= mod) x -= mod;
      return *this;
    }
    mint& operator-=(const mint a) {
      if ((x += mod-a.x) >= mod) x -= mod;
      return *this;
    }
    mint& operator*=(const mint a) { (x *= a.x) %= mod; return *this;}
    mint operator+(const mint a) const { return mint(*this) += a;}
    mint operator-(const mint a) const { return mint(*this) -= a;}
    mint operator*(const mint a) const { return mint(*this) *= a;}
    mint pow(ll t) const {
      if (!t) return 1;
      mint a = pow(t>>1);
      a *= a;
      if (t&1) a *= *this;
      return a;
    }

    // for prime mod
    mint inv() const { return pow(mod-2);}
    mint& operator/=(const mint a) { return *this *= a.inv();}
    mint operator/(const mint a) const { return mint(*this) /= a;}
};
istream& operator>>(istream& is, mint& a) { return is >> a.x;}
ostream& operator<<(ostream& os, const mint& a) { return os << a.x;}

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

    vector<mint> sum(n+1, 0);
    for(int i = 0; i < n; ++i) {
        sum[i+1] += (sum[i]+(mint)avec[i]);
    }

    mint ans = 0;
    for(int i = 0; i < n; ++i) {
        mint ch = avec[i];
        mint dd = sum[n]-sum[i+1];
        ans += (ch*dd);
    }
    cout << ans << endl;
}

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

using namespace std;

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
  	string s = "";
  	for (int i = 0; i < 3; i++) {
    	char a;
      	cin >> a;
      	s += a;
    }
  	int foo = stoi(s);
  	cout << (foo % 4 == 0 ? "YES" : "NO") << '\n';
    return 0;
}


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

public class Main {
    public static void main(String[] args) {
        BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
        String input;
        try {
            input = reader.readLine();
            int n = Integer.parseInt(input);
            int money = 100000;
            for(int i=0; i<n; i++){
                money = (int)Math.ceil((money * 1.05)/1000)*1000;
            }
            System.out.println(money);
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}

Measured memory_bytes: 16864
#include <iostream>
#include <string>

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

    if (n % 2 == 0)
    {
        std::string t = s.substr(0, n / 2);
        if (t + t == s)
        {
            std::cout << "Yes" << std::endl;
            return 0;
        }
    }
    std::cout << "No" << std::endl;
    return 0;
}

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


typedef long long ll;
typedef pair<ll, ll> P;

struct edge {int to, cost; };

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

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

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

int par[1000001];
int rank_[1000001];

void init(int n){
  for(int i=0; i<n; i++){
    par[i] = i;
    rank_[i] = 0;
  }
}

int find(int x){
  if(x==par[x]){
    return x;
  }else{
    return par[x] = find(par[x]);
  }
}

void unite(int x, int y){
  x = find(x);
  y = find(y);
  if(x==y) return;
  if(rank_[x]<rank_[y]){
    par[x]=y;
  }else{
    par[y]=x;
    if(rank_[x]==rank_[y]) rank_[x]++;
  }
}

int main(){
  int n, m;
  cin >> n >> m;
  init(n);
  for(int i=0; i<m; i++){
    int x, y;
    cin >> x  >> y;
    unite(x, y);
  }
  int ans = 0;
  for(int i=0; i<n; i++){
    if(i==find(i)) ans++;
  }
  cout << ans-1 << endl;
  return 0;
}


Measured memory_bytes: 4360
#define _USE_MATH_DEFINES
#include <iostream>
#include <string>
#include <utility>
#include <stack>
#include <vector>
#include <queue>
#include <algorithm>
#include <map>
#include <climits>
#include <set>
#include <cmath>
#include <numeric>
#include <iomanip>

using namespace std;

vector <pair<pair <int, int>, int > >edges;
void add_base_graph(int msb){
    for(int i = 0; i < msb; i++){
        edges.push_back(make_pair(make_pair(i + 1, i + 2), 0));
        edges.push_back(make_pair(make_pair(i + 1, i + 2), (1 << i)));
    }    
}

int main(){
    int L;
    cin >> L;
    
    int msb = 0;
    for(int i = 20; i >= 0; i--){
        if(((L >> i) & 1) == 1){
            msb = i;
            break;
        }
    }
    
    add_base_graph(msb);
    
    int tmp = (1 << msb);
    for(int i = msb - 1; i >= 0; i--){
        if(((L >> i) & 1) == 1){
            edges.push_back(make_pair(make_pair(i + 1, msb + 1), tmp));
            tmp += (1 << i);
        }
    }
    
    cout << msb + 1 << " " << edges.size() << endl;
    for(int i = 0; i < edges.size(); i++){
        cout << edges[i].first.first << " " << edges[i].first.second << " " << edges[i].second << endl;
    }
    //cout << msb << endl;
    return 0;
}


Measured memory_bytes: 256
# -*- coding: utf-8 -*-
"""
B - Good Distance
https://atcoder.jp/contests/abc133/tasks/abc133_b

"""
import sys
from itertools import combinations


def solve(points):
    ans = 0
    for p1, p2 in combinations(points, 2):
        d = sum([(a-b)**2 for a, b in zip(p1, p2)])
        ans += (d**0.5).is_integer()
    return ans


def main(args):
    n, d = map(int, input().split())
    points = [[int(x) for x in input().split()]  for _ in range(n)]
    ans = solve(points)
    print(ans)


if __name__ == '__main__':
    main(sys.argv[1:])


Measured memory_bytes: 3188
#include <stdio.h>

int min(int a,int b){return a > b ? b : a;}

void warshall_floyd(int n,int d[10][10]) {
    for (int k = 0; k < n; k++){       // 経由する頂点
        for (int i = 0; i < n; i++) {    // 始点
            for (int j = 0; j < n; j++) {  // 終点
                d[i][j] = min(d[i][j], d[i][k] + d[k][j]);
            }
        }
    }
}

int main()
{
    int h,w,c[10][10],a;

    int i,j,k;

    scanf("%d %d",&h,&w);
    for (i = 0; i < 10; i++){for (j = 0; j < 10; j++){scanf("%d",&c[i][j]);}}
    warshall_floyd(10,c);
    //printf("\n");for (i = 0; i < 10; i++){for (j = 0; j < 10; j++){printf("%d ",c[i][j]);}printf("\n");}

    long long ans = 0;
    for (i = 0; i < h; i++)
    {
        for (j = 0; j < w; j++)
        {
            scanf("%d",&a);
            if(a == -1)continue;
            ans += c[a][1];
        }
    }
    
    printf("%lld",ans);
}


Measured memory_bytes: 128
#include <algorithm>
#include <cmath>
#include <iostream>
#include <iomanip>
#include <map>
#include <numeric>
#include <set>
#include <string>
#include <vector>

using namespace std;
using LLONG = long long;

int main()
{
    LLONG a, b, x;
    cin >> a >> b >> x;
    if (a != 0)
    {
        cout << b / x - (a - 1) / x << endl;
    }
    else
    {
        cout << b / x + 1 << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(void)
{
	int a=0,b=0,c=0;
	int at[6]={0,0,0,0,0,0};
	int bt[6]={0,0,0,0,0,0};
	int ct[6]={0,0,0,0,0,0};
	int ast[3]={0,0,0};
	int bst[3]={0,0,0};
	int cst[3]={0,0,0};
	
	scanf("%d %d %d %d %d %d",&at[0],&at[1],&at[2],&at[3],&at[4],&at[5]);
	scanf("%d %d %d %d %d %d",&bt[0],&bt[1],&bt[2],&bt[3],&bt[4],&bt[5]);
	scanf("%d %d %d %d %d %d",&ct[0],&ct[1],&ct[2],&ct[3],&ct[4],&ct[5]);
	
	a=(at[3]*3600+at[4]*60+at[5])-(at[0]*3600+at[1]*60+at[2]);
	b=(bt[3]*3600+bt[4]*60+bt[5])-(bt[0]*3600+bt[1]*60+bt[2]);
	c=(ct[3]*3600+ct[4]*60+ct[5])-(ct[0]*3600+ct[1]*60+ct[2]);
	
	ast[0]=a/3600;
	ast[1]=(a%3600)/60;
	ast[2]=a-(3600*ast[0]+60*ast[1]);
	
	bst[0]=b/3600;
	bst[1]=(b%3600)/60;
	bst[2]=b-(3600*bst[0]+60*bst[1]);
	
	cst[0]=c/3600;
	cst[1]=(c%3600)/60;
	cst[2]=c-(3600*cst[0]+60*cst[1]);
	
	printf("%d %d %d\n",ast[0],ast[1],ast[2]);
	printf("%d %d %d\n",bst[0],bst[1],bst[2]);
	printf("%d %d %d\n",cst[0],cst[1],cst[2]);
	
	return 0;
}

Measured memory_bytes: 600
import java.awt.print.Printable;
import java.util.Scanner;
import java.util.HashSet;
import java.util.Set;

import javax.sound.midi.SysexMessage;
import java.util.Arrays;
  
public class Main{      
    public static void main(String[] args){

        Scanner sc = new Scanner(System.in);

        int count = sc.nextInt();
        //String dict[]=new String[1000000];
        Set<String> set = new HashSet<String>();
        for(int i=0;i<count;i++){
            String str = sc.next();
            if(str.equals("insert"))
                set.add(sc.next());
            else{
                if(set.contains(sc.next()))
                    System.out.println("yes");
                else
                    System.out.println("no");
            }
            
        }
        sc.close();
        
    }   
}


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

using namespace std;
using ll = long long;

//container util
#define SORT(c) sort((c).begin(),(c).end())

//repetition
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)


int main(void){


	int N; cin >> N;
	vector<int> A(N);
	vector<int> s(N);
	REP(i,N){
		cin >> A[i];
		s[i] = A[i];
	}

	SORT(s);

	REP(i,N){
		int idx = N - 1;
		if(s.back() == A[i]) idx--;

		cout << s[idx] << endl;

	}




	return 0;

}


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

/**
 *
 * @author yoshkur
 */
public class Main {

	public static void main(String[] args) {
		try {
			BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
			InputData inputData = new InputData(br);
			Processing processing = new Processing(inputData);
			System.out.println(processing.getResult());

		} catch (IOException | NumberFormatException e) {
			System.err.println(e.getLocalizedMessage());
		}
	}
}

class InputData {

	private Integer a;
	private Integer b;
	private Integer c;

	public InputData(BufferedReader br) throws IOException {
		String line = br.readLine().trim();
		String[] values = line.split(" ");
		this.a = Integer.valueOf(values[0]);
		this.b = Integer.valueOf(values[1]);
		this.c = Integer.valueOf(values[2]);
	}

	public Integer getA() {
		return a;
	}

	public void setA(Integer a) {
		this.a = a;
	}

	public Integer getB() {
		return b;
	}

	public void setB(Integer b) {
		this.b = b;
	}

	public Integer getC() {
		return c;
	}

	public void setC(Integer c) {
		this.c = c;
	}
}

class Processing {

	private InputData inputData;

	public Processing(InputData inputData) {
		this.inputData = inputData;
	}

	public String getResult() {
		String result = null;
		if (this.inputData.getA() < this.inputData.getB()
				&& this.inputData.getB() < this.inputData.getC()) {
			result = "Yes";
		} else {
			result = "No";
		}
		return result;
	}
}

Measured memory_bytes: 23996
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int th,ts,ah,as;
	cin>>th>>ts>>ah>>as;
	int flag=true;
	while(th>0&&ah>0)
	{
		ah=ah-ts;
		if(ah<1)
		{
			flag=false;//t wins
			break;
		}
		th=th-as;
		if(th<1)
		{
			flag=true;
			break;
		}
	}
	if(flag)
	{
		cout<<"No";
	}
	else
	{
		cout<<"Yes";
	}
	
}


Measured memory_bytes: 3624
def main():

    N, Y = map(int, input().split())
    count = 0
    for z in range(N + 1):
        for y in range(N - z + 1):
            X = Y - 1000 * z - 5000 * y
            if X % 10000 == 0:
                x = X // 10000
                if x + y + z == N:
                    count += 1
                    if count == 1:
                        print(x, y, z)
    if count == 0:
        print("-1 -1 -1")


if __name__ == "__main__":
    main()

Measured memory_bytes: 3064
#include<stdio.h>

int main()
{
	char *str;
	char m[10];
	scanf("%s", &m);
	str = m;
	if (*(str + 2) == *(str + 3) && *(str + 4) == *(str + 5))
		printf("Yes");
	else
		printf("No");
	return 0;
}

Measured memory_bytes: 128
#include <iostream>

int main() {
  int a[3];
  int c5(0), c7(0);
  std::cin >> a[0] >> a[1] >> a[2];
  for (int i=0; i<3; i++)
  {
    if (a[i] == 5) c5++;
    else if(a[i] == 7) c7++;
  }
  if (c5 == 2 || c7 == 1) std::cout << "YES" << std::endl;
  else std::cout << "NO" << std::endl;
  return 0;
}

Measured memory_bytes: 3576
N = int(input())
A = []
B = []
for i in range(N):
	A.append(int(input()))
	
max_1 = max(A)
B = A[:]
B.remove(max_1)
max_2 = max(B)

for i in A:
	if i == max_1:
		print(max_2)
	else:
		print(max_1)


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

#define REP(i, l, n) for(int i=(l), i##_len=(n); i<i##_len; ++i)
#define ALL(x) (x).begin(),(x).end()
#define pb puah_back

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

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

vector<ll> divisor(ll n) {
    vector<ll> ret;
    for (ll i = 1; i * i <= n; i++) {
        if (n % i == 0) {
            ret.push_back(i);
            if (i * i != n) ret.push_back(n / i);
        }
    }
    sort(ret.begin(), ret.end()); // 昇順に並べる
    return ret;
}

int check(ll n, ll k){
    while(n >= k){
        if(n % k == 0){
            n = n / k;
        }else{
            n = n % k;
        }
    }
    if(n == 1){
        return 1;
    }else{
        return 0;
    }
}

int main(){
    ll n; cin >> n;
    ll ans = 0;
    vector<ll> lis1 = divisor(n);
    REP(i, 1, lis1.size()){
        if(check(n, lis1[i])){
            ans++;
        }
    }
    vector<ll> lis2 = divisor(n-1);
    REP(i, 1, lis2.size()){
        if(check(n, lis2[i])){
            ans++;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 384
#include <stdio.h>

int main(void)
{
	int money[7][7] = {{0,300,500,600,700,1350,1650},
					   {300,0,350,450,600,1150,1500},
					   {500,350,0,250,400,1000,1350},
					   {600,450,250,0,250,850,1300},
					   {700,600,400,250,0,600,1150},
					   {1350,1150,1000,800,600,0,500},
					   {1650,1500,1350,1300,1150,500,0}};
	int distance[7][7] = {{0,6,13,18,23,43,58},
						  {6,0,7,12,17,37,52},
						  {13,7,0,5,10,30,45},
						  {18,12,5,0,5,25,40},
						  {23,17,10,5,0,20,35},
						  {43,37,30,25,20,0,15},
						  {58,52,45,40,35,15,0}};
	int sic , sh, sm;
	int eic , eh, em;
	int flag;
	
	while (1){
		scanf("%d", &sic);
		
		if (sic == 0){
			break;
		}
		
		scanf("%d%d", &sh, &sm);
		
		scanf("%d", &eic);
		
		scanf("%d%d", &eh, &em);
		
		flag = 0;
		
		if (distance[sic - 1][eic - 1] <= 40){
			if(1730 <= sh * 100 + sm || eh * 100 + em <= 1930 ){
				printf("%d\n",(money[sic - 1][eic - 1] / 2) + (money[sic - 1][eic - 1] % 100 == 50 ? 25:0));
				flag = 1;
			}
		}
		
		if (flag != 1){
			printf("%d\n", money[sic - 1][eic - 1]);
		}
	}
	
	return (0);
}

Measured memory_bytes: 0
import atexit,io,sys,os,math
from collections import OrderedDict
buffer=io.BytesIO()
sys.stdout=buffer
@atexit.register
def write():
    sys.__stdout__.write(buffer.getvalue())


s=raw_input().strip()
n=len(s)
m=s.count('+')
print(2*m-n)

Measured memory_bytes: 2932
#include <iostream>#include <iostream>
#include <string>
#include <unordered_map>
using namespace std;
unordered_map<string,int> mp;
int cnt;
int main()
{
    int n;
    cin>>n;
    string str;
    for(int i=1;i<=n;i++){
        cin>>str;
        if(!mp.count(str))mp[str]=++cnt;
    }
    cout<<cnt<<endl;
}

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

#define int long long

#define rep(i,n) for(int i=0;i<(n);i++)
#define reps(i,a,b) for(int i=(a);i<(b);i++)
#define pb push_back
#define eb emplace_back
#define all(v) (v).begin(),(v).end()
#define fi first
#define se second

using vint=vector<int>;
using pint=pair<int,int>;
using vpint=vector<pint>;

template<typename A,typename B>inline void chmin(A &a,B b){if(a>b)a=b;}
template<typename A,typename B>inline void chmax(A &a,B b){if(a<b)a=b;}

template<class A,class B>
ostream& operator<<(ostream& ost,const pair<A,B>&p){
    ost<<"{"<<p.first<<","<<p.second<<"}";
    return ost;
}

template<class T>
ostream& operator<<(ostream& ost,const vector<T>&v){
    ost<<"{";
    for(int i=0;i<v.size();i++){
        if(i)ost<<",";
        ost<<v[i];
    }
    ost<<"}";
    return ost;
}

int N,K;
int score[3];
int A[111111];

int calc(vint v){
    int cur=0;
    int ret=0;
    while(cur<v.size()){
        int nex=cur;
        while(nex<v.size()&&v[cur]==v[nex])nex++;
        ret+=score[v[cur]]*((nex-cur+1)/2);
        cur=nex;
    }
    return ret;
}

signed main(){
    cin>>N>>K;
    rep(i,3)cin>>score[i];
    string str;
    cin>>str;
    rep(i,str.size()){
        if(str[i]=='r'){
            A[i]=2;
        }
        else if(str[i]=='s'){
            A[i]=0;
        }
        else{
            A[i]=1;
        }
    }

    int ans=0;
    for(int i=0;i<K;i++){
        vint v;
        for(int j=i;j<N;j+=K)v.pb(A[j]);
        ans+=calc(v);
    }
    cout<<ans<<endl;
    return 0;
}

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

int main() {
	int a, b,c;
	cin >> a >> b;
	if (a == 1) {
		if (b == 2)c = 3;
		if (b == 3)c = 2;
	}
	if (a == 2) {
		if (b ==1)c = 3;
		if (b == 3)c = 1;
	}
	if (a == 3) {
		if (b == 2)c = 1;
		if (b == 1)c = 2;
	}
	cout << c << endl;
	return 0;
}


Measured memory_bytes: 256
X,Y = map(int,input().split())
tsuru = 0
kame = X
ashi = 0
flag = False
for i in range(X+1):
    ashi = tsuru * 2 + kame * 4
    if(Y == ashi):
        flag = True
        break
    tsuru+=1
    kame-=1

if(flag):
    print("Yes")
else:
    print("No")

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

using namespace std;

int m, d;

int tich(int x)
{
    return (x/10)*(x%10);
}

int main()
{
    ios_base:: sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    cin >> m >> d;
    int res = 0;
    for (int i = 1; i <= m; i++)
    {
        for (int j = 10; j <= d; j++)
        {
            if(j / 10 >= 2 && j % 10 >= 2&& tich(j) == i)
            {
                res++;
            }
        }
    }
    cout << res;
    return 0;
}


Measured memory_bytes: 256
# -*- coding: utf-8 -*-
# AtCoder Beginner Contest


if __name__ == '__main__':
    n = int(input())
    a = list(map(int, input().split()))
    count = 0

    # See:
    # https://beta.atcoder.jp/contests/abc100/submissions/2675457
    for ai in a:
        while ai % 2 == 0:
            ai //= 2
            count += 1

    print(count)


Measured memory_bytes: 4148
n,t = map(int,input().split())
l = list(map(int,input().split()))
ans = []

check = l[0]
dis = 0
for i in l:
    if i < check:
        check = i
        dis = 0
    
    else:
        dis = i-check
        ans.append(dis)
print(ans.count(max(ans)))

        

Measured memory_bytes: 14252
#include <bits/stdc++.h>
#define rep(i, n) for (int i=0; i<n; ++i)
#define rep1(i, n) for (int i=1; i<=n; ++i)
#define ALL(v) v.begin(), v.end()
#define RALL(v) v.rbegin(), v.rend()
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
constexpr ll  MOD = (1e9+7);
constexpr int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
constexpr int lcm(int a, int b) { return a / gcd(a, b) * b; }

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 factorial(ll n, ll m=2) {
    // calculate n!
    m = max(2LL, m);
    ll rtn = 1;
    for (ll i=m; i<=n; i++) {
        rtn = (rtn * i) % MOD;
    }
    return rtn;
}
ll modinv(ll a, ll m) {
    ll b = m, u = 1, v = 0;
    while (b) {
        ll t = a / b;
        a -= t * b;
        swap(a, b);
        u -= t * v;
        swap(u, v);
    }
    u %= m;
    if (u < 0) u += m;
    return u;
}
ll modpow(ll a, ll n) {
    ll res = 1;
    while (n > 0) {
        if (n & 1)
            res = res * a % MOD;
        a = a * a % MOD;
        n >>= 1;
    }
    return res;
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(0);
    int a, b, c; cin >> a >> b >> c;
    if (b-a == c-b) puts("YES");
    else puts("NO");
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i = 0; i < n; i++)
#define COUT(x) cout<<(x)<<endl
#define dump(x)  cout << #x << " = " << (x) << endl;
using ll = long long;
using P = pair<int,int>;
using Graph = vector<vector<int>>;
using M = map<int,int>;
using PQ = priority_queue<int>;
using PQG = priority_queue<int, vector<int>, greater<int>>;
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;

int main() {
  int n;  cin >> n;
  if (n==1) { COUT(1); return 0; }
  ll ans,l1=2,l2=1;
  for (int i = 2; i <= n; i++) {
    ans = l1+l2;
    l1=l2; l2=ans;
  }
  COUT(ans);
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef long double ld;
typedef vector<ll> vl;
typedef vector<string> vs;
typedef vector<char> vc;
typedef queue<ll> ql;
typedef deque<ll> dql;
typedef priority_queue<ll/*, vl, greater<ll>*/> pql; //降順(/*昇順*/)
typedef set<ll> sl;
typedef pair<ll, ll> pl;
typedef vector<vl> vvl;
typedef vector<pl> vpl;
#define rep(i, n) for(ll i = 0; i < ll(n); i++)
#define rep2(i, n) for(ll i = 1; i <= ll(n); i++)
//#define rep(i, k, n) for(ll i = k-1; i < ll(n); i++)
//#define rep2(i, k, n) for(ll i = k; i <= ll(n); i++)
#define all(v) (v).begin(), (v).end()
bool chmin(ll &a, ll b) {if(b < a) {a = b; return 1;} return 0;}
bool chmax(ll &a, ll b) {if(b > a) {a = b; return 1;} return 0;}
const ll INF = 1LL << 60;
const ll MOD = 1e9 + 7;
//const ll MOD = 998244353;
const ll MAX = 1e9;
const char newl = '\n';

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

  ll n;
  cin >> n;
  
  vvl cnt(n, vl(26));
  string s;
  
  rep(i, n) {
    cin >> s;
    rep(j, s.size()) cnt[i][s[j]-'a']++;
  }
  
  vl ans(26, INF);
  rep(i, n) rep(j, 26) {
    chmin(ans[j], cnt[i][j]);
  }
  
  rep(i, 26) rep(_, ans[i]) cout << (char)('a'+i);
  cout << newl;
  return 0;
}

Measured memory_bytes: 3676
#include<cstdio>
#include<cmath>
#include<algorithm>
#include<cstdlib>
#include<cstring>
using namespace std;
inline int read()
{
	int x=0,f=1;char ch=getchar();
	while(ch<'0' || ch>'9'){if(ch=='-')f=-1;ch=getchar();}
	while(ch>='0' && ch<='9')x=x*10+ch-'0',ch=getchar();
	return x*f;
}
int stack[20];
inline void write(int x)
{
	if(x<0){putchar('-');x=-x;}
	if(!x){putchar('0');return;}
	int top=0;
	while(x)stack[++top]=x%10,x/=10;
	while(top)putchar(stack[top--]+'0');
}
inline void pr1(int x){write(x),putchar(' ');}
inline void pr2(int x){write(x),puts("");}
int main()
{
    //freopen("a.in","r",stdin);
    //freopen("a.out","w",stdout);
   	int n=read();bool pd=false;
   	while(n)
   	{
   		if(n%10==7)pd=true;
   		n/=10;
   	}
   	if(pd==true)puts("Yes");
   	else puts("No");
    return 0;
}

Measured memory_bytes: 1476
#include <iostream>
#include <stdio.h>
#include <algorithm>
#include <vector>
#include <utility>
#include <cstdio>
#include <iomanip>
#include <cmath>
#include <string>
#include <string.h>
#include <stack>
#include <queue>
#include <map>
#include <stdlib.h>
#include <set>
typedef long long ll;
using namespace std;

int main() {
	int n, s1 = 0, s2 = 0, mi = 200, w = 0;
	cin >> n;
	vector<int> v(n);
	for (int i = 0; i < n; i++)
		cin >> v.at(i);
	for (int i = 0; i < n - 1; i++) {
		w++;
		for (int j = 0; j < w; j++) {
			s1 += v.at(j);
		}
		for (int k = w ; k < n; k++) {
			s2 += v.at(k);
		}
		mi = min(mi, abs(s1 - s2));
		s1 = 0;
		s2 = 0;
	}

	cout << mi << endl;
	return 0;
}



Measured memory_bytes: 256
n = gets.chomp.to_i
obj = {}

n.times do
  str = gets.chomp.chars.sort.join
  if obj[str]
    obj[str] += 1
  else
    obj[str] = 1
  end
end

count = 0;
obj.each do |key, value|
  next if value == 1
  (value - 1).times { |i| count += i + 1 }
end

puts count


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

//--------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define RFOR(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define LL long long
#define INF INT_MAX/2

//--------------------------------------------
const double EPS = 1e-14;
const double PI  = acos(-1.0);

//--------------------------------------------

int main() {
  int x;
  int n = 0;

  scanf("%d",&x);

  int i = 1;
  while (n < x) {
    n += i;
    i++;
  }

  printf("%d\n",i - 1);
}


Measured memory_bytes: 256
#pragma GCC optimize ("O3")
#include <iostream>
#include <iomanip>
#include <istream>
#include <ostream>
#include <sstream>
#include <iterator>
#include <vector>
#include <algorithm>
#include <queue>
#include <deque>
#include <list>
#include <stack>
#include <map>
#include <unordered_map>
#include <set>
#include <utility>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <string>
#include <ctime>
#include <cctype>
#include <cstdlib>
#define IINF 10e8
#define INF 1<<30
#define MOD 1000000007
#define mod 10007
#define REP(i, a, n) for (ll i = a; i < (ll)(n); i++)
#define REPE(i, a, n) for (ll i = a; i <= (ll)(n); i++)
#define Endl endl
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define mmax(x,y)(x>y?x:y)
#define mmin(x,y)(x<y?x:y)
#define chmax(x,y) x=mmax(x,y)
#define chmin(x,y) x=mmin(x,y)
#define all(x) (x).begin(),(x).end()
#define siz(x) (ll)(x).size()
#define PI acos(-1.0)
using namespace std;
typedef long long int ll;
typedef long double ld;
typedef pair<int,int>Pin;
typedef pair<ll,ll>Pll;
template<class T> using V=vector<T>;
long long GCD(long long a, long long b) {return b?GCD(b,a%b):a;}
long long LCM(long long a, long long b) {return a/GCD(a,b)*b;}
int dx[4]={-1,0,1,0};
int dy[4]={0,-1,0,1};
int ddx[8]={-1,0,1,0,1,1,-1,-1};
int ddy[8]={0,-1,0,1,1,-1,1,-1};
ll cmp(pair<ll,ll>a,pair<ll,ll> b){
        if(a.se!=b.se)
        return a.se<b.se;
        else
        return a.fi<b.fi;
}
//----------------------------------------------------------------------
int dp[1<<21];
int cnt[21][100010];
int ccnt[21];
//----------------------------------------------------------------------
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    //-------------------------------
    ll a,b,c,k;cin>>a>>b>>c>>k;
    if(a==b){
        cout<<0<<endl;
        return 0;
    }
    ll ans=0;
    if(k%2==0){
        ans=a-b;
    }
    else ans=b-a;
    if(ans>1e18){
        cout<<"Unfair"<<endl;
    }
    else cout<<ans<<endl;
    //-------------------------------
    return 0;
}
//----------------------------------------------------------------------


































Measured memory_bytes: 256
#include<bits/stdc++.h>
#define range(i,a,b) for(int i = (a); i < (b); i++)
#define rep(i,b) range(i,0,b)
#define vi vector<int>
#define pb(a) push_back(a)
#define all(a) (a).begin(), (a),end()
#define debug(x) cout << "debug " << x << endl;
#define NUM 405
using namespace std;

int tile[NUM][NUM];

void solve(int *x, int *y){
    rep(i,NUM){
        rep(j,NUM){
            if(tile[i][j] > - 1){
                tile[i][0] = tile[0][j] = 1;
            }
        }
    }
    rep(i,NUM) if(tile[i][0] > -1) *y = *y + 1;
    rep(i,NUM) if(tile[0][i] > -1) *x = *x + 1;
}

void input(int n, int d, int* tileNum){
    rep(i,NUM){
        rep(j,NUM){
            if(tile[i][j] == n){
                if(d == 0) tile[i][j - 1]  = *tileNum;
                else if(d == 1) tile[i + 1][j] = *tileNum;
                else if(d == 2) tile[i][j + 1] = *tileNum;
                else tile[i - 1][j] = *tileNum;
                break; 
            }
        }
    }
    *tileNum = *tileNum + 1;
}

int main(){
    int n;
    while(cin >> n, n){
        int tileNum = 1;
        rep(i,NUM) rep(j,NUM) tile[i][j] = -1;
        tile[200][200] = 0;
        n--;
        while(n--){
            int num, d;
            cin >> num  >> d;
            input(num, d, &tileNum);
        }
        int wedth, height;
        wedth = height = 0;
        solve(&wedth, &height);
        cout << wedth << ' ' << height << endl;
    }
}

Measured memory_bytes: 1800
#include <cassert>
#include <cstdio>
#include <cmath>
#include <iostream>
#include <iomanip>
#include <sstream>
#include <vector>
#include <map>
#include <queue>
#include <numeric>
#include <algorithm>

using namespace std;
using lint = long long;
constexpr int MOD = 1000000007, INF = 1111111111;
constexpr lint LINF = 1LL << 60;

template <class T>
ostream &operator<<(ostream &os, const vector<T> &vec) {
	for (const auto &e : vec) os << e << (&e == &vec.back() ? "" : " ");
	return os;
}

#ifdef _DEBUG
template <class T>
void dump(const char* str, T &&h) { cerr << str << " = " << h << "\n"; };
template <class Head, class... Tail>
void dump(const char* str, Head &&h, Tail &&... t) {
	while (*str != ',') cerr << *str++; cerr << " = " << h << "\n";
	dump(str + (*(str + 1) == ' ' ? 2 : 1), t...);
}
#define DMP(...) dump(#__VA_ARGS__, __VA_ARGS__)
#else 
#define DMP(...) ((void)0)
#endif

lint pow(lint n, lint a = 10) {
	lint res = 1;
	while (n > 0) {
		if (n & 1) res = res * a;
		a = a * a;
		n >>= 1;
	}
	return res;
}

int main() {

	cin.tie(nullptr);
	ios::sync_with_stdio(false);

	lint s;
	cin >> s;

	lint ans = 0, sz = to_string(s).size() - 1;
	for (int bit = 0b0; bit < (1 << sz); bit++) {

		lint tmp = s, div = 10;
		for (int i = 0; i < sz; i++) {
			if (bit & (1 << i)) {
				ans += tmp % div;
				tmp /= div;
				div = 1;
			}
			div *= 10;
		}
		ans += tmp;
	}

	cout << ans << "\n";

	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main()
{
    int n;
    scanf("%d" , &n);
 
    int arr[n] , lgcd[n+1] , rgcd[n+1] , maxm=0;
 
    for(int i=0; i<n; i++){
      scanf("%d" , &arr[i]);
    }
    lgcd[0]=arr[0];
    rgcd[n-1]=arr[n-1];
    for(int i=1; i<(n); i++){
        lgcd[i]=__gcd(lgcd[i-1] , arr[i]);
       // rgcd[n-1-i]= __gcd(rgcd[n-i] , arr[n-i-1]);
 
        //cout << lgcd[i]  << endl;
    }
 
   // cout << " bc  " << endl ;
 
    for(int i=n-2; i>=0 ; i--){
        rgcd[i]=__gcd(rgcd[i+1] , arr[i]);
       // rgcd[n-1-i]= __gcd(rgcd[n-i] , arr[n-i-1]);
 
      //  cout << rgcd[i]  << endl;
    }
 
    for(int i=1; i<(n-1); i++){
        maxm = max( __gcd(lgcd[i-1] , rgcd[i+1] ) , maxm);
        //cout << rgcd[i] << endl;
    }
 
    maxm = max( maxm , max(rgcd[1], lgcd[n-2]));
 
    cout << maxm << endl;
    return 0;
}

Measured memory_bytes: 1408
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> l_l;
typedef pair<int , int> i_i;
typedef vector<ll> vel;
typedef vector<int> vei;
typedef vector<char> vec;
typedef vector<bool> veb;
typedef vector<string> ves;
typedef vector<vector<ll>> ve_vel;
typedef vector<vector<int>> ve_vei;
typedef vector<vector<char>> ve_vec;
typedef vector<vector<bool>> ve_veb;
typedef vector<vector<string>> ve_ves;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<(int)(n);i++)
#define rep2(i,n) for(int i=2;i<(int)(n);i++)
#define repk(i,k,n) for(int i=k;i<(int)(n);i++)
#define fs first
#define sc second
#define pub push_back
#define puf push_front
#define pob pop_back
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define maxel(a) *max_element(all(a))
#define minel(a) *min_element(all(a))
#define acc accumulate
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
#define mod (1000000007)
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }

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

    string s; cin >> s;
    if(s.size() == 2) {
        cout << s << endl;
        return 0;
    }
    else {
        cout << s[2] << s[1] << s[0] << endl;
        return 0;
    }
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long
const int N=2e5+100;
using std::greater;
using std::sort;
using std::max;
int n;
ll k,maxx;
ll a[N],f[N];
inline bool check(ll mid,ll kk)
{
	for (int i=1;i<=n;i++)
	{
		ll now=mid/f[i];
		if (a[i]-now<=0) continue;
		kk=kk-(a[i]-now);
		if (kk<0) return 0;
	}
	if (kk>=0) return 1;
	return 0;
}
int main()
{
	scanf("%d%lld",&n,&k);
	for (int i=1;i<=n;i++)
	scanf("%lld",&a[i]);
	for (int i=1;i<=n;i++)
	scanf("%lld",&f[i]);
	sort(a+1,a+n+1,greater<int>());
	sort(f+1,f+n+1);
	ll l=0,r=1e17,ans;
	while (l<=r)
	{
		ll mid=(l+r)>>1;
		if (check(mid,k))
		{
			ans=mid;
			r=mid-1;
		}
		else l=mid+1;
	}
	printf("%lld\n",ans);
	return 0;
}

Measured memory_bytes: 3328
#include<stdio.h>
    #include<stdlib.h>
    #include<string.h>
    #include<math.h>
    #include<iostream>
    #include<algorithm>
    #include<stack>
    #include<queue>
    #include<vector>
    #include<set>
    #include<map>
    #include<string>
    using namespace std;
    typedef long long ll;
    typedef unsigned long long ull;
    const int INF=0x3f3f3f3f;

    ll a[1000010];
    int n;
    ll solve()
    {
        ull sum=0;
        ll oo=0,flag;
        if(a[0]>0)
            flag=-1;
        else if(a[0]<0)
            flag=1;
            for(int i=0;i<n;i++)
            {
                oo+=a[i];
                if(flag==1)
                {
                    if(oo>=0)
                    {
                        sum+=oo+1;
                        oo=-1;
                    }
                }
                if(flag==-1)
                {
                    if(oo<=0)
                    {
                        sum+=0-oo+1;
                        oo=1;
                    }
                }
                flag=-flag;
            }
            return sum;
    }

    int main()
    {
        while(scanf("%d",&n)!=EOF)
        {
            ll sum;
            for(int i=0;i<n;i++)
            {
                scanf("%lld",&a[i]);
            }
            int t=a[0];
            if(a[0]==0)
            {
                a[0]=1;
                ull sum1=solve();
                a[0]=-1;
                ull sum2=solve();
                sum=min(sum1,sum2)+1;
            }
            else
            {
                ll sum0=solve();
                a[0]=1;
                ll sum1=solve()+abs(t-1);
                a[0]=-1;
                ll sum2=solve()+abs(t+1);
                sum=min(sum0,min(sum1,sum2));
            }
            printf("%lld\n",sum);
        }
        return 0;
    }


Measured memory_bytes: 1024
import numpy as np
import copy

h, w = map(int,input().split())
lst = [input() for i in range(h)]

array = np.zeros((h,w))
for n, i in enumerate(lst):
    for m, j in enumerate(i):
        array[n][m] = 1if j == '#' else 0

while True:
    origin = copy.deepcopy(array)
    array = array[:, array.sum(axis=0) > 0]
    array = array[array.sum(axis=1)>0, :]
    if array.shape == origin.shape:
        break

for i in array:
    string = ''
    for j in i:
        string += '#' if j == 1 else '.'
    print(string)

Measured memory_bytes: 12632
#include<iostream>
#include<cmath>
#include<algorithm>
#include<string>
#include<vector>
#include<stack>
#include<queue>
#include<set>
#include<map>
#include<iomanip>
#include<bitset>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
typedef pair<ll,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(ll i=0;i<x;i++)
#define repn(i,x) for(ll 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())

const int MAX = 510000;
const int MOD = 1000000007;

ll dpans[510][510];
ll dptmp[510][510];

int main(){
  ll N, M, Q; cin >> N >> M >> Q;
  vector<P> a(M); rep(i,M) cin >> a[i].fi >> a[i].sc; rep(i,M){a[i].fi--; a[i].sc--;}
  vector<P> b(Q); rep(i,Q) cin >> b[i].fi >> b[i].sc; rep(i,Q){b[i].fi--; b[i].sc--;}

  SORT(a);
  // table作成してしまう O(N^2)
  rep(i,M) dptmp[a[i].fi][a[i].sc]++;

  for(ll i = N - 1; i >= 0; i--){
    // i is left side
    for(ll j = 0; j < N ; j++){
      // j is right side
      if(dptmp[i][j]){
        for(ll k = j; k < N; k++){
          dpans[i][k] += dptmp[i][j];
        }
      }
    }
  }
  // rep(i,N) rep(j,N) cout << i << " " << j << " " << dpans[i][j] << endl;
  // したから上に足していく
  rep(j,N){
    for(ll i = N - 1; i > 0; i--){
      dpans[i - 1][j] += dpans[i][j];
    }
  }

  // rep(i,N) rep(j,N) cout << i << " " << j << " " << dpans[i][j] << endl;

  rep(i,Q){
    cout << dpans[b[i].fi][b[i].sc] << endl;
  }
}


Measured memory_bytes: 9600
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
#define max0(a,b,c) max(max(a,b),c)
#define min0(a,b,c) min(min(a,b),c)
#define ft first
#define sc second
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define all(v) (v).begin(),(v).end()
#define mod 1000000007
using namespace std;
using Graph = vector<vector<int>>;
typedef long long lint;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ldouble;
typedef vector<int> vec;
typedef vector<ll> lvec;
typedef vector<ull> ulvec;
typedef vector<double> dvec;
typedef vector<pair<int,int>> pvec;
typedef vector<pair<ll,ll>> plvec;
typedef vector<tuple<ll,ll,ll>> tvec;
typedef vector<string> svec;

int main(){
    int n;
    cin>>n;
    lvec a(n);
    rep(i,n) cin>>a[i];
    sort(all(a));
    cout<<a[n-1]-a[0];
}

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

#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")

using namespace std;
// #define ll long long
#define pb push_back
#define mp make_pair
#define ll unsigned long long
#define rep(n) for(ll i = 0 ; i<n ; i++) 
#define rep2(n) for(ll j=0 ; j<n ; ++j )
#define repd(n) for(ll i = n-1 ; i>=0 ; i--)
#define MOD 1000000007
#define pii pair<ll,ll>
#define vll vector<ll>
#define ff first
#define ss second
typedef vector<vector<ll> > mat;
#define nl "\n"
#define INF 0x3f3f3f3f
#define sz(a) a.size() 

void solve() {
	ll x,y,a,b,c; cin >> x >> y >> a >> b >> c ;
	ll p[a],q[b],r[c];
	rep(a) cin>>p[i];
	rep(b) cin>>q[i];
	rep(c) cin>>r[i];
	sort(p,p+a,greater<ll>()); sort(q,q+b,greater<ll>()); sort(r,r+c,greater<ll>());
	vll final;
	rep(x) final.pb(p[i]);
	rep(y) final.pb(q[i]);
	rep(min(x+y,c)) final.pb(r[i]);
	sort(final.begin(),final.end(),greater<ll>());
	ll s = 0 ;
	rep(x+y) s+=final[i];
	cout << s ;
}


int main() {
	ios::sync_with_stdio(0);
	cin.tie(0); cout.tie(0);
	ll t=1;
	// cin>>t;
	rep(t) {
		solve() ; 
	}
	return 0;
}

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

#define pb push_back
#define mp make_pair
#define size(n) ( int( n.size() ) )
#define sqr(n) ( (n) * (n) )

using namespace std;

typedef long long ll;
typedef long double ld;



int ans = 110;

int check( string s ){
    for ( int i = 1; i < size(s); i++ ){
        if ( s[i] != s[i-1] ){
            return 0;
        }
    }
    return 1;
}

int main(){
   // freopen("input.txt","r",stdin);
    //freopen("output.txt","w",stdout);
    string s, ns, old_s;
    cin >> s;
    old_s = s;
    int cnt = 0;
    for ( int j = 1; j <= 26; j++ ){
        cnt = 0;
        while( !check(s) ){
            ns = "";
            for ( int i = size(s) - 2; i >= 0; i-- ){
                if ( ( s[i+1] - 'a' + 1 == j ) || ( s[i] - 'a' + 1 == j ) ){
                    ns = ns + char(int('a') + j - 1 );
                }
                else{
                    ns = ns + s[i];
                }

            }
            reverse( ns.begin(), ns.end() );
            s = ns;
            cnt++;
        }

        s = old_s;
        ans = min( ans, cnt );
    }
    cout << ans << endl;
    return 0;
}




Measured memory_bytes: 256
#include <bits/stdc++.h>
        using namespace std;
        #define int long long
const int MAX = 510000;
const int MOD = 1000000007;
//


        signed main() {
                cout << std::setprecision(12); 
              int x,y;
              cin>>x>>y;
              if(x==2||y==2){
                      cout<<"No"<<endl;
                      return 0;
              }
              bool t[13]={};t[4]=true;t[6]=true;
              t[9]=true;t[11]=true;
              if(t[x]^t[y])cout<<"No"<<endl;
              else cout<<"Yes"<<endl;

        
        
        


      }


        


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

using namespace std;

int main(){

	int n;
	char field[1001][1001];
	//int under[1001][1001];
	//int right[1001][1001];
	//int squareSize[1001][1001];

	vector<vector<int> > under;
	vector<vector<int> > right;
	vector<vector<int> > squareSize;

	vector<int> v(1001,-1);
	vector<int> vvv(1001,0);

	for(int i = 0; i < 1001; i++){
		under.push_back(v);
		right.push_back(v);
		squareSize.push_back(vvv);
	}

	while(cin>>n&&n!=0){
		int maxSize=0;
		for(int i = 0; i < n; i++){
			for(int j = 0; j < n; j++){
				cin>>field[i][j];
			}
		}

		for(int i = 0; i < 1001; i++){
			for(int j = 0; j < 1001; j++){
				under[i][j]=-1;
				right[i][j]=-1;
				squareSize[i][j]=0;
			}
			//fill(under[i],under[i]+1001,-1);
			//fill(right[i],right[i]+1001,-1);
			//fill(squareSize[i],squareSize[i]+1001,0);
		}

		for(int i = 0; i < n; i++){
			for(int j = 0; j < n; j++){
				// º
				if(field[i][j]=='*'){
					
				}
				else if(i-1<0||field[i-1][j]=='*'){
					int cnt=0;
					for(int k = i+1;k<n; k++){
						if(field[k][j]=='*')
							break;
						cnt++;
					}
					under[i][j]=cnt;
				}
				else if(i-1>=0&&field[i][j]=='.'){
					under[i][j]=under[i-1][j]-1;
				}
				// E
				if(field[i][j]=='*'){
					
				}
				else if(j-1<0||field[i][j-1]=='*'){
					int cnt=0;
					for(int k = j+1;k<n; k++){
						if(field[i][k]=='*')
							break;
						cnt++;
					}
					right[i][j]=cnt;
				}
				else if(j-1>=0&&field[i][j]=='.'){
					right[i][j]=right[i][j-1]-1;
				}
			}
		}
		// ì¬Å«ésquareÌTCYðmè
		for(int i = n-1; i >= 0; i--){
			for(int j = n-1; j >= 0; j--){
				if(field[i][j]=='.'){
					if(i+1<n&&j+1<n&&field[i+1][j+1]=='.'){
						// TuXNFAÌTCY
						int ss=squareSize[i+1][j+1];
						// TuXNFAÉdËé`ÅXNFAªìêéê
						if(under[i][j]>=ss&&right[i][j]>=ss){
							squareSize[i][j]=ss+1;
							maxSize=max(maxSize,squareSize[i][j]);
						}
						// ìêÈ¢êAunderÆrightÌTCY©çAìêéTCYðmè
						else{
							int m=min(under[i][j],right[i][j]);
							squareSize[i][j]=m+1;
							maxSize=max(maxSize,squareSize[i][j]);
						}
					}
					// EºªAX^Ü½ÍtB[hOÌê
					else{
						squareSize[i][j]=1;
						maxSize=max(maxSize,squareSize[i][j]);
					}
				}
				// ©gÌêªAX^Ìê
				else{
					squareSize[i][j]=0;
				}
			}
		}
		cout<<maxSize<<endl;
	}

	return 0;
}

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

#define all(v) v.begin(), v.end()
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define intll int long long

int main() {
  int a , b , c , d ;
  cin >> a >> b >> c >> d ;
  
  string ans = "No";
  if( max(a,c)-min(a,c) <=d ) 
    ans = "Yes";
  
  else if( (min(a,c) <= b) && (b <= max(a,c))){
    if((b- (min(a,c) <= d) && (max(a,c) - b <= d )))
       ans =  "Yes";
  }

  cout << ans;
       

}


Measured memory_bytes: 256
#include<stdio.h>

int main()
{
    int i,n,arr,s[14],h[14],c[14],d[14];
    char ch;
    scanf("%d",&n);
    for(i=0;i<=13;i++)
    {
        s[i]=0;
        h[i]=0;
        c[i]=0;
        d[i]=0;
    }
    for(i=0; i<n*2; i++)
    {
        scanf("%c%d",&ch,&arr);

        if(ch=='S')
            s[arr]=1;
        if(ch=='H')
            h[arr]=1;
        if(ch=='C')
            c[arr]=1;
        if(ch=='D')
            d[arr]=1;
    }

    for(i=1; i<=13; i++)
    {
        if(s[i]!=1)
            printf("S %d\n",i);
    }
     for(i=1; i<=13; i++)
    {
        if(h[i]!=1)
            printf("H %d\n",i);
    }
     for(i=1; i<=13; i++)
    {
        if(c[i]!=1)
            printf("C %d\n",i);
    }
     for(i=1; i<=13; i++)
    {
        if(d[i]!=1)
            printf("D %d\n",i);
    }

}



Measured memory_bytes: 2108
n,x,y = map(int,input().split())
ans = [0 for i in range(n)]
for i in range(1,n+1):
    for j in range(i+1,n+1):
        ans[min(j-i-1,abs(i-x)+abs(j-y))] += 1
for i in range(n-1):
    print(ans[i])

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


int main() {
    int n; cin >> n;
    int a[n];
    for (int i = 0; i < n; i++) cin >> a[i];
    int last = 0;
    for (int i = 0; i < n; i++) {
        if (a[i] == last+1) last++;
    }
    if (last == 0) cout << "-1\n";
    else cout << n-last << '\n';
}

Measured memory_bytes: 1024
import java.util.*;
public class Main{
	public static void main(String[] args){		
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();
		
		int[] c = new int[a];
		for(int i=0;i<a;i++){
			c[i] = sc.nextInt();
		}
		sc.close();
		
//		long result = 0;
//		for(int i=0;i<a;i=i+1){
//			long num = 0;
//			for(int j=i;j<a;j=j+1){
//				num += c[j];
//				if(num%b == 0){
//					result = result+1;
//				}
//			}
//		}
//		System.out.println(result);
		
		Map<Long, Long> cnt = new HashMap<Long, Long>();
		{
			long sum = 0;
			for (int i = 0; i < a; i++) {
				sum += c[i];
				sum %= b;
				if (!cnt.containsKey(sum)) {
					cnt.put(sum, 1L);
				} else {
					cnt.put(sum, cnt.get(sum) + 1);
				}
			}
		}
		
		{
			long ans= 0;
			long sum = 0;
			for (int i = 0; i < a; i++) {
				if (cnt.containsKey(sum)) {
					ans += cnt.get(sum);
				}
				sum += c[i];
				sum %=b;
				cnt.put(sum, cnt.get(sum) - 1);
			}
			System.out.println(ans);
		}
		
		
	}
}


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

int main() {
 int w,h,n; cin >> w >> h >> n;
 int wlef=0,hbot=0,wrig=w,htop=h;
  rep(i,n){
    int x,y,a; cin >> x >> y >> a;
    if(a==1 && wlef<=x)wlef=x;

    else if(a==2 && wrig>=x)wrig=x;

    else if(a==3 && hbot<=y)hbot=y;

    else if(a==4 && htop>=y)htop=y;
  }
 int ans=(max(0,wrig-wlef))*(max(0,htop-hbot));
  cout << ans << endl;
}


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

int a[123491];

int main(){

    int n, menor = 0, maior = 0;

    scanf("%d", &n );

    scanf("%d", &a[0]);
    maior = a[0];
    menor = a[0];

    for (int i = 1; i < n; i++) {
        scanf("%d", &a[i]);
        if (a[i] >= maior)
            maior = a[i];
        if (a[i] <= menor)
            menor = a[i];
    }
    
    int tt = maior - menor;

    printf("%d\n", tt );


return 0;
}


Measured memory_bytes: 128