akhauriyash/Code-Regression huggingface dataset:
// clang-format off
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define stoi stoll
using pii = pair<int,int>;
using vi = vector<int>;
using vvi = vector<vi>;
#define all(c) begin(c), end(c)
#define rall(c) rbegin(c), rend(c)
#define fore(x, c) for(auto &&x : c)
#define rep(i, a, n) for(int i = a, i##len = (int)(n); i < i##len; ++i)
#define rrep(i, a, n) for(int i = (int)(n - 1); i >= a; --i)
#define sz(c) ((int)c.size())
#define contains(c, x) (c.find(x) != end(c))
#define inseg(l, x, r) ((l) <= (x) && (x) < (r))
#define dump(...)
#define pb push_back
#define eb emplace_back
#define _ 0
const signed INF_ = 1001001001; const long long INF = 1001001001001001001LL;
const int DX[9] = {0,1,0,-1,1,1,-1,-1,0}, DY[9] = {-1,0,1,0,-1,1,1,-1,0};
template<class T> ostream& operator<<(ostream &os, const vector<T> &v) {
  for (auto i = begin(v); i != end(v); i++) os<<*i<<(i==end(v)-1?"":" ");return os;}
template<class T> istream& operator>>(istream &is, vector<T> &v) {
  for (auto i = begin(v); i != end(v); i++) is>>*i;return is;}
template<class T,class U> istream& operator>>(istream &is, pair<T,U> &p) {
  is>>p.first>>p.second;return is;}
template<class T, class U> bool chmax(T &a, const U &b){return a<b?a=b,1:0;}
template<class T, class U> bool chmin(T &a, const U &b){return a>b?a=b,1:0;}
template <class T> void psum(T& c) {partial_sum(begin(c), end(c), begin(c));}
template<class T> using heap = priority_queue<T, deque<T>, greater<T>>;
struct before_main_function {
  before_main_function() {
      cin.tie(nullptr); ios::sync_with_stdio(0);
      cout << setprecision(15) << fixed;
  }
} before_main_function;
// clang-format on
//------------------8<------------------------------------8<--------------------

signed main() {
  int a, b;
  cin >> a >> b;
  string A, B;
  rep(i, 0, b) A += to_string(a);
  rep(i, 0, a) B += to_string(b);
  cout << min(A, B) << endl;
  return (0 ^ _ ^ 0);
}



Measured memory_bytes: 256
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <cstring>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <algorithm>
#include <climits>
#include <iomanip>
using namespace std;

#define REP(i,n) for(int i=0; i<n; ++i)
#define FOR(i,a,b) for(int i=a; i<=b; ++i)
#define FORR(i,a,b) for (int i=a; i>=b; --i)
#define ALL(c) (c).begin(), (c).end()

typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<VI> VVI;
typedef vector<VL> VVL;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;


int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int x;
    cin >> x;
    if(x == 7 or x == 5 or x == 3) {
        cout << "YES" << endl;
    } else {
        cout << "NO" << endl;
    }
    return 0;
}


Measured memory_bytes: 256
n,k=map(int,input().split())
x=list(map(int,input().split()))
ans=float("inf")
for i in range(n-k+1):
    l=x[i]
    r=x[i+k-1]
    if l*r<0:ans=min(ans,max(abs(l),r)+min(abs(l),r)*2)
    else: ans=min(ans,max(abs(l),r))
print(ans)

Measured memory_bytes: 14384
for i in range(input()):
	n = raw_input()
	c = 0
	while len(n) > 1:
		c += 1
		maxn = 0
		for i in range(1,len(n)):
			maxn = max(maxn, int(n[:i])*int(n[i:]))
		n = str(maxn)
	print c
	

Measured memory_bytes: 4216
fn solve(hs: Vec<usize>, k: usize) -> usize {
    let n = hs.len();

    let mut a = 0;
    for h in hs {
        if h >= k {
            a += 1;
        }
    }
    a
}

#[test]
fn test() {
    assert_eq!(solve(vec![150, 140, 100, 200], 150), 2);
}

#[allow(unused_macros)]
macro_rules! parse_line {
    ( $t:ty ) => (
        {
            let mut line = String::new();
            ::std::io::stdin().read_line(&mut line).unwrap();
            let mut iter = line.split_whitespace();
            iter.next().unwrap().parse::<$t>().unwrap()
        }
    );

    ( $( $t:ty), +) => (
        {
            let mut line = String::new();
            ::std::io::stdin().read_line(&mut line).unwrap();
            let mut iter = line.split_whitespace();
            ( $(iter.next().unwrap().parse::<$t>().unwrap()),* )
        }
    );
}

#[allow(unused_macros)]
macro_rules! read_line {
    () => {{
        let mut line = String::new();
        ::std::io::stdin().read_line(&mut line).unwrap();
        line.pop();
        line
    }};
}

#[allow(unused_macros)]
macro_rules! parse_vec {
    ( $t:ty ) => {{
        let mut line = String::new();
        ::std::io::stdin().read_line(&mut line).unwrap();
        let iter = line.split_whitespace();
        iter.map(|v| v.parse::<$t>().unwrap()).collect::<Vec<_>>()
    }};
}

fn main() {
    let (n, k) = parse_line!(usize, usize);
    let hs = parse_vec!(usize);

    println!("{}", solve(hs, k));
}


Measured memory_bytes: 4476
#ifdef LOCAL111
	#define _GLIBCXX_DEBUG
#else
	#define NDEBUG
#endif
#include <bits/stdc++.h>
const int INF = 1e9;
using namespace std;
template<typename T, typename U> ostream& operator<< (ostream& os, const pair<T,U>& p) { cout << '(' << p.first << ' ' << p.second << ')'; return os; }

#define endl '\n'
#define ALL(a)  (a).begin(),(a).end()
#define SZ(a) int((a).size())
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define RFOR(i,a,b) for (int i=(b)-1;i>=(a);i--)
#define REP(i,n)  FOR(i,0,n)
#define RREP(i,n) for (int i=(n)-1;i>=0;i--)
#ifdef LOCAL111
	#define DEBUG(x) cout<<#x<<": "<<(x)<<endl
	template<typename T> void dpite(T a, T b){ for(T ite = a; ite != b; ite++) cout << (ite == a ? "" : " ") << *ite; cout << endl;}
#else
	#define DEBUG(x) true
	template<typename T> void dpite(T a, T b){ return; }
#endif
#define F first
#define S second
#define SNP string::npos
#define WRC(hoge) cout << "Case #" << (hoge)+1 << ": "
template<typename T> void pite(T a, T b){ for(T ite = a; ite != b; ite++) cout << (ite == a ? "" : " ") << *ite; cout << endl;}
template<typename T> bool chmax(T& a, T b){if(a < b){a = b; return true;} return false;}
template<typename T> bool chmin(T& a, T b){if(a > b){a = b; return true;} return false;}

typedef long long int LL;
typedef unsigned long long ULL;
typedef pair<int,int> P;
typedef pair<LL,LL> LP;

void ios_init(){
	//cout.setf(ios::fixed);
	//cout.precision(12);
#ifdef LOCAL111
	return;
#endif
	ios::sync_with_stdio(false); cin.tie(0);	
}

int main()
{
	ios_init();
	LL a[7];
	REP(i,7) cin >> a[i];
	LL ans = 0;
	ans += a[1];
	
	LL t = 0;
	LL mi = min({a[0],a[3],a[4]});
	a[0] -= mi; a[3] -= mi; a[4] -= mi;
	t += mi*3;
	LL hoge = (a[0]/2+a[3]/2+a[4]/2)*2;
	t += hoge;

	if(mi != 0){
		LL tt = (mi-1)*3;
		a[0]++; a[3]++; a[4]++;
		LL hoge = (a[0]/2+a[3]/2+a[4]/2)*2;
		tt += hoge;
		t = max(tt,t);
	}

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


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

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

  int a, b;
  cin >> a >> b;
  int c = a + b;
  if (c % 2 == 0)
    cout << c / 2 << endl;
  else
    cout << "IMPOSSIBLE" << endl;
}


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

int main(){
	int n, m, l;
	cin>>n>>m>>l;
	vector<vector<long> > A(n, vector<long>(m));
	vector<vector<long> > B(m, vector<long>(l));
	vector<vector<long> > C(n, vector<long>(l));
	int i,j, k;
	for(i=0;i<n;i++){
		for(j=0;j<m;j++){
			cin>>A[i][j];
		}
	}
	for(i=0;i<m;i++){
		for(j=0;j<l;j++){
			cin>>B[i][j];
		}
	}
	for(i=0;i<n;i++){
		for(j=0;j<l;j++){
			for(k=0;k<m;k++){
				C[i][j] += A[i][k]*B[k][j];
			}
			cout<<C[i][j];
			if(j!=l-1)cout<< ' ';
		}
		cout << endl;
	}
	
	return 0;
}

Measured memory_bytes: 1420
#include<bits/stdc++.h>
using namespace std;
#define ll  long long
#define FASTINOUT ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
const ll MOD = 1000000007;
const ll N=1e5+9;
vector<int>v[N],en[N];
int c=0,o=1;
bool visited[N];
int cnt[N];
int sz[N];
set<int>st[N];
void dfs(int x){
    visited[x]=true;
    c++;
    cnt[x]=o;
    st[o].insert(x);
    for (int i=0;i<v[x].size();i++){
        if (!visited[v[x][i]])
            dfs(v[x][i]);
    }
}
int main()
{
    FASTINOUT;
    int x,f,e,l,r;
    cin>>x>>f>>e;
    for (int i=0;i<f;i++){
        cin>>l>>r;
        v[l].push_back(r);
        v[r].push_back(l);
    }
    for (int i=0;i<e;i++){
        cin>>l>>r;
        en[l].push_back(r);
        en[r].push_back(l);
    }
    for (int i=1;i<=x;i++){
        if (!visited[i])
        {
            c=0;
            dfs(i);
            sz[o]=c;
            o++;

        }
        int m=v[i].size(),k=0;
        for (int j=0;j<en[i].size();j++){
            if (st[cnt[i]].find(en[i][j])!=st[cnt[i]].end())
                k++;
        }
        cout<<sz[cnt[i]]-m-k-1<<" ";
    }
    return 0;
}


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

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

int main() {
  ll n;
  cin >> n;
  ll sum = 0;
  vector<ll> a(n);
  rep(i, n) cin >> a[i];
  ll x2 = 0;
  rep(i, n) {
    if (i % 2)
      x2 -= a[i];
    else
      x2 += a[i];
  }

  vector<int> ans(n);
  ans[0] = x2 / 2;
  rep(i, n - 1) ans[i + 1] = a[i] - ans[i];

  rep(i, n) ans[i] *= 2;
  rep(i, n) printf("%d%c", ans[i], i == n - 1 ? '\n' : ' ');
  return 0;
}


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

int f(int n) {
  int f = 0;
  
  while(n) {
    f += n % 10;
    n /= 10;
  }
  
  return f;
}

int main() {
  int n;
  cin >> n;
  
  if ((n % f(n)) == 0) cout << "Yes" << endl;
  else cout << "No" << endl;
}

Measured memory_bytes: 256
n,m = gets.split.map(&:to_i)
a = n.times.map{gets.split.map(&:to_i)}.sort_by{|i,j|i}
ans = 0
n.times do |i|
    if a[i][1] <= m
        ans += a[i][0]*a[i][1]
        m -= a[i][1]
    else
        ans += a[i][0]*m
        m = 0
    end
    break if m == 0
end
puts ans

Measured memory_bytes: 12664
def main():
    l, r = map(int, input().split())
    p = 2019
    if r - l + 1 >= p:
        print(0)
        return
    ans = 10 ** 10
    for i in range(l, r):
        for j in range(i + 1, r+1):
            if ans > (i * j) % p:
                ans = (i * j) % p
    print(ans)


main()


Measured memory_bytes: 3060
#include<iostream>
using namespace std;
int main()
{
	int n,m,x;
	cin>>n>>m>>x;
	int c[n+1];
	for(int i=1;i<=n;i++)
	c[i]=0;
	for(int i=1;i<=m;i++)
	{
		int b;
		cin>>b;
		c[b]=1;
	}
	int minv=0;
	for(int i=x;i<=n;i++)
	{
		minv+=c[i];
	}
	int s=0;
	for(int i=x;i>=1;i--)
	s+=c[i];
	if(s>minv)
	cout<<minv;
	else
	cout<<s;
	return 0;
}

Measured memory_bytes: 256
import sys

S = input()
T = input()

d_T = {}
d_S = {}

for i in range(len(S)):
    if T[i] in d_T and d_T[T[i]]!=S[i]:
        print("No")
        sys.exit()
    d_T[T[i]] = S[i]

for i in range(len(T)):
    if S[i] in d_S and d_S[S[i]]!=T[i]:
        print("No")
        sys.exit()
    d_S[S[i]] = T[i]


print("Yes")

Measured memory_bytes: 3632
#include <stdio.h>
#include <stdlib.h>
#include <vector>
#include <string>
#include <algorithm>
#include <iostream>
#include <unordered_map>
#include <sstream>
using namespace std;

class Change{
public:
  int getChange(int n){
    return (1000-n%1000)%1000;
  }
};

int main(int argc, const char*argv[]){
  Change c;
  string nLn;
  getline(cin,nLn);
  int n = atoi(nLn.c_str());
  int cAmt = c.getChange(n);
  cout<<cAmt<<endl;
  return 0;
}


Measured memory_bytes: 3616
#include <bits/stdc++.h>
#define INF 1e9
using namespace std;

#define REPR(i,n) for(int i=(n); i >= 0; --i)
#define FOR(i, m, n) for(int i = (m); i < (n); ++i)
#define REP(i, n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define ALL(a)  (a).begin(),(a).end()

template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return true; } return false; }
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return true; } return false; }
int gcd(int a,int b){return b?gcd(b,a%b):a;}
typedef long long ll;
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}


int main() {
    ll X,Y;
    cin >> X >> Y;

    if (X%Y == 0) {
        cout << -1 << endl;
        return 0;
    }
    cout << X * (Y+1) << endl;
    return 0;

}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<iostream>
using namespace std;
#define vi vector<int>
void solve(){
    int n,k;
    cin>>n>>k;
    vi arr(n);
    for(int i=0;i<n;i++) cin>>arr[i];
    for(int i=k;i<n;i++) {
        if(arr[i] > arr[i-k]) 
            cout<<"Yes" <<endl;
        else 
            cout <<"No"<<endl;
    }
}

int main(){
   
    solve();
    
    return 0;
}


Measured memory_bytes: 4008
#include <bits/stdc++.h>
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <cmath>
#include <iomanip>
#include <cstring>
 
using namespace std;
typedef long long ll;
 
int main()
{
    int N;
    cin >> N;
    map<int, ll> mp; vector <int> number(N);
    ll pattern_all = 0;
    for ( int i=0; i<N; i++)
    {
        cin >> number[i];
        mp[number[i]] += 1;
    }
 
    for ( auto i = mp.begin(); i != mp.end(); i++ )
    {
        pattern_all += ( i->second * i->second - i->second ) / 2;
    }
 
    for ( int i=0; i<N; i++)
    {
        cout << ( pattern_all - ( mp[number[i]] - 1 ) ) << endl;
    }
 
    return 0;
}

Measured memory_bytes: 10240
#define DEBUG
#include <iostream>
#include <algorithm>
#include <vector>
#include <map>
using namespace std;
using ll = long long int;

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

    // 元のカード
    vector<ll> a;
    for (size_t i = 0; i < n; i++)
    {
        int ai;
        cin >> ai;
        a.emplace_back(ai);
    }
    sort(a.begin(), a.end());

    // 取り替える全てのカード
    map<ll, ll, greater<ll>> card;
    for (size_t i = 0; i < m; i++)
    {
        ll bi, ci;
        cin >> bi >> ci;
        card[ci] += bi;
    }

    // 取り替える n 枚のカード
    vector<ll> c;
    ll cnt = 0;
    for (auto &&e : card)
    {
        if (cnt >= n)
        {
            break;
        }
        int add_cnt = min(e.second, n - cnt);
        cnt += add_cnt;

        for (size_t i = 0; i < add_cnt; i++)
        {
            c.emplace_back(e.first);
        }
    }

    // a と c を比較
    for (size_t i = 0; i < n; i++)
    {
        if (i > c.size()) {
            break;
        }
        if (a[i] < c[i]) {
            a[i] = c[i];
        }
    }
    
    // calcurate sum of a
    ll res = 0;
    for (size_t i = 0; i < n; i++)
    {
        res += a[i];
    }
    cout << res << endl;
}

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

int main()
{
    long long A,B,mx,mn,r;
    cin >> A >> B;
    mx=max(A,B);
    mn =min(A,B);
    r=mx%mn;
    while(r!=0){
        mx=mn;
        mn=r;
        r=mx%mn;
    }
    cout << (A*B)/mn;
}

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

using namespace std;

typedef long long ll;

int main() {
    ios::sync_with_stdio(false);
    ll x, y, a, b, c;
    cin >> x >> y >> a >> b >> c;
    vector<ll> v(x + y + c), p(a), q(b);
    for (ll i = 0; i < a; ++i) cin >> p.at(i);
    for (ll i = 0; i < b; ++i) cin >> q.at(i);
    for (ll i = 0; i < c; ++i) cin >> v.at(i);
    sort(p.begin(), p.end(), greater<ll>());
    sort(q.begin(), q.end(), greater<ll>());
    for (ll i = 0; i < x; ++i) v.at(c + i) = p.at(i);
    for (ll i = 0; i < y; ++i) v.at(c + x + i) = q.at(i);
    sort(v.begin(), v.end(), greater<ll>());
    cout << accumulate(v.begin(), v.begin() + (x + y), 0LL) << endl;
    return 0;
}


Measured memory_bytes: 3968
import java.io.FileNotFoundException;
import java.util.Scanner;

public class Main {
	int n;
	String[] s;
	int[] d;

	public static void main(String[] args) throws FileNotFoundException {
//		System.setOut(new PrintStream(new File(System.currentTimeMillis()/1000+".txt")));

		new Main().run();
	}

	private void run() {
		Scanner sc = new Scanner(System.in);

		while(true){
			s = new String[1000];
			d = new int[1000];

			n = sc.nextInt();

			if(n==0) return;
			sc.nextLine();

			for(int i=0;i<n;i++){
				s[i] = sc.nextLine();
				for(int j=0;j<s[i].length();j++){
					if(s[i].charAt(j)!='.'){
						d[i] = j;
						break;
					}
				}
				s[i] = s[i].replace(".", "");
			}

			for(int i=0;i<n;i++){
				for(int j=0;j<d[i];j++){
					if(j==d[i]-1){
						System.out.print("+");
					}
					else{
						int x = -1, y = -1;
						for(int p=i-1;p>=0;p--){
							if(j==d[p]-1){
								x = p;
								break;
							}
							else if(j>d[p]-1){
								break;
							}
						}
						for(int q=i+1;q<n;q++){
							if(j==d[q]-1){
								y = q;
								break;
							}
							else if(j>d[q]-1){
								break;
							}
						}
//						System.out.println("i="+i+",j="+j+",x="+x+",y="+y);
						if(x==-1||y==-1){
							System.out.print(" ");
						}
						else if(y-x>=2){
							System.out.print("|");
						}
						else{
							System.out.print(" ");
						}
					}
				}
				System.out.println(s[i]);
			}
		}
	}

}

Measured memory_bytes: 92280
s = int(input())
a = s //100
b = s - a * 100
if 1 <= a <= 12:
  if 1 <= b <= 12:
    print("AMBIGUOUS")
  else:
    print("MMYY")
else:
  if 1 <= b <= 12:
    print("YYMM")
  else:
    print("NA")

Measured memory_bytes: 2940
def count(i, j):
  count = 0
  for k in range(-1, 2):
    for l in range(-1, 2):
      if (k, l) != (0, 0) \
        and 0 <= i+k < H \
        and 0 <= j+l < W \
        and S[i+k][j+l] == '#':
        count += 1
  return count

H, W = map(int, input().split())
S = [ list(input()) for _ in range(H) ]

for i in range(H):
  for j in range(W):
    if S[i][j] == '.':
      S[i][j] = str(count(i, j))

for s in S:
  print(''.join(s))

Measured memory_bytes: 3188
N = 200000
p = []
s = gets.strip
pw = 1
s.length.times{
  k = s.length - _1 - 1
  p[k] = (pw * s[k].to_i + p[k + 1].to_i) % 2019
  pw = 10 * pw % 2019
}
cnt = 0
q = []
q[0] = 1
s.length.times{
  k = s.length - _1 - 1
  cnt += q[p[k]].to_i
  q[p[k]] = q[p[k]].to_i + 1
}
puts cnt

Measured memory_bytes: 16260
N=int(input())
S=[input() for i in range(N)]
a,b=0,0
X=[]
Y=[]
for i in range(N):
  a,b=0,0
  for j in range(len(S[i])):
    if S[i][j]=='(':
      a+=1
    else:
      a-=1
    b=min(b,a)
  b=-b
  a=a+b
  if a>b:
    X.append((b,a))
  else:
    Y.append((b,a))
P=0
Q=0
X.sort()
for i in range(len(X)):
  P=max(P,Q+X[i][0])
  Q=Q+X[i][0]-X[i][1]
Y.sort(key=lambda x:-x[1])
for i in range(len(Y)):
  P=max(P,Q+Y[i][0])
  Q=Q+Y[i][0]-Y[i][1]
if P or Q:
  print('No')
else:
  print('Yes')

Measured memory_bytes: 243188
// AOJ 0600
#include<cstdio>
#include<algorithm>
#define rep(i,a) for(int i=0;i<(a);++i)

typedef long long ll;

const int MAX_N = 100000;

int N;
ll A[MAX_N], S[MAX_N*3+1];

int nxt( int p, ll x )
{ return std::lower_bound( S, S+N*3, S[p]+x )-S; }

bool C( ll x )
{
	rep( i, N )
	{
		int p = i;
		p = nxt( p, x ); if( p > i+N ) continue;
		p = nxt( p, x ); if( p > i+N ) continue;
		p = nxt( p, x ); if( p > i+N ) continue;

		return true;
	}

	return false;
}

int main()
{
	scanf( "%d", &N );
	rep( i, N )
		scanf( "%lld", A+i );

	S[0] = 0;
	rep( i, N )
		S[i+1] = S[i+N+1] = S[i+N*2+1] = A[i];
	rep( i, 3*N )
		S[i+1] += S[i];

	ll lb = 1, ub = S[N]/3;

	while( lb != ub )
	{
		ll mid = lb+ub+1>>1;

		if( C( mid ) )
			lb = mid;
		else
			ub = mid-1;
	}

	printf( "%lld\n", ub );

	return 0;
}

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

int main() {
  string c;
  cin >> c;
  
  if (c == "a" || c == "i" || c == "u" || c == "e" || c == "o" ){
    cout << "vowel" << endl;
  }
  
  else {
    cout << "consonant" << endl;
  }
}


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

int main() {
  int N;
  scanf("%d", &N);
  
  if(N % 2 == 0){
    printf("%d" , N / 2);
  }
  
  else{
    printf("%d" , N / 2 + 1);
  }
  
    
}
    


Measured memory_bytes: 256
h, w, k = map(int, input().split())
c = [input() for i in range(h)]
ans = 0
for i in range(1 << h):
    for j in range(1 << w):
        cnt = 0
        for x in range(h):
            for y in range(w):
                if (i >> x & 1) or (j >> y & 1):
                    continue
                if c[x][y] == "#":
                    cnt += 1
        if cnt == k:
            ans += 1
print(ans)

Measured memory_bytes: 68208
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
#define F first
#define S second
const int maxn = 2e5 + 10;
int n, q;
ll m;
int p[maxn], sz[maxn];
int find(int x) {return p[x] == x ? x : p[x] = find(p[x]);}
vector<pii> edges[2];
bool Union(int x, int y) {
	x = find(x), y = find(y);
	if(x == y) return 0;
	if(sz[x] < sz[y]) swap(x, y);
	p[y] = x, sz[x] += sz[y];
	return 1;
}
int main() {
	scanf("%d%lld%d", &n, &m, &q);
	for(int i = 0; i < q; i++) {
		int x, y, c;
		scanf("%d%d%d", &x, &y, &c);
		edges[c].push_back({x, y});
	}
	if(m == n - 1 && !edges[1].empty())
		return puts("No"), 0;
	
	for(int i = 0; i < n; i++) p[i] = i, sz[i] = 1;
	int com = n;
	for(auto p : edges[0]) 
		if(Union(p.F, p.S)) com--;
	for(auto p : edges[1]) 
		if(find(p.F) == find(p.S)) return puts("No"), 0;

	if(com != 2 && m <= n - com + 1LL * com * (com - 1) / 2) 
		puts("Yes");
	else puts("No");
	return 0;
}


Measured memory_bytes: 2036
#include <stdio.h>
#include <string>
#include <iostream>
#include <iomanip>
#include <map>
#include <algorithm>
#include <vector>
using namespace std;

int main(void) {
	int n;
	cin >> n;
	vector<int> app(n);
	for(int i=0; i<n; i++)cin >> app[i];
	int m;
	cin >> m;
	vector<int> que(m);
	for(int i=0; i<m; i++)cin >> que[i];
	sort(app.begin(),app.end());
	sort(que.begin(),que.end());
	int i=0,j=0;
	while(j<m){
		if(app[i]<que[j])i++;
		else if(app[i]==que[j])i++,j++;
		else {
			cout << "NO" << endl;
			return 0;
		}
	}
	cout << "YES" << endl;
	return 0;
}

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

int main(){
    int s, m = 1;
    int c[1000001] = {};
    cin >> s;
    c[s]++;
    while(1){
        m++;
        if(s%2 == 0){
            s /= 2;
        }else{
            s = 3*s+1;
        }
        if(c[s] == 1){
            cout << m;
            return 0;
        }else{
            c[s]++;
        }
    }
}

Measured memory_bytes: 4096
# -*- coding: utf-8 -*-


N = int(input())
count = 0
flag = 0
for i in range(N):
    a, b = map(int,input().split())

    if a == b:
        count += 1
    else:
        count = 0
        
    if count == 3:
        print("Yes")
        flag = 1
        break
if not flag:
    print("No")



Measured memory_bytes: 62336
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll n,m,ans=0;
int main(){
    cin>>n;
    vector<ll> h(n);
    for(ll i=0;i<n;i++) cin>>h.at(i);
    sort(h.begin(),h.end());
    for(ll i=0;i<n-1;i++){
        ans+=h.at(i);
    }
    cout<<ans+h.at(n-1)/2<<endl;
}


Measured memory_bytes: 256
// 
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cstdlib>
#include <vector>
#include <string>
#include <algorithm>
#include <numeric>
#include <map>
#include <unordered_map>
#include <stack>
#include <queue>
#include <set>
#include <unordered_set>
#include <bitset>
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
#define REP(i, n) for(size_t i = 0; i < (n); ++i)

int main()
{
    string S, T;
    cin >> S >> T;
    int N = S.size();
    int m = T.size();
    int ans = m;
    for (int i = 0; i < N - m + 1; ++i)
    {
        int cnt = 0;
        for (int j = 0; j < m; ++j)
        {
            if (S[i + j] != T[j]) ++cnt;
        }
        ans = min(ans, cnt);
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3524
#include <sstream>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
#include <iostream>
#include <utility>
#include <set>
#include <cctype>
#include <queue>
#include <stack>
#include <cstdio>
#include <cstdlib>
#include <cmath>
using namespace std;
#define eps 1e-8
int main(void) {
    int n;
    cin >> n;
    for (int i = 0; i < n; i++) {
        double x1, x2, y1, y2, a, b, c, d, e, f;
        cin >> a >> b >> c >> d >> e >> f;
        x1 = c - a; y1 = d - b;
        x2 = e - a; y2 = f - b;
        double x = (y1 * (x2 * x2 + y2 * y2) - y2 * (x1 * x1 + y1 * y1)) / (2 * (y1 * x2 - x1 * y2));
        double y, r;
        if (-eps < y1 && y1 < eps) y = y2 / 2 - (x2 / y2) * (x - x2 / 2);
        else y = y1 / 2 - (x1 / y1) * (x - x1 / 2);
        r = sqrt(x * x + y * y);
//        printf("%.5f\n", r);
        x += a; y += b;
        int intx = x * 10000;
        int inty = y * 10000;
        int intr = r * 10000;
        if (intx % 10 >= 5) x = (intx + 5) / 10000.0;
        if (inty % 10 >= 5) y = (inty + 5) / 10000.0;
        if (intr % 10 >= 5) r = (intr + 5) / 10000.0;
        printf("%.3f %.3f %.3f\n", x, y, r);
    }
    return 0;
}

Measured memory_bytes: 1244
#include<iostream>
#include<cmath>
#include<string>
#include<map>
#include <queue>
using namespace std;
#define N 3
#define N2 9

struct Puzzle{
  int f[N2];
  int space;
  string path;

  bool operator < ( const Puzzle &p ) const {
    for( int i = 0; i < N2; i++){
      if( f[i] == p.f[i] ) continue;
      return f[i] > p.f[i];
    }
    return false;
  }
};

static const int dx[4] = {-1, 0, 1, 0};
static const int dy[4] = {0, -1, 0, 1};
static const char dir[4] = {'u', 'l', 'd', 'r'};

bool isTarget(Puzzle p){
  for( int i = 0; i < N2; i++ )
    if( p.f[i] != (i + 1) )return false;
  return true;
}

string bfs(Puzzle s){
  queue<Puzzle> Q;
  map<Puzzle, bool> V;
  Puzzle u, v;
  s.path = "";
  Q.push(s);
  V[s] = true;

  while( !Q.empty() ){
    u = Q.front(); Q.pop();
    if( isTarget(u) )return u.path;
    int sx = u.space / N;
    int sy = u.space % N;
    for( int r = 0; r < 4; r++){
      int tx = sx + dx[r];
      int ty = sy + dy[r];
      if( tx < 0 || ty < 0 || tx >= N || ty >= N ) continue;
      v = u;
      swap(v.f[u.space], v.f[tx * N + ty]);
      v.space = tx * N + ty;
      if( !V[v] ){
        V[v] = true;
        v.path += dir[r];
        Q.push(v);
      }
    }
  }

  return "unsolvable";
}

int main(){
  Puzzle in;

  for( int i = 0; i < N2; i++){
    cin >> in.f[i];
    if( in.f[i] == 0){
      in.f[i] = N2;
      in.space = i;
    }
  }
  string ans = bfs(in);
  cout << ans.size() << endl;

  return 0;
}
/*
  Topic13 ProblemB 8Puzzle
  8 パズルは１つの空白を含む 3×3 のマス上に 8 枚のパネルが配置され、
  空白を使ってパネルを上下左右にスライドさせ、絵柄を揃えるパズルです。

  入力
  入力はパネルの数字あるいは空白を表す 3×3　個の整数です。
  空白で区切られた 3 つの整数が 3 行で与えられます。

  出力
  最短手数を１行に出力してください。

  use C++
*/



Measured memory_bytes: 30660
while True:
    n, x = map(int,input().split())
    if n == 0 and x == 0 :
        break
    a = 0
    for i in range(1,n+1):
        for j in range(i+1,n+1):
            for k in range(j+1,n+1):
                b = i+j+k
                if  b == x:
                    a += 1
    print(a)


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

#define DIV 1000000007

long long N, M;
long long up[500005];
long long bottom[500005];


long long modpow(long long ori, long long po){
	long long res = 1;
	while(po > 0){
		if(po&1){
			res *= ori;
			res %= DIV;
		}
		ori *= ori;
		ori %= DIV;
		po >>= 1;
	}
	return res;
}

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


	up[0] = 1;
	for(long long i = 1; i <=M; i++) {
		up[i] = up[i-1] * i;
		up[i] %= DIV;
	}

	bottom[0] = 1;
	for(long long i = 1; i <=M; i++) {
		bottom[i] = bottom[i-1] * modpow(i, DIV-2);
		bottom[i] %= DIV;
	}


	long long cur = 0;
	for(long long x = 0; x <= N; x++) {
		long long tmp = 0;
		//cout << "x = " << x << endl;

		//x子以上被る置き方(M-x)から(N-x)を選ぶ
		tmp = up[M - x];
		tmp *= bottom[M -  N];
		tmp = (tmp+DIV) % DIV;

		//cout << "up[" << M - x << "] * bottom[" << M - x - N << "]" << endl;

		//被るxこの場所の選び方
		tmp *= up[N];
		tmp = (tmp+DIV) % DIV;
		tmp *= bottom[N-x];
		tmp = (tmp+DIV) % DIV;
		tmp *= bottom[x];
		tmp = (tmp+DIV) % DIV;
		//cout << "up[" << N << "] bottom[" << N - x << "] bottom[" << x << "]" << endl;
		//cout << " tmp = " << tmp << endl;
		if(x % 2 == 0) {
			cur += tmp;
			cur = (cur + DIV) % DIV;
		}else{
			cur -= tmp;
			cur = (cur + DIV) % DIV;
		}
	}

	//親の配列の並び方 MからN個を並べる
	cur *= up[M];
	cur = (cur + DIV) % DIV;
	cur *= bottom[M-N];
	cur = (cur + DIV) % DIV;
	cout << cur << endl;
}



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

int main() {
	int n;cin>>n;
	vector<int> a(n);
	int flag=1;
	int max=0;
	for(int i=0;i<n;i++){
		cin>>a[i];
		if(a[i]!=a[0])flag=0;
		if(max<a[i])max=a[i];
	}
	for(int i=0;i<n;i++){
		if(a[i]<max-1){
			cout<<"No"<<endl;
			return 0;
		}
	}
	if(flag){
		if(n-1==max){
			cout<<"Yes"<<endl;
			return 0;
		}
		if(n/max>=2){
			cout<<"Yes"<<endl;
			return 0;
		}
		cout<<"No"<<endl;
		return 0;
	}
	int maxcat=0;
	for(int i=0;i<n;i++){
		a[i]-=max-1;
		maxcat+=a[i];
	}
	int singlecat=n-maxcat;
	int remcap=max-singlecat;
	if(remcap<=0){
		cout<<"No"<<endl;
		return 0;
	}
	if(maxcat/remcap>=2){
		cout<<"Yes"<<endl;
	}else{
		cout<<"No"<<endl;
	}

	return 0;
}

Measured memory_bytes: 640
//C++14 (Clang 3.8.0)

#include <vector>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <string>
#include <climits>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
const int maxn=2000003;
int bit1[maxn];
ll a[maxn];
ll b[maxn],c[maxn];
int main(){
  int n;
  ll k;
  cin>>n>>k;
  fill(a,a+maxn,0LL);
  fill(b,b+maxn,0LL);
  fill(c,c+maxn,0LL);
  for(int i=0;i<n;i++){
    int ta;
    ll tb;
    cin>>ta>>tb;
    a[ta]+=tb;
  }
  int now=1;
  for(int i=0;i<maxn;i++){
    if(a[i]!=0LL){
      b[now]=a[i];
      b[now]+=(ll)b[now-1];
      c[now]=(ll)i;
      now++; 
    }
  }
  
  for(int i=0;i<now;i++){
    if(b[i]>=(ll)k){
      cout<<c[i]<<endl;
      return 0;
    }
  }
  /*
  int l=-1,r=now-1,mid;
  while(r-l>1){
    mid=(l+r)/2;
    //cout<<l<<" "<<r<<" "<<mid<<" "<<b[mid]<<endl;
    if(b[mid]>=k)r=mid;
    else l=mid;
  }
  if(c[r]==k) cout<<c[r]<<endl;
  else
  */


  return 0;
}


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

int n;
vector<int> a;
vector<vector<int> > g;
int dfs(int u, int p) {
	if(g[u].size() == 1) return a[u];
	int mx = 0;
	long long sum = 0;
	for(int v: g[u]) if(v != p) {
		int ret = dfs(v, u);
		sum += ret;
		mx = max(ret, mx);
	}
	int pr;
	if(mx <= sum/2) pr = sum/2;
	else pr = sum - mx;
	if(a[u] <= sum && a[u] >= sum-pr) return 2*a[u]-sum; 
	else cout << "NO", exit(0);
}

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	cin >> n;
	a.resize(n);
	g.resize(n);
	for(int i = 0; i < n; i++) cin >> a[i];
	for(int i = 0, u, v; i < n-1; i++) {
		cin >> u >> v;
		u--;
		v--;
		g[u].push_back(v);
		g[v].push_back(u);
	}
	if(n == 2) {
		if(a[0] != a[1]) cout << "NO";
		else cout << "YES";
		exit(0);
	}
	int root = 0;
	while(g[root].size() == 1) root++;
	if(!dfs(root, -1)) cout << "YES";
	else cout << "NO";
}


Measured memory_bytes: 12800
#include <iostream>
#include <vector>
#include <map>
#include <unordered_map>
#include <queue>
#include <set>
#include <algorithm>
#include <string>
#include <math.h>
#include <limits.h>
#include <stack>
#include <complex>

using namespace std;

typedef long long ll;
typedef pair<ll, ll> P;


int main(){
    int N, a, b;
    cin >> N;
    if(N == 1){
        cout << "Hello World" << endl;
    }
    else{
        cin >> a >> b;
        cout << a + b << endl;
    }


    return 0;

}



Measured memory_bytes: 256
#include <iostream>
#include <sstream>
#include <vector>
#include <cassert>
#include <string>

int main(int argc, char const *argv[]) {
    std::string input_str;
    std::vector<int> input_vec;

    // for (int i = 0; !std::cin.eof(); i++) {
    //     int ret;
    //     std::cin >> input_str;
    //     std::istringstream iss(input_str);
    //     iss >> ret;
    //     input_vec.push_back(ret);
    // }

    std::getline(std::cin, input_str);
    std::istringstream iss(input_str);
    while (!iss.eof()) {
        int ret;
        iss >> ret;    
        input_vec.push_back(ret);
    }
    assert(input_vec.size() == 3);
    if(input_vec.at(0) < input_vec.at(1) && input_vec.at(1) < input_vec.at(2)) {
        std::cout << "Yes" << std::endl;
    } else {
        std::cout << "No" << std::endl;
    }
    return 0;
}



Measured memory_bytes: 3140
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
int main() {
  int A, B, C, D;
  cin >> A >> B >> C >> D;
  if(!(A == C)) {
    cout << 1 << endl;
  }
  else {
    cout << 0 << endl;
  }
}

Measured memory_bytes: 3616
#include<iostream>
#include<iomanip>
#include<vector>
#include<string>
#include<cstring>
#include<map>
#include<set>
#include<queue>
#include<stack>
#include<algorithm>
#include<cmath>
#include<cstdio>
#include<cstdlib>
#include<climits>
#include<fstream>

#define MOD (1000000007)

using namespace std;

typedef long long int Int;

constexpr Int TEN(int n) { return n == 0 ? 1 : 10 * TEN(n-1); }
map<int,int> m;
int N,Q;
struct point {
    int s,t,x;
};

vector<int> D;

int main(void) {
    cin>>N>>Q;

    struct point p[N];

    for(int i = 0;i < N;i++) {
        struct point temp;

        cin>>temp.s>>temp.t>>temp.x;
        
        p[i] = temp;
    }

    sort(p,p+N, [](const point &l, const point &r) {return l.x < r.x;});

    for(int i = 0;i < Q;i++) {
        int d;
        cin>>d;
        m[d] = i;
    }

    int ans[Q];
    memset(ans,-1,sizeof(ans));

    for(int i = 0;i < N;i++) {
        auto itr = m.lower_bound(p[i].s - p[i].x);
        int fin_time = p[i].t - p[i].x;
        while(itr != m.end() && itr->first < fin_time) {
            ans[itr->second] = p[i].x;
            m.erase(itr++);
        }
    }

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

    return 0;
}






Measured memory_bytes: 14336
n,m=gets.chomp.split.map(&:to_i)
a=[]
b=Hash.new(0)
n.times do
  aa,bb=gets.chomp.split.map(&:to_i)
  a << aa
  b[aa] += bb
end
a.sort!
a.uniq!
ans = 0
a.each do |v|
  if m <= b[v]
    ans += m * v
    puts ans
    exit
  end
  ans += v * b[v]
  m -= b[v]
end
puts ans




Measured memory_bytes: 15720
#include "bits/stdc++.h"
using namespace std;

int main() {
	long long N, M;
	cin >> N >> M;
	long long ans = min(N,M/2);
	N -= ans;
	M -= 2 * ans;
	ans += M / 4;
	cout << ans <<endl;
	return 0;
}

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

int main(){
        long long n;
        scanf("%lld", &n);

        long long open[n][10];
        for(long long i=0; i<n; i++){
                for(long long j=0; j<10; j++){
                        scanf("%lld", &open[i][j]);
                }
        }

        long long earn[n][11];
        for(long long i=0; i<n; i++){
                for(long long j=0; j<11; j++){
                        scanf("%lld", &earn[i][j]);
                }
        }

        long long mx = -1e9;
        for(long long i=1; i<1024; i++){
                long long sm = 0;
                for(long long j=0; j<n; j++){
                        long long cnt = 0;
                        for(long long k=0; k<10; k++) cnt += ((i>>k) & open[j][k]);
                        sm += earn[j][cnt];
                }
                mx = sm>mx? sm:mx;
        }
        printf("%lld\n", mx);
        return 0;
}

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

int main(){
	string s;
	cin >> s;
	vector<bool> al(26);
	rep(i, 26) al.at(i) = false;
	
	rep(i,s.size()){
		al.at(s.at(i)-'a') = true;
	}

	rep(i,26){
		if(!al.at(i)){
			cout << (char)(i+'a') << endl;
			return 0;
		}
	}
	cout << "None" << endl;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
#define DEBUG(x) cerr << (#x) << ": " << (x) << '\n'

using namespace std;

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

  int M, D; cin >> M >> D;
  int ans = 0;
  for (int m = 1; m <= M; ++m) {
    for (int d1 = 2; d1 <= 9; ++d1) {
      for (int d2 = 2; d2 <= 9; ++d2) {
        int d = d1 * 10 + d2;
        if (d > D) break;
        if (d1 * d2 == m) ++ans;
      }
    }
  }
  cout << ans << endl;

  cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<unordered_set>
using namespace std;
// SHUBHAM KHANNA //
#define ff              first
#define ss              second
//#define int             long long
#define pb              push_back
#define mp              make_pair
#define pii             pair<int,int>
#define vi              vector<int>
#define mii             map<int,int>
#define pqb             priority_queue<int>
#define pqs             priority_queue<int,vi,greater<int> >
#define setbits(x)      __builtin_popcountll(x)
#define zrobits(x)      __builtin_ctzll(x)
#define mod             1000000007
#define inf             1e18
#define ps(x,y)         fixed<<setprecision(y)<<x
#define mk(arr,n,type)  type *arr=new type[n];
#define w(x)            int x; cin>>x; while(x--)
#define rep(x,y)        for(int i=x;i<y;i++)

void solve() {
	int n;
	cin >> n;
	int a, b, cnt = 0;
	int max_cnt = -1;
	for (int i = 0; i < n; i++)
	{
		cin >> a >> b;
		if (a == b)
		{
			cnt++;
			if (cnt > max_cnt)
			{
				max_cnt = cnt;
			}
		}
		else
		{
			cnt = 0;
		}
	}
	if (max_cnt > 2)
	{
		cout << "Yes" << endl;
	}
	else
	{
		cout << "No" << endl;
	}

}

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

#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif

	solve();
	return 0;
}

Measured memory_bytes: 3632
#include<bits/stdc++.h>
#define fi first
#define se second
#define rep(i, n) for(int (i) = 0; (i) < (n); (i)++)
#define rrep(i, n) for (int (i) = 1; (i) <= (n); (i++))
#define rng(a) a.begin(),a.end()
#define rrng(a) a.rbegin(),a.rend()
#define pb push_back
#define eb emplace_back
#define yn {puts("Yes");}else {puts("No");}
#define printd(x) printf("%.20f\n", x);
template<class T> bool chmin(T& a, const T& b) {if (a > b) {a = b; return 1;} return 0;}
template<class T> bool chmax(T& a, const T& b) {if (a < b) {a = b; return 1;} return 0;}
using namespace std;
using ll = long long;

int main() {
	int n;
	cin >> n;
	int a[n];
	rep (i, n) cin >> a[i];
	int ans = 0;
	rep (i, n) {
		if (i % 2 == 0 && a[i] % 2) ans++; 
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 3632
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <vector>
#include <cmath>
using namespace std;

int L,R,d;
void input()
{
    cin>>L>>R>>d;
}

void solve()
{
    int ans=0;
    for(int i=L;i<=R;++i){
        if(i%d==0) ++ans;
    }
    cout<<ans<<endl;
}

int main()
{
    cin.tie();
    ios::sync_with_stdio(false);
    input();
    solve();
    return 0;
}

Measured memory_bytes: 3608
#include <iostream>
using namespace std;
const int M = 1000;
int main() {
	int N;
	cin >> N;
	int a[M][2];
	for (int i = 0;i<N;i++) cin >> a[i][0] >> a[i][1];

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

	cout << p;
}

Measured memory_bytes: 256
import java.util.*;
import java.lang.*;
 
public class Main{
  public static void main(String[] args){
    Scanner stdIn=new Scanner(System.in);
    double r=stdIn.nextDouble();
    double S=Math.PI*r*r, C=Math.PI*2*r;
    System.out.printf("%.6f %.6f",S,C);
  }
}


Measured memory_bytes: 28328
#include <cstdio>
#include <algorithm> 
using namespace std;
const int N = 128;
const int M = 10024;

struct T {int v, w;};
T a[N];
int dp[N][M];

int main()
{
	int n, w;
	scanf("%d %d", &n, &w);
	for (int i = 1;i  <= n; ++i)
		scanf("%d %d", &a[i].v, &a[i].w);
	
	for (int i = 1; i <= n; ++i)
	{
		for (int j = 1; j <= w; ++j)
		{
			if (a[i].w <= j)
			{
				dp[i][j] = max(dp[i-1][j-a[i].w] + a[i].v , dp[i-1][j]);
			}
			else 
			{
				dp[i][j] = dp[i-1][j];
			}
		}
	}
	printf("%d\n", dp[n][w]);	
	
	return 0;
}


Measured memory_bytes: 6680
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<n; i++)
//long long mo = 1e9 + 7;
typedef long long ll;
typedef pair<int,int> P;

int main(){
    int N;
    cin >> N;
    map<int, int> m{};
    int tmp;
    rep(i,N){
        cin >> tmp;
        m[tmp]++;
        if(m[tmp] == 2){
            cout << "NO" << endl;
            return 0;
        }
    }
    cout<< "YES" <<endl;
}


Measured memory_bytes: 9600
#include <bits/stdc++.h>
using namespace std;
const int maxn = 1234;
long long md2(long long v){
	v %= 2;
	if(v < 0) v += 2;
	return v;
}
long long x[maxn], y[maxn];
bool inside(long long x, long long y, int k){
	if(k == -1) return x == 0 && y == 0;
	if(md2(x) == md2(y)) return false;
	int v = 1<<(k+1); v--;
	return -v <= x && x <= v && -v <= y && y <= v && abs(x) + abs(y) <= v;
}
int main(){
	int n; cin >> n;
	for(int i = 0; i < n; i++) cin >> x[i] >> y[i];
	for(int i = 1; i < n; i++) if(md2(x[i] + y[i]) != md2(x[0] + y[0])) return !printf("-1\n");
	bool add = false;
	if(md2(x[0] + y[0]) == 0){
		add = true;
		for(int i = 0; i < n; i++) x[i] += 1;
	}
	const int bits = 31;
	cout << bits + add << endl;
	for(int i = 0; i < bits; i++) cout << (1<<i) << " "; 
	if(add) cout << 1;
	cout << endl;
	for(int i = 0; i < n; i++){
		long long cx = x[i], cy = y[i];
		string mvs;
		for(int j = bits - 1; j >= 0; j--){
			if(inside(cx - (1<<j), cy, j - 1)){
				cx -= 1<<j;
				mvs.push_back('R');
			} else if(inside(cx + (1<<j), cy, j - 1)){
				cx += 1<<j;
				mvs.push_back('L');
			} else if(inside(cx, cy - (1<<j), j - 1)){
				cy -= 1<<j;
				mvs.push_back('U');
			} else if(inside(cx, cy + (1<<j), j - 1)){
				cy += 1<<j;
				mvs.push_back('D');
			} else {
				assert(0);
			}
		}	
		reverse(mvs.begin(), mvs.end());
		if(add) mvs.push_back('L');
		long long myx = 0, myy = 0;
		for(int j = 0; j < bits; j++){
			if(mvs[j] == 'L') myx -= 1<<j;
			if(mvs[j] == 'R') myx += 1<<j;
			if(mvs[j] == 'U') myy += 1<<j;
			if(mvs[j] == 'D') myy -= 1<<j;
		}
		if(add) myx -= 1;
		cout << mvs << endl;
	}
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define eps 1e-3
#define pi acos(-1.0)
#define inf 0x3f
#define INF 0x3f3f3f3f
#define pb push_back
#define debug1 cout<<"&&";
#define debug2 cout<<"**";
#define ms(a, x) memset(a, x, sizeof(a))
#define for0(i, n) for(int i = 0; i < n; ++i)
#define for1(i, n) for(int i = 1; i <= n; ++i)
using namespace std;
typedef double db;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef pair<long long, int> pli;
typedef pair<long long, long long> pll;
const int mod = 1e9 + 7;
const int N = 3e3+10;
const int M = 1e6+10;
inline int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
inline ll Pow(ll a, ll b) { ll ans = 1; for( ; b; b >>= 1) { if(b&1) ans = ans * a % mod; a = a * a % mod;} return ans;}
inline ll Mul ( ll a, ll b)  { ll lf = a * ( b >> 25ll ) % mod * ( 1LL << 25 ) % mod; ll rg = a * ( b & ( ( 1ll << 25 ) - 1 ) ) % mod; return ( lf + rg ) % mod;}
inline ll C(ll y, ll x) { ll ans = 1; if(y < 0 || x < 0 || y < x) return 0; y %= mod; if(!y || !x) return 1; for0(i, x) ans = ans * (y-i) % mod; for1(i, x) ans = ans * Pow(i, mod-2) % mod; return ans; }
//==================================================================================================================================================================//

int n;
db p[N], dp[N][N];

int main() {
   scanf("%d", &n);
   for1(i, n) scanf("%lf", p+i);
   dp[0][0] = 1;
   for1(i, n) for(int j = 0; j <= i; ++j) {
      if(!j) dp[i][j] = dp[i-1][j] * (1.0 - p[i]);
      else dp[i][j] = dp[i-1][j] * (1.0 - p[i]) + dp[i-1][j-1] * p[i];
   }
   db ans = 0;
   for(int i = n/2+1; i <= n; ++i) ans += dp[n][i];
   printf("%.9lf\n", ans);
   return 0;
}

Measured memory_bytes: 49876
#include <iostream>
#include <string>
#include <algorithm>

using namespace std;

#define ll long long;
#define REP(i, n) for(int i = 0; i < (int)(n); i++)

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

    string s;
    bool flag = true;
    int firstA, lastZ;
    cin >> s;
    REP(i, s.size()) {
        if(flag && s[i] == 'A') {
            flag = false;
            firstA = i;
        }
        if(s[i] == 'Z') lastZ = i;
    }

    cout << lastZ - firstA + 1 << endl;


}



Measured memory_bytes: 720
#include <iostream>
#include <algorithm>

using namespace std;

int main (void)
{
	int n,a[100];

	cin >> n;

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

	int MAX = 0,co;

	for (int i = 0; i < n; i++)
	{
		co = 0;
		if (a[i] == 1)
		{
			for (int j = i; j < n + 1; j++)
			{
				if (a[j] == 0)
				{
					break;
				}
				co += 1;
			}
		}

		if (co > MAX)
		{
			MAX = 0;
			MAX = co;
		}
	}

	cout << MAX + 1 << endl;
}


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

vector<int> to_xor(vector<int> x)
{
    int n = x.size();
    vector<int> ret(n);
    for (int i = 0; i < n; i++)
    {
        ret[i] = x[i] ^ x[(i + 1) % n];
    }
    return ret;
}

template <typename T>
class MP
{
    long long n;
    T t;
    vector<long long> table;

public:
    MP(const T &str)
    {
        this->t = T(str);
        this->n = t.size();
        this->table = vector<long long>(this->n + 1, -1);
        long long j = -1;
        for (long long i = 0; i < this->n; i++)
        {
            while (j != -1 && this->t[j] != this->t[i])
            {
                j = this->table[j];
            }
            j++;
            this->table[i + 1] = j;
        }
    }

    int operator[](const int i)
    {
        return this->table[i];
    }

    vector<long long> find_from(const T &s)
    {
        vector<long long> res;
        long long j = 0;
        for (long long i = 0; i < s.size(); i++)
        {
            while (j != -1 && this->t[j] != s[i])
            {
                j = this->table[j];
            }
            j++;
            if (j == this->n)
            {
                res.push_back(i - j + 1);
                j = this->table[j];
            }
        }
        return res;
    }
};

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

    vector<int> a(N);
    for (int &aa : a)
    {
        cin >> aa;
    }
    vector<int> axor = to_xor(a);
    axor.insert(axor.end(), axor.begin(), axor.end());

    vector<int> b(N);
    for (int &bb : b)
    {
        cin >> bb;
    }
    vector<int> bxor = to_xor(b);

    MP<vector<int>> mp(bxor);
    for (int i : mp.find_from(axor))
    {
        if (i >= N)
        {
            continue;
        }
        cout << i << " " << (a[i] ^ b.front()) << endl;
    }
}


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

int main() {
    int a,p,b;
    cin >> a >> p >> b;

    string output = "NO";
    for (int i = 1; i < p; i++)
    {
        if(a * i % p == b)
        {
            output = "YES";
            break;
        }
    }
    cout << output << endl;
}   

Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;

public class Main {
	
	public static void main(String[] args) throws IOException {
		MyScanner sc = new MyScanner();
		PrintWriter out = new PrintWriter(System.out);
		int L = sc.nextInt();
		int N = sc.nextInt();
		int[] right = new int[N];
		int[] left = new int[N];
		for (int i = 0; i < right.length; i++) {
			right[i] = sc.nextInt();
			left[N-1-i] = L - right[i];
		}
		long[] acumR = new long[N+1];
		long[] acumL = new long[N+1];
		for (int i = 0; i < N; i++) {
			acumR[i+1] = acumR[i] + right[i];
			acumL[i+1] = acumL[i] + left[i];
		}
		long ans = Math.max(right[N-1], left[N-1]);
		for (int l = 1; l < N ; l++) {
			int r = N - l;
			int min = Math.min(l, r);
			long value = 0;
			value += 2 * (acumR[r] - acumR[r - min]);
			value += 2 * (acumL[l] - acumL[l - min]);
			value += Math.max(-right[r-1] + 2 * (r > min ? right[r - min - 1] : 0), -left[l-1] + 2 * (l > min ? left[l - min - 1] : 0));
			ans = Math.max(ans, value);
		}
		out.println(ans);
		
		out.flush();
	}
	
	static class MyScanner {
		private BufferedReader br;
		private StringTokenizer tokenizer;
		
		public MyScanner() {
			br = new BufferedReader(new InputStreamReader(System.in));
		}
		
		public String next() {
			while (tokenizer == null || !tokenizer.hasMoreTokens()) {
				try {
					tokenizer = new StringTokenizer(br.readLine());
				} catch (IOException e) {
					throw new RuntimeException(e);
				}
			}
			return tokenizer.nextToken();
		}
		
		public int nextInt() {
			return Integer.parseInt(next());
		}
		
		public long nextLong() {
			return Long.parseLong(next());
		}
	}
}


Measured memory_bytes: 43948