akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
typedef pair<int,int> P;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<P> vp;
typedef vector<vp> vvp;

int n;
vi r;
vvp a;

int main(){
	cin>>n;
	r=vi(n);
	a=vvp(3,vp(n));
	for(int i=0;i<n;i++) cin>>r[i];
	for(int i=0;i<n;i++) cin>>a[0][i].first>>a[1][i].first>>a[2][i].first;
	for(int i=0;i<n;i++) for(int j=0;j<3;j++) a[j][i].second=i;
	bool flag=0;
	int res=(1<<29);
	for(int i=0;i<3;i++) for(int j=0;j<=100;j++){
		vvp b=a;
		b[i][0].first+=j;
		for(int k=0;k<3;k++) sort(b[k].rbegin(),b[k].rend());
		vp sum(n,{0,0});/*
		vvi num(3,vi(n));
		for(int k=0;k<3;k++){
			num[i][0]
			for(int l=1;l<n;l++) 
		}*/
		for(int k=0;k<n;k++) sum[k].second=k;
		for(int k=0;k<3;k++){
			int I=0;
			sum[b[k][0].second].first+=r[0];
			for(int l=1;l<n;l++){
				if(b[k][l].first==b[k][l-1].first) sum[b[k][l].second].first+=r[I];
				else{
					sum[b[k][l].second].first+=r[l];
					I=l;
				}
			}
		}
		sort(sum.begin(),sum.end(),[](P p,P q){
			if(p.first==q.first) return p.second<q.second;
			return p.first>q.first;
		});
/*		if(i==0&&j==2){
			for(int k=0;k<3;k++){
				for(int l=0;l<n;l++) cout<<b[k][l].second<<' ';
				cout<<endl;
			}
		}*/
/*		if(i==0&&j==2) for(int k=0;k<n;k++) cout<<sum[k].first<<' '<<sum[k].second<<endl;*/
		for(int k=0;k<8;k++) if(!sum[k].second){
			res=min(res,j);
			flag=1;
		}
	}
	if(!flag) cout<<"Saiko"<<endl;
	else cout<<res<<endl;
}

Measured memory_bytes: 3044
#include<iostream>
    using namespace std;
    long long a, b, n, N, T, A;
    int main() {
    	cin >> N;
    	a = 1, b = 1;
    	for (int i = 0; i < N; i++) {
    		cin >> T >> A;
    		n = max((a+T-1)/T,(b+A-1)/A);
    		a = T*n;
    		b = A*n;
    	}
    	cout << a+b  << endl;
    	return 0;
    }

Measured memory_bytes: 256
#![allow(non_snake_case)]

fn read_line() -> String {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).unwrap();
    s.trim().to_string()
}

fn main() {
    let S: Vec<char> = read_line().chars().collect();
    let odd = ['R', 'U', 'D'];
    let even = ['L', 'U', 'D'];
    let mut ok = true;
    for i in 0..S.len() {
        if ((i+1) % 2 == 0 && !even.contains(&S[i]))
            || ((i+1) % 2 == 1 && !odd.contains(&S[i])) {
            ok = false;
            break;
        }
    }
    if ok {
        println!("Yes");
    } else {
        println!("No");
    }
}


Measured memory_bytes: 4352
#include <iostream>
#include <string>
#include <cstring>
#include <vector>
#include <algorithm>
#include <set>
#include <stack>
#include <deque>
#include <cmath>
#include <map>
using namespace std;
typedef long long LL;

int main() {
    int n, m, x, y;
    cin >> n >> m >> x >> y;
    vector<int> vx(n), vy(m);
    for (int i = 0; i < n; i++) cin >> vx[i];
    for (int i = 0; i < m; i++) cin >> vy[i];

    int mx = x, my = y;
    for (int i = 0; i < n; i++) mx = max(mx, vx[i]);
    for (int i = 0; i < m; i++) my = min(my, vy[i]);
    if(mx < my) cout << "No War" << endl;
    else cout << "War" << endl;
}

Measured memory_bytes: 256
//
// Created by tac on 2016/10/12.
//

#include <cstdlib>
#include <iostream>
#include <vector>

int main() {
    int n;
    int a;
    std::cin >> n;
    std::vector<int> vec;
    for (int i = 0; i < n; ++i) {
        std::cin >> a;
        vec.push_back(a);
    }
    std::string sep {""};
    for (int i = n - 1; i >= 0; --i) {
        std::cout << sep << vec[i];
        sep = std::string {" "};
    }
    std::cout << std::endl;
    return EXIT_SUCCESS;
}

Measured memory_bytes: 3168
macro_rules! input {
    ($ttype:ty) => {
        {
            let mut input = String::new();
            let _= std::io::stdin().read_line(&mut input);
            input.trim().parse::<$ttype>().unwrap()
        }
    };

    ($($ttype:ty),*) => {
        {
            use std::io::BufRead;
            let mut input = String::new();
            let stdin = std::io::stdin();
            let _ = stdin.lock().read_line(&mut input);
            let mut iter = input.trim().split_whitespace();
            (
                $(iter.next().unwrap().parse::<$ttype>().unwrap(),)*
            )
        }
    };

    ($ttype:ty; $x:expr) => {
        {
            use std::io::BufRead;
            let mut input = String::new();
            let stdin = std::io::stdin();
            let _ = stdin.lock().read_line(&mut input);
            let v: Vec<$ttype> = input
                .trim()
                .split_whitespace()
                .map(|x| x.parse().unwrap())
                .collect();
            v
        }
    };

    ($ttype:ty; $x:expr; $y:expr) => {
        {
            use std::io::BufRead;
            let mut matrix = Vec::with_capacity($y);
            for _ in 0..$y {
                let mut input = String::new();
                let stdin = std::io::stdin();
                let _ = stdin.lock().read_line(&mut input);
                let v: Vec<$ttype> = input
                    .trim()
                    .split_whitespace()
                    .map(|x| x.parse().unwrap())
                    .collect();
                matrix.push(v);
            }
            matrix
        }
    };
}

fn main() {
    let (x, y) = input!(i64, i64);

    // for i in 1..(y as u32) {
        // if x * 2_i64.pow(i - 1) > y {
            // println!("{}", i - 1);
            // break;
        // }
    // }
    let mut i: u32 = 1;
    while x * 2_i64.pow(i - 1) <= y {
        i += 1;
    }
    println!("{}", i - 1);
}

Measured memory_bytes: 4352
import java.util.Scanner;

class Main{
	public static void main(String[] args) {
		Scanner sc=new Scanner(System.in);
		int A=sc.nextInt();
		int B=sc.nextInt();
		int C=sc.nextInt();
		if(A<=C && C<=B) {
			System.out.println("Yes");
		}
		else {
			System.out.println("No");
		}
	}
}

Measured memory_bytes: 21972
#include <iostream>
#include <algorithm>
#include <bitset>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#include <complex>
#include <string.h>
#include <numeric>
using namespace std;

//#define int long long
#define reps(i,s,n) for(int (i)=(s);(i)<(n);++(i))
#define rep(i,n) reps(i,0,n)
#define rept(i,n) rep(i,(n)+1)
#define repst(i,s,n) reps(i,s,(n)+1)
#define reprt(i,n,t) for(int (i)=(n);(i)>=(t);--(i))
#define repr(i,n) reprt(i,n,0)
#define each(i,v) for(auto &(i):(v))
#define eachr(i,v) for(auto &(i)=(v).rbegin();(i)!=(v).rend();(i)++)
#define all(c) (c).begin(),(c).end()
#define rall(c) (c).rbegin(),(c).rend()
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define tmax(x,y,z) max(x,max(y,z))
#define tmin(x,y,z) min(x,min(y,z))
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)
#define ln '\n'
#define bln(i,n) (((i)==(n)-1)?'\n':' ')
#define dbg(x) cout<<#x" = "<<(x)<<ln<<flush
#define dbga(x,n) {cout<<#x" : ";for(int (i)=0;i<(n);++i){cout<<((x)[i])<<(i==((n)-1)?'\n':' ')<<flush;}}
#define zero(a) memset(a,0,sizeof(a))
#define unq(a) sort(all(a)),a.erase(unique(all(a)),a.end())
#define endl "\n"

//typedef complex<double> P;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<string> vst;
typedef vector<pii> vpii;
typedef vector<pll> vpll;
typedef vector<vector<int> > mat;

const ll inf = (ll)1e9+10;
const ll linf = (ll)1e18+10;
const ll mod = (ll)(1e9+7);
const int dx[] = {0, 1, 0, -1};
const int dy[] = {1, 0, -1, 0};
const int ddx[] = {0, 1, 1, 1, 0, -1, -1, -1};
const int ddy[] = {1, 1, 0, -1, -1, -1, 0, 1};
const double eps = 1e-10;

ll mop(ll a,ll b,ll m=mod) {ll r=1;a%=m;for(;b;b>>=1){if(b&1)r=r*a%m;a=a*a%m;}return r;}
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;}
bool ool(int x,int y,int h,int w) {return((x<0)||(h<=x)||(y<0)||(w<=y));}
bool deq(double a,double b) {return abs(a-b)<eps;}

struct oreno_initializer {
    oreno_initializer() {
        cin.tie(0);
        ios::sync_with_stdio(0);
    }
} oreno_initializer;



// Aで終わる個数がX Bで始まる個数がYとすると
// sum(AB) + min(X,Y)　じゃない
// 両方満たすのはZとすると
//
int n, sum, x, y, z;
string s;

signed main() {
    cin >> n;
    rep(i,n) {
        cin >> s;
        int m = s.size();
        rep(i,m-1) if (s[i]=='A' && s[i+1]=='B') sum++;
        bool X = 0, Y = 0;
        if (s[m-1]=='A') X = 1;
        if (s[0]=='B') Y = 1;

        if (X && Y) z++;
        else if (X || Y) (X ? x : y)++;
    }
    // zは真ん中で連結が最善
    // x,yも1個ずつだけ連結可能
    if (z) {
        sum += z-1;
        if (x) sum++, x--;
        if (y) sum++, y--;
    }
    sum += min(x, y);
    cout << sum << endl;
}


Measured memory_bytes: 256
#include<stdio.h>
int main(){
    long long int h,w;
    scanf("%llu %llu",&h,&w);
    if((h*w%2==0)&&(h!=1)&&(w!=1)){
        long long int x=h*w/2;
        printf("%llu\n",x);
    }else if((h*w%2!=0)&&(h!=1)&&(w!=1)){
        long long int x=h*w/2+1;
        printf("%llu\n",x);
    }else{
        printf("1\n");
    }
}

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

int main() {
	int n;
	cin >> n;
	vector<ll> s(n);
	rep(i,n) cin >> s[i];
	sort(s.rbegin(), s.rend());
	ll ans = 0;
	if(n % 2 == 0) {
		int t = n / 2;
		rep(i,t) ans += s[i];
		rep(i,t-1) ans += s[i+1];
	}
	else {
		int t = n / 2;
		rep(i,t) ans += s[i];
		rep(i,t) ans += s[i+1];
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 4828
#include<bits/stdc++.h>
using namespace std;
int main()
{
    long long a,b,c,k,ans=0;
    cin>>a>>b>>c>>k;
    if(a>=k)
    {
        cout<<k;
        return 0;
    }
    if(a+b>=k)
    {
        cout<<a;
        return 0;
    }
    cout<<a-(k-(a+b));
    return 0;
}

Measured memory_bytes: 3640
import sys
from collections import deque, defaultdict
import copy
import bisect
sys.setrecursionlimit(10 ** 9)
import math
import heapq
from itertools import product, permutations,combinations
import fractions
from operator import itemgetter

import sys
def input():
	return sys.stdin.readline().strip()


S = input()

N = len(S) + 1

min_list = deque()
max_list = []
num = [-1]*N
if S[0] == "<":
	min_list.append(1)
	num[0] = 0
if S[-1] == ">":
	min_list.append(N - 2)
	num[N - 1] = 0
for i in range(1, N - 1):
	if S[i - 1] == ">" and S[i] == "<":
		min_list.append(i - 1)
		min_list.append(i + 1)
		num[i] = 0
	if S[i - 1] == "<" and S[i] == ">":
		max_list.append(i)

while len(min_list) > 0:
	x = min_list.popleft()
	if x == 0:
		num[x] = num[x + 1] + 1
	elif x == N - 1:
		num[x] = num[x - 1] + 1
	elif not (S[x - 1] == "<" and S[x] == ">"):
		num[x] = max(num[x - 1], num[x + 1]) + 1
		if num[x - 1] == -1:
			min_list.append(x - 1)
		if num[x + 1] == -1:
			min_list.append(x + 1)

for x in max_list:
	num[x] = max(num[x - 1], num[x + 1]) + 1

print(sum(num))

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

int main(){
	string str;
	int s=0,len;
	cin>>str;
	len = str.size()-1;
	int ans = 0;
	while(s<len){
		if(str[s] != str[len])ans++;
		s++;len--;
	}

	cout<<ans<<endl;
}

Measured memory_bytes: 256
#include<stdio.h>
main(){
  int s=0,H=0,M=0;
  scanf("%d",&s);
  while(s>3599){
    s=s-3600;
    H++;
  }
  while(s>59){
    s=s-60;
    M++;
  }
  printf("%d:%d:%d\n",H,M,s);
  return 0;
}

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

int main() {
  string s;
  cin >> s;
  bool flag1 = (s.size() % 2 == 0);
  bool flag2 = (s[0] == s[s.size() - 1]);
  if ((flag1 && !flag2) || (!flag1 && flag2)) {
    cout << "Second" << endl;
  } else {
    cout << "First" << endl;
  }
  return 0;
}


Measured memory_bytes: 512
def is_stable(before_sort, after_sort):
    current_num = 0
    same_number_card = list()
    for num in after_sort:
        if current_num == int(num[1]):
            for same_card in same_number_card:
                if before_sort.index(same_card) > before_sort.index(num):
                    return False
            same_number_card.append(num)
        else:
            current_num = int(num[1])
            same_number_card = [num,]
    return True

def partition(A, p, r):
    x = A[r][1]
    i = p - 1
    for j in range(p, r):
        if A[j][1] <= x:
            i += 1
            A[i], A[j] = A[j], A[i]
    A[i+1], A[r] = A[r], A[i+1]
    return i + 1

def quicksort(A, p, r):
    if p < r:
        q = partition(A, p, r)
        quicksort(A, p, q-1)
        quicksort(A, q+1, r)

if __name__ == '__main__':
    n = int(input())
    cards = list()
    for i in range(n):
        card = input().split()
        card[1] = int(card[1])
        cards.append(card)
    before_cards = list(cards)
    quicksort(cards, 0, n-1)
    print('Stable') if is_stable(before_cards, cards) else print('Not stable')
    for card in cards:
        print(*card)

Measured memory_bytes: 29988
#include <bits/stdc++.h>
#define FI first
#define SE second
#define EPS 1e-9
#define ALL(a) a.begin(),a.end()
#define SZ(a) int((a).size())
#define MS(s, n) memset(s, n, sizeof(s))
#define FOR(i,a,b) for (int i = (a); i <= (b); i++)
#define FORE(i,a,b) for (int i = (a); i >= (b); i--)
#define FORALL(it, a) for (__typeof((a).begin()) it = (a).begin(); it != (a).end(); it++)
#define WHATIS(x) cout << #x << " is " << x << endl;
#define ERROR(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }
//__builtin_ffs(x) return 1 + index of least significant 1-bit of x
//__builtin_clz(x) return number of leading zeros of x
//__builtin_ctz(x) return number of trailing zeros of x

using namespace std;
using ll = long long;
using ld = double;
typedef pair<int, int> II;
typedef pair<II, ll> III;
typedef complex<ld> cd;
typedef vector<cd> vcd;

void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
    cout << *it << " = " << a << endl;
    err(++it, args...);
}

const ll MODBASE = 1000000007LL;
const int MAXN = 310;
const int MAXM = 35;
const int MAXK = 510;
const int MAXQ = 200010;

int n, m, a[110];

int main() {
    ios::sync_with_stdio(0);
    cin.tie(nullptr);
    cin >> n >> m;
    FOR(i,1,n) cin >> a[i];
    FOR(i,1,n) a[i] = a[i-1] + a[i];
    int res = 0;
    FOR(i,0,n)
        if (a[i] <= m) res++;
    cout << res;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
int main() {
    string s;
    cin>>s;
    ll n = s.size();
    for(int i=1;i<n;i++) {
        if(s[i] == s[i-1]) {
            cout<<i-1+1<<" "<<i+1<<"\n";
            return 0;
        } else if(i > 1) {
            if(s[i] == s[i-2]) {
                cout<<i-2+1<<" "<<i+1<<"\n";
                return 0;
            }
        }
    }
    cout<<-1<<" "<<-1<<"\n";
    return 0;
}

Measured memory_bytes: 512
#include<bits/stdc++.h> 
using namespace std;
using ll=long long;
typedef pair<ll,ll> P;
#define fi first
#define se second
#define all(v) (v).begin(),v.end()
const ll inf=(1e18);
const ll mod=1000000007;
const ll mod2=998244353;
ll gcd(ll a,ll b) {return b ? gcd(b,a%b):a;}
ll lcm(ll c,ll d){return c/gcd(c,d)*d;}
//ios_base::sync_with_stdio(false);
//cin.tie(NULL);
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(){
ios_base::sync_with_stdio(false);
cin.tie(NULL);
ll n,a,b;
cin>>n>>a>>b;
vector<ll> s(n);
for(int i=0;i<n;i++)cin>>s[i];
ll sum=0;
for(int i=1;i<n;i++){
    if((s[i]-s[i-1])*a<b)sum+=(s[i]-s[i-1])*a;
    else sum+=b;
}
cout<<sum<<endl;
}

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

using namespace std;

using ll = long long;
using P = pair<ll, ll>;
using Graph = vector<vector<ll>>;
#define rep(i, n) for(ll i=0;i<(ll)(n);i++)
#define rep2(i, m, n) for(ll i=m;i<(ll)(n);i++)
#define rrep(i, n, m) for(ll i=n;i>=(ll)(m);i--)
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
const int ddx[8] = {0, 1, 1, 1, 0, -1, -1, -1};
const int ddy[8] = {1, 1, 0, -1, -1, -1, 0, 1};
const ll MOD = 1000000007;
const ll INF = 1000000000000000000L;
#ifdef __DEBUG

/**
 * For DEBUG
 * https://github.com/ta7uw/cpp-pyprint
 */
#include "cpp-pyprint/pyprint.h"

#endif

void Main() {
    ll N; cin >> N;
    vector<ll> V(N), C(N);
    ll ans = 0;
    rep(i, N){cin >> V.at(i);}
    rep(i, N){cin >> C.at(i);}
    rep(i, N){
        ll diff = V.at(i) - C.at(i);
        if (diff > 0){ans += diff;}
    }
    cout << ans << endl;
}

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    Main();
    return 0;
}


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

#include<cstdio>
#define r(i,n) for(int i=0;i<n;i++)

int main(void){
  int x,maxi=1;
  cin>>x;
  for(int i=2;i*i<=x;i++){
    for(int j=i*i;j<=x;j*=i){
      maxi=max(maxi,j);
    }
  }
  cout<<maxi<<endl;

return 0;}


Measured memory_bytes: 256
use std::io;

fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    let mut n = String::new();
    io::stdin().read_line(&mut n).unwrap();
    n.trim()
        .split_whitespace()
        .map(|e| e.parse().ok().unwrap())
        .collect()
}

fn main() {
    let x: Vec<u32> = read_vec();
    let mut count = 0;
    for i in x[0]..x[1] + 1 {
        if x[2] % i == 0 {
            count += 1;
        }
    }
    println!("{}", count);
}



Measured memory_bytes: 5024
{-# LANGUAGE BangPatterns #-}

module Main
  ( main
  )
where

import           Control.Applicative
import           Control.Monad
import           Data.Bits
import qualified Data.ByteString.Char8         as BS
import           Data.Char
import           Data.List
import           Data.Maybe
import qualified Data.Vector                   as V
import qualified Data.Vector.Mutable           as MV
import           Control.Monad.ST
import           Data.Ord
import qualified Data.Vector.Unboxed           as UV

parse = fst . fromJust
parseInt = parse . BS.readInt
parseInteger = parse . BS.readInteger
readInt = parseInt <$> BS.getLine
readInteger = parseInteger <$> BS.getLine
readIntList = map parseInt . BS.words <$> BS.getLine
readIntegerList = map parseInteger . BS.words <$> BS.getLine

main = do
  [a, b] <- readIntList
  putStrLn $ if a < b then [intToDigit a | i <- [1..b]] else [intToDigit b | i <- [1..a]]


Measured memory_bytes: 380
using System;
using System.Linq;
using System.Collections.Generic;
using System.IO;
using static System.Console;

namespace atcorder2
{
    class Program
    {
        public static long Read()
        {
            return long.Parse(Console.ReadLine());
        }

        public static long[] Reads()
        {
            return Console.ReadLine().Split().Select(long.Parse).ToArray();
        }


        public static long gcd(long x, long y)
        {
            if (y < x) gcd(y, x);
            while (y != 0)
            {
                var z = x % y;
                x = y;
                y = z;
            }
            return x;
        }
        public static long keta(long x)
        {
            var z = 1;
            while (x > 0)
            {
                x /= 10;
                z++;
            }
            return z;
        }
        static void Main(string[] args)
        {
            var sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
            Console.SetOut(sw);

            var abc = Reads();
            var a = abc[0];
            var b = abc[1];
            var c = abc[2];
            var f = false;
            for (int i = 0; i < b; i++)
            {
                if (a * i % b == c) f = true;
            }
            WriteLine(f ? "YES" : "NO");
            

            Console.Out.Flush();
        }
    }
}



Measured memory_bytes: 19032
#include <iostream>
//#include <iomanip>
using namespace std;

int main(){

	int H, W;

	while(1){
		cin >> H >> W;
		if(H == 0 && W == 0){
			break;
		}
		for(int i = 0; i < H; i++){
			for(int j = 0; j < W; j++){
				cout << "#";
			}
			cout << endl;
		}
		cout << endl;
	}

	return 0;
}

Measured memory_bytes: 1152
#include <iostream>
#include <string>
using namespace std;
 
int main() {
  string S,ans;
  cin >> S;
  int S_len = S.size();
  string Str = to_string(S_len-2);
  cout << S.at(0) << Str << S.at(S_len-1) << endl;
}

Measured memory_bytes: 3604
# coding: utf-8
# Your code here!
S=list(input())[::-1]

count=0
temp=[]
pre=[]
while len(S)>3:
    temp.append(S.pop(-1))
    if temp==pre:
        temp.append(S.pop(-1))
    pre.clear()
    pre+=temp
    temp.clear()
    count+=1
#print(S[::-1])
if len(S)==3:
    if pre[-1]==S[2] or S[2]==S[1] or S[1]==S[0]:
        print(count+2)
    else:
        print(count+3)
else:
    if S[1]==S[0]:#aabbaが出来ればよい
        print(count+1)
    else:
        print(count+2)


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

int main(){
	int a,b;
	cin>>a>>b;
	rep(i,100000){
		int c=i*0.08;
		int d=i*0.10;
		if(a==c&&b==d){
			puts(i);
			return 0;
		}
	}
	puts(-1);
}


Measured memory_bytes: 256
#18:37
n,k = map(int,input().split())
a = list(map(int,input().split()))
now = 2 ** len(bin(k)[2:])
can = 0
while now:
  tmp = 0
  for i in range(n):
    if a[i] ^ now > a[i]:
      tmp += 1
  if tmp * 2 > n:
    can += now
    if can > k:
      can -= now
  now //= 2
ans = 0
for i in range(n):
  ans += a[i] ^ can
#print(can)
print(ans)

Measured memory_bytes: 69136
#include<iostream>
#include<cstring>
#include<cmath>
#include<algorithm> 
using namespace std;
int a,b,n,d;
bool sc(int x)
{
	int s=0,y;
	while(x)
	{
	s=s+(x%10);	
	x/=10;
	}
	if(s>=a&&s<=b)return 1;
	else return 0;
}
int main()
{
	cin>>n>>a>>b;
	for(int i=1;i<=n;i++)
	{
		if(sc(i))d+=i;
	}
	cout<<d;
	return 0;
} 

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

using namespace std;

using ll = long long;
using ld = long double;

const double PI = 3.1415926535897932384626433832795;

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

int gcd(int x, int y) { return y ? gcd(y, x % y) : abs(x); }
ll gcd(ll x, ll y) { return y ? gcd(y, x % y) : abs(x); }
int lcm(int x, int y) { return x / gcd(x, y) * y; }
ll lcm(ll x, ll y) { return x / gcd(x, y) * y; }

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

	int n;
	cin >> n;

	vector<int> v(n);
	for (auto &a : v) {
		cin >> a;
	}

	vector<int> c(n);
	for (auto &a : c) {
		cin >> a;
	}

	int ans = 0;
	for (int i = 0; i < n; i++) {
		int cost = v[i] - c[i];
		if (cost > 0) {
			ans += cost;
		}
	}

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


Measured memory_bytes: 256
import java.util.Scanner;
import java.util.*;
 public class Main{
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
int n =sc.nextInt();
int k = sc.nextInt();
int[] arr = new int[n];
for(int i = 0;i<n;i++){
arr[i]=  sc.nextInt();

}
Arrays.sort(arr);
int sum =0;
for(int i=0;i<k &&i<n;i++){
sum+=arr[i];
}
System.out.println(sum);
        sc.close();
    }
}

Measured memory_bytes: 38972
#include <bits/stdc++.h>
using namespace std;
using int64 = long long;
#define int int64
#define rep(i, n) for(int i=0; i<n; i++)
#define FOR(i, a, b) for(int i=a; i<b; i++)
#define SORT(x) sort(x.begin(), x.end())
#define GSORT(x) sort(x.begin(), x.end(), greater<int>())
#define mk make_pair
#define fi first
#define se second
#define pb push_back
#define ALL(x) x.begin(), x.end()
#define V(T) vector<T>
typedef pair<int, int> P;
typedef pair<P, P> PP;
typedef vector<int> vi;
typedef vector<vi> vvi;
int max(int a, int b) {if(b>a) return b; else return a;}
int min(int a, int b) {if(b<a) return b; else return a;}


signed main() {
    string s = "1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51";
    reverse(ALL(s));
    int k;
    cin >> k;
    
    vi nums;
    int mul = 1;
    int temp = 0;
    rep(i, s.size()) {
        if(s[i]>='0' && s[i]<='9') {
            temp += (s[i]-'0')*mul;
            mul*=10;
        } else if(s[i]==',') {
            nums.pb(temp);
            mul = 1;
            temp = 0;
        }
    }
    if(temp) nums.pb(temp);

    reverse(ALL(nums));

    cout << nums[k-1] << endl;
    

    
    return 0;
}

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

int solve(string a, string b, int i,int j, vector<vector<int>>&dp){
    if(i==a.length() || j == b.length())
    return 0;
    if(dp[i][j] !=-1)
    return dp[i][j];
    if(a[i] == b[j]){
        dp[i][j] = solve(a,b,i+1,j+1,dp) + 1;
    }
    else{
        dp[i][j] = max(solve(a,b,i+1,j,dp), solve(a,b,i,j+1,dp));
    }
    return dp[i][j];
}

int main() {
    // int t;
    // cin>>t;
    // while(t--){
    // int n , m;
    // cin>>n>>m;
    string a, b;
    cin>>a>>b;
    vector<vector<int>> dp(a.length() + 1, vector<int>(b.length() + 1, 0));
    for (int i = 1; i <= a.length(); i++) {
		for (int j = 1; j <= b.length(); j++) {
			if (a[i - 1] == b[j - 1])
				dp[i][j] = 1 + dp[i - 1][j - 1];
			else
				dp[i][j] = max(dp[i - 1][j], dp[i][j - 1]);
		}
	}
    //cout<<solve(a,b,0,0,dp);
    
    int len = dp[a.length()][b.length()];
    // for(auto r : dp){
    //     for(int val : r){
    //         cout<<val<<" ";
    //     }
    //     cout<<"\n";
    // }
    //cout<<"\n";
    //}
    string res="";
    int i=a.length(),j=b.length();
    while(len){
        if(a[i-1] == b[j-1]){
            res.push_back(a[i-1]);
            i--;j--;
            len--;
        }
        else if (dp[i - 1][j] == len) {
			i--;
		}
		else {
			j--;
		}
    }
    cout<<string(res.rbegin(), res.rend());
    
    
	return 0;
}

Measured memory_bytes: 38624
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <set>
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include <cstdio>
#include <cstring>
#include <iterator>
#include <bitset>
#include <unordered_set>
#include <unordered_map>
#include <fstream>
#include <iomanip>
#include <cassert>
#include <utility>
#include <memory>
#include <functional>
#include <deque>
#include <cctype>
#include <ctime>
#include <numeric>
#include <list>
#include <iomanip>

#if __cplusplus >= 201103L
#include <array>
#include <tuple>
#include <initializer_list>
#include <forward_list>

#define cauto const auto&
#else

#endif

using namespace std;


typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

typedef vector<int> vint;
typedef vector<vector<int> > vvint;
typedef vector<long long> vll;
typedef vector<vector<long long> > vvll;

#define VV(T) vector<vector< T > >

template <class T>
void initvv(vector<vector<T> > &v, int a, int b, const T &t = T()){
    v.assign(a, vector<T>(b, t));
}

template <class F, class T>
void convert(const F &f, T &t){
    stringstream ss;
    ss << f;
    ss >> t;
}

#define GET_MACRO(_1, _2, _3, NAME, ...) NAME
#define _rep(i,n) _rep2((i),0,(n))
#define _rep2(i,a,b) for(int i=(a);i<(b);++i)
#define rep(...) GET_MACRO(__VA_ARGS__, _rep2, _rep)(__VA_ARGS__)
#define ALL(v) (v).begin(),(v).end()
#define PB push_back
#define fi first
#define se second
#define mkp make_pair
#define DEBUG
#ifdef DEBUG
#define dump(x)  cout << #x << " = " << (x) << endl;
#define debug(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
#else
#define dump(x) 
#define debug(x) 
#endif

#define MOD 1000000007LL
#define EPS 1e-8
#define INF 0x3f3f3f3f
#define INFL 0x3f3f3f3f3f3f3f3fLL
#define maxs(x,y) x=max(x,y)
#define mins(x,y) x=min(x,y)

// Mod int
// const int MOD = 1000000007;
struct mint{
    ll x;
    mint():x(0){}
    mint(ll x):x((x%MOD+MOD)%MOD){}
    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;}
    bool operator==(const mint& a)const{ return x == a.x;}
    friend ostream& operator<<(ostream& os, const mint& mi)  
    {  
        os << mi.x;  
        return os;  
    }
};

void mainmain(){
	ll n,m;
	cin>>n>>m;
	ll nn = n, mm = m;
	mint a(1);
	mint b(1);
	if(abs(n-m)>=2){
		cout<<0<<endl;
		return;
	}
	while(n){
		a *= mint(n);
		n--;
	}
	while(m){
		b *= mint(m);
		m--;
	}
	mint ans(0);
	if(nn>=mm){
		ans += a*b;
	}
	if(mm>=nn){
		ans += a*b;
	}
	cout<<ans<<endl;
}


signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout<<fixed<<setprecision(20);
    mainmain();
}

Measured memory_bytes: 256
# include <bits/stdc++.h>
# define ll int64_t
# define rep(i,n) for(ll i=0;i<n;i++)
# define rrep(i,n) for(ll i=1;i<=n;i++)
# define ALL(x) (x).begin(), (x).end()
# define SZ(x) ((int)(x).size())
# define pb push_back
# define mod 1000000007

using namespace std;

bool compare_by_b(pair<string,ll> a,pair<string,ll> b){
    if(a.second != b.second) return a.second<b.second;
    else return a.first<b.first;
}

bool my_compare(pair<string,ll> a,pair<string,ll> b){
    
    if(a.first != b.first) return a.first<b.first;
    if(a.second != b.second) return a.second>b.second;
    else return true;
}

ll factorial(ll n){
    ll x=1;
    rrep(i,n) x *= i;
    return x;
}

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

ll lcm(ll a, ll b)
{
   return a / gcd(a, b) * b;
}

int main(){
    ll n,m;
    cin>>n>>m;
    cout<<n*(n-1)/2 + m*(m-1)/2<<endl;
    return 0;
}

Measured memory_bytes: 256
n, m = map(int, input().split())
if m == 0:
  print(0, 0)
else:
  wa_dic = {}
  ac_dic = {}
  for _ in range(m):
    p, s = input().split()
    if s == 'WA' and (p not in ac_dic):
      if p in wa_dic:
        wa_dic[p] += 1
      else:
        wa_dic[p] = 1
    elif s == 'AC' and (p not in ac_dic):
      ac_dic[p] = 1
  ac = 0
  for v in ac_dic.values():
    ac += v
  wa = 0
  for k, v in wa_dic.items():
    if k in ac_dic:
      wa += v
  print(ac, wa)


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

using namespace std;

typedef long long ll;
typedef pair<int, int> ii;
typedef vector<ii> vii;
typedef vector<int> vi;

// Common memset settings
//memset(memo, -1, sizeof memo); // dp memoization with -1
//memset(arr, 0, sizeof arr); //clear array of integers




int main(){
	//ios::sync_with_stdio(0);
	//cin.tie(0);
	
	//freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);

	int h,w,n;

	cin >> h >> w >> n;


	if(h >= n || w >= n){
		cout << 1;
	}else{
		cout << (int)ceil(1.0*n/max(h,w));
	}
	

	return 0;
}




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

bool ap(vector<int> v) {
  int d = v[1] - v[0];
  for (int i = 1; i < v.size() - 1; i++) {
    if (d != v[i + 1] - v[i]) return false;
  }
  return true;
}

int main() {
  int n;
  while (cin >> n, n) {
    n++;
    vector<int> h(n);
    for (auto& e : h) cin >> e;
    for (int i = 0; i < n; i++) {
      if (i < n - 1 && h[i] == h[i + 1]) {
        cout << h[i] << "\n";
        break;
      }
      vector<int> v;
      for (int j = 0; j < n; j++) {
        if (i == j) continue;
        v.push_back(h[j]);
      }
      if (ap(v)) {
        cout << h[i] << "\n";
        break;
      }
    }
  }
}


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

#define _overload(_1,_2,_3,name,...) name
#define _rep(i,n) _range(i,0,n)
#define _range(i,a,b) for(int i=int(a);i<int(b);++i)
#define rep(...) _overload(__VA_ARGS__,_range,_rep,)(__VA_ARGS__)

#define _rrep(i,n) _rrange(i,n,0)
#define _rrange(i,a,b) for(int i=int(a)-1;i>=int(b);--i)
#define rrep(...) _overload(__VA_ARGS__,_rrange,_rrep,)(__VA_ARGS__)

#define _all(arg) begin(arg),end(arg)
#define uniq(arg) sort(_all(arg)),(arg).erase(unique(_all(arg)),end(arg))
#define getidx(ary,key) lower_bound(_all(ary),key)-begin(ary)
#define clr(a,b) memset((a),(b),sizeof(a))
#define bit(n) (1LL<<(n))
#define popcount(n) (__builtin_popcountll(n))

using namespace std;

template<class T>bool chmax(T &a, const T &b) { return (a<b)?(a=b,1):0;}
template<class T>bool chmin(T &a, const T &b) { return (b<a)?(a=b,1):0;}

typedef long long ll;
typedef long double R;
const R EPS=1e-9L; // [-1000,1000]->EPS=1e-8 [-10000,10000]->EPS=1e-7
inline int sgn(const R& r){return(r > EPS)-(r < -EPS);}
inline R sq(R x){return sqrt(max(x,0.0L));}

const int dx[8]={1,0,-1,0,1,-1,-1,1};
const int dy[8]={0,1,0,-1,1,1,-1,-1};
const int NMAX=100000;
int N;
vector<int> h(NMAX);
int dp[NMAX+1];

int main() {
  cin >> N;
  for(int i = 0; i < N; ++i) {
    cin >> h[i];
  }
  memset(dp, 0, sizeof(dp));
  for(int i = 0; i < N; ++i) {
    if(i == 0) dp[i] == 0;
    else if(i == 1) dp[i] = abs(h[i] - h[i-1]);
    else dp[i] = min(dp[i-1] + abs(h[i]-h[i-1]), dp[i-2] + abs(h[i] - h[i-2]));
  }
  cout << dp[N-1] << endl;

  return 0;
}


Measured memory_bytes: 1024
def main():
    import sys
    input = sys.stdin.readline
    sys.setrecursionlimit(10**7)
    from collections import Counter, deque
    #from collections import defaultdict
    from itertools import combinations, permutations, accumulate, groupby
    #from itertools import product
    from bisect import bisect_left,bisect_right
    from heapq import heapify, heappop, heappush
    from math import floor, ceil
    #from operator import itemgetter

    #inf = 10**17
    #mod = 10**9 + 7

    n = int(input())
    a = int(n**0.5)+1
    res = 10**20
    for i in range(1, a):
        if n%i==0:
            res = min(res, i+n//i)
    print(res-2)

if __name__ == '__main__':
    main()

Measured memory_bytes: 3444
#![allow(unused)]

#[allow(unused_imports)]
use std::{cmp, collections, fmt, io, iter, ops, str};
use cmp::Ordering::*;
use collections::{HashMap, HashSet};
use io::{Read, Write};

#[cfg(feature = "debug")]
macro_rules! debug {
    ($fmt: expr) => { eprintln!($fmt) };
    ($fmt: expr, $($arg: tt)*) => { eprintln!($fmt, $($arg)*) };
}

#[cfg(not(feature = "debug"))]
macro_rules! debug {
    ($fmt: expr) => {};
    ($fmt: expr, $($arg: tt)*) => {};
}

fn read_line() -> String {
    let mut buf = String::new();
    io::stdin().read_line(&mut buf).unwrap();
    buf.trim().to_owned()
}

fn read_word() -> String {
    const CAPACITY: usize = 16;

    let mut stdin = io::stdin();
    let mut byte: [u8; 1] = [0];

    loop {
        let mut buf = Vec::with_capacity(CAPACITY);

        loop {
            let res = stdin.read(&mut byte);

            if res.unwrap_or(0) == 0 || byte[0] <= b' ' {
                break;
            } else {
                buf.push(byte[0]);
            }
        }

        if buf.len() > 0 {
            return String::from_utf8(buf).unwrap();
        }
    }
}

fn parse_line<T: str::FromStr>() -> T {
    read_line().parse().ok().unwrap()
}

fn parse_word<T: str::FromStr>() -> T {
    read_word().parse().ok().unwrap()
}

fn parse_vec<T: str::FromStr>() -> Vec<T> {
    read_line()
        .split_whitespace()
        .map(|e| e.parse().ok().unwrap())
        .collect()
}

fn flush() {
    io::stdout().flush();
}

fn main() {
    let train_normal = parse_line::<i32>();
    let train_free = parse_line::<i32>();
    let bus_normal = parse_line::<i32>();
    let bus_free = parse_line::<i32>();

    let fee_min = cmp::min(train_normal, train_free) + cmp::min(bus_normal, bus_free);
    println!("{}", fee_min);
}


Measured memory_bytes: 4352
#include<map>
using namespace std;
#include<bits/stdc++.h>
int main()
{
    int n,i,ans=0,j,count=0;
    cin>>n;
    string a;
    cin>>a;
    for(i=1;i<n;i++)
    {
        if(a[i]==a[i-1])
        a[i-1]='+';
    }
    for(i=0;i<n;i++)
    {
        if(a[i]!='+')
        count++;
    }
    cout<<count;
    return 0;
}

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

namespace ABC106A
{
    class Program
    {
        static void Main(string[] args)
        {
            int a, b, c;

            var word = Console.ReadLine().Split(' ');

            a = int.Parse(word[0]);
            b = int.Parse(word[1]);

            c = a * b - (a + b - 1);

            Console.WriteLine(c);

            Console.ReadKey();
        }
    }
}


Measured memory_bytes: 11092
X,K,D=map(int,input().split())

if X<0:
    X = X*(-1)

if X- K*D >0:
    print(X-K*D)
    
elif (K - X//D)%2 == 0:
    print( X % D )

else:
    print(abs(D - X % D))
    

Measured memory_bytes: 9172
#include "bits/stdc++.h"
using namespace std;
using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using vi = vector<int>;
using vl = vector<ll>;
using vvi = vector<vi>;
using vvl = vector<vl>;
const int INF = 1 << 28;
const ll MOD = 1000000007;
template <class T>
bool chmax(T &a, const T &b) {
    return (a < b) ? (a = b, 1) : 0;
}
template <class T>
bool chmin(T &a, const T &b) {
    return (b < a) ? (a = b, 1) : 0;
}

int main() {
    ll n, T;
    cin >> n >> T;
    vl t(n);
    for (int i = 0; i < n; ++i) {
        cin >> t[i];
    }
    ll ret = T;
    for (int i = n - 2; i >= 0; --i) {
        ret += min(T, t[i + 1] - t[i]);
    }
    cout << ret << "\n";
    return 0;
}

Measured memory_bytes: 1792
#include<iostream>
#include<string>
using namespace std;
int main()
{
	string a,b;
	cin>>a>>b;
	for (int i=0;i<b.length();i++)
		cout<<a[i]<<b[i];
	if (a.length()>b.length())
		cout<<a[a.length()-1];
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < n; i++)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pi;
typedef pair<ll, ll> pl;
const double EPS = 1e-9;
const ll mod = 1000000007;
const int inf = 1 << 30;
const ll linf = 1LL << 60;
const double PI = 3.14159265358979323846;

#define MAX_V 2010

struct edge{int to; ll cap, cost; int rev; };

int V;
vector<edge> G[MAX_V];
ll h[MAX_V];
ll dist[MAX_V];
int prevv[MAX_V], preve[MAX_V];

void add_edge(int from, int to, ll cap, ll cost){
	G[from].push_back((edge){to, cap, cost, G[to].size()});
	G[to].push_back((edge){from, 0LL, -cost, G[from].size()-1});
}

ll min_cost_flow(int s, int t, ll f){
	ll res = 0;
	fill(h, h+V, 0);
	while(f > 0){	
		priority_queue<pl, vector<pl>, greater<pl> > que;
		fill(dist, dist+V, linf);
		dist[s] = 0;
		que.push(pl(0,s));
		while(!que.empty()){
			pl p = que.top(); que.pop();
			int v = p.second;
			if(dist[v] < p.first) continue;
			for(int i = 0; i < G[v].size(); i++){
				edge &e = G[v][i];
				if(e.cap > 0 && dist[e.to] > dist[v] + e.cost + h[v] - h[e.to]){
					dist[e.to] = dist[v] + e.cost + h[v] - h[e.to];
					prevv[e.to] = v;
					preve[e.to] = i;
					que.push(pl(dist[e.to],e.to));
				}
			}
		}
		if(dist[t] == linf){
			return -1;
		}
		for(int v = 0; v < V; v++) h[v] += dist[v];
		
		ll d = f;
		for(int v = t; v != s; v = prevv[v]){
			d = min(d, G[prevv[v]][preve[v]].cap);
		}
		f -= d;
		res += d*h[t];
		for(int v = t; v != s; v = prevv[v]){
			edge &e = G[prevv[v]][preve[v]];
			e.cap -= d;
			G[v][e.rev].cap += d;
		}
	}
	return res;
}

int n;

int main() {
    ll total = 0;
    cin >> n;
    V = 2*n+6;
    rep(i,n) {
        int x, y, c;
        cin >> x >> y >> c;
        add_edge(2*n, i, c, 0);
        add_edge(i, 2*n+2, c, 100*(ll)inf - x - y);
        add_edge(i, 2*n+3, c, 100*(ll)inf - x + y);
        add_edge(i, 2*n+4, c, 100*(ll)inf + x - y);
        add_edge(i, 2*n+5, c, 100*(ll)inf + x + y);
        total += c;
    }
    rep(i,n) {
        int x, y, c;
        cin >> x >> y >> c;
        add_edge(n+i, 2*n+1, c, 0);
        add_edge(2*n+2, n+i, c, 100*(ll)inf + x + y);
        add_edge(2*n+3, n+i, c, 100*(ll)inf + x - y);
        add_edge(2*n+4, n+i, c, 100*(ll)inf - x + y);
        add_edge(2*n+5, n+i, c, 100*(ll)inf - x - y);
    }
    cout << -1 * (min_cost_flow(2*n, 2*n+1, total) - 200*total*inf) << endl;
}

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

#define ll long long
#define all(x) (x).begin(), (x).end()
const long long INF = 1LL << 60;

#define rep(i, n) for (int i = 0; i < (int)(n); i++)  //(i, 10) i=0～i=9まで
#define repr(i, n) for (int i = n; i >= 0; i--)   // (i, 10) i=10～i=0まで
#define FOR(i, m, n) for (int i = m; i < n; i++)  // (i, 3, 10) i=3～i=9まで

// 総数を1000000007で割った余り
const long long mod = 1e9 + 7;

int main() {
    // cin.tie(0);
    // ios::sync_with_stdio(false);
    // cout << fixed << setprecision(5);

    // 入力
    int a, b;
    cin >> a >> b;

    // 処理
    cout << ((a == 2 || b == 2) ? "No" : "Yes") << endl;
    // 出力

    return 0;
}


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

const ll INF = 1LL << 60;

string S;
ll ans = 0;

void dfs(string tmp) {
    if (tmp.size() >= S.size()) {
        // 計算
        // cout << tmp << endl;
        ll target = stol(tmp);
        ll input = stol(S);
        // cout << input << endl;

        ll a = 0;
        if (target <= input) {
            rep(i, tmp.size()) {
                a += tmp[i] - '0';
            }
        }
        ans = max(ans, a);
        return;
    } 

    dfs(tmp + "8");
    dfs(tmp + "9");
}

int main() {
    cin >> S;

    // N: 1 の時
    if (S.size() == 1) {
        cout << S[0] << endl;
        return 0;
    }

    ll one = S[0] - '0';
    // dfs で調べる
    for (int i = one; i >= 0; i--) {
        dfs(to_string(i));
    }

    cout << ans << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <queue>
#include <stack>
#include <vector>
#include <algorithm>
#include <map>
#include <set>
#include <deque>
using lint = long long;

lint calc_gcd(lint n, lint m)
{
    lint remainder = -1;

    lint g = std::max(n, m);
    lint l = std::min(n, m);

    while (remainder != 0)
    {
        remainder = g % l;
        g = l;
        l = remainder;
    }

    return g;
}

// std::vector<std::pair<lint, lint>> prime_fact(lint n)
// {
//     std::vector<std::pair<lint, lint>> out;
//     lint divided = n;
//     for (lint i = 2; i < sqrt(n) + 1; ++i)
//     {
//         lint index = 0;
//         while (divided % i == 0)
//         {
//             index++;
//             divided /= i;
//         }
//         if (index)
//             out.push_back(std::make_pair(i, index));
//     }
//     return out;
// }

lint prime_fact(lint n)
{
    lint out = 0;
    lint divided = n;
    for (lint i = 2; i < static_cast<lint>(sqrt(n)) + 1; ++i)
    {
        lint index = 0;
        while (divided % i == 0)
        {
            index++;
            divided /= i;
        }
        if (index)
            out++;
    }
    if (divided != 1)
        out++;
    return out;
}

int main()
{
    lint a, b;
    scanf("%lld", &a);
    scanf("%lld", &b);

    lint gcd = calc_gcd(a, b);
    lint ans = prime_fact(gcd) + 1;

    printf("%lld", ans);
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define fi first
#define se second
#define show(x) cerr<<#x<<"="<<x<<"\n"
typedef long long ll;
template<typename T>
void print_to(std::ostream &os,const char *,const char *tail,const T &fst){
  os<<fst<<tail;
}
template<typename Fst,typename... Rst>
void print_to(std::ostream &os,const char *del,const char *tail,const Fst &fst,const Rst &... rst){
  os<<fst<<del;
  print_to(os,del,tail,rst...);
}
template<typename Iter>
void print_to_(std::ostream &os,const char *del,const char *tail,Iter bgn,Iter end){
  for(Iter it=bgn;it!=end;){
    os<<*it;
    if(++it!=end)os<<del;
    else os<<tail;
  }
}
template<typename Fst,typename... Rst>
void println(const Fst &fst,const Rst &... rst){
  print_to(std::cout,"\n","\n",fst,rst...);
}
template<typename Fst,typename... Rst>
void print(const Fst &fst,const Rst &... rst){
  print_to(std::cout," ","\n",fst,rst...);
}
template<typename Iter>
void println_(Iter bgn,Iter end){
  print_to_(std::cout," ","\n",bgn,end);
}
using namespace std;
//const ll MOD=(ll)1e9+7;
//const ll inf=(ll)1e14;
const int dy[]={1,0,-1};
const int dx[]={1,0,-1};
int n,h,w;
string s;
vector<ll> v1,v2,v3,v4;
ll m;

int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.precision(10);
  cout<<fixed;
#ifdef LOCAL_DEFINE
  FILE *stream1;
  //FILE *stream2;
  stream1=freopen("in","r",stdin);
  //stream2=freopen("out","w",stdout);
  if(stream1==NULL)return 0;
  //if(stream2==NULL)return 0;
#endif
  cin>>n>>m;
  ll f=0;
  for(int i=0;i<n;i++){
    ll a,b;cin>>a>>b;
    if(i==0){
      v1.push_back(b);
      f=a;
      continue;
    }
    if(a-f==0)v1.push_back(b);
    else if(a-f==1)v2.push_back(b);
    else if(a-f==2)v3.push_back(b);
    else if(a-f==3)v4.push_back(b);
  }
  sort(v1.begin(),v1.end());
  reverse(v1.begin(),v1.end());
  sort(v2.begin(),v2.end());
  reverse(v2.begin(),v2.end());
  sort(v3.begin(),v3.end());
  reverse(v3.begin(),v3.end());
  sort(v4.begin(),v4.end());
  reverse(v4.begin(),v4.end());
  for(int i=1;i<(int)v1.size();i++){
    v1[i]=v1[i]+v1[i-1];
  }
  for(int i=1;i<(int)v2.size();i++){
    v2[i]=v2[i]+v2[i-1];
  }
  for(int i=1;i<(int)v3.size();i++){
    v3[i]=v3[i]+v3[i-1];
  }
  for(int i=1;i<(int)v4.size();i++){
    v4[i]=v4[i]+v4[i-1];
  }
  ll ans=0;
  for(int i=0;i<=(int)v1.size();i++){
    for(int j=0;j<=(int)v2.size();j++){
      for(int k=0;k<=(int)v3.size();k++){
        for(int l=0;l<=(int)v4.size();l++){
          if(f*i+(f+1)*j+(f+2)*k+(f+3)*l>m)continue;
          ll sum=0;
          if(i!=0)sum+=v1[i-1];
          if(j!=0)sum+=v2[j-1];
          if(k!=0)sum+=v3[k-1];
          if(l!=0)sum+=v4[l-1];
          ans=max(ans,sum);
        }
      }
    }
  }
  print(ans);
#ifdef LOCAL_DEFINE
  cerr<<"Time elapsed: "<<1.0*clock()/CLOCKS_PER_SEC<<"s.\n";
  fclose(stream1);
  //fclose(stream2);
#endif
  return 0;
}






Measured memory_bytes: 256
// This file is a "Hello, world!" in C++ language by GCC for wandbox.
#include <iostream>
#include <cstdlib>

using namespace std;



int main()
{
    long long N; cin >> N;
    for (int i = 1; i <= 3500; i++){
        for (int j = 1; j <= 3500; j++){
            if (4*j*i - N*j - N*i > 0){
                if ( N*i*j % (4*j*i - N*j - N*i) == 0){
                    cout << i << " " << j << " " << N*i*j / (4*j*i - N*j - N*i) << endl;
                    return 0;
                }
            }
        }
    }

}



Measured memory_bytes: 256