akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<vector>
#include<string>
#include<set>
#include<cstring>
#include<algorithm>
using namespace std;
#define INF (1<<29)

bool p(int n){
	for(int i=6;i*i<=n;i+=(i%7==6?2:5)){
		if(n%i==0)return false;
	}
	return true;
}
vector<int> divisor(int n){
	vector<int> res;
	for(int i=6;i*i<=n;i+=(i%7==6?2:5)){
		if(n%i==0){
			if(p(i))res.push_back(i);
			if(i!=n/i && p(n/i))res.push_back(n/i);
		}
	}
	if(p(n))res.push_back(n);
	return res;
}

int main(){
	int n;
	while(cin>>n,n-1){
		cout<<n<<':';
		vector<int> div=divisor(n);
		sort(div.begin(),div.end());
		for(int i=0;i<div.size();i++)cout<<' '<<div[i];
		cout<<endl;
	}
	return 0;
}

Measured memory_bytes: 1216
#include <bits/stdc++.h>
#define sp ' '
#define nyan "(=^・ω・^=)"
#define mkp make_pair
#define intmax 2147483647
#define llmax 9223372036854775807
#define lP pair<ll,ll>
#define iP pair<int,int>
typedef long long ll;
using namespace std;
const int mod = 1000000007, mod998 = 998244353;

int N, K, res;

int main() {
	cin >> N >> K;
	if (N%K != 0)
		res = 1;
	cout << res << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define lli long long int
#define uli unsigned long long int
#define INF 99999999999
#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(150) << 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 5100000
#define chmax(a, b) a = (((a)<(b)) ? (b) : (a))
#define chmin(a, b) a = (((a)>(b)) ? (b) : (a))
int main(){
  lli A,B,C,D,E,F,N,M,K,L,R,X,Y,H,W,sum=0,num=0,flag=0;string S,T;
  cin >> N;
  Vec(P,int,N,0);rep(i,0,N)cin >> P[i];
  cin >> M;
  Vec(Q,int,M,0);rep(i,0,M)cin >> Q[i];
  Sort(P);Sort(Q);
  S="YES";
  rep(i,0,M){
    flag=0;
    while(num<N){
      if(P[num]==Q[i]){flag=1;num++;break;}
      else num++;
    }
    if(!flag){S="NO";break;}
  }
  Out(S);
}

Measured memory_bytes: 1792
#include <cstdio>
#include <cstring>
#include <iostream>
#include <string>
#include <cmath>
#include <bitset>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <algorithm>
#include <complex>
#include <unordered_map>

using namespace std;
typedef long long int ll;
typedef pair<int, int> P;

const ll MOD=998244353ll;

ll powmod(ll a, ll k){
    ll ap=a, ans=1;
    while(k>0){
        if(k%2==1){
            ans*=ap;
            ans%=MOD;
        }
        ap=ap*ap;
        ap%=MOD;
        k/=2;
    }
    return ans;
}

ll inv(ll a){
	return powmod(a, MOD-2);
}

int main()
{
	int k, n;
	cin>>k>>n;
	ll f[2002], invf[2002], p2[2002];
	f[0]=1; p2[0]=1;
	for(ll i=1; i<=2000; i++){
		f[i]=f[i-1]*i%MOD;
		p2[i]=p2[i-1]*2%MOD;
	}
	invf[2000]=inv(f[2000]);
	for(ll i=1999; i>=0; i--){
		invf[i]=invf[i+1]*(i+1)%MOD;
	}
	ll c[2][2002][2002];
	for(int i=0; i<=k; i++){
		for(int t=0; t<2; t++){
			c[t][0][i]=0;
			if(i-1>=0 && n-t>=i) c[t][0][i]+=(f[n-t-1]*invf[i-1]%MOD*invf[n-t-i]%MOD);
        }
	}
	for(int i=1; i<=k; i++){
		for(int j=0; i+j<=k; j++){
			for(int t=0; t<2; t++){
				c[t][i][j]=c[t][i-1][j+1]+c[t][i-1][j];
				c[t][i][j]%=MOD;
			}
		}
	}
	ll ans[2002];
	for(int i=2; i<=k+1; i++){
		ans[i]=0;
		for(int j=0; j<=(i-1)/2; j++){
			ans[i]=(ans[i]+p2[j]*c[0][k-i+1][j]%MOD*f[(i-1)/2]%MOD*invf[j]%MOD*invf[(i-1)/2-j]%MOD)%MOD;
			if(i%2==0) ans[i]=(ans[i]+p2[j]*c[1][k-i+1][j]%MOD*f[(i-1)/2]%MOD*invf[j]%MOD*invf[(i-1)/2-j]%MOD)%MOD;
		}
		cout<<ans[i]<<endl;
	}
	for(int i=k; i>=2; i--) cout<<ans[i]<<endl;
    return 0;
}

Measured memory_bytes: 62720
#include <iostream>

int main () {
  int D,N;
  std::cin >> D >> N;
  if (D == 0) {
    if (N == 100) {
      std::cout << N + 1 << std::endl;  
    }
    else {
      std::cout << N << std::endl;  
    }
  }
  else {
    if (D == 1) {
      if (N == 100 ) {
        std::cout << N * 100 + 100 << std::endl;  
      }
      else {
        std::cout << N * 100 << std::endl;  
      }
     }  
    else {
      if (N == 100) {
        std::cout << N * 100 * 100 + 100*100 << std::endl;  
      }
      else {
        std::cout << N * 100 * 100 << std::endl;  
      }
    }
  }
}

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

using namespace std;
int main(int argc, char *argv[]) {
	int n;
	cin >> n;
	int a[n] = {INT_MAX};
	int b[n-1];
	for (int i = 0; i < n - 1; i++) {
		cin >> b[i];
	}
	
	for (int i = 0; i < n - 1; i++) {
		a[i] = min(a[i], b[i]);
		a[i+1] = b[i];
	}
	int ans = 0;
	for (int i = 0; i < n; i++) {
		ans += a[i];
	}
	
	cout << ans << endl;
}

Measured memory_bytes: 256
// I - Snack.cpp : This file contains the 'main' function. Program execution begins and ends there.
//

#include <iostream>
using namespace std;

#define ll long long

ll gcd(int A, int B) {
	if (B > A)
		swap(A,B);

	int C = A % B;

	while (C) {
		A = B;
		B = C;
		C = A % B;
	}
	return B;

}
int main()
{
	ll x, y;

	cin >> x >> y;
	cout << x * y / gcd(x, y);
	
}


Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include <iostream>
#include <string>
#include <list>
#include <vector>
#include <queue>
#include <algorithm>
#include <climits>
#include <cstring>
#include <cmath>
#include <stack>
#include <iomanip>
#include <tuple>
#include <functional>
#include <cfloat>
#include <map>
#include <set>
#include <array>
#include <stdio.h>
#include <string.h>
using ll = long long;
using ull = unsigned long long;
using namespace std;
#define int long long
#define CONTAINS(v,n) (find((v).begin(), (v).end(), (n)) != (v).end())
#define SORT(v) sort((v).begin(), (v).end())
#define RSORT(v) sort((v).rbegin(), (v).rend())
#define ARY_SORT(a, size) sort((a), (a)+(size))
#define REMOVE(v,a) (v.erase(remove((v).begin(), (v).end(), (a)), (v).end()))
#define REVERSE(v) (reverse((v).begin(), (v).end()))
#define ARY_REVERSE(v,a) (reverse((v), (v)+(a)))
#define REP(i, n) for (int (i)=0; (i) < (n); (i)++)
#define CONTAINS_MAP(m, a) (m).find((a)) != m.end()
void YesNo(bool b) { cout << (b ? "Yes" : "No") << endl; }
void YESNO(bool b) { cout << (b ? "YES" : "NO") << endl; }
//max_element



signed main()
{
	int a;
	cin >> a;
	cout << (a + a * a + a * a * a) << endl;
}



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

int main(){
  int n;
  cin >> n;
  bool second = true;
  for(int i=0; i<n; i++){
    int num;
    cin >> num;
    if(num % 2 != 0) second = false;
  }
  if(second) cout << "second" << endl;
  else cout << "first" << endl;
  return 0;
}


Measured memory_bytes: 3620
n,x=(int(x) for x in input().split())
while n!=0 or x!=0:
    count=0
    for i in range(1,n+1):
        for j in range(i+1,n+1):
            for k in range(j+1,n+1):
                if i+j+k==x:
                    count+=1
    print(count)
    n,x=(int(x) for x in input().split())


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

int main()
{
    int n, m, Q;
    cin >> n >> m >> Q;
    int a[501][501];
    int l[200001], r[200001];
    for(int i = 0; i < n; i++){
        for(int j = 0; j < n; j++){
            a[i][j] = 0;
        }
    }
    for(int i = 0; i < m; i++){
        cin >> l[i] >> r[i];
        a[l[i] - 1][r[i] - 1]++;
    }
    for(int i = 0; i < n; i++){
        for(int j = 0; j < n - 1; j++){
            a[i][j + 1] += a[i][j];
        }
    }
    for(int j = 0; j < n; j++){
        for(int i = n - 1; i > 0; i--){
            a[i - 1][j] += a[i][j];
        }
    }
    int p[100001], q[100001];
    for(int i = 0; i < Q; i++){
        cin >> p[i] >> q[i];
        cout << a[p[i] - 1][q[i] - 1] << endl;
    }
}

Measured memory_bytes: 4224
#include<iostream>
#include<string>

using namespace std;

class DICE{
public:
    int top;
    int bottom;
    int right;
    int left;
    int front;
    int back;
    void South();
    void North();
    void East();
    void West();
    void LF();
    void RF();
};

void DICE::South(){
    int temp = back;
    back = top;
    top = front;
    front = bottom;
    bottom = temp;
}

void DICE::North(){
    int temp = front;
    front = top;
    top = back;
    back = bottom;
    bottom = temp;
}

void DICE::West(){
    int temp = left;
    left = top;
    top = right;
    right = bottom;
    bottom = temp;
}

void DICE::East(){
    int temp = right;
    right = top;
    top = left;
    left = bottom;
    bottom = temp;
}

void DICE::RF(){
    int temp = front;
    front = left;
    left = back;
    back = right;
    right = temp;
}

void DICE::LF(){
    int temp = front;
    front = right;
    right = back;
    back = left;
    left = temp;
}


int main(){
    DICE d1;
    DICE d2;
    cin>>d1.top>>d1.back>>d1.right>>d1.left>>d1.front>>d1.bottom;
    cin>>d2.top>>d2.back>>d2.right>>d2.left>>d2.front>>d2.bottom;

    for(int i=0;i<4;i++)
    {
        if(d1.top == d1.back)d1.South();
    }
    for(int i=0;i<4;i++)
    {
        if(d1.back == d1.right)d1.RF();
    }


    if(d2.top != d1.top)
    {
        d2.South();
        if(d2.top != d1.top)
        {
            d2.South();
            if(d2.top != d1.top)
            {
                d2.South();
                if(d2.top != d1.top)
                {
                    d2.South();
                    if(d2.top != d1.top)
                    {
                        d2.East();
                        if(d2.top != d1.top)
                        {
                            d2.East();
                            d2.East();
                        }
                    }
                }
            }
        }
    }

    if(d2.back != d1.back)
    {
        d2.RF();
        if(d2.back != d1.back)
        {
            d2.RF();
            if(d2.back != d1.back)
            {
                d2.RF();
                if(d2.back != d1.back){
                    d2.RF();
                }
            }
        }
    }

    if(d1.top == d2.top &&
        d1.bottom == d2.bottom &&
        d1.right == d2.right &&
        d1.left == d2.left &&
        d1.front == d2.front &&
        d1.back == d2.back){
            cout<<"Yes"<<endl;
    }else
    {
        cout<<"No"<<endl;
    }


    return 0;
}

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

int main() {
    int k,s;
    cin >> k >> s;
    int ans = 0;
    for(int x=0; x<=k; x++){
        for(int y=0; y<=k; y++){
            int z = s - x - y;
            if(0 <= z && z <= k) ans++;
        }
    }
    cout << ans << endl;
}

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

typedef long long lint;
typedef long double louble;

template<typename T1,typename T2> inline T1 max(T1 a,T2 b){return a<b?b:a;}
template<typename T1,typename T2> inline T1 min(T1 a,T2 b){return a<b?a:b;}

namespace ae86
{
	const int bufl = 1<<15;
	
	char buf[bufl],*s=buf,*t=buf;
	
	inline int fetch()
	{
		if(s==t){t=(s=buf)+fread(buf,1,bufl,stdin);if(s==t)return EOF;}
		return *s++;
	}
	
	inline int ty()
	{
		int a=0,b=1,c=fetch();
		while(!isdigit(c))b^=c=='-',c=fetch();
		while(isdigit(c))a=a*10+c-48,c=fetch();
		return b?a:-a;
	}
}
using ae86::ty;

const int _ = 100007;
const char *YES = "Yes" , *NO = "No";

int n,m,qn,ea[_],eb[_],ec=0,pa[_],pb[_],pc=0;
int bfa[_]={0};

int findbfa(int x){return bfa[x]==x?x:bfa[x]=findbfa(bfa[x]);}
inline void link(int a,int b){bfa[findbfa(b)]=findbfa(a);}

int main()
{
	n=ty(),m=ty();qn=ty();
	for(int i=1;i<=qn;i++)
	{
		int a=ty()+1,b=ty()+1,c=ty();
		if(c)pc++,pa[pc]=a,pb[pc]=b;
		else ec++,ea[ec]=a,eb[ec]=b;
	}

	for(int i=1;i<=n;i++)bfa[i]=i;
	for(int i=1;i<=ec;i++)link(ea[i],eb[i]);
	for(int i=1;i<=pc;i++)if(findbfa(pa[i])==findbfa(pb[i])){puts(NO);return 0;}

	int ccnt=0;
	for(int i=1;i<=n;i++)if(findbfa(i)==i)ccnt++;

	lint l=ccnt-1,r=1ll*ccnt*(ccnt-1)/2,tar=m-n+ccnt;
	if(pc)l=max(3,ccnt);
	puts((l<=tar && tar<=r)?YES:NO);
	
	return 0;
}


Measured memory_bytes: 1408
#include <iostream>

int bubbleSort(int a[], int n) {
    int x = 0;
    int flag = 1;
    while (flag) {
        flag = 0;
        for (int j = n - 1; j >= 1; j--) {
            if (a[j] < a[j - 1]) {
                int tmp = a[j];
                a[j] = a[j - 1];
                a[j - 1] = tmp;
                flag = 1;
                x++;
            }
        }
    }
    return x;
}

int main(int argc, const char *argv[]) {
    int n;
    std::cin >> n;
    int a[n];
    for (int i = 0; i < n; i++) {
        std::cin >> a[i];
    }
    
    int x = bubbleSort(a, n);
    
    std::cout << a[0];
    for (int i = 1; i < n; i++) {
        std::cout << " " << a[i];
    }
    std::cout << std::endl;
    
    std::cout << x << std::endl;
    
    return 0;
}

Measured memory_bytes: 3092
/**
 *    Author:   Sambhu Show(JGEC)
 *    fb    :   https://www.facebook.com/sambhu.show.98
 *              #everyday counts.....(^_^)
**/
#include<bits/stdc++.h>
using namespace std;
#define fio ios_base::sync_with_stdio(false);cin.tie(NULL);
#define itc int t;cin>>t;while(t--)
#define ltc ll t;cin>>t;while(t--)
#define ll long long int
#define ld long double
#define pb push_back
#define vll vector<ll>
#define sll set<ll>
#define mpll map<ll ,ll>
#define sortd(arr) sort(arr,arr+n,greater<ll>())
#define revs(str) reverse(str.begin(), str.end());
#define memset(arr) memset(arr,0,sizeof(arr));//array elements to 0
//-----------------------#Sambhu.98(CF)-------------------------------//
#define fr(i,a,b) for(ll i=a;i<=b;i++)
#define frr(i,a,b) for(ll i=a;i>=b;i--)
ll const inf=1e18;
//-----------------------#sambhu_98(CC)------------------------//
bool isPrime(ll n)
{   if (n <= 1)  return false;
    if (n <= 3)  return true;
    if (n % 2 == 0 or n % 3 == 0)  return false;
    ll i = 5;
    while(i * i <= n) { 
        if (n % i == 0 or n % (i + 2) == 0)  
        return false;
        i = i + 6;}
        return true; }

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

ll countDivisors(ll n) 
{ ll cnt = 0; 
    for (ll i = 1; i <= sqrt(n); i++) { 
        if (n % i == 0) { 
            if (n / i == i) 
                cnt++; 
            else  
                cnt = cnt + 2; } } 
    return cnt; }
/*/\/\/\/\/\/\/\/\/\/\/\/\//\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\*/
int main()
{
ll n,k;
cin>>n>>k;
ll arr[n];
if(k>=n)
cout<<"0"<<endl;
else
if(k<n)
{
fr(i,0,n-1)
{
    cin>>arr[i];
}
ll ans=0;

sortd(arr);

fr(i,0,min((k-1),n-1))
{
    arr[i]=0;
}
//fr(i,0,n-1)
//cout<<arr[i]<<" ";

fr(i,0,n-1)
ans+=arr[i];

cout<<ans<<endl;

}

return 0;
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
#define fir first
#define sec second
#define pb push_back
#define mp make_pair
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<string, string> pss;
const int INF = 0x3f3f3f3f;
const int N = 1e5 + 5;
const int M = 2e5 + 5;
const int MOD = 1e9 + 7;
const double PI = acos(-1.0);
const double EPS = 1e-8;
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
ll lcm(ll a, ll b) { return a * b / gcd(a, b); }
inline ull qpow(ull a, ull b, ull c)
{
    ull ans = 1;
    while (b)
    {
        if (b & 1)
            ans = ans * a % c;
        a = a * a % c;
        b >>= 1;
    }
    return ans;
}
int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    int x;
    cin >> x;
    int ans = 0;
    ans += x / 500 * 1000;
    x -= x / 500 * 500;
    ans += x / 5 * 5;
    cout << ans;
}

Measured memory_bytes: 256
use std::collections::HashMap;
fn main() {
    let n = read::<usize>();
    let mut hm = HashMap::new();
    for _ in 0..n {
        let a = read::<u32>();
        let c = hm.entry(a).or_insert(0);
        *c += 1;
    }
    let mut count = 0;
    for &v in hm.values() {
        if v % 2 != 0 {
            count += 1;
        }
    }
    println!("{}", count);
}

#[allow(dead_code)]
fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}
#[allow(dead_code)]
fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    read::<String>()
        .split_whitespace()
        .map(|e| e.parse().ok().unwrap())
        .collect()
}
#[allow(dead_code)]
fn read_vec2<T: std::str::FromStr>(n: u32) -> Vec<Vec<T>> {
    (0..n).map(|_| read_vec()).collect()
}
#[allow(dead_code)]
fn yn(result: bool) {
    if result {
        println!("Yes");
    } else {
        println!("No");
    }
}


Measured memory_bytes: 8444
N = int(input())
dp = [[[[0 for a in range(4)] for b in range(4)] for c in range(4)] for i in range(100+1)]
#A,G,C,T: 0,1,2,3

mod = 10**9 + 7

for a in range(4):
  for b in range(4):
    for c in range(4):
      dp[3][a][b][c] = 1
dp[3][0][1][2] = 0
dp[3][0][2][1] = 0
dp[3][1][0][2] = 0
#print(dp[3])

for i in range(4,100+1):
  for a in range(4):
    for b in range(4):
      for c in range(4):
        for j in range(4):
          dp[i][a][b][c] += dp[i-1][j][a][b]
          if b == 1 and c == 2 and j == 0:
            dp[i][a][b][c] -= dp[i-1][j][a][b]
          if a == 1 and c == 2 and j == 0:
            dp[i][a][b][c] -= dp[i-1][j][a][b]
          if a == 1 and b == 1 and c == 2 and j == 0:
            dp[i][a][b][c] += dp[i-1][j][a][b]
          dp[i][a][b][c] %= mod
  dp[i][0][1][2] = 0
  dp[i][1][0][2] = 0
  dp[i][0][2][1] = 0

answer = 0
for a in range(4):
  for b in range(4):
    for c in range(4):
      answer += dp[N][a][b][c]
answer %= mod
print(answer)

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

using namespace std;
using ll = long long;


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

    ll sum = 0;
    for (int i = 0; i <= n ; i++) {
        if (i % 3 == 0) continue;
        if (i % 5 == 0) continue;
        sum += i;
    }

	cout << sum << endl;
	return 0;
}


Measured memory_bytes: 3632
#include <bits/stdc++.h>
#define INF 5000000000000000000
#define ll long long
#define pll pair<ll, ll>
using namespace std;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  string N;
  cin >> N;
  ll ans = 0;
  for (ll i = 0; i < N.size(); ++i) {
    ans += N.at(i) - '0';
  }
  ans = max(ans, (ll)((N.at(0) - '1') + 9 * (N.size() - 1)));
  cout << ans << "\n";
}


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

int main(){
    int N,M;
    std::cin >> N >> M;
    std::vector<std::vector<int>>edge(N);
    for(int i = 0; i < M; ++i){
        int s,t; std::cin >> s >> t;
        edge[s - 1].push_back(t - 1);
        edge[t - 1].push_back(s - 1);
    }
    constexpr int inf = 1e9;
    std::vector<int>d(N,inf),prev(N,0);
    d[0] = 0;
    std::priority_queue<std::pair<int,int>,std::vector<std::pair<int,int>>,std::greater<>>que;
    que.emplace(d[0],0);
    while(not que.empty()){
        auto tp = que.top(); que.pop();
        int cv,cd; std::tie(cd,cv) =  tp;
        if(cd > d[cv]) continue;
        for(const auto nv : edge[cv]){
            if(d[nv] > cd + 1){
                d[nv] = cd + 1;
                prev[nv] = cv;
                que.emplace(d[nv],nv);
            }
        }
    }
    if (std::count_if(d.begin(),d.end(),[&](auto e){return e == inf;})){
        std::cout << "No" << std::endl;
    } else {
        std::cout << "Yes" << std::endl;
        prev.erase(prev.begin());
        for(const auto pv : prev){
            std::cout << pv + 1 << std::endl;
        }
    }
}


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

#define F first
#define S second
#define PB push_back
#define MP make_pair
#define REP(i,a,b) for (int i = a; i <= b; i++)
#define debug(i) cout << i << endl;
#define debugarr(a) for(auto i : a) cout << i << " ";

#define lli long long
#define vi vector<int>
#define vlli vector<lli>
#define pi pair<int,int>
#define pli pair<li, li>
#define vpi vector<pi>

using namespace std;

int main() {

    ios_base::sync_with_stdio(false);

    int a, b;

    cin >> a >> b;

    if(a > 8 || b > 8) cout << ":(" << endl;
    else cout << "Yay!" << endl;

}


Measured memory_bytes: 256
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
#define rep(i,s,t) for(register int i=s;i<=t;++i)
int a,b,k;
int main(){
	scanf("%d%d%d",&a,&b,&k);
	for(int i=a;i;--i)
		if(a%i==0&&b%i==0){
			--k;
			if(!k){
				printf("%d\n",i);
				return 0;
			}
		}
	return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <cstring>
using namespace std;

const int N = 1010;
const int oo = 1000000000;
struct edge
{
	int v,next;
}e[N * N];

int head[N],cnt;

void addedge(int u,int v)
{
	e[cnt].v = v;
	e[cnt].next = head[u];
	head[u] = cnt ++;
}

int pre[N],visit[N];
int f[N / 10][N / 10];

int find(int u)
{
	for(int i = head[u]; i != -1; i = e[i].next)
		if(!visit[e[i].v]) {
			visit[e[i].v] = 1;
			int tmp = pre[e[i].v];
			pre[e[i].v] = u;
			if(tmp == -1 || find(tmp)) return 1;
			pre[e[i].v] = tmp;
		}
	return 0;
}

struct point
{
	int x,t;
	void read() {
		scanf("%d%d",&x,&t);
	}
	friend bool operator < (const point &p,const point &q) {
		return p.t < q.t;
	}
}a[N];

int main()
{
	int n,m,r;
	int x,y,z;
	while(scanf("%d%d%d",&n,&m,&r)) {
		if(!n && !m && !r) break;
		for(int i = 0; i < n; i ++) {
			for(int j = 0; j < n; j ++)
				f[i][j] = oo;
			f[i][i] = 0;
		}
		cnt = 0;
		memset(head,-1,sizeof(head));
		while(m --) {
			scanf("%d%d%d",&x,&y,&z);
			f[x][y] = f[y][x] = min(z,f[x][y]);
		}
		for(int k = 0; k < n; k ++)
			for(int i = 0; i < n; i ++)
				for(int j = 0; j < n; j ++)
					f[i][j] = min(f[i][j],f[i][k] + f[k][j]);
		for(int i = 0; i < r; i ++)
			a[i].read();
		sort(a,a + r);
		memset(pre,-1,sizeof(pre));
		int ans = r;
		for(int i = 0; i < r; i ++)
			for(int j = i + 1; j < r; j ++)
				if(f[a[i].x][a[j].x] + a[i].t <= a[j].t)
					addedge(i,j);
		for(int i = 0; i < r; i ++) {
			memset(visit,0,sizeof(visit));
			ans -= find(i);
		}
		printf("%d\n",ans);
	}
	return 0;
}

Measured memory_bytes: 5324
#include<stdio.h>
int main()
{
    int row,col,i,j;
    for(;;){
    scanf("%d %d",&row,&col);
    for(i=1;i<=row;i++){
        for(j=1;j<=col;j++){
            printf("#");
        }
        printf("\n");}
        
    if(row == 0 && col == 0)
      break;
      printf("\n");
  }
    return 0;

}



Measured memory_bytes: 2148
#include <bits/stdc++.h>
using namespace std;
 
#define fo(i,n) for(i=0;i<n;i++)
#define Fo(i,k,n) for(i=k;i<n;i++)
#define ll long long
 
#define pi pair < ll , ll >
#define pb push_back
#define mp make_pair
#define F first
#define S second
 
#define fastIO ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
 
#define debug(x) cout<<#x<<" :: "<<x<<"\n";
#define debug2(x,y) cout<<#x<<" :: "<<x<<"\t"<<#y<<" :: "<<y<<"\n";
#define debug3(x,y,z) cout<<#x<<" :: "<<x<<"\t"<<#y<<" :: "<<y<<"\t"<<#z<<" :: "<<z<<"\n";
using namespace std;

const ll mod = 1e9+7;

void solve() {
    string s;cin>>s;
    if(s[1]=='R')s[1]='B';
    else s[1]='R';
    cout<<s;
}   

int main()
{
    fastIO;ll t=1;
    // cin>>t;
    while(t--)solve();
}


Measured memory_bytes: 3608
x = gets.to_i

case x
when (400..599)
  puts 8
when (600..799)
  puts 7
when (800..999)
  puts 6
when (1000..1199)
  puts 5
when (1200..1399)
  puts 4
when (1400..1599)
  puts 3
when (1600..1799)
  puts 2
when (1800..1999)
  puts 1
end



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

#define ll long
#define ld double
#define mp make_pair
#define pb push_back
#define F first
#define S second
#define setpr(pp) fixed<<setprecision(pp)
#define FOR(I,N) for(I=0;I<N;++I)
#define MS0(x) memset(x,0,sizeof(x))
#define MS1(x) memset(x,-1,sizeof(x))
#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define mod	%1000000007
#define pi 3.141592653
#define NL -5000000

int main()
{	IOS;
	ll i,a[5];
	FOR(i,5)
		cin>>a[i];

	FOR(i,5)
	{
		if(a[i]==0)
			cout<<(i+1);
	}
}


Measured memory_bytes: 3640
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main() {
    ll t;
    t=1;
    while(t--) /// get diameter nothing else
    {
       ll x,y,a,b,c;
       cin>>x>>y>>a>>b>>c;
       ll arr[a],brr[b],crr[c];
       for(int i=0;i<a;i++)cin>>arr[i];
       for(int i=0;i<b;i++)cin>>brr[i];
       for(int i=0;i<c;i++)cin>>crr[i];
       sort(arr,arr+a);reverse(arr,arr+a);
       sort(brr,brr+b);reverse(brr,brr+b);
       sort(crr,crr+c);reverse(crr,crr+c);
       vector<ll> v;
       for(int i=0;i<x;i++)
        v.push_back(arr[i]);
       for(int i=0;i<y;i++)
        v.push_back(brr[i]);
       for(int i=0;i<min(x+y,c);i++)
        v.push_back(crr[i]);
        sort(v.begin(),v.end());
        reverse(v.begin(),v.end());
       ll ans=0;
       for(int i=0;i<x+y;i++)
        ans+=v[i];
       cout<<ans;

    }
}


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

const int INF = 1e6;

int v, e;
int g[20][20];
int dp[(1 << 20)][20];

int rec(int s, int t) {
	if (dp[s][t] != 0) return dp[s][t];
	if (s == (1 << t)) return dp[s][t] = g[0][t];
	int ret = INF;
	int prev = s & ~(1 << t);
	for (int u = 0; u < v; u++) {
		if (!(prev & (1 << u))) continue;
		ret = min(ret, rec(prev, u) + g[u][t]);
	}
	return dp[s][t] = ret;
}

int main() {
	cin >> v >> e;
	rep(i, 20) rep(j, 20) g[i][j] = INF;
	rep(i, e) {
		int s, t, d;
		cin >> s >> t >> d;
		g[s][t] = d;
	}
	int ans = rec((1 << v) - 1, 0);
	if (ans != INF) cout << ans << endl;
	else cout << -1 << endl;
	return 0;
}


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

using namespace std;
#define sqr(x) ((x)*(x))
#define cube(x) ((x)*(x)*(x))
#define GCD(a, b) __gcd(a, b)
#define LCM(a, b) ((a)*(b)/GCD(a,b))
#define PI (3.141592653589793238462643383279502884197169399375105820974944)
#define MP make_pair
#define n1 first
#define n2 second
#define PII pair<int,int>
#define PLL pair<ll,ll>
#define PDB pair<db,db>
#define SI set<int>
#define SL set<ll>
#define MS multiset
#define MSI multiset<int>
#define MSLL multiset<ll>
#define PB push_back
#define PF push_front
#define VI vector<int>
#define VPI vector<pair<int,int>>
#define VLL vector<ll>
#define VS vector<string>
#define SZ(x) ((int)x.size())

typedef long long ll;

typedef unsigned long long ull;
typedef long double ld;
typedef double db;
const db eps = 0.00000000001;
const int INF = 1000000007;
const ll LINF = 1000000000000000555;
const int N = 550555;
const int L = 21;
const int M = 2155;

bool used[N];
void solve() {
    int n, k;
    cin >> n >> k;

    for (int i = 1; i <= k; i++){
        int d;
        cin >> d;
        while (d--){
            int x;
            cin >> x;
            used[x] = true;
        }
    }

    int cnt = 0;
    for (int i = 1; i <= n; i++){
        if (!used[i]) cnt++;
    }

    cout << cnt;

}

int main() {
    ios_base::sync_with_stdio(false);
#ifdef dxz05
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#else

#endif

    int T = 1;
    //cin >> T;

    while (T--) {
        solve();
    }

    return 0;
}

Measured memory_bytes: 3616
#include <bits/stdc++.h>
#define rep(i, a, n) for(int i = a; i < n; i++)
#define REP(i, n) rep(i, 0, n)
#define int long long
using namespace std;
typedef pair<int, int> P;
const int mod = 1000000007;
const int INF = 1e18;

struct Combination {
	vector<int64_t> fact, rfact;
	Combination(int sz) : fact(sz + 1), rfact(sz + 1) {
		fact[0] = 1;
		for(int i = 1; i < fact.size(); i++){
			fact[i] = fact[i - 1] * i % mod;
		}
		rfact[sz] = inv(fact[sz]);
		for(int i = sz - 1; i >= 0; i--){
			rfact[i] = rfact[i + 1] * (i + 1) % mod;
		}
	}
	int64_t inv(int x) const {
		return pow(x, mod - 2);
	}
	int64_t pow(int64_t x, int64_t n) const {
		int64_t ret = 1;
		while(n > 0){
			if(n & 1) (ret *= x) %= mod;
			(x *= x) %= mod;
			n >>= 1;
		}
		return (ret);
	}
	int64_t P(int n, int r) const {
		if(r < 0 || n < r) return (0);
		return (fact[n] * rfact[n - r] % mod);
	}

	int64_t C(int p, int q) const {
		if(q < 0 || p < q) return (0);
		return (fact[p] * rfact[q] % mod * rfact[p - q] % mod);
	}

	int64_t H(int n, int r) const {
		if(n < 0 || r < 0) return (0);
		return (r == 0 ? 1 : C(n + r - 1, r));
	}
};

signed main(){
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  string s;
  int k;
  cin >> k >> s;
  int n = s.size();
  Combination c(n + k);
  int ans = 0;
  for(int i = 0; i <= k; i++){
    ans += c.C(n + i - 1, n - 1) * c.pow(25, i) % mod * c.pow(26, k - i) % mod;
    ans %= mod;
  }
  cout << ans << endl;
}

Measured memory_bytes: 35640
N, W = list(map(int, input().split()))
w, v = [None] * N, [None] * N
for i in range(N):
    w[i], v[i] = list(map(int, input().split()))


dp = [[0] * (W + 1) for _ in range(N + 1)]
for i in range(1, N + 1):
    for j in range(W + 1):
        if w[i - 1] <= j:
            dp[i][j] = max(dp[i - 1][j], v[i - 1] + dp[i - 1][j - w[i - 1]])
        else:
            dp[i][j] = dp[i - 1][j]

ans = max(dp[N])
print(ans)
        

Measured memory_bytes: 148208
#include <iostream>
#include <cmath>
using namespace std;
int Gcd(int a, int b) {
    if (a % b == 0) return b;
    return Gcd(b, a % b);
}
int solve() {
    int N, X, x0;
    cin >> N >> X >> x0;
    if (N == 1) return abs(x0 - X);
    int gcd = abs(x0 - X), x;
    for (int i = 1; i < N; i++) {
        cin >> x;
        gcd = Gcd(gcd, abs(x - X));
    }
    return gcd;
}
int main() {
    cout << solve() << endl;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <math.h>
int main(void)
{
  double r, ans;
  while(scanf("%lf", &r) != EOF)
  {
    ans = r * M_PI;
    printf("%.6lf %.6lf\n", r*ans, 2*ans);
  }
  return 0;
}


Measured memory_bytes: 2048
#include <bits/stdc++.h>
#define ll long long
#define INF 1000000005
#define MOD 1000000007
#define EPS 1e-10
#define rep(i,n) for(int i=0;i<(int)(n);++i)
#define rrep(i,n) for(int i=(int)(n)-1;i>=0;--i)
#define srep(i,s,t) for(int i=(int)(s);i<(int)(t);++i)
#define each(a,b) for(auto (a): (b))
#define all(v) (v).begin(),(v).end()
#define len(v) (int)(v).size()
#define zip(v) sort(all(v)),v.erase(unique(all(v)),v.end())
#define cmx(x,y) x=max(x,y)
#define cmn(x,y) x=min(x,y)
#define fi first
#define se second
#define pb push_back
#define show(x) cout<<#x<<" = "<<(x)<<endl
#define spair(p) cout<<#p<<": "<<p.fi<<" "<<p.se<<endl
#define svec(v) cout<<#v<<":";rep(kbrni,v.size())cout<<" "<<v[kbrni];cout<<endl
#define sset(s) cout<<#s<<":";each(kbrni,s)cout<<" "<<kbrni;cout<<endl
#define smap(m) cout<<#m<<":";each(kbrni,m)cout<<" {"<<kbrni.first<<":"<<kbrni.second<<"}";cout<<endl

using namespace std;

typedef pair<int,int> P;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<double> vd;
typedef vector<P> vp;

const int MAX_N = 100005;

ll dp[202][10002];

ll add(ll x,ll y)
{
    return (x + y)%MOD;
}

ll sub(ll x,ll y)
{
    return (x+MOD-y)%MOD;
}

ll mult(ll x,ll y)
{
    return x*y%MOD;
}

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n,W;
    cin >> n >> W;
    vi vec(n);
    rep(i,n){
        cin >> vec[i];
    }
    sort(all(vec),greater<int>());
    vi sm(n+1);
    sm[n] = 0;
    rrep(i,n){
        sm[i] = sm[i+1] + vec[i];
    }
    if(accumulate(all(vec),0) <= W){
        cout << "1\n";
        return 0;
    }
    dp[0][0] = 1;
    ll ans = 0;
    rep(i,n){
        srep(j,max(0,W-sm[i]+1),W-sm[i+1]+1){
            ans = add(ans,dp[i][j]);
            // dp[i][j] = 0;
        }
        rrep(j,W+1){
            dp[i+1][j] = add(dp[i+1][j],dp[i][j]);
            if(j >= vec[i]){
                dp[i+1][j] = add(dp[i+1][j],dp[i][j-vec[i]]);
            }
        }
        // rep(j,n+1){
        //     cout << j << ":";
        //     rep(k,W+1){
        //         cout << dp[j][k] << " ";
        //     }
        //     cout << "\n";
        // }
    }
    cout << ans << "\n";
    return 0;
}

Measured memory_bytes: 18648
#include <stdio.h>

int main(){
	int y,m,d,num;

	while(scanf("%d %d %d",&y,&m,&d) != EOF){
		num = y*10000+m*100+d;
		if(num < 18680908){
			printf("pre-meiji\n");
		}else if(num < 19120730){
			printf("meiji %d %d %d\n",y-1867,m,d);
		}else if(num < 19261225){
			printf("taisho %d %d %d\n",y-1911,m,d);
		}else if(num < 19890108){
			printf("showa %d %d %d\n",y-1925,m,d);
		}else{
			printf("heisei %d %d %d\n",y-1988,m,d);
		}
	}

	return 0;
}

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

using namespace std;

#define rep(i, a, b)  for(int i = (a); i < (b); i++)
#define rrep(i, a, b) for(int i = (a); i > (b); i--)
#define sq(x) ((x) * (x))
#define bit(x) bitset<32>(x)
#define vsort(v)  sort(v.begin(), v.end())
#define rvsort(v) sort(v.begin(), v.end(), greater<llint>())
#define debug(x) cout << #x << " " << (x) << endl
#define ci cin
#define co cout
#define en endl
#define ln cout<< '\n'
#define pb push_back
#define fi first
#define se second
#define MOD 1000000007

typedef long long int llint;
typedef pair<int, int> pii;
typedef pair<llint, llint> pll;
typedef vector<int> vi;
typedef vector<llint> vl;
typedef vector<pii> vii;
typedef vector<pll> vll;


template<typename Tn> Tn __lcm(Tn a, Tn b)
{
    return a / __gcd(a, b) * b;
}

int dx[] = {1, 0, -1, 0};
int dy[] = {0, 1, 0, -1};

int n;

struct ab
{
    int a, b;
    ab() {}
    ab(int a, int b) : a(a), b(b) {}

    bool operator < (const ab &a) const {
	return b < a.b;
    }
};


int main()
{
    ci >> n;

    vector<ab> v;
    
    rep(i, 0, n) {
	int a, b;
	ci >> a >> b;
	
	v.pb(ab(a, b));
    }
    
    vsort(v);
    
    int t = 0;

    rep(i, 0, n) {

	if(v[i].b - (t + v[i].a) < 0) {
	    co << "No" << en;
	    return 0;
	}

	t += v[i].a;
    }

    co << "Yes" << en;
    
    return 0;
}


Measured memory_bytes: 2420
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <numeric>

#define REP(i, a, b) for (int i = int(a); i < int(b); i++)
using namespace std;
typedef long long int ll;

// clang-format off
#ifdef _DEBUG_
#define dump(...) do{ cerr << __LINE__ << ":\t" << #__VA_ARGS__ << " = "; PPPPP(__VA_ARGS__); cerr << endl; } while(false)
template<typename T> void PPPPP(T t) { cerr << t; }
template<typename T, typename... S> void PPPPP(T t, S... s) { cerr << t << ", "; PPPPP(s...); }
#else
#define dump(...)
#endif
template<typename T> vector<T> make_v(size_t a, T b) { return vector<T>(a, b); }
template<typename... Ts> auto make_v(size_t a, Ts... ts) { return vector<decltype(make_v(ts...))>(a, make_v(ts...)); }
template<typename T>
bool chmin(T &a, T b) { if (a > b) {a = b; return true; } return false;}
template<typename T>
bool chmax(T &a, T b) { if (a < b) {a = b; return true; } return false;}
// clang-format on

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    vector<vector<int>> G(n * n);
    vector<int> Coming(n * n, 0);
    REP(i, 0, n) {
        int prev = -1;
        REP(j, 0, n - 1) {
            int a = i;
            int b;
            cin >> b;
            b--;
            if (a > b) {
                swap(a, b);
            }
            int v = a * n + b;
            if (prev != -1) {
                G[prev].push_back(v);
                Coming[v]++;
            }
            prev = v;
        }
    }
    vector<int> q;
    REP(i, 0, n * n) {
        if (Coming[i] == 0) {
            q.emplace_back(i);
        }
    }
    int ans = 0;
    while (q.size()) {
        vector<int> q2;
        for (auto &v : q) {
            for (auto &g : G[v]) {
                if (--Coming[g] == 0) {
                    q2.emplace_back(g);
                }
            }
        }
        ans++;
        q = q2;
    }
    REP(i, 0, n * n) {
        if (Coming[i] != 0) {
            ans = -1;
            break;
        }
    }
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 45432
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <cmath>
#include <queue>
#include <map>
#include <unordered_map>
#include <set>
#include <functional>
#include <bitset>
#include <cassert>
#include <random>
using namespace std;
using ll = long long;


int main() {
	ll n, a, b; cin >> n >> a >> b;
	cout << n / (a + b) * a + min(a, n % (a + b)) << endl;
	return 0;
}


Measured memory_bytes: 256
import Data.List

makeList :: Int -> Int -> [Int]
makeList 0 _ = []
makeList n l = [l] ++ makeList (n-1) (l+1)

minAbs :: [Int] -> Int
minAbs x = head (sortOn abs x)

main = do
    [n, l] <- map read . words <$> getLine
    let ml = makeList n l
    print $ (sum ml) - (minAbs ml)

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

typedef pair<int,int> P;

int n, m, s, t;
vector<P> G[N];

void add_edge(int A, int B, int C){
  G[A].push_back(P(B, C));
  G[B].push_back(P(A, C));
}

int d[N];
const int INF = 1e18;

int dijkstra(){

  for(int i=0;i<n;i++) d[i] = INF;
  
  priority_queue<P,vector<P>,greater<P> > q;

  q.push(P( 0, s ));
  d[s] = 0;

  while(!q.empty()){
    
    P tmp = q.top(); q.pop();

    int node = tmp.second;
    int cost = tmp.first;

    if( node == t ) return cost;
    if( d[node] < cost ) continue;
    
    for(auto p : G[node] ){
      
      int nnode = p.first;
      int ncost = cost + p.second;

      if( d[nnode] > ncost ){
	d[nnode] = ncost;
	q.push(P( ncost, nnode ));
      }
    }
    
  }
  
}

signed main(){
  
  cin>>n>>m>>s>>t;
  
  s--, t--;
  
  for(int i=0;i<m;i++){
    
    int a, b, c, d;
    cin>>a>>b>>c>>d;
    
    a--, b--, c--;
    
    add_edge( a, b, d );
    add_edge( a, c, d );
    add_edge( b, c, d );
  }
  
  cout<<dijkstra()<<endl;
  
  return 0;
}



Measured memory_bytes: 23740
#include <iostream>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <cmath>
#include <numeric>

using namespace std;

#define int long long
typedef long double ld;
#define pii pair<int, int>
#define vi vector<int>
#define vii vector<vi>
#define viii vector<vii>
#define vpii vector<pii>
#define vb vector<bool>
#define vbb vector<vb>
#define vs vector<string>
#define pb push_back
#define ff first
#define ss second
#define all(a) a.begin(), a.end()
#define in(a, x) for (int i = x; i < (a).size(); ++i) cin >> (a)[i]
#define out(a) for (auto qwe : a) cout << qwe << " "

const int INF = 1e9;
const int INF64 = 1e18;
const int MOD = 1e9 + 7;
const int MOD9 = 1e9 + 9;
const int MOD3 = 998244353;
const int P = 37;

const int mxn = 200000;

int n;
vector<vector<vector<ld>>> dp;

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

    cin >> n;

    int a = 0, b = 0, c = 0;

    for (int i = 0; i < n; ++i) {
        int x;
        cin >> x;

        if (x == 1) ++a;
        if (x == 2) ++b;
        if (x == 3) ++c;
    }

    dp.assign(n + 2, vector<vector<ld>>(n + 2, vector<ld>(n + 2, 0)));

    for (int k = 0; k <= c; ++k) {
        for (int j = 0; j <= b + (c - k); ++j) {
            for (int i = 0; i <= (n - j - k); ++i) {
                if (i == 0 && j == 0 && k == 0)
                    continue;

                dp[i][j][k] = (ld) n / (i + j + k);

                if (i > 0)
                    dp[i][j][k] += dp[i - 1][j][k] * ((ld) i / (i + j + k));
                if (j > 0)
                    dp[i][j][k] += dp[i + 1][j - 1][k] * ((ld) j / (i + j + k));
                if (k > 0)
                    dp[i][j][k] += dp[i][j + 1][k - 1] * ((ld) k / (i + j + k));
            }
        }
    }

    cout.precision(10);
    cout << fixed << dp[a][b][c];
}


Measured memory_bytes: 437632
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <functional>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <vector>
#define ll long long
#define mod 1000000007
#define imfor(i, n) for(int i = 0; i < n; i++)
using namespace std;

int main() {
    int n, m;
    cin >> n >> m;
    if (n != m && n - m != 1 && m - n != 1) {
        cout << 0 << endl;
        return 0;
    }
    ll fact[100010];
    fact[0] = 1;
    for (int i = 1; i <= max(n, m); i++) {
        fact[i] = (fact[i - 1] * i) % mod;
    }
    ll ans;
    ans = (fact[n] * fact[m]) % mod;
    if (n == m) {
        ans = ans * 2 % mod;
    }
    cout << ans << endl;
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
#include<time.h>
#include<stdlib.h>
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("sse4")
#define pb push_back
#define mp make_pair
#define IOS ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define ll long long
#define pll pair<ll,ll>
#define vll vector<ll,ll>
#define all(a) (a).begin(),(a).end()
#define ff first
#define ss second
#define sz(x) (ll)x.size()
#define hell 1000000007
#define repf(i,a,b) for(ll i=a;i<b;i++)
#define repb(i,a,b) for(ll i=a;i>b;i--)
#define lbnd lower_bound
#define ubnd upper_bound
#define bs binary_search
#define gcd(a,b) __gcd((a),(b))
#define EPS 1e-12
#define lcm(a,b) ((a)*(b))/__gcd((a),(b))
#define sqrt sqrtl
#define cbrt cbrtl
using namespace std;

int main()
{	
	ll a,b;
	cin>>a>>b;
	if(a<=5)
		cout<<0;
	else if(a>=13)
		cout<<b;
	else
		cout<<b/2;

	return 0;
}

Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <cassert>
#include <string>
#include <vector>
#include <utility>
#include <complex>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <deque>
#include <tuple>
#include <bitset>
#include <limits>
#include <algorithm>
#include <array>
#include <random>
#include <complex>
#include <regex>
using namespace std;
typedef long double ld;
typedef long long ll;
typedef vector<int> vint;
typedef vector<ll> vll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
#define fcout cout << fixed << setprecision(10)
#define rep(i,n)    for(int i=0; i<(int)n; i++)
#define mp(a,b) make_pair(a,b)
#define pb push_back
const ll inf = 1e18;
const ll mod = 1e9 + 7;

ll pow (ll x, ll n){
    ll ans = 1;
    while(n>0){
        if(n & 1 == 1){
            ans *= x;
        }
        x = x * x;
        n >>= 1;
    }
    return ans;
}

int main(){
    int n,m ;   cin >> n >> m;
    int r[n][n];
    rep(i,n)    rep(j,n)    r[i][j] =0;
    rep(i,m){
        int a,b; cin >> a >> b;
        a--;    b--;
        r[a][b]++;
        r[b][a]++;
    }

    rep(i,n){
        int ans =0;
        rep(j,n){
            ans += r[i][j];
        }
        cout << ans << endl;
    }

}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(k,i,n) for(ll i=k;i<n;++i)
int main(void){
    // Your code here!
    ll n;
    cin>>n;
    ll ans=0;
    rep(0,i,n){
        ll x=i+1;
        if(to_string(x).length()%2==1){
            ++ans;
        }
    }
    cout<<ans;
}

Measured memory_bytes: 256
li2 = [input() for i in range(3)]
a = []
for i in range(3):
    a.append([int(x.strip()) for x in li2[i].split()])
bingo = [[0, 0, 0] for i in range(3)]

n = int(input())
b = [int(input()) for i in range(n)]


def atari(z):
    for x in range(3):
        for y in range(3):
            if a[x][y] == z:
                bingo[x][y] = 1


for i in range(n):
    atari(b[i])

ans = 0


def check(z1, z2, z3):
    if z1 == 1 and z2 == 1 and z3 == 1:
        global ans
        ans = 1




for i in range(3):
    check(bingo[i][0], bingo[i][1], bingo[i][2])
    check(bingo[0][i], bingo[1][i], bingo[2][i])

check(bingo[0][0], bingo[1][1], bingo[2][2])
check(bingo[2][0], bingo[1][1], bingo[0][2])


if ans == 1:
    print("Yes")
else:
    print("No")


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

using namespace std;

int main()
{
    string s;
    long long int cnt = 0;

    cin >> s;

    for (int i = 0; i < (int)s.size(); i++) {
        long long int max = 0;
        for (int j = i; j < (int)s.size(); j++) {
            if (s[j] == 'A' || s[j] == 'T' || s[j] == 'G' || s[j] == 'C') {
                max++;
            }
            else {
                break;
            }
        }
        if (cnt < max) cnt = max;
    }

    cout << cnt << endl;
}


Measured memory_bytes: 256
#include <stdio.h> 
int main()
{  
  int A,H;  
  scanf("%d", &H);      
  scanf("%d", &A);      
  if(A>=H)   
  {     printf("1");     
  }  
  else   
  {            
    int count=1, damage = 0;    
    while(damage<H)    
    {        damage = A*count;        
     count++;    
    }   
    printf("%d", count-1);   }

  return 0;

}

Measured memory_bytes: 1624
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <cstdio>
#include <cmath>
#include <tuple>
#include <iomanip>
#include <numeric>
#include <unordered_map>
#include <sstream>   
#include<limits.h>
#include<float.h>
#include<list>
#include <array>
#include <complex>
using namespace std;
#define i64  long long
#define int  long long
 
#define I32_MAX 2147483647
#define I64_MAX 9223372036854775807LL
#define I64_MAX2 1223372036854775807LL
#define INF I64_MAX2
#define MOD 1000000007
#define MEM_SIZE 10000
#define DEBUG_OUT true

// int DP[MEM_SIZE][MEM_SIZE] = {0};
// int GMEM[MEM_SIZE][MEM_SIZE] = {0};
template<typename T> void DEBUG(T e){if(DEBUG_OUT == false)return;std::cout << e << std::endl;}
template<typename T> void DEBUG(const std::vector<T>& v){if(DEBUG_OUT == false)return;for(const auto& e : v){ std::cout << e << " "; } std::cout << std::endl;}
template<typename T> void DEBUG(const std::vector<std::vector<T> >& vv){if(DEBUG_OUT == false)return;for(const auto& v : vv){ DEBUG(v); } }
template<class T> void DEBUG(string str, T e){if(DEBUG_OUT == false)return;std::cout <<str<<" ";DEBUG(e);};
template <class T> void corner(bool flg, T hoge) {if (flg) {cout << hoge << endl; exit(0);}}
template< typename T1, typename T2 > inline bool chmax(T1 &a, T2 b) { return a < b && (a = b, true); }
template< typename T1, typename T2 > inline bool chmin(T1 &a, T2 b) { return a > b && (a = b, true); }
template<typename T> void SORT_(vector<int>& v,bool GREATER = 0){if(GREATER == 0)sort(v.begin(),v.end());else{sort(v.begin(),v.end(),std::greater<T>());}}

//CODE
void solve(void)
{
  int K;
  cin>>K;
  cout<<(K/2)*(K -K/2)<<endl;
}


int32_t main(int32_t argc, const char *argv[])
{
  std::ios::sync_with_stdio(false);
  std::cin.tie(0);

  std::cout << std::fixed;
  std::cout << std::setprecision(9);
  solve();

 
  return 0;
}

Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <cstdio>
#include <vector>
#include <utility>
#include <algorithm>
#include <string>
#include <queue>
#include <stack>
#include <tuple>
#include <set>
#include <map>
#include <functional>
#include <cmath>
#include <cstring>
using namespace std;
#define sci(n) scanf("%lld", &(n))
#define scd(n) scanf("%Ld", &(n))
typedef long long LL;
typedef long double LD;
typedef pair<LL, LL> pll;

int main(void)
{
	string s;
	cin >> s;
	for (int i = 0; i < s.length();i++) {
		for (int j = 0; j+i <= s.length(); j++) {
			string scp(s);
			scp.erase(i,j);
			if (scp == "keyence") {
				cout << "YES";
				return 0;
			}
		}
	}
	cout << "NO";
	return 0;
}


Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main() {
	int N, sum = 0, n;
	cin >> N;
	n = N;

	while (n > 0) {
		sum += n % 10;
		n = n / 10;
	}
	if (N%sum == 0)
		cout << "Yes" << endl;
	else
		cout << "No" << endl;
	return 0;
}

Measured memory_bytes: 256
from fractions import gcd
g = gcd(*map(int, input().split()))

f = 2
d = {}
while f**2 <= g:
    if g % f:
        f += 1
    else:
        d[f] = d.get(f,0) + 1
        g//=f

if g>1:
    d[g] =d.get(g,0) + 1

print(len(d)+1)

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

int main() {
    int a, b, k;
    cin >> a >> b >> k;
    
    int p = min(a, b);
    int q = max(a, b);
    int r = q % p;
    while(r > 0){
        q = p;
        p = r;
        r = q % p;
    }
    
    int count = 0;
    int ans = 0;
    for(int i = p; i > 0; i--){
        if((a % i == 0)&&(b % i == 0)) {
            count++;
            if(count == k) {
                ans = i;
                break;
            }
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
n,m=map(int,input().split())
D=[1] * (n + 1)
for _ in range(m):
    D[int(input())] = 0
for i in range(n+1):
    if i < 2:
        continue
    D[i] = (D[i-1] + D[i-2]) % 1000000007 * D[i]
print(D[i])

Measured memory_bytes: 6976