akhauriyash/Code-Regression huggingface dataset:
n = int(input())
A = list(map(int, input().split()))
q = int(input())
queries = []
for _ in range(q):
    b,c = map(int,input().split())
    queries.append((b,c))

all_sum = sum(A)
cnt = {}
for a in A:
    if a not in cnt:
        cnt[a] = 0
    cnt[a] += 1
    


for (b,c) in queries:
    if b in cnt:
        all_sum -= b * cnt[b]
        all_sum += c * cnt[b]
        if c not in cnt:
            cnt[c] = 0
        cnt[c] += cnt[b]
        cnt[b] = 0
    print(all_sum)

Measured memory_bytes: 31248
#include <iostream>
#include <string>
#include <algorithm>
#include <ctime>
#include <functional>
#include <vector>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <cassert>
#include <bitset>
#include <list>
#include <cstdio>
#include <stdio.h>
#include <string.h>
#include <limits.h>
#include <math.h>
#include <cmath>
#include <tuple>
#include <cassert>
#include <array>
#include <iomanip>

using namespace std;
using ll = long long;
using pii = pair<int, int>;
using ti = tuple<int, int, int>;

#define pb push_back
#define mp make_pair
#define debug(x) cerr << #x << ": " << x << endl
// #define int long long 

const double eps=1e-14;
const int mod = 1e9 + 7;
const int inf = ((1<<30)-1);
const ll linf = (1LL<<60);
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll x;
    cin >> x;
    ll tmp = 100;
    ll ans = 0;
    while(tmp < x)
    {
        tmp *= 1.01;
        ans++;
    }
    cout << ans << endl;
}


Measured memory_bytes: 3608
import sys

def solve(lis):
    if len(lis) == 1 :print lis[0] ; return 0
    l = [ (lis[i]+lis[i+1])%10 for i in xrange(len(lis)-1) ]
    solve(l)

for s in sys.stdin:
    solve([ int(e) for e in s[:-1] ])

Measured memory_bytes: 4196
n = int(input())
li = list(map(int,input().split()))
cnt = 0
for i in range(1,n-1):
    if li[i-1] < li[i] and li[i] < li[i+1]:
        cnt += 1
    elif li[i-1] > li[i] and li[i] > li[i+1]:
        cnt += 1

print(cnt)

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

using namespace std;
typedef long long int ll;
typedef long double ld;
#define REP(i, n) for(ll i = 0LL; i < (ll)(n); i++)
#define REPR(i, n) for (ll i = (ll)(n) - 1; i >= 0; i--)
#define FOR(i, n, m) for(ll i = (ll)n; i < (ll)(m); i++)
#define ALL(x) (x).begin(),(x).end()
#define MOD 1000000007
#define INF (1LL << 62)

#define PI (acos(-1))
#define PRINT(x) cout << x << endl
 
ll gcd(ll a, ll b) { return b ? gcd(b,a%b) : a;}
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }
ll countDigit(ll n) { return floor(log10(n) + 1); } 
typedef pair <ll,ll> P;
static const ll dy[4] = {0,1,0,-1}, dx[4] = {1,0,-1,0};

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

template <typename T1, typename T2> 
ostream& operator<<(ostream& os, const map<T1, T2>& m) 
{ 
    for (auto p : m) os << "<" << p.first << ", " << p.second << "> "; 
    return os; 
}

int main()
{
    ll N, K;
    cin >> N >> K;
    ll ans = min(N%K, K - N%K);
    PRINT(ans);
    return 0;
} 

Measured memory_bytes: 256
#include<cstdio>
#include<iostream>
#include<cstring>
#include<queue>
#include<vector>
#define N 100005
using namespace std;
int n,head[2*N],cnt=1,s,t,ma[N];
int d[2*N],maxflow,rt,num,ans[N];
const int inf=0x3f3f3f3f;
vector<int>v[N];
bool vis[N];
struct edge
{
	int to,nxt,siz;
}w[8*N];
void add(int x,int y,int siz)
{
	w[++cnt]=(edge){y,head[x],siz};
	head[x]=cnt;
	w[++cnt]=(edge){x,head[y],0};
	head[y]=cnt;
}
bool bfs()
{
	queue<int>q;
	memset(d,0,sizeof(d));
	q.push(s);
	d[s]=1;
	while(!q.empty())
	{
		int x=q.front();
		q.pop();
		for(int i=head[x];i;i=w[i].nxt)
		{
			int y=w[i].to;
			if(d[y]||!w[i].siz)continue;
			d[y]=d[x]+1;
			if(y==t)return 1;
			q.push(y);
		}
	}
	return 0;
}
int Dinic(int x,int flow)
{
	if(x==t)return flow;
	int rest=flow;
	for(int i=head[x];i&&rest;i=w[i].nxt)
	{
		int y=w[i].to;
		if(d[y]!=d[x]+1||!w[i].siz)continue;
		int k=Dinic(y,min(w[i].siz,rest));
		if(!k)d[y]=0;
		w[i].siz-=k;
		w[i^1].siz+=k;
		rest-=k;
	}
	return flow-rest;
}
void dfs(int x)
{
	num++;
	for(int i=0;i<(int)v[x].size();i++)
	{
		if(vis[v[x][i]])continue;
		vis[v[x][i]]=1,ans[v[x][i]]=x;
		dfs(ma[v[x][i]]);
	}
}
int main()
{
	scanf("%d",&n);
	s=2*n+1,t=s+1;
	for(int i=1;i<=n;i++)add(s,i,1);
	for(int i=1;i<n;i++)
	{
		int k;
		scanf("%d",&k);
		add(n+i,t,1);
		for(int j=1,x;j<=k;j++)
		{
			scanf("%d",&x);
			v[x].push_back(i);
			add(x,n+i,1);
		}
	}
	while(bfs())maxflow+=Dinic(s,inf);
	if(maxflow!=n-1)
	{
		puts("-1");
		return 0;
	}
	for(int x=1;x<=n;x++)
	{
		bool flag=0;
		for(int i=head[x];i;i=w[i].nxt)
			if(!w[i].siz&&n+1<=w[i].to&&w[i].to<=n+n-1)
				ma[w[i].to-n]=x,flag=1;
		if(!flag)rt=x;
	}
	dfs(rt);
	if(num!=n)
	{
		puts("-1");
		return 0;
	}
	for(int i=1;i<n;i++)
		printf("%d %d\n",ans[i],ma[i]);
	return 0;
}

Measured memory_bytes: 22644
#include <bits/stdc++.h>
using namespace std;
 
int main(){
int K;
  cin >> K;
  int count = 0;
  int gij = 0;
  for(int i = 1; i <= K; i++){
  	for(int j = 1; j <= K; j++){
    	for(int k = 1; k <= K; k++){
        	gij = gcd(gcd(i,j),k);
          	count += gij;
        }
    }
  }
  cout << count << endl;
}


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

using namespace std;

#define sim template <class c
#define ris return *this
#define dor > debug &operator<<
#define eni(x)                                                                        \
	sim > typename enable_if<sizeof dud<c>(0) x 1, debug &>::type operator<<(c i) \
	{
sim > struct rge
{
	c b, e;
};
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c *x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug
{
#ifdef LOCAL
	~debug()
	{
		cerr << endl;
	}
	eni(!=) cerr << boolalpha << i;
	ris;
} eni(==) ris << range(begin(i), end(i));
}
sim, class b dor(pair<b, c> d)
{
	ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d)
{
	*this << "[";
	for (auto it = d.b; it != d.e; ++it)
		*this << ", " + 2 * (it == d.b) << *it;
	ris << "]";
}
#else
	sim dor(const c &)
	{
		ris;
	}
#endif
}
;
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "

#define forn(i, n) for (int i = 0; i < int(n); i++)
#define rfor(n, i) for (ll i = (n - 1); i >= 0; --i)
#define all(V) V.begin(), V.end()
#define rall(V) V.rbegin(), V.rend()
#define len(V) (int)V.size()
#define ll long long
#define ld long double
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define endl '\n'
#define M_PI 3.14159265358979323846
#define EPS 1e-7

const int MAX_N = 1e5 + 7;


void solve()
{
        ll n, b, r; cin >> n >> b >> r;
        if (n % (b + r) == 0)
        {
                cout << (n / (r + b)) * b << endl;
        }
        else cout << (n / (r + b)) * b + min(b, (n % (b + r)))<< endl;
}

int main()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	solve();
}


Measured memory_bytes: 3584
{-# LANGUAGE FlexibleInstances    #-}
{-# LANGUAGE TypeSynonymInstances #-}

import           Control.Applicative
import           Control.DeepSeq
import           Control.Monad
import           Control.Monad.ST
import qualified Data.Array                  as A
import qualified Data.Array.IArray           as IA
import qualified Data.Array.IO               as AI
import qualified Data.Array.MArray           as MA
import qualified Data.Array.ST               as STA
import qualified Data.Array.Unboxed          as AU
import           Data.Bits
import qualified Data.ByteString.Char8       as BS
import           Data.Char
import qualified Data.Graph                  as G
import           Data.Int
import qualified Data.IntMap                 as IM
import qualified Data.IntSet                 as IS
import           Data.List
import qualified Data.Map.Strict             as M
import           Data.Maybe
import           Data.Ord
import qualified Data.Sequence               as SQ
import qualified Data.Set                    as S
import           Data.Time
import qualified Data.Tree                   as T
import qualified Data.Vector                 as V
import qualified Data.Vector.Mutable         as VM
import qualified Data.Vector.Unboxed         as VU
import qualified Data.Vector.Unboxed.Mutable as VUM

readInt :: IO [Int]
readInt = map (fst . fromJust . BS.readInt) . BS.words <$> BS.getLine

readInts :: Int -> IO [[Int]]
readInts n = replicateM n readInt

readInteger :: IO [Integer]
readInteger = map (fst . fromJust . BS.readInteger) . BS.words <$> BS.getLine

readIntegers :: Int -> IO [[Integer]]
readIntegers n = replicateM n readInteger

readString :: IO [String]
readString = map BS.unpack . BS.words <$> BS.getLine

readStrings :: Int -> IO [[String]]
readStrings n = replicateM n <$> readString

toPair :: [a] -> (a, a)
toPair [x, y] = (x, y)

count :: Eq a => a -> [a] -> Int
count a as = length $ filter (== a) as

put :: Show a => a -> IO ()
put = putStr . show

putLn :: Show a => a -> IO ()
putLn = print

putList :: Show a => [a] -> IO ()
putList [n] = put n
putList (n:ns) = do
  put n
  putStr " "
  putList ns

putStrList :: [String] -> IO ()
putStrList [n] = putStr n
putStrList (n:ns) = do
  putStr n
  putStr " "
  putStrList ns

main = do
  [r] <- readInt
  [g] <- readInt
  put $ r ^ 2 - g


Measured memory_bytes: 380
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;


using namespace std;

#define debug(x) cout << '>' << #x << ':' << x << endl;
#define loop(i,n) for(int i=0;i<(int)(n);i++)
#define foi(i,k,n) for(int i=(k); i<(int)(n); i+=1)
#define fod(i,n,k) for(int i=k; i>=(int)n; i-=1)
#define fast_io ios_base::sync_with_stdio(false) , cin.tie(NULL);
#define all(x) x.begin(), x.end()
#define tr(it, a) for(auto it = a.begin(); it != a.end(); it++)
#define endl "\n"

#define int long long
#define INF 0x3f3f3f3f
#define PI 3.1415926535897932384626433832795
#define MOD 1000000007

#define fir first
#define sec second
#define pb push_back
#define mp make_pair

typedef long long llint;
typedef pair<int, int> PII;
typedef vector<int> VI;
typedef vector<llint> VL;
typedef vector<string> VS;
typedef vector<PII> VII;
typedef vector<VI> VVI;
typedef map<int,int> MII;
typedef set<int> SI;
string tostr(int n) {stringstream rr;rr<<n;return rr.str();}
llint toint(string s) {stringstream ss(s); llint x; ss >> x; return x;}
//typedef tree<int, null_type, less_equal<int>, rb_tree_tag, tree_order_statistics_node_update> indexed_set;
//gp_hash_table<string, llint> table;


//int mpow(llint base, llint exp) {
  //base %= MOD;
  //llint result = 1;
  //while (exp > 0) {
    //if (exp & 1) result = ((llint)result * base) % MOD;
    //base = ((llint)base * base) % MOD;
    //exp >>= 1;
  //}
  //return result;
//}


//void makegraph(int n, int m){
	//int i, u, v;
	//while(m--){
		//cin>>u>>v;
		//u--, v--;
		//g[u].pb(v);
		//g[v].pb(u);
	//}
//}

//void dfs(int u, int par){
	//for(int v:g[u]){
		//if (v == par) continue;
		//dfs(v, u);
	//}
//}


// ------------------------------------------------------------------ILB----------------------------------------------------------------  //



void solve(){
	int n;
	cin >> n;
	VI v(n);
	loop(i, n) cin >> v[i];
	MII m;
	loop(i, n) ++m[v[i]];
	int q;
	cin >> q;
	int sum = accumulate(all(v), 0LL);
	while(q--){
		int a, b;
		cin >> a >> b;
		if(m.count(a)){
			sum -= a * m[a];
			sum += b * m[a];
			m[b] += m[a];
			m.erase(a);
		}
		cout << sum << endl;
	}
}




int32_t main() {
	fast_io;
    int t = 1;
    //cin >> t;
    //int xx = 0
    while(t--) {
		//xx++;
		//cout << "Case ";
      solve();
    }
    return 0;
}



Measured memory_bytes: 7884
#include <iostream>
#include <algorithm>
#include <vector> //動的配列
#include <string>
#include <list> //双方向リスト
#include <map> //連想配列
#include <set> //集合
#include <stack>
#include <queue>
#include <deque>
#include <cmath>
#include <bitset>
#include <numeric>



typedef long long ll;


using namespace std;

typedef pair<int, int> P;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)



ll fast_pow(ll x,ll n,ll mod){
    if (n==0) return 1;
    ll res=fast_pow(x*x %mod,n/2,mod);
    if (n&1) res=res*x%mod;
    return res;
}

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

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

//小さい順から取り出すヒープ
//priority_queue<ll, vector<ll>, greater<ll> > pque1;




int main(){
    ll n,a;
    cin>>n;
    vector<ll> vec(n),vec1(n);
    rep(i,n) {
        cin>>a;
        vec.at(i)=vec1.at(i)=a;
    }
        
    sort(vec.begin(),vec.end());
    rep(i,n){
        if (vec1[i]==vec[n-1]){
            cout<<vec[n-2]<<endl;
        }else {
            cout<<vec[n-1]<<endl;
        }
    }
    
    return 0;
    cout<<vec<<vec1<<endl;
    
}


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

int main() {
int a,b,c;
cin >> a >> b >> c;

if ( (a == 5 && b == 5 && c == 7) || (a == 5 && b == 7 && c == 5 ) || (a == 7  && b == 5 && c == 5 )){
  cout << "YES" << endl;
}

else {
cout << "NO" << endl;
}

return 0;
}



Measured memory_bytes: 256
#include<cstdio>
#include<algorithm>
#define ll long long
#define maxn 100010
int a[maxn],b[maxn];
int n;
int main()
{
	scanf("%d",&n);
	if(n==1){
		printf("0\n"); return 0;
	}
	for(int i=1;i<=n;i++)scanf("%d",&a[i]);
	std::sort(a+1,a+n+1);
	if(n&1){
		int mid=(n+1)>>1;
		b[1]=a[mid];
		if(a[mid]-a[mid-1]>a[mid+1]-a[mid]){
			for(int i=2;i<=n;i+=2)
				b[i]=a[i>>1],b[i+1]=a[n+1-(i>>1)];
		}
		else{
			for(int i=2;i<=n;i+=2)
				b[i]=a[n+1-(i>>1)],b[i+1]=a[i>>1];
		}
	}
	else{
		b[1]=a[n>>1]; b[n]=a[(n>>1)+1];
		for(int i=2;i<n;i+=2)
			b[i]=a[n-(i>>1)+1],b[i+1]=a[(i>>1)];
	}
	ll sum=0;
	for(int i=2;i<=n;i++)
		sum+=abs(b[i]-b[i-1]);
	printf("%lld\n",sum);
}

Measured memory_bytes: 1024
def get_i() #空白区切の入力を数値(整数)の配列で返す
  return gets.chomp.split(" ").map(&:to_i)
end
def get_f() #空白区切の入力を数値(実数)の配列で返す
  return gets.chomp.split(" ").map(&:to_f)
end
def get() #空白区切の入力を文字列の配列で返す
  return gets.chomp.split(" ")
end
def get_nsp() #入力されたものを一文字ずつに区切った文字列の配列で返す
  return gets.chomp.split("")
end
def yn_judge(bool,y="Yes",n="No") #boolに真偽を投げることで、trueならy、falseならnの値を出力する
  return bool ? y : n 
end
def array(size,n=1,init=nil) #nに配列の次元数、sizeに配列の大きさ、initに初期値を投げることでその配列を返す
  if n==1
    return Array.new(size){init}
  else
    return Array.new(n).map{Array.new(size){init}}
  end
end

r,c=get_i
ans=array(r+1,1)
r.times do|i|
  ans[i]=get_i
  ans[i].push(ans[i].inject(:+))
end
ans[r]=array(c,1,0)
c.times do|i|
  r.times do|j|
    ans[r][i]+=ans[j][i]
  end 
end
ans[r].push(ans[r].inject(:+))
(r+1).times do|i|
  puts ans[i].join(" ")
end


Measured memory_bytes: 7064
//#include "stdafx.h"
#include <iostream>
#include <iomanip>
#include <string>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <vector>
#include <cassert>
#include <fstream>
#include <algorithm>
#include <list>
#include <random>
#include <ctime>
#include <cmath>
#include <random>
#include <bitset>
#include <complex>

using namespace std;

typedef unsigned long long ull;
typedef long long ll;
typedef long double ld;
//#define int ll
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector< vi > vvi;
typedef vector< vvi > vvvi;
typedef vector<short> vs;
typedef vector<vs> vvs;
typedef vector<vvs> vvvs;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<vvl> vvvl;
typedef pair<ld, ld> pld;
typedef complex<double> base;

#define mmin(a, b) a = min(a, (b))
#define mmax(a, b) a = max(a, (b))
#define mp(a,b) make_pair(a,b)
#define pb(a) push_back(a)
#define ALL(a) a.begin(),a.end()
#define sqr(x) (x) * (x)
#define fori(i, n) for(int i = 0; i < int(n); ++i)
#define cint const int & 
#define SZ(a) ((int)(a.size()))
#define watch(x) cout << (#x) << " = " << x << endl;

const double PI = 2 * acos(0.0);

template<class T>
void show(const vector<T> &a) {
	for (T x : a)
		cout << x << " ";
	cout << endl;
}

const int N = 1e5 + 9;

int p[N];
vi g[N];
char used[N];
int n, m;
set<int> a;
vi b;

void dfs(int v) {
	if (used[v]) return;
	used[v] = 1;
	for (int to : g[v]) {
		dfs(to);
	}
	a.insert(v);
	b.pb(p[v]);
}
signed main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);

	cin >> n >> m;
	for (int i = 1; i <= n; ++i) {
		cin >> p[i];
	}
	fori(iter, m) {
		int u, v;
		cin >> u >> v;
		g[u].pb(v);
		g[v].pb(u);
	}
	int ans = 0;
	for (int i = 1; i <= n; ++i) if (!used[i]) {
		a.clear();
		b.clear();
		dfs(i);
		for (auto x : b) {
			//watch(x);
			if (a.count(x))
				ans++;
		}
	}
	cout << ans << endl;
}


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

using namespace std;

const int N = 1e3 + 3 , M = 1e4 + 4;
int memo[N][M];
int A[N] , B[N] , n;

int solve (int i , int rem) {
    if (rem <= 0)
        return 0;

    if (i == n)
        return 1e9;

    int &ret = memo[i][rem];
    if (~ret)
        return ret;

    return ret = min(solve(i + 1 , rem) , solve(i , rem - A[i]) + B[i]);
}

int main() {
    ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
#ifndef ONLINE_JUDGE
    freopen("input.in" , "r" , stdin);
#endif
    int h;
    cin >> h >> n;
    for (int i = 0 ;i < n ;i++)
        cin >> A[i] >> B[i];

    memset(memo , -1 , sizeof memo);
    cout << solve(0 , h);
}

Measured memory_bytes: 43292
A, B, C, D, E, F = map(int, input().split())
water = set()
sugar = set()
answer = 0.0
answer1 = [0, 0]
w, s = 0, 0
i = 0
while True:
    j = 0
    if 100 * A * i + 100 * B * j > F:
        break
    while True:
        w = 100 * A * i + 100 * B * j
        if w > F:
            break
        water.add(w)
        j += 1
    i += 1

i = 0
while True:
    j = 0
    if C * i + D * j > F:
        break
    while True:
        s = C * i + D * j
        if s > F:
            break
        sugar.add(s)
        j += 1
    i += 1

# print(water)
# print(sugar)

for i in water:
    for j in sugar:
        # print('i:{0}, j:{1}'.format(i, j))
        if i != 0:
            if E / 100 >= j / i and F >= i + j:
                if answer <= j / i:
                    answer = j / i
                    answer1 = i + j, j
                    # print('i:{0}, j:{1}, answer:{2}'.format(i, j, answer))

print(*answer1)

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

int main(){
    int x , n;
    cin >> x >> n;
    vector <int> p(n);
    int mini = 100 , ans = 127389;
    if(n == 0){
        cout << x << endl;
        return 0;
    }
    for(int i = 0; i < n; i++){
        cin >> p[i];
    }
    for(int j = 101; j >= 0; j--){
        for(int i = 0; i < n; i++){
            if(j != p[i] && abs(j - x) <= mini){
                bool a = true;
                for(int k = 0; k < n; k++){
                    if(j == p[k]){
                        a = false;
                    }
                }
                if(a){
                    mini = abs(j - x);
                    ans = j;
                }
            }
        }
    }

    cout << ans << endl;
}

Measured memory_bytes: 3632
s = list(input())
t1 = []
t2 = []
t1 = s[0:int((len(s)-1)/2)]
t2 = s[int((len(s)-1)/2)+1:]

sr = s.copy()
sr.reverse()
t1r = t1.copy()
t2r = t2.copy()
t1r.reverse()
t2r.reverse()

if s == sr and t1 == t1r and t2 == t2r:
    print("Yes")
else:
    print("No")


Measured memory_bytes: 3060
/**
 *    author:  tourist
 *    created: 25.11.2017 13:06:02       
**/
#include <bits/stdc++.h>

using namespace std;

int main() {
  vector<int> cnt(3);
  string s;
  cin >> s;
  for (char c : s) {
    cnt[(int) (c - 'a')]++;
  }
  if (abs(cnt[0] - cnt[1]) <= 1 && abs(cnt[0] - cnt[2]) <= 1 && abs(cnt[1] - cnt[2]) <= 1) {
    puts("YES");
  } else {
    puts("NO");
  }
  return 0;
}


Measured memory_bytes: 512
#include <iostream>
#include<vector>

using namespace std;

int main()
{
    int N,count=0;
    cin >> N;
    vector<long long> a(N);
    for(int i=0;i<N;i++){
        cin >> a[i];
        while(a[i]%2==0){
            count++;
            a[i]/=2;
        }
    }
    cout << count << endl;
}

Measured memory_bytes: 384
#include <iostream>

using namespace std;

#define MAX 500000
#define SENTINEL 2000000000

int L[MAX/2+2], R[MAX/2+2];
int cnt;

void merge(int A[],int n,int left, int mid, int right) {
  int n1 = mid -left;
  int n2 = right - mid;
	
  for(int i=0;i<n1;i++) L[i] = A[left + i];
  for(int i=0;i<n2;i++) R[i] = A[mid + i];
  L[n1] = R[n2] = SENTINEL;
  int i=0, j=0;
  for(int k=left; k<right; k++) {
    cnt++;
    if(L[i]<=R[j]) {
      A[k] = L[i++];
    } else {
      A[k] = R[j++];
    }
  }
}

void mergeSort(int A[],int n,int left,int right) {
  if(left+1 < right) {
    int mid = (left+right) / 2;
    mergeSort(A,n,left,mid);
    mergeSort(A,n,mid, right);
    merge(A,n,left,mid,right);
  }
}

int main(void) {
  int A[MAX], n, i;
  cnt = 0;

	cin >> n;
  for(i=0;i<n;i++) cin >> A[i];

  mergeSort(A, n, 0, n);
  for(i=0;i<n;i++) {
    if(i)cout << " ";
  	cout << A[i];
  }
  cout << endl;

  cout << cnt << endl;

  return 0;
}

Measured memory_bytes: 6980
#include <bits/stdc++.h>
using namespace std;
//int a[1000000];
long long a[30][30];
long long b[30];
int main()
{long long ans=-1;
 int n;
 cin>>n;
 long long x;
 set<long long>s;
 int n1=n;
 while(n--){
    cin>>x;
    s.insert(x);
 }
 if(s.size()==n1)cout<<"YES";
 else cout<<"NO";
}


Measured memory_bytes: 9600
main = do
    [n,a,b,c,d] <- (map read . words) <$> getLine
    putStrLn $ if solve (n-1) (b-a) (c,d) then "YES" else "NO"

solve n' k (c,d) = any f [n'*d, n'*d-(c+d) .. 0]
  where f x = x-(d-c)*n' <= abs k && abs k <= x

Measured memory_bytes: 1020
#include <iostream>
#include <random>
#include <fstream> //iostreamのファイル入出力をサポート
#include <vector>
#include <algorithm>
#include <string>
#include <math.h> 
#include <time.h>
#define FOR(i,k,n) for((i)=(k);(i)<(n);(i)++)
#define rep(i,n) for (int i=0;i<(n);i++)
#define REP(i,n) for (int i=0;i<(n);i++)
#define pb push_back
#define all(a) (a).begin(),(a).end()  //greater<int>()
#define ll long long
#define PII pair<int,int>
#define pii pair<int,int>
#define pcc pair<char,char>
#define pic pair<int,char>
#define pci pair<char,int>
#define VS vector<string>
#define vs vector<string>
#define VI vector<int>
#define vi vector<int>
using namespace std;

int main(){
	int a,b,c,ans;

	cin>>a>>b>>c;
	
	ans=10000000;
	ans=min(ans,a+b);
	ans=min(ans,a+c);
	ans=min(ans,b+c);

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


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using lint     = long long;
const lint inf = 1LL << 60;
const lint mod = 1000000007;

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    lint n, m;
    cin >> n >> m;
    if (n % 2 == 0) {
        for (int i = 0; i < m; ++i) {
            if (i < n / 4)
                cout << i + 1 << " " << n - i << endl;
            else
                cout << n / 2 - (i - n / 4) << " " << n / 2 + 2 + (i - n / 4) << "\n";
        }

    } else {
        for (int i = 0; i < m; ++i) {
            cout << i + 1 << " " << n - i << endl;
        }
    }
    return 0;
}

Measured memory_bytes: 3620
#include <bits/stdc++.h>
#define int long long
#define pb push_back
#define fi first
#define se second
using namespace std;
using pii = pair<int, int>;

signed main() {
    ios_base::sync_with_stdio(false); cin.tie(NULL);
    int d,t,s; cin>>d>>t>>s;
    cout << (d/s + (d%s ? 1 : 0) <= t ? "Yes" : "No");
    return 0;
}

Measured memory_bytes: 3596
#include <iostream>
#include <algorithm>
#include <cmath>
#include <climits>
#include <string>
#include <queue>
#include <vector>
#include <set>
#include <unordered_map>
using namespace std;

int main() {
  int N;
  set<char> S;
  cin >> N;
  int count = 0;
  for (int i = 0; i < N; i++) {
    char c;
    cin >> c;
    if (S.find(c) == S.end()) {
      count++;
    }
    S.insert(c);
  }
  cout << (count == 3 ? "Three" : "Four") << endl;
}


Measured memory_bytes: 256
// #include {{{
#include <array>
#include <vector>
#include <deque>
#include <queue>
#include <set>
#include <unordered_set>
#include <map>
#include <unordered_map>
#include <string>
#include <algorithm>
#include <numeric>
#include <functional>
#include <iterator>
#include <tuple>
#include <utility>
#include <random>
#include <limits>
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <cstdint>
#include <cassert>
// }}}

using namespace std;

// macros {{{
template<typename T, size_t N>
constexpr size_t NELEMS(T (&)[N]) { return N; }

template<typename InputIt>
void PRINT_RANGE(InputIt first, InputIt last)
{
    for(; first != last; ++first)
        cout << *first << (first==last ? "" : " ");
    cout << "\n";
}

template<typename T>
void PRINT_MATRIX(T mat, size_t nr, size_t nc)
{
    for(size_t r = 0; r < nr; ++r) {
        for(size_t c = 0; c < nc; ++c) {
            cout << mat[r][c] << (c==nc-1 ? "" : " ");
        }
        cout << "\n";
    }
}

#define FOR(i, start, end) for(int i = (start); i < (end); ++i)
#define REP(i, n) FOR(i, 0, n)
// }}}

// types {{{
using ll  = long long;
using ull = unsigned long long;
// }}}

ll X;

void solve()
{
    ll q = X / 11;
    ll r = X % 11;

    ll cnt = 2*q;
    if(r == 0) {
        ;
    }
    else if(r <= 6) {
        ++cnt;
    }
    else {
        cnt += 2;
    }

    cout << cnt << "\n";
}

int main()
{
    cin >> X;

    solve();

    return 0;
}


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

using namespace std;

int main(){
    int sx,sy,tx,ty;
    cin >> sx >> sy >> tx >> ty;
    for(int i=0;i<(ty-sy);i++){
        cout << 'U';
    }
    for(int i=0;i<(tx-sx);i++){
        cout << 'R';
    }
    for(int i=0;i<(ty-sy);i++){
        cout << 'D';
    }
    for(int i=0;i<(tx-sx);i++){
        cout << 'L';
    }
    cout << 'L';
    for(int i=0;i<(ty-sy)+1;i++){
        cout << 'U';
    }
    for(int i=0;i<(tx-sx)+1;i++){
        cout << 'R';
    }
    cout << 'D' << 'R';
    for(int i=0;i<(ty-sy)+1;i++){
        cout << 'D';
    }
    for(int i=0;i<(tx-sx)+1;i++){
        cout << 'L';
    }
    cout << 'U' << endl;
    
}

Measured memory_bytes: 256
N=int(input())
A=input()
B=input()
C=input()
num=0
for i in range(N):
    a=A[i]
    b=B[i]
    c=C[i]
    if a==b:
        if b==c:
            continue
        elif b!=c:
            num+=1
    elif a!=b:
        if b==c:
            num+=1
        elif a==c:
            num+=1
        else:
            num+=2
print(num)

Measured memory_bytes: 38384
import math
N,K = [int(i) for i in input().split()]
a = list(input().split())
m = a.index('1')
if m == 0 or m == N-1:
    print(math.ceil((N-1)/(K-1)))
else:
    res = ((K-1) - m%(K-1))%(K-1)
    print(math.ceil((m)/(K-1)) + math.ceil((N-m-1-res)/(K-1)))

Measured memory_bytes: 10740
#ifdef LOCAL
#define _GLIBCXX_DEBUG
#endif
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;++i)
#define rrep(i,n) for(int i=n-1;i>=0;--i)
#define reps(i,a,b) for(int i=a;i<b;++i)
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
#define sz(x) (int)(x).size()
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
using namespace std;
using ll = long long;
using P = pair<int, int>;
template<typename T> inline bool chmax(T &a,T b){if(a<b){a=b;return 1;}return 0;}
template<typename T> inline bool chmin(T &a,T b){if(b<a){a=b;return 1;}return 0;}
template<typename T> vector<T> make_vec(size_t a){return vector<T>(a);}
template<typename T,typename... Ts>
auto make_vec(size_t a,Ts... ts){return vector<decltype(make_vec<T>(ts...))>(a,make_vec<T>(ts...));}
template<typename T,typename U,typename... V>
typename enable_if<is_same<T,U>::value>::type fill_v(U &u,const V... v){u=U(v...);}
template<typename T,typename U,typename... V>
typename enable_if<!is_same<T,U>::value>::type fill_v(U &u,const V... v){for(auto &e:u)fill_v<T>(e,v...);}

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

    char c;
    cin >> c;
    if (isupper(c)) cout << 'A' << endl;
    else cout << 'a' << endl;
}


Measured memory_bytes: 3608
#include <bits/stdc++.h>
#define ll long long
#define PB push_back
#define MP make_pair
#define PI pair<int , int>
#define REP(i, n) for(int i=0;i<(int)(n);++i)
#define FOR(i,l,h) for(int i=(int)(l);i<=(int)(h);++i)
#define FORD(i,h,l) for(int i=(int)(h);i>=(int)(l);--i)

//#define max(a,b) a>b?a:b
//#define min(a,b) a>b?b:a

ll gcd(ll a, ll b) { return !b ? a : gcd(b, a % b); }
ll lcm(ll a, ll b) { return (a / gcd(a, b)) * b; }

#define dump(x)  cerr << #x << " = " << (x) << endl
#define ALL(t) (t).begin(),(t).end()

using namespace std;

#define error(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }

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

int sum() { return 0; }

template<typename T, typename... Args>
T sum(T a, Args... args) { return a + sum(args...); }


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

	string s;cin>>s;
	ll sum = 0;
	for (int i = 0; i < s.size(); ++i)
	{
		sum += (s[i] - '0');
	}
	if(sum % 9 == 0) cout<<"Yes\n";
	else cout<<"No\n";
    return 0;
}


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

int main() {
  int N;
  cin >> N;

  map<string, int> MA;

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

  int M;
  cin >> M;

  for (int i = 0; i < M; i++) {
    string t;
    cin >> t;
    MA[t]--;
  }

  int ans = 0;

  for (auto ma : MA) ans = max(ans, ma.second);

  cout << max(ans, 0) << "\n";
}


Measured memory_bytes: 256
def main():                                                                     
    s = raw_input()                                                             
    to_eval = [s[0]]                                                            
    buf = []                                                                    
                                                                                
    for elem in s[1:]:                                                          
        for x in to_eval:                                                       
            buf.append(x+elem)                                                  
            buf.append(x+'+'+elem)                                              
        to_eval = buf[:]                                                        
        buf = []                                                                
                                                                                
    _sum = 0                                                                    
    for x in to_eval:                                                           
        _sum += eval(x)                                                         
    print(_sum)                                                                 
                                                                                
main()

Measured memory_bytes: 2692
/**
 *    author:  math2do
 *    created: 21.11.2019 15:43:6
**/

#include <bits/stdc++.h>

using namespace std;

const int pinf = (1U << 31) - 1;


vector <int> dp;

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

  int n, k;
  cin >> n >> k;
  vector <int> h(n);
  for (int i = 0; i < n; i++) cin >> h[i];

  auto solve = [&](auto &Self, int idx) {
    if (idx == n - 1) return 0;
    if (dp[idx] != -1) return dp[idx];
    int cost = pinf;
    
    for (int i = 1; i <= k; i++) {
      int j = idx + i;
      if (j < n) {
        int ret = Self(Self, j);
        if (ret != pinf) {
          cost = min(cost, ret + abs(h[idx] - h[j]));
        }
      } 
    } 

    return dp[idx] = cost;
  };

  dp.resize(n + 2);
  fill(dp.begin(), dp.end(), -1);

  int ans = solve(solve, 0);
  cout << ans << endl;
  return 0;
}


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

int main(){
    using namespace std;
    constexpr unsigned long MOD = 1000000007;
    unsigned long K;
    cin >> K;
    string S;
    cin >> S;
    const auto& modpow = [](unsigned long a, unsigned long n, unsigned long b = 1) -> unsigned long {
        unsigned long r{b % MOD};
        while(n){
            if(n & 1)(r *= a) %= MOD;
            (a *= a) %= MOD;
            n >>= 1;
        }
        return r;
    };
    unsigned long N{S.size()};
    unsigned long ans{0}, coef{modpow(26, K)}, den{1}, num{1};
    for(unsigned long i{0}; i <= K; ++i){
        ans += modpow(den, MOD - 2, num * coef);
        (coef *= 423076927) %= MOD;
        (den *= (i + 1)) %= MOD;
        (num *= (N + i)) %= MOD;
    }
    cout << ans % MOD << endl;
    return 0;
}

Measured memory_bytes: 5252
#include<iostream>
#include<algorithm>
#include<vector>
using namespace std;
int d,G;
int p[10],c[10];
int dp[1001];
main()
{
	cin>>d>>G;
	for(int i=0;i<d;i++)cin>>p[i]>>c[i];
	for(int i=0;i<d;i++)
	{
		for(int k=1000;k>=1;k--)
		{
			for(int j=1;j<=p[i]&&j<=k;j++)
			{
				dp[k]=max(dp[k],dp[k-j]+(i+1)*100*j+(j==p[i]?c[i]:0));
			}
		}
	}
	for(int i=0;i<=1000;i++)
	{
		if(dp[i]>=G)
		{
			cout<<i<<endl;
			return 0;
		}
	}
}


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

bool graph[10][10];
bool visited[10], all_visited;//グローバル宣言すると0で初期化される
//この場合はfalse


int dfs(int v,int n) {
	visited[1] = true;//始点なので
	all_visited = true;//すべての頂点を通ったかを判別する変数
	for (int i = 1; i <= n; ++i) {
		if (visited[i] == false) {
			all_visited = false;//１つでも通っていなければダメ
		}
	}
	if (all_visited)return 1;//ここは1つの試行で（スタートからゴールまでの行き方の一つを１試行とする）1度しか判定されるチャンスがない。すなわちゴールの頂点がvと
	//なるときのdfs(それ以外ではall_visited=falseであるから)なおそのときに通り逃した頂点があると判定されない
	int sum = 0;//ゴールの頂点以外のdfsでは0,ゴールの頂点でも通り逃した頂点があるとsum=0になる。そのとき、ゴールの頂点以外の頂点でのdfsはここを通り過ぎており、
	//もう通らないからその試行での値は0、最大でも１つの試行では１しかとらないこともわかる(当たり前)
	for (int i = 1; i <= n; ++i) {
		if (visited[i])continue;
		if (graph[v][i]) {
			visited[i] = true;
			sum += dfs(i, n);
			visited[i] = false;
		}
	}
	return sum;
}

int main() {
	int n, m,a,b;
	cin >> n >> m;
	for (int i = 0; i < m; ++i) {
		cin >> a>>b;
		graph[a][b] = true;
		graph[b][a] = true;
	}
	cout << dfs(1,n) << endl;
	return 0;
}

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

bool show() {
    int x;
    static int counter = 1;
    cin >> x;
    if( x == 0 ) return false;
    cout << "Case" << " " << counter << ": " << x << endl;
    ++counter;
    return true;
}

int main() {

    while( show() ){ }
}

Measured memory_bytes: 1160
#include <iostream>
using namespace std;
int main() {
    int n, i, t1, t2, a[101], m, s = 0;
    cin >> n;
    for (i = 0; i < n; i++) {
        cin >> t1;
        a[i] = t1;
        s += t1;
    }
    cin >> m;
    for (i = 0; i < m; i++) {
        cin >> t1 >> t2;
        cout << s - a[--t1] + t2 << endl;
    }
    return 0;
}

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


int main() {

	int n;
	cin >> n;
	vi a(n);
	rep(i, n)cin >> a[i];

	int ans = -n;
	rep(i, n) ans += a[i];
	cout << ans << endl;

}

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

using namespace std;
typedef long long LL;
template <typename F, typename S> std::ostream& operator<<(ostream& os, const pair<F,S>& p) {
    os << "(" << p.first << "," << p.second << ")"; return os; }
template <typename T> ostream& operator<<(ostream& os, const vector<T>& v) {
    os << "["; for(const T& a: v){ os << a << ", "; } os << "]"; return os; }
template <typename K, typename V> ostream& operator<<(ostream& os, const map<K,V>& m) {
    os << "{"; for(const auto& p: m){ os << p.first <<":"<< p.second << ", "; } os << "}"; return os; }


int main(){
    LL k, q;
    cin >> k >> q;
    vector<LL> d(k);
    for(LL i = 0; i < k; ++i){
        cin >> d[i];
    }
    for(LL i = 0; i < q; ++i){
        LL n, x, m;
        cin >> n >> x >> m;
        vector<LL> a(k+2);
        a[0] = x % m;
        for(LL j = 1; j-1 <= k; ++j){
            a[j] = a[j-1] + d[(j-1)%k] % m;
        }
        LL n2 = (n-1) / k;
        LL r = (n-1) % k;

        LL last_val = a[0] + (a[k] - a[0]) * n2 + (a[r] - a[0]);
        LL cnt = 0;
        for(LL j = 0; j < k; ++j){
            if(a[j+1] == a[j]) cnt++;
        }
        cnt *= n2;
        for(LL j = 0; j+1 <= r; ++j){
            if(a[j+1] == a[j]) cnt++;
        }
        //cerr << a << endl;
        //cerr << "last_val=" << last_val << " " << last_val / m << " " << last_val % m << endl;
        cout << (n-1) - last_val / m - cnt  << endl;
    }
    return 0;
}



Measured memory_bytes: 764
#include <bits/stdc++.h>
#include <cstdlib>
#include <cmath>
#include <algorithm>
using namespace std;
using ll = long long;
using P = pair<int,int>;
using Graph= vector<vector<ll>>; 
#define rep(i,n) for (ll i=0; i < (n); ++i)
#define rep2(i,n,m) for(ll i=n;i<=m;i++)
#define rep3(i,n,m) for(ll i=n;i>=m;i--)
#define pb push_back
#define eb emplace_back
#define ppb pop_back
const ll INF=1e18 ;
inline void chmax(ll& a,ll b){a=max(a,b);}
inline void chmin(ll& a,ll b){a=min(a,b);}

vector<bool> seen ;
void dfs(const Graph &g,ll i){
  seen[i]=true ;//訪問済みに初期化
  for(ll u:g[i]){
   if(seen[u]) continue ;
    dfs(g,u) ;//今度はuから出発して同じ操作
  }
}


int main(){
  ll n,m  ;
  cin>> n>>m ;
  Graph g(n) ;
  rep(i,m){
    ll a,b,c ;
    cin>>a>>b>>c ;
    a--;b--;
    g[a].pb(b) ;
    g[b].pb(a) ;
  }
  int ans=0;
  seen.assign(n,false);//すべて未訪問に初期化
    rep(i,n){
      if(seen[i]) continue ;
      dfs(g,i)   ;     //iから出発するdfs
      ans++ ;          //一つのdfsが終わるたびにカウント
    }
    cout<<ans<<endl ;
    return 0;
  }

Measured memory_bytes: 10368
N,M,C = map(int, input().split())
B = list(map(int, input().split()))
count = 0
for n in range(N):
    A = list(map(int, input().split()))
    total = C
    for a,b in zip(A,B):
        total += a*b
    if total > 0:
        count += 1
print(count)

Measured memory_bytes: 3060
#include <bits/stdc++.h>
 
#define ALL(l)  (l).begin(),(l).end()
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
using namespace std;
typedef long long ll;
ll mod =  1000000007;
ll maxn = 1000000000;
 
//---------------------------------------------------------------------------------------------------
using vi = vector<int>; // intの1次元の型に vi という別名をつける
using vll = vector<ll>; // intの1次元の型に vi という別名をつける
using vvi = vector<vi>; // intの2次元の型に vvi という別名をつける
using vs = vector<string>; // stringの1次元の型に vs という別名をつける
using pll = pair<ll, ll>; // これ以降 pii という型名はpair<ll, ll> と同じ意味で使える
//---------------------------------------------------------------------------------------------------
 
int main(){
    ll n,m;
    cin>>n>>m;
    //vll a(n);
    vector<bool> a(n+1);
    rep(i,n)a.at(i+1)=false;
   rep(i,m){
       ll k;
       cin>>k;
       a.at(k)=true;
   }
    
   vll dp(n+1);
   
   
   
       dp.at(0)=1;

       if(a.at(1)){
           dp.at(1)=0;
           
       }
       else dp.at(1)=1;
       
       
       for(ll i=2;i<=n;i++){
           if(a.at(i)){
               dp.at(i)=0;
           }else{
               dp.at(i)=dp.at(i-1)+dp.at(i-2);
               dp.at(i)=dp.at(i)%mod;
           }
       }
       
       cout<<dp.at(n)<<endl;
   }
   



Measured memory_bytes: 1024
N,M=[int(i) for i in input().split(" ")]
H=[int(i) for i in input().split(" ")]


tenboudai=[True for i in range(N)]

for _ in range(M):
    A,B=[int(i) for i in input().split(" ")]
    A-=1
    B-=1
    if H[A]>=H[B]:
        tenboudai[B]=False
    if H[A]<=H[B]:
        tenboudai[A]=False


print(sum(tenboudai))


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

#define endl '\n' ;

using namespace std;

void quick () {
    cin.tie(0);
    cout.tie(0);
    ios_base::sync_with_stdio(0);
}

int main()
{
    quick();
    int a , b ;
    cin >> a >> b ;
    bool state = false ;
    for (int i = 1 ; i <= 3 ; i++){
        if (a*b*i%2!=0)state=true;
    }
    if (state){
        cout << "Yes";
    }else {
        cout << "No";
    }
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<cmath>
#include<algorithm>
#include<iomanip>
#include<map>
#define ran(x) (x).begin(),(x).end()
using namespace std;
int main() {
	string s;
	cin >> s;
	int ans = 0;
	for(int i = 0; i < 3; ++i) {
		if(s[i] == 'R')
			++ans;
		if(ans > 0 && s[i] == 'S')
			return cout << ans << endl, 0;
	}
	cout << ans << endl;
}

Measured memory_bytes: 3592
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<vector>
#include<utility>
#include<cmath>
#include<string>
#include<cstring>
#include<map>
#include<queue>
#include<set>
#include<climits>
#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define prin(arg) std::cout<<arg<<"\n"
#define prin2(arg1,arg2) std::cout<<arg1<<" "<<arg2<<"\n"
#define fill(arg,n) std::memset(arg,n,sizeof(arg))
#define mp std::make_pair
#define pb push_back
using std::cin;
typedef long long ll;
typedef std::pair<int,int> pi;
typedef std::pair<ll,ll> pll;
typedef std::vector<int> vi;
typedef std::set<int> si;
typedef std::string str;
const int INF=1e+9;
const ll INFLL=LLONG_MAX;
const ll MOD=1e+9+7;
int N,K;
ll x[60],y[60];
bool comp(pll &a,pll &b){
  return a.second<b.second;
}
int main(){
  cin>>N>>K;
  rep(i,N) cin>>x[i]>>y[i];
  pll p[60];
  rep(i,N) p[i]=mp(x[i],y[i]);
  ll res=INFLL;
  rep(i,N){
    rep(j,N){
      rep(k,N){
	rep(l,N){
	  ll xl=x[i],xu=x[j],yl=y[k],yu=y[l];
	  if(xl>=xu||yl>=yu) continue;
	  else{
	    int cnt=0;
	    rep(m,N){
	      if(xl<=x[m]&&x[m]<=xu&&yl<=y[m]&&y[m]<=yu) cnt++;
	    }
	    if(cnt>=K){
	      res=std::min(res,(xu-xl)*(yu-yl));
	    }
	    else continue;
	  }
	}
      }
    }
  }
  prin(res);
  return 0;
}


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

int main() {
	long long N, M, Cur = 0, ANS = 0;
	static long long A[100000], X[100000] = {};
	static pair<long long, long long> P[100000];
	cin >> N >> M;
	for (int i = 0; i < N; i++) cin >> A[i];
	sort(A, A + N);
	for (int i = 0; i < M; i++) {
		cin >> P[i].second >> P[i].first;
	}
	sort(P, P + M, greater<pair<long long, long long> >());
	for (int i = 0; i < M; i++) {
		for (int j = 0; j < P[i].second; j++) {
			if (Cur >= N) goto NEXT;
			X[Cur] = P[i].first;
			Cur++;
		}
	}
NEXT:;
	for (int i = 0; i < N; i++) {
		ANS += max(A[i], X[i]);
	}
	cout << ANS << endl;
}

Measured memory_bytes: 3328
#include <stdio.h>

int main()
{
    char c[4], s[4];
    int i;
    
    for (i = 0; i < 3; i++) {
        scanf("%s", c);
        s[i] = (char)c[i];
    }
    printf("%c%c%c", s[0], s[1], s[2]);
    
    return 0;
}


Measured memory_bytes: 128
#include<cstdio>
#include<algorithm>

using namespace std;

typedef	long long	ll;

ll gcd(ll a,ll b){
	for(;a;swap(a,b))	b%=a;
	return b;
}

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

int main(){
	for(int n;scanf("%d",&n),n;){
		int d[10],v[10];
		for(int i=0;i<n;i++){
			scanf("%d%d",d+i,v+i);
			int g=gcd(d[i],v[i]);
			d[i]/=g,v[i]/=g;
		}

		ll deno=d[0];
		for(int i=1;i<n;i++)	deno=lcm(deno,d[i]);
		ll nume[10];
		for(int i=0;i<n;i++)	nume[i]=v[i]*deno/d[i];
		ll g=nume[0];
		for(int i=1;i<n;i++)	g=gcd(g,nume[i]);
		for(int i=0;i<n;i++)	printf("%d\n",nume[i]/g);
	}

	return 0;
}

Measured memory_bytes: 0
from __future__ import division, print_function
import sys
if sys.version_info[0] < 3:
    from __builtin__ import xrange as range
    from future_builtins import ascii, filter, hex, map, oct, zip

import os, sys, bisect, copy
from collections import defaultdict, Counter, deque
#from functools import lru_cache   #use @lru_cache(None)
if os.path.exists('in.txt'): sys.stdin=open('in.txt','r')
if os.path.exists('out.txt'): sys.stdout=open('out.txt', 'w')
#
def input(): return sys.stdin.readline()
def mapi(arg=0): return map(int if arg==0 else str,input().split())
#------------------------------------------------------------------

a = input().strip()
n = len(a)
dp = [0]*(n+1)
mp  = defaultdict(int)
dp[n-1] = int(a[n-1])
dp[n] = 0
mp[dp[n]]+=1
mp[dp[n-1]]+=1
for i in range(n-2,-1,-1):
    dp[i] = (dp[i+1]+(int(a[i])*pow(10,(n-i-1),2019))%2019)%2019
    mp[dp[i]]+=1
res =0
#print(dp)
#dp.sort()
#print(dp)
#print(mp)
for i,v in mp.items():
    res+=v*(v-1)//2
print(res)


Measured memory_bytes: 71188
#include<bits/stdc++.h>
#define REP(x,y,z) for(int x=y;x<=z;x++)
#define MSET(x,y) memset(x,y,sizeof(x))
#define M 100005
using namespace std;
using LL = long long;
int n,in[M];
int main()
{
    while (~scanf("%d", &n)) {
        int cnt = 0;
        REP(i,1,n) {
            scanf("%d", &in[i]);
            if (in[i]<0) {
                cnt ++;
                in[i] *= -1;
            }
        }

        LL ans = accumulate(in+1, in+n+1, 0LL);
        if (cnt%2) {
            ans -= *min_element(in+1, in+n+1) * 2;
        }
        printf("%lld\n", ans);
    }
    return 0;
}


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

using namespace std;
typedef long long ll;
typedef string str;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector <pii> vpii;
typedef vector <pll> vpll;
typedef map <str,int> mapsi;
typedef map <str,int> :: iterator mapsitr;
typedef map <int , int> mint;
typedef map <ll , ll> mll;
typedef set <int> si;
typedef set <ll> sll;
typedef si :: iterator sitr;
typedef si :: reverse_iterator rsitr;
typedef sll :: iterator sltr;
typedef sll :: reverse_iterator rsltr;
#define mset multiset

typedef mset <int> msi;
typedef mset <ll> msll;
typedef msi :: iterator msitr;
typedef msi :: reverse_iterator msritr;
typedef msll :: iterator msltr;
typedef msll :: reverse_iterator mslritr;

#define mp make_pair
#define pb push_back
#define pob pop_back
#define pf push_front
#define pof pop_front
#define fi first
#define se second
#define fs first.second
#define ss second.second
#define ff first.first
#define sf second.first
#define newl '\n'

char to_upper (char x){
    if( 97 <= int(x) && int(x) <= 126)return char(x-32);
    else if( 65 <= int(x) && int(x) <= 90)return x;
}
char to_lower (char x){
    if( 97 <= int(x) && int(x) <= 126)return x;
    else if( 65 <= int(x) && int(x) <= 90)return char(x+32);
}
int numerize (char x){
    if(48 <= int(x) && int(x) <= 57)return int(x-'0');
    else if( 97 <= int(x) && int(x) <= 126)return int(x-96);
    else if( 65 <= int(x) && int(x) <= 90)return int(x-64);
}
bool isect (int l1, int r1, int l2, int r2){
    pii p1,p2;
    p1 = mp(l1,r1); p2 = mp(l2,r2);
    if(p1>p2)swap(p1,p2);
    if(p2.fi <= p1.se)return true;
    else return false;
}
ll fexp (ll num1, ll num2, ll MOD){
    if(num2==0)return 1;
    else if(num2==1)return num1;
    else{
        ll temp = fexp (num1,num2/2,MOD); ll res = ((temp%MOD) * (temp%MOD))%MOD;
        if(num2%2==1) res = ((res%MOD)*(num1%MOD))%MOD; return res;
    }
}
ll invmod (ll num, ll MOD){return fexp (num,MOD-2,MOD);}
ll gcd (ll num1, ll num2){
    if(num1 < num2) swap(num1,num2); ll num3 = num1 % num2 ;
    while(num3 > 0){ num1 = num2; num2 = num3; num3 = num1 % num2;}
    return num2;
}
ll lcm (ll num1 , ll num2){return (ll) (num1/gcd(num1,num2))*num2;}
// end of Template
int a,b,ans;
int main(){

//    freopen("input.txt", "r", stdin);
//    freopen("output.txt", "w", stdout);

    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cin>>a>>b;
    int in = 1;
    while(in<b){
        in--;in+=a;
        ans++;
    }
    cout<<ans<<newl;
}


Measured memory_bytes: 256