akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<cstdio>
#include<cmath>
#include<cctype>
#include<climits>
#include<vector>
#include<set>
#include<map>
#include<string>
#include<queue>
#include<unordered_map>
#include<unordered_set>
#include<algorithm>
#include<utility>
#include<iomanip>
//#include<ext/pb/ds/assoc_container.hpp>

#define setbits(x) __builtin_popcountll(x)
#define zrobits(x) __builtin_ctzll(x)
#define fast_io ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
//mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

using namespace std;
//using namespace __gnu_pbds;

//typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pbds;
typedef long long int lld;
typedef long double real;

lld mod = 1e9+7;

template<typename T>
void input_vector(vector<T>& v, lld n, lld start=0) {
	for(lld i=start; i<n; ++i) 
		cin>>v[i];
}

template<typename T>
void display_vector(vector<T> v, lld start=0, string sep=" ") {
	for(lld i=start; i<v.size(); ++i)
		cout<<v[i]<<sep;
	cout<<"\n";
}

void fillPrimes(vector<lld>& sieve, vector<lld>& primes) {
	lld i, j;
	
	for(i=2*2; i<sieve.size(); i+=2) 
		sieve[i]=0;
	
	j=3;
	while(j<sieve.size()) {
		for(i=j*j; i<sieve.size(); i+=(2*j)) {
			sieve[i]=0;
		}
		
		// get next prime
		for(i=j+1; i<sieve.size(); ++i)
			if(sieve[i]) {
				j=i;
				break;
			}
		if(i==sieve.size())
			break;
	}
	
	for(i=2; i<sieve.size(); ++i) {
		if(sieve[i])
			primes.push_back(i);
	}
}

vector<pair<lld, lld>> factorize(lld n, vector<lld> primes) {
	vector<pair<lld, lld>> factors;
	lld tmp=n;
	for(lld i=0; primes[i]*primes[i]<=n; ++i) {
		if(tmp%primes[i]==0){
			pair<lld, lld> pr = {primes[i], 0};
			while(tmp%primes[i]==0) {
				pr.second++;
				tmp /= primes[i];
			}
			factors.push_back(pr);
		}
	}
	if(tmp>1)
		factors.push_back({tmp, 1});
	return factors;
}

void solve() {
	
}

int main() {
	lld t=1;
	//cin>>t;
	
	for (lld cs=1; cs<=t; ++cs) {
		lld a, b;
		cin>>a>>b;
		cout<<a*b<<"\n";
		//solve();
	}
	
	return 0;
}

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

using namespace std;

using ll = long long;
using P = pair<ll, ll>;
using Graph = vector<vector<ll>>;
#define rep(i, n) for(ll i=0;i<(ll)(n);i++)
#define rep2(i, m, n) for(ll i=m;i<(ll)(n);i++)
#define rrep(i, n, m) for(ll i=n;i>=(ll)(m);i--)
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
const int ddx[8] = {0, 1, 1, 1, 0, -1, -1, -1};
const int ddy[8] = {1, 1, 0, -1, -1, -1, 0, 1};
const ll MOD = 1000000007;
const ll INF = 1000000000000000000L;
#ifdef __DEBUG

/**
 * For DEBUG
 * https://github.com/ta7uw/cpp-pyprint
 */
#include "cpp-pyprint/pyprint.h"

#endif

void solve() {
    ll X;
    cin >> X;
    ll L = (360 * X) / gcd(X, 360);
    cout << L / X << '\n';
}

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


Measured memory_bytes: 3636
#include <iostream>
#include <cstdlib>
#include <utility>
#include <algorithm>

using namespace std;
using ll = long long;

int main() {
    ll x; cin >> x;
    ll a = 100;
    ll iter = 0;
    while (a < x) {
        a = ll(double(a) * 1.01);
        iter++;
    }
    cout << iter << endl;
}

Measured memory_bytes: 3620
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
#define MOD 1000000007
using namespace std;
int main()
{
    int n,m;
    cin >> n >> m;
    long long int a[n];
    for(int i = 0;i < n;i++)
    {
        cin >> a[i];
    }
    pair<long long int,long long int> p[m];
    for(int i = 0;i < m;i++)
    {
        long long int b,c;
        cin >> b >> c;
        p[i] = make_pair(c,b);
    }
    sort(a,a + n);
    sort(p,p + m,greater<pair<int,int> >());
    int k = 0;
    bool flag = true;
    for(int i = 0;k < n && i < m;i++)
    {
        while(p[i].second > 0)
        {
            if(p[i].first < a[k])
            {
                flag = false;
                break;
            }
            a[k] = p[i].first;
            p[i].second--;
            k++;
        }
        if(!flag)
        {
            break;
        }
    }
    long long int ans = 0;
    for(int i = 0;i < n;i++)
    {
        ans += a[i];
    }
    cout << ans << "\n";

    return 0;
}

Measured memory_bytes: 2560
#!/usr/bin/env python3
import sys

YES = "Yes"  # type: str
NO = "No"  # type: str


def solve(S: str):

    if (len(S)%2 != 0):
        print(NO)
    
    else:
        for x in range(len(S)//2):
            if S[2*x:2*x+2] != "hi":
                print(NO)
                return
    
        print(YES)
    return


# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    S = next(tokens)  # type: str
    solve(S)

if __name__ == '__main__':
    main()


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

int main(){

  long long N, T, t[200010], sum=0;

  cin>>N>>T;

  for(int i=1;i<=N;i++){
    cin>>t[i];
    if(i>1){
      if(t[i]-t[i-1]<T) sum+=t[i]-t[i-1];
      else sum+=T;
    }
  }

  cout<<sum+T<<endl;
  
  return 0;
}

Measured memory_bytes: 1792
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.*;

public class Main {
  private static 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;
    }
  }

  public static void main(String[] args) {
    FastScanner sc = new FastScanner(System.in);
    int h = sc.nextInt();
    int w = sc.nextInt();
    int[][] a = new int[h][w];
    for (int i = 0; i < h; i++) {
      a[i] = sc.nextIntArray(w);
    }
    List<int[]> path = new ArrayList<>();
    for (int i = 0; i < h; i++) {
      if (i % 2 == 0) {
        for (int j = 0; j < w; j++) {
          path.add(new int[] {i, j});
        }
      } else {
        for (int j = w - 1; j >= 0; j--) {
          path.add(new int[] {i, j});
        }
      }
    }
    List<String> result = new ArrayList<>();
    for (int k = 0; k < h * w - 1; k++) {
      int[] from = path.get(k);
      if (a[from[0]][from[1]] % 2 == 0) continue;
      int[] to = path.get(k + 1);
      a[from[0]][from[1]]--;
      a[to[0]][to[1]]++;
      result.add(String.format("%d %d %d %d", from[0] + 1, from[1] + 1, to[0] + 1, to[1] + 1));
    }
    StringBuilder sb = new StringBuilder();
    sb.append(result.size());
    for (String s : result) {
      sb.append("\n");
      sb.append(s);
    }
    System.out.println(sb.toString());
  }
}

Measured memory_bytes: 158584
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define YES cout<<"YES"<<endl
#define NO cout<<"NO"<<endl
#define Yes cout<<"Yes"<<endl
#define No cout<<"No"<<endl
#define ANS cout << ans << endl
#define all(a) a.begin(),a.end()
#define SORT(a) sort(all(a))
#define REVERSE(a) reverse(all(a))
#define int long long
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define VIin(a) for(int i=0; i<a.size(); i++) cin >> a[i]
#define OUT(a) cout << a << endl
typedef vector<int> VI;
typedef vector<VI> VVI;
const int MOD=1e9+7;
const long long INF = 1LL << 60;
/*最大公約数*/int gcd(int x, int y) { return y ? gcd(y,x%y) : x;}
/*最小公倍数*/int lcm(int a, int b) { int g = gcd(a, b); return a / g * b; }
/*素数判定*/int isPrime(int n){if(n<2){return 0;}for(int i=2; i*i<=n; i++){if(n%i==0){return 0;}}return 1;}
/*約数列挙*/vector<int> getDivisor(int n){vector<int> v; for(int i=1; i*i<=n; i++){if(n%i==0){v.push_back(i);if(i!=n/i){v.push_back(n/i);}}}sort(v.begin(),v.end()); return v;}
//----------------------------------------------
signed main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    
    string s,t; cin >> s >> t;
    rep(i,s.size()){
        if(s == t){
            Yes;
            return 0;
        }else s = s.back() + s.substr(0,s.size()-1);
    }
    No;

    return 0;
}



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

int gcd(int x,int y){
    if(y==0)return x;
    x=x%y;
    gcd(y,x);
}

int digitPoor(int n)
{
    if (n < 10)         return 1;
    else if (n < 100)        return 2;
    else if (n < 1000)       return 3;
    else if (n < 10000)      return 4;
    else if (n < 100000)     return 5;
    else if (n < 1000000)    return 6;
    else if (n < 10000000)   return 7;
    else if (n < 100000000)  return 8;
    else if (n < 1000000000) return 9;
    else if (n < 10000000000) return 10;
    else if (n < 100000000000) return 11;
    else if (n < 1000000000000) return 12;
    else if (n < 10000000000000) return 13;
    else if (n < 100000000000000) return 14;
    else if (n < 1000000000000000) return 15;
    else if (n < 10000000000000000) return 16;
    else if (n < 100000000000000000) return 17;
    else if (n < 1000000000000000000) return 18;
}

main()
{
    int n;
    cin>>n;
    int ans=n/1.08;
    int c=0;
        if(ans*1.08==n) {
            cout<<ans<<endl;
            c=1;
    }else if((int)((ans+1)*1.08)==n){
        cout<<ans+1<<endl;
        c=1;
    }
if(c==0) cout<<":("<<endl;
}

Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#include <vector>
int main(int argc, char *argv[]) {
	size_t n;
	int t;
	std::cin >> n >> t;
	typedef struct {
		int c;
		int t;
	} ct_t;
	std::vector<ct_t> v;
	for (size_t i = 0; i < n; i++) {
		ct_t ct;
		std::cin >> ct.c >> ct.t;
		if (ct.t <= t) {
			v.push_back(ct);
		}
	}
	const size_t nv = v.size();
	if (nv == 0) {
		std::cout << "TLE" << std::endl;
	} else {
		const auto v_min = *std::min_element(
			v.begin(), v.end(),
			[] (const auto &l, const auto &r) { return (l.c < r.c); }
		);
		std::cout << v_min.c << std::endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <list>
#include <queue>
#include <algorithm>
#define rep(i, n) for(i = 0; i < (n); i++)
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
#define MOD 1000000007
#define PI 3.14159265358979323846
#define INF 1 << 30

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

ll Pow(ll n, ll k) {
	ll ans = 1, a = n % MOD;
	while (k > 0) {
		if (k & 1) {
			ans *= a;
			ans %= MOD;
		}
		a *= a;
		a %= MOD;
		k >>= 1;
	}
	return ans;
}

ll Inverse(ll a) {
	return Pow(a, MOD - 2);
}

//nCaを計算、a < 0 の時 0
ll Combi(ll n, ll a, vector<ll> & k) {
	a = min(a, n - a);
	if (a < 0)
		return 0;
	else if (a == 0)
		return 1;
	ll ans = k[n] * Inverse(k[a]) % MOD;
	return ans * Inverse(k[n - a]) % MOD;
}

// d[n] = n! の配列初期化
void Ini_fact(vector<ll> & d) {
	d[1] = 1;
	for (ll i = 2; i < d.size(); i++)
		d[i] = d[i - 1] * i % MOD;
	return;
}

int main(void) {
	ll num, i, k, ans = 0;
	char c = 'a';
	string s;
	vector<ll> kai(2000010);
	cin >> num >> s;
	vector<vector<ll>> dp(27, vector<ll>(num + 1, 0));
	Ini_fact(kai);
	rep(i, num + 1) {
		k = Pow(25, i) * Pow(26, num - i) % MOD;
		k *= Combi(s.size() + i - 1, i, kai);
		k %= MOD;
		ans += k;
		ans %= MOD;
	}
	cout << ans << "\n";
	return 0;
}

Measured memory_bytes: 238980
#include <bits/stdc++.h>
using namespace std;
#define repr(i,a,b) for(int i=a;i<b;i++)
#define rep(i,n) for(int i=0;i<n;i++)
#define reprrev(i,a,b) for(int i=b-1;i>=a;i--) // [a, b)
#define reprev(i,n) reprrev(i,0,n)
typedef long long ll;
typedef unsigned long long ull;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

/* attention
    long longのシフト演算には気をつけよう
    タイポした時のデバッグが死ぬほどきつくなるので変数名は最低3字くらい使った方がいいかも
    sizeは(int)とキャストしよう
    cin.tie(0);
    ios::sync_with_stdio(false);<- これら、printfとかと併用しない方が良さそう

*/

const ll mod = 1e9+7;

void chmod(ll &M){
    if(M >= mod) M %= mod;
    else if(M < 0){
        M += (abs(M)/mod + 1)*mod;
        M %= mod;
    }
}

ll modpow(ll x, ll n){
    if(n==0) return 1;
    ll res=modpow(x, n/2);

    if(n%2==0) return res*res%mod;
    else return res*res%mod*x%mod;
}

int getl(int i, int N) { return i==0? N-1:i-1; };
int getr(int i, int N) { return i==N-1? 0:i+1; };


// 線分 ab の偏角 返り値は[-π, π]
double argument(const pair<double, double> &a, const pair<double, double> &b){
    double ax=a.first, ay=a.second, bx=b.first, by=b.second;
    return atan2(by-ay, bx-ax);
}

/* <-----------------------------------------------------------------------------------> */
/* <-----------------------------------------------------------------------------------> */
/* <-----------------------------------------------------------------------------------> */
/* <-----------------------------------------------------------------------------------> */


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

    ll n; cin >> n;
    if(n%2 == 0) cout << n/2 - 1 << endl;
    else cout << n/2 << endl;

    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cmath>
#include<cstring>
#include<algorithm>
using namespace std;

int n;
int a[200005];
int main()
{
	int i;
	cin>>n;
	for(i=1;i<=n;i++)
		cin>>a[i];
	sort(a+1,a+1+n);
	cout<<abs(a[n]-a[1]);
	return 0;	
} 



Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long
#define pb push_back
#define mod 1000000007
#define ff first
#define ss second
using namespace std;
/*ll power(ll x,ll y)
{
    ll res=1;
    while(y>0)
    {
        if(y%2==1)
            res=(res*x)%mod;
        x=(x*x)%mod;
        y=y/2;
    }
    return res;
}*/
int main()
{
ll n,i,m,c=0;
cin>>n;
vector<ll>v;
for(i=0;i<n;i++)
{
    cin>>m;
    v.pb(m);
}
for(i=1;i<n-1;i++)
{
    if(v[i]<v[i-1] && v[i]>v[i+1])
        c++;
    else if(v[i]>v[i-1] && v[i]<v[i+1])
        c++;
}
cout<<c<<endl;
}


Measured memory_bytes: 256
n,a,b = map(int,input().split())

ans = 0

for i in range(1,n+1):
  str_i = str(i)
  total = 0
  for j in range(len(str_i)):
    total += int(str_i[j])
  if a<=total and total<=b:
    ans +=i

print(ans)

Measured memory_bytes: 3316
#include<stdio.h>
int main()
{
	long long int n, a, b;
	scanf("%lld %lld %lld", &n, &a, &b);
	if (a > b)
	{
		long long int f = a;
		a = b;
		b = f;
	}
	if ((b - a) % 2 == 0)
	{
		printf("%lld\n", (b - a) / 2);
		return 0;
	}
	if (a - 1 < n - b)
		printf("%lld\n", a + (b - a) / 2);
	else
		printf("%lld\n", n - b + (b - a + 1) / 2);
	return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
#define REP(i, m, n) for(int (i) = (m); (i) < (n); ++i)
#define rep(i, n) REP(i, 0, n)
#define all(x) (x).begin(), (x).end()
using namespace std;
using Graph = vector<vector<int>>;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
typedef long long ll;
typedef pair<ll, ll> P;
const int INF = 1e9+7;
const ll LINF = 1LL<<60;

int main()
{
    cin.tie(0);
    ios_base::sync_with_stdio(0);
    string o, e;
    cin >> o >> e;

    int no = o.length();
    int ne = e.length();

    rep(i, no + ne) {
        if (i % 2 == 0) cout << o[i/2];
        else cout << e[i/2];
    }
    cout << endl;

    return 0;
}

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

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

int gcd(vector<int> a) {
  int answer = a.at(0);
  for(int i = 1; i < a.size(); i++) {
    answer = gcd(answer, a.at(i));
  }
  return answer;
}

int main() {
  int N; cin >> N;
  vector<int> nums(N, 0);
  
  for (int i = 0; i < N; i++) cin >> nums.at(i);
  
  cout << gcd(nums) << endl;
  return 0;
}

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

typedef long long ll;
typedef pair<int,int> pii;
typedef map<int,int> mkmap;
typedef vector<int> vi;
typedef vector<string> vs;
typedef vector<pii> vp;
typedef vector<vi> vv;

#define fast ios_base::sync_with_stdio(false),cin.tie(NULL),cout.tie(NULL)
const ll mod=1000000007;
const int sz=1000001;
#define endl "\n"
#define all(a) (a).begin(),(a).end()
#define rep(i,a,b) for(i=a;i<b;++i)
#define rrep(i,a,b) for(i=a;i>=b;--i)
#define F first
#define S second
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define db(x) cout << (#x) << " = " << x << endl;

inline ll mult(ll a, ll b) {return (((a % mod) * (b % mod)) % mod);}



int main(){
    fast;
    int t,tt,tti,n,m,x,y,z,i,j,k,temp,count,o,e,f,ans,sum,l,r,mx,mn;
    ll lx,ly,lz,ltemp;
    double fx,fy,fz;
    string s;
    
    char c;
    cin>>c;
    cout<<char(c+1);
}

/*
    
*/

Measured memory_bytes: 3580
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
typedef long long ll;
int a[55];
int val[200005];
int vis[200005];
vector<int>adj[200005];
int ans[200005];
void dfs(int ele, int sum) {
    vis[ele] = 1;
    for(int i=0;i<adj[ele].size();i++) {
        if(!vis[adj[ele][i]]) {
            dfs(adj[ele][i], sum+val[adj[ele][i]]);
        }
    }
    ans[ele] = sum;
}
int main() {
    int n,q;
    cin>>n>>q;
    for(int i=0;i<n-1;i++) {
        int a,b;
        cin>>a>>b;
        adj[a].pb(b);
        adj[b].pb(a);
    }
    for(int i=0;i<q;i++) {
        int p,x;
        cin>>p>>x;
        val[p] += x;
    }
    dfs(1, val[1]);
    for(int i=1;i<=n;i++) {
        cout<<ans[i]<<" ";
    }
    cout<<endl;
}


Measured memory_bytes: 24832
import sys
def input(): return sys.stdin.readline().strip()


def main():
    N = int(input())
    X = input()
    bit_num = X.count("1")

    X_minus = [0] * N # X_minus[i] = 2^i mod (bit_num - 1)
    X_plus = [0] * N # X_plus[i] = 2^i mod (bit_num + 1)
    X_minus[0], X_plus[0] = 1, 1
    for i in range(1, N):
        if bit_num != 1: X_minus[i] = (X_minus[i - 1] * 2) % (bit_num - 1)
        X_plus[i] = (X_plus[i - 1] * 2) % (bit_num + 1)
    #print("X_minus={}".format(X_minus))
    #print("X_plus={}".format(X_plus))

    rem_minus = 0
    rem_plus = 0
    for i in range(N):
        if X[N-i-1] == '1':
            if bit_num != 1: rem_minus = (rem_minus + X_minus[i]) % (bit_num - 1)
            rem_plus = (rem_plus + X_plus[i]) % (bit_num + 1)
    #print(rem_minus, rem_plus)

    for i in range(N):
        if X[i] == '0':
            bit = bit_num + 1
            n = (rem_plus + X_plus[-i-1]) % bit
        if X[i] == '1':
            bit = bit_num - 1
            if bit != 0: n = (rem_minus - X_minus[-i-1]) % bit
        if bit == 0 or bit == 1:
            print(bit)
            continue

        cnt = 1
        while n != 0:
            bit = bin(n).count("1")
            n %= bit
            cnt += 1
        print(cnt)




if __name__ == "__main__":
    main()


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

int main() {
    int n, m, c;
    int b[22];
    int a[22][22];
    int sum;
    int ans = 0;
    
    cin >> n >> m >> c;
    
    for (int i = 0; i < m; i++) {
        cin >> b[i];
    }
    
    for (int i = 0; i < n; i++) {
        for (int ii = 0; ii < m; ii++) {
            cin >> a[i][ii];
        }
    }
    
    for (int i = 0; i < n; i++) {
        sum = 0;
        
        for (int ii = 0; ii < m; ii++) {
            sum += a[i][ii] * b[ii];
        }
        
        sum += c;
        
        if (sum > 0) {
            ans++;
        }
    }
    
    cout << ans << endl;
    return 0;
}

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

#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define reps(i,s,n) for(int (i)=(s);(i)<(n);(i)++)
#define repr(i,n) for(int (i)=(n)-1;(i)>=0;(i)--)
#define forin(x,n) for(auto& (x) : n)
#define all(v) (v).begin(),(v).end()
#define chmax(a, b) a = (((a)<(b)) ? (b) : (a))
#define chmin(a, b) a = (((a)>(b)) ? (b) : (a))
#define mp make_pair
#define pb push_back
#define MOD 1000000007
#define inf 1000000000
#define llinf 1000000000000000
#define MAX 1000000


typedef long long ll;
typedef vector<int> vint;
typedef vector<ll> vll;
typedef pair<int,int> pint;
typedef pair<ll,ll> pll;
typedef vector<pint> vpint;
typedef pair<int,pint> P;

int main(){
    int n,m;
    cin>>n>>m;
    vint a(n);
    vector<pint> b(m);
    vint d(n);

    rep(i,n)cin>>a[i];

    rep(i,m){
        int tt,tt2;
        cin>>tt>>tt2;
        b[i]=mp(tt2,tt);
    }
    sort(all(b));
    reverse(all(b));
    int count=0;
    rep(i,m){
        rep(j,b[i].second){
            d[count]=b[i].first;
            count++;
            if(count>=n)break;
        }
        if(count>=n)break;
    }
    if(count<n){
        reps(i,count,n){
            d[i]=0;
        }
    }
    sort(all(a));
    ll ans=0;
    rep(i,n){
        ans+=(ll)max(a[i],d[i]);
    }
    cout<<ans<<endl;

    
}

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

using namespace std;
typedef long long ll;

const int N = int(1e8) + 7;

void init(){

}

void solve(){
    char c[100007];
    scanf("%s", c);
    int n = strlen(c);
    int ans = 0;
    for(int i = 0; i < n; i++){
        if(i%2 == 0 && c[i] == '0') ans++;
        if(i%2 == 1 && c[i] == '1') ans++;
    }
    int k = 0;
    for(int i = 0; i < n; i++){
        if(i%2 == 0 && c[i] == '1') k++;
        if(i%2 == 1 && c[i] == '0') k++;
    }
    ans = min(ans, k);
    printf("%d\n", ans);
}

const bool mtc = false;

int main(){
    int t;
    if(mtc){
        scanf("%d", &t);
        while(t--) solve();
    }
    else solve();
}


Measured memory_bytes: 384
from math import atan2, sqrt

def main():
    n = int(input())
    engines = [list(map(int, input().split())) for _ in range(n)]
    for i in range(n):
        rad = atan2(engines[i][1], engines[i][0])
        engines[i].append(rad)
    engines.sort(key=lambda x: x[2])
    ans = 0
    for k in range(1, n+1):
        for i in range(n):
            x_sum, y_sum = 0, 0
            for j in range(i, i+k):
                p = j%n
                x_sum += engines[p][0]
                y_sum += engines[p][1]
            tmp = x_sum**2 + y_sum**2
            if ans < tmp:
                ans = tmp
    print(sqrt(ans))

if __name__ == "__main__":
    main()

Measured memory_bytes: 9452
A, B = map(int, input().split())
S = input()

nums = [str(i) for i in range(10)]

if (A + B + 1) != len(S):
    print('No')
    exit(0)

for i in range(len(S)):
    if i == A:
        if S[i] != '-':
            print('No')
            exit(0)
    else:
        if not S[i] in nums:
            print('No')
            exit(0)

print('Yes')


Measured memory_bytes: 3060
#include<cstring>
#include<cstdlib>
#include<cstdio>
#include<cmath>
#include<iostream>
#include<algorithm>
#define N 3100
#define inf (1e9)+1
using namespace std;
struct node{int y,nex;}a[2*N];
int f[N],g[N],n,fir[N],len,d[N],num,A[N];
void ins(int x,int y)
{
	a[++len].y=y;a[len].nex=fir[x];fir[x]=len;
}
void dfs(int x,int fa)
{
	f[x]=d[x];
	for(int k=fir[x];k;k=a[k].nex)
	{
		int y=a[k].y;
		if(y==fa) continue;
		dfs(y,x);
		if(d[x]>f[y]) f[x]=inf;
	}
}
void dp(int x,int fa)
{
	int cnt=0;
	for(int k=fir[x];k;k=a[k].nex)
	{
		int y=a[k].y;
		if(y==fa) continue;
		if(d[x]>f[y]) cnt++;
	}
	if(d[x]>g[fa]) cnt++;
	if(cnt) A[++num]=x;
	for(int k=fir[x];k;k=a[k].nex)
	{
		int y=a[k].y;
		if(y==fa) continue;
		int t=cnt;
		if(d[x]>f[y]) t--;
		if(t) g[x]=inf;
		else g[x]=d[x];
		dp(y,x);
	}
}
int main()
{
	scanf("%d",&n);
	for(int i=1;i<=n;i++) scanf("%d",&d[i]);
	for(int i=1;i<n;i++)
	{
		int x,y;scanf("%d%d",&x,&y);
		ins(x,y);ins(y,x);
	}
	dfs(1,0);
	g[0]=inf;
	dp(1,0);
	sort(A+1,A+num+1);
	for(int i=1;i<=num;i++) printf("%d ",A[i]);
	return 0;
}

Measured memory_bytes: 512
import sys
input = sys.stdin.readline
#n = int(input())
#l = list(map(int, input().split()))
'''
A=[]
B=[]
for i in range():
    a, b = map(int, input().split())
    A.append(a)
    B.append(b)'''

n, k = map(int, input().split())
a = list(map(int, input().split()))

cnt=0
now=1
cyc=0
visited=[0]*n
flg=False
for i in range(k):
    cnt+=1
    now=a[now-1]
    visited[now-1]+=1
    if visited[now-1]==2:
        cyc+=1
        #print(cyc)
    if visited[now-1]==3:
        flg=True
        #print(visited,cyc,now)
        #cyc-=1
        break
    #print(visited,now)
#print(cyc, cnt, now, (k-cnt+2*cyc) % cyc)
if flg:
    for i in range((k-cnt+2*cyc)%cyc):
        now=a[now-1]
    print(now)
else:
    print(now)


Measured memory_bytes: 31716
#include<iostream>
#include<vector>
#include<cstdio>
#include<string>
#include<algorithm>
using namespace std;
typedef long long ll ;

int main(){
  int n,m;
  cin >> n >> m;
  if(n<m){
    int x[m];
    for(int i=0;i<m;i++){
      cin >> x[i];
    }
    sort(x,x+m);
    int dif_x[m-1];
    for(int i=0;i<m-1;i++){
      dif_x[i]=x[i+1]-x[i];
    }
    sort(dif_x,dif_x+(m-1));
    int ans =0;
    for(int i=0;i<m-n;i++){
      ans += dif_x[i];
    }
    cout << ans << endl;
    return 0;
  }
  else{
    int x[m];
    for(int i=0;i<m;i++){
      cin >> x[i];
    }
    int ans = 0;
    cout << ans << endl;
    return 0;
  }
}


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

using namespace std;
using llong = long long;
using P = pair<llong, llong>;

#define BE(x) x.begin(), x.end()

const llong inf = llong(1e18)+7;
const llong mod = 1e9+7;

int main(){
	int N;
	vector<int> s;

	cin >> N;
	s.resize(N+1,0);
	int sum = 0;
	for(int i = 0; i < N; i++){
		cin >> s[i];
		sum += s[i];
	}

	sort(BE(s));
	for(int i = 0; i < s.size(); i++){
		if((sum - s[i]) % 10){
			cout << sum - s[i] << endl;
			return 0;
		}
	}

	cout << 0 << endl;
	return 0;

	return 0;
}

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

const int MOD = 1000000007;

int main()
{
    int a, b, c, x, y;
    cin >> a >> b >> c >> x >> y;
    int ans = 0;
    if(x>y){
        ans = 2 * c * y + a * (x - y);
    }
    else{
        ans = 2 * c * x + b * (y - x);
    }
    cout << min({a * x + b * y, c * 2 * max(x, y), ans});
}

Measured memory_bytes: 256
x=range(int(input()),0,-1)
P=[]
for _ in x:P+=[[int(i) for i in input().split()]]
P+=[P[0]]
for j in x:_+=P[j-1][0]*P[j][1]-P[j-1][1]*P[j][0]
print(_*0.5-0.5)

Measured memory_bytes: 7728
#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>

int main(void)
{
	int N, M, X, Y, x[1000], y[1000], i, ans = 0;

	scanf("%d %d %d %d", &N, &M, &X, &Y);
	for (i = 0; i < N; i++) scanf("%d", &x[i]);
	for (i = 0; i < M; i++) scanf("%d", &y[i]);

	int x_max = x[0], y_min = y[0];
	for (i = 0; i < N; i++) if (x_max < x[i]) x_max = x[i];
	for (i = 0; i < M; i++) if (y_min > y[i]) y_min = y[i];

	for (i = X + 1; i <= Y; i++) {
		if (X < i && i <= Y && x_max < i &&i <= y_min) {
			ans = 1;
			break;
		}
	}
	if (ans==1) printf("No War\n");
	else printf("War\n");
	return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
#define mem(a,b) memset(a,b,sizeof(a))
#define REP(i,n) for (int i=0;i<(n);i++)
#define FOR(i,s,e) for (int i=s;i<(e);i++)
using namespace std;
typedef long long llint;
typedef pair<int, int> P;
const int MOD = (int)1e9 + 7;
const int INF = 999999999;
const double PI = acos(-1.0);

int A[100000];
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N;
    cin >> N;
    REP(i, N){
        cin >> A[i]; 
    }
    sort(A, A+N);
    int before = 0;
    int ans = 0;
    REP(i, N){
        if(before != A[i]){
            ans += 1;
            before = A[i];
        }else{
            ans -= 1;
            before = 0;
        }
    }

    cout << ans << "\n";
    return 0;
}


Measured memory_bytes: 640
#include <stdio.h>

int search(int S[],int n,int key){
  int i;
  i=0;
  S[n]=key;
  while(S[i] != key)i++;
  return i !=n;
    }

int main(){
  int i,n,q,cnt=0,key;
  scanf("%d",&n);
  int S[10000];
  for(i=0;i<n;i++){
    scanf("%d",&S[i]);
  }
  scanf("%d",&q);
  for(i=0;i<q;i++){
    scanf("%d",&key);
  if (search(S, n, key))cnt++;
}
  printf("%d\n",cnt);
  return 0;
}



Measured memory_bytes: 2048
#include <bits/stdc++.h>
#define REP(i,s,e) for(int i=(s); i<(e);i++)
#define rep(i,n) REP(i,0,n)
#define rep1(i,n) REP(i,1,n)
#define repe(i,n) for(auto &&i:n)
#define all(v) (v).begin(),(v).end()
#define decimal fixed<<setprecision(20)
#define fastcin() cin.tie(0);ios::sync_with_stdio(false)
using namespace std;
using LL = long long;
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; }
const int INF = 1e9;
const LL LLINF = 1e16;

LL dp[4][5050], dp2[4][5050*5050];

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

    rep(i, 3){
        rep(j, n+1){
            LL v = b[i] - a[i];
            if(j - a[i] >= 0) dp[i+1][j] = max(dp[i][j], dp[i+1][j-a[i]]+v);
            else dp[i+1][j] = dp[i][j];
        }
    }

    LL m = dp[3][n];
    // cout << m << endl;
    rep(i, 3){
        rep(j, n+m+1){
            LL v = a[i] - b[i];
            if(j - b[i] >= 0) dp2[i+1][j] = max(dp2[i][j], dp2[i+1][j-b[i]]+v);
            else dp2[i+1][j] = dp2[i][j];
        }
    }

    cout << n+m+dp2[3][n+m] << endl;

}

Measured memory_bytes: 592384
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
#define rep(i,n) for(ll i=0;i<(ll)(n);i++)
#define all(a)  (a).begin(),(a).end()
#define pb push_back
#define INF (1e9+1)
//#define INF (1LL<<59)


int main(){
	int n,k,x,y;
	cin>>n>>k>>x>>y;
	cout<<min(k,n)*x + max(0,n-k)*y<<endl;
}

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

#define int long long

const int MAX_N = 100000;

int N, a[MAX_N];

signed main()
{
    cin >> N;
    int ans = 0;
    int cnt[MAX_N] = {};
    for (int i = 0; i < N; i++)
    {
        cin >> a[i];
    }
    cnt[N - 1] = 1;
    for (int i = N - 2; i >= 0; i--)
    {
        if (a[i] != a[i + 1]) cnt[i] = cnt[i + 1] + 1;
        else cnt[i] = 1;
    }
    for (int i = 0; i < N; i++)
    {
        int pos = i;
        for (int j = 0; j < 3 && pos < N; j++) pos += cnt[pos];
        ans = max(ans, pos - i);
    }
    printf("%lld\n", ans);
    return 0;
}

Measured memory_bytes: 2716
// ConsoleApplication1.cpp : このファイルには 'main' 関数が含まれています。プログラム実行の開始と終了がそこで行われます。
//
#include <iostream>
#include <string>

using namespace std;


int main()
{
	char X, Y;
	cin >> X >> Y;
	if (X < Y) {
		cout << "<" << endl;
	}
	else if (X > Y) {
		cout << ">" << endl;
	}
	else {
		cout << "=" << endl;
	}
}
// プログラムの実行: Ctrl + F5 または [デバッグ] > [デバッグなしで開始] メニュー
// プログラムのデバッグ: F5 または [デバッグ] > [デバッグの開始] メニュー

// 作業を開始するためのヒント: 
//    1. ソリューション エクスプローラー ウィンドウを使用してファイルを追加/管理します 
//   2. チーム エクスプローラー ウィンドウを使用してソース管理に接続します
//   3. 出力ウィンドウを使用して、ビルド出力とその他のメッセージを表示します
//   4. エラー一覧ウィンドウを使用してエラーを表示します
//   5. [プロジェクト] > [新しい項目の追加] と移動して新しいコード ファイルを作成するか、[プロジェクト] > [既存の項目の追加] と移動して既存のコード ファイルをプロジェクトに追加します
//   6. 後ほどこの,プロジェクトを再び開く場合、[ファイル] > [開く] > [プロジェクト] と移動して .sln ファイルを選択します

Measured memory_bytes: 256
#include<iostream>
#include<functional>
#include<algorithm>
using namespace std;
int sum(int x){
  int a=0;
  while(x>0){
    a+=x%10;
    x/=10;
  }
  return a;
}

int main(){
  int n;
  cin>>n;
  if(n%sum(n)==0){
    cout<<"Yes"<<endl;
  }
  else
    cout<<"No"<<endl;
}


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

#define sc(a) scanf("%d",&a)
#define scm(a,b) scanf("%d%d",&a,&b)
#define fl(c,i,n) for(int i=c;i<n;i++)
#define f(i,n) for(int i=0;i<n;i++)
#define mem(a) memset(a,0,sizeof(a))
#define ll long long int
#define ull unsigned long long int
#define inf INT_MAX
#define linf LLONG_MAX
#define pb push_back
#define pp pop_back()
#define aov(a) a.begin(),a.end()
//#define mp make_pair
#define nl printf("\n")
#define PI 2.0*acos(0.0) //#define PI acos(-1.0)
#define xx first
#define yy second
#define mxv(a) *max_element(aov(a))
#define mnv(a) *min_element(aov(a))
#define LB(a,x) (lower_bound(aov(a),x)-a.begin())
#define UB(a,x) (upper_bound(aov(a),x)-a.begin())
#define to_c_string(a) a.c_str()
#define strtoint(c) atoi(&c[0])
#define pii pair<int,int>
#define MAXN 100005
#define MOD 1000000007

template <class T> inline T bigmod(T p,T e,T M){
    ll ret = 1;
    for(; e > 0; e >>= 1){
        if(e & 1) ret = (ret * p) % M;
        p = (p * p) % M;
    } return (T)ret;
}
template <class T> inline T gcd(T a,T b){if(b==0)return a;return gcd(b,a%b);}
template <class T> inline T modinverse(T a,T M){return bigmod(a,M-2,M);}
/*int fact[MAXN];
int invfact[MAXN];
int inv(int a, int b){
    if(b==0)
        return 1;
    if(b&1)
        return (long long)a*inv(a, b-1)%MOD;
    else{
        int res = inv(a, b>>1);
        return (long long)res*res%MOD;
    }
}
void init(){
    fact[0] = 1;
    for(int i=1;i<MAXN;i++){
        fact[i] = (long long)fact[i-1]*i%MOD;
    }
    invfact[MAXN-1] = inv(fact[MAXN-1], MOD-2);
    for(int i=MAXN-1;i>0;i--){
        invfact[i-1] = (long long)invfact[i]*i%MOD;
    }
}
int C(int n, int r){
    if(r>n || r<0)
        return 0;
    return (long long)((long long)fact[n]*invfact[r]%MOD)*invfact[n-r]%MOD;
}*/
int n, m, a, b;
vector<int> v[55];
void solve(){
    cin>>n>>m;
    f(i, m){
        cin>>a>>b;
        v[a].pb(b);
        v[b].pb(a);
    }
    f(i, n){
        cout<<v[i+1].size()<<"\n";
    }
}
int main(){
    /*FILE *fin = freopen("C-small-attempt0.in", "r", stdin);
	assert( fin!=NULL );
	FILE *fout = freopen("C-small.out", "w", stdout);*/
	//init();
    solve();
    return 0;
}


Measured memory_bytes: 256
n,k = map(int,input().split())
x=list(map(int,input().split()))
y=[]
x.sort()
for i in range(1,k):
    y.append(x[i]-x[i-1])
y.sort()
if n>k-1:
    print(0)
else:
    for k in range(n-1):
        y.pop()
    print(sum(y))

Measured memory_bytes: 57000
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n - 1; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
using namespace std;

int main(){
  int n;
  cin >> n;
  int b[n-1];
  REP(i,n-1) cin >> b[i];
  int ans = b[0];
  FOR(i, 1, n-1){
    if(b[i] > b[i-1]) ans += b[i-1];
    else ans += b[i];
  }
  ans += b[n-2];
  cout << ans;
  
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define SZ(X) ((int)(X).size())
#define ALL(X) (X).begin(), (X).end()
#define REP(I, N) for (int I = 0; I < (N); ++I)
#define REPP(I, A, B) for (int I = (A); I < (B); ++I)
#define RI(X) scanf("%d", &(X))
#define RII(X, Y) scanf("%d%d", &(X), &(Y))
#define RIII(X, Y, Z) scanf("%d%d%d", &(X), &(Y), &(Z))
#define DRI(X) int (X); scanf("%d", &X)
#define DRII(X, Y) int X, Y; scanf("%d%d", &X, &Y)
#define DRIII(X, Y, Z) int X, Y, Z; scanf("%d%d%d", &X, &Y, &Z)
#define RS(X) scanf("%s", (X))
#define CASET int ___T, case_n = 1; scanf("%d ", &___T); while (___T-- > 0)
#define MP make_pair
#define PB push_back
#define MS0(X) memset((X), 0, sizeof((X)))
#define MS1(X) memset((X), -1, sizeof((X)))
#define LEN(X) strlen(X)
#define F first
#define S second
#define RF(x) freopen(x,"r",stdin)
#define WF(x) freopen(x,"w",stdout)
typedef long long LL;
using namespace std;
typedef pair<LL,LL> PLL;
typedef pair<int,int> PII;
const LL MOD = (LL)1e9+7;
const int SIZE = 2e5+5;
const LL INF = 1LL<<29;
const double eps = 1e-4;
const double PI=3.1415926535897932;

int t[100009];

int main(){
	DRIII(n,c,k);
	REP(i,n){
		RI(t[i]);
	}
	sort(t,t+n);
	int cur=0,ce=t[0],ans=0;
	REP(i,n){
		if(t[i]-ce>k||cur==c){
			ans++;ce=t[i];cur=1;
		}
		else{
			cur++;
		}
	}
	if(cur)ans++;
	printf("%d",ans);
}


Measured memory_bytes: 640
#include<bits/stdc++.h>
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) for (int i = 0; i < (n); ++i)
#define int long long
#define vec(a,n) vector<int> (a)((n))
#define Vec(a,n) vector<string> (a)((n))
using namespace std;
signed main(){
    int a,b,c;
    cin >> a >> b >> c;
    int d = a + b + c;
    int e = max({a,b,c});
    cout << d-e << endl;
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<string>
#include<cmath>
#include<algorithm>
#include<functional>
#include<numeric>
#include<queue>
#include<stack>
#include<map>
#include<unordered_map>
#include<set>
#include<bitset>
#include<random>

#pragma region
using namespace std;
#define FOR(i,r,n) for(ll i = (ll)(r); i < (ll)(n); i++)
#define rep(i,n) FOR(i,0LL,n)
#define RFOR(i,r,n) for(ll i=(ll)(n-1);i>=r;i--)
#define rrep(i,n) RFOR(i,0LL,n)
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
#define COUNT(a,y,x) upper_bound(all(a), y) - lower_bound(all(a), x)
#define UNIQUE(a) sort(all(a)); a.erase(unique(all(a)), a.end())
#define pb push_back
typedef long long int ll;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef pair<ll, ll> pll;
typedef vector<pll> vpll;
typedef vector<string> vs;
typedef map<ll, ll> MAP;
const ll inf = 2222222222222222222LL;
const ll mod = 1000000007LL;

ll n = 0, m = 0, ans = 0, tmp = 0, ma = -inf, mi = inf;
string s;
bool ok;
ll dx[9] = { 0,1,-1,0,0,1,1,-1,-1 }, dy[9] = { 0,0,0,1,-1,1,-1,1,-1 };
#define endl '\n'
#pragma endregion
#define MAX 222222






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


  cin >> n >> m;
  if (n == m) cout << n + m << endl;
  else cout << max(n, m) * 2 - 1 << endl;



  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <vector>
#include <string>
#include <unordered_set>

#define REP(i, s, e) for (ll i = s; i < e; ++i)

using namespace std;
using ll = long long;
using ld = long double;

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

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

    ll temp = N / K;
    ll result = temp * temp * temp;
    if (K % 2 == 0)
    {
        ll temp2 = N / (K / 2) - temp;
        result += temp2 * temp2 * temp2;
    }

    cout << result << endl;

    return 0;
}


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

long long solve(long long H, long long W) {
    long long ans = INF;
    if(H >= 3) {
        if(H % 3) ans = min(ans, W);
        else ans = 0;
    }
    for(long long i=1; i<=H-1; ++i) {
        long long S[3];
        S[0] = W * i;
        S[1] = (H-i) * (W/2);
        S[2] = (H-i) * (W - W/2);
        sort(S, S+3);
        ans = min(ans, S[2] - S[0]);
    }
    return ans;
}

int main() {
    long long H,W;
    cin >> H >> W;
    cout << min(solve(H,W), solve(W,H)) << endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define itn int
#define REP(i,n) for(int i=0;i<n;i++)
#define IREP(i,n) for(int i=n-1;i>=0;i--)
#define FOR(i,k,n) for(int i=k;i<n;i++)
#define REPEACH(itr,k) for(auto itr : k)
#define MOD 1000000007

using namespace std;
typedef long long ll;

const ll INF = 1LL<<60;
typedef pair<double,int> P;


int main(){
  double w,h,x,y;
  cin >> w >> h >> x >> y;
  cout << w*h/2.0 << " ";
  if(x==w/2&&y==h/2){
    cout << 1 << endl;
  }
  else {
    cout << 0 << endl;
  }
}


Measured memory_bytes: 256
import math

def comb(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

def main():
    S = int(input())
    mod = 1000000007

    n = S // 3
    res = 0
    for i in range(1,n+1):
        res += comb(S-2*i-1,i-1)
        res %= mod

    print(res)


if __name__ == "__main__":
    main()

Measured memory_bytes: 73700
/*
#pragma GCC target ("avx2")
#pragma GCC optimize ("Ofast")
#pragma GCC optimize ("unroll-loops")
#pragma GCC target("avx,avx2,fma")
#pragma GCC optimize("O3")
*/
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/rope>

using namespace std;
using namespace __gnu_pbds;
using namespace __gnu_cxx;

#define IOS ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define pb push_back
#define rev reverse
#define all(x) x.begin(), x.end()
#define sz(x) (int)x.size()
#define ub upper_bound
#define lb lower_bound
#define ll long long
#define ull unsigned long long
#define endl '\n'

template<typename T> using ordered_set = tree <T, null_type, less <T>, rb_tree_tag, tree_order_statistics_node_update>;

const ll inf = 1e18;
const ll mod = 1e9+7;
const ll N = 1e5+1;
const ll P = 31;
const double PI =  acos(-1.0);

ll a[N], cnt[N];
int main() {
//  freopen(    "angle2.in", "r", stdin);
//  freopen("angle2.out", "w", stdout);
    IOS
    ll n;
    ll sum = 0;
    cin >> n;
    for(int i = 1; i <= n; i++) {
        cin >> a[i];
        sum += a[i];
        cnt[a[i]]++;
    }
    ll q;
    cin >> q;
    for(int i = 1; i <= q; i++) {
        ll x, y;
        cin >> x >> y;
        sum -= cnt[x]*x;
        cnt[y] += cnt[x];

        sum += cnt[x] * y;
        cnt[x] = 0;
        cout << sum << endl;
    }
    return 0;
}
// assert(condition) -> if (condition == false) Runtime Error
// order_of_key(x) -> number of elements smaller than x
// *find_by_order(k) -> k-th element in 0-based indexation


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

vector<vector<int>> es;
int bfs(int start,int k,int stop=-1){
	queue<int> que,dist;
	set<int> st;
	que.push(start);dist.push(0);
	while(!que.empty()){
		int v = que.front();que.pop();
		int d = dist.front();dist.pop();
		st.insert(v);
		for(int i=0;i<es[v].size();i++){
			if(st.find(es[v][i]) != st.end())continue;
			if( es[v][i] == stop )continue;
			if( d + 1 > k)continue;
			st.insert(es[v][i]);
			que.push( es[v][i] );
			dist.push(d + 1);
		}
	}
	return st.size();
}

int main(void){
	int N,K;
	cin >> N >> K;
	es.resize(N);
	vector<pair<int,int>> e;
	for(int i=0;i<N-1;i++){
		int a,b;cin >> a >> b;a--;b--;
		es[a].push_back(b);
		es[b].push_back(a);
		e.emplace_back(a,b);
	}

	int ret = -1;
	if(K%2 == 0){
		// 中心の頂点を決める
		for(int i=0;i<N;i++){
			ret = max( ret, bfs(i,K/2));
		}
	}else{
		for(int i=0;i<N-1;i++){
			int nodes = bfs( e[i].first, K/2, e[i].second ) + bfs( e[i].second, K/2, e[i].first );
			ret = max( ret, nodes);
		}
	}
	cout << N-ret << endl;
}

Measured memory_bytes: 512
<?php

while (true) {
    fscanf(STDIN, "%d %d", $H, $W);

    if (0 == $H && 0 == $W) break;

    for ($i = 0; $i < $H; $i++) {
        for ($j = 0; $j < $W; $j++) {
            $is_around =
                ($i == 0 || $i == $H-1) || ($j == 0 || $j == $W-1);
            echo ($is_around ? '#' : '.');
        }

        echo "\n";
    }

    echo "\n";
}

Measured memory_bytes: 6552
#include <stdio.h>
 
int main(){
  int n, m, tl[10001], tr[10001], i, j, k, befor, maxnum;
 
  while(1){
    scanf("%d %d", &n, &m);
    if(n==0 && m==0) break;

    for(i=0;i<n;i++){
      scanf("%d", &tl[i]);
    }
    tl[i]=1000001;
 
    for(i=0;i<m;i++){
      scanf("%d", &tr[i]);
    }
    tr[i]=1000001;

	j=0;
	k=0;
	maxnum=-1;
	befor=0;
	for(i=0;i<n+m+1;i++){
		if(tl[j]<=tr[k]){
			if(maxnum<tl[j]-befor){
				maxnum = tl[j] - befor;
			}
			befor=tl[j];
			j++;
		}
		else if(tl[j]>tr[k]){
			if(maxnum<tr[k]-befor){
				maxnum = tr[k] - befor;
			}
			befor=tr[k];
			k++;
		}
		if(tl[j]==tr[k]){
			i++;
			k++;
		}
	}
    printf("%d\n", maxnum);
  }
  return 0;
}

Measured memory_bytes: 1108
/*
  AOJ 1602
  Title:ICPC caluculator
  @kankichi573
*/
#include <stdio.h>
#include <string.h>

int N;
char line[17][15];


int get_level(char *p)
{
  if(*p != '.')
    return(0);
  return (1+get_level(p+1));
}


int evaluate(int ln,int level)
{
  int   i,ret;

  if(isdigit(line[ln][level]))
    return(line[ln][level]-'0');
  else if (line[ln][level]=='+')
    {
      ret=0;
      for(i=ln+1;i<N;i++)
	{
	  if(get_level(&line[i][0])==level)
	    break;
	  if(get_level(&line[i][0])==level+1)
	    ret += evaluate(i,level+1);
	}
    }
  else if (line[ln][level]=='*')
    {
      ret=1;
      for(i=ln+1;i<N;i++)
	{
	  if(get_level(&line[i][0])==level)
	    break;
	  if(get_level(&line[i][0])==level+1)
	    ret *= evaluate(i,level+1);
	}
    }
  return(ret);
}

main()
{
  int i,ret;
  

  while(scanf("%d",&N)  && (N))
    {
      for(i=0;i<N;i++)
	{
	  scanf("%s",&line[i][0]);
	  //printf("%s [%d]\n",&line[i][0],get_level(&line[i][0]));
	}
      ret=evaluate(0,0);
      printf("%d\n",ret);
    }
  return(0);
}

Measured memory_bytes: 604
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cmath>
#include <queue>
#include <climits>
#include <set>
#include <map>
#include <stack>
#include <iomanip>
#include <tuple>
#define ll long long
using namespace std;
struct all_init
{
    all_init()
    {
        cout << fixed << setprecision(12);
    }
} All_init;

int main()
{
    string s;
    cin >> s;
    if(s.size()==2){
        cout << 1 << endl;
        exit(0);
    }
    s.erase(s.size() - 2,2);
    while(s.size()>0){
        string sa = s.substr(0, s.size() / 2);
        string sb = s.substr(s.size() / 2, s.size() / 2);
        if(sa==sb){
            cout << s.size() << endl;
            exit(0);
        }
        s.erase(s.size()-2,2);
    }

}


Measured memory_bytes: 384
listX = input().split()
listY = input().split()
s=0

for cnt in range(int(listX[0])):
    if cnt==0:
        st = int(listY[cnt])
        continue
    if st > int(listY[cnt]):
        s = s + st - int(listY[cnt])
    else:
        st = int(listY[cnt])

print(s)

Measured memory_bytes: 24848
n, k = map(int, input().strip().split())
okashi = [0] * n
for i in range(k):
    d = int(input())
    as_ = list(map(int, input().strip().split()))
    for a in as_:
        okashi[a - 1] += 1

no_okashi = [1 for ok in okashi if ok == 0]

print(len(no_okashi))


Measured memory_bytes: 9180
#include<bits/stdc++.h>
using namespace std;
int main(){
    int x=0;
    int y=0;
    scanf("%d %d", &x, &y);
    int pres=1;
    while(x!=0){
        if (pres>=y){
            pres+=y;
        }
        else{
            pres+=pres;
        }
        x-=1;
    }
    printf("%d", pres);
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define INF 1e9
#define INFLL 1ull<<60u
using namespace std;

#define REPR(i,n) for(int i=(n); i >= 0; --i)
#define FOR(i, m, n) for(int i = (m); i < (n); ++i)
#define REP(i, n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define ALL(a)  (a).begin(),(a).end()
#define endl "\n"

template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return true; } return false; }
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return true; } return false; }
typedef long long ll;

void solve() {
    int N; cin >> N;
    ll d1max = -INFLL;
    ll d1min = INFLL;
    ll d0max = -INFLL;
    ll d0min = INFLL;
    REP(_,N) {
        ll x,y;
        cin >> x >> y;
        auto f0 = x - y;
        auto f1 = x + y;
        chmax(d1max,f1);
        chmax(d0max,f0);
        chmin(d0min,f0);
        chmin(d1min,f1);
    }
    auto d0 = d0max - d0min;
    auto d1 = d1max - d1min;
    cout << max(d0,d1) << endl;
}

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

Measured memory_bytes: 3616
#include <bits/stdc++.h>
#define ll long long 
#define rep(i,a,n) for(int i=a;i<n;i++)
#define pb push_back
#define endl "\n"
#define dd double
using namespace std;
dd printValueOfPi(int N) 
{ 
    double pi = 2 * acos(0.0);
  	return ("%.*lf\n", N, pi); 
} 
  
// Driver Code 
int main() 
{ 
    int n;
  cin>>n;
   dd  pie=  printValueOfPi(20);
  std::cout << std::setprecision(20) << 2* pie*n << '\n';
    return 0; 
} 

Measured memory_bytes: 3776