akhauriyash/Code-Regression huggingface dataset:
/**
 *   created: 01 September 2019  17:13:12
**/
#include<bits/stdc++.h>
using namespace std;

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

#define PB push_back
#define PPB pop_back
#define all(c) c.begin(),c.end()
#define rep(i,a,b) for(int i = (int)(a); i < (int)(b); i++)
#define rrep(i,a,b) for(int i = (int)(a-1); i>=(int)(b); i--)
#define INFLL 2000000000000000007
#define INF 2000000007
#define MOD 1000000007


#define TRACE

#ifdef TRACE
#define trace1(x)                cerr << #x << ": " << x << endl;
#define trace2(x, y)             cerr << #x << ": " << x << " | " << #y << ": " << y << endl;
#define trace3(x, y, z)          cerr << #x << ": " << x << " | " << #y << ": " << y << " | " << #z << ": " << z << endl;
#define trace4(a, b, c, d)       cerr << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " << c << " | " << #d << ": " << d << endl;
#define trace5(a, b, c, d, e)    cerr << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " << c << " | " << #d << ": " << d << " | " << #e << ": " << e << endl;
#define trace6(a, b, c, d, e, f) cerr << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " << c << " | " << #d << ": " << d << " | " << #e << ": " << e << " | " << #f << ": " << f << endl;

#else

#define trace1(x)
#define trace2(x, y)
#define trace3(x, y, z)
#define trace4(a, b, c, d)
#define trace5(a, b, c, d, e)
#define trace6(a, b, c, d, e, f)

#endif


void optimizeIO()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
}

//                                        //AUTHOR: Kaushalesh Shukla

//=========================================================================================================

int main()
{
	optimizeIO();
	int tt=1;
	// cin>>tt;
	while(tt--){
		ll n;
		cin>>n;
		cout<<(n*(n-1))/2;
	}
	return 0;
}


Measured memory_bytes: 256
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author EDGE
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        FastReader in = new FastReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        Task160A solver = new Task160A();
        solver.solve(1, in, out);
        out.close();
    }

    static class Task160A {
        public void solve(int testNumber, FastReader in, PrintWriter out) {

            char[] s = in.nextLine().trim().toCharArray();

            if (s[2] == s[3] && s[5] == s[4])
                out.println("Yes");
            else
                out.println("No");
        }

    }

    static class FastReader {
        BufferedReader br;

        public FastReader(InputStream inputStream) {
            br = new BufferedReader(new
                    InputStreamReader(inputStream));
        }

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

    }
}



Measured memory_bytes: 21460
#include <bits/stdc++.h>
    
using namespace std;
typedef long long ll;
    
int main()
{
    int A, B, C;
    cin >> A >> B >> C;

    if (A + B < C) {
        cout << "No";
    } else {
        cout << "Yes";
    }

    return 0;
}

Measured memory_bytes: 256
def main():
    n, a, b = map(int, input().split())
    print(min(n * a, b))
    # import sys
    # sys.setrecursionlimit = 10 ** 7
    # input = sys.stdin.readline
    # rstrip()
    # (int(x) - 1 for x in input().split())
    pass


if __name__ == '__main__':
    main()

# def binary_search(*, ok, ng, func):
#     while abs(ok - ng) > 1:
#         mid = (ok + ng) // 2
#         if func(mid):
#             ok = mid
#         else:
#             ng = mid
#     return ok


Measured memory_bytes: 9084
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vin=vector<int>;
using vll=vector<long long>;
using vvin=vector<vector<int>>;
using vvll=vector<vector<long long>>;
using vstr=vector<string>;
using vvstr=vector<vector<string>>;
using vch=vector<char>;
using vvch=vector<vector<char>>;
using vbo=vector<bool>;
using vvbo=vector<vector<bool>>;
using vpii=vector<pair<int,int>>;
using pqsin=priority_queue<int,vector<int>,greater<int>>;
#define mp make_pair
#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++)
#define all(v) v.begin(),v.end()
#define decp(n) cout<<fixed<<setprecision((int)n)
const ll inf=1e9+7;
const ll INF=1e18;

//参考サイト:http://sigma1113.hatenablog.com/entry/2019/08/12/130042

struct edge{int from,to;ll cost;};

vector<edge> e;
vll d(2550);
int v;
bool MAX=true;

void bellman(int s){
    fill(all(d),-INF);
    d[s]=(ll)0;
    bool update;
    rep(i,2*v+5){
        update=false;
        for(auto hen:e){
            if(d[hen.from]!=-INF&&d[hen.to]<d[hen.from]+hen.cost){
                d[hen.to]=(i<v-1)?d[hen.from]+hen.cost:INF;//上記サイト参照
                update=true;
            }
        }
        if(!update)break;
        if(d[v]==INF){
            MAX=false;
            break;
        }
    }
}

int main(){
    int n,m;ll p;cin>>n>>m>>p;
    v=n;
    vin a(m),b(m);vll c(m);
    rep(i,m){
        cin>>a[i]>>b[i]>>c[i];
        c[i]-=p;
        e.push_back((edge){a[i],b[i],c[i]});
    }
    bellman(1);
    if(MAX)cout<<max(d[n],(ll)0)<<endl;
    else cout<<-1<<endl;
}

Measured memory_bytes: 3832
n, w = map(int, input().split())
items = [tuple(map(int, input().split())) for _ in range(n)]

#dp[i][u] := i個目までで重さu以下での最大の価値
#0個目までなら0なのは自明
dp = [[0] * (w+1) for _ in range(n+1)]

#dp[i][なんでも]がわかっているときにdp[i+1][u]を考える
for i in range(n):
    for u in range(w+1):
        #i+1個目の重さが残りの重さより重かったら，i+1個目は使えない
        if u < items[i][1]:
            dp[i+1][u] = dp[i][u]
        #i+1個目が使えるとき，考えうるのはi+1個目を使うか使わないか
        #使うとき，実は比べるのは１つ少なく使ったときに対して使った時が最大効率
        else:
            dp[i+1][u] = max(dp[i][u], dp[i+1][u-items[i][1]] + items[i][0])

print(dp[n][w])


Measured memory_bytes: 15696
#include<stdio.h>
#include<math.h>

int main(){
  int i,n,s[1000];
  double a,m;

  while(1){
    scanf("%d",&n);
    if(n==0)break;
    m=0.0;
    for(i=0;i<n;i++){
      scanf("%d",&s[i]);
      m += s[i];
    }
    m /= n;
    a=0.0;
    for(i=0;i<n;i++)
      a += (s[i]-m)*(s[i]-m);
    a=sqrt(a/n);
    printf("%f\n",a);
  }
  return 0;
}

Measured memory_bytes: 636
N = int(input())
x = [0]*N
y = [0]*N
h = [0]*N
for i in range(N):
    x[i], y[i], h[i] = map(int,input().split())
    if h[i] != 0:
        nonzero = [x[i], y[i], h[i]]

for cx in range(101):
    for cy in range(101):
        ch = nonzero[2] + abs(cx-nonzero[0]) + abs(cy-nonzero[1])
        cnt = 0
        for i in range(N):
            if h[i] == max(ch-abs(x[i]-cx)-abs(y[i]-cy), 0):
                cnt += 1
        if cnt == N:
            print(cx,cy,ch)
            exit()




Measured memory_bytes: 3064
#include<stdio.h>
#include<stdlib.h>
#include<math.h>

typedef long long int int64;

#define MAX(a,b) ((a)>(b)?(a):(b))
#define MIN(a,b) ((a)<(b)?(a):(b))
#define ABS(a) ((a)>(0)?(a):-(a))

#define POS(k,i) ((k)*n+(i))

void assign(int a,int b,int *vertex,int *next,int *start,int index){
  vertex[index]=b;
  next[index]=start[a];
  start[a]=index;
  return;
}

void run(void){
  int n,m;
  scanf("%d%d",&n,&m);
  char *s=(char *)malloc(sizeof(char)*(n+1));
  scanf("%s",s);
  int *vertex=(int *)malloc(sizeof(int)*2*m);
  int *next=(int *)malloc(sizeof(int)*2*m);
  int *start=(int *)malloc(sizeof(int)*n);
  int i;
  for(i=0;i<n;i++) start[i]=-1;
  for(i=0;i<m;i++){
    int a,b;
    scanf("%d%d",&a,&b);
    a--;
    b--;
    assign(a,b,vertex,next,start,2*i);
    assign(b,a,vertex,next,start,2*i+1);
  }
  int *cond=(int *)malloc(sizeof(int)*n);
  int *cntA=(int *)calloc(n,sizeof(int));
  int *cntB=(int *)calloc(n,sizeof(int));
  for(i=0;i<n;i++) cond[i]=1;
  int *q=(int *)malloc(sizeof(int)*n);
  int front=0;
  int last=0;
  for(i=0;i<n;i++){
    int p;
    for(p=start[i];p!=-1;p=next[p]){
      int u=vertex[p];
      if(s[u]=='A'){
	cntA[i]++;
      } else {
	cntB[i]++;
      }
    }
    if(cntA[i]==0 || cntB[i]==0){
      q[last++]=i;
      cond[i]=0;
    }
  }
  while(front<last){
    int v=q[front++];
    int p;
    for(p=start[v];p!=-1;p=next[p]){
      int u=vertex[p];
      if(!cond[u]) continue;
      if(s[v]=='A'){
	cntA[u]--;
	if(cntA[u]==0){
	  cond[u]=0;
	  q[last++]=u;
	}
      } else {
	cntB[u]--;
	if(cntB[u]==0){
	  cond[u]=0;
	  q[last++]=u;
	}
      }
    }
  }
  printf("%s\n",last==n?"No":"Yes");
}

int main(void){
  run();
  return 0;
}


Measured memory_bytes: 7040
// abc150_a
#include <iostream>
#include <math.h>
#include <cstring>
#include <iomanip>
#include <algorithm>
#include <string>

#define US unsigned short
#define UI unsigned int
#define UC unsigned char
#define UL unsigned long
#define ULL unsigned long long
using namespace std;

int main(int argc, char const *argv[])
{
    UL k, x;
    cin >> k >> x;
    if (500 * k >= x)
    {
        cout << "Yes" << endl;
    }
    else
    {
        cout << "No" << endl;
    }
}

Measured memory_bytes: 256
#
# 　　  ⋀_⋀　 
#　　  (･ω･)  
# .／ Ｕ ∽ Ｕ＼
#  │＊　合　＊│
#  │＊　格　＊│ 
#  │＊　祈　＊│ 
#  │＊　願　＊│ 
#  │＊　　　＊│ 
#      ￣
#
import sys
input=sys.stdin.readline
from math import floor,ceil,sqrt,factorial,log #log2ないｙｐ
from heapq import heappop, heappush, heappushpop
from collections import Counter,defaultdict
from itertools import accumulate,permutations,combinations,product,combinations_with_replacement
from bisect import bisect_left,bisect_right
inf=float('inf')
mod = 10**9+7
def INT_(n): return int(n)-1
def MI(): return map(int,input().split())
def MF(): return map(float, input().split())
def MI_(): return map(INT_,input().split())
def LI(): return list(MI())
def LI_(): return [int(x) - 1 for x in input().split()]
def LF(): return list(MF())
def LIN(n:int): return [I() for _ in range(n)]
def LLIN(n: int): return [LI() for _ in range(n)]
def LLIN_(n: int): return [LI_() for _ in range(n)]
def LLI(): return [list(map(int, l.split() )) for l in input()]
def I(): return int(input())
def F(): return float(input())
def ST(): return input().replace('\n', '')
def main():
    S = ST()
    a = defaultdict(int)
    for s in S:
        a[s] += 1
        if a[s] == 3:
            print("No")
            exit()
    if len(a) == 2:
        print("Yes")
    else:
        print("No")
if __name__ == '__main__':
    main()

Measured memory_bytes: 38384
#include<iostream>
#include<cstdio>
#include<cmath>
using namespace std;
int main(){
	double a,b;
	for(;;){
		cin >>a>>b;
		if(!a && !b){break;}
		printf("%.6lf\n",a*a+2*a*sqrt((a/2)*(a/2)+b*b));
	}
}

Measured memory_bytes: 0
n=int(input())
L=[0,0,0] #a,b,c prosli
for i in range(n):
    a,b,c=map(int,input().split())
    L=[max(L[1]+a,L[2]+a), max(L[0]+b,L[2]+b), max(L[0]+c,L[1]+c)]
print(max(L))


Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
 
//DEFINE and TYPEDEF--------------------------------------------------------------
 
#define timeKyaHorhaH 1.0 * clock() / CLOCKS_PER_SEC

#define FORG(i,a,n) for(lld i=a;i<n;i++) //for - general
#define FORZ(i,n) for(lld i=0;i<n;i++) //for - zero
#define FORGI(i,a,n,inc) for(lld i=a;i<n;i+=inc) //for - general incremental
#define FORZI(i,n,inc) for(lld i=0;i<n;i+=inc) //for - zero incremental
#define SPEEDUP ios_base::sync_with_stdio(0); cin.tie(NULL); cout.tie(NULL);
#define MEM(a,val) memset(a,val,sizeof(a));
 
#define SORTall(m) sort(m.begin(),m.end());
 
#define st first
#define nd second
#define pb push_back
 
typedef long long int lld;
typedef unsigned long long int ulld;
 
//DEBUGGER------------------------------------------------------------------------
// #define DEBUG(x) cerr<<(#x)<<" is "<<(x)<<"\n" //to debug values of variables
// #define DEBUGON
#define ZINDA cerr<<"\nIdhar-ich hai apun!!\n"; //to debug if code reached that point

vector<string> vec_splitter(string s) {
	for(char& c: s) c = c == ',' ?  ' ': c;
	stringstream ss; ss << s;
	vector<string> res;
	for(string z; ss >> z; res.push_back(z));
	return res;
}

void debug_out(vector<string> args, int idx) { cerr << endl; }
template <typename Head, typename... Tail>
	void debug_out(vector<string> args, int idx, Head H, Tail... T) {
		if(idx > 0) cerr << ", ";
		stringstream ss; ss << H;
		cerr << args[idx] << " = " << ss.str();
		debug_out(args, idx + 1, T...);
	}

#ifdef DEBUGON
	#define debug(...) debug_out(vec_splitter(#__VA_ARGS__), 0, __VA_ARGS__);
	#define DEBUG(...) debug_out(vec_splitter(#__VA_ARGS__), 0, __VA_ARGS__);	
#else
	#define debug(...) 320;
	#define DEBUG(...) 320;
#endif

lld power(lld b, lld e)
{
    if(e==0)
        return 1;
    if(e%2==1)
        return b*power(b*b,(e-1)/2);
    else
        return power(b*b,e/2);
}
 
lld power(lld b, lld e, lld m)
{
	if(e==0)
		return 1;
	if(e%2==1)
		return b*power(((b%m)*(b%m))%m,(e-1)/2,m)%m;
	else
		return power(((b%m)*(b%m))%m,e/2,m)%m;
}
 
int nDig(lld n)
{
	if(n<0) 
		n*=-1;
	if(n==0)
		return 1;

    return floor(log10(n) + 1);
}

#define endl '\n'
#define mod 1000000007

//endl : changed to '\n', to flush comment that definition
//--------------------------------------------------------------------------------

void swagWaalaFunction()
{
	lld n,a,b;
	cin>>n>>a>>b;

	FORG(i,a,b+1)
	{
		if(i%n==0)
		{
			cout<<"OK";
			return;
		}
	}

	cout<<"NG";
	return;
}

int main()
{
    SPEEDUP;
 	lld t=1;
 	//cin>>t;

 	while(t--)
 		swagWaalaFunction();
	
	// cerr<<"\n"<<timeKyaHorhaH; 	
 	return 0;
}

Measured memory_bytes: 3688
#include <bits/stdc++.h>
#include <ctime>
#include <unordered_map>
#include <stdlib.h>
using namespace std;
#define ll  long long int
#define mod 1000000007
#define modd 998244353
#define com(a,n) for(ll i=0;i<n;i++) cin>>a[i];
#define pri(a,n) for(ll i=0;i<n;i++) cout<<a[i]<<endl;
#define velocity ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
/*__builtin_clz();
__builtin_ctz();
__builtin_popcount();*/
int main()
{
    velocity;
    string s;
    cin>>s;
    for(ll i=0;i<s.length();i++)
    {
        cout<<"x";
    }
    cerr << "\nTime elapsed: " << 1000 * clock()/CLOCKS_PER_SEC << "ms\n";
}
 
 
//  1967513926 1540383426 -1303455736 -52159536
 
 
// bool prime[100000];
 
// // int gcdExtended(int a, int b, int *x, int *y) ;
// ll modInverse(int a, int m) 
// { 
//     int x, y; 
//     int g = gcdExtended(a, m, &x, &y); 
//     // if (g != 1) 
//     //     cout << "Inverse doesn't exist"; 
//     // else
//     // { 
//         // m is added to handle negative x 
//         int res = (x%m + m) % m; 
//         return res; 
//     // } 
// } 
  
// // // C function for extended Euclidean Algorithm 
// int gcdExtended(int a, int b, int *x, int *y) 
// { 
//     // Base Case 
//     if (a == 0) 
//     { 
//         *x = 0, *y = 1; 
//         return b; 
//     } 
  
//     int x1, y1; // To store results of recursive call 
//     int gcd = gcdExtended(b%a, a, &x1, &y1); 
  
//     // Update x and y using results of recursive 
//     // call 
//     *x = y1 - (b/a) * x1; 
//     *y = x1; 
  
//     return gcd; 
// } 
// ll modu(ll x)
// {
//     if(x<0)
//     {
//         x+=mod;
//     }
//     else 
//     {
//         x=x%mod;
//     }
//     return x;
// }
 
// void SieveOfEratosthenes(int n) 
// { 
//     // Create a boolean aay "prime[0..n]" and initialize 
//     // all entries it as true. A value in prime[i] will 
//     // finally be false if i is Not a prime, else true. 
     
//     memset(prime, true, sizeof(prime)); 
  
//     for (int p=2; p*p<=n; p++) 
//     { 
//         // If prime[p] is not changed, then it is a prime 
//         if (prime[p] == true) 
//         { 
//             // Update all multiples of p greater than or  
//             // equal to the square of it 
//             // numbers which are multiple of p and are 
//             // less than p^2 are already been marked.  
//             for (int i=p*p; i<=n; i += p) 
//                 prime[i] = false; 
//         } 
//     } 
//     prime[1]=false;
  
//     // Print all prime numbers 
//     // for (int p=2; p<=n; p++) 
//     //    if (prime[p]) 
//     //       cout << p << " "; 
// } 
// ll power(ll x, unsigned ll y, ll p) 
// { 
//     ll res = 1;      // Initialize result 
  
//     x = x % p;  // Update x if it is more than or  
//                 // equal to p 
  
//     while (y > 0) 
//     { 
//         // If y is odd, multiply x with result 
//         if (y & 1) 
//             res = (res*x) % p; 
  
//         // y must be even now 
//         y = y>>1; // y = y/2 
//         x = (x*x) % p;   
//     } 
//     return res; 
// } 

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

using namespace std;

#define UNDEF -1

int N,M,S,dp[2001][3001];

int ths(int begin,int end,int count)
{
	return ((begin + end) * count) / 2;
}

int main(void)
{
	while(true)
	{
		cin >> N >> M >> S;
		if(N == 0 && M == 0 && S == 0)
			exit(0);
		for(int i = 0;i < 2001;i++)
		{
			for(int ii = 0;ii < 3001;ii++)
				dp[i][ii] = 0;
		}
		dp[0][0] = 1;
		int t = ths(1,N*N,N*N);
		for(int i = 1;i <= N * N;i++)
		{
			for(int j = 0;j < M-(N*N);j++)
			{
				for(int k = 0;k < S - t;k++)
				{
					if(j < 2000 && k+i < 3001)
						dp[j+1][k+i] = (dp[j+1][k+i] + dp[j][k]) % 100000;
				}
			}
		}
		int result = 0;
		for(int i = 0;i <= M - (N*N);i++)
		{
			result = (result + dp[i][S - t]) % 100000;
		}
		cout << result << endl;
	}
}

Measured memory_bytes: 26452
#include <bits/stdc++.h>
#define FOR(i,bg,ed) for(ll i=(bg);i<(ed);i++)
#define REP(i,n) FOR(i,0,n)
#define MOD 1000000007
#define int long long
using namespace std;
typedef long long ll;
const int INF = 1e9;

int x, a, b;

signed main()
{
    cin >> x >> a >> b;

    if (abs(a - x) < abs(b - x)) {
        cout << "A" << endl;
    } else {
        cout << "B" << endl;
    }
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <string>
#include <string.h>
#include <stdlib.h>
#include <math.h>
#include <vector>
#include <queue>
#include <stack>
#include <cmath>
#include <map>
#include <iomanip>
#include <set>
#include <ctime>
#include <tuple>
#include <bitset>
using namespace std;

/*
sort(sp.begin(), sp.end(), [](PAIR l, PAIR r){
        return l.first<r.first || (l.first==r.first && l.second > r.second);
        });
*/

typedef long long  ll;


int main() {
    ll a,b,c,x,y;
    cin>>a>>b>>c>>x>>y;
    ll ans=a*x+b*y;
    ll z=0;
    while(x>0 or y>0){
        x--; y--;
        if(x<0)x=0;
        if(y<0)y=0;
        z+=2;
        ans=min(ans,a*x+b*y+c*z);
    }
    cout<<ans<<endl;





    return 0;
}


Measured memory_bytes: 256
import java.util.*;
public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int a = sc.nextInt();
    int v = sc.nextInt();
    int b = sc.nextInt();
    int w = sc.nextInt();
    int t = sc.nextInt();
    if(Math.abs(b-a) <= (long)t*Math.abs(w-v) && v > w)
      System.out.println("YES");
    else
      System.out.println("NO");
  }
}

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

using namespace std;

const int N = 1e5;
int n, a, b;
vector<int> g[N];
int d1[N], d2[N];
int ans;

void dfs1(int v, int p = -1) {
  for (int to : g[v]) {
    if (to == p) {
      continue;
    }
    d1[to] = d1[v] + 1;
    dfs1(to, v);
  }
}

void dfs2(int v, int p = -1) {
  for (int to : g[v]) {
    if (to == p) {
      continue;
    }
    d2[to] = d2[v] + 1;
    dfs2(to, v);
  }
}

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

  cin >> n >> a >> b;
  --a, --b;
  for (int i = 1; i < n; ++i) {
    int u, v;
    cin >> u >> v;
    g[u - 1].push_back(v - 1);
    g[v - 1].push_back(u - 1);
  }
  dfs1(a), dfs2(b);
  for (int i = 0; i < n; ++i) {
    if (d1[i] <= d2[i]) {
      ans = max(ans, d2[i] - 1);
    }
  }
  cout << ans;

  return 0;
}

Measured memory_bytes: 10368
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
using namespace std;
typedef long long int ll;
typedef pair<int,int> P;
#define yn {puts("Yes");}else{puts("No");}
#define MAX_N 200005

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

    ll l[n], r[n];
    rep(i,n)cin >> l[i] >> r[i];

    sort(r,r+n);
    sort(l,l+n,greater<ll>());

    ll tmp1 = 0, tmp2 = 0;

    ll now = l[0];
    tmp1 += abs(now);

    int i = 0;
    while(true){
        if(now <= r[i])break;
        tmp1 += now - r[i];
        now = r[i];
        i++;
        if(i == n)break;
        if(l[i] <= now)break;
        tmp1 += l[i] - now;
        now = l[i];
    }

    tmp1 += abs(now);

    now = r[0];
    tmp2 += abs(now);

    i = 0;
    while(true){
        if(l[i] <= now)break;
        tmp2 += l[i] - now;
        now = l[i];
        i++;
        if(i == n)break;
        if(now <= r[i])break;
        tmp2 += now - r[i];
        now = r[i];
    }

    tmp2 += abs(now);

    ll ans = max(tmp1, tmp2);
    cout << ans << endl;
    return 0;
}
 
 


Measured memory_bytes: 1792
#include <bits/stdc++.h>
#define mem(a,b) memset(a,b,sizeof(a))
#define REP(i,n) for (int i=0;i<(n);i++)
#define FOR(i,s,e) for (int i=s;i<(e);i++)
using namespace std;
typedef long long llint;
typedef pair<int, int> P;
const int MOD = (int)1e9 + 7;
const int INF = 999999999;
const double PI = acos(-1.0);

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

    int a,b,c,d,e,f;
    cin >> a >> b >> c >> d >> e >> f;
    double maxdns = 100.0*e / (100+e);
    double candns = 0.0;
    int ans_w = 0;
    int ans_s = 0;
    REP(i, f/(100*a) + 1){
        REP(j, f/(100*b) + 1){
            REP(k, f/c + 1){
                REP(l, f/d + 1){
                    int amt = 100*a*i + 100*b*j + c*k + d*l;
                    if(amt > f) break;
                    double dns = 100.0*(c*k+d*l) / amt;
                    if(maxdns < dns) continue;
                    if(candns < dns){
                        ans_w = amt;
                        ans_s = c*k+d*l;
                        candns = dns;
                    }
                }
            }
        }
    }
    if(ans_w == 0) ans_w = 100*a;
    cout << ans_w << " " << ans_s << "\n";
    return 0;
}


Measured memory_bytes: 256
import std.conv;
import std.stdio;
import std.string;

void main()
{
	auto dn = readln.split.to!( int[] );
	writeln( solve( dn[ 0 ], dn[ 1 ] ) );
}

auto solve( in int d, in int n )
{
	auto db = 1;
	foreach( i; 0 .. d )
	{
		db *= 100;
	}
	
	return db * n + ( ( n == 100 ) ? db : 0 );
}

unittest
{
	assert( solve( 0, 5 ) == 5 );
	assert( solve( 1, 11 ) == 1100 );
	assert( solve( 2, 85 ) == 850000 );
	assert( solve( 0, 100 ) == 101 );
	assert( solve( 1, 100 ) == 10100 );
	assert( solve( 2, 100 ) == 1010000 );
}


Measured memory_bytes: 256
#include <algorithm>
#include <cassert>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <vector>

#include <limits.h>

using namespace std;

typedef long long ll;

template<class T>
inline bool chmax(T &a, T b) {
    if(a < b) {
        a = b;
        return true;
    }
    return false;
}

template<class T>
inline bool chmin(T &a, T b) {
    if(a > b) {
        a = b;
        return true;
    }
    return false;
}

const ll MX = 1000LL * 1000LL * 1000LL * 1000LL * 1000LL * 1000LL;

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

    vector<ll> as(N);
    bool has_zero = false;
    for (int i = 0; i < N; i++) {
        cin >> as[i];
        if (as[i] == 0) {
            has_zero = true;
        }
    }

    if (has_zero) {
        cout << 0 << endl;
        return 0;
    }

    bool ok = true;
    ll acc = 1;
    for (int i = 0; i < N; i++) {
        ll x = acc * as[i];
        if (acc > MX / as[i]) {
            ok = false;
            break;
        }
        acc *= as[i];
    }

    if (ok) {
        cout << acc << endl;
    } else {
        cout << -1 << endl;
    }

    return 0;
}


Measured memory_bytes: 4044
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <queue>
#include <map>
using namespace std;
typedef long long ll;
typedef pair<string, int> P;
typedef pair<int, P> Q;

ll mod = 1000000007;
const ll INF = 100000000000000;
map<ll, ll> mp;
ll N, K, a[200010], sum[200010], ans;

ll pow_mod(ll x, ll y)
{
	if (y == 0) return 1;

	if (y % 2 == 0)
	{

	}
	else
	{

	}
}

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

int main()
{
	ll n;
	string s;

	cin >> n >> s;

	for (int i = 0; i < s.length(); i++)
	{
		ll u = (s[i] - 'A' + n) % 26;
		printf("%c", u + 'A');
	}
	cout << endl;
	
	int www;
	cin >> www;
}

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

int main(){
    int N,K;

    cin >> N;
    cin >> K;

    int x[N];

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

    int ans = 0;

    for(int i = 0; i < N; i++){
        if(K > x[i]){
            if(x[i] > K - x[i]){
                ans += 2 * (K - x[i]);
            }else{
                ans += 2 * x[i];
            }
        }else{
            if(x[i] > K - x[i]){
                ans += 2 * (K - x[i]);
            }else{
                ans += 2 * x[i];
            }
        }
    }

    cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, n) for (long long i = 0; i < (long long)n; i++)
//#define _GLIBCXX_DEBUG
using namespace std;
using ll = long long;
using Pi = pair<int, int>;
using Pl = pair<ll, ll>;
using Vl = vector<ll>;
using vi = vector<int>;
using Graph = vector<vi>;

map<ll, int> prime_factor(ll n) {
  map<ll, int> ret;
  for (ll i = 2; i * i <= n; i++) {
    while (n % i == 0) {
      ret[i]++;
      n /= i;
    }
  }
  if (n != 1) ret[n] = 1;
  return ret;
}

int main() {
  ll N;
  cin >> N;
  int ans = 0;
  map<ll, int> X = prime_factor(N);
  for (auto p : X) {
    int time = 1;
    // cout << p.first << " " << p.second << endl;
    while (p.second - time >= 0) {
      p.second -= time;
      time++;
      ans++;
    }
    // cout << ans << endl;
  }
  cout << ans << endl;
}

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

using ll    = long long;
using ull   = unsigned long long;
using veci  = vector<int>;
using vecll = vector<ll>;
#define EPS (1e-7)
#define INF (1e9)
#define PI  (acos(-1))
#define FOR(i,a,b) for(int i = (a);i < (b); ++i)
#define REP(i,n) for(int i= 0;i<(int)(n);++i)
#define pb push_back

veci enum_div(int n){
	veci ret;
	ret.pb(1);
	for(int i=1;i*i<n;i++){
		if(n%i==0){
			ret.pb(i);
			if(i != n/i){ret.pb(n/i);}
		}
	}
	ret.pb(n);
	return ret;
}
int gcb(int a,int b){return ((b == 0)? a : gcb(b,a%b));}
int gcd(int a,int b){return (a*b) / gcb(a,b);}

int main(){
    int n;
    vecll x,y,h;
    cin >> n;
    REP(i,n){
        ll tmp1,tmp2,tmp3;
        cin >> tmp1 >> tmp2 >> tmp3;
        x.pb(tmp1); y.pb(tmp2),h.pb(tmp3);
    }
    REP(py,101){
        REP(px,101){
            int needH = -1;
            REP(i,n){
                if(h[i] > 0){
                    int tmp = h[i]+abs(py-y[i]) + abs(px-x[i]);
                    if(needH == -1){
                        needH = tmp;
                    }else{
                        if(needH != tmp){
                            needH = -2;
                            break;
                        }
                    }
                }
            }
            REP(i,n){
                if(h[i]==0){
                    int d = abs(py-y[i]) + abs(px -x[i]);
                    if(needH > d){
                        needH = -2;
                        break;
                    }
                }
            }
            if(needH == -2){
                continue;
            }
            cout << px << " " << py << " " << needH << endl;
            return 0;
        }
    }
	return 0;
}

Measured memory_bytes: 256
from collections import deque

N = int(input())
A = list(map(int,input().split()))

A.sort()

ans = 0
max_A = max(A)
ban = [0]*(max_A+1)
again = list()

last = 0
for i in range(N-1):
    if A[i] == A[i+1] and A[i] != last:
        again.append(A[i])
        last = A[i]
if N > 1 and A[N-1] == A[N-2] and A[N-1] != last:
    again.append(A[N-1])

for num in again:
    ban_num = num
    while ban_num <= max_A:
        ban[ban_num] = 1
        ban_num += num
 
for num in A:
    if ban[num] != 1:
        ans += 1
        ban_num = num
        while ban_num <= max_A:
            ban[ban_num] = 1
            ban_num += num

print(ans)

Measured memory_bytes: 33948
#include <cstdio>

#define MAX 30

int N;
int A[MAX], B[MAX], C[MAX];

int main() {
  scanf("%d", &N);
  for (int i = 0; i < N; ++i) {
    scanf("%d", &A[i]);
  }
  for (int i = 0; i < N; ++i) {
    scanf("%d", &B[i]);
  }
  for (int i = 0; i < N - 1; ++i) {
    scanf("%d", &C[i]);
  }

  int ans = B[A[0] - 1];
  for (int i = 1; i < N; ++i) {
    ans += B[A[i] - 1];
    if (A[i] == A[i - 1] + 1) {
      ans += C[A[i - 1] - 1];
    }
  }
  printf("%d\n", ans);
  return 0;
}


Measured memory_bytes: 128
import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    int A = sc.nextInt();
    int B = sc.nextInt();
    
    int ans = 0;
    for (int i = 1; i <= N; i++) {
      int n = i;
      int sum = 0;
      while (n != 0) {
        sum += n % 10;
        n /= 10;
      }
      if (A <= sum && sum <= B) {
        ans += i;
      }
    }
    
    System.out.println(ans);
  }
}

Measured memory_bytes: 21844
#include "bits/stdc++.h"
// Custom Header {{{
#define ALL(x)      x.begin(), x.end()
#define rep(i,n)    for (int i = 0; i < (n); ++i)
using namespace std;
using i64 = long long;
using pii = pair<i64, i64>;
template<class A, class B>inline bool chmax(A &a, const B &b){return b>a ? a=b,1 : 0;}
template<class A, class B>inline bool chmin(A &a, const B &b){return b<a ? a=b,1 : 0;}
constexpr int INF  = 0x3f3f3f3f;
constexpr i64 LINF = 0x3f3f3f3f3f3f3f3fLL;
// }}}


signed main()
{
    // ios::sync_with_stdio(false); cin.tie(nullptr);
    int cnt[64][2] {};
    i64 N, K;
    i64 a[100010];

    cin >> N >> K;
    rep(i, N) {
        cin >> a[i];
        rep(b, 50) cnt[b][(a[i] >> b) & 1] += 1;
    }

    const auto f = [&a, &N](i64 X) {
        i64 sum = 0;
        rep(i, N) sum += X ^ a[i];
        return sum;
    };

    i64 ans = f(K);

    rep(d, 50) {
        i64 X = K;
        X &= ~(1LL << d);
        assert(X <= K);

        rep(i, d) {
            if (cnt[i][0] > cnt[i][1]) {
                X |= (1LL << i);
            } else {
                X &= ~(1LL << i);
            }
        }

        if (X > K) continue;
        chmax(ans, f(X));
    }

    cout << ans << endl;

    return 0;
}



Measured memory_bytes: 1024
<?php
$a = ints();
sort($a);
$isOdd = true;
for ($i = 0; $i < 3; ++$i) if ($a[$i] % 2 === 0) $isOdd = false;
echo $isOdd ? $a[0] * $a[1] : 0;
function ints()
{
    return array_map('intval', explode(' ', trim(fgets(STDIN))));
}


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

#define ll long long

using namespace std;

int main() {
    ll a[3];
    cin >> a[0] >> a[1] >> a[2];
    if(a[0] % 2 == 0 || a[1] % 2 == 0 || a[2] % 2 == 0 ){
         cout << 0 << endl;
    }else{
         sort(a,a+3);
         //cout << abs(((a[2]/2)*a[1]*a[2]) - ((a[2] - a[2]/2)* a[1]*a[0])) << endl;
        cout << a[0]*a[1] << endl;
    }

	return 0;
}        


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <numeric>
#include <cmath>
#include <algorithm>
#include <queue>
using namespace std;
int main(void){
	int K;
	cin >> K;
	queue<long> Q;
	for(int i=0;i<9;i++)Q.push(i+1);
	long ans,x;
	for(int i=0;i<K;i++){
		x = Q.front();
		Q.pop();
		if(x%10!=0)Q.push(10*x + x%10 - 1);
		Q.push(10*x+x%10);
		if(x%10!=9)Q.push(10*x + x%10 + 1);
	}
	ans=x;
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 1792
from sys import stdin


def main() -> None:
    a = next_int()
    b = next_int()

    ab = int(str(a) + str(b))
    sqrt = int(ab ** 0.5)

    print(["No","Yes"][sqrt ** 2 == ab])


def next_int() -> int:
    return int(next_str())


def next_str() -> str:
    result = ""
    while True:
        tmp = stdin.read(1)
        if tmp.strip() != "":
            result += tmp
        elif tmp != '\r':
            break
    return result


if __name__ == '__main__':
    main()

Measured memory_bytes: 3188
#include <bits/stdc++.h>
#define pb push_back
#define sz(a) int(a.size())
#define re return
using namespace std;
int a[105];
int main()
{
	int n;
	cin>>n;
	int best=100000000;
	for (int i=0;i<n;i++)  cin>>a[i];
	for (int i=0;i<100;i++)
	{
		int ans=0;
		for (int j=0;j<n;j++)
		{
			ans=ans + abs(i -a[j]) * abs(i -a[j]);
		}
		best=min(best , ans); 
	}
	cout<<best;
	re 0;
}

Measured memory_bytes: 256
#ifdef DBG1
  #define LOCAL
#endif

#ifdef LOCAL
  #define _GLIBCXX_DEBUG
#endif

#include <iostream>
#include <cstdio>
#include <cstring>
#include <cassert>
#include <cstring>
#include <string>
#include <vector>
#include <algorithm>
#include <map>
#include <set>

#ifdef DBG1
    #define dbg(...) fprintf(stderr, __VA_ARGS__)
#else
    #define dbg(...)
#endif

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair <int, int> pii;

ll solve(const vector<pii> &a, vector<int> p, vector<int> q) {
  ll res = 0;
  int n = int(a.size());
  int pos = 0;
  vector<bool> used(n, false);
  dbg("%d", pos);
  for (int i = 0; i < n; ++i) {
    vector<int> &x = (i&1) ? p : q;
    while (1) {
      assert(!x.empty());
      int num = x.back();
      x.pop_back();
      if (!used[num]) {
        if (a[num].first <= pos && pos <= a[num].second) {
        } else if (a[num].first > pos) {
          res += abs(a[num].first - pos);
          pos = a[num].first;
        } else {
          res += abs(pos - a[num].second);
          pos = a[num].second;
        }
        dbg("->%d", pos);
        used[num] = true;
        break;
      }
    }
  }
  dbg("->0\n");
  return res + abs(pos);
}

bool solve() {
  int n;
  if (scanf("%d", &n) != 1) { return false; }
  vector<pii> a(n);
  for (int i = 0; i < n; ++i) {
    scanf("%d%d", &a[i].first, &a[i].second);
  }
  vector<int> p(n), q(n);
  for (int i = 0; i < n; ++i) {
    p[i] = q[i] = i;
  }

  sort(p.begin(), p.end(), [&a](int i, int j) { return a[i].first < a[j].first; });
  sort(q.begin(), q.end(), [&a](int i, int j) { return a[i].second > a[j].second; });
  printf("%lld\n", max(solve(a, p, q), solve(a, q, p)));
  return true;
}

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

Measured memory_bytes: 3328
import itertools
import math
import sys
import heapq
from collections import Counter
from collections import deque
from fractions import gcd
from functools import reduce
sys.setrecursionlimit(4100000)
from functools import lru_cache
INF = 1 << 60

#ここから書き始める
n, k = map(int, input().split())
ans = 0
while n > 0:
    if n < k:
        ans += 1
    else:
        ans += 1
    n //= k
print(ans)


Measured memory_bytes: 5536
using System;
using System.Linq;
using static System.Console;
class E { static void Main() => new J(); }
class J
{
	long[] G => ReadLine().Split().Select(_ => long.Parse(_)).ToArray();
	public J()
	{
		var I = G;
		long N = I[0], A = I[1];
		var min = N;
		for (var k = 1; N > 1 && k < 50; k++)
		{
			var m = FirstBinary(2, N + 2, _m =>
			{
				var p = N - 1;
				for (var i = 0; i <= k; i++) p /= _m;
				return p <= 0;
			});
			var z = k + 1;
			while (true)
			{
				var p = N - 1;
				z--;
				for (var i = 0; i < z; i++) p /= m;
				for (var i = z; i <= k; i++) p /= m - 1;
				if (p > 0) break;
			}
			min = Math.Min(min, k * A + (m - 1) * (k + 1) + z + 1);
		}
		WriteLine(min);
	}
	long FirstBinary(long min, long max, Predicate<long> pred)
	{
		while (min < max)
		{
			var mid = (min + max) / 2;
			if (pred(mid)) max = mid;
			else min = mid + 1;
		}
		return min;
	}
}

Measured memory_bytes: 2776
K, S = map(int, input().split())
x,y,z = 0,0,0
ans = 0

for i in range(K+1):
  x = i
  for j in range(K+1):
    y = j
    z = S - x - y
    if 0 <= z <= K:
      ans += 1
print(ans)

Measured memory_bytes: 3060
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<bitset>
#include<set>
#include<map>
#include<stack>
#include<queue>
#include<deque>
#include<list>
#include<iomanip>
#include<cmath>
#include<cstring>
#include<functional>
#include<cstdio>
#include<cstdlib>
using namespace std;
 
#define repr(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define rep(i, n) repr(i, 0, n)
#define INF 2e9
#define MOD 1000000007
//#define MOD 998244353
#define LINF (long long)4e18
#define jck 3.141592
 
const double EPS = 1e-10;
 
using ll = long long;
using Pi = pair<int,int>;
using Pl = pair<ll,ll>;



int main(){
    string s; cin >> s;
    int n = s.size();
    deque<char> d;
    rep(i,n){
        d.push_back(s[i]);
    }
    
    int Q; cin >> Q;
    int now = 0;
    rep(i,Q){
        int a; cin >> a;
        if(a == 1) now ^= 1;
        else{
            int b; cin >> b;
            char c; cin >> c;
            if(b == 1){
                if(now == 0){
                    d.push_front(c);
                }
                else d.push_back(c);
            }
            else{
                if(now == 0) d.push_back(c);
                else d.push_front(c);
            }
        }
    }
    if(now&1) reverse(d.begin(),d.end());
    rep(i,d.size()) cout << d[i];
    cout << endl;
}

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

void decompose(vector<long long>& primes,
               vector<int>& degree, long long P) {
    if (P % 2 == 0) {
        primes.push_back(2);
        degree.push_back(0);
        while (P % 2 == 0) {
            P /= 2;
            ++degree[0];
        }
        if (1 == P)
            return;
    }
    for (long long i = 3; i <= (long long)sqrt(P); i += 2) {
        if (P % i != 0)
            continue;
        primes.push_back(i);
        degree.push_back(0);
        while (P % i == 0) {
            ++degree[degree.size() - 1];
            P /= i;
        }
        if (1 == P) {
            return;
        }
    }
}

int main() {
    long long N, P;
    cin >> N >> P;
    if (N >= P) {
        cout << 1;
        return 0;
    }
    if (N == 1) {
        cout << P;
        return 0;
    }

    vector<long long> primes;
    vector<int> degree;
    decompose(primes, degree, P);

    long long ans = 1;
    for (int i = 0; i < degree.size(); ++i) {
        degree[i] /= N;
        while (degree[i] > 0) {
            ans *= primes[i];
            --degree[i];
        }
    }
    cout << ans;

    return 0;
}


Measured memory_bytes: 768
#include <bits/stdc++.h>
using namespace std;
#define MD 1000000007
#define INF 1000000000
typedef long long int ll;
typedef pair<ll, ll> P;
template <typename T>
std::string tostr(const T &t)
{
    std::ostringstream os;
    os << t;
    return os.str();
}
int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};

int main()
{
    ll h, w, n;
    cin >> h >> w >> n;
    vector<P> pa(n);
    for (int i = 0; i < n; i++)
    {
        int a, b;
        cin >> a >> b;
        a--;
        b--;
        pa[i] = {a, b};
    }
    map<P, int> mp;
    for (int i = 0; i < n; i++)
    {
        for (int dx = -1; dx <= 1; dx++)
        {
            for (int dy = -1; dy <= 1; dy++)
            {
                //(nx,ny)は正方形の中心の座標
                int nx = pa[i].second + dx, ny = pa[i].first + dy;
                if (nx - 1 >= 0 && nx + 1 < w && ny - 1 >= 0 && ny + 1 < h)
                {
                    if (!mp.count({ny, nx}))
                    {
                        mp[{ny, nx}] = 1;
                    }
                    else
                    {
                        mp[{ny, nx}]++;
                    }
                }
            }
        }
    }
    vector<ll> ans(11, 0);
    for (auto itr = mp.begin(); itr != mp.end(); ++itr)
    {
        ans[itr->second]++;
    }
    ll cnt = 0;
    for (int i = 0; i < 10; i++)
    {
        cnt += ans[i];
    }
    ans[0] = ll(h - 2) * (w - 2) - cnt;
    for (int i = 0; i < 10; i++)
    {
        cout << ans[i] << endl;
    }
    return 0;
}

Measured memory_bytes: 58112
#include <cstdio>
#include <iostream>
#include <cstdlib>
#include <math.h>
#include <algorithm>
#include <string.h>
#include <iomanip>
using namespace std;

int main(void){
    string s; 
    int n,k;
    cin >> n >> k >> s;
    
    s[k-1] = tolower(s[k-1]);
    cout << s << endl;
}

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

int main()
{
  int n[4], a, b;

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

  cin >> a >> b;
  sort (n, n + 4);
  int res = 0;
  for (int i = 0; i < 3; i++){
    res += n[3 - i];
  }
  cout << res + max(a, b) << endl;
}

Measured memory_bytes: 3128
#include<bits/stdc++.h>
using namespace std;
char ch[110];
int n;
int main(){
	cin>>ch;
	n=strlen(ch);
	for(int i=0;i<n;i++){
		if(ch[i]=='C'){
			for(int j=i+1;j<n;j++){
				if(ch[j]=='F'){
					printf("Yes");
					return 0;
				};
			}
			printf("No");
			return 0;
		}
	}
	printf("No");
}

Measured memory_bytes: 256
// ABC067_A.cpp : Defines the entry point for the console application.
//

#include <iostream>
#include <algorithm>
#include <string>

using namespace std;

int main()
{
	int n, m = 0;
	cin >> n;
	while (n) {
		m += n--;
	}
	cout << m << endl;
	return 0;
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
#define fi first
#define se second
#define show(x) cerr<<#x<<"="<<x<<"\n"
typedef long long ll;
using namespace std;
//const ll MOD=(ll)1e9+7;
//const ll inf=(ll)1e14;
const int dy[]={1,0,-1};
const int dx[]={1,0,-1};
int n,m,h,w;
string s;
int a[200011],b[200011];

int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.precision(10);
  cout<<fixed;
#ifdef LOCAL_DEFINE
  FILE *stream1;
  //FILE *stream2;
  stream1=freopen("in","r",stdin);
  //stream2=freopen("out","w",stdout);
  if(stream1==NULL)return 0;
  //if(stream2==NULL)return 0;
#endif
  cin>>n>>w>>h;
  vector<pair<int,int> > okx,oky;
  for(int i=0;i<n;i++){
    int x,y,z;cin>>x>>y>>z;
    okx.push_back({x-z,x+z});
    oky.push_back({y-z,y+z});
  }
  for(int i=0;i<n;i++){
    if(okx[i].fi<0)okx[i].fi=0;
    if(okx[i].se>w)okx[i].se=w;
    a[2*okx[i].fi]++;
    a[2*okx[i].se+1]--;
  }
  for(int i=0;i<n;i++){
    if(oky[i].fi<0)oky[i].fi=0;
    if(oky[i].se>h)oky[i].se=h;
    b[2*oky[i].fi]++;
    b[2*oky[i].se+1]--;
  }
  for(int i=1;i<=2*w;i++){
    a[i]=a[i-1]+a[i];
  }
  for(int j=1;j<=2*h;j++){
    b[j]=b[j-1]+b[j];
  }
  bool flag1=1,flag2=1;
  for(int i=0;i<=2*w;i++){
    if(a[i]<=0)flag1=0;
  }
  for(int i=0;i<=2*h;i++){
    if(b[i]<=0)flag2=0;
  }
  if(flag1 || flag2)cout<<"Yes"<<endl;
  else cout<<"No"<<endl;
#ifdef LOCAL_DEFINE
  cerr<<"Time elapsed: "<<1.0*clock()/CLOCKS_PER_SEC<<"s.\n";
  fclose(stream1);
  //fclose(stream2);
#endif
  return 0;
}







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

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

#define pb push_back

#define rep(i, l, n) for (int i = (l); i < n; i++)
#define rep_cs(i, l, n) for (int i = (l); i <= n; i++)

#define rep_d(j, n) for (int j = n; j >= 0; j--)
#define rep_d_op(j, n, a) for (int j = n; j >= a; j--)

template <class T>
inline bool chmax(T &a, T b)
{
    if (a < b)
    {
        a = b;
        return 1;
    }
    return 0;
}
template <class T>
inline bool chmin(T &a, T b)
{
    if (a > b)
    {
        a = b;
        return 1;
    }
    return 0;
}

const int MOD = 1000000007;

const vector<int> dx = {1, 0};
const vector<int> dy = {0, 1};
const ll INF = 1LL << 60;

// int max = *std::max_element(vec.begin(), vec.end());
// int sum = accumulate(list, list + size, 0);

int GCD(int a, int b) { return b ? GCD(b, a % b) : a; }

using Graph = vector<vector<int>>;

Graph G;

vector<bool> seen;
void dfs(const Graph &G, int v)
{
    seen[v] = true;

    for (auto next_v : G[v])
    {
        if (seen[next_v])
            continue;
        dfs(G, next_v);
    }
}

int main()
{
    ll n, k;
    cin >> n >> k;

    vll h(n);
    rep(i, 0, n) cin >> h[i];

    vll dp(110000, INF);
    dp[0] = 0;

    rep(i, 0, n)
    {
        rep_cs(j, 1, k)
        {
            chmin(dp[i + j], dp[i] + abs(h[i] - h[i + j]));
        }
    }

    cout << dp[n - 1] << endl;
}

Measured memory_bytes: 1920
import java.io.PrintWriter

fun main(args: Array<String>) {
    PrintWriter(System.out).use { out ->
        solve(out)
        out.flush()
    }
}

fun solve(out: PrintWriter) {
    val s = readLine()!!
    var ans = 1
    var preString = s.substring(0, 1)
    var left = 1
    var right = 2
    while (left < s.length) {
        while (right <= s.length && s.substring(left, right) == preString) {
            right++
        }

        if (right > s.length) {
            break
        }

        ans++

        preString = s.substring(left, right)
        left = right
        right++
    }
    println(ans)
}

fun readInteger() = readLine()!!.toInt()
fun readLong() = readLine()!!.toLong()
fun readStringList() = readLine()!!.split(" ")
fun readIntegerList() = readStringList().map(String::toInt)
fun readLongList() = readStringList().map(String::toLong)
fun readDoubleList() = readStringList().map(String::toDouble)


Measured memory_bytes: 40240
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author
 */

#include <cstdio>
#include <cstring>
#include <cmath>
#include <utility>
#include <iostream>
#include <functional>
#include <bitset>
#include <algorithm>
#include <vector>
#include <forward_list>
#include <set>
#include <map>
#include <queue>
#include <deque>
#include <stack>
#include <numeric>
#define ll long long int
#define rep(i,n) for(int i=0;i<(n);i++)
#define pb push_back
using namespace std;
int mx4[] = {0,1,0,-1};
int my4[] = {1,0,-1,0};
int mx2[] = {1,0};
int my2[] = {0,1};

class AAbcOfABC {
public:
	void solve(istream& in, ostream& out) {
        string s;
        in >> s;
        if(s[0] != s[1] && s[1] != s[2] && s[2] != s[0]) out << "Yes" << endl;
        else out << "No" << endl;
	}
};

int main() {
	AAbcOfABC solver;
	std::istream& in(std::cin);
	std::ostream& out(std::cout);
	solver.solve(in, out);
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
typedef long long ll;
#define  rep(i,a,b)for(long long i=a;i<b;++i)
#define  rrep(i,a,b)for(int i=a;i>=b;--i)
#define  yesno(flag)if(flag)cout<<"Yes"<<endl; else cout<<"No"<<endl;
using namespace std;
const ll INF=1000000000000LL;
const ll r197=1000000007;
typedef pair<int,int>P;
typedef pair<int,P>Pa;
bool Inframe(int a,int b,int c,int d,int h,int w){
	if(a+b>=0&&a+b<h&&c+d>=0&&c+d<w)return true;
	return false;
}


int n,a[1005][1005],ma,b[1005][1005]={};
int c[1005][1005]={};
int ans=-1;
vector<P> v[1005][1005];
int main() {
	cin>>n;
	cout<<n*n*n<<endl;
	return 0;
}


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

int main(){
    int a[3];
    for (int i = 0;i < 10; i++) {
        int input;
        cin >> input;

        if (input > a[0]) {
            a[2] = a[1];
            a[1] = a[0];
            a[0] = input;
        } else if (input > a[1]) {
            a[2] = a[1];
            a[1] = input;
        } else if (input > a[2]) {
            a[2] = input;
        }

    }

    for (int j = 0; j < 3; j++) {
        cout << a[j] << endl;
    }

    return 0;
}

Measured memory_bytes: 1160