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

using namespace std;

int n,h,w;
const ll mod=1e9+7;
pair<int,int> polja[3010];
ll dp[3010];
ll fact[200010];
ll invfact[200010];

ll mul(ll a, ll b)
{
    return a*b%mod;
}

ll dec(ll a, ll b)
{
    a-=b;
    if(a<0) a+=mod;
    return a;
}

ll bin(int n, int k)
{
    return mul(fact[n],mul(invfact[k],invfact[n-k]));
}

ll racunaj(int i, int j)
{
    int dx=polja[i].first-polja[j].first;
    int dy=polja[i].second-polja[j].second;
    if(dx<0 || dy<0) return 0;
    return mul(dp[j],bin(dx+dy,dx));
}

ll stepen(ll a, int st)
{
    ll sol=1;
    while(st!=0)
    {
        if(st%2==1)
            sol=mul(sol,a), st--;
        else
            a=mul(a,a), st/=2;
    }
    return sol;
}

ll solve(int i)
{
    int x=polja[i].first;
    int y=polja[i].second;
    dp[i]=bin(x+y-2,x-1);
    //cout<<"*"<<x<<" "<<y<<" "<<dp[i]<<endl;
    for(int j=0;j<i;j++)
        dp[i]=dec(dp[i], racunaj(i,j));//cout<<"*"<<i<<" "<<racunaj(i,j)<<endl;
}


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

    cin>>h>>w>>n;
    for(int i=0;i<n;i++)
        cin>>polja[i].first>>polja[i].second;


    fact[0]=1;
    invfact[0]=1;
    for(int i=1;i<=h+w;i++)
        fact[i]=mul(fact[i-1],i), invfact[i]=stepen(fact[i], mod-2);//cout<<(stepen(fact[i],mod-2)==step(fact[i],mod-2))?" ":".i.\n";

    polja[n++]=make_pair(h,w);
    sort(polja,polja+n);
    for(int i=0;i<n;i++)
        solve(i);// cout<<dp[i]<<endl;
    cout<<dp[n-1];
	return 0;
}


Measured memory_bytes: 3456
#include <stdio.h>
#include <stdlib.h>

int main() {
	int N, M, C;
	int *B;
	int **A;
	int i, j, k;
	int count = 0;
	long int value = 0;

	scanf("%d", &N);
	scanf("%d", &M);
	scanf("%d", &C);
	B = (int*)malloc(sizeof(int) * M);
	for(i = 0;i < M;i++) {
		scanf("%d", &B[i]);
	}
	A = (int**)malloc(sizeof(int*) * N);
	for(i = 0;i < N;i++) {
		A[i] = (int*)malloc(sizeof(int) * M);
	}
	for(i = 0;i < N;i++) {
		for(j = 0;j < M;j++) {
			scanf("%d", &A[i][j]);
		}
	}
	for(i = 0;i < N;i++) {
		value = 0;
		for(j=0;j < M;j++) {
			value += A[i][j] * B[j];
		}
		value += C;
		if(value > 0) {
			count++;
		}
	}
	printf("%d\n", count);
	return 0;
}


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

using namespace std;

const int mod = 1e9 + 7;

int a[110];
long long dp[410][410], sm[410];
int n;

int main(){
    cin >> n;
    for(int i = 0; i < n; i++) cin >> a[i];
    for(int i = 0; i < n; i++) sm[i + 1] = sm[i] + a[i];
    for(int i = n - 1; i >= 0; i--){
        for(int j = i + 2; j <= n; j++){
            dp[i][j] = LLONG_MAX;
            for(int k = i + 1; k < j; k++)
                dp[i][j] = min(dp[i][k] + dp[k][j] + sm[j] - sm[i], dp[i][j]);
        }
    }
    cout << dp[0][n] << '\n';
}

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

int main(){
    unsigned long long int a;
    double b;
    cin >> a >> b;
    string bstr;
    bstr = to_string(b);
    bstr.erase(bstr.size()-7, 1);
    bstr.erase(bstr.size()-4, 5);
    // cout << bstr << endl;

    // while(bstr.at(0)==0){
    //     bstr.erase(0, 1);
    // }
    // cout << bstr << endl;

    int b2 = stoi(bstr);
    //cout << b2 << endl;
    unsigned long long int ans = a*b2/100;
    cout << ans << endl;
}

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

int main(){
	int n,d;cin>>n>>d;
  	int ans=0,s=0;
  vector<vector<int>>x(n,vector<int>(d));
  rep(i,n)rep(j,d)cin>>x[i][j];
  for(int i=0;i<n;i++)for(int j=i+1;j<n;j++){
  	s=0;
    for(int k=0;k<d;k++){
     s+= (x[i][k]-x[j][k])*(x[i][k]-x[j][k]);
    }
    for(int l=1;l*l<=s;l++){
    	if(s==l*l)ans++;
    }
  }
	cout<<ans<<endl;
}


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

int num_max = 1000000007;

int ctoi(char c)
{
	return (int)(c - '0');
}

int main() {
	string s;
	cin >> s;
	int dp[s.size()][13] = {0};
	int mods[6] = {1, -3, -4, -1, 3, 4};
	for (size_t i = 0; i < s.size(); i ++) {
		int mod = mods[i % 6];
		char c = s[s.size() - 1 - i];
		if (c == '?') {
			if (i == 0) {
				for (int j = 0; j < 10; j ++) {
					dp[i][j] = 1;
				}
			} else {
				for (int j = 0; j < 13; j ++) {
					for (int k = 0; k < 10; k ++) {
						dp[i][j] += dp[i-1][(65 + j- mod * k) % 13];
						dp[i][j] %= num_max;
					}
				}
			}
		} else {
			if (i == 0) {
				dp[i][ctoi(c)] = 1;
			} else {
				for (int j = 0; j < 13; j ++) {

					dp[i][j] = dp[i-1][(65 + j - mod* ctoi(c)) % 13] % num_max;
				}
			}
		}
	}

	cout << dp[s.size()-1][5] << endl;

	return 0;
}

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

using namespace std;

#define endl '\n'

typedef long long int64;
typedef pair<int,int> pii;
typedef vector<int> vi;

const double eps = 1e-9;
const int oo = 0x3f3f3f3f;
const int mod = 1000000007;

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

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

    vector<vi> adj(n);

    for (int i = 0; i < m; ++i){
        int u, v; cin >> u >> v;
        u--; v--;
        adj[u].push_back(v);
        adj[v].push_back(u);
    }

    vector<int> vis(n);
    vector<pii> ans;
    set<pii> seen;
    vector<int> deg(n);
    vector<pii> tree;

    auto check = [&](int a, int b){
        if (a > b) swap(a, b);
        if (seen.find(pii(a, b)) == seen.end()){
            seen.insert(pii(a, b));
            return true;
        } else {
            return false;
        }
    };

    function<void(int,int)> dfs = [&](int s, int p){
        vis[s] = true;

        for (auto u : adj[s]){
            if (u == p) continue;

            if (vis[u]){
                if (check(s, u)){
                    ans.push_back({s, u});
                    deg[s] ^= 1;
                }
            } else {
                dfs(u, s);
            }
        }


        if (p != -1){
            deg[s] ^= 1;
            tree.push_back(pii(s, p));
        }
    };

    dfs(0, -1);

    for (auto e : tree){
        if (deg[e.first]){
            deg[e.first] ^= 1;
            deg[e.second] ^= 1;
            swap(e.first, e.second);
        }

        ans.push_back(e);
    }

    if (deg[0]){
        cout << -1 << endl;
    } else {
        for (auto e : ans){
            cout << e.first + 1 << " " << e.second + 1 << endl;
        }
    }

    return 0;
}

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

int inner()
{
  int contest, display, inner;
  inner = 0;
  cin >> contest >> display;
  if(contest >= 10)
  {
    return display;
  }
  else
  {
   inner = display + (100 * (10 - contest));
   return inner;
  }
}
int main()
{
  cout << inner() << endl;
}


Measured memory_bytes: 3592
class UnionFind:
    def __init__(self, n):
        self.n = n
        self.p = [e for e in range(n)]
        self.rank = [0] * n
        self.size = [1] * n

    def same(self, u, v):
        return self.find_set(u) == self.find_set(v)

    def unite(self, u, v):
        u = self.find_set(u)
        v = self.find_set(v)

        if u == v:
            return

        if self.rank[u] > self.rank[v]:
            self.p[v] = u
            self.size[u] += self.size[v]
        else:
            self.p[u] = v
            self.size[v] += self.size[u]
            if self.rank[u] == self.rank[v]:
                self.rank[v] += 1

    def find_set(self, u):
        if u != self.p[u]:
            self.p[u] = self.find_set(self.p[u])

        return self.p[u]

    def update_p(self):
        for u in range(self.n):
            self.find_set(u)

    def get_size(self, u):
        return self.size[self.find_set(u)]


n, m = map(int, input().split())
xyz = [list(map(int, input().split())) for _ in range(m)]

uf = UnionFind(n)

for x, y, _ in xyz:
    x -= 1
    y -= 1
    uf.unite(x, y)

uf.update_p()
ans = len(set(uf.p))
print(ans)


Measured memory_bytes: 39180
#include "bits/stdc++.h"
//#include <iostream>
//#include <vector>
//#include <string>
using namespace std;
#define setc cin.tie(0);ios::sync_with_stdio(0)
#define repi(i,a,b) for(int i=(a), i##_len=(b); i<i##_len; ++i)
#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 rep_(i,n) repi_(i,0,n)
#define all(x) (x).begin(),(x).end()
#define vsort(v) sort((v).begin(), (v).end())
#define gsort(v) tsort(v); reverse((v).begin(), (v).end())
#define vrev(v) reverse((v).begin(), (v).end())
#define siz(v) ((int)(v).size())
#define ers(v, n) (v).erase((v).begin() + n)
#define cnt(v, n) count(all(v), n)
#define vmin(v) *min_element(v.begin(), v.end())
#define vmax(v) *max_element(v.begin(), v.end())
#define contain(q) !q.empty()
#define cont(q) !q.empty()
//#define qpop(q, a, b) a=q.back().first;b=q.back().second;q.pop()
//#define pqpop(p, a, b) a=q.top().first;b=q.top().second;q.pop()
#define el "\n"
#define sp " "
#define co(x) cout<<(x)<<el
#define coc(c, a, b) if(c)co((a));else co((b))
#define cosp(x) cout<<(x)<<' '
#define YES(c) coc(c,"YES", "NO")
#define Yes(c) coc(c,"Yes", "No")
#define yes(c) coc(c,"yes", "no")
#define POSSIBLE(c) coc(c, "POSSIBLE", "IMPOSSIBLE")
#define Possible(c) coc(c, "Possible", "Impossible")
#define possible(c) coc(c, "possible", "impossible")
#define inf INT_MAX
#define wildcard(T) numeric_limits<T>::min()

#define pb push_back
#define pq priority_queue
#define np next_permutation

#ifdef tqktmp_2
#define gc() getchar(); getchar()
#else
#define gc() 1
#endif
const unsigned int bf0 = (1 << 0);
const unsigned int bf1 = (1 << 1);
const unsigned int bf2 = (1 << 2);
const unsigned int bf3 = (1 << 3);
const unsigned int bf4 = (1 << 4);
const unsigned int bf5 = (1 << 5);
const unsigned int bf6 = (1 << 6);
const unsigned int bf7 = (1 << 7);

typedef long long lint;
typedef vector<int> ivec; typedef vector<string> svec;
typedef vector<vector<int>> ivvec;
typedef pair<int, int> P;

const int
	dx8[8] = { 0,1,1,1,0,-1,-1,-1 },
	dy8[8] = { 1,1,0,-1,-1,-1,0,1 },
	dx4[4] = { 0,1,0,-1 },
	dy4[4] = { 1,0,-1,0 };

template<class T>inline bool maxi(T &a, const T &b) { if (a<b) { a = b; return 1; } return 0; }
template<class T>inline bool mini(T &a, const T &b) { if (b<a) { a = b; return 1; } return 0; }

int main() {
	setc;

	lint n, in; cin >> n;
	ivec a;
	rep(i, n) {
		cin >> in;
		a.pb(in);
	}
	vsort(a);
	co(abs(a[0] - a[n - 1]));
	gc();
}

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

int main() {
	int n, ma = 0, sum = 0;
	cin >> n;
	vector<int> l(n);
	for (int i = 0; i < n; ++i) {
		cin >> l[i];
		ma = max(ma, l[i]);
		sum += l[i];
	}
	if (ma < sum - ma) cout << "Yes" << endl;
	else cout << "No" << endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <list>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <bitset>
#include <algorithm>
#include <numeric>
#include <utility>
#include <sstream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <string>
#include <cstring>
#include <climits>
#include <complex>
 
#define REP(i,b,n) for(int i=b;i<n;++i)
#define REPR(i,b,n) for(int i=n-1;i>=b;--i)
#define CLR(mat) memset(mat, 0, sizeof(mat))
#define NCLR(mat) memset(mat, -1, sizeof(mat))
#define EACH(i, c) for(typeof((c).begin()) i = (c).begin(); i != (c).end(); ++i)
#define EXIST(s, e) ((s).find(e) != (s).end())
#define BIT(n, b) ((n>>b) & 1)
#define PI acos(-1.0)

using namespace std;

static const double EPS = 1e-9;
typedef complex<double> p;
typedef pair<int, int> pii;
typedef long long ll;

double cross(p a, p b){
	
	return (a.real() * b.imag() - a.imag() * b.real());
}

string solve(vector<p> vc){

	bool sgo;
	
	for(int i=0; i<vc.size(); ++i){
		
		bool sg = cross(vc[i] - vc[(i+2)%vc.size()], vc[(i+1)%vc.size()] - vc[(i+2)%vc.size()]) > 0;
		
		if(i==0){
			sgo = sg;
		}
		
		if(sgo ^ sg)
			return "NO";
	}
	
	return "YES";
}
	

int main(){

	double x[4], y[4];
	char c;
	
	while(cin >> x[0] >>c>> y[0] >>c>> x[1] >>c>> y[1] >>c>>
			x[2] >>c>> y[2] >>c>> x[3] >>c>> y[3], !cin.eof()){
	
		vector<p> lct;
		
		for(int i=0; i<4; ++i){
			lct.push_back(p(x[i]+100.0, y[i]+100.0));
		}
		
		cout << solve(lct) << endl;
	}
	
	return 0;
}

Measured memory_bytes: 1228
#include "bits/stdc++.h"
using namespace std;
long long mod=1e9+7;

int main(){
  long long n,z,w;
  cin>>n>>z>>w;
  vector<long long> a(n);
  for(int i=0;i<n;i++)cin>>a[i];
  long long ans;
  if(n==1)ans=abs(a[n-1]-w);
  else ans=max(abs(a[n-1]-w),abs(a[n-2]-a[n-1]));
  cout<<ans<<endl;
}


Measured memory_bytes: 256
import java.util.*

//

fun main() {
    abc176d()
}

fun abc176d() {
    val (h, w) = readLine()!!.split(" ").map { it.toInt() }
    val (ch, cw) = readLine()!!.split(" ").map { it.toInt() - 1 }
    val (dh, dw) = readLine()!!.split(" ").map { it.toInt() - 1 }
    val map = List(h) { CharArray(w) }
    for (i in 0 until h) {
        val s = readLine()!!
        for (j in 0 until w) {
            map[i][j] = s[j]
        }
    }
    val step = List(h) { IntArray(w) { -2 } }
    var visited = ArrayDeque<Pair<Int, Int>>()
    val next = ArrayDeque<Pair<Int, Int>>()
    next.add(dh to dw)
    var s = 0
    while (step[ch][cw] == -2) {
        while (next.isNotEmpty()) {
            val (th, tw) = next.poll()
            if (th !in 0 until h) continue
            if (tw !in 0 until w) continue
            if (step[th][tw] > -2) continue
            if (map[th][tw] == '.') {
                step[th][tw] = s
                visited.add(th to tw)
                next.add(th - 1 to tw)
                next.add(th + 1 to tw)
                next.add(th to tw - 1)
                next.add(th to tw + 1)
            }
        }
        s++
        while (visited.isNotEmpty()) {
            val (th, tw) = visited.poll()
            if (th !in 0 until h) continue
            if (tw !in 0 until w) continue
            val startH = (th - 2).coerceAtLeast(0)
            val endH = (th + 2).coerceAtMost(h - 1)
            val startW = (tw - 2).coerceAtLeast(0)
            val endW = (tw + 2).coerceAtMost(w - 1)
            for (i in startH..endH) {
                for (j in startW..endW) {
                    if (map[i][j] == '.') {
                        if (step[i][j] == -2) next.add(i to j)
                    } else {
                        step[i][j] = -1
                    }
                }
            }
        }
        if (next.isEmpty() && visited.isEmpty()) break
    }
    val ans = step[ch][cw]
    println(if (ans < 0) -1 else ans)
}


Measured memory_bytes: 71448
#include <bits/stdc++.h>
using namespace std;
using ll = int64_t;
#define endl '\n';

ll calc_val(ll a, ll p) {
    return a * (100 + p) / 100;
}

int main() {
    while(true) {
        ll x, y, s;
        cin >> x >> y >> s;
        if(!(x || y || s)) break;
        ll ans = 0;
        for(ll a = 1; a < s; a++) {
            for(ll b = 1; b < s; b++) {
                ll prea = calc_val(a, x), preb = calc_val(b, x);
                if(prea + preb != s) continue;
                ll tmp = calc_val(a, y) + calc_val(b, y);
                ans = max(ans, tmp);
            }
        }
        cout << ans << endl;
    }
    return 0;
}



Measured memory_bytes: 3088
#include<stdio.h>
#include<math.h>

int main(){

  int i,j,c=0,N,f=0,a;
  //load number
  scanf("%d",&N);
  //N>0 ->roop
  while(N-->0){
    //road number
    scanf("%d",&a);
    if(a==1)continue;
    //judge number
    for(j=2;j<=sqrt((double)a);j++){
      //if a%j=0 flag=1
      if(a%j==0) f=1;
    }
    if(f==1)f=0;
    //else count prime number
    else c++;
  }
  //print counter
  printf("%d\n",c);



  return 0;

}

Measured memory_bytes: 364
#include "iostream"
#include <stdio.h>
#include <algorithm>
#include <stdlib.h>
#include <cstring>
#include <math.h>
#include <cctype>
#include <stack>
#include <vector>
#include <list>
#include <queue>
#include <set>
#include <map>
#include <bitset>
#include <iomanip>
using namespace std;
using ll=long long;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
#define MOD  1000000007
int dx[4]={0,0,-1,1},dy[4]={1,-1,0,0};


int main(int argc, char const *argv[]) {
  string s; std::cin >> s;
  int n=s.size(),w=0,l=0,pa=0,pt=0;
  string t={};
  for(int i=0; i<n; i++){
    if(i%2==0)t+="g";
    else t+="p";
  }

  for(int i=0; i<n; i++){
    if(s[i]=='g' && t[i]=='p') w++;
    else if(s[i]=='p' && t[i]=='g') l++;
  }
  for(int i=0; i<n; i++){
    if(s[i]=='p') pt++;
    if(t[i]=='p') pa++;
  }

  std::cout << pa-pt << '\n';


  return 0;
}


Measured memory_bytes: 512
#%%
n, k = map(int, input().split())
r, s, p = map(int, input().split())
T = input()

#%%
win = []
for t in T:
    if t == 'r':
        win.append('p')
    elif t == 'p':
        win.append('s')
    elif t == 's':
        win.append('r')


def score(rps):
    if rps == 'r':
        return r
    elif rps == 'p':
        return p
    elif rps == 's':
        return s

ans = 0
for i in range(n):
    if i - k < 0:
       ans += score(win[i])
    else:
        if win[i] == win[i-k]:
            win[i] = None
        else:
            ans += score(win[i])

print(ans)


Measured memory_bytes: 10128
#include<bits/stdc++.h>
#include<algorithm>
#include<math.h>
#include<iostream>
using namespace std;
long long int lcm(long long int a,long long int b){
  long long int n;
  n=a*b/__gcd(a,b);
  return n;
}
using ll =long long int;
#define ci(a) cin>>a
#define co(a) cout<<a<<endl
#define gcd(a,b) __gcd(a,b)
#define vec vector<ll>
#define for(i,a,b) for(ll i=a;i<b;i++)
#define sort(a,b) sort(a.begin(),b.end())
//gcd 最大公約数
//lcm 最小公倍数
//double 少数（変数）
//string 文字列（変数）
//sqrt 平方根
//ceil 天井関数
//floor 床関数
//abs 絶対値
//pow 累乗
//cbrt  立方根
//hypot 平方和の平方根
//(string-'0') 文字列を数字に変換
 
int main() {
  ll a;
  ci(a);
  vector<string> b(a);
  for(i,0,a)
    ci(b[i]);
  string c="Yes";
  ll d=0;
  for(i,0,a-1){
    for(j,i+1,a)
      if(b[i]==b[j]){
        c="No";
        d++;
        break;
      }
    if(d==1)
      break;
  }
  for(i,0,a-1){
    if(c=="No")
      break;
    ll e=b[i].size();
    if(b[i][e-1]!=b[i+1][0])
      c="No";
  }
  co(c);
}

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

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

using namespace std;

using graph=vector<vector<int>>;

void add_undirected_edge(graph& G,int u,int v){
	G[u].emplace_back(v);
	G[v].emplace_back(u);
}

vector<vector<int>> connected_components(const graph& G){
	int n=G.size();
	vector<vector<int>> res;
	vector<bool> vis(n);
	rep(u,n) if(!vis[u]) {
		vis[u]=true;
		res.emplace_back();
		queue<int> Q; Q.emplace(u);
		while(!Q.empty()){
			int v=Q.front(); Q.pop();
			res.back().emplace_back(v);
			for(int w:G[v]) if(!vis[w]) {
				vis[w]=true;
				Q.emplace(w);
			}
		}
	}
	return res;
}

int main(){
	int n,m; scanf("%d%d",&n,&m);
	graph G(n);
	rep(i,m){
		int u,v; scanf("%d%d",&u,&v); u--; v--;
		add_undirected_edge(G,u,v);
	}

	printf("%ld\n",connected_components(G).size()-1);

	return 0;
}


Measured memory_bytes: 10300
#include<iostream>
#include<vector>
#include<bitset>
#include<string>
#include<cmath>
#include<algorithm>
#include<stack>
using namespace std;


int main(){
  int a,b,c; cin>>a>>b>>c;
  int d,e,f;
  d=a+b;
  e=b+c;
  f=c+a;
  if(d==c){
      cout<<"Yes"<<endl;
  }
  else if(e==a){
      cout<<"Yes"<<endl;
  }
  else if(f==b){
      cout<<"Yes"<<endl;
  }
  else{
      cout<<"No"<<endl;
  }
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
	long long int n,sum=0;
	int c=1;
	cin>>n;
	while(n!=1)
	{
		n=n/2;
		c++;
	}
	//cout<<c;
	for(int i=0;i<c;i++)
	{
		sum+=pow(2,i);
	}
	cout<<sum;
}

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


/// File input & output /////
#define fRead(x)        freopen("x.txt","r",stdin)
#define fWrite(x)       freopen ("x.txt","w",stdout)

#define mt              make_tuple
#define ld              long double
#define ll              long long
#define ull             unsigned long long
#define ff              first
#define ss              second
#define pb              push_back
#define INF             2e16
#define PI              acos(-1.0)
#define mp              make_pair
#define pii             pair<int,int>
#define pll             pair<LL,LL>


#define min3(a,b,c)     min(a,min(b,c))
#define max3(a,b,c)     max(a,max(b,c))
#define min4(a,b,c,d)   min(a,min(b,min(c,d)))
#define max4(a,b,c,d)   max(a,max(b,max(c,d)))
#define SQR(a)          ((a)*(a))
#define FOR(i,a,b)      for(int i=a;i<=b;i++)
#define ROF(i,a,b)      for(int i=a;i>=b;i--)
#define REP(i,b)        for(int i=0;i<b;i++)
#define MEM(a,x)        memset(a,x,sizeof(a))
#define ABS(x)          ((x)<0?-(x):(x))

#define SORT(v)         sort(v.begin(),v.end())
#define REV(v)          reverse(v.begin(),v.end())


#define FASTIO        ios_base::sync_with_stdio(0);cin.tie(nullptr);




///..................Sort by second element in a pair in decending order............. ///
bool SortbySecDesc(const pair<long long,long long > &a, const pair<long long,long long > &b)
{
    return a.second>b.second;
}

///.........................first element of pair in descending order..........................//////
bool sortinrev(const pair<int,int> &a,
               const pair<int,int> &b)
{
       return (a.first > b.first);
}



///.............................................................TEMPLATE................................................./////


//long long  Prime[3000000],nPrime;
//long long  mark[10000002];
//
//void seive(long long int n)
//{
//	long long int i,j,limit=sqrt(n*1.0)+2;
//	mark[1]=1;
//	for(i=4; i<=n ;i+=2)
//	mark[i]=1;
//	Prime[nPrime++]=2;
//	for(i=3; i<=n; i+=2)
//	{
//		if(!mark[i])
//		{
//			Prime[nPrime++]=i;
//			if(i<=limit)
//			{
//				for(j=i*i; j<=n ;j+=i*2)
//				{
//					mark[j]=1;
//				}
//			}
//		}
//	}
//}

int main()
{
    FASTIO;

    ll x;

    string s;

    cin >> x >> s;

    ll ans = (s[0]-'0')*100 + (s[2]-'0')*10 + (s[3]-'0');


    cout << ans*x/100 << endl;




    return 0;
}


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

int main() {
  int A,B,C,D;
  cin >> A >> B >> C >> D ;
  int turn = 0;
  bool result;
  while(1){
    C -= B;
    if(C <= 0){
      result = true;
      break;
    }
    A -= D;
    if(A <= 0){
      result = false;
      break;
    }
  }
  if(result){
    cout << "Yes" ;
  }else{
    cout << "No";
  }
  cout << endl;
  return 0;
}


Measured memory_bytes: 3132
#include <iostream>
#include <numeric>
#include <algorithm>
#include <functional>
#include <vector>
#include <cmath>
#include <chrono>
#include <queue>
#include <set>
#include <cassert>
#include <random>
#include <chrono>
#include <complex>
#include <cstring>
int main() {
    std::ios::sync_with_stdio(false);
    std::cin.tie(nullptr);
    int t;
    std::cin >> t;
    long long p[70][40][30];
    for (int i = 0; i < 70; ++i) {
        for (int j = 0; j < 40; ++j) {
            for (int k = 0; k < 30; ++k) {
                if (i) {
                    p[i][j][k] = 2 * p[i - 1][j][k];
                } else if (j) {
                    p[i][j][k] = 3 * p[i][j - 1][k];
                } else if (k) {
                    p[i][j][k] = 5 * p[i][j][k - 1];
                } else {
                    p[i][j][k] = 1;
                }
            }
        }
    }
    while (t--) {
        long long n;
        std::cin >> n;
        int a, b, c, d;
        std::cin >> a >> b >> c >> d;
        long long ans = 1e18;
        long long f[70][40][30][2];
        std::memset(f, 0x7f, sizeof(f));
        for (int i = 0; ; ++i) {
            for (int j = 0; ; ++j) {
                for (int k = 0; ; ++k) {
                    for (int l = 0; l < 2; ++l) {
                        long long val = n / p[i][j][k] + l;
                        f[i][j][k][l] = std::min(std::abs(n - val), f[i][j][k][l]);
                        if (1.0 * d * val < 1e18)
                            ans = std::min(ans, 1ll * a * i + 1ll * b * j + 1ll * c * k + d * (val + f[i][j][k][l]));
                        if (n >= p[i][j][k]) {
                            for (int r = 0; r < 2; ++r) {
                                f[i + 1][j][k][r] = std::min(f[i + 1][j][k][r], f[i][j][k][l] + std::abs(val - 2 * (n / p[i + 1][j][k] + r)));
                                f[i][j + 1][k][r] = std::min(f[i][j + 1][k][r], f[i][j][k][l] + std::abs(val - 3 * (n / p[i][j + 1][k] + r)));
                                f[i][j][k + 1][r] = std::min(f[i][j][k + 1][r], f[i][j][k][l] + std::abs(val - 5 * (n / p[i][j][k + 1] + r)));
                            }
                        }
                    }
                    if (p[i][j][k] > n)
                        break;
                }
                if (p[i][j][0] > n)
                    break;
            }
            if (p[i][0][0] > n)
                break;
        }
        std::cout << ans << "\n";
    }
    return 0;
}

Measured memory_bytes: 5628
#include <bits/stdc++.h>
#pragma GCC target("avx")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
using namespace std;
#define lli long long int
#define uli unsigned long long int
#define INF 999999999999999999
#define rep(i,m,n) for(lli i = m;i < n;i++)
#define rrep(i,m,n) for(lli i=m-1;i>=n;i--)
#define pb(n) push_back(n)
#define UE(N) N.erase(unique(N.begin(),N.end()),N.end());
#define Sort(n) sort(n.begin(), n.end())
#define Rev(n) reverse(n.begin(),n.end())
#define Out(S) cout << S << endl
#define NeOut(S) cout << S
#define HpOut(S) cout << setprecision(25) << S << endl
#define Vec(K,L,N,S) vector<L> K(N,S)
#define DV(K,L,N,M,S) vector<vector<L>> K(N,vector<L>(M,S))
#define TV(K,L,N,M,R,S) vector<vector<vector<L>>> K(N,vector<vector<L>>(M,vector<L>(R,S)))
#define pint pair<lli,lli>
#define paf(L,R) pair<L,R>
#define mod 1000000007
#define MAX 10000000
#define ALL(a)  a.begin(),a.end()
#define chmax(a, b) a = (((a)<(b)) ? (b) : (a))
#define chmin(a, b) a = (((a)>(b)) ? (b) : (a))
struct UnionFind {
  vector< int > data;
 
  UnionFind(int sz) {
    data.assign(sz, -1);
  }
 
  bool unite(int x, int y) {
    x = find(x), y = find(y);
    if(x == y) return (false);
    if(data[x] > data[y]) swap(x, y);
    data[x] += data[y];
    data[y] = x;
    return (true);
  }
 
  int find(int k) {
    if(data[k] < 0) return (k);
    return (data[k] = find(data[k]));
  }
 
  int size(int k) {
    return (-data[find(k)]);
  }
};
int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  lli A,B,C,D,E,F,N,M,K,L,X,Y,Z,H,W,sum=0,num=0,flag=0;string S,T;
  cin >> N >> M >> K;
  UnionFind uf(N);
  map<int,int>mp;
  rep(i,0,M){
    cin >> A >> B;
    uf.unite(A-1,B-1);
    mp[A-1]++;
    mp[B-1]++;
  }
  rep(i,0,K){
    cin >> C >> D;
    if(uf.find(C-1)==uf.find(D-1)){
      mp[C-1]++;
      mp[D-1]++;
    }
  }
  rep(i,0,N)Out(uf.size(i)-mp[i]-1);
}

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

int main() {
  ll X, K, D;
  cin >> X >> K >> D;

  ll output;

  ll q = abs(X) / D;
  ll r = abs(X) % D;

  if (K <= q) {
    output = abs(X) - K * D;
  } else {
    if ((K - q) % 2 == 0) {
      output = min(r, abs(r - 2 * D));
    } else {
      output = abs(r - D);
    }
  }
  cout << output << endl;
  return 0;
}

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

int main(void){
    long L, R, minimum=2020, tmp;
    cin >>L>>R;
    if(R-L >= 2019){
        cout <<0;
        return 0;
    }
    for (long i = L; i <= R-1; ++i) {
        for (long j = i+1; j <= R; ++j) {
            tmp = (i*j)%2019;
            minimum = min(tmp,minimum);
        }
    }
    cout<<minimum;
    return 0;
}

Measured memory_bytes: 256
#!/usr/bin/env python3
import sys
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
read = sys.stdin.buffer.read
sys.setrecursionlimit(10 ** 7)
INF = float('inf')

X, K, D = map(int, input().split())
X = abs(X)

q, mod = divmod(X, D)

if q < K:
    # print("if")
    X = X - (q * D)
    if (K - q) % 2 == 0:
        ans = X
    else:
        ans = X - D
else:
    # print("else")
    ans = X - (K * D)
print(abs(ans))

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

#define rep(i, n) for(long long i=0;i<(long long)(n);i++)
#define rep2(i, s, n) for(long long i=(s);i<(long long)(n);i++)
#define repi(i, n) for(int i=0;i<(int)(n);i++)
#define rep2i(i, s, n) for(int i=(s);i<(int)(n);i++)
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
#define chmax(s, t) s=max(s,t);
#define chmin(s, t) s=min(s,t); 

#define deg2rad(deg) (((deg)/360)*2*M_PI)
#define rad2deg(rad) (((rad)/2/M_PI)*360)

using ll = long long;
using ld = long double;
using vll = vector<ll>;
using vvll = vector<vll>;
using P = pair<ll, ll>;
using vi = vector<int>;
using vvi = vector<vi>;

const ll INF = (1LL<<60);
const int INFi = (1<<29);

/*素数判定*/
bool is_prime(ll n){
    if(n==1) return false;
    for(ll i=2;i*i<=n;i++){
        if(n%i==0) return false;
    }
    return true;
}

/*約数列挙*/
vll enum_divisors(ll n){
    vll l;
    for(ll i=1;i*i<=n;i++){
        if(n%i==0){
            l.push_back(i);
            if(n/i != i) l.push_back(n/i);
        }
    }
   sort(all(l));
   return l;
}

/*素因数分解*/
vector<P> prime_factorize(ll n){
    vector<P> l;
    for(ll i=2;i*i<=n;i++){
        if(n%i!=0) continue;
        ll e = 0;
        while(n%i==0){
            e++;
            n /= i;
        }
        l.push_back({i, e});
    }
    if(n!=1) l.push_back({n, 1});
    return l;
}

/*最小公倍数*/
ll lcm(ll a, ll b){
    return a*b/__gcd(a,b);
}

/*最大公約数*/
ll gcd(ll a, ll b){
    return __gcd(a,b);
}

/*組み合わせ(Combination)*/
const ll CMAX = 1010000;
const ll CMOD = 1e9+7;
ll fac[CMAX], finv[CMAX], inv[CMAX];
// テーブルを作る前処理
void combinit() {
	fac[0] = fac[1] = 1;
	finv[0] = finv[1] = 1;
	inv[1] = 1;
	for (ll i = 2; i < CMAX; i++) {
		fac[i] = fac[i - 1] * i % CMOD;
		inv[i] = CMOD - inv[CMOD%i] * (CMOD / i) % CMOD;
		finv[i] = finv[i - 1] * inv[i] % CMOD;
	}
}
// 二項係数計算
ll comb(ll n, ll k) {
	if (n < k) return 0;
	if (n < 0 || k < 0) return 0;
	return fac[n] * (finv[k] * finv[n - k] % CMOD) % CMOD;
}

/*階乗*/
ll factorial(ll n){
    const ll FMOD = 1e9+7;
    ll ret = n;
    for(ll i=n-1;i>0;i--){
        ret*=i;
        ret%=FMOD;
    }
    return (ret?ret:1);
}


int main(){

    string s, t; cin >> s >> t;
    if(s.size()<t.size()){
        cout << "UNRESTORABLE" << endl;
        return 0;
    }

    for(ll i=s.size()-t.size();i>=0;i--){
        bool f = true;
        rep(j, t.size()){
            if(s[i+j]!='?'){
                if(t[j]!=s[i+j]){
                    f = false;
                    break;
                }
            }
        }
        if(f){
            rep(j, t.size()){
                s[i+j] = t[j];
            }
            rep(j, s.size()){
                if(s[j]=='?') s[j] = 'a';
            }
            cout << s << endl;
            return 0;
        }
    }

    cout << "UNRESTORABLE" << endl;
    return 0;
}

Measured memory_bytes: 3612
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
#define rep(i,n) for (ll i=0; i<n; ++i)
#define all(c) begin(c),end(c)
#define PI acos(-1)
#define oo LLONG_MAX
template<typename T1, typename T2>
bool chmax(T1 &a,T2 b){if(a<b){a=b;return true;}else return false;}
template<typename T1, typename T2>
bool chmin(T1 &a,T2 b){if(a>b){a=b;return true;}else return false;}
/*

*/
int main(){
  cin.tie(0);
  ios::sync_with_stdio(0);
  
  ll H, W, K, ans = 0; cin >> H >> W >> K;
  vector<vector<char>> C(H, vector<char>(W, '.'));
  rep(i, H) rep(j, W)
    cin >> C[i][j];
  rep(i, 1 << H){
    rep(j, 1 << W){
//      cout<<"i:"<<i<<" j:"<<j<<endl;
      vector<vector<char>> test;
      test = C;
      rep(k, H){
        if((i>>k) & 1)
          rep(x, W)
            test[k][x] = '.';
      }
      rep(k, W){
        if((j>>k) & 1)
          rep(y, H)
            test[y][k] = '.';
      }
      ll tmp = 0;
      rep(n, H) rep(m, W) 
        if (test[n][m] == '#')
          tmp++;
      if (tmp == K)
        ans++;
/*rep(i, H){
  rep(j, W)
    cout<<test[i][j];
  cout<<endl;
}
  cout<<endl;
*/   
//cout << tmp << endl;
    }
  }
  cout << ans << endl;
}



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

using ll = long long;
const ll amari = 1e9+7;
#define ben(a) a.begin(),a.end()

int main(){
	vector<int> ab;
	for(int i = 0; i < 6; i++){
		int a;
		cin >> a;
		ab.push_back(a);
	}
	sort(ben(ab));
	int ok = 0;
	for(int i = 0; i < 6; i++){
		if(ab[i] == ab[i + 1])ok++;
		else{
			ok++;
			if(ok == 3){
				cout << "NO" << endl;
				return 0;
			}
			ok = 0;
		}
	}
	cout << "YES" << endl;
	return 0;
}

Measured memory_bytes: 256
import bisect
import math

N = int(input())
a = list(map(int, input().split()))
a.sort()
n = a[-1]
harf = n/2
ri = bisect.bisect_left(a, harf)
r = a[ri]
if ri > 0 and abs(harf-r) >= abs(harf-a[ri-1]):
  r = a[ri-1]
print(n, r)

Measured memory_bytes: 19800
//arc080_d.cpp
//Sat Jul 20 11:41:07 2019

#include <iostream>
#include <string>
#include <queue>
#include <map>
#include <unordered_map>
#include <vector>
#include <algorithm>
#include <math.h>
#include <set>
#define INTINF 2147483647
#define LLINF 9223372036854775807
using namespace std;
using ll=long long;
typedef pair<int,int> P;

int main(){
	int h,w,n;
	cin >> h >> w >> n;

	vector<int> colors;
	for (int i=0;i<n;i++){
		int temp;
		cin >> temp;
		for (int j=0;j<temp;j++){
			colors.push_back(i+1);
		}
	}

	int count = 0;
	for (int i=0;i<h;i++){
		if (i%2==0){
			for (int j=0;j<w;j++){
				cout << colors[count] << " ";
				count++;
			}
			printf("\n");
		}else if (i%2==1){
			for (int j=0;j<w;j++){
				cout << colors[(i+1)*w-(count-i*w)-1] << " ";
				count++;
			}
			printf("\n");
		}
	}
}

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

#define int long long
#define CASET int _T; cin >> _T; REP(caset, 0, _T)
#define REP(i, l, r) for (int i=(l); i<(r); ++i)
#define RREP(i, r, l) for (int i=(r); i>(l); --i)
#define sq(x) (x)*(x)
#define vi vector<int>
#define vb vector<bool>
#define pii pair<int,int>
#define t3i tuple<int,int,int>
#define t4i tuple<int,int,int,int>
#define mii map<int,int>

const int INF = 1LL<<60;
const int MOD = 998244353;

template<typename T> istream &operator>>(istream &is, vector<T> &vec){ for (auto &v : vec) is >> v; return is; }
string to_string(string s) {return s;}
string to_string(bool b) {return b?"true":"false";}
template <typename A, typename B>
string to_string(pair<A, B> p) {return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";}
template <typename A, typename B, typename C>
string to_string(tuple<A, B, C> t) {return "(" + to_string(get<0>(t)) + ", " + to_string(get<1>(t)) + ", " + to_string(get<2>(t)) + ")";}
template <typename A, typename B, typename C, typename D>
string to_string(tuple<A, B, C, D> t) { return "(" + to_string(get<0>(t)) + ", " + to_string(get<1>(t)) + ", " + to_string(get<2>(t)) + ", " + to_string(get<3>(t)) + ")";}
template <typename A>
string to_string(vector<A> v) {
    bool first = true;
    string result = "[";
    for (A i : v) {
        if (!first) result += ", ";
        first = false;
        result += to_string(i); 
    }
    return result + "]";
}
string bin_string(int x) {
    const int d = 32;
    string result(d, ' ');
    REP(i, 0, d) result[d-1-i] = '0'+(x>>i & 1LL);
    return result;
}

int powa(int base, int exp) {
    int res = 1;
    while (exp) {
        if (exp&1) res = res*base % MOD;
        base = base*base % MOD;
        exp >>= 1;
    }
    return res;
}

main() {
    ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
    
    int n,m;
    cin >> n >> m;
    vi a(n);
    cin >> a;
    sort(a.begin(), a.end());
    vi suff(n+1);
    RREP(i, n-1, -1) suff[i] = suff[i+1] + a[i];

    int k=0;
    int upp = 2e15;
    for (int b=upp; b>=1; b/=2) {
        while (k+b<=upp) {
            int check = k+b;
            int shakes = 0;
            REP(i, 0, n) {
                int kk=-1;
                for (int bb=n; bb>=1; bb/=2) {
                    while (kk+bb<n && a[i]+a[kk+bb]<check) kk += bb;
                }
                shakes += n-kk-1;
            }
            if (shakes < m) break;
            k += b;
        }
    }
    int res = 0, shakes=0;
    REP(i, 0, n) {
        int kk=-1;
        for (int bb=n; bb>=1; bb/=2) {
            while (kk+bb<n && a[i]+a[kk+bb]<k) kk += bb;
        }
        shakes += n-kk-1;
        res += (n-kk-1)*a[i]+suff[kk+1];
    }
    res -= (shakes-m)*k;
    cout << res;
}

Measured memory_bytes: 1792
#!/usr/bin/env python3
s = input()
t = input()
list_s = []
list_t = []
for i in range(len(s)):
    list_s.append(s[i])
for i in range(len(t)):
    list_t.append(t[i])
list_s.sort()
list_t.sort()
for i in range(len(s)):
    if list_s[i] < list_t[-i-1]:
        print("Yes")
        exit(0)
    elif list_s[i] > list_t[-i-1]:
        print("No")
        exit(0)
    elif i == len(t)-1:
        if i < len(s):
            print("No")
        else: print("Yes")
        exit(0)
print("Yes")
    

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
#define pi 2*asin(1.0)


//template functions
/////////////////////////
long Comb(long N,long M){// nCm
long ans=1;
for(long i=N;i>N-M;i--){
    ans=ans*i;
}
for(long i=M;i>0;i--){
    ans=ans/i;
}
return ans;
}
long Perm(long N,long M){// nPm
long ans=1;
for(long i=N;i>N-M;i--){
    ans=ans*i;
}
return ans;
}
long GCM(long A,long B){
            long W,r;
    if(A<B){

        W=B;
        B=A;
        A=W;
    }
    while(A%B!=0){
        r=A%B;
        A=B;
        B=r;
    }
    return B;
}
long LCM(long A,long B){
    return (A*B)/GCM(A,B);
}

long upDiv(long a,long b){
  return (a+b-1)/b;
}

/////////////////////////


//Answer


int main() {

string S;
cin>>S;
if(S=="SSS"){
cout<<0<<endl;
}else if(S=="RRR"){
cout<<3<<endl;
}else if(S=="RRS"||S=="SRR"){
cout<<2<<endl;
}else{
cout<<1<<endl;
} 


}







//高精度要求→しつこくlong doubleでcast　出力はprintf("20.20Lf")とかで
//printf("%a.bLf")のとき、a-b-1が整数部分の桁数。
/*配列系の書き方
long N;
cin>>N;
vector<long> p(N);
for(long i=0;i<N;i++){
cin>>p.at(i);
}

vector<int> d(102,1);

sort(A.begin(),A.end());
reverse(A.begin(),A.end());

typedef pair<long,long> P;
vector<P> p(N);

vector<vector<int>> A(N,vector<int>(M));

int a='A'+2;
cout<<a<<endl;　//a=67 文字は整数型に代入して文字コード化できる。

  char c=65;
cout<<c<<endl;  //c='A' 整数は文字型に代入してその整数が文字コードとしてあらわす整数にできる。

*/

Measured memory_bytes: 3628
# -*- coding: utf-8 -*-
import sys
import math
from bisect import bisect_left
from bisect import bisect_right
from collections import defaultdict
from heapq import heappop, heappush
import itertools
import random
from decimal import *

input = sys.stdin.readline

def inputInt(): return int(input())
def inputMap(): return map(int, input().split())
def inputList(): return list(map(int, input().split()))
def inputStr(): return input()[:-1]

inf = float('inf')
mod = 1000000007

#-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-
#-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-

def main():
	N,M,K = inputMap()
	A = inputList()
	B = inputList()

	sumA = []
	for i,val in enumerate(A):
		if i == 0:
			sumA.append(val)
		else:
			sumA.append(val + sumA[i-1])

	sumB = []
	for i,val in enumerate(B):
		if i == 0:
			sumB.append(val)
		else:
			sumB.append(val + sumB[i-1])

	ans = 0
	for i,val in enumerate(sumA):
		if val > K:
			break
		amari = K - val
		indexs = bisect_right(sumB, amari)
		tmp = (i+1) + indexs
		#print(tmp)
		if ans < tmp:
			ans = tmp

	for i,val in enumerate(sumB):
		if val > K:
			break
		amari = K - val
		indexs = bisect_right(sumA, amari)
		tmp = (i+1) + indexs
		#print(tmp)
		if ans < tmp:
			ans = tmp

	print(ans)

#-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-
#-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-
if __name__ == "__main__":
	main()


Measured memory_bytes: 147188
#include <bits/stdc++.h>                                           
 
//#define int long long
//#pragma GCC optimize("Ofast")
//#pragma comment(linker, "/stack:200000000")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4")
 
 
#define file(s) freopen(s".in","r",stdin); freopen(s".out","w",stdout);
#define forev(i, b, a) for(int i = (b); i >= (a); --i)
#define forn(i, a, b) for(int i = (a); i <= (b); ++i)
#define all(x) x.begin(), x.end()
#define sz(s) (int)s.size()
#define pb push_back
#define ppb pop_back
#define mp make_pair
#define s second
#define f first
 
 
using namespace std;
 
 
typedef pair < long long, long long > pll;    
typedef pair < int, int > pii;
typedef unsigned long long ull;         
typedef vector < pii > vpii;
typedef vector < int > vi;
typedef long double ldb; 
typedef long long ll;  
typedef double db;                         
 
 
const int dx[] = {1, -1, 0, 0}, dy[] = {0, 0, 1, -1}, block = 555;
const pii base = mp(1171, 3307), Mod = mp(1e9 + 7, 1e9 + 9);
const int inf = 1e9, N = 2e5 + 48, mod = 1e9 + 7;
const db eps = 1e-12, pi = 3.14159265359;
const ll INF = 1e18;
 

int n, a[20], x[20][20], y[20][20];

main () {
	cin >> n;
	forn (i, 0, n - 1) {
		cin >> a[i];
		forn (j, 1, a[i])  {
			cin >> x[i][j] >> y[i][j]; 
			--x[i][j];	
		}
	}

	int ans = 0;
	forn (mask, 0, (1 << n) - 1) {
	    int Mask1 = 0, Mask2 = 0;
		forn (i, 0, n - 1)
			if (mask & (1 << i)) {
				forn (j, 1, a[i])
					if (y[i][j])
						Mask1 |= (1 << x[i][j]);
					else
						Mask2 |= (1 << x[i][j]);			
			}	

		if ((Mask1 & mask) == Mask1 && !(mask & Mask2)) 
			ans = max(ans, __builtin_popcount(mask));
	}

	cout << ans << endl;
} 

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

typedef long long ll;

#define mod 1000000007
#define all(x) (x).begin(), (x).end()
#define pb push_back

const long double PI = acos(-1);

ll gcd(ll a,ll b){return b ? gcd(b,a%b) : a;}
ll lcm(ll a,ll b){return a / gcd(a,b) * b;}
ll GetDigit(ll num) {return log10(num)+1;}

int main(){
  string s, t;
  cin >> s >> t;
  int a, b;
  cin >> a >> b;
  string u;
  cin >> u;
  if(u == s) a--;
  else b--;
  cout << a << " " << b << endl;
  return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
#include<string.h>
int main(){
	char ara[15];
	gets(ara);
	int n=strlen(ara);
	if(ara[0]!='A'){
		printf("WA\n");
		return 0;
	}
	int x=0,j;
	for(j=2;j<n-1;j++){
		if(ara[j]=='C') {
			x=0;
			break;
		}
		else x=1;
		
	}
	if(x==1){
		printf("WA\n");
		return 0;
	}
	for(int i=1;i<n;i++){
		if(i==j) continue;
		if(ara[i]>='a' && ara[i]<='z'){}
		else{
			printf("WA\n");
			return 0;
		}
	}
	printf("AC\n");
}

Measured memory_bytes: 128
import java.util.Comparator;
import java.util.Map.Entry;
import java.util.Scanner;
import java.util.SortedMap;
import java.util.TreeMap;

public class Main {
	final static C SINGLE_C = new C();

	static class C implements Comparator<String> {
		private C() {
		};

		@Override
		public int compare(String o1, String o2) {
			int result = o1.length() - o2.length();
			if (result == 0) {
				result = o1.compareTo(o2);
			}
			return result;
		}

	}

	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		int n = in.nextInt();
		int[] value = new int[n];
		int nextIndex = 0;
		SortedMap<String, Integer> indexMap = new TreeMap<String, Integer>(
				SINGLE_C);
		while (n-- > 0) {
			String name = in.next();
			int index;
			if (!indexMap.containsKey(name)) {
				index = nextIndex;
				indexMap.put(name, Integer.valueOf(nextIndex++));
			} else {
				index = indexMap.get(name).intValue();
			}
			value[index] += in.nextInt();
		}
		for (Entry<String, Integer> e : indexMap.entrySet()) {
			System.out.println(e.getKey() + " "
					+ value[e.getValue().intValue()]);
		}

	}
}

Measured memory_bytes: 38084
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
    //  String[] nyu=sc.nextLine().split(" ");
   //  String nyu=sc.nextLine();

int[] num=new int[6];

for(int i=0;i<6;i++){
num[i]=Integer.parseInt(sc.nextLine());
}

if(num[4]-num[0]<num[5]+1){
System.out.println("Yay!");

}else{
System.out.println(":"+"(");

}


//int A=Integer.parseInt(nyu[0]);
//int B=Integer.parseInt(nyu[1]);



	}
}

Measured memory_bytes: 23124
#include <bits/stdc++.h>
using namespace std;
bool f(int64_t n)
  {if (n <= 1) return false;
  for (auto i = 2LL; i * i <= n; ++i) if (!(n % i)) return false;
  return true;}
int main()
  {int N; cin >> N;
  for (int i = 2; i <= 55555 and N; ++i)
    if (f(i) and i % 5 == 1) {--N; cout << i << (N ? " " : "\n");}}

Measured memory_bytes: 3564
import java.util.*;
public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    if (n % 2 == 0) {
      System.out.println(n);
    } else {
      System.out.println(n * 2);
    }
  }
}

Measured memory_bytes: 21716
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(n);i++)
#define sz(x) int(x.size())
#define pb push_back
#define eb emplace_back
using ll=long long;
using P = pair<int,int>;
#define chmax(x,y) x = max(x,y)
#define chmin(x,y) x = min(x,y)
const ll MOD=1000000007;

//Pは<最短距離、頂点番号>。距離のオーダーがllならP pair<ll,int>に変える
#define INF 1e+9//llなら1e18くらい
#define MAX_V 10//最大頂点数
struct Edge{
    int to;
    int cost;
};
int V;//頂点数。main関数で入力
vector<Edge> G[MAX_V];//グラフ。main関数で入力
int d[MAX_V];//最短距離格納用
void dijkstra(int s){//sは始点
    priority_queue<P,vector<P>,greater<P>> que;
    fill(d,d+V,INF);
    d[s]=0;
    que.push(P(0,s));
    while(!que.empty()){
        P p=que.top();
        que.pop();
        int v=p.second;
        if(d[v]<p.first)continue;
        for(int i=0;i<G[v].size();i++){
            Edge e=G[v][i];
            if(d[e.to]>d[v]+e.cost){
                d[e.to]=d[v]+e.cost;
                que.push(P(d[e.to],e.to));
            }
        }
    }
}

int main() {
    int H,W;
    cin>>H>>W;
    rep(i,10){
        rep(j,10){
            int a;
            cin>>a;
            Edge e={i,a};
            G[j].pb(e);
        }
    }
    V=10;
    dijkstra(1);
    int ans=0;
    rep(i,H)rep(j,W){
        int A;
        cin>>A;
        if(A>=0){ans+=d[A];}
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 256
import java.math.BigInteger;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        BigInteger[] b = new BigInteger[a];
        BigInteger total = BigInteger.ONE;
        for(int i =0; i<a; i++) {
            b[i] = sc.nextBigInteger();
            if(BigInteger.ZERO.equals(b[i])) {
                System.out.println("0");
                return;
            }
        }
        BigInteger c = BigInteger.TEN.pow(18);
        for(int i =0; i<a; i++) {
            total = b[i].multiply(total);
            if(0 < total.compareTo(c) ) {
                System.out.println("-1");
                return;
            }
        }
        System.out.println(total);
    }
}

Measured memory_bytes: 56608