akhauriyash/Code-Regression huggingface dataset:
/*
 * atcoder/abc118/c.cpp
 */

// C++ 14
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cstring> // memset
#include <cassert>
using namespace std;
#define ll long long
#define loop(__x, __start, __end) for(int __x = __start; __x < __end; __x++)
template <class T> bool chmin(T &a, T b) { if (a > b) {a = b; return true; } return false; }
template <class T> bool chmax(T &a, T b) { if (a < b) {a = b; return true; } return false; }

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

int N;

void solve() {
  cin >> N;
  ll ans, a;
  cin >> ans;
  loop(n,0,N-1) {
    cin >> a;
    ans = gcd(ans, a);
  }
  cout << ans << endl;
}

int main() {
  // cout.precision(15);
  // cout << fixed << double

  solve();

  return 0;
}


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

int main()
{
  int n;
  cin >> n;
  vector<string> s(n);
  vector<int> t(n);

  for(int i=0;i<n;i++) {
    cin>>s.at(i)>>t.at(i);
  }
  string x;
  cin >> x;
  int start=0;
  for(int i=0;i<n;i++) {
    if(s.at(i)==x) {
      start=i+1;
    }
  }
  int ans=0;
  for(int i=start;i<n;i++) {
    ans+=t.at(i);
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define very_slow       ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define int             long long
#define pb              push_back
#define mp              make_pair
#define pii             pair<int,int>
#define vec             vector<int>
#define mii             map<int,int>
#define pqb             priority_queue<int>
#define pqs             priority_queue<int,vi,greater<int> >
#define inf             1e18
#define MAX             1e9
#define MIN            -1e9
#define no_of_test(x)        int x; cin>>x; while(x--)
//Actual Code Is At The Top
const int mod = 1e9 + 7;
int gcd(int a, int b)
{
	if (b == 0) return a;
	return gcd(b, a % b);
}
int binary_exponentation(int a, int b)
{
	int ret = 1;
	while (b)
	{
		if (b & 1) ret = (ret * a) % mod;
		b >>= 1;
		a = (a * a) % mod;
	}
	return ret;
}
int32_t main()
{   
	very_slow
//	no_of_test(x)
	{  
      int n,k;
      cin>>k>>n;
      vector<int>v(n);
      for(int i=0;i<n;i++)
      {
          cin>>v[i];
      }  
      v.push_back(v[0]+k);
      int l=0;
      for(int i=0;i<n;i++)
      {
          l=max(l,(v[i+1]-v[i]));
      }
      cout<<k-l<<'\n';
	}
	return 0;
}

Measured memory_bytes: 6344
#include <iostream>
#include <stdio.h>
#include <vector>
#include <queue>
#include <stack>
#include <algorithm>
#include <set>
#include <map>
#include <deque>
#include <math.h>
#include <string>
#include <iomanip>
#include <locale>
#include <list>
#include <bitset>
#include <tuple>
using namespace std;
#define FORN(i,m,n) for(int i=(m); i<int(n); i++)
#define PRINTVEC(v) FORN(i,0,v.size()) cout<<v[i]<<" "; cout<<endl
#define PRINTMAT(m) FORN(j,0,m.size()) {PRINTVEC(m[j]);}
typedef long long ll;

int main(){
  ios_base::sync_with_stdio(false); cin.tie(NULL);
  ll x; cin>>x;
  ll ans = 0;
  ans += (x / 500) * 1000;
  x %= 500;
  ans += (x / 5) * 5;
  cout<<ans<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define int long long
using namespace std;
const int MOD = 1000000007;
using Graph = vector<vector<int>>;

signed main() {
  int N, K;
  cin >> N >> K;
  vector<int> A(N);
  vector<int> F(N);
  for( int i = 0; i < N; i++ ) cin >> A.at(i);
  for( int i = 0; i < N; i++ ) cin >> F.at(i);
  
  sort(A.begin(), A.end());
  sort(F.rbegin(), F.rend());
  
  int ok = 1e13;
  int ng = -1;
  while( ok-ng > 1 ){
    int mid = (ok+ng)/2;
    int total = 0;
    for( int i = 0; i < N; i++ ){
      int T = A.at(i) - (mid/F.at(i));
      if( T <= 0 ) continue;
      total += T;
    }
    if( total <= K ) ok = mid;
    else ng = mid;
  }
  cout << ok << endl;
}


Measured memory_bytes: 3328
/*input
10
8 5
10 8
6 5
1 5
4 8
2 10
3 6
9 2
1 7
*/
#include<bits/stdc++.h>
#include<unordered_set>
#include<unordered_map>
using namespace std;
#define pb push_back
#define pii pair<int,int>
#define all(v) (v).begin(),(v).end()
#define mpr make_pair
#define MX 1000000007
#define ui unsigned int
#define ll long long
#define ld long double
#define fi first
#define se second
#define testcases int testcases;cin>>testcases;while(testcases--)
#define printvector(v) for(int i=0;i<v.size();i++) cout<<v[i]<<" ";  cout<<endl
#define printarray(v,n)  for(int i=0;i<n;i++) cout<<v[i]<<" ";  cout<<endl
#define inputarray(v,n)  for(int i=0;i<n;i++)cin>>v[i]
#define debug(i) cout<<"debug: "<<i<<endl
#define pr(i) cout<<i<<endl
#define timetaken cerr<<clock()/double(CLOCKS_PER_SEC)<<endl
#define fast_io ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
ll powmod(ll base,ll exp,ll MOD){ll res=1;while(exp>0){if(exp%2==1) res=(res*base)%MOD;base=(base*base)%MOD;exp/=2;}return (res%MOD);}
ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }


class graph{
    unordered_map<int,vector<int>> adjList;
    int n;
public:
    graph(int n){
        this->n = n;
    }
    void addEdge(int a, int b){
        adjList[a].pb(b);
        adjList[b].pb(a);
    }
    
    ll dfs(int from, vector<vector<ll>>&dp, int col, int parent){
        if(dp[from][col] != -1) return dp[from][col];
        
        ll ans = 1;
        for(auto to: adjList[from]){
            ll tmp = 1;
            if(to != parent){
                if(col == 1){
                    tmp = dfs(to, dp, 1-col, from);
                } else {
                    tmp = dfs(to, dp, col, from) + dfs(to, dp, 1-col, from);
                }
            }
            ans = (ans*tmp)%MX;
        }
        return dp[from][col] = ans%MX;
    }
};

// int dp[1000000];

// bool cal(vector<int> &a, int n, int k){
//     if(dp[k] != -1) return dp[k];

//     bool ans = 1;
//     for(int i=0;i<n;++i){
//         if(k>=a[i])
//             ans &= cal(a,n,k-a[i]);
//     }

//     return dp[k] = !ans;
// }

int main() {
    fast_io
    int n;
    cin>>n;
    graph g(n);
    int a,b;
    for(int i=0;i<n-1;++i){
        cin>>a>>b;
        g.addEdge(a,b);
    }

    vector<vector<ll>>dp(n+1,vector<ll>(2,-1));

    ll ans = (g.dfs(1,dp,0,0) + g.dfs(1,dp,1,0))%MX;
    pr(ans);
}

Measured memory_bytes: 49316
import java.util.*;
import java.io.*;
 
public class Main {
    static int[] mx = {1,0,0,-1};
    static int[] my = {0,1,-1,0};
    public static void main(String[] args) throws Exception {
        FastScanner sc = new FastScanner(System.in);
        int n = sc.nextInt();
        int[][] step = new int[n][n];
        for(int i = 0; i < n; i++){
            for(int j = 0; j < n; j++){
                step[i][j] = Math.min(i,Math.min(j,Math.min(n-1-i,n-1-j)));
            }
        }
        long ans = 0;
        boolean[][] removed = new boolean[n][n];
        Deque<Integer> q = new ArrayDeque<Integer>();
        for(int i = 0; i < n*n; i++){
            int now = sc.nextInt()-1;
            int h = now/n;
            int w = now%n;
            ans += step[h][w];
            removed[h][w] = true;
            q.add(now);
            while(q.size() > 0){
                int p = q.poll();
                int Y = p/n;
                int X = p%n;
                int cnt = removed[Y][X] ? step[Y][X] : step[Y][X]+1;
                for(int j = 0; j < 4; j++){
                    int nx = X+mx[j];
                    int ny = Y+my[j];
                    if(check(ny,nx,n) && step[ny][nx] > cnt){
                        step[ny][nx] = cnt;
                        q.add(ny*n+nx);
                    }
                }
            }
        }
        System.out.println(ans);
    }
    
    public static boolean check(int y, int x, int n){
        return (0 <= y && y < n && 0 <= x && x < n);
    }
}

class FastScanner {
    private BufferedReader reader = null;
    private StringTokenizer tokenizer = null;
    public FastScanner(InputStream in) {
        reader = new BufferedReader(new InputStreamReader(in));
        tokenizer = null;
    }

    public String next() {
        if (tokenizer == null || !tokenizer.hasMoreTokens()) {
            try {
                tokenizer = new StringTokenizer(reader.readLine());
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }
        return tokenizer.nextToken();
    }

    public String nextLine() {
        if (tokenizer == null || !tokenizer.hasMoreTokens()) {
            try {
                return reader.readLine();
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }
        return tokenizer.nextToken("\n");
    }

    public long nextLong() {
        return Long.parseLong(next());
    }

    public int nextInt() {
        return Integer.parseInt(next());
    }

    public double nextDouble() {
         return Double.parseDouble(next());
    }

    public int[] nextIntArray(int n) {
        int[] a = new int[n];
        for (int i = 0; i < n; i++)
            a[i] = nextInt();
        return a;
    }

    public long[] nextLongArray(int n) {
        long[] a = new long[n];
        for (int i = 0; i < n; i++)
            a[i] = nextLong();
        return a;
    } 
}


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

int main(){
    int a,b,c,d,e,k;
    cin >> a;
    cin >> b;
    cin >> c;
    cin >> d;
    cin >> e;
    cin >> k;
    vector<int> arr{a,b,c,d,e};
    sort(arr.begin(),arr.end());
    cout << (arr[4] - arr[0] > k ? ":(" : "Yay!") << endl; 
}

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

int main() {
	long long H, W;
	cin >> H >> W;
	long long ans = 1e18;
	{
		if (0 == W % 3) {
			ans = min(ans, (long long)0);
		}
		else {
			ans = min(ans, H);
		}
	}
	{
		if (0 == H % 3) {
			ans = min(ans, (long long)0);
		}
		else {
			ans = min(ans, W);
		}
	}
	{
		for (long long i = 0; i <= H; ++i) {
			long long x = i * W;
			long long y = (H - i)*(W / 2);
			long long z = (H - i)*(W - W / 2);
			long long tmp = max(x, max(y, z)) - min(x, min(y, z));
			ans = min(ans, tmp);
		}
	}
	{
		for (long long i = 0; i <= W; ++i) {
			long long x = i * H;
			long long y = (W - i)*(H / 2);
			long long z = (W - i)*(H - H / 2);
			long long tmp = max(x, max(y, z)) - min(x, min(y, z));
			ans = min(ans, tmp);
		}
	}
	cout << ans << endl;
	return 0;
}

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

int main(){
    int P,Q,R;
    cin >> P >> Q >> R;
    if(P >= Q && P >= R) cout << Q+R << endl;
    else if(Q >= P && Q >= R) cout << P+R << endl;
    else cout << P+Q << endl;
}

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

using namespace std;


int main()
{
  string S;
  cin >> S;
  string T;
  for(auto &c : S) {
    if(T.empty() && c == 'B') continue;
    if(c == 'B') T.pop_back();
    else if(c == '1') T += "1";
    else T += "0";
  }
  cout << T << endl;
}

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() {
    ll N, A, B;
    cin >> N >> A >> B;

    int ans = 0;

    for (int i = 1; i <= N; ++i) {
        int sum = 0;
        int M = i;
        while (M > 0) {
            sum += M % 10;
            M /= 10;
        }
        if (sum >= A && sum <= B) ans += i;
    }
    cout << ans << endl;

}

Measured memory_bytes: 3636
n=int(input())
a=list(input())
b=list(input())
c=list(input())

ans=0

for i in range(n):
    if a[i]==b[i] and b[i]==c[i]:
        continue
    elif a[i]!=b[i] and b[i]==c[i]:
        ans+=1
    elif a[i]!=c[i] and a[i]==b[i]:
        ans+=1
    elif b[i]!=c[i] and a[i]==c[i]:
        ans+=1
    else:
        ans+=2
print(ans)

Measured memory_bytes: 9200
M, K = map(int, input().split())

if K == 0:
    print(*[i//2 for i in range(2**(M+1))])
elif M == 1:
    print(-1)
elif K < 2**M:
    X = [i for i in range(1, 2**M) if i != K]
    print(*([0] + X + [0] + [K] + X[::-1] + [K]))
else:
    print(-1)

Measured memory_bytes: 17428
#include<bits/stdc++.h>
using namespace std;
int main(){
    int a,b;
    cin>>a>>b;
    if(a>b){
        cout<<"a > b"<<endl;
    }
    else if(a<b){
        cout<<"a < b"<<endl;
    }
    else if(a==b){
        cout<<"a == b"<<endl;
    }
}


Measured memory_bytes: 3056
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repm(i, m, n) for (int i = (m); i < (int)(n); i++)
#define repr(i, n) for (int i = (n); i > 0; i--)
#define all(vec) vec.begin(), vec.end()
using namespace std;

int main(){
  int c, a, b;
  //string c;
  cin >> c >> a >> b;

  int ans = 0;
  //string ans = "Yes";
  rep(i, c + 1){
    int s = 0;
    int d = i;
    rep(j, 5){
      s += d % 10;
      d /= 10;
    }
    if (a <= s && s <= b) ans += i;
  }
  
  cout << ans << endl;
}

Measured memory_bytes: 256
x = int(input())
ans = 0
if x == 1:
    print(1)
else:
    for i in range(1,x+1):
        cnt = 2
        while cnt<x:
            if i**cnt > x:
                break
            else:
                ans = max(ans,i**cnt)
                cnt+=1
                

    print(ans)


Measured memory_bytes: 2940
use proconio::*;
use std::*;

fn main() {
    input! {
        a: isize,
        b: isize,
        c: isize,
        d: isize,
    }
    let ans = cmp::max(a*c, cmp::max(a*d, cmp::max(b*c, b*d)));
    println!("{}", ans)
}


Measured memory_bytes: 2172
using System;
using System.Net.NetworkInformation;

class name
{
    static void Main()
    {
       string val = Console.ReadLine();
        string dos = Console.ReadLine();
        int ans = 0;
        for (int s = 0; s < dos.Length; s++)
         {
            char sal = val[s];
            char pom = dos[s];
            if (sal!= pom)
            {
                ans++;
            }

        }
        Console.WriteLine(ans);
    }
}

Measured memory_bytes: 27392
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#include<cmath>
#include<set>
#include<map>
//#include<bits/stdc++.h>
#define int long long
#define mod 1000000007
#define for0(i, n) for(int i = 0; i < (n); i++)
#define for1(i, n) for(int i = 1; i <= (n);i++)
#define mp make_pair
#define all(x) x.begin(),x.end()
using namespace std;
signed main() {
	string s; int ans = 0, cnt = 0; cin >> s;
	for (char ch : s)if (ch == 'A' || ch == 'C' || ch == 'G' || ch == 'T')cnt++; else {ans = max(ans, cnt);cnt=0;} ans = max(ans, cnt); cout << ans << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
main()
{
	long long n,k,min;
	cin>>n>>k;
	if(n>=k)
	{
		long long m=n/k;
		n=n-m*k;	
	}
	if(n>k/2)
	{
		n=abs(n-k);
	}
	cout<<n<<"\n";
}


Measured memory_bytes: 256
/// Bismillahir Rahmanir Rahim
//Author: Tanvir Hussain
//ICE,NSTU
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;

using namespace std;

const long long MOD = 1000000007;
#define SET(x) memset(x, 0, sizeof(x))
#define SET2d(x,m,n) memset(x, 0, sizeof(x[0][0]) * m * n)
#define SETBOOL(x) memset(x,false,sizeof(x))
#define CLR(x) memset(x, -1, sizeof(x))
#define mp make_pair
#define PII pair<int, int>
#define pf printf

#define sf scanf

#define ALL(x) x.begin(),x.end()
#define pb push_back

#define IOS ios::sync_with_stdio(false); cin.tie(0);
#define np std::string::npos
#define for0(i,n) for(int i=0;i<n;i++)
#define forn(i,n) for(int i=n-1;i>=0;i--)
#define highest(x) numeric_limits<x>::max()
#define lowest(x) numeric_limits<x>::min()
#define Inf INFINITY
#define minv(v) *min_element(v.begin(),v.end())
#define maxv(v) *max_element(v.begin(),v.end())
#define cases(cs,t) for(int cs=1;cs<=t;cs++)
#define PI acos(-1)
#define no1 __builtin_popcount
#define BOUNDARY(i, j) ((i >= 0 && i < row) && (j >= 0 && j < column))
#define uniq(vec) vec.resize(distance(vec.begin(),unique(vec.begin(),vec.end())))
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
typedef long long ll;
typedef tree<pair<int, int>,null_type,less<pair<int, int>>,rb_tree_tag,tree_order_statistics_node_update> ordered_multiset;
int dx8[] = {0, 0, 1, 1, 1, -1, -1, -1};
int dy8[] = {1,-1, 1, -1, 0, 0, -1, 1};
int dx4[] = {0, 0, 1, -1};
int dy4[] = {1, -1, 0, 0};
const int maxx=100005;

//this fuction sorts vector pair according to first element in descending order.
bool sortinrev(const pair<int,int> &a,const pair<int,int> &b)
{
    return a.first>b.first;
}

template<typename T>inline T Bigmod(T base, T power, T MOD){
    T ret=1;
    while(power)
    {
        if(power & 1)ret=(ret*base)%MOD;
        base=(base*base)%MOD;
        power>>=1;
    }
    return ret;
}
double sq(double x) {return x*x;}
int ext_gcd(int a, int b, int & x, int & y) {
    //for finding modular inverse
    //if its return 1 ,then a has a mod inverse x mod b.
    if (a == 0) {
        x = 0;
        y = 1;
        return b;
    }
    int x1, y1;
    int d = ext_gcd(b % a, a, x1, y1);
    x = y1 - (b / a) * x1;
    y = x1;
    return d;
}

int main()

{
    IOS;
    //freopen("input.txt", "r", stdin);
     //freopen("output.txt", "w", stdout);
      long long n,k;
     while(cin>>n>>k){
        long long diff=abs(n-k);
        //cout<<diff<<endl;
        if(diff%k==0ll) cout<<0<<endl;
        else {
            cout<<min((k-diff%k),diff)<<endl;
        }
     }

     return 0;

}
///Alhamdulillah


Measured memory_bytes: 256
n = int(input())
w = list(map(int, input().split()))
half_sum = sum(w) / 2

diff = 10000000
part_sum = 0
for val in w:
  part_sum += val
  if diff > abs(half_sum - part_sum):
    diff = abs(half_sum - part_sum)
  else:
    break
print(int(diff*2))

Measured memory_bytes: 3064
n, k = map(int, input().split())
a = [0] * n
b = [0] * n
sum = 0
arr = []
for i in range(n):
    a[i], b[i] = map(int, input().split())
arr_list = list(zip(a, b))
arr_list = sorted(arr_list)
# print(arr_list)
for i in range(n):
    sum += arr_list[i][1]
    # print(sum, arr_list[i])
    if sum >= k:
        answer = arr_list[i][0]
        break

print(answer)


Measured memory_bytes: 19320
S = input()
K = int(input())


if len(set(S)) == 1:
    print(len(S)*K//2)
else:
    i, count1 = 1, 0
    while i < len(S):
        if S[i] == S[i-1]:
            count1 += 1
            i += 2
        else:
            i += 1
    ss = S*2
    i, count2 = 1, 0
    while i < len(ss):
        if ss[i] == ss[i-1]:
            count2 += 1
            i += 2
        else:
            i += 1
    print(count1+(count2-count1)*(K-1))


Measured memory_bytes: 9092
#include <bits/stdc++.h>
using namespace std;
#define rep(i,ini,n) for(int i=ini;i<n;i++)
#define _rep(i,ini,n) for(int i=ini;i>=n;i--)
#define ToEnd(a) a.begin(),a.end()
uint64_t MOD=1000000007;

int main(){
    int K; cin>>K;
    string S; cin>>S;

    if(S.size()<=K){
        cout<<S<<endl;
        
    }else{
        S.replace(K,S.size()-K,"...");
        cout<<S<<endl;
    }
}

Measured memory_bytes: 3624
N = int(input())
s = input()

def makeans(ans):
        for c in s:
                if (ans[-1] == "S") ^ (c == "o") ^ (ans[-2] == "W"):
                        ans += "W"
                else:
                        ans += "S"

        return ans

for initial in ["SS","SW","WS","WW"]:
        ans = makeans(initial)
        if ans[0] == ans[-2] and ans[1] == ans[-1]:
                print(ans[1:-1])
                exit()

print("-1")

Measured memory_bytes: 3504
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int INF = 1LL << 30;
#define REP(i, n) for (ll i = 0; i < n; i++)
#define FOR(i, a, n) for (ll i = a; i < n; i++)

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll n;
    cin >> n;
    ll minRank=0,min=INF;
    REP(i,n){
        ll a,b;
        cin >> a >> b;
        if(minRank<a){
            minRank= a;
            min= b;
        }
    }
    cout << minRank+min << endl;
}

Measured memory_bytes: 256
import sys
import numpy as np

N = int(input())

o = [0] * (N+1)
for i in range(1, 100):
    for j in range(1, 100):
        for k in range(1, 100):
            n = int( ((i+j) * (j+k)) + i*i + k*k)
            if n < (N+1):
                o[n] += 1
            if n > 10001:
                break

for i in range(N):
    print(o[i+1])



Measured memory_bytes: 27244
#include<iostream>
#include<cmath>
#include <vector>
using namespace std;

int main() {

  string S = "";

  cin >> S;

  if (S[2] == S[3] && S[4] == S[5]) {
    cout << "Yes" << endl;
    return 0;
  }

  cout << "No" << endl;

  return 0;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
#define REP(i, n) for(ll i = 0;i < n;i++)
#define ll long long
#define MOD 1000000007

int n;

int main(){
  int n=0;
  cin >> n;
  int ans=0;
  vector<int> h(n);
  REP(i,n){
    cin>>h[i];
  }

  int maxi=0;
  
  REP(i,n-1){
    if (maxi<h[i])h[i]--;
    
    if (h[i]-h[i+1]>=1){ans=-1;break;}
    //if (h[i]-h[i+1]==1){}
    maxi=max(maxi,h[i]);
    //cout<<maxi<<endl;
  }

  if (ans==0){
  cout<<"Yes"<<endl;
  }else{
    cout<<"No"<<endl;
  }
  

  return 0;
}

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

int64_t calc(const vector<int64_t>& acc, int l, int r) {
    return acc[r] - acc[l];
}

int main() {
    int n;
    cin >> n;
    vector<int64_t> A(n);
    vector<int64_t> acc(n+1);
    for (int i = 0; i < n; i++) {
        cin >> A[i];
        if (i == 0) {
            acc[0] = 0;
        } else {
            acc[i] = acc[i - 1] + A[i - 1];
        }
    }
    acc[n] = acc[n-1] + A[n-1];
    int l = 0;
    int r = 0;
    int64_t ans = INT64_MAX;
    for (int m = 0; m < n; m++) {
        int64_t l_sum = calc(acc, 0, m);
        int64_t r_sum = calc(acc, m, n);
        while (l+1 < m && abs(calc(acc, 0, l+1) - calc(acc, l+1, m)) < abs(calc(acc, 0, l) - calc(acc, l, m))) {
            l++;
        }
        while (r < n && abs(calc(acc, m, r+1) - calc(acc, r+1, n)) < abs(calc(acc, m, r) - calc(acc, r, n))) {
            r++;
        }
        int64_t tmp = max({calc(acc, 0, l), calc(acc, l, m), calc(acc, m, r),
                           calc(acc, r, n)}) -
                      min({calc(acc, 0, l), calc(acc, l, m), calc(acc, m, r),
                           calc(acc, r, n)});
        ans = min(ans, tmp);
    }
    cout << ans << endl;
}


Measured memory_bytes: 3328
#include<bits/stdc++.h>
#define ll long long
#define dbl double
#define forn(i,n,k) for(int i=0;i<n;i=i+k)
#define forpn(p,n,k) for(int i=p;i<n;i+=k)
#define for0(n) for(int i=0;i<n;i++)
#define for1(n) for(int i=1;i<=n;i++)
using namespace std;
int no_of_bits(long long n)
{
    int count=0;
    while(n>0)
    {
        n=n>>1;
        count++;
    }
    return count;
}
long long gcd(int a,int b)
{
    if(b==0) return a;
    else return gcd(b,a%b);
}
bool isPrime(int n) {
    
    if (n == 1) {
        return false;
    }

    int i = 2;
  
    while (i*i <= n) {
        
        if (n % i == 0) {
            
            return false;
        }
        i += 1;
    }
    
    return true;
}
int main()
{   ios::sync_with_stdio(0);
    int t;
    // cin>>t;
    t=1;
    cin.tie(0);
    cout.tie(0);
    while(t--)
    {
       int n,w;
       cin>>n>>w;
      vector<ll> dp(w+1);
      for(ll i=0;i<n;i++)
      {
        ll a,b;
        cin>>a>>b;
        for(ll j=w-a;j>=0;j--)
        {
          dp[j+a]=max(dp[j+a],dp[j]+b);
        }
      }
      cout<<dp[w]<<endl;
	}
}

   


Measured memory_bytes: 1024
N=int(input())
count=[0]*(N+1)
for x in range(1,100):
  for y in range(1,100):
    for z in range(1,100):
      n=x*x+y*y+z*z+x*y+y*z+z*x
      if(n<=N):
        count[n]+=1
for i in range(1,N+1):
  print(count[i])

Measured memory_bytes: 9308
#include "bits/stdc++.h"
#define FOR(i, a, b) for (int i = a; i < b; i++)
#define mFOR(i, a, b) for (int i = a; i > b; i--)
#define MP make_pair
#define PB push_back
#define ALL(v) v.begin(), v.end()
#define N 50
#define INF 1000000007
using namespace std;

typedef long long ll;

ll gcd(ll a, ll b) { return b == 0 ? a : gcd(b, a % b); }
ll fceil(ll a, ll b) { return (a % b == 0 ? a / b : a / b + 1); }
int main()
{
   int n, point, a[N] = {}, b[N] = {}, c[N] = {};
   cin >> n;
   for (int i = 0; i < n; i++)
      cin >> a[i];
   for (int i = 0; i < n; i++)
      cin >> b[i];
   for (int i = 0; i < n - 1; i++)
      cin >> c[i];

   point = b[a[0] - 1];
   for (int i = 1; i < n; i++)
   {
      point += b[a[i] - 1];
      if (a[i - 1] + 1 == a[i])
         point += c[a[i - 1] - 1];
   }
   cout << point << endl;
   return 0;
}


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

int main(){
  string str;
  getline(cin,str);

  for(int i=0;i<(int)str.size();i++){
    if('a'<=str[i]&&str[i]<='z'){
      str[i]=str[i]-'a'+'A';
    }else if('A'<=str[i]&&str[i]<='Z'){
      str[i]=str[i]-'A'+'a';
    }
  }
  cout<<str<<endl;
  return 0;
}


Measured memory_bytes: 3148
#include <iostream>
#include <string>
#include <vector>

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

using std::cin;
using std::cout;
using std::endl;
using std::string;
using std::vector;

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

  vector<int> H(N);
  rep(i, N) cin >> H[i];

  bool no = false;
  for (int i = N - 1; i > 0; i--)
  {
    if (H[i] < H[i - 1])
    {
      H[i - 1]--;
    }
    if (H[i] < H[i - 1])
    {
      no = true;
      break;
    }
  }

  if (no)
    cout << "No" << endl;
  else
    cout << "Yes" << endl;

  return 0;
}


Measured memory_bytes: 3780
N,M = map(int,input().split())
A = list(map(int,input().split()))
A.sort()
import bisect
for i in range(M):
    bisect.insort(A,A[-1]/2)
    A.pop(-1)
for i in range(N):
    A[i] = int(A[i])
print(sum(A))

Measured memory_bytes: 87716
import sys
sys.setrecursionlimit(100000000)

line = raw_input().rstrip().split()
N, L = map(int, line)


def solve2(trr, hour=0):
    N = len(trr)
    if sum(trr) == 0:
        return hour
    elif N == 1:
        trr[0] += 1
    elif N == 2:
        if trr[0] > trr[1]:
            trr[0] += 1
        else:
            trr[1] += 1
    elif N > 2:
        if trr[0] > trr[1]:
            trr[0] += 1
        if trr[N-1] > trr[N-2]:
            trr[N-1] += 1
        for i in xrange(1, N-1):
            if N > 2 and trr[i-1] < trr[i] > trr[i+1]:
                trr[i] += 1
    return solve(map(lambda t: 0 if t == L else t, trr), hour+1)


def solve(trr, N):
#    print trr
    if N == 1:
        return L - trr[0]
    elif N == 2:
        return (L - trr[0]) + (L - trr[1])
    best_hour = -1
    peaks = []
    if trr[0] > trr[1]:
        peaks.append(0)
    if trr[N-1] > trr[N-2]:
        peaks.append(N-1)
    peaks += [i for i in xrange(1, N-1) if trr[i-1] < trr[i] > trr[i+1]]
#    print peaks
    for i, p in enumerate(peaks):
        hour1 = hour2 = L - trr[p]
        p_tm1 = p
        while p_tm1+1 < N and trr[p_tm1] > trr[p_tm1+1]:
            hour1 += L - trr[p_tm1+1]
            p_tm1 += 1
        p_tm2 = p
#        print '%d %d' % (p, trr[p_tm2-1])
        while p_tm2-1 > -1 and trr[p_tm2] > trr[p_tm2-1]:
            hour2 += L - trr[p_tm2-1]
#            print hour2
            p_tm2 -= 1
#            print hour2
        if best_hour < hour1:
            best_hour = hour1
        if best_hour < hour2:
            best_hour = hour2
    return best_hour

print solve([int(raw_input().rstrip()) for _ in xrange(N)], N)

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

using namespace std;

int main(int argc, const char *argv[]) {
  int n;
  cin >> n;
  vector<int> vh(n);
  for (int i = 0; i < n; ++i) {
    cin >> vh[i];
  }

  int ans = 0;
  while (true) {
    int l = 0;
    while (l < vh.size() && vh[l] == 0) {
      l++;
    }

    if (l >= vh.size()) {
      break;
    }

    int r = l;
    while (r < vh.size() && vh[r] != 0) {
      vh[r]--;
      r++;
    }

    // [l, r)
    ans++;
  }

  cout << ans << '\n';

  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long
int main() 
{
    ll n,x;
    cin>>n>>x;
    ll c[n],p[n];
    for(ll i=0;i<n;i++)
    cin>>c[i]>>p[i];
    ll dp[n][x+1]={0};
        for(ll i=0;i<n;i++)
 {   for(ll j=0;j<=x;j++)
    {
        dp[i][j]=0;
    }
}
    if(c[0]<=x)
    dp[0][c[0]]=p[0];
    //cout<<dp[0][c[0]]<<endl;
    for(ll i=1;i<n;i++)
    {
        for(ll j=0;j<=x;j++)
        {
            dp[i][j]=dp[i-1][j];//not taking item;
            if(c[i]<=j)
            dp[i][j]=max(dp[i][j],p[i]+dp[i-1][j-c[i]]);
        }
    }
   /* for(int i=0;i<n;i++)
 {   for(int j=0;j<=x;j++)
    {
        cout<<dp[i][j]<<" ";
    }
    cout<<endl;
}*/
    ll ans=*max_element(dp[n-1],dp[n-1]+x+1);
    cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 78336
N=int(input())
bk=list(input())

l=0
R=0
for sbk in bk:
    if sbk==')':
        if l==0:
            R+=1
        else:
            l-=1
    else:
        l+=1



r=0
L=0
for sbk in reversed(bk):
    if sbk=='(':
        if r==0:
            L+=1
        else:
            r-=1

    else:
        r+=1




res='('*R+"".join(bk)+')'*L
print(res)


Measured memory_bytes: 3060
#include <iostream>
#include <iomanip>
#include <vector>
#include <string>
#include <algorithm>
#include <math.h>
#include <map>
using namespace std;

int main() {
    int h, w;
    cin >> h >> w;
    vector<vector<char>> masu(h, vector<char>(w));
    vector<vector<bool>> tf(h, vector<bool>(w, false));
    for (int i = 0; i < h; i++) {
        for (int j = 0; j < w; j++) {
            cin >> masu.at(i).at(j);
            if (masu.at(i).at(j) == '#') {
                tf.at(i).at(j) = true;
            }
        }
    }
    for (int i = 0; i < h - 1; i++) {
        for (int j = 0; j < w; j++) {
            if (masu.at(i).at(j) == '#' && masu.at(i + 1).at(j) == '#') {
                tf.at(i).at(j) = false;
                tf.at(i + 1).at(j) = false;
            }
        }
    }
    for (int i = 0; i < h; i++) {
        for (int j = 0; j < w - 1; j++) {
            if (masu.at(i).at(j) == '#' && masu.at(i).at(j + 1) == '#') {
                tf.at(i).at(j) = false;
                tf.at(i).at(j + 1) = false;
            }
        }
    }
    for (int i = 0; i < h; i++) {
        for (int j = 0; j < w; j++) {
            if (tf.at(i).at(j)) {
                cout << "No" << endl;
                return 0;
            }
        }
    }
    cout << "Yes" << endl;
}

Measured memory_bytes: 256
def split_list(l, n):

    for dx in range(0, len(l), n):
        yield l[dx:dx + n]

H, W = map(int, input().split())
N = int(input())
a = list(map(int, input().split()))
list1 = [0] * H * W

count = 0
for i in range(N):
    for j in range(a[i]):
        list1[count + j] = i + 1
    count += a[i]

ans_list = list(split_list(list1, W))

for i in range(H):
    list2 = list(ans_list[i])
    if i % 2 == 0:
        print(" ".join(map(str, list2)))
    else:
        list2.reverse()
        print(" ".join(map(str, list2)))

Measured memory_bytes: 3696
#include<stdio.h>
#include<math.h>
int prime(int n);

int main(void){
	int i,n,p[10010],s;
	i=0;n=2;
	while(i<10000){
		if(prime(n)==0){p[i++]=n;}
		n++;
	}
	while(1){
		scanf("%d",&n);
		if(n==0){break;}
		s=0;
		for(i=0;i<n;i++){
			s+=p[i];
		}
		printf("%d\n",s);
	}
	return 0;
}
int prime(int n){
	int i;
	if(n==2){return 0;}
	if(n%2==0){return 1;}
	for(i=3;i<sqrt(n)+1;i+=2){
		if(n%i == 0){return 1;}
	}
	return 0;
}

Measured memory_bytes: 636
{-# LANGUAGE ScopedTypeVariables #-}
import qualified Data.ByteString.Char8 as BS

main = do
  n :: Int <- readLn
  vs :: [Int] <- map (read . BS.unpack) . BS.words <$> BS.getLine
  cs :: [Int] <- map (read . BS.unpack) . BS.words <$> BS.getLine
  print $ sum $ filter (> 0) $ zipWith (-) vs cs


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

int f[100005];

int main(void)
{
    int n; cin>>n;
    for(int x=1;x<100;++x){
        for(int y=x;y<100;++y){
            for(int z=y;z<100;++z){
                int s = x*x+y*y+z*z+x*y+y*z+z*x;
                if(x==y && y==z) f[s] += 1;
                else if(x==y || x==z || y==z) f[s] += 3;
                else f[s] += 6;
            }
        }
    }
    for(int i=1;i<=n;++i) cout<<f[i]<<'\n';
    return 0;
}

Measured memory_bytes: 3824
#include<stdio.h>
#define MAX 25
#define NIL -1
 
typedef struct{
  int parent;
  int left;
  int right;
}node;
 
void preParse(int);
void inParse(int);
void postParse(int);
 
node t[MAX];
 
int main(){
  int n, index, root;
  int i;
 
  scanf("%d", &n);
 
  //初期化
  for(i=0;i<n;i++){
    t[i].parent = NIL;
  }
   
  for(i=0;i<n;i++){
    scanf("%d", &index);
    scanf("%d %d", &t[index].left, &t[index].right);
    //右の子と左の子の親を設定
    if(t[index].left != NIL) t[t[index].left].parent = index; 
    if(t[index].right != NIL) t[t[index].right].parent = index;
  }
 
  for(i=0;i<n;i++){
    if(t[i].parent == NIL) root = i;
  }
 
  printf("Preorder\n");
  preParse(root);
  printf("\n");
 
  printf("Inorder\n");
  inParse(root);
  printf("\n");
 
  printf("Postorder\n");
  postParse(root);
  printf("\n");
   
  return 0;
}
 
void preParse(int u){
  if(u == NIL) return;
  printf(" %d", u);
  preParse(t[u].left);
  preParse(t[u].right);
}
 
void inParse(int u){
  if(u == NIL) return;
  inParse(t[u].left);
  printf(" %d", u);
  inParse(t[u].right);
}
 
void postParse(int u){
  if(u == NIL) return;
  postParse(t[u].left);
  postParse(t[u].right);
  printf(" %d", u);
}


Measured memory_bytes: 2104
#include <algorithm>
#include <cmath>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <tuple>
#include <vector>
using namespace std;
typedef long long ll;
ll const INF = 1LL << 60;

int main() {
  ll N;
  cin >> N;
  vector<ll> A(N), back_len(N, 0);
  ll all_len = 0;
  for (int i = 0; i < N; i++) {
    cin >> A[i];
    if (i > 0) {
      back_len[i] = abs(A[i] - A[i - 1]);
      all_len += back_len[i];
    }
  }
  all_len += abs(A[0]);
  all_len += abs(A[N - 1]);
  cout << all_len - back_len[1] - abs(A[0]) + abs(A[1]) << endl;
  for (int i = 1; i < N - 1; i++) {
    cout << all_len - back_len[i] - back_len[i + 1] + abs(A[i + 1] - A[i - 1])
         << endl;
  }
  cout << all_len - back_len[N - 1] - abs(A[N - 1]) + abs(A[N - 2]) << endl;
  return 0;
}

Measured memory_bytes: 4824
#include<iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <cmath>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
int Max = 1000000;
int main(){
  	int K, N;
  	cin >> K >> N;
  	int A[N];

  	int width = 0;
  	for(int i=0;i<N;i++){
  		cin >> A[i];
  	}
  	for(int i=0;i<N-1;i++){
  		width = max(width, A[i+1]- A[i]);
  	}

  	width = max(width, A[0]+ K-A[N-1]);

  	cout << K - width <<endl;

    
  	return 0;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
const ll INF = 100000000;
#define rep1(i, n) for (ll i=0; i<(n); i++) 
#define rep2(i, k, n) for (ll i=k; i<(n); i++)
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }


int main() {
    ll n;
    cin >> n;
    vector<ll> x(n, 0);
    rep1(i, n) cin >> x[i];
    ll ans = INF;
    rep1(p, 100){
        ll sum = 0;
        rep1(i, n) sum += (x[i] - p) * (x[i] - p);
        ans = min(sum, ans);
    }
    cout << ans << endl;
    //printf("%.12f", ans);
}

Measured memory_bytes: 3616
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
int main(){
    vector<vector<int> > vec(3,vector<int>(3)),bingo(3,vector<int>(3,0));
    int n,tmp,ans=0;
    rep(i,3){
        rep(j,3){
            cin >> vec.at(i).at(j);
        }
    }
    cin >> n;
    rep(i,n){
        cin >> tmp;
        rep(j,3){
            rep(k,3){
                if(vec.at(j).at(k)==tmp)bingo.at(j).at(k)=1;
            }
        }
    }
    rep(i,3){
        if(bingo.at(i).at(0)*bingo.at(i).at(1)*bingo.at(i).at(2))ans=1;
    }
    rep(i,3){
        if(bingo.at(0).at(i)*bingo.at(1).at(i)*bingo.at(2).at(i))ans=1;
    }
    if(bingo.at(0).at(0)*bingo.at(1).at(1)*bingo.at(2).at(2)+bingo.at(0).at(2)*bingo.at(1).at(1)*bingo.at(2).at(0))ans=1;
    cout << (ans?"Yes":"No") << endl;
}


Measured memory_bytes: 256
//QQ
class Main{
    public static void main(String[] a){
        int i = 1;
        int j = 1;
        for(;i<10;i++) {
            for(j=1;j<10;j++) {
                System.out.println(i+"x"+j+"="+(i*j));
            }
        }
    }
}

Measured memory_bytes: 16852
#include <bits/stdc++.h>
using namespace std;
#define rep(i,c) for(int i=0;i<(int)c;i++)
#define print(var) cout<<var<<endl;
#define DEBUG(var) cerr<<var<<endl

const int inf = 1000000000;//10^9



int main(){
string S;
cin >> S;
if(S=="AAA"||S=="BBB"){
  print("No");
  return 0;
};
print("Yes");



return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<stdio.h>
#include<algorithm>
using namespace std;
long long n,a[200005],x,y,sum[200005],i,minm;
int main()
{
	while(scanf("%lld",&n)!=EOF)
	{
		sum[0]=0;
		for(i=1;i<=n;i++)
		{
			scanf("%lld",&a[i]);
			sum[i]=sum[i-1]+a[i];
		}
		minm=3000000000000000000;
		for(i=1;i<n;i++)
		{
			x=sum[i];
			y=sum[n]-sum[i];
			//cout<<x<<' '<<y<<endl;
			if(abs(y-x)<minm)
			minm=abs(x-y);
		}
		printf("%lld\n",minm);
	}
	return 0;
}

Measured memory_bytes: 3328
#include <bits/stdc++.h>
#define INF 200000000000000007LL
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef pair<ll,int> P2;
int n;
vector<P> G[100005];
ll dist[100005];
ll ans[100005];
int cnt[100005];
int a[100005],b[100005];

ll labs(ll v){
	if(v<0LL)return -v;
	return v;
}

int dfs(int v,int p){
	int ans=1;
	for(int i=0;i<G[v].size();i++){
		if(G[v][i].first!=p){
			ans+=dfs(G[v][i].first,v);
		}
	}
	return (cnt[v]=ans);
}

ll dp[1000005];

ll dijk(int v){
	priority_queue<P2,vector<P2>,greater<P2> > que;
	que.push(P2(0,v));
	for(int i=0;i<n;i++){
		dp[i]=INF;
	}
	dp[v]=0;
	while(que.size()){
		P2 p=que.top();
		que.pop();
		if(dp[p.second]<p.first)continue;
		for(int i=0;i<G[p.second].size();i++){
			P e=G[p.second][i];
			if(ans[e.second]==-1){
				if(dp[p.second]<dp[e.first]){
					dp[e.first]=dp[p.second];
					que.push(P2(dp[e.first],e.first));
				}
			}else{
				if(dp[p.second]+ans[e.second]<dp[e.first]){
					dp[e.first]=dp[p.second]+ans[e.second];
					que.push(P2(dp[e.first],e.first));
				}
			}
		}
	}
	ll all=0;
	for(int i=0;i<n;i++){
		all+=dp[i];
	}
	return all;
}

int main(void){
	scanf("%d",&n);
	for(int i=0;i<n-1;i++){
		scanf("%d%d",&a[i],&b[i]);
		a[i]--;
		b[i]--;
		G[a[i]].push_back(P(b[i],i));
		G[b[i]].push_back(P(a[i],i));
	}
	for(int i=0;i<n;i++){
		scanf("%lld",&dist[i]);
	}
	dfs(0,-1);
	for(int i=0;i<n-1;i++){
		int nv=min(cnt[a[i]],cnt[b[i]]);
		if(nv*2==n){
			ans[i]=-1;
		}else{
			ll av=min(n-nv,nv);
			ll bv=max(n-nv,nv);
			ans[i]=labs(dist[a[i]]-dist[b[i]])/(bv-av);
		}
	}
	for(int i=0;i<n-1;i++){
		if(ans[i]==-1){
			ll val=dijk(a[i]);
			ans[i]=(dist[a[i]]-val)/((ll)n/2);
		}
		printf("%lld\n",ans[i]);
	}
	return 0;
}

Measured memory_bytes: 19328
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

public class Main {
	private BufferedReader br;
	private long a,b,c;
	private StringTokenizer st;
	private boolean Istrue;

	public static void main(String[] args) throws IOException{
		// TODO Auto-generated method stub
		new Main().start();
	}
	private void start() throws IOException{
		br=new BufferedReader(new InputStreamReader(System.in));
		st=new StringTokenizer(br.readLine());
		a=Integer.parseInt(st.nextToken());
		b=Integer.parseInt(st.nextToken());
		c=Integer.parseInt(st.nextToken());
		Istrue=false;
		for(long i=1;i<b;i++){
			if((a*i)%b==c){
				Istrue=true;
				break;
			}
		}
		if(Istrue){
			System.out.println("YES");
		}
		else{
			System.out.println("NO");
		}
	}
}


Measured memory_bytes: 22740
#include<bits/stdc++.h>
using namespace std;
#define arep(i,x,n) for(int i=int(x);i<(int)(n);i++)
#define rep(i,n) for(long long i = 0;i < n;++i)
#define rrep(i,n) for(int i=int(n-1);i>=0;i--)
#define fs first
#define sc second
#define all(x) (x).begin(), (x).end()
#define pi 3.141592653589793
#define eps 0.00000001
#define INF 1e9+7  
using ll = long long; 
using P=pair<int,int>;
using lP=pair<ll,ll>;
using fP=pair<double,double>;
using PPI=pair<P,int>;
ll const mod=998244353;
//const ll mod=1e9+7;
const ll MAX=300000;
using vi=vector<int>;
using vl=vector<ll>;
using vc=vector<char>;
using vd=vector<double>;
using vs=vector<string>;
using vp=vector<P>;
using vb=vector<bool>;
using vvi =vector<vector<int>>;
using vvl=vector<vector<ll>>;
using vvd=vector<vector<double>>;
using vvc=vector<vector<char>>;
using vvp =vector<vector<P>>;
using vvb=vector<vector<bool>>;
template <typename T>
bool chmax(T &a, const T b){if(a < b){a = b; return true;} return false;}
template <typename T>
bool chmin(T &a, const T b){if(a > b){a = b; return true;} return false;}


//////////////////////////////////////


int main(){
    int a,b;
    cin>>a>>b;
    cout<<a*b<<endl;
    return 0;
}

Measured memory_bytes: 3624
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < n; i++)
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
template<class T> inline bool chmax(T& a, T b) {
  if (a < b) { a = b; return 1; }
  return 0; }
template<class T> inline bool chmin(T& a, T b) {
  if (a > b) { a = b; return 1; }
  return 0; }
vector<vector<int>> children(100005,vector<int>());
vector<int> ans;

int main(void){
  int n,m; cin >> n >> m;
  rep(i,m){
    int a,b; cin >> a >> b;
    a--; b--;
    children[a].push_back(b);
    children[b].push_back(a);
  }
  rep(i,n){
    ans.push_back(-1);
  }
  queue<int> q;
  q.push(0);
  while(!(q.empty())){
    int k = q.front();
    q.pop();
    for(int c : children[k]){
      if(ans[c] == -1){
        ans[c] = k;
      }
      else continue;
      q.push(c);
    }
  }
  for(int i = 1; i < n; i++){
    if(ans[i] == -1){
      cout << "No" << endl;
      return 0;
    }
  }
  cout << "Yes" << endl;
  for(int i= 1; i< n; i++){
    cout << ans[i]+1 << endl;
  }
  return 0;
}


Measured memory_bytes: 10208
#include <stdio.h>
#include <iostream>

int main(int argc, char* argv[]){
  int sum=1;

  int n;
  std::cin >> n;
  int a[n];
  for(int i=0; i<n; i++) std::cin >> a[i];
  
  for(int i=1; i<n; i++){
    if(a[0]<=a[i]){
      sum++;
      a[0]=a[i];
    }
  }
  
  printf("%d",sum);
}

Measured memory_bytes: 256
#include"stdio.h"
int main(){
    int a,b,c;
    scanf("%d %d %d",&a,&b,&c);
    int memo_a=a%b;
    if(memo_a==c)
        printf("YES\n");
    else{
        while(1){
            a+=memo_a;
            if(a%b==memo_a){
                printf("NO\n");
                break;
            }
            if(a%b==c){
                printf("YES\n");
                break;
            }
        }
    }
}



Measured memory_bytes: 1640
// include
// ------------------------------------------------
#include <bits/stdc++.h>
#include <vector>
#include <algorithm>
#include <math.h>

using namespace std;

// func
// ------------------------------------------------
int CalcSumOfDigit(int n);      // 各桁の和を計算する。
string upper(string str);       // 英字を大文字に変換する。
string lower(string str);       // 英字を小文字に変換する。

// define
// ------------------------------------------------
#define all(a)        (a).begin(),(a).end()
#define rall(a)       (a).rbegin(),(a).rend()
#define sz(a)         int((a).size())
#define rep(i,n)      for(int(i)=0;(i)<(n);(i)++)
#define repe(i,n)     for(int(i)=0;(i)<=(n);(i)++)
#define vsort(v)      sort((v).begin(),(v).end())
#define rvsort(v)     sort(rall((v)))
#define vi            vector<int>
#define GCD(a,b)      __gcd((a),(b))
#define LCM(a,b)      (a)/GCD((a),(b))*(b)
#define kiriage(a,b)  ((a)+(b)-1)/(b)

const int INF = 1e9;

// code
// ------------------------------------------------
int main() {

  string s;cin >> s;

  map<char,int> m;

  rep(i,sz(s))
  {
    if(m[s[i]] != 0)
    {
      cout << "no" << endl;
      return 0;
    }
    m[s[i]]++;
  }

  cout << "yes" << endl;
  

  return 0;
}
// funcの実体
// ------------------------------------------------
int CalcSumOfDigit(int n)
{
  int s = 0;
  while(n)
  {
    s += n % 10;
    n = n / 10;
  }
  return s;
}

string upper(string str)
{
  for(auto itr = str.begin();itr != str.end() ; itr++)
  {
    if(97 <= *itr && *itr <= 122)
    {
      *itr = *itr - 32;
    }
  }
  return str;
}

string lower(string str)
{
  for(auto itr = str.begin();itr != str.end() ; itr++)
  {
    if(65 <= *itr && *itr <= 90)
    {
      *itr = *itr + 32;
    }
  }
  return str;
}


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

namespace Program
{
    class MainClass
    {
        public static void Main(string[] args)
        {
            int A = int.Parse(Console.ReadLine());
            int B = int.Parse(Console.ReadLine());
            int C = int.Parse(Console.ReadLine());
            int X = int.Parse(Console.ReadLine());
            int total;
            int count = 0;

            for (int a = 0; a <= A; a++)
            {
                for (int b = 0; b <= B; b++)
                {
                    for (int c = 0; c <= C; c++)
                    {
                        total = 500 * a + 100 * b + 50 * c;
                        if (total == X)
                        {
                            count++;
                        }
                    }
                }
            }
            Console.WriteLine(count);

        }
    }
}



Measured memory_bytes: 11092
n = int(input())
a = list(map(int, input().split(" ")))

b = [0]*(n+1)
for i in range(n, 0, -1):
    count = 0
    j = i
    while j <= n:
        count += b[j]
        j += i
    if count%2 != a[i-1]:
        b[i] = 1

print(sum(b))
ans = []
for i in range(n):
    if b[i+1] == 1:
        ans.append(i+1)

if len(ans) > 0:
    for i in range(len(ans)-1):
        print(ans[i], end=" ")
    print(ans[-1])

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

using namespace std;

#define REP(i,n)	for(int i=0, i##_len=(n); i<i##_len; ++i)
#define REPS(i,s,n)	for(int i=(s), i##_len=(n); i<i##_len; ++i)

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

typedef unsigned int 			uint;
typedef unsigned long long int	ull;
typedef long long int 			ll;

typedef pair<int,int>			P;
typedef vector<int>				V;
typedef vector<V>				VV;

#undef _P
#define _P(...) (void)printf(__VA_ARGS__)
#define MAX 		100050

const ll LINF = (ll)1e18+7;		//
const int INF = 1e9+7;			//2,147,483,647 (Max int)
const int MOD = 1e9+7;
// テンプレ終了
//====================================================================//




//
int main(){
	int N;cin>>N;
	V A(N);
	REP(i,N)cin>>A[i];
	V B(N);
	iota(ALL(B),1);

	int cnt = 0;
	REP(i,N){
		if(A[i] != B[i] )cnt++;
	}

	cout << (cnt > 2 ? "NO" : "YES") << endl;

	return 0;
}




Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int H = sc.nextInt();
        int N = sc.nextInt();
        for(int i=0;i<N;i++){
            H -= sc.nextInt();
        }
        if(H > 0){
            System.out.println("No");
        }else{
            System.out.println("Yes");
        }

    }
}


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

#define DUMP(x) cerr << #x << "=" << x << endl
#define DUMP2(x, y) cerr<<"("<<#x<<", "<<#y<<") = ("<<x<<", "<<y<<")"<< endl
#define BINARY(x) static_cast<bitset<16> >(x)

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

#define in_range(x, y, w, h) (0<=(int)(x) && (int)(x)<(int)(w) && 0<=(int)(y) && (int)(y)<(int)(h))
#define ALL(a) (a).begin(),(a).end()

typedef long long ll;
const int INF   = 1e9;
const ll  INFLL = 1e18;
typedef pair<int, int> PII;
int dx[4]={0, -1, 1, 0}, dy[4]={-1, 0, 0, 1};

class BIT {
    int n;
    vector<int> dat;

public:
    BIT(int _n) : n(_n), dat(vector<int>(_n+1)) {}

    void add(int i, int x)
    {
        while (i <= n) {
            dat[i] += x;
            i += i & -i;
        }
    }

    int sum(int i)
    {
        int res = 0;
        while (i > 0) {
            res += dat[i];
            i -= i & -i;
        }
        return res;
    }

    // [l, r]
    int sum(int l, int r)
    {
        return sum(r) - sum(l-1);
    }
};

int main()
{
    ios::sync_with_stdio(false);

    int N;
    cin >> N;
    vector<PII> A(N);
    rep(i, N) {
        cin >> A[i].first;
        A[i].second = i;
    }
    sort(ALL(A));

    int ans = 0;
    rep(i, N) {
        if (i%2 != A[i].second%2) ans++;
    }

    cout << ans/2 << endl;
}



Measured memory_bytes: 1024