akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;

#define INF 1<<30
#define LINF 1ll<<60ll
#define MOD 1000000007
#define pb(a) push_back(a)

#define _overload3(_1,_2,_3,_4,name,...) name
#define _rep(i,n) _repi(i,0,n)
#define _repi(i,a,b) for(int i=a, i##_len=(b); i<i##_len; ++i)
#define _repis(i,a,b,s) for(int i=a, i##_len(b); i<i##_len; i+=s)
#define REP(...) _overload3(__VA_ARGS__,_repis,_repi,_rep,)(__VA_ARGS__)

#define REPR(i, n) for(int i = n;i >= 0;--i)
#define REPARR(i, v) for(int i = 0;i < sz(v);++i)

#define all(vec) (vec.begin()),(vec.end())
#define sz(x) ((int)(x).size())
#define bit(n) (1ll<<(n))

template<class T>bool chmax(T &a,const T &b){if(a<b){a=b;return true;}return false;}
template<class T>bool chmin(T &a,const T &b){if(a>b){a=b;return true;}return false;}

#define YES(n) cout<<((n)?"YES":"NO")<<endl
#define Yes(n) cout<<((n)?"Yes":"No")<<endl
#define yes(n) cout<<((n)?"yes":"no")<<endl
#define poss(n) cout<<((n)?"possible":"impossible")<<endl
#define Poss(n) cout<<((n)?"Possible":"Impossible")<<endl
#define POSS(n) cout<<((n)?"POSSIBLE":"IMPOSSIBLE")<<endl



int main(){
    int n;
    cin>>n;
    int ans=0;
    REP(i,n){
        int l,r;
        cin>>l>>r;
        ans+=r-l+1;
    }
    cout<<ans<<endl;
    return 0;
}

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

using namespace std;

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

    int total = a + b + c + d;
    int m = total / 60;
    int s = total % 60;

    cout << m << endl << s << endl;
    return 0;
}



Measured memory_bytes: 3064
n,m,c = gets.split.map(&:to_i)
bs = gets.split.map(&:to_i)

count = 0

n.times do
  as = gets.split.map(&:to_i)
  count += 1 if as.zip(bs).map{|a,b|a*b}.reduce(:+) + c > 0
end

puts count

Measured memory_bytes: 1788
n=gets.to_i
a=gets.split.map(&:to_i)
b=gets.split.map(&:to_i)
c=a.zip(b).reduce(0){|s,(x,y)|s+(x>y ? x-y : 0)}
d=a.zip(b).reduce(0){|s,(x,y)|s+(x<y ? (y-x+1)/2 : 0)}
puts b.reduce(:+)-a.reduce(:+)<[c,d].max ? :No : :Yes

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

int main() {
    int n;
    cin >> n;
    char a[26]={};
    for (int i=0; i<26; i++)
        a[i] = 32;
    for (int i=0; i<n; i++) {
        string s;
        char r[26] ={};
        cin >> s;
        for (int j=0; j<s.length(); j++) {
            r[s[j]-'a']++;
        }
        for (int i=0; i<26; i++)
            a[i] = min(a[i], r[i]);
    }
    for (int i=0; i<26; i++)
        for (int j=0; j<a[i]; j++)
            printf("%c", 'a'+i);
    puts("");
    return 0;
}


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

int main() {
  int N,X,ans = 0,tmp = 0,cnt = 0;
  cin >> N >> X;
  vector<int> L(N);
  for(int i = 0; i < N; i++){
  	cin >> L.at(i);
  }
  for(int i = 0; i < N; i++){
  	if(ans <= X){
    cnt++;
    }
    ans = tmp + L.at(i);
    tmp = ans;
    if(i == N - 1 && tmp <= X){
    	cnt++;
    }
  }
  cout << cnt << endl;
}


Measured memory_bytes: 256
using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Numerics;
using System.Text;
using System.Threading.Tasks;
using static System.Console;
using static System.Math;
using static Func;
class Z { static void Main() => new K(); }
class K
{
	int F => int.Parse(Str);
	long FL => long.Parse(Str);
	int[] G => Strs.Select(int.Parse).ToArray();
	uint[] GU => Strs.Select(uint.Parse).ToArray();
	decimal[] GD => Strs.Select(decimal.Parse).ToArray();
	long[] GL => Strs.Select(long.Parse).ToArray();
	string Str => ReadLine();
	string[] Strs => Str.Split(new char[] { ' ', '\t' }, StringSplitOptions.RemoveEmptyEntries);
	static T[] ConstantArray<T>(int n, T val) { var a = new T[n]; for (var i = 0; i < n; i++) a[i] = val; return a; }
	static T[] MakeArray<T>(int n, Func<int, T> f) { var a = new T[n]; for (var i = 0; i < n; i++) a[i] = f(i); return a; }
	static T[] Recurse<T>(int n, T a0, Func<int, T, T> f) { var a = new T[n]; a[0] = a0; for (var i = 1; i < n; i++) a[i] = f(i, a[i - 1]); return a; }
	static T[] Accumulate<T>(IList<T> a, T zero, Func<T, T, T> f) { var s = new T[a.Count + 1]; s[0] = zero; for (var i = 0; i < a.Count; i++) s[i + 1] = f(s[i], a[i]); return s; }
	static ulong One(int k) => 1ul << k;
	static ulong All(int k) => One(k) - 1;
	static bool Has(ulong s, int k) => (s & One(k)) != 0;
	const int MOD = 1000000007;
	public K()
	{
		SetOut(new StreamWriter(OpenStandardOutput()) { AutoFlush = false });
		Solve();
		Out.Flush();
	}
	void Solve()
	{
		var S = Str;
		var l = 15 - S.Length + S.Count(c=>c=='o');
		WriteLine(l >= 8 ? "YES" : "NO");
	}
}
static class Func { }


Measured memory_bytes: 13268
#include<iostream>
#include<map>
#include<queue>
#include<algorithm>
#include<vector>
using namespace std;
#define REP(i,b,n) for(int i=b;i<n;i++)
#define rep(i,n)   REP(i,0,n)
#define ALL(c)   (c).begin(),(c).end()
#define pb push_back
#define mp make_pair

typedef pair<int,int> pii;

const  int lim = 150;

enum{ON=0,OFF=1};
class st{
public:
  int t,w;
  bool operator<(const st & a)const{
    if (t != a.t)return t < a.t;
    return w < a.w;
  }
};

void setdata(vector<st> & a,map<int,int> &M){
  map<int,int>::iterator itr = M.begin();
  while(itr != M.end()){
    a.pb((st){(*itr).first,(*itr).second});
    itr++;
  }
}

bool solve(vector<st> &in){
  sort(ALL(in));
  int now=0;
  rep(i,in.size()){
    now+=in[i].w;
    if (now > lim)return false;
  }
  return true;
}

main(){
  int n;
  while(cin>>n && n){
    map<int,int> M;
    rep(i,n){
      int a,b,c;
      cin>>a>>b>>c;
      M[b]+=a;
      M[c]-=a;
    }
    vector<st> in;
    setdata(in,M);
    if (solve(in))cout <<"OK" << endl;
    else cout <<"NG" << endl;
  }
}

Measured memory_bytes: 0
import java.util.*;

public class Main {	
	public static void main(String args[]){
		Scanner sc = new Scanner(System.in);
		
		ArrayDeque<Integer> s = new ArrayDeque<>();
		
		while(sc.hasNext()){
			String str = sc.next();
			
			switch(str){
			case "+":
				s.push(s.pop() + s.pop());
				break;
			case "-":
				s.push(-1 * s.pop() + s.pop());
				break;
			case "*":
				s.push(s.pop() * s.pop());
				break;
			default:
				s.push(Integer.parseInt(str));
			}
		}
		
		System.out.println(s.pop());
	}
	
}



Measured memory_bytes: 26084
#include <bits/stdc++.h>
using namespace std;
#define  rep(i, n) for(int i = 0; i < n; i++) 
#define  all(x) (x).begin(),(x).end()     // 昇順ソート
#define  rall(v) (v).rbegin(), (v).rend() // 降順ソート
#define  INF 1LL << 60
typedef long long int LL;
typedef long long int ll;
#define pll pair<ll, ll>
#define F first
#define S second
const int MOD = 1000000007;
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return true; } return false; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return true; } return false; }
//sort(all(x))とするとソートできるよ
// 10^x は pow(10,(x)) 
// 任意のlogは　対数の底の変換を使う    log(N) / log(任意の底)

int main(){
    int N,K;cin >> N >> K;
    LL ans = 0;

    if(K != 0){
        rep(b,N+1)if(b != 0)ans += N/b * max(0,(b - K)) + max(0,(N % b - K + 1)); 
    }
    else ans = (LL)N * (LL)N;
    cout << ans << endl;
}



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

int main() {
  int N, P, W, G, Y = 0;
  string k;
  cin >> N;
  for (int i = 0; i < N; i++) {
    cin >> k;
    if (k == "P")
      P = 1;
    else if (k == "W")
      W = 1;
    else if (k == "G")
      G = 1;
    else if (k == "Y")
      Y = 1;
  }
  if ((P + W + G + Y) == 4) {
    cout <<"Four" << endl;
  }
  else if ((P + W + G + Y) == 3) {
    cout << "Three" << endl;
  }
}


Measured memory_bytes: 256
# coding: utf-8
# Here your code !
n  = input()
a = map(int, raw_input().split())
t = [False for i in xrange(n)]
count = 0

for i in xrange(n):
    if t[i-1]:
        continue
    j = a[i-1]
    if a[j-1] == i:
        count += 1
        t[j-1] = True
    t[i-1] = True
    
print count

Measured memory_bytes: 11328
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <cctype>
#include <string>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <algorithm>
#include <functional>
#include <iomanip>
#include <limits>

using namespace std;
typedef long long int ll;
void sayYes() { cout << "Yes" << endl; };
void sayNo() { cout << "No" << endl; };
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }                   // 最大公約数
ll lcm(ll a, ll b) { return a * b / gcd(a, b); };                      // 最小公倍数
ll getDigit(ll num) { return log10(num) + 1; }                         // 桁数
ll digitSum(ll n) { return (n < 10) ? n : digitSum(n / 10) + n % 10; } // 各桁の和
#define rep(i, n) for (ll i = 0; i < n; i++)

void Main()
{
    // int n;
    // cin >> n;
    // vector<int> a(n);
    // rep(i, n)
    // {
    //     cin >> a[i];
    // }

    int a, b, c;
    cin >> a >> b >> c;

    cout << ((a + b + c >= 22) ? "bust" : "win") << endl;

    return;
}

signed main(void)
{
    std::cin.tie(nullptr);
    std::ios_base::sync_with_stdio(false);
    std::cout << std::fixed << std::setprecision(15);
    Main();
    return 0;
}


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

using namespace std;


#define ff				first
#define ss				second
#define int				long long
#define pb				push_back
#define mp				make_pair
#define pii				pair<int,int>
#define vi				vector<int>
#define mii 			map<int,int>
#define	pqb				priority_queue<int>
#define pqs				priority_queue<int,vi,greater<int> >
#define setbits(x)		__builtin_popcountll(x)
#define zrobits(x)		__builtin_ctzll(x)
#define mod				1000000009
#define inf 			1e18
#define ps(x,y)			fixed<<setprecision(y)<<x
#define mk(arr,n,type)	type *arr = new type[n]
#define w(x)			int x; cin>>x; while(x--)
#define FIO             ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define endl			'\n'
#define yes cout<<"YES"<<endl
#define no cout<<"NO"<<endl

const int maxn = 1e5 + 5;
void c_p_c()
{
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif

}


bool isPrime(int n)
{
	if (n <= 1)
		return false;
	if (n <= 3)
		return true;
	if (n % 2 == 0 || n % 3 == 0)
		return false;
	for (int i = 5; i * i <= n; i += 6)
	{
		if (n % i == 0 || n % (i + 2) == 0)
			return false;

	}
	return true;
}

set<int> Sieve(int n)
{
	bool prime[n + 1];
	memset(prime, true, sizeof(prime));
	for (int i = 2; i * i <= n; i++)
	{
		if (prime[i])
		{
			for (int j = i * i; j <= n; j += i)
			{
				prime[j] = false;
			}
		}
	}
	set<int> primes;

	for (int i = 2; i <= n; i++)
	{
		if (prime[i])
			primes.insert(i);
	}
	return primes;
}
set<int> primeFactors(int  n)
{
	set<int> factors;
	while (n % 2 == 0)
	{
		n /= 2;
		factors.insert(2);

	}
	for (int i = 3; i <= sqrt(n); i += 2)
	{
		// int count = 0;
		while (n % i == 0)
		{
			factors.insert(i);
			n /= i;
		}
	}
	if (n > 2)
		factors.insert(n);
	return factors;
}

int power(int x, unsigned int y, int p)
{
	int res = 1;

	x = x % p;

	if (x == 0) return 0;
	;
	while (y > 0)
	{

		if (y & 1)
			res = (res * x) % p;

		y = y >> 1; // y = y/2
		x = (x * x) % p;
	}
	return res;

}

// Graph------------------------------------------------------------------------


int32_t main()
{
	FIO;
	// c_p_c();
	// --------------------------------------------------
	// Never GIVE UP !!!!
	string s;
	cin >> s;
	if (s == "RRR")
		cout << 3 << endl;
	else if (s ==	"RRS" || s == "SRR")
		cout << 2 << endl;
	else if (s.find("R") != string::npos)
		cout << 1 << endl;
	else
		cout << 0 << endl;


}

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

using namespace std;

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

#define each(i,a) for (auto&& i : a)
#define FOR(i,a,b) for (ll i=(a),__last_##i=(b);i<__last_##i;i++)
#define RFOR(i,a,b) for (ll i=(b)-1,__last_##i=(a);i>=__last_##i;i--)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define __GET_MACRO3(_1, _2, _3, NAME, ...) NAME
#define rep(...) __GET_MACRO3(__VA_ARGS__, FOR, REP)(__VA_ARGS__)
#define rrep(...) __GET_MACRO3(__VA_ARGS__, RFOR, RREP)(__VA_ARGS__)
#define pb push_back
#define all(a) (a).begin(),(a).end()
#define chmin(x,v) x = min(x, v)
#define chmax(x,v) x = max(x, v)

const ll linf = 1e18;
const int inf = 1e9;
const double eps = 1e-12;
const double pi = acos(-1);

template<typename T>
istream& operator>>(istream& is, vector<T>& vec) {
    each(x,vec) is >> x;
    return is;
}
template<typename T>
ostream& operator<<(ostream& os, const vector<T>& vec) {
    rep(i,vec.size()) {
        if (i) os << " ";
        os << vec[i];
    }
    return os;
}
template<typename T>
ostream& operator<<(ostream& os, const vector< vector<T> >& vec) {
    rep(i,vec.size()) {
        if (i) os << endl;
        os << vec[i];
    }
    return os;
}
struct Ant {
    ll x, dir, id;
};
bool operator<(const Ant& a1, const Ant& a2) {
    return a1.x < a2.x;
}
int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    ll n, L;
    while (cin >> n >> L, n || L) {
        vector<Ant> ants;
        rep(i, n) {
            string d; ll x; cin >> d >> x;
            ants.pb(Ant{x, (d == "L" ? -1 : 1), i});
        }
        sort(all(ants));
        rep(t, 2*(L+1)) {
            each(a, ants) {
                // cout << "(" << a.x << ", " << a.dir << ", " << a.id << ")" << " ";
                a.x += a.dir;
            }
            // cout << endl;
            sort(all(ants));
            rep(i, 1, ants.size()) {
                if (ants[i-1].x == ants[i].x) {
                    ants[i-1].dir *= -1;
                    ants[i].dir *= -1;
                }
            }
            vector<Ant> nants;
            each(a, ants) {
                if (0 <= a.x && a.x <= L) {
                    nants.pb(a);
                }
            }
            if (nants.size() == 0) {
                cout << t << " " << ants[0].id+1 << endl;
                break;
            }
            ants = nants;
        }
    }
}

Measured memory_bytes: 3216
#include<bits/stdc++.h>
#define upd(a,b) a=add(a,b)
#define lb(x) ((x)&(-(x)))
using namespace std;
const int Mod=1e9+7;
int add(int a,const int b){a+=b;if(a>=Mod)a-=Mod;return a;}
const int N=23,V=(1<<20)+10;
int n,m,K,c=0,sx,ans=0;
int h[N][N],f[2][V];
int main()
{
	int i,j,ns,s1,s2,a,b;
	cin>>n>>m>>K;
	if(n==1)
	{
		puts("1");return 0;
	}
	n--;
	sx=1<<n;
	memset(h,-1,sizeof(h));
	for(i=1;i<=K;i++)
	{
		cin>>a>>b;b--;
		cin>>h[a][b];h[a][b]^=1;
	}
	f[0][0]=1;
	for(i=1;i<=m;i++)
	{
		for(j=0;j<n;j++)
		{
			memset(f[c^1],0,sizeof(f[c^1]));
			for(ns=0;ns<sx;ns++)
			{
				if(h[i][j]!=0)
				{
					if(!((ns>>j)&1))
					{
						upd(f[c^1][ns],f[c][ns]);
					}
				}
				if(h[i][j]!=1)
				{
					if((ns>>j)&1)
					{
						upd(f[c^1][ns],f[c][ns]);
					}
					else
					{
						s1=ns&((1<<j)-1);s1|=(1<<j);
						s2=ns>>j;s2^=lb(s2);s2>>=1;
						upd(f[c^1][s1|(s2<<(j+1))],f[c][ns]);
					}
				}
			}
			c^=1;
		}
	}
	for(ns=0;ns<sx;ns++) upd(ans,f[c][ns]);
	printf("%d",ans);
	return 0;
}

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

char getGrade(int m, int s, int r){
    char grade;
    int sum = m + s;
    if(m == -1 || s == -1){
        grade = 'F';
    } else if(sum >= 80) {
        grade = 'A';
    } else if(sum < 80 && sum >= 65){
        grade = 'B';
    } else if(sum < 65 && sum >= 50){
        grade = 'C';
    } else if(sum < 50 && sum >= 30){
        if(r >= 50){
            grade = 'C';
        } else {
            grade = 'D';
        }
    } else {
        grade = 'F';
    }
    return grade;
}

int main(){
    int m, s, r;
    
    while(1){
        cin >> m >> s >> r;
        if(m == -1 && s == -1 && r == -1){
            break;
        }
        cout << getGrade(m, s, r) << endl;
    }
   
    return 0;
}


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

int main(void){
  int n; cin >> n;
  vector<int> a(n);
  rep(i,n) cin >> a[i];

  rep(i,n) a[i]--;
  int ans = 0;
  int button=a[0];
  ans++;
  int i=button;
  do{
    if(button!=1){
      button=a[i];
      ans++;
      i=button;
    }
    if((button == 1) || (ans==n)) break;
  }while(1);

  if(button==1) cout << ans << endl;
  else cout << "-1" << endl;
  
  return 0;
}


Measured memory_bytes: 768
//Robs Code
/***********HEADER***************/
#include <iostream>
#include <bitset>
#include <deque>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <string>
#include <algorithm>
#include <list>
#include <vector>
#include <unordered_set>
#include <unordered_map>
#include <stack>
#include <set>
#include <queue>
#include <map>
/***********MACROS***************/
#define int long long int
#define fri(l,k) for (i=l;i<=k;i++)
#define frj(l,k) for (j=l;j>=k;j--)
#define fij(a,b,l,k) for(i=a;i<=b;i++) for(j=l;j<=k;j++)
#define all(x) x.begin(),x.end()
#define allr(x) x.rbegin(),x.rend()
#define endl "\n"
#define pb push_back
#define _1 first
#define _2 second
#define mxsz 1e5+10
#define mod 1e9 + 7
#define pii pair<int,int>
using namespace std;
const int N = 1e5 + 1;
int n,m,i,j,l,k,x,y,a,b,cnt[3],sum[3];
/***********MAIN**************/
signed main(){
	ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
	int h,w,k;
	cin>>h>>w>>k;
	char mat[h][w];
	for(int i=0;i<h;i++){
		for(int j=0;j<w;j++){
			cin>>mat[i][j];
		}
	}
	int ans[h][w] = {};
	int cnt = 1;
	set<int> v1;
	for(int i=0;i<h;i++){
		vector<int> v;
		for(int j=0;j<w;j++){
			if(mat[i][j] == '#'){
				v.pb(j);
			}
		}
		if(v.size() == 0){
			v1.insert(i);
		}else{
			int k = 0;
			for(int j=0;j<v.size();j++){
				while(k <= v[j]){
					ans[i][k] = cnt;
					k++;
				}
				cnt++;
			}
			cnt--;
			while(k<w){
				ans[i][k] = cnt;
				k++;
			}
			cnt++;
		}
	}
	for(int i=1;i<h;i++){
		for(int j=0;j<w;j++){
			if(ans[i][j] != 0){
				int x = ans[i][j];
				for(int k = i-1;k>=0;k--){
					if(ans[k][j] == 0){
						ans[k][j] = x;
					}
				}
			}
		}
	}
	for(int i=0;i<h-1;i++){
		for(int j=0;j<w;j++){
			if(ans[i][j] != 0){
				int x = ans[i][j];
				for(int k = i+1;k<h;k++){
					if(ans[k][j] == 0){
						ans[k][j] = x;
					}else{
						break;
					}
				}
			}
		}
	}
	
	for(int i=0;i<h;i++){
		for(int j=0;j<w;j++){
			cout<<ans[i][j]<<" ";
		}
		cout<<"\n";
	}
    return 0;
}
//.........

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

int main(){
    //A
    /*
    vector<int> a={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};
    int K;
    cin>>K;
    cout<<a[K-1]<<endl;
    */
   //B
   /*
   long long H,W;
   cin>>H>>W;
   if(H==1||W==1) cout<<1<<endl;
   else cout<<(H*W+1)/2<<endl;
   */
   //C
   long long a,b,c; //int型は2*10^9くらいの値まで
   cin>>a>>b>>c;
   long long d = c-a-b;
   if(d>0&&d*d>4*a*b) cout<<"Yes"<<endl;
   else cout<<"No"<<endl;
return 0;
}

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


int main() {
    int a,b;
    cin >> a >> b;
    if((a*b)%2 == 1)cout << "Yes\n";
    else cout << "No\n";
    return 0;
}

/*
やっほい！
　　　　　　　やほほい！
　　　　+　　 　*
　　　 ∧∧　　. ∧∞∧　*
*　ヽ(=´ω｀)人(´ω｀*)ﾉ
　.～（ O x.） （ 　 O)～　+
。*　 　∪　　　　∪
*/

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>

using namespace std;
using namespace __gnu_pbds;

using u128 = __uint128_t;

#define int long long
#define idxSet tree<int, null_type,less_equal<int>, rb_tree_tag,tree_order_statistics_node_update>
#define atIdx find_by_order
#define idxOf order_of_key
#define MOD 1000000007
#define MAX 200005
#define endl '\n'

#define v(type) vector<type>
#define p(type1, type2) pair<type1 , type2>
typedef pair<int, int> ii;
typedef vector<int> vi;
typedef vector<ii> vii;

int dp[MAX];

void solve() {
    int n ;
    cin>>n;
    string x;
    cin>>x;
    int a[26] = {0};
    int b[26] = {0};
    for (int i = 0; i < n; ++i) {
        a[x[i] - 'a']++;
    }
    int ans = 0;
    for (int j = 0; j < n; ++j) {
        a[x[j] - 'a']--;

        b[x[j] -'a']++;

        int c = 0;
        for (int i = 0; i < 26; ++i) {
            if(a[i] > 0 && b[i] > 0)
                c++;
        }
        ans = max(ans , c);
    }
    cout<<ans<<endl;

}

int32_t main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int t = 1;
    //cin>>t;
    while (t--)
        solve();
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
using namespace std;
#include <vector>
#include <numeric>
#include <map>
#include <cmath>
#include <iomanip>
#include <queue>
using ll =long long;
using vi = vector<int>;
using vl = vector<ll>;
using vvi = vector<vi>;

int main() {
    string S;
    cin >> S;
    if(S.at(2)==S.at(3) && S.at(4)==S.at(5)){
        cout << "Yes" << endl;
    }
    else{
        cout << "No" << endl;
    }
}

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

constexpr ll mod = 1e9+7;

int main(){
    ll N, K;
    cin >> N >> K;
    vector<ll> acc(N+3, 0);
    rep(i, 1, N+3){
        acc[i] = acc[i-1] + i - 1;
        acc[i] %= mod;
    }
    
    ll ans = 0;
    rep(i, K, N+2){
        ll b = acc[i];
        ll u = acc[N+1] - acc[N+1-i];
        //cerr << i << ":" << u << ", " << b << endl;
        ans += u - b + 1;
        ans %= mod;
    }
    if(ans < 0) ans = mod + ans;
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 4844
#include <sys/time.h>

#include <iostream>
#include <iomanip>
#include <algorithm>
#include <utility>
#include <cmath>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <deque>
#include <utility>
#include <cctype>

using namespace std;

using ll = long long;
using P = pair<double, double>;

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define mkp(a, b) make_pair(a, b)
ll mod = 1000000007LL;


int main() {
	int n;
	cin >> n;
	int count = 0;

	for (int i = 1; i <= n; i++) {
		int a;
		cin >> a;
		if (i % 2 == 1 && a % 2 == 1) count ++;
	}
	cout << count << endl;

	return 0;
}


Measured memory_bytes: 3184
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 8)
INF = float('inf')
MOD = 10 ** 9 + 7

def main():
    H, W = map(int, readline().split())
    S = list(list(input()) for _ in range(H))
    ans = [[0]*W for _ in range(H)]
    dx = [-1,0,1]
    dy = [-1,0,1]
    for i in range(H):
        for j in range(W):
            if S[i][j]=='#':
                ans[i][j] = '#'
                for x in dx:
                    for y in dy:
                        ny = i + y
                        nx = j + x
                        if 0<=nx<W and 0<=ny<H and ans[ny][nx]!='#':
                            ans[ny][nx] += 1
    for i in range(H):
        print(''.join(map(str,ans[i])))



if __name__ == '__main__':
    main()

Measured memory_bytes: 3064
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <map>
#include <set>
#include <vector>
#include <iostream>
#include <algorithm>
#include <string>
#include <iomanip>
#include <assert.h>
#include <math.h>
#include <stack>
#include <queue>
#include <list>
using namespace std;

// #define __DEBUG__

#ifdef __DEBUG__
bool debug_disabled = false;
#else
bool debug_disabled = true;
#endif

#define dbg if (debug_disabled) {} else cerr

const int MOD = 998244353;

long long mod_pow(long long a, int p) {
    if (p == 0) return 1;
    long long half = mod_pow(a, p / 2);
    long long res = (half * half) % MOD;
    if (p % 2 != 0) res = (res * a) % MOD;
    return res;
}

long long inverse(long long b) {
    return mod_pow(b, MOD - 2);
}

void solve() {
    int N, M, K;
    cin >> N >> M >> K;
    long long res = 0;
    long long nck = 1;
    for (int i = 0; i <= K; ++i) {
        if (i != 0) nck = (((nck * (N - i)) % MOD) * inverse(i)) % MOD;
        dbg << "nck = " << nck << endl;
        long long cur_res = (nck * (long long) M) % MOD;
        cur_res = (cur_res * mod_pow(M - 1, N - i - 1)) % MOD;
        res = (res + cur_res) % MOD;
    }
    cout << res << endl;
}

int main() {
    cout.setf(ios::fixed, ios::floatfield);
    cout.setf(ios::showpoint);
    cout.precision(12);
    cin.tie(0);
    cout.tie(0);
    ios::sync_with_stdio(false);

    int T = 1;
    // cin >> T;
    for (int i = 1; i <= T; ++i) {
        solve();
    }

    return 0;
}


Measured memory_bytes: 3644
n = int(input())
h = [int(i) for i in input().split()]

dp = [0] * n
dp[-2] = abs(h[-1] - h[-2])

for i in range(n - 3, -1, -1):
    dp[i] = min(abs(h[i] - h[i + 1]) + dp[i + 1], abs(h[i] - h[i + 2]) + dp[i + 2])

print(dp[0])


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

int main() {
	std::ios_base::sync_with_stdio(false);
	cin.tie(0);
	int n;
	cin >> n;
	vector<int> a(n);
	for (int i = 0; i < n; i++)
		cin >> a[i];
	int cur = 0;
	for (int i = 1; i < n; i++)
		cur ^= a[i];
	cout << cur;
	for (int i = 1; i < n; i++) {
		cur ^= a[i] ^ a[i - 1];
		cout << ' ' << cur;
	}
	cout << '\n';
}



Measured memory_bytes: 3964
#include<bits/stdc++.h>
using namespace std;
int n,l,a[10],ans,cnt;
string s;
int al[10],tal[10];
void d(int x,int sum,int nsum){
  if(x==l){
    sum+=nsum;
    if(ans==sum)cnt++;
    if(sum>ans&&sum<=n){
      ans=sum,cnt=1;
      for(int i=0;i<l;i++)tal[i]=al[i];
    }
    return;
  }
  if(sum>n)return;
  d(x+1,sum+nsum,a[x]);
  al[x]=1;
  d(x+1,sum,nsum*10+a[x]);
  al[x]=0;
}

int main(){
  while(cin>>n>>s){
    if(!n)break;
    int tn=n,sum=0;
    l=ans=0;
    cnt=1;
    for(int i=0;i<s.size();i++){
      al[i]=tal[i]=0;
      a[i]=s[i]-'0';
      sum+=a[i];
    }
    l=s.size();
    if(n<sum)cout<<"error"<<endl;
    else{
      d(1,0,a[0]);
      if(cnt==1){
	cout<<ans;
	for(int i=0;i<s.size();i++){
	  if(!tal[i])cout<<" ";
	  cout<<s[i];
	}
	cout<<endl;
      }
      else cout<<"rejected"<<endl;
    }
  }
  return 0;
}



Measured memory_bytes: 3148
#define _USE_MATH_DEFINES
#include <iostream>
#include <math.h>
#include <algorithm>
using namespace std;

int main() {
	double r;

	scanf("%lf", &r);

	printf("%.5f %.5f", M_PI*r*r, 2 * M_PI*r);

	cout << endl;
	return 0;
}

Measured memory_bytes: 3212
import java.math.BigDecimal;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        try (Scanner sc = new Scanner(System.in)) {

            char[] s = sc.next().toCharArray();
            BigDecimal decimal = sc.nextBigDecimal();

            long i = 0L;
            for (; i < s.length; i++) {
                if (s[(int) i] != '1') {
                    break;
                }
            }
            // if(s.length == i && k > i) {
            // System.out.println();
            // return;
            // }

            if (decimal.compareTo(BigDecimal.valueOf(i)) > 0) {
                System.out.println(s[(int) i]);
                return;
            }
            System.out.println(1);
        }
    }
}


Measured memory_bytes: 23380
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;

int solver(string s){

    int N = s.size();
    string buf = s;

    int del;
    if(N == 2) return 1;
    else if(N%2 == 0) del = 2;
    else del = 1;

    int ans = 0;
    while(N-del < N){
        string l, r;
        for(int j = 0; j != (N-del)/2; ++j) l += buf.at(j);
        for(int k = (N-del)/2; k != N-del; ++k) r += buf.at(k);
        del += 2;

        if(l == r){
            ans = l.size() + r.size();
            break; 
        }
    }

    return ans;
}

int solver2(string s){

    int N = s.size();

    int del = 0;
    if(N == 2) return 2; 
}

int main(){

    string s;
    cin >> s;

    cout << solver(s) << endl;
    cerr << solver2(s) << endl;
    
    return 0;
}

Measured memory_bytes: 3656
#include<iostream>
#include<cstdlib>
#include<cstdio>
using namespace std;
int n;
int main()
{
 cin>>n;
 if(n<2) {cout<<1<<endl;exit(0);}
 if(n<4) {cout<<2<<endl;exit(0);}
 if(n<8) {cout<<4<<endl;exit(0);}
 if(n<16) {cout<<8<<endl;exit(0);}
 if(n<32) {cout<<16<<endl;exit(0);}
 if(n<64) {cout<<32<<endl;exit(0);}
 cout<<64<<endl;
 return 0;
}

Measured memory_bytes: 256
package main

// https://atcoder.jp/contests/agc003/tasks/agc003_a
// 東西と南北は独立
// aをEの出現回数, bをWの出現回数としたとき、
// a*m - b*n = 0 となるようなmとnがあるか？
// つまり aとbの最小公倍数が見つかればよい。

import (
	"fmt"
)

func gcd(a, b int) int {
	if b == 0 {
		return a
	}
	return gcd(b, a%b)
}

func lcm(a, b int) int {
	return a * b / gcd(a, b)
}

func check(a, b int) bool {
	if a == 0 && b == 0 {
		return true
	} else if lcm(a, b) > 0 {
		return true
	}
	return false
}

func solve(str string) {
	n := 0
	w := 0
	s := 0
	e := 0
	for i := 0; i < len(str); i++ {
		switch str[i] {
		case 'N':
			n++
		case 'W':
			w++
		case 'S':
			s++
		case 'E':
			e++
		}
	}
	if check(n, s) && check(w, e) {
		fmt.Println("Yes")
	} else {
		fmt.Println("No")
	}
}

func main() {
	var s string
	fmt.Scanf("%s", &s)
	solve(s)
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
#define ll long long
#define ld long double
#define endl "\n"
using namespace std;

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

    int n,m;
    cin >> n >> m;
    int arr[n];

    int sum=0;
    for (int i=0;i<=n-1;i++)
    {
        cin >> arr[i];
        sum=sum+arr[i];
    }    

    int min=ceil((float)((float)sum/(float)(4*m)));
    int count=0;
    for (int i=0;i<=n-1;i++)
    {
        if (arr[i]>=min)
        {
            count++;
        }
    }

    if (count>=m)
    {
        cout << "Yes" << endl;
    }
    else
    {
        cout << "No" << endl;
    }

    return 0;
}


Measured memory_bytes: 256
N, M = map(int, input().split())
G = [[] for _ in range(N)]
res = [""] * M
for i in range(M):
    p, y = map(int, input().split())
    G[p - 1].append((y, i))

G = list(map(sorted, G))
for p in range(N):
    for m, (y, i) in enumerate(G[p], 1):
        res[i] = 10 ** 12 + (p + 1) * 10 ** 6 + m

for r in res:
    print(str(r)[1:])


Measured memory_bytes: 40016
import sys
import math
sys.setrecursionlimit(10**6)
# input = sys.stdin.readline
ii = lambda: int(input())
mis = lambda: map(int,input().split())
lmis = lambda: list(mis())
INF = float('inf')

def main():
    n=ii()
    pay=n/1.08
    if int(int(pay)*1.08)==n:
        print(int(pay))
    elif int(math.ceil(pay)*1.08)==n:
        print(math.ceil(pay))
    else:
        print(':(')


if __name__ == "__main__":
    main()

Measured memory_bytes: 3064
#include <iostream>
#include <iomanip>
#include <vector>
#include <set>
#include <string>
#include <queue>
#include <algorithm>
#include <map>
#include <cmath>
#include <numeric>
#include <list>
#include <stack>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <tuple>
#include <deque>
#include <complex>
#include <bitset>

using namespace std;

typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int, int> pii;
typedef vector<pii> vpii;

typedef long long ll;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef pair<long long, long long> pll;
typedef vector<pll> vpll;

typedef long double ld;
typedef vector<ld> vld;

typedef vector<bool> vb;

#define rep(i, n) for (ll i = 0; i < (n); i++)
#define reps(i, n) for (ll i = 1; i <= (n); i++)
#define rrep(i, n) for (ll i = (n) - 1; i >= 0; i--)
#define rreps(i, n) for (ll i = (n); i >= 1; i--)
#define all(v) (v).begin(), (v).end()

template <class T> void chmin(T& a, T b) { a = min(a, b);}
template <class T> void chmax(T& a, T b) { a = max(a, b);}

constexpr int INF = 1 << 30;
constexpr ll INFL = 1LL << 60;
constexpr ll MOD = 1000000007;
constexpr ld EPS = 1e-12;
ld PI = acos(-1.0);

void solve() {
    ll n, a, b;
    cin >> n >> a >> b;
    if(a * b < n || a + b - 1 > n) {
        cout << -1 << endl;
        return;
    }
    ll rem = a * b - n;
    vll v;
    rep(i, b) v.push_back(b - i);
    for(int i = 1; i < a; ++i) {
        v.push_back(b * (i + 1));
        if(rem >= b - 1) {
            rem -= b - 1;
        }
        else if(rem > 0) {
            rep(j, b - 1 - rem) v.push_back(b * (i + 1) - j - 1);
            rem = 0;
        }
        else {
            rep(j, b - 1) v.push_back(b * (i + 1) - j - 1);
        }
    }
    vll v2 = v;
    sort(v2.begin(), v2.end());
    for(ll i : v) {
        ll j = lower_bound(v2.begin(), v2.end(), i) - v2.begin() + 1;
        cout << j << ' ';
    }
    cout << endl;
    return;
}

int main() {
    std::cin.tie(nullptr);
    std::ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    solve();
}

Measured memory_bytes: 8156
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import accumulate, permutations, combinations, product
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

N, M , W = MAP()
A = LIST()
B = LIST()

sa = sum(A)
sb = sum(B)
A.reverse()
C = A + B
# print(C)
ans = 0
left_wa = 0
right_wa = 0


ruiseki = C.copy()
ruiseki = [0] + ruiseki
for i in range(len(ruiseki)-1):
    ruiseki[i+1] = ruiseki[i] + ruiseki[i+1]
# print(ruiseki)
left = 0
# for right in range(1, len(C)+1):
#     ruiseki[left:right]
idx = 0
wa = 0
ans = 0
# print(len(ruiseki))
for right in range(len(A), len(ruiseki)):
    # idx += 1
    # print("right:", right)
    wa = ruiseki[right] - ruiseki[left]
    # if
    while wa > W:
        left += 1
        wa = ruiseki[right] - ruiseki[left]
    if left <= len(A):
        tmp = right - left
        # print(tmp)
        ans = max(tmp, ans)
    else:
        break
    # print("left, right, :", left, right)

print(ans)



Measured memory_bytes: 53728
#pragma target("avx")
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> P;
typedef vector<ll> V;
typedef unordered_map<ll, ll> U_MAP;
typedef priority_queue<ll> pq;
typedef priority_queue<ll, vector<ll>, greater<ll>> rpq;
const int INF = 1e9, MOD = 1e9 + 7, ohara = 1e6 + 10;
const ll LINF = 1e18;

#define rep(i, n) for (ll(i) = 0; (i) < (int)(n); (i)++)
#define rrep(i, a, b) for (ll i = (a); i < (b); i++)
#define rrrep(i, a, b) for (ll i = (a); i >= (b); i--)
#define all(v) (v).begin(), (v).end()
#define Size(n) (n).size()
#define Cout(x) cout << (x) << endl
#define doublecout(a) cout << fixed << setprecision(15) << a << endl;
#define fi first
#define se second
#define m_p make_pair
#define p_b push_back

//------ Believe yourself as a genius!!!!!! ------

int dy[] = {1, 0, -1, 0};
int dx[] = {0, 1, 0, -1};
// int dy[]={-1,0,1,-1,1,-1,0,1};int dx[]={-1,-1,-1,0,0,1,1,1};
string alph("abcdefghijklmnopqrstuvwxyz"), s;
ll n, cnt, ans, a[ohara], b, c, d, tmp, m, h, w, x, y, sum, k, q;

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

  cin >> n;
  rep(i, n - 1) cin >> a[i];
  rep(i, n) {
    if (i == 0)
      ans += a[i];
    else if (i == n - 1) {
      ans += a[i - 1];
    } else {
      ans += min(a[i], a[i - 1]);
    }
  }
  Cout(ans);
  return 0;
}

Measured memory_bytes: 764
import java.io.*;
import java.util.*;

class Main {

    public static void main(String[] args) throws Exception {
        final Scanner sc = new Scanner(System.in);
        long N;
        N = sc.nextLong();
        solve(N);
    }

    static void solve(long N){
        double ans;
        double N2 = (double)N;
        if(N2%2==0){
            ans = 0.5;
        } else {
            ans = ((N2+1)/2) * 1.0 / N2;
        }
        System.out.println(ans);

    }
}


Measured memory_bytes: 23764
N=gets.to_i
ps=gets.split.map(&:to_i)
qs=gets.split.map(&:to_i)
idx=1
a=0
b=0
(1..N).to_a.permutation(N) do |es|
   a=idx if ps==es 
   b=idx if qs==es 
   idx+=1
end
puts (a-b).abs

Measured memory_bytes: 2172
#include <stdio.h>
#include <math.h>
int main(void) {

  int n;
  scanf("%d", &n);

  int count;
  int min = 100;
  
  for (int i= 0; i < n; i++) {
    int a;
    scanf("%d",&a);
    count = 0;
    while (a % 2 == 0) {
      a = a / 2;
      count++;
    } 
    if (min < count) {
      continue;
    } else {
      min = count;
    }
  }
  printf("%d", min);
}

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

int main() {
    int k, n;
    cin >> k >>  n;
    vector<int> A(n, 0);
    for (int i = 0; i < n; ++i) {
      cin >> A[i];
    }
    sort(A.begin(), A.end());
    int ans = A[n-1] - A[0];
    for (int i = 1; i < n; ++i) {
      ans = min(ans, k-A[i]+A[i-1]);
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n)for(int i=0;i<(n);i++)
#define ALL(a) (a).begin(), (a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define pb push_back
using ll = long long;
using P = pair<int, int>;

int main(){
    int n; cin >> n;
    int tmp = n%10;
    if(tmp == 3) cout << "bon" << endl;
    else if(tmp == 0 || tmp == 1 || tmp == 6 || tmp == 8) cout << "pon" << endl;
    else cout << "hon" << endl;
}

Measured memory_bytes: 3632
#include<bits/stdc++.h>
using namespace std;
using ll=long long;
#define fr(i,n) for(int i=0;i<(n);++i)
#define Fr(i,n) for(int i=1;i<=(n);++i)
#define ifr(i,n) for(int i=(n)-1;i>=0;--i)
#define iFr(i,n) for(int i=(n);i>0;--i)

template<class T> struct STree{
    int n;
    T e;
    vector<T> dat;

    inline T f(T x,T y){
        return min(x,y);
    }

    STree(int n_,T e_){
        n=1;e=e_;
        while(n<n_) n<<=1;
        dat.resize((n<<1),e);
    }

    STree(vector<T> v,T e_){
        int n_=v.size();
        n=1;e=e_;
        while(n<n_) n<<=1;
        dat.resize((n<<1),e);
        for(int i=0;i<n_;++i) dat[i+n]=v[i];
        for(int i=n-1;i>0;--i) dat[i]=f(dat[(i<<1)],dat[(i<<1)^1]);
    }

    void ud(int k,T c){
        k+=n;
        dat[k]=c;
        while(k){
            dat[k>>1]=f(dat[k],dat[k^1]);
            k>>=1;
        }
    }

    T gt(int l,int r){
        l+=n;r+=n;
        T s=e;
        while(l<r){
            if(r&1){
                --r;
                s=f(s,dat[r]);
            }
            if(l&1){
                s=f(s,dat[l]);
                ++l;
            }
            l>>=1,r>>=1;
        }
        return s;
    }

    T operator[](int i){return dat[i+n];}
};

int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    istream& in(cin);
    ostream& out(cout);
    int n,q,c,x,y;
    in>>n>>q;
    STree<int> st(n,INT_MAX);
    fr(i,q){
        in>>c>>x>>y;
        if(c) cout<<st.gt(x,y+1)<<endl;
        else st.ud(x,y);
    }

}


Measured memory_bytes: 3884
d,g=gets.split.map(&:to_i)
rule=[]
d.times do 
  rule << gets.split.map(&:to_i)
end
list=Array.new
d.downto(1) do |i|
  list << i
end
min=Float::INFINITY
0.upto(d) do |i|
  [*1..d].combination(i) do |order|
    cnt=0
    pts=0
    chk=0
    order.each do |i|
      pts += rule[i-1][0]*100*i+rule[i-1][1]
      cnt += rule[i-1][0]
    end

    list.each do |elem|
      unless order.include?(elem)
        @tmp = elem
        break
      end
    end
    if (pts + rule[@tmp-1][0]*@tmp*100) > g && pts < g
      cnt += ((g-pts)/(100.0*@tmp)).ceil
      if cnt < min
        min=cnt
      end
    elsif pts >= g && cnt < min
        min=cnt
    end
  end
end

puts min


Measured memory_bytes: 1788
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < n; i++)
#define rep1(i,n) for(int i = 1; i <= n; i++)
#define co(x) cout << x <<endl
#define cs(x) cout << x <<" "
#define ALL(a) (a).begin(),(a).end()
typedef long long ll;
using namespace std;
ll mod = 998244353;

ll power(ll a, ll b)
{
	ll res = 1;
	rep(i, b)
	{
		res *= a;
		res %= mod;
	}
	return res;
}

int main()
{
	int n; cin >> n;
	vector<int> a(n, 0);
	rep(i, n)
	{
		int d; cin >> d;
		if (i == 0 && d != 0)
		{
			co(0);
			return 0;
		}
		a[d]++;
	}
	ll ans = 1;
	if (a[0] != 1)
	{
		ans = 0;
	}
	else
	{
		rep(i, n-1)
		{
			ans *= power(a[i], a[i + 1]);
			ans %= mod;
		}
	}
	ans %= mod;
	co(ans);
	return 0;
}

Measured memory_bytes: 640
#include <stdio.h> 
 #include <math.h> 
 #define MAX 1000 
  
  
 int main(){ 
     int n; 
     int i, j=0, sum; 
     int score[MAX]; 
     double ave, tmp; 
     double dev[MAX]; 
  
  
     while(1){ 
         scanf("%d", &n); 
         if(n==0)break; 
         sum=0; 
         for(i=0;i<n;i++){ 
             scanf("%d", &score[i]); 
             sum+=score[i]; 
         } 
         ave=(double)sum/(double)n; 
         tmp=0.0; 
         for(i=0;i<n;i++){ 
             tmp+=pow(score[i]-ave, 2); 
         } 
         dev[j++]=sqrt(tmp/(double)n); 
     } 
     for(i=0;i<j;i++){ 
         printf("%f\n", dev[i]); 
     } 
     return 0; 
 }


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

using namespace std;

constexpr char endl('\n');



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

    size_t m, n, s;
    cin >> n >> m;

    vector<size_t> a(n);
    s = 0;
    for (auto i = 0; i < n; ++i) {
        cin >> a.at(i);
        s += a.at(i);
    }

    size_t t = (4 * m);

    size_t th = s / t;
    if (s % t != 0) {
        th += 1;
    }


    std::sort(a.begin(), a.end(), [](size_t a, size_t b) {
        return a > b;
        });
    if (a.at(m - 1) < th) {
        cout << "No" << ::endl;
    }
    else {
        cout << "Yes" << ::endl;
    }
    

    return 0;
}


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

int main() {
  long long N;
  cin >> N;
  
  vector<char> C(N);
  for (int i=0; i<N; i++){
    cin >> C[i];
  }
  
  long long left = 0;
  long long right = N-1;
  long long count = 0;
  
  while(true) {
    for (int i=left; i<=N; i++){
      left = i;
      if (i == N) {
        break;
      }
      if (C[i] == 'W') {
        break;
      }
    }
    for (int i=right; i>=-1; i--){
      right = i;
      if (i == -1) {
        break;
      }
      if (C[i] == 'R') {
        break;
      }
    }
    if (right == -1) {
      break;
    }
    if (left == N) {
      break;
    }
    
    if (left < right) {
      //cout << "left" << left << endl;
      //cout << "right" << right << endl;
      count++;
    }
    
    left++;
    right--;
  }
  
  cout << count << endl;
  
  return 0;
}

Measured memory_bytes: 3624
/***"In the name of Allah(swt), the most gracious, most merciful. Allah(swt) blesses with knowledge whom he wants."***/
/*** "ALHAMDULILLAH for Everything..." ***/
#include<bits/stdc++.h>
using namespace std;
#define  fastt       ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define  ll         long long
#define  debug      printf("Come here!")
#define  inf        1000000000000000000
#define  pb         push_back
#define  mp         make_pair
#define  sz(a)      a.size()
#define  mem(a,b)   memset(a,b,sizeof(a))
#define  clr(x)     x.clear()
#define  ff         first
#define  ss         second
#define  case(x)    cout << "Case " << x <<": "

#define  md         1000000007
#define  pi         acos(-1.0)
#define  cos(a)     cos(a*pi/180)
#define  sin(a)     sin(a*pi/180)
#define  tan(a)     tan(a*pi/180)
#define  cosi(a)    acos(a)/(pi/180)
#define  sini(a)    asin(a)/(pi/180)
#define  tani(a)    atan(a)/(pi/180)

#define  vl         vector <ll>
#define  vs         vector <string>
#define  vc         vector <char>
#define  vpll       vector < pair <ll, ll> >
#define  vpsl       vector < pair <string, ll> >
#define  vpls       vector < pair <ll, string> >
#define  pql        priority_queue<ll>
#define  minpql     priority_queue<ll,vector<ll>,greater<ll> >

#define  setbits(x)     __builtin_popcountll(x)
#define  zerobits(x)    __builtin_ctzll(x)

#define toll(a) atoll(a.c_str())
string tostr(ll a) {stringstream rr;rr<<a;return rr.str();}
ll pow(ll c,ll d){return d==0?:c*pow(c,d-1);}
ll gcd(ll a,ll b) {return b==0? a:gcd(b,a%b);}
ll lcm(ll a,ll b) {return ((a*b)/gcd(a,b));}

/* mpp.max_load_factor(0.25); mpp.reserve(1024); */
/* cout << fixed << setprecision(12);*/

int main()
{
    fastt;
    ll n, m, k, i, j, x, y, p=0, s=0, h, f=inf;
    cin>>n;
    ll a[n];
    for(i=0; i<n; i++){
        cin>>a[i];
        if(a[i]>s){
            s=a[i];
            p=i;
        }
    }
    k=s/2;
    for(i=0; i<n; i++){
        if(i==p)continue;
        h=abs(a[i]-k);
        if(h<=f){
            if(h==f){
                if(a[i]>k){
                    x=a[i];
                }
            }
            else{
                f=h;
                x=a[i];
            }

        }
    }
    cout<<s<<" "<<x<<endl;

    return 0;
}



Measured memory_bytes: 4404
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define leading zero str.erase(0, min(str.find_first_not_of('0'), str.size()-1));
using namespace __gnu_pbds;
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
string text="abcdefghijklmnopqrstuvwxyz";
const int maxn=1e6+7;
//        .--------------.
//        | Try First One|
//        '--------------'
//                |     .--------------.
//                |     |              |
//                V     V              |
//              .--------------.       |
//              |      AC.     |<---.  |
//              '--------------'    |  |
//              (True)|  |(False)   |  |
//           .--------'  |          |  |
//           |           V          |  |
//           |  .--------------.    |  |
//           |  |   Try Again  |----'  |
//           |  '--------------'       |
//           |                         |
//           |  .--------------.       |
//           '->| Try Next One |-------'
//              '--------------'
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
    int n,k;
	cin>>n>>k;
	vector<int>val(n);
	vector<int>arr(n);
	int sum=0;
	for(int i=0;i<n;i++){
		cin>>val[i]>>arr[i];
		sum+=arr[i];
	}
	vector<long long>dp(sum+1,1e9+1);
	dp[0]=0;
		for(int j=0;j<n;j++){
			for(int i=sum;i>0;i--){
			if(i-arr[j]>=0) dp[i]=min(dp[i],dp[i-arr[j]]+val[j]);
		}
	}
	ll ans=1e9+1;
	for(int i=0;i<=sum;i++)if(dp[i]<=k)ans=i;
	cout<<ans;
}


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

int main() {
  int N, D;
  cin >> N >> D;
  
  vector<vector <int>> X;
  for (int i=0; i < N; i++) {
    vector<int> x;
    for (int j=0; j < D; j++) {
      int tmp;
      cin >> tmp;
      x.push_back(tmp);
    }
    X.push_back(x);
  }
  
  int result = 0;
  for (int i=0; i<N; i++) {
    for (int j=i+1; j<N; j++) {
      double ans = 0;
      for (int k=0; k<D; k++) {
        ans += pow(X[i][k] - X[j][k], 2);
      }
      ans = sqrt(ans);
      if (ans - int (ans) == 0) result++;
    }
  }
  
  
  cout << result << endl;
  
  return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
int main(void)
{
	int a,b,c,x;
	scanf("%d %d %d",&a,&b,&c);
	if(b<a){
		x=b;
		b=a;
		a=x;
	}
	if(c<b){
		x=c;
		c=b;
		b=x;
	}
	if(b<a){
		x=b;
		b=a;
		a=x;
	}
	printf("%d %d %d\n",a,b,c);
	return 0;
}

Measured memory_bytes: 596