akhauriyash/Code-Regression huggingface dataset:
import java.util.ArrayDeque;
import java.util.Queue;
import java.util.Scanner;

public class Main {

    public static void main(String[] args) throws Exception {

//    	File file = new File("test.txt");
//    	Scanner sc = new Scanner(file);
    	Scanner sc = new Scanner(System.in);
    	int N = sc.nextInt();
    	int K = sc.nextInt();
    	int[] ary = new int[N];
    	for(int i = 0; i < N; i++){
    		ary[i] = sc.nextInt()+1;
    	}
    	sc.close();
    	Queue<Integer> queue = new ArrayDeque<>();
    	int max = 0;
    	int s = 0;
    	for(int i = 0; i < N; i++){
    		s += ary[i];
    		queue.add(ary[i]);
    		if(queue.size() > K){
    			s -= queue.peek();
    			queue.poll();
    		}
    		if(queue.size() == K){
    			max = Math.max(s, max);
    		}
    	}
    	double ans = max;
    	ans /= 2;
    	System.out.println(ans);
    }
}

Measured memory_bytes: 76056
package main

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

var sc = bufio.NewScanner(os.Stdin)

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

func readFloat64() float64 {
	sc.Scan()
	f, err := strconv.ParseFloat(sc.Text(), 64)
	if err != nil {
		panic(err)
	}
	return f
}

func readString() string {
	sc.Scan()
	return sc.Text()
}

func main() {
	sc.Split(bufio.ScanWords)
	r := readInt()

	var ans float64
	ans = 2.0 * float64(r) * math.Pi
	fmt.Println(ans)
}


Measured memory_bytes: 1756
import java.util.*;

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

		long a = scan.nextLong();
		long b = scan.nextLong();
		long c = scan.nextLong();
		long k = scan.nextLong();
		k %= 2;
		if(k==1) {
			long sumA = b+c;
			long sumB = a+c;
			a = sumA;
			b = sumB;
		}
		long ans = a-b;
		System.out.println((Math.abs(ans)>1000000000000000000L)?"Unfair":ans);
	}
}


Measured memory_bytes: 22356
#include <bits/stdc++.h>
//#define ivorysi
#define enter putchar('\n')
#define space putchar(' ')
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define eps 1e-8
#define mo 974711
#define MAXN 200005
#define pii pair<int,int>
using namespace std;
typedef long long int64;
typedef double db;
template<class T>
void read(T &res) {
    res = 0;char c = getchar();T f = 1;
    while(c < '0' || c > '9') {
	if(c == '-') f = -1;
	c = getchar();
    }
    while(c >= '0' && c <= '9') {
	res = res * 10 + c - '0';
	c = getchar();
    }
    res *= f;
}
template<class T>
void out(T x) {
    if(x < 0) {putchar('-');x = -x;}
    if(x >= 10) {
	out(x / 10);
    }
    putchar('0' + x % 10);
}
int N,M;
struct node {
    int to,next;
}E[MAXN * 2];
int head[MAXN],sumE,id[MAXN],ra[MAXN],f[MAXN];
int64 A[MAXN],B[MAXN],C[MAXN],dp[MAXN],siz[MAXN];
vector<int> son[MAXN];
int getfa(int x) {
    return f[x] == x ? x : f[x] = getfa(f[x]);
}
bool cmp(int s,int t) {
    return C[s] < C[t];
}
void add(int u,int v) {
    E[++sumE].to = v;
    E[sumE].next = head[u];
    head[u] = sumE;
}
void Init() {
    read(N);read(M);
    for(int i = 1 ; i <= N ; ++i) {
	read(A[i]);read(B[i]);C[i] = max(A[i] - B[i],0LL);
	id[i] = i;
    }
    sort(id + 1,id + N + 1,cmp);
    for(int i = 1 ; i <= N ; ++i) ra[id[i]] = i;
    int u,v;
    for(int i = 1 ; i <= M ; ++i) {
	read(u);read(v);
	add(u,v);add(v,u);
    }
}
void dfs1(int u) {
    siz[u] += B[u];
    for(auto v : son[u]) {
	dfs1(v);
	siz[u] += siz[v];
    }
}
void dfs2(int u) {
    if(son[u].size() == 0) {
	dp[u] = B[u] + C[u];
	return;
    }
    dp[u] = 1e18;
    for(auto v : son[u]) {
	dfs2(v);
	dp[u] = min(siz[u] - siz[v] + max(C[u],dp[v]),dp[u]);
    }
}
void Solve() {
    for(int i = 1 ; i <= N ; ++i) f[i] = i;
    for(int i = 1 ; i <= N ; ++i) {
	int u = id[i];
	for(int j = head[u] ; j ; j = E[j].next) {
	    int v = E[j].to;
	    if(ra[getfa(v)] < ra[u] && getfa(v) != u) {
		son[u].pb(getfa(v));
		f[getfa(v)] = u;
	    }
	}
    }
    dfs1(id[N]);
    dfs2(id[N]);
    out(dp[id[N]]);enter;
}
int main() {
#ifdef ivorysi
    freopen("f1.in","r",stdin);
#endif
    Init();
    Solve();
    return 0;
}


Measured memory_bytes: 24320
#include<bits/stdc++.h>
#define endl '\n';
#define rep(i,n) for(int i=0; i<(n); i++)
using namespace std;
using ll = long long;
using P = pair<int,int>;
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize("Ofast")
constexpr ll INF = 1e18;
constexpr int inf = 1e9;
constexpr double INFD = 1e100;
constexpr ll mod = 1000000007;
constexpr ll mod2 = 998244353;
const double PI = 3.1415926535897932384626433832795028841971;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
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; }
// ios::sync_with_stdio(false);
// cin.tie(nullptr);
// ---------------------------------------------------------------------------

int main(){
  string S,T;
  cin >> S >> T;
  sort(S.begin(),S.end());
  sort(T.begin(),T.end(),greater<char>());
  if(S < T){
    cout << "Yes" << endl;
  }else{
    cout << "No" << endl;
  }
  return 0;
}

Measured memory_bytes: 256
#ifdef DEBUG
#define _GLIBCXX_DEBUG
#endif
//#pragma GCC optimize("O3")
#include <bits/stdc++.h>
using namespace std;
typedef long double ld;
typedef long long ll;
const int mod = (int)1e9 + 7;

int mult(int a, int b) {
    return (1LL * a * b) % mod;
}

int pw(int a, int b) {
    if (b == 0) return 1;
    if (b & 1) return mult(a, pw(a, b - 1));
    int res = pw(a, b / 2);
    return mult(res, res);
}

int sub(int a, int b) {
    int s = a - b;
    if (s < 0) s += mod;
    return s;
}

int sum(int a, int b) {
    int s = a + b;
    if (s >= mod) s -= mod;
    return s;
}

const int maxN = 2 * (int)1e5 + 100;

int fact[maxN], invfact[maxN], inv[maxN];

void init() {
    inv[1] = invfact[1] = invfact[0] = fact[0] = fact[1] = 1;
    for (int i = 2; i < maxN; i++) {
        fact[i] = mult(fact[i - 1], i);
        inv[i] = mult(inv[mod % i], mod - mod / i);
        invfact[i] = mult(invfact[i - 1], inv[i]);
    }
}

int cnk(int n, int k) {
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return mult(fact[n], mult(invfact[k], invfact[n - k]));
}

int invNumber(int a) {
    return pw(a, mod - 2);
}
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
//    freopen("input.txt", "r", stdin);
    init();
    int h, w, a, b;
    cin >> h >> w >> a >> b;
    int ways = cnk(h - 1 + w - 1, h - 1);
    for (int i = h - a + 1; i <= h; i++) {
        int x1 = i;
        int y1 = b;
        ways = sub(ways, mult(cnk(x1 - 1 + y1 - 1, y1 - 1), cnk(h - x1 + w - y1 - 1, h - x1)));
    }
    cout << ways;
    return 0;
}

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

int main() {
	//cout<<"GfG!";
	int l,r,n,i,c=0;
	cin>>n;
	int a[n];
	for(i=1;i<=n;i++)
	{
	    cin>>a[i];
	}
	for(i=1;i<=n;i++)
	{
	    if(a[i]%2!=0 && i%2!=0)
	    c++;
	}
	cout<<c;
//	return 0;
}

Measured memory_bytes: 3192
// dfmt off
T lread(T=long)(){return readln.chomp.to!T;}T[] lreads(T=long)(long n){return iota(n).map!((_)=>lread!T).array;}
T[] aryread(T=long)(){return readln.split.to!(T[]);}void arywrite(T)(T a){a.map!text.join(' ').writeln;}
void scan(L...)(ref L A){auto l=readln.split;foreach(i,T;L){A[i]=l[i].to!T;}}alias sread=()=>readln.chomp();
void dprint(L...)(lazy L A){debug{auto l=new string[](L.length);static foreach(i,a;A)l[i]=a.text;arywrite(l);}}
static immutable MOD=10^^9+7;alias PQueue(T,alias l="b<a")=BinaryHeap!(Array!T,l);import std, core.bitop;
// dfmt on

void main()
{
    long N, M;
    scan(N, M);
    auto box = new long[](N);
    auto red = new bool[](N);
    box[] = 1;
    red[0] = true;
    foreach (_; 0 .. M)
    {
        long x, y;
        scan(x, y);
        x--, y--;
        if (red[x])
        {
            if (box[x] == 1)
                red[x] = false;
            red[y] = true;
            box[x]--;
            box[y]++;
        }
        else
        {
            box[x]--;
            box[y]++;
        }
    }
    red.sum().writeln();
}


Measured memory_bytes: 5560
N = int(input())
K = eval("*".join(map(str, list(range(1, N+1)))))
ans = 1
for i in range (2, N + 1):
    num = 0
    while K % i == 0:
        num += 1
        K //= i
    ans *= (num + 1)
print(ans % (10**9 + 7))

Measured memory_bytes: 3956
#include <bits/stdc++.h>
#define INF 1e9
#define MOD 1000000007
using namespace std;
using ll = long long;
using pii = pair<int, int>;

int main(void) {
    int N;
    cin >> N;
    
    vector<ll> z(N), w(N);


    for (int i = 0; i < N; i++)
    {
        ll x, y;
        cin >> x >> y;

        z[i] = x + y;
        w[i] = x - y;
    }

    ll zmax = *max_element(z.begin(), z.end()) - *min_element(z.begin(), z.end());
    ll wmax = *max_element(w.begin(), w.end()) - *min_element(w.begin(), w.end());

    cout << max(zmax, wmax) << endl;
    return 0;
}


Measured memory_bytes: 6420
#include <iostream>
#include <vector>
#include <map>

using namespace std;

int main() {
    int N;
    cin >> N;
    
    vector<long long int> A(N);
    vector<long long int> S(N+1, 0);
    map<long long int, long long int> mp;
    for(int n=0; n<N; n++) {
        cin >> A[n];
        S[n+1] += S[n]+A[n];
        mp[S[n+1]]++;
    }
    
    long long int ans=mp[0];
    for(auto itr=mp.begin(); itr!=mp.end(); itr++) {
        ans += itr->second * ((itr->second)-1) / 2;
    }
    
    cout << ans << endl;


    return 0;
    
}

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

#define for_(i,a,b) for(int i=a;i<b;++i)

bool f[31];

int main() {
	for_(i,0,30) {
		int a; cin >> a;
		f[a] = true;
	}
	for_(i,1,31) if (!f[i]) cout << i << endl;
	return 0;
}

Measured memory_bytes: 1164
#include<bits/stdc++.h>
using namespace std;
 
#define REP(i, n) for(int i = 0; i < n; i++)
#define FOR(i, a, b) for(int i = a; i <= b; i++)
#define ST first
#define ND second
 
ostream& operator<<(ostream &out, string str) {
	for(char c : str) out << c;
	return out;
}
 
template<class L, class R> ostream& operator<<(ostream &out, pair<L, R> p) {
	return out << "(" << p.ST << ", " << p.ND << ")";
}

template<class T> auto operator<<(ostream &out, T &&x) -> decltype(x.begin(), out) {
	out << '{';
	for(auto &e : x)
        	out << e << (&e == &*--x.end() ? "" : ", ");
	return out << '}';
}

template<class... Args> void dump(Args&&... args) {
	((cerr << args << ";  "), ...);
}
 
#ifdef DEBUG
#  define debug(x...) cerr << "[" #x "]: ", dump(x), cerr << "\n"
#else
#  define debug(...) false
#endif
 
template<class T> int size(T && a) { return (int) a.size(); }
 
using LL = long long;
using PII = pair<int, int>;

mt19937 rng(2137);
int rd(int a, int b) {
	return uniform_int_distribution<int>(a, b)(rng);
}

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

	auto start = chrono::steady_clock::now();

	int d;
	cin >> d;
	const int n = 26;
	vector<int> c(n);
	REP(i, n) cin >> c[i];
	vector<vector<int>> s(d, vector<int>(n));
	REP(i, d) REP(j, n) cin >> s[i][j];

	auto get_score = [&](vector<int> &ans) {
		LL score = 0;
		vector<int> last(n, -1);
		REP(i, d) {
			score += s[i][ans[i]];
			last[ans[i]] = i;
			REP(j, n) score -= c[j] * (i - last[j]);
		}
		return score;
	};

	auto get_time = [&]() {
		auto curr = chrono::steady_clock::now();
		return int(chrono::duration_cast<chrono::milliseconds>(curr - start).count());
	};


	LL inf = 1e18;
	auto init = [&]() {
		vector<int> ans(d), last(n, -1);
		REP(i, d) {
			pair<LL, int> opt = {0, -1};
			REP(j, n)
				opt = max(opt, {s[i][j] + c[j] * (i - last[j]), j});
			ans[i] = opt.ND;
			last[ans[i]] = i;
		}
		return ans;
	};

	vector<int> best = init();
	LL best_score = get_score(best);

	auto try_update = [&](vector<int> &cur) {
		LL new_score = get_score(cur);
		if(new_score >= best_score) {
			best = cur;
			best_score = new_score;
		}
	};

	while(get_time() <= 1950) {
		auto cur = best;
		if(get_time() <= 700) {
			int x = rd(0, d - 1);
			cur[x] = rd(0, 25);
		}
		else {
			int len = rd(2, 10);
			int x = rd(0, d - len);
			shuffle(cur.begin() + x, cur.begin() + x + len, rng);
		}
		try_update(cur);
	}

	for(int x : best)
		cout << x + 1 << "\n";
}


Measured memory_bytes: 3712
#include<bits/stdc++.h>
using namespace std;
 
#define REP(i,s,n) for(int i=s;i<n;++i)
#define rep(i,n) REP(i,0,n)
#define SORT(c) sort((c).begin(),(c).end())
#define IINF INT_MAX
#define LLINF LLONG_MAX
#define DEBUG false
 
typedef long long ll;
typedef pair<int, int> ii;

int main() {

	int n;
	cin >> n;
	int cnt = 0;
	bool flag = true;
	rep(i, n){
		string s;
		cin >> s;
		if(s == "A") cnt++;
		else cnt--;
		
		if(cnt < 0) flag = false;
		
	}
	if(cnt != 0) flag = false;
	if(flag) cout << "YES" << endl;
	else cout << "NO" << endl;

	return 0;
}

Measured memory_bytes: 3132
#include<stdio.h>

int main(void){
	int i, j;	//ループ用変数
	
	for (i = 1; i < 10; i++){
		for (j = 1; j < 10; j++){
			printf("%dx%d=%d\n", i, j, i*j);
		}
	}
	return 0;
}

Measured memory_bytes: 524
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
static const int MOD = 1e9+7;
static const ll INF = 1ll<<60;

int main(){
    int N;
    cin>>N;
    vector<ll> A(N);
    for(int i=0; i<N; i++) cin>>A[i];

    ll mi = A[0];
    ll ans = 0;
    for(int i=1; i<N; i++){
        if(mi > A[i]){
            ans += mi-A[i];
            A[i] = mi;
        }
        else{
            mi = A[i];
            ans += abs(mi-A[i]);
        }
    }

    cout<<ans<<endl;
    
}

Measured memory_bytes: 4832
// Crt. 2020-01-11  09:58:59
#include <algorithm>
#include <iostream>
#include <cstring>
#include <cstdio>
#define N 5005
using namespace std;

int n, Mod, K;
int f[2][N];

inline int MOD(int x) {
    return x >= Mod ? x - Mod : x;
}

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

int main(){
#ifdef LOCAL_JUDGE
    freopen("work.in", "r", stdin);
    freopen("work.out", "w", stdout);
#endif

    cin >> n >> Mod, K = n / 2;

    //if (n == 2) return puts("3"), 0;

    int op = 0; f[op][0] = 1;
    for (int i = 2, b; i <= n; ++i) {
        if (n & 1) {
            if (i <= n - K) b = i - 1;
            else b = n - i + 2; 
        } else {
            if (i <= K + 1) b = i - 1;
            else b = n - i + 2;
        }
        //cout << i << " " << b << endl;
        op ^= 1;
        for (int j = 0; j <= n; ++j)
            f[op][j] = 0;
        for (int xi = 0; xi <= n; xi += b)
            for (int j = xi; j <= n; ++j)
                inc(f[op][j], f[op ^ 1][j - xi]);
    }

    int ans = 0;
    for (int i = 0; i < n; ++i)
        inc(ans, 1ll * (n - i) * f[op][i] % Mod);

    cout << ans << endl;

	return 0;
}


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

int main() {
    int N;
    cin >> N;
    int ans = 0;
    for (int i = 1; i <= N; ++i) {
        int cnt = 0;
        for (int j = 1; j <= i; j = j + 2) {
            if (i % j == 0) cnt += 1;
        }
        if (cnt == 8) ans += 1;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

//UFO Shooting Down Operation
public class Main{

	double dot(double[] a, double[] b){
		return a[0]*b[0]+a[1]*b[1];
	}
	
	void run(){
		Scanner sc = new Scanner(System.in);
		while(true){
			int R = sc.nextInt();
			int n = sc.nextInt();
			if((R|n)==0)break;
			double[][] ufo = new double[n][4];
			for(int i=0;i<n;i++)for(int j=0;j<4;j++)ufo[i][j]=sc.nextDouble();
			double[][] adv = new double[n][2];
			double[] dist = new double[n];
			for(int i=0;i<n;i++){
				double norm = Math.hypot(ufo[i][0], ufo[i][1]);
				dist[i] = norm-ufo[i][3];
				adv[i][0] = -ufo[i][0]/norm*ufo[i][3];
				adv[i][1] = -ufo[i][1]/norm*ufo[i][3];
				ufo[i][0] += adv[i][0];
				ufo[i][1] += adv[i][1];
			}
			boolean[] u = new boolean[n];
			int c = 0;
			while(true){
				double min = 1<<20;
				int id = -1;
				for(int i=0;i<n;i++){
					if(u[i])continue;
					double d = dist[i];
					if(d<=R){
						u[i] = true;
						c++;
					}
					else if(d<min){
						min = d;
						id = i;
					}
				}
				if(id==-1)break;
				double norm = Math.hypot(ufo[id][0], ufo[id][1]);
				double[] p = {ufo[id][0]/norm, ufo[id][1]/norm};
				for(int i=0;i<n;i++){
					if(u[i])continue;
					double[] ci = {ufo[i][0], ufo[i][1]};
					double A = dot(p, p);
					double B = -2*dot(p, ci);
					double C = dot(ci, ci)-ufo[i][2]*ufo[i][2];
					double D = B*B-4*A*C;
					if(D>=0){
						double t1 = (-B-Math.sqrt(D))/(2*A);
						double t2 = (-B+Math.sqrt(D))/(2*A);
						if(t1>R||t2>R)u[i] = true;
					}
					ufo[i][0] += adv[i][0];
					ufo[i][1] += adv[i][1];
					dist[i] -= ufo[i][3];
				}
			}
			System.out.println(c);
		}
	}
	
	public static void main(String[] args) {
		new Main().run();
	}
}

Measured memory_bytes: 0
#include <iostream>
#include <string>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <algorithm>
#include <sstream>
#include <cmath>
#include <set>
#include <iomanip>
#include <deque>
#include <stdio.h>
using namespace std;

#define REP(i,n) for(int (i)=0;(i)<(int)(n);(i)++)
#define RREP(i,n) for(int (i)=(int)(n)-1;i>=0;i--)
#define REMOVE(Itr,n) (Itr).erase(remove((Itr).begin(),(Itr).end(),n),(Itr).end())
#define PB_VEC(Itr1,Itr2) (Itr1).insert((Itr1).end(),(Itr2).begin(),(Itr2).end())
#define UNIQUE(Itr) sort((Itr).begin(),(Itr).end()); (Itr).erase(unique((Itr).begin(),(Itr).end()),(Itr).end())
#define LBOUND(Itr,val) lower_bound((Itr).begin(),(Itr).end(),(val))
#define UBOUND(Itr,val) upper_bound((Itr).begin(),(Itr).end(),(val))
typedef long long ll;


int main(){
    
    ll X; cin>>X;
    ll ans=2;
    while(X>0){
        X--;
        ans=ans*2+2;
    }
    
    cout<<ans<<endl;
    
    return 0;
}


Measured memory_bytes: 256
#include <stdlib.h>
#include <stdio.h>
#include <cmath>
#include <algorithm>
#include <vector>
#include <map>
#include <iostream>
#include <set>


using namespace std;
int n,q;
int a[200000];
long long int b,c;
map<int,int> mp;
long long int res = 0;
int main() {
    cin>>n;
    for(int i=0;i<n;i++) {
        cin>>a[i];
        mp[a[i]]++;
        res+=a[i];
    }

    cin>>q;
    for(int i=0;i<q;i++) {
        cin>>b>>c;
        int cnt = mp[b];
        mp[c]+=cnt;
        mp[b] = 0;
        res-=b*cnt;
        res+=c*cnt;

        cout<<res<<endl;
    }

    return 0;
}

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

#define ll              long long
#define pb              push_back
#define mp              make_pair
#define ff              first
#define ss              second
#define SQ(x)           ((x)*(x))
#define LCM(x,y)        (((x)/gcd((x),(y)))*(y))
#define PI              acos(-1)
#define SZ(x)           x.size() - 1
#define waa             printf("Ripon\n")
#define mem(a,b)        memset(a,b,sizeof(a))
#define rep(i,a,n)      for(int i=(int)(a);i<=(int)(n);i++)
#define per(i,n,a)      for(int i=(int)(n);i>=(int)(a);i--)
#define SC              scanf
#define PF              printf
#define all(v)          v.begin(), v.end()
#define allr(v)         v.rbegin(), v.rend()
int dx[] = { 0, 1, 0, -1, -1, 1, 1, -1 };
int dy[] = { 1, 0, -1, 0, -1, -1, 1, 1 };
int kx[] = { -2, -2, -1, 1, 2, 2, 1, -1 };
int ky[] = { -1, 1, 2, 2, 1, -1, -2, -2 };
int overlap(int rs,int re,int qs,int qe){ if(rs>qe or re<qs) return 0; else if(qs<=rs and re<=qe) return 1; else return 2;} // 0 no, 1 total, 2 partial
//--------------------------//
void pvec(auto v){
    for (auto x:v){
        cout<<x<<" ";
    }
    cout<<endl;
}
//------------done with useless stuff--------------//


struct DATA{};
#define TC 0
#define mod 10000007
#define N 1000000
int n,m;
vector<int> v;



void solve(int T) {

    int n;
    cin>>n;
    cout<<n*(n+1)/2<<endl;
    return;

}


int main(){

    ios_base::sync_with_stdio(0);cin.tie(nullptr);
	#ifdef RIPON
	    freopen("file.txt","r",stdin);
	#endif

    int T=1;
    if(TC) cin>>T;
    for(int t=1;t<=T;t++)   solve(t);
    return 0;
}



Measured memory_bytes: 256
#include<stdio.h>


int c=0;
void s (int *x, int *y) {
  int temp; 
  temp = *x;
  *x = *y;
  *y = temp;

}


void sort (int array[], int size) {
  int i, j, in;

  for (i = 0; i < size-1; i++) {
    in = i;   
    for (j = i + 1; j < size; j++) {
      if (array[j] < array[in]){in = j; }   
    }
    if(in!=i)c++;
    s(&array[in], &array[i]);
  }
}

int main (void) {
  int g;
  scanf("%d",&g);
  int i;
  int a[100];
    for(i =0;i<g;i++){
      scanf("%d",&a[i]);
    }
  sort(a,g); 
  for (i = 0; i < g; i++) { printf("%d", a[i]);if(i!=g-1)printf(" ");}
  printf("\n");
  printf("%d\n",c);

  return 0;
}



Measured memory_bytes: 2104
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, j, n) for (ll i = j; i < n; i++)
#define all(x) (x).begin(),(x).end()
#define INF (1000000000)
#define MOD (1000000007)
#define MAX (100000)
#define pii pair<int, int>

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

class XY{
public:
  ll x, y;
  XY() {x = y = 0;}
  XY(ll u, ll v) {x = u; y = v;}
};

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

template<typename T1, typename T2>
ll mypow(T1 a, T2 n){
  if(n == 0) return 1;
  if(n == 1) return a;
  if(n % 2) return a * mypow(a, n - 1);
  ll tmp = mypow(a, n / 2);
  return tmp * tmp;
}

template<typename T>
int BS(vector<T> V, int left, int right, T key){
  int mid = (left + right) / 2;
  if(V[mid] <= key) left = mid;
  else right = mid;
  if(right - mid == 1) return left;
  else return BS(V, left, right, key);
}

ll comb(ll n, ll r){
	ll res = 1;
  rep(i, 0, r){
    res *= n - i;
    res /= i + 1;
  }
  return res;
}

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

int DFS(vector<vector<char>> &A, int h, int w){
  if(h == A.size() - 1 && w == A[0].size() - 1) return 1;
  int res = 0;
  if(h < A.size() - 1) if(A[h + 1][w] == '#') if(DFS(A, h + 1, w)) res = 1;
  if(w < A[0].size() - 1) if(A[h][w + 1] == '#') if(DFS(A, h, w + 1)) res = 1;
  return res;
}

void Main() {
  int H, W; cin >> H >> W;
  vector<vector<char>> A(H, vector<char>(W));
  int cnt = 0;
  rep(i, 0, H) rep(j, 0, W) {
    cin >> A[i][j];
    if(A[i][j] == '#') cnt++;
  }
  string res;
  if(cnt == H + W - 1 && DFS(A, 0, 0)) res = "Possible";
  else res = "Impossible";
  cout << res << endl;
}

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

int main(){
  cin.tie(nullptr);
  ios_base::sync_with_stdio(false);
  cout << std::fixed << std::setprecision(15);

  Main();
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <cstdlib>
#include <map>
#include <set>
#include <vector>
#include <utility>
#include <queue>
#include <cmath>

#define BEGIN(x) x.begin()
#define END(x) x.end()
#define ALL(x) BEGIN(x), END(x)
#define PAIR make_pair
#define VEC(type) vector<type >

#define FOR(i, A, B) for(auto i = (A);i != (B); i++)
#define FORD(i, A, B) for(auto i = (A);i != (B); i--)

#define READRANGE(begin, end) FOR(it, begin, end) cin >> *it
#define READVEC(V) READRANGE(BEGIN(V), END(V))

using namespace std;

typedef long long lint;

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

int main(int argc, char **argv)
{
    io_init();

    // Actual program code starts here.
    int N, K;
    cin >> N >> K;
    VEC(int) bad(K);
    READVEC(bad);
    set<int> badset(ALL(bad));
    FOR(i, N, N + 200000) {
        bool good = true;
        int tmp = i;
        while (tmp > 0) {
            if (badset.count(tmp % 10))
                good = false;
            tmp /= 10;
        }

        if (good) {
            cout << i << endl;
            break;
        }
    }
    return 0;
};


Measured memory_bytes: 256
a,b = map(int,input().split())
if (0 <= a <= 100 and 2 <= b<= 1000 and b % 2 ==0):
   if 13 <= a <= 100:
       print(b)
   elif 6 <= a <= 12:
       print(int(b/2))
   else:
       print(0)

Measured memory_bytes: 3060
import java.util.*;
public class Main{
    static Scanner sc = new Scanner(System.in);
    public static void main(String[] args) {
        int N = sc.nextInt();
        Map<Integer,Integer> map = new HashMap<>();
        long sum = 0;
        for(int i = 0; i < N; i++) {
            int curr = sc.nextInt();
            map.put(curr, map.getOrDefault(curr,0) + 1);
            sum += curr;
        }
        int q = sc.nextInt();
        for(int i = 0; i < q; i++) {
            int b = sc.nextInt();
            int c = sc.nextInt();
            if(map.containsKey(b)) {
                int count = map.get(b);
                sum -= (long)b * count;
                sum += (long)c * count;
                map.remove(b);
                map.put((int)c, map.getOrDefault(c, 0) + count);
            }
            System.out.println(sum);
        }
    }
}

Measured memory_bytes: 64128
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);
		StringBuffer sb = new StringBuffer(sc.next());
		StringBuffer pos = new StringBuffer();

		int q = sc.nextInt();
		boolean reverse = false;
		for(int i = 0; i < q; i++){
			int op = sc.nextInt();

			if(op == 1){
				reverse = !reverse;
			}

			else {
				int f = sc.nextInt();
				char c = sc.next().charAt(0);
				if((f == 1 &&!reverse) || (f == 2 && reverse)){
					pos.append(c);
				}
				else {
					sb.append(c);
				}
			}
		}

		if(!reverse){
			System.out.println(pos.reverse().toString() + sb);
		}
		else {
			System.out.println(sb.reverse() + pos.toString());
		}
	}
}


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

const int MAX_N = 200000;

int main() {
	int N, K, total = 0, Amax = 0;
	static int cnt[MAX_N + 1];

	std::cin >> N >> K;
	for(int i = 0; i < N; ++i) {
		int A;
		std::cin >> A;
		Amax = std::max(Amax, A);
		if(cnt[A] == 0) ++total;
		++cnt[A];
	}
	std::sort(cnt, cnt + Amax + 1);

	int ans = 0, c = 1;
	while(total > K) {
		if(cnt[c] > 0) {
			ans += cnt[c];
			--total;
		}
		++c;
	}

	std::cout << ans << std::endl;
}


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

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

    long long X[N], Y[N];
    double Z[N];
    int j=0;

    for (int i = 0; i < N; i++)
    {
        cin >> X[i] >> Y[i];
        Z[i] = sqrt(X[i] * X[i] + Y[i] * Y[i]);

        if (Z[i] <= D)
        {
            j++;
        }
    }

    cout << j;
}

Measured memory_bytes: 8304
#include <iostream>
#include <stdbool.h>
using namespace std;

int main(){
  unsigned long long n,b,r, c=0, t=0;
  cin>>n>>b>>r;
  c = n/(b+r);
  c*=b;
  unsigned long long x = n-(n/(b+r)*(b+r));
  if(x<b) c+=x;
  else c+=b;
  cout<<c;
}

Measured memory_bytes: 256
#include <iostream> 
#include<vector>
#include<algorithm>
#include<map>
#include<set>
#include<queue>
#include<iomanip>
#include<sstream>
#include<cmath>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define req(i,n) for(int i = 1;i <=  n; i++)
#define rrep(i,n) for(int i = n -1;i >= 0;i--)
typedef long long int ll;
typedef long double ld;
const ll INF = 1LL << 60;
const int inf = (1 << 30);
const int MOD = 1000000007;
ll n, k, ans = 0, h = 1, W, now = 0, a, b, c, d;
template<typename A, size_t N, typename T>
void Fill(A(&array)[N], const T & val) {
    std::fill((T*)array, (T*)(array + N), val);
}
int main() {
    cin >> n >> W;
    vector<int> v(n), w(n);
    rep(i, n) cin >> w[i] >> v[i];
    ll dp[100010][110];
    Fill(dp, 0);
    rep(i, W+1) {
        rep(j, n) {
            if (w[j] <= i) {
                dp[i][j + 1] = max(dp[i][j], dp[i - w[j]][j] + v[j]);
            }
            else dp[i][j + 1] = dp[i][j];
        }
    }
    rep(i, W + 1) {
        ans = max(ans, dp[i][n]);
    }cout << ans << endl;
}

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

struct StCoord
{
  StCoord() : m_nx(0), m_ny(0), m_nHigh(0) { }

  int m_nx;
  int m_ny;
  int m_nHigh;
};

void fnInput(vector<StCoord>& rvoCoord)
{
  int nCoordSiz;
  cin >> nCoordSiz;
  rvoCoord.resize(nCoordSiz);

  for (StCoord& roCoord : rvoCoord)
    cin >> roCoord.m_nx >> roCoord.m_ny >> roCoord.m_nHigh;
}

int fnCenterHigh(StCoord oCenter, StCoord oCoord)
{
  return  abs(oCenter.m_nx - oCoord.m_nx) 
        + abs(oCenter.m_ny - oCoord.m_ny) + oCoord.m_nHigh;
}

bool fnCenterCheck(StCoord& roCenter, const vector<StCoord>& cnrvoCoord)
{
  int nCenterHigh = 0;

  for (int i = 0; i < cnrvoCoord.size(); ++i)
    if ( cnrvoCoord[i].m_nHigh )
      if ( !nCenterHigh )
        nCenterHigh = fnCenterHigh(roCenter, cnrvoCoord[i]);
      else
        if (nCenterHigh != fnCenterHigh(roCenter, cnrvoCoord[i]))
          return false;

  for (int i = 0; i < cnrvoCoord.size(); ++i)
    if ( !cnrvoCoord[i].m_nHigh )
      if (nCenterHigh <= fnCenterHigh(roCenter, cnrvoCoord[i]));
      else
        return false;

  roCenter.m_nHigh = nCenterHigh;
  return true;
}

void fnCenterCoord(const vector<StCoord>& cnrvoCoord)
{
  StCoord oCenter;
  bool bCenter = false;
  oCenter.m_nx = -1;

  while ( !bCenter       &&
          oCenter.m_nx < 101 )
  {
    ++oCenter.m_nx;
    oCenter.m_ny = -1;

    while ( !bCenter       &&
            oCenter.m_ny < 101 )
    {
      ++oCenter.m_ny;
      bCenter = fnCenterCheck(oCenter, cnrvoCoord);
    }
  }
  if ( bCenter )  
    cout << oCenter.m_nx << " " << oCenter.m_ny << " " << oCenter.m_nHigh;
}
  
int main()
{
  vector<StCoord> voCoord;
  
  fnInput(voCoord);
  fnCenterCoord(voCoord);

  return 0;
}

Measured memory_bytes: 3640
#define _CRT_SECURE_NO_WARNINGS

#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <cstring>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <list>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include <unordered_set>
#include <unordered_map>
#include <array>
#include <cassert>
#include <bitset>
#include <cstdint>
using namespace std;
using LL = long long;



int main() {
	int N;
	cin >> N;
	int ans = 0;
	for (int i = 1; i <= N; ++i) {
		int k = (int)log10(i);
		if (k % 2 == 0) {
			++ans;
		}
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include<stdio.h>

#define N 110

int main(){
  int Graph[N][N];
  int loop;
  int i,j;
  int vertex,adjacent,adnum;

  scanf("%d",&loop);
  for(i=1;i<loop+1;i++){
    scanf("%d %d",&vertex,&adjacent);

    for(j=1;j<adjacent+1;j++){

      scanf("%d",&adnum);

      if(adnum!=0){
	Graph[vertex][adnum]=1;
      }

      else{
	Graph[vertex][adnum]=0;
      }
    }
    
  }

  for(i=1;i<loop+1;i++){
    for(j=1;j<loop;j++){

      printf("%d ",Graph[i][j]);
    }

    printf("%d\n",Graph[i][loop]);
  }
			
  return 0;
}



Measured memory_bytes: 2112
#include <algorithm>
#include <bitset>
#include <cmath>
#include <complex>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <regex>
#include <set>
#include <stack>
#include <string>
#include <vector>

const int MOD = 1e9 + 7;
const int iINF = 2147483647 / 2;
const long long int llINF = 9223372036854775807 / 2;

using namespace std;
using ll = long long int;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;
using vvvl = vector<vector<vector<ll>>>;

typedef pair<ll, ll> pll;
bool paircomp(const pll &a, const pll &b) {
  if (a.first == b.first)
    return a.second < b.second;
  return a.first < b.first;
}

#define REP(i, n) for (ll i = 0; i < (n); i++)
#define RREP(i, n) for (ll i = (n)-1; i >= 0; i--)
#define FOR(i, a, b) for (ll i = (a); i < (b); i++)
#define AUTO(i, m) for (auto &i : m)
#define ALL(a) (a).begin(), (a).end()
#define MAX(vec) *std::max_element(vec.begin(), vec.end())
#define MIN(vec) *std::min_element(vec.begin(), vec.end())
#define ARGMAX(vec)                                                            \
  std::distance(vec.begin(), std::max_element(vec.begin(), vec.end()))
#define ARGMIN(vec)                                                            \
  std::distance(vec.begin(), std::min_element(vec.begin(), vec.end()))
#define REV(T) greater<T>()
#define PQ(T) priority_queue<T, vector<T>, greater<T>>
#define VVL(a, b, c) vector<vector<ll>>(a, vector<ll>(b, c))
#define VV(T, a, b, c) vector<vector<T>>(a, vector<T>(b, c))
#define VVVL(a, b, c, d)                                                       \
  vector<vector<vector<ll>>>(a, vector<vector<ll>>(b, vector<ll>(c, d)))
#define VVV(T, a, b, c, d)                                                     \
  vector<vector<vector<T>>>(a, vector<vector<T>>(b, vector<T>(c, d)))
#define SP(a) setprecision(a)
#define SQRT(a) sqrt((long double)(a))
#define DPOW(a, b) pow((long double)(a), (long double)(b))
#define UNIQUE(vec)                                                            \
  do {                                                                         \
    sort(ALL((vec)));                                                          \
    (vec).erase(std::unique(ALL((vec))), (vec).end());                         \
  } while (0)

ll POW(ll n, ll m) {
  if (m == 0) {
    return 1;
  } else if (m % 2 == 0) {
    ll tmp = POW(n, m / 2);
    return (tmp * tmp);
  } else {
    return (n * POW(n, m - 1));
  }
}

int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  ll N;
  cin >> N;
  vl A(N);
  map<ll, ll> M;
  REP(i, N) {
    cin >> A[i];
    if (M.find(A[i]) == M.end()) {
      M[A[i]] = 1;
    } else {
      M[A[i]]++;
    }
  }
  ll ans = 0;
  AUTO(m, M) { ans += (m.second * (m.second - 1)) / 2; }
  REP(i, N) {
    ll po = M[A[i]];
    ll score = ans;
    score -= (po * (po - 1)) / 2;
    score += ((po - 2) * (po - 1)) / 2;
    cout << score << endl;
  }

  return 0;
}


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

#define rep(i,n,m) for(int (i)=(n);(i)<(m);(i)++)
#define rrep(i,n,m) for(int (i)=(n);(i)>(m);(i)--)
using ll = long long;
const ll MOD = 1e9+7;


int gcd(int a,int b){
    if (a < b) swap(a,b);
    int t = 0;
    while (a % b != 0){
        t = a % b;
        a = b;
        b = t;
    }
    return b;
}

int main(){

    int N,a,now;
    cin >> N;
    rep(i,0,N){
        cin >> a;
        if (i == 0){
             now = a;
        }else{
            now = gcd(a,now);
        }
    }

    cout << now << endl;
}

Measured memory_bytes: 256
#pragma warning(disable: 4996)
#include<stdio.h>

int a, b, c, x;
int flag = 0;
int main() {
	scanf("%d %d %d", &a, &b, &c);
	
	
		if (a > b) {
			x = a;
			a = b;
			b = x;
		}
		if (b > c) {
			x = b;
			b = c;
			c = x;
		}
		if (a > b) {
			x = a;
			a = b;
			b = x;
		}
	printf("%d %d %d\n", a, b, c);
	

}


Measured memory_bytes: 1940
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define endl "\n"
#define print_array(name,n) for(ll o=0;o<n;o++) cout<<name[o]<<" "
#define fr(i,f,t) for(ll i=(f);i<t;i++)
#define fb(i,f,t) for(ll i=(f);i>=t;i--)
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define inf 2e18
bool sortbysecond(const pair<int,int> &a,const pair<int,int> &b){
	return (a.ss>b.ss);
}


int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);cout.tie(0);
    ll n;
    cin>>n;
    double arr[n] = {0};
    fr(i,0,n){
    	cin>>arr[i];
    }
    sort(arr,arr + n);
    double maxi = 0;
    double temp = arr[0];
    fr(i,1,n){
    	temp = (arr[i]+temp)/2;
    }
    cout<<setprecision(10)<<temp<<endl;
    return 0;
}


Measured memory_bytes: 256
import bisect
n, k = map(int, input().split())
a = list(map(int, input().split()))
seen = []
seen_sort = [1]
start = 1

while True:
    tmp = a[start - 1]
    seen.append(start)
    index = bisect.bisect_left(seen_sort, tmp)
    if index >= len(seen_sort) or seen_sort[index] != tmp:
        seen_sort.insert(index, tmp)
    else:
        repeat_index = seen.index(tmp)
        repeat_len = len(seen) - repeat_index
        break
    start = tmp

if k <= repeat_index:
    print(seen[k])
else:
    print(seen[repeat_index + ((k - repeat_index) % repeat_len)])

Measured memory_bytes: 103404
using System; 
   class AIDU0015
    {
        static string res,resf;
        static bool carry=false;
        static int a0f,a1f,Af,i;
        static string[] ress;

        public static void Main(){
            /*add for each figures
            return whether carries and figures of self
            */
            string a0,a1;
            const int M=80;
            int Np,np,l0,l1,j;
            bool ex;
            
            byte N=byte.Parse(Console.ReadLine());
            ress=new string[N];

            for(i=0;i<N;i++) {
                res="";

                //input string
                a0=Reverse(Console.ReadLine());
                a1=Reverse(Console.ReadLine());
                //screen
                l0=a0.Length;           l1=a1.Length;
                Np=Math.Max(l0,l1);     np=Math.Min(l0,l1);
                ex=l0>=l1;
                //Calc
                for(j=0;j<Np;j++) {
                    if(j<np) { 
                        a0f=int.Parse(a0.Substring(j,1));           a1f=int.Parse(a1.Substring(j,1));
                    } else {    //np<=j<Np
                        a0f=int.Parse((ex?a0:a1).Substring(j,1));   a1f=0;
                    }
                    Af=a0f+a1f+(carry?1:0);

                    carry=Af>=10;
                    resf =(Af%10).ToString();       res=string.Concat(resf,res);
                }
                if(carry) {
                    res =string.Concat("1",res);carry=false;
                }
                
                ress[i]=res.Length>M?"overflow":res;
            }

            foreach(string ress1 in ress) {
                Console.WriteLine(ress1);
            }
            Console.ReadKey();

        }
        
        
        static string Reverse(string s) {
            //http://o-maguro.hatenablog.com/entry/2014/06/09/200421
            char[] chars = s.ToCharArray();
            Array.Reverse(chars);
            return new string(chars);
        }

    }

Measured memory_bytes: 9772
// Problem : B - Substring
// Contest : AtCoder - AtCoder Beginner Contest 177
// URL : https://atcoder.jp/contests/abc177/tasks/abc177_b
// Memory Limit : 1024 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

#pragma GCC optimize("O2")
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)
#define mod 1000000007
using namespace std;
using namespace __gnu_pbds;
typedef long long ll;
typedef tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update> indexed_set;
int main()
{
	fast;
	ll t = 1;
	// cin >> t;
	while (t--)
	{
		string s,t;
		cin>>s>>t;
		ll ans = 100000;
		for(ll i=0;i<s.size();i++)
		{
			ll k=i;
			if(k > (s.size()-t.size()))
			{
				break;
			}
			ll cnt = 0;
			for(ll j=0;j<t.size();j++)
			{
				if(t[j] != s[k++])
					cnt++;
			}
			ans = min(cnt,ans);
		}
		cout<<ans<<"\n";
	}
	return 0;
}


Measured memory_bytes: 3656
#include <iostream>
#include <vector>
#include <utility>              // swap
using namespace std;

int bubbleSort(vector<int>& A) {
    bool flag = true;
    int cnt = 0;                // 交換した回数

    while (flag) {
        flag = false;
        for (auto i = A.size()-1; i >= 1; i--) {
            if (A[i] < A[i-1]) {
                swap(A[i], A[i-1]);
                flag = true;
                cnt++;
            }
        }
    }
    return cnt;
}

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

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

    int ans = bubbleSort(ary);
    for (auto i = 0; i < ary.size(); i++) {
        cout << (i ? " " : "") << ary[i];
    }
    cout << endl;
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 1200
#include<iostream>
using namespace std;
string w[110];
int main() {
	
	int N;
	cin >> N;
	for (int i = 0; i < N; i++)
		cin >> w[i];

	bool ans = true;
	for (int i = 0; i < N-1; i++)
		if (w[i][w[i].length()-1] != w[i + 1][0])
			ans = false;
	for (int i = 0; i < N; i++)
		for (int j = i + 1; j < N; j++)
			if (w[i] == w[j])
				ans = false;
	if (ans)
		cout << "Yes" << endl;
	else
		cout << "No" << endl;
	return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;
public class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        String s = in.nextLine();
        if(s.charAt(2)==s.charAt(3)&&s.charAt(5)==s.charAt(4))  System.out.println("Yes");
        else System.out.println("No");
    }
}

Measured memory_bytes: 21844
import math
K=int(input())
sum=int(0.5*K*(K+1))

for i in range(1, K):
    for j in range(i+1, K+1):
        sum+=6*math.gcd(i, j)

for i in range(1, K-1):
    for j in range(i+1, K):
        for k in range(j+1, K+1):
            sum+=6*math.gcd(math.gcd(i, j), k)

print(sum)

Measured memory_bytes: 9200
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, a, b) for (int i = a; i < b; i++)
#define all(v) v.begin(), v.end()
const int MOD = 1e9 + 7;
const int INF = 2e9;
//'A' = 65, 'Z' = 90, 'a' = 97, 'z' = 122

int main() {
    int h, w;
    cin >> h >> w;
    string s[h];
    rep(i, 0, h) cin >> s[i];
    int cnt1[h][w] = {};
    int cnt2[h][w] = {};
    rep(i, 0, h) {
        int tmp = 0;
        rep(j, 0, w) {
            if (s[i][j] == '#') {
                if (tmp >= 1) {
                    for (int k = max(0, j - 1); k >= j - tmp; k--) cnt1[i][k] = tmp;
                    tmp = 0;
                }
            } else {
                tmp++;
            }
        }
        if (tmp) {
            for (int k = w - 1; k >= w - tmp; k--) {
                cnt1[i][k] = tmp;
            }
        }
    }
    rep(i, 0, w) {
        int tmp = 0;
        rep(j, 0, h) {
            if (s[j][i] == '#') {
                if (tmp >= 1) {
                    for (int k = max(0, j - 1); k >= j - tmp; k--) cnt2[k][i] = tmp;
                    tmp = 0;
                }
            } else {
                tmp++;
            }
        }
        if (tmp) {
            for (int k = h - 1; k >= h - tmp; k--) {
                cnt2[k][i] = tmp;
            }
        }
    }

    int ans = -10;
    rep(i, 0, h) {
        rep(j, 0, w) {
            if (s[i][j] == '.') {
                ans = max(ans, cnt1[i][j] + cnt2[i][j] - 1);
            }
        }
    }
    cout << ans << endl;

    /*rep(i, 0, h) {
        rep(j, 0, w) {
            cout << cnt1[i][j] << " ";
        }
        cout << endl;
    }*/
    return 0;
}


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

int main(){
	int N;
	cin >> N;
	vector <pair<int, int> > lr(N);
	for (int i = 0; i < N; i++) cin >> lr.at(i).first >> lr.at(i).second;
	long ans = 0;
	for (int i = 0; i < N; i++) ans += lr.at(i).second - lr.at(i).first + 1;
	cout << ans << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define inf 1000000000
#define mod 1000000007
using namespace std;
using LL = long long;

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

    if(a>=13)cout<<b<<endl;
    else if(a>=6)cout<<b/2<<endl;
    else cout<<0<<endl;
}


Measured memory_bytes: 256
use std::cmp::max;
use std::fs::File;
use std::io::{stdout, BufWriter, Read, Write};
use std::thread;

fn main() {
    thread::Builder::new()
        .stack_size(32 * 1024 * 1024) // 32MB
        .spawn(run)
        .unwrap()
        .join()
        .unwrap();
}

/// ローカル環境なら _in.txt から入力を受ける
fn read_input() -> String {
    let stdin = std::io::stdin();
    let mut s = String::new();
    match option_env!("LOCAL") {
        Some(_) => File::open("src/_in.txt")
            .expect("File not found")
            .read_to_string(&mut s)
            .unwrap(),
        None => stdin.lock().read_to_string(&mut s).unwrap(),
    };
    s
}

fn run() {
    let out = stdout();
    let mut out = BufWriter::new(out.lock());
    let input = read_input();
    let mut input = input.split_whitespace();

    let a: i64 = input.next().unwrap().parse().unwrap();
    let b: i64 = input.next().unwrap().parse().unwrap();

    let r1 = a * b;
    let r2 = a - b;
    let r3 = a + b;

    writeln!(out, "{}", max(r3, max(r1, r2))).ok();
}


Measured memory_bytes: 8572
import java.io.*;
import java.math.*;
import java.util.*;
public class Main { 
 
	public static void main(String[] args) { 
		FastScanner I = new FastScanner(); //Input
		OutPut O = new OutPut(); //Output
		O.pln((I.nextInt()-1)*(I.nextInt()-1));
	}
	public static long ceil(long num, long den) {long ans = num/den; if (num%den!=0) 
	ans++; return ans;}
	public static long GCD(long a, long b) {
		if (a==0||b==0) return Math.max(a,b);
		return GCD(Math.min(a, b),Math.max(a, b)%Math.min(a, b));
	}
	public static long FastExp(long base, long exp, long mod) {
		long ans=1;
		while (exp>0) {
			if (exp%2==1) ans*=base;
			exp/=2;
			base*=base;
			base%=mod;
			ans%=mod;
		}
		return ans;
	}
	public static long ModInv(long num,long mod) {return FastExp(num,mod-2,mod);}
	static class FastScanner {
		BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
		StringTokenizer st=new StringTokenizer("");
		String next() {
			while (!st.hasMoreTokens())
				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());};
	}
	static class OutPut{
		PrintWriter w = new PrintWriter(System.out);
		void pln(int x) {w.println(x);w.flush();}
		void pln(long x) {w.println(x);w.flush();}
		void pln(String x) {w.println(x);w.flush();}
		void pln(char x) {w.println(x);w.flush();}
		void pln(StringBuilder x) {w.println(x);w.flush();}
		void p(int x) {w.print(x);w.flush();}
		void p(long x) {w.print(x);w.flush();}
		void p(String x) {w.print(x);w.flush();}
		void p(char x) {w.print(x);w.flush();}
		void p(StringBuilder x) {w.print(x);w.flush();}
	}
}



Measured memory_bytes: 25580
#include <cstdio>
#include <cmath>
#include <set>

using namespace std;

int main()
{
	int N;
	double R;
	int dx[] = {1, 0, -1, 0, 1, -1, 1, -1};
	int dy[] = {0, 1, 0, -1, -1, 1, 1, -1};
	
	scanf("%d %lf", &N, &R);
	
	set<pair<int, int> > g;
	
	for (int i = 0; i < N; i++){
		double x, y;
		scanf("%lf %lf", &x, &y);
		int nx = (int)floor(x / R), ny = (int)floor(y / R);
		if (g.find(make_pair(nx, ny)) == g.end()){
			g.insert(make_pair(nx, ny));
		}
	}
	
	int ans = 0;
	
	set<pair<int, int> >::iterator it = g.begin();
	
	for(;it != g.end(); it++){
		ans++;
		int sx = it->first, sy = it->second;
		for (int i = 0; i < 8; i++){
			int tx = sx + dx[i], ty = sy + dy[i];
			if (g.find(make_pair(tx, ty)) != g.end()){
				g.erase(make_pair(tx, ty));
			}
		}
	}
	
	printf("%d\n", ans);
	
	return (0);
}

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

int main() {
  string S;
  cin >> S;

  if (S == "Sunny") {
    cout << "Cloudy" << endl;
  } else if (S == "Cloudy") {
    cout << "Rainy" << endl;
  } else {
    cout << "Sunny" << endl;
  }
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main() {
    int n;
    cin >> n;
    int a[n+1];
    bool pressed[n+1] = {};
    for (int i=1; i<=n; i++) {
        cin >> a[i];
    }
    int on = 1, cnt = 0;
    while (on != 2) {
        if (pressed[a[on]] == false) {
            pressed[a[on]] = true;
            on = a[on];
            cnt++;
        } else {
            cout << -1 << endl;
            return 0;
        }
    }
    cout << cnt << endl;
}

Measured memory_bytes: 4112
#include<stdio.h>
int n, L, w[101000],x;
int main(){
    int i;
    scanf("%d%d",&n,&L);
    for(i=1;i<=n;i++){
        scanf("%d",&w[i]);
    }
    for(i=1;i<n;i++){
        if(w[i]+w[i+1] >= L)x = i;
    }
    if(!x){
        printf("Impossible\n");
        return 0;
    }
    printf("Possible\n");
    for(i=1;i<x;i++)printf("%d\n",i);
    for(i=n-1;i>=x;i--)printf("%d\n",i);
}


Measured memory_bytes: 1152