akhauriyash/Code-Regression huggingface dataset:
#include <string>
#include <cstring>
#include <iostream>
#include <ciso646>


bool check(const std::string &pass)
{
    if (pass.length() < 6) return false;

    bool has_digit(false), has_upper(false), has_lower(false);

    for (size_t i = 0; i < pass.length(); ++i)
    {
        char c = pass[i];

        if (std::isdigit(c)) has_digit = true;
        if (std::isupper(c)) has_upper = true;
        if (std::islower(c)) has_lower = true;

        if (has_digit and has_upper and has_lower) break;
    }

    return has_digit and has_upper and has_lower;
}


int main()
{
    std::string pass;
    std::cin >> pass;

    std::cout << (check(pass) ? "VALID" : "INVALID") << std::endl;
    
    return 0;
}

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

typedef double du ;
typedef string st ;
typedef long long ll ;
typedef long double ld ;
typedef long long int lli ;

#define vi vector <lli>
#define loop(num) for (lli i = 0 ; i < num ; i ++ )
#define loopcin(num , ar ) for (lli i = 0 ; i < num ; i ++ ) {cin >> ar [i] ;}
#define loopcout(num , ar) for (lli i = 0 ; i < num ; i ++ ) {cout << ar [i] << ' '; }

#define forr(num1 , num2) for (lli i = num1 ; i < num2 ; i ++ )
#define forrcin(num1 , num2 , ar ) for (lli i = num1 ; i < num2 ; i ++ ) {cin >> ar [i] ;}
#define forrcout(num1 , num2 , ar) for (lli i = num1 ; i < num2 ; i ++ ) {cout << ar [i] << ' '; }

#define D2forrcin(num1_1 , num1_2 , num2_1 , num2_2 , A ) for (lli i = num1_1 ; i < num1_2 ; i ++){ for (lli j = num2_1 ; j < num2_2 ; j++){cin >> A[i][j] ;}}
#define D2forrcout(num1_1 , num1_2 , num2_1 , num2_2 , A ) for (lli i = num1_1 ; i < num1_2 ; i ++){ for (lli j = num2_1 ; j < num2_2 ; j++){cout << A[i][j] << ' ' ;}cout << endl ;}

#define YES cout << "YES" << endl
#define Yes cout << "Yes" << endl
#define NO cout << "NO" << endl
#define No cout << "No" << endl

#define F first
#define S second

#define fastio ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);

int main ()
{
    fastio
    lli a[3] ;
    loopcin (3 , a) ;
    sort(a , a + 3 ) ;
    (a[0] == 5 && a[1] == 5 && a[2] == 7 ? YES : NO ) ;
    return 0 ;
}

/*___________________________________________________________________functions___________________________________________________________________________*/



Measured memory_bytes: 256
//  Mohib Manva.
#include<bits/stdc++.h>
using namespace std;
 
 
int main() {
    int t = 1;
    //  scanf("%d",&t);
    while (t--) {
        int n,k;
        scanf("%d %d",&n,&k);
        if (k==1){
            puts("0");
        } else 
        printf("%d\n", (n%k)>0);       
    }
    return 0;
}

Measured memory_bytes: 256
import scala.io.StdIn

object Main extends App {

  val n = StdIn.readLine().toInt

  val a = StdIn.readLine().split(' ').map(_.toInt)
  val buff = Array.ofDim[Int](scala.math.pow(10, 5).toInt + 2)

  val max = a.foldLeft(0L) { (acc, ai) =>
    buff(ai + 1) += 1
    buff(ai) += 1
    if (ai > 0) {
      buff(ai - 1) += 1
      scala.math.max(acc, scala.math.max(buff(ai + 1), scala.math.max(buff(ai - 1), buff(ai))))
    } else {
      scala.math.max(acc, scala.math.max(buff(ai + 1), buff(ai)))
    }
  }

  //println(buff.mkString(" "))

  println(max)

}


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

#define PI 3.14159265359
//#define scanf scanf_s

// 半径Rの面積と円周を出力
int main()
{
	double iInputR;
	scanf("%lf", &iInputR);

	printf("%lf %lf", iInputR * iInputR * PI, 2 * iInputR * PI);
	return 0;
}


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

void ex(string &x)
{
    REP(i,x.size())if(x.at(i)>='a'&&x.at(i)<='z')x.at(i)-=0x20;
}

int main()
{
    string w;
    cin>>w;
    ex(w);
    string t;
    int sum=0;
    while(cin>>t)
    {
        if(t=="END_OF_TEXT")break;
        ex(t);
        if(w==t)sum++;
    }cout<<sum<<endl;
}


Measured memory_bytes: 3140
#include<bits/stdc++.h>
#define fo(i,a,b) for((i)=(a);i<=(b);i++)
#define rfo(i,a,b) for((i)=(a);i>=(b);i--)
#define inrange(x,y,z) (((x)>=(y))&&((x)<=(z)))
#define ALL(vec) ((vec).begin(),(vec).end())
#define SOR(vec) sort(ALL(vec))
#define UNI(vec) (vec).erase(unique(ALL(vec)),(vec).end())
#define A second
#define B first
using namespace std;
int n,bal[1000100],minbal[1000100],totbal;
pair<int,int> fuck[1000100]; 
string s[1000100];
bool fun(pair<int,int> a,pair<int,int> b){
	return (min(-a.B,a.A-b.B))>(min(-b.B,b.A-a.B)); 
}
int main(){
	#ifdef FILIN
		#ifndef DavidDesktop
			freopen(FILIN,"r",stdin);
			freopen(FILOUT,"w",stdout);
		#endif
	#endif
	ios::sync_with_stdio(0);
	cin.tie(NULL);
	cout.tie(NULL);
	cin>>n;
	for(int i=1;i<=n;i++){
		cin>>s[i];
		bal[i]=0;
		minbal[i]=998244353;
		for(int j=0;j<s[i].size();j++){
			if(s[i][j]=='(') bal[i]++;
			if(s[i][j]==')') bal[i]--;
			minbal[i]=min(minbal[i],bal[i]);
		}
		totbal+=bal[i];
		minbal[i]*=-1;
		fuck[i]=make_pair(minbal[i],bal[i]);
	}
	if(totbal!=0){
		cout<<"No"<<endl;
		return 0;
	}
	sort(fuck+1,fuck+n+1,fun);
	totbal=0;
	for(int i=1;i<=n;i++){
		if(fuck[i].B>totbal){
			cout<<"No"<<endl;
			return 0;
		}
		totbal+=fuck[i].A;
	}
	cout<<"Yes"<<endl;
	return 0;
}


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

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

typedef long long ll;
const ll MOD = 1e9 + 7;

std::vector<int> getZarr(const std::string S) {
  int n = S.length();
  std::vector<int> Z(n);

  Z[0] = n;
  int p, R, K;
  p = R = 0;
  for(int i = 1; i < n; ++i) {
    if(i > R) {
      int j = 0;
      while(i + j < n and S[i + j] == S[j]) ++j;
      Z[i] = j;
    }
    else {
      K = i - p;
      if(Z[K] < R - i + 1) {
        Z[i] = Z[K];
      }
      else {
        int j = R - i + 1;
        while(i + j < n and S[i + j] == S[j]) ++j;
        Z[i] = j;
      }
    }

    if(R < i + Z[i] - 1) {
      p = i;
      R = p + Z[p] - 1;
    }
  }

  return Z;
}

int main() {
  int N;
  std::string S;
  std::cin >> N >> S;

  int len = 0;
  while(S.length() > 0) {
    std::vector<int> Z = getZarr(S);

    for(int j = 1; j < Z.size(); ++j) {
      int l = std::min(Z[j], j);
      len = std::max(len, l);
    }
    S.erase(0, 1);
  }
  std::cout << len << '\n';
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#include<cctype>
#include<utility>
#include<string>
#include<cstring>
#include<cmath>
#include <numeric>
#include<queue>
#include<climits>
#include<cstdio>


#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define llong long long
#define pb(a) push_back(a)
//#define INF ((LLONG_MAX) / (2))
using namespace std;
typedef pair<int, int> P;
typedef pair<llong, llong> LP;
typedef pair<int, P> PP;
typedef pair<llong, LP> LPP;
typedef long long int ll;
typedef pair<ll,int> LL_IP;
#define INF 1e9+7


int main(){

    int x,y;
    cin >> x >> y;
    int ans = INF;
    for(int i = 0;i < (1<< 2);i++){
        int tmp = 0;
        int tmp_x = x,tmp_y = y;
        for(int j = 0;j < 2;j++){

            if((i>>j)&1){
                if(j == 0){
                    tmp_x = -tmp_x;
                    tmp++;
                }else{
                    tmp_y = -tmp_y;
                    tmp++;
                }
            }
        }
        if(tmp_x <= tmp_y){
            tmp += abs(tmp_y-tmp_x);
            ans = min(ans,tmp);
        }
    }
    cout << ans << endl;


    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
int ans;
int n;
int i;
char newslr[6];
int dicetmp;
short dice[6];
/*
[0] Top
[1] South side
[2] East  side
[3] North side
[4] West  side
[5] Float
*/
/*
   [3]
[4][0][2]
   [1]
*/

void solve(void){ 
scanf("%s",newslr);
switch(newslr[0]){
case 'N':
dicetmp = dice[1];
dice[1] = dice[5];
dice[5] = dice[3];
dice[3] = dice[0];
dice[0] = dicetmp;
ans += dicetmp;
break;
case 'E':
dicetmp = dice[4];
dice[4] = dice[5];
dice[5] = dice[2];
dice[2] = dice[0];
dice[0] = dicetmp;
ans += dicetmp;
break;
case 'W':
dicetmp = dice[2];
dice[2] = dice[5];
dice[5] = dice[4];
dice[4] = dice[0];
dice[0] = dicetmp;
ans += dicetmp;
break;
case 'S':
dicetmp = dice[3];
dice[3] = dice[5];
dice[5] = dice[1];
dice[1] = dice[0];
dice[0] = dicetmp;
ans += dicetmp;
break;
case 'L':
ans += dice[0];
dicetmp = dice[1];
dice[1] = dice[4];
dice[4] = dice[3];
dice[3] = dice[2];
dice[2] = dicetmp;
break;
case 'R':
ans += dice[0];
dicetmp = dice[1];
dice[1] = dice[2];
dice[2] = dice[3];
dice[3] = dice[4];
dice[4] = dicetmp;
break;
}
return;
}

int main(void){
while(scanf("%d",&n),n){
ans = 1;
dice[0] = 1;
dice[1] = 2;
dice[2] = 3;
dice[3] = 5;
dice[4] = 4;
dice[5] = 6;
for(i = 0;i < n;i++)solve();
printf("%d\n",ans);
}
return 0;
}

Measured memory_bytes: 604
/*
我的心脏怦怦跳，监管者就在附近
name:
Algorithm:
writer:Lxs(cdx)
place:
nothing is impossible
*/
#pragma GCC optimize(3,"Ofast","inline")
#include<bits/stdc++.h>
#include<string>
#include<iostream>
#include<cmath>
#include<set>
#include<stack>
#include<queue>
#include<unistd.h>
#include<stdio.h>
#include<cstring>
#define random(a,b) (rand()%(b-a+1)+a)
using namespace std;
bool prime(int x){
	 int i;
	 if(x<2) return 0;
	 for(i=2;i*i<=x;i++){
		if(x%i==0){return 0;}
	 }
	 return 1;
}
int main()
{
	int a;
	cin>>a;
	cout<<a*2*3.1415926<<endl;
	return 0;
}


Measured memory_bytes: 3784
n, m = map(int, raw_input().split())
a = []
for i in range(n):
    row = map(int, raw_input().split())
    a.append(row)
op = []
for i in range(n):
    for j in range(m - 1):
        if a[i][j] % 2 == 1:
            a[i][j + 1] += 1
            op.append([i + 1, j + 1, i + 1, j + 2])
for i in range(n - 1):
    if a[i][m - 1] % 2 == 1:
        a[i + 1][m - 1] += 1
        op.append([i + 1, m, i + 2, m])
print len(op)
for tup in op:
    print " ".join(map(str, tup))

Measured memory_bytes: 28164
#include<bits/stdc++.h>
#define Vsort(a) sort(a.begin(), a.end())
#define rep(i,n) for(int i = 0; i < (n); i++)
#define ll long long
#define P pair<int, int>
using namespace std;

int main() {
  int d, t, s;
  cin >> d >> t >> s;
  if((t * s) - d >= 0) cout << "Yes" << endl;
  else cout << "No" << endl;
}

Measured memory_bytes: 3620
a,b,c,x,y = map(int, input().split())

A = a * x + b * y
if min(x,y) == x:
    B = c * x * 2 + (y-x) * b
    C = c * y * 2
else:
    B = c * y * 2 + (x-y) * a
    C = c * x * 2

print(min(A,B,C))

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
int main(){
        int k, n; cin >> k >> n;
        vector<int> v_v;
        for (int x = 0; x < n; ++x){
            int q; cin >> q;
            v_v.push_back(q);
        }
        vector<int> v_d;
        for (int x = 1; x < n; ++x){
            v_d.push_back(v_v[x] - v_v[x-1]);
        }
        v_d.push_back(v_v.front() + k - v_v.back());
        int mxs = INT_MIN;
        for (auto x : v_d){
            mxs = max(mxs, x);
        }
        cout << k - mxs << endl;
    return 0;
}


Measured memory_bytes: 5608
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#define MAX 101

int top=0;
int Stack[MAX];

int isempty(){
  if(top == 0)return 1;
  else return 0;
}

int isfull(){
  if(top >= MAX-1)return 1;
  else return 0;
}

int pop(){
  if(isempty()){
    return NULL;
  }else{
    top--;
    return Stack[top+1];
  }
}

void push(int a){
  if(isfull()){
    return;
  }else{
    top++;
    Stack[top] = a;
  }
}



int main(){
  int top=0,a,b;
  char s[MAX];

  while(scanf("%s",s) != EOF){
    if(s[0] == '+'){
      a = pop();
      b = pop();
      push(a + b);
    }else if(s[0] == '-'){
      b = pop();
      a = pop();
      push(a - b);
    }else if(s[0] == '*'){
      a = pop();
      b = pop();
      push(a * b);
    }else{
      push(atoi(s));
    }
  }
  printf("%d\n",pop());

  return 0;
}


Measured memory_bytes: 2084
# A - Prefix and Suffix
n = int(input())
s = input()
t = input()

if len(s) + len(t) <= n:
	print(n)
elif s == t and len(s) >= n:
	print(len(s))
else:
	min_len = min(len(s), len(t))
	ans = len(s) + len(t)
	
	for i in range(1, min_len + 1):
		if s[-i:] == t[:i]:
			ans = len(s) + len(t) - i
	
	if ans < n:
		ans = n
	
	print(ans)

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

#define INF 1e9
using namespace std;
typedef long long ll;

int main() {

    ll n, m; cin >> n >> m;

    cout << m * 1900 * pow(2, (double)m) + (n-m) * 100 * pow(2, (double)m) << endl;
}

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

int main() {
    int n, m, x, a, left=0, right=0;
    cin >> n >> m >> x;
    while(cin >> a) {
        if(a < x) left++;
        else right++;
    }
    cout << min(left, right) << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define P pair<int,int>
using ll=int64_t;
using namespace std;
#define ketasuu(n) fixed<<setprecision(n)
#define btoe(p) p.begin(),p.end()
#define etob(p) p.rbegin(),p.rend()




int main(){
    ll n,a,b; cin>>n>>a>>b;
    if((a-b)%2==0){
        cout<<abs(a-b)/2<<endl;
        return 0;
    }
    ll ans=a+b-2; ans=(ans+1)/2;
    ll c=2*n-a-b; c=(c+1)/2;
    ans=min(ans,c);
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <vector>
#include <string>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <sstream>
#include <iomanip>

using namespace std;

typedef long long ll;
typedef vector <int> vi;
typedef vector <vector <int>> vii;
typedef vector <long long> vll;
typedef vector <string> vs;
typedef vector <char> vc;
typedef set <int> si;
typedef set <string> ss;
typedef queue <int> qi;
typedef queue <long long> qll;
typedef queue <string> qs;
typedef queue <char> qc;
typedef struct board board;
typedef pair <int, int> pi;
typedef pair <long long, long long> pll;
typedef pair <int, pair<int, int>> pii;

#define eb emplace_back
#define ppb pop_back
#define clr(a) a.clear()
#define F first
#define S second
#define mkp make_pair

#define sz(x) (int)(x).size()
#define all(x) (x).begin(), (x).end()

#define left(x) x * 2
#define right(x) x * 2 + 1

#define meme(a, b, c) fill(a + 1, a + 1 + b, c)

#define max(a, b) (a > b ? a : b)
#define min(a, b) (a > b ? b : a)
#define abs(a) (a > 0? a : -(a))

#define move(s) s += "#"

#define fr(i, a, b) for (ll i = a; i <= b; ++ i)
#define rf(i, a, b) for (ll i = a; i >= b; -- i)

#define eprintf(...) fprintf(stderr, __VA_ARGS__);

void to_pray() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    cerr << "Ready\n";
}

const int N = 4e6 + 10;
const int NN = 1e3 + 10;
const int NNN = 2e3 + 9;
const int MOD = 1e9 + 7;
const int INF = 1e9 + 7;
const ll LLINF = 1e17 + 7;
const ll P = 53;
const int EPS = 1e-9 - 8;
const int vN = 2e4 + 10;
const int sz = (1 << 22) - 1;
const double PI = acos(-1);

ll a[20];

ll rec(int l, int r, ll x1, ll xr) {
	if (r - l == 1)
		return a[l] * x1 + a[r] * xr;
	ll ans = 1ll << 60;
	for (int i = l + 1; i < r; ++ i) {
		ans = min(ans, rec(l, i, x1, x1 + xr) + rec(i, r, x1 + xr, xr) - (x1 + xr) * a[i]);
	}
	return ans;
}

int main () {
    to_pray();
	
    int n;
    cin >> n;
    
    for (int i = 1; i <= n; ++ i)
    	cin >> a[i];
    
    cout << rec(1, n, 1, 1);
    
    //eprllf("%.18lf seconds\n", (double)clock() / CLOCKS_PER_SEC);
    cout << '\n';
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstring>
#include<cstdio>
#include<algorithm>
#define Asrt(x) if(!(x)) return !printf("No\n")
#define N 100010
#define lb(x) (x&-x)
#define gc getchar()
#define debug(x) cerr<<#x<<"="<<x
#define sp <<" "
#define ln <<endl
using namespace std;
inline int inn()
{
	int x,ch;while((ch=gc)<'0'||ch>'9');
	x=ch^'0';while((ch=gc)>='0'&&ch<='9')
		x=(x<<1)+(x<<3)+(ch^'0');return x;
}
int a[4][N],b[N],c[5],d[5],p[N],n;
inline int gabs(int x) { return x<0?-x:x; }
inline int update(int x) { for(;x<=n;x+=lb(x)) b[x]^=1;return 0; }
inline int query(int x,int ans=0) { for(;x;x-=lb(x)) ans^=b[x];return ans; }
int main()
{
	n=inn();
	for(int i=1;i<=3;i++)
		for(int j=1;j<=n;j++) a[i][j]=inn();
	for(int i=1;i<=n;i++) Asrt(a[2][i]%3==2);
	for(int i=1;i<=n;i++)
	{
		p[i]=a[2][i]/3+1;
//		debug(i)sp,debug(p[i])ln;
		Asrt(p[i]%2==i%2);
		Asrt(gabs(a[1][i]-a[2][i])==1);
		Asrt(gabs(a[3][i]-a[2][i])==1);
		if(a[1][i]>a[2][i]) c[i&1]^=1;
	}
	for(int i=n;i>=1;i-=2) d[i&1]^=query(p[i]),update(p[i]);
	memset(b,0,sizeof b);
	for(int i=n-1;i>=1;i-=2) d[i&1]^=query(p[i]),update(p[i]);
	Asrt(d[0]==c[1]);Asrt(d[1]==c[0]);return !printf("Yes\n");
}

Measured memory_bytes: 2176
/*************************************
 * @contest:      AtCoder ABC156.
 * @user_id:      63720.
 * @user_name:    Jomoo.
 * @time:         2020-02-22.
 * @language:     C++.
 * @upload_place: Luogu.
*************************************/ 

#include <bits/stdc++.h>
using namespace std;

typedef signed char          int8;
typedef unsigned char       uint8;
typedef short                int16;
typedef unsigned short      uint16;
typedef int                  int32;
typedef unsigned            uint32;
typedef long long            int64;
typedef unsigned long long  uint64;

template <typename Int>
inline Int read()       
{
    Int flag = 1;
    char c = getchar();
    while ((!isdigit(c)) && c != '-') c = getchar();
    if (c == '-') flag = -1, c = getchar();
    Int init = c & 15;
    while (isdigit(c = getchar())) init = (init << 3) + (init << 1) + (c & 15);
    return init * flag;
}

template <typename Int>
inline Int read(char &c)       
{
    Int flag = 1;
    c = getchar();
    while ((!isdigit(c)) && c != '-') c = getchar();
    if (c == '-') flag = -1, c = getchar();
    Int init = c & 15;
    while (isdigit(c = getchar())) init = (init << 3) + (init << 1) + (c & 15);
    return init * flag;
}

template <typename Int>
inline void write(Int x)
{
    if (x < 0) putchar('-'), x = ~x + 1;
    if (x > 9) write(x / 10);
    putchar((x % 10) | 48);
}  

template <typename Int>
inline void write(Int x, char nextch)
{
    write(x);
    putchar(nextch);
}

int N, K;

int main()
{
    N = read<int>();
    K = read<int>();
    int cnt = 0;
    while (N) {
        cnt++;
        N /= K;
    }
    write(cnt, 10);
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<set>
#include<map>
#include<queue>
#include<cassert>
#define PB push_back
#define MP make_pair
#define sz(v) (in((v).size()))
#define forn(i,n) for(in i=0;i<(n);++i)
#define forv(i,v) forn(i,sz(v))
#define fors(i,s) for(auto i=(s).begin();i!=(s).end();++i)
#define all(v) (v).begin(),(v).end()
using namespace std;
typedef long long in;
typedef vector<in> VI;
typedef vector<VI> VVI;
VI wys[2];
const in mdl=1000000007LL;
int main(){
  ios::sync_with_stdio(0);
  cin.tie(0);
  in n;
  cin>>n;
  string s;
  cin>>s;
  in k=sz(s);
  in sw=1;
  in nw=0;
  forn(z,2)
    wys[z].resize(n+3);
  wys[nw][0]=1;
  forn(i,n){
    swap(sw,nw);
    forv(p,wys[nw])
      wys[nw][p]=0;
    forn(p,n+1){
      if(p)
	wys[nw][p-1]+=wys[sw][p];
      else
	wys[nw][p]+=wys[sw][p];
      wys[nw][p+1]+=2*wys[sw][p];
    }
    if(i%5==0 || i==n-1){
      forv(p,wys[nw])
	wys[nw][p]%=mdl;
    }
  }
  in inv2=(mdl+1)/2;
  in rs=wys[nw][k];
  forn(i,k)
    rs=rs*inv2%mdl;
  cout<<rs<<endl;
  return 0;
}


Measured memory_bytes: 512
import itertools

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

A = [[ int(n) for n in input().split()] for _ in range(Q) ]
n = [i for i in range(1,M+1)]
numbers = list(itertools.combinations_with_replacement(n, N))
ans = [0 for _ in range(len(numbers))]

q = Q
while  q> 0:
    q -= 1
    a, b, c, d = A[q][0], A[q][1], A[q][2], A[q][3]

    for i in range(len(numbers)):
        if numbers[i][b-1] - numbers[i][a-1] == c:
            ans[i] += d


print(max(ans))

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

void ccp(vector<int>& c, int n, int m){
  sort(c.begin(), c.end());
  vector<vector<int> > t(m, vector<int>(n + 1));
  for(int i = 0; i < m; i++){
    t[i][0] = 0;
  }
  for(int j = 0; j <= n; j++){
    t[0][j] = j;
  }
  for(int i = 1; i < m; i++){
    for(int j = 0; j <= n; j++){
      if(j - c[i] < 0) t[i][j] = t[i - 1][j];
      else t[i][j] = min(t[i - 1][j], t[i][j - c[i]] + 1);
    }
  }
  cout << t[m - 1][n] << endl;
  return;
}

void kp(vector<int>& v, vector<int>& w, int N, int W){
  vector<pair<int, int> > k(N);
  for(int i = 0; i < N; i++){
    k[i].second = v[i];
    k[i].first = w[i];
  }
  sort(k.begin(), k.end());
  vector<vector<int> > t(N, vector<int>(W + 1));
  for(int i = 0; i < N; i++){
    t[i][0] = 0;
  }
  for(int i = 0; i <= W; i++){
    if(i >= k[0].first) t[0][i] = k[0].second;
    else t[0][i] = 0;
  }
  for(int i = 1; i < N; i++){
    for(int j = 0; j <= W; j++){
      if(j - k[i].first < 0) t[i][j] = t[i - 1][j];
      else t[i][j] = max(t[i - 1][j], t[i - 1][j - k[i].first] + k[i].second);
    }
  }
  cout << t[N - 1][W] << endl;
}

void lis(vector<int>& a){
  int n = a.size();
  vector<int> l(n);
  l[0] = a[0];
  int lid = 1;
  for(int i = 1; i < n; i++){
    int x = a[i];
    auto it = lower_bound(l.begin(), l.begin() + lid, x);
    int pos = (int)(it - l.begin());
    if(pos == lid){
      l[lid++] = x;
    }
    else *it = x;
    /*for(int i = 0; i < l.size(); i++){
      cout << l[i] << " ";
    }
    cout << endl;*/
  }
  cout << lid << endl;
}

void solve(){
  int h, w; cin >> h >> w;
  vector<vector<int> > c(h, vector<int>(w));
  vector<vector<int> > dp(h, vector<int>(w, -1));
  for(int i = 0; i < h; i++){
    for(int j = 0; j < w; j++){
      cin >> c[i][j];
      if(c[i][j] == 1) dp[i][j] = 0;
    }
  }
  int ans = 0;
  for(int i = 0; i < h; i++){
    for(int j = 0; j < w; j++){
      if(dp[i][j] != -1) continue;
      if(i >= 1) dp[i][j] = dp[i - 1][j];
      if(j >= 1) dp[i][j] = min(dp[i][j],dp[i][j - 1]);
      if(i >= 1 && j >= 1) dp[i][j] = min(dp[i][j], dp[i - 1][j - 1]);
      dp[i][j]++;
      dp[i][j] = min(dp[i][j], min(i, j) + 1);
      if(dp[i][j] == 0) dp[i][j] = 1;
      ans = max(ans, dp[i][j]);
    }
  }
  /*for(int i = 0; i < h; i++){
    for(int j = 0; j < w; j++){
      cout << dp[i][j] << " ";
    }
    cout << endl;
  }*/


  cout << ans * ans << endl;
}

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



Measured memory_bytes: 18096
#include <iostream>
#include <vector>
#include <string>
#include <cmath>
#include <set>
#include <algorithm>
#include <array>
#include <complex>
#include <string>
#include <utility>
#include <map>
#include <queue>
#include <list>
#include <functional>
#include <numeric>
#include <stack>
#include <tuple>

using namespace std;
int dx[4] = { -1,0,1,0 };
int dy[4] = { 0,1,0,-1 };
const int INF = 100000000;
const long long LINF = 1000000000000000000;
const int MOD = (int)1e9 + 7;
const double EPS = 1e-6;
const double pi = 3.14159265359;
using pii = std::pair<int, int>;
using ll = long long;
using pLL = std::pair<ll, ll>;
#define SORT(v) std::sort(v.begin(), v.end())
#define RSORT(v) std::sort(v.rbegin(), v.rend())



int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    string s;
    cin >> s;
    int right=0, left=0,x=INF;
    for (size_t i = 0; i < s.size(); ++i) {
        if (s[i] == '(')left++;
        else {
            left--;
            if (left < 0) {
                right++;
                left++;
            }
        }
    }
    string ans;
    for (int i = 0; i < right; ++i) {
        ans += "(";
    }
    ans += s;
    for (int i = 0; i < left; ++i) {
        ans += ")";
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
n = int(input())
s = input()
x = int(s, 2)

popcnt = 0
for c in s:
    if c == '1':
        popcnt += 1

if popcnt == 0:
    for i in range(n):
        print(1)
    exit()
if popcnt == 1:
    if s[-1] == '0':
        for i in range(n - 1):
            if s[i] == '1':
                print(0)
            else:
                print(1)
        print(2)
    else:
        for i in range(n - 1):
            print(2)
        print(0)
    exit()

xm = x % (popcnt - 1)
xp = x % (popcnt + 1)


def pp(k):
    cnt = 0
    while k > 0:
        cnt += k & 1
        k >>= 1
    return cnt


for i in range(n):
    if s[i] == '0':
        # xp
        rem = xp + pow(2, n - 1 - i, popcnt + 1)
        rem %= popcnt + 1
        cnt = 1
        while rem != 0:
            rem %= pp(rem)
            cnt += 1
        print(cnt)
    else:
        # xm
        rem = xm - pow(2, n - 1 - i, popcnt - 1)
        rem %= popcnt - 1
        cnt = 1
        while rem != 0:
            rem %= pp(rem)
            cnt += 1
        print(cnt)


Measured memory_bytes: 9580
/*https://atcoder.jp/contests/abc138/tasks/abc138_c*/
#include<bits/stdc++.h>
using namespace std;
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
#ifndef ONLINE_JUDGE
	// for getting input from input.txt
	freopen("input.txt", "r", stdin);
	// for writing output to output.txt
	freopen("output.txt", "w", stdout);
#endif
	int n, a[1000];
	cin >> n;
	for (int i = 0; i < n; i++)
		cin >> a[i];
	sort(a, a + n);
	double sum = a[0];
	for (int i = 1; i < n; i++)
		sum = (sum + a[i]) / 2;
	cout << fixed << setprecision(5) << sum;
}

Measured memory_bytes: 3772
#include <bits/stdc++.h>
using namespace std;
 
#define FOR(i, x, n) for(ll i = x; i < n; i++) 
#define pb push_back
#define pf push_front
#define ll long long
#define hii cout << "hii" << endl
#define pii pair<int, int>
#define pll pair<ll, ll>
// #define int ll
#define mpp make_pair
#define endl '\n'
#define ff first 
#define ss second
#define vi vector<int>
#define all(s) s.begin(), s.end()
#define fuck_you_scanf ios_base:: sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define si size()
 
const int mod = 1e9 + 7;
const int N = 5e5 + 6;
const int MAX = 5000;
const int N1 = 2005;
 
int arr[N];
int cnt[N][26];
int segtree[2 * N][26];
string input;
int n;
 
void build(int s = 0, int e = n - 1, int node = 0)
{
    if(s == e)
    {
        segtree[node][input[s] - 'a']++;
        return;
    }
    int mid = s + e >> 1;
    build(s, mid, 2 * node + 1);
    build(mid + 1, e, 2 * node + 2);
    for(int i = 0; i < 26; i++)
    {
        segtree[node][i] = segtree[2 * node + 1][i] + segtree[2 * node + 2][i];
    }
}
 
void update(int idx, char ch, int s = 0, int e = n - 1, int node = 0)
{
    if(s == e)
    {
        segtree[node][input[s] - 'a']--;
        segtree[node][ch - 'a']++;
        input[s] = ch;
        return;
    }
    int mid = s + e >> 1;
    if(idx <= mid)
    {
        update(idx, ch, s, mid, 2 * node + 1);
    }
    else
    {
        update(idx, ch, mid + 1, e, 2 * node + 2);
    }
    for(int i = 0; i < 26; i++)
    {
        segtree[node][i] = segtree[2 * node + 1][i] + segtree[2 * node + 2][i];
    }
}
 
void query(int l, int r, vector<int> & ret, int s = 0, int e = n - 1, int node = 0)
{
    if(s >= l and e <= r)
    {
        for(int i = 0; i < 26; i++)
        {
            ret[i] += segtree[node][i];
        }
        return;
    }
    if(s > r or l > e) return;
    int mid = s + e >> 1;
    query(l, r, ret, s, mid, 2 * node + 1);
    query(l, r, ret, mid + 1, e, 2 * node + 2);
}
 
 
int32_t main()
{
    fuck_you_scanf;
	cin >> n;
    cin >> input;
    n = input.si;
    build();
    int q;
    cin >> q;
    while(q--)
    {
        int t;
        cin >> t;
        if(t == 1)
        {
            char ch;
            int pos;
            cin >> pos >> ch;
            pos--;
            update(pos, ch);
        }
        else if(t == 2)
        {
            int l, r;
            cin >> l >> r;
            l--;
            r--;
            vector<int> ret;
            for(int i = 0; i < 26; i++) ret.push_back(0);
            query(l, r, ret);
            int cnt = 0;
            for(int i = 0; i < 26; i++) cnt += (ret[i] != 0);
            cout << cnt << endl;
        }
    }
}

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

using namespace std;

const int BITS = 20;

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

  int n;
  cin >> n;

  for (int i = 0; i < n; i++) {
    for (int j = i + 1; j < n; j++) {
      if (j > i + 1) {
        cout << ' ';
      }
      for (int k = 0; k < BITS; k++) {
        if ((i & (1 << k)) != (j & (1 << k))) {
          cout << k + 1;
          break;
        }
      }
    }
    cout << '\n';
  }

  return 0;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
template<class T> bool chmax(T& a,T b) { if (a < b) { a = b; return true; } return false; }
template<class T> bool chmin(T& a,T b) { if (a > b) { a = b; return true; } return false; }

int main() {
    string s;
    cin >> s;
    
    const int n = s.length();
    reverse(s.begin(), s.end());
    vector<long long> a(n + 1, 0);
    long long t = 1;
    for (int i = 0; i < n; i++) {
        a[i + 1] = (a[i] + (s[i] - '0') * t) % 2019;
        t = t * 10 % 2019;
    }
    
    long long ans = 0;
    map<long long, long long> mp;
    for (int i = 0; i <= n; i++) {
        ans += mp[a[i]];
        mp[a[i]]++;
    }
    
    cout << ans << '\n';
    return 0;
}

Measured memory_bytes: 5132
# -*- coding: utf-8 -*-

n=int(input())  #数値入力 「N」だけの入力のとき
s=str(input())  #数値入力 「N」だけの入力のとき
center = n//2
if n%2==1:
    print("No")
    exit()
first = s[:center]
second = s[center:]
if first == second:
    print("Yes")
else:
    print("No")


Measured memory_bytes: 2940
import java.util.*;

class Main{
    static Scanner sc = new Scanner(System.in);
    public static void main(String args[]){
        String S=sc.next(),T=sc.next();
        int res=T.length();
        for(int i=0;i<=(S.length()-T.length());i++){
            int count=0;
            for(int j=0;j<T.length();j++){
                if(S.charAt(i+j)!=T.charAt(j)){
                    count++;
                }
            }
            res=Math.min(res,count);
        }
        System.out.println(res);


        // int N=sc.nextInt();
        // long A[]=new long[N],sum=0,pow=0,res;
        // for(int i=0;i<N;i++){
        //     A[i]=sc.nextLong();
        //     sum+=A[i];
        //     pow+=A[i]*A[i];
        // }
        // res=((sum*sum-pow)/2)%1000000007;
        // System.out.println(res);
    }
}

Measured memory_bytes: 35544
def main():
    n, k, s = map(int, input().split())
    ans = [str(s)] * k + [str(s + 1)] * (n - k) if s != 10 ** 9 else [str(s)] * k + ['1'] * (n - k)
    print(' '.join(ans))


if __name__ == '__main__':
    main()


Measured memory_bytes: 11956
#include <bits/stdc++.h>
using namespace std;
#define M0D 1000000007

int main(){

  int N;
  cin >> N;
  string S,T;
  cin >> S >> T;
  for(int i=0; i<N; i++){
    cout << S[i] << T[i];
  }
  cout << endl;

  return 0;
}


Measured memory_bytes: 256
/**
*	created: 16.08.2020 16:07:45
**/
#include <bits/stdc++.h>
// #include <boost/multiprecision/cpp_int.hpp>
// using bint = boost::multiprecision::cpp_int;
using namespace std;
using ll = long long;
using P = pair<int,int>;
// #define endl '\n'
#define int long long
#define rep(i,n) for (int i = 0; i < (int)(n); i++)
#define rep2(i,s,n) for (int i = (s); i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define pcnt(bit) __builtin_popcountll(bit)
template<class T> bool chmax(T &a, const T &b) {if (a < b) {a = b; return 1;} return 0;}
template<class T> bool chmin(T &a, const T &b) {if (b < a) {a = b; return 1;} return 0;}
const long double pi = acos(-1.0);
const int MAX = 1000010;
const int INF = LLONG_MAX;
const int MOD = 1000000007;
// const int MOD = 998244353;

int dp[MAX];

signed main() {

    cin.tie(0);
    ios_base::sync_with_stdio(false);

    int n, k; cin >> n >> k;
    vector<int> h(n);
    rep(i,n) {cin >> h[i]; dp[i] = INF;}
    dp[0] = 0;
    rep(i,n) rep2(j,1,k+1) chmin(dp[i+j],dp[i]+abs(h[i+j]-h[i]));
    cout << dp[n-1] << endl;
    return 0;
}

Measured memory_bytes: 4760
#include <bits/stdc++.h>
using namespace std;
#define endl "\n"
#define what_is(x) cerr << #x <<" is " << x << endl;
typedef long long ll;
const double PI = 3.14159265358979;
const ll INF =  1e15 + 7;
const ll MOD = 998244353;
const ll nax = 1010;


int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	int tc = 1;
	// cin >> tc;
	while (tc--) {
		ll n;
		cin >> n;
		ll a[n + 10], b[n + 10];
		for (int i = 1; i <= n; i++) {
			cin >> a[i] >> b[i];
		}
		sort(a + 1, a + n + 1);
		sort(b + 1, b + n + 1);

		// for (int i = 1; i <= n; i++) {
		// 	cout << a[i].first << " " << a[i].second << endl;
		// }
		if (n & 1) {
			ll m = (n + 1) / 2;
			cout << b[m] - a[m] + 1;
		}
		else {
			ll m = n / 2;
			ll minn = a[m] + a[m + 1];
			ll maxx = b[m] + b[m + 1];
			cout << maxx - minn + 1;
		}
	}
	return 0;
}




















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

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;

int N, T;
vi W, V;
vector<vl> dp;

void input_init(void) {
	cin >> N >> T;
	W.resize(N + 1);
	V.resize(N + 1);
	for (int i = 1; i <= N; ++i)
		cin >> W[i] >> V[i];
	dp.resize(N + 1, vl(T + 1, (ll)0));
}

void solve(void) {
	for (int i = 1; i <= N; ++i) {
		for (int j = 0; j <= T; ++j) {
			if (j + W[i] <= T)
				dp[i][j + W[i]] = max(dp[i][j + W[i]], dp[i - 1][j] + V[i]);
			dp[i][j] = max(dp[i][j], dp[i - 1][j]);
		}
	}
}

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

	input_init();
	solve();

	cout << dp[N][T] << '\n';
	return 0;
}


Measured memory_bytes: 80256
#include<iostream>
#include<cmath>
using namespace std;
int main()
{
     int n,k;
     cin>>n>>k;
     int j=0;
     while(pow(k,j)<n)
     {
		 j++;
	 }
	 if(pow(k,j)==n)
	    cout<<j+1<<endl;
	 else
	    cout<<j<<endl;
}


Measured memory_bytes: 256
//abc161_c.cpp
//Sat Apr  4 20:34:59 2020

#include <iostream>
#include <string>
#include <queue>
#include <map>
#include <unordered_map>
#include <vector>
#include <algorithm>
#include <math.h>
#include <set>
#define INTINF 2147483647
#define LLINF 9223372036854775807
#define MOD 1000000007

using namespace std;
using ll=long long;
typedef pair<int,int> P;

int main(){
	ll n,k;
	cin >> n >> k;

	if (n%k==0){
		cout << 0 << endl;
		return 0;
	}

	ll ans = n%k;
	if (abs(k-ans)<ans){
		cout << abs(k-ans)<<endl;
	}else {
		cout << ans << endl;
	}

}

Measured memory_bytes: 256
#include<stdio.h>
#include<iostream>
using namespace std;
int main(){
int h,r,i;
scanf("%d %d",&h,&r);
if(h>=0)
i=1;
else if(r+h==0)
i=0;
else
i=-1;
printf("%d\n",i);
return 0;
}

Measured memory_bytes: 3212
/*
	*	Created By: 'Present_Sir'
	*	Created On: Sunday 02 August 2020 05:32:48 PM IST
*/

#include<bits/stdc++.h>
#define IOS ios_base::sync_with_stdio(false); cin.tie(NULL)
#define int long long
using namespace std;


void solve(){
    int n,d;
    cin>>n>>d;
    int ans=0;
    for(int i=0; i<n; i++){
        int x,y;
        cin>>x>>y;
        if(sqrt(x*x+y*y) <= d){
            ans++;
        }
    }
    cout<<ans<<endl;
}

int32_t main(){
    IOS;
    //int t; cin>>t; while(t--)
    {
        solve();
    }
    return 0;
}



Measured memory_bytes: 3588
# coding: utf-8
# Here your code !
S = int(input())
N = list(map(int,input().split()))
count=0
def bubblesort(n,s):
    global count
    flag = 1
    while flag:
        flag = 0
        for i in range(s-1,0,-1):
            key = n[i]
            if n[i]<n[i-1]:
                n[i]=n[i-1]
                n[i-1]=key
                count+=1
                flag=1
    print(" ".join(list(map(str,n))))
    print(count)
        
bubblesort(N,S)

Measured memory_bytes: 7636
#include <iostream>
#include <string>
#include <vector>
#include <cmath>
#include <algorithm>

using namespace std;
typedef long long ll;

int main() {
	int red, green; cin >> red >> green;
	int r, g, c; cin >> r >> g >> c;

	vector<ll> rA(r), gA(g), cA(c);
	for (auto &x : rA) { cin >> x; }
	for (auto &x : gA) { cin >> x; }
	for (auto &x : cA) { cin >> x; }

	sort(rA.begin(), rA.end());
	sort(gA.begin(), gA.end());
	sort(cA.begin(), cA.end());

	ll ans = 0; int colorless = 0;
	int i = r - 1, j = g - 1, k = c - 1;
	while ((red || green) && colorless < red+green) {
		ll curMax = 0; bool takenRed = red;
		if (takenRed) { curMax = rA[i]; } 
		else { curMax = gA[j]; }
		if (takenRed && green && j >= 0 && gA[j] > curMax) { 
			takenRed = false; curMax = gA[j];
		}
		if (k>=0){
			if (cA[k] > curMax) {
				colorless++;
				curMax = cA[k];
				k--;
			}
			else if (takenRed) { red--; i--; }
			else { green--; j--; }
		}
		else if (takenRed) { red--; i--; }
		else { green--; j--; }

		ans += curMax;
	}

	cout << ans << endl;
}

Measured memory_bytes: 2688
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N=1e6+5;
int n,q;
char s[N];
ll dp[N],f[N],sumd[N],summ[N];
int main()
{
    scanf("%d",&n);
    scanf("%s",s+1);
    scanf("%d",&q);
    for(int i=1;i<=n;i++)
    {
        sumd[i]=sumd[i-1]+(s[i]=='D');
        summ[i]=summ[i-1]+(s[i]=='M');
        dp[i]=dp[i-1];
        f[i]=f[i-1];
        if(s[i]=='M') dp[i]+=sumd[i];
        if(s[i]=='C') f[i]+=dp[i];
    }
    while(q--)
    {
        ll ans=f[n];
        int k;scanf("%d",&k);
        for(int i=k;i<=n;i++)
            if(s[i]=='C')
            ans-=dp[i-k]+(summ[i]-summ[i-k])*sumd[i-k];
        printf("%lld\n",ans);
    }
}


Measured memory_bytes: 32512
// 解き直し.
// https://img.atcoder.jp/abc156/editorial.pdf
#include <bits/stdc++.h>
using namespace std;
using LL = long long;
#define repex(i, a, b, c) for(int i = a; i < b; i += c)
#define repx(i, a, b) repex(i, a, b, 1)
#define rep(i, n) repx(i, 0, n)
#define repr(i, a, b) for(int i = a; i >= b; i--)
const LL MOD = 1e9 + 7;
const int LIMIT = 2020202;
LL FAC[LIMIT];
LL INV[LIMIT];

// Fermat's little theorem から, 大きな冪乗の計算を行う.
// @param a: べき乗したい正整数.
// @param b: 指数.
// @return:  べき乗した計算結果(mod版).
LL mPow(LL a, LL b){
    LL t = 1;
    while(b){
        if(b & 1) t = (t * a) % MOD;
        a = a * a % MOD;
        b >>= 1;
    }
    return t % MOD;
}

// 組み合わせ(nCk)計算用(mod版).
// ※配列FAC, INV は, 事前に計算済のものを使う.
// @param n: 対象となる要素の個数.
// @param k: 選択する要素の個数.
// @return: 組み合わせ(nCk)の計算結果(mod版).
LL combination(LL n, LL k){
    if(n < 0 || k < 0 || k > n) return 0;
    LL ret = FAC[n] * INV[k] % MOD * INV[n - k] % MOD;
    return ret;
}

int main(){
    
    // 1. 入力情報.
    LL n, k;
    scanf("%lld %lld", &n, &k);
    FAC[0] = 1;
    repx(i, 1, LIMIT) FAC[i] = i * FAC[i - 1] % MOD;
    rep(i, LIMIT)     INV[i] = mPow(FAC[i], MOD - 2) % MOD;
    
    // 2. 解説通り.
    // nCm * (n - 1)C(n - m - 1) の 総和を計算.
    LL ans = 0;
    int upper = (int)min(k, n) + 1;
    rep(m, upper){
        LL t = combination(n, m);
        t %= MOD;
        t *= combination(n - 1, n - m - 1);
        t %= MOD;
        ans += t;
        ans %= MOD;
    }
    
    // 3. 出力.
    printf("%lld\n", ans);
    return 0;
    
}

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

using namespace std;

typedef pair<int, int> P;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define repto(i, n) for(int i = 0; i <= (n); i++)
#define all(c) (c).begin(), (c).end()
#define uniq(c) c.erase(unique(all(c)), (c).end()) // ユニークなvectorにする。連続した値を除去して切り出す。
#define _1 first
#define _2 second
#define pb push_back
#define INF 1145141919
#define MOD 1000000007
#define DEBUG(x) cout << #x << ": " << x << endl;

__attribute__((constructor))
void initial() {
  cin.tie(0);
  ios::sync_with_stdio(false);
}

int gcd(int u, int v) {
    while ( v != 0) {
        int r = u % v;
        u = v;
        v = r;
    }
    return u;
}

int main() {
  int W, H, C;
  cin >> W >> H >> C;
  int gcdResult = gcd(W, H);
  cout << ((W / gcdResult) * (H / gcdResult) * C) << endl;
}



Measured memory_bytes: 3220
#include <cstdio>
 
int main(){
    int n, m, sum;
    scanf("%d %d", &n, &m);
    int a[n][m], b[m];
    int i, j;
    for (i = 0; i < n; i++) {
        for (j = 0; j < m; j++) {
            scanf("%d", &a[i][j]);
        }
    }
    for (i = 0; i < m; i++){
        scanf("%d", &b[i]);
    }
    for (i = 0; i < n; i++){
        sum = 0;
        for (j = 0; j < m; j++){
            sum += a[i][j] * b[j];
            }
        printf("%d\n", sum);
    }
    
    return 0;
}


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

int abs(int x){
	return x>0?x:-1*x;
}

int min(int a, int b){
	return a<b?a:b;
}

int main(int argc, char const *argv[])
{
	int n;
	scanf("%d",&n);
	int a[n],dp[n];
	for(int i=0;i<n;i++){
		scanf("%d",&a[i]);
	}
	dp[0] = 0;
	dp[1] = abs(a[1] - a[0]);
	for(int i=2;i<n;i++){
		dp[i] = min(dp[i-1]+abs(a[i-1]-a[i]),dp[i-2]+abs(a[i-2]-a[i]));
	}
	printf("%d\n", dp[n-1]);
	return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define pb push_back
#define mp make_pair
#define pii pair<int,int>
#define in freopen("input.txt", "r", stdin)
#define out freopen("output.txt", "w", stdout)  
#define forn(i,n) for(int (i)=0;(i)<(n);++(i))
#define ref(i,a,b) for (int (i)=(a); (i)<=(b); ++(i))
#define INF 0xFFFFFF
#define endl '\n'
#define pp printf("Case %d: \n",t)
const int MAXX=1000005;
const int maxInt = 2147483647;
int main(){
  ios_base::sync_with_stdio(false);cin.tie(NULL);
	string s;
	cin >> s;
	if(s[0]==s[1] && s[1]==s[2] && s[3]==s[2])cout << "No"<<endl;
	else if( (s[0]==s[1] && s[2]==s[3]) || (s[0]==s[2] && s[1]==s[3]) || (s[0]==s[3] && s[2]==s[1]) )cout <<"Yes"<<endl;
	else cout << "No"<<endl;  
  return 0;
}


Measured memory_bytes: 256
X = int(input())
d= 10**3
list = [0]*d
for i in range(d):
  list[i] = i**5
for i in range(d):
  for j in range(i,d):
    if list[j]-list[i] == X:
      print(j,i)
      break
    elif list[i]+list[j] == X:
      print(j,-i)
      break

Measured memory_bytes: 9200
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int a = scan.nextInt();
		int b = scan.nextInt();
		int c = scan.nextInt();
		System.out.println(a < b && b < c ? "Yes" : "No");
	}

}


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

int main() {
  vector<vector<int>> A(3,vector<int>(3));
  int a[3], b[3];
  
  for(int i=0; i<3; i++){
    for(int j=0; j<3; j++){
      cin >> A[i][j];
    }
  }
  
  bool possible = false;
  for(int i=0; i<=A[0][0]; i++){
    b[1]=A[0][0]-i;
    b[2]=A[0][1]-i;
    b[3]=A[0][2]-i;
    
    if(A[1][0]-b[1]==A[1][1]-b[2] && A[1][1]-b[2]==A[1][2]-b[3]){
      if(A[2][0]-b[1]==A[2][1]-b[2] && A[2][1]-b[2]==A[2][2]-b[3]){
        possible = true;
        break;
      }
    }
  }
  
  if(possible) cout << "Yes" << endl;
  else cout << "No" << endl;
}


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

using ll = int64_t;
#define int ll

#define FOR(i, a, b) for (int i = int(a); i < int(b); i++)
#define REP(i, b) FOR(i, 0, b)
#define MP make_pair
#define PB push_back
#define EB emplace_back
#define ALL(x) x.begin(), x.end()

using pi = pair<int, int>;
using vi = vector<int>;
using ld = long double;

template <class T, class U>
ostream &operator<<(ostream &os, const pair<T, U> &p) {
  os << "(" << p.first << "," << p.second << ")";
  return os;
}

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

ll read() {
  ll i;
  scanf("%" SCNd64, &i);
  return i;
}

void printSpace() { printf(" "); }

void printEoln() { printf("\n"); }

void print(ll x, int suc = 1) {
  printf("%" PRId64, x);
  if (suc == 1) printEoln();
  if (suc == 2) printSpace();
}

string readString() {
  static char buf[3341000];
  scanf("%s", buf);
  return string(buf);
}

char *readCharArray() {
  static char buf[3341000];
  static int bufUsed = 0;
  char *ret = buf + bufUsed;
  scanf("%s", ret);
  bufUsed += strlen(ret) + 1;
  return ret;
}

template <class T, class U>
void chmax(T &a, U b) {
  if (a < b) a = b;
}

template <class T, class U>
void chmin(T &a, U b) {
  if (b < a) a = b;
}

template <class T>
T Sq(const T &t) {
  return t * t;
}

const int mod = 1e9 + 7;

signed main() {
  int n = read();
  vi a;
  map<int, int> cnt;
  REP(i, n) {
    a.PB(read());
    cnt[a[i]]++;
  }
  if (cnt[0] == n) {
    std::cout << "Yes" << std::endl;
    return 0;
  }
  if (n % 3 != 0) {
    std::cout << "No" << std::endl;
    return 0;
  }
  vi all;
  for (auto &p : cnt) {
    REP(i, p.second / (n / 3)) all.PB(p.first);
  }
  if (all.size() == 3 && (all[0] ^ all[1]) == all[2]) {
    std::cout << "Yes" << std::endl;
    return 0;
  }
  std::cout << "No" << std::endl;
}


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

#define int long long
#define DBG 1
#define dump(o) if(DBG){cerr<<#o<<" "<<(o)<<" ";}
#define dumpl(o) if(DBG){cerr<<#o<<" "<<(o)<<endl;}
#define dumpc(o) if(DBG){cerr<<#o; for(auto &e:(o))cerr<<" "<<e;cerr<<endl;}
#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define rrep(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define all(c) begin(c),end(c)
const int INF = sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD = (int)(1e9 + 7);
template<class T> bool chmax(T &a, const T &b) { if (a < b) { a = b; return true; } return false; }
template<class T> bool chmin(T &a, const T &b) { if (a > b) { a = b; return true; } return false; }

signed main() {
	int N; cin >> N;
	vector<int> v(N + 1); v[0] = 0; rep(i, 0, N) { cin >> v[i + 1]; }
	rep(i, 1, N + 1) {
		v[i] += v[i - 1];
	}
	unordered_map<int, int> mp;
	int ans = 0;
	rep(i, 0, N + 1) {
		if (mp.count(v[i])) {
			chmax(ans, i - mp[v[i]]);
		}
		else
			mp[v[i]] = i;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 12456
#include <stdio.h>
int main(void){
  int n,i,t=0;
 scanf("%d",&n);
 for(i=0;i<3;i++){
    if(n%10==7){
      t=1;
    }
   n=n/10; 
 }
 if(t==1) puts("Yes");
 else puts("No");
return 0;
}

Measured memory_bytes: 1620
#![allow(unused_imports)]
use itertools::Itertools;
use proconio::{input, marker::*};
use std::cmp::*;
use std::collections::*;
use superslice::*;

fn main() {
    input! {
        t: usize,
        cases: [(u64, u64, u64, u64, u64);t],
    }

    for (n, a, b, c, d) in cases {
        let mut memo: HashMap<u64, u64> = HashMap::new();
        let ans = solve(n, a, b, c, d, &mut memo);
        println!("{}", ans);
    }
}

fn solve(n: u64, a: u64, b: u64, c: u64, d: u64, memo: &mut HashMap<u64, u64>) -> u64 {
    if n == 0 {
        return 0;
    }
    if n == 1 {
        return d;
    }
    if let Some(&n) = memo.get(&n) {
        return n;
    }

    let mut res = d.saturating_mul(n);

    //A
    let a_plus = 2 - (n % 2);
    res = min(res, solve((n + 1) / 2, a, b, c, d, memo) + a + d * a_plus);

    let a_minus = n % 2;
    res = min(res, solve(n / 2, a, b, c, d, memo) + a + d * a_minus);

    //B
    let b_plus = 3 - (n % 3);
    res = min(res, solve((n + 2) / 3, a, b, c, d, memo) + b + d * b_plus);

    let b_minus = n % 3;
    res = min(res, solve(n / 3, a, b, c, d, memo) + b + d * b_minus);

    //C
    let c_plus = 5 - (n % 5);
    res = min(res, solve((n + 4) / 5, a, b, c, d, memo) + c + d * c_plus);

    let c_minus = n % 5;
    res = min(res, solve(n / 5, a, b, c, d, memo) + c + d * c_minus);

    memo.insert(n, res);
    res
}


Measured memory_bytes: 2604
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <cstdio>
//stl
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <deque>
#include <set>
#include <map>
#include <string>
#include <cmath>
#include <list>
#include <bitset>
#include <iomanip>

#define ll long long
#define ioio ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define F first
#define S second
const ll mod = 1000000007;
const double eps = 1e-9;
const double pi = acos(-1.0);

using namespace std;

int module(int a, int b)
{
	return (a % b + b) % b;
}

vector<vector<int>>g;
vector<int>used;

bool dfs(int v, int pcol)
{
	if (pcol == 1)
		used[v] = 2;
	else
		used[v] = 1;
	int call = used[v];
	bool f = 1;
	for (auto i : g[v])
	{
		if (used[i] == 0)
		{
			f &= dfs(i, call);
		}
		else
		{
			if (used[v] == used[i])
			{
				return false;
			}
		}
	}
	return f;
}


void solve()
{
	string s;
	cin >> s;
	for (int i = 0; i < s.size(); ++i)
		cout << 'x';
}


int main()
{
#ifdef _DEBUG
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
	ioio;
	/*int n;
	cin >> n;
	for (int i = 0; i < n; ++i)*/
	{
		solve();
	}
}

Measured memory_bytes: 256