akhauriyash/Code-Regression huggingface dataset:
import sys

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

def main():
    s=input()
    print("ABC"+s)
main()

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef double d;
const long long INF = 10000000000000;
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; }
int main() {
  d A,B,C,D,E,F;
  cin >> A >> B >> C >> D >> E >> F;
  vector<tuple<d,d,d>> t;
  vector<d> M;
  vector<d> S;
  for(int i=  0;i<=F;i++){
    for(int j = 0;j<=F;j++){
      d m= 100*A*i+100*B*j;
      if(m<=F) M.push_back(m);
    }
  }
  for(int i=  0;i<=F;i++){
    for(int j = 0;j<=F;j++){
      d s= C*i + D*j;
      if(s<=F) S.push_back(s);
    }
  }
  for(int i=  0;i<M.size();i++){
    for(int j = 0;j<S.size();j++){
      if(100*S[j]/(M[i]+S[j]) <= 100*E/(100+E) && M[i] + S[j] <= F && M[i] +S[j] >0){
        t.push_back(make_tuple(100*S[j]/(M[i]+S[j]),M[i]+S[j],S[j]));
        }
       }
     }
    sort(t.begin(),t.end());
 cout << get<1>(t[t.size()-1]) <<" " <<  get<2>(t[t.size()-1])<<endl;
               
}

Measured memory_bytes: 30052
package main

import "fmt"

func main() {
	var c1, c2 string
	fmt.Scan(&c1, &c2)
	if c1[0] == c2[2] && c1[1] == c2[1] && c1[2] == c2[0] {
		fmt.Println("YES")
	} else {
		fmt.Println("NO")
	}
}

Measured memory_bytes: 512
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <complex>
#include <cstring>
#include <cstdlib>
#include <string>
#include <cmath>
#include <queue>
using namespace std;

#define REP(i,n) for(int i=0;i<(int)n;++i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define ALL(c) (c).begin(), (c).end()
const int INF = 1<<29;

int main() {
  int n;
  cin >> n;
  while(n--) {
    int ba[5][5];
    REP(y,5)REP(x,5) {
      cin >> ba[x][y];
    }
    int res = 0;
    for (int w=1; w<=5; ++w) {
      for (int h=1; h<=5; ++h) {
        REP(xx,6-w) {
          REP(yy,6-h) {
            bool f = 1;
            REP(x,w) {
              REP(y,h) {
                if (ba[xx+x][yy+y] == 0) {
                  f = 0;
                  break;
                }
              }
            }
            if (f == 1) {
              res = max(res, w*h);
            }

          }
        }
      }
    }
    cout << res << endl;
  }

}

Measured memory_bytes: 0
import java.util.*;

class Main{
	public static void main(String[] args){
    	Scanner sc = new Scanner(System.in);
      	int n = sc.nextInt();
      	List<Integer> hoge = new ArrayList<>();
      	for(int i = 0; i < n; i++) {
      		hoge.add(sc.nextInt());
      	}
      	
      	int s1 = 0, s2 = 0, min = 1000;
      	for(int j = 1; j <= n; j++) {
      		int q = 0;
      		for(Integer p:hoge) {
      			if(q <= j) s1+=p;
      			else s2+=p;
      			q++;
      		}
      		if(min > Math.abs(s1 - s2)) min = Math.abs(s1 - s2);
      		s1 = 0;
      		s2 = 0;
      	}
      	System.out.println(min);
    }
}

Measured memory_bytes: 21844
n = int(input())
ans = [0, 0]
for i in range(n):
    [t, h] = input().split()
    sort = [t, h]
    sort.sort()
    if t==h:
        ans[0] += 1
        ans[1] += 1
    elif [t, h]==sort:
        ans[1] += 3
    else:
        ans[0] += 3

print(ans[0], ans[1])

Measured memory_bytes: 7688
#include<stdio.h>
int main(){
  int a,b,c,n;
  scanf("%d %d %d %d",&a,&b,&c,&n);
  while(n--){
    if(a>=b)b*=2;
    else c*=2;
  }
  printf("%s\n",a<b&&b<c?"Yes":"No");
  return 0;
}


Measured memory_bytes: 1656
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
int main(){
  int N; cin >> N;
  vector<ll> psum (N+1, 0);
  for(int i = 1; i < N+1; i++){
    int t; cin >> t;
    psum[i] = psum[i-1] + t;
  }
  ll mi = INT_MAX;
  for(int i = 1; i < N; i++){
    ll s1 = psum[i];
    ll s2 = psum[N] - psum[i];
    //cout << s1 << " " << s2 << endl;
    mi = min(mi, abs(s1 - s2));
  }
  cout << mi << endl;
}


Measured memory_bytes: 1792
def main():
    n = int(input())
    a_list = list(map(int, input().split()))
    mod = 10 ** 9 + 7
    sum_a = sum(a_list)
    ans = 0

    for i in range(n - 1):
        sum_a -= a_list[i]
        ans += (a_list[i] * sum_a) % mod

    print(ans % mod)


if __name__ == "__main__":
    main()


Measured memory_bytes: 94256
#include <iostream>

using namespace std;

int main()
{
	int N, numeros, sum=0;
	cin>>N;
	for(int i=0; i<N; ++i)
	{
		cin>>numeros;
		while(numeros%2==0)
		{
			numeros /=2;
			sum++;
		}
	}
	cout<<sum;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define INF INT_MAX
#define MINF INT_MIN
#define ll long long
#define PB push_back
#define PF push_front
#define P_F pop_front
#define P_B pop_back
#define F front
#define B back
#define MP make_pair
#define FOR(i, a, b) for(int i = a; i < b; i++)
#define forit(i, s) for(__typeof ((s).end ()) i = (s).begin (); i != (s).end (); ++i)
#define foritr(i, s) for(__typeof ((s).rend ()) i = (s).rbegin (); i != (s).rend (); ++i)
 
using namespace std;

int main(){
  int n, aux;
  cin >> n;
  vector<vector<ll> > maxi(n), data(n);
  
  FOR(i, 0, n){
    FOR(j, 0, 3){
      cin >> aux;
      data[i].PB(aux);
      maxi[i].PB(MINF);
    }
  }
  
  FOR(i, 0, 3)
    maxi[0][i] = data[0][i];
    
  FOR(i, 1, n){
    maxi[i][0] = data[i][0] + max(maxi[i-1][1], maxi[i-1][2]);
    maxi[i][1] = data[i][1] + max(maxi[i-1][0], maxi[i-1][2]);
    maxi[i][2] = data[i][2] + max(maxi[i-1][0], maxi[i-1][1]);
  }
  
  cout << max(maxi[n-1][0], max(maxi[n-1][1], maxi[n-1][2])) << "\n";
  
  return 0;
}

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

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

int main(){
	int w,d;
	int memo[21][21];
	
	while(cin>>w>>d,w|d){
		int t;
		int ws[21],ds[21];
		int ret = 0;
		int w_check[21], d_check[21];
		
		memset(w_check,0,sizeof(w_check));
		memset(d_check,0,sizeof(d_check));
		memset(memo,0,sizeof(memo));
		
		rep(i,w){ cin>>t; ws[i]=t; }
		rep(i,d){ cin>>t; ds[i]=t; }
		
		for(;;){
			int id_w,id_d;
			int wm = 0;
			int dm = 0;
			//bool flag_1 = false;
			//bool flag_2 = false;
			
			int k;
			for(k=0; k<w; k++)if( !w_check[k] )break;
			if( k==w ){
				for(k=0; k<d; k++)if( !d_check[k] ){
					ret += ds[k];
				}
				break;
			}
			for(k=0; k<d; k++)if( !d_check[k] )break;
			if( k==d ){
				for(k=0; k<w; k++)if( !w_check[k] ){
					ret += ws[k];
				}
				break;
			}
			
			rep(i,w)if( w_check[i]==0 ){
				if( wm<ws[i] ){
					id_w = i;
					wm = ws[i];
				}
			}
			rep(i,d)if( d_check[i]==0 ){
				if( dm<ds[i] ){
					id_d = i;
					dm = ds[i];
				}
			}
			
			if( ds[id_d] == ws[id_w] ){
				d_check[id_d] = w_check[id_w] = 1;
				ret += ds[id_d];
			}else if( ds[id_d] < ws[id_w] ){
				w_check[id_w] = 1;
				ret += ws[id_w];
			}else{
				d_check[id_d] = 1;
				ret += ds[id_d];
			}
		}
		printf("%d\n",ret);
	}
	return 0;
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(){
    string s;
    cin >>s;

    if((s[0]=='A'&&s[1]=='A'&&s[2]=='A')||(s[0]=='B'&&s[1]=='B'&&s[2]=='B')){
        cout << "No" <<endl;
    }else{
        cout << "Yes" << endl;
    }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp> 
using namespace std;
//using namespace __gnu_pbds;
#define rep(i,a,b) for(i=(a);i<=(b);i++)
#define ll long long
#define pll pair<ll, ll>
#define pii pair<int,int>
#define pb push_back
#define F first
#define S second
#define mod 1000000007
#define maxn 100005
#define inf 1e18
#define boost ios::sync_with_stdio(false);cin.tie(0)
#define fr freopen("source.txt","r",stdin),freopen("output.txt","w",stdout)
#define SET(a,b) memset(a,b,sizeof(a))
#define deb(x) cout << #x << "=" << x << endl
#define deb2(x, y) cout << #x << "=" << x << "," << #y << "=" << y << endl
#define all(x) x.begin(), x.end()
//template<typename T>
//using ordered_set = tree<T,null_type,less<T>,rb_tree_tag,tree_order_statistics_node_update>;

int main()
{
    boost;
    ll n,i,j,x,t,y,k;
    cin>>n;
    ll a[n];
    for(i=0;i<n;i++) cin>>a[i];
    ll ans=inf;
    for(i=1;i<=100;i++){
        ll temp=0;
        for(j=0;j<n;j++) temp+=(a[j]-i)*(a[j]-i);
        ans=min(ans,temp);
    }
    cout<<ans;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define N 10001
char s[N][N];
int main(){
	ios::sync_with_stdio(false);
	int n,m;
	cin>>n>>m;
	for(int i=1;i<=n;i++){
		for(int j=1;j<=m;j++){
			cin>>s[i][j];
		}
	}
	for(int i=1;i<=n;i++){
		for(int j=1;j<=m;j++){
			if(s[i][j]=='#')s[i][j]='#';
			if(s[i][j]=='.'){
				s[i][j]='0';
				for(int p=i-1;p<=i+1;p++){
					for(int q=j-1;q<=j+1;q++){
						if(s[p][q]=='#')s[i][j]++;
					}
				}
			}
		}
	}
	for(int i=1;i<=n;i++){
		for(int j=1;j<=m;j++){
			cout<<char(s[i][j]);
		}
		cout<<endl;
	}
	return 0;
}

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

#define all(x) (x).begin(), (x).end()
#define sz(x) static_cast<int>((x).size())

using LL = long long;
template<class T, size_t D>
struct vec : vector<vec<T, D - 1>> {
  template<class... Args>
  vec(size_t n = 0, Args... args)
    : vector<vec<T, D - 1>>(n, vec<T, D - 1>(args...)) {}
};
template<class T>
struct vec<T, 1> : vector<T> {
  template<class... Args>
  vec(Args... args)
    : vector<T>(args...) {}
};

template<class T>
inline bool asMn(T& a, const T& b) { return a > b ? a = b, true : false; }
template<class T>
inline bool asMx(T& a, const T& b) { return a < b ? a = b, true : false; }
inline int nex(int i, int n) { return i == n - 1 ? 0 : i + 1; }
inline int pre(int i, int n) { return !i ? n - 1 : i - 1; }

mt19937 rng(static_cast<uint32_t>(chrono::steady_clock::now().time_since_epoch().count()));

template<int MOD>
struct ModInt {
  int a;
  ModInt(int a_ = 0) {
    a = a_ < MOD ? (a_ < 0 ? a_ + MOD : a_) : a_ - MOD;
  }

  bool operator !() const { return !a; }

  ModInt operator+(const ModInt& o) const { return ModInt(a + o.a); }
  ModInt& operator+=(const ModInt& o) { return *this = *this + o; }
};
using Mint = ModInt<static_cast<int>(1e9 + 7)>;

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

  #ifdef EntityIT
  freopen("input.txt", "r", stdin);
  #endif // EntityIT

  int n, m; cin >> n >> m;
  vec<pair<int, int>, 2> cond(n + 1);
  while (m--) {
    int l, r, x; cin >> l >> r >> x;
    cond[r].emplace_back(l, x);
    if (r == 1 && x > 1) {
      cout << "0\n";
      return 0;
    }
  }

  vec<Mint, 2> f(n + 1, n + 1);
  f[0][0] = Mint(3);
  auto check = [&](int i, int j, int k) {
    for (auto& condition : cond[i]) {
      int l = condition.first, x = condition.second;
      if (l > k) {
        if (x != 1) {
          return false;
        }
      } else if (l <= j) {
        if (x != 3) {
          return false;
        }
      } else {
        if (x != 2) {
          return false;
        }
      }
    }
    return true;
  };
  for (int i = 2; i <= n; ++i) {
    vec<Mint, 2> nxtF(n + 1, n + 1);
    for (int j = 0; j < i - 1; ++j) {
      for (int k = j; k < i - 1; ++k) {
        if (!f[j][k]) {
          continue;
        }

        if (check(i, j, k)) {
          nxtF[j][k] += f[j][k];
        }
        if (check(i, k, i - 1)) {
          nxtF[k][i - 1] += f[j][k];
        }
        if (check(i, j, i - 1)) {
          nxtF[j][i - 1] += f[j][k];
        }
      }
    }
    f.swap(nxtF);
  }

  Mint ans = 0;
  for (auto& i : f) {
    ans += accumulate(all(i), Mint());
  }
  cout << ans.a << '\n';

  return 0;
}


Measured memory_bytes: 4024
#include <functional>
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <cstring>
#include <string>
#include <vector>
#include <random>
#include <bitset>
#include <queue>
#include <cmath>
#include <stack>
#include <set>
#include <map>
typedef long long ll;
using namespace std;
const ll MOD = 1000000007LL;

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

    vector<int> a(n);
    map<int, ll> mp;
    for (int i = 0; i < n; i++) {
        cin >> a[i];
        mp[a[i]]++;
    }

    ll ans = 0;
    for (auto p : mp) {
        ans += p.second * (p.second - 1) / 2;
    }

    for (int i = 0; i < n; i++) {
        cout << ans - mp[a[i]] + 1 << endl;
    }

    return 0;
}

Measured memory_bytes: 11912
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <vector>
#include <math.h>
#include <iomanip>
#include <bitset>
#include <string>
#include <cstring>
#include <stdlib.h>
#include <utility>
#include <set>
using namespace std;
//cout <<  << endl;
typedef long long int ll;
typedef long double ld;
vector<pair<ll,ll>> p;
bool pairCompare(const pair<double,ll>& firstElof, const pair<double,ll>& secondElof){
    return firstElof.first < secondElof.first;
}

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

#define MAX_N 110
bool x[MAX_N];
ll num[MAX_N];
ll fibl[MAX_N]={0};

ll fib(ll a){
    if (fibl[a]!=0)return fibl[a];
    if (a==0){
        return 0;
    }else if (a==1){
        return 1;
    }
    return fibl[a]=fib(a-1)+fib(a-2);
}

ll eratosthenes(ll n) {
    int p = 0;
    for (ll i=0; i<=n; ++i) x[i] = true;
    x[0] = x[1] = false;
    for(int i=2; i<=n; ++i) {
        if(x[i]) {
            p++;
            for(int j=2*i; j<=n; j+=i) x[j] = false;
        }
        
        num[i] = p;
    }
    
    return p;
}

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

int main(){
    ll n;
    cin >> n;
    cout << n/2-1+(n%2) << endl;
    return 0;
}




Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <functional>
#include <bitset>

using namespace std;
using lint = long long int;
long long int INF = 1001001001001001LL;
int inf = 1000000007;
long long int MOD = 1000000007LL;
double PI = 3.1415926535897932;

template<typename T1,typename T2>inline void chmin(T1 &a,const T2 &b){if(a>b) a=b;}
template<typename T1,typename T2>inline void chmax(T1 &a,const T2 &b){if(a<b) a=b;}

#define ALL(a) a.begin(),a.end()
#define RALL(a) a.rbegin(),a.rend()

/* do your best */

int main() {
  
  int x; cin >> x;
  if (x >= 30) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }


  return 0;
}


Measured memory_bytes: 3632
// clang-format off
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define loop(i, a, n) for (int i = (a); i < (n); i++)
#define rep(i, n) loop(i, 0, n)
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define prec(n) fixed << setprecision(n)
constexpr int INF = sizeof(int) == sizeof(long long) ? 1000000000000000000LL : 1000000000;
constexpr int MOD = 1000000007;
constexpr double PI = 3.14159265358979;
template<typename A, typename B> bool cmin(A &a, const B &b) { return a > b ? (a = b, true) : false; }
template<typename A, typename B> bool cmax(A &a, const B &b) { return a < b ? (a = b, true) : false; }
bool odd(const int &n) { return n & 1; }
bool even(const int &n) { return ~n & 1; }
template<typename T> int len(const T &v) { return v.size(); }
template<typename T = int> T in() { T x; cin >> x; return x; }
template<typename T = int> T in(T &&x) { T z(forward<T>(x)); cin >> z; return z; }
template<typename T> istream &operator>>(istream &is, vector<T> &v) { for (T &x : v) is >> x; return is; }
template<typename A, typename B> istream &operator>>(istream &is, pair<A, B> &p) { return is >> p.first >> p.second; }
template<typename T> ostream &operator<<(ostream &os, const vector<vector<T>> &v) { int n = v.size(); rep(i, n) os << v[i] << (i == n - 1 ? "" : "\n"); return os; }
template<typename T> ostream &operator<<(ostream &os, const vector<T> &v) { int n = v.size(); rep(i, n) os << v[i] << (i == n - 1 ? "" : " "); return os; }
template<typename A, typename B> ostream &operator<<(ostream &os, const pair<A, B> &p) { return os << p.first << ' ' << p.second; }
template<typename Head, typename Value> auto vectors(const Head &head, const Value &v) { return vector<Value>(head, v); }
template<typename Head, typename... Tail> auto vectors(Head x, Tail... tail) { auto inner = vectors(tail...); return vector<decltype(inner)>(x, inner); }
// clang-format on

main() {
  int n = in();
  vector<int> a(n);
  cin >> a;
  int q = in();
  while (q--) {
    int b, e, k;
    cin >> b >> e >> k;
    cout << count(a.begin() + b, a.begin() + e, k) << endl;
  }
}



Measured memory_bytes: 3088
#include <iostream>

int main()
{
	int a, b, c;


	std::cin >> a >> b >> c;

	int count = 0;
	for (int i = a; i <= b; i++) {
		if (c%i == 0)
			count++;
	}
	
	printf("%d\n", count);

	return 0;
}


Measured memory_bytes: 3180
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class Main {

	@SuppressWarnings("resource")
	public static void main(String args[]) {
		Scanner scanner = new Scanner(System.in);
		int n = scanner.nextInt();
		List<Integer> list = new ArrayList<>();

		for (int i = 0; i < n; i++) {
			int a = scanner.nextInt();
			if (a % 2 == 0)
				list.add(a);
		}

		int cnt = 0;
		for (int a : list) {
			cnt += calc2Pow(a);
		}

		System.out.println(cnt);

	}

	private static int calc2Pow(int a) {
		int cnt = 0;
		while (a % 2 == 0) {
			a /= 2;
			cnt++;
		}
		return cnt;
	}
}

Measured memory_bytes: 34208
import bisect,collections,copy,heapq,itertools,math,string
from collections import defaultdict as D
from functools import reduce
import numpy as np
import sys
import os
from operator import mul

sys.setrecursionlimit(10**7)

def _S(): return sys.stdin.readline().rstrip()
def I(): return int(_S())
def LS(): return list(_S().split())
def LI(): return list(map(int,LS()))

if os.getenv("LOCAL"):
    inputFile = basename_without_ext = os.path.splitext(os.path.basename(__file__))[0]+'.txt'
    sys.stdin = open(inputFile, "r")
INF = float("inf")
IINF = 10 ** 18
MOD = 10 ** 9 + 7
# MOD = 998244353    

N = I()
H = LI()

# 短調非減少 H[i] <= H[i+1]
# 隣接要素を比較して大きかったら、必ず-1しておく
H[0]-=1
for i in range(N-1):
  if H[i] < H[i+1]:
    H[i+1] -= 1
  elif H[i] > H[i+1]:
    print("No")
    exit()
print("Yes")



# if N ==1:
#     print('Yes')
#     exit()
# ans = True
# for i in range(N-1):
#     if H[i] <= H[i+1]:
#         # print(i,'1')
#         continue
#     elif (not i==0) and H[i]-1 == H[i+1]:
#         if not H[i-1] == H[i]:
#             H[i] -= 1
#             # print(i,'2')
#             continue
#     # print(i,'3')
#     ans = False
#     break

# if ans:
#     print('Yes')
# else:
#     print('No')

Measured memory_bytes: 38300
#include <math.h>
#include <algorithm>
#include <iostream>
#include <map>
#include <ostream>
#include <tuple>
#include <vector>
using namespace std;

typedef long long ll;
typedef unsigned long long ull;

typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

typedef int _lcint;
#define REP(i, n) for (_lcint i = 0; i < n; i++)
#define FOR(i, a, b) for (_lcint i = (_lcint)(a); i < (_lcint)(b); i++)
#define FORREV(i, a, b) for (_lcint i = (_lcint)(b)-1; i >= (_lcint)(a); i--)
#define DEBUG(x) cout << #x << ": " << x << endl;
#define DEBUG_VEC(v)  \
  cout << #v << ": "; \
  REP(i, v.size()) cout << " " << v[i] << endl;

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

// permutation
ll mPn(ll m, ll n) {
  ll a = 1;
  REP(i, n) { a *= m - i; }
  return a;
}

// excrametion
ll exc(ll m) {
  ll a = 1;
  FOR(i, 1, m) { a *= i + 1; }
  return a;
}

// combination
ll mCn(ll m, ll n) {
  ll a = 1, b = 1;
  REP(i, n) {
    a *= m - i;
    b *= n - i;
  }
  return a / b;
}

int main() {
  int N;
  int M;
  int count = 1;
  cin >> N;

  int H[N];
  REP(i, N) cin >> H[i];

  FOR(i, 1, N) {
    bool max = true;
    FORREV(j, 0, i) {
      if (H[j] > H[i]) {
        max = false;
      }
    }

    if (max) {
      count++;
    }
  }

  cout << count << endl;

  return 0;
}


Measured memory_bytes: 888
n, x, y = [int(i) for i in input().split()]

juli = dict()
for i in range(1, n + 1):
    juli[i] = dict()
    for j in range(1, n + 1):
        juli[i][j] = 5000

for i in range(1, n + 1):
    juli[i][i] = 0

for i in range(1, n):
    juli[i][i + 1] = 1
    juli[i + 1][i] = 1

juli[x][y] = 1
juli[y][x] = 1


for i in range(1, x + 1):
    for j in range(i, x + 1):
        juli[i][j] = j - i

for i in range(y, n + 1):
    for j in range(i, n + 1):
        juli[i][j] = j - i

for i in range(x, y + 1):
    for j in range(i, y + 1):
        juli[i][j] = min(j - i, i - x + 1 + y - j)

for i in range(1, x + 1):
    for j in range(y, n + 1):
        juli[i][j] = j - i - (y - x) + 1

for i in range(1, x):
    for j in range(x + 1, y + 1):
        juli[i][j] = min(x - i + (y - j) + 1, j - i)

for i in range(x, y):
    for j in range(y, n + 1):
        juli[i][j] = min(j - y + (i - x) + 1, j - i)

table = dict()
for i in range(0, n + 1):
    table[i] = 0

for i in range(1, n + 1):
    for j in range(i, n + 1):
        table[juli[i][j]] += 1

for i in range(1, n):
    print(table[i])


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

int main(){
int n;
int A=0,B=0;
  cin>>n;
  vector<int> a(n);
  for(int i=0; i<n; i++)cin>>a[i];
  sort(a.begin(),a.end());
  reverse(a.begin(),a.end());
    for(int i=0; i<n; i++){
  if(i%2==0) A += a[i];
  if(i%2!=0) B += a[i];
  }
  cout<<A-B<<endl;
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
void convert(int x, int p){
    if ( p == 12 ) return;
    convert(x/2, p+1);
    if ( p == 3 ) cout << ".";
    cout << x%2;
}
int main(){
    for ( double x; cin >> x && x >= 0; ){
        int shift = (int)(x*16);
        if ( x == shift/16.0 && shift < 4096 ){
            convert(shift, 0);
            cout << endl;
        } else {
            cout << "NA" << endl;
        }
    }
    return 0;
}

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

#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define all(x) (x).begin(),(x).end()
using ll = long long;
string char_to_string(char val) {
  return string(1, val);
}
int char_to_int(char val) {
  return val - '0';
}
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 N;
void dfs(ll cur, int use, ll &counter) {
  if(cur > N) return; // 終了条件
  if(use == 0b111) {
    // cout << cur << endl;
    ++counter; // 7, 5, 3のうち、それまでどれを含めたか?
  }

  dfs(cur * 10 + 7, use | 0b001, counter);
  dfs(cur * 10 + 5, use | 0b010, counter);
  dfs(cur * 10 + 3, use | 0b100, counter);
}

int main() {
  cin >> N;
  ll res = 0;
  dfs(0, 0, res);
  cout << res << endl;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = Integer.parseInt(sc.next());
		int K = Integer.parseInt(sc.next());
		int[] x = new int[N];
		for(int i =0; i < N; i++) {
			x[i] = Integer.parseInt(sc.next());
		}

		int total = 0;
		for(int i = 0; i < x.length; i++) {
			if(x[i] < Math.abs(x[i]-K)) {
				total += x[i]*2;
			}else {
				total += Math.abs(x[i]-K)*2;
			}
		}
		System.out.println(total);

		sc.close();
	}

}


Measured memory_bytes: 21204
#include<bits/stdc++.h>
using namespace std;
int n,a[200003];
bool cmp(int x,int y){return x>y;}
int main(){
	cin>>n;for(int i=0;i<n;i++)scanf("%d",a+i);
	sort(a,a+n,cmp);long long ans=a[0];
	int tmp=n-2;
	for(int i=1;i<n;i++)
		ans+=min(2,tmp)*a[i],
		tmp=max(tmp-2,0);
	cout<<ans;
}

Measured memory_bytes: 4540
n = int(input())
T = []
for i in range(n):
    T.append(int(input()))

T = sorted(T)
def gcd(a, b):
    while b > 0:
        t = a
        a = b
        b = t%b
    return(a)

def lcm(a, b):
    return(int(a / int(gcd(a, b))) * b)

LCM = T[0]
for i in range(n-1):
    LCM = lcm(LCM, T[i+1])

print(LCM)


Measured memory_bytes: 3064
def divisor(n):
    limit = int(n**0.5 + 1)
    divisors = set()
    for div in range(1, limit):
        if n % div == 0:
            div2 = n//div
            divisors.add(div)
            divisors.add(div2)
    return len(divisors)


n = int(input())
ans = 0

for num in range(105, n+1, 2):
    if divisor(num) == 8:
        ans += 1

print(ans)


Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define repr(i, n) for (int i = (n) - 1; i >= 0; i--)
#define range(a) a.begin(), a.end()

ll dp[50][5050];

bool chmin(ll &x, ll y) {
  if (x > y) {
    x = y;
    return true;
  }
  return false;
}

struct edge {
  int v;
  ll a, b;
};

template<class T>
using heap = priority_queue<T, vector<T>, greater<T>>;

int main() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(15);
  int N, M, S; cin >> N >> M >> S;
  vector<vector<ll>> dp(N, vector<ll>(5050, LLONG_MAX));
  vector<vector<edge>> G(N);
  rep(_, M) {
    int u, v, a, b; cin >> u >> v >> a >> b; u--; v--;
    G[u].push_back((edge){v, a, b});
    G[v].push_back((edge){u, a, b});
  }
  vector<ll> C(N), D(N);
  rep(i, N) cin >> C[i] >> D[i];
  heap<tuple<ll, int, int>> hp;
  auto ins = [&](int u, int x, ll d) {
    if (chmin(dp[u][x], d)) {
      hp.emplace(d, u, x);
    }
  };
  ins(0, min(S, 5040), 0);
  while (not hp.empty()) {
    ll d;
    int u, x;
    tie(d, u, x) = hp.top(); hp.pop();
    if (dp[u][x] < d) continue;
    ins(u, min(5040LL, x + C[u]), dp[u][x] + D[u]);
    for (edge e : G[u]) {
      if (x >= e.a) {
        ins(e.v, x - e.a, dp[u][x] + e.b);
      }
    }
  }
  for (int i = 1; i < N; i++) {
    ll ans = LLONG_MAX;
    rep(j, 5050) {
      chmin(ans, dp[i][j]);
    }
    cout << ans << '\n';
  }
}

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

int main() {
  int A, B, K;
  cin >> A >> B >> K;
  int ans = 101, cnt = 0;
  while (cnt != K) {
    ans--;
    if (A % ans == 0 && B % ans == 0) {
      cnt++;
    }
  }
  cout << ans;
  return 0;
}

Measured memory_bytes: 256
import java.util.*;

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

        while(true){
            String s = sc.nextLine();
            if(s.equals(".")) break;

            s = s.replaceAll("[A-Za-z \\.]", "");

            while(true){
                String before = s;
                String after = s.replaceAll("\\[\\]", "");
                after = after.replaceAll("\\(\\)", "");

                if(before.length() == after.length()){
                    break;
                }

                s = after;
            }

            if(s.length() != 0){
                System.out.println("no");
            }
            else{
                System.out.println("yes");
            }
        }
    }
}

Measured memory_bytes: 13000
from collections import deque
S = deque(input())
Q = int(input())
Query = [[] for _ in range(Q)]
for i in range(Q):
    Query[i] = list(map(str,input().split()))

fl = False
for q in Query:
    if q[0]=='1':
        fl = not fl
    else:#q[0]=='2'
        if (q[1]=='1') ^ fl:
            S.appendleft(q[2])
        else:#q[1]=='2'
            S.append(q[2])
T = ''.join(S)
if fl:
    T = T[::-1]
print(T)

Measured memory_bytes: 44568
#include<bits/stdc++.h>
#define REP(i,n) for(int i = 0;i < (n);i++)
#define P pair<int,int>
#define pb push_back
#define mk make_pair
using namespace std;
const int INF = 1e9;

typedef long long ll;

#define MAX_V 200001

struct edge {
    int to;
    int cost;
};


int V;
vector<edge> G[MAX_V];
int d[MAX_V];


void dijkstra(int s) {
    priority_queue<P, vector<P>, greater<P> > que;
    fill(d, d+V, INF);
    d[s] = 0;
    que.push(P(0, s));

    while (!que.empty()) {
        P p = que.top();
        que.pop();
        int v = p.second;
        if (d[v] < p.first) continue;

        for (int i=0; i<G[v].size(); ++i) {
            edge e = G[v][i];
            if (d[e.to] > d[v] + e.cost) {
                d[e.to] = d[v] + e.cost;
                que.push(P(d[e.to], e.to));
            }
        }
    }
}



int main(){
  int E,r;
  cin >> V >> E;
  REP(i,E){
    int f,t,c;
    cin >> f >> t;
    c = 1;
    f--;
    t--;
    edge e = {t,c};
    G[f].pb(e);
    e.to = f;
    G[t].pb(e);
  }

  dijkstra(0);
  if(d[V-1] == 2)
    cout <<  "POSSIBLE" << endl;
  else
    cout << "IMPOSSIBLE" << endl;
  return 0;
}


Measured memory_bytes: 15080
#include <bits/stdc++.h>
using namespace std;
int main(){
  int N,M;
  cin>>N>>M;
  int a[M],b[M];
  for(int i=0;i<M;i++){
    cin>>a[i]>>b[i];
  }
  int S[N];
  for(int i=0;i<N;i++){
    S[i]=0;
  }
  for(int i=0;i<M;i++){
    for(int j=0;j<N;j++){
      if(a[i]==j+1)
        S[j]++;
      if(b[i]==j+1)
        S[j]++;
    }
  }
  for(int i=0;i<N;i++){
    cout<<S[i]<<endl;
  }
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <utility>
#include <stack>
#include <numeric>
#include <algorithm>
#include <tuple>
#include <stdio.h>
#include <bitset>
#include <limits.h>
#include <complex>
#include <deque>
#include <iomanip>
using namespace std;
#define pi pair<int32,int32>
#define pl pair<int64,int64>
#define chmax(a,b) (a<b ? a=b:0)
#define chmin(a,b) (a>b ? a=b:0)
#define en cout << endl //セミコロンつけろ
//#define MM 1000000000
//#define MOD MM+7
const int MM = 1e9;
const int MOD = MM+7;
const long double PI = acos(-1);
const long long INF = 1e15;
int dx[8] = {-1,0,1,0,-1,-1,1,1};
int dy[8] = {0,-1,0,1,-1,1,1,-1};
// 'A' = 65, 'Z' = 90, 'a' = 97, 'z' = 122
// cout << fixed << setprecision(10);
template<typename T>
T GCD(T u,T v){
    return v ? GCD(v,u%v) : u;
}
template<typename T>
T LCM(T x,T y){
    T gc = GCD(x,y);
    return x*y/gc;
}

long long F(long long b){
    if (b % 4 == 0) return b;
    if (b % 4 == 1) return 1;
    if (b % 4 == 2) return b+1;
    return 0;
}
int main(){
    long long A,B; cin >> A >> B;
    cout << (F(B)^F(A-1)) << endl;
} 

Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
const int INF = (1<<30);
const ll INFLL = (1ll<<60);
const ll MOD = (ll)(1e9+7);

#define l_ength size

void mul_mod(ll& a, ll b){
	a *= b;
	a %= MOD;
}

void add_mod(ll& a, ll b){
	a = (a<MOD)?a:(a-MOD);
	b = (b<MOD)?b:(b-MOD);
	a += b;
	a = (a<MOD)?a:(a-MOD);
}

int a[5555],b[5555];
ll d[2525],c[5555];

int main(void){
	int n,m,i,cnt=0,j;
	bool update,loop;
	ll p,ans;
	fill(d,d+2525,INFLL);
	d[1] = 0ll;
	cin >> n >> m >> p;
	for(i=0; i<m; ++i){
		cin >> a[i] >> b[i] >> c[i];
		c[i] = p - c[i];
	}
	while(true){
		update = false;
		for(i=0; i<m; ++i){
			if(d[b[i]]>d[a[i]]+c[i]){
				update = true;
				d[b[i]] = d[a[i]]+c[i];
			}
		}
		if(!update){
			loop = true;
			break;
		}
		if(cnt > n){
			break;
		}
		++cnt;
	}
	ans = d[n];
	for(j=0; j<n; ++j){
		for(i=0; i<m; ++i){
			if(d[b[i]]>d[a[i]]+c[i]){
				d[b[i]] = d[a[i]]+c[i];
			}
		}
	}
	if(ans != d[n]){
		cout << -1 << endl;
		return 0;
	}
	cout << max(-ans,0ll) << endl;
	return 0;
}


Measured memory_bytes: 384
#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;
        int sum = 0;
        for(int i = 1; i <= n; i++){
            if(i % 5 and i % 3){
                sum += i;
            }
        }
        cout << sum << '\n';
    }
}

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

int main(){
    int N;
    int flag = 0;
    string sent[100];
    cin >> N;

    for (int i = 0; i < N ; i++) {
        cin >> sent[i];
    }
    for (int i = 1; i < N ; i++){
        int ssize = sent[i-1].size();
        if(sent[i-1][ssize-1] != sent[i][0]){
            flag = 1;
        }
    }
    sort(sent, sent+N);
    for (int i = 1; i < N;i++){
        if(sent[i-1] == sent[i]){
            flag = 1;
        }
    }
    if (flag == 1){
        cout << "No" << endl;
    } else {
        cout << "Yes" << endl;
    }

   
} 

Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#include <limits.h>
 
struct edge_t {
    int from;
    int to;
    int cost;
};
typedef struct edge_t Edge;
 
int main(void) {
    int num, i, k, from, to, cost, update, nedge = 0;
    int dis[10000];
    Edge *edges, *p;
 
    edges = malloc(sizeof(Edge)*500000);
 
    scanf("%d", &num);
 
    for (i = 0; i < num; i++) {
        scanf("%d %d", &from, &k);
 
        while (k--) {
            scanf("%d %d", &to, &cost);
 
            p = &edges[nedge++];
            p->from = from;
            p->to = to;
            p->cost = cost;
        }
 
        dis[i] = INT_MAX;
    }
    dis[0] = 0;
 
    update = 1;
    while (update) {
        update = 0;
        for (i = 0; i < nedge; i++) {
            from = edges[i].from;
            to = edges[i].to;
            cost = edges[i].cost;
            if (dis[from] < INT_MAX && dis[to] > cost + dis[from]) {
                dis[to] = cost + dis[from];
                update = 1;
            }
        }
    }
 
    for (i = 0; i < num; i++) {
        printf("%d %d\n", i, dis[i]);
    }
    return 0;
}



Measured memory_bytes: 7520
#include <bits/stdc++.h>
using namespace std;
#define IOS ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define rep(i,n) for(ll i=0;i<n;i++)
#define rep1(i,n) for(ll i=1;i<=n;i++)
#define rep_start(a,i,n) for(ll i=a;i<=n;i++)
#define rev(i,n) for(ll i=n-1;i>=0;i--)
#define rev1(i,n) for(ll i=n;i>0;i--)
#define sz(a) int((a).size())
#define all(c) c.begin(),c.end()
#define tr(c,i) for(typeof(c).begin() i+=c.begin; i!=c.end(); i++)
#define present(c,x) (c.find(x)!=c.end())
#define cpresent(c,x) (find(all(c),x)!=c.end())
#define pb push_back
#define F first
#define S second
#define INF INT_MAX
#define mod 1000000007
#define print1(a) cout<<a<<"\n";
#define print2(a,b) cout<<a<<" "<<b<<"\n";
#define print3(a,b,c) cout<<a<<" "<<b<<" "<<c<<"\n";
#define mt make_tuple
#define eb emplace_back

typedef long long int ll;
typedef vector<ll> vi;
typedef vector<bool> vb;
typedef vector<vb> vvb;
typedef vector<vi> vvi;
typedef pair<ll,ll> ii;
typedef vector<ii> vii;
typedef tuple<int,int,int> State;

void solve(){
    int x,n,tmp;cin>>x>>n;
    map<int,int> m;
    rep(i,n) {cin>>tmp;m[tmp]++;}
    int c1=x,c2=x;
    while(true){
        if(m[c1]==0) {cout<<c1;return;}
        if(m[c2]==0) {cout<<c2;return;}
        c1--;c2++;
    }
}

signed main() {
    // your code goes here
    IOS
    ll t=1;
    //cin>>t;
    rep1(i,t){
        solve(); 
    }
    return 0;
}

Measured memory_bytes: 3656
#include <iostream>

using namespace std;

int main()
{
   string a,b,c;
   cin>>a ;
   cin>>b ;
   cin>>c ;

   if(a[a.length()-1] == b[0] && b[b.length() -1] == c[0])
    cout<<"YES\n";
   else
    cout<<"NO\n";
    return 0;
}


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

#include <iostream>
#include<vector>
using namespace std;

int main() {
	int n;cin>>n;
	vector<pair<int,int>> p;
	for(int i=2;i<=n;i++){
		int num=i;
		for(auto& x:p){
			while(num%x.first==0){
				x.second++;
				num/=x.first;
			}
		}
		if(num==i){
			p.push_back(make_pair(i,1));
		}
	}
//	for(auto x:p){
//		cout<<x.first<<' '<<x.second<<endl;
//	}
	int pn2=0;
	int pn4=0;
	int pn14=0;
	int pn24=0;
	int pn74=0;
	for(auto x:p){
		if(x.second>=2){
			pn2++;
		}
		if(x.second>=4){
			pn4++;
		}
		if(x.second>=14){
			pn14++;
		}
		if(x.second>=24){
			pn24++;
		}
		if(x.second>=74){
			pn74++;
		}
	}
	int ans=0;
	if(pn24>=1){
		ans+=pn24*(pn2-1);
	}
	if(pn14>=1){
		ans+=pn14*(pn4-1);
	}
	if(pn4>=2){
		ans+=pn4*(pn4-1)/2*(pn2-2);
	}
	ans+=pn74;
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 256
def main():
    L, R = map(int, input().split())
    # 60 の相異なる素因数は 3, 673 の 2つ
    if L + 672 <= R:
        print(0)
        return
    elif R % 673 < L % 673 and L + 2 <= R:
        print(0)
        return
    print(min(i * j % 2019 for i in range(L, R + 1)
              for j in range(i + 1, R + 1)))
    return


main()


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

using namespace std;

const int Mod = 1e9 + 7, Nmax = 2e5+5;

int n, i, ans = 0, start, dp[Nmax], Max, Min, sum, Left[Nmax], Right[Nmax];

void aduna(int &x, int y)
{
    x += y;
    if(x>=Mod) x -= Mod;
}

void scade(int &x, int y)
{
    x -= y;
    if(x<0) x += Mod;
}

struct aoki
{
    int x, v;
} a[Nmax];

bool cmp1(const aoki &a, const aoki &b) { return a.v < b.v; }
bool cmp2(const aoki &a, const aoki &b) { return a.x < b.x; }

int main()
{
    //freopen("input", "r", stdin);
    cin.sync_with_stdio(false);

    cin >> n;
    for(i=1; i<=n; ++i)
        cin >> a[i].x >> a[i].v;

    sort(a+1, a+n+1, cmp1);

    for(i=1; i<=n; ++i) a[i].v = i;
    sort(a+1, a+n+1, cmp2);

    Max = 0;
    for(i=1; i<=n; ++i)
    {
        Max = max(Max, a[i].v);
        Right[i] = Max;
    }

    Min = n;
    for(i=n; i; --i)
    {
        Min = min(Min, a[i].v);
        Left[i] = Min;
    }

    start = 0; sum = dp[0] = 1;

    for(i=1; i<=n; ++i)
    {
        while(Right[start]+1 < Left[i]) scade(sum, dp[start++]);
        dp[i] = sum;
        sum = sum*2 % Mod;

        if(Right[i] == n) aduna(ans, dp[i]);
    }

    cout << ans << '\n';

    return 0;
}


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

using namespace std;

const int mod = 1e9 + 7;

vector<int> dzielniki_n;

map<int, int> palin;

int pot(long long x, long long y){
    long long wyn = 1;
    while (y){
        if (y % 2)
            wyn = (wyn * x) % mod;
        y /= 2;
        x = (x * x) % mod;
    }
    return wyn;
}

int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int n, k;
    long long wynik = 0;
    cin >> n >> k;
    for (int i = 1; i * i <= n; i++)
        if (n % i == 0){
            dzielniki_n.push_back(i);
            if (i * i < n)
                dzielniki_n.push_back(n / i);
        }
    sort(dzielniki_n.begin(), dzielniki_n.end());
    for (int i : dzielniki_n){
        int pom = pot(k, (i + 1) / 2);
        for (int j = 0; dzielniki_n[j] < i; j++)
            if (!(i % dzielniki_n[j])){
                pom -= palin[dzielniki_n[j]];
                if (pom < 0)
                    pom += mod;
            }
        palin[i] = pom;
        if (i % 2)
            wynik = (wynik + ((long long)pom * i) % mod) % mod;
        else
            wynik = (wynik + ((long long)pom * i / 2) % mod) % mod;
    }
    cout << wynik << "\n";
    return 0;
}

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

int main(){
    int n;
    cin >> n;
    int prev_t,prev_x,prev_y;
    int curr_t,curr_x,curr_y;
    cin >> prev_t >> prev_x >> prev_y;
    if(n==1){
		if((prev_t >= (abs(prev_x)+abs(prev_y))) && 
			(abs((prev_x + prev_y)%2) == (prev_t)%2)){ cout << "Yes"; return 0;}
		else { cout << "No"; return 0;}
	}
    while(--n){
		//cout << "HERE" << endl;
		cin >> curr_t >> curr_x >> curr_y;
		if((curr_t-prev_t >= (abs(curr_x-prev_x)+abs(curr_y-prev_y))) && 
			(abs((curr_x + curr_y)%2 - (prev_x + prev_y)%2) == (curr_t-prev_t)%2));
		else { cout << "No"; return 0;}
		prev_t = curr_t;
		prev_x = curr_x;
		prev_y = curr_y;
	}
	cout << "Yes";
		
			
}


Measured memory_bytes: 256
H, W = map(int, input().split())
S = []
for _ in range(H):
    s = list(input())
    S.append(s)
    
cnt = [[0]*W for _ in range(H)]

for h in range(H):
    c = 0
    for w in range(W):
        if S[h][w] == "#":
            c += 1
        else:
            if c == 1:
                cnt[h][w-1] = 1
            c = 0
    if c == 1:
        cnt[h][w] = 1

ans = "Yes"
for w in range(W):
    c = 0
    for h in range(H):
        if S[h][w] == "#":
            c += 1
        else:
            if c == 1:
                if cnt[h-1][w] == 1:
                    ans = "No"
                    break
            c = 0
    if c == 1:
        if cnt[h][w] == 1:
            ans = "No"
            break
            
print(ans)

Measured memory_bytes: 9256
//marico el que lo lea
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <stdlib.h>
#include <assert.h>
using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef pair<int, int> ii;

void fastIO() {
	std::ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
}

#define FOR(i,f,t) for(int i=f; i<(int)t; i++)
#define FORR(i,f,t) for(int i=f; i>(int)t; i--)
#define FORE(i,c) for(auto i = (c).begin(); i != (c).end(); i++)
#define pb push_back
#define all(obj) obj.begin(), obj.end()
#define ms(obj, val) memset(obj, val, sizeof(obj))
#define ms2(obj, val, sz) memset(obj, val, sizeof(obj[0])*sz)

#define fst first
#define snd second

template<typename T, typename U> inline void mnze(T &x, U y) { if(y < x) x = y; }
template<typename T, typename U> inline void mxze(T &x, U y) { if(x < y) x = y; }

void _scan( int &x ) { scanf("%d",&x); }
void _scan( long long &x ) { scanf("%lld",&x); }
void _scan( double &x ) { scanf("%lf",&x); }
void _scan( char &x ) { scanf(" %c",&x); }
void _scan( char *x ) { scanf("%s",x); }
void scan() {}
template<typename T, typename... U>
void scan( T& head, U&... tail ) { _scan(head); scan(tail...);}

template<typename T> void _dbg(const char* sdbg, T h) { cerr<<sdbg<<"="<<h<<"\n"; }
template<typename T, typename... U> void _dbg(const char* sdbg, T h, U... t) {
	while(*sdbg != ',')cerr<<*sdbg++; cerr<<"="<<h<<","; _dbg(sdbg+1, t...);
}

#ifdef LOCAL
#define debug(...) _dbg(#__VA_ARGS__, __VA_ARGS__)
#define debugv(x) {{cerr <<#x <<" = "; FORE(_i, (x)) cerr <<*_i <<", "; cerr <<"\n"; }}
#define debuga(x, sz) {{cerr <<#x <<" = "; FOR(_i, 0, sz) cerr << x[_i] <<", "; cerr <<"\n"; }}
#else
#define debug(...) (__VA_ARGS__)
#define debugv(x)
#define debuga(x, sz)
#define cerr if(0)cout
#endif

///////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////

const int MAXN = 1e5+5;

int N, M, Q;
vi G[MAXN];
bool vis[MAXN][11];
int col[MAXN];

int C[MAXN], V[MAXN], D[MAXN];

void bfs(int v, int d, int c){
    if(vis[v][d]) return;
    queue<ii> q;
    q.push({v,d});
    FOR(dd,0,d+1) vis[v][dd]=true;
    while(!q.empty()){
        int v=q.front().fst, dd=q.front().snd; q.pop();
        if(col[v]==-1) col[v]=c;
        int du = dd-1;
        //debug(v,dd);
        if(du==-1) continue;
        for(int u : G[v]){
            if(!vis[u][du]){
                q.push({u,du});
                FOR(i,0,du+1) vis[u][i]=true;
            }
        }
    }
}

int main(){
    scan(N,M);
    FOR(i,0,M){
        int v,u; scan(v,u); v--; u--;
        G[v].pb(u);
        G[u].pb(v);
    }
    ms(col,-1);
    scan(Q);
    FOR(i,0,Q){
        scan(V[i],D[i],C[i]);
        V[i]--;
    }
    FORR(i,Q-1,-1){
        bfs(V[i],D[i],C[i]);
    }
    FOR(i,0,N) printf("%d\n",col[i]==-1 ? 0 : col[i]);
}


Measured memory_bytes: 9608
#include <iostream>
#include <vector>
#include <cmath>
#include <sstream>
#include <iomanip>
#include <algorithm>
#include <map>

using namespace std;

int main(int argc, const char * argv[]) {

    char a;
    cin >> a;
    
    if (a >= 'a' && a <= 'z') cout << "a" << endl;
    else if (a >= 'A' && a <= 'Z') cout << "A" << endl;

    return 0;
    
    
}


Measured memory_bytes: 3588
/*   _/                _/                 _/_/_/   _/
  _/_/_/_/   _/_/   _/_/_/_/   _/_/    _/       _/_/
   _/     _/    _/   _/     _/    _/  _/_/_/     _/
  _/     _/    _/   _/     _/    _/  _/    _/   _/
   _/_/   _/_/       _/_/   _/_/      _/_/     _/ */
#include<iostream>
#include<algorithm>
#include<cmath>
#include<iomanip>
#include<set>
#include<map>
#include<queue>
#include<vector>
using namespace std;
using ll=long long;
const int MOD=1e9+7;
const double pi=3.14159265358979323846;
const int inf=2e9;
const ll INF=1e18;
using P=pair<int,int>;
int dx[4]={1,0,-1,0},dy[4]={0,1,0,-1};
int main() {
  cin.tie(0),cout.tie(0);
  ios::sync_with_stdio(false);
  int n,x,y,dp[2005][2005]={},cnt[2005]={};
  cin >> n >> x >> y;
  for(int i=1; i<n; i++) {
    for(int j=i+1; j<=n; j++) {
      dp[i][j]=inf;
    }
  }
  for(int i=1; i<n; i++) {
    dp[i][i+1]=1;
  }
  dp[x][y]=1;
  for(int i=1; i<=n-1; i++) {
    for(int j=i+1; j<=n; j++) {
      dp[i][j]=min({j-i,abs(i-x)+abs(y-j)+1,dp[i][j]});
    }
  }
  for(int i=1; i<n; i++) {
    for(int j=i+1; j<=n; j++) {
      cnt[dp[i][j]]++;
    }
  }
  for(int i=1; i<=n-1; i++) {
    cout << cnt[i] << "\n";
  }
}

Measured memory_bytes: 16000
#include<bits/stdc++.h>
#define rep(i,n)for(int i=0;i<n;++i)
#include<string>
#include<vector>
using namespace std;
typedef long long 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; }
//max=({});
//条件式が真ならwhileの中身を回し続ける
//printf("%d\n", ans);

//pairの入力
//vector<pair<ll, ll>>work(n);
//rep(i, n) {
//	ll a, b;
//	cin >> a >> b;
//	work[i] = make_pair(a, b);
//}

int g[15][15];
const int INF = 1001001001;
const int dx[4] = { -1,0,1,0 };
const int dy[4] = { 0,-1,0,1 };

//最大公約数
ll gcd(ll x, ll y) {
	return y ? gcd(y, x % y) : x;
}

ll lcm(ll x, ll y) {
	if (x == 0 || y == 0)return 0;
	return (x / gcd(x, y) * y);
}

//素因数分解
vector<pair<ll, int>>factorize(ll n) {
	vector<pair<ll, int>>res;
	for (ll i = 2;i * i <= n;++i) {
		if (n % i)continue;
		res.emplace_back(i, 0);
		while (n % i == 0) {
			n /= i;
			res.back().second++;
		}
	}
	if (n != 1)res.emplace_back(n, 1);
	return res;
}

int dp[1010][1010];
int bingo[3][3];
bool flag[3][3];
int I[100][20];

int main() {
	int n;
	cin >> n;
	string s;
	cin >> s;
	vector<int>west(n);
	vector<int>east(n);
	if (s[0] == 'W')west[0]++;
	else east[0]++;
	for (int i = 1;i < n;++i) {
		east[i] = east[i - 1];
		west[i] = west[i - 1];
		if (s[i] == 'W') {
			west[i] ++;
		}
		else east[i]++;
	}
	int ans = min(east[n - 1] - east[0], west[n - 2]);
	for (int i = 1;i < n;++i) {
		int res = west[i - 1] + east[n - 1] - east[i];
		ans = min(ans, res);
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 3076