akhauriyash/Code-Regression huggingface dataset:
import java.util.Scanner;
import java.util.Stack;

class Main {

    public static void main(String[] args) {
        new Main().compute();
    }

    void compute() {
        Scanner sc = new Scanner(System.in);
        int H = sc.nextInt();
        int W = sc.nextInt();
        for (int i = 0; i < W + 2; i++) {
            System.out.print('#');
        }
        System.out.println();
        for (int i = 0; i < H; i++) {
            System.out.print('#');
            System.out.print(sc.next());
            System.out.print('#');
            System.out.println();
        }
        for (int i = 0; i < W + 2; i++) {
            System.out.print('#');
        }
    }
}

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

const long long INF = 1000000000;

typedef long long ll;

#define writeln(n) cout<<n<<"\n"
#define rep(i,n) for(int i=0; i<(n); ++i)

typedef pair<int, int> P;
typedef pair<string, int> Psi;


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

	int a,b;cin>>a>>b;
	
	if(a >=13){
		writeln(b);
	}else if (a>=6) {
		writeln(b/2);
	}else {
		writeln(0);
	}


}


Measured memory_bytes: 256
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

func main() {
	var N int
	fmt.Scanln(&N)

	sc := bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanWords)

	var cur int
	for i := 0; i < N; i++ {
		sc.Scan()
		h, _ := strconv.Atoi(sc.Text())

		if h < cur-1 {
			fmt.Println("No")
			return
		} else if h > cur {
			cur = h
		}
	}
	fmt.Println("Yes")
}


Measured memory_bytes: 2176
#include <iostream>
using namespace std;
int main(){
	int n,b;
	bool a[53];
	char c;
	cin>>n;
	for (int i=0;i<53;i++){
		a[i]=false;
	}
	for (int i=1;i<n+1;i++){
		cin>>c>>b;
		if (c=='S')
			a[b]=true;
		else if (c=='H')
			a[b+13]=true;
		else if (c=='C')
			a[b+26]=true;
		else if (c=='D')
			a[b+39]=true;
	}
	for (int i=1;i<53;i++){
		if (i<14 && a[i]==false)
			cout<<"S "<<i<<endl;
		else if (i<27 && a[i]==false)
			cout<<"H "<<i-13<<endl;
		else if (i<40 && a[i]==false)
			cout<<"C "<<i-26<<endl;
		else if (a[i]==false)
			cout<<"D "<<i-39<<endl;
	}
}


Measured memory_bytes: 3112
import java.util.Scanner;
import java.util.Arrays;
import java.util.Comparator;
public class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int m = sc.nextInt();
		Cake[] cake=new Cake[n];
		long ans=0;
		for(int i = 0; i<n; i++){
			long x = sc.nextLong();
			long y = sc.nextLong();
			long z = sc.nextLong();
			cake[i]=new Cake(x,y,z);
		}
		int[] xyz=new int[3];
		for(int i = 0; i<8; i++){
			Arrays.fill(xyz,1);
			int ii=i;
			long an=0;
			int count=0;
			while(ii>0){
				if((ii & 1)==1){
					xyz[count]*=-1;
				}
				ii>>=1;
				count++;
			}
			for(int j=0; j<n; j++){
				cake[j].x1=cake[j].x*xyz[0];
				cake[j].y1=cake[j].y*xyz[1];
				cake[j].z1=cake[j].z*xyz[2];
			}
			Arrays.sort(cake,Comparator.comparing(Cake::getSum).reversed());
			for(int k=0; k<m; k++){
				an+=cake[k].getSum();
			}
			ans=Math.max(ans,an);
		}
		System.out.println(ans);
	}
	static class Cake{
		long x;
		long y;
		long z;
		long x1;
		long y1;
		long z1;
		public Cake(long x,long y,long z){
			this.x=x;
			this.y=y;
			this.z=z;
		}
		public long getSum(){
			return	this.x1+this.y1+this.z1;
		}
	}
}

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

counter = [[0]*10 for _ in range(10)]

for i in range(1,N+1):
    x = str(i)
    counter[int(x[0])][int(x[-1])] += 1

ans = 0

for i in range(10):
    for j in range(10):
        ans += counter[i][j] * counter[j][i]
        
print(ans)

Measured memory_bytes: 3064
#include <stdio.h>
#include <string.h>

typedef struct node_ node;

struct node_{
    int x;
    node *before;
    node *next;
};

class list{
    node* head;
    node* tail;
public:
    list(){
        head = NULL;
        tail = NULL;
    }
    void insertX(int n);
    void deleteX(int n);
    void deleteFirst();
    void deleteLast();
    void show();
};

void list::insertX(int n){
    node *tmp = new node;
    if(head)head->before = tmp;
    else tail = tmp;
    tmp->before = NULL;
    tmp->next = head;
    tmp->x = n;
    head = tmp;
}

void list::deleteX(int n){
    if(!head)return;
    if(head->x==n){
        deleteFirst();
        return;
    }
    node *ptr=head->next;
    while(ptr->x!=n){
        ptr=ptr->next;
        if(!ptr)return;
    }
    ptr->before->next = ptr->next;
    if(ptr->next)ptr->next->before=ptr->before;
    else tail = ptr->before;
    delete ptr;
}

void list::deleteFirst(){
    if(!head)return;
    if(head==tail){
        delete head;
        head = NULL;
        tail = NULL;
    }else{
        head = head->next;
        delete head->before;
        head->before = NULL;
    }
}

void list::deleteLast(){
    if(!tail)return;
    if(tail==head){
        delete tail;
        head = NULL;
        tail = NULL;
    }else{
        tail = tail->before;
        delete tail->next;
        tail->next = NULL;
    }
}

void list::show(){
    node *tmp = head;
    while(tmp){
        printf("%d",tmp->x);
        if(tmp->next)printf(" ");
        tmp = tmp->next;
    }
    printf("\n");
}

int main(){
    list ob;
    int i, n, x;
    char command[12];
    scanf("%d",&n);
    for(i=0;i<n;i++){
        scanf("%s",command);
        if(strcmp(command,"insert")==0){
            scanf("%d",&x);
            ob.insertX(x);
        }else if(strcmp(command,"delete")==0){
            scanf("%d",&x);
            ob.deleteX(x);
        }else if(strcmp(command,"deleteFirst")==0){
            ob.deleteFirst();
        }else if(strcmp(command,"deleteLast")==0){
            ob.deleteLast();
        }else{
            printf("else.\n");
        }
    }
    ob.show();
    return 0;
}



Measured memory_bytes: 33824
#include <map>
#include <set>
#include <list>
#include <ctime>
#include <cmath>
#include <queue>
#include <stack>
#include <bitset>
#include <vector>
#include <cstdio>
#include <string>
#include <cstring>
#include <sstream>
#include <iomanip>
#include <cstdlib>
#include <utility>
#include <iostream>
#include <algorithm>
using namespace std;
int a[105][105],b[10005];
int main ( ) {
	int n,m,i,j,s=0,p=1;
	scanf("%d%d",&n,&m);
	int q;
	scanf("%d",&q);
	for (i=1;i<=q;i++) scanf("%d",&b[i]);
	for (i=1;i<=n;i++) {
		if (i%2) {
			for (j=1;j<=m;j++) {
				s++;
				if (s>b[p]) p++,s=1;
				a[i][j]=p;
			}
		}
		else {
			for (j=m;j>=1;j--) {
				s++;
				if (s>b[p]) p++,s=1;
				a[i][j]=p;
			}
		}
	}
	for (i=1;i<=n;i++) {
		for (j=1;j<=m;j++) printf("%d ",a[i][j]);
		puts("");
	}
	return 0;
}
/*
2 2
3
2 1 1

1 1
2 3

3 5
5
1 2 3 4 5

1 4 4 4 3
2 5 4 5 3
2 5 5 5 3

1 1
1
1

1
*/

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

using namespace std;

const long long inf = 1000000000000000000;
const int dx[] = {-1, 1};

long long mx[2][2];
long long mn[2][2];

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

	int n;
	cin >> n;

	for(int i = 0; i < 2; ++i) {
		for(int j = 0; j < 2; ++j) {
			mx[i][j] = -inf;
			mn[i][j] = inf;
		}
	}

	vector<long long> x(n);
	vector<long long> y(n);
	for(int i = 0; i < n; ++i) {
		cin >> x[i] >> y[i];
	}

	for(int i = 0; i < n; ++i) {
		for(int a = 0; a < 2; ++a) {
			for(int b = 0; b < 2; ++b) {
				mx[a][b] = max(mx[a][b], x[i] * dx[a] + y[i] * dx[b]);
				mn[a][b] = min(mn[a][b], x[i] * dx[a] + y[i] * dx[b]);
			}
		}
	}

	long long ans = 0;
	for(int i = 0; i < 2; ++i) {
		for(int j = 0; j < 2; ++j) {
			ans = max(ans, mx[i][j] - mn[i][j]);
		}
	}

	cout << ans << '\n';

	return 0;
}


Measured memory_bytes: 6320
(defun is-mm (s)
  (or (and (char= (aref s 0) #\0) (char<= #\1 (aref s 1) #\9))
      (and (char= (aref s 0) #\1) (char<= #\0 (aref s 1) #\2))))


(let ((s (read-line)))
  (format t "~A~%" (cond ((and (is-mm (subseq s 0 2)) (is-mm (subseq s 2 4)))
                          "AMBIGUOUS")
                         ((is-mm (subseq s 0 2))
                          "MMYY")
                         ((is-mm (subseq s 2 4))
                          "YYMM")
                         (t
                          "NA"))))


Measured memory_bytes: 23748
n,l,v[1001],w[1001],i,j,k,dp[1001][1001];
int main(){
  for(;++k;){
    scanf("%d",&l); 
    if(!l)exit(0);
    scanf("%d",&n);
    for(i=n;i;)scanf("%d,%d",v+i--,w+i);
    for(i=1;i<=n;i++)
      for(j=1;j<=l;j++){
	int a=dp[i-1][j];
	if(j>=w[i]){
	    int b=dp[i-1][j-w[i]]+v[i];
	   a=a>b?a:b;
	  }
	dp[i][j] = a;
      }
    for(i=0;i<=l;i++)
      if(dp[n][l]==dp[n][i]){j=i;break;}
    printf("Case %d:\n%d\n%d\n",k,dp[n][l],j);
  }
}

Measured memory_bytes: 0
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<cmath>
#include<math.h>
#include<limits>
#include<list>
using namespace std;
using ll = long long;
#define rep(i,n) for(int i = 0;i < (n); ++i)

int main() {
	string s, t;
	cin >> s >> t;
	int count = 0;
	rep(i, s.size()) {
		if (s[i] != t[i]) {
			count++;
		}
	}
	cout << count << endl;
	return 0;
}

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

int main(void) {
    int N,x=0,a=0;
    string S;
    cin >> N >> S;
    for (int i = 0; i < N; i++) {
        if (S[i] == 'I') x ++ ;
        else x --;
        if (x > a)a = x;
    }
    cout << a << endl;

    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<sstream>
using namespace std;
int main(){
long i,n[1001]={0},n2[1001]={0},nn;
string s;
stringstream ss;
while(getline(cin,s)){
if(s=="")break;
ss.str("");ss<<s;
ss>>nn;
n[nn]++;
}
while(getline(cin,s)){
if(s=="")break;
ss.str("");ss<<s;
ss>>nn;
n2[nn]++;
}
for(i=1;i<=1000;i++)if(n[i]*n2[i]>0)cout<<i<<" "<<n[i]+n2[i]<<endl;
return 0;
}

Measured memory_bytes: 1248
#include <assert.h>
#include <limits.h>
#include <algorithm>
#include <bitset>
#include <cctype>
#include <cmath>
#include <complex>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <vector>
 
using ll = long long;
using P = std::pair<long double, ll>;
 
#define rep(i, a, b) for (ll(i) = (a); i < (b); i++)
#define all(i) i.begin(), i.end()
#define debug(i) std::cerr << "debug " << #i <<" "<<i<< std::endl
 
template <typename T1, typename T2>
std::ostream& operator<<(std::ostream& os, std::pair<T1, T2> pa) {
  return os << pa.first << " " << pa.second;
}
 
template <typename T>
std::ostream& operator<<(std::ostream& os, std::vector<T> vec) {
  for (int i = 0; i < vec.size(); i++)os << vec[i] << (i + 1 == vec.size() ? "" : " ");
  return os;
}
 
template<typename T1,typename T2>
inline bool chmax(T1& a,T2 b){return a<b && (a=b,true);}
 
template<typename T1,typename T2>
inline bool chmin(T1& a,T2 b){return a>b && (a=b,true);}
 
// const ll MOD = 998244353;
const ll MOD = 1e9 + 7;


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

  ll n,m;
  std::cin>>n>>m;

  std::vector<std::vector<ll>> graph(3*n);

  rep(i,0,m){
    ll u,v;
    std::cin>>u>>v;
    u--;v--;

    rep(j,0,3)graph[u+n*j].push_back((v+n*((j+1)%3)));
  }

  std::vector<bool> used(3*n,false);

  ll s,t;
  std::cin>>s>>t;

  s--;t--;

  std::queue<P> que;

  used[s]=true;
  que.push({s,0});

  while(!que.empty()){
    P e=que.front();que.pop();

    if(e.first==t){
      std::cout<<e.second/3;
      return 0;
    }

    for(ll next:graph[e.first]){
      if(!used[next]){
        used[next]=true;
        que.push({next,e.second+1});
      }
    }
  }

  std::cout<<-1;

  return 0;
}





Measured memory_bytes: 16768
#include <stdio.h>
#include <string.h>
#include <stdlib.h>

const long long int q = 1000000007;

int main(){
    int r;
    scanf("%d",&r);
    double l = 2 * 3.141592 * r;
    printf("%.20f",2 * 3.141592 * r);
    return 0;
}


Measured memory_bytes: 1732
#include<stdio.h>
int main(void)
{
    int a,b,c,i,n=0;
	scanf("%d %d %d",&a,&b,&c);
	for(i=a;i<=b;i++){
	    if(c%i==0){
             n++;
		}
	}
	printf("%d\n",n);
	return 0;
}

Measured memory_bytes: 2752
#include<cstdio>
#include<iostream>
#include<cstdlib>
#include<cmath>
#include<vector>
#include<list>
#include<map>
#include<algorithm>

using namespace std;

int main()
{
    int x, y, z;
    cin >> x >> y >> z;

    cout << (x - z) / (y + z) << endl;

    return 0;
}


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

#ifdef DEBUG
#include "inc/debug.hpp"
#else
#define debug(...) 42
#endif

int score[2];
bool mark[2][500][500];

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

string solve() {
    int n, u, v, m;
    cin >> n >> u >> v >> m;
    map<int, vector<pair<int,int>>> p[2];
    for (int t=0; t<2; ++t) {
        for (int i=0; i<n; ++i) {
            for (int j=0; j<n; ++j) {
                int a;
                cin >> a;
                p[t][a].emplace_back(i, j);
            }
        }
    }
    for (int i=0; i<m; ++i) {
        int a;
        cin >> a;
        for (int j=0; j<2; ++j) {
            for (auto& pp: p[j][a]) {
                int y, x;
                tie(y, x) = pp;
                mark[j][y][x] = true;

                if (n == 1) {
                    score[j] ++;
                    continue;
                }
                for (int k=0; k<4; ++k) {
                    int len = -1, ty = y, tx = x;
                    while (0 <= ty && ty < n && 0 <= tx && tx < n && mark[j][ty][tx]) {
                        ty += dy[k];
                        tx += dx[k];
                        len ++;
                    }
                    ty = y, tx = x;
                    while (0 <= ty && ty < n && 0 <= tx && tx < n && mark[j][ty][tx]) {
                        ty -= dy[k];
                        tx -= dx[k];
                        len ++;
                    }
                    if (len == n) score[j] ++;
                }
            }
        }
        if (u <= score[0] && v <= score[1]) return "DRAW";
        if (u <= score[0]) return "USAGI";
        if (v <= score[1]) return "NEKO";
    }
    return "DRAW";
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << solve() << endl;
    return 0;
}


Measured memory_bytes: 36892
n = int(input())
la = list(map(int, input().split()))

d0 = {-1: 0}
for a in la[::2]:
    d0[a] = d0.get(a, 0) + 1
d1 = {-1: 0}
for a in la[1::2]:
    d1[a] = d1.get(a, 0) + 1

n0 = sorted([(v, k) for k, v in d0.items()], reverse=True)
n1 = sorted([(v, k) for k, v in d1.items()], reverse=True)


if n0[0][1] != n1[0][1]:
    answer = n - n0[0][0] - n1[0][0]
else:
    if n0[1][0] > n1[1][0]:
        answer = n - n0[1][0] - n1[0][0]
    else:
        answer = n - n0[0][0] - n1[1][0]


print(answer)


Measured memory_bytes: 25492
#include<bits/stdc++.h>
using namespace std;
const long long INF = 1e7 + 1;
const long long MOD = 1000000007;
const long double PI = 3.1415926;
#define FOR(i,r,n) for(ll i = (ll)(r); i < (ll)(n); i++)
#define RFOR(i,r,n) for(ll i=(ll)(n-1);i>=r;i--)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define ALL(x) x.begin(),x.end()
#define RALL(x) x.rbegin(),x.rend()
typedef long long int ll;
typedef vector<ll> vi;
typedef vector < pair<ll, ll > > vp;
typedef vector <string> vs;
typedef vector <char> vc;
typedef list <ll> lst;

ll n, m, k, ans = 0, sum = 0, cnt = 0;
string s;
char c;


/*--------------------template--------------------*/

int main()
{
	while (1) {
	NEXT:
		cin >> n;
		if (n == 0) {
			return 0;
		} else {
			vi v;
			REP(i, n)
			{
				cin >> s;
				v.push_back(s.size());
			}
			cnt = 0;
			for (int i = cnt; i < n; i++) {
				ll j = cnt;
				ll flag = 0;
				sum = 0;
				while (1) {
					sum += v[j];
					j++;
					if (flag == 0) {
						if (sum == 5) {
							sum = 0;
							flag = 1;
						}
						if (sum > 5) {
							break;
						}
					} else if (flag == 1) {
						if (sum == 7) {
							sum = 0;
							flag = 2;
						}
						if (sum > 7) {
							break;
						}
					} else if (flag == 2) {
						if (sum == 5) {
							sum = 0;
							flag = 3;
						}
						if (sum > 5) {
							break;
						}
					} else if (flag == 3) {
						if (sum == 7) {
							sum = 0;
							flag = 4;
						}
						if (sum > 7) {
							break;
						}
					} else if (flag == 4) {
						if (sum == 7) {
							cout << cnt + 1 << endl;
							goto NEXT;
						}
						if (sum > 7) {
							break;
						}
					}
				}
				cnt++;
			}
		}
	}
}

Measured memory_bytes: 3124
import sys
def input(): return sys.stdin.readline().rstrip()
from collections import Counter
def main():
    h,w=map(int,input().split())
    s=""
    for _ in range(h):
        s+=input()
    sc=list(Counter(s).values())
    cunt_1=(h%2)*(w%2)
    cunt_2=(h%2)*(w//2)+(w%2)*(h//2)
    cunt_4=(h//2)*(w//2)
    #print(sc)
    for i,scc in enumerate(sc):
        if scc>=4:
            x=min(scc//4,cunt_4)
            sc[i]-=x*4
            cunt_4-=x
        if cunt_4==0:break
    else:
        print("No")
        sys.exit()
    for i,scc in enumerate(sc):
        if scc>=2:
            x=min(scc//2,cunt_2)
            sc[i]-=x*2
            cunt_2-=x
        if cunt_2==0:break
    else:
        print("No") 
        sys.exit()
    for i,scc in enumerate(sc):
        if scc>=1:
            x=min(scc,cunt_1)
            sc[i]-=x
            cunt_1-=x
        if cunt_1==0:break
    else:
        print("No")   
        sys.exit()  
    print("Yes")

        

if __name__=='__main__':
    main()


Measured memory_bytes: 3316
using System;
using CompLib.Util;

public class Program
{
    public void Solve()
    {
        var sc = new Scanner();
        int n = sc.NextInt();
        int k = sc.NextInt();

        // 全部 kの倍数
        // 全部 k/2の倍数
        long ans = 0;
        if (k % 2 == 0)
        {
            long d = (n - k / 2 + k) / k;
            ans += d * d * d;
        }

        long d2 = n / k;
        ans += d2 * d2 * d2;
        Console.WriteLine(ans);
    }

    public static void Main(string[] args) => new Program().Solve();
}

namespace CompLib.Util
{
    using System;
    using System.Linq;

    class Scanner
    {
        private string[] _line;
        private int _index;
        private const char Separator = ' ';

        public Scanner()
        {
            _line = new string[0];
            _index = 0;
        }

        public string Next()
        {
            while (_index >= _line.Length)
            {
                _line = Console.ReadLine().Split(Separator);
                _index = 0;
            }

            return _line[_index++];
        }

        public int NextInt() => int.Parse(Next());
        public long NextLong() => long.Parse(Next());
        public double NextDouble() => double.Parse(Next());
        public decimal NextDecimal() => decimal.Parse(Next());
        public char NextChar() => Next()[0];
        public char[] NextCharArray() => Next().ToCharArray();

        public string[] Array()
        {
            _line = Console.ReadLine().Split(Separator);
            _index = _line.Length;
            return _line;
        }

        public int[] IntArray() => Array().Select(int.Parse).ToArray();
        public long[] LongArray() => Array().Select(long.Parse).ToArray();
        public double[] DoubleArray() => Array().Select(double.Parse).ToArray();
        public decimal[] DecimalArray() => Array().Select(decimal.Parse).ToArray();
    }
}

Measured memory_bytes: 13140
#include <iostream>

using namespace std;

int main() {
    int A, B, C, D;
    cin >> A >> B >> C >> D;
    bool flag=true;
    while(A>0 && C>0) {
        if(flag) {
            C -= B;
            flag = false;
            if(C<=0) {
                cout << "Yes" << endl;
                break;
            }
        } else {
            A -= D;
            flag = true;
            if(A<=0) {
                cout << "No" << endl;
                break;
            }
        }
    }



    return 0;
    
}

Measured memory_bytes: 3636
#include <cstdio>
#include <cmath>
#include <cstring>
#include <ctime>
#include <climits>
#include <iostream>
#include <algorithm>
#include <set>
#include <map>
#include <queue>
#include <vector>
#include <sstream>
#include <typeinfo>
#include <fstream>

#define DIV 1000000007

using namespace std;

long long N, X;

long long dfs(long long h, long long w){
	long long ret = 0;
	//cout << "h=" << h << "w=" << w << endl;
	if(h < w){
		if(w%h==0){
			//cout << "d0" << endl;
			return 2 * h * (w/h) - h;
		}else{
			//cout << "d1" << endl;
			ret = 2 * h *(w/h);
		}
		ret += dfs(w%h, h);
	}else if(w < h){
		if(h%w==0){
			//cout << "d2" << endl;
			return 2 * w * (h/w) - w;
		}else{
			//cout << "d3" << endl;
			ret = 2 * w * (h/w);
		}
		ret += dfs(h%w, w);
	}else{
		//cout << "d4" << endl;
		return w;
	}
	return ret;
}



int main(){
	cin >> N >> X;
	cout << dfs(N-X, X) + N << endl;
}


Measured memory_bytes: 256
A,B = input().split()
if int(A) == 1 and int(B) == 1:
    print("Draw")
elif int(A) == 1:
    print("Alice")
elif int(B) == 1:
    print("Bob")
elif int(A) > int(B):
    print("Alice")
elif int(A) < int(B):
    print("Bob")
elif int(A) == int(B):
    print("Draw")

Measured memory_bytes: 3060
#include<iostream>
#include<math.h>
#include<iomanip>
using namespace std;

int main(){
	double x1,x2,y1,y2,distance;
	cin>>x1>>y1>>x2>>y2;
	distance=(x1-x2)*(x1-x2)+(y1-y2)*(y1-y2);
	cout<<fixed<<setprecision(5)<<sqrt(distance)<<endl;
	
}


Measured memory_bytes: 3284
use std::io::*;
use std::str::FromStr;

//https://qiita.com/tubo28/items/e6076e9040da57368845
fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

fn gcd (x:i64,y:i64) -> i64 {
    if x == 0 {
        return y;
    }else{
        return gcd(y%x,x);
    }
}

fn main(){
    let n:usize = read();
    let a:Vec<i64> = (0..n).map(|_| read()).collect();

    let mut g = a[0];
    for i in a.into_iter().skip(1){
        g = gcd(g,i);
    }
    println!("{}",g);

}


Measured memory_bytes: 4352
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <cstring>
#include <string>
#include <vector>
#include <queue>
#include <cmath>
#include <stack>
#include <set>
#include <map>
typedef long long ll;
using namespace std;

const int INF = 2000000000;

struct edge{
  int from, to, cost;
};

int main(){
  int N, M, P;
  cin >> N >> M >> P;
  edge e[M];
  for(int i = 0; i < M; i++){
    int a, b, c;
    cin >> a >> b >> c;
    a--;
    b--;
    c -= P;
    c *= -1;
    e[i] = edge{a, b, c};
  }

  //V回回した時のd[N - 1]　2V回回した時のd[N-1]
  int v1, v2;

  int d[N];
  fill(d, d + N, INF);
  d[0] = 0;
  for(int i = 0; i < N; i++){
    for(int j = 0; j < M; j++){
      if(d[e[j].from] != INF && d[e[j].from] + e[j].cost < d[e[j].to]){
        d[e[j].to] = d[e[j].from] + e[j].cost;
      }
    }
  }

  v1 = d[N - 1];

  for(int i = 0; i < N; i++){
    for(int j = 0; j < M; j++){
      if(d[e[j].from] != INF && d[e[j].from] + e[j].cost < d[e[j].to]){
        d[e[j].to] = d[e[j].from] + e[j].cost;
      }
    }
  }

  v2 = d[N - 1];

  if(v1 == v2){
    cout << max(0, -v1) << endl;
  } else {
    cout << -1 << endl;
  }

  return 0;
}


Measured memory_bytes: 256
import scala.io.StdIn.readLine
import scala.collection.mutable.ArrayBuffer

object Main {
  def isHamming(num:Int):Boolean = {
    var n = num
    while(n%2==0) n = n/2
    while(n%3==0) n = n/3
    while(n%5==0) n = n/5

    if(n==1) true
    else false
  }

  def main(args:Array[String]) = {
    var s = "0"
    val b = new ArrayBuffer[String]
    while({s=readLine.trim;s}!="0") {
      val n = s.split(" ").map(_.toInt)
      b+=(n(0) to n(1)).count(i=>isHamming(i)).toString
    }
    println(b.mkString("\n"))
  }
}

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

typedef long long ll;
typedef pair<int,int> ii;
typedef tree<ii,null_type,less<ii>,rb_tree_tag,tree_order_statistics_node_update> indexed_set;

int main() {
	cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(0);
	int a,b; cin>>a>>b;	
	if (a+b>=10) cout<<"error";
	else cout<<(a+b)<<endl;
	return 0;
}


Measured memory_bytes: 256
import sys
input = sys.stdin.readline
from collections import deque

N = int(input())
#A = list(map(int, input().split()))
A = [(a, i) for i, a in enumerate(map(int, input().split()))]
A = sorted(A, reverse=True)

values = []
num_indcies = {}
for i, a in enumerate(A):
    if not a in num_indcies:
        num_indcies[a] = [i]
        values.append(a)
    else:
        num_indcies[a].append(i)

values = sorted(values, reverse=True)
ans = 0
# indexの配列
dp_indices = []
for v in values:
    dp_indices.extend(num_indcies[v])


dp = [[0] * (N+1) for _ in range(N+1)]
for no, (a, pos) in enumerate(A):
    for i in range(no+1):
        j = no - i
        #k = dp_indices[i+j-2]
        #a = A[k]
        dp[i+1][j] = max(dp[i+1][j], dp[i][j] + a * (pos -i))
        dp[i][j+1] = max(dp[i][j+1], dp[i][j] + a * abs(pos - (N-1-j)))

ans = 0
for i in range(1, N+1):
    ans = max(ans, dp[i][N-i])
print(ans)





Measured memory_bytes: 98960
#include <iostream>
#include <map>
using namespace std;
typedef long long ll;
const ll mod = 1000000007;

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

    ll n;
    cin >> n;
    if(n == 1){
        cout << 1 << endl;
        return 0;
    }
    
    map<ll, ll> factors;
    for(ll i = 2; i <= n; ++i){
        ll tmp = i;
        for(ll j = 2; j * j <= i; ++j){
            while(tmp%j == 0){
                ++factors[j];
                tmp /= j;
            }
        }
        if(tmp != 1) ++factors[tmp];
    }

    ll res = 1;
    for(auto elem: factors){
        res = res * ((elem.second+1) % mod) % mod;
    }

    cout << res << endl;
}

Measured memory_bytes: 3648
#include<stdio.h>
int main(){
    int a,b,d,r;
    double f;

    scanf("%d%d",&a,&b);

    d=a/b;
    r=a%b;
    f=(double)a/(double)b;

    printf("%d %d %.10f",d,r,f);

    return 0;
}

Measured memory_bytes: 640
#include<bits/stdc++.h>
#define M 100005
#define P 1000000007
#define LL long long
using namespace std;
char s[M],t[M];
int n,m;
int nxt[M][26];
int pos[26];
void Init(){
	memset(pos,-1,sizeof(pos));
	for(int i=n-1;i>=0;i--){
		for(int j=0;j<26;j++)nxt[i][j]=pos[j];
		pos[s[i]-'a']=i;
	}
}
LL solve(){
	LL cost=0;
	int x=pos[t[0]-'a'];
	for(int i=1;i<m;i++){
		if(nxt[x][t[i]-'a']==-1){
			cost+=n;
			x=pos[t[i]-'a'];
		}else{
			x=nxt[x][t[i]-'a'];
		} 
	}
	return cost+x+1;
}
int main(){  
	scanf("%s %s",s,t);
	n=strlen(s);
	m=strlen(t);
	Init(); 
	for(int i=0;i<m;i++)
		if(pos[t[i]-'a']==-1){
			puts("-1");return 0;
		}
	cout<<solve()<<endl; 
	return 0;
}

Measured memory_bytes: 10624
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < n; i++)
using namespace std;
using ll = long long;
using P = pair<int, int>;
const int M = 1000100;
int main() {
  ll N ;
  cin >> N;
  
  vector<ll> cnt(M);
  rep(i,M) cnt.at(i)=0;
  
  ll sum = 0;
  ll a;
  rep(i,N) {
    cin >> a; 
    sum += a; 
    cnt.at(a)++;
  }
  
  ll Q;
  cin >> Q;
  
  ll b,c;
  ll d;
  rep(i,Q) {
    cin >> b >> c;
    d = cnt.at(b);
    cnt.at(b) = 0;
    cnt.at(c) += d; 
    sum -=d*b;
    sum +=d*c;
    cout << sum << endl;
  }
}


Measured memory_bytes: 11172
#include <iostream>
#include <vector>
#include <cmath>
#include <algorithm>
#include <climits>
#include <set>
#include <map>
#include <queue>
#include <deque>
#include <stack>
#include <string>
#include <list>
#include <ctime>
#include <complex>
#include <bitset>
#include <tuple>

#define ff first
#define ss second

using namespace std;
using pii=pair<int,int>;
using ll=long long;

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

    int a,b;
    cin>>a>>b;
    cout<<a*b;

    return 0;
}


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

int main() {
  int N, M;
  cin >> N >> M;
  vector<int> vote(N);
  int total = 0;
  for(int i = 0; i < N; i++) {
    int a;
    cin >> a;
    vote.at(i) = a;
    total += a;
  }
  int popular = 0;
  for(int i = 0; i < N; i++) {
    if(vote.at(i) * 4 * M >= total) {
      popular++;
    }
  }
  if (popular >= M) {
    cout << "Yes" << endl;
  }
  else {
    cout << "No" << endl;
  }   
}

Measured memory_bytes: 3592
#include <bits/stdc++.h>
using namespace std;
int main() {
    string n;
    cin>>n;

    if((n[0]==n[1]&&n[1]==n[2])||(n[1]==n[2]&&n[2]==n[3])){
        cout<<"Yes"<<endl;
    }
    else {
        cout<<"No"<<endl;
    }


}


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

using namespace std;

int main() {

	long n;
	cin >> n;

	long a;
	long minn = 10000000;
	long counter = 0;
	for (long i = 0; i < n; i++) {
		cin >> a;
		if (minn >= a) { counter++; }
		minn = min(minn, a);
	}

	cout  << counter << endl;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define LL long long
#define ULL unsigned long long
#define mp make_pair
#define pb push_back
#define pii pair<int,int>
#define pll pair<LL,LL>
#define x first
#define y second
#define pi acos(-1)
#define sqr(x) ((x)*(x))
#define pdd pair<double,double>
#define MEMS(x) memset(x,-1,sizeof(x))
#define MEM(x) memset(x,0,sizeof(x))
#define less Less
#define EPS 1e-4
#define arg ARG
#define cpdd const pdd
#define rank Rank
#define KK 500
#define MXN 200005
int main(){
    int n;
    scanf("%d",&n);
    int a[100005];
    for(int i = 0;i<n;i++)
        scanf("%d",&a[i]);
    sort(a,a+n);
    reverse(a,a+n);
    LL tot[100005];
    tot[n-1]=a[n-1];
    for(int i = n-2;i>=0;i--){
        tot[i]=tot[i+1]+a[i];
    }
    for(int i = 1;i<n;i++){
        if(tot[i]*2<a[i-1]){
            printf("%d\n",i);
            return 0;
        }
    }
    printf("%d\n",n);
    return 0;
}


Measured memory_bytes: 1408
import std.algorithm;
import std.array;
import std.conv;
import std.math;
import std.range;
import std.stdio;
import std.string;
import std.typecons;

T read(T)() { return readln.chomp.to!T; }
T[] reads(T)() { return readln.split.to!(T[]); }
alias readint = read!int;
alias readints = reads!int;

bool calc(string[] a, string[] b) {
    int n = cast(int) a.length;
    int m = cast(int) b.length;

    for (int i = 0; i < n; i++) {
        if (i + m > n) break;

        for (int j = 0; j < n; j++) {
            if (j + m > n) break;

            bool ok = true;
            for (int r = 0; r < m; r++) {
                for (int c = 0; c < m; c++) {
                    if (a[i + r][j + c] != b[r][c]) {
                        ok = false;
                    }
                }
            }
            if (ok) return true;
        }
    }

    return false;
}

void main() {
    auto nm = readints;
    int n = nm[0], m = nm[1];

    string[] a;
    for (int i = 0; i < n; i++) {
        a ~= read!string;
    }

    string[] b;
    for (int i = 0; i < m; i++) {
        b ~= read!string;
    }

    writeln(calc(a, b) ? "Yes" : "No");
}


Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>
#define ll long long
#define ins(a) scanf("%s", (a))
#define put(a) printf("%lld\n", (a))
int main(void){
    char S[205];
    ins(S);
    for(ll ans=strlen(S)-2; ; ans-=2){
        if(!strncmp(S, S+ans/2, ans/2)){
            put(ans);
            return 0;
        }
    }
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
#define ll long long int
#define ld long double
#define pb push_back
#define vi vector<int>
#define vl vector<ll> 
#define vvl vector< vector<ll> > 
#define vvi vector< vector<int> >
#define rep(i,a)  for(ll i=0; i< a; i++)
#define rep1(i,a)   for(ll i = 1; i< a; i++)
#define foi(i, a, b)    for(ll i = a; i<b ; i++)
#define fod(i, a, b)    for(ll i = a; i>=b ; i--)
#define mp make_pair
#define ff first.first
#define fs first.second
#define pi pair<int, int>
#define ppi pair<pair<int, int>, int>
#define max3(a, b, c)   max(max(a, b), c)
#define min3(a, b, c)   min(min(a, b), c)
#define MAX 1000001
#define MOD 1000000007
#define s(v) v.size()
#define e(v) v.empty()

using namespace std;

ll gcd(ll a, ll b){if(b==0)return a;return gcd(b, a%b);}
ll lcm(ll a, ll b){return a*b/gcd(a, b);}
ll fexp(ll a, ll b){ll ans = 1;while(b){if(b&1) ans = ans*a%MOD; b/=2;a=a*a%MOD;}return ans;}
ll inverse(ll a, ll p){return fexp(a, p-2);}
// bool sortbysec(const pair<int,int> &a, const pair<int,int> &b){return (a.second < b.second);} 

int main(){
	// #ifndef ONLINE_JUDGE
 //        freopen("../input.txt", "r", stdin);
 //        freopen("../output.txt", "w", stdout);
 //    #endif
    ios::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
    ll t;
    // cin>>t;
    t = 1;
    while(t--){
    	string s, r;
    	cin>>s>>r;
    	ll cnt = 0;
    	rep(i, 3){
    		if(s[i] == r[i])	cnt++;
    	}
    	cout<<cnt<<endl;
    }
}

Measured memory_bytes: 256
#include<algorithm>
#include <iostream>
#include<cstdio>
#include<cmath>
#include<iomanip>
#include<string>
using namespace std;
int main(){
   
    int x,a,b;
    cin>>x>>a>>b;
    
    if((a-b)>=0){
        cout<<"delicious"<<endl;
    }else if((b-a)<=x){
        cout<<"safe"<<endl;
    }else{
        cout<<"dangerous"<<endl;
    }
        
    
    
    return 0;
}






Measured memory_bytes: 256
#include<bits/stdc++.h>
#define pb push_back
#define all(v) (v).begin() , (v).end()
#define popcnt(x) __builtin_popcount(x)
#define inf 0x3f3f3f3f
#define watch(x) cout << (#x) << " is " << (x) << endl
#define rand() (rand() << 15 | rand())
using namespace std;
typedef long long  ll;
#define EPS 1e-9
#define PI acos(-1.0)


int main() {
   ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
   int f , s;
   cin >> s;
   f = s / 2 + (s & 1);
   cout << fixed << setprecision(6) << 1.0 * f / s << "\n";
}

Measured memory_bytes: 256
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

fn main() {
    input! {
    	n: usize
    }
    println!("{}", if (n%2==1){(n+1)/2} else {n/2});
}


Measured memory_bytes: 4352
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define REP(i, a, b) for(ll i=(a); i<(b); i++)
#define PER(i, a, b) for(ll i=(a); i>=(b); i--)
#define rep(i, n) REP(i, 0, n)
#define per(i, n) PER(i, n, 0)
const ll INF = 1e18+18;
const ll MAX = 200000;
const ll MOD = 1000000007;
#define Yes(n) cout << ((n) ? "Yes" : "No") << endl;
#define YES(n) cout << ((n) ? "YES" : "NO") << endl;
int N;
vector<char> C={'a','b','c','d','e','f','g','h','i','j'};
void out(string S, int i, int j){
    if(i<N){
        rep(k, j+1){
            string T=S+C[k];
            if(k<j)out(T, i+1, j);
            if(k==j)out(T, i+1, j+1);
        }
    }
    if(i==N)cout<<S<<endl;
}

int main(){
    cin>>N;
    out("a", 1, 1);
}

Measured memory_bytes: 1536
# Aizu Problem ALDS_1_4_C: Dictionary
import sys, math, os

# read input:
PYDEV = os.environ.get('PYDEV')
if PYDEV=="True":
    sys.stdin = open("sample-input.txt", "rt")


D = set()
N = int(input())
for _ in range(N):
    cmd, string = input().split()
    if cmd == "insert":
        D.add(string)
    elif cmd == "find":
        print("yes" if string in D else "no")

Measured memory_bytes: 33232
#include <iostream>
#include<cmath>
#include<string>
#include<algorithm>
#include<ctime>
#include<functional>
#include<vector>
#include<stack>
#include<queue>
#include<deque>
#include<list>
#include<map>
#include<set>
#include<tuple>
#include<cassert>
#include<bitset>
#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<cctype>
#include<iomanip>
#include<climits>
#include<typeinfo>
#include<utility>
#define rep(i,n) for(int i=0;i<n;i++)
#define Rep(i,n) for(ll i=0;i<n;i++)
#define For(i,m,n) for(int i=m;i<n;i++)
#define FOR(i,m,n) for(ll i=m;i<n;i++)
double pi = 3.141592653589793238;
using ll = long long;
using namespace std;

ll LGCD(ll x, ll y) { if (x % y == 0) return y;else return LGCD(y, x % y); }
ll LLCM(ll x, ll y) { return x * y / LGCD(x, y); }

int GCD(int x, int y) { if (x % y == 0) return y;else return GCD(y, x % y); }
int LCM(int x, int y) { return x * y / GCD(x, y); }
ll dpcombination[10000][10000];
ll combination(ll n, ll r) {
	if (n == r) { return dpcombination[n][n] = 1; }
	else if (r == 0) { return dpcombination[n][0] = 1; }
	else if (r == 1) { return dpcombination[n][1] = n; }
	else if (dpcombination[n][r]) { return dpcombination[n][r]; }
	else { return dpcombination[n][r] = combination(n - 1, r - 1) + combination(n - 1, r); }
}

void clockman(int time1) {

	cout << 1.0*(clock() - time1) / CLOCKS_PER_SEC << endl;
	return;
}
//cout << fixed << setprecision(10)


int main()
{
	string s;
	int k;
	cin >> k >> s;
	int n = s.length();
	if (n <= k)cout << s << endl;
	else {
		string t;

		for (int i = 0;i < k;i++) {
			t = t + s[i];
		}
		t = t + "...";
		cout << t << endl;
	}



	return 0;
}



Measured memory_bytes: 3600
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
 
int main(){
    int N;
    cin >> N;
    vector<int> A(N);
    for (int i = 0; i < N; i++)
    {
        cin >> A[i];
    }
 
    long long ans = 0;
    int MaxNum = 0;
    for (int i = 0; i < N; i++)
    {
        //MaxNumを使い回すことで計算を抑える
        MaxNum = max(MaxNum, A[i]);
        int Bi = MaxNum;
        ans += Bi - A[i];
    }
 
    cout << ans << endl;
}

Measured memory_bytes: 3980
#include <bits/stdc++.h>
typedef long long ll;
const int N=100005;
int n,mx;
int a[N],sum[N<<1],b[N],s[N];
int lowbit(int x) { return x&-x; }
void upd(int x) {
	while (x<=mx){
		sum[x]++;
		x+=lowbit(x); 
	}
}
int getsum(int x) {
    int ret=0;
    while (x){
    	ret+=sum[x];
    	x-=lowbit(x);
    }
    return ret;
}

int check(int mid) {
    memset(sum,0,sizeof(sum));
	mx=0;
    for (int i=1;i<=n;++i) {
        if (a[i]<mid) s[i]=-1;
        else s[i]=1;
    }
    ll ans=0;
    for (int i=1;i<=n;i++) s[i]+=s[i-1],ans+=(s[i]>=0);
    for (int i=1;i<=n;i++) s[i]+=n+1,mx=std::max(mx,s[i]);
    for (int i=1;i<=n;i++) ans+=getsum(s[i]),upd(s[i]);
    ll cnt=1ll*n*(n-1)/2+n;
    return cnt-ans<cnt/2+1;
}

int main() {
    scanf("%d",&n);
    for (int i=1;i<=n;++i) scanf("%d",&a[i]),b[i]=a[i];
    std::sort(b+1,b+n+1); 
	int m=std::unique(b+1,b+n+1)-b-1;
    for (int i=1;i<=n;++i) a[i]=std::lower_bound(b+1,b+m+1,a[i])-b;
    int l=1,r=m,ans=0;
    while (l<=r) {
        int mid=(l+r)>>1;
        if (check(mid)) l=mid+1,ans=b[mid];
        else r=mid-1;
    }
    printf("%d\n",ans);
    return 0;
}

Measured memory_bytes: 5728
#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <limits>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <regex>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <valarray>
#include <vector>
using namespace std;

using ll = long long;
using ld = long double;
const int INF = 1e9;
const double EPS = 1e-9;
const ll MOD = 1e9 + 7;

int main()
{
  string S;
  cin >> S;
  int N = S.size();
  vector<ll> mods(2019, 0);

  ll cur = 0, coef = 1;
  mods[cur]++;
  for (int i = 0; i < N; ++i)
  {
    cur = (cur + coef * (S[N - i - 1] - '0') % 2019) % 2019;
    coef = coef * 10 % 2019;
    mods[cur]++;
  }
  ll ans = 0;
  for (int i = 0; i < 2019; ++i)
  {
    ans += mods[i] * (mods[i] - 1) / 2;
  }
  cout << ans << endl;

  return 0;
}


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

using namespace std;
typedef long long ll;

int main(){
  long long A;
  string B;
  std::cin >> A >> B;
  long long B100 = stoll( B.substr(0,B.size()-3) + B.substr(B.size()-2, 2) );
  long long C = A*B100/100;
  std::cout << C << std::endl;
  return 0;
}

Measured memory_bytes: 3648
#include <stdio.h>
#include <cctype>
#include <limits.h>
#include <math.h>
#include <complex>
#include <bitset>
#include <vector>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <cstring>
#include <string>
#include <sstream>
#include <algorithm>
#include <iomanip>
#include <iostream>

#define VARIABLE(x) cerr << #x << "=" << x << endl
#define BINARY(x) static_cast<bitset<16> >(x);
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define REP(i,m,n) for (int i=m;i<(int)(n);i++)
#define if_range(x, y, w, h) if (0<=(int)(x) && (int)(x)<(int)(w) && 0<=(int)(y) && (int)(y)<(int)(h))

const int INF = 1000000000;
const double EPS = 1e-8;
const double PI = 3.14159;
int dx[4]={0, 1, 0, -1}, dy[4]={-1, 0, 1, 0};
using namespace std;
typedef pair<int, int> P;


/** Problem2260 : (iwi) **/
int main()
{
	string s;
	cin>>s;
	int ans = 0;

	if (s.size()%2==1) {
		if (s[s.size()/2] != 'i' && s[s.size()/2] != 'w')
			ans++;
		
		s.erase(s.size()/2, 1);
	}

	while (s.size()) {
		int n = (int)s.size();
		if (s[n/2-1] == '(') {
			if (s[n/2] != ')')
				ans++;
		} else if (s[n/2-1] == ')') {
			if (s[n/2] != '(')
				ans++;
		} else if (s[n/2-1] != s[n/2])
			ans++;
			
		s.erase(n/2-1, 2);
	}
	
	cout << ans << endl;
}

Measured memory_bytes: 1200
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)
using P = pair<int,int>;
using ll = long long;
int x, y, z, a, b, c, e;
priority_queue<int> qu;
P p[100005], xx[100005];
ll cur, ans;
int main(){
	scanf("%d%d%d", &x, &y, &z);
	rep(i,x+y+z){
		scanf("%d%d%d", &a, &b, &c);
		cur += c;
		xx[i] = {a-c,b-c};
	}
	sort(xx,xx+x+y+z, greater<P>());
	rep(i,y+z) p[i] = {xx[i+x].second,i+x};
	sort(p, p+y+z, greater<P>());
	rep(i,y) cur += p[i].first;
	e = y;
	rep(i,x){
		cur += xx[i].first;
		qu.push(xx[i].second - xx[i].first);
	}
	ans = cur;
	for(int i=x; i<x+y; i++){
		P tmp = {xx[i].second, i};
		if(tmp > p[e]) cur -= xx[i].second;
		else{
			for(e--; p[e].second < i; e--);
			cur -= p[e].first;
		}
		cur += xx[i].first;
		qu.push(xx[i].second - xx[i].first);
		cur += qu.top();
		qu.pop();
		ans = max(ans, cur);
	}
	printf("%lld\n", ans);
}

Measured memory_bytes: 1920
#include <iostream>
#include <cstring>
#include <map>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <set>
#include <vector>
#include <queue>
#include <list>
#include <numeric>
#include <stdio.h>
#include <string>
#include <cstdlib>
#include <math.h>
#include <stack>
#include <climits>
#include <bitset>

using namespace std;
typedef long long ll;

//最小公倍数
ll gcd(ll x, ll y) {
  ll tmp = 0;
  if (x < y){
    tmp=x;
    x=y;
    y=tmp;
  }
  while (y > 0) {
    ll r = x % y;
    x = y;
    y = r;
  }
  return x;
}

//最大公倍数
ll lcm(ll x,ll y){
  return x/gcd(x,y)*y;
}


//for(int i = ; i < ; i++){}

int main(){
  int n;
  cin>>n;
  int c1=0;
  int c2=0;
  int c4=0;
  for(int i = 0; i < n; i++){
    int s;
    cin>>s;
    if(s%4==0){
      c4++;
    }
    else if(s%2==0){
      c2++;
    }
    else{
      c1++;
    }
  }
  bool ans = false;
  if(c2==0){
    if(c1<=c4+1) ans = true;
  }
  else{
    if(c1<=c4) ans = true;
  }
  if(ans)cout<<"Yes"<<endl;
  else cout<<"No"<<endl;
  return 0;
}




Measured memory_bytes: 256
from collections import deque

# データの入力
N = int(input())
DG = {}
for i in range(N):
    tmp = input().split()
    if int(tmp[1]) != 0:
        DG[i] = [int(x)-1 for x in tmp[2:]]
    else:
        DG[i] = []


result = {}
is_visited = {key: False for key in range(N)}
# bfs
# 初期queue
que = deque([(0, 0)])  # 必要なものはnodeidと原点からの距離
while que:
    nodeid, cost = que.popleft()  # 先入れ先出し
    result[nodeid] = cost
    is_visited[nodeid] = True  # この文は最初の1for目しか意味ないんだけどなんかうまい方法ないのか
    for nextnode in DG[nodeid]:
        if is_visited[nextnode]:
            pass
        else:  # 未訪問のものについては探索候補に入れる
            que.append((nextnode, cost + 1))
            is_visited[nextnode] = True  # 探索候補に入れた瞬間に訪問管理しないと重複を生じる場合がある

for i in range(N):
    if is_visited[i]:
        print(i + 1, result[i])
    else:
        print(i+1, -1)


Measured memory_bytes: 6040
#include <bits/stdc++.h>
using ll = long long;
#define FOR(i, k, n) for(ll i = (k); i < (n); i++)
#define FORe(i, k, n) for(ll i = (k); i <= (n); i++)
#define FORr(i, k, n) for(ll i = (k)-1; i > (n); i--)
#define FORre(i, k, n) for(ll i = (k)-1; i >= (n); i--)
#define REP(i, n) FOR(i, 0, n)
#define REPr(i, n) FORre(i, n, 0)
#define ALL(x) (x).begin(), (x).end()
#define ALLr(x) (x).rbegin(), (x).rend()
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
using namespace std;

const int INF = 1001001001;

int main(void){
  int a, b, c, d;
  cin >> a >> b >> c >> d;
  cout << min(a, b) + min(c, d) << endl;
  return 0;
}

Measured memory_bytes: 256
N=int(input())
C=[int(input()) for i in range(N)]
a=[0]*N
p={}
m=10**9+7
for i,c in enumerate(C):
    a[i]=a[i-1]
    if c in p and p[c]<i-1:
        a[i]=(a[i]+a[p[c]]+1)%m
    p[c]=i
print(a[-1]+1)

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

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	int n;
	cin >> n;
	map <string, int> mp;
	for(int i=0;i<n;++i){
		string s;
		cin >> s;
		mp[s]++;
	}
	int mx = 0;
	for(auto i : mp)
		mx = max(mx, i.second);
	for(auto i : mp){
		if(mx == i.second)
			cout << i.first << "\n";
	}
	return 0;
}
		


Measured memory_bytes: 23808
#include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <cstring>
#include <map>
#include <queue>
#include <cmath>
#include <complex> // complex<double> a(1.2 , 2.3);// real(): 1.2, imag()2.3
using namespace std;

#define MOD 1000000007
#define ll long long
#define ld long double
#define FOR(i,a,b) for(ll i=(ll)a;i<(ll)b;i++)
#define rep(i,n) FOR(i,0,n)
#define pb push_back
#define mp make_pair
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define rmsame(a) sort(all(a)),a.erase(unique(all(a)), a.end())
#define rmvector(a,b) rep(i,a.size())rep(j,b.size())if(a[i]==b[j]){a.erase(a.begin()+i);i--;break;}
#define pq_pair_tB priority_queue <pair<ll,ll>, vector<pair<ll,ll> > , greater<pair<ll,ll> > > 
#define pq_pair_ts priority_queue <pair<ll,ll> > //第二成分の大きさが関係ない
template<typename X> bool exist(vector<X> vec, X item){return find(all(vec), item)!=vec.end();}
ll gcd(ll a, ll b){if(b==0)return a;return gcd(b,a%b);}
ll lcm(ll a, ll b){return a/gcd(a,b)*b;}


int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    ll N; cin >> N ;
    vector<ll> p;
    
    rep(i,N){
        ll inp; cin >> inp;
        p.pb(inp);
    }
    
    ll ans = 0;
    rep(i,N-1){
        if(i+1 == p[i]) {
            swap(p[i], p[i+1]);
            ans ++;
        }
    }
    if(p[N-1] == N) ans ++;
    cout << ans << endl;
    //cout << fixed << setprecision(16) << ans << endl;
    return 0;
}


Measured memory_bytes: 1400
R, G, B, N = map(int, input().split())

ans = 0
for r in range(3001):
    for g in range(3001):
        remain = N - (r*R + g*G)
        if remain >= 0:
            if remain % B == 0:
                ans += 1
        else:
            break
print(ans)

Measured memory_bytes: 2940