akhauriyash/Code-Regression huggingface dataset:
import java.util.Scanner;
public class Main {
	static int[][] judge(int x, int y,char[][] c){
		int h = x;
		int w = y;
		int[][] ret = new int[h][w];
		for(int i = 0; i < h; i++){//????????°?????????
			int cloud = -1;//???????????????????´?
			for(int k = 0; k < w; k++){
				if(c[i][k] == 'c'){//????????£??????
					cloud = k;
					ret[i][k] = 0;
				}else if(cloud == -1 && c[i][k] == '.'){//"."??§???????????´??????????????????
					ret[i][k] = -1;
				}else{//"."??§?????????????????????
					int d = k - cloud;//?????¨????????¢
					ret[i][k] = d;
				}
			}
		}
		return ret;
	}
	void doIt() {
		// TODO Auto-generated method stub
		Scanner sc = new Scanner(System.in);
		int h = sc.nextInt();
		int w = sc.nextInt();
		int p = 0;//????????????????????????
		char weather[][] = new char[h][];//??\?????¨
		int ans[][] = new int[h][w];//????????¨
		for(int i = 0; i < h; i++){//????????????????????\???
			weather[i] = sc.next().toCharArray();
		}
		
//		for(int i = 0; i < h; i++){//????????°?????????
//			int cloud = -1;//???????????????????´?
//			for(int k = 0; k < w; k++){
//				if(weather[i][k] == 'c'){//????????£??????
//					cloud = k;
//					ans[i][k] = 0;
//				}else if(cloud == -1 && weather[i][k] == '.'){//"."??§???????????´??????????????????
//					ans[i][k] = -1;
//				}else{//"."??§?????????????????????
//					int d = k - cloud;//?????¨????????¢
//					ans[i][k] = d;
//				}
//			}
//		}
		ans = judge(h,w,weather);
		for(int i = 0; i < h; i++){
			p = 0;
			for(int k = 0; k < w; k++){
				if(p == w-1){
					System.out.println(ans[i][k]);
				}else{
					System.out.print(ans[i][k]);
					System.out.print(" ");
					p++;
				}
			}
		}
	}
	
	public static void main(String[] args){
		new Main() . doIt();
	}

}

Measured memory_bytes: 35456
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define mp make_pair
#define vi vector<int>
#define ppi pair<int,pi>
#define ld long double
#define pb push_back
#define eb emplace_back
#define F first
#define S second
#define deb(x) cout << #x << "=" << x << endl
#define deb2(x, y) cout << #x << "=" << x << "," << #y << "=" << y << end
#define all(x) x.begin(), x.end()
#define clr(x) memset(x, 0, sizeof(x))
#define tr(it, a) for(auto it = a.begin(); it != a.end(); it++)
#define PI 3.1415926535897932384626
#define f(i, begin, end) for (__typeof(end) i = (begin); i != (end) ; i += 1 - 2 * ((begin) > (end)))
#define nl cout<<"\n";
#define endl "\n"
#define par(a,n) f(i,0,n) cout<<a[i]<<" "; nl
//void prt(int x) {cerr << x;}
#define vv(n,m) vector <vector <int> > v(n, vector <int> (m));

#define er(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }
void err(istream_iterator<string> it) {}
template<typename T, typename... brgs>
void err(istream_iterator<string> it, T a, brgs... args) {
	cerr << *it << " = " << a << endl;
	err(++it, args...);	
}
#pragma GCC target ("avx2")
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")
typedef pair<int,int> pii;
typedef vector<pii> vpii;
const int mod = 1000000007;
const int N = 3e5;

// int kadane(int*a, int n);
// bool isPrime(int n);
// int mpow(int a, int b);

int cmp(int a, int b){
  return a>b;
}

void solve(){
  string s,t;
  cin>>s>>t;
  int a=0;
  f(i,0,s.length()){
    if(s[i]!=t[i]) a++;
  }
  cout<<a<<endl;

}

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

int mpow(int a, int b){ /* pow(a, b) % m */
  int m=mod;
  int x=1;
  while (b>0){
    if (b&1){
      x=(x * a) % m;
    }
    a=(a*a) % m; /* compute the next power of 2 */
    b>>=1; /* this is equivalent to b = floor(b / 2) */
  }
  return x;
}
bool isPrime(int n) 
{ 
    if (n <= 1)  return false; 
    if (n <= 3)  return true; 
    if (n%2 == 0 || n%3 == 0) return false; 
    for (int i=5; i*i<=n; i=i+6) 
        if (n%i == 0 || n%(i+2) == 0) 
           return false; 
    return true; 
} 

int kadane(int*a, int n){
    int max_so_far = INT_MIN, max_ending_here = 0;
    f(i,0,n){
        max_ending_here+=a[i];
        max_so_far = max(max_so_far, max_ending_here);
        if(max_ending_here<0) max_ending_here=0;
    }
    return max_so_far;
}

Measured memory_bytes: 3788
#include<bits/stdc++.h>
#define pi (atan(1)*4)
using namespace std;
double a,b,h,m,ang,c;
int main(){
	cin>>a>>b>>h>>m;
	ang=5.5*m-30*h;
	if(ang<0) ang=360+ang;
	c=sqrt(a*a+b*b-2*a*b*cos(ang*pi/180));
	printf("%.20lf",c);
	return 0;
}

Measured memory_bytes: 4224
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
const ll MOD=1000000007;
const double PI=3.14159265358979;
const ll INF= pow(10,18);
typedef pair<ll,ll> P;
typedef vector<ll> vl;
typedef vector<vl> vvl;
#define FOR(i,a,b) for(ll i=a;i<b;i++)
#define rep(i,n) FOR(i,0,n)
string abc="abcdefghijklmnopqrstuvwxyz";
string ABC="ABCDEFGHIJKLMNOPQRSTUVWXYZ";

int main() {
  ll k,a,b;
  cin >> k >> a >> b;
  if(b-a>=2){
    if(k>a){
      ll z=k-(a-1);
      cout << (a-1)+(z/2*(b-a)+z%2)+1 << endl;
    }
    else{
      cout << k+1 << endl;
    }
  }
  else{
    cout << k+1 << endl;
  }
}

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

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

int main(){
    int x,y;
    cin>>x>>y;
    int GCD=gcd(x,y);
    cout<<x+y-GCD+1<<endl;

    return 0;
}


Measured memory_bytes: 3072
#include<cstdio>
#include<iostream>
#include<string>
#include<map>
#include<cmath>
using namespace std;
int change(string x){
    int t = 0;
    for(int i = 0; i < x.size(); i++){
        t = t + (x[i]-'0')*pow(2,4-i);
    }
    return t;
}
int main(){
    string str;
    map<char,string> d;
    d[' '] = "101";
    d['\''] = "000000";
    d[','] = "000011";
    d['-'] = "10010001";
    d['.'] = "010001";
    d['?'] = "000001";
    d['A'] = "100101";
    d['B'] = "10011010";
    d['C'] = "0101";
    d['D'] = "0001";
    d['E'] = "110";
    d['F'] = "01001";
    d['G'] = "10011011";
    d['H'] = "010000";
    d['I'] = "0111";
    d['J'] = "10011000";
    d['K'] = "0110";
    d['L'] = "00100";
    d['M'] = "10011001";
    d['N'] = "10011110";
    d['O'] = "00101";
    d['P'] = "111";
    d['Q'] = "10011111";
    d['R'] = "1000";
    d['S'] = "00110";
    d['T'] = "00111";
    d['U'] = "10011100";
    d['V'] = "10011101";
    d['W'] = "000010";
    d['X'] = "10010010";
    d['Y'] = "10010011";
    d['Z'] = "10010000";
    string a = "ABCDEFGHIJKLMNOPQRSTUVWXYZ .,-'?";
    while(getline(cin,str)){
        string ans;
        string temp;
        for(int i = 0; i < str.size(); i++){
            ans += d[str[i]];
        }
        for(int i = 0;i < ans.size()%5; i++){
            ans+= "0";
        }
        for(int i = 0; i < ans.size(); i+=5){
            temp="";
            temp += ans[i];
            temp += ans[i+1];
            temp += ans[i+2];
            temp += ans[i+3];
            temp += ans[i+4];
            cout << a[change(temp)];
        }
        cout << endl;
    }
    return 0;
}

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

using namespace std;
typedef long long int ll;

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


int main(int argc, char const *argv[])
{
    ll n;
    cin >> n;
    vector<ll> c(n), s(n), f(n), ans(n, 0);
    for (ll i = 0; i < n - 1; i++)
    {
        cin >> c[i] >> s[i] >> f[i];
    }

    ans[n - 2] = s[n - 2] + c[n - 2];

    for (ll i = n - 3; i >= 0; i--)
    {
        ll temp = s[i] + c[i];
        for (ll k = i + 1; k < n - 1; k++)
        {
            ll time = s[k];
            while (temp > time)
            {
                time += f[k];
            }
            temp = time + c[k];
        }
        ans[i] = temp;
    }

    for (auto i : ans)
    {
        cout << i << endl;
    }
}

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

int64_t gcd(int64_t a, int64_t b) {
    if (b > a) {
        int64_t c = b;
        b = a;
        a = c;
    }

    if (b == 0) {
        return a;
    }

    int64_t c = a % b;
    return gcd(b, c);
}

int main()
{
    int64_t N;
    cin >> N;
    int64_t b_n = 1;
    for (int i=0; i < N; i++) {
        int64_t num;
        cin >> num;
        b_n = num * (b_n / gcd(num, b_n));
    }

    cout << b_n << endl;
}

Measured memory_bytes: 256
#include <stdlib.h> 
#include <stdio.h>
#include <iostream>
#include <string.h>
#include <math.h>
#define PI 3.14159265359
using namespace std; 

int main()
{
    float r;
    double c;
    cin>>r;
    c = (2*r)*PI;
    cout<<c; 

    return 0;
}



Measured memory_bytes: 3776
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<queue>
using namespace std;
typedef long long ll;
#define rep(i,n) for(ll i=0;i<n;++i)
#define rep1(i,n) for(ll i=1;i<=n;++i)
int main(){
    ll a,b,k;cin>>a>>b>>k;
    if(a>=k)a-=k;
    else{
        b=b+a-k;
        a=0;
        if(b<0)b=0;
    }
    cout<<a<<" "<<b<<endl;
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<cmath>
#include<string.h>
#include<stdio.h>
#include<algorithm>
using namespace std;

long long n;

int main()
{
    long long i,j,k;
    cin>>n;
    for(i=1;i<=3500;i++)
    {
        for(j=1;j<=3500;j++)
        {
            long long p,q;
            p=n*i*j;
            q=4ll*i*j-n*(i+j);
            
            if(q>0 && p%q==0)
            {
                cout<<i<<' '<<j<<' '<<p/q<<endl;
                return 0;
            }
        }
    }
    
    
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
int main()
{
  int S, h, m, s;
  std::cin >> S;
  h = S / 3600;
  S = S % 3600;
  m = S / 60;
  s = S % 60;
  std::cout << h << ":" << m << ":" << s << '\n';
  return (0);
}

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

#define ll long long
#define mod 1000000007
#define pb push_back
#define pi pair<int,int>
#define vi vector<int>
#define vpi vector< pi > 
#define IOS ios_base::sync_with_stdio(false),cin.tie(NULL)
const int N=500003;

int main()
{
  double r;
  cin>>r;
  
  cout<<2*acos(-1)*r;
	
	return 0;
}

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

int read() {
	char c = getchar();
	int x = 0;
	while(c >= '0' && c <= '9') {
		x = x * 10 + c - '0';
		c = getchar();
	}
	return x;
}

int main() {
	int a, b, c;
	cin >> a >> b >> c;
	if(a + b + c >= 22) cout << "bust" << endl;
	else cout << "win" << endl; 
	return 0;
}


Measured memory_bytes: 256
def gs() gets.chomp end
def gi() gets.to_i end
def gsmi() gets.chomp.split.map(&:to_i) end
def debug(k,v) puts "#{k}: #{v}" end
def desc(ar) ar.sort!{|x,y|y<=>x} end
def min(a,b) a<=b ? a : b end
def max(a,b) a>=b ? a : b end
def sum(ar) ar.inject(:+) end

$stdin = File.open('input.txt') if File.exist?('input.txt')
n,@k = gsmi#10**5, 10**9
@as = gets.chomp.split.map(&:to_f)

def ok(l)
  cnt = 0
  @as.each do |a|
    cnt += (a/l).ceil
    cnt -= 1
  end
  cnt <= @k
end

min, max = 0, 10**9+1
while max-min >1
  mid = (min+max)/2
  if ok(mid)
    max = mid
  else
    min = mid
  end
end
puts max


Measured memory_bytes: 29800
{-# LANGUAGE BangPatterns          #-}

import Control.Monad
import Control.Applicative
import Data.List as List
import Data.Set as Set



solve:: Int -> String -> String
solve _ [] = ""
solve i (x:xs)
    | (mod i 2) == 0 = solve (i + 1) xs
    | otherwise = [x] ++ (solve (i + 1) xs) 

main :: IO()
main = do
    s <- getLine
    let a = solve 1 s
    putStrLn a


Measured memory_bytes: 4988
/*#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp>*/
#include <bits/stdc++.h>

using namespace std;
//using namespace __gnu_pbds;
 
typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> pii;
//typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> ordered_set;

#define FOR(i, a, b) for (int i=a; i<b; i++)
#define F0R(i, a) for (int i=0; i<a; i++)
#define FORd(i,a,b) for (int i = (b)-1; i >= a; i--)
#define F0Rd(i,a) for (int i = (a)-1; i >= 0; i--)
 
#define mp make_pair
#define pb push_back
#define f first
#define s second
#define lb lower_bound
#define ub upper_bound

const int MOD = 1000000007;
double PI = 4*atan(1);

int H,W, cum[101][101], h, w;
char grid[101][101];

int sum(int h1, int h2, int w1, int w2) {
    return cum[h2][w2]-cum[h1-1][w2]-cum[h2][w1-1]+cum[h1-1][w1-1];
}

int main() {
	cin >> H >> W;
	FOR(i,1,H+1) FOR(j,1,W+1) {
	    cin >> grid[i][j];
	    cum[i][j] = cum[i][j-1]+cum[i-1][j]-cum[i-1][j-1];
	    if (grid[i][j] == 'o') cum[i][j] ++;
	    else if (grid[i][j] == 'E') h = i, w = j;
	}
	int dp[h][H-h+1][w][W-w+1];
	memset(dp,0,sizeof dp);
	F0R(a,h) F0R(b,H-h+1) F0R(c,w) F0R(d,W-w+1) {
	    if (a < h-1) {
	        if (h-a-1 > b) dp[a+1][b][c][d] = max(dp[a+1][b][c][d],dp[a][b][c][d]+sum(h-a-1,h-a-1,max(d+1,w-c),min(W-c,w+d)));
	        else dp[a+1][b][c][d] = max(dp[a+1][b][c][d],dp[a][b][c][d]);
	    } 
	    if (b < H-h) {
	        if (h+b+1 < H-a+1) dp[a][b+1][c][d] = max(dp[a][b+1][c][d],dp[a][b][c][d]+sum(h+b+1,h+b+1,max(d+1,w-c),min(W-c,w+d)));
	        else dp[a][b+1][c][d] = max(dp[a][b+1][c][d],dp[a][b][c][d]);
	    }
	    if (c < w-1) {
	        if (w-c-1 > d) dp[a][b][c+1][d] = max(dp[a][b][c+1][d],dp[a][b][c][d]+sum(max(b+1,h-a),min(H-a,h+b),w-c-1,w-c-1));
	        else dp[a][b][c+1][d] = max(dp[a][b][c+1][d],dp[a][b][c][d]);
	    }
	    if (d < W-w) {
	        if (w+d+1 < W-c+1) dp[a][b][c][d+1] = max(dp[a][b][c][d+1],dp[a][b][c][d]+sum(max(b+1,h-a),min(H-a,h+b),w+d+1,w+d+1));
	        else dp[a][b][c][d+1] = max(dp[a][b][c][d+1],dp[a][b][c][d]);
	    }
	}
	cout << dp[h-1][H-h][w-1][W-w];
}

Measured memory_bytes: 25728
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Battle_0528_1問目
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] A = Console.ReadLine().Split(' ');
            int W = int.Parse(A[0]);
            int X = int.Parse(A[1]);
            int Y = int.Parse(A[2]);
            int Z = int.Parse(A[3]);

            Duelist duelist1 = new Duelist();
            duelist1.Name = "高橋";
            duelist1.HP = W;
            duelist1.Attack = X;

            Duelist duelist2 = new Duelist();
            duelist2.Name = "青木";
            duelist2.HP = Y;
            duelist2.Attack = Z;

           while(true)
            {
                duelist2.HP -= duelist1.Attack;
                if(duelist2.HP<=0)
                {
                    Console.WriteLine("Yes");
                    break;
                }

                duelist1.HP -= duelist2.Attack;
                if(duelist1.HP<=0)
                {
                    Console.WriteLine("No");
                    break;
                }
             
            }
            Console.Read();

        }
    }

    class Duelist
    {
        public string Name;
        public int HP;
        public int Attack;

    }
}


Measured memory_bytes: 27536
#include<stdio.h>
#include<algorithm>
int main()
{
	int K,U,P,C;
	K=U=P=C=0;
	char*p,s[512];
	scanf("%s",&s);
	for(p=s;*p;++p)
	{
		if(*p=='K')++K;
		if(*p=='U')++U;
		if(*p=='P')++P;
		if(*p=='C')++C;
	}
	printf("%d\n",std::min(std::min(K,U),std::min(P,C)));
	return 0;
}

Measured memory_bytes: 0
#pragma GCC optimize("Ofast")
#include<bits/stdc++.h>
#define ll long long
#define gmax(x,y) x=max(x,y)
#define gmin(x,y) x=min(x,y)
#define F first
#define S second
#define P pair
#define FOR(i,a,b) for(int i=a;i<=b;i++)
#define rep(i,a,b) for(int i=a;i<b;i++)
#define V vector
#define RE return
#define ALL(a) a.begin(),a.end()
#define MP make_pair
#define PB emplace_back
#define PF emplace_front
#define FILL(a,b) memset(a,b,sizeof(a))
#define lwb lower_bound
#define upb upper_bound
using namespace std;
int main(){
	ios::sync_with_stdio(0);
	cin.tie(0);
	int n,d,x,y,ans=0;
	cin>>n>>d;
	FOR(i,1,n){
		cin>>x>>y;
		double t=1.0*x*x+1.0*y*y;
		t=sqrt(t);
		if(t<=d)ans++;
	}
	cout<<ans;
	RE 0;
}




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

int main() {
  int N, M, C;
  cin >> N >> M >> C;

  vector<int> B(M);
  for (int i = 0; i < M; i++) {
    cin >> B.at(i);
  }

  vector<vector<int>> A(N, vector<int>(M));
  int ans = 0;
  for (int i = 0; i < N; i++) {
    int sum = 0;
    for (int j = 0; j < M; j++) {
      cin >> A.at(i).at(j);
      sum += A.at(i).at(j) * B.at(j);
    }
    if (sum + C > 0) ans++;
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <iomanip>
#include <vector>
#include <queue>
#include <set>
#include <map>

using namespace std;
typedef long long ll;
typedef pair<ll, int> P;
int N;
ll A[2000];
P p[2000];
ll dp[2005][2005];

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << setprecision(10) << fixed;
    cin >> N;
    for(int i = 0; i < N; i++) {
        cin >> A[i];
        p[i] = P(A[i], i);
    }
    sort(p, p+N, greater<P>());
    for(int i = 0; i < N; i++){
        ll a = p[i].first;
        int idx = p[i].second;
        for(int j = 0; j <= i; j++){
            int l = i-j;
            int r = N-j-1;
            // left
            if(i >= 1) dp[i][j] = max(dp[i][j], dp[i-1][j]+abs(idx-l)*a);
            else dp[i][j] = abs(idx-l)*a;
            // right
            if(i >= 1) dp[i][j+1] = max(dp[i][j+1], dp[i-1][j]+abs(r-idx)*a);
            else dp[i][j+1] = abs(r-idx)*a;
        }
    }
    ll ans = 0;
    for(int i = 0; i <= N; i++){
        ans = max(ans, dp[N-1][i]);
    }
    cout << ans << endl;
}

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

const int MAXN = 100010;
bool dp[MAXN];
int main() {
	memset(dp, 0, sizeof(dp));
	int n;
	cin>>n;
	dp[0] = 1;
	for (int price = 100; price <= 105; price++)
		for (int i=0; i+price<=n; i++) {
			if (dp[i]) {
				dp[i+price] = 1;
				if (i+price == n) {
					cout<<1<<endl;
					return 0;
				}
			}
		}
	cout<<0<<endl;
	return 0;
}

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

int main(){
    int x, i;
    i = 1;
    
    while(1){
        cin >> x;
        
        if(x == 0) break;
        
        cout << "Case " << i << ": " << x << endl;
        
        i++;
    }
    
    return 0;
}


Measured memory_bytes: 3052
N = int(input())
P = list(map(int, input().split(' ')))
num = 0
for i in range(len(P)):
    if P[i] == i+1:
        if i+1 == len(P):
            P[i],P[i-1] = P[i-1],P[i]
        else:
            P[i],P[i+1] = P[i+1],P[i]
        num += 1
print(num)


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

#undef _P
#define _P(...) (void)printf(__VA_ARGS__)
#define FOR(x,to) for(x=0;x<(to);x++)
#define FORR(x,arr) for(auto& x:arr)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define ALL(a) (a.begin()),(a.end())
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
//-------------------------------------------------------

int A,B,C;

void solve() {
	int i,j,k,l,r,x,y; string s;
	
	cin>>A>>B>>C;
	if(A==B&&A!=C) cout<<"Yes"<<endl;
	else if(A==C&&A!=B) cout<<"Yes"<<endl;
	else if(B==C&&A!=C) cout<<"Yes"<<endl;
	else cout<<"No"<<endl;
}


int main(int argc,char** argv){
	string s;int i;
	if(argc==1) ios::sync_with_stdio(false), cin.tie(0);
	FOR(i,argc-1) s+=argv[i+1],s+='\n'; FOR(i,s.size()) ungetc(s[s.size()-1-i],stdin);
	cout.tie(0); solve(); return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <iomanip>
#include <cmath>
#include <vector>
#include <sstream>
#include <string>
#include <cstdio>
#include <array>

using namespace std;

//デバッグ時はTESTを定義する。本番時はこの行をコメントアウトする
//#define TEST //*******************************************************************************************************************************************

//そうすることで、以下に定義する、デバッグ時にのみ標準出力する、doutコマンドが実現できる。本番時はダミーストリームに出力
#ifdef TEST
    #define dout cout
#else
    stringstream dummy; //デバッグ時のdoutコマンドのダミー出力先
    #define dout dummy.str(""); dummy.clear(stringstream::goodbit); dummy //dummyを毎回リセットしておかないとメモリ溢れちゃう。
    //どうせ表示しないからgoodbitしなくていいけど、表示する場合はこれしておかないとバグるらしいので、勉強のために。詳しくは http://d.hatena.ne.jp/linden/20060427/p1
#endif


////////////////////////////////////////
//AtCoder Beginner Contest 072
//C - Together
//
//±1範囲内に収まるa[]の数の最大値を求めよ
//TLEで手詰まり中
////////////////////////////////////////

#define value first
#define cnt second


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

    //input data
    int a[numOfData];
    for(int i=0; i<numOfData; i++) {
        cin >> a[i];
    }

    //a[]のvalueごとに数をカウント
    vector< pair<int, int> > list; //list[].first = value, .second = 当該valueの出現回数
    
    for(int i=0; i<numOfData; i++) {
        
        auto v = list.begin();
        for(; v!=list.end(); v++) {
            if(v->value == a[i]) { //(*v).value OK, *v.value NG
                v->cnt++;
                break;
            }
        }
        
        if( v==list.end() ) { //list中に当該valueが見つからなかった場合
//            pair<int, int> new_pair = {a[i], 1};
//            list.push_back(new_pair);
            list.push_back( make_pair(a[i], 1) ); //最後尾に新しいペアを挿入
        }
        
    } //end of i-loop

    //display list
    dout << "list\n";
    for(auto v : list) {
        dout << v.value << " " << v.cnt << endl;
    }
    dout << endl;

    //sort list
    sort(list.begin(), list.end()); //O(N*logN)
    
    //display list
    dout << "list\n";
    for(auto v : list) {
        dout << v.value << " " << v.cnt << endl;
    }
    dout << endl;
    
    //calc. max
    int numOfX;
    int numOfX_max = 0;
    
    dout << "calc. numOfX\n";
    
    auto v = list.begin();
    int X = v->value;
    numOfX = v->cnt + ((v+1)->value == X+1 ? (v+1)->cnt : 0); //listの先頭なので前は見ず、後ろだけ
    dout << v->value << " " << numOfX << endl;
    
    numOfX_max = numOfX; //最初の値をMaxに暫定設置
    
    for(++v; v!=list.end(); v++) {
        X = v->value;
        numOfX = ((v-1)->value == X-1 ? (v-1)->cnt : 0 ) + v->cnt + ((v+1)->value == X+1 ? (v+1)->cnt : 0); //前後を見てそれぞれX-1, X+1に等しいときだけcntをカウント
        if( numOfX_max < numOfX )
            numOfX_max = numOfX;
    
        dout << v->value << " " << numOfX << endl;
    }

    dout << "numOfX_max = ";
    cout << numOfX_max << endl;
    
    return 0;
}

Measured memory_bytes: 1276
import Control.Applicative ((<$>), (<*>))
import Control.Monad
import Data.List

main :: IO ()
main = do
  ss <- getc id
  print $ solve ss

solve :: [String] -> Int
solve = length . filter isPalindrome

isPalindrome :: String -> Bool
isPalindrome s = s == reverse s

getc :: (String -> a) -> IO [a]
getc f = map f . lines <$> getContents

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

 int main() {
   int h, w;
   cin >> h >> w;
   vector<string> a(h);
   for (int i = 0; i < h; i++) {
    cin >> a[i];
   }

   vector<bool> s(h, false);
   vector<bool> t(w, false);

   for (int i = 0; i < h; i++) {
    for (int j = 0; j < w; j++) {
       if (a[i][j] == '#') {
         s[i] = true;
         t[j] = true;
       }
    }
   }

   for (int i = 0; i < h; i++) {
     if (s[i]) {
       for (int j = 0; j < w; j++) {
         if (t[j]) {
           cout << a[i][j];
         }
       }
       cout <<"\n";
     }
   }
 }

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
  int N;
  cin>>N;
  int a[6];
  for(int i=0;i<6;i++){
    a[i]=N%10;
    N/=10;
  }
  int sum=0;
  for(int i=0;i<6;i++) sum+=a[i];
  if(sum==1) cout<<10<<endl;
  else cout<<sum<<endl;
}

Measured memory_bytes: 256
def lowbit(x):
	return x & (-x)

def update(n , c ,x , y):
	while x <= n:
		c[x] += y
		x += lowbit(x)

def query(c , x):
	ans = 0
	while x != 0:
		ans += c[x]
		x -= lowbit(x)
	return ans

def main():
	n , q = map(int , input().split())
	a_li = list(map(int , input().split()))
	a_li.insert(0,0)
	sum_li = [0 for _ in range(n + 1)]
	for i in range(1 , n + 1):
		sum_li[i] = sum_li[i - 1] + a_li[i]

	c = [0 for _ in range(n + 1)]
	for _ in range(q):
		t , l , r = map(int , input().split())
		if t == 1:
			print(query(c , r) - query(c , l) +  sum_li[r] - sum_li[l])
		else:
			update(n , c , l + 1 , r)

if __name__ == '__main__':
	main()

Measured memory_bytes: 71476
#include<bits/stdc++.h>
#define ll long long
using namespace std;
ll a,b,c,d,e,f,g,h,n,m,t,res;
vector<list<ll> >adj(100001);
bitset<100001>v;
vector<ll>val(100001,1);
void hi(ll x){
    v[x]=true;
    for(auto i=adj[x].begin();i!=adj[x].end();i++){
        if(!v[*i])hi(*i);
        val[x]=max(val[x],1+val[*i]);
    }
 
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin>>n>>m;
    for(int i=0;i<m;i++){
        cin>>a>>b;
        adj[a].push_back(b);
    }
    c=0;
    for(int i=1;i<=n;i++){
        if(v[i])continue;
        hi(i);
    }
    for(int i=1;i<=n;i++){
        c=max(c,val[i]);
    }
    cout<<c-1<<endl;
    return 0;
}

Measured memory_bytes: 7808
#include<bits/stdc++.h>
using namespace std;
#define rep(i,a,b) for(int i=(a);i<=(b);i++)
#define ll long long
const int mod=1e5+5;
priority_queue<int>q;
int main()
{
    int n,m;
    cin>>n>>m;
    rep(i,1,n)
    {
        int a;
        cin>>a;
        q.push(a);
    }
    while(m)
    {
        int temp=q.top()/2;
        q.pop();
        q.push(temp);
        m--;
    }
    ll ans=0;
    while(!q.empty())
    {
        ans+=q.top();
        q.pop();
    }
   cout<<ans<<endl;
}



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

def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))

def main():
    mod=10**9+7
    N,Ma,Mb=MI()
    a=[0]*N
    b=[0]*N
    c=[0]*N
    cab=[[0,0,0] for _ in range(N)]
    for i in range(N):
        cab[i][1],cab[i][2],cab[i][0]=MI()
    cab.sort()
    for i in range(N):
        a[i]=cab[i][1]
        b[i]=cab[i][2]
        c[i]=cab[i][0]
        
    
    inf=10**5
    #dp[i][j][k]はi番目の商品まででaがjg,bがkgをとるときの最低金額
    dp=[[[inf]*(N*10+1) for _ in range(N*10+1)] for i in range(N+1)]
    dp[0][0][0]=0
    
    ans=inf
    for i in range(N):
        for j in range(N*10+1-a[i]):
            for k in range(N*10+1-b[i]):
                if dp[i][j][k]!=inf:
                    dp[i+1][j][k]=dp[i][j][k]
                    dp[i+1][j+a[i]][k+b[i]]=min(dp[i+1][j+a[i]][k+b[i]],dp[i][j][k]+c[i])
                    if (j+a[i])*Mb==(k+b[i])*Ma:
                        ans=min(ans,dp[i+1][j+a[i]][k+b[i]])
                    
    if ans==inf:
        print(-1)
    else:
        print(ans)
    
    
    

main()


Measured memory_bytes: 94556
#include <algorithm>
#include <cmath>
#include <climits>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <fstream>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
#include <cassert>
#include <bits/stdc++.h>

using namespace std;

#define LOG(...) fprintf(stderr, __VA_ARGS__)
//#define LOG(...)
#define FOR(i, a, b) for(int i=(int)(a); i<(int)(b); ++i)
#define REP(i, n) for(int i=0; i<(int)(n); ++i)
#define ALL(a) (a).begin(), (a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define EXIST(s, e) ((s).find(e)!=(s).end())
#define SORT(c) sort(ALL(c))
#define RSORT(c) sort(RALL(c))
#define SQ(n) (n) * (n)

typedef long long ll;
typedef unsigned long long ull;
typedef vector<bool> vb;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vb> vvb;
typedef vector<vi> vvi;
typedef vector<vll> vvll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

const int INF = 100000;

int main() {
  int n, m;
  cin >> n >> m;
  int start = 0;
  REP(i, n){
    int k;
    cin >> k;
    start = (start << 1) | k;
  }
  int goal1 = 0, goal2 = 0;
  int t = 0;
  REP(i, m){
    int k;
    cin >> k;
    REP(j, k){
      goal1 = (goal1 << 1) | t;
      goal2 = (goal2 << 1) | (1 - t);
    }
    t = 1 - t;
  }

  vi dp(1 << (n+1), INF);
  vi dp_back(1 << (n+1), INF);
  dp[start] = 0;
  dp_back[start] = 0;

  // cout << bitset<15>(goal1) << endl;
  // cout << bitset<15>(goal2) << endl;
  int step = 0;

  while(min(dp[goal1], dp[goal2]) == INF) {
    // LOG("-------- step : %d\n", step);
    REP(i, 1 << (n+1)){
      if(dp[i]!=step) continue;
        // cout <<'s'<< bitset<15>(i) << endl;
      REP(j, n - 1){
        int trade = 3 << j;
        int disable = i & trade;
        int next = i ^ trade;
        // cout <<' '<< bitset<15>(next) << endl;
        if (disable == 0 || disable == trade) continue;
        if(next >= (1 << n)) continue;
        dp_back[next] = min(dp_back[next], dp[i] + 1);
        // cout << bitset<15>(next) << endl;
        // cout << dp_back[next] << endl;
      }
    }
    dp = dp_back;
    step ++;
  }
  cout << min(dp[goal1], dp[goal2]) << endl;
  // cout << dp[goal1] << endl;
  // cout << dp[goal2] << endl;
}

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

#define ll long long

#define MAX_N 200001

ll N;
set<ll> S;

void input() {
  ll a;
  cin >> N;
  for (ll i=0; i<N; i++) {
    cin >> a;
    if (S.find(a) != S.end()) {
      cout << "NO" << endl;
      return;
    }

    S.insert(a);
  }

  cout << "YES" << endl;
}

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


Measured memory_bytes: 9600
while True:
    n = int(input())
    if n == 0:break
    a = [input() for _ in range(n)]
    while True:
        if len(a) == 1:break
        c = 0
        s = 0
        for i in range(len(a)):
            if a[i].count('.') > c:
                c = a[i].count('.')
                s = i
        e = s
        while e < len(a) and a[e].count('.') == a[s].count('.'):
            e += 1
        k = a[s - 1].replace('.', '')
        b = [a[i] for i in range(s, e)]
        for i in range(len(b)):
            b[i] = int(b[i].replace('.', ''))
        if k == '+':
            a[s - 1] = '.'*a[s - 1].count('.')+str(sum(b))
            del a[s:e]
        else:
            m = 1
            for i in b:
                m *= i
            a[s - 1] = '.'*a[s - 1].count('.')+str(m)
            del a[s:e]
    print(a[0])
    


Measured memory_bytes: 5608
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#define FOR(i,a,b) for(int i=a;i<b;i++)
#define rep(i,n) FOR(i,0,n)
#define ROF(i,a,b) for(int i=a;i>=b;i--)
#define per(i,a) ROF(i,a,0)
#define pb push_back
using namespace std;
using ll=long long;
using ld=long double;
using ch=char;
typedef pair<ll,ll> P;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<P> vP;
typedef vector<ch> vc;
typedef vector<vc> vvc;
const ll MOD=1000000007;
const ll MOD2=998244353;
const ld PI=acos(-1);
const ll INF=1e18;
struct edge{ll to,cost;};
struct edge2{ll from,to,cost;};

template <typename T>
bool chmax(T &a, const T& b) {
    if (a < b) {
      a = b;
        return true;
    }
    return false;
}

template <typename T>
bool chmin(T &a, const T& b) {
    if (a > b) {
      a = b;
      return true;
    }
    return false;
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int N,M;
    cin >> N >> M;
    vector<pair<P,P>> p(N);
    rep(i,N){
        cin >> p[i].first.second >> p[i].second.first >> p[i].second.second;
    }
    ll ans=-1;
    rep(q,8){
        rep(i,N){
            if(q<4){
                p[i].first.first=p[i].first.second;
            }
            else{
                p[i].first.first=-p[i].first.second;
            }
            if(q%4<2){
                p[i].first.first+=p[i].second.first;
            }
            else{
                p[i].first.first-=p[i].second.first;
            }
            if(q%2==0){
                p[i].first.first+=p[i].second.second;
            }
            else{
                p[i].first.first-=p[i].second.second;
            }
        }
        sort(p.begin(),p.end());
        reverse(p.begin(),p.end());
        ll res=0;
        rep(i,M){
            res+=p[i].first.first;
        }
        chmax(ans,res);
    }
    cout << ans << endl;
}
/*
overflow checked?
corner case checked?
boundary checked?
not TLE in worst case checked?
*/

Measured memory_bytes: 3672
#define _CRT_SECURE_NO_WARNINGS

#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include<math.h>

//for
#define REP(i,n) for(int i=0,i##_len=(int)(n);i<i##_len;i++)
#define REPS(i,n) for(int i=1,i##_len=(int)(n);i<=i##_len;i++)
#define RREP(i,n) for(int i=(int)(n)-1;i>=0;i--)
#define RREPS(i,n) for(int i=(int)(n);i>0;i--)
#define SREP(i,s,n) for(int i=(int)(s),i##_len=(int)(n);i<i##_len;i++)

//printf
#define PRINTD(d) printf("%d\n",(d))
#define PRINTL(d) printf("%lld\n",(d))

//memset
#define m0(s) memset(s,0,sizeof(s))
#define ml(s) memset(s,63,sizeof(s))
#define fill(s,c) memset(s,c,sizeof(s))

#define INF 1e9

typedef long long ll;
int diff[4][2] = {
	{ 0, -1 },
	{ -1, 0 },
	{ 1, 0 },
	{ 0, 1 },
};

int Min(int a, int b) {
	return (a)<(b) ? (a) : (b);
}
int Max(int a, int b) {
	return (a) > (b) ? (a) : (b);
}

int main() {
	int a, b;
	scanf("%d %d", &a, &b);
	PRINTD(a <= b ? a : a - 1);
}

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

int a(int x1, int x2, int x3, int x4, int x5) {
  if(x1 == 0) {
    return 1;
  }
  if(x2 == 0) {
    return 2;
  }
  if(x3 == 0) {
    return 3;
  }
  if(x4 == 0) {
    return 4;
  }
  return 5;
}

int main() {
  int x1, x2, x3, x4, x5;
  cin >> x1 >> x2 >> x3 >> x4 >> x5;
  cout << a(x1, x2, x3, x4, x5);
}

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

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

    int ans = 0;
    for(int i = a; i < t+0.5; i += a){
        ans += b;
    }
    cout << ans << endl;
}

Measured memory_bytes: 384
import itertools
n = int(input())
s = list(itertools.permutations(range(1,n+1)))
a = tuple(map(int,input().split()))
b = tuple(map(int,input().split()))
aans = 0
bans = 0
for i in s:
  if a == i:
    aans = s.index(a)
  if b == i:
    bans = s.index(b)
print(abs(aans-bans))


Measured memory_bytes: 8052
#include <stdio.h>
#include <string>
#include <iostream>
#include <iomanip>
#include <map>
#include <algorithm>
#include <vector>
#include <math.h>
#define INF 1000000007
using namespace std;

int main(void){
    int ans=INF;
    string s;
    cin >> s;
    for(int i=0; i<s.length()-2; i++){
        int temp=stoi(s.substr(i,3));
        ans=min(ans,abs(753-temp));
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
n = int( input())
list = list(map(int, input().split()))
list = sorted(list)
count = 0
for i in range(n-2):
    for j in range(i+1, n):
        for k in range(j+1, n):
            if list[j]+list[i] > list[k] and list[i] != list[j] and list[j] != list[k]:
                count += 1
print(count)

Measured memory_bytes: 9180
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#include<cmath>
#include<map>
#include<iomanip>
#include<queue>
#include<stack>
#include<time.h>
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,n) for(int i=1;i<=n;i++)
#define ggr getchar();getchar();return 0;
#define prique priority_queue
constexpr auto mod = 1000000007;
#define inf 1e15
#define key 1e9
using namespace std;
typedef pair<int, int>P;
template<class T> inline void chmax(T& a, T b) {
	a = std::max(a, b);
}
template<class T> inline void chmin(T& a, T b) {
	a = std::min(a, b);
}
//combination(Nが小さい時はこれを使う)
const int MAX = 330000;
int fac[MAX], finv[MAX], inv[MAX];
void COMinit() {
	fac[0] = fac[1] = 1;
	finv[0] = finv[1] = 1;
	inv[1] = 1;
	for (int i = 2; i < MAX; i++) {
		fac[i] = fac[i - 1] * i % mod;
		inv[i] = mod - inv[mod % i] * (mod / i) % mod;
		finv[i] = finv[i - 1] * inv[i] % mod;
	}
}
int COMB(int n, int k) {
	if (n < k) return 0;
	if (n < 0 || k < 0) return 0;
	return fac[n] * (finv[k] * finv[n - k] % mod) % mod;
}

bool prime(int n) {
	int cnt = 0;
	for (int i = 1; i <= sqrt(n); i++) {
		if (n % i == 0)cnt++;
	}
	if (cnt != 1)return false;
	else return n != 1;
}
int gcd(int x, int y) {
	if (y == 0)return x;
	return gcd(y, x % y);
}
int lcm(int x, int y) {
	return x / gcd(x, y) * y;
}

//繰り返し二乗法（Nが大きい時の場合のcombination)
int mod_pow(int x, int y, int m) {
	int res = 1;
	while (y) {
		if (y & 1) {
			res = res * x % m;
		}
		x = x * x % m;
		y >>= 1;
	}
	return res;
}
int kai(int x, int y) {
	int res = 1;
	for (int i = x - y + 1; i <= x; i++) {
		res *= (i % mod); res %= mod;
	}
	return res;
}
int comb(int x, int y) {
	if (y > x)return 0;
	return kai(x, y) * mod_pow(kai(y, y), mod - 2, mod) % mod;
}
//UnionFind
class UnionFind {
protected:
	int* par, * rank, * size;
public:
	UnionFind(unsigned int size) {
		par = new int[size];
		rank = new int[size];
		this->size = new int[size];
		rep(i, size) {
			par[i] = i;
			rank[i] = 0;
			this->size[i] = 1;
		}
	}
	int find(int n) {
		if (par[n] == n)return n;
		return par[n] = find(par[n]);
	}
	void unite(int n, int m) {
		n = find(n);
		m = find(m);
		if (n == m)return;
		if (rank[n] < rank[m]) {
			par[n] = m;
			size[m] += size[n];
		}
		else {
			par[m] = n;
			size[n] += size[m];
			if (rank[n] == rank[m])rank[n]++;
		}
	}
	bool same(int n, int m) {
		return find(n) == find(m);
	}
	int getsize(int n) {
		return size[find(n)];
	}
};
int dight(int n) {
	int ans = 1;
	while (n >= 10) {
		n /= 10;
		ans++;
	}
	return ans;
}
int dight_sum(int n) {
	int sum = 0;
	rep(i, 20)sum += (n % (int)pow(10, i + 1)) / (pow(10, i));
	return sum;
}
signed main() {
	int n, a;
	cin >> n >> a;
	if (n % 500 <= a)puts("Yes");
	else puts("No");
	ggr
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(){
  string X;cin>>X;
  int cnt_st=0;
  int cnt_ss=0;
  int tf=1;
  for(int i=0;i<X.size();++i){
    if(X[i]=='S'){
      cnt_ss+=1;
      tf=0;
    } else if(X[i]=='T'){
      if(tf==0){
        if(cnt_ss>0){
          cnt_ss-=1;
          cnt_st+=2;
        }
        if(cnt_ss==0) tf=1;
      } else if(tf==1){
        cnt_ss=0;
      }
    }
  }
  int ans=X.size()-cnt_st;
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 644
#include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <numeric>
#include <functional>
#include <cmath>
#include <string>

using namespace std;
int main(int argc, const char * argv[]) {
    
    int x1, x2, y1, y2;
    cin >> x1 >> y1 >> x2 >> y2;
    int dx = x2-x1;
    int dy = y2-y1;

    cout << x2 - dy << " " ;
    cout << y2 + dx << " " ;
    cout << x1 - dy << " " ;
    cout << y1 + dx << " " ;
    
    cout << endl;

    return 0;
}

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

int main(){
  
  int a;
  int b;
  
  cin >> a >> b;
  
  if(a + b == 15){
    cout << '+' << endl;
  }
  else if(a * b == 15){
    cout << '*' << endl;
  }
  else{
    cout << 'x' << endl;
  }
 
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define fast ios::sync_with_stdio(false), cin.tie(0);
#define ll long long
#define endl '\n'

using namespace std;

main()
{
  fast;
  string s;
  int i;
  cin>>s;
  stack<char> p;
  for (i=0;i<s.size();i++)
  {
    if (s[i]=='0')
      p.push(s[i]);
    else if (s[i]=='1')
      p.push(s[i]);
    else if (s[i]=='B' && !p.empty())
      p.pop();
  }
  string ans="";
  char f;
  while (!p.empty())
  {
    f=p.top();
    p.pop();
    ans=f+ans;
  }
  cout<<ans<<endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,c) for(int i=0;i<(int)c;i++)
#define print(var) cout<<var<<endl;
#define DEBUG(var) cerr<<var<<endl;
// puts("str");

using ll = long long;
using P = pair<int,int>;
const int inf = 1000000000;//10^9

int main (){
  ll A,ans;
  double B;
  cin>>A>>B;
  //ll ib=round(B*100);
  ll ib=B*100+0.1;
  ans=(A*ib)/100;
  print(ans);


  return 0;

}


Measured memory_bytes: 3692
#include <cstdio>
#include <cstdlib>
#define INF (__INT32_MAX__ / 2)
#define MAX_N 100
#define MAX_W 10000

using namespace std;

int cost[9] = {2,5,5,4,5,6,3,7,6};

int n;
int nums[MAX_N];     //ソート済
int W;


int ddp[MAX_N][MAX_W + 1][MAX_N];
void sort(int *array, int left, int right);

int max(int left, int right) {
    return left > right ? left : right;
}

void array_copy(int *orig, int *copy, int left, int right) {
    for(int i = left; i < right; ++i)
        copy[i] = orig[i];
}

void print(int *array, int length) {
    for(int i = n - 1; i >= 0; --i)
        for(int j = 0; j < array[i]; ++j)
            printf("%i", nums[i]);
    printf("\n");
}

int cmp_value(int index, int *prev, int *cur, int cur_k) {
  
    int prev_sum = 0, cur_sum = cur_k;
    for(int i = index; i <= n; ++i) prev_sum += prev[i];
    for(int i = index + 1; i <= n; ++i) cur_sum += cur[i];
    if(prev_sum != cur_sum) return prev_sum - cur_sum;

    for(int i = n - 1; i >= index + 1; --i)
        if(prev[i] != cur[i])
            return prev[i] - cur[i];
    
    if(prev[index] != cur_k) return prev[index] - cur_k;
    return 0;
}

int main(int argc, char **argv) {
    scanf("%d", &W);
    scanf("%d", &n);

    for(int i = 0; i < n; ++i) {
        int tmp;
        scanf("%d", &tmp);
        nums[i] = tmp;
    }
    sort(nums, 0, n);

  
    for(int w = 1; w <= W; ++w)
        for(int i = 0; i <= n; ++i)
            ddp[n][w][i] = -INF;    


    for(int index = n - 1; index >= 0; --index)
        for(int volume = 1; volume <= W; ++volume)
        {
            array_copy(ddp[index + 1][volume], ddp[index][volume], index + 1, n + 1);
            ddp[index][volume][index] = 0;
            for(int k = 1; true; ++k) {
                if(volume < cost[nums[index] - 1] * k) break;

                if(cmp_value(index, ddp[index][volume], ddp[index + 1][volume - k * cost[nums[index] - 1]], k) < 0) {
                    array_copy(ddp[index + 1][volume - k * cost[nums[index] - 1]], ddp[index][volume], index + 1
                        , n + 1);
                    ddp[index][volume][index] = k;
                }
            }
            
        }

    print(ddp[0][W], n);
}


int buf[10];
void sort(int *array, int left, int right) {
    right--;
    if(left < right)
    {
        int mid = (left + right) / 2;

        sort(array, left, mid + 1);
        sort(array, mid + 1, right + 1);

        //merge
        int left_len = mid - left + 1;
        int right_len = right - mid;

        int i_left = 0;
        int i_right = 0;


        for(int i = 0; i < left_len + right_len; ++i)
        {
            if (i_left < left_len &&
                (i_right >= right_len || array[left + i_left] <= array[mid + 1 + i_right]))
                buf[i] = array[left + i_left++];
            else if (i_right < right_len)
                buf[i] = array[mid + 1 + i_right++];
            else
                break;
        }

        for(int i = 0; i < left_len + right_len; ++i)
            array[left + i] = buf[i];
    }
}

Measured memory_bytes: 41088
#include<cstdio>

int main(){
    int i,j,n,count[26];
    for(int i = 0; i < 26; i++){
        count[i] = 0;
 	}
    char ch;
    while(scanf("%c",&ch)!=EOF){
        if(ch>='a' && ch<='z'){
            count[ch-'a']++;
        }
        else if(ch>='A'&& ch<='Z'){
            count[ch-'A']++;
        }
    }
    for(j=0;j<26;j++){
        printf("%c : %d\n",j+'a',count[j]);
    }
    return 0;
}


Measured memory_bytes: 2684
#include <iostream>
#include <cstring>
#include <algorithm>
#include <vector>
#include <string>
#include <math.h>
#include <iomanip>
#include <limits>
#include <list>
#include <queue>
#include <tuple>
#include <map>
#include <stack>
#include <set>
using namespace std;
#define MOD (long long int)(1e9+7)
#define ll long long int
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define reps(i,n) for(int i=1; i<=(int)(n); i++)
#define REP(i,n) for(int i=n-1; i>=0; i--)
#define REPS(i,n) for(int i=n; i>0; i--)
#define INF (int)(1123456789)
#define LINF (long long int)(112345678901234567)
#define chmax(a, b) a = (((a)<(b)) ? (b) : (a))
#define chmin(a, b) a = (((a)>(b)) ? (b) : (a))
#define all(v) v.begin(), v.end()

const int N = (int)3e5;

ll mpow(ll a, ll b){
  if(b==0) return 1;
  else if(b%2==0){ll memo = mpow(a,b/2); return memo*memo%MOD;}
  else return mpow(a,b-1) * a % MOD;
}
ll lpow(ll a, ll b){
  if(b==0) return 1;
  else if(b%2==0){ll memo = lpow(a,b/2); return memo*memo;}
  else return lpow(a,b-1) * a;
}
ll gcd(ll a, ll b){
  if(b==0) return a;
  else return gcd(b, a%b);
}
vector<ll> kaijo_memo;
ll kaijo(ll n){
  if(kaijo_memo.size() > n) return kaijo_memo[n];
  if(kaijo_memo.size() == 0) kaijo_memo.push_back(1);
  while(kaijo_memo.size() <= n) kaijo_memo.push_back(kaijo_memo[kaijo_memo.size()-1] * kaijo_memo.size() % MOD);
  return kaijo_memo[n];
}
vector<ll> gyaku_kaijo_memo;
ll gyaku_kaijo(ll n){
  if(gyaku_kaijo_memo.size() > n) return gyaku_kaijo_memo[n];
  if(gyaku_kaijo_memo.size() == 0) gyaku_kaijo_memo.push_back(1);
  while(gyaku_kaijo_memo.size() <= n) gyaku_kaijo_memo.push_back(gyaku_kaijo_memo[gyaku_kaijo_memo.size()-1] * mpow(gyaku_kaijo_memo.size(), MOD-2) % MOD);
  return gyaku_kaijo_memo[n];
}

ll nCr(ll n, ll r){
  if(n == r) return 1;//0個の丸と-1個の棒みたいな時に時に効く？不安.
  if(n < r || r < 0) return 0;
  ll ret = 1;
  ret *= kaijo(n); ret %= MOD;
  ret *= gyaku_kaijo(r); ret %= MOD;
  ret *= gyaku_kaijo(n-r); ret %= MOD;
  return ret;
}


int main(void){
  int h,w,a,b;
  cin>>h>>w>>a>>b;
  vector<vector<int>> ans;
  rep(i,h){
    ans.push_back(vector<int>());
    rep(j,w){
      ans[i].push_back(0);
    }
  }
  rep(i,h){
    rep(j,a){
      ans[i][j] = 1;
    }
  }
  rep(i,b){
    rep(j,w){
      ans[i][j] = (ans[i][j]+1)%2;
    }
  }

  rep(i,h){
    rep(j,w){
      cout<<ans[i][j];
    }
    cout<<endl;
  }
  return 0;
}


Measured memory_bytes: 5248
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define fi first
#define se second
#define all(x) (x).begin(), (x).end()
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define repp(i, a, b) for (int i = a; i <= (b); ++i)
#define repr(i, a, b) for (int i = a; i >= (b); --i)
typedef long long ll;
const int INF = 1001001001;
const ll LINF = 1001001001001001001ll;
const int MOD = 1000000007;

template <class T>
inline bool chmin(T& a, T b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}

template <class T>
inline bool chmax(T& a, T b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}

int main() {
  int A, B;
  cin >> A >> B;
  cout << (A + B) % 24 << 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 int long long
#define all(v) v.begin() , v.end()
#define pb push_back
#define pii pair<int,int>
#define F first
#define S second
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
int mod = 998244353;
vector<int>v;
int dp[200000][20];
int solve(int n , int i)
{
    if(n<0) return 1e13;
    if(n == 0) return 0;
    if(i == v.size()) {
        if(n == 0) return 0;
        return 1e13;
    }

    if(dp[n][i] != -1) return dp[n][i];

    int ans=1e13;
    if(n >= v[i]) {
        ans=min(ans , 1+solve(n-v[i] , i+1));
        ans=min(ans , 1+solve(n-v[i] , i));
    }
    ans=min(ans , solve(n , i+1));

    return dp[n][i] = ans;
}


int32_t main()
{   fastio;

    int n;
    cin>>n;
    memset(dp , -1 , sizeof(dp));

    v.pb(1);
    int p=6;
    while(p<=100000)
    {
        v.pb(p);
        p *= 6;
    }
    int z=9;
    while(z<=100000)
    {
        v.pb(z);
        z *= 9;
    }

    cout<<solve(n , 0)<<"\n";

}


Measured memory_bytes: 40992
#include <iostream>
#define r(i,n) for(int i=0;i<n;i++)
using namespace std;int main(){int h,w,c[10][10],a;cin>>h>>w;r(i,10)r(j,10)cin>>c[i][j];r(k,10)r(i,10)r(j,10)c[i][j]=min(c[i][j],c[i][k]+c[k][j]);int ans=0;r(i,h)r(j,w){cin>>a;if(a!=-1)ans+=c[a][1];}cout<<ans;}


Measured memory_bytes: 384