akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
int main(){
    
    int n;
    int a[100];
    
    cin>>n;
    
    for(int i=0; i<n; i++) cin>>a[i];
    
    
    for( int i=0; i< n-1-i; i++) swap(a[i],a[n-1-i]);
    
    
    for( int i=0; i<n; i++){
        if(i) cout<<" ";
        cout<<a[i];
    }
    
    cout<<endl;
    
    return 0;
}



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

#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define Task ""

using namespace std;
typedef long long ll;

const int mod = 1e9 + 7;
const int maxn = 1e5 + 5;

signed main(void)
{
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    if (fopen("A.INP", "r")){
        freopen("A.INP", "r", stdin);
        freopen("A.OUT", "w", stdout);
    }
    if (fopen(Task".INP", "r")){
        freopen(Task".INP", "r", stdin);
        freopen(Task".OUT", "w", stdout);
    }
    int x, y;
    cin >> x >> y;
    if (x % y == 0){
        cout << -1;
        return 0;
    }
    cout << x;
}


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

public class Main {
	public static void main(String[] args) {
		final Scanner sc = new Scanner(System.in);
		int a = sc.nextInt(), b = sc.nextInt(), c = sc.nextInt();
		int[] arr = { a, b, c };
		Arrays.sort(arr);
		int diff1 = arr[2] - arr[0];
		int diff2 = arr[2] - arr[1];
//		System.out.println(diff1);
//		System.out.println(diff2);
		if (diff1 % 2 == 0 && diff2 % 2 == 0) {
			System.out.println((diff1 + diff2) / 2);
		} else if(diff1 % 2 == 1 && diff2 % 2 == 1) {
			System.out.println((diff1+diff2) / 2);
		} else {
			if(diff1 % 2 == 0) {
				long ans = diff1 / 2 + (diff2 + 1) / 2 + 1;
				System.out.println(ans);
			} else {
				long ans = diff2 / 2 + (diff1 + 1) / 2 + 1;
				System.out.println(ans);
			}
		}
	}
}

Measured memory_bytes: 22996
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<map>
#include<cstring>
using namespace std;

#define rep(i,n) for(int i=0;i<n;i++)
#define REP(n) rep(i,n)
#define all(n) n.begin(),n.end()

int main()
{
    long long n;
    while(cin >> n && n)
    {
        string ans = "";
        int rest;
        while(n)
        {
            rest = (int)(n % 8);

            if(rest==0) ans = "0" + ans;
            if(rest==1) ans = "1" + ans;
            if(rest==2) ans = "2" + ans;
            if(rest==3) ans = "3" + ans;
            if(rest==4) ans = "5" + ans;
            if(rest==5) ans = "7" + ans;
            if(rest==6) ans = "8" + ans;
            if(rest==7) ans = "9" + ans;

            n /= 8;
        }
        cout << ans << endl;

    }
    return 0;
}

Measured memory_bytes: 916
#include <bits/stdc++.h>
#define repr(i,a,b) for(int i=a;i<b;i++)
#define rep(i,n) for(int i=0;i<n;i++)
#define reprrev(i,a,b) for(int i=b-1;i>=a;i--) // [a, b)
#define reprev(i,n) reprrev(i,0,n)

                    
using ll = long long;
using ull = unsigned long long;
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; }
const ll mod = 1e9+7;
void chmod(ll &M){
  if(M >= mod) M %= mod;
  else if(M < 0){
     M += (abs(M)/mod + 1)*mod;
    M %= mod;
}
}
ll modpow(ll x, ll n){
   if(n==0) return 1;
  ll res=modpow(x, n/2);
 if(n%2==0) return res*res%mod;
else return res*res%mod*x%mod;
}
int getl(int i, int N) { return i==0? N-1:i-1; };
int getr(int i, int N) { return i==N-1? 0:i+1; };
long long GCD(long long a, long long b) {
  if (b == 0) return a;
  else return GCD(b, a % b);
}

using namespace std;
/* <-----------------------------------------------------------------------------------> */
/* <-----------------------------------------------------------------------------------> */
/* <-----------------------------------------------------------------------------------> */
/* <-----------------------------------------------------------------------------------> */
int main()
{
    string S;
    cin >> S;
    if(S=="SUN") cout << 7 << endl;
    if(S=="MON") cout << 6 << endl;
    if(S=="TUE") cout << 5 << endl;
    if(S=="WED") cout << 4 << endl;
    if(S=="THU") cout << 3 << endl;
    if(S=="FRI") cout << 2 << endl;
    if(S=="SAT") cout << 1 << endl;
}   

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

int main() {
  int i,j;
  cin >> i >> j;
  vector<string> str(i);
  
  for(int l=0;l<i;l++) {
    cin >> str.at(l);
  }
  for(int l=0;l<j+2;l++) {
    cout << "#";
  }
  cout << endl;
  
  for(int l=0;l<i;l++) {
    cout << "#" << str.at(l) << "#" << endl;
  }
  
  for(int l=0;l<j+2;l++) {
    cout << "#";
  }
  cout << endl;
}
  


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long
using namespace std;
#define maxn 500010
#define mod 1000000007

int main(){
    int m,d;
    cin>>m>>d;
    int ans=0;
    for(int i=1;i<=m;i++){
        for(int j=10;j<=d;j++){
            int d1=j/10,d2=j%10;
            if(d1>=2&&d2>=2&&d1*d2==i){
                //cout<<i<<' '<<j<<endl;
                ans++;
            }
        }
    }
    cout<<ans;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
// a^n mod を計算する
long long modpow(long long a, long long n, long long mod) {
    long long res = 1;
    while(n > 0) {
        if(n & 1)
            res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}
int main() {
    long long ans = 0;
    long long mod = 1000000007;
    int N;
    cin >> N;
    vector<long long> A(N);
    for(int i = 0; i < N; i++) {
        cin >> A.at(i);
    }
    map<int, long long> pow2{};
    for(long long a : A) {
        int i = 0;
        while(a > 0) {
            if(a & 1)
                pow2[i]++;
            a /= 2;
            i++;
        }
    }
    for(auto itr = pow2.begin(); itr != pow2.end(); ++itr) {
        ans = (ans + modpow(2, itr->first, mod) *
                         (itr->second * (N - itr->second) % mod) % mod) %
              mod;
    }

    cout << ans << endl;
}

Measured memory_bytes: 2560
#include <stdio.h>

int d;

int abs(int a)
{
  return a < 0 ? -a : a;
}

int talkable(int a, int b)
{
  return  abs(a-b) <= d ? 1 : 0;
}

int main(void)
{
  int a, b, c;
  scanf("%d%d%d%d", &a, &b, &c, &d);
  printf("%s\n", talkable(a, c) || talkable(a, b) && talkable(b, c) ? "Yes" : "No");
}


Measured memory_bytes: 128
MOD = 998244353

n, m, k = map(int, input().split())

fact = [0 for _ in range(n)]
invfact = [0 for _ in range(n)]
fact[0] = 1
for i in range(1, n):
    fact[i] = fact[i - 1] * i % MOD

invfact[n - 1] = pow(fact[n - 1], MOD - 2, MOD)

for i in range(n - 2, -1, -1):
    invfact[i] = invfact[i + 1] * (i + 1) % MOD
def nCk(n, k):
    if k < 0 or n < k:
        return 0
    else:
        return fact[n] * invfact[k] * invfact[n - k] % MOD
        
ans = 0
for i in range(0, k + 1):
    ans += m * pow(m - 1, n - i - 1, MOD) * nCk(n - 1, i) % MOD
    
print(ans % MOD)

Measured memory_bytes: 24692
// clang-format off
#include <bits/stdc++.h>
#define int long long
#define main signed main()
// #define main int main()
#define loop(i, a, n) for (int i = (a); i < (n); i++)
#define rep(i, n) loop(i, 0, n)
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define prec(n) fixed << setprecision(n)
#define stlice(from, to) substr(from, (to) - (from) + 1)
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define fi first
#define se second
using namespace std;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<double> vd;
typedef vector<char> vc;
typedef vector<bool> vb;
typedef vector<string> vs;
typedef vector<pii> vpii;
typedef vector<vi> vvi;
typedef vector<vb> vvb;
typedef vector<vpii> vvpii;
const int INF = sizeof(int) == sizeof(long long) ? 1000000000000000000LL : 1000000000;
const int MOD = 1000000007;
const double PI = acos(-1);
template<typename A, typename B> bool cmin(A &a, const B &b) { return a > b ? (a = b, true) : false; }
template<typename A, typename B> bool cmax(A &a, const B &b) { return a < b ? (a = b, true) : false; }
bool odd(const int &n) { return n & 1; }
bool even(const int &n) { return !odd(n); }
void solve();
main { solve(); return 0; }
// clang-format on

void solve() {
  int n, m, t;
  cin >> n >> m >> t;
  vi cannotStudy(t + 1);
  while (n--) {
    int a;
    cin >> a;
    for (int i = a - m; i <= a + m; i++) {
      if (i < cannotStudy.size()) cannotStudy[i] = 1;
    }
  }
  int c = 0;
  loop(i, 1, cannotStudy.size()) c += !(cannotStudy[i - 1] && cannotStudy[i]);
  cout << c << endl;
}

Measured memory_bytes: 3136
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#include<cstdlib>
#include<queue>
#include<set>
#include<cstdio>

using namespace std;

#define ll long long
#define rep(i, n) for(int i = 0; i < n; i++)
#define P pair<int, int>

typedef vector<int> vec;
typedef vector<vec> mat;


int const MAX_N = 200000;
int par[MAX_N]; // 親
int depth[MAX_N]; // 木の深さ
int num[MAX_N]; // 要素数

// n要素で初期化
void init(int n){
    for(int i = 0; i < n; i++){
        par[i] = i;
        depth[i] = 0;
        num[i] = 1;
    }
}

// 木の根を求める
int find(int x){
    if (par[x] == x) {
        return x;
    }else{
        return par[x] = find(par[x]);
    }
}

// xとyの属する集合を合併
void unite(int x, int y){
    x = find(x);
    y = find(y);
    if (x == y) return;

    if (depth[x] < depth[y]) {
        par[x] = y;
        num[y] +=  num[x];
    }else{
        par[y] = x;
        num[x] += num[y];
        if (depth[x] == depth[y]) depth[x]++;
    }
}

// xとyが同じ集合に属するか否か
bool same(int x, int y){
    return find(x) == find(y);
}


int main(){
    int n, m;
    cin >> n >> m;
    int a[m], b[m];
    rep(i, m){
        cin >> a[i] >> b[i];
        a[i]--; b[i]--;
    }
    init(n);
    rep(i, m){
        unite(a[i], b[i]);
    }
    int ans = 0;
    rep(i, n) ans = max(ans, num[i]);
    cout << ans << endl;
}

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

using namespace std;

int main()
{
    int n;
    cin>>n;
    float a;
    vector<float>v;
    for(int i=0;i<n;i++)
    {
        cin>>a;
        v.push_back(a);
    }
    float sum=0;
    for(auto i:v)
    {
        sum+=i;
    }
    float avg=sum/(float)n;
    for(int i=0;i<n;i++)
    {
        v[i]=fabs(v[i]-avg);
    }
    float y=*min_element(v.begin(),v.end());
    auto it=find(v.begin(),v.end(),y);
    cout<<distance(v.begin(),it)<<endl;
return 0;
}


Measured memory_bytes: 256
#include<iostream>

using namespace std;

int n,k;
int check(long long p,int A[]){
    int i=0;
    for(int j=0;j<k;j++){
       long long s=0;
       while(s+A[i]<=p ){
       		s+=A[i++];
       		if(i==n)return n;
       }
       
    }
    return i;
}
int main(){
	
	cin>>n>>k;
	int *A=new int[n];
	int sum=0;
    for(int i=0;i<n;++i){
    	cin>>A[i];
    	sum+=A[i];
    }
    int left=sum/k-1,right=sum;
    int mid;
    while(right>left+1){
       mid=(left+right)/2;
       int v=check(mid,A);
       if(v>=n)right=mid;
       else left=mid;
    }
    cout<<right<<endl;
    
	delete A;
	return 0;

}


Measured memory_bytes: 3128
#include <iostream>

using namespace std;

int main() {
  string s;
  cin >> s;

  if (s[0] != 'A') {
    cout << "WA" << endl;
    return 0;
  }

  if (65 <= (int)s[1] && (int)s[1] <= 90) {
    cout << "WA" << endl;
    return 0;
  }

  if (65 <= (int)s[s.length() - 1] && (int)s[s.length() - 1] <= 90) {
    cout << "WA" << endl;
    return 0;
  }

  bool flg = false;
  for (int i = 2; i < s.length() - 1; i++) {
    if (65 <= (int)s[i] && (int)s[i] <= 90 && s[i] != 'C') {
      cout << "WA" << endl;
      return 0;
    }
    if (flg && s[i] == 'C') {
      cout << "WA" << endl;
      return 0;
    }
    if (!flg && s[i] == 'C') {
      flg = true;
    }
  }

  if (flg) {
    cout << "AC" << endl;
  } else {
    cout << "WA" << endl;
  }

  return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <iostream>
using namespace std;
int main() {
    int t; scanf("%d",&t);
    for (int ix=0; ix<t; ix++) {
        string str; cin>>str;
        string res="", temp="";
        res+=str[0];
        int pos=0;
        for (int i=1; i<str.length(); i++) {
            if (str[i]!='-'&&str[i]!='>'&&str[i]!='<') {
                if (temp=="->") {
                    pos++;
                    if (res.length()==pos) res+=str[i];
                    else if (res[pos]!=str[i]) {
                        res+='x';
                        for (int j=res.length()-1; j>pos; j--) {
                            res[j]=res[j-1];
                        }
                        res[pos]=str[i];
                    }
                } else {
                    pos--;
                    if (pos==-1) {
                        res=str[i]+res;
                        pos=0;
                    } else if (res[pos]!=str[i]) {
                        res='x'+res;
                        for (int j=0; j<pos; j++) {
                            res[j]=res[j+1];
                        }
                        res[pos]=str[i];
                    }
                }
                temp="";
            } else temp+=str[i];
        }
        cout<<res<<endl;
    }
}

Measured memory_bytes: 0
#include<cstdio>
#include<cstring>
#define retrun return
#define cpnst const
int n,k;
char str[1111];
typedef long long ll;
cpnst ll mod=1e9+7;
ll C[1111][1111],fac[1111];
void precalc()
{
	register int i,ii;
	C[0][0]=1;
	for(i=fac[0]=1;i<=1000;i++)fac[i]=fac[i-1]*i%mod,C[i][0]=C[i][i]=1;
	for(i=1;i<=1000;i++)
		for(ii=1;ii<i;ii++)C[i][ii]=(C[i-1][ii-1]+C[i-1][ii])%mod;
}
ll ans=0;
int siz[1111];
bool vis[1111];
bool eraser()
{for(register int i=1;i<=k;i++)if(!vis[i])if(str[i]=='r')return vis[i]=1;return 0;}
void cover(register int p,int s)
{for(;s;p++)if(!vis[p])vis[p]=1,s--;}
bool elim(int ss)
{
	int R=0;
	int ff=0;
	for(register int i=k;i;i--)
	{
		if(!vis[i])R++;
		if(R>=ss-1)if(!vis[i])if(str[i]=='b')ff=i;
		if(ff)if(!vis[i])if(str[i]=='r')return cover(ff,ss-1),vis[i]=1;
	}return 0;
}
int locatr(int x)
{while(x<=k&&(str[x]!='r'||vis[x]))x++;return x;}
int locatb(int x)
{while(x<=k&&(str[x]!='b'||vis[x]))x++;return x;}
int Rs[11111];
bool valid(int T)
{
	if(!T)return 1;
	register int i;
	for(i=1;i<=k+1;i++)vis[i]=0,Rs[i]=0;
	int cc=0;
	for(i=T;i;i--)
		if(siz[i]>1)cc++;
	int x=locatr(1),y=locatb(x);
	for(i=1;i<=cc;i++)
	{
		if(y==k+1)return 0;
		vis[x]=1,vis[y]=1,Rs[y+1]+=siz[i]-2,x=locatr(x+1),y=locatb(y+1);
		if(y<x)y=locatb(x);
	}for(i=1;i<=T;i++)
		if(siz[i]==1)
			if(!eraser())return 0;
	int ss=0,EE=0;
	for(i=k+1;i;i--)
	{
		ss+=Rs[i];
		if(ss>EE)return 0;
		EE+=!vis[i-1];
	}return 1;
}
ll concen(int T)
{
	register int i,ii;
	ll ret=1,G=T;
	for(i=1;i<=T;i=ii+1)
	{
		for(ii=i;ii<T&&siz[ii]==siz[ii+1];ii++);
		(ret*=C[G][ii-i+1])%=mod,G-=ii-i+1;
	}return ret;
}
ll solve(int T,int res)
{
	if(!T)return 1;
	register int i;
	ll SS=T+1;
	for(i=1;i<=T;i++)SS+=2*siz[i]-1;
	return C[SS+res-1][res]*concen(T);
}
void dfs(int dep=1,int prev=k,int sum=0)
{
	if(sum>n)return;
	if(!valid(dep-1))return;
	(ans+=solve(dep-1,n-sum))%=mod;
	register int i;
	if(dep^1)sum++;
	for(i=prev;i;i--)siz[dep]=i,dfs(dep+1,i,sum+(i<<1)-3+(i==1)*2);
}
int main()
{precalc(),scanf("%d%d%s",&n,&k,str+1),dfs(),printf("%lld\n",ans);}
/*
Just go for it.
*/

Measured memory_bytes: 9064
import java.security.KeyStore.Entry;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Scanner;

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

	void run() {
		Scanner sc = new Scanner(System.in);
		HashMap<Long, Long> map = new HashMap<>();
		int N = sc.nextInt();
		for (int i = 0; i < N; ++i) {
			char[] cs = sc.next().toCharArray();
			int[] a = new int[cs.length];
			for (int j = 0; j < a.length; ++j)
				a[j] = cs[j] - 'a';
			Arrays.sort(a);
			long add = 0;
			for (int j = 0; j < a.length; ++j) {
				add = add * 26 + a[j];
			}
			if (map.containsKey(add)) {
				map.put(add, map.get(add) + 1);
			} else {
				map.put(add, (long) 1);
			}
		}
		long ans = 0;
		for (java.util.Map.Entry<Long, Long> entry : map.entrySet()) {
			long v = entry.getValue();
			ans += v * (v - 1) / 2;
		}
		System.out.println(ans);
	}

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


Measured memory_bytes: 55448
#include<iostream>
#include<stdio.h>
//#include <bits/stdc++.h>
#include<vector>
#include<float.h>
#include<iomanip>
#include<algorithm>
#include<string>
#include<cstring>
#include<math.h>
#include<cmath>
#include<sstream>
#include<set>
#include<map>
#include<queue>
#include <cassert>
#include <cmath>
#include<cstdint>


#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++)
#define VEC(type, c, n) std::vector<type> c(n);for(auto& i:c)std::cin>>i;
#define vec(type,n) vector<type>(n)
#define vvec(m,n) vector<vector<int>> (int(m),vector<int>(n))
#define ALL(a)  (a).begin(),(a).end()

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

vector<int>bitSearch(int bit,int n){
    vector<int>S,False(1,-1);
    rep(i,n)if(bit&(1<<i))S.push_back(i);
    return S;
}

template<typename A,size_t N,typename T>
void Fill(A(&array)[N],const T &val){
    fill((T*)array,(T*)(array+N),val);
}


int main(){
    string s;
    cin >> s;
    vector<int>b, w;
    
    const int len = s.size();
    rep(i, len){
        if(s[i] == 'B') b.push_back(i);
        if(s[i] == 'W') w.push_back(i);
    }

    if(s.size() == 1 || b.empty() || w.empty()){
        cout << 0 << endl;
        return 0;
    }

    ll res = 0;
    int now = len - 1;

    for(auto x : b){
        res += now - x;
        now--;
    }
    
    cout << res << endl;
}

Measured memory_bytes: 1784
#include <stdio.h>
int main(void){
	int i,j,H,W;
	while(scanf("%d %d",&H,&W)!=EOF){
		if(H==0&&W==0){
			break;
		}
		for ( i = 0; i < H; i++ ){
			for ( j = 0; j < W; j++ ){
				if(j==0||j==W-1||i==0||i==H-1){
					printf("#");
				}
				else {
					printf(".");
				}
			}
			printf("\n");
		}
		printf("\n");
	}
	return(0);
}


Measured memory_bytes: 2052
# coding: utf-8
import sys
import itertools


def sr(): return sys.stdin.readline().rstrip()


def ir(): return int(sr())


def lr(): return list(map(int, sr().split()))


N, M = lr()
l_list = []
r_list = []
for i in range(M):
    l, r = lr()
    l_list.append(l)
    r_list.append(r)

# ans = set()
# left = l_list[M - 1]
# right = r_list[0]
tl_list = []
tr_list = []
for i in range(M):
    tmp_left = l_list[i]
    tmp_right = r_list[i]
    tl_list.append(tmp_left)
    tr_list.append(tmp_right)
left = max(tl_list)
right = min(tr_list)
# cards = sorted(l_list[i:] + r_list[:i + 1])
# cards = set(range(cards[0], cards[-1] + 1, 1))
# if (len(ans) == 0):
#     ans = cards
#     continue

# ans = cards & ans

ans = right - left + 1
if ans <= 0:
    print(0)
else:
    print(ans)


Measured memory_bytes: 12656
#include <iostream>
    #include<cmath>
    #include<string>
    using namespace std;
    int main()
    {
      
      long long int a,b;
      char op;
      cin>>a>>op>>b;
      if(op=='+')
        cout<<a+b;
      else
        cout<<a-b;

    return 0;
    }

Measured memory_bytes: 3624
// Problem : C - Sqrt Inequality
// Contest : Panasonic Programming Contest 2020
// URL : https://atcoder.jp/contests/panasonic2020/tasks/panasonic2020_c
// Memory Limit : 1024 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cp-editor)

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> // Common file
#include <ext/pb_ds/tree_policy.hpp> // Including tree_order_statistics_node_update

using namespace std;
using namespace __gnu_pbds;

typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update>
ordered_set;	

#define FOR(i,a,b) for(int i = (a); i <= (b); ++i)
#define FORD(i,a,b) for(int i = (a); i >= (b); --i)
#define RI(i,n) FOR(i,1,(n))
#define REP(i,n) FOR(i,0,(n)-1)
#define mini(a,b) a=min(a,b)
#define maxi(a,b) a=max(a,b)
#define mp make_pair
#define pb push_back
#define st first
#define nd second
#define sz(w) (int) w.size()
typedef vector<int> vi;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<pii, int> para;
const ll inf = 1e18 + 7;
const ll maxN = 1e6 + 5;
const ll MOD = 1e9 + 7;

ll a, b, c;
int main() {
	ios_base::sync_with_stdio(0);
	cin >> a >> b >> c;
	ld s = 2.0 * sqrt(a*b);
	ll p = (ll)s;
	//cout << p << " " << c - a - b << endl;
	if (p < c - a - b) {
		cout << "Yes\n";
	} else {
		if (p == c - a - b) {
			//cout << s * s << " " << p * p << " " << 4 * a * b << endl;
			if (p * p <= 4 * a * b) {
				cout << "No\n";
			} else {
				cout << "Yes\n";
			}
		} else cout << "No\n";
	}
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
#define pb emplace_back
#define ff first
#define ss second
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
#define quickio ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
const ll MOD = 1000000007;
ll power(ll x,ll y){ll R=1;x%=MOD;while(y>0){if(y&1)R=(R*x)%MOD;y=y>>1,x=(x*x)%MOD;}return R;}

int main() 
{
    vector<ll> v;
    ll ans= LLONG_MIN;
    for(int i=0; i<4;i++){
        int a;
        cin>>a;
        v.push_back(a);
    }
    for(int i=0; i<2;i++){
        for(int j=2;j<4;j++){
            ans=max(ans,v[i]*v[j]);
            
        }
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 3584
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, a, b) for (int i = a; i < b; i++)
int main()
{
    string s;
    cin >> s;
    int ans = 0;
    int cnt;
    rep(i, 0, s.length())
    {
        cnt = 0;
        rep(j, i, s.length())
        {
            if (s[j] == 'A' || s[j] == 'G' || s[j] == 'C' || s[j] == 'T')
            {
                cnt++;
            }
            else
            {
                break;
            }
        }
        ans = max(cnt, ans);
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3608
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <algorithm>
#include <cctype>
#include <cmath>
#include <queue>
#include <map>
#include <numeric>
#include <unordered_map>
#include <iomanip>
#include <functional>
#include <bitset>
#include <complex>
#include <stack>



#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define rrep(i, n) for(int i = (int)(n-1); i >= 0; i--)
#define repi(i,a,b) for(int i=int(a);i<int(b);i++)
#define all(x) (x).begin(),(x).end()

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

typedef long long ll;

using namespace std;
ll cal(ll a,ll b,ll c,ll d){
  return abs(a-c)+abs(b-d);
}

int main()
{
  ios::sync_with_stdio(false);
  cin.tie(0);
  ll k;cin>>k;
  ll x,y;cin>>x>>y;
  ll p=1,q=1;
  if(x!=0)p=x/abs(x);
  if(y!=0)q=y/abs(y);
  x=abs(x);
  y=abs(y);
  if(k%2==0&&(x+y)%2!=k%2){
    cout<<-1<<endl;
    return 0;
  }
  vector<ll>rx,ry;
  if(cal(x,y,0,0)%k==0){
    ll tx=0,ty=0;
    while(tx+k<=x){
      tx+=k;
      rx.push_back(tx);
      ry.push_back(ty);
    }
    while(ty+k<=y){
      ty+=k;
      rx.push_back(tx);
      ry.push_back(ty);
    }
    if(tx!=x){
      rx.push_back(x);
      ry.push_back(y);
    }
    cout<<rx.size()<<endl;
    rep(i,rx.size()){
      cout<<p*rx[i]<<" "<<q*ry[i]<<endl;
    }
    return 0;
  }
  ll a;
  if(k%2){
    if((x+y)%k%2){
      a=(k-(x+y)%k)/2;
    }
    else{
      a=-(x+y)%k/2;
    }
  }
  else {
    a=(k-(x+y)%k)/2;
  }
  ll tx=-a;
  ll ty;
  if(a==0){
    ty=k;
  }
  else {
    ty=(k-abs(a))*a/abs(a);
  }

  if(k%2==0&&tx+ty==x+y){
    tx=tx-k/2;
    ty=ty-k/2;
  }
  if((x>y)^(tx>ty)){
    //cout<<"swap"<<endl;
    swap(tx,ty);
  }
  rx.push_back(tx);
  ry.push_back(ty);
  while(abs(x-tx)>=k){
    tx+=k*((x-tx)/abs(x-tx));
    rx.push_back(tx);
    ry.push_back(ty);
  }
  while(abs(y-ty)>=k){
    ty+=k*((y-ty)/abs(y-ty));
    rx.push_back(tx);
    ry.push_back(ty);
  }
  if(tx!=x) {
    ty+=(k-abs(x-tx))*(x-tx)/abs(x-tx);
    tx=x;
    rx.push_back(tx);
    ry.push_back(ty);
  }
  if(ty!=y){
    rx.push_back(x);
    ry.push_back(y);
  }
  cout<<rx.size()<<endl;
  rep(i,rx.size()){
    cout<<p*rx[i]<<" "<<q*ry[i]<<endl;
  }
  return 0;

}


Measured memory_bytes: 5604
#pragma GCC optimize ("O3")
#pragma GCC target ("avx")

#include <bits/stdc++.h>
using namespace std;
using LL = long long int;
#define incID(i, l, r) for(int i = (l)    ; i <  (r); ++i)
#define decID(i, l, r) for(int i = (r) - 1; i >= (l); --i)
#define incII(i, l, r) for(int i = (l)    ; i <= (r); ++i)
#define decII(i, l, r) for(int i = (r)    ; i >= (l); --i)
#define inc(i, n)  incID(i, 0, n)
#define dec(i, n)  decID(i, 0, n)
#define inc1(i, n) incII(i, 1, n)
#define dec1(i, n) decII(i, 1, n)
#define inID(v, l, r) ((l) <= (v) && (v) <  (r))
#define inII(v, l, r) ((l) <= (v) && (v) <= (r))
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define MT make_tuple
#define FI first
#define SE second
#define FR front()
#define BA back()
#define ALL(v) v.begin(), v.end()
#define RALL(v) v.rbegin(), v.rend()
auto setmin   = [](auto & a, auto b) { return (b <  a ? a = b, true : false); };
auto setmax   = [](auto & a, auto b) { return (b >  a ? a = b, true : false); };
auto setmineq = [](auto & a, auto b) { return (b <= a ? a = b, true : false); };
auto setmaxeq = [](auto & a, auto b) { return (b >= a ? a = b, true : false); };
#define SI(v) static_cast<int>(v.size())
#define RF(e, v) for(auto & e: v)
#define until(e) while(! (e))
#define if_not(e) if(! (e))
#define ef else if
#define UR assert(false)
#define IN(T, ...) T __VA_ARGS__; IN_(__VA_ARGS__);
void IN_() { };
template<typename T, typename ... U> void IN_(T &  a, U &  ... b) { cin >> a; IN_(b ...); };
template<typename T                > void OUT(T && a            ) { cout << a << endl; }
template<typename T, typename ... U> void OUT(T && a, U && ... b) { cout << a << " "; OUT(b ...); }

// ---- ----

const int L =   2'500;
const int K = 500'000 / L;
int A1[L], B1[L], am, bm, ac, bc, mi, sum;
pair<int, int> A2[K], B2[K];
int main() {
	until(getchar_unlocked() == '\n') { }
	while(true) {
		char c = getchar_unlocked();
		if(c == '(' || c == ')') {
			sum += (c == '(' ? +1 : -1);
			setmin(mi, sum);
		} else {
			int a = -mi, b = sum - mi;
			if(a <= b) { if(a < L) { A1[a] += sum; setmax(am, a + 1); } else { A2[ac++] = { a, sum }; } }
			else       { if(b < L) { B1[b] += sum; setmax(bm, b + 1); } else { B2[bc++] = { b, sum }; } }
			mi = 0, sum = 0;
			if(c == EOF) { break; }
		}
	}
	sort(A2, A2 + ac);
	sort(B2, B2 + bc);
	inc(i, am) {
		setmin(mi, sum - i);
		sum += A1[i];
	}
	inc(z, ac) { auto [i, Ai] = A2[z];
		setmin(mi, sum - i);
		sum += Ai;
	}
	dec(z, bc) { auto [i, Bi] = B2[z];
		sum += Bi;
		setmin(mi, sum - i);
	}
	dec(i, bm) {
		sum += B1[i];
		setmin(mi, sum - i);
	}
	puts(mi >= 0 && sum == 0 ? "Yes" : "No");
}


Measured memory_bytes: 3684
#include <bits/stdc++.h>
#define int long long
typedef long long ll;
using namespace std;

const ll MAXN = 200000;
const ll INF = 1001001001;

ll A, B;
char ans[100][100];

signed main(){
    cin >> A >> B;
    for(int i=0;i<100;i++) {
        for(int j=0;j<100;j++) {
            if(i<50) ans[i][j] = '#';
            else ans[i][j] = '.';
        }
    }
    ll cta=0, ctb=0;
    for(int i=0;i<50;i+=2) {
        for(int j=0;j<50;j+=2) {
            if(cta==A-1) break;
            ans[i][j] = '.';
            cta++;
        }
    }
    for(int i=0;i<50;i+=2) {
        for(int j=0;j<50;j+=2) {
            if(ctb==B-1) break;
            ans[99-i][99-j] = '#';
            ctb++;
        }
    }    
    cout << 100 << " " << 100 << endl;
    for(int i=0;i<100;i++) {
        for(int j=0;j<100;j++) {
            cout << ans[i][j];
        }
        cout << endl;
    }
    return 0;
}

Measured memory_bytes: 3640
#include <stdio.h>
int main(void)
{
    int n;
    long int yy;
    scanf("%d %ld",&n,&yy);
    yy=yy/1000;
    int z=0;
    int p=-1;
    int q=0;
    int au=yy-n;
    int j=0;
    while(j==0 && au>=9*(p+1))
    {
        p++;
        if((au-9*p)%4==0)
        {
            q=(au-9*p)/4;
            if((yy-10*p-5*q)>=0)j=1;
        }
    }
    if(j==0)printf("-1 -1 -1");
    else
    {
        z=yy-10*p-5*q;
        printf("%d %d %d",p,q,z);
    }
    //printf("%d",au);
}


Measured memory_bytes: 128
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Scanner;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author mikit
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        BCountingRoads solver = new BCountingRoads();
        solver.solve(1, in, out);
        out.close();
    }

    static class BCountingRoads {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            int n = in.nextInt(), m = in.nextInt();
            int[] ans = new int[n];
            for (int i = 0; i < 2 * m; i++) {
                ans[in.nextInt() - 1]++;
            }
            for (int a : ans) {
                out.println(a);
            }
        }

    }
}



Measured memory_bytes: 21844
#include<bits/stdc++.h>
using namespace std;
#define int long long
signed main(){
  int A,B;
  cin>>A>>B;
  int N=__gcd(A,B),j=1;
  for(int i=2;i*i<N;i++){
    if(N%i==0){
      for(;N%i==0;N/=i){}
      j++;
    }
  }
  if(N!=1)
    j++;
  cout<<j<<endl;
}

Measured memory_bytes: 3596
# 2019-11-25 22:51:53(JST)
import sys
from collections import Counter

MOD = 10 ** 9 + 7

def main():
    n, s = sys.stdin.read().split()
    n = int(n)
    
    res = 1
    for c in Counter(s).values():
        res = res * (c + 1) % MOD

    res = (res - 1) % MOD

    print(res) 

if __name__ == '__main__':
    main()


Measured memory_bytes: 3572
import bisect,collections,copy,heapq,itertools,math,string
from collections import defaultdict as D
from functools import reduce
import numpy as np
import sys
import os
from operator import mul

sys.setrecursionlimit(10**7)

def _S(): return sys.stdin.readline().rstrip()
def I(): return int(_S())
def LS(): return list(_S().split())
def LI(): return list(map(int,LS()))

if os.getenv("LOCAL"):
    inputFile = basename_without_ext = os.path.splitext(os.path.basename(__file__))[0]+'.txt'
    sys.stdin = open(inputFile, "r")
INF = float("inf")
IINF = 10 ** 18
MOD = 10 ** 9 + 7
# MOD = 998244353    

n = I()
a = LI()
b = LI()

ans = 0
m = 0
for i in range(n):
    if a[i]>=m:
        ans += m
        a[i] -= m
    else:
        ans += a[i]
        a[i]=0
    if a[i]>=b[i]:
        ans += b[i]
        m = 0
    else:
        ans += a[i]
        m = b[i] - a[i]
    # print(m,ans)
if a[n]>=m:
    ans +=m
else:
    ans +=a[n]
print(ans)

Measured memory_bytes: 43028
#include <algorithm>
#include <cassert>
#include <cmath>
#include <climits>
#include <cstdlib>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <string>
#include <vector>
#define DEBUG 1
constexpr int kMod = 1000000007;
typedef long long LL;

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

  int cnt = 1;
  int min; std::cin >> min;
  for (int i = 1; i < N; ++i) {
    int p; std::cin >> p;
    if (min >= p) {
      ++cnt;
      min = p;
    }
  }
  std::cout << cnt << std::endl;
}


Measured memory_bytes: 256
s = input()
date = s.split("/")

if int(date[0]) < 2019:
    print("Heisei")
elif int(date[0]) ==  2019 and int(date[1]) < 4:
    print("Heisei")
elif int(date[0]) ==  2019 and int(date[1]) == 4 and int(date[2]) <= 30:
    print("Heisei")
else:
    print("TBD")

Measured memory_bytes: 3060
#include<set>
#include<iostream>
#define F(A, B) for(int A=0; A<B; A++)
using namespace std;

int dia(int n, bool *used, int **e, int cur, int max){
	//bool end=true;
	//F(i, n){
	//	if(used[i] == false)end=false;
	//}
	//if(end == true){
	//	return max-d[cur-1];
	//}else{
	int Dia=max;
	F(i, n){
		if(e[cur][i] > 0 && used[i] == false){
			used[i] = true;
			int tmp = dia(n, used, e, i, max+e[cur][i]);
			used[i] = false;
			if(Dia < tmp)Dia=tmp;
		}
	}
	return Dia;
	//}
}


int main(){
	int n;

	cin >> n;
	while(n != 0){
		int *p=new int[n-1], *d=new int[n-1], **e=new int*[n], all=0;
		F(i, n)e[i] = new int[n];
		bool *used = new bool[n];
		set<int> pleaf;
		set<int> leaf;
		F(i, n)F(j, n)e[i][j]=0;

		F(i, n-1){
			cin >> p[i];
		}
		F(i, n-1){
			cin >> d[i];
			all += d[i];
		}
		F(i, n-1){
			e[i+1][p[i]-1] = d[i];
			e[p[i]-1][i+1] = d[i];
		}

		//F(i, n){
		//	F(j, n)cout << e[i][j] << ' ';
		//	cout << endl;
		//}	

		F(i, n){
			int pre=-1, cnt=0;
			F(j, n){
				if(e[i][j] > 0){
					cnt++;
					pre=j;
				}
			}
			if(cnt == 1){
				leaf.insert(i);
				pleaf.insert(pre);
			}
		}

		F(i, n)used[i]=false;

		int leafall=0;
		for(set<int>::iterator it=leaf.begin(); it!=leaf.end(); it++){
			F(i, n){
				leafall += e[(*it)][i];
			}
			used[(*it)] = true;
		}

		int diamax=0, tmp;
		for(set<int>::iterator it=pleaf.begin(); it!=pleaf.end(); it++){
			used[*it] = true;
			tmp = dia(n, used, e, *it, 0);
			used[*it] = false;
			if(diamax < tmp)diamax=tmp;
		}
		//cout << all << ' ' << diamax << ' ' << leafall << endl;
		//cout << *3-diamax-leafall*2 << endl;
		cout << leafall*1+diamax*2+(all-diamax-leafall)*3 << endl;
		delete p; delete d;
		F(i, n)delete e[i];
		delete e;
		delete used;

		cin >> n;
	}
}

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

int gcd(int x, int y) {return (y?gcd(y,x%y):x);}

int main() {
    int n;
    cin >> n;
    queue<int> q;
    rep(i,n) {
        int a;
        cin >> a;
        q.push(a);
    }
    while (q.size() != 1) {
        int a1 = q.front(); q.pop();
        int a2 = q.front(); q.pop();
        int x = gcd(a1, a2);
        q.push(x);
    }
    cout << q.front() << endl;

}

Measured memory_bytes: 640
#include <iostream>
#include <cstring>
#include <fstream>
#define rep(i,w) for(int i=0;i<(w);i++)

using namespace std;

char mat[100][100];
string dp[100][100];
int w, h;

string cmp (string s, string t )
{
	while (s[0] == '0' )
		s = s.substr (1 );
	while (t[0] == '0' )
		t = t.substr (1 );

	if (s.length() != t.length() )
		if ( s.length() < t.length() ) return t;
		else return s;

	int w = s.length();
	rep (i, w ){
		if (s[i] != t[i] )
			if (s[i] < t[i] ) return t;	
			else return s;
	} // end rep

	return s;
}

void calc_dp (void )
{
	if (isdigit (mat[0][0] ) )
		dp[0][0] += mat[0][0];

	for (int i = 1; i < h; i++ )
		if (isdigit (mat[i][0] ) ){
			dp[i][0] += dp[i-1][0];
			dp[i][0] += mat[i][0];
		} // end if
	for (int j = 1; j < w; j++ )
		if (isdigit (mat[0][j] ) ){
			dp[0][j] += dp[0][j-1];
			dp[0][j] += mat[0][j];
		} // end if

	for (int i = 1; i < h; i++ ){
		for (int j = 1; j < w; j++ ){
			if (isdigit (mat[i][j] ) ){
				dp[i][j] += cmp (dp[i-1][j], dp[i][j-1] );
				dp[i][j] += mat[i][j];
			} // end if
		} // end for
	} // end for
}

void init_val (void )
{
	memset (mat, 0, sizeof (mat ) );
	rep (i, 100 )
		rep (j, 100 )
			dp[i][j] = "";
}

int main()
{
	while (cin >> w >> h && w && h ){
		init_val();
		rep (i, h ){
			string str = "";
			cin >> str;
			rep (j, w ){
				mat[i][j] = (char)str[j];
			} // end rep
		} // end rep
		calc_dp ();
		string res = "";
		rep (i, h ){
			rep (j, w ){
				res = cmp (res, dp[i][j] );
			} // end rep
		} // end rep
		cout << res << endl;	
	} // end while
		
	return 0;
}

Measured memory_bytes: 0
use proconio::input;
use proconio::marker::Chars;
#[allow(unused_imports)]
use std::cmp::{max, min};
#[allow(unused)]
const ALPHA_SMALL: [char; 26] = [
    'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's',
    't', 'u', 'v', 'w', 'x', 'y', 'z',
];
#[allow(unused)]
const ALPHA: [char; 26] = [
    'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S',
    'T', 'U', 'V', 'W', 'X', 'Y', 'Z',
];
#[allow(unused)]
const N: usize = 1_000_000 + 10;
fn main() {
    input!(K: usize);
    if K % 2 == 0 || K % 5 == 0 {
        println!("-1");
        return;
    }

    let mut m = 7;
    let mut ans: usize = 1;
    for i in 0..N {
        if m % K == 0 {
            break;
        }
        ans += 1;
        m = 10 * m + 7;
        m %= K;
    }
    println!("{}", ans);
}


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

#define REP( i, n )     for( int (i) = 0; (i) < (n); (i)++ )
#define ALL( a )        (a).begin(), (a).end()

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

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

const int INF = 1e9;
const ll LINF = 1e18;
const int MOD = 1e9 + 7;

int main(){
    int N; cin >> N;
    map<int, int> mp;
    REP( i, N ){
        int a; cin >> a;
        mp[a]++;
    }

    vector<int> t;
    for( auto p : mp ){
        if( p.second >= 4 ) t.push_back( p.first );
        if( p.second >= 2 ) t.push_back( p.first );
    }

    sort( ALL( t ), greater<>() );

    if( t.size() >= 2 ) cout << (ll)t[0] * t[1] << endl;
    else cout << 0 << endl;
}


Measured memory_bytes: 4992
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <cmath>
#include <iomanip>
#include <algorithm>
using namespace std;

int main(){
    int n;
    cin >> n;
    vector<string> s;
    set<string> t;
    for(int i = 0; i < n; i++){
        string str;
        cin >> str;
        s.push_back(str);
        t.insert(str);
    }
    bool flag = true;
    for(int i = 1; i < n; i++){
        flag &= (s[i-1].at(s[i-1].size()-1) == s[i].at(0));
    }
    if(flag && n == t.size()){
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
    return 0;
}

Measured memory_bytes: 256
x,k,d=map(int,input().split())

ma=x+k*d
mi=x-k*d

if ma*mi>0:
    print(min(abs(ma),abs(mi)))
else:
    a=x%d
    b=a-d
    if (x//d)%2==k%2:
        print(abs(a))
    else:
        print(abs(b))

Measured memory_bytes: 9184
#include<iostream>
#include<string>
#include<cstdlib>
#define MAX 100000
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;

class Queue{
private:
  int inf[MAX];
  int head,tail;

public:

  Queue(){
    syokika();
  }

  void syokika(){
    head = 0;
    tail = 0;
  }

  void push(int x){
    inf[tail]=x;
    if(MAX == tail+1)tail = 0;
    else tail++;
  }

  void pop(){
    if(MAX == head+1)head=0;
    else head++;
  }

  int front(){
    return inf[head];
  }

  bool empty(){
    if(tail - head == 0)return true;
    else return false;
  }

  int size(){
    return tail - head;
  }

};


int main()
{
  Queue que;
  int n,q,a;
  string s[MAX];
  int st[MAX];

  cin >> n >> q;

  rep(i,n)st[i]=0;

  rep(i,n)
    {
      cin >> s[i] >> a;    
      que.push(a);
    }
  int index = 0,nowval,val=0;
  bool finished[n],end=true;
  rep(i,n)finished[i]=false;

  while(true){
    rep(i,n){
      if(!finished[i])
	{
	  end = false;
	  break;
	}
    }
    if(end)break;
    end = true;

    if(index == n)index = 0;    

    if(finished[index])
      {
	index++;
	continue;
      }

    nowval = que.front();      
    

    if(nowval-q<=0)
      {
	que.pop();
	val+=nowval;
	st[index]=val;
	finished[index]=true;
	cout  <<  s[index] << " " << st[index] << endl;
      }
    else
      {
	que.pop();  
	que.push(nowval-q);
	val+=q;
	st[index]=val;
      }

    
    index++;
  }



}

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

using namespace std;

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

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

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

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

    int N, H, W;
    std::cin >> N >> H >> W;

    int res = (N - (H - 1)) * (N - (W - 1));
    std::cout << res << std::endl;
}


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

using namespace std;

int main() {

	int n, k;
	cin >> n >> k;

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

	sort(a, a+n);

	int sum = 0;
	for(int i=0; i<k; i++) sum += a[i];

	cout << sum << '\n';

	return 0;
}

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

int main() {
    ll a, b, n;
    cin >> a >> b >> n;
    ll ans = 0;
    if (b - 1 <= n) {
        ans = a * (b - 1);
    } else {
        ans = a * (n == b ? n - 1 : n);
    }
    ans /= b;
    cout << ans << endl;
}

Measured memory_bytes: 3636
'use strict';
process.stdin.on('data', function(chunk) {
  var inputs = chunk.toString().trim().split('\n').map(Number);
  for (var i = 0; i < inputs.length; i++) {
    if(inputs[i]=== 0 ) {
        break;
    }
    console.log('Case '+ (i + 1)+ ': '+inputs[i]);
  }
   
});
process.stdin.resume();
process.stdin.setEncoding('utf8');

Measured memory_bytes: 20672
#include<bits/stdc++.h>
#define pb push_back
#define ppb pop_back
#define mer make_pair
#define fi first
#define se second
using namespace std;

int main(){
	//my new name is Veex
	//clock_t start1=clock();
	int a,b,c;
	cin>>a>>b>>c;
	int maxn=max(a,max(b,c));
	if(a==maxn&&b==maxn&&c==maxn){
		cout<<0;
		return 0;
	}
	for(int i=maxn;i<=maxn+1;i++){
		int sum=i*3-a-b-c;
		if(sum%2==0){
			cout<<sum/2;
		}
	}
	//((double)(clock()-start1)/CLOCKS_PER_SEC)*1000;
	return 0;
}


Measured memory_bytes: 256
// Author : Mahmoud Tarek

#include <bits/stdc++.h>

using namespace std ;

#define sz(v) (int)v.size()
#define ll long long
#define all(v)  v.begin() , v.end()
#define rall(v)  v.rbegin() , v.rend()
#define pf push_front
#define pb push_back
#define fast FastInputOutput() ;
#define Clear( container , value ) memset( container , value , sizeof container )
#define forn( t , v , be , n ) for( t v = be ; v < n ; v++ )
#define fore( x , j ) for( auto x : j )
#define debug(x , y) cerr << #x << " = " << x << y ;

const ll Long_max = numeric_limits < ll > :: max() ;
const int Int_max = numeric_limits < int > :: max() ;

void File_input( string pathIn ) {
    freopen( pathIn.c_str(), "r", stdin ) ;
}

void File_output( string pathOut ) {
    freopen( pathOut.c_str(), "w", stdout ) ;
}

void FastInputOutput() {
    ios_base :: sync_with_stdio( 0 ) ;
    cin.tie( 0 ) ;
    cout.tie( 0 ) ;
}

int a ;
string s ;

int main(){
 cin >> a >> s ;
 if( a >= 3200 ) cout << s ;
 else cout << "red" ;
 return 0 ;
}



Measured memory_bytes: 256
n,m = gets.split.map(&:to_i)

a = n.times.map{gets.chomp}
b = m.times.map{gets.chomp}

puts n.times.find{|y| n.times.find{|x| a[y,m].map{|a| a[x,m]} == b}} ? 'Yes' : 'No'


Measured memory_bytes: 2172
#include<bits/stdc++.h>
using namespace std;
deque<int> deq;
int main()
{
	int k;
	scanf("%d",&k);
	int dis[100005];
	memset(dis,0x3f3f3f3f3f,sizeof(dis));
	deq.push_front(1);
	dis[1] = 1;
	while(!deq.empty()){
		int x = deq.front();
		//cout<<x<<endl;
		deq.pop_front();
		if(dis[x * 10 % k] > dis[x]) dis[x * 10 % k] = dis[x],deq.push_front(x * 10 % k);
		if(dis[(x + 1) % k] > dis[x] + 1) dis[(x + 1) % k] = dis[x] + 1,deq.push_back((x + 1) % k);
	}
	cout<<dis[0]<<endl;
	return 0;
}

Measured memory_bytes: 896
#include <bits/stdc++.h>
#define ll long long
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define min_3(a,b,c) min(a,min(b,c))
#define max_3(a,b,c) max(a,max(b,c))
#define nout(ans) cout << (ans) << "\n"
#define sout(ans) cout << (ans) << " "
using namespace std;

const double pi = 3.14159265359;
const ll INF = 1e12;
const ll MOD = 1e9 + 7;
const ll N = 2e5 + 5; 
/*
Decimal Places: cout << fixed << setprecision(n) << ans << endl
*/

bool compare(const pair<int, int>&i, const pair<int, int>&j)
{
    return i.second < j.second;
}

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


int n, cnt=0, r=0, W=0,R=0, ans=0; char a[N];

void solve()
{
    cin >> n;
    priority_queue <int> q;
    for (int i=0; i<n; ++i) {
        cin >> a[i];
        if (a[i]=='R') q.push(i);
    }

    for (int i=0; i<n; ++i) {
        if (a[i]=='W') {
            if (!q.empty()) {
                if (q.top()<i) {
                    break;
                }
                a[q.top()]='W'; q.pop(); ans++; 
            }else {
                break;
            }
        }
    }nout(ans);
    
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL); cout.tie(NULL);
    int t = 1;
    //cin >> t;
    for (int i=1; i<=t; i++)
    {
        solve();
    }
    return 0;
}

Measured memory_bytes: 4600
#include <stdio.h>


int main(void) {
  char a[256];



  scanf("%s",&a[256] );

  if (a[256]=='A') {
    printf("T\n" );
  }
  if (a[256]=='T') {
    printf("A\n");
  }
  if (a[256]=='G') {
    printf("C\n");
  }
  if (a[256]=='C') {
    printf("G\n" );
  }

  return 0;
}

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

int main()
{
    long int x,i;
    cin>>x;
    for(i=1;i<=1e6;i++)
    {
        if((x*i)%360==0)
        break;
    }
    cout<<i<<endl;
	return 0;
}

Measured memory_bytes: 3592
#include <iostream>
#include <cmath>
#include <stdio.h>
using namespace std;

int bitxor(int z)
{
	int s = 0;
	for (int i = 0; i < 10; i++) {
		s += (1 & z);
		z /= 2;
	}
	return (s % 2);
}

int main()
{
	int n = 0, m = 0;
	int k[10] = { 0 }, s[10][10] = { 0 };
	int p[10] = { 0 };

	cin >> n >> m;
	for (int i = 0; i < m; i++) {
		cin >> k[i];
		for (int j = 0; j < k[i]; j++) {
			cin >> s[i][j];
		}
	}
	for (int i = 0; i < m; i++) {
		cin >> p[i];
	}

	int x, y[10] = { 0 };
	for (int i = 0; i < m; i++) {
		for (int j = 0; j < k[i]; j++) {
			y[i] += pow(2, s[i][j] - 1);
		}
	}

	int cnt = 0;
	for (int j = 0; j < pow(2, n); j++) {
		x = j;
		bool suc = true;
		for (int i = 0; i < m; i++) {	// 電球iについて
			int z = (x & y[i]);
			//printf("x:%x y[%d]:%x: z:%x XOR(z):%x p[%d]:%x\n", x, i, y[i], z, bitxor(z), i, p[i]);
			if (bitxor(z) != p[i]) {
				suc = false;
				break;
			}
		}

		if (suc) {
			cnt++;
		}
	}

	cout << cnt << endl;

	return 0;
}


Measured memory_bytes: 512
#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 x[] = {0, 2, 5, 5, 4, 5, 6, 3, 7, 6};

string max(string a, string b)
{
  if(a == "-1") return b;
  if(b == "-1") return a;

  int na = a.size();
  int nb = b.size();
  if(na == nb){
    rep(i, na){
      if(a[i] < b[i]) return b;
      else if(a[i] > b[i]) return a;
    }
  }else if(na < nb){
    return b; 
  }
  return a;
}

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

  vi a(m);
  rep(i, m) cin >> a[i];

  vector<string> dp(n+1, "-1");
  dp[n] = "";
  for(int i = n; i >= 0; i--){
    if(dp[i] == "-1") continue;
    rep(j, m){
      if(i-x[a[j]] >= 0){
        dp[i-x[a[j]]] = max(dp[i-x[a[j]]], dp[i]+to_string(a[j]));
      }
    }
  }

  cout << dp[0] << endl;

  return 0;
}



Measured memory_bytes: 33024