akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;

int main(){
    unsigned long A,B;
    cin >> A >> B;

    // 2つの数のうち大きい方をAA、小さい方をBBとする
    unsigned long AA = max(A,B);
    unsigned long BB = min(A,B);

    // 大きい方の数字を確保しておく
    unsigned long C = AA;

    for(int i=1; i<=100000; i++){
        if(AA%BB == 0){
            cout << AA << endl;
            break;
        }else AA = (i+1) * C;
    }
}

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

#define INF 1001001001
#define MAX 1e18

struct Sieve {
  int n;
  vector<int> f, primes;
  Sieve(int n=1):n(n), f(n+1) {
    f[0] = f[1] = -1;
    for (ll i = 2; i <= n; ++i) {
      if (f[i]) continue;
      primes.push_back(i);
      f[i] = i;
      for (ll j = i*i; j <= n; j += i) {
        if (!f[j]) f[j] = i;
      }
    }
  }
  bool isPrime(int x) { return f[x] == x;}
  vector<int> factorList(int x) {
    vector<int> res;
    while (x != 1) {
      res.push_back(f[x]);
      x /= f[x];
    }
    return res;
  }
  vector<P> factor(int x) {
    vector<int> fl = factorList(x);
    if (fl.size() == 0) return {};
    vector<P> res(1, P(fl[0], 0));
    for (int p : fl) {
      if (res.back().first == p) {
        res.back().second++;
      } else {
        res.emplace_back(p, 1);
      }
    }
    return res;
  }
  vector<pair<ll,int>> factor(ll x) {
    vector<pair<ll,int>> res;
    for (int p : primes) {
      int y = 0;
      while (x%p == 0) x /= p, ++y;
      if (y != 0) res.emplace_back(p,y);
    }
    if (x != 1) res.emplace_back(x,1);
    return res;
  }
};

int main() {
  int n;
  cin >> n;
  ll ans = 0;
  for (int i=1;i<=n;i++) {
    ans+=n/i;
    if (n%i==0) ans--;
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 3668
n,x,y = map(int, input().split())

ans = [0] * (n-1)

for i in range(1,n):
    for j in range(i+1,n+1):
        ans[min(abs(j-i),abs(x-i)+1+abs(j-y),abs(y-i)+1+abs(j-x))-1] += 1

for k in ans:
    print(k)

Measured memory_bytes: 3444
// itne me hi thakk gaye?
#include <bits/stdc++.h>
using namespace std;
#pragma GCC optimize ("-O3")
#define ll long long 
#define ull unsigned long long
using ld = long double;
const ll mod = 1e9 + 7;
const ll inf = 1e18;
const ll rk = 256;
const ll mod2 = 998244353;
const ld PI = 3.141592653589793;
#define pb push_back
#define mp make_pair
#define vc vector
#define fs first
#define sec second
#define pq priority_queue
#define lb lower_bound
#define ub upper_bound
#define pll pair<ll,ll> 
#define pls pair<ll,string>
#define psl pair<string,ll>
#define plc pair<ll,char>
#define pcl pair<char,ll>
#define pss pair<string,string>
#define all(x) (x).begin(), (x).end()
#define tol(s) transform(s.begin(),s.end(),s.begin(),::tolower);
#define tou(s) transform(s.begin(),s.end(),s.begin(),::toupper);
#define print(a) for(auto j:a) {cout<<j<<",";} cout << "\n";
#define endl '\n'
#define whatis(x) cout << "> "<<#x << " ==> " << x << endl;
#define lwi(x) cout << " your " << #x << " is ---> " << x << " ";
#define FastIO ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
 
// // Printing pair
ostream & operator << (ostream & os, pair <ll, ll> const& x) {
    os << x.first << "," << x.second;
    return os;
}
 
// printing vector
template <class T>
ostream & operator << (ostream & os, vector <T> const& x) {
    os << "{ ";
    for(auto& y : x) os << y << " ";
    return os << "}";
}
 
// printing set
template <class T>
ostream & operator << (ostream & os, set <T> const& x) {
    os << "{ ";
    for(auto& y : x) os << y << " ";
    return os << "}";
}
 
template <class Ch, class Tr, class Container>
basic_ostream <Ch, Tr> & operator << (basic_ostream <Ch, Tr> & os, Container const& x) {
    os << "{ ";
    for(auto& y : x) os << y << " ";
    return os << "}";
}
 
template <class X, class Y>
ostream & operator << (ostream & os, pair <X, Y> const& p) {
    return os << "[ " << p.first << ", " << p.second << "]" ;
}
const int mxn = 1e6+5;
int32_t main(){
    FastIO;
    int a;
    cin >> a;
    cout << a + (a*a) + (a*a*a) << endl;
    return 0;
}


Measured memory_bytes: 3648
//#include<bits/stdc++.h>
#include<cstdio>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
#define ce(x) cerr << (x) << "\n"
#define cesp(x) cerr << (x) << " "
#define pb push_back
#define mp make_pair
#define Would
#define you
#define please

const int cm = 1 << 17;
char cn[cm], * ci = cn + cm, ct;
inline char getcha() {
	if (ci - cn == cm) { fread(cn, 1, cm, stdin); ci = cn; }
	return *ci++;
}
inline int getint() {
	int A = 0;
	if (ci - cn + 16 > cm) while ((ct = getcha()) >= '0') A = A * 10 + ct - '0';
	else while ((ct = *ci++) >= '0') A = A * 10 + ct - '0';
	return A;
}

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


	int N = getint();
	int A[100001];
	rep1(i, N) A[getint()] = i + 1;
	int daishou[100004] = {};
	daishou[0] = 2;
	daishou[N + 3] = N + 1;

	ll kotae = 0;
	rep1(i, N) {
		int a = A[i];
		int l = daishou[a - 1];
		if (!l) l = a;
		int r = daishou[a + 1];
		if (!r) r = a;
		int l2 = daishou[l - 2];
		if (!l2) l2 = l - 1;
		int r2 = daishou[r + 2];
		if (!r2) r2 = r + 1;

		kotae += ((ll)(r2 - r) * (a - l + 1) + (ll)(l - l2) * (r - a + 1)) * i;

		daishou[l] = r;
		daishou[r] = l;
	}

	printf("%lld", kotae);

	Would you please return 0;
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define PB push_back
#define MP make_pair
#define REP(i,a,b) for(inti=a;i<=b;i++)

#define MOD 1000000007
typedef long long int ll;
typedef vector<int>vi;
typedef pair<int,int>pi;


int main()
{
string s ,t;
cin>>s>>t;

reverse(t.begin(),t.end());
if(s==t)
    cout<<"YES"<<endl;
else
    cout<<"NO"<<endl;
 return 0;
}


Measured memory_bytes: 3608
import java.util.*;
 
class Main{
 
    int h, w;
    int sx, sy, gx, gy;
    int[][] grid;
 
    void solve(){
        Scanner sc = new Scanner(System.in);
 
        while(true){
 
            h = sc.nextInt();
            w = sc.nextInt();
            if(h==0 && w==0) break;
 
            grid = new int[h][w];
            for(int i=0; i<h; i++){
                for(int j=0; j<w; j++){
                    grid[i][j] = sc.nextInt();
                }
            }
            sy = sc.nextInt();
            sx = sc.nextInt();
            gy = sc.nextInt();
            gx = sc.nextInt();
 
            System.out.println(bfs());
        }
    }
 
    class Dice{
        int[] dice = new int[6];
        Dice(int a, int b, int c, int d, int e, int f){
            dice[0] = a; dice[1] = b; dice[2] = c;
            dice[3] = d; dice[4] = e; dice[5] = f;
        }
    }
 
    int[][] dd = {{1,5,2,3,0,4}, {3,1,0,5,4,2}, {4,0,2,3,5,1}, {2,1,5,0,4,3}};
 
    Dice rotate(Dice d, int idx){
        return new Dice(d.dice[dd[idx][0]], d.dice[dd[idx][1]], d.dice[dd[idx][2]], d.dice[dd[idx][3]], d.dice[dd[idx][4]], d.dice[dd[idx][5]]);
    }
 
    class P{
        Dice d;
        int[] num;
        P(int[] num, Dice d){
            this.num = num;
            this.d = d;
        }
    }
    
    int[] dx = {0, 1, 0, -1};
    int[] dy = {-1, 0, 1, 0};
    
    int bfs(){
        //x, y pena,direction
        PriorityQueue<P> 
            q = new PriorityQueue<P>(10, new Comparator<P>(){
                    public int compare(P a, P b){
                        return a.num[2] - b.num[2];
                    }
                });
        boolean[][][][] v = new boolean[h][w][6][6];
        Dice d = new Dice(1,2,3,4,5,6);
        q.add(new P(new int[]{sx, sy, 0}, d));
              
        int min = Integer.MAX_VALUE;
              
        while(q.size()>0){
            P p = q.poll();
            int[] qq = p.num;
            int x = qq[0], y = qq[1], pena = qq[2];
            Dice ddd = p.d;
            //System.out.println(x+" "+y+" "+pena+" "+Arrays.toString(ddd.dice));
 
            if(x==gx && y==gy) return pena;

            if(v[y][x][ddd.dice[0]-1][ddd.dice[1]-1]) continue;
            v[y][x][ddd.dice[0]-1][ddd.dice[1]-1] = true;
 
            for(int i=0; i<4; i++){
                int nx = x + dx[i], ny = y + dy[i];
                if(nx<0 || nx>=w || ny<0 || ny>=h) continue;
                Dice newDice = rotate(ddd, i);
                q.add(new P(new int[]{nx, ny, pena+grid[ny][nx]*newDice.dice[5], newDice.dice[0], newDice.dice[1]}, newDice));
            }
        }

        return min; 
    }
 
 
    public static void main(String[] args){
        new Main().solve();
    }
}

Measured memory_bytes: 61176
#include <iostream>
#include <string>
#include <cstring>
#include <fstream>
#include <cmath>
#include <iomanip>
#include <cstdlib>
#include <algorithm>
#include <vector>
#include <map>
#include <deque>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <list>
#include <unordered_map>
#include <bitset>
#include <sstream>

typedef  long long ll;
#define mop 1000000007
using namespace std;

long long extGCD(long long a, long long b, long long &x, long long &y) {
    if (b == 0) {
        x = 1;
        y = 0;
        return a;
    }
    long long d = extGCD(b, a%b, y, x); // 再帰的に解く
    y -= a / b * x;
    return d;
}

// 負の数にも対応した mod (a = -11 とかでも OK)
inline long long mod(long long a, long long m) {
    return (a % m + m) % m;
}

// 逆元計算 (ここでは a と m が互いに素であることが必要)
long long modinv(long long a, long long m) {
    long long x, y;
    extGCD(a, m, x, y);
    return mod(x, m); // 気持ち的には x % m だが、x が負かもしれないので
}


unsigned long long nCr(long n, long r) {
    unsigned long long ans = 1;
    for (long i = 1 ; i < r + 1; ++i) {
        ans = ans * (n-i+1);
        ans %= mop;
        ans = ans * modinv(i, mop);
        ans %= mop;
    }
    return ans;
}

int main() {
    
    long x,y;
    cin >> x >> y;
    if(2*x < y or 2*y < x or (x+y)%3 != 0){
        cout << 0 << endl;
        return 0;
    }
    if (x > y){
        ll t = x;
        x = y;
        y = t;
    }
//    long tmp = x / 3;
    long numX = y - (x+y)/3;
    long numY = x - (x+y)/3;
//    cout << numX << " " << numY << endl;

    cout << nCr(numX+numY, numX) << endl;


}


Measured memory_bytes: 384
N=int(input())
A=[]
PRECISION_DIGITS=9
cnt={}


for n in range(N):
	tmpA = float(input())
	tmpA = round(tmpA*(10**PRECISION_DIGITS))
	#print(tmpA)

	two = 0
	five = 0
	while (tmpA % 2) == 0:
		two += 1
		tmpA /= 2
	while (tmpA % 5) == 0:
		five += 1
		tmpA /= 5

	if (two,five) in cnt:
		cnt[(two,five)]+=1
	else:
		cnt[(two,five)]=1

keys=sorted(cnt.keys())
# print(keys)
ans = 0
for t1 in keys:
	for t2 in keys:
		# 2**a(a>=0) and 5**b(b>=0) => integer
		if 18 <= t1[0]+t2[0] and 18 <= t1[1]+t2[1]:
			cnt1 = cnt[(t1[0],t1[1])]
			cnt2 = cnt[(t2[0],t2[1])]
			if t1 < t2:
				ans += int(cnt1*cnt2)
			elif t1 == t2:
				# same entry
				# Total number of combinations choose 2 items
				# nC2 = n*(n-1)/2
				ans += int(cnt1*(cnt1-1)/2)


print(ans)



Measured memory_bytes: 9248
#include <bits/stdc++.h>
 
using namespace std;
 
typedef long long ll;
typedef long double ld;
 
typedef pair<int, int> p;
 
int main() {
	cin.tie(0);
    ios::sync_with_stdio(false);

    string s;
    cin >> s;

    s[5] = ' ';
    s[13] = ' ';

    cout << s << endl;
}

Measured memory_bytes: 256
# include "cstdio"
# include "iostream"
# include "cmath"

using namespace std;

const int maxm=1e5+10;
const int maxn=65;

int N,Max;
long long K,A[maxm],B[maxn],Add[maxn];

int main(){
	register int i,j;
	register long long Now,Ans=0;
	scanf("%d%lld",&N,&K);
	for(i=1;i<=N;i++) scanf("%lld",A+i);
	Max=log2(K);
	for(i=Max;i>=0;i--){
		Now=1ll<<i;
		for(j=1;j<=N;j++){
			if(A[j]&Now) B[i]--;
			else B[i]++;
		}
		B[i]=B[i]<0?0:(1ll<<i)*B[i];
	}
	for(i=0;i<=Max;i++) Add[i]=i>0?Add[i-1]+B[i]:B[i];
	Now=0;
	for(i=Max;i>=0;i--){
		if(!(K&(1ll<<i))) continue;
		Ans=max(Ans,i-1ll>=0?Now+Add[i-1]:Now);
		if(K&(1ll<<i)) Now+=B[i];
	}
	Ans=max(Ans,Now);
	for(i=1;i<=N;i++) Ans+=A[i];
	printf("%lld",Ans);
	return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
void debug() {cout<<endl;}
template<typename T,typename... Args>
void debug(T x,Args... args) {cout<<x<<" ";debug(args...);}
#define forn(i,a,b) for(int i=a;i<b;++i)
#define pb push_back
#define F first
#define S second
#define endl "\n"
typedef long long ll;
typedef pair<int, int> pii;

const int N = 3005;
int A[N];
ll dp[N][N];

ll f(int i, int j){
  if(i > j)return 0;
  ll &ans = dp[i][j];
  if(ans != -1)return ans;
  ans = 0;
  ans = max(A[i]-f(i+1, j), A[j]-f(i, j-1));
  return ans;
}


int main() {
  ios::sync_with_stdio(0); cin.tie(0);
  int n;
  ll tot = 0;
  cin >> n;
  forn(i, 0, n){
    cin >> A[i];
    tot += A[i];
  }
  memset(dp, -1, sizeof dp);
  ll ans = f(0, n-1);
  cout << ans << endl;


}





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

struct Point {
    int x;
    int y;
    Point(int new_x, int new_y) {
        x = new_x;
        y = new_y;
    }
};

bool operator<(const Point &lhs, const Point &rhs) {
    if (lhs.x == rhs.x) {
        return lhs.y < rhs.y;
    }
    else {
        return lhs.x < rhs.x;
    }
}

double get_dist(const Point &lhs, const Point &rhs) {
    return sqrt((lhs.x - rhs.x) * (lhs.x - rhs.x) + (lhs.y - rhs.y) * (lhs.y - rhs.y));
}

double find_shortest_traversal(vector<Point> &points) {
    sort(points.begin(), points.end());
    int n = points.size();
    vector<double> dp(n, 0);


    vector<double> sum_of_distances(n, 0); //sum of dist(xi, x(i+1)) + dist(x(i+1), x(i+2)) + ...
    sum_of_distances[n - 1] = 0;
    for (int i = n - 2; i >= 0; --i) {
        sum_of_distances[i] = sum_of_distances[i + 1] + get_dist(points[i], points[i + 1]);
    }


    dp[1] = get_dist(points[0], points[1]);
    if (n == 2) {
        return dp[1] + dp[1];
    }
    dp[2] = get_dist(points[2], points[0]) + dp[1];
    for (int j = 3; j < n; ++j) {
        double minimal_length = -1;
        for (int i = 1; i < j; ++i) {
            double length_xn_xi = get_dist(points[j], points[i - 1]) + dp[i] + sum_of_distances[i] - sum_of_distances[j - 1];
            if (minimal_length == -1 || minimal_length > length_xn_xi) {
                minimal_length = length_xn_xi;
            }
        }
        dp[j] = minimal_length;
    }
    return dp[n - 1] + get_dist(points[n - 1], points[n - 2]);
}

int main() {
    int n;
    cin >> n;
    vector<Point> points;

    for (int i = 0; i < n; ++i) {
        int new_x;
        int new_y;
        cin >> new_x >> new_y;
        points.push_back(Point(new_x, new_y));
    }
    
    cout << fixed << setprecision(8) << find_shortest_traversal(points) << endl;
    return 0;
}


Measured memory_bytes: 3312
n = int(input())
lst = str(input()).split(' ')
 
p1 = [0]*(max([int(i) for i in lst])+1)
p2 = [0]*(max([int(i) for i in lst])+1)
for idx in range(n):
	if idx%2 == 0:
		p1[int(lst[idx])] += 1
	else:
		p2[int(lst[idx])] += 1

if p1.index(max(p1)) == p2.index(max(p2)):
	print(min(n-max(p1)-sorted(p2)[-2], n-sorted(p1)[-2]-max(p2)))
else:
	print(n-max(p1)-max(p2))

'''
pp1 = p1.index(max(p1))
pp2 = p2.index(max(p2))
if pp1 == pp2:
	if max(p1)+sorted(p2)[-2] >= sorted(p1)[-2]+max(p2):
		pp2 = p2.index(sorted(p2)[-2])
		print(n-max(p1)-sorted(p2)[-2])
	else:
		pp1 = p1.index(sorted(p1)[-2])
		print(n-sorted(p1)[-2]-max(p2))
else:
	print(n-max(p1)-max(p2))

cnt1 = 0
cnt2 = 0
for idx in range(n):
	if idx%2 == 0:
		if not lst[idx] == str(pp1):
			cnt1 += 1
	else:
		if not lst[idx] == str(pp2):
			cnt2 += 1
'''

Measured memory_bytes: 14648
using System;
using System.Collections.Generic;
using System.Linq;
using static System.Console;
using static System.Convert;
using static System.Math;
using Pair = System.Tuple<int, int>;
using Edge = System.Tuple<int, int, long>;
//using Debug;
//using static System.Globalization.CultureInfo;

class Program
{
    static void Main(string[] args)
    {
        var nm = Input.ar;
        var abc = new int[nm[1]][];
        var dist = new long[nm[0], nm[0]];
        for(var i = 0; i < nm[1]; i++)
        {
            abc[i] = Input.ar;
            dist[abc[i][0] - 1, abc[i][1] - 1] = abc[i][2];
            dist[abc[i][1] - 1, abc[i][0] - 1] = abc[i][2];
        }
        for (var i = 0; i < nm[0]; i++)
            for (var j = 0; j < nm[0]; j++)
                if (i != j && dist[i, j] == 0)
                    dist[i, j] = long.MaxValue / 2;
        for (var k = 0; k < nm[0]; k++)
            for (var i = 0; i < nm[0]; i++)
                for (var j = 0; j < nm[0]; j++)
                    dist[i, j] = Min(dist[i, j], dist[i, k] + dist[k, j]);
        var res = 0;
        foreach (var eg in abc)
            if (dist[eg[0]-1, eg[1]-1] != eg[2])
                res++;
        WriteLine(res);
    }
}

public class Input
{
    public static string read => ReadLine();
    public  static int[] ar => Array.ConvertAll(read.Split(' '), int.Parse);
    public  static int num => ToInt32(read);
    public static long[] arL => Array.ConvertAll(read.Split(' '), long.Parse);
    public  static long numL => ToInt64(read);
    public static char[][] gred(int h) 
        => Enumerable.Repeat(0, h).Select(v => read.ToCharArray()).ToArray();
    public static int[][] twodim(int num)
        => Enumerable.Repeat(0, num).Select(v => ar).ToArray();
    public static long[][] twodimL(int num)
        => Enumerable.Repeat(0, num).Select(v => arL).ToArray();
    public const long Inf = (long)1e18/2;
    public const double eps = 1e-6;
    public  const string Alfa = "abcdefghijklmnopqrstuvwxyz";
    public  const int MOD = 1000000007;
}


Measured memory_bytes: 13336
fun main(args: Array<String>) = IO().exec {
    val n = int()
    val s = Array(n){string().toCharArray().sorted().joinToString("")}
    val cnt = mutableMapOf<String, Long>()
    for (i in n) cnt[s[i]] = (cnt[s[i]] ?: 0) + 1
    var ret = 0L
    for (e in cnt) ret += e.value * (e.value - 1) / 2
    println(ret)
}

// region template
operator fun Int.iterator() = 0.until(this).iterator()

class IO {
    val printable = 33..126
    val buffer = ByteArray(1024)
    var ptr = 0
    var buflen = 0
    val out = java.io.PrintWriter(System.out)
    fun hasNextByte(): Boolean = if (ptr < buflen) true else {
        ptr = 0
        buflen = System.`in`.read(buffer)
        buflen > 0
    }

    fun readByte(): Byte = if (hasNextByte()) buffer[ptr++] else -1
    fun hasNext(): Boolean {
        while (hasNextByte() && buffer[ptr] !in printable) ptr++
        return hasNextByte()
    }

    fun string(): String {
        if (!hasNext()) throw java.util.NoSuchElementException()
        val sb = StringBuilder()
        var b = readByte()
        while (b in printable) {
            sb.appendCodePoint(b.toInt())
            b = readByte()
        }
        return sb.toString()
    }

    fun long(): Long {
        if (!hasNext()) throw java.util.NoSuchElementException()
        var n = 0L
        var minus = false
        var b = readByte()
        if (b == '-'.toByte()) {
            minus = true
            b = readByte()
        }
        if (b !in '0'.toByte()..'9'.toByte()) {
            throw NumberFormatException()
        }
        while (true) {
            if (b in '0'.toByte()..'9'.toByte()) {
                n *= 10
                n += b - '0'.toByte()
            } else if (b == (-1).toByte() || b !in printable) {
                return if (minus) -n else n
            } else {
                throw NumberFormatException()
            }
            b = readByte()
        }
    }

    fun int(): Int {
        val nl = long()
        if (nl !in Integer.MIN_VALUE..Integer.MAX_VALUE) throw NumberFormatException()
        return nl.toInt()
    }

    fun double(): Double = string().toDouble()
    fun print(obj: Any) = out.print(obj)
    fun print(i: Int) = out.print(i)
    fun print(l: Long) = out.print(l)
    fun println(obj: Any) = out.println(obj)
    fun println(i: Int) = out.println(i)
    fun println(l: Long) = out.println(l)
    inline fun exec(block: IO.() -> Unit) {
        block()
        out.flush()
    }
}
// endregion

Measured memory_bytes: 75292
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define _GLIBCXX_DEBUG
#define all(x) x.begin(), x.end()
using namespace std;
typedef long long ll;
typedef pair<int, int> pair;
const int inf = 1000000000; //10^9
const ll inff = 1000000000000000000; //10^18

int main(){
    double x1,x2,y1,y2;
    cin >> x1 >> y1 >> x2 >> y2;
    double x, y;
    x = (x2 - x1) * (x2 - x1);
    y = (y2 - y1) * (y2 - y1);
    double ans = sqrt(x + y);
    cout << fixed << setprecision(6) << ans << endl;

    return 0;
}


Measured memory_bytes: 3296
#include<iostream>
#include<vector>
#include<algorithm>
#include<queue>
#include<deque>
#include<cmath>
#include<map>
#include<cstring>

using namespace std;
typedef long long ll;
const int INF = 1e9;
const int MOD = 1e9 + 7;
const ll LLINF = 1LL<<60;
#define P pair<int, int>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define print(x) cout << (x) << endl

class mint {
    long long x;
public:
    mint(long long x=0) : x((x%MOD+MOD)%MOD) {}
    mint operator-() const {
      return mint(-x);
    }
    mint& operator+=(const mint& a) {
        if ((x += a.x) >= MOD) x -= MOD;
        return *this;
    }
    mint& operator-=(const mint& a) {
        if ((x += MOD-a.x) >= MOD) x -= MOD;
        return *this;
    }
    mint& operator*=(const  mint& a) {
        (x *= a.x) %= MOD;
        return *this;
    }
    mint operator+(const mint& a) const {
        mint res(*this);
        return res+=a;
    }
    mint operator-(const mint& a) const {
        mint res(*this);
        return res-=a;
    }
    mint operator*(const mint& a) const {
        mint res(*this);
        return res*=a;
    }
    mint pow(ll t) const {
        if (!t) return 1;
        mint a = pow(t>>1);
        a *= a;
        if (t&1) a *= *this;
        return a;
    }
    // for prime MOD
    mint inv() const {
        return pow(MOD-2);
    }
    mint& operator/=(const mint& a) {
        return (*this) *= a.inv();
    }
    mint operator/(const mint& a) const {
        mint res(*this);
        return res/=a;
    }

    friend ostream& operator<<(ostream& os, const mint& m){
        os << m.x;
        return os;
    }
};
/* -- template -- */

struct UnionFind {
    vector<int> par;
    vector<ll> siz;
    UnionFind(int N) : par(N), siz(N, 1LL) {
        for(int i = 0; i < N; ++i) {
            par[i] = i;
        }
    }
    int root(int x) {
        if(par[x] == x) return x;
        return par[x] = root(par[x]);
    }
    void unite(int x, int y) {
        int rx = root(x);
        int ry = root(y);
        if(rx == ry) return;
        siz[ry] += siz[rx];
        par[rx] = ry;
    }
    bool same(int x, int y) {
        return root(x) == root(y);
    }
    ll size(int x) {
        return siz[root(x)];
    }
};
ll ans[100001];
int main() {
    ll N, M;
    cin >> N >> M;
    int A[M], B[M];
    UnionFind tree(N);
    rep(i, M) {
        cin >> A[M - 1 - i] >> B[M - 1 - i];
        --A[M - 1 - i], --B[M - 1 - i];
    }
    ans[M] = 0;
    rep(i, M - 1) {
        if(tree.same(A[i], B[i])) {
            ans[M - 1 - i] = ans[M - i];
        }else {
            ans[M - 1 - i] = ans[M - i] + tree.size(A[i]) * tree.size(B[i]);
            tree.unite(A[i], B[i]);
        }
    }
    rep(i, M - 1)
        cout << N * (N - 1) / 2 - ans[i + 1] << endl;
    cout << N * (N - 1) / 2 << endl;
}


Measured memory_bytes: 4096
function Main(input) {
    var c1 = changeNumber(input.split('\n')[0].split(' '));
    var c2 = changeNumber(input.split('\n')[1].split(' '));
    var c3 = changeNumber(input.split('\n')[2].split(' '));
    function changeNumber(c){
        var box =[];
        for(var k =0; k<3; k++){
            box.push(Number(c[k]));
        }
        return box;
    }
    var c = [];
    c.push(c1);
    c.push(c2);
    c.push(c3);
    var ans="No";
    if(c[2][2]-c[1][2]===c[2][1]-c[1][1]&&
       c[2][1]-c[1][1]===c[2][0]-c[1][0]&&
       c[1][2]-c[0][2]===c[1][1]-c[0][1]&&
       c[1][1]-c[0][1]===c[1][0]-c[0][0]&&
       c[0][2]-c[0][1]===c[1][2]-c[1][1]&&
       c[1][2]-c[1][1]===c[2][2]-c[2][1]&&
       c[0][1]-c[0][0]===c[1][1]-c[1][0]&&
       c[1][1]-c[1][0]===c[2][1]-c[2][0]){
    ans="Yes";
  }
  console.log(ans);
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));

Measured memory_bytes: 7372
import java.util.*;
import java.lang.*;
import java.io.*;


public class Main {
    public static int maxOfArray(int[] a){
    	int ans = a[0];
    	for(int i=1;i<a.length;i++){
    		if(a[i]>ans) ans=a[i];
    	}
    	return ans;
    }
    public static int minOfArray(int[] a){
    	int ans = a[0];
    	for(int i=1;i<a.length;i++){
    		if(a[i]<ans) ans=a[i];
    	}
    	return ans;
    }
    
    public static boolean unbalanced(String s){
        int[] count = new int[26];
        for(int i=0;i<s.length();i++){
        	count[s.charAt(i)-'a']++;
        }
        return maxOfArray(count)>s.length()/2;
    }
    public static String solve(String s){
        if(s.length()<3) return (unbalanced(s) ? "1 2" : "-1 -1");
        
        for(int i=0;i<s.length()-2;i++){
        	if(unbalanced(s.substring(i,i+3))) return ((i+1)+" "+(i+3));
        }
        return "-1 -1";
    }
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        System.out.println(solve(s));
    }
}


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

int main(void) {

    string str;

    cin >> str;
    if (str.find("A") != std::string::npos && str.find("B") != std::string::npos ){
      cout << "Yes" << endl;
    } else {
      cout << "No" << endl;
    }

    return 0;
}


Measured memory_bytes: 256
n=int(input())
t,a=map(int,input().split())
h=list(map(int,input().split()))
b=10**10
c=d=e=0
for i in h:
	c=abs(a-(t-0.006*i))
	d+=1
	if c<b:
		b=c
		e=d
print(e)


Measured memory_bytes: 3060
#include<iostream>
#include<cstdio>
#include<string>
using namespace std;
string A,B;
int M;
int dp[2][3][10][501][501];
int mod=10000;
int solve(string S,int f,int x,int pre,int rem,int index){
	if(index==S.length()){
		return !rem;
	}
	if(dp[f][x][pre][rem][index]!=-1)return dp[f][x][pre][rem][index];
	int end;
	if(f)end=9;
	else end=S[index]-'0';
	int res=0;
	for(int u=0;u<=end;u++){
		int nextx;
		if(x==0){
			if(pre!=0&&pre==u)continue;
			if(pre==0)nextx=0;
			else if(pre>u)nextx=1;
			else nextx=2;
		}
		else if(x==1){
			if(pre>=u)continue;
			nextx=2;
		}
		else{
			if(pre<=u)continue;
			nextx=1;
		}
		res+=solve(S,f|(u!=(S[index]-'0')),nextx,u,(rem*10+u)%M,index+1);
	}
	res%=mod;

	return dp[f][x][pre][rem][index]=res;
}
string ff(string S){
	int pos=S.length()-1;
	while(S[pos]=='0'){
		S[pos]='9';
		pos--;
	}
	S[pos]=(S[pos]-'0')-1+'0';
	if(pos==0&&S[pos]=='0')S.erase(S.begin());
	return S;
}
int main()
{
	for(int i=0;i<3;i++)for(int j=0;j<10;j++)for(int k=0;k<501;k++)for(int l=0;l<501;l++)for(int m=0;m<2;m++)dp[m][i][j][k][l]=-1;
	cin >> A >> B;scanf("%d",&M);
	A=ff(A);
	int ans1=solve(A,0,0,0,0,0);
	for(int i=0;i<3;i++)for(int j=0;j<10;j++)for(int k=0;k<501;k++)for(int l=0;l<501;l++)for(int m=0;m<2;m++)dp[m][i][j][k][l]=-1;
	int ans2=solve(B,0,0,0,0,0);
	printf("%d\n",(ans2-ans1+mod)%mod);
	return 0;
}

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

#include <iostream>
#include <fstream>

#pragma comment(linker, "/stack:200000000")
#include <bits/stdc++.h>
#define int long long
#define f(i,a,b) for(int i=(a);i<(b);i++)
#define MOD 1000000007
using pii=std::pair<int,int>;

using namespace std;

class ATOrT {
public:
	void solve(std::istream& in, std::ostream& out) {
		int n,a,b;
		in >> n >> a >> b;
		out << min(n*a,b) << "\n";
	}
};


int32_t main() {
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	ATOrT solver;
	std::istream& in(std::cin);
	std::ostream& out(std::cout);
	solver.solve(in, out);
	return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
#include<stdlib.h>
#include<string.h>

typedef long long int int64;

typedef struct vector{
  int *a;
  int len;
  int maxLen;
} vec;

vec* newVector(void){
  vec *v=(vec *)calloc(1,sizeof(vec));
  v->a=NULL;
  v->len=0;
  v->maxLen=0;
  return v;
}

void push_back(vec *v,int x){
  if(v->len==v->maxLen){
    v->maxLen=2*v->maxLen+1;
    v->a=realloc(v->a,sizeof(int)*v->maxLen);
  }
  v->a[v->len++]=x;
}

int64 calcInversion(int *a,int n,int *tmp){
  if(n<=1) return 0;
  int m=n/2;
  int64 res=calcInversion(a,m,tmp)+calcInversion(a+m,n-m,tmp);
  memcpy(tmp,a,sizeof(int)*m);
  int i=0;
  int j=m;
  int k=0;
  while(i<m && j<n){
    if(tmp[i]<=a[j]){
      a[k++]=tmp[i++];
    } else {
      res+=m-i;
      a[k++]=a[j++];
    }
  }
  memcpy(a+k,tmp+i,sizeof(int)*(m-i));
  return res;
}

int64 calc(char *s,int n,vec **v){
  int64 ans=0;
  int cnt[26]={0};
  int back=0;
  int mid=0;
  int i;
  for(i=0;i<n;i++){
    int k=s[i]-'a';
    cnt[k]++;
    if(v[k]->len%2==1 && cnt[k]==v[k]->len/2+1){
      mid=1;
      ans+=back;
    } else if(cnt[k]>v[k]->len/2){
      back++;
    } else {
      ans+=back+mid;
    }
  }
  memset(cnt,0,sizeof(int)*26);
  int *array=(int *)calloc(n/2,sizeof(int));
  int len=0;
  for(i=n-1;i>=0;i--){
    int k=s[i]-'a';
    if(cnt[k]<v[k]->len/2){
      array[len++]=v[k]->a[cnt[k]];
    }
    cnt[k]++;
  }
  int *tmp=(int *)calloc(n/2,sizeof(int));
  ans+=calcInversion(array,len,tmp);
  free(tmp);
  return ans;
}

void run(void){
  char *s=(char *)calloc(200000+1,sizeof(char));
  scanf("%s",s);
  int n=strlen(s);
  const int f=26;
  vec **v=(vec **)calloc(f,sizeof(vec *));
  int i;
  for(i=0;i<f;i++) v[i]=newVector();
  for(i=0;i<n;i++) push_back(v[s[i]-'a'],i+1);
  int odd=0;
  for(i=0;i<f;i++) if(v[i]->len%2) odd++;
  if(odd>1){
    printf("-1\n");
    return;
  }
  int64 ans=calc(s,n,v);
  printf("%lld\n",ans);
}

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


Measured memory_bytes: 1920
/*
confirm 0LL and 1LL
confirm cornercases such as 0
confirm times of cin < 10^6
*/
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<ll, ll>;
using Pld = pair<ld, ld>;
using Vec = vector<ll>;
using VecP = vector<P>;
using VecB = vector<bool>;
using VecC = vector<char>;
using VecD = vector<ld>;
using VecS = vector<string>;
using Graph = vector<VecP>;
template <typename T>
using Vec1 = vector<T>;
template <typename T>
using Vec2 = vector<Vec1<T> >;
#define REP(i, m, n) for(ll (i) = (m); (i) < (n); ++(i))
#define REPN(i, m, n) for(ll (i) = (m); (i) <= (n); ++(i))
#define REPR(i, m, n) for(ll (i) = (m)-1; (i) >= (n); --(i))
#define REPNR(i, m, n) for(ll (i) = (m); (i) >= (n); --(i))
#define rep(i, n) REP(i, 0, n)
#define repn(i, n) REPN(i, 1, n)
#define repr(i, n) REPR(i, n, 0)
#define repnr(i, n) REPNR(i, n, 1)
#define all(s) (s).begin(), (s).end()
#define pb push_back
#define mp make_pair
#define fs first
#define sc second
template <typename T>
bool chmax(T &a, const T b){if(a < b){a = b; return true;} return false;}
template <typename T>
bool chmin(T &a, const T b){if(a > b){a = b; return true;} return false;}
template <typename T>
ll pow2(const T n){return (1LL << n);}
template <typename T>
void cosp(const T n){cout << n << ' ';}
template <typename T>
void co(const T n){cout << n << '\n';}
template <typename T1, typename T2>
void co(pair<T1, T2> p){cout << p.fs << ' ' << p.sc << '\n';}
template <typename T>
void co(const Vec1<T> &v){for(T i : v) cosp(i); cout << '\n';}
template <typename T>
void co(initializer_list<T> v){for(T i : v) cosp(i); cout << '\n';}
template <typename T>
void ce(const T n){cerr << n << endl;}
void sonic(){ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);}
void setp(const ll n){cout << fixed << setprecision(n);}
const ll INF = 1e9+1;
const ll LINF = 1e18+1;
const ll MOD = 1e9+7;
//const ll MOD = 998244353;
const ld PI = acos(-1);
const ld EPS = 1e-11;

int main(void){
	ll n, k;
	cin >> n >> k;
	Vec a(n);
	rep(i, n) cin >> a[i];
	Vec pl, mi;
	ll ze = 0;
	for(ll i : a){
		if(i > 0) pl.pb(i);
		else if(i < 0) mi.pb(-i);
		else ze++;
	}
	sort(all(pl));
	sort(all(mi));

	ll l = -LINF, r = LINF;
	while(r-l > 1){
		ll m = (l+r)/2;
		ll cnt = 0;
		if(m == 0){
			cnt += ze*(n-1);
			cnt += ze*(n-ze);
			cnt += pl.size()*mi.size()*2;
		}else if(m > 0){
			cnt += ze*(n-1);
			cnt += ze*(n-ze);
			cnt += pl.size()*mi.size()*2;
			for(ll i : pl){
				ll t = m/i;
				ll p = upper_bound(all(pl), t)-pl.begin();
				if(i*i <= m) p--;
				cnt += p;
			}
			for(ll i : mi){
				ll t = m/i;
				ll p = upper_bound(all(mi), t)-mi.begin();
				if(i*i <= m) p--;
				cnt += p;
			}
		}else{
			ll mm = -m;
			for(ll i : pl){
				ll t = mm/i+!!(mm%i);
				ll p = lower_bound(all(mi), t)-mi.begin();
				p = mi.size()-p;
				cnt += p;
			}
			for(ll i : mi){
				ll t = mm/i+!!(mm%i);
				ll p = lower_bound(all(pl), t)-pl.begin();
				p = pl.size()-p;
				cnt += p;
			}
		}
		
		//co({m, cnt/2, k});
		if(cnt/2 < k) l = m;
		else r = m;
	}
	co(r);

	return 0;
}


Measured memory_bytes: 3956
import sys
sys.setrecursionlimit(100000)

class UnionFind:
    def __init__(self, n):
        self.parents = [i for i in range(n + 1)]

    def root(self, i):
        if self.parents[i] == i:
            return i
        else:
            self.parents[i] = self.root(self.parents[i])
            return self.parents[i]

    def unite(self, i, j):
        self.parents[self.root(self.parents[i])] = self.root(j)

    def is_unite(self, i, j):
        return self.root(i) == self.root(j)


from collections import Counter


def solve(N, M, ABs):
    uf = UnionFind(N)
    counter = Counter([i + 1 for i in range(N)])
    ans = []
    tans = N * (N - 1)
    for a, b in ABs[::-1]:
        ans.append(str(tans // 2))

        if not uf.is_unite(a, b):
            ar = uf.root(a)
            br = uf.root(b)

            tans -= counter[ar] * (N - counter[ar])
            tans -= counter[br] * (N - counter[br])
            counter[br] += counter[ar]
            tans += counter[br] * (N - counter[br])

            uf.unite(a, b)
    return "\n".join(ans[::-1])

if __name__ == "__main__":
    N, M = tuple(map(int, input().split(" ")))
    ABs = [tuple(map(int, input().split(" "))) for _ in range(M)]
    print(solve(N, M, ABs))


Measured memory_bytes: 45136
#include <iostream>

using namespace std;

int c[10][10];
int H, W, A, ans;

int main(void) {
    cin >> H >> W;
    for (int i = 0; i < 10; ++i) {
        for (int j = 0; j < 10; ++j) {
            cin >> c[i][j];
        }
    }

    for (int k = 0; k < 10; ++k) {
        for (int i = 0; i < 10; ++i) {
            for (int j = 0; j < 10; ++j) {
                if (c[i][j] > c[i][k] + c[k][j]) {
                    c[i][j] = c[i][k] + c[k][j];
                }
            }
        }
    }

    for (int i = 0; i < H; ++i) {
        for (int j = 0; j < W; ++j) {
            cin >> A;
            if (A >= 0) {
                ans += c[A][1];
            }
        }
    }

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

Measured memory_bytes: 256
#include <iostream>
#include <fstream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <tuple>
#include <cmath>
using namespace std;

int main(int argc, const char * argv[]) {
  int x, y, z;
  cin >> x >> y >> z;
  int ans = (x - z)/(y+z);
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
def main():
	S = list(str(input()))
	LenP = len(S)-1
	ans = 0
	for i in range(2**LenP):
		P = [""]*LenP
		for j in range(LenP):
			if i >> j & 1:
				P[j] = "+"
		Res = [None] * (len(S)+len(P))
		Res[1::2],Res[::2] = P,S
		ResEval = "".join(Res)
		ans += eval(ResEval)
	print(ans)

if __name__ == '__main__':
	main()

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


 
 int main()
{
    char T[100],S[100];
    int n = 0,count = 0;
    
    scanf("%s",T);
    scanf("%s",S);
    for(int i = 0;T[i] != '\0';i++)
    {
        n++;
    }
    
    /*
    
    for(int i = n;T[i] > 1;i--)
    {
        if(i == n)
        {
            T[1] = T[0];
            T[0] = T[n];
            continue;
        }
        T[i] = T[i-1];
    }
    */


    for(int i = 0;i<n;i++)
    {
        if(T[i] == S[i])
        {
            continue;
        }
        
        else
        
        {   int d = T[n-1];
         
            for(int i = n-1;i > 0;i--)
            {
                
                T[i] = T[i-1];
            }
            
            T[0] = d;
        
         
            i = 0;
            count++;}
        
        
        if(count == n){
            printf("No\n");
            return 0;
        }
    }
    
    printf("Yes\n");
    
    return 0;
    
}


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

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

	int H, W;
	while (cin >> H >> W , H) {
		string b[101];
		for (int i = 0; i < H; i++) {
			cin >> b[i];
		}

		bool visited[101][101] = {false};
		int x = 0, y = 0;
		while (b[y][x] != '.' && !visited[y][x]) {
			visited[y][x] = true;
			if (b[y][x] == '^') y--;
			if (b[y][x] == 'v') y++;
			if (b[y][x] == '<') x--;
			if (b[y][x] == '>') x++;
		}

		if (visited[y][x]) {
			cout << "LOOP" << endl;
		}
		else {
			cout << x << " " << y << endl;
		}
	}
}

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

using namespace std;

int main(){
    int s, i, tmp;
    cin >> s;

    vector< int > L;
    L.push_back(s);
    tmp = s;
    for (i=2; i<1000001; i++){
        if (tmp%2) tmp = 3 * tmp +1;
        else tmp = tmp / 2;
        auto result = std::find(L.begin(), L.end(), tmp);
        if (result != L.end()) break;
        L.push_back(tmp);
    }

    cout << i << '\n';
}

   

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ

		Scanner sc = new Scanner(System.in);

		int X = sc.nextInt();
		int A = sc.nextInt();
		int B = sc.nextInt();

			System.out.println((X-A)%B);


		}
	}



Measured memory_bytes: 21844
#include <bits/stdc++.h>
#define _overload3(_1,_2,_3,name,...)name
#define _rep(i,n)repi(i,0,n)
#define repi(i,a,b)for(int i=int(a),i##_len=(b);i<i##_len;++i)
#define MSVC_UNKO(x)x
#define rep(...)MSVC_UNKO(_overload3(__VA_ARGS__,repi,_rep,_rep)(__VA_ARGS__))
#define all(c)c.begin(),c.end()
#define write(x)cout<<(x)<<'\n'
using namespace std; using ll = long long; template<class T>using vv = vector<vector<T>>;
template<class T>auto vvec(int n, int m, T v) { return vv<T>(n, vector<T>(m, v)); }
constexpr int INF = 1 << 29, MOD = int(1e9) + 7; constexpr ll LINF = 1LL << 60;
struct aaa { aaa() { cin.tie(0); ios::sync_with_stdio(0); cout << fixed << setprecision(10); }; }aaaa;

int main() {
    string T;
    cin >> T;
    int N = T.size();
    rep(i, N) {
        if (T[i] == '?') T[i] = 'D';
    }

    //int ans = T[0] == 'D';
    //rep(i, 1, N) {
    //    ans += T[i] == 'D';
    //    ans += T.substr(i - 1, 2) == "PD";
    //}
    //write(ans);

    write(T);
}

Measured memory_bytes: 3784
n,m = map(int,input().split())
a = []
for i in range(n):
    a.append(input())
b = []
for i in range(m):
    b.append(input())

flag = 0
def solve():
    global flag
    if n == m:
        if a == b:
            flag = 1
        return 
    
    for i in range(n-m):
        for j in range(n-m):
            z = 0
            while a[i+z][j:j+m] == b[z]:
                if z == m-1:
                    flag = 1
                    break
                z += 1
    return

solve()
if flag:
    print("Yes")
else:
    print("No")


Measured memory_bytes: 3064
#include<iostream>
#include<vector>
#include<queue>
#include <string>
#include <sstream>
#include <queue>
#include <map>
#include <algorithm>
using namespace std;

const long MOD = 1e9 + 7;
int main()
{
  string s;
  long k;
  cin >> s;
  cin >> k;

  priority_queue< string, std::vector<string>, std::greater<string> > v;
  vector<string> vmap;

  for (int i = 0; i < s.size() ; i++) {  //5000回
    for (int j = 0; j < s.size() - i; j++) { //100回くらい
      string ss = s.substr(j,i+1);
      if (find(vmap.begin(), vmap.end(), ss) ==vmap.end() ) {
        v.push(ss);
        vmap.push_back(ss);
        // if (v.size() >= k)break;
      }
    }
    if (i > k)break;
     // if (v.size() >= k)break;
  }
  
  // v.pop();


  for (int i = 0; i < k-1; ++i)
  {
    // cout << v.top() <<endl;
    v.pop();
  }

  cout << v.top();

  return 0;
}






Measured memory_bytes: 1784
from functools import reduce

def gcd(a, b):
    if b == 0:
        return a
    return gcd(b, a % b)

def gcd_list(n):
    return reduce(gcd, n)

n, k = map(int, input().split())
a = list(map(int, input().split()))
if k % gcd_list(a) == 0 and k <= max(a):
    print("POSSIBLE")
else:
    print("IMPOSSIBLE")

Measured memory_bytes: 14600
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <deque>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <iomanip>
#include <bitset>
#include <set>
#include <map>
#include <stdio.h>
#include <numeric>
#include <cstring>

#define rep(i,n) for (int i = 0; i < (n); i++)
#define rep1(i,n) for (int i = 1; i < (n); i++)
#define FOR(i,a,b) for (int i=(a); i < (b); i++)
#define MOD 1000000007 //10^9+7
using namespace std;
using ll = long long;
using PII = pair<int, int>;
const int INF = numeric_limits<int>::max();

// 負の数にも対応した % 演算
long long mod(long long val, long long m) {
    long long res = val % m;
    if (res < 0) res += m;
    return res;
}

//greatest common divisor
long long gcd(ll a, ll b) 
{
    if (a % b == 0) {
        return b;
    } else {
        return gcd(b, a % b);
    }
}

//least common multiple
long long lcm(ll a, ll b)
{
    return a / gcd(a, b) * b ;
}

int main()
{
    int n; cin >> n;
    if (n == 1) {
        cout << 1 << endl;
        return 0;
    }
    char c, pc;
    cin >> pc;
    string ans = "";
    rep1(i,n) {
        cin >> c;
        if (c != pc)
            ans += pc;
        pc = c;
    }
    if (ans[ans.length()-1] != c)
        ans += c;
    cout << ans.length() << endl;

    return 0;
}


Measured memory_bytes: 512
#include <algorithm>
#include <climits>
#include <complex>
#include <cstring>
#include <iostream>
#include <map>
#include <set>
#include <vector>

// using
using namespace std;

// typedef
typedef long long ll;

// define
#define ALL(c) (c).begin(), (c).end()
#define SORT(c) sort(ALL(c))
#define REVERSE(c) reverse(ALL(c))
#define UNIQ(c) unique(ALL(c))
#define FOR(i, a, b, c) for (int i = (int)(a); i < (int)(b); i += (int)(c))
#define REP(i, n) FOR(i, 0, n, 1)
#define RFOR(i, a, b, c) for (int i = (int)(a); i >= (int)(b); i -= (int)(c))
#define RREP(i, n) RFOR(i, n, 0, 1)

// functions
int ceil(int a, int b) {
    return (a + b - 1) / b;
}
int round(int a, int b) {
    return (a + b / 2) / b;
}
int gcd(int a, int b) {
    return b ? gcd(b, a % b) : a;
}
int lcm(int a, int b) {
    return a * b / gcd(a, b);
}
template <class T> bool amax(T &a, const T &b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
template <class T> bool amin(T &a, const T &b) {
    if (b < a) {
        a = b;
        return true;
    }
    return false;
}

// main
int main() {
    string S;
    int K;
    cin >> S >> K;
    int N = S.size(), cnt = 0;
    REP(i, N) {
        if (S[i] == '1') {
            cnt++;
        } else {
            break;
        }
    }
    if (cnt >= K) {
        cout << 1 << endl;
    } else {
        cout << S[cnt] << endl;
    }
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <stdio.h>       // printf,scanf
#include <stdlib.h>
#include <math.h>
#include <string>
#include <vector>
#include <algorithm>  //sort,binarySearch
#include <functional> 
#include <iomanip>    // setprecision
#include <utility>    // c+11 Array
#include <set>
#include <sstream>
#include <map>
#include <bits/stdc++.h>
#define MOD 1000000007
#define PI 3.141592653589793238462643383279
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define pb(x) push_back(x)
#define debug(x) cout << #x << " = " << x << endl;
#define debret(x) debug(x) ; return 0;

using namespace std;


int main(void){

    int N, x;

    cin >> N >> x;

    int ans[2*N-1];

    fill(ans,ans+(2*N-1),0);

    REP(i,2*N-1){
        ans[i] = i+1;
    }

    if(x == 1 || x == 2*N-1){
        cout << "No" << endl;
        return 0;
    }else{
        cout << "Yes" << endl;
        swap(ans[N-1],ans[x-1]);
        swap(ans[N-2],ans[0]);
        swap(ans[N],ans[2*N-2]);
        
        REP(i,2*N-1){
            cout << ans[i] << endl;
        }
    }

    return 0;
}


Measured memory_bytes: 2304
#include "bits/stdc++.h"
using namespace std;
#define ll long long int
#define rep(i,n) for( int i = 0; i < n; i++ )
#define rrep(i,n) for( int i = n; i >= 0; i-- )
#define REP(i,s,t) for( int i = s; i <= t; i++ )
#define RREP(i,s,t) for( int i = s; i >= t; i-- )
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define INF 2000000000
#define mod 1000000007
#define INF2 1000000000000000000
#define int long long

signed main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N; cin >> N;
    set<int> st;
    REP(k, 3, 10) {
        rep(i, (int)pow(3, k)) {
            int cnt3 = 0, cnt5 = 0, cnt7 = 0;
            int tmp = i;
            string S;
            rep(j, k) {
                if (tmp % 3 == 0) {
                    cnt3++;
                    S += '3';
                } else if (tmp % 3 == 1) {
                    cnt5++;
                    S += '5';
                } else {
                    cnt7++;
                    S += '7';
                }
                tmp /= 3;
            }
            if (cnt3 >= 1 && cnt5 >= 1 && cnt7 >= 1) {
                st.insert(stoll(S));
            }
        }
    }
    int ans = 0;
    for(auto itr = st.begin(); itr != st.end(); itr++) {
        if (N >= *itr) ans++;
        //cout << *itr << endl;
    }
    cout << ans << endl;


    return 0;
}


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

namespace AtCorder
{
	public class Program
	{
		static void Main(string[] args)
		{
			B();
		}

		public static void B()
		{
			Scanner cin = new Scanner();
			string s = cin.Next();

			int mae = int.Parse(s.Substring(0, 2));
			int ushiro = int.Parse(s.Substring(2, 2));
			//MMは01~12
			if (In(mae) && In(ushiro)) {
				Console.WriteLine("AMBIGUOUS");
			} else if (In(mae) && In(ushiro) == false) {
				Console.WriteLine("MMYY");
			} else if (In(mae) == false && In(ushiro)) {
				Console.WriteLine("YYMM");
			} else {
				Console.WriteLine("NA");
			}
		}

		public static bool In(int value)
		{
			if (value > 0 && value < 13) {
				return true;
			} else {
				return false;
			}
		}
	}

	public class Scanner
	{
		string[] s;
		int i;

		char[] cs = new char[] { ' ' };

		public Scanner()
		{
			s = new string[0];
			i = 0;
		}

		public string Next()
		{
			if (i < s.Length) return s[i++];
			string st = Console.ReadLine();
			while (st == "") st = Console.ReadLine();
			s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
			if (s.Length == 0) return Next();
			i = 0;
			return s[i++];
		}

		public int Int()
		{
			return int.Parse(Next());
		}
		public int[] ArrayInt(int N, int add = 0)
		{
			int[] Array = new int[N];
			for (int i = 0; i < N; i++) {
				Array[i] = Int() + add;
			}
			return Array;
		}

		public long Long()
		{
			return long.Parse(Next());
		}

		public long[] ArrayLong(int N, long add = 0)
		{
			long[] Array = new long[N];
			for (int i = 0; i < N; i++) {
				Array[i] = Long() + add;
			}
			return Array;
		}

		public double Double()
		{
			return double.Parse(Next());
		}


		public double[] ArrayDouble(int N, double add = 0)
		{
			double[] Array = new double[N];
			for (int i = 0; i < N; i++) {
				Array[i] = Double() + add;
			}
			return Array;
		}
	}
}


Measured memory_bytes: 11092
#include<bits/stdc++.h>
using namespace std;
int main(){
int64_t N,M;
  cin>>N>>M;
  if(N==1 && M==1)
    cout<<1<<endl;
  else if(N==1 || M==1){
   int64_t ans=max(N,M)-2;
    cout<<ans<<endl;
  }else{
  int64_t ans=(N-2)*(M-2);
    cout<<ans<<endl;
  }
    
    return 0;
}

Measured memory_bytes: 256