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

long long com(long long i){
    return i*(i-1)/2;
}

int main(){

    int N;
    cin >> N;

    vector<string> s(N);
    for(int i = 0; i < N; i++){
        cin >> s[i];
    }

    for(int i = 0; i < N; i++){
        sort(s[i].begin(),s[i].end());
    }

    //cout << endl;for(int i = 0; i < N; i++){cout << s[i] << endl;}

    sort(s.begin(), s.end());

    //cout << endl;for(int i = 0; i < N; i++){cout << s[i] << endl;}

    long long ans = 0;
    long long cnt = 1;

    for(int i = 0; i < N-1; i++){

        if(s[i] == s[i+1]){
            cnt++;
        }else{
            ans += com(cnt);
            cnt = 1;
        }
    }

    ans += com(cnt);

    cout << ans << endl;
}

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

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

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

using namespace std;
int main(){

    int n,m,k;
    int ar[4];

    for(int i=1;i<=3;i++)cin>>ar[i];

    int ma=ar[1]+ar[2];
    for(int i=1;i<=3;i++){
      for(int j=i+1;j<=3;j++)ma=min(ma,ar[i]+ar[j]);
    }
    cout<<ma<<endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define FI first
#define SE second
#define PB push_back
#define ll long long
#define FOR(i,a,b) for(int i=a;i<b;i++)
#define ROF(i,a,b) for(int i=b-1;i>=a;i--)
#define YES(i) cout<<(i?"YES":"NO")<<endl
#define Yes(i) cout<<(i?"Yes":"No")<<endl
#define co(i) cout<<(i)<<endl
#define fcout cout<<fixed<<setprecision(10)
#define uni(i) i.erase(unique(i.begin(), i.end()), i.end());
#define all(i) i.begin(),i.end()
#define pint pair<int, int>
#define vint vector<int>
using namespace std;

const int INF=1e9+7;
const int MOD=1e9+7;
//const int MOD=998244353;

int main(){
	int n; cin>>n;
	int h[100000];
	int dp[100000]={};
	FOR(i,0,n){
		cin>>h[i];
	}
	dp[0]=0;
	dp[1]=abs(h[1]-h[0]);
	FOR(i,2,n){
		dp[i]=min(abs(h[i]-h[i-2])+dp[i-2],abs(h[i]-h[i-1])+dp[i-1]);
	}
	co(dp[n-1]);
}


Measured memory_bytes: 1024
#include <iostream>
#include <ios>
#include <string>
using namespace std;

int main() {
    ios::sync_with_stdio(false);
    string S;
    cin >> S;
    int count = 0;
    char prev = ' ';
    for (auto c : S){
        if (prev != c) ++count;
        prev = c;
    }
    cout << count - 1 << endl;
    return 0;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);i++)
using namespace std;
typedef long long ll;
 
int main(){
  string S;
  cin>>S;
  rep(i,S.length()){
    rep(j,i){
      if(S[i]==S[j]){
        cout<<"no"<<endl;
        return 0;
      }
    }
  }
  cout<<"yes"<<endl;
}

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

int main()
{
	int N;
	scanf("%d", &N);
	std::vector<int> X(N), Y(N);
	for (int i{}; i < N; i++)
		scanf("%d%d", &X[i], &Y[i]);
	for (int i{}; i < N; i++)
		if (std::abs(X.front() + Y.front()) % 2 != std::abs(X[i] + Y[i]) % 2)
		{
			puts("-1");
			return 0;
		}

	std::vector<int64_t> sum(N), diff(N);
	for (int i{}; i < N; i++)
	{
		sum[i] = X[i] + Y[i];
		diff[i] = X[i] - Y[i];
	}

	std::vector<int64_t> length(32);
	for (int i{}; i < 32; i++)
		length[i] = 1ll << (31 - i);
	if (sum.front() % 2 == 0) length.push_back(1);
	printf("%d\n", length.size());
	for (int i{}; i < (int)length.size(); i++)
		printf("%lld%c", length[i], i + 1 == (int)length.size()? '\n': ' ');

	const char dir[]{"RUDL"};

	for (int i{}; i < N; i++)
	{
		std::vector<int> ans(length.size());
		int64_t place{};
		for (int j{}; j < 32; j++)
			if (place >= sum[i])
			{
				place -= length[j];
				ans[j] += 2;
			}
			else
				place += length[j];
		if (ans.size() % 2 && place > sum[i])
			ans.back() += 2;
		
		place = 0;
		for (int j{}; j < 32; j++)
			if (place >= diff[i])
			{
				place -= length[j];
				ans[j]++;
			}
			else
				place += length[j];
		if (ans.size() % 2 && place > diff[i])
			ans.back()++;
		for (auto& e: ans) putchar(dir[e]);
		putchar('\n');
	}

	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <deque>
#include <algorithm>
using namespace std;
using ll = long long;

int main() {
  ll 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) {
    D = S * 2;
  }
  ll res = (N / 2) * D + (N % 2) * S;
  cout << res << endl;
  return 0;
}


Measured memory_bytes: 256
import sys
from collections import *
import heapq
import math
import bisect
from itertools import permutations,accumulate,combinations,product
from fractions import gcd
def input():
    return sys.stdin.readline()[:-1]
def ruiseki(lst):
    return [0]+list(accumulate(lst))
mod=pow(10,9)+7

n,m=map(int,input().split())
sc=[list(map(int,input().split())) for i in range(m)]
sc.sort()
lst=[-1]*n
for i in range(m):
    s,c=sc[i]
    if n!=1 and s==1 and c==0:
        print(-1)
        quit()
    if lst[s-1]!=-1 and lst[s-1]!=c:
        print(-1)
        quit()
    lst[s-1]=c

ans=0
if lst[0]==-1 and n!=1:
    lst[0]=1
for i in range(n):
    if lst[i]!=-1:
        ans=ans*10 + lst[i]
    else:
        ans=ans*10 + 0

print(ans)

Measured memory_bytes: 64108
import sys
input = sys.stdin.readline

N = int(input())

heights = list(map(int, input().split()))


cnt_height_plus_ind = {}
cnt_height_minus_ind = {}
cnt_ind_minus_height = {}
cnt_minus_height_minus_ind = {}

for ind in range(N):
    height = heights[ind]

    if ind - height not in cnt_ind_minus_height:
        cnt_ind_minus_height[ind - height] = 0
    cnt_ind_minus_height[ind - height] += 1

    if ind + height not in cnt_height_plus_ind:
        cnt_height_plus_ind[ind + height] = 0
    cnt_height_plus_ind[ind + height] += 1

    if height - ind not in cnt_height_minus_ind:
        cnt_height_minus_ind[height - ind] = 0
    cnt_height_minus_ind[height - ind] += 1

    if - ind - height not in cnt_minus_height_minus_ind:
        cnt_minus_height_minus_ind[-ind-height] = 0
    cnt_minus_height_minus_ind[-ind-height] += 1
    

ans = 0
for val in cnt_height_minus_ind:
    if val in cnt_minus_height_minus_ind:
        ans += cnt_height_minus_ind[val] * cnt_minus_height_minus_ind[val]

for val in cnt_height_plus_ind:
    if val in cnt_ind_minus_height:
        ans += cnt_height_plus_ind[val] * cnt_ind_minus_height[val]

print(ans//2)

Measured memory_bytes: 87412
#include <bits/stdc++.h>
using namespace std;
const int MOD = 1000000007;
int POW(int x,int y){
    int res = 1;
    for(int i = 0;i < y;i++){
        res *= x;
        res %= MOD;
    }
    return res;
}
int main(){
    int n;
    cin >> n;
    vector<int> a(n,0);
    for(int i = 0;i < n;i++){
        cin >> a[i];
    }
    bool judge = true;
    sort(a.begin(),a.end());
    if(n % 2 == 1 && a[0] == 0){
        for(int i = 1;i < (n+1)/2;i++){
            if(a[2*i-1] == 2*i && a[2*i] == 2*i);
            else{
                judge = false;
                break;
            }
        }
    }else if(n % 2 == 0){
        for(int i = 0;i < (n+1)/2;i++){
            if(a[2*i] == 2*i+1 && a[2*i+1] == 2*i+1);
            else{
                judge = false;
                break;
            }
        }
    }else{
        judge = false;
    }
    if(judge){
        cout << POW(2,n/2) << endl;
    }else{
        cout << 0 << endl;
    }
    //cin >> n;
}

Measured memory_bytes: 640
def listToString(_list, split=""):
    maped_list = map(str, _list)  # mapで要素すべてを文字列に
    mojiretu = split.join(maped_list)
    return mojiretu


n, l = [int(i) for i in input().split()]
s = ["" for _ in range(n)]
for i in range(len(s)):
    s[i] = input()
s.sort()
print(listToString(s))

Measured memory_bytes: 3060
n,m=map(int,input().split())
ab=[list(map(int, input().split())) for _ in range(m)]
# bに注目してソート
ab = sorted(ab, key=lambda x: x[1])
ans=0
left=-1
for i in range(m):
    if ab[i][0]<=left<ab[i][1]:
        continue
    left=ab[i][1]-0.5
    ans+=1
print(ans)


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

// cin >> a >> b;
// coud << "" << << endl;

void Main() {
    long long W, H;
    cin >> H >> W;

    if (H == 1 || W == 1) {
        cout << 1 << endl;
        return;
    }
    long long c1 = H / 2 + H % 2;
    long long c2 = H / 2;

    long long res = (c1 + c2) * (W / 2) + c1*(W % 2);
    cout << res << endl;
    // for (int i = 1; i <= W; ++i) {

    // }
}



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



Measured memory_bytes: 384
#include<iostream>
#include<cstdio>
#include<cmath>
#include<cstring>
#include<string>
#include<stack>
#include<queue>
#include<vector>
#include<algorithm>
#include<iomanip>
#include<set>
#include<map>
typedef long long int ll;
using namespace std;
#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define REP(i,n) for (int i=0;i<(n);i++)
#define EREP(i,n) for (int i=1;i<=(n);i++)
#define ALL(a) (a).begin(),(a).end()
//#define EVEL 1

#ifdef EVEL
#define DEB(X) cout << #X << ":" <<X<<" " ;
#define TF(f) f ? cout<<"true  " : cout<<"false ";
#define END cout<<"\n";
#else
#define DEB(X) {}
#define TF(f) {}
#define END {}
#endif
const int MOD = 1000000007;
const int INF = 2000000000;

    ll N,M;
    ll A,B,C;

    ll S[100010];

    ll ans=0;
int main(){
    ios_base::sync_with_stdio(false);
    cin>>A>>B;
    ll a=0;
    REP(i,999){
        a+=i+1;
        S[i]=a;
    }
    REP(i,999){
        if((S[i+1]-S[i])==B-A){
            cout<<S[i]-A;
            break;
        }
    }
    //cout<<A<<endl<<B;
    return 0;
}


Measured memory_bytes: 256
import numpy as np

N = int(input())
nplis = np.array([int(i) for i in input().split() if int(i) % 2 == 0])


cnt = 0

if(len(nplis) != N):
    print(0)
else:
    while(len(nplis) == N):
        nplis = nplis/2
        nplis = np.array([int(i) for i in nplis if int(i) % 2 == 0])
        cnt += 1
    
    print(cnt)

Measured memory_bytes: 12920
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class Main {

	static Scanner scanner;

	//static List<Integer> E = new ArrayList<Integer>();
	static int N;
	static int M;
	static int Q;
	static int[] A;
	static int[] B;
	static int[] C;
	static int[] D;
	static int max=0;

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

	    N=gi();
	    M=gi();
	    Q=gi();
	    A=new int[Q];
	    B=new int[Q];
	    C=new int[Q];
	    D=new int[Q];

	    for (int i=0; i<Q; i++) {
	    	A[i]=gi();
	    	B[i]=gi();
	    	C[i]=gi();
	    	D[i]=gi();

	    }

	    List<Integer> E=new ArrayList<Integer>();
	    f(E);
	    	System.out.print(max);

//        if (flg) {
//        	System.out.print("YES");
//        }else {
//        	System.out.print("NO");
//        }


	}

	public static void f(List<Integer> E) {
		if (E.size()==N) {
			int num=0;
			for (int i=0; i<Q; i++) {
				if(E.get(B[i]-1) - E.get(A[i]-1) == C[i]) {
					num+=D[i];
				}
			}
			if (max<num) {
				max=num;
			}
          return;
		}
		int start=1;
		if(E.size() !=0) {
			start=E.get(E.size() - 1);
		}
		for (int i=start; i<=M; i++) {
			List<Integer> nE=new ArrayList<Integer>();
			nE.addAll(E);
			nE.add(i);
			f(nE);
		}
	}
	// 文字列として入力を取得
	public static String gs() {
		return scanner.next();
	}

	// intとして入力を取得
	public static int gi() {
		return Integer.parseInt(scanner.next());
	}

	// longとして入力を取得
	public static long gl() {
		return Long.parseLong(scanner.next());
	}

	// doubleとして入力を取得
	public static double gd() {
		return Double.parseDouble(scanner.next());
	}
}

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

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

const ll mod =  1000000007;
const int inf = 1e9;
const long long INF = 1LL << 60;   // INFの値は1152921504606846976

int main()
{
    int n,k;
    cin >> n >> k;
    double p[n];
    rep(i,n){
        cin >> p[i];
        p[i] = (p[i]+1.0)/2;
    }
    double m = 0;
    rep(i,k) m += p[i];
    double sum = m;
    rep(i,n-k){
        m -= p[i];
        m += p[i+k];
        sum = max(sum,m);
    }
    printf("%.10lf",sum);
}

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

public class Main {
	public static void main(String[] args) {
		try {
			System.setIn(new FileInputStream("src/aoj2100/input.txt"));
			// System.setOut(new PrintStream(new FileOutputStream("src/aoj1172/result.txt")));
		} catch (FileNotFoundException e) {
		}
		new Main().run();
	}

	Scanner sc;
	void run() {
		sc = new Scanner(System.in);
		int T = sc.nextInt();
		while(T-- > 0) {
			solve();
		}
	}
	void solve(){
		int N = sc.nextInt();
		int[] a = new int[N];
		for (int i = 0; i < N; i++)
			a[i] = sc.nextInt();

		int A = 0, B = 0;
		for (int i = 1; i < N; i++) A = max(A, a[i] - a[i-1]);
		for (int i = 1; i < N; i++) B = max(B, a[i-1] - a[i]);
		System.out.println(A + " " + B);
	}

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

Measured memory_bytes: 12000
#include<bits/stdc++.h>
using namespace std;
#define l long
#define ll long long
#define nitro ios_base::sync_with_stdio(false);cin.tie(0);
#define vi vector<int>
#define pub push_back
#define puf push_front
#define pob pop_back
#define pof pop_front
int main()
{
    ll int n,s=0;cin>>n;
    for(int i=1;i<=n;i++)
    {
        if(i%3==0 or i%5==0) continue;
        else s+=i;
    } cout<<s;
    return 0;
}


Measured memory_bytes: 3632
require 'set'
n, m = gets.split.map(&:to_i)
weight = {}
(gets.split.map(&:to_i)).each.with_index {|w, i| weight[i+1] = w}
g = {}
(1..m).each do
    u, v = gets.split.map(&:to_i)
    (g[u] ||= Set.new) << v
    (g[v] ||= Set.new) << u
end

heaviest_child_weight = Hash.new(0)
leafs = (2..n).select {|u| g[u].size == 1}
until leafs.empty?
    v = leafs.pop
    if w = heaviest_child_weight[v]
        weight[v] += w
    end
    u = g[v].to_a[0]
    hcw = heaviest_child_weight[u]
    heaviest_child_weight[u] = weight[v] if weight[v] > hcw
    g[u].delete(v)
    leafs << u if u != 1 && g[u].size == 1
    heaviest_child_weight.delete(v)
    weight.delete(v)
end

p (weight.values.inject(:+) || 0) + (heaviest_child_weight.values.max || 0)

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

int main() 
{
    int N,A,B;
    int count = 0;

    cin >> N >> A >> B;

    for( int i=1 ; i<=N ; i++ )
    {
        int a = i%10;
        int b = (i%100) / 10;
        int c = (i%1000) / 100;
        int d = (i%10000) / 1000;
        int e = i / 10000;

        int sum = a + b + c + d + e;
        if( sum >= A && B  >= sum )  count += i;
    }

    cout << count << endl;
}

Measured memory_bytes: 256
import java.util.Arrays;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		int num1 = scanner.nextInt();
		int num2 = scanner.nextInt();
		int num3 = scanner.nextInt();
		int[] nums = {num1,num2,num3};
		Arrays.sort(nums);
		
		System.out.println(String.format("%s %s %s", nums[0],nums[1],nums[2]));
		
	}
}

Measured memory_bytes: 17164
#include <bits/stdc++.h>
#include <boost/multiprecision/cpp_int.hpp>

// increment
#define rep_n(_1, _2, _3, NAME, ...) NAME
#define rep_2(i, n) for (int(i) = 0; (i) < (int)(n); ++(i))
#define rep_3(i, initial, n) for (int(i) = (int)(initial); (i) < (int)(n); ++(i))
#define rep(...) rep_n(__VA_ARGS__, rep_3, rep_2, rep_1)(__VA_ARGS__)
// decrement
#define rep_r_n(_1, _2, _3, NAME, ...) NAME
#define rep_r_2(i, n) for (int(i) = (int)(n); (i) > 0; (i)--)
#define rep_r_3(i, initial, n) for (int(i) = (int)(initial); (i) > (int)(n); (i)--)
#define rep_r(...) rep_r_n(__VA_ARGS__, rep_r_3, rep_r_2)(__VA_ARGS__)
// define type definition
using namespace std;
typedef long long ll;
using mpint = boost::multiprecision::cpp_int; // 多倍長整数（任意精度）
typedef pair<int, int> P;

// define construct variable
const double EPS = numeric_limits<double>::epsilon();
// 10^9 + 7
const ll MOD = ll(1e9)+7;
const ll INF = ll(1e10);
const string ALPHABET = "abcdefghijklmnopqrstuvwxyz";

// define methods
// 最大公約数
ll gcd(const ll a, const ll b) { return b ? gcd(b, a % b) : a; }
// 最小公倍数
ll lcm(const ll a, const ll b) { return a / gcd(a, b) * b; }
// char -> int
int ctoi(char c) { return (int)(c - '0'); }
// 素因数分解
vector< pair<ll, ll> > prime_factorize(ll n) {
  vector< pair<ll, ll> > p;
  for (ll i = 2; i * i <= n; i++) {
    if ((n % i) != 0) continue;
    p.push_back(make_pair(i, 0));
    while ((n % i) == 0) {
      n /= i;
      p[i].second += 1;
    }
    p.push_back(make_pair(n, 0));
  }

  if (n != 1) p.push_back(make_pair(n, 1));
  return p;
}
// 組み合わせの整合性を保つ（後ほど解析する）
ll modinv(ll a) {
	ll b = MOD, u = 1, v = 0;
	while (b) {
		ll t = a / b;
		a -= t * b;
		swap(a, b);
		u -= t * v;
		swap(u, v);
	}
	u %= MOD;
	if (u < 0) { u += MOD; }
	return u;
}
// 順列
ll permutation(const ll n, const ll m) {
	ll result = 1;
	for (ll i = n; i > n - m; i--) { result = (result * i) % MOD; }
	return result;
}

// 繰り返し n 乗法
ll repeat_square(const ll n, const ll x) {
	if (x == 0) return 1;
	ll res = repeat_square(n, x/2);
	res = res * res % MOD;
	if ((x % 2) == 1) res = res * n % MOD;
  return res;
}
// 組み合わせ
ll combination(const ll n, const ll a) {
	ll x = 1, y = 1;
  for(ll i = 0; i < a; i++){
    x = x * (n-i) % MOD;
    y = y * (i+1) % MOD;
  }
  return x * repeat_square(y, MOD-2) % MOD;
}

int main() {
	ll X;
	cin >> X;

	for(int i = 0; i < 1001; i++) {
		for(int j = -1000; j < i; j++) {
			mpint x1 = (mpint)i * i * i * i * i;
			mpint x2 = (mpint)j * j * j * j * j;
			// cout << i << ", " << j << " " << x1 << " : " << x2 << " = " << (x1 - x2) << endl;
			// cout << i << ", " << j << " " << x3 << " : " << x4 << " = " << (x3 - x4)  << endl;
			if ((x1 - x2) == X) {
				cout << i << " " << j << endl;
				return 0;
			}
		}
	}
  return 0;
}


Measured memory_bytes: 3636
class UnionFind:
    def __init__(self, num):
        self.parent = [i for i in range(num + 1)]

    def find(self, node):
        if self.parent[node] == node:
            return node
        self.parent[node] = self.find(self.parent[node])
        return self.parent[node]

    def union(self, node1, node2):
        node1 = self.find(node1)
        node2 = self.find(node2)
        if node1 == node2:
            return
        if self.parent[node1] > self.parent[node2]:
            node1, node2 = node2, node1
        self.parent[node2] = node1
        return

    def same(self, node1, node2):
        return self.find(node1) == self.find(node2)


# edges is array which consists of [cost, frm, to] elements
def kruskal(vertex_num, edges):
    ans = 0
    uf = UnionFind(vertex_num)
    # sort edges in cost ascending order
    edges.sort()
    for edge in edges:
        cost, frm, to = edge
        if uf.same(frm, to) is False:
            uf.union(frm, to)
            ans += cost
    return ans


v, e = map(int, input().split())
edges = []
for _ in range(e):
    s, t, w = map(int, input().split())
    edges.append([w, s, t])

print(kruskal(v, edges))




Measured memory_bytes: 25148
#include<stdio.h>
#include<math.h>

int main(){
        long long n;
        scanf("%lld", &n);
        for(int i=(long long)sqrt(n); i>0; i--){
                if(n%i==0){
                        printf("%lld\n", n/i+i-2);
                        return 0;
                }
        }
        return 0;
}

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

int main(){

int a,b;
string s,t,u;

cin>>s;
cin>>t;
cin>>a;
cin>>b;
cin>>u;

    if(s==u)
        a=a-1;
    else if(t==u)
        b=b-1;

cout<<a<<" "<<b;

    return 0;


}

Measured memory_bytes: 3564
import java.util.Scanner;

public class Main {
	public static void main(String args[]) {
		Scanner scn = new Scanner(System.in);
		int D = scn.nextInt();
		String ans;
		switch (D) {
		case 25:
			ans = "Christmas";
			break;
		case 24:
			ans = "Christmas Eve";
			break;
		case 23:
			ans = "Christmas Eve Eve";
			break;
		case 22:
			ans = "Christmas Eve Eve Eve";
			break;
		default:
			ans = "";
			break;
		}
		System.out.println(ans);

	}
}


Measured memory_bytes: 22612
#include<bits/stdc++.h>
using namespace std;
int main(){
	int row,col;string s;
	cin >> row >> col;
	for(int i=0; i<row; i++)for(int j=0; j<col; j++){
		cin>>s;
		if(s == "snuke"){
			printf("%c%d\n",j+'A',i+1);
		}
	}
	return 0;
}


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

int main(void)
{
	ios_base::sync_with_stdio(false);    
	cin.tie(NULL);
	cout.tie(NULL);
	
	ll n,k;
	cin>>n>>k;
	
	vector<ll> a(n+1);
	
	for(int i=1;i<=n;i++)
		cin>>a[i];
		
	vector<ll> no;
	int i=1;
	no.push_back(1);
	vector<bool> check(n+1);
	check[1]=1;
	
	while(check[a[i]]!=1)
	{
		i=a[i];
		no.push_back(i);
		check[i]=1;
	}
	
	
	ll start=find(no.begin(),no.end(),a[i])-no.begin();
	if(k<=start)
	{
		cout<<no[k]<<"\n";
	}
	else{
		cout<<no[start+(k-start)%(no.size()-start)]<<"\n";
	}
	
	return 0;
}

Measured memory_bytes: 6888
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <cmath>
#include <string>
#include <cstring>
#include <vector>
#include <numeric>

#define roop(i, n) for(int i=0;i<n;i++)
#define DIV 1000000007

using namespace std;
using ll = long long int;
using ull = unsigned long long;

float myPower(int a, int n) { // aのn乗の計算
	float x = 1;
	while (n > 0) { // 全てのbitが捨てられるまで
		if ( n & 1) { // 一番右のbitが１のとき
			x *= a;
		}
		a *= a;
		n >>= 1; // bit全体を右に1つシフトして一番右を捨てる
	}
	return x;
}

ll combination(ll n, ll r) {
	if (n < 0 || r < 0 || r > n) return -1;

	if (n - r < r) r = n - r;
	if (r == 0) return 1;
	if (r == 1) return n;

	vector<ll> num(r);
	vector<ll> den(r);

	for (ll i = 0; i < r; i++) {
		num[i] = n - r + i + 1;
		den[i] = i + 1;
	}

	for (ll p = 2; p <= r; p++) {
		ll pivot = den[p - 1];
		if (pivot > 1) {
			ll offset = (n - r) % p;
			for (ll k = p - 1; k < r; k += p) {
				num[k - offset] /= pivot;
				den[k] /= pivot;
			}
		}
	}
	ll result = 1;
	for (ll k = 0; k < r; k++) {
		if (num[k] > 1) result *= num[k];
	}
	return result;
}

int main() {
	ll x;
	cin >> x;
	for (int i = 0; i < 1000; i++) {
		for (int j = 0; j < 1000; j++) {
			if ((i*i*i*i*i - j*j*j*j*j) == x) {
				cout << i << " " << j << endl;
				return 0;
			}
		}
	}
	for (int i = 0; i < 1000; i++) {
		for (int j = 0; j < 1000; j++) {
			if ((i*i*i*i*i + j*j*j*j*j) == x) {
				cout << i << " " << -j << endl;
				return 0;
			}
		}
	}

	return -1;
}

Measured memory_bytes: 3600
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <functional>
#include <queue>
#include <set>
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)

using namespace std;
typedef long long int lli;
const int MAX=2e4;

int main(){
	int N;
	cin>>N;
	int p[MAX+1];
	rep1(i,N) cin>>p[i];
	
	int a[MAX+1],b[MAX+1];
	rep1(i,N){
		a[i]=i*MAX;
		b[i]=(N+1-i)*MAX;
	}
	rep1(i,N)a[p[i]]+=i;
	rep1(i,N)cout<<a[i]<<" ";
	cout<<endl;
	rep1(i,N)cout<<b[i]<<" ";
}

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

int main() {
  int A, B, C, D, E, F;
  cin >> A >> B >> C >> D >> E >> F;

  double noudo = 0.0;
  int sugarwater = 100 * A, sugar = 0;
  for (int i = 0; 100 * A * i <= F; i++) {
    int o1 = 100 * A * i;
    for (int j = 0; o1 + 100 * B * j <= F; j++) {
      int o2 = 100 * B * j;
      int water = o1 + o2;
      int max_sugar = min(F - water, water * E / 100);
      for (int k = 0; C * k <= max_sugar; k++) {
        int o3 = C * k;
        for (int l = 0; o3 + D * l <= max_sugar; l++) {
          int o4 = D * l;
          int s = o3 + o4;
          if (water + s > F) break;
          double n = 1.0 * 100 * s / (water + s);
          if (n > noudo) {
            noudo = n;
            sugar = s;
            sugarwater = sugar + water;
          }
        }
      }
    }
  }

  cout << sugarwater << " " << sugar << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <stdio.h>
#include <string>
#include <algorithm>
#include <cmath>
#include <vector>
#include <functional>
#include <cstdlib>
#include <map>
using namespace std;
#define REP(i,n); for(int i = 0;i < (int)(n);i++)

long long calc(long long h){
	if(h == 1)
		return 1;
	else 
		return 1+2*calc(h/2);  
}

int main() {
	long long h;
	long long ans=0;

	cin >> h;

	ans = calc(h);
	cout << ans;
	
	return(0);
}


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

int main() {
	for (int i = 0; i < 3; i++) {
		int h, m, s, hh, mm, ss;
		cin >> h >> m >> s >> hh >> mm >> ss;
		if (ss < s) {
			mm--;
			ss += 60;
		}
		if (mm < m) {
			hh--;
			mm += 60;
		}
		cout << hh - h << " " << mm - m << " " << ss - s << endl;
	}
}

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

using namespace std;


int main(void){
    int n;
    cin>>n;
    
    string s[n];
    int ss=1e9;
    int b;
    for(int i=0;i<n;i++){
        cin>>s[i];
        //cout<<s[i]<<endl;
        int a=s[i].size();
        if(a<ss){
            ss=a;
            b=i;
        }
    }
    string ans;
    int c=1;
    for(int i=0;i<s[b].size();i++){
        for(int j=0;j<n;j++){
            if(s[j].find(s[b][i])==std::string::npos){
                //cout<<s[j]<<" "<<s[b][i]<<endl;
                c=1;
                break;
            }else{
                if(b!=j){
                    int p=s[j].find(s[b][i]);
                    s[j][p]='1';
                    //cout<<s[j]<<endl;
                }
                c=0;
            }
        }
        if(c==0){
            ans+=s[b][i];
            c=1;
        }
        //cout<<endl;
    }
    
    if(ans.size()==0){
        cout<<""<<endl;
        return 0;
    }
    
    
    for(int i=0;i<ans.size()-1;i++){
        for(int j=ans.size()-1;j>i;j--){
            if(ans[j-1]>ans[j]){
                char tmp=ans[j];
                ans[j]=ans[j-1];
                ans[j-1]=tmp;
            }
        }
    }
    cout<<ans<<endl;
    
    return 0;
}


Measured memory_bytes: 256
N = int(input())
A = list(map(int,input().split()))
pre = -999
frag = 0

for i in range(N):
    if A[i]-1 >= pre:
        pre = A[i] - 1
    elif A[i] >= pre:
        pre = A[i]
    else:
        frag += 1
        break
        
if frag == 1:
    print("No")
else:
    print("Yes")

Measured memory_bytes: 14252
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define pi 3.141592653589793238
#define fast ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define MOD 1000000007
int main(){
	fast;
	int s,k,cnt=0;
	cin>>k>>s;
	for(int i=0;i<=k;i++)
		for(int j=0;j<=k;j++)
			if(s-i-j<=k&&s-i-j>=0)
				cnt++;
	cout<<cnt;
	return 0;
}



Measured memory_bytes: 3600
#include<iostream>
#include<cassert>
#include<stdexcept>
#include<utility>
#include<functional>
#include<numeric>
#include<cmath>
#include<algorithm>
#include<cstdio>
#include<cstdlib>
#include<array>
#include<stack>
#include<queue>
#include<deque>
#include<vector>
#include<complex>
#include<set>
#include<map>
#include<unordered_map>
#include<unordered_set>
#include<string>
#include<bitset>
using namespace std;
using ll=long long;

const int SIZE=1<<20;
const ll MOD=1e9+7;
int main(){
    int n;
    cin>>n;
    vector<int> a(n);
    for(int i=0;i<n;i++) cin>>a[i];
    vector<ll> dp0(SIZE,0);
    vector<ll> dp1(SIZE,1);
    vector<int> offset(SIZE,0);
    int cnt=0;
    ll xs=0;
    for(int i=0;i+1<n;i++){
        xs^=a[i];
        if(xs==0){
            cnt++;
            ll tmp=dp0[0];
            dp0[0]+=dp1[0];
            dp0[0]%=MOD;
            dp1[0]+=tmp;
            dp1[0]%=MOD;
        }
        else{
            dp1[xs]+=dp0[xs]*(cnt-offset[xs]);
            dp1[xs]%=MOD;
            offset[xs]=cnt;
            dp0[xs]+=dp1[xs];
            dp0[xs]%=MOD;
        }
    }
    for(int i=1;i<SIZE;i++){
        dp1[i]+=dp0[i]*(cnt-offset[i])%MOD;
        dp1[i]%=MOD;
        offset[i]=cnt;                    
    }
    xs^=a[n-1];
    if(xs==0){
        ll res=accumulate(dp0.begin(),dp0.end(),0LL)+dp1[0];
        cout<<res%MOD<<endl;
    }
    else{
        cout<<dp1[xs]<<endl;
    }

    return 0;
}

Measured memory_bytes: 22656
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
       int N = scanner.nextInt();
       int A = scanner.nextInt();
       int B = scanner.nextInt();

       if (A*N < B) {
           System.out.println(A*N);
       } else {
           System.out.println(B);
       }
    }

}

Measured memory_bytes: 23252
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define INF (1e9 + 7)
using namespace std;
template<class T>inline bool chmax(T &a, const T &b){if(a < b){a = b; return 1;}return 0;}
template<class T>inline bool chmin(T &a, const T &b){if(a > b){a = b; return 1;}return 0;}
typedef long long ll;
int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  int N, T; cin >> N >> T;
  int ans = 1e9;
  REP(i, N){
    int c, t; cin >> c >> t;
    if(t <= T){
      ans = min(ans, c);
    }
  }
  if(ans == 1e9){
    cout << "TLE" << endl;
  }else{
    cout << ans << endl;
  }
}

Measured memory_bytes: 256
#!/usr/bin/env python3

import collections
import sys
input=sys.stdin.readline

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

def judge(n,arr):
    MAX=10**6
    table=[i for i in range(MAX+1)]
    for i in range(2,MAX+1):
        if table[i]<i:
            continue
        for j in range(i,MAX+1,i):
            table[j]=i
    cnt=collections.defaultdict(int)
    for val in arr:
        s=set()
        while val!=1:
            prime=table[val]
            s.add(prime)
            val//=prime
        for tmp in s:
            cnt[tmp]+=1
    for val in cnt.values():
        if val>=2:
            return False
    return True
    
n=int(input())
arr=list(map(int,input().split()))
tmp=arr[0]
for val in arr:
    tmp=gcd(tmp,val)
if tmp==1:
    is_setwise=True
else:
    is_setwise=False
is_pairwise=judge(n,arr)
if is_pairwise==True:
    print('pairwise coprime')
elif is_setwise==True:
    print('setwise coprime')
else:
    print('not coprime')

Measured memory_bytes: 212388
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		try (Scanner sc = new Scanner(System.in)) {
			int n = sc.nextInt();
			long[] p = new long[n];
			for (int i = 0; i < n; i++) {
				p[i] = sc.nextLong();
			}
			int result = 0;

			for (int i = 1; i < n - 1; i++) {
				if (judge(p[i - 1], p[i], p[i + 1])) {
					result++;
				}
			}

			System.out.println(result);
		}

	}

	private static boolean judge(long a, long b, long c) {
		return (a < b && b < c) || (c < b && b < a);
	}
}


Measured memory_bytes: 21844
using System;

namespace B
{
    internal class Program
    {
        public static void Main(string[] args)
        {
            var N = int.Parse(Console.ReadLine());
            var S = Console.ReadLine().ToCharArray();
            int count = 0;
            
            for (int i = 0; i < N; i++)
            {
                if (S[i] == 'A' && i <= N - 3)
                {
                    if (S[i + 1] == 'B')
                    {
                        if (S[i + 2] == 'C')
                        {
                            count++;
                        }
                    }
                }
            }

            Console.WriteLine(count);
        }
    }
}

Measured memory_bytes: 11092
N, X, M = map(int, input().split())
checked = [-1] * M
a = X
i = 0
while checked[a] == -1 and i < N:
    checked[a] = i
    a = a**2 % M
    i += 1

if i == N:
    a = X
    ans = 0
    for _ in range(N):
        ans += a
        a = a**2%M
    print(ans)
else:
    cycle_size = i - checked[a]
    cycle_num = a
    cycle = []
    cycle_sum = 0
    for _ in range(cycle_size):
        cycle.append(cycle_num)
        cycle_sum += cycle_num
        cycle_num = cycle_num**2 % M

    before_cycle_size = checked[a] 
    before_cycle = []
    before_cycle_sum = 0
    num = X
    for _ in range(before_cycle_size):
        before_cycle.append(num)
        before_cycle_sum += num 
        num = num**2 % M
    ans = before_cycle_sum
    ans += (N-before_cycle_size)//cycle_size * cycle_sum
    after_cycle_size = (N-before_cycle_size)%cycle_size
    for i in range(after_cycle_size):
        ans += cycle[i]
    
    print(ans)

Measured memory_bytes: 13216
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < (int)(n); ++i)
using P = pair<int,int>;
using ll = long long;
static const int INF = 10000000;
static const ll MOD = 1000000007;

ll gcd(ll a, ll b){return b!=0 ? gcd(b, a%b) : b;}
ll lcm(ll a, ll b){return a / gcd(a, b) * b;}

int main(){
	string s;
	cin >> s;
	
	if(s == "SUN") cout << 7 << endl;
	if(s == "MON") cout << 6 << endl;
	if(s == "TUE") cout << 5 << endl;
	if(s == "WED") cout << 4 << endl;
	if(s == "THU") cout << 3 << endl;
	if(s == "FRI") cout << 2 << endl;
	if(s == "SAT") cout << 1 << endl;
	return 0;
}



Measured memory_bytes: 256
from sys import stdin
nii=lambda:map(int,stdin.readline().split())
lnii=lambda:list(map(int,stdin.readline().split()))

n=int(input())

def divisore(n):
    divisors=[]
    for i in range(1,int(n**0.5)+1):
        if n%i==0:
            divisors.append(i)
            if i!=n//i:
                divisors.append(n//i)
    divisors.sort()
    return divisors

ans_l=divisore(n-1)[1:]

d=divisore(n)
for i in d[1:]:
  nn=n
  while nn%i==0:
    nn//=i
  if nn%i==1:
    ans_l.append(i)

print(len(ans_l))

Measured memory_bytes: 9412
#include <bits/stdc++.h>
using namespace std;
/* typedef */
typedef long long ll;
/* constant */
const int INF = 1 << 30;
const ll LINF = 1LL << 50;
const int NIL = -1;
const int MAX = 10000;
const int mod = 1000000007;
const double pi = 3.141592653589;
/* global variables */
/* function */
/* main */
int main(){
    int n;
    cin >> n;
    cout << (n / 500) * 1000 + (n % 500) / 5 * 5 << '\n';
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <string>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <iomanip>
#include <utility>
#include <tuple>
#include <functional>
#include <bitset>
#include <cassert>
#include <complex>
#include <time.h>
#define int long long
#define endl '\n'
#define INF 1000000000000000000
#define EPS 1e-10
#define PI 3.141592653589793238
#define all(a) a.begin(),a.end()
#define rep(i, n) for (int i = 0; i < (n); i++)
#define pb push_back
#define double long double
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
typedef pair<ll, P> PP;
typedef complex<double> com;
template<class T, class S> bool chmax(T &a, const S &b) { if (a < b) { a = b; return 1; } return 0; }
template<class T, class S> bool chmin(T &a, const S &b) { if (a > b) { a = b; return 1; } return 0; }
ll gcd(ll n, ll m) { return (m ? gcd(m, n%m) : n); }
ll lcm(ll n, ll m) { return n / gcd(n, m)*m; }


signed main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	cout << fixed << setprecision(20);
	//modcalc();

	vector<int> ans = { 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 };
	int n;
	cin >> n;
	cout << ans[n - 1] << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define fast ios_base::sync_with_stdio(false),cin.tie(nullptr)
int main()
{
        fast;
        int x,y;
        cin>>x>>y;
        if(y%2!=0)
                cout<<"No"<<endl;
        else
        {
                int cranes=(4*x-y)/2;
                int turtles=(y-2*x)/2;
                //cout<<cranes<< " "<<turtles<<endl;
                if(abs(cranes)+abs(turtles)==x)
                        cout<<"Yes"<<endl;
                else
                        cout<<"No"<<endl;
        }
}

Measured memory_bytes: 3668
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define Rep(i,s,n) for(int i=s;i<n;i++)
#define fi first
#define se second
#define all(c) c.begin(),c.end()
typedef long long int ll;
typedef pair<int, int> P;
typedef long double ld;
void Ans(bool x){if(x) cout<<"Yes"<<endl;else cout<<"No"<<endl;}

const int INF=100100;
const ll mod=1000000007;

int main(){
  int n;cin>>n;
  vector<P> a(n),b(n);
  int q,w;
  rep(i,n){
    cin>>q>>w;
    a[i]=P(w,q);
  }
  rep(i,n){
    cin>>q>>w;
    b[i]=P(q,w);
  }
  sort(all(b));
  sort(all(a));
  int ans=0;
  rep(i,n){
    P now=b[i];
    int d=-1;
    rep(j,n){
      if(now.fi>a[j].se&&now.se>a[j].fi){
        d=max(d,j);
      }
    }
    if(d!=-1){
      ans++;
      a[d]=P(INF,INF);
    }
  }
  
  cout<<ans<<endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <fstream>
#include <set>
#include <map>
#include <string>
#include <vector>
#include <queue>
#include <deque>
#include <stack>
#include <functional>
#include <algorithm>
#include <climits>
#include <cmath>
#include <iomanip>
using namespace std;
#define ll long long int
#define rep(i,n) for( int i = 0; i < n; i++ )
#define rrep(i,n) for( int i = n; i >= 0; i-- )
#define REP(i,s,t) for( int i = s; i <= t; i++ )
#define RREP(i,s,t) for( int i = s; i >= t; i-- )
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define INF 2000000000
#define mod 1000000007
#define INF2 1000000000000000000


int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N; cin >> N;
    int T, A;
    cin >> T >> A;
    int H[1010];
    rep(i, N) cin >> H[i];
    int num = 0;
    rep(i, N) {
        int a1 = abs(A * 1000 - (T * 1000 - H[i] * 6));
        int a2 = abs(A * 1000 - (T * 1000 - H[num] * 6));
        if(a1 < a2) {
            num = i;
        }
    }
    cout << num + 1 << endl;

    return 0;
}


Measured memory_bytes: 3628
using System;
using System.Collections.Generic;
using System.Text;
using System.Linq;

namespace ConsoleApplication2
{
    class Program
    {

        static void Main(string[] args)
        {
            int.Parse(Console.ReadLine());
            int[] x = Console.ReadLine().Split(' ')
                                .Select( s => int.Parse(s))
                                .ToArray();

            int[] y = Console.ReadLine().Split(' ')
                                .Select( s => int.Parse(s))
                                .ToArray();


            int[] d = x.Select((k,i) => Math.Abs(k-y[i])).ToArray();

            Func<double, double> dis = (dim) =>
            {
                return Math.Pow( d.Select(
                            c => Math.Pow(c, dim))
                                      .Sum(), 1.0 / dim);
            };

            Console.WriteLine("{0:f6}", d.Sum());
            Console.WriteLine("{0:f6}", dis(2.0));
            Console.WriteLine("{0:f6}", dis(3.0));
            Console.WriteLine("{0:f6}", d.Max());

        }
    }
}

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

dct = {}

for i in range(N):
    s = input()
    if not s in dct:
        dct[s] = 1

    else:
        dct[s] +=  1
    
m = max(dct.values())
for s in sorted(k for k in dct if dct[k] == m):
    print(s)

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

int main() {
  int n,m,ans=0;
  cin >> n >> m;

  vector<int> onoff(n);
  vector<bool> light(m);
  vector<int> k(m);
  vector<int> p(m);
  vector<vector<int>> change(n);
  for(int i=0;i<m;i++) {
    cin >> k.at(i);
    for(int j=0;j<k.at(i);j++) {
      int a;
      cin >> a;
      change[a-1].push_back(i);
    };
  };
  for(int i=0;i<m;i++) {
    cin >> p.at(i);
    light.at(i) = p.at(i)==0;
  };

  bool bre=false;
  while(true) {
    for(int i=0;i<m;i++) {
      if(light.at(i)==0) break;
      if(i+1==m) ans++;
    };
    bool b=true;
    for(int i=0;b;i++) {
      if(onoff.at(i)==0){
        onoff.at(i)=1;
        for(int j=0;j<change.at(i).size();j++) {
          light.at((change.at(i).at(j)))=!(light.at((change.at(i).at(j))));
        };
        b=false;
      } else {
        onoff.at(i)=0;
        for(int j=0;j<change.at(i).size();j++) {
          light.at((change.at(i).at(j)))=!(light.at((change.at(i).at(j))));
        };
        if(i+1==n) {
          bre=true;
          break;
        };
      };
    };
    if(bre) break;
  };

  cout << ans << endl;
}

Measured memory_bytes: 256
n = int(input())
a = list(map(int, input().split()))
a.sort(reverse = True)
a.append(0)
i = 0
j = 0
while i + 1 < a[i + 1]:
    i += 1
    j += 1
while i + 1 <= a[j]:
    j += 1
if (j - i) % 2 == 0 or (a[i] - i) % 2 == 0:
    print("First")
else:
    print("Second")

Measured memory_bytes: 20384
#include<iostream>
#include<algorithm>
using namespace std;
int main(){
    int a;
    int b;
    int c;

    cin >> a >> b >> c;

    if((a==7 && b==5 && c==5) || (a==5 && b==7 && c==5) || (a==5 && b==5 && c==7) ){
        printf("YES");
    }else{
        printf("NO");
    }
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef long double ld;
typedef vector<ll> vl;
typedef vector<string> vs;
typedef vector<char> vc;
typedef queue<ll> ql;
typedef deque<ll> dql;
typedef priority_queue<ll/*, vl, greater<ll>*/> pql; //降順(/*昇順*/)
typedef set<ll> sl;
typedef pair<ll, ll> pl;
typedef vector<vl> vvl;
typedef vector<pl> vpl;
#define rep(i, n) for(ll i = 0; i < ll(n); i++)
#define rep2(i, n) for(ll i = 1; i <= ll(n); i++)
//#define rep(i, k, n) for(ll i = k-1; i < ll(n); i++)
//#define rep2(i, k, n) for(ll i = k; i <= ll(n); i++)
#define all(v) (v).begin(), (v).end()
bool chmin(ll &a, ll b) {if(b < a) {a = b; return 1;} return 0;}
bool chmax(ll &a, ll b) {if(b > a) {a = b; return 1;} return 0;}
const ll INF = 1LL << 60;
const ll MOD = 1e9 + 7;
//const ll MOD = 998244353;
const ll MAX = 1e9;
const char newl = '\n';

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout << fixed << setprecision(30);
  
  ld a, b;
  cin >> a >> b;
  a *= b;
  cout << (ll)floor(a) << newl;
  return 0;
}

Measured memory_bytes: 3764
#include <iostream>
#include <cstdio>
#include <cmath>

using namespace std;
typedef long long ll;

int main(){
  int n, a[100000];
  int m, M;

  cin>>n;
  m=1e9;
  M=-1e9;
  ll s=0LL;
  for(int i=0; i<n; i++){
    cin>>a[i];
    if(a[i]<m) m=a[i];
    if(a[i]>M) M=a[i];
    s+=a[i];
  }

  cout<<m<<" "<<M<<" "<<s<<endl;
}

Measured memory_bytes: 3128
#include <stdio.h>

int main(){
    int n;
    double ans;
    double num;

    scanf("%d", &n);

    if(n % 2 == 0){
        num = n / 2;
    }else{
        num = n / 2 + 1;
    }

    ans = num / n;

    printf("%lf", ans);
    return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
#pragma GCC optimize("Ofast,no-stack-protector,unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#define ll          long long
#define pb          push_back
#define mp 			make_pair
#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 fi          firstn
#define si          second
#define sz(x)       (ll)x.size()
#define endl        '\n'
#define checkbit(n, b) ((n >> b) & 1)
#define mod        1000000007
#define puts(n)		cout<<n;
#define fr(i,l,u) 	for(i=l;i<=u;i++)
#define bk(i,l,u)	for(i=l;i>=u;i--)
#define mset(m,v) memset(m,v,sizeof(m))
using namespace std;
ll posx[]={1,-1,0,0};
ll posy[]={0,0,1,-1};

void solve()
{
    ll n,i,j,k;
    cin>>n>>k;
    ll dp[n+1];
    ll a[n+1];
    for(i=1;i<=n;i++)
    {
        cin>>a[i];
        dp[i]=mod;
    }
    dp[1]=0;
    for(i=1;i<n;i++)
    {
        for(j=1;j<=k;j++)
        {
            if((i+j)<=n)
            dp[i+j]=min(dp[i+j],dp[i]+abs(a[i+j]-a[i]));
        }
    }
    cout<<dp[n];

}

signed main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	int t=1;
	//cin>>t;
	while(t--)
	{
		solve();
	}
	return 0;
}


Measured memory_bytes: 1792
#include <iostream>
#include <string>
#include <cstring>
#include <algorithm>
#include <functional>
#include <cmath>
#include <set>
#include <queue>
#include <vector>
#include <climits>
#include <sstream>
#include <iomanip>
#include <map>
#include <stack>
using namespace std;
typedef unsigned long long ull;
typedef long long ll;

int main()
{
	ll N, A, B, C, D;
	cin >> N >> A >> B >> C >> D;

	auto diff = abs(A - B);
	auto result = false;
	for (auto i = 0; i <= N - 1; i += 2)
	{
		auto x = N - 1 - i;
		if (x * C - i / 2 * (D - C) <= diff && diff <= x * D + i / 2 * (D - C))
		{
			result = true;
			break;
		}
	}

	if (result)
	{
		cout << "YES" << endl;
	}
	else
	{
		cout << "NO" << endl;
	}

	return 0;
}

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

using namespace std; 
using ll = long long;
using ull = unsigned long long;
using pii = pair<int,int>; 
#define INF INT_MAX/2 //(1<<(4*4-1))
#define MOD 1000000007
#define rng(a) a.begin(),a.end()
#define rrng(a) a.rbegin(),a.rend()

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

   /*
   int N,K;
   cin>>N>>K;

   if(N<=2){
      cout<<"NO"<<endl;
      return 0;
   }

   int a;
   a=max(N/2,(N+1)/2);
   if(a>=K)cout<<"YES"<<endl;
   else cout<<"NO"<<endl;
   */

   vector<int>a(3),b(3);
   for(int i=0;i<3;i++)cin>>a[i]>>b[i];
   vector<int>s(4);
   for(int i=0;i<3;i++){
      if(b[i]==1)s[0]++;
      if(b[i]==2)s[1]++;
      if(b[i]==3)s[2]++;
      if(b[i]==4)s[3]++;
      if(a[i]==1)s[0]++;
      if(a[i]==2)s[1]++;
      if(a[i]==3)s[2]++;
      if(a[i]==4)s[3]++;
   }
   
   bool ok = false;
   int one=0,two=0;
   for(int i=0;i<4;i++){
      if(s[i]==1)one++;
      if(s[i]==2)two++;
   }
   if(one==2&&two==2)ok=true;

   if(ok)cout<<"YES"<<endl;
   else cout<<"NO"<<endl;
   return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
#define FOR(i,l,r) for(i=l;i<r;i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(x) x.begin(),x.end()
#define P pair<ll,ll>
#define F first
#define S second
ll MOD=1000000007;
ll E(ll N){
  if(N==1)return 1;
  else return E(N-1)*N%MOD;
}
signed main(){
  ll N,M,ans=0;cin>>N>>M;
  if(abs(N-M)==1)ans=E(N)*E(M)%MOD;
  if(N-M==0)ans=E(N)*E(M)%MOD*2%MOD;
  cout<<ans<<endl;
  return 0;
}

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

int main() {
    int A,B;
    cin >> A >> B;
    int sum = 0;
    for(int i = A; i < B+1; i++){
       
      if(i/10000 == i%10 && i%10000/1000 == i%10000%1000%100/10)
       sum+=1;
    }
    cout << sum << endl;
} 

Measured memory_bytes: 256
#include<bits/stdc++.h>
//#include<ext/pb_ds/assoc_container.hpp>
//#include<ext/pb_ds/tree_policy.hpp>
//
//
//using namespace __gnu_pbds;
using namespace std;

#define pb                     push_back
#define ll                     long long
#define forn(i,n)              for(int i=0; i<(int)n; i++)
#define forn1(i,n)              for(int i=1; i<=(int)n; i++)

#define sfd(a)                 scanf("%d", &a)
#define sffd(a,b)              scanf("%d%d", &a, &b)
#define sffl(a,b)              scanf("%lld%lld", &a,&b)
#define sfl(a)                 scanf("%lld", &a)

#define pii                    pair<int , int>
#define pll                    pair<ll , ll>
#define ff                     first
#define ss                     second
#define mem(a, val)            memset(a, val, sizeof(a))
#define all(x)                 (x).begin(), (x).end()

//#define mx                     200005
#define INF_mx                 1e18
#define gcd(a,b)               __gcd(a, b)
#define lcm(a,b)               (a*b)/__gcd(a,b)
#define PRINT                  cout<<"hi"<<endl
#define PI acos(-1)
#define fast_in_out          ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define Q    int q; cin>>q; while(q--)
/*
tree<
       int,
     null_type,
     less<int>,
     rb_tree_tag,
     tree_order_statistics_node_update>t;
*/

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

   for(int i=0; i<s.size(); i++)
   {
       if(s[i]=='7') {cout<<"Yes"<<endl;return 0;}
   }
    cout<<"No"<<endl;
    return 0;
}
/*
1
21 7
wudixiaoxingxingheclp
*/


Measured memory_bytes: 3596