akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<math.h>
#include<iomanip>
#include<set>
#include<numeric>
#include<cstring>
#include<cstdio>
#include<functional>
#include<bitset>
#include<limits.h>
#include<cassert>
#include<iterator>
#include<complex>
#include<stack>
using namespace std;
#define lint long long int
/*
vector<char>al(26);
al = {'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'};
vector<char>AL(26);
AL = {'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z'};
*/


int main() {
	int r;
	cin >> r;
	cout << r * r << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<algorithm>
#include<deque>
#include<queue>
#define ll long long int
#define ld long double
#define pi acos(-1)
#define pb push_back
using namespace std;

int main()
{
    ll i,j,a,k,b,c,n,t,m,p,q,d,e,f,y,g,z,h,r,l,x,o;
    ld aa,bb,cc,ee,dd,ff,kk,gg;
    vector<ll > v,s;
    map<ll,vector<ll> > me;
    map<ll,ll > sa,ta,pa,ma;
    priority_queue<ll, vector<ll>, greater<ll> > aq,tq,pq;
    string st,et,ft,pt,ct;
    deque<ll> de,pe,ne;
    ios_base::sync_with_stdio(false);
//    freopen("input.txt", "r", stdin);
//    freopen("output.txt", "w", stdout);

    cin>>n;
    if(n==0)cout<<1<<endl;
    else if(n==1)cout<<0<<endl;
}


Measured memory_bytes: 3652
#include "bits/stdc++.h"
using namespace std;
#define fastcin {\
    cin.tie(0);\
    ios::sync_with_stdio(false);\
}
#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 fore(i, a) for(auto &i:a)
#define print(x) cout << x << "\n"
#define SORT(a, n) sort(a, a+n);
#define REVERSE(a,n) reverse(a,a+n);
#define VSORT(v) sort(v.begin(), v.end());
#define VREVERSE(v) reverse(v.begin(), v.end());
#define MOD 1000000007
#define yes "YES"
#define no "NO"
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vll;

bool dp[100001][100];
int si[7] = {1, 6, 36, 216, 1296, 7776, 46656};
int ni[6] = {1, 9, 81, 729, 6561, 59049};
int main() {
    fastcin;
    int n, ans = 0;
    cin >> n;
    int a, b;
    dp[n][0] = 1;
    rep(i, 0, 100001) {
        rep(j, 0, n+1) {
            if(dp[j][i]) {
                rep(k, 0, 7) {
                    int l = j - si[k];
                    if(l>0) dp[l][i+1] = true;
                    else if(l==0) ans = i+1;
                }
                rep(k, 0, 6) {
                    int l = j - ni[k];
                    if(l>0) dp[l][i+1] = true;
                    else if(l==0) ans = i+1;
                }
            }
            if(ans!=0) break;
        }
        if(ans!=0) break;
    }
    print(ans);
    return 0;
}

Measured memory_bytes: 9984
import math

n, m = map(int, input().split())
s = input()
t = input()


def lcm(x, y):
    return (x * y) // math.gcd(x, y)
l = (lcm(n, m))

sdict = {}
s_num = []
for i, moji in enumerate(list(s)):
    num = i * l // n + 1
    sdict[num - 1] = moji
    s_num.append(num - 1)

tdct = {}
t_num = []
for i, moji in enumerate(list(t)):
    num = i * l // m + 1
    tdct[num - 1] = moji
    t_num.append(num - 1)

stlst = list(set(s_num) & set(t_num))

for i in stlst:
    if sdict[i] != tdct[i]:
        print(-1)
        exit()
print(l)


Measured memory_bytes: 38536
A,B,K = map(int,input().split())

# for i in range(K) :
#     if (A >= 1) :
#         A -= 1
#     elif (B >= 1) :
#         B -= 1

# print(A,B)

if (A <= K) :
    K -= A
    A = 0
else :
    A -= K
    K = 0

if (B <= K) :
    K -= B
    B = 0
else :
    B -= K
    K = 0

print(A,B)

Measured memory_bytes: 3060
# coding: utf-8
line = input().split()
r = int(line[0])
c = int(line[1])
val = [[0 for i in range(c+1)] for j in range(r+1)]
for i in range(r):
    line = input().split()
    for j in range(c):
        val[i][j] = int(line[j])

for i in range(r):
    for j in range(c):
        val[i][c] += val[i][j]

for i in range(c+1):
    for j in range(r):
        val[r][i] += val[j][i]
        
for i in range(r+1):
    for j in range(c+1):
        print(str(val[i][j]),end = "")
        if j==c:
            print()
        else:
            print(" ",end = "")



Measured memory_bytes: 6748
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using VI = vector<int>;
using VL = vector<ll>;
#define FOR(i,a,n) for(int (i)=(a);(i)<(n);++(i))
#define eFOR(i,a,n) for(int (i)=(a);(i)<=(n);++(i))
#define rFOR(i,a,n) for(int (i)=(n)-1;(i)>=(a);--(i))
#define erFOR(i,a,n) for(int (i)=(n);(i)>=(a);--(i))
#define SORT(i) sort((i).begin(),(i).end())
#define rSORT(i,a) sort((i).begin(),(i).end(),(a))
#define all(i) (i).begin(),(i).end()
#define out(y,x,h,w) (y) < 0 || (h) <= (y) || (x) < 0 || (w) <= (x)
constexpr ll INF = 1000000000;
constexpr ll LLINF = 1LL << 60;
constexpr ll mod = 1000000007;
constexpr ll MOD = 998244353;
const long double pi = acos(-1);
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; }return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; }return 0; }
inline void init() { cin.tie(nullptr); cout.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(15); }
template<class T>inline istream& operator>>(istream& input, vector<T>& v) { for (auto& elemnt : v)input >> elemnt; return input; }


int main() {
    init();

    string s; cin >> s;
    int n = s.length();

    int ans = 0;
    char bef = '?';
    FOR(i, 0, n) {
        if (s[i] == bef) {
            if (i == n - 1)break;
            ++i;
            bef = '?';
        }
        else bef = s[i];
        ++ans;
    }
    cout << ans << "\n";
}


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

int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);  
	
	int n; cin >> n;
	vector<double> a(n);
	double total = 0;
	for(int i = 0; i < n; i++) {
		cin >> a[i];
		total += a[i];
	}
	double ave = total / n;
	double dist = 10000000;
	int ans = n - 1;
	for(int i = n - 1; i >= 0; i--){
		double tmp = abs(a[i] - ave);
		if(tmp <= dist){
			ans = i;
			dist = tmp;
		}
	}
	cout << ans << endl;
	
	return 0;	
}


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

#define rep(i,s,n) for (int i = (int)s; i < (int)n; i++)
#define ll long long
#define pb push_back
#define All(x) x.begin(), x.end()
#define Range(x, i, j) x.begin() + i, x.begin() + j
#define lbidx(x, y) lower_bound(x.begin(), x.end(), y) - x.begin()
#define ubidx(x, y) upper_bound(x.begin(), x.end(), y) - x.begin()
#define BiSearchRangeNum(x, y, z) lower_bound(x.begin(), x.end(), z) - lower_bound(x.begin(), x.end(), y)

class Work {
  public:
  int day, reward;
  Work(int day = 0, int reward = 0): day(day), reward(reward) {}
  bool operator < (const Work &w) const {
    return reward < w.reward;
  }
};

int main() {
  int N, M;
  cin >> N >> M;
  int A, B;
  priority_queue<Work> pq;
  map<int, vector<Work>> m;
  rep(i, 0, N) {
    cin >> A >> B;
    Work w = Work(A, B);
    m[A].pb(w);
  }

  vector<Work> ans(M+1);

  rep(i, 1, M+1) {
    if (m.count(i) > 0) {
      for (auto it = m[i].begin(); it != m[i].end(); it++) {
        // cout << i << "日, day: " << it->day << ", reward: " << it->reward << endl;
        pq.push(*it);
      }
    }
    Work w;
    if (!pq.empty()) {
      w = pq.top(); pq.pop();
    }
    ans[i] = w;
  }

  int total = 0;

  rep(i, 1, M+1) {
    total += ans[i].reward;
  }

  cout << total << endl;
};


Measured memory_bytes: 11648
#include <iostream>
#include <string>
#include <string.h>
#include <algorithm>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <cmath>
#include <stdio.h>
#include <vector>
#include <thread>
#include <atomic>
#include <mutex>
#include <future>
#define int long long
#define endre getchar();getchar();return 0
#define INF 1000000007
#define rep(i,n) for(int i=0;i<n;i++)
#define P pair<int,int>
#define prique(T) priority_queue<T,vector<T>,greater<T>>
#define vecunique(vec) sort(vec.begin(), vec.end());decltype(vec)::iterator result = std::unique(vec.begin(), vec.end());vec.erase(result, vec.end())
using namespace std;
bool prime(int n) {
	for (int i = 2; i <= sqrt(n); i++) {
		if (n%i == 0)return false;
	}
	return n != 1;
}
int gcd(int x, int y) {
	if (x < y)swap(x, y);
	if (y == 0)return x;
	return gcd(y, x%y);
}
int lcm(int x, int y) {
	return x * y / gcd(x, y);
}
int kai(int n) {
	if (n == 0)return 1;
	return (kai(n - 1)*n) % INF;
}
int mod_pow(int x, int y, int mod) {
	int res = 1;
	while (y > 0) {
		if (y & 1) {
			res = res * x%mod;
		}
		x = x * x%mod;
		y >>= 1;
	}
	return res;
}
int mystoi(string s) {
	int cnt = 0;
	for (int i = 0; i < s.size(); i++) {
		cnt += (int)(s[i] - '0') * mod_pow(10, s.size() - i - 1, INF);
	}
	return cnt;
}
/*--------Library Zone!--------*/
int n, ma, mb, a[50], b[50], c[50], ans = INF;
int dp[50][405][405];
signed main() {
	cin >> n >> ma >> mb;
	rep(i, n + 1)rep(j, 405)rep(k, 405)dp[i][j][k] = INF;
	rep(i, n)cin >> a[i] >> b[i] >> c[i];
	dp[0][0][0] = 0;
	rep(i, n) {
		rep(j, 405) {
			rep(k, 405) {
				if (dp[i][j][k] != INF) {
					dp[i + 1][j][k] = min(dp[i + 1][j][k], dp[i][j][k]);
					dp[i + 1][j + a[i]][k + b[i]] = min(dp[i + 1][j + a[i]][k + b[i]], dp[i][j][k] + c[i]);
				}
			}
		}
	}
	for(int i=1;i<=400;i++) {
		if (i%ma)continue;
		if (i / ma * mb > 400)break;
		ans = min(ans, dp[n][i][i / ma * mb]);
	}
	if (ans != INF)cout << ans << endl;
	else cout << -1 << endl;
	endre;
}


Measured memory_bytes: 53504
#include <iostream>
#include <stdio.h>
#include <unordered_map>

using namespace std;

int main(){

    string S;
    string T;
    string tmp;
    string tmp2;
    string ans;

    unordered_map<string, int> mp_S;
    unordered_map<string, int> mp_T;

    cin >> S;
    cin >> T;
 
    int num_C;
    int si = 0;

    ans = "Yes";
    num_C = 1;

    tmp = S[si];
    mp_S[tmp] = num_C;
    tmp = T[si];
    mp_T[tmp] = num_C;
    num_C++;
    for( si = 1 ; si < S.length() ; si++ ){
        tmp  = S[si];
        tmp2 = T[si];
        auto itr  = mp_S.find(tmp);        // "xyz" が設定されているか？
        auto itr2 = mp_T.find(tmp2);        // "xyz" が設定されているか？
        if( itr != mp_S.end() || itr2 != mp_T.end() ) {
            //設定されている場合の処理
            if( mp_S[tmp] != mp_T[tmp2]  ){
                ans = "No";
                   break;
            }

        } else {
            //設定されていない場合の処理
            mp_S[tmp] = num_C;
            mp_T[tmp2] = num_C;
            num_C++;
        }
    }

    cout << ans;

    return 0;
}

Measured memory_bytes: 776
#include<bits/stdc++.h>
#define maxn 3005
#define rep(i,j,k) for(int i=(j),LIM=(k);i<=LIM;i++)
#define per(i,j,k) for(int i=(j),LIM=(k);i>=LIM;i--)
using namespace std;

int n,P,S[maxn][maxn],C[maxn][maxn],pw[maxn];
int upd(int x){ return x += x >> 31 & P; }
int main(){
	scanf("%d%d",&n,&P);
	rep(i,S[0][0]=C[0][0]=1,n) rep(j,C[i][0]=1,i) C[i][j] = upd(C[i-1][j-1] + C[i-1][j] - P) % P;
	rep(i,1,n) rep(j,S[i][0]=1,i) S[i][j] = (S[i-1][j] * (j+1ll) + S[i-1][j-1]) % P;
	int ans = 0 , ppw = 2;
	rep(i,0,n) pw[i] = 1;
	per(k,n,0){
		int sm = 0;
		rep(i,0,k) sm = (sm + 1ll * S[k][i] * pw[i]) % P;
		ans = (ans + (k&1?-1ll:1ll)*C[n][k]*ppw%P*sm)%P;
		int p2 = 1;
		rep(i,0,n) pw[i] = 1ll * p2 * pw[i] % P , p2 = 2ll * p2 % P;
		ppw = ppw * 1ll * ppw % P;
	}
	printf("%d\n",(ans+P)%P);
}

Measured memory_bytes: 58896
n = int(input())
keta = len(str(n))
ans = 0
for i in range(1, keta + 1, 2):
    if i == keta:
        ans += n - (10 ** (i - 1)) + 1
    else:
        ans += 9 * (10 ** (i - 1))
print(ans)

Measured memory_bytes: 3060
/*
                IftekharMd.Shishir
                Dept. of Information and Communication Engineering
                University of Rajshahi
*/

#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>

#define ll  long long
#define ull  unsigned long long
#define ld  long double
#define f(i,n)  for(i=0;i<n;i++)
#define F(i,n)  for(i=n-1;i>=0;i--)
#define fa(i,a,b)  for(i=a;i<=b;i++)
#define Fa(i,a,b)  for(i=a;i>=b;i--)
#define printArray(i,a,n)  f(i,n)cout<<a[i]<<" "; cout<<endl;
#define printSet(a)  for(auto setData:a) cout<<setData<<" ";cout<<endl;
#define printMap(a)  for(auto mapData:a) cout<<mapData.first<<" "<<mapData.second<<endl;
#define printVector(a)  for(auto vectorData:a)cout<<vectorData<<" ";cout<<endl;
#define printLinkedList()  temp=head;while(temp){cout<<temp->data<<" ";temp=temp->post;} cout<<endl;

#define pb(x)  push_back(x)
#define all(a)  a.begin(),a.end()
#define rall(a)  a.rbegin(),a.rend()

#define bs  binary_search
#define lb  lower_bound
#define ub  upper_bound
#define mp  make_pair
#define TxtIO  freopen("input.txt","r",stdin);freopen("output.txt","w",stdout);
#define TxtTest freopen("C:/Users/Iftekhar/Documents/what/input.txt", "r", stdin);
#define FastIO  ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);ios::sync_with_stdio(0);
#define TestCase  ll t;cin>>t;while(t--)
#define points(x)  fixed<<setprecision(x)
#define scd(a,x,y)  a/__gcd(x,y);
#define nl  cout<<endl;
#define done  return 0

const ld PI= 3.14159265358979323846264338327950288;  //2*acos(0.0);
const long long MOD= 1000000007;
const long long MAX = 32000;

// stringstream demo(str);  demo >> x;
// stringstream demo;  demo << x;  name=demo.str();

using namespace __gnu_pbds;
using namespace std;
typedef tree<ll,null_type,less<ll>,rb_tree_tag,tree_order_statistics_node_update> indexed_set;

int main()
{
        FastIO;
        //TxtTest;
        ll n,m,flag=0;
        string a,b,c,d;
        cin>>a>>b;
        c=a+b;
        d=b+a;
        stringstream demo(c);
        demo>>n;
        stringstream demu(d);
        demu>>m;
        double p;
        ll x;
        p=sqrt(n);
        x=sqrt(n);
        if(p-x==0.0) flag=1;
        p=sqrt(m);
        x=sqrt(m);
        if(p-x==0.0) flag=1;
        if(flag) cout<<"Yes"<<endl;
        else cout<<"No"<<endl;
        done;
}


Measured memory_bytes: 3552
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
const int INF = 1e9;
const ll LINF = 1e18;
inline ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }
inline ll lcm(ll a, ll b) { return a / gcd(a, b)*b; }
template<class S,class T> ostream& operator << (ostream& out,const pair<S,T>& o){ out << "(" << o.first << "," << o.second << ")"; return out; }
template<class T> ostream& operator << (ostream& out,const vector<T>& V){ for(int i = 0; i < V.size(); i++){ out << V[i]; if(i!=V.size()-1) out << " ";} return out; }
template<class T> ostream& operator << (ostream& out,const vector<vector<T> >& Mat){ for(int i = 0; i < Mat.size(); i++) { if(i != 0) out << endl; out << Mat[i];} return out; }
template<class S,class T> ostream& operator << (ostream& out,const map<S,T>& mp){ out << "{ "; for(auto it = mp.begin(); it != mp.end(); it++){ out << it->first << ":" << it->second; if(mp.size()-1 != distance(mp.begin(),it)) out << ", "; } out << " }"; return out; }
template<typename T>vector<T> make_v(size_t a){return vector<T>(a);}
template<typename T,typename... Ts>auto make_v(size_t a,Ts... ts){return vector<decltype(make_v<T>(ts...))>(a,make_v<T>(ts...));}
template<typename T,typename V> typename enable_if<is_class<T>::value==0>::type fill_v(T &t,const V &v){t=v;}
template<typename T,typename V> typename enable_if<is_class<T>::value!=0>::type fill_v(T &t,const V &v){for(auto &e:t) fill_v(e,v);}
/*
 <url:>
 問題文============================================================
 =================================================================
 解説=============================================================
 ================================================================
 */

template<class Type>
Type solve(Type res = Type()){
    ll N; cin >> N;
    vector<ll> H(N); for(auto& in:H) cin >> in;
    
    H[0]--;
    for(int i = 1; i < N;i++){
        if(H[i-1] < H[i]){
            H[i]--;
        }
        
        if(H[i-1] > H[i]){
            return "No";
        }
    }
    return "Yes";
    return res;
}
int main(void) {
    cin.tie(0); ios_base::sync_with_stdio(false);
    // solve(0);
    cout << fixed << setprecision(15) << solve<string>() << endl;
    return 0;
}


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

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

using namespace std;

signed main(){
  int a[5];
  cin>>a[0]>>a[1]>>a[2]>>a[3]>>a[4];
  /*
  rep(i,5){
    cout << a[i] << endl;
  }*/
  int sum = 0;
  int min_a = 10;
  int min_index = 0;
  rep(i,5){
    if(min_a>(a[i]%10) && (a[i]%10)!=0){
      min_a = a[i] % 10;
      min_index = i;
    }
  }
  //cout << min_index;
  int c;
  rep(i, 5){
    if(min_index!=i){
      if (a[i] % 10 == 0) {
        c = (a[i] / 10) * 10;
      } else {
        c = (a[i] / 10 + 1) * 10;
      }
        //cout << c << endl;
        sum += c;
        //cout << sum << endl;
      }
  }
  sum += a[min_index];
  cout << sum << endl;
  return 0;
}


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

int main(){
  int N; cin >>N;
  int p[N];
  int count = 0;
  for(int i=0;i<N;i++){
    cin >>p[i];
    if(i+1!=p[i]) count++;
  }

  if(count>2) cout << "NO" << endl;
  else cout << "YES" << endl;
  return 0;
}


Measured memory_bytes: 256
<?php

[$N] = fscanf(STDIN, "%d");
$A = fscanf(STDIN, str_repeat("%d", $N));
const MOD = 1000000007;
$sum = [];
$sum[$N] = 0;
for($i = $N-1; $i>0;$i--){
    $sum[$i] = ($sum[$i+1] + $A[$i]) % MOD;
}
$ans = 0;
foreach($A as $key => $value){
    $ans += ($value * $sum[$key+1]) % MOD;
    $ans %= MOD;
}
echo $ans;

Measured memory_bytes: 35024
#include <string>
#include <vector>
#include <algorithm>
#include <numeric>
#include <set>
#include <map>
#include <queue>
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cmath>
#include <ctime>
#include <cstring>
#include <cctype>
#include <cassert>
#include <limits>
#include <functional>
#include <iomanip>
#include <complex>
#define rep(i,n) for(int (i)=0;(i)<(int)(n);++(i))
#define rer(i,l,u) for(int (i)=(int)(l);(i)<=(int)(u);++(i))
#define reu(i,l,u) for(int (i)=(int)(l);(i)<(int)(u);++(i))
#if defined(_MSC_VER) || __cplusplus > 199711L
#define aut(r,v) auto r = (v)
#else
#define aut(r,v) __typeof(v) r = (v)
#endif
#define each(it,o) for(aut(it, (o).begin()); it != (o).end(); ++ it)
#define all(o) (o).begin(), (o).end()
#define pb(x) push_back(x)
#define mp(x,y) make_pair((x),(y))
#define mset(m,v) memset(m,v,sizeof(m))
#define INF 0x3f3f3f3f
#define INFL 10000000000000000
using namespace std;
typedef vector<int> vi; typedef pair<int, int> pii; typedef vector<pair<int, int> > vpii; typedef long long ll;
template<typename T, typename U> inline void amin(T &x, U y) { if(y < x) x = y; }
template<typename T, typename U> inline void amax(T &x, U y) { if(x < y) x = y; }
typedef complex<double> P;
long long int MOD = 1000000007;
#define SIZE 1000000
string mp[505],ans1[505],ans2[505];
int main(){
	int h,w;
	cin>>h>>w;
	for(int i=0;i<h;i++){
		cin>>mp[i];
	}
	for(int i=0;i<h;i++){
		if(i%2==0){
			for(int j=0;j<w-1;j++)ans1[i]+='#';
		}else{
			ans1[i]+='#';
			for(int j=1;j<w-1;j++)ans1[i]+='.';
		}
		ans1[i]+='.';
	}
	
	for(int i=0;i<h;i++){
		ans2[i]+='.';
		if(i%2==1){
			for(int j=0;j<w-1;j++)ans2[i]+='#';
		}else{
			for(int j=1;j<w-1;j++)ans2[i]+='.';
			ans2[i]+='#';
		}
	}
	for(int i=0;i<h;i++){
		for(int j=0;j<w;j++){
			if(mp[i][j]=='#')ans1[i][j]='#',ans2[i][j]='#';
		}
	}
	rep(i,h)cout<<ans1[i]<<endl;
	cout<<endl;
	rep(i,h)cout<<ans2[i]<<endl;
}
	


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


int main() {
  int n;
  cin >> n;
  vector<int> d(n + 1);
  for (int i = 0; i < n; i++) {
    cin >> d.at(i);
  }
  d.at(n) = 0;
  sort(d.begin(), d.end());
  int count = 0;
  for (int i = 0; i < n; i++) {
    if (d.at(i) == d.at(i + 1)) {
      continue;
    }
    else {
      count++;
    }
  }
  cout << count << endl;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
#define fios ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define DEBUG(x) cout << '>' << #x << ':' << x << endl;
typedef long long ll;
#ifdef LOCAL
mt19937 rng(unsigned(70));
#else
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
#endif
#define rand rng
#define M_PI       3.14159265358979323846


int main() {
	// fios;
	int a, b , h, m;
	cin >> a >> b>> h >> m;
	double hr = .5 * (h * 60 + m);
	double mn = 6 * m;
	double ang = fabs(hr - mn);	
	ang = fmin(360 - ang, ang);
	cout << fixed << setprecision(20);
	cout << sqrt(a * a + b * b - 2 * a * b * cos(ang * M_PI / 180.0)) <<endl;	

}

Measured memory_bytes: 4248
import java.io.*;
import java.util.*;

class Helper {
	ArrayList<Integer> elems;
	public Helper(ArrayList<Integer> elements) {
		this.elems = elements;
	}
	public void makeCanList(ArrayList<Integer> cans) {
		for (int ei = 0; ei < elems.size(); ++ei) {
			int elem = elems.get(ei);
			int size = cans.size();
			for (int li = 0; li < size; ++li) {
				int can = cans.get(li);
				cans.add(can + elem);
			}
			cans.add(elem);
		}
	}
}

public class Main {
	ArrayList<Integer> A;
	ArrayList<Integer> M;
	public static void main(String[] args) {
		StringBuilder ans = new StringBuilder();
		Main m = new Main();
		m.input();
		Helper helper = new Helper(m.A);
		ArrayList<Integer> cans = new ArrayList<>();
		helper.makeCanList(cans);
		for (int i = 0; i < m.M.size(); ++i) {
			int x = m.M.get(i);
			boolean has = cans.contains(x);
			if (has) {
				ans.append("yes" + "\n");
			} else {
				ans.append("no" + "\n");
			}
		}
		ans.deleteCharAt(ans.length() - 1);
		System.out.println(ans.toString());
	}
	public void input() {
		try {
                        BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
                        int n = Integer.parseInt(reader.readLine());
                        A = new ArrayList<>();
                        StringTokenizer stA = new StringTokenizer(reader.readLine());
                        while (stA.hasMoreTokens())
                                A.add(Integer.parseInt(stA.nextToken()));
                        int q = Integer.parseInt(reader.readLine());
                        M = new ArrayList<>();
                        StringTokenizer stM = new StringTokenizer(reader.readLine());
                        while (stM.hasMoreTokens())
                                M.add(Integer.parseInt(stM.nextToken()));
                } catch (Exception e) {
                        e.printStackTrace();
                }
	}
}


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

typedef long long ll; 
typedef pair<int, int> pii; 
typedef pair<ll, ll> pll; 
typedef pair<string, string> pss; 
typedef vector<int> vi; 
typedef vector<vi> vvi; 
typedef vector<pii> vii; 
typedef vector<ll> vl; 
typedef vector<vl> vvl; 

double EPS=1e-9; 
int INF=1000000005; 
long long INFF=1000000000000000005ll; 
double PI=acos(-1); 
int dirx[8]={ -1, 0, 0, 1, -1, -1, 1, 1 }; 
int diry[8]={ 0, 1, -1, 0, -1, 1, -1, 1 }; 
const ll MOD = 1000000007;

#define DEBUG fprintf(stderr, "====TESTING====\n") 
#define VALUE(x) cerr << "The value of " << #x << " is " << x << endl 
#define OUT(x) cout << x << endl 
#define debug(...) fprintf(stderr, __VA_ARGS__) 
#define READ(x) for(auto &(z):x) cin >> z;
#define FOR(a, b, c) for (int(a)=(b); (a) < (c); ++(a)) 
#define FORN(a, b, c) for (int(a)=(b); (a) <= (c); ++(a)) 
#define FORD(a, b, c) for (int(a)=(b); (a) >= (c); --(a)) 
#define FORSQ(a, b, c) for (int(a)=(b); (a) * (a) <= (c); ++(a)) 
#define FORC(a, b, c) for (char(a)=(b); (a) <= (c); ++(a)) 
#define EACH(a, b) for (auto&(a) : (b)) 
#define REP(i, n) FOR(i, 0, n) 
#define REPN(i, n) FORN(i, 1, n) 
#define MAX(a, b) a=max(a, b) 
#define MIN(a, b) a=min(a, b) 
#define SQR(x) ((ll)(x) * (x)) 
#define RESET(a, b) memset(a, b, sizeof(a)) 
#define fi first 
#define se second 
#define mp make_pair 
#define pb push_back 
#define ALL(v) v.begin(), v.end() 
#define ALLA(arr, sz) arr, arr + sz 
#define SIZE(v) (int)v.size() 
#define SORT(v) sort(ALL(v)) 
#define REVERSE(v) reverse(ALL(v)) 
#define SORTA(arr, sz) sort(ALLA(arr, sz)) 
#define REVERSEA(arr, sz) reverse(ALLA(arr, sz)) 
#define PERMUTE next_permutation 
#define TC(t) while (t--) 
#define FAST_INP  ios_base::sync_with_stdio(false);cin.tie(NULL)


void solve() {

}

int main()  
{ 
    FAST_INP;
//    #ifndef ONLINE_JUDGE
//    freopen("input.txt","r", stdin);
//    freopen("output.txt","w", stdout);
//    #endif
//    
//    int tc; cin >> tc;
//    TC(tc) solve();
	int d,t,s;
	cin >> d >> t >> s;
	if(d<=s*t) OUT("Yes");
	else OUT("No");
    return 0; 
} 

Measured memory_bytes: 3620
#include <iostream>
#include <utility>
#include <string>
#include <algorithm>
#include <map>
#include <vector>
#include <climits>
#include <numeric>
using namespace std;
signed main()
{
	ios::sync_with_stdio(false);
	int n;
	int a[200004];
	cin >> n;
	int tmp;
	for (int i = 0; i < n; i++) {
		cin >> tmp;
		a[i] = tmp - i - 1;
	}
	sort(a, a + n);
	int b = a[n / 2];
	long long ans = 0;
	for (int i = 0; i < n; i++) {
		ans += abs(a[i] - b);
	}
	cout << ans;
}

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

int n, W, v, w;
int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	
	cin >> n >> W;
	int dp[W+1] = {0};
	for (int i = 0; i < n; ++i) {
		cin >> v >> w;
		for (int j = w; j <=W; ++j) {
			dp[j] = max(dp[j], dp[j-w]+v);
		}
	}
	cout << dp[W] << "\n";
}

Measured memory_bytes: 3212
#include<stdio.h>
int main(){
	int i,j,n,s[2]={0};
	for(i=0;i<2;i++){
		for(j=0;j<4;j++){scanf("%d",&n);s[i]+=n;}
	}
	printf("%d\n",s[1]>s[0]?s[1]:s[0]);
	exit(0);
}

Measured memory_bytes: 0
//Code By CXY07
#include<bits/stdc++.h>
using namespace std;

//#define int long long

const int MAXN = 2e5 + 10;
const int INF = 2e9;
const int mod = 1e9 + 7;

int k,n,a[MAXN],ans;

signed main () {
	cin >> k >> n;
	for(register int i = 1;i <= n; ++i) {
		cin >> a[i];
		ans = max(ans,a[i] - a[i - 1]);
	}
	ans = max(ans,k + a[1] - a[n]);
	cout << k - ans << endl;
	return 0;
}

Measured memory_bytes: 1152
n,m = map(int,input().split())
x = list(map(int,input().split()))
y = list(map(int,input().split()))
mod = 10**9+7

a, b = 0, 0
for i in range(n):
    a += x[i]*i - x[i]*(n-i-1)
for i in range(m):
    b += y[i]*i - y[i]*(m-i-1)

print(a * b % mod)

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

using namespace std;

int find(vector<int>& parent, int a) {
	if (parent[a] == -1) return a;
	else return parent[a] = find(parent, parent[a]);
}

void un(vector<int>& parent, vector<int>& rank, int a, int b) {
	int x = find(parent, a);
	int y = find(parent, b);

	if (x != y) {
		if (rank[x] < rank[y]) {
			swap(rank[x], rank[y]);
		}
		rank[x] += rank[y];
		parent[y] = x;
	}
}

void check(vector<int>& parent,vector<int>& res, int a, int b) {
	int x = find(parent, a);
	int y = find(parent, b);

	if (x == y) {
		res[a]--;
		res[b]--;

	}
}

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

	vector<vector<int>> graph(n);
	vector<int> parent(n, -1);
	vector<int> rank(n, 1);

	for (int i = 0; i < m; i++) {
		int from, to;
		cin >> from >> to;
		from--, to--;
		graph[from].push_back(to);
		graph[to].push_back(from);
		un(parent,rank, from, to);
	}

	vector<int> res(n);

	for (int i = 0; i < k; i++) {
		int from, to;
		cin >> from >> to;
		from--, to--;
		check(parent, res, from, to);
	}

	for (int i = 0; i < n; i++) {
		int pr = find(parent, i);
		int componentElements = rank[pr];
		int neighbours = graph[i].size();
		res[i] += componentElements - neighbours - 1;
		cout << res[i] << " ";
	}


}

Measured memory_bytes: 8440
#include <iostream>
#include<stdio.h>
#include<vector>
#include<algorithm>
#include<string>
#include <set>
#include <numeric>
#include<math.h>
#include<queue>
#include<unordered_map>
#include<cmath>
#define ll long long int
#define fo(i,n) for(ll i=0;i<n;i++)
#define fo1(i,n) for(ll i=1;i<=n;i++)
#define pi (double)3.14159265359
#define vect vector <ll>
#define pb push_back
using namespace std;

void solve() {
	ll n,sum=0;
	cin >> n;
	vect c(100005, 0);
	vect v(n + 1);
	fo(i, n) {
		cin >> v[i];
		c[v[i]]++;
		sum += v[i];
	}
	ll q,a,b,s=sum;
	cin >> q;
	while (q--) {
		cin >> a >> b;
		s = s - c[a] * a;
		s = s + c[a] * b;
		cout << s << endl;
		c[b] += c[a];
		c[a] = 0;
	}
}
int main(){
	solve();
	return 0;
}


Measured memory_bytes: 4816
#include <stdio.h>
int main() {
  int N,i;
  scanf("%d", &N);
  long long int A[100005],B[100005];
  long long int max=0;
  for(i=0;i<N+1;i++){
    scanf("%lld", &A[i]);
  }
  for(i=0;i<N;i++){
    scanf("%lld", &B[i]);
  }
  
  for(i=0;i<N;i++){
    if(B[i]>=A[i]){
      max+=A[i];
      B[i]-=A[i];
      //A[i]=0;
      
      if(B[i]>=A[i+1]){
	max+=A[i+1];
	//B[i]-=A[i+1];
	A[i+1]=0;
      }
      else{
	max+=B[i];
	//B[i]=0;
	A[i+1]-=B[i];
      }
    }
    else{
      max+=B[i];
      //B[i]=0;
      //A[i]-=B[i];
    }

  }
  printf("%lld\n",max);  
  return 0;
}


Measured memory_bytes: 1664
#include <bits/stdc++.h>
    using namespace std;
     
    int main() {
      // ここにプログラムを追記
      string a,b,c;
      cin >> a >> b >> c;
      cout << a.at(0) << b.at(1) << c.at(2) << endl;
      return 0;
      
      
    }

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

int main() {
  int A,B,C;
  cin >> A >> B >> C;
  if (C <= A + B) {
    cout << C + B << endl;
  }
  else if (C == A + B) {
    cout << B + A + B << endl;
  }
  else if (C > A + B) {
    cout << B + A + B + 1 << endl;
  }
}

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

using namespace std;
typedef long long int ll;
typedef pair<int, int> ii;
#define DEBUG freopen("in.txt", "r", stdin);

struct fastio {
    fastio() {
        ios::sync_with_stdio(false);
        cout << setprecision(10) << fixed;
        cin.tie(0);
    }
};

fastio _fast_io;

const int N = 55;
int n, m, a, b;
int CNT[N];

int main() {
    cin >> n >> m;
    for (int i = 0; i < m; ++i) {
        cin >> a >> b;
        CNT[a]++;
        CNT[b]++;
    }
    for (int i = 1; i <= n; ++i) {
        cout << CNT[i] << endl;
    }
    return 0;
}


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

int main(){
  
  long long x;
  cin>>x;
  long long dep = 100;
  int count = 0;
  for(int i=1;;i++){
    dep = (dep + dep/100);
	count += 1;
    if(dep >= x)
      break;
  }
  cout<<count<<endl;
  
  
  
 return 0; 
  
}


Measured memory_bytes: 3632
#pragma comment(linker,"/STACK:1024000000,1024000000")
//std::ios::sync_with_stdio(false)
#include<iostream>
#include<cstdio>
#include<cstring>
#include<string>
#include<cmath>
#include<algorithm>
#include<map>
#include<queue>
#include<deque>
#include<stack>
#include<set>
#define INF 0X3F3F3F3F
#define MOD 2147493647
#define egs 1e-30
#define LL long long
#define SC(x) scanf("%d",&x)
#define SCC(x,y) scanf("%d%d",&x,&y)
#define SCCC(x,y,z) scanf("%d%d%d",&x,&y,&z)
#define FF(i,a,b) for(int i=a; i<=b; i++)
#define RR(i,a,b) for(int i=a; i>=b; i--)
#define FC(i,a,b) for(int i=a; i<b; i++)
#define SS(x) scanf("%s",x)
#define PR(x) printf("%d\n",x)
#define PRR(x,y) printf("%d %d\n",x,y)
#define CL(a,x) memset(a,x,sizeof(a))
#define MID int mid=((l+r)>>1)
#define lson x<<1,l,mid
#define rson x<<1|1,mid+1,r
#define root int x,int l,int r
#define F(x) ((x)/3+((x)%3==1?0:tb))
#define G(x) ((x)<tb?(x)*3+1:((x)-tb)*3+2)
#define f first
#define s second
#define MP make_pair
#define PB push_back
#define all(x) x.begin(),x.end()
#define IN freopen("in.txt","r",stdin)
#define OUT freopen("out.txt","w",stdout)
#define MAIN 1000010
#define MAXN 1010
using namespace std;
int main()
{
    long long a,b,c;
    int k;
    while(cin>>a>>b>>c>>k)
    {
        long long maxx=max(a,max(b,c));
        long long ans=a+b+c;
        if(a==maxx) ans-=a;
        else if(b==maxx) ans-=b;
        else ans-=c;
        for(int i=1; i<=k; i++) maxx*=2;
        cout<<ans+maxx<<endl;
    }
    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
typedef long long ll;
ll n,a,b,c,d;
bool solve() {
	scanf("%lld%lld%lld%lld%lld",&n,&a,&b,&c,&d);
	--n;a=b-a;
	for(int i=0;i<=n;++i) {
		if(c*i-d*(n-i)<=a&&a<=d*i-c*(n-i)) return true;
	}
	return false;
}
int main() {
	puts(solve()?"YES":"NO");
	return 0;
}

Measured memory_bytes: 128
use proconio::{fastout, input};
#[allow(unused_mut)]
#[fastout]
fn main() {
    input! {
        k: usize
    }
    let mut before = 7 % k;
    if before == 0 {
        println!("{}", 1);
        return;
    }
    for i in 1..k {
        before = (before * 10 + 7) % k;
        if before == 0 {
            println!("{}", i + 1);
            return;
        }
    }
    println!("-1");
}


Measured memory_bytes: 2156
#include <algorithm>
#include <array>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <map>
#include <memory>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <sstream>
#include <unordered_map>
#include <vector>


#define INF 4000000000000000000LL
#define MOD 1000000007
#define ALL(x) std::begin(x), std::end(x)


int main(int argc, char** argv)
{
  std::cin.tie(0);
  std::ios_base::sync_with_stdio(0);

  std::cout << std::fixed << std::setprecision(6);

  int A, B, C;

  std::cin >> A >> B >> C;

  if (A != B && A != C) {
    std::cout << A << std::endl;
  }
  else if (B != C && B != A) {
    std::cout << B << std::endl;
  }
  else {
    std::cout << C << std::endl;
  }

  return 0;
}


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


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

    std::vector<int> v(n), r(n);
    for (int i = 0; i < n; i++) {
        std::cin >> v[i];
    }

    for (int i = 0; i < n; i++) {
        r[v[i] - 1] = i + 1;
    }

    for (int i = 1; i <= n; i++) {
        std::cout << 30000 * i;
        if(i != n) std::cout << " ";
    }
    std::cout << std::endl;
    for (int i = 1; i <= n; i++) {
        std::cout << 30000 * (n - i) + r[i - 1];
        if (i != n) std::cout << " ";
    }
    std::cout << std::endl;
    return 0;
}

Measured memory_bytes: 768
#include <bits/stdc++.h>
using namespace std;
int main()
{
	long long a,b,p;
	cin>>a>>b;
	long long c=a*b;
	if(b>a)
	  swap(a,b);
	do{
		p=a%b;
		a=b;
		b=p;
	}while(p!=0);
	cout<<c/a;
	return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int count = 0;
		while(n>0) {
			count += n%10;
			n/=10;
		}
		System.out.println(count==1? 10 : count);
	}

}


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

int main () {
  int n, m, c;
  cin >> n >> m >> c;
  vector<int> b(m);
  rep(i,m) cin >> b[i];

  int res = 0;
  rep(i,n) {
    int sum = c;
    rep(j,m) {
      int a;
      cin >> a;
      sum += a*b[j];
    }
    if(sum > 0) res += 1;
  }

  cout << res << endl;

  return 0;
}


Measured memory_bytes: 256
s=input()
ans=0
if s[0]!='A':
    print("WA")
    exit()
for i in range(1,int(len(s))):
    if s[i].isupper():
        if i==1 or i==int(len(s))-1 or s[i]!='C':
            print("WA")
            exit()
        ans+=1
if ans !=1:
    print("WA")
    exit()
print("AC")

Measured memory_bytes: 61868
#include <cstdio>
#include <utility>
#include <vector>

using namespace std;

vector<pair<int, int>> w[19];

int main() {
  int n;
  scanf("%d", &n);
  for (int i = 0; i < n; ++i) {
    w[i].clear();
    int m;
    scanf("%d", &m);
    while (m--) {
      int x, y;
      scanf("%d%d", &x, &y);
      --x;
      w[i].emplace_back(x, y);
    }
  }
  int ans = 0;
  for (int i = 1; i < (1 << n); ++i) {
    bool ok = true;
    for (int j = 0; j < n; ++j) {
      if (i >> j & 1) {
        for (auto &e : w[j]) {
          if (i >> e.first & 1) {
            if (e.second == 0) {
              ok = false;
            }
          } else {
            if (e.second == 1) {
              ok = false;
            }
          }
        }
      }
    }
    if (!ok) {
      continue;
    }
    int cnt = 0;
    for (int j = 0; j < n; ++j) {
      if (i >> j & 1) {
        ++cnt;
      }
    }
    if (cnt > ans) {
      ans = cnt;
    }
  }
  printf("%d\n", ans);
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
long long a[100005];
long long s=0,b=0;

int main()
{
	int n,x;
	cin>>n>>x;
	for(int i=1;i<=n;i++)
		cin>>a[i];
	for(int i=1;i<=n;i++)
		if(b+a[i]>x) {
			s+=b+a[i]-x;
			b=a[i]-(b+a[i]-x);
		}
		else b=a[i];
	cout<<s<<endl;
}

Measured memory_bytes: 1024
INF = float('inf')

H, N = map(int, input().split())
A = []
B = []
for _ in range(N):
    a, b = map(int, input().split())
    A.append(a)
    B.append(b)


# i個目までを使って与えた魔力の総和がjの時の最小コスト
dp = [[INF for j in range(H + 1)] for i in range(N + 1)]

dp[0][0] = 0

for i in range(N):
    for j in range(H + 1):
        if j < A[i]:
            dp[i + 1][j] = min(dp[i][j], dp[i + 1][0] + B[i])
        else:
            dp[i + 1][j] = min(dp[i][j], dp[i + 1][j - A[i]] + B[i])

print(dp[N][H])


Measured memory_bytes: 294024
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<unordered_map>
#include<set>
#include<unordered_set>
#include<numeric>
#include<algorithm>
#include<tuple>
#include<cmath>
#include <iomanip>

typedef unsigned long long ull;
typedef long long ll;

ll DENOM = 1000000000LL + 7LL;
using namespace std;

ll n, k;

int main(){
    cin >> n >>k;
    vector<ll> a(n);
    for (int i=0; i<n; ++i){
        cin >> a[i];
        a[i] -= 1;
    }
    vector<ll> fa(n, -1) ;
    fa[0] = 0;
    ll nxt = 0;
    ll ctr = 0;
    for (int i=0; i<n; ++i){
        nxt = a[nxt];
        ctr++;
        if (fa[nxt] != -1){
            break;
        }
        fa[nxt] = ctr;
    }
    ll kp;
    if (k < fa[nxt]){
        kp = k;
    }else{
        ll prod = ctr - fa[nxt];
        kp = (k - fa[nxt]) % prod + fa[nxt] ;
    }
    nxt = 0;
    for (int i=0; i<kp; ++i){
        nxt = a[nxt];
    }
    cout << nxt+1 << endl;
    return 0;
}

Measured memory_bytes: 5996
N=int(input())
F = []
for _ in range(N):
    s = input().split()
    F.append(int("".join(s), base=2))
P = [list(map(int, input().split())) for _ in range(N)]
ans = -float("inf")
for bit in range(1, 2**10):
    gain = 0
    for i in range(N):
        ci = 0
        for j in range(10):
            if ((bit>>j) & 1) and ((F[i]>>j) & 1):
                ci += 1
        gain += P[i][ci]
    ans = max(ans, gain)
print(ans)

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

int main(){
    int A, B, C;

    //input
    cin >> A >> B >> C;

    //output
    if(A == B && B == C){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }

    return 0;
}


Measured memory_bytes: 256
<?php
    fscanf(STDIN,"%d",$N);
    fscanf(STDIN,"%s",$S);

    // $list_a = explode(" ", trim(fgets(STDIN)));



    for($i=0;$i<strlen($S);$i++){
        $jyushin = ord($S[$i]);
        if($jyushin+$N > 90){
            $S[$i]= chr(65+$N+$jyushin-90-1);
        }else{
            $S[$i] = chr($jyushin+$N);
        }
    }

    echo $S."\n";
    


Measured memory_bytes: 4604
#include<iostream>
using namespace std;
typedef long long ll;

int main(){
    ll h, w;
    cin >> h >> w;
    ll tmp = (w+1)/2;
    if(h == 1 || w == 1){
        cout << 1 << endl;
        return 0;
    }
    cout << h/2*w+(h%2)*tmp << endl;
    return 0;
}

Measured memory_bytes: 256
#pragma GCC optimize("Ofast")
#include<stdio.h>
int main(void)
{
    int n = 5;
    int a[7] = {0};
    char c=getchar_unlocked();
    while(c<='9'&&c>='0') {a[--n] = c - '0'; c=getchar_unlocked();}
    int v = (a[n+2] << 2) + (a[n+2] << 5) + (a[n+2] << 6) + (a[n+1] << 3) + (a[n+1] << 1) + a[n];
    if(v) {
        printf("%d", 1000 - v);
        return 0;
    }
    puts("0");
    return 0;
}


Measured memory_bytes: 1600
#include <iostream>

int main(){
	int n,a,b,c,d,i;
	while(std::cin>>n&&n){
	i=0;
	for(a=0;a<10;++a){
		for(b=0;b<10;++b){
			for(c=0;c<10;++c){
				for(d=0;d<10;++d){
					if(a+b+c+d==n)
						i++;
					}
				}
			}
		}
		std::cout<<i<<std::endl;
		}
	 return 0;
	}

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

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

typedef struct pp{
    char name[100];
    int t;
} P;

P Q[LEN+1];
int head, tail, n;

void enqueue(P x){
    Q[tail] = x;
    tail = (tail + 1) % LEN;
}

P dequeue(){
    P x = Q[head];
    head = (head + 1) % LEN;
    return x;
}

int min(int a, int b){ return a < b ? a : b;}

int main(){
  int elaps = 0, c;
  int i, q;
  P u;
  scanf("%d %d", &n, &q);

  for ( i = 1; i <= n; i++){
    scanf("%s", Q[i].name);
    scanf("%d", &Q[i].t);
  }
  head = 1; tail = n+1;

  while ( head != tail ){
      u = dequeue();
      c = min(q, u.t);
      u.t -= c;
      elaps += c;
      if ( u.t > 0 ) enqueue(u);
      else{
          printf("%s %d\n",u.name, elaps);
      }
  }

  
  return 0;
}


Measured memory_bytes: 13304
#include <bits/stdc++.h>
using namespace std;
int main() {
	int N, Q, a, b;
	cin >> N >> Q;
	vector<vector<int>> branch(N);
	vector<int> score(N), searched(N);
	//木を生やす
	for (size_t i = 0; i < N - 1; i++)
	{
		cin >> a >> b;
		a--;
		b--;
		branch.at(a).push_back(b);
		branch.at(b).push_back(a);
	}
	//スコアを足しておく
	for (size_t i = 0; i < Q; i++)
	{
		cin >> a >> b;
		a--;
		score.at(a) += b;
	}
	//bfs
	queue<int> que;
	que.push(0);
	searched.at(0) = 1;
	while (!que.empty()) {
		for (size_t i = 0; i < branch.at(que.front()).size(); i++)
		{
			if (searched.at(branch.at(que.front()).at(i))==0)
			{
				que.push(branch.at(que.front()).at(i));
				//if (que.front() == 1&& branch.at(que.front()).at(i)==3)cout << "chk";
				//cout << score.at(que.front())<<"was added to"<< score.at(branch.at(que.front()).at(i));
				score.at(branch.at(que.front()).at(i)) += score.at(que.front());
				searched.at(branch.at(que.front()).at(i))++;
			}
		}
		que.pop();
	}
	for (size_t i = 0; i < N; i++)
	{
		cout << score.at(i) << endl;
	}
}

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

int main() {
    int n;
    cin >> n;
    string s = "APPROVED";
    vector<int> a(n);
    for(int i=0;i<n;i++){
        cin >> a.at(i);
        if(a.at(i)%2==0&&(a.at(i)%3!=0&&a.at(i)%5!=0)){
            s="DENIED";
        }
    }
    cout << s << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <list>
#include <algorithm>
using namespace std;
int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);

    int n; cin >> n;
    list<int> li;

    int key;
    list<int>::iterator pos;

    for (int i=0; i<n; ++i) {
        string op; cin >> op;
        if (op[0] == 'i') {
            cin >> key;
            li.push_front(key);
        } else if (op.size() > 6 && op[6] == 'F') {
            li.pop_front();
        } else if (op.size() > 6 && op[6] == 'L') {
            li.pop_back();
        } else {
            cin >> key;
            pos = find(li.begin(), li.end(), key);
            if (pos != li.end()) {
                li.erase(pos);
            }
        }
    }

    for (list<int>::iterator it = li.begin(); it != li.end(); ++it) {
        cout << ((it == li.begin()) ? "" : " ") << *it;
    }
    cout << endl;
    return 0;
}

Measured memory_bytes: 32472
N=int(input())
XY=[tuple(map(int, input().split())) for _ in range(N)]

from math import sqrt
def dist(a,b):
    return sqrt((a[0]-b[0])**2 + (a[1]-b[1])**2)
from itertools import permutations
a=b=0
for p in permutations(range(N)):
    b+=1
    for i in range(N-1):
        a+=dist(XY[p[i]], XY[p[i+1]])
print(a/b)

Measured memory_bytes: 40684
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <cmath>
#include <queue>
#include <stack>
#include <cstdlib>
#include <map>
#include <iomanip>
#include <set>
#include <stdio.h>
#include <ctype.h>
using namespace std;
#define pie 3.141592653589793238462643383279
#define mod 1000000007
#define INF 1145141919364364
#define int long long
#define all(vec) vec.begin(),vec.end()
#define P pair<int,int>
#define S second
#define F first

int gcd(int x, int y) {
	if (y == 0)return x;
	return gcd(y, x%y);
}
int lcm(int x, int y) {
	return x / gcd(x, y)*y;
}
bool prime(int x) {
	for (int i = 2; i <= sqrt(x); i++) {
		if (x%i == 0)return false;
	}
	return true;
}
int kai(int x, int y) {
	int res = 1;
	for (int i = x - y + 1; i <= x; i++) {
		res *= i; res %= mod;
	}
	return res;
}
int mod_pow(int x, int y, int m) {
	int res = 1;
	while (y > 0) {
		if (y & 1) {
			res = res * x % m;
		}
		x = x * x % m;
		y >>= 1;
	}
	return res;
}
int comb(int x, int y) {
	if (y > x)return 0;
	return kai(x, y) * mod_pow(kai(y, y), mod - 2, mod) % mod;
}

string s;
bool a, b;

signed main() {
	cin >> s;
	for (int i = 0; i < 3; i++) {
		if (s[i] == 'A')a = true;
		else b = true;
	}
	if (a&&b)cout << "Yes" << endl;
	else cout << "No" << endl;
}

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

using namespace std;

int main()
{
	int t;
	t=1;
	while(t--)
	{
	
	char c;
	cin>>c;
	
	if(c>=65&&c<=90)
	cout<<"A";
	
	else
	cout<<"a";
	
	
	
	}



}


Measured memory_bytes: 3628
#include<stdio.h>
int main(void)
{
	int N,i;
	char a[101],b[101];
	scanf("%d\n",&N);
	for(i=0;i<N;i++)
	{
		if(i==N-1)
		scanf("%c ",&a[i]);
		else
		scanf("%c",&a[i]);
	}
	for(i=0;i<N;i++)
	{
		scanf("%c",&b[i]);
	}
	for(i=0;i<N;i++)
	{
		printf("%c",a[i]);
		printf("%c",b[i]);
	}
	return 0;
}

Measured memory_bytes: 128
N = int(input())
MOD = 10**9+7
memo = [{} for i in range(N+1)]

def ok(last4:str)->bool:
    for i in range(4):
        t = list(last4)
        if i>=1:
            t[i-1],t[i] = t[i],t[i-1]
        if ''.join(t).count("AGC") >= 1:
            return False
    return True

def dfs(cur, last3):
    if last3 in memo[cur]:
        return memo[cur][last3]
    if cur==N:
        return 1
    ret = 0
    for c in "AGCT":
        if ok(last3 + c):
            ret = (ret + dfs(cur+1, last3[1:] + c)) % MOD
    memo[cur][last3] = ret
    return ret

print(dfs(0, "TTT"))

Measured memory_bytes: 3848
using System;
using System.Linq;

namespace ProgramingStydying
{
    class Program
    {
        static void Main(string[] args)
        {
            var ny = Console.ReadLine().Split().Select(int.Parse).ToArray();
            var n = ny[0];
            var y = ny[1];

            var cost = y - 1000 * n;
            var a = -1;
            var b = -1;
            var c = -1;

            for(int i = 0; i <= n; i++)
            {
                if(cost < 0)
                {
                    break;
                }
                if(cost % 4000 == 0 && n - i - cost/4000 >= 0)
                {
                    a = i;
                    b = cost / 4000;
                    c = n - a - b;
                    break;
                }
                else
                {
                    cost -= 9000;
                }
            }

            Console.WriteLine(a + " " + b + " " + c);
        }
    }
}

Measured memory_bytes: 28304
#include <bits/stdc++.h>
#define rep(i, n) for(ll i = 0; i < n; ++i)
#define repR(i, n) for(ll i = n; i >= 0; ++i)
#define FDS(i, n) for(ll i = 0; i < n; ++i)
#define FDSR(i, n) for(ll i = n; i >= 0; ++i)
#define FOR(i, m, n) for(ll i = m; i < n; ++i)
#define FORR(i, m, n) for(ll i = m;i >= n;--i)
#define VSORT(v) sort(v.begin(), v.end());
#define VREV(v) reverse(v.begin(), v.end());
#define INF 999999999
#define itn ll
#define ednl endl
using namespace std;
typedef long long ll;template<typename Typell>Typell G_C_D(Typell a, Typell b){if (a < 0) a = -a;if (b < 0) b = -b;while (b != 0) {a %= b;if (a == 0) return b;b %= a;}return a;}template<typename Typell>
Typell G_C_D(const std::vector<Typell> &list){Typell a = list[0];for (size_t i = 1; i < list.size(); ++i) {a = G_C_D(a, list[i]);}return a;}template<typename Typell>Typell L_C_M(Typell a, Typell b) {if( a == 0 && b == 0)return 0;return a / G_C_D(a, b) * b;}
template<typename Typell>Typell L_C_M(const std::vector<Typell> &list){Typell a = list[0];for (size_t i = 1; i < list.size(); ++i) {a = L_C_M(a, list[i]);}return a;}

int main(){
	cin.tie(0);ios::sync_with_stdio(false);
	int X,A;
	cin>>X>>A;
	if(X<A)cout<<0<<endl;
	else cout<<10<<endl;
}

Measured memory_bytes: 256