akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>

int main() {

  int N;
  std::string str1, str2;
  int point1, point2;

  point1 = point2 = 0;

  std::cin >> N;
  for(int i = 0; i < N; ++i) {
    std::cin >> str1 >> str2;

    if( str1 > str2 ) {
      point1 += 3;
    }
    else if( str1 < str2 ) {
      point2 += 3;
    }
    else {
      point1 += 1;
      point2 += 1;
    }

  }

  std::cout << point1 << " " << point2 << std::endl;
  
  return 0;
}

Measured memory_bytes: 1212
/*
      author : nishi5451
      created: 12.08.2020 16:12:44
*/

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


int main(){
    string s;
    cin >> s;
    string a;
    rep(i,(int)s.size()){
        if(s[i]=='0') a.push_back('0');
        else if(s[i]=='1') a.push_back('1');
        else if(s[i]=='B'){
            if(!a.empty())
                a.pop_back();
        } 
    }
    cout << a << endl;
    return 0;
}


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


int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    string s;
    cin >> s;
    
    int n=s.size(), ans=0,now=0;
    rep(i,0,n){
    	if(s[i]=='A'||s[i]=='T'||s[i]=='C'||s[i]=='G') now++;
    	else now=0;
    	ans=max(now,ans);
    }
    cout << ans << endl;
}    


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


using namespace std;

int main() {
  int N,K;
  string S;
  cin >> N>> S>>K;
  char s;
  s = S.at(K-1);
  for(int i = 0; i < N; i++) {
    if(S.at(i) == s) {
      cout << s;
    }
    else{
      cout << '*';
    }
  }
  cout << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main(){
    int n;
    cin >> n;
    vector<int> v;
    for(int i = 0; i < n; i++){
        int a; cin >> a;
        v.push_back(a);
    }
   
    for(int i = n - 1 ; i >= 0; i--){
        if(i != 0){
            cout << v[i] << " ";
        }else{
            cout << v[i];
    }
    }
cout << endl;
return 0;
}
    

Measured memory_bytes: 3128
#include <iostream>
using namespace std;
int main(void){
  int n, sum=0;
  cin>>n;
  int t[n], m;
  for(int i=0; i<n; i++)
    cin>>t[i];
  cin>>m;
  int p[m], x[m];
  for(int i=0; i<m; i++)
    cin>>p[i]>>x[i];
  for(int i=0; i<m; i++){
    int copy[n];
    for(int j=0; j<n; j++)
      copy[j]=t[j];
    copy[p[i]-1]=x[i];
    for(int j=0; j<n; j++)
      sum+=copy[j];
    cout<<sum<<endl;
    sum=0;
  }
  return 0;
}

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

string s;
int w;

int main() {
  cin >> s >> w;
  string ans;
  for(int i=0;i<s.size();i++){
    if(i%w==0) ans+=s[i];
  }
  cout << ans << endl;
} 

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define double long double
#define SZ(x) ((int)(x).size())
#define rep(i,n) for(int i=0;i<(n);++i)
#define fore(i,a) for(auto &i:a)
#define min(...) min({__VA_ARGS__})
#define max(...) max({__VA_ARGS__})
#define Yes cout << "Yes" << endl;
#define No cout << "No" << endl;
#define ALL(x) (x).begin(),(x).end()
signed _main(); signed main() { cin.tie(0); ios::sync_with_stdio(false); _main(); }
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; }
template<class T> using v = vector<T>;
template<class T> using vv = vector<v<T>>;
const int MOD=1e9+7;
const long long INF = 1LL << 60;
using P=pair<int,int>;

signed _main(){
  int a,b; cin >> a >> b;
  cout << min(string(b,'0'+a),string(a,'0'+b)) << endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i,n,N) for(int i=n;i<N;i++)
#define p(S) cout<<(S)<<endl
using namespace std;
int dp[1001][1001];
int w[100010],c[100010];
int sumw[100010];
int main(){
	int n;
	cin>>n;
	REP(i,0,n) {
		cin>>c[i]>>w[i];
		if(i>0)	sumw[i]=sumw[i-1]+w[i];
		else sumw[i]=w[i];
	}
	REP(i,0,1001) REP(j,i,1001) dp[i][j]=j-i+1;
	REP(i,0,n-1)  if(c[i]>=w[i+1]||c[i+1]>=w[i]) dp[i][i+1]=1;


	for(int k=2;k<n;k++){
		for(int i=0;i+k<n;i++){
			if((dp[i+1][i+k]==1&&c[i]>=sumw[i+k]-sumw[i])||(dp[i][i+k-1]==1&&c[i+k]>=sumw[i+k-1]-(i?sumw[i-1]:0)))
				dp[i][i+k]=1;
			else dp[i][i+k]=min(dp[i+1][i+k],dp[i][i+k-1])+1;

			for(int j=i+1;j<i+k;j++)
				dp[i][i+k]=min(dp[i][i+k],dp[i][j]+dp[j+1][i+k]);
		}
	}
	p(dp[0][n-1]);
	return 0;
}

Measured memory_bytes: 7000
n,x = map(int,input().split())
a = [0] + list(map(int,input().split()))
ans = 0
for i in range(n):
  if a[i] + a[i+1] > x:
    ans += a[i] + a[i+1] - x
    a[i+1] -= a[i] + a[i+1] - x
print(ans)

Measured memory_bytes: 14052
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
#define fo(i,n) for(i=0;i<n;i++)
#define fok(i,k,n) for(i=k;i<n;i++)
#define ci(x) cin>>x;
#define ci2(x,y) cin>>x>>y;
#define co(x) cout<<x<<"\n";
#define co2(x,y) cout<<x<<" "<<y<<"\n";
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define PI 3.1415926535897932384626
typedef pair<int, int>	pii;
typedef pair<ll, ll>	pll;
typedef vector<int>		vi;
typedef vector<ll>		vl;
typedef vector<pii>		vpii;
typedef vector<pll>		vpll;
typedef vector<vi>		vvi;
typedef vector<vl>		vvl;
const int mod = 1000000007;

int main() {
	int L;
	scanf("%d",&L);
	printf("%.12f\n",(double)L*L*L/27);
	return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <fstream>
#include <sstream>
#include <set>
#include <map>
#include <vector>
#include <list>
#include <algorithm>
#include <cstring>
#include <cmath>
#include <string>
#include <stack>
#include <queue>
#include <bitset>     //UWAGA - w czasie kompilacji musi byc znany rozmiar wektora - nie mozna go zmienic
#include <cassert>
#include <iomanip>        //do setprecision
#include <ctime>
#include <complex>
using namespace std;

#define FOR(i,b,e) for(int i=(b);i<(e);++i)
#define FORQ(i,b,e) for(int i=(b);i<=(e);++i)
#define FORD(i,b,e) for(int i=(b)-1;i>=(e);--i)
#define REP(x, n) for(int x = 0; x < (n); ++x)

#define ST first
#define ND second
#define PB push_back
#define PF push_front
#define MP make_pair
#define LL long long
#define ULL unsigned LL
#define LD long double
#define pii pair<int,int>
#define pll pair<LL,LL>
#define vi vector<int>
#define vl vector<LL>
#define vii vector<vi>
#define vll vector<vl>

const double pi = 3.14159265358979323846264;
const int mod=1000000007;

int main(){
	LL n,k,m;
    cin>>n>>m>>k;
    vl a(n),b(m+2,mod);
    b[0]=-1;
    FOR(i,0,n){
        cin>>a[i];
    }
    LL rest=k,ans=0;
    FOR(i,0,m){
        cin>>b[i+1];
        if(i!=0)b[i+1]+=b[i];
        if(b[i+1]<=k)ans++;
    }
    FOR(i,0,n){
        rest-=a[i];
        if(rest<0)break;
        int t=i+1;
        t+=upper_bound(b.begin(),b.end(),rest)-b.begin()-1;
        if(ans<t)ans=t;
    }
    cout<<ans<<endl;




}


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

#define Bye return 0
#define ll long long

using namespace std;
const int MAX = 1e-6;

void solve(){
    int n; cin>>n;
    cout<<fixed<<setprecision(12)<<((double) n*n*n/27)<<endl;
}

int main(){
    solve();
    Bye;
}

Measured memory_bytes: 3740
#define _USE_MATH_DEFINES
#include "bits/stdc++.h"
using namespace std;
#define FOR(i,j,k) for(int (i)=(j);(i)<(int)(k);++(i))
#define rep(i,j) FOR(i,0,j)
#define each(x,y) for(auto &(x):(y))
#define mp make_pair
#define MT make_tuple
#define all(x) (x).begin(),(x).end()
#define debug(x) cout<<#x<<": "<<(x)<<endl
#define smax(x,y) (x)=max((x),(y))
#define smin(x,y) (x)=min((x),(y))
#define MEM(x,y) memset((x),(y),sizeof (x))
#define sz(x) (int)(x).size()
#define RT return
#define vv(a,b,c,d) vector<vector<a> >(b,vector<a>(c,d))
#define vvv(a,b,c,d,e) vector<vector<vector<a> > >(b,vv(a,c,d,e))
using ll = long long;
using pii = pair<int, int>;
using vi = vector<int>;
using vll = vector<ll>;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << fixed << setprecision(20);

    int N;
    while (cin >> N) {
        vector<string> S(N);
        rep(a, N)cin >> S[a];
        int re = 0;
        rep(a, N) {
            bool ok = [&] {
                rep(x, N)rep(y, N)
                    if (S[(x + a) % N][y] != S[(y + a) % N][x])RT false;
                RT true;
            }();
            if (ok)re += N;
        }
        cout << re << endl;
    }
}

Measured memory_bytes: 384
<?php

class UnionFind
{
    private $parents = [];

    public function __construct($n)
    {
        $this->parents = array_fill(0, $n, -1);
    }

    public function root($A)
    {
        if ($this->parents[$A] < 0) {
            return $A;
        }
        $this->parents[$A] = $this->root($this->parents[$A]);
        return $this->parents[$A];
    }

    public function size($A)
    {
        return -1 * $this->parents[$this->root($A)];
    }

    public function connect($A, $B)
    {
        $ra = $this->root($A);
        $rb = $this->root($B);

        if ($ra === $rb) {
            return false;
        }

        if ($this->size($ra) > $this->size($rb)) {
            $this->parents[$ra] += $this->parents[$rb];
            $this->parents[$rb] = $ra;
        } else {
            $this->parents[$rb] += $this->parents[$ra];
            $this->parents[$ra] = $rb;
        }
        return true;
    }

    public function isConnect($A, $B)
    {
        return $this->root($A) === $this->root($B);
    }
}

fscanf(STDIN, "%d %d", $n, $q);
$P = [];
$X = [];
$Y = [];
for ($i = 0; $i < $q; ++$i) {
    fscanf(STDIN, "%d %d %d", $p, $x, $y);
    $P[] = $p;
    $X[] = $x;
    $Y[] = $y;
}

$uni = new UnionFind($n);

for ($i = 0; $i < $q; ++$i) {
    if ($P[$i] == 0) {
        $uni->connect($X[$i], $Y[$i]);
    } else {
        echo $uni->isConnect($X[$i], $Y[$i]) ? 1 : 0, PHP_EOL;
    }
}



Measured memory_bytes: 53952
#include <stdio.h>
  int main(){
int n;
scanf("%d",&n);
while(n--){
     double x1,x2,x3,x4,y1,y2,y3,y4;
     scanf("%lf%lf%lf%lf%lf%lf%lf%lf",&x1,&y1,&x2,&y2,&x3,&y3,&x4,&y4);
	 if((x1-x2)==0 && (x3-x4)==0){
printf("YES\n");
continue;
}
if((x1-x2)==0){
printf("NO\n");
continue;
}
if((x3-x4)==0){
printf("NO\n");
continue;
}
double ab=(y1-y2)/(x1-x2);
double cd=(y3-y4)/(x3-x4);
if(ab==cd){
printf("YES\n");
}else{
printf("NO\n");
}
continue;
}
return 0;
}

Measured memory_bytes: 620
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>
#include <queue>
#include <algorithm>
#include<iostream>
#include<vector>
#include<map>
#include<string>
#include <iomanip>
#include<deque>
#include<stack>
#include<set>
#include <numeric>
#include<bitset>

using namespace std;
typedef unsigned int uint;
typedef long long ll;
//typedef pair<int, int> P;
const int INF = 1e9 + 1;
const ll LLINF = 1e17 + 1;
const double EPS = 0.000000000001;
const int DX[9] = { 0,0,1,-1, 1, 1, -1, -1, 0 }; // 4;４近傍
const int DY[9] = { 1,-1,0,0, 1, -1, 1, -1, 0 }; // 8:８近傍 9:(0,0)を含む
const int MOD = 1e9 + 7; //10^9 + 7
const double PI = 3.14159265358979323846264338327950288;

int N;
vector<int> X(N), Y(N), H(N);

int high(int Cx,int Cy, int idx) {
	return max(H[idx] - abs(X[idx] - Cx) - abs(Y[idx] - Cy), 0);
}

int main() {

	//==================================
	cin.tie(nullptr);
	ios_base::sync_with_stdio(false);
	cout << fixed << setprecision(15);
	//==================================
	   

	ll N;
	cin >> N;
	vector<ll> A(N);
	for (ll i = 0; i < N; i++) {
		cin >> A[i];
	}

	sort(A.begin(), A.end(), greater<ll>());

	ll first= 0, second=0;
	for (ll i = 0; i < N-1; i++) {
		if (A[i] == A[i + 1]) {
			if (!first) {
				first = A[i];
				i++;
			}
			else {
				second = A[i];
				break;
			}
		}

	}

	cout << first * second;



}



Measured memory_bytes: 1024
import java.util.Scanner;

public class Main {
    static Scanner sc = new Scanner(System.in);
    public static void main(String[] args) {
        int N = sc.nextInt();
        int M = sc.nextInt();
        int[] t = new int[M];
        for (int i = 0; i < N; i++) {
            int K = sc.nextInt();
            for (int j = 0; j < K; j++) {
                t[sc.nextInt()-1]++;
            }
        }
        int ans = 0;
        for (int i = 0; i < M; i++) {
            if (t[i] == N) {
                ans++;
            }
        }
        System.out.println(ans);
    }
}


Measured memory_bytes: 22356
#include<bits/stdc++.h>
using namespace std;
int main() {
	int n;
	cin>>n;
	int k=n;
	int ans=0;
	while(n) {
		ans+=n%10;
		n/=10;
	}
	if(k%ans==0) cout<<"Yes\n";
	else cout<<"No\n";

}

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



int main(){
    Int A;
    string B;
    cin >> A >> B;

    int x,y,z;
    x = B[0] - '0';
    y = B[2] - '0';
    z = B[3] - '0';


    int B100 = x * 100 + y * 10 + z;

    Int ans = A * B100;

    ans /= 100;

    cout << ans << endl;

} 

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

using namespace std;

#define int long long
#define FOR(i, j, k) for(int i = j; i < k; ++i)
#define rep(i, j) FOR(i, 0, j)
#define INF (1 << 30)
#define fi first
#define se second

typedef unsigned long long ull;
typedef pair<int, int> P;
typedef pair<P, int> Pi;
typedef pair<P, P> PP;

const int MOD = 1e9 + 7;
const int dy[]={0, 0, 1, -1};
const int dx[]={1, -1, 0, 0};

template <class T> void chmin(T& a, const T& b) { a = min(a, b); }
template <class T> void chmax(T& a, const T& b) { a = max(a, b); }

string s;
int x, y;
int xcnt[4000], ycnt[4000];
int dp[4000][16001];
int xc = 0, yc = 0;

void xsolve(int cnt, int now) {
    if(dp[cnt][8000 + now]) return;
    if(cnt < xc) {
        xsolve(cnt + 1, now + xcnt[cnt]);
        xsolve(cnt + 1, now - xcnt[cnt]);
    }
    dp[cnt][8000 + now] = 1;
}

void ysolve(int cnt, int now) {
    if(dp[cnt][8000 + now]) return;
    if(cnt < yc) {
        ysolve(cnt + 1, now + ycnt[cnt]);
        ysolve(cnt + 1, now - ycnt[cnt]);
    }
    dp[cnt][8000 + now] = 1;
}

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

    cin >> s >> x >> y;
    bool xflag = true;
    rep(i, s.size()) {
        if(s[i] == 'F') {
            if(xflag) ++xcnt[xc];
            else ++ycnt[yc];
        }
        else {
            if(xflag) {
                xflag = false;
                ++xc;
            }
            else {
                xflag = true;
                ++yc;
            }
        }
    }
    if(s[s.size() - 1] == 'F') ((xflag) ? ++xc : ++yc);
    xsolve(1, xcnt[0]);
    bool xf = (dp[xc][8000 + x] == 1) ? true : false;
    memset(dp, 0, sizeof(dp));
    ysolve(0, 0);
    bool yf = (dp[yc][8000 + y] == 1) ? true : false;
    cout << ((xf && yf) ? "Yes" : "No") << endl;
    return 0;
}

Measured memory_bytes: 500480
#include <bits/stdc++.h>
#define rep(i,n) for (ll i = 0; i < n; ++i)
#define ALL(c) (c).begin(), (c).end()
#define SUM(x) std::accumulate(ALL(x), 0LL)
#define MIN(v) *std::min_element(v.begin(), v.end())
#define MAX(v) *std::max_element(v.begin(), v.end())
#define EXIST(v, x) (std::find(v.begin(), v.end(), x) != v.end())
#define FORV(i, v) for (auto i = v.begin(); i != v.end(); i++)
using namespace std;

typedef long long ll;

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline void dump(vector<T> v) { for (auto& x : v) cerr << x << " "; cerr << endl; }
template<class T> inline void dump(vector<pair<T, T>> v) { for (auto& p : v) cerr << p.first << " " << p.second << endl; }
template<class T> inline void dump(vector<vector<T>> vv) { for (auto& v : vv) {for (auto& x : v) cerr << x << " "; cerr << endl;} }

const ll INF = 1e9;
const long long INFL = 1LL<<60;

int main() {
  int h, w;
  cin >> h >> w;

  vector<string> a(h);
  rep(i, h) cin >> a[i];

  int cnt = 0;
  rep(i, h) rep(j, w) if (a[i][j] == '#') cnt++;

  if (cnt != h + w - 1) {
    puts("Impossible");
  } else {
    puts("Possible");
  }

  return 0;
}

Measured memory_bytes: 3644
#include        <map>
#include      <cmath>
#include      <queue>
#include     <string>
#include     <cstdio>
#include     <vector>
#include    <cstring>
#include   <iostream>
#include  <algorithm>
using namespace std;
#define ll long long
const ll inf = 0x3f3f3f3f3f3f3f3f;
const int maxn = 500+5;
const ll mod = 1e9+7;


int main(){
    int a, b;
    scanf("%d%d",&a,&b);
    printf("%d\n",max(a+b,max(a-b,a*b)));
    return 0;
}


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

using namespace std;
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
typedef long long ll;
typedef long int li;

int main()
{
    IOS;
    //freopen("fr.txt","r",stdin);
    int a[5];
    for(int i=0;i<5;i++){
        cin>>a[i];
        if(a[i]==0)
            cout<<i+1<<endl;
    }

    return 0;
}


Measured memory_bytes: 3664
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <deque>
#include <fstream>
#include <iomanip>
#include <iostream>
#include <limits>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <sstream>
#include <stack>
#include <unordered_map>
#include <unordered_set>
#include <vector>

#define len(X) ((int)(X).size())

#ifdef __LOCAL
#define DBG(X) cout << #X << "=" << (X) << '\n';
#define SAY(X) cout << (X) << '\n';
#else
#define DBG(X)
#define SAY(X)
#endif

using namespace std;

using ll = long long int;
using ull = unsigned long long int;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;

const int INT_INF = (int)(2e9);
const ll  LL_INF = (ll)(2e18);

const int NIL = -1;
static mt19937 _g(time(nullptr));

std::string pad(int num)
{
    char buffer[4];
    std::snprintf(buffer, sizeof(buffer), "%03d", num);
    return buffer;
}

inline ll randint(ll a, ll b) { ll w = (_g() << 31LL) ^ _g(); return a + w % (b - a + 1); }
inline void fast_io() { ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); };
template<typename T> inline T sign(T x) { return T(x > 0) - T(x < 0); }
template<typename T, typename S> inline ostream& operator<<(ostream& os, const pair<T, S> p) { cout << "[" << p.first << ";" << p.second << "]"; return os; }
template<typename T> inline ostream& operator<<(ostream& os, const vector<T>& v) { for (auto el : v) cout << el << " "; return os; }
template<typename T> inline T fetch() { T ret; cin >> ret; return ret; }
template<typename T> inline vector<T> fetch_vec(int sz) { vector<T> ret(sz); for (auto& elem : ret) cin >> elem; return ret; }

#ifdef _MSC_VER
#  include <intrin.h>
#  define __builtin_popcount __popcnt
#endif

bool solve()
{
    string str;

    std::cin >> str;

    for (int i = 0; i < str.length(); i += 2) {

        if (str[i] != 'h')
            return false;

        if (i + 1 >= str.length())
            return false;

        if (str[i+1] != 'i')
            return false;
    }

    return true;
}

int main()
{
//    std::cout << solve() << std::endl;
    if (solve())
        cout << "Yes" << endl;
    else
        cout << "No" << endl;

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>

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

#define mem(dp,a)           memset(dp,a,sizeof dp)
#define rep(i,a,b)          for(ll i=a;i<b;i++)
#define pb(x)               push_back(x)
#define mp(x,y)             make_pair(x,y)
#define fastio              ios_base::sync_with_stdio(false);cin.tie(NULL)
#define F                   first
#define S                   second
#define all(v)              (v).begin(),(v).end()
#define pi					3.14159265359
ll INF=1e18+10;
ll MOD=1000000007;

const int N=60;
vector<int> adj[N];

int main()
{
    //freopen("in.txt","r",stdin);
    //freopen("out.txt","w",stdout);
    fastio;
    ll n;cin>>n;
    ll ans=n*n*n;
    cout<<ans<<endl;
}


Measured memory_bytes: 256
package main

import (
  "fmt"
)

func main() {
  var k, a, b int
  var yen int = 0
  var biscuit uint64 = 1
  fmt.Scan(&k)
  fmt.Scan(&a)
  fmt.Scan(&b)
  if (b - a <= 2) {
    fmt.Println(k + 1)
    return
  }
  for i := 0; i < k; i++ {
    if yen > 0 {
      yen -= 1
      biscuit += uint64(b)
    } else if biscuit >= uint64(a) && i < k - 1 {
      biscuit -= uint64(a)
      yen += 1
    } else {
      biscuit++
    }
  }
  fmt.Println(biscuit)
}


Measured memory_bytes: 512
// g++ macro.cpp -std=c++14
#include <bits/stdc++.h>
typedef long long ll;
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;
using namespace std;

#define dump(x)  cout << #x << " = " << (x) << endl;
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl

#define SANKOU(n,a,b) cout << ((n) ? (#a) : (#b) ) << endl

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) for(int i=0;i<(n);++i)
#define REPR(i,n) for(int i=n;i>=0;i--)

#define FOREACH(x,a) for(auto& (x) : (a) )

#define WFA(d,v) REP(k,v)REP(i,v)REP(j,v)d[i][j]=min(d[i][j],d[i][k]+d[k][j])

#define SCOUT(x) cout<<(x)<<" "
#define ENDL cout<<endl

#define VECCIN(x) for(auto&youso_: (x) )cin>>youso_
#define VECIN2(x,y) REP(i,x.size())cin>>x[i]>>y[i]
#define VECCOUT(x) for(auto&youso_: (x) )cout<<youso_<<" ";cout<<endl

#define ALL(obj) (obj).begin(),(obj).end()

#define EXIST(n,x) (find(ALL(n),x)!=n.end())
#define UNIQUE(obj) sort(ALL( obj )); obj.erase(unique(ALL(obj)),obj.end())
#define COUT(x) cout<<(x)<<endl
void CINT(){}
template <class Head,class... Tail>
void CINT(Head&& head,Tail&&... tail){
    cin>>head;
    CINT(move(tail)...);
}
#define CIN(...) int __VA_ARGS__;CINT(__VA_ARGS__)
#define SCIN(...) string __VA_ARGS__;CINT(__VA_ARGS__)

// #include <boost/multiprecision/cpp_int.hpp>
// using namespace boost::multiprecision; // cpp_int

#define P pair<int,int>
#define V vector<int>
#define M map<int,int>
#define S set<int>
#define L list<int>

#define pb(a) push_back(a)
#define mp make_pair
class UnionFind{
public:
    V par,rank;// parent,rank
    UnionFind(int n);
    int Find(int x);
    void Unite(int x,int y);
    bool Same(int x,int y);
};
UnionFind::UnionFind(int n){
    par.resize(n);rank.resize(n);
    REP(i,n){par[i]=i;rank[i]=0;}
}
int UnionFind::Find(int x){
    
    return (par[x]==x?x:Find(par[x]));
}
void UnionFind::Unite(int x,int y){
    x=Find(x);y=Find(y);//parent
    
    if(x==y)return;//end
    if(rank[x]<rank[y])par[x]=y;
    else{
        par[y]=x;
        if(rank[x]==rank[y])rank[x]++;
    }
}
bool UnionFind::Same(int x,int y){
    return (Find(x)==Find(y));
}


int main(){

  CIN(n,k,l);V p(k);V q(k);V r(l);V s(l);VECIN2(p,q);VECIN2(r,s);
  REP(i,k){q[i]--;p[i]--;}
  REP(i,l){r[i]--;s[i]--;}
  UnionFind road(n);UnionFind train(n);

  REP(i,k)road.Unite(p[i],q[i]);
  REP(i,l)train.Unite(r[i],s[i]);
  map<P,S> map_;
  REP(i,n)map_[mp(road.Find(i),train.Find(i))].insert(i);
  
  vector<int> ans(n,0);
  FOREACH(x,map_){
    FOREACH(xx,x.second){
      ans[xx] = x.second.size();
    }
  }

  REP(i,n-1)SCOUT(ans[i]);COUT(ans.back());


  return 0;
}


Measured memory_bytes: 32128
import java.io.*;
  
public class Main {
  
    public static void main(String[] args){
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        try{
        
        double r = Double.parseDouble(br.readLine());
  
        double pi = Math.PI;
        double x = r * r * pi;
        double y = 2 * r * pi;
        System.out.printf("%.6f %.6f", x, y);
                
    }catch(IOException e){}
    }
}

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

int main(void){
    int n;
    cin >> n;
    if(n == 1){
        cout << "Hello World" << endl;
    }else{
        int a,b;
        cin >> a >> b;
        cout << a+b << endl;
    }
    return 0;
}

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

int n,m;
int a[100002];
int b,c;
priority_queue<pair<int,int> >pq;

int main(){
	cin>>n>>m;
	for(int i=0;i<n;i++)cin>>a[i];
	sort(a,a+n);
	for(int i=0;i<m;i++){
		cin>>b>>c;
		pq.push(make_pair(c,b));
	}

	int cnt=0;
	while(!pq.empty()){
		pair<int,int>f=pq.top();pq.pop();
		int val=f.first,lim=f.second;
		while(0<lim && a[cnt]<val && cnt<n){
			a[cnt]=val;cnt++;lim--;
		}
	}

	long long ans=0;
	for(int i=0;i<n;i++){
		ans += a[i];
	}

	cout<<ans<<endl;
	return(0);
}


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

#define int long long

const int M = 1e9+7ll;

int n,m,a[105];
int f[105][100005],s[100005];

signed main()
{
	cin>>n>>m;
	for(int i=1;i<=n;cin>>a[i++]);
	f[0][0] = 1;
	for(int i=1;i<=n;i++)
	{
		memset(s,0,sizeof(s));
		s[0] = 1;
		for(int j=1;j<=m;j++)
			s[j] = s[j-1]+f[i-1][j];
		for(int j=0;j<=m;j++)
			if(j>a[i])
				f[i][j] = (s[j]-s[j-a[i]-1])%M;
			else
				f[i][j] = s[j]%M;
	}
	cout<<f[n][m]<<endl;
	
	return 0;
}

Measured memory_bytes: 79360
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <string>
#include <iomanip>
#include <map>
#include <set>
#include <cmath>
#include <cstdio>
using namespace std;
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define FOR(i,m,n) for(int (i)=(m);(i)<(n);(i)++)
#define All(v) (v).begin(),(v).end()
typedef long long ll;

int main(){
    int N,K;cin >> N >> K;
    string S;
    cin >> S;
    if(S[K-1]=='A')S[K-1]='a';
    if(S[K-1]=='B')S[K-1]='b';
    if(S[K-1]=='C')S[K-1]='c';
    cout << S << endl;
    return 0;
}

Measured memory_bytes: 256
import sys

sys.setrecursionlimit(10**7)
def I(): return int(sys.stdin.readline().rstrip())
def MI(): return map(int,sys.stdin.readline().rstrip().split())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))  #空白あり
def LI2(): return list(map(int,sys.stdin.readline().rstrip()))  #空白なし
def S(): return sys.stdin.readline().rstrip()
def LS(): return list(sys.stdin.readline().rstrip().split())  #空白あり
def LS2(): return list(sys.stdin.readline().rstrip())  #空白なし


A = [LI() for _ in range(3)]
N = I()
flag = [[0]*3 for _ in range(3)]

for i in range(N):
    b = I()
    for j in range(3):
        for k in range(3):
            if A[j][k] == b:
                flag[j][k] = 1

for i in range(3):
    if flag[i][0] == flag[i][1] == flag[i][2] == 1 or flag[0][i] == flag[1][i] == flag[2][i] == 1:
        print('Yes')
        exit()

if flag[0][0] == flag[1][1] == flag[2][2] == 1 or flag[0][2] == flag[1][1] == flag[2][0] == 1:
    print('Yes')
    exit()

print('No')


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

typedef long long ll;

int main() {
    int N;
    cin >> N;
    vector<ll> A(N + 1), maxn(N + 2, 0), node(N + 1, 1);
    rep(i, N + 1) cin >> A[i];
    for (int i = N; i >= 0; i--) {
        maxn[i] = maxn[i + 1] + A[i];
    }
    ll ans = 1;
    //rep(i, N + 2) cout << maxn[i] << " "; cout << "\n";
    rep(i, N) {
        if (node[i] < A[i]) {
            cout << "-1\n";
            return 0;
        }
        node[i + 1] = min(maxn[i + 1], (node[i] - A[i]) * 2);
        ans += node[i + 1];
    }
    if (node[N] < A[N]) {
        cout << "-1\n";
        return 0;
    }
    cout << ans << "\n";
    //rep(i, N + 1) cout << "node[" << i << "]=" << node[i] << "\n";
}

Measured memory_bytes: 5544
#include<stdio.h>

int main(void){
    int a = 0, b = 0;

    int i, j;
    for(i = 1; i < 10; i++){
      for(j = 1; j < 10; j++){
        printf("%dx%d=%d\n", i, j, i*j);
      }
    }
  return 0;
}

Measured memory_bytes: 2556
n = input()
a = len(n)  # 桁数
if a % 2 == 0:  # 桁数が偶数
  ans = "90" * (a // 2)
  ans = int(ans[:-1])
else:
  if a == 1:
    ans = int(n)
  else:
    ans = "90" * ((a - 1) // 2)
    ans = int(ans[:-1])
    ans += int(n) - 10 ** (a - 1) + 1
print(ans)

Measured memory_bytes: 3060
import sys
input = sys.stdin.readline

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

leaf = sum(A)
ans = 0
node = 1
for i in range(N+1):
    if A[i] > node or leaf == 0:
        ans = -1
        break
    ans += node
    leaf -= A[i]
    node = min(2*(node-A[i]), leaf)
print(ans)


Measured memory_bytes: 82744
//g++ -std=gnu++14 a.cpp
//#include <bits/stdc++.h>

#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <iostream>
#include <istream>
#include <iterator>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
#include <tuple>
#include <iomanip>
#include <random>
#include <math.h>

using namespace std;

#define ll long long
#define rep(i, n) for(ll i = 0; i < (n); i++)
ll MOD = 1e9 + 7;
int INF = 1 << 30;
ll INFL = 1LL << 60;

int main(){
   ll H,N;
   cin >> H >> N;
   vector<ll> A(N);
   rep(i,N)cin >> A[i];
   ll sum = 0;
   for(ll x : A) sum += x;
   if(H <= sum) cout << "Yes" << endl;
   else cout << "No" << endl;
}


Measured memory_bytes: 4040
#include <bits/stdc++.h>
using namespace std;
 
int main() {

string s,t="";

cin >> s;

for(int i=0;i<s.size();i++){
  if(s.at(i)=='0') t.push_back('0');

  else if(s.at(i)=='1') t.push_back('1');

  else{
    if(t=="") continue;
    else t.pop_back();
  }

}

cout << t << endl;
    
return 0;
}

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

int N, height[100005];
int dp[100005];

int diff(int x, int y) {
	if (x>y) {
		return x-y;
	}
	return y-x;
}

int solve(int i) {
	if (i >= N) {
		return -1;
	}
	
	if (dp[i] != -1) {
		return dp[i];
	}
	
	int X = solve(i+2);
	if (X != -1) {
		X += diff(height[i], height[i+2]);
	} else {
		X = INT_MAX;
	}
	
	int Y = diff(height[i], height[i+1]) + solve(i+1);
	
	return dp[i] = min(X, Y);
}


int main() {
	for(int i=0;i<100005;i++) {
		dp[i] = -1;
	}
	cin>>N;
	for(int i=0;i<N;i++) {
		cin>>height[i];
	}
	
	dp[N-1] = 0;
	if (N>2) {
		dp[N-2] = diff(height[N-1], height[N-2]);
	}
	
	cout<<solve(0);
}

Measured memory_bytes: 2560
import math
N,K= list(map(int,input().split()))
a = int(N/K)
a1 = a*K
a2 = (a+1)*K
if N % K ==0:
    Num = 0
else:
    if abs(N%K) < abs((N%K)-K) :
        Num = abs(N%K)
    else:
        Num =  abs((N%K)-K)
    
print(Num)

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

#define fst(t) std::get<0>(t)
#define snd(t) std::get<1>(t)
#define thd(t) std::get<2>(t)
#define unless(p) if(!(p))
#define until(p) while(!(p))

using ll = std::int64_t;
using P = std::tuple<int,int>;

constexpr ll INF = 1001001001001001001;
int N;
int gA, sA, bA;
int gB, sB, bB;
ll dp[3][5010*5010];

ll solve(int n){
    dp[0][0] = 0;
    dp[1][0] = 0;
    dp[2][0] = 0;

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

        if(gA <= i){
            dp[0][i] = std::max(dp[0][i], dp[0][i-gA] + gB);
        }
    }

    for(int i=1;i<=n;++i){
        dp[1][i] = std::max(dp[1][i-1], dp[0][i]);

        if(sA <= i){
            dp[1][i] = std::max(dp[1][i], dp[1][i-sA] + sB);
        }
    }

    for(int i=1;i<=n;++i){
        dp[2][i] = std::max(dp[2][i-1], dp[1][i]);

        if(bA <= i){
            dp[2][i] = std::max(dp[2][i], dp[2][i-bA] + bB);
        }
    }

    ll mx = 0;

    for(int i=0;i<=n;++i){
        mx = std::max(mx, dp[2][i] + (n - i));
    }

    return mx;
}

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

    std::cin >> N >> gA >> sA >> bA >> gB >> sB >> bB;

    ll x = solve(N);

    std::swap(gA, gB);
    std::swap(sA, sB);
    std::swap(bA, bB);

    x = solve(x);

    std::cout << x << std::endl;
}


Measured memory_bytes: 588032
#include <cstdio>
#include <vector>
#include <set>
using namespace std;

const int MAXN = 100005;
const int LOG = 17;

int N, K;
int a[MAXN][LOG];
int depth[MAXN];
vector <int> ch[MAXN];

struct cmp {
    bool operator()(const int &lhs, const int &rhs) const {
        if (depth[lhs] != depth[rhs])
            return depth[lhs] > depth[rhs];
        return lhs < rhs;
    }
};

set <int, cmp> S;

void load() {
    scanf("%d%d", &N, &K);
    for (int i = 1; i <= N; i++)
        scanf("%d", a[i]);
}

void dfs(int x, int d) {
    depth[x] = d;
    for (int i = 0; i < ch[x].size(); i++)
        dfs(ch[x][i], d + 1);
}

int jmp(int x, int k) {
    for (int i = 0; i < LOG; i++)
        if (k >> i & 1) x = a[x][i];
    return x;
}

void go(int x) {
    if (!S.count(x)) return;
    S.erase(x);
    for (int i = 0; i < ch[x].size(); i++)
        go(ch[x][i]);
}

int solve() {
    int sol = a[1][0] > 1;
    a[1][0] = 0;
    for (int j = 1; j < LOG; j++)
        for (int i = 1; i <= N; i++)
            a[i][j] = a[a[i][j - 1]][j - 1];
    
    for (int i = 1; i <= N; i++)
        ch[a[i][0]].push_back(i);
    
    dfs(1, 0);
    
    for (int i = 1; i <= N; i++)
        S.insert(i);
    
    for (; !S.empty(); sol++) {
        int x = *S.begin();
        if (depth[x] <= K) break;
        go(jmp(x, K - 1));
    }
    
    return sol;
}

int main() {
    load();
    printf("%d\n", solve());
    return 0;
}



Measured memory_bytes: 22144
var input = require('fs').readFileSync('/dev/stdin', 'utf8');
var arr=input.trim().split("\n");
var nq=arr[0].split(" ").map(Number);
var s = arr[1];
var a=[0,0];
var cnt=0;
for(var i=1;i<s.length;i++){
   if(s[i]=="C" && s[i-1]=="A")cnt++;
   a.push(cnt);
}
var ans=["",""];
var len = nq[1]+2;
while(ans.length < len) {
   var lr=arr[ans.length].split(" ");
   ans.push(a[lr[1]-0]-a[lr[0]-0]);
}
console.log(ans.join("\n").trim());

Measured memory_bytes: 34640
import java.io.*;
import java.util.*;
import java.math.*;
     
public class Main{
	public static void main(String[] args) throws Exception {
	IO io = new IO();
	PrintWriter out = new PrintWriter(System.out);
	Solver sr = new Solver();
	sr.solve(io,out);
	out.flush();
	out.close();
    	}

	static class Solver
	{
	    void solve(IO io, PrintWriter out)
	    {
           	int n = io.nextInt();
          	int m = io.nextInt();
          	int sum=0;
          	for(int i=0 ; i<m ; i++)
              	sum+=io.nextInt();
            out.println( sum>n ? "-1" : (n-sum));
	    }
    	
	}
	//Special thanks to Petr (on codeforces) who inspired me to implement IO class!
	static class IO
	{
    	BufferedReader reader;
        StringTokenizer tokenizer;
    	public IO() {
                reader = new BufferedReader(new InputStreamReader(System.in));
                tokenizer = null;
            }
     
        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }
        public String nextLine() {
            String s="";
            try {
                    s=reader.readLine();
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            return s;
        }
        public int nextInt() {
            return Integer.parseInt(next());
        }
    
        public long nextLong() {
            return Long.parseLong(next());
        }
    	double nextDouble()
    	{
    		return Double.parseDouble(next());
    	}
	}
}

Measured memory_bytes: 34200
#include<iostream>
main(){
int a,b,c,k,x[1000][4],p[500];
while(true){
for(int i=0;i<500;i++){p[i]=2;}
std::cin>>a>>b>>c;
if(a==0){break;}
std::cin>>k;
for(int i=0;i<k;i++){std::cin>>x[i][0]>>x[i][1]>>x[i][2]>>x[i][3];
if(x[i][3]==1){p[x[i][0]]=1;p[x[i][1]]=1;p[x[i][2]]=1;}
}
for(int i=0;i<k;i++){
if(p[x[i][0]]==1&&p[x[i][1]]==1&&x[i][3]==0)
p[x[i][2]]=0;
if(p[x[i][0]]==1&&p[x[i][2]]==1&&x[i][3]==0)
p[x[i][1]]=0;
if(p[x[i][1]]==1&&p[x[i][2]]==1&&x[i][3]==0)
p[x[i][0]]=0;
}
for(int i=1;i<=a+b+c;i++){printf("%d\n",p[i]);}
}
}

Measured memory_bytes: 3036
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApp4
{
    class Program
    {
        static void Main(string[] args)
        {
            var s = Console.ReadLine().Split(' ');

            if (int.Parse(s[0]) > 8 || int.Parse(s[1]) > 8)
            {
                Console.WriteLine(":(");
            }
            else
            {
                Console.WriteLine("Yay!");
            }
        }
    }
}

Measured memory_bytes: 13140
#include <bits/stdc++.h>
using namespace std;
int main()
{
	int n, c, k;
	cin >> n >> c >> k;
	long t[n];
	for (int i = 0; i < n; i++)
	{
		cin >> t[i];
	}
	sort(t, t + n);

	long now;
	int i = 0;
	int res = 0;
	while (i < n)
	{
		int j = min(i + c, n);
		while (t[j - 1] - t[i] > k)
		{
			j--;
		}
		res++;
		i = j;
	}

	cout << res << endl;
	return 0;
}


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

#define int long long
const long long MOD=1e9+7;
void f(int &a){
  a%=MOD;if(a<0)a+=MOD;
}
void kakeru(int &a,int b){
  f(a);f(b);a*=b;f(a);
}

signed main(){
  int n,k,ans=1;cin>>n>>k;
  vector<int> pl,mi;
  for(int i=0;i<n;i++){
    int a;cin>>a;
    (a>=0?pl:mi).push_back(a);
  }
  sort(pl.begin(),pl.end());
  sort(mi.begin(),mi.end());
  if(n==k){
    for(int p:pl)kakeru(ans,p);
    for(int p:mi)kakeru(ans,p);
    cout<<ans<<endl;return 0;
  }
  if(k&1)
    if(pl.size()){
      kakeru(ans,pl.back());
      pl.erase(pl.end()-1);
    }
    else{
      for(int i=0;i<k;i++)kakeru(ans,mi[n-1-i]);
      cout<<ans<<endl;return 0;
    }
  k>>=1;
  priority_queue<int> pque;
  for(int i=(int)pl.size()-1;i>0;i-=2)pque.push(pl[i]*pl[i-1]);
  for(int i=0;i<(int)mi.size()-1;i+=2)pque.push(mi[i]*mi[i+1]);
  while(k--){
    kakeru(ans,pque.top());pque.pop();
  }
  cout<<ans<<endl;
}


Measured memory_bytes: 6676
#include <bits/stdc++.h>
using namespace std;
#define repl(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define rep(i,n) repl(i,0,n)
#define mp(a,b) make_pair((a),(b))
#define pb(a) push_back((a))
#define all(x) (x).begin(),(x).end()
#define uniq(x) sort(all(x)),(x).erase(unique(all(x)),end(x))
#define fi first
#define se second
#define dbg(x) cout<<#x" = "<<((x))<<endl
template<class T,class U> ostream& operator<<(ostream& o, const pair<T,U> &p){o<<"("<<p.fi<<","<<p.se<<")";return o;}
template<class T> ostream& operator<<(ostream& o, const vector<T> &v){o<<"[";for(T t:v){o<<t<<",";}o<<"]";return o;}

#define INF 2147483600

long solve(vector<long> &vec, long init){
  int n =vec.size();
  long acc = vec[0];
  long ret = 0;
  if(vec[0] *init <=0){
    ret += abs(init - vec[0]);
    acc = init;
  }
  repl(i,1,n){
    if(acc<0){
      if(acc + vec[i] > 0){
        acc = acc + vec[i];
      } else {
        ret += abs(1 - (acc + vec[i]));
        acc = 1;
      }
    } else {
      if(acc + vec[i] < 0){
        acc = acc + vec[i];
      } else {
        ret += abs(-1 - (acc + vec[i]));
        acc = -1;
      }
    }
  }//dbg(ret);
  return ret;
}

int main(){
  int n;
  cin>>n;
  vector<long> vec(n);
  rep(i,n) cin>>vec[i];

  cout << min(solve(vec,1), solve(vec,-1)) << endl;

  return 0;
}


Measured memory_bytes: 1024
using System;

public class Problem_C
{
  static readonly int[] di = { 1, -1, 0, 0 };
  static readonly int[] dj = { 0, 0, 1, -1 };

  public static void Main()
  {
    var inputs = Array.ConvertAll(Console.ReadLine().Split(), int.Parse);
    int H = inputs[0], W = inputs[1];
    var grid = new char[H, W];
    for (var i = 0; i < H; i++)
    {
      var line = Console.ReadLine();
      for (var j = 0; j < W; j++) grid[i, j] = line[j];
    }

    for (var i = 0; i < H; i++)
    {
      for (var j = 0; j < W; j++)
      {
        if (grid[i, j] == '.') continue;
        var isDrawable = false;
        for (var k = 0; k < 4; k++)
        {
          var i2 = i + di[k];
          var j2 = j + dj[k];
          if (i2 >= 0 && i2 < H
              && j2 >= 0 && j2 < W
              && grid[i2, j2] == '#')
          {
            isDrawable = true;
          }
        }
        if (!isDrawable)
        {
          Console.WriteLine("No");
          return;
        }
      }
    }
    Console.WriteLine("Yes");
  }
}


Measured memory_bytes: 11092
#include <bits/stdc++.h>
#define pb push_back
#define REP(i, n) for (signed long long i = 0; i < (n); i++)
#define MOD 1000000007
#define INF 98765431219876543
#define bitcnt(a) (ll) __builtin_popcount((a))
#define lb(a, b) lower_bound((a).begin(), (a).end(), (b))
#define ub(a, b) upper_bound((a).begin(), (a).end(), (b))
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
typedef pair<string, string> PS;

int main() {

  ll n, p, P;
  cin >> n >> p;
  map<ll, ll> m;
  P = p;
  for (int i = 2; i <= sqrt(P); i++) {
    while (p % i == 0) {
      m[i]++;
      p /= i;
    }
  }
  m[p]++;
  ll cnt = 1;
  for (auto &a : m) {
    cnt *= (pow(a.first, a.second / n));
  }
  cout << cnt << endl;
}

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

using namespace std;

#define int 	long long
#define endl	"\n"
#define mod		1000000007
#define IOS		ios::sync_with_stdio(0), cin.tie(0), cout.tie(0)

int32_t main(){

	IOS;
	
	int n;
	cin >> n;

	if(n % 10 == 3)
		cout << "bon\n";

	else if(n % 10 == 0 || n % 10 == 1 || n % 10 == 6 || n % 10 == 8)
		cout << "pon\n";

	else
		cout << "hon\n";

	return 0;
}

Measured memory_bytes: 3648
import java.util.Arrays;
import java.util.Scanner;

public class Main {
public static void main(String[] args) {
		
		Scanner keyboard = new Scanner(System.in); 
		
		int A = keyboard.nextInt();
		int B = keyboard.nextInt();
		
		int ans = 0;
		
		if (A >= 13) {
			ans = B;
		}else if(A >= 6) {
			ans = B / 2;
		}else {
			ans = 0;
		}
		
		System.out.print(ans);
		keyboard.close();	
	}
}


Measured memory_bytes: 21716
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <algorithm>
#include <map>
#include <cmath>
#include <queue>
#include <set>
#include <cassert>

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

using namespace std;
typedef long long int ll;
const ll INF = 1000000000000000000;
const double PI = acos(-1);

int main()
{
    int n;
    cin >> n;
    set<int> s;
    rep(i, n) {
        int a;
        cin >> a;
        s.insert(a);
    }
    if (s.size() == n) {
        cout << "YES" << endl;
    }
    else {
        cout << "NO" << endl;
    }
    return 0;
}


Measured memory_bytes: 12972
PROGRAM ATCODER

implicit none
integer(16) :: n, w_max, i, j, sum_w
integer(16), allocatable :: w(:), v(:), dp(:,:)

read(*,*) n, w_max
allocate(dp(0:n,0:w_max), w(0:n), v(0:n))

dp = 0

do i = 0, n-1
	read(*,*) w(i), v(i)
end do

do i = 0, n-1
	do sum_w = 0, w_max
    	if (sum_w-w(i) >= 0) then
        	call chmax(dp(i+1,sum_w), dp(i,sum_w-w(i))+v(i))
		end if
		call chmax(dp(i+1,sum_w), dp(i,sum_w))
    end do
end do

write(*,'(i0)') maxval(dp)


contains
subroutine chmax(dp,x)
implicit none
integer(16) :: dp, x

if (dp < x) then
	dp = x
	return
end if

end subroutine

END PROGRAM ATCODER

Measured memory_bytes: 158080
Imports System.Collections.Generic
Imports System.Console

Module Program
    Dim dic As New Dictionary(Of String, Integer)

    Sub Main()
        Dim N As Integer = NextInt()
        Dim D As Integer = NextInt()
        Dim X As Integer = NextInt()

        For i As Integer = 0 To N - 1
            Dim A As Integer = NextInt()
            X += 1 + (D - 1) \ A
        Next

        WriteLine(X)
    End Sub

    Function NextInt() As Integer
        Return CInt(NextString())
    End Function

    Function NextString() As String
        Dim result As New List(Of Char)
        Do
            Dim tmp As Integer = Read()
            If tmp < 0 Then Exit Do
            Dim nextChar As Char = Chr(tmp)

            If Not Char.IsWhiteSpace(nextChar) Then
                result.Add(nextChar)
            ElseIf nextChar <> vbCr Then
                Exit Do
            End If
        Loop
        Return New String(result.ToArray())
    End Function

End Module


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

using namespace std;

int main() {
  int i, j;
  long int N; cin >> N;
  vector<long int> A(N);
  for(int i=0;i<N;i++) cin >> A[i];
  vector<long int> B(N);
  long int max_sed = 0;
  long int max = 0;
  bool maxdouble_flag = false;

  for(i=0; i<N; i++) {
    if(A[i] > max){
      max_sed = max;
      max = A[i];
    } else if(A[i] > max_sed){
      max_sed = A[i];
    }
  }

  for(i=0; i<N; i++) {
    if(A[i] == max) {
      if(A[i] == max) {
        maxdouble_flag = true;
        break;
      }
    }
  }

  for(i=0; i<N; i++) {
    if(A[i] != max){
      cout << max << endl;
    } else {
      cout << max_sed << endl;
    }
  }


//  cout << ans << endl;

  return 0;
}


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

using namespace std;

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

    int n;
    cin >> n;

    vector<tuple<string, int, int>> rs(n);
    for (int i = 0; i < n; ++i) {
        cin >> get<0>(rs[i]) >> get<1>(rs[i]);
        get<1>(rs[i]) *= -1;
        get<2>(rs[i]) = i + 1;
    }

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

    for (const auto &r : rs)
        cout << get<2>(r) << '\n';

    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define R register int
#define ll long long 
using namespace std;
const int N=200002;
const int mod=1e9+7;
int n,x,y,len,ans,tot,jic[N],inv[N],w[N],c[N],Mnq[N],Mnh[N];
struct Qs{int sz,vl;}Q[N];
int cmp(const Qs &x,const Qs &y){return x.vl<y.vl;}
vector<int>G[N];
int Qpow(R x,R y){
    R ans=1,bas=x;
    while(y){
        if(y&1)ans=1ll*ans*bas%mod;
        bas=1ll*bas*bas%mod,y>>=1;
    }return ans;
}
int gi(){
    R x=0,k=1;char c=getchar();
    while((c<'0'||c>'9')&&c!='-')c=getchar();
    if(c=='-')k=-1,c=getchar();
    while(c>='0'&&c<='9')x=(x<<3)+(x<<1)+c-'0',c=getchar();
    return x*k;
}
int main(){
    n=gi(),x=gi(),y=gi(),Mnq[0]=Mnh[n+1]=2e9;
    inv[0]=inv[1]=jic[0]=jic[1]=1;
    for(R i=2;i<=n;++i)jic[i]=1ll*i*jic[i-1]%mod;
    inv[n-1]=Qpow(jic[n-1],mod-2);
    for(R i=n-2;i>=2;--i)inv[i]=1ll*inv[i+1]*(i+1)%mod;
    for(R i=1;i<=n;++i)
        c[i]=gi(),w[i]=gi(),G[c[i]].push_back(w[i]);
    for(R i=1;i<=n;++i)sort(G[i].begin(),G[i].end());
    for(R i=1,j;i<=n;++i){
        Mnq[i]=Mnq[i-1],j=G[i].size();
        if(j)Mnq[i]=min(Mnq[i],G[i][0]);
    }
    for(R i=n,j;i>=1;--i){
        Mnh[i]=Mnh[i+1],j=G[i].size();
        if(j)Mnh[i]=min(Mnh[i],G[i][0]);
    }
    for(R i=1,lim;i<=n;++i){
        lim=G[i].size();
        if(!lim)continue;Q[++tot].vl=G[i][0],Q[tot].sz=1;
        for(R j=1;j<lim;++j)
            if(G[i][0]+G[i][j]<=x||G[i][j]+min(Mnq[i-1],Mnh[i+1])<=y)
                Q[tot].sz++;
            else break;
    }
    sort(Q+1,Q+tot+1,cmp),len=Q[1].sz,ans=inv[Q[1].sz];
    if(tot==1)return puts("1"),0;
    for(R i=2;i<=tot;++i){
        if(Q[i].vl+Q[1].vl<=y)
            len+=Q[i].sz,ans=1ll*ans*inv[Q[i].sz]%mod;
        else break;
    }
    cout<<1ll*jic[len]*ans%mod<<endl;
    return 0;
}


Measured memory_bytes: 15488
#include <iostream>
#include <fstream>
#include <vector>
#include <cstring>
#include <algorithm> // sort
#include <map>
#include <cmath>

#define REP(i, n) for (long long i = 0; i < (n); i++) 
typedef long long ll;
static const ll MOD = 1000000007;
static const ll INF = 1000000000000000000LL;
using namespace std;



int main(){
    int n;
    cin >> n;
    vector <int> r(n);
    for(int i = 0; i < n; ++i)
    {
      cin >> r.at(i);
    }
    vector <int> iMax(n);

    //iMax[n] = -1;
    iMax[n-1] = -MOD;

    //後ろから、maxを作る
    for(int i = n-2; i >= 0; --i)
    {
      iMax[i] = max(iMax[i+1], r[i+1]);
    }

    int res = -MOD;
    for(int i = 0; i < n; ++i)
    {
      //if(r.at(i) > iMax[i+1])continue;
      res = max(res, iMax[i] - r.at(i));
    }

    cout << res << endl;
    return 0;    
}



Measured memory_bytes: 4432
function main(_stdin) {
    const stdin = _stdin.split('\n');
    const [length, quantam] = stdin.shift().split(' ');
    const result = [];
    let cost = 0;

    const tasks = stdin.filter(e => e.length).map(e => e.split(' '));

    for(const task of tasks){
        const temp = Number(task[1]) - Number(quantam);
        if(temp > 0) {
            task[1] = temp;
            cost += Number(quantam);
            tasks.push(task);
        } else {
            cost += Number(task[1]);
            result.push(`${task[0]} ${cost}`);
        }
    }

    console.log(result.join('\n'));
}



main(require('fs').readFileSync('/dev/stdin', 'utf8'));



Measured memory_bytes: 49528