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

#define ll long long
#define vvi vector<vector<int>>
#define vec vector
#define pq priority_queue
#define all(v) (v).begin(), (v).end()
#define rep(i, n) for (int (i) = (0); (i) < (n); ++(i))
#define repp(i, m, n) for (int (i) = (m); (i) < (n); ++(i))
#define debug(x) cerr << #x << ": " << x << endl;
#define debug2(x, y) cerr<<"("<<#x<<", "<<#y<<") = "<<"("<<x<<", "<<y<<")"<<endl;
#define debug3(x, y, z) cerr<<"("<<#x<<", "<<#y<<", "<<#z<<") = "<<"("<<x<<", "<<y<<", "<<z<<")"<<endl;
#define debugB(x, y) cerr<<#x<<": "<<bitset<y>(x) << endl;
#define line() cerr << "---------------" << endl;

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

template<typename T>
void printA(vector<T> &printArray, char between = ' ') {
   int paSize = printArray.size();
   for (int i = 0; i < paSize; i++) { cerr << printArray[i] << between;}
   if (between != '\n') {cerr << endl;}
}

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

ll v[100009];
int n;

bool bin(int key) {
   int left = 0, right = n;
   while (left <= right) {
      int mid = (left + right) / 2;
      if (v[mid] > key) {
         right = mid-1;
      } else if (v[mid] < key) {
         left = mid+1;
      } else {
         return true;
      }
   }
   return false;
}

int main() {
   cin >> n;
   rep (i, n) cin >> v[i];
   sort(v, v+n);
   int q;
   cin >> q;
   int cnt = 0;
   rep (i, q) {
      int x;
      cin >> x;
      if (bin(x)) cnt++;
   }
   cout << cnt << endl;

   return 0;
}


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

using namespace std;

template <class T>inline T updmax(T& a, T b) {return a = max(a, b);}
template <class T>inline T updmin(T& a, T b) {return a = min(a, b);}

template <unsigned long long mod> class modint {
public:
	unsigned long long v;
	modint(const long long x = 0) : v(x % mod) {}
	modint operator+(const modint rhs) { return modint(*this) += rhs; }
	modint operator-(const modint rhs) { return modint(*this) -= rhs; }
	modint operator*(const modint rhs) { return modint(*this) *= rhs; }
	modint operator/(const modint rhs) { return modint(*this) /= rhs; }
	modint operator-() { return modint(mod - this->v); }
	modint& operator+=(const modint rhs) {
		v += rhs.v;
		if (v >= mod) v -= mod;
		return *this;
	}
	modint& operator-=(const modint rhs) {
		if (v < rhs.v) v += mod;
		v -= rhs.v;
		return *this;
	}
	modint& operator*=(const modint rhs) {
		v = v * rhs.v % mod;
		return *this;
	}
	modint inverse(modint a) {
		unsigned long long exp = mod - 2;
		modint ret(1ULL);
		while (exp) {
			if (exp % 2) { ret *= a; }
			a *= a;
			exp >>= 1;
		}
		return ret;
	}
	modint& operator/=(modint rhs) {
		(*this) *= inverse(rhs);
		return *this;
	}
	friend ostream& operator<<(ostream& os, modint& u) {
		os << u.v;
		return (os);
	}
	friend istream& operator>>(istream& is, modint& u) {
		is >> u.v;
		return (is);
	}
};

const int MOD = 1000000007;
using mint = modint<MOD>;

class Solution {
public:
	void solve() {
		int n;
		cin >> n;
		vector<long long> a(n, 0);
		mint ans{0};
		for(int i=0; i<n; i++)cin >> a[i];
		for(int i=0; i < 60; i++){
			mint cnt{0};
			for(int j=0; j < n; j++){
				if((a[j] >> i)&1)cnt += 1;
			}
			ans += (cnt * (mint{n}-cnt)) * (1ll << i);
		}
		cout << ans << "\n";
		return;
	};
};

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(nullptr);
	Solution solution;
	solution.solve();
	return 0;
}

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

using namespace std;

int main(){

char s[17];

int a,b;

	for (int i = 0;i < 9;i++){
	
		cin >> s >> a >> b;
		
		cout << s << " ";
		
		cout << a + b << " ";
		
		cout << a * 200 + b * 300 << endl;
		
	}
	
return 0;

}
	


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

int main()
{
  string s;
  vector<bool> a(3, false);
  string ans = "Yes";
  cin >> s;
  for (int i = 0; i < 3; i++)
    a[s[i] - 'a'] = true;
  for (int i = 0; i < 3; i++)
  {
    if (!a[i])
      ans = "No";
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
#[allow(unused_macros)]
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)*}
    };
}
 
#[allow(unused_macros)]
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)*}
    };
 
    ($next:expr, mut $var:ident : $t:tt $($r:tt)*) => {
        let mut $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}
 
#[allow(unused_macros)]
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, bytes) => {
        read_value!($next, String).into_bytes()
    };
 
    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };
 
    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

fn main() {
    input! {
        s: chars,
        t: chars,
    }
    
    let s_rev: Vec<char> = s.into_iter().rev().collect();
    let t_rev: Vec<char> = t.into_iter().rev().collect();

    let pos = find_match(&s_rev, &t_rev);



    //出力
    if pos.is_none() {
        println!("UNRESTORABLE");
        return;
    }
    let position = pos.unwrap();

    let mut ans = String::new();

    for i in 0..position {
        if s_rev[i] == '?' {
            ans.push('a');
        } else {
            ans.push(s_rev[i]);
        }
    }

    for c in &t_rev {
        ans.push(*c);
    }

    for i in position +t_rev.len()..s_rev.len() {
        if s_rev[i] == '?' {
            ans.push('a');
        } else {
            ans.push(s_rev[i]);
        }
    }

    for c in ans.chars().rev() {
        print!("{}", c);
    }
    println!("");

}

fn find_match(s: &Vec<char>, t: &Vec<char>) -> Option<usize> {
    if s.len() < t.len() {
        return None;
    }
    let mut count = 0;
    for i in 0..s.len()-t.len()+1 {
        for (j, k) in (i..i+t.len()).enumerate() {
            if s[k] != '?' && s[k] != t[j]{
                break;
            }
            count = count + 1;
        }
        if count == t.len() {
            return Some(i);
        } 
        count = 0;
    }

    None
}


Measured memory_bytes: 4352
x,y=map(int,input().split())
c=0
for i in range(0,x+1):
    if y==2*(x-i)+4*i:
        c+=1
        print("Yes")
        break
    elif y==2*i+4*(x-i):
        c+=1
        print("Yes")
        break
if c==0:
    print("No")

Measured memory_bytes: 9188
N,M = map(int,input().split())
H = [int(i) for i in input().split()]
AB = []
for m in range(M):
    AB.append([int(i) for i in input().split()])
from collections import defaultdict as ddict
R = ddict(list)
for ab in AB:
    R[ab[0]].append(ab[1])
    R[ab[1]].append(ab[0])
ans = 0
for n in range(1,N+1):
    highest = True
    for r in R[n]:
        if H[n-1] <= H[r-1]:
            highest = False
            break
    if highest:
        ans += 1
print(ans)

Measured memory_bytes: 47132
#include<bits/stdc++.h>
#include<string>
#include<map>
using namespace std;
int main()
{
    long long int t,n,a,b,x,y,m,i,j,k,l,cnt,flag,flag1;
    cin>>n;
    long long int arr[n+5];
    map<long long int,long long int>mp;

    for(i=0; i<n-1; i++)
    {
        cin>>arr[i];
        mp[arr[i]]++;

   }

   for(j=1;j<=n;j++)
   {
    map<long long int,long long int>::iterator it=mp.begin();
      if(j==(it->first))
      {
          cout<<it->second<<endl;
          mp.erase(it);
      }
      else
      {
          cout<<"0"<<endl;
      }


   }


    return 0;
}



Measured memory_bytes: 17688
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n)   FOR(i,0,n)
#define pb emplace_back
typedef long long ll;
typedef pair<int,int> pint;

int main(){
    int q;
    ll a,b;
    cin>>q;
    rep(i,q){
        cin>>a>>b;
        if(a>b) swap(a,b);
        if(b-a<=1){
            cout<<a*2-2<<endl;
        }
        else{
            ll c=sqrt(a*b);
            if(c*c==a*b) --c;
            if(c*(c+1)>=a*b){
                cout<<c*2-2<<endl;
            }
            else cout<<c*2-1<<endl;
        }
    }
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <string>
#include <map>
#include <numeric>
#include <bitset>
#include <vector>
#include <queue>

using namespace std;

typedef long long ll;
#define FOR(i,a,b)   for(ll i = (a); i < (b); i++ )
#define REP(i, n)    FOR(i,0,n)
typedef pair< ll, ll >   cp2;
typedef pair< ll, cp2 >   cp3;
#define fi first
#define se second
#define sec  se.fi
#define thr  se.se
const ll mod = 1000000007;
//              123456789

 
///////////////////////////////////////////////
//
//
///////////////////////////////////////////////

////////////////////////////////////////////////
////////////////////////////////////////////////

int N, M, K, S;
int c; 
cp2 ma[11234];
cp2 mi[11234];
ll ans;

int main() {
	
	while( cin>>N>>M, (N||M) ){
		REP( i, 11234 ){
			mi[i] = cp2( 0, i );
			ma[i] = cp2( 0, i );
		}
		REP( i, M ){
			cin>>S>>K;
			REP( i, K ){
				cin>>c;
				ma[c].fi += S;
			}
			if( K == 1 ) mi[c].fi += S;
		}
		sort( ma+1, ma+N+1, greater<cp2>() );
		sort( mi+1, mi+N+1 );
		if( ma[1].se == mi[1].se ){
			ans = max( (ma[1].fi-mi[2].fi), (ma[2].fi-mi[1].fi) ) + 1;
		}
		else{
			ans = ma[1].fi-mi[1].fi+1;
		}
		//cout<<"@ ";
		cout<<ans<<endl;
	}
}



Measured memory_bytes: 3428
S = input()
N = len(S)
ans = ""
flag = ""
ans2 = ""

if(N==1):
  if(S == "?"):
    print("D")
  else:
    print(S)
else:
  for i in range(N):
    if(S[i] == "?"):
      flag += "1"
      ans += "D"
    else:
      flag += "0"
      ans += S[i]
  for i in range(N):
    if(i==0):
      if(ans[i+1] == "D" and flag[i] == "1"):
        ans2 += "P"
      else:
        ans2 += ans[i]
    elif(i==N-1):
      ans2 += ans[i]
    else:
      if(ans2[i-1] == "D" and ans[i+1] == "D" and flag[i] == "1"):
        ans2 += "P"
      else:
        ans2 += ans[i]
  print(ans2)

Measured memory_bytes: 10056
// ARC091A.cpp
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

int n, m;

int main()
{
    scanf("%d%d", &n, &m);
    if (n > m)
        swap(n, m);
    if (n == 1)
    {
        if (m == 1)
            puts("1");
        else
            printf("%d\n", max(0, m - 2));
        return 0;
    }
    printf("%lld\n", max(0LL, 1LL * (n - 2) * (m - 2)));
    return 0;
}

Measured memory_bytes: 256
N = int(input())
*A, = map(int, input().split())

cnt_neg = sum(a < 0 for a in A)
cnt_zero = A.count(0)

if cnt_zero or cnt_neg % 2 == 0:
    print(sum(abs(a) for a in A))
else:
    print(sum(abs(a) for a in A)-2*min(abs(a) for a in A))


Measured memory_bytes: 88844
N = int(input())

A = map(int, input().split())

ones = [0] * 60
m = 10 ** 9 + 7

for Ai in A:
    for digit in range(60):
        ones[digit] += ((Ai >> digit) & 1)

res = 0
for i, num in enumerate(ones):
    res += (1 << i) * num * (N - num)

print(res % m)


Measured memory_bytes: 122808
while 1:
    INF = 10**9
    N, K = map(int, input().split())
    if N == K == 0:
        break
    E = [[INF]*N for i in range(N)]
    for i in range(N):
        E[i][i] = 0
    ans = []
    for i in range(K):
        q, *c = map(int, input().split())
        if q == 0:
            a, b = c
            cost = E[a-1][b-1]
            if INF <= cost:
                ans.append(-1)
            else:
                ans.append(cost)
        else:
            c, d, e = c
            if e < E[c-1][d-1]:
                E[c-1][d-1] = E[d-1][c-1] = e
                Ec = E[c-1]; Ed = E[d-1]
                for i in range(N):
                    Ei = E[i]
                    Eic = Ei[c-1] + e
                    Eid = Ei[d-1] + e
                    for j in range(i+1, N):
                        Ei[j] = E[j][i] = min(Ei[j], Eic + Ed[j], Eid + Ec[j])
    print(*ans, sep='\n')



Measured memory_bytes: 6344
#include <iostream>
#include<cstdlib>
#include<queue>
#include<set>
#include<vector>
#include<string>
#include<cmath>
#include<algorithm>
#include<stack>
#include<map>
#include<deque>
#include<cstdio>
using namespace std;
#define rep(i,a) for(int i=0;i<a;i++)
#define mp make_pair
#define pb push_back
#define ll __int64
#define __int64 long long
#define P pair<int,int>

int n;
string s;


bool ok(string tmp){
    //cout<<tmp<<endl;
    int cnt=0;
    rep(i,s.size()){

        if(s[i]==tmp[cnt])cnt++;
        if(cnt==3)
            return 1;
    }
    return 0;
}

int main(void){
    int ans=0;
    cin>>n>>s;

    rep(i,10){

        rep(j,10){

            rep(k,10){
                string tmp="";
                tmp+=(char)(i+'0');
                tmp+=(char)(j+'0');
                tmp+=(char)(k+'0');
                if(ok(tmp))
                    ans++;
            }
        }
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
 
int main (void)
 
{
 
char in[1001];
 
int out,i;
 
for(;;)
 
{
 
scanf("%s",in);
 
if(in[0]=='0')
 
{
 
return 0;
 
}
 
out=0;
 
for(i=0;in[i]!='\0';i++)
 
{
 
out+=in[i]-'0';
 
}
 
printf("%d\n",out);
 
}
 
}

Measured memory_bytes: 536
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int arr[5];
    for(int i=0;i<5;i++){
        cin>>arr[i];
    }
    int k;
    cin>>k;
    int flag=0;
    for(int i=0;i<4;i++){
        for(int j=i+1;j<5;j++){
            if(arr[j]-arr[i]>k){ flag=1; break; }
        }
        if(flag==1) break;
    }
    if(flag) cout<<":(";
    else cout<<"Yay!";
}

Measured memory_bytes: 256
n = int(input())
b = list(map(int, input().split()))
a = [b[0], b[0]]
c = b[0]
d = b[0]
for i in range(1, n - 1):
  if b[i] >= a[i]:
    a.append(b[i])
  else:
    a[i] = b[i]
    a.append(b[i])
print(sum(a))

Measured memory_bytes: 3188
N, L = map(int,input().split())
import statistics
S = []
for i in range(L,N+L):
    S.append(i)
ans = []
p = []
for j in S:
    ans.append(abs(sum(S) - sum(S) - j))
    p.append(sum(S)-j)

print(p[ans.index(min(ans))])

Measured memory_bytes: 5140
#include <bits/stdc++.h>
using namespace std;
#define all(x) (x).begin(),(x).end()
 
int main(){
    int a,b,c,a0,b0,c0,a1,b1,c1,count=0;
    cin>>a>>b>>c;
    a0=a; b0=b; c0=c;
    while(a%2==0 and b%2==0 and c%2==0){
        a1=a; b1=b; c1=c;
        a=(b1+c1)/2; b=(c1+a1)/2; c=(a1+b1)/2;

        count++;
        if(a==a0 and b==b0 and c==c0){ cout<<-1; return 0;}
    }
    cout<<count;

    return 0;
}


Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(){
	int n;
	cin >> n;
	int a[n];
	for(int i=0; i<n; i++){
		cin >> a[i];
	}
	if(n<=1){
		cout << "Yes";
		return 0;
	}
	if(a[0]==a[1]+1) a[0]--;
	else if(a[0]>a[1]+1){
		cout << "No";
		return 0;
	}
	for(int i=1; i<n; i++){
		if(a[i]<a[i-1]){
			cout << "No";
			return 0;
		}
		if(a[i]>a[i-1]) a[i]--;
	}
	cout << "Yes";
}

Measured memory_bytes: 640
N = int(input())
C = input()

ans = 0
left = 0
right = N -1
while left < right:
    if C[right] == "W":
        right -= 1
        continue
    if C[left] == "R":
        left += 1
        continue
    if C[left] == "W" and C[right] == "R":
        ans += 1
        right -= 1
        left += 1

print(ans)

Measured memory_bytes: 67528
package main

import (
	"fmt"
	"sort"
	)

	
func main() {
	var n int
	fmt.Scan(&n)
	m:=make([]int,n)
	c:=make([]int,0,n)
	
	for i:=0;i<n;i++{
		var ai int
		fmt.Scan(&ai)
		m[i] = ai
	}

	
	for i:=0;i<n;i++{
		k := sort.Search(len(c), func(j int)bool{return c[j]<m[i]})
		if k == len(c){
			c= append(c,m[i])
		} else {
			c[k]=m[i]
		}
	}

	fmt.Println(len(c))
}


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

#define rep(i,n) for(int (i)=0;(i)<(int)(n);(i)++)
#define rept(i,n) for(int (i)=0;(i)<=(int)(n);(i)++)
#define reps(i,s,n) for(int (i)=(s);(i)<(int)(n);(i)++)
#define repst(i,s,n) for(int (i)=(s);(i)<=(int)(n);(i)++)
#define repr(i,n) for(int (i)=(n);(i)>=0;(i)--)
#define each(itr,v) for(auto (itr):(v))
#define all(c) (c).begin(),(c).end()
#define pb push_back
#define mp(x,y) make_pair((x),(y))
#define fi first
#define se second
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)
#define ln "\n"
#define show(x) cout << #x << " = " << x ln
#define dbg(x) cout<<#x"="<<x ln

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vector<int> > mat;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

const int inf = (int)1e9;
const ll linf = (ll)1e18;
const int mod = (int)(1e9+7);
const int dx[] = {0, 1, 0, -1};
const int dy[] = {1, 0, -1, 0};
const int ddx[] = {0, 1, 1, 1, 0, -1, -1, -1};
const int ddy[] = {1, 1, 0, -1, -1, -1, 0, 1};

struct oreno_initializer {
	oreno_initializer() {
		cin.tie(0);
		ios::sync_with_stdio(0);
	}
} oreno_initializer;

// ━━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…
// .｡.:( ^ω^)・ﾟ＋.｡.:( ^ω^)・ﾟ＋.｡.:( ^ω^)・ﾟ＋.｡.:( ^ω^)・ﾟ＋.｡.:( ^ω^)・ﾟ＋
// ・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・

string s;
int l;

int main() {
	cin >> s;
	l = (int)s.length();
	if (l%2==0) l = l/2-1;
	else l = l/2;
	repr(i,l) {
		if (s.substr(0,i) == s.substr(i,i)) {
			cout << i*2 << ln;
			return 0;
		}
	}
}

Measured memory_bytes: 256
import java.io.*;

public class Main {
	public static void main(String[] args) throws Exception {
		String s="";
		BufferedReader bf = new BufferedReader(new InputStreamReader(System.in));
		int t[] = new int[19];
		for(int i=0;i<9;i++)t[i]=t[18-i]=i+1;t[9]=10;
		while((s = bf.readLine())!=null){
			int n = Integer.parseInt(s);
			int a=0;for(int i=0;i<19;i++)if(n>=i && (n-i)<19)a+=t[i]*t[n-i];
			System.out.println(a);
		}
	}
}

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

int main(){
    string s;
    cin >>s;
    int a=0;
    int n=s.size();
     for(int i=0;i<n;i++){
        if (s[i]=='+'){
        a++;
    }
    else{
        a--;
    }     
}
    
    
   cout <<a;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)n; i++)
#define all(x) (x).begin(), (x).end()
#define int long long
#define double long double

main(){
	int n,k;
  cin>>n>>k;
  vector<int>a(n);
  rep(i,n) cin>>a[i];
  if((n-1)%(k-1)==0)cout<<(n-1)/(k-1)<<endl;
  else cout<<(n-1)/(k-1)+1<<endl;
}


Measured memory_bytes: 1024
#include<bits/stdc++.h>
#define vi vector<int>
#define vvi vector<vector<int> >
#define vl vector<ll>
#define vvl vector<vector<ll>>
#define vb vector<bool>
#define vc vector<char>
#define vs vector<string>
using ll = long long;
using ld =long double;
//#define int ll
#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 all(in) in.begin(), in.end()
template<class T, class S> void cmin(T &a, const S &b) { if (a > b)a = b; }
template<class T, class S> void cmax(T &a, const S &b) { if (a < b)a = b; }
#define MAX 9999999
using namespace std;
typedef pair<int, int> pii;
typedef pair<int,pii> piii;
#define mp make_pair
signed main(){
    int n,k;cin>>n>>k;
    vector<int>v(n);rep(i,n)cin>>v[i];
    sort(all(v),greater<int>());
    int ans=0;
    rep(i,k)ans+=v[i];
    cout<<ans<<endl;
}


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

int f[100][100];
int e[100][100];

int main(){
	int n,m;
	while(cin >> n >> m && n){
		for(int i = 0 ; i < n ; i++)
			for(int j = 0 ; j < n ; j++)
				cin >> f[i][j];
		for(int i = 0 ; i < m ; i++)
			for(int j = 0 ; j < m ; j++)
				cin >> e[i][j];
		
		pair<int,int> ans(1e7,1e7);
		
		for(int r = 0 ; r < 4 ; r++){
			for(int i = 0 ; i < n - m + 1 ; i++){
				for(int j = 0 ; j < n - m + 1 ; j++){
					int flag = 1;
					int X=-1,Y;
					for(int k = 0 ; k < m ; k++){
						for(int l = 0 ; l < m ; l++){
							if(f[i+k][j+l] != e[k][l] && e[k][l] != -1){
								flag = false;
							}
							if(e[k][l] != -1 && X == -1){
								Y = i+k;
								X = j+l;
								//cout << X << " " << Y << endl;
							}
						}
					}
					if( flag ) ans = min( ans , make_pair(Y,X) );
				}
			}
			for(int i = 0 ; i < m ; i++)
				for(int j = i+1 ; j < m ; j++)
					swap(e[i][j],e[j][i]);
			for(int i = 0 ; i < m ; i++)
				for(int j = 0 ; j < m/2 ; j++)
					swap(e[i][j],e[i][m-j-1]);
		}
		if( ans.first > 1e6 ) cout << "NA" << endl;
		else cout << ans.second+1 << " " << ans.first+1 << endl;
	}
}

Measured memory_bytes: 936
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define zero_pad(num) setfill('0') << std::right << setw(num)
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<int, int>;

int main() {
    int n, a, b;
    cin >> n >> a >> b;
    int ans = 0;
    for(int i = 1; i <= n; i++){
        string s = to_string(i);
        int sum = 0;
        rep(j, (int)s.size()){
            sum += s[j] - '0';
        }
        if(a <= sum && sum <= b) ans += i;
    }
    cout << ans << endl;
}

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

int main() {
  long long s, t;
  cin >> s;
  t = s;
  int d;
  for(int i=0; i<100; i++) {
    if(s != 0)
      s /= 10;
    else {
      d = i;
      break;
    }
  }
  int ans = fabs(t % 1000 - 753);
  
  for(int i=0; i<d-2; i++) {
    int temp = fabs(t % 1000 - 753);
    if(temp < ans)
      ans = temp;
    t /= 10;
  }
  
  cout << ans << endl;
}

Measured memory_bytes: 256
#include <algorithm>
#include <cstdlib>
#include<iostream>
#include<vector>
#include<map>
#include<cmath>
using namespace std;
int r,g,b;

int main(int argc, char const *argv[])
{
    cin>>r>>g>>b;
    if((g*10+b)%4==0){
        cout<<"YES"<<endl;
    }else{
        cout<<"NO"<<endl;
    }
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
#define deb(x) cout<<#x<<" "<<x<<endl;
#define print(arr,n) for(int i=0;i<n;++i) { cout<<arr[i]<<" "; } cout<<endl;
#define ub(x,el) upper_bound(x.begin(),x.end(),el) - x.begin()
#define lb(x,el) lower_bound(x.begin(),x.end(),el) - x.begin();
#define bs(x,el) binary_search(x.begin(),x.end(),el)
#define MOD 1000000007
#define finish return 0
using namespace std;
using namespace __gnu_pbds; 
typedef long long int ll;
typedef tree<ll, null_type,less<ll>, rb_tree_tag,tree_order_statistics_node_update> ordered_set;
template<int D, typename T> struct Vec : public vector<Vec<D - 1, T>> { static_assert(D >= 1, "Vector dimension must be greater than zero!"); template<typename... Args> Vec(int n = 0, Args... args) : vector<Vec<D - 1, T>>(n, Vec<D - 1, T>(args...)) { }}; template<typename T> struct Vec<1, T> : public vector<T> { Vec(int n = 0, T val = T()) : vector<T>(n, val) { } };
inline ll mod(ll x) { return (x%MOD + MOD)%MOD; }
ll gcd(ll a, ll b, ll &x, ll &y){if(a == 0){x = 0, y = 1; return b;} ll x1, y1;  ll d = gcd(b%a, a, x1, y1); x = y1 - (b/a) * x1; y = x1; return d;}
ll power(ll x,ll y, ll p) { ll res = 1; x = x % p; while (y > 0) { if (y & 1) res = (res*x) % p; y = y>>1; x = (x*x) % p;   } return res; } 
ll power(ll x,ll y) { ll res = 1; while (y > 0) { if (y & 1) res = (res*x); y = y>>1; x = (x*x);   } return res; } 
ll mod(ll num, ll den){ return mod(mod(num) * power(den,MOD-2,MOD)); }
void bt(ll i, vector< pair< pair<ll,ll>, pair<ll,ll> > > &v, ll n, ll m, ll &ans, vector<ll> &temp)
{
    if(i==n)
    {
        ll co = 0;
       // print(temp,temp.size());
        for(auto prs:v)
        {
            auto a = prs.first.first;
            auto b = prs.first.second;
            auto c = prs.second.first;
            auto d = prs.second.second;
            if(temp[b-1]-temp[a-1] == c) co+=d;
        }
        //deb(co);
        ans = max(ans, co);
        return;
    }
    ll beg = 1;
    if(i-1>=0) beg = temp[i-1];
    for(ll j=beg;j<=m;++j)
    {
        temp[i] = j;
        bt(i+1,v,n,m,ans,temp);
    }
}
int main()
{
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
	ll n,m,q;
    cin>>n>>m>>q;
    vector< pair< pair<ll,ll>, pair<ll,ll> > > v;
    for(ll i=0;i<q;++i)
    {
        ll a,b,c,d;
        cin>>a>>b>>c>>d;
        v.push_back({{a,b},{c,d}});
    }
    ll ans = 0;
    vector<ll> temp(n);
    bt(0,v,n,m,ans, temp);
    cout<<ans<<endl;
}

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

using namespace std;

const double PI = 3.141592653589;
#define fastio ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define pb push_back
#define mp make_pair
#define int long long
#define all(c) (c).begin(),(c).end()
#define M 1000000007
#define INF LLONG_MAX
#define pr(...) dbs(#__VA_ARGS__, __VA_ARGS__)
template <class T> void dbs(string str, T t) {cerr << str << " : " << t << "\n";}
template <class T, class... S> void dbs(string str, T t, S... s) {int idx = str.find(','); cerr << str.substr(0, idx) << " : " << t << ", "; dbs(str.substr(idx + 1), s...);}
template <class S, class T>ostream& operator <<(ostream& os, const pair<S, T>& p) {return os << "(" << p.first << ", " << p.second << ")";}
template <class T>ostream& operator <<(ostream& os, const vector<T>& p) {os << "[ "; for (auto& it : p) os << it << " "; return os << "]";}
template <class T>ostream& operator <<(ostream& os, const set<T>& p) {os << "[ "; for (auto& it : p) os << it << " "; return os << "]";}
template <class S, class T>ostream& operator <<(ostream& os, const map<S, T>& p) {os << "[ "; for (auto& it : p) os << it << " "; return os << "]";}
template <class T> void prc(T a, T b) {cerr << "["; for (T i = a; i != b; ++i) {if (i != a) cerr << ", "; cerr << *i;} cerr << "]\n";}
// Use pr(a,b,c,d,e) or cerr<<anything or prc(v.begin(),v.end()) or prc(v,v+n)
//  


int32_t main()
{
    fastio;
    //freopen("file.in", "r", stdin);
    //freopen("file.out", "w", stdout);
    char c;
    cin >> c;
    cout << (char)((c+1-'a')%26 + 'a') << "\n";
    return 0;
}



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

vector<pair<ll, ll>> primeFactorization(ll n) {
    vector<pair<ll, ll>> result;
    for (ll i = 2; i * i <= n; i++) {
        ll num = 0;
        while (n % i == 0) {
            n /= i;
            num++;
        }
        if (num != 0) {
            result.push_back({ i, num });
        }
    }

    if (n != 1) {
        result.push_back({ n, 1 });
    }

    return result;
}

int main() {
    ll N;
    cin >> N;
    vector<ll> num(N + 1, 0);
    for (ll i = 2; i <= N; i++) {
        for (auto p : primeFactorization(i)) {
            num[p.first] += p.second;
        }
    }

    ll ans = 0;
    for (ll i = 2; i <= N; i++) {
        //1つ
        if (num[i] >= 74) {
            ans++;
        }

        for (ll j = i + 1; j <= N; j++) {
            //2つ
            ans += (num[i] >= 2 && num[j] >= 24);
            ans += (num[i] >= 24 && num[j] >= 2);
            ans += (num[i] >= 4 && num[j] >= 14);
            ans += (num[i] >= 14 && num[j] >= 4);

            for (ll k = j + 1; k <= N; k++) {
                //3つ
                ans += (num[i] >= 2 && num[j] >= 4 && num[k] >= 4);
                ans += (num[i] >= 4 && num[j] >= 2 && num[k] >= 4);
                ans += (num[i] >= 4 && num[j] >= 4 && num[k] >= 2);
            }
        }

    }

    cout << ans << endl;
}

Measured memory_bytes: 256
/* {{{ */
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};
    ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($iter, $t);
        input_inner!{$iter $($r)*}
    };
}

macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };
    ($iter:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
    };
    ($iter:expr, chars) => {
        read_value!($iter, String).chars().collect::<Vec<char>>()
    };
    ($iter:expr, usize1) => {
        read_value!($iter, usize) - 1
    };
    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}
/* }}} */

fn main() {
    input! {
        n: usize,
        k: u32,
        h: [u32;n]
    }
    println!("{}",
        h.iter().filter(|&x| *x >= k).count());
}
/* vim:set foldmethod=marker: */


Measured memory_bytes: 4352
import math
while True:
    zero_counter = 0
    num = int(input())
    if num == 0:
        break
    splited_num = list(str(math.factorial(num)))

    for i in reversed(splited_num):
        if i == "0":
            zero_counter += 1
        else:
            break

    print(zero_counter)



Measured memory_bytes: 6312
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> P;
typedef pair<ll, P> P3;
typedef pair<P, P> PP;
constexpr ll MOD = ll(1e9 + 7);
constexpr int IINF = INT_MAX;
constexpr ll LLINF = LLONG_MAX;
constexpr int MAX_N = int(1e5) + 5;
constexpr double EPS = 1e-9;
constexpr int di[] = {0, 1, 0, -1}, dj[] = {1, 0, -1, 0};
#define REP(i, n) for (int i = 0; i < n; i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define SORT(v) sort((v).begin(), (v).end())
#define SORTR(v) sort((v).rbegin(), (v).rend())
#define ALL(v) (v).begin(), (v).end()




int main() {
    string s, t;
    cin >> s >> t;
    int cnt = 0;
    for(int i=0;i<3;i++){
        if(s[i]==t[i])cnt++;
    }
    cout << cnt << endl;
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#define max(a, b) a>b?a:b
#define MOD 1000000007
using namespace std;

int hgrid(const int m, const int n){
    int grid[m+1][n+1];
    char inp;

    for(int i = 0; i < m; i++){
        for(int j = 0; j < n; j++){
            cin>>inp;
            if(inp == '.')
                grid[i][j] = 0;
            else if(inp == '#')
                grid[i][j] = -1;
        }
    }

    grid[0][0] = 1;
    for(int i = 0; i < m; i++){
        for(int j = 0; j < n; j++){
            if(i == 0 && j ==0)
                continue;
            if(grid[i][j] != -1){
                if(grid[i-1][j] != -1 && i > 0)
                    grid[i][j] = (grid[i][j] + grid[i-1][j]) % MOD;
                if(grid[i][j-1] != -1 && j > 0)
                    grid[i][j] = (grid[i][j] + grid[i][j-1]) % MOD;
            }
        }
    }
    return grid[m-1][n-1];
}

int main(){
    int M, N;
    cin >> M >> N;
    cout << hgrid(M, N);
    return 0;
}

Measured memory_bytes: 7456
#include <iostream>
#include <vector>
#include <deque>
#include <set>
#include <cmath>
#include <bits/stdc++.h>
#include <limits>

#define MOD 1000000007

using namespace std;

int main(void){
    // Your code here!
    long long n;
    long long power = 1;
    
    cin >> n;
    for(int i = 1; i <= n; i++)
        power = (power * i) % MOD;
        
    cout << power << endl;
    
    return 0;
}

Measured memory_bytes: 256
def read_input():
    n = int(input())
    return n

def submit():
    n = read_input()

    acc = 1
    limit = 10**9 + 7
    for i in range(1, n + 1):
        acc *= i

        if acc > limit:
            acc %= limit

    print(acc)


if __name__ == '__main__':
    submit()


Measured memory_bytes: 38512
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		int x;
		Scanner scan = new Scanner(System.in);
	    x = scan.nextInt();


	    //?????£????????????(int)
	    System.out.println( (int)Math.pow(x, 3) );
	    
	   

	}

}

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


int32_t main() {
	ios_base :: sync_with_stdio(0); cin.tie(0); cout.tie(0);
	vector <string> v;
	int n, l; cin >> n >> l;
	for(int i = 0; i < n; i++) {
		string str; cin >> str;
		v.push_back(str);
	} sort(v.begin(), v.end());

	for(auto x: v) {
		cout << x;
	}

} 

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cstring>
#include<string>
#include<vector>
#include<queue>
#include<stack>
#include<cmath>
#include<map>
#include<list>
#include<set>
using namespace std;

int main(){
  char a[200],b[100],c[200];
  cin >> a;
  cin >> b;
  strcpy(c,a);
  strcat(c,a);
  if(strstr(c,b)){
    cout << "Yes" << endl;
  }else{
    cout << "No" << endl;
  }
  return 0;
}



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

using namespace std;
typedef long long ll;
typedef pair<int, int> i_i;
typedef pair<ll, ll> l_l;
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
#define int ll
//const ll mod = 1000000007;

int ans, a, b, c;

signed main() {
    cin >> a >> b;
    c = 1;
    while (c < b) {
        c += a - 1;
        ans++;
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<map>
#include<set>
#include<utility>
#include<cmath>
#include<cstring>
#include<queue>
#include<cstdio>
#define loop(i,a,b) for(int i=a;i<b;i++) 
#define rep(i,a) loop(i,0,a)
#define pb push_back
#define mp make_pair
#define all(in) in.begin(),in.end()
const double PI=acos(-1);
const double EPS=1e-10;
const int inf=1e9;
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int,int> pii;
vi x,y;
int n,a,b,c,d;
bool f(int q,int nx,int ny,double t){
	if(q==(1<<n)-1)return 1;
	rep(i,n)if((q&1<<i)==0&&(hypot(nx-x[i],ny-y[i])+t+EPS>hypot(c-x[i],d-y[i])))return 0;
	rep(i,n)if((q&1<<i)==0&&f(q^1<<i,x[i],y[i],t+hypot(nx-x[i],ny-y[i])))return 1;
	return 0;
}
int main(){
	while(cin>>n,n){
		cin>>a>>b>>c>>d;
		y=x=vi(n);
		rep(i,n)cin>>x[i]>>y[i];
		cout<<(f(0,a,b,0)?"YES":"NO")<<endl;
	}
	cin>>n>>n>>n>>n;
}

Measured memory_bytes: 1220
#include<bits/stdc++.h>
using namespace std;
int main(){
  int a,n=0;string s;cin>>s;
  a=s.size();
  for(int i=0;i<a-1;i++){
    if(s.at(i)=='C'){
      for(int j=i+1;j<a;j++){
        if(s.at(j)=='F'){
          n=1;
          break;
        }
      }
    break;
    }
  }
  if(n==1)cout<<"Yes"<<endl;
  else cout<<"No"<<endl;
}

Measured memory_bytes: 256
S = int(input())
S_list = []
while S > 0:
    S_list.append(S%10)
    S //= 10 
S_list.reverse()

love = 753
_min = 114514

for i in range(len(S_list)-2):
	a = 100*S_list[i] + 10*S_list[i+1] + S_list[i+2]
	dif = abs(love-a)
	_min = min(dif, _min)

print(_min)

Measured memory_bytes: 3064
from fractions import gcd
from functools import reduce
 
def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)
 
    divisors.sort()
    return divisors
 
def gcds(n):
    return reduce(gcd, n)
 
n=int(input())
a=list(map(int, input().split()))
a=sorted(a)
# print(a)
m1=a[0]
m2=a[1]
ans=1
divm2=make_divisors(m2)
divm2.reverse()
divm1=make_divisors(m1)
divm1.reverse()
divs=list(set(divm1+divm2))
divs.sort()
divs.reverse()
ans=1
for i in divs:
    count=0
    for j in a:
        if j%i != 0:
            count+=1
        if count>=2:
            break
    if count<=1:
        ans=i
        break
print(ans)


Measured memory_bytes: 16508
# -*- coding: utf-8 -*-
N = int(input())
P = list(map(int, input().split()))
ans=1
if N!=1:
    M=P[0]
    for i in range(1,N,1):
        M=min(P[i],M)
        if P[i] ==M:
            ans+=1
print(ans)

Measured memory_bytes: 24744
#include<bits/stdc++.h>
#define ALL(v) v.begin(), v.end()
// greater<int>()
typedef long long ll;
ll GCD(ll x, ll y) { return y ? GCD(y, x%y) : x; }
ll LCM(ll x, ll y) { return x * y / GCD(x, y); }

using namespace std;


int main() {
	int a,b;
	cin >> a >> b;
	
	if (a < b) {
		for (int i = 0; i < b; i++)
		{
			cout << a;
		}
	}
	else {
		for (int i = 0; i < a; i++)
		{
			cout << b;
		}
	}

	

}


Measured memory_bytes: 384
func readInts() -> [Int] {
    return readLine()!.split(separator: " ").map { Int($0)! }
}

func main() {
    let N = Int(readLine()!)!
    
    var (t_, x_, y_) = (0, 0, 0)
    for _ in 1...N {
        let line = readInts()
        let t = line[0]
        let x = line[1]
        let y = line[2]
        
        let dT = t - t_
        let dX = abs(x - x_)
        let dY = abs(y - y_)
        
        if dT < dX + dY {
            print("No")
            return
        }
        
        if dT % 2 != (dX + dY) % 2 {
            print("No")
            return
        }
        
        (t_, x_, y_) = (t, x, y)
    }
    
    print("Yes")
}

main()


Measured memory_bytes: 8200
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define ALL(x) (x).begin(), (x).end() //sortなどの引数を省略
 
int main(){
  ll n, m;
  cin >> n >> m;
  vector<ll> h(n+1);
  vector<ll> a(m+1), b(m+1);
  for(ll i = 1; i <= n; i++){
    cin >> h.at(i);
  }
  ll ans[n+1]={};
  
  for(ll i = 1; i <= m; i++){
    cin >> a.at(i) >> b.at(i);
    ll result=0;
    result = max(h[a[i]], h[b[i]]);
    //cout << i<< result <<endl;
    if(result == h[a[i]]){
      ans[b[i]]=1;   
    }else{
      ans[a[i]]=1;
    }
    if(h[a[i]] == h[b[i]]){
      ans[a[i]]=1;
      ans[b[i]]=1;
    }
  }
  ll cnt = 0;
  for(ll i = 1; i <= n; i++){
    //cout << i << ans[i] << endl;
    if(ans[i] == 0){
      cnt++;
    }
  }
  cout << cnt;
}

Measured memory_bytes: 6428
use proconio::input;
use proconio::marker::Usize1;
use superslice::*;

enum Op {
    Add,
    Replace(usize, u64),
}

fn dfs(
    ls: &mut Vec<usize>,
    lis: &mut Vec<u64>,
    stack: &mut Vec<Op>,
    es: &Vec<Vec<usize>>,
    ais: &Vec<u64>,
    u: usize,
    p: usize,
) {
    for &v in es[u].iter() {
        if v == p {
            continue;
        }

        let a = ais[v];
        let &last_a = lis.last().unwrap();
        if last_a < a {
            lis.push(a);
            stack.push(Op::Add);
        } else {
            let i = lis[..].lower_bound(&a);
            let b = lis[i];
            lis[i] = a;
            stack.push(Op::Replace(i, b));
        }
        ls[v] = lis.len();

        dfs(ls, lis, stack, es, ais, v, u);

        match stack.pop().unwrap() {
            Op::Add => {
                lis.pop();
            }
            Op::Replace(i, b) => {
                lis[i] = b;
            }
        }
    }
}

fn main() {
    input! {
        n: usize,
        ais: [u64; n],
        uvs: [(Usize1, Usize1); n - 1],
    };

    let mut es = vec![vec![]; n];
    for (u, v) in uvs {
        es[u].push(v);
        es[v].push(u);
    }

    let mut ls = vec![0_usize; n];
    let mut lis = vec![];
    let mut stack = vec![];
    ls[0] = 1;
    stack.push(Op::Add);
    lis.push(ais[0]);
    dfs(&mut ls, &mut lis, &mut stack, &es, &ais, 0, 0);

    for l in ls {
        println!("{}", l);
    }
}


Measured memory_bytes: 52612
class Edge
  attr_accessor :s, :t, :d
  def initialize(arr)
    self.s = arr[0]
    self.t = arr[1]
    self.d = arr[2]
  end
end

v, e, r = gets.strip.split(' ').map(&:to_i)

es = []

e.times do
  edge = Edge.new(gets.strip.split(' ').map(&:to_i))
  es << edge
end

d = Array.new(v, Float::INFINITY)
d[r] = 0;

loop do
  update = false
  e.times do |i|
    edge = es[i]
    if d[edge.s] == Float::INFINITY
      next
    end
    dd = d[edge.s] + edge.d
    if d[edge.t] > dd
      d[edge.t] = dd
      update = true
    end
  end

  break unless update
end

d.each do |i|
  if i == Float::INFINITY
    puts "INF"
  else
    puts i
  end
end

Measured memory_bytes: 54992
import java.util.Scanner;

public class Main {
	public static void main(String args[]) {
		Scanner sc = new Scanner(System.in);
		long a = sc.nextLong();
		long b = sc.nextLong();
		long ans = 0;
		long x = a*b;
		if(a<b) {
			long tmp = a;
			a = b;
			b = tmp;
		}
		long r = a%b;
		while(r!=0) {
			a = b;
			b = r;
			r = a % b;
		}
		ans = x/b;
		System.out.println(ans);
	}
}


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

int main()
{
    double w,h,x,y;
    cin >> w >> h >> x >> y;
    double s = w * h / 2;
    
    cout << fixed << setprecision(15);
    cout << s << " ";
    cout << (x==w/2 && y==h/2 ? "1" : "0") << endl;
    return 0;
}

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

int main() {
    ios::sync_with_stdio(false);
    //freopen("input.txt", "r", stdin);

   int a, b, c; cin >> a >> b >> c;
   cout << a*b/2 << endl;

    return 0;
}


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

typedef long long int ll;
typedef vector<int> vi;            typedef vector<ll> vl;
typedef vector<vi> vvi;         typedef vector<vl> vvl;
typedef pair<int, int>     pii;    typedef pair<ll, ll> pll;
typedef vector<pii> vii;         typedef vector<pll> vll;
typedef map<int,int> mii;
typedef vector<char> vc;
typedef vector<bool> vb;
#define endl '\n'
#define forn(i,n) for(int i=0;i<n;i++)
#define rforn(i,n) for(int i=n-1;i>=0;i--)
#define forne(i,n) for(int i=1;i<=n;i++)
#define rforne(i,n) for(int i=n;i>=1;i--)
#define forse(i,s,e) for(int i=s;i<e;i++)
#define rforse(i,s,e) for(int i=e-1;i>=s;i--)
#define all(x) x.begin(),x.end()
#define sz(x) (ll)x.size()
#define MOD 998244353
#define F first
#define S second
#define pb push_back
#define pf push_front
#define rb pop_back
#define rf pop_front
#define in insert
#define mp make_pair
#define fill(a,x) memset(a,x,sizeof a);
#define trav(a,x) for(auto &a:x)
#define min3(a, b, c) min(min(a, b), c)
#define min4(a, b, c, d) min(min(a, b), min(c, d))
#define max3(a, b, c) max(max(a, b), c)
#define max4(a, b, c, d) max(max(a, b), max(c, d))
const ll INFL = 1e18;
const int INFI = 1e9;
#ifdef KARAN
    #include "../../trace.h"
#else
    #define trace(args...)
#endif

ll div_floor(const ll &a,const ll &b) { return a / b - (((a ^ b) < 0) and a % b);}
ll div_ceil(const ll &a,const ll &b) { return a / b + (((a ^ b) >= 0) and a % b);}
ll modpow(ll a, ll b, ll m = MOD){a %= m; ll res = 1; 
    while (b) {if (b & 1)res = (res * a) % m; a = (a * a) % m; b >>= 1;} return res;}
ll bpow(ll a, ll b){ll res = 1; while (b) {if (b & 1)res = res * a; a = a * a; b >>= 1;} return res;}
ll modinv(ll a, ll m = MOD) {return modpow(a, m - 2, m);}
void graph(vvi &adj, int m) {int x, y; forn(i, m){cin>>x>>y; adj[--x].pb(--y); adj[y].pb(x);}}

void solve(){
    ll n, s; cin>>n>>s;
    vl a(n+1); forne(i, n) cin>>a[i];
    vvl dp(n+1, vl(s+1, 0));
    ll inv2 = modinv(2);
    forne(i, n){
        forn(j, s+1){
            dp[i][j] += dp[i-1][j];
            if(j + a[i] <= s) dp[i][j + a[i]] += (dp[i-1][j] * inv2)%MOD;
        }
        forn(j, s+1)
            dp[i][j] %= MOD;
        if(a[i]<=s) dp[i][a[i]] += inv2;
    }
    ll ans = (dp[n][s]*modpow(2, n))%MOD;
    cout<<ans<<endl;
}

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    #ifdef KARAN
        freopen("inp.txt", "r", stdin);
        freopen("out.txt", "w", stdout);
        freopen("err.txt", "w", stderr);
    #endif
    // init();
    int t=1;
    // cin>>t;
    while(t--)
        solve();
}

Measured memory_bytes: 73688
#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>;

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

int main(){
    ll n;
    cin>>n;
    vector<ll>x=divisor(n);
    int ans=0;
    rep(i,x.size()){
        if(x[i]==1)continue;
        ll m=n;
        while(m%x[i]==0){
            m/=x[i];
        }
        if(m%x[i]==1)ans++;
    }
    ans+=divisor(n-1).size()-1;
    cout<<ans<<endl;
}

Measured memory_bytes: 3632
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n; i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
typedef long double ld;
int main()
{
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  int a,b;
  cin >> a >> b;
  if(a==1) a+=13;
  if(b==1) b+=13;
  if(a>b) puts("Alice");
  else if(a<b) puts("Bob");
  else puts("Draw");
  return 0;
}


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

#define endl "\n"
#define sc(a) scanf("%d ",&a);
#define ssc(a,b) scanf("%d %d ",&a,&b);
#define mp(a,b) make_pair(a,b)
#define pb(x) push_back(x)
#define all(a) a.begin(),a.end()
#define forn(i,n) for(int i=0;i<n;i++)
#define forq(i,q,n) for(int i=q;i<n;i++)
#define form(i,n) for(int i=n;i>=0;i--)
#define forp(i,q,n) for(int i=q;i>=n;i--)
#define fi first
#define se second
#define INF 1000000010
#define MOD 1000000007
#define MAXN
#define long long ll;


using namespace std;

set<string>st;

void init(){
	string s;
	string b = " ";  
	getline(cin, s);
	//st.insert(s);
	s.erase(s.begin()+5);
	s.insert(5,b);
	s.erase(s.begin()+13);
	s.insert(13,b);
	cout << s;
}

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

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef unsigned long long ULL;
typedef long long LL;
#define FOR(i, a, b) for(LL i=(LL)(a);i<(LL)(b);i++)
#define REP(i,x) for(LL i=0;i<(LL)(x);i++)
#define MOD_PRIME = 1e9 + 7;

LL sub(LL x, LL k)
{
    LL diff_one = 0;
    if(x > k)
    {
        diff_one = x - k;
    }
    else
    {
        diff_one = k - x;
    }

    if(x > diff_one)
    {
        // 1回で引く量
        LL diff2 = x - diff_one;
        // 何回連続で引けるか
        LL temp = x / diff2;
        LL diff = x - temp * diff2;
        return sub(diff, k);
    }
    else
    {
        return x;
    }

    return x;
}
int main()
{
    ios::sync_with_stdio(false);
    cin.tie(NULL);
    // cout << fixed << setprecision(10);
    LL n, k;
    cin >> n >> k;

    cout << sub(n, k) << endl;
    return 0;
}



Measured memory_bytes: 256
#include<stdio.h>
int wa(int a){
  int ans = 0;
  while(a > 0){
    ans += a % 10;
    a /= 10;
  }
  return ans;
}

int main(){
  int n,a,b,ans = 0;
  scanf("%d %d %d",&n,&a,&b);
  for(int i = 1;i <= n;i++){
    int s = wa(i);
    if(a <= s && s <= b){
      ans += i;
    }
  }
  printf("%d",ans);
  return 0;
}

Measured memory_bytes: 128