akhauriyash/Code-Regression huggingface dataset:
n, m = map(int, input().split())
sc = {1:set(), 2:set(), 3:set()}
#print(sc)

for i in range(m):
  s, c = map(int, input().split())
  sc[s].add(c)

ans = 0
#print(sc)
#重複してるか
for v in sc.values():
  if len(v) > 1:
    ans = -1
if ans != -1:
  if n == 3:
    if sc[1] == {0}:
      ans = -1
    elif (sc[1] == {0}) and (sc[2] == {0}):
      ans = -1
    else:
      ans = ""
      if sc[1] != set():
          ans += str(sc[1].pop())
      else:
          ans += str("1")
      if sc[2] != set():
          ans += str(sc[2].pop())
      else:
          ans += str("0")
      if sc[3] != set():
        ans += str(sc[3].pop())
      else:
        ans += str("0")
  if n == 2:
    if sc[1] == {0}:
      ans = -1
    else:
      ans = ""
      if sc[1] != set():
          ans += str(sc[1].pop())
      else:
          ans += str("1")
      if sc[2] != set():
          ans += str(sc[2].pop())
      else:
          ans += str("0")
  if n == 1:
    if sc[1] == {0}:
      ans = 0
    else:
      ans = ""
      if sc[1] != set():
          ans += str(sc[1].pop())
      else:
          ans += str("0")
print(ans)


    

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

int main(){
   ll n, k;
    cin >> n >> k;
    vector<int> a(n);
    rep(i,n){
        int x;
        cin >> x; x--;
        a[i] = x;
    }
    
    vector<int> visited(n);
    vector<int> town;
    visited[0] = 1;
    town.push_back(0);
    ll next_town = a[0];
    ll cnt = 1;
    ll bias, roop;
    for(int i = 0; i < n; i++){
        cnt++;
        if(visited[next_town] == 0){
            visited[next_town] = cnt;
            town.push_back(next_town);
            next_town = a[next_town];
        }else{
            roop = cnt - visited[next_town];
            bias = visited[next_town];
            break; 
        }
    }
    // rep(i,n){
    //     cout << a[i] << " ";
    // }
    // cout << endl;
    // rep(i,town.size()){
    //     cout << town[i] << " " ;
    // }
    // cout << endl;
    // cout << bias << " " << roop << endl;
    // cout << k % roop << endl;
    if(k <= bias){
        cout << town[k] + 1 << endl;
        return 0;
    }else{
        k -= bias;
        ll p = k % roop;
        if(p == roop - 1){
            p = -1;
        }
        //cout << "p:" << p << endl;
        cout << town[bias  + p] + 1 << endl;
        return 0;
    }
    //最後に町の数を++ 
}

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

using System.Collections;

class Program
{
    static void Main()
    {
        char[] vals = 
            Console.ReadLine()
            .Split(' ')
            .Select(s => char.Parse(s))
            .OrderByDescending(c => c)
            .ToArray();

        Console.WriteLine(int.Parse(new string(vals, 0, 2)) + int.Parse(new string(vals, 2, 1)));
        
    }
    
    
}


Measured memory_bytes: 13396
S = input()
T = input()
ls = len(S)
lt = len(T)

ans = 10**9
for i in range(ls - lt + 1):
    tmp = 0
    for j in range(lt):
        if S[i + j] != T[j]:
            tmp += 1
    ans = min(ans, tmp)

print(ans)


Measured memory_bytes: 67544
#include <iostream>
#include <vector>
#include <string>

using namespace std;

void solve()
{
	int N;
	while(cin >> N, N)
	{
		string str;
		cin >> str;
		vector<int> a(N);
		vector<int> b(N);
		for(int i = 0; i < N; ++i)
		{
			cin >> a[i] >> b[i];
		}
		for(int i = N - 1; i >= 0; --i)
		{
			char temp = str[a[i] - 1];
			str[a[i] - 1] = str[b[i] - 1];
			str[b[i] - 1] = temp;
			int c = str[a[i] - 1] + (b[i] - a[i]) % 26;
			int d = str[b[i] - 1] + (b[i] - a[i]) % 26;
			if(c > 'z')
			{
				c -= 26;
			}
			if(d > 'z')
			{
				d -= 26;
			}
			str[a[i] - 1] = c;
			str[b[i] - 1] = d;
		}
		cout << str << endl;
	}
}

int main()
{
	solve();
	return(0);
}

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

using namespace std ;

int main()
{
	ios_base::sync_with_stdio(0) ;
	cin.tie(0) ;
	int n , x;
	cin>>n>>x ;
	long long arr[n] ;
	long long ans = 0ll ;
	for(int i = 0 ; i < n ; ++i)
		cin>>arr[i] ;
	for(int i = 0 ; i < n-1 ; ++i)
	{
		if(arr[i] + arr[i+1] > x)
		{
			ans += arr[i] + arr[i+1] - x ;
			arr[i+1] -= min(arr[i+1] , arr[i] + arr[i+1] - x) ;
		}
	}
	return cout<<ans<<"\n" , 0 ;
}

Measured memory_bytes: 1024
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cctype>
#include <cstring>
#include <iomanip>
#include <bitset>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <list>
#include <map>

using namespace std;

struct open {
  int a, b;
  open(int a, int b) : a(a), b(b) {}
};

bool cmp(struct open &a, struct open &b) {
  return (a.a < b.a);
}

int main() {
  int n, m;
  cin >> n >> m;
  vector <open> vec;
  for (int i = 0; i < n; i++) {
    int x, y;
    cin >> x >> y;
    vec.push_back(open(x, y));
  }
  sort(vec.begin(), vec.end(), cmp);
  long long ans = 0;
  for (int i = 0; i < vec.size(); i++) {
    int take = min(m, vec[i].b);
    ans += 1ll * take * vec[i].a;
    m -= take;
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 1400
#include <iostream>
#include <algorithm>
#include <queue>
#include <string>
using namespace std;

int main() {
  string a;
  cin >> a;
  deque<char> dq;
  for (char c : a) {
    dq.push_back(c);
  }
  int q;
  cin >> q;
  int t, f;
  char c;
  bool reverseflag = false;
  for (int i=0; i<q; i++) {
    cin >> t;
    if (t == 1) {
      reverseflag = !reverseflag;
    } else {
      cin >> f;
      cin >> c;
      bool sORe = (f==1) ^ reverseflag;
      if (sORe) {
	dq.push_front(c);
      } else {
	dq.push_back(c);
      }
    }
  }
  if (reverseflag) {
    for (auto it=dq.rbegin(); it!=dq.rend(); it++) {
      cout << *it;
    }
  } else {
    for (char c : dq) {
      cout << c;
    }
  }
  cout << endl;
  

}
  


Measured memory_bytes: 896
N= int(input())
input_data = [int(x) for x in input().split()]
mini = min(input_data)
length=max(input_data)-mini
zahyo = [n-mini for n in input_data]
energy=[0 for i in range(length+1)]
for i in range(length+1):
    for j in range(N):
        energy[i]=energy[i]+(i-zahyo[j])**2
print(min(energy))

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

#define ll long long
#define vi vector<int>
#define vl vector<ll>
#define pii pair<int,int>
#define pll pair<ll,ll>
// pll pp; -> (pp.first,pp.second)
// vector<vl> pp(n,vl(2)); sort(pp.begin(),pp.end(),[](vl a,vl b){return a[0]<b[0];});

#define REP(i,n) for(ll (i)=0;(i)<(n);(i)++)
#define RREP(i,n) for(ll (i)=(n)-1;(i)>=0;(i)--)
#define FOR(i,a,b) for(ll (i)=(a);(i)<(b);(i)++)
#define FORR(i,a,b) for(ll (i)=(b)-1;(i)>=(a);(i)--)
#define DEBUG(x) cout << #x << ": " << x << endl
#define CHMAX(a,b) a=max((a),(b))
#define CHMIN(a,b) a=min((a),(b))
/*}}}*/

// n : num of nodes
ll n;
// m : num of queries
ll m;
// dat[i] : if({i is root}) -1 * {num of nodes under i} else {i's root}
vl dat;

// return x's root
ll root(ll x){
  return dat[x] < 0 ? x : dat[x]=root(dat[x]);
}

// make node a and node b belong to same group
void unite(ll a, ll b){
  a = root(a);
  b = root(b);
  if(a==b) return;
  // thanks to following line, {num of nodes under a}>={num of nodes under a} is true
  // tree height becomes smallest 
  if(-dat[a] < -dat[b]) swap(a,b);
  // {num of nodes under a} += {num of nodes under b}
  dat[a] += dat[b];
  // node b is no longer root, and b's root is a
  dat[b] = a;
}

int main() {
  cin >> n >> m;
  dat = vl(n,-1);
  REP(i,m) {
    ll ai,bi;
    cin >> ai >> bi;
    ai--;
    bi--;
    unite(ai,bi);
  }
  ll ans = 0;
  REP(i,n) if(root(i)==i) CHMAX(ans, -dat[i]);
  cout << ans << endl;
  return 0;
}

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

int main() {
    set<int> a;
    rep(i, 3) {
        int x;
        cin >> x;
        a.insert(x);
    }

    cout << a.size() << endl;
    return 0;
}


Measured memory_bytes: 3604
#include<bits/stdc++.h>
using namespace std;
#define int long
vector<int> factor(const int n){
  int m=n;
  vector<int> f;
  for(int i=2;i*i<=n;++i){
    while(m%i==0)f.push_back(i),m/=i;
  }
  if(m>1)f.push_back(m);
  return f;
}
main(){
  int n;
  cin>>n;
  map<int,int> f;
  for(int i=2;i<=n;++i){
    vector<int> g=factor(i);
    for(auto i:g)f[i]++;
  }
  vector<int> pr = {2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97};
  for(auto itr=f.begin();itr!=f.end();++itr){
    if(itr->second<2)f.erase(itr);
  }
  for(auto p:f) cerr<<p.first<<","<<p.second<<endl;
  int p3=0,p414=0,p224=0,p1=0;
  for(int i=0;i<pr.size()-1;++i){
    if(f[pr[i]]<4)break;
    for(int j=i+1;j<pr.size();++j){
      if(f[pr[j]]<4)break;
      for(int k=0;k<pr.size();++k){
        if(i==k||j==k)continue;
        if(f[pr[k]]<2)break;
        ++p3;
      }
    }
  }
  for(int i=0;i<pr.size();++i){
    if(f[pr[i]]<14)break;
    for(int j=0;j<pr.size();++j){
      if(i==j)continue;
      if(f[pr[j]]<4)break;
      ++p414;
    }
  }
  for(int i=0;i<pr.size();++i){
    if(f[pr[i]]<24)break;
    for(int j=0;j<pr.size();++j){
      if(i==j)continue;
      if(f[pr[j]]<2)break;
      if(f[pr[i]]>=24&&f[pr[j]]>=2)++p224;
    }
  }
  for(int i=0;i<pr.size();++i)
    if(f[pr[i]]>=74)++p1;
  cout<<p3+p414+p224+p1;
}

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

#define rep(i, a, b) for (int i = a; i < (int)(b); ++i)
#define rrep(i, a, b) for (int i = b - 1; i >= (int)(a); --i)

using namespace std;

using ll = long long;
using vi = vector<int>;
using vll = vector<ll>;

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

    int h;
    cin >> h;

    vi a(h + 1);
    rep(i, 1, h + 1) { cin >> a[i]; }

    rep(i, 1, h + 1) {
        cout << "node " << i << ": key = " << a[i] << ", ";
        if (i / 2 > 0) { cout << "parent key = " << a[i / 2] << ", "; }
        if (2 * i <= h) { cout << "left key = " << a[2 * i] << ", "; }
        if (2 * i + 1 <= h) { cout << "right key = " << a[2 * i + 1] << ", "; } 
        cout << endl;
    }

    return 0;
}


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

int main(){
    double n,x;
    int t;
    cin >> n >> x >> t;
    cout << int(ceil(n/x))*t << endl;
}

Measured memory_bytes: 3720
#include<iostream>
#include<vector>
#include<queue>
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;
struct Node{
	double time;
	int cur,prev,v;
};
bool operator<(const Node &l,const Node &r){
		return l.time>r.time;
}
struct Edge{
	int next,d,lim;
};
int main(){
	int n,m,s,g;
	NEXT:while(cin>>n>>m,n){
		cin>>s>>g,s--,g--;
		vector<vector<Edge> > e(n);
		rep(i,m){
			int x,y,d,c;
			cin>>x>>y>>d>>c,x--,y--;
			Edge t; t.d=d,t.lim=c;
			t.next=y,e[x].push_back(t);
			t.next=x,e[y].push_back(t);
		}
		priority_queue<Node> Q;
		double C[30][30][31]; rep(i,30)rep(j,30)rep(k,31)C[i][j][k]=1e99;
		Node init,cnode,nnode;
		rep(i,e[s].size()){
			init.time=e[s][i].d,init.cur=e[s][i].next,init.prev=s,init.v=1;
			Q.push(init); C[init.cur][s][1]=e[s][i].d;
		}
		while(!Q.empty()){
			nnode=cnode=Q.top();Q.pop();
			if(cnode.cur==g&&cnode.v==1){
				cout<<cnode.time<<endl;goto NEXT;
			}
			int c=cnode.cur,cv=cnode.v;
			nnode.prev=c;
			rep(i,e[c].size())if(e[c][i].next!=cnode.prev)
			for(int nv=cv-1;nv<=cv+1;nv++)if(0<nv&&nv<=e[c][i].lim)
			if(C[e[c][i].next][c][nv]>cnode.time+1.*e[c][i].d/nv){
				nnode.time=cnode.time+1.*e[c][i].d/nv,
				nnode.v=nv,
				nnode.cur=e[c][i].next;
				C[e[c][i].next][c][nv]=nnode.time,Q.push(nnode);
			}
		}
		cout<<"unreachable"<<endl;
	}
	return 0;
}

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

vector<vector<int>> ve;
int maks = 0;

void combinationUtil(int arr[], int n, int r,  
                    int index, int data[], int i);  
  
// The main function that prints all 
// combinations of size r in arr[]  
// of size n. This function mainly  
// uses combinationUtil()  
void printCombination(int arr[], int n, int r)  
{  
    // A temporary array to store  
    // all combination one by one  
    int data[r];  
  
    // Print all combination using  
    // temprary array 'data[]'  
    combinationUtil(arr, n, r, 0, data, 0);  
}  
  
/* arr[] ---> Input Array  
n ---> Size of input array  
r ---> Size of a combination to be printed  
index ---> Current index in data[]  
data[] ---> Temporary array to store current combination  
i ---> index of current element in arr[] */
void combinationUtil(int arr[], int n, int r,  
                    int index, int data[], int i)  
{  
    // Current cobination is ready, print it  
    if (index == r)  
    {  	
    		int temp = 0;
    		for(int i=0; i<(int)ve.size(); i++){
    			if(data[ve[i][1]-1]-data[ve[i][0]-1] == ve[i][2]+ve[i][1]-ve[i][0]){
    				temp += ve[i][3];
    			}
    		}
    		maks = max(temp, maks);
        // for (int j = 0; j < r; j++)  
        //     cout << data[j] << " ";  
        // cout << endl;  
        return;  
    }  
  
    // When no more elements are there to put in data[]  
    if (i >= n)  
        return;  
  
    // current is included, put next at next location  
    data[index] = arr[i];  
    combinationUtil(arr, n, r, index + 1, data, i + 1);  
  
    // current is excluded, replace it with next (Note that  
    // i+1 is passed, but index is not changed)  
    combinationUtil(arr, n, r, index, data, i+1);  
}  
  
// Driver code  
int main()  
{  
		ios_base::sync_with_stdio(0);
 		cin.tie(0), cout.tie(0);

 		int n,m,q;
 		cin >> n >> m >> q;

 		for(int i=0; i<q; i++){
 			int a,b,c,d;
 			cin >> a >> b >> c >> d;
 			vector<int> tempo = {a,b,c,d};
 			ve.push_back(tempo);
 		}

    // int arr[] = {1, 2, 3, 4, 5};  
    int arr[m+n-1];
    for(int i=1; i<m+n; i++){
    	arr[i-1] = i;
    }
    // int r = n;  
    printCombination(arr, m+n-1, n);  
    cout << maks << "\n";
    return 0;  
}


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

#define deb(x) cerr<<"["#x<<" : "<<x<<" ]\n";

int main()
{
	using ll = long long;
	ll n;
	cin >> n;
	if(n%2 == 0) {
		cout << n;
	} else {
		cout << 2*n;
	}
}


Measured memory_bytes: 3604
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
#include <string>

int main(int argc, char const *argv[]) {
  int n, t[200][3], tmp, score[3] = {0};
  std::cin >> n;

  for (size_t i = 0; i < n; i++) {
    std::cin >> t[i][0] >> t[i][1] >> t[i][2];
  }

  for (size_t k = 0; k < n; k++) {
    for (size_t i = 0; i < 3; i++) {
      tmp = t[k][i];

      for (size_t j = 0; j < n; j++) {
        if (j == k) {
          continue;
        }
        score[i] = tmp;
        if (tmp == t[j][i]) {
          score[i] = 0;
          break;
        }
      }

    }

    int totalscore = 0;
    for (size_t i = 0; i < 3; i++) {
      totalscore += score[i];
    }

    std::cout << totalscore << std::endl;
  }

  return 0;
}

Measured memory_bytes: 1164
n,m = [int(x) for x in input().split(" ")]
lmax = 0
rmin = 1000000
for i in range(m):
    l,r = [int(x) for x in input().split(" ")]
    
    if(lmax<l):
        lmax = l
    
    if(rmin>r):
        rmin = r

c = rmin-lmax
if c < 0:
    c = 0
    print(c)
else:
    print(c+1)
    

Measured memory_bytes: 3060
import java.util.Scanner;

class Main
{
	public static void main(String[] args){
	Scanner scan = new Scanner(System.in);
	
	double[] x = new double[100];
	double[] y = new double[100];
	double d;
	double D;
	double xy;
	double max = 0;
	
	int n = scan.nextInt();
	
	for(int i=0; i<n; i++){
		x[i] = scan.nextDouble();}
	for(int i=0; i<n; i++){
		y[i] = scan.nextDouble();}
		
	for(int p=1; p<=3; p++){
		D = 0;
		for(int i=0; i<n; i++){
			xy = 1;
			for(int t=1; t<=p; t++){
				xy *= Math.abs(x[i]-y[i]);}
			D += xy;}
			if(p == 1){
				d = D;}
			else if(p == 2){
				d = Math.sqrt(D);}
			else{
				d = Math.cbrt(D);}
			System.out.printf("%.6f\n", d);}
		for(int i=0; i<n; i++){
			xy = Math.abs(x[i]-y[i]);
			if(max < xy){
				max = xy;}}
		System.out.printf("%.6f\n", max);
	}
}


Measured memory_bytes: 29180
n = int(input())
h = list(map(int,input().split()))

ans = 1
m = h[0]
for i in range (n):
    if (h[i] > m):
        m = h[i]
    elif (m-h[i] >= 2):
        ans = 0
        break

if (ans == 1):
    print("Yes")
else :
    print("No")

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

int main() {

  vector<int> c(4);
  for (int i = 0; i < 6; i++) {
    int a;
    cin >> a;
    c.at(a - 1)++;
  }
  sort(c.begin(), c.end());

  bool flag = true;
  for (int i = 0; i < 3; i++) {
    if (i == 0 || i == 1) {
      if (c.at(i) != 1) {
        flag = false;
      }
    }
    if (i == 2 || i == 3) {
      if (c.at(i) != 2) {
        flag = false;
      }
    }
  }
  if (flag) {
    cout << "YES" << endl;
  } else {
    cout << "NO" << endl;
  }
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <math.h>
#include <vector>
#include <algorithm>
#include <iomanip>
#include <set>
#include <queue>
#define mod 1000000007
#define ten5 100005
#define PI 3.1415926
using namespace std;


int main()
{
    //int m,n,o=0,i,j,k;
    long long int sum=0,sum2=0,n1=0,n2=0,n3;
    double ans=0.0,half;
    long long int m,n,o,i,j,k=1,now=1;
    long long int a,a1;
    //float f,g,h;
    //char now,pre;
    string s,s1;
    cin>>s>>s1;
    a=s.size();
    a1=s1.size();
    if(a!=a1)
    {
        if(a>a1) cout<<"GREATER";
        else cout<<"LESS";
    }
    else
    {
        for(i=0;i<a;i++)
        {
            if(s[i]>s1[i])
            {
                cout<<"GREATER";
                return 0;
            }
            else if(s[i]<s1[i])
            {
                cout<<"LESS";
                return 0;
            }
        }
        cout<<"EQUAL";
    }
    return 0;
}



Measured memory_bytes: 256
N = gets.to_i
A = N.times.map { gets.to_i }

sorted = A.sort
count = 0

indices = Hash[sorted.map.with_index { |a, i| [a, i] }]

A.each.with_index do |a, i|
  count += 1 if (i - indices[a]).abs.odd?
end

p count / 2


Measured memory_bytes: 15144
while True:
  s= 0
  a = int(input())
  if a == 0:
    break
  else:
    n = int(input())
    for y in range(n):
      b = map(int,raw_input().split())
      c,v = b[0],b[1]
      s += v-c
    if s >= a :
      print "OK"
    else:
      print a-s

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

int main(){
  string p,s;
  cin>>p>>s;
  p=p+p;
  bool flag=false;
  for(int i=0;i<(int)p.size()-(int)s.size()+1;i++){
    
    // pのi文字目から連続したs.size() 文字を抜き出す
    string t=p.substr(i, s.size() );
    
    if( t == s ){
      flag=true;
      break;
    }
  }
  if(flag){
    cout<<"Yes"<<endl;
  }else{
    cout<<"No"<<endl;
  }
  return 0;
}




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

int main(){
  int A; cin >> A;
  int B; cin >> B;
  int C; cin >> C;
  int lim; lim = B / A;
  int ans;
  if (lim <= C){
    ans = lim;
  } else {
    ans = C;
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
#include <vector>
#include <iostream>
#include <cmath>
#include <map>
#include <unordered_map>
#include <algorithm>
#include <fstream>
#include <unistd.h>
#include <string>
#include <numeric>
#include <queue>
#include <deque>
#include <sstream>
#include <iomanip>
#include <set>
#include <stack>
#include <cassert>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<vvl> vvvl;
typedef vector<vi> vvi;
typedef vector<vvi> vvvi;
typedef vector<bool> vb;
typedef vector<vector<bool>> vvb;
typedef vector<vvb> vvvb;
typedef vector<vvvb> vvvvb;
typedef vector<string> vs;
typedef vector<vector<string>> vvs;
typedef vector<char> vc;
typedef vector<vector<char>> vvc;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<vvd> vvvd;
typedef pair<int, int> P;
typedef pair<ll, ll> PL;
typedef vector<P> vp;
typedef vector<PL> vpl;
typedef vector<vector<P>> vvp;
typedef vector<vector<PL>> vvpl;
const int INF = 1001001001;
const ll LINF = 1e16;
const double pi = 3.1415926535897932;
const string endstr = "\n";
#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 REP(i, n) for(ll i = 0; i < n; i++)
#define RREP(i, n) for(ll i = n-1; i > -1; i--)
#define FORMAP(it, m) for(auto it = m.begin(); it != m.end(); it++)
#define ff first
#define ss second
#define pb push_back
#define epb emplace_back

template <typename T>
T gcd(T a, T b) {
    return (a == 0) ? b : gcd(b%a, a);
}
template <typename T>
T lcm(T a, T b) {
    return a / gcd(a, b) * b;
}

bool p_comp_fs(const PL p1, const PL p2){ return p1.first < p2.first;};
bool p_comp_fg(const PL p1, const PL p2){ return p1.first > p2.first;};
bool p_comp_ss(const PL p1, const PL p2){ return p1.second < p2.second;};
bool p_comp_sg(const PL p1, const PL p2){ return p1.second > p2.second;};
template <typename T>
vector<T> uniquen(vector<T> vec){
    vec.erase(unique(vec.begin(), vec.end()), vec.end());
    return vec;
}


int main(){
    ll A, P; cin >> A >> P;
    P += A*3;
    cout << P / 2 << endl;
    return 0;
}


Measured memory_bytes: 256
while 1:
    n = int(input())
    if n == 0:
        break
    
    sum_a = 0
    sum_b = 0
    
    for i in range(n):
        a,b = map(int, input().split())
        
        if a > b:
            sum_a = sum_a + a + b
        elif a < b:
            sum_b = sum_b + a + b
        elif a == b:
            sum_a = sum_a + a
            sum_b = sum_b + b

    print(sum_a,sum_b)

        



Measured memory_bytes: 5616
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pll = pair<ll, ll>;
using vl = vector<ll>;

/* short */
#define pb push_back
#define mp make_pair
#define Fi first
#define Se second
#define ALL(v) begin(v), end(v)
#define RALL(v) rbegin(v), rend(v)

/* REPmacro */
#define FOR(i, a, b) for(int i = (a); i < (b); i++)
#define FORR(i, a, b) for(int i = (a); i >= (b); i--)
#define REP(i, n) for(int i = 0; i < (n); i++)
#define FOREACH(x, a) for(auto x : a)

/* exchange */
#define CHMIN(a, b) (a) = min((ll)(a), (ll)(b))
#define CHMAX(a, b) (a) = max((ll)(a), (ll)(b))

/* function */
#define IN(x) cin >> x
#define DEBUG(x) cerr << (x) << " "
#define LN() cerr << "\n"
#define PRINT(x) cout << (x) << endl
#define BR cout << endl

/* const */
const int ARRAY = 100005;
const int INF = 1001001001; // 10^9
const ll LINF = 1001001001001001001; // 10^18
const int MOD = 1e9 + 7;

ll N = 0;
ll M = 0;
ll t;
ll ret = 0;
string s;
ll sum = 0;

void input() {
  IN(N);
  IN(M);
  REP(i, M) {
    IN(t);
    sum += t;
  }
}

void solve() {
  if (sum > N) {
    PRINT(-1);
  } else {
    PRINT(N - sum);
  }
}

int main(void){
  input();
  solve();
}


Measured memory_bytes: 3640
#include <bits/stdc++.h>
using namespace std;
void solve();
int main(){
    int t = 1;
    while(t --) solve();
    return 0;
}

#define pb push_back
#define mp make_pair
#define fr first
#define sc second

const int maxn = 1e6 + 6;
const int mod = 1e9 + 7;

int n, a[maxn];
long long s, S, res;
void solve(){
    cin >> n;
    for(int i = 1; i <= n; i ++) cin >> a[i];
    int l = 1;
    for(int i = 1; i <= n; i ++){
        s ^= a[i];
        S += a[i];
        while(s != S){
            s ^= a[l];
            S -= a[l];
            l ++;
        }
        res += i - l + 1;
    }
    cout << res;
}


Measured memory_bytes: 1024
#include<iostream>
#include<cstring>
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<set>
#include<bitset>
#include<map>

#define fo(i,a,b) for(int i=a;i<=b;i++)
#define fd(i,a,b) for(int i=a;i>=b;i--)

using namespace std;

typedef long long LL;
typedef double db;

int get(){
	char ch;
	while(ch=getchar(),(ch<'0'||ch>'9')&&ch!='-');
	if (ch=='-'){
		int s=0;
		while(ch=getchar(),ch>='0'&&ch<='9')s=s*10+ch-'0';
		return -s;
	}
	int s=ch-'0';
	while(ch=getchar(),ch>='0'&&ch<='9')s=s*10+ch-'0';
	return s;
}

const int p = 37;
const int mo = 1e9+7;
const int N = 305;

LL quickmi(LL x,LL tim){
	LL ret=1;
	for(;tim;tim/=2,x=x*x%mo)
	if (tim&1)ret=ret*x%mo;
	return ret;
}

int n;
char s[N][N],tmp[N][N];
LL v0[N],v1[N],mi[N],ny;

int main(){
	n=get();
	fo(i,0,n-1)scanf("%s",s[i]);
	mi[0]=1;
	fo(i,1,n)mi[i]=mi[i-1]*p%mo;
	ny=quickmi(p,mo-2);
	int ans=0;
		fo(B,0,n-1){
			fo(i,0,n-1){
				fo(j,0,n-1)tmp[i][(j+B)%n]=s[i][j];
				v0[i]=v1[i]=0;
				fo(j,0,n-1)v1[i]=(v1[i]*p+tmp[i][j]-'a'+1)%mo;
			}
			fo(i,0,n-1){
				fo(j,0,n-1)v0[i]=(v0[i]*p+tmp[j][i]-'a'+1)%mo;
			}
			fo(A,0,n-1){
				int cnt=0;
				fo(i,0,n-1)cnt+=(v1[i]==v0[(i+A)%n]);
				if (cnt==n)ans++;
				fo(i,0,n-1){
					LL v=v0[i];
					v=((v+mo-(tmp[(n-1-A)%n][i]-'a'+1))%mo*ny%mo+mi[n-1]*(tmp[(n-1-A)%n][i]-'a'+1)%mo)%mo;
					v0[i]=v;
				}
			}
		}
	printf("%d\n",ans);
	return 0;
}

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

int main(int argc, char const *argv[])
{
	int n;
	cin>>n;
	int a[n];
	set<int> b;
	for (int i = 0; i < n; ++i)
	{
		cin>>a[i];
		b.insert(a[i]);
	}
	sort(a,a+n);
	int f=0;
	if (b.size()==1)
	{
		if (a[n-1]==0)
		{
			f=1;
		}
	}
	else if (b.size()==2)
	{
		if (n%3==0&&a[n/3-1]==0&&a[n/3-1]!=a[n/3])
		{
			f=1;
		}
	}
	else if (b.size()==3)
	{
		if (n%3==0&&a[n/3-1]!=a[n/3]&&a[2*n/3-1]!=a[2*n/3]&&(a[0]^a[n/3]^a[2*n/3])==0)
		{
			f=1;
		}
	}
	if (f==1)
	{
		cout<<"Yes\n";
	}
	else
	{
		cout<<"No\n";
	}
	return 0;
}


Measured memory_bytes: 4224
#include<bits/stdc++.h>
#define LL long long
#define il inline

using namespace std;
const int N=1e5+10;
il int rd()
{
    int x=0,w=1;char ch=0;
    while(ch<'0'||ch>'9') {if(ch=='-') w=-1;ch=getchar();}
    while(ch>='0'&&ch<='9') {x=(x<<3)+(x<<1)+(ch^48);ch=getchar();}
    return x*w;
}
int to[N<<1],nt[N<<1],hd[N],dg[N],ddg[N],tot;
void add(int x,int y)
{
    ++tot,to[tot]=y,nt[tot]=hd[x],hd[x]=tot,++dg[x];
    ++tot,to[tot]=x,nt[tot]=hd[y],hd[y]=tot,++dg[y];
}
int n,m,ans,s[N],de[N],sx,sy;
bool v[N];
int st[N],tt,sq[N],ts,kk[N];
void findd()
{
    queue<int> q;
	for(int i=1;i<=n;++i) if(dg[i]==1) q.push(i);
	while(!q.empty())
	{
		int x=q.front();
		q.pop();
		for(int i=hd[x];i;i=nt[i])
		{
			int y=to[i];
			--dg[y];
			if(dg[y]==1) q.push(y);
		}
	}
	for(int i=1;i<=n;++i)
		if(dg[i]>1)
		{
			int la=0,x=i;
			while(1)
			{
				sq[++ts]=x;
				for(int i=hd[x];i;i=nt[i])
				{
					int y=to[i];
					if(dg[y]<=1||y==la) continue;
					la=x,x=y;break;
				}
				if(x==i) break;
			}
			return;
		}
}
void dfs(int x,int ffa,int ss)
{
	if(x==sx) kk[x]=1;
	else if(x==sy) kk[x]=-1;
	s[x]+=de[x]=ss;
	for(int i=hd[x];i;i=nt[i])
	{
		int y=to[i];
		if(y==ffa) continue;
		if(min(x,y)==min(sx,sy)&&max(x,y)==max(sx,sy)) continue;
		dfs(y,x,-ss);
		s[x]+=s[y],kk[x]+=kk[y];
	}
	ans+=abs(s[x]);
}

int main()
{
    n=rd(),m=rd();
    for(int i=1;i<=m;++i) add(rd(),rd());
    if(m==n-1)
    {
		dfs(1,0,1);
		printf("%d\n",s[1]?-1:ans);
    }
    else
    {
		findd();
		sx=sq[1],sy=sq[2];
		dfs(1,0,1);
		if(ts&1)
		{
			if(abs(s[1])&1) puts("-1");
			else
			{
				int sht=-(s[1]/2);
				for(int i=1;i<=n;++i) s[i]=0;
				s[sq[1]]=s[sq[2]]=sht;
				ans=0,dfs(1,0,1);
				printf("%d\n",ans+abs(sht));
			}
		}
		else
		{
			if(s[1]) puts("-1");
			else
			{
				ans=0;
				st[tt=1]=0;
				for(int i=1;i<=n;++i)
				{
					if(!kk[i]) ans+=abs(s[i]);
					else st[++tt]=(~kk[i])?-s[i]:s[i];
				}
				sort(st+1,st+tt+1);
				for(int i=1;i<=tt;++i) ans+=abs(st[i]-st[(tt+1)/2]);
				printf("%d\n",ans);
			}
		}
    }
    return 0;
}


Measured memory_bytes: 11136
from collections import deque

totaltime = 0

n, q = (int(x) for x in input().split())


Q = deque()

for i in range(n):
    name, time = (x for x in input().split())
    Q.append([name,int(time)])
    
while len(Q) != 0:
    process = Q.popleft()
    time = process[1] - q
    if time > 0:
        process[1] = time
        totaltime += q
        Q.append(process)
        
    else:
        totaltime += process[1]
        print(process[0] + ' ' + str(totaltime))


Measured memory_bytes: 13304
#!/usr/bin/env python3

def main():
    N = int(input())
    a = list(map(int, input().split()))

    ans = 0
    for i in range(N):
        if i % 2 == 0 and (a[i] % 2 == 1):
            ans += 1

    print(ans)


if __name__ == "__main__":
    main()


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

#define REP(i,n) REPN(i,0,n)
#define REPN(i,m,n) for(int i=m; i<(n); i++)

struct Point {
    double x, y;
};

void koch(int n, Point a, Point b) {
    if (n == 0) {
        return;
    }
    Point s, t, u;
    double th = M_PI * 60.0 / 180.0;

    s.x = (2.0 * a.x + 1.0 * b.x) / 3.0;
    s.y = (2.0 * a.y + 1.0 * b.y) / 3.0;
    t.x = (1.0 * a.x + 2.0 * b.x) / 3.0;
    t.y = (1.0 * a.y + 2.0 * b.y) / 3.0;
    u.x = (t.x - s.x) * cos(th) - (t.y - s.y) * sin(th) + s.x;
    u.y = (t.x - s.x) * sin(th) + (t.y - s.y) * cos(th) + s.y;

    koch(n - 1, a, s);
    cout << s.x << " " << s.y << '\n';
    koch(n - 1, s, u);
    cout << u.x << " " << u.y << '\n';
    koch(n - 1, u, t);
    cout << t.x << " " << t.y << '\n';
    koch(n - 1, t, b);
}

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

    Point a, b;
    int n;

    cin >> n;

    a.x = 0;
    a.y = 0;
    b.x = 100;
    b.y = 0;

    cout << a.x << " " << a.y << '\n';
    koch(n, a, b);
    cout << b.x << " " << b.y << '\n';
}



Measured memory_bytes: 3296
from collections import Counter
n = int(input())
A = list(map(int,input().split()))
Acount = Counter(A)

total = 0
for key in Acount.keys():
    total += Acount[key] * (Acount[key] - 1) // 2

for i in range(n):
    tmp = total
    tmp -= Acount[A[i]]*(Acount[A[i]]-1) // 2
    tmp += (Acount[A[i]]-1)*(Acount[A[i]]-2) // 2
    print(tmp)

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

#define ll long long
#define rep(i,x,y) for(int i=x;i<y;i++)
#define rel(i,x,y) for(int i=x-1;i>=y;i--)
#define all(x) x.begin(),x.end()

int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    vector<int> x1(n);
    vector<int> x2;
    rep(i,0,n) cin >> x1[i];
    copy(all(x1),back_inserter(x2));

    sort(all(x2));
    rep(i,0,n){
        if(x1[i]<x2[n/2]) cout << x2[n/2] << endl;
        else cout << x2[n/2-1] << endl;
    }
}

Measured memory_bytes: 3956
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<utility>
#include<map>
#include<set>
#include<queue>
#include<stack>
#include<functional>
#include<math.h>
using namespace std;
#define N (1000000000+7)
#define M (998244353)
#define INF 1e16
typedef long long ll;
typedef pair<int,int> P;


int main(void){
    int a,b;
    cin>>a>>b;
    if(a>0)cout<<"Positive"<<endl;
    else{
        if(a==0)cout<<"Zero"<<endl;
        else{
            if(b>=0)cout<<"Zero"<<endl;
            else{
                if((b-a+1)%2==0)cout<<"Positive"<<endl;
                else cout<<"Negative"<<endl;
            }
        }
    }
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
using namespace std;
int main(){
  int n,i,j,k,b;
  string str;
  char c;
  cin >> n;
  for(i=0;i<n;i++){
    cin >> c;
    str+=c;
  }
  k=0;
  while(str.find(to_string(k))!=-1){
    k++;
  }
  cout << k << endl;
  return 0;
}

Measured memory_bytes: 3276
#include <iostream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <algorithm>
using namespace std;

int main(){
    long long n;
    cin >> n;

    vector<long long>a(n);
    vector<long long>b(n);

    long long sum_a = 0, sum_b = 0;

    for(long long i = 0; i < n; i++){
        cin >> a[i];
        sum_a += a[i];
    }

    for(long long i = 0; i < n; i++){
        cin >> b[i];
        sum_b += b[i];
    }

    if(sum_a < sum_b){
        printf("-1\n");
        return 0;
    }

    vector<long long> plus;
    vector<long long> minus;

    for(long long i = 0; i < n; i++){
        if(a[i] - b[i] > 0){
            plus.push_back(a[i]-b[i]);
        }
        else if(a[i] - b[i] < 0){
            minus.push_back(b[i]-a[i]);
        }
    }

    sort(plus.begin(), plus.end(), greater<long long>());
    sort(minus.begin(), minus.end(), greater<long long>());

    if(minus.size() == 0){
        printf("0\n");
        return 0;
    }

    long long count = 0;

    while(minus.size() != 0){
        if(plus[0] > minus[0]){
            plus[0] -= minus[0];
            count++;
            minus.erase(minus.begin());
        }
        else if(plus[0] < minus[0]){
            minus[0] -= plus[0];
            count++;
            plus.erase(plus.begin());
        }
        else{
            count += 2;
            minus.erase(minus.begin());
            plus.erase(plus.begin());
        }
    }

    cout << count+1 << endl;

    return 0;


}

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

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

#define pb push_back
#define rep(i, n) for(int i = 0; i < (n); i++)
#define dep(i, a, n) for(int i = a; i >= (n); i--)
#define FOR(i, a, n) for(int i = a; i < (n); i++)
#define mod (ll)(1e9+7)
#define int ll
#define INF 100000000

__attribute__((constructor))
void initial() {
  cin.tie(0);
  ios::sync_with_stdio(false);
}

signed main() {
	ll n;
  cin >> n;
  rep(z, n) {
    if(z) cout << endl;
    ll ch[9][9];
    bool result[9][9];
    rep(i, 9) rep(j, 9) {
      cin >> ch[i][j];
      result[i][j] = false;
    }
    rep(i, 9) rep(j, 9) {
      ll a, b;
      a = ((i + 3) % 3);
      b = ((j + 3) % 3);
      rep(k, j) if(ch[i][j] == ch[i][k]) result[i][j] = result[i][k] = true;
      FOR(k, j + 1, 9) if(ch[i][j] == ch[i][k]) result[i][j] = result[i][k] = true;
      rep(k, i) if(ch[i][j] == ch[k][j]) result[i][j] = result[k][j] = true;
      FOR(k, i + 1, 9) if(ch[i][j] == ch[k][j]) result[i][j] = result[k][j] = true;
      for(int k = (i - a); k < (i - a + 3); k++) {
        for(int l = (j - b); l < (j - b + 3); l++) {
          if(i == k && j == l) continue;
          if(ch[i][j] == ch[k][l]) result[i][j] = result[k][l] = true;
        }
      }
    }
    rep(i, 9) {
      rep(j, 9) {
      if(result[i][j]) cout << '*';
      else cout << ' ';
      cout << ch[i][j];
      }
      cout << endl;
    }
  }
	return 0;
}


Measured memory_bytes: 3128
def main():
    S = input()
    L = []
    LL = []
    i = 0
    for _ in range(len(S)):
        L.append(str(1 ^ i))
        i ^= 1
    i = 0
    for _ in range(len(S)):
        LL.append(str(0 ^ i))
        i ^= 1
    L = ''.join(L)
    LL = ''.join(LL)
    lc = 0
    llc = 0
    for s, l, ll in zip(S, L, LL):
        if s != l:
            lc += 1
        if s != ll:
            llc += 1
    print(min(lc, llc))


main()


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

int main(){
    int n;
    cin >> n;
    map<int,int> m;
    rep(i,n){
        int a;
        cin >> a;
        m[a]++;
    }
    for(auto p : m){
        if(p.second > 1){
            cout << "NO" << endl;
            return 0;
        }
    }
    cout << "YES" << endl;
}

Measured memory_bytes: 12836
#include <bits/stdc++.h>
#define LOCAL
using namespace std;
template <typename A, typename B>
ostream& operator <<(ostream& out, const pair<A, B>& a) {
out << "(" << a.first << "," << a.second << ")";
return out;
}
template <typename T, size_t N>
ostream& operator <<(ostream& out, const array<T, N>& a) {
out << "["; bool first = true;
for (auto& v : a) { out << (first ? "" : ", "); out << v; first = 0;} out << "]";
return out;
}
template <typename T>
ostream& operator <<(ostream& out, const vector<T>& a) {
out << "["; bool first = true;
for (auto& v : a) { out << (first ? "" : ", "); out << v; first = 0;} out << "]";
return out;
}
template <typename T, class Cmp>
ostream& operator <<(ostream& out, const set<T, Cmp>& a) {
out << "{"; bool first = true;
for (auto& v : a) { out << (first ? "" : ", "); out << v; first = 0;} out << "}";
return out;
}
template <typename U, typename T, class Cmp>
ostream& operator <<(ostream& out, const map<U, T, Cmp>& a) {
out << "{"; bool first = true;
for (auto& p : a) { out << (first ? "" : ", "); out << p.first << ":" << p.second; first = 0;} out << "}";
return out;
}
#ifdef LOCAL
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
#else
#define trace(...) 42
#endif
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
cerr << name << ": " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
const char* comma = strchr(names + 1, ',');
cerr.write(names, comma - names) << ": " << arg1 << " |";
__f(comma + 1, args...);
}
#define rep(i,n) for(int i=0; i<(n); i++)
using ll = long long;
#define int long long
using P = pair<int,int>;
//#########################################
bool comp(const P &a,const P &b){
    if(a.second == b.second)return a.first > b.second;
    return a.second < b.second;
}
signed main(){
    int n;cin >> n;
    vector<P> res;
    rep(i,n){
        int a,b;cin >> a >> b;
        res.emplace_back(a-b,a+b);
    }
    sort(res.begin(),res.end(),comp);
    vector<P> ret;
    rep(i,n){
        if(ret.size()){
            if(ret.back().second > res[i].first)continue;
        }
        ret.emplace_back(res[i]);
    }
    cout << ret.size() << endl;
    return 0;
}

Measured memory_bytes: 7900
n,m = map(int, input().split())
D = [list() for i in range(n)]
for i in range(m):
  a,b = map(int,input().split())
  D[a-1].append(b-1)
  D[b-1].append(a-1)

d = [0]*n
d[0] = 1
cnt = 0

def dfs(x):
  global cnt
  if all(d):
    cnt += 1
    return
  for i in D[x]:
    if d[i] == 0:
      d[i] = 1
      dfs(i)
      d[i] = 0

dfs(0)
print(cnt)

Measured memory_bytes: 3064
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <queue>
#include <string>
#include <map>
#include <set>
#include <tuple>
#include <deque>
#include <numeric>
#include <bitset>
#include <iomanip>
#include <cassert>
#include <chrono>
#include <random>
#include <limits>
#include <iterator>
#include <functional>
using namespace std;
 
typedef long long ll;
typedef pair<int, int> P;
const double PI = 3.1415926535897932;   // acos(-1)
const double EPS = 1e-15;
const int mod = 1e+9 + 7;
const int INF = 1e+9;

ll dp0[2005][2005];
ll dp1[2005][2005];

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

    int n, m;
    cin >> n >> m;
    vector<int> s(n+2, -1), t(m+2, -2);
    for(int i = 0; i < n; ++i){
        cin >> s[i];
    }
    for(int i = 0; i < m; ++i){
        cin >> t[i];
    }
    dp0[0][0] = 1;
    for(int i = 0; i <= n; ++i){
        for(int j = 0; j <= m; ++j){
            dp0[i+1][j] = (dp0[i+1][j] + dp0[i][j]) % mod;
            dp1[i][j] = (dp1[i][j] + dp0[i][j]) % mod;
            dp1[i][j+1] = (dp1[i][j+1] + dp1[i][j]) % mod;
            if(s[i] == t[j]){
                dp0[i+1][j+1] = (dp0[i+1][j+1] + dp1[i][j]) % mod;
            }
        }
    }
    cout << dp1[n][m] << endl;
}

Measured memory_bytes: 63104
#include<iostream>
#include <vector>
#include <cmath>
#include <algorithm>
#include <utility>
#include <map>

using namespace std;

int main()
{
	int A,B;
	cin >> A >> B;

	if (A % 2 == 0)
	{
		cout << "No" << endl;

		return 0;
	}

	if (B % 2 == 0)
	{
		cout << "No" << endl;

		return 0;
	}

	cout << "Yes"<< endl;

	return 0;


}



Measured memory_bytes: 3600
import sys


stdin = sys.stdin
def ns(): return stdin.readline().rstrip()
def ni(): return int(stdin.readline().rstrip())
def nm(): return map(int, stdin.readline().split())
def nl(): return list(map(int, stdin.readline().split()))


def main():
    n, k = nm()
    print(0 if n % k == 0 else 1)


if __name__ == '__main__':
    main()


Measured memory_bytes: 9180
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int P = 998244353;
const int N = 1000000 + 1;
int n, x, c[N], c2[N];
ll f[N];
int inv[N];
void get_inv() {
    inv[1] = 1;
    for (int i = 2; i < N; i++) inv[i] = 1ll * inv[P % i] * (P - P / i) % P;
}
int main() {
    get_inv();
    scanf("%d", &n);
    for (int i = 1; i <= n; i++) {
        scanf("%d", &x);
        c[x] = (c[x] + x) % P;
        c2[x] = (c2[x] + 1ll * x * x % P) % P;
    }
    for (int i = 1; i < N; i++) {
        for (int j = i + i; j < N; j += i) {
            c[i] = (c[i] + c[j]) % P;
            c2[i] = (c2[i] + c2[j]) % P;
        }
        //printf("%d %d\n",c[i],c2[i]);
        f[i] =
            (1ll * c[i] * c[i] % P - c2[i] + P) % P * inv[2] % P;
    }
    for (int i = N - 1; i >= 1; --i)
        for (int j = i + i; j < N; j += i) f[i] = (f[i] - f[j] + P) % P;
    int ans = 0; 
    for (int i = 1; i < N; i++) ans = (ans + f[i] * inv[i] % P) % P;
    printf("%d\n", ans);
    return 0;
}

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

#define DICE_SIZE 6

#define TOP    0
#define FRONT  1
#define RIGHT  2
#define LEFT   3
#define BACK   4
#define BOTTOM 5

using namespace std;

class Dice {
	private:
		int number[DICE_SIZE];
		int work_space[DICE_SIZE];

		void reset_number(int, int, int, int, int, int);

	public:
		Dice(int *);
		void turn(char);
		void turn_horizon();
		int peek(int);
		void set_top(int);
		int get_position(int);
		bool equals(Dice *);
};

Dice::Dice(int *number) {
	for (int i = 0; i < DICE_SIZE; i++) this->number[i] = number[i];
}

void Dice::turn(char direction) {
	for (int i = 0; i < DICE_SIZE; i++) work_space[i] = number[i];

	switch (direction) {
		case 'N':
			reset_number(work_space[1], work_space[5], work_space[2], work_space[3], work_space[0], work_space[4]);
			break;			
		case 'E':
			reset_number(work_space[3], work_space[1], work_space[0], work_space[5], work_space[4], work_space[2]);
			break;
		case 'S':
			reset_number(work_space[4], work_space[0], work_space[2], work_space[3], work_space[5], work_space[1]);
			break;
		case 'W':
			reset_number(work_space[2], work_space[1], work_space[5], work_space[0], work_space[4], work_space[3]);
			break;
	}
}

void Dice::turn_horizon() {
	for (int i = 0; i < DICE_SIZE; i++) work_space[i] = number[i];

	reset_number(work_space[0], work_space[3], work_space[1], work_space[4], work_space[2], work_space[5]);
}

int Dice::peek(int position) {
	return number[position];
}

int Dice::get_position(int num) {
	for (int i = 0; i < DICE_SIZE; i++) {
		if (number[i] == num) return i;
	}
}

void Dice::reset_number(int num0, int num1, int num2, int num3, int num4, int num5) {
	number[0] = num0;
	number[1] = num1;
	number[2] = num2;
	number[3] = num3;
	number[4] = num4;
	number[5] = num5;
}

void Dice::set_top(int num) {
	int current_position = get_position(num);

	if (current_position == RIGHT || current_position == LEFT) {
		while (peek(TOP) != num) {
			turn('W');
		}
	} else {
		while (peek(TOP) != num) {
			turn('N');
		}
	}
}

bool Dice::equals(Dice *dice) {
	bool eql_flg = true;
	for (int i = 0; i < DICE_SIZE; i++) {
		if (peek(i) != dice->peek(i)) {
			eql_flg = false;
			break;
		}
	}

	return eql_flg;
}

int main() {
	int number[DICE_SIZE];
	
	for (int i = 0; i < DICE_SIZE; i++) cin >> number[i];
	Dice *dice1 = new Dice(number);

	for (int i = 0; i < DICE_SIZE; i++) cin >> number[i];
	Dice *dice2 = new Dice(number);

	bool eql_flg = false;
	for (int i = 0; i < DICE_SIZE; i++) {
		dice1->set_top(dice1->peek(i));

		for (int j = 0; j < DICE_SIZE; j++) {
			dice2->set_top(dice2->peek(j));

			for (int k = 0; k < 4; k++) {
				if (dice1->equals(dice2)) {
					eql_flg = true;
					goto END;
				}

				dice2->turn_horizon();
			}
		}
	}

	END:
		cout << (eql_flg ? "Yes" : "No") << endl;

	return 0;
}



Measured memory_bytes: 3108
#include <bits/stdc++.h>
typedef long long ll;
#define INF 1000000000
#define MOD 1000000007
int dx[4]={1,0,-1,0},dy[4]={0,-1,0,1};
using namespace std;
int main(void){
    int n;
    cin>>n;
    ll a[n];
    int ans=0;
    for(int i=0;i<n;i++){
        cin>>a[i];
    }   
    for(int i=0;i<n;i++){
        while(a[i]%2==0){
            ans++;
            a[i]/=2;
        }
    }
    cout<<ans<<endl;
    return 0;   
}

Measured memory_bytes: 384
s = [int(x) for x in list(input().split())]
ans = "No"
for i in range(3):
  tmp = [x/s[i] == 1 for x in s]
  is_poor = 0
  for j in tmp:
    is_poor += j
  if is_poor == 2:
    ans = "Yes"
    pass
print(ans)


Measured memory_bytes: 2940
#include <iostream>
#include <vector>
#include <string>
#include <numeric>
#include <tuple>
#include <algorithm>
#include <array>
using namespace std;
using ll = long long;
#define rep(i,n) for(decltype(n) i=0; i<n; ++i)
inline constexpr ll Inf = (1ULL << 62) -1;

template <class T>
void updatemax(T& a, T b) { if (b > a) a = b; }

int main() {
    ll N, D;
    cin >> N >> D;
    ll ans=0;
    rep(i,N) {
        ll x,y;
        cin >> x >> y;
        if (x*x+y*y <= D*D)
            ++ans;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3160
#include<bits/stdc++.h>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
#define lli long long int   //used int to avoid mle
#define ulli unsigned long long int 
#define ld long double
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define loop(i,a,b) for(lli i=a;i<b;i++)
#define initialize(array,size,value) for(lli i=0;i<size;i++) array[i]=value
#define couta(array,size) for(lli i=0;i<size;i++) cout<<array[i]<<" "
#define vl vector<lli>
#define vp vector< pair <lli,lli> >
#define sl set<lli>
#define spl set<pll>
#define msl multiset <lli>
#define msp multiset <pll>
#define pll pair<lli, lli>
#define mll map<lli, lli>              //for( map<lli, lli>::iterator i=temp.begin();i!=temp.end();i++)cout<<i->fi<<" "<<i->se<<endl;
#define mvl map<lli, vl>
#define umll unordered_map<lli, lli>
#define vt vector<pair<lli, pll >  >
#define vf vector<pair<pll,pll > >
#define qu queue<lli>
#define pq priority_queue<lli>
#define dq deque <lli>
#define ptr vector<lli>::iterator
#define bs(array,x) binary_search(array.begin(),array.end(),x)
#define lb(array,x) lower_bound(array.begin(),array.end(),x)
#define ub(array,x) upper_bound(array.begin(),array.end(),x)
#define nobw(array,i,j) upper_bound(array.begin(), array.end(), j)-lower_bound(array.begin(), array.end(), i) //number of numbers between i & j
#define vc clear()
#define endl '\n'
#define sp system("pause");
#define INF 9223372036854775807
#define MINF -9223372036854775808
#define start_routine() int begtime = clock();
#define end_routine() int endtime = clock(); cerr << endl << "Time elapsed: " << (endtime - begtime)*1000/CLOCKS_PER_SEC << " ms"; return 0
lli mod=1000000007;
//string s=bitset<32>(n).to_string();
int main()
{
 	ios::sync_with_stdio(0);
    cin.tie(0);
    
        lli n;
        cin>>n;
        if(n%2==1){cout<<0;return 0;}
       	lli t=10;
       	lli ans=0;
       	while(t<=n){
       		ans+=n/t;
       		t=t*5;
       	}
       	cout<<ans;

}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int               long long
#define pb                push_back
#define ppb               pop_back
#define pf                push_front
#define ppf               pop_front
#define all(x)            (x).begin(),(x).end()
#define sz(x)             (int)((x).size())
#define fr                first
#define sc                second
#define pii               pair<int,int>
#define rep(i,a,b)        for(int i=a;i<b;i++)
#define mem1(a)           memset(a,-1,sizeof(a))
#define mem0(a)           memset(a,0,sizeof(a))
#define ppc               __builtin_popcount
#define ppcll             __builtin_popcountll

template<typename T1,typename T2>istream& operator>>(istream& in,pair<T1,T2> &a){in>>a.fr>>a.sc;return in;}
template<typename T1,typename T2>ostream& operator<<(ostream& out,pair<T1,T2> a){out<<a.fr<<" "<<a.sc;return out;}
template<typename T,typename T1>T amax(T &a,T1 b){if(b>a)a=b;return a;}
template<typename T,typename T1>T amin(T &a,T1 b){if(b<a)a=b;return a;}

const long long INF=1e18;
const int32_t M=1e9+7;
const int32_t MM=998244353;

const int N=0;



void solve(){
	int n,k;
	cin>>n>>k;
	set<int> s;
	rep(i,1,n+1){
		s.insert(i);
	}
	rep(i,0,k){
		int d;
		cin>>d;
		rep(j,0,d){
			int a;
			cin>>a;
			s.erase(a);
		}
	}
	cout<<sz(s);
}
signed main(){
	ios_base::sync_with_stdio(false);
	cin.tie(0);cout.tie(0);
	//freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);
	#ifdef SEIVE
		seive();
	#endif
	#ifdef NCR
		init();
	#endif
	int t=1;
	//cin>>t;
	while(t--) solve();
	return 0;
}


Measured memory_bytes: 3656