akhauriyash/Code-Regression huggingface dataset:
#pragma once
#include <stdio.h>
#include <sstream>
#include <string.h>
#include <vector>
#include <map>
#include <algorithm>
#include <iostream>
#include <utility>
#include <set>
#include <cctype>
#include <queue>
#include <stack>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <deque>
#include <limits>
#include <iomanip>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
#define bit(x,v) ((ll)x << v)

const ll INF = 1000000007;
const ll MAX = 1000010;
const ll MOD = 1000000007;

long long fac[MAX], finv[MAX], inv[MAX];
void COMinit() {
	fac[0] = fac[1] = 1;
	finv[0] = finv[1] = 1;
	inv[1] = 1;
	for (int i = 2; i < MAX; i++) {
		fac[i] = fac[i - 1] * i % MOD;
		inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
		finv[i] = finv[i - 1] * inv[i] % MOD;
	}
}

// 二項係数計算
long long COM(int n, int k) {
	if (n < k) return 0;
	if (n < 0 || k < 0) return 0;
	return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

ll gcd(ll a, ll b) {
	if (b == 0) return a;
	return gcd(b, a % b);
}
int pr[100010];
void uini(int n) {
	for (size_t i = 0; i <= n; i++)
	{
		pr[i] = i;
	}
}

int parent(int x) {
	if (x == pr[x]) return x;
	return pr[x] = parent(pr[x]);
}

bool unit(int x, int y) {
	int px = parent(x);
	int py = parent(y);

	if (px == py) return false;
	if (px < py) {
		pr[py] = px;
	}
	else {
		pr[px] = py;
	}
	return true;
}

// res[i][c] := i 文字目以降で最初に文字 c が登場する index (存在しないときは n)
vector<vector<int> > calcNext(const string& S) {
	int n = (int)S.size();
	vector<vector<int> > res(n + 1, vector<int>(26, n));
	for (int i = n - 1; i >= 0; --i) {
		for (int j = 0; j < 26; ++j) res[i][j] = res[i + 1][j];
		res[i][S[i] - 'a'] = i;
	}
	return res;
}
// mod 1000000007 の世界で a += b する関数
void add(long long& a, long long b) {
	a += b;
	if (a >= MOD) a -= MOD;
}
const ll ainf = 998244353;

struct cell {
	int x, y;
	int deep;
	cell(int x, int y, int deep) : x(x), y(y), deep(deep) {}
};

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

int W, H, N;
int X1[500], X2[500], Y1[500], Y2[500];

bool fld[500 * 6][500 * 6];
int compress(int* x1, int* x2, int w) {
	vector<int> xs;
	for (int i = 0; i < N; i++)
	{
		for (int d = -1; d <= 1; d++)
		{
			int tx1 = x1[i] + d, tx2 = x2[i] + d;
			if (1 <= tx1 && tx1 <= W) xs.push_back(tx1);
			if (1 <= tx2 && tx2 <= W) xs.push_back(tx2);
		}
	}

	sort(xs.begin(), xs.end());
	xs.erase(unique(xs.begin(), xs.end()), xs.end());

	for (size_t i = 0; i < N; i++)
	{
		x1[i] = find(xs.begin(), xs.end(), x1[i]) - xs.begin();
		x2[i] = find(xs.begin(), xs.end(), x2[i]) - xs.begin();
	}
	return xs.size();
}
const int MAX_N = 1 << 17;

void solv() {

	int n;
	cin >> n;
	int p[55];
	int c = 0;
	for (size_t i = 1; i <= n; i++)
	{
		cin >> p[i];
		if (i != p[i]) c++;
	}

	if (c > 2) {
		cout << "NO" << endl;
	}
	else cout << "YES" << endl;
}

int main() {
	//COMinit();
	solv();

	return 0;
}


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

public class Main {
	static int mod = (int) 1e9 + 7;
	static int DX[] = { -1, 0, 1, 0 }, DY[] = { 0, -1, 0, 1 };

	public static void main(String[] args) {
		FastScanner fs = new FastScanner(System.in);
		int n = fs.nextInt(), a = fs.nextInt();
		int x[] = fs.nextIntArray(n);
		long dp[][][] = new long[n+1][n+1][2520];
		dp[0][0][0] = 1;
		for(int i=1;i<n+1;i++) {
			int now = x[i-1];
			for(int j=0;j<=i;j++) {
				for(int k=0;k<2501;k++) {
					if(j==0) {
						dp[i][j][k] = dp[i-1][j][k];
						continue;
					}
					if(k-now>=0) dp[i][j][k] =  dp[i-1][j-1][k-now] + dp[i-1][j][k];
					else dp[i][j][k] = dp[i-1][j][k];
				}
			}
		}
		long ans = 0;
		for(int i=1;i<=n;i++) {
			if(i*a>2500)continue;
			ans += dp[n][i][i*a];
		}
		System.out.println(ans);
	}
}

//高速なScanner
class FastScanner {
	private BufferedReader reader = null;
	private StringTokenizer tokenizer = null;

	public FastScanner(InputStream in) {
		reader = new BufferedReader(new InputStreamReader(in));
		tokenizer = null;
	}

	public String next() {
		if (tokenizer == null || !tokenizer.hasMoreTokens()) {
			try {
				tokenizer = new StringTokenizer(reader.readLine());
			} catch (IOException e) {
				throw new RuntimeException(e);
			}
		}
		return tokenizer.nextToken();
	}

	public String nextLine() {
		if (tokenizer == null || !tokenizer.hasMoreTokens()) {
			try {
				return reader.readLine();
			} catch (IOException e) {
				throw new RuntimeException(e);
			}
		}
		return tokenizer.nextToken("\n");
	}

	public long nextLong() {
		return Long.parseLong(next());
	}

	public int nextInt() {
		return Integer.parseInt(next());
	}

	public double nextDouble() {
		return Double.parseDouble(next());
	}

	public int[] nextIntArray(int n) {
		int[] a = new int[n];
		for (int i = 0; i < n; i++)
			a[i] = nextInt();
		return a;
	}

	public long[] nextLongArray(int n) {
		long[] a = new long[n];
		for (int i = 0; i < n; i++)
			a[i] = nextLong();
		return a;
	}
}

Measured memory_bytes: 83196
#include <bits/stdc++.h>
using namespace std;
#define rep(i,a,b) for(int i=a;i<(b);++i)
#define debug(x) cerr<<#x<<": "<<x<<endl
#define trav(a,x) for(auto &a:x)
#define all(x) x.begin(),x.end()
#define sz(x) (int)(x).size()
typedef long long ll;
typedef pair<int,int> pii;
typedef vector<int> vi;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int n;
    cin >> n;
    vector<vector<ll>> a(n,vector<ll>(n));
    rep(i,0,n) rep(j,0,n) cin >> a[i][j];
    vector<ll> score(1<<n);
    rep(mask,0,1<<n) {
        rep(j,0,n) if(mask&(1<<j)) rep(k,j+1,n) if(mask&(1<<k)) {
                score[mask] += a[j][k];
            }
    }
    vector<ll> dp(1<<n);
    rep(mask,1,1<<n) {
        for(int x=mask; x; ) {
            --x &= mask;
            dp[mask] = max(dp[mask], dp[x]+score[mask^x]);
        }
    }
    cout << dp[(1<<n)-1]<<"\n";
} 


Measured memory_bytes: 1280
import java.io.*;
import java.util.*;
class Main
{
	 public static void  main (String[] args) throws IOException
    {
       try{
       BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
       int a=0;
       a=Integer.parseInt(br.readLine());
       long sum=0;int c=1;
       for(int i=1;i<=a;i++)
       {
       	sum+=(a-1)/i;
       }
       System.out.println(sum);
   }
    catch(Exception e){}
}}


Measured memory_bytes: 32768
/*
	Code written by Talant I.D.
*/

#include <bits/stdc++.h> 

using namespace std;

typedef long long ll;
typedef pair <int, int> pii;
typedef tuple <int, int, int> tiii;

#define precision(n) fixed << setprecision(n)
#define pb push_back
#define lb lower_bound 
#define ub upper_bound 
#define mp make_pair
#define mt make_tuple
#define mod int(1e9+7)
#define eps double(1e-9)
#define PI 2*acos(0.0)
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
#define do_not_disturb ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define curMod ll(998244353)
#define fr first
#define sc second

inline bool isvowel(char ch){
	ch = tolower(ch);
	return (ch == 'a' || ch == 'e' || ch == 'i' || ch == 'o' || ch == 'u' || ch == 'y');
}

inline bool isprime(int n){
	if(n < 2 || (n % 2 == 0 && n != 2))
		return false;
	for(int i = 3; i*i <= n; i += 2)
		if(n%i == 0) return false;
	return true;
}

const int N = 50000;
int tree[N*4];
vector <int> damage, cost;

void build(int v, int l, int r){
	if(l == r){
		if(!l) tree[v] = 0;
		else tree[v] = 2e9;
		return;
	}
	int mid = (l+r) >> 1;
	build(v+v, l, mid);
	build(v+v+1, mid+1, r);
	tree[v] = min(tree[v+v], tree[v+v+1]);
}

void update(int v, int l, int r, int pos, int val){
	if(l == pos && l == r){
		tree[v] = val;
		return;
	}
	int mid = (l+r) >> 1;
	if(pos <= mid){
		update(v+v, l, mid, pos, val);
	}
	else{
		update(v+v+1, mid+1, r, pos, val);
	}
	tree[v] = min(tree[v+v], tree[v+v+1]);
}

int get(int v, int l, int r, int ql, int qr){
	if(r < ql || qr < l) return 2e9;
	if(ql <= l && r <= qr) return tree[v];
	int mid = (l+r) >> 1;
	return min(get(v+v, l, mid, ql, qr), get(v+v+1, mid+1, r, ql, qr));
}

int main(){
	do_not_disturb
	mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
	
	int n, h, i, j;
	cin >> h >> n;
	damage.resize(n);
	cost.resize(n);
	for(i = 0; i < n; i++){
		cin >> damage[i] >> cost[i];
	}
	
	build(1, 0, h);
	for(i = 1; i <= h; i++){
		int mn = 2e9;
		for(j = 0; j < n; j++){
			int l = max(0, i-damage[j]), r = i-1;
			int res = get(1, 0, h, l, r);
			mn = min(res+cost[j], mn);
		}
		update(1, 0, h, i, mn);
	}
	cout << get(1, 0, h, h, h);
	
	return 0;
}


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

int main() {
 int N;
 int count = 0;
 cin >> N;
 int list[N];
 bool bit = true;
 for(int i = 0; i< N;i++){
 cin >> list[i];}
while(bit){
 for(int i: list){
 	if(i %2 == 0){}
 	else{
 		bit = false;
 		break;}
 	}
  if(bit){
  	count++;
    for(int i = 0; i< N;i++){
 		list[i] =  list[i] /2;}
  }
  }
  cout << count << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <iomanip>
#include <queue>
#include <string>
#include <utility>
#include <map>
using namespace std;
#define rep(i,n) for(int i=1;i<=(int)(n);i++)
#define Rep(i,n) for(int i=0;i<=(int)(n-1);i++)
typedef long long ll;
int dx[]={-1,0,1,0};
int dy[]={0,-1,0,1};
int inf=2020000000;

string s;
string stock;

string alpha ="abcdefghijklmnopqrstuvwxyz";
string al ="zyxwvutsrqponmlkjihgfedcba";

string Sort(string s){
	Rep(i,s.size()){
		Rep(j,s.size()-i){
			if(s[j+i]<s[i]){
				char v;
				v=s[j+i];
				s[j+i] = s[i];
				s[i] =v;
			}
		}
	}
	return s;
}

int main() {
	cin>>s;
	
	Rep(i,s.size()){
		Rep(j,26){
			if(s[i]==alpha[j]){
				alpha.erase(alpha.begin()+j);
			}
		}
	}
	if(alpha.size()){
		s+=alpha[0];
		cout<<s<<endl;
	}
  else if(s=="zyxwvutsrqponmlkjihgfedcba"){
    cout<<-1<<endl;
  }
	else{
		for(int i=25;i>0;i--){
			if(s[i-1]>s[i]){
				stock += s[i];
				s.erase(s.begin()+i);
			}
			else{
				stock+= s[i];
				s.erase(s.begin()+i);
				string t =Sort(stock);
				Rep(j,t.size()){
					if(s[i-1]<t[j]){
						s.erase(s.begin()+(i-1));
						s+=t[j];
						break;
					}
				}
				break;
			}
		}
		cout<<s<<endl;
	}

	
	
	return 0;
}

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

typedef pair<string,int> P;

string change(char a, char b) {
  string s;
  if((a=='r' && b=='g') || (a=='g' && b=='r')) s="bb";
  if((a=='r' && b=='b') || (a=='b' && b=='r')) s="gg";
  if((a=='g' && b=='b') || (a=='b' && b=='g')) s="rr";
  return s;
}

int main() {
  string t;
  while(cin >> t && t!="0") {
    map<string,int> color;
    queue<P> que;
    que.push(P(t,0));
    color[t]=1;
    int ans=-1;
    while(!que.empty()) {
      P p=que.front();
      que.pop();
      string s=p.first;
      bool ck=true;
      for(int i=0; i<s.size()-1; i++) {
	if(s[i]!=s[i+1]) {
	  string r;
	  r=s.substr(0,i)+change(s[i],s[i+1])+s.substr(i+2,s.size()-i-2);
	  if(color[r]!=1) {
	    que.push(P(r,p.second+1));
	    color[r]=1;
	  }
	  ck=false;
	}
      }
      if(ck) {
	ans=p.second;
	break;
      }
    }
    if(ans==-1) cout << "NA" << endl;
    else cout << ans << endl;
  }
  return 0;
}


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

int main(){
  string s;
  cin >> s;
  if (s.at(2) == s.at(3) && s.at(4) == s.at(5)){
    cout << "Yes" << endl;
  }
  else{
    cout << "No" << endl;
  }
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <cstdio>
#include <cmath>
#include <tuple>


using namespace std;
#define i64  long long

void solve(void)
{
  i64 A,B;
  cin>>A>>B;
  cout<<max(A+B,max(A*B,A-B));
  return;
  
}
int main(int argc, const char *argv[])
{

  solve();

  return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;
public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ

		Scanner sc=new Scanner(System.in);
		int k=sc.nextInt();
		int a=sc.nextInt();
		int b=sc.nextInt();
		
		int kyori=(b/k)*k;
		
		if(a<=kyori) {
			System.out.println("OK");
		}else {
			System.out.println("NG");
		}
		sc.close();
	}

}


Measured memory_bytes: 26964
#![allow(unused_parens)]
#![allow(unused_imports)]
#![allow(non_upper_case_globals)]
#![allow(non_snake_case)]
#![allow(unused_mut)]
#![allow(unused_variables)]
#![allow(dead_code)]

use itertools::Itertools;
use proconio::input;
use proconio::marker::{Chars, Usize1};

#[allow(unused_macros)]
#[cfg(debug_assertions)]
macro_rules! mydbg {
    //($arg:expr) => (dbg!($arg))
    //($arg:expr) => (println!("{:?}",$arg));
      ($($a:expr),*) => {
          eprintln!(concat!($(stringify!($a), " = {:?}, "),*), $($a),*);
      }
}
#[cfg(not(debug_assertions))]
macro_rules! mydbg {
    ($($arg:expr),*) => {};
}

macro_rules! echo {
    ($($a:expr),*) => {
          $(println!("{}",$a))*
      }
}

use std::cmp::*;
use std::collections::*;
use std::ops::{Add, Div, Mul, Sub};

#[allow(dead_code)]
static INF_I64: i64 = 92233720368547758;
#[allow(dead_code)]
static INF_I32: i32 = 21474836;
#[allow(dead_code)]
static INF_USIZE: usize = 18446744073709551;
#[allow(dead_code)]
static M_O_D: usize = 1000000007;
#[allow(dead_code)]
static PAI: f64 = 3.1415926535897932;

trait IteratorExt: Iterator {
    fn toVec(self) -> Vec<Self::Item>;
}

impl<T: Iterator> IteratorExt for T {
    fn toVec(self) -> Vec<Self::Item> {
        self.collect()
    }
}

trait CharExt {
    fn toNum(&self) -> usize;
    fn toAlphabetIndex(&self) -> usize;
    fn toNumIndex(&self) -> usize;
}
impl CharExt for char {
    fn toNum(&self) -> usize {
        return *self as usize;
    }
    fn toAlphabetIndex(&self) -> usize {
        return self.toNum() - 'a' as usize;
    }
    fn toNumIndex(&self) -> usize {
        return self.toNum() - '0' as usize;
    }
}

trait VectorExt {
    fn joinToString(&self, s: &str) -> String;
}
impl<T: ToString> VectorExt for Vec<T> {
    fn joinToString(&self, s: &str) -> String {
        return self
            .iter()
            .map(|x| x.to_string())
            .collect::<Vec<_>>()
            .join(s);
    }
}

trait StringExt {
    fn get_reverse(&self) -> String;
}
impl StringExt for String {
    fn get_reverse(&self) -> String {
        self.chars().rev().collect::<String>()
    }
}

trait UsizeExt {
    fn pow(&self, n: usize) -> usize;
}
impl UsizeExt for usize {
    fn pow(&self, n: usize) -> usize {
        return ((*self as u64).pow(n as u32)) as usize;
    }
}

fn main() {
    input! {
       N: usize,
       K:usize,
    }
    let mut m = vec![];
    for _ in 0..K {
        input! {
            l:usize,
            r:usize,
        }
        m.push((l, r));
    }

    let mut sum = vec![0; N + 10];
    let mut dp = vec![0; N + 10];
    dp[0] = 1;
    sum[1] = 1;
    for i in 1..N {
        for j in 0..K {
            let (l, r) = m[j];
            if i >= l {
                dp[i] += sum[i + 1 - l] - sum[i.saturating_sub(r)];
                dp[i] %= 998244353;
                dp[i] = (dp[i] + 998244353) % 998244353;
            }
        }
        sum[i + 1] = sum[i] + dp[i];
        sum[i + 1] %= 998244353;
    }
    echo!(dp[N - 1]);
}


Measured memory_bytes: 3616
import fractions
a,b,c,d = map(int,input().split())
cd = (c*d) // fractions.gcd(c,d)
c_sum = (b // c) - ((a-1) // c)
d_sum = (b // d) - ((a-1) // d)
cd_sum = (b // cd) - ((a-1) // cd)
result = b-a+1 -(c_sum+d_sum-cd_sum)
print(result)

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

int main() {
	ios :: sync_with_stdio(false);
	cin.tie(0);
	int n;
	cin >> n;
	vector<int> v;
	for(int i = 0; i < n; i++) {
		int x;
		cin >> x;
		v.push_back(x);
	}
	sort(v.begin(), v.end());
	auto p = unique(v.begin(), v.end());
	v.resize(distance(v.begin(), p));
	int n1 = v.size();
	cout << (n1 != n ? "NO" : "YES");
	return 0;
}

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

int main(){
	int N;
	cin>>N;
	double sum=0;
	string unit;
	double number;
	for(int i=0;i<N;i++){
		cin>>number>>unit;
		if(unit=="JPY"){
			sum += number;
		}	else if(unit=="BTC"){
			sum += number*380000.0;
		}
	}
	cout<<sum;
	return 0;
}	


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<queue>
#include<complex>
#include<algorithm>
#define INF 1<<30
using namespace std;
typedef pair<int,int> mypair;
typedef pair<mypair,mypair> pi;
int dx[7]={0,1,1,0,-1,-1,0};
int dy[2][7]={{1,0,-1,-1,-1,0,0},
	{1,1,0,-1,0,1,0}};
int main(){
	int sx,sy,gx,gy,n,lx,ly;
	int dp[201][201][6];
	for(int i=0;i<201;i++)for(int j=0;j<201;j++)for(int k=0;k<6;k++)dp[i][j][k]=INF;
	//fill(dp[0][0],dp[201][0],INF);
	bool ob[201][201]={};

	cin>>sx>>sy>>gx>>gy>>n;
	for(int i=0;i<n;i++){
		int x,y;
		cin>>x>>y;
		ob[100+x][100+y]=true;	
	}
	  

	cin>>lx>>ly;
	  

	priority_queue<pi> q;
	q.push(pi(mypair(0,0),mypair(sx,sy)));
//	q.push((S){sx,sy,0,0});
	while(!q.empty()){
	pi temp =q.top();
	q.pop();
	int ti=temp.first.first,p=temp.first.second,x=temp.second.first,y=temp.second.second;
	//int x=temp.x ,y=temp.y ,ti temp.t ,p=temp.p;
	if(dp[x+100][y+100][-ti]<=-p)continue;
	dp[x+100][y+100][-ti] = -p;
	
		for(int i=0;i<7;i++){
		int nx = x+dx[i];
		int ny = y+dy[abs(x)%2][i];
		if(abs(ny)<=ly&&abs(nx)<=lx&&!ob[nx+100][ny+100]){
				
					q.push(pi(mypair((ti-1)%6,p-(abs(x*y*ti)%6!=i)),mypair(nx,ny)));
//		q.push((S){nx,ny,(ti+1)%6,p+(abs(x*y*ti)%6!=i)});		
			}
		}

			}
	int ans =INF;
	
	for(int i=0;i<6;i++){
	ans =min(ans,dp[gx+100][gy+100][i]);
//	cout<<dp[gx+100][gy+100][i]<<endl;
	}
	
	
	if(ans==INF)cout<<-1<<endl;
	else cout<<ans<<endl;

return 0;
}



Measured memory_bytes: 4828
import numpy as np

N = int(input())
S = []
P = []
for i in range(N):
    s, p = input().split()
    p = int(p)
    S.append(s)
    P.append(p)

for n in sorted(set(S)):
    d = []
    p = []
    for i in range(N):
        if S[i] == n:
            d.append(i)
            p.append(P[i])

    for i in np.argsort(p)[::-1]:
        print(d[i] + 1)


Measured memory_bytes: 12396
import java.util.*;
public class Main{
  public static void main(String[]args){
      Scanner sc = new Scanner(System.in);

      int a = sc.nextInt();
      int b = sc.nextInt();
      int c = sc.nextInt();
      int d = sc.nextInt();

      if(a+b==c+d){
        System.out.println("Balanced");
      }else if(a+b>c+d){
        System.out.println("Left");
      }else{
        System.out.println("Right");
      }
  }
}


Measured memory_bytes: 23764
package main

import (
	"bufio"
	"fmt"
	"os"

)

func main(){
	reader := bufio.NewReader(os.Stdin)
	writer := bufio.NewWriter(os.Stdout)
	defer writer.Flush()
  var n int64;
  fmt.Scan(&n);
  nums:=make([]int64,n)

  for i:=1;i<int(n);i++{
			if i == int(n-1) {
				fmt.Fscanf(reader, "%d\n", &nums[i])
			} else {
				fmt.Fscanf(reader, "%d", &nums[i])
			}		
		}
	//fmt.Println(nums)
  ans:=make([]int64,n)
  for i:=1;i<int(len(nums));i++{

	  ans[nums[i]-1]++
  }
 for i:=range ans{
	 fmt.Println(ans[i])
 }
}

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

#define int         long long
#define pb          push_back
#define pii         pair<int,int>
#define vi          vector<int>
#define vii         vector<pii>
#define mi          map<int,int>
#define mii         map<pii,int>
#define all(a)      (a).begin(),(a).end()
#define x           first
#define y           second
#define sz(x)       (int)x.size()
#define endl        '\n'
#define hell        10000000000007LL
#define rep(i,a,b)  for(int i=a;i<b;i++)
using namespace std;
int n,k,dp[303][303][303],h[303];
int go(int pos,int last,int rem){
    if(rem<0) return hell;
    if(pos==n+1) return 0;
    int &ans=dp[pos][last][rem];
    if(ans!=-1) return ans;
    return ans=min(go(pos+1,last,rem-1),go(pos+1,pos,rem)+max(0LL,h[pos]-h[last]));
}
void solve(){
    memset(dp,-1,sizeof dp);
    cin>>n>>k;
    rep(i,1,n+1) cin>>h[i];
    cout<<go(1,0,k)<<endl;
}

signed main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int t=1;
    // cin>>t;
    while(t--){
        solve();
    }
    return 0;
}

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

using namespace std;
typedef long long ll;
#define int ll

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; }

#define REP(i,n) for(int i=0;i<n;++i)
#define SORT(name) sort(name.begin(), name.end())
#define ZERO(p) memset(p, 0, sizeof(p))
#define MINUS(p) memset(p, -1, sizeof(p))
#if 1
#  define DBG(fmt, ...) printf(fmt, ##__VA_ARGS__)
#else
#  define DBG(fmt, ...)
#endif

const ll LLINF = (1LL<<60);
const int INF = (1LL<<30);
const double DINF = std::numeric_limits<double>::infinity();
const int MOD = 1000000007;
const int MAX_N = 1000010;

string Nc;
int Len;
int dp[MAX_N][2];

int dfs(int i, int raising) {
    if(i >= Len) { return 0; }

    int& ret = dp[i][raising];
    if(~ret) { return ret; }
    ret = LLINF;

    int n = Nc[i] - '0' + raising;

    // 繰り上がりをする場合
    ret = dfs(i + 1, 1) + (10 - n);
    // 繰り上がりをしない場合
    chmin(ret, dfs(i + 1, 0) + n);

    return ret;
}

int solve(string N) {
    N = "0" + N;

    reverse(N.begin(), N.end());

    ll len = N.length();

#if 1
    Len = len;
    Nc = N;
    MINUS(dp);
    ll ret = dfs(0, 0);
    return ret;
#else
    // a = 支払うお金, b = おつり
    int ans = LLINF;
    for(int border = 1; border < 10; border++) {
        int a = 0, b = 0;
        int raising = 0;    // 繰り上がり
        REP(i, len) {
            int n = N[i] - '0' + raising;
            if (n <= border) {
                // 5 以下なら a に足す
                a += n;
                raising = 0;
            }
            else {
                // 6 以上なら b に足して繰り上がり
                b += (10 - n);
                raising = 1;
            }
        }
        int cand = a + b;
        chmin(ans, cand);
    }
    return ans;
#endif
}

int digit_sum(int n) {
    string s = to_string(n);
    int ret = 0;
    REP(i, s.length()) {
        ret += (s[i] - '0');
    }
    return ret;
}
int brute_force(string N) {
    int n = atoi(N.c_str());
    int lim = 1;
    REP(i, N.length() + 1) {
        lim *= 10;
    }
    int ret = LLINF;
    for(int a = n; a < lim; ++a){
        int b = a - n;
        int cand = digit_sum(a) + digit_sum(b);
        chmin(ret, cand);
    }
    return ret;
}

#define SUBMIT

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

#if defined(SUBMIT)
    string N;
    cin >> N;

    int ans = solve(N);

    printf("%lld\n", ans);
#else
    for(int n = 1; n < 1000; ++n) {
        string N = to_string(n);
        int cand = solve(N);
        int ans = brute_force(N);
        if(cand != ans) {
            printf("cand: %lld ans: %lld N: %s\n", cand, ans, N.c_str());
            return 0;
        }
    }
    printf("OK\n");
#endif

    return 0;
}



Measured memory_bytes: 65820
import core.bitop, std.algorithm, std.ascii, std.bigint, std.conv, std.math,
    std.functional, std.numeric, std.range, std.stdio, std.string, std.random,
    std.typecons, std.container, std.format;

// dfmt off
T lread(T = long)(){return readln.chomp.to!T();}
T[] aryread(T = long)(){return readln.split.to!(T[])();}
void scan(TList...)(ref TList Args){auto line = readln.split();
foreach (i, T; TList){T val = line[i].to!(T);Args[i] = val;}}
alias sread = () => readln.chomp();enum MOD = 10 ^^ 9 + 7;
alias PQueue = BinaryHeap!(Array!long, "a<b");
// dfmt on

/// Number of k-combinations
T combination(T = long)(T n, T k)
{
    assert(0 <= k);
    assert(0 <= n);
    if (n < k)
        return 0;
    k = min(n - k, k);
    if (k == 0)
        return 1;
    if (k == 1)
        return n;
    return memoize!combination(n - 1, k - 1) + memoize!combination(n - 1, k);
}

void main()
{
    long N = lread();
    {
        writeln((N - 1) * N / 2);
    }
}


Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main(void) {
    int l, m, n, K, S, X;
    cin >> K >> S;
    X = 0;
    for (l=0;l<=K;l++) {
        for (m=0;m<=K;m++) {
            if (l+m <= S && S-(l+m) <= K) X++;
        }
    }

    cout << X << endl;
    return 0;
}

Measured memory_bytes: 256
import copy

N = int(input())
nums = list(map(int, input().split()))

asc_nums = sorted(nums)


def check():
    """総当たりで入れ替えてチェックする"""
    # 入れ替えずに昇順かチェックする
    if nums == asc_nums:
        return "YES"
    for i in range(N):
        for j in range(i + 1, N):
            nums_copy = copy.copy(nums)
            nums_copy[i] = nums[j]
            nums_copy[j] = nums[i]
            if nums_copy == asc_nums:
                return "YES"
    return "NO"


print(check())


Measured memory_bytes: 3444
#include <iostream>
#include <string>
#include <vector>
#include <math.h>
#include <stdio.h>
#include <algorithm>
#include <cmath>
#include <map>
#include <cstdio>
#include <cstdlib>
#include <istream>
#include <set>
#include <queue>
#define rep0(i,n) for (long long int i = 0; i <= (n); ++i)
#define rep1(i,n) for (long long int i = 1; i <= (n); ++i)
#define REP(a,b) for (long long int i = a; i <= (b); ++i) 
#define ps push_back 
#define MOD 1000000007
using namespace std;
typedef long long ll;
int main() {
	string s;
	cin >> s;
	int count = 0;
	string ans;
	if (s[0] == '1') {
		rep0(i, s.size() - 1) {
			if (i % 2 != 0)
				ans += '0';
			else
				ans += '1';
		}
	}
	else {
		rep0(j, s.size() - 1) {
			if (j % 2 != 0)
				ans += '1';
			else
				ans += '0';
		}

	}
	rep0(k, s.size() - 1) {
		if (s[k] != ans[k])
			++count;
	}
	cout << count<< endl;
	return 0;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define ll long long int
#define ff first
#define ss second
#define S size()
#define mod (ll)(1e9+7)
#define mset(a,k) memset(a,k,sizeof(a))
#define fr(i, x, y) for ( ll i = x; i < y;i++)
#define dr(i, x, y) for ( ll i = x; i >= y; i--)
#define all(v) v.begin(), v.end()
#define pqueue priority_queue<ll>
#define piqueue priority_queue<ll,vll ,greater<ll>>
#define mapcl map<char,ll>
#define mapll map<ll,ll>
#define mapsl map<string,ll>
#define vi vector<ll>
#define vs vector<string>
#define vb vector<bool>
#define psi pair<string,ll>
#define pii pair<ll,ll>
#define piii pair<ll,pii>
#define vii vector<pii>
#define vvi vector<vi>
#define vvii vector<vii>
using namespace std;
void fast() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
}
//----------------------------------------FUNCTIONS-------------------------------------
ll gcd(ll x, ll y )						{if (y == 0) return x; return gcd(y, x % y);}
ll lcm(ll a, ll b)						{return (a * b) / gcd(a, b);}
ll logx(ll base, ll num)				{int cnt = 0; while (num != 1) {num /= base; ++cnt;} return cnt;}
vi vin(ll n)							{vi a(n); fr(i, 0, n) cin >> a[i]; return a;}
void out(vi a)							{for (int i = 0; i < (ll)a.S; i++) { cout << a[i] << " "; } cout << endl;}
void in(ll *a, ll n)        			{for (ll i = 0; i < n; i++)cin >> a[i];}
void out(ll *a, ll n)					{fr(i, 0, n) {cout << a[i] << " ";} cout << '\n';}
void out1(vi v)							{fr(i, 0, (ll)v.S) {cout << v[i] << " ";} cout << endl;}
const ll MAXN = (ll)(1 * 1e6 + 5 ), level = 22;

void solve()
{
	ll n;
	cin >> n;
	mapsl m;
	fr(i, 0, n)
	{
		string s;
		cin >> s;
		m[s]++;
	}
	string s[4] = {"AC", "WA", "TLE",  "RE"};
	fr(i, 0, 4)
	{
		if (m.find(s[i]) == m.end()) {
			cout << s[i] << " x " << 0 << '\n';
		}
		else
		{
			cout << s[i] << " x " << m[s[i]] << '\n';
		}
	}

}
int main()
{

#ifndef ONLINE_JUDGE
	freopen ("inp4.txt", "r", stdin);
	freopen ("out4.txt", "w", stdout);
#endif
	fast();
	ll t = 1;
	//cin >> t;
	fr(i, 0, t)
	{
		solve();
	}
}

Measured memory_bytes: 3632
/**
  * http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ITP1_7_D&lang=jp
  * Structured Program II - Matrix Multiplication
  */
object Main {
  type Matrix[T] = Seq[Seq[T]]

  def main(args: Array[String]): Unit = {
    val Array(n, m, l) = io.StdIn.readLine().split(" ").map(_.toInt)
    val matrixA = readMatrix(n)
    val matrixB = readMatrix(m)
    val result = multiplyMatrix(matrixA, matrixB)
    result.foreach(row => println(row.mkString(" ")))
  }

  def readMatrix(rows: Int): Matrix[Int] = {
    Iterator.continually(io.StdIn.readLine()).takeWhile(_ != null).take(rows).map(_.split(" ").map(_.toInt).toSeq).toList
  }

  def swapDim(matrix: Matrix[Int]): Matrix[Int] = {
    val width = matrix.head.length
    (0 until width).map(column => matrix.map(_ (column)))
  }

  // element type is Long
  def multiplyMatrix(matrixA: Matrix[Int], matrixB: Matrix[Int]): Matrix[Long] = {
    val swappedB = swapDim(matrixB)
    matrixA.map(elemA => swappedB.map(elemB => (elemA zip elemB).foldLeft(0L)((acc, x) => acc + x._1 * x._2)))
  }
}

Measured memory_bytes: 127880
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <complex>
#include <string>
#include <sstream>
#include <algorithm>
#include <numeric>
#include <vector>
#include <queue>
#include <stack>
#include <functional>
#include <iostream>
#include <map>
#include <set>
using namespace std;
typedef pair<int,int> P;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
#define pu push
#define pb push_back
#define mp make_pair
#define eps 1e-9
#define INF 2000000000
#define sz(x) ((int)(x).size())
#define fi first
#define sec second
#define SORT(x) sort((x).begin(),(x).end())
#define all(x) (x).begin(),(x).end()
#define EQ(a,b) (abs((a)-(b))<eps)
bool prime[100100];
const int MAX=100000;
void eratos()
{
	memset(prime,true,sizeof(prime));
	prime[0]=prime[1]=false;
	for(int i=2;i*i<=MAX;i++)if(prime[i])
	{
		for(int j=i*2;j<=MAX;j+=i)
		{
			prime[j]=false;
		}
	}
	return;
}
int Count(int x)
{
	int res=0;
	for(int i=1;i<=x/2;i++)
	{
		if(prime[i]&&prime[x-i])res++;
	}
	return res;
}
int main()
{
	eratos();
	while(1)
	{
		int n;
		scanf("%d",&n);
		if(n==0)break;
		printf("%d\n",Count(n));
	}
	return 0;
}

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

int comparador(const void *a, const void *b)
{
   return ( *(int*)a - *(int*)b );
}

int main()
{
   int n;
   scanf("%d", &n);
   int a[n];
   int marcador[1000001] = {0};
   int result = 0, valor, igual = 0, maior = 0;

   for(int i=0; i<n; i++)
   {
      scanf(" %d", &a[i]);
      if(a[i] > maior)       //guarda o maior numero
         maior = a[i];
   }
   qsort(a,n,sizeof(int),comparador);

   for(int i=0; i<n; i++)
   {
      if(marcador[a[i]] == 0)
      {
         if(a[i+1] != a[i])
            result++;

         for(int j=1;; j++)
         {
            valor = a[i]*j;
            if(valor > maior)
               break;
            marcador[valor] = 1;
         }
      }
   }
   printf("%d\n", result);
   return 0;
}


Measured memory_bytes: 7040
#pragma GCC optimize ("O3")
#pragma GCC target("sse4")
#include <bits/stdc++.h>
#define f first
#define s second
#define pb push_back
#define mp make_pair
#define ts to_string
#define ub upper_bound
#define lb lower_bound
const char nl = '\n';
using namespace std;
using ll = long long;
using vi = vector<int>;
using vl = vector<ll>;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using str = string;
//The following debugging code was taken from Benjamin Qi's template :) 
str ts(char c) { return str(1,c); }
str ts(bool b) { return b ? "true" : "false"; }
str ts(const char* s) { return (str)s; }
str ts(str s) { return s; }
template<class A> str ts(complex<A> c) { 
    stringstream ss; ss << c; return ss.str(); }
str ts(vector<bool> v) { 
    str res = "{"; for(int i = 0;i < (int)v.size(); i++) res += char('0'+v[i]);
    res += "}"; return res; }
template<size_t SZ> str ts(bitset<SZ> b) {
    str res = ""; for(int i = 0; i < b.size(); i++) res += char('0'+b[i]);
    return res; }
template<class A, class B> str ts(pair<A,B> p);
template<class T> str ts(T v) { 
    bool fst = 1; str res = "{";
    for (const auto& x: v) {
        if (!fst) res += ", ";
        fst = 0; res += ts(x);
    }
    res += "}"; return res;
}
template<class A, class B> str ts(pair<A,B> p) {
    return "("+ts(p.f)+", "+ts(p.s)+")"; }
void DBG() { cerr << "]" << endl; }
template<class H, class... T> void DBG(H h, T... t) {
    cerr << ts(h); if (sizeof...(t)) cerr << ", ";
    DBG(t...); }

#ifdef LOCAL 
#define dbg(...) cerr << "LINE(" << __LINE__ << ") -> [" << #__VA_ARGS__ << "]: [", DBG(__VA_ARGS__)
#else
#define dbg(...) 0
//freopen(".in", "r", stdin);
//freopen(".out", "w", stdout);
#endif
//CODE STARTS HERE-----------------------------------------------------------------------------------------// 
const int MOD = 1e9 + 7;
const int N = 1e3 + 15;
int h, w;
char inp[N][N];
int dp[N][N];

int add(int x, int y)
{
    x += y;
    while(x >= MOD) x -= MOD;
    while(x < 0) x += MOD;
    return x;
}

signed main(){
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);
    cin >> h >> w;
    for(int i =1; i <= h; i++){
        for(int j = 1; j <= w; j++){
            cin >> inp[i][j];
        }
    }
    for(int i = 1; i <= h; i++){
        for(int j = 1; j <= w; j++){
            if(inp[i][j] == '.'){
                dp[i][j] = add(dp[i-1][j], dp[i][j-1]);
                if(i == 1 && j == 1){
                    dp[1][1] = 1;
                }
            }
            dbg(dp[i][j], i , j);
        }
    }
    cout << dp[h][w] << nl;
}


Measured memory_bytes: 8536
#include <stdio.h>

	int main(void)
	{
		int A, B, C, D, E, max;

		scanf("%d", &A);
		scanf("%d", &B);

		C = A + B;
		D = A - B;
		E = A * B;

		


		max = C;
		if (max < D) {
			max = D;
		}
		if (max < E) {
			max = E;
		}

		printf("%d\n", max);

		return 0;
	}


Measured memory_bytes: 128
#include <iostream>

using namespace std;

int Num(int n){
    int count=0;
    while(n%2==0){
    n/=2;
    count++;
    }
    return count;
}
int main(){
    int N,count=0;
    cin >> N;
    int a[N]={};
    for (int i=0 ;i<N;i++){
    cin >> a[i];
    }
    for(int i=0; i<N;i++){
    count+=Num(a[i]);
    }
    cout << count << endl;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <math.h>
#include <stdlib.h>
#include <string.h>

typedef long long ll;
const double PI = 3.1415926535897932384626433;
const int MOD = 1e9+7;
const int INF = 1e9;
#define rep(i, n) for(int i=0;i<(n);++i)

//prototype declaration

//gloval variable


int main(void){
  int h, w;
  scanf("%d %d\n", &h, &w);

  char ** map;
  map = (char**)calloc(h, sizeof(char*));
  if(map == NULL){
    fprintf(stderr, "memory allocation error.\n");
    exit(1);
  }
  for(int i = 0; i < h; i++){
    map[i] = (char*)calloc(w, sizeof(char));
    if(map[i] == NULL){
      fprintf(stderr, "memory allocation error.\n");
      exit(1);
    }
  }
  for(int i = 0; i < h; i++){
    for(int j = 0; j < w; j++){
      scanf(" %c", &map[i][j]);
    }
  }

  int * discardROW;
  discardROW = (int*)calloc(h, sizeof(int));
  if(discardROW == NULL){
    fprintf(stderr, "memory allocation error.");
    exit(1);
  }
  int * discardCOLUMN;
  discardCOLUMN = (int*)calloc(w, sizeof(int));
  if(discardCOLUMN == NULL){
    fprintf(stderr, "memory allocation error.");
    exit(1);
  }

  for(int i = 0; i < h; i++){
    int flag = 0;
    for(int j = 0; j < w; j++){
      if(map[i][j]=='#') flag++;
    }
    if(flag==0) discardROW[i] = 1;
  }
  for(int i = 0; i < w; i++){
    int flag = 0;
    for(int j = 0; j < h; j++){
      if(map[j][i]=='#') flag++;
    }
    if(flag==0) discardCOLUMN[i] = 1;
  }

  for(int i = 0; i < h; i++){
    if(discardROW[i]==0){
      for(int j = 0; j < w; j++){
        if(discardCOLUMN[j]==0)printf("%c", map[i][j]);
      }
      printf("\n");
    }
  }

  free(discardROW);
  free(discardCOLUMN);
  for(int i = 0; i < h; i++){
    free(map[i]);
  }
  free(map);
  return 0;
}


Measured memory_bytes: 1660
#include<bits/stdc++.h>
using namespace std;
int main(){
  int a,b,c,k,sum=0,ssum=0,sssum=0;
  cin>>a>>b>>c>>k;
  sssum=a+b+c;
  
  if(a>sum){sum=a;}
  if(b>sum){sum=b;}
  if(c>sum){sum=c;}
  if(a>sum){sum=a;}

  sssum-=sum;

  for(int i=0;i<k;i++){
    sum*=2;
  }
  cout<<sum+sssum<<endl;
  
}
  


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#include<queue>
#include<map>
#include<math.h>
#include<numeric>
#include<utility>
#include<unordered_map> //hash map

#define rep(i,a,n) for(int (i)=(a);(i)<(n);(i)++)
#define rrep(i,a,n) for(int (i)=(a);(i)>=(n);(i)--)

#define INF 1000000000
#define MOD 1000000007

typedef  long long ll;

using namespace std;

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

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

double euclid_distance(double a,double b){
    return sqrt(a*a+b*b);
}

ll gcd(ll  a,ll b){
    ll r;
    if(a < b){
        ll tmp;
        tmp = a;
        a = b;
        b = tmp;
    }
    while(r = a % b){
        a = b;
        b = r;
    }
    return b;
}
/*
ll Integer_factorization(ll n){
    ll num = 0;
    ll ndash = n;
    if(n == 1) return 1;
    ll a = 2;
    while(ndash >= a*a){
        if(n % a  == 0){
            count++;
            n/=a;

        if(count % b == 0){
            ans *= a;
        }
        }else{a++;count = 0;}
    }

    return num;
}
*/

ll r_fuct[2000];
ll fuct[2000];

//MOD逆元
void conb(ll n,ll k){
    fuct[0] = 1;
    for(int i = 1;i < k+1;i++){
        fuct[i] *= fuct[i-1]%MOD;
        
        ll b = MOD, u = 1, v = 0;
        ll value = fuct[i];
        while (b) {
            ll t = value / b;
            value -= t * b;
            swap(value, b);
            u -= t * v;
            swap(u, v);
        }
        u %= MOD;
        if (u < 0) u += MOD;
        r_fuct[i] = u;
    }
}

ll factrial(ll n){
    if(n == 0) return 1;
    ll p = factrial(n-1)*n%MOD;
    return p;
}

//MOD逆元
ll farmat(ll n,ll p){    
    if(p == 0) return 1;
    else if(p == 1) return n%MOD;
    ll d = farmat(n,p/2);
    if(p%2 == 0){
        return (d*d)%MOD;
    }else{
        return ((n*d)%MOD*d)%MOD;
    }
}

ll conbination(ll n,ll k){
    ll a = factrial(n);
    ll b = factrial(k);
    ll c = factrial(n-k);
    return (a*farmat(b,MOD-2)%MOD*farmat(c,MOD-2))%MOD;
}

int memo[10000000];

int fib(int i){
    if(i <= 1) return i;
    if(memo[i] != 0) return memo[i];
    return memo[i] = fib(i-1)+fib(i-2);
}

ll dig(ll n){
    ll d = 0;
    while(n != 0){
        n/=10;
        d++;
    }
    return d;
}

void solve() {
  int a,b,c;
  cin>> a >> b >> c;
  if(a+b >= c) cout << "Yes";
  else cout << "No";
}




int main() {

	cin.tie(0);
	ios::sync_with_stdio(false);
	solve();
	return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n; i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define INF 2e9
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;

void Main()
{
    string a, b, c;
    cin >> a >> b >> c;
    string x, y, z;
    x = b;
    y = a;
    z = x;

    x = c;

    cout << x << ' ' << y << ' ' << z << endl;
}

int main()
{
    std::cout << std::fixed << std::setprecision(15);
    Main();
}

//　if文
// if (num == 0)
// {
//     cout << "0";
// }
// else if (num == 1)
// {
//     cout << "1"; // 1が表示される
// }
// else
// {
//     cout << "01以外";
// }

Measured memory_bytes: 256
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <cmath>
#include <iomanip>
using namespace std;
//typedef __int64 LL;
typedef pair<int,int> P;
const int INF=100000000;

int main(){
	double L;
	cin>>L;
	cout<<fixed<<setprecision(10)<<(L/3)*(L/3)*(L/3)<<"\n";
	return 0;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

#define MAX 2000000

int H, A[MAX+1];

void maxHeapify(int i)
{
    int l, r, largest;

    l = 2 * i;
    r = 2 * i + 1;

    // 左の子、自分、右の子で値が最大のノードを選ぶ
    if (l <= H && A[l] > A[i]) largest = l;
    else largest = i;
    if (r <= H && A[r] > A[largest]) largest = r;

    if (largest != i) {
        swap(A[i], A[largest]);
        maxHeapify(largest);
    }
}

int main()
{
    cin >> H;

    for (int i = 1; i <= H; i++) cin >> A[i];

    for (int i = H / 2; i >= 1; i--) maxHeapify(i);

    for (int i = 1; i <= H; i++) {
        cout << " " << A[i];
    }
    cout << endl;

    return 0;
}


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

using namespace std;

using ll = long long;
using P = pair<ll, ll>;
using Graph = vector<vector<ll>>;
#define rep(i, n) for(ll i=0;i<(ll)(n);i++)
#define rep2(i, m, n) for(ll i=m;i<(ll)(n);i++)
#define rrep(i, n, m) for(ll i=n;i>=(ll)(m);i--)
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
const int ddx[8] = {0, 1, 1, 1, 0, -1, -1, -1};
const int ddy[8] = {1, 1, 0, -1, -1, -1, 0, 1};
const ll MOD = 1000000007;
const ll INF = 1000000000000000000L;
#ifdef __DEBUG

/**
 * For DEBUG
 * https://github.com/ta7uw/cpp-pyprint
 */
#include "cpp-pyprint/pyprint.h"

#endif

void solve() {
    ll N, M;
    cin >> N >> M;
    vector<ll> H(N);
    rep(i, N) cin >> H[i];
    Graph graph(N);
    rep(i, M) {
        ll a, b;
        cin >> a >> b;
        a--;
        b--;
        graph[a].push_back(b);
        graph[b].push_back(a);
    }
    ll ans = 0;
    rep(i, N) {
        ll h = H[i];
        bool ok = true;
        for (ll u : graph[i]) {
            if (H[u] >= h) {
                ok = false;
            }
        }
        if (ok) ans++;
    }
    cout << ans << '\n';
}

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    solve();
    return 0;
}


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

int main() {
	string  st;
	bool flag = false;
	cin >> st;

	if (st.at(0) == st.at(1) &&  st.at(2) == st.at(3) &&st.at(1) != st.at(2)) flag=true;
 	else if (st.at(0) == st.at(2)&&  st.at(1) == st.at(3) &&st.at(2) != st.at(1)) flag=true;
	else if (st.at(0) == st.at(3) && st.at(1) == st.at(2) &&st.at(3) != st.at(1)) flag=true;
  
  	if (flag) cout << "Yes" << endl;
	else cout << "No" << endl;

}

Measured memory_bytes: 256
N = int(input())
s = []
f = True
for i in range(N):
  s.append(int(input()))
s = sorted(s, reverse = True)
a = sum(s)
if a%10 != 0:
  print(a)
  f = False

if f:
  m = 0
  f = True
  s = sorted(s)
  for i in range(N):
    if s[i]%10 != 0:
      f = False
      m = s[i]
      break

  if f:
    print(0)
  else:
    print(a-m)

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

int main() {
    int k, s, cnt = 0;
    cin >> k >> s;
    rep(x, k) {
        rep(y, k) {
            if(s - x - y >= 0 && s - x - y <= k) {
                cnt++;
            }
        }
    }
    cout << cnt << endl;
}


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

bool comp(const pair<string,int> a, const pair<string,int> b) {
  if (a.first != b.first)
    return a.first < b.first; // 高い順に並べたいので演算子を逆に
  else{
      return a.second > b.second;
  }
}

int main(){
  string s;

  cin >>s;
  int wnum = 0;

  for(int i = 0;i<(int)s.length();i++){
    if('o' == s[i])wnum++;
  }

  if((8 -wnum) > (15-(int)s.length()))cout <<"NO"<<endl;
  else cout <<"YES"<<endl;

  return 0;
  }

Measured memory_bytes: 256
sx, sy, tx, ty = gets.split.map(&:to_i)

ans = ""
# 1週目
(ty - sy).times do
  ans += "U"
end
(tx - sx).times do
  ans += "R"
end
(ty - sy).times do
  ans += "D"
end
(tx - sx).times do
  ans += "L"
end

# 2週目
ans += "L"
(ty - sy + 1).times do
  ans += "U"
end
(tx - sx + 1).times do
  ans += "R"
end
ans += "DR"
(ty - sy + 1).times do
  ans += "D"
end
(tx - sx + 1).times do
  ans += "L"
end
ans += "U"


puts ans

Measured memory_bytes: 29052
N, K = [int(i) for i in input().split()]
P = [int(i) for i in input().split()]
W = {'r': 'p', 's': 'r', 'p': 's'}
H = ['r', 's', 'p']
T = [i for i in list(input())]
dp = [[0, 0, 0] for _ in range(N+10)]
hl = []

for i in range(N):
    flag = True
    f2 = False
    for j in range(3):
        if f2:
            break
        for k in range(3):
            if W[T[i]] == H[k]:
                if i >= K:
                    if hl[i-K] == k:
                        hl.append(4)
                        dp[i+1] = [max(dp[i])]*3
                        f2 = True
                        break
                # print(i, j, k, hl)
                if flag:
                    hl.append(k)
                    flag = False
                dp[i+1][k] = max(dp[i+1][k], dp[i][j] + P[k])

print(max(dp[N]))

Measured memory_bytes: 18392
from math import floor

arr = []

def factorization(n):
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])

    if temp!=1:
        arr.append([temp, 1])

    if arr==[]:
        arr.append([n, 1])
    
n = int(input())
if n == 1:
  print(0)
  exit()
  
factorization(n)
ans = 0

for prime,power in arr:
  ans += floor((-1+(1+8*power)**0.5)/2)
  
print(ans)

Measured memory_bytes: 9376
#include <cstdio>
const int MAXN = 1e6 + 5, mod = 1e9 + 7;
inline int addmod(int a, int b) { return (a + b) % mod; }
inline int mulmod(long long a, int b) { return (a * b) % mod; }
int n, f[MAXN], prefix[MAXN];
inline int get(int l, int r) {
	int res = 0;
	if(l < 0) {
		res = addmod(res, -l);
		l = 0;
	}
	res = addmod(res, prefix[r]);
	if(l > 0) res = addmod(res, mod - prefix[l - 1]);
	return res;
}
int main() {
	scanf("%d", &n);
	f[0] = 1;
	f[1] = n;
	prefix[0] = f[0];
	prefix[1] = f[0] + f[1];
	int tmp = mulmod(n - 1, n - 1);
	for(int i = 2; i <= n; i++) {
		f[i] = addmod(f[i - 1], addmod(tmp, get(i - n - 1, i - 3)));
		prefix[i] = addmod(prefix[i - 1], f[i]);
	}
	printf("%d\n", f[n]);
	return 0;
}

Measured memory_bytes: 7936
#[allow(unused_macros)]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };

    ($next:expr, mut $var:ident : $t:tt $($r:tt)*) => {
        let mut $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

#[allow(unused_macros)]
macro_rules! debug {
    ($($a:expr),*) => {
        #[cfg(debug_assertions)]
        writeln!(&mut std::io::stderr(), concat!("[DEBUG] ", $(stringify!($a), "={:?} "),*), $($a),*);
    }
}

#[allow(unused_imports)]
use std::cmp::{min, max};
#[allow(unused_imports)]
use std::io::{stdout, stdin, BufWriter, Write};

fn main() {
    let out = std::io::stdout();
    let mut out = BufWriter::new(out.lock());
    macro_rules! puts {
        ($($format:tt)*) => (write!(out,$($format)*).unwrap());
    }

    input!{
      n: usize,
      d: usize,
    }

    let m = 2*d+1;
    let ans = (n+m-1)/m;
    puts!("{}\n", ans);
}


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

#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define rep(i,n) FOR(i,0,n)
#define RFOR(i,a,b) for(int i=(a)-1;i>=(b);i--)
#define rrep(i,n) RFOR(i,n,0)

using namespace std;

typedef long long ll;
typedef unsigned long long ull;

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

	int a, b;
	cin >> a >> b;

	cout << (abs(a - b) > 1 ? ":(" : "Yay!") << endl;
}

Measured memory_bytes: 256