akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> l_l;
typedef pair<int , int> i_i;
typedef vector<ll> vl;
typedef vector<int> vi;
typedef vector<char> vec;
typedef vector<bool> veb;
typedef vector<string> ves;
typedef vector<vector<ll>> vvl;
typedef vector<vector<int>> vvi;
typedef vector<vector<char>> vvec;
typedef vector<vector<bool>> vveb;
typedef vector<vector<string>> vves;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<(int)(n);i++)
#define rep2(i,n) for(int i=2;i<(int)(n);i++)
#define repk(i,k,n) for(int i=k;i<(int)(n);i++)
#define fs first
#define sc second
#define pb push_back
#define pp pop_back
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define maxel(a) *max_element(all(a))
#define minel(a) *min_element(all(a))
#define acc accumulate
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
#define mod (1000000007)
typedef long long int64;
//const int64 INF = 1LL << 58;
#define dame { puts("-1"); return 0;}
#define YES { cout << "YES" << endl; return 0; }
#define NO { cout << "NO" << endl; return 0; }
#define Yes { cout << "Yes" << endl; return 0; }
#define No { cout << "No" << endl; return 0; }
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }
int dx[] = {0, 0, -1, 1};
int dy[] = {1, -1, 0, 0};

int p(int x, int y){
    if(y==0){return 1;}
    if(y==1){return x;}
    return p(x,y-1)*x;
}

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

    int n,k;
    cin >> n >> k;
    double x=0;
    rep1(i,n+1){
        int tmp = i;
        int cnt = 0; 
        while(tmp<k){
            tmp = (tmp << 1);
            cnt++;
        }
        int bunbo = n * p(2,cnt);
        x +=  (double) 1/bunbo  ;
    }
    cout << std::fixed << std::setprecision(15) << x << endl;
    
    return 0;
}

Measured memory_bytes: 256
using System;
class _0031
{
    public static void Main()
    {
        int[] weight = { 1, 2, 4, 8, 16, 32, 64, 128, 256, 512 };
        string str;
        int obj = 0, sum = 0, wMap = 0;
        bool flag = false;
        while ((str = Console.ReadLine()) != null)
        {
            obj = int.Parse(str);
            for (int i = 0; i < 1024; i++)
            {
                sum = 0;
                wMap = 0;
                for (int j = 0; j < 10; j++)if ((i >> j & 1) == 1) sum += weight[j];
                if (obj == sum) { wMap = i; break; }
            }
            flag = false;
            for (int i = 0; i < 10; i++)
            {
                if ((wMap >> i & 1) == 1)
                {
                    if (!flag) { Console.Write(weight[i]); flag = true; }
                    else Console.Write(" " + weight[i]);
                }
            }
            Console.Write('\n');
        }
    }
}

Measured memory_bytes: 5612
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using Graph=vector<vector<pair<int,ll>>>;
using pp=pair<ll,pair<ll,ll>>;
#define MAX 1000000
#define MOD 1000000007
#define INF 1000000000000000000

int main(){
  int D,T,S;
  cin>>D>>T>>S;
  if(S*T>=D){
    cout<<"Yes"<<endl;
  }else{
    cout<<"No"<<endl;
  }
}


Measured memory_bytes: 3620
#include <bits/stdc++.h>
#define be(v) (v).begin(),(v).end()
#define pb(q) push_back(q)
typedef long long ll;
using namespace std;
const ll mod=1000000007;
#define doublecout(a) cout<<fixed<<setprecision(10)<<a<<endl;
ll uni[200005];
ll root(ll u){
    if(uni[u]<0)return u;
    return uni[u]=root(uni[u]);
}

void connect(int a,int b){
    a=root(a);
    b=root(b);
    if(a==b)return;
    if(a>b){
        a^=b;
        b^=a;
        a^=b;
    }
    uni[a]+=uni[b];
    uni[b]=a;
    return;
}
int main() {
    cin.tie(0);
    cout.tie(0);
    ios::sync_with_stdio(false);
    memset(uni,-1,sizeof(uni));
    ll n,m;
    cin>>n>>m;
    ll k,x,a;
    for(int i=0;i<n;i++){
        cin>>k;
        for(int j=0;j<k;j++){
            cin>>x;
            x--;
            if(j){
                connect(x+100000,a);
            }
            else{
                a=x+100000;
            }
        }
        connect(a,i);
    }
    for(int i=1;i<n;i++){
        if(root(i)){
            cout <<"NO"<<endl;
            return 0;
        }
    }
    cout << "YES"<<endl;
    return 0;
}

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

int main() {
  int n,k;
  cin >> n >> k;
  int ans = 1;
  rep(i,n){
    ans = min({ans+k,ans*2});
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<stdlib.h>
//#define scanf scanf_s
#define gc() getchar()
typedef unsigned long long ull;
typedef  long long ll;
int in() {   // 非負整数の入力
	int n = 0; int c;
	c = gc();
	do n = 10 * n + (c & 0xf); while ((c = gc()) >= '0');
	return n;
}
int comp(const void* a, const void* b)//用来做比较的函数。
{
	return *(int*)a - *(int*)b;
}
ll qabs(ll a, ll b)
{
	if (a - b < 0) return b - a;
	else return a - b;
}
int main()
{
	ll n, k, m, t;
	scanf("%lld %lld", &n, &k);
	if (n == k) { printf("0\n"); return 0; }
	if (n < k) n += k;
	m = n % k;
	t = qabs(m , k);
	printf("%lld", m < t ? m : t);
}

Measured memory_bytes: 128
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.math.BigInteger;
import java.util.Arrays;
import java.util.StringTokenizer;

public class Main {
    public static void main(String[] args) {
        FastReader input = new FastReader();
        int n = input.nextInt();
        long[] arr = new long[n];
        for(int i = 0;i < n;i++){
            arr[i] = input.nextLong();
        }
        Arrays.sort(arr);

        BigInteger a1 = BigInteger.valueOf(arr[0]);
        BigInteger k = new BigInteger("1000000000000000000");

        for(int i = 1;i < n;i++){
            BigInteger b1 = BigInteger.valueOf(arr[i]);
            a1 = a1.multiply(b1);
            if(a1.compareTo(k) == 1){

                System.out.println(-1);
                return;
            }
        }
        System.out.println(a1);
    }
    static class FastReader
    {
        BufferedReader br;
        StringTokenizer st;

        public FastReader()
        {
            br = new BufferedReader(new
                    InputStreamReader(System.in));
        }

        String next()
        {
            while (st == null || !st.hasMoreElements())
            {
                try
                {
                    st = new StringTokenizer(br.readLine());
                }
                catch (IOException e)
                {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int nextInt()
        {
            return Integer.parseInt(next());
        }

        long nextLong()
        {
            return Long.parseLong(next());
        }

        double nextDouble()
        {
            return Double.parseDouble(next());
        }

        String nextLine()
        {
            String str = "";
            try
            {
                str = br.readLine();
            }
            catch (IOException e)
            {
                e.printStackTrace();
            }
            return str;
        }
    }
}


Measured memory_bytes: 53300
#include <stdio.h>

int main(void)
{
	int x,y,z,a,b,c,k,s;
	a = 0;
	scanf("%d %d",&k,&s);
	for (x = 0; x<=k;x++)
	{
		for (y = 0; y <= k ; y++)
		{
//			printf("%d %d %d\n",x,y,s-x-y);
			if (s-x-y <= k && s-x-y >= 0) a++;
		}
	}
	printf("%d",a);
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
struct Fast {Fast(){std::cin.tie(0);std::ios::sync_with_stdio(false);}} fast;
typedef long long ll;
typedef long double ld;
#define rep(i, n) for (ll i = 0; i < (int)(n); i++)
#define repR(i, n) for(ll i = n; i >= 0; i--)
#define For(i, m, n) for(ll i = m; i < n; i++)

#define pb push_back
#define eb emplace_back
#define mp make_pair
#define Fi first
#define Se second
#define ALL(v) v.begin(), v.end()

using namespace std;

ll mod = 1e9+7;
inline ll gcd(ll a, ll b){
    ll r = a % b;
    while(r!=0){
        a = b;
        b = r;
        r = a % b;
    }
    return b;
}

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

inline ll modinv(ll a, ll m) {
    ll b = m, u = 1, v = 0;
    while (b) {
        ll t = a / b;
        a -= t * b; swap(a, b);
        u -= t * v; swap(u, v);
    }
    u %= m;
    if (u < 0) u += m;
    return u;
}

inline ll nCr(ll n, ll r) {
    if ( r * 2 > n ) r = n - r;
    ll dividend = 1;
    ll divisor  = 1;
    for ( ll i = 1; i <= r; ++i ) {
        dividend *= (n-i+1);
        divisor  *= i;
    }
    return (dividend / divisor);
}

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

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

//階乗
inline ll factorialMethod(ll k){
    ll sum = 1;
    for (int i = 1; i <= k; ++i)
    {
        sum *= i;
    }
    return sum;
}

inline ll vector_finder(std::vector<ll> vec, ll number) {
    auto itr = std::find(vec.begin(), vec.end(), number);
    size_t index = std::distance( vec.begin(), itr );
    if (index != vec.size()) { // 発見できたとき
        return 1;
        
        
    }
    else { // 発見できなかったとき
        return 0;
    }
}

void recursive_comb(ll *indexes, ll s, ll rest, std::function<void(ll *)> f) {
    if (rest == 0) {
        f(indexes);
    } else {
        if (s < 0) return;
        recursive_comb(indexes, s - 1, rest, f);
        indexes[rest - 1] = s;
        recursive_comb(indexes, s - 1, rest - 1, f);
    }
}

void foreach_permutation(int n, std::function<void(int *)> f) {
    int indexes[n];
    for (int i = 0; i < n; i++) indexes[i] = i;
    do {
        f(indexes);
    } while (std::next_permutation(indexes, indexes + n));
}

void coutPrecision(ld ans){
    cout << fixed << setprecision(20) << ans << endl;
}

int main(){
    ll a, b, h, m;
    cin >> a >> b >> h >> m;
    
    ld tan = h * 30 + m * 0.5;
    ld cho = m * 6;
    
    ld kaku = abs(cho - tan);
    ld ans = a*a + b*b - (2*a*b*cos(M_PI * kaku / 180.0));
    coutPrecision(sqrt(ans));
    return 0;
}


Measured memory_bytes: 4156
#include <bits/stdc++.h>
using namespace std;
#define REP(i,a,n) for(int i=(a); i<(int)(n); i++)
#define rep(i,n) REP(i,0,n)
#define FOR(it,c) for(__typeof((c).begin()) it=(c).begin(); it!=(c).end(); ++it)
#define ALLOF(c) (c).begin(), (c).end()
typedef long long ll;
typedef unsigned long long ull;


int main(){
  ll A, B, N;
  cin >> A >> B >> N;

  ll x = min(B-1, N);

  cout << ((A*x)/B) - (A*(x/B)) << endl;
  
  return 0;
}



Measured memory_bytes: 3632
using System;
using System.Collections.Generic;
using System.Linq;

class Program
{
    static void Main()
    {
        Console.WriteLine(Solve());
        //Solve();
        return;
    }

    public static string Solve()
    {
        int[] input = ReadInts();
        int N = input[0], M = input[1];
        if (N == M) return "Yes";
        else return "No";
    }

    private static string Read() { return Console.ReadLine(); }
    private static int ReadInt() { return int.Parse(Read()); }
    private static long ReadLong() { return long.Parse(Read()); }
    private static double ReadDouble() { return double.Parse(Read()); }
    private static int[] ReadInts() { return Array.ConvertAll(Read().Split(), int.Parse); }
    private static long[] ReadLongs() { return Array.ConvertAll(Read().Split(), long.Parse); }
    private static double[] ReadDoubles() { return Array.ConvertAll(Read().Split(), double.Parse); }
}


Measured memory_bytes: 13140
#include <iostream>

int
main(int argc, char** argv) {
    int n;
    std::cin >> n;

    int ans = 0;
    int p, prev1, prev2;
    p = prev1 = prev2 = -1;
    for (int i = 0; i < n; i++) {
        std::cin >> p;

        //std::printf("%d, %d, %d\n", prev1, prev2, p);
        if ( (i >= 2) &&
             ( ((prev1 < prev2) && (prev2 < p)) ||
               ((prev1 > prev2) && (prev2 > p)) ) ) {
            ans++;
        }
        prev1 = prev2;
        prev2 = p;


    }
    std::printf("%d\n", ans);
    return 0;
}

Measured memory_bytes: 256
MOD = 998244353 
N = int(input())
D = [int(x) for x in input().split()]
zero = 0 
for d in D:
    zero += (d == 0)
if (D[0] != 0 or zero != 1):
    print(0)
else:
    lst = [0] * (N)
    for d in D:
        lst[d] += 1
    first0 = False
    for i in range(N):
        if (lst[i] != 0 and first0):
            print(0)
            exit()
        elif (lst[i] ==0):
            first0 = True
    ans = 1
    for i in range(N-1):
        ans *= lst[i] ** lst[i+1]
        ans %= MOD
    print(ans)


Measured memory_bytes: 52952
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
pair<int, int> par[100010];
int root(int x) {
    if (par[x].first == x) return x;
    return par[x].first = root(par[x].first);
}
void unite(int x, int y) {
    int rx = root(x), ry = root(y);
    if (rx == ry) return;
    par[ry].first = rx;
    par[rx].second += par[ry].second;
}
int ans[100010];
int main () {
    int N, M, K;
    cin >> N >> M >> K;
    for (int i = 1; i <= N; i++) {
        par[i].first = i;
        par[i].second = 1;
    }
    for (int i = 0; i < M; i++) {
        int A, B;
        cin >> A >> B;
        unite(A, B);
        ans[A]--;
        ans[B]--;
    }
    for (int i = 0; i < K; i++) {
        int C, D;
        cin >> C >> D;
        if (root(C) == root(D)) {
            ans[C]--;
            ans[D]--;
        }
    }
    for (int i = 1; i <= N; i++) {
        ans[i] += par[root(i)].second - 1;
        cout << ans[i] << endl;
    }
}

Measured memory_bytes: 2560
#include <bits/stdc++.h>
 
using namespace std;
 
int main() {
    int N, M;
    cin >> N >> M;
 
    string A[50], B[50];
    for (int i = 0; i < N; i++)
        cin >> A[i];
 
    for (int i = 0; i < M; i++)
        cin >> B[i];
 
    for (int i = 0; i + M <= N; i++) {
        for (int j = 0; j + M <= N; j++) {
            bool flag = true;
            for (int k = 0; k < M; k++) {
                if (A[i + k].substr(j, M) != B[k]) {
                    flag = false;
                }
            }
            if (flag) {
                cout << "Yes" << endl;
                return 0;
            }
        }
    }
    cout << "No" << endl;
 
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
#define all(a) (a).begin(),(a).end()

using namespace std;

int main(int argc, char const *argv[]) {
  int N;
  scanf("%d\n",&N);
  std::vector<int> A(N);
  std::vector<int> ans(100000,0);
  for (size_t i = 0; i < N; i++) {
    std::cin >> A[i];
    ++ans[A[i]];
    if(A[i]!=0){
      ++ans[A[i]-1];
    }
    if(ans[A[i]]!=99999){
      ++ans[A[i]+1];
    }
  }
  int max=ans[0];
  for (size_t i = 1; i < 100000; i++) {
    if(max<ans[i]){
      max=ans[i];
    }
  }
  printf("%d\n",max);
  return 0;
}


Measured memory_bytes: 1024
H, W = gets.chomp.split.map(&:to_i)
area = (H * W).to_i
area_half = (area / 2).to_i

if H == 1 || W == 1 || area == 2
  puts 1
elsif area.even?
  puts area_half
elsif !area.even?
  puts (area_half) + 1
end


Measured memory_bytes: 1916
#include<iostream>
#include<cstdio>
using namespace std;
main()
{
	char s[2];
	int now,k=1;
	for(now=1;now<=10;now++,k*=10)
	{
		printf("? %d\n",k);
		fflush(stdout);
		scanf("%s",s);
		if(s[0]=='N')break;
	}
	now--;
	if(now==10)
	{
		k=2;
		for(now=1;now<=10;now++,k*=10)
		{
			printf("? %d\n",k);
			fflush(stdout);
			scanf("%s",s);
			if(s[0]=='Y'){printf("! %d",k/2);fflush(stdout);return 0;}
		}
	}
	else
	{
		int l=k/10+1,r=k-1;
		while(l<=r)
		{
			if(l==r){printf("! %d",l);fflush(stdout);return 0;}
			if(l==r-1)
			{
				printf("? %lld\n",(long long)l*10);
				fflush(stdout);
				scanf("%s",s);
				if(s[0]=='Y'){printf("! %d",l);fflush(stdout);return 0;}
				else {printf("! %d",r);fflush(stdout);return 0;}
			}
			int mid=l+r>>1;
			printf("? %lld\n",(long long)mid*10);
			fflush(stdout);
			scanf("%s",s);
			if(s[0]=='Y')r=mid;
			else l=mid+1;
		}
	}
	return 0;
}
//1.控制字典序一定小  1,10,100...， 来确定数字位数或是不是10的次幂
//2.找出位数后，控制数字一定大， 二分ans，给交互库ans*10，比较字典序来确定数字 

Measured memory_bytes: 596
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<cmath>
#include<climits>
#include<map>
#include<set>
#include<queue>
#include<stack>
#include<bitset>
#include<iomanip>
using namespace std;

#define rep(i,j,n) for(int i=(j);i<(n);i++)
#define rep2(i,j,n) for(int i=(j);i<=(n);i++)
#define all(i) i.begin(),i.end()

typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<string> vs;
typedef vector<vector<string>> vvs;
typedef pair<int, int> pi;
typedef long long i64;

int main() {
	int n;
	while (cin >> n, n != 0) {
		vi s(n);
		int sum = 0;
		rep(i, 0, n) {
			cin >> s[i];
			sum += s[i];
		}
		sum -= *max_element(all(s)) + *min_element(all(s));
		cout << sum / (n - 2) << endl;
	}
}



Measured memory_bytes: 3088
#include <bits/stdc++.h>
using namespace std;
#define LL long long
#define N 100005
#define MOD 1000000007
#define dd double
#define pb push_back
#define mp make_pair
#define rep(i,n) for(int i=0;i<(n);++i)
#define repA(i,a,n) for(int i=a;i<=(n);++i)
#define repD(i,a,n) for(int i=a;i>=(n);--i)

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	
	string s,t;
	cin>>s>>t;

	int res = 0;

	for(int i=0; i<s.length(); i++) {
		if(s[i]!=t[i]) res++;
	}



	cout<<res<<endl;
	return 0;
}

Measured memory_bytes: 3800
import java.lang.Math.abs
import java.lang.Math.min

fun main(args:Array<String>?): Unit {
    val (t, d) = readLine()!!.trim().split(' ').map(String::toInt)
    val (ta, tb) = readLine()!!.trim().split(' ').map(String::toDouble)
    val (da, db) = readLine()!!.trim().split(' ').map(String::toInt)
    var minDiff = Double.MAX_VALUE
    for (sum in min(da, db) .. d){
        for (va in (0 .. sum / da).map{it * da}){
            val vb = (sum - va) / db * db
            val temp = (ta * va + tb * vb) / (va + vb)
            if (minDiff > abs(t - temp)) {
                minDiff = abs(t - temp)
            }
        }
    }
    println("%.10f".format(minDiff))
}


Measured memory_bytes: 34028
#define _CRT_SECURE_NO_WARNINGS
#include<bits/stdc++.h>
#define fi first
#define se second
#define pb push_back

using namespace std;
const long long MOD = (long long)1e9 + 7;

int k, n;

int main()
{
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    cin >> n >> k;
    cout << n - k + 1 << "\n";
    //system("pause");
    return 0;
}

Measured memory_bytes: 256
#pragma GCC optimize("Ofast")

#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>
#include <random>

using namespace std;
using namespace __gnu_pbds;

typedef
tree<pair<int, int>, null_type, less<pair<int, int>>, rb_tree_tag, tree_order_statistics_node_update> orderedSet;

#define pb push_back
#define F first
#define S second
#define all(a) (a).begin(), (a).end()

#define for1(i0, l0, r0) for (int i0 = l0; i0 < r0; ++i0)
#define for2(i0, l0, r0) for (int i0 = l0; i0 <= r0; ++i0)
#define forn(i0, n0) for (int i0 = 0; i0 < n0; ++i0)
#define forn1(i0, n0) for (int i0 = 1; i0 < n0; ++i0)
#define forr(i0, n0) for (int i0 = n0; i0 >= 0; --i0)
#define forr1(i0, r0, l0) for (int i0 = r0; i0 > l0; --i0)
#define forr2(i0, r0, l0) for (int i0 = r0; i0 >= l0; --i0)

#define Sort(a) sort(all(a))
#define Reverse(a) reverse(all(a))
#define relaxMax(a, b) a = max(a, b)
#define relaxMin(a, b) a = min(a, b)

typedef long long ll;
typedef long double ld;
#define ui unsigned int
#define ull unsigned long long

typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<double, double> pdd;
typedef pair<string, string> pss;

typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<double> vd;
typedef vector<ld> vld;
typedef vector<bool> vb;
typedef vector<string> vs;

typedef vector<pii> vpii;
typedef vector<pll> vpll;
typedef vector<pdd> vpdd;

typedef vector<vi> vvi;
typedef vector<vd> vvd;
typedef vector<vll> vvll;
typedef vector<vb> vvb;

#define vpss vector<pss>
#define vvs vector<vs>
#define vvpii vector<vpii>
#define vvpll vector<vpll>
#define vpt vector<pt>
#define vvvi vector<vvi>
#define vsi vector<set<int>>
#define ss second
#define ff first

#define printvi(arr) for (int x0 : arr) cout << x0 << ' '; cout << '\n';
#define printvll(arr) for (ll x0 : arr) cout << x0 << ' '; cout << '\n';
#define printpair(pair0) cout << pair0.F << ' ' << pair0.S << '\n';
#define printvp(arr) for (auto pair0 : arr) printpair(pair0);
#define initArray(arr, N0, X0) memset(arr, X0, N0 * sizeof(int))
//mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

void init() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    //cout.precision(16);
    //freopen("amusing.in", "r", stdin);
    //freopen("amusing.out", "w", stdout);
}

void solve() {
    int n;
    cin >> n;
    cout << n * (n + 1) / 2 << '\n';
}

bool multitest = false;

int main() {
    init();
    int t = 1;
    if (multitest) cin >> t;
    forn(i, t) solve();
}

Measured memory_bytes: 3584
#include<iostream>
#include<iomanip>
#include<string>
#include<set>
#include<vector>
#include<utility>
#include<queue>
#include<algorithm>
#include<functional>
using namespace std;
#define LL long long
#define MOD 100000
#define inf 2147483647



int main() {
	while (true) {
		int h, w;
		cin >> h >> w;
		if (h + w == 0)break;
		for (int i = 0; i < h; i++) {
			for (int j = 0; j < w; j++)cout << '#';
			cout << endl;
		}
		cout << endl;
	}


	return 0;
}



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

#define fastio ios_base::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL)
#define lli long long int
#define rep(i,n,z) for(int i=z;i<n;i++)
#define rrep(i,z) for(int i=z;i>=0;i--)
#define nl cout<<endl
#define vi vector<int>
#define vlli vector<long long int>
#define umap unordered_map
#define pb push_back
#define mp make_pair
#define ss second
#define ff first
#define ipair pair <int,int>
#define llipair pair <lli,lli>
#define pq priority_queue
#define displaymatrix(a,m,n) for(int i=0;i<m;i++){for(int j=0;j<n;j++)cout<<a[i][j]<<" ";cout<<endl;}
#define printarray(a,n) for(int i=0;i<n;i++){cout<<a[i]<<" ";}nl;
#define vinput(a,n) vlli a(n);rep(i,n,0)cin>>a[i]
#define ainput(a,n) rep(i,n,0)cin>>a[i]
#define SO(a) sort(a.begin(),a.end())
#define all(x) (x).begin(),(x).end()
#define SOP(a,comp) sort(a.begin(),a.end(),comp)
#define inf INT_MAX
#define endl '\n'


void solve(){
    int n, x, t;
    cin>>n>>x>>t;
    cout<<(int)ceil(1.0*n/x)*t<<endl;
}


int main()
{
    fastio;
    int t;
    // cin>>t;
    t =1;
    while(t--)solve();

}

Measured memory_bytes: 3620
#include <iostream>
#include <vector>
#include <map>
#include <string>
#include <math.h>
#include <algorithm>
#include <numeric>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); i++)

int main() {
    int n, k;
    cin >> n >> k;
    
    vector<bool> has(n);
    rep(i, k) {
        int d;
        cin >> d;
        rep(j, d) {
            int a;
            cin >> a;
            has[a-1] = true;
        }
    }

    int cnt = 0;
    rep(i, n) {
        if (has[i] == false) cnt++;
    }
    cout << cnt << endl;
}

Measured memory_bytes: 3632
#include <bits/stdc++.h>
using namespace std;
const long long int MOD = 1e9 + 7;

int n;
vector<vector<int>> graph;
vector<long long int> pow2;

long long int ans = 0;
int DFS(int v, int parent_v = -1){
    vector<int> subtree_sizes;
    int total = 1;// self

    for(int child_v : graph[v]){
        if(child_v == parent_v) continue;

        int sub = DFS(child_v, v);
        subtree_sizes.push_back(sub);
        total += sub;
    }
    if(parent_v != -1) subtree_sizes.push_back(n - total);

    long long int add = pow2[n-1] - 1;
    for(int s : subtree_sizes){
        add -= pow2[s] - 1;
        add = (add % MOD + MOD) % MOD;
    }
    ans += add;
    ans %= MOD;

    return total;
}

long long int modpow(long long int b, long long int p){
    long long int num = 1, power = b;
    for(int i=0; i<=30; i++){
        if((p>>i) & 1){
            num *= power;
            num %= MOD;
        }

        power *= power;
        power %= MOD;
    }
    return num;
}

int main(){
    cin >> n;

    graph.resize(n);
    for(int i=0; i<n-1; i++){
        int a, b;
        cin >> a >> b;
        a -= 1;
        b -= 1;
        graph[a].push_back(b);
        graph[b].push_back(a);
    }

    pow2.resize(n+1, 1);// pow2[i] = 2^i
    for(int i=0; i<n; i++){
        pow2[i+1] = pow2[i] * 2;
        pow2[i+1] %= MOD;
    }

    DFS(0);
    //cout << ans << " " << pow2[n] << " ";

    long long int x = modpow(pow2[n], MOD-2);
    //cout << ((x * pow2[n]) % MOD)<< endl;
    ans *= x;
    ans %= MOD;
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 31416
#include <cstdio>
#include <cstring>
#include <string>
#include <cmath>
#include <cassert>
#include <iostream>
#include <algorithm>
#include <stack>
#include <queue>
#include <vector>
#include <set>
#include <map>
#include <bitset>
#include <functional>
#include <numeric>
using namespace std;

#define repl(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define rep(i,n) repl(i,0,n)
#define mp(a,b) make_pair((a),(b))
#define pb(a) push_back((a))
#define all(x) (x).begin(),(x).end()
#define dbg(x) cout<<#x"="<<((x))<<endl
#define fi first
#define se second

#define INF 2147483600
#define long long long

int main(){
  int n,m,t;
  cin>>n>>m>>t;
  vector<bool> vec(t,false);
  rep(loop,n){
    int a;
    cin>>a;
    for(int i=max(0,a-m); i<min(t,a+m); i++){
      vec[i]=true;
    }
  }
  int res=0;
  rep(i,t) if(!vec[i]) res++;
  cout << res<<endl;

  return 0;
}

Measured memory_bytes: 3088
a=list(map(int, input().split()))
b=list(map(int, input().split()))
c=list(map(int, input().split()))
A = [a,b,c]
N = int(input())
b = []
temp = []
for _ in range(N):
    inp = int(input())
    for y, row in enumerate(A):
        try:
            temp.append([y, row.index(inp)])
            break
        except ValueError:
            pass
if ([0,0] in temp and [1,0] in temp and [2,0] in temp) or([0,1] in temp and [1,1] in temp and [2,1] in temp)or([0,2] in temp and [1,2] in temp and [2,2] in temp)or([0,0] in temp and [0,1] in temp and [0,2] in temp)or([1,0] in temp and [1,1] in temp and [1,2] in temp)or([2,0] in temp and [2,1] in temp and [2,2] in temp)or([0,0] in temp and [1,1] in temp and [2,2] in temp)or([0,2] in temp and [1,1] in temp and [2,0] in temp):
	print("Yes")
else:
    print("No")

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

n,m,x=map(int,input().split())
r=map(int,input().split())

r0=0
rn=0

for i in r:
    if i<x:
        r0=r0+1
    else:
        rn=rn+1


if r0<rn:
    print(r0)
else:
    print(rn)




Measured memory_bytes: 2940
from itertools import product as p
n,m = [int(i) for i in input().split()]
a = [[int(i) for i in input().split()] for j in range(n)]
c = [1,-1]
ans = 0
for l,j,k in p(c,repeat=3):
    ans = max(ans,sum(sorted([a[i][0]*l+a[i][1]*j+a[i][2]*k for i in range(n)])[n-m:])) 
print(ans)

Measured memory_bytes: 3328
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int S;
  cin >> S;
  cout << S / 100 + (S - S / 100 * 100) / 10 + S - S / 100 * 100 - (S - S / 100 * 100) / 10 * 10 << endl;
}


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

template<class T> struct FenwickTree {
  const int n;
  vector<T> t;
  FenwickTree(int _n) : n(_n), t(n + 1) {}
  void add(int i, T x) { for (++i; i <= n; i += i & -i) t[i] += x; }
  T sum(int i) const {
    T s = 0;
    for (; i; i -= i & -i) s += t[i];
    return s;
  }
  T sum(int l, int r) const { return sum(r) - sum(l); }
};

int main() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  int n, k;
  cin >> n >> k;
  vector<int> a(n);
  for (auto&& e : a) {
    cin >> e;
    e -= k;
  }
  vector<long long> c(n + 1);
  for (int i = 0; i < n; ++i) {
    c[i + 1] = c[i] + a[i];
  }
  auto v = c;
  sort(begin(v), end(v));
  v.erase(unique(begin(v), end(v)), end(v));
  for (auto&& e : c) {
    e = lower_bound(begin(v), end(v), e) - begin(v);
  }
  FenwickTree<int> ft(n + 1);
  long long res = 0;
  for (int i = 0; i <= n; ++i) {
    res += ft.sum(c[i] + 1);
    ft.add(c[i], 1);
  }
  cout << res << '\n';
}



Measured memory_bytes: 5184
var read = require('readline').createInterface({
  input: process.stdin,
  output: process.stdout
});
var obj;
var inLine = [];
read.on('line', function(input){inLine.push(input);});
read.on('close', function(){
  obj = init(inLine);
  myerr("-----start-----");
  var start = new Date();
  Main();
  var end = new Date() - start;
  myerr("----- end -----");
  myerr("time : " + (end) + "ms");
});
function nextInt(){return myconv(next(),1);} function nextStrArray(){return myconv(next(),2);}
function nextIntArray(){return myconv(next(),4);} function nextCharArray(){return myconv(next(),6);}
function next(){return obj.next();} function hasNext(){return obj.hasNext();}
function init(input){  
  var returnObj = {
    list : input, index : 0, max : input.length,
    hasNext : function(){return (this.index < this.max);},
    next : function(){if(!this.hasNext()){throw "ArrayIndexOutOfBoundsException これ以上ないよ";}else{var returnInput = this.list[this.index];this.index++;return returnInput;}}
  };
  return returnObj;
}
function myout(s){console.log(s);}
function myerr(s){console.error("debug:" + require("util").inspect(s,false,null));}
//[no]要素の扱い。数値型
//不明値、異常時:引数そのまま返す 1:数値へ変換
//2:半角SPで分割 4:半角SPで分割し、数値配列へ
//6:1文字で分割  7:1文字で分割し、数値配列へ
//8:半角SPで結合 9:改行で結合 0:文字なしで結合
function myconv(i,no){try{switch(no){case 1:return parseInt(i);case 2:return i.split(" ");case 4:return i.split(" ").map(Number);case 6:return i.split("");case 7:return i.split("").map(Number);case 8:return i.join(" ");case 9:return i.join("\n");case 0:return i.join("");default:return i;}}catch(e){return i;}}
function Main(){
	var one = nextIntArray();
	var N = one[0];
	var M = one[1];
	var list = new Array(N);
	for(var i = 0; i < N; i++){
		list[i] = {
			child : [],
			access : false,
			from : null
		};
	}
	for(var i = 0; i < M; i++){
		var tmp = nextIntArray();
		list[tmp[0] - 1].child.push(tmp[1] - 1);
		list[tmp[1] - 1].child.push(tmp[0] - 1);
	}
	
	var queue = new Array(100000);
    queue[0] = 0;
    var maeIndex = 0;
  	var atoIndex = 1;
	list[0].access = true;
	list[0].from = 0;
	while(maeIndex != atoIndex){
		var tmp = queue[maeIndex];
      	maeIndex++;
		var child = list[tmp].child;
		for(var i = 0; i < child.length; i++){
			if(!list[child[i]].access){
				list[child[i]].access = true;
				list[child[i]].from = tmp + 1;
				queue[atoIndex] = child[i];
              	atoIndex++;
			}
		}
	}
	var output = new Array(N);
	output[0] = "Yes";
	for(var i = 1; i < N; i++){
		if(list[i].from == null){
			myout("No");
			return;
		}
		output[i] = list[i].from;
	}
	myout(myconv(output,9));
}


Measured memory_bytes: 107752
s = list(input())

k = 1000
ans = [0]*3
for i in range(len(s)-2):
  str = s[i:i+3]
#  print(str)
#  print(''.join(str))
  sel_num = int(''.join(str))
  if abs(sel_num - 753) < k:
    ans = sel_num
    k = abs(sel_num - 753)
#print(ans)
#print(type(ans))         
print(abs(ans - 753))


Measured memory_bytes: 2940
#include<bits/stdc++.h>
#define REP(i, a, b) for(int i=a; i<(int)(b); i++)
#define RREP(i, a, b) for(int i=b; i>=(int)(a); i--)
#define ALL(v) v.begin(), v.end()
#define INF 2e9
typedef long long ll;
template<class T>bool chmax(T &a, const T &b){if(a<b){a=b; return 1;}return 0;}
template<class T>bool chmin(T &a, const T &b){if(a>b){a=b; return 1;}return 0;}

using namespace std;

int main(void)
{
	int N;
	cin >> N;
	string s;
	cin >> s;
	int R=0;
	int B=0;
	REP(i, 0, N){
		if(s[i]=='R'){
			R++;
		}else{
			B++;
		}
	}
	if(R>B){
		cout << "Yes";
	}else{
		cout << "No";
	}
	cout << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) begin(v),end(v)
#define fi first
#define se second
template<typename A, typename B> inline bool chmax(A &a, B b) { if (a<b) { a=b; return 1; } return 0; }
template<typename A, typename B> inline bool chmin(A &a, B b) { if (a>b) { a=b; return 1; } return 0; }
using ll = long long;
using pii = pair<int, int>;
constexpr ll INF = 1ll<<30;
constexpr ll longINF = 1ll<<60;
constexpr ll MOD = 1000000007;
constexpr bool debug = 0;
//---------------------------------//

vector<int> sieve(int n) {
	vector<int> res;
	vector<bool> is_prime(n + 1, true);
	
	is_prime[0] = is_prime[1] = false;
	
	for (ll i = 2; i * i <= n; i++) if (is_prime[i]) {
		res.push_back(i);
		for (ll j = 1; i * j <= n; j++) is_prime[i * j] = false;
	}
	
	REP(i, n + 1) if (is_prime[i]) res.push_back(i);
	sort(res.begin(), res.end());
	return res;
}

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

int main() {
	int N;
	cin >> N;
	vector<int> A(N);
	REP(i, N) scanf("%d", &A[i]);
	
	
	constexpr int MAXA = 1000000;

	auto prime = sieve(MAXA);
	
	vector<int> cnt(MAXA + 1);
	REP(i, N) ++cnt[A[i]];
	
	bool pairwise = true;
	for (int p : prime) {
		int cur = p;
		int sum = 0;
		while (cur <= MAXA) {
			sum += cnt[cur];
			cur += p;
		}
		if (sum > 1) pairwise = false;
	}
	
	int g = A[0];
	FOR(i, 1, N) g = gcd(g, A[i]);
	
	if (pairwise) puts("pairwise coprime");
	else if (g == 1) puts("setwise coprime");
	else puts("not coprime");
	
	return 0;
}


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

typedef long long ll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef pair<ll,ll> pll;
typedef vector<bool> vb;
const ll oo = 0x3f3f3f3f3f3f3f3f;
const double eps = 1e-9;
#define sz(c) ll((c).size())
#define all(c) begin(c), end(c)
#define FOR(i,a,b) for (ll i = (a); i < (b); i++)
#define FORD(i,a,b) for (ll i = (b)-1; i >= (a); i--)
#define mp make_pair
#define mt make_tuple
#define pb push_back
#define eb emplace_back
#define xx first
#define yy second
#define has(c,i) ((c).find(i) != end(c))
#define DBGDO(X) ({ if(1) cerr << "DBGDO: " << (#X) << " = " << (X) << endl; })

vl cnt(2), col;
vvl adj;

bool dfs(ll i) {
	for (ll j: adj[i]) {
		if (col[j] == -1) {
			col[j] = !col[i];
			cnt[col[j]]++;
			if (!dfs(j)) return false;
		} else {
			if (col[j] == col[i]) return false;
		}
	}
	return true;
}

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	
	ll n, m; cin >> n >> m;
	adj.resize(n);
	col.resize(n,-1);
	FOR(i,0,m) {
		ll a, b; cin >> a >> b;
		a--, b--;
		adj[a].pb(b);
		adj[b].pb(a);
	}
	
	col[0] = 0;
	cnt[0]++;
	if (dfs(0)) {
		cout << cnt[0]*cnt[1]-m << endl;
	} else {
		cout << n*(n-1)/2 - m << endl;
	}
}



Measured memory_bytes: 7296
#[allow(unused_imports)]
use std::cmp;
#[allow(unused_imports)]
use std::collections::*;
#[allow(unused_imports)]
use std::vec::Vec;

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

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

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

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

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

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

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

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

fn main() {
    input!{
        n: usize,
        a: [isize;n],
    }
    let mut a = a
        .into_iter()
        .enumerate()
        .map(|(i, x)| x - i as isize - 1)
        .collect::<Vec<isize>>();
    a.sort();
    let b = a[n / 2];
    let sum = a.into_iter().fold(0, |acc, x| acc + (x - b).abs());
    println!("{}", sum);
}


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

struct iostream_init_struct
{ 
	iostream_init_struct()
	{
		std::cin.tie(0);
		std::cin.sync_with_stdio(false);
	}
} iostream_init;

int main()
{
	int sx, sy, tx, ty;
	cin >> sx >> sy >> tx >> ty;
	int x = sx;
	int y = sy;

	//s
	assert(x == sx && y == sy);
	for (; y < ty; ++y)
		cout << 'U';
	for (; x < tx; ++x)
		cout << 'R';
	// t
	assert(x == tx && y == ty);
	for (; y > sy; --y)
		cout << 'D';
	for (; x > sx; --x)
		cout << 'L';
	// s
	assert(x == sx && y == sy);
	cout << 'D'; --y;
	for (; x < tx + 1; ++x)
		cout << 'R';
	for (; y < ty; ++y)
		cout << 'U';
	cout << 'L'; --x;
	//t
	assert(x == tx && y == ty);
	cout << 'U'; ++y;
	for (; x > sx - 1; --x)
		cout << 'L';
	for (; y > sy; --y)
		cout << 'D';
	cout << 'R'; ++x;
	assert(x == sx && y == sy);

	cout << endl;
	return 0;
}

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

#define vec                vector<int>
#define vecll              vector<ll>
#define vecd               vector<double>
#define vecst              vector<string>
#define vecb               vector<bool>
#define vec2(var, n, m)    vector<vector<int>> var(n, vector<int>(m, 0))
#define vecll2(var, n, m)  vector<vector<ll>> var(n, vector<ll>(m, 0))

#define rep(i,n)         for(ll i=(ll)0; i<(ll)n; i++)
#define REP(i,m,n)       for(ll i=(ll)m; i<(ll)n; i++)
#define arr(var, n)      vec var(n); rep(i,n){cin >> var[i];}
#define arrll(var, n)    vecll var(n); rep(i,n){cin >> var[i];}
#define arrst(var, n)    vecst var(n); rep(i,n){cin >> var[i];}
#define all(var)         (var).begin(), (var).end()
#define sortall(var)     sort(all(var))
#define uniqueall(v)     v.erase(unique(v.begin(), v.end()), v.end());
#define f_sum(var)       accumulate(all(var), 0)
#define f_sumll(var)     accumulate(all(var), 0LL)
#define chmin(v1, v2)    v1 = min(v1, v2)
#define chmax(v1, v2)    v1 = max(v1, v2)
#define pb(var)          push_back(var)
#define prt(var)         cout << (var) << "\n"
#define prtd(n, var)     cout << fixed << setprecision(n) << (var) << "\n"
#define prtfill(n, var)  cout << setw(n) << setfill('0') << (var);
#define prt2(v1, v2)     cout << (v1) << " " << (v2) << "\n"
#define prt3(v1, v2, v3) cout << (v1) << " " << (v2) << " " << (v3) << "\n"
#define prtall(v)        rep(i,v.size()){cout<<v[i]<<(i!=v.size()-1?" ":"\n");}
void prtok(bool ok){prt(ok ? "YES" : "NO");}
//----------------------------------------------------------------

int main(void) {
  ll a, v, b, w, t;
  cin >> a >> v >> b >> w >> t;

  bool ans=false;
  if(a==b){
    ans=true;
    prtok(ans);
    return 0;
  }

  ll dist = abs(a-b);
  if(v>w && (v-w)*t>=dist){
    ans=true;
  } else {
    ans=false;
  }

  prtok(ans);
}


Measured memory_bytes: 3672
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <queue>
#include <cmath>
#include <climits>
#include <iomanip>
#include <set>
#include <map>
using namespace std;
typedef long long ll;
int main(){
  ll a,b;
  cin >> a >> b;
  if((a + b) % 2 == 1)cout << "IMPOSSIBLE" << endl;
  else cout << (a + b) / 2 << endl;
}

Measured memory_bytes: 256
/*
    飲んだ魔剤で家が建つ。
    created at: 2020-04-02 22:40:45
*/

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

#define all(x) (x).begin(),(x).end()
#define rev(x) greater<(x)>()
#define MOD 1000000007
#define INF 1000000000

typedef long long LL;
typedef long double LD;

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

LL modpower(LL n, LL m, LL mod) {
    if (m == 0) {
        return 1;
    } else if (m % 2 == 0) {
        LL p = modpower(n, m/2, mod);
        return p*p % mod;
    } else {
        return n*modpower(n, m-1, mod) % mod;
    }
}

LL modinv(LL n, LL mod) {
    return modpower(n, mod-2, mod);
}

LL modcombination(LL n, LL r, LL mod) {
    LL ret = 1;

    for (int i = 0; i < r; i++) {
        ret *= (n-i);
        ret %= mod;
        ret *= modinv(i+1, mod);
        ret % mod;
    }

    return ret % mod;
}

int gcd(int k, int l) {
    if (l > 0) return gcd(l, k%l);
    else return k;
}

ostringstream oss_global;
string s_global = oss_global.str();

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

    int ans = 0;
    for (int i = 0; i < n-1; i++) {
        for (int j = i+1; j < n; j++) {
            int diff = abs(a[i] - a[j]);
            if (ans < diff) ans = diff;
        }
    }

    cout << ans << endl;

    return 0;
}


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

using namespace std;

typedef long long ll;

const int INF = 1e9+7;
int n, m, ans = 0;

vector <vector <int>> g;
vector <bool> used;
vector <int> d;

void dfs(int v)
{
    used[v] = 1;
    for (auto u:g[v])
    {
        if (!used[u])
            dfs(u);
        d[v] = max(d[v], d[u] + 1);
    }
    ans = max(ans, d[v]);
}

int main()
{
    cin >> n >> m;
    g.resize(n);
    used.resize(n);
    d.resize(n);

    for (int i=0; i<m; ++i)
    {
        int a, b;
        cin >> a >> b;
        --a; --b;
        g[a].push_back(b);
    }

    for (int i=0; i<n; ++i)
        dfs(i);
    cout << ans;
    return 0;
}

Measured memory_bytes: 8192
#include<bits/stdc++.h>
using namespace std;
int n;
long long f[10000001];
long long ans;
int main(){
	long long i,j;
	cin>>n;
	/*
	for(i=2;i<=n;++i){
		if(a[i]==0){
			v.push_back(i);
		}
		for(j=0;j<v.size()&&i*v[j]<=n;++j){
			a[i*v[j]]=1;
		}
	}
	///
	for(i=1;i<=n;++i)f[i]=1;
	for(i=0;i<v.size();++i){
		int s=v[i];
		while(s<=n){
			for(j=1;s*j<=n;++j){
				f[s*j]*=
			}
		}
	}
	*/
	for(i=1;i<=n;++i){
		for(j=1;i*j<=n;++j){
			++f[i*j];
		}
	}
	for(i=1;i<=n;++i){
		ans+=i*f[i];
	}
	cout<<ans;
}

Measured memory_bytes: 81624
#include <bits/stdc++.h>
 
#define endl '\n'
#define fi first
#define se second
#define MOD(n,k) ( ( ((n) % (k)) + (k) ) % (k))
#define forn(i,n) for (int i = 0; i < (n); i++)
#define forr(i,a,b) for (int i = a; i <= b; i++)
#define all(v) v.begin(), v.end()
#define pb(x) push_back(x)
 
using namespace std;
 
typedef long long ll;
typedef long double ld;
typedef pair<int, int> ii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ii> vii;

string s;

int main () {
	ios_base::sync_with_stdio(0); cin.tie(0);
	
	cin >> s; 
	for (char c : s) {
		if (c == '?') cout << 'D';
		else cout << c;
	}
	cout << endl;

	return 0;
}

Measured memory_bytes: 3788
import java.util.Scanner;

public class Main
{
	public static void main(String[] args)
	{
		Scanner sc = new Scanner(System.in);
		String a = sc.nextLine();
		String ans="A";
		sc.close();
		if (a.compareTo("a")>=0 && a.compareTo("z")<=0) ans = "a";
		System.out.println(ans);
	}
}


Measured memory_bytes: 26860
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);

		int n = sc.nextInt();
		int m = sc.nextInt();
		int c = sc.nextInt();
		int[] b = new int[m];
		int[][] a = new int[n][m];

		for (int i = 0; i < m; i++) {
			b[i] = sc.nextInt();
		}

		for (int i = 0; i < n; i++) {
			for (int j = 0; j < m; j++) {
				a[i][j] = sc.nextInt();
			}
		}

		int count = 0;

		for (int i = 0; i < n; i++) {
			int sum = c;
			for (int j = 0; j < m; j++) {
				sum += a[i][j] * b[j];
			}
			if (sum > 0) {
				count++;
			}
		}

		System.out.print(count);
	}
}

Measured memory_bytes: 24148
#include <iostream>

using namespace std;

int main()
{
  long n, a, b;
  cin >> n >> a >> b;
  
  if ((a+b) % 2)
    if (a+b < 1+n)
      a = 1 - a;
    else
      a = 2 * n + 1 - a;
      
  cout << (a > b ? (a-b)/2 : (b-a)/2) << endl;
}


Measured memory_bytes: 256
#!usr/bin/env python3
from collections import defaultdict
from collections import deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
import itertools
sys.setrecursionlimit(10**5)
stdin = sys.stdin
def LI(): return list(map(int, stdin.readline().split()))
def LF(): return list(map(float, stdin.readline().split()))
def LI_(): return list(map(lambda x: int(x)-1, stdin.readline().split()))
def II(): return int(stdin.readline())
def IF(): return float(stdin.readline())
def LS(): return list(map(list, stdin.readline().split()))
def S(): return list(stdin.readline().rstrip())
def IR(n): return [II() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def FR(n): return [IF() for _ in range(n)]
def LFR(n): return [LI() for _ in range(n)]
def LIR_(n): return [LI_() for _ in range(n)]
def SR(n): return [S() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
mod = 1000000007

#A
def A():
    s = S()
    if "9" in s:
        print("Yes")
    else:
        print("No")
    return

#B
def B():
    n = II()
    ans = 0
    for i in range(n):
        l, r = LI()
        ans += r - l + 1
    print(ans)
    return

#C
def C():
    n = II()
    A = {}
    for _ in range(n):
        k = II()
        if not k in A:
            A[k] = 1
        else:
            A[k] += 1
    ans = 0
    for item in A.values():
        ans += item % 2
    print(ans)
    return

#D
def D():
    return

#Solve
if __name__ == '__main__':
    B()

Measured memory_bytes: 39024
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
ll P[100012];
ll J[100012];
int main()
{
	while(true){
		int N;
		scanf("%d",&N);
		if(N==0)break;
		for(int i=0;i<N;i++)scanf("%lld",&P[i]);
		for(int i=0;i<N-1;i++)scanf("%lld",&J[i]);
		sort(J,J+N-1);reverse(J,J+N-1);
		ll ans=0;ll sum=0;
		for(int i=0;i<N;i++){
			sum+=P[i];
		}
		ans=sum*N;
		for(int i=0;i<N-1;i++){
			sum+=J[i];
			ans=max(ans,sum*(N-1-i));
		}
		printf("%lld\n",ans);
	}
	return 0;
}

Measured memory_bytes: 2224
#include "bits/stdc++.h"
using namespace std;
int main() {
	int H, W;
	cin >> H >> W;
	int N;
	cin >> N;
	vector<int>A(N);
	vector<int>B(H * W);
	int k = 0;
	for (int i = 0; i < N; i++) {
		cin >> A.at(i);
		for (int j = 0; j < A.at(i); j++) {
			B.at(k) = i + 1;
			k++;
		}
	}
	k = 0;
	vector<vector<int>>ans(H, vector<int>(W));
	for (int i = 0; i < H; i++) {
		if (i % 2 == 0) {
			for (int j = 0; j < W; j++) 
			{
				ans.at(i).at(j) = B.at(k);
				k++;
			}
		}
		else {
			for (int j = W - 1; j >= 0; j--) {
				ans.at(i).at(j) = B.at(k);
				k++;
			}
		}
	}
	for (int i = 0; i < H; i++) {
		for (int j = 0; j < W; j++) {
			cout << ans.at(i).at(j);
			if (j != W - 1) cout << ' ' ;
		}
		cout << endl;
	}
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
int main(void)
{
	int n, q;
	cin >> n >> q;
	vector<vector<int>> G(n);
	for (int i = 0; i < n-1; i++) {
		int a, b;
		cin >> a >> b;
		G[a-1].push_back(b-1);
		G[b-1].push_back(a-1);
	}
	vector<long long> xs(n, 0);
	for (int i = 0; i < q; i++) {
		int p, x;
		cin >> p >> x;
		xs[p-1] += x;
	}
	vector<int> parents(n);
	vector<bool> visited(n, false);
	queue<int> que;
	que.push(0);
	parents[0] = -1;
	vector<long long> counters(n, 0);
	while (!que.empty()) {
		int v = que.front();
		que.pop();
		if (parents[v] != -1) {
			counters[v] = counters[parents[v]];
		}
		counters[v] += xs[v];
		for (int i = 0; i < G[v].size(); i++) {
			if (!visited[G[v][i]]) {
				que.push(G[v][i]);
				parents[G[v][i]] = v;
			}
		}
		visited[v] = true;
	}
	for (int i = 0; i < n; i++) {
		cout << counters[i];
		if (i < n-1)
			cout << " ";
		else
			cout << endl;
	}
	return 0;
}

Measured memory_bytes: 19816
N = int(input())

sq = int(N ** 0.5) + 1

f = []
for i in range(1, sq):
    if N % i == 0:
        f.append((i, N // i))

ans = N
for a, b in f:
    ans = min(ans, max(len(str(a)), len(str(b))))

print(ans)


Measured memory_bytes: 3060