akhauriyash/Code-Regression huggingface dataset:
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import accumulate, permutations, combinations, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7
import numpy as np

x = INT()
print("ABC" if x < 1200 else "ARC")




Measured memory_bytes: 13584
from operator import itemgetter
from itertools import accumulate
 
n = int(input())
a = sorted((tuple(map(int, input().split())) for _ in range(n)),
           key=itemgetter(1))
c, d = (map(itemgetter(i), a) for i in (0, 1))
print('YNeos'[any(x > y for x, y in zip(accumulate(c), d))::2])

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

int main(){

    long long int L,R;
    cin >> L >> R;

    int m=2019;

    if(R-L>=2019){
        cout << 0 << endl;
        return 0;
    }else{
        int mod=2020;
        for(long long int i=L;i<R;i++){
            for(long long int j=i+1;j<=R;j++){
                mod=i*j%2019;
                m=min(mod,m);
            }
        }
    }

    cout << m << endl;
                
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef string str;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector <pii> vpii;
typedef vector <pll> vpll;
typedef map <str,int> mapsi;
typedef map <str,int> :: iterator mapsitr;
typedef map <int , int> mint;
typedef map <ll , ll> mll;
typedef set <int> si;
typedef set <ll> sll;
typedef si :: iterator sitr;
typedef si :: reverse_iterator rsitr;
typedef sll :: iterator sltr;
typedef sll :: reverse_iterator rsltr;
#define mset multiset
typedef mset <int> msi;
typedef mset <ll> msll;
typedef msi :: iterator msitr;
typedef msi :: reverse_iterator msritr;
typedef msll :: iterator msltr;
typedef msll :: reverse_iterator mslritr;
#define mp make_pair
#define pb push_back
#define pob pop_back
#define pf push_front
#define pof pop_front
#define fi first
#define se second
#define fs first.second
#define ss second.second
#define ff first.first
#define sf second.first
#define newl '\n'
char to_upper (char x){
    if( 97 <= int(x) && int(x) <= 126)return char(x-32);
    else if( 65 <= int(x) && int(x) <= 90)return x;
}
char to_lower (char x){
    if( 97 <= int(x) && int(x) <= 126)return x;
    else if( 65 <= int(x) && int(x) <= 90)return char(x+32);
}
int numerize (char x){
    if(48 <= int(x) && int(x) <= 57)return int(x-'0');
    else if( 97 <= int(x) && int(x) <= 126)return int(x-96);
    else if( 65 <= int(x) && int(x) <= 90)return int(x-64);
}
//void IO(){
//	#ifndef ONLINE_JUDGE
//	    freopen("input.txt", "r", stdin);
//	    freopen("output.txt", "w", stdout);
//	#endif
//}
// end of Template

ll n,k,s;
set <ll> z;
set <ll> :: iterator itr;
ll v[65000],memo[65000][102],ans;
ll md = 1000000007;
bool calc[65000][102];
ll dp (ll x, ll y){
    if(x==0)return 0;
    else if(y==0)return 1;
    else if(calc[x][y])return memo[x][y];
    else{
        ll p = s+1-x;
        ll sel = v[x] - v[x-1];
        ll a,b;
        a = dp(x-1,y);
        b = ((sel%md) * (dp(p,y-1)%md))%md;
        ll res = ((a%md) + (b%md))%md;
        calc[x][y] = true;
        memo[x][y] = res;
        return res;
    }
}
int main(){
	//IO();
//    ios_base::sync_with_stdio(false);
//    cin.tie(NULL);
    cin>>n>>k;
    for(ll i=1;i<=sqrt(n);i++){
        z.insert(i);
        z.insert(n/i);
    }
    int idx = 0;
    for(itr = z.begin(); itr != z.end(); itr++){
        idx ++;
        v[idx] = *itr;
    }
    s = idx;
    for(int i=1;i<=k;i++){
        for(int j=1;j<=s;j++){
            ans = dp(j,i);
        }
    }
    cout<<ans<<newl;
}



Measured memory_bytes: 61056
import java.util.Scanner;

public class Main{

	public static void main(String args[]){
		Scanner scan = new Scanner(System.in);
		String S = scan.next();
		int Slong = S.length();

        StringBuffer str = new StringBuffer(S);
        String R = str.reverse().toString();

		String result = "No";

        if(S.equals(R)) {
        	String S2 = S.substring(0,(Slong-1)/2);
        	StringBuffer str2 =  new StringBuffer(S2);
            String R2 = str2.reverse().toString();
        	if(S2.equals(R2)) {
            	String S3 = S.substring((Slong+3)/2-1,Slong);
            	StringBuffer str3 =  new StringBuffer(S3);
                String R3 = str3.reverse().toString();
        		if(S3.equals(R3)) {
        			result="Yes";
        		}
        	}
        }

		System.out.println(result);
	}
}

Measured memory_bytes: 23764
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)  
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define RVSORT(v) sort(v.rbegin(), v.rend());
#define ll long long
#define pb(a) push_back(a)
#define INF 999999999
#define MOD 1000000007
using namespace std;
typedef pair<int, int> P;
typedef pair<ll, ll> LP;
typedef pair<int, P> PP;
typedef pair<ll, LP> LPP;

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

int gcd(int a,int b){return b?gcd(b,a%b):a;}

ll modpow(ll n,ll k){
  if(k == 1){
    return n;
  }else if(k == 0){
    return 1;
  }else if(k%2==0){
    ll memo = modpow(n,k/2)%MOD;
    return memo*memo%MOD;
  }else{
    return n * modpow(n,k-1)%MOD;
  }
}

int main(){

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

  cout<<min(n*a,b)<<endl;

 

  return 0;
}

Measured memory_bytes: 256
import math
(n, m) = list(map(int, input().split()))
sub = abs(n - m)
if sub > 1:
    print(0)
elif sub == 1:
    print((math.factorial(n) * math.factorial(m)) % 1000000007)
else:
    print((math.factorial(n) * math.factorial(m)) * 2 % 1000000007)

Measured memory_bytes: 5184
import java.util.*;

class Main{
	public static void main(String[] args){
    	Scanner sc = new Scanner(System.in);
      String S = sc.next();
      String T = sc.next();
      
      //末尾から1文字分を削除
      String T_S = T.substring(0, T.length()-1);
      
      if ( S.equals(T_S))
        System.out.println("Yes");
      else
        System.out.println("No");
    }
}

Measured memory_bytes: 35700
#pragma GCC target("avx2")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")

#include <algorithm>
#include <cmath>
#include <iostream>

using namespace std;

typedef long long ll;

const int MAX_N = 1000;

int N;
int T[MAX_N];
int A[MAX_N];

ll ceilInt(ll a, ll b);

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

    cin >> N;

    for (int i = 0; i < N; i++) {
        int t, a;
        cin >> t >> a;
        T[i] = t;
        A[i] = a;
    }

    ll num = T[0] + A[0];
    ll tvn = T[0];
    ll avn = A[0];

    for (int i = 1; i < N; i++) {
        ll c = ceilInt(num, T[i] + A[i]);
        ll ct = ceilInt(tvn, T[i]);
        ll ca = ceilInt(avn, A[i]);
        c = max(c, max(ct, ca));
        tvn = c * T[i];
        avn = c * A[i];
        num = c * (T[i] + A[i]);
    }

    cout << num << "\n";

    return 0;
}

ll ceilInt(ll a, ll b)
{
    if (a % b == 0) {
        return a / b;
    } else {
        return a / b + 1;
    }
}


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

int main() {
    int n,y;
    cin >> n >> y;
    int a= -1, b = -1, c = -1;
    for (int i = 0; i < n + 1; i++) {
        
        for (int j = 0; j < n - i + 1; j++) {
            int n_d = n - i - j;
            int total = 10000 * n_d + 5000 * j + 1000 * i;
            if (total == y) {
                a = n_d;
                b = j;
                c = i;
                cout << a << ' ' << b << ' ' << c << endl;
                return 0;
            }
        }
    }
    cout << a << ' ' << b << ' ' << c << endl;
    return 0;
}

Measured memory_bytes: 3592
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MOD=1000000007;
#define INF 1LL<<30
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define all(x) (x).begin(),(x).end()

// エラトステネスのふるい
/*
int MAX=101010;
vector<int> is_prime(MAX,1);
is_prime[0]=0,is_prime[1]=0;
for(int i=2;i<MAX;i++){
    if(!is_prime[i]) continue;
    for(int j=i*2;j<MAX;j+=i) is_prime[j]=0;
}
*/

vector<int> isok(1000010,1);
vector<int> isok2(1000010,1);

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

    sort(all(a));
    rep(i,n){
        if(!isok[a[i]]) continue;
        for(int j=a[i]*2;j<1000010;j+=a[i]) isok[j]=0;
        if(a[i]==a[i+1]) isok[a[i]]=0;
    }

    int ans=0;

    rep(i,n){
        if(isok[a[i]]) ans++;
    }

    cout<<ans<<endl;
}


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

using pll = pair<long long, long long>;
bool cmp(pll a, pll b) {
    return a.second < b.second;
}

int N;
vector<pll> v;

int main() {
    cin >> N;
    v.resize(N);
    for (int i = 0; i < N; ++i) cin >> v[i].first >> v[i].second;
    sort(v.begin(), v.end(), cmp);

    bool ok = true;
    long long sum = 0;
    for (int i = 0; i < N; ++i) {
        sum += v[i].first;
        if (sum > v[i].second) ok = false;
    }
    if (ok) cout << "Yes" << endl;
    else cout << "No" << endl;
}

Measured memory_bytes: 3328
# -*- coding: utf-8 -*-
import bisect
import heapq
import math
import random
import sys
from collections import Counter, defaultdict, deque
from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal
from functools import lru_cache, reduce
from itertools import combinations, combinations_with_replacement, product, permutations
from operator import add, mul, sub

sys.setrecursionlimit(100000)
input = sys.stdin.readline


def read_int():
    return int(input())


def read_int_n():
    return list(map(int, input().split()))


def read_float():
    return float(input())


def read_float_n():
    return list(map(float, input().split()))


def read_str():
    return input().strip()


def read_str_n():
    return list(map(str, input().split()))


def error_print(*args):
    print(*args, file=sys.stderr)


def mt(f):
    import time

    def wrap(*args, **kwargs):
        s = time.time()
        ret = f(*args, **kwargs)
        e = time.time()

        error_print(e - s, 'sec')
        return ret

    return wrap

@mt
def slv(N, M, AB):
    ans = 0
    cand = []
    AB.sort(key=lambda x: x[0], reverse=True)
    for i in range(1, M+1):
        while AB and AB[-1][0] <= i:
            _, b = AB.pop()
            heapq.heappush(cand, -b)
        if cand:
            ans -= heapq.heappop(cand)
    return ans 

def main():
    N, M = read_int_n()
    AB = [read_int_n() for _ in range(N)]
    print(slv(N, M, AB))

if __name__ == '__main__':
    main()


Measured memory_bytes: 93400
#include <set>
#include <map>
#include <cmath>
#include <ctime>
#include <bitset>
#include <string>
#include <vector>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cassert>
#include <iomanip>
#include <iostream>
#include <algorithm>
#define PR pair
#define fi first
#define se second
#define mk make_pair
#define pb push_back
#define REP(i, x, y)   for(int i = (int)(x); i <= (int)(y); i++)
#define FOR(i, x, y)   for(int i = (int)(x); i <  (int)(y); i++)
#define PER(i ,x, y)  for(int i = (int)(x); i >= (int)(y); i--)
#define CH	         ch = getchar()
#define Exit(...)    printf(__VA_ARGS__), exit(0)
#define dln()        fprintf(stderr,"\n")
#define dprintf(...) fprintf(stderr,__VA_ARGS__)
using namespace std;
typedef double	  db;
typedef long long LL;
typedef vector<int> VI;
typedef vector<VI > VII;
typedef PR<int,int> PII;
typedef vector<PII> VPI;
const	int inf=2e9;
const	LL Inf=1e10;
const	int P=1e9+7;
const	int N=1000005;

inline LL IN(){
	LL x = 0;
	int ch = 0, f = 0;
	for (CH; ch != -1 && (ch < 48 || ch > 57); CH) f = (ch == '-');
	for (; ch >= 48 && ch <= 57; CH) x = (x << 1) + (x << 3) + ch - '0';
	return f ? (-x) : x;
}
template<typename T> inline int chkmin(T &a, const T &b){if(b < a) return a = b, 1; return 0;}
template<typename T> inline int chkmax(T &a, const T &b){if(b > a) return a = b, 1; return 0;}

void renew(int &x, const int &y){
	x += y;
	if(x >= P) x -= P;
	if(x <  0) x += P;
}

int Pow(int x, int y, int p){
	int a = 1;
	for (; y; y >>= 1, x = (LL)x * x %p) if(y & 1) a=(LL)a * x%p;
	return a;
}

int las[N << 1];
int gts[N << 1];
int sum[N];
int n, A[N], F[N];
char S[N], T[N];

int main(){

	scanf("%d", &n);
	scanf("%s%s", S + 1, T + 1);
	int flag = 1;
	REP(i, 1, n) if(S[i] ^ T[i]) flag = 0;
	if(flag){
		puts("0");
		return 0;
	}
	int x = n;
	PER(i, n, 1){
		if(x > i) x = i;
		while(x && S[x] != T[i]) x --;
		if(!x){
			puts("-1");
			exit(0);
		}
		A[i] = x;
	}
	REP(i, 1, n) if(A[i] ^ i) F[A[i]] = 1;
	REP(i, 1, n) sum[i] = sum[i - 1] + F[i];
	REP(i, 1, n) gts[i] = gts[i - 1] + (F[i] ? 0 : 1);
	int ans = 0;
	PER(i, n, 1){
		las[gts[i] + n] = i;
		if(A[i] != A[i - 1] && A[i] != i){
			int u = sum[i] - sum[A[i]];
			int r = las[u + gts[i] + n];
			chkmax(ans, sum[r] - sum[A[i]] + 1);
		}
	}
	printf("%d\n", ans + 1);
	return 0;
}

Measured memory_bytes: 21504
#include <bits/stdc++.h>
#include <math.h>
using namespace std;
int main() {
  string S;
  cin>>S;
  if(S.size()>=4&&((S[0]=='Y'&&S[1]=='A')&&(S[2]=='K'&&S[3]=='I'))){
    cout<<"Yes"<<endl;
  }else cout<<"No"<<endl;
}



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

#define pb push_back
#define INF 0x3f3f3f3f
#define LINF 0x3f3f3f3f3f3f3f3f
#define ms memset
//#define MAXN 10005
//#define MAXM 100005
#define pi 3.14159265359

typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<pair<int, int>> vpii;
typedef long long ll;
typedef priority_queue<int> pqi;
typedef priority_queue<pii, vpii, greater<pii> > dij;

string S;

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

	cin >> S;

	cout << (S == "ABC" ? "ARC\n" : "ABC\n");

	return 0;	
}

Measured memory_bytes: 3600
#include <bits/stdc++.h>
using namespace std;
///////////////////////////////////////////
const long long int INF = 1LL<<60;
const long long int Mod = 1000000007;
using ll = long long int; using ci = const int;
using vi = vector<int>;  using Vi = vector<long long int>;
using P = pair<int, int>;  using PLL = pair<ll, ll>;
using matrix = vector<vector<ll>>;
#define pb(x) push_back(x)
#define mp(x,y) make_pair(x,y)
#define all(x) (x).begin(),(x).end()
#define rp(i,N) for(ll i = 0; i < (ll)N; i++)
#define repi(i,a,b) for(ll i = ll(a); i < ll(b); ++i)
template<class T>bool chmax(T &former, const T &b) { if (former<b) { former=b; return true; } return false; }
template<class T>bool chmin(T &former, const T &b) { if (b<former) { former=b; return true; } return false; }
template<class T>T sqar(T x){ return x*x; }//sqrt(x)は平方根;
#define Sort(v) std::sort(v.begin(), v.end(), std::greater<decltype(v[0])>()) //降順でVをソート
#define p_queue(v) priority_queue<v, vector<v>, greater<v> >
template<class T> inline void princ(T x){cout<<x<<" ";}; 
template<class T> inline void print(T x){cout<<x<<"\n";};
template<class T> inline void Yes(T condition){ if(condition) cout << "Yes" << endl; else cout << "No" << endl; }
template<class T> inline void YES(T condition){ if(condition) cout << "YES" << endl; else cout << "NO" << endl; }
///////////////////////////////////////////////////////////////////////////////////

void solve(){
    ll n,c;
    cin >> n >> c;
    matrix iwa(c,Vi(c));
    rp(i,c){
        rp(j,c) cin >> iwa[i][j];
    }
    matrix g_color(3,Vi(c+1,0));
    rp(i,n){
        rp(j,n){
            ll C;
            cin >> C;
            g_color[(i+j)%3][C]++;
        }
    }
    ll ans=INF;
    repi(i,1,c+1){
        repi(j,1,c+1){
            if(i==j) continue;
            repi(k,1,c+1){
                if(i==k||j==k) continue;
                ll sum=0;
                repi(m,1,c+1){
                    sum+=g_color[0][m]*iwa[m-1][i-1];
                }
                repi(m,1,c+1){
                    sum+=g_color[1][m]*iwa[m-1][j-1];
                }
                repi(m,1,c+1){
                    sum+=g_color[2][m]*iwa[m-1][k-1];
                }
                chmin(ans,sum);
            }
        }
    }
    print(ans);
    return;
}
int main(){
    cin.tie(0);ios::sync_with_stdio(false);
    std::cout<<std::fixed<<std::setprecision(30);
    solve();
    return 0;
}

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

#define DEBUG(x) cerr << #x << ": " << x << endl;
#define ll long long

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

    int a = 0;
    for (int i = 0; i < s.size(); i++) {
        if (s[i] == 'A') {
            a = i;
            break;
        }
    }

    int z = 0;
    for (int i = s.size()-1; i >= 0; i--) {
        if (s[i] == 'Z') {
            z = i;
            break;
        }
    }

    cout << z - a + 1 << endl;

    return 0;
}

Measured memory_bytes: 640
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <cmath>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <tuple>
#include <stack>
#include <bitset>
#include <utility>
#include<iomanip>
// #include <numeric>
using namespace std;



typedef unsigned long ul;
typedef unsigned long long ull;
typedef long long ll;
typedef vector<ll> vint;
typedef vector<vector<ll>> vvint;
typedef vector<string> vstring;
typedef vector<vector<string>> vvstring;
typedef vector<char> vchar;
typedef vector<vector<char>> vvchar;
typedef vector<long double> vdouble;
typedef vector<vector<long double>> vvdouble;
typedef vector<vector<vector<long double>>> vvvdouble;
typedef pair<ll,ll> pint;
typedef vector<pint> vpint;

#define rep(i,n) for(ll i=0;i<n;i++)
#define repf(i,f,n) for(ll i=f;i<n;i++)
#define repr(i,n) for(ll i=n-1;i>=0;i--)
#define mp make_pair
#define mt make_tuple
#define pb push_back
#define pf push_front
#define fi first
#define se second
#define INT_MAX 2147483647
#define LLONG_MAX 9223372036854775807
#define vmax(vec) *max_element(vec.begin(), vec.end())
#define vmin(vec) *min_element(vec.begin(), vec.end())
#define vsort(vec) sort(vec.begin(), vec.end())
#define vsortgr(vec) sort(vec.begin(), vec.end(), greater<ll>())
#define DIVIDER 1000000007


//
// struct Node{
//   vint children;
//   ll index;
//   ll prop;
// };



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

// ll X,Y,Z,K;
// ll pmax = 30000000000;
// vint A,B,C;




// int binary_search(int key){
//  //isOKを満たす要素のうち最小のインデックスを返す。（要ソート）
//   int left = -1;
//   int right = N;
//
//   while(right - left > 1){
//     int mid = left + (right - left)/2;
//
//     if(isOK(mid, key)) right=mid;
//     else left=mid;
//   }
//
//   return right;
// }

// ll gcd(ll m, ll n){
//   if(m<n) swap(m,n);
//   if(n==0) return m;
//   return gcd(n, m%n);
// }




int main() {
  cout<<fixed<<setprecision(10);

  ll N;cin>>N;
  string s,t;cin>>s>>t;

  ll ans=N;
  rep(i,N){
    if(s.substr(i,N-i) == t.substr(0,N-i)){
      break;
    }else{
      ans++;
    }

  }

  cout << ans << endl;
}

















//


Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
#define ll long long int
#define rep(i,n) for( int i = 0; i < n; i++ )
#define rrep(i,n) for( int i = n; i >= 0; i-- )
#define REP(i,s,t) for( int i = s; i <= t; i++ )
#define RREP(i,s,t) for( int i = s; i >= t; i-- )
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define INF 2000000000
#define mod 1000000007
#define INF2 1000000000000000000


int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N; cin >> N;
    ll ans = 0;
    ll num = 0;
    ll A[100010], B[100010];
    rep(i, N) cin >> A[i] >> B[i];
    RREP(i, N - 1, 0) {
        A[i] += num;
        ll tmp = (B[i] - A[i] % B[i]) % B[i];
        num += tmp;
        ans += tmp;
    }
    cout << ans << endl;

    return 0;
}


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

struct Fast {Fast(){cin.tie(0);ios::sync_with_stdio(0);}} fast;

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define reps(i, n, m) for (int i = (int)(n); i <= (int)(m); i++)
#define ALL(obj) (obj).begin(), (obj).end()
#define rALL(obj) (obj).rbegin(), (obj).rend()
#define ceiv(a, b) (1 + (int)((a) - 1)/(int)(b))
#define int long long

signed main(){
    int a, b;
    cin >> a >> b;
    
    int n = stoi(to_string(a) + to_string(b));
    bool ans = false;
    
    for(int i = 1; i * i <= n; i++){
        if(i * i == n) ans = true;
    }
    
    cout << (ans ? "Yes" : "No") << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <queue>
#include <map>
#include <stack>
#include <utility>
#include <vector>
using namespace std;
using ll = long long;

int main(){
  int n, m; cin >> n >> m;
  ll x[n], y[n], z[n];
  for(int i=0; i<n; i++) cin >> x[i] >> y[i] >> z[i];

  ll ans = 0;
  for(int i=0; i<(1<<3); i++){
    ll sum[n];
    for(int j=0; j<n; j++){
      ll xt, yt, zt;
      xt = ((i >> 2) % 2)? x[j] : -x[j];
      yt = ((i >> 1) % 2)? y[j] : -y[j];
      zt = ((i >> 0) % 2)? z[j] : -z[j];
      sum[j] = xt + yt + zt;
    }

    sort(sum, sum+n, greater<ll>());

    ll tmp = 0;
    for(int j=0; j<m; j++){
      tmp += sum[j];
    }
    ans = max(tmp, ans);
  }

  cout << ans << endl;

  return 0;
}


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

int main() {
   int a, b, c;
   string x, y, z;
   cin >> c >> a >> b;
   for(int i = a; i <= b; i++){
      if(i % c == 0){
         cout << "OK" << endl;
         return 0;
      }
   }
   cout << "NG" << endl;
   return 0;
}

Measured memory_bytes: 3612
#include<stdio.h>

int main(void){
    int a,b,c;
    scanf("%d %d %d",&a,&b,&c);
    if(a==b&&a!=c){
        printf("Yes");
    }else if(b==c&&b!=a){
        printf("Yes");
    }else if(c==a&&c!=b){
        printf("Yes");
    }else{
        printf("No");
    }
    return 0;
}

Measured memory_bytes: 128
#include <stdio.h>

int main(){
    int n, i, j, count;
    
    while(1){
        scanf("%d", &n);
        if(n == 0) break;
        count = 0;
        if(n < 5){printf("0\n"); continue;}
        for(i = 5; i <= n; i += 5){
            j = i;
            while(1){
                j /= 5;
                count++;
                if(j % 5 != 0) break;
            }
        }
        printf("%d\n", count);
    }
    return 0;
}

Measured memory_bytes: 612
#pragma warning(disable:4996)
#include <bits/stdc++.h>

using namespace std;

#define REP(i,n) for (int i = 0; i<n; i++)
#define ALL(a) begin(a), end(a)
#define TPL template
#define TNM typename

using ll = long long;
using ull = unsigned long long;
TPL<TNM T> using vec = vector<T>;
TPL<TNM T> using vec2 = vec<vec<T>>;
TPL<TNM T> using vec3 = vec<vec2<T>>;
TPL<TNM T> using vec4 = vec<vec3<T>>;
TPL<TNM T> using vec5 = vec<vec4<T>>;

TPL<TNM V, TNM H> void resize(vector<V>& v, const H h) { v.resize(h); }
TPL<TNM V, TNM H, TNM ... T> inline void resize(vector<V>& v, const H& h, const T ... t) { v.resize(h); for (auto& _v : v) resize(_v, t ...); }
TPL<TNM V, TNM T> void fill(V& x, const T& val) { x = val; }
TPL<TNM V, TNM T> inline void fill(vector<V>& vec, const T& val) { for (auto& v : vec) fill(v, val); }
TPL<TNM T> inline void UNIQUE(vector<T>& vec) { sort(ALL(vec)); vec.erase(unique(ALL(vec)), vec.end()); }



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

Measured memory_bytes: 256
#include <stdio.h>
#include <algorithm>
#include <assert.h>
#include <bitset>
#include <cmath>
#include <complex>
#include <deque>
#include <functional>
#include <iostream>
#include <limits.h>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <stdlib.h>
#include <string.h>
#include <string>
#include <time.h>
#include <unordered_map>
#include <unordered_set>
#include <vector>

#pragma warning(disable:4996)
#pragma comment(linker, "/STACK:336777216")
using namespace std;

#define mp make_pair
#define all(x) (x).begin(), (x).end()
#define ldb ldouble

typedef tuple<int, int, int> t3;
typedef long long ll;
typedef unsigned long long ull;
typedef double db;
typedef long double ldb;
typedef pair <int, int> pii;
typedef pair <ll, ll> pll;
typedef pair <ll, int> pli;
typedef pair <db, db> pdd;

int IT_MAX = 1 << 18;
int MOD = 1000000007;
const int INF = 0x3f3f3f3f;
const ll LL_INF = 0x3f3f3f3f3f3f3f3f;
const db PI = acos(-1);
const db ERR = 1e-10;
#define szz(x) (int)(x).size()
#define rep(i, n) for(int i=0;i<n;i++)
#define Se second
#define Fi first

const int MX = 1<<14 | 15;
const int MM = 998244353;

int main()
{
	int N;
	scanf("%d", &N);
	deque<int> Q;
	for(int i = 1; i <= N; i++){
		int a;
		scanf("%d", &a);
		if(i%2) Q.push_back(a);
		else Q.push_front(a);
	}
	if( N%2 == 1 ) for(int i = N-1; i >= 0; i--) printf("%d ", Q[i]);
	if( N%2 == 0 ) for(int i = 0; i < N; i++) printf("%d ", Q[i]);
	printf("\n");
}


Measured memory_bytes: 2944
#include <iostream>
#include <fstream>
#include <vector>
#include <deque>
#include <set>
#include <map>
#include <unordered_map>
#include <list>
#include <array>
#include <cstdlib>
#include <stack>
#include <string>
#include <queue>
#include <chrono>
#include <functional>
#include <limits>
#include <cmath>
#include <algorithm>
#include <random>
#include <regex>
#include <tuple>
#include <utility>
#include <bitset>
#include <complex>
#include <iomanip>
#include <ostream>
#include <sstream>
#include <ctime>
using namespace std;
#define for0(i, n) for(int i = 0; i < n; i++)
#define for1(i, n) for(int i = 1; i <= n; i++)
#define pb push_back
#define mp make_pair
#define all(v) v.begin(), v.end()
#define V vector<int>
#define VP vector<pair<int, int> >
#define FASTIO ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define index INDEX
#ifndef ONLINE_JUDGE
#define print(x) PRINT(x, #x)
template<typename T> inline const void PRINT(T VARIABLE, const string& NAME) {
	cerr << NAME << " = " << fixed << VARIABLE << "\n";
}
#else
#define print(x) 0 
#endif
#ifdef RAND_MAX
#undef RAND_MAX
#endif
#define RAND_MAX 999999937 
int generate_random() {
	const int MAX_RANDOM = (int)1e6;
	mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
	return uniform_int_distribution<int>(0, MAX_RANDOM)(rng);
}
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
const ll INFLL = 2 * (ll)1e18 + 100;
#define int ll
#ifdef int 
const int INFINT = INFLL;
#else
const int INFINT = 2 * (int)1e9 + 100;
#endif
const double PI = atan(1) * 4;
const double EPS = 1e-6;
const int SEED = (int)1e3 + 7;
const int MOD = (int)1e9 + 7;
const int NMAX = (int)1e6 + 5;

bool yymm(string s)
{
	int here = (s[2] - '0') * 10 + s[3] - '0';
	return here >= 1 && here <= 12;
}

bool mmyy(string s)
{
	int here = (s[0] - '0') * 10 + s[1] - '0';
	return here >= 1 && here <= 12;
}

int32_t main() {
#ifndef ONLINE_JUDGE
	double START_PROGRAM = clock();
#endif
	srand(time(0));
	cout << setprecision(20) << fixed;
	FASTIO;
	string s;
	cin >> s;
	if (yymm(s) && mmyy(s))
		return cout << "AMBIGUOUS", 0;
	if (yymm(s))
		return cout << "YYMM", 0;
	if (mmyy(s))
		return cout << "MMYY", 0;
	cout << "NA";






#ifndef ONLINE_JUDGE
	double END_PROGRAM = clock();
	double ELAPSED_TIME = (END_PROGRAM - START_PROGRAM) / CLOCKS_PER_SEC;
	cerr << "\n\nElapsed Time: " << ELAPSED_TIME * 1000 << "\n";
	system("pause");
#endif
	return 0;
}







Measured memory_bytes: 504
using namespace std;
#include <iostream>
#include <string>
#include <cstdio>
#include <algorithm>
#include <vector>
#define all(x) (x).begin(),(x).end()

void solve(){

}
int main(){
    int a, b;
    cin >> a >> b;
    if ( (a + b) % 2 != 0){
        cout << (a + b) / 2 + 1 << endl;
    } else {
        cout << (a + b) /2 << endl;
    }
}


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

bool dp[81][81][160*80+1];

int main(){
    // 入力処理
    int h,w; cin >> h >> w;
    int a[h][w], b[h][w];
    rep(i,h) rep(j,w) cin >> a[i][j];
    rep(i,h) rep(j,w) cin >> b[i][j];

    // dp準備
    dp[0][0][abs(a[0][0] - b[0][0])] = true;
    // 上端の処理
    rep(i,w-1) rep(k,(h+w)*80+1){
        int tmpa = a[0][i+1], tmpb = b[0][i+1];
        if(abs(k - abs(tmpa - tmpb)) >= 0){
            if(dp[0][i][abs(k - abs(tmpa - tmpb))]) dp[0][i+1][k] = true;
        }
        if(k + abs(tmpa - tmpb) <= (h+w)*80){
            if(dp[0][i][k + abs(tmpa - tmpb)]) dp[0][i+1][k] = true;
        }
    }
    // 左端の処理
    rep(i,h-1) rep(k,(h+w)*80+1){
        int tmpa = a[i+1][0], tmpb = b[i+1][0];
        if(abs(k - abs(tmpa - tmpb)) >= 0){
            if(dp[i][0][abs(k - abs(tmpa - tmpb))]) dp[i+1][0][k] = true;
        }
        if(k + abs(tmpa - tmpb) <= (h+w)*80){
            if(dp[i][0][k + abs(tmpa - tmpb)]) dp[i+1][0][k] = true;
        }
    }

    // dp計算
    for(int i = 1; i < h; ++i) for(int j = 1; j < w; ++j){
        rep(k,(h+w)*80+1){
            int tmpa = a[i][j], tmpb = b[i][j];
            if(abs(k - abs(tmpa - tmpb)) >= 0){
                if(dp[i-1][j][abs(k - abs(tmpa - tmpb))]) dp[i][j][k] = true;
                if(dp[i][j-1][abs(k - abs(tmpa - tmpb))]) dp[i][j][k] = true;
            }
            if(k + abs(tmpa - tmpb) <= (h+w)*80){
                if(dp[i-1][j][k + abs(tmpa - tmpb)]) dp[i][j][k] = true;
                if(dp[i][j-1][k + abs(tmpa - tmpb)]) dp[i][j][k] = true;
            }
        }
    }
    // 出力
    rep(k,(h+w)*80+1){
        if(dp[h-1][w-1][k]){
            cout << k << endl;
            return 0;
        }
    }
}

Measured memory_bytes: 81280
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int H = sc.nextInt();
		int W = sc.nextInt();
		String HArray[][];
		HArray = new String[H][W];

		int flagArray[][];
		flagArray = new int[H][W];

		//　空読み
		sc.nextLine();



		for(int i = 0; i < H; i++) {
			String line = sc.nextLine();
	        String[] array = line.split("");

	        for(int j = 0; j < array.length; j++) {
	        HArray [i][j] = array[j];
	        flagArray [i][j] = 0;
	        }
		}



		boolean flag = false;

		for(int i = 0; i < H; i++) {
			for(int j = 0; j < W; j++) {
		        String a = HArray [i][j];
		        if(a.equals("#")) {
		        	flag = true;
		        }
		        //System.out.print(a);
		    }
			if(flag == false) {
				for(int j = 0; j < W; j++) {

			        flagArray[i][j] = -1;
			        //System.out.print(a);
			    }
			}

			//System.out.println();
			flag = false;
	    }


		for(int i = 0; i < W; i++) {
			for(int j = 0; j < H; j++) {
		        String a = HArray [j][i];
		        if(a.equals("#")) {
		        	flag = true;
		        }
		        //System.out.print(a);
		    }
			if(flag == false) {
				for(int j = 0; j < H; j++) {

			        flagArray[j][i] = -1;
			        //System.out.print(a);
			    }
			}

			//System.out.println();
			flag = false;
	    }



		for(int i = 0; i < H; i++) {
			for(int j = 0; j < W; j++) {

		        if(flagArray[i][j] == 0) {
		        System.out.print(HArray [i][j]);
		        flag = true;
		        }
		        }
			if(flag == true) {
			System.out.println();
			}
			flag = false;
	        }

		sc.close();
	}

}

Measured memory_bytes: 26580
n, x = map(int, input().split())

l = [1]
p = [1]

for i in range(1,n+1):
    l.append(2 * l[i-1] + 3)
    p.append(2 * p[i-1] + 1)

def result(n, x):
    if n == 0:
        if x == 1:
            return 1
        else:
            return 0
    elif x == 1:
        return 0
    
    elif l[n] == x:
        return p[n]
    
    elif l[n]//2 + 1 <= x:
        return p[n-1] + 1 + result(n-1, x - l[n]//2-1)
    else:
        return result(n-1, x-1)

print(result(n, x))

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

using namespace std;

using ll = long long;

#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=a;i<=(ll)(b);i++)
#define FORD(i,a,b) for(ll i=a;i>=(ll)(b);i--)

#define input(...) __VA_ARGS__; in(__VA_ARGS__)

template<class T>
void print(vector<T> a) {
  cout << "[ ";
  REP(i, a.size()) cout << a[i] << " ";
  cout << "]" << endl;
}

void print() {
  std::cout << std::endl;
}

template <class Head, class... Tail>
void print(Head&& head, Tail&&... tail) {
  std::cout << head << " ";
  print(std::forward<Tail>(tail)...);
}

void in() { }

template <class Head, class... Tail>
void in(Head&& head, Tail&&... tail) {
  cin >> head;
  in(std::forward<Tail>(tail)...);
}

vector<pair<ll, ll>> d = {
  {-1, -1},
  {+1, -1},
  {-1, +1},
  {+1, +1},
  {+0, +1},
  {+0, -1},
  {+1, +0},
  {-1, +0},
};

void dfs(ll x, ll y, vector<vector<ll>> &graph) {
  graph[y][x] = 0;
  for(auto v: d) {
    ll nx = v.first + x;
    ll ny = v.second + y;
    if (0 <= ny && ny < graph.size() && 0 <= nx && nx < graph[y].size() && graph[ny][nx]) {
      dfs(nx, ny, graph);
    }
  }
}

bool solve() {
  ll input(w, h);
  if (w == 0 && h == 0) return false;

  vector<vector<ll>> graph(h);
  REP(i, h) {
    vector<ll> r(w);
    REP(j, w) cin >> r[j];
    graph[i] = r;
  }

  ll cnt = 0;
  REP(i, h) REP(j, w) {
    if (graph[i][j]) {
      dfs(j, i, graph);
      cnt++;
    }
  }
  cout << cnt << endl;
  return true;
}

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



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

typedef struct{
  int x;
  int y;
} Point;

typedef struct{
  char tate[8];
  char yoko[8];
  char naname[15];
  char sita[15];
} Field;

Point Q[8];

int put(char x, Field F ,char s){
  int i,m;
  if(s==8) return 0;
  if(F.tate[x]==-1) return put(x+1,F,s);
  
  for(i=0;i<8;i++){
    if(F.yoko[i]==-1 || F.naname[x+i]==-1 || F.sita[x-i+7]==-1) continue;

    //printf("s=%d, x=%d, i=%d",s,x,i); for(i=0;i<s;i++) printf(" Q[%d]=(%d,%d)",i,Q[i].x,Q[i].y); printf("\n");
    Q[s].x=x;
    Q[s].y=i;

    //printf("Q[%d]={%d,%d} ,%d:%d:%d\n",s,Q[s].x,Q[s].y,F.yoko[i],F.naname[x+i],F.sita[x-i+7]);
	
    F.yoko[i]--;
    F.naname[x+i]--;
    F.sita[x-i+7]--;
	
    if( put(x+1,F,s+1) == 0 ) return 0;

    F.yoko[i]++;
    F.naname[x+i]++;
    F.sita[x-i+7]++;
    
  }

  return -1;		
}

int main(){
  int i,j,n;
  char board[8][8];
  Field F;

  scanf("%d",&n);

  for(i=0;i<n;i++){
    scanf("%d%d",&Q[i].x,&Q[i].y);
  }

  for(i=0;i<8;i++) F.tate[i]=F.yoko[i]=0;
  for(i=0;i<15;i++) F.naname[i]=F.sita[i]=0;

  for(i=0;i<n;i++){
    F.tate[ Q[i].x ]=-1;
    F.yoko[ Q[i].y ]=-1;
    F.naname[ Q[i].x + Q[i].y ]=-1;
    F.sita[ Q[i].x - Q[i].y + 7]=-1;
  }

  //for(i=0;i<8;i++) printf("tate[%d]=%d,yoko[%d]=%d \n",i,F.tate[i],i,F.yoko[i]);
  //for(i=0;i<15;i++) printf("naname[%d]=%d,sita[%d]=%d\n",i,F.naname[i],i,F.sita[i]);

 put(0,F,n);

  for(i=0;i<8;i++) for(j=0;j<8;j++) board[i][j]='.';
  for(i=0;i<8;i++) board[ Q[i].x ][ Q[i].y ]='Q';

  for(i=0;i<8;i++){
    for(j=0;j<8;j++) printf("%c",board[i][j]);
    printf("\n");
  }
    
  return 0;
}




Measured memory_bytes: 2108
use std::cmp::max;

fn input_pair<T: std::str::FromStr + Copy>() -> (T, T) {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).unwrap();
    let arr: Vec<_> = s.trim().split_whitespace().flat_map(str::parse).collect();
    (arr[0], arr[1])
}

fn main() {
    let (a, b) = input_pair::<isize>();
    println!("{}", max(a - b * 2, 0));
}


Measured memory_bytes: 4352
s=input()
n=len(s)
g=0
p=0
ans=0
for i in range(n):
    if s[i]=="g":
        if p+1<=g:
            ans+=1
            p+=1
        else:
            g+=1
    else:
        if p+1<=g:
            p+=1
        else:
            g+=1
            ans-=1
print(ans)


Measured memory_bytes: 9248
/*
Dice II
ITP1_11_B
ダイス
側面の数を調べる
*/
package main

import (
	"fmt"
	// "strconv"
)

func right_eye(top int, left int) int {
	eyes := map[int]int{
		12: 3,
		13: 5,
		14: 2,
		15: 4,

		24: 6,
		26: 3,
		23: 1,
		21: 4,

		31: 2,
		32: 6,
		36: 5,
		35: 1,

		41: 5,
		45: 6,
		46: 2,
		42: 1,

		51: 3,
		53: 6,
		56: 4,
		54: 1,

		62: 4,
		64: 5,
		65: 3,
		63: 2,
	}

	return eyes[top*10+left]
}

/*
ダイスの数から面番号(1~6)を取得する
*/
func getfno(dice [6]int, eye int) int {
	i := 0
	for {
		if dice[i] == eye {
			break
		}
		i++
	}

	i++
	return i
}

func main() {
	var n int
	var top, left int
	var dice [6]int

	/* ダイスデータ読み込み */
	for i := 0; i < 6; i++ {
		fmt.Scanf("%d", &dice[i])
	}

	fmt.Scanf("%d", &n)

	for i := 0; i < n; i++ {
		fmt.Scanf("%d %d", &top, &left)
		top_fno := getfno(dice, top)
		left_fno := getfno(dice, left)

		right := right_eye(top_fno, left_fno)
		fmt.Println(dice[right-1])
	}
}


Measured memory_bytes: 1148
lis = [int(x) for x in input().split()]
a = lis[0]
b = lis[1]
m = lis[2]
lis2 = []
A=[int(x) for x in input().split()]
B=[int(x) for x in input().split()]


for i in range(m):
    lis2.append([int(x) for x in input().split()])

min1 = min(A)+min(B)
cost = [A[lis2[x][0]-1] + B[lis2[x][1]-1] - lis2[x][2] for x in range(m)]
min2 = min(cost)

print(min([min1 , min2]))


Measured memory_bytes: 36468
#include <bits/stdc++.h>
#define INF 5000000000000000000
#define ll long long
#define pll pair<ll, ll>
using namespace std;

int main() {
  static const double pi = 3.141592653589793;
  ll A, B, H, M;
  cin >> A >> B >> H >> M;
  double hour = (H * 60 + M) / 720.0 * 2 * pi;
  double mi = M / 60.0 * 2 * pi;
  double dif = max(hour, mi) - min(hour, mi);
  dif = min(dif, 2 * pi - dif);
  double ans = sqrt(A * A + B * B - 2 * A * B * cos(dif));;
  cout << setprecision(30) << ans << "\n";
}


Measured memory_bytes: 4216
#include<iomanip>
#include <string>
#include<iostream>
#include<vector>
#include <bits/stdc++.h>
#include <stdio.h>
#include <numeric>
#include<math.h>
#include <ctype.h>
#include <algorithm> // sort
#include <map> // pair
using namespace std;
#define nin(n) int n; cin >> n;
#define kin(k) int k; cin >> k;
const int INF = 1001001001;
int main(){
  int n;cin >> n;
  int W;cin >> W;
  long long int v[n];
  int weight[n];
  for(int i=0;i<n;i++){
    cin >> weight[i+1] >> v[i+1];
  }
  long long int dp[110][100010]={0};
  for(int i=1;i<=n;i++){
    for(int w=0;w<=W;w++){
      if(w-weight[i]>=0){
        dp[i][w]=max(dp[i][w],dp[i-1][w-weight[i]]+v[i]);
      }
      dp[i][w]=max(dp[i-1][w],dp[i][w]);
      
    }
  }
 cout << dp[n][W];
}


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

int main() {
  long a, b, c, d;
  cin >> a >> b >> c >> d;
  
  if(b>=0 && c>=0){
    cout << b*d <<endl;
  }
  else if(a<=0 && d<=0){
    cout << a*c <<endl;
  }
  else if(a>=0 && d<=0){
    cout << a*d <<endl;
  }
  else if(b<=0 && c>=0){
    cout << b*c <<endl;
  }
  else if(a<=0 && b>=0 && c<=0 && d>=0){
    if(a*c<b*d){
      cout << b*d <<endl;
    }
    else{
      cout << a*c <<endl;
    }
  }
  else if(b<=0 && c<=0){
    cout << a*c <<endl;
  }
  else if(a>=0 && d>=0){
    cout << b*d <<endl;
  }
}


Measured memory_bytes: 3636
#define __USE_MINGW_ANSI_STDIO 0
#include <bits/stdc++.h>
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl '\n'
#define rep(i, a, b) for (int i = a; i < b; i++)
#define ff first
#define pii pair<int, int>
#define vii vector< pair<int,int> >
#define vi vector<int>
#define vvi vector< vector< int> >
#define ss second
#define MOD 998244353LL
#define mod 1000000007
#define pb push_back
#define mp make_pair
#define int long long
#define all(a) a.begin(), a.end()
#define inf (1LL<<61)
#define ull unsigned long long
#define trace1(x)                cout<<#x<<": "<<x<<endl
#define trace2(x, y)             cout<<#x<<": "<<x<<" | "<<#y<<": "<<y<<endl
#define trace4(x, y, z, d)          cout<<#x<<":" <<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<" | "<<#d<<": "<<d<<endl

#define trace3(x, y, z)          cout<<#x<<":" <<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl
#define debug1(x) cerr << #x << ": " << x <<'\n'
#define debug2(x, y) cerr << #x << ": " << x << '\t' << #y << ": " << y <<'\n'
#define debug3(x, y, z) cerr << #x << ": " << x << '\t' << #y << ": " << y << '\t' << #z << ": " << z <<'\n'
using namespace std;
int dx[]={1,0,-1, 0};int dy[]={0,1,0, -1}; //4 Direction
//int dx[]={1,1,0,-1,-1,-1,0,1};int dy[]={0,1,1,1,0,-1,-1,-1};//8 direction
bool compare(const pair<int,int> &a,
             const pair<int,int> &b)
{
    if(a.ff == b.ff) {
        return (b.ss < a.ss);
    }
    return (a.ff<b.ff);
}
int findlcm(int arr[], int n) 
{ 
    // Initialize result 
    int ans = arr[0]; 
  
    // ans contains LCM of arr[0], ..arr[i] 
    // after i'th iteration, 
    for (int i = 1; i < n; i++) 
        ans = (((arr[i] * ans)) / 
                (__gcd(arr[i], ans))); 
  
    return ans; 
}
bool prime[1000001];
void SieveOfEratosthenes(int n) 
{
    // Create a boolean array "prime[0..n]" and initialize
    // aint entries it as true. A value in prime[i] wiint
    // finainty be false if i is Not a prime, else true.

    memset(prime, true, sizeof(prime));

    for (int p=2; p*p<=n; p++)
    {
        if (prime[p] == true)
        {
            for (int i=p*p; i<=n; i += p)
                prime[i] = false;
        }
  }
}
vector<pair<int, int> > g[100005];
int vis[100005] = {0};
int col[100005] = {-1};
void dfs(int n){
	vis[n] = 1;
	rep(i, 0, g[n].size()){
		if( g[n][i].ss%2==0){
			col[g[n][i].ff] = col[n];
		}
		else{
			col[g[n][i].ff] = abs(1-col[n]);
		}
		if(!vis[g[n][i].ff]){
			dfs(g[n][i].ff);
		}
	}
}
int32_t main()
{
    IOS;
    // #ifndef ONLINE_JUDGE
    // freopen("input.txt","r",stdin);
    // freopen("output.txt","w",stdout);
    // #endif
    /********************* From here ***********************/
    int n;
    cin >> n;
    rep(i, 0, n-1){
    	int a,b,c;
    	cin >> a >> b >> c;
    	g[a].pb(mp(b,c));
    	g[b].pb(mp(a,c));
    }

    col[1] = 0;
    dfs(1);
    rep(i, 1, n+1){
    	cout << col[i] << endl;
    }
}

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

int main(){
 int D,N;
  cin >> D >> N;
  int hun =1;
  for (int i = 0; i <D; i++){
   hun *=100; 
  }
  if (N ==100){
   N +=1; 
  }
  cout << hun * N <<endl;
}

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

typedef long long ll;

using namespace std;


void solve(vector<vector<int>> room, int n) {
    
    set<int> used;
    
    map<int,int> mapp;
    vector<int> roomNums={1};
    int index=0;
    int before = 0;
    
    while(roomNums.size()<n) {
        
        index=(int)roomNums.size()-index;
        
        if(index==before) {
            cout<<"No"<<"\n";
            return;
        }
        
        before=index;
        
        for(int i=index; i<roomNums.size(); i++) {
            int roomNum = roomNums[i]-1;
            for(int j=0; j<room[roomNum].size(); j++) {
                int num = room[roomNum].at(j);
                if(used.count(num)==0){
                    mapp[num]=roomNum+1;
                    used.insert(num);
                    roomNums.push_back(num);
                    index++;
                }
            }
        }
    }
    
    cout<<"Yes"<<"\n";
    for(auto x : mapp)
        if(x.first!=1)
            cout<<x.second<<"\n";
}

int main() {
    
    ios::sync_with_stdio(0);
    cin.tie(0);
    
    int n, m;
    cin>>n>>m;
    
    vector<vector<int>> room(n+1,vector<int>(0));

    while(m--) {
        int a,b;
        cin>>a>>b;
        room[b-1].push_back(a);
        room[a-1].push_back(b);
    }
    
    solve(room, n);
}


Measured memory_bytes: 24784
#include <bits/stdc++.h>
using namespace std;
#define watch(x) cout << (#x) << " is " << (x) << '\n'
#define rep(i,a,n) for (int i=a;i<n;i++)
#define per(i,a,n) for (int i=n-1;i>=a;i--)
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define sz(x) ((int)(x).size())
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef pair<int, int> pi;
typedef pair<ll, ll> pll;
typedef double db;
ll gcd(ll a, ll b) { return b?gcd(b,a%b):a; }
//head

void solve(){
    int a, b;
    cin >> a >> b;
    cout << a*b - a - b + 1 << '\n';
}

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

    //int t; cin >> t; while (t--)
        solve();
}

Measured memory_bytes: 3572
#include <iostream>
#include <vector>
#include <limits.h>
using namespace std;
int main(void){
  int N;
  int count = 0;
  long int min = LONG_MAX;
  long int sum=0;
  cin >> N;
  vector<long int> data(N);
  for (int i=0;i<N;i++){
    cin >> data[i];
    if (data[i]<0) count++;
    if (abs(data[i]) < min) min = abs(data[i]);
    sum += abs(data[i]);
  }
  if (! (count%2)) cout << sum << endl;
  else cout << sum-2*min << endl;
  return 0;
}

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

#define int long long
#define rep(i,n) for(int i=0;i<(n);i++)
#define reps(i,f,n) for(int i=(f);i<(n);i++)
#define pb push_back
#define all(v) (v).begin(),(v).end()
#define fi first
#define se second
#define each(it,v) for(auto it=(v).begin();it!=(v).end();it++)
typedef vector<int>vint;
typedef pair<int,int>pint;
typedef vector<pint>vpint;
template<typename A,typename B>inline void chmin(A &a,B b){if(a>b)a=b;}
template<typename A,typename B>inline void chmax(A &a,B b){if(a<b)a=b;}

signed main(){
    int N;cin>>N;
    map<pint,int>cnt;

    rep(i,N){
        int x,y,w;
        cin>>x>>y>>w;
        rep(dy,2)rep(dx,2)cnt[pint(y+dy,x+dx)]+=w;
    }

    int ma=0;
    each(it,cnt)chmax(ma,it->se);
    cout<<ma<<" / 1"<<endl;

    return 0;
}

Measured memory_bytes: 28088
#include <bits/stdc++.h>
#include <cassert>
#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;
using ll = long long;
using P = pair<int, int>;
/*
struct Edge
{
    int to;
    int weight;
    Edge(int t, int w) : to(t), weight(w) {}
};
using Graph = vector<vector<Edge>>;
*/
using Graph = vector<vector<int>>;

const long long INF = 1LL << 60;
const int INT_INF = 1000000000;

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

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

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    ll N, K;
    cin >> N >> K;
    bool isExist = false;
    ll maxA = 0;
    vector<ll> A(N);
    for (auto &it : A)
    {
        cin >> it;
        maxA = max(maxA, it);
        if (it == K)
            isExist = true;
    }
    if (isExist)
    {
        cout << "POSSIBLE" << endl;
        return 0;
    }
    if (maxA < K)
    {
        cout << "IMPOSSIBLE" << endl;
        return 0;
    }

    ll res = A[0];
    for (int i = 0; i < N; i++)
        res = gcd(res, A[i]);

    if (K % res == 0)
        cout << "POSSIBLE" << endl;
    else
        cout << "IMPOSSIBLE" << endl;
    return 0;
}

Measured memory_bytes: 3988