akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#define mfill(x,y) memset(x,y,sizeof(x))
#define all(v) v.begin(), v.end()
#define in(x,y,h,w) if(0<=x&&x<h&&0<=y&&y<w)
#define y0 y12345
#define y1 y54321

#ifdef LOCAL
#define debug(...) fprintf(stderr,__VA_ARGS__)
#else
#define debug(...) 42
#endif

using ul = unsigned long;
using ll = long long;
using P = pair<int, int>;
using vint = vector<int>;using vvint = vector<vector<int>>;
using vll = vector<ll>;using vvll = vector<vector<ll>>;
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(a>b){a=b;return 1;}return 0;}
template <class T>void initvv(vector<vector<T> > &v, int a, int b, const T &t = T()){
    v.assign(a, vector<T>(b, t));
}
template <class T>T gcd(T &a, T &b){if(a<b){swap(a,b);} T r = a%b; while(r!=0){a=b;b=r;r=a%b;} return b;}

vint dx = {-1, 0, 1, 0}, dy = {0, -1, 0, 1};
vint dx8 = {-1, -1, -1, 0, 1, 1, 1, 0}, dy8 = {-1, 0, 1, 1, 1, 0, -1, -1};

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    debug("debug test\n");
    int n,m;cin>>n;
    vector<double> v(n);
    rep(i, n){
        cin>>v[i];
    }
    sort(all(v));
    double ans = 0;
    ans += v[0]/pow(2.0, n-1);
    ans += v[1]/pow(2.0, n-1);
    for(int i = 2;i < n;i++){
        ans += v[i]/pow(2.0, n-i);
    }
    printf("%.9f\n", ans);
    return 0;
}


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



int main() {
  string S;
  ll K;
  cin >>S >> K;
  rep(i,K){
  if (S[i] != '1'){
      cout << S[i] << endl;
      return 0;
    }
  
  }
  
  cout << 1 << endl;



  return 0;
}








Measured memory_bytes: 3588
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <sstream>
#include <cstring>
#include <cstdlib>
#include <cstdio>
#include <cmath>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <bitset>
 
#define rep(i, n) for(int i = 0; i < (n); i++)
#define FOR(i, a, b) for(int i = (a); i < (b); i++)
#define all(v) (v).begin(), (v).end()
#define rev(s) (s).rbegin(), (s).rend()
#define MP make_pair
#define X first
#define Y second
 
using namespace std;
 
typedef long long ll;
typedef pair<int, int> P;
typedef vector<int> vi;

void fin(){
	freopen("test.txt", "r", stdin);
}

int main(){
	int n;
	while(cin >> n, n){
		vector<pair<int, int> > v;
		int start = -1;
		int end = -1;
		rep(i, n){
			int p;
			cin >> p;
			if(start == -1){
				start = end = p;
				continue;
			}
			if(end + 1 != p){
				v.push_back(MP(start, end));
				start = p;
			}
			end = p;
		}
		v.push_back(MP(start, end));

		rep(i, v.size()){
			cout << (i?" ":"");
			if(v[i].X == v[i].Y) cout << v[i].X;
			else cout << v[i].X << '-' << v[i].Y;
		}
		cout << endl;
	}

	return 0;
}

Measured memory_bytes: 1204
#include <bits/stdc++.h>
using namespace std;
int main() {
  int N; cin >> N;
  vector<vector<pair<int, bool>>> x(N, vector<pair<int, bool>> (0));
  for(int i = 0; i < N; i++) {
    int A; cin >> A;
    for(int j = 0; j < A; j++) {
      int X, Y;
      cin >> X >> Y; X--;
      x.at(i).push_back(make_pair(X, Y));
    }
  }
  int count = 0;
  for(int i = 0; i < (1 << N); i++) {
    bool judge = false;
    bitset<15> board(i);
    for(int j = 0; j < N; j++) {
      if(board.test(j)) {
        for(int k = 0; k < x.at(j).size(); k++) {
          if(board.test(x.at(j).at(k).first) != x.at(j).at(k).second) {
            judge = true;
            break;
          }
        }
        if(judge) break;
      }
      if(judge) break;
    }
    if(judge) continue;
    int c = board.count();
    count = max(count, c);
  }
  cout << count << endl;
}

Measured memory_bytes: 256
n = int(input())
lst = list(map(int, input().split()))
lst = sorted(lst)

res = 0
for i in range(n):
    s = i + 1
    e = i + 2
    while True:
        while e < n and lst[i] + lst[s] > lst[e]:
            res += 1
            e += 1
        if e >= n:
            res += (e - s - 1) * (e - s - 2) // 2
            break
        else:
            s += 1
            if e - s -1 > 0:
                res += e - s - 1
            if e == s:
                e += 1
print(res)

Measured memory_bytes: 3188
N,M=map(int,input().split())
ks=[list(map(int,input().split())) for i in range(M)]
p=list(map(int,input().split()))
ans=0
import numpy as np

for x in range(2**N):
  bin_str = format(x, '0{0}b'.format(N))
  X=np.array(list(map(int,list(bin_str))))
  flg=True
  for i in range(M):
    if sum(X[np.array(ks[i][1:])-1])%2 != p[i]:
      flg=False
      break
  if flg:
    ans+=1
print(ans)

Measured memory_bytes: 19408
#include<bits/stdc++.h>
using namespace std;
int main()
{
  long long int n;
  cin>>n;
  long long int i=sqrt(n);
  while(1)
  {
    if(n%i==0)
   	  break; 
   	i--;
  }
  cout<<i+n/i-2;
  return 0;
}
  

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    long long n,s=0,k;
    
    cin>>n>>k;
    long long a[n];
    if(n<=k)
      cout<<"0";
    else
     {for(int i=0;i<n;i++) 
         cin>>a[i];
      
    sort(a,a+n,greater<int>());
    
      for(int i=k;i<n;i++)
         s+=a[i];
    
      cout<<s;
        
    }
  return 0;
}
     
   




Measured memory_bytes: 5220
/// kazuki08
/*
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("O3")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize("unroll-loops")
*/
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
#define int long long
typedef long long ll;
typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update>ordered_set;
typedef long double ld;
typedef vector<int> vi;
typedef pair<int,int> pi;
typedef vector<pi> vpi;
#define ar array
//#define inf 1000000000
#define mod 1000000007
#define dmp(x) cerr<<"line "<<__LINE__<<" "<<#x<<":"<<x<<endl
#define fs first
#define sc second
#define pb push_back
#define all(c) (c).begin(),(c).end()
#define mt make_tuple
#define IOS ios::sync_with_stdio(0);cin.tie(0);cout.tie(0)
template<class S,class T> ostream& operator<<(ostream& o,const pair<S,T> &p){
    return o<<"("<<p.fs<<","<<p.sc<<")";
}
template<class T> ostream& operator<<(ostream& o,const vector<T> &vc){
    o<<"{";
    for(const T& v:vc) o<<v<<",";
    o<<"}";
    return o;
}
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

const int MAXN = 3010;
int n,m,k;
int dp[MAXN][MAXN][4],val[MAXN][MAXN];

signed main(){
IOS;
//freopen("input.txt", "r", stdin);
//freopen("output.txt", "w", stdout);
  
  cin >> n >> m >> k;
  for(int i=1;i<=k;i++){
    int x,y,v;
    cin >> x >> y >> v;
    val[x][y] = v;
  }
  dp[1][1][0]=0;
  dp[1][1][1]=val[1][1];
  for(int i=1;i<=n;i++){
    for(int j=1;j<=m;j++){
      for(int c=0;c<=3;c++){
        if(j+1<=m){
          dp[i][j+1][c] = max(dp[i][j+1][c],dp[i][j][c]);
          if(c<3){
            dp[i][j+1][c+1] = max(dp[i][j+1][c+1],dp[i][j][c]+val[i][j+1]);
          }
        }
        if(i+1<=n){
          dp[i+1][j][0] = max(dp[i+1][j][0],dp[i][j][c]);
          dp[i+1][j][1] = max(dp[i+1][j][1],dp[i][j][c]+val[i+1][j]);
        }
      }
    }
  }
  int ans = 0;
  for(int c = 0;c<=3;c++){
    ans = max(ans,dp[n][m][c]);
  }
  cout << ans << endl;

return 0;
}
///....


Measured memory_bytes: 356064
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>

using namespace std;

#define ll long long
const int N = 1e5+7;

int main(){
	int n;
	cin >> n;
	if(n % 2 == 0) cout << (n/2)*(n/2);
	else cout << (n/2+1)*(n/2);
} 
 

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <utility>
#include <algorithm>
#include <map>
#include <vector>
#include <cmath>
#include <cstdlib>
#include <queue>
#include <stack>

using namespace std;

#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = n;i >= m;i--)
#define REPO(i, n) for(int i = 1;i <= n;i++)
#define ll long long
#define INF 1999999999
#define MINF -1999999999
#define ALL(n) n.begin(),n.end()

int main() {
	int a;
	cin >> a;
	if (a % 2 == 1)cout << a * 2 << endl;
	else cout << a  <<endl;
}

Measured memory_bytes: 256
// C - Minimization
#include <bits/stdc++.h>
using namespace std;
#define lli long long int
#define uli unsigned long long int
#define rep(i, m, n) for (lli i = m; i < (n); i++)
#define repe(i, m, n) for (lli i = m; i <= (n); i++)
#define ALL(x) (x).begin(), (x).end()
#define SIZE(x) ((lli)(x).size())
#define MAX(x) *max_element(ALL(x))
#define MIN(x) *min_element(ALL(x))
#define _GLIBCXX_DEBUG
const lli INF = 2147483647;
const lli MINF = -2147483648;
const lli LINF = 9223372036854775807;
const lli MOD = 1000000007; //10^9+7
const double PI = acos(-1);
#define SORT(n) sort(n.begin(), n.end())
#define SORTR(n) sort(n.begin(), n.end(), greater<int>())
#define REV(n) reverse(n.begin(), n.end())
#define pb push_back
#define eb emplace_back
#define mp make_pair
#pragma GCC optimize("Ofast")
using vi = vector<int>;
using vvi = vector<vi>;
using vvvi = vector<vvi>;
using vlli = vector<lli>;
using vvli = vector<vlli>;
using vs = vector<string>;
using vvs = vector<vs>;
using vb = vector<bool>;
using vvb = vector<vb>;
using ll = long long;
// vector入力
template <typename T>
istream &operator>>(istream &is, vector<T> &vec)
{
  for (T &x : vec)
    is >> x;
  return is;
}
// vector出力
template <typename T>
ostream &operator<<(ostream &os, vector<T> &vec)
{
  // os << '{';
  for (int i = 0; i < vec.size(); i++)
  {
    os << vec[i] << (i + 1 == vec.size() ? "" : "");
  }
  // os << '}';
  return os;
}
// aよりもbが大きいならばaをbで更新する(更新されたならばtrueを返す)
template <typename T>
bool chmax(T &a, const T &b)
{
  if (a < b)
  {
    a = b; // aをbで更新
    return true;
  }
  return false;
}
// aよりもbが小さいならばaをbで更新する(更新されたならばtrueを返す)
template <typename T>
bool chmin(T &a, const T &b)
{
  if (a > b)
  {
    a = b; // aをbで更新
    return true;
  }
  return false;
}

int main()
{
  ios::sync_with_stdio(false);
  cin.tie(0);
  lli a, b, c, h, n, k, w, ans = 0, count = 1;
  string s, t;
  vector<pair<string, pair<lli, lli>>> pr;
  cin >> n >> k;
  a = k - 1;
  vlli d(n);
  rep(i, 0, n)
  {
    cin >> d[i];
  }
  n -= k;
  while (n > 0)
  {
    n -= a;
    count++;
  }
  cout << count << endl;
}

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

using namespace std;

#define int long long
#define endl '\n'
#define maxn 100010
const int MOD = 1000000007;

void solve() {
    int n, k;
    cin >> n >> k;

    vector<int> v(n + 1);
    for (int i = 0; i < k; i++) {
        int d;
        cin >> d;
        for (int j = 0; j < d; j++) {
            int a;
            cin >> a;
            v[a] = 1;
        }
    }
    int ans = 0;
    for (int i = 1; i <= n; i++) {
        if (!v[i])ans++;
    }
    cout << ans << endl;
}

int32_t main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);

    int t = 1;
//    cin >> t;

    while (t--)
        solve();
    return 0;
}

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

#define ll long long 
#define ld long double
#define fastio ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define vl vector<ll>
#define pb push_back
#define pll pair<ll,ll>
#define mp make_pair
#define ff first
#define ss second
#define rep(i,m,n) for(ll i=(m);i<(n);i++)
#define rem(i,m,n) for(ll i=(m);i>(n);i--) 

const ll INF = 1e+10;


void solve()
{
   vl v(5);
   ll k=-1;
   rep(i,0,5)
   {
       cin>>v[i];
       if(v[i]==0)
       {k=i+1;}
   }

   cout<<k<<"\n";
}


int main()
{
    fastio;
    ll t=1;
    //cin>>t;
    while(t--)
    {
        solve();
    }
    
    
    #ifndef ONLINE_JUDGE
    cout<<"\nTime Elapsed: " << 1.0*clock() / CLOCKS_PER_SEC << " sec\n";
    #endif


    return 0;
}



Measured memory_bytes: 3652
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) throws IOException {
        Scanner sc = new Scanner(System.in);
        //BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

        int N = sc.nextInt();
        int res = N * (N+1) / 2;
        System.out.println(res);
    }
}


Measured memory_bytes: 10068
#include <bits/stdc++.h>
#define PI 3.14159265359
#define NIL (-1)
#define LL long long
using namespace std;
const int64_t MOD = 1e9 + 7;

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

	int n = sqrt(X);
	int ans = n * n;

	for (int i = n - 1; i > 1; i--) {
		int m = 1;
		while (m <= X) {
			m *= i;
		}
		m /= i;
		ans = max(ans, m);
	}

	cout << ans << endl;
}

Measured memory_bytes: 3580
N, K = map(int, input().split())
num = [0 for _ in range(K)]
for i in range(1, N + 1):
    num[i % K] += 1
ans = 0
if K % 2 == 0:
    ans += num[0] ** 3 + num[K // 2] ** 3
else:
    ans += num[0] ** 3
print(ans)





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

void countingSort(int *a,int *b,int n,int k){
  int i,j;
  int c[k+1];
  for(i=0;i<=k;i++)c[i]=0;
  for(j=1;j<=n;j++)c[a[j]]++;
  for(i=1;i<=k;i++)c[i]=c[i]+c[i-1];
  for(j=n;j>=1;j--){
    b[c[a[j]]]=a[j];
    c[a[j]]--;
  }
}

int main(){
  int i,n,max=0;
  int *ar1,*ar2,*a,*b;
  
  scanf("%d",&n);
  ar1=(int *)malloc(n*sizeof(int)+1);
  ar2=(int *)malloc(n*sizeof(int)+1);
  a=ar1;
  b=ar2;

  for(i=1;i<n+1;i++){
    scanf("%d",a+i);
    if(*(a+i)>max)max=*(a+i);
  }
  countingSort(a,b,n,max);

  for(i=1;i<n;i++)printf("%d ",*(b+i));
  printf("%d\n",*(b+i));
  free(ar1);
  free(ar2);
  return 0;
}


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

typedef pair<int,int> P;
#define ll long long
#define ld long double
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define PI 3.14159265358979323846
#define sz(x) ((int)(x).size())
#define chmin(x,y) x = min(x,y)
#define chmax(x,y) x = max(x,y)

const int INF = 1e9;
const int MOD = 1e9 + 7;
const ll LINF = 1e18;

ll calc(ll a,ll b, ll x)
{
    return (a*x)/b-a*(x/b);
}

int main()
{
    ll a,b,n;
    cin >> a >> b >> n;
    ll x;
    if(n>=b-1)
    {
        x = b-1;
        cout << calc(a,b,x) << endl;
        return 0;
    }else
    {
        x = n;
        cout << calc(a,b,x) << endl;
        return 0;
    }
}

Measured memory_bytes: 3588
#include <iostream>
#include<string>
#include<map>
#include<iostream>
#include<math.h>
#include<vector>
#include<algorithm>
#include <time.h>
#include<limits.h>
#include<unordered_map>
#include <set>
using namespace std;
const long long m = 1e18;
int main() {
    long long n; cin >> n;
    long long ans = 0;
    for (long long i = 2; i * i <=n; i ++) {
        long long cnt = 0; 
        while(n % i == 0) {
            cnt ++;
            n/=i;
        }
        int j = 1;
        while(cnt) {
            if (cnt >= j) {
                cnt-=j;
                ans++;
                j ++;
            }
            else break;
        }
    }
    if (n != 1) ans ++;
    cout << ans << endl;
   
}


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

namespace Array
{
    class Reversing_Numbers
    {
        static void Main(string[] args)
        {
            Console.ReadLine();
            var array = Console.ReadLine().Split(' ').Select(s => int.Parse(s)).ToArray();
            for (int i = array.Length-1; 0 <= i; i--)
            {
                Console.Write(array[i]);
                if (i != 0) Console.Write(" ");
                else Console.WriteLine();
            }
            
        }
    }
}

Measured memory_bytes: 9580
#include "bits/stdc++.h"
 
using namespace std;

using ll = long long;
using ull = unsigned long long;
using ld = long double;

#define REP(i,n) for(int i=0; i<int(n); i++)
#define REREP(i,n) for(int i=int(n-1); i>=0; i--)
#define FOR(i,m,n) for(int i=int(m); i<int(n); i++)
#define REFOR(i,m,n) for(int i=int(n-1); i>=int(m); i--)
#define ALL(obj) (obj).begin(),(obj).end()
 
#define VI vector<int>
#define VVI vector<vector<int>>
#define VVVI vector<vector<vector<int>>>
#define VD vector<double>
#define VVD vector<vector<double>>
#define VVVD vector<vector<vector<double>>>
#define VL vector<ll>
#define VVL vector<vector<ll>>
#define VVVL vector<vector<vector<ll>>>
#define VB vector<bool>
#define VVB vector<vector<bool>>
#define VVVB vector<vector<vector<bool>>>
#define VS vector<string>
#define VVS vector<vector<string>>
#define VVVS vector<vector<vector<string>>>
 
#define PII pair<int,int>
#define PDD pair<double,double>
#define PLL pair<ll,ll>
#define VPII vector<pair<int,int>>
#define VVPII vector<vector<pair<int,int>>>
#define VVVPII vector<vector<vector<pair<int,int>>>>
#define VPLL vector<pair<ll,ll>>
#define VVPLL vector<vector<pair<ll,ll>>>
#define VVVPLL vector<vector<vector<pair<ll,ll>>>>
 
#define SUMI(obj) accumulate((obj).begin(), (obj).end(), 0)
#define SUMD(obj) accumulate((obj).begin(), (obj).end(), 0.)
#define SUML(obj) accumulate((obj).begin(), (obj).end(), 0LL)
#define SORT(obj) sort((obj).begin(), (obj).end()) // 1,2,3,4,5...
#define RESORT(obj) sort((obj).begin(), (obj).end(), greater<int>()) // 5,4,3,2,1...
#define UB(obj,n) upper_bound((obj).begin(), (obj).end(), n) //itr > n
#define LB(obj,n) lower_bound((obj).begin(), (obj).end(), n) //itr>= n

#define PB push_back
#define Cout(str) cout << str << endl

const ll MOD = (ll)1e9 + 7;
const ll HINF = (ll)1e18;
const ll LINF = (ll)1e9;
const ll EPS = (ll)1e-8;

int main(){
	int n,m;
	int a,b;
	int sum;
	string str;
	string s,t;
	char c;
	VI vi;
	vector<char> vc;
	VS vs;
	int reserve_vi = 100;
	map<int, int> table; 

	//cin >> n >> m;
	//cin >> a >> b;
	//cin >> a >> b >> m;
	//cin >> str;
	//cin >> n;
	
	//cin >> s >> t;
	//cin >> c;

	REP(i, 3){
		cin >> n;
		table[n]++;
	}

	cout << table.size() << endl;

	//cout << accumulate(vi.begin(), vi.begin()+n, 0) << endl;

	//swap(a, b);
	//vi.resize(N);
	//fill(vi.begin(), vi.end(), 1);
	//vi.reserve(reserve_vi);
	//vi.PB(n);

	//vc.resize(5);
	//vc[i] = (str[i]);

	//sort(vc.begin(), vc.end(), greater<char>());
	//sort(vc.begin(), vc.end());

	//for(auto itr = table.begin(); itr != table.end(); ++itr) {
	return 0;
}



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

int main(void){
    int n, k, max = 0;
    string s;
    cin >> n >> k >> s;
    if(n==1){
        cout << "1" << endl;
        return 0;
    }
    int left = 0, right = 0, zeros = 0;
    if(s[0]=='0') zeros = 1;
    while(left < n){
        char prev = s[right];
        while(zeros <= k){
            if(s[right]=='0' && prev=='1'){
                ++zeros;
            }
            prev = s[right];
            ++right;
            if(right > n) break;
        }
        int tmp = right - left - 1;
        if(max < tmp){
            max = tmp;
        }
        if(right >= n) break;
        prev = s[left];
        while(zeros > k){
            ++left;
            if(s[left]=='1' && prev=='0'){
                --zeros;
            }
            prev = s[left];
        }
    }
    cout << max << endl;
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int i_rate, n, r;
  cin >> n;
  cin >> r;
  
  if (n >= 10){
    cout << r << endl;
  }
  else{
    i_rate = r + 100*(10-n);
    cout << i_rate << endl;
  }
}

Measured memory_bytes: 256
//nani?
#include<bits/stdc++.h>
#define pi acos(-1);
#define fs first
#define sc second
#define pb push_back
#define mp make_pair
#define f(i,a,b) for( int i = a; i < b ; i++ )
#define sor(a) sort( a.begin(), a.end() )
#define rsor(a) sort( a.rbegin(), a.rend() )
#define fastio ios_base::sync_with_stdio(0);cin.tie(0)
//#define inf 1LL<<62
typedef long long ll;
typedef double ld;
using namespace std;
const ll inf=1e10+6;
const ll MOD=1e9+7;
const ll mod=998244353;
// ac cmtr;
const int MAX_N = 1e6+5;
const int LG = 25;

#define TRACE
#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1) {
  cout << name << " : " << arg1 << endl;}
 
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args) {
  const char* comma = strchr(names + 1, ',');
  cout.write(names, comma - names) << " : " << arg1<<" | ";
  __f(comma+1, args...);}
#else
#define trace(...)
#endif
//---------------------------

ll a[MAX_N];
ll b[MAX_N];

int main(){
    fastio;
    ll a,b;
    cin>>a>>b;
    if(a>9 || b>9) cout<<-1<<endl;
    else cout<<a*b<<endl;


}






Measured memory_bytes: 3632
#include<bits/stdc++.h>
using namespace std;
#define rep(i,j,n) for(int i=(int)(j);i<(int)(n);i++)
#define REP(i,j,n) for(int i=(int)(j);i<=(int)(n);i++)
#define MOD 1000000007
#define int long long
#define ALL(a) (a).begin(),(a).end()
#define vi vector<int>
#define vii vector<vi>
#define pii pair<int,int>
#define priq priority_queue<int>
#define disup(A,key) distance(A.begin(),upper_bound(ALL(A),(int)(key)))
#define dislow(A,key) distance(A.begin(),lower_bound(ALL(A),(int)(key)))
#define tii tuple<int,int,int>
signed main(){
  int N,L; cin>>N>>L;
  vector<string> S(N);
  rep(i,0,N) cin>>S[i];
  sort(ALL(S));
  string ans="";
  rep(i,0,N) ans+=S[i];
  cout<<ans<<endl;
  }


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

int binary_search(int *S, int n, int key){
  int l=0, r=n;
  while(l < r){
    int mid = (l+r)/2;
    if(S[mid] == key) return 1;
    else if(S[mid] < key) l = mid+1;
    else r = mid;
  }
  return 0;
}

int main(){
  int n, q, S[100000], key, C=0;
  cin >> n;
  for(int i=0; i<n; i++) cin >> S[i];

  cin >> q;
  for(int i=0; i<q; i++){
    cin >> key;
    if(binary_search(S, n, key)) C++;
  }

  cout << C << endl;
  return 0;
}



Measured memory_bytes: 3376
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#include<bits/stdc++.h>
#define speedX ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)
using namespace std;
// #define ONLINE_JUDGE
#ifndef ONLINE_JUDGE
template<typename T>
void __p(T a) { cout << a << " "; }
template<typename T, typename F>
void __p(pair<T, F> a) { cout << "{ "; __p(a.first); __p(a.second); cout << "}"; }
template<typename T>
void __f(const char* s, T t) { cout << s << " : "; __p(t); }
template<typename T>
void __t(const char* s, const T &x) { cout << s << " : { "; for (auto it : x) __p(it); cout << "} ";}
template<typename T, typename ... F>
void __f(const char* s, T t, F ... f) {
	int i = 0; for (;; ++i) if (s[i] == ',') break;
	cout.write(s, i) << " : "; __p(t); cout << " | "; __f(s + i + 1, f...);
}
#define trace(...) { cout<<"LINE: "<<__LINE__<<" || "; __f(#__VA_ARGS__,__VA_ARGS__); cout<<"\n\n"; }
#define debug(...) { cout<<"LINE: "<<__LINE__<<" || "; __t(#__VA_ARGS__,__VA_ARGS__); cout<<"\n\n"; }
int begtime = clock();
#define end_time() cout << "\n\nTime of execution: " << (clock() - begtime)*1000/CLOCKS_PER_SEC << " ms\n\n";
#else
#define trace(...)
#define debug(...) 
#define end_time()
#endif
 
 
#define int long long 
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<pii, int> piii;
typedef vector<int> vi;
typedef vector<pii> vii;

inline bool equals(ld a, ld b) {return fabs(a - b) < 1e-9;}
inline int gcd(int a, int b) { a=abs(a); b=abs(b); while(a>0 && b>0) (a>b?a%=b:b%=a); return (a==0?b:a); } 
inline int power(int x, int n, int m = LLONG_MAX)
    {  int res=1; x = (x%m + m)%m;
       while(n) { if(n&1) res=(res*x)%m;  x=(x*x)%m;  n >>= 1; }  return res;
    }
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define ff first
#define ss second
#define uset unordered_set
#define umap unordered_map
#define all(x) x.begin(), x.end()
#define mod 1000000007

void solve(){
	int n;
	cin>>n;
	string num;
	int res = 0;
	for(int i = 0; i<1000000; i++){
		res = (res*10 + 7)%n;
		if(res==0) {
			cout<<(i+1)<<"\n";
			return;
		}
	}
	cout<<"-1\n";
	return;
}
signed main(){
	speedX;
	#ifndef ONLINE_JUDGE
        freopen("input.txt", "r", stdin);
        freopen("output.txt", "w", stdout);
    #endif
	int t=1;
	//cin>>t;
	for(int i=1;i<=t;++i) {
		//cout<<"Case #"<<i<<": ";
		solve();
	}
	end_time();
	return 0;
}


Measured memory_bytes: 3632
use std::io;
fn main() {
    let mut buf = String::new();

    std::io::stdin().read_line(&mut buf).unwrap();
    let mut iter = buf.split_whitespace();
    let s: String = iter.next().unwrap().parse().unwrap();

    let mut buf2 = String::new();
    std::io::stdin().read_line(&mut buf2).unwrap();
    let mut iter2 = buf2.split_whitespace();
    let t: String = iter2.next().unwrap().parse().unwrap();

    let mut ans = "YES";
    for c in 0..10 {
        if s.chars().nth(c) != t.chars().nth(2-c) { ans = "NO" };
    }
    
    println!("{}",ans);
}

Measured memory_bytes: 4352
/*{{{*/
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<string>
#include<iostream>
#include<sstream>
#include<set>
#include<map>
#include<queue>
#include<bitset>
#include<vector>
#include<limits.h>
#include<assert.h>
#define SZ(X) ((int)(X).size())
#define ALL(X) (X).begin(), (X).end()
#define REP(I, N) for (int I = 0; I < (N); ++I)
#define REPP(I, A, B) for (int I = (A); I < (B); ++I)
#define FOR(I, A, B) for (int I = (A); I <= (B); ++I)
#define FORS(I, S) for (int I = 0; S[I]; ++I)
#define RS(X) scanf("%s", (X))
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define GET_POS(c,x) (lower_bound(c.begin(),c.end(),x)-c.begin())
#define CASET int ___T; scanf("%d", &___T); for(int cs=1;cs<=___T;cs++)
#define MP make_pair
#define PB push_back
#define MS0(X) memset((X), 0, sizeof((X)))
#define MS1(X) memset((X), -1, sizeof((X)))
#define LEN(X) strlen(X)
#define F first
#define S second
using namespace std;
typedef long long LL;
typedef unsigned long long ULL;
typedef long double LD;
typedef pair<int,int> PII;
typedef vector<int> VI;
typedef vector<LL> VL;
typedef vector<PII> VPII;
typedef pair<LL,LL> PLL;
typedef vector<PLL> VPLL;
template<class T> void _R(T &x) { cin >> x; }
void _R(int &x) { scanf("%d", &x); }
void _R(LL &x) { scanf("%lld", &x); }
void _R(double &x) { scanf("%lf", &x); }
void _R(char &x) { scanf(" %c", &x); }
void _R(char *x) { scanf("%s", x); }
void R() {}
template<class T, class... U> void R(T &head, U &... tail) { _R(head); R(tail...); }
template<class T> void _W(const T &x) { cout << x; }
void _W(const int &x) { printf("%d", x); }
void _W(const LL &x) { printf("%lld", x); }
void _W(const double &x) { printf("%.16f", x); }
void _W(const char &x) { putchar(x); }
void _W(const char *x) { printf("%s", x); }
template<class T,class U> void _W(const pair<T,U> &x) {_W(x.F); putchar(' '); _W(x.S);}
template<class T> void _W(const vector<T> &x) { for (auto i = x.begin(); i != x.end(); _W(*i++)) if (i != x.cbegin()) putchar(' '); }
void W() {}
template<class T, class... U> void W(const T &head, const U &... tail) { _W(head); putchar(sizeof...(tail) ? ' ' : '\n'); W(tail...); }
#ifdef HOME
 #define DEBUG(...) {printf("# ");printf(__VA_ARGS__);puts("");}
#else
 #define DEBUG(...)
#endif
int MOD = 1e9+7;
void ADD(LL& x,LL v){x=(x+v)%MOD;if(x<0)x+=MOD;}
/*}}}*/
const int SIZE = 1e6+10;
int d[SIZE];
int main(){
    FOR(i,1,200){
        for(int j=i;j<SIZE;j+=i)d[j]++;
    }
    int N;
    R(N);
    int an=0;
    FOR(i,1,N){
        if(i%2==1&&d[i]==8)an++;
    }
    W(an);
    return 0;
}


Measured memory_bytes: 4096
#include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
#include <queue>
#include <string>
#define REP(i,n) for(ll i = 0; i < (ll)n; i++)
using namespace std;
typedef long long ll;

int main(){
  string s;
  cin >> s;
  ll ans = 0;
  if(s[0]=='1')ans++;
  if(s[1]=='1')ans++;
  if(s[2]=='1')ans++;
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define PI acos(-1)
using namespace std;
int main()
{
    int a,b,h,m;
    cin>>a>>b>>h>>m;
    double x,y,z,v;
    x=0.5*((60*h)+m);
    y=6*m;
    z=abs(x-y);
    v = z * PI / 180.0;
    double ans = a * a + b * b - 2 * a * b * cos(v);
    cout << setprecision(14)<<sqrt(ans)<<endl;
}

Measured memory_bytes: 4224
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)(n);i++)
using namespace std;
using ll = long long ;
using P = pair<int,int> ;
using pll = pair<long long,long long>;
constexpr int INF = 1e9;
constexpr long long LINF = 1e17;
constexpr int MOD = 1000000007;
constexpr double PI = 3.14159265358979323846;

int main(){
    int n,m;
    cin >> n >> m;
    vector<P> ab(n);
    rep(i,n) cin >> ab[i].first >> ab[i].second;
    sort(ab.begin(),ab.end());
    ll ans = 0;
    int id = 0;
    priority_queue<ll> pq;
    for(int i=1;i<=m;i++){
        while(ab[id].first<=i&&id<n){
            pq.push(ab[id].second);
            ++id;
            if(id>=n) break;
        }
        if(!pq.empty()){
            ans += pq.top();
            pq.pop();
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 5104
//
// Copyright 2018 Authors All Rights Reserved.
//
// FileName: D.cc
// Author: Beiyu Li <sysulby@gmail.com>
// Date: 2018-05-12
//
#include <bits/stdc++.h>

using namespace std;

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

typedef long long LL;
typedef pair<int, int> Pii;

const int inf = 0x3f3f3f3f;
const LL infLL = 0x3f3f3f3f3f3f3f3fLL;

const int maxn = 100000 + 5;

int n, m;
int p[maxn];
int x[maxn], y[maxn];
int f[maxn];
unordered_map<int, unordered_set<int> > mp;

int find(int u) { return ~f[u]? f[u] = find(f[u]): u; }

void merge(int u, int v)
{
  u = find(u), v = find(v);
  if (u == v) return;
  f[u] = v;
}

int main(int argc, char *argv[])
{
  scanf("%d%d", &n, &m);
  rep(i,n) scanf("%d", &p[i]), --p[i];
  memset(f, -1, sizeof(f));
  rep(j,m) {
    scanf("%d%d", &x[j], &y[j]);
    --x[j], --y[j];
    merge(x[j], y[j]);
  }
  rep(i,n) mp[find(i)].insert(i);
  int ret = 0;
  for (auto &i : mp) {
    unordered_set<int> &st = i.second;
    for (auto &j : st)
      if (st.count(p[j])) ++ret;
  }
  printf("%d\n", ret);

  return 0;
}

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

int main(){
  int a,b;
  cin >> a >> b ;

  if (a<b){
    cout << "a < b" << endl;
  }
  else if (a>b){
    cout << "a > b" << endl;
  }
  else{
    cout << "a == b" << endl;
  }

  return 0;
}

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int A1, A2, A3;
  cin >> A1 >> A2 >> A3;
  if(A1 + A2 + A3 >= 22){
    cout << "bust" << endl;
  }else{
    cout << "win" << endl;
  }
}

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

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

  vector<pair<pair<string, int>, int>> v(N);
  for (int i = 0; i < N; i++)
  {
    string a;
    int b, c = i + 1;
    cin >> a >> b;
    v.at(i) = make_pair(make_pair(a, -b), c);
  }

  sort(v.begin(), v.end());

  for (auto i : v)
  {
    cout << i.second << endl;
  }
}

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

using namespace std;

const int MAX = 100005;	
const int mod = 1000000007;
int con[MAX];

int main() {
	int n;
	scanf("%d", &n);

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

	int rec = n % 2? 2 : 1;
	if (n % 2) {
		if (con[0] != 1){
			puts("0");
			return 0;
		}
	} 
	while (rec <= n) {
		if (con[rec] != 2){
			puts("0");
			return 0;
		}
		rec += 2;
	}
	int mitad = n / 2;
	long long res = 1;
	for (int i = 0; i < mitad; i++) {
		res = res * 2 % mod;
	}
	printf("%lld\n", res);
	return 0;
}

Measured memory_bytes: 640
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <cmath>
#include <vector>
#include <map>
#include <set>
#include <string>
#include <stack> // s.top()
#include <bitset>
#include <queue> // s.front()
using namespace std;

typedef long long Int;
typedef pair<Int,Int> P;
#define print(x) cout<<(x)<<endl

#define INF10 10000000000
#define INF5 100000
#define EPS 1e-10
#define MOD 1000000007



int main() {
	int a, b;
	cin >> a >> b;
	if (a*b % 2 == 0)print("No");
	else print("Yes");


	return 0;
}

Measured memory_bytes: 256
Module Module1

    Sub Main()

        Dim N As Integer = CInt(Console.ReadLine())
        Dim tmp As String() = Split(Console.ReadLine(), " ")
        Dim S As String = tmp(0)
        Dim T As String = tmp(1)
        Dim R As String = ""

        For c As Integer = 1 To N
            R &= Mid(S, c, 1) & Mid(T, c, 1)
        Next

        Console.WriteLine(R)
        'Console.ReadLine()

    End Sub

End Module



Measured memory_bytes: 13536
#include<bits/stdc++.h>
using namespace std;
const double pi = 3.141592653589793238;
double calcAngle(double h, double m)
{

    if (h == 12) h = 0;
    if (m == 60) m = 0;

    // Calculate the angles moved
    // by hour and minute hands
    // with reference to 12:00
    double hour_angle = 0.5 * (h * 60 + m);
    double minute_angle = 6 * m;

    // Find the difference between two angles
    double angle = abs(hour_angle - minute_angle);

    // Return the smaller angle of two possible angles
    angle = min(360 - angle, angle);

    return angle;
}

int main(){

       double a,b,h,m;
        cin>>a>>b>>h>>m;


       double theta = calcAngle(h,m);

        double cosine = cos(theta * (pi/180));

         cosine = cosine * 2 * a * b;

         double ans = a*a + b*b - cosine;

          ans = sqrt(ans);


          cout<<std::setprecision(16)<<ans;
}


Measured memory_bytes: 4228
n=int(input())
m=0;a=0;r=0;c=0;h=0
for i in range(n):
  x=input()
  if x[0]=='M':m+=1
  elif x[0]=='A':a+=1
  elif x[0]=='R':r+=1
  elif x[0]=='C':c+=1
  elif x[0]=='H':h+=1
print(m*a*r+m*a*c+m*a*h+m*r*c+m*r*h+m*c*h+a*r*c+a*r*h+a*c*h+r*c*h)

Measured memory_bytes: 3316
IDENTIFICATION                   DIVISION.
PROGRAM-ID.                      ABC_091_B.
ENVIRONMENT                      DIVISION.
DATA                             DIVISION.
WORKING-STORAGE                  SECTION.
    01 i      PIC 9(18).
    01 j      PIC 9(18).

    01 tmpkey PIC X(10) VALUE SPACE.
    01 tmpval PIC 9(3) VALUE 0.

    01 tmp    PIC S9(3).

    01 point  PIC S9(3) VALUE 0.
    01 ans    PIC X(3).
    01 ZS     PIC Z(3)9.

    01 N      PIC 9(3).
    01 M      PIC 9(3).

    01 slen   PIC 9(3) VALUE 0.

    01 s1.
        03 s11 OCCURS 100.
            05 skey PIC X(10) VALUE SPACE.
            05 sval PIC 9(3) VALUE 0.

    01 tlen   PIC 9(3) VALUE 0.

    01 t1.
        03 t11 OCCURS 100.
            05 tkey PIC X(10) VALUE SPACE.
            05 tval PIC 9(3) VALUE 0.

    01 flg    PIC 9(1).
    01 DUMMY  PIC X(1).
PROCEDURE                        DIVISION.
MAIN.
    ACCEPT N.

    PERFORM VARYING i FROM 1 BY 1 UNTIL N < i
        ACCEPT tmpkey
        MOVE 0 TO flg
        PERFORM VARYING j FROM 1 BY 1 UNTIL slen < j
            IF skey(j) = tmpkey THEN
                MOVE 1 TO flg
                ADD 1 TO sval(j)
            END-IF
        END-PERFORM
        IF flg = 0 THEN
            ADD 1 TO slen
            MOVE tmpkey TO skey(slen)
            MOVE 1 TO sval(slen)
        END-IF
    END-PERFORM.

    ACCEPT M.

    PERFORM VARYING i FROM 1 BY 1 UNTIL M < i
        ACCEPT tmpkey
        MOVE 0 TO flg
        PERFORM VARYING j FROM 1 BY 1 UNTIL tlen < j
            IF tkey(j) = tmpkey THEN
                MOVE 1 TO flg
                ADD 1 TO tval(j)
            END-IF
        END-PERFORM
        IF flg = 0 THEN
            ADD 1 TO tlen
            MOVE tmpkey TO tkey(tlen)
            MOVE 1 TO tval(tlen)
        END-IF
    END-PERFORM.

    PERFORM VARYING i FROM 1 BY 1 UNTIL slen < i
        MOVE sval(i) to tmp
        PERFORM VARYING j FROM 1 BY 1 UNTIL tlen < j
            IF skey(i) = tkey(j) THEN
               SUBTRACT tval(j) FROM tmp
            END-IF
        END-PERFORM
        COMPUTE point = FUNCTION MAX(point, tmp)
    END-PERFORM.

    MOVE point TO ZS.

    PERFORM UNANS.

    DISPLAY ans(1:FUNCTION STORED-CHAR-LENGTH(ans)).
    STOP RUN.

UNANS                            SECTION.
    UNSTRING
        ZS DELIMITED BY ALL SPACE
        INTO DUMMY ans
    END-UNSTRING.


Measured memory_bytes: 384
#include<iostream>
#include<cstdio>
#include<cmath>
#include<cstring>
#include<string>
#include<stack>
#include<queue>
#include<vector>
#include<algorithm>
#include<iomanip>
#include<utility>
#include<set>
typedef long long int ll;
using namespace std;
#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define REP(i,n) for (int i=0;i<signed(n);i++)
#define EREP(i,n) for (int i=1;i<=(n);i++)
#define ALL(a) (a).begin(),(a).end()
//#define EVEL 1

#ifdef EVEL
#define DEB(X) cout << #X << ":" <<X<<" " ;
#define TF(f) f ? cout<<"true  " : cout<<"false ";
#define END cout<<"\n";
#else
#define DEB(X) {}
#define TF(f) {}
#define END {}
#endif
const int MOD = 1000000007;
const ll INF = 20000000000;
struct edge {int to,cost;};
#define VMAX 51
//typedef std::pair<int,int> P;

    ll N,A[100001],ans=1;
    string S;
    bool F=true,Q=false;
int main(){
    ios_base::sync_with_stdio(false);
    cin>>S;
    N=S.size();
    for(int i=0;i<N;){
        bool f=false;
        if(S[i]=='d'){
            if(S.substr(i,5)=="dream")i+=5;
            else{
                F=false;
                break;
            }
        }
        else if(S[i]=='e'){
            if(S.substr(i,4)=="eras")i+=4;
            else if(S.substr(i,2)=="er"&&!Q){i+=2;f=true;}
            else{
                if(S.substr(i-4,4)=="eras")i+=1;
                else{
                    F=false;
                    break;
                }
            }
        }else{
            F=false;
            break;
        }
        DEB(i)END
        Q=f;
    }
    cout<<(F?"YES":"NO")<<endl;
    return 0;
}

Measured memory_bytes: 512
//  Created by conan1024hao on 2019/11/19.
//  Copyright © 2019 conan1024hao. All rights reserved.
//  専用ライブラリです、自由にコピーして構いません。
//  感谢看我的代码！Wechat:conan1024hao QQ:810396815
#pragma GCC optimize ("O3")
#include <iostream>
#include <iomanip>
#include <istream>
#include <ostream>
#include <sstream>
#include <iterator>
#include <vector>
#include <algorithm>
#include <queue>
#include <deque>
#include <list>
#include <stack>
#include <map>
#include <set>
#include <utility>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <string>
#include <ctime>
#include <cctype>
#include <cstdlib>
using namespace std;
typedef long long int ll;
typedef pair<ll,ll>P;
#define INF 10e16
#define MOD 1000000007
#define rep(i, a, n) for (ll i = a; i < (ll)(n); i++)
#define fi first
#define se second
#define mmax(x,y)(x>y?x:y)
#define mmin(x,y)(x<y?x:y)
#define chmax(x,y) x=mmax(x,y)
#define chmin(x,y) x=mmin(x,y)
#define all(x) (x).begin(),(x).end()
#define PI acos(-1.0)
long long GCD(long long a, long long b) { return b ? GCD(b, a%b) : a; }
long long LCM(long long a, long long b)  {return a/GCD(a,b)*b;}
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
ll cmp(pair<ll,string>a,pair<ll,string> b){
        if(a.fi!=b.fi)
        return a.fi<b.fi;
        else
        return a.se<b.se;
}
//---------------------------------------------------------------------------

//---------------------------------------------------------------------------
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    //-------------------------------
    int n;
    cin>>n;
    vector<ll>a(n);
    for(int i=0;i<n;i++)
        cin>>a[i];
    sort(all(a));
    
    ll ans=GCD(a[0],a[1]);
    for(ll i=2;i<n;i++){
        ll t=GCD(a[0],a[i]);
        chmin(ans,t);
    }
    cout<<ans<<endl;
    //-------------------------------
    return 0;
}
//---------------------------------------------------------------------------


Measured memory_bytes: 1024
import math as m

a, b = map(int, input().split())
cost = -1
flg = 0

while flg == 0 and cost < 10 ** 6 / 1.5:
    cost += 1
    aAns = m.floor(cost * 0.08)
    bAns = m.floor(cost * 0.1)
    if aAns == a and bAns == b:
        flg = 1

print(cost if flg == 1 else -1)


Measured memory_bytes: 3060
#include <iostream>
#include <string>
#include <cstring>
#include <algorithm>
#include <functional>
#include <cmath>
#include <set>
#include <queue>
#include <vector>
#include <climits>
#include <sstream>
#include <iomanip>
#include <map>
#include <stack>
using namespace std;

int main()
{
	int N, M;
	cin >> N >> M;
	vector<pair<int, long long>> list;
	for (auto i = 0; i < N; ++i)
	{
		int A;
		long long B;
		cin >> A >> B;
		list.push_back(make_pair(A, B));
	}
	sort(list.begin(), list.end());

	priority_queue<long long> q;
	auto index = 0;
	auto result = 0ll;
	for (auto i = 1; i <= M; ++i)
	{
		for (; index < list.size(); ++index)
		{
			auto& p = list[index];
			if (p.first > i)
			{
				break;
			}

			q.push(p.second);
		}

		if (!q.empty())
		{
			result += q.top();
			q.pop();
		}
	}

	cout << result << endl;

	return 0;
}

Measured memory_bytes: 3568
#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)
#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: 3640
#include<bits/stdc++.h>
using namespace std;

int main(){
  int N, M;
  cin >> N >> M;
  vector<vector<int>> graph(M,vector<int>(3));
  for(int i=0; i<M; i++){
    for(int j=0; j<3; j++){
      cin >> graph.at(i).at(j);
    }
  }
  vector<vector<int>> cost(N,vector<int>(N));
  for(int i=0; i<N; i++){
    for(int j=0; j<N; j++){
      cost.at(i).at(j) = 100000000;
    }
  }
  for(int i=0; i<M; i++){
    int x = graph.at(i).at(0)-1;
    int y = graph.at(i).at(1)-1;
    cost.at(x).at(y) = graph.at(i).at(2);
    cost.at(y).at(x) = graph.at(i).at(2);
  }
  for(int i=0; i<N; i++){
    cost.at(i).at(i) = 0;
  }
  
  vector<vector<int>> next(N,vector<int>(N));
  for(int i=0; i<N; i++){
    for(int j=0; j<N; j++){
      next.at(i).at(j) = j+1;
    }
  }
  
  for(int k=0; k<N; k++){
    for(int i=0; i<N; i++){
      for(int j=0; j<N; j++){
        if(cost.at(i).at(j) > cost.at(i).at(k) + cost.at(k).at(j)){
          cost.at(i).at(j) = cost.at(i).at(k) + cost.at(k).at(j);
          next.at(i).at(j) = next.at(i).at(k);
        }
      }
    }
  }
  
  int cnt = 0;
  
  //for(int i=0; i<N; i++){
    //for(int j=0; j<N; j++){
      //cout << next.at(i).at(j);
    //}
    //cout << endl;
  //}
  
  for(int i=0; i<M; i++){
    int a = graph.at(i).at(0);
    int b = graph.at(i).at(1);
    if(next.at(a-1).at(b-1) != b && next.at(b-1).at(a-1) != a){
      cnt++;
    }
  }
  cout << cnt << endl;
}

Measured memory_bytes: 384
n = int(input())
a = list(map(int,input().split()))
an = []
ans = ''
for i in range(n):
    an.append([i+1,a[i]])
an.sort(key=lambda x: x[1])

for i in range(n):
    ans += (str(an[i][0]) + ' ')

print(ans)

Measured memory_bytes: 22396
#include <bits/stdc++.h>
    using namespace std;
    
    int main() {
    int i = 0;
      int D;
    cin >> D;
    cout << "Christmas";
      int Di = 25 - D;
    while(i < Di){
    cout << " Eve";
     i++;
    }
    cout << endl;
    }

Measured memory_bytes: 3528
N=int(input())
A=list(map(int,input().split()))
A=A[::-1]
dpmax=[0 for i in range(0,N)]
dpmin=[0 for i in range(0,N)]

for i in range(0,N):
    if i==0:
        if A[0]!=2:
            print(-1)
            break
        else:
            dpmax[0]=3
            dpmin[0]=2
    else:
        testmax=dpmax[i-1]-dpmax[i-1]%A[i]
        if dpmin[i-1]%A[i]!=0:
            testmin=dpmin[i-1]-dpmin[i-1]%A[i]+A[i]
        else:
            testmin=dpmin[i-1]
        if testmax>=dpmin[i-1]:
            dpmax[i]=testmax+A[i]-1
        else:
            print(-1)
            break
        if dpmax[i-1]>=testmin:
            dpmin[i]=testmin
        else:
            print(-1)
            break
else:
    print(dpmin[-1],dpmax[-1])


Measured memory_bytes: 65892
r, g, b, n = gets.split.map(&:to_i)
r, g, b = [r, g, b].sort!

ans = 0

0.upto(n / r) do |x|
  balls = r * x
  next if balls > n
  if balls == n
    ans += 1
    next
  end

  0.upto((n - (r * x)) / g) do |y|
    balls = r * x + g * y
    next if balls > n
    if balls == n
      ans += 1
      next
    end

    rest = n - balls
    ans += 1 if rest % b == 0
  end
end

puts ans


Measured memory_bytes: 1788
#include <iostream>
#include <cstdio>

using namespace std;

const int mod = 1e9 + 7;
int g[331080][12], f[45][331080], n, x, y, z;

int main()
{
//	freopen("poem.in", "r", stdin);
//	freopen("poem.out", "w", stdout);
	cin >> n >> x >> y >> z;
	int i, j, tm = 1 << x + y + z, k;
	y += x;
	z += y;
	for (i = 1; i <= tm; i++)
	for (j = 1; j <= 10; j++)
	{
		g[i][j] = 1;
		if (i == tm)
		{
			g[i][j] = tm;
			continue;
		}
		for (k = 0; k < z; k++)
		if ((i & (1 << k)) && k + j <= z &&
		 !(k < x && k + j > x) && !(k < y && k + j > y))
		g[i][j] |= 1 << k + j;
		if (g[i][j] > tm) g[i][j] = tm;
		//cout << g[i][j] << endl;
	}
	f[0][1] = 1;
	for (i = 0; i < n; i++)
	for (j = 1; j <= tm; j++)
	if (f[i][j])
	{
		for (k = 1; k <= 10; k++)
		(f[i + 1][g[j][k]] += f[i][j]) %= mod;
	}
	cout << f[n][tm] << endl;
	fclose(stdin);
	fclose(stdout);
	return 0;
}

Measured memory_bytes: 59648
#include<bits/stdc++.h>
using namespace std;
const int N = 1e5 + 9;
vector<int>V[N];

int n, f[N];
// f[i] ±íÊ¾ÒÔiÎª¸ùµÄ×ÓÊ÷ÓÐÄÄÐ©±êºÅµÄµãÐèÒª½â¾öÆ¥ÅäÎÊÌâ 
void Dfs (int u, int fa) {
	int all = 0, s = 0;
	for (auto v : V[u]) if (v != fa) {
		Dfs(v, u);
		all |= (s & f[v]);
		s |= f[v];
	}
	all = all << 1 | 1;
	for (int i = 30; ~i; --i) if (all >> i & 1) {
		while (s >> i & 1) ++i;
		f[u] = (s ^ (s & ((1 << i) - 1))) | (1 << i);
		return ;
	}
}

int main () {
	scanf("%d", &n);
	for (int i = 1, a, b; i < n; ++i) scanf("%d%d", &a, &b), V[a].push_back(b), V[b].push_back(a);
	Dfs(1, 0);
	for (int i=30;i>=0;i--) if (f[1]>>i&1) return printf("%d\n",i),0;
	return 0;
}

Measured memory_bytes: 11776
import sys
import numpy as np

N, M, Q = map(int, input().split(' '))

dp = np.zeros(shape=(N + 1, N + 1), dtype=int)
for _ in range(M):
    L, R = map(int, input().split(' '))
    dp[L][R] += 1

dp = dp.cumsum(axis=1).cumsum(axis=0)

queries = np.array(list(map(int, sys.stdin.read().split())))

left = queries[0::2] - 1
right = queries[1::2]

print('\n'.join((dp[right, right] + dp[left, left] - dp[left, right] - dp[right, left]).astype(str)))


Measured memory_bytes: 37304
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {
    public static void main(String[] args) throws IOException {
        BufferedReader input = new BufferedReader(new InputStreamReader(System.in));
        int N = Integer.parseInt(input.readLine());
        String S = input.readLine();
        int[] values = new int[N + 1];
        int currentValue = 0;
        values[0] = currentValue;
        for (int i = 0; i < N; i++) {
            currentValue += incrementOrDecrement(S.charAt(i));
            values[i + 1] = currentValue;

        }

        int answer = values[0];
        for (int i = 0; i < N + 1; i++) {
            if (answer < values[i]) {
                answer = values[i];
            }
        }
        System.out.println(answer);
    }

    private static int incrementOrDecrement(char operation) {
        if (operation == 'I') {
            return 1;
        } else {
            return -1;
        }
    }
}


Measured memory_bytes: 21332
import heapq

N, M = map(int, input().split())

H = []
for a in map(int, input().split()):
    heapq.heappush(H, -a)

for m in range(M):
    a = heapq.heappop(H)
    heapq.heappush(H, -1 * (-a // 2))

print(-1 * sum(H))


Measured memory_bytes: 14180
#include<stdio.h>
#include<vector>
#include<algorithm>
int main()
{
	int v,d,i,a,b,c;
	while(scanf("%d%d",&v,&d)>0)
	{
		std::vector<int>s;
		a=b=1;
		for(i=0;i<v;++i)
		{
			s.push_back(c=(a+b)%1001);
			a=b;
			b=c;
		}
		std::sort(s.begin(),s.end());
		for(i=a=0;i<s.size()-1;++i)
			if(s[i+1]-s[i]>=d)++a;
		printf("%d\n",a+1);
	}
	return 0;
}

Measured memory_bytes: 0