akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define repr(i,a,b) for(int i=a;i<b;i++)
#define rep(i,n) for(int i=0;i<n;i++)
#define reprrev(i,a,b) for(int i=b-1;i>=a;i--) // [a, b)
#define reprev(i,n) reprrev(i,0,n)

                    
using ll = long long;
using ull = unsigned long long;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
const ll mod = 1e9+7;
void chmod(ll &M){
  if(M >= mod) M %= mod;
  else if(M < 0){
     M += (abs(M)/mod + 1)*mod;
    M %= mod;
}
}
ll modpow(ll x, ll n){
   if(n==0) return 1;
  ll res=modpow(x, n/2);
 if(n%2==0) return res*res%mod;
else return res*res%mod*x%mod;
}
int getl(int i, int N) { return i==0? N-1:i-1; };
int getr(int i, int N) { return i==N-1? 0:i+1; };
long long GCD(long long a, long long b) {
  if (b == 0) return a;
  else return GCD(b, a % b);
}

using namespace std;
/* <-----------------------------------------------------------------------------------> */
/* <-----------------------------------------------------------------------------------> */
/* <-----------------------------------------------------------------------------------> */
/* <-----------------------------------------------------------------------------------> */
int main()
{   
    int X, N;
    cin >> X >> N;
    if(N == 0) cout << X << endl;
    
    else {
    vector<int> P(210);
    for(int i = 0; i <= N; i++) {
        int a;
        cin >> a;
        P.at(a) = 1;
    }
    int ans = 10000;
    int check = 114514;
    for(int i = 0; i <= 200; i++)  {
      if (P.at(i) != 1 and chmin(check, abs(i - X))==true) {
          
          ans = i;
      }
          
    }  

    cout << ans << endl;
    }
}


Measured memory_bytes: 3604
/*
[ ( ^ _ ^ ) ]
*/

// problem: atc/dp_r

import java.io.*;
import java.util.*;


public class Main {
    int INF = (int)1e9;
    long MOD = 1000000007;

    long[][] mul(long[][] a, long[][] b) {
        int n = a.length;
        long[][] rs = new long[n][n];
        for(int i=0; i<n; i++) {
            for(int j=0; j<n; j++) {
                for(int k=0; k<n; k++) {
                    rs[i][j] += a[i][k] * b[k][j];
                    rs[i][j] %= MOD;
                }
            }
        }
        return rs;
    }

    void solve(InputReader in, PrintWriter out) throws IOException {
        int n = in.nextInt();
        long k = in.nextLong();
        long[][] a = new long[n][n];
        long[][] rs = new long[n][n];
        for(int i=0; i<n; i++) {
            rs[i][i] = 1;
            for(int j=0; j<n; j++) {
                a[i][j] = in.nextInt();
            }
        }
        while(k>0) {
            if(k%2==1) {
                rs = mul(rs, a);
            }
            k /= 2;
            a = mul(a, a);
        }   
        long t = 0;
        for(int i=0; i<n; i++) {
            for(int j=0; j<n; j++) {
                t += rs[i][j];
                if(t >= MOD) t -= MOD;
            }
        }
        out.println(t);
    }
    

    public static void main(String[] args) throws IOException {
        if(args.length>0 && args[0].equalsIgnoreCase("d")) {
            DEBUG_FLAG = true;
        }
        InputReader in = new InputReader();
        PrintWriter out = new PrintWriter(System.out);
        int t = 1;//in.nextInt();
        long start = System.nanoTime();
        while(t-- >0) {
            new Main().solve(in, out);
        }
        long end = System.nanoTime();
        debug("\nTime: " + (end-start)/1e6 + " \n\n");
        out.close();
    }
    
    static boolean DEBUG_FLAG = false;
    static void debug(String s) {
        if(DEBUG_FLAG) System.out.print(s);
    }
    
    public static void show(Object... o) {
        System.out.println(Arrays.deepToString(o));
    }
    
    static class InputReader {
        static BufferedReader br;
        static StringTokenizer st;
    
        public InputReader() {
            br = new BufferedReader(new InputStreamReader(System.in));
        }
        
        String next() {
            while (st == null || !st.hasMoreTokens()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }
        
        int nextInt() {
            return Integer.parseInt(next());
        }
        
        long nextLong() {
            return Long.parseLong(next());
        }
        
        double nextDouble() {
            return Double.parseDouble(next());
        }
    }
}

Measured memory_bytes: 24020
n = int(input())
s = list(input())
def next_chr(chara):
    if chara == "Z":
        return "A"
    else:
        return chr(ord(chara)+1)

def next_n(chara, n):
    for i in range(n):
        chara = next_chr(chara)
    return chara
for i in s:
    print(next_n(i, n), end = "")

Measured memory_bytes: 45784
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <iomanip>
#include <random>
#include <cstdio>
#include <cmath>
#include <map>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (int) n; i++)

int main() {
    int x1, y1, x2, y2; cin >>x1>>y1>>x2>>y2;

    // (x1,y1)から(x2,y2)に向かうベクトルa
    pair<int, int> a;
    a.first = x2-x1; a.second = y2-y1;
    // 反時計回りにπ/2回転したベクトルb
    pair<int, int> b;
    b.first = -a.second; b.second = a.first;

    int x3 = x2 + b.first;
    int y3 = y2 + b.second;
    int x4 = x1 + b.first;
    int y4 = y1 + b.second;
    char s = ' ';
    cout << x3 << s << y3 << s << x4 << s << y4 << endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define All(V) V.begin(), V.end()
typedef long long int ll;
typedef pair<int, int> P;
const ll MOD = 1e9+7, INF = 1e9;

int main()
{
  string s; int q; cin >> s >> q;
  deque<char> dq;
  rep(i, s.size()){
    dq.push_back(s[i]);
  }
  int cnt = 0;
  rep(i, q){
    int a; cin >> a;
    if(a == 1){
      cnt++;
    }
    else{
      int b; char c; cin >> b >> c;
      if((b == 1 && cnt % 2 == 0) || (b == 2 && cnt % 2 == 1)){
        dq.push_front(c);
      }
      else dq.push_back(c);
    }
  }
  if(cnt % 2 == 1){
    reverse(All(dq));
  }
  while(!dq.empty()){
    cout << dq.front();
    dq.pop_front();
  }
  cout << endl;
  system("pause");
}

Measured memory_bytes: 1152
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		char[] text = sc.nextLine().toCharArray();
		
		for(int i=0; i<text.length; i++) {
			if(Character.isUpperCase(text[i])) {
				text[i] = Character.toLowerCase(text[i]);
			} else {
				text[i] = Character.toUpperCase(text[i]);
			}
		}
		
		System.out.println(text);
	}

}

Measured memory_bytes: 26120
from collections import Counter
from typing import List


def main(n: int, a: List[int]):
    c = Counter(a)
    ans = 0

    for t in c.values():
        if t % 2 == 1:
            ans += 1

    print(ans)


if __name__ == "__main__":
    n = int(input())
    a = [int(input()) for _ in range(n)]

    main(n, a)


Measured memory_bytes: 21600
#include <bits/stdc++.h>
#define REP(i,n,N) for(ll i=(n);i<(ll) N;i++)
#define RREP(i,n,N) for(int i=N-1;i>=(int) n;i--)
#define p(s) cout<<(s)<<endl
#define DEBUG(x,y) cout<<#x<<": "<<x<<" , "<<#y<<": "<<y<<endl;
#define CK(n,a,b) ((a)<=(n)&&(n)<=(b))
#define F first
#define S second
typedef long long ll;
using namespace std;
const int inf=1e9+7;

string s;
int main(){
	cin>>s;
	bool flag=false;
	REP(i,0,s.size()-1){
		if(s[i]=='A'&&s[i+1]=='C') flag=true;
	}
	if(flag){
		p("Yes");
	}else{
		p("No");
	}

	return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <iostream>
#include <vector>
#include <string>
#include <sstream>
#include <algorithm>
#include <utility>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <functional>

using namespace std;

#define fst first
#define scd second
#define PB push_back
#define MP make_pair
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define omajinai ios::sync_with_stdio(false);cin.tie(0)
#define rep(i,x) for(int i=0;i<(int)(x);++i)
#define rep1(i,x) for(int i=1;i<=(int)(x);++i)

using ll=long long;
using ld=long double;
using vi=vector<int>;
using vvi=vector<vi>;
using pii=pair<int, int>;
using vpii=vector<pii>;

template<class T,class U>ostream&operator<<(ostream&os,const pair<T,U>p){os<<"("<<p.fst<<", "<<p.scd<<")";return os;}
template<class T>ostream&operator<<(ostream&os,const vector<T>v){rep(i,v.size()){if(i)os<<", ";os<<v[i];}return os;}
template<typename T>T&max(T&a,T&b){if(a>=b)return a;return b;}
template<typename T>T&min(T&a,T&b){if(a < b)return a;return b;}
template<typename T>bool chmax(T&a,T b){if(a < b){a=b;return true;}return false;}
template<typename T>bool chmin(T&a,T b){if(a > b){a=b;return true;}return false;}

constexpr int inf = 1e9;
constexpr ll linf = 3e18;
constexpr double eps = 1e-9;

int N, K;
int C[2005], G[2005];

vi books[11];

int dp[11][2005]; // dp[i][j] := i?¨?????????§???j????????£?????????????????????????????§???

int main()
{
    cin >> N >> K;

    rep(i, N) {
        cin >> C[i] >> G[i];
        books[G[i]].PB(C[i]);
    }

    rep1(i, 10) {
        sort(all(books[i]), greater<int>());

        books[i].insert(begin(books[i]), 0);

        for (int j = 1; j < books[i].size(); ++j) {
            books[i][j] += books[i][j - 1];
            books[i][j] += (j - 1) * 2;
        }
    }

    for (int i = 1; i <= 10; ++i) {
        for (int j = 0; j <= K; ++j) {
            for (int k = 0; j + k <= K; ++k) {
                if (k >= books[i].size()) break;
                chmax(dp[i][j + k], dp[i - 1][j] + books[i][k]);
            }
        }
    }

    cout << dp[10][K] << endl;
}

Measured memory_bytes: 3236
import java.util.Arrays;
import java.util.PriorityQueue;
import java.util.Scanner;

public class Main {
    static Tuple[] data;
    static int xt;
    static int yt;
    static int N;

    static class Tuple implements Comparable<Tuple> {
        long x;
        long y;
        long r;
        int index;
        double cost;

        @Override
        public int compareTo(Tuple o) {
            return Double.compare(cost, o.cost);
        }
    }

    static double dist(Tuple a, Tuple b) {
        double p = Math.sqrt((a.x - b.x) * (a.x - b.x) + (a.y - b.y) * (a.y - b.y));
        p -= a.r + b.r;
        if (p < 0) {
            p = 0;
        }
        p += a.cost;

        return p;
    }

    public static void setNext(PriorityQueue<Tuple> queue, Tuple a, double[] dp) {
        for (int i = 0; i < data.length; i++) {
            Tuple t = new Tuple();
            t.x = data[i].x;
            t.y = data[i].y;
            t.index = i;
            t.r = data[i].r;
            t.cost = dist(a, data[i]);
            if (dp[i] > t.cost) {
                queue.add(t);
            }
        }
        Tuple end = new Tuple();
        end.x = xt;
        end.y = yt;
        end.r = 0;
        end.cost = dist(a, end);

        end.index = N;
        if (dp[N] > end.cost) {
            queue.add(end);
        }
    }

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


        xt = sc.nextInt();
        yt = sc.nextInt();
        N = sc.nextInt();
        data = new Tuple[N];
        for (int i = 0; i < N; i++) {
            Tuple t = new Tuple();
            t.x = sc.nextInt();
            t.y = sc.nextInt();
            t.r = sc.nextInt();
            t.index = i;
            data[i] = t;
        }

        Tuple start = new Tuple();
        start.x = xs;
        start.y = ys;

        PriorityQueue<Tuple> queue = new PriorityQueue<>();
        double[] dp = new double[N + 1];

        Arrays.fill(dp, Double.MAX_VALUE);

        setNext(queue, start, dp);

        while (queue.size() > 0) {
            final Tuple poll = queue.poll();
            if (dp[poll.index] > poll.cost) {
                dp[poll.index] = poll.cost;
                setNext(queue, poll, dp);
            }
        }
        System.out.println(dp[N]);
    }
}


Measured memory_bytes: 57696
n = int(input())
a = list(map(int, input().split()))

L = {}
R = {}

for i in range(n):
    if i + a[i] in L:
        L[i + a[i]] = L[i + a[i]] + 1
    else:
        L[i + a[i]] = 1

    if i - a[i] in R:
        R[i - a[i]] = R[i - a[i]] + 1
    else:
        R[i - a[i]] = 1

#print(L,R,sep="\n")
ans = 0
for key in L.keys():
    if key in R:
        #print(L[key], R[key])
        ans += L[key] * R[key]
print(ans)

"""
ans = 0
for i in range(n):
    for j in range(i+1, n):
        if abs(i-j) == a[i]+a[j]:
            ans += 1
print(ans)
"""


Measured memory_bytes: 139004
package main

import "fmt"

func main() {
  var a, b, k int
  fmt.Scan(&a, &b, &k)

  if k >= a {
    temp := k - a
    a = 0
    if temp >= b {
      b = 0
    } else {
      b = b - temp
    }
  } else {
    a = a - k
  }

  fmt.Printf("%d %d", a, b)

}

Measured memory_bytes: 512
#include <iostream>
#include <iomanip> //! for setprecision(10)
#include <math.h>
#include <algorithm>
#include <functional> 
#include <string>
#include <vector>

#include <cstring>
#include <set>
#include <map>
#include <queue>
#include <utility>

using namespace std;

typedef long long LL;

#define dump(c) { for (auto it = c.begin(); it != c.end(); ++it) if (it == c.begin()) cout << *it; else cout << ' ' << *it; cout << endl; } 
#define rep(i,n) for (int i = 0; i < (n); ++i)

const int MOD = 1000000007;

int dp[3000][3000];


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

    string s, t;
    cin >> s >> t;

    rep(i, s.length()) rep(j, t.length()) {
        int top = (i==0 ? 0 : dp[i-1][j]);
        int left = (j==0 ? 0 : dp[i][j-1]);
        int topLeft = (i==0 || j ==0 ? 0 : dp[i-1][j-1]);
        if (s[i]==t[j]) {
            dp[i][j] = topLeft+1;
        } else {
            dp[i][j] = max(left, top);
        }
    }

    int i = s.length()-1;
    int j = t.length()-1;
    string ans;
    while (0 <= i && 0 <= j) {
        if (s[i] == t[j]) {
            ans = s[i] + ans;
            --i;
            --j;
        } else {
            if (0 < i && dp[i-1][j] == dp[i][j]) {
                --i;
            } else {
                --j;
            }
        }
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 35456
import sys
def input(): return sys.stdin.readline().rstrip()
def main():
    n = int(input())
    A = list(map(int,input().split()))
    cunt=0
    for i, a in enumerate(A):
        if i%2==0 and a%2:
            cunt+=1
    print(cunt)


if __name__=='__main__':
    main()

Measured memory_bytes: 61968
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll zero = 0;
const ll INF = 10000000000000000; //10^16
const ll MOD = 1000000007; //10^9+7
const ll MOD2 = 998244353;

int main() {
    ll N;
    cin >> N;
    vector<ll> D(N);
    vector<ll> C(N+1, 0);
    for(ll i = 0; i < N; i++){
        cin >> D.at(i);
    }
    for(ll i = 0; i < N; i++){
        C.at(D.at(i))++;
    }
    
    if(D.at(0) != 0){
        printf("0\n");
        return 0;
    }
    if(C.at(0) != 1){
        printf("0\n");
        return 0;
    }
    
    ll ans = 1;
    ll tmp;
    ll p, q;
    for(ll i = 0; i < N-1; i++){
        q = C.at(i+1);
        p = C.at(i);
        tmp = 1;
        while(q >= 1){
            if(q & 1) tmp = tmp * p % MOD2;
            p = p * p % MOD2;
            q >>= 1;
        }
        ans = ans * tmp % MOD2;
    }
    
    printf("%lld\n", (ans + MOD2) % MOD2);
    return 0;
}

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

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

    int Count=0;
    if (s[0]== '1') {
        Count = Count + 1;
    }
    if (s[1] == '1') {
        Count = Count + 1;
    }
    if (s[2] == '1') {
        Count = Count + 1;
    }
    cout << Count;
  
    return 0;

}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <vector>
#include <valarray>
#include <map>
#include <set>
#include <list>
#include <queue>
#include <stack>
#include <bitset>
#include <utility>
#include <numeric>
#include <algorithm>
#include <functional>
#include <complex>
#include <string>
#include <sstream>

#include <cstdio>
#include <cstdlib>
#include <cctype>
#include <cstring>
#include <cmath>

using namespace std;

#define all(c) c.begin(),c.end()
#define repeat(i,n) for(int i=0;i<static_cast<int>(n);i++)
#define debug(x) #x << "=" << (x)
#define dump(x) cerr << debug(x) << " (L:" << __LINE__ << ")"<< endl

typedef long long ll;
typedef vector<int> vi;
typedef vector<vector<int> > vvi;
typedef vector<string> vs;

template<typename T>
ostream& operator<<(ostream& os, const vector<T>& vec){
    os << "[";
    for(int i = 0; i < vec.size(); i++){
        os << vec[i] << ",";
    }
    os << "]";
    return os;
}

template<typename T>
T input(){
    T t;
    cin >> t;
    return t;
}

template<typename T>
vector<T> input(const int N){
    vector<T> v(N);
    repeat(i,N) cin >> v[i];
    return v;
}

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

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

long long mul(const long long& a, const long long& b, const long long& mod) {
    return ((a % mod) * (b % mod)) % mod;
}

long long power(const long long& x, const long long& y, const long long& mod) {
    if (y == 0) {
        return 1;
    } else if (y == 1) {
        return x % mod;
    } else {
        long long value = power(x, y / 2, mod);
        if (y % 2 == 0) {
            return mul(value, value, mod);
        } else {
            return mul(value, value, mod) * x % mod;
        }
    }
}

long long div(const long long& a, const long long& b, const long long& mod) {
    return mul(a, power(b, mod - 2, mod), mod);
}

map<long long, long long> factorials;
long long factorial(const long long& n, const long long& mod) {
    if (n == 0 || n == 1) {
        return 1;
    }
    if (factorials[n] != 0) {
        return factorials[n];
    }
    factorials[n] = n * factorial(n - 1, mod) % mod;
    return factorials[n] % mod;
}

long long combination(const long long& n, const long long& x, const long long& mod) {
    long long numerator = 1;
    long long denominator = 1;
    repeat(i, x) {
        numerator *= (n - i) % mod;
        numerator %= mod;
        denominator *= (i + 1) % mod;
        denominator %= mod;
    }
    return div(numerator, denominator, mod);
}

int main(){
    int K, S;
    cin >> K >> S;

    int patterns = 0;
    for (int i = 0; i <= K; ++i) {
        for (int j = 0; j <= K; ++j) {
            if (i + j <= S && S - (i + j) <= K) {
                patterns += 1;
            }
        }
    }
    cout << patterns << endl;
    return 0;
}


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

class Program
{
    static void Main()
    {
        Scanner cin = new Scanner();
        int N = cin.Int();
        int[] C = new int[N];
        int[] S = new int[N];
        int[] F = new int[N];
        for(int i = 0; i < N - 1; i++)
        {
            int[] input = cin.ArrayInt(3);
            C[i] = input[0];
            S[i] = input[1];
            F[i] = input[2];
        }

        for(int i = 0; i < N; i++)
        {
            int t = 0; //t秒後に駅jに到着したとする
            for(int j = i; j < N - 1; j++)
            {
                if (t < S[j]) t = S[j];
                else if (t % F[j] == 0) ;
                else t = t + F[j] - (t % F[j]);
                t += C[j];
            }
            Console.WriteLine(t);
        }
 
        Console.ReadLine();
    }

}

class Scanner //標準入力
{
    string[] s;
    int i;

    char[] cs = new char[] { ' ' };

    public Scanner()
    {
        s = new string[0];
        i = 0;
    }

    public string next()
    {
        if (i < s.Length) return s[i++];
        string st = Console.ReadLine();
        while (st == "") st = Console.ReadLine();
        s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
        if (s.Length == 0) return next();
        i = 0;
        return s[i++];
    }

    public int Int()
    {
        return int.Parse(next());
    }
    public int[] ArrayInt(int N, int add = 0)
    {
        int[] Array = new int[N];
        for (int i = 0; i < N; i++)
        {
            Array[i] = Int() + add;
        }
        return Array;
    }

    public long Long()
    {
        return long.Parse(next());
    }

    public long[] ArrayLong(int N, long add = 0)
    {
        long[] Array = new long[N];
        for (int i = 0; i < N; i++)
        {
            Array[i] = Long() + add;
        }
        return Array;
    }

    public double Double()
    {
        return double.Parse(next());
    }


    public double[] ArrayDouble(int N, double add = 0)
    {
        double[] Array = new double[N];
        for (int i = 0; i < N; i++)
        {
            Array[i] = Double() + add;
        }
        return Array;
    }
}



Measured memory_bytes: 11092
#include<stdio.h>


int main(void){
	int n,m;
	int i;
	int s[5],c[5];
	int x;
	int div;
	int buff;
	int ed[4] = {0,10,100,1000};
	int st[4] = {0,0,10,100};
	int md[4][4] ={ {1,   1,  1,  1},
					{ 1,  1,  1,  1},
					{ 1,10, 1,  1},
					{1,100,10, 1}};
	int f;
	int l;
	
	l = 0;

	scanf("%d %d",&n,&m);
	for(i=0;i<m;i++){
		scanf("%d %d",&s[i],&c[i]);
	}

	for(x=st[n]; x<ed[n]; x++){
		f = 0;
		for(i=0;i<m;i++){
			div = md[n][s[i]];
			buff = (int)(x / div)%10;
			if(c[i] != buff){
				f = 1;
			}
		}
		if(f==1){
			continue;
		}
		printf("%d\n",x);
		l = 1;
		break;
	}

	if(l==0){
		printf("-1\n");
	}

}



Measured memory_bytes: 128
//include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <fstream>
using namespace std;

//conversion
//------------------------------------------
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

//math
//-------------------------------------------
template<class T> inline T sqr(T x) {return x*x;}

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef pair<long, long> PLL;
typedef long long LL;
//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())

//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI  = acos(-1.0);

//clear memory
#define CLR(a) memset((a), 0 ,sizeof(a))

int a[5003],b[5003];
int main(){
	int A,B;
	cin>>A>>B;
	
	REP(i,A)cin>>a[i];
	REP(i,B)cin>>b[i];
	int res=0;
	
	REP(i,B){
		int cnt=i;
		int temp=0;
		for(int j=0;j<A&&cnt<B;j++){
			if(b[cnt]==a[j]){
				temp++;
				cnt++;
			}
		}
		res=max(temp,res);
	}
	cout<<res<<endl;
	return 0;
}

Measured memory_bytes: 1204
N,M = map(int,input().split())
a = [1]*N
for i in range(M):
    a[int(input())-1] = 0

mod = int(1e9+7)

dp = [0]*N

if N == 1:
    print(1)
    exit()

if a[0] and a[1]:
    dp[0] = 1
    dp[1] = 2
elif not a[0] and a[1]:
    dp[1] = 1

for i in range(2,N):
    if a[i]:
        dp[i] = dp[i-1] + dp[i-2]
    else:
        dp[i] = 0

print(dp[N-1]%mod)

Measured memory_bytes: 460788
#include<bits/stdc++.h>
 
#define hell                         1000000007
#define hell2                        998244353
#define lcm(a,b)                     (a*b)/__gcd(a,b)
#define ll                           long long
#define vll                          vector<ll>
#define pll                          vector< pair<ll,ll> >
#define pb                           push_back
#define all(v)                       v.begin(),v.end()
#define F                            first
#define S                            second
#define rep(i,a,b)                   for(ll i=a;i<b;i++)
#define ret(x)                       return cout<<x,0;
#define endl                           '\n'
 
const ll MAX=200005;
const ll SQN=330;
const ll LG=22;
const double PI=atan(1)*4;
using namespace std;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);cout.tie(NULL);

    ll N,M,K;
    cin >> N >> M >> K;
    string s[N];
    rep(i,0,N) cin >> s[i];

    ll ans=0;
    for(ll i=0;i<(1<<N);i++) {
    	set<ll> row;
    	rep(j,0,N) if(i&(1<<j)) row.insert(j);

    	for(ll j=0;j<(1<<M);j++) {
    		set<ll> col;
    		rep(k,0,M) if(j&(1<<k)) col.insert(k);


    		ll c=0;
    		for(ll a=0;a<N;a++) {
    			for(ll b=0;b<M;b++) {
    				if(row.find(a)==row.end() && col.find(b)==col.end() && s[a][b]=='#') c++;
    			}
    		}
    		if(c==K) ans++;
    	}
    }
    ret(ans);
}


Measured memory_bytes: 3656
fun main() {
    val k = readLine()!!.toLong()

    if (k % 2 == 0L) {
        println(-1)
        return
    }

    var cur = 0L

    for (i in 0..k) {
        cur = (cur * 10 + 7) % k
        if (cur == 0L) {
            println(i+1)
            return
        }
    }

    println(-1)
}


Measured memory_bytes: 34524
#include <bits/stdc++.h>
using namespace std;
int main()
{
    int n;
    cin >> n;
    vector<int> h(n);
    for(int i = 0; i < n; i++)
    {
        cin >> h[i];
    }
    int m = h[0];
    int ans = 1;
    for(int i = 1; i < n; i++)
    {
        if(h[i] >= m)
        {
            ans++;
            m = h[i];
        }
    }
    cout << ans << endl;
}


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

int n;
int lists[1000][999];
int itr[1000];
vector<int> vs[1000000];

int main() {
  cin >> n;
  for (int i = 0; i < n; ++i) {
    for (int j = 0; j < n - 1; ++j) {
      int k;
      cin >> k;
      --k;
      int p = i;
      int q = k;
      if (p > q) swap(p, q);
      lists[i][j] = p * n + q;
    }
  }
  
  vector<int> todo;
  for (int i = 0; i < n; ++i) {
    int k = lists[i][0];
    vs[k].push_back(i);
    if (vs[k].size() == 2) {
      todo.push_back(k);
    }
  }
  
  int ans = 0;
  int cnt = 0;
  vector<int> todonext;
  while (!todo.empty()) {
    for (int k : todo) {
      for (int i : vs[k]) {
        ++itr[i];
        if (itr[i] == n - 1) continue;
        int k = lists[i][itr[i]];
        vs[k].push_back(i);
        if (vs[k].size() == 2) {
          todonext.push_back(k);
        }
      }
      ++cnt;
    }
    
    todo = move(todonext);
    ++ans;
  }
  
  if (cnt == n * (n - 1) / 2) {
    cout << ans << endl;  
  } else {
    cout << -1 << endl;
  }
}

Measured memory_bytes: 43264
from collections import deque


H, W = map(int, input().split())
A = [list(input()) for _ in range(H)]

INF = 10 ** 5
d = [[10 ** 5] * W for _ in range(H)]

q = deque()

for i in range(H):
    for j in range(W):
        if A[i][j] == '#':
            d[i][j] = 0
            q.append((i, j))

dy = [-1, 1, 0, 0]
dx = [0, 0, -1, 1]

while q:
    y, x = q.popleft()

    for i in range(4):
        ny = y + dy[i]
        nx = x + dx[i]

        if (0 <= ny < H and 0 <= nx < W and
            A[ny][nx] != '#' and d[ny][nx] == INF):

            d[ny][nx] = d[y][x] + 1
            q.append((ny, nx))

ans = 0
for i in range(H):
    for j in range(W):
        ans = max(ans, d[i][j])

print(ans)

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

int main() {

  int A,B;
  cin >> A >>B;
   if(13<=A) {
    cout << B << endl;
  }

  else if(6<=A && A<=12) {
     
    cout <<  B/2 << endl;
  }
  else if(A<=5){
  cout <<0<<endl;
  }
}


Measured memory_bytes: 256
#include <algorithm>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <iomanip>
#include <iostream>
#include <string>
#include <vector>

typedef long long ll;
using namespace std;

int main() {
    ll a = 0, b = 0, c = 0;
    cin >> a >> b >> c;
    cout << ((a + b >= c - 1) ? b + c : a + 2*b + 1) << endl;
    return 0;
}


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

 int main() {
  int n;
  cin >> n;
  
  vector<int> b(n - 1);
  rep(i,n - 1) {
   cin >> b.at(i);
   }
   
   long long sum = b.at(0) * 2;
   for(int i = 1; i < n - 1; i++){
    sum += b.at(i);
    }
    
    for(int i = 0; i < n - 2; i++) {
     if(b.at(i) > b.at(i+1)) {
      sum = sum - (b.at(i) - b.at(i+1));
      }
      }
 cout << sum;
 }

Measured memory_bytes: 3588
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <map>
#include <vector>
#include <queue>
#include <algorithm>

using namespace std;

//typedef pair<int,int> P;



int main(){
	int a,b,c,d;
	scanf("%d %d %d %d", &a, &b, &c, &d);

	int e = min(a,b);
	int f = min(c,d);
	printf("%d\n", e+f);
	return 0;
}


Measured memory_bytes: 256
#pragma GCC optimize ("O3")
#include <bits/stdc++.h>
#define FOR(i, a, b) for (int i=(a); i<(int)(b); i++)
#define pb push_back
#define ALL(x) (x).begin(), (x).end()
#define st first
#define nd second
using namespace std;
 
const int maxN = 1 << 19;

const int mod = 998244353;

template <class T1, class T2> inline void addMod(T1& a, T2 b)	{   a = (a + b) % mod;  }
template <class T1, class T2> inline void multMod(T1& a, T2 b)	{   a = a * b % mod;    }

long long qpow(long long a, long long b)
{
    long long res0 = 1;
    for (; b!=0; b>>=1)
    {
        if (b & 1)  multMod(res0, a);
        multMod(a, a);
    }
    return res0;
}

long long D[maxN], A[maxN];

void solve()
{
	int n;
	long long mx = 0;
	scanf ("%d", &n);
	FOR(i, 1, n+1)
		scanf ("%lld", D+i), A[D[i]]++, mx = max(mx, D[i]);
		
	if (D[1] != 0 or A[0] != 1)
	{
		printf("0\n");
		return;
	}
	
	long long res = 1;
	FOR(i, 1, mx+1)
		multMod(res, qpow(A[i-1], A[i]));
	printf("%lld\n", res);
}
 
int main()
{
	int t;
	t = 1;//scanf ("%d", &t);
	while (t--)
		solve();
	return 0;
}


Measured memory_bytes: 3072
import numpy as np
N, T = map(int, input().split())
t = list(map(int, input().split()))
timer = np.zeros(N)

for i in range(1, N):
    if t[i] - t[i-1] >= T:
        timer[i] = t[i] - t[i-1]
    else:
        timer[i] = T

timer = timer - T
timer[0] = 0


print(int(t[-1]+T - sum(timer)))


Measured memory_bytes: 48716
#include <iostream>
#include <cstdio>
#include <queue>
#include <cstring>
#include <vector>
#include <map>
#include <unordered_map>
#include <algorithm>
#include <cctype>
#include <cmath>
#include <bitset>
#include <set>
#include <tuple>
#include <iomanip>
using namespace std;

#define REP(i,n) for(int i=0;i<(int)(n);i++)
#define REPR(i, n) for(int i = n - 1; i >= 0; --i)
#define FOR(i,k,n) for(int i=(k);i<(int)(n);++i)
#define all(i,n) (i),(i+n)

int dx4[4]={1,0,-1,0};
int dy4[4]={0,-1,0,1};
int dx8[8]={1,0,-1,1,-1,1,0,-1};
int dy8[8]={1,1,1,0,0,-1,-1,-1};

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

const int INF = 1e9;
const ll LLINF = 1e18;
const int MAX_V = 1e6+1;
const ll mod = 1000000007;

// --------------------------------------
int n, k, q;
int a[100005];
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cin >> n >> k >> q;

  fill(a, a + n + 2, 0);
  REP(i, q) {
    int b;
    cin >> b;
    a[b]++;
  }

  FOR(i, 1, n + 1) {
    cout << ((k - (q - a[i])) > 0 ? "Yes" : "No") << endl;
  }
}


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

int main(){
    long long X; 
    cin >> X;
    int N=log10(X)+1;
    int M=pow(2,N-1);
    long long S=0;
    for (int i=0;i<M;i++){
        if (i<N){
            S=S+(pow(2,N-4)*pow(5,i)+pow(2,N-i-1)*pow(10,i)-pow(2,N-4))*((long long)(X/pow(10,i))%10);
        }
    }
    cout << S << endl;
}


Measured memory_bytes: 3992
N,L=map(int ,input().split())
if L >= 0:
    print(int((2*L+N)*(N-1)/2) )
elif L < 0 and L+N-1>=0:
    print(int((2*L+N-1)*(N)/2) )
else:
    print(int((2*L+N-2)*(N-1)/2) )

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

using namespace std;

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

const double PI=3.14159265358979323846;

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

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

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


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

    int n;
    string s;
    cin >> n >> s;

    int ans = 0;
    string cmp = "ABC";
    rep (i, n - 2)
    {
        if (s.substr(i, 3) == cmp)
        {
            ++ans;
        }
    }

    cout << ans << "\n";
    return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
#define REP(i,n) for(int i=0;i<(n);++i)
#define ll long long
const long long INF = 1LL<<60;
const long long mod = 1e9 + 7;
using Graph = vector<vector<int>>;

int main(){
    int H, A;
    cin >> H >> A;
    if(H%A==0) cout << H/A << endl;
    else cout << H/A + 1 << endl;
}

Measured memory_bytes: 3596
#pragma GCC optimize("Ofast")   //Comment optimisations for interactive problems (use endl)
#pragma GCC target("avx,avx2,fma")
#pragma GCC optimization ("unroll-loops")
#include<bits/stdc++.h>

using namespace std;

#define  fastio         ios:: sync_with_stdio(0);cin.tie(0);cout.tie(0);cout<<fixed;cout<<setprecision(10);
#define  randomINIT     mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());
#define  all(x)         (x).begin(),(x).end()
#define  mset(x,val)    memset(x,val,sizeof(x))
#define  endl           "\n"
#define  pb             push_back
#define  sym(s)         s="#"+s+"#";
#define  mp             make_pair
#define  s              second
#define  f              first
#define  dline          cerr<<"///REACHED///\n";
#define  debv(a)        for(auto it: a)cout<<it<<" ";cout<<endl;
#define  deb1(a)        cout<<a<<endl;
#define  deb2(a,b)      cout<<a<<" "<<b<<endl;
#define  deb3(a,b,c)    cout<<a<<" "<<b<<" "<<c<<endl;
#define  deb4(a,b,c,d)  cout<<a<<" "<<b<<" "<<c<<" "<<d<<endl;
#define  uniq(a)        a.resize(unique(a.begin(), a.end()) - a.begin());

typedef  long long             ll;
typedef  unsigned long long    ull;
typedef  long double           ld;
typedef  pair<ll,ll>           pll;
typedef  vector<ll>            vll;
typedef  vector<pll>           vpll;

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

vll adj[N];ll vis[N]={};
int dx8[]={0,1,1,1,0,-1,-1,-1}, dy8[]={1,1,0,-1,-1,-1,0,1};
int dx4[]={0,1,0,-1}, dy4[]={1,0,-1,0};

//<<-----Declare Variable Here------->>//
int t=1;

//<<-----Implement Functions Here---->>//


//<<-----Start of Main--------------->>//
void MAIN(){
		ll n,d;ll ans = 0;
		cin>>n>>d;
		for(ll i=1;i<=n;i++)
		{
			ll x,y;cin>>x>>y;
			if((ld)sqrt(x*x+y*y)<=d)ans++;
		}
		cout<<ans<<endl;
}

int main(){
    fastio;randomINIT;

    //cin>>t;
    while(t--){
        MAIN();
    }

    #ifndef ONLINE_JUDGE
    cout<<"\nTime Elapsed: " << 1.0*clock() / CLOCKS_PER_SEC << " sec\n";
    #endif
}

Measured memory_bytes: 10716
n = int(input())
s = [input() for _ in range(n)]
x = dict()
s.sort()
for si in s:
  if si in x:
    x[si] += 1
  else :
    x[si] = 1

n = max(x.values())
for xi in x.keys():
  if x[xi] == n:
    print(xi)


Measured memory_bytes: 39560
#include <bits/stdc++.h>
using namespace std;
#define ll unsigned long long
vector<int> ans(200001,0);
vector<bool> used(200001,false);
void bfs(int s,vector<int> g[]){

    queue<int> que;
    used[s]=true;
    que.push(s);
    while(!que.empty()){
        int p=que.front(); que.pop();
        //cout << p << endl;
        for(auto it=g[p].begin();it!=g[p].end();it++){
            if(used[*it]==false){
                ans[*it]+=ans[p];
                que.push(*it);
                used[*it]=true;
            }
        }
    }
}
int main()
{
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n,q;
  cin>>n>>q;
  vector<int> a[n];

  for(int i=0;i<n-1;i++)
  {
    int b,c;
    cin>>b>>c;
    c--;b--;
    a[b].push_back(c);
    a[c].push_back(b);
  }
  for(int i=0;i<q;i++)
  {
    int b,c;
    cin>>b>>c;
    b--;
    ans[b]+=c;
  }
  bfs(0,a);
  for(int i=0;i<n;i++)
  cout<<ans[i]<<" ";
  cout<<"\n";
  return 0;
}


Measured memory_bytes: 15604
while(1):
	H, W = map(int, input().split())
	if H == 0 and W == 0:
		break
	for i in range(H):
		for j in range(W):
			if i % 2 == 0:
				if j % 2 == 0:
					print("#", end='')
				else:
					print(".", end='')
			else:
				if j % 2 == 0:
					print(".", end='')
				else:
					print("#", end='')
		print("\n", end='')
	print("\n", end='')

Measured memory_bytes: 8980
#include<bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n ; i++)
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define whole(f, x, ...) ([&](decltype((x)) whole) { return (f)(begin(whole), end(whole), ## __VA_ARGS__); })(x) // decltypeで型取得、引数があればva_argsのところに入れる
using namespace std;
typedef long long ll; // long longをllでかけるようにした
const int INF = 1e9;

int main(void){
    int n, m, x; cin >> n >> m >> x;
    vector<int> cost(m);
    int high = 0, low = 0;
    REP(i, m){
        cin >> cost[i];
        if(cost[i] > x) high++;
        else low++;
    }
    cout << (high > low ? low : high) << endl;
}

Measured memory_bytes: 256
#include<iostream>

using namespace std;

int main() {
	int a, b, c, x;
	cin >> a >> b >> c >> x;

	int ans = 0;

	for (int i = 0; i < a + 1; i++) {
		for (int j = 0; j < b + 1; j++) {
			for (int k = 0; k < c + 1; k++) {
				if (i * 500 + j * 100 + k * 50 == x) ans++;
			}
		}
	}

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 256
n, m = list(map(int, input().split()))
coin = list(map(int, input().split()))
a = [i for i in range(n + 1)]
for j in coin:
    for i in range(j, n + 1):
        a[i] = min(a[i], a[i - j] + 1)

print(a[n])



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

int main() {
    int a, b, c, d, e, k;

    cin >> a >> b >> c >> d >> e >> k;

    if (e - a > k) {
        cout << ":(" << endl;
    } else {
        cout << "Yay!" << endl;
    }

    return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;
public class Main {

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int h,w;
		while(true) {
			h=scan.nextInt();
			w=scan.nextInt();
			if(h==0&&w==0)break;
			for(int i=0;i<h;i++) {
				for(int j=0;j<w;j++) {
					System.out.print("#");
				}
				System.out.println();
			}
			System.out.println();
		}
		scan.close();
	}

}


Measured memory_bytes: 34436
# -*- coding: utf-8 -*-

S = str(input())
ans = 0
if len(S)==1:
    print(0)
    exit()
elif S=="00" or S=="11":
    print(1)
    exit()

flg = True
if S[0]=="0":
    for i in range(len(S)):
        if i == 0:
            continue
        if i%2 == 0:
            if S[i]!="0":
                ans+=1
                continue
        else:
            if S[i]!="1":
                ans+=1
                continue
else:
    for i in range(len(S)):
        if i == 0:
            continue
        if i%2 == 0:
            if S[i]!="1":
                ans+=1
                continue
        else:
            if S[i]!="0":
                ans+=1
                continue
print(ans)

Measured memory_bytes: 3188
#include <bits/stdc++.h>
#define fi first
#define se second
#define ll long long
//priority_queue<int, vector<int>, greater<int> > pq;
#define _CRT_SECURE_NO_DEPRECATE
const int N = 330030;
#define rep(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
const ll mod =  1e9+7;
using namespace std;

int main() {
    ios::sync_with_stdio(false);
int n,m;
cin>>n>>m;
bool b[n+1];
rep(i,1,n+1)
b[i]=false;
b[1]=true;
int cnt[n+1];
rep(i,1,n+1)
cnt[i]=1;
rep(i,1,m+1)
{
	int x,y;
	cin>>x>>y;
	if(b[x]==true&&cnt[x]>0)
	{
		b[y]=true;
		--cnt[x];
		++cnt[y];
	}
	else
	{
		cnt[x]--;
		cnt[y]++;
	}
	if(cnt[x]==0)
	b[x]=false;
}
int nas=0;
rep(i,1,n+1)
if(b[i]==true)
nas++;
cout<<nas;

}


Measured memory_bytes: 768
#include <iostream>

using namespace std;

int main() {
	int a = 0;
	int b = 0;
	int c = 0;
	cin >> a >> b >> c;
	if (a <= b) {
		if (b <= c) {
			cout << a << ' ' << b << ' ' << c << endl;
		} else {
			cout << a << ' ' << c << ' ' << b << endl;
		}
	} else if (c >= b) {
		if (c >= a ) {
			cout << b << ' ' << a << ' ' << c << endl;
		} else {
			cout << b << ' ' << c << ' ' << a << endl;
		}
	} else {
		cout << c << ' ' << b << ' ' << a << endl;
	}
}


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

int main()
{
    int n;
    scanf("%d",&n);
    while(n>0)
    {
        if(n % 10 == 9)
        {
            printf("Yes\n");
            return 0;
        }
        n /= 10;
    }
    printf("No\n");
    return 0;
}


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

#define pi acos(-1.0)
#define eps 1e-9
#define ll long long
#define ull unsigned long long
#define sf scanf
#define pf printf
#define nl printf("\n")
#define	inf (ll)1e15
#define mod 1000000007
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend() 
#define sz(x) (int)(x).size()
#define test_case int ___t;scanf("%d", &___t);for(int cs=1;cs<=___t;cs++)

using namespace __gnu_pbds;
using namespace std;

inline string str_inp(int n){char ch[n+5];sf(" %s",ch);return string(ch);}
inline string line_inp(int n)
{char ch[n+5];fgets(ch,n+5,stdin);string s=string(ch);s.pop_back();return s;}

//typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> new_data_set;
typedef pair<ll,ll>pll;

const int S=100100;
ll n;
pll ara[S+5];



int main()
{
    //#ifndef ONLINE_JUDGE
    //freopen("input.txt","r",stdin);
    //#endif
	ll a,b,c;
  	sf("%lld %lld.%lld",&a,&b,&c);
  	b*=100;
  	b+=c;
  	pf("%lld\n",(a*b)/100);
    return 0;
}




































Measured memory_bytes: 3820
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);++i)
#define ALL(A) A.begin(), A.end()

using namespace std;

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

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

	int A, B; cin >> A >> B;

	if (A + B >= 10){
		cout << "error" << endl;
	}else{
		cout << A + B << endl;
	} // end if
	
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, a, n) for(int i = a; i < n; i++)
#define repb(i, a, b) for(int i = a; i >= b; i--)
#define all(a) a.begin(), a.end()
#define o(a) cout << a << endl
#define int long long
#define fi first
#define se second
using namespace std;
typedef pair<int, int> P;

signed main(){
    int a, b;
    cin >> a >> b;
    if(a == b) cout << 2 * a << endl;
    else cout << max(a, b) * 2 - 1 << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>

using namespace std;
const int INF = numeric_limits<int>::max();
const int Maxn = 60;

int g[Maxn][Maxn];
int d[Maxn];

int n, m;

void dfs(int x){
    for (int y = 0; y < n; ++y) {
        if (g[x][y] && d[y] == INF){
            d[y] = 0;
            dfs(y);
        }
    }
}

int main() {
    cin >> n >> m;
    vector<int> a(m), b(m);
    for (int i = 0; i < m; ++i) {
        int x, y;
        cin >> x >> y;
        --x; --y;
        a[i] = x; b[i] = y;
        g[x][y] = g[y][x] = 1;
    }

    int ans = 0;
    for (int i = 0; i < m; ++i) {
        g[a[i]][b[i]] = g[b[i]][a[i]] = 0;
        for (int j = 0; j < n; ++j) {
            d[j] = INF;
        }
        d[a[i]] = 0;
        dfs(a[i]);
        if (d[b[i]] == INF){
            ++ans;
        }
        g[a[i]][b[i]] = g[b[i]][a[i]] = 1;
    }

    cout << ans << endl;
}



Measured memory_bytes: 256
#include <iostream>
#include <set>

int main(int argc, char const* argv[])
{
  int n;
  std::cin >> n;

  std::set<int> width;

  for (int i = 0; i < n; ++i) {
    int tmp;
    std::cin >> tmp;
    width.insert(tmp);
  }

  std::cout << width.size() << std::endl;

  return 0;
}


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

int main() {
  
  string A;
  int count = 0;
  cin >> A;
  for (int i = 0; i < 3; i++){
    if (A[i] == '1'){
      count ++;
    }
    else{
      continue;
    }
  }
  cout << count << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using pp=pair<ll,pair<int,int>>;
using Graph=vector<vector<pair<int,ll>>>;

int main(){
  int H,W,N,sr,sc;
  string S,T;
  cin>>H>>W>>N>>sr>>sc>>S>>T;
  sr--;sc--;
  vector<bool> lr(W,false);
  int left=0,right=W-1;
  int up=0,down=H-1;
  if(S.at(N-1)=='L'){
    left++;
  }else if(S.at(N-1)=='R'){
    right--;
  }else if(S.at(N-1)=='U'){
    up++;
  }else{
    down--;
  }
  bool flag=false;
  for(int i=N-2;i>=0;i--){
    if(T.at(i)=='L'){
      right=min(right+1,W-1);
    }else if(T.at(i)=='R'){
      left=max(left-1,0);
    }else if(T.at(i)=='U'){
      down=min(down+1,H-1);
    }else{
      up=max(up-1,0);
    }
    if(S.at(i)=='L'){
      left++;
      if(left==W){
        flag=true;
        break;
      }
    }else if(S.at(i)=='R'){
      right--;
      if(right==-1){
        flag=true;
        break;
      }
    }else if(S.at(i)=='D'){
      down--;
      if(down==-1){
        flag=true;
        break;
      }
    }else{
      up++;
      if(up==H){
        flag=true;
        break;
      }
    }
  }
  if(right<left||down<up){
    flag=true;
  }
  if(sr<up||down<sr||sc<left||right<sc){
    flag=true;
  }

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


Measured memory_bytes: 776
n = int(input())
s = input()
ans = 0
 
for i in range(n):
    a = s[:i]
    b = s[i:]
    tes = 0
    c = []
    for cha in a:
        if cha in b:
            if cha not in c:
                c.append(cha)
                tes += 1
    ans = max(tes,ans)

    
print(ans)


Measured memory_bytes: 3060
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <cmath>
#include <map>
#include <queue>
#include <iomanip>
#include <set>
#include <tuple>
#define mkp make_pair
#define mkt make_tuple
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define all(v) v.begin(),v.end()
using namespace std;
typedef long long ll;
const ll MOD=1e9+7;
template<class T> void chmin(T &a,const T &b){if(a>b) a=b;}
template<class T> void chmax(T &a,const T &b){if(a<b) a=b;}

const int L=200;

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

  int X,N;
  cin>>X>>N;
  vector<int> A(N);
  rep(i,N) cin>>A[i];

  vector<int> num(L,0);
  rep(i,N) num[A[i]]=1;

  int ans=2*L;
  for(int i=0;i<=L;i++){
    if(num[i]==0){
      if(abs(X-ans)>abs(X-i)) ans=i;
      if(abs(X-ans)==abs(X-i)&&i<ans) ans=i;
    }
  }

  cout<<ans<<endl;

  return 0;
}


Measured memory_bytes: 3656
#include<bits/stdc++.h>
using namespace std;
int a[4]={0,0,0,0};
int main(){
  int n;cin>>n;
  for(int i=0;i<n;i++){
    string str;cin>>str;
    if(str=="AC")
      a[0]++;
    else if(str=="WA")
      a[1]++;
    else if(str=="TLE")
      a[2]++;
    else if(str=="RE")
      a[3]++;
  }
  cout<<"AC x "<<a[0]<<endl;
  cout<<"WA x "<<a[1]<<endl;
  cout<<"TLE x "<<a[2]<<endl;
  cout<<"RE x "<<a[3]<<endl;
}

Measured memory_bytes: 3624