akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
/*
#include <iostream>
#include <string>
#include <map>
#include <queue>
#include <stack>
#include <algorithm>
#include <list>
#include <set>
#include <cmath>
#include <cstring>

#include <stdio.h>
#include <string.h>
#include <sstream>
#include <stdlib.h>
#include <vector>
#include <iomanip>
#include <ctime>
*/
#define nl "\n"
#define F first
#define S second
#define mp make_pair
#define pb push_back
#define p_un(a) ((void)a)
#define p_st(a) string(a)
#define sz(a) (int)a.size()
#define all(a) a.begin(), a.end()
#define naj ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define NL cout << endl;
#define sqr(x) (sqrt(x) * 1LL)
#define pcnt(i) __builtin_popcount(i)
#define up_b upper_bound
#define low_b lower_bound
#define lcm(a,b) (a * b) / __gcd(a, b)
#define REVERSE(a, n) reverse(a + 1, a + n + 1);
#define SORT(a, n) sort(a + 1, a + n + 1);
#define rsz resize

using namespace std;

typedef long long ll;
typedef long double ld;
typedef unsigned long long ul;
typedef vector <ll> vl;
typedef vector <bool> vb;
typedef vector <char> vc;
typedef vector <int> vi;
typedef vector <string> vs;
typedef pair <ll, ll> pll;
typedef map <ll, ll> mll;
typedef set <ll> sl;
typedef set <char> sc;
typedef map <string, ll> msl;
typedef map <string, bool> msb;
typedef map <char, ll> mcl;
typedef map <string, string> mss;
typedef vector <vl> vvl;

const ll mxn = 1e6 + 1;
const ll mod = 1e9 + 7;
const ll inf = 1e18;
const ld eps = 1e-9;
const ld PI = acos(-1);
const ld E = 2.71828;

#define int int64_t
#define FLN "inverse"

//int dx[]= {1,0,-1,0}; int dy[]= {0,1,0,-1}; //4 Direction
//int dx[]={1,1,0,-1,-1,-1,0,1}; int dy[]={0,1,1,1,0,-1,-1,-1};//8 direction
//int dx[]={2,1,-1,-2,-2,-1,1,2}; int dy[]={1,2,2,1,-1,-2,-2,-1};//Knight Direction
//int dx[]={-1,-1,+0,+1,+1,+0}; int dy[]={-1,+1,+2,+1,-1,-2}; //Hexagonal Direction

inline void joji(bool ok = 0) {naj;if(ok){freopen(FLN".in","r",stdin);freopen(FLN".out","w",stdout);}}

vector <pair <int, int> > v;

main () {

	joji();
	string s, t, u; int a, b;
	cin >> s >> t >> a >> b >> u;
	if(u == t) b --;
	if(u == s) a --;
	cout << a << ' ' << b;
	return 0;
}





        
                                                             


Measured memory_bytes: 256
#include <bits/stdc++.h>
using ll = long long;
using namespace std;
ll mod=1e9;

int main(){
  string s;
  cin>>s;
  int n=s.size();
  ll cnt(0),ans(0);
  for (int i(0);i<n;i++){
    if (s[i]=='W') {
      ans+=(i-cnt);
      cnt++;
    }
  }
  cout << ans << endl;
  return 0;
}



Measured memory_bytes: 640
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<cmath>
#include<cstdlib>
#include<tuple>
#include<iomanip>
#include<map>
#include<queue>
#define int long long
using namespace std;
const int INF = 1e10;
const int ZERO = 0;
int gcd(int a,int b) {
	if(a < b) {
		int tmp = a;
		a = b;
		b = tmp;
	}
	int r = a % b;
	while(r != 0) {
		a = b;
		b = r;
		r = a % b;
	}
	return b;
}
signed main() {
	int N;
	cin >> N;
	vector<int> vec(N);
	for(int i = 0;i < N;i++) {
		cin >> vec.at(i);
	}
	double L = vec.at(0);
	for(int i = 1;i < N;i++) {
		int tmp = gcd(L,vec.at(i));
		L = L * vec.at(i) / tmp;
	}
	double G = 0;
	for(int i = 0;i < N;i++) {
		G += L / vec.at(i);
	}
	double answer = L / G;
  cout << fixed; 
	cout << setprecision(9) << answer << endl;
}

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

// ただの辺
struct edge {
    int to;
    long long cost;
    // 引数一つの時は距離1
    edge(int t, long long c = 1) : to(t), cost(c) {}
};

// a^n mod pを計算　O(log n)
long long pow_mod(long long a, long long n, long long p) {
    if (n == 0) return 1;
    if (n & 1) return pow_mod(a, n - 1, p) * a % p;
    long long temp = pow_mod(a, n / 2, p);
    return temp * temp % p;
}

// Z_pでのaの逆元を計算 O(log p)
// depend:pow_mod
long long inv_mod(long long a, long long p) {
    return pow_mod(a, p - 2, p);
}

// nCr mod p(n<p)をキビキビ計算する
// 構築:O(n), クエリ:O(1)
struct combination_mod {
    using lint = long long int;
    int sz;
    lint mod;
    vector<lint> fac;
    vector<lint> finv;
    combination_mod(int _sz, lint _mod) : sz(_sz), mod(_mod) {
        fac.assign(sz + 1, 1);
        finv.assign(sz + 1, 1);
        vector<lint> inv(sz + 1, 1);
        for (int i = 2; i <= sz; i++) {
            fac[i] = fac[i - 1] * i % mod;
            inv[i] = mod - inv[mod % i] * (mod / i) % mod;
            finv[i] = finv[i - 1] * inv[i] % mod;
        }
    }
    lint query(int n, int r) {
        return fac[n] * (finv[r] * finv[n - r] % mod) % mod;
    }
};

int n;
const lint mod = 1e+9 + 7;
vector<vector<edge>> g;
vector<lint> base;
vector<lint> num;
vector<lint> ans;
combination_mod comb(300000, mod);

void dfs1(int now, int par) {
    int res = 1;
    for (auto e : g[now]) {
        if (e.to == par) continue;
        dfs1(e.to, now);
        res += num[e.to];
    }
    num[now] = res;
}

void dfs2(int now, int par) {
    lint res = 1;
    int rem = num[now] - 1;
    for (auto e : g[now]) {
        if (e.to == par) {
            continue;
        }
        dfs2(e.to, now);
        res = res * base[e.to] % mod * comb.query(rem, num[e.to]) % mod;
        rem -= num[e.to];
    }
    base[now] = res;
}

void dfs3(int now, int par, lint rev) {
    lint res = rev * comb.fac[n - 1] % mod * comb.finv[n - num[now]] % mod;
    for (auto e : g[now]) {
        if (e.to == par) continue;
        res = res * comb.finv[num[e.to]] % mod * base[e.to] % mod;
    }
    ans[now] = res;
    res = res * comb.finv[n - 1] % mod;
    for (auto e : g[now]) {
        if (e.to == par) continue;
        lint next_rev = res * comb.fac[n - num[e.to] - 1] % mod * inv_mod(base[e.to], mod) % mod *
                        comb.fac[num[e.to]] % mod;
        dfs3(e.to, now, next_rev);
    }
}

int main() {
    cin >> n;
    g.resize(n);
    for (int i = 0; i < n - 1; i++) {
        int a, b;
        cin >> a >> b;
        a--, b--;
        g[a].push_back(b);
        g[b].push_back(a);
    }
    base.resize(n);
    num.resize(n);
    ans.resize(n);
    dfs1(0, -1);
    dfs2(0, -1);
    dfs3(0, -1, 1);
    for (auto e : ans) {
        cout << e << endl;
    }
}

Measured memory_bytes: 27096
//#include <bits/stdc++.h>
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstdlib>
#include <string>
#include <vector>
#include <map>
#include <queue>

using namespace std;

typedef long long ll;
typedef vector<int> vint;
typedef vector<vector<int> > vvint;
typedef vector<long long> vll, vLL;
typedef vector<vector<long long> > vvll, vvLL;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) for(int i=0;i<n;++i)
#define mod (ll)(1e9+7)
#define FIX(a) ((a)%mod+mod)%mod
#define ALL(obj) (obj).begin(), (obj).end()
#define rALL(obj) (obj).rbegin(), (obj).rend()
#define INF 1000000000 //1e9
#define LLINF 2000000000000000000LL //2e18
#define fi first
#define se second
#define pb push_back
int dy[]={0, 0, 1, -1};
int dx[]={1, -1, 0, 0};

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int a,b;
    cin >> a >> b;
    int ans = max({a+b,a-b,a*b});
    cout << ans << endl;
    
    return 0;
}

Measured memory_bytes: 256
x,y,a,b=map(int,input().split())
a=a-x ; b=b-y 

ans="R"*a + "U"*b + "L"*a + "D"*(b+1) + "R"*(a+1) + "U"*(b+1) + "L"
ans+="U" + "L"*(a+1) + "D"*(b+1) + "R"
print(ans) 



Measured memory_bytes: 9092
#include<bits/stdc++.h>
#include<math.h>
using namespace std;
#define endl "\n"
#define PI 3.141592653589793238
#define ld long double 
ld calangle(ld h, ld m)  
{  
  
    if (h == 12) h = 0;  
    if (m == 60) m = 0;   
    ld  hour_angle = 0.5 * (h * 60 + m);  
    ld minute_angle = 6 * m;  
  
    ld angle = abs(hour_angle - minute_angle);   
    //angle = min(360 - angle, angle);  
  
    return angle;  
}  
int main()
{
  ld a,b,h,m;
  cin>>a>>b>>h>>m;
  ld angle=calangle(h,m);
  ld result = cos ( angle * PI / 180.0 );
  //cout<<cos(angle)<<endl;
  //double  ans = sqrt((pow(a,2))+(pow(b,2))-(2*a*b*result));
  cout<<setprecision(20)<<(ld)sqrt((pow(a,2))+(pow(b,2))-(2*a*b*result))<<endl;
}

Measured memory_bytes: 4160
#include <bits/stdc++.h>
#include <cassert>
typedef long long int ll;
using namespace std;

#define DEBUG 0

#if DEBUG
  #define DLOG(...) fprintf(stderr, __VA_ARGS__)
#else
  #define DLOG(...)
#endif

void debug(auto f) {
#if DEBUG
  f();
#endif
}

ll N, K;
string S;
vector<ll> one, zero;

void s_cnt(ll& res, ll& idx, char req) {
  DLOG("IN: s_cnt(%lld, %lld, %c)\n", res, idx, req);
  res = 0;
  while (idx < N && S.at(idx) == req) {
    idx++;
    res++;
  }
  DLOG("OUT: s_cnt: res = %lld, idx = %lld\n", res, idx);
}

int main() {
#if !DEBUG
  ios_base::sync_with_stdio(false);
#endif

  cin >> N >> K >> S;
  DLOG("S = %s\n", S.c_str());
  ll idx = 0;
  ll i = 0;
  one.resize(N+1);
  zero.resize(N+1);
  while (idx < N) {
    s_cnt(one.at(i),  idx, '1');
    s_cnt(zero.at(i), idx, '0');
    DLOG("zero.at(%lld) = %lld; idx = %lld\n", i, zero.at(i), idx);
    i++;
  }
  DLOG("there\n");
  one.at(i) = zero.at(i) = 0;
  ll intvSize = i + 1;
  ll val = 0;
  for (ll i = 0; i < min(K, intvSize); i++) {
    val += one.at(i) + zero.at(i);
  }
  if (K < intvSize)  val += one.at(K);
  ll ans = val;
  for (ll i = K; i < intvSize - 1; i++) {
    ll diff = zero.at(i) + one.at(i+1) - (one.at(i-K) + zero.at(i-K));
    val += diff;
    ans = max(ans, val);
  }
  cout << ans << endl;
  

  return 0;
}



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

int main()
{
  ll a,b,m;
  cin>>a>>b>>m;
  ll ai[a];
  ll dup[a];
  for (int i = 0; i < a; ++i)
  {
    cin>>ai[i];
    dup[i]=ai[i];
  }
  sort(dup,dup+a);
  ll bi[b];
  ll dup2[b];
  for (int i = 0; i < b; ++i)
  {
    cin>>bi[i];
    dup2[i]=bi[i];
  }
  sort(dup2,dup2+b);
  ll sum=dup[0]+dup2[0];
  for (int i = 0; i < m; ++i)
  {
    ll x,y,c;
    cin>>x>>y>>c;
   // cout<<ai[x-1]<<"  "<<bi[y-1]<<"  "<<c<<endl;
    ll mid=ai[x-1]+bi[y-1]-c;
    sum=min(sum,mid);
  }
  cout<<sum<<endl;
}

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

using namespace std;

typedef long long int ll;
typedef long double ld;

int main(){
	ios_base::sync_with_stdio(false);
    cin.tie(NULL); cout.tie(NULL);
    
	string str;
	set<char> s;
	
	cin >> str;
	
	for(int i = 0; i < 4; i++){
		s.insert(str[i]);
	}
	
	if(s.size() == 2){
		cout << "Yes" << endl;
	}
	else{
		cout << "No" << endl;
	}
	
	return 0;
}




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

using namespace std;

int main()
{
//    freopen("int.txt","r",stdin);

    int a,c,b;
    while(cin>>a>>b>>c)
    {
        int divisors=0;
        for(int i=a;i<=b;i++)
        {
            if(c%i==0)
                divisors++;
        }
        cout<<divisors<<endl;
    }
}



Measured memory_bytes: 3112
#include<algorithm>
#include <iostream>
#include<cstdio>
#include<cmath>
#include<iomanip>
#include<string>
using namespace std;
int main(){
    
    int n;
    cin>>n;
    int a[n];
    for(int i=0;i<n;i++){
        cin>>a[i];
    }
   
    int count=0;
    int h=0;
    
    
    for(int j=0;1==1;j++){
    for(int i=0;i<n;i++){
        if(a[i]%2==1){
            h=1;
            
        }
    }
    if(h==0){
        for(int i=0;i<n;i++){
            a[i]/=2;
            count+=1;
        }
    }else{
        cout<<count/n<<endl;
        return 0;
    }
        
    }
    
    return 0;
}









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

int main() {
  long long A[3];
  cin >> A[0] >> A[1] >> A[2];
  sort(A, A + 3);
  if (A[0] % 2 == 0 || A[1] % 2 == 0 || A[2] % 2 == 0)
    cout << 0 << endl;
  else
    cout << A[0] * A[1] << endl;
}

Measured memory_bytes: 256
object Main extends App {
  val in = scala.io.Source.stdin.getLines.toSeq
  val S = in.head.toArray
  var c0 = 0
  var c1 = 0
  var i = 0
  while(i < S.size){
    if(S(i)-'0' == (i%2) ) c0 += 1 else c1+= 1
    i += 1
  }
  val ret = Math.min(c0, c1)
  println(ret)
}


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

public class Main {

	private static int[] cal = { 0, 31, 60, 91, 121, 152, 182, 213, 244, 274,
			305, 335 };

	private static String[] day = { "Wednesday", "Thursday", "Friday",
			"Saturday", "Sunday", "Monday", "Tuesday" };

	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String line = "";

		while ((line = br.readLine()) != null) {
			if (line.equals("0 0"))
				break;

			int m = Integer.parseInt((line.split(" ")[0])) - 1;
			int d = Integer.parseInt((line.split(" ")[1]));
			System.out.println(day[(cal[m] + d) % 7]);
		}
	}
}

Measured memory_bytes: 16944
/*
title:

url:
*/

#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <functional>
#include <queue>
#include <limits>
#include <string>
#include <utility>
#include <cstring>
#include <map>
#include <cmath>

using namespace std;

#define REP(i, n) for (int i = 0; i < (n); i++)
#define INF 1000000007

typedef pair<int, int> pint;
typedef long long ll;

int main()
{
    int a, b, c, d;
    cin >> a >> b >> c >> d;
    cout << min(a, b) + min(c, d) << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <queue>
#include <algorithm>
#include <set>
#include <map>
#include <unordered_map>
#include <cmath>
#include <bitset>
#include <cstdio>
#include <iomanip>
#include <climits>
#include <string>
#include <sstream>
#include <numeric>
#include <stack>

#define MOD 1000000007
#define MOD2 998244353
#define int long long
#define EPS 1e-9
//#define PI 3.14159265358979

#define rep(i, n) for (int i = 0; i < (int)(n); i++)

using namespace std;

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

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

struct edge {
	int from, to, d, c;
	edge(int _from = 0, int _to = 0, int _d = 0, int _c = 0) {
		from = _from;
		to = _to;
		d = _d;
		c = _c;
	}
	bool operator<(const edge &rhs) const {
		return (d == rhs.d) ? (c < rhs.c) : (d < rhs.d);
	}
};
struct aabb {
	int x1, y1, x2, y2;
	aabb(int x1, int y1, int x2, int y2) : x1(x1), y1(y1), x2(x2), y2(y2) {}
};

typedef vector< edge > edges;
typedef vector< edges > graph;
struct flow {
	int to, cap, rev, cost;
	flow(int to = 0, int cap = 0, int rev = 0, int cost = 0) : to(to), cap(cap), rev(rev), cost(cost) {}
};
typedef vector< vector< flow > > flows;

const int di[4] = {0, -1, 0, 1};
const int dj[4] = {-1, 0, 1, 0};
const int ci[5] = {0, 0, -1, 0, 1};
const int cj[5] = {0, -1, 0, 1, 0};
const ll LINF = LLONG_MAX / 2;
const int INF = INT_MAX / 2;
const double PI = acos(-1);

int pow2(int n) { return 1LL << n; }
template < typename T, typename U >
bool chmin(T &x, const U &y) {
	if (x > y) {
		x = y;
		return true;
	}
	return false;
}
template < typename T, typename U >
bool chmax(T &x, const U &y) {
	if (x < y) {
		x = y;
		return true;
	}
	return false;
}

struct initializer {
	initializer() {
		cout << fixed << setprecision(20);
	}
};
initializer _____;

int N, M, K, T, Q, H, W;
signed main() {
	string S;
	cin >> S;
	N = S.size();
	vector< vector< int > > dp(N + 1, vector< int >(13, 0));
	dp[0][0] = 1;
	rep(i, N) rep(j, 13) {
		int ni = i + 1, nj;
		if (S[i] == '?') {
			rep(k, 10) {
				nj = (j * 10 + k) % 13;
				(dp[ni][nj] += dp[i][j]) %= MOD;
			}
		} else {
			int x = S[i] - '0';
			nj = (j * 10 + x) % 13;
			(dp[ni][nj] += dp[i][j]) %= MOD;
		}
	}
	cout << dp[N][5] << endl;
	return 0;
}

Measured memory_bytes: 13696
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);
		
		int a = sc.nextInt();
		int b = sc.nextInt();
		int c = 0;
		
		if (b>a){
			c = a;
			a = b;
			b = c;
		}
		
		boolean af=false;
		boolean bf=false;
		for (int i=0; i<16; i++){
			if ((a>0) && !af){
				a--;
				af = true;
				bf = false;
			}
			if ((b>0) && !bf){
				b--;
				af = false;
				bf = true;
			}
			if ((af && !bf) || (!af && bf)){
				i++;
				af = false;
				bf = false;
			}
		}
		
		
		if ((a==0) && (b==0)){
			System.out.println("Yay!");
		}
		else {
			System.out.println(":(");
		}
			
			
			
			
			
	}

}


Measured memory_bytes: 22228
#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;

#define watch(x) cout<<(#x)<<"="<<(x)<<'\n'
#define mset(d,val) memset(d,val,sizeof(d))
#define setp(x) cout<<fixed<<setprecision(x)
#define forn(i,a,b) for(int i=a;i<b;i++)
#define fore(i,a,b) for(int i=a;i<=b;i++)
#define pb push_back
#define F first
#define S second
#define INF ll(1e18)
#define MOD 998244353
#define pqueue priority_queue
#define fbo find_by_order
#define ook order_of_key
typedef long long ll;
typedef pair<ll,ll> ii;
typedef vector<ll> vi;
typedef vector<ii> vii;
typedef long double ld;
typedef tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update> pbds;

#define MAXN 100005

bool cmp(ii a,ii b){
	if(a.S!=b.S) return a.S<b.S;
	return a.F<b.F;
}

int main()
{
	ios_base::sync_with_stdio(0); cin.tie(0);
	
	int n; cin>>n;
	ii a[n];
	forn(i,0,n){
		ll x,l; cin>>x>>l;
		a[i]={x-l,x+l};
		//a[i]={x,l};
	}
	
	sort(a,a+n,cmp);
	
	ll dp[n],Max[n];
	forn(i,0,n) dp[i]=Max[i]=1;
	
	forn(i,1,n){
		int L=0,R=i-1,an=-1;
		while(L<=R){
			int mid=(L+R)>>1;
			if(a[mid].S<=a[i].F){
				an=mid; L=mid+1;
			}
			else R=mid-1;
		}
		
		if(an!=-1)	dp[i]=Max[an]+1;
		Max[i]=max(dp[i],Max[i-1]);
	}
	
	//cout<<'\n';
	//forn(i,0,n) cout<<a[i].F<<" "<<a[i].S<<'\n';
	
	ll ans=1;
	forn(i,0,n){
		//if(dp[i]>ans) watch(i);
		ans=max(ans,dp[i]);
	}
	
	cout<<ans<<'\n';
	
	return 0;
}


Measured memory_bytes: 3328
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <vector>
#include <cmath>
#include <iomanip>
#include <bitset>
#include <string>
using namespace std;

typedef long long int ll;
typedef long double ld;



int main(){
    ll a;
    cin >> a;
    if (a<1200){
        cout << "ABC" << endl;
    }else{
        cout << "ARC" << endl;
    }
}

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

int main() {
    string s;
    cin >> s;
    int l = 0, r = s.size() - 1;
    int count = 0;
    bool flag = false;
    while (r - l > 0) {
        if (s[l] == 'x' && s[r] != 'x') {
            count++;
            l++;
        } else if (s[l] != 'x' && s[r] == 'x') {
            count++;
            r--;
        } else if (s[l] == s[r]) {
            l++;
            r--;
        } else {
            flag = true;
            break;
        }
    }
    cout << (flag ? -1 : count) << endl;
}

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

int main(){
	int n;
	cin >> n;
	set<string> data1;
	string tmp;
	while(n--){
		cin >> tmp;
		data1.insert(tmp);
	}		
	int m;
	cin >> m;
	int count = 0;
	while(m--){
		cin >> tmp;
		if(data1.find(tmp) != data1.end()) count++;
	}
	cout << count << endl;
	return 0;
}

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

#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <string>
#include <functional>
#include <math.h>
#include <map>
#include <queue>
#include <stack>

typedef long long ll;
typedef unsigned long long ull;

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define RFOR(i,a,b) for(int i=(b-1);i>=(a);--i)
#define REP(i,n)   FOR(i,0,n)
#define RREP(i,n)   RFOR(i,0,n)
#define SORT(s) sort(s.begin(), s.end())
#define P pair<int, int>
#define mp make_pair

const double INF = 1e+09;
const int MOD = 1e9+7;

using namespace std;

template <typename _Ty>
ostream& operator << (ostream& ostr, const vector<_Ty>& v) {if (v.empty()) {ostr << "{ }"; return ostr;}
    ostr << "{" << v.front(); for (auto itr = ++v.begin(); itr != v.end(); itr++) {ostr << ", " << *itr;}
    ostr << "}";
    return ostr;}

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

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

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

vector<int> uniq(vector<int> vec){
  sort(vec.begin(), vec.end());
  vec.erase(unique(vec.begin(), vec.end()), vec.end());
  return vec;}


int main(void){
  ios::sync_with_stdio(false);
  ll x;
  cin >> x;
  ll tmp = 100;
  ll ans = 0;
  REP(i, 1e+06){
    tmp *= 1.01;
    if (tmp >= x){
      cout << ans+1 << endl;
      break;
    }
    else ans++;
  }
  return 0;
}



Measured memory_bytes: 3656
s,t=input(),input()
ls=len(s)
lt=len(t)
ans=1000000000000
for i in range(ls-lt+1):
    ans_sub=0
    for j in range(lt):
        if t[j]!=s[i+j]:
            ans_sub+=1
    ans=min(ans,ans_sub)
print(ans)

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

using namespace std;

bool test(string s, int n) {
	for(int i = 0; i < n / 2; i++) {
		if(s[i] != s[n - i - 1]) return 0;
	}
	return 1;
}

int32_t main() {
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	
	string s;
	cin >> s;

	int n = s.size();
	bool ok1 = test(string(s.begin(), s.begin() + (n - 1) / 2), n / 2);
	bool ok2 = test(string(s.begin() + (n + 1) / 2, s.end()), n / 2);
	bool ok3 = test(s, n);

	cout << ((ok1 && ok2 && ok3) ? "Yes" : "No");

	return 0;
}



Measured memory_bytes: 256
import itertools


def parse(expr):
    if expr == "P":
        return lambda p, q, r: p
    if expr == "Q":
        return lambda p, q, r: q
    if expr == "R":
        return lambda p, q, r: r
    if expr == "0":
        return lambda p, q, r: 0
    if expr == "1":
        return lambda p, q, r: 1
    if expr == "2":
        return lambda p, q, r: 2
    if expr[0] == "-":
        t = parse(expr[1:])
        return lambda p, q, r: 2 - t(p, q, r)
    if expr[0] != "(" or expr[-1] != ")":
        raise SyntaxError("invalid syntax")
    depth = 0
    i = 1
    l = len(expr) - 1
    op_pos = -1
    while i < l:
        c = expr[i]
        if c == "(":
            depth += 1
        elif c == ")":
            depth -= 1
        elif depth == 0 and c in ("+", "*"):
            if op_pos != -1:
                raise SyntaxError("invalid syntax")
            op_pos = i
        i += 1
    if depth != 0 or op_pos == -1:
        raise SyntaxError("invalid syntax")
    op = {
        "+": lambda x, y: max(x, y),
        "*": lambda x, y: min(x, y)
    }[expr[op_pos]]
    lhs = parse(expr[1:op_pos])
    rhs = parse(expr[op_pos + 1:-1])
    return lambda p, q, r: op(lhs(p, q, r), rhs(p, q, r))


# first part
while True:
    line = raw_input()
    if line == ".":
        break
    ans = 0

    f = parse(line)
    for p, q, r in itertools.product((0, 1, 2), repeat=3):
        if f(p, q, r) == 2:
            ans += 1

    print ans

Measured memory_bytes: 6508
#include <iostream>
#include <algorithm>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <string.h>
#include <vector>
#include <queue>
#include <cmath>
#include <bitset>
#include <complex>
#include <functional>
#include <numeric>
#include <iomanip>

#define SPBR(w, n) std::cout<<(w + 1 == n ? '\n' : ' ');
#define YES cout << "YES" << endl
#define Yes cout << "Yes" << endl
#define NO cout << "NO" << endl
#define No cout << "No" << endl
#define ALL(i) (i).begin(), (i).end()
#define FOR(i, a, n) for(int i=(a);i<(n);++i)
#define RFOR(i, a, n) for(int i=(n)-1;i>=(a);--i)
#define REP(i, n) for(int i=0;i<int(n);++i)
#define RREP(i, n) for(int i=int(n)-1;i>=0;--i)
#define IN(a, x, b) (a<=x && x<b)
#define OUT(a, x, b) (x<a || b<=x)
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

#define int ll
using ll = long long;
using ull = unsigned long long;
using ld = long double;
const int MOD = 1000000007;
/* const int MOD = 998244353; */
const int INF = 1e18;
const double PI = acos(-1);

using namespace std;
struct INIT { INIT(){
  cin.tie(0); ios::sync_with_stdio(false);
  cout << fixed << setprecision(10);
}}INIT;

vector<pair<int, int>> primeFact(int n) {
  vector<pair<int, int>> res;
  for (int i = 2; i * i <= n; i++) {
    int divcnt = 0;
    if (n % i == 0) {
      do {
        divcnt++;
        n /= i;
      } while (n % i == 0);
      res.emplace_back(i, divcnt);
    }
  }
  if (n != 1)
    res.emplace_back(n, 1);
  return res;
}


vector<int> fac, finv, inv;

void comb_init(int n) {
  fac  = vector<int>(n);
  finv = vector<int>(n);
  inv  = vector<int>(n);
  fac[0] = fac[1] = 1;
  finv[0] = finv[1] = 1;
  inv[1] = 1;
  for (int i = 2; i < n; i++) {
    fac[i] = fac[i - 1] * i % MOD;
    inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
    finv[i] = finv[i - 1] * inv[i] % MOD;
  }
}
 
int comb(int n, int k) {
  if (n < k) return 0;
  if (n < 0 || k < 0) return 0;
  return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

signed main() {
  int N, M; 
  cin >> N >> M;

  comb_init(400000);

  int ans = 1;

  auto primes = primeFact(M);
  for(auto p : primes){
    (ans *= comb(N+p.second-1, p.second)) %= MOD;
  }

  cout << ans << "\n";

  return 0;
}

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

using namespace std;

#define PB push_back
#define MP make_pair
#define FOR( i , n ) for( int i = 0; i < (n); i++ )
#define FORR( i , n ) for( int i = ( n - 1 ); i >= 0 ; i-- )
#define DB( x ) cout << #x << " = " << x << endl;
#define OUT( a , n ) for( int J = 0; J < (n); J++ )cout<< (a)[J] << " \n"[J == (n) - 1 ]
#define WAIT cout << flush , system("PAUSE");
#define CONTAINS(a, x) ((a).find(x) != (a).end())
#define endl '\n'

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

const int N = 1e6;

int n ,m;
int main()
{
	ios::sync_with_stdio( 0 );
	cin.tie( 0 );

	cin >> n >> m;

	vector<int> a , b;

	for( int i = 0; i < m; ++i ){
		int u, v;
		cin >> u >> v;
		if(u == 1){
			a.push_back(v);
		}

		if(v == 1){
			a.push_back(u);
		}
		if(u == n){
			b.push_back(v);
		}

		if(v == n){
			b.push_back(u);
		}
	}

	sort(b.begin(), b.end());

	for( auto v : a){
		auto it = lower_bound(b.begin(), b.end(), v);
		if(it != b.end() && (*it) == v){
			cout << "POSSIBLE" << endl;
			exit(0);
		}
	}

	cout << "IMPOSSIBLE" << endl;



	return 0;
}


Measured memory_bytes: 1276
import math
A,B,C,D = map(int,input().split())
ans = 0
def gcd(a,b):
        while b!=0:
                a,b=b,a%b
        return a
 
def lcm(a,b):
        return a*b//gcd(a,b)
 
def kosu(x):
        global C,D
        return x-(x//C + x//D - x//lcm(C,D))

print(kosu(B)-kosu(A-1))

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

#define rep(i, n) for (int i = 0; i < int(n); i++)
#define rrep(i, n) for (int i = int(n) - 1; i >= 0; i--)
#define reps(i, n) for (int i = 1; i <= int(n); i++)
#define rreps(i, n) for (int i = int(n); i >= 1; i--)
#define repc(i, n) for (int i = 0; i <= int(n); i++)
#define rrepc(i, n) for (int i = int(n); i >= 0; i--)
#define repi(i, a, b) for (int i = int(a); i < int(b); i++)
#define repic(i, a, b) for (int i = int(a); i <= int(b); i++)
#define each(x, y) for (auto &x : y)
#define all(a) (a).begin(), (a).end()
#define bit(b) (1ll << (b))

using namespace std;

using i32 = int;
using i64 = long long;
using f80 = long double;
using vi32 = vector<i32>;
using vi64 = vector<i64>;
using vf80 = vector<f80>;
using vstr = vector<string>;

inline void yes() { cout << "Yes" << '\n'; exit(0); }
inline void no() { cout << "No" << '\n'; exit(0); }
inline i64 gcd(i64 a, i64 b) { if (min(a, b) == 0) return max(a, b); if (a % b == 0) return b; return gcd(b, a % b); }
inline i64 lcm(i64 a, i64 b) { return a / gcd(a, b) * b; }
void solve(); int main() { ios::sync_with_stdio(0); cin.tie(0); cout << fixed << setprecision(16); solve(); return 0; }
template <typename T> class pqasc : public priority_queue<T, vector<T>, greater<T>> {};
template <typename T> class pqdesc : public priority_queue<T, vector<T>, less<T>> {};
template <typename T> inline void amax(T &x, T y) { if (x < y) x = y; }
template <typename T> inline void amin(T &x, T y) { if (x > y) x = y; }
template <typename T> inline T power(T x, i64 n, T e = 1) { T r = e; while (n > 0) { if (n & 1) r *= x; x *= x; n >>= 1; } return r; }
template <typename T> istream& operator>>(istream &is, vector<T> &v) { each(x, v) is >> x; return is; }
template <typename T> ostream& operator<<(ostream &os, vector<T> &v) { rep(i, v.size()) { if (i) os << ' '; os << v[i]; } return os; }
template <typename T, typename S> istream& operator>>(istream &is, pair<T, S> &p) { is >> p.first >> p.second; return is; }
template <typename T, typename S> ostream& operator<<(ostream &os, pair<T, S> &p) { os << p.first << ' ' << p.second; return os; }

void solve() {
  int H, W; cin >> H >> W;
  vstr s(H); rep(i, H) cin >> s[i];
  
  int cnt = 0;
  rep(i, H) rep(j, W) if (s[i][j] == '#') cnt++;

  vector<vector<int>> dist(H, vector<int>(W, 1e9));
  auto bfs = [&]() {
    queue<pair<int, int>> q;
    q.emplace(0, 0);
    dist[0][0] = 1;
    while (!q.empty()) {
      int x, y;
      tie(x, y) = q.front(), q.pop();
      rep(i, 4) {
        int dx = x + (i - 1) % 2;
        int dy = y + (i - 2) % 2;
        if (dx < 0 || dx >= H || dy < 0 || dy >= W) continue;
        if (s[dx][dy] == '#') continue;
        if (dist[dx][dy] <= dist[x][y] + 1) continue;
        dist[dx][dy] = dist[x][y] + 1;
        q.emplace(dx, dy);
      }
    }
  };
  bfs();
  if (dist[H - 1][W - 1] != 1e9) cout << H * W - dist[H - 1][W - 1] - cnt << '\n';
  else cout << -1 << '\n';
}


Measured memory_bytes: 256
#include <iostream>
#include <numeric>
#include <vector>

using namespace std;

int main() {
    int N, M, P, X;
    cin >> N;
    std::vector<int> list(N);
    for (int i=0; i<N; i++) {
        cin >> list.at(i);
    }
    const std::vector<int> constList = list;
    cin >> M;
    for (int j = 0; j < M; j++) {
        cin >> P >> X;
        list[P-1] = X;
        int sum = std::accumulate(list.begin(), list.end(), 0);
        list = constList;
        cout << sum << endl;
    }
  return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <bits/stdc++.h>
#include <cstdint>
#include <iostream>
#include <iterator>
#include <vector>

// lib/util.hpp
#ifndef UTIL_HPP
#define UTIL_HPP


typedef std::int_fast64_t i64;
typedef std::uint_fast64_t u64;
typedef std::int_fast32_t i32;
typedef std::uint_fast32_t u32;

namespace tools {
  template <typename T>
  void read(std::vector<T>& vector, const typename std::vector<T>::size_type size) {
    vector.reserve(size);
    std::copy_n(std::istream_iterator<T>(std::cin), size, std::back_inserter(vector));
  }

  template <typename T, std::size_t N>
  void read(std::array<T, N>& array) {
    std::copy_n(std::istream_iterator<T>(std::cin), N, array.begin());
  }
}

#endif

// main.cpp

int main() {
  i64 A, B, C;
  std::cin >> A >> B >> C;
  std::cout << (A % 2 == 0 || B % 2 == 0 || C % 2 == 0 ? 0 : std::min({A * B, B * C, C * A})) << std::endl;
  return 0;
}

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

typedef long long ll;
typedef pair<int,int> ii;

int main() {
	cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(0);
	int n,m; cin>>n>>m;
	priority_queue<int> pq;
	int a;
	while(n-->0)
		cin>>a, pq.push(a);
	while(!pq.empty() && m>0) {
		int cur=pq.top(); pq.pop();
		pq.push(cur/2);
		m--;
	}

	ll ret=0;
	while(!pq.empty())
		ret+=pq.top(), pq.pop();
	cout<<ret<<"\n";
	return 0;
}

Measured memory_bytes: 1020
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;
import java.util.regex.Pattern;
import java.util.stream.Collectors;
import java.util.stream.Stream;

/**
0-1 Knapsack Problem

You have N items that you want to put them into a knapsack. Item i has value vi and weight wi.

You want to find a subset of items to put such that:

The total value of the items is as large as possible.
The items have combined weight at most W, that is capacity of the knapsack.
Find the maximum total value of items in the knapsack.

Input
N W
v1 w1
v2 w2
:
vN wN
The first line consists of the integers N and W. In the following lines, the value and weight of the i-th item are given.

Output
Print the maximum total values of the items in a line.

Constraints
1 ??? N ??? 100
1 ??? vi ??? 1000
1 ??? wi ??? 1000
1 ??? W ??? 10000
Sample Input 1
4 5
4 2
5 2
2 1
8 3
Sample Output 1
13

Sample Input 2
2 20
5 9
4 10
Sample Output 2
9
*/

public class Main {
    public static class Solver {
        int solve(int W, List<Integer> values, List<Integer> weights) {
            int[] dp = new int[W + 1];
            for (int i = 1; i <= values.size(); ++i) {
                for (int j = W; j >= 0; --j) {
                    int v = values.get(i - 1);
                    int w = weights.get(i - 1);
                    if (j - w >= 0) {
                        dp[j] = Math.max(dp[j], dp[j - w] + v);
                    }
                }
            }
            return dp[W];
        }
    }

    private static final Pattern SPLIT = Pattern.compile("\\s");
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        List<Integer> weights = new ArrayList<>();
        List<Integer> values = new ArrayList<>();
        List<Integer> NW = Stream.of(SPLIT.split(scanner.nextLine())).map(Integer::valueOf)
                .collect(Collectors.toList());
        final int N = NW.get(0);
        final int W = NW.get(1);
        for (int i = 0; i < N; ++i) {
            List<Integer> collect = Stream.of(SPLIT.split(scanner.nextLine())).map(Integer::valueOf)
                    .collect(Collectors.toList());
            values.add(collect.get(0));
            weights.add(collect.get(1));
        }
        System.out.println(new Solver().solve(W, values, weights));
    }
}

Measured memory_bytes: 33096
#include <stdlib.h>
#include <cmath>
#include <cstdio>
#include <cstdint>
#include <string>
#include <iostream>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
using namespace std;
using ll = long long;

int main(){
  int K;
  string S;
  cin >> K >> S;

  if(S.size()<=K) cout << S << endl;
  else{
    string sub_S=S.substr(0,K);
    sub_S+="...";
    cout << sub_S << endl;
  }
  

  return 0;
}


Measured memory_bytes: 3632
#include <iostream>
#include <vector>
#include <stack>
#include <queue>
#include <algorithm>
#include <cstdlib>
#include <cmath>
#include <numeric>

using namespace std;

#define rep(i, n) for(int i = 0; i < n; i++)
#define repi(i, start, end) for(int i = start; i < end; i++)
#define all(x) (x).begin(), (x).end()
typedef long long ll;

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

    if(n < 1000){
        cout << "ABC" << endl;
    }else{
        cout << "ABD" << endl;
    }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<unordered_set>
#include<unordered_map>
#include <iostream>
#include <string>
#include <cmath>
using namespace std;
#define ll long long
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
#define FORR(i,a,b)for(ll i=(a);i<=(b);i++)
#define repR(i,n) for(ll i=n;i>=0;i--)
#define all(v)(v).begin(),(v).end()
#define rall(v)(v).rbegin(),(v).rend()
#define F first
#define S second
#define pb push_back
#define pu push
#define COUT(x) cout<<(x)<<endl
#define PQ priority_queue<ll>
#define PQR priority_queue<ll,vector<ll>,greater<ll>>
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define mp make_pair
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define sz(x) (int)(x).size()
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
const ll MOD = 1000000007LL;
const ll INF = 1LL << 60;
using vll = vector<ll>;
using vb = vector<bool>;
using vvb = vector<vb>;
using vvll = vector<vll>;
using vstr = vector<string>;
using pll = pair<ll, ll>;
using vc = vector<char>;
using vvc = vector<vc>;
ll dx[4]={0,1,0,-1};
ll dy[4]={1,0,-1,0};
int main(){
  ll n;
  cin>>n;
  vll c(n);
 rep(i,n){
   ll k;
   cin>>k;
   c[k]++;
   if(i==0&&k!=0){
     COUT(0);
     return 0;
   }
 }
  if(c[0]!=1){
COUT(0);
    return 0;
  }
  ll ans=1;
  for(int i=1;i<n;i++){
    for(int j=0;j<c[i];j++){
      ans*=c[i-1];
      ans%=998244353;
    }
  }
  COUT(ans);
}


Measured memory_bytes: 1024
#include<iostream>
#include<cstdio>
#include<cmath>
#include<cstdlib>
#include<climits>
#include<string>
#include<algorithm>
#include<vector>
#include<queue>
#include<stack>
#include<numeric>
#include<map>
#include<set>
#include<bitset>
using namespace std;
#define REP(i,m,n) for(int i = m; i < n; i++)
#define rep(i,n) REP(i,0,n)
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a)  (a).rbegin(),(a).rend()
#define PI 3.14159265359
#define MOD 1000000007
typedef long long LL;

template<class T> inline void chmax(T& a, T b) { if (a < b) { a = b; } }
template<class T> inline void chmin(T& a, T b) { if (a > b) { a = b; } }
template<class T> void print_vector(vector<T> vec) {
	cout << "[ ";
	for (int i = 0; i < vec.size(); i++) {
		cout << vec[i] << " ";
	}
	cout << "]" << endl;
}
template<class T> void print_pair_vector(vector<pair<T, T> > vec) {
	cout << "[ ";
	for (int i = 0; i < vec.size(); i++) {
		cout << "(" << vec[i].first << "," << vec[i].second << ") ";
	}
	cout << "]" << endl;
}

const int INF = 1 << 30;

int main(void) {
	int N, M;
	cin >> N >> M;

	vector<string> A(N);
	rep(i, N) cin >> A[i];

	vector<string> B(M);
	rep(i, M) cin >> B[i];

	bool template_is_included = false;
	for (int h = 0; h < N - M + 1; h++) {
		for (int w = 0; w < N - M + 1; w++) {
			for (int j = 0; j < M; j++) {
				for (int k = 0; k < M; k++) {
					if (A[h + j][w + k] != B[j][k]) {
						goto NEXT_PATTERN_MATCH;
					}

					if (k == M - 1 and j == M - 1) {
						template_is_included = true;
					}
				}
			}
		NEXT_PATTERN_MATCH:
			continue;
		}
	}

	if (template_is_included) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}
	return 0;
}

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

int main() {
  int n, m;
  cin >> n >> m;

  vector<int> l(m), r(m);
  int l_max = 0, r_min = 1e5;
  for (int i = 0; i < m; i++) {
    cin >> l[i] >> r[i];
    l_max = max(l_max, l[i]);
    r_min = min(r_min, r[i]);
  }

  int ans = 0;
  for (int i = 1; i <= n; i++) {
    if (l_max <= i && i <= r_min) {
      ans++;
    }
  }

  cout << ans << endl;
}

Measured memory_bytes: 1024
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools

sys.setrecursionlimit(10**7)
inf = 10**20
eps = 1.0 / 10**10
mod = 10**9+7
dd = [(-1,0),(0,1),(1,0),(0,-1)]
ddn = [(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()
def pf(s): return print(s, flush=True)


def main():
    n,m,c = LI()
    b = LI()
    aa = [LI() for _ in range(n)]

    r = 0
    for a in aa:
        t = c
        for d,e in zip(a,b):
            t += d * e
        if t > 0:
            r += 1


    return r


print(main())




Measured memory_bytes: 8008
#include<iostream>
#include<vector>
#include<ctype.h>
#include<string>
using namespace std;

string card[2];
int n,point[2]={0};

int main(){
    cin>>n;
    for(int i=0;i<n;++i){
        cin>>card[0]>>card[1];
        if(card[0] > card[1]){
            point[0]+=3;
        }
        else if(card[0] < card[1]){
            point[1]+=3;
        }
        else{
            point[0]++;
            point[1]++;
        } 
    }
    cout<<point[0]<<" "<<point[1]<<endl;
    return 0;
}



Measured memory_bytes: 3136
//  Created by conan1024hao in 2019.
//  Copyright © 2019 conan1024hao. All rights reserved.
//  専用ライブラリです、自由にコピーして構いません。
//  感谢看我的代码！Wechat:conan1024hao QQ:810396815
#pragma GCC optimize ("O3")
#include <iostream>
#include <iomanip>
#include <istream>
#include <ostream>
#include <sstream>
#include <iterator>
#include <vector>
#include <algorithm>
#include <queue>
#include <deque>
#include <list>
#include <stack>
#include <map>
#include <set>
#include <utility>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <string>
#include <ctime>
#include <cctype>
#include <cstdlib>
#define INF 10e16
#define MOD 1000000007
#define rep(i, a, n) for (ll i = a; i < (ll)(n); i++)
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define mmax(x,y)(x>y?x:y)
#define mmin(x,y)(x<y?x:y)
#define chmax(x,y) x=mmax(x,y)
#define chmin(x,y) x=mmin(x,y)
#define all(x) (x).begin(),(x).end()
#define siz(x) (ll)(x).size()
#define PI acos(-1.0)
using namespace std;
//using Int=int_fast64_t;
typedef long long int ll;
typedef pair<ll,ll>Pll;
typedef pair<int,int>Pin;
long long GCD(long long a, long long b) { return b ? GCD(b, a%b) : a; }
long long LCM(long long a, long long b)  {return a/GCD(a,b)*b;}
int dx[8]={-1,0,1,0,1,1,-1,-1};
int dy[8]={0,-1,0,1,1,-1,1,-1};
char dir[4]={'u','l','d','r'};
ll cmp1(pair<ll,string>a,pair<ll,string> b){
        if(a.fi!=b.fi)
        return a.fi<b.fi;
        else
        return a.se<b.se;
}
//---------------------------------------------------------------------------

//---------------------------------------------------------------------------
int main(){//問題をちゃんと見ろ!!!!!!!!!!!!!!!!!      llか??????????        memset()!!!!!!!!!!!!
    cin.tie(0);
    ios::sync_with_stdio(false);
    //-------------------------------
    int n,a,b;cin>>n>>a>>b;
    cout<<min(a*n,b);

    //-------------------------------
    return 0;
}
//---------------------------------------------------------------------------


Measured memory_bytes: 256
use std::io::stdin;
use std::str::FromStr;
use std::cmp::min;

fn main(){
    let n: usize = get_one();
    let xs: Vec<i64> = get_vec();
    let can_all_positive = {
        let mut n_neg = 0;
        for &x in &xs {
            if x == 0 { n_neg=0; break; };
            if x < 0 { n_neg += 1 };
        }
        n_neg % 2 == 0
    };
    let abss: Vec<i64> = xs.iter().map(|&x|x).map(i64::abs).collect();
    let m = abss.iter().map(|&x|x).fold(std::i64::MAX, std::cmp::min);
    let mut ans = abss.iter().map(|&x|x).fold(0, |acc, x| acc + x);
    if !can_all_positive {
        ans -= m * 2;
    }
    println!("{}", ans);
}

#[allow(dead_code)]
fn get_line() -> String {
    let mut s = String::new();
    match stdin().read_line(&mut s){
        Ok(_) => {s.trim().to_string()}
        Err(_) => String::new()
    }
}

#[allow(dead_code)]
fn get_vec<T: std::str::FromStr>() -> Vec<T> {
    let line = get_line();
    line.split_whitespace().filter_map(|x| x.parse().ok()).collect()
}

#[allow(dead_code)]
fn get_one<T: FromStr + Copy>() -> T {
    let v = get_vec();
    v[0]
}

#[allow(dead_code)]
fn get_pair<T: FromStr + Copy>() -> (T, T) {
    let v = get_vec();
    (v[0], v[1])
}

#[allow(dead_code)]
fn get_triple<T: FromStr + Copy>() -> (T, T, T) {
    let v = get_vec();
    (v[0], v[1], v[2])
}

#[allow(dead_code)]
fn get_chars() -> Vec<char> {
    get_line().chars().collect()
}


Measured memory_bytes: 8444
def inpl(): return [int(i) for i in input().split()]

Q, H, S, D = inpl()
N = int(input())
mini2 = min(8*Q, 4*H, 2*S, D)
mini1 = min(4*Q, 2*H, S)
print(N//2*mini2 + N%2*mini1)

Measured memory_bytes: 3316
#include<map>
#include<set>
#include<cmath>
#include<ctime>
#include<queue>
#include<stack>
#include<bitset>
#include<cstdio>
#include<vector>
#include<cstdlib>
#include<cstring>
#include<iostream>
#include<algorithm>
#define lb(x) x&-x
#define il inline
#define ll long long
#define llu unsigned long long
#define mem(x) memset(x,0,sizeof(x))
#define mem3(x) memset(x,0x3f,sizeof(x))
#define ccA() puts("耐心冷静查代码")
#define cc() puts("谁知盘中餐，粒粒皆辛苦")
#define fo(i,a,b) for(register int i=a;i<=b;++i)
#define fd(i,a,b) for(register int i=a;i>=b;--i)
#define fk(i,j) for(register int i=fir[j];i;i=nxt[i])
#define fv(i,q) for(int i=0;i<q.size();i++)
using namespace std;
inline ll read(){
    ll x=0,f=1;char c;
    for(c=getchar();c<'0'||c>'9';f=((c=='-')?-1:f),c=getchar());
    for(;c>='0'&&c<='9';x=x*10+c-'0',c=getchar());
    return x*f;
}
inline void write(ll a){
    if(a==0){putchar('0');return;}
    if(a<0)putchar('-'),a=-a;
    char c1[120];
    ll h=0;
    while(a)c1[++h]=a%10+'0',a/=10;
    fd(i,h,1)putchar(c1[i]);
    return;
}
inline void write_(ll a){write(a);putchar(' ');}
inline void writeln(ll a){write(a);putchar('\n');}
//-----------------------------------------------------------------
const int N=1e5+9;
ll m[N],d[N];
ll n,ans;
int main(){
	n=read();
	fo(i,1,n){
		d[i]=read();
	}
	ans=d[1];
	fo(i,2,n){
		if(i%2)ans-=d[i];
		else ans+=d[i];
	}
	m[2]=ans;
	ans/=2;
	fo(i,3,n){
		m[i]=d[i-1]*2-m[i-1];
	}
	m[1]=d[n]*2-m[n];
	fo(i,1,n){
		write_(m[i]);
	}
	return 0;
}

Measured memory_bytes: 2816
#include <iostream>
#include <sstream>
#include <stack>
#include <iomanip>
#include <numeric>
#include <string>
#include <cstring>
#include <algorithm>
#include <functional>
#include <cstdlib>
#include <map>
#include <set>
#include <vector>
#include <utility>
#include <queue>
#include <cmath>

#define BEGIN(x) x.begin()
#define END(x) x.end()
#define ALL(x) BEGIN(x), END(x)
#define PAIR make_pair
#define VEC(type) vector<type >
#define endl '\n'

#define FOR(i, A, B) for(auto i = (A);i != (B); i++)
#define FORD(i, A, B) for(auto i = (A);i != (B); i--)

#define READRANGE(begin, end) FOR(it, begin, end) cin >> *it
#define READVEC(V) READRANGE(BEGIN(V), END(V))

using namespace std;

typedef long long lint;
typedef pair<int, int> Pii;
typedef pair<int, lint> Pil;
typedef pair<lint, lint> Pll;
typedef pair<lint, int> Pli;

// ---- BEGIN LIBRARY CODE ----
// ---- END LIBRARY CODE ----
void io_init()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
};

int main(int argc, char **argv)
{
    io_init();

    // Actual program code starts here.
    int A, B;
    cin >> A >> B;
    cout << max(A + B, max(A - B, A * B)) << endl;
    return 0;
};


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < (n); i++)
#define vec vector

using namespace std;

const int inf = 1e8;

int s(int n){
    return n*(n+1)*(n+2)/6;
}
int main(){
  vec<int> d1(2e6+1, inf), d2(2e6+1, inf);
  d1[0] = d2[0] = 0;
  rep(i, 1000){
      int n = s(i+1);
      rep(j, 2e6+1){
          if(j + n < 2e6+1) {
          d1[j+n] = min(d1[j]+1, d1[j+n]);
          if(n%2==1) d2[j+n] = min(d2[j]+1, d2[j+n]);
          }
      }
  }
  int x;
  while(cin >> x, x != 0){
      cout << d1[x] <<" "<< d2[x] <<endl;
  }
}

Measured memory_bytes: 18140
#include<bits/stdc++.h>
#include <math.h>
#include <algorithm>
#include <functional>
#include<iostream>
#include <string>
using namespace std;
typedef long long ll;
#define pb pushback
#define fr(i,n) for(int i=0;i<n;i++)
#define fro(i,j,n) for(int i=j;i<n;i++)
#define ifr(i,n) for(int i=n-1;i>=0;i--)


int main() {
    int x,y,a,b,c;
	cin >>x>>y>>a>>b>>c;
    long p[a];
   long q[b];
  long r[c];
    fr(i,a){
      cin>>p[i];
    }
  fr(i,b){
      cin>>q[i];
    }
  fr(i,c){
      cin>>r[i];
    }
  sort(p,p+a,greater<>());
  sort(q,q+b,greater<>());
  sort(r,r+c,greater<>());
  long n[x+y];
  fr(i,x){
    n[i]=p[i];
  }
  fr(i,y){
    n[i+x]=q[i];
  }
  long ans=0;
  sort(n,n+x+y);
  fr(i,x+y){
    if(n[i]<r[i]&&i<c)ans+=r[i];
    else ans+=n[i];
  }

  cout << ans << endl;
}

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

int main(int argc, char const *argv[])
{
    vector<int> v;
    int t,k;
    for(int i=0;i<5;++i){
        cin >> t;
        v.push_back(t);
    }
    cin >> k;
    for(int i=0;i<5;++i){
        for(int j=i;j<5;++j){
            if(v[j]-v[i]>k){
                cout << ":(" << endl;
                return 0;
            }
        }
    }
    cout << "Yay!" << endl;

    return 0;
}


Measured memory_bytes: 256