akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>

using namespace std;

int main() {
    string s, t;
    cin >> s >> t;
    int l1 = s.length(), l2 = t.length();

    vector <vector <pair <int, int>> > dp(l1 + 1, vector <pair <int, int>> (l2 + 2, {0, 0}));

    for (int i = 1; i <= l1; i++) {
        for (int j = 1; j <= l2; j++) {
            if (s[i - 1] == t[j - 1]) {
                dp[i][j] = {dp[i - 1][j - 1].first + 1, 0};
            }
            else {
                if (dp[i - 1][j].first > dp[i][j - 1].first)
                    dp[i][j] = {dp[i - 1][j].first, -1};
                else
                    dp[i][j] = {dp[i][j - 1].first, 1};
            }
        }
    }

    int len = dp[l1][l2].first;
    string sol(len, 'a');
    int i = l1, j = l2;
    while (i * j > 0) {
        if (dp[i][j].second == 0) {
            i--;
            j--;
            sol[--len] = s[i];
        }
        else if (dp[i][j].second == -1)
            i--;
        else
            j--;
    }

    cout << sol << '\n';
    return 0;
}

Measured memory_bytes: 70784
using System;
using System.Collections.Generic;

class Program
{
    static void Main(string[] args)
    {
        string str = Console.ReadLine();


        char[] chary = str.ToCharArray();

        for (int i = 0; i < chary.Length; i++)
        {
            if (Char.IsUpper(chary[i]))
            {
               chary[i] = Char.ToLower(chary[i]);
               
            }
            else if (Char.IsLower(chary[i]))
            {
               chary[i] = Char.ToUpper(chary[i]);
            }
        }

        foreach (var c in chary)
        {
            Console.Write(c);
        }
        Console.WriteLine();
    }
}


Measured memory_bytes: 15884
using System.Collections.Generic;
using static System.Console;

class Program {
	static void Main() {
		var N = NextInt();
		var ans = 0;

		for (var i = 0; i < N; i++) {
			var l = NextInt();
			var r = NextInt();
			ans += r - l + 1;
		}

		WriteLine(ans);
	}

	static int NextInt() {
		return int.Parse(NextString());
	}

	static string NextString() {
		var result = new List<char>();
		while (true) {
			int next = Read();
			if (next < 0)
				break;
			var nextChar = (char)next;
			if (!char.IsWhiteSpace(nextChar))
				result.Add(nextChar);
			else if (nextChar != '\r')
				break;
		}
		return string.Join("", result);
	}
}


Measured memory_bytes: 13268
#include <iostream>
#include <vector>
#include <numeric>//accumulate(v.begin(), v.end(), 0);
#include <algorithm>//sort(v.begin(),v.end());
#include <string>//
using namespace std;
#define ll long long
#define rep(i, n) for(int i = 0; i < (int)(n); i++)

int main(){
        string s,t;
        int N;
        cin >> N >> s >> t;
        int x = 0;
        for (int i = 1; i <= N; i++) {
                if (s.substr(N - i, i) == t.substr(0, i)) x = i;
        }
        cout << 2 * N - x << endl;

        return 0;
}


Measured memory_bytes: 256
first = input().split(" ")
n = int(first[0])
m = int(first[1])

second = input().split(" ")
items = []
total = 0
for i in range(n):
    items.append(int(second[i]))
    total += int(second[i])

popu = 0
for item in items:
    if item >= (1/(4*m))*total:
        popu += 1

if popu >= m:
    print("Yes")
else:
    print("No")



Measured memory_bytes: 9088
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

fn main() {
    input!{
        s: String,
    }
    println!("{}", 700 + 100 * s.match_indices("o").count() as u64);
}


Measured memory_bytes: 4352
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i=0; i<(int)(n); i++)
using ll = long long;
using vi = vector<int>;
using Graph = vector<vi>;
using P = pair<int, int>;
const int INFTY = 1e9+7;

int main() {
  bitset<100003> L;
  cin >> L;

  vector<ll> pow3n(100003);  // (0,0) (0,1) (1,0)
  pow3n[0] = 1;
  for (int i=1; i<100003; i++) {
    pow3n[i] = pow3n[i-1]*3;
    pow3n[i] %= INFTY;
  }

  ll sum = 0;
  ll tmp = 1;  // (0,1) (1,0)
  for (int i=100002; i>=0; i--) {
    if (L.test(i)) {
      sum = (sum + tmp*pow3n[i]) % INFTY;
      tmp = (tmp*2) % INFTY;
    }
  }
  sum = (sum + tmp) % INFTY;  // A+B == L
  cout << sum << endl;
  return 0;
}


Measured memory_bytes: 1152
#!/usr/bin/env python3
from fractions import gcd

def main():
    N = int(input())
    A = list(map(int, input().split()))
    L = [0] * (N+1)
    R = [0] * (N+1)
    for i in range(N):
        L[i+1] = gcd(L[i], A[i])
        R[N-1-i] = gcd(R[N-i], A[N-1-i])
    ans = 0
    for i in range(N):
        ans = max(ans, gcd(L[i], R[i+1]))
    print(ans)

if __name__ == "__main__":
    main()


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

using namespace std;

using ll = long long;
using pii = pair<int,int>;
using pll = pair<ll,ll>;
using vi = vector<int>;
using vl = vector<ll>;

using _loop_int = int;
#define REP(i,n) for(_loop_int i=0; i<(_loop_int)(n); i++)
#define FOR(i,a,b) for(_loop_int i=(_loop_int)(a); i<(_loop_int)(b); i++)
#define FORR(i,a,b) for(_loop_int i=(_loop_int)(b)-1; i>=(_loop_int)(a); i--)

#define CHMIN(a,b) (a)=min((a),(b))
#define CHMAX(a,b) (a)=max((a),(b))
#define ALL(v) (v).begin(),(v).end()

#define DEBUG(x) cerr<<#x<<": "<<(x)<<endl
#define DEBUG_VEC(v) cerr<<#v<<": ";REP(__i,(v).size())cerr<<((v)[__i])<<", ";cerr<<endl

const ll MOD = 1000000007ll;

int n;
int a[125252];

int main(){
    scanf("%d",&n);
    REP(i,n)scanf("%d",a+i);
    sort(a,a+n);
    int sum = 0;
    stack<int> pos, neg;
    if(a[0]>=0){
        // all positive
        sum = accumulate(a,a+n,0) - 2*a[0];
        neg.push(a[0]);
        FOR(i,1,n)pos.push(a[i]);
    }else if(a[n-1]<=0){
        // all negative
        sum = -accumulate(a,a+n,0) + 2*a[n-1];
        pos.push(a[n-1]);
        REP(i,n-1)neg.push(a[i]);
    }else{
        // sum abs
        REP(i,n)sum += abs(a[i]);
        REP(i,n)(a[i]<0 ? neg : pos).push(a[i]);
    }
    printf("%d\n",sum);
    while(neg.size()>1){
        int p = pos.top(); pos.pop();
        int n = neg.top(); neg.pop();
        pos.push(p-n);
        printf("%d %d\n",p,n);
    }
    int c = neg.top(); neg.pop();
    while(pos.size()>1){
        int p = pos.top(); pos.pop();
        printf("%d %d\n",c,p);
        c = c-p;
    }
    int p = pos.top(); pos.pop();
    printf("%d %d\n",p,c);
    return 0;
}


Measured memory_bytes: 2636
import java.util.Scanner;

public class Main {
	void run() {
		Scanner scan = new Scanner(System.in);
		int n = scan.nextInt();
		int[] a = new int[n];
		for (int i = 0; i < n; i++)
			a[i] = scan.nextInt();
		
		int baseIndex = partition(a, 0, n - 1);
		for (int i = 0; i < n; i++) {
			if (i == baseIndex)
				System.out.print("[" + a[i] + "]");
			else
				System.out.print(a[i]);
			System.out.print(i == n - 1 ? "\n" : " ");
		}
	}
	
	int partition(int[] a, int p, int r) {
		int x = a[r];
		int i = p - 1;
		for (int j = p; j < r; j++) {
			if (a[j] <= x) {
				i += 1;
				int tmp = a[i];
				a[i] = a[j];
				a[j] = tmp;
			}
		}
		int tmp = a[i + 1];
		a[i + 1] = a[r];
		a[r] = tmp;
		return i + 1;
	}

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



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

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

  int max1 = 0;
  int maxi1 = 0;
  int max2;

  for(int i = 0; i < n; i++){
    int a;
    cin >> a;

    if(a >= max1){
      max2 = max1;

      max1 = a;
      maxi1 = i;

    }

    else if(a >= max2){
      max2 = a;
    }
  }

  for(int i = 0; i < n; i++){
    if(i != maxi1) cout << max1 << endl;
    else cout << max2 << endl;
  }

  return 0;

}


Measured memory_bytes: 1664
#include <iostream>

using namespace std;


int main(){

        int n;
        cin >> n;

        int four=0;
        int two=0;
        long long a[n];
        for(int i=0;i<n;++i){
                cin >> a[i];
                if(a[i]%4==0)
                        ++four;
                else if(a[i]%2==0)
                        ++two;
        }

        four += two/2;

        if(n/2 <= four){
                cout << "Yes" << endl;
        }
        else{
                cout << "No" << endl;
        }

        return 0;

}

Measured memory_bytes: 1024
s = input()
odd = "RUD"
even = "LUD"
flag = True
for i in range(len(s)):
    if i % 2 == 0 and s[i] not in odd:
        flag = False
    elif i % 2 != 0 and s[i] not in even:
        flag = False
print("Yes" if flag else "No")

Measured memory_bytes: 3060
import sys
sys.setrecursionlimit(10**6)

readline = sys.stdin.readline

ns = lambda: readline().rstrip()
ni = lambda: int(readline().rstrip())
nm = lambda: map(int, readline().split())
nl = lambda: list(map(int, readline().split()))


n = ni()
G = [list() for _ in range(n)]
for _ in range(n-1):
  a, b = nm()
  a -= 1; b -= 1
  G[a].append(b)
  G[b].append(a)
  
  
mod = 10**9 + 7
dub = [1]*(n+1)
for i in range(n):
  dub[i+1] = dub[i] * 2
  if dub[i+1] > mod:
    dub[i+1] -= mod
    
size = [1]*n
def dfs_depandsize(tree,v,p):
    for x in tree[v]:
        if x == p:
            continue
        size[v] += dfs_depandsize(tree,x,v)
    return size[v]
dfs_depandsize(G, 0, -1)
ans = 0
for v in range(n):
  c = 0
  res = 1
  for x in G[v]:
    if size[x] < size[v]:
      c += size[x]
      res += dub[size[x]] - 1
  res += dub[n-1-c] - 1
  res %= mod
  ans = (ans + dub[n-1] - res) % mod
print(ans * pow(dub[n], mod-2, mod) % mod)


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

int main() {

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

  double answer = 0.0;

  for (int i = 1; i <= N; i++) {
    int v = i;
    int count = 0;
    while (v < K) {
      v *= 2;
      count++;
    }
    answer += pow(0.5, count) / N;
  }
  
  cout << setprecision(15) << answer << endl;

}

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

int main(void){
    cin.tie(0);
    ios_base::sync_with_stdio(false);
    
    int a,b;
    cin>>a>>b;
    cout<<((a*b)%2==0?"Even":"Odd");
    
    return 0;
}


Measured memory_bytes: 3612
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define all(x) (x).begin(),(x).end()
using namespace std;
typedef long long ll;
typedef pair<int,int> P;

int main() {
  std::ios::sync_with_stdio(false);
  std::cin.tie(0);
  priority_queue<ll> que;
  int n, m;
  cin >> n >> m;
  rep(i,n) {
    ll a;
    cin >> a;
    que.push(a);
  }
  rep(i,m) {
    ll a = que.top(); que.pop();
    a /= 2;
    que.push(a);
  }
  ll sum = 0;
  rep(i,n) {
    ll a = que.top(); que.pop();
    sum += a;
  }
  cout << sum << "\n";
  return 0;
}

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

#define p(s) cout<<(s)<<endl
#define REP(i,n,N) for(int i=n;i<N;i++)
#define RREP(i,n,N) for(int i=N-1;i>=n;i--)
#define CK(n,a,b) ((a)<=(n)&&(n)<(b))
#define F first
#define S second
typedef long long ll;
using namespace std;
const int inf=1e9+7;

ll N,K;
ll T[100010];
priority_queue<ll> pq;
ll ans;
int main(){
    cin>>N>>K;
    REP(i,0,N){
        cin>>T[i];
    }

    REP(i,0,N-1){
        pq.push(-(T[i+1] - T[i]));
    }
    REP(i,0,N-K){
        ans -= pq.top();
        pq.pop();
    }
    ans += K;
    p(ans);
    return 0;
}



Measured memory_bytes: 4724
n,m=map(int,input().split())
p=[list(map(int,input().split())) for _ in [0]*n]
ans=0
for i in [1,-1]:
    for j in [1,-1]:
        for k in [1,-1]:
            l=[i*x+j*y+k*z for x,y,z in p]
            l.sort(reverse=True)
            ans=max(ans,sum(l[:m])) 

print(ans)

Measured memory_bytes: 40304
#include <bits/stdc++.h>
 using namespace std;
 int main(){
     int a,b,c,d;
     cin >> a >> b  >> c >> d;
     while (true){
         c -= b;
         if (c <=0){
             cout << "Yes" << endl;
             break;
         }
         a -= d;
         if (a <=0){
             cout << "No" << endl;
             break;
         }
     }

return 0;
 }

Measured memory_bytes: 3588
import sys
from math import *

input = sys.stdin.readline

a, b, x = map(int, input().split())

s = x / a


if s > a*b / 2:
    sankaku = a*b - s
    h = (a*b - s) * 2 / a 
    print(degrees(atan(h/a)))
else:
    w = 2*s/b
    print(degrees(atan(b/w)))
    

Measured memory_bytes: 9276
#include <bits/stdc++.h>
#define rep(i, n) for (lli i = 0; i < (n); i++)
#define rrep(i, n) for (lli i = (n)-1; i >= 0; i--)
using namespace std;
using lli = long long int;
struct line {
  lli a, b;
  line(lli a, lli b): a(a), b(b) {}
  lli v(lli x) { return a * x + b; }
}; vector<line> maxy;
vector<line> maxx;
vector<line> miny;
vector<line> minx;
int conv(char u) {
  if (u == 'D')
    return 3;
  if (u == 'U')
    return 2;
  if (u == 'L')
    return 1;
  if (u == 'R')
    return 0;
  return 0;
}
set<lli> xs[4], ys[4];
lli calc_diffx(lli x) {
  lli ma = -1e18;
  for (auto s : maxx) {
    ma = max(s.v(x), ma);
  }
  lli mi = 1e18;
  for (auto s : minx) {
    mi = min(s.v(x), mi);
  }
  return ma - mi;
}
lli calc_diffy(lli x) {
  lli ma = -1e18;
  for (auto s : maxy) {
    ma = max(s.v(x), ma);
  }
  lli mi = 1e18;
  for (auto s : miny) {
    mi = min(s.v(x), mi);
  }
  return ma - mi;
}
lli calc(lli x) { return calc_diffx(x) * calc_diffy(x); }
int main() {
  int n;
  cin >> n;
  vector<lli> x(n), y(n), d(n);
  char e;
  rep(i, n) cin >> x[i] >> y[i] >> e, d[i] = conv(e);
  rep(i, n) xs[d[i]].insert(2 * x[i]), ys[d[i]].insert(2 * y[i]);
  if (xs[0].size()) {
    maxx.push_back(line(1, *max_element(xs[0].begin(), xs[0].end())));
    minx.push_back(line(1, *min_element(xs[0].begin(), xs[0].end())));
    miny.push_back(line(0, *min_element(ys[0].begin(), ys[0].end())));
    maxy.push_back(line(0, *max_element(ys[0].begin(), ys[0].end())));
  }
  if (xs[1].size()) {
    maxx.push_back(line(-1, *max_element(xs[1].begin(), xs[1].end())));
    minx.push_back(line(-1, *min_element(xs[1].begin(), xs[1].end())));
    miny.push_back(line(0, *min_element(ys[1].begin(), ys[1].end())));
    maxy.push_back(line(0, *max_element(ys[1].begin(), ys[1].end())));
  }
  if (xs[2].size()) {
    maxx.push_back(line(0, *max_element(xs[2].begin(), xs[2].end())));
    minx.push_back(line(0, *min_element(xs[2].begin(), xs[2].end())));
    miny.push_back(line(1, *min_element(ys[2].begin(), ys[2].end())));
    maxy.push_back(line(1, *max_element(ys[2].begin(), ys[2].end())));
  }
  if (xs[3].size()) {
    maxx.push_back(line(0, *max_element(xs[3].begin(), xs[3].end())));
    minx.push_back(line(0, *min_element(xs[3].begin(), xs[3].end())));
    miny.push_back(line(-1, *min_element(ys[3].begin(), ys[3].end())));
    maxy.push_back(line(-1, *max_element(ys[3].begin(), ys[3].end())));
  }
  lli left = 0;
  lli right = 1e9;
  while (right - left > 2) {
      //cout << right << " " << left << endl;
    lli m1 = (left * 2 + right) / 3;
    lli m2 = (left + 2 * right) / 3;
    lli v1 = calc(m1);
    lli v2 = calc(m2);
    if (v1 > v2) {
      left = m1;
    } else {
      right = m2;
    }
  }
  printf("%.10f",0.25 * (double)min({calc(left), calc(left + 1), calc(left + 2)}));
}


Measured memory_bytes: 11264
#include <iostream>
#include <cmath>

using namespace std;

string str;
const string color[8] = {"black","blue","lime","aqua","red","fuchsia",
			 "yellow","white"};
const string strong[8] = {"#000000","#0000ff","#00ff00","#00ffff","#ff0000",
			  "#ff00ff","#ffff00","#ffffff"};

int change(char ch){
  if('0' <= ch && ch <= '9'){
    return ch - '0';
  }
  return 10 + (ch - 'a');
}

int d(string str1,string str2){
  int R1 = change(str1[1])*16 + change(str1[2]);
  int G1 = change(str1[3])*16 + change(str1[4]);
  int B1 = change(str1[5])*16 + change(str1[6]);

  int R2 = change(str2[1])*16 + change(str2[2]);
  int G2 = change(str2[3])*16 + change(str2[4]);
  int B2 = change(str2[5])*16 + change(str2[6]);

  int res = pow(R1-R2,2.0) + pow(G1-G2,2.0) + pow(B1-B2,2.0);

  return res;
}

#define INF (1<<29)

int main(){
  while(cin >> str , str != "0"){
    int min_ = INF,ans;
    for(int i = 0 ; i < 8 ; i++){
      int dist = d(str,strong[i]);
      if(dist < min_){
	min_ = dist;
	ans = i;
      }
    }
    cout << color[ans] << endl;
  }

  return 0;
}

Measured memory_bytes: 1188
N, M, K = map(int, input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
a, b = [0], [0]
for i in range(N):
  a.append(a[i] + A[i])
for i in range(M):
  b.append(b[i] + B[i])
ans, j = 0, M
for i in range(N + 1):
  if a[i] > K:
    break
  while b[j] > K - a[i]:
    j -= 1
  ans = max(ans, i + j)
print(ans)

Measured memory_bytes: 47324
#include<bits/stdc++.h>
typedef long long ll;
using namespace std;
int main(){
	int n,x,y;
	cin>>n>>x>>y;
	int a[n+1],b[n+1],c[n+1];
	ll dp[100][501][501];
	ll INF=(ll)1e9;
	for(int i=0; i<n; i++){
		cin>>a[i]>>b[i]>>c[i];
	}
	for(int i=0; i<=50; i++){
		for(int j=0; j<=500; j++){
			for(int k=0; k<=500; k++){
				dp[i][j][k]=INF;
			}
		}
	}
	dp[0][0][0]=0;
	for(int i=0; i<n; i++){
		for(int j=0; j<500; j++){
			for(int k=0; k<500; k++){
				if(dp[i][j][k]==INF){continue;}
				dp[i+1][j+a[i]][k+b[i]]=min(dp[i+1][j+a[i]][k+b[i]],dp[i][j][k]+c[i]);
				dp[i+1][j][k]=min(dp[i+1][j][k],dp[i][j][k]);
			}
		}
	}
	ll ans=10000000;
		for(int j=1; j<500; j++){
			for(int k=1; k<500; k++){
					if(j*y==k*x){
						ans=min(ans,dp[n][j][k]);
					
				}
			}
		}
	if(ans==10000000){
		cout<<-1;
	}
	else{
		cout<<ans;
    }
}


Measured memory_bytes: 102016
#include <bits/stdc++.h> 
#define FOR(i,a,b) for(int i=(a);i<=(b);++i) 
#define RFOR(i,a,b) for(int i=(a);i>=(b);--i) 
#define REP(i,n) for(int i=0;i<(n);++i)
#define RREP(i,n) for(int i=(n);i>0;--i)
#define CI cin>> 
#define CO cout<<
#define EN <<endl 
#define all(x) (x).begin(),(x).end()
using namespace std;
template <typename T> istream& operator >> (istream& is, vector<T>& vec) { for (T& x : vec) is >> x; 	return is; }
using ll = long long;
using VI = vector<int>;

int main() {
	int n; CI n;
	VI v(n); CI v;
	VI c(n); CI c;
	int ans = 0;
	int x = 0, y = 0;
	REP(i, n) {
		if (v[i] > c[i]) {
			x += v[i];
			y += c[i];
		}
	}
	CO x - y EN;
}

Measured memory_bytes: 256
#pragma GCC optimize("O3")
        #pragma comment(linker, "/stack:200000000")
        #pragma GCC optimize("unroll-loops")
         
        #include <algorithm>
        #include <bitset>
        #include <cassert>
        #include <chrono>
        #include <cmath>
        #include <complex>
        #include <cstdio>
        #include <cstdlib>
        #include <cstring>
        #include <ctime>
        #include <deque>
        #include <functional>
        #include <iomanip>
        #include <iostream>
        #include <iterator>
        #include <limits>
        #include <climits>
        #include <list>
        #include <map>
        #include <numeric>
        #include <queue>
        #include <random>
        #include <ratio>
        #include <set>
        #include <sstream>
        #include <stack>
        #include <string>
        #include <unordered_map>
        #include <unordered_set>
        #include <utility>
        #include <vector>
        using namespace std;
         
        typedef long long ll;
        typedef long double LD;
        #define int ll
        #define double LD
        #define pb push_back
        #define mp make_pair
        #define REP(i,n) for (int i = 0; i < n; i++)
        #define loop(i,n) for (int i = 0; i < n; i++)
        #define FOR(i,a,b) for (int i = a; i < b; i++)
        #define REPD(i,n) for (int i = n-1; i >= 0; i--)
        #define FORD(i,a,b) for (int i = a; i >= b; i--)
        #define remax(a,b) a = max(a,b)
        #define remin(a,b) a = min(a,b)
        #define mem(a, b) memset(a, b, sizeof a)
        #define append push_back
        #define all(v) v.begin(),v.end()
        #define F first
        #define S second
        #define print(x) cout << (x) << endl
        #define PRECISION(x) cout << fixed << setprecision(x)
        #define FAST_IO ios::sync_with_stdio(0); cin.tie(0); cout.tie(0)
         
        const double PI=acos(-1);
        const int MOD = 1000000007;
        const int FMOD = 998244353;
        const double eps = 1e-9;
         
        mt19937 RNG(chrono::steady_clock::now().time_since_epoch().count()); 
       
		signed main()
		{
			int n;
			cin>>n;
			int p=n/500;
			int r=n-p*500;
			int s=r/5;
			cout<<1000*p+5*s;
		}

Measured memory_bytes: 256
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
#define repr(i,a,b) for(int i=a;i<b;i++)
#define rep(i,n) for(int i=0;i<n;i++)
#define invrepr(i,a,b) for(int i=b-1;i>=a;i--)
#define invrep(i,n) invrepr(i,0,n)
#define repitr(itr,a) for(auto itr=a.begin();itr!=a.end();++itr)
#define P pair<int,int>
const int MOD=1e9+7;
const int INF=2e9;


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

    vector<int> x(13);
    x[4]=1;
    x[6]=1;
    x[9]=1;
    x[11]=1;
    x[2]=2;

    int a,b; 
    cin >> a >> b;
    if (x[a]==x[b]) cout << "Yes" << endl;
    else cout << "No" << endl;
    

    return 0;   
}


Measured memory_bytes: 256
#include<stdio.h>

int main(){
	int i,n,count=0;
	int train[100];
	while(scanf("%d",&n)!=EOF){
		if(n!=0){
			train[count]=n;
			count++;
		}else{
			printf("%d\n",train[count-1]);
			count--;
		}
	}
	return 0;
}

Measured memory_bytes: 600
program main
    implicit none
    integer :: n,i

    read(*,*)n
    if (n >= 64) then
      write(*,*)64
    else if (n >= 32) then
      write(*,*)32
    else if (n >= 16) then
      write(*,*)16
    else if (n >= 8) then
      write(*,*)8
    else if (n >= 4) then
      write(*,*)4
    else if (n >= 2) then
      write(*,*)2
    else
      write(*,*)1
    end if
end program main

Measured memory_bytes: 256
// Problem : B - Multiple of 9
// Contest : AtCoder - AtCoder Beginner Contest 176
// URL : https://atcoder.jp/contests/abc176/tasks/abc176_b
// Memory Limit : 1024 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

// Delete the dynamically allocated memory

#include<bits/stdc++.h>
using namespace std;
 
#define ff              first
#define ss              second
#define pb              push_back
#define pr              pair<long long,long long>
#define mp(a,b)         make_pair(a,b)
#define vr              vector<long long>
#define mod1            1000000007
#define mod2            998244353
#define inf             1e18
#define ps(x,y)         fixed<<setprecision(y)<<x
#define fill(a,b)       memset(a, b, sizeof(a))
#define mk(arr,n,type)  type *arr=new type[n];
#define ll              long long
#define ld	            long double
#define w(x)            int x; cin>>x; while(x--)
ll power(ll base, ll exp) {
    ll res=1;
    while(exp>0) {
       if(exp%2==1) res=(res*base);
       base=(base*base);
       exp/=2;
    }
    return res;
}
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	string n;
	cin>>n;
	ll sum=0;
	for(ll i=0;i<n.length();i++){
		sum+=n[i]-'0';
	}
	if(sum%9==0){
		cout<<"Yes"<<"\n";
	}else{
		cout<<"No"<<"\n";
	}
	return 0;
	}

Measured memory_bytes: 3760
#include <vector>
#include <math.h>
#include <iostream>
#include <string>
#include <algorithm>
#include <queue>
#include <iomanip>
#include <deque>
#include <map>

typedef long long ll;
#define rep(i, a, n) for(int i = a; i<n; i++)
#define ALL(a) begin(a), end(a)
#define mii map<int, int>
#define msi map<string, int>
#define vi vector<int>
#define vl vector<ll>
#define MOD 1000000007
#define INF 1e9
#define showVector(v) rep(i,0,v.size()){p(v[i]);p(" ")} pl("")
# define p(s) std::cout << s ;
# define pl(s)  std::cout << s << endl;
using namespace std;

// 素数判定 O(√n)
bool is_prime(int n){
    for(int i = 2; i * i <= n; i++){
        if(n % i == 0) return false;
    }
    return true;
}
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;
}
int main() {
    int N;
    cin >> N;
    vl a(N);
    rep(i, 0, N) {
        cin >> a[i];
    }

    ll ans=0;
    rep(i, 1, N-1) {
vl b;
           b.push_back(a[i-1]);
                b.push_back(a[i]);
        b.push_back(a[i+1]);

    sort(b.begin(), b.end());
if (a[i] == b[1]) ++ans;
            }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
Public Class Program
  Shared Sub Main()
    Dim n As Integer = Cin.Int()
    Dim s(0 To n - 1) As Long
    Dim t(0 To n - 1) As Long
    For i As Integer = 0 To n - 1
      Dim xl As Long() = Cin.LngArr()
      s(i) = xl(0) - xl(1)
      t(i) = xl(0) + xl(1)
    Next
    Array.Sort(t, s)
    Dim ans As Integer = 0
    Dim cur As Long = -1000000000
    For i As Integer = 0 To n - 1
      If cur <= s(i) Then
        ans += 1
        cur = t(i)
      End If
    Next
    Console.WriteLine(ans.ToString())
  End Sub
End Class

Public Class Cin
  Public Shared Function Str() As String
    Return Console.ReadLine().Trim()
  End Function
  Public Shared Function Int() As Integer
    Return Integer.Parse(Str())
  End Function
  Public Shared Function Lng() As Long
    Return Long.Parse(Str())
  End Function
  Public Shared Function Dbl() As Double
    Return Double.Parse(Str())
  End Function
  Public Shared Function StrArr(Optional separator As String = " ") As String()
    Return Str().Split(separator)
  End Function
  Public Shared Function IntArr(Optional separator As String = " ") As Integer()
    Return Array.ConvertAll(Of String, Integer)(StrArr(separator), AddressOf Integer.Parse)
  End Function
  Public Shared Function LngArr(Optional separator As String = " ") As Long()
    Return Array.ConvertAll(Of String, Long)(StrArr(separator), AddressOf Long.Parse)
  End Function
  Public Shared Function DblArr(Optional separator As String = " ") As Double()
    Return Array.ConvertAll(Of String, Double)(StrArr(separator), AddressOf Double.Parse)
  End Function
End Class

Measured memory_bytes: 18684
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define F first
#define S second
#define all(f) (f).begin(),(f).end()
#define allr(f) (f).rbegin(),(f).rend()
const int mod = 1e9+7, A = 1e5+5;

int main()
{
	ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
	int n, m;
	cin >> n >> m;
	for (int i = 0, x; i < m; i++)
		cin >> x, n-= x;
	cout << (n < 1? "Yes":"No");
	return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <unordered_map>
#include <vector>
#include <string.h>
#include <set>

using namespace std;

#define COUT(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl

template<class T> void printvec(const vector<T>& v) {
  for (auto x : v) { cout << x << " "; }
  cout << endl;
}
template<class T> void printtree(const vector< vector<T> >& tree) {
  for (long long i = 0; i < tree.size(); ++i) {
    cout << i + 1 << ": "; printvec(tree[i]);
  }
}
template<class T, class U> void printmap(const map<T, U>& mp) {
  for (auto x : mp) { cout << x.first << "=>" << x.second << endl; }
}

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

#define rep(i, n) for(ll i = 0; i < n; ++i)
#define all(s) s.begin(), s.end()
#define fr first
#define sc second
#define mp make_pair
#define pb push_back

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;
typedef tuple<ll, ll, ll> triple;
typedef double D;

const ll INF = 1e9;
const ll MOD = 1000000007;  // 1e9 + 7

int dr[4] = { 1, -1, 0, 0 };
int dc[4] = { 0, 0, 1, -1 };

int main(int argc, char** argv) {
  cin.tie(NULL);
  cout.tie(NULL);
  ios_base::sync_with_stdio(false);
  //cout << setprecision(10) << fixed;

  ll h, w, k;
  cin >> h >> w >> k;
  vector<string> mat(h);
  rep(r, h) {
    cin >> mat[r];
  }
  pair<ll, ll> s;
  rep(r, h) {
    rep(c, w) {
      if (mat[r][c] == 'S') {
        s.first = r;
        s.second = c;
      }
    }
  }

  // Here, we check all places from start by BFS
  ll ans = INF;
  queue<pair<P, ll>> q; // pair of <position, cnt>
  vector<vector<bool>> visited(h, vector<bool>(w));

  q.push(pair<P, ll>(s, 0));
  while (!q.empty()) {
    auto p = q.front(); q.pop();
    pair<ll, ll> pos = p.first;
    ll cnt = p.second;
    if (cnt > k) { continue; } // cnt is too large
    // Here, cnt <= k. It is valid.
    ll dist = INF;
    ll r = pos.first;  // row
    ll c = pos.second; // col
    if (r == 0 || r == h-1 || c == 0 || c == w-1) { // reached to edge
      cout << 1 << endl;
      return 0;
    }
    // Here, 0 < r < h-1, 0 < c < w-1

    chmin(ans, 1+(r      +(k-1))/k); // top    .. round up of (r) / k
    chmin(ans, 1+((h-1-r)+(k-1))/k); // bottom .. round up of (h-1-r) / k
    chmin(ans, 1+(c      +(k-1))/k); // left   .. round up of (c) / k
    chmin(ans, 1+((w-1-c)+(k-1))/k); // right  .. round up of (w-1-c) / k
    rep(i, 4) {
      int nextR = r + dr[i];
      int nextC = c + dc[i];
      // Here, we don't need to check the range of (nextR, nextC)
      if (mat[nextR][nextC] == '#') { continue; } // skip wall
      if (visited[nextR][nextC]) { continue; }
      visited[nextR][nextC] = true;

      // Here, nextR, nextC is valid and not visited.
      pair<ll, ll> nextPos(nextR, nextC);
      q.push(pair<P, ll>(nextPos, cnt + 1));
    }
  }

  cout << ans << endl;
}


Measured memory_bytes: 1024
import collections
S=input()
T=input()
tableS=collections.defaultdict(list)
tableT=collections.defaultdict(list)

for i in range(len(S)):
  tableS[S[i]].append(i)
  tableT[T[i]].append(i)
listS=tableS.values()
listT=tableT.values()

for x in listS:
  flag=False
  for y in listT:
    if x in y or x in listT:
      flag=True
      break
  if not flag:
    print("No")
    exit(0)
print("Yes")
      


Measured memory_bytes: 14640
#pragma GCC optimize(3,"Ofast","inline")
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
bool Finish_read;
template<class T>inline void read(T &x){Finish_read=0;x=0;int f=1;char ch=getchar();while(!isdigit(ch)){if(ch=='-')f=-1;if(ch==EOF)return;ch=getchar();}while(isdigit(ch))x=x*10+ch-'0',ch=getchar();x*=f;Finish_read=1;}
template<class T>inline void print(T x){if(x/10!=0)print(x/10);putchar(x%10+'0');}
template<class T>inline void writeln(T x){if(x<0)putchar('-');x=abs(x);print(x);putchar('\n');}
template<class T>inline void write(T x){if(x<0)putchar('-');x=abs(x);print(x);}
/*================Header Template==============*/
char s[100005];
int n,k,c0,c1,ans;
int main() {
	scanf("%s",s+1),n=strlen(s+1);
	for(int i=1;i<=n;++i) {
		if(s[i]=='0') {
			if(c1)
				--c1,++ans;
			else
				++c0;
		}
		else {
			if(c0)
				--c0,++ans;
			else
				++c1;
		}
	}
	cout<<ans*2<<endl;
}

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

using VS = vector<string>;    using LL = long long;
using VI = vector<int>;       using VVI = vector<VI>;
using PII = pair<int, int>;   using PLL = pair<LL, LL>;
using VL = vector<LL>;        using VVL = vector<VL>;

#define ALL(a)  begin((a)),end((a))
#define RALL(a) (a).rbegin(), (a).rend()
#define SZ(a) int((a).size())
#define SORT(c) sort(ALL((c)))
#define RSORT(c) sort(RALL((c)))
#define UNIQ(c) (c).erase(unique(ALL((c))), end((c)))
#define FOR(i, s, e) for (int(i) = (s); (i) < (e); (i)++)
#define FORR(i, s, e) for (int(i) = (s); (i) > (e); (i)--)
//#pragma GCC optimize ("-O3") 
#ifdef YANG33
#include "mydebug.hpp"
#else
#define DD(x) 
#endif
const int INF = 1e9;                          const LL LINF = 1e16;
const LL MOD = 1000000007;                    const double PI = acos(-1.0);
int DX[8] = { 0, 0, 1, -1, 1, 1, -1, -1 };    int DY[8] = { 1, -1, 0, 0, 1, -1, 1, -1 };

/* -----  2019/02/28  Problem: ABC 107 A / Link: http://abc107.contest.atcoder.jp/tasks/abc107_a  ----- */
/* ------問題------



-----問題ここまで----- */
/* -----解説等-----



----解説ここまで---- */

LL ans = 0LL;

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

	LL N, I; cin >> N >> I;
	ans = N - I + 1;
	
	cout << ans << "\n";

	return 0;
}


Measured memory_bytes: 256
import math
import itertools
N, M = map(int,input().split())
s = 0

min = 0
max = 0
for j in range(M):
  min += j
  max += N-j
s = max - min + 1

for i in range(M+1, N+2):
  min += i
  max += N+2-i
  s += max - min + 1
  
print(s%(1000000000+7))

Measured memory_bytes: 9200
#include<bits/stdc++.h>
#define ll      long long
#define pb	    push_back
#define F	    first
#define S	    second
#define B	    begin()
#define E	    end()
#define pii     pair < ll , ll >
#define FASTIO  ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);

using namespace std ;
int jamil ;
int main()
{
    FASTIO
    string jamil ;
    cin >> jamil ;
    bool ans = 0 ;
    for ( int i = 0 ; i < jamil.size() - 2 ; i++ )
    {
        if ( jamil[i] == jamil[i+1] && jamil[i+2] == jamil[i+1] )
            ans = 1 ;
    }
    cout << ( ans ? "Yes" : "No" ) ;
	return 0 ;
}


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

int main(){
    int ninzuu[4][3][10];
    for(int i=0;i<4;i++){
        for(int j=0;j<3;j++){
            for(int k=0;k<10;k++){
                ninzuu[i][j][k]=0;
            }
        }
    }
    int n;
    cin>>n;
    for(int i=0;i<n;i++){
        int b,f,r,v;
        cin>>b>>f>>r>>v;
        ninzuu[b-1][f-1][r-1]+=v;
    }
    for(int i=0;i<4;i++){
        for(int j=0;j<3;j++){
            for(int k=0;k<10;k++){
                cout<<" "<<ninzuu[i][j][k];
            }
            cout<<endl;
        }
        if(i!=3)cout<<"####################"<<endl;
    }
    return 0;
}


Measured memory_bytes: 3084
#include<stdio.h>
#include<stdlib.h>
#define MAX 500001

typedef struct Node {
    long key;
    struct Node *p, *l, *r;
} Node;

Node *root, *NIL;


void insert(long k) {
    Node *y = NIL;
    Node *x = root;
    Node *z;
    
    z = (Node *)malloc(sizeof(Node));
    z->key = k;
    z->l = z->r = NIL;
    
    while (x != NIL) {
	y = x;
	if (z->key < x->key) x = x->l;
	else x = x->r;
    }
    z->p = y;
    
    if (y == NIL) root = z;
    else if (z->key < y->key) y->l = z;
    else y->r = z;
}

Node* find(Node *x, long k) {
    while (x != NIL && k != x->key) {
	if (k < x->key) x = x->l;
	else x = x->r;
    }
    return x;
}

void inorder(Node *u) {
    if (u == NIL) return;
    inorder(u->l);
    printf(" %d", u->key);
    inorder(u->r);
}

void preorder(Node *u) {
    if (u == NIL) return;
    printf(" %d", u->key);
    preorder(u->l);
    preorder(u->r);
}

void print() {
    inorder(root);
    printf("\n");
    preorder(root);
    printf("\n");
}

int main() {
    long n, i, x;
    char st[20];
    scanf("%ld", &n);
    for (i = 0; i < n; i++) {
 	scanf("%s", st);
	scanf("%ld", &x);
	if (st[0] == 'f') {
	    if (find(root, x) != NIL) printf("yes\n");
	    else printf("no\n");
	}
	else if (st[0] == 'i') insert(x);
	else if (st[0] == 'p') print();
    }
    return 0;
}

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

int tr(char x){
  return int(x-'0');
}

int main(){
  string S;cin >> S;
  int N = S.size();
  vector<ll> A(N);
  for(int i=0;i<N;i++){
    A[i] = tr(S[i]);
  }
  ll sum = 0;
  for(int bit=0;bit<(1<<(N-1));bit ++){
    ll cursum = 0;
    for(int i=0;i<N;i++){
      cursum = cursum * 10 + A[i];
      if(i==N-1){
        sum += cursum;
        cursum = 0;
      }else if(bit&(1<<i)){
        sum += cursum;
        cursum = 0;
      }
    }
  }
  cout << sum << endl;
}

Measured memory_bytes: 3624
package main

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

var sc = bufio.NewScanner(os.Stdin)

func rectangle(height int, width int) {
	for i := 0; i < height; i++ {
		fmt.Println(strings.Repeat("#", width))
	}
}

func main() {
	for sc.Scan() {
		inputs := strings.Split(sc.Text(), " ")
		if inputs[0] == "0" && inputs[1] == "0" {
			break
		}
		h, _ := strconv.Atoi(inputs[0])
		w, _ := strconv.Atoi(inputs[1])
		rectangle(h, w)
		fmt.Println("")
	}

}



Measured memory_bytes: 1228
#include<bits/stdc++.h>
#define N 100005
using namespace std;
int n,m,a[1005];
char c[15];
int main(){
	scanf("%s",c+1);
	
	for(int i=1;i<=4;i++){
		a[c[i]]++;
	}
	for(int i=1;i<=4;i++){
		if(a[c[i]]!=2){
			printf("No\n");
			return 0;
		}
	}
	puts("Yes");
	return 0;
}

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

int main(){
  int64_t n,p;
  cin >> n >> p;
  map<int64_t,int>a;
  if(n==1){cout << p << endl;return 0;}
  for(int64_t i=2;pow(i,n)<=p;i++){
    while(p%i==0){
      a[i]++;
      p/=i;
    }
  }
  int64_t ans=1;
  for(auto x:a)
    ans*=pow(x.first,x.second/n);
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 4000
#include <iostream>
#include <cstdio>

using namespace std;

int a, b, c;

int main()
{
    scanf("%d%d%d", &a, &b, &c);
    if(a == b + c || b == a + c || c == a + b)
    {
        printf("Yes");
    }
    else
    {
        printf("No");
    }
    return 0;
}


Measured memory_bytes: 384
import java.math.BigDecimal;
import java.util.Scanner;
 
public class Main {
 
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		long N = sc.nextLong();
		BigDecimal ans = new BigDecimal(1);
		BigDecimal over = new BigDecimal(1000000000000000000L);
		boolean ov = false;
		boolean ze = false;
		for (int i = 0; i < N; i++) {
			long Ai = sc.nextLong();
			if (!ze) {
				if (Ai == 0) {
					ze = true;
				}
				if (!ov) {
					BigDecimal bd = new BigDecimal(Ai);
					ans = ans.multiply(bd);
					int ju = ans.compareTo(over);
					if (ju == 1) {
						ov = true;
					}
				}
			}
		}
		if (ze) {
			System.out.println(0);
		} else if (ov) {
			System.out.println(-1);
		} else {
			System.out.println(ans);
		}
	}
}

Measured memory_bytes: 60100
#include<bits/stdc++.h>
using namespace std;
#define ll long long
const int inf=1000000000;

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

int main(){
	ios::sync_with_stdio(0);
	cin.tie(0);
    
    string s,t;
    int n,m,i,j;
    cin>>s>>t;
    n=s.length();
    m=t.length();
    int dp[n+1][m+1];
    for(i=0;i<=n;i++)
    {
        for(j=0;j<=m;j++)
        {
            if(i==0||j==0)
                dp[i][j]=0;
            else if(s[i-1]==t[j-1])
                dp[i][j]=1+dp[i-1][j-1];
            else
                dp[i][j]=max(dp[i-1][j],dp[i][j-1]);
        }
    }
    int l=dp[n][m];
    char ans[l];
    i=n,j=m;
    while(i>0 && j>0)
    {
        if(s[i-1]==t[j-1])
        {
            ans[l-1]=s[i-1];
            i-=1;
            j-=1;
            l-=1;
        }
        else
        {
            if(dp[i-1][j]>dp[i][j-1])
                i-=1;
            else
                j-=1;
        }
    }
    for(i=0;i<dp[n][m];i++)
        cout<<ans[i];
 
    return 0;
}


Measured memory_bytes: 35456
#include<bits/stdc++.h>
using namespace std;
int n,m,mi,c,me,cn,cnme;
vector<int> a,b;
vector<bool> t;
void che(int i){
  int me=0,cnme=0;
  t[i]=false;
  if((i+1)*a[i]*100+c<m){
    c+=(i+1)*a[i]*100;
    me+=(i+1)*a[i]*100;
    cn+=a[i];
    cnme+=a[i];
  }else{
    for(int j=0;j<a[i];j++){
      c+=(i+1)*100;
      me+=(i+1)*100;
      cn++;
      cnme++;
      if(c>=m){
        mi=min(mi,cn);
        goto v;
      }
    }
  }
  c+=b[i];
  me+=b[i];
  if(c>=m){
    mi=min(mi,cn);
    goto v;
  }
  for(int j=0;j<n;j++){
    if(t[j]){
      che(j);
    }
  }
  v:
  c-=me;
  cn-=cnme;
  t[i]=true;
}
int main(){
  cin>>n>>m;
  a.resize(n);
  b.resize(n);
  t.resize(n);
  for(int i=0;i<n;i++){
    cin>>a[i]>>b[i];
    t[i]=true;
  }
  c=0;
  cn=0;
  mi=100000;
  for(int i=0;i<n;i++){
    che(i);
  }
  cout<<mi;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include<numeric>
#include<cmath>
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define INF 2e9
#define ALL(v) v.begin(), v.end()
using namespace std;
using ll = long long;
using P = pair<int,int>;
using pll = pair<ll,ll>;
using vvii = vector<vector<int> >;
using vvll =  vector<vector<ll> >;
const ll mod = 1e9 + 7;

const ll inf = 1LL << 60;

struct mint{
    ll x;
    mint(ll x = 0): x((x % mod + mod)%mod){}

    
    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 n)const{
        if(n == 0)return 1;
        mint a = pow(n>>1);
        a *= a;
        if(n & 1)a *= (*this);
        return a;
    }

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

ostream& operator<<(ostream &os, const mint &m){
    os << m.x;
    return os;
}

struct Combination{
    vector<mint> fact,ifact;
    Combination(int n): fact(n+1),ifact(n+1){
        fact[0] = 1;
        for(int i = 1; i<=n; i++)fact[i] = fact[i-1]*i;
        ifact[n] = fact[n].inv();
        for(int i = n; i>= 1; i--){
            ifact[i-1] = ifact[i] * i;
        }
    }

    mint comb(int n, int k){
        if(k < 0 || n < k)return 0;
        return fact[n]*ifact[k]*ifact[n-k];
    }
};

int main(){
    cin.tie(nullptr);
	ios_base::sync_with_stdio(false);
	//cout << fixed << setprecision(15);
    ll n;
    int a,b; cin >>n>>a>>b;
    mint ans;
    mint two = 2;
    mint nca = 1, ncb = 1;
    for(int i = 1; i <= a; i++){
        nca *= (n-i+1);
        nca /= i;
    }
    for(int i = 1; i <= b; i++){
        ncb *= (n-i+1);
        ncb /= i;
    }
    ans = two.pow(n) - 1 - nca - ncb;

    cout << ans << endl;

}

Measured memory_bytes: 3636
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <string>
#include <stack>
#include <queue>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <cmath>

using namespace std;
#define PI 3.1415926535897932384626433832795
#define MOD (1000000007)
#define EPS (1e-15)
#define rep(i, n) for (int i = 0; i < (n); i++)
#define repc(i, s, n) for (int i = (s); i <= (n); i++)
#define rrep(i, n) for (int i = (n) - 1; i >= 0; i--)
#define rrepc(i, s, n) for (int i = (s); i >= (n); i--)
#define bet(x, a, b) (a) <= (x) && (x) < (b)
typedef long long ll;
typedef unsigned long long ull;

int ans[2000];

int main()
{
	int N, X, Y;

	cin >> N >> X >> Y;

	repc(i, 1, N - 1) {
		repc(j, i + 1, N) {
			int d1, d2, d3;

			d1 = j - i;
			d2 = abs(i - X) + 1 + abs(j - Y);
			d3 = abs(i - Y) + 1 + abs(j - X);

			ans[min(d1, min(d2, d3))]++;
		}
	}

	repc(i, 1, N - 1) cout << ans[i] << endl;

	return 0;
}


Measured memory_bytes: 256
M = 10**9 + 7
a = [1] + [0] * 12
p = 1
for c in reversed(input()):
    r = range(0, p * 10, p) if c == '?' else (p * int(c),)
    a = [sum(a[(i - j) % 13] for j in r) % M for i in range(13)]
    p = p * 10 % 13
print(a[5])

Measured memory_bytes: 46316
#include<bits/stdc++.h>
using namespace std;
int main(){
    long long int n,m,c,d,top=1;
    cin>>n>>m;
    for(long long int i=0;i<m;i++){
        cin>>c>>d;
        if(top>n)top=top%n;
        if(c==0){
            if((top+d-1)%n!=0){
                cout<<(top+d-1)%n<<endl;
            }else{
                cout<<n<<endl;
            }
        }else if(c==1){
            top+=d;
        }
    }
    return 0;
}


Measured memory_bytes: 3096
#include <stdio.h>
int main(void){
    // Your code here!
	int x,y,z;
	scanf("%d", &x);
    scanf("%d", &y);
    scanf("%d", &z);
    
	if(x<y && y<z)
	    printf("Yes\n");
	else
	    printf("No\n");
	return 0;
}


Measured memory_bytes: 2104
/**
 *    author:  tourist
 *    created: 16.01.2020 23:14:00       
**/
#include <bits/stdc++.h>

using namespace std;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int a, b;
  cin >> a >> b;
  cout << (a % 3 == 0 || b % 3 == 0 || (a + b) % 3 == 0 ? "Possible" : "Impossible") << '\n';
  return 0;
}


Measured memory_bytes: 256
x = gets.to_f
a, b = 0, 0
u, v = 0, 1
c, d = Math.cos(Math::PI*x/180), Math.sin(Math::PI*x/180)
k = 0
loop do
  k += 1
  a += u
  b += v
  u, v = c*u-d*v, d*u+c*v
  
  if a.abs < 1e-8 and b.abs < 1e-8
    puts k
    exit
  end
end

Measured memory_bytes: 14676
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cmath>
#include <stack>
#include <queue>
#include <set>
#include <map>
using namespace std;
typedef long long ll;
typedef vector<int> VI;
typedef vector< vector<int> > VII;
typedef pair<int,int> P;
#define rep(i,n) for(int i=0;i<(n);i++)
#define all(a) (a).begin(),(a).end()

int main(){
  int N,M;
  cin>>N;
  VI A(N);
  rep(i,N) cin>>A[i];
  ll ans=0;
  rep(i,N) ans+=(A[i]-1);
  cout<<ans<<endl;
}



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

int main()
{
	string a,b;
  	cin>>a>>b;
  	int m=a.length();
  	int n=b.length();
  
  int dp[m+1][n+1];
  
  for(int i=0;i<=m;i++)
    for(int j=0;j<=n;j++){
      if(i==0||j==0)
        dp[i][j]=0;
      else if(a[i-1]==b[j-1])
        dp[i][j]=1+dp[i-1][j-1];
      else dp[i][j]=max(dp[i-1][j],dp[i][j-1]);
    }
  int i=a.length(),j=b.length();
    string ans="";
    while(i>0&&j>0){
        if(dp[i][j]!=dp[i-1][j]&&dp[i][j]!=dp[i][j-1]){
            ans+=a[i-1];
            i--;j--;
        }
        else if(dp[i][j]==dp[i][j-1]) j--;
        else i--;
    }
    reverse(ans.begin(),ans.end());
  cout<<ans<<endl;
  return 0;
}

Measured memory_bytes: 35456
#define _CRT_SECURE_NO_WARNINGS

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

using namespace std;
typedef long long ll;
#define rep(i, n) for (ll i = 0; i < (n); ++i)

int main() {

	int N;

	scanf("%d", &N);

	rep(i, 4 + 1) {
		if ((N - 7 * i) >= 0 && !((N - 7 * i) % 4)) {
			printf("Yes\n");
			return 0;
		}
	}

	printf("No\n");

	return 0;
}

Measured memory_bytes: 256