akhauriyash/Code-Regression huggingface dataset:
#include <vector>
#include <iostream>
#include <utility>
#include <algorithm>
#include <string>
#include <deque>
#include <queue>
#include <tuple>
#include <queue>
#include <functional>
#include <cmath>
#include <iomanip>
#include <map>
#include <set>
#include <numeric>
#include <unordered_map>
#include <unordered_set>
#include <complex>
#include <iterator>
#include <array>
#include <memory>
#include <stack>
#define vi vector<int>
#define vvi vector<vector<int> >
#define ll long long int
#define vl vector<ll>
#define vvl vector<vector<ll>>
#define vb vector<bool>
#define vc vector<char>
#define vs vector<string>
#define ld long double
#define INF 1e9
#define EPS 0.0000000001
#define rep(i,n) for(int i=0;i<n;i++)
#define loop(i,s,n) for(int i=s;i<n;i++)
#define all(in) in.begin(), in.end()
template<class T, class S> void cmin(T &a, const S &b) { if (a > b)a = b; }
template<class T, class S> void cmax(T &a, const S &b) { if (a < b)a = b; }
#define MAX 9999999
using namespace std;
typedef pair<int, int> pii;
typedef pair<double,double>pdd;
typedef pair<ll,ll>pll;
int main(){
    int a,b; cin>>a>>b;
    cout<<max(a-b,0)<<endl;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		String S1 = Main.asshuku(sc.next());
		String S2 = Main.asshuku(sc.next());
		String[] S = { S1, S2 };
		long ans = 0;
		for(int i=0; i<S1.length(); i++) {
			if(S1.charAt(i) == S2.charAt(i)) {
				if(i==0) {
					ans = 3;
				} else {
					if(S1.charAt(i-1) == S2.charAt(i-1)) {
						ans *= 2;
					} else {
						;
					}
				}
			} else {
				if(i==0) {
					ans = 6;
				} else {
					if(S1.charAt(i-1) == S2.charAt(i-1)) {
						ans *= 2;
					} else {
						ans *= 3;
					}
				}
			}
			ans = ans % 1000000007;
		}
		System.out.println(ans);
	}
	
	private static String asshuku(String s) {
		String newstr = "";
		char prechar = '?';
		for(int i=0; i<s.length(); i++) {
			if(prechar == s.charAt(i)) {
				;
			} else {
				newstr += s.charAt(i);
			}
			prechar = s.charAt(i);
		}
		return newstr;
	}

}

Measured memory_bytes: 23764
#include<iostream>
#include<string>
#include<algorithm>
#include<cstdlib>
#include<cmath>
#include<vector>
#include<list>
#include<cstdint>
#include<bits/stdc++.h>
#include<queue>
#include<set>

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define rep_r(i, n) for(int i = n-1; i >= 0; i--)
#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define all(x) (x).begin(),(x).end()
#define SZ(x) ((ll)(x).size())
#define bit(n) (1LL<<(n))
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );

#define pb push_back
#define mod 1000000007

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

using namespace std;
using uif=uint_fast64_t;
using ll=long long int;

int qp(int a,ll b){int ans=1;do{if(b&1)ans=1ll*ans*a%mod;a=1ll*a*a%mod;}while(b>>=1);return ans;}
int qp(int a,ll b,int mo){int ans=1;do{if(b&1)ans=1ll*ans*a%mo;a=1ll*a*a%mo;}while(b>>=1);return ans;}

int gcd(int a,int b){return b?gcd(b,a%b):a;}
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};


int main(void){

  ll n;
  cin>>n;
  vector<ll>a(n);
  vector<ll>b(n);
  vector<ll>c(n);

  rep(i,n){
    cin>>a[i];
    cin>>b[i];
    c[i] = a[i]+b[i];
  }

  std::vector<size_t> indices(c.size());
  std::iota(indices.begin(), indices.end(), 0);
  std::sort(indices.begin(), indices.end(), [&c](size_t i1, size_t i2) {
        return c[i1] > c[i2];
    });
  ll a_sum=0;
  ll b_sum=0;
  //for (auto v : c) std::cout << v << " ";
  //for (auto v : indices) std::cout << v << " ";
  rep(i,n){
    if(i%2 == 0){
      a_sum+=a[indices[i]];
    }
    else{
      b_sum+=b[indices[i]];
    }
  }
  cout << a_sum - b_sum << endl;

  return 0;
}


Measured memory_bytes: 3328
#include <iostream>
#include <string>
#include <map>
#include <vector>
#include <set>
#include <iomanip>
#include <stack>
#include <fstream>
#include <cstdint>
#include <cmath>
#include <algorithm>
#include <utility>
#include <numeric>
#include <functional>
using namespace std;

constexpr int INF       = 1000000000;/* 1e+9a */
constexpr int MODULO    = 1000000007;

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

template<typename STL> inline void print_STL(STL c, string ab = ""){
	cout << ab << '\n';
	for(auto t : c) cout << t << ' '; cout << '\n';}


int64_t pow_Mod(int64_t x, int64_t n)
{
	int64_t anser = 1;
	int64_t now_pow = x;
	while(n > 0)
	{
		if((n & 1 )== 1)
		{
			anser *= now_pow;
			anser %= MODULO;
		}
		now_pow *= now_pow;
		now_pow %= MODULO;

		n >>= 1;
	}
	return anser;
}

template<typename VEC> inline void import_VEC(VEC& c, int n){
	typename VEC::value_type tmp;
	for(int i = 0; i < n; ++i){	cin >> tmp; c.push_back(tmp);} }

#define SPRE(x) setprecision(x) // 精度を指定

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

	int n;
	cin >> n;

	map<int,int> a;
	for(int i = 0; i < n; ++i)
	{
		int tmp;
		cin >> tmp;
		a[tmp]++;
	}

	bool cant = false;
	for(auto t : a)
	{
		if(t.second > 2 || (t.second == 1 && t.first != 0))
		{
			cant = true;
			break;
		}
		if(t.first == 0 && t.second != 1)
		{
			cant = true;
			break;
		}
		if(t.first % 2 == n % 2)
		{
			cant = true;
			break;
		}
	}
	if(cant)
	{
		cout << 0 << '\n';
		return 0;
	}
	cout << pow_Mod(2, (n/2)) << '\n';


}



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

bool visited[105][105][15];
bool dp[105][105][15];
int t[105];
int a[15],b[15],c[15];

bool rec(int l,int r,int id){
  if(visited[l][r][id])
    return dp[l][r][id];
  visited[l][r][id]=true;

  if(l==r){
    if(a[id]==t[l])return dp[l][r][id]=true;
    else return dp[l][r][id]=false;
  }
  
  for(int i=l;i<r;i++){
    if(rec(l,i,b[id])&&rec(i+1,r,c[id])){
      return dp[l][r][id]=true;
    }    
  }
  return dp[l][r][id]=false;
}


int main(){
  int n,m;
  cin>>n;
  for(int i=0;i<n;i++)cin>>t[i];
  cin>>m;
  for(int i=0;i<m;i++){
    cin>>a[i]>>b[i]>>c[i];
    b[i]--;
    c[i]--;
  } 
  if(rec(0,n-1,0)){
    cout<<"Yes"<<endl;
  }else{
    cout<<"No"<<endl;
  }
  return 0;
}

Measured memory_bytes: 1468
#include<bits/stdc++.h>
#define rep for(int s,i=lk[x];i;i=hd[i])\
if((s=to[i])^y)
const int N=2003;
using namespace std;
int n,to[N*2],hd[N*2],lk[N],cnt,
mx[N],mn[N],sz[N],ans=1e9;
inline void add(int u,int v){
	to[++cnt]=v,hd[cnt]=lk[u],lk[u]=cnt;
}int u,v;
char a[N];
void dfs(int x,int y){
	sz[x]=a[x]-'0',mx[x]=0;
	rep dfs(s,x),mx[s]+=sz[s],mn[s]+=sz[s],
	sz[x]+=sz[s],mx[x]+=mx[s];
	mn[x]=mx[x]&1;
	rep mn[x]=max(mn[x],mn[s]-mx[x]+mx[s]);
}
int main(){
	scanf("%d%s",&n,a+1);
	for(int i=1;i<n;i++)
	scanf("%d%d",&u,&v),
	add(u,v),add(v,u);
	for(int i=1;i<=n;i++){
		dfs(i,0);
		if(!mn[i])ans=min(ans,mx[i]);
	}
	printf("%d",ans<1e9?ans/2:-1);
}

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

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);

		long s = sc.nextLong();

		int n = String.valueOf(s).length();

		int nn = n;

		long[] a = new long[n];

		for(int i=0;i<n;i++) {

			long p = (long)Math.pow(10, nn-1);

			a[i] = s/p;

			s %= p;

			nn--;
		}

		long min = 1000;

		for(int i=0;i<=n-3;i++) {

			long aa = a[i]*100 + a[i+1]*10 +a[i+2];

			long b = Math.abs(aa-753);

			if(min>b) min = b;
		}

		System.out.println(min);
	}

}


Measured memory_bytes: 21844
#pragma GCC optimize("O3")
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;
using P = pair<ll,ll>;
using um = unordered_map<ll,ll>;
#define fl cout<<flush;
#define endl '\n'
template <typename T> inline void prt(T v){cout<<v<<'\n';}
template <typename T> inline bool chmax(T &a, const T &b){if (a<b){a=b;return 1;}return 0;}
template <typename T> inline bool chmin(T &a, const T &b){if (a>b){a=b;return 1;}return 0;}
const ll INF=1LL<<60;
const ll MOD=(ll)1e9+7;
const ll MOD2=998244353;
const ld pi=3.14159265358979323846;
const ld eps=1e-10;

signed main(void){
    cin.tie(0);cout.tie(0);ios::sync_with_stdio(false);
    ll L;
    cin >> L;
    ll R;
    cin >> R;
    ll d;
    cin >> d;
    prt(R/d-(L-1)/d);fl

    return 0;
}



Measured memory_bytes: 3640
/* AtCoder コピペ */
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repEq(i, n) for (int i = 0; i <= (int)(n); i++)
#define repVector(i, v) for (auto i = v.begin(); i != v.end(); ++i)

#define ifBetween(n, a, b) if (n > a && n < b)
#define ifBetweenEq(n, a, b) if (n >= a && n <= b)

int main() {
	int a, b, c;
  	cin >> a >> b >> c;
  
  	bool is575 = false;
  	if (a == 7 && b == 5 && c == 5) is575 = true;
    if (a == 5 && b == 7 && c == 5) is575 = true;
    if (a == 5 && b == 5 && c == 7) is575 = true;

  	cout << (is575 ? "YES" : "NO") << endl;
}


Measured memory_bytes: 256
main :: IO ()
main = getLine >>= solve
-- getLine :: IO String
solve :: String -> IO ()
solve string = if (tappable string)
    then putStrLn "Yes"
    else putStrLn "No"

helper :: Int -> Char -> Int
helper  1 'L' = 0
helper (-1) 'R' = 0
helper 1 _ = -1
helper (-1) _ = 1
helper 0 _ = 0

tappable :: String -> Bool 
tappable = (/=0) . foldl helper 1

Measured memory_bytes: 380
// Problem : D - Teleporter
// Contest : AtCoder - AtCoder Beginner Contest 167
// URL : https://atcoder.jp/contests/abc167/tasks/abc167_d
// Memory Limit : 1024 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

#include <cstring>
#include <iostream>
using namespace std;
int a[200005],vis[200005];
int main()
{
 ios::sync_with_stdio(false);
 memset(vis,-1,sizeof(vis));
 int n;
 long long k;
 cin>>n>>k;
 for(int i=1;i<=n;i++)
  cin>>a[i];
 int cur=1;
 for(int i=0;i<=k;i++)
 {
  if(vis[cur]==-1)vis[cur]=i;
  else
  {
   int r=i-vis[cur];
   k=(k-i)%r;
   while(k--)
    cur=a[cur];
   break;
  }
  if(i<k)cur=a[cur];
 }
 cout<<cur<<endl;
 return 0;
}

Measured memory_bytes: 5188
// AOJ 1087: Dimensional Analysis
// 2017.12.13 bal4u@uu

#include <stdio.h>
#include <string.h>
#include <ctype.h>

#define HASHSIZ 101
typedef struct { long long k; char *s; } HASH;
HASH hash1[HASHSIZ+2], *hashend1 = hash1+HASHSIZ;			// Hash table
HASH hash2[HASHSIZ+2], *hashend2 = hash2+HASHSIZ;

char *getStr(long long k)
{
	int i = (int)(k % HASHSIZ);
	HASH *tp = hash1 + i;

	while (tp->k) {
		if (tp->k == k) return tp->s;
		if (++tp == hashend1) tp = hash1;
	}
	return NULL;
}

void regStr(long long k, char *s)
{
	int i = (int)(k % HASHSIZ);
	HASH *tp = hash1 + i;

	while (tp->k) {
		if (tp->k == k) tp->s = s;
		if (++tp == hashend1) tp = hash1;
	}
	tp->k = k, tp->s = s;
}

long long getK(char *s)
{
	int w = strlen(s);
	int i = (101 * *s + 103 * *(s+w-1) + 107 * w) % HASHSIZ;
	HASH *tp = hash2 + i;

	while (tp->s != NULL) {
		if (!strcmp(tp->s, s)) return tp->k;
		if (++tp == hashend2) tp = hash2;
	}
	return -1;
}

void regK(char *s, long long k)
{
	int w = strlen(s);
	int i = (101 * *s + 103 * *(s+w-1) + 107 * w) % HASHSIZ;
	HASH *tp = hash2 + i;

	while (tp->s != NULL) {
		if (!strcmp(tp->s, s)) return;
		if (++tp == hashend2) tp = hash2;
	}
	tp->s = s, tp->k = k;
}

#define N1   5
#define N2   31
#define BASE 16

int n;
char str[30][25]; int sz;
char formula[101], *p;


long long factor()
{
	long long x;
	long long expr();
	char *q, c;

	if (*p == '(') { p++; if ((x = expr()) < 0) return -1LL; p++; }
	else {
		q = p; while (isalpha(*p)) p++;
		c = *p; *p = 0;
		x = getK(q);
		*p = c;
	}
	return x;
}

long long calc(long long x, long long y, int op)
{
	int i, a[5], b[5];

	for (i = 0; i < n; i++) {
		a[i] = (int)(x & N2);
		b[i] = (int)(y & N2);
		x >>= N1, y >>= N1;
	}
	for (i = 0; i < n; i++) {
		if (op) a[i] += b[i] - BASE;
		else    a[i] += BASE - b[i];
		if (a[i] <= 0 || a[i] >= N2) return -1LL;
	}
	for (x = 0, i = n-1; i >= 0; i--) x = (x << N1) + a[i];
	return x;
}

long long term()
{
	int op;
	long long x, y;

	if ((x = factor()) < 0) return -1LL;
	while (1) {
		if (*p == '*') op = 1;
		else if (*p == '/') op = 0;
		else break;
		p++;
		if ((y = factor()) < 0) return -1LL;
		x = calc(x, y, op);
		if (x < 0) return -1LL;
	}
	return x;
}

long long expr()
{
	long long x, y;
	
	if ((x = term()) < 0) return -1LL;
	while (1) {
		if (*p == '+' || *p == '-');
		else break;
		p++;
		if ((y = term()) < 0) return -1LL;
		if (x != y) return -1LL;
	}
	return x;
}

int main()  
{  
	int M, P, d, i;
	long long k;  
	char buf[25];

    while (scanf("%d%d%d", &n, &M, &P) && n > 0) {
		sz = 0;
		memset(hash1, 0, sizeof(hash1));
		memset(hash2, 0, sizeof(hash2));
		while (M--) {
			scanf("%s", str[sz++]);
			for (k = 0, i = 0; i < n; i++) {
				scanf("%d", &d);
				k = (k << N1) + (d + BASE);
			}
			regStr(k, str[sz-1]);
			regK(str[sz-1], k);
		}

		scanf("%s", formula);

		while (P--) {
			scanf("%s%s", str[sz++], buf);
			regK(str[sz-1], getK(buf));
		}

		p = formula;
		k = expr();
		if (k < 0) puts("error");
		else if ((p = getStr(k)) == NULL) puts("undefined");
		else puts(p);
    }
    return 0;
}

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

int main(void)
{
    int i,j;
    int count;
    int S[13]={0};
    int H[13]={0};
    int C[13]={0};
    int D[13]={0};

    int n;
    char suit;

    scanf("%d",&count);

    for(i=0;i<count;i++){

        scanf("%*c%c %d",&suit,&n);

        if(suit=='S'){
            S[n-1]=1;
        }

        else if(suit=='H'){
            H[n-1]=1;
        }

        else if(suit=='C'){
            C[n-1]=1;
        }

        else if(suit=='D'){
            D[n-1]=1;
        }
    }

   for(j=0;j<13;j++){
	   if(S[j]==0){
	       printf("S %d\n",j+1);
	   }
   }

   for(j=0;j<13;j++){
	   if(H[j]==0){
	       printf("H %d\n",j+1);
	   }
   }

   for(j=0;j<13;j++){
	   if(C[j]==0){
	       printf("C %d\n",j+1);
	   }
   }

   for(j=0;j<13;j++){
	   if(D[j]==0){
	       printf("D %d\n",j+1);
	   }
   }

    return 0;
}





Measured memory_bytes: 2704
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
#define irep(i, n) for (int i = (n); i >= 0; i++)
using namespace std;
using ll = long long;
using P = pair<int, int>;
const int INF = 1 << 30;
char maze[60][60];
int main() {
  int h, w;
  cin >> h >> w;
  int white_cnt = 0;
  rep(i,h) rep(j,w) {
    cin >> maze[i][j];
    if (maze[i][j] == '.') white_cnt++;
  }
  int dist[60][60];
  memset(dist, -1, sizeof(dist));
  dist[0][0] = 0;

  queue<P> p;
  p.push(make_pair(0,0));
  int dx[4] = {0,-1,0,1}, dy[4] = {1,0,-1,0};
  while (!p.empty())
  {
    int x = p.front().first, y = p.front().second;
    p.pop();
    rep(i,4) {
      int nx = x + dx[i], ny = y + dy[i];
      if (0<=nx&&nx<h&&0<=ny&&ny<w&&maze[nx][ny]=='.') {
        if (dist[nx][ny] >= 0) continue;
        dist[nx][ny] = dist[x][y] + 1;
        p.push(make_pair(nx, ny));
      }
    }
  }
  if (dist[h-1][w-1]>0) cout << white_cnt - dist[h-1][w-1] - 1 << endl;
  else cout << -1<< endl;
  return 0;
}

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

#define trace(...) __f( #__VA_ARGS__ , __VA_ARGS__ )
template <typename Arg1>
void __f( const char* name , Arg1&& arg1 ) {
        cerr << name << " : " << arg1 << "\n";
}
template <typename Arg1, typename... Args>
void __f( const char* na , Arg1&& arg1 , Args&&... args ) {
        const char* c = strchr( na + 1 , ',' );
        cerr.write( na , c - na ) << " : " << arg1 << " , ";
        __f( c + 1 , args... );
}
#define endl "\n"
#define all(V) V.begin(),V.end()
#define Unique(V) sort(all(V)),V.erase(unique(all(V)),V.end())
#define IO ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
typedef long long int LL;
typedef pair <int,int> pii;
const int MOD = 1e9 + 7;
const int inf = 1e9;
const double EPS = 1e-9;
const double PI = acos(-1.0);
const long long INF = 1e18;
const int N = 1e5 + 5;

int n;
int a[ N ];
int dp[ N ];

int main( ) {
        IO;
        #ifdef LOCAL
            //freopen( "input.txt" , "r" , stdin );
        #endif // LOCAL
        cin >> n;
        for( int i = 1; i <= n; i++ ) cin >> a[i];
        int mx = 0 , cur = 0;
        for( int i = 2; i <= n; i++ ) {
                if( a[i] <= a[i-1] ) cur++ , mx = max( mx , cur );
                else mx = max( mx , cur ) , cur = 0;
        }
        cout << mx << endl;
        return 0;
}










Measured memory_bytes: 640
import std.stdio;
import std.string;
import std.conv;
import std.bigint;
import std.typecons;
import std.algorithm;
import std.array;
import std.math;
import std.range;
 
void main() {
    auto tmp = readln.split.to!(int[]);
    if (tmp[0] == tmp[1]) writeln(tmp[2]);
    else if (tmp[1] == tmp[2]) writeln(tmp[0]);
    else writeln(tmp[1]);
}


Measured memory_bytes: 256
# unihernandez22
# https://atcoder.jp/contests/abc052/tasks/abc052_b
# implementation

input()
s = input()

ans = 0
x = 0
for i in s:
    if i == 'I':
        x += 1
    elif i == 'D':
        x -= 1
    ans = max(ans, x)

print(ans)


Measured memory_bytes: 2940
#define  _USE_MATH_DEFINES

#define  rep(i, n) for(int i = 0; i < n; i++)
#define  repx(i, a, n) for(int i = a; i < n; i++)
#define  loop while(1)
#define  lli long long int
 
#include <iostream>
#include <algorithm>
#include <cmath>
#include <numeric>
#include <string>
#include <vector>
#include <list>
#include <map>
#include <utility>
#include <set>
  
using namespace std;
 
int main() {

  double a, b, c, angleC, sinC, cosC;
  cin >> a >> b >> angleC;

  angleC = angleC * M_PI / 180.0;

  cosC = cos(angleC);
  sinC = sqrt(1 - cosC * cosC);

  printf("%.10lf\n", a * b * sinC / 2.0);
  printf("%.10lf\n", a + b + sqrt(a * a + b * b - 2 * a * b * cosC));
  printf("%.10lf\n", b * sinC);
 
  return 0;
}



Measured memory_bytes: 3412
#include<stdio.h>
 
int main(){
  int n, cnt = 0, min;
  scanf("%d", &n);
  
  int p[n];
  scanf("%d", &p[0]);
  min = p[0];
  cnt++;
  for(int i = 1;i < n;i++){
    scanf("%d", &p[i]);
    if(min > p[i]){
      min = p[i];
      cnt++;
    }
  }
  
  printf("%d\n", cnt);
  
  return 0;
}

Measured memory_bytes: 896
import java.util.Arrays;
import java.util.OptionalInt;
import java.util.Scanner;

public class Main {

    void run() {
        Scanner sc = new Scanner(System.in);

        int n = sc.nextInt();
        int[] A = new int[n];

        for (int i = 0; i < n; i++) {
            A[i] = sc.nextInt();
        }
        int ans = Arrays.stream(A)
                .reduce(this::gcd)
                .getAsInt();
        System.out.println(ans);
    }

    int gcd(int a, int b) {
        if (b == 0) return a;
        return gcd(b, a % b);
    }

    void debug(Object... os) {
        System.err.println(Arrays.deepToString(os));
    }

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


Measured memory_bytes: 52164
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> l_l;
typedef pair<int , int> i_i;
typedef vector<ll> vl;
typedef vector<int> vi;
typedef vector<char> vec;
typedef vector<bool> veb;
typedef vector<string> ves;
typedef vector<vector<ll>> vvl;
typedef vector<vector<int>> vvi;
typedef vector<vector<char>> vvec;
typedef vector<vector<bool>> vveb;
typedef vector<vector<string>> vves;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<(int)(n);i++)
#define rep2(i,n) for(int i=2;i<(int)(n);i++)
#define repk(i,k,n) for(int i=k;i<(int)(n);i++)
#define fs first
#define sc second
#define pb push_back
#define pp pop_back
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define maxel(a) *max_element(all(a))
#define minel(a) *min_element(all(a))
#define acc accumulate
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
#define mod (1000000007)
typedef long long int64;
//const int64 INF = 1LL << 58;
#define dame { puts("-1"); return 0;}
#define YES { cout << "YES" << endl; return 0; }
#define NO { cout << "NO" << endl; return 0; }
#define Yes { cout << "Yes" << endl; return 0; }
#define No { cout << "No" << endl; return 0; }
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 (a>b) { a=b; return 1; } return 0; }
int dx[] = {0, 0, -1, 1};
int dy[] = {1, -1, 0, 0};

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

	ld a,b; cin >> a;
	b = a / 3;
	cout << b * b * b << endl;
    
}

Measured memory_bytes: 256
#include <iostream>

int main(void)
{
    int a, b;
    std::cin >> a >> b;
    int c = (a + b) / 2;
    if (((a + b) & 1) == 1)
    {
        c += 1;
    }
    std::cout << c << std::endl;
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cstring>
#include<cmath>
#include<algorithm>
using namespace std;
typedef long long LL;
const int INF=0x3f3f3f3f;
const int MAXN=1e5+5;
int a[MAXN];
int G[105][105];

int main()
{
    int h,w;
    while(scanf("%d%d",&h,&w)!=EOF)
    {
        int n;
        cin>>n;
        for(int i=1;i<=n;++i)
            scanf("%d",&a[i]);
        int cnt=1;
        for(int i=1;i<=h;++i)
        {
            if(i&1)
            {
                for(int j=1;j<=w;++j)
                {
                   if(a[cnt]>0) {G[i][j]=cnt;--a[cnt];}
                   else if(a[cnt]==0) {++cnt;G[i][j]=cnt;--a[cnt];}
                }
            }else
            {
                for(int j=w;j>=1;--j)
                {
                    if(a[cnt]>0) {G[i][j]=cnt;--a[cnt];}
                    else if(a[cnt]==0) {++cnt;G[i][j]=cnt;--a[cnt];}
                }
            }
        }
        for(int i=1;i<=h;++i)
        {
            for(int j=1;j<=w;++j)
            {
                if(j!=w) printf("%d ",G[i][j]);
                else printf("%d\n",G[i][j]);
            }
        }
    }
    return 0;
}

Measured memory_bytes: 384
#include<iostream>
#include<vector>
#include<algorithm>
#include<set>
#include<queue>
#include<map>
#include<math.h>
#include<string>
#include <cctype>
#include <cstdlib>
#include<bitset>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define reps(i, s, n) for (int i = s; i < (int)(n); i++)
#define out(x) cout << x << endl
#define INF 1ll<<60;
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; }

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

int main(){
    unsigned long long a; cin >> a;
    long double b; cin >> b;
    b = (int)(b*100+0.01);
    ll f = a*b/100;
    cout << f << endl;
}


Measured memory_bytes: 3724
//inlclude before define 
#define _USE_MATH_DEFINES

//include
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<cmath>
#include<type_traits>
#include<numeric>
#include<deque>
#include<iomanip>
#include<set>
#include<unordered_set>
#include<tuple>
#include<map>
#include<memory>

using namespace std;

//typedef
typedef vector<int> VI;
typedef vector<string> VS;
typedef vector<char> VC;
typedef vector<double> VD;
typedef pair<int, int> P1;
typedef long long int ll;

//number
#define INF 1e9
#define NUM 1000000007

//itr
#define all(x) begin(x),end(x)

//repeat
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define REP(i,a,b) for(int i=int(a);i<int(b);i++)

//max,min
#define chmin(a,b) a=min((a),(b))
#define chmax(a,b) a=max((a),(b))

//function

/*ll gcd(ll a, ll b) {
	if (b == 0) return a;
	else return gcd(b, a%b);
}*/

/*ll lcm(ll a,ll b) {
	ll g = gcd(a, b);
	retur5n a * (b / g);
}*/

int dig(int a) {
	int sum = 0;
	while (a) {
		sum += a % 10;
		a /= 10;
	}
	return sum;
}

//grid template
int x[] = { -1, 0, 1, 0 };
int y[] = { 0,-1,0,1 };
int xx[] = { -1,-1,1,1 };
int yy[] = { 1,-1,1,-1 };

int main() {
	int n, m;
	cin >> n >> m;
	VI a(n+2),r(m),l(m);
	rep(i, m) cin >> l[i] >> r[i];

	for (int i = 0; i < m; i++){
		a[l[i]] ++;
		a[r[i]+1] --;
	}

	for (int i = 0; i < n+1; i++) {
		if(0<i)a[i] += a[i-1];
	}
	//ep(i, n+1) cout << a[i]<<"\n";
	int cnt = 0;
	for (int i = 0; i < n+1; i++) {
		if (a[i] == m) cnt++;
	}
	cout << cnt << endl;
}

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

using namespace std;

#define int long long
typedef vector<int> vint;
typedef pair<int, int> pint;
const double PI = 3.14159265358979323846;
const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
// cout << fixed << setprecision(20);

int N;
int dp[110000][3];

signed main() {
    cin >> N;
    for (int i = 1; i <= N; i++) {
        int a, b, c;
        cin >> a >> b >> c;
        dp[i][0] = max(dp[i - 1][1], dp[i - 1][2]) + a;
        dp[i][1] = max(dp[i - 1][0], dp[i - 1][2]) + b;
        dp[i][2] = max(dp[i - 1][0], dp[i - 1][1]) + c;
    }
    cout << max({dp[N][0], dp[N][1], dp[N][2]}) << endl;
}


Measured memory_bytes: 2560
#include<bits/stdc++.h>
using namespace std;
#define int long long
struct node{
  int key;
  node *left,*right,*p;
  node(){}
  node(int key):key(key){left=right=p=NULL;};
};
node *root;
void insert(node z){
  node *y=NULL;
  node *x=root;
  while(x!=NULL){
    y=x;
    if(z.key<x->key) x=x->left;
    else x=x->right;
  }
  z.p=y;
  if(y==NULL) root=new node(z);
  else if(z.key<y->key) y->left=new node(z);
  else y->right=new node(z);
}
bool find(int z){
  node *x=root;
  while(x!=NULL){
    if(z==x->key) return true;
    if(z<x->key) x=x->left;
    else x=x->right;
  }
  return false;
}
void inorderTreeWalk(node *v){
  if(v==NULL) return;
  inorderTreeWalk(v->left);
  cout<<" "<<v->key;
  inorderTreeWalk(v->right);
}
void preorderTreeWalk(node *v){
  if(v==NULL) return;
  cout<<" "<<v->key;
  preorderTreeWalk(v->left);
  preorderTreeWalk(v->right);
}
signed main(){
  int n;
  cin>>n;
  root=NULL;
  for(int i=0;i<n;i++){
    string s;
    cin>>s;
    //cout<<(root==NULL?-1:root->key)<<endl;
    if(s=="print"){
      inorderTreeWalk(root);
      cout<<endl;
      preorderTreeWalk(root);
      cout<<endl;
      continue;
    }
    int x;
    cin>>x;
    if(s=="insert"){
      insert(node(x));
    }
    if(s=="find"){
      cout<<(find(x)?"yes":"no")<<endl;
    }
  }
  return 0;
}



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

int main() {
	// your code goes here
	string s;
	for(int i=1;i<=6;i++){
		cin>>s[i];}
		if(s[3]==s[4] && s[5]==s[6])
		cout<<"Yes"<<endl;
		else
		cout<<"No"<<endl;

	return 0;
}

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

using namespace std;
#define PI              3.1415926536

#define ff              first
#define ss              second
#define int             long long
#define pb              push_back
#define mp              make_pair
#define pii             pair<int,int>
#define vi              vector<int>
#define mii             map<int,int>
#define pqb             priority_queue<int>
#define pqs             priority_queue<int,vi,greater<int> >
#define setbits(x)      __builtin_popcountll(x)
#define zrobits(x)      __builtin_ctzll(x)
#define mod 1000000007
#define inf             1e18
#define ps(x,y)         fixed<<setprecision(y)<<x
#define mk(arr,n,type)  type *arr=new type[n];
#define w(x)            int x; cin>>x; while(x--)
#define REP(i,n) for(i=0;i<n;i++)
#define FIO             ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
mt19937                 rng(chrono::steady_clock::now().time_since_epoch().count());

bool f(int x, int y)
{
	return x > y;
}
void c_p_c()
{
#ifndef  ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
}
template<class T> bool ckmin(T& a, const T& b) { return b < a ? a = b, 1 : 0; }

void solve()
{



}




int32_t main()
{
	//c_p_c();
	FIO;

	// w(t)
	// {
	int n;
	cin >> n;
	int a[n];
	int i;

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

	int b[n];

	for (i = 0; i < n; i++)
	{
		if (i == 0)
		{
			b[i] = a[i];
		}
		else if (i != 0)
		{
			b[i] = b[i - 1] % mod + a[i] % mod;
		}
	}

	int res = 0;
	for (i = n - 1; i >= 1; i--)
	{
		res %= mod;
		res += ((a[i] % mod) * (b[i - 1] % mod)) % mod;
	}
	cout << res % mod;
}




Measured memory_bytes: 6756
use std::cmp::*;
use std::io::*;
const INF: usize = 1 << 30;

fn main() {
    let mut s: String = String::new();
    stdin().read_to_string(&mut s).ok();
    let mut itr = s.trim().split_whitespace();
    let n: usize = itr.next().unwrap().parse().unwrap();
    let ma: usize = itr.next().unwrap().parse().unwrap();
    let mb: usize = itr.next().unwrap().parse().unwrap();
    let abc: Vec<(usize, usize, usize)> = (0..n)
        .map(|_| {
            (
                itr.next().unwrap().parse().unwrap(),
                itr.next().unwrap().parse().unwrap(),
                itr.next().unwrap().parse().unwrap(),
            )
        })
        .collect();

    let mut dp: Vec<Vec<Vec<usize>>> = vec![vec![vec![INF; 444]; 444]; 44];
    dp[0][0][0] = 0;
    for i in 0..n {
        for a in 0..400 {
            for b in 0..400 {
                dp[i + 1][a][b] = min(dp[i + 1][a][b], dp[i][a][b]);
                dp[i + 1][a + abc[i].0][b + abc[i].1] = min(
                    dp[i + 1][a + abc[i].0][b + abc[i].1],
                    dp[i][a][b] + abc[i].2,
                );
            }
        }
    }

    let mut ans = INF;
    let mut i = 1;
    while 404 > max(ma, mb) * i {
        ans = min(ans, dp[n][i * ma][i * mb]);
        i += 1;
    }
    if ans == INF {
        println!("-1");
    } else {
        println!("{}", ans);
    }
}


Measured memory_bytes: 73980
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
typedef long long ll;
int main() {
  int s, w;
  cin >> s >> w;
  if (s <= w)
    cout << "unsafe";
  else
    cout << "safe";
}


Measured memory_bytes: 3636
using System;
using System.Linq;

namespace ABC
{
#if USE_STUB
    using static Stub.Console;
#else
    using static System.Console;
#endif
    using static System.Math;
    public class Program
    {
        private const int MOD = 1000000007;

        static long N;
        static _AB[] AB;

        static void Main(string[] args)
        {
            WriteLine(Solve());
        }

        public static object Solve()
        {
            N = long.Parse(ReadLine());
            AB = new _AB[N];
            for (int i = 0; i < N; i++)
            {
                AB[i] = new _AB(ReadLine().Split().Select(long.Parse).ToArray());
            }

            var tmp = 0L;
            if (AB.OrderBy(ab => ab.B).All(ab =>
                {
                    tmp += ab.A;
                    return tmp <= ab.B;
                }))
                return "Yes";
            else
                return "No";
        }

        struct _AB
        {
            public long A { get; }
            public long B { get; }

            public _AB(long[] ab)
            {
                A = ab[0];
                B = ab[1];
            }
        }
    }
}


Measured memory_bytes: 26000
#include <bits/stdc++.h>
#define simplify ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define int long long
#define endl "\n"
using namespace std;


int32_t main() {

    simplify

    int h,w,total;
    cin>>h>>w>>total;

    int ans=0;

    vector<string>grid(h);

    for(int i=0;i<h;i++){
        cin>>grid[i];
    }

    for(int i=0;i<(1<<h);i++){
        for(int j=0;j<(1<<w);j++){
            int blacks=0;
            for(int k=0;k<h;k++){
                for(int l=0;l<w;l++){
                    if(i&(1<<k) || j&(1<<l)){
                        continue;
                    }
                    else if(grid[k][l]=='#'){
                        blacks++;
                    }
                }
            }
            if(blacks==total)ans++;
        }
    }
    cout<<ans;
    

    return 0;
}



Measured memory_bytes: 3652
#pragma GCC optimize("Ofast")
#include<bits/stdc++.h>
using namespace std;
struct __INIT{__INIT(){cin.tie(0);ios::sync_with_stdio(false);cout<<fixed<<setprecision(15);}} __init;
#define max3(a,b,c) max(a,max(b,c))
#define min3(a,b,c) min(a,min(b,c))
#define MOD 1000000007
#define INF (1<<30)
#define LINF (1LL<<60)
#define endl "\n"
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define reprev(i,n) for(int (i)=(n-1);(i)>=0;(i)--)
#define Flag(x) (1<<(x))
#define Flagcount(x) __builtin_popcount(x)
#define pint pair<int,int>
#define pdouble pair<double,double>
#define plint pair<lint,lint>
typedef unsigned long long int ull;
typedef long long lint;

int main(void){
  string A,B;
  cin >> A >> B;
  A+=B;
  int keisu=1;
  int ans=0;
  int L=A.length();
  reprev(i,L){
    ans+=keisu*(A[i]-'0');
    keisu*=10;
  }
  if((int)sqrt(ans)*(int)sqrt(ans)==ans) cout << "Yes" << endl;
  else cout << "No" << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define INF 2000000000
#define MOD 1000000007
#define EPS (1e-10)

using namespace std;

int main(int argc, char *argv[]) {

	int N,K; cin >> N >> K;

	cout << N - K + 1 << endl;
	return 0;
}


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

using namespace std;

#define MOD ((int)(1e9+7))

int main() {
    int H, W;
    cin >> H >> W;

    bool grid[H][W];
    char c;
    scanf("%c", &c); // endl
    for (int i=0; i<H; i++) {
        for (int j=0; j<W; j++) {
            scanf("%c", &c);
            grid[i][j] = (c == '.')? true:false;
        }
        scanf("%c", &c); // endl
    }
    
    int ans[H][W];
    for (int i=0; i<H; i++)
        for (int j=0; j<W; j++) 
            ans[i][j] = 0;
    ans[0][0] = 1;

    for (int i=0; i<H; i++) {
        for (int j=0; j<W; j++) {
            if (i == 0 && j == 0)
                continue;
            
            if (i > 0) 
                if (grid[i-1][j])
                    ans[i][j] += ans[i-1][j];
            ans[i][j] %= MOD;

            if (j > 0) 
                if (grid[i][j-1])
                    ans[i][j] += ans[i][j-1];
            ans[i][j] %= MOD;
            
        }
    }

    cout << ans[H-1][W-1];

    return 0;
}

Measured memory_bytes: 5120
#include <bits/stdc++.h>
typedef long long LL;
#define SZ(X) ((int)(X).size())
#define ALL(X) (X).begin(), (X).end()
#define REP(I, N) for (int I = 0; I < (N); ++I)
#define REPP(I, A, B) for (int I = (A); I < (B); ++I)
#define RI(X) scanf("%d", &(X))
#define RII(X, Y) scanf("%d%d", &(X), &(Y))
#define RIII(X, Y, Z) scanf("%d%d%d", &(X), &(Y), &(Z))
#define DRI(X) int (X); scanf("%d", &X)
#define DRII(X, Y) int X, Y; scanf("%d%d", &X, &Y)
#define DRIII(X, Y, Z) int X, Y, Z; scanf("%d%d%d", &X, &Y, &Z)
#define RS(X) scanf("%s", (X))
#define CASET int ___T, case_n = 1; scanf("%d ", &___T); while (___T-- > 0)
#define MP make_pair
#define PB push_back
#define MS0(X) memset((X), 0, sizeof((X)))
#define MS1(X) memset((X), -1, sizeof((X)))
#define LEN(X) strlen(X)
#define PII pair<int,int>
#define VI vector<int>
#define VL vector<long long>
#define VPII vector<pair<int,int> >
#define PLL pair<long long,long long>
#define VPLL vector<pair<long long,long long> >
#define F first
#define S second

using namespace std;

VI ps;

int findp(int i){
	if (ps[i]!=i) ps[i]=findp(ps[i]);
	return ps[i];
}

void merge(int i,int j){
	ps[findp(i)]=ps[findp(j)];
}

int main(){
	//ios_base::sync_with_stdio(false);
    //cin.tie(NULL);
    DRI(n);
    VI cols(1e5+1,-1);
    VI rows(1e5+1,-1);
    ps=VI(n);
    REP(i,n){
		ps[i]=i;
	}
	VPII points;
    REP(i,n){
		DRII(x,y);
		points.PB({x,y});
		if (cols[y]!=-1) {merge(i,cols[y]);}
		if (rows[x]!=-1) {merge(i,rows[x]);}
		cols[y]=i;
		rows[x]=i;
	}
	vector<set<int>> nbc(n);
	vector<set<int>> nbr(n);
	REP(i,n){
		int p=findp(i);
		nbr[p].insert(points[i].F);
		nbc[p].insert(points[i].S);
		}
	LL rr=0;
	
	REP(i,n){
		int b=nbr[i].size();
		int c=nbc[i].size();
		rr+=(LL)b*c;
	}
	printf("%lld\n",rr-n);
}


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

// iterator
#define REP(i,init, n) for(lli i=init;i<n;i++)
#define REPE(i,init, n) for(lli i=init;i<=n;i++)
#define REPIT(it,container) for(auto it = container.begin(); it != container.end(); it++)
#define REPIT_R(it,container) for(auto it = container.rbegin(); it != container.rend(); it++)

// input
#define cin1(x)             cin >> x
#define cin2(x, y)          cin >> x >> y
#define cin3(x, y, z)       cin >> x >> y >> z
#define ncin1(n, x)         REP(i, 0, n) {cin1(x[i]);}
#define ncin2(n, x, y)      REP(i, 0, n) {cin2(x[i], y[i]);}
#define ncin3(n, x, y, z)   REP(i, 0, n) {cin3(x[i], y[i], z[i]);}

// output
#define cout1(x)         cout << #x << ": " << x << endl;
#define ncout1(n, x)     REP(i, 0, n) {cout << #x << "[" << i << "]: "<< x[i] << endl;}

// sort
#define sort_r(x, y)        sort(x, y, greater<lli>()); // 降順(5,4,3,,,)

#define ARRAY_LENGTH(array) (sizeof(array) / sizeof(array[0]))

typedef long long int lli;
typedef pair<lli, lli> P;

int main() {
    lli n;
    cin1(n);
    double v[n];
    ncin1(n, v);
    priority_queue<double, vector<double>, greater<double>> que;
    REP(i, 0, n) {
        que.push(v[i]);
    }

    REP(i, 0, n-1) {
        double x = que.top();
        que.pop();
        double y = que.top();
        que.pop();
        que.push((x+y)/2);
    }
    cout <<fixed<< que.top() << endl;
}


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

int MAX,N;
int d[300];


bool a[300],b[300];
vector<int>ga[300],gb[300];

void f(int x){
    if(a[x])return;
    a[x]=true;
    for(int i=0;i<ga[x].size();i++)f(ga[x][i]);
}

void g(int x){
    if(b[x])return;
    b[x]=true;
    for(int i=0;i<gb[x].size();i++)g(gb[x][i]);
}

void solve(){
    for(int i=0;i<=N+1;i++){
        a[i]=b[i]=false;
        ga[i]=gb[i]=vector<int>();
    }

    for(int i=0;i<=N;i++){
        for(int j=1;j<=MAX;j++){
            int to=max(min((min(i+j,N+1)+d[min(i+j,N+1)]),N+1),0);
            ga[i].push_back(to);
            gb[to].push_back(i);
        }
    }

    f(0);g(N+1);

    for(int i=0;i<=N;i++){
        if(a[i]&&(!b[i])){
            cout<<"NG"<<endl;
            return;
        }
    }

    cout<<"OK"<<endl;

}

bool input(){
    cin>>MAX;
    if(!MAX)return false;
    cin>>N;
    for(int i=0;i<N;i++)cin>>d[i+1];
    d[N+1]=0;
    return true;
}

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

Measured memory_bytes: 1292
#include <bits/stdc++.h>
using namespace std;
int main() {
  int x, a, b;
  cin >> x >> a >> b;
  if (b - a <= 0) {
    cout << "delicious" << endl;
    return 0;
  }
  if (b - a <=x)
    cout << "safe" << endl;
  else
    cout << "dangerous" << endl;
  
}

Measured memory_bytes: 256
#!/usr/bin/python3

from collections import defaultdict, Counter
from itertools import product, groupby, count, permutations, combinations
from math import pi, sqrt
from collections import deque
from bisect import bisect, bisect_left, bisect_right
from string import ascii_lowercase
from functools import lru_cache
import sys
sys.setrecursionlimit(10000)
INF = float("inf")
YES, Yes, yes, NO, No, no = "YES", "Yes", "yes", "NO", "No", "no"
dy4, dx4 = [0, 1, 0, -1], [1, 0, -1, 0]


def inside(y, x, H, W):
    return 0 <= y < H and 0 <= x < W


def solve(a, b):
    pass


def main():
    a, b = map(int, input().split())
    ans = 0
    for i in range(b - a):
        ans += i
    print(ans - a)

if __name__ == '__main__':
    main()


Measured memory_bytes: 4080
parseInt(x::String) = parse(Int, x)
parseInt(x::SubString{String}) = parse(Int, x)
parseInt(x::Char) = parse(Int, x)
parseInt(x::Float64) = trunc(Int, x)
parseFloat(x::String) = parse(Float64, x)
parseFloat(x::Int) = trunc(Float64, x)
parseMap(x::Array{SubString{String},1}) = map(parseInt, x)

function main()
    a,b=parseMap(split(readline()))
    num=parseInt(join([string(a),string(b)]))
    ans="No"
    for i in 1:100100
        if i^2==num
            ans="Yes"
            break
        end
    end
    println(ans)
end
main()

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

using namespace std;
#define ll long long
#define ld long double

ll binPow(ll a, ll b) {
    ll ans = 1;
    while(b > 0) {
        if(b & 1) ans *= a;
        a *= a;
        b >>= 1;
    }
    return ans;
}

ll binPowMod(ll a, ll b, ll m) {
    ll ans = 1;
    a %= m;
    while(b > 0) {
        if(b & 1) ans *= a % m;
        a *= a % m;
        b >>= 1;
    }
    return ans;
}

int main()
{
    ios_base::sync_with_stdio(0),cin.tie(NULL),cout.tie(NULL);
    ll h;
    cin >> h;
    ll c = 1, ans = 0LL;
    while(h > 0LL) {
        ans += c;
        c *= 2;
        h /= 2;
    }
    cout << ans << endl;
    return 0;
}


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


int main() {
   int A[3][3];
   rep(i, 3){
       rep(j, 3){
           cin >> A[i][j];
       }
   }
   int N;
   cin >> N;
   vector<vector<bool>> f(3, vector<bool>(3, false));
   rep(i, N){
       int b;
       cin >> b;
       rep(j, 3){
           rep(k, 3){
               if(A[j][k] == b){
                    f[j][k] = true;
               }
           }
       }
    }
    rep(i, 3){
        if(f[i][0] && f[i][1] && f[i][2]){
            cout << "Yes";
            return 0;
        }
        if(f[0][i] && f[1][i] && f[2][i]){
            cout << "Yes";
            return 0;
        }
    }
    if(f[0][0] && f[1][1] && f[2][2]){
            cout << "Yes";
            return 0;
    }
        if(f[0][2] && f[1][1] && f[2][0]){
            cout << "Yes";
            return 0;
        }
    cout << "No";

}
    


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ALL(x) (x).begin(),(x).end()
#define COUT(x) cout<<(x)<<"\n"
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define REP(i, n) for(int i=0;i<n;i++)
#define YES(x) cout<<(x?"YES":"NO")<<"\n"
#define Yes(x) cout<<(x?"Yes":"No")<<"\n"
#define dump(x) cout<<#x<<" = "<<(x)<<"\n"
#define endl "\n"
using G = vector<vector<int>>;
using M = map<int,int>;
using P = pair<int,int>;
using PQ = priority_queue<int>;
using PQG = priority_queue<int,vector<int>,greater<int>>;
using V = vector<int>;
using ll = long long;
using edge = struct { int to; int cost; };
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;

int main() {
  IOS;
  ll n; cin >> n;
  vector<ll> a(n);
  REP(i,n) {
    cin >> a[i];
  }
  ll x = a[0];
  for(int i = 1; i < n; i++) {
    x = x^a[i];
  }

  REP(i,n) {
    cout << (x^a[i]) << " ";
  }
  cout << endl;
  return 0;
}

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

int main(){
    int A,B; cin >> A >> B;
    rep(i,1010){
        if(floor(i*0.08)==A && floor(i*0.1)==B){
            cout << i << endl;
            return 0;
        }
    }
    cout << -1 << endl;
}

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

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

int main(void) {
    int r;
    cin >> r;

    cout << 3 * r * r << endl;

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main() {
  string s;
  cin >> s;
  string rev_s = s;
  reverse(rev_s.begin(), rev_s.end());
  int cnt = 0;
  for (auto i = 0; i < s.size(); i++) if (s[i] != rev_s[i]) cnt++;
  printf("%d\n", cnt / 2);
}


Measured memory_bytes: 256
eval"N,*T=#{`tr -! ,`}0"
z=1
N.times{|i|a,b=T[N+i,2]
z*=[[[a,t=T[i]].min,0,-1[a-t]][s=T[i-1]<=>t],0,(s%3-1)[t-a]][b<=>a]
z%=10**9+7}
p z

Measured memory_bytes: 41948
#include <bits/stdc++.h>
#define all(a) a.begin(), a.end()
using namespace std;

int H, W;

int main(){
  ios_base::sync_with_stdio(false); 
  cin >> H >> W;
  char a[H+2][W+2];
  memset(a, '#', sizeof(a));
  for(int i=1; i<=H; ++i)
    for(int j=1; j<=W; ++j)
      cin >> a[i][j];
  for(int i=0; i<=H+1; ++i){
    for(int j=0; j<=W+1; ++j)
      cout << a[i][j];
    cout << "\n";
  }
  /* if(H < W)
    swap(H, W);
  int ar = H*W;
  int res = 0;
  if(ar%3 != 0){
    
  }
  cout << res << "\n";
  */return 0;
}



Measured memory_bytes: 256
#include <stdio.h>

int main(void)
{
    int a[3],i,j,t;
    for(i=0;i<3;i++)scanf("%d",&a[i]);
    for(i=0;i<2;i++){
        for(j=2;j>i;j--){
            if(a[j]<a[j-1]){
                t=a[j];
                a[j]=a[j-1];
                a[j-1]=t;
            }
        }
    }
    printf("%d",a[2]-a[1]+a[1]-a[0]);
    return 0;
}

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

#ifdef LOCAL
#define eprintf(...) fprintf(stderr, __VA_ARGS__)
#else
#define eprintf(...) 42
#endif

#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define repi(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define all(x) (x).begin(),(x).end()
#define foreach(u,v) for(auto (u) : (v))
#define pb push_back
#define mp make_pair
#define mt make_tuple

typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<ll, ll> pll;
typedef vector<ll> vl;

const int inf = 1e9;
const ll linf = 1LL<<60;
const ll mod = 1e9 + 7;
const double eps = 1e-9;

/*
 */

int y, m, d;

bool check()
{
  if(y < 2019) return true;
  else if(y > 2019) return false;
  if(m < 4) return true;
  else if(m > 4) return false;
  if(d <= 30) return true;
  return false;
}

int main()
{
  scanf("%d/%d/%d", &y, &m, &d);

  cout << (check() ? "Heisei" : "TBD") << endl;

  return 0;
}


Measured memory_bytes: 256
s = input().strip()
words = ["dream", "dreamer", "erase", "eraser"]
i = len(s)
while i > 0:
    b = False
    for w in words:
        if w == s[i-len(w):i]:
            b = True
            i -= len(w)
            break
    if not b:
        break

print("YES" if i == 0 else "NO")


Measured memory_bytes: 40432
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < n; i++)
#define INF 1001001001
#define LINF (1LL << 62)
using namespace std;
using ll = long long;
using P = pair<int, int>;

void solv() {
    string s;
    cin >> s;
    int Q;
    cin >> Q;
    bool isReverse = false;
    rep(i, Q) {
        int T;
        cin >> T;
        if (T == 1) {
            isReverse = !isReverse;
        }
        if (T == 2) {
            int F;
            string C;
            cin >> F >> C;
            if (isReverse == false) {
                if (F == 1) {
                    s.insert(0, C);
                } else {
                    s.push_back(C[0]);
                }
            } else {
                if (F == 1) {
                    s.push_back(C[0]);
                } else {
                    s.insert(0, C);
                }
            }
        }
    }
    if (isReverse == true)
        reverse(s.begin(), s.end());
    rep(i, s.size()) {
        printf("%c", s.at(i));
    }
    cout << endl;
}

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

Measured memory_bytes: 900
#import pysnooper
#import numpy
#import os,re,sys,operator
#from collections import Counter,deque
#from operator import itemgetter,mul
#from itertools import accumulate,combinations,groupby,combinations_with_replacement,permutations
from sys import stdin,setrecursionlimit
#from bisect import bisect_left,bisect_right
#from copy import deepcopy
#import heapq
#import math
#import string
#from time import time
#from functools import lru_cache,reduce
#from math import factorial,hypot
#import sys
#from fractions import gcd
setrecursionlimit(10**6+1)
input=stdin.readline

n=int(input().rstrip())
a=[int(i) for i in input().split()]
ans=[0]*n
for i in a:
    ans[i-1]+=1
print(*ans,sep="\n")

Measured memory_bytes: 31104
#include<bits/stdc++.h>
using namespace std;
inline int read(){
	char c=getchar();int t=0,f=1;
	while(!isdigit(c)){if(c=='-')f=-1;c=getchar();}
	while(isdigit(c)){t=(t<<3)+(t<<1)+(c^48);c=getchar();}
	return t*f;
}
int a,b;
int main(){
	a=read(),b=read();
	int alfa=(a+b)/2;
	if(abs(alfa-a)==abs(alfa-b))
	printf("%d\n",alfa);
	else puts("IMPOSSIBLE");
	return 0;
}


Measured memory_bytes: 256