akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<set>
#include<cstdio>
#include <sstream>
#include <string>
using namespace std;
int main()
{
  int s;
  cin>>s;
  for(;s--;)
    {
      
      int n,c=0;
      cin>>n;
      set<int> hash;
      for(;n>9;)
	{
	  if(hash.find(n) != hash.end())
	    {
	      c=-1;
	      break;
	    }
	  hash.insert(n);
	  int max=0;
	  stringstream ss;
	  ss << n;
	  string tmp= ss.str();

	  for(int i=1;i<tmp.size();i++)
	    {
	      int a=0,b=0;
	      for(int j=0;j<tmp.size();j++)
		{
		  if(j<i)
		    {
		      a*=10;
		      a+=tmp[j]-'0';
		    }
		  else
		    {
		      b*=10;
		      b+=tmp[j]-'0';
		    }
		}
	      
	      //	      cout<<"i:"<<i<<" a:"<<a<<" b:"<<b<<" a*b:"<<a*b<<endl;
	      if(a*b>max)
		max=a*b;
	    }
	  
	  //	  cout<<"max:"<<max<<endl;
	  n=max;
	  c++;
	}
      	cout<<c<<endl;
    }
}

Measured memory_bytes: 1220
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<queue>
#include<map>
#include<vector>
#include<functional>

using namespace std;

long long N, a[200000], c, ans;
int main(void) {
	scanf("%lld", &N);
	for (int i = 0; i < N; i++) {
		scanf("%lld", &a[i]);
	}
	c = 0;
	ans = 0;
	for (int i = N - 1; i >= 0; i--) {
		if (c > a[i]) { printf("-1\n"); return 0; }
		else if (c < a[i]) {
			c = a[i];
			ans += a[i];
		}
		c--;
	}

	if (c == -1) { printf("%lld\n", ans); }
	else { printf("-1\n"); }

	return 0;
}


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

const int maxn = (int)2*1e5+10;
const int size = 26;
const int inf = (int)1e9+7;

int dp[maxn], vis[maxn];
int nxt[maxn][size];
char A[maxn];
int n;

//////////////辅助函数/////////////
int id(char c) { return c-'a'; }

int f(int x) {
  if (x > n) return 0;
  int &ans = dp[x];
  if (vis[x]) return ans;
  vis[x] = 1; ans = inf;
  for (int i=0; i<size; i++) {
    ans=min(ans, f(nxt[x][i]+1)+1);
    //if (x == 0) printf("%c %d\n", 'a'+i, ans);
  }
  return ans;
}

void print_ans(int x) {
  if (x > n) return ;
  for (int i=0; i<size; i++) 
    if (dp[x]==dp[nxt[x][i]+1]+1) {
      putchar(i+'a');
      print_ans(nxt[x][i]+1);
      break;
    }
}

//////////////主要函数/////////////
void init() {
  scanf("%s", A);
  n = strlen(A);
  for (int i=0; i<size; i++)
    nxt[n][i] = n;
  for (int i=n-1; i>=0; i--) 
    for (int j=0; j<size; j++) {
      if (id(A[i]) == j) nxt[i][j] = i;
      else nxt[i][j] = nxt[i+1][j];
    }
}

void solve() {
  f(0);
  //for (int i=0; i<n; i++) printf("%d ", dp[i]); 
  //printf("\n");
  print_ans(0);
  putchar('\n');
}

int main() {
  init();
  solve();
  return 0;
}


Measured memory_bytes: 22528
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#include <climits>
#include <cstring>
#include <cassert>


using namespace std;
#define SZ(x) (int)(x.size())
#define REP(i, n) for(int i=0;i<n;++i)
#define FOR(i, a, b) for(int i=a;i<b;++i)
#define RREP(i, n) for(int i=n-1;i>=0;--i)
#define RFOR(i, a, b) for(int i=b-1;i>=a;--i)

#define all(x) begin(x),end(x)
#define dump(x) cerr<<#x<<" = "<<(x)<<endl
#define debug(x) cerr<<#x<<" = "<<(x)<<" (L"<<__LINE__<<")"<< endl;

using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using P = pair<int, int>;
const double eps = 1e-8;
const ll MOD = 1000000007;
const int INF = INT_MAX / 2;
const ll LINF = LLONG_MAX / 2;

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

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


template<typename T1, typename T2>
ostream &operator<<(ostream &os, const pair<T1, T2> p) {
    os << p.first << ":" << p.second;
    return os;
}

template<class T>
ostream &operator<<(ostream &os, const vector<T> &v) {
    os << "[";
    REP(i, SZ(v)) {
        if (i) os << ", ";
        os << v[i];
    }
    return os << "]";
}

// edit
int N;
vector<ll> A;

vector<vector<ll>> dp;
vector<vector<bool>> vis;

ll dfs(int n, int c) {
    if (vis[n][c]) return dp[n][c];
    if (n == 0) {
        if (c <= 1) {
            return 0;
        } else {
            return -LINF;
        }
    }
    if (n == 1) {
        if (c == 0) {
            return A[0];
        } else if (c <= 2) {
            return 0;
        } else {
            return -LINF;
        }
    }

    vis[n][c] = true;

    ll &ret = dp[n][c];
    ret = dfs(n - 2, c) + A[n - 1];
    if (c >= 1) {
        chmax(ret, dfs(n - 1, c - 1));
    }

    return ret;
}

void solve() {
    cin >> N;
    A.resize(N);
    REP(i, N) cin >> A[i];

    dp.resize(N + 1, vector<ll>(3));
    vis.resize(N + 1, vector<bool>(3));

    ll ans = dfs(N, 1 + (N + 0) % 2);
    cout << ans << endl;


}


int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(10);
//    std::ifstream in("input.txt");
//    std::cin.rdbuf(in.rdbuf());

    solve();


    return 0;
}


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

using namespace std;

int A, B;
string ans;

void resolve()
{
    cin >> A >> B;

    ans = (A != 2 && B != 2) ? "Yes" : "No";
    cout << ans << endl;
}

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


Measured memory_bytes: 256
#include<bits/stdc++.h>
//cervello|Phoenix
using namespace std;
#define ll long long int
#define eb emplace_back
#define mk make_pair
#define all(x) x.begin(),x.end()
#define mod 1000000007
const double pi = 3.1415926535988;

int main(){
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  double a,b,h,m; cin>>a>>b>>h>>m;
  double ans=0.0;
  double a1=(m/60);
  double a2=(h/12);
  a1=abs(h*30-5.5*m)/180;
  a1*=pi;
  ans=a*a+b*b-2*a*b*cos(a1);
  ans=sqrt(ans);
  cout<<fixed<<setprecision(12)<<ans<<"\n";
  return 0;
}

Measured memory_bytes: 4244
// g++ -std=gnu++1y -O2 main.cpp

#include <cassert>
#include <cstdio>
#include <vector>
#include <set>

#include <map>
#include <unordered_map>
#include <string>
#include <utility>
#include <algorithm>
#include <iostream>
#include <iostream>
#include <climits>

using namespace std;

template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

const int INF = 1e9;
const long long LINF = 1e18;

int main() {
	long long N;
	string S;
	cin >> N;
	cin >> S;

	long long cntR = 0;
	long long cntG = 0;
	long long cntB = 0;

	for (int i = 0; i < N; i++)
	{
		if (S[i] == 'R')
			cntR++;
		else if (S[i] == 'G')
			cntG++;
		else
			cntB++;
	}

	long long cnt = 0;
	for (int i = 1; i <= N - 2; i++)
	{
		for (int j = i + 1; j <= N - 1; j++) {
			int k = 2 * j - i;

			if (k < 3 || N < k)
				continue;

			// cout << "i: " << i << ", j: " << j << ", k:" << k << endl;
			if (S[i - 1] != S[j - 1] && S[i - 1] != S[k - 1] && S[j - 1] != S[k - 1])
				cnt++;
		}
	}

	long long total =cntR * cntG * cntB;
	cout << total - cnt << endl;

	return 0;
}


Measured memory_bytes: 3628
#include <iostream>
#include <algorithm>
#include <cstring>
#include <vector>
#include <queue>

using namespace std;

int main(){
  long long x;
  cin>>x;
  long long tmp = 0;
  int ans = 0;
  for(int i = 0;i<=x;i++){
    //cout<<"i:"<<i<<endl;
    if(tmp < x)
      tmp += i;
    /*
    if(tmp == x){
      ans = i;
      break;
    }else if(tmp > x){
      if(tmp - x <= i){
	ans = i;
	break;
      }
	
    }
    */
    if(tmp >= x){
      ans = i;
      //cout<<"ans:"<<ans;
      break;
    }
      
  }
  cout<<ans<<endl;
    

  return 0;
}


Measured memory_bytes: 256
n = int(input())
ans = 0
for i in range(1,n+1):
  if i % 3 == 0 and i % 5 == 0:
    ans += 0
  elif i % 3 == 0 or i % 5 == 0:
    ans += 0
  else:
    ans += i

print(ans)

Measured memory_bytes: 9112
import java.util.*

fun main(args:Array<String>) {
    val sc= Scanner(System.`in`)
    val k = sc.nextInt()
    var ans = 0L

    fun gcd(a:Int, b:Int): Int {
        if(b == 0)
            return a
        return gcd(b, a % b)
    }

    for(a in 1..k) {
        for(b in 1..k) {
            for(c in 1..k) {
                ans += gcd(gcd(a,b),c)
            }
        }
    }
    println(ans)

}

Measured memory_bytes: 36576
N, M = map(int, input().split())
Edges = []
for i in range(M):
    a, b, c = map(int, input().split())
    a, b = a - 1, b - 1
    c = -c
    Edges.append([a, b, c])


dist = [float('inf')] * N
dist[0] = 0

for i in range(N):
    for fr, to, cost in Edges:
        if (dist[fr] != float('inf')) and (dist[to] > dist[fr] + cost):
            dist[to] = dist[fr] + cost
            if (i == N - 1) & (to == N - 1):
                print(float('inf'))
                exit()

print(-dist[N - 1])


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

using namespace std;

#define REP(i,n) for(ll (i) = (0);(i) < (n);++i)
#define REV(i,n) for(ll (i) = (n) - 1;(i) >= 0;--i)
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define FI first
#define SE second
#define SHOW1d(v,n) {REP(WW,n)cerr << v[WW] << ' ';cerr << endl << endl;}
#define SHOW2d(v,WW,HH) {REP(W_,WW){REP(H_,HH)cerr << v[W_][H_] << ' ';cerr << endl;}cerr << endl;}
#define ALL(v) v.begin(),v.end()
#define Decimal fixed<<setprecision(20)
#define INF 1000000000
#define LLINF 1000000000000000000LL
#define MOD 998244353

typedef long long ll;
typedef pair<ll,ll> P;

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

	ll a, b;cin >> a >> b;
	ll now = 1;
	for(int i = 0;;i++){
		if(now + i * (a - 1) >= b){
			cout << i << endl;
			return 0;
		}
	}

	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <cstring>
#include <vector>
#include <algorithm>
#include <set>
#include <stack>
#include <deque>
#include <cmath>
#include <map>
using namespace std;
using ll = long long;
#define rep(i, n) for (ll i = 0; i < n; i++)
template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}

int main() {
    string s;
    cin >> s;
    if (s <= "2019/04/30") cout << "Heisei" << endl;
    else cout << "TBD" << endl;
}

Measured memory_bytes: 256
import std.algorithm, std.conv, std.range, std.stdio, std.string;

void main()
{
  auto n = readln.chomp.to!size_t;
  Node node;

  foreach (_; n.iota) {
    auto rd = readln.chomp.splitter(' '), cmd = rd.front;
    switch (cmd) {
    case "insert":
      rd.popFront;
      node.insert(rd.front.to!int);
      break;
    case "print":
      node.inorderWalk;
      writeln;
      node.preorderWalk;
      writeln;
      break;
    default:
      assert(0);
    }
  }
}

void writeArray(T)(T[] ai)
{
  foreach (a; ai) write(" ", a);
  writeln;
}

void insert(ref Node node, int val)
{
  Node par, cur = node;
  while (cur !is null) {
    par = cur;
    if (val < cur.key) cur = cur.l;
    else cur = cur.r;
  }

  Node chi = new Node(val);
  if (par is null)
    node = chi;
  else if (val < par.key)
    par.l = chi;
  else
    par.r = chi;
}

void inorderWalk(Node node)
{
  if (node.l !is null) inorderWalk(node.l);
  write(" ", node.key);
  if (node.r !is null) inorderWalk(node.r);
}

void preorderWalk(Node node)
{
  write(" ", node.key);
  if (node.l !is null) preorderWalk(node.l);
  if (node.r !is null) preorderWalk(node.r);
}

class Node
{
  int key;
  Node l, r;

  this(int key)
  {
    this.key = key;
  }
}

Measured memory_bytes: 37480
#include <stdio.h>

int main(void)
{
    int i = 1, inp;

    while (1){
        scanf("%d",&inp);
        if (inp != 0){
            printf("Case %d: %d\n", i, inp);
            i++;
        }else{
            break;
        }
    }

    return 0;
}

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

int main() {
  int n,k;
  int ans=0;
  
  cin >> n >> k;
  int man[n] = {};
  
  for(int i=0;i<k;i++){
    int d;
    cin >> d;
    
    for(int j=0;j<d;j++){
      int l;
      cin >> l;
      man[l-1]++;
    }
  }
  
  for(int i=0;i<n;i++){
    if(man[i] == 0){
      ans++;
    }
  }
  
  cout << ans << endl;
      
}


Measured memory_bytes: 3624
<?php
//error_reporting(0);
$N = trim(fgets(STDIN));
//list($a,$b) = explode(" ",trim(fgets(STDIN)));
//$P = explode(" ",trim(fgets(STDIN)));
//$a = array_map('intval',explode(" ",trim(fgets(STDIN))));

for($i=1;$i<=$N;$i++){
    $start = substr($i,0, 1);
    $end = substr($i, -1);
    if($end == 0){
        continue;
    }
    @$map[$start][$end] += 1;
}
$ans=0;
for($i=1;$i<=$N;$i++){
    $start = substr($i,0, 1);
    $end = substr($i, -1);
    if($end == 0){
        continue;
    }
    $ans+=$map[$end][$start];
}
printf("%d\n",$ans);


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

const double PI=3.14159265358979323846;

int main() {
    double A, B, H, M;
    cin >> A >> B >> H >> M;

    double ta, tb;
    ta = (H/12.0 + M/(60.0 * 12.0)) * 2 * PI;
    tb = (M/60.0) * 2 * PI;

    double xa, ya, xb, yb;
    xa = A * cos(ta);
    ya = A * sin(ta);
    xb = B * cos(tb);
    yb = B * sin(tb);

    double ans;
    ans = sqrt((xa - xb) * (xa - xb) + (ya - yb) * (ya - yb));
    cout << fixed << setprecision(12) << ans << endl;

    return 0;
}

Measured memory_bytes: 4100
n = int(input())
lia = list(map(int,input().split()))
lib = list(map(int,input().split()))
mon = sum(lia)
for i in range(n):
    k = lia[i] - lib[i]
    if k <= 0:
        lia[i] = 0
        lia[i+1] += k
        if lia[i+1] < 0:
            lia[i+1] = 0
    else:
        lia[i] -= lib[i]
print(mon-sum(lia))

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

#define INF 1.1e9
#define LINF 1.1e18
#define FOR(i,a,b) for (int i = (a); i < (b); ++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(), (v).end()
#define pb push_back
#define pf push_front
#define fi first
#define se second
#define BIT(x,n) bitset<n>(x)

typedef long long ll;
typedef pair<int,int> P;
typedef pair<P,int> PP;

struct edge {
	int to,cost;
	edge(int t,int c):to(t),cost(c) {}
};

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

ll mypow(ll x,ll n,ll m) {	//xのn乗をmで割った余り
	if(n==0) return 1;
	if(n%2==0) return mypow(x*x%m,n/2,m);
	else return x*mypow(x,n-1,m)%m;
}

//-----------------------------------------------------------------------------

int h,w;
string s[100];

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

	cin>>h>>w;
	REP(i,h) cin>>s[i];
	REP(i,w+2) cout<<"#";
	cout<<endl;
	REP(i,h) {
		cout<<"#";
		REP(j,w) cout<<s[i][j];
		cout<<"#"<<endl;
	}
	REP(i,w+2) cout<<"#";
	cout<<endl;

	return 0;
}


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

int main(){
    int a, b, c, d, e, f;
    std::cin >> a >> b >> c >> d >> e >> f;
    a *= 100;
    b *= 100;

    // 作れるかどうか
    long double maxConcent = 0.0;
    int outWater = a;
    int outSugar = 0;
    for(int i = 0; i <= f / a; i++){
        for(int j = 0; j <= f / b; j++){
            for(int k = 0; k <= f / c; k++){
                for(int l = 0; l <= f / d; l++){
                    if(a * i + b * j == 0) continue;
                    if(a * i + b * j + c * k + d * l > f) continue;
                    int water = a * i + b * j;
                    int sugar = c * k + d * l;
                    // 溶け残りNG
                    long double maxSugar = (water * e) / 100.0;
                    if(maxSugar < sugar) continue;
                    if(maxConcent < (100.0 * sugar) / (1.0 * (water + sugar))){
                        maxConcent = (100.0 * sugar) / (1.0 * (water + sugar));
                        outWater = water;
                        outSugar = sugar;
                    }
                }
            }
        }
    }

    std::cout << outWater + outSugar << " " << outSugar << std::endl;
    return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner stdIn = new Scanner(System.in);

		while(true){
			int p1 = stdIn.nextInt();
			int p2 = stdIn.nextInt();
			int p3 = stdIn.nextInt();
			if(p1==0&&p2==0&&p3==0){
				return;
			}
			int p = p1+p2+p3;
			boolean[] ok = new boolean[p+1];
			boolean[] ng = new boolean[p+1];
			int n = stdIn.nextInt();
			int[][] logg = new int[n][4];
			for(int i=0;i<n;i++){
				logg[i] = new int[4];
				int a = stdIn.nextInt();
				int b = stdIn.nextInt();
				int c = stdIn.nextInt();
				int judge = stdIn.nextInt();
				logg[i][0] = a;
				logg[i][1] = b;
				logg[i][2] = c;
				logg[i][3] = judge;
				if(judge==1){
					ok[a] = true;
					ok[b] = true;
					ok[c] = true;
				}
			}
			for(int i=0;i<n;i++){
				if(logg[i][3]==0){
					int a = logg[i][0];
					int b = logg[i][1];
					int c = logg[i][2];
					if(ok[a]&&ok[b]){
						ng[c] = true;
					}
					else if(ok[a]&&ok[c]){
						ng[b] = true;
					}
					else if(ok[b]&&ok[c]){
						ng[a] = true;
					}
				}
			}
			for(int i=1;i<=p;i++){
				//			System.out.println(ok[i]+"\t"+ng[i]);
				if(ok[i]){
					System.out.println(1);
				}
				else if(!ng[i]){
					System.out.println(2);
				}
				else{
					System.out.println(0);
				}
			}
		}
	}
}

Measured memory_bytes: 28320
import java.io.IOException;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) throws IOException {

		new Main().run();
	}

	private void run() throws IOException {
		Scanner scanner = new Scanner(System.in);
		while (true) {
			w = scanner.nextInt();
			h = scanner.nextInt();
			if ((w | h) == 0)
				break;
			map = new char[h][w];
			v = new boolean[h][w];
			for (int i = 0; i < h; i++) {
				map[i] = scanner.next().toCharArray();
				for (int j = 0; j < w; j++) {
					if (map[i][j] != '.') {
						v[i][j] = true;
					}
				}
			}
			ans = new int[4];
			for (int i = 0; i < h; i++)
				for (int j = 0; j < w; j++) {
					u = 0;
					if (v[i][j])
						continue;
					int ret  = dfs(i, j);
					ans[u] += ret;
				}
			System.out.println(ans[1] + " " + ans[2]);
		}
	}

	private int dfs(int y, int x) {
		int ret = 0;
		if (v[y][x])
			return ret;
		v[y][x] = true;
		ret++;
		for (int[] m : move) {
			int ny = y + m[0];
			int nx = x + m[1];
			if (!isOK(ny, nx))
				continue;
			if (map[ny][nx] == 'B') {
				u |= 1;
				continue;
			} else if (map[ny][nx] == 'W') {
				u |= 2;
				continue;
			}
			ret += dfs(ny, nx);
		}
		return ret;
	}

	private boolean isOK(int y, int x) {
		return 0 <= y && y < h && 0 <= x && x < w;
	}

	int w, h, u, ans[];
	boolean[][] v;
	char[][] map;
	int[][] move = { { -1, 0 }, { 0, -1 }, { 0, 1 }, { 1, 0 } };
}

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

using namespace std;

int main()
{
	int n;
	cin >> n;
	vector<int> a(n + 1), b(n);
	for (int i = 0; i <= n; i++) {
		cin >> a[i];
	}
	for (int i = 0; i < n; i++) {
		cin >> b[i];
	}

	long long ans = 0;
	int t;
	for (int i = 0; i < n; i++) {
		t = min(a[i], b[i]);
		ans += t;
		b[i] -= t;
		t = min(a[i + 1], b[i]);
		ans += t;
		a[i + 1] -= t;
	}
	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
#define fi first
#define se second
#define re return
#define pb emplace_back
#define em emplace
#define er erase
#define all(x) (x).begin(), (x).end()
#define in(v); { for (auto &i : v) cin >> i; }
#define out(v); { for (auto &i : v) cout << i << ' '; cout << endl; }

#define int long long

using namespace std;
//using namespace __gnu_cxx;
//using namespace __gnu_pbds;

const long long INFll = 1e18;



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

    int k = 0;
    while (n) {
        n /= 2; k++;
    }

    cout << (1ll << k) - 1;
}

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

    solve();
}


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

using namespace std;
using llint = long long;

#define LOG(x) cout << "# " << #x <<" => "<< (x) <<endl

int n, m, ans;
vector<int> k;

int main() {
    // Input
    cin >> n >> m;

    k.resize(n);
    vector<vector<int> > a(n);
    
    for (int i = 0; i < n; ++i) {
        cin >> k.at(i);

        a.at(i).resize(k.at(i));
        for (int j = 0; j < k.at(i); ++j) {
            cin >> a.at(i).at(j);
            --a.at(i).at(j);
        }
    }

    // Solve
    for (int i = 0; i < m; ++i) {
        bool flag1 = true;
        for (int j = 0; j < n; ++j) {
            bool flag2 = false;
            for (auto x : a.at(j)) {
                if (x == i)
                {
                    flag2 = true;
                }
             }

             flag1 = flag1 && flag2;
        }

        if (flag1)
        {
            ans++;
        }
    }

    // Output
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
import math
a,b,h,m=map(int,input().split())
hkakudo=h*30+(m/2)
mkakudo=m*6
if hkakudo == 0:
    hkakudo = 360
if mkakudo == 0:
    mkakudo = 360
kakudo = abs(hkakudo-mkakudo)
print(math.sqrt(a**2+b**2-(2*a*b*math.cos(math.radians(kakudo)))))

Measured memory_bytes: 9512
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(n) for (ll i = 0; i < n; ++i)
#define rep2(i, n) for (ll i = 0; i < n; ++i)
#define rep3(i, a, b) for (ll i = a; i < b; ++i)
#define rep4(i, a, b, c) for (ll i = a; i < b; i += c)
#define erep(n) for (ll i = 0; i <= n; ++i)
#define erep2(i, n) for (ll i = 0; i <= n; ++i)
#define erep3(i, a, b) for (ll i = a; i <= b; ++i)
#define erep4(i, a, b, c) for (ll i = a; i <= b; i += c)
#define rrep(i, a, b) for (ll i = a; i > b; --i)
#define rrep2(i, a, b, c) for (ll i = a; i > b; i -= c)
#define errep(i, a, b) for (ll i = a; i >= b; --i)
#define errep2(i, a, b, c) for (ll i = a; i >= b; i -= c)
#define print(a) cout << a << endl;
#define printVec(v) printf("{"); for (const auto& i : v) { std::cout << i << ", "; } printf("}\n");
#define cin(x) cin >> x;
const ll MOD = 1000000007;
const double PI = 3.14159265358979323846264338327950;
inline int newline() { putchar('\n'); return 0; }

int main() {
    ll a;
    double b;
    cin(a); cin(b);

    ll ib = b * 100 + 0.5;
    a *= ib;
    a /= 100;

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

Measured memory_bytes: 3788
#!/usr/bin/env python3
import sys



# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    N,L = [ int(s) for s in input().split() ]
    pie_all = 0
    pie_taste = [0]* N
    for i in range(N):
        pie_taste[i] = L + (i+1) -1
        pie_all += pie_taste[i]

    min_index = 0
    min_value = 100000000000
    pie_mean = pie_all / N
    for i in range(N):
        if min_value > abs(pie_taste[i]):
            min_index = i
            min_value = abs(pie_taste[i])

    print(pie_all - pie_taste[min_index])

if __name__ == '__main__':
    main()


Measured memory_bytes: 3064
/*********************************************
* 20.05.19 AtCoder Beginner Contest 153
* 
* 
*********************************************/

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,n) for(int (i)=1;(i)<=(n);i++)
#define rez(i,n) for(int (i)=0;(i)<(n);i++)
#define et "\n"

class CRun{
private:
    struct {
    }gv;
public:
    char problem_num;
    
    CRun(){
        problem_num = 'B';
    }; 
    ~CRun(){};
    void build();
    void solve_A(); void solve_B(); void solve_C(); 
    void solve_D(); void solve_E(); void solve_F();
};

void CRun::build(){
    
}

/*********************************************
A - Serval vs Monster
敵の体力H
味方の攻撃1回で体力をA減らせる
勝つための攻撃回数は？
*********************************************/
void CRun::solve_A(){
    int H; cin >> H;
    int A; cin >> A;
    
    int ans = 0;
    //ans += (H % A > 0 ? H / A + 1 : H / A);
    ans += (H - 1) / A + 1;
    cout << ans;
}

/*********************************************
B - Common Raccoon vs Monster
モンスターの体力H
N種類の攻撃で敵のHPをAN減らせる
同じ攻撃を使わずに敵を倒せるか？
*********************************************/
void CRun::solve_B(){
    
    int H; cin >> H;
    int N; cin >> N;
    int A[N]; rez(i,N) cin >> A[i];
    
    int sum = 0;
    for (auto &ix : A) sum += ix;
    
    string ans[] = {"Yes", "No"};
    if (sum >= H) {
        cout << ans[0];
    }
    else {
        cout << ans[1];
    }
    
}

/*********************************************

*********************************************/
void CRun::solve_C(){
    
}

/*********************************************

*********************************************/
void CRun::solve_D(){
    
}

/*********************************************

*********************************************/
void CRun::solve_E(){
    
}

/*********************************************

*********************************************/
void CRun::solve_F(){
    
}

int main(){
    CRun run;
    run.build();
    switch (run.problem_num) {
        case 'A' : run.solve_A();
        case 'B' : run.solve_B();
        case 'C' : run.solve_C();
        case 'D' : run.solve_E();
        case 'E' : run.solve_D();
        case 'F' : run.solve_F();
    }
}



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

using namespace std;

int main(void){

  string S, T;

  cin >> S;
  cin >> T;

  for(int i=0; i<S.size(); i++){
    if(T[i]!=S[i]){
      cout << "No" << endl;
      break;
    }
    if(i==S.size()-1 && S.size()+1==T.size()){
      cout << "Yes" << endl;
    }
  }

  return 0;
}


Measured memory_bytes: 3624
#include<bits/stdc++.h>
using namespace std;
int main(){
    int two[12]={1,2,4,8,16,32,64,128,256,512,1024,2048};
    
    int n,m,ans=0;bool flag=true;
    cin>>n>>m;
    int s[20][20],p[m],k[m];
    for(int i=0;i<m;i++)
    {
        cin>>k[i];
        for(int j=0;j<k[i];j++)
        {
            cin>>s[i][j];
            s[i][j]--;
        }
    }
    for(int i=0;i<m;i++)
    cin>>p[i];
    int b=1;
    for(int i=0;i<n;i++)
    b*=2;
    for(int i=0;i<b;i++)
    {
        flag=true;
        for(int j=0;j<m;j++)
        {
            int counter=0;
            for(int h=0;h<k[j];h++)
            {
                if((two[s[j][h]]&i)>0)
                counter++;
            }
            if(counter%2!=p[j]){
                flag=false;
            }
        }
        if(flag)
        ans++;
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 256
from collections import defaultdict, deque, Counter
from heapq import heappush, heappop, heapify
import math
import bisect
import random
from itertools import permutations, accumulate, combinations, product
import sys
import string
from bisect import bisect_left, bisect_right
from math import factorial, ceil, floor
from operator import mul
from functools import reduce


sys.setrecursionlimit(2147483647)
INF = 10 ** 20
def LI(): return list(map(int, sys.stdin.buffer.readline().split()))
def I(): return int(sys.stdin.buffer.readline())
def LS(): return sys.stdin.buffer.readline().rstrip().decode('utf-8').split()
def S(): return sys.stdin.buffer.readline().rstrip().decode('utf-8')
def IR(n): return [I() for i in range(n)]
def LIR(n): return [LI() for i in range(n)]
def SR(n): return [S() for i in range(n)]
def LSR(n): return [LS() for i in range(n)]
def SRL(n): return [list(S()) for i in range(n)]
def MSRL(n): return [[int(j) for j in list(S())] for i in range(n)]
mod = 1000000007

class UnionFind:
    def __init__(self, n):
        # 負  : 根であることを示す。絶対値はランクを示す
        # 非負: 根でないことを示す。値は親を示す
        self.table = [-1] * n
        self.size = [1] * n
        self.group_num = n

    def root(self, x):
        if self.table[x] < 0:
            return x
        else:
            self.table[x] = self.root(self.table[x])
            return self.table[x]

    def get_size(self, x):
        r = self.root(x)
        return self.size[r]

    def union(self, x, y):
        r1 = self.root(x)
        r2 = self.root(y)
        if r1 == r2:
            return
        # ランクの取得
        d1 = self.table[r1]
        d2 = self.table[r2]
        if d1 <= d2:
            self.table[r2] = r1
            self.size[r1] += self.size[r2]
            if d1 == d2:
                self.table[r1] -= 1
        else:
            self.table[r1] = r2
            self.size[r2] += self.size[r1]
        self.group_num -= 1


n, m = LI()
A = [(a, i) for i, a in enumerate(LI())]
heapify(A)
uf = UnionFind(n)
for x, y in LIR(m):
    uf.union(x, y)

k = uf.group_num
if (k - 1) * 2 > n:
    print('Impossible')
else:
    ans = 0
    ret = 0
    ret2 = 0
    D = defaultdict(int)
    while ret + ret2 < (k - 1) * 2:
        a, i = heappop(A)
        r = uf.root(i)
        if not D[r]:
            D[r] = 1
            ret += 1
            ans += a
        else:
            if ret2 < (k - 1) * 2 - k:
                ret2 += 1
                ans += a
    print(ans)



Measured memory_bytes: 126384
#!/usr/bin/env python3

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

count = 0
for i in range(1, len(p)-1):
    min_ = min(p[i-1], p[i], p[i+1])
    max_ = max(p[i-1], p[i], p[i+1])
    if p[i] != min_ and p[i] != max_:
        count += 1
print(count)


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

int main(){
  int a,b,A,B;
  cin >> a >> b;
  A = a % 2,B = b % 2;
  if(A == 0 || B == 0){
    cout << "Even" << endl;
  }
  else {
    cout << "Odd" << endl;
  }
}

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

#define vi vector<int>
#define ii pair<int, int>
#define vii vector<ii>
#define vvi vector<vi>
#define vb vector<bool>
#define pb push_back
#define mp make_pair
#define x first
#define y second
#define INF int(1e9)
#define LL long long int 

using namespace std;

int main () {
    ios_base::sync_with_stdio(false);

    LL n, k;

    cin >> n >> k;

    while(1){
        LL val = n/k;

        if(val==0)
            val = 1;

        LL new_n = abs(n - (k*val));
        if(new_n>=n)
            break;

        n = new_n;
    }
    
    cout << n << endl;

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <bitset>
#include <string>
#include <cmath>
#include <complex>
#include <numeric>
#include <cassert>

#include <vector>
#include <array>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <deque>
#include <utility>

#define int64 long long
#define uint64 unsigned long long
using namespace std;

int main()
{
	int64 nn, mm;
	cin >> nn >> mm;
	vector<int64> aa(nn + 1, -1);
	int64 ss, cc;
	for(int64 ii = 0;ii < mm;ii++)
	{
		cin >> ss >> cc;
		if(aa[ss] == -1 || aa[ss] == cc)
		{
			aa[ss] = cc;
		}
		else
		{
			puts("-1");
			return 0;
		}
	}
	if(aa[1] == 0 && nn != 1)
	{
		puts("-1");
		return 0;
	}
	else if(aa[1] == -1 && nn == 1)
	{
		aa[1] = 0;
	}
	else if(aa[1] == -1)
	{
		aa[1] = 1;
	}
	for(int64 ii = 2;ii <= nn;ii++)
	{
		if(aa[ii] == -1)
		{
			aa[ii] = 0;
		}
	}
	for(int64 ii = 1;ii <= nn;ii++)
	{
		cout << aa[ii];
	}
	cout << endl;
	return 0;
}


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

int n, m;
vector < vector < pair < int, int64_t > > > g(100001);
vector < bool > used(100001, 0);
map < int, int64_t > d;
bool ok = 1;

void dfs (int u) {
    used[u] = 1;
    for (auto edge: g[u]) {
        int v = edge.first;
        int64_t w = edge.second;
        if (!used[v]) {
            d[v] = d[u] + w;
            dfs(v);
        }
        else if (d[u] + w != d[v]) 
            ok = 0;
    }
}

signed main () {
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    
    cin >> n >> m;
    for (int i = 0; i < m; ++i) {
        int u, v;
        int64_t w;
        cin >> u >> v >> w;
        g[u].push_back(make_pair(v, w));
        g[v].push_back(make_pair(u, -w));
    }
    for (int i = 1; i <= n; ++i) {
        if (!used[i]) {
            d.clear();
            d[i] = 0;
            dfs(i);
        }
    }
    if (ok) 
        cout << "Yes\n";
    else
        cout << "No\n";
}


Measured memory_bytes: 25344
#include "bits/stdc++.h"
using namespace std;
typedef long long int ll;
#define m 1000000007
#define MAXN 1000001
#define satya ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define cil(a,b) (((a-1)/b)+1)
//#define init int t;cin>>t;while(t--)
#define in(a) ll a;scanf("%lld",&a)
#define ine(a,b) ll a,b;scanf("%lld lld",&a,&b)



ll spf[MAXN]; 

void sieve1() 
{ 
	spf[1] = 1; 
	for (int i=2; i<MAXN; i++) 

		spf[i] = i; 

	for (int i=4; i<MAXN; i+=2) 
		spf[i] = 2; 

	for (int i=3; i*i<MAXN; i++) 
	{ 
		if (spf[i] == i) 
		{ 
			for (int j=i*i; j<MAXN; j+=i) 

				if (spf[j]==j) 
					spf[j] = i; 
		} 
	} 
} 

ll  getFactorization(int x) 
{ 
	vector<int> ret; 
	long long int p=0;
	while (x != 1) 
	{ 
		ret.push_back(spf[x]); 
		x = x / spf[x]; 
	} 
	sort(ret.begin(),ret.end());
	for(int i=0;i<ret.size()-1;i++) 
	{
	    if(ret[i]!=ret[i+1])
	    p=p+ret[i];
	}
	p=p+ret[ret.size()-1];
	return p;
} 

ll d[1000055],u=0;
void Sieve(int n) 
{ 
	bool prime[n+1]; 
//	ll u=0;
	memset(prime, true, sizeof(prime)); 

	for (int p=2; p*p<=n; p++) 
	{ 
		if (prime[p] == true) 
		{ 
			for (int i=p*2; i<=n; i += p) 
				prime[i] = false; 
		} 
	} 

	for (int p=2; p<=n; p++) 
	if (prime[p]) 
	{
	    d[u]=p;
	    u++;
	}
} 

ll minverse(ll x,ll n,ll M)
{
    if(n==0)
        return 1;
    else if(n%2 == 0)        //n is even
        return minverse((x*x)%M,n/2,M);
    else                             //n is odd
        return (x*minverse((x*x)%M,(n-1)/2,M))%M;

}
ll prime(ll n){
    ll i;
    if(n==1||n==0)
    return 0;
    for(i=2;i<sqrt(n);i++)
    {
        if(n%i==0)
        return 0;
    }
    return 1;
}
int main() {
       satya;
     //sieve1(); 
     //Sieve(100);
    	   ll n,k;
    	   cin>>n;
            ll a[n],i;
            vector<ll>v;
            for(i=0;i<n;i++){
            cin>>a[i];
            v.push_back(a[i]);}
            sort(v.begin(),v.end());
            if(n==1)
            cout<<0<<endl;
            else{
            for(i=0;i<n;i++)
            {
                if(a[i]==v[v.size()-1])
                cout<<v[v.size()-2]<<endl;
                else
                cout<<v[v.size()-1]<<endl;
            }
            }
            
    return 0;
}

Measured memory_bytes: 4848
#include<iostream>
using namespace std;
int main()
{
	long long A, B,K,a[100];
	int count = 0;
	cin >> A >> B >> K;
	for (int i = 0; i < K; i++)
	{
		if (A + i <= B) {
			printf("%d\n", A + i);
			a[i] = A + i;
		}
		else
		{
			count = i - 1;
			break;
		}
		count = i;
	}
	for (int i = K - 1; i >= 0; i--)
	{
		if (B - i <= a[count])
			continue;
		for (int j = 0; j < K; j++)
		{
			if (a[j] == B - i)
				break;
		}
		printf("%d\n", B - i);
	}
	return 0;
}

Measured memory_bytes: 256
var
  n,i,x,maxo,maxj,oi,ji,maxo2,maxj2:longint;
  j,o:array[1..100000]of longint;
begin
  read(n);
  for i:=1 to n do
    begin
	  read(x);
	  if i mod 2=0 then inc(o[x])
	  else inc(j[x]);
	end;
  maxo:=-maxlongint;
  maxj:=-maxlongint;
  for i:=1 to 100000 do
    begin
    if o[i]>maxo then begin maxo:=o[i]; oi:=i; end;
	if j[i]>maxj then begin maxj:=j[i]; ji:=i; end;
	end;
  if oi=ji then begin
    o[oi]:=-maxlongint;
	j[ji]:=-maxlongint;
  maxo2:=-maxlongint;
  maxj2:=-maxlongint;
  for i:=1 to 100000 do
    begin
    if o[i]>maxo2 then begin maxo2:=o[i]; oi:=i; end;
	if j[i]>maxj2 then begin maxj2:=j[i]; ji:=i; end;
	end;
  if maxo2>=maxj2 then write(n-maxo2-maxj)
  else write(n-maxj2-maxo);
  end
  else write(n-maxo-maxj);
end.

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

int main() {
	int vec[] = { 1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51 };
	int K;
	cin >> K;
	cout << vec[K - 1] << endl;
	return 0;
}

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

int main() {
    ll a,b,c;
    cin>>a>>b>>c;
    ll cap=a-b;
    if(cap>=c){
        cout<<0<<endl;
    }else{
        cout<<c-cap<<endl;
    }
}


Measured memory_bytes: 764
#include<bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define rep(i, n) for(int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;
template<class T> istream& operator >> (istream& s, vector<T>& v)
{ for (T& x: v) { s >> x; } return s;}

int main(){
    char s; cin >> s;
    if(s == 'A') cout << 'T' << endl;
    else if(s == 'T') cout << 'A' << endl;
    else if(s == 'G') cout << 'C' << endl;
    else if(s == 'C') cout << 'G' << endl;
    return 0;
}

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

struct Fast {Fast() {std::cin.tie(0); ios::sync_with_stdio(false);}} fast;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using pii = pair<int, int>;
using vll = vector<long long>;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define mp make_pair
#define MOD 1000000007

int main() {
    string b; cin >> b;
    if (b == "A") cout << "T" << endl;
    else if (b == "T") cout << "A" << endl;
    else if (b == "G") cout << "C" << endl;
    else cout << "G" << endl;
}


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

set <string> s;

int main()
{
    int n;

    cin >> n;
    rep(i, n) {
        string s1;
        cin >> s1;
        s.insert(s1);
    }

    std::cout << s.size() << endl;

    return(0);
}


Measured memory_bytes: 19196
#include<bits/stdc++.h>
using namespace std;
typedef double db;
typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> pii;
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define pw(x) (1ll << (x))
#define sz(x) ((int)(x).size())
#define all(x) (x).begin(),(x).end()
#define rep(i,l,r) for(int i=(l);i<(r);++i)
#define per(i,l,r) for(int i=(r)-1;i>=(l);--i)
#define dd(x) cout << #x << " = " << x << ", "
#define de(x) cout << #x << " = " << x << endl

//-----
const int N = 50 + 6, B = 2500;
int n, a, x[N];
ll dp[N][N * 100];
int main() {
	std::ios::sync_with_stdio(false);
	std::cin.tie(0);
  cin >> n >> a;
  rep(i, 1, n + 1) cin >> x[i], x[i] -= a;
  dp[0][B + 0] = 1;
  rep(i, 0, n + 1) rep(j, 0, 2 * B) if (dp[i][j]) {
  	dp[i + 1][j + x[i + 1]] += dp[i][j];
  	dp[i + 1][j] += dp[i][j];
	}
	cout << dp[n][B] - 1;
	return 0;
}

Measured memory_bytes: 1024
#include <stdio.h>
#define N_MAX 50

int main(void)
{
     int hand[N_MAX], wan, n, i, j;

     while(1){
	  scanf("%d %d",&n,&wan);
	  if(n+wan==0) return 0;
	  
	  for(i=0; i<n; i++) hand[i]=0;
	  
	  i=0;
	  while(1){
	       if(wan) wan--, hand[i]++;
	       else wan+=hand[i], hand[i]=0;

	       if(!wan){
		    for(j=0; j<n; j++) if(j!=i && hand[j]) break;
		    if(j==n) break;
	       }

	       i = (i+1)%n;
	  }

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

Measured memory_bytes: 408
#define _CRT_SECURE_NO_WARNINGS
#include<bits/stdc++.h>
#define fi first
#define se second
#define pb push_back
#define E "\n"

using namespace std;
const long long MOD = (long long)1e9 + 7;

long long x;

int main()
{
	ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	cin >> x;
	long long y = 100;
	int cnt = 0;
	while (1) {
		if (y >= x) break;
		y = y + y / 100;
		cnt++;
	}
	cout << cnt << E;
	//system("pause");
	return 0;
}

Measured memory_bytes: 3612
#include<bits/stdc++.h>
#define __ ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define ll long long int
#define N 1005
#define M 1000000007
#define mod 998244353
using namespace std;

int main()
{
    __

    int n,m,tot=0,ans=0;

    double tmp,avg,num=100.0;

    cin >> n >> m;

    int a[n];

    for(int i=0;i<n;i++) cin >> a[i],tot+=a[i];

    tmp = num/(m*4.0);

    for(int i=0;i<n;i++)
    {
        avg = (a[i]*num)/tot;

        if(avg>=tmp) ans++;
    }

    if(ans>=m) cout << "Yes\n";

    else cout << "No\n";

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h> 
using namespace std;
#define rep(i, N) for(int i=0; i<N; i++)
typedef long long ll;
#define dump(x) cerr<<#x<<"="<<x<<endl
using P = pair<int, int>;

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

    set<int> st;
    rep(i, k){
        if(a+i<=b) st.insert(a+i);
        if(b-i>=a) st.insert(b-i);
    }

    for(auto x: st){
        cout << x << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define dum(x) cout<<#x<<'='<<x<<endl
#define ll long long
using namespace std;

int gcd(int a, int b) {
  if (a < b) swap(a, b);

  int r;
  while (b > 0) {
    r = a % b;
    a = b;
    b = r;
  }
  return a;
}

int main() {
  int n, x;
  cin >> n >> x;
  vector<int> v(n);
  for (int i = 0; i < n; ++i) {
    int c; cin >> c;
    v.at(i) = abs(x - c);
  }

  sort(v.begin(), v.end());
  int tmp;
  if (n == 1) {
    tmp = v.at(0);
    cout << tmp << endl;
    return 0;
  } else {
    for (int i = 0; i < n; ++i) {
      if (i == 0) {
        tmp = gcd(v.at(0), v.at(1));
      }
      tmp = gcd(tmp, v.at(i));
    }
    cout << tmp << endl;
    return 0;
  }
}

Measured memory_bytes: 640
#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 ll long long int
#define ordered_set tree < ll ,  null_type ,  less<ll> ,  rb_tree_tag ,  tree_order_statistics_node_update >
//added two more functions to set
//(1)*(set.find_by_order(k))[kth element in the sorted set] 
//(2)set.order_of_key(k)[count of elements strictly less than k]
typedef vector< int > vi;
typedef vector< ll > lvi;
typedef vector< vi > vvi;
typedef vector< lvi > lvvi;
typedef pair< int,int > ii;
typedef pair< ll,ll > lii;
#define sz(a) int((a).size())
#define pb push_back
#define all(c) (c).begin(),(c).end()
#define tr(c,i) for(auto i = (c).begin(); i != (c).end(); i++)//remember i is an iterator
#define present(c,x) ((c).find(x) != (c).end())//for sets,maps,multimaps
#define cpresent(c,x) (find(all(c),x) != (c).end())//for vectors
#define tc(t) int (t); cin>>(t);while((t)--)
#define ff first
#define ss second
#define mp make_pair
#define ld long double
#define ull unsigned long long int
#define mod 1000000007
int main()
{
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);	
	ld l;
	cin>>l;
	ld x=l/3;
	cout<<fixed<<setprecision(8)<<x*x*x<<endl;
	return 0;
}

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

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

	vector<vector<int>> vec(M);

	for (int i = 0; i < M; i++) {
		int k; cin >> k;
		vec[i].resize(k);
		for (int j = 0; j < k; j++) {
			cin >> vec[i][j];
			vec[i][j]--;
		}
	}
	vector<int>p(M);
	for (int i = 0; i < M; i++) cin >> p[i];

	int ans = 0;
	for (int i = 0; i < (1<<N); i++) {
		bool on = true;
		for (int j = 0; j < M; j++) {
			int c = 0;
			for (auto x : vec[j]) {
				if ((i >> x) & 1)  c++;
			}
			c %= 2;
			if (c != p[j]) on = false;
		}
		if (on)ans++;
	}
	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 256
import sys
input = lambda: sys.stdin.readline().rstrip()
input_nums = lambda: list(map(int, input().split()))

n, a, b = input_nums()

r = n // (a + b)
q = n % (a + b)

ans = r * a
if q >= a:
    ans += a
else:
    ans += q
print(ans)

Measured memory_bytes: 38256
#include <stdio.h>
#include <iostream>

using namespace std;

int main() {

	int mae = 4280;
	int ryoukin;
	int water;

	while (1) {
		cin >> water;
		if (water == -1) {
			break;
		} else {
			if (water < 10) {
				ryoukin = 1150;
			} else {
				water = water - 10;
				if (water < 10) {
					ryoukin = 1150 + 125 * water;
				} else { 
					water = water - 10;
					if (water < 10) {
						ryoukin = 1150 + 125 * 10 + 140 * water;
					} else {
						water = water - 10;
						ryoukin = 1150 + 125 * 10 + 140 * 10 + 160 * water;
					}
				}
			}
		}
		cout << mae - ryoukin << endl;
	}

	return 0;
}

Measured memory_bytes: 1160
#include<bits/stdc++.h>
using namespace std;
long long n;
int main()
{
    scanf("%lld",&n);
    if(n==2) {printf("1\n");return 0;}
    long long m;
    int cnt=0;
    for(long long i=2;i*i<=n;i++)
    {
        m=n;
        if(m%i) continue;
        while(m%i==0) m=m/i;
        if(m%i==1) cnt++;
    }
    n--;
    for(long long j=2;j*j<=n;j++)
    {
        if(n%j==0)
        {
            if(j*j==n) cnt++;
            else cnt+=2;
        }
    }
    printf("%d\n",cnt+2);
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<bits/stdc++.h>
#include<iomanip>
using namespace std;
typedef long long ll;
typedef long  l;
typedef pair<int,int> P;
#define rep(i,n) for(int i=0;i<n;i++)
#define fs first
#define sc second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define ALL(A) A.begin(),A.end()
const int INF=1000000001;
const double PI=3.141592653589;


int main(){
  int a,b,c,x; cin>>a>>b>>c>>x;
  int ans=0;
  rep(i,a+1){
    rep(j,b+1){
      rep(k,c+1){
        if(500*i+100*j+50*k==x)
        ans++;
      }
    }
  }
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
template<class T> inline bool isPrimeNumber(T n)
  {if(n<=1)return false;for (T i=2;i*i<=n;i++) if (n%i==0) return false;return true;} 
int main(){
  int x;
  cin>>x;
  if(x == 2 || x == 3){
    cout<<x<<endl;
    return 0;
  }
  for(int i = x; ; i++){
    if(i % 2==0)continue;
    if(isPrimeNumber(i)){
      cout<<i<<endl;
      return 0;
    }
  }
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
	int n,m;
	cin>>n>>m;
	
	int ac[n+1], wa[n+1];
	memset(ac, 0, sizeof(ac));//0,initial,-1 has AC
	memset(wa, 0, sizeof(wa));//0,initial,-1 has AC

	int cnt_ac=0, cnt_wa=0;
	for(int i=1;i<=m;i++){
		int idx;
		string res;
		cin>>idx>>res;
		if(res=="WA" && ac[idx]!=-1) wa[idx]++;
		else if(res=="AC" && ac[idx]!=-1){
			cnt_ac++;
			cnt_wa+=wa[idx];
			ac[idx]=-1;
		}
	}
	cout<<cnt_ac<<" "<<cnt_wa<<endl;
	return 0;
} 

Measured memory_bytes: 1024
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
 
using namespace __gnu_pbds;
using namespace std;
 
typedef long long int ll;
typedef unsigned long long int sll;
typedef  double ld;
#define A 1000000007ll
#define D 100000000000000ll
#define B 998244353ll
#define C 1000000000000000000ll
#define FAST ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define oset tree<ll, null_type,less_equal<ll>, rb_tree_tag,tree_order_statistics_node_update> 
#define pb push_back
#define pf push_front
#define pob pop_back
#define pof pop_front
#define mxe(v) *max_element(v.begin(),v.end())
#define mne(v) *min_element(v.begin(),v.end())
#define bs binary_search
#define lb lower_bound
#define ub upper_bound
#define ve vector
#define br break
#define PI acos(-1)
#define subt cerr << "Time : " << 1000 * ((double)clock()) / (double)CLOCKS_PER_SEC << "ms\n" 

int main() 
{
    FAST;
    ll a[32]={1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
    ll k;
    cin>>k;
    cout<<a[k-1];
    subt;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <cstring>
using namespace std;
int main()
{
	string h[2] = {"qwertasdfgzxcvb", "yuiophjklnm"};
	char s[33];
	int n, r, i;
	while (cin >> s)
	{
		if (s[0] == '#') break;
		n = ((h[0].find(s[0], 0) != string::npos) ? 0 : 1);
		r = 0;
		for (i = 1; i < strlen(s); i++)
			if (h[n].find(s[i], 0) == string::npos)
				n = ((n == 0) ? 1 : 0), r++;
		cout << r << endl;
	}
}

Measured memory_bytes: 0