akhauriyash/Code-Regression huggingface dataset:
// Problem : G - Longest Path
// Contest : AtCoder - Educational DP Contest
// URL : https://atcoder.jp/contests/dp/tasks/dp_g
// Memory Limit : 1024 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

#include<bits/stdc++.h>
using namespace std;
#define int         long long
#define ull 		unsigned long long
#define ll 			long long
#define MM			1000000007
#define N			100005
#define pb 			push_back
#define p_q 		priority_queue
#define pii         pair<ll,ll>
#define vi          vector<ll>
#define vii         vector<pii>
#define mi          map<ll,ll>
#define mii         map<pii,ll>
#define all(a)      (a).begin(),(a).end()
#define sz(x)       (ll)x.size()
#define endl        '\n'
#define Endl        '\n'
#define gcd(a,b)    __gcd((a),(b))
#define lcm(a,b)    ((a)*(b)) / gcd((a),(b))
#define ios	    	ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define mp 			make_pair
#define lb 			lower_bound
#define ub			upper_bound
#define F           first
#define S           second
#define rep(i, begin, end) for(int i=begin;i<end;i++)
#define repr(i,begin,end) for(int i=end-1;i>=begin;i--)
#define ini(a,n,b)	for(ll int i=0;i<n;i++) a[i]=0;
#define cset(a)		__builtin_popcountll(a)
#define hell 		(ull)1e9
#define re 			resize
 
 int n,m,dp[N];
 vector<int> adj[N];
 bool vis[N];
 void dfs(int s)
 {    
     vis[s]=1;
     for(int j:adj[s])
     {
         if(!vis[j]) dfs(j);
         dp[s]=max(dp[s],dp[j]+1);
     }
 }
 
signed main(void)
{ios
	int TESTS=1;
	//cin>>TESTS;
	while(TESTS--)
	{
		cin>>n>>m;
		rep(i,0,m)
		{
		    int x,y;
		    cin>>x>>y;
		    adj[x].pb(y);
		}
		rep(i,1,n+1) if(!vis[i]) dfs(i);
		int ans=0;
		rep(i,1,n+1) ans=max(ans,dp[i]);
		//cout<<sz(start)<<' ';
		cout<<ans;
	}
}

Measured memory_bytes: 12612
#[allow(unused_imports)]
use proconio::{input, fastout};
#[allow(unused_imports)]
use proconio::marker::{Chars};

#[fastout]
fn main() {
  input!{x:i64}
  if x>=30 {
    println!("Yes")
  } else{
    println!("No")
  }
}


Measured memory_bytes: 2200
#include <stdio.h>

using namespace std;

int main() {
    int a, b;
    scanf("%d %d", &a, &b);
    if(a>b) {
        printf("a > b\n");
    } else if (a==b){
        printf("a == b\n");
    } else if (a<b){
        printf("a < b\n");
    }
}


Measured memory_bytes: 2560
#include <bits/extc++.h>
#include <bits/stdc++.h>
using namespace std;
#define _rep(n, a, b) for (ll n = (a); n <= (b); ++n)
#define _rev(n, a, b) for (ll n = (a); n >= (b); --n)
#define _for(n, a, b) for (ll n = (a); n < (b); ++n)
#define _rof(n, a, b) for (ll n = (a); n > (b); --n)
#define oo 0x3f3f3f3f3f3f
#define ll long long
#define db double
#define eps 1e-3
#define bin(x) cout << bitset<10>(x) << endl;
#define what_is(x) cerr << #x << " is " << x << endl
#define met(a, b) memset(a, b, sizeof(a))
#define all(x) x.begin(), x.end()
#define pii pair<ll, ll>
#define pdd pair<db, db>
const ll mod = 1e9 + 7;
const ll maxn = 1e3 + 10;
vector<ll> a;
signed main()
{

   ll n, k;
   cin >> k >> n;
   a.resize(n+1);
    _rep(i, 1, n){
        cin >> a[i];
    }
    ll res = 0;
    _rep(i, 2, n){
        res = max(res, a[i] - a[i-1]);
    }
    res = max(a[1] + k - a[n], res);
    cout << k - res << endl;
}


Measured memory_bytes: 1792
using System;

namespace Sample1
{
    class Program
    {
        static void Main(string[] args)
        {
            string input = Console.ReadLine();
            int a = int.Parse(input.Split(' ')[0]);
            int b = int.Parse(input.Split(' ')[1]);
            double af = a;
            double bf = b;
            Console.WriteLine("{0} {1} {2}",
                a / b,
                a % b,
                (af / bf).ToString("0.00000000"));
        }
    }
}

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

int main()
{
	int months[12] = { 31 , 29 , 31 , 30 , 31 , 30 , 31 , 31 , 30 , 31 , 30 , 31 } ;

	int getmonth , getday ;

	while( cin >> getmonth >> getday )
	{
		if( getmonth == 0 ){ break ; }

		getmonth -- ;
		while( getmonth > 0 )
		{
			getday += months[getmonth-1] ;
			getmonth -- ;
		}

		if( getday %7 == 0 )
		{
			cout << "Wednesday" << endl ;
		}
		else if( getday %7 == 1 )
		{
			cout << "Thursday" << endl ;
		}
		else if( getday %7 == 2 )
		{
			cout << "Friday" << endl ;
		}
		else if( getday %7 == 3 )
		{
			cout << "Saturday" << endl ;
		}
		else if( getday %7 == 4 )
		{
			cout << "Sunday" << endl ;
		}
		else if( getday %7 == 5 )
		{
			cout << "Monday" << endl ;
		}
		else if( getday %7 == 6 )
		{
			cout << "Tuesday" << endl ;
		}
	}
	return 0 ;
}

Measured memory_bytes: 1160
import java.util.Scanner;

public class Main{
  public void keisan(int n,int a) {
    boolean k = false;
    
    for (int i = 0; i < 100; i ++) {
      for ( int j = 0; j <= a; j++) {
        int r = j + i *500;
        if (n == r) {
          k = true;
          break;
        }
      }
    }
    if (k) System.out.println("Yes");
    else System.out.println("No");
  }

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

    String N = scan.next();
    String A = scan.next();

    int n = Integer.parseInt(N);
    int a = Integer.parseInt(A);

    Main main = new Main();
    
    main.keisan(n,a);
  }
}

Measured memory_bytes: 23252
#include<bits/stdc++.h>
using namespace std;
long long len;
long long f[30];
char a[200010];
int main() {
	scanf("%s",a);
	long long len=strlen(a);
	for (int i=0;i<len;i++)
	 f[a[i]-'a']++;
	long long ans=len*(len-1)/2; 
	for (int i=0;i<26;i++)
	 ans-=f[i]*(f[i]-1)/2;
	printf("%lld\n",ans+1); 
}

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

namespace ABC080_A
{
    class Program
    {
        static void Main(string[] args)
        {
            var NAB = Console.ReadLine().Split().Select(int.Parse).ToArray();
            var p1 = NAB[0] * NAB[1];
            Console.WriteLine(p1 < NAB[2] ? p1 : NAB[2]);
        }
    }
}


Measured memory_bytes: 13268
from collections import deque

U, D, L, R = (-1, 0), (+1, 0), (0, -1), (0, +1)

is_good = lambda x, y, R, C: True if x < R and x >= 0 and y < C and y >= 0 else False


def traverse(grid, start, distance_grid):
  d = deque([(start, 0)])
  tx, ty = start
  distance_grid[tx][ty] = 0
  #print(distance_grid)
  dis = 0
  visited = set([start])
  while d:
    node, path = d.popleft()
    cx, cy = node
    for dx, dy in U, D, L, R:
      if is_good(cx + dx, cy + dy, len(grid), len(grid[0])) and grid[cx + dx][cy + dy] != '#' and (cx + dx, cy + dy) not in visited:
        nx, ny = cx + dx, cy + dy
        visited.add((nx, ny))
        d.append([(nx, ny), path+1])
        distance_grid[nx][ny] = distance_grid[cx][cy]+1
  #print(distance_grid)
  for arr in distance_grid:
    dis = max(dis, max(arr))
  return dis

from copy import deepcopy

def bfs():
  R, C = tuple(map(int, input().split()))
  grid =[list(input()) for _ in range(R)]
  temp = [[-1 for _ in range(C)] for _ in range(R)]
  #print(grid)
  answer = 0
  for row in range(R):
    for col in range(C):
      if grid[row][col] != '#':
        start = (row, col)
        distance_grid = deepcopy(temp)
        answer = max(answer, traverse(grid, start, distance_grid))
  return answer


print(bfs())

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

#define loop(i, n) for(int i = 0;i < int(n);i++)
#define rloop(i, n) for(int i = int(n);i >= 0;i--)
#define range(i, a, b) for(int i = int(a);i <= int(b);i++)
#define sz(c) int(c.size())
#define clr(v, d)   memset(v, d, sizeof(v))
#define ALL(c) c.begin(), c.end()
#define RALL(c) c.rbegin(), c.rend()
#define PI acos(-1)
#define pb push_back
#define mp make_pair
#define fr first
#define sc second
#define INF             INT64_MAX
#define NINF            INT64_MIN

typedef long long ll;
typedef pair<int, int> ii;
typedef pair<ll, ll> pll;
typedef vector<ii> vii;
typedef vector<int> vi;
typedef vector<pll> vll;
typedef vector<ll> vl;

string neg2base(ll num)
{
    string res="";
    while(num!=0)
    {
        ll rem=num%(-2);
        num=num/(-2);
        if(rem<0)
        {
            num++;
            rem+=2;
        }
        res=to_string(rem)+res;

    }
    return res;
}
int main()
{
    //    std::ios_base::sync_with_stdio(false);
    //    cin.tie(NULL);
    //    cout.tie(NULL);

    //    freopen("popcorn.in", "r", stdin);

    //    ll t;
    //    cin>>t;
    //    while(t--)
    //    {

    ll n;
    cin>>n;
    string ans=neg2base(n);
    if(ans=="")
        cout<<"0"<<endl;
    else
        cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 256
import math

n, k = map(int,input().split())
ans = 0

for i in range(1,n+1):
    if i >= k:
        ans += 1
    else:
        m = math.ceil(math.log2(k/i)) # 必要な回数
        ans += 0.5**m
print(ans / n) # 最後に割る

Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define rep(i,n) for(ll (i)=0; i<(n); ++(i))
#define print(a) cout << (a) << endl

int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  ll sx,sy,tx,ty;cin>>sx>>sy>>tx>>ty;
  string ans="";
  ll dx=tx-sx,dy=ty-sy;
  rep(i,dx) ans+='R';rep(i,dy) ans+='U';rep(i,dx) ans+='L';rep(i,dy) ans+='D';
  ans+='L';
  rep(i,dy+1) ans+='U';rep(i,dx+1) ans+='R';ans+='D';
  ans+='R';
  rep(i,dy+1) ans+='D';rep(i,dx+1) ans+='L';ans+='U';
  print(ans);
  return 0;
}

Measured memory_bytes: 256
import java.io.*;
import java.util.*;

public class Main {
    public static void main(String[] args) throws IOException {
        InputReader in = new InputReader();
        PrintWriter out = new PrintWriter(System.out);
        int test_cases = 1;
        Solver s = new Solver();
        for (int i = 1; i <= test_cases; i++) {
            s.solve(i, in, out);
        }
        out.close();
    }
}

class Solver {

    void solve(int test_number, InputReader in, PrintWriter out) throws IOException {
        int n = in.nextInt();
        int a = in.nextInt();
        int b = in.nextInt();
        out.println(Math.min(b,  a * n));
    }
}


class InputReader {
    BufferedReader br;
    StringTokenizer st;

    public InputReader() {
        br = new BufferedReader(new
                InputStreamReader(System.in));
    }

    String next() {
        while (st == null || !st.hasMoreElements()) {
            try {
                st = new StringTokenizer(br.readLine());
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
        return st.nextToken();
    }

    int nextInt() {
        return Integer.parseInt(next());
    }

    long nextLong() {
        return Long.parseLong(next());
    }

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

    String nextLine() {
        String str = "";
        try {
            str = br.readLine();
        } catch (IOException e) {
            e.printStackTrace();
        }
        return str;
    }
}

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

int main(){
    string S[3];
    for(int i=0;i<3;i++) cin >> S[i];
    int now = 0;
    int id[3] = {0,0,0};
    while(true){
        if(id[now]==S[now].size()){
            char c = 'A'+now;
            cout << c << endl;
            return 0;
        }
        id[now]++;
        now = S[now][id[now]-1]-'a';
    }
}

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

typedef long long ll;
int main(){
    ll n;
    cin >> n;

    ll mi,x;
    for(ll i = 0;i<5;i++){
        cin >> x;
        if(i==0)mi=x;
        mi=min(x,mi);
    }
    if(n<mi)cout << 5 << endl;
    else{
        if(n%mi)cout << 4+n/mi+1 << endl;
        else cout << 4+n/mi << endl;
    }


    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define MAX 1000000007
#define ull unsigned long long int
#define ll long long int
#define fo(i,n) for(int i=0;i<n;i++)
#define ull unsigned long long int
#define pb push_back
#define eb emplace_back
using namespace std;

int main(){
    // fast i/o
    ios_base::sync_with_stdio(false);
    // unties cout and cin streams....
    cin.tie(0); cout.tie(0);
//    int t;
//    cin>>t;
//    while(t--){
//
//    }
      int n,k;
      cin>>n>>k;
      int arr[101]={0};
      int d;
      for(int i=0;i<k;i++){
          cin>>d;
          int ar[d];
          for(int j=0;j<d;j++){
              cin>>ar[d];
              arr[ar[d]]++;
          }
      }
      int ct=0;
      for(int i=1;i<=n;i++){
          if(arr[i]==0){
              ct++;
          }
      }
      cout<<ct<<endl;
    return 0;
}

Measured memory_bytes: 3648
while True:
    try:
        Roma = input()
        Roma = Roma.replace('IV', 'IIII')
        Roma = Roma.replace('IX', 'VIIII')
        Roma = Roma.replace('XL', 'XXXX')
        Roma = Roma.replace('XC', 'LXXXX')
        Roma = Roma.replace('CD', 'CCCC')
        Roma = Roma.replace('CM', 'DCCCC')
        Roma = list(Roma)
        Num = 1000 * Roma.count('M') + 500 * Roma.count('D') + 100 * Roma.count('C') + 50 * Roma.count('L') + 10 * Roma.count('X') + 5 * Roma.count('V') + Roma.count('I')
        print(Num)
        
    except EOFError:
        break

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

using namespace std;

#ifndef aa
#define trace(...)
#define endl '\n'
#endif
#define pb push_back
#define ub upper_bound
#define lb lower_bound
#define fi first
#define se second
#define int long long
typedef long long ll;
typedef long double ld;
#define double long double
#define pii pair<int,int>
#define pdd pair<double,double>
#define pll pair<ll,ll>
#define sz(x) ((long long)x.size())
#define fr(a,b,c) for(int a=b; a<=c; a++)
#define frev(a,b,c) for(int a=c; a>=b; a--)
#define rep(a,b,c) for(int a=b; a<c; a++)
#define trav(a,x) for(auto &a:x)
#define all(con) con.begin(),con.end()
#define deb(x) cout << x << endl
#define done(x) {cout << x << endl;return;}
const ll infl = 0x3f3f3f3f3f3f3f3fLL;
const int infi = 0x3f3f3f3f;
mt19937_64 mt(chrono::steady_clock::now().time_since_epoch().count());
//const int mod = 998244353;
const int mod = 1e9 + 7;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<pair<int, int>> vpii;
typedef map<int, int> mii;
typedef set<int> si;
typedef set<pair<int,int>> spii;
typedef queue<int> qi;


const int N = 2e5+5;


void solve() {

  int n,x,t;
  cin>>n>>x>>t;
  cout<<(n+x-1)/x*t;

}


signed main() {
    ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
    //srand(chrono::high_resolution_clock::now().time_since_epoch().count());
    cout << fixed << setprecision(15);
    int t = 1;
   //cin >> t;

    while (t--)
        solve();
#ifdef aa
    cout << endl << endl << endl << endl << "Time elapsed: " << (double)(clock() - clk) / CLOCKS_PER_SEC << endl;
#endif
    return 0;
}


int powm(int a, int b) {
    int res = 1;
    while (b) {
        if (b & 1)
            res = (res*a) % mod;
        a = (a * a) % mod;
        b >>= 1;
    }
    return res;
}


int divide(int a, int b) {
    return (a % mod) * powm(b, mod - 2) % mod;
}

int norm(int a) {
    while (a >= mod) a -= mod;
    while (a < 0) a += mod;
    return a;
}


int gcd(int a, int b) {
    return b ? gcd(b, a % b) : a;
}


Measured memory_bytes: 3568
<?php
$tmp = [];
while ($line = fgets(STDIN)) {
    $tmp[] = trim($line);
}

$string = $tmp[0];
$list = str_split($string);
$n = count($list) - 1;

$sum = 0;
for ($bit = 0; $bit < (1 << $n); $bit++) {
    $st = '';
    for ($i = 0; $i < $n; $i++) {
        $st .= $list[$i];
        if ($bit & (1 << $i)) {
            $st .= '+';
        }
    }
    $st .= $list[$i];

    $result = explode('+', $st);
    $sum += array_sum($result);
}

echo $sum;

Measured memory_bytes: 4984
#include <iostream>
#include <limits.h>
#include <algorithm>
#include <bitset>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>

#include <list>
#include <map>
#include <numeric>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#include <queue>
#include <unordered_map>
#include <unordered_set>

/***************************/
using namespace std;

typedef long long ll;
typedef vector<ll> vi;
typedef vector<long long> vl;
typedef pair<ll, ll> pi;
typedef vector<pair<ll, ll> > vpi;

//const long long INF = 1LL << 55;

#define itn ll
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define ss second
#define ff first
#define dup(x,y) ((x) + (y) - 1)/(y)
#define mins(x,y) x = min(x,y)
#define maxs(x,y) x = max(x,y)
#define all(x) (x).begin(),(x).end()
#define Rep(n) for(ll i = 0;i < n;i++)
#define rep(i,n) for(ll i = 0;i < n;i++)
#define flush fflush(stdout)
#define rrep(i,n) for(ll i = n - 1;i >= 0;i--)
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() )
#define ioboost cin.tie(0);ios::sync_with_stdio(false);cout<<fixed<<setprecision(20)
ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }
ll qp(ll a, ll b) { ll ans = 1; do { if (b & 1)ans = 1ll * ans*a; a = 1ll * a*a; } while (b >>= 1); return ans; }
ll qp(ll a, ll b, ll mo) { ll ans = 1; do { if (b & 1)ans = 1ll * ans*a%mo; a = 1ll * a*a%mo; } while (b >>= 1); return ans; }

#define _GLIBCXX_DEBUG
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl

ll m;
ll d[200020],c[200020];
ll sum,dig;
void input(){
	cin >> m;
	rep(i,m)cin >> d[i] >> c[i];
}
void calc(){
	sum = dig = 0;
	rep(i,m){
		sum += d[i]*c[i];
		dig += c[i];
	}
}
void solve(){
	cout << (dig - 1) + (sum - 1) / 9 << endl;
}

int main(){
	input();
	calc();
	solve();
}

//./oj.py --onlinejudgename [contest_id] problem_id [options...]
































Measured memory_bytes: 3328
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int hp = sc.nextInt(), n = sc.nextInt();
		int[][] array = new int[n][2];
		int max=0;
		for(int i=0;i<n;i++) {
			array[i][0]=sc.nextInt();
			array[i][1]=sc.nextInt();
			if(array[i][0]>max) max = array[i][0];
		}
		int[] dp = new int[hp+1+max];
		dp[0]=0;
		for(int i=1;i<=hp+max;i++) dp[i]=1000000000;
		for(int i=1;i<=hp+max;i++) {
			int min = 1000000000;
			for(int j=0;j<n;j++) {
				if(i-array[j][0]>=0) {
					if(dp[i-array[j][0]]+array[j][1]<min) {
						min = dp[i-array[j][0]]+array[j][1];
					}
				}
			}
			dp[i]=min;
		}
		int min = 1000000000;
		for(int i=hp;i<=hp+max;i++) {
			if(dp[i]<min) min = dp[i];
		}
		System.out.println(min);
	}
}


Measured memory_bytes: 26112
#include <iostream>
#include <cstdio>
#define N 200005
using namespace std;
typedef long long ll;

ll l, n, ans, a[N], sl[N], sr[N];
int main() {
	ll i, k, d;
	cin >> l >> n;
	for(i=1; i<=n; i++) {
		scanf("%lld", &a[i]);
		sl[i] = sl[i-1] + a[i];
	}
	for(i=n; i; i--) sr[i] = sr[i+1] + l - a[i];
	for(i=1; i<n; i++) {
		k = min(i, n-i);
		d = 2 * (sl[i] - sl[i-k] + sr[i+1] - sr[i+1+k]) - min(a[i], l-a[i+1]);
		ans = max(ans, d);
	}
	for(i=1; i<=n; i++) {
		k = min(i-1, n-i);
		d = 2 * (sl[i-1] - sl[i-1-k] + sr[i+1] - sr[i+1+k]) + max(a[i], l-a[i]);
		ans = max(ans, d);
	}
	cout << ans;
	return 0;
}

Measured memory_bytes: 4992
#include <bits/stdc++.h>
#define pb push_back
#define ll long long
#define si short int
#define speed ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0)
#define pill pair<ll,ll>
#define f first
#define s second
#define pilc pair<ll,char>
#define all(a) (a).begin(),(a).end()
#define rep(s,e,step) for(int i = (s); i < (e) ; i += step)
#define vrep(s,e,step) for(int j = (s); j < (e) ; j += step)
#define ex exit(0)
#define sz(a) (a).size()


using namespace std;

const ll N = 121;
const ll big = 1e18;
const ll block = 800;
const ll mod = 1e6;
ll n;
ll a[N];
ll x = 0;
int main() {
	cin >> n;
	for(int i = 0; i < n; i++)
		cin >> a[i];
	ll ans = 0;
	for(int i = 0; i < n; i++) {
		for(int j = i + 1; j < n; j++) {
			for(int l = j + 1; l < n; l++) {
				ll b[3] = {a[i], a[j], a[l]};
				sort(b, b + 3);
				if(b[0] + b[1] > b[2] && b[0] != b[1] && b[1] != b[2])
					ans++;
			}
		}
	}
	cout << ans << '\n';
}

/*

*/



Measured memory_bytes: 3636
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define vi vector<int>
#define mod 1000000007
int main()
{
  string s;
  cin>>s;

  if(s=="ABC")
    cout<<"ARC\n";
  else if(s=="ARC")
    cout<<"ABC\n";
return 0;
}


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

// a^nを計算　O(log n)
long long int powint(long long int a, long long int n) {
    if (n == 0) {
        return 1;
    } else {
        long long int temp = powint(a, n / 2);
        if (n % 2 == 0) {
            return temp * temp;
        } else {
            return temp * temp * a;
        }
    }
}

int main() {
    lint a;
    string b;
    cin >> a >> b;
    lint mul = 0;
    mul += (b[0] - '0') * 100;
    if (b.length() >= 3) {
        mul += (b[2] - '0') * 10;
    }
    if (b.length() >= 4) {
        mul += (b[3] - '0');
    }
    lint ans = a * mul / 100;
    cout << ans << endl;
}

Measured memory_bytes: 3596
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <map>
#include <numeric>
#include <queue>
using namespace std;
typedef long long ll;

int main(){
    string s;cin>>s;
    for(char &x:s){
        if(x=='9')x='1';
        else if(x=='1')x='9';
    }
    cout<<s;
}

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

using namespace std;
typedef long long ll;

int main() {
  ll N, M;
  cin >> N >> M;
  
  priority_queue<pair<ll, ll>> pq;
  for (ll i = 0; i < N; i++) {
    ll a;
    cin >> a;
    pq.push({a, 1});
  }
  for (ll i = 0; i < M; i++) {
    ll a, b;
    cin >> a >> b;
    pq.push({b, a});
  }
  
  ll cnt = N;
  ll ans = 0;
  while(cnt > 0) {
    pair<ll, ll> p = pq.top();
    pq.pop();
    ans += p.first;
    p.second--;
    cnt--;
    if (p.second >= 1) {
      pq.push(p);
    }
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 6384
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main() {
	int t;
	scanf("%d", &t);
	int cnt = 0;
	vector<string> ans;
	map<string, int> mp;
	while(t--) {
		string s;
		cin >> s;
		mp[s]++;
		cnt = max(cnt, mp[s]);
	}
	for(auto x : mp) {
		if(mp[x.first] == cnt) ans.push_back(x.first);
	}
	for(int i = 0; i < ans.size(); i++) cout << ans[i] << endl;
	return 0;
}

Measured memory_bytes: 28404
N = int(input())
p = [0] * N
for i in range(N):
    p[i] = list(map(int, input().split()))

for i in range(N):
    if p[i][2] > 0:
        pp = p[i]

f = 0

for i in range(101):
    for j in range(101):
        H = pp[2] + abs(i - pp[0]) + abs(j - pp[1])
        for k in range(N):
            #print(i, j ,k)
            if p[k][2] != max(H - abs(i - p[k][0]) - abs(j - p[k][1]), 0):
                break
            if k == (N - 1):
                xa = i
                ya = j
                Ha = H
                f = 1
                break
        if f == 1:
            break
    if f == 1:
        break


print(xa, ya, Ha)

Measured memory_bytes: 9052
#include <iostream>

using namespace std;

int bw[1001][1001][2] = {0};

int main(){
	int n, k;

	cin >> n >> k;

	for(int i=0; i<n; i++){
		int x, y;
		char c;
		cin >> x >> y >> c;

		int color = c == 'W' ? 1 : 0;
		color = (color + (x/k) + (y/k)) % 2;
		bw[x%k + 1][y%k + 1][color]++;
	}

	for(int i=1; i<=k; i++){
		for(int j=1; j<=k; j++){
			for(int t=0; t<2; t++){
				int res = 0;
				res += bw[i-1][j][t];
				res += bw[i][j-1][t];
				res -= bw[i-1][j-1][t];
				bw[i][j][t] += res;
			}
		}
	}

	int ans = 0;

	for(int i=0; i <= k; i++){
		for(int j=0; j <= k; j++){
			for(int t=0; t < 2; t++){
				int buf = 0;
					buf += bw[i][k][1-t] - bw[i][j][1-t];
					buf += bw[k][j][1-t] - bw[i][j][1-t];
					buf += bw[k][k][t];
					buf -= bw[i][k][t] - bw[i][j][t];
					buf -= bw[k][j][t] - bw[i][j][t];


				if(ans < buf){
					//cout << i <<" "<<j <<" : "<< buf << endl;
					ans = buf;
				}
			}
		}
	}

	cout << ans<< endl;

	return 0;
}


Measured memory_bytes: 8064
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main()
{
    int xyz[3] = {};
    int a, b, c;
    long long sum = 0;
    cin >> xyz[0] >> xyz[1] >> a >> b >> c;
    vector<pair<int, int>> pqr(a+b+c);
    for(int i = 0; i < a; i++) {
        pqr[i].second = 0;
        scanf("%d", &pqr[i].first);
    }
    for(int i = 0; i < b; i++) {
        pqr[a+i].second = 1;
        scanf("%d", &pqr[a+i].first);
    }
    for(int i = 0; i < c; i++) {
        pqr[a+b+i].second = 2;
        scanf("%d", &pqr[a+b+i].first);
    }
    sort(pqr.rbegin(), pqr.rend());
    int count = xyz[0] + xyz[1], j = 0;
    while(count) {
        if(xyz[0] == 0 && pqr[j].second == 0) {
            j++;
            continue;
        }
        if(xyz[1] == 0 && pqr[j].second == 1) {
            j++;
            continue;
        }
        sum += pqr[j].first;
        xyz[pqr[j].second]--;
        count--;
        j++;
    }
    cout << sum << endl;
    return 0;
}

Measured memory_bytes: 2560
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long hxtype;
#define rep(i,l,r) for(i=(l);i<=(r);++i)
#define per(i,l,r) for(i=(l);i>=(r);--i)
#define REP(i,l,r) for(i=(l);i< (r);++i)
#define PER(i,l,r) for(i=(l);i> (r);--i)
template<class IT>inline void cmax(IT &a,IT b){if(a<b)a=b;}
template<class IT>inline void cmin(IT &a,IT b){if(b<a)a=b;}
const ll p=998244353ll;
const int N=100005;
int a[N];
int main(){
	int n,i;bool s;
	scanf("%d",&n);
	rep(i,1,n)scanf("%d",&a[i]);
	sort(a+1,a+n+1);
	if(n%3)s=(a[1]==a[n]);
	else{
		i=n/3;
		s=(a[1]==a[i])&&(a[i+1]==a[i<<1])&&(a[i<<1|1]==a[n])&&!(a[1]^a[i<<1]^a[n]);
	}
	if(s)puts("Yes");else puts("No");
	return 0;
}

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

int main() {

    int n; cin >> n;
    map<string, int> mp;
    for (int i = 0; i < n; i++) {
        string s; cin >> s;
        mp[s]++;
    }
    int ans = 0;
    for (auto u : mp) {
        ans++;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 19124
#include<iostream>
#include<cstdio>
#include<string>
#include<cstring>
#include<vector>
#include<queue>
#include<map>
#include<set>
#include<stack>
#include<cmath>
#include<algorithm>
#define f first
#define s second
#define pb push_back
using namespace std;
int const INF=0x3f3f3f3f;
int const maxn=105;
typedef long long ll;
typedef pair<int,int>P;
char s[maxn][maxn];
int num[maxn][maxn];
bool vis[maxn][maxn];
int mv[2][2]={{1,0},{0,1}};
queue<P>que;
int main(){
	double l;
	scanf("%lf",&l);
	printf("%.7f",pow(l/3,3));
}


Measured memory_bytes: 384
#include<stdio.h>
#include<stdlib.h>
#include<math.h>
#include<string.h>
int main(void){
    int a,i;
    char b[4];
    scanf("%d %s",&a,b);
    for(i=0;i<strlen(b);i++)a*=10;
    a+=atoi(b);
    if(sqrt((double)a)-(int)sqrt((double)a)==0){
        puts("Yes");
    }else{
        puts("No");
    }
    return 0;
}

Measured memory_bytes: 128
#![allow(dead_code, unused_variables, unused_macros, unused_imports)]

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

fn main() {
    input! {
        a: [i32; 5],
        k: i32,
    }

    if a[4] - a[0] > k {
        println!(":(");
    } else {
        println!("Yay!");
    }
}


Measured memory_bytes: 4352
import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    int t = sc.nextInt();
    int[] a = new int[n];
    for(int i = 0; i < n; i++) {
      a[i] = sc.nextInt();
    }
    int[] ma = new int[n];
    ma[n - 1] = a[n - 1];
    for(int i = n - 2; i >= 0; i--) {
      ma[i] = Math.max(ma[i + 1], a[i]);
    }
    int M = 0;
    for(int i = 0; i < n; i++) {
      M = Math.max(M, ma[i] - a[i]);
    }
    int ans = 0;
    for(int i = 0; i < n; i++) {
      if(M == (ma[i] - a[i])) ans++;
    }
    System.out.println(ans);
  }
}

Measured memory_bytes: 49816
//Hariom_Pandey

#include<bits/stdc++.h>
using namespace std;

int main(){
    string str; cin>>str;
    int sum=0;
    for(int i=0; i<(int)str.size(); i++){
        sum+=str[i]-'0';
    }
    if(sum%9 ==0){
        cout<<"Yes";
    }
    else{
           cout<<"No";
    }    
  
}


Measured memory_bytes: 3704
#include <vector>
#include <iostream>
#include <cmath>
#include <map>
#include <unordered_map>
#include <algorithm>
#include <fstream>
#include <unistd.h>
#include <string.h>
#include <string>
#include <numeric>
#include <queue>
#include <deque>
#include <sstream>
#include <iomanip>
#include <set>
#include <stack>
#include <cassert>
#include <functional>
#include <random>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<vvl> vvvl;
typedef vector<vvvl> vvvvl;
typedef vector<vi> vvi;
typedef vector<vvi> vvvi;
typedef vector<bool> vb;
typedef vector<vector<bool>> vvb;
typedef vector<vvb> vvvb;
typedef vector<vvvb> vvvvb;
typedef vector<string> vs;
typedef vector<vs> vvs;
typedef vector<vvs> vvvs;
typedef vector<char> vc;
typedef vector<vector<char>> vvc;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<vvd> vvvd;
typedef long double LD;
typedef vector<LD> vld;
typedef vector<pair<LD, LD>> vpld;
typedef pair<ll, ll> PL;
typedef vector<PL> vpl;
typedef vector<vector<PL>> vvpl;
typedef vector<vvpl> vvvpl;
typedef pair<ll, PL> TL;
typedef vector<TL> vtl;
typedef vector<vtl> vvtl;
typedef long double ld;
typedef vector<ld> vld;
const ll LINF = 1e17;
const double pi = 3.1415926535897932;
const string endstr = "\n";
#define FOR(i, a, b) for(ll i = (a); i < b; i++)
#define RFOR(i, a, b) for(ll i = (a); i > b; i--)
#define rep(i, n) for(ll i = 0; i < n; i++)
#define rrep(i, n) for(ll i = n-1; i > -1; i--)
#define FORMAP(it, m) for(auto it = m.begin(); it != m.end(); it++)
#define ff first
#define ss second
#define pb push_back
#define epb emplace_back
#define ALL(X) (X).begin(),(X).end()

template <typename T> T gcd(T a, T b) {return (a == 0) ? b : gcd(b%a, a);}
template <typename T> T lcm(T a, T b) { return a / gcd(a, b) * b;}

bool p_comp_fs(const PL p1, const PL p2){ return p1.first < p2.first;};
bool p_comp_fg(const PL p1, const PL p2){ return p1.first > p2.first;};
bool p_comp_ss(const PL p1, const PL p2){ return p1.second < p2.second;};
bool p_comp_sg(const PL p1, const PL p2){ return p1.second > p2.second;};
template <typename T>
vector<T> uniquen(vector<T> vec /* copy */){
    sort(ALL(vec)); vec.erase(unique(vec.begin(), vec.end()), vec.end()); return vec;
}

inline ll popcnt(ll x){return __builtin_popcountll((unsigned long long)x);};
template<class T> bool chmax(T &a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> bool chmin(T &a, T b) { if (a > b) { a = b; return true; } return false; }
//friend bool operator<(const tpl& lhs, const tpl& rhs){
//    return std::tie(lhs.l, lhs.r) < std::tie(rhs.l, rhs.r);
//}

bool bit(ll st, ll b){return ((st>>b)&1) == 1;}


int main(){
#ifdef __DEBUG_LOCAL__
    ifstream file("../../../../../in.txt"); if(file.is_open()) cin.rdbuf(file.rdbuf());
#endif
    ios_base::sync_with_stdio(false); cin.tie(nullptr);
    
    string S, T; cin >> S >> T;
    cout << T << S << endstr;
    
    return 0;
}


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

int main(){
    int n;
    cin >> n;
    vector<int> ans(n, 0);
    for(int i=1;i<n;++i){
        int d;
        cin >> d;
        ans[d-1] += 1;
    }
    for(int i=0;i<n;++i){
        cout << ans[i] << endl;
    }
}


Measured memory_bytes: 4048
module Rank 
  class Rank
    def initialize(str)
      @str = str.clone.freeze
    end

    def to_s
      @str
    end
  end

  A = Rank.new ?A
  B = Rank.new ?B
  C = Rank.new ?C
  D = Rank.new ?D
  F = Rank.new ?F

  private_constant :Rank
end

ReExamScore = Struct.new(:value) do
  def over50?
    value >= 50
  end
end

MidExamScore = Struct.new(:value) do
  def absent?
    value == -1
  end
end

FinalExamScore = Struct.new(:value) do
  def absent?
    value == -1
  end
end

AllScore = Struct.new(:mid_exam_score, :final_exam_score, :reexam_score) do
  def rank
    return Rank::F if any_absent?

    case mid_exam_score.value + final_exam_score.value
    when (80..100) then Rank::A
    when (65...80) then Rank::B
    when (50...65) then Rank::C
    when (30...50) then reexam_score.over50? ? Rank::C : Rank::D
    when ( 0...30) then Rank::F
    end
  end

  def any_absent?
    [mid_exam_score, final_exam_score].any?(&:absent?)
  end
end

loop {
  m,f,r = gets.split.map(&:to_i)

  break if [m,f,r].all?{|e| e == -1 }

  m = MidExamScore.new(m)
  f = FinalExamScore.new(f)
  r = ReExamScore.new(r)
  
  a = AllScore.new(m, f, r)

  puts a.rank.to_s
}



Measured memory_bytes: 6884
#include<stdio.h>
int  x,t,y,m;
int main(){
while(~scanf("%d",&x))
	{
		if(x<100)
		printf("0\n");
		else
		{
			t=x%10+x/10%10*10;
			y=(x-t)/100;
			if(t%5==0)
			m=t/5;
			else
			m=t/5+1;
			if(y>=m)
			printf("1\n");
			else
			printf("0\n");
		 } 
	}
} 

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define loop(i, a, b) for(lli i = a;i <= b; ++i)
#define fast ios::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define lli long long int 
#define p (lli)1e15 + 2
using namespace std;
 
signed main(){
    fast;
    
    lli n;cin>>n;
    lli dp[n+1][n+1], pre[n+1] = {0};
    dp[0][0] = 0;pre[0] = 0;
    loop(i,1,n){
        cin>>pre[i];
        pre[i] += pre[i-1];
        dp[i][i] = 0;
    }

    loop(i,0,n)
        loop(j,0,n)
            if(i != j)
                dp[i][j] = p;

    loop(len,1,n)
        for(lli i=1;i+len-1<=n;i++)
            loop(k,i,i+len-2)
                dp[i][i+len-1] = min(dp[i][i+len-1], dp[i][k]+dp[k+1][i+len-1]+pre[i+len-1]-pre[i-1]);

    cout<<dp[1][n]<<endl;
    return 0;
        
}

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

using namespace std;

long long l, r;
int ans = 2019;

int main(){
	scanf("%lld%lld", &l, &r);

	for(int i = 0; i <= 2 * 2019; i++){
		if(l + i > r) break;

		for(int j = i + 1; j <= 2 * 2019; j++){
			if(l + j > r) break;
			ans = min((long long) ans, ((l + i) * (l + j)) % 2019);
		}
	}

	printf("%d\n", ans);
	
	return 0;
}

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

using namespace std;

void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}

template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}

#define ONLINE_JUDGE
#ifndef ONLINE_JUDGE
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define debug(x...)
#endif
#define  endl 			"\n"
#define  FOR(i, a, n)   for (ll i = a; i < n; i++)
#define  ROF(i, a, n)   for (ll i = a; i >= n; i--)
#define  all(x)         (x).begin(), (x).end()
#define  mset(x, val)   memset(x,val,sizeof(x))
#define  dline          cout<<"///REACHED///\n";

typedef long long ll;

const ll   MOD   =  1e+9+7;
const ll   INF   =  0x7f7f7f7f7f7f7f7f;
const int  INFi  =  0x7f7f7f7f;
const ll   MAXN  =  4e+5+7;


int main() {
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
	//int T;
	//cin >> T;
	//while (T--) {
		
	//}
	int n;
	cin >> n;
	vector<int> a(n);
	for(int& x: a) cin >> x;
	vector<int> dp(n, INFi);
	dp[0] = 0;
	FOR(i, 0, n) {
		if (i+1 < n)
		dp[i+1] = min(dp[i+1], dp[i]+abs(a[i+1]-a[i]));
		if (i+2 < n) 
		dp[i+2] = min(dp[i+2], dp[i]+abs(a[i+2]-a[i]));
		debug(dp);
	}
	cout << dp[n-1] << endl;
	return 0;
}


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

using namespace std;

map <int, int> mp;

int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    int n, m;
    cin >> n >> m;
    n = min(n, m);
    vector <long long> x(m);
    for(int i = 0; i < m; i++) {
        cin >> x[i];
    }
    sort(x.begin(), x.end());
    vector < pair <long long, int> > p;
    for(int i = 1; i < m; i++) {
        p.emplace_back(x[i] - x[i - 1], i);
    }
    sort(p.begin(), p.end());
    reverse(p.begin(), p.end());
    n--;
    mp[0] = 1;
    for(int i = 0; i < n; i++) {
        mp[p[i].second] = 1;
    }
    int last = 0;
    long long ans = 0;
    for(int i = 1; i < m; i++) {
        if(mp[i]) {
            ans += x[i - 1] - x[last];
            last = i;
        }
    }
    ans += x[m - 1] - x[last];
    cout << ans << '\n';
    return 0;
}


Measured memory_bytes: 7280
#include <bits/stdc++.h>
using namespace std;
#define rep(i,a,b) for(int i = (a); i < (b); ++i)
#define rrep(i,a,b) for(int i = (b); i --> (a);)
#define all(v) (v).begin(),(v).end()
#define trav(x,v) for(auto &x : v)
#define sz(v) int(v.size())
typedef vector<int> vi;
typedef long long ll;
typedef pair<int,int> pii;

const ll md = 1e9+7;

int main(){
	cin.sync_with_stdio(0);
	cin.tie(0);

	int n;
	cin >> n;

	string s;
	cin >> s;
	vi cnt(26);
	trav(c, s) ++cnt[c-'a'];

	ll ans = 1;
	trav(x, cnt) ans = ans * (x+1) % md;
	--ans;
	cout << ans << endl;
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
#define For(i, a, b) for(int (i)=(a); (i)<(b); (i)++)
#define rFor(i, a, b) for(int (i)=(a)-1; (i)>=(b); (i)--)
#define rep(i, n) For((i), 0, (n))
#define rrep(i, n) rFor((i), (n), 0)
using namespace std;
typedef long long lint;

int n;
vector<int> G[100010];
const lint mod = 1e9 + 7;
lint dp[100010][2];
bool used[100010];

void dfs(int x){
    used[x] = true;
    dp[x][0] = 1;
    dp[x][1] = 1;
    rep(i, G[x].size()){
        int nx = G[x][i];
        if(!used[nx]){
            dfs(nx);
            dp[x][0] = dp[x][0] * (dp[nx][0] + dp[nx][1]) % mod;
            dp[x][1] = dp[x][1] * dp[nx][0] % mod;
        }
    }
}

int main(){
    cin >> n;
    rep(i, n-1){
        int x, y; cin >> x >> y;
        G[x-1].push_back(y-1);
        G[y-1].push_back(x-1);
    }
    rep(i, n)rep(j, 2) dp[i][j] = 0;
    rep(i, n) used[i] = false;
    dfs(0);
    cout << (dp[0][0] + dp[0][1]) % mod << endl;
}

Measured memory_bytes: 12928
#include <iostream>
using namespace std;
bool judge(int a,int b,int c,int d, int e,int f){
    if(abs(c-a)+abs(d-b) <= f-e && abs(b+d-a-c)%2 == (f-e)%2){
        return true;
    }
    return false;
}
int main(){
    int n;
    cin >> n;
    int t[n+1];
    int x[n+1];
    int y[n+1];
    bool fl = true;
    t[0] = 0;
    x[0] = 0;
    y[0] = 0;
    for(int i = 0;i<n;i++){
        cin >> t[i+1] >> x[i+1] >> y[i+1];
        if(!judge(x[i],y[i],x[i+1],y[i+1],t[i],t[i+1])){
            fl = false;
        }
    }
    if(fl){
        cout << "Yes" << endl;
    }
    else{
        cout << "No" << endl;
    }
}

Measured memory_bytes: 1408
#include <iostream>
#include <string>
#include <cstdlib>
#include <vector>
#include <array>
#include <map>
#include <set>
#include <algorithm>
#include <queue>
#include <stack>
#include <cmath>
#include <climits>
#include <cstdio>
#include <iomanip>
#include <utility>

using namespace std;
typedef long long int ll;

#define SP(x) setprecision((int)x)
#define ALL(v) v.begin(),v.end()

int main(int argc, char const *argv[])
{
    ll x, y;
    cin >> x >> y;
    ll cnt = 1;
    while (x << 1 <= y)
    {
        x <<= 1;
        cnt++;
    }
    cout << cnt << endl;
}

Measured memory_bytes: 256
data_list = []
for i in range(5):
    data = int(input())
    if data / 10 != data // 10:
        data_list.append(((((data // 10) * 10 + 10) - data), data))
    else:
        data_list.append((0, data))
data_list.sort(key=lambda tup: tup[0])
result = 0
for i in range(5):
    result += (data_list[i][0] + data_list[i][1])
print(result - data_list[4][0])

Measured memory_bytes: 3064
#include <bits/stdc++.h>
#include <math.h>
#define ALL(a)    a.begin(), a.end() 
#define rep(i, K, N)  for(long long int i = K; i < N; i++)
#define ll long long int
#define PP 1000000007
using namespace std;

vector<ll> A{0};
vector<ll> B;
map<ll, ll> Ans;
ll L, j = 1;
string S, T;

int main(){
cin >> T;

S = 'a' + T;

L = S.size();B.resize(L + 1);

rep(i, 1, L - 1){

  if(S[i] == 'R' &&S[i + 1] == 'L')A.push_back(i + 1);

}

rep(i, 1, L){

  if(i < A[j]){

    if(S[i] == 'R'){

      B[i] = A[j] - i;continue;

    }

    if(S[i] == 'L'){

      B[i] = i - A[j - 1];continue;

    }
  }

  if(i == A[j]){
    
    if(j <= A.size() - 1)j++;
    
    continue;
    
    }

    if(i > A.back()){B[i] = i - A.back();continue;}

}

j = 1;

rep(i, 1, L){

    if(i == A[j]){
    
    if(j > A.size() - 1)break;
      
    Ans[A[j]]++;
    
    j++;continue;
    
    }

  if(S[i] == 'R'){

    if(B[i]%2 == 0){Ans[A[j]]++;continue;}

    if(B[i]%2 == 1){Ans[A[j] - 1]++;continue;}

  }

  if(S[i] == 'L'){

    if(B[i]%2 == 0){Ans[A[j - 1]]++;continue;}

    if(B[i]%2 == 1){Ans[A[j - 1] - 1]++;continue;}

  }

}
  
rep(i, 1, L){cout << Ans[i] << " ";}

}

Measured memory_bytes: 10828
#pragma GCC optimize("Ofast")
#pragma GCC target("sse4,avx,avx2,fma")
#include <bits/stdc++.h>
using namespace std;


#define f first
#define s second
#define pb push_back
#define mp make_pair
#define ts to_string
#define ub upper_bound
#define lb lower_bound
#define ar array
#define all(x) x.begin(), x.end()
#define siz(x) (int)x.size()
#define FOR(x, y, z) for(int x = (y); x < (z); x++)
#define ROF(x, y, z) for(int x = (y-1); x >= (z); x--)
#define F0R(x, z) FOR(x, 0, z)
#define R0F(x, z) ROF(x, z, 0)
#define trav(x, y) for(auto&x:y)

const string nl = "\n";
using ll = int64_t;
using vi = vector<int>;
using vl = vector<ll>;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using str = string;
using vpii = vector<pii>;
using vpll = vector<pll>;


template<class T> inline bool ckmin(T&a, T b) {return b < a ? a = b, 1 : 0;}
template<class T> inline bool ckmax(T&a, T b) {return b > a ? a = b, 1 : 0;}
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
void usaco(string x=""){
    ios_base::sync_with_stdio(0); cin.tie(0); x=x;
#ifndef D
    if(siz(x)){
        freopen((x+".in").c_str(), "r", stdin);
        freopen((x+".out").c_str(), "w", stdout);
    }
#endif
}


str ts(char c) { return str(1,c); }
str ts(bool b) { return b ? "true" : "false"; }
str ts(const char* s) { return (str)s; }
str ts(str s) { return s; }
template<class A> str ts(complex<A> c) { 
    stringstream ss; ss << c; return ss.str(); }
str ts(vector<bool> v) { 
    str res = "{"; for(int i = 0;i < (int)v.size(); i++) res += char('0'+v[i]);
    res += "}"; return res; }
template<size_t SZ> str ts(bitset<SZ> b) {
    str res = ""; for(int i = 0; i < b.size(); i++) res += char('0'+b[i]);
    return res; }
template<class A, class B> str ts(pair<A,B> p);
template<class T> str ts(T v) { 
    bool fst = 1; str res = "{";
    for (const auto& x: v) {
        if (!fst) res += ", ";
        fst = 0; res += ts(x);
    }
    res += "}"; return res;
}
template<class A, class B> str ts(pair<A,B> p) {
    return "("+ts(p.f)+", "+ts(p.s)+")"; }
void DBG() { cerr << "]" << endl; }
template<class H, class... T> void DBG(H h, T... t) {
    cerr << ts(h); if (sizeof...(t)) cerr << ", ";
    DBG(t...); }


#ifdef D 
#define dbg(...) cerr << "LINE(" << __LINE__ << ") -> [" << #__VA_ARGS__ << "]: [", DBG(__VA_ARGS__)
#else
#define dbg(...) 0
#endif



signed main(){
    usaco("");
    ll a, b, c, d; cin >> a >> b >> c >> d;
    cout << max({a*c, a*d, b*c, b*d}) << nl;
}
/*
 * Stuff I should try:
 * Is it Monotonic? -> Binary Search
 * Is N small? -> Bitsets or other exponential
 * Edge Cases? Look Carefully 
 * Can't figure anything out? Brute Force and see patterns
 * Try to prove greedies
 * Prefix Sums, Amortization, DP, Data Structures
*/



Measured memory_bytes: 3632
#include <cstring>
#include <iomanip>
#include <sstream>
#include <cstdio>
#include <algorithm>
#include <iostream>
#include <vector>
#include <map>
#include <unordered_map>
#include <cmath>
#include <queue>
#include <set>
#include <numeric>
#include <stack>

using namespace std;
typedef long long ll;
#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)
#define repr(i, n) for(ll i = n - 1; i >= 0; i--)
#define repone(i, n) for(ll i = 1; i <= (ll)(n); i++)
#define each(i, mp) for(auto i:mp)
const int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};
const ll mod = 1000000007;
const ll inf = ll(1e9);
const ll half_inf = ll(1e5);
const ll ll_inf = ll(1e9) * ll(1e9);
typedef unordered_map<ll, ll> ump;
typedef pair<ll, ll> P;

ump mp;

int main() {
#ifdef MY_DEBUG
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wmissing-noreturn"
    while (true) {
        mp = ump();
#pragma clang diagnostic pop
#endif
        double n, m, d;
        cin >> n >> m >> d;

        double ans = 0;
        if (d == 0) {
            ans += (m - 1) * 1 / n;
        } else {
            ans += (m - 1) * 2 * (n - d) / (n * n);
        }

        cout << fixed << setprecision(10) << ans << endl;


#ifdef MY_DEBUG
    }
#endif
    return 0;
}	

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#include<map>
#include<cstring>
#include<math.h>
#include<bitset>
#include<queue>
#include<set>
// #include<bits/stdc++.h>
using namespace std;
#define ll long long


int main(){
  string S,T;
  cin >> S >> T;
  reverse(S.begin(),S.end());
  reverse(T.begin(),T.end());
  bool can = false;
  string ans;
  for(int i=0; i<(int)S.size(); i++){
    ans = S;
    for(int j=0; j<(int)T.size(); j++){
      if(S[i+j] == T[j] || S[i+j] == '?'){
          ans[i+j] = T[j];
          if(j == (int)T.size()-1){
            can = true;
            break;
          }
      }else{
        break;
      }
    }
    if(can){
      break;
    }
  }
  if(can){
    for(int i=0; i<(int)ans.size(); i++){
      if(ans[i] == '?'){
        ans[i] = 'a';
      }
    }
    reverse(ans.begin(),ans.end());
    cout << ans << endl;
  }else{
    cout << "UNRESTORABLE" << endl;
  }
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(){
    long long Q, H, S, D, N;
    cin >> Q >> H >> S >> D >> N;
    if(Q * 2 < H) H = Q * 2;
    if(H * 2 < S) S = H * 2;
    if(S * 2 < D) cout << N * S << endl;
    else cout << ((int)N/2) * D + N%2 * S << endl;
}


Measured memory_bytes: 256