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

#define fa(x,v) for(auto x:v)
#define f(i,a,b) for(ll i=(ll)a;i<=(ll)b;i++)
#define rf(i,a,b) for(ll i=(ll)a;i>=(ll)b;i--)
#define spc " "
#define endl '\n'
#define ll long long
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define len(s) (ll)int(s.length())
#define sz(v) (ll)int(v.size())
#define MOD 1000000007

void Fast_IO() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    #ifndef ONLINE_JUDGE
    freopen("input.in","r",stdin);
    freopen("output.out","w",stdout);
    freopen("debug.out","w",stderr);
    #endif
} 

// Code Here

int main()
{
    Fast_IO();
    ll l, r, d; cin >> l >> r >> d;
    ll cc = 0;
    f(n,l,r) {
    	if(n % d == 0) cc++;
    }
    cout << cc;
    return 0;
}

Measured memory_bytes: 3636
// c++ -std=c++14 atcoder.cpp
#include <iostream>
#include <string>
#include <vector>
#include <utility>
#include <queue>
#include <deque>
#include <stack>
#include <algorithm>
#include <bitset>
#include <cstdio>
#include <cmath>

using namespace std;

int main() {
    int l;
    cin >> l;

    double ans = pow(l/3.0, 3);
    printf("%.7f\n", ans);;
}


Measured memory_bytes: 256
/*Author: Gautam*/
 
 
#include<bits/stdc++.h>
#define FastIO ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
using namespace std;
#define MOD 1000000007
#define ull unsigned long long int
#define newline cout<<endl
 
 
/* TYPE DEFINITIONS */
typedef     long long int        ll;
typedef     vector<ll>     vi;
typedef     pair<ll,ll>   pi;
 
 
 
/* MATH */
bool isPrime(ull n) 
{ 
    if (n <= 1)  return false; 
    if (n <= 3)  return true; 
    if (n%2 == 0 || n%3 == 0) return false; 
  
    for (ull i=5; i*i<=n; i=i+6) 
        if (n%i == 0 || n%(i+2) == 0) 
           return false; 
  
    return true; 
} 
 
ll pow(ll a,ll b,ll m)
{
    ll res=1;
    while(b>0)
    {
        if(b&1)res=(res*a)%m;
        a=(a*a)%m;
        b>>=1;
    }
    return res;
}
 
  
//
/* MACROS */
 
#define  all(A)         (A).begin() , (A).end()
#define  arrall(A,n)    (A),((A)+(n))
#define  rall(A)        (A).rbegin() , (A).rend()
#define  sz(A)          (int)(A).size()
#define  pb             push_back
#define  ppb            pop_back
#define  mp             make_pair
#define  ln(X)          (int)(X).length()
#define  square(X)      ((X)*(X))
#define  cube(X)        ((X)*(X)*(X))
#define  forn(i, n)  for (int i = 0; i < int(n); i++)
#define  forr(i, n)  for (int i = int(n - 1); i >= 0; i--)
#define  fora(i, a, b)  for (int i = int(a); i <= int(b); i++)
#define  forb(i, a, b)  for (int i = int(a); i >= int(b); i--)
#define  fore(it, a)    for(__typeof((a).begin()) it = (a).begin(); it != (a).end(); it++) 
void solve()
{
    string s;
    cin>>s;
    int ans=0;
    if(!s.compare("SUN"))ans=7;
    if(!s.compare("MON"))ans=6;
    if(!s.compare("TUE"))ans=5;
    if(!s.compare("WED"))ans=4;
    if(!s.compare("THU"))ans=3;
    if(!s.compare("FRI"))ans=2;
    if(!s.compare("SAT"))ans=1;
    cout<<ans<<endl;

}

int main()
{
 
    FastIO;
    ll t=1;
    //cin>>t;
    while(t--)
    {
        solve();
    }
}

Measured memory_bytes: 256
n,l = map(int,input().split())
aji = []
for i in range(n):
    aji.append(l+i)
sum_aji = sum(aji)
min_diff = float("inf")
ans = 0
for s in aji:
    if abs(s) < min_diff:
        min_diff = abs(s)
        ans = sum_aji-s
print(ans)

Measured memory_bytes: 3060
#include <cstdio>

#define sz 8
char mp[sz][sz];

int main(){
    int h,w,k;
    scanf("%d %d %d",&h,&w,&k);
    for(int i=0;i<h;i++) scanf("%s",mp[i]);

    int ans=0;

    for(int m1=0;m1<(1<<h);m1++){
        for(int m2=0;m2<(1<<w);m2++){
            int cnt=0;
            for(int i=0;i<h;i++){
                for(int j=0;j<w;j++){
                    if(mp[i][j]=='#' && ((m1 & (1<<i))==0) && ((m2 & (1<<j))==0)) cnt++;
                }
            }
            if(cnt==k) ans++;
        }
    }

    printf("%d\n", ans);

    return 0;
}


Measured memory_bytes: 1708
a,b,k = map(int,input().split())
res = []
for i in range(a,min(a+k,b)):
    res.append(i)
for j in range(max(a,b-k+1),b+1):
    res.append(j)
res = sorted(set(res))
for i in res:
    print(i)

Measured memory_bytes: 3060
/// Author: Sarfaraz Alam
# include <bits/stdc++.h>
# define pb push_back
# define ll long long

# define fi first
# define se second
# define all(vc) vc.begin(),vc.end()
# define speed ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
# define DEBUG
typedef unsigned long long int ull;
using namespace std;
#include<string>
#include<cmath>
const int N = 1e5 + 7;
const int mod = 1e9 + 7;


int main()
{
    speed;
    #ifdef DEBUGfd
        freopen("in.txt", "r", stdin);
        freopen("out.txt", "w", stdout);
    #endif // DEBUG

    //Code begins
    int h, w;
    cin>>h>>w;

    char a[h][w+2];
    for(int i = 0; i<h; i++)
    {
      a[i][0] ='#';
      for(int j = 1; j<w+1; j++)
      {
        cin>>a[i][j];
      }
      a[i][w+1] = '#';
    }

    cout<<string(w+2, '#')<<endl;
    for(int i = 0; i<h;i++)
    {
      for(int j = 0; j<w+2; j++)
      cout<<a[i][j];
      cout<<endl;
    }
    cout<<string(w+2, '#');





    return 0;
}


Measured memory_bytes: 256
n = int(input())
a = list(map(int, input().split()))
money = 1000
kabu = 0

for i in range(n-1):
    if a[i] < a[i+1]:
        kabu += money // a[i]
        money -= money // a[i] * a[i]
    else:
        money += kabu * a[i]
        kabu = 0
print(money + kabu * a[n-1])

Measured memory_bytes: 9184
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#include<functional>
#include<assert.h>
#include<numeric>
#include <bits/stdc++.h>
using namespace std;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
using ll = long long;
const int inf=1e9+7;
const ll longinf=1LL<<60 ;
const ll mod=1e9+7 ;
 
int main(){
    int n;
    cin >> n;
    int B[n-1];
    int A[n];
    rep(i, n-1) cin >> B[i];
    A[0] = B[0];
    REP(i, 0, n-2){
        if (B[i] > B[i+1]) A[i+1] = B[i+1];
        else A[i+1] = B[i];
    }
    A[n-1] = B[n-2];
    int ans = 0;
    rep(i, n) ans += A[i];

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



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0, i##_len = (n); i < i##_len; ++i)
#define rep2(i, x, n) for(int i = x, i##_len = (n); i < i##_len; ++i)
#define all(n) begin(n), end(n)
using ll = long long;
using P = pair<ll, ll>;
using vi = vector<int>;
using vl = vector<ll>;
using vs = vector<string>;
using vc = vector<char>;
using vb = vector<bool>;
using vd = vector<double>;
vi dir = {-1, 0, 1, 0, -1, -1, 1, 1, -1};

struct Edge {
  ll to;
  ll cost;
};
using Graph = vector<vector<Edge>>;
const long long INF = 1LL << 60;
/* dijkstra(G,s,dis,prev)
    入力：グラフ G, 開始点 s, 距離を格納する dis, 最短経路の前の点を記録するprev
    計算量：O(|E|log|V|)
    副作用：dis, prevが書き換えられる
*/
void dijkstra(const Graph &G, int s, vl &dis, vi &prev) {
  int N = G.size();
  dis.resize(N, INF);
  prev.resize(N, -1);  // 初期化
  priority_queue<P, vector<P>, greater<P>>
      pq;  // 「仮の最短距離, 頂点」が小さい順に並ぶ
  dis[s] = 0;
  pq.emplace(dis[s], s);
  while(!pq.empty()) {
    P p = pq.top();
    pq.pop();
    int v = p.second;
    if(dis[v] < p.first) {  // 最短距離で無ければ無視
      continue;
    }
    for(auto &e : G[v]) {
      if(dis[e.to] >
         dis[v] + e.cost) {  // 最短距離候補なら priority_queue に追加
        dis[e.to] = dis[v] + e.cost;
        prev[e.to] = v;  // 頂点 v を通って e.to にたどり着いた
        pq.emplace(dis[e.to], e.to);
      }
    }
  }
}
/* get_path(prev, t)
    入力：dijkstra で得た prev, ゴール t
    出力： t への最短路のパス
*/
vi get_path(const vi &prev, int t) {
  vi path;
  for(int cur = t; cur != -1; cur = prev[cur]) {
    path.push_back(cur);
  }
  reverse(path.begin(), path.end());  // 逆順なのでひっくり返す
  return path;
}

int main() {
  ll v, e, r;
  cin >> v >> e >> r;
  Graph g(v);
  rep(i, e) {
    ll s, t, d;
    cin >> s >> t >> d;
    Edge ed;
    ed.to = t;
    ed.cost = d;
    g[s].push_back(ed);
  }
  vl dis;
  vi prev;
  dijkstra(g, r, dis, prev);
  rep(i, v) {
    if(dis[i] == INF)
      cout << "INF" << endl;
    else
      cout << dis[i] << endl;
  }
}


Measured memory_bytes: 19904
#include<stdio.h>
int a[45];

int fib(int num){
 if ( (num == 0) || (num == 1) ) { 
   return a[num] = 1;
 }
 if (a[num] != -1) {
   return a[num];
 }
 return a[num] = fib(num-1) + fib(num-2);
}

int main(){
 int qnum,i;

 scanf("%d", &qnum);

 for(i = 0;i <= 44; i++){
   a[i] = -1;
 }

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

Measured memory_bytes: 1852
## coding: UTF-8
from decimal import *
from itertools import permutations, combinations,combinations_with_replacement,product

s = input().split()
t = [int(p) for p in s]

A = t[0]
B = t[1]
M = t[2]

s = input().split()
t = [int(p) for p in s]

a = t

s = input().split()
t = [int(p) for p in s]

b = t

discount = []
for i in range(M):
    s = input().split()
    t = [int(p) for p in s]
    discount.append(t)


price = [min(a) + min(b)]

for i in range(len(discount)):
    price.append( a[discount[i][0] - 1] + b[discount[i][1] - 1] - discount[i][2])


#print('A:{}, B:{}, M:{}, a:{}, b:{}, discount:{}'.format(A,B,M,a,b,discount))
#print(price)
print(min(price))

Measured memory_bytes: 38448
#include<algorithm>
#include<iostream>
#include<math.h>
#include<queue>
#include<stdio.h>
#include<stdlib.h>
#include<stack>
#include<string>
#include<vector>

#define ll long long
#define ull unsigned long long

using namespace std;
int main(void) {

	ll N = 0;
	scanf("%lld", &N);
	if (N < 1000)
		printf("ABC\n");
	else
		printf("ABD\n");
	return 0;
}

Measured memory_bytes: 256
n = int(input())
d, x = list(map(int, input().split()))
a = [int(input()) for i in range(n)]
import numpy as np
count = n
for i in range(n):
    if a[i] <= d:
        #print(a[i])
        for j in range(d):
            if (a[i] * (j+1) + 1 <= d):
                count += 1
print(x + count)

Measured memory_bytes: 12456
#include<iostream>
#include<algorithm>
#include<vector>
#include<string.h>
using namespace std;

int syc(long i,long Min,long Max){
	if(Min <= i && i <= Max){
		return 1;
	}else{
		exit(1);
		//return 0;
	}
}

int main(){
	
	string s;
	cin >> s;
	int a;
	a=s.length();
	
	syc(a,1,100);

	int check = 0;		
	for(int i=0;i<a;i++){
		if(i%2 == 0){
			if(s[i] == 'R' || s[i] == 'U' || s[i] == 'D'){
			}else{
				check++;
			}
		}else if(i%2 != 0){
			if(s[i] == 'L' || s[i] == 'U' || s[i] == 'D'){
			}else{
				check++;
			}
		}
	}
	
	if(check == 0){
		cout << "Yes" << endl;
	}else{
		cout << "No" << endl;
	}
	
	return 0;
}


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

bool isPrime(int n){
  for(int i=2;i*i<=n;i++) if (n%i==0) return false;
  return true;
}

static int q, l[114514], r[114514], memo[114514];
static bool p[114514];
int main(){
  for(int i=2;i<=100000;i++) p[i] = isPrime(i);
  int cnt = 0;
  for(int i=1;i<=100000;i++){
    if (i%2 && p[i] && p[(i+1)/2]) cnt++;
    memo[i+1] = cnt;    
  }
  cin >> q;
  for(int i=0;i<q;i++){
    cin >> l[i] >> r[i];
    cout << memo[r[i]+1] - memo[l[i]] << endl;
  }
}    
  
  
  
  
  

Measured memory_bytes: 1920
#include<bits/stdc++.h>
#include<iostream>
#include<algorithm>
#include<cctype>
#include<cstring>
#include<cctype>
#include<cstdio>
#include<cstdlib>
#include<limits.h>

using namespace std;


int main()
{
  int low=1000000000;
  int high=0;
  int n,i;
  scanf("%d",&n);
  int p[n];
  for(i=0;i<n;i++)
  {
      scanf("%d",&p[i]);
      if(low>p[i])
        low=p[i];
      if(high<p[i])
        high=p[i];
  }
  printf("%d\n",high-low);
    return 0;
}


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

void counting_sort(int *array, int *output, int n, int k);
void print_array(int *array, int size);
int main(){
	int n;

	cin >> n;

	int* array = (int*)malloc(n * sizeof(int));
	int* output = (int*)malloc(n * sizeof(int));
	int k = 0;

	if(n < 1){
		return 0;
	}

	for(int i = 0; i < n; i++){
		cin >> array[i];
		if(array[i] > k) k = array[i];
	}
	counting_sort(array, output, n, k);
	print_array(output, n);
	return 0;
}
void counting_sort(int *array, int *output, int n, int k){
	int *c = (int *)calloc(k, sizeof(int));
	for(int i = 0; i < n; ++i){
		++c[array[i]];
	}
	for(int i = 1; i <= k; ++i){
		c[i] += c[i-1];
	}
	for(int j = n-1; j >= 0; --j){
		output[c[array[j]]-1] = array[j];
		c[array[j]]--;
	}

}


void print_array(int *array, int size){
	for(int i = 0; i < size; i++){
		cout <<  array[i];
		if(i != size - 1){
		cout << " " ;
		}
	}
	cout << endl;
}

Measured memory_bytes: 16868
//code written by a living bruh moment
import java.io.*;
import java.lang.*;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.BufferedReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.IOException;
import java.util.StringTokenizer;
import java.util.Random;
import java.util.Arrays;
import java.util.ArrayList;
import java.util.Collections;

public class Main {
    static InputReader in = new InputReader(System.in);
    static PrintWriter out = new PrintWriter(System.out);

    public static void main(String[] args) {
        int n = in.nextInt();
        int m = in.nextInt();
        int o = in.nextInt();
        int[] arr = {n,m,o};
        Arrays.sort(arr);
        String s = String.valueOf(arr[2]) + String.valueOf(arr[1]);
        int ans = Integer.parseInt(s) + arr[0];
        out.println(ans);
        out.close();
    }

    static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }
        public long nextLong()
        {
            return Long.parseLong(next());
        }
        public double nextDouble()
        {
            return Double.parseDouble(next());
        }
        public String nextLine()
        {
            try
            {
                return reader.readLine();
            }
            catch(Exception e)
            {
                e.printStackTrace();
            }
            return null;
        }
        public boolean hasNext()
        {
            String next=null;
            try
            {
                next=reader.readLine();
            }
            catch(Exception e)
            {
            }
            if(next==null)
            {
                return false;
            }
            tokenizer=new StringTokenizer(next);
            return true;
        }
    }
}

Measured memory_bytes: 37464
using System;using System.Text;using System.Collections.Generic;using System.Linq;using E = System.Linq.Enumerable; class Program { static long[] a; static long N; static long K; static void Main(string[] args) { 
  //入力を受け取る 
  int N = int.Parse(Console.ReadLine()); string[] A = new string[N]; var map = new Dictionary<string, int>(); for(int i = 0; i < N ; i++){ A[i] = Console.ReadLine(); var B = A[i].ToCharArray(); Array.Sort(B); A[i] = new String(B); if(map.ContainsKey(A[i])){ map[A[i]] += 1; }else{ map.Add(A[i],0); } } long sum = 0; foreach(long num in map.Values){ sum += num*(num+1)/2; } Console.WriteLine(sum); } }

Measured memory_bytes: 32088
n,t=map(int,input().split())
ab=[[0]*2 for i in range(n+1)]
for i in range(1,n+1):
  ab[i][0],ab[i][1]=map(int,input().split())
dp=[[0]*(t+3001) for i in range(n+1)]
ab.sort(key=lambda x:x[0])
for i in range(1,n+1):
  for j in range(t):
    dp[i][j]=max(dp[i][j],dp[i-1][j])
    dp[i][j+ab[i][0]]=max(dp[i][j+ab[i][0]],dp[i-1][j]+ab[i][1])
ans=0
for i in range(n+1):
  ans=max(ans,max(dp[i]))
print(ans)

Measured memory_bytes: 183256
// Author: Vamsi Krishna Reddy Satti
// With love for Competitive Programming!
 
#include <bits/stdc++.h>
using namespace std;
 
#define fast_io ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr);
#define cout_precision cout.setf(ios::fixed); cout.precision(32);
 
using ll = int64_t; using vll = vector<ll>; using vvll = vector<vll>;
using pll = pair<ll, ll>; using vpll = vector<pll>; using vvpll = vector<vpll>;
using ld = long double;
 
// ------------------------------------------------------------------------------------------------

ll n, s, d, ans;

ll valid(ll m) {
    ll sum = 0;
    for (ll x = n; x > 0; x /= m) {
        sum += x % m;
    }
    return sum == s;
}

int main() {
    fast_io; cout_precision;
    cin >> n >> s;
    if (n < s) {
        cout << -1 << endl;
        return 0;
    } else if (n == s) {
        cout << n + 1 << endl;
        return 0;
    }
    d = n - s, ans = INT64_MAX;
    for (ll i = 1; i * i <= d; i++) {
        if (d % i != 0) {
            continue;
        }
        if (valid(i + 1)) {
            ans = min(ans, i + 1);
        }
        if (valid(d / i + 1)) {
            ans = min(ans, d / i + 1);
        }
    }
    cout << ((ans == INT64_MAX) ? -1 : ans) << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <cmath>
#include<algorithm>
#include<stack>
#include<queue>
#include<map>
#include<set>
#include<iomanip>
#define _USE_MATH_DEFINES
#include <math.h>
#include <functional>
using namespace std;

#define rep(i,x) for(ll i=0;i<x;i++)
#define repn(i,x) for(ll i=1;i<=x;i++)

typedef long long ll;
const ll INF = 1e17;
const ll MOD = 998244353;
const ll MAX = 1000001;

ll max(ll a, ll b) {
	if (a > b) { return a; }
	return b;
}

ll min(ll a, ll b) {
	if (a > b) { return b; }
	return a;
}

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

ll lcm(ll a, ll b) {
	return a / gcd(a, b) *b;
}

struct edge {
	ll ind;
	ll fr;
	ll to;
	ll d;
};


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



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

	ll N = S.size();

	char str[7] = { 'k','e','y','e','n','c','e' };

	ll a = 0;
	rep(i, 7) {
		if (S[i] == str[i]) { a++; }
		else { break; }
	}

	ll b = 0;
	rep(i, 7) {
		if (S[N - 1 - i] == str[6 - i]) { b++; }
		else { break; }
	}

	if (a + b >= 7) { cout << "YES"; }
	else { cout << "NO"; }

	system("PAUSE");
}


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

#define ub upper_bound
#define sum(a) accumulate(all(a),0ll)
#define lb lower_bound
#define all(v) begin(v),end(v)
#define allr(v) rbegin(v),rend(v)
#define sort_dec(v) sort(all(v),[](auto e1,auto e2){return e1>e2;})
#define For(n) for(ll i=0;i<n;i++)
#define Forj(n) for(ll j=0;j<n;j++)
typedef long long int ll;
typedef unsigned long long int ull;
#define fi first
#define se second
#define rep(i,a,n) for(ll i=a;i<n;i++)
#define Mp 1e9+7
#define vpll vector< pair<ll,ll> >
#define bug(n) {cout<<n;return;}
#define cont(n) {cout<<n<<endl;continue;}
#define pb push_back

const ll N=1e5+1;

vector<vector<ll>> v(N);
bool root[N];
ll inDegree[N];
ll dist[N];
ll M;

void dfs(ll i){
	// cout<<i<<endl;
	M=max(M,dist[i]);
	for(ll ii:v[i]){
		dist[ii]=max(dist[ii],dist[i]+1);
		inDegree[ii]--;
		if(inDegree[ii]==0)dfs(ii);
	}
}

// void levelOrder(ll i)
// {
// 	queue<ll> Q;
// 	Q.push(i);
// 	while(!Q.empty()){
// 		ll node=Q.front();
// 		Q.pop();
// 		for(ll ii:v[node]){
// 			if(dist[ii]<dist[node]+1){
// 				dist[ii]=dist[node]+1;
// 				Q.push(ii);
// 			}
// 		}
// 	}
// }
 
void solve()
{
	// memset(inDegree,0,sizeof(inDegree));
	// memset(dist,0,sizeof(dist));
	ll n,m;
	cin>>n>>m;
	For(m){
		ll x,y;
		cin>>x>>y;
		x--;y--;
		v[x].pb(y);
		root[y]=1;
		inDegree[y]++;
	}
	For(n)if(!root[i])dfs(i);
	// ll M=0;
	// For(n)M=max(M,dist[i]);
	cout<<M;
}
 
int main()
{
	ios_base::sync_with_stdio(false);cin.tie(NULL);
	 
	int t=1;
	 
	while(t--)
	{
		solve();
	}

	cerr<<"time taken : "<<(float)clock()/CLOCKS_PER_SEC<<" secs"<<endl;
	 
	return 0;
}

Measured memory_bytes: 15072
#include <bits/stdc++.h>
#define rep(i, n) for(long long int i = 0; i < n; i++)
#define _rep(i, m, n) for(long long int i = m; i < n; i++)
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
const int N = 1000000;
const ll mod = 1000000007;
using Graph = vector<vector<int>>;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

ll gcd(ll A, ll B){
    if(B == 0)return A;
    return gcd(B, A % B);
}
ll lcm(ll A, ll B){
    return A * B / gcd(A, B);
}

/*------------------------------------------------------------------*/
int main(){
    string s; cin >> s;
    ll n = s.size();
    ll k; cin >> k;
    set<char> se;
    rep(i, n){
        se.insert(s[i]);
    }
    if(se.size() == 1){
        cout << (n * k) / 2 << endl;
        return 0;
    }
    
    string t = s + s;
    ll count_i = 0;
    ll count_o = 0;
    ll count;
    _rep(i, 1, n){
        count = 0;
        if(s[i] == s[i - 1]){
            while(i < n and s[i] == s[i - 1]){
                count++;
                i++;
            }
        }
        count_i += (count + 1) / 2;
    }
    _rep(i, 1, 2 * n){
        count = 0;
        if(t[i] == t[i - 1]){
            while(i < 2 * n and t[i] == t[i - 1]){
                count++;
                i++;
            }
        }
        count_o += (count + 1) / 2;
    }
    ll ans = count_i + (count_o - count_i) * (k - 1);
    cout << ans << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define REP(i,m,n) for(int i=(int)(m); i<(int)(n); i++)
#define rep(i,n) REP(i,0,n)
#define RREP(i,m,n) for(int i=(int)(m); i>=(int)(n); i--)
#define rrep(i,n) RREP(i,(n)-1,0)
#define all(v) v.begin(), v.end()
#define endk '\n'
const int inf = 1e9+7;
const ll longinf = 1LL<<60;
const ll mod = 1e9+7;
const ld eps = 1e-10;
template<typename T1, typename T2> inline void chmin(T1 &a, T2 b){if(a>b) a=b;}
template<typename T1, typename T2> inline void chmax(T1 &a, T2 b){if(a<b) a=b;}

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int h, w, k; cin >> h >> w >> k;
  vector<string> S(h); rep(i, h) cin >> S[i];
  vector<vector<int>> ans(h, vector<int>(w, -1));
  int tmp = 0;
  rep(i, h) {
    if(S[i] == string(w, '.')) {
      if(i != 0) ans[i] = ans[i-1];
    } else {
      rep(j, w) {
        if(S[i][j] == '#') {
          tmp++;
          while(true) {
            ans[i][j] = tmp;
            j++;
            if(j == w || S[i][j] == '#') break;
          }
          j--;
        }
      }
      int prev = 0;
      rrep(j, w) {
        if(ans[i][j] == -1) ans[i][j] = prev;
        prev = ans[i][j];
      }
    }
  }
  rrep(i, h) {
    if(S[i] == string(w, '.') && i != h-1) {
      ans[i] = ans[i+1];
    }
  }
  rep(i, h) {
    rep(j, w) {
      cout << ans[i][j] << ' ';
    }
    cout << endk;
  }
  return 0;
}


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

#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define eb emplace_back

typedef long long ll;
typedef pair<int, int> pi;

string s;

int check(string s, char ch){
    int pre = 0;
    int ret = 0;
    for(int i = 0;i < s.length();i++){
        if(s[i] == ch){
            ret = max(ret, pre);
            pre = 0;
        }else{
            pre++;
        }
    }
    ret = max(ret, pre);
    return ret;
}

int main(){
    ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
    cin >> s;
    int ans = s.length() - 1;
    for(char ch = 'a';ch <= 'z';ch++){
        int tmp = check(s, ch);
        ans = min(ans, tmp);
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define int long long
using namespace std;
vector<int> s;
int n,k,a[200001],ord[200001];
signed main()
{
	scanf("%lld %lld",&n,&k);
	for(int i=1;i<=n;i++)
		scanf("%lld",&a[i]);
	int cnt=1;
	while(ord[cnt]==0)
	{
		ord[cnt]=s.size();
		s.push_back(cnt);
		cnt=a[cnt];
	}
	int l=ord[cnt];
	int c=s.size()-ord[cnt];
	if(k<l)
		cout<<s[k];
	else
	{
		k-=l;
		k%=c;
		cout<<s[l+k];
	}
	return 0;
}

Measured memory_bytes: 8460
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,queue,copy

sys.setrecursionlimit(10**7)
inf=10**20
mod=10**9+7
dd=[(-1,0),(0,1),(1,0),(0,-1)]
ddn=[(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())
def LS(): return sys.stdin.readline().split()
def S(): return input()

def main():
  l=[1,2,3]
  a=I()
  b=I()
  l.remove(a)
  l.remove(b)
  return l[0]

# main()
print(main())


Measured memory_bytes: 7748
import sys
read = sys.stdin.readline


def readln():
    return list(map(int, read().split()))


N, M = readln()
A = []
B = []
for _ in range(M):
    a, b = readln()
    A.append(a-1)
    B.append(b-1)
# AB = [readln() for _ in range(M)]
# A = [ab[0]-1 for ab in AB[::-1]]
# B = [ab[1]-1 for ab in AB[::-1]]
A.reverse()
B.reverse()


class UnionFind:
    def __init__(self, N):
        self.N = N  # ノード数
        # 親ノードをしめす。負は自身が親ということ。
        self.parent = [-1] * N  # idxが各ノードに対応。

    def root(self, A):
        # print(A)
        # ノード番号を受け取って一番上の親ノードの番号を帰す
        if (self.parent[A] < 0):
            return A
        self.parent[A] = self.root(self.parent[A])  # 経由したノードすべての親を上書き
        return self.parent[A]

    def size(self, A):
        # ノード番号を受け取って、そのノードが含まれている集合のサイズを返す。
        return -self.parent[self.root(A)]

    def concat(self, A, B):
        # ノード番号を2つ受け取って、そのノード同士をつなげる処理を行う。
        # 引数のノードを直接つなぐ代わりに、親同士を連結する処理にする。
        A = self.root(A)
        B = self.root(B)

        # すでにくっついている場合
        if (A == B):
            return False

        # 大きい方に小さい方をくっつけたほうが処理が軽いので大小比較
        if (self.size(A) < self.size(B)):
            A, B = B, A

        # くっつける
        self.parent[A] += self.parent[B]  # sizeの更新
        self.parent[B] = A  # self.rootが呼び出されればBにくっついてるノードもすべて親がAだと上書きされる

        return True


ans = [N * (N - 1) // 2]
uni = UnionFind(N)
for a, b in zip(A, B):
    if uni.root(a) == uni.root(b):
        ans.append(ans[-1])
    else:
        ans.append(ans[-1] - uni.size(a) * uni.size(b))
        uni.concat(a, b)

for a in ans[-2::-1]:
    print(a)


Measured memory_bytes: 17740
#pragma GCC optimize("Ofast")
#pragma GCC optimize ("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
 
#include<bits/stdc++.h>
using namespace std;

#define int long long
#define endl '\n'

const int N = 100005;

int n, m, ans;
vector<int> v[N];
priority_queue<int> pq;
signed main(){
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	cin >> n >> m;
	for(int i = 1 ; i <= n ; i ++){
		int a, b;
		cin >> a >> b;
		v[a].push_back(b);
	}
	for(int i = 1 ; i <= m ; i ++){
		for(int u: v[i])
			pq.push(u);
		if(pq.size()){
			ans += pq.top();
			pq.pop();
		}
	}
	cout << ans;
}

Measured memory_bytes: 5632
#include <algorithm>
#include <bitset>
#include <cmath>
#include <complex>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <regex>
#include <set>
#include <stack>
#include <string>
#include <vector>

const int MOD = 1e9 + 7;
const int iINF = 2147483647 / 2;
const long long int llINF = 9223372036854775807 / 2;

using namespace std;
using ll = long long int;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;
using vvvl = vector<vector<vector<ll>>>;

typedef pair<ll, ll> pll;
bool paircomp(const pll &a, const pll &b) {
  if (a.first == b.first)
    return a.second < b.second;
  return a.first < b.first;
}

#define REP(i, n) for (ll i = 0; i < (n); i++)
#define RREP(i, n) for (ll i = (n)-1; i >= 0; i--)
#define FOR(i, a, b) for (ll i = (a); i < (b); i++)
#define AUTO(i, m) for (auto &i : m)
#define ALL(a) (a).begin(), (a).end()
#define MAX(vec) *std::max_element(vec.begin(), vec.end())
#define MIN(vec) *std::min_element(vec.begin(), vec.end())
#define ARGMAX(vec)                                                            \
  std::distance(vec.begin(), std::max_element(vec.begin(), vec.end()))
#define ARGMIN(vec)                                                            \
  std::distance(vec.begin(), std::min_element(vec.begin(), vec.end()))
#define REV(T) greater<T>()
#define PQ(T) priority_queue<T, vector<T>, greater<T>>
#define VVL(a, b, c) vector<vector<ll>>(a, vector<ll>(b, c))
#define VV(T, a, b, c) vector<vector<T>>(a, vector<T>(b, c))
#define VVVL(a, b, c, d)                                                       \
  vector<vector<vector<ll>>>(a, vector<vector<ll>>(b, vector<ll>(c, d)))
#define VVV(T, a, b, c, d)                                                     \
  vector<vector<vector<T>>>(a, vector<vector<T>>(b, vector<T>(c, d)))
#define SP(a) setprecision(a)
#define SQRT(a) sqrt((long double)(a))
#define DPOW(a, b) pow((long double)(a), (long double)(b))
#define UNIQUE(vec)                                                            \
  do {                                                                         \
    sort(ALL((vec)));                                                          \
    (vec).erase(std::unique(ALL((vec))), (vec).end());                         \
  } while (0)

ll POW(ll n, ll m) {
  if (m == 0) {
    return 1;
  } else if (m % 2 == 0) {
    ll tmp = POW(n, m / 2);
    return (tmp * tmp);
  } else {
    return (n * POW(n, m - 1));
  }
}

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

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  string S;
  ll n = 0, s = 0, w = 0, e = 0;
  cin >> S;
  REP(i, S.size()) {
    if (S[i] == 'N')
      n++;
    else if (S[i] == 'S')
      s++;
    else if (S[i] == 'W')
      w++;
    else if (S[i] == 'E')
      e++;
  }
  if (((n > 0 && s > 0) || (n == 0 && s == 0)) &&
      ((e > 0 && w > 0) || (e == 0 && w == 0)))
    cout << "Yes" << endl;
  else
    cout << "No" << endl;

  return 0;
}


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

int main(){
  string word;
  cin >> word;
  int alphabet[26]={0};
  for(int i=0;i<word.length();++i){
  	char index = (int)word[i] - 97 ;
    alphabet[index]++;
  }
  string ans = "Yes";
  for(int i=0;i<26;++i){
  	int times = alphabet[i];
    if(times%2!=0){
      ans = "No";
      break;
    }
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
N, M = list(map(lambda x: int(x), input().split(" ")))

S = ["X"] * N
minus1flag = False
for i in range(M):
  tmp = input().split(" ")
  if S[int(tmp[0]) - 1] in ["X", tmp[1]]:
    S[int(tmp[0]) - 1] = tmp[1]
  else:
    minus1flag = True

if N > 1 and S[0] == "0" or minus1flag:
  print(-1)
elif N == 1 and S[0] in ["0", "X"]:
  print(0)
elif N > 1 and S[0] == "X":
  S[0] = "1"
  print("".join(["0" if s == "X" else s for s in S]))
else:
  print("".join(["0" if s == "X" else s for s in S]))
  
  

Measured memory_bytes: 9136
#include <bits/stdc++.h>
#define int int64_t
using namespace std;
typedef pair<int, int> P;
const int INF = 100000000;

// グローバル変数


// 関数：


signed main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	
	string S1, S2;
	cin >> S1; S2 = S1;
	int N, counter1, counter2;
	N = S1.size();
	
	counter1 = 0;
	for (int i=1; i<N; i++) {
		if (S1[i] == S1[i-1]) {
			if (S1[i] == '0') S1[i] = '1';
			else S1[i] = '0';
			counter1 = counter1 + 1;
		}
	}
	//cout << S1 << endl;
	
	counter2 = 0;
	for (int i=N-2; i>=0; i--) {
		if (S2[i] == S2[i+1]) {
			if (S2[i] == '0') S2[i] = '1';
			else S2[i] = '0';
			counter2 = counter2 + 1;
		}
	}
	//cout << S2 << endl;
	
	cout << min(counter1, counter2) << endl;
}


Measured memory_bytes: 512
from collections import deque

n, m = map(int, input().split())
graph = [[] for i in range(n)]
# print(graph)
seen = [False for i in range(n)]

ans = [0] * (n)
for i in range(0, m):
    a, b = map(int, input().split())
    a -= 1
    b -= 1
    graph[a].append(b)
    graph[b].append(a)
    # print(graph)
q = deque()
q.append(0)
INF = float('inf')
dist = [INF for i in range(n)]
dist[0] = 0
pre = [-1 for i in range(n)]
seen[0] = True
while len(q) > 0:
    v = q.popleft()
    for next_v in graph[v]:
        if seen[next_v]:
            continue
        q.append(next_v)
        seen[next_v] = True
        dist[next_v] = dist[v] + 1
        pre[next_v] = v

print('Yes')

for i in range(1, n):
    ans = pre[i] + 1
    print(ans)




Measured memory_bytes: 36044
#include <iostream>
#include <vector>
#include <cstring>
#include <string>
#include <algorithm>
#include <iomanip>
#include <functional>
#include <queue>
using namespace std;

int field[10][10];

typedef long long W;

const W INF = 1LL << 50;

struct edge {
	int to;
	W cost;
};
typedef pair<W, int> P;
typedef vector<vector <edge > > Graph;

void dijkstra(int s, const Graph& G, vector<W>& d) {
	priority_queue< P, vector<P>, greater<P> > que;
	fill(d.begin(), d.end(), INF);
	d[s] = 0;
	que.push(P(0, s));
	while(!que.empty()) {
		P p = que.top();
		que.pop();
		int v = p.second;
		if(d[v] < p.first) continue;
		for(int i = 0; i < G[v].size(); i++) {
			edge e = G[v][i];
			if(d[e.to] > d[v] + e.cost) {
				d[e.to] = d[v] + e.cost;
				que.push(P(d[e.to], e.to));
			}
		}
	}
}

int toV(int x, int y, int a, int b, int c) {
	return x * 10 * 7 * 7 * 7 + y * 7 * 7 * 7 + a * 7 * 7 + b * 7 + c;
}

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

void rot(int k, int a, int b, int c, int& na, int& nb, int& nc) {
	if(k == 0) {
		na = 7 - b;
		nb = a;
		nc = c;
	}
	if(k == 1) {
		na = a;
		nb = 7 - c;
		nc = b;
	}
	if(k == 2) {
		na = b;
		nb = 7 - a;
		nc = c;
	}
	if(k == 3) {
		na = a;
		nb = c;
		nc = 7 - b;
	}
}

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

	int h, w, sx, sy, gx, gy;
	while(cin >> h >> w, h) {
		for(int y = 0; y < h; y++) {
			for(int x = 0; x < w; x++) {
				cin >> field[y][x];
			}
		}

		cin >> sy >> sx >> gy >> gx;

		Graph G(10 * 10 * 7 * 7 * 7);
		vector<W> d(10 * 10 * 7 * 7 * 7);

		for(int y = 0; y < h; y++) {
			for(int x = 0; x < w; x++) {
				for(int k = 0; k < 4; k++) {
					int nx = x + dx[k], ny = y + dy[k];
					if(nx < 0 || w <= nx || ny < 0 || h <= ny) continue;
					for(int a = 1; a <= 6; a++) {
						for(int b = 1; b <= 6; b++) {
							for(int c = 1; c <= 6; c++) {
								int v1 = toV(x, y, a, b, c);
								int na, nb, nc;
								rot(k, a, b, c, na, nb, nc);
								int v2 = toV(nx, ny, na, nb, nc);
								G[v1].push_back(edge{ v2, field[ny][nx] * (7 - nb) });
							}
						}
					}
				}
			}
		}

		dijkstra(toV(sx, sy, 2, 1, 3), G, d);
		W ans = INF;
		for(int a = 1; a <= 6; a++) {
			for(int b = 1; b <= 6; b++) {
				for(int c = 1; c <= 6; c++) {
					ans = min(ans, d[toV(gx, gy, a, b, c)]);
				}
			}
		}
		cout << ans << endl;
	}
}

Measured memory_bytes: 5484
#!/usr/bin/ruby

s = STDIN.readline.chomp.split(//).sort
t = STDIN.readline.chomp.split(//).sort
s.each_with_index do |c, i|
  if t.select{|tt| c < tt}.length > 0
    puts "Yes"
    exit
  end
end
if s.join == t.join
  puts "No"
  exit
end
if s.join < t.join
  puts "Yes"
  exit
end
puts "No"


Measured memory_bytes: 1916
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include <cstring>


using namespace std;
int dp[100001];
vector<int> edge[100001];
int ans = 0;
int rec(int i){
   if(dp[i] != -1 ) return dp[i];
   dp[i] = 0;
   for(int j = 0; j < (int)edge[i].size(); j++){
      dp[i] = max(dp[i], rec(edge[i][j])+1);
   }
   return dp[i];
}

int main(){
   int N,M;
   cin >> N >> M;
   for(int i = 0 ; i <M; i++){
      int x,y;
      cin >> x >> y;
      x--;y--;
      edge[y].push_back(x);
   }
   memset(dp,-1,sizeof(dp));

   for(int i = 0 ; i < N; i++){
      ans = max(ans,rec(i));
   }
   cout << ans << endl;

   return 0;
}


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

#define ll long long

using namespace std;

template <typename T>
struct sqrt_max {
    vector<T> buckets, data;
    const int ext_sq;
    sqrt_max(int n, int ext_sq = 500) : 
        ext_sq(ext_sq),
        data(n, 0),
        buckets(n / ext_sq + 1, 0) {}

    void insert(int pos, T val) {
        data[pos] = max(data[pos], val);
        int bucket_id = pos / ext_sq;
        buckets[bucket_id] = max(buckets[bucket_id], val);
    }

    T best(int pos) {
        T result = 0;
        int i = 0;
        for(int i = 0; (i + 1) * ext_sq <= pos ; i++)
            result = max(result, buckets[i]);
        int j = i * ext_sq;
        for(; j <= pos; j++)
            result = max(result, data[j]);
        return result;
    }
};

template <typename T>
struct seg_max {
    int n;
    vector<T> data;
    seg_max(int n) {
        int k = 1;
        while(k < n) k <<= 1;
        this->n = k;
        data.resize(2 * k, 0);
    }

    void insert(int pos, T val) {
        pos += n;
        while(pos > 0) {
            data[pos] = max(data[pos], val);
            pos /= 2;
        }
    }

    T best(int pos) {
        pos += n;
        T result = 0;
        while(pos > 0) {
            result = max(result, data[pos]);
            if(pos % 2 == 1)
                pos /= 2;
            else if(pos & (pos - 1))
                pos = (pos - 1) / 2;
            else
                break;
        }
        return result;
    }
};

int main() {
    std::ios::sync_with_stdio(false);
    int n;
    cin >> n;
    //sqrt_max<ll> B(n + 1);
    seg_max<ll> D(n + 1);
    vector<int> H(n), A(n);
    for(int i = 0; i < n; i++) cin >> H[i];
    for(int i = 0; i < n; i++) cin >> A[i];
    for(int i = 0; i < n; i++) {
        //B.insert(H[i], B.best(H[i] - 1) + A[i]);
        D.insert(H[i], D.best(H[i] - 1) + A[i]);
    }
    cout << D.best(n) << "\n";
    return 0;
}


Measured memory_bytes: 5888
#include <cstdio>
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

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

    vector<int> a;
    vector<int> diff;

    long long int asum = 0;
    long long int bsum = 0;

    int modify = 0;
    long long int minusSum = 0;

    for(int i = 0; i < n; i ++){
        int tmp;
        cin >> tmp;
        a.push_back(tmp);
        asum += tmp;
    }
    for(int i = 0; i < n; i ++){
        int tmp;
        cin >> tmp;
        if(a[i] - tmp < 0){
            minusSum += a[i] - tmp;
            modify++;
        }else{
            diff.push_back(a[i] - tmp);
        }
        bsum += tmp;
    }

    // cant solve
    if(bsum > asum){
        printf("-1\n");
        return 0;
    }

    sort(diff.begin(), diff.end(), greater<int>());

    long long int minusCover = 0;
    for(int i = 0 ; i < diff.size() && minusSum < minusCover; i++){
        minusCover -= diff[i];
        modify++;
    }
    printf("%d\n", modify);

    return 0;
}

Measured memory_bytes: 1400
#pragma GCC optimize ("O3")
#include <bits/stdc++.h>
#define abdelrahman010 ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
typedef long long ll;
using namespace std;
const int N = 1e5 + 5;

int n , k , a[N];
int main()
{
	abdelrahman010
	cin >> n >> k;
	for(int i = 0;i < n;i++)
		cin >> a[i];
	sort(a , a + n);
	int mn = 1e9;
	for(int i = k - 1;i < n;i++)
		mn = min(mn , a[i] - a[i - k + 1]);
	cout << mn;
	return 0;
}


Measured memory_bytes: 640
#include <iostream>
#include <cmath>
#include <vector>

using namespace std;

int main(){
  vector<int> A(5,0);
  int num=10,l=0;
  for(int i=0;i<5;i++){
    cin>>A[i];
    if((A[i]%10<num&&A[i]%10!=0)||num==10){
      num=A[i]%10; l=i;
    }
  }
  int ans=0;
  for(int i=0;i<5;i++){
    ans+=(i!=l?A[i]:0);
    if(ans%10!=0){
      ans+=(10-(ans%10));
    }
  }

  ans+=A[l];
  cout<<ans<<endl;

  return 0;

}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define IOS ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define ll long long
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define ff first
#define ss second
#define pii pair <int,int>
#define pll pair <ll,ll>
#define testcase() int t; cin>>t; while(t--)
#define forn(i,n) for(int i=0;i<n;i++)
#define forn1(i,n) for(int i=1;i<=n;i++)
#define all(v) v.begin(),v.end()

ll M = 1e9 + 7;
double pi = acos(-1.0);
ll powerm(ll x,ll y){ ll res=1; while(y){ if(y&1) res=(res*x)%M; y=y>>1; x=(x*x)%M;} return res%M; }
ll power(ll x,ll y){ ll res=1; while(y){ if(y&1) res=(res*x); y=y>>1; x=(x*x);} return res; }
ll gcd(ll a,ll b){if(b>a)return gcd(b,a); if(b==0)return a; return gcd(b,a%b);}

int main() {
	
	//ifstream cin("input.txt");
	//ofstream cout("output.txt");
	IOS;
	 
    int a,b; cin>>a>>b;
    cout<<a*b;
	
	return 0;
}


Measured memory_bytes: 3612
#include <bits/stdc++.h>
using namespace std;
#define REP(name, stop) for (ll(name) = 0; (name) < (stop); (name)++)
using ll = long long;
using vi = vector<ll>;

int main(void) {
    string s;
    cin >> s;
    ll cnt = count(begin(s), end(s), '7');
    string ans = (cnt > 0) ? "Yes" : "No";
    cout << ans << endl;

    return 0;
}


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

using namespace std;

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

const double PI=3.14159265358979323846;

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

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

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

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

vector< bool > reached;

void dfs(vector< vs32 >& g, int u)
{
    reached[u] = true;
    for (auto v : g[u])
    {
        if (!reached[v]) dfs(g, v);
    }
}

template <typename T = int>
struct edge { int from, to; T cost; };

template <typename T = int>
bool BellmanFord(vector< edge<T> >& e, vector< T >& d)
{
    int n = d.size();

    rep (i, n)
    {
        bool update = false;
        rep (j, e.size())
        {
            int from = e[j].from;
            int to = e[j].to;
            T c = e[j].cost;
            if (reached[to] && d[to] > d[from] + c)
            {
                d[to] = d[from] + c;
                update = true;
            }
        }
        if (i == n - 1 && update) return false;
    }
    return true;
}

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

    int n, m;
    cin >> n >> m;

    reached.resize(n, false);
    vector< vs32 > g(n);

    vector< edge<s64> > e(m);
    rep (i, m)
    {
        int u, v;
        s64 c;
        cin >> u >> v >> c;
        --u, --v;
        e[i].from = u;
        e[i].to = v;
        e[i].cost = -c;
        g[v].push_back(u);
    }

    dfs(g, n - 1);

    vs64 d(n, 1e18);
    d[0] = 0;
    if (BellmanFord<s64>(e, d))
    {
        cout << -d[n - 1] << "\n";
    }
    else
    {
        cout << "inf\n";
    }

    return 0;
}



Measured memory_bytes: 384
#include <iostream>
#include <string>
#include <vector>
#include <queue>
#include <deque>
#include <algorithm>
#include <set>
#include <map>
#include <bitset>
#include <cmath>
#include <functional>
#include <iomanip>
#define vll vector<ll>
#define vvvl vector<vvl>
#define vvl vector<vector<ll>>
#define VV(a, b, c, d) vector<vector<d> >(a, vector<d>(b, c))
#define VVV(a, b, c, d) vector<vvl>(a, vvl(b, vll (c, d)));
#define re(c, b) for(ll c=0;c<b;c++)
#define all(obj) (obj).begin(), (obj).end()
typedef long long int ll;
typedef long double ld;
using namespace std;

ll solve(ll d, string s){
  ll ans = 0;
  ll m = s.size();
  vll t(18, 1);
  for(int i=1;i<18;i++) t[i] = (t[i-1]*10);

  //std::cout << s << '\n';
  for(int i=0;i<(1<<(m/2));i++){
    ll num = 0, cnt = 1;
    //bitset<5> b(i);
    //std::cout << b << '\n';
    for(int j=0;j<m/2;j++){
      ll l = m - 1 - j, r = j;
      string tmp = to_string(num);
      ll x = (tmp.size()<=j?0:tmp[tmp.size()-1-j] - '0');
      ll y = (s.size()<=j?0:s[s.size()-1-j] - '0');
      if((i>>j)&1){ //加算
        ll z = (y - x + 10)%10, ad;

        if(z==0){
          ad = 0;
          cnt *= 10-(j==0);
        }else{
          ll L = 10 - z;
          ad = L * t[l] - L*t[r];
          cnt *= (10 - L) - (j==0);
          num += ad;
        }
      }else{ //減算
        ll z = (y-x+10)%10, sb;
        if(z==0){
          sb = 0;
          cnt *= 0;
        }else{
          ll L = z;
          sb = L*t[l] - L*t[r];
          cnt *= (10 - L) - (j==0);
          num -= sb;
        }
      }
      //std::cout << num << " " << cnt << '\n';
    }
    if(num==d) ans += cnt;
  }
  if(m%2) ans *= 10;
  return ans;
}

int main(int argc, char const *argv[]) {
  ll d;std::cin >> d;
  string k = to_string(d);
  ll ret = 0;
  for(int i=0;i+k.size()<=18;i++){
    string ad(i, '0');
    ret += solve(d, ad + k);
  }

  std::cout << ret << '\n';
  return 0;
}


Measured memory_bytes: 384
#include <bits/stdc++.h> 
#define rep(i, n) for(long long i = 0; i < (long long)(n); i++)
#define all(x) (x).begin(),(x).end()
#define _GLIBCXX_DEBUG
typedef long long ll;
using namespace std;
int main(){
  int m,d;
  cin>>m>>d;
  if(d<22||m<4){cout<<0<<endl;}
  else{int k=0;
       for(int j=4;j<=m;j++){
         for(int i=22;i<=d;i++){
           if(i/10>=2&&i%10>=2&&(i/10)*(i%10)==j){k++;}
         }}
        cout<<k<<endl;}
}

Measured memory_bytes: 256
(defun solver ()
  (let* ((N (read)) (M (read))
         (temp (make-array (* 2 M) :fill-pointer 0 :adjustable t))
         (temp2 (make-array (1+ N))))
    (do ((i 0 (incf i))) ((= i (* 2 M)))
        (vector-push (read) temp))
    (do ((j 0 (incf j))) ((= j (* 2 M)))
        (incf (aref temp2 (aref temp j))))
    (do ((k 1 (incf k))) ((> k N))
        (format t "~A~%" (aref temp2 k)))))

(solver)

Measured memory_bytes: 17124
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
#define dump(x) cout << x << endl
typedef int64_t Int;

using namespace std;
using Graph = vector<vector<Int>>;

const double pi = M_PI;
const Int MOD = 1000000007;

int main() {
    int k;
    cin >> k;
    int a[32] = {1,
                 1,
                 1,
                 2,
                 1,
                 2,
                 1,
                 5,
                 2,
                 2,
                 1,
                 5,
                 1,
                 2,
                 1,
                 14,
                 1,
                 5,
                 1,
                 5,
                 2,
                 2,
                 1,
                 15,
                 2,
                 2,
                 5,
                 4,
                 1,
                 4,
                 1,
                 51};

    cout
        << a[k - 1] << endl;
}

Measured memory_bytes: 256
from collections import Counter
MOD = 10**9+7
N = int(input())
A = list(map(int,input().split()))
def prime_factorize(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a
prime = [0] * (10**6+1)
for i in range(N):
    c = Counter(prime_factorize(A[i]))
    for j in c.items():
        prime[j[0]] = max(j[1],prime[j[0]])
lcm = 1
for i in range(10**6):
    if prime[i] > 0:
        lcm *= pow(i,prime[i])
        lcm %= MOD

ans = 0
for i in range(N):
    ans += lcm * pow(A[i],MOD-2,MOD)
    ans %= MOD
print(ans)


Measured memory_bytes: 82832
import java.io.*;
import java.util.*;
import java.lang.*;

class Main{
  public static void main(String[] args) throws IOException{
    Scanner scan=new Scanner(System.in);
    while(true){
      int n=Integer.parseInt(scan.next());
      if(n==0)break;
      int[] s=new int[n];
      for(int i=0;i<n;i++){
        s[i]=Integer.parseInt(scan.next());
      }
      double sum=0;
      double sum2=0;
      for(int i=0;i<n;i++){
        sum+=s[i];
        sum2+=Math.pow(s[i],2);
      }
      double avg=sum/n;
      double dev=Math.sqrt(sum2/n-Math.pow(avg,2));
      System.out.println(dev);
    }
  }
}



Measured memory_bytes: 29968