akhauriyash/Code-Regression huggingface dataset:
#include <algorithm>
#include <iostream>
#include <cstdint>
#include <string>
#include <vector>

using namespace std;

int main() {
	int n;
	string s;
	cin >> n;
	cin >> s;
	vector<bool> b( n );
	for ( int i = 0; i < n; i++ ) b[i] = s[i] == '#';
	vector<int> x( n ), y( n );
	int c = 0, d = 0;
	for ( int i = 0; i < n; i++ ) {
		if ( b[i] ) c++;
		x[i] = c;
		if ( !b[n-1-i] ) d++;
		y[n-1-i] = d;
	}
	int r = y[0];
	for ( int i = 0; i < n; i++ ) {
		int t = x[i] + y[i+1];
		if ( t < r ) r = t;
	}
	cout << r << endl;
	return 0;
}


Measured memory_bytes: 2180
import collections
import math

n = int(input())
a = [int(i) for i in input().split()]

def com(n, r):
    if n > 1:
        ann = math.factorial(n) // (math.factorial(n - r) * math.factorial(r))
    else:
        ann = 0
    return ann

b = collections.Counter(a)
ans = []
for i in b:
    ans.append(com(b[i],2))
anss = sum(ans)

for i in range(n):
    t = b[a[i]]
    print(anss - (t-1))

Measured memory_bytes: 34068
# ===================================
# (c) MidAndFeed aka ASilentVoice
# ===================================
# import math, fractions, collections
# ===================================
flag = 1
st = 0
sx = 0
sy = 0
for _ in range(int(input())):
	t, x, y = [int(x) for x in input().split()]
	dur = abs(t-st)
	dx = abs(x-sx)
	dy = abs(y-sy)
	if(dx+dy > dur):
		flag = 0
	else:
		if((dx+dy)&1 and not(dur&1)):
			flag = 0
		elif(not((dx+dy)&1) and (dur&1)):
			flag = 0
	st = t
	sx = x
	sy = y
print("Yes" if flag else "No")

Measured memory_bytes: 3064
#include "bits/stdc++.h"

#define REP(i,n) for(ll i=0;i<n;++i)
#define RREP(i,n) for(ll i=n-1;i>=0;--i)
#define FOR(i,m,n) for(ll i=m;i<n;++i)
#define RFOR(i,m,n) for(ll i=n-1;i>=m;--i)
#define ALL(v) (v).begin(),(v).end()
#define PB(a) push_back(a)
#define UNIQUE(v) v.erase(unique(ALL(v)),v.end());
#define DUMP(v) REP(aa, (v).size()) { cout << v[aa]; if (aa != v.size() - 1)cout << " "; else cout << endl; }
#define INF 1000000001ll
#define MOD 1000000007ll
#define EPS 1e-9

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


using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
ll max(ll a, int b) { return max(a, ll(b)); }
ll max(int a, ll b) { return max(ll(a), b); }
ll min(ll a, int b) { return min(a, ll(b)); }
ll min(int a, ll b) { return min(ll(a), b); }
///(テつエテ」ツδサテ渉嘉」ツδサ`)(テつエテ」ツδサテ渉嘉」ツδサ`)(テつエテ」ツδサテ渉嘉」ツδサ`)(テつエテ」ツδサテ渉嘉」ツδサ`)(テつエテ」ツδサテ渉嘉」ツδサ`)(テつエテ」ツδサテ渉嘉」ツδサ`)///

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	int h, w;
	while (cin >>w>>h, w) {
		vector<vector<vector<vector<int>>>> v(h, vector<vector<vector<int>>>(w, vvi(h, vi(w,1))));
		REP(i, 2 * h - 1) {
			if (i % 2 == 0) {
				REP(j, w - 1) {
					cin >> v[i / 2][j][i / 2][j + 1];
					v[i / 2][j+1][i / 2][j] = v[i / 2][j][i / 2][j+1];
				}
			}
			else {
				REP(j, w) {
					cin >> v[i / 2][j][i / 2 + 1][j];
					v[i / 2 + 1][j][i / 2][j] = v[i / 2][j][i / 2 + 1][j];
				}
			}
		}
		vvi depth(h, vi(w, INF));
		depth[0][0] = 0;
		queue<pii> q;
		q.push({ 0,0 });
		while (!q.empty()) {
			pii p = q.front();
			q.pop();
			int x = p.first, y = p.second;
			REP(i, 4) {
				int nx = x + dx[i * 2], ny = y + dy[i * 2];
				if (nx < 0 || nx >= w || ny < 0 || ny >= h)continue;
				if (!v[y][x][ny][nx]&&depth[ny][nx]==INF) {
					depth[ny][nx] = depth[y][x] + 1;
					q.push({ nx,ny });
				}
			}
		}

		if (depth[h - 1][w - 1] == INF)cout << 0 << endl;
		else cout << depth[h - 1][w - 1] + 1 << endl;
	}
}

Measured memory_bytes: 7336
//Code by: Nikhil Shukla, MMMUT GKP
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define V vector
#define pb push_back
#define all x x.begin(),x.end()
#define fast() ios_base::sync_with_stdio(false); cin.tie(NULL);
#define tc ll t; cin>>t; while(t--)
#define tc1 ll tt=1; while(tt--)
#define fir first
#define sec second
#define mod 1000000007
#define out1(x) cout<<x<<"\n";
#define out2(x,y) cout<<x<<" "<<y<<"\n";
#define debug() cout<<"I am in\n";
#define Vll vector<long long>
#define FOR(i,x,n) for(ll i=x;i<n;i++)
#define RFOR(i,x,n) for(ll i=x;i>=n;i--)
////////////////////////////////////////////////////////////////////////////////////////
/*vector<ll>graph[100001];
vector<ll>temp;
vector<bool>visited(100001,false);
//long long count=0;
void dfs(long long node,ll dp[])
{
        visited[node]=1;
        for(ll i=0;i<graph[node].size();i++)
        {
            if(!visited[graph[node][i]])
            dfs(graph[node][i],dp);
            dp[node]=max(dp[node],1+dp[graph[node][i]]);
        }
}*/

ll dp[3002][3002];
ll visited[3002][3002];
ll a[3002];
ll n;
ll solve(ll i,ll j)
{
    if(visited[i][j])
    return dp[i][j];
    visited[i][j]=1;
    if(i==j)
    return dp[i][j]=a[i];
    return dp[i][j]=max(a[i]-solve(i+1,j),a[j]-solve(i,j-1));
}
int main()
{
    fast()
    tc1
    {
        FOR(i,0,3001)
        FOR(j,0,3001)
        visited[i][j]=0;
        cin>>n;
        FOR(i,1,n+1)
        cin>>a[i];
        cout<<solve(1,n)<<"\n";
    }
    
    return 0;
}


Measured memory_bytes: 120328
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define rep(i,n) for (int i = 0; i < (n); ++i)
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
const ll INF=1LL<<60;
const int inf=1<<30;
const int mod=1e9+7;
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n,m;
    while(cin >> n >> m){
        if(n==0&&m==0){
            return 0;
        }
        vector<vector<int>> g(n);
        rep(i,m){
            int a,b;cin >> a >> b;
            a--,b--;
            g[a].push_back(b);
            g[b].push_back(a);
        }
        vector<int> c(n,-1);
        c[0]=0;
        stack<int> st;
        bool f=true;
        st.push(0);
        while(!st.empty()){
            int p=st.top();
            st.pop();
            for(int x:g[p]){
                if(c[x]==-1){
                    c[x]=c[p]^1;
                    st.push(x);
                }
                else{
                    if(c[x]==c[p]){
                        f=false;
                    }
                }
            }
        }
        if(!f){
            cout << 0 << endl;
            continue;
        }
        int cnt=0;
        rep(i,n){
            if(c[i]){
                cnt++;
            }
        }
        vector<bool> ans(n+1);
        int t=n-cnt;
        if(cnt%2==0){
            ans[cnt/2]=true;
        }
        if(t%2==0){
            ans[t/2]=true;
        }
        int res=0;
        rep(i,n+1){
            if(ans[i]){
                res++;
            }
        }
        cout << res << endl;
        rep(i,n){
            if(ans[i]){
                cout << i << endl;
            }
        }
    }
}


Measured memory_bytes: 3284
#![allow(non_snake_case)]
#![allow(unused_variables)]

fn main() {
    let N: i64 = {
        let mut line: String = String::new();
        std::io::stdin().read_line(&mut line).unwrap();
        line.trim().parse().unwrap()
    };
    let S: Vec<char> = {
        let mut line: String = String::new();
        std::io::stdin().read_line(&mut line).unwrap();
        line.trim().chars().collect()
    };

    let MOD = 1_000_000_007;

    // 各要素について、開くか閉じるかは一意に定まる
    let ans = {
        let (x, y) = S.iter()
            .fold(
                (
                    (1..(N + 1)).fold(1, |f, i| (f * i) % MOD),
                    0
                ),
                |(res, k), &c| if c == 'B' && k % 2 == 0 || c == 'W' && k % 2 == 1 {
                    (res, k + 1)
                } else {
                    ((res * k) % MOD, k - 1)
                }
            );
        if y == 0 {
            x
        } else {
            0
        }
    };

    println!("{}", ans);
}


Measured memory_bytes: 4352
#include<stdio.h>
int main(){
int p[101][101];
int n,m,x,w;
for(int i=0;i<101;i++){
for(int j=0;j<101;j++)
{p[i][j]=0;}}
w=0;
scanf("%d",&n);scanf("%d",&m);

for(int i=0;i<n;i++)
{
for(int j=0;j<m;j++)
{scanf("%d",&x);
p[i][j]=x;
p[i][m]+=x;
}
}

for(int ii=0;ii<n;ii++){
for(int jj=0;jj<=m;jj++){

if(jj<m){printf("%d ",p[ii][jj]);}

else if(jj==m){printf("%d\n",p[ii][m]);}

}
}
for(int j=0;j<m;j++){
for(int i=0;i<n;i++)
{
p[n][j]+=p[i][j];
}
printf("%d ",p[n][j]);
p[n][m]+=p[n][j];
}
printf("%d\n",p[n][m]);

return 0;
}

Measured memory_bytes: 1068
#include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include <algorithm>
#include <string.h>
#include <math.h>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <stack>
#define mem(a,b) memset(a,b,sizeof(a))
#define ll long long
#define ull unsigned long long
#define EPS 1e-8
using namespace std;
typedef pair<int,int> pii;
typedef pair<long,long> pll;
const double pi = acos(-1.0);
int read()
{
	int ret=0;char ch=getchar();
	while(ch<'0'||ch>'9') ch=getchar();
	for(;ch>='0'&&ch<='9';ch=getchar()) ret=ret*10+ch-'0';
	return ret;
}
set <int> s;
int n,a;
int main()
{
 	#ifdef TEST
	 	freopen("input.txt","r",stdin);
	#endif
	s.clear();
	cin>>n;
	while(n--)
	{
		cin>>a;
		if(s.find(a)!=s.end())
		{
			s.erase(a);
		}
		else
		{
			s.insert(a);
		}
	}
	cout<<s.size()<<endl;
	return 0;
}



Measured memory_bytes: 4864
#include<bits/stdc++.h>
using namespace std;
#define fastIO std::ios_base::sync_with_stdio(false); std::cin.tie(0); std::cout.tie(0)
#define rep(i,a,n) for (int i=a;i<n;i++)
#define per(i,a,n) for (int i=n-1;i>=a;i--)
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define SZ(x) ((int)(x).size())
typedef vector<int> VI;
typedef long long ll;
typedef pair<int,int> PII;
typedef double db;
//mt19937 mrand(random_device{}()); 
const ll mod=1000000007;
const int INF = 0x3f3f3f3f;
//int rnd(int x) { return mrand() % x;}
ll powmod(ll a,ll b) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
ll gcd(ll a,ll b) { return b?gcd(b,a%b):a;}

const int maxn = 2e5 + 10; 

int main()
{
	fastIO;
	int x,y,z;
	cin >> x >> y >> z;
	swap(x,y);
	swap(x,z);
	cout << x << " " << y << " " << z << endl; 
	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
int main(void){
    int a,b;
    char op;
    while(1){
        scanf("%d %c %d",&a,&op,&b);
        if (op == '?') break;
        if (op=='+') printf("%d\n",a+b);
        else if (op=='-') printf("%d\n",a-b);
        else if (op=='*') printf("%d\n",a*b);
        else if (op=='/') printf("%d\n",a/b);
        
    }
    
    return 0;
}


Measured memory_bytes: 2040
#include <algorithm>
#include <cstdio>
#include <iostream>
#include <map>
#include <cmath>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
#include <stdlib.h>
#include <stdio.h>
#include <bitset>
#include <cstring>
#include <deque>
#include <iomanip>
#include <limits>
#include <fstream>
using namespace std;
#define FOR(I,A,B) for(int I = (A); I < (B); ++I)
#define CLR(mat) memset(mat, 0, sizeof(mat))
typedef long long ll;
typedef pair<int, int> P;
int main()
{
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n, m;
  cin >> n >> m;
  vector<P> v(m);
  FOR(i,0,m){
      int a, b;
      cin >> a >> b;
      v[i] = P(a, b);
  }
  int ans = 0;
  sort(v.begin(), v.end());
  FOR(i,1,m){
      if(v[i].first < n){
          ans += n - v[i].first;
      }
  }
  cout << ans << endl;
}


Measured memory_bytes: 3140
// Contest.cpp : コンソール アプリケーションのエントリ ポイントを定義します。
//

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

using namespace std;

int main()
{
	int c = 0;
	string s;
	cin >> s;
	for (int i = 0; i < s.length(); i++)if (s[i] == '1')c++;
	cout << c;
	return 0;
}



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

#define lli long long int
#define REP(i,s,l) for(lli i=s;i<l;i++)
#define DEBUG 0
#define INF (1LL<<50)
#define MOD 1000000007

int main(){
    string s; cin >> s;
    
    int min = 100000;
    string tmp = "";
    for(int i=0; i<s.length()-2; i++){
        tmp.push_back(s[i]);
        tmp.push_back(s[i+1]);
        tmp.push_back(s[i+2]);
        int num = stoi(tmp);
        int diff = abs(num-753);
        if(diff<min) min=diff;
        tmp = "";
    }
    cout << min << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <stack>
#include <queue>
#include <map>
#include <algorithm>
#include <iomanip>
#include <math.h>
#include <string.h>
#include <cstdio>
using namespace std; using ll = long long; using pll = pair<ll, ll>;
using vl = vector<ll>; using vll = vector<vl>; using vpll = vector<pll>;
//**デバッグ準備**//
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
void debug_out() { cerr << endl; }
template<typename Head, typename... Tail>
void debug_out(Head h, Tail... t) {
	cerr << " " << h;
	if (sizeof...(t) > 0) cerr << " :";
	debug_out(t...);
}
template <typename T>
ostream& operator<<(ostream& os, vector<T> vec) {
	for (size_t i = 0; i < vec.size(); i++)os << vec[i] << (i + 1 == vec.size() ? "" : " ");
	return os;
}
ll ctoi(char c) {
	switch (c) {
	case '0': return 0; case '1': return 1; case '2': return 2;
	case '3': return 3; case '4': return 4; case '5': return 5;
	case '6': return 6; case '7': return 7; case '8': return 8;
	case '9': return 9;  default: return 0;
	}
}
bool pairCompare(const pll firstElof, pll secondElof)
{
	return firstElof.first > secondElof.first;
}
//**Snippetリスト**//
//rep, vin, all, iteLoop//
//gcdlcm, isPrime, eratos, divisor, modinv, bitSearch, bitList, dfs, bfs//
//dijkstra, UnionFind, COM, digitDP//
ll i, j, k, l; ll N, M, K, H, W, L, X, Y, Z;
ll MOD = 1000000007; ll INF = 9999999999999; ll ans = INF;
vl flag, color; vll path; ll start = 0;
//***********//
vl Ans;
void dfs(ll now, vl V, ll num) {
	stack<ll> S;
	S.push(now);
	flag[now] = 1;
	V.push_back(now + 1);
	while (!S.empty()) {
		ll u = S.top();
		S.pop();
		for (ll i = 0; i < path[u].size(); i++) {
			ll v = path[u][i];
			if (v == start) {
				debug(start, V);
				if (num < ans) {
					ans = num;
					Ans = V;
				}
			}
			if (flag[v] == 0) {
				dfs(v, V, num + 1);
			}
		}
	}
}
int main() {
	cin >> N >> M;
	flag.resize(N);
	path.resize(N);
	for (i = 0; i < M; i++) {
		ll a, b;
		cin >> a >> b;
		a--; b--;
		path[a].push_back(b);
	}
	//始点でDFS
	for (i = 0; i < N; i++) {
		for (j = 0; j < N; j++) {
			flag[j] = 0;
		}
		vl A = {};
		start = i;
		dfs(i, A, 1);
	}
	if(ans==INF) cout << -1;
	else {
		cout << ans << endl;
		for (i = 0; i < Ans.size(); i++) {
			cout << Ans[i] << endl;
		}
	}
}


Measured memory_bytes: 12288
package main

import (
	"fmt"
	_ "net/http/pprof"
	"github.com/emirpasic/gods/lists/arraylist"
	"github.com/emirpasic/gods/utils"
)

func main() {
	list := arraylist.New()
	list.Add("a")                         // ["a"]
	list.Add("c", "b")                    // ["a","c","b"]
	list.Sort(utils.StringComparator)     // ["a","b","c"]
	_, _ = list.Get(0)                    // "a",true
	_, _ = list.Get(100)                  // nil,false
	_ = list.Contains("a", "b", "c")      // true
	_ = list.Contains("a", "b", "c", "d") // false
	list.Swap(0, 1)                       // ["b","a",c"]
	list.Remove(2)                        // ["b","a"]
	list.Remove(1)                        // ["b"]
	list.Remove(0)                        // []
	list.Remove(0)                        // [] (ignored)
	_ = list.Empty()                      // true
	_ = list.Size()                       // 0
	list.Add("a")                         // ["a"]
	list.Clear()                          // []
	list.Insert(0, "b")                   // ["b"]
	list.Insert(0, "a")                   // ["a","b"]

	var n,x,t int
	fmt.Scanf("%d %d %d", &n, &x, &t)
	fmt.Printf("%d\n", (n+x-1)/x * t)
}

Measured memory_bytes: 7320
#include <bits/stdc++.h>
using namespace std;
#define FOR(i, a, b) for(int i=(a);i<(b);++i)
#define rep(i, n) FOR(i, 0, n)
#define whole(x) (x).begin(),(x).end()
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end())
using ll = long long;
using P = pair<int, int>;
const int mod = 1000000007;

bool isSmall (string a, string b) {
    int n = a.size();
    rep(i, n) {
        if (a[i]==b[i]) continue;
        if (a[i]<b[i]) {
            return true;
        }
        if (a[i]>b[i]) {
            return false;
        }
    }
    return true;
}

bool f(string a) {
    int n = a.size();
    bool x[3] = {false, false, false};
    int y[3] = {3, 5, 7};
    rep(i, n) {
        int v = a[i] - '0';
        rep(j, 3) {
            if (v==y[j]) x[j] = true;
        }
    }
    if (x[0] && x[1] && x[2]) return true;
    return false;
}


int main(){
    string n;
    cin >> n;
    int ans = 0;
    int s = n.size();
    for (int i=3; i<s; i++) {
        ans += pow(3, i) - 3 - 3*(pow(2, i)-2);
    }
    int x[3] = {3, 5, 7};
    rep(i, pow(3, s)) {
        string temp;
        int v = i;
        rep(i, s) {
            temp += '0' + x[v%3];
            v /= 3;
        }
        if (isSmall(temp, n) && f(temp)) ans++;
    }
    
    cout << ans << endl;
    
    return 0;
}


Measured memory_bytes: 384
s = input()
chars = len(s)
model1 = ['0' if i % 2 == 0 else '1' for i in range(chars)]
model2 = ['1' if i % 2 == 0 else '0' for i in range(chars)]
ans1, ans2 = 0, 0
for i in range(chars):
    if s[i] != model1[i]:
        ans1 += 1
    if s[i] != model2[i]:
        ans2 += 1
print(min(ans1, ans2))


Measured memory_bytes: 4724
import java.util.Scanner;

public class Main {
	Scanner in = new Scanner(System.in);
	int n, m;
	int maxX, maxY, minX, minY;
	int[][] x;
	int[][] y;
	
	public Main() {
		while (true) {
			n = in.nextInt();
			if (n == 0) break;
			x = new int[n+1][];
			y = new int[n+1][];
			for (int i = 0; i <= n; i++) {
				m = in.nextInt();
				x[i] = new int[m];
				y[i] = new int[m];
				maxX = Integer.MIN_VALUE;
				maxY = Integer.MIN_VALUE;
				minX = Integer.MAX_VALUE;
				minY = Integer.MAX_VALUE;
				for (int j = 0; j < m; j++) {
					x[i][j] = in.nextInt() * 2;
					y[i][j] = in.nextInt() * 2;
					maxX = Math.max(maxX, x[i][j]);
					maxY = Math.max(maxY, y[i][j]);
					minX = Math.min(minX, x[i][j]);
					minY = Math.min(minY, y[i][j]);
				}
				int gx = (maxX + minX) / 2;
				int gy = (maxY + minY) / 2;
				for (int j = 0; j < m; j++) {
					x[i][j] -= gx;
					y[i][j] -= gy;
				}
			}
			for (int i = 1; i <= n; i++) {
				if (x[0].length != x[i].length) continue;
				else if (equalPolygon(i))
					System.out.println(i);
			}
			System.out.println("+++++");
		}
	}
	
	boolean equalPolygon(int tgt) {
		for (int i = 0; i < 4; i++) {
			for (int j = 0; j < m; j++) {
				if ((x[0][j] == x[tgt][j] && y[0][j] == y[tgt][j]) ||
					(x[0][j] == x[tgt][m-j-1]) && (y[0][j] == y[tgt][m-j-1])) {
					if (j == m - 1) return true;
					continue;
				}
				else break;
			}
			for (int j = 0; j < m; j++) {
				int temp = x[tgt][j];
				x[tgt][j] = y[tgt][j];
				y[tgt][j] = -temp;
			}
		}
		return false;
	}
	
	public static void main(String[] args) {
		new Main();
	}
}

Measured memory_bytes: 29388
/**************************
  * Writer : Leo101
  * Problem : 
  * Tags : 
**************************/
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstring>
#define File(s) freopen(#s".in", "r", stdin); freopen(#s".out", "w", stdout)
#define gi get_int()
int get_int()
{
	int x = 0, y = 1; char ch = getchar();
	while ((ch < '0' || ch > '9') && ch != '-')
		ch = getchar();
	if (ch == '-') y = -1,ch = getchar();
	while (ch <= '9' && ch >= '0') {
		x = x * 10 + ch - '0';
		ch = getchar();
	}
	return x * y;
}

int main()
{
	int a = gi, b = gi, k = gi;
	int Lim = std :: min(a, b);
	
	for (int i = Lim; i >= 0; i--) {
		if (a % i ==0 && b % i == 0) k--;
		if (k == 0) {
			printf("%d", i);
			return 0;
		}
	}

	return 0;
}


Measured memory_bytes: 256
def main():
    n, height = getInputs()

    cost = [0] * n
    cost[1] = abs(height[0] - height[1])

    for i in range(2, n):
        cost[i] = min(
            cost[i - 1] + abs(height[i] - height[i - 1]),
            cost[i - 2] + abs(height[i] - height[i - 2])
        )

    print(cost[-1])

def getInputs():
    return int(input()), tuple(map(lambda x: int(x), input().split()))

main()


Measured memory_bytes: 87332
N=int(input())
a=list(map(int,input().split()))
flag=0
ans=1
for i in range(1,N):
  if flag== 0:
    if a[i]>a[i-1]:
      flag=1
      continue
    elif a[i]<a[i-1]:
      flag=-1
      continue
    else:
      continue
  elif flag>0:
    if a[i]<a[i-1]:
      ans+=1
      flag=0
  else:
    if a[i]>a[i-1]:
      ans+=1
      flag=0
print(ans)    

    

Measured memory_bytes: 14252
#include<iostream>
#include<vector>
#include<map>
#include<string>
#include<utility>
#include<algorithm>
#include<cstdio>
#include<iomanip>
#include<queue>
#define ll int64_t
#define REP(i, n) for (ll i=0; i<n; i++)
using namespace std;

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

    ll N;
    cin >> N;
    vector<vector<pair<ll, ll>>> graph(N, vector<pair<ll, ll>>());
    REP (i, N-1) {
        ll a, b, c;
        cin >> a >> b >> c;
        a--; b--;
        graph[a].push_back(make_pair(b, c));
        graph[b].push_back(make_pair(a, c));
    }
    ll Q, K;
    cin >> Q >> K;
    K--;

    // Dijkstra's algorithm
    const ll INF = 1000000000000000;
    vector<ll> dist(N, INF);
    dist[K] = 0;
    vector<ll> pre(N);
    vector<bool> done(N, false);
    priority_queue<pair<ll, ll>> pq;
    pq.push(make_pair(0, K));

    while (!pq.empty()) {
        pair<ll, ll> f = pq.top();
        pq.pop();
        ll u = f.second;

        if (dist[u] < f.first * -1) continue;

        for (auto e : graph[u]) {
            ll v = e.first;
            ll c = e.second;
            if (done[v]) continue;
            if (dist[u] + c < dist[v]) {
                dist[v] = dist[u] + c;
                pq.push(make_pair(dist[v]*-1, v));
            }
        }
    }

    // for (auto e : dist) {
    //     cout << e << "\n";
    // }

    REP (i, Q) {
        ll x, y;
        cin >> x >> y;
        x--; y--;
        cout << dist[x] + dist[y] << "\n";
    }
}

Measured memory_bytes: 13424
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <deque>
#include <fstream>
#include <functional>
#include <iostream>
#include <limits>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <vector>
using namespace std;
using ll = long long;
#define fst first
#define snd second

/* clang-format off */
template <class T, size_t D> struct _vec { using type = vector<typename _vec<T, D - 1>::type>; };
template <class T> struct _vec<T, 0> { using type = T; };
template <class T, size_t D> using vec = typename _vec<T, D>::type;
template <class T> vector<T> make_v(size_t size, const T& init) { return vector<T>(size, init); }
template <class... Ts> auto make_v(size_t size, Ts... rest) { return vector<decltype(make_v(rest...))>(size, make_v(rest...)); }
template <class T> inline void chmin(T &a, const T& b) { if (b < a) a = b; }
template <class T> inline void chmax(T &a, const T& b) { if (b > a) a = b; }
/* clang-format on */

struct Event {
  ll S, T, X;

  bool operator<(const Event& rhs) const {
    if (X != rhs.X) return X < rhs.X;
    return S < rhs.S;
  }
};

using Query = pair<ll, int>;

int main() {
#ifdef DEBUG
  ifstream ifs("in.txt");
  cin.rdbuf(ifs.rdbuf());
#endif
  int N, Q;
  while (cin >> N >> Q) {
    vector<ll> S(N), T(N), X(N);
    for (int i = 0; i < N; i++) cin >> S[i] >> T[i] >> X[i];
    vector<ll> D(Q);
    for (ll& x : D) cin >> x;
    vector<Event> events;
    for (int i = 0; i < N; i++) events.push_back({S[i] - X[i], T[i] - X[i], X[i]});
    sort(events.begin(), events.end());
    set<Query> queries;
    for (int i = 0; i < Q; i++) queries.emplace(D[i], i);
    vector<ll> res(Q, -1);
    for (auto& ev : events) {
      auto lb = queries.lower_bound({ev.S, 0});
      auto ub = queries.lower_bound({ev.T, 0});
      for (auto it = lb; it != ub; it++) res[it->snd] = ev.X;
      queries.erase(lb, ub);
    }
    for (ll x : res) cout << x << endl;
  }
  return 0;
}


Measured memory_bytes: 28012
#include<bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
#define lint long long
#define ll long long
#define pq priority_queue
#define mp make_pair
#define pb push_back
#define vl vector<long long>
#define pii pair<long long,long long>
#define all(x) (x).begin(),(x).end()
#define rep(x) for(int i = 0;i < (x);i++)
#define repj(x) for(int j = 0;j < (x);j++)
#define REP(i,x) for(int (i) = 0;(i) < (x);(i)++)
#define rrep(x) for(int i = (x);i >= 0;i--)
#define mod 1000000007
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
int qp(int a,ll b){int ans=1;do{if(b&1)ans=1ll*ans*a;a=1ll*a*a;}while(b>>=1);return ans;}
int qp(int a,ll b,int mo){int ans=1;do{if(b&1)ans=1ll*ans*a%mo;a=1ll*a*a%mo;}while(b>>=1);return ans;}
int gcd(int a,int b){return b?gcd(b,a%b):a;}
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
long long INF = 1e10;

int main(){
    int grid[3][3];
    rep(3) repj(3) cin >> grid[i][j];
    int ans = true;
    rep(2) ans &= (grid[i][1]-grid[i][0] == grid[i+1][1] - grid[i+1][0]);
    rep(2) ans &= (grid[i][2]-grid[i][1] == grid[i+1][2] - grid[i+1][1]);
    rep(2) ans &= (grid[1][i]-grid[0][i] == grid[1][i+1] - grid[0][i+1]);
    rep(2) ans &= (grid[2][i]-grid[1][i] == grid[2][i+1] - grid[1][i+1]);
    if(ans) cout << "Yes" << endl; else cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 256
import java.util.Arrays;
import java.util.Scanner;

public class Main {

    private static int frog1(int N, int K, int[] h) {
        // subproblem:
        // f(j) = cost when standing on stone j (0 <= j < N)
        // f(N-1)

        // f(0) = 0
        // f(j) = min:
        //        f(j-1) + abs(h[j], h[j-1])
        //        f(j-2) + abs(h[j], h[j-2])
        //        ...
        //        f(j-K) + abs(h[j], h[j-K])

        int[] dp = new int[N];
        Arrays.fill(dp, Integer.MAX_VALUE);
        dp[0] = 0;
        for (int j = 1; j < N; j++) {
            for (int i = Math.max(0, j-K); i < j; i++) {
                dp[j] = Math.min(dp[j], dp[i] + Math.abs(h[j] - h[i]));
            }
        }
        return dp[N-1];
    }

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int N = scanner.nextInt();
        int K = scanner.nextInt();
        int[] h = new int[N];
        for (int i = 0; i < N; i++) {
            h[i] = scanner.nextInt();
        }
        int res = frog1(N, K, h);
        System.out.println(res);
    }
}


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

using i64 = int64_t;

int main(){
    int n;
    cin >> n;
    vector<int> v;
    int neg = 0;
    for(int i=0;i<n;++i){
        int a;
        cin >> a;
        v.push_back(a);
        if(a < 0)neg++;
    }
    sort(v.begin(), v.end());
    if(neg == 0) neg++;
    else if(neg == n)neg--;
    vector<pair<int, int>> ans;
    for(int i=neg;i<n-1;++i){
        ans.emplace_back(v[0], v[i]);
        v[0] -= v[i];
    }
    for(int i=0;i<neg;++i){
        ans.emplace_back(v.back(), v[i]);
        v.back() -= v[i];
    }
    cout << v.back() << endl;
    for(auto e: ans){
        cout << e.first << " " << e.second << endl;
    }

    return 0;
}

Measured memory_bytes: 3188
#include <iostream>
#include <string>
#include <algorithm>
#include <cstdlib>
#include <cmath>
#include <vector>
#include <climits>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)

int main()
{
	int n, k;
	cin >> n >> k;
	vector<int> h(n);
	rep(i, n) cin >> h[i];

	vector<int> cost(n); //DPのための表
	cost[0] = 0;
	cost[1] = abs(h[1]-h[0]);

	for(int i = 2; i < n; i++){
		int j = 1;
		int temp = INT_MAX; 
		while(i-j >= 0 && j <= k){
			temp = min(temp, cost[i-j] + abs(h[i-j]-h[i]));
			j++;
		}

		cost[i] = temp;
		//cout << cost[i] << " ";
	}

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


Measured memory_bytes: 1024
from operator import mul
from functools import reduce

def ncr(n,r):
    r = min(n-r,r)
    if r == 0: return 1
    over = reduce(mul, range(n, n - r, -1))
    under = reduce(mul, range(1,r + 1))
    return over // under


n = int(input())
a = list(map(int, input().split()))

numList = [0] * (n+1)
numSet = set()

ncrList = [0] * (n+1)

resultList = [0] * (n+1)
resultSet = set()

for i in range(len(a)):
    numList[a[i]] += 1
    if(numList[a[i]]==2):
        numSet.add(a[i])

sums = 0
for i in numSet:
    ncrList[i] = ncr(numList[i], 2)
    sums += ncrList[i]

for i in range(len(a)):
    if(a[i] in resultSet):
        print(resultList[a[i]])
        continue
    s = sums
    if(a[i] in numSet):
        if(numList[a[i]] == 2):
            s -= 1
        else:
            s -= ncrList[a[i]]
            s += ncr(numList[a[i]]-1, 2)
    print(s)
    resultList[a[i]] = s
    resultSet.add(a[i])

    


Measured memory_bytes: 27460
#include <cstdio>
#include <algorithm>
int i,o,t,j,l,s,z,x;
long long r;
int main() {
  scanf("%d%d%d%d%d%d%d",&i,&o,&t,&j,&l,&s,&z);
  r+=o+(i/2)*2;
  r+=(l/2)*2+(j/2)*2;
  if (i>0 && j>0 & l>0) {
    x=i%2+j%2+l%2;
    if (x==2) r++; else if (x==3) r+=3;
  }
  printf("%lld\n",r);
  return 0;
}


Measured memory_bytes: 128
#include <iostream>

using namespace std;

int main(){
  char C[2][3];
  for(int i=0;i<2;i++){
    for(int j=0;j<3;j++){
      cin>>C[i][j];
    }
  }

  if((C[0][0]==C[1][2])&&(C[0][1]==C[1][1])&&(C[0][2]==C[1][0])){
    cout<<"YES"<<endl;
  }
  else cout<<"NO"<<endl;

  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using vi=vector<int>;
using vvi=vector<vi>;
using vs=vector<string>;
using msi=map<string,int>;
using mii=map<int,int>;
using pii=pair<int,int>;
using vlai=valarray<int>;
using ll=long long;
#define rep(i,n) for(int i=0;i<n;i++)
#define range(i,s,n) for(int i=s;i<n;i++)
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define fs first
#define sc second
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define INF 1e9
#define EPS 1e-9

int main(){
    int n;cin>>n;
    queue<int> q;
    rep(i,(1<<n)){
        int p;
        cin>>p;
        q.push(p);
    }
    while(q.size()!=1){
        int a=q.front(); q.pop();
        int b=q.front(); q.pop();
        if(a==b)q.push(a);
        else q.push(abs(a-b));
    }
    cout<<q.front()<<endl;
    return 0;
}


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

using namespace std;

using ints_t = vector<int>;

void process(ints_t &ints, int k) {
  sort(ints.begin(), ints.end(), ::less<int>());
  int sum = accumulate(ints.begin(), ints.begin() + k, 0);
  cout << sum << "\n";
}

int main() {
  int n, k;
  cin >> n >> k;
  ints_t ints;
  while(n--) {
    int i;
    cin >> i;
    ints.push_back(i);
  }

  process(ints, k);  
  
  return 0;
}

Measured memory_bytes: 3620
#include<bits/stdc++.h>
typedef long long ll;
using namespace std;
const int maxn=2e5+10;
const ll mod=20180623;
int s[maxn];
int main(){
    int n;
    cin>>n;
    for(int i=0;i<n;i++){
        cin>>s[i];
    }
    ll mx=s[0];
    ll res=0;
    for(int i=1;i<n;i++){
        if(s[i]<mx){
            res+=mx-s[i];
        }else{
            mx=s[i];
        }
    }
    cout<<res;
    return 0;
}


Measured memory_bytes: 4396
#include <bits/stdc++.h>
#define ll long long

using namespace std;

int main()
{
//    ios_base::sync_with_stdio(false);
//    cin.tie(0);
	ll n;
	cin >> n;
	if(n%2==0){
		cout << n/2 << endl;
	}
	else{
		cout << n/2+1 << endl;
	}
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <map>
#include <cmath>
#include <algorithm>
#define endl "\n"
using namespace std;

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

    if(x < 1200)
    	cout << "ABC" << endl;
    else
    	cout << "ARC" << endl;
}

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

int main() {
  int N;
  cin >> N;
  string S;
  int sum = 0;
  
  for(int i = 0 ; i < N ; i++) {
    cin >> S;
    if(S == "Y") {
      sum += 1;
    }
  }
  if(sum != 0) {
    cout << "Four" << endl;
  }
    else {
    cout << "Three" << endl;
    }
  
 }

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

 int main(){
     int i,sum=0,j;
     char W[11];
     char T[1001];
     scanf("%s",&W);

     for(i=0;;i++){
         scanf("%s",&T);
         if(strcmp(T,"END_OF_TEXT")==0)break;
         for(j=0;j<strlen(W);j++){
                  T[j]=tolower(T[j]);
                  }
         if(strcmp(W,T)==0)sum++;
         }  
     printf("%d\n",sum);
     return 0;
     }



Measured memory_bytes: 2096
#include <bits/stdc++.h>
        using namespace std;
        #define int long long
const int MAX = 510000;
const int MOD = 1000000007;
bool w[3][4001];
   map<string,int> mp;
        signed main() {
     string a,b,c;int ans=MOD,ans2;bool u;
     cin>>a>>b>>c;
     
     int A=a.size(),B=b.size(),C=c.size();
        for(int i=-A;i<=B;i++){
                u=true;
                for(int j=max(0ll,i);j<B&&j-i<A;j++){
                        if(b[j]!='?'&&a[j-i]!='?'&&b[j]!=a[j-i]){
                                u=false;
                                break;
                        }
                }
                w[0][A+i]=u;

        }
         for(int i=-B;i<=C;i++){
                u=true;
                for(int j=max(0ll,i);j<C&&j-i<B;j++){
                        if(c[j]!='?'&&b[j-i]!='?'&&c[j]!=b[j-i]){
                                u=false;
                                break;
                        }
                }
                w[1][B+i]=u;

        }
         for(int i=-C;i<=A;i++){
                u=true;
                for(int j=max(0ll,i);j<A&&j-i<C;j++){
                        if(a[j]!='?'&&c[j-i]!='?'&&a[j]!=c[j-i]){
                                u=false;
                                break;
                        }
                }
                w[2][C+i]=u;

        }
      for(int i=-4000;i<=4000;i++)for(int j=-4000;j<=4000;j++){
              if((i<-A||i>B||w[0][i+A])&&(j<-B||j>C||w[1][j+B])&&(-i-j<-C||-i-j>A||w[2][-i-j+C]))
              ans=min(ans,max(max(0ll,-i)+max(B,i+A),max(max(0ll,-j)+max(C,j+B),max(0ll,i+j)+max(A,-i-j+C))));
      }
     
   cout<<ans;
     
     
    

      
        


      }


        


Measured memory_bytes: 256
#include <cassert>
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
/*
//#if __cplusplus >= 201103L
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>
*/

// C++
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
/*
//#if __cplusplus >= 201103L
#include <array>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
*/
using namespace std;
#define fi first
#define se second
#define repl(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define rep(i,n) repl(i,0,n)
#define each(itr,v) for(auto itr:v)
#define pb(s) push_back(s)
#define mmax(x,y) (x>y?x:y)
#define mmin(x,y) (x<y?x:y)
#define maxch(x,y) x=mmax(x,y)
#define minch(x,y) x=mmin(x,y)
#define mp(a,b) make_pair(a,b)
#define all(x) (x).begin(),(x).end()
#define dbg(x) cout<<#x"="<<x<<endl

#define uni(x) x.erase(unique(all(x)),x.end())
template<class T,class U>inline void chmin(T &t,U f){if(t>f)t=f;}
template<class T,class U>inline void chmax(T &t,U f){if(t<f)t=f;}
#define MAX(a, b) ((a) > (b) ? (a) : (b))
#define MIN(a, b) ((a) > (b) ? (b) : (a))

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> P;
typedef pair<P, int> PPI;

#define INF INT_MAX/3
#define MAX_N 1000
#define M_INF 1000000000
int n,m,v,i;
void solve(){
   cin.tie(0);
  ios::sync_with_stdio(false);
  cin>>n;
  std::vector<ll> v(n);
  rep(i,n) cin>>v[i];
  ll flg = 0;
  ll prev_num = 0;
  ll ans = 0;
  rep(i,n){
    if(flg == 0) {
      if(prev_num == 0) prev_num = v[i];
      else {
        if(prev_num < v[i]) flg = 1;
        else if(prev_num > v[i]) flg = -1;
        prev_num = v[i];
      }
    } else {
      if((flg == 1 && prev_num > v[i]) || (flg == -1 && prev_num < v[i])) {
        ans++;
        flg = 0;
      }
        prev_num = v[i];
    }
  }
  ans++;
  cout<<ans<<endl;
}

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


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

#define REP(i, n) for(int64_t i = 0; i < n; i++)
#define REPR(i, n) for(int64_t i = n; i >= 0; i--)
#define FOR(i, m, n) for(int64_t i = m; i < n; i++)
#define FORR(i, m, n) for(int64_t i = m; i >= n; i--)
#define ALL(v) v.begin(), v.end()
typedef long long ll;
template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
    fill( (T*)array, (T*)(array+N), val );
}
template<class T>
inline bool chmax(T &a, T b) {if(a < b) {a = b;return true;}return false;}
template<class T>
inline bool chmin(T &a, T b) {if(a > b) {a = b;return true;}return false;}
const ll INF= 1ll << 60;
const ll MOD = 1000000007;
double EPS = 1e-10;
//----------------------------------------------------------

int N;

int main(){
    cin >> N;
    cout << setprecision(7) << (N%2==0 ? 0.5 : ((N+1)*0.5)/N) << endl;
    return 0;
}

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

using namespace std;

#define REP(i, n) for(int i = 0; i < (n); i++)
#define SREP(i, s) for(int i = 0; i < (s.size()); i++)
#define SORT(v, n) sort(v, v+n);
#define GSORT(v, n) sort(v, v+n, greater<int>());
#define VSORT(v) sort(v.begin(),v.end());
#define VGSORT(v) sort(v.begin(),v.end(),greater<int>());
#define REV(a) reverse(begin(a),end(a));

int main(){
	ios::sync_with_stdio(false);cin.tie(0);
//////////////////////////////////////////////
	int a,b;
	cin >> a >> b;
	cout << ((a*3)+b)/2 << endl;
	
//////////////////////////////////////////////
}


Measured memory_bytes: 256
n = input()
a = input()
b = input()
c = input()
n = int(n)
a = a.split()
a = [int(x) for x in a]
b = b.split()
b = [int(x) for x in b]
c = c.split()
c = [int(x) for x in c]
extrapoint = 0

for i in range(n-1):
    if (a[i]+1)==a[i+1]:
        extrapoint += c[a[i]-1]

output= sum(b) + extrapoint

print(output)


Measured memory_bytes: 3064
A, B = map(int, input().split())
ans = []

for i in range(1001):
    tax_eight = int(i * 0.08)
    tax_ten = int(i * 0.1)
    if A == tax_eight and B == tax_ten:
        ans.append(i)

if len(ans) == 0:
    print(-1)
else:
    print(min(ans))

Measured memory_bytes: 3060
#include<bits/stdc++.h>
#define ll long long

using namespace std;

int main()
{
	ll n ;
	scanf("%lld",&n);
	map <ll , ll > cnt;
	vector<ll>v;
	v.push_back(0);
	for(int i = 0; i  < n ; i++)
	{
		ll input;
		scanf("%lld",&input);
		v.push_back(input);
	}
		sort(v.begin(),v.end());
	ll ans = 1e9;
	for(int i = 0;  i < v.size() ; i++)
	{
		if(i%2 == 0)
		{
			v[i] = 24-v[i];
		}
		if(v[i] == 24)
		{
			v[i] = 0;
		}
	}
	sort(v.begin(),v.end());
	for(int i = 0 ; i <v.size()-1 ; i++)
	{
		ans = min(abs(v[i]-v[i+1]) , ans);
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 256
import bisect


N,M,K=map(int,input().split())
a=list(map(int,input().split()))
b=list(map(int,input().split()))

# print(K)
# print(a)
# print(b)
# N,M=3,4
# K=240
# a=[60, 90, 120]
# b=[80, 150, 80, 150]

ans=0

accum_a=[0]
for i in a:
    _a=accum_a[-1]+i
    if _a>K:
        break
    else:
        accum_a.append(_a)
accum_a.append(K)

accum_b=[0]
for i in b:
    accum_b.append(accum_b[-1]+i)

ans=0

for j in range (len(accum_a)-1):
    Kb=K-accum_a[j]
    bookB=bisect.bisect_right(accum_b,Kb)-1
    if j+bookB>ans:
        ans=j+bookB
    else:
        pass

print(ans)


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

using namespace std;

using ll = long long;

inline ll Dist(ll a, ll b, ll c, ll d) { return abs(a - c) + abs(b - d); }

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

    int n, m;
    cin >> n >> m;
    vector<ll> a(n), b(n), c(m), d(m);
    for (int i = 0; i < n; ++i) cin >> a[i] >> b[i];
    for (int j = 0; j < m; ++j) cin >> c[j] >> d[j];

    for (int i = 0; i < n; ++i) {
        int idx = -1;
        for (int j = 0; j < m; ++j) {
            if (idx == -1 || Dist(a[i], b[i], c[idx], d[idx])
                > Dist(a[i], b[i], c[j], d[j]))
                idx = j;
        }
        cout << idx + 1 << endl;
    }

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
typedef long long int lint;
using namespace std;
int main(){
    lint N;
    cin >> N;
    lint T,A;
    cin >> T >> A;
    double* H = new double[N];
    for(lint i = 0;i < N;i++){
        cin >> H[i];
        H[i] = (double)(1.0*T-H[i]*0.006);
    }
    double min = (double)abs((1.0*A-H[0]));
    lint t = 0;
    for(lint i = 0;i < N;i++){
        if(min > abs(1.0*A-H[i])){
            min = abs(1.0*A-H[i]);
            t = i;
        }
    }
    cout << t+1;
    return 0;
}

Measured memory_bytes: 256
n = int(input())
a,b = map(int,input().split())
P = list(map(int,input().split()))
q1 = 0
q2 = 0
q3 = 0
for p in P:
  if p <= a:
    q1 += 1
  elif a < p <= b:
    q2 += 1
  else:
    q3 += 1
print(min(q1,q2,q3))

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

// template {{{  0 
// using {{{ 1
using ll = long long int;
using pii = pair<int,int>;
using pll = pair<ll,ll>;
using vi = vector<int>;
using vl = vector<ll>;
using vii = vector<pii>;
using vll = vector<pll>;
// }}} 1
// definition {{{ 1
// scaning {{{ 2
#define Scd(x) scanf("%d", &x)
#define Scd2(x,y) scanf("%d%d", &x, &y)
#define Scd3(x,y,z) scanf("%d%d%d", &x, &y, &z)
#define Scll(x) scanf("%lld", &x)
#define Scll2(x,y) scanf("%lld%lld", &x, &y)
#define Scll3(x,y,z) scanf("%lld%lld%lld", &x, &y, &z)
#define Scc(c) scanf("%c", &c);
#define Scs(s) scanf("%s", s);
#define Scstr(s) scanf("%s", &s);
// }}} 2
// constants {{{ 2
#define EPS (1e-7)
#define INF (2e9)
#define PI (acos(-1))
// }}} 2
// systems {{{ 2
#define Repe(x,y,z) for(ll x = z; x < y; x++)
#define Rep(x,y) Repe(x,y,0)
#define RRepe(x,y,z) for(ll x = y-z-1; x >= 0; x--)
#define RRep(x,y) RRepe(x,y,0)
// }}} 2
// output {{{ 2
#define YesNo(a) (a)?printf("Yes\n"):printf("No\n")
#define YESNO(a) (a)?printf("YES\n"):printf("NO\n")
// }}} 2
// }}} 1
// input {{{ 1
// }}} 1
// }}} 0

int main() {

    int N;
    Scd(N);

    printf ("%.19f\n", 1.0 / N * ((N+1)/2) );

    return 0;
}





Measured memory_bytes: 256
import collections
H, W = map(int, input().split())
S = [list(input()) for i in range(H)]

remaining = set()
for i in range(H):
    for j in range(W):
        remaining.add((i, j))

q = collections.deque()
ans = 0
while(remaining):
    i, j = remaining.pop()
    q.append((i, j))
    black = 0
    white = 0
    while(q):
        y, x = q.popleft()
        if S[y][x] == "#":
            black += 1
        else:
            white += 1

        if (y-1, x) in remaining and S[y][x] != S[y-1][x]:
            remaining.remove((y-1, x))
            q.append((y-1, x))
        if (y, x-1) in remaining and S[y][x] != S[y][x-1]:
            remaining.remove((y, x-1))
            q.append((y, x-1))
        if (y+1, x) in remaining and S[y][x] != S[y+1][x]:
            remaining.remove((y+1, x))
            q.append((y+1, x))
        if (y, x+1) in remaining and S[y][x] != S[y][x+1]:
            remaining.remove((y, x+1))
            q.append((y, x+1))
    ans += black * white
print(ans)


Measured memory_bytes: 20968
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] h = new int[n];
        for(int i = 0; i < n; i++) {
        	h[i] = sc.nextInt();
        }

        System.out.println(solve(n,h)[n-1]);

    }



	private static int[] solve(int n, int[] h) {
		int[] dp = new int[n];

		dp[0] = 0;
		dp[1] = Math.abs(h[0] - h[1]);
		for(int i = 2; i < n; i++)
			dp[i] = Math.min(dp[i-1]+Math.abs(h[i-1]-h[i]), dp[i-2]+Math.abs(h[i-2]-h[i]));

		return dp;

	}
}

Measured memory_bytes: 48868
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vll = vector<ll>;
#define all(x) (x).begin(), (x).end()
#define fsp(x) fixed << setprecision(x)
//const ll p = 1e9 + 7;
//const ll p = 998244353;
const ll inf = LLONG_MAX;
const long double pi = acos(-1);
void Yes() {cout << "Yes" << endl;}
void No() {cout << "No" << endl;}
void YES() {cout << "YES" << endl;}
void NO() {cout << "NO" << endl;}

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

	ll n;
	cin >> n;
	set<string> st;
	for (ll i = 0; i < n; i++) {
		string s;
		cin >> s;
		st.insert(s);
	}
	cout << st.size() << endl;
}


Measured memory_bytes: 19224
#include <iostream>
#include <cstdio>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <iomanip>
#include <stdlib.h>
#include <string.h>
#include <cstring>
#include <cmath>
#include <map>
#include <queue>
#include <deque>
#include <stack>
#include <set>
#include <stdio.h>
#include <tuple>
#include <bitset>
#include <cfloat>
#include <fstream>
#include <limits.h>
#include <list>
#include <math.h>
#include <random>
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#include <numeric>
#include <utility>
#include <sstream>

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

using namespace std;
#define ll long long
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
#define FORR(i,a,b)for(ll i=(a);i<=(b);i++)
#define repR(i,n) for(ll i=n;i>=0;i--)
#define P pair<ll, ll>
#define sz(x) (ll)x.size()
#define ALL(x) (x).begin(),(x).end()
#define ALLR(x) (x).rbegin(),(x).rend()
#define VE vector<ll>
#define COUT(x) cout<<(x)<<endl
#define MA map<ll,ll>
#define SE set<ll>
#define PQ priority_queue<ll>
#define PQR priority_queue<ll,VE,greater<ll>>
#define COUT(x) cout<<(x)<<endl
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define EPS (1e-10)
ll gcd(ll a, ll b) {
	if (a < b)swap(a, b);
	if (b == 0) return a;
	return gcd(b, a % b);
}
ll lcm(ll a, ll b) {
	ll g = gcd(a, b);
	return a / g * b;
}
bool prime(ll n) {
	for (ll i = 2; i <= sqrt(n); i++) {
		if (n%i == 0)return false;
	}
	return n != 1;
}


const long long MOD = 1000000007;
const long long INF = 1LL << 60;
#define int long long

const int MAX_N = 1010;


signed main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	int n; cin >> n;
	VE t(n); rep(i, n)cin >> t[i];
	int tmp = t[0];
	rep(i, n) {
		tmp = lcm(tmp, t[i]);
	}
	cout << tmp << endl;
	return 0;
}


Measured memory_bytes: 256