akhauriyash/Code-Regression huggingface dataset:
# include <iostream>
# include <stdint.h>
# include <stdio.h>
# include <math.h>
using namespace std;


int main(){
	int m,f,r ,x;
	
	do{
		cin >>m >>f >>r;
		x= m+f;
		if(m ==-1 && f ==-1 && r == -1) break;
		else if(m == -1|| f ==-1){
			cout <<'F'<<"\n";
		}
		else if(x >=80){
			cout<<'A'<<"\n";
		}
		else if(x>=65 &&x<80){
			cout <<'B'<<"\n";
		}
		else if(x >=50 && x<65){
			cout<<'C'<<"\n";
		}
		else if(x>=30 && x<50){
			if(r>=50){
				cout<<'C'<<"\n";
			}
			else{
				cout<<'D'<<"\n";
			}
		}
		else if(0<=x &&x<30){
			cout<<'F'<<"\n";
		}
		

	}while(m !=-1 || r!=-1 ||f !=-1);
	
	
	return 0;
}



Measured memory_bytes: 3028
#include <stdio.h>

#include <algorithm>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>

using namespace std;

void __print(int x) { cerr << x; }
void __print(long x) { cerr << x; }
void __print(long long x) { cerr << x; }
void __print(unsigned x) { cerr << x; }
void __print(unsigned long x) { cerr << x; }
void __print(unsigned long long x) { cerr << x; }
void __print(float x) { cerr << x; }
void __print(double x) { cerr << x; }
void __print(long double x) { cerr << x; }
void __print(char x) { cerr << '\'' << x << '\''; }
void __print(const char *x) { cerr << '\"' << x << '\"'; }
void __print(const string &x) { cerr << '\"' << x << '\"'; }
void __print(bool x) { cerr << (x ? "true" : "false"); }

template <typename T, typename V>
void __print(const pair<T, V> &x) {
    cerr << '{';
    __print(x.first);
    cerr << ',';
    __print(x.second);
    cerr << '}';
}
template <typename T>
void __print(const T &x) {
    int f = 0;
    cerr << '{';
    for (auto &i : x) cerr << (f++ ? "," : ""), __print(i);
    cerr << "}";
}
void _print() { cerr << "]\n"; }
template <typename T, typename... V>
void _print(T t, V... v) {
    __print(t);
    if (sizeof...(v)) cerr << ", ";
    _print(v...);
}
#ifdef LOCAL
#define debug(x...)               \
    cerr << "[" << #x << "] = ["; \
    _print(x)
#else
#define debug(x...)
#endif

#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end());
#define rep(i, n) for (int i = 0; i < (int)(n); i++)

typedef long long ll;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    ll L, R;
    cin >> L >> R;
    if (R - L >= 2019) { //必ず2019の倍数が含まれる
        cout << 0 << endl;
        return 0;
    } else {
        double min_ans = 1e25;
        for (ll j = L; j < R; j++) { //多くても2019回のループ
            for (ll i = 1; i <= R - L; i++) { //多くても2019回のループ
                if(j+i>R) continue;
                ll ans = (j * (j + i)) % 2019;
                debug(j, i, ans);
                if (ans < min_ans) {
                    min_ans = ans;
                }
            }
        }
        cout << min_ans << endl;
        return 0;
    }
}


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

#define fi first
#define se second
#define all(x) x.begin(), x.end()
using namespace std;
using ull = unsigned long long;
using ll = long long;
constexpr int I_INF = INT_MAX;
constexpr ll L_INF = LLONG_MAX;

struct __INIT {
    __INIT() {
        cin.tie(nullptr);
        ios::sync_with_stdio(false);
        cout << fixed << setprecision(15);
    }
} __init;

//最大公約数
template<class X> X gcd(X a, X b) {return b ? gcd(b,a%b):a;}

template <class X> X lcm2(X a, X b){
    X g = gcd(a, b);
    return a / g * b;
}

int main() {
    ull A, B;
    cin >> A >> B;
    cout << lcm2(A, B) << endl;
}

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

using i64 = int64_t;

int main(){
    i64 w, h;
    cin >> w >> h;
    vector<pair<i64,int>> v;
    for(int i=0;i<w;++i){
        i64 tmp;
        cin >> tmp;
        v.emplace_back(tmp, 0);
    }
    for(int i=0;i<h;++i){
        i64 tmp;
        cin >> tmp;
        v.emplace_back(tmp, 1);
    }

    sort(v.begin(), v.end());
    i64 ans = 0;
    for(auto e: v){
        if(e.second == 0){
            ans += e.first * (h+1);
            w--;
        }else{
            ans += e.first * (w+1);
            h--;
        }
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 6512
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define pii pair<int,int>
#define sorted(a) sort(a.begin(),a.end())
#define rsorted(a) sort(a.rbegin(),a.rend())
#define test(val) cout<<val<<endl;
#define test1(val) cout<<val<<" ";

struct node{
	int cost;
	int arr[20]={0};
};

int required_level;
ll min_cost = 1e14;
int global_flag;
void backtrack(node books[], int start, vector<ll>level,int n, int m, ll current_cost){
	if(start>=n) return;

	for(int i=start;i<n;i++){

		current_cost+=books[i].cost;
		for(int j=0;j<m;j++) level[j]+=books[i].arr[j];

		for(int k=0;k<m;k++){
			if(level[k]<required_level){
				break;
			}
			if(k==m-1){ min_cost = min(min_cost,current_cost); }
		}
		
		backtrack(books,i+1,level,n,m,current_cost);
		for(int j=0;j<m;j++) level[j]-=books[i].arr[j];
		current_cost-=books[i].cost;
	}
	return;
}

void solve(){
	global_flag=0;
	int n,m,x;
	cin>>n>>m>>x;
	required_level=x;
	node books[n];
	vector<ll>level(m,0);
	for(int i=0;i<n;i++){
		cin>>books[i].cost;
		for(int j=0;j<m;j++)
			cin>>books[i].arr[j];
	}
	backtrack(books,0,level,n,m,0ll);
	if(min_cost!=1e14)
	cout<<min_cost<<flush;
	else
	cout<<-1<<flush;
}

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	int t=1;
	// cin>>t;
	while(t--){
		solve();
	}

return 0;
}

Measured memory_bytes: 3596
#include <bits/stdc++.h>
#include <string>
#include <vector>
#include <algorithm>
#define rep(i,w) for (int i = 0;i < (w); ++i)
using namespace std;
using ll = long long;
using P = pair<int,int>;
int INF = 1e9;

const int mod = 1000000007;
class mint {
  long long x;
public:
  mint(long long x=0) : x((x%mod+mod)%mod) {}
  mint operator-() const { 
  return mint(-x);
  }
  mint& operator+=(const mint& a) {
    if ((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator-=(const mint& a) {
    if ((x += mod-a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator*=(const  mint& a) {
    (x *= a.x) %= mod;
    return *this;
  }
  mint operator+(const mint& a) const {
    mint res(*this);
    return res+=a;
  }
  mint operator-(const mint& a) const {
    mint res(*this);
    return res-=a;
  }
  mint operator*(const mint& a) const {
    mint res(*this);
    return res*=a;
  }
  mint pow(ll t) const {
    if (!t) return 1;
    mint a = pow(t>>1);
    a *= a;
    if (t&1) a *= *this;
    return a;
  }
  // for prime mod
  mint inv() const {
    return pow(mod-2);
  }
  mint& operator/=(const mint& a) {
    return (*this) *= a.inv();
  }
  mint operator/(const mint& a) const {
    mint res(*this);
    return res/=a;
  }
  friend ostream& operator<<(ostream& os, const mint& m){
    os << m.x;
    return os;
  }
};

int n,k;
vector<vector<int>> G(100005);
vector<int> num(100005,-1);

void dfs(int v){
  int i = ((v == 0) ? 0 : 1);
  for(auto nv : G[v]){
    if(num[nv] != -1) continue;
    num[nv] = k - 1 - i;
    dfs(nv);
    i++; 
  }
  return;
}

int main(){
  cin >> n >> k;
  rep(i,n-1){
    int a,b;cin >> a >> b;
    --a;--b;
    G[a].push_back(b);
    G[b].push_back(a);
  }
  num[0] = k;
  dfs(0);
  mint ans = 1;
  rep(i,n) ans *= num[i];
  cout << ans << endl;

  
}

Measured memory_bytes: 12580
//#include <bits/stdc++.h>
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
using namespace std;
int n;

int main(){
  cin >> n;
  vector<long> A;
  vector<long> num;
  long x;
  long b;
  for(int i = 0; i < n; i++){
    cin >> x;
    A.push_back(x);
    num.push_back(x - (i + 1));
  }
  sort(num.begin(),num.end());
  b = num[num.size()/2];
  

  long res = 0;
  for(long i = 0; i < n; i++){
    res +=  abs( A[i] - ( b + i+1));
  }

  cout <<  res << endl;



  return 0;
}


Measured memory_bytes: 3564
#include <iostream>
#define ll long long int
using namespace std;

ll max(ll a,ll b){
	if(a>b)return a;
	return b;
}

int main() {
	// your code goes here
	int n;cin>>n;
	ll a[n],sum=0;
	for(int i=0;i<n;i++){cin>>a[i];sum+=a[i];}
	ll dp[n+1][n];
	
	for(int l=1;l<=n;l++){
		for(int i=0;i<n-l+1;i++){
			int j=i+l-1;
			if(l==1){
				dp[i][j]=a[i];
			}else if(l==2){
				dp[i][j]=max(a[i],a[j]);
			}else{
				ll x1,x2;
				if(dp[i+1][j-1]>dp[i+2][j]){
					x1=a[i]+dp[i+2][j];
				}else{
					x1=a[i]+dp[i+1][j-1];
				}
				
				
				if(dp[i][j-2]>dp[i+1][j-1]){
					x2=a[j]+dp[i+1][j-1];
				}else{
					x2=a[j]+dp[i][j-2];
				}
				
				//int x1=a[i]+max(dp[i+2][j],dp[i+1][j-1]);
				//int x2=a[j]+max(dp[i+1][j-1],dp[i][j-2]);
				dp[i][j]=max(x1,x2);
			}
		}
	}
	
/*	for(int i=0;i<n;i++){
		for(int j=i;j<n;j++){
			cout<<dp[i][j]<<" ";
		}cout<<endl;
	}
*/	
	
	ll ans1=dp[0][n-1];
	sum=sum-ans1;
	ans1-=sum;
	cout<<ans1<<endl;
	
	
	
	return 0;
}

Measured memory_bytes: 49720
#include "bits/stdc++.h"
using namespace std;
typedef long long int lint;
typedef pair<lint, lint> plint;
typedef pair<double long, double long> pld;
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) ((lint)(x).size())
#define POW2(n) (1LL << (n))
#define FOR(i, begin, end) for(lint i=(begin),i##_end_=(end);i<i##_end_;i++)
#define IFOR(i, begin, end) for(lint i=(end)-1,i##_begin_=(begin);i>=i##_begin_;i--)
#define REP(i, n) FOR(i,0,n)
#define IREP(i, n) IFOR(i,0,n)
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 T1, typename T2> pair<T1, T2> operator+(const pair<T1, T2>& l, const pair<T1, T2>& r) { return make_pair(l.first + r.first, l.second + r.second); }
template<typename T1, typename T2> pair<T1, T2> operator-(const pair<T1, T2>& l, const pair<T1, T2>& r) { return make_pair(l.first - r.first, l.second - r.second); }
const lint MOD = 1e9 + 7, MAX = 1e18;
typedef long double ld;

int main() {
	cin.tie(0); ios_base::sync_with_stdio(false);
	string s;
	cin >> s;
	REP(i, SZ(s)) {
		if (s[i] == '?') s[i] = 'D';
	}
	cout << s;
}


Measured memory_bytes: 3740
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		long n = sc.nextLong();
		int mod = (int) (Math.pow(10, 9)+7);
		long ans = 1;
		for(int i = 1; i <= n ; i++) {
			ans *= i;
			ans%=mod;
		}
		System.out.println(ans);
	}
}

Measured memory_bytes: 35632
#include <stdio.h>
#include <string.h>

int main(){
    int n, i;
    scanf("%d", &n);
        char str[n];
        scanf("%s", str);
        if(n%2 != 0){
            printf("No\n");
            return 0;
        }
        for(i = 0; i < n/2; i ++){
            if(str[i] != str[i + n/2]){
                printf("No\n");
                return 0;
            }
        }
        printf("Yes\n");
    return 0;
}

Measured memory_bytes: 128
import sys

stdin = sys.stdin

ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline().rstrip()  # ignore trailing spaces

n = input()
ans = ""
for i in range(len(n)):
    if n[i] == "1":
        ans += "9"
    else:
        ans += "1"
print(ans)

Measured memory_bytes: 3060
#pragma region header
#pragma GCC target("avx2")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep1(i, n) for (int i = 1; i <= (int)(n); i++)
#define rev(i, n) for(int i = (int)(n - 1); i >= 0; i--)
#define rev1(i, n) for(int i = (int)(n); i > 0; i--)
#define pb push_back
#define all(v) (v).begin(), (v).end()
#define resort(v) sort((v).rbegin(), (v).rend())
#define vi vector<int>
#define vvi vector<vector<int>>
#define vc vector<char>
#define vvc vector<vector<char>>
#define vb vector<bool>
#define vvb vector<vector<bool>>
using ll = long long;
using P = pair<int, int>;
/* ----------------よく使う数字や配列----------------- */
int dx[] = {1,0,-1,0};
int dy[] = {0,1,0,-1};
constexpr ll mod = 1e9+7;
constexpr ll inf = INT32_MAX/2;
constexpr ll INF = LLONG_MAX/2;
constexpr long double eps = DBL_EPSILON;
constexpr long double pi = 3.141592653589793238462643383279;
/* ----------------------end----------------------- */

/* --------------------テンプレート------------------ */
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;
}
/* ----------------------end----------------------- */

/* --------------------ライブラリ-------------------- */
ll fact(int i) {       //階乗
    if (i == 0) return 1;
    return (fact(i - 1)) * i % mod;
}
ll gcd(ll a, ll b) {        //最大公約数
    if(b == 0) return a;
    return gcd(b, a % b); 
}
ll lcm(ll a, ll b) {      //最小公倍数
    return a / gcd(a, b) * b ;
}
int keta(ll n) {        //桁数を求める
    if(n == 0) return 1;
    int count = 0;
    while(n != 0) {
        n /= 10;
        count++;
    }
    return count;
}
ll ketasum(ll n) {    //各桁の和
    ll sum = 0;
    while(n != 0) {
        sum += n % 10;
        n /= 10;
    }
    return sum;
}
bool isprime(int n) { //素数判定
    if(n==1)return false;
    if(n==2)return true;
    for(int i = 2;i<=sqrt(n);i++) {
        if(n%i==0) return false;
    }
    return true;
}
/* ----------------------end----------------------- */
#pragma endregion

signed main() {
    int h,w;cin >> h >> w;
    int n;cin >> n;
    vi v(n);
    rep(i, n) cin >> v[i];
    queue<int> que;
    rep(i, n) rep(j, v[i]) que.push(i+1);
    vvi ans(h,vi(w));
    rep(i, h) {
        if(i&1) {
            rev(j, w) {
                int p = que.front();que.pop();
                ans[i][j]=p;
            }
        }
        else {
            rep(j, w) {
                int p = que.front();que.pop();
                ans[i][j]=p;
            }
        }
    }
    rep(i, h) {
        rep(j, w) {
            cout << ans[i][j];
            if(j==w-1)cout << endl;
            else cout << ' ';
        }
    }
    return 0;
}

Measured memory_bytes: 3800
#include <iostream>
#include <vector>
#include <cmath>
#include <algorithm>
#include <string>
#include <sstream>
#include <utility>
#define ll long long int
#define rep(i,x,y) for(int i=x;i<y;i++)
#define rel(i,x,y) for(int i=x-1;i>=y;i--)
#define all(x) x.begin(),x.end()
#define MOD 1000000007
using namespace std;

int main(){
	int N,M;
	cin >>N>>M;
	bool a[N+1]={};
	ll dp[N+1] = {};
	rep(i,0,M){
		int tmp;
		cin >> tmp;
		a[tmp] = true;
	}	
	dp[0] = 1;
	rep(i,0,N){
		rep(j,i+1,min(N+1,i+3)){
			if(!a[j]){
				dp[j] += dp[i];
				dp[j] %= MOD;
			}
		}
	}
	cout << dp[N] << endl;
}


Measured memory_bytes: 1152
#include <stdio.h>
#include <ctype.h>

int main()
{
	char a;
	char alpha[27]="abcdefghijklmnopqrstuvwxyz";
	int i;
	int count[26]={0};
	while(1){
		i=scanf("%c", &a);
		if(i==EOF){
			break;
		}
		else if(isalpha(a)){
			a=tolower(a);
			count[a-'a']++;
		}
	}
	for(i=0; i<26; i++){
		printf("%c : %d\n", alpha[i], count[i]);
	}
	return 0;
}

Measured memory_bytes: 548
//============================================================================
// Name        : A.cpp
// Author      : 
// Version     :
// Copyright   : Your copyright notice
// Description : Hello World in C++, Ansi-style
//============================================================================

#include<algorithm>
#include<iostream>
#include<vector>
#include<string>
#include<queue>
#include<stack>
#include<cmath>
#include<list>
#include<set>
#include<map>

using namespace std;

int main() {
	string s;
	cin >> s;
	int ans = 0;
	for(int i = 0; i < s.length(); ++i){
		if(s[i] == '+')++ans;
		else --ans;
	}
	cout << ans << endl;
	
	return 0;
}

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

using namespace std;

int main()
{
    int N, T, c, t;
    cin >> N >> T;
    vector<int> v;

    for (int i = 0; i < N; i++)
    {
        cin >> c >> t;

        if (T >= t)
        {
            v.push_back(c);
        }
    }

    if (v.size() != 0)
    {
        sort(v.begin(), v.end());
        cout << v[0];
    }

    if (v.size() == 0)
    {
        cout << "TLE";
    }
}

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

// 型定義
typedef long long ll;
typedef pair<ll, ll> P;

// forループ
#define REP(i,n) for(ll i=0; i<(ll)(n); ++i)

// 定数宣言
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;

// グラフ表現
using Graph = vector<vector<int>>;

// n次元配列の初期化。第２引数の型のサイズごとに初期化していく。
template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
    std::fill( (T*)array, (T*)(array+N), val );
}

int main()
{
    int A, B, M;
    cin  >> A >> B >> M;

    vector<int> a(A);
    vector<int> b(B);
    vector<int> x(M);
    vector<int> y(M);
    vector<int> c(M);

    int min_A = 1e6;
    int min_B = 1e6;
    REP(i, A){
        cin >> a[i];
        min_A = min(min_A, a[i]);
        
    }
    REP(i, B){
        cin >> b[i];
        min_B = min(min_B, b[i]);
    }
    // 割引を使わない最小
    int ans = min_A + min_B;

    REP(i, M){
        cin >> x[i] >> y[i] >> c[i];
        int temp = a[x[i]-1] + b[y[i]-1] - c[i];
        ans = min(ans, temp);
    }
    cout << ans << endl;
    
    return 0;
}

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

using namespace std;
 
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
 
#define nl '\n'
 
#define y1 aza_ibagaliev
 
#define f first
#define s second
	
#define ed end()
#define bg begin()
#define rbg rbegin()
 
#define rv reverse
#define mp make_pair
#define pb push_back
#define ppb pop_back
#define ppf pop_front
 
#define sz size()
#define all(x) x.bg, x.ed
 
#define pll pair < ll, ll >
#define pii pair < int, int >
 
#define sqr(x) ((x) * 1ll * (x))
#define sqrd(x) ((x) * 1.0 * (x))
 
#define speed ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0)
 
#define rnl cout << "----------------------------------------" << nl
 
#define bit __builtin_popcount
 
inline ll bip(ll x, ll n, ll mod){ll res=1;while(n){if(n & 1){res=(res*x)%mod;}x=(x*x)%mod;n>>=1;}return res;}
        	
const int ppr = 257;
const ll INF = 2e18;
const int inf = 2e9;
const int mod = 1e9 + 7;
const int N = 1e5 + 123;
const ld pi = 3.1741592653589793238462643;
 
const int dx[] = {1, 0, -1, 0};
const int dy[] = {0, 1, 0, -1};

string s, t;
int n, m, dp[3005][3005];
pii pr[3005][3005];

inline void change(int x, int y, int px, int py) {
	if(s[px] == t[py]) pr[x][y] = {px, py};
	else pr[x][y] = pr[px][py];
}

main() {             	
//  freopen(".in", "r", stdin);
//  freopen(".out", "w", stdout);

//	srand(time(NULL));

	cin >> s >> t;

	n = s.size();
	m = t.size();

	s = '#' + s;
	t = '#' + t;

	int mx = 0;
	pii ans = {0, 0};

	for(int i = 1; i <= n; i++)
		for(int j = 1; j <= m; j++) { 
			if(dp[i][j] < dp[i - 1][j - 1] + (s[i] == t[j])) {
				dp[i][j] = dp[i - 1][j - 1] + (s[i] == t[j]);
				change(i, j, i - 1, j - 1);
				if(dp[i][j] > mx) {
					mx = dp[i][j];
					ans = {i, j};
				}
			}
			if(dp[i][j] < dp[i][j - 1]) {
				dp[i][j] = dp[i][j - 1];
				change(i, j, i, j - 1);
				if(dp[i][j] > mx) {
					mx = dp[i][j];
					ans = {i, j};
				}
			}
			if(dp[i][j] < dp[i - 1][j]) {
				dp[i][j] = dp[i - 1][j];
				change(i, j, i - 1, j);
				if(dp[i][j] > mx) {
					mx = dp[i][j];
					ans = {i, j};
				}
			}
		}

	string answer = "";

	while(ans.f) {
		int x = ans.f;
		int y = ans.s;

		if(s[x] == t[y]) answer += s[x];

		ans = pr[x][y];
	}

	rv(all(answer));

	cout << answer;

    return 0;                                        
}

Measured memory_bytes: 105984
#include<bits/stdc++.h>
using namespace std;
int main(){
  long long n,x;
  cin >> n >> x;
  vector<long long> a(n);
  long long sum=0;
  for(int i=0;i<n;i++){
    cin >> a[i];
    sum+=a[i];
  }
  int ans=0;
  if(x<sum){
    sort(a.begin(),a.end());
    for(int i=0;i<n;i++){
      if(x>=a[i]){
        ans++;
        x-=a[i];
      }
      else{
        break;
      }
    }
  }
  else if(x==sum){
    ans=n;
  }
  else{
    ans=n-1;
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
import sys
import copy

N = int(input())

def calcH(x, y, h, cx, cy):
    return (h+abs(cx-x)+abs(cy-y))

XYH = []
for i in range(N):
    x,y,h = map(int, input().split())
    XYH.append([x,y,h])

for cx in range(101):
    for cy in range(101):
        beforeH = ""
        roop = 0
        minH = float('inf')
        for i in range(len(XYH)):
            if XYH[i][2] == 0:
                minH = min(minH, abs(cx-XYH[i][0])+abs(cy-XYH[i][1]))
                roop += 1
            else:
                calced_H = calcH(XYH[i][0], XYH[i][1], XYH[i][2], cx, cy)
                if beforeH == "":
                    beforeH = calced_H
                elif calced_H > minH:
                    break
                elif beforeH != calced_H:
                    break
                roop += 1
        if roop == N and calced_H <= minH:
            print(str(cx)+" "+str(cy)+" "+str(beforeH))
            sys.exit()

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

using namespace std;

typedef long long int64;

int main()
{
  int N, S, W, Q, A[100000];

  while(cin >> N >> S >> W >> Q, N) {

    int g = S;
    for(int i = 0; i < N; i++) {
      A[i] = (g / 7) % 10;
      if(g % 2 == 0) g = g / 2;
      else g = (g / 2) ^ W;
    }

    if(Q == 2 || Q == 5) {
      int64 ret = 0, up[10] = {};
      for(int i = N - 1; i >= 0; i--) {
        up[A[i]]++;
        if(A[i] > 0) {
          if(Q == 5) ret += up[5] + up[0];
          else ret += up[0] + up[2] + up[4] + up[6] + up[8];
        }
      }
      cout << ret << endl;
      continue;
    }

    unordered_map< int, int > sum;
    int mul = 1, now = 0;
    int64 ret = 0;
    sum[0]++;
    for(int i = N - 1; i >= 0; i--) {
      (now += (1LL * A[i] * mul % Q)) %= Q;
      (mul *= 10) %= Q;
      if(A[i] && sum.count(now)) ret += sum[now];
      sum[now]++;
    }
    cout << ret << endl;
  }

}

Measured memory_bytes: 6896
#include<bits/stdc++.h>
#define ll                  long long
#define dl                 double
#define pb                push_back
#define F                  first
#define S                  second
#define endl              "\n"
#define rep(i,a,b)       for(i=a;i<b;i++)
#define all(v)             v.begin(),v.end()
#define allr(v)            v.rbegin(),v.rend()
#define mod              1000000007
#define CIN(V,s,n)      for(int i=s;i<n;i++){cin >> V[i];}
#define COUT(V,s,n)   {for(int i=s;i<n;i++){cout <<  V[i] << " "  ;} cout << endl;}
#define fast               ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define CLEAR(V);      for(ll i=0;i<V.size();i++) V[i] = 0;
#define N                  100000LL
#define tmod            998244353
using namespace std;

bool sBs(const pair<int,int> &a,const pair<int,int> &b)
{   return (a.second < b.second);   }

ll SUMD(ll n);
ll BS(vector<ll> &PS,ll s,ll e,ll ser);
ll MI(ll a, ll m);
bool P[N + 1];
void Sieve(int n=N);
ll Powb(ll b,ll n);

int main()
{
//fast;
ll q=1;
//cin >> q;
while(q--)
{
    ll n,m,k,i,j,l,r,a,b,c=0,g,counter=0,u,v,d,e,w,y;//flag=1;
    //n=m=i=j=l=r=a=t=b=c=u=v=w=p=x=y=0;
    string s1;
    cin >> s1;
    if(s1=="Sunny") cout << "Cloudy";
    else if(s1=="Cloudy") cout << "Rainy";
    else cout << "Sunny";

}
    return 0;
}

//*****************************************************************************************************************************************

ll Powb(ll b,ll n)
{
    if(n==0) return 1LL;
    if(n==1) return b;
    ll temp = Powb(b,n/2);
    if(n%2==0){return (temp*temp)%mod;}
    else{return (b*((temp*temp)%mod))%mod;}
}

ll SUMD(ll n)
{   ll sum=0;
    while(n>0){sum += n%10;n = n/10;}
    return sum;

}
ll BS(vector<ll> &PS,ll s,ll e,ll ser)
{
    if(s>e)
        return s;
    ll mid = (s+e)/2;
    if(PS[mid]==ser)
    {
        return mid;
    }
    else if(PS[mid] > ser)
    {
        return BS(PS,s,mid-1,ser);
    }
    else
        return BS(PS,mid+1,e,ser);
}
ll MI(ll a, ll m)
{
    ll m0 = m;
    ll y = 0, x = 1;
    if (m == 1)
      return 0;
    while (a > 1)
    {
        ll q = a / m;
        ll t = m;
        m = a % m, a = t;
        t = y;
        y = x - q * y;
        x = t;
    }
    if (x < 0)
       x += m0;
    return x;
}

void Sieve(int n)
{
    memset(P,true,sizeof(P));
    P[0] = false;
    P[1]= false;
    for(ll i=2;i*i<=n;i++)
    {
        if(P[i])
        {
            for(ll j=i*i;j<=n;j+=i)
            {
                P[j]=false;
            }
        }
    }

}


Measured memory_bytes: 256
def buy(n,cake,donut):
  cost = cake*4 + donut*7
  if cost == n:
    return True
  elif cost > n:
  	return False
  else:
    if ((n - cost) % 4) == 0 or ((n - cost) % 7) == cost:
      return True
    else:
      return buy(n,cake+1,donut) or buy(n,cake,donut+1)

n = int(input())
if buy(n,0,0):
  print('Yes')
else:
  print('No')
  

Measured memory_bytes: 3060
using System;
using System.Text;
using System.Linq;
using System.Collections;
using System.Collections.Generic;
using static System.Console;
using static System.Math;

namespace AtCoder
{
    public class Program
    {
        public static void Main(string[] args)
        {
            new Program().Solve(new ConsoleInput(Console.In, ' '));
        }

        public void Solve(ConsoleInput cin)
        {
            var N = cin.ReadInt;
            var K = cin.ReadInt;
            var S = cin.Read;

            var chars = S.ToCharArray();
            var count = 0;
            for (int i = 1; i < N; i++)
            {
                if (chars[i - 1] == chars[i])
                {
                    count++;
                }
            }

            var ans = Min(count + 2 * K, N - 1);
            Console.WriteLine(ans);
        }
    }

    public class ConsoleInput
    {
        private readonly System.IO.TextReader _stream;
        private char _separator = ' ';
        private Queue<string> inputStream;
        public ConsoleInput(System.IO.TextReader stream, char separator = ' ')
        {
            this._separator = separator;
            this._stream = stream;
            inputStream = new Queue<string>();
        }
        public string Read
        {
            get
            {
                if (inputStream.Count != 0) return inputStream.Dequeue();
                string[] tmp = _stream.ReadLine().Split(_separator);
                for (int i = 0; i < tmp.Length; ++i)
                    inputStream.Enqueue(tmp[i]);
                return inputStream.Dequeue();
            }
        }
        public string ReadLine { get { return _stream.ReadLine(); }}
        public int ReadInt { get { return int.Parse(Read); }}
        public long ReadLong { get { return long.Parse(Read); }}
        public double ReadDouble { get { return double.Parse(Read); }}
        public string[] ReadStrArray(long N) { var ret = new string[N]; for (long i = 0; i < N; ++i) ret[i] = Read; return ret;}
        public int[] ReadIntArray(long N) { var ret = new int[N]; for (long i = 0; i < N; ++i) ret[i] = ReadInt; return ret;}
        public long[] ReadLongArray(long N) { var ret = new long[N]; for (long i = 0; i < N; ++i) ret[i] = ReadLong; return ret;}
    }
}


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

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

  if (N<=9) {
    cout << "Yes" << endl;
  }
  else if (N==10||N==12||N==14||N==16||N==18||N==20||N==21||N==22||N==24||N==25||N==27){
    cout<<"Yes"<<endl;
  }
  else if(N==28||N==30||N==32||N==35||N==36||N==40||N==42||N==45||N==48||N==49||N==56){
    cout<<"Yes"<<endl;
  }
  else if(N==63||N==64||N==72||N==81||N==15){
    cout<<"Yes"<<endl;
  }
  else {
    cout<<"No"<<endl;
  }
}


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

int main(){
  int K,A,B;
  cin >> K>>A>>B;
  int ans=0;
  
  for(int i=A;i<=B;i++){
    if(i%K==0){
      ans++;
      break;
    }
  }
  if (ans==0)
    cout<<"NG"<<endl;
  else
    cout << "OK"<<endl;
  return 0;
}

Measured memory_bytes: 3636
#include<iostream>
#include<cstdio>
#include<string>
#include<algorithm>
#include<utility>
#include<numeric>
#include<vector>
#include<map>
#include<unordered_map>
#include<set>
#include<tuple>
#include<stack>
#include<queue>
#include<functional>
#include<iterator>
#include<cmath>
#include<cctype>
#include<cassert>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> P;

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

#define FOR(i, a, n) for (ll i = (ll)a; i < (ll)n; ++i)
#define rep(i,n) FOR(i,0,n)

struct edge{int to,cost;};

template<typename T>
void dump_line(T *b,int n){
	for(int i=0;i<n;i++){
		cout << b[i] << " ";
	}
	cout << "\n";
}

ll mypow(ll x,ll n){
	if(n==0) return 1;
	ll res=mypow(x*x,n/2);
	if(n&1) res=res*x;
	return res;
}

ll mod_pow(ll x,ll n,ll mod){
	if(n==0) return 1;
	ll res=mod_pow(x*x%mod,n/2,mod);
	if(n&1) res=res*x%mod;
	return res;
}

int priority[9]={1,7,4,5,3,2,9,6,8};
int match[9]={2,5,5,4,5,6,3,7,6};
bool A[9]={};

map<int,int> ans;

bool dfs(int i,int n){
	if(n==0) return true;
	if(i==9) return false;

	while(i<9 && !A[priority[i]-1]) i++;
	if(i==9) return false;

	int num=priority[i];//マッチで作る数字
	for(int j=n/match[num-1];j>=0;j--){
		if(dfs(i+1,n-j*match[num-1])){
			ans[num]=j;
			return true;
		}
	}
	return false;
}

const int N=1e5;
ll a[N],b[N];

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

	int n;
	cin >> n;
	ll suma=0,sumb=0;
	rep(i,n){
		cin >> a[i];
		suma+=a[i];
	}
	rep(i,n){
		cin >> b[i];
		sumb+=b[i];
	}
	if(suma < sumb){
		cout << "-1\n";
		return 0;
	}

	vector<int> savings;
	ll lack=0;
	int ans=0;
	rep(i,n){
		if(a[i] < b[i]){
			lack+=b[i]-a[i];
			ans++;
		}
		else if(a[i] > b[i]){
			savings.push_back(a[i]-b[i]);
		}
	}
	sort(savings.begin(),savings.end());

	for(auto i=savings.rbegin();lack>0;i++){
		ans++;
		lack-=*i;
	}
	cout << ans << "\n";

	return 0;
}

Measured memory_bytes: 2176
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll MOD = 1e9 + 7;
const ll INF = 1LL << 60;
#define rep(i, a, n) for (ll i = (a); i < (n); i++)
#define debug(x) cerr << #x << ": " << x << endl;
template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}

int main() {
    ll n;
    cin >> n;
    vector<pair<string, pair<ll, ll>>> vec;
    rep(i, 0, n) {
        string s;
        ll p;
        cin >> s >> p;
        vec.emplace_back(make_pair(s, make_pair(-p, i+1)));
    }
    sort(vec.begin(), vec.end());
    for(auto p : vec) {
        cout << p.second.second << endl;
    }
}

Measured memory_bytes: 256
#include <stdio.h>

int main(void){
	int kuku[9][9];
	int i, j;

	for(i = 1; i <= 9; i++){
		for(j = 1; j <= 9; j++){
			kuku[i - 1][j - 1] = i * j;
			printf("%dx%d=%d\n", i, j, kuku[i - 1][j - 1]);
		}
	}
	return 0;
}

Measured memory_bytes: 524
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <map>
#include <cmath>
#include <utility>

using namespace std;


int main(void){
    int n;
    cin >> n;
    multimap<int, int> works;
    for(int i = 0; i < n; i++){
        int a, b;
        cin >> a >> b;
        works.insert(make_pair(b, a));

    }
    int time=0;
    bool flag = true;
    for(auto x: works){
        time += x.second;
        //cout << time <<"-";
        if(time > x.first){
            flag = false;
        }
    }
    if(flag){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
    return 0;

}

Measured memory_bytes: 9600
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <cfloat>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <fstream>
#include <functional>
#include <bitset>
#define chmin(a, b) ((a)=min((a), (b)))
#define chmax(a, b) ((a)=max((a), (b)))
#define fs first
#define sc second
#define eb emplace_back
using namespace std;

typedef long long ll;
typedef pair<int, int> P;
typedef tuple<int, int, int> T;

const ll MOD=1e9+7;
const ll INF=1e18;
const double pi=acos(-1);
const double eps=1e-10;

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

int main(){
    int n; cin>>n;
    vector<int> c(n);
    for(int i=0; i<n; i++) cin>>c[i];

    vector<int> v;
    for(int i=0; i<n; i++){
        v.push_back(c[i]);
        while(i+1<n && c[i]==c[i+1]){
            i++;
        }
    }

    // dp[i] := i 番目まで操作したときの数列の場合の数
    vector<ll> dp(n+10, 0);
    vector<ll> dpsum(200010, 0);
    dp[0]=1;
    for(int i=0; i<v.size(); i++){
        dp[i+1]=dp[i]+dpsum[v[i]];
        dpsum[v[i]]+=dp[i];
        dp[i+1]%=MOD;
        dpsum[v[i]]%=MOD;
    }

    cout << dp[v.size()] << endl;
}

Measured memory_bytes: 5108
#include <bits/stdc++.h>
#define int int64_t
#define REP(i, n) for (int i = 0; (i) < (int)(n); ++ (i))
#define REP3(i, m, n) for (int i = (m); (i) < (int)(n); ++ (i))
#define REP_R(i, n) for (int i = (int)(n) - 1; (i) >= 0; -- (i))
#define REP3R(i, m, n) for (int i = (int)(n) - 1; (i) >= (int)(m); -- (i))
#define REPP(i, n) for (int i = 1; (i) < (int)(n+1); ++ (i))
#define REPR(i, n) for (int i = (int)(n) - 1; (i) >= 0; -- (i))
#define REPRP(i, n) for (int i = (int)(n); (i) >= 0; -- (i))
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define FORP(i, m, n) for(int i = m; i < n+1; i++)
#define FORR(i, a, b) for(int i=(b)-1; i>=(a); i--)
#define ALL(v) v.begin(), v.end()
#define SZ(a) int((a).size())
#define SORT(c) sort((c).begin(),(c).end())
#define SORTR(c) sort((c).begin(),(c).end(),greater<int>());
#define BIT(n) (1LL<<(n))
#define PCNT(x) __builtin_popcountll(x)
#define GCD(x,y) __gcd(x,y)
#define LCM(x,y) x/__gcd(x,y)*y
#define PB push_back
#define MP make_pair
#define endl "\n"
#define pa cout << ans << endl
#define p(x) cout << x << endl
#define pall(x) for(auto iter : x) p(iter)
#define yes cout << "Yes" << endl
#define no cout << "No" << endl
#define yn(x) cout << (x ? "Yes" : "No") << endl
using namespace std;
typedef long double LD;
typedef vector<int> VI;
typedef vector<vector<int> > VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef vector<PII> VPII;
using Graph = vector<vector<int> >;
using WeightedGraph = vector<vector<pair<int, int> > >;
const int INF = 2000000000ll;
const long double PI = acosl(-1);
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }



int power(int a, int b) {return b?power(a*a,b/2)*(b%2?a:1):1;}
int perm(int N, int K){
    int x=1;
    for(int i=1;i<=K;i++)
    {
        x=x*(N-i+1);
    }
    return x;
}
int factorial(int N) {return perm(N,N);}
int comb(int N,int K) {return factorial(N)/factorial(K)/factorial(N-K);}
int hcomb(int N, int K) {return comb(N+K-1, N-1);}

int dtoi(double d) {return round(d);}

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

int mystoi(string S){
    int num = 0;
    for (int i = (int) S.length()-1; i >= 0; i--){
        num += (S[i]-'0') * power(10,S.length()-1-i);
    }
    return num;
}

template<class T>
int SUM(T a) {
    int sum = 0;
    for(auto iter : a) sum += iter;
    return sum;
}

void solve(int K, string S);

signed main() {
    std::ios::sync_with_stdio(false);
    std::cin.tie(nullptr);
    cout << fixed << setprecision(10);
    int K;
    string S;
    cin >> K >> S;
    solve(K, S);
    return 0;
}

void solve(int K, string S) {
    int ans = 0;
    if (SZ(S) <= K) p(S);
    else  {
        cout << S.substr(0,K) << "..." << endl;
    }
}

/*
cd ~/Desktop/Programming/AtCoder/contest/abc168/abc168_b && sh test.sh
cd ~/Desktop/Programming/AtCoder/contest/abc168/abc168_b && sh etest.sh
cd ~/Desktop/Programming/AtCoder/contest/abc168/abc168_b && sh submit.sh
*/


Measured memory_bytes: 3672
#include <bits/stdc++.h>
#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 ll long long
#define lld long double
#define ALL(x) x.begin(), x.end()
#ifdef DEBUG
#define line() cerr << "[" << __LINE__ << "] ";
#define dump(i) cerr << #i ": " << i << " ";
#define dumpl(i) cerr << #i ": " << i << endl;
#else
#define line(i)
#define dump(i)
#define dumpl(i)
#endif
using namespace std;

int main()
{
    int x, a;
    cin >> x >> a;
    if (x < a)
    {
        cout << 0 << endl;
    }
    else
    {
        cout << 10 << endl;
    }

    return 0;
}

Measured memory_bytes: 256
package main

import (
	"bufio"
	"fmt"
	"os"
	"sort"
	"strconv"
)

func out(x ...interface{}) {
	fmt.Println(x...)
}

var sc = bufio.NewScanner(os.Stdin)

func getInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

func getString() string {
	sc.Scan()
	return sc.Text()
}

// min, max, asub, absなど基本関数
func max(a, b int) int {
	if a > b {
		return a
	}
	return b
}

func min(a, b int) int {
	if a < b {
		return a
	}
	return b
}

func asub(a, b int) int {
	if a > b {
		return a - b
	}
	return b - a
}

func abs(a int) int {
	if a >= 0 {
		return a
	}
	return -a
}

func lowerBound(a []int, x int) int {
	idx := sort.Search(len(a), func(i int) bool {
		return a[i] >= x
	})
	return idx
}

func upperBound(a []int, x int) int {
	idx := sort.Search(len(a), func(i int) bool {
		return a[i] > x
	})
	return idx
}

func main() {
	sc.Split(bufio.ScanWords)
	sc.Buffer([]byte{}, 1000000)
	s, K := getString(), getInt()
	for i, v := range s {
		if v != '1' {
			out(string(v))
			return
		}
		// out(i)
		if i+1 == K {
			out(string(v))
			return
		}
	}
}


Measured memory_bytes: 640
#include<stdio.h>

void trace(int A[], int N)
{
   int i;
   for(i=0; i<N; i++) {
      if(i>0) printf(" ");
      printf("%d", A[i]);
   }
   printf("\n");
}

void insertionSort(int A[], int N)
{
   int j, i, v;
   for (i=1; i<N; i++) {
      v = A[i];
      j = i-1;
      while (j>=0 && A[j]>v) {
         A[j+1] = A[j];
         j--;
      }
      A[j+1] = v;
      trace(A, N);
   }
}

int main()
{
   int N, i, j;
   int A[100];

   scanf("%d", &N);
   for(i=0; i<N; i++) scanf("%d", &A[i]);

   trace(A, N);
   insertionSort(A, N);

   return 0;
}

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

bool g[252][252];

int main(){

  while(1){

    int max;

    cin >> max;

    if(max == 0){
      break;
    }

    int n;

    cin >> n;

    for(int i=0;i<n+2;i++){
      for(int j=0;j<n+2;j++){
        g[i][j] = false;
      }
    }

    int mass[n+2];

    mass[0] = 0;
    mass[n+1] = 0;

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

    for(int i=0;i<n+1;i++){
      for(int j=1;j<=max;j++){
        int next;
        if(i+j>=n+2){
          next = n+1;
        }
        else{
          next = i+j+mass[i+j];
        }

        if(next<0) next = 0;
        if(next>n+2) next=n+1;
        g[i][next] = true;
      }
    }

    for(int k=0;k<n+2;k++){
      for(int i=0;i<n+2;i++){
        for(int j=0;j<n+2;j++){
          if(g[i][k] && g[k][j]){
            g[i][j] = true;
          }
        }
      }
    }

    bool flag = true;

    for(int i=0;i<n+1;i++){
      if(g[0][i] && !g[i][n+1]){
        flag = false;
        break;
      }
    }

    if(flag){
      cout << "OK" << endl;
    }
    else{
      cout << "NG" << endl;
    }

  }

}

Measured memory_bytes: 3120
#include <stdio.h>
int main()
{
    int ans=0;
    char s[110];
    scanf("%s",s);
    for(int i=0;;i++){
        int a=s[i];
        if(a=='R'&&i%2==1){
            ans=1;
            break;
        }
        if(a=='L'&&i%2==0){
            ans=1;
            break;
        }
        if(s[i]=='\0')break;
    }
    
    if(ans==1) printf("No");
    else printf("Yes");
}


Measured memory_bytes: 128
IDENTIFICATION DIVISION.
       PROGRAM-ID. ATCODER.
       DATA DIVISION.
       WORKING-STORAGE SECTION.
       01  indata PIC X(100).
       01  a1 PIC 9(08).
       01  a2 PIC 9(08).
       01  a3 PIC 9(08).
       01  r pic 9(08).
       01  g pic 9(08).
       01  r2 pic 9(08).
       01 disp pic Z(20)9.
       PROCEDURE DIVISION.
        ACCEPT a1.
        if a1 = 1 then
         display "Hello World"
        else
         ACCEPT a2
         ACCEPT a3
         compute r = a3 + a2
         MOVE FUNCTION TRIM(r) to disp
         DISPLAY disp
        END-IF
        

       STOP RUN.


Measured memory_bytes: 384
// include
#include <array>
#include <algorithm>
#include <set>
#include <cstdint>
#include <cmath>
#include <iostream>
#include <vector>
#include <list>
#include <map>
#include <string>
#include <unordered_map>


// pow(10, 15) 10の15乗

//  多倍長整数
#include <boost/multiprecision/cpp_int.hpp>
using big_int = boost::multiprecision::cpp_int;


// ============================================
int main() {
  int X;
  std::cin >> X;
  int ans = 0;
  if (X <= 599) {
    ans = 8;
  } else if (X <= 799) {
    ans = 7;
  } else if (X <= 999) {
    ans = 6;
  } else if (X <= 1199) {
    ans = 5;
  } else if (X <= 1399) {
    ans = 4;
  } else if (X <= 1599) {
    ans = 3;
  } else if (X <= 1799) {
    ans = 2;
  } else {
    ans = 1;
  }
  
  std::cout << ans << std::endl;

    return 0;
}


Measured memory_bytes: 3228
n,k = list(map(int,input().split()))
sunuke = [i for i in range(1,n+1)]
have = []
for i in range(k):
    d = int(input())
    a = list(map(int,input().split()))
    for i in a:
        have.append(i)

ans = list(set(sunuke) - set(have))
print(len(ans))


Measured memory_bytes: 9108
let dbg = Printf.printf "[debug]%s"

let max_num = 1_000_000_000

module Tuple2 = struct
  let make x y = (x, y)
  let first (x, _) = x
  let second (_, y) = y
end

let id = fun x -> x
let succ x = x + 1
let pred x = x - 1

let (++) n m =
  let rec aux i =
    if i = m then [m]
    else i :: aux (i+1) in
  if n > m then [] else aux n

let (++^) n m = n ++ (m-1)

let scan fmt f = Scanf.sscanf (read_line ()) fmt f

let scan_lines n fmt f =
  List.map (fun _ -> scan fmt f) (0++^n)

let scan_matrix n m e conv =
  let arr = Array.make_matrix n m e in
  Array.iteri (fun i line ->
      let s = Scanf.Scanning.from_string @@ read_line () in
      Array.iteri (fun j _ ->
          arr.(i).(j) <- Scanf.bscanf s " %s" conv;
        ) line) arr; arr

let between n x m = n <= x && x < m

let string_to_list s =
  List.map (String.get s) (0 ++^ String.length s)

let n = scan "%d" id
let arr = Array.of_list @@ scan_lines n "%d %d" Tuple2.make

let memo = Array.make_matrix n n None

let rec solve n m =
  match memo.(n).(m) with
  | Some v ->  v
  | None ->
    if n = m then 0
    else
      let v = List.map (fun i ->
          let v = Tuple2.first arr.(n) * Tuple2.second arr.(i) * Tuple2.second arr.(m) in
          (solve n i) + (solve (i+1) m) + v) (n ++^ m)
              |> List.fold_left min max_num in
      memo.(n).(m) <- Some v;
      v

let () =
  solve 0 @@ pred n
  |> Printf.printf "%d\n"



Measured memory_bytes: 4740
#include <cassert>
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <cwchar>
#include <cwctype>
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#include <array>
#include <atomic>
#include <chrono>
#include <codecvt>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)
#define rep2(i, n) for(int i = 1; i <= (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#pragma GCC optimize("Ofast")
using namespace std;
typedef int64_t ll;
typedef long double ld;
const ll INF=(1LL<<60);
const ld pi=acosl(1);
const ll mod = 1000000007;
//const ll mod = 998244353;
const int dx[4]={0,1,0,-1};
const int dy[4]={1,0,-1,0};
const int ddx[8]={1,0,-1,-1,-1,0,1,1};
const int ddy[8]={1,1,1,0,-1,-1,-1,0};

void solve(){
  ll n,k;cin>>n>>k;
  vector<ll>x(n);rep(i,n)cin>>x[i];
  ll ans=INF;
  for(int i=0;i+k-1<n;i++){
    ans=min(ans,min(abs(x[i]),abs(x[i+k-1]))+x[i+k-1]-x[i]);
  }
  cout<<ans<<endl;
}

signed main(){
  ios::sync_with_stdio(false);
  cin.tie(nullptr);cout<<fixed;
  cout<<setprecision(30);
  solve();
}


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

int main() {
    int a,b,c,x=0;
    cin>>a>>b>>c;
    x=100*a+10*b+c;
    if(x%4 == 0) cout<<"YES"<<endl;
    else cout<<"NO"<<endl;

    return 0;
}


Measured memory_bytes: 256
from collections import Counter
import math

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

n=int(input())
l=["".join(sorted(input())) for i in range(n)]
c=Counter(l).most_common()
ans=0
for i in range(len(c)):
    if c[i][1]>=2:
        ans+=combinations_count(c[i][1],2)
print(ans)

Measured memory_bytes: 29420
#include<iostream>
#include<math.h>
#include <algorithm>
#include<float.h>
#include <limits>
#include <vector> 
#include <numeric>

#define rep(i,a,n) for(int (i) = (a);(i) < (n);(i)++)
#define MOD 1000000007
#define ll long long

using namespace::std;
int main(){
  string S;
  cin>>S;
  S[5]=' ';
  S[13]=' ';
  cout<<S;
  


}
// int *p = new int[N];

// vector<vector<int>> 変数名(左の個数, vector<int>(右の個数));

//


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

int main() {
  string str;
  int n;
  cin >> n >> str;

  if((int)str.length() <= n) {
    cout << str << endl;
  } else {
    cout << str.erase(n) << "..." << endl;
  }

  return 0;
}


Measured memory_bytes: 3624
#include <iostream>
#include <iomanip>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <algorithm>
#include <cstdio>
#include <utility>
#include <string>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <deque>
#include <numeric>

using namespace std;

typedef uint64_t u64;
typedef int64_t s64;
typedef uint32_t u32;
typedef int32_t s32;
typedef vector<s32> vs32;
typedef vector<u32> vu32;
typedef vector<s64> vs64;
typedef vector<u64> vu64;

const double PI=3.14159265358979323846;

#define MAX(x, y) ((x) < (y) ? (y) : (x))
#define MIN(x, y) ((x) > (y) ? (y) : (x))

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

#define CEIL(x, y) (((x) + (y) - 1) / (y))
#define MOD 1000000007ULL

#define IN(l, r, x) ((l) <= (x) && (x) < (r))

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

    s64 x;
    cin >> x;

    s64 a, b;
    for (a = -1000; a <= 1000; ++a)
    {
        for (b = -1000; b <= 1000; ++b)
        {
            if (a * a * a * a * a - b * b * b * b * b == x)
            {
                cout << a << " " << b << "\n";
                return 0;
            }
        }
    }

    return 0;
}



Measured memory_bytes: 3588