akhauriyash/Code-Regression huggingface dataset:
#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);
    int n;
    cin >> n;
    map < int, int > mp;
    set < int > s;
    for (int i = 1; i <= n; i++) {
        int x;
        cin >> x;
        mp[x]++;
        s.insert(x);
    }
    if (n % 3 != 0) {
        if (mp[0] != n) {
            cout << "No" << '\n';
        }
        else {
            cout << "Yes" << '\n';
        }
        return 0;
    }
    if (s.size() == 1) {
        if (mp[0] != n) {
            cout << "No" << '\n';
        }
        else {
            cout << "Yes" << '\n';
        }
        return 0;
    }
    if (s.size() == 2) {
        int v1 = *s.begin();
        int v2 = *(--s.end());
        if (mp[v1] > mp[v2]) swap(v1, v2);
        if (v1 != 0 || mp[v1] != n / 3 || mp[v2] != (2 * n) / 3) cout << "No" << '\n';
        else cout << "Yes" << '\n';
    }
    else {
        if (s.size() != 3) {
            cout << "No";
            return 0;
        }
        int xr = 0;
        for (int v : s) {
            if (mp[v] != n / 3) {
                cout << "No";
                return 0;
            }
            xr ^= v;
        }
        if (xr != 0) cout << "No";
        else cout << "Yes";
    }
    return 0;
}

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

#define LL long long
#define REP(i, n) for(int i = 0; i < (int)(n); i++)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define ALL(x) (x).begin(),(x).end()
const int IINF = 1e9;
const LL LINF = 1e18;
const LL mod = 1e9+7;

struct Task {
    LL A;
    LL B;
};

int main() {
    LL N, M;
    cin >> N >> M;
    Task tasks[N];
    REP(i, N) {
        cin >> tasks[i].A >> tasks[i].B;
    }

    vector<vector<LL>> v;
    v.resize(M + 1);

    for(int i = 0;i < N;i++) {
        if(0 <= M - tasks[i].A) {
            v[M - tasks[i].A].push_back(tasks[i].B);
        }
    }

    priority_queue<LL> q;
    LL res = 0;
    for(LL i = M;0 <= i;i--) {
        for(LL j = 0;j < v[i].size();j++) {
            q.push(v[i][j]);
        }
        if(!q.empty()) {
            res += q.top();
            q.pop();
        }
    }
    cout << res << endl;
    return 0;
}



Measured memory_bytes: 7168
#include<bits/stdc++.h>
#include<math.h>
using namespace std;
#define int long long int
#define pp pair<int,int>
#define endl "\n"
#define PI 3.14159265
int MAX = INT_MAX;
const int mod=1e9+7;
const int INF =INT_MAX;
inline int gcd(int a,int b){if(a==0) return b;return gcd(b%a,a);}
inline int pow(int a,int n,int mod){if(n==0)return 1;int p=pow(a,n/2,mod);p=(p%mod*p%mod)%mod;if(n%2) return (p%mod*a%mod)%mod;else return p;}
int32_t main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

   int t;
   //cin>>t;
   t=1;
   while(t--)
   {
       int n;
       cin>>n;
       string s;
       cin>>s;
       int cntr=0,cntw=0;
       for(int i=0;i<n;i++)
       {
         if(s[i]=='R')cntr++;
         else cntw++;
       }

       int ans=min(cntr,cntw);
       int cnt=0;
       for(int i=0;i<=cntr-1;i++)
       {
           if(s[i]=='W')cnt++;
       }
       cout<<min(ans,cnt)<<endl;


   }
}


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

int main() {
	
	string s; cin >> s;
	string ans = "";
	for (int i = 0; i < s.size(); i++) {
		if (s[i] == '0') {
			ans += "0";
		}
		else  if (s[i] == '1') {
			ans += "1";
		}
		else {
			if (ans.size() != 0) {
				ans.pop_back();
			}
		}
	}
	for (int i = 0; i < ans.size(); i++) {
		cout << ans[i];
	}
	return 0;
}

Measured memory_bytes: 3612
#include <iostream>
#include <vector>

using namespace std;

int main(void) {
    int N;
    cin >> N;
    vector<int> B(N-1);
    for(int i=0; i<N-1; i++) {
        cin >> B[i];
    }
    long long int answer = B[0] + B[N-2];
    for(int i=1; i<N-1; i++) {
        answer += min(B[i-1], B[i]);
    }
    cout << answer << endl;
    return 0;
}

Measured memory_bytes: 256
import java.util.*;
public class Main{
	public static void main(String[] args){
    	Scanner sc = new Scanner(System.in);
      String s = sc.next();
      for(char c = 'a';c <= 'z';c++){
      	if(s.indexOf(c)==-1){
        	System.out.println(c);
          return;
        }
      }
      System.out.println("None");
    }
}


Measured memory_bytes: 24728
#include <iostream>

using namespace std;

main(){
  string x;
  cin >> x;
  int apos = x.find_first_of('a');
  int bpos = x.find_first_of('b');
  int cpos = x.find_first_of('c');
  
  if (apos == std::string::npos) {
        cout << "No" << endl;
    }else if(bpos == std::string::npos){
     cout << "No" << endl;   
    }else if(cpos == std::string::npos){
  	cout << "No" << endl;	
  }else{
  cout << "Yes" << endl;}
  return 0;
}

Measured memory_bytes: 256
# atcoder : python3 (3.4.3)
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**6)
mod = 10**9+7

# main
N = int(input())
TXY = [[0,0,0]]+[list(map(int,input().split())) for _ in range(N)]

ans = "Yes"
for i in range(N):
    t0,x0,y0 = TXY[i]
    t1,x1,y1 = TXY[i+1]
    t = t1-t0
    d = abs(x1-x0)+abs(y1-y0)
    if t<d or d%2!=t%2:
        ans = "No"
        break

print(ans)

Measured memory_bytes: 28080
"use strict";
var input = require("fs").readFileSync("/dev/stdin", "utf8");
var cin = input.trim().split(/ |\n/), cid = 0;

var mod = 998244353;
// mod < 2**30, N,M <= 2* 200000 < 2**18
// mod * N < 2**48 < 2**53-1 = Number.MAX_SAFE_INTEGER
// 乗算 with mod
function mul() {
    let max = 2 ** 52;
    for (var a = arguments, r = a[0], i = a.length; --i;) {
        let r1 = (r >> 16) * a[i];
        let r2 = r1 % mod * 65536;
        let r3 = (r & 65535) * a[i];
        if (r1 > max) console.log("over1", r, a[i]);
        if (r2 > max) console.log("over2", r, a[i]);
        if (r3 > max) console.log("over3", r, a[i], i);
        r = (r2 + r3) % mod;
    }
    return r;
}
// 累乗 with mod
function pow(x, y) {
    if (y == 0) return 1;
    if (y == 1) return x;
    let t = pow(x, y >> 1);
    t = mul(t, t);
    if (y & 1) t = mul(t, x);
    //console.log({ x, y, t });
    return t;
}
// 逆元 1/x == x^(mod-2) // 互いに素な場合
function inv(x) {
    if (x == 1) return 1;
    return pow(x, mod - 2);
}
function main() {
    let N = +cin.shift();
    let M = +cin.shift();
    let K = +cin.shift();
    // ans = M * Sigma (C(N-1,K)*(M-1)^(N-K) ) % mod_base
    let y = Array(K + 1).fill(1);
    let z = Array(N).fill(1);
    for (let i = 0; i < K; i++) {
        // y[i + 1] = (y[i] * (N - i - 1) / (i + 1) ) % mod_base;
        //console.log("inv:", i + 1, "->", j);
        y[i + 1] = mul(y[i], N - i - 1, inv(i + 1));
    }
    for (let i = N - 2; i >= 0; i--) {
        //z[N-1]=1, z[N-2]=M-1, z[N-2]=(M-1)**2, ..., z[i]=(M-1)**(N-i), ..., z[0]=(M-1)**N
        z[i] = mul(z[i + 1], M - 1);
    }
    //console.log({ y, z });
    let ans = 0;
    for (let i = 0; i < K + 1; i++) {
        ans += mul(y[i], z[i]);
      	ans = ans % mod;
    }
    ans = mul(M, ans);
    console.log(ans);
}
main();


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

int t;
int n,x,d,h;
int mb,ma;
int a,b;
int ans;

int A[100],B[100],C[100];

int main(){
	cin >> n;
	for (int i = 0 ; i < n; ++i){
		cin >> A[i];
	}
	for (int i = 0 ; i < n; ++i){
		cin >> B[i];
	}
	for (int i =  0; i < n-1; ++i){
		cin >> C[i];
	}


	for (int i = 0 ; i < n; ++i){
		ans += B[A[i]-1];
		if(i==0)continue;
		else if(A[i] == A[i-1]+1){
			ans += C[A[i-1]-1];
		}
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 256
fn get_input() -> String {
    let mut word = String::new();
    std::io::stdin().read_line(&mut word).unwrap();
    word.trim().to_owned()
}

fn main() {
    let n:u64 = get_input().parse().unwrap();
    let mut tasks: Vec<(u64, u64)> = Vec::new();

    for _ in 0..n {
        let line = get_input();
        let mut split = line.split_whitespace();
        let a = split.next().unwrap().parse().unwrap();
        let b = split.next().unwrap().parse().unwrap();
        tasks.push((b, a));
    }

    tasks.sort();

    let mut t = 0;
    let mut ans = "Yes";
    for i in 0..n as usize {
        t += tasks[i].1;
        if t > tasks[i].0 {
            ans = "No";
            break;
        }
    }
    println!("{}", ans);
}

Measured memory_bytes: 9284
#include <stdio.h>
#include <stdbool.h>
int main(){
    int a[3],b[3];
    int c[4]={0,0,0,0};
    bool flag=true;
    for(int i = 0;i<3;i++){
        scanf("%d %d",&a[i],&b[i]);
    }
    for(int i = 0;i<3;i++){
        switch(a[i]%4){
            case 0:
                c[3]++;
                break;
            case 1:
                c[0]++;
                break;
            case 2:
                c[1]++;
                break;
            case 3:
                c[2]++;
                break;
            }
        switch(b[i]%4){
            case 0:
                c[3]++;
                break;
            case 1:
                c[0]++;
                break;
            case 2:
                c[1]++;
                break;
            case 3:
                c[2]++;
                break;
            }
        }
    //ab check
    if(a[0]==a[1]&&b[0]==b[1]){
        flag=false;
    }else if(a[0]==a[2]&&b[0]==b[2]){
        flag=false;
    }else if(a[1]==a[2]&&b[1]==b[2]){
        flag=false;
    }
    if(a[0]==b[1]&&b[0]==a[1]){
        flag=false;
    }else if(a[0]==b[2]&&b[0]==a[2]){
        flag=false;
    }else if(a[1]==b[2]&&b[1]==a[2]){
        flag=false;
    }
    //c check
    for(int i=0;i<4;i++){
        if(c[i]>2){
            flag=false;
        }
        if(c[i]==0){
            flag=false;
        }
    }
    if(flag){
        printf("YES\n");
    }else{
        printf("NO\n");
    }
    return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <vector>
#include <string.h>
#include <stack>
#include <queue>
#include <algorithm>
#include <climits>
#include <cmath>
#include <map>
#include <set>
#include <assert.h>
#define REP(i,n) for(ll i=0;i<(n);i++)
#define MOD 1000000007
#define int long long
#ifdef int
const long long INF = LLONG_MAX / 10;
#else
const int INF = 1010101010;
#endif
using namespace std;
typedef long long ll;
typedef vector<vector<ll> > mat;
typedef pair<int, int> P;
//typedef pair<double, double> P;
const int dx[9] = {-1, 0, 0, 1, -1, -1, 1, 1, 0};
const int dy[9] = {0, -1, 1, 0, -1, 1, -1, 1, 0};

int N, C;
int s, t, c;
int imos1[35][101010];
int imos2[101010];

signed main()
{
  cin >> N >> C;
  REP(i,N) {
    cin >> s >> t >> c;
    imos1[c][s]++;
    imos1[c][t+1]--;
  }
  REP(i,35) {
    bool one = false;
    for (int j=1; j<101010; j++) {
      imos1[i][j] += imos1[i][j-1];
      if (imos1[i][j] == 1 && !one) {
        imos2[j]++;
        one = true;
      } else if (imos1[i][j] == 0 && one) {
        imos2[j]--;
        one = false;
      }
    }
  }
  int ans = 0;
  for (int i=1; i<101010; i++) {
    imos2[i] += imos2[i-1];
    ans = max(ans, imos2[i]);
  }
  cout << ans << endl;
  //REP(i,20) cout << imos[i];
}


Measured memory_bytes: 28672
def insertionSort(S, N):
    for i in range(N):
        v = S[i]
        j = i-1
        while j >= 0 and S[j] > v:
            S[j+1] = S[j]
            j = j-1
        S[j+1] = v
        
        print(' '.join(map(str, S)))
        
        
n = int(input())
s = list(map(int, input().split()))
insertionSort(s, n)


Measured memory_bytes: 5604
let () =
  let third_root q =
    let rec f x =
      let c = x*.x*.x and
          t = 0.00001*.q in
      if c-.q > (t*.(-1.)) && c-.q < t then x
      else
        f (x-.((c-.q)/.(3.*.x*.x)))
    in
    f (q/.2.)
  in
  let rec read () =
    let n = read_float () in
    if n = (-1.) then ()
    else
      begin
        Printf.printf "%f\n" (third_root n);
        read ()
      end
  in read ()
;;

Measured memory_bytes: 2336
#pragma GCC optimize("O3")
#define _CRT_SECURE_NO_WARNINGS
#include <bits/stdc++.h>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
#define M 1000000007
#define M2 998244353
#define ll long long
#define pll pair<long, long>
#define REP(i, a, b) for (ll i = a; i < b; i++)
#define REPI(i, a, b) for (ll i = b - 1; i >= a; i--)
#define ff first
#define ss second
#define pb push_back
#define db pop_back
#define mp make_pair
#define mt make_tuple
#define g(a, b) get<a>(b)
#define INF (ll)1e18 + 100
#define vl vector<ll>
#define vi vector<int>
#define vll vector<pair<ll, ll>>
#define vii vector<pair<int, int>>
#define all(v) v.begin(),v.end()
#define bset(a, p) ((a) | (1ll << (p)))
#define bchk(a, p) ((a) & (1ll << (p)))
#define bxor(a, p) ((a) ^ (1ll << (p)));
#define brem(a, p) (bchk(a, p) ? (bxor(a, p)) : (a))
/*SOME BITMASK KNOWLEDGE
1)x & (x - 1):sets the last one bit of x to zero
power of two exactly when x & (x − 1) = 0.
2)x & -x:sets all the one bits to zero, except last one bit
3)x | (x - 1):inverts all the bits after the last one bit*/
#define endl "\n"
#define p0(a) cout << a << " "
#define p1(a) cout << a << endl
#define p2(a, b) cout << a << " " << b << endl
#define p3(a, b, c) cout << a << " " << b << " " << c << endl
#define p4(a, b, c, d) cout << a << " " << b << " " << c << " " << d << endl

#define o_set tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update>
#define o_setll tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update>
//member functions :
//1. order_of_key(k) : number of elements strictly lesser than k
//2. find_by_order(k) : k-th element in the set

ll modI(ll a, ll m);
ll gcd(ll a, ll b);
ll powM(ll x, unsigned ll y, unsigned ll m);
void pairsort(int a[], int b[], int n);
void pairsortll(ll a[],ll b[],ll n);
ll logint(ll x,ll y);
 
 
ll gcd(ll x,ll y)
{
    if(x==0) return y;
    return gcd(y%x,x);
}
 
ll powM(ll x,ll y,ll m)
{
    if(y==0) return 1;
    ll p=powM(x,y/2,m)%m;
    p=(p*p)%m;
    return (y%2==0)?p:(x*p)%m;
}
 
ll modI(ll a, ll m)
{
   return powM(a, m-2, m);
}
 
void pairsort(int a[],int b[],int n)
{
    pair<int,int> v[n];
    REP(i,0,n)
    {
        v[i].ff=a[i];
        v[i].ss=b[i];
    }
    sort(v,v+n);
    REP(i,0,n)
    {
        a[i]=v[i].ff;
        b[i]=v[i].ss;
    }
}
 
void pairsortll(ll a[],ll b[],ll n)
{
    pair<ll,ll> v[n];
    REP(i,0,n)
    {
        v[i].ff=a[i];
        v[i].ss=b[i];
    }
    sort(v,v+n);
    REP(i,0,n)
    {
        a[i]=v[i].ff;
        b[i]=v[i].ss;
    }
}
 
ll logint(ll x,ll y)
{
    ll ans=0;
    ll a=1;
    for(ll i=0;i<=x;i++)
    {
        if(x<a)
        {
            return ans;
        }
        ans++;
        a*=y;
    }
    return -1;
}
int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    int a,b;
    cin>>a>>b;
    if(a<=9 && b<=9 && a>=1 && b>=1){cout<<a*b;}
    else{cout<<"-1";}
}


Measured memory_bytes: 256
K, A, B = map(int, input().split())
if A + 2 > B:
    print(K+1)
    exit()

if K - (A+1) < 0:
    print(K+1)
    exit()

bis = 0
K = K - (A+1)
bis = B

if B - A >= 2:
    k = K//2
    bis += (B-A)*k

    if K % 2 == 1:
        bis += 1

print(bis)

Measured memory_bytes: 3064
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] stones = new int[n];
        for (int i = 0; i < n; ++i) {
            stones[i] = sc.nextInt();
        }
        int[] dp = new int[n];
        dp[0] = 0;
        dp[1] = Math.abs(stones[1] - stones[0]);
        for (int i = 2; i < stones.length; i++) {
            dp[i] = Math.min(dp[i - 1] + Math.abs(stones[i] - stones[i - 1]), dp[i - 2] + Math.abs(stones[i] - stones[i - 2]));
        }
        System.out.print(dp[n - 1]);
    }
}

Measured memory_bytes: 51180
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll M = 998244353;

int main() {
    int N;
    cin >> N;
    vector<ll> a(N);
    ll ans = 1LL, sum = 0;
    for (int i = 0; i < N; i++) {
        cin >> a[i];
        sum += a[i];
        ans *= 3LL;
        ans %= M;
    }

    vector<vector<ll>> dp(500, vector<ll>(100000, 0));
    vector<vector<ll>> dp2(500, vector<ll>(100000, 0));
    dp[0][0] = dp2[0][0] = 1;
    for (int i = 0; i < N; i++) {
        for (int j = 0; j <= sum; j++) {
            dp[i + 1][j + a[i]] += dp[i][j];
            dp[i + 1][j + a[i]] %= M;
            dp[i + 1][j] += 2 * dp[i][j];
            dp[i + 1][j] %= M;

            dp2[i + 1][j + a[i]] += dp2[i][j];
            dp2[i + 1][j + a[i]] %= M;
            dp2[i + 1][j] += dp2[i][j];
            dp2[i + 1][j] %= M;
        }
    }

    ll x = 0;
    for (int i = (sum + 1) / 2; i <= sum; i++) {
        x += dp[N][i];
        x %= M;
    }

    ans -= 3 * x;
    if (sum % 2 == 0) ans += 3 * dp2[N][sum / 2];

    cout << (ans % M + M) % M << endl;
}

Measured memory_bytes: 785776
#include <stdio.h>

char s[10000];

int main()
{
    char t[] = "YAKI";
    scanf("%s", s);
    for (int i = 0; i < 4; ++ i)
        if (!s[i] || s[i] != t[i])
            return puts("No"), 0;
    puts("Yes");
}

Measured memory_bytes: 128
#include<iostream>
int main() {
	char c;
	std::cin >> c;
	 if (c == 'a') {
		std::cout << "vowel" << std::endl;
	}
	else if (c == 'i') {
		std::cout << "vowel" << std::endl;
	}
	else if (c == 'u') {
		std::cout << "vowel" << std::endl;
	} 
		
	else if (c == 'e') {
		std::cout << "vowel" << std::endl;
	}
	else if (c == 'o') {
		std::cout << "vowel" << std::endl;
	}
	else {
		std::cout << "consonant" << std::endl;
	}
}

Measured memory_bytes: 256
n,a,b=gets.split
n=n.to_i
a=a.to_i
b=b.to_i

array=gets.split.map(&:to_i)


i=0
answer=0

(n-1).times{
    
   answer+=[(array[i+1]-array[i])*a,b].min
    i+=1
}

puts answer

Measured memory_bytes: 11012
#include <iostream>
#include <iomanip>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <algorithm>
#include <cstdio>
#include <utility>
#include <string>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <deque>

using namespace std;

typedef uint64_t u64;
typedef int64_t s64;
typedef uint32_t u32;
typedef int32_t s32;
typedef vector<s32> vs32;
typedef vector<u32> vu32;
typedef vector<s64> vs64;
typedef vector<u64> vu64;

const double PI=3.14159265358979323846;

#define MAX(x, y) ((x) < (y) ? (y) : (x))
#define MIN(x, y) ((x) > (y) ? (y) : (x))

#define rep(i, N) for(int i = 0; i < N; ++i)

#define CEIL(x, y) (((x) + (y) - 1) / (y))
#define MOD 1000000007ULL

#define IN(l, r, x) ((l) <= (x) && (x) < (r))

int h, w;
vector< string > field;
vector< vs32 > d;

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

    cin >> h >> w;

    field.resize(h);
    rep (i, h)
    {
        cin >> field[i];
    }

    d.resize(h, vs32(w, 1e9));
    d[0][0] = (field[0][0] == '#' ? 1 : 0);
    int dy[] = {0, 1};
    int dx[] = {1, 0};
    rep (i, h)
    {
        rep (j, w)
        {
            rep (k, 2)
            {
                int ny = i + dy[k];
                int nx = j + dx[k];
                if (IN(0, h, ny) && IN(0, w, nx))
                {
                    d[ny][nx] = MIN(d[ny][nx], d[i][j] + (field[i][j] == '.' && field[ny][nx] == '#' ? 1 : 0));
                }
            }
        }
    }

    // rep (i, h)
    // {
    //     rep (j, w)
    //     {
    //         cout << d[i][j] << " ";
    //     }
    //     cout << "\n";
    // }

    cout << d[h - 1][w - 1] << "\n";
    return 0;
}



Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int a,n,x,p=0;
    cin>>a>>n;
    while(n--)
    {
        cin>>x;
       p=p+x;
    }
    if(p<a)
        cout<<"No"<<endl;
    else
        cout<<"Yes"<<endl;
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int n,mn=1e9,mx=0;
	int a;
	scanf("%d",&n);
	for(int i=1;i<=n;i++)
	{
		scanf("%d",&a);
		if(a<mn)mn=a;
		if(a>mx)mx=a;
	}
	printf("%d",mx-mn);
}

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

using namespace std;

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

  if (s.length() == 3) {
    int tmp = s[0];
    s[0] = s[2];
    s[2] = tmp;

    cout << s << endl;

  } if (s.length() == 2) {
    cout << s << endl;
  }

  return 0;
}

Measured memory_bytes: 256
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		
        int n = sc.nextInt();
      	long y = sc.nextLong();
      	long lstack,lstack2,lstack3;
      	int ilimit = (int)(y/10000);
      	int jlimit;
      	int num;
      	boolean con = true;
      
      	for(int i = 0;i <= ilimit && con; i++){
       	  lstack = y;	
          lstack -= 10000*i;
          jlimit = (int)lstack/5000;
          for(int j = 0;j <= jlimit && con;j++){
       	    num = j + (int)((lstack-5000*j)/1000);
            if((i+num) == n) {
              System.out.println(i + " " + j + " " + (num-j));
              con = false;
            }                         
          }
        }
	  	if(con) System.out.println("-1 -1 -1");
      
	}
}

Measured memory_bytes: 39328
import sys
import os
import math
import bisect
import collections
import itertools
import heapq
import re
import queue

# import fractions

ii = lambda: int(sys.stdin.buffer.readline().rstrip())
il = lambda: list(map(int, sys.stdin.buffer.readline().split()))
fl = lambda: list(map(float, sys.stdin.buffer.readline().split()))
iln = lambda n: [int(sys.stdin.buffer.readline().rstrip()) for _ in range(n)]

iss = lambda: sys.stdin.buffer.readline().decode().rstrip()
sl = lambda: list(map(str, sys.stdin.buffer.readline().decode().split()))
isn = lambda n: [sys.stdin.buffer.readline().decode().rstrip() for _ in range(n)]

lcm = lambda x, y: (x * y) // math.gcd(x, y)
# lcm = lambda x, y: (x * y) // fractions.gcd(x, y)

MOD = 10 ** 9 + 7
MAX = float('inf')


def main():
    if os.getenv("LOCAL"):
        sys.stdin = open("input.txt", "r")

    A, B, H, M = il()

    a = 30 * H + 30 * (M/60)
    b = 6 * M
    c = abs(a - b)
    print(math.sqrt(A ** 2 + B ** 2 - 2 * A * B * math.cos(math.radians(c))))


if __name__ == '__main__':
    main()


Measured memory_bytes: 10552
#include<iostream>

using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)

int main()
{
  int N,i;
  cin>>N;
  
  int A[N];
  rep(i,N) 
  {
    cin>>A[i];
    if(A[i]%2==0)
    {
      if(A[i]%5==0||A[i]%3==0)
      {
      }
      else
      {
        cout<<"DENIED";
        goto end;
      }
    }
  }
  cout<<"APPROVED";
  end:;
}

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

int main() 
{
	long long int n,tot=0,a;
	cin>>n;
	map<long long int, long long int>mp;
	for(long long int i=0;i<n;i++)
	{
	    cin>>a;
	    tot+=a;
	    mp[a]++;
	}
	long long int q;
	cin>>q;
	while(q--)
	{
	    long long int b,c;
	    cin>>b>>c;
	    tot+=(mp[b]*(c-b));
	    mp[c]+=mp[b];
	    mp[b]=0;
	    cout<<tot<<endl;
	}
	return 0;
}


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

char C[2][3];
 
signed main() {
    cin.tie(0); ios::sync_with_stdio(false);
    rep(i, 2) rep(j, 3) cin >> C[i][j];
    if (C[0][0]==C[1][2] && C[0][1]==C[1][1] && C[0][2]==C[1][0]) cout << "YES" << endl;
    else cout << "NO" << endl;
}

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

#define rep(l, r) for (int i = (l); i < (r); i++)

typedef long long ll;
 
using namespace std;

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

    if (a == b) {
        cout << "Draw";
    } else {
        if (a == 1) cout << "Alice";
        else if (b == 1) cout << "Bob";
        else cout << (a > b ? "Alice" : "Bob");
    }
    cout << endl;

    return 0;
}


Measured memory_bytes: 256
from collections import deque

q = deque()

for i in range(int(input())):
  command_line = input().split(" ")
  command = command_line[0]
  arg = ""
  if len(command_line) > 1: arg = command_line[1]

  if command == "insert":
    q.appendleft(arg)
  elif command == "delete":
    try:
      q.remove(arg)
    except ValueError:
      pass
  elif command == "deleteFirst":
    q.popleft()
  else:
    q.pop()

print(" ".join(q))

Measured memory_bytes: 71972
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define ss second
#define ff first
#define pb push_back
#define mp make_pair

int h[100001];
int n;
string x;
int p;
void go(int idx)
{   int s=0,s1=0;
    bool ok=1;
    for(int i=idx;i<n;i++)
    {
        if(x[i]=='L')
        {
            h[i-1]+=s;
            h[i]+=s1;
            return;
        }
        if(ok)
            s++;
        else
            s1++;
        ok=!ok;
        p=i;
    }
}
void go2(int idx)
{   int s=0,s1=0;
    bool ok=1;
    for(int i=idx;i>=0;i--)
    {
        if(x[i]=='R')
        {
            h[i+1]+=s;
            h[i]+=s1;
            return;
        }
        if(ok)
            s++;
        else
            s1++;
        ok=!ok;
        p=i;
    }
}
int main() {
    cin>>x;
    n=x.size();
    for(int i=0;i<n;i++)
    {
        if(x[i]=='R')
        {
            go(i);
            i=p;
        }

    }
    for(int i=n-1;i>=0;i--)
    {
        if(x[i]=='L')
        {
            go2(i);
            i=p;
        }
    }
    for(int i=0;i<n;i++)
        cout<<h[i]<<' ';
    return 0;
}
//5 1 5 -10 -10 -10 5 7


Measured memory_bytes: 1024
s = []
A = 0
B = 1
C = 2
player = ["A", "B", "C"]
for i in range(3):
    s.append(list(input()))

nextPlayer = 0

while True:
    if len(s[nextPlayer]) == 0:
        print(player[nextPlayer])
        exit()

    tmp = s[nextPlayer].pop(0)
    if tmp == "a":
        nextPlayer = A
    elif tmp == "b":
        nextPlayer = B
    elif tmp == "c":
        nextPlayer = C

Measured memory_bytes: 3064
#include<stdio.h>
int main(void){
   int T, H, S, Ans1, Ans3, AT1, AH1, AS1, AT3, AH3, AS3;
   scanf("%d %d %d", &T, &H, &S);
   while (1) {
      S = T * 3600 + H * 60 + S;
      Ans1 = 2 * 3600 - S;
      Ans3 = 3 * Ans1;
      AT1 = Ans1 / 3600;
      AH1 = Ans1 % 3600 / 60;
      AS1 = Ans1 - AT1 * 3600 - AH1 * 60;
      AT3 = Ans3 / 3600;
      AH3 = Ans3 % 3600 / 60;
      AS3 = Ans3 - AT3 * 3600 - AH3 * 60;

      printf("0%d:", AT1);
      if ( AH1 < 10) printf("0%d:", AH1);
      else printf("%d:", AH1);
      if ( AS1 < 10) printf("0%d\n", AS1);
      else printf("%d\n", AS1);

      printf("0%d:", AT3);
      if ( AH3 < 10) printf("0%d:", AH3);
      else printf("%d:", AH3);
      if ( AS3 < 10) printf("0%d\n", AS3);
      else printf("%d\n", AS3);
      scanf("%d %d %d", &T, &H, &S);
      if ( T == -1 && H == -1 && S == -1 ) break;
   }
   return 0;
}

Measured memory_bytes: 1800
#include <bits/stdc++.h>
#define X first
#define Y second

using namespace std;
typedef long long llint;

const int maxn = 1e6+10;
const int base = 31337;
const int mod = 1e9+7;
const int inf = 0x3f3f3f3f;
const int logo = 20;
const int off = 1 << logo;
const int treesiz = off << 1;

int n;
int niz[maxn];
bool bio[maxn];
bool bio2[maxn];

int main() {
	scanf("%d", &n);
	for (int i = 0; i < n; i++)
		scanf("%d", niz+i);
		
	memset(bio, false, sizeof bio);
	sort(niz, niz+n);
	
	memset(bio2, false, sizeof bio2);
	for (int i = 1; i < n; i++) {
		if (niz[i] == niz[i - 1]) bio2[niz[i]] = true;
	}
	
	int sol = 0;
	for (int i = 0; i < n; i++) {
		if (!bio[niz[i]]) {
			sol += !bio2[niz[i]];
			for (int x = niz[i]; x < maxn; x += niz[i]) bio[x] = true;
		}
	}
	printf("%d", sol);
	return 0;
}



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

using std::cout;
using std::cin;
using std::vector;
using std::sort;

#define INF 999999999;


long long int T, N, K;
vector<long long int> X, dis;
long long int ans;

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

	cin >> T;
	for(int i = 0; i < T; i++){
		cin >> N >> K;
		for(int j = 0; j < N; j++){
			int inn;
			cin >> inn;
			X.push_back(inn);
			if(j > 0){
				ans += X[j] - X[j - 1];
				dis.push_back(X[j] - X[j - 1]);
			}
		}
		ans = X[X.size() - 1] - X[0];
		sort(dis.begin(), dis.end(), [](int a, int b){return a > b;});
		for(int j = 0; j < N - 1 && j < K - 1; j++){
			ans -= dis[j];
		}
		cout << ans << "\n";
		ans = 0;
		X.clear();
		dis.clear();
	}
	return 0;
}




Measured memory_bytes: 4772
#include<stdio.h>
char s[5];
int main(void){
  scanf("%s",&s);
  if(s[0]==s[1] && s[1]==s[2]){
    printf("Yes");
  }else if(s[1]==s[2] && s[2]==s[3]){
    printf("Yes");
  }else{
    printf("No");
  }
  return 0;
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
const int maxn=510;

char buf[1<<15],*fs,*ft;
inline char getc() { return (ft==fs&&(ft=(fs=buf)+fread(buf,1,1<<15,stdin),ft==fs))?0:*fs++; }
template<typename T>inline void read(T &x)
{
    x=0;
    T f=1, ch=getchar();
    while (!isdigit(ch) && ch^'-') ch=getchar();
    if (ch=='-') f=-1, ch=getchar();
    while (isdigit(ch)) x=(x<<1)+(x<<3)+(ch^48), ch=getchar();
    x*=f;
}

char Out[1<<24],*fe=Out;
inline void flush() { fwrite(Out,1,fe-Out,stdout); fe=Out; }
template<typename T>inline void write(T x)
{
    if (!x) *fe++=48;
    if (x<0) *fe++='-', x=-x;
    T num=0, ch[20];
    while (x) ch[++num]=x%10+48, x/=10;
    while (num) *fe++=ch[num--];
    *fe++=' ';
}

int c[maxn],b[maxn],a[maxn*maxn+maxn];
inline bool cmp(int a,int b)
{
	return c[a]<c[b];
}

int main()
{
	int n;read(n);
	for (int i=1; i<=n; ++i) read(c[i]),b[i]=i;
	sort(b+1,b+n+1,cmp);
	int x=1;
	for (int i=1; i<=n; ++i)
	{
		int w=b[i];
		a[c[w]]=w;
		for (int j=1; j<w; ++j)
		{
			while (a[x]) ++x;
			a[x]=w;
		}
		if (x>c[w]) return puts("No"),0;
	}
	for (int i=1; i<=n; ++i)
	{
		int w=b[i];
		for (int j=1; j<=n-w; ++j)
		{
			while (a[x]) ++x;
			if (x<c[w]) return puts("No"),0;
			a[x]=w;
		}
	}
	puts("Yes");
	for (int i=1; i<=n*n; ++i) write(a[i]);
	flush();
	return 0;
}

Measured memory_bytes: 3072
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <list>
#include <cmath>
#include <stack>
#include <string>
#include <cstring>
#include <numeric>
const int inf=1e9+7;
const int mod=1e9+7;
#define YES(i) cout<<(i?"YES":"NO")<<endl
#define Yes(i) cout<<(i?"Yes":"No")<<endl
using namespace std;
//
int main(){
	int n,x;
	int a[100];
	cin>>n>>x;
	for(int i=0;i<n;i++){
		cin>>a[i];
	}
	sort(a,a+n);
	int idx=0;
	int ans=0;
	while(idx<n&&x-a[idx]>=0){
		x-=a[idx];
		idx++;
		ans++;
	}
	if(idx==n&&x>0){
		ans--;
	}
	cout<<ans<<endl;
	return 0;
}

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

// typedef
using ll  = long long;
using str = string;
using lc  = deque<char>;
using vc  = vector<char>;

// Loop
#define REP(i, a, b) for(ll(i) = (a); (i) < (b); (i)++)
#define RREP(i, a, b) for(ll(i) = (a); (i) >= (b); (i)--)
#define rep(i, n) REP(i, 0, n)
#define rrep(i, n) RREP(i, n, 0)

// All
#define ALL(v) v.begin(), v.end()

const char* alpha = "abcdefghijklmnopqrstuvwxyz";


int main(void) {
	ll n;
	lc q;
	cin >> n;
	n--;
	while(n >= 0) {
		q.push_front((char)'a' + (n % 26));
		n /= 26;
		n--;
	}
	while(!q.empty()) {
		cout << q.front();
		q.pop_front();
	}
	cout << endl;
	return 0;
}

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

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

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

#define x1 gray_cat_x1
#define y1 gray_cat_y1

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

#define file "cycle"

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

const int MAXN = 1e5 + 5;

char s[MAXN];

int fl[200];

void solve(){
	scanf("%s", &s[0]);
	for(int i = 0; s[i]; i++){
		fl[s[i]] = 1;
	}
	if (fl['N'] + fl['S'] == 1 || fl['W'] + fl['E'] == 1){
		printf("No\n");
	} else {
		printf("Yes\n");
	}
}	

int main(){

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

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<cstdio>
#include<algorithm>
#include<stack>
#include<queue>
#include<vector>
#include<cmath>
#include<utility>
#include<set>
#include<complex>
#include<map>
#define vi vector<int>
#define vvi vector<vector<int> >
#define ll long long int
#define vl vector<ll>
#define vvl vector<vector<ll>>
#define vb vector<bool>
#define vc vector<char>
#define vs vector<string>
#define ld long double
#define INF 1e9
#define EPS 0.0000000001
#define rep(i,n) for(int i=0;i<n;i++)
#define loop(i,s,n) for(int i=s;i<n;i++)
#define CC puts("-------ok--------");
#define all(in) in.begin(), in.end()
using namespace std;
typedef pair<int, int> pii;
#define MAX 99999999
int main(){
    int n,m;
    cin>>n;vector<pii>v(1001+1);
    rep(i,n)cin>>v[i].first>>v[i].second;
    cin>>m;rep(i,m)cin>>v[i+n].first>>v[i+n].second;
    sort(v.begin(),v.begin()+n+m);
    vb check(n+m,true);
    int l=0;
    rep(i,n+m)rep(j,n+m)if(i!=j&&check[i]&&v[i]==v[j]){check[j]=false;}
    rep(i,n+m)if(check[i]){if(l)cout<<" ";l++;printf("%d:%02d",v[i].first,v[i].second);}
    cout<<endl;
}

Measured memory_bytes: 3256
package main

import (
	"bufio"
	"fmt"
	"io"
	"os"
	"strconv"
)

func main() {
	n := readInt()
	for i := 1; i < 10; i++ {
		if n%i == 0 && n/i < 10 {
			fmt.Println("Yes")
			return
		}
	}
	fmt.Println("No")
}

// sort ------------------------------------------------------------

type xxx struct {
	x int
}

type sortArray []xxx

func (s sortArray) Len() int           { return len(s) }
func (s sortArray) Swap(i, j int)      { s[i], s[j] = s[j], s[i] }
func (s sortArray) Less(i, j int) bool { return s[i].x < s[j].x }

// -----------------------------------------------------------------

var (
	readString func() string
	readBytes  func() []byte
)

func init() {
	readString, readBytes = newReadString(os.Stdin)
}

func newReadString(ior io.Reader) (func() string, func() []byte) {
	r := bufio.NewScanner(ior)
	r.Buffer(make([]byte, 1024), int(1e+11))
	r.Split(bufio.ScanWords)

	f1 := func() string {
		if !r.Scan() {
			panic("Scan failed")
		}
		return r.Text()
	}
	f2 := func() []byte {
		if !r.Scan() {
			panic("Scan failed")
		}
		return r.Bytes()
	}
	return f1, f2
}

func readInt() int {
	return int(readInt64())
}

func readInt64() int64 {
	i, err := strconv.ParseInt(readString(), 10, 64)
	if err != nil {
		panic(err.Error())
	}
	return i
}

func readFloat64() float64 {
	f, err := strconv.ParseFloat(readString(), 64)
	if err != nil {
		panic(err.Error())
	}
	return f
}

func min(a, b int) int {
	if a < b {
		return a
	}
	return b
}

func max(a, b int) int {
	if a > b {
		return a
	}
	return b
}

func abs(a int) int {
	if a < 0 {
		return -a
	}
	return a
}

func sum(a []int) int {
	var ret int
	for i := range a {
		ret += a[i]
	}
	return ret
}

func sumFloat64(a []float64) float64 {
	var ret float64
	for i := range a {
		ret += a[i]
	}
	return ret
}

func gcd(m, n int) int {
	for m%n != 0 {
		m, n = n, m%n
	}
	return n
}

func lcm(m, n int) int {
	return m / gcd(m, n) * n
}


Measured memory_bytes: 640
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#define rep(i,n) for (ll i = 0; i < (n); ++i)
typedef long long ll;
using namespace std;

int main(){
    int h,a; cin >> h >> a;
    if(h%a == 0) cout << h/a << endl;
    else cout << h/a+1 << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <map>

using namespace std;

int main(void)
{
	int n;
	cin >> n;

	int a1[102] = {};
	int a2[102] = {};

	for (int i = 0; i < n; i++)
	{
		cin >> a1[i];
	}
	for (int i = 0; i < n; i++)
	{
		cin >> a2[i];
	}

	int sum1[102] = {};
	int sum2[102] = {};

	sum1[0] = a1[0];

	for (int i = 1; i < n; i++)
	{
		sum1[i] = sum1[i - 1] + a1[i];
	}

	sum2[n - 1] = a2[n - 1];

	for (int i = n - 2; i >= 0; i--)
	{
		sum2[i] = sum2[i + 1] + a2[i];
	}

	int best = 0;

	for (int i = 0; i < n; i++)
	{
		int ans = sum1[i] + sum2[i];

		if (ans > best)
			best = ans;
	}

	cout << best << endl;

	return 0;
}

Measured memory_bytes: 256
def upper(word):
    Word = ''
    str = list(word)
    for i in range(len(str)):
        if str[i].islower(): Word += str[i].upper()
        else: Word += str[i]
    return Word

key_word = str(upper(input()))
sen = []
count = 0
while True:
    a = str(input())
    if a == 'END_OF_TEXT': break
    a = upper(a)
    sen.extend(a.split())
for i in range(len(sen)):
    if sen[i] == key_word:
        count+= 1
print(count)


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

public class Main {

	int INF = 1 << 28;
	int[] cards = new int[13];
	boolean c3, c4;
	boolean p1, p2;
	boolean st;
	
	void run() {
		Scanner sc = new Scanner(System.in);
		for(;sc.hasNext();) {
			c3 = p1 = p2 = st = c4 = false;
			int[] cards = new int[13];
			String[] str = sc.next().split(",");
			for(int i=0;i<5;i++) {
				cards[ Integer.parseInt(str[i])-1 ]++;
			}
			int cnt = 0;
			for(int i=0;i<13;i++) {
				if( cards[i] == 4 ) {
					c4 = true;
				}
				if( cards[i] == 3 ) {
					c3 = true;
				}
				if( p1 && cards[i] == 2 ) {
					p2 = true;
				}
				if( cards[i] == 2 ) {
					p1 = true;
				}
				if(cards[i] > 0 && cards[i] == cards[(i+1)%13]) cnt++;
				if(cnt != 4 && cnt > 0 && cards[i] != cards[(i+1)%13]) cnt = 0;
//				System.out.println(cnt);
			}
			if( c4 ) {
				System.out.println("four card");
			}
			else if(p1 && c3) {
				System.out.println("full house");
			}
			else if(cnt==4) {
				System.out.println("straight");
			}
			else if(c3) {
				System.out.println("three card");
			}
			else if(p2) {
				System.out.println("two pair");
			}
			else if(p1) {
				System.out.println("one pair");
			}
			else {
				System.out.println("null");
			}
		}
	}

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

	void debug(Object... os) {
		System.err.println(Arrays.deepToString(os));
	}
}

Measured memory_bytes: 12000
#include <bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp>
//using namespace __gnu_pbds;
using namespace std;
typedef long long ll;
typedef long double ld;
//typedef tree<int,null_type,less<int >,rb_tree_tag,tree_order_statistics_node_update>indexed_set;
template<class T1, class T2>
ostream &operator <<(ostream &os, pair<T1,T2>&p);
template <class T>
ostream &operator <<(ostream &os, vector<T>&v);
template <class T>
ostream &operator <<(ostream &os, set<T>&v);
template <class T1, class T2>
ostream &operator <<(ostream &os, map<T1,T2>&v);
#ifdef APURBA
#define debug(a) cout<<#a<<" --> "<<(a)<<"\n";
#define debug2(a) cout<<#a<<" --> "<<(a)<<" ";
#define HERE cout<<"here - "<<__LINE__<<"\n";
#else
#define debug(a)
#define debug2(a)
#define HERE
#endif
const ll mod = 1e9+7;
const int N = 1e5+5;
typedef pair<ll,ll> pii;

pii read()
{
    string s;
    cin>>s;
    ll p = 0 , q = 1;
    bool dot = false;
    for(int i=0;i<s.size();i++)
    {
        if(s[i]=='.')
        {
            dot = true;
            continue;
        }
        ll now= s[i]-'0';
        p= (p*10) + now;
        if(dot)
        {
            q= q*10;
        }
    }
    return make_pair(p,q);
}
void TEST_CASES(int cas)
{
    ll n;
    scanf("%lld",&n);
    map<pii, ll>mp;
    ll ans = 0;
    for(ll i=0; i<n; i++)
    {
        pii tmp = read();
        ll p = tmp.first ;
        ll q = tmp.second;
        //debug(p);
        //debug(q);
        ll c1 =0, c2 =0;
        while(p%2==0)
        {
            c1++;
            p/=2;
        }
        while(p%5==0)
        {
            c2++;
            p/=5;
        }
        while(q%2==0)
        {
            c1--;
            q/=2;
        }
        while(q%5==0)
        {
            c2--;
            q/=5;
        }
        for(auto it:mp)
        {
            ll dui = it.first.first, pach= it.first.second;
            if(dui+c1>=0 && pach + c2>=0)
            {
                ans+= (ll)it.second;
            }
        }
        mp[make_pair(c1,c2)]++;
    }
    printf("%lld\n",ans);


}


/*

*/

int main()
{
    //freopen("input.txt","r",stdin);
    //freopen("output.txt","w",stdout);
    int t=1,cas=0;
    //scanf("%d",&t);
    while(t--)
    {
        TEST_CASES(++cas);
    }
    return 0;
}



//os.order_of_key(v): returns how many elements strictly less than v
//os.find_by_order()

template<class T1, class T2>
ostream &operator <<(ostream &os, pair<T1,T2>&p)
{
    os<<"{"<<p.first<<", "<<p.second<<"} ";
    return os;
}
template <class T>
ostream &operator <<(ostream &os, vector<T>&v)
{
    os<<"[ ";
    for(int i=0; i<v.size(); i++)
    {
        os<<v[i]<<" " ;
    }
    os<<" ]";
    return os;
}

template <class T>
ostream &operator <<(ostream &os, set<T>&v)
{
    os<<"[ ";
    for(T i:v)
    {
        os<<i<<" ";
    }
    os<<" ]";
    return os;
}
template <class T1, class T2>
ostream &operator <<(ostream &os, map<T1,T2>&v)
{
    for(auto i:v)
    {
        os<<"Key : "<<i.first<<" , Value : "<<i.second<<endl;
    }
    return os;
}


Measured memory_bytes: 3764
n = int(input())
b = list(map(int, input().split()))

b_cur = b
sol = []
while b_cur:
    for i in reversed(range(len(b_cur))):
        if b_cur[i] == i+1:
            sol.append(b_cur[i])
            b_cur = b_cur[:i] + b_cur[i+1:]
            break
    else:
        sol = False
        break
if sol:    
    for i in reversed(sol):
        print(i)
else:
    print(-1)
    

Measured memory_bytes: 3060
unittest
{
	assert( [ "16" ].parse.expand.solve == "pon" );
	assert( [ "2" ].parse.expand.solve == "hon" );
	assert( [ "183" ].parse.expand.solve == "bon" );
}



import std.conv;
import std.range;
import std.stdio;
import std.typecons;

void main()
{
	stdin.byLineCopy.parse.expand.solve.writeln;
}

auto parse( Range )( Range input )
if( isInputRange!Range && is( ElementType!Range == string ) )
{
	auto n = input.front.to!( dchar[] );
	return tuple( n );
}

auto solve( dchar[] n )
{
	if( n[ $ - 1 ] == '2' || n[ $ - 1 ] == '4' || n[ $ - 1 ] == '5' || n[ $ - 1 ] == '7' || n[ $ - 1 ] == '9' ) return "hon";
	if( n[ $ - 1 ] == '0' || n[ $ - 1 ] == '1' || n[ $ - 1 ] == '6' || n[ $ - 1 ] == '8' ) return "pon";
	return "bon";
}


Measured memory_bytes: 2736
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, srt, end) for (long long i = (srt); i < (long long)(end); i++)

int main(){
    ll N;
    cin >> N;
    string s[2];
    cin >> s[0] >> s[1];
    constexpr ll mod = 1e9+7;
    ll i, ans;
    bool one;
    if(s[0][0] == s[1][0]){
        one = true;
        i = 1;
        ans = 3;
    }else{
        one = false;
        i = 2;
        ans = 6;
    }
    while(i < N){
        if(s[0][i] == s[1][i]){
            i += 1;
            if(one) ans *= 2;
            else ans *= 1;
            one = true;
        }else{
            i += 2;
            if(one) ans *= 2;
            else ans *= 3;
            one = false;
        }   
        ans %= mod;
    }
    cout << ans << endl;
    return 0;
}

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

// #define int long long
#define rep(i, n) for (int i = (int)(0); i < (int)(n); ++i)
#define reps(i, n) for (int i = (int)(1); i <= (int)(n); ++i)
#define rrep(i, n) for (int i = ((int)(n)-1); i >= 0; i--)
#define rreps(i, n) for (int i = ((int)(n)); i > 0; i--)
#define irep(i, m, n) for (int i = (int)(m); i < (int)(n); ++i)
#define ireps(i, m, n) for (int i = (int)(m); i <= (int)(n); ++i)
#define SORT(v, n) sort(v, v + n);
#define REVERSE(v, n) reverse(v, v+n);
#define vsort(v) sort(v.begin(), v.end());
#define all(v) v.begin(), v.end()
#define mp(n, m) make_pair(n, m);
#define cout(d) cout<<d<<endl;
#define coutd(d) cout<<std::setprecision(10)<<d<<endl;
#define cinline(n) getline(cin,n);
#define replace_all(s, b, a) replace(s.begin(),s.end(), b, a);
#define PI (acos(-1))
#define FILL(v, n, x) fill(v, v + n, x);
#define sz(x) int(x.size())

using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using pii = pair<int, int>;
using pll = pair<ll, ll>;

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; }

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

signed main()
{
  cin.tie( 0 ); ios::sync_with_stdio( false );
  ll n; cin>>n;
  vll a(n);
  rep(i,n) cin>>a[i],a[i]--;
  
  ll ans=0;
  rep(i,n-1){
    if(a[i]==i) {
      swap(a[i],a[i+1]);
      ans++;
    }
  }
  if(a[n-1]==n-1) ans++;
  cout<<ans<<endl;
}

Measured memory_bytes: 1024
import sys
def input(): return sys.stdin.readline().strip()
def mapint(): return map(int, input().split())
sys.setrecursionlimit(10**9)

class UnionFind():
    def __init__(self, n):
        self.n = n
        self.parents = [-1] * n

    def find(self, x):
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]

    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)

        if x == y:
            return

        if self.parents[x] > self.parents[y]:
            x, y = y, x

        self.parents[x] += self.parents[y]
        self.parents[y] = x

    def size(self, x):
        return -self.parents[self.find(x)]

    def same(self, x, y):
        return self.find(x) == self.find(y)

    def members(self, x):
        root = self.find(x)
        return [i for i in range(self.n) if self.find(i) == root]

    def roots(self):
        return [i for i, x in enumerate(self.parents) if x < 0]

    def group_count(self):
        return len(self.roots())

N, K, L = mapint()
uf_road = UnionFind(N)
for _ in range(K):
    x, y = mapint()
    uf_road.union(x-1, y-1)

uf_rail = UnionFind(N)
for _ in range(L):
    x, y = mapint()
    uf_rail.union(x-1, y-1)
from collections import Counter
lis = []
for i in range(N):
    road = uf_road.find(i)
    rail = uf_rail.find(i)
    lis.append((road, rail))
c = Counter(lis)

ans = []
for i in range(N):
    road = uf_road.find(i)
    rail = uf_rail.find(i)
    ans.append(str(c[(road, rail)]))
print(' '.join(ans))


Measured memory_bytes: 138240
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int,int>;
int main() {
    int a, b, c, x, y;
    cin >> a >> b >> c >> x >> y;
    int c1 = a*x + b*y;
    int c2 = 2*c*min(x,y) + ((x<y)?(y-x)*b:(x-y)*a);
    int c3 = 2*c*max(x,y);
    //printf("%d %d %d\n",c1,c2,c3);
    cout << min(c1, min(c2, c3));
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int num = sc.nextInt();
        int numOfEven = num / 2;
        int numOfOdd = num - numOfEven;
        System.out.println(numOfEven * numOfOdd);
    }
}

Measured memory_bytes: 24020