akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define ff first
#define ss second
#define len(x) (int)(x.size())
#define all(vs) vs.begin(), vs.end()
using ii = pair<int, int>;
using ll = long long;

int32_t main(){
	ios::sync_with_stdio(0);	
	string st;
	cin >> st;
	for(char &c:st) cout << 'x';
	cout << endl;
}


Measured memory_bytes: 256
from decimal import *
N, K = map(int, input().split())
As = list(map(int, input().split()))
MOD = 10**9 + 7


K_1 = Decimal(K)*Decimal(1+K) / Decimal(2)
K_2 = (K_1 - Decimal(K)) % Decimal(MOD)
K_1 %= Decimal(MOD)

res_next = [0 for i in range(N)]
for i in range(N):
    a = As[i]
    for j in range(i+1, N):
        if a > As[j]:
            res_next[i] += 1

res_prev = [0 for i in range(N)]

for i in range(N):
    a = As[i]
    for j in range(i):
        if a > As[j]:
            res_prev[i] += 1

ans = Decimal(0)

for i in range(N):
    ans += (Decimal(res_next[i]) * K_1) % Decimal(MOD)
    ans %= Decimal(MOD)
    ans += (Decimal(res_prev[i]) * K_2) % Decimal(MOD)
    ans %= Decimal(MOD)

print(int(ans))


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

using namespace std;
typedef long long ll;

#define rep(i, N) for (int i = 0; i < (int)N; i++)
const ll MOD = pow(10,9)+7;
const ll LLINF = pow(2,61)-1;
const int INF = pow(2,30)-1;


int main() {
  int N; cin >> N;
  double a[N]; rep(i,N) cin >> a[i];
  double ave = 0; rep(i,N) ave += a[i]; ave /= N;
  int result = 0;
  rep(i,N) if (abs(a[i]-ave)<abs(a[result]-ave)) result = i;
  cout << result << endl;
  return 0;
}

Measured memory_bytes: 256
N, M = map(int, input().split())

H = [int(x) for x in input().split()]

road_list = [[] * N for _ in range(N)]
for i in range(M):
  A, B = map(int, input().split())
  road_list[A-1].append(H[B-1])
  road_list[B-1].append(H[A-1])

ans = 0
for i in range(N):
  if len(road_list[i]) == 0:
    ans += 1
  elif H[i] > max(road_list[i]):
    ans += 1
    
print(ans)

Measured memory_bytes: 23040
import java.util.Scanner;

class Main {
  public static void main(String args[]) {
	  	Scanner scanner = new Scanner(System.in);
	  	int a[] = new int[10000];  // 配列確保（大きめに）
        int n = scanner.nextInt(); // データ数
        int max = -1000000;
        int min = 1000000;
        long sum = 0;
        int i;
        
        // データ入力
        for (i = 0; i < n; i++) {
            a[i] = scanner.nextInt();
        }
	  	
        for (i = 0; i < n; i++) {
            if(min > a[i])
            	min = a[i];
        }
        for (i = 0; i < n; i++) {
            if(max < a[i])
            	max = a[i];
        }
		for (i = 0; i < n; i++) {
        	sum += a[i];
        }
        
        System.out.println(min + " " + max + " " + sum  );
        
        scanner.close();
  }
}



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


int main(){
	long long n, m;
	while(cin >> n){
		long long x = 0x3f3f3f3f, y = 0;
		int f = 0;
		for(int i = sqrt(n); i >= 1; i--){
			if((n / i) * i == n){
				x = n / i;
				y = i;
				f = 1;
				break;
			}
		}
		if(f == 0)
			x = n, y = 1;
		printf("%lld\n",x + y - 2);
	}
	return 0;
}

Measured memory_bytes: 256
import sys
import itertools

# import numpy as np

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

N, *AB = map(int, read().split())
A = AB[:N + 1]
B = AB[N + 1:]

B.append(0)
ans = 0
rest = 0
for i, j in zip(A, B):
    x = min(rest, i)
    ans += x
    i -= x
    if i < j:
        ans += i
        rest = j - i
    else:
        ans += j
        rest = 0
print(ans)


Measured memory_bytes: 23432
#include <bits/stdc++.h>
#include <algorithm>
#include <vector>
#define rep(i,n) for(int i=0;i<(n);++i)
using namespace std;
typedef long long ll;
 
int main() {
    string s;
    cin>>s;

    if(s=="SUN")    cout<<7<<endl;
    if(s=="MON")    cout<<6<<endl;
    if(s=="TUE")    cout<<5<<endl;
    if(s=="WED")    cout<<4<<endl;
    if(s=="THU")    cout<<3<<endl;
    if(s=="FRI")    cout<<2<<endl;
    if(s=="SAT")    cout<<1<<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 = Integer.parseInt(sc.nextLine());
        int b = Integer.parseInt(sc.nextLine());
        int c = Integer.parseInt(sc.nextLine());
        int x = Integer.parseInt(sc.nextLine());
        int count = 0;
        for(int i = 0; i<=a ;i++){
            for(int j = 0; j<=b ;j++){
                for(int k = 0; k<=c ;k++){
                    if( 500 * i + 100 * j + 50 * k == x){
                        count++;
                    }
                }
            }
        }
        System.out.println(count);

    }
}


Measured memory_bytes: 21844
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <utility>
#include <tuple>
#include <cstdint>
#include <cstdio>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <deque>
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#include <cctype>
#include <numeric>
#include <cmath>
#include <iomanip> //cout << fixed << setprecision(15) << << endl;
#include <cassert>
//#include "atcoder/all"

using namespace std;
//using namespace atcoder;

typedef long long ll;

#define pb push_back
#define rep(i,n) for(int i=0;i<(n);i++)
#define REP(i,n) for(int i=1;i<=(n);i++)
#define P pair<int,int>

int mx8[] = {0,0,1,-1,-1,1,-1,1};
int my8[] = {-1,1,0,0,-1,-1,1,1};
int mx4[] = {1,-1,0,0};
int my4[] = {0,0,-1,1};

const int MOD = 1000000007;
ll modPow(ll a, ll n, ll p) {
    if (n == 0) return 1; // 0乗にも対応する場合
    if (n == 1) return a % p;
    if (n % 2 == 1) return (a * modPow(a, n - 1, p)) % p;
    long long t = modPow(a, n / 2, p);
    return (t * t) % p;
}

int d[101];

int main() {
    ios::sync_with_stdio(false);

    int n; cin >> n;
    while(n--)
    {
        int a; cin >> a;
        d[a] = 1;
    }
    int ans = 0;
    rep(i,101) ans += d[i];
    cout << ans << endl;
}

Measured memory_bytes: 3660
#include<stdio.h>
int main(){
	char a[10000],b[10000];
	scanf("%s",a);
	scanf("%s",b);
	int lena=0;
	int lenb=0;
	while (a[lena]!=0) lena++;
	while (b[lenb]!=0) lenb++;
	int count=10000000;
	for (int i=0;i<lena-lenb+1;i++){
		int ans=0;
		for (int j=0;j<lenb;j++){
			if (b[j]!=a[i+j])
			  ans++;
		}
		if (ans<count) count=ans;
	}
	printf("%d",count);
}

Measured memory_bytes: 1736
from collections import Counter
from itertools import combinations

counter = Counter()

n = int(input())
for _ in range(n):
    line = input()
    if line[0] in "MARCH":
        counter[line[0]] += 1

ans = 0
for a, b, c in combinations("MARCH", 3):
    c = counter[a] * counter[b] * counter[c]
    ans += c

print(ans)


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

int main(){
	int b,r,g,c,s,t;
	while(true){
		cin >> b >> r >> g >> c >> s >> t;
		if(!b && !r && !g && !c && !s && !t)
			return 0;
		cout << b*5*13 + r*3*13 + b*12 + r*12 + g*4 - c - (t-b-r-g-c-s-b*5-r*3)*3 + 100 << endl;
	}
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
using namespace std;
#define  rep(i, n) for(int i = 0; i < n; i++) 
#define  all(x) (x).begin(),(x).end()     // 昇順ソート
#define  rall(v) (v).rbegin(), (v).rend() // 降順ソート
#define  INF 1000000000
#define  pow(x) pow(10,(x)) 
typedef long long int LL;
//sort(all(x))とするとソートできるよ

int main(){
    int N,A,B ; cin >> N >> A >> B;
    int tmp = N*A;
    if(tmp <= B){
        cout << tmp << endl;
    }
    else{
        cout << B << endl;
    }
}

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

using namespace std;

void Solve(){
	string a, b;
	cin>>a>>b;
	string res = "";
	for(int i = 0; i < b.size() - 1; i++)
		res += b[i];
	if(res == a) cout<<"Yes\n";
	else cout<<"No\n";

}
int main(){
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	int T = 1;
	//cin>>T;
	while(T--){
		Solve();
	}
}

Measured memory_bytes: 3556
#include <bits/stdc++.h>
#include <vector>
#include <iostream>
#include <numeric>
#include <queue>
#include <stack>
#define mod 1000000007
#define rep(i,n) for(ll i = 0; i < (n); i++)
#define srep(i,s,t) for (ll i = s; i < t; i++)
#define drep(i,n) for(ll i = (n)-1; i >= 0; i--)
using namespace std;
typedef long long ll;
typedef vector<vector<char>> field_t;
typedef unsigned long long ull;
typedef pair<ll, ll> point_t;


int main()
{
    ull n;
    cin >> n;
    ull ans=0;
    for(ull i=1;i<=n;i++){
        ull now=n/i;
        ans+=(i*now*(now+1)/2);
    }
    cout << ans<< endl;
    return 0;
}

Measured memory_bytes: 3608
#include<stdio.h>
#define INF -1000000000000000000
#define ll long long

int main() {
  int n, m, f;
  int i, j;
  ll score[1010] = {};
  scanf("%d %d", &n, &m);
  ll a[2010] = {};
  ll b[2010] = {};
  ll c[2010] = {};
  for (i = 1; i < m+1; i++) {
    scanf("%lld %lld %lld", &a[i], &b[i], &c[i]);
  }
  for (i = 2; i < n+1; i++) {
    score[i] = INF;
  }
  for (i = 1; i < n+1; i++) {
    f = 0;
    for (j = 1; j < m+1; j++) {
      int from = a[j];
      int to = b[j];
      if (score[to] < score[from] + c[j]) {
	score[to] = score[from] + c[j];
	if (i >= n) {
	  if (b[j] == n) {
	    f = 1;
	  }
	} else {
	  f = 1;
	}
      }
    }
    if (f == 0) {
      break;
    }
    if (i == n) {
      printf("inf\n");
      return 0;
    }
  } 
  printf("%lld\n", score[n]);
  return 0;
}
  
  
      


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n)for(int i=0;i<(n);i++)
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef tuple<ll,ll,ll> T;
const long long INF = 1LL<<60;
const int MOD = 1000000000+7;
#define rev(s) (string((s).rbegin(), (s).rend()))
template < typename T > inline string toString( const T &a ) { ostringstream oss; oss << a; return oss.str(); };
// cout << fixed << setprecision(10) << ans << endl;
// *min_element(c + l, c + r) *max_element(c + l, c + r)
// int dx[8]={1,1,0,-1,-1,-1,0,1};
// int dy[8]={0,1,1,1,0,-1,-1,-1};
// int dx[4]={1,0,-1,0};
// int dy[4]={0,1,0,-1};
// struct Edge {
//   int to, id;
//   Edge(int to, int id): to(to), id(id) {}
// };

int a[100010],b[100010];
vector<int> ki[100010];
int par_col[100010];
bool seen[100010];

int main () {
    int n;cin>>n;
    int mx=0;
    rep(i,n-1) {
        cin>>a[i]>>b[i];
        a[i]--;b[i]--;
        ki[a[i]].push_back(b[i]);
        ki[b[i]].push_back(a[i]);
        mx=max(mx,(int)ki[a[i]].size());
        mx=max(mx,(int)ki[b[i]].size());
    }
    map<P,int> ma;
    queue<int> qu;
    qu.push(0);
    seen[0]=true;
    par_col[0]=-1;
    while(!qu.empty()){
        int now = qu.front();qu.pop();
        int col = 0;
        for(auto nxt: ki[now]) {
            if(!seen[nxt]) {
                seen[nxt]=true;
                if(col == par_col[now]) col = (col+1)%mx;
                par_col[nxt]=col;
                ma[P(now,nxt)]=col;
                ma[P(nxt,now)]=col;
                col++;
                qu.push(nxt);
            }
        }
    }
    cout<<mx<<endl;
    rep(i,n-1) {
        cout<<ma[P(a[i],b[i])]+1<<endl;
    }
}

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

int main(){
    int w, n;
    cin >> w >> n;
    int a, b;
    char com;
    vector<int> r;
    for (int i = 0; i <= w; i++) r.push_back(i);
    
    for (int i = 0; i < n; i++){
	cin >> a >> com >> b;
	swap(r[a], r[b]);
    }

    for (int i = 1; i <= w; i++)
	cout << r[i] << endl;
}

Measured memory_bytes: 0
def examA():
    N = I()
    ans = ((N+1)//2)/N
    print(ans)
    return

def examB():
    N, K = LI()
    H = [I()for _ in range(N)]
    H.sort()
    ans = inf
    for i in range(N-K+1):
        cur = H[i+K-1]-H[i]
        if ans>cur:
            ans = cur
    print(ans)
    return

def examC():
    N = I()
    A = LI()
    ans = [0]*N
    C = Counter(A)
    base = 0
    for c in C.values():
        base += c*(c-1)//2
    #print(C)
    #print(base)
    for i in range(N):
        ans[i] = base - (C[A[i]]-1)
    for v in ans:
        print(v)
    return

def examD():
    N, K = LI()
    X = LI()
    L = []; R = [0]
    for x in X:
        if x<0:
            L.append(-x)
        else:
            R.append(x)
    L.append(0)
    L = L[::-1]
    ans = inf
    for i in range(len(L)):
        if len(R)<=K-i or K-i<0:
            continue
        cur = min(L[i] * 2 + R[K - i], L[i] + R[K - i] * 2)
        # print(cur)
        if ans > cur:
            ans = cur
    print(ans)
    return

def examE():
    N, M = LI()
    X = [LI()for _ in range(N)]
    ans = 0
    for i1 in [-1,1]:
        for i2 in [-1,1]:
            for i3 in [-1,1]:
                curX = [0]*N
                for i in range(N):
                    curX[i] = X[i][0]*i1+X[i][1]*i2+X[i][2]*i3
                curX.sort(reverse=True)
                cur = sum(curX[:M])
                if ans<cur:
                    ans = cur
    print(ans)
    return

def examF():

    ans = 0
    print(ans)
    return

import sys,bisect,itertools,heapq,math,random
from copy import deepcopy
from heapq import heappop,heappush,heapify
from collections import Counter,defaultdict,deque
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
def I(): return int(readline())
def LI(): return list(map(int,readline().split()))
def LSI(): return list(map(str,sys.stdin.readline().split()))
def LS(): return sys.stdin.readline().split()
def SI(): return sys.stdin.readline().strip()
global mod,mod2,inf,alphabet,_ep
mod = 10**9 + 7
mod2 = 998244353
inf = 10**18
_ep = 10**(-12)
alphabet = [chr(ord('a') + i) for i in range(26)]

sys.setrecursionlimit(10**7)

if __name__ == '__main__':
    examD()

"""
142
12 9 1445 0 1
asd dfg hj o o
aidn
"""

Measured memory_bytes: 13788
import queue
import copy
def main():
    h,w = map(int,input().split())
    maze = []
    maze.append(['#' for i in range(w+2)])
    for i in range(h):
        tmp = input()
        tmp = list('#' + tmp + '#')
        maze.append(tmp)
    maze.append(['#' for i in range(w+2)])
    # print(maze)

    dx_ = [0,1,0,-1]
    dy_ = [1,0,-1,0]
    ans = -1
    q = queue.Queue()
    for i in range(1,h+1):
        for j in range(1,w+1):
            new_maze = copy.deepcopy(maze)
            
            dis = [[-1 for a in range(w+2)]for b in range(h+2)]
            # for a in range(1,h):
            #     for b in range(1,w):
            #         dis[a][b] = -1

            if new_maze[i][j]=='.':
                dis[i][j]=0
                q.put([i,j])
            max_dis = -1
            while(not q.empty()):
                [x,y] = q.get()
                new_maze[x][y]='#'
                # print(x,y)
                if max_dis < dis[x][y]:
                    max_dis = dis[x][y]

                for dx,dy in zip(dx_,dy_):
                    # print(x+dx,y+dy)
                    if dis[x+dx][y+dy] == -1 and new_maze[x+dx][y+dy] != '#':
                        # new_maze[x+dx][y+dy] = '#'
                        dis[x+dx][y+dy] = dis[x][y]+1
                        q.put([x+dx,y+dy])
                        # print("put",x+dx,y+dy)

                        # for i in range(len(maze)):
                        #     print(maze[i])
                        # print()
            # print("max is",max_dis)
            if ans < max_dis:
                ans = max_dis

            
    print(ans)
    return 0


if __name__ == "__main__":
    main()

Measured memory_bytes: 4080
use proconio::input;
use std::collections::BTreeSet;
use std::ops::Bound::Excluded;
use std::ops::Bound::Unbounded;

const C:usize = 26;
fn main() {
    input!{
        d:usize,
        c:[i32;C],
        s:[[i32;C];d],
        t:[usize;d],
        m:usize,
        dq:[(usize,usize);m]
    };
    let mut t:Vec<usize> = t.into_iter().map(|x|x-1).collect();
    let dq:Vec<(usize,usize)> = dq.into_iter().map(|(d,q)|(d-1,q-1)).collect();

    let mut occs = vec![BTreeSet::<i32>::new();C];
    for occ in &mut occs {
        occ.insert(-1);
    }
    let mut ans = 0;
    for (day,&ti) in t.iter().enumerate() {
        ans += s[day][ti];
        occs[ti].insert(day as i32);
        for j in 0..26 {
            let sc = (c[j] as i32) * ((day as i32) -*occs[j].iter().last().unwrap());
            ans -= sc;
        }
    }
    for occ in &mut occs {
        occ.insert(d as i32);
    }    

    let sum_lr = |l,r,n| n*(l+r)/2;

    for (d,q) in dq {
        let pre_q = t[d];
        ans-=s[d][pre_q];
        ans+=s[d][q];
        t[d]=q;
        let d = d as i32;
        // for pre_q
        let mut calc = |q:usize,is_ins:bool| {
            if is_ins {
                occs[q].insert(d);
            }
            else {
                occs[q].remove(&d);
            }
            let pre_d = *occs[q].range((Unbounded,Excluded(&d))).last().unwrap();
            let nex_d = *occs[q].range((Excluded(&d),Unbounded)).next().unwrap();
            let lbig = d - pre_d;
            let rbig = nex_d - pre_d -1;
            let lsml = 0;
            let rsml = nex_d-d-1;
            let sc = sum_lr(lbig,rbig,nex_d-d)-sum_lr(lsml,rsml,nex_d-d);
            sc
        };
        
        ans -= calc(pre_q,false)*c[pre_q];
        ans += calc(q,true)*c[q];
        println!("{}",ans);

    }
}


Measured memory_bytes: 5656
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define all(v) v.begin(), v.end()
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define Rep(n) for (ll _ = 0; _ < (ll)(n); _++)

template<class S>S sum(vector<S>&a){return accumulate(all(a),S());}
template<class S>S max(vector<S>&a){return *max_element(all(a));}
template<class S>S min(vector<S>&a){return *min_element(all(a));}
ll max(int a,ll b){return max((ll)a,b);} ll max(ll a,int b){return max(a,(ll)b);}
ll min(int a,ll b){return min((ll)a,b);} ll min(ll a,int b){return min(a,(ll)b);}
template <class S> void print(vector<S> &v){for(ll i=0; i<(ll)v.size(); i++){cerr << v[i] << ' ';}cerr << endl;}
template <class S> void print(vector<vector<S>> &v) {for (ll i = 0; i < (ll)v.size(); i++) {for (ll j = 0; j < (ll)v[i].size(); j++) {cerr << v[i][j] << ' ';}cerr << endl;}}

void Main();

int main(){
	cin.tie(nullptr);
	ios_base::sync_with_stdio(false);
	cout << fixed << setprecision(20);
	Main();
	return 0;
}

int h,w;
int cx, cy, dx, dy;
int offset[4][2] = {{-1,0}, {1,0}, {0,-1}, {0,1}};
vector<vector<bool>> s(1000, vector<bool>(1000, false));
vector<vector<bool>> visited(1000, vector<bool>(1000, false));

void Main(){
	cin >> h >> w;
	cin >> cx >> cy;
	cin >> dx >> dy;
	cx--; cy--; dx--; dy--;
	rep(i,h){
		string a; cin >> a;
		rep(j, w){
			s[i][j] = (a[j] == '#');
		}
	}
	queue<pair<int,int>> que;
	queue<pair<int,int>> nex;
	que.push(make_pair(cx, cy));
	int magic = 0;
	do{
		while(!nex.empty()){
			auto p = nex.front();
			nex.pop();
			que.push(p);
		}
		while(!que.empty()){
			auto [x,y] = que.front();
			que.pop();
			if(visited[x][y]) continue;
			if(x == dx && y == dy){
				cout << magic << endl;
				return;
			}
			visited[x][y] = true;
			for(auto dxy: offset){
				int dx = dxy[0];
				int dy = dxy[1];
				int x2 = x + dx;
				int y2 = y + dy;
				if(0 <= x2 && x2 < h && 0 <= y2 && y2 < w){
					if(s[x2][y2] == false && visited[x2][y2] == false){
						que.push(make_pair(x2,y2));
					}
				}
			}
			for(int x2 = x-2; x2 < x+3; x2++){
				for(int y2 = y-2; y2 < y+3; y2++){
					if(0 <= x2 && x2 < h && 0 <= y2 && y2 < w){
						if(s[x2][y2] == false && visited[x2][y2] == false){
							nex.push(make_pair(x2,y2));
						}
					}
				}
			}
		}
		magic++;
	}while(!nex.empty());
	cout << -1 << endl;
}


Measured memory_bytes: 4568
#include<bits/stdc++.h>
using namespace std;
 
int main()
{
string s1,s2;
cin>>s1>>s2;
int correct=0;
for(int i=0;i<s1.length();i++)
	if(s1[i]==s2[i])
		correct++;
cout<<correct;

return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define div1 1000000007
const long long INF = 1LL << 60;
using namespace std;
typedef long long ll;
typedef long double ld;
// a>b -> a==b;
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
// a<b -> a==b;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }

int main(void)
{
    ll N, M, i, A[100001], sum=0;

    cin >> N >> M;

    for(i=1; i<=M; i++){
        cin >> A[i];
        sum += A[i];
    }

    if(sum<=N) cout << N-sum << endl;
    else cout << -1 << endl;

    return 0;
}

Measured memory_bytes: 3636
#include <iostream>
#include <cmath>
#include <stdio.h>
#include <float.h>
#include <stdio.h>
using namespace std;

int main(){
  double x1,x2,y1,y2,px,py;
  char ch;
  while( cin>>x1>>ch>>y1>>ch>>x2>>ch>>y2>>ch>>px>>ch>>py ){
    if(x1 == x2){
      printf("%.6f %.6f\n",2*x1-px,py);
      continue;
    }
    if(y1 == y2){
      printf("%.6f %.6f\n",px,2*y1-py);
      continue;
    }

    double a = (y1-y2)/(x1-x2);
    double b = -a*x1+y1;
    double c = -1/a;
    double d = -c*px + py;
    double qx = (d-b)/(a-c);
    double qy = a*qx + b;
    double ax = 2*qx - px;
    double ay = 2*qy - py;
    printf("%.6f %.6f\n",ax,ay);
  }
  return 0;
}

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

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

  if(a[0]){
    cout << -1;
    return 0;
  }

  ll ans = 0;
  for(int i = 1; i < N; i++){
    if(a[i] - a[i - 1] > 1){
      cout << -1;
      return 0;
    }
    if(a[i] == a[i - 1] + 1) ans++;
    else ans += a[i];
  }
  cout << ans << endl;

}


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

int main()
{
  int m1, d1, m2, d2 ;
  cin >> m1 >> d1 >> m2 >> d2 ;

  if( ((d1 == 30 || d1 == 31 || d1 == 28) && d2 == 1) && m1 != m2)
  {
    cout << 1 << endl ;
  }
  else
  {
    cout << 0 << endl ;
  }
  
}


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


def solve(N: int, K: int, X: "List[int]"):
    ans = 0
    for x in X:
        robo_a = abs(0 - x) * 2
        robo_b = abs(K - x) * 2
        ans += min(robo_a, robo_b)
    print(ans)
    return


# Generated by 1.1.7.1 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word

    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    K = int(next(tokens))  # type: int
    x = [int(next(tokens)) for _ in range(N)]  # type: "List[int]"
    solve(N, K, x)


if __name__ == "__main__":
    main()


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

#define CPP_STR(x) CPP_STR_I(x)
#define CPP_CAT(x,y) CPP_CAT_I(x,y)
#define CPP_STR_I(args...) #args
#define CPP_CAT_I(x,y) x ## y

#define ASSERT(expr...) assert((expr))

using i8  = int8_t;
using u8  = uint8_t;
using i16 = int16_t;
using u16 = uint16_t;
using i32 = int32_t;
using u32 = uint32_t;
using i64 = int64_t;
using u64 = uint64_t;

using f32 = float;
using f64 = double;
using ll = long long;

constexpr i64 INF = 1010000000000000017LL;

constexpr i64 MOD = 1000000007LL;

constexpr f64 EPS = 1e-12;

constexpr f64 PI = 3.14159265358979323846;

#define FOR(i, start, end) for(i64 i = (start), CPP_CAT(i,xxxx_end)=(end); i < CPP_CAT(i,xxxx_end); ++i)
#define REP(i, n) FOR(i, 0, n)

#define ALL(f,c,...) (([&](decltype((c)) cccc) { return (f)(std::begin(cccc), std::end(cccc), ## __VA_ARGS__); })(c))

template<typename C>
i64 SIZE(const C& c) { return static_cast<i64>(c.size()); }

template<typename T, size_t N>
i64 SIZE(const T (&)[N]) { return static_cast<i64>(N); }

template<typename T, typename U, typename Comp=less<>>
bool chmax(T& xmax, const U& x, Comp comp={}) {
    if(comp(xmax, x)) {
        xmax = x;
        return true;
    }
    return false;
}

template<typename T, typename U, typename Comp=less<>>
bool chmin(T& xmin, const U& x, Comp comp={}) {
    if(comp(x, xmin)) {
        xmin = x;
        return true;
    }
    return false;
}

struct ProconInit {
    static constexpr int IOS_PREC = 15;
    static constexpr bool AUTOFLUSH = false;

    ProconInit() {
        cin.tie(nullptr);
        ios::sync_with_stdio(false);
        cout << fixed << setprecision(IOS_PREC);
        if(AUTOFLUSH)
            cout << unitbuf;
    }
} PROCON_INIT;

ll mod_pow(ll x, ll n) {
    if (n == 0) return 1;
    if (n % 2 == 0) {
        return mod_pow(x * x % MOD, n / 2) % MOD;
    } else {
        return x * mod_pow(x, (n - 1)) % MOD;
    }
}

ll mod_pow_r(ll x, ll n) {
    if (x == 0) return 0;
    if (n == 0) return 1;

    ll ret = 1;
    while (n) {
        if (n & 1) ret = ret * x % MOD;
        x = x * x % MOD;
        n /= 2;
    }
    return ret;
}

ll factorial(ll n) {
    ll ret = 1;
    REP(i, n) {
        ret *= (i + 1);
        ret %= MOD;
    }
    return ret;
}

ll combination(ll n, ll r) {
    if (n < 0 || n < r || r < 0) return 0;
    ll fn = factorial(n);
    ll fr = factorial(r);
    ll fn_r = factorial(n-r);

    ll d = (mod_pow(fr, MOD - 2) * mod_pow(fn_r, MOD - 2)) % MOD;
    ll u = fn % MOD;
    return u * d % MOD;
}

void solve() {
    string s; cin >> s;
    if (s[2] == s[3] && s[4] == s[5]) cout << "Yes";
    else cout << "No";
}

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

Measured memory_bytes: 256
N, T = map(int, input().split())
A = [int(i) for i in input().split()]

m = [(A[0], 1)]

mv, mn = A[0], 1
for a in A[1:] :
    if a < mv :
        m.append((a, 1))
        mv, mn = a, 1
    elif a == mv :
        m.append((mv, mn + 1))
        mn += 1
    else :
        m.append((mv, mn))

Md, Mn = 0, 0
for i in range(N - 1, 0, -1) :
    d = A[i] - m[i-1][0]
    if d > Md :
        Md, Mn = d, 1
    elif d == Md :
        Mn += m[i-1][1]
        
print(Mn)

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

    using namespace std;
    using ll = long long int;
    constexpr ll M = 1e9 + 7;
    inline ll sum_1(const ll n) { return ((n * (n + 1)) / 2) % M; }
    inline ll sum_2(const ll n) { return ((n * (n + 1) * (2 * n + 1)) / 6) % M; }
    inline ll sum_3(const ll n) { return (((n * (n + 1)) / 2) % M * ((n * (n + 1)) / 2) % M) % M; }
    inline ll sum_1(const ll i, const ll j) { return (sum_1(j) - sum_1(i - 1) + M) % M; }
    inline ll sum_2(const ll i, const ll j) { return (sum_2(j) - sum_2(i - 1) + M) % M; }
    inline ll sum_3(const ll i, const ll j) { return (sum_3(j) - sum_3(i - 1) + M) % M; }

    ll pow_f(ll b, ll e) {
        ll ans = 1;
        while (e) {
            if (e&1) {
                ans = (ans * b);
            }
            b = (b * b);
            e >>= 1;
        }
        return ans;
    }

    ll nCr(ll n, ll r) {
        if (r > n || n < 0 || r < 0) { return 0; }
        if (n == r || r == 0) { return 1; }
        r = min(r, n-r);
        ll ans = 1;
        for (ll i = 1; i <= r; ++i) {
            ans = (ans * (n-i+1))/(i); 
        }
        return ans;
    }

    ll nCr(tuple<ll,ll> t) {
        auto n = get<0>(t);
        auto k = get<1>(t);
        return nCr(n+k-1, k);
    }

    void solve() {
        ll x;
        cin >> x;

        ll limit = 1005;
        for (ll i = -limit; i <= limit; ++i) {
            for (ll j = -limit; j <= limit; ++j) {
                if ((pow_f(i, 5) - pow_f(j, 5)) == x) {
                    cout << i << " " << j << endl;
                    return;
                }
            }
        }

    }

    int main() {
        ios_base::sync_with_stdio(false);
        cin.tie(0);
        cout.tie(0);
        #ifdef D_LOCAL
            freopen("in.in", "r", stdin);
            freopen("out.out", "w", stdout);
        #endif

        solve();

        return 0;
    }

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

using namespace std;

int main(){
    int N, K;
    string S;
    cin >> N >> K >> S;

    bool ok = true;
    for (int i = 0; i < N+K+1;i++){
        if(i==N&&S[i]!='-'){
            ok = false;
        }else if(S[i]=='-'&&i!=N){
            ok = false;
        }
    }
    if(ok){
        cout << "Yes";
    }else{
        cout << "No";
    }
}

Measured memory_bytes: 384
fun main(args: Array<String>) {
    val n = readInteger()
    (1..n step 2).filter {
        (1..it).filter { n -> it % n == 0 }.count() == 8
    }.count().let(::println)
}

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


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

int main(){
    int n;
    while(cin >> n,n){
      int w,h;
      cin >> w >> h;
      vector<vector<int> > mat(300,vector<int>(300,0));
      for(int i=0;i<n;i++){
        int x,y;
        cin >> x >> y;
        mat[y-1][x-1]=1;
      }
      int s,t;
      cin >> s >> t;
      int cou=0,ma=0;
      for(int i=0;i<h;i++){
          for(int j=0;j<w;j++){
              for(int k=0;k<t&&k+i<h;k++){
                  for(int l=0;l<s&&l+j<w;l++){
                      cou+=mat[k+i][l+j];
                  }
              }
              ma=max(ma,cou);
              cou=0;
          }
      }
      cout << ma << endl;
    }
}

Measured memory_bytes: 3240
import java.util.Map;
import java.util.Map.Entry;
import java.util.Scanner;
import java.util.TreeMap;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        Map<Integer,Integer> map = new TreeMap<>();
        for(int i = 1; i <= n; i++) {
            map.put(sc.nextInt(), i);
        }
        for(Entry<Integer, Integer> entry : map.entrySet()) {
            System.out.print(entry.getValue() + " ");
        }
    }
}

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

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

  string ans="EQUAL";
  if(a.length() < b.length()) ans = "LESS";
  else if(b.length() > b.length()) ans = "GREATER";
  else {
    for(int i=0; i<a.length(); i++){
      if(a[i]<b[i]){
        ans="LESS";
        break;
      }
      if(a[i]>b[i]){
        ans="GREATER";
        break;
      }
    }
  }

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


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

using namespace std;

vector<vector<int> > G;

vector<bool> used;

int rec(int pos)
{
    used[pos] = true; int ret = 1;
    
    for(int i = 0; i < G[pos].size(); i++)
    {
        if(!used[G[pos][i]])
        {
            ret = max(ret, rec(G[pos][i]) + 1);
        }
    }
    
    used[pos] = false;
    
    return ret;
}

int main()
{
    int N, A, B;
    
    while(true)
    {
        scanf("%d", &N);
        
        if(N == 0) { break; }

        G = vector<vector<int> >(100, vector<int>());
        
        used = vector<bool>(100);
    
        for(int i = 0; i < N; i++)
        {
            scanf("%d", &A); A--;
            scanf("%d", &B); B--;
        
            G[A].push_back(B);
            G[B].push_back(A);
        }
        
        int nodes = 0;
        
        for(int i = 0; i < 100; i++)
        {
            if(G[i].size())
            {
                nodes++;
            }
        }
    
        int ret = 0;
    
        for(int i = 0; i < 100; i++)
        {
            if(G[i].size())
            {
                ret = max(ret, rec(i));
                
                if(ret == nodes) { break; }
            }
        }
        
        printf("%d\n", ret);
    }
    
    return 0;
}

Measured memory_bytes: 3148
#include <bits/stdc++.h>
#define rep(i,n) for (int i=0; i<(n); ++i)
#define all(a) a.begin(), a.end()
using namespace std;
using ll = long long;
using vi = vector<int>;
using vv = vector<vi>;
using P  = pair<int,int>;
const int INF = 1001001001;
const int MOD = 1000000007;
const int NMAX = 2000;



int main(){
    int n;
    cin >> n;
    
    set<ll> plus, minus;
    
    rep(i,n){
        ll x, y;
        cin >> x >> y;
        plus.insert(x+y);
        minus.insert(x-y);
    }
    
    ll ans = *plus.rbegin() - *plus.begin();
    ans = max(ans, *minus.rbegin() - *minus.begin());
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 22360
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <algorithm>
#include <fstream>
#include <string>
#include <math.h>
#include <cstdlib>
#include <istream>
#include <sstream>
#include <cctype>
#define fore(i,x,y) for(long long i=x;i<y;i++)
typedef long long ll;
using namespace std;
int main()
{
	int N,ANS=0;
	vector<int>V;
	cin >> N;
	for(int i=0;i<N;i++){
		int t;
		cin >> t;
		V.push_back(t);
	}
	int i=0,count=0;
	while(ANS==0){
		count++;
		if(V[i]==2){
			ANS=count;
		}
		if(count==N){
			ANS=-1;
		}
		i=V[i]-1;
	}
	cout << ANS << endl;
}

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

#define pb push_back
#define mp make_pair
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef complex<double> point;
typedef double DOUBLE;
#define xx real()
#define yy imag()

#define REP(i, a, b) for(int i = (a); i < (int)(b); i++)
#define REPN(i, a, b) for(int i = (a); i <= (int)(b); i++)
#define FA(it, x) for(__typeof((x).begin()) it = (x).begin(); it != (x).end(); it++)
#define SZ(x) (int)(x).size()
#define BE(x) (x).begin(), (x).end()
#define SORT(x) sort(BE(x))
#define _1 first
#define _2 second

#define x1 gray_cat_x1
#define y1 gray_cat_y1

template<class T> T gcd(T a, T b) { return b ? gcd(b, a % b) : a; }

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

#define file "I1"

const double EPS = 1e-9;
const double PI = acos(-1.);
const ll LL_INF = 1e17 + 10;
const int INF = 1e9 + 10;
const ll MOD = 1e9 + 7;

const int MAXN = 2e5 + 5;

pii pp[MAXN];

void solve(){
	int n;
	scanf("%d", &n);
	REP(i, 0, n) {
		int x, l;
		scanf("%d%d", &x, &l);
		pp[i] = mp(x + l, x - l);
	}
	sort(pp, pp + n);
	int last = -INF;
	int ans = 0;
	REP(i, 0, n) {
		if (pp[i]._2 >= last) {
			ans++;
			last = pp[i]._1;
		}
	}
	cout << ans << endl;
}

int main(){

    //freopen(file".in", "r", stdin); freopen(file".out", "w", stdout);
    int t = 1;
    //cin >> t;
    while(t--){
        solve();    
    }
}


Measured memory_bytes: 1024
from itertools import accumulate

def mi():
    return map(int, input().split())

def main():
    S = input()
    N = len(S)
    l = []
    r = []
    ans = [0]*N
    for i in range(N-1):
        if S[i:i+2] == 'LR':
            l.append(i)
        if S[i:i+2] == 'RL':
            r.append(i)

    l = [-1]+l+[N-1]

    for i in range(len(l)-1):
        for j in range(l[i]+1, l[i+1]+1):
            ans[r[i]+(j-r[i])%2] += 1

    print(' '.join(list(map(str, ans))))

if __name__ == '__main__':
    main()

Measured memory_bytes: 49976
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		int n = s.length();
		if(n==2) {
			System.out.println(s);
		}else if(n==3) {
			StringBuffer str = new StringBuffer(s);
	         String hoge2 = str.reverse().toString();
			System.out.println(hoge2);
		}
		  }
		}

Measured memory_bytes: 35648
#include <cstdio>
#include <algorithm>

long long dp[2][100001];
int main()
{
  int n, W;
  scanf("%d%d", &n, &W);
  int w[100];
  long long v[100];
  for (int i = 0; i < n; ++i)
  {
    scanf("%d%lld", w + i, v + i);
  }
  for (int i = 0; i < n; ++i)
  {
    for (int j = 0; j <= W; ++j)
    {
      if (j - w[i] >= 0)
      {
        dp[(i + 1) & 1][j] = std::max(dp[i & 1][j], dp[i & 1][j - w[i]] + v[i]);
      }
      else
      {
        dp[(i + 1) & 1][j] = dp[i & 1][j];
      }
    }
  }
  printf("%lld\n", dp[n & 1][W]);
  return 0;
}

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

bool check(string const& s, int& p) {
    //cout << "p: " << p << endl;
    if(s.size() >= p+3 && s.substr(p, 3) == "mew") {
        p += 3;
        return true;
    }

    if(s[p] != 'm') {
        return false;
    }
    p++;
    if(s[p] != 'e') {
        if(!check(s, p)) {
            return false;
        }
        if(s[p] != 'e') {
            return false;
        }
        p++;
        if(s[p] != 'w' && !check(s, p)) {
            return false;
        }
        if(s[p] != 'w') {
            return false;
        }
        p++;
        return true;
    } else {
        p++;
        if(s[p] != 'w' && !check(s, p)) {
            return false;
        }
        if(s[p] != 'w') {
            return false;
        }
        p++;
        return true;
    }
}

int main() {
    string S;
    cin >> S;
    int pos = 0;
    if(check(S, pos) && (pos == S.size() || pos == S.size()-1)) {
        cout << "Cat" << endl;
    } else {
        cout << "Rabbit" << endl;
    }
}


Measured memory_bytes: 3164
#include <iostream>
#include <string>
#include <math.h>
#include <iomanip>
#include <stdio.h>
#include <algorithm>
#include <ctime>
#include <vector>
#include <set>
#include <queue>
using namespace std;
typedef long long ll;

#define PI 3.14159265358979323846264338327950L

string res;

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

    int N,K;
    cin >> N >> K;
    vector<int> A(N);
    for (int i = 0; i < N; i++)
    {
        cin >> A[i];
    }
    for(int i = 0; i < N-K; i++ )
    {
        if(A[i]<A[i+K]){
            cout << "Yes" << endl;
        }else{
            cout << "No" << endl;
        }
    }
    return 0;
}

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

int main(){
	int n,a,b,c,d;
	
	while(cin >> n){
		int p=0;
		for(a=0;a<10;a++){
			for(b=0;b<10;b++){
				for(c=0;c<10;c++){
					for(d=0;d<10;d++){
						if(n==(a+b+c+d)){
							p = p+1;
						}
					}
				}
			}
		}
		cout << p <<endl;
	}		
	
	return 0;
}

Measured memory_bytes: 1160
#include <stdio.h>

int main(){

    char a[10],b[10],c[10];
    int A=0,B=0,C=0;
    scanf("%s %s %s",a,b,c);

    while(a[A]){A++;}
    while(b[B]){B++;}
    while(c[C]){C++;}

    if(a[A-1]==b[0]&&b[B-1]==c[0]){
        printf("YES\n");
    } else {
        printf("NO\n");
    }


    return 0;
}

Measured memory_bytes: 128
using System;
using System.Collections.Generic;
using System.Windows;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Atcoder
{
    public class Program
    {
        static void Main(string[] args)
        {
            var r = ReadSplit();
            var n = r[0].Int();
            var m = r[1].Int();
            var mod = 1000000007;
            var d = new int[n + 1];
            for (int i = 0; i < m; i++)
            {
                var r2 = Read().Int();
                d[r2] = 1;
                if (r2 - 1 > 0 && d[r2 - 1] == 1 && d[r2] == 1)
                {
                    WriteRead(0);
                    return;
                }
            }
            var dp = new int[n + 2];
            dp[0] = 1;
            dp[1] = 1;
            for (int i = 0; i <= n; i++)
            {
                if (d[i] == 1)
                {
                    dp[i] = 0;
                    continue;
                }
                if (i - 2 >= 0)
                {
                    dp[i] = (dp[i - 1] + dp[i - 2]) % mod;
                }
            }
            WriteRead(dp[n]);
        }

        public static string Read()
        {
            return Console.ReadLine();
        }

        public static string[] ReadSplit()
        {
            return Console.ReadLine().Split(' ');
        }

        public static void WriteRead(object str)
        {
            Console.WriteLine(str);
            Read();
        }

        public static void Write(object str)
        {
            Console.WriteLine(str);
        }

        private static bool ChangeMin<T>(ref T a, T b) where T : IComparable
        {
            if (a.CompareTo(b) > 0)
            {
                a = b;
                return true;
            }
            return false;
        }

        private static bool ChangekMax<T>(ref T a, T b) where T : IComparable
        {
            if (b.CompareTo(a) > 0)
            {
                a = b;
                return true;
            }
            return false;
        }
    }
}


public static class Extentions
{
    public static int Int(this object obj)
    {
        return int.Parse(obj.ToString());
    }

    public static long Long(this object obj)
    {
        return long.Parse(obj.ToString());
    }

    public static decimal Decimal(this object obj)
    {
        return decimal.Parse(obj.ToString());
    }

    public static double Double(this object obj)
    {
        return double.Parse(obj.ToString());
    }

    public static T2 GetValueZero<T1, T2>(this Dictionary<T1, T2> d, T1 key) where T2 : struct
    {
        T2 value;
        if (d.TryGetValue(key, out value))
        {
            return value;
        }
        return new T2();
    }
}



Measured memory_bytes: 11616
/*************************************************\
           In the name of almighty ALLAH
                 MD.Faysal Hasan
                Comilla Univesity
\*************************************************/

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

#define     ikarus_101  ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);

typedef     long long             ll;
typedef     long double           ld;
typedef     unsigned long long    ull;
typedef     vector<int>           vci;
typedef     vector<ll>            vcl;
typedef     pair<int,int>         pii;
typedef     pair<ll,ll>           pll;
typedef     vector<pll>           vpl;
typedef     vector<pii>           vpi;
typedef     map<ll,ll>            mll;
typedef     map<int,int>          mii;
typedef     multiset<int>         msi;
typedef     multiset<ll>          msl;
using pql=priority_queue<ll,vcl,less<ll>>;
using pqg=priority_queue<ll,vcl,greater<ll>>;

#define    sci(x)         scanf("%d",&x)
#define    scii(x,y)      scanf("%d%d",&x,&y)
#define    sciii(x,y,z)   scanf("%d%d%d",&x,&y,&z)
#define    scl(x)         scanf("%lld",&x)
#define    scll(x,y)      scanf("%lld%lld",&x,&y)
#define    sclll(x,y,z)   scanf("%lld%lld%lld",&x,&y,&z)
#define    sclu(x)        scanf("%llu",&x)
#define    scc(x)         scanf("%c",&x)
#define    scs(x)         scanf("%s",&x)
#define    pfi(x)         printf("%d\n",x)
#define    pfii(x,y)      printf("%d %d\n",x,y)
#define    pfl(x)         printf("%lld\n",x)
#define    pfll(x,y)      printf("%lld %lld\n",x,y)
#define    pflu(x)        printf("%llu\n",x)
#define    pfs(s)         printf("%s",s.c_str())
#define    nel            printf("\n")
#define    nn             '\n'///endl

#define    all(str)       str.begin(),str.end()
#define    sajo(str)      sort(str.begin(),str.end())
#define    rev(str)       reverse(str.begin(),str.end())
#define    usajo(str)     sort(str.rbegin(),str.rend())
#define    vin(a)         for(auto &it : a) cin>>it
#define    vout(a)        for(auto it:a) cout<<it<<' ';cout<<nn
#define    pb             push_back
#define    eb             emplace_back
#define    mkp(x,y)       make_pair(x,y)
#define    F              first
#define    S              second
#define    yes            cout<<"YES"<<"\n"
#define    no             cout<<"NO"<<"\n"

#define    rep(i,n)       for (i=0;i<n;++i )
#define    rep1(i,n)      for (i=1;i<=n;++i )

#define    min3(a,b,c)    min(a,min(b,c))
#define    max3(a,b,c)    max(a,max(b,c))
#define    sqr(x)         ((x)*(x))
#define    pi             2*acos(0.0)
#define    gcd(a,b)       __gcd(a,b)
#define    lcm(a,b)       (a/gcd(a,b))*b
#define    mem(a,b)       memset(a,b,sizeof (a))
#define    dec(x)         cout<<fixed<<setprecision(x)
#define    no1(n)         __builtin_popcountll(n)
#define    strl(a)        atoi(a.c_str())
string lstr(ll n){stringstream ss;ss<<n;return ss.str();}

const   int  N2  =   1e6+7;
const   int  N   =   2e5+7;
const   int  M   =   1e9+7;
const   ll  inf  =   0x7f7f7f7f7f7f7f7f;

int main() {ikarus_101

      ll n,m,i,j,k,x;

      cin >> n;
      cout<<n*(1+n*(1+n))<<nn;








      return 0;
}


Measured memory_bytes: 3612
N, M = map(int, input().split())
ListH = list(map(int, input().split()))
ListAB = [list(map(int, input().split())) for i in range(M)]

Cnt=[0]*N

for i in range(M):
  if ListH[ListAB[i][0]-1]==ListH[ListAB[i][1]-1]:
    Cnt[ListAB[i][0]-1] = 1
    Cnt[ListAB[i][1]-1] = 1  
  else :
    if ListH[ListAB[i][0]-1] > ListH[ListAB[i][1]-1]:
      Cnt[ListAB[i][1]-1]=1
    if ListH[ListAB[i][0]-1] < ListH[ListAB[i][1]-1]:
      Cnt[ListAB[i][0]-1]=1

print(Cnt.count(0))  

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

const int INF = 1e9;
const int MOD = 1e9 + 7;

using namespace std;

typedef long long ll;

#define REP(i, n) for (int i = 0; i < int(n); i++)
#define REPD(i, n) for (int i = n - 1; i >= 0; i--)
#define FOR(i, a, b) for (int i = a; i < int(b); i++)
#define FORD(i, a, b) for (int i = b - 1; i >= int(a); i--)
#define WRAP(y, x, h, w) (0 <= y && y < h && 0 <= x && x < w)

#define ALL(x) (x).begin(), (x).end()

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

int main()
{
    int n, m;
    cin >> n >> m;
    if (n % 2 == 1) {
        REP(i, m)
        {
            cout << i + 1 << " " << n - 1 - i << endl;
        }
    } else {
        REP(i, m)
        {
            if (i > (n-4)/4)
                cout << n / 2 - i << " " << n / 2 + 2 + i << endl;
            else
                cout << n / 2 - i << " " << n / 2 + 1 + i << endl;
        }
    }
}

Measured memory_bytes: 3644
import sys
N = input()
weather = {'Sunny':0, 'Cloudy':1, 'Rainy':2}
weather_list = ['Sunny', 'Cloudy', 'Rainy']
next_day = (weather[N]+1)%3
#A = [int(x) for x in input().split()]
print(weather_list[next_day])

Measured memory_bytes: 3060
import java.util.Scanner;

public class Main {
	private static int count = 0;

	/**
	 * バブルソートをするプログラム
	 * 
	 * @param args
	 */
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int num = scan.nextInt();
		int[] value = new int[num];
		for (int i = 0; i < num; i++) {
			value[i] = scan.nextInt();
		}

		int[] sort = bubbleSort(value, num);
		for (int j = 0; j < num; j++) {
			if (j == num - 1) {
				System.out.print(sort[j]);
			} else {
				System.out.print(sort[j] + " ");
			}
		}
		System.out.println("");
		System.out.println(count); // ソート回数

		scan.close();
	}

	/**
	 * バブルソート
	 * 
	 * @param A
	 *            ソートする配列
	 * @param N
	 *            ソートする個数
	 * @return 昇順にソートされた配列
	 */
	public static int[] bubbleSort(int[] A, int N) {
		boolean flag = true;
		while (flag) {
			flag = false;
			for (int j = N - 1; j >= 1; j--) {
				if (A[j] < A[j - 1]) {
					int tmp;
					tmp = A[j];
					A[j] = A[j - 1];
					A[j - 1] = tmp;
					flag = true;
					counter();
				}
			}
		}
		return A;
	}

	public static void counter() {

		count++;
	}
}



Measured memory_bytes: 26392
#include <bits/stdc++.h>
#define pb push_back
#define ll long long
#define in insert
#define sz(x) ((in)(x).size())
using namespace std;
const int N = 1e5 + 123;


void read_file()
{
    freopen("text.in","r",stdin);
    freopen("text.out","w",stdout);
}

void solve()
{
    ll n;
    cin >> n;
    if (n == 1){
        cout << 1 << endl;
    }else
        cout << pow(n,3) << endl;
}

int main()
{
    solve();
    //cerr << printf("Time %.2f\n", (double) clock() / CLOCKS_PER_SEC);
    return (0);
}




Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long
#define mp make_pair
#define pb push_back
#define pii pair<ll,ll>
#define vi vector<ll>
#define mod 1000000007
using namespace std;
const int N=234567;

ll A[N],sm[N];

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

    ll n;
    cin>>n;;

    for(ll i=0;i<n;i++)
    cin>>A[i];

    sm[0]=A[0];

    for(ll i=1;i<n;i++)
    {
        sm[i]=A[i]+sm[i-1];
    }
    ll mn=INT_MAX;
    ll sum=sm[n-1];
    for(ll i=0;i<n-1;i++)
    {
      ll diff = sum-sm[i];
      mn = min(mn , abs(diff-sm[i]));

    }
    cout<<mn;

return 0;
}


Measured memory_bytes: 3328
#include <stdio.h>
int main(){
  int a[5],i;
  for(i=0;i<5;i++){
  scanf("%d",&a[i]);
  }
  for(i=0;i<5;i++){
    if(a[i]==0){
      printf("%d",i+1);
      }
    }
  return 0;
  }


Measured memory_bytes: 1736
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)

n, x = map(int, input().split())
point = list(map(int, input().split()))
diff = [0] * n
for i in range(n):
    diff[i] = abs(point[i] - x)

def gcd(big, small):
    if small == 0:
        return big
    else:
        return gcd(small, big % small)

import functools

print(functools.reduce(gcd, diff))


Measured memory_bytes: 85580