akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#define rep(a,b,c) for(int a=b;a<=c;a++)
#define per(a,b,c) for(int a=b;a>=c;a--)
#define ios; ios::sync_with_stdio(false); cin.tie(0);
#define pb push_back
#define mk make_pair
#define fi first
#define se second
#define mem(a,b) memset(a,b,sizeof(a))
#define inf 0x3f3f3f3f
#define ls(x) (x<<1)
#define rs(x) (ls(x)|1)
#define eps 1e-11
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll,ll> pll;
typedef pair<int,int> pii;
typedef vector<int> VI;
typedef double db;
mt19937 rnd(random_device{}());
const int mod = 1e9 + 7;
const int N = 5e3 + 5;
const int M = 1e3 + 5;
inline ll gcd(ll a,ll b){ return b?gcd(b,a%b):a; }
inline ll lcm(ll a,ll b){ return a*b/gcd(a,b); }
inline ll ksm(ll x,ll y){ ll res=1; while(y){if(y&1) res=res*x%mod;
x=x*x%mod; y>>=1;} return res; }
int n, m, k;
int p[N];
ll c[N], f[N];

int main(){
    scanf("%d%d",&n,&k);
    rep(i,1,n) scanf("%d",&p[i]);
    rep(i,1,n) scanf("%lld",&c[i]);
    ll ans=-4e18;
    rep(i,1,n){
        mem(f,0);
        int pos=p[i], tot=0;
        while(pos!=i){
            ++tot;
            f[tot]=f[tot-1] + c[pos];
            pos=p[pos];
        }
        ++tot;
        f[tot]=f[tot-1]+c[pos];
        ll res=f[1], res2=f[1];
        rep(j,1,(k-1)%tot+1) res=max(res,f[j]);
        res+=1ll*((k-1)/tot)*max(0ll,f[tot]);

        rep(j,1,tot) res2=max(res2,f[j]);
        res2+=1ll*(k/tot-1)*max(0ll,f[tot]);
        res=max(res,res2);
        ans=max(ans,res);
    }
    printf("%lld\n",ans);
    return 0;
}
/*

*/
//
//                            _ooOoo_
//                           o8888888o
//                           88" . "88
//                           (| -_- |)
//                           O\  =  /O
//                        ____/`---'\____
//                      .'  \|     |//  `.
//                     /  \|||  :  |||//  \
//                    /  _||||| -:- |||||-  \
//                    |   | \  -  /// |   |
//                    | \_|  ''\---/''  |   |
//                    \  .-\__  `-`  ___/-. /
//                  ___`. .'  /--.--\  `. . __
//               ."" '<  `.___\_<|>_/___.'  >'"".
//              | | :  `- \`.;`\ _ /`;.`/ - ` : | |
//              \  \ `-.   \_ __\ /__ _/   .-` /  /
//         ======`-.____`-.___\_____/___.-`____.-'======
//                            `=---='
//        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
//                     ·ð×æ±£ÓÓ      ÓÀÎÞBUG


Measured memory_bytes: 3872
from collections import deque, defaultdict
n, m, s, t = map(int, input().split())
s -= 1
t -= 1
edges = [[] for _ in range(n)]
for _ in range(m):
  x, y = map(int, input().split())
  x -= 1
  y -= 1
  edges[x].append(y)
  edges[y].append(x)

def dist_from(s):
  INF = 10 ** 20
  dist = [INF] * n
  dist[s] = 0
  que = deque()
  que.append((0, s))
  while que:
    score, node = que.popleft()
    for to in edges[node]:
      if dist[to] > score + 1:
        dist[to] = score + 1
        que.append((score + 1, to))
  return dist

dist_from_s = dist_from(s)
dic1 = {}
for i, d in enumerate(dist_from_s):
  if d in dic1:
    dic1[d].add(i)
  else:
    dic1[d] = {i}

dist_from_t = dist_from(t)
dic2 = {}
for i, d in enumerate(dist_from_t):
  if d in dic2:
    dic2[d].add(i)
  else:
    dic2[d] = {i}

st_dist = dist_from_s[t]
ans = 0
for key in dic1:
  another_key = st_dist - key - 2
  if another_key in dic2:
    add = len(dic1[key]) * len(dic2[another_key])
    for u in dic1[key]:
      for to in edges[u]:
        if to in dic2[another_key]:
          add -= 1
    ans += add
print(ans)



Measured memory_bytes: 47112
#include <bits/stdc++.h>
#define rep(i, a, n) for(int i = a; i < n; i++)
#define repb(i, a, b) for(int i = a; i >= b; i--)
#define all(a) a.begin(), a.end()
#define o(a) cout << a << endl
#define int long long
using namespace std;
typedef pair<int, int> P;

signed main(){
    int a, b;
    char c;
    cin >> a >> c >> b;
    if(c == '+') cout << a + b << endl;
    else cout << a - b << endl;
}

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

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

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

const long long INF=1LL<<60;
int main(){
  int N,W; cin >> N >> W;
  int w[N],v[N];
  for(int i=0;i<N;i++) cin >> w[i] >> v[i];
  
  long long dp[N+1][W+1];
  for(int i=0;i<=N;i++) for(int j=0;j<=W;j++) dp[i][j]=0;

  for(int i=0;i<N;i++){
    for(int j=0;j<=W;j++){
      if(j-w[i]>=0){
        chmax(dp[i+1][j],dp[i][j-w[i]]+v[i]);
      }
      chmax(dp[i+1][j],dp[i][j]);
    }
  }
  cout << dp[N][W] << endl;
}

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

template<class U, class V>
istream& operator >>(istream& in, pair<U, V>& pr) {
    return in >> pr.first >> pr.second;
}

template<class U, class V>
ostream& operator <<(ostream& out, pair<U, V>& p) {
    return out << p.first << " " << p.second;
}

template<class T>
ostream& operator <<(ostream& out, vector<T> vec) {
    for (T& e : vec)
        out << e << " ";
    return out << endl;
}

// ---- 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 X;
    cin >> X;
    cout << (X / 500) * 1000 + (X % 500) / 5 * 5 << endl;
    return 0;
};

Measured memory_bytes: 256
N,M,C= map(int,input().split())
B= list(map(int,input().split()))
now = 0
for i in range(N):
    A=list(map(int,input().split()))
    ans = C
    for j in range(M):
        ans += A[j]*B[j]
    if (ans)>0:
        now += 1
print(now)


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

const int N = 100000;
const int NIL = -1;

int n;
vector<int> G[N];
int color[N];

void dfs(int r, int c){
    stack<int> S;
    S.push(r);
    color[r] = c;

    while(!S.empty()){
        int x = S.top(); S.pop();
        for(int i = 0; i < G[x].size(); i++){
            int v = G[x][i];
            if(color[v] == NIL){
                color[v] = c;
                S.push(v);
            }
        }
    }
}

void solve(){
    int id = 1;
    for(int i = 0; i < n; i++)  color[i] = NIL;
    for(int u = 0; u < n; u++){
        if(color[u] == NIL) dfs(u, id++);
    }
}

int main(){
    int q, s, t;
    cin >> n >> q;

    while(q-- > 0){
        cin >> s >> t;
        G[s].push_back(t);
        G[t].push_back(s);
    }

    solve();

    cin >> q;
    while(q-- > 0){
        cin >> s >> t;
        if(color[s] == color[t])    cout << "yes" << endl;
        else                        cout << "no" << endl;
    }

    return 0;
}



Measured memory_bytes: 8912
#include <iostream>
#include <cstdio>
using namespace std;
int a[100005];
int main() {
	int k;
	cin >> k;
	for (int i = 1; i <= k; i++) 	{
		cin >> a[i];
	}
	long long mmax = 2, mmin = 2;
	for (int i = k; i >= 1 && mmax >= mmin; i--)	{
		if (mmin%a[i] != 0)			mmin = mmin / a[i] * a[i] + a[i];
		mmax = (mmax / a[i] + 1)*a[i] - 1;
	}
	if (mmax >= mmin)		cout << mmin << ' ' << mmax << endl;
	else		cout << -1 << endl;
	return 0;
}


Measured memory_bytes: 640
#include <iostream>
#include <vector>
#include <queue>
#include <algorithm>

using namespace std;

constexpr int INF = 1e9;

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

int main() {
  int n, m;
  cin >> n >> m;
  vector<vector<int>> G(n);
  for (int i=0; i<m; i++) {
    int u, v;
    cin >> u >> v;
    G.at(u-1).push_back(v-1);
  }
  int s, t;
  cin >> s >> t;
  s--, t--;
  
  queue<int> que;
  vector<int> dis(3*n, INF);
  dis.at(3*s) = 0;
  que.push(s);
  while (!que.empty()) {
    int cur = que.front(); que.pop();
    for (int next : G.at(cur)) {
      bool update = false;
      update = update || chmin(dis.at(next*3), dis.at(cur*3+1)+1);
      update = update || chmin(dis.at(next*3+1), dis.at(cur*3+2)+1);
      update = update || chmin(dis.at(next*3+2), dis.at(cur*3)+1);
      if (update) que.push(next);
    }
  }
  
  cout << (dis.at(t*3) == INF ? -1 : dis.at(t*3) / 3) << '\n';
  return 0;
}


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

#define black first
#define white second
#define MP make_pair
#define PB push_back

using namespace std;

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

const int MAXN = 1e5 + 500;

int MOD;
vector <int> G[MAXN];
vector <int> tree[MAXN];
vector <int> prefix[MAXN];
vector <int> sufix[MAXN];
int down[MAXN], up[MAXN];

int add(const int& a, const int& b) {
    if(a + b >= MOD)
        return (a + b - MOD);
    return (a + b);
}

int mult(const int& a, const int& b) {
    return (((ll)a * b) % MOD);
}

void dfs(int node, int parent = -1) {
    for(auto child : G[node]) {
        if(child != parent) {
            tree[node].push_back(child);
            dfs(child, node);
        }
    }
}

void solve_down(int node) {
    int sz = tree[node].size();
    prefix[node].resize(sz);
    sufix[node].resize(sz);

    down[node] = 1;
    for(int i = 0; i < sz; i++) {
        int child = tree[node][i];
        solve_down(child);
        down[node] = mult(down[node], 1 + down[child]);
    }

    for(int i = 0; i < sz; i++) {
        int child = tree[node][i];
        prefix[node][i] = 1 + down[child];
        if(i == 0)
            continue;
        prefix[node][i] = mult(prefix[node][i], prefix[node][i - 1]);
    }

    for(int i = sz - 1; i >= 0; i--) {
        int child = tree[node][i];
        sufix[node][i] = 1 + down[child];
        if(i == sz - 1)
            continue;
        sufix[node][i] = mult(sufix[node][i], sufix[node][i + 1]);
    }
}

void solve_up(int node) {
    int sz = tree[node].size();
    for(int i = 0; i < sz; i++) {
        int child = tree[node][i];
        up[child] = up[node];
        if(i != 0)
            up[child] = mult(up[child], prefix[node][i - 1]);
        if(i != sz - 1)
            up[child] = mult(up[child], sufix[node][i + 1]);
        up[child] = add(up[child], 1);
        solve_up(child);
    }
}

int main() {
    int N, u, v;

    scanf("%d%d", &N, &MOD);
    for(int i = 0; i < N - 1; i++) {
        scanf("%d%d", &u, &v);
        G[u].push_back(v);
        G[v].push_back(u);
    }


    dfs(1);
    solve_down(1);
    up[1] = 1;
    solve_up(1);

    for(int i = 1; i <= N; i++) {
        printf("%d\n", mult(down[i], up[i]));
    }

    return 0;
}


Measured memory_bytes: 29440
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cmath>
using namespace std;
int n;
bool f[2000][2000];
int fa[2000];
bool vis[2000];
struct data {
    int x,y;
}a[1000],b[1000];
bool find(int x) {
    for (int i=1;i<=n;i++) {
        if (!vis[i]&&f[x][i]) {
            vis[i]=true;
            if (fa[i]==0||find(fa[i])) {
                fa[i]=x;
                return true;
            }
        }
    }
    return false;
}
int main() {
    scanf("%d",&n);
    for (int i=1;i<=n;i++)
	scanf("%d%d",&a[i].x,&a[i].y);
    for (int i=1;i<=n;i++)
	scanf("%d%d",&b[i].x,&b[i].y);
    for (int i=1;i<=n;i++)
	for (int j=1;j<=n;j++)
	    if (a[i].x<b[j].x&&a[i].y<b[j].y) f[i][j]=1;
    int ans=0;
    for (int i=1;i<=n;i++) {
        memset(vis,0,sizeof(vis));
        if (find(i)) ans++;
    }
    printf("%d\n",ans);
    return 0;
}


Measured memory_bytes: 512
import Control.Monad
import Data.Maybe
import qualified Data.ByteString.Char8 as BS
import Data.Array.Unboxed
import Data.Bits
import Data.List
--import qualified  Data.ByteString as B
import Data.Ord
import Data.Array.ST
-- import Data.Array.IO 
import Control.Monad.ST
import Data.List.Extra


bsToInt :: BS.ByteString -> Int
bsToInt = fst . fromJust . BS.readInt

bsToIntList :: BS.ByteString -> [Int]
bsToIntList = map bsToInt . BS.words

main :: IO ()
main = do
    n <- bsToInt <$> BS.getLine
    ss <- replicateM n BS.getLine
    let t1 = sort ss 
    --let t3 = listArray (0, length t1) [1..3] :: UArray Int Int
    let t2 = g t1 0
            where
            g [] acc = acc
            g [s1] acc = g [] (acc+1)
            g (s1:s2:ss) acc 
                |s1 == s2  = g (dropWhile (==s1) ss) (acc+1)
                |otherwise = g (s2:ss)               (acc+1)
    
    print $ t2

Measured memory_bytes: 70164
/*******************************
 Author: i_o__o_i
 Created: Friday 2020-04-10
********************************/
#include<bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>
#pragma GCC optimization("Ofast")

using namespace std;
using namespace __gnu_pbds;

typedef     long long   ll;

#define     CS(x) cout << "Case " << x << ": ";
#define     _test int TC; cin >> TC; while(TC--)
#define     sq(x) ((x) * 1LL * (x))
#define     eb emplace_back
#define     pb push_back
#define     all(_n) _n.begin(), _n.end()
#define     rall(_n) _n.rbegin(), _n.rend()
#define     Clear(a, b) memset(a, b, sizeof(a))
#define     sp << ' ' <<
#define     endl "\n"
#define     nl cout << endl
#define     D(x) cout << #x << " >>>>>> " << x << endl;
#define     D2(x, y) cout << #x << " >>> " << x << " # " << #y << " >>> " << y << endl;
#define     DD cout << "--\n";
#define     dbg cout << "!!ERROR ERROR ERROR!!" << endl;
#define     show(x) cout << x << endl
#define     precision(n) cout << fixed << setprecision(n);
#define     exeTime(fun){clock_t start, end; start = clock(); fun; end = clock(); double time_taken = double(end - start) / double(CLOCKS_PER_SEC); cout << "Execution time: " << time_taken << " secs."; }
#define     F first
#define     S second
#define     mini(a, b) a = min(a, b)
#define     maxi(a, b) a = max(a, b)
#define     sz(x) int( x.size() )
#define     gcd(a, b) __gcd(a, b)
#define     lcm(a, b) (abs((a) * (b)) / gcd(a, b))
#define     getbit(n, i) (((n) & (1LL << i)) != 0)
#define     setbit0(n, i) ((n) & (~(1LL << i)))
#define     setbit1(n, i) ((n) | (1LL << i))
#define     kbits(n, k) ((n) & ((1LL << k) - 1))
#define     LSB(n) ((n) & (-(n)))
#define     MSB(n) (1LL << (int)log2(n))
#define     isPowOf2(n) ((n > 0) && (((n) & (n-1)) == 0))
#define     parity(a, b) (a&1 ^ b&1)
#define     cond(__C, __R1, __R2) (__C ? __R1 : __R2)

inline bool _equal(double a, double b) { return fabs(a-b) < 1e-9; }
template<typename T> void print (T t){ for(const auto &it : t) cout << it << ' '; nl; }
template<class T> inline T min(T a, T b, T c){ return min(min(a, b), c); }
template<class T> inline T max(T a, T b, T c){ return max(max(a, b), c); }
template <typename T>  using orderedSet = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>; // order_of_key find_by_order

//mt19937 mrand(random_device{}());
//int rnd(int x) { return mrand() % x;}

const    double Pi = acos(-1.0);
const    int Mod = 1e9 + 7;
const    int Eps = 1e-9;
const    int Inf = 1 << 30;
const    int Maxx = 1e5 + 10;

/******************************[Code Starts Here]********************************/


void _case()
{
    int a, b, c;
    cin >> a >> b >> c;
    swap(a, b); swap(a, c);
    cout << a sp b sp c << endl;
}

int main()
{
    ios::sync_with_stdio(false), cin.tie(nullptr), cout.tie(nullptr);
    _case();
    return 0;
}




Measured memory_bytes: 256
#coding:utf-8
import sys,os
sys.setrecursionlimit(10**6)
write = sys.stdout.write
dbg = (lambda *something: print(*something)) if 'TERM_PROGRAM' in os.environ else lambda *x: 0
def main(given=sys.stdin.readline):
    input = lambda: given().rstrip()
    LMIIS = lambda: list(map(int,input().split()))
    II = lambda: int(input())
    XLMIIS = lambda x: [LMIIS() for _ in range(x)]
    YN = lambda c : print('Yes') if c else print('No')
    MOD = 10**9+7

    N = II()
    A = LMIIS()
    # maxNumBits = len(bin(max(A)))-2
    maxNumBits = 60
    numBitsOne = [0]*maxNumBits
    numBitsZero = [0]*maxNumBits

    for a in A:
        for i,b in enumerate(bin(a)[2:][::-1]):
            if b == '1':
                numBitsOne[i] += 1
    
    for i in range(maxNumBits):
        numBitsZero[i] = N - numBitsOne[i]

    numAnsBitsOne = []
    numAnsBits = list(map(lambda t : t[0]*t[1] , 
[t for t  in zip(numBitsOne,numBitsZero)]))
    
    ans = 0
    for i in range(maxNumBits):
        ans += numAnsBits[i] * 2**i
        ans %= MOD
    print(ans)

if __name__ == '__main__':
    main()

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

#define rep(i,m,n) for(int (i)=(int)(m);i<(int)(n);++i)
#define rep2(i,m,n) for(int (i)=(int)(n)-1;i>=(int)(m);--i)
#define REP(i,n) rep(i,0,n)
#define REP2(i,n) rep2(i,0,n)
#define FOR(i,c) for(decltype((c).begin())i=(c).begin();i!=(c).end();++i)
#define all(hoge) (hoge).begin(),(hoge).end()
#define en '\n'
using ll = long long;
using ull = unsigned long long;
template <class T> using vec = vector<T>;
template <class T> using vvec = vector<vec<T>>;
typedef pair<ll, ll> P;
constexpr long long INF = 1LL << 60;
constexpr int INF_INT = 1 << 25;
//constexpr long long MOD = (ll) 1e9 + 7;
constexpr long long MOD = 998244353LL;
using ld=long double;
static const ld pi = 3.141592653589793L;
typedef vector<ll> Array;
typedef vector<Array> Matrix;


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

struct Edge {
	ll to, rev;
    long double cap;
	Edge(ll _to, long double _cap, ll _rev) {
	to = _to; cap = _cap; rev = _rev;
	}
};
using Edges = vector<Edge>;
using Graph = vector<Edges>;

void add_edge(Graph& G, ll from, ll to, long double cap, bool revFlag, long double revCap) {
	G[from].push_back(Edge(to, cap, (ll)G[to].size()));
	if (revFlag)G[to].push_back(Edge(from, revCap, (ll)G[from].size() - 1));
}

void solve(){
    ll a;
    string bb;
    cin>>a>>bb;
    ll b=(bb[0]-'0')*100+(bb[2]-'0')*10+(bb[3]-'0');
    cout<<a*b/100<<en;
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
	
	solve();
	//ll t;cin>>t;REP(i,t) solve();

    return 0;
}


Measured memory_bytes: 3632
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <cmath>

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define Rep(i, n) for (int i = 1; i <= (int)(n); i++)
#define fore(i, a) for (auto &i:a)

#define ll long long
#define pll vector<pair<ll, ll>>
#define mod 1000000007
#define all(x) (x).begin(), (x).end()
#define pb push_back
#define popcount(x) __builtin_popcountll(x)
using namespace std;

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 stringcount(string s, char c){return count(s.cbegin(), s.cend(), c);}

bool isInteger(double x){return floor(x) == x;}

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

    int a,b,c,d;cin >> a >> b >> c >> d;
    if(abs(a-b) <= d && abs(b-c) <= d || abs(a-c) <= d){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
}

Measured memory_bytes: 256
#include<cstdio>
long long a,b,k;
main(){
    scanf("%lld%lld%lld",&k,&a,&b);
    if(k<=a)return puts("1"),0; 
    else if(a<=b)return puts("-1"),0;   
    else printf("%lld\n",((k-a)/(a-b)+bool((k-a)%(a-b)))<<1|1);
}

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

bool isPrime(int num) {
	if (num == 2)return true;
	if (num < 2 || !(num & 1))return false;
	for (int i = 3; i*i <= num; i += 2) {
		if (num % i == 0) return false;
	}
	return true;
}

int main() {
	int N;
	cin >> N;
	int cnt = 0;
	for (int i = 0; i < N; ++i) {
		int x;
		cin >> x;
		if (isPrime(x))++cnt;
	}
	cout << cnt << endl;
	return 0;
}


Measured memory_bytes: 3092
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <string>
#include <cstring>
#include <cctype>
#include <cmath>
#include <stack>
#include <queue>
#include <vector>
#include <set>
#include <map>
#include <list>
#include <stdio.h>
#include <string.h>
#include <cstdlib>
#include <math.h>
#define INF 2000000000
using namespace std;
int dx[4]={1,0,-1,0},dy[4]={0,1,0,-1};
#define ll long long
#define PL pair<long long, long long>
#define P pair<int,int>
#define mk make_pair
#define en endl;
#define WHITE 0
#define BLACK 2
#define GRAY 1
#define repi(start,end) for(int i=start; i<end; i++)
#define repj(start,end) for(int j=start; j<end; j++)
#define repk(start,end) for(int k=start; k<end; k++)
#define repl(start,end) for(int l=start; l<end; l++)
#define RE return 0;

int main(){
  int a,b,c,x,y;
  cin>>a>>b>>c>>x>>y;
  
  if(c*2>a+b){
    cout<<a*x+y*b<<en
    RE
  }else{
    int minxy=min(x,y);
    if(x>y){
      if(c*x*2<c*2*y+(x-y)*a){
        cout<<c*x*2<<en
        RE
      }else{
        cout<<c*y*2+(x-y)*a<<en
        RE
      }
    }else{
      if(c*2*y<c*2*x+(y-x)*b){
        cout<<c*y*2<<en
        RE
      }else{
        cout<<c*2*x+(y-x)*b<<en
        RE
      }
    }
  }
}


Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <stdint.h> // int64_t

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

int get_int(void) {
  int num;
  scanf("%d", &num);
  return num;
}

// <arr[0]> <arr[1]> .. <arr[size-1]>
int fget_array(double *arr, int size) {
    int i;
    for(i = 0; i < size; i++) {
        scanf("%lf", &arr[i]);
    }
    return 0;
}

#define NUM_MAX 3000

int main(void) {
    int num = get_int();
    static double dp[NUM_MAX+1][NUM_MAX/2+1];
    dp[0][0] = 1;

    static double arr[NUM_MAX];
    fget_array(arr, num);

    int i, j;
    // assume that num is odd
    for(i = 1; i <= num; i++) {
        double prob = arr[i-1];
        for(j = 0; j <= num/2; j++) {
            // front
            dp[i][j] += dp[i-1][j] * prob;
            // back
            if(j>=1) dp[i][j] += dp[i-1][j-1] * (1-prob);
        }
#ifdef DEBUG
        for(j = 0; j <= num/2; j++) {
            printf(" %lf", dp[i][j]);
        }
        putchar('\n');
#endif
    }
    double sum = 0;
    for(i = 0; i <= num/2; i++) {
        sum += dp[num][i];
    }
    printf("%.10lf\n", sum);
    return 0;
}

Measured memory_bytes: 35328
#include <cstdio>
#include <unordered_map>
#include <vector>
#include <algorithm>
using namespace std;
typedef int key;

int main(){
	int r,c,n;
	scanf("%d%d%d",&r,&c,&n);
	unordered_map<key,vector<pair<key,long long>>>m;
	for(;n;n--){
		int s1,s2,d;
		scanf("%d%d%d",&s1,&s2,&d);
		m[s1].emplace_back(s2+r,d);
		m[s2+r].emplace_back(s1,-d);
	}
	for(;!m.empty();){
		long long a=-1LL<<61,b=1LL<<61;
		auto s=m.begin()->first;
		vector<pair<key,long long>>st={{s,0}};
		unordered_map<key,long long>memo={{s,0}};
		for(;!st.empty();){
			auto p=*st.rbegin();st.pop_back();
			auto cur=p.first;long long d=p.second;
			for(auto &e:m[cur]){
				if(memo.find(e.first)==memo.end()){
					st.emplace_back(e.first,d+e.second);
					memo[e.first]=d+e.second;
				}else if(memo[e.first]!=d+e.second){
					puts("No");
					return 0;
				}
			}
			if(cur<=r)a=max(a,d);
			else b=min(b,d);
		}
		if(a>b){
			puts("No");
			return 0;
		}
		for(auto &e:memo)m.erase(m.find(e.first));
	}
	puts("Yes");
}

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

const int N = 2333;
const ll LLINF = ll(4e18);

int n, x;
int a[N];
int f[N][N];

int main() {
    scanf("%d", &n);
    scanf("%d", &x);
    for (int i = 0; i < n; i++) {
        scanf("%d", &a[i]);
    }

    for (int i = 0; i < n; i++) {
        f[i][0] = a[i];
        for (int j = 1; j <= n - 1; j++) {
            int k = (i - j + n) % n;
            f[i][j] = min(f[i][j - 1], a[k]);
        }
    }

    ll ans = LLINF;
    for (int cnt = 0; cnt <= n - 1; cnt++) {
        ll sm = ll(cnt) * x;
        for (int i = 0; i < n; i++) {
            sm += f[i][cnt];
        }
        ans = min(ans, sm);
    }

    printf("%lld\n", ans);
}


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

namespace _069B
{
    class Program
    {
        static void Main(string[] args)
        {

            int count;
            string a, b,l, moji;

            moji = Console.ReadLine();

            count = moji.Length;
            l = (count - 2).ToString();

            a = moji[0].ToString();
            b = moji[count - 1].ToString();

            Console.WriteLine(a +l+ b);

            Console.Read();
        }
    }
}


Measured memory_bytes: 13140
#include <stdio.h>
#include <stdlib.h>
int main()
{
    int n,i,flag=0;
    scanf("%d",&n);
    int a[30];
    for(i=0;i<n;i++){
        scanf("%d",&a[i]);
    }
    for(i=1;i<n-1;i++){
        if((a[i]>a[i-1]&&a[i]<a[i+1])||(a[i]<a[i-1]&&a[i]>a[i+1]))
            flag++;
    }
    printf("%d",flag);
}


Measured memory_bytes: 128
/******************************************
* AHAM BRAHMASHMI ;) *
******************************************/
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define vll vector<ll>
#define pll pair<ll,ll>
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define mod 1000000007


void print_vec(vll a)
{
	cout << "start printing the vector\n";
	for (ll i = 0; i < a.size(); i++)
		cout << a[i] << " ";
	cout << "\n";
}
void print_mat(vector<vll> a)
{
	cout << "start printing the matrix\n";
	for (ll i = 0; i < a.size(); i++)
	{
		for (ll j = 0; j < a[i].size(); j++)
		{
			cout << a[i][j] << " ";
		}
		cout << "\n";
	}
}

/******************************************
* NUMBER THEORY ;) *
******************************************/



ll powermod(ll x, ll y)
{
	ll res = 1;
	x = x % mod;
	while (y > 0)
	{
		if (y & 1)
			res = (res * x) % mod;
		y = y >> 1;
		x = (x * x) % mod;
	}
	res %= mod;
	return res;
}
ll factmod(ll n)
{
	ll res = 1;
	while (n > 1)
	{
		res = (res * ((n / mod) % 2 ?  mod - 1 : 1)) % mod;
		for (ll i = 2; i <= n % mod; ++i)
			res = (res * i) % mod;
		n /= mod;
	}
	res %= mod;
	return res;
}



void solve()
{
	ll a, b;
	cin >> a >> b;
	ll gcd = __gcd(a, b);
	ll lcm = (a * b) / gcd;
	cout << lcm << "\n";

}

int main()
{

#ifndef ONLINE_JUDGE
	// for getting input from input.txt
	freopen("input.txt", "r", stdin);
	// for writing output to output.txt
	freopen("output.txt", "w", stdout);
#endif
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	// ll t;
	// cin>>t;
	// while(t--)
	// {
	solve();
	// }

	return 0;
}

Measured memory_bytes: 3652
import java.util.*;

public class Main {
    public static void main(String[] args){
        Scanner sc=new Scanner(System.in);
        int n=sc.nextInt();
        int m=sc.nextInt();
        int [][] allBit=allBit(n);
        /*for(int i=0;i<allBit.length;i++){
        for(int j=0;j<n;j++)System.out.print(allBit[i][j]);
            System.out.println();
        }*/
        ArrayList<int[]>po=new ArrayList<>();
        for(int i=0;i<m;i++){
            int k=sc.nextInt();
            int[]a=new int[k];
            for(int j=0;j<k;j++){
                a[j]=sc.nextInt();
            }
            po.add(a);
        }
        int[]b=new int[m];
        for(int i=0;i<m;i++){
            b[i]=sc.nextInt();
        }
        long count=0;
        for(int i=0;i<allBit.length;i++){
            boolean bo=true;
            for(int j=0;j<m;j++){
                int c=0;
                for(int l=0;l<po.get(j).length;l++){
                    c+=allBit[i][po.get(j)[l]-1];
                }
                if(c%2!=b[j]){bo=false;break;}
            }
            if(bo)count++;
        }
        System.out.println(count);
    }
    public static int[][] allBit(int n) {
		int[][]a=new int[1<<n][n];
        for(int i=0;i<(1<<n);i++){
            for(int j=0;j<n;j++){
                a[i][j]+=((1&i>>j)==1)?1:0;
            }

        }
		return a;
	}
}


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

int main(){
  int64_t n,k;
  cin >> n >> k;
  if(k!=0){
    cout << "0\n";
    return 0;
  }
  vector<int64_t>a(n-1);
  for(int i=0;i<n-1;i++){
    cin >> k;
    if(k==0){
      cout << "0\n";
      return 0;
    }
    a.at(k-1)++;
  }
  int64_t ans=1;
  for(int i=0;i<n-2;i++){
    int64_t m=1;
    for(int j=0;j<a.at(i+1);j++){
      m*=a.at(i);
      m%=998244353;
    }
    ans*=m;
    ans%=998244353;
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 4028
#include<stdio.h>

int main()
{
    double n;
    scanf("%lf",&n);
    int k;
    scanf("%d",&k);
    int i=0;
    if(n>1){
        while(n>=1){
            n=n/k;
            i++;
        }
    }else{
        i=1;
    }

    printf("%d\n",i);
    return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <iomanip>
#include <stack>
#include <queue>
typedef long long ll;

using namespace std;

int main() {
    int a;
    cin >> a;
    
    string s;
    cin >> s;
    
    if(a < 3200) {
        cout << "red" << endl;
    }
    else {
        cout << s << endl;
    }
    
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define IOS ios::sync_with_stdio(false); cin.tie(0);
#define FOR(i,s,n) for(int i = s; i < (n); i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(n) (n).begin(), (n).end()
#define RALL(n) (n).rbegin(), (n).rend()
#define ATYN(n) cout << ( (n) ? "Yes":"No") << endl;
#define CFYN(n) cout << ( (n) ? "YES":"NO") << endl;
using ll = long long;
using ull = unsigned long long;
using pii = pair<int,int>;

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

    int t = 0;
    bool ans = false;
    REP(i,b) {
        t += a;
        if (t % b == c) {
            ans = true;
            break;
        }
    }

    CFYN(ans)

    return 0;
}

Measured memory_bytes: 256
text=input()
string=input()


#common_length[i]は、探索列がstring[i]で探索を終了したときに、
# string[i-common_lneght[i] + 1] 〜string[i]で構成される文字列が、探索価値を持つことを示す


len_string=len(string)
common_length=[0]*len_string
tmp=0
for i in range(1,len_string):
    if(string[i]==string[tmp]):
        if(string[i-1]==string[tmp-1]):
            common_length[i-1]=1
        else:
            common_length[i-1]=0
        tmp+=1
    else:
        common_length[i-1]=tmp
        if(string[i]==string[0]):
            tmp=1
        else:
            tmp=0

if(string[-1]==string[tmp-1]):
    common_length[-1]=tmp
common_length[0]=0



tmp=0

for i in range(len(text)):
    if(text[i]!=string[tmp]):
        while(text[i]!=string[tmp] and tmp>0):
            tmp=common_length[max([tmp-1,0])]
        if(text[i]==string[tmp]):
            tmp+=1
    else:
        tmp+=1
        if(tmp==len_string):
            print(i-tmp+1)
            tmp=common_length[-1]


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

using namespace std;

int main() {
  int N;
  double sum = 0;
  
  cin >> N;
  
  for (int i = 0; i < N; i++) {
    double in_sum;
    string in_type;
    
    cin >> in_sum >> in_type;
    
    sum += (in_type == "BTC" ? in_sum * 380000.0 : in_sum);
  }
  
  cout << sum << endl;
  
  return 0;
}

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

using ull = unsigned long long;

template<class T>           //自定义读入函数
inline void read(T &a) {
    register T x = 0, flag = 1;
    register char ch;
    while (!isdigit(ch = getchar())) if (ch == '-') flag = -1;
    while (x = x * 10 + (ch & 15), isdigit(ch = getchar()));
    a = x * flag;
}

template <class T>        //自定义写入函数
inline void write(T x) {
    if (x < 0)
        putchar('-'), x = -x;
    if(x >= 10) write(x / 10); 
    putchar(x % 10 + '0');
}

template<class T> inline bool Chkmax(T& x, const T& y) { return x < y ? x = y, true : false; }   //自定义比较函数
template<class T> inline bool Chkmin(T& x, const T& y) { return x > y ? x = y, true : false; }   //自定义比较函数

#define For(i, a, b) for (int i = (a); i <= (b); i++)   //从小到大重复
#define Rep(i, a, b) for (int i = (a); i >= (b); i--)   //从大到小重复
#define For_edge(x) for (int i = head[x]; i; i = net[i])
#define mem0(a) memset(a, 0, sizeof a)    

#if 0

int main()
{
	ull a;
	double b;
	scanf("%llu%lf", &a, &b);
	ull c = (ull)(b*100 + 1e-6);    //加上1e-6是因为浮点数存在误差
	ull result = a * c / 100;
	cout << result << endl;
	return 0;
}

#endif

#if 1

int main()
{
	ull a, b, c;
	scanf("%llu%llu.%llu", &a, &b, &c);
	printf("%llu\n", (a * b + a * c / 100) );
	return 0;
}

#endif

Measured memory_bytes: 3760
using System;
using System.Collections;

class Program{
    public static void Main(){
        var n=int.Parse(Console.ReadLine());
        var hashtable=new Hashtable();
        for(var i=0; i<n; i++){
            var s=Console.ReadLine().Split(' ');
            if(s[0][0]=='f'){
                Console.WriteLine(hashtable.ContainsKey(s[1]) ? "yes" : "no");
            } else{
                if(!hashtable.ContainsKey(s[1])){
                    hashtable.Add(s[1], true);
                }
            }
        }
    }
}

Measured memory_bytes: 63440
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;

int n, a[100009];
int main(){
  cin.tie(0); ios_base::sync_with_stdio(0);
  cin >> n;
  ll tot = 0;
  for(int i=0;i<n;i++) {
    cin >> a[i];
    if (i%2)tot-=a[i];
    else tot+=a[i];
  }
  for(int i=0;i<n;i++) {
    cout << abs(tot) << ' ';
    if (i%2==0) tot-=2*a[i];
    else tot+=2*a[i];
  }
  cout <<endl;
}


Measured memory_bytes: 1792
import java.util.Scanner;
public class Main {


    public static void main(String[] args) {


        Scanner scan = new Scanner(System.in);
        int H1 = scan.nextInt();
        int M1 = scan.nextInt();
        int H2 = scan.nextInt();
        int M2 = scan.nextInt();
        int K = scan.nextInt();
if (H1>H2){H2=H2+24;}
        if (M1>M2){M2=M2+60;
        H2=H2-1;}

int YH=H2-H1;
int YM=M2-M1;

int L=YM+YH*60;
L=L-K;
System.out.println(L);




    }


        }






Measured memory_bytes: 27040
n,m = map(int,input().split())
count = 0
Li = []
Ri = []
for i in range(m):
    l,r = map(int,input().split())
    Li.append(l)
    Ri.append(r)

Limax = max(Li)
Rimin = min(Ri)

for j in range(1,n+1):
    if Limax<=j<=Rimin:
        count+=1
    else:
        pass
print(count)

Measured memory_bytes: 10996
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <numeric>
#include <cmath>
using namespace std;

int main(){
    int64_t n,k,s ;
    cin >> n >> k >> s ;
    if (s < 1000000000)
    {
        int i = 0;
        while (i < k)
        {
            if (i < n-1)
            {
                cout << s << " " ;
            }else
            {
                cout << s << endl ;
            }
            i++ ;
        }
        while (i < n)
        {
            if (i < n-1)
            {
                cout << 1000000000 << " " ;
            }else
            {
                cout << 1000000000 << endl ;
            }
            i++ ;
        }
        
        
    }else
    {
        for (size_t i = 0; i < n; i++)
        {
            if (i < k)
            {
                cout << s ;
            }else
            {
                cout << 1 ;
            }
            if (i < n-1)
            {
                cout << " " ;
            }else
            {
                cout << endl ;
            }
            
            
            
        }
        
    }
    
    
}    

Measured memory_bytes: 1280
#----グローバル変数----
INF = 10**10 #無限大（最小化問題の場合）
dp=[]       #DPテーブル

h=[]   #足場の高さ
#----------------------

#----関数----

#DPテーブル更新関数　最小化用＆最大化用
def chmin(dp, idx, new_val):
    if dp[idx] > new_val:
        dp[idx] = new_val
        return True
    return False

def chmax(dp, idx, new_val):
    if dp[idx] < new_val:
        dp[idx] = new_val
        return True
    return False
#------------


#----実行開始----
# 入力
n,k = map(int, input().split())

s = input()
h = [int(x) for x in s.split()]

# DPテーブル初期化 (最小化問題なので INF に初期化)
for i in range(n):
    dp.append(INF)

# 初期条件
dp[0] = 0;

# ジャンプのループ
for i in range(1,n):
    farthest = max(0,i-k)
    for j in range(farthest,i):
        # jp check    
        jpcost = abs(h[j]-h[i])
        chmin(dp,i,dp[j]+jpcost)

# 出力
print(dp[n-1])

#---------------


Measured memory_bytes: 56544
#include <cassert>
#include <iostream>
#include <vector>

/* デバッグ時はコメントアウトする */
#define NDEBUG

static const int MAX_WEIGHT = 50;	/* セミ地図の最大幅 */
static const int MAX_HEIGHT = 50;	/* セミ地図の最大高さ */

void cicada(void)
{
	/* [幅][高さ] の位置に進む際の最小セミ遭遇数地図 */
	std::vector< std::vector<int> > min_encount_vector( MAX_WEIGHT, std::vector<int>(MAX_HEIGHT, 0) );

	char in;												/* input 文字 */
	int  encount;											/* [幅][高さ] の位置に存在するセミの数 */
	int  weight, height;									/* input 幅、input 高さ */

	/* -------------------- */
	/* 地図の幅、高さを取得 */
	/* -------------------- */
	std::cin >> height >> weight;

	assert( height <= MAX_WEIGHT );	/* 最大値チェック */
	assert( weight <= MAX_HEIGHT );	/* 最大値チェック */

	/* -------------------------- */
	/* 最小セミ遭遇数の地図を作成 */
	/* -------------------------- */
	for (int h = 0; h < height; ++h)
	{
		for (int w = 0; w < weight; ++w)
		{
			/* セミ地図1マス分を取得 */
			std::cin >> in;
			encount = in - '0';
			
			assert(0 <= encount && encount <= 9);	/* 入力値チェック */

			if (w == 0 && h == 0)
			{
				/* スタート位置 */
				min_encount_vector[w][h] = encount;
			}
			else if (w == 0)
			{
				/* 一番上なので、左からしか来れない */
				min_encount_vector[w][h] = min_encount_vector[0][h - 1] + encount;
			}
			else if (h == 0)
			{
				/* 一番左なので、上からしか来れない */
				min_encount_vector[w][h] = min_encount_vector[w - 1][0] + encount;
			}
			else
			{
				/* 上と左、値が小さいほうから来れば出会う蝉の数は最小になる */
				min_encount_vector[w][h] = std::min( min_encount_vector[w - 1][h], min_encount_vector[w][h - 1]) + encount;
			}
		}
	}

	/* -------------------------- */
	/* 出会う蝉の数の最小値を出力 */
	/* -------------------------- */
	std::cout << min_encount_vector[weight - 1][height - 1] << std::endl;

	return;
}

int main()
{
	cicada();
	return 0;
}



Measured memory_bytes: 3180
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<utility>
using namespace std;
#define rep(i, n) for(int i = 0; i < n; i++)

int main()
{
    int N;
    cin >> N;
    string s;
    cin >> s;
    if(N >= 3200)   cout << s << endl;
    else
    {
        cout << "red" << endl;
    }
    return 0;
}


Measured memory_bytes: 256
#include <bitset>
#include <cstdlib>
#include <functional>
#include <iostream>
#include <queue>
#include <vector>
using namespace std;

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

template<class T> inline void chmin(T &a, const T &b) { if(a > b) a = b; }

struct state {
	int v, t, d;
	state(int v_, int t_, int d_):v(v_), t(t_), d(d_) {}
	bool operator>(const state &s) const {
		return d > s.d;
	}
};

struct edge {
	int to, cost, time, company;
	edge(int to_, int cost_, int time_, int company_):to(to_), cost(cost_), time(time_), company(company_) {}
};

constexpr int MAX_K = 8;
constexpr int INF = (1 << 29);

int dijkstra(int s, int t, int h, const vector<vector<edge>> &G, const bitset<MAX_K> &b, int limit) {
	const int n = G.size();
	vector<vector<int>> dist(n, vector<int>(h + 1, INF));
	priority_queue<state, vector<state>, greater<state>> que;

	dist[s][0] = 0;
	que.push(state(s, 0, 0));

	while(!que.empty()) {
		const state s = que.top();
		que.pop();

		if(s.d >= limit) return INF;
		if(s.d > dist[s.v][s.t]) continue;
		if(s.v == t) return s.d;

		for(const auto &e : G[s.v]) {
			const int next_time = s.t + e.time;
			if(next_time > h) continue;

			const int next_dist = s.d + (b[e.company] ? 0 : e.cost);
			if(dist[e.to][next_time] > next_dist) {
				dist[e.to][next_time] = next_dist;
				que.emplace(e.to, next_time, next_dist);
			}
		}
	}

	return INF;
}

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

	for(int n, m, h, k; cin >> n >> m >> h >> k && n;) {
		vector<vector<edge>> G(n);

		rep(i, m) {
			int a, b, c, t, r;
			cin >> a >> b >> c >> t >> r;
			--a; --b; --r;
			G[a].emplace_back(b, c, t, r);
			G[b].emplace_back(a, c, t, r);
		}

		int s, t, p;
		cin >> s >> t >> p;
		--s; --t;

		vector<int> pass(p, 0);
		vector<int> value(p);

		rep(i, p) {
			int l;
			cin >> l >> value[i];

			rep(j, l) {
				int q;
				cin >> q;
				pass[i] |= (1 << (q - 1));
			}
		}

		vector<int> min_cost(1 << k, INF);
		min_cost[0] = 0;

		int ans = INF;
		rep(i, 1 << k) {
			if(min_cost[i] >= ans) continue;

			const int limit = ans - min_cost[i];
			chmin(ans, dijkstra(s, t, h, G, bitset<MAX_K>(i), limit) + min_cost[i]);

			rep(j, p) {
				const int next = (i | pass[j]);
				chmin(min_cost[next], min_cost[i] + value[j]);
			}
		}

		cout << (ans == INF ? -1 : ans) << endl;
	}
	return EXIT_SUCCESS;
}

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

int main() {
  ll N = 0, M = 0, X = 0;
  cin >> N >> M >> X;
  rep(i,10000){
    ll tmp = 0;
    tmp = N*(i+1) % M;
    if(tmp == X){
      cout << "YES";
      return 0;
    }
  }
  cout << "NO";
}

Measured memory_bytes: 3560
#include<bits/stdc++.h>
using namespace std;
     
#define ll long long
#define loop(i,a,n) for(ll i=a;i<n;++i)
#define revloop(i,a,b) for(ll i=a;i>=b;--i)
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define INF 9999999999999999
#define MOD 1000000007

ll cnt;

void dfs(ll s,vector<ll> adj[],bool vis[]){
    vis[s]=true;
    ++cnt;
    for(auto u:adj[s]){
        if(!vis[u]){
            dfs(u,adj,vis);
        }
    }
}

void func()
{
    ll n,m;
    cin>>n>>m;
    vector<ll> adj[n+1];
    set<pair<ll,ll> > s;
    loop(i,0,m){
        ll a,b;
        cin>>a>>b;
        if(s.count(mp(a,b))==0){
            adj[a].pb(b);
            adj[b].pb(a);
            s.insert(mp(a,b));
        }
    }
    bool vis[n+1]={0};
    ll ans=0;
    loop(i,1,n+1){
        cnt=0;
        dfs(i,adj,vis);
        ans=max(ans,cnt);
    }
    cout<<ans<<"\n";
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
 
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r" , stdin);
    freopen("output.txt", "w" , stdout);
    #endif
 
    ll t=1;
    //cin>>t;
    //solve();
    while(t--)
    {
        func();
    }

}


Measured memory_bytes: 36652
from collections import Counter
def ABC073C_WriteAndErase():
    N = int(input().strip())
    Ai = [int(input().strip()) for i in range(N)]


    Bi = Counter(Ai)
    count = 0
    for key, val in Bi.items():
        if val % 2 == 1:
            count += 1

    print(count)
    

def main():
    ABC073C_WriteAndErase()

if __name__ == "__main__":
    main()


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

using namespace std;
#define all(a)a.begin(),a.end()
using ll=long long;
const int INF = 1<<30;
const ll INFll =1LL<<62;
//const int mod= int(1e9)+7;
const int mod=998244353;
using P = pair<int,int>;
using Pll = pair<ll,ll>;
using ld=long double;

int main(){
    int n;cin >>n;
    cout <<"ABC"<<n<<endl;
}


Measured memory_bytes: 3592
import java.util.Arrays;
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        @SuppressWarnings("resource")
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] a = new int[n];
        for (int i = 0 ; i < n ; i++) {
            a[i] = sc.nextInt();
        }
        Arrays.sort(a);
        int alice = 0;
        int bob = 0;
        for (int i = 0 ; i < n ; i++) {
            if (i % 2 == 0) {
                alice += a[n - 1 - i];
            } else {
                bob += a[n - 1 - i];
            }
        }
        System.out.println(alice - bob);
    }

}

Measured memory_bytes: 21972
/**
 *    author:  otera    
**/
#include<iostream>
#include<string> 
#include<cstdio>
#include<cstring>
#include<vector>
#include<cmath>
#include<algorithm> 
#include<functional>
#include<iomanip>
#include<queue>
#include<deque>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
#include<cassert>
using namespace std;

//#define int long long
typedef long long ll;
typedef unsigned long long ul;
typedef unsigned int ui;
typedef long double ld;
const int inf=1e9+7;
const ll INF=1LL<<60 ;
const ll mod=1e9+7 ;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
typedef complex<ld> Point;
const ld eps = 1e-8;
const ld pi = acos(-1.0);
typedef pair<int, int> P;
typedef pair<ld, ld> LDP;
typedef pair<ll, ll> LP;
#define fr first
#define sc second
#define all(c) c.begin(),c.end()
#define pb push_back
#define debug(x)  cerr << #x << " = " << (x) << endl;
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; }

void solve() {
	int n, h, w; cin >> n >> h >> w;
    vector<int> a(n), b(n);
    rep(i, n) {
        cin >> a[i] >> b[i];
    }
    int ans = 0;
    rep(i, n) {
        if(a[i] >= h && b[i] >= w) {
            ++ ans;
        }
    }
    cout << ans << endl;
}

signed main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	//cout << fixed << setprecision(10);
	//int t; cin >> t; rep(i, t)solve();
	solve();
    return 0;
}

Measured memory_bytes: 256
a, b, h, m = map(int, input().split())

kakudo_s = h * 30 + m / 2
kakudo_l = m * 6
import math
x_s = math.cos(math.radians(kakudo_s)) * a
y_s = math.sin(math.radians(kakudo_s)) * a
x_l = math.cos(math.radians(kakudo_l)) * b
y_l = math.sin(math.radians(kakudo_l)) * b

def get_distance(x1, y1, x2, y2):
    d = math.sqrt((x2 - x1) ** 2 + (y2 - y1) ** 2)
    return d

print(get_distance(x_s, y_s, x_l, y_l))

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

template<typename T>
istream &operator>>(istream &is, vector<T> &v) {
	for (auto &x : v) is >> x;
	return is;
}

int main() {
	ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	string s;
	cin >> s;
	long long sum = 0;
	for (int i = 0; i < s.size(); i++) {
		sum += s[i] - '0';
	}
	cout << (sum % 9 == 0 ? "Yes" : "No") << '\n';
	return 0;
}



Measured memory_bytes: 3740
import Numeric

main :: IO ()
main = do
  [n,k] <- map read . words <$> getLine :: IO [Double]
  if n < k
    then putStrLn $ showFFloat (Just 10) ((/n) $ sum $ map (\x -> (0.5)^(ceiling (logBase 2 (k / x)))) [1..n]) ""
    else putStrLn $ showFFloat (Just 10) (((n-k+1)/n) + (sum $ map (\x -> (0.5)^(ceiling (logBase 2 (k / x)))) [1..(k-1)])/n) ""


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

int main() {
    int n, m;
    cin >> n >> m;
    
    int a[100][100];
    int b[100];
    int c[100];
    
    for (int i = 0;i < n;i++){
        for (int  j = 0;j < m;j++){
            cin >> a[i][j];
        }
    }
    
    for (int i = 0;i < m;i++){
        cin >> b[i];
    }
    
    for (int i = 0;i < n;i++){
        c[i] = 0;
        for(int j = 0;j < m;j++){
            c[i] += a[i][j] * b[j];
        }
        
    }
    
    for (int i = 0;i < n;i++){
        cout << c[i] << endl;
    }
    return 0;
}

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

#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,a) FOR(i,0,a)

using namespace std;

typedef long long ll;

const int INF=1e9+1,MAX_N=2e5;

int N;
ll A[MAX_N],B[MAX_N];

int main(){
	cin>>N;
	ll sum=0,m=INF;
	REP(i,N){
		cin>>A[i]>>B[i];
		if (A[i]>B[i]){
			m=min(m,B[i]);
		}
		sum+=A[i];
	}
	if (m==INF){
		cout<<0<<endl;
	}else{
		cout<<sum-m<<endl;
	}
	return 0;
}

Measured memory_bytes: 512