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

public class Main {

    private static Scanner scan = new Scanner(System.in);

    public static void main(String[] args) {
	int A = Integer.parseInt(scan.next());
	int B = Integer.parseInt(scan.next());
	int C = Integer.parseInt(scan.next());
	int D = Integer.parseInt(scan.next());

	System.out.println(A*B > C*D ? A*B : C*D);
	scan.close();
    }
}


Measured memory_bytes: 21844
n = int(input())
h = [int(i) for i in input().split(" ")]
dp = [float("inf")] * n

dp[0] = 0
dp[1] = dp[0] + abs(h[0] - h[1])
for i in range(1, n-1, 1):
  dp[i+1] = min(dp[i-1] + abs(h[i-1] - h[i+1]), dp[i] + abs(h[i] - h[i+1]))
  
print(dp[-1])

Measured memory_bytes: 53640
#include <iostream>
#include <cstdio>

using namespace std;

int main()
{
    int n;
    while (scanf("%d",&n)!=EOF)
    {
        if (n%10==9||n/10==9)
            printf("Yes\n");
        else
            printf("No\n");
    }
    return 0;
}

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

using namespace std;

bool perfectSquare(long long f){
	long long square=(long long)round((sqrt(f)));

    if(square*square == f) {
        return true; 
    }
     else {
        return false; 
     }
}


int main(){
	string a,b,c;
	int d;
	cin>>a>>b;
	c=a+b;
	d=stoi(c);
	if(perfectSquare(d)){
		cout<<"Yes"<<endl;
	}else{
		cout<<"No"<<endl;
	}



	return 0;
}

Measured memory_bytes: 256
import static java.lang.Math.min;

import java.io.InputStream;
import java.io.PrintStream;
import java.util.Scanner;

public class Main {

  public static void main(String[] args) {
    resolve(System.in, System.out);
  }

  static void resolve(InputStream is, PrintStream pw) {
    Scanner sc = new Scanner(is);
    int h = Integer.parseInt(sc.next());
    int n = Integer.parseInt(sc.next());
    long dp[] = new long[h + 1];
    for (int i = 0; i < dp.length; i++) {
      dp[i] = Integer.MAX_VALUE;
    }
    dp[0] = 0;
    for (int i = 0; i < n; i++) {
      int a = Integer.parseInt(sc.next());
      int b = Integer.parseInt(sc.next());
      for (int j = 0; j < h; j++) {
        int nj = min(j + a, h);
        dp[nj] = min(dp[nj], dp[j] + b);
      }
    }
    pw.println(dp[h]);
  }
}


Measured memory_bytes: 23940
from collections import defaultdict

def getArray(a):
    d = defaultdict(int)
    n = len(a)
    for i in range(n):
        s = 0
        for j in range(i,n):
            s += a[j]
            d[s] += 1
    return d

while 1:
    N,M = map(int,raw_input().split())
    if N == 0: break
    h = [int(raw_input()) for _ in xrange(N)]
    w = [int(raw_input()) for _ in xrange(M)]
    H,W = getArray(h),getArray(w)
    print sum(H[hi]*W[hi] for hi in H)

Measured memory_bytes: 86244
#include<iostream>
#include<iomanip>
#include<cstdlib>
#include<stdio.h>
#include<time.h>
#include<math.h>
#include<algorithm>
#include<string>
#include<vector>
#include<list>
#include<queue>
#include<stack>
#include<deque>
#include<set>
#include<map>
#define REP(i, N) for(ll i = 0; i < N; ++i)
#define FOR(i, a, b) for(ll i = a; i < b; ++i)
#define ALL(a) (a).begin(),(a).end()
#define pb push_back
#define INF 1000000000
#define MOD 1000000007
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
int qx[8] = {1, 1, 0, -1, -1, -1, 0, 1};
int qy[8] = {0, 1, 1, 1, 0, -1, -1, -1};

int main(void) {
	int W, H, x, y, r;
	cin>>W>>H>>x>>y>>r;
	if(x - r >= 0 && x + r <= W && y - r >= 0 && y + r <= H)cout<<"Yes"<<endl;
	else cout<<"No"<<endl;
}

Measured memory_bytes: 3080
#ifdef DEBUG
#define _GLIBCXX_DEBUG
#endif
//#pragma GCC optimize("O3")
#include <bits/stdc++.h>
using namespace std;
typedef long double ld;
typedef long long ll;
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
//    freopen("input.txt", "r", stdin);
    ll A, B, V, W, T;
    cin >> A >> V >> B >> W >> T;
    if (W >= V || (T * (V - W) < abs(A - B))) {
        cout << "NO\n";
    }
    else {
        cout << "YES\n";
    }
    return 0;
}

Measured memory_bytes: 3652
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define all(v) v.begin(), v.end()
#define vl vector<ll>
#define vi vector<int>
#define pii pair<int,int>
#define pb push_back
#define ff first
#define ss second
const int N=100005;
void solve()
{
    ll n,k=0,val=0,m=0,i=0,j=0,l=-1,x,y,z;
    ll ans=0;
    ll d;
    cin>>n>>k>>d;
    n=abs(n);
    m=(n+d-1)/d;
    if(k<m)
    {
        cout<<n-k*d;
        return;
    }
    k-=m;
    ll rem=d*m-n;
    if(k%2==0)cout<<rem;
    else cout<<d-rem;
}
int main()
{
    ios::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL);
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin) ;
    freopen("output.txt", "w", stdout) ;
    #endif
    int t=1;
    //cin>>t;
    while(t--)solve();
    return 0;
}

Measured memory_bytes: 3648
macro_rules !input {(source =$s :expr ,$($r :tt ) *) =>{let mut iter =$s .split_whitespace () ;let mut next =||{iter .next () .unwrap () } ;input_inner !{next ,$($r ) *} } ;($($r :tt ) *) =>{let stdin =std ::io ::stdin () ;let mut bytes =std ::io ::Read ::bytes (std ::io ::BufReader ::new (stdin .lock () ) ) ;let mut next =move ||->String {bytes .by_ref () .map (|r |r .unwrap () as char ) .skip_while (|c |c .is_whitespace () ) .take_while (|c |!c .is_whitespace () ) .collect () } ;input_inner !{next ,$($r ) *} } ;}
macro_rules !input_inner {($next :expr ) =>{} ;($next :expr ,) =>{} ;($next :expr ,$var :ident :$t :tt $($r :tt ) *) =>{let $var =read_value !($next ,$t ) ;input_inner !{$next $($r ) *} } ;}
macro_rules !read_value {($next :expr ,($($t :tt ) ,*) ) =>{($(read_value !($next ,$t ) ) ,*) } ;($next :expr ,[$t :tt ;$len :expr ] ) =>{(0 ..$len ) .map (|_ |read_value !($next ,$t ) ) .collect ::<Vec <_ >>() } ;($next :expr ,chars ) =>{read_value !($next ,String ) .chars () .collect ::<Vec <char >>() } ;($next :expr ,usize1 ) =>{read_value !($next ,usize ) -1 } ;($next :expr ,$t :ty ) =>{$next () .parse ::<$t >() .expect ("Parse error" ) } ;}

fn main() {
   input! {
      n: usize,
      _a: [usize; n],
      _b: [usize; n],
      _c: [usize; n],
   }
   let mut a = _a;
   let mut b = _b;
   let mut c = _c;
   a.sort();
   b.sort();
   c.sort();
   let mut ans = 0;
   for b in b {
      if a[0] >= b || c[n-1] <= b {
         continue;
      }
      ans += a.lower_bound(&b)*(n - c.upper_bound(&b));
   }
   println!("{}", ans);
}

/// Equivalent to std::lowerbound and std::upperbound in c++
pub trait BinarySearch<T> {
   fn lower_bound(&self, x: &T) -> usize;
   fn upper_bound(&self, x: &T) -> usize;
}
#[allow(dead_code)]
impl<T: Ord> BinarySearch<T> for [T] {
   fn lower_bound(&self, x: &T) -> usize {
      let mut low = 0;
      let mut high = self.len();
      while low != high {
         let mid = (low + high) / 2;
         match self[mid].cmp(x) {
            std::cmp::Ordering::Less => {
               low = mid + 1;
            }
            std::cmp::Ordering::Equal | std::cmp::Ordering::Greater => {
               high = mid;
            }
         }
      }
      low
   }
   fn upper_bound(&self, x: &T) -> usize {
      let mut low = 0;
      let mut high = self.len();
      while low != high {
         let mid = (low + high) / 2;
         match self[mid].cmp(x) {
            std::cmp::Ordering::Less | std::cmp::Ordering::Equal => {
               low = mid + 1;
            }
            std::cmp::Ordering::Greater => {
               high = mid;
            }
         }
      }
      low
   }
}


Measured memory_bytes: 8444
#include <iostream>
#include <vector>
#include <string>
#include <numeric>
#include <math.h>

using namespace std;

using ll = long long;

#define say(s) cout << s << endl
#define rep(i, n) for(int i=0; i<(int)(n); i++)

#define vec vector

const ll INF = ll(1e18)+1;

int main() {
  ll n, k;
  cin >> n >> k;
  ll a = 0;
  while(1) {
    if(powl(k, a) <= n) {
      a++;
    }else {
      break;
    }
  }
  say(a);
  return 0;
}


Measured memory_bytes: 384
import java.util.*;
import static java.lang.Math.*;

public class Main {
	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		
		// 入力
		int r = sc.nextInt();
		int g = sc.nextInt();
		int b = sc.nextInt();
		
		// 計算
		String result = "NO";
		if((100*r +  10*g + b)%4 == 0) result = "YES";

		// 出力
		System.out.println(result);
	}
}



Measured memory_bytes: 21840
#include <stdio.h>
int main(void){
    int a, b, wa, sa, se;
    scanf("%d%d", &a, &b);
    wa = (a + b);
    sa = (a - b);
    se = (a * b);
    if(wa < sa){
        if(sa < se){
            printf("%d", se);
        }else{
            printf("%d", sa);
        }
    }else if(wa < se){
        if(sa < se){
            printf("%d", se);
        }else{
            printf("%d", sa);
        }
    }else{
        printf("%d", wa);
    }
    
}

Measured memory_bytes: 1704
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>

using namespace std;

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

    cout << min({abs(a / 2 * b * c - (a - a / 2) * b * c),
                 abs(b / 2 * a * c - (b - b / 2) * a * c),
                 abs(c / 2 * b * a - (c - c / 2) * b * a)})
         << endl;
    ;
}

Measured memory_bytes: 764
#include<iostream>
#include <algorithm>
#include<string>
#include <bitset>
#include <vector>
#include <functional>
#include <climits>
#include <iomanip>
#include <utility>
#include <stack>
#include <queue>
#include <math.h>
#include <iomanip>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <numeric>
#include <stack>
typedef std::stack<int> IntStack;
typedef std::stack<char> charStack;

using namespace std;
using ll = long long;
typedef pair <int, int> pii;
int main()
{
	ll a = 0, b = 0, c = 0, d = 0, e = 0, f = 0, g = 0, h = 0, ans = 0;
	ll n, m;
	char tmp;
	ll memo[1003][1003] = { {} };
	ll memox[1003] = {};
	ll memoy[1003] = {};
	ll x[100005] = {};
	ll y[100005] = {};
	ll z[100005] = {};
	string s;
	//IntStack yStack;
	//charStack Stack;
	cin >> a;
	cin >> b;
	cin >> c;




	cout << a*b/2 << endl;

	////std::cout << std::fixed;
	//cout << std::setprecision(20) << << endl;
	//cout << d+1 << endl;
	//cout << "" << endl;

	return 0;
}
//char型の文字数字は、-'0'で数値に変換できる
//accumulate(x, x + a, 0);//int型までの配列の合計
//memcpy(x, visited, sizeof(ll)*n);
//void kansuu(ll num, ll visited[10]) {}
//kansuu(1, zz);
//cout << setprecision(15) << v << endl;
//cout << char(z - 'a');
//log10(i) + 1 //10進数の桁数を取得

//int temp;
//for (int i = 0; i < n - 1; i++) {
//	for (int j = n - 1; j > i; j--) {
//		if (w[j - 1] < w[j]) {  /* 前の要素の方が大きかったら */
//			temp = w[j];        /* 交換する */
//			w[j] = w[j - 1];
//			w[j - 1] = temp;
//		}
//	}
//}

//最小公倍数
//ll x = a * b;
//ll tmp;
///* 自然数 a > b を確認・入替 */
//if (a<b) {
//	tmp = a;
//	a = b;
//	b = tmp;
//}
///* ユークリッドの互除法 */
//ll r = a % b;
//while (r != 0) {
//	a = b;
//	b = r;
//	r = a % b;
//}
//a = x / b;//答え

Measured memory_bytes: 256
#include<stdio.h>
#include<math.h>
int a[105];
int b[105];
int c[105];
int main()
{
    int n;
    scanf("%d",&n);
    for(int i=1;i<=n;i++)
    {
        scanf("%d",&a[i]);
    }
    b[1]=a[1];c[1]=a[n];

    for(int i=2;i<=n;i++)
    {
        c[i]=c[i-1]+a[n-i+1];
        b[i]=b[i-1]+a[i];
    }
    int minn=10000,t;
    for(int i=1;i<=n;i++)
    {
        t=b[i]-c[n-i];
        if(t<0)t=-t;else t=t;
        if(t<minn)minn=t;
    }
printf("%d\n",minn);
    return 0;
}
//8
//27 23 76 2 3 5 62 52


Measured memory_bytes: 128
import math

a,b,h,m = map(int,input().split())
xhr = a*math.sin(((h+(m/60))/12)*(2*math.pi))
yhr = a*math.cos(((h+(m/60))/12)*(2*math.pi))
xmin = b*math.sin((m/60)*(2*math.pi))
ymin = b*math.cos((m/60)*(2*math.pi))
print(math.dist([xhr,yhr],[xmin,ymin]))

Measured memory_bytes: 9528
#include <bits/stdc++.h>
#define DUMP(x)  cout << #x << " = " << (x) << endl;
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define IFOR(i, m, n) for(int i = n - 1; i >= m; i-- )
#define REP(i, n) FOR(i,0,n)
#define IREP(i, n) IFOR(i,0,n)
#define FOREACH(x,a) for(auto& (x) : (a) )
#define ALL(v) (v).begin(), (v).end()
using namespace std;
typedef long long ll;
const ll INF = 1e18;
/* テンプレートここまで */

int main() {
  ll N; cin >> N;
  vector<pair<ll, ll> > ba(N);
  vector<pair<ll, ll> > cd(N);
  REP(i, N){
    cin >> ba[i].second >> ba[i].first;
  }
  REP(i, N){
    cin >> cd[i].first >> cd[i].second;
  }

  sort(ALL(cd));
  sort(ALL(ba));
  reverse(ALL(ba));

  ll ans = 0;
  REP(i, N){
    ll x = cd[i].first;
    ll y = cd[i].second;

    for(auto it = ba.begin(); it != ba.end(); it++){
      if(it->first < y && it->second < x){
        ans++;
        ba.erase(it);
        break;
      }
    }
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <string.h>
#include <vector>
#include <queue>
#include <cmath>
#include <bitset>
#include <complex>
#include <functional>
#include <numeric>
#include <iomanip>

#define SPBR(w, n) std::cout<<(w + 1 == n ? '\n' : ' ');
#define YES cout << "YES" << endl
#define Yes cout << "Yes" << endl
#define NO cout << "NO" << endl
#define No cout << "No" << endl
#define ALL(i) (i).begin(), (i).end()
#define FOR(i, a, n) for(int i=(a);i<(n);++i)
#define RFOR(i, a, n) for(int i=(n)-1;i>=(a);--i)
#define REP(i, n) for(int i=0;i<int(n);++i)
#define RREP(i, n) for(int i=int(n)-1;i>=0;--i)
#define IN(a, x, b) (a<=x && x<b)
#define OUT(a, x, b) (x<a || b<=x)
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; }

#define int ll
using ll = long long;
using ull = unsigned long long;
using ld = long double;
const int MOD = 1000000007;
/* const int MOD = 998244353; */
const int INF = 1e18;
const double PI = acos(-1);

using namespace std;
struct INIT { INIT(){
  cin.tie(0); ios::sync_with_stdio(false);
  cout << fixed << setprecision(10);
}}INIT;


signed main() {
  vector<int> x(5);
  REP(i, 5) cin >> x[i];

  REP(i, 5){
    if(x[i] == 0){
      cout << i+1 << "\n";
    }
  }

  return 0;
}


Measured memory_bytes: 3644
// #pragma GCC optimize "trapv" Uncomment when dealing with huge numbers
/*<----------PBDS---------->

#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace __gnu_pbds;
template <typename T>
using order_set = tree<T,null_type,less<T>,rb_tree_tag,tree_order_statistics_node_update>;

order_set<datatype>oset;
Kth smallest : *oset.find_by_order(k-1); // 0 based index
No of elements less than k : oset.order_of_key(k);
Erase X : oset.erase(x)
<----------PBDS---------->*/
#include<iostream>
#include<bits/stdc++.h>
#define int long long
#define mod 1000000007
#define pb(x) push_back(x)
#define gcd(a,b) __gcd(a,b)
#define all(v) v.begin(),v.end()
#define lcm(a,b) (a*b)/gcd(a,b)
#define bits(x) __builtin_popcountll(x)
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
using namespace std;
int32_t main()
{
	fast;
	string s;
	cin >> s;
	bool ok1 = false;
	bool ok2 = false;
	bool ok3 = false;
	int n = s.size();
	for(int i = 0 ; i <=(n/2) ;i++ ){
		if(s[i]!=s[n-i-1]){
			ok1 = true;
		}
	}
	for(int i = 0,j = ((n-1)/2)-1 ; i<j ; i++,j--){
		if(s[i]!=s[j]){
			ok2 = true;
		}
	}
	for(int i = ((n+3)/2)-1,j = n-1 ; i<j ;i++,j--){
		if(s[i]!=s[j]){
			ok3 = true;
		}
	}
	if(!ok1 && !ok2 && !ok3){
		cout << "Yes";
		return 0;
	}
	cout << "No";
}





Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <sstream>
#include <bitset>
using namespace std;

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

    vector<int> X(M);
    for(int i=0; i<M; i++){
        cin >> X[i];
    }
    sort(X.begin(), X.end());

    vector<int> cost(M-1);
    for(int i=0; i<M-1; i++){
        cost[i] = X[i+1] - X[i];
        // cout << cost[i] << endl;
    }

    sort(cost.begin(), cost.end());
    int ans = 0;

    for(int i=0; i<M-N; i++){
        ans += cost[i];
    }

    cout << ans;



    return 0;
}

Measured memory_bytes: 1024
import sys
input = sys.stdin.readline
N,W = [int(i) for i in input().split()]
weight = [0] * N
value= [0] * N
for i in range(N) :
    w,v = [int(i) for i in input().split()]
    value[i] = v
    weight[i] = w
dp = [[0] * (W+1) for _ in range(N+1)]
for i in range(N):
    for w in range(W+1) :
        if w >= weight[i] :
            dp[i+1][w] = max(dp[i][w-weight[i]]+value[i],dp[i][w])
        else :
            dp[i+1][w] = dp[i][w]
print(dp[N][W])

Measured memory_bytes: 120044
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <stdio.h>
#include <queue>
#include <stack>
#include <climits>
#include <map>
#include <set>

const int mod = 1e9 + 7;
const int inf = 1 << 20;
const long long INF = 1LL << 60;
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
using namespace std;

int main()
{
    string s;
    cin >> s;
    int n = s.size();

    stack<char> stack;
    for(int i = 0; i < n; i++){
        if(stack.size() == 0){
            stack.push(s[i]);
        }else if(stack.top() == 'S' && s[i] == 'T'){
            stack.pop();
        }else{
            stack.push(s[i]);
        }
    }
    cout << stack.size();
}


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

int main(){
	int a,b,c,k=1;
	cin >> a >> b >> c;
	if(a!=b && a!=c){k++;if(b!=c){k++;}}
	else if(b!=c){k++;}
	cout << k <<endl;
	return 0;
}


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

using namespace std;

typedef long long ll;

int main() {
    ll n, k;
    cin >> n;
    k = n;
    ll sum = 0;
    while (k > 0) {
        sum += k % 10;
        k /= 10;
    }
    if (n % 10 == 0 && sum == 1) {
        cout << sum + 9 << endl;
    } else {
        cout << sum << endl;
    }
    return 0;
}


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

typedef long long ll;
typedef unsigned long long ull;

void solve() {
  int N;
  scanf("%d", &N);
  int acts_n = 3;
  std::vector<int> dp(acts_n, 0);
  for (int day = 0; day < N; ++day) {
    std::vector<int> new_dp(acts_n, 0);
    std::vector<int> costs(acts_n);
    for (int i = 0; i < costs.size(); ++i) {
      scanf("%d", &costs[i]);
    }
    for (int prev = 0; prev < acts_n; ++prev) {
      for (int next = 0; next < acts_n; ++next) {
        if (prev != next) {
          new_dp[next] = std::max(new_dp[next], dp[prev] + costs[next]);
        }
      }
    }
    dp = new_dp;
  }
  int ans = dp[0];
  for (int a : dp) {
    ans = std::max(ans, a);
  }
  std::cout << ans << "\n";
}

void warp() {
  std::ios_base::sync_with_stdio(false);
  std::cin.tie(0);
  std::cout.tie(0);
  // freopen("input.txt", "r", stdin);
  // freopen("output.txt", "w", stdout);
}
int main() {
  warp();
  solve();
  return 0;
}

Measured memory_bytes: 3640
//Author: master19
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
#define ll long long int
#define ff first 
#define ss second 
#define pb push_back
#define endl "\n"
#define mod 1000000007LL // fixed...
#define modd 1000000007LL // Can be changed for global use
#define all(arr) arr.begin(),arr.end()
#define x(arr) arr.begin(),arr.end()
#define ulli unsigned long long int
#define assign(x,val) memset(x,val,sizeof(x))
#define prec(val, dig) fixed << setprecision(dig) << val
#define Sort(arr) sort(arr.begin(), arr.end())
#define lower(str) transform(str.begin(), str.end(), str.begin(), ::tolower);
#define upper(str) transform(str.begin(), str.end(), str.begin(), ::toupper);
#define crap ios_base :: sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define get(arr, num) vector < ll > arr(num); for(int i=0; i<num; i++)cin >> arr[i];
#define get_set(arr, num, st, type) set < type > st; for(int i=0; i<num; i++) st.insert(arr[i]);
#define put(arr, num) for(int i=0; i<num; i++)cout << arr[i] << " "; cout << endl;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update > new_ds; 
void debug_out() { cerr << endl; }
template <typename HeadStart, typename... TailEnd>
void debug_out(HeadStart H, TailEnd... T) {
    cerr << " " << to_string(H);
    debug_out(T...);
}
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
ll lets_do_it();
pair < ll, ll > xy[] = {{-1, 0}, {1, 0} , {0, -1}, {0, 1}};
pair < ll, ll > dig[] = {{-1, -1}, {-1, 1}, {1, 1}, {1, -1}};
bool isValid(ll x, ll y, ll row, ll col){
    return ((x>=0) && (y >=0)  && (x < row) && (y < col));
}
int main(int argc, const char** argv) {
    crap;
    ll test = 1;
    // cin >> test;
    for(int loop=0; loop<test; loop++){
        // cout << "Case #" << (loop+1) << ": "; 
        lets_do_it();
    }
    return 0;
}
ll lets_do_it(){
    // Your code goes by here !!
    ll d, t, s;
    cin >> d >> t >> s;
    double value = d/(double)s;
    if(value <= t)
        cout << "Yes\n";
    else
    {
        cout << "No\n";
    }
    




    return 0;
}


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

#define _GLIBCXX_DEBUG
#define all(v) (v).begin(),(v).end()

using namespace std;

using ll=long long;
using pii=pair<int, int>;
using vi=vector<int>;

const ll LINF=1LL<<60;
const int INF=1<<29;
const ll MOD=(ll)1e9+7;

int main(){
    int N, K; cin >> N >> K;
    vi p(N);
    for(auto &x : p) cin >> x;
    vector<double> E(N);
    for(int i=0; i<N; i++){
        E[i]=(p[i]+1)/2.0;
    }
    double sum=0;
    for(int i=0; i<K; i++){
        sum+=E[i];
    }
    double res=sum;
    for(int i=K; i<N; i++){
        sum=sum+E[i]-E[i-K];
        res=max(res, sum);
    }
    printf("%.7f\n", res);
    return 0;
}

Measured memory_bytes: 5600
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <string>
#include <cmath>

using ll = long long;

using namespace std;

int main() {
    int n, x, y;
    cin >> n >> x >> y;
    int cnt[n];
    fill(cnt, cnt+n, 0);
    for (int i=1; i<=n; i++) {
        for (int j=i+1; j<=n; j++) {
            int d = min(j - i, abs(j-y) + 1 + abs(i-x));
            cnt[d]++;
        }
    }
    for (int k=1; k<n; k++) cout << cnt[k] << '\n';
    return 0;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;

int main(int argc, char* argv[]) {
	ll n, answer = 0;
	string s[200005];
	cin >> n;
	for (int i = 0; i < n; i++)
	{
		cin >> s[i];
	}
	sort(s, s + n);
	string CheckString = s[0];
	answer = 1;
	for (int i = 1; i < n; i++)
	{
		if (CheckString != s[i])
		{
			answer++;
			CheckString = s[i];
		}
	}
	cout << answer << endl;
	return 0;
}

Measured memory_bytes: 9880
#include <stdio.h>
#define MAX 200001

int main(){
  int n,a[MAX],s[MAX],list[MAX],round[MAX],next[MAX],last[MAX],p,
      i,j;
  
  long k,count,mod;
  
  scanf("%d%ld",&n,&k);
  for(i=0;i<MAX;i++){last[i]=-1;}
  for(i=0;i<n;i++){
    scanf("%d",&a[i]);
    if(last[a[i]] == -1){
      next[i] = i;
      last[a[i]] = i;
    }else{
      next[i] = next[last[a[i]]];
      next[last[a[i]]] = i;
      last[a[i]] = i;
    }
  }
  
  p=0;
  count=1;
  round[1] = 0;
  while(1){
    if(next[p] <= p){
      count++;
    }
    p = next[p] + 1;
    if(p == n){
      break;
    }
    round[count] = p;
  }

  mod = k % count;
  if(mod == 0){
    return 0;
  }
  
  p = 0;
  for(i=0;i<MAX;i++){s[i]=-1; list[i]=-1;}
  for(i=round[mod];i<n;i++){
    if(list[a[i]] == -1){
      s[p] = a[i];
      list[a[i]] = p;
      p++;
    }else{
      for(j=list[a[i]]+1;j<p;j++){
        list[s[j]] = -1;
        s[j] = -1;
      }
      p = list[a[i]];
      s[list[a[i]]] = -1;
      list[a[i]] = -1;
    }
  }
    
  for(i=0;i<p;i++) printf("%d ",s[i]);
  return 0;
}   

Measured memory_bytes: 6144
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        // Your code here!
        Scanner scan = new Scanner(System.in);
        Integer A = scan.nextInt();
        Integer B = scan.nextInt();
        int plus = A + B;
        int minus = A - B;
        int multi = A * B;
        int max = -999;
        if(max < plus)
            max = plus;
        if (max < minus)
            max = minus;
        if(max < multi)
            max = multi;
        System.out.println(max);
    }
}


Measured memory_bytes: 21844
#define _USE_MATH_DEFINES
#include "bits/stdc++.h"
using namespace std;

//#define int long long
#define DBG 1
#define dump(o) if(DBG){cerr<<#o<<" "<<o<<endl;}
#define dumpc(o) if(DBG){cerr<<#o; for(auto &e:(o))cerr<<" "<<e;cerr<<endl;}
#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define rrep(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define each(it,c) for(auto it=(c).begin();it!=(c).end();it++)
#define all(c) c.begin(),c.end()
const int INF = sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD = (int)(1e9 + 7);

signed main() {
	int n;
	while (cin >> n, n) {
		vector<vector<int>>v(n + 1, vector<int>(n + 1));
		rep(i, 0, n)rep(j, 0, n)cin >> v[i][j];
		rep(i, 0, n) {
			v[i][n] = accumulate(v[i].begin(), v[i].end(), 0);
		}
		rep(i, 0, n + 1) {
			int sum(0);
			rep(j, 0, n)sum += v[j][i];
			v[n][i] = sum;
		}

		rep(i, 0, n + 1) {
			rep(j, 0, n + 1) {
				printf("%5d", v[i][j]);
			}
			cout << endl;
		}
	}
	return 0;
}

Measured memory_bytes: 3164
#include<stdio.h>
int main(void){
	int f[16][16],d[16][16],i,j,c,x,y;
	for(;scanf("%d%d",&x,&y),x;){
		for(i=0;i<y;*d[i]=d[i][x+1]=0,*f[i]=f[i][x+1]=1,i++)
			for(j=1;j<=x;j++)
				scanf("%d",f[i]+j);
		for(j=1;j<=x;j++)
			d[y][j]=1,d[y-1][j]=f[y-1][j]!=1;
		for(i=y-1;i--;)
			for(j=1;j<=x;d[i][j++]=c)
				switch(f[i][j]){
					case 0:
						c=d[i+1][j];
						f[i+1][j-1]-2?c+=d[i+1][j-1]:0;
						f[i+1][j+1]-2?c+=d[i+1][j+1]:0;
					break;
					case 1:
						c=0;
					break;
					case 2:
						c=d[i+2][j];
					break;
				}
		c=0;
		for(j=1;j<=x;j++)c+=d[0][j];
		printf("%d\n",c);
	}
	return 0;
}

Measured memory_bytes: 0
#include <iostream>
#include <string>
#include <array>
#include <vector>
#include <math.h>
#include <algorithm>
#include <set>
#include <deque>
#include <utility>
#include <map>

using namespace std;

int main(void)
{
	int n;
	vector <int> a;
	int i, j;
	int temp;
	int lamp;
	int count = 1;
	int k = -1;

	cin >> n;

	for (i = 0; i < n; i++) {
		cin >> temp;
		a.push_back(temp);

	}

	lamp = a[0];
	if (lamp == 2) {
		cout << 1 << endl;
		return (0);
	}

	for (i = 0; i < n; i++) {
		temp = lamp;
		
		lamp = a[temp - 1];

		count++;

		if (lamp == 2) {
			cout << count << endl;
			return (0);
		}


	}

	cout << k << endl;


	return (0);
}

Measured memory_bytes: 892
import sys
import itertools
sys.setrecursionlimit(1000000000)
from heapq import heapify,heappop,heappush,heappushpop
import math
import collections
import copy


if __name__ == "__main__":
    n = int(input())
    a = list(map(int,input().split()))
    a.sort(reverse=True)
    ans = 0
    for i in range(1,2*n,2):
        ans += a[i]
    print(ans)

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

#define HEAP priority_queue
#define rep(i, n) for(int i = 0, _end_ = (n); i < _end_; ++i)
#define per(i, n) for(int i = (n) - 1; i >= 0 ; --i)
#define forn(i, l, r) for(int i = (l), _end_ = (r); i <= _end_; ++i)
#define nrof(i, r, l) for(int i = (r), _end_ = (l); i >= _end_; --i)
#define FOR(a, b) for(auto (a): (b))
#define mp make_pair
#define mt make_tuple
#define pb push_back
#define X first
#define Y second
#define eps 1e-6
#define pi 3.1415926535897932384626433832795
#define SZ(x) (int)x.size()
#define ALL(x) x.begin(), x.end()
#define FILL(a, b) memset((a), (b), sizeof((a)))
#define MCPY(a, b) memcpy((a), (b), sizeof((b)))

using namespace std;

typedef long long LL;
typedef double flt;
typedef vector<int> vi;
typedef vector<LL> vl;
typedef pair<int,int> pii;
typedef pair<int,LL> pil;
typedef pair<LL,int> pli;
typedef pair<LL,LL> pll;
typedef vector<pil> vil;
typedef vector<pii> vii;
typedef vector<pli> vli;
typedef vector<pll> vll;

const int iinf = 1e9 + 7;
const int oo = 0x3f3f3f3f;
const LL linf = 1ll << 60;
const flt dinf = 1e60;

template <typename T>
inline void scf(T &x)
{
	bool f = 0; x = 0; char c = getchar();
	while((c < '0' || c > '9') && c != '-') c = getchar();
	if(c == '-') { f = 1; c = getchar(); }
	while(c >= '0' && c <= '9') { x = x * 10 + c - '0'; c = getchar(); }
	if(f) x = -x; return;
}
template <typename T1, typename T2>
void scf(T1 &x, T2 &y) { scf(x); return scf(y); }
template <typename T1, typename T2, typename T3>
void scf(T1 &x, T2 &y, T3 &z) { scf(x); scf(y); return scf(z); }
template <typename T1, typename T2, typename T3, typename T4>
void scf(T1 &x, T2 &y, T3 &z, T4 &w) { scf(x); scf(y); scf(z); return scf(w); }

inline char mygetchar(){ char c = getchar(); while(c == ' ' || c == '\n') c = getchar(); return c; }

template <typename T> inline bool chkmax(T &x, const T &y){ return y > x ? x = y, 1 : 0; }
template <typename T> inline bool chkmin(T &x, const T &y){ return y < x ? x = y, 1 : 0; }

#ifdef ONLINE_JUDGE
#define debug(...) ;
#else
#define debug(...) fprintf(stderr, __VA_ARGS__)
#define DEBUG
#endif

//---------------------------------------------------------head----------------------------------------------------

const int maxn = 2e5 + 100;

int n, k;
int a[maxn];

int main()
{
	scf(n, k);
	forn(i, 1, n) scf(a[i]);
	LL x = 1, y = 0;
	forn(i, 1, n)
	{
		if(a[i] & 1) x = y = x + y;
		else x <<= 1, y <<= 1;
	}
	printf("%lld\n", k ? y : x);
	return 0;
}

Measured memory_bytes: 256
def solve(H, W, grid):
	MOD = 10 ** 9 + 7
	dp = [0] * (W)
	for j in range(W):
		if grid[0][j] == '#':
			break
		if j == 0:
			dp[j] = 1
		else:
			dp[j] = dp[j-1]

	for i in range(1, H):
		dp2 = [0] * W
		dp2[0] = dp[0] if grid[i][0] != '#' else 0
		for j in range(1, W):
			dp2[j] = dp[j] + dp2[j-1] if grid[i][j] != '#' else 0
		dp = dp2

	return dp[-1] % MOD

H, W = [int(s) for s in input().split()]
grid = []
for _ in range(H):
	grid.append([s for s in input()])
print(solve(H, W, grid))

Measured memory_bytes: 12276
import itertools
while True:
    n,x=map(int,input().split())
    if n==0 and x==0:
        break
    else:
        y=[]
        l=list(range(1,n+1))
        for team in itertools.combinations(l,3):
            s=sum(team)
            y.append(s)
        print(y.count(x))


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

#define PI 3.1415926535897932
#define MOD 1000000007
#define INF 1e9

#define REP(i, n) for(ll i = 0; i < (n); i++)
#define FOR(i, start, end) for(ll i = (start); i < (end); i++)
#define ALL(v) (v).begin(), (v).end()

using namespace std;

typedef long long ll;
typedef pair<ll,ll> pii;
typedef vector<ll> vi;
typedef vector<vi> vvi;
typedef vector<string> vs;

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

void solve()
{
    ll N; cin >> N;
    vi A(N); REP(i, N) cin >> A[i];

    vi ok(N, 0);
    REP(i, N) ok[A[i]]++;

    bool can = true;
    if(N % 2 == 0)
        for(ll i = 1; i < N; i += 2) 
           if(ok[i] != 2)
           {
               can = false;
               break;
           }

    if(N % 2 == 1)
    {
        if(ok[0] != 1) can = false;
        for(ll i = 2; i < N; i += 2) 
           if(ok[i] != 2)
           {
               can = false;
               break;
           }
    }

    if(can) cout << modpow(2, N/2) % MOD << endl;
    else cout << 0 << endl;
}

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

    return 0;
}

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

using namespace std;

int main()
{
	string S;
	cin >> S;
	long long K;
	cin >> K;
	for(int i = 0; i < S.length(); i++)
	{
		if(S[i] != '1')
		{
			cout << S[i] << endl;
			return 0;
		}
		if(i + 1 == K)
		{
			cout << S[i] << endl;
			return 0;
		}
	}
	return 0;
}

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



#define ll long long
#define pb push_back
#define endl "\n"

using namespace std;
const ll maxn=1e3+100;
vector<ll> adj[29];


ll ans[maxn][maxn];
int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
//   freopen("test.txt","r",stdin);
    //  freopen("PAINT.INP", "r", stdin);
    //  freopen("PAINT.OUT", "w", stdout);
    //  cout <<asdadasdasdadaasdad;
     ll n, m, a ,b ;
     cin>>n>>m>>a>>b;
     swap(a,b);
      for (int i=1;i<=n;i++)
        for (int j=1;j<=m;j++)
      {
        if (j<=b) ans[i][j]=1;
        else ans[i][j]=0;
      }
      for (int i=1;i<=a;i++)
      {
          for (int j=1;j<=m;j++)
          ans[i][j]=!ans[i][j];
      }
      for (int i=1;i<=n;i++)
      {
          for (int j=1;j<=m;j++)
          {
              cout <<ans[i][j];
          }
          cout <<endl;
      }



}


Measured memory_bytes: 9856
#include <stdio.h>
#include <string.h>
#include <algorithm>
#include <iostream>
#include <math.h>
#include <assert.h>
#include <vector>
#include <queue>
#include <string>
#include <map>
#include <set>

using namespace std;
typedef long long ll;
typedef unsigned int uint;
typedef unsigned long long ull;
static const double EPS = 1e-9;
static const double PI = acos(-1.0);

#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define FOR(i, s, n) for (int i = (s); i < (int)(n); i++)
#define FOREQ(i, s, n) for (int i = (s); i <= (int)(n); i++)
#define FORIT(it, c) for (__typeof((c).begin())it = (c).begin(); it != (c).end(); it++)
#define MEMSET(v, h) memset((v), h, sizeof(v))

int n, m, k;
char input[6][500];
char str[10000100];
set<string> opened;

string Open(int &pos) {
  string ret;
  while (input[5][pos] != '\0' && input[5][pos] != ')') {
    if (isdigit(input[5][pos])) {
      int num = 0;
      while (isdigit(input[5][pos])) {
        num *= 10;
        num += input[5][pos++] - '0';
        num = min(num, m);
      }
      assert(num != 0);
      assert(input[5][pos] == '(');
      pos++;
      string nret = Open(pos);
      assert(input[5][pos] == ')');
      pos++;
      num = min(num, max(2, (m + (int)nret.size() - 1) / (int)nret.size()));
      if (nret.size() >= 400) {
        if (opened.count(nret)) { num = 1; }
        opened.insert(nret);
      }
      string add;
      REP(i, num) { add += nret; }
      if (add.size() >= 400) { opened.insert(add); }
      ret += add;
    } else {
      ret += input[5][pos++];
    }
  }
  assert((int)ret.size() <= 10000000);
  return ret;
}

int main() {
  while (scanf("%d %d %d", &n, &m, &k) > 0) {
    opened.clear();
    scanf("%s", input[5]);
    REP(i, k) {
      scanf("%s", input[i]);
    }
    {
      int pos = 0;
      string s = Open(pos);
      sprintf(str, "%s", s.c_str());
    }
    int ans = -1;
    int maxValue = -1;
    REP(iter, k) {
      int lv = 0;
      REP(r, m) {
        REP(l, r + 1) {
          char c = input[iter][r + 1];
          input[iter][r + 1] = 0;
          lv += strstr(str, input[iter] + l) != NULL;
          input[iter][r + 1] = c;
        }
      }
      if (lv > maxValue) {
        ans = iter + 1;
        maxValue = lv;
      }
    }
    printf("%d %d\n", ans, maxValue);
  }
}

Measured memory_bytes: 1088
#include "bits/stdc++.h"
using namespace std;
#define forn(i, x, n) for (int i = x; i < n; i++)
#define all(a) (a).begin(), (a).end()
#define pii pair<int, int>
#define pll pair<ll, ll>
typedef long double ld;
typedef long long ll;
template <typename... Args>
void dbg(Args&&... args) {
  using expander = int[];
  (void)expander {0,(static_cast<void>(void(cout << std::forward<Args>(args) << " ")), 0)...};
  cout << endl;
}
void gen() {exit(0);}

const int N = 1e5 + 5;
int n, m;
int a[N];

void input() {
  scanf("%d %d", &n, &m);
  forn(i, 0, n) {
    scanf(" %d", &a[i]);
  }
}

ll ans = 0;
map<int, int> counts;

void solve() {
  int cur = 0;
  forn(i, 0, n) {
    cur = (cur + a[i]) % m;
    ans += counts[cur] + (cur == 0);
    counts[cur]++;
  }
  printf("%lld\n", ans);
}

int main() {
#ifdef DEBUG
  freopen("input", "r", stdin);
  //  freopen("output", "w", stdout);
  //  gen();
#endif
  input();
  solve();
  return 0;
}


Measured memory_bytes: 3584
#!/usr/bin/env python3
from bisect import bisect_left
from itertools import accumulate


def main():
    N, K = map(int, input().split())
    x = list(map(int, input().split()))
    # i0 = bisect_left(x,0)
    # pos = list(accumulate(x[i0:]))
    # neg = list(accumulate(x[:i0][::-1]))
    # y = neg[::-1] + pos
    ans = 10**18
    for i in range(N-K+1):
        # x[i] と x[i+K-1]の符号が違う
        p, q = abs(x[i]), abs(x[i+K-1])
        if x[i] * x[i+K-1] < 0:
            ans = min(ans, p + q + min(p,q) )
        else:
            ans = min(ans, max(p,q))
    print(ans)
    # print(x)


if __name__ == "__main__":
    main()


Measured memory_bytes: 14452
#include<iostream>
#include<algorithm>
#include<vector>
#include<stack>
#include <cmath>
#include <limits>
#include<set>
#include <iomanip>
#include <queue>
#include <string>
#pragma GCC optimize("Ofast")
using namespace std;
const long long INF=200000000000000;
double pi=3.141592653589793;
//setprecision(20) <<

const int MOD = 1000000007;

long long gcd(long long a,long long b){
	if(a<b)swap(a,b);
	if(a%b==0)return b;
	return gcd(a%b,b);
}

long long lcm(long long a,long long b){
	return a/gcd(a,b)*b;
}
long myPow(long long x, long long n, long long m=MOD){
  if(n == 0)
    return 1;
  if(n % 2 == 0)
    return myPow(x * x % m, n / 2, m);
  else
    return x * myPow(x, n - 1, m) % m;
}

class Point{
public:
	long long x;
	long long y;
	long long dis;
	Point(long long _x,long long _y,long long _dis){
		x=_x;
		y=_y;
		dis=_dis;
	}
};

int main(){
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	long long n,a,b;
	cin>>n>>a>>b;
	cout<<max(0LL,(n-2)*(b-a)+1)<<endl;
}


Measured memory_bytes: 256
import bisect
import numpy as np
 
hint = list(map(int, input().split()))
s = [int(input()) for i in range(sum(hint))]
# print(s)

def search_min_pos(arr, target):
  index = bisect.bisect_left(arr, target)
  if 0 == index:
    dist = arr[index]
  else:
    dist = arr[index-1:index+1]
  if not isinstance(dist, list):
    dist = [dist]
  return dist

a_arr = s[:hint[0]]
b_arr = s[hint[0]:-hint[2]]
sum = 0
for t in s[-hint[2]:]:
  a_pos = search_min_pos(a_arr, t)
  b_pos = search_min_pos(b_arr, t)
  #print(t, a_pos, b_pos)
  min_dist = 10 ** 11
  for a in a_pos:
    b_against_a = search_min_pos(b_arr, a)
    for ba in b_against_a:
      min_dist = min([min_dist, abs(t-a)+abs(ba-a)])
  for b in b_pos:
    a_against_b = search_min_pos(a_arr, b)
    for ab in a_against_b:
      min_dist = min([min_dist, abs(t-b)+abs(ab-b)])
  print(min_dist)

Measured memory_bytes: 27692
def input():
    import sys
    return sys.stdin.readline().rstrip()


def main():
    import math
    import collections
    import itertools
    import functools

    n = int(input())
    as_ = [0] + list(map(int, input().split())) + [0]
    sum_cost = functools.reduce(lambda x, i: x + abs(as_[i] - as_[i - 1]), range(1, n + 2), 0)
    # print(sum_cost)
    for i in range(1, n + 1):
        # print(abs(as_[i] - as_[i - 1]) - abs(as_[i + 1] - as_[i]) + abs(as_[i + 1] - as_[i - 1]))
        print(sum_cost - abs(as_[i] - as_[i - 1]) - abs(as_[i + 1] - as_[i]) + abs(as_[i + 1] - as_[i - 1]))

    

if __name__ == '__main__':
    main()

Measured memory_bytes: 14428
//
// Created by file on 18/05/26.
//


#include <iostream>

using namespace std;

int A;
int B;
int SUM;
int diff;
int product;
int MAX;

void judge(){
    //calculate
    SUM = A+B;
    diff = A- B;
    product = A*B;
    //judge

    MAX = SUM;
    if(MAX<diff){
        MAX = diff;
    }
    if(MAX<product){
        MAX =product;
    }

}




int main(){

    std::cin>>A;
    std::cin>>B;
    judge();

    std::cout<<MAX;
}

Measured memory_bytes: 256
def gcd(a, b):
  if b == 0:
    return a
  else:
    return gcd(b, a%b)

def lcm(x, y):
  return x * y // gcd(x, y)

n = int(input())
ans = 1
for i in range(n):
  x = int(input())
  ans = lcm(ans, x)

print(ans)

Measured memory_bytes: 3060
#include<stdio.h>
int keta(int a,int b);
int main(void){
  int a,b;

  while(scanf("%d %d",&a,&b) != EOF){
    printf("%d\n",keta(a,b));
  }
  return 0;
}
int keta(int a,int b){
  int wa,sum,count=0;

  sum=a+b;
  for(wa=1;sum/wa!=0;wa*=10){
    if(sum/wa!=0)
      count++;
  }
  return count;
}

Measured memory_bytes: 1736
#include<bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define rrep(i,n) for (int i = (n)-1; i >= 0; i--)
#define rep2(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 pb push_back
#define eb emplace_back
#define vi vector<int>
#define vvi vector<vector<int>>
#define vl vector<ll>
#define vvl vector<vector<ll>>
#define vd vector<double>
#define vs vector<string>
#define vc vector<char>
#define vb vector<bool>
#define vp vector<P>
using namespace std;
using ll = long long;
using P = pair<int,int>;
using LP = pair<ll,ll>;
template<class S,class T> istream& operator>>(istream &is,pair<S,T> &p) { return is >> p.first >> p.second; }
template<class S,class T> ostream& operator<<(ostream &os,const pair<S,T> &p) { return os<<'{'<<p.first<<","<<p.second<<'}'; }
template<class T> istream& operator>>(istream &is,vector<T> &v) { for(T &t:v){is>>t;} return is; }
template<class T> ostream& operator<<(ostream &os,const vector<T> &v) { os<<'[';rep(i,v.size())os<<v[i]<<(i==v.size()-1?']':','); return os; }
void Yes(bool b) { cout << (b ? "Yes" : "No") << endl; }
void YES(bool b) { cout << (b ? "YES" : "NO") << endl; }
template<class T> bool chmin(T& a,T b) {if(a > b){a = b; return true;} return false;}
template<class T> bool chmax(T& a,T b) {if(a < b){a = b; return true;} return false;}
const int inf = 1001001001;
const ll linf = 1001001001001001001;

int dp[90010];

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr); cout.tie(nullptr);
    int h,w,d;
    cin >> h >> w >> d;
    vi x(h*w),y(h*w);
    rep(i,h) rep(j,w) {
        int a;
        cin >> a;
        a--;
        x[a] = i;
        y[a] = j;
    }
    rrep(i,h*w) {
        if(i+d >= h*w) continue;
        else dp[i] = dp[i+d]+abs(x[i]-x[i+d])+abs(y[i]-y[i+d]);
    }
    int q;
    cin >> q;
    rep(_,q) {
        int l,r;
        cin >> l >> r;
        l--; r--;
        cout << dp[l]-dp[r] << "\n";
    }
}


Measured memory_bytes: 2176
#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
#include<vector>
#include<functional>
#include<algorithm>
#include<stdlib.h>
#include<string>
#include<string.h>
#define _USE_MATH_DEFINES
#include<math.h>
#include<deque>
#include<map>
#include<iostream>
using namespace std;
typedef long long ll;
#define rep(i,a,b) for(auto i=a;i<b;i++)
#define all(_x) _x.begin(), _x.end()
#define r_sort(_x) sort(_x.begin(), _x.end(), std::greater<int>())
#define vec_cnt(_a, _n) (upper_bound(all(_a), _n) - lower_bound(all(_a), _n))
int k[26];
int main() {
	string s;
	cin >> s;
	int a = -1;
	if (s[0] != 'z')a = 0;
	rep(i, 0, s.size()) {
		k[s[i] - 'a'] = 1;
		if (i && s[i - 1] - s[i] != 1)a = i;
	}
	if (a == -1) {
		puts("-1");
		return 0;
	}
	rep(i, 0, 26) {
		if (!k[i]) {
			cout << s << (char)('a' + i);
			return 0;
		}
	}
	string t = s;
	next_permutation(all(s));
	rep(i, 0, s.size()) {
		cout << s[i];
		if (s[i] != t[i])break;
	}
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define For(i,n,k) for(ll i=(n);i<(k);i++)
#define ALL(a)  (a).begin(),(a).end()
ll ans=0;
void Main(){
    ll n;cin>>n;
    cout<<(n+1)/2<<endl;
}
int main(){
    Main();
    return 0;
}

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

namespace B_Frog2
{
    class Program
    {
        public static int[] h = new int[110000];
        public static int[] dp = new int[110000];
        static void Main(string[] args)
        {
            var input = Console.ReadLine().Split(' ');
            var N = int.Parse(input[0]);
            var K = int.Parse(input[1]);

            var input2 = Console.ReadLine().Split(' ');

            for (int i = 0; i < N; i++)
            {
                h[i] = int.Parse(input2[i]);
            }

            dp[0] = 0;
            for (int i = 1; i < 110000; i++)
            {
                dp[i] = int.MaxValue;
            }

            for (int i = 0; i < N; i++)
            {
                for (int j = 1; j <= K; j++)
                {
                    dp[i + j] = Chmin(dp[i + j], dp[i] + Math.Abs(h[i + j] - h[i]));
                }

            }
            Console.WriteLine(dp[N - 1]);
        }

        public static int Chmin(int a, int b)
        {
            return a > b ? b : a;
        }
    }
}


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

signed main() {
  int n;
  vector<int> a(n);
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  int count = 0;
  for (int i = 1; i < n-1; i++) {
    if (a[i-1] < a[i] && a[i] < a[i+1]) count++;
    if (a[i-1] > a[i] && a[i] > a[i+1]) count++;
  }
  cout << count << endl;
}

Measured memory_bytes: 33024
/////////////////////////   _LeMur_
#include <algorithm>
#include <iostream>
#include <cstring>
#include <cassert>
#include <bitset>
#include <cstdio>
#include <vector>
#include <string>
#include <ctime>
#include <stack>
#include <queue>
#include <cmath>
#include <ctime>
#include <list>
#include <map>
#include <set>

using namespace std;

const int N = 100005;
const int inf = 1000 * 1000 * 1000;
const int mod = 1000 * 1000 * 1000 + 7;

int n , m;
vector <int> g[N];

int in[N];
queue <int> q;

int parent[N];

int main(){
    scanf("%d%d",&n,&m);
    m += n - 1;
    for(int i=1;i<=m;i++){
        int a , b;
        scanf("%d%d",&a,&b);
        g[a].push_back(b);
        in[b]++;
    }
    for(int i=1;i<=n;i++){
        if(in[i] == 0)
            q.push(i);
    }
    while(!q.empty()){
        int v = q.front();
        q.pop();
        for(int i=0;i<(int)g[v].size();i++){
            int to = g[v][i];
            in[to]--;
            if(in[to] == 0){
                parent[to] = v;
                q.push(to);
            }
        }
    }
    for(int i=1;i<=n;i++){
        printf("%d\n",parent[i]);
    }
    return 0;
}


Measured memory_bytes: 7040
#include <iostream>
#include <vector>
#include <tuple>

long myPOW2( long p )
{
	long result = 1;

	for ( long i = 0; i < p; i++ )
	{
		result *= 2;
	}

	return ( result );
}

int main()
{
	long L;
	std::cin >> L;

	int r = 0;
	long tmpL;
	while( myPOW2( r ) <= L ) { ++r; }

	long N = r;
	std::vector<std::tuple<long, long, long> > v;

	for ( int i = 1; i < N; ++i )
	{
		// 頂点iからi+1へ長さ0の辺と長さ2^iの辺を張る
		v.emplace_back( std::make_tuple( i, i + 1, 0 ) );
		v.emplace_back( std::make_tuple( i, i + 1, myPOW2( i - 1 ) ) );
	}

	for ( int t = N - 1; t >= 1; --t )
	{
		if ( L - myPOW2( t - 1 ) >= myPOW2( r - 1 ) )
		{
			v.emplace_back( t, N, L - myPOW2( t - 1 ) );
			L -= myPOW2( t - 1 );
		}
	}

	std::cout << N << " " << v.size() << std::endl;
	for ( auto &&it : v )
	{
		std::cout << std::get<0>( it ) << " "
				  << std::get<1>( it ) << " "
				  << std::get<2>( it ) << std::endl;
	}

	return ( 0 );
}


Measured memory_bytes: 256