akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
typedef pair<int,int> P;
typedef long long ll;
typedef long double ld;
const int inf=1e9+7;
const ll longinf=1LL<<60;

const int mx=200010;
const ll mod=1e9+7;

int n, ans=0;
string a,b,c;

int main(){
  cin >> n >> a >> b >> c;
  for(int i=0; i<n; i++){
    if(a[i]==b[i] && b[i]==c[i]){continue;}
    if(a[i]==b[i] || b[i]==c[i] || a[i]==c[i]){ans++; continue;}
    ans += 2;  
  }

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

Measured memory_bytes: 256
H, W = map(int, input().split(' '))
count = [['0']*W for i in range(H)]

def update_count(i, j, count):
    count[i][j] = '#'
    start_i = 0 if i-1 < 0 else i-1
    end_i = H if i + 2 > H else i+2
    start_j = 0 if j-1 < 0 else j-1
    end_j = W if j + 2 > W else j+2
    for k in range(start_i, end_i):
        for l in range(start_j, end_j):
            if count[k][l] != '#':
                count[k][l] = str(1 + int(count[k][l]))
    return count

for i in range(H):
    S = input()
    for j in range(W):
        if S[j] == '#':
            count = update_count(i, j, count)

for i in range(H):
    print(''.join(count[i]))


Measured memory_bytes: 9196
#include<bits/stdc++.h>
#define ll               long long
#define mod              1000000007
#define endl              "\n"
#define fast               ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define pb                push_back
#define all(v)             v.begin(),v.end()
#define inp(V,n)      for(int i=0;i<n;i++){cin >> V[i];}
#define oup(V,n)     {for(int i=0;i<n;i++){cout <<  V[i] << " "  ;} cout << endl;}
using namespace std;
ll factorial(ll n)
{
    return (n == 1 || n == 0) ? 1 : n * factorial(n - 1);
}
ll gcd(ll a, ll b)
{
    if (a == 0)
      return b;
    return gcd(b % a, a);
}
ll lcm(ll a, ll b)
{
   return (a*b)/gcd(a, b);
}
bool sortByVal(const pair<ll,ll> &a,
               const pair<ll,ll> &b)
{
    return (a.second > b.second);
}
ll Powb(ll b,ll n)
{
    if(n==0) return 1LL;
    if(n==1) return b;
    ll temp = Powb(b,n/2);
    if(n%2==0){return (temp*temp)%mod;}
    else{return (b*((temp*temp)%mod))%mod;}
}
int main()
{
     fast;
     ll m,x,y,k,z,i,j,e=0,f=0,g=0,h=0,n,sum=0;
     ll c=0,d=0;
     cin>>n>>k;
     if(n%k==0)
     {
         cout<<0;
     }
     else
     {
         c=n;
    n%=k;
    d=abs(n-k);
    cout<<min(c,d);
     }



}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
void rd(int &x){
  int k, m=0;
  x=0;
  for(;;){
    k = getchar_unlocked();
    if(k=='-'){
      m=1;
      break;
    }
    if('0'<=k&&k<='9'){
      x=k-'0';
      break;
    }
  }
  for(;;){
    k = getchar_unlocked();
    if(k<'0'||k>'9'){
      break;
    }
    x=x*10+k-'0';
  }
  if(m){
    x=-x;
  }
}
void wt_L(int x){
  char f[10];
  int m=0, s=0;
  if(x<0){
    m=1;
     x=-x;
  }
  while(x){
    f[s++]=x%10;
     x/=10;
  }
  if(!s){
    f[s++]=0;
  }
  if(m){
    putchar_unlocked('-');
  }
  while(s--){
    putchar_unlocked(f[s]+'0');
  }
}
int main(){
  int A, B;
  rd(A);
  rd(B);
  wt_L((A+B)%24);
  putchar_unlocked('\n');
  return 0;
}
// cLay varsion 20170326-3 [beta]


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

#define rep(i, a, b) for (ll i = (a); i < (b); i++)
typedef uint64_t ull;
typedef int64_t ll;
typedef std::pair<ll, ll> PLL;

using namespace std;

signed main() {
  ll a,b,c;
  cin>>a>>b>>c;
  cout<<max((ll)0, c-(a-b))<<endl;
  return 0;
}


Measured memory_bytes: 256
# diverta 2019 Programming Contest: B – RGB Boxes
R, G, B, N = [int(i) for i in input().split()]

bingo = 0

for r in range(N + 1):
    if R * r > N:
        break
    for g in range(N + 1):
        b = (N - (R * r + G * g)) // B
        if b < 0:
            break
        elif R * r + G * g + B * b == N:
            bingo += 1

print(bingo)

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

template <typename T>
T gcd(T x, T y)
{
    if (y == 0)
        return x;
    return gcd(y, x % y);
}

template <typename T>
T lcm(T x, T y)
{
    if (x == 0 || y == 0)
        return 0;
    return x / gcd(x, y) * y;
}

int main()
{
    int cnt = 0;
    string N;
    cin >> N;
    if (N[0] == N[1] && N[1] == N[2])
        cout << "Yes" << endl;
    else if (N[1] == N[2] && N[2] == N[3])
        cout << "Yes" << endl;
    else
        cout << "No" << endl;
}

Measured memory_bytes: 256
import java.util.ArrayList;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);
		ArrayList<Integer> i = new ArrayList<Integer>();

		int n = sc.nextInt();

		for (int x = 0; x < n; x++) {

			i.add(sc.nextInt());

		}
		for (int y = i.size() - 1; y >= 0; y--) {

			if (y != i.size() - 1) {
				System.out.print(" ");
			}

			System.out.print(i.get(y));

		}
		System.out.println();
		sc.close();
	}

}

Measured memory_bytes: 26396
N, L = map(int, input().split())
S = []
for i in range(N):
    S.append(L+i)
if 0 in S:
    print(sum(S))
else:
    if S[0]>0:
        print(sum(S)-S[0])
    else:
        print(sum(S)-S[-1])

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
int main(){
	int N, M; cin >> N >> M; 
	bool broken[100010] = {}; 
	for(int i = 1; i <= M; i++){
		int a; cin >> a; 
		broken[a] = true; 
	}
	int A[100010] = {}; 
	A[0] = 1; 
	if(!broken[1]) A[1] = 1; 
	for(int i = 2; i <= N; i++){
		if(broken[i]) continue; 
		if(!broken[i-1]) A[i] += A[i-1]; 
		if(!broken[i-2]) A[i] += A[i-2]; 
		A[i] %= 1000000007; 
	}
	cout << A[N] << endl;
}

Measured memory_bytes: 768
#include<stdio.h>

#define Max 100000

struct Node { int p, l, r; };
struct Node T[Max];

void Preorder(int x){
	if (x == -1) {
		return;
	}
	printf(" %d", x);
	Preorder(T[x].l);
	Preorder(T[x].r);
}

void Inorder(int x) {
	if (x == -1) {
		return;
	}
	Inorder(T[x].l);
	printf(" %d", x);
	Inorder(T[x].r);
}

void Postorder(int x) {
	if (x == -1) {
		return;
	}
	Postorder(T[x].l);
	Postorder(T[x].r);
	printf(" %d", x);
}

int main(void) {
	
	int n, i, c, l, r, root;

	scanf("%d", &n);
	for (i = 0; i < n; i++) {
		T[i].p = -1;
	}

	for (i = 0; i < n; i++) {
		scanf(" %d %d %d", &c, &l, &r);
		T[c].l = l;
		T[c].r = r;
		if (l != -1) {
			T[l].p = c;
		}
		if (r != -1) {
			T[r].p = c;
		}
	}

	for (i = 0; i < n; i++) {
		if (T[i].p == -1) {
			root = i;
		}
	}
	printf("Preorder\n");
	Preorder(root);
	putchar('\n');
	printf("Inorder\n");
	Inorder(root);
	putchar('\n');
	printf("Postorder\n");
	Postorder(root);
	putchar('\n');

	return 0;
}


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

int main(){
    int n;
    cin >> n;
    vector<int> d(n);
    for(int i=0; i<n; i++){
        cin >> d[i];
    }
    int sum = 0;
    for(int i=0; i<n; i++){
        for(int j=i+1; j<n; j++){
            sum += d[i]*d[j];
        }
    }
    cout << sum;
}

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

using namespace std;

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

  int n;
  cin >> n;
  int a_old;
  cin >> a_old;
  int64_t ans = 0;
  for (int i = 1; i < n; ++i) {
    int a;
    cin >> a;
    if (a < a_old) {
      ans += (a_old - a);
    } else {
      a_old = a;
    }
  }

  cout << ans << '\n';

  return 0;
}


Measured memory_bytes: 3624
#include<iostream>
#include<stdio.h>

using namespace std;

int main() {
	int N,X,A,min;
	int S = 0;
	int a[99];
	int i = 0;
	int j = 0;
	int k = 0;

	cin >> N >> X;

	while (i < N) {
		cin >> a[i];
		i++;
	}

	while (j < N) {
		S = S + a[j];
		j++;
	}

	min = a[0];

	while (k < N) {
		if (min > a[k]) {
			min = a[k];
		}
		k++;
	}

	A = X - S;

	cout << N + A / min << endl;


	return 0;
}

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

#define pu push
#define pb push_back
#define mp make_pair
#define eps 1e-7
#define INF 1000000000
#define mod 1000000007
#define fi first
#define sc second
#define rep(i,x) for(long long i=0;i<x;i++)
#define repn(i,x) for(long long i=1;i<=x;i++)
#define SORT(x) sort(x.begin(),x.end())
#define ERASE(x) x.erase(unique(x.begin(),x.end()),x.end())
#define POSL(x,v) (lower_bound(x.begin(),x.end(),v)-x.begin())
#define POSU(x,v) (upper_bound(x.begin(),x.end(),v)-x.begin())

// vector<vector<int>> data(3, vector<int>(4));

ll perm2[8];
vector<long long> P(8-1+1);
vector<long long> Q(8-1+1);
ll a = -1, b = -1;
void permutation2(int n) {
	for (int i = 0; i < n; i++) {
		perm2[i] = i;
	}
	ll idx = 1;
	do {
		bool flga = true, flgb = true;
		rep(i, n) {
			if (perm2[i] != P[i]) flga = false;
		}
		rep(i, n) {
			if (perm2[i] != Q[i]) flgb = false;
		}
		if (flga) a = idx;
		if (flgb) b = idx;
		idx++;
	} while (next_permutation(perm2, perm2 + n));
	return ;
}

int main(){	
	long long N;
	scanf("%lld",&N);
	for(int i = 0 ; i <= N-1 ; i++){
		scanf("%lld",&P[i]);
		P[i]--;
	}
	for(int i = 0 ; i <= N-1 ; i++){
		scanf("%lld",&Q[i]);
		Q[i]--;
	}
	permutation2(N);
	cout << abs(a-b) << endl;
	return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
const int INF = 0x3f3f3f3f;
#define ll long long
#define pr(x) cerr << #x << ' ' << x << ' '
#define prln(x) cerr << #x << ' ' << x << endl
const int maxn = 105;
int x[maxn], y[maxn];

int main() {
    #ifdef LOCAL
        freopen("in.txt", "r", stdin);
    #endif // LOCAL
    int N, M, X, Y;
    cin >> N >> M >> X >> Y;
    for (int i = 0; i < N; ++i) {
        cin >> x[i];
    }
    for (int i = 0; i < M; ++i) {
        cin >> y[i];
    }
    sort(x, x + N);
    sort(y, y + M);
    int max_x = x[N - 1];
    int min_y = y[0];
    for (int i = max_x + 1; i <= min_y; ++i) {
        if (i > X && i <= Y) {
            puts("No War");
            return 0;
        }
    }
    puts("War");
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
ll a[100][2]={0},b[100005]={0};
ll mlen=0;
void  f(ll x)
{
	ll j=0;
	ll c=mlen;
	 while(c--)
	 {
	 	 a[j][x%2]++;
	 //	 printf("%d ",x%2);
	 	 x/=2;
	 	 j++;
	 }
//	 printf("\n");
	// mlen=max(j,mlen);
}
ll m(ll x)
{
	ll j=0;
	
	 while(x)
	 {
	 	// a[j][x%2]++;
	 //	 printf("%d ",x%2);
	 	 x/=2;
	 	 j++;
	 }	
	 return j;
}
int main()
{
ll n,k;
cin>>n>>k;
mlen=m(k);
for(ll i=0;i<n;i++)
{
	
cin>>b[i];	
f(b[i]);
}
ll ans=0;
ll nn=0;
//cout<<mlen<<endl;

//for(ll i=0;i<mlen;i++)
//{
//	if(a[i][0]>a[i][1]&&nn+(1<<i)<=k)
//	{
//		nn+=(1<<i);
//	}
////printf("%d %d\n",a[i][0],a[i][1]);
//}

ll nnn=0;
for(ll i=mlen-1;i>=0;i--)
{
//	printf("=%lld %lld\n",a[i][0],a[i][1]);
	 if(a[i][0]>a[i][1]&&nnn+(1ll<<i)<=k)
	 {
	 	nnn+=(1ll<<i); 
	// 	printf("i=%lld\n",i);
	 }
 } 

//cout<<nnn<<"\n";

for(ll i=0;i<n;i++)
{
	 ans+=(nnn^b[i]);
	
}

cout<<ans;
}



Measured memory_bytes: 1024
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String S = sc.next();
        String T = sc.next();
        int[] q = new int[26];
        int[] r = new int[26];
        //要素数26、初期値：－1の変換表を用意
        for (int i = 0; i < 26; i++) {
            q[i] = -1;
            r[i] = -1;
        }
        boolean flag = true;
        for (int i = 0; i < S.length(); i++) {
            if (q[S.charAt(i) - 'a'] < 0) {
                q[S.charAt(i) - 'a'] = T.charAt(i) - 'a';
            } else {
                if (q[S.charAt(i) - 'a'] != T.charAt(i) - 'a') {
                    flag = false;
                }
            }
            if (r[T.charAt(i) - 'a'] < 0) {
                r[T.charAt(i) - 'a'] = S.charAt(i) - 'a';
            } else {
                if (r[T.charAt(i) - 'a'] != S.charAt(i) - 'a') {
                    flag = false;
                }
            }
        }
        if (flag) {
            System.out.println("Yes");
        } else {
            System.out.println("No");
        }
    }

}

Measured memory_bytes: 27132
object Main {
  def main(args: Array[String]): Unit = {
    val in = new java.util.Scanner(System.in)
    val r = in.nextInt()
    val c = in.nextInt()
    val array = Array.ofDim[Int](r+1,c+1)
    for( i <- 0 to r-1){
      for(j <- 0 to c-1){
        array(i)(j) = in.nextInt()
        array(i)(c) += array(i)(j)
        array(r)(j) += array(i)(j)
        array(r)(c) += array(i)(j)
      }
    }
   
    printArray(array)
  }
  def printArray(array : Array[Array[Int]]) :Unit ={
    for(i <- 0 to array.length-1){
      for(j <- 0 to array(i).length-1){
        print(array(i)(j))
        if(j != array(i).length-1){
          print(" ")
        }
      }
      println("")
    }
  }
}

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

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

using ll = long long;
constexpr ll INF = 10000000000;
constexpr ll MOD = 1000000007;

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

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

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

		while (i + 1 < n && a[i] == a[i + 1])i++;

		if (i + 1 < n && a[i] < a[i + 1]) {
			while (i + 1 < n && a[i] <= a[i + 1])i++;
		}
		else if (i + 1 < n && a[i] > a[i + 1]) {
			while (i + 1 < n && a[i] >= a[i + 1])i++;
		}
		cnt++;
	}
	cout << cnt << endl;
}	




Measured memory_bytes: 640
#include <iostream>
#include <algorithm>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <string.h>
#include <vector>
#include <queue>
#include <cmath>
#include <bitset>
#include <complex>
#include <functional>
#include <numeric>
#include <iomanip>

// output
#define SPBR(w, n) std::cout<<(w + 1 == n ? '\n' : ' ');
#define YES cout << "YES" << endl
#define Yes cout << "Yes" << endl
#define NO cout << "NO" << endl
#define No cout << "No" << endl
// utility
#define ALL(i) (i).begin(), (i).end()
#define FOR(i, a, n) for(int i=(a);i<(n);++i)
#define RFOR(i, a, n) for(int i=(n)-1;i>=(a);--i)
#define REP(i, n) for(int i=0;i<int(n);++i)
#define RREP(i, n) for(int i=int(n)-1;i>=0;--i)
#define IN(a, x, b) (a<=x && x<b)
#define OUT(a, x, b) (x<a || b<=x)
template<class T> inline T chmax(T & a, const T b) { return a = (a < b) ? b : a; }
template<class T> inline T chmin(T& a, const T b) { return a = (a > b) ? b : a; }

// type/const
#define int ll
using ll = long long;
using ull = unsigned long long;
using ld = long double;
const int MOD = 1000000007;
/* const int MOD = 998244353; */
const int INF = 1e18;
const double PI = acos(-1);

using namespace std;
struct INIT { 
  INIT(){cin.tie(0); ios::sync_with_stdio(false);
  cout << fixed << setprecision(10);
}}INIT;


signed main() {
  int H, W;
  cin >> H >> W;

  vector<string> s(H);
  REP(i, H) cin >> s[i];

  REP(i, H){
    cout << s[i] << "\n" << s[i] << "\n";
  }

  return 0;
}

Measured memory_bytes: 256
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx")
#pragma GCC optimize("unroll-loops")
//#pragma warning(disable : 4996)

#ifdef _MSC_VER
#include <intrin.h>
#define __builtin_popcount __popcnt
#define __builtin_popcountll __popcnt64
#endif

#include <limits.h>
#include <math.h>
#include <time.h>

#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <complex>
#include <cstdio>
#include <cstring>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>

using namespace std;

#define REP(i, n) for (int i = 0; i < (n); ++i)
#define REPR(i, n) for (int i = n - 1; i >= 0; --i)
#define FOR(i, m, n) for (int i = m; i < n; ++i)
#define FORR(i, m, n) for (int i = m - 1; i >= n; --i)
#define SORT(v, n) sort(v, v + n);
#define VSORT(v) sort(v.begin(), v.end());
#define REVERSE(v, n) reverse(v, v + n);
#define VREVERSE(v) reverse(v.begin(), v.end())
#define ll long long
#define print(x) cout << (x) << '\n'
#define pe(x) cout << (x) << " "
#define DEBUG(x) cout << #x << ": " << x << endl
#define lb(v, n) lower_bound(v.begin(), v.end(), (n))
#define ub(v, n) upper_bound(v.begin(), v.end(), (n))
#define int long long
#define double long double
#define all(x) (x).begin(), (x).end()
#define print_space(v) REP(i, v.size()) cout << v[i] << ((i == v.size() - 1) ? "\n" : " ")
template <typename T1, typename T2> inline void chmin(T1& a, T2 b) {
	if (a > b) a = b;
}
template <typename T1, typename T2> inline void chmax(T1& a, T2 b) {
	if (a < b) a = b;
}
typedef pair<int, int> pii;
typedef pair<long long, long long> pll;
typedef array<int, 3> arr3;
std::random_device rd;
std::mt19937 mt(rd());
constexpr ll MOD = 1e9 + 7;
constexpr int MAX = 500050;
const double pi = acos(-1);
constexpr double EPS = 1e-8;
constexpr ll LINF = 1e18 + 1;
constexpr int INF = 1e9 + 1;


void solve() {
	int A, V, B, W, T; cin >> A >> V >> B >> W >> T;
	int d = abs(B - A);
	int v = V - W;
	if (v <= 0)print("NO");
	else if (v*T >= d)print("YES");
	else print("NO");
}



signed main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	mt.seed((int)(time(0)));
	//REP(_, 10000)test();
	//int q;
	//cin >> q;
	//while (q--)
	solve();
}



Measured memory_bytes: 3648
#include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define all(v) v.begin(),v.end()
#define mem(arr) memset(arr, 0, sizeof(arr))
#define ff first
#define ss second
#define int long long int
const int MOD = 1e9 + 7;
const int INF = 1e18;
const int N = 1e6 + 20;
vector<int> g[N];
vector<int> vis(N);
int32_t main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    int tc = 1;
    while(tc--){
        int n;
        cin >> n;
        string s;
        cout << "0\n";
        cout << flush;
        cin >> s;
        if(s[0] == 'V'){
            return 0;
        }
        int l = 0, r = n - 1;
        while(l <= r){
            int mid = (l + r) / 2;
            cout << mid << '\n';
            cout << flush;
            string str;
            cin >> str;
            if(str[0] == 'V'){
                return 0;
            }
            if(mid % 2){
                if(str[0] != s[0]){
                    l = mid + 1;
                }else{
                    r = mid - 1;
                }
            }else{
                if(str[0] == s[0]){
                    l = mid + 1;
                }else{
                    r = mid - 1;
                }
            }
        }
    }
}

Measured memory_bytes: 32084
n, m = map(int,input().split())
a = list(map(int,input().split()))
tot = 0
for x in a:
    tot += x
cnt = 0
for x in a:
    if 4*x*m >= tot:
        cnt += 1
if cnt < m:
    print("No")
else:
    print("Yes")


Measured memory_bytes: 3060
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<utility>
#include<set>
#include<stack>
#include<list>
#include<deque>
#include<bitset>
#include<iomanip>
#include<cstring>
#include<sstream>
#include<cstdio>
#include<cstdlib>
#include<climits>
#include<cmath>
#include<cctype>


#define pb push_back
#define mp make_pair
#define rep(i,a,b) for(int i=a;i<=b;i++)
#define ren(i,a,b) for(int i=a;i>=b;i--)
#define ff first
#define ss second
#define pll pair<long long int,long long int>
#define pii pair<int,int>
#define vll vector<long long int>
#define vii vector<int>
#define gi(n) scanf("%d",&n)
#define gll(n) scanf("%lld",&n)
#define gstr(n) scanf("%s",n)
#define gl(n) cin >> n
#define oi(n) printf("%d",n)
#define oll(n) printf("%lld",n)
#define ostr(n) printf("%s",n)
#define ol(n) cout << n
#define os cout<<" "
#define on cout<<"\n"
#define o2(a,b) cout<<a<<" "<<b
#define all(n) n.begin(),n.end()
#define present(s,x) (s.find(x) != s.end())
#define cpresent(s,x) (find(all(s),x) != s.end())
#define tr(container, it) for(__typeof(container.begin()) it = container.begin(); it != container.end(); it++)
using namespace std;

typedef unsigned long long int ull;
typedef long long int ll;
typedef long double ld;
typedef vector<vector<ll> > mat;

bitset<20005> x[8005],y[8005];
int off=10000;
int main()
{ios_base::sync_with_stdio(false);
string s;
cin>>s;
int x1,y1;
cin>>x1>>y1;
s+='T';
int n=s.length();

vii v;
int c=0;
rep(i,0,n-1)
{
	if(s[i]=='F')c++;
	else
	{
		if(c>0)
		v.pb(c);
		c=0;
		v.pb(c);
	}
}
n=v.size();
int t=0;

rep(i,0,n-1)
{
	if(i==0)
	{
		y[0].set(off);
		if(v[0]==0)
		{
			t++;
			x[0].set(off);
		}
		else
		{
			x[0].set(off+v[0]);
		}
	}
	else
	{
		if(v[i]==0)
		{
			t++;
			x[i]=x[i-1];
			y[i]=y[i-1];
		}
		else
		{
			if(t%2)
			{
				x[i]=x[i-1];
				y[i]=(y[i-1]>>v[i])|(y[i-1]<<v[i]);
			}
			else
			{
				y[i]=y[i-1];
				x[i]=(x[i-1]>>v[i])|(x[i-1]<<v[i]);
			}
		}
	}
}
if(x[n-1].test(off+x1)&&y[n-1].test(off+y1))ol("Yes");
else ol("No");
return 0;
}



Measured memory_bytes: 39552
#include <cstdio>

using namespace std;

int dp1[3001];
int dp2[3001];

int main() {
    int a, b, c, d, e, f, sum, ans, i, j;
    
    scanf("%d %d %d %d %d %d", &a, &b, &c, &d, &e, &f);
    
    a *= 100;
    b *= 100;
    
    dp1[0] = 1;
    for (i = 0; i <= f; i++) {
        if (dp1[i] == 0) continue;
        
        if (i + a <= f) dp1[i + a] = 1;
        if (i + b <= f) dp1[i + b] = 1;
    }
    
    dp2[0] = 2;
    for (i = 0; i <= f; i++) {
        if (dp2[i] == 0) continue;
        
        if (i + c <= f) dp2[i + c] = 1;
        if (i + d <= f) dp2[i + d] = 1;
    }
    
    sum = a;
    ans = 0;
    
    for (i = 1; i <= f; i++) {
        for (j = 1; i + j <= f; j++) {
            if (j * (100 + e) > (i + j) * e) break;
            if (dp1[i] == 0 || dp2[j] == 0) continue;
            
            if (j * sum > (i + j) * ans) {
                sum = i + j;
                ans = j;
            }
        }
    }
    
    printf("%d %d\n", sum, ans);
    
    return 0;
}


Measured memory_bytes: 128
a = []
a = gets.split.map(&:to_i)
b = []
b = gets.split.map(&:to_i)
t = 0
ini = 0
for i in 0..b.length-1
  ini = ini + b[i]
end 
for i in 1..b.length-1
  if b[0] > a[1]
    b[0] = a[1]
  end
  if b[i-1] + b[i] > a[1]
    b[i] = a[1] - b[i-1]
  end
end
fin = 0
for i in 0..b.length-1
  fin = fin + b[i]
end  
puts ini - fin
    

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

int main() {
	ios :: sync_with_stdio(false);
	int a[10];
	for(int i = 0; i < 10; i ++)
		cin >> a[i];
	sort(a, a + 10, greater<int>());
	for(int i = 0; i < 3; i ++)
		cout << a[i] << '\n';
	return 0;
}

Measured memory_bytes: 3144
import sys
from io import StringIO
import unittest

class TestClass(unittest.TestCase):
    def assertIO(self, input, output):
        stdout, stdin = sys.stdout, sys.stdin
        sys.stdout, sys.stdin = StringIO(), StringIO(input)
        resolve()
        sys.stdout.seek(0)
        out = sys.stdout.read()[:-1]
        sys.stdout, sys.stdin = stdout, stdin
        self.assertEqual(out, output)
    def test_入力例_1(self):
        input = """4 150
150 140 100 200"""
        output = """2"""
        self.assertIO(input, output)
    def test_入力例_2(self):
        input = """1 500
499"""
        output = """0"""
        self.assertIO(input, output)
    def test_入力例_3(self):
        input = """5 1
100 200 300 400 500"""
        output = """5"""
        self.assertIO(input, output)
def resolve():
    (N,K)=(int(i) for i in input().split())
    h=[int(i) for i in input().split()]
    count=0
    for i in h:
        if i>=K:
            count+=1
    print(count)
if __name__ == "__main__":
    resolve()

Measured memory_bytes: 64236
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
//template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
 
/* attention
    long longのシフト演算には気をつけよう
    タイポした時のデバッグが死ぬほどきつくなるので変数名は最低3字くらい使った方がいいかも
    sizeは(int)とキャストしよう
    ごちゃごちゃ場合分けを考える前に全探索は考えましたか？
*/

typedef tuple<int, int, int> T;

int main(){
    int N, Q; cin >> N >> Q;
    vector<T> a(N);
    vector<int> ans(Q, -1);

    for(int i=0; i<N; i++){
        int s, t, x; cin >> s >> t >> x;
        s -= x;
        t -= x;
        a[i] = make_tuple(x, s, t);
    }
    sort(a.begin(), a.end());

    set<pair<int, int>> s;
    for(int i=0; i<Q; i++){
        int d; cin >> d;
        s.insert(make_pair(d, i));
    }

    for(int i=0; i<N; i++){
        int x, l, r;
        tie(x, l, r) = a[i];
        auto itr = s.lower_bound(make_pair(l, -1));
        while(itr != s.end()){
            if(itr->first >= r) break;

            ans[itr->second] = x;
            s.erase(itr++);
        }
    }

    for(int i=0; i<Q; i++) cout << ans[i] << endl;

    return 0;
}

Measured memory_bytes: 14336
#include <bits/stdc++.h>
using namespace std;
double esp=1e-8;
//#pragma comment(linker, "/STACK:1024000000,1024000000")
#define fi first
#define se second
#define all(a) (a).begin(),(a).end()
#define cle(a) while(!a.empty())a.pop()
#define mem(p,c) memset(p,c,sizeof(p))
#define mp(A, B) make_pair(A, B)
#define pb push_back
typedef long long int LL;
const long double PI = acos((long double)-1);
const LL INF=0x3f3f3f3fll;
const int MOD =1e9+7ll;
const int maxn=100010;
priority_queue<pair<LL,int> >q,q1,q2,q3;
LL f[maxn],a[maxn],b[maxn],c[maxn];
int main()
{
    //freopen("in.txt", "r", stdin);
    //freopen("pentagon.in", "r", stdin);
    //freopen("pentagon.out", "w", stdout);
    int X,Y,Z;
    scanf("%d%d%d",&X,&Y,&Z);
    LL sum=X+Y+Z,ans=0;
    for(int x=1;x<=sum;x++)
    {
        scanf("%lld%lld%lld",&a[x],&b[x],&c[x]);
        ans+=a[x];
        q.push(mp(-a[x]+b[x],x));
        f[x]=1;
    }
    for(int x=1;x<=Y;x++)
    {
        auto tt=q.top();
        q.pop();
        f[tt.se]=2;
        ans+=tt.fi;
    }
    for(int x=1;x<=sum;x++)
    if(f[x]==1)
    {
        q1.push(mp(-a[x]+c[x],x));
        q3.push(mp(-a[x]+b[x],x));
    }
    else
    {
        q2.push(mp(-b[x]+c[x],x));
    }
    for(int x=1;x<=Z;x++)
    {
        pair<LL,int> m1=mp(-2*INF,0),m2=mp(-INF,0),m3=mp(-INF,0);
        while(!q1.empty()&&f[q1.top().se]!=1)q1.pop();
        if(!q1.empty())m1=q1.top();

        while(!q2.empty()&&f[q2.top().se]!=2)q2.pop();
        if(!q2.empty())m2=q2.top();


        while(!q3.empty()&&f[q3.top().se]!=1)q3.pop();
        if(!q3.empty())m3=q3.top();

        if(m1.fi>m2.fi+m3.fi)
        {
            ans+=m1.fi;
            f[m1.se]=3;
        }
        else
        {
            ans+=m2.fi+m3.fi;
            q2.push(mp(-b[m3.se]+c[m3.se],m3.se));
            f[m2.se]=3;
            f[m3.se]=2;
        }
    }
    printf("%lld\n",ans);
    return 0;
}


Measured memory_bytes: 11120
#include<bits/stdc++.h>
using namespace std;
#define N 2003
#define LL long long
#define mod 998244353

int n,ans;
int b[N];

inline int read(){
	int X=0,w=0;
	char ch=0;
	while (ch<'0' || ch>'9')
	  w|=ch=='-',ch=getchar();
	while (ch>='0' && ch<='9')
	  X=(X<<3)+(X<<1)+(ch^48),ch=getchar();
	return w ? -X : X;
}

int main(){
	n=read();
	int last=2e9;
	for (int i=1;i<n;i++){
		int p=read();
		ans+=min(p,last);
		last=p;
	}
	ans+=last;
	printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 256
from collections import defaultdict

d = defaultdict(int)
d[0] = 1
s, p = 0, 1
for c in reversed(input()):
  s = (s + p * int(c)) % 2019
  d[s] = d.get(s, 0) + 1
  p = p * 10 % 2019
print(sum(x * (x - 1) // 2 for x in d.values()))


Measured memory_bytes: 9568
/*
 * ID: 0025
 * Problem: Hit and Blow
 */

#include <stdio.h>

int main(void)
{
    int a[4 + 1], b[4 + 1];

    while (scanf("%d %d %d %d", a + 1, a + 2, a + 3, a + 4) != EOF) {
        scanf("%d %d %d %d", b + 1, b + 2, b + 3, b + 4);

        int hit = 0;
        int i;
        for (i = 1; i <=4; i++)
            if (a[i] == b[i]) {
                a[i] = b[i] = 0;
                hit++;
            }

        int blow = 0;
        int j;
        for (i = 1; i <=4; i++) {
            if (a[i] == 0)
                continue;
            for (j = 1; j <=4; j++) {
                if (b[j] == 0)
                    continue;
                if (a[i] == b[j]) {
                    a[i] = b[j] = 0;
                    blow++;
                }
            }
        }

        printf("%d %d\n", hit, blow);
    }

    return 0;
}




Measured memory_bytes: 1924
n, k, q = list(map(int, input().split()))

# 回答者毎の正解数を0で初期化
ns_corrects = [0] * n

for i in range(q):
    # 回答者毎の正解数をカウント
    ns_corrects[int(input())-1] += 1


for j in range(n):
    # 回答者毎に「問題数―正解数=減点数」をカウントし持ち点が無くなれば'No'
    if k - (q - ns_corrects[j]) <= 0:
        print('No')
    else:
        print('Yes')

Measured memory_bytes: 9832
using namespace std;

#include <iostream>
#include <cmath>
int main(
){
    long long   N = 0;
    long long   K = 0;
    std::cin >> N >> K;

    long long   ans;
    ans = min(N%K, std::abs(N%K - K));


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

Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.math.BigDecimal;

public class Main {

    public static void main(String[] args) throws Exception {
        PrintWriter out = new PrintWriter(System.out);
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int L = Integer.parseInt(br.readLine());
        double average = (double)L/3;
        out.println(BigDecimal.valueOf(average * average * average).toPlainString());
        out.flush();
        out.close();
        br.close();
    }
}

Measured memory_bytes: 20436
import java.io.*;
import java.util.*;

public class Main {
  private static final int MOD = 1000000007;

  public static void main(String[] args) throws IOException {
    BufferedReader in = new BufferedReader(new InputStreamReader(System.in));

    int N = Integer.parseInt(in.readLine());
    int[] A = new int[N];
    StringTokenizer st = new StringTokenizer(in.readLine());
    for (int i = 0; i < N; ++i) {
      A[i] = Integer.parseInt(st.nextToken());
    }

    System.out.println(solve(N, A));

    in.close();
  }

  private static long solve(int N, int[] A) {
    long sum = A[0], result = 0;

    for (int i = 1; i < N; ++i) {
      result = (result + (sum * A[i]) % MOD) % MOD;
      sum += A[i];
      sum %= MOD;
    }

    return result;
  }
}

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

#define fo1(i, n) for (int i = 0; i < n; i++)
#define rep(i, l, r) for (int i = l; i < r; i++)
#define repb(i, r, l) for (int i = r; i > l; i--)
#define all(x) (x).begin(), (x).end()
#define sz(x) int((x).size())
using ll = long long; using vi = vector<int>; using ii = pair<int,int>;
const int oo = 0x3f3f3f3f; const ll OO = ll(oo)*oo; const int N = 100005;
#ifndef DEBUG
#define endl '\n'
#define debugf(...)
#else
#define debugf(...) printf(__VA_ARGS__)
#endif

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

    double n; cin >> n;

    if ((int)n % 2 == 1) {
        cout << 0.5 + 1.0/(2.0*n) << endl;
    } else {
        cout << 0.5 << endl;
    }

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i=0; i<(int)(n); i++)
#define rep1(i, n) for(int i=1; i<(int)(n); i++)
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> wi;
typedef vector<string> vs;

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

  int n;
  cin >> n;

  string ans="No";
  for(int i=0; i<=n/4; i++)for(int j=0; j<=n/7; j++){
    if(i*4+j*7==n){
      ans="Yes";
      break;
    }
  }

  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 3656
#include<stdio.h>

int b,n,d=0;


int main(){������
	scanf("%d %d",&n,&b);
	loop:
		n=n/b;
		d++;
		if (n==0){
			printf("%d",d);
			return 0;
		}
		if (n<b){
			d++;
			printf("%d",d);
			return 0;
		}
	goto loop;
	return 0;
}

Measured memory_bytes: 128
//Link : https://atcoder.jp/contests/arc095/tasks/arc095_d

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

vector<int> adj[N];

int numDegTwoNode[N];
bool dfs(int node,int par) {
  numDegTwoNode[node]= 0;
  for(int ch : adj[node]) {
    if(adj[ch].size()>=2) {
      ++numDegTwoNode[node];
    }
    if(ch!=par) {
      if(!dfs(ch,node)) {
        return false;
      }
    }
  }
  if(numDegTwoNode[node]>2) {
    return false;
  }
  return true;
}

int path[N];
int pos = 1;
void dfs2(int node,int par) {
  path[pos++] = node;
  for(int ch : adj[node]) {
    if(ch==par) {
      continue;
    }
    if(adj[ch].size()>=2) {
      dfs2(ch,node);
      break;
    }
  }
}

int per[N];
int tmp[N];

void isBetter(int n) {
  for(int i=0;i<n;++i) {
    if(per[i]!=tmp[i]) {
      if(per[i]>tmp[i]) {
        for(int j = 0;j<n;++j) {
          per[j] = tmp[j];
        }
      }
      return;
    }
  }
}

int deg[N];


void makePermuetation(int size,int n) {
  int index = 1;
  int per = 2;
  tmp[0] = 1;
  for(int i=1;i<size;++i) {
    int sz = deg[i] - 2;
    tmp[index+sz] = per++;
    for(int j =0;j<sz;++j) {
      tmp[index+j] = per++;
    }
    index += sz+1;
  }
  tmp[index] = per;
  assert(per==n);
}
void solve() {
  int n;scanf("%d ", &n);
  if(n==2) {
    printf("1 2\n");
    return;
  }
  for(int i=0;i<n-1;++i) {
    int a,b;scanf("%d %d ", &a,&b);
    adj[a].push_back(b);
    adj[b].push_back(a);
  }
  if(!dfs(1,0)) {
    printf("-1\n");
    return;
  }

  int stNode = -1;
  for(int i=1;i<=n;++i) {
    if(adj[i].size()>=2 && numDegTwoNode[i]<=1) {
      stNode = i;
      break;
    }
  }
  assert(stNode!=-1);
  dfs2(stNode,0);
  for(int i=1;i<pos;++i) {
    deg[i] = adj[path[i]].size();
  }
  per[0] = n+2;
  makePermuetation(pos,n);
  isBetter(n);
  reverse(deg+1,deg+pos);
  makePermuetation(pos,n);
  isBetter(n);

  for(int i=0;i<n;++i) {
    printf("%d ", per[i]);
  }
}

int main() {
  //freopen("input.txt","r",stdin);
  solve();
  return 0;
}


Measured memory_bytes: 10624
import java.util.Scanner;
public class Main{
 
	public static void main(String[] args) {
 
		Scanner sc = new Scanner(System.in);
		
		long a = sc.nextLong();
   	    long b = sc.nextLong();
	    long k = sc.nextLong();
      
      	long num1 = a-k ;
      
      if(num1>=0)
              System.out.println((a-k)+" "+b);
      else
      {
        if(num1+b>0)
          System.out.println('0'+" "+(num1+b));
        else
          System.out.println('0'+" "+'0');
      }
      
      
      


 
      
      
 
 
 
		
		
	}
 
}

Measured memory_bytes: 21844
/******************************************
* AUTHOR : SHASHANK *
* NICK : lance_lot *
* INSTITUTION : BIT MESRA *
******************************************/
#include <bits/stdc++.h>
using namespace std;
#define N 100005
#define MOD 1000000007
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define endl "\n"
#define fast ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair <ll, ll> pll;
const ll M=1e9+7;
ll inf=1e18;

int main() {
fast;
#ifdef _DEBUG
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
    ll n;
    cin>>n;
    ll arr[n];
    for(ll i = 0;i < n;i++)
        cin>>arr[i];
    ll dp[n] = {0};
    dp[0] = 0,dp[1] = abs(arr[1]-arr[0]);
    for(ll i = 2;i < n;i++) {
        dp[i] += min(dp[i-1]+abs(arr[i]-arr[i-1]),dp[i-2]+abs(arr[i]-arr[i-2]));
    }
    cout<<dp[n-1];
}

Measured memory_bytes: 1792
#include<iostream>
#include<vector>
#include<algorithm>
#include<queue>
using namespace std;

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

int main(){
   int h,w;
   cin>>h>>w;
   vector<vector<char>>a(100,vector<char>(100));
   vector<vector<int>>b(100,vector<int>(100));
   for(int i=1;i<=h;i++){
       for(int j=1;j<=w;j++){
           cin>>a[i][j];
           if(a[i][j]=='#'){
               b[i][j]=9;
           }
           else{
               b[i][j]=0;
           }
       }
   }
   for(int i=1;i<=h;i++){
       for(int j=1;j<=w;j++){
           if(b[i][j]>=9){
               b[i-1][j-1]++;
               b[i-1][j]++;
               b[i-1][j+1]++;
               b[i][j-1]++;
               b[i][j+1]++;
               b[i+1][j-1]++;
               b[i+1][j]++;
               b[i+1][j+1]++;
           }
       }
   }
   for(int i=1;i<=h;i++){
       for(int j=1;j<=w;j++){
           if(b[i][j]>=9){
               cout<<'#'<<flush;
           }
           else{
               cout<<b[i][j]<<flush;
           }
       }
       cout<<endl;
   }

    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp make_pair
#define Fast_IO ios::sync_with_stdio(false);
inline int read()
{
	char ch=getchar(); int nega=1; while(!isdigit(ch)) {if(ch=='-') nega=-1; ch=getchar();}
	int ans=0; while(isdigit(ch)) {ans=ans*10+ch-48;ch=getchar();}
	if(nega==-1) return -ans;
	return ans;
}
#define N 205
int a[N][N];
int res[N];
signed main()
{
#ifdef __LOCAL__
	freopen("in.txt","r",stdin);
#endif
	int n;
	cin>>n;
	for(int i=1;i<=n;i++)
	{
		for(int j=1;j<=n;j++)
		{
			scanf("%1d",&a[i][j]);
		}
	}
	int ans=0;
	for(int i=1;i<=n;i++)
	{
		memset(res,-1,sizeof(res));
		res[i]=1;
		bool ok=true;
		queue<int> q;
		q.push(i);
		while(!q.empty())
		{
			int t=q.front();
			q.pop();
			for(int j=1;j<=n;j++)
			{
				if(a[t][j])
				{
//					printf("%d %d %d %d\n",t,j,res[j],res[t]);
					if(abs(res[j]-res[t])==1) continue;
					else if(res[j]==-1) res[j]=res[t]+1,q.push(j);
					else ok=0;
				}
			}
		}
		if(ok)
		{
			int maxn=0;
			for(int i=1;i<=n;i++)
			{
				if(res[i]>maxn) maxn=res[i];
			}
			if(maxn>ans) ans=maxn;
//			printf("%d %d\n",i,ans);
		}
	}
	if(ans!=0) cout<<ans<<endl;
	else cout<<"-1\n";
#ifdef __LOCAL__
	printf("Time Used : %d\n",clock());
#endif
	return 0;
}



Measured memory_bytes: 384
n = int(input())
a = []
for i in range(n):
	a.append(int(input()))
t = a[0]
ans = 1
if t == 2:
	print(ans)
else:
	while True:
		t = a[t-1]
		ans += 1
		if t == 2:
			print(ans)
			break
		if ans > n:
			print('-1')
			break

Measured memory_bytes: 7084
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>

#include <iostream>
#include <complex>
#include <string>
#include <algorithm>
#include <numeric>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>

#include <functional>
#include <cassert>

typedef long long ll;
using namespace std;

#ifndef LOCAL
#define debug(x) ;
#else
#define debug(x) cerr << __LINE__ << " : " << #x << " = " << (x) << endl;

template <typename T1, typename T2>
ostream &operator<<(ostream &out, const pair<T1, T2> &p) {
  out << "{" << p.first << ", " << p.second << "}";
  return out;
}

template <typename T>
ostream &operator<<(ostream &out, const vector<T> &v) {
  out << '{';
  for (const T &item : v) out << item << ", ";
  out << "\b\b}";
  return out;
}
#endif

#define mod 1000000007 //1e9+7(prime number)
#define INF 1000000000 //1e9
#define LLINF 2000000000000000000LL //2e18
#define SIZE 200010


int main(){
  int N;
  ll sum = 0, a[SIZE];

  cin >> N;

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

  ll sum2 = 0;

  ll ans = LLINF;

  for (int i=0; i<N-1; i++) {
    sum2 += a[i];
    sum -= a[i];

    ans = min(ans, abs(sum - sum2));
  }

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 1792
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <bitset>
#include <algorithm>
#include <complex>
#include <array>
using namespace std;
 
#define REP(i,n) for(int i=0; i<n; ++i)
#define FOR(i,a,b) for(int i=a; i<=b; ++i)
#define FORR(i,a,b) for (int i=a; i>=b; --i)
#define ALL(c) (c).begin(), (c).end()
 
typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<VI> VVI;
typedef vector<VL> VVL;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;
typedef vector<double> VD;
typedef vector<VD> VVD;

template<typename T> void chmin(T &a, T b) { if (a > b) a = b; }
template<typename T> void chmax(T &a, T b) { if (a < b) a = b; }

int in() { int x; scanf("%d", &x); return x; }
ll lin() { ll x; scanf("%lld", &x); return x; }

int main() {
    int n, k;
    cin >> n >> k;
    cout << (n - k + 1) << endl;

    return 0;
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
#define rep(i,n) for(int i = 0; i < (n); ++i)
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n, a, b;
	cin >> n >> a >> b;
	int ans = 0;
	for(int i = 1; i <= n; ++i){
		int num = i, sum = 0;
		while(num > 0){
			sum += num % 10;
			num /= 10;
		}
		if(a <= sum && sum <= b) ans += i;
	}
	cout << ans << endl;
	return 0;
}

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

int a[200005];

int main() {
    int n, x;
    cin >> n;
    for(int i=2; i<=n; i++) {
        cin >> x;
        a[x]++;
    }
    for(int i=1; i<=n; i++) {
        cout << a[i] << "\n";
    }
    return 0;
}


Measured memory_bytes: 4328
#include<bits/stdc++.h>
using namespace std;
int main(){


    long long int a,b,c,d,e,f,g,i,j;
    string x,y,z;
    vector<int> v;
    vector<int> v1;
   cin>>a;
   b=a/500;
   c=b*1000;
   d=a%500;
   e=d/5;
   
   f=e*5;
   g=c+f;
   cout<<g<<endl;





    return 0;
}


Measured memory_bytes: 256
using System;

namespace A___Tenki
{
    class Program
    {
        static void Main(string[] args)
        {
            var S = Console.ReadLine();
            var T = Console.ReadLine();
            var count = 0;
            for (int i = 0; i < S.Length; i++)
            {
                if (S[i] == T[i])
                {
                    count++;
                }
            }
            Console.WriteLine(count);
        }
    }
}


Measured memory_bytes: 11092
#include <iostream>
#include <algorithm>
#include <iomanip>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,k,n) for(int i=k;i<n;i++)
int main (){
    int n,k;
    double b[100100] = {};
    cin >> n >> k;
    rep(i,n+1) b[i] = 0.5;

    REP(i,1,50001){
        b[i*2] += b[i]/2.0;
    }
    double ans = 0.0;
    REP(i,1,k){
        ans += (double)b[i];

    }
    ans = (n-ans)/n;
    cout << fixed << setprecision(12) <<ans << endl;

    return 0;
}


Measured memory_bytes: 1024
/**
    AUTHOR:Jun_SH
    TIME:2019/6/16
    PROBLEM:ABC130_d
*/
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll maxn=2e3+10;
const ll mod=1e9+7;
ll ans=0;
ll n,m;
ll lcs[maxn][maxn];
ll a[maxn];
ll b[maxn];
void cal(){
    lcs[1][1]=a[1]==b[1]?2:1;
    for(ll i=2;i<=n;++i){
        lcs[1][i]=lcs[1][i-1];
        if(b[1]==a[i])lcs[1][i]=lcs[1][i-1]+1;

    }
    for(ll i=2;i<=m;++i){
        lcs[i][1]=lcs[i-1][1];
        if(a[1]==b[i])lcs[i][1]=lcs[i-1][1]+1;
    }
    for(ll i=2;i<=m;++i){
        for(ll j=2;j<=n;++j){
            if(a[j]==b[i]){
                lcs[i][j]=(lcs[i-1][j]+lcs[i][j-1])%mod;
            }
            else{
                if(lcs[i-1][j]==lcs[i][j-1]){
                    lcs[i][j]=(2*lcs[i-1][j]-lcs[i-1][j-1]+mod)%mod;
                }
                else lcs[i][j]=(lcs[i][j-1]+lcs[i-1][j]-lcs[i-1][j-1]+mod)%mod;
            }
        }
    }
}
int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    cin>>n>>m;
    for(ll i=1;i<=n;++i)cin>>a[i];
    for(ll i=1;i<=m;++i)cin>>b[i];
    lcs[0][0]=1;
    cal();
    cout<<(lcs[m][n])%mod<<endl;
}


Measured memory_bytes: 31744
#include <stdio.h>
#include <stdlib.h>
#define MAX 2000001
#define VMAX 10001
int  C[VMAX],B[MAX];
void CountingSort(int A[],int n){
  int i,j;
  
  for(i=1;i<=VMAX;i++){
    C[i]=0;
  }

  for(j=1;j<=n;j++){
    C[A[j]]++;
  }

  for(i=1;i<=VMAX;i++){
    C[i]=C[i] + C[i-1];
  }
  
  for(j=n;j>=1;j--){
    B[C[A[j]]]=A[j];
    C[A[j]]--;
  }

  for(i=1;i<=n-1;i++){
  printf("%d ",B[i]);
  }
  printf("%d",B[n]);
  printf("\n");
}
    
int main(){
  int A[MAX];
  int n, i, j;

  scanf("%d", &n);

  for(i=1;i<=n;i++){
    scanf("%d",&A[i]);
  }
  
  CountingSort(A,n);
  


  return 0;
}



Measured memory_bytes: 17444
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
       
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        if(s.equals("AAA") || s.equals("BBB")){
          System.out.println("No");    
        } else {
          System.out.println("Yes");  
        }
        
    }
}


Measured memory_bytes: 23892
#include<stdlib.h>
#include<stdio.h>
#include<math.h>
#include<cstring>
#include<iostream>
#include<algorithm>
using namespace std;
int n,a[2][101],f[2][101];
int main()
{
	scanf("%d",&n);
	for(int i=0;i<2;i++)for(int j=1;j<=n;j++)
	  scanf("%d",&a[i][j]);
	for(int j=1;j<=n;j++)
	  {
	  f[0][j]=f[0][j-1]+a[0][j];
	  f[1][j]=max(f[0][j],f[1][j-1])+a[1][j];
	  }
	return printf("%d\n",f[1][n]),0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#include <vector>
#include <string>
#include <ctime>
#include <climits>
#include <iomanip>
#include <fstream>
#include <sstream>
#include <algorithm>
#include <utility>
#include <cstdlib>

using namespace std;
long int pow107 = (int)pow(10, 9) + 7;
int ilimit = INT_MAX;
long int llimit = LONG_MAX;

bool comp(pair<int, int> a, pair<int, int> b){
    if(a.first != b.first) return a.first > b.first;
    else return a.second < b.second;
}

long int jou(long int x, long int y){
    long int f = 1;
    for(int i = 0; i < y; ++i){
        f = f * x % pow107;
    }
    return f;
}

bool pn(long int x){
    if(x != 2 && x % 2 == 0)
        return false;
    for(int i = 3; i < x; ++i){
        if(x != i && x % i == 0)
            return false;
    }
    return true;
}

long int factorial(long int n){
    long int f = 1;
    for(long int i = 1; i <= n; ++i){
        f = f * i % pow107;
    }
    return f;
}

int Func2(int n,int m){
    long int s2 = 1,
        r = 1;


    for(int i = 1; i <= m; ++i){
        s2 = (s2*(n - (i - 1))/i) % pow107;
    }

    return s2;
}

//long intの最大llimit
//intの最大ilimit
//10^9+7    pow107
//素数pn
//n乗jou
//階乗factorial
//コンビネーションFunc2

int main(){
    int n;
    cin >> n;
    if(n % 2 == 1){
        cout << "No" << endl;
        return 0;
    }

    char s[100] = {},t[100] = {};
    for(int i = 0; i < n / 2; ++i){
        cin >> s[i];
    }
    for(int i = 0; i < n / 2; ++i){
        cin >> t[i];
    }

    for(int i = 0; i < n / 2; ++i){
        if(s[i] != t[i]){
            cout << "No" << endl;
            return 0;
        }
    }

    cout << "Yes" << endl;

}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

const long long INF = 1LL << 40;

int main()
{
	int N, M, L;
	cin >> N >> M >> L;

	vector<vector<long long>> g(N, vector<long long>(N, INF));
	for (int i = 0; i < M; ++i) {
		int A, B, C;
		cin >> A >> B >> C;
		--A;
		--B;
		g[A][B] = C;
		g[B][A] = C;
	}

	vector<vector<long long>> d = g;
	for (int k = 0; k < N; ++k) {
		for (int i = 0; i < N; ++i) {
			for (int j = 0; j < N; ++j) {
				d[i][j] = min(d[i][j], d[i][k] + d[k][j]);
			}
		}
	}

	vector<vector<long long>> g2(N, vector<long long>(N, INF));
	for (int i = 0; i < N; ++i) {
		for (int j = 0; j < N; ++j) {
			if (d[i][j] <= L) {
				g2[i][j] = 1;
			}
		}
	}

	vector<vector<long long>> d2 = g2;
	for (int k = 0; k < N; ++k) {
		for (int i = 0; i < N; ++i) {
			for (int j = 0; j < N; ++j) {
				d2[i][j] = min(d2[i][j], d2[i][k] + d2[k][j]);
			}
		}
	}

	int Q;
	cin >> Q;
	vector<long long> ans(Q);
	for (int i = 0; i < Q; ++i) {
		int s, t;
		cin >> s >> t;
		--s;
		--t;
		if (d2[s][t] == INF) {
			ans[i] = -1;
		}
		else {
			ans[i] = d2[s][t] - 1;
		}
	}

	for (auto x : ans) {
		cout << x << endl;
	}
}


Measured memory_bytes: 4096