akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define endl "\n"
#define fo(i,s,e) for( i=s;i<e;i++)
#define rfo(i,s,e) for(i=s;i>e;i--)
#define LL long long int 
const LL MOD=1e9+7;
#define pb push_back
#define pob pop_back()
#define sp " "
#define ff first
#define ss second
//            When something is important enough, you do it even if the odds are not in your favor.

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);cout.tie(NULL);
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif
    // code goes here
    int t=1;//cin>>t;
    while(t--){
      LL n,i,j;cin>>n;
      LL a[n],ans=0;
      fo(i,0,n) cin>>a[i];
      sort(a,a+n);
      fo(i,0,n){
        fo(j,i+1,n){
          auto it=lower_bound(a,a+n,a[i]+a[j])-a;
          ans+=it-j-1;
        }
      }
      cout<<ans;
    }
    return 0;
}

Measured memory_bytes: 3648
#include <iostream>
using namespace std;
int N,W;
int v[101],w[10010010];
int dp[101][10001];
int INF = 1001001001;

int main(){
    cin >> N >> W;
    for(int i=0; i<N; i++) cin >> v[i] >> w[i];
    
    fill(dp[0], dp[0] + 101 * 10001, INF);
    dp[0][0] = 0;
    
    for(int i=0; i<N; i++){
        for(int j=0; j<=10000; j++){
            if(j < v[i]) dp[i + 1][j] = dp[i][j];
            else dp[i + 1][j] = min(dp[i][j], dp[i][j - v[i]] + w[i]);
        }
    }
    int res = 0;
    for(int j=0; j<=10000; j++) if(dp[N][j] <= W) res = j;
    cout << res << endl;
}


Measured memory_bytes: 7060
import java.util.Scanner;

public class Main {

	private void solve() {
		Scanner in = new Scanner(System.in);
		int K = in.nextInt();
		int X = in.nextInt();
		
		for(int i=X-K+1; i<=X+K-1; i++) {
			System.out.print(i);
			if(i<X+K-1) {
				System.out.print(" ");
			}else {
				System.out.println();
			}
		}
	}
	
	public static void main(String[] args) {
		new Main().solve();
	}
}


Measured memory_bytes: 22996
# https://atcoder.jp/contests/arc086/tasks/arc086_a
from collections import Counter
n, k = map(int, input().split())

nums = [int(i) for i in input().split()]
c = Counter(nums)
kinds = len(c)
if kinds <= k:
    ans = 0
else:
    ans = 0
    common = c.most_common()[::-1]
    for i in range(kinds - k):
        ans += common[i][1]
print(ans)

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

using namespace std;

int main()
{
    long long a,b,c,d;
    cin>>a>>b>>c>>d;
    long long fc,sc;
    if(c%b ==0)
    {
        fc = c/b;
    }
    else
    {
        fc = (c/b) + 1;
    }
    if(a%d ==0)
    {
        sc = a/d;
    }
    else
    {
        sc = (a/d) + 1;
    }
    if(fc <= sc)
    {
        cout<<"Yes\n";
    }
    else
    {
        cout<<"No\n";
    }
    
    
    
    

    return 0;
}

Measured memory_bytes: 3632
#include<iostream>
#include<algorithm>
using namespace std;
const int dy[] = { 1, 0, 0, -1}, dx[] = { 0, -1, 1, 0};
int h, w, mas[90][90];
bool used[90][90];
int dfs( int y, int x){
  if(used[y][x] || !mas[y][x]) return 0;
  used[y][x] = true;
  int ret = 0;
  for(int i = 0 ; i < 4 ; i++ ){
    int ny = y + dy[i], nx = x + dx[i];
    if(ny >= 0 && ny < h && nx >= 0 && nx < w){
      ret = max( ret, dfs( ny, nx) + 1);
    }
  }
  used[y][x] = false;
  return ret;
}
int main(){
  while(cin >> h >> w, h){
    for(int i = 0 ; i < h ; i++ ){
      for(int j = 0 ; j < w ; j++ ){
        cin >> mas[i][j];
      }
    }
    int ret = 0;
    for(int i = 0 ; i < h ; i++ ){
      for(int j = 0 ; j < w ; j++ ){
        ret = max( ret, dfs( i, j));
      }
    }
    cout << ret << endl;
  }
}

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

#define ll long long
#define vvi vector<vector<int>>
#define vec vector
#define pq priority_queue
#define all(v) (v).begin(), (v).end()
#define rep(i, n, m) for (int (i) = (n); (i) < (m); ++(i))
#define debug(x) cerr << #x << ": " << x << endl;
#define debug2(x, y) cerr<<"("<<#x<<", "<<#y<<") = "<<"("<<x<<", "<<y<<")"<<endl;
#define debugB(x, y) cerr<<#x<<": "<<bitset<y>(x) << endl;
#define line() cerr << "---------------" << endl;

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

int N, W;
int weight[110], value[110];
int dp[110][10010];

int main() {
   cin >> N >> W;
   rep (i, 0, N) {
      cin >> value[i] >> weight[i];
   }

   rep (w, 0, W+1) {
      dp[0][w] = 0;
   }

   rep (i, 0, N) {
      rep (w, 0, W+1) {
         if (w >= weight[i]) {
            dp[i+1][w] = 
               max(dp[i][w-weight[i]]+value[i], dp[i][w]);
         } else {
            dp[i+1][w] = dp[i][w];
         }
      }
   }
   cout << dp[N][W] << endl;

   return 0;
}


Measured memory_bytes: 7028
#include<stdio.h>
int main(){
	double a,b,c,d,e,f;
	double x,y,z,v;
	while(scanf("%lf %lf %lf %lf %lf %lf",&a,&b,&c,&d,&e,&f)!=-1){
		x=(c*e-b*f)/(a*e-b*d);
		y=(c*d-a*f)/(b*d-a*e);
		if(x>=-0.0005&&x<0.0005)	x=0;
		if(y>=-0.0005&&y<0.0005)	y=0;
		printf("%.3lf %.3lf\n",x,y);
	}
}

Measured memory_bytes: 2624
#pragma GCC optimize("Ofast")
#include<bits/stdc++.h>
                
#define speedio ios_base::sync_with_stdio(false); cin.tie(NULL);
#define pretime float(clock()-clk)/CLOCKS_PER_SEC
#define max2(a,b) ((a)>(b) ? (a) : (b))   
#define min2(a,b) ((a)<(b) ? (a) : (b)) 
#define rep(i,a,b) for(i=a;i<=b;++i)
#define rev(i,a,b) for(i=a;i>=b;--i) 
#define all(x) x.begin(),x.end()
#define sz(x) (int)x.size()
#define ll long long int 
#define ins insert
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define PI 3.14159265
#define mod 1000000007
#define inf 1000000000000000

using namespace std;
typedef vector<ll>   vll;
typedef vector<int>   vi;
typedef set<ll>      sll;
typedef set<int>      si;
typedef pair<ll,ll> pll;
typedef pair<int,int> pii;
clock_t clk=clock();       

ll i,j;
void solve(void);

int main()
{
  speedio;
   int t=1;  
  // cin>>t;
   while(t--)
     solve();

  return 0;
}
//
void solve()
{
 ll n,a,b,c,d; string s;
 cin>>n>>a>>b>>c>>d>>s;

--a; --b; --c; --d;
s[a]='#';
   if(d<c)
   {
   	 rep(i,b,d)
   	  if(s[i-1]!='#' && s[i+1]!='#' && s[i]!='#')
   	   break;

   	  if(i==d+1) s[d]='#';
   }
rep(i,a+1,c-1)
  	 if(s[i]=='#' && s[i+1]=='#')
  	 {
  	 	cout<<"No\n"; return;
  	 }
rep(i,b+1,d-1)
    if(s[i]=='#' && s[i+1]=='#')
    {
    	cout<<"No\n"; return;
    }
    cout<<"Yes\n";
}

Measured memory_bytes: 592
N,A,B=map(int,input().split())
N_list=list(str(N))
num=0
for n in range(1,N+1):
    if len(N_list)==1:
        if A<=n<=B:
            num+=n
    if len(N_list)==2:
        if A<=((n//10)+(n%10))<=B:
            num+=n
    if len(N_list)==3:
        if A<=((n//100)+((n%100)//10)+(n%10))<=B:
            num+=n
    if len(N_list)==4:
        if A<=((n//1000)+((n%1000)//100)+((n%100)//10)+(n%10))<=B:
            num+=n
    if len(N_list)==5:
        if A<=((n//10000)+((n%10000)//1000)+((n%1000)//100)+((n%100)//10)+(n%10))<=B:
            num+=n
print(num)

Measured memory_bytes: 39280
#define _USE_MATH_DEFINES
#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
#include<string>
#include<iostream>
#include<cctype>
#include<cstdio>
#include<vector>
#include<stack>
#include<queue>
#include <algorithm>
#include<math.h>
#include<set>
#include<map>
#include<iomanip>

//#include<bits/stdc++.h>

using namespace std;


int main() {

	int n, ans = 0;
	cin >> n;
	for (int i = 0; i < n; i++) {
		int a, b;
		cin >> a >> b;
		ans += b - a + 1;

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


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
const int N=2005;
char s[N][N];
int n,m,q,P[N][N],row[N][N],line[N][N];

void init()
{
    scanf("%d%d%d",&n,&m,&q);
    for(int i=1;i<=n;i++) 
    {
        scanf("%s",s[i]+1);
        for(int j=1;j<=m;j++) if(s[i][j]=='1') P[i][j]=1;
    }
    for(int i=1;i<=n;i++)
    {
        for(int j=1;j<=m;j++) P[i][j]+=P[i-1][j]+P[i][j-1]-P[i-1][j-1];
    }
    for(int i=1;i<=n;i++)
    {
        for(int j=2;j<=m;j++) 
        {
            if(s[i][j]=='1'&&s[i][j-1]=='1') row[i][j]=1;
            row[i][j]+=row[i][j-1];
            row[i][j]+=row[i-1][j];
            row[i][j]-=row[i-1][j-1];
        }
    }
    for(int j=1;j<=m;j++)
    {
        for(int i=2;i<=n;i++)
        {
            if(s[i][j]=='1'&&s[i-1][j]=='1') line[i][j]=1;
            line[i][j]+=line[i-1][j];
            line[i][j]+=line[i][j-1];
            line[i][j]-=line[i-1][j-1];
        }
    }
}

void solve()
{
    int sx,ex,ey,sy;
    scanf("%d%d%d%d",&sx,&sy,&ex,&ey);
    int sum1=P[ex][ey]-P[sx-1][ey]-P[ex][sy-1]+P[sx-1][sy-1];
    int sum2=line[ex][ey]-line[sx][ey]-line[ex][sy-1]+line[sx][sy-1];
    sum2+=row[ex][ey]-row[sx-1][ey]-row[ex][sy]+row[sx-1][sy];
    printf("%d\n",sum1-sum2);
}

int main()
{
    init();
    while(q--)
    {
        solve();
    }
}

Measured memory_bytes: 54732
n = int(input())
ti_1, xi_1, yi_1 = [0,0,0]
for i in range(n):
  ti, xi, yi = map(int, input().split())
  tlim = ti- ti_1
  dist = abs(xi - xi_1) + abs(yi - yi_1)
  if tlim < dist or (tlim-dist) % 2 == 1:
    print('No')
    exit()
  else:
    ti_1, xi_1, yi_1 = ti, xi, yi
    continue
print('Yes')

Measured memory_bytes: 74064
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
#define INF (1<<30)
#define INFLL (1ll<<60)
typedef pair<int, int> P;
typedef pair<int, P> E;
#define gt first
#define gc second.first
#define gr second.second
#define MOD (1000000007ll)
#define l_ength size
#define PI 3.14159265358979

void mul_mod(ll& a, ll b){
	a *= b;
	a %= MOD;
}

void add_mod(ll& a, ll b){
	b += MOD;
	a += b;
	a %= MOD;
}

int n;
ll a[2222],memo[2222][2222];
bool done[2222][2222];

ll sgmn(int l, int r){
	if(done[l][r]){
		return memo[l][r];
	}
	done[l][r] = true;
	if(l > r){
		memo[l][r] = min(sgmn(l,n-1),sgmn(0,r));
	}else if(l == r){
		memo[l][r] = a[l];
	}else{
		memo[l][r] = min(sgmn(l,r-1),a[r]);
	}
	return memo[l][r];
}

int main(void){
	int i,j;
	ll x,tmp,ans=INFLL;
	fill(done[0],done[2222],false);
	cin >> n >> x;
	for(i=0; i<n; ++i){
		cin >> a[i];
	}
	for(i=0; i<n; ++i){
		tmp = i * x;
		for(j=0; j<n; ++j){
			tmp += sgmn((j-i+n)%n,j);
		}
		ans = min(tmp,ans);
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 41216
a, b, c, d = map(int, input().split())

if b < 0 and d < 0: #両方負
    print(a*c)
elif b < 0: #xは負
    if c < 0:
        print(a*c) #負*負
    else:
        print(b*c)
elif d < 0: #yは負
    if a < 0:
        print(a*c) #負*負
    else:
        print(a*d)
else:
    print(max(a*c, b*d))


Measured memory_bytes: 9176
# 隣接リスト
n = int(input())

graph = []
for _ in range(n):
    tmp = list(map(int, input().split()))
    if tmp[1] == 0:
        graph.append([])
    else:
        graph.append(tmp[2:])

#print(graph)
check = [0]*n
count = 0
go = [0]*n
back = [0]*n

def dfs(v):
    #print(v)
    global count
    if check[v] == 0:
        check[v] = 1
        count += 1
        go[v] = count
        tolist = graph[v]
        if len(tolist) > 0:
            for i in tolist:
                dfs(i-1)
        count += 1
        back[v] = count

while True:
    if 0 in check:
        k = check.index(0)
        dfs(k)
    else:
        break

#print("check\t:{}".format(check))
#print("go\t:{}".format(go))
#print("back\t:{}".format(back))

for i in range(n):
    print("{} {} {}".format(i+1, go[i], back[i]))



Measured memory_bytes: 5624
#include <iostream>
#include <cmath>
using namespace std;
long long a[1000],b[1000];
long long D[600][600];
long long E[600];
long long check(int n,int B){
	for(int i=1;i<=n;i++){
		long long t=a[i]%B;
		E[i]=E[i-1]+t;
		D[i][0]=D[i-1][0]+t;
		D[i-1][i]=12341234123412341;
		for(int j=1;j<=i;j++){
			D[i][j]=min(D[i-1][j]+t,D[i-1][j-1]-t+B);
		}
	}
	return D[n][E[n]/B];
}
int main(){
	int n;long long k;
	cin>>n>>k;
	for(int i=1;i<=n;i++){
		cin>>a[i];
		b[i]=b[i-1]+a[i];
	}
	long long sum=b[n];
	long long lim=sqrt(b[n])+2;
	if(lim>sum)lim=sum;
	for(int i=1;i<=lim;i++){
		if(sum%i==0){
			long long B=sum/i;
			if(check(n,B)<=k*2){
				cout<<B<<endl;
				return 0;
			}
		}
	}
	for(int i=lim;i>=1;i--){
		if(sum%i==0){
			long long B=i;
			if(check(n,B)<=k*2){
				cout<<B<<endl;
				return 0;
			}
		}
	}
}

Measured memory_bytes: 2560
//Giorgi Kldiashvili

#include <bits/stdc++.h>

#define fr first
#define sc second

using namespace std;

void ex()
{
  printf("Impossible\n");
  exit(0);
}

int n;
int a[220], A[220];
int di, d, cnt;

int main()
{
  scanf("%d", &n);

  for(int i = 0; i < n; ++ i)
  {
    scanf("%d", &a[i]);
    di = max(di, a[i]);
  }

  if(n == 2)
  {
    if(a[0] == a[1] && a[1] == 1)
      return printf("Possible\n"), 0;
    ex();
  }

  sort(a, a + n);
  di = a[n - 1];

  if(di < 2)
    ex();

  d = (di >> 1) + (di & 1);


  if(a[0] < d)
    ex();

  for(int i = 0; i < n; ++ i)
    A[a[i]] ++;

  cnt = 1;
  cnt += di & 1;
  if(A[d] != cnt)
    ex();
  for(int i = d + 1; i <= di; ++ i)
    if(A[i] < 2)
      ex();

  printf("Possible\n");
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <algorithm>
#include <vector>
#include <stack>
using namespace std;
#define REP(i, n) for(int (i)=0; (i)<(n); (i)++)
#define OUT(a) cout << (a) << "\n"
#define ll long long
ll MOD = 10e9 + 7;

pair<int, int> a[51][51];

int main() {
    int n;
    cin >> n;
    vector<pair<double, pair<int, int> > > xy(n);
    vector<pair<int, pair<int, int> > > ans;
    REP(i, n) {
        scanf("%d %d", &xy[i].second.first, &xy[i].second.second);
        xy[i].first = sqrt(pow(xy[i].second.first, 2) + pow(xy[i].second.second, 2));
    }
    //sort(xy.begin(), xy.end());
    REP(i, n) for(int j=0; j<n; j++) {
        a[i][j].first = xy[j].second.first - xy[i].second.first;
        a[i][j].second = xy[j].second.second - xy[i].second.second;
    }
    REP(i, n) for(int j=0; j<n; j++) {
        int p = 0;
        for(p=0; p<ans.size(); p++) {
            if (a[i][j] == ans[p].second) {
                ans[p].first++;
                break;
            }
        }
        if (p==ans.size() && (a[i][j].first != 0 || a[i][j].second != 0)) {
            ans.push_back(make_pair(1, a[i][j]));
        }
    }
    int m = 0;
    REP(i, ans.size()) {
        m = max(m, ans[i].first);
        //cout << ans[i].first << endl;
    }
    if (n-m <= 0) cout << 1 << endl;
    else cout << n-m << endl;
    return 0;
}

Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define lvector vector<ll> 
#define P pair<ll,ll>
#define rep(i,n) for(ll (i)=0; i<(n); ++(i))
#define print(a) cout << (a) << endl

int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  ll n,m,ans=0;cin>>n>>m;
  if(m/n<=1e8) {
    for(ll i=1;i<=m/n;++i) if(m%i==0&&m/i>=n) ans=i;
  }
  else {
    for(ll i=n;i<=m;++i) if(m%i==0) {ans=m/i;break;} 
  }
  print(ans);
  return 0;
}


Measured memory_bytes: 256
n = int(input())
s = [sorted(input()) for _ in range(n)]
sorted_s = sorted(s)

num = 0
num_same = 1
prev = sorted_s[0]
for i in range(1, len(sorted_s)):
    if prev != sorted_s[i]:
        num += int(num_same * (num_same - 1) / 2)
        num_same = 1
        prev = sorted_s[i]
    else:
        num_same += 1
num += int(num_same * (num_same - 1) / 2)
print(num)


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

int main(){
    int n;
    string s, t;
    cin >> n >> s >> t;

    for(int i=0; i<=n; i++){
        string test = s.substr(0,i) + t;
        //cout << test << endl;
        if(test.substr(0,n) == s){
            cout << test.length() << endl;
            return 0;
        }
    }
    return 0;
}

Measured memory_bytes: 3636
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long; 
using pii =  pair<int, int>;
using pll =  pair<long long, long long>;
#define rep(i, n) for(int i = 0; i < (n); ++i)
#define all(x) (x).begin(),(x).end()
constexpr char ln =  '\n';
constexpr long long MOD = 1000000007LL;
//constexpr long long MOD = 998244353LL;
template<class T, class U> inline bool chmax(T &a, U b) { if (a < b) { a = b; return true;} return false; }
template<class T, class U> inline bool chmin(T &a, U b) { if (a > b) { a = b; return true;} return false; }
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
 
int main() {
    ios::sync_with_stdio(false); cin.tie(nullptr);
    
    ll N,K; cin >> N >> K;
    vector<ll> A;
    rep(i, N) {
        int a; cin >> a;
        A.push_back(a);
    }
    
    ll cnt = 0;
    ll width = 1;
    
    while(N > width){
        width += K-1;
        cnt++;
    }
    
    cout << cnt << ln;
    return 0;
}

Measured memory_bytes: 1400
#include <iostream>
using namespace std;
int main(void){
    int N;
    cin >> N;
    int a[N];
    for(int i=0;i<N;i++){
        cin >> a[i];
    }
    int ans = 0;
    for(int i=0;i<N;i++){
        while(a[i] % 2 == 0){
            ans++;
            a[i] = a[i] / 2;
        }
    }
    
    cout << ans << endl;
}


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

typedef unsigned long long ll;

ll md = 1000000007;

int main(int, char**)
{
	int n, ans = 0;
	cin >> n;
	vector<int> p(n);
	for (int i = 0; i < n; ++i)
		cin >> p[i];

	for (int i = 1; i < n - 1; ++i)
		if (p[i-1] < p[i] && p[i] < p[i+1])
			++ans;
		else if (p[i-1] > p[i] && p[i] > p[i+1])
			++ans;

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


Measured memory_bytes: 256
k, n = map(int, input().split())
home_positions = list(map(int, input().split()))


def max_distance_homes(homes):
    max_distance = 0
    for i in range(len(homes) - 1):
        distance = homes[i + 1] - homes[i]
        if max_distance < distance:
            max_distance = distance
    distance = min(homes[-1] - homes[0], k + homes[0] - homes[-1])
    if max_distance < distance:
        max_distance = distance
    return max_distance


print(k - max_distance_homes(home_positions))

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

int main()
{
  stack<int> skiCalc;
  string sCalc;
  
  while (cin >> sCalc)
  {
    if (sCalc == "+" || sCalc == "-" || sCalc == "*")
    {
      int iNum1 = skiCalc.top(); skiCalc.pop();
      int iNum2 = skiCalc.top(); skiCalc.pop();
      int iReslt;
      if      (sCalc == "+")
        iReslt = iNum2 + iNum1;
      else if (sCalc == "-")
        iReslt = iNum2 - iNum1;
      else if (sCalc == "*")
        iReslt = iNum2 * iNum1;
      else;
      
      skiCalc.push(iReslt);
    }
    else
    {
      int iNum = stoi(sCalc);
      skiCalc.push(iNum);
    }
  }

  cout << skiCalc.top() << endl;
  skiCalc.pop();

  return 0;
}

Measured memory_bytes: 1204
#include <stdio.h>
#define rep(i,n) for(int i=0;i<n;i++)
int main() {
    int N;
    scanf("%d", &N);
    int a[N]={};
    rep(i,N){
        scanf("%d", &a[i]);
    }
    int cnt=0;
    rep(i,N){
        while(a[i]!=0){
            if(a[i]%2==0){
                a[i]=a[i]/2;
                cnt++;
            }else{
                break;
            }
        }
    }

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

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

int N,sum, tmp;
vector<int> d = {};


int main(){
  
  cin >> N;
  for(int i=0;i<N;i++){
    cin >> tmp;
    d.push_back(tmp);
  }

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

  sum=1;
  for(int i=1;i<N;i++)
    if(d.at(i) != d.at(i-1))
      sum++;

  cout << sum << endl;

  return 0;
}


Measured memory_bytes: 3576
n, m = map(int, input().split())
p = []
s = []

for i in range(m):
    v1, v2 = input().split()
    p.append(int(v1))
    s.append(v2)

# print(p, s)

acSet = set()
acCnt = 0
waCnt = 0
waTempMap = [0]*(n+1)

for i in range(m):
    prob = p[i]
    res = s[i]

    if res == 'AC':
       if prob not in acSet:
           acSet.add(prob)
           acCnt += 1
           waCnt += waTempMap[prob]
    else:
        waTempMap[prob] += 1
        # waCnt += 1

print(acCnt, waCnt)

Measured memory_bytes: 66392
#include<cstdio>
#define fo(i,a,b) for(int i=a;i<=b;i++)
using namespace std;

const int maxn=2e5+5;

int n,a[maxn],num[maxn];

int ans,cov[maxn];
void ADD(int x)
{
	if (x<=0) return;
	if (++cov[x]==1) ans++;
}
void DEC(int x)
{
	if (x<=0) return;
	if (--cov[x]==0) ans--;
}

int m;
int main()
{
	scanf("%d %d",&n,&m);
	fo(i,1,n)
	{
		scanf("%d",&a[i]);
		num[a[i]]++;
		ADD(a[i]-num[a[i]]+1);
	}
	
	while (m--)
	{
		int x,y;
		scanf("%d %d",&x,&y);
		
		DEC(a[x]-num[a[x]]+1);
		num[a[x]]--;
		num[y]++;
		ADD(y-num[y]+1);
		a[x]=y;
		
		printf("%d\n",n-ans);
	}
}

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

typedef long long ll;

int main() {
	string s; cin >> s;
	bool ans=false;
	for (int i = 0; i < s.length() - 1; i++) {
		if(s[i]=='A' && s[i+1]=='C') ans=true;
	}
	cout << (ans?"Yes":"No") << endl;
}

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


def solve(N: int, B: "List[int]"):
    A = [0] * (N)
    A[0] = B[0]
    A[1] = B[0]
    for i in range(1,N-1):
        A[i] = min(A[i], B[i])
        A[i+1] = B[i]

    print(sum(A))
    return


# Generated by 1.1.5 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    B = [int(next(tokens)) for _ in range(N - 1)]  # type: "List[int]"
    solve(N, B)

if __name__ == '__main__':
    main()


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

#define INF (2e9)
#define FOR(i, a, b) for (ll (i) = (a); (i) < (b); ++(i))
#define REP(i, n) FOR(i, 0, n)

using namespace std;

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

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

using ll = long long;
using ld = long double;

#define ALL(x) (x).begin(), (x).end()
template<class T>
using vc = vector<T>;
using vi = vc<ll>;
using vvi = vc<vi>;

template<class T>
using va = valarray<T>;
using vad = va<ld>;
using vai = va<ll>;

using pii = pair<ll, ll>;

vi Read(ll n) {
    auto      v = vi(n);
    for (auto i = std::size_t(0); i < n; ++i) {
        cin >> v[i];
    }
    return v;
}

template<class T>
void DumpRow(const T& A) {
    for (const auto& value : A)
        cout << value << "\n";
}

template<class T>
void DumpColumn(const T& A) {
    auto isFirst = true;
    for (const auto& value : A) {
        if (isFirst) {
            cout << value;
            isFirst = false;
        } else {
            cout << " " << value;
        }

    }
    cout << endl;
}

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

    int n;
    cin >> n;
    const auto a = Read(n);

    int ans = 1;
    int count = 1;
    REP(i, n - 1){
        if (a[i] == 1) ++count;
        if (a[i + 1] == 0){
            chmax(ans, count);
            count = 1;
        }
    }
    if (a[n-1] == 1) ++count;
    chmax(ans, count);

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



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

void solve(){
  int a[3];
  cin >> a[0] >> a[1] >> a[2];
  int sum = 0;
  sum = a[0] + a[1] + a[2];
  if(sum == 17 && (a[0] == 5 || a[0] == 7) && (a[0] + a[1] == 10 || a[0] + a[1] == 12))
  {
    cout << "YES" << endl;
  } else {
    cout << "NO" << endl;
  }
}

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


Measured memory_bytes: 3604
#include<iostream>
#include<sstream>
#include<algorithm>
#include<set>
#include<map>
#include<queue>
#include<complex>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cassert>

#define rep(i,n) for(int i=0;i<(int)n;i++)
#define all(c) (c).begin(),(c).end()
#define mp make_pair
#define pb push_back
#define each(i,c) for(__typeof((c).begin()) i=(c).begin();i!=(c).end();i++)
#define dbg(x) cerr<<__LINE__<<": "<<#x<<" = "<<(x)<<endl

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> pi;
const int inf = (int)1e9;
const double INF = 1e12, EPS = 1e-9;

int n, m, p[100000], w[1000000];
set<int> s[100000];
int root(int x){
	if(x == p[x]) return x;
	return p[x] = root(p[x]);
}
int main(){
	while(scanf("%d%d", &n, &m), n){
		rep(i, n) s[i].clear(), s[i].insert(i);
		rep(i, n) p[i] = i, w[i] = 0;
		rep(i, m){
			char c;
			int a, b, x;
			scanf(" %c%d%d", &c, &a, &b);
			a--; b--;
			if(c == '!'){
				scanf("%d", &x);
				int ra = root(a), rb = root(b);
				if(ra == rb) continue;
				if(s[ra].size() > s[rb].size()){
					swap(ra, rb);
					swap(a, b);
					x *= -1;
				}
				p[ra] = rb;
				x += w[a] - w[b];
				each(i, s[ra]){
					s[rb].insert(*i);
					w[*i] -= x;
				}
			}
			else{
				if(root(a) != root(b)) puts("UNKNOWN");
				else printf("%d\n", w[b] - w[a]);
			}
		}
	}
	return 0;
}

Measured memory_bytes: 15540
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
using namespace std;

int main(){
    int X;
    cin >> X;
    if (X == 3 || X == 5 || X == 7)
        cout << "YES" << endl;
    else
        cout << "NO" << endl;
        
    return 0;
}

Measured memory_bytes: 256
using System;
using System.Linq;
using System.Collections;
using System.Collections.Generic;

class Program
{
    static bool isOdd(int a)
    {
        return ((a & 1) == 0) ? false : true;
    }
    public static void Main()
    {
        int N = int.Parse(Console.ReadLine());
        var s = Console.ReadLine().Split(' ');
        int[] a = new int[N];
        for (int i = 0; i < N; i++)
            a[i] = int.Parse(s[i]);
        int ctr=0;
        while (true)
        {
            bool OddOnly = true;
            for (int i = 0; i < N; i++)
            {
                if (!isOdd(a[i]))
                {
                    OddOnly = false;
                    break;
                }
            }
            if (OddOnly)
                break;
            for (int i = 0; i < N; i++)
            {
                while ((a[i] & 1) == 0)
                {
                    a[i] >>= 1;
                    ctr++;
                }
            }
        }
        Console.WriteLine(ctr);
    }
}

Measured memory_bytes: 11744
#include <stdio.h>

int main(void)
{
  char S[101];
  int N;
  int x = 0;
  int max = 0;
  int i;
  
  scanf("%d", &N);
  scanf("%s", &S);

  for(i = 0; i < N; i++) {
    if(S[i] == 'I') {
      x += 1;
      if(x > max) {
	max = x;
      }
    } else {
      x -= 1;
    }
  }

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


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

#define int long long
#define pii pair<int, int>
#define pb push_back
#define vi vector<int>

signed main() {
    ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
    int n;
    cin >> n;
    int a[n];
    for(int i = 0; i < n; i++) {
        cin >> a[i];
    }
    sort(a, a + n);
    int ans = 0;
    int count = 2;
    ans = a[n - 1];
    for(int i = n - 2; i >= 0 and count < n; i--) {
        if(count != n) {
            ans += a[i];
            count++;
        }
        if(count != n) {
            ans += a[i];
            count++;
        }
    }
    cout << ans << endl;

    return 0;
}



Measured memory_bytes: 5176
#include <iostream>
#include <string>
#include <vector>
#include <math.h>
#include <stdio.h>
#include <algorithm>
#include <utility>
#include <functional>
#include <map>
#include <queue>
#include <list>
#define rep(i,n) for(int i=0;i<(n);i++)
#define REP(i,a,b) for(int i=int(a);i<int(b);++i)
#define crep(i) for(char i='a';i<='z';i++)
#define psortsecond(A,N) sort(A,A+N,[](const pii &a, const pii &b){return a.second<b.second;});
#define psortfirst(A,N) sort(A,A+N,[](const pii &a, const pii &b){return a.first<b.first;});
#define ALL(x) (x).begin(),(x).end()
int ctoi(const char c){
  if('0' <= c && c <= '9') return (c-'0');
  return -1;
}
using namespace std;
using pii  = pair<int,int>;
long long gcd(long long a, long long b){return (b == 0 ? a : gcd(b, a%b));}
long long lcm(long long a, long long b){return a*b/gcd(a,b);}
typedef long long ll;
#define MOD 1000000007
#define EPS 10e-8

map<double,ll> mizu,sato;

int main(){
  double A,B,C,D,E,F,anssugar=0,anssum=0;
  cin >> A >> B >> C >> D >> E >> F;
  double noudo=0.0;
  vector<double> water,sugar;
  for(int i=0;i<=F;i+=A*100){
    for(int j=0;j<=F-i;j+=B*100){
      if(mizu[i+j]==0){
        mizu[i+j]=1;
        water.push_back(i+j);
      }
    }
  }
  for(int i=0;i<=F;i+=C){
    for(int j=0;j<=F-i;j+=D){
      if(sato[i+j]!=1){
        sato[i+j]=1;
        sugar.push_back(i+j);
      }
    }
  }
  ll t=0;
  sort(ALL(water));
  sort(ALL(sugar));
  REP(i,0,sugar.size()){
    REP(j,1,water.size()){
      if(sugar[i]+water[j]>F){
        break;
      }
      if(100*sugar[i]/(water[j]+sugar[i])<=E*100/(100+E)){
        if(noudo<=100*sugar[i]/(water[j]+sugar[i])){
          noudo=100*sugar[i]/(water[j]+sugar[i]);
          anssugar=sugar[i];
          anssum=water[j]+sugar[i];
          break;
        }
      }
    }
    if(t==1){
      break;
    }
  }
  cout << anssum  << " " <<anssugar<< endl;
}

Measured memory_bytes: 512
#include <iostream>
#include <string>
#include <cstring>
#include <algorithm>
#include <functional>
#include <cmath>
#include <set>
#include <queue>
#include <vector>
#include <climits>
#include <sstream>
#include <iomanip>
#include <map>
using namespace std;

void getPrime(int N, vector<int>& list)
{
	vector<bool> isPrime(N + 1, true);

	for (auto i = 2; i <= N; ++i)
	{
		if (isPrime[i])
		{
			list.push_back(i);
			for (auto j = 2; i * j <= N; ++j)
			{
				isPrime[i * j] = false;
			}
		}
	}
}

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

	vector<int> list;
	getPrime(55555, list);

	auto count = 0;
	for (auto i = 0; i < list.size(); ++i)
	{
		if (list[i] % 5 == 1)
		{
			if (count > 0)
			{
				cout << " ";
			}
			cout << list[i];
			++count;

			if (count >= N)
			{
				break;
			}
		}
	}

	cout << endl;

	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define ll long long
int main(){
    ll n,ans;
    cin >> n;
    n--;
    if(n%2 == 0){
        ll kakeru = n/2;
        ans = (n+1)*kakeru;
    }
    else{
        ll kakeru = n/2;
        ans = (n+1)*kakeru + n/2+1;
    }
    cout << ans <<endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h> 
using namespace std;
typedef long long ll;
template<typename T1,typename T2> bool chmin(T1 &a,T2 b){if(a<=b)return 0; a=b; return 1;}
template<typename T1,typename T2> bool chmax(T1 &a,T2 b){if(a>=b)return 0; a=b; return 1;}




signed main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << fixed << setprecision(20);
 
    int s,t;
    cin>>s>>t;
    if(t >= s){
        cout << "unsafe"<<endl;
    }
    else cout << "safe"<<endl;
}

Measured memory_bytes: 3652
import java.util.*;
import static java.lang.System.*;

public class Main {

	Scanner sc = new Scanner(in);
	
	void run() {
		int n, m;
		n = Integer.parseInt(sc.nextLine());
		Set<String> id = new HashSet<String>();
		for (int i = 0; i < n; i++)
			id.add(sc.nextLine());
		m = Integer.parseInt(sc.nextLine());
		boolean state = false;
		for (int i = 0; i < m; i++) {
			String s = sc.nextLine();
			if (!id.contains(s)) {
				out.printf("Unknown %s\n", s);
			} else {
				if (state)
					out.printf("Closed by %s\n", s);
				else
					out.printf("Opened by %s\n", s);
				state = !state;
			}
		}
	}
	
	public static void main(String[] args) {
		new Main().run();
	}

}

Measured memory_bytes: 23284
#include <iostream>
#include <algorithm>
#include <bits/stdc++.h>
/* run this program using the console pauser or add your own getch, system("pause") or input loop */
using namespace std;

int n,cnt=0;
void dfs(long long num, unsigned char flag)
{
	if(num<=n)
	{
		if(flag==07)
		 cnt++;
		 
		 
		 dfs(num*10+3,flag|01);
		 
		 dfs(num*10+5,flag|02);
		
		 dfs(num*10+7,flag|04);
	}
}
int main(int argc, char** argv) {
	
    cin>>n;
    dfs(0,0);
    
    printf("%d",cnt);
	
	return 0;
}

Measured memory_bytes: 256
import bisect, collections, copy, heapq, itertools, math, string
import sys
def I(): return int(sys.stdin.readline().rstrip())
def MI(): return map(int, sys.stdin.readline().rstrip().split())
def LI(): return list(map(int, sys.stdin.readline().rstrip().split()))
def S(): return sys.stdin.readline().rstrip()
def LS(): return list(sys.stdin.readline().rstrip().split())

N = I()
cnt = 0
for i in range(1,N + 1):
    if i % 3 != 0 and i % 5 != 0:
        cnt += i
print(cnt)

Measured memory_bytes: 74744
// std::set
#include <iostream>
#include <set>
using namespace std;

int main()
{
  int N;
  int d[110];
  cin >> N;
  for (int i = 0; i < N; i++)
    cin >> d[i];
  set<int> values;
  for (int i = 0; i < N; i++)
    values.insert(d[i]);
  cout << values.size() << endl;
}

Measured memory_bytes: 256
#include<stdio.h>

bool prime[1000001];
bool money[1000001];
int mono[31];
int n,x;

void func(int now){
	for(int i = 0; i < n; i++){
		if(now+mono[i] <= x){
			money[now+mono[i]] = 1;
		}
	}
}

int main(void){
	prime[0] = prime[1] = 1;
	for(int i = 2; i < 1000000; i++){
		if(prime[i])continue;
		for(int j = i * 2; j < 1000000; j+=i){
			prime[j] = 1;
		}
	}
	while(scanf("%d%d", &n, &x) && n && x){
		int ans = -1; 
		for(int i = 0; i < n; i++){
			scanf("%d", &mono[i]);
		}
		money[0] = 1;
		for(int i = 0; i <= x; i++){
			if(money[i])func(i);
		}
		for(int i = x; i >= 0; i--){
			if(!prime[i] && money[i]){
				ans = i;
				break;
			}
		}
		if(ans == -1){
			puts("NA");
		}else {
			printf("%d\n",ans);
		}
		
		/*ツ渉可甘コツ可サ*/
		for(int i = 0; i < 1000001; i++){
			money[i] = 0;
		}
		for(int i = 0; i < 31; i++){
			mono[i] = 0;
		}
	}
}

Measured memory_bytes: 2712
#include<iostream>
#define SIZE 200000
using namespace std;
 
struct Queue{
  int table[SIZE];
  int tail,head;
 
  void init(){
    head=tail=0;
  }
 
  bool empty(){
    return head==tail;
  }
   
  void inqueue(int x){
    table[tail]=x;
    tail++;
    tail%=SIZE;
  }
 
  int dequeue(){
    if(empty())return 0;
    int res=table[head];
    head++;
    head%=SIZE;
    return res;
  }
};
 
int main(){
  Queue queue,queue2;
  int n,q,num;
  string table[SIZE];
  cin>>n>>q;
  queue.init();
  queue2.init();
  for(int i=0;i<n;i++){
    cin>>table[i]>>num;
    queue.inqueue(num);
    queue2.inqueue(i);
  }
   
  int now=0,A,B;
  while(!queue.empty()){
    A=queue.dequeue();
    B=queue2.dequeue();
    if(A<=q){
      now+=A;
      cout<<table[B]<<' '<<now<<endl;
    }else{
      now+=q;
      A-=q;
      queue.inqueue(A);
      queue2.inqueue(B);
    }
  }
   
  return 0;
}



Measured memory_bytes: 8456
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#define max(a, b)	(((a) > (b)) ? (a) : (b))		/* ２個の値の最大値 */
#define min(a, b)	(((a) < (b)) ? (a) : (b))		/* ２個の値の最小値 */
#define ENTER		printf("\n")					/* 改行プリント */
/********************************************************************************************************************************/
/* main *************************************************************************************************************************/
/********************************************************************************************************************************/
int DEBUG = 1;										/* デバッグプリント 提出時は0 */
int main()
{
	int		i,j,n,m,x[2020]={0},ans = 0;
	int		k[101] = {0};
	
	scanf("%d", &n);
	for(i=1;i<=n;i++) {
		scanf("%d", &j);
		x[j] = 1;
		k[i] = j;
	}
	scanf("%d", &m);
	for(j=0;j<m;j++) {
		scanf("%d", &i);
		if ((k[i] != 2019)&&(x[k[i]+1]==0)) {
			x[k[i]] = 0;
			x[k[i]+1] = 1;
			k[i]++;
		}
	}
	for(i=1;i<=n;i++) {
		printf("%d\n",k[i]);
	}

	return 0;
}



Measured memory_bytes: 2052
N, K = [int(i) for i in input().split()]
H = [int(i) for i in input().split()]

dp = [float('inf')] * N
dp[0] = 0
for i in range(1, N):
    for j in range(1, K + 1):
        if i - j < 0:
            break
        dp[i] = min(dp[i], dp[i - j] + abs(H[i] - H[i - j]))
print(dp[N - 1])

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

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

const int INF = 100000000;
const double PI=acos(-1);

bool comp(P p1, P p2){
    if (p1.first != p2.first) {
        return p1.first < p2.first;
    }
    else if (p1.second != p2.second) {
        return p1.second > p2.second;
    }
    else {
        return true;
    }
}


int main () {
    ll N, M;
    cin >> N >> M;
    vector<ll> A(N);
    map<ll,ll> S;
    rep(i,N) {
        cin >> A[i];
    }
    rep(i,M) {
        ll b,c;
        cin >> b >> c;
        if (!S.count(c)) {
            S[c] = b;
        }
        else {
            S[c] += b;
        }
    }

    sort(A.begin(),A.end());
    
    rep(i,A.size()) {
        auto iter = S.end();
        iter--;
        if (A[i]<iter->first) {
            A[i] = iter->first;
            iter->second --;
            if (iter->second==0) {
                S.erase(iter->first);
                if (S.size()==0) {
                    break;
                }
            }
        }     
    }
    ll ans = 0;
    rep(i,A.size()) {
        ans += A[i];
    }

    cout << ans << endl;

}


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

    int l = S.size(), ans = 0;
    for(int i=1;i<l;i++){
        if(S[i] == S[i-1]){
            if(S[i-1] == '0')
                S[i] = '1';
            else
                S[i] = '0';
            ans++; 
        }
    }
    
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 512
#define _USE_NATH_DEFINES
#include <cstdio>
#include <iostream>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <complex>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <limits>
#include <climits>
#include <cfloat>
#include <functional>
#include <iterator>
#include <random>
#include <tuple>


using namespace std;
#define REP(i,m,n) for(int i=(int)m ; i < (int) n ; ++i )
#define rep(i,n) REP(i,0,n)
using ll = long long;
#define EPS 1e-9
const int INF = 1050000000;
const long long LINF = 1LL << 60;
const ll MOD = 1e9 + 7;
const int MINF = -1050000000;

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; }



int main() {
	ll n, a, b;
	cin >> n >> a >> b;
	ll cnt, amari;
	cnt = n / (a + b);
	amari = n % (a + b);
	if (n % (a + b) == 0) {
		cout << a * cnt << endl;
		return 0;
	}
	if (amari > a) {
		cout << a * cnt + a << endl;
	}
	else {
		cout << a * cnt + amari << endl;
	}
	return 0;
}


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

using namespace std;

long A[100000];
long sum_all[100001];
long sum_odd[100001];
long sum_even[100001];

int main(){
    int N, Q;
    cin >> N >> Q;
    for(int i = 0; i < N; i++) {
        cin >> A[i];
        sum_all[i+1] = sum_all[i]+A[i];
        if(i == 0) sum_even[0] = A[0];
        if(i%2 == 0 && i-2 >= 0) sum_even[i] = sum_even[i-2]+A[i];
        if(i == 1) sum_odd[1] = A[1];
        if(i%2 == 1 && i-2 >= 0) sum_odd[i] = sum_odd[i-2]+A[i];
    }
    for(int i = 0; i < Q; i++) {
        long X;
        cin >> X;
        long l = 1; long r = N;
        while(r-l > 1){
            long c = (l+r)/2;
            long n = A[N-c];
            long *p = lower_bound(A, A+N, 2*X-n);
            if(&A[N-c]-p >= c-1) l = c;
            else r = c;
        }
        //cout << l << ' ' << N-2*l-1 << endl;
        long ans = sum_all[N]-sum_all[N-l];
        if(N-2*l-1 >= 0){
            if(N%2 == 0) ans += sum_odd[N-2*l-1];
            else ans += sum_even[N-2*l-1];
        }
        cout << ans << endl;
    }
}

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

int main() {
  int a,b;
  cin>>a>>b;
  if(a==1)a+=19;
  if(b==1)b+=19;
  if(a>b)cout<<"Alice"<<endl;
  if(a==b)cout<<"Draw"<<endl;
  if(a<b)cout<<"Bob"<<endl;
}


Measured memory_bytes: 256
function main(_stdin) {
    const stdin = _stdin.trim().split('\n');
    const n = Number(stdin.shift());
    const T = [];
    for (let i = 0; i < n; i++) {
        T.push({ parent: null, left: null, right: null });
    }
    for (let line of stdin) {
        const [id, left, right] = line.split(' ').map(Number);
        if(left > -1) {
            T[left].parent = id;
        }
        if(right > -1) {
            T[right].parent = id;
        }
        T[id].left = left;
        T[id].right = right;
    }


    for (let i = 0, l = T.length; i < l; i++) {
        const sibling = getSib(i, T);
        const degree = T[i].left > -1 && T[i].right > -1 ? 2 : T[i].left < 0 && T[i].right < 0 ? 0 : 1;
        const depth = getDepth(i, T);
        const height = getHeight(i, T);
        const type = T[i].parent === null ? 'root' : T[i].left < 0 && T[i].right < 0 ? 'leaf' : 'internal node';

        console.log(`node ${i}: parent = ${T[i].parent === null ? -1 : T[i].parent}, sibling = ${sibling}, degree = ${degree}, depth = ${depth}, height = ${height}, ${type}`);
    }
}

function getSib(id, T) {
    if (T[id].parent === null) return -1;
    const pid = T[id].parent;
    return T[pid].left === id ? T[pid].right : T[pid].left;
}

function getDepth(id, T) {
    let depth = 0;
    while(T[id].parent !== null) {
        depth += 1;
        id = T[id].parent;
    }
    return depth;
}

function getHeight(id, T) {
    let lefth = 0;
    let righth = 0;
    if(T[id].left > -1) {
        lefth = getHeight(T[id].left, T) + 1;
    }
    if(T[id].right > -1) {
        righth = getHeight(T[id].right, T) + 1;
    }
    return Math.max(lefth, righth);
}


main(require('fs').readFileSync('/dev/stdin', 'utf8'));



Measured memory_bytes: 15416
/*#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<cmath>
#include<map>
#include<cstdio>
#include<stack>
#include<queue>
#include<fstream>
#include<cstdio>
#include<deque>
#include<iomanip>
#include <random>

using namespace std;
#define ok1 printf("ok1\n");
#define ok2 printf("ok2\n");
#define M 1000000000000000000LL
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,s,n) for(int i=(s);i<(n);i++)
#define repr(i,n) for(int i=n-1;i>=0;i--)
#define REPR(i,s,n) for(int i=(s);i>=(n);(i)--)
#define all(a) (a).begin(),(a).end()
#define reall(a) (a).rbegin(),(a).rend()
#define pb push_back
#define pf push_front
#define MIN(a,b) a=min((a),(b))
#define MAX(a,b) a=max((a),(b))
#define SIZE(v) (int)v.size()
const double pi = acos(-1.0);

typedef vector<int> vi;
typedef vector<string> vs;
typedef long long ll;
typedef vector<ll> vll;
typedef vector<vi> vvi;
typedef deque<ll> dll;
#define mod 1e9 + 7;

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(nullptr);
	cout.tie(nullptr);
	cout.setf(ios::fixed);
	cout.precision(20);

	vs v;
	string s1, s2;
	vs cs1, cs2;
	while (true) {
		cin >> s1;
		if (s1 == ".") break;
		cin >> s2;
		ll sum = 0;
		if (s1 == s2) v.pb("IDENTICAL");
		else {
			rep(i, s1.size()) {
				rep(j, s1.size()) {
					if (i != j && s1[i] == '"' && s1[j] == '"') {
						cs1.pb(s1.substr(i + 1, j - 1));
						s1[i] = '0'; s1[j] = '0';
					}

				}
			}
			rep(i, s2.size()) {
				rep(j, s2.size()) {
					if (i != j && s2[i] == '"' && s2[j] == '"') {
						cs2.pb(s2.substr(i + 1, j - 1));
						s2[i] = '0'; s2[j] = '0';
					}

				}
			}
			rep(i, cs1.size()) {
				cout << cs1[i] << " " << cs2[i] << endl;
				if (cs1[i] != cs2[i]) sum++;
				if (sum == 2) break;
			}
			if (sum == 1) v.pb("CLOSE");
			else v.pb("DIFFERENT");
		}
	}
	rep(i, v.size()) cout << v[i] << endl;
	return 0;
}*/
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<cmath>
#include<map>
#include<cstdio>
#include<stack>
#include<queue>
#include<fstream>
#include<cstdio>
#include<deque>
#include<iomanip>

using namespace std;
#define ok1 printf("ok1\n");
#define ok2 printf("ok2\n");
#define M 1000000000000000000LL
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,s,n) for(int i=(s);i<(n);i++)
#define repr(i,n) for(int i=n-1;i>=0;i--)
#define REPR(i,s,n) for(int i=(s);i>=(n);(i)--)
#define all(a) (a).begin(),(a).end()
#define reall(a) (a).rbegin(),(a).rend()
#define pb push_back
#define pf push_front
#define MIN(a,b) a=min((a),(b))
#define MAX(a,b) a=max((a),(b))
#define SIZE(v) (int)v.size()
const double pi = acos(-1.0);

typedef vector<int> vi;
typedef vector<string> vs;
typedef long long ll;
typedef vector<ll> vll;
typedef vector<vi> vvi;
typedef deque<ll> dll;
#define mod 1e9 + 7;

int main()
{
	ios_base::sync_with_stdio(false);

	int h, w;
	cin >> h >> w;
	if (h*w == 15)cout << "*" << endl;
	else if (h + w == 15) cout << "+";
	else cout << "x";
	return 0;
}


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

using namespace std;

int get_ans(string s, char c) {
  if (all_of(s.begin(), s.end(), [&](char c0) {
    return c0 == c;
  })) {
    return 0;
  }
  
  string nxt;
  for (int i = 0; i < s.size() - 1; i++) {
    if (s[i] == c || s[i+1] == c)
      nxt += c;
    else
      nxt += s[i];
  }
  
  return get_ans(nxt, c) + 1;
}

int get_ans(string s) {
  int ans = 1e9;
  for (char c = 'a'; c <= 'z'; c++) {
    ans = min(ans, get_ans(s, c));
  }
  return ans;
}

int main() {
  char s[1000];
  scanf("%s", s);
  printf("%d\n", get_ans(s));
}

Measured memory_bytes: 256
//  Created by conan1024hao in 2019.
//  Copyright © 2019 conan1024hao. All rights reserved.
//  専用ライブラリです、自由にコピーして構いません。
//  感谢看我的代码！Wechat:conan1024hao QQ:810396815
#pragma GCC optimize ("O3")
#include <iostream>
#include <iomanip>
#include <istream>
#include <ostream>
#include <sstream>
#include <iterator>
#include <vector>
#include <algorithm>
#include <queue>
#include <deque>
#include <list>
#include <stack>
#include <map>
#include <set>
#include <utility>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <string>
#include <ctime>
#include <cctype>
#include <cstdlib>
#define INF 10e16
#define MOD 1000000007
#define rep(i, a, n) for (ll i = a; i < (ll)(n); i++)
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define mmax(x,y)(x>y?x:y)
#define mmin(x,y)(x<y?x:y)
#define chmax(x,y) x=mmax(x,y)
#define chmin(x,y) x=mmin(x,y)
#define all(x) (x).begin(),(x).end()
#define siz(x) (ll)(x).size()
#define PI acos(-1.0)
using namespace std;
using Int=int_fast64_t;
typedef long long int ll;
typedef pair<ll,ll>Pll;
typedef pair<int,int>Pin;
long long GCD(long long a, long long b) { return b ? GCD(b, a%b) : a; }
long long LCM(long long a, long long b)  {return a/GCD(a,b)*b;}
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
ll cmp(pair<ll,string>a,pair<ll,string> b){
        if(a.fi!=b.fi)
        return a.fi<b.fi;
        else
        return a.se<b.se;
}

//---------------------------------------------------------------------------

//---------------------------------------------------------------------------
int main(){//問題をちゃんと見ろ!!!!!!!!!!!!!!!!!      llか??????????
    cin.tie(0);
    ios::sync_with_stdio(false);
    //-------------------------------
    string s,t;cin>>s>>t;
    sort(all(s));sort(all(t));reverse(all(t));
    if(t>s)
        cout<<"Yes"<<endl;
    else
        cout<<"No"<<endl;
    //-------------------------------
    return 0;
}
//---------------------------------------------------------------------------


Measured memory_bytes: 256