akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;

#if __has_include("print.hpp")
  #include "print.hpp"
#endif

#define ALL(x) (x).begin(), (x).end()
#define RALL(x) (x).rbegin(), (x).rend()
#define MOD 1000000007

typedef long long ll;
typedef pair<int, int> p;

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

int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  int h, w;
  cin >> h >> w;
  vector<string> v(h);
  vector<vector<int>> count(h+1, vector<int> (w+1, 1));
  vector<vector<bool>> visited(h+1, vector<bool> (w+1, false));

  vector<bool> flags(w, false);
  for (int i = 0; i < h; i++) {
    cin >> v[i];
    for (int j = 0; j < w; j++) {
      if(i == 0 && j == 0) continue;

      if(v[i][j] == '#') count[i][j] = 0;
      else{
        if(i == 0 && count[i][j-1] == 0) count[i][j] = 0;
        else if(j == 0 && count[i-1][j] == 0) count[i][j] = 0;
        else if(i >= 1 && j >= 1 && (count[i-1][j] == 0 || count[i][j-1] == 0)) count[i][j] = 0;
      }
    }
  }
  // print(v);
  // print(count);

  //
  // queue<p> q;
  // q.push({0, 0});
  // // visited[0][0] = true;
  // while(!q.empty()) {
  //   int ny = q.front().first;
  //   int nx = q.front().second;
  //   cout << ny << " : " << nx << endl;
  //   q.pop();
  //   for (int i = 0; i < 4; i++) {
  //     v[ny][nx] = '#';
  //     int next_x = nx + dx[i];
  //     int next_y = ny + dy[i];
  //     visited[ny][nx] = true;
  //     if(next_x >= 0 && next_x < w && next_y >= 0 && next_y < h){
  //       // cout << next_y << " : " << next_x << endl;
  //       if(v[next_y][next_x] == '.'){
  //         q.push({next_y, next_x});
  //         if(visited[next_y][next_x]){
  //           count[next_y][next_x] += count[ny][nx];
  //           count[next_y][next_x] %= MOD;
  //         }else{
  //           count[next_y][next_x] = count[ny][nx];
  //           visited[next_y][next_x] = true;
  //         }
  //       }
  //     }
  //   }
  // }
  //
  // print(count);
  // print(visited);
  // cout << count[h-1][w-1] << endl;

  for (int i = 1; i < h; i++) {
    for (int j = 1; j < w; j++) {
      if(v[i][j] == '.') count[i][j] = (count[i-1][j] + count[i][j-1]) % MOD;
      else count[i][j] = 0;
    }
  }

  cout << count[h-1][w-1] << endl;
}


Measured memory_bytes: 5504
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <queue>
#include <limits>
#include <map>
#include <stack>
#include <unordered_map>
#define REP(i,n) for(long (i)=0;(i)<(n);(i)++)
#define REPI(i,a,b) for(long (i)=(a);(i)<(b);(i)++)
#define INF numeric_limits<double>::infinity()
constexpr long MOD = 1e9 + 7;
using namespace std;
using P = pair<long, long>;
using VI = vector<long>;

int main() {
    int n;
    long a;
    long s = 0;
    cin >> n;
    long ans = 0;
    VI v;
    REP(i,n) {
        cin >> a;
        if (a) {
            s += a;
        } else {
            ans += s / 2;
            s = 0;
        }
    }
    ans += s / 2;
    
    cout << ans << endl;
}


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

int main(){
    ll n, a, b;
    ll res = 0;
    cin >> n >> a >> b;

    if((b-a) % 2 != 0) {
        res += min(a-1, n-b) + 1 + (b-a-1)/2;
        cout << res << endl;
    } else {
        res = (b-a)/2;
        cout << res << endl;
    }
}


Measured memory_bytes: 256
n, m = map(int,input().split())
apple = []
for _ in range(n):
    apple.append(list(map(int, input().split())))

for i in apple:
    i.pop(0)
orange = []
for i in apple:
    for j in i:
        orange.append(j)
cat = 0
for i in range(m):
    if orange.count(i + 1) == n:
        cat += 1
    else:
        pass
print(cat)

Measured memory_bytes: 3064
import java.util.*;
import java.io.*;
import java.math.*;

public class Main {
	Scanner sc = new Scanner(System.in);

	void run() {
		for (;;) {
			int m = sc.nextInt();
			int n = sc.nextInt();
			int d = sc.nextInt();

			if ((m | n | d) == 0) {
				break;
			}

			int init[][] = new int[n][m];

			for (int i = 0; i < n; i++) {
				for (int j = 0; j < m; j++) {
					init[i][j] = sc.nextInt();
				}
			}

			int push[][][][] = new int[n][m][n][m];

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

			for (int i = 0; i < n; i++) {
				for (int j = 0; j < m; j++) {

					push[i][j][i][j] = 1;

					for (int z = 0; z < 4; z++) {
						for (int k = 0; k <= d; k++) {
							int ni = dx[z] * k + i;
							int nj = dy[z] * (d - k) + j;

							if (ni < n && ni >= 0) {
								if (nj < m && nj >= 0) {
									push[i][j][ni][nj] = 1;
								}
							}
						}
					}
				}
			}
		

			boolean ng = false;

			boolean used[][] = new boolean[n][m];

			for (int i = 0; i < n && !ng; i++) {
				for (int j = 0; j < m && !ng; j++) {
					int y = 0;
					int x = 0;
					boolean kkks = false;
					for (y=0; y < n; y++) {
						for (x=0; x < m; x++) {
							if (used[y][x]) {
								continue;
							}
							if (push[y][x][i][j] == 1) {
								kkks = true;
								break;
							}
						}
						if (kkks) {
							break;
						}
					}

					
					if (y == n) {
						if (init[i][j] == 1) {
					//		System.out.println(i +" " + j + " fjsaoi");
							ng = true;
							break;
						} else {
							continue;
						}
					}
					

					used[y][x] = true;

					for (int zi = 0; zi < n; zi++) {
						for (int zj = 0; zj < m; zj++) {
							if(used[zi][zj]){
								continue;
							}
							if (push[zi][zj][i][j] == 1) {
								for (int z1 = 0; z1 < n; z1++) {
									for (int z2 = 0; z2 < m; z2++) {
										push[zi][zj][z1][z2] = push[y][x][z1][z2]
												^ push[zi][zj][z1][z2];
									}
								}
							}
						}
					}

					if (init[i][j] == 1) {
						for (int z1 = 0; z1 < n; z1++) {
							for (int z2 = 0; z2 < m; z2++) {
								init[z1][z2] = init[z1][z2]
										^ push[y][x][z1][z2];
							}
						}
					}

				}
			}
/*			
			for(int i =0; i < n ; i++){
				for(int j = 0; j < m ; j++){
					System.out.println("-----------\n"+i+" "+j);
					for(int k = 0; k < n ; k++){
						for(int l = 0 ; l < m ; l++){
							System.out.print(push[i][j][k][l]+" ");
						}	
						System.out.println();
						
						
					}
				}
						
			}
		*/	
			
			if (ng) {
				System.out.println(0);
			} else {
				System.out.println(1);
			}
		}
	}

	public static void main(String[] args) {
		new Main().run();
	}
}

Measured memory_bytes: 0
#include <iostream>
#include <vector>
#include <map>
using namespace std;

int main(){
  int n;
  long long ans = 0;
  cin >> n;
  vector<int> in(n);
  for(int i = 0;i < n;i++){
    cin >> in[i];
  }

  vector<long long> sum(n, 0);
  map<long long, int> M;

  sum[0] = in[0];M[sum[0]]++;
  for(int i = 1 ;i < n;i++){
    sum[i] = in[i] + sum[i-1];
    M[sum[i]]++;
  }

  long long tar = 0;
  for(int i = 0;i < n;i++){
    if (M.count(tar) != 0)ans += M[tar];
    M[sum[i]]--;
    tar += in[i];
  }

  cout << ans << endl;
  return 0;
}


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

#define FOR(i, j, k) for(int i = j; i < k; i++)
#define REP(i, j) FOR(i, 0, j)
#define fst first
#define snd second
#define pb push_back
#define eb emplace_back
#define all(obj) (obj).begin(), (obj).end()
#define rall(obj) (obj).rbegin(), (obj).rend()
typedef long long int ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vi> vvi;

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> istream &operator>>(istream &is, vector<T> &vec) {
    for(T &x : vec)
        is >> x;
    return is;
}

int lx[2001][2001];
int ly[2001][2001];

int main() {

    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.precision(10);
    cout << fixed;

    int h, w;
    cin >> h >> w;

    vector<string> vs(h);
    REP(i, h) cin >> vs[i];

    REP(y, h) {
        int cnt = 0;
        REP(x, w) {
            if(vs[y][x] == '#') {
                cnt = 0;
            } else {
                lx[y][x] = ++cnt;
            }
        }
        for(int x = w - 2; x >= 0; x--) {
            if(vs[y][x] == '.') {
                lx[y][x] = max(lx[y][x], lx[y][x + 1]);
            }
        }
    }

    REP(x, w) {
        int cnt = 0;
        REP(y, h) {
            if(vs[y][x] == '#') {
                cnt = 0;
            } else {
                ly[y][x] = ++cnt;
            }
        }
        for(int y = h - 2; y >= 0; y--) {
            if(vs[y][x] == '.') {
                ly[y][x] = max(ly[y][x], ly[y + 1][x]);
            }
        }
    }

    // REP(y, h) {
    //     REP(x, w) { cout << lx[y][x] << " "; }
    //     cout << endl;
    // }
    // cout << "-- " << endl;
    // REP(y, h) {
    //     REP(x, w) { cout << ly[y][x] << " "; }
    //     cout << endl;
    // }

    int ans = 0;
    REP(x, w) REP(y, h) { ans = max(ans, lx[y][x] + ly[y][x]); }
    cout << ans - 1 << endl;
    return 0;
}


Measured memory_bytes: 35840
// by Isaunoya
#include<bits/stdc++.h>
#define int long long
using namespace std;
struct io {
	char buf[1 << 25 | 3], *s;
	int f;
	io() { f = 0, buf[fread(s = buf, 1, 1 << 25, stdin)] = '\n'; }
	io& operator >> (int&x) {
		for(x = f = 0; !isdigit(*s); ++s) f |= *s  == '-';
		while(isdigit(*s)) x = x * 10 + (*s++ ^ 48);
		return x = f ? -x : x, *this;
	}
};

const int maxn = 2e5 + 52;
int g[maxn];
signed main() {
#ifdef LOCAL
	freopen("testdata.in", "r", stdin);
#endif
	string s;
	cin >> s;
	int n = s.length(), res = 0;
	int x, y;
	x = y = 0;
	g[0] = 1;
	for(int i = 1 ; i <= n ; i ++) g[i] = g[i - 1] * 10 % 2019;
	static int a[23333];
	int ans = 0;
	a[0] = 1;
	for(int i = n - 1; ~i; -- i) {
		x = (s[i] ^ '0') * g[n - i - 1] % 2019;
		ans += a[(x + y) % 2019] ++;
		y = (x + y) % 2019;
	}
	cout << ans << '\n';
	return 0;
}


Measured memory_bytes: 5272
#include <iostream>
#include <vector>
#include <string>
#include <utility>
#include <queue>
#include <algorithm>
#include <map>
#include <set>
#include <cmath>
//#include "h.h"
using namespace std;

#define ll long long
#define pint pair<int, int>
#define pll pair<ll, ll>
#define pb push_back
#define mp make_pair
#define pm(first, second) pb(mp(first, second))
#define SPACE " "
#define fpf first.first
#define fps first.second
#define spf second.first
#define sps second.second

#define all(X) (X).begin(), (X).end()

int main(){

	int N;
	int ans;
	while(true){
		cin >> N;
		if(N == 0)break;
		N = 1000 - N;
		ans = 0;
		ans += N / 500;
		N %= 500;
		ans += N / 100;
		N %= 100;
		ans += N / 50;
		N %= 50;
		ans += N / 10;
		N %= 10;
		ans += N / 5;
		N %= 5;
		ans += N;
		cout << ans << endl;
	}

	return 0;
}


Measured memory_bytes: 3064
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <cassert>

using namespace std;
typedef long long LL;
template <typename F, typename S> std::ostream& operator<<(ostream& os, const pair<F,S>& p) {
    os << "(" << p.first << "," << p.second << ")"; return os; }
template <typename T> ostream& operator<<(ostream& os, const vector<T>& v) {
    os << "["; for(const T& a: v){ os << a << ", "; } os << "]"; return os; }
template <typename K, typename V> ostream& operator<<(ostream& os, const map<K,V>& m) {
    os << "{"; for(const auto& p: m){ os << p.first <<":"<< p.second << ", "; } os << "]"; return os; }


int main(){
    LL n, q;
    cin >> n >> q;
    vector<pair<LL,LL>> a;
    for(LL i = 0; i < n; ++i){
        LL s, t, x;
        cin >> s >> t >> x;
        a.emplace_back(s-x, x);
        a.emplace_back(t-x, -x);
    }
    sort(a.begin(), a.end());
    LL cur = 0;
    set<LL> block;
    for(LL i = 0; i < q; ++i){
        LL d;
        cin >> d;
        while(cur < a.size() && a[cur].first <= d){
            if(a[cur].second < 0){
                block.erase(-a[cur].second);
            }else{
                block.insert(a[cur].second);
            }
            ++cur;
        }
        if(block.empty()){
            cout << -1 << endl;
        }else{
            cout << *block.begin() << endl;
        }
    }
    return 0;
}



Measured memory_bytes: 18664
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		final String t = "qwertyuioplkjhgfdsazxcvbnm";

		System.out.println(t.contains(s) ? "a" : "A");
	}
}



Measured memory_bytes: 35648
#include<algorithm>//sort,二分探索,など
#include<bitset>//固定長bit集合
#include<cmath>//pow,logなど
#include<complex>//複素数
#include<deque>//両端アクセスのキュー
#include<functional>//sortのgreater
#include<iomanip>//setprecision(浮動小数点の出力の誤差)
#include<iostream>//入出力
#include<map>//map(辞書)
#include<numeric>//iota(整数列の生成),gcdとlcm(c++17)
#include<queue>//キュー
#include<set>//集合
#include<stack>//スタック
#include<string>//文字列
#include<unordered_map>//イテレータあるけど順序保持しないmap
#include<unordered_set>//イテレータあるけど順序保持しないset
#include<utility>//pair
#include<vector>//可変長配列

using namespace std;
typedef long double ld;

int main()
{
 ld L;
 cin>>L;
 ld V;
 V = (L/3)*(L/3)*(L/3);
 /*
 cout<<L<<endl;
 cout<<L/3<<endl;
 */
 cout << fixed << setprecision(10) << V << endl;
 return 0;  
}

Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include <iostream>
#include <complex>
#include <algorithm>
#include <vector>
#include <stack>
#include <string>
#include <queue>
#include <cmath>
#include <math.h>
#include <numeric>
#include <list>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <climits>
#include <set>
#include <memory.h>
#include <memory>
#include <cstdio>
#include <cstdlib>
#include <cctype>
#include <cassert>
#include <map>
#include <cassert>
#include <time.h>
#include <ctime>

using namespace std;

typedef complex<double> xy_t;
typedef pair<xy_t, xy_t> line;
typedef long long ll;
typedef pair<int, int> P;
typedef pair<int , P> PP;
typedef pair<int, string> Ps;
typedef vector<int> vec;
typedef vector<vec> mat;
const int INF= 1 << 30;
const double EPS = 1e-9;
const double PI = 3.1415926535897932384626433832795;
const int CLK = CLOCKS_PER_SEC;

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

double cross(const xy_t &a, const xy_t &b){
	return imag(conj(a) * b);
}

double dot(const xy_t &a, const xy_t &b){
	return real(conj(a) * b);
}

xy_t projection(const line &l, const xy_t &p){
	double t = dot(p - l.first, l.first - l.second) / norm(l.first - l.second);
	return l.first + t * (l.first - l.second);
}

int ccw(xy_t a, xy_t b, xy_t c){
	b -= a;
	c -= a;
	if(cross(b, c) > 0) return 1;
	if(cross(b, c) < 0) return -1;
	if(dot(b, c) < 0) return 2;
	if(norm(b) < norm(c)) return -2;
	return 0;
}

bool intersectSP(const line &l, const xy_t &p){
	return abs(l.first- p) + abs(l.second - p) - abs(l.first - l.second) < EPS;
}

bool intersectSS(const line &s, const line &t){
	return ccw(s.first, s.second, t.first) * ccw(s.first, s.second, t.second) <= 0 &&
		ccw(t.first, t.second, s.first) * ccw(t.first, t.second, s.second) <= 0;
}

double distanceSP(line s, xy_t p){
	const xy_t r = projection(s, p);
	if(intersectSP(s, r)) return abs(r - p);
	return min(abs(s.first - p), abs(s.second - p));
}

int main(){
	int n;
	double xp1, yp1, xp2, yp2, xp3, yp3, xk, yk, xs, ys;
	line s, l[3];
	cin >> n;
	rep(t, n){
		cin >> xp1 >> yp1 >> xp2 >> yp2 >> xp3 >> yp3 >> xk >> yk >> xs >> ys;
		l[0] = line(xy_t(xp1, yp1), xy_t(xp2, yp2));
		l[1] = line(xy_t(xp2, yp2), xy_t(xp3, yp3));
		l[2] = line(xy_t(xp3, yp3), xy_t(xp1, yp1));
		s = line(xy_t(xs, ys), xy_t(xk, yk));
		int cnt = 0;
		rep(i, 3) if(intersectSS(l[i], s)) cnt++;
		if(cnt % 2 == 0) cout << "NG" << endl;
		else cout << "OK" << endl;
	}
	return 0;
}

Measured memory_bytes: 0
n = int(input())
h_list = list(map(int, input().split()))

min_v = h_list[-1]
for i in range(n - 1, 0, -1):
    if h_list[i] < min_v:
        min_v = h_list[i]
    if h_list[i - 1] - min_v >= 2:
        print('No')
        break
else:
    print('Yes')

Measured memory_bytes: 14224
#include <stdio.h>
int main(void){
    char a[1200] = {0};
    int i=0,j=0;
    
    for(i=0;i<1200;i++){
        scanf("%c",&a[i]);
        if(a[i]=='\n'){break;}
    }
    
    for(j=0;j<=i;j++){
        if(a[j]>=65 && a[j]<=90){
            a[j] = a[j]+32;
        }
        else if(a[j]>=97 && a[j]<=122){
            a[j] = a[j]-32;
        }
    }
    for(j=0;j<=i;j++){
        printf("%c",a[j]);
    }
    return 0;
}



Measured memory_bytes: 2108
#include <stdio.h>
#include <stdlib.h>
#define M -1

typedef struct{
  int p; //親
  int r; //左の子
  int l; //右の子
}NODE;

void GetDepth(NODE *,int,int,int *);
int GetHeight(NODE *,int,int *);
int GetSibling(NODE *,int);

int main()
{
  int n,i,num,left,right,t,depth[100],height[100],degree;
  NODE T[26];

  scanf("%d",&n);
  if(n<1 || n>25) exit(1);
  for(i=0;i<n;i++) T[i].p = M;
  for(i=0;i<n;i++){
    scanf("%d %d %d",&num,&left,&right); //子を持たない場合は-1
    T[num].l = left;
    T[num].r = right;
    if(left != M) T[left].p = num; //子がいたら親を設定
    if(right != M) T[right].p = num; //同じ
  }

  for(i=0;i<n;i++)
    if(T[i].p == M) t=i; //rootを探す

  GetDepth(T,t,0,depth); //深さ獲得
  GetHeight(T,t,height); //高さ獲得

  for(i=0;i<n;i++){
    degree = 0;
    if(T[i].l != M) degree++; //次数のカウント
    if(T[i].r != M) degree++; //次数のカウント
    printf("node %d: parent = %d, sibling = %d, degree = %d, depth = %d, height = %d, ",i,T[i].p,GetSibling(T,i),degree,depth[i],height[i]);
    if(T[i].p == M) printf("root\n");
    else if(T[i].l == M && T[i].r == M) printf("leaf\n");
    else printf("internal node\n");
  }
  return 0;
}

void GetDepth(NODE *T,int t,int num,int *depth)
{
  if(t == M) return;
  depth[t] = num; //深さを与える
  if(T[t].r != M) GetDepth(T,T[t].r,num+1,depth); //右の兄弟に深さ+1
  if(T[t].l != M) GetDepth(T,T[t].l,num+1,depth); //左の兄弟に深さ+1
}

int GetHeight(NODE *T,int t,int *height)
{
  int h1=0,h2=0;

  if(T[t].l != M) h1 = GetHeight(T,T[t].l,height)+1; //子がいるなら高さ+1
  if(T[t].r != M) h2 = GetHeight(T,T[t].r,height)+1; //同じ
  return height[t] = (h1>h2 ? h1 : h2); //高い方を返して下に進んでいくイメージ
}

int GetSibling(NODE *T,int t)
{
  if(T[t].p == M) return M;
  if(T[T[t].p].l != t && T[T[t].p].l != M) return T[T[t].p].l; //左兄弟がrootでも空でもない場合、左の兄弟を返す
  if(T[T[t].p].r != t && T[T[t].p].r != M) return T[T[t].p].r; //右兄弟がrootでも空でもない場合、右の兄弟を返す
  return M;
}



Measured memory_bytes: 2128
#include <cstdio>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <cstdlib>
#include <set>
#include <queue>
using namespace std;
typedef long long LL;
const int inf = 1 << 30;
const LL INF = 1LL << 60;
const int MaxN = 100005;

int a[5][5];

bool check() {
	int tmp = a[1][1] + a[2][2] + a[3][3];
	for(int i = 1; i <= 3; i++) {
		for(int j = 1; j <= 3; j++) {
			for(int k = 1; k <= 3; k++) {
				if(i != j && j != k && i != k) {
					if(a[1][i] + a[2][j] + a[3][k] != tmp)
						return false;
				}
			}
		}
	}
	return true;
}

int main()
{
	for(int i = 1; i <= 3; i++) 
		for(int j = 1; j <= 3; j++)
			scanf("%d", &a[i][j]);
	if(check() ) printf("Yes\n");
	else printf("No\n");
	return 0;
}

Measured memory_bytes: 128
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Scanner;

public class Main {

	static Scanner sc = new Scanner(System.in);

	public static void main(String[] args) {
		int SZ = 10003;
		int[][] sum = new int[2][SZ];
		while (true) {
			int N = sc.nextInt();
			int R = sc.nextInt();
			if (N == 0) break;
			for (int[] a : sum) {
				Arrays.fill(a, 0);
			}
			ArrayList<ArrayList<Integer>> plus = new ArrayList<ArrayList<Integer>>();
			ArrayList<ArrayList<Integer>> minus = new ArrayList<ArrayList<Integer>>();
			for (int i = 0; i < SZ; ++i) {
				plus.add(new ArrayList<Integer>());
				minus.add(new ArrayList<Integer>());
			}
			for (int i = 0; i < N; ++i) {
				int x1 = Integer.parseInt(sc.next()) + 1;
				int y1 = Integer.parseInt(sc.next()) + 1;
				int x2 = Integer.parseInt(sc.next()) + 1;
				int y2 = Integer.parseInt(sc.next()) + 1;
				plus.get(y1).add(x1);
				plus.get(y2).add(x2);
				minus.get(y1).add(x2);
				minus.get(y2).add(x1);
			}
			int area = 0;
			int len = 0;
			int t = 1;
			for (int i = 1; i < SZ; ++i) {
				Arrays.fill(sum[t], 0);
				for (int v : plus.get(i)) {
					sum[t][v]++;
				}
				for (int v : minus.get(i)) {
					sum[t][v]--;
				}
				for (int j = 1; j < SZ; ++j) {
					sum[t][j] += sum[1 - t][j] + sum[t][j - 1] - sum[1 - t][j - 1];
					if (sum[t][j] > 0) ++area;
					if (sum[t][j] == 0 ^ sum[1 - t][j] == 0) ++len;
					if (sum[t][j] == 0 ^ sum[t][j - 1] == 0) ++len;
				}
				t ^= 1;
			}
			System.out.println(area);
			if (R == 2) System.out.println(len);
		}
	}
}

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

int main() {
  long long N,K;
  cin>>N>>K;
  long long sum=0;
 
  for(int i=K;i<=N+1;i++) {
 sum=sum+(((N-i+1)*i+1)%1000000007);
  }
  cout<<sum%1000000007<<endl;
}
    
    

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

using namespace std;
#define _for(i,j,N) for(int i = (j);i < (N);i++)
#define _rep(i,j,N) for(int i = (j);i <= (N);i++)
#define _dec(i,j,N) for(int i = (N-1);i >= (j);i--)
#define ALL(x) x.begin(),x.end()
#define PB push_back
#define LL long long

template<typename T>
ostream& operator<<(ostream& os,const vector<T>& v) {
    _for(i,0,v.size()) os << v[i] << " ";
    return os;
}

template<typename T>
ostream& operator<<(ostream& os,const set<T>& v){
    for(typename set<T>::iterator it = v.begin();it != v.end();it++)
    os << *it <<" ";
    return os;
}

struct P{
    int x,y;
    P(int x,int y):x(x),y(y){;}
    int deg(){
        return abs(x+y)%2;
    }
};

int N;
vector<P> vp;

int main()
{
    cin >> N;
    int deg = -1;
    _for(i,0,N){
        int x,y;
        cin >> x >> y;
        P t(x,y);
        vp.push_back(t);
        if(i){
            if(deg != t.deg()) {printf("-1\n");return 0;}
        }
        else{
            deg = t.deg();
        }
    }
    vector<LL> vl;
    if(!deg) vl.push_back(1);
    LL num = 1;
    _rep(i,0,31){
        vl.push_back(num);
        num*=2;
    }
    num--;
    reverse(ALL(vl));
    printf("%u\n",vl.size());
    _for(i,0,vl.size()){
        if(i)printf(" ");
        printf("%lld",vl[i]);
    }
    printf("\n");

    _for(i,0,N){
        LL u = vp[i].x + vp[i].y;
        LL v = vp[i].x - vp[i].y;

        if(deg){
            u = (u + num)/2;
            v = (v + num)/2;
        }else{
            u = (u + num + 1)/2;
            v = (v + num + 1)/2;
        }

        _for(j,0,vl.size()){
            int xx = -1,yy = -1;
            if(u >= vl[j]){xx = 1;u-=vl[j];}
            if(v >= vl[j]){yy = 1;v-=vl[j];}
            if(xx == -1 && yy == -1) printf("L");
            else if(xx == 1 && yy == 1) printf("R");
            else if(xx == -1 && yy == 1) printf("D");
            else printf("U");
        }
        printf("\n");
    }

    return 0;
}


Measured memory_bytes: 256
// 2020-07-26 11:08:57
#include<bits/stdc++.h>
#ifdef LOCAL
#include "lib/debug.hpp"
#else
#define debug(...) 1
#endif
#define ALL(a) (a).begin(), (a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define rep(i, n) REP(i, 0, (n))
#define repc(i, n) REPC(i, 0, (n))
#define REP(i, n, m) for (int i = (int)(n); i < (int)(m); i++)
#define REPC(i, n, m) for (int i = (int)(n); i <= (int)(m); i++)
#define REPCM(i, n, m) for (int i = (int)(n); i >= (int)(m); i--)
using namespace std;
using ll = long long;
using ld = long double;
using pr = pair<ll, ll>;
using vll = vector<ll>;
using vpr = vector<pr>;
using P = pair<int, int>;
template<class T> inline bool chmin(T& a, const T& b) { if (a > b) { a = b; return true; } else return false; }
template<class T> inline bool chmax(T& a, const T& b) { if (a < b) { a = b; return true; } else return false; }

void answer() {
  int n, k;
  cin >> n >> k;
  int lim = (n-1) * (n-2) / 2;
  if(k > lim) {
    cout << -1 << '\n';
    return;
  }
  int m = n-1+lim-k;
  cout << m << '\n';
  REPC(i, 2, n) {
    cout << 1 << ' ' << i << '\n';
  }
  REPC(i, 2, n-1) REPC(j, i+1, n) {
    if(k < lim) {
      cout << i << ' ' << j << '\n';
      lim--;
    }
  }
}
int main() {
  std::ios::sync_with_stdio(false);
  std::cin.tie(0);
  answer();
  return 0;
}

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

int digit_sum(int n){
    int sum = 0;
    if(n < 0) 
        return 0;
    while(n > 0){
        sum += n % 10;
        n /= 10;
    }
    return sum;
}

int main(){
    int N, sum1, sum2, min = 999999;
    cin >> N;
    int j = N - 1;
    if(N == 2){
        cout << 2 << endl;
        return 0;
    }
    for(int i=1;i<N && i<j;i++, j--){
        sum1 = digit_sum(i);
        sum2 = digit_sum(j);
        if(sum1 + sum2 < min)
            min = sum1 + sum2;
    }
    cout << min << endl;
    return 0;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
using ll = long long;
using namespace std;
vector<tuple<string,ll,ll>> a;



int main(){
ll N;
cin>>N;
string stmp;
ll tmp;
for(ll i=0;i<N;i++){
  cin>>stmp>>tmp;
  a.emplace_back(stmp,tmp,i+1);
}
sort(a.begin(),a.end());

for(ll i=0;i<N-1;i++)
{
  for(ll j=i;j<N;j++)
  {
    if((get<0>(a[i])==get<0>(a[j]))&&(get<1>(a[i])<get<1>(a[j])))
    iter_swap(a.begin()+i, a.begin()+j);
  }
}


for(ll i=0;i<N;i++)
{
  cout<<get<2>(a[i])<<endl;
}
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <set>
#include <bits/stdc++.h>

using namespace std;


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

	if(s == "Sunny")
	{
		cout << "Cloudy" << endl;
	}else if(s == "Cloudy")
	{
		cout << "Rainy" << endl;
	}else
	{
		cout << "Sunny" << endl;
	}
    return 0;
}

Measured memory_bytes: 256
n,a,b=map(int,input().split())
m=10**9+7
def c(x):
 r=1
 for i in range(x):r=r*(n-i)*pow(i+1,m-2,m)%m
 return r
print((pow(2,n,m)-1-c(a)-c(b))%m)

Measured memory_bytes: 3060
N = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))
before = N
result = 0
for i in range(N):
  result += B[A[i] - 1]
  if before + 1 == A[i] - 1:
    result += C[before]
  before = A[i] - 1
print(result)


Measured memory_bytes: 38256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
    int N, K;
    string ans;
    ans = "No";
    cin >> N >> K;
    vector<int> A(N+1);
    A.at(0) = 0;
    for (int i =1 ; i <= N; i++) {
        cin >> A.at(i);
    }
    for(int i = K+1; i <= N;i++){
        if (A.at(i-K) < A.at(i)) {
            cout << "Yes" << endl;
        }else{
            cout << "No" << endl;
        }
    }
   
}


Measured memory_bytes: 4040
import heapq

N,M = map(int, input().split())
es = [[] for _ in range(N)]

for i in range(M):
    a,b,c = map(int, input().split())
    es[a-1].append((c, b-1))
    es[b-1].append((c, a-1))

INF = float("inf")
# 全ノード間の最短距離を求める
d = [[INF for _ in range(N)] for _ in range(N)]

for i in range(N):
    q = []
    d[i][i] = 0
    heapq.heappush(q, (0, i))
    while q:
        cost, a = heapq.heappop(q)
        if d[i][a] < cost:
            continue
        for c,b in es[a]:
            if d[i][a] + c < d[i][b]:
                d[i][b] = d[i][a] + c
                heapq.heappush(q, (d[i][b], b))


# 全ての辺について、その辺の間の距離cがa->bまでの最短距離か確かめる
# ある辺がいずれかのノード間の最短経路に含まれるなら、その辺（が結ぶノード）も最短距離になるから。
cnt = 0
for i in range(N):
    for c, b in es[i]:
        if d[i][b] != c:
            cnt += 1

# 無向グラフなので２方向分カウントされてるから２で割る
print(cnt//2)

Measured memory_bytes: 3568
#include<iostream>
#include<cstring>
#include<algorithm>
using namespace std;

#define rep(i,n) for(int i=0; i<n; i++)
int dp[50001];	// dp[金額] == コインの最小枚数

int main(){
	int n, m, d[20];
	cin >> n >> m;
	rep(i,m) {
		cin >> d[i];
	}
	rep(i,n+1)  dp[i] = 200000;
	dp[0] = 0;
	rep(coin,m) {
		rep(val,n-d[coin]+1) {
			dp[val+d[coin]] = min( dp[val+d[coin]], dp[val]+1 );
		}
	}
	cout << dp[n] << endl;
	return 0;
}

Measured memory_bytes: 1360
#include<bits/stdc++.h>
#define int long long
using namespace std;

signed main()
{
	string s;
	cin>>s;
	int a=count(s.begin(), s.end(), 'R');
	if(a==0)
		cout<<0<<endl;
	else if(s[1]=='R')
		cout<<a<<endl;
	else
		cout<<1<<endl;
}

Measured memory_bytes: 3584
mod = 10 ** 9 + 7

N = int(input())
S = input()

d = 0
ans = 1
for s in S:
    if (s == "B") ^ (d % 2 != 0):
        d += 1
    else:
        ans = (ans * d) % mod
        d -= 1

if d != 0:
    print(0)
    quit()

for i in range(1, N + 1):
    ans = (ans * i) % mod

print(ans)

Measured memory_bytes: 3572
#include <bits/stdc++.h>
using namespace std;
const int N = (int) 1e5+5;

int main(){
    long long s;
    cin >> s;
    long long x_1 = (long long) sqrt(s);
    if (x_1 * x_1 != s) x_1 ++;
    cout << 0 << ' ' << 0 << ' ' << x_1 << ' ' << 1 << ' ' << x_1 * x_1 - s << ' ' << x_1;

}

Measured memory_bytes: 256
N,A,B,C,D=map(int, input().split())
if N % A == 0 and N % C == 0 and B / A < D / C:
    print(N//A*B)
elif N % A == 0 and N % C == 0 and B / A >= D / C: 
    print(N//C*D)
elif N % A != 0 and N % C == 0 and (N//A+1)*B < N//C*D :
    print((N//A+1)*B)
elif N % A != 0 and N % C == 0 and (N//A+1)*B >= N//C*D:
    print(N//C*D)
elif N % A == 0 and N % C != 0 and N//A*B < (N//C+1)*D:
    print(N//A*B)
elif N % A == 0 and N % C != 0 and N//A*B >= (N//C+1)*D:
    print((N//C+1)*D)
elif N % A != 0 and N % C != 0 and (N//A+1)*B < (N//C+1)*D :
    print((N//A+1)*B)
elif N % A != 0 and N % C != 0 and (N//A+1)*B >= (N//C+1)*D :
    print((N//C+1)*D)
else :
    pass


Measured memory_bytes: 5608
use std::io;
use std::cmp;
use std::collections::BinaryHeap;
use std::collections::HashMap;
use std::collections::HashSet;

fn read_line() -> String {
    let mut buf = String::new();
    io::stdin().read_line(&mut buf).ok();
    buf
}


fn main() {
    let s: Vec<char> = read_line().trim().chars().collect();

    let mut memo = vec![0;s.len()];
    let mut ans = vec![0;s.len()];
    let mut pos = 0;
    while pos < memo.len() {
        if s[pos] == 'R' {
            let mut tmp = pos;
            while tmp < memo.len() && s[tmp] == 'R' {
                tmp += 1;
            }
            for i in 0..tmp-pos {
                memo[i+pos] = tmp-pos - i;
            }
            pos = tmp;
        } else {
            let mut tmp = pos;
            while tmp < memo.len() && s[tmp] == 'L' {
                memo[tmp] = tmp - pos + 1;
                tmp += 1;
            }
            pos = tmp;
        }
    }
    for i in 0..s.len() {
        if s[i] == 'R' {
            if memo[i] %2 == 0 {
                ans[i + memo[i]] += 1;
            } else {
                ans[i + memo[i] - 1] += 1;
            }
        } else {
            if memo[i] %2 == 0 {
                ans[i - memo[i]] += 1;
            } else {
                ans[i - memo[i] + 1] += 1;
            }
        }
    }

    println!("{}", ans.iter().map(|i| i.to_string()).collect::<Vec<String>>().connect(" "));
}


Measured memory_bytes: 10620
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <numeric>
#include <vector>

using namespace std;

int main(void){
    int N=0;
    cin >> N;
    for(int i=1; i<=N; i++){
        if(i % 3 == 0)
            cout << " " << i;
        else{
            int x = i;
            while(x){
                if(x % 10 == 3){
                    cout << " " << i;
                    break;
                }
                x /= 10;
            }
        }
    }
    cout << endl;
}


Measured memory_bytes: 3116
# coding: utf-8

def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)
    divisors.sort()
    return divisors

A, B = map(int, input().split())
dA = make_divisors(A)
dB = make_divisors(B)
Al = list(set(dA) & set(dB))
ans_l = [1]

for i in range(1, len(Al)):
    cnt = 0
    for j in range(i):
        if Al[i] % Al[j] == 0:
            cnt += 1
    if cnt == 1:
        ans_l.append(Al[i])
print(len(set(ans_l)))


Measured memory_bytes: 41348
import sys

sys.setrecursionlimit(10 ** 6)
int1 = lambda x: int(x) - 1
p2D = lambda x: print(*x, sep="\n")
def II(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def LI(): return list(map(int, sys.stdin.readline().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]
def SI(): return sys.stdin.readline()[:-1]

def main():
    n=II()
    aa=LI()
    cnt=[0]*(n+1)
    for a in aa:cnt[a]+=1
    for i in range(1,n+1):
        print(cnt[i])

main()

Measured memory_bytes: 31104
#include <bits/stdc++.h>
using namespace std;
#define rep(i,a,n) for (int i=a;i<n;i++)
#define pb push_back
#define fi first
#define se second
#define sz(A) (int)(A.size())
#define all(x) (x).begin(),(x).end()
#define caset int ___T; cin>>___T; for(int cs=1;cs<=___T;cs++)
#define get(c,x) (lower_bound(c.begin(),c.end(),x)-c.begin())
typedef long long ll;
typedef pair<int, int> PII;
typedef vector<int> VI;
const ll mod = 1e18;
const int Max = 1e6 + 10;
ll powmod(ll a, ll b) { ll res = 1; a %= mod; assert(b >= 0); for (; b; b >>= 1) { if (b & 1)res = res*a%mod; a = a*a%mod; }return res; }

void solve() {
	ll n;
	cin >> n;
	VI ans;
	while (n) {
		ans.push_back(n % 26);
		n /= 26;
	}
	int i = 0;
	while (i<sz(ans)) {
		while (i < sz(ans) && ans[i] != 0)i++;

		while (i < sz(ans) && ans[i] <= 0) {
			if (i + 1 < sz(ans)) {
				ans[i] += 26;
				ans[i + 1]--;
			}
			i++;
		}
	}
	for (int i = sz(ans) - 1; i >= 0; i--) {
		if (ans[i]) {
			cout << (char)('a' + ans[i] - 1);
		}
	}
}
int main() {
	ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	//caset{
	solve();
	//}
	return 0;
}






Measured memory_bytes: 3644
N = int(input())
a = [int(input()) for _ in range(N)]
start = a[0]
counting = 1
coreect = 0
if start == 2:
    print(counting)
    coreect = 1

else:
    while N >= 1:
        
        N -= 1
        counting += 1
        start = a[start-1]
        if start == 2:
            coreect = 1
            print(counting)
            break

if coreect != 1:
    print(-1)

Measured memory_bytes: 7084
#include "bits/stdc++.h"
using namespace std;
int main() {
	string g, h;
	int i = 0;
	vector<int>ireko;
	bool LeftKakko = false;
	int k = 0;
	while ((cin >> g), g != ".") {
		for (int l = 0; l < g.size();++l) {
			char a = g[l];
			if (a == 43) {
				i++;
			}
			else if (a == 45) {
				i--;
			}
			else if (a == 91) {
				ireko.push_back(k);
			}
			else if (a == 93) {
				reverse(h.begin() + ireko.back(), h.end());
				ireko.pop_back();
			}
			else if (a == 63) {
				h += 65;
				i = 0;
				++k;
			}
			else {
				int w;
				for (w = a + i; 64 >= w || w >= 91; (w >= 91) ? w -= 26 : w += 26){}
				h.push_back(w);
				i = 0;
				++k;
			}
		}
		cout << h << endl;
		h.erase();
		k = 0;
	}
	return 0;
}

Measured memory_bytes: 3140
#include <bits/stdc++.h>
#define REP(i,n) for(int i=0;i<(n);++i)
#define ALL(v)   (v).begin(),(v).end()
#define debug(x) cerr<<#x<<": "<<(x)<<endl
#define INF      (int)1e9
#define EPS      (double)1e-9
#define MOD      ((int)1e9+7)
using namespace std;
typedef long long     llong;
typedef vector<int>   vi;
typedef vector<vi >   vvi;
typedef vector<vvi >  vvvi;
typedef pair<int,int> pii;
template<class Type> void line(const Type &a){int cnt=0;for(const auto &elem:a){if(cnt++)cerr<<' ';cout<<elem;}cerr<<endl;}

int count_bits(unsigned x){return (x==0)?0:count_bits(x>>1)+(x&1);}//自然数のビット数を求める.

template<class Type_k,class Type_p>
Type_p mod_pow(long long n,Type_k k,Type_p p){//n^k(mod p).
	if(k==0) return 1;
	long long res=mod_pow(n*n%p,k/2,p);
	if(k&1) res=res*n%p;
	return res;
}

//ツイッター参考.
int main(){//大きくてもn桁なので1回目の操作でn=0~n-1になる!
	int n;
	string s;
	cin>>n>>s;
	
	vi dp(n);//dp[i]:=f(i) (i:0~n-1).
	dp[0]=0;
	for(int i=1;i<n;++i){
		int tmp=count_bits(i);
		dp[i]=dp[i%tmp]+1;
	}
	
	int num=0;		//sの'1'の数.
	int sum[2]={};	//mod num+1とnum-1の場合の合計.
	REP(i,n){
		if(s[i]=='1') num++;
	}
	REP(i,n){
		if(s[i]=='1'){
			sum[0]=(sum[0]+mod_pow(2LL,n-1-i,num+1))%(num+1);
			if(num>1) sum[1]=(sum[1]+mod_pow(2LL,n-1-i,num-1))%(num-1);
		}
	}
	
	REP(i,n){
		if(s[i]=='0'){
			int tmp=(sum[0]+mod_pow(2LL,n-1-i,num+1))%(num+1);
			cout<<dp[tmp]+1<<endl;
		}else{
			if(num==1) cout<<0<<endl;//0割り防止!
			else{
				int tmp=((num-1)+sum[1]-mod_pow(2LL,n-1-i,num-1))%(num-1);
				cout<<dp[tmp]+1<<endl;
			}
		}
	}
}

Measured memory_bytes: 4420
#include<bits/stdc++.h>
using namespace std;
using ll = long long int;
const ll mod=1e9+7;

    void add_self(int&a,int b)
    {
        a+=b;
        if(a>=mod)
            a-=mod;
        return;
    }

    int main()
    {
        int T=1;
        //cin>>T;
        // cin.ignore(); must be there when using getline(cin, s)
        while(T--)
        {
            string a;
            cin>>a;
            int d;
            cin>>d;
            int len=a.length();
            vector<vector<int>> dp(d,vector<int>(2));
            dp[0][0]=1;
            for(int i=0;i<len;i++)
            {
                vector<vector<int>> new_dp(d,vector<int>(2));
                for(int sum=0;sum<d;sum++)
                {
                    for(bool small:{false,true})
                    {
                        for(int dig=0;dig<10;dig++)
                        {
                            if(dig>(a[i]-'0') && !small)
                                break;
                            add_self(new_dp[(sum+dig)%d][small || dig<(a[i]-'0')],dp[sum][small]);
                        }
                    }
                }
                dp=new_dp;
            }
            int ans=dp[0][0]+dp[0][1]%mod;
            ans--;
            if(ans<0)
                ans+=mod;
            cout<<ans;
        }
        return 0;
    }

Measured memory_bytes: 256
import collections

N = int(input())
D = collections.Counter(map(int, input().split()))
M = int(input())
T = collections.Counter(map(int, input().split()))

for i in T.keys():
    if not i in D.keys():
        print("NO")
        exit()
    else:
        if T[i] > D[i]:
            print("NO")
            exit()
print("YES")


Measured memory_bytes: 67680
#include <iostream>
#include <string>

using namespace std;

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

  int N;
  cin >> N;

  string s;
  int m = 0;
  long long T[26] = {0};
  for (int i = 0; i < N; ++i) {
    cin >> s;
    const char c = s[0];
    switch (c) {
      case 'M':
      case 'A':
      case 'R':
      case 'C':
      case 'H':
        T[s[0] - 'A']++;
        ++m;
        break;
      default:
        break;
    }
  }
  long long ans = 0;
  const string C[10] = {
      "ACH", "ARC", "ARH", "MAC", "MAH", "MAR", "MCH", "MRC", "MRH", "RCH",
  };
  for (const auto& a : C) ans += T[a[0] - 'A'] * T[a[1] - 'A'] * T[a[2] - 'A'];
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < n; i++)
#define rrep(i, n) for (int i = n - 1; i >= 0; i--)
using namespace std;
using Graph = vector<vector<int>>;
#define MOD 1000000007
#define MOD2 998244353
#define INF ((1<<30)-1)
#define LINF (1LL<<60)
#define EPS (1e-10)
typedef long long ll;
typedef pair<ll, ll> P;

int main(){
    int k, a, b;
    cin >> k >> a >> b;
    bool flag = false;
    
    for (int  i = a; i <= b; i++){
        if (i % k == 0) flag = true;
    }

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

    return 0;
}

Measured memory_bytes: 3596
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)
#define rep2(i, a, n) for(ll i = a; i < (ll)(n); i++)
#define memi cout << endl
#define kono(n) cout << fixed << setprecision(n)
#define all(c) (c).begin(), (c).end()
#define pb push_back
#define hina cout << ' '
#define in(n) cin >> n
#define in2(n, m) cin >> n >> m
#define in3(n, m, l) cin >> n >> m >> l
#define out(n) cout << n
const ll mei = (ll)1e9 + 7;

int main(){
  ll a, b, c, d, e, h;
  in3(a, b, c);
  in2(d, e);
  out(min({(a + 9) / 10 * 10 + (b + 9) / 10 * 10 + (c + 9) / 10 * 10 + (d + 9) / 10 * 10 + e,
           (a + 9) / 10 * 10 + (b + 9) / 10 * 10 + (c + 9) / 10 * 10 + (e + 9) / 10 * 10 + d,
           (a + 9) / 10 * 10 + (b + 9) / 10 * 10 + (e + 9) / 10 * 10 + (d + 9) / 10 * 10 + c,
           (a + 9) / 10 * 10 + (e + 9) / 10 * 10 + (c + 9) / 10 * 10 + (d + 9) / 10 * 10 + b,
           (e + 9) / 10 * 10 + (b + 9) / 10 * 10 + (c + 9) / 10 * 10 + (d + 9) / 10 * 10 + a}));
  memi;
}

Measured memory_bytes: 256
(defun whether ()
  (let ((w (read)))
    (cond
      ((eql w 'Sunny) (format t "~a" "Cloudy"))
      ((eql w 'Cloudy) (format t "~a" "Rainy"))
      ((eql w 'Rainy) (format t "~a" "Sunny")))))

(whether)

Measured memory_bytes: 10084
#include<stdio.h>
#include<stdlib.h>
#include<math.h>
#include<string.h>
//if(strcmp(s[i],"AC")==0)
//if(s[l]=='#')
/*小文字判定
if((moji>= 'a') && (moji<='z')){
    printf("a\n");
    return 0;
  }
  */
//文字列中の一文字⇒数字の時は s[i]-'0'
int W_Length(char *str){
	int length = 0;
	while(*str++ != '\0')
		length++;
	return length;
}

void swap(long long int *a, long long int *b){
  int temp;
  temp=*a;
  *a=*b;
  *b=temp;
}
//swap(&a, &b)

double deg(double theta){//deg to theta
return theta*(2*3.14159265359)/360;
}

long long int cmp( const void *p, const void *q ) {
    return *(long long int*)p - *(long long int*)q;
}//ちいさい順
//qsort(a,n,sizeof(long long int),cmp);


int cmp_s(const void * left, const void * right)
{
	char *left_char = (char *)left;
  char *right_char = (char *)right;
  return strcmp(left_char, right_char);
}
//qsort(s,n,sizeof(s[0]),cmp_s);
//char s[n][11]

long long int GCD(long long int a, long long int b){
  long long int L=a,S=b;
  while(1){
    if(S>L){
      L=S+L;
      S=L-S;
      L=L-S;
    }
    if(L%S==0){
      return S;
    }
    L=L%S;
  }
  
}

long long int LCM(long long int a, long long int b){
  return a*b/(GCD(a,b));
}

long long int nCr[3000][3000]={0};
 
long long int combination(long long int n, long long int r)
{
    if (r == 0 || r == n){
      nCr[n][r]=1;
        return (1);
    }
    else if (r == 1){
      nCr[n][r]=n;
        return (n);
    }
  if(nCr[n-1][r-1]==0&&nCr[n-1][r]==0){
    nCr[n-1][r-1]=combination(n - 1, r - 1)%1;
    nCr[n-1][r]=combination(n - 1, r)%1;
    return (nCr[n-1][r-1]+nCr[n-1][r]);
  }
  else if(nCr[n-1][r-1]!=0&&nCr[n-1][r]==0){
    nCr[n-1][r]=combination(n-1,r)%1;
    return(nCr[n-1][r-1]+ nCr[n - 1][r]);
  }
  else if(nCr[n-1][r-1]==0&&nCr[n-1][r]!=0){
    nCr[n-1][r-1]=combination(n-1,r-1)%1;
    return(nCr[n-1][r]+ nCr[n - 1][r-1]);
  }
  else{
    return nCr[n-1][r]+nCr[n-1][r-1];
  }
    
}


int main (void)
{
	long long int n,i,min,k,a[210000],b[210000],max=0,m,j=1,count=0,sum=0,a_max;
scanf("%lld%lld%lld",&n,&m,&k);
for(i=1;i<=n;i++){
  scanf("%lld",&a[i]);
}  
for(i=1;i<=m;i++){
  scanf("%lld",&b[i]);
}  
  for(i=1;i<=n;i++){
    sum+=a[i];
    if(sum>k){
      sum=sum-a[i];
      break;
    }
    count++;
    if(max<=count){
      max=count;
    }
  }
  a_max=count;
  count=0;
  for(i=1;i<=m;i++){
    sum+=b[i];
    while(sum>k&&a_max!=0){
      sum-=a[a_max];
      a_max--;
      if(a_max==0){
        break;
      }
    }
    if(sum>k){
      break;
    }
  count++;
    if(a_max+count>max){
      max=a_max+count;
    }
  }
  printf("%lld",max);
return 0;
}


Measured memory_bytes: 4848
import Data.Maybe
import Data.List

main :: IO ()
main = do
  input <- getContents
  putStrLn $ trim (solve (trim input))

--処理
solve :: String -> String
solve [a, _, b] | a == b    = "H"
                | otherwise = "D"

trimHead :: String -> String
trimHead = dropWhile (\s -> isJust (elemIndex s [' ', '\t', '\n', '\r']))

trim :: String -> String
trim = reverse . trimHead . reverse . trimHead

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

const double PI = 3.14159265358979323846;
using namespace std;
typedef long long ll;
const double EPS = 1e-9;
#define rep(i, n) for (int i = 0; i < (n); ++i)
//typedef pair<ll, ll> P;
typedef pair<ll, int> P;
const ll INF = 1e15;
#define cmin(x, y) x = min(x, y)
#define cmax(x, y) x = max(x, y)
#define ret() return 0;

std::istream &operator>>(std::istream &in, set<int> &o) {
    ll a;
    in >> a;
    o.insert(a);
    return in;
}

std::istream &operator>>(std::istream &in, queue<int> &o) {
    ll a;
    in >> a;
    o.push(a);
    return in;
}

bool contain(set<int> &s, int a) { return s.find(a) != s.end(); }

//ifstream myfile("C:\\Users\\riku\\Downloads\\0_00.txt");
//ofstream outfile("log.txt");
//outfile << setw(6) << setfill('0') << prefecture << setw(6) << setfill('0') << rank << endl;
// std::cout << std::bitset<8>(9);
const int mod = 1000000007;
//const ll mod = 1e10;
typedef priority_queue<string, vector<string>, greater<string> > PQ_ASK;

bool check(const vector<int> &arr, const vector<vector<bool>> &bridge) {
    for (int i = 1; i < arr.size(); i++) {
        int from = arr[i - 1];
        int to = arr[i];
        if (!bridge[from][to]) return false;
    }
    return true;
}

int main() {


    int n, m;
    cin >> n >> m;

    vector<vector<bool>> bridge(n, vector<bool>(n, false));
    rep(i, m) {
        int a, b;
        cin >> a >> b;
        a--;
        b--;
        bridge[a][b] = true;
        bridge[b][a] = true;
    }

    vector<int> arr(n);
    rep(i, n)arr[i] = i;

    int ans = 0;
    do {
        bool b = check(arr, bridge);
        if (b) ans++;
    } while (std::next_permutation(arr.begin() + 1, arr.end()));
    cout << ans << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
	long long n,d,ans=0;
	cin>>n;
	for(int i=floor(sqrt(n));i>=1;i--)
	{
		if(n%i==0) 
		{
			d=n/i;
			while(d!=0)
			{
				ans++;
				d=d/10; 
			}
			cout<<ans<<endl;
			break;
		}
	}
}

Measured memory_bytes: 256
package main

import (
	"bufio"
	"fmt"
	"os"
	"strings"
)

var sc = bufio.NewScanner(os.Stdin)

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

func main() {
	nextLine()
	st := strings.Split(nextLine(), " ")
	for k, _ := range(st[0]) {
		fmt.Printf("%c", st[0][k])
		fmt.Printf("%c", st[1][k])
	}
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<bool> vb;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef map<int,int> mii;
typedef map<ll,ll> mll;
#define pi 3.141592653589793
#define mod 998244353
#define pb push_back
#define all(v) v.begin(),v.end()
#define tc int t;cin>>t;while(t--)
#define pqmax priority_queue<int>
#define pqmin priority_queue<int,vi,greater<int>>
#define fast_io ios_base::sync_with_stdio(0), cin.tie(NULL)
#define tc_g int tt;cin>>tt;for(int ti=1;ti<=tt;ti++)
#define case_g "Case #"<<ti<<": "
//bitset<365> a;const double PI = acos(-1);
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
typedef tree<int, null_type, greater_equal<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_multiset;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
typedef tree<int, int, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_map;
using namespace std;
const int INF = 1e9 + 5;
int main() {
    ll N, K;
    cin >> N >> K;
    vi dp(N);
    vi height(N);
    for(auto &it:height) cin >> it;
    dp[0] = 0;
    for(int i = 1; i < N; ++i) {
        int mn = INF;
        for(int j = i - 1; j >= i - K; --j) {
            if(j >= 0)
                mn = min(mn, dp[j] + abs(height[i] - height[j]));
            else
                break;
        }
        dp[i] = mn;
    }
    cout << dp[N - 1] << endl;
}


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

int main() {
    int N;
    cin >> N;
  	vector<long long int> As(N);
    for (int i=0; i<N; i++) {
        cin >> As[i];
        if(As[i]==0){
            cout << "0" << endl;
            exit(0);
        }
    }
  
    long long int res = 1;

    for (int i = 0; i < N; i++)
    {
        if (res > 1000000000000000000/As[i])
        {
            cout << "-1" << endl;
            exit(0);
        }
      res *= As[i];
    }

    cout << res << endl;
}


Measured memory_bytes: 4400
import sys

strs = sys.stdin.readline().split(' ')

while strs[1] != '?':
  num0 = int(strs[0])
  num1 = int(strs[2])
  op = strs[1]

  if op == '+':
    ret = num0 + num1
  elif op == '-':
    ret = num0 - num1
  elif op == '*':
    ret = num0 * num1
  elif op == '/':
    ret = num0 / num1

  print(int(ret))

  strs = sys.stdin.readline().split(' ')


Measured memory_bytes: 5600