akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <algorithm>
#include <climits>
#include <cmath>
#include <utility>
#include <string>
#include <cstring>
#include <functional>

using namespace std;

const int maxv = 200002;

int n, cnt[maxv];

long long helper(long long x) {
    return x * (x-1) / 2;
}

int main() {

	ios_base::sync_with_stdio(false);
	cin.tie(NULL);

    cin >> n;
    vector<int> v(n);

    for (int i = 0; i < n; ++i) {
        cin >> v[i];
        ++cnt[v[i]];
    }

	long long tot = 0;
    for (int i = 1; i < maxv; ++i)
        if (cnt[i] > 1)
            tot += helper(cnt[i]);

    for (int i = 0; i < n; ++i) {
        cout << tot - (cnt[v[i]] - 1) << endl;
    }

	return 0;
}

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

#define rp(i, k, n) for (int i = k; i < n; i++)
typedef long long ll;

ll mod = 1e9 + 7;
int inf = 1e9 + 7;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

int main() {
    int n, W;
    scanf("%d%d", &n, &W);
    vector<int> w(n);
    vector<int> v(n);
    rp(i, 0, n) scanf("%d%d", &w.at(i), &v.at(i));
    vector<vector<int>> dp(n, vector<int>(100009, inf));
    //dp.at(i).at(j)は、i(0~n-1)番目まで考えたとき、価値j以上にするために必要な重さのmin
    rp(i, 0, n) dp.at(i).at(0) = 0;
    rp(i, 0, v.at(0) + 1) dp.at(0).at(i) = w.at(0);
    rp(i, 1, n) {
        rp(j, 0, 100009) chmin(dp.at(i).at(j), dp.at(i-1).at(j));
        rp(j, 0, v.at(i) + 1) chmin(dp.at(i).at(j), w.at(i));
        rp(j, v.at(i) + 1, 100009) if(dp.at(i-1).at(j-v.at(i)) + w.at(i) <= W) chmin(dp.at(i).at(j), dp.at(i-1).at(j-v.at(i)) + w.at(i));
    }
    int res;
    rp(j, 0, 100009) {
        if (dp.at(n-1).at(j) <= W) res = j;
    }
    printf("%d", res);
    return 0;
} 

Measured memory_bytes: 39808
#include <bits/stdc++.h>
using namespace std;
#define FOR(i, n) for(int i = 0; i < (n); i++)
#define MEM(a, x) memset(a, x, sizeof(a))
#define ALL(a) a.begin(), a.end()
#define UNIQUE(a) a.erase(unique(ALL(a)), a.end())
typedef long long ll;

ll a, b, c;

int main(int argc, char const *argv[]) {
	ios_base::sync_with_stdio(false);
	cin >> a >> b >> c;
	if (a & 1 || b & 1 || c & 1) {
		cout << 0 << endl;
		return 0;
	}
	if (a == b && b == c && c == a) {
		cout << -1 << endl;
		return 0;
	}
	ll cnt = 0;
	while (true) {
		ll aa = (b+c)/2, bb = (c+a)/2, cc = (a+b)/2;
		cnt++;
		if (aa & 1 || bb & 1 || cc & 1) {
			break;
		}
		a = aa;
		b = bb;
		c = cc;
	}
	cout << cnt << endl;
	return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <fstream>
#include <iostream>
#include <map>
#include <queue>
#include <string>
#include <stack>
#include <vector>
#include <set>
#include <tuple>
#include <utility>
#include <functional>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef tuple<int,int,int> T;
const int INF = 1000000000;
const int MOD = 1000000007;
int main(){
	string s,t;
	cin >> s >> t;
	string emp = "";
	for(int i = 0;i < s.size();i++)emp += t[i];
	if(emp == s){
		cout << "Yes" << endl;
	}
	else cout << "No" << endl;
}


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

using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
typedef long long ll;

int main(){
  int n;
  cin >> n;
  vector<int> d(n);
  rep(i,n){
    cin >> d[i];
  }
  for(int i=n-1;i>=0;i--){
    if(i==n-1){
      cout << d[i];
    }else cout << ' ' << d[i];
  }
  cout << endl;
}



Measured memory_bytes: 3052
import copy

N = int(input())
A = []
for i in range(N):
    A.append(list(map(int, input().split())))

B = copy.deepcopy(A)
for i in range(N):
    for j in range(N):
        if i == j:
            continue
        for k in range(N):
            if j == k:
                continue
            if k == i:
                continue
            if A[i][j] > A[i][k] + A[k][j]:
                print(-1)
                exit()
            if A[i][j] == A[i][k] + A[k][j]:
                B[i][j] = 0

ans = 0
for i in range(N):
    for j in range(i, N):
        ans += B[i][j]

print(ans)



Measured memory_bytes: 55388
binpow a b mmod
  | b == 0    = 1
  | otherwise =
    if b `mod` 2 == 1 then
      res `mod` mmod * res `mod` mmod * a `mod` mmod
    else
      res `mod` mmod * res `mod` mmod
        where res = binpow a (b `div` 2) mmod

main = do
  li <- getLine
  let n = read li :: Integer
  let mmod = 10^9+7
  print $ ((\x -> (x + mmod) `mod` mmod) :: Integer -> Integer)
    $ (binpow 10 n mmod) - ((*2) $ binpow 9 n mmod) + (binpow 8 n mmod)

Measured memory_bytes: 3956
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main(void){
    long long X;
    cin >> X;
    long long A=100;
    long cnt=0;
    while(A<X){
        A=A*1.01;
        cnt++;
    }
    
    cout << cnt << endl;
    return 0;
}


Measured memory_bytes: 3636
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
long long maximum;
long long mod = 1000000007;
const int INF = 1001001001;
vector<vector<int>> dp;

int main(){
  string x;
  cin >> x;
  int a = 0;
  int ans = 0;
  for(int i=0;i<x.size()-1;i++){
    if(x.at(i) == 'T') a--; else a++;
    if(x.at(i) == 'T' && x.at(i+1) == 'S' && a<0){
      ans += -1 * a;
      a = 0;
    }    
  }
  cout << ans * 2 << endl;
}


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

# define y1 aasjdladljskdj

using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair < int, int > pii;
typedef unsigned long long ull;

const int N = int(2e6) + 5;
const int inf = (int)1e9 + 7;

int n, k;
int a[N];

int main(){
  scanf("%d %d", &n, &k);
  for(int i = 1; i <= n; ++i){
    scanf("%d", a + i);
  }
  sort(a + 1, a + 1 + n);
  int sum = 0;
  for(int i = 1; i <= n; ++i){
    sum += a[i];
    if(sum > k){
      printf("%d", i - 1);
      return 0;
    }
  }
  if(sum < k){
    printf("%d\n", n - 1);
    return 0;
  }
  printf("%d", n);
  return 0;
}


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

int p, q, a, n, ans;

void dfs( int nume, int deno , int num, int pos ){
	if( p * deno == q * nume ){
		ans++;
		return;
	}
	if( num == n ) return;
	if( p * deno < q * nume ) return;
	for( int i = pos; i * deno <= a; i++ ){
		dfs( nume*i+deno, deno*i, num+1, i );
	}
}

int main(){
    while( cin >> p >> q >> a >> n && p ){
			ans = 0;
			dfs(0,1,0,1);
			cout << ans << endl;
    }
}

Measured memory_bytes: 1160
//  RAKSHIT KADAM
//ALWAYS USE &IT FOR ITERATING USING AUTO ...
//USE COUNT(STARTING ADDRESS, ENDING ADRESS ,VALUE) FOR FINDING THE COUNT IN THE RESPECTIVE DATA STRUCTURE
//NOTE THAT MEMSET CANT FILL THE DOUBLE VALUES;
//ACCUMULATE DOES NOT WORK PROPERLY IF VALUES START SUMMING BEYOND 1E9...
 #include <bits/stdc++.h>
// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>
// using namespace __gnu_pbds;
// #define ordered_set tree< int ,  null_type ,  less<int> ,  rb_tree_tag ,  tree_order_statistics_node_update>
#warning !!!check the size of arrayss!!!
 
// NUMERIC DEFINITIONS :
    #define INF 1000000000000000005
    #define inf 1000000037
    #define MOD  1000000007
    #define newMOD  998244353
    #define MAX 300006
    #define pi 3.1415926535897932384626433832795
#define ld long double
                         #define ll long long
                         #define int long long
//  #define ll int
 #define P(gg) for(auto rax:gg){cout<<rax<<" ";}cout<<endl;
 #define Need_for_speed(activated) ios_base :: sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL)
 #define satisfy ll t; cin>> t; while(t--)
 #define inp(n) int n;cin >> n
 #define mp make_pair
 #define pb push_back
 #define endl "\n"
 #define x first
 #define y second
 #define fore(i,a,b) for(ll i=a;i<b;i++)
 #define forci(i,n) for(ll i=0;i<n;i++)
 #define vi vector<ll>
 #define Endl endl
 #define lb lower_bound
 #define ub upper_bound
#define pii pair<ll,ll>
 
 #define input freopen("input.txt", "r", stdin),freopen("output.txt", "w", stdout)
// #define time        cerr << "\nTime elapsed: " << 1000 * clock() / CLOCKS_PER_SEC << "ms\n";
using namespace std;
 
ll gcd(ll a, ll b){if (b == 0)return a;return gcd(b, a % b);}
int power(int x, unsigned int y, unsigned int m){ if (y == 0) return 1;int p = power(x, y/2, m) % m;  p = (p * p) % m;return (y%2 == 0)? p : (x * p) % m;}
ll modInverse(int a, int m){{ return power(a, m-2, m);}}
const int maxn =500003;


void solve()
{
    ll n,k;cin>>n>>k;
    ll a[n];
    for(ll i=0;i<n;i++)cin>>a[i];sort(a,a+n);
    ll sum =0;
    for(ll i=0;i<k;i++)sum+=a[i];
    cout<<sum<<endl;
}
 
signed main()
{
   Need_for_speed(activated);
    
   
//satisfy
//    {
//  solve();
//   }
    solve();
    
    return 0;
}
 


Measured memory_bytes: 3628
//BISMILLAHIR RAHMANIR RAHIM
#include <bits/stdc++.h>
#define mem(a, b) (memset(a, b, sizeof(a)))
#define pb push_back
#define mk make_pair
#define ff first
#define ss second
#define PI acos(-1)
#define INF 2147483647
#define MOD 1000000007
#define MAX 100005
using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> ii;
typedef pair<int, ii> pii;
typedef vector<ii> vii;
typedef priority_queue<int,vector<int>,greater<int> > PQ;

int Set(int mask, int pos){return mask = mask | (1<<pos);}
bool check(int mask, int pos){return (bool)(mask & (1<<pos));}

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

    int n;
    cin>>n;

    bool found = false;
    while(n != 0){
        if(n % 10 == 7)
            found = true;
        n /= 10;
    }

    (found) ? cout<<"Yes"<<endl : cout<<"No"<<endl;

    return 0;
}


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

int main(){
  int N,M,C;
  cin>>N>>M>>C;
  int B[M];
  int A[M];
  for (int i=0;i<M;i++){
    cin>>B[i];
  }
  int count=0;
  int ans=0;
  
  for(int i=0;i<N;i++){
    ans=0;
    for(int j=0;j<M;j++){
      cin>>A[j];
      ans=ans+A[j]*B[j];
    }
    ans=ans+C;
    if(ans>0){
      count++;
    }
  }
  cout<<count<<endl;     
  return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
int main(){
  int i,n,count=0,a,b;
  scanf("%d",&n);
  for(i=0;i<n;i++){
    scanf("%d %d",&a,&b);
    count+=(b-a+1);
  }
  printf("%d\n",count);
}

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

long pow3(int n){
    long r = 1;
    for(int i = 0; i < n; i++){
        r = (r * 3) % 998244353;
    }
    return r;
}

int main() {
    int N;
    cin >> N;
    int a[N];
    int s = 0;
    for(int i = 0; i < N; i++){
        cin >> a[i];
        s += a[i];
    }
    int m = (s + 1) / 2;

    long c1[m + 1];
    for (int j = 0; j < m; j++){
        c1[j] = 0;
    }
    c1[m] = 1;
    for (int i = 0; i < N; i++){
        for(int j = 0; j < m - a[i] + 1; j++){
            c1[j] = (2 * c1[j] + c1[j + a[i]]) % 998244353;
        }
        for(int j = m - a[i] + 1; j < m + 1; j++){
            c1[j] = (2 * c1[j] + c1[m]) % 998244353;
        }
    }

    long ans1 = c1[0];


    if (s % 2 == 0){
        for (int j = 0; j < m; j++){
            c1[j] = 0;
        }
        c1[m] = 1;
        for (int i = 0; i < N; i++){
            for(int j = 0; j < m - a[i] + 1; j++){
                c1[j] = (c1[j] + c1[j + a[i]]) % 998244353;
            }
            for(int j = m - a[i] + 1; j < m + 1; j++){
                c1[j] = c1[j];
            }
        }
    }else{
        c1[0] = 0;
    }

    long ans = ((pow3(N) - 3 * ans1 + 3 * c1[0]) % 998244353 + 998244353) % 998244353;
    cout << ans << "\n";
}

Measured memory_bytes: 640
#include <iostream>
using namespace std;
int hit(int a[],int b[]);
int blow(int a[], int b[]);
int main(){
    int a[4];
    int b[4];
    while (cin >> a[0] >> a[1] >> a[2] >> a[3]){
        cin >> b[0] >> b[1] >> b[2] >> b[3];
        int hi = hit(a,b);
        int bl = blow(a,b);
        cout << hi << " " << bl << endl;
    }
}

int hit(int a[],int b[]){
    int n=0;
    for (int i=0; i<4;i++){
        if (a[i]==b[i])
            n++;
    }
    return n;
}

int blow(int a[], int b[]){
    int n=0;
    for (int i=0; i<4; i++){
        for (int j=0; j<4; j++){
            if (a[i]==b[j] && i!=j)
                n++;
        }
    }
    return n;
}

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

using namespace std;

using int64 = long long;
const int64 INF = 1LL << 60;


int main() {
  int N;
  string S[300];

  cin >> N;
  for(int i = 0; i < N; i++) {
    cin >> S[i];
  }
  int ret = 0;
  for(int i = 0; i < N; i++) {
    bool flag = true;
    for(int j = 0; j < N; j++) {
      for(int k = 0; k < N; k++) {
        if(S[(i + j) % N][k] != S[(i + k) % N][j]) flag = false;
      }
    }
    ret += flag * N;
  }
  cout << ret << endl;
}

Measured memory_bytes: 384
from sys import stdin

n, x = [int(x) for x in stdin.readline().split()]
a_lst = sorted([int(x) for x in stdin.readline().split()])
s = 0

for i, a in enumerate(a_lst):
  s += a
  if s > x:
    print(i)
    exit()
    
if s == x: print(i+1)
else: print(i)

Measured memory_bytes: 8872
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define pb push_back
#define vll vector<ll>
#define ub upper_bound
#define lb lower_bound
#define all(v) ((v).begin()),((v).end())
#define allr(v) ((v).rbegin()),((v).rend())
#define ff first
#define ss second
#define mp make_pair
#define pll pair<ll,ll> 
#define fo(i,n) for(ll i=0;i<n;i++)
#define foa(i,s,e) for(ll i=(s);i<e;i++)
#define fod(i,s,e) for(ll i= (s);i>=(e);i--)
const ld pi = 3.14159265358979323846;
ll mod1 = 1e9 + 7;
ll mod2 = 998244353;
ll mul(ll x,ll y){
    return (1ll* (x%mod1)*(y%mod1));
}
ll modpow(ll x,ll y){ll z=1;while(y>0){if(y%2)z=mul(z,x);x =mul(x,x) ;y/=2;}return z;}
ll power(ll x,ll y){ll z=1;while(y>0){if(y%2)z=z*x;x =x*x ;y/=2;}return z;}
ll gcd(ll a,ll b){if(a<b) return gcd(b,a);if(b==0) return a;return gcd(b,a%b);} 
ll min(ll a,ll b){if(a<b)return a;return b;}
ll max(ll a,ll b){if(a>b)return a;return b;}
ll sq(ll a){
    ll ans = (1ll*a*a);
    return ans;
}
const int n = 1000000;
vector<char> is_prime(n+1, true);
vll primes;
void sieve(){
    is_prime[0] = is_prime[1] = false;
    for (int i = 2; i <= n; i++) {
        if (is_prime[i] && (long long)i * i <= n) {
            for (int j = i * i; j <= n; j += i)
                is_prime[j] = false;
        }
    }
}
void pri(){
    for(ll i = 2;i<=1000000;i++){
        if(is_prime[i])primes.pb(i);
    }
}

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0),cout.tie(0);
    #ifndef ONLINE_JUDGE
    freopen("inputf.txt" , "r" , stdin) ;
    freopen("outputf.txt" , "w" , stdout) ;
    //freopen("error.txt" , "w" , stderr) ;
    #endif
    ll n;
    sieve(),pri();
    cin>>n;
    vll v;
    for(ll x: primes){
        ll cnt = 0;
        while(n%x == 0){
            cnt++;
            n/=x;
        }
        v.pb(cnt);
    }
    if(n>1){
        v.pb(1);
    }
    ll ans = 0;
    for(ll x: v){
        ll k = (-1 + sqrt(1 + 8*x))/2 ;
        ans+=k;
    }
    cout<<ans<<"\n";



}


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

using namespace std;

#define rep2(x,fr,to) for(int (x)=(fr);(x)<(to);(x)++)
#define rep(x,to) for(int (x)=0;(x)<(to);(x)++)
#define repr(x,fr,to) for(int (x)=(fr);(x)>=(to);(x)--)
#define all(c) (c).begin(),(c).end()
#define sz(v) (int)(v).size()

typedef long long ll; typedef vector<int> VI; typedef pair<ll,int> pii;
const ll mod = 1e9+7;

	bool dp[100100];
	
int main()
{
	
	//cin.tie(0); ios_base::sync_with_stdio(false);

	int n, mx=0;
	cin >>n;
	dp[0] = 1;
	rep(i,n){
		int s; cin >>s;
		repr(j, mx, 0) if(dp[j]>0){
			dp[j + s] = 1; mx = max(mx, j+s);
		}
	}
	
	repr(i,mx,0) if(dp[i] && i%10){
		cout << i << endl; return 0;
	}
	puts("0");
	return 0;
}




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

int main() {
    int N;
    cin >> N;
    vector<int> V(N);
    for (int i=0; i<N; i++) {
        cin >> V.at(i);
    }
    vector<int> C(N);
    for (int i=0; i<N; i++) {
        cin >> C.at(i);
    }
    int ans = 0;
    for (int i=0; i<N; i++) {
        if (V.at(i) > C.at(i)) {
            ans += V.at(i) - C.at(i);
        }
    }
    cout << ans << endl;
}

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

string s;
int n, k;
char c;


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

    c = s.at(k-1);

    for (int i = 0; i < n; ++i)
    {
        if (s.at(i) != c)
        {
            s.at(i) = '*';
        }
    }

    cout << s << endl;
}

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

long long cache[100005][3];

long long vacate(vector<long long>* v, int n, int i, int activity) {
    if (i >= n) {
        return 0;
    }

    if (activity != -1 && cache[i][activity] != -1) {
        return cache[i][activity];
    }

    long long points = 0;
    for (int m = 0; m < 3; m++) {
        if (activity != m) {
            points = max(points, v[i][m] + vacate(v, n, i+1, m));
        }
    }

    cache[i][activity] = points;
    return points;
}

int main() {
    int n;
    cin>>n;
    vector<long long> v[n];

    int a, b, c;
    for (int i = 0; i < n; i++) {
        cin>>a>>b>>c;
        v[i].push_back(a);
        v[i].push_back(b);
        v[i].push_back(c);
    }

    for (int i = 0; i < n; i++) {
        for (int j = 0; j < 3; j++) {
            cache[i][j] = -1;
        }
    }

    long long points = vacate(v, n, 0, -1);
    cout<<points<<endl;
}


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

using namespace std;

int R, C, Ans;
int MapData[10][10000];
bool FlagRow[10];

int countOK() {
	int curSum, total;

	total = 0;
	for (int j = 0; j < C; ++j) {
		curSum = 0;
		for (int i = 0; i < R; ++i) {
			if (FlagRow[i] && !MapData[i][j] || !FlagRow[i] && MapData[i][j]) {
				++curSum;
			}
		}
		total += max(curSum, R - curSum);
	}

	return total;
}

void solve(int curRow) {

	if (curRow == R) {
		Ans = max(Ans, countOK());
		return;
	}
	
	FlagRow[curRow] = false;
	solve(curRow + 1);

	FlagRow[curRow] = true;
	solve(curRow + 1);
}

int main() {

	while (cin >> R >> C, R) {
		for (int i = 0; i < R; ++i) {
			for (int j = 0; j < C; ++j) {
				cin >> MapData[i][j];
			}
		}
		Ans = -1;
		solve(0);
		cout << Ans << endl;
	}

	return 0;
}


Measured memory_bytes: 3468
while 1:
    H,W=map(int,input().split())
    if H==0 and W==0:
        break
    for i in range(0,H):
        for j in range(0,W):
            if (i+j)%2==0:
                print("#",sep="",end="")
            elif (i+j)%2==1:
                print(".",sep="",end="")
        print()
    print()

Measured memory_bytes: 7000
#include <bits/stdc++.h>
#define REP(i, n) for(ll i = 0; i < (ll)n; i++)
#define FOR(i, a, b) for(ll i = (a); i < (ll)b; i++)
#define ALL(obj) (obj).begin(), (obj).end()
#define INF (1ll << 60)
using namespace std;
typedef long long ll;
typedef double db;
typedef string str;
typedef pair<ll, ll> p;
constexpr int MOD = 1000000007;
using ll = long long;
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;
}

void print(const std::vector<int> &v) {
    std::for_each(v.begin(), v.end(), [](int x) { std::cout << x << " "; });
    std::cout << std::endl;
}

int main() {
    int N, K;
    cin >> N >> K;
    vector<int> l(N);
    REP(i, N) { cin >> l[i]; }
    sort(l.begin(), l.end(), greater<int>());
    int s = 0;
    REP(i, K) { s += l[i]; }
    cout << s << endl;
    return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#define _USE_MATH_DEFINES
#include <cmath>
#define rad(r) (r * M_PI / 180)
int main() {
	double a, b, C, S;
	scanf("%lf %lf %lf", &a, &b, &C);
	S = 0.5 * a * b * sin(rad(C));
	printf("%f\n", S);
	printf("%f\n", a + b + sqrt(a*a + b*b - 2 * a*b*cos(rad(C))));
	printf("%f\n", 2 * S / a);
}

Measured memory_bytes: 1124
def gcd(a,b):
    while b!=0:
        a, b = b, a%b
    return a

def lcm(a,b):
    return a*b // gcd(a,b)

N = int(input())
T = [int(input()) for _ in range(N)]
ans = 1
for t in T:
    ans = lcm(ans, t)
print(ans)


Measured memory_bytes: 9168
//long time no ac
#include<bits/stdc++.h>
using namespace std;

#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";

#define     SPEED       ios::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define 	setprecn(x) cout<<fixed<<setprecision(x);
#define 	ll          long long int
#define 	pb          push_back
#define 	pll         pair<ll,ll>
#define 	vll         vector<ll>
#define 	ff          first
#define 	ss          second
#define 	all(a)      (a).begin(),(a).end()
#define 	sz(x)       (ll)x.size()
#define 	hell        1000000007
#define 	rep(i,n)    for(ll i=0;i<n;i++)
#define 	repe(i,a,b) for(ll i=a;i<b;i++)
#define 	lbnd        lower_bound
#define 	ubnd        upper_bound
#define 	bs          binary_search

ll power(ll a,ll b)
{
	if(b==0)
		return 1;
	if(b==1)
		return a;
	ll c=power(a,b/2);
	if(b%2==0)
		return((c%hell)*(c%hell))%hell;
	return ((((c%hell)*(c%hell))%hell)*(a%hell))%hell;
}

/********************************************************/
//	d.erase(unique(all(d)), d.end());




int main()
{
	SPEED;
	ll n,k,m,i,j,c=0,cs=0,t;
	t=1;

	// cin>>t;
	string s;
	while(t--)
	{
		// cs++;
		cin>>i>>j;
		// n=s.length();
		// ll a[n];
		n=max(i,j);
		m=min(i,j);
		c=n+((n-1)>m?(n-1):m);
		
		cout<<c;
		if(t!=0)
	   		cout<<"\n";
	}
	return 0;
}

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

int main() {
    string S;
    cin >> S;
    if (S == "SUN") cout << 7 << endl;
    else if (S == "MON") cout << 6 << endl;
    else if (S == "TUE") cout << 5 << endl;
    else if (S == "WED") cout << 4 << endl;
    else if (S == "THU") cout << 3 << endl;
    else if (S == "FRI") cout << 2 << endl;
    else if (S == "SAT") cout << 1 << endl;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <queue>
#include <vector>
#include <bitset>
#include <utility>
using namespace std;
typedef pair<int,int> pi;
#define F first
#define S second
#define MP make_pair
#define PB push_back
const int N=10010;
const int M=100010;
const int INF=1<<30;
int prim(int n,int m){
    int ans=0,l,r,temp,dis[N];
    bitset<N> went;
    vector<pi>graph[N];
    pi nxt;
    priority_queue<pi,vector<pi>,greater<pi> >pq;
    for(int i=0;i<m;i++){
        scanf("%d%d%d",&l,&r,&temp);
        graph[l].PB(MP(temp,r));
        graph[r].PB(MP(temp,l));
    }
    for(int i=1;i<n;i++)dis[i]=INF;
    dis[0]=0;
    pq.push(MP(0,0));
    went.reset();
    while(n>0){
        nxt=pq.top();
        pq.pop();
        if(went[nxt.S])continue;
        went[nxt.S]=true;
        ans+=dis[nxt.S];
        for(int i=0;i<graph[nxt.S].size();i++)if(!went[graph[nxt.S][i].S]){
            if(dis[graph[nxt.S][i].S]>graph[nxt.S][i].F){
                dis[graph[nxt.S][i].S]=graph[nxt.S][i].F;
                pq.push(graph[nxt.S][i]);
            }
        }
        n--;
    }
    return ans;
}
int main(){
    int n,m;
    scanf("%d%d",&n,&m);
    printf("%d\n",prim(n,m));
}


Measured memory_bytes: 5832
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;

namespace nikkei2019_qual_d
{
    class MainClass
    {
        public static void Main(string[] args)
        {
            var ins = new Problem();
            ins.solve();
        }
    }

    class Problem 
    {
        public void solve()
        {
            Func<int[]> read = () => Console.ReadLine().Split().Select(int.Parse).ToArray();
            int[] v = read();
            int N = v[0];
            int M = v[1];
            Dictionary<int, List<int>> d = new Dictionary<int, List<int>>();
            Dictionary<int, List<int>> e = new Dictionary<int, List<int>>();
            var h = new int[N + 1];

            for (int i = 1; i <= N; i++)
            {
                d.Add(i, new List<int>());
                e.Add(i, new List<int>());
            }

            int A, B;

            for (int i = 0; i < N + M - 1; i++)
            {
                int[] b = read();
                A = b[0];
                B = b[1];
                d[A].Add(B);
                e[B].Add(A);
                h[B]++;
            }

            var tp = topologicalSort(e, d, h);
            for (int i = 1; i <= N;i++) {
                int s = 0;
                int t = 0;
                foreach(var j in e[i])
                {
                    if (s < tp[j]) {
                        s = tp[j];
                        t = j;
                    }
                }
                Console.WriteLine("{0}", t);
            }

        }

        private Dictionary<int, int> topologicalSort(Dictionary<int, List<int>> IN, Dictionary<int, List<int>> OUT, int[] h) {
            var q = new Stack<int>();
            var ans = new Dictionary<int, int>();

            foreach(var elem in IN) 
            {
                if (elem.Value.Count == 0)
                {
                    q.Push(elem.Key);
                }
            }

            int c = 0;

            while (q.Count != 0) 
            {
                var s = q.Pop();
                c++;
                ans.Add(s, c);

                foreach(var t in OUT[s])
                {
                    h[t]--;
                    if(h[t]==0)
                    {
                        q.Push(t);
                    }
                }
            }

            return ans;
        }
    }
}


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

int main() {
	string temp;
	int H, W, semi[60][60], semi2[60][60] = {};

	for (int i = 0; i < 60; i++)
		for (int j = 0; j < 60; j++) semi2[i][j] = -1;
	semi2[0][0] = 0;
	cin >> H >> W;

	for (int i = 0; i < H; i++) {
		cin >> temp;
		for (int j = 0; j < W; j++) {
			semi[i][j] = temp[j] - '0';
		}
	}
	for (int i = 0; i < H; i++) {
		for (int j = 0; j < W; j++) {
			
			if (i + 1 != H) {
				if (semi2[i + 1][j] == -1) {
					semi2[i + 1][j] = semi[i + 1][j] + semi2[i][j];
				} else semi2[i + 1][j] = min(semi2[i + 1][1], semi[i + 1][j] + semi2[i][j]);
			}
			if (j + 1 != W) {
				if (semi2[i][j + 1] == -1) {
					semi2[i][j + 1] = semi[i][j + 1] + semi2[i][j];
				}else semi2[i][j + 1] = min(semi2[i][j + 1], semi[i][j + 1] + semi2[i][j]);
			}
		}
	}
	
	cout << semi2[H - 1][W - 1] << endl;

	return 0;
}


Measured memory_bytes: 3240
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
#include<bits/stdc++.h>
#define INF         1e9
#define EPS         1e-9
#define REP(i,n)    for(lint i=0,i##_len=(n);i<i##_len;++i)
#define REP1(i,n)   for(lint i=1,i##_len=(n);i<=i##_len;++i)
#define REPR(i,n)   for(lint i=(n)-1;i>=0;--i)
#define REPR1(i,n)  for(lint i=(n);i>0;--i)
#define REPC(i,obj) for(auto i:obj)
#define R_UP(a,b)   (((a)+(b)-1)/(b))
#define ALL(obj)    (obj).begin(),(obj).end()
#define SETP        cout << fixed << setprecision(10)
using namespace std;
using lint = long long;
template<typename T = lint>inline T in() { T x; cin >> x; return x; }
class vec2d {
public:
	double x, y;
	vec2d(double x, double y) :x(x), y(y) {}
	double norm() const {
		return sqrt(x * x + y * y);
	}
	vec2d operator+(vec2d v) {
		return vec2d(x + v.x, y + v.y);
	}
	vec2d operator-(vec2d v) {
		return vec2d(x - v.x, y - v.y);
	}
	vec2d operator*(double k) const {
		return vec2d(x * k, y * k);
	}
	vec2d operator/(double k)const {
		return vec2d(x / k, y / k);
	}
	bool operator==(const vec2d&v)const {
		return x == v.x && y == v.y;
	}
	static double inner_product(const vec2d&a, const vec2d&b) {
		return a.x * b.x + a.y * b.y;
	}
	static double cros_product(const vec2d&a, const vec2d&b) {
		return a.x * b.y - a.y * b.x;
	}
	static double argument(const vec2d&a, const vec2d&b) {
		return atan2(cros_product(a, b), inner_product(a, b));
	}
	static double distance(const vec2d&a, const vec2d&b) {
		return hypot(b.x - a.x, b.y - a.y);
	}
	static vec2d projection(const vec2d&a, const vec2d&b) {
		double n = a.norm();
		return a * vec2d::inner_product(a, b) / n / n;
	}
	static vec2d cross_point(const vec2d&v0, const vec2d&v1, const vec2d&v2, const vec2d&v3) {
		return vec2d(((v1.x * v0.y - v0.x * v1.y) * (v3.x - v2.x) - (v3.x * v2.y - v2.x * v3.y) * (v1.x - v0.x)) / ((v1.x - v0.x) * (v3.y - v2.y) - (v3.x - v2.x) * (v1.y - v0.y)), ((v1.x * v0.y - v0.x * v1.y) * (v3.y - v2.y) - (v3.x * v2.y - v2.x * v3.y) * (v1.y - v0.y)) / ((v1.x - v0.x) * (v3.y - v2.y) - (v3.x - v2.x) * (v1.y - v0.y)));
	}
};
signed main() {
	SETP;
	int q = in();
	REP(i, q) {
		double xp0 = in(), yp0 = in(), xp1 = in(), yp1 = in(), xp2 = in(), yp2 = in(), xp3 = in(), yp3 = in();
		vec2d v0(xp0, yp0), v1(xp1, yp1), v2(xp2, yp2), v3(xp3, yp3);
		vec2d cross = vec2d::cross_point(v0, v1, v2, v3);
		if (std::isnan(cross.x) && std::isnan(cross.y)) {
			vector<double> dis = {
			vec2d::distance(v0, v1),
			vec2d::distance(v0, v2),
			vec2d::distance(v0, v3),
			vec2d::distance(v1, v2),
			vec2d::distance(v1, v3),
			vec2d::distance(v2, v3)
			};
			double dis_sum = dis[0] + dis[5];
			double dis_max = *max_element(ALL(dis));
			cout << (dis_max < dis_sum || abs(dis_max - dis_sum) < EPS ? '1' : '0') << endl;
		} else if (std::isinf(cross.x) || std::isinf(cross.y)) {
			cout << '0' << endl;
		} else {
			v1 = v1 - v0;
			cross = cross - v0;
			double ks0 = v1.x != 0 ? cross.x / v1.x : cross.y / v1.y;
			v3 = v3 - v2;
			cross = cross + v0 - v2;
			double ks1 = v3.x != 0 ? cross.x / v3.x : cross.y / v3.y;
			cout << (0 <= ks0 && ks0 <= 1 && 0 <= ks1 && ks1 <= 1 ? '1' : '0') << endl;
		}
	}
}


Measured memory_bytes: 3120
#define _USE_MATH_DEFINES

#include <iostream>
#include <iomanip>
#include <stdio.h>

#include <sstream>
#include <algorithm>
#include <iterator>
#include <cmath>
#include <complex>

#include <string>
#include <cstring>
#include <vector>
#include <bitset>

#include <queue>
#include <set>
#include <map>
#include <stack>
#include <list>

#include <ctime>
////
//#include <random>//
/////////

typedef long long LL;
typedef long double LD;
typedef unsigned long long ULL;

////定数
const int INF = (int)1e9 + 10;
const LL MOD = (LL)1e9 + 7;
const LL LINF = (LL)4e18 + 20;
const LD PI = acos(-1.0);
const double EPS = 1e-9; 
/////////
using namespace::std;
void chmax(LL& a, LL b) {
	a = max(a, b);
}
void chmin(LL& a, LL b) {
	a = min(a, b);
}
//////////////

void solve() {
	int N, K;
	cin >> N >> K;
	vector<int> H(200001, 0);

	for (int i = 0; i < N; ++i) {
		int ter;
		cin >> ter;
		H[ter]++;
	}
	vector<int> A;

	for (int i = 0; i <= 200000; ++i) {
		if (H[i] == 0)continue;
		A.push_back(H[i]);
	}
	sort(A.begin(), A.end());
	reverse(A.begin(), A.end());
	
	int cnt = 0;
	int ans = 0;
	for (int i = 0; i < A.size(); ++i) {
		if (cnt < K) {
			++cnt;
		}
		else {
			ans += A[i];
		}
	}
	cout << ans << endl;
}

signed main(void) {
	std::cin.tie(0);
	std::ios::sync_with_stdio(false);
	std::cout << std::fixed;//小数を10進数表示
	cout << setprecision(16);//小数点以下の桁数を指定//coutとcerrで別	

	solve();
}


Measured memory_bytes: 2168
#include<bits/stdc++.h>
using namespace std;
using Graph = vector<vector<int>>;
#define rep(i,n) for(int i=0;i<n;++i)
#define all(v) v.begin(), v.end()
typedef long long int ll;
typedef unsigned long long ull;
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;}
typedef pair<ll,ll> P;
const long long MOD = 1e9+7;
const ll INF = 1LL << 60;

ll mulfi(ll n){
    ll cnt = 0;
    while(n > 0){
        cnt += n / 5;
        n /= 5;
    }   

    return cnt;
}


int main(){

    ll n;
    cin >> n;

    ll cnt = 0;

    if(n % 2 != 0){
        cout << 0 << endl;
        return 0;
    }

    cnt = mulfi(n/2);

    cout << cnt << endl;

}

Measured memory_bytes: 3636
#include<bits/stdc++.h>
#define for_int(i,a,b) for(int i=(a);i<=(b);++i)
#define rep_int(i,a,b) for(int i=(a);i>=(b);--i)
#define for_ll(i,a,b) for(ll i=(a);i<=(b);++i)
#define rep_ll(i,a,b) for(ll i=(a);i>=(b);--i)
#define ull unsigned long long
#define ll long long
#define db double
#define HPMAX 1005
#define KMP_MAX 1005
#define prime_MAX 1e6+5
#define quick_pow_mod 1e9+7
#define PII pair<int,int>
using namespace std;
//快读
int read() {
	char c = getchar();
	int x = 0, f = 1;
	for (; !isdigit(c); c = getchar())
		if (c == '-')
			f = -1;
	for (; isdigit(c); c = getchar())
		x = x * 10 + c - 48;
	return x * f;
}
int x, n, p;
map<int, int>mp;
int main() {
	x = read(); n = read();
	for_int(i, 1, n) {
		p = read();
		mp[p] = 1;
	}
	if (!mp[x]||n==0)
		cout << x << endl;
	else {
		int p1 = x - 1, p2 = x + 1;
		for (; mp[p1]; --p1);
		for (; mp[p2]; ++p2);
		if (p2 - x < x - p1)
			cout << p2 << endl;
		else
			cout << p1 << endl;
	}
	return 0;
}

Measured memory_bytes: 3600
//#include <bits/stdc++.h>
//#include <stdio.h>
#include<iostream>
#include<cstdio>
#include<bitset>
#include<algorithm>
#include<vector>
#include<list>
#include<queue>
#include<stack>
#include<string>
#include<string.h>
#include<cmath>
#include<utility>
#include<functional>
#include<map>
#include<set>
#include<cctype>
#include<fstream>


#define FOR(i, a, b) for( int i=(a);i<=(b);i++)
#define RFOR(i, a, b) for( int i=(a);i>=(b);i--)
#define LFOR(i, a, b) for( long long int i=(a);i<=(b);i++)
#define LRFOR(i, a, b) for(long long int i=(a);i>=(b);i--)
#define MOD 1000000007
#define INF 1000000000 //2000000000
#define LINF 1000000000000000000 //9000000000000000000
#define PI 3.14159265358979
#define MAXI 7500000

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

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

//グローバル変数
struct edge {
	int to;
	int cost;
};
int V = 100001;
vector<vector <edge> > G(V, vector<edge>());
vector<int> d(100001);

void dijkstra(int s) {
	typedef pair<int, int> P;

	priority_queue<P, vector<P>, greater<P> > que;
	fill(d.begin(), d.end(), INF);
	d[s] = 0;
	que.push(P(0, s));

	while (!que.empty()) {
		P p = que.top();
		que.pop();
		int v = p.second;
		if (d[v] < p.first) {
			continue;
		}
		for (int i = 0; i < G[v].size(); i++) {
			edge e = G[v][i];
			if (d[e.to] > d[v] + e.cost) {
				d[e.to] = d[v] + e.cost;
				que.push(P(d[e.to], e.to));
			}
		}
	}
}

int main(void) {
	int N;

	cin >> N;
	vector<int> u(N), v(N), w(N);
	vector<int> color(N+1,0);//まだ、黒、白
	edge a;
	queue<int> que;
	int now;

	FOR(i, 0, N - 2) {
		cin >> u[i] >> v[i] >> w[i];
		a.cost = w[i];
		a.to = v[i];
		G[u[i]].push_back(a);
		a.to = u[i];
		G[v[i]].push_back(a);
	}



	/*FOR(i, 1, N) {
		cout << d[i] << endl;
	}*/

	que.push(u[0]);
	color[u[0]] = 1;
	while (!que.empty()) {
		now = que.front();
		que.pop();
		
		for (int i = 0; i < G[now].size(); i++) {
			//cout << now << " " << i << " " << G[now][i].to << endl;
			if (color[G[now][i].to] == 0) {
				if ((G[now][i].cost) % 2 == 0) {
					color[G[now][i].to] = color[now];
				}
				else {
					if (color[now] == 1) {
						color[G[now][i].to] = 2;
					}
					else {
						color[G[now][i].to] = 1;
					}
				}
				que.push(G[now][i].to);
			}
			
		}
	}

	FOR(i, 0, N - 1) {
		cout << color[i + 1]-1 << endl;
	}

	

	return 0;
}

Measured memory_bytes: 8448
#pragma GCC optimize("Ofast")   //Comment optimisations for interactive problems (use endl)
#pragma GCC target("avx,avx2,fma")
#pragma GCC optimization ("unroll-loops")
#include<bits/stdc++.h>

using namespace std;

#define  fastio         ios:: sync_with_stdio(0);cin.tie(0);cout.tie(0);cout<<fixed;cout<<setprecision(10);
#define  randomINIT     mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());
#define  all(x)         (x).begin(),(x).end()
#define  mset(x,val)    memset(x,val,sizeof(x))
#define  endl           "\n"
#define  pb             push_back
#define  sym(s)         s="#"+s+"#";
#define  mp             make_pair
#define  s              second
#define  f              first
#define  dline          cerr<<"///REACHED///\n";
#define  debv(a)        for(auto it: a)cout<<it<<" ";cout<<endl;
#define  deb1(a)        cout<<a<<endl;
#define  deb2(a,b)      cout<<a<<" "<<b<<endl;
#define  deb3(a,b,c)    cout<<a<<" "<<b<<" "<<c<<endl;
#define  deb4(a,b,c,d)  cout<<a<<" "<<b<<" "<<c<<" "<<d<<endl;
#define  uniq(a)        a.resize(unique(a.begin(), a.end()) - a.begin());

typedef  long long             ll;
typedef  unsigned long long    ull;
typedef  long double           ld;
typedef  pair<ll,ll>           pll;
typedef  vector<ll>            vll;
typedef  vector<pll>           vpll;

const ll   MOD   =  1e+9+7;
const ll   INF   =  0x7f7f7f7f7f7f7f7f;
const int  INFi  =  0x7f7f7f7f;
const ll   N  =  3e+5+7;

vll adj[N];ll vis[N]={};
int dx8[]={0,1,1,1,0,-1,-1,-1}, dy8[]={1,1,0,-1,-1,-1,0,1};
int dx4[]={0,1,0,-1}, dy4[]={1,0,-1,0};

//<<-----Declare Variable Here------->>//
int t=1;
ll n;
const ll N2=1e6+8;
ll p[N2];
void sieve(){
    for(ll i = 2; i*i <= N2; i++){
        if(p[i] == 0){
            for(ll j = 2*i; j < N2; j += i){  
                if(p[j]==0) p[j]=i;//for spf
            }
        }
    }
    for(ll i=1;i<=N2-1;i++)if(p[i]==0)p[i]=i;
    
}
map<ll,ll> getFactorization(ll x) 
{ 
    map<ll,ll> ret; 
    while(x!=1){ret[p[x]]++;x = x/p[x];} 
    return ret;
} 
//<<-----Implement Functions Here---->>//


//<<-----Start of Main--------------->>//
void MAIN(){
		cin>>n;ll ans1 = 0;
		for(ll i=1;i<=n-1;i++)
		{
			ll num = n-i;map<ll,ll>map1;
			map1 = getFactorization(num);
			ll ans = 1;
			for(auto it:map1)ans*=(it.s+1);
			ans1 += ans;
		}
		cout<<ans1<<endl;
}

int main(){
    fastio;randomINIT;
    sieve();
    //cin>>t;
    while(t--){
        MAIN();
    }

    #ifndef ONLINE_JUDGE
    cout<<"\nTime Elapsed: " << 1.0*clock() / CLOCKS_PER_SEC << " sec\n";
    #endif
}

Measured memory_bytes: 18496
#include <iostream>
#include <array>
#include <algorithm>
#include <vector>
#include <bitset>
#include <set>
#include <unordered_set>
#include <cmath>
#include <complex>
#include <deque>
#include <iterator>
#include <numeric>
#include <map>
#include <unordered_map>
#include <queue>
#include <stack>
#include <string>
#include <tuple>
#include <utility>
#include <limits>
#include <iomanip>
#include <functional>
#include <cassert>
using namespace std;

using ll=long long;
template<class T> using V = vector<T>;
template<class T, class U> using P = pair<T, U>;
using vll = V<ll>;
using vvll = V<vll>;
#define rep(i, k, n) for (ll i=k; i<(ll)n; ++i)
#define REP(i, n) rep(i, 0, n)
#define ALL(v) v.begin(),v.end()
template < class T > inline bool chmax(T& a, T b) {if (a < b) { a=b; return true; } return false; }
template < class T > inline bool chmin(T& a, T b) {if (a > b) { a=b; return true; } return false; }
#define DEBUG_VLL(vec) REP(sz, vec.size()) std::cerr<<vec[sz]<<(sz==vec.size()-1?'\n':' ');

const long long MOD = 1000000007;
const long long HIGHINF = (long long)1e18;
const int INF = (int)1e9;

int n, m;
V< V<int> > s;
V<int> p;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cin >> n >> m;
    s.resize(m), p.resize(m);
    for (int i = 0; i < m; i++) {
        int k; cin >> k;
        for (int j = 0; j < k; j++) {
            int tmps; cin >> tmps;
            s[i].emplace_back(tmps - 1);
        }
        sort(ALL(s[i]));
    }
    for (int i = 0; i < m; i++) cin >> p[i];

    int ans = 0;
    for (int state = 0; state < (1 << n); state++) {
        int on = 0;
        for (int den = 0; den < m; den++) {
            int swc = 0;
            for (int sw = 0; sw < s[den].size(); sw++) {
                if ((state >> s[den][sw]) & 1) swc++;
            }
            if (swc % 2 == p[den]) on++;
        }
        if (on == m) ans++;
    }
    cout << ans << '\n';
    return 0;
}


Measured memory_bytes: 256
# D

n = int(input())
a = list(map(int, input().split()))

ans_a = max(a)
min_b = max(a)
for i in range(n):
    if a[i] != ans_a:
        if min_b > abs(a[i] - ans_a/2):
            ans_b = a[i]
            min_b = abs(a[i] - ans_a/2)
print("{} {}".format(ans_a, ans_b))

Measured memory_bytes: 14052
#include <bits/stdc++.h>
#include <boost/multiprecision/cpp_int.hpp>

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

using namespace std;
using ll=long long;

const int INF = 1001001001;

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

  
  vector<int> dp(h+1, INF);
  dp[0] = 0;
    
    
  rep(i, n) {
    int a,b;
    cin >> a >> b;
    rep(j, h){
      int nj = min(j+a, h);
    
      dp[nj] = min(dp[nj], dp[j] + b);
    }
  }

  cout << dp[h] << endl;

  return 0;
}


Measured memory_bytes: 256
import itertools

N, M, Q = map(int, input().split())
X = [tuple(map(int, input().split())) for _ in range(Q)]

ans = 0
for t in itertools.combinations_with_replacement(range(1, M + 1), N):
    tmp = 0
    for a,b,c,d in X:
        if t[b-1] - t[a-1] == c:
            tmp += d
    ans = max(ans, tmp)
print(ans)

Measured memory_bytes: 9196
#coding:utf-8

if __name__ == "__main__":
    N = int(input())
    tmp = input().split()
    Hs = []
    for t in tmp:
        Hs.append(int(t))
    total = 0

    for n in range(N):
        n_count = 0
        for i in range(0, n):
            if Hs[i] > Hs[n]:
                break
            n_count += 1
        if n_count == n:
            total += 1
        
    print(total)

Measured memory_bytes: 3064
#include <iostream>
#include <set>
#include <utility>
#define llint long long

using namespace std;
typedef pair<llint, llint> P;

llint b;
set<llint> S;

void make(llint x)
{
	S.clear();
	for(llint i = 1; i*i <= x; i++){
		if(x % i == 0) S.insert(i), S.insert(x/i);
	}
}

int main(void)
{
	while(1){
		cin >> b;
		if(b == 0) break;
		
		P ans = P(0, 0);
		
		make(b);
		for(auto it = S.begin(); it != S.end(); it++){
			llint x = *it, len = b / x;
			if(len%2 == 0) continue;
			llint l = x - len/2;
			if(l < 1) continue;
			ans = max(ans, P(len, l));
		}
		
		make(2*b);
		for(auto it = S.begin(); it != S.end(); it++){
			llint x = *it, len = 2 * b / x;
			if(x%2 == 0) continue;
			if(len%2) continue;
			llint l = x - len + 1;
			if(l < 2) continue;
			ans = max(ans, P(len, l/2));
		}
		cout << ans.second << " " << ans.first << endl;
	}
	return 0;
}


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

int main(){

 
  string S;
  cin>>S;
  
  if(S[1]=='B')cout<<"ARC"<<endl;
  else cout<<"ABC"<<endl;

}

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

static const int N = 100;

int main(){
	int n, p[N + 1],m[N + 1][N + 1];
	cin >> n;
	for(int i= 1; i <= n; i++){
		cin >> p[i-1] >> p[i];
	}
	
	
	for(int i = 1; i <= n; i++)m[i][i] = 0;
	for(int l = 2; l <= n; l++){
		for(int i=1; i <= n-l+1; i++ ){
			int j = i + l - 1;
			m[i][j] = (1 << 21);
			for(int k = i; k <= j - 1; k++){
				m[i][j] = min(m[i][j],m[i][k] + m[k+1][j] + p[i-1] * p[k] * p[j]);
			}
		}
	}
	
	cout << m[1][n] << endl;
	
	return 0;
}


					
					
					
					


Measured memory_bytes: 3120
#include <bits/stdc++.h>
#define f first
#define s second
#define pb push_back
#define ENDL '\n'
#define all(a) begin(a),end(a)
#define sz(a) (int)(a.size())
#define deb(a) cout << #a << ": " << a << ENDL;
#define fore(i, a, b) for(int i(a), ThkMk(b); i < ThkMk; ++i)
#define _ ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);

using namespace std;

typedef long long lli;
typedef long double ld;
typedef pair<lli, lli> ii;
typedef vector<lli> vi;

int main()
{   _
    lli x; cin >> x;
    cout << (x >= 30 ? "Yes" : "No") << ENDL;
    return 0;
}


Measured memory_bytes: 3664
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define F first
#define S second
#define pii pair<int, int>
#define eb emplace_back
#define all(v) v.begin(), v.end()
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rep3(i, l, n) for (int i = l; i < (n); ++i)
#define chmax(a, b) a = (a >= b ? a : b)
#define chmin(a, b) a = (a <= b ? a : b)
#define out(a) cout << a << endl
#define outa(a, n) { rep(_, n) cout << a[_] << " "; cout << endl; }
#define outp(a, n) { cout << endl; rep(_, n) cout << a[_].F << " " << a[_].S << endl; }
#define sz(v) (int)v.size()
#define inf (int)(1e9+7)
#define abs(x) (x >= 0 ? x : -(x))
#define ceil(a, b) a / b + !!(a % b)
#define FIX(a) fixed << setprecision(a)
#define LB(v, n) (int)(lower_bound(all(v), n) - v.begin())
#define UB(v, n) (int)(upper_bound(all(v), n) - v.begin())
ll pow(ll a, int b) { return b ? pow(a * a, b / 2) * (b % 2 ? a : 1) : 1; }
template<typename T> T gcd(T a, T b) { if (b == 0) return a; return gcd(b, a % b); }



vector<int> sieve() {
    const int MAX_N = 7369791 + 1;
    vector<int> v(MAX_N, 0);
    v[0] = v[1] = 1;
    for (int i = 2; i * i <= MAX_N; ++i) {
        int tmp = 2;
        while (tmp * i <= MAX_N) {
            v[tmp++ * i] = 1;
        }
    }
    return v;
}


int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    
   
    
    
    int table[100001] = {0};
    
    
    auto v = sieve();
    rep3(i, 1, 100001) if (i % 2 != 0 && v[i] == 0 && v[(i + 1) / 2] == 0) {
        table[i] = 1;
    }
    
    rep3(i, 1, 100001) table[i + 1] += table[i];
    
    int Q;
    cin >> Q;
    
    rep(i, Q) {
        int l, r;
        cin >> l >> r;
        out(table[r] - table[l - 1]);
    }
}




Measured memory_bytes: 29824
N, K = map(int, input().split())
A = [int(x) for x in input().split()]

i1 = A.index(1)
d1, m1 = divmod(i1, K - 1)

r = i1 + 1
if m1 != 0:
    r += K - 1 - m1

d2, m2 = divmod(max(0, N - r), K - 1)

print(d1 + d2 + (m1 != 0) + (m2 != 0))

Measured memory_bytes: 13880
import itertools

foods = [int(input()) for _ in range(5)]

def calc(foods):
    t = 0
    for f in foods:
        if t % 10 == 0:
            t += f
        else:
            t += 10-t%10 + f
    return t

def solve(f):
    ans = 2**32
    for it in itertools.permutations(f):
        ans = min(ans, calc(it))
    return ans

print(solve(foods))

Measured memory_bytes: 3060
n,k=map(int, input().split()) 
p=list(map(int, input().split()))
E = []
for e in p:
    E.append( (1+e)/2 )

s=0
for i in range(k):
    s += E[i]
    
box=[]
box.append(s)
for i in range(k,n):
    s += E[i] - E[i-k]
    box.append(s)
    
print(max(box))
    
    

    

Measured memory_bytes: 75912
n = int(input())
A = list(map(int, input().split()))

maxA = max(A) + 1
B = [0] * n
C = [0] * maxA

for a in A:
    C[a] += 1
    
j = 0
for i in range(maxA):
    for k in range(C[i]):
        B[j] = i
        j += 1
        
print(" ".join(map(str, B)))


Measured memory_bytes: 240580
#include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define fi first
#define se second
#define all(container) container.begin(),container.end()
#define fast ios::sync_with_stdio(0); cin.tie(0)
#ifndef ONLINE_JUDGE
#include "debug.cpp"
#endif
#define int long long
const int mod = 1e9+7;  
int power(int a,int b) { if(b==0) return 1; int res = power(a,b/2); if(b&1) return res * res * a; else return res * res; }


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

  int a = n/3;
  int sum1 = (a * (6+(a-1)*3))/2;

  int b= n/5;
  int sum2 = (b * (10+(b-1)*5))/2;

  int c = n/15;
  int sum3 = (c * (30+(c-1)*15))/2;

  // print(sum1,sum2,sum3);

  int sum = (n*(n+1))/2;
  sum = sum - sum1 - sum2 + sum3;

  cout << sum << '\n';

  

  return 0;
}

Measured memory_bytes: 3668
using System;
using System.Collections.Generic;
using System.Linq;

public class Hello
{
    private const int MOD_N = 1000000000 + 7;

    public static void Main()
    {
        var list = Console.ReadLine().Split(' ');
        var r = int.Parse(list[0]);
        var d = int.Parse(list[1]);
        var x = int.Parse(list[2]);

        for (int i = 10; i != 0; --i)
        {
            x *= r;
            x -= d;
            Console.WriteLine(x);
        }
    }
}


Measured memory_bytes: 11092