akhauriyash/Code-Regression huggingface dataset:
#include <algorithm>
#include <bitset>
#include <tuple>
#include <cstdint>
#include <cstdio>
#include <cctype>
#include <assert.h>
#include <stdlib.h>
#include <stdio.h>
#include <cassert>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <ctime>
#include <deque>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <list>
#include <limits>
#include <map>
#include <memory>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
using namespace std;
using ll=long long;
using ld=long double;
//#define int long long
//#define _CRT_SECURE_NO_WARNINGS
#define rep(i, n) for (int i = 0; i < n; i++)
#define _GLIBCXX_DEBUG
const int MOD = 1e9 + 7;
const int INF = 1e18 + 9;
constexpr long double pi = 3.141592653589793238462643383279;
int fact(int i) {
    if (i == 0) return 1;
    return (fact(i - 1)) * i;
}
int gcd(int a, int b) {
    if (b == 0) return a;
    return gcd(b, a % b);
}
int lcm(int a, int b) {
    return a * b / gcd(a, b);
}
int keta(int n) {
    if (n == 0) return 1;
    int count = 0;
    while (n != 0) {
        n /= 10;
        count++;
    }
    return count;
}
int ketasum(int n) {
    int sum = 0;
    while (n != 0) {
        sum += n % 10;
        n /= 10;
    }
    return sum;
}
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 a, b, c;
int main(void) {
    cin >> a >> b >> c;
    if (a == b) cout << c << endl;
    else if (a == c) cout << b << endl;
    else cout << a << endl;
    return 0;
}

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

public class Main {
  public static void main(String[] args) throws IOException {
    BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
    StringTokenizer st = new StringTokenizer(in.readLine());
    
    int fiveCount = 0;
    int sevenCount = 0;
    for (int i = 0; i < 3; i++) {
        int x = Integer.parseInt(st.nextToken());
        if (x == 5)
             fiveCount++;
        if (x == 7) 
             sevenCount++;
    }
    if (fiveCount == 2 && sevenCount == 1)
         System.out.println("YES");
    else 
         System.out.println("NO");
  }
}

Measured memory_bytes: 21204
#include<stdio.h>
int main(void) {
  int a,b,i;
  i=0;
  scanf("%d %d",&a,&b);
  while(a != 0 || b != 0){
    if(a>b) printf("%d %d\n",b,a);
    else printf("%d %d\n",a,b);
    scanf("%d %d",&a,&b);
  }
  return 0;
}

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

int main()
{
	string ori = "CODEFESTIVAL2016";
	string read;
	cin >>read;
	int ans = 0;
	for (int i = 0; i < ori.length(); ++i){
		if (ori[i] != read[i])
			ans++;
	}
	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
const int MAX = 700000;
const int MOD = 1000000007;

long long  fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit() {
	fac[0] = fac[1] = 1;
	finv[0] = finv[1] = 1;
	inv[1] = 1;
	for (int i = 2; i < MAX; i++) {
		fac[i] = fac[i - 1] * i % MOD;
		inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
		finv[i] = finv[i - 1] * inv[i] % MOD;
	}
}

// 二項係数計算
long long COM(int n, int k) {
	if (n < k) return 0;
	if (n < 0 || k < 0) return 0;
	return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
/*第二引数で第一引数を割ったときの切り上げの計算*/
long long int maxtime(long long int x, long long int y){
	return(x + y - 1) / y;

}
/*最大公約数*/
long long int lcm(long long int number1, long long int number2) {
	long long int m = number1;
	long long int n = number2;

	if (number2 > number1) {
		m = number2;
		n = number1;
	}
	long long int s = -1;
	while (s != 0) {
		s = m % n;
		m = n;
		n = s;
	}
	return m;
}
/*最大公倍数*/
long long int gcd(long long int number1, long long int number2) {
	long long int m = number1;
	long long int n = number2;
	return m / lcm(m, n) * n;
}
/*逆元計算*/
long long int  modinv(long long a, long long m) {
	long long int b = m, u = 1, v = 0;
	while (b) {
		long long int t = a / b;
		a -= t * b; swap(a, b);
		u -= t * v; swap(u, v);
	}
	u %= m;
	if (u < 0) u += m;
	return u;
}
// index が条件を満たすかどうか
vector<long long int >meguru;
bool isOK(int index, int key) {
	if (meguru[index] >= key) return true;
	else return false;
}
// 汎用的な二分探索のテンプレ
int binary_search(int key) {
	int left = -1; //「index = 0」が条件を満たすこともあるので、初期値は -1
	int right = (int)meguru.size(); // 「index = a.size()-1」が条件を満たさないこともあるので、初期値は a.size()
	/* どんな二分探索でもここの書き方を変えずにできる！ */
	while (right - left > 1) {
		int mid = left + (right - left) / 2;

		if (isOK(mid, key)) right = mid;
		else left = mid;
	}
	/* left は条件を満たさない最大の値、right は条件を満たす最小の値になっている */
	return right;
}
long long modpow(long long a, long long n, long long mod) {
	long long res = 1;
	while (n > 0) {
		if (n & 1) res = res * a % mod;
		a = a * a % mod;
		n >>= 1;
	}
	return res;
}
int dp[3000][3000] = {};
int main() {
	long long int x, y, a, b, c;
	cin >> x >> y >> a >> b >> c;
	vector<long long int >as;
	vector<long long int>bs;
	vector<long long int>cs;
	for (int i = 0; i < a; i++) {
		long long int in;
		cin >> in;
		as.push_back(in);
	}
	for (int i = 0; i < b; i++) {
		long long int in;
		cin >> in;
		bs.push_back(in);
	}
	for (int i = 0; i < c; i++) {
		long long int in;
		cin >> in;
		cs.push_back(in);
	}
	sort(as.begin(), as.end(),greater<long long int>());
	sort(bs.begin(), bs.end(),greater<long long int>());
	sort(cs.begin(), cs.end(),greater<long long int>());
	vector<long long int >s;
	for (int i = 0; i < x; i++) {
		s.push_back(as[i]);
	}
	for (int i = 0; i < y; i++) {
		s.push_back(bs[i]);
	}
	sort(s.begin(), s.end());
	long long int f = cs.size();
	f = min(f, x + y);
	for (long long int i = 0; i < f; i++) {
		if (cs[i] > s[i]) {
			s[i] = cs[i];
		}
	}
	long long int ans = 0;
	for (long long int i = 0; i < x + y; i++) {
		ans = ans + s[i];
	}
	cout << ans;
 }


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

typedef long long int ll;


int main()
{
	std::ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	
	
	string s;
	cin>>s;
	
	map <ll,ll> mp;
	vector <ll> left;
	vector <ll> right;
	for(ll i=0;i<s.size();i++)
	{
		if(s[i]=='L')
			left.push_back(i);
		else
			right.push_back(i);
	}
	
	for(ll i=0;i<left.size();i++)
	{
		auto it = lower_bound(right.begin(),right.end(),left[i])-right.begin();
		it--;
		ll dis = left[i]-right[it];
		//cout<<left[i]<<" "<<right[it]<<endl;
		if(dis%2==0)
		{
			mp[right[it]]++;
		}
		else{
			mp[right[it]+1]++;
		}
	}
	for(ll i=0;i<right.size();i++)
	{
		auto it = upper_bound(left.begin(),left.end(),right[i])-left.begin();
		ll dis = left[it]-right[i];
		//cout<<left[it]<<" "<<right[i]<<endl;
		if(dis%2==0)
		{
			mp[left[it]]++;
		}
		else{
			mp[left[it]-1]++;
		}
	}
	
	for(ll i=0;i<s.size();i++)
	{
		cout<<mp[i]<<" ";
	}cout<<endl;

	
}


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

using namespace std;

typedef long long ll;
typedef long double ld;
typedef unsigned int uint;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
typedef pair<int, int> ii;
typedef map<int, int> MPII;
typedef set<int> SETI;

const int mxN = 2e5;
const ld pi = 4.0 * atanl(1.0);
const int iinf = 1e9 + 10;
const int inf = 1e18 + iinf + 10;
const int mod = 1000000007;
const ld prec = .000001;

#define F first
#define S second
#define pb push_back
#define mp make_pair
#define all(c) c.begin(), c.end()
#define rall(c) c.end(), c.begin()

ll n, m, t, a[mxN];
vi v;

void fast() { ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0); }

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

  for (ll i = 0; i < n; ++i) cin >> a[i];
  ll ans = 1, p = a[0];
  for (ll i = 1; i < n; ++i) {
    p = min(p, a[i]);
    if (a[i] <= p) ++ans;
  }
  cout << ans;

  return 0;
}



Measured memory_bytes: 5088
#include<stdio.h>

int main(void){
	int h,w,i,j=0;
	while(1){
		scanf("%d %d",&h,&w);
		if((h==0)&&(w==0))break;
		for(j=0;j<h;j++){
		for(i=0;i<w;i++){
			printf("#");
		}
			printf("\n");
		}
		printf("\n");
	}
	return 0;
}


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

#define ALL(g) (g).begin(),(g).end()
#define REP(i, x, n) for(int i = x; i < n; i++)
#define rep(i,n) REP(i,0,n)
#define RREP(i, x, n) for(int i = x; i >= n; i--)
#define rrep(i, n) RREP(i,n,0)
#define pb push_back

using namespace std;

// #define DEBUG_IS_VALID

#ifdef DEBUG_IS_VALID
#define DEB 1 
#else
#define DEB 0
#endif
#define DUMPOUT cout
#define dump(...) if(DEB) DUMPOUT<<"  "<<#__VA_ARGS__<<" :["<<__LINE__<<":"<<__FUNCTION__<<"]"<<endl<<"    "; if(DEB) dump_func(__VA_ARGS__)
template<typename T>ostream& operator << (ostream& os, vector<T>& vec) { os << "{"; for (int i = 0; i<vec.size(); i++) os << vec[i] << (i + 1 == vec.size() ? "" : ", "); os << "}"; return os; }
void dump_func(){DUMPOUT << endl;}
template <class Head, class... Tail>void dump_func(Head&& head, Tail&&... tail){ DUMPOUT << head; if (sizeof...(Tail) == 0) { DUMPOUT << " "; } else { DUMPOUT << ", "; } dump_func(std::move(tail)...);}
template<class T> inline void chmax(T& a,T const& b){a=max(a,b);}
template<class T> inline void chmin(T& a,T const& b){a=min(a,b);}

using ll = long long;
using P = pair<int,int>;
using Pl = pair<ll,ll>;
using vi = vector<int>;
using vvi = vector<vi>;
using vl = vector<ll>;
using vvl = vector<vl>;

const int mod=1e9+7,INF=1<<30;
const double EPS=1e-12,PI=3.1415926535897932384626;
const ll lmod = 1e9+7,LINF=1LL<<60; 

bool used[100005];

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  int N,M; cin >> N >> M;
  vvi graph(N,vi(0));
  rep(i,M){
    int a,b; cin >> a >> b;
    a--; b--;
    graph[a].pb(b); graph[b].pb(a);
  }
  fill(used,used+N,false);
  deque<int> que;
  bool is_first = true;
  used[0] = true; used[graph[0][0]] = true;
  function<void(int)> go = [&](int u){
    used[u] = true;
    if(is_first) que.push_back(u);
    else que.push_front(u);
    for(auto v:graph[u]){
      if(!used[v]){
        go(v);
        break;
      }
    }
  };
  go(graph[0][0]);
  is_first = false;
  go(0);
  cout << que.size() << endl;
  rep(i,que.size()) cout << que[i]+1 << ( i!=que.size()-1 ? " ":"\n");
  return 0;
}


Measured memory_bytes: 12544
#dt = {} for i in x: dt[i] = dt.get(i,0)+1
import sys;input = sys.stdin.readline
inp,ip = lambda :int(input()),lambda :[int(w) for w in input().split()]

n = inp()
x = ip()
mx = 0
ans = 0
for i in x:
    mx = max(mx,i)
    ans += mx-i
print(ans)




Measured memory_bytes: 104916
process.stdin.resume();
process.stdin.setEncoding('utf8');

var g_input = '';
process.stdin.on('data', function(chunk) {
    g_input += chunk;
});

process.stdin.on('end', function() {
    Main(g_input.split(/\r?\n/));
});

function Main(input) {
    var n = parseInt(input[0], 10);
    var inputA = input[1].split(' ');
    var a = new Array(n);
    for (var i = 0; i < n; i++) {
        a[i] = parseInt(inputA[i], 10);
    }
    var ans = dfs(0, a);
    console.log(ans);

    return 0;
}

function dfs(i, a) {
    if (i >= a.length) {
        return 0;
    }
    var ans1 = 1;
    for (var j = i + 1; j < a.length; j++) {
        ans1 *= 3;
    }
    var ans2 = dfs(i + 1, a);
    var ans = 0;
    if (a[i] % 2 == 0) {
        ans = ans1 + 2 * ans2;
    }
    else {
        ans = 2 * ans1 + ans2;
    }
    return ans;
}


Measured memory_bytes: 22340
#include <bits/stdc++.h>
using namespace std;
 
int main() {
    int N,D,number;
    cin >> N >> D;
    
    int a = 2*D+1;

    if((N % a) == 0){
        number = N / a;
    }else{
        number = N / a + 1;
    }
    
    cout << number;
    return 0;
}

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

int main() {
	string s; cin >> s;
	int k; cin >> k;
	vector<string>dict;
	for (int i = 1; i <= k; i++) {		
		for (int j = 0; j + i - 1 < s.size(); j++) {			
			dict.push_back(s.substr(j, i));
		}
	}
	dict.push_back(s);
	sort(dict.begin(), dict.end());
	unique(dict.begin(), dict.end());
	cout << dict[k - 1] << endl;

	return 0;
}

Measured memory_bytes: 1660
#include <iostream>

using namespace std;

int main() {
  int n;
  int year, month, day;

  cin>>n;

  cin>>year>>month>>day;

  for(int i=0; i<n; i++) {
    int totalDays = 0;
    //cout<<year<<" "<<month<<" "<<day<<endl;
    for(int y=year; y<1000; y++) {
      for(int m=1; m<11; m++) {
	if(y == year && m==month) { // 誕生年の誕生月のみは判定が特殊
	  if(y%3==0 || m%2==1) {
	    totalDays += 20-day+1;
	  }
	  else {
	    totalDays += 19-day+1;
	  }
	}
	else if(y == year && m < month) {
	  totalDays += 0;
	}
        else if(y%3==0 || m%2==1) { // 年が3n あるいは 奇数月
	  totalDays += 20;
        }
        else {
	  totalDays += 19;
        }
      }
    }
    cout<<totalDays<<endl;

    if(i != n-1) {
      cin>>year>>month>>day;
    }
  }

}

Measured memory_bytes: 1160
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i = 0; i < (n); ++i)

int main() {
    int A,B,K,t,n;
    cin >> A >> B >> K;
    n = B-A+1;

    rep(i,min(n,K))
        cout << A+i << endl;
    t = A+min(n,K)-1;
    rep(i,K)
        if(B-K+1+i > t)
            cout << B-K+1+i << endl;
}

Measured memory_bytes: 256
// g++ -std=c++11 a.cpp
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>	
#include<map>
#include<set>
#include<unordered_map>
#include<utility>
#include<cmath>
#include<random>
#include<cstring>
#include<queue>
#include<stack>
#include<bitset>
#include<cstdio>
#include<sstream>
#include<iomanip>
#include<assert.h>
#include<typeinfo>
#define loop(i,a,b) for(int i=a;i<b;i++) 
#define rep(i,a) loop(i,0,a)
#define FOR(i,a) for(auto i:a)
#define pb push_back
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)
#define show1d(v) rep(i,v.size())cout<<" "<<v[i];cout<<endl<<endl;
#define show2d(v) rep(i,v.size()){rep(j,v[i].size())cout<<" "<<v[i][j];cout<<endl;}cout<<endl;
using namespace std;
//kaewasuretyuui
typedef long long ll;
//#define int ll
typedef int Def;
typedef pair<Def,Def> pii;
typedef vector<Def> vi;
typedef vector<vi> vvi;
typedef vector<pii> vp;
typedef vector<vp> vvp;
typedef vector<string> vs;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef pair<Def,pii> pip;
typedef vector<pip>vip;
// #define mt make_tuple
// typedef tuple<int,int,int> tp;
// typedef vector<tp> vt;
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;}
//template<class C>constexpr int size(const C &c){return (int)c.size();}
//template<class T,size_t N> constexpr int size(const T (&xs)[N])noexcept{return (int)N;}
const double PI=acos(-1);
const double EPS=1e-9;
Def inf = sizeof(Def) == sizeof(long long) ? 2e18 : 1e9+10;
int dx[]={0,1,0,-1,1,1,-1,-1};
int dy[]={1,0,-1,0,1,-1,1,-1};//RDLU
//nCr mod m
#define MOD 1000000007
#define M 1000000
vector<ll> fact;
bool h=false;
void init(){
	h=true;
	fact=vector<ll>(M);
	fact[0]=fact[1]=1;
	loop(i,2,M)fact[i]=fact[i-1]*i%MOD;
}
// a^b mod MOD
ll powmod(ll a,ll b,ll m=MOD){
	ll out=1;
	ll p=a%m;
	while(b){
		if(b&1)out=out*p%m;
		p=p*p%m;
		b>>=1;
	}
	return out;
}
//nCr
ll nCr(ll n,ll r,ll m=MOD){
	if(!h)init();
	if(n<0||r<0||n<r)return 1;//??????
	ll out=fact[n]*powmod(fact[r]*fact[n-r]%m,m-2,m)%m;
	return out;
}
//nHr
ll nHr(ll n,ll r){
	if(!r&&n!=r)return 0;
	if(!r)return 1;
	return nCr(n+r-1,r-1);
}
int main(){
	ll n,m;
	cin>>n>>m;
	ll out=1;
	for(ll i=2;i<100000;i++){
		int c=0;
		while(m%i==0){
			c++;
			m/=i;
		}
		(out*=nHr(c,n))%=MOD;
	}
	if(m-1)(out*=nHr(1,n))%=MOD;
	cout<<out<<endl;
}









Measured memory_bytes: 8064
#!/usr/bin/env python3

def main():
    N, M = map(int, input().split())
    *H, = map(int, input().split())
    L = []
    for _ in range(M):
        A, B = map(int, input().split())
        if H[A - 1] < H[B -1]:
            L.append(A)
        elif H[A - 1] > H[B - 1]:
            L.append(B)
        elif H[A - 1] == H[B - 1]:
            L.append(A)
            L.append(B)
    print(N - len(list(set(L))))


main()

Measured memory_bytes: 20008
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <math.h>
using namespace std;

int main(){
  int n;
  cin>>n;
  int a[n];
  for(int i=0;i<n;i++) cin>>a[i];
  if(n==2){
    if(a[0]<a[1]) swap(a[0],a[1]);
    cout<<a[0]<<" "<<a[n-1]<<endl;
    return 0;
  }
  sort(a,a+n);
  int z;
  z=lower_bound(a,a+n,a[n-1]/2)-a;
  if(z==0){
    cout<<a[0]<<" "<<a[n-1]<<endl;
  }else{
    if((a[n-1]/2)-a[z-1]<a[z]-(a[n-1]/2)){
      cout<<a[n-1]<<" "<<a[z-1]<<endl;
    }else{
      cout<<a[n-1]<<" "<<a[z]<<endl;
    }
  }
  return 0;
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef vector<ll> vl;
typedef pair<ll, ll> PP;
#define rep(i, n) for(ll i = 0; i < ll(n); i++)
#define all(v) v.begin(), v.end()
bool chmin(ll & a, ll  b) { if (b < a) { a = b; return 1; } return 0; }
bool chmax(ll & a, ll b) { if (b > a) { a = b; return 1; } return 0; }
const ll INF = 999999999999999;
const ll MOD = 1000000007;
const ll MAX_N=500010;
struct union_find {
	ll par[MAX_N];
	ll Size[MAX_N];
	union_find(ll n) {
		for (int i = 0; i < n; i++) {
			par[i] = i;
			Size[i] = 1;
		}
	}
	ll root(ll x) {
		if (par[x] == x)return x;
		return par[x] = root(par[x]);
	}
	bool same(ll x, ll y) {
		return root(x) == root(y);
	}
	void unite(ll x, ll y) {
		if (same(x, y))return;
		Size[root(x)] += Size[root(y)];
		par[root(y)] = root(x);
	}
};
ll a, b, c, d, e, f, p, t, x, y, z, q, m, n, r, h, k, w, l, ans;
int main() {
    cin >> n>>m>>k;
    union_find U(n);
	vl X,Y;
		rep(i,m){
		cin>>x>>y;
		x--;
		y--;
		U.unite(x,y);
		X.push_back(x);
		Y.push_back(y);

	}

	vl A;
	rep(i,n){
		A.push_back(U.Size[U.root(i)]);
	}

	rep(i,m){
		if(U.same(X[i],Y[i])){
			A[X[i]]--;
			A[Y[i]]--;
		}
	}

	rep(i,k){
		cin>>x>>y;
		x--;
		y--;
		if(U.same(x,y)){
			A[x]--;
			A[y]--;
		}
	}

	rep(i,n){
		cout<<A[i]-1<<" ";
	}
}

Measured memory_bytes: 9836
import java.util.Scanner;
class Main{
    int n,x,y,z;
    public void solve(){
        Scanner sc = new Scanner(System.in);
        n = sc.nextInt();
        for(x = 3; x <= n; x++){
            y = x;
            z = 0;

                if(y % 3 == 0){
                    System.out.printf(" %d",x);
                    z++;
                }else{
                    while(z == 0){
                        if(y % 10 == 3){
                            System.out.printf(" %d",x);
                            z++;
                        }
                        y /= 10;
                        if(y < 3){
                            z++;
                        }
                    }   
                }
        }
        System.out.println();
    }
    public static void main(String[] args){
        new Main().solve();
    }
}

Measured memory_bytes: 33808
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int L = sc.nextInt();
		int R = sc.nextInt();
		int d = sc.nextInt();
		int rt = 0;
		for(int i = L ; i <= R ; ++i){
			if(i % d == 0){
				++rt;
			}
		}
		System.out.println(rt);
	}
}


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

#define FOR(i,l,r) for(int i = int(l);i < int(r);i++)
template<typename T> bool chmax(T& a,const T& b){ return a < b ? (a = b,true) : false; }
template<typename T> bool chmin(T& a,const T& b){ return b < a ? (a = b,true) : false; }
typedef long long ll;

int N;

int main()
{
	scanf("%d",&N);
	int ans = 0;
	FOR(i,0,N){
		int l,r;
		scanf("%d%d",&l,&r);
		ans += r - l + 1;
	}
	printf("%d\n",ans);

	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
typedef pair<int, int> P;
ll Mod = 1000000007;
int N;
string S;

string Mena(string str) {
  string res = str;
  for (int i = 2; i < N; i++) {
    if ((S[i-1] == 'o' && res[i-1] == 'S') || (S[i-1] == 'x' && res[i-1] == 'W')) {
      res += res[i-2]; 
    } else {
      if (res[i-2] == 'W') {
        res += 'S';
      } else {
        res += 'W';
      }
    }
  }
  bool m = true;
  if ((S[N-1] == 'o' && res[N-1] == 'S') || (S[N-1] == 'x' && res[N-1] == 'W')) {
    if (res[N-2] != res[0]) {
      m = false;
    }
  } else {
    if (res[N-2] == res[0]) {
      m = false;
    }
  }
  if ((S[0] == 'o' && res[0] == 'S') || (S[0] == 'x' && res[0] == 'W')) {
    if (res[N-1] != res[1]) {
      m = false;
    }
  } else {
    if (res[N-1] == res[1]) {
      m = false;
    }
  }
  if (m) return res;
  else return "NG";
} 
int main() {
  cin >> N >> S;
  string cand[4];
  cand[0] = Mena("SS");
  cand[1] = Mena("SW");
  cand[2] = Mena("WS");
  cand[3] = Mena("WW");
  for (int i = 0; i < 4; i++) {
    if (cand[i] != "NG") {
      cout << cand[i] << endl;
      return 0;
    }
  }
  cout << -1 << endl;
  return 0; 
}

Measured memory_bytes: 3828
package main

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

type job struct {
        A, B int
}

type jobList []job

func (a jobList) Len() int      { return len(a) }
func (a jobList) Swap(i, j int) { a[i], a[j] = a[j], a[i] }
func (a jobList) Less(i, j int) bool {
        if a[i].B == a[j].B {
                return a[i].A < a[j].A
        }
        return a[i].B < a[j].B
}

var sc = NewScanner()

func main() {
        n := sc.NextInt()

        jobs := make(jobList, n)
        for i := 0; i < n; i++ {
                a := sc.NextInt()
                b := sc.NextInt()
                jobs[i] = job{a, b}
        }
        sort.Sort(jobs)

        var now int
        for _, job := range jobs {
                now += job.A
                if now > job.B {
                        fmt.Println("No")
                        return
                }
        }
        fmt.Println("Yes")
}

type Scanner struct {
        sc *bufio.Scanner
}

func NewScanner() *Scanner {
        sc := bufio.NewScanner(os.Stdin)
        sc.Split(bufio.ScanWords)
        return &Scanner{sc}
}

func (sc *Scanner) NextInt() int {
        sc.sc.Scan()
        i, err := strconv.Atoi(sc.sc.Text())
        if err != nil {
                panic(err)
        }
        return i
}

Measured memory_bytes: 6272
N = int(input())
a = list(map(int,input().split(' ')))

sum_a = sum(a)
b = sum_a/N
ans = 0
minimum = abs(b-a[0])
for i in range(1,N):
    if minimum > abs(b-a[i]):
        minimum = abs(b-a[i])
        ans = i

print(ans)


Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
int main()
{
    char a[4];
    for(int i=1;i<=4;i++)
    {
    	cin>>a[i];
	}
    if(a[2]==a[3])
    {
    	if(a[1]==a[2]||a[3]==a[4])
    	{
    		cout<<"Yes"<<endl;
    	}
    	else cout<<"No"<<endl;
    }
    else cout<<"No"<<endl;
    return 0;
} 

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define MOD 1000000007
#define ll long long
#define mp make_pair
#define pb push_back 
using namespace std;
int main(){
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	int s, w;
	cin >> s >> w;
	if(w >= s)
		cout << "unsafe\n";
	else cout << "safe\n";

}

Measured memory_bytes: 3648
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define eps 1e-9
#define maxp 400
#define mod 1000000007
#define sin(s) scanf("%lld",&s);
#define sout(s) printf("%lld\n",s);
#define in(s) cin>>s
#define in2(a,b) cin>>a>>b
#define in3(a,b,c) cin>>a>>b>>c
#define out(s) cout<<s
#define outs(s,a) cout<<s<<a
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define gear_change ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0)
#define nfl(i,n) for(i=0;i<n;i++)
#define sfl(i,s,e) for(i=s;i<e;i++)
#define ufl(i,n) for(i=n-1;i>=0;i--)
using namespace std;
void solve()
{
    ll a,b;
    in2(a,b);
    if(a<=9&&b<=9)
        cout<<a*b<<"\n";
    else
        cout<<"-1\n";
}
int main()
{

    gear_change;
    ll test=1;
    // in(test);
    while(test--)
    {
        solve();
    }
    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 ll long long

int main(){
  int A,B,C,K;
  cin >> A >> B >> C >> K;
  int ans = 0;
  
  if(A+B>K){
    ans = K;
  } else{
    ans = A - (K-A-B);
  }
  cout << ans << endl;
}

Measured memory_bytes: 3624
#!/usr/bin/env python3
import sys

INF = 10 ** 10

# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    N, M, X = map(int, input().split())
    C = []
    A = []
    
    ans = INF

    for _ in range(N):
        CA = [int(i) for i in input().split()]
        C.append(CA.pop(0))
        A.append(CA)

    
    for n in range(2 ** N):
        flg = True
        cost = 0
        count = [0] * M
        for i in range(N):
            if n>>i & 1:
                for j in range(M):
                    count[j] += A[i][j]
                cost += C[i]
        # print(cost)
        # print(count)
        for j in range(M):
            if count[j] < X:
                flg = False
        if flg:
            ans = min(cost, ans)
    print(ans if ans != INF else -1)

if __name__ == '__main__':
    main()


Measured memory_bytes: 9236
#include <iostream>
#include <cctype>

int main()
{
    char ch;
    int alphabet[26] = {0};

    while (std::cin >> ch) {
        if (isupper(ch)) {
            alphabet[ch - 'A']++;
        } else if (islower(ch)) {
            alphabet[ch - 'a']++;
        }
    }

    for (int i = 0; i < 26; i++) {
        std::cout << (char)(i + 'a') << " : " << alphabet[i] << std::endl;
    }

    return 0;
}

Measured memory_bytes: 3088
#include <cstdio>
#include <algorithm>
#include <cmath>
using namespace std;
int N, K, x[100005], ans = 1e9;
int main() {
  scanf("%d %d", &N, &K);
  for(int i = 1; i <= N; ++i) scanf("%d", &x[i]);
  for(int i = 1; i+K-1 <= N; ++i) {
    int l = x[i]; int r = x[i+K-1];
    ans = min(ans, r-l+min(abs(l), abs(r)));
  }
  printf("%d\n", ans);
}

Measured memory_bytes: 512
#include <iostream>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <algorithm>
using namespace std;
template <typename T = int>
T in() {
    T temp; cin >> temp; return temp;
}

template <typename VType = int>
list<VType> const LR(VType start, VType end) {
    list<VType> ret; for (VType i = start; i < end; i++) ret.push_back(i); return move(ret);
}

int main() {
    int k[5];
    pair<int, int> last = make_pair<int, int>(10, 124);
    for (int i = 0; i < 5; i++) {
        k[i] = in();
        int temp = (k[i] % 10);
        if ((temp < last.first) && temp != 0) {
            last = make_pair(temp, i);
        }
    }
    
    int sum = 0;
    bool flag = (last.second == 124);
    for (int i = 0 ; i < 5; i++) {
        if (i == last.second) continue;
        sum += k[i];
        int temp = sum % 10;
        if ((temp != 0) &&
            !(i == 4 && flag)) {
            sum += 10 - temp;
        }
    }
    if (!flag) sum += k[last.second];
    cout << sum << endl;
    return 0;
}




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

using namespace std;

map <int, int> kind;

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n, m;
    cin >> n >> m;
    int x, q, y = n;
    while (n--){
        cin >> q;
        while (q--) cin >> x, ++kind[x];
    }
    int ans = 0;
    for (int i = 1; i <= m; ++i)    
        if (kind[i] == y) ++ans;
    cout << ans;
    return 0;
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Text;

namespace LogicSummoner
{
    class Program
    {
        static void Main(string[] args)
        {
            while (true)
            {
                var line = Console.ReadLine().Trim();
                if (line == "-")
                {
                    break;
                }

                var M = GetNumber();
                var queue = new Queue<char>(line);
                for (int i = 0; i < M; i++)
                {
                    var h = GetNumber();
                    for (int j = 0; j < h; j++)
                    {
                        queue.Enqueue(queue.Dequeue());
                    }
                }

                System.Console.WriteLine(new string(queue.ToArray()));
            }
        }

        //static StreamReader Console = new StreamReader("input.txt");

        static int GetNumber()
        {
            return int.Parse(Console.ReadLine().Trim());
        }

        static double GetDounble()
        {
            return double.Parse(Console.ReadLine().Trim());
        }

        static int[] GetNumbersInt(int n = 0)
        {
            return Console.ReadLine().Trim().Split(new[] { " " }, StringSplitOptions.RemoveEmptyEntries).Select(x => int.Parse(x)).ToArray();
        }

        static long[] GetNumbersLong(int n = 0)
        {
            return Console.ReadLine().Trim().Split(new[] { " " }, StringSplitOptions.RemoveEmptyEntries).Select(x => long.Parse(x)).ToArray();
        }

        static double[] GetNumbersDouble(int n = 0)
        {
            return Console.ReadLine().Trim().Split(new[] { " " }, StringSplitOptions.RemoveEmptyEntries).Select(x => double.Parse(x)).ToArray();
        }

        static string[] GetStrings(int n = 0)
        {
            return Console.ReadLine().Trim().Split(new[] { " " }, StringSplitOptions.RemoveEmptyEntries).ToArray();
        }
    }
}

Measured memory_bytes: 10156
N = int(input())
L = []
for k in range(N):
    t = []
    for l in range(int(input())):
        x, y = map(int,input().split())
        t.append([x-1,y])
    L.append(t)
ans = 0
for k in range(2**N):
    t = []
    for d in range(N):
        if (k>>d)&1:
            t.append(d)
    flag = 1
    for e in t:
        for f in L[e]:
            if f[0] in t and f[1] == 0:
                flag = 0
                break
            if f[0] not in t and f[1] == 1:
                flag = 0
                break
    ans = max(ans,flag*len(t))
print(ans)


Measured memory_bytes: 46576
#include <iostream>
#include <vector>

using namespace std;

int main() {
    int n, l;
    cin >> n >> l;
    vector<int> a = vector<int>();
    for (int i = 1; i <= n; i++) {
        a.push_back(i + l - 1);
    }
    int minI = 0;
    for (int i = 0; i < n; i++) {
        if (abs(a[i]) < abs(a[minI])) {
            minI = i;
        }
    }
    int sum = 0;
    for (int i = 0; i < n; i++) {
        if (i == minI) {
            continue;
        }
        sum += a[i];
    }
    cout << sum << endl;

    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<set>
#include<map>
#include<queue>
#include<cassert>
#define PB push_back
#define MP make_pair
#define sz(v) (in((v).size()))
#define forn(i,n) for(in i=0;i<(n);++i)
#define forv(i,v) forn(i,sz(v))
#define fors(i,s) for(auto i=(s).begin();i!=(s).end();++i)
#define all(v) (v).begin(),(v).end()
using namespace std;
typedef long long in;
typedef vector<in> VI;
typedef vector<VI> VVI;
in cs(in a, in b){
  return (a-b)*(a-b);
}
int main(){
  ios::sync_with_stdio(0);
  cin.tie(0);
  in n;
  VI mar;
  cin>>n;
  mar.resize(n);
  forn(i,n)
    cin>>mar[i];
  in bst=1e9;
  for(in g=-100;g<=100;++g){
    in sm=0;
    forn(i,n)
      sm+=cs(mar[i],g);
    bst=min(bst,sm);
  }
  cout<<bst<<endl;
  return 0;
}


Measured memory_bytes: 256
using System;
class Program
{
    static void Main(string[] args)
    {
        int n = int.Parse(Console.ReadLine());

    

        for(int i = 1; i <= 9; i++)
        {
            for(int j = 1; j <= 9; j++)
            {
                if(i * j == n)
                {
                    Console.WriteLine("Yes");
                    return;
                }
            }
        }
        Console.WriteLine("No");

    }


}

Measured memory_bytes: 27332
#include <iostream>

int main() {
    int n, m;
    std::cin >> n >> m;

    int l = 1;
    int r = n;

    for (int i = 0; i < m; i++) {
        int lTmp, rTmp;
        std::cin >> lTmp >> rTmp;

        if (lTmp > l) {
            l = lTmp;
        }
        if (rTmp < r) {
            r = rTmp;
        }
    }

    if (r - l + 1 <= 0) {
        std::cout << 0 << std::endl;
    } else {
        std::cout << r - l + 1 << std::endl;
    }
}

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

int main()
{
    std::string T, P;
    std::cin >> T >> P;
    int Pos = T.find(P, Pos);
    while(Pos != std::string::npos){
        std::cout << Pos << std::endl;
        Pos = T.find(P, Pos+1);
    }
    return 0;
}

Measured memory_bytes: 3116
#include <bits/stdc++.h>
using namespace std;
int main()
{
  
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);

  int a,b;
  cin>>b>>a;
  if(a%b==0)cout<<a+b<<endl;
  else cout<<a-b<<endl;
  return 0;
}

Measured memory_bytes: 256
/*** author: yuji9511 ***/
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using lpair = pair<ll, ll>;
const ll MOD = 1e9+7;
const ll INF = 1e18;
#define rep(i,m,n) for(ll i=(m);i<(n);i++)
#define rrep(i,m,n) for(ll i=(m);i>=(n);i--)
#define printa(x,n) for(ll i=0;i<n;i++){cout<<(x[i])<<" \n"[i==n-1];};
void print() {}
template <class H,class... T>
void print(H&& h, T&&... t){cout<<h<<" \n"[sizeof...(t)==0];print(forward<T>(t)...);}

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll N,A,B;
    cin >> N >> A >> B;
    if((B - A) % 2 == 0){
        print((B-A)/2);
    }else{
        ll ans1 = (B+A-1)/2;
        ll ans2 = (2*N - A - B + 1) / 2;
        ll ans = min(ans1, ans2);
        print(ans);
    }
    

}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <cmath>
#include <numeric>
using namespace std;
using ll=long long;
#define rep(i,a,b) for(int i=(a); i<(b); ++i) // a ≦ i < b 
#define Rrep(i,a,b) for(int i=(a);i>=(b);--i) // reverse repeat. a から b まで減少．
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend() //逆イテレータ
#define RANGE(a,b,c) (a).begin()+b,(a).begin()+c // コンテナ a の 要素 b から c へのイテレータ
#define MOD 1000000007
// typedef
typedef pair<int, int> PII;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef vector<PII> VP;

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

string S ; cin >>  S;

int K=S.size();
rep(i, 0, S.size()){
    if (S[i] == S[i+1]) {
        --K;
        i += 2;
    }
}

cout << K << "\n";

return 0;
}

// 境界，出力文字列 チェック



Measured memory_bytes: 720
package main

import "fmt"

func main() {
	var n, m int
	fmt.Scan(&n, &m)

	as := make([]int, m)
	bs := make([]int, m)
	for i := 0; i < m; i++ {
		fmt.Scan(&as[i], &bs[i])
	}

	uf := newUnionFind(n + 1)

	cnts := make([]int, m+1)
	cnt := n * (n - 1) / 2
	cnts[m] = cnt

	for i := m - 1; i >= 0; i-- {
		a, b := as[i], bs[i]

		if uf.same(a, b) {
			uf.unite(a, b)
			cnts[i] = cnt
			continue
		}

		ac := uf.size(a)
		bc := uf.size(b)
		c1 := (ac * (ac - 1) / 2) + (bc * (bc - 1) / 2)

		uf.unite(a, b)

		ac2 := uf.size(a)
		c2 := ac2 * (ac2 - 1) / 2

		cnt = max(0, cnt-(c2-c1))
		cnts[i] = cnt
	}

	for i := 1; i <= m; i++ {
		fmt.Println(cnts[i])
	}
}

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

// UnionFind .
type UnionFind struct {
	par   []int
	rank  []int
	sizes []int
}

func newUnionFind(n int) UnionFind {
	u := UnionFind{}
	u.par = make([]int, n)
	u.rank = make([]int, n)
	u.sizes = make([]int, n)

	for i := 0; i < n; i++ {
		u.par[i] = i
		u.rank[i] = 0
		u.sizes[i] = 1
	}

	return u
}

func (u UnionFind) unite(x, y int) {
	x = u.root(x)
	y = u.root(y)
	if x == y {
		return
	}

	if u.rank[x] < u.rank[y] {
		u.par[x] = y
		u.sizes[y] += u.sizes[x]
	} else {
		u.par[y] = x
		u.sizes[x] += u.sizes[y]
		if u.rank[x] == u.rank[y] {
			u.rank[x]++
		}
	}
}

func (u UnionFind) root(x int) int {
	if u.par[x] == x {
		return x
	}
	u.par[x] = u.root(u.par[x])
	return u.par[x]
}

func (u UnionFind) same(x, y int) bool {
	return u.root(x) == u.root(y)
}

func (u UnionFind) size(x int) int {
	return u.sizes[u.root(x)]
}


Measured memory_bytes: 8632
#define DEBUG 0

#include <bits/stdc++.h>
using namespace std;

#if DEBUG
// basic debugging macros
int __i__,__j__;
#define printLine(l) for(__i__=0;__i__<l;__i__++){cout<<"-";}cout<<endl
#define printLine2(l,c) for(__i__=0;__i__<l;__i__++){cout<<c;}cout<<endl
#define printVar(n) cout<<#n<<": "<<n<<endl
#define printArr(a,l) cout<<#a<<": ";for(__i__=0;__i__<l;__i__++){cout<<a[__i__]<<" ";}cout<<endl
#define print2dArr(a,r,c) cout<<#a<<":\n";for(__i__=0;__i__<r;__i__++){for(__j__=0;__j__<c;__j__++){cout<<a[__i__][__j__]<<" ";}cout<<endl;}
#define print2dArr2(a,r,c,l) cout<<#a<<":\n";for(__i__=0;__i__<r;__i__++){for(__j__=0;__j__<c;__j__++){cout<<setw(l)<<setfill(' ')<<a[__i__][__j__]<<" ";}cout<<endl;}

// advanced debugging class
// debug 1,2,'A',"test";
class _Debug {
    public:
        template<typename T>
        _Debug& operator,(T val) {
            cout << val << endl;
            return *this;
        }
};
#define debug _Debug(),
#else
#define printLine(l)
#define printLine2(l,c)
#define printVar(n)
#define printArr(a,l)
#define print2dArr(a,r,c)
#define print2dArr2(a,r,c,l)
#define debug
#endif

// define
#define MAX_VAL 999999999
#define MAX_VAL_2 999999999999999999LL
#define EPS 1e-6
#define mp make_pair
#define pb push_back

// typedef
typedef unsigned int UI;
typedef long long int LLI;
typedef unsigned long long int ULLI;
typedef unsigned short int US;
typedef pair<int,int> pii;
typedef pair<LLI,LLI> plli;
typedef vector<int> vi;
typedef vector<LLI> vlli;
typedef vector<pii> vpii;
typedef vector<plli> vplli;

// ---------- END OF TEMPLATE ----------

int A[500][500];
LLI pre[501][501];
LLI dp[500][500];
int main() {
    int i,j;
    int N;
    LLI sum = 0;
    scanf("%d",&N);
    for (i = 0; i < N; i++) {
        for (j = 0; j < N; j++) {
            if (i != j) {
                scanf("%d",&A[i][j]);
                if (j < i) sum += A[i][j];
                else A[i][j] = -A[i][j];
            }
            pre[i+1][j+1] = pre[i+1][j]+pre[i][j+1]-pre[i][j]+A[i][j];
        }
    }

    int k;
    LLI ans = -1e18;
    for (i = 0; i < N; i++) {
        for (j = 0; j <= i; j++) {
            if (j == 0) dp[i][j] = pre[i+1][i+1];
            else {
                dp[i][j] = -1e18;
                for (k = 0; k < j; k++) {
                    dp[i][j] = max(dp[i][j],dp[j-1][k]+pre[i+1][i+1]-pre[i+1][j]-pre[j][i+1]+pre[j][j] \
                         + pre[i+1][j]-pre[i+1][k]-pre[j][j]+pre[j][k]);
                }
            }
            if (i == N-1) ans = max(ans,dp[i][j]);
        }
    }
    printf("%lld\n",sum-ans);

    return 0;
}



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

int main(){
	ll N, K, S; cin >> N >> K >> S;
	if(S==1000000000){
		for(int i=0; i<N; i++){
			if(i<K) cout << S << " ";
			else cout << 1 << " ";
		}
		cout << "\n";
	}else{
		for(int i=0; i<N; i++){
			if(i<K) cout << S << " ";
			else cout << 1000000000 << " ";
		}
		cout << "\n";
	}
	return 0;
}


Measured memory_bytes: 1280
N = int(input())
S1, S2 = input(), input()

A = []
cur = 0
while cur < N:
    if S1[cur] == S2[cur]:
        A.append("X")
        cur += 1
    else:
        A.append("Y")
        cur += 2

ans = 3 if A[0] == "X" else 6
for i in range(1, len(A)):
    if A[i - 1] == "X":
        ans *= 2
    elif A[i] == "Y":
        ans *= 3
    ans %= 1000000007

print(ans)

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

using namespace std;
typedef long long ll;
//#define rep(i, s, e) for (int(i) = (s); (i) < (e); ++(i))
#define rep(i, e) for (int(i) = 0; (i) < (e); ++(i))
#define all(x) x.begin(),x.end()


int main()
{
	int a, b, c; cin >> a >> b >> c;
	if (a <= c && c <= b)cout << "Yes" << endl;
	else cout << "No" << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <stdio.h>
#include <cstring>
#include <queue>
#include <stack>
#include <functional>
#include <math.h>
#include <iomanip>
using namespace std;
#define Would
#define you
const int INF = 999999999;
const int MOD = 1e9 + 7;

bool ch;
int n, mon;
int main() {
	string s;
	cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> s;
		if (s == "A") { ++mon; }
		else if (s == "Un") { --mon; }
		if (mon < 0) { ch = 1; }
	}
	if (mon != 0) { ch = 1; }
	if (ch) { cout << "NO" << endl; }
	else { cout << "YES" << endl; }
}



Measured memory_bytes: 3160
import java.util.Scanner;

public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        Integer a = new Integer(sc.nextInt());
        Integer b = new Integer(sc.nextInt());
        int result = a.compareTo(b);
        
        System.out.println(result == 0 ? "a == b" : result < 0 ? "a < b" : "a > b"); 
    }
}


Measured memory_bytes: 26124
while True:

    
    m,f,r=map(int,input().split())
    if m==f==r==-1:
        break
    sumnumber=m+f
    if m==-1 or f == -1:
        print("F")
    elif sumnumber>=80:
        print("A")
    elif sumnumber>=65:
        print("B")
    elif sumnumber>=50:
        print("C")
    elif sumnumber>=30:
        if r>=50:
            print("C")
        else:
            print("D")
    else:
        print("F")


Measured memory_bytes: 5596
#include<iostream>
#include<map>
#include<set>
#include<string>
#include<algorithm>
#include<cmath>
#include<vector>
#include<queue>
#include<stack>
#include<limits>
#include<sstream> 
#include<unordered_map>      

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef int itn;

const int inf = numeric_limits<int>::max() >> 2;
const ll linf = numeric_limits<ll>::max() >> 2;
const ull ulinf = numeric_limits<ull>::max() >> 2;
const double pi = acos(-1);
const int dx[4]={1,0,-1,0};
const int dy[4]={0,1,0,-1};
const int dx8[8]={-1,0,1,-1,1,-1,0,1};
const int dy8[8]={-1,-1,-1,0,0,1,1,1};

#define p_queue(i) priority_queue<i> 
#define rp_queue(i) priority_queue<i, vector<i>, greater<i>> 
#define umap(i,j) unordered_map<i,j>
#define P(p) cout<<(p)<<endl
#define PS(p) cout<<(p)<< " "
#define PN cout << endl
#define rep(i,m,n) for(int i = (m); i < (int)(n); i++)
#define rrep(i,m,n) for(int i = (n-1); i >= (int)(m); i--)
#define inrep(n,a) for(int i = 0; i < (int)(n); i++)cin >> a[i];
#define mod(i) ((i)%(ll)(1e9 + 7))
#define divm(a,b) (mod(a * modpow((ll)b,(ll)(1e9+5))))
#define rsort(a,b,c) sort(a, b, greater<c>())
#define vsort(v) sort(v.begin(), v.end())
#define rvsort(v,c) sort(v.begin(), v.end(), greater<c>()) 
#define ft first
#define sd second
#define pb push_back
#define it insert
#define sz(x) ((int)(x).size())
#define lb(a,n,k) (lower_bound(a,a+n,k) - (a)) 
#define vlb(a,k)  (lower_bound(a.begin(),a.end(),k) - a.begin())
#define ub(a,n,k) (upper_bound(a,a+n,k) - (a)) 
#define vub(a,k)  (upper_bound(a.begin(),a.end(),k) - a.begin())
#define YES cout<<"YES"<< endl
#define NO cout<<"NO"<<endl
#define Yes cout<<"Yes"<<endl
#define No cout<<"No"<<endl  
#define yes cout<<"yes"<<endl
#define no cout<<"no"<<endl
#define ret return


ll modpow(ll i,ll j){ ll tmp=1; while(j){ if(j%2)tmp=mod(tmp*i);i=mod(i*i);j/=2;}return tmp;}
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }


/*
vector<string> split(const string &str, char sep){
    vector<string> v;
    stringstream ss(str);
    string buffer;
    while( getline(ss, buffer, sep) ) {
        v.push_back(buffer);
    }
    return v;
}
*/

/*
ll ncr[100][100];
ll nCr(int n, int r){if(n==r) ret ncr[n][r] = 1; if(r==0) ret ncr[n][r] = 1; if(r==1) ret ncr[n][r] = n;if(ncr[n][r]) ret ncr[n][r]; ret ncr[n][r] = nCr(n-1,r) + nCr(n-1,r-1);}

ll npr[100][100]={};
ll nPr(int n,int r){if(npr[n][r])ret npr[n][r];if(r==0)ret npr[n][r] = 1;if(r==1)ret npr[n][r] = n;ret npr[n][r] = n * nPr(n-1,r-1);}

ll nHr(int n,int r){ret nCr(n+r-1,r);}
*/

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

int main(){

    string s;
    cin >> s;
    rep(i,0,3){
	if(s[i] == '7'){
	    Yes;
	    ret 0;
	}
    }
    No;
    return  0;
}


Measured memory_bytes: 3612
#include<iostream>
#include<stdio.h>
#include<string.h>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<set>
#include<iomanip>
#include<cmath>

#define REP(i,n) for (int i = 0; (i) < (n); ++ (i))
#define FOR(i,n) for (int i = 1; (i) <= (n); ++ (i))
#define dump(x)  cout << #x << " = " << (x) << endl;
#define pb push_back
#define int long long

const int INF = 1e18;
const int MOD = 1e9+7;
//const lint LINF = 1e18;
const double eps = 0.000000001;//もとの値の10^(-16)まで

using namespace std;

//typedef pair<int, int> P;
//priority_queue< P, vector<P>, greater<P> > q;//ダイクストラの時、greaterで小さい順

signed main(){
    int n;
    cin >> n;
    if(n%2==1){
        cout << 0 << endl;
        return 0;
    }
    n = n/2;
    int ans = 0;
    while(n>0){
        ans += n/5;
        n/= 5;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstring>
#include <vector>
#include <deque>
#include <queue>
#include <array>
#include <set>
#include <map>
#include <cmath>
#include <algorithm>
#include <numeric>
#include <utility>
#include <tuple>
#include <functional>
#include <bitset>
#include <cstdint>
#include <cassert>
#include <random>

using namespace std;
using i64 = int64_t;
using i32 = int32_t;
template<class T, class U> void init_n(vector<T>& v, size_t n, U x) 
{ v = vector<T>(n, x); }
template<class T> void init_n(vector<T>& v, size_t n) { init_n(v, n, T()); }
template<class T> void read_n(vector<T>& v, size_t n, size_t o = 0) 
{ v = vector<T>(n+o); for (size_t i=o; i<n+o; ++i) cin >> v[i]; }
template<class T> void read_n(T a[], size_t n, size_t o = 0)
{ for (size_t i=o; i<n+o; ++i) cin >> a[i]; }
template<class T> T gabs(const T& x) { return max(x, -x); }
#define abs gabs

struct Edge { i64 v, w; };

i64 n, m, l, dist[301][301], g[301][301], h[301][301];
// vector<vector<Edge>> /*g,*/ h;
int main() {
  cin >> n >> m >> l;
  // g.resize(n + 1);
  for (int i = 0; i <= n; ++i) {
    for (int j = 0; j <= n; ++j) {
      if (i != j) g[i][j] = 1ll << 50;
    }
  }
  for (i64 i = 0; i < m; ++i) {
    i64 a, b, c;
    cin >> a >> b >> c;
    g[a][b] = c;
    g[b][a] = c;
    /*
    g[a].emplace_back(b, c);
    g[b].emplace_back(a, c);
    */
  }

  for (int k = 1; k <= n; ++k) {
    for (int i = 1; i <= n; ++i) {
      for (int j = 1; j <= n; ++j) {
        g[i][j] = min(g[i][j], g[i][k] + g[k][j]);
      }
    }
  }

  for (int i = 1; i <= n; ++i) {
    for (int j = 1; j <= n; ++j) {
      h[i][j] = g[i][j] <= l ? 1 : 1ll << 50;
    }
  }

  for (int k = 1; k <= n; ++k) {
    for (int i = 1; i <= n; ++i) {
      for (int j = 1; j <= n; ++j) {
        h[i][j] = min(h[i][j], h[i][k] + h[k][j]);
      }
    }
  }

  i64 q;
  cin >> q;
  while (q--) {
    i64 s, t;
    cin >> s >> t;
    cout << (h[s][t] > n ? -1 : h[s][t] - 1) << '\n';
  }
  return 0;
}


Measured memory_bytes: 1920
def main():
	
	n = int(input())
	h = list(map(int, input().split()))
	dp = [0] * n

	dp[1] = abs(h[1] - h[0])

	for i in range(2, n):
		dp[i] = min(dp[i-1]+abs(h[i]-h[i-1]), dp[i-2]+abs(h[i]-h[i-2]))

	print(dp[n-1])

if __name__ == '__main__':
	main()

Measured memory_bytes: 13980
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <numeric>
#include <cassert>
#include <vector>
#include <cmath>
#include <queue>
#include <set>
#include <map>
#define syosu(x) fixed<<setprecision(x)
using namespace std;
typedef long long ll;
typedef unsigned int uint;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef pair<double,double> pdd;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<string> vs;
typedef vector<P> vp;
typedef vector<vp> vvp;
typedef vector<pll> vpll;
typedef pair<P,int> pip;
typedef vector<pip> vip;
const int inf=1<<30;
const ll INF=1ll<<60;
const double pi=acos(-1);
const double eps=1e-8;
const ll mod=998244353;
const int dx[4]={-1,0,1,0},dy[4]={0,-1,0,1};

int x;

int main(){
	cin>>x;
	cout<<1-x<<endl;
}

Measured memory_bytes: 3620