akhauriyash/Code-Regression huggingface dataset:
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author Joy
 */

#include <bits/stdc++.h>

#define REP(i, N) for (ll i = 0; i < (N); ++i)
#define ALL(x) (x).begin(), (x).end()
#define MOD 1000000007
#define INF ll(1e9)
#define INFL ll(1e18)
#define PB push_back
#define MP make_pair
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
ll gcd(ll x, ll y) { return y ? gcd(y, x % y) : x; }
int ctoi(char c) {return c - '0';}

class AKthTerm {
public:
	void solve(std::istream& in, std::ostream& out) {
	    int 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};
	    int K; in >> K;
	    out << a[K-1] << '\n';
	}
};


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

	AKthTerm solver;
	std::istream& in(std::cin);
	std::ostream& out(std::cout);
	solver.solve(in, out);
	return 0;
}


Measured memory_bytes: 256
import           Data.Time.Calendar (Day, fromGregorian)

main :: IO ()
main = print . solve . parse =<< getLine

data Result = Heisei | TBD deriving Show

solve :: Day -> Result
solve d = if d <= lastOfHeisei then Heisei else TBD
  where
    lastOfHeisei = fromGregorian 2019 4 30

parse :: String -> Day
parse [y1, y2, y3, y4, '/', m1, m2, '/', d1, d2] =
  fromGregorian (read [y1, y2, y3, y4]) (read [m1, m2]) (read [d1, d2])
parse _ = error "unknown format"


Measured memory_bytes: 508
#include <iostream>
#include <fstream>
#include <string> 
#include <cstring>
#include <cmath>  
#include <cstdlib>
#include <ctime>
#include <vector>
#include <algorithm>
#include <numeric>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <deque>
#include <functional>
#include <cctype>
#include <list>
//#include <boost/multiprecision/cpp_int.hpp>

#define BIT(a) (1 << (a))
#define EPS (1e-10)

using namespace std;
//using namespace boost::multiprecision;

const long long MOD = 1000000007;
const int COUNTER_CLOCKWISE = 1;
const int CLOCKWISE = -1;
const int ONLINE_BACK = 2;
const int ONLINE_FRONT = -2;
const int ON_SEGMENT = 0;

class Point{
    public:
    double x, y;

    Point(double x = 0, double y = 0): x(x), y(y) {}
    
    Point operator+(Point p){return Point(x + p.x, y + p.y);}
    Point operator-(Point p){return Point(x - p.x, y - p.y);}
    Point operator*(double a){return Point(a * x, a * y);}
    Point operator/(double a){return Point(x / a, y / a);}

    bool operator < (const Point &p) const {
        return y != p.y ? y < p.y : x < p.x;
    }

    double norm(){return x * x + y * y;}
};
typedef Point Vector;
typedef vector<Vector> Polygon;

double cross(Vector a, Vector b){
    return a.x*b.y - a.y*b.x;
}

double dot(Vector a, Vector b){
    return a.x * b.x + a.y * b.y;
}

int ccw(Point p0, Point p1, Point p2){
    Vector a = p1 - p0;
    Vector b = p2 - p0;
    if (cross(a, b) > EPS)return COUNTER_CLOCKWISE;
    if (cross(a, b) > -EPS)return CLOCKWISE;
    if (dot(a, b) < -EPS)return ONLINE_BACK;
    if (a.norm() < b.norm())return ONLINE_FRONT;

    return ON_SEGMENT;
}

Polygon andrewScan(Polygon s){
    Polygon u, l;
    if (s.size() < 3) return s;
    sort(s.begin(), s.end());
    u.push_back(s[0]);
    u.push_back(s[1]);
    l.push_back(s[s.size()-1]);
    l.push_back(s[s.size()-2]);
    
    for (size_t i = 2; i < s.size(); i++){
        for (size_t n = u.size(); n >= 2 && ccw(u[n-2], u[n-1], s[i]) == COUNTER_CLOCKWISE; n--){
            u.pop_back();
        }
        u.push_back(s[i]);
    }

    for (int i = (int)s.size() - 3; i >= 0; i--){
        for (size_t n = l.size(); n >= 2 && ccw(l[n-2], l[n-1], s[i]) == COUNTER_CLOCKWISE; n--){
            l.pop_back();
        }
        l.push_back(s[i]);
    }

    reverse(l.begin(), l.end());
    for (size_t i = u.size() - 2; i >= 1; i--) l.push_back(u[i]);

    return l;
}

long long mod_pow(long long x, long long n){
    long long res = 1;
    for(int i = 0;i < 60; i++){
        if(n >> i & 1) res = res * x % MOD;
        x = x * x % MOD;
    }
    return res;
}


int main(void){
    string s;
    cin >> s;
    for (int i = s.length()-1; i >= 0; i--){
        cout << s[i];
    }
    cout << endl;
    return 0;
}   




Measured memory_bytes: 3156
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.InputMismatchException;

public class Main {
	InputStream is;
	PrintWriter out;
	String INPUT = "";

	void solve() {
		int n = ni();
		String[] s = new String[n];
		int[] a = new int[n];
		for(int i = 0; i < n; i++) {
			s[i] = ns();
			a[i] = ni();
		}
		String X = ns();
		int ans = 0;
		for(int i = 0; i < n; i++) {
			if(X.equals(s[i])) {
				for(int j = i+1; j < n; j++) {
					ans += a[j];
				}
				break;
			}
		}
		out.println(ans);
	}

	void run() throws Exception {
		is = INPUT.isEmpty() ? System.in : new ByteArrayInputStream(INPUT.getBytes());
		out = new PrintWriter(System.out);

		long s = System.currentTimeMillis();
		solve();
		out.flush();
		if (!INPUT.isEmpty())
			tr(System.currentTimeMillis() - s + "ms");
	}

	public static void main(String[] args) throws Exception {
		new Main().run();
	}

	private byte[] inbuf = new byte[1024];
	public int lenbuf = 0, ptrbuf = 0;

	private int readByte() {
		if (lenbuf == -1)
			throw new InputMismatchException();
		if (ptrbuf >= lenbuf) {
			ptrbuf = 0;
			try {
				lenbuf = is.read(inbuf);
			} catch (IOException e) {
				throw new InputMismatchException();
			}
			if (lenbuf <= 0)
				return -1;
		}
		return inbuf[ptrbuf++];
	}

	private boolean isSpaceChar(int c) {
		return !(c >= 33 && c <= 126);
	}

	private int skip() {
		int b;
		while ((b = readByte()) != -1 && isSpaceChar(b))
			;
		return b;
	}

	private double nd() {
		return Double.parseDouble(ns());
	}

	private char nc() {
		return (char) skip();
	}

	private String ns() {
		int b = skip();
		StringBuilder sb = new StringBuilder();
		while (!(isSpaceChar(b))) { // when nextLine, (isSpaceChar(b) && b != ' ')
			sb.appendCodePoint(b);
			b = readByte();
		}
		return sb.toString();
	}

	private char[] ns(int n) {
		char[] buf = new char[n];
		int b = skip(), p = 0;
		while (p < n && !(isSpaceChar(b))) {
			buf[p++] = (char) b;
			b = readByte();
		}
		return n == p ? buf : Arrays.copyOf(buf, p);
	}

	private char[][] nm(int n, int m) {
		char[][] map = new char[n][];
		for (int i = 0; i < n; i++)
			map[i] = ns(m);
		return map;
	}

	private int[] na(int n) {
		int[] a = new int[n];
		for (int i = 0; i < n; i++)
			a[i] = ni();
		return a;
	}

	private int ni() {
		int num = 0, b;
		boolean minus = false;
		while ((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'))
			;
		if (b == '-') {
			minus = true;
			b = readByte();
		}

		while (true) {
			if (b >= '0' && b <= '9') {
				num = num * 10 + (b - '0');
			} else {
				return minus ? -num : num;
			}
			b = readByte();
		}
	}

	private long nl() {
		long num = 0;
		int b;
		boolean minus = false;
		while ((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'))
			;
		if (b == '-') {
			minus = true;
			b = readByte();
		}

		while (true) {
			if (b >= '0' && b <= '9') {
				num = num * 10 + (b - '0');
			} else {
				return minus ? -num : num;
			}
			b = readByte();
		}
	}

	private static void tr(Object... o) {
		System.out.println(Arrays.deepToString(o));
	}
}

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

int standpanel;
char tile[31][31];

void check(int i,int j)
{
	if(tile[i][j]=='.')
	{
		tile[i][j]='#';
		standpanel++;
		check(i-1,j);
		check(i,j-1);
		check(i+1,j);
		check(i,j+1);
		
	}
	
}


int main(){
	int W,H;
	while(cin>> H >> W &&W&&H)
	{
		standpanel = 0;
		for(int i=0;i<=25;i++)for(int j=0;j<=25;j++)tile[i][j]='#';
		int manx,many;
		for(int i=1;i<=W;i++)for(int j=1;j<=H;j++)
		{
			cin >> tile[i][j];
			if(tile[i][j]=='@'){manx = i;many = j;tile[i][j]='.';}
			
		}
		check(manx,many);
		cout << standpanel << endl;
	}
	return 0;
}

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

using namespace std;

typedef long long ll;

struct info {
    ll to;
    ll d;
};

vector<vector<info>> G;
vector<ll> V;
vector<ll> visit;

bool solve(ll n, ll acc){
    if(visit[n] == 0){
        V[n] = acc;
        visit[n] = 1;
    } else if(V[n] != acc){
        return false;
    }

    for(auto& it : G[n]){
        if(visit[it.to]){
            if(V[it.to] != acc + it.d) return false;
        } else {
            if(solve(it.to, acc+it.d) == false) return false;
        }
    }

    return true;
}

int main(void){
    ll N, M;
    cin >> N >> M;
    G.resize(N, vector<info>());
    V.resize(N, -1);
    visit.resize(N, 0);
    for(int i=0;i<M;i++){
        ll l, r, d;
        cin >> l >> r >> d;
        l--; r--;
        G[l].push_back(info{r,  d});
        G[r].push_back(info{l, -d});
    }

    for(int i=0;i<N;i++){
        if(visit[i]) continue;
        if(!solve(i, 0)){
            cout << "No" << endl;
            return 0;
        }
    }

    cout << "Yes" << endl;

    return 0;
}

Measured memory_bytes: 16384
program ABC_081_B_ShiftOnly
   implicit none
   integer N, i, j
   integer, allocatable :: A(:)   
   read(*, *) N
   allocate (A(1:N))
   read(*, *) A(1:N)
   j = 0
   do  
      do i = 1, N
         if(mod(A(i),2) == 0) then
	         A(i) = A(i) / 2
	     else 
	         goto 1
	     end if
      end do
	  j = j + 1
   end do
   1 continue
   write(*, *) j
end program ABC_081_B_ShiftOnly

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

const int N=1001000;
int fa[N],n,m,q[N],d[N],a[N],bl[N];
vector<int>g[N];
vector<pair<int,int> >vec[N];
int find(int x){return fa[x]==x?x:fa[x]=find(fa[x]);}
void add(int x,int y){g[x].push_back(y);g[y].push_back(x);}

int bfs(int S,int T){
	for(int i=1;i<=n;++i)d[i]=-2;
	d[S]=0;int t=-1,w=0;q[0]=S;
	for(;t<w;){
		int x=q[++t];
		for(int i:g[x])if(d[i]==-2)d[i]=d[x]+1,q[++w]=i;
	}
	return d[T];
}

int main(){
	ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
	cin>>n>>m;int S=1,T=n,mx=0;
	for(int i=1;i<=m;++i){
		int x,y,z;cin>>x>>y>>z;mx=max(mx,z);
		vec[z].emplace_back(x,y);
	}
	for(int i=1;i<=mx;++i)if(!vec[i].empty()){
		int cnt=0;
		for(auto j:vec[i])a[++cnt]=j.first,a[++cnt]=j.second;
		sort(a+1,a+cnt+1);cnt=unique(a+1,a+cnt+1)-a-1;
		for(int j=1;j<=cnt;++j)fa[a[j]]=a[j];
		for(auto j:vec[i])fa[find(j.first)]=find(j.second);
		for(int j=1;j<=cnt;++j)if(fa[a[j]]==a[j])bl[a[j]]=++n;
		for(int j=1;j<=cnt;++j)add(a[j],bl[find(a[j])]);
	}
	cout<<(bfs(S,T)/2)<<'\n';
	return 0;
}


Measured memory_bytes: 77312
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n) ;i++)
#define pb push_back
#define all(v) (v).begin(),(v).end()
#define fi first
#define se second
#define sz(x) ((int)(x).size())
using ll=long long;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
#define MOD  1000000007
const ll INF=1e18;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b){ a = b; return 1; } return 0; }



int main(int argc, char const *argv[]) {
  string s;
  cin >> s;

  int a=stoi(s);
  int x=a/1000;
  int y=(a%1000)/100;
  int z=(a%100)/10;
  int w=(a%10);

  int b=x*10+y,c=z*10+w;

if(b<13 && c<13 && b!=0 && c!=0) cout << "AMBIGUOUS" << endl;
else if(b<13 && b!=0) cout << "MMYY" << endl;
else if(c<13 && c!=0) cout << "YYMM" << endl;
else cout << "NA" << endl;






  return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {



	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);
		String in = sc.nextLine();
		String[] inArray = in.split(" ");
		int a = Integer.parseInt(inArray[0]);
		int b = Integer.parseInt(inArray[1]);
		int ans = a + b;
		if (ans < 10) {
			System.out.println(ans);
		} else {
			System.out.println("error");
		}



		sc.close();
	}



}


Measured memory_bytes: 22996
#include <algorithm>
#include <iostream>
#include <math.h>
#include <stdio.h>
#include <string>
#include <sstream>
#include <vector>
#include <set>
#include <stack>
#include <map>
#include <cmath>
#include <queue>
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
using namespace std;
typedef long long ll;

string reverse(string str){
	int n = str.size();
	string ans;
	rep(i,n){
		ans.push_back(str[n-1-i]);
	}
	return ans;
}

bool isPerindlome(string str){
	string str2 = reverse(str);
	return str2 == str;
}

bool isStrongPerindlome(string str){
	string str1,str2;
	int n;
	n = str.size();
	str1 = str.substr(0,(n-1)/2);
	str2 = str.substr(1+ ((n-1)/2),(n-1)/2);
	if( isPerindlome(str1) == true && isPerindlome(str2) == true && isPerindlome(str) == true){
		return true;
	}else{
		return false;
	}
}

int main()
{
	string str;
	cin>>str;
	if( isStrongPerindlome(str) == true){
		cout<<"Yes"<<endl;
	}else{
		cout<<"No"<<endl;
	}
	return 0;
}



Measured memory_bytes: 256
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<cassert>
#include<iostream>
#include<sstream>
#include<string>
#include<vector>
#include<queue>
#include<set>
#include<map>
#include<utility>
#include<numeric>
#include<algorithm>
#include<bitset>
#include<complex>

using namespace std;

typedef long long Int;
typedef vector<int> vint;
typedef pair<int,int> pint;
#define mp make_pair

template<class T> void pv(T a, T b) { for (T i = a; i != b; ++i) cout << *i << " "; cout << endl; }
template<class T> void chmin(T &t, T f) { if (t > f) t = f; }
template<class T> void chmax(T &t, T f) { if (t < f) t = f; }
int in() { int x; scanf("%d", &x); return x; }

vector<pair<string,int> > items;
vector<pair<string,vector<string> > > renkins;

int main() {
	int n,m,k;
	string i,o;
	while(n=in()){
		int j;
		items.clear();
		for(j=0;j<n;j++){
			string s;
			int c;
			cin>>s>>c;
			items.push_back(mp(s,c));
		}
		m=in();
		renkins.clear();
		pair<string,vector<string> > renkin;
		int x;
		for(j=0;j<m;j++){
			renkin.second.clear();
			cin>>renkin.first>>k;
			string str;
			for(x=0;x<k;x++){
				cin>>str;
				renkin.second.push_back(str);
			}
			renkins.push_back(renkin);
		}
//for(x=0;x<renkins.size();x++){
//	int z;
//	cout<<renkins[x].first<<" : ";
//	for(z=0;z<renkins[x].second.size();z++){
//		cout<<renkins[x].second[z];
//	}
//	cout<<endl;
//}
		bool hoge=true;
		while(hoge){
			hoge=false;
			for(j=0;j<m;j++){
				int sum=0;
				for(x=0;x<renkins[j].second.size();x++){
					int y;
					for(y=0;y<n;y++){
						if(items[y].first==renkins[j].second[x]){
							sum+=items[y].second;
						}
					}
				}
				for(x=0;x<n;x++){
					if(items[x].first==renkins[j].first){
						if(items[x].second>sum){
							items[x].second=sum;
							hoge=true;
						}
					}
				}
			}
		}
		string st;
		cin>>st;
//for(x=0;x<n;x++){
//	cout<<items[x].first<<" "<<items[x].second<<endl;
//}
		for(x=0;x<n;x++){
			if(items[x].first==st){
				cout<<items[x].second<<endl;
			}
		}
	}
	return 0;
}

Measured memory_bytes: 0
import java.io.InputStream;
import java.io.PrintStream;
import java.util.Arrays;
import java.util.Scanner;

public class Main {
	InputStream in = System.in;
	PrintStream out = System.out;

	public void _main(String[] args) {
		Scanner sc = new Scanner(in);

		int K = sc.nextInt();
		int A = sc.nextInt();
		int B = sc.nextInt();
		
		sc.close();

		for(int a=K;a<=B;a+=K) {
			if(a>=A && a <= B) {
				out.println("OK");
				return;
			}
		}
		out.println("NG");
		
	}

	public static void main(String[] args) {
		new Main()._main(args);
	}

	@SuppressWarnings("unused")
	private String join(String delimiter, int[] a) {
		StringBuilder sb = new StringBuilder();

		for (int i = 0; i < a.length; i++) {
			sb.append(a[i]);
			sb.append(delimiter);
		}
		return sb.substring(0, Math.max(sb.length() - delimiter.length(), 0));
	}

	@SuppressWarnings("unused")
	private String join(String delimiter, long[] a) {
		StringBuilder sb = new StringBuilder();

		for (int i = 0; i < a.length; i++) {
			sb.append(a[i]);
			sb.append(delimiter);
		}
		return sb.substring(0, Math.max(sb.length() - delimiter.length(), 0));
	}

	@SuppressWarnings("unused")
	private int max(int[] arr) {
		if(arr == null || arr.length == 0) {
			throw new IllegalArgumentException(Arrays.toString(arr));
		}

		int candidate = arr[0];
		for(int i=1;i<arr.length;i++) {
			candidate = candidate > arr[i] ? candidate : arr[i];
		}
		return candidate;
	}

	@SuppressWarnings("unused")
	private long max(long[] arr) {
		if(arr == null || arr.length == 0) {
			throw new IllegalArgumentException(Arrays.toString(arr));
		}

		long candidate = arr[0];
		for(int i=1;i<arr.length;i++) {
			candidate = candidate > arr[i] ? candidate : arr[i];
		}
		return candidate;
	}

	@SuppressWarnings("unused")
	private int min(int[] arr) {
		if(arr == null || arr.length == 0) {
			throw new IllegalArgumentException(Arrays.toString(arr));
		}

		int candidate = arr[0];
		for(int i=1;i<arr.length;i++) {
			candidate = candidate < arr[i] ? candidate : arr[i];
		}
		return candidate;
	}

	@SuppressWarnings("unused")
	private long min(long[] arr) {
		if(arr == null || arr.length == 0) {
			throw new IllegalArgumentException(Arrays.toString(arr));
		}

		long candidate = arr[0];
		for(int i=1;i<arr.length;i++) {
			candidate = candidate < arr[i] ? candidate : arr[i];
		}
		return candidate;
	}

	@SuppressWarnings("unused")
	private int[] nextIntArray(Scanner sc, int n) {
		int[] result = new int[n];
		for (int i = 0; i < n; i++) {
			result[i] = sc.nextInt();
		}
		return result;
	}

	@SuppressWarnings("unused")
	private long[] nextLongArray(Scanner sc, int n) {
		long[] result = new long[n];
		for (int i = 0; i < n; i++) {
			result[i] = sc.nextLong();
		}
		return result;
	}

	@SuppressWarnings("unused")
	private int[] nextIntArray1origin(Scanner sc, int n) {
		int[] result = new int[n + 1];
		for (int i = 1; i <= n; i++) {
			result[i] = sc.nextInt();
		}
		return result;
	}
}


Measured memory_bytes: 26984
#include <iostream>
#include <iomanip>
#include<math.h>
#include<list>
#include <algorithm>
#include<set>
#include<vector>
#include<math.h>
#include<map>
#include<string>
#include <numeric>
#include <queue>
#include <sstream>
#include <bitset>
#include<stack>
#include<functional>
#include<unordered_set>
#include<unordered_map>

using namespace std;
using ll = long long;
using vll = vector<long long>;
using sll = set<long long>;
const long long ll_max = 9223372036854775807;
const long long ll_min = -9223372036854775807;
const int int_max = 2147483647;

template<typename T>
T gcd(T a, T b) { return b ? gcd(b, a % b) : a; }
template<typename T>
T lcm(T a, T b) { return a / gcd(a, b) * b; }

template<typename T>
map<T, T> getPrimeFactor(T n) {
	map<T, T> ret;
	for (T i = 2; i * i <= n; ++i) {
		while (n % i == 0) {
			ret[i] ++;
			n /= i;
		}
	}
	if (n != 1) ret[n] = 1;
	return ret;
}

template<typename T>
bool IsPrimeNumber(T num)
{
	if (num <= 2) return true;
	else if (num % 2 == 0) return false;

	double sqrtNum = sqrt(num);
	for (int i = 3; i <= sqrtNum; i += 2)
	{
		if (num % i == 0)
		{
			return false;
		}
	}

	return true;
}

template<typename T>
T modinv(T a, T m) {
	T b = m, u = 1, v = 0;
	while (b) {
		long long t = a / b;
		a -= t * b; swap(a, b);
		u -= t * v; swap(u, v);
	}
	u %= m;
	if (u < 0) u += m;
	return u;
}



// 繰り返し二乗法
ll pow2(ll n, ll p, ll mod) {
	if (p == 0 || n == 1) {
		return 1;
	}
	else {
		ll ret = pow2(n * n % mod, p / 2, mod);
		if (p % 2 == 1) {
			ret *= n;
		}
		return ret % mod;
	}
}


#define rep(i,s,e) for(ll i=s;i<e;i++)
#define repeq(i,s,e) for(ll i=s;i<=e;i++)

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

	vector<vll> t(N + 2, vll(N + 1, 0));
	rep(i, 0, M) {
		ll l, r;
		cin >> l >> r;
		t[l][r]++;
	}
	for (ll i = N; i >= 0; i--) {
		repeq(j, 1, N) {
			t[i][j] += t[i][j - 1];
		}
		repeq(j, 1, N) {
			t[i][j] += t[i + 1][j];
		}
	}

	rep(i, 0, Q) {
		ll p, q;
		cin >> p >> q;
		cout << t[p][q] << endl;
	}

	return 0;
}


Measured memory_bytes: 5576
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> Pii;

constexpr ll UNDEF = 1e12;

int main() {
    int N, M; cin >> N >> M;
    vector<vector<int>> info(M);
    vector<vector<Pii>> graph(N+1);
    for (int i = 0; i < M; i++) {
        int l, r, d; cin >> l >> r >> d;
        graph[l].push_back(Pii(r, d));
        graph[r].push_back(Pii(l, -d));
        info[i] = {l, r, d};
    }
    vector<ll> pos(N+1, UNDEF);
    vector<bool> added(N+1, false);
    for (int i = 1; i <= N; i++) {
        if (graph[i].size() == 0) continue;
        if (pos[i] == UNDEF) {
            pos[i] = 0;
            queue<vector<int>> q;
            for (Pii x : graph[i]) {
                if (!added[x.first]) {
                    added[x.first] = true;
                    q.push({i, x.first, x.second});
                }
            }
            while (!q.empty()) {
                vector<int> x = q.front();
                q.pop();
                pos[x[1]] = pos[x[0]] + x[2];
                for (Pii y : graph[x[1]]) {
                if (!added[y.first]) {
                    added[y.first] = true;
                    q.push({x[1], y.first, y.second});
                }
            }
            }
        }
    }
    for (int i = 0; i < M; i++) {
        if (pos[info[i][1]] - pos[info[i][0]] != info[i][2]) {
            cout << "No" << endl;
            return 0;
        }
    }
    cout << "Yes" << endl;
    return 0;
}


Measured memory_bytes: 25204
#include <algorithm>
#include <cmath>
#include <iostream>
#include <vector>
using namespace std;
#define U(v) cerr << #v << ": " << (v) << endl

struct SegmentTree2 {

    long long sum[1 << 18];
    long long lazy[1 << 18];
    int size;

    void init(int size) {
        this->size = 1 << (int)ceil(log2(size));
    }

    void hoge(int k, long long v) {
        lazy[k] += v / 2;
        sum[k] += v / 2;
    }

    void propagate(int k) {
        if (lazy[k]) {
//            if (k < size - 1) {
                hoge(k * 2 + 1, lazy[k]);
                hoge(k * 2 + 2, lazy[k]);
 //           }
            lazy[k] = 0;
        }
    }

    void add(int a, int b, int v, int k, int l, int r) {
        if (b <= l || r <= a) {
            return;
        }
        if (a <= l && r <= b) {
            hoge(k, v * (r - l) * 2);
            return;
        }
        propagate(k);
        add(a, b, v, k * 2 + 1, l, (l + r) / 2);
        add(a, b, v, k * 2 + 2, (l + r) / 2, r);
        sum[k] = sum[k * 2 + 1] + sum[k * 2 + 2];
    }

    void add(int a, int b, int v) {
        add(a, b, v, 0, 0, size);
    }

    long long get(int a, int b, int k, int l, int r) {
        if (b <= l || r <= a) {
            return 0;
        }
        if (a <= l && r <= b) {
            return sum[k];
        }
        propagate(k);
        long long vl = get(a, b, k * 2 + 1, l, (l + r) / 2);
        long long vr = get(a, b, k * 2 + 2, (l + r) / 2, r);
        return vl + vr;
    }

    long long get(int a, int b) {
        return get(a, b, 0, 0, size);
    }
} st;

int main() {
    int n, q;
    cin >> n >> q;
    st.init(n);
    while (q--) {
        int i, s, t, x;
        cin >> i >> s >> t;
        --s;
        if (i) {
            cout << st.get(s, t) << endl;
        } else {
            cin >> x;
            st.add(s, t, x);
        }
    }
    return 0;
}

Measured memory_bytes: 6392
use std::io::Read;

fn run() {
    let mut s = String::new();
    std::io::stdin().read_to_string(&mut s).unwrap();
    let mut it = s.trim().split_whitespace();
    let h: usize = it.next().unwrap().parse().unwrap();
    let w: usize = it.next().unwrap().parse().unwrap();
    let mut a = vec![vec![0usize; w + 1]; h + 1];
    for a in a.iter_mut().take(h) {
        for a in a.iter_mut().take(w) {
            *a = it.next().unwrap().parse().unwrap();
        }
    }
    for i in (0..h).rev() {
        for j in 0..w {
            if a[i][j] == 1 {
                a[i][j] = 0;
            } else {
                a[i][j] = a[i + 1][j] + 1;
            }
        }
    }
    let mut ans = 0;
    for a in a.iter().take(h) {
        let mut stack: Vec<(usize, usize)> = vec![];
        for (i, &a) in a.iter().enumerate() {
            let mut k = i;
            while let Some(&(l, b)) = stack.last() {
                if a >= b {
                    break;
                } else {
                    ans = std::cmp::max(ans, (i - l) * b);
                    k = l;
                    stack.pop();
                }
            }
            stack.push((k, a));
        }
    }
    println!("{}", ans);
}

fn main() {
    run();
}



Measured memory_bytes: 25516
def main():
    s = list(input())
    ans = 0
    flg = 0
    for i in range(1,len(s)-1,2):
        cpy_s = s[:i+1]
        cpy_size = i+1
        for j in range(cpy_size//2):
            if cpy_s[j] == cpy_s[j + cpy_size // 2]:
                continue
            else:
                flg = 1
                break
        if flg == 0:
            ans = cpy_size
        flg = 0
    print(ans)


if __name__ == '__main__':
    main()


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

#define int long long int
#define pb push_back
#define MAX 100005
#define mod (int)(1e18+7)
#define sp fixed<<setprecision(12)
/*
vector<int> primes;
bool is_prime[MAX];
void sieve(){
    is_prime[0]=is_prime[1]=true;
    for(int i=4;i<MAX;i+=2){
        is_prime[i]=true;
    }
    for(int i=3;i*i<MAX;i+=2){
        if(!is_prime[i]){
            for(int j=i*i;j<MAX;j+=i){
                is_prime[j]=true;
            }
        }
    }
    
}

int power(int a,int n,int p){
    int res=1;
    while(n){
        if(n&1){
            res=(res*a)%p;
            n--;
        }else{
            a=(a*a)%p;
            n/=2;
        }
    }
    return res;
}
*/

void minWindow(string &s, string &t) {
        int n=s.length();
        int m=t.length();
        if(m>n){
            cout<<"No String\n";
            return;
        }
        int hash_s[256]={0};
        int hash_t[256]={0};
        for(int i=0;i<m;i++){
            hash_t[t[i]]++;
        }
        int start=0,start_indx=-1,min_len=INT_MAX;
        int count=0;
        for(int last=0;last<n;last++){
            hash_s[s[last]]++;
            if(hash_t[s[last]]!=0 and hash_s[s[last]]<=hash_t[s[last]]){
                count++;
            }
            if(count==m){
                while( (hash_s[s[start]] > hash_t[s[start]]) or (hash_t[s[start]]==0) ){
                    if((hash_t[s[start]]!=0) and hash_s[s[start]] > hash_t[s[start]]){
                        hash_s[s[start]]--;
                    }
                    start++;
                }
                int curr_len=last-start+1;
                if(curr_len < min_len){
                    min_len=curr_len;
                    start_indx=start;
                }
            }
        }
        if(start_indx==-1){
            cout<<"No String\n";
            return;
        }
        cout<<s.substr(start_indx,min_len)<<"\n";
}

int32_t main(){

    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    #ifndef ONLINE_JUDGE
        freopen("input.txt","r",stdin);
        freopen("output.txt","w",stdout);
    #endif
    //double    pi=3.14159265358979323846;

    int t=1;
    //cin>>t;
    //int it=1;
    while(t--){
        int l,r,n;
        cin>>l>>r>>n;
        int ct=0;
        for(int i=l/n;i<(r/n)+1;i++){
            if((i*n)>=l and (i*n)<=r){
                ct++;
            }
        }
        cout<<ct<<"\n";
    }

    return 0;
    
}

Measured memory_bytes: 3612
/**********************************
	author:  mariogzsl
**********************************/

#include <bits/stdc++.h>

#define FOR(i,a,b) for(int i=a;i<b;i++)
#define ROF(i,b,a) for(int i=b-1;i>=a;i--)
#define f first
#define s second
#define puts(x) cout<<x<<endl
using namespace std;
typedef vector<int> vi;
typedef pair<int, int> pii;
typedef long long ll;
int gcd(int a, int b){return (b==0)?a:gcd(b,a%b);}

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	int l=0, c=0;
	string s;
	cin>>s;
	FOR(i,0,s.size()){
		if(s[i]=='A' or s[i]=='C' or s[i]=='G' or s[i]=='T'){
			c++;
			l=max(c,l);
		}else{
			c=0;
		}
	}
	cout<<l<<endl;
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repe(i, n) for (int i = 0; i <= (int)(n); i++)
#define YES cout<<"YES"<<endl
#define NO cout<<"NO"<<endl
#define Yes cout<<"Yes"<<endl
#define No cout<<"No"<<endl
#define ANS cout << ans << endl
#define all(a) a.begin(),a.end()
#define SORT(a) sort(all(a))
#define REVERSE(a) reverse(all(a))
#define KOZYUN(a) sort(all(a),greater<int>())
#define int ll
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORe(i, m, n) for(int i = m;i <= n;i++)
#define VIin(a) for(int i=0; i<a.size(); i++) cin >> a[i]
#define OUT(a) cout << a << endl
#define IN(a) cin >> a
#define INT(a) int a; cin >> a
typedef vector<int> VI;
typedef vector<VI> VVI;
const int MOD=1e9+7;
const long long INF = 1LL << 60;
/*最大公約数*/int gcd(int x, int y) { return y ? gcd(y,x%y) : x;}
/*最小公倍数*/int lcm(int a, int b) { int g = gcd(a, b); return a / g * b; }
/*素数判定*/int isPrime(int n){if(n<2){return 0;}for(int i=2; i*i<=n; i++){if(n%i==0){return 0;}}return 1;}
/*約数列挙*/vector<int> getDivisor(int n){vector<int> v; for(int i=1; i*i<=n; i++){if(n%i==0){v.push_back(i);if(i!=n/i){v.push_back(n/i);}}}sort(v.begin(),v.end()); return v;}
//----------------------------------------------
signed main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    
    string a,b; cin >> a >> b;
    REVERSE(b);
    if(a == b) YES;
    else NO;

    return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        int n;
        int k;
        String[] a;

        Scanner sc = new Scanner(System.in);
        n = sc.nextInt();
        k = sc.nextInt();
        sc.nextLine();
        a = sc.nextLine().split(" ");

        int one = 0;
        for (int i = 0; i < a.length; i++) {
            if (a[i].equals("1")) one = i;
            break;
        }
        int left = one;
        int right = a.length - one - 1;
        if (left % (k - 1) > 0) left += k - 1;
        if (right % (k - 1) > 0) right += k - 1;

        int ans = Math.max(left / (k - 1), right / (k - 1));
        System.out.println(ans);
    }
}

Measured memory_bytes: 48600
using System;
using System.Linq;
using System.Collections.Generic;
using static System.Math;

namespace C
{
    class Program
    {
        static void Main(string[] args)
        {
            var n = long.Parse(Console.ReadLine());
            var s = new List<string>();
            var hashTable = new Dictionary<string, long>();

            long ans = 0;

            for (int i = 0; i < n; i++)
            {
                var input = string.Join("",Console.ReadLine().OrderBy(x => x).ToArray());

                if(!hashTable.ContainsKey(input))
                {
                    hashTable.Add(input, 0);
                }

                ans += hashTable[input];
                hashTable[input]++;
            }



            // foreach (var item in s)
            // {
            //     if (hashTable.ContainsKey(item))
            //     {
            //         hashTable[item] ++;
            //     }
            //     else
            //     {
            //         hashTable.Add(item, 1);
            //     }
            // }

            // long ans = 0;

            // foreach (var x in hashTable)
            // {
            //     if (x.Value > 1)
            //     {
            //         ans += nCr(x.Value,2);
            //     }
            // }

            Console.WriteLine(ans);

        }

        static long nCr(long n, long r)
        {
            return nPr(n, r) / Factorial(r);
        }

        static long nPr(long n, long r)
        {
            return Factorial(n) / Factorial(n-r);
        }

        static long Factorial(long n)
        {
            if (n == 0)
            {
                return 1L;
            }
            return n * Factorial(n - 1);
        }

    }
}


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

int main() {
  vector<double> h;
  double i;
  while (cin >> i) {if(i==0)break; h.push_back(i);}
  sort(h.begin(), h.end());
  cout << (h[h.size() - 1] - h[0]) << endl;
  return 0;
}


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

int main(){
    
    int w, h;
    int H, W;
    
    int min;
    
    while(1){
        
        cin >> h >> w;
        
        if ( w == 0 && h == 0) break;
        
        int length = w*w + h*h;
        min = 150*150;
        
        bool flag = false;
        
        for(int i = 1; i <= 150 ; i++)
        {
            
            for(int j = i+1; j <= 150 ; j++)
            {
                
                int temp = i*i + j*j;
                
                if(temp > length)
                {
                    
                    if (temp < min)
                    {
                        
                        H = i;
                        W = j;
                        min = temp;
                    }
                
                }
                else if(temp == length)
                {
                    if (i > h)
                    {
                        flag = true;
                        H = i;
                        W = j;
                        min = temp;
                    }
                }
                
                if(flag) break;
            }
            
            if(flag) break;
        }
        
        cout << H << " " << W << endl;
    }
    
    return 0;
}


Measured memory_bytes: 3092
from fractions import gcd
t = int(input())
for _ in range(t):
  a, b, c, d = map(int, input().split())
  if a - b < 0:
    print("No")
    continue
  if b > d:
    print("No")
    continue
  g = gcd(b, d)
  s = a + (c - a) // b * b
  if s < 0:
    print("No")
    continue
  #print((((b - s - 1) // g) * g + s) % b, s, g)
  if (((b - s - 1) // g) * g + s) % b > c: print("No")
  else: print("Yes")

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

void solve(long long P, long long Q, long long R)
{
    vector<long long> v;
    v.push_back(P + Q);
    v.push_back(R + Q);
    v.push_back(P + R);
    long long ans = *min_element(v.begin(), v.end());
    cout << ans << endl;
}

// Generated by 1.1.4 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
int main()
{
    long long P;
    scanf("%lld", &P);
    long long Q;
    scanf("%lld", &Q);
    long long R;
    scanf("%lld", &R);
    solve(P, Q, R);
    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
int main(){
  int N,i,count,x,y,z,f;
  scanf("%d",&N);
  for(i=0;i<N;i++){
    count=0;
    for(x=1;x<99;x++){
      for(y=x;y<99;y++){
        for(z=y;z<99;z++){
          f=(x+y)*(x+y)+(y+z)*(y+z)+(z+x)*(z+x);
          if(f==2*(i+1)){
            if(x==y && y==z) count++;
            else if(x==y || y==z) count=count+3;
            else count=count+6;
          }
        }
      }
    }
    printf("%d\n",count);
  }
  return 0;
}

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

using namespace std;

int main(){

  int a,b;
  int sum;
  
  while(cin>>a>>b){

	sum=a+b;
	int cnt=0;
	
	while(1){

	  if(sum/10==0 && sum%10==0)
		break;
	  else{
		cnt++;
		sum=sum/10;
	  }
	}

	cout<<cnt<<endl;
	
  }

}



Measured memory_bytes: 3004
import java.util.Scanner;

public class Main {

	private static Scanner sc = new Scanner(System.in);

	public static void main(String[] args) {
		char[] s = sc.next().toCharArray();
		int ans = 0;
		for (int i = 0; i < s.length; i++) {
			if (s[i] == '2') {
				ans++;
			}
		}
		System.out.println(ans);
	}
}

Measured memory_bytes: 23764
import fractions

A, B = map(int,input().split())
GCD = fractions.gcd(A, B)

def prime_factorize(n):
    a = [1]
    flag = 1
    while n % 2 == 0:
        if flag:
            a.append(2)
            flag = 0
        n //= 2
    f = 3
    flag = 1
    while f * f <= n:
        if n % f == 0:
            if flag:
                a.append(f)
                flag = 0
            n //= f
        else:
            f += 2
            flag = 1
    if n != 1 and n != a[-1]:
        a.append(n)
    return a

a = prime_factorize(GCD)

print(len(a))

Measured memory_bytes: 5596
#include<stdio.h>
#include<math.h>

int main(void){
double v,y;
int N;

while(scanf("%lf",&v)!=EOF){
	N=0;
	y=v*v/19.6;
	do{
		N++;
	}while( y > 5*(N-1) );
	printf("%d\n",N);
}
return 0;

}

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

#define  all(v)            v.begin(), v.end()
#define  sz(x)             (int)x.size()
#define  debug(x)          cout << #x << ':' << x << endl;
#define  rep(i,n)          for(long long i = 0; i <  n ; i++)
#define  reps(i,n)         for(long long i = 1; i <= n ; i++)
#define  make_unique(v)    sort(all(v));v.erase(unique(all(v)), v.end());
#define  REMOVE(v,a)       v.erase(remove(v.begin(),v.end(), a), v.end());
#define  pb                push_back
#define  mp                make_pair
#define  endl              '\n'
#define  fi                first
#define  se                second
#define  ajs(a)            (a<0)?(-1*a):a

using namespace std;
typedef long long          ll;
typedef vector<long long>  vll;
typedef pair<ll,ll>        pll;
const ll MOD = 1000000007;
bool cmp(int X, int Y) {return X > Y;}

ll gcd(ll a, ll b) {return !b ? a : gcd(b, a % b);}
ll lcm(ll a, ll b) {return (a / gcd(a, b)) * b;}
ll modpow(ll a, ll b, ll m=MOD){a %= m; ll res = 1; while (b) {if (b & 1)res = (res * a) % m; a = (a * a) % m; b >>= 1;} return res;}
ll bpow(ll a, ll b){if(b<0){return 0;}ll res = 1; while (b) {if (b & 1)res = res * a; a = a * a; b >>= 1;} return res;}

ll ncr(ll n , ll r){
	if(r > n - r) {r = n - r;}
	if(r==1){return n;}
	if(r==0){return 1;}
	
	if(r == n){return 1;}
	
	return ((n*ncr(n-1,r-1))/r)%MOD;
	}


int main(){ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
ll n;cin>>n;
if(n==1){
	cout<<0<<endl;
	return 0;
	}

ll ans1 = modpow(10,n);
ll ans2 = modpow(9,n);
ans2*=2;
ll ans3 = modpow(8,n);

ll ans = ( (ans1+MOD)%MOD  -  (ans2+MOD)%MOD   + (ans3+MOD)%MOD);
ans=(ans+MOD)%MOD;


cout<<ans;
	
				

}	







	


Measured memory_bytes: 3632
import java.util.Scanner;

public class Main {

	static Scanner scanner;

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

	    int N=gi();
	    int[] A=new int[N];
	    int[] B=new int[N];
	    int[] C=new int[N-1];
	    
	    for(int i=0; i<N; i++) {
	    	A[i]=gi();
	    }
	    for(int i=0; i<N; i++) {
	    	B[i]=gi();
	    }
	    for(int i=0; i<N-1; i++) {
	    	C[i]=gi();
	    }
	    
	    int b=-1;
	    int m=0;
	    for (int i=0; i<N; i++) {
	    	int a=A[i];
	    	m+=B[a-1];
	    	if(b!=-1 && a-b==1) {
	    		m+=C[b-1];
	    	}
	    	b=a;
	    }
        System.out.print(m);
//        if (c<=2) {
//        	System.out.println("YES");
//        }else {
//        	System.out.println("NO");
//        }
	}

	// 文字列として入力を取得
	public static String gs() {
		return scanner.next();
	}

	// intとして入力を取得
	public static int gi() {
		return Integer.parseInt(scanner.next());
	}

	// longとして入力を取得
	public static long gl() {
		return Long.parseLong(scanner.next());
	}

	// doubleとして入力を取得
	public static double gd() {
		return Double.parseDouble(scanner.next());
	}
}

Measured memory_bytes: 35732
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;++i)
#define rrep(i,n) for(int i=n-1;i>=0;--i)
#define REP(i,a,b) for(int i=a;i<b;i++)
#define yesno(flg) if(flg){cout<<"YES"<<endl;}else{cout<<"NO"<<endl;}
#define vi vector<int>
#define pb push_back
#define i197 1000000007
#define MAX_N 200002
using namespace std;

typedef long long ll;
typedef pair<int,int> Pii;
typedef pair<Pii,int> Piii;
const int inf=1000000000;
struct edge{
	int myc,to,c,cost;
};
struct pos{
	int from,to;
};
int dy[]={0, 0, 1, -1};
int dx[]={1, -1, 0, 0};
int f[MAX_N]={};
int b[MAX_N]={};
bool dp[MAX_N]={};

int pa[100001]={};
int ra[100001]={};
vector<int> v[100001];

int rank1(int num){
	if(ra[num]>0)return ra[num];
	if(v[num].empty())return 0;
	for(auto it:v[num]){
		if(ra[num]<(rank1(it)+1)){
			ra[num]=rank1(it)+1;
			pa[num]=it;
		}
	}
	return ra[num];
}

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

	int k=n-1+m;
	rep(i,k){
		cin>>a>>b;
		v[b].push_back(a);
	}

	rep(i,n){
		ra[i+1]=rank1(i+1);
		cout<<pa[i+1]<<endl;
	}
	return 0;
}


Measured memory_bytes: 11008
#include <stdio.h>

int main() {
    int n, a, deuRuim = 0;
    //printf("%d\n", a);
    
    scanf("%d", &n);
    
    int i = 0;
    
    while(i < n) {
        scanf("%d", &a);
        
        if (a % 2 == 0) {
            if (a % 3 != 0 && a % 5 != 0) {
                deuRuim = 1;
                break;
            }
        }
        
        ++i;  //i = i + 1;  | i++;
    }
    
    if (deuRuim) {
        printf("DENIED\n");
    } else {
        printf("APPROVED\n");
    }
    
    return 0;
}









Measured memory_bytes: 128
import bisect
import math

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

a.sort()

ans = sum(a)
for i in range(m):
    tmp = a.pop()
    ans -= tmp
    cost = math.floor(tmp/2)
    ans += cost
    idx = bisect.bisect_left(a,cost)
    a.insert(idx,cost)

print(ans)


Measured memory_bytes: 85860
<?php
$n = fgets(STDIN);
$a = array();
for($i=0; $i<$n; $i++){
    $a[$i] = trim(fgets(STDIN));
    $word = str_split($a[$i]);
    sort($word);
    $sortword = implode($word);
    $a[$i] = $sortword;
}
sort($a);
$count = 1;
$buffStr = "";
$ans = 0;
for($i=0; $i<$n; $i++){
    if($buffStr != $a[$i]){
        $buffStr = $a[$i];
        if($count != 1) {
            $ans += ($count * ($count-1) ) / 2;
        }
        $count = 1;
    } else {
        $count++;
    }
}

if($count != 1) {
    $ans += ($count * ($count-1) ) / 2;
}

echo $ans;

Measured memory_bytes: 12792
#include <iostream>
#include <vector>
#include <math.h>

int main()
{
    uint64_t mon_hp;
    uint64_t cur_mon_hp;
    uint64_t wattakazu = 0;
    std::cin >> mon_hp;

    cur_mon_hp = mon_hp;

        /*どこかで割る対称の体力が偶数になったらそこで確認終了できる　それ以降の必要攻撃回数は*/
        /*必ず2で割った数になるから*/
        /*割る数が奇数である限り試行しなければ...*/

    while(cur_mon_hp){
        if(cur_mon_hp % 2 == 0){
            cur_mon_hp = cur_mon_hp / 2;
            wattakazu ++;
        }
        cur_mon_hp = cur_mon_hp / 2;
        wattakazu ++;
    }

    std::cout << (uint64_t)(pow(2, wattakazu) - 1) << std::endl;
    return 0;
}

Measured memory_bytes: 1016
#include <set>
#include <map>
#include <list>
#include <queue>
#include <stack>
#include <cmath>
#include <ctime>
#include <cstdio>
#include <vector>
#include <string>
#include <bitset>
#include <cctype>
#include <cstdlib>
#include <cstring>
#include <utility>
#include <numeric>
#include <complex>
#include <sstream>
#include <regex>
#include <fstream>
#include <iomanip>
#include <cassert>
#include <iostream>
#include <iterator>
#include <algorithm>
using namespace std;
using ll = long long;
using VL=vector<ll>;

#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++)
const long long INF =  999999999;

int main(){
  double b,ans;
  cin>>b;
  ans=2*b*M_PI;
  cout<<printf("%.6f",ans)<<endl;
}


Measured memory_bytes: 3256
//059A
#include <bits/stdc++.h>
using namespace std;
int main(void){
    string a, b, c= " ";
    string ans = "abc";
    vector<string>L{"abcdefghijklmnopqrstuvwxyz", "ABCDEFGHIJKLMNOPQRSTUVWXYZ"};
    cin >> a >> b >> c;
    for(int i=0; i<L[0].length(); i++){
        if (L[0][i]== a[0]){
            ans[0] =L[1][i];
        }
        if (L[0][i]== b[0]){
            ans[1] =L[1][i];
        }
        if (L[0][i]== c[0]){
            ans[2] =L[1][i];
        }
    }
    cout << ans;

}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <map>
#include <iostream>
#include <algorithm>
#include <string.h>
#include <memory>
#define MX 2147483647
using namespace std;

const int N = 1e5 + 1;
int arr[N], n, dp[N];


int solve(int index){
	if (index >= n)
		return MX;
	if (index == n - 1)
		return 0;
	if (dp[index] != -1)
		return dp[index];
	int minimum_answer = MX;
	minimum_answer = min(minimum_answer, abs(arr[index + 1] - arr[index]) + solve(index + 1));
	if (index + 2 < n)
		minimum_answer = min(minimum_answer, abs(arr[index + 2] - arr[index]) + solve(index + 2));
	return dp[index] = minimum_answer;
}

int main() {
	memset(dp, -1, sizeof dp);
	cin >> n;
	for (int i = 0; i < n; i++)
		cin >> arr[i];
	cout << solve(0) << '\n';
	return 0;
}

Measured memory_bytes: 5760
#include <bits/stdc++.h>
#define MAXN 100001
#define inf 1<<30
using namespace std;
struct node {
    int x, dist;
    node(int _x, int _dist) {
        x = _x;
        dist = _dist;
    }
};
vector<node> G[MAXN];
int cost[MAXN];
bool viz[MAXN], flag = false;
int N, M;
void dfs(int node) {
    int next;
    if (flag == true) {
        return;
    }
    viz[node] = true;
    for (int i = 0; i < G[node].size(); ++i) {
        next = G[node][i].x;
        if (viz[next] == false) {
            cost[next] = cost[node] + G[node][i].dist;
            dfs(next);
        } else if (cost[next] != cost[node] + G[node][i].dist) {
            flag = true;
            return;
        }
    }
}
int main()
{
    int l, r, dist;
    cin >> N >> M;
    for (int i = 1; i <= M; ++i) {
        cin >> l >> r >> dist;
        G[l].push_back(node(r, dist));
        G[r].push_back(node(l, -dist));
    }
    for (int i = 1; i <= N; ++i) {
        if (viz[i] == false) {
            cost[i] = 0;
            dfs(i);
        }
        if (flag == true) {
            cout << "No";
            return 0;
        }
    }
    cout << "Yes";
    return 0;
}


Measured memory_bytes: 12032
#include<stdio.h>

#define N 1000

int solve (int , int);

int n;
int A[N];

int main(){
  
  int i,num;
  int mi[N];
  int q;
  int j=0;

  scanf("%d",&num);
  n = num;
  for(i=0;i<num;i++) scanf("%d",&A[i]);

  scanf("%d",&q);
  
  for(i=0;i<q;i++) {
    scanf("%d",&mi[i]);
    if(solve(j,mi[i]) == 1) printf("yes\n");
    else if(solve(j,mi[i]) == 0) printf("no\n");
  }
  

  return 0;
}


int solve(int i,int m){
  int res;
  if (m == 0)
    return 1;
  if (i >= n)
    return 0;
  res = solve(i + 1, m) || solve(i + 1, m - A[i]);
  return res;
}



Measured memory_bytes: 2696
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;
typedef long long ll;
const int MOD = 1000000007;
int main()
{
  int N;
  cin >> N;
  map<string,int>used;
  char prev='.';
  for(int i=0;i<N;i++){
    string W;
    cin >> W;
    if(used[W]>0){
      cout << "No" << endl;
      return 0;
    }
    used[W]++;
    if(i>0){
      if(prev!=W[0]){
        cout << "No" << endl;
        return 0;
      }
    }
    prev=W[W.size()-1];
  }
  cout << "Yes" << endl;

  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n, m;
  cin >> n >> m;
  priority_queue<long long> pq;
  for(int i = 0; i < n; i++){
    long long a;
    cin >> a;
    pq.push(a);
  }
  for(int i = 0; i < m; i++){
    long long x = pq.top();
    pq.pop();
    x /= 2;
    pq.push(x);
  }
  long long ans = 0;
  for(int i = 0; i < n; i++){
    ans += pq.top();
    pq.pop();
  }
  cout << ans << endl;    
  return 0;
}

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

const int MAX_N = 1e3+100;
int N;
int T,A;
int H[MAX_N];

int main(){
   // freopen("in.txt", "r", stdin);
    ios::sync_with_stdio(0); cin.tie(0);
    while(cin >> N){
        cin >>T >> A;
        T *= 1000; A *= 1000;
        for(int i = 1; i <= N; ++i){
            cin >> H[i];
        }
        int minn = abs(T - 6*H[1] - A), idx = 1;
        for(int i = 2; i <= N; ++i){
            int x = abs(T - 6*H[i] - A);
            if(x < minn){
                minn = x; idx = i;
            }
        }
        cout << idx << endl;
    }
    return 0;
}


Measured memory_bytes: 256