akhauriyash/Code-Regression huggingface dataset:
fn main() {
    let s = {
        use std::io::Read;
        let mut s = String::new();
        std::io::stdin().read_to_string(&mut s).unwrap();
        s
    };
    let mut iter = s.split_whitespace();
    let n = iter.next().unwrap().parse::<usize>().expect("Parse error");
    let m = iter.next().unwrap().parse::<usize>().expect("Parse error");
    let c = iter.next().unwrap().parse::<i32>().expect("Parse error");
    let b = (0..m).map(|_| iter.next().unwrap().parse::<i32>().expect("Parse error")).collect::<Vec<_>>();
    let a = (0..n).map(|_| (0..m).map(|_| iter.next().unwrap().parse::<i32>().expect("Parse error")).collect::<Vec<_>>()).collect::<Vec<_>>();
    println!("{}", solve(n, m, c, b, a));
}

fn solve(n: usize, m: usize, c: i32, b: Vec<i32>, a: Vec<Vec<i32>>) -> i32 {
    // write solution here
    let mut counter = 0;
    for n in 0..n {
        let mut line_sum = 0;
        for m in 0..m{
            line_sum += a[n][m] * b[m];
        }
        line_sum += c;
        if line_sum > 0{
            counter += 1;
        }
    }
    // return answer
    counter
}


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

typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<double> vd;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
typedef pair<int,int> pii;
typedef pair<double, double> pdd;
typedef pair<ll, ll> pll;
typedef vector<pii> vii;
typedef vector<pll> vll;
typedef vector<pdd> vdd;

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define mem(a,b) memset(a, b, sizeof(a) )
#define all(x) (x).begin(),(x).end()
#define INF 1000000000000
#define MOD 1000000007
#define PB push_back
#define MP make_pair
#define F first
#define S second

inline void normal(ll &a) { a %= MOD; (a < 0) && (a += MOD); }
inline ll modMul(ll a, ll b) { a %= MOD, b %= MOD; normal(a), normal(b); return (a*b)%MOD; }
inline ll modAdd(ll a, ll b) { a %= MOD, b %= MOD; normal(a), normal(b); return (a+b)%MOD; }
inline ll modSub(ll a, ll b) { a %= MOD, b %= MOD; normal(a), normal(b); a -= b; normal(a); return a; }
inline ll modPow(ll b, ll p) { ll r = 1; while(p) { if(p&1) r = modMul(r, b); b = modMul(b, b); p >>= 1; } return r; }
inline ll modInverse(ll a) { return modPow(a, MOD-2); }
inline ll modDiv(ll a, ll b) { return modMul(a, modInverse(b)); }

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

int ctoi(char c) {
	if (c >= '0' && c <= '9') {
		return c - '0';
	}
	return 0;
}

int main(){
	int n;cin>>n;
	vl a(n);
	rep(i,n)cin>>a[i];
	ll ans=0,sum=0;
	rep(i,n){
		if(a[i]!=0){
			sum+=a[i];
		}
		else{
			ans+=sum/2;
			sum=0;
		}
	}
	ans+=sum/2;
	cout<<ans<<endl;
}


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

int main() {
    int n;
    cin>>n;
    vector<int> z(n, 0);
    for(int i = 0; i <n; i++){
        cin>>z[i];
    }
    unsigned long long int count = 0;
    for(int i = 1; i < n; i++){
        if(z[i] < z[i-1]){
            unsigned long long int diff = z[i-1] - z[i];
            count+=diff;
            z[i]+=diff;
        }
    }
    cout<<count<<endl;
    return 0;
}


Measured memory_bytes: 4032
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.math.BigDecimal;

public class Main {

    private static final double TAX = 1.05;

    /**
     * <p> [??????] n ?????\???????????¨??????n ??±????????????????????????????????????????????????????????°?????????n ??? 100 ??\??????</p>
     * <p> [??¬???] ???????????????</p>
     * <p> [??????] ???????????????</p>
     * @param args
     * @throws IOException
     */
    public static void main(String[] args) throws IOException {

        String week = new BufferedReader(new InputStreamReader(System.in)).readLine();

        double totalAmount = 100000;
        BigDecimal returnAmount = new BigDecimal(totalAmount);
        int i = Integer.parseInt(week);

        // ??\??????????????°???????????????????¢?????????????
        for (int count = 0; count < i; count++) {
            returnAmount = new BigDecimal(totalAmount * TAX).setScale(-3, BigDecimal.ROUND_UP);
            totalAmount = returnAmount.doubleValue();
        }
        // ???????????????????????????
        System.out.println(returnAmount.intValue());
    }

}

Measured memory_bytes: 15156
#include<bits/stdc++.h>
	#define ll long long
	#define f   first
	#define s   second
	#define pb          push_back
	#define mod         1000000007
	#define hell        998244353
	#define inf         1000000000000000000LL
	using namespace std;
	ll n,k,m,l,mx,sum,q;
	void solve()
	{   ll x;
		cin>>x;
		ll y=100;
		ll t=0;
		//cout<<y<<" "<<x;
		while(y<x)
		{
			t++;

			y=(y*1.01);
			
			//cout<<y<<" ";
		}
		cout<<t;
		
				

	}    
	int main()
	{   
	    ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
	    //cout<<primes.size();
	    

	    ll t=1;
	   //cin>>t;
	    for(int i=1; i<=t; i++) {
        solve();
    }

	}

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

int main() {
	int N, K;
	cin >> N >> K;
	string S;
	cin >> S;
	K--;

	if (S[K] == 'A') S[K] = 'a';
	else if (S[K] == 'B') S[K] = 'b';
	else S[K] = 'c';

	cout << S << endl;
	return 0;
}

Measured memory_bytes: 256
import java.util.*;

public class Main{
    public static void main(String[] args){
	Scanner sc = new Scanner(System.in);

	String s = sc.next();
	String t = sc.next();

	String S = s+s;

	if(S.contains(t) == true){
		System.out.println("Yes");
	}else{
		System.out.println("No");
	}
    }
}


Measured memory_bytes: 21844
#include <bits/stdc++.h>
using namespace std;
int main(){
	int n;
	cin>>n;
	int arr[n];
	for(int i{};i<n;i++){
		cin>>arr[i];
	}
	int dp[n];
	dp[0]=0;
	if(n>1){
		dp[1]=abs(arr[0]-arr[1]);	
	}
	if(n>2){
		dp[2]=min(dp[1]+abs(arr[2]-arr[1]), abs(arr[2]-arr[1]));	
	}
	for(int i{2};i<n;i++){
		dp[i]=min(dp[i-1]+ abs(arr[i]-arr[i-1]), 
					dp[i-2]+ abs(arr[i]-arr[i-2]));
	}
	cout<<dp[n-1];
}


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

#define int long long
#define vvi vector<vector<int>>
#define vec vector
#define pq priority_queue
#define all(v) (v).begin(), (v).end()
#define uniqueV(x) sort(x.begin(), x.end()); x.erase(unique(x.begin(), x.end()), x.end());
#define rep(i, n) for (int (i) = (0); (i) < (n); ++(i))
#define repp(i, m, n) for (int (i) = (m); (i) < (n); ++(i))
#define dbg(x) cerr << #x << ": " << x << endl;
#define dbg2(x, y) cerr<<"("<<#x<<", "<<#y<<") = "<<"("<<x<<", "<<y<<")"<<endl;
#define dbg3(x, y, z) cerr<<"("<<#x<<", "<<#y<<", "<<#z<<") = "<<"("<<x<<", "<<y<<", "<<z<<")"<<endl;
#define dbgB(value, size) cerr<<#value<<": "<<bitset<size>(value) << endl;
#define line() cerr << "---------------" << endl;

const int dx[] = {1, -1, 0, 0};
const int dy[] = {0, 0, -1, 1};
const double PI = 3.14159265358979323846;

template<class T>bool chmax(T &a, const T &b) { if (a<b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a = b; return 1; } return 0; }

template<typename T, typename U>
void print1(T Array, U size) {
  for (int i = 0; i < size; i++) {
    cout << Array[i] << " ";
  }
  cout << endl;
}

template<typename T>
void print(T Array, int height, int width) {
  for (int i = 0; i < height; i++) {
    for (int j = 0; j < width; j++) {
      cout << " " << Array[i][j];
    }
    cout << endl;
  }
}

// ------------------------------------------------------------------------------------------

int a, b, c;

signed main() {
  cin >> a >> b >> c;

  int ans = b;
  int life = a + b;
  if (life < c) {
    ans += life + 1;
  } else {
    ans += c;
  }

  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 256
#pragma GCC optimize("O3")
#include<bits/stdc++.h> 
using namespace std;
using ll=long long;
using P=pair<int,int>;
template<class T> using V=vector<T>; 
#define fi first
#define se second
#define all(v) (v).begin(),(v).end()
const ll inf=(1e18);
const ll mod=1000000007;
ll gcd(ll a,ll b) {return b ? gcd(b,a%b):a;}
ll lcm(ll c,ll d){return c/gcd(c,d)*d;}
struct __INIT{__INIT(){cin.tie(0);ios::sync_with_stdio(false);cout<<fixed<<setprecision(15);}} __init;
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }
int main(){
int n,m;
cin>>n>>m;
V<string> s(n);
for(int i=0;i<n;i++)cin>>s[i];
for(int i=0;i<=n+1;i++){
    cout<<'#';
    if(i==0||i==n+1){
          for(int i=0;i<m;i++)cout<<'#';
    }
    else cout<<s[i-1];
    cout<<'#'<<endl;
}
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
const double eps=1e-7;
typedef long long ll;
const ll maxx=1e6+10;
const ll mod=1e9+7;
const ll inf=0x3f3f3f3f;
char s[maxx];
ll dp[maxx],f[maxx],a[maxx],b[maxx];
int main(){
    scanf("%s",s+1);
    int n=strlen(s+1);
    for(int i=1;i<=n;i++){
        a[i]=s[i]-'0';
        b[i]=a[i];
    }
    dp[n]=a[n]; f[n+1]=1;
    int ok=0;
    for(int i=n-1;i>=0;i--){
        b[i]+=b[i+1]/10;
        b[i+1]%=10;
        f[i+1]=f[i+2];
        if(b[i+1]==5){
            if(b[i]<5){
                f[i+1]+=b[i+1];
            }else{
                f[i+1]+=10-b[i+1];
                b[i]++;
            }
        }
        else if(b[i+1]>5){
            f[i+1]+=10-b[i+1];
            b[i]++;
        }else{
            f[i+1]+=b[i+1];
        }
        dp[i]=min(dp[i+1],f[i+1])+a[i];
    }
    cout<<dp[0]<<endl;
}


Measured memory_bytes: 32512
#include <stdio.h>
 
int main(void){
 
    int a,b;
    char op;
 
    while(1){
        scanf("%d %c %d",&a,&op,&b);
        if(op=='+')printf("%d\n",a+b);
        else if(op=='-')printf("%d\n",a-b);
        else if(op=='*')printf("%d\n",a*b);
        else if(op=='/')printf("%d\n",a/b);
        else if(op=='?')break;
    }
 
    return 0;
 
}

Measured memory_bytes: 600
#-*-coding:utf-8-*-

import sys

def check(a,b,c,d,ans_pattern):
    ans_list=[b,c,d]
    ans=a
    for i in range(3):
        if ans_pattern[i]=="+":
            ans+=ans_list[i]
        else:
            ans-=ans_list[i]
    if ans==7:
        print("{}{}{}{}{}{}{}=7".format(a,ans_pattern[0],b,ans_pattern[1],c,ans_pattern[2],d))
        sys.exit() 

def main2():
    #000なら+++
    #001なら++-
    a,b,c,d=map(int,input())
    for i in range(2**3):
        ans_pattern=["+","+","+"]
        for j in range(3):
            if (i >> j)&1:
                ans_pattern[j]="-"
        check(a,b,c,d,ans_pattern)
 
if __name__=="__main__":
    main2()

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

using namespace std;

#define DUMP(x) std::cout << (#x) << " = " << (x) << "\n"
#define rep(i, n) for(int i = 0; i < (int)(n); ++i)
#define ALL(x) x.begin(), x.end()

using ll = long long;

void Main() {
    int n;
    cin >> n;
    vector<int> a(n + 1);
    vector<int> b(n);
    for(auto& x : a){
        cin >> x;
    }
    for(auto& x : b){
        cin >> x;
    }

    ll ans = 0;
    rep(i, n){
        int left = min(a[i], b[i]);
        ans += left;
        a[i] -= left;
        b[i] -= left;

        int right = min(a[i + 1], b[i]);
        ans += right;
        a[i + 1] -=right;
        b[i] -= right;
    }
    cout << ans << endl;
}

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


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

using namespace std;

int main(){
	string a;
	string b;
	long long int i;
	
	cin>>a>>b; //getchar();
	if(a.length()>=b.length()){
		for(i=0; i<=(a.length() - b.length()); i++){
			if(a.substr(i,b.length())==b){
			    printf("%lld\n",i);
			} 
		}
	}

	//getchar();
	return 0;
}


Measured memory_bytes: 3984
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MOD = 1e9+7, N = 1e5+5;
vector<int> adj[N];
int main(){
    int n,m;
    cin >> n >> m;
    vector<int> path;
    int s,t;
    for(int i = 0; i < m; ++i){
        int a,b;
        scanf("%d %d",&a,&b);
        s = a;
        t = b;
        adj[a].push_back(b);
        adj[b].push_back(a);
    }
    vector<bool> in(n+1);
    in[s] = true;
    in[t] = true;
    path.push_back(s);
    path.push_back(t);
    while(true){
        bool again = false;
        for(int v : adj[path.back()])
            if(!in[v]){
                in[v] = true;
                again = true;
                path.push_back(v);
                break;
            }
        if(again == false)
            break;
    }
    reverse(path.begin(),path.end());
    while(true){
        bool again = false;
        for(int v : adj[path.back()])
            if(!in[v]){
                in[v] = true;
                again = true;
                path.push_back(v);
                break;
            }
        if(again == false)
            break;
    }
    cout << path.size() << '\n';
    for(int i = 0; i < path.size(); ++i)
        cout << path[i] << " \n"[i==path.size()-1];
}


Measured memory_bytes: 6776
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#define MAX(a,b) (a > b) ? a : b
#define MIN(a,b) (a < b) ? a : b
const int inf = 1000000000; // 10^9

int main(){
   char ans[100];
   char s[100];scanf("%s",s);
   int count;
   int i,j;
   for(i = 0;i < strlen(s);i++){
      if(s[i] == '1'){
         //printf("1だよ！\n");
         ans[j] = '1';
         j++;
      }else if(s[i] == '0'){
         //printf("0だよ！\n");
         ans[j] = '0';
         j++;
      }else {
         //printf("bだよ！\n");
         if(j){
            j--;
         }
      }
   }
   for(int i = 0;i < j;i++){
      printf("%c",ans[i]);
   }
   printf("\n");
   return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <array>
#include <map>
#include <algorithm>
#include <cmath>
#include <vector>
#include <fstream>
#include <string>
#include <random>
#include <queue>
#include <iomanip>
#include <functional>
#include <climits>
#include <tuple>
#include <unordered_map>
#include <limits>
#include <functional>
#include <cassert>
#include <numeric>
#include <bitset>

#define FOR(x,n) for(int x = 0; x < n; x++)
#define PUT(x) cout << x << endl
#define DPUT(x) printf("%.15lf\n",x)
#define GET(x,y) std::get<x>(y)
#define CHMAX(x,y) x = std::max(x,y)
#define CHMIN(x,y) x = std::min(x,y)
#define SP_END (i != n - 1 ? ' ' : '\n') ;

using namespace std;

using ll = long long int;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using vll = std::vector<ll>;
using vpll = std::vector<pll>;
using vpii = std::vector<pii>;
using vi = std::vector<int>;
using vvi = std::vector<vi>;
using vvpii = std::vector<vpii>;
using vch = std::vector<char>;
using vvch = std::vector<vch>;
using tiii = std::tuple<int, int, int>;

const ll mod197 = 1000000007LL;
const ll INF = 10000000000LL;

const double PI11 = 3.14159265359;

const int dis[5] = { 0,1,0,-1,0 };

const int disD[4] = { 0,1,1,0 };

int d[200000] = {};
int t[200000] = {};

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

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

	cin >> m;

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

	sort(d, d + n);
	sort(t, t + m);

	int p = 0;

	for (int i = 0; i < m; i++) {
		while (d[p] != t[i]) {
			p++;
			if (p >= n) {
				cout << "NO" << endl;
				return 0;
			}
		}
		p++;
	}

	cout << "YES" << endl;

	return 0;
}


Measured memory_bytes: 1792
# include <bits/stdc++.h>
# define ll long long
using namespace std;
const ll MOD = 1e9 + 7;
string s;
ll ans, cnt[26], n; 
int main(){
	cin >> n >> s;
	for(int i = 0; i < n; ++i){
		ll ways = 1;
		for(int j = 0; j < 26; ++j){
			if(s[i] - 'a' == j)continue;
			ways = ways * (cnt[j] + 1) % MOD;
		}
		ans += ways;
		ans %= MOD;
		cnt[s[i] - 'a'] ++;
	}
	cout << ans << '\n';
}

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

int main(){
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	string s;
	cin>>s;
	int tot = 0;
	vector<int> cur;
	for(int i = s.size() - 1;i>=0;i--)
		cur.emplace_back(s[i] - '0');
	cur.emplace_back(0);
	for(int i=0, x=0;i+1<cur.size();i++){
		x += cur[i] * 9;
		cur[i] = x % 10;
		x /= 10;
		cur.back() = x;
	}
	if(cur.back()==0)	cur.pop_back();
	for(int it:cur)
		tot += it;
	for(int i=1;;i++){
		cur.emplace_back(0);
		int x = 9;
		for(int j=0;x!=0;j++){
			tot -= cur[j];
			x += cur[j];
			cur[j] = x % 10;
			tot += cur[j];
			x /= 10;
		}
		if(tot <= 9 * i){
			cout<<i<<endl;
			break;
		}
		if(cur.back()==0)
			cur.pop_back();	
	}
}


Measured memory_bytes: 5936
#include <stdio.h>

int main() {
  int i, j, tmp;
  int N, A[100], res = 0;
  scanf("%d", &N);
  for (i = 0; i < N; i++) {
    scanf("%d", &A[i]);
  }
  for (i = 1; i < N; i++) {
    tmp = A[i];
    for (j = i; j > 0 && A[j-1] < tmp; j--) {
      A[j] = A[j-1];
    }
    A[j] = tmp;
  }
  for (i = 0; i < N; i++) {
    if (i % 2 == 0) res += A[i];
    else res -= A[i];
  }
  printf("%d\n", res);
  return 0;
}


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

int main() {
    int N, M, X, Y;
    cin >> N >> M >> X >> Y;

    int x[N + 1];
    int y[M + 1];
    for (int i = 0; i < N; i++){
        cin >> x[i];
    }

    for (int i = 0; i < M; i++){
        cin >> y[i];
    }
    x[N] = X;
    y[M] = Y;

    sort(x, x + N + 1);
    sort(y, y + M + 1);

    if (x[N] < y[0]){
        cout << "No War" << endl;
    }else{
        cout << "War" << endl;
    }

}


Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
bitset <333> a[333];
int n, m;
const int mod = 998244353;
long long pw[333];

int main(int argc, char const *argv[])
{
	scanf("%d %d", &n, &m);
	pw[0] = 1;
	for(int i = 1; i <= max(n, m); i++) {
		pw[i] = pw[i - 1] * 2;
		pw[i] %= mod;
	} 
	for(int i = 0; i < n; i++) {
		for(int j = 0; j < m; j++) {
			int x;
			scanf("%d", &x);
			a[i][j] = x;
		}
	}
	int ptr = 0;
	for(int j = 0; j < m; j++) {
		for(int i = ptr; i < n; i++) {
			if(a[i][j] == 1) {
				swap(a[ptr], a[i]);
				for(int x = 0; x < n; x++) {
					if(x != ptr && a[x][j] == 1) {
						a[x] ^= a[ptr];
					}
				}
				++ptr;
				break;
			}
		}
	}
	long long res = pw[m-1] * (pw[n] - pw[n - ptr]);
	res %= mod;
	if(res < 0) res += mod;
	printf("%lld\n", res);
	return 0;
}

Measured memory_bytes: 256
#include<stdio.h>

int main(){

     int a, b;

     scanf("%d", &a);
     scanf("%d", &b);

     if (a>b){
          printf("a > b\n");
     } else if (a<b){
          printf("a < b\n");
     } else {
          printf("a == b\n");
     }

      return 0;
}

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

int main() {
  int h, w;
  cin >> h >> w;
  vector<string> a(h);
  for(int i = 0; i < h; i++) cin >> a.at(i);
  
  vector<vector<int>> check(h, vector<int>(w));
  int ans = -1;
  queue<pair<int, int>> bfs;
  for(int i = 0; i < h; i++){
    for(int j = 0; j < w; j++){
      if(a.at(i).at(j) == '.') continue;
      bfs.push({i, j});
      check.at(i).at(j) = 1;
    }
  }
  vector<int> dx = {0, 0, -1, 1}, dy = {1, -1, 0, 0};
  while(bfs.size() > 0){
    ans++;
    queue<pair<int, int>> next;
    while(bfs.size() > 0){
      next.push(bfs.front());
      bfs.pop();
    }
    while(next.size() > 0){
      int y = next.front().first, x = next.front().second;
      next.pop();
      for(int i = 0; i < 4; i++){
        int nx = x + dx.at(i), ny = y + dy.at(i);
        if(nx < 0 || nx >= w || ny < 0 || ny >= h) continue;
        if(check.at(ny).at(nx)) continue;
        check.at(ny).at(nx) = 1;
        bfs.push({ny, nx});
      }
    }
  }
  
  cout << ans << endl;
}

Measured memory_bytes: 17748
S=input()
R_S=S[::-1]
ans=0
count=[1]+[0]*2018
remainder=0

i=0
while i<len(S):
    remainder+=int(R_S[i])*pow(10,i,2019)
    remainder=remainder%2019
    ans+=count[remainder]
    count[remainder]+=1
    i+=1

print(ans)

Measured memory_bytes: 9212
#include<algorithm>
#include<climits>
#include<cmath>
#include<cstdint>
#include<cstdlib>
#include<iomanip>
#include<iostream>
#include<numeric>
#include<string>
#include<utility>
#include<vector>
using namespace std;

long gcd(long x, long y) { if (x > y) { return gcd(y, x); } long r; while (y != 0) { r = x % y; x = y; y = r; }return x; }
long lcm(long x, long y) { return(x / gcd(x, y)) * y; }
void indexsort(long* first, long* last, long* func) { sort(first, last, [&](long a, long b) {return func[a] < func[b]; }); }
//--------------------

bool issquare(long x){ return ((long)sqrtl((double)x) * (long)sqrtl((double)x) == x) ? true : false; }
bool kwissq(int64_t num){ int64_t rt = (int64_t)sqrtl(num); return(rt * rt == num); }
int main() {

	string s; cin >> s;
	long mylen = s.length();
	long res = 0;

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

		if (s[i] == 'g' && i % 2 == 1) res++;

		if (s[i] == 'p' && i % 2 == 0) res--;
		
	}
	cout << res << endl;
}

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

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

template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

typedef long long ll;

using namespace std;


int main()
{
  ios::sync_with_stdio(false);
  cin.tie(0);
  int a,b;cin>>a>>b;
  int d=abs(a-b);
  cout<<(d+1)*d/2-b<<endl;

  return 0;

}


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

int main(){

    int a[5], k, i;
    for(i=0; i<5; i++) cin >> a[i];
    cin >> k;

    if(a[4] - a[0] <= k) cout << "Yay!" << endl;
    else cout << ":(" << endl;
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<algorithm>
#include<set>
#include<unordered_map>
using namespace std;
int main()
{
    int a,b;
    int all[60]={1,2,3,4,5,6,7,8,9,4,6,8,10,12,14,16,18,9,12,15,18,21,24,27,16,20,24,28,32,36,25,30,35,40,45,36,42,48,54,49,56,63,64,72,81};
    unordered_map<int,int> hash;
    for(int i =0;i<60;i++)
        hash[all[i]]=1;
    cin>>a;
    if(hash[a])
        cout<<"Yes"<<endl;
    else
        cout<<"No"<<endl;
    return 0;
}


Measured memory_bytes: 384
#include <iostream>
using namespace std;
int main(void){
    int a,b,c,d,p,x,y,mon;
    cin>>a;
    cin>>b;
    cin>>c;
    cin>>d;
    cin>>p;
    x=p*a;
    if(p<=c){
        y=b;
    }
    if(p>c){
        y=b+(p-c)*d;
    }
    if(y>x){
    mon=x;
    }
    if(y<x){
        mon=y;
    }
    cout<<mon<<endl;
}



Measured memory_bytes: 3096
#include<iostream>
#include<algorithm>
#include<vector>
#include<stack>
#include<queue>
#include<cstdio>
#include<climits>
#include<cmath>
#include<cstring>
#include<string>

#define f first
#define s second
#define mp make_pair

#define REP(i,n) for(int i=0; i<(int)(n); i++)
#define FOR(i,c) for(__typeof((c).begin()) i=(c).begin(); i!=(c).end(); i++)
#define ALL(c) (c).begin(), (c).end()
#define EPS (1e-10)
using namespace std;

typedef unsigned int uint;
typedef long long ll;

#define MAX (1000000)
int main(){
  vector<bool> isP(MAX,true);
  vector<int>  ans(MAX,0);
  int n;
  isP[0] = isP[1] = false;
  for(int i=2; i<MAX; i++)
    if(isP[i]){
      ans[i] = ans[i-1] + 1; 
      for(int j=i+i; j<MAX; j+=i)
	isP[j] = false;
    }else{
      ans[i] = ans[i-1];
    }
  
  while(cin>>n) cout<<ans[n]<<endl;
  return 0;
}

Measured memory_bytes: 0
H ,A = input().split(" ")
H = int(H)
A = int(A)


lst = input().split(" ")
hissatsu = []
for l in lst:
  hissatsu.append(int(l))
sum_h = sum(hissatsu)

if H > sum_h:
  print("No")
else:
  print("Yes")

Measured memory_bytes: 13788
#include<iostream>
#include<string>
#include<cmath>
#include<queue>
#include<map>
#include<set>
#include<list>
#include<iomanip>
#include<vector>
#include<random>
#include<cassert>
#include<functional>
#include<algorithm>
#include<cstdio>
#include<bitset>
#include<unordered_map>
using namespace std;
//---------------------------------------------------
//ライブラリゾーン！！！！
typedef long long ll;
typedef long double ld;
#define str string
#define rep(i,j) for(ll i=0;i<(long long)(j);i++)
#define all(a) (a).begin(),(a).end()
const ll Mod = 1000000007;
const ll gosenchou = 5000000000000000;
short gh[2][4] = { { 0,0,-1,1 },{ -1,1,0,0 } };
struct P {
	ll pos, cost;
};
bool operator<(P a, P b) { return a.cost < b.cost; }
bool operator>(P a, P b) { return a.cost > b.cost; }
struct B {//隣接リスト表現
	ll to, cost;
};
struct E {//辺の情報を入れる変数
	ll from, to, cost;
};
bool operator<(E a, E b) {
	return a.cost < b.cost;
}
struct H {
	ll x, y;
};
bool operator<(H a, H b) {
	if (a.x != b.x) return a.x < b.x;
	return a.y < b.y;
}
bool operator>(H a, H b) {
	if (a.x != b.x) return a.x > b.x;
	return a.y > b.y;
}
bool operator==(H a, H b) {
	return a.x == b.x&&a.y == b.y;
}
bool operator!=(H a, H b) {
	return a.x != b.x || a.y != b.y;
}
ll gcm(ll i, ll j) {//最大公約数
	if (i > j) swap(i, j);
	if (i == 0) return j;
	return gcm(j%i, i);
}
ld rad(H a, H b) {
	return sqrt(pow(a.x - b.x, 2.0) + pow(a.y - b.y, 2.0));
}//rad＝座標上の2点間の距離
ll ari(ll a, ll b, ll c) {
	return (a + b)*c / 2;
}//等差数列の和
ll fact(ll x, ll k, ll p) {//最大値、個数、あまり
	ll sum = 1;
	for (int i = 0; i < k; i++) {
		sum *= (x--);
		sum %= p;
	}
	return sum;
}//階乗(正）
ll mod_pow(ll x, ll n, ll p) {
	ll res = 1;
	while (n > 0) {
		if (n & 1) res = res * x%p;
		x = x * x%p;
		n >>= 1;
	}
	return res;
}//x^n%p
short ctos(char a) {
	return (int)(a - '0');
}
const long long Inf = 4523372036854775807;
const int inf = 15000000000;
//----------------------------------------------------
//++++++++++++++++++++++++++++++++++++++++++++++++++++
int a[500][500];
struct A {
	int a, b, c, d;
};
A res[250000];
signed main() {
	int h, w;
	cin >> h >> w;
	for (int i = 0; i < h; i++) {
		for (int j = 0; j < w; j++) {
			cin >> a[i][j];
		}
	}
	int ans = 0;
	for (int i = 0; i < h; i++) {
		for (int j = 0; j < w; j++) {
			if (i == h - 1&&j==w-1) {
				break;
			}
			if (i == h - 1) {
				if (a[i][j] % 2 == 1) {
					a[i][j + 1]++;
					res[ans] = { i,j,i,j + 1 };
					ans++;
				}
			}
			else if (j == w - 1) {
				if (a[i][j] % 2 == 1) {
					a[i + 1][j]++;
					res[ans] = { i,j,i + 1,j };
					ans++;
				}
			}
			else {
				if (a[i][j] % 2 == 1) {
					if (a[i][j] % 2 == 1) {
						a[i + 1][j]++;
						res[ans] = { i,j,i+1,j };
						ans++;
					}
					else {
						a[i][j + 1]++;
						res[ans] = { i,j,i,j + 1 };
						ans++;
					}
				}
			}
		}
	}
	cout << ans << endl;
	for (int i = 0; i < ans; i++) {
		cout << res[i].a + 1 << " " << res[i].b + 1 << " " << res[i].c + 1 << " " << res[i].d + 1 << endl;
	}
}

Measured memory_bytes: 6144
def examA():
    N = I()
    if N==1:
        ans = "Hello World"
    elif N==2:
        A = I(); B = I()
        ans = A + B
    try:
        print(ans)
    except:
        print()
    return

import sys,copy,bisect,itertools,heapq,math
from heapq import heappop,heappush,heapify
from collections import Counter,defaultdict,deque
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))
def LSI(): return list(map(str,sys.stdin.readline().split()))
def LS(): return sys.stdin.readline().split()
def SI(): return sys.stdin.readline().strip()
mod = 10**9 + 7
inf = float('inf')

if __name__ == '__main__':
    examA()


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


int main() {
  int n, l;
  cin >> n >> l;
  vector<string> s(n);
  rep(i,n) cin >> s[i];
  sort(s.begin(),s.end());
  string ans="";
  rep(i,n) ans += s[i];
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll  long long
#define endl '\n'
#define FASTINOUT ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
const ll mod = 1000000007;
const double PI = 3.141592653589793238463;
const int N=2e5+9;
vector<int>v[N];
int main()
{
    FASTINOUT;
    int x,m,q;
    cin>>x>>m>>q;
    int r,l,ans=0;
    for (int i=0;i<m;i++){
        cin>>l>>r;
        v[l].push_back(r);
    }
    for (int i=1;i<=m;i++){
        sort(v[i].begin(),v[i].end());
    }
    for (int i=0;i<q;i++){
        cin>>l>>r;
        ans=0;
        for (int i=l;i<=r;i++){
            ans+=upper_bound(v[i].begin(),v[i].end(),r)-v[i].begin();
            //cout<<upper_bound(v[i].begin(),v[i].end(),r)-v[i].begin()<<endl;
        }
        cout<<ans<<endl;
    }
    return 0;
}


Measured memory_bytes: 6912
import collections
s = input()
n = len(s)
k = list(s)
#c = collections.Counter(k)
if n >= 3:
    for i in range(n - 2):
        tmpli = [s[i], s[i + 1], s[i + 2]]
        if len(set(tmpli)) != 3:
            print(i + 1, i + 3)
            exit()
    print(-1, -1)
else:
    if s[0] == s[1]:
        print(1, 2)
    else:
        print(-1, -1)

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

using namespace std;

int main()
{
	string s;
	cin >> s;
	bool use[26] = {};
	bool ok = true;
	for (int i = 0; i < s.size(); i++)
	{
		if (use[s[i] - 'a'])
			ok = false;
		use[s[i] - 'a'] = true;
	}
	if (ok)
		cout << "yes" << endl;
	else
		cout << "no" << endl;

	return 0;
}


Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include <iostream>
#include <string>
#include <list>
#include <vector>
#include <queue>
#include <algorithm>
#include <climits>
#include <cstring>
#include <cmath>
#include <stack>
#include <iomanip>
#include <tuple>
#include <functional>

#define int long long
#define CONTAINS(v,n) (find((v).begin(), (v).end(), (n)) != (v).end())
#define SORT(v) sort((v).begin(), (v).end())
#define RSORT(v) sort((v).rbegin(), (v).rend())
#define ARY_SORT(a, size) sort((a), (a)+(size))
#define MAX(a,b) (((a) > (b)) ? (a) : (b))
#define MIN(a,b) (((a) < (b)) ? (a) : (b))
#define REMOVE(v,a) v.erase(remove(v.begin(), v.end(), a), v.end())
#define REP(i, n) for (int (i) = 0; (i) < (n); (i)++)
using namespace std;

struct St
{
	int index;
	int n;
	bool operator < (const St &st) const
	{
		return (n < st.n);
	}
};

struct Sub
{
	int from;
	int to;
	int sub;
	Sub(int from, int to, int sub)
	{
		this->from = from;
		this->to = to;
		this->sub = sub;
	}
	bool operator < (const Sub &st) const
	{
		return (sub > st.sub);
	}
};

int N;
St sorted_x[100000] = {};
St sorted_y[100000] = {};
int table_x[100000] = {};
int table_y[100000] = {};
bool flg[100000] = {};

priority_queue<Sub> q;

signed main()
{
	cin >> N;
	REP(i, N)
	{
		int x, y;
		cin >> x >> y;
		sorted_x[i].index = i;
		sorted_x[i].n = x;
		sorted_y[i].index = i;
		sorted_y[i].n = y;
	}

	ARY_SORT(sorted_x, N);
	ARY_SORT(sorted_y, N);

	REP(i, N)
	{
		table_x[sorted_x[i].index] = i;
		table_y[sorted_y[i].index] = i;
	}

	int cnt = 0;
	int ans = 0;
	int next = 0;
	flg[0] = true;
	while (true)
	{
		int x = sorted_x[table_x[next]].n;
		int y = sorted_y[table_y[next]].n;
		int xi = table_x[next];
		int yi = table_y[next];

		if (xi > 0)
		{
			int sub = abs(x - sorted_x[xi - 1].n);
			q.push(Sub(sorted_x[xi].index, sorted_x[xi - 1].index, sub));
		}
		if (yi > 0)
		{
			int sub = abs(y - sorted_y[yi - 1].n);
			q.push(Sub(sorted_y[yi].index, sorted_y[yi - 1].index, sub));
		}
		if (xi < N - 1)
		{
			int sub = abs(x - sorted_x[xi + 1].n);
			q.push(Sub(sorted_x[xi].index, sorted_x[xi + 1].index, sub));
		}
		if (yi < N - 1)
		{
			int sub = abs(y - sorted_y[yi + 1].n);
			q.push(Sub(sorted_y[yi].index, sorted_y[yi + 1].index, sub));
		}

		while (true)
		{
			Sub s = q.top();
			q.pop();
			if (!flg[s.to])
			{
				ans += s.sub;
				flg[s.to] = true;
				next = s.to;
				break;
			}
		}

		cnt++;
		if (cnt >= N - 1) break;
	}

	cout << ans << endl;
}


Measured memory_bytes: 13296
#include <bits/stdc++.h>
using namespace std;
#define P pair<int,int>
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define re(i,k,n) for(int i=k;i<n;i++)
#define mod 1000000007;
//最大公約数
int gcd(int s,int b){
    if(b==0)return s;
    return gcd(b,s%b);
}
signed main(){
    int n;
    cin>>n;
    int ans=1;
    rep(i,3){
        ans*=n;
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(int argc, const char * argv[]) {
    int n,m,d;
    while(""){
        scanf("%d %d",&n,&m);
        if(n==0 && m==0)break;
        d=0;
        for(int a = 1 ; a < n-1 ; a++){
            for(int b = a+1 ; b < n ; b++){
                for(int c = b+1 ; c < n+1 ; c++){
                    if(a+b+c==m){
                        d++;
                    }
                }
            }
        }
        printf("%d\n",d);
    }
    
    return 0;
}



Measured memory_bytes: 2104
#define _CRT_SECURE_NO_WARNINGS

#include <stdio.h>
#include <string.h>
#include <algorithm>
#include <set>
#include <map>
#include <vector>
#include <math.h>
#include <cmath>
#include <queue>
#include <stack>
#include <list>
#include <functional>
#include <numeric>
#include <iostream>
#include <string>
#include <time.h>
#include <bitset>

using namespace std;
typedef long long ll;
#define rep(i, n) for (ll i = 0; i < (n); ++i)
#define all(x) (x).begin(),(x).end()
ll GCD(ll a, ll b) { return b ? GCD(b, a % b) : a; }

string S, T;

int main() {

	cin >> S >> T;

	int ans = 0;

	rep(i, S.size()) {
		if (S[i] != T[i]) ans++;
	}

	cout << ans << endl;

	return 0;
}


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

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

	string ans = "";
	for (int i = 0; i < k; i++)
	{
		ans += "ACL";
	}

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 3660
// C - City Savers

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

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

	int A[100001];
	int B[100000];

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

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

	ll ans = 0;
	for (int i=0; i<N; i++) {
		if (A[i] >= B[i]) {
			ans += B[i];
		} else {
			ans += A[i];
			B[i] -= A[i];
			if (A[i+1] >= B[i]) {
				ans += B[i];
				A[i+1] -= B[i];
			} else {
				ans += A[i+1];
				A[i+1] = 0;
			}
		}
	}

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 1024
x , y ,z , k = map(int, input().split())
a = list(map(int,input().split()))
b = list(map(int,input().split()))
c = list(map(int,input().split()))

a.sort(reverse=True)
b.sort(reverse=True)
c.sort(reverse=True)

e = [i + j for i in a[:k] for j in b[:k]]
e.sort(reverse=True)
e = e[:k]
ans = [i + j for i in e for j in c[:k]]
ans.sort(reverse=True)

for i in range(k):
    print(ans[i])


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

int main() {
    string S, st="", en="";
    long Q;
    cin >> S >> Q;
    
    int T[Q] = {0}, F[Q] = {0};
    char C[Q] = {' '};
    bool dir = 0; //1は逆順

    //input
    for(int i = 0; i < Q; ++i){
        cin >> T[i];
        if(T[i]==2) cin >> F[i] >> C[i];
    }

    //edit
    for(int i = 0; i < Q; ++i){
        if(T[i] == 1){
            dir = !dir;
        }
        else{
            if(F[i] == 1){ //文字列 S の先頭に Ci を追加する。
                if(!dir) st = C[i] + st;
                else en += C[i];
            }
            else{ //文字列 S の末尾に Ci を追加する。
                if(!dir) en += C[i];
                else st = C[i] + st;
            }
        }
    }
    
    S = st + S + en;
    if(dir) reverse(S.begin(), S.end());

    cout << S << endl;
}


Measured memory_bytes: 3152
#include <bits/stdc++.h>
using namespace std;
int main() {
    #ifdef DEBUG
    std::ifstream in("/home/share/inputf.in");
    std::cin.rdbuf(in.rdbuf());
    #endif
    int P, Q, R;
    cin >> P >> Q >> R;
    cout << min(min(P + Q, Q + R), R + P) << endl;
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(void){
	int pasta[3];
	int juice[2];
	int minp=2000,minj=2000;
	int i;
	for(i=0;i<3;i++){
		scanf("%d",&pasta[i]);
		if(minp >pasta[i])
			minp=pasta[i];
	}
	for(i=0;i<2;i++){
		scanf("%d",&juice[i]);
		if(minj >juice[i])
			minj=juice[i];
	}

	printf("%d\n",minp+minj-50);

	return 0;
}

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

#define rep(i,m,n) for(int (i)=(int)(m);i<(int)(n);++i)
#define rep2(i,m,n) for(int (i)=(int)(n)-1;i>=(int)(m);--i)
#define REP(i,n) rep(i,0,n)
#define REP2(i,n) rep2(i,0,n)
#define FOR(i,c) for(decltype((c).begin())i=(c).begin();i!=(c).end();++i)
#define all(hoge) (hoge).begin(),(hoge).end()
#define en '\n'
using ll = long long;
using ull = unsigned long long;
template <class T> using vec = vector<T>;
template <class T> using vvec = vector<vec<T>>;
typedef pair<ll, ll> P;
constexpr long long INF = 1LL << 60;
constexpr int INF_INT = 1 << 25;
constexpr long long MOD = (ll) 1e9 + 7;
//constexpr long long MOD = 998244353LL;
using ld=long double;
static const ld pi = 3.141592653589793L;
typedef vector<ll> Array;
typedef vector<Array> Matrix;


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

struct Edge {
	ll to, cap, rev;
	Edge(ll _to, ll _cap, ll _rev) {
	to = _to; cap = _cap; rev = _rev;
	}
};
using Edges = vector<Edge>;
using Graph = vector<Edges>;

void add_edge(Graph& G, ll from, ll to, ll cap, bool revFlag, ll revCap) {
	G[from].push_back(Edge(to, cap, (ll)G[to].size()));
	if (revFlag)G[to].push_back(Edge(from, revCap, (ll)G[from].size() - 1));
}

void solve(){
    ll n;
    cin>>n;
    Array p(n*n);
    REP(i,n*n) cin>>p[i];

    Matrix use(n,Array(n,1));
    Matrix d(n,Array(n,0));
    REP(i,n){
        REP(j,n){
            d[i][j]=min({(ll)i,n-1-i,(ll)j,n-1-j});
        }
    }

    ll dx[4]={0,0,-1,1};
    ll dy[4]={1,-1,0,0};
    queue<P> que;

    ll ans=0;
    REP(i,n*n){
        p[i]--;
        ll y=p[i]/n;
        ll x=p[i]%n;
        use[y][x]=0;
        ans+=d[y][x];
        REP(i,4){
            ll nx=x+dx[i];
            ll ny=y+dy[i];
            if(nx<0 || nx>=n || ny<0 || ny>=n) continue;
            chmin(d[y][x],d[ny][nx]+use[ny][nx]);
        }
        REP(i,4){
            ll nx=x+dx[i];
            ll ny=y+dy[i];
            if(nx<0 || nx>=n || ny<0 || ny>=n) continue;
            if(d[y][x] < d[ny][nx]){
                d[ny][nx]=d[y][x];
                que.push({ny,nx});
            }
        }

        while(que.size()){
            auto [py,px]=que.front();que.pop();
            REP(i,4){
                ll nx=px+dx[i];
                ll ny=py+dy[i];
                if(nx<0 || nx>=n || ny<0 || ny>=n) continue;
                if(d[py][px]+use[py][px] < d[ny][nx]){
                    d[ny][nx]=d[py][px]+use[py][px];
                    que.push({ny,nx});
                }
            }
        }
    }
    cout<<ans<<en;
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
	
	solve();
	//ll t;cin>>t;REP(i,t) solve();

    return 0;
}


Measured memory_bytes: 9256
#include <stdio.h>
typedef long long ll;
#define MAX_N (100010)
#define MAX_W (10010)
int W[MAX_N];
int n, k;

bool check( ll p );


int main()
{

    ll left = 0;
    ll right = (ll)MAX_N * (ll)MAX_W;
    scanf("%d %d", &n, &k);

    for ( int i = 0; i < n; i++ ) {
	scanf("%d", &W[i] );
    }

    while ( right - left > 1) {
	ll mid = ( left + right ) / 2;
	if ( check( mid ) ) {
	    right = mid;
	}
	else {
	    left = mid;
	}
    }
    
    printf("%lld\n", right);

    return 0;
}



bool check( ll p )
{
    int num_track = k;
    ll available = 0;
    for ( int i = 0; i < n; i++ ) {
	if ( W[i] > p ) return false; // ?????????????????????????????????????¶?????????´???
	if ( available < W[i] ) { // ????????????????????´???
	    if ( num_track == 0 ) {
		return false;
	    }
	    else {
		num_track--;
		available = p - W[i];
	    }
	}
	else {
	    available -= W[i];
	}
    }

    return true;
}

Measured memory_bytes: 1416
from sys import stdin, stdout, setrecursionlimit
from collections import deque, defaultdict, Counter
from heapq import heappush, heappop
from functools import lru_cache
import math

#setrecursionlimit(10**6)
rl = lambda: stdin.readline()
rll = lambda: stdin.readline().split()
rli = lambda: map(int, stdin.readline().split())
rlf = lambda: map(float, stdin.readline().split())

INF, NINF = float('inf'), float('-inf')
MOD = 10**9 + 7

def main():
	n = str(int(rl()))
	tot = 0
	for c in n:
		tot += int(c)
	if tot % 9 == 0:
		print("Yes")
	else:
		print("No")

if __name__ == "__main__":
	main()

Measured memory_bytes: 76460
# データの数を受け取る
n = int(input())

# データを受け取る
input_list = [input() for i in range(n)]

# 3 * 4 * 10 の0を用意
count = [[[0 for i in range(10)] for j in range(3)] for k in range(4)]

# インプットデータを基にリスト内の要素を更新
for l in input_list:
    tou, kai, banme, nin = map(int, l.split())
    count[tou - 1][kai - 1][banme - 1] = count[tou - 1][kai - 1][banme - 1] + nin

# 結果を出力
for m in range(4):
    for o in range(3):
        print(" " + " ".join(map(str, count[m][o])))
    if m != 3:
        print("#" * 20)



Measured memory_bytes: 5608
#include<bits/stdc++.h>
using namespace std;
#define next Next
#define gc getchar
#define int long long
const int N=1e6+5;
int n,ans,a[N];
/*char buf[1<<21],*p1=buf,*p2=buf;
inline int gc(){return p1==p2&&(p2=(p1=buf)+fread(buf,1,1<<21,stdin),p1==p2)?EOF:*p1++;}*/
inline int read()
{
    int ret=0,f=0;char c=gc();
    while(!isdigit(c)){if(c=='-')f=1;c=gc();}
    while(isdigit(c)){ret=ret*10+c-48;c=gc();}
    if(f)return -ret;return ret;
}
signed main()
{
	n=read();
	for(int i=1;i<=n;i++)a[i]=read();
	sort(a+1,a+n+1);
	for(int i=1;i<=n;i++)
		for(int j=i+1;j<=n;j++)
		{
			ans+=n-j;
			if(a[n]>=a[i]+a[j])ans-=n-(lower_bound(a+1,a+n+1,a[i]+a[j])-a)+1;
		}
	cout<<ans;
}

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;

int main(){
  int n,m;
  cin >>n >>m;
  vector<ll> h(n);
  rep(i,n) cin >>h[i];
  int num[n] = {0};
  rep(i,m){
    int a,b;
    cin >>a >>b;
    a--; b--;
    if(h[a]<=h[b]) num[a]--;
    if(h[a]>=h[b]) num[b]--;
  }
  int cnt = 0;
  rep(i,n){
    if(num[i]==0) cnt++;
  }
  cout << cnt << endl;
  return 0;
}

Measured memory_bytes: 4556
#include <cstdio>
#include <iostream>
#include <algorithm>
#define MN 201000

int a[MN], b[MN];

int main() 
{
	int n, m; scanf("%d%d", &n, &m); n *= 2;
	for(int i = 1; i <= n; i++) scanf("%d", &a[i]);
	std::sort(a + 1, a + n + 1);
	for(int i = 1; i <= n; i += 2) b[i + 1 >> 1] = a[i];
	int l = 0;
	for(int i = n; i >= 1; i -= 2)
	{
		int p = std::lower_bound(b + 1, b + n / 2 + 1, m - a[i]) - b;
		if(p == n / 2 + 1) l = std::max(l, i + 1);
		l = std::max(l, (p - (n - i) / 2) * 2 - 1);
	}
	int ans = 0;
	for(int i = 1; i < l; i++) ans = std::max(ans, a[i] + a[l - i]);
	for(int i = l; i <= n; i++) ans = std::max(ans, a[i] + a[n - (i - l)] - m);
	printf("%d\n", ans);
}

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

int main() {
    ios::sync_with_stdio(false);
    cin.tie(NULL);
    int N, K, X, Y, sum;
    cin >> N >> K >> X >> Y;
    if (N-K >= 0) {
        sum = K * X + (N-K) * Y;
    } else {
        sum = N * X;
    }
    cout << sum << endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define fi first
#define se second
#define IOS ios::sync_with_stdio(0),cin.tie(0),cout.tie(0)
#define endl '\n'
#define ld long double
typedef pair<ll,ll> pii;
const int maxn=100005;
const int mod=1e9+7;
int cnt[maxn];
int main()
{
    #ifdef local
    freopen("in.txt","r",stdin);
    #endif // local
    IOS;
    int a,b,c;
    cin>>a>>b>>c;
    cnt[a]++,cnt[b]++,cnt[c]++;
    if(cnt[5]==2 && cnt[7]==1) cout<<"YES\n";
    else cout<<"NO\n";
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define F first
#define S second
#define pii pair<int, int>
#define eb emplace_back
#define all(v) v.begin(), v.end()
#define rep(i, n) for (int i = 0; i < n; ++i)
#define rep3(i, l, n) for (int i = l; i < n; ++i)
#define chmax(a, b) a = (a >= b ? a : b)
#define chmin(a, b) a = (a <= b ? a : b)
#define out(a) cout << a << endl
#define outa(a, n) { rep(_, n) cout << a[_] << " "; cout << endl; }
#define SZ(v) (int)v.size()
#define inf (int)(1e9+7)
#define abs(x) (x >= 0 ? x : -(x))
#define ceil(a, b) a / b + !!(a % b)
#define FIX(a) fixed << setprecision(a)

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n;
    cin >> n;
    int a[n];
    rep(i, n) cin >> a[i];
    for (int i = n - 1; i > 0; --i) {
        if (a[i - 1] > a[i]) a[i - 1]--;
    }
    rep(i, n - 1) {
        if (a[i] > a[i + 1]) { out("No"); return 0; }
    }
    out("Yes");
}


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

int main(){
    int a[1000];
    int ans = 0;
    for(int i=0;i<5;i++){
        cin >> a[i];
        if(a[i]==0){
            ans=i+1;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 3596
#include <iostream>
#include <algorithm>
#include <complex>
#include <utility>
#include <vector>
#include <string>
#include <queue>
#include <tuple>
#include <cmath>
#include <bitset>
#include <cctype>
#include <set>
#include <map>
#include <numeric>
#include <functional>
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(ll i=ll(a);i<ll(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define all(x) (x).begin(),(x).end()
#define PRINT(V) cout << V << "\n"
#define SORT(V) sort((V).begin(),(V).end())
#define RSORT(V) sort((V).rbegin(), (V).rend())
using namespace std;
using ll = long long;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
inline void Yes(bool condition){ if(condition) PRINT("Yes"); else PRINT("No"); }
template<class itr> void cins(itr first,itr last){
    for (auto i = first;i != last;i++){
        cin >> (*i);
    }
}
template<class itr> void array_output(itr start,itr goal){
    string ans = "",k = " ";
    for (auto i = start;i != goal;i++) ans += to_string(*i)+k;
    if (!ans.empty()) ans.pop_back();
    PRINT(ans);
}
ll gcd(ll a, ll b) {
    return a ? gcd(b%a,a) : b;
}
const ll INF = 1e15;
const ll MOD = 1000000007;
typedef pair<ll,ll> P;
const ll MAX = 400010;
constexpr ll nx[8] = {1,0,-1,0,-1,-1,1,1};
constexpr ll ny[8] = {0,1,0,-1,-1,1,-1,1};
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n,k,d,b;
    cin >> n >> k;
    vector<int> a(n,0);
    rep(i,k){
        cin >> d;
        rep(i,d){
            cin >> b;
            b--;
            a[b]++;
        }
    }
    int c = 0;
    rep(i,n){
        if (a[i] == 0) c++;
    }
    PRINT(c);
}


Measured memory_bytes: 3664
import sys
input = sys.stdin.readline
sx,sy,tx,ty=map(int,input().split())
dx=tx-sx
dy=ty-sy
keiro=''
keiro+='R'*dx
keiro+='U'*dy
keiro+='L'*dx
keiro+='D'*dy
keiro+='D'
keiro+='R'*(dx+1)
keiro+='U'*(dy+1)
keiro+='LU'
keiro+='L'*(dx+1)
keiro+='D'*(dy+1)
keiro+='R'
print(keiro)

Measured memory_bytes: 3064
# coding: utf-8

N = int(input())
a = list(map(int, input().split())) #A_1,A_2…を入れる

sum = -1
b = 0

while b == 0:
    sum += 1
    for i in range(N):
        if a[i] % 2 == 0:
            a[i] = a[i] / 2
        else:
            b = 1

print(sum)

Measured memory_bytes: 3060
#include "bits/stdc++.h"
#include <boost/multi_array.hpp>
#include <boost/optional.hpp>
#include <boost/range/irange.hpp>
#include <boost/range/algorithm.hpp>
#include <boost/range/adaptors.hpp>
#include <boost/dynamic_bitset.hpp>

namespace adaptor = boost::adaptors;
using namespace std;

void Main()
{
  int N, M, C;
  cin >> N >> M >> C;
  int B[M];
  int i,j;
  for(j=0;j<M;j++) cin >> B[j];

  int a, sum, ans=0;
  for(i=0;i<N;i++)
  {
    sum=C;
    for(j=0;j<M;j++)
    {
      cin >> a;
      sum+= a*B[j];
    }
    if(sum>0) ans++;
  }
  cout << ans << endl;
}

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


Measured memory_bytes: 256