akhauriyash/Code-Regression huggingface dataset:
#define _CRT_SECURE_NO_WARNINGS
#include<bits/stdc++.h>
using namespace std;
#ifndef FAST_IO
 #define IOS ios_base::sync_with_stdio(false);cin.tie(nullptr);
#endif

#define FILE_IO freopen("input.txt","r",stdin)
#define int long long
#define f first
#define s second
#define endl '\n'
#define all(c) c.begin(),c.end()
#define bp __builtin_popcount
#define debug(x) cerr << #x << " = " << x << endl;

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

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
template <typename T>void print(T t){for(auto &it : t)cout<<it<<" ";}
inline int powerexp(int a, int b, int m = MOD){ int res = 1;while(b){if(b&1)res = res * a % m;a = a * a % m,b >>= 1;}return res % m;}
inline int modinv(int a){ return powerexp(a,MOD-2,MOD);}
inline int lcm(int a, int b){ int g = __gcd(a,b);return a/g*b;}
inline int add(int x, int y){ x += y; if (x >= MOD) x -=  MOD; return x;}
inline int mul(int x, int y){ return (x * 1ll * y) % MOD;}
inline int sub(int x, int y){ x -= y; if (x<0) x += MOD; return x ;}

//-------------------< start here >-------------------------// 

void solve(){
   int n;
   cin >> n;
   while(n--){
	 double x[4], y[4];
	 for(int i = 0; i < 4; i++){
		  cin >> x[i] >> y[i]; 
		}
	 if (fabs((x[3] - x[2]) * (y[1] - y[0]) - (x[1] - x[0]) * (y[3] - y[2])) < 1e-10){
		  cout << "YES" << endl;
		}
	 else cout << "NO" << endl; 
	 }
}

//-----------------------------
//comment from here for TOPCODER 
int32_t main(){
   IOS;
   solve();
   //find();
   #ifdef LOCAL_DEFINE
   cerr << "time elapsed " << (double)clock()/CLOCKS_PER_SEC << endl;
   #endif
}



Measured memory_bytes: 3040
main(V,d){
	for(;~scanf("%d%d",&V,&d);){
		int f[1001]={0},a=1,b=1,c;
		for(;V--;){
			c=a+b;
			f[c%=1001]=1;
			a=b;
			b=c;
		}
		c=-1e4;
		b=0;
		for(a=0;a<1001;a++){
			if(++c==d)
				b++;
			if(f[a]==1)
				c=0;
		}
		if(c<d)
			b++;
		printf("%d\n",b);
	}
}

Measured memory_bytes: 0
#include "bits/stdc++.h"
#define int long long
#define range(i, a, b) for(auto i = a; i < b; i++)
#define rep(i, a) range(i, 0, a)
#define all(a) (a).begin(),(a).end()
using namespace std;
const int INF = sizeof(int) == sizeof(long long) ? 1000000000000000000LL : 1000000000;
const int MOD = 1000000007;
const long double EPS = 1e-8;
using vi = vector <int>;
using vvi = vector <vi>;

signed main() {
	int c[3][3];
	rep (i, 3) rep (j, 3) cin >> c[i][j];
	rep (a1, c[0][0] + 1) {
		int b1 = c[0][0] - a1;
		rep (a2, c[1][1] + 1) {
			int b2 = c[1][1] - a2;
			rep (a3, c[2][2] + 1) {
				int b3 = c[2][2] - a3;
				if (a1 + b2 == c[0][1] && a1 + b3 == c[0][2]
				 && a2 + b1 == c[1][0] && a2 + b3 == c[1][2]
				 && a3 + b1 == c[2][0] && a3 + b2 == c[2][1]) {
					cout << "Yes" << endl;
					return 0;
				}
			}
		}
	}
	cout << "No" << endl;
	return 0;
}

Measured memory_bytes: 256
n = int(input())

cands = set()

def dfs(n, c3, c5, c7):
    if c3 >= 1 and c5 >= 1 and c7 >= 1:
        cands.add(n)
    if n >= 10 ** 9:
        return
    dfs(n * 10 + 3, c3 + 1, c5, c7)
    dfs(n * 10 + 5, c3, c5 + 1, c7)
    dfs(n * 10 + 7, c3, c5, c7 + 1)

dfs(0, 0, 0, 0)
print(len([c for c in cands if c <= n]))

Measured memory_bytes: 18368
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int n= Integer.parseInt(sc.next());
		String s = sc.next();
		int k = Integer.parseInt(sc.next());
      	for(int i = 0; i < n; i++){
      		if(s.charAt(i) != s.charAt(k-1)){
      			System.out.print("*");
      		}else {
      			System.out.print(s.charAt(i));
      		}
			}
	}
	
}

Measured memory_bytes: 35592
#include<stdio.h>
int main(void) {
	int a=0;
	scanf("%d", &a);
	int b = 0;
	int c = 0;
	int d = 0;
	scanf("%d %d", &b, &c);
	for (int i = b; i <= c; i++) {
		if (i % a == 0)
			d = 1;
	}
	if (d == 1)
		printf("OK");
	else
		printf("NG");
}

Measured memory_bytes: 1736
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
typedef long long ll;
const ll MOD = 1e9+7;
/*int dfs(vector<int> &T, vector<int> &C, int i, int sum, int g, int count){
   
}*/

int main(){
  int n, i, j;
  cin >> n;
  vector<int> D(n);
  rep(i, n) cin >> D[i];
  int sum = 0;
  rep(i, n-1){
    for(j=i+1; j<n; j++){
      sum+=D[i]*D[j];
    }
  }
  cout << sum << endl;  
}



Measured memory_bytes: 256
#include<stdio.h>
#include<string.h>
int main(){
    char s[10];
    scanf("%s",s);
    if(strcmp(s,"SUN") ==0 ){
        printf("7\n");
    }
    else if(strcmp(s,"MON") ==0){
        printf("6\n");
    }
    else if(strcmp(s,"TUE") ==0){
        printf("5\n");
    }    
    else if(strcmp(s,"WED") ==0){
        printf("4\n");
    }    
    else if(strcmp(s,"THU") ==0){
        printf("3\n");
    }    
    else if(strcmp(s,"FRI") ==0){
        printf("2\n");
    }
    else if(strcmp(s,"SAT") ==0){
        printf("1\n");
    }    
    return 0;
}

Measured memory_bytes: 128
using System.Linq;
using System;

public class Hello
{
    public static void Main()
    {
        string[] line = Console.ReadLine().Trim().Split(' ');
        var n = int.Parse(line[0]);
        var x = int.Parse(line[1]);
        var a = new int[n];
        for (int i = 0; i < n; i++) a[i] = int.Parse(Console.ReadLine().Trim());
        var t = a.Sum();
        var m = a.Min();
        var ret = (x - t) / m + n;
        Console.WriteLine(ret);
    }
}

Measured memory_bytes: 13268
#include<bits/stdc++.h>
using namespace std;
template <class A, class B> inline bool chmax(A &a, const B &b) { return b > a && (a = b, true); }
template <class A, class B> inline bool chmin(A &a, const B &b) { return b < a && (a = b, true); }
typedef long long ll;
typedef vector<int> vint;
typedef pair<int, int> pint;
typedef vector<long long> vlong;
typedef vector<string> vstring;
#define _GLIBCXX_DEBUG
#define vpush(a,x) a.push_back(x);
#define rep(i, n) REP(i, 0, n)
#define all(v) v.begin(), v.end()
#define REP(i, x, n) for(int i = x; i < n; i++)
const int INF = 1 << 30;
const int dx[] = {1,0,-1,0,1,1,-1,-1};
const int dy[] = {0,-1,0,1,1,-1,-1,1};
#define stp(x)  setprecision(x)
int main(){
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  ll l,r;
  cin>>l>>r;
  if((l-1)/2019 != (r-1)/2019)
    {
      cout<<0;
      return 0;
    
    }
  else
    {
      l=l%2019,r=r%2019;
      ll ans=2018;
      for(ll i=l;i<=r;i++)
        {
          for(ll j=i+1;j<=r;j++)
            ans=min(ans,(i*j)%2019);
        
        }
      cout<<ans;
    
    }
  return(0);
}


Measured memory_bytes: 256
#include <iostream>
#include <queue>
#include <algorithm>
using namespace std;
class FC{
public:
    int p[31];
    int n;
    bool is_over(){
        return p[1]==p[2]&&p[2]==p[3]&&p[3]==p[4]&&p[4]==p[5]&&
            p[5]==p[6]&&p[6]==p[7]&&p[7]==p[8]&&p[8]==p[9]&&
            p[10]==p[11]&&p[11]==p[12]&&
            p[13]==p[14]&&p[14]==p[15]&&
            p[16]==p[17]&&p[17]==p[18]&&
            p[19]==p[20]&&p[20]==p[21]&&
            p[22]==p[23]&&p[23]==p[24]&&p[24]==p[25]&&p[25]==p[26]&&
            p[26]==p[27]&&p[27]==p[28]&&p[28]==p[29]&&p[29]==p[30];
    }
    void rot1(){
        swap(p[7],p[22]);
        swap(p[8],p[23]);
        swap(p[9],p[24]);
        swap(p[13],p[18]);
        swap(p[10],p[12]);
    }
    void rot2(){
        swap(p[1],p[28]);
        swap(p[2],p[29]);
        swap(p[3],p[30]);
        swap(p[15],p[16]);
        swap(p[19],p[21]);
    }
    void rot3(){
        swap(p[1],p[24]);
        swap(p[4],p[27]);
        swap(p[7],p[30]);
        swap(p[10],p[21]);
        swap(p[16],p[18]);
    }
    void rot4(){
        swap(p[3],p[22]);
        swap(p[6],p[25]);
        swap(p[9],p[28]);
        swap(p[12],p[19]);
        swap(p[13],p[15]);
    }
};
int main(){
    int N;
    cin>>N;
    for(int i=0; i<N; i++){
        FC now;
        for(int j=1; j<=30; j++){
            cin>>now.p[j];
        }
        now.n=0;

        queue<FC> que;
        que.push(now);
        while(!que.empty()){
            now=que.front();
            que.pop();
            if(now.is_over()){
                cout<<now.n<<endl;
                break;
            }
            FC nex1=now; nex1.rot1(); nex1.n++; que.push(nex1);
            FC nex2=now; nex2.rot2(); nex2.n++; que.push(nex2);
            FC nex3=now; nex3.rot3(); nex3.n++; que.push(nex3);
            FC nex4=now; nex4.rot4(); nex4.n++; que.push(nex4);
        }
    }
    return 0;
}



Measured memory_bytes: 13972
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        int a = 0;
        int b = 0;
        Scanner sc = new Scanner(System.in);
        while (true) {
        int H = sc.nextInt();
        int W= sc.nextInt();
        if (H == 0 && W == 0) {
        break;
        }
        // 二重ループ(forの中にfor)を書いて、. と # を交互に表示しよう！
        for(int i=0;i<H;i++){
            for(int j=0;j<W;j++){
                if(a==0){
                    System.out.print("#");
                    a = 1;
                }else{
                    System.out.print(".");
                    a = 0;
                }
            }
            System.out.println();
            if(b==0){
                a=1;
                b=1;
            }else{
                a=0;
                b=0;
            }
        }
        System.out.println();
        a = 0;
        b=0;
        }


        
        sc.close();
        }
}


Measured memory_bytes: 34072
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,k,n) for(int i = (int)(k); i < (int)(n); i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(a) a.begin(), a.end()
#define MS(m,v) memset(m,v,sizeof(m))
typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<string> vs;
typedef pair<int, int> pii;
const int MOD = 1000000007;
const int INF = MOD + 1;
const ld EPS = 1e-12;
template<class T> T &chmin(T &a, const T &b) { return a = min(a, b); }
template<class T> T &chmax(T &a, const T &b) { return a = max(a, b); }

/*--------------------template--------------------*/
typedef pair<ld, ld> Point;

template<class T>
void compress(vector<T> v, map<T, int>& zip, vector<T>& unzip)
{
	sort(ALL(v));
	v.erase(unique(ALL(v)), v.end());
	unzip.resize(v.size());
	REP(i, v.size())
	{
		zip[v[i]] = i;
		unzip[i] = v[i];
	}
}


int main()
{
	cin.sync_with_stdio(false); cout << fixed << setprecision(2);
	int n;
	for (int cs = 1; cin >> n, n; cs++)
	{
		vector<pair<Point, ld>> v;
		vector<ld> x, y;
		REP(i, n)
		{
			ld tx, ty, rad; cin >> tx >> ty >> rad;
			ld lx, dy, rx, uy;
			lx = tx - rad, rx = tx + rad;
			dy = ty - rad, uy = ty + rad;
			v.emplace_back(Point(tx, ty), rad);
			x.emplace_back(lx);
			x.emplace_back(rx);
			y.emplace_back(dy);
			y.emplace_back(uy);
		}
		map<ld, int> x_zip, y_zip;
		vector<ld> x_unzip, y_unzip;
		compress(x, x_zip, x_unzip);
		compress(y, y_zip, y_unzip);
		bool fld[500][500] = {};
		for (auto i : v)
		{
			ld tx, ty, rad;
			tx = i.first.first, ty = i.first.second;
			rad = i.second;
			ld lx, dy, rx, uy;
			lx = tx - rad, rx = tx + rad;
			dy = ty - rad, uy = ty + rad;
			FOR(j, x_zip[lx], x_zip[rx])FOR(k, y_zip[dy], y_zip[uy])
			{
				fld[j][k] = true;
			}
		}
		ld ans = 0;
		REP(i, 500)REP(j, 500)
		{
			if (!fld[i][j]) continue;
			ld lx, dy, rx, uy;
			lx = x_unzip[i], rx = x_unzip[i + 1];
			dy = y_unzip[j], uy = y_unzip[j + 1];
			ans += (rx - lx) * (uy - dy);
		}
		cout << cs << " " << ans << endl;
	}
	return 0;
}

Measured memory_bytes: 3424
#include <cstdio>
#include <algorithm>
#include <vector>
using namespace std;

typedef long long ll;
typedef pair<ll, ll> P;
const ll INF = 100000000000000;
ll dan(P p1, P p2){ return (p1.second + p2.second) * abs(p2.first - p1.first); }
int main(){
	ll n, m;
	while(true){
		scanf("%lld %lld", &n, &m);
		if(n == 0) break;
		vector<P> a[n + 1];
		ll dp[n + 1][10][m + 1];
		//初期化
		for(int i = 0; i <= n; i++)
			for(int j = 0; j < 10; j++)
				for(int k = 0; k < m + 2; k++)
					dp[i][j][k] = (i==0 || i==1)?0:INF;
		for(int i = 1; i <= n; i++){
			int ki;
			scanf("%d", &ki);
			for(int j = 0; j < ki; j++){
				ll x, d;
				scanf("%lld %lld", &x, &d);
				a[i].push_back(P(x, d));
			}
		}
		for(int i = 2; i <= n; i++){
			for(int j = 0; j < a[i].size(); j++){
				for(int k = m; k >= 0; k--){
					ll t = INF;
					for(int l = 0; l < a[i-1].size(); l++)
						t = min(t, dan(a[i-1][l], a[i][j]) + dp[i-1][l][k]);
					if(k < m){
						if(i == 2)t = 0;
						for(int l = 0; l < a[i-2].size(); l++){
							t = min(t, dan(a[i-2][l], a[i][j]) + dp[i-2][l][k + 1]);
						}
						t = min(t, dp[i][j][k + 1]);
					}
					dp[i][j][k] = t;
				}
			}
		}

		ll ans = INF;
		for(int j = 0; j < a[n].size(); j++)
			ans = min(ans, dp[n][j][0]);
		if(m >= 1)
		for(int j = 0; j < a[n-1].size(); j++)
			ans = min(ans, dp[n-1][j][1]);
		printf("%lld\n", ans);
	}
	return 0;
}

Measured memory_bytes: 1976
#include <algorithm>
#include <cstdio>
#include <iostream>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <stack>
#include <vector>
using namespace std;
typedef long long int ll;
typedef long double ld;
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define Sort(Array) sort(Array.begin(), Array.end())
#define Reverse(a) reverse(a.begin(), a.end())
#define out(ans) cout << ans << endl;
const int MOD = 1000000007;
const int INF = 2147483647;

//------------↓------------- M -------------- E ---------------- M --------------- O ---------------↓--------------//
// コンパイル 
// g++ -std=c++1z
//
// -------型変換--------
// int を string に変換
// string s = to_string(n);
// string を int に変換
// int n = stoi(s);
//
// -------二分探索---------
// k以上の値が最初に現れる時のイテレータ
// lower_bound(data.begin(), data.end(), k)
// kより大きい値が最初の現れる時のイテレータ O(logN)
// upper_bound(data.begin(), data.end(), k)
// kがdataに存在するかをtrue or falseで返す O(logN)
// binary_search(data.begin(), data.end(), k)
// 
//
//
//
//
//
// 
//------------↑------------- M -------------- E ---------------- M --------------- O ---------------↑--------------//


int main(void) {

    
    ll N, M; cin >> N >> M;
    ll ans;
    if (2 * N > M) {
        ans = M / 2;
    }
    else {
        ans = N + (M - 2 * N) / 4;
    }
    out(ans);




    


    return 0;
}











Measured memory_bytes: 256
use std::collections::BTreeMap;

const INF: u64 = 1 << 60;

fn main() {
    let s = std::io::stdin();
    let mut sc = Scanner(s.lock());
    let n: usize = sc.read();
    let k: usize = sc.read();
    let h: Vec<u64> = sc.vec(n);

    let mut dp = BTreeMap::new();
    dp.insert((0, 0), 0);
    for next_height in h.into_iter() {
        let mut next = BTreeMap::new();
        for ((cur_height, cur_k), cost) in dp.into_iter() {
            if cur_k < k {
                let cur = next.entry((cur_height, cur_k + 1)).or_insert(INF);
                if *cur > cost {
                    *cur = cost;
                }
            }
            if cur_height < next_height {
                let cost = cost + next_height - cur_height;
                let cur = next.entry((next_height, cur_k)).or_insert(INF);
                if *cur > cost {
                    *cur = cost;
                }
            } else if cur_height >= next_height {
                let cur = next.entry((next_height, cur_k)).or_insert(INF);
                if *cur > cost {
                    *cur = cost;
                }
            }
        }
        dp = next;
    }

    let ans = *dp.values().min().unwrap();
    println!("{}", ans);
}

pub struct Scanner<R>(R);

impl<R: std::io::Read> Scanner<R> {
    pub fn read<T: std::str::FromStr>(&mut self) -> T {
        use std::io::Read;
        let buf = self
            .0
            .by_ref()
            .bytes()
            .map(|b| b.unwrap())
            .skip_while(|&b| b == b' ' || b == b'\n')
            .take_while(|&b| b != b' ' && b != b'\n')
            .collect::<Vec<_>>();
        unsafe { std::str::from_utf8_unchecked(&buf) }
            .parse()
            .ok()
            .expect("Parse error.")
    }
    pub fn vec<T: std::str::FromStr>(&mut self, n: usize) -> Vec<T> {
        (0..n).map(|_| self.read()).collect()
    }
    pub fn chars(&mut self) -> Vec<char> {
        self.read::<String>().chars().collect()
    }
}


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

int h,w,k;
bool isApplied(vector<vector<char>> garden) {
  int cnt = 0;
  for (int i=0; i<h; i++) {
    for (int j=0; j<w; j++) {
      if (garden[i][j] == '#') {
        cnt++;
      }
    }
  }
  if (cnt == k) {
    return true;
  }
  return false;
}

int main() {
  cin >> h>>w>>k;
  vector<vector<char>> garden;

  for (int i=0; i<h; i++) {
    vector<char> V;
    for (int j=0; j<w; j++) {
      char a;
      cin >> a;
      V.push_back(a);
    }
    garden.push_back(V);
  }

  int ans = 0;

  for (int i=0; i < (1 << h); i++) {
    for (int j=0; j < (1 << w); j++) {
      vector<vector<char>> garden2 = garden;
      for (int y=0; y < h; y++) {
        if (i & (1<<y)) {
          // yoko ichiretu umeru
          for (int yoko=0; yoko<w;yoko++){
            garden2[y][yoko] = '.';
          }
        }
      }
      for (int x=0; x < w; x++) {
        if (j & (1 << x)) {
          for (int tate=0; tate<h;tate++) {
            garden2[tate][x] = '.';
          }
        }
      }
      if (isApplied(garden2)) {
        ans++;
      }
    }
  }

  cout << ans << endl;
}


Measured memory_bytes: 3628
#include <iostream>

#include <stack>
#include <queue>
#include <deque>
#include <vector>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>

#include <cmath>
#include <algorithm>

#include <fstream>

using namespace std;


const long long INF = 1e9;
using LD = long double;
using LL = long long;



int main()
{
    //ifstream cin ("/Users/Roman/ClionProjects/Calculations/input.txt");
    //ofstream cout ("/Users/Roman/ClionProjects/Calculations/output.txt");

    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);

    cout.setf(ios_base::fixed);
    cout.precision(10);
    srand(179);
    LL n;

    //cout << maxn << endl;
    cin >> n;
    LL ans = 0;
    LL last, first;
    cin >> first;
    last = first;
    vector < int > res;
    ans += first;
    for (int i = 1; i < n; ++i) {
        int a;
        cin >> a;
        res.push_back(a - last);
        last = a;
        ans += a;
    }
    res.push_back(first - last);
    LL del  = (n * (n + 1)) / 2;
    if (ans % del != 0) {
        cout << "NO\n";
        return 0;
    }
    LL k = ans /del;
    LL cnt1 = 0, cntn = 0;
    for (int i = 0; i < n; ++i) {
        //cout << res[i] << " ";
        if ((k - res[i]) % n != 0) {
            cout << "NO\n";
            return 0;
        } else {
            LL x = (k - res[i]) / n;
            LL y = k - x;
            if (x < 0 || y < 0) {
                cout << "NO\n";
                return 0;
            }
            cntn += x;
            cnt1 += y;
        }
    }
    //cout << cntn << " " << cnt1 << endl;
    if (cntn != k && cnt1 != (n - 1) * k) {
        cout << "NO\n";
        return 0;
    }
    cout << "YES";
    return 0;
}

Measured memory_bytes: 1524
#include<iostream>
#include<algorithm>
#include<vector>
#include<numeric>
#include<string>
#include<cmath>
#include<set>
#include<queue>
#include<deque>
#include<bitset>
#include<iomanip>
#include<cctype>
#include<map>

#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define rep2(i,a,b) for (int (i)=a;(i)<(b);(i)++)
#define all(x) (x).begin(),(x).end()

using namespace std;
const int inf = 1001001000;
const long long int Inf = 1001001001001001000;

void print(vector<vector<int>> a){
	for (int i=0;i<a.size();i++){
		for (int j=0;j<a[i].size();j++){
			cout << a[i][j] << " ";
		}
		cout << endl;
	}
}

void print(vector<vector<long long int>> a){
	for (int i=0;i<a.size();i++){
		for (int j=0;j<a[i].size();j++){
			cout << a[i][j] << " ";
		}
		cout << endl;
	}
}

void print(vector<int> a){
    int n = a.size();
    for (int j=0;j<n;j++) {
        if (j != n-1) cout << a[j] << " ";
        else cout << a[j] << endl;
    }
}

//最大公約数を返す関数.
long long int gcd(long long int x, long long int y){
    if (x < y) swap(x,y);
    while (y > 0){
        long long int r = x % y;
        x = y;
        y = r;
    }
    return x;
}
//最小公倍数を返す関数.gcdが必要.
long long int lcm(long long int x, long long int y){
    return x * y / gcd(x,y);
}


int main(){
	int n;
	cin >> n;
	int l = 1;
	rep(i, n){
		int a;
		cin >> a;
		l = lcm(l, a);
	}
	cout << l << endl;

	return 0;
}




Measured memory_bytes: 3096
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < n; i++)
#define repp(i, n, m) for (int i = (int)(n); i < (int)(m); i++)
#define rrep(i, n, m) for (int i = n; i >= m; i--)
#define ALL(a) (a).begin(), (a).end()
#define p(a, b) printf(a, b);
#define c(s) cout << (s) << endl;
#define yes cout << "Yes" << endl;
#define no cout << "No" << endl;
#define YES cout << "YES" << endl;
#define NO cout << "NO" << endl;
#define cyn(c) cout << (c ? "Yes" : "No") << endl;
#define cYN(c) cout << (c ? "YES" : "NO") << endl;
#define pyn(c) printf("%s\n", c ? "Yes" : "No");
#define pYN(c) printf("%s\n", c ? "YES" : "NO");
#define INF 1e18
typedef long long LL;
typedef unsigned long long ULL;
typedef pair<LL, LL> P;
template <class T>
bool contain(const std::string &s, const T &v)
{
  return s.find(v) != std::string::npos;
}
ULL mod = 1e9 + 7;

int main(){
    int a[2]={},ans=0; cin>>a[0]>>a[1];
    sort(a,a+2);
    ans+=a[1];
    a[1]--;
    sort(a,a+2);
    ans+=a[1];
    cout<<ans<<endl;

}


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

int main(){
  string data;
  cin>>data;
  int flag=0,size=data.size();
  for(int i=0;i<size;i++){
    if(data[i]!=data[size-1-i]){
      flag=1;
      break;
    }
  }
  
  for(int i=0;i<(size-1)/2;i++){
    if(data[i]!=data[(size-1)/2-1-i]){
      flag=1;
      break;
    }
  }
  
  for(int i=(size+3)/2-1;i<size;i++){
    if(data[i]!=data[size-1-i]){
      flag=1;
      break;
    }
  }
  
  if(flag==1) cout<<"No";
  else cout<<"Yes";
}

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

using namespace std;
using ll = long long;

const long long inf = 1e9;
#define fr(i,a,n) for (int i=a;i<n;i++)
#define rfr(i,n,a) for (int i=n;i>=a;i--)
#define mp make_pair
#define pb push_back
#define pii pair<int,int>
#define pll pair<ll,ll> 
#define endl "\n"
typedef vector<int> VI;
typedef vector<ll> VL;
typedef priority_queue<int> Pqi;
typedef priority_queue<ll> Pql;

ll n, m, k;


int main() {
	ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	cin >> n >> m;
	cout << n * m << endl;
 	return 0;
}

Measured memory_bytes: 3596
#![allow(non_snake_case)]

fn read_line() -> String {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).unwrap();
    s.trim().to_string()
}

fn read_vec() -> Vec<i32> {
    read_line()
        .split_whitespace()
        .map(|e| e.parse().unwrap())
        .collect()
}

fn main() {
    let N: usize = read_line().parse().unwrap();
    let B = read_vec();
    let mut ans = B[0] + B[N-2];
    for i in 1..N-1 {
        ans += std::cmp::min(B[i-1], B[i]);
    }
    println!("{}", ans);
}


Measured memory_bytes: 4352
#include <iostream>
#include <cstdio>
#include <cstring>
using namespace std;
int f[100005];
int a[100005];
int main()
{
    int n,x,y;
    memset(f,0,sizeof(f));
    memset(a,0,sizeof(a));
    f[0]=1;
    f[1]=1;
    for (int i=2;i<=100000;i++)
        if (f[i]==0)
        {
            for (int j=i+i;j<=100000;j=j+i) f[j]=1;
        }
    for (int i=1;i<=100000;i++)
        if (f[i]==0)
    {
        if (f[(i+1)/2]==0) a[i]=a[i-1]+1;
        else a[i]=a[i-1];
    }
    else a[i]=a[i-1];
    while(scanf("%d",&n)!=EOF)
    {
        for (int i=0;i<n;i++)
        {
            scanf("%d%d",&x,&y);
            printf("%d\n",a[y]-a[x-1]);
        }
    }
    return 0;
}


Measured memory_bytes: 1408
#include<bits/stdc++.h>
using namespace std;
long long i,j,n,m,mas[200005][30],x,p[40],z[40],k,aa,rez;
int main()
{
    std::cin.sync_with_stdio(false);
    std::cin.tie(0);
    cin >> n;
    i=1;
    p[0]=1;
    while (i<30)
    {
        p[i]=p[i-1]*2;
        i++;
    }
    i=0;
    while (i<n)
    {
        cin >> m;
        j=0;
        x=1;
        while (x<m)
        {
            x*=2;
            j++;
        }
        while (j>=0)
        {
            mas[i][j]=m/p[j];
            m%=p[j];
            j--;
        }
        i++;
    }

    /*i=0;
    while (i<n)
    {
        j=0;
        while (j<20)
        {
            cout << mas[i][j] << " ";
            j++;
        }
        cout << "\n";
        i++;
    }*/
    i=0;
    while (i<30)
    {
        z[i]=mas[0][i];
        i++;
    }

    i=0;
    j=0;
    while (i<n)
    {
        k=0;
        aa=0;
        if (j<n-1)
        {
            while (k<30)
            {
                if (z[k]==mas[j+1][k]&&z[k]==1)
                {
                    aa=1;
                }
                k++;
            }
        }
        else
        {
            aa=1;
        }
        if (aa==0)
        {
            if (j<n)
            {
                j++;
                k=0;
                while (k<30)
                {
                    z[k]+=mas[j][k];
                    k++;
                }
            }
            else
            {
                i++;
                k=0;
                while (k<30)
                {
                    z[k]-=mas[i][k];
                    k++;
                }
            }
        }
        else
        {
            //cout << i << " " << j << "\n";
            k=0;
            while (k<30)
            {
                z[k]-=mas[i][k];
                k++;
            }
            rez+=j-i+1;
            i++;
            if (j<i)
            {
                j=i;
                k=0;
                while (k<30)
                {
                    z[k]+=mas[j][k];
                    k++;
                }
            }
        }
    }
    //cout << i << " " << j << "\n";
    //rez+=j-i+1;
    cout << rez;
    return 0;
}


Measured memory_bytes: 47104
#include<stdio.h>
int at(int x, int y);
int main(void)
{

        int a,b,c;

        scanf("%d%d",&a,&b);
        if((1<=a) && (a<=b) && (b<=20))
                c = at(a, b);
        else
                printf("正しい値を入力してください\n");
        printf("%d\n",c);
        return 0;
}

int at(int x, int y){

        int g;

        if(y%x==0)
                g = x + y;
        else
                g = y - x;
        return g;
}


Measured memory_bytes: 128
#include <iostream>
#include <queue>
#include <map>
#include <cmath>
#include <algorithm>
#include <queue>
#include <cstdarg>
#include <set>
#include <limits>
#include <iomanip>

using namespace std;
#define INF 2e9 + 9
#define MOD 1000000007
#define ALL(v) v.begin() , v.end()
#define Int int64_t
#define pll pair<Int,Int>
template<class T> using pql = priority_queue<T, vector<T>>;
template<class T> using pq = priority_queue<T, vector<T>, greater<T>>;
#define ll(n) Int n; cin >> n;
#define LL(...) Int __VA_ARGS___; cin >> __VA_ARGS___;
#define OUT(...) cout << __VA_ARGS___;
#define RP(n, i, s) for(Int i = s ;i < n ;i++)
#define REP(n, i) for (Int i = 0; i < n; i++)
#define REPe(n, i) for (Int i = 1; i <= n; i++)
#define RPe(n, i, s) for (Int i = s; i <= n; i++)
#define upd_max(maxer, updater) if (maxer < updater) maxer = updater;

void ansYes(bool flag){
    if (flag) cout << "Yes" << endl; else  cout << "No" << endl;
}

void ansYES(bool flag){
    if (flag) cout << "YES" << endl; else  cout << "NO" << endl;
}

struct node {
    Int to;
    Int length;
};


vector<Int> divisor(Int n) {
    vector<Int> ret;
    for (Int i = 1; i * i <= n; i++) {
        if (n % i == 0) {
            ret.push_back(i);
            if (i * i != n) ret.push_back(n / i);
        }
    }
    return (ret);
}

/*
vector<vector<int>> to;
vector<int> flag;
vector<int> c;


Int dfs(int from, int mae) {
    flag[from] = 1;
    Int mini = 0;
    for (auto next : to[from]) {
        if (next == mae) continue;
        if (flag[next] == 1) {
            return -1;
        } else {
            mini = min(mini, dfs(next, from));
        }
    }
    return mini;
}*/

int dx8[8] = {0, -1, -1, -1, 0, 1, 1, 1};
int dy8[8] = {-1, -1, 0, 1, 1, 1, 0, -1};

struct datas{
    Int max;
    Int size;
};


int main(void) {
    Int a ,b;
    cin >> a >> b;
    queue<Int> que;
    for (int i = ceil((double)a / 2 * 25);((double)i) * 8 / 100 < a + 1;i++){
        que.push(i);
    }
    while(!que.empty()){
        auto z = que.front();
        que.pop();
        double hyouka = ((double)z) / 100 * 10;
        if (b == floor(hyouka)) {
            cout << z << endl;
            return 0;
        }
    }
    cout << -1 << endl;
}




Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define MOD 1000000007
vector<int>vt;
set<int>st;
map<int,int>mp;
unordered_map<string,int> umap; 
const long long MAX = 1e5;
const long long INF = 1e9;
const double pi = acos(-1);




int main() {
  
  int x;
  cin>>x;
  for(long long int i=-2000;i<=2000;i++)
    for(long long int j=-2000;j<=2000;j++)
    {
      if(i*i*i*i*i==j*j*j*j*j+x)
      {
        cout<<i<<" "<<j<<endl;
       exit(0);
      }
    }

}

Measured memory_bytes: 3656
# https://atcoder.jp/contests/abc121/tasks/abc121_b

import itertools
import collections
import bisect

def main():
    N, M, C = map(int, input().split())
    B = list(map(int, input().split()))
    A = [list(map(int, input().split())) for _ in range(N)]

    ans = 0
    for i in range(N):
        s = C
        for a, b in zip(A[i], B):
            s += a * b
        if s > 0:
            ans += 1
    print(ans)

if __name__ == '__main__':
    main()


Measured memory_bytes: 3444
import java.util.*;

public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int tower = sc.nextInt();
    int num = sc.nextInt();
    int T[][] = new int[tower][2];
    int t_count[] = new int[tower];
    for(int i = 0;i < tower;i++){
      T[i][0] = sc.nextInt();
    }
    for(int i = 0;i < num;i++){
      int a = sc.nextInt();
      int b = sc.nextInt();
      t_count[a - 1]++;
      t_count[b - 1]++;
      if(T[a - 1][0] < T[b - 1][0]){
        T[b - 1][1]++;
      }
      else if(T[a - 1][0] > T[b - 1][0]){
        T[a - 1][1]++;
      }
    }
    int count = 0;
    for(int i = 0;i < tower;i++){
      if(T[i][1] == t_count[i]){
        count++;
      }
    }
    System.out.println(count);
  }
}
    

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

int frog2(int arr[], int n, int k){
    if(n < 2)
        return 0;
    int dp[n];
    dp[n-1] = 0;
    for(int i=n-2; i>=0; i--){
        int minCost = INT_MAX;
        for(int j=i+1; j<n and j<=i+k; j++){
            int currCost = abs(arr[j]-arr[i]) + dp[j];
            if(currCost < minCost)
                minCost = currCost;
        }
        dp[i] = minCost;
    }
    return dp[0];
}

int main()
{
 int n, k;
 cin>>n>>k;
 int arr[n];
 for(int i=0; i<n; i++)
    cin>>arr[i];
 int ans = frog2(arr, n, k);
 cout<<ans;
 return 0;
}



Measured memory_bytes: 4404
#include <bits/stdc++.h>
#define debug(x) cerr << #x << " " << (x) << endl
using namespace std;

const int N = 100005;
const long long inf = 10000000000000000ll;

template <class T>
void read (T &x) {
	int sgn = 1;
	char ch;
	x = 0;
	for (ch = getchar(); (ch < '0' || ch > '9') && ch != '-'; ch = getchar()) ;
	if (ch == '-') ch = getchar(), sgn = -1;
	for (; '0' <= ch && ch <= '9'; ch = getchar()) x = x * 10 + ch - '0';
	x *= sgn;
}

template <class T>
void write (T x) {
	if (x < 0) putchar('-'), write(-x);
	else if (x < 10) putchar(x + '0');
	else write(x / 10), putchar(x % 10 + '0');
}

struct node {
	int id;
	long long val;
	bool operator < (node rhs) const {
		return val < rhs.val;
	}
} vec[N << 1];

int n;
bool ina[N], inb[N];
long long a[N], b[N], ans = inf, sum = 0ll, sum1 = 0ll, sum2 = 0ll;
int main () {
	read(n);
	for (int i = 1; i <= n; i++) {
		vec[i].id = i, read(vec[i].val);
		sum1 += (a[i] = vec[i].val);
		vec[i + n].id = i + n, read(vec[i + n].val);
		sum2 += (b[i] = vec[i + n].val);
	}
	ans = min(sum1, sum2);
	sort(vec + 1, vec + (n << 1 | 1));
	
	for (int i = 1; i <= n; i++) ina[i] = inb[i] = false;
	for (int i = 1; i <= n; i++) {
		if (vec[i].id <= i) ina[vec[i].id] = true; 
		else inb[vec[i].id - n] = true;
		sum += vec[i].val;
	}

	bool flag = false;
	for (int i = 1; i <= n; i++) {
		if (ina[i] && inb[i]) flag = true;
	}
	if (flag) ans = min(ans, sum);
	else {
		if (max(vec[n + 1].id - vec[n].id, vec[n].id - vec[n + 1].id) != n) ans = min(ans, sum + vec[n + 1].val - vec[n].val);
		else {
			ans = min(ans, sum + vec[n + 2].val - vec[n].val);
			if (max(vec[n + 1].id - vec[n - 1].id, vec[n - 1].id - vec[n + 1].id) != n) ans = min(ans, sum + vec[n + 1].val - vec[n - 1].val);
		}
	}

	write(ans), putchar('\n');
	return 0;
}

Measured memory_bytes: 5120
n=int(input())
s=[input() for _ in range(n)]
t={}
u=[]
for i in range(n):
    if s[i] not in t.keys():
        t[s[i]]=1
    else:
        t[s[i]]+=1

max=0
for i in t:
    if max<=t[i]:
        max=t[i]
for i in t:
    if max==t[i]:
        u.append(i)
u.sort()
for i in range(len(u)):
    print(u[i])

Measured memory_bytes: 35220
#include <bits/stdc++.h>
using namespace std;
#define ll long long
int main() {
  ll A, B;
  cin >> A >> B;
  if ((A + B) % 2) {
    cout << "IMPOSSIBLE" << endl;
  } else {
    cout << (A+B) / 2 << endl;
  }
  
}

Measured memory_bytes: 256
import java.util.Scanner;

class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		long N = sc.nextLong();
		long min = Long.MAX_VALUE;
		for(int i = 0; i < 5; i++) {
			min = Math.min(min, sc.nextLong());
		}
		long ans = (N % min == 0) ? N / min : N / min + 1;
		ans += 4;
		System.out.println(ans);
	}
}


Measured memory_bytes: 21716
package main

import (
	"fmt"
	"math"
)

type Point struct {
	X float64
	Y float64
}

func Distance(a,b Point) float64 {
	return math.Sqrt((a.X-b.X)*(a.X-b.X) + (a.Y-b.Y)*(a.Y-b.Y)) 
}

func main() {

	var a, b Point
	fmt.Scan(&(a.X),&(a.Y),&(b.X),&(b.Y))

	fmt.Println(Distance(a,b))
}


Measured memory_bytes: 1148
#include <bits/stdc++.h>
using namespace std;
using Graph = vector<vector<int> >;

int n, m;
Graph G;

void solve() {
    vector<int> dist(n, -1);
    vector<int> prev(n, -1);
    queue<int> que;
    que.push(0);
    dist[0] = 0;
    while (!que.empty()) {
        int v = que.front();
        que.pop();
        for (auto nv : G[v]) {
            if (dist[nv] == -1) {
                dist[nv] = dist[v] + 1;
                prev[nv] = v;
                que.push(nv);
            }
        }
    }
    cout << "Yes" << endl;
    for (int i = 1; i < n; ++i) cout << prev[i] + 1 << endl;
}

int main() {
    cin >> n >> m;
    G.assign(n, vector<int>());
    for (int i = 0; i < m; ++i) {
        int a, b;
        cin >> a >> b;
        --a, --b;
        G[a].push_back(b);
        G[b].push_back(a);
    }
    solve();
}


Measured memory_bytes: 10680
use proconio::{fastout, input};

#[fastout]
fn main() {
    input! {
        a: [[i32; 3]; 3],
        n: usize,
        b: [i32; n],
    }

    let mut check = [[false; 3]; 3];

    for i in 0..3 {
        for j in 0..3 {
            if b.contains(&a[i][j]) {
                check[i][j] = true;
            }
        }
    }

    let mut flag = false;
    for i in 0..3 {
        if check[i][0] && check[i][1] && check[i][2] {
            flag = true;
        }
    }
    for i in 0..3 {
        if check[0][i] && check[1][i] && check[2][i] {
            flag = true;
        }
    }
    if check[0][0] && check[1][1] && check[2][2] {
        flag = true;
    }
    if check[0][2] && check[1][1] && check[2][0] {
        flag = true;
    }

    let ans = if flag { "Yes" } else { "No" };

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


Measured memory_bytes: 2172
#define _CRT_SECURE_NO_WARNINGS

#include <iostream>
#include <string>
#include <vector>
#include <cmath>
#include <fstream>
#include <set>
#include <utility>
#include <algorithm>
#include <queue>
#include <stack>
#include <deque>
#include <numeric>
#include <sstream>
#include <list>
#include <map>
#include <functional>
#include <iterator>

#define rep(i,p,n) for(int i=(int)p;i<(int)n;i++)
#define repp(i,p,n) for(int i=(int)p;i>=(int)n;i--)
#define Sort(x) sort(x.begin(),x.end())
#define PSort(x) sort(begin(x), end(x), pairCompare)
#define ll long long
#define INF 2000000000
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define vi vector<int>
#define PI 3.14159265358979
int dx[4] = { -1,0,1,0 }, dy[4] = { 0,1,0,-1 };
using namespace std;

int main(){	
	int n;
	int ans = 0;
	cin >> n;
	vector<int> ct(100000, INF);
	rep(i, 0, n) {
		int x;
		cin >> x;
		if (x <= 100000) {
			x--;
			if (ct[x] == INF)ct[x] = 0;
			ct[x]++;
		}
		else ans ++;
	}

	rep(i, 0, 100000) {
		//printf("%d\n", ct[i]);
		if (ct[i] != INF) {
			if (ct[i] - (i + 1) >= 0)ans += ct[i] - (i + 1);
			else ans += ct[i];
		}
	}

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



Measured memory_bytes: 640
n = int(input())
h = list(map(int, input().split()))

ans = 1
if len(h) >= 2:
  if h[0] <= h[1]:
    ans += 1
  for i in range(2,n):
    isCount = True
    if h[0] <= h[i]:
      if h[1] <= h[i]:
      	for j in range(1,i):
          if h[j] > h[i]:
          	isCount = False
      	if isCount:
          ans += 1
print(ans)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
 
#define REP(i, s) for (int i = 0; i < s; ++i)
#define ALL(v) (v).begin(), (v).end()
#define COUT(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl
#define EACH(i, s) for (__typeof__((s).begin()) i = (s).begin(); i != (s).end(); ++i)
#define DEBUG
#define int long long
#define INF 1e18
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
template<class T1, class T2> ostream& operator << (ostream &s, pair<T1,T2> P)
{ return s << '<' << P.first << ", " << P.second << '>'; }
template<class T> ostream& operator << (ostream &s, vector<T> P)
{ for (int i = 0; i < P.size(); ++i) { if (i > 0) { s << " "; } s << P[i]; } return s; }
template<class T> ostream& operator << (ostream &s, vector<vector<T> > P)
{ for (int i = 0; i < P.size(); ++i) { s << endl << P[i]; } return s << endl; }
template<class T> ostream& operator << (ostream &s, set<T> P)
{ EACH(it, P) { s << "<" << *it << "> "; } return s << endl; }
template<class T1, class T2> ostream& operator << (ostream &s, map<T1,T2> P)
{ EACH(it, P) { s << "<" << it->first << "->" << it->second << "> "; } return s << endl; }
template<class T>void show(vector<T>v){for (int i = 0; i < v.size(); i++){cerr<<v[i]<<" ";}cerr<<"\n";}
typedef long long ll;

signed main()
{
    int k;
    cin>>k;
    vector<int>a(k);
    REP(i,k) cin>>a[i];
    int minn=2,maxn=2;
    for(int i=k-1;i>=0;i--){
        if(maxn - minn <a[i] && minn%a[i] <= maxn%a[i] && minn%a[i]!=0 && maxn%a[i]!=0){
            cout<<-1<<endl;
            return 0;
        }
        int x=minn%a[i];
        if(x!=0) minn=minn+a[i]-x; 
        int y=maxn%a[i];
        maxn=maxn-y+a[i]-1;
        
      //  cerr << minn << " " << maxn << endl;
    }
    cout<<minn<<" "<<maxn<<endl;
    return 0;
}

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

int main() {
  int N, M;
  cin >> N >> M;
  vector<pair<int, int>> request(M);
  rep(i, M) {
    int a, b;
    cin >> a >> b;
    request[i] = make_pair(a, b);
  }
  
  sort(request.begin(), request.end());
  reverse(request.begin(), request.end());
  vector<int> bridge;
  rep(i, M) {
    bool finish = false;
    for (int x : bridge) {
      if (request[i].first <= x && x < request[i].second) finish = true;
    }
    if (finish) continue;
    bridge.push_back(request[i].first);
  }
  
  cout << bridge.size() << endl;
  return 0;
}

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


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

    string s;
    cin>>s;
    int cnt[26]={};
    for(int i=0;i<4;i++){
        cnt[s[i]-'A']++;
    }
    int ans=0;
    for(int i=0;i<26;i++){
        if(cnt[i]==2) ans++;
    }
    if(ans==2){
        cout<<"Yes"<<endl;
    }
    else cout<<"No"<<endl;
}

Measured memory_bytes: 256
n = int(input())
s = input()
S = []
for i in s:
    S.append(i
    )

ans = 0
for i in range(1, n):
    x = S[0:i]
    y = S[i:n]
    a = 0
    for j in range(len(x)):
        if x[j] in y:
            a += 1
            while x[j] in y:
                y[y.index(x[j])] = 0
    ans = max(ans, a)
print(ans)

Measured memory_bytes: 3064
N,X,Y = list(map(int, input().split()))
X,Y = X-1,Y-1
ans = [0] * (N-1)
for i in range(N):
  for j in range(i+1,N):
    d = min(j-i, abs(j-X) + 1 + abs(i-Y), abs(j-Y) + 1 + abs(i-X))
    ans[d-1] += 1
    
for a in ans:
  print(a)
  
#print(ans)

Measured memory_bytes: 47452
main :: IO ()
main = do
  str <- getLine
  putStrLn $ show $ function1 str

function1 :: String -> Int
function1 str = length $ function3 $ function2 str 

function2 :: String ->  String
function2 str = dropWhile (/= 'A') str

function3 :: String -> String
function3 = dropWhile (/= 'Z') . reverse 

Measured memory_bytes: 13948
/*
  Contest 088
  A - Infinite Coins
  Rakesh Kumar --> 18/09/2020
 */

#include <bits/stdc++.h>

int main() {
    std::ios_base::sync_with_stdio(false);
    std::cin.tie(0); std::cout.tie(0);
    int n = 0;
    std::cin >> n;

    std::vector<int> cards;
    while (n--) {
        int s = 0;
        std::cin >> s;
        cards.emplace_back(s);
    }
    std::sort(cards.rbegin(), cards.rend());

    int alice = 0, bob = 0;
    for (std::size_t i = 0; i < cards.size(); ++i) {
        if (i & 1)
            bob += cards[i];
        else
            alice += cards[i];
    }
    std::cout << alice - bob << std::endl;

    return 0;
}


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

int main() {
  int A, B, C;
  cin >> A >> B >> C;
  
  if((A<C&&C<B) ||(B<C&&C<A)){
    cout << "Yes" <<endl;
  }
  else{
    cout << "No" <<endl;
  }
}

Measured memory_bytes: 256
#include <iostream>
#include <cstring>
#include <algorithm>
#include <vector>
#include <string>
#include <math.h>
#include <iomanip>
#include <limits>
#include <list>
#include <queue>
#include <tuple>
#include <map>
using namespace std;
#define MOD (long long int)(1e9+7)
#define ll long long int
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define reps(i,n) for(int i=1; i<=(int)(n); i++)
#define REP(i,n) for(int i=n-1; i>=0; i--)
#define REPS(i,n) for(int i=n; i>0; i--)
#define INF (int)(1123456789)
#define LINF (long long int)(112345678901234567)
#define chmax(a, b) a = (((a)<(b)) ? (b) : (a))
#define chmin(a, b) a = (((a)>(b)) ? (b) : (a))
#define all(v) v.begin(), v.end()

ll mpow(ll a, ll b){
	if(b==0){
		return a;
	}else if(b%2==0){
		ll memo = mpow(a,b/2);
		return memo*memo%MOD;
	}else{
		return mpow(a,b-1) * a % MOD;
	}
}

int main(void){
	ll n,k;
	cin>>n>>k;
	cout<<(k==1?0:n-k)<<endl;
	return 0;
}


Measured memory_bytes: 636
#include<stdio.h>

int main(){
  int a[3], i, j, c;
  
  for(i = 0; i < 3; i++){
    scanf("%d", &a[i]);
  }
  
  for(i = 0; i < 3; i++){
    for(j = i; j < 3; j++){
      if(a[i] > a[j]){
        c = a[i];
        a[i] = a[j];
        a[j] = c;
      }
    }
  }
  
  printf("%d\n", 10*a[2] + a[1] + a[0]);
  
  return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <string>
#include <algorithm>
#include <map>
#include <cmath>
#include <numeric>
#include <vector>
#include <bitset>
#include <queue>
using namespace std;

int main(){
    int x;
    cin >> x;
    int ans = 0;
    long long dist = 0;
    while(true){
        if(x == dist){
            cout << ans << endl;
            return 0;
        }
        if(dist - x > 0 && dist - x < ans){
            cout << ans << endl;
            return 0;
        }
        ans++;
        dist += ans;
    }
    return 0;
}

Measured memory_bytes: 256
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.NoSuchElementException;

public class Main {
	public static void main(String[] args) {
		FastScanner sc = new FastScanner();
		int A = sc.nextInt();
		int B = sc.nextInt();
		int T = sc.nextInt();

		PrintWriter out = new PrintWriter(System.out);
		out.println(T / A * B);

		out.flush();
	}

}

class FastScanner {
	private final InputStream in = System.in;
	private final byte[] buffer = new byte[1024];
	private int ptr = 0;
	private int buflen = 0;

	private boolean hasNextByte() {
		if (ptr < buflen) {
			return true;
		} else {
			ptr = 0;
			try {
				buflen = in.read(buffer);
			} catch (IOException e) {
				e.printStackTrace();
			}
			if (buflen <= 0) {
				return false;
			}
		}
		return true;
	}

	private int readByte() {
		if (hasNextByte())
			return buffer[ptr++];
		else
			return -1;
	}

	private static boolean isPrintableChar(int c) {
		return 33 <= c && c <= 126;
	}

	public boolean hasNext() {
		while (hasNextByte() && !isPrintableChar(buffer[ptr]))
			ptr++;
		return hasNextByte();
	}

	public String next() {
		if (!hasNext())
			throw new NoSuchElementException();
		StringBuilder sb = new StringBuilder();
		int b = readByte();
		while (isPrintableChar(b)) {
			sb.appendCodePoint(b);
			b = readByte();
		}
		return sb.toString();
	}

	public long nextLong() {
		if (!hasNext())
			throw new NoSuchElementException();
		long n = 0;
		boolean minus = false;
		int b = readByte();
		if (b == '-') {
			minus = true;
			b = readByte();
		}
		if (b < '0' || '9' < b) {
			throw new NumberFormatException();
		}
		while (true) {
			if ('0' <= b && b <= '9') {
				n *= 10;
				n += b - '0';
			} else if (b == -1 || !isPrintableChar(b)) {
				return minus ? -n : n;
			} else {
				throw new NumberFormatException();
			}
			b = readByte();
		}
	}

	public int nextInt() {
		long nl = nextLong();
		if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE)
			throw new NumberFormatException();
		return (int) nl;
	}

	public double nextDouble() {
		return Double.parseDouble(next());
	}
}


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

int main()
{	
	int n,a,b,sum=0;
	cin>>n;
	for(int i=0;i<n;i++)
	{
		cin>>a>>b;
		sum+=b-a+1;
	}
	cout<<sum<<endl;
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<vector>
#include<cstdio>
#include<utility>
#include<map>
#include<set>
#include<string>
#include<sstream>
#include<climits>
#include<cmath>
#include<cstdlib>
using namespace std;

int solve(string tmp){
  set<string> ans;
  for(int i=1;i<tmp.size();i++){
    string a = tmp.substr(0,i);
    string b = tmp.substr(i);
    const string ra = string(a.rbegin(),a.rend());
    const string rb = string(b.rbegin(),b.rend());
    ans.insert(a+b);
    ans.insert(ra+b);
    ans.insert(a+rb);
    ans.insert(ra+rb);
    ans.insert(b+a);
    ans.insert(rb+a);
    ans.insert(rb+ra);
    ans.insert(b+ra);
  }
  return ans.size();
}

int main(){
  int n;
  cin>>n;
  for(int i=0;i<n;i++){
    string tmp;
    cin>>tmp;
    cout<<solve(tmp)<<endl;
  }
  return 0;
}

Measured memory_bytes: 1300
def main():
    import sys
    input = sys.stdin.readline
    sys.setrecursionlimit(10**7)
    from collections import Counter, deque
    #from collections import defaultdict
    from itertools import combinations, permutations, accumulate, groupby
    #from itertools import product
    from bisect import bisect_left,bisect_right
    from heapq import heapify, heappop, heappush
    from math import floor, ceil
    #from operator import itemgetter

    #inf = 10**17
    #mod = 10**9 + 7

    n = int(input())
    x, y, h = [], [], []
    for _ in range(n):
        a,b,c = map(int, input().split())
        x.append(a)
        y.append(b)
        h.append(c)
    a = max(h)

    for cx in range(101):
        for cy in range(101):
            for higth in range(a, a+300):
                for i in range(n):
                    if h[i] > 0:
                        if h[i] != (higth-abs(x[i]-cx)-abs(y[i]-cy)):
                            break
                    else:
                        if 0 < (higth-abs(x[i]-cx)-abs(y[i]-cy)):
                            break
                else:
                    print(cx, cy, higth)
                    exit()

if __name__ == '__main__':
    main()

Measured memory_bytes: 43120