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

int main() {
  int n, m, c;
  cin >> n >> m >> c;
  int a[n][m], b[m];
  for ( int i = 0; i < m; i++ ) { cin >> b[i]; }
  for ( int i = 0; i < n; i++ ) {
    for ( int j = 0; j < m; j++ ) {
      cin >> a[i][j];
    }
  }

  int ans = 0;
  for ( int i = 0; i < n; i++ ) {
    int sm = 0;
    for ( int j = 0; j < m; j++ ) {
      sm += a[i][j]*b[j];
    }
    ans = ( sm+c > 0 ) ? ans+1 : ans;
  }

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


Measured memory_bytes: 256
from collections import deque
 
def bfs(maze, visited, sy, sx, gy, gx):
  queue = deque([[sy, sx]])
  visited[sy][sx] = 0
  while queue:
    y,x = queue.popleft()
    for j, k in ([1, 0], [-1, 0], [0, 1], [0, -1]):
      new_y, new_x = y+j, x+k
      if maze[new_y][new_x] == "." and visited[new_y][new_x] == -1:
        #　移動回数の計算
        visited[new_y][new_x] = visited[y][x] + 1
        queue.append([new_y, new_x])
  return visited[gy][gx]

h,w = map(int,input().split())
wall = ''
for i in range(w+2):
  wall += '#'
maze = [wall]
for i in range(h) :
  m1 = input()
  maze.append('#'+m1+'#')
maze .append(wall)

b_now = 0
for i in range(1,h+1) :
  for j in range(1,w+1) :
    if maze[i][j] == '#' :
      b_now += 1

visited = [[-1]*(w+2) for _ in range(h+2)]
cnt = bfs(maze, visited, 1, 1, h, w)
b_need = h*w - cnt - 1

if cnt == -1 :
  print(-1)
else :
  print(b_need-b_now)

Measured memory_bytes: 3316
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)
#define pb push_back
#define all(v) (v).begin(),(v).end()
#define fi first
#define se second
#define sz(x) ((int)(x).size())
using ll=long long;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
#define MOD  1000000007
const ll INF=1e18;
template<class T>void show(vector<T>v){for (int i = 0; i < v.size(); i++){cerr<<v[i]<<" ";}cerr<<endl;}
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b){ a = b; return 1; } return 0; }



int main(int argc, char const *argv[]) {
  int n;
  cin >> n;
  vector<string> s(n);
  rep(i,n) {
    cin >> s[i];
    sort(all(s[i]));
  }
  //show(s);
  map<string, ll> cnt;
  rep(i, n) cnt[s[i]]++;
  ll ans = 0;
  sort(all(s));
  s.erase(unique(s.begin(), s.end()), s.end());
  //show(s);
  for (auto mp: cnt){
    ans += mp.se * (mp.se - 1) / 2;
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 18176
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const double EPS = 1e-9;
typedef vector<int> vint;
typedef pair<int, int> pint;
#define rep(i, n) REP(i, 0, n)
#define ALL(v) v.begin(), v.end()
#define MSG(a) cout << #a << " " << a << endl;
#define REP(i, x, n) for(int i = x; i < n; i++)
template<class T, class C> void chmax(T& a, C b){ a>b?:a=b; }
template<class T, class C> void chmin(T& a, C b){ a<b?:a=b; }
int main(int argc, char* argv[]) {
    int a,b;
    cin >> a >> b;
    int a2=ceil(a/0.08);
    int b2=ceil(b/0.1);
    if(a2>b2) {
        if(a2*0.1>=b&&a2*0.1<b+1) cout << a2 << endl;
        else cout << "-1" << endl;
    }
    else if(a2==b2) cout << a2 << endl;
    else {
        if(b2*0.08>=a&&b2*0.08<a+1) cout << b2 << endl;
        else cout << "-1" << endl;
    }
    return 0;
}


Measured memory_bytes: 256
// AOJ
// ALDS1_1_A Insertion Sort

#include <iostream>
#include <string>

using namespace std;

int main()
{
	int N, i, j, v, k;
	cin >> N;
	int A[N];
	for (i=0; i<N; i++) {
		cin >> A[i];
	}

	for (i=0; i<N; i++) {
		cout << A[i];
		if (i!=N-1) {
			cout << " ";
		}
	}
	cout << endl;

	for (i=1; i<N; i++) {
		v = A[i];
		j = i - 1;
		while (j >= 0 && A[j] > v) {
			A[j+1] = A[j];
			j--;
		}
		A[j+1] = v;
		for(k=0; k<N; k++) {
			cout << A[k];
			if (k!=N-1) {
				cout << " ";
			}
		}
		cout << endl;
	}
}



Measured memory_bytes: 3104
#include<stdio.h>

int main()
{
    int a,b,i,j,f;
    scanf("%d %d",&a,&b);
    char s[a][b];
    for(i=0;i<a;i++)
    {
                scanf("\n");
        for(j=0;j<b;j++)
        {
            scanf("%c",&s[i][j]);
        }

    }
    for(i=0;i<a;i++)
    {
        for(j=0;j<b;j++)
        {
            if(s[i][j]=='.') f=1;
            else
            {
                f=0;
                break;
            }
        }
        if(f==1) {
             for(j=0;j<b;j++)
             {
                 s[i][j]='x';
             }
        }
    }
     for(j=0;j<b;j++)
    {
        for(i=0;i<a;i++)
        {
            if(s[i][j]=='.' || s[i][j]=='x') f=1;
            else
            {
                f=0;
                break;
            }
        }
        if(f==1) {
             for(i=0;i<a;i++)
             {
                 s[i][j]='x';
             }
        }
    }
    for(i=0;i<a;i++)
    {
        for(j=0;j<b;j++)
        {
            if(s[i][j]!='x') printf("%c",s[i][j]);
        }
        printf("\n");
    }
}


Measured memory_bytes: 128
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        int m = scanner.nextInt();
        int[][] edge = new int[m][3];
        long[][] cost = new long[n][n];
        ArrayList<Integer>[][] minEdgeList = new ArrayList[n][n];

        for (int i = 0; i < m; i++) {
            edge[i][0] = scanner.nextInt()-1;
            edge[i][1] = scanner.nextInt()-1;
            edge[i][2] = scanner.nextInt();
        }

        for (int i = 0; i < n; i++) {
            for (int j = 0; j < n; j++) {
                minEdgeList[i][j] = new ArrayList<>();
            }
            Arrays.fill(cost[i], Integer.MAX_VALUE);
        }

        for (int i = 0; i < n; i++) {
            cost[i][i] = 0;
        }

        // ベルマンフォード法？
        for (int startIndex = 0; startIndex < n; startIndex++) {
            while (true) {
                boolean isUpdated = false;
                for (int edgeIndex = 0; edgeIndex < m; edgeIndex++) {
                    int viaNode = edge[edgeIndex][0];
                    int targetNode = edge[edgeIndex][1];
                    int viaCost = edge[edgeIndex][2];
                    if (cost[startIndex][targetNode] > cost[startIndex][viaNode] + viaCost) {
                        isUpdated = true;
                        cost[startIndex][targetNode] = cost[startIndex][viaNode] + viaCost;
                        minEdgeList[startIndex][targetNode].clear();
                        minEdgeList[startIndex][targetNode].addAll(minEdgeList[startIndex][viaNode]);
                        minEdgeList[startIndex][targetNode].add(edgeIndex);
                    }
                    viaNode = edge[edgeIndex][1];
                    targetNode = edge[edgeIndex][0];
                    if (cost[startIndex][targetNode] > cost[startIndex][viaNode] + viaCost) {
                        isUpdated = true;
                        cost[startIndex][targetNode] = cost[startIndex][viaNode] + viaCost;
                        minEdgeList[startIndex][targetNode].clear();
                        minEdgeList[startIndex][targetNode].addAll(minEdgeList[startIndex][viaNode]);
                        minEdgeList[startIndex][targetNode].add(edgeIndex);
                    }
                }
                if(!isUpdated) {
                    break;
                }
            }
        }

        boolean[] used = new boolean[m];
        Arrays.fill(used, false);

        for (int i = 0; i < n; i++) {
            for (int j = 0; j < n; j++) {
                for (int edgeIndex : minEdgeList[i][j]) {
                    used[edgeIndex] = true;
                }
            }
        }

        int ans = 0;
        for (boolean isUsed : used) {
            if (!isUsed) ans++;
        }
        System.out.println(ans);
    }
}


Measured memory_bytes: 33564
#include <iostream>
#include <vector>
#include<cstdio>
#include<math.h>
using namespace std;

int main(void){
    long long l,min_l;
    int n,m,checkp;
    cin >> n >> m;
    long long a[n],b[n],c[m],d[m];
    for(int i=0;i<n;i++) scanf("%lld %lld",&a[i],&b[i]);
    for(int i=0;i<m;i++) scanf("%lld %lld",&c[i],&d[i]);

    for(int j=0;j<n;j++){
        min_l = abs(a[j]-c[0]) + abs(b[j]-d[0]);
        checkp=0;
        for(int i=1;i<m;i++){  
            l = abs(a[j]-c[i]) + abs(b[j]-d[i]);
            if(l<min_l) {
                min_l = l;
                checkp = i;
            }
        }
        cout<<checkp+1<<endl;
    }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define itn int
#define nibu(K,x) binary_search(K.begin(),K.end(),x)
#define rep(i,n) for(int i=0;i<n;i++)
#define all(x) x.begin(),x.end()
#define si(x) x.size()
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define out(x) cout<<x<<endl
#define in(x) cin>>x
#define maxx(a,b,c) max(a,max(b,c))
#define minn(a,b,c) min(a,min(b,c))
using ll = long long;
using pll = pair<ll,ll>;
using psi = pair<string,int>;
using pis = pair<int,string>;
using vl = vector<ll>;
using vs = vector<string>;


int main() {
	ll N,M;
  cin >> N >> M;
  vector<pll> K(N);
  rep(i,N){
   ll a,b;
    cin >> a >> b;
    K[i] = mp(a,b);
  }
  sort(all(K));
  ll ans =0;
  int i =0;
    bool f = true;
  while(f){
   if(M >= K[i].S){
    M -= K[i].S;
  
     ans += K[i].F * K[i].S;
     i++;
   }
    else{
      ans += K[i].F * M;
      f= false;
    }
  }
  out (ans);
}
  


Measured memory_bytes: 1792
#include <cstdio>
#include <cstring>
#include <vector>
#include <queue>
#include <string>
#include <algorithm>
#include <iostream>
#include <string>
#include <map>
#include <set>
#include <functional>
#include <iostream>
#define MOD 1000000007LL
using namespace std;
typedef long long ll;
typedef pair<int,int> P;

string data[4]={"dream","dreamer","erase","eraser"};
string str;

int main(void){
	cin >> str;
	int a=str.size();
	while(a>0){
		bool flag=false;
		if(a>=7 && str.substr(a-7,7)==data[1]){
			a-=7;
			flag=true;
		}else if(a>=6 && str.substr(a-6,6)==data[3]){
			a-=6;
			flag=true;
		}else if(a>=5 && str.substr(a-5,5)==data[0]){
			a-=5;
			flag=true;
		}else if(a>=5 && str.substr(a-5,5)==data[2]){
			a-=5;
			flag=true;
		}
		if(!flag)break;
	}
	printf("%s\n",a==0?"YES":"NO");
	return 0;
}


Measured memory_bytes: 512
#include<iostream>
#include <vector>
using namespace std;
     
int Merge(int A[],int left,int mid,int right){
  int n1=mid-left;
  int n2=right-mid;
  int i,j,k;
  int L[n1+1],R[n2+1];
       
  for(i=0;i<n1;i++)L[i]=A[left+i];
  for(i=0;i<n2;i++)R[i]=A[mid+i];
  L[n1]=1000000000;
  R[n2]=1000000000;
       
  i=j=0;
  for(k=left;k<right;k++){
    if(L[i]<=R[j]){
      A[k]=L[i];
      i++;
    }else{
      A[k]=R[j];
      j++;
    }
  }
  return right-left;
}
     
int Merge_Sort(int A[],int left,int right){
  int mid,res=0;
  if(left+1<right){
    mid=(left+right)/2;
     
    res+=Merge_Sort(A,left,mid);
    res+=Merge_Sort(A,mid,right);
    res+=Merge(A,left,mid,right);
         
  }
  return res;
}
  
int merge(vector<int> &vec, int left, int mid, int right) {
    int n1 = mid - left;
    int n2 = right - mid;
  
    vector<int> l(n1);
    for (int i = 0; i < n1; ++i) l[i] = vec[left + i];
  
    vector<int> r(n2);
    for (int i = 0; i < n2; ++i) r[i] = vec[mid + i];
  
    int i = 0, j = 0, k = left;
    while (i < n1 && j < n2) {
        if (l[i] <= r[j]) vec[k++] = l[i++];
        else              vec[k++] = r[j++];
    }
    while (i < n1) vec[k++] = l[i++];
    while (j < n2) vec[k++] = r[j++];
  
    return right - left;
}
  
int MergeSort(vector<int> &vec, int left, int right) {
    int res = 0;
    if (left + 1 < right) {
        int mid = (left + right) / 2;
        res += MergeSort(vec, left, mid);
        res += MergeSort(vec, mid, right);
        res += merge(vec, left, mid, right);
    }
  
    return res;
}
  
int main(){
  int i,x,n,S[500000]; 
  cin>>n;
  for(i=0;i<n;i++)cin>>S[i];
  
  vector<int> vec(S,S + n);
  MergeSort(vec, 0, vec.size());
     
  x=Merge_Sort(S,0,n);
       
  for(i=0;i<n;i++){
    if(i)cout<<" ";
    cout<<vec[i];
  }
  cout<<endl;
  cout<<x<<endl;
  return 0;
}


Measured memory_bytes: 8800
#include <bits/stdc++.h>
#define MAX_N 10000
#define INF 1e9

using namespace std;

typedef int long long ll;
typedef int long l;
typedef pair<int, int> Pii;
const ll MOD = 1000000007;


int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int k, a, b;
    cin >> k >> a >> b;
    bool flag = 0;

    if (b / k - a / k > 0 || a % k == 0) {
        cout << "OK";
    } else {
        cout << "NG";
    }
    cout << endl;
    return 0;
}

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

int main(){
    int data[101][101];

    int r, c, temp;

    scanf("%d %d", &r, &c);
    for(int j=0; j<=r; j++){
        for(int i=0; i<=c; i++){
            data[j][i] = 0;
        }
    }   

    for(int j=0; j<r; j++){
        for(int i=0; i<c; i++){
            scanf("%d", &data[j][i]);
            data[r][i] += data[j][i];
            data[j][c] += data[j][i];
            data[r][c] += data[j][i]; 
        }
    }

     for(int j=0; j<=r; j++){
        for(int i=0; i<=c; i++){
            printf("%d", data[j][i]);
            if(i<c){
                printf(" ");
            }
        }
        printf("\n");
     }

    return 0;
}


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

using namespace std;

int main()
{
	int N, M, X, Y;
	cin >> N >> M >> X >> Y;
	vector<int> x(N), y(M);
	for (auto& e : x) cin >> e;
	x.push_back(X);
	for (auto& e : y) cin >> e;
	y.push_back(Y);
	sort(x.begin(), x.end());
	sort(y.begin(), y.end());
	
	if (x.back() < y.front()) {
		cout << "No War" << endl;
	}
	else {
		cout << "War" << endl;
	}
}


Measured memory_bytes: 256
#include"bits/stdc++.h"
using namespace std;
#define ll long long
#define rep(i,n) for(ll i=0;i<(ll)n;++i)
#define rrep(i,n) for(ll i=n-1;i>=0;--i)
#define pp pair<ll,ll>
#define ppp pair<ll,pp>
#define pb push_back
#define ALL(v) v.begin(),v.end()
#define fi first
#define se second
const ll mod=1e9+9,INF=1e16;
vector<ll>node[200010];
ll m,d,ans;
int main(){
    cin>>m>>d;
	for(int i=1;i<=m;++i){
		for(int j=1;j<=d;++j){
			if(j%10<2||j/10<2)continue;
			if((j%10)*(j/10)==i){
                ++ans;
			}
		}
	}
	cout<<ans<<endl;
}

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

class
  Program
{
  static void Main(string[] args)
  {
    var input = Console.ReadLine().Split(' ');
    var data = new List<int>();
    foreach(var val in input)
    {
      data.Add(int.Parse(val));
    }
    var result = data[0].CompareTo(data[1]) == 0 
      ? "==" : data[0].CompareTo(data[1]) > 0 
      ? ">" : "<";
    Console.WriteLine("a "+result+" b");

  }
}

Measured memory_bytes: 8892
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
	
		int A = sc.nextInt();
	
		int B = sc.nextInt();
      
      	
		int r = A+B;
      
      if( r%2 == 0){
        System.out.println(r/2);
      }else{
        System.out.println("IMPOSSIBLE");
      }
      
    
    
        
    
	}
}

Measured memory_bytes: 23764
# coding:utf-8

import sys
import math
import time
#import numpy as np
import collections
from collections import deque
from collections import Counter
import queue
import copy
import bisect
import heapq
import itertools


sys.setrecursionlimit(10**7)
#N, Q = map(int, input().split())
#G = [list(input()) for i in range(H)]
#INF = V * 10001
#A = [int(i) for i in input().split()]
#AB = [list(map(int, input().split())) for _ in range(K)]

D, T, S= map(int, input().split())
ans = 0

A = T*S

if(A>=D):
    print("Yes")
else:
    print("No")


Measured memory_bytes: 68720
#include "bits/stdc++.h"
#include <set>

using namespace std;
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define RFOR(i, a, b) for (int i = (b)-1; i >= (a); i--)
#define rep(i, n) for (int i = 0; i < (n); i++)
#define rep1(i, n) for (int i = 1; i < (n); i++)
#define rrep(i, n) for (int i = (n)-1; i >= 0; i--)
#define all(i) (i).begin(), (i).end()
#define rall(i) (i).begin(), (i).end(), greater<int>()
#define int long long
#define elif else if
#define eb emplace_back
#define pb push_back
#define mp make_pair
#define fst first
#define sec second
#define mod 1000000007
#define INF 10e10
template <typename T>

void print(T x)
{
	std::cout << x << " ";
}
template <typename T>

void println(T x)
{
	std::cout << x << "\n";
}


signed main(void) {
	int n;
	cin >> n;
	vector<vector<int>>G(n);
	vector<pair<int, int>> vp;
	rep(i, n - 1) {
		int tmpa, tmpb;
		cin >> tmpa >> tmpb;
		tmpa--;
		tmpb--;
		G[tmpa].pb(tmpb);
		G[tmpb].pb(tmpa);
		vp.pb(make_pair(tmpa,tmpb));
	}
	vector<int> visited(n, -1); // 全頂点を「未訪問」に初期化
	queue<int> que;
	vector<int> cs(n, 0); // color of edge between its parent
	map<pair<int, int>, int> I;
	visited[0] = 0;
	que.push(0);
	int k = 1;

	while (!que.empty()) {
		int v = que.front();
		que.pop();
		if (k < (int)G[v].size()) k = G[v].size();
		int cur = 1;
		for (int nv : G[v]) {
			if (visited[nv] != -1) continue; // すでに発見済みの頂点は探索しない
			if (cur == cs[v])cur++;
			I[make_pair(v, nv)] = cur;
			I[make_pair(nv, v)] = cur;
			cs[nv] = cur;
			visited[nv] = 0;
			que.push(nv);
			cur++;
		}
	}
	println(k);
	for (auto v : vp)println(I[v]);
}

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

int main(void){
    const int DATA_MAX = 1000;
    int n = 0;
    double sum = 0.0, ave = 0.0, squared = 0.0;
    double data[DATA_MAX];
    
    while(true){
      sum = 0, ave = 0.0, squared = 0.0;
      
      scanf("%d", &n);//総数を取得
      if(n==0) break;
      
      for(int i=0;i<n;i++){
          scanf("%lf", &data[i]);
          sum += data[i];
      }
      ave = sum / n;
      
      for(int i=0;i<n;i++){
          squared += (data[i] - ave) * (data[i] - ave);
      }
      squared /= n;
      
      printf("%lf\n", sqrt(squared));
    }
    return 0;
}


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

#define rep(i, n) for(int i = 0; i < n; i++)
using namespace std;

typedef long long ll;

const int INF = 1 << 30;
const ll LLINF = 1LL << 62;

int mod = 1000000007;

int main(void){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int a; cin >> a;
    cout << a + a*a + a*a*a << endl;
    return 0;
}

Measured memory_bytes: 3644
#include <iostream>
#include <vector>

template <typename Tp> void println(const std::vector<Tp>& A){
    for(auto itr = A.cbegin(); itr != A.cend(); ){ 
        std::cout << (*itr++); std::cout << (itr == A.cend() ? '\n' : ' ');
    }
}

int main(void){
    std::cin.tie(nullptr); std::cin.sync_with_stdio(false);
    int n; std::cin >> n; 
    std::vector<int> A(n); for(int i = 0; i < n; ++i) std::cin >> A[i];

    std::cout.tie(nullptr);
    println(A);
    for(int i = 1; i < n; ++i){
        int v = A[i];
        int j;
        for(j = i - 1; j >= 0 and A[j] > v; --j) A[j + 1] = A[j];
        A[j + 1] = v;
        println(A);
    }

    return 0;
}


Measured memory_bytes: 3168
n=int(input())
a=list(map(int,input().split()))
b=[]
if n%2==0:
    x=a[::2]
    y=a[1::2]
    y.reverse()
    b=y+x
    print(*b)
else:
    x=a[::2]
    y=a[1::2]
    x.reverse()
    b=x+y
    print(*b)

Measured memory_bytes: 26180
#include<bits/stdc++.h>
using namespace std;
#define ll long long
ll x,k,ans;

int main()
{
  
   cin>>x;
   k=100;
   while(k<x)
   {
   	  k=k+k/100;
   	  ans++;
   }
   cout<<ans;
return 0;
}


Measured memory_bytes: 3632
#include <iostream>
using namespace std;
 
int main(){ 
    int N;
    scanf("%d",&N);
    int ary[N];
    for(int i=0;i<N;i++){
        scanf("%d",&ary[i]);
    }
    int min=1000000000;
    int cnt = 0; 
    for(int i=0;i<N;i++){
        if (ary[i]<=min){
            min=ary[i];
            cnt=cnt+1;
        }
    }
    printf("%d\n",cnt);
    
    return 0;
}

Measured memory_bytes: 1024
while True:
    p=0
    n,x=map(int,input().split())
    if n==0 and x==0:
        break
    
    for a in range(1,n-1):
        for b in range(a+1,n):
            for c in range(b+1,n+1):
                s=a+b+c
                if s==x:
                    p=p+1
    print(p)


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

int main(){
	int N, Y;
	cin >> N >> Y;
	int i = -1, j = -1;
	int flag = 0;
	int total;

	for (i = 0; i <= N; i++){
		for (j = 0; j + i <= N; j++){
			total = 10000*i + 5000*j + 1000*(N-i-j);
			if(total == Y) {
				flag = 1;
				break;
			}

		}
		if(total == Y) break;
	}
	if(flag == 1) cout << i << " " << j << " " << N-i-j << endl;
	else cout << -1 << " " << -1 << " " << -1 << endl;

}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector> 
#include <algorithm>
#include <cmath>
#include <map>
#include <numeric>
#include <queue>
using namespace std;
typedef long long ll;

int main(){
   int a,b,c;cin>>a>>b>>c;
   vector<int> v;
   for(int i=1;i<=min(a,b);i++){
       if(a%i==0&&b%i==0)v.push_back(i);
   }
   reverse(v.begin(),v.end());
   cout<<v[c-1];
   
}

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

using namespace std;
typedef long long ll;

#define MOD (long long)(1e9+7)
#define INF (1LL<<60)
#define rep(i,n) for(ll i = 0; i < (n); i++)
#define rep1(i,n) for(ll i = 1; i <= (n); i++)

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


// 最大公約数
ll gcd(ll a, ll b)
{
  if(b == 0) return a;
  return gcd(b, a % b);
}

// mod m におけるa の逆元
ll modinv(ll a, ll m) {
  ll b = m, u = 1, v = 0;
  while (b) {
    ll t = a / b;
    a -= t * b; swap(a, b);
    u -= t * v; swap(u, v);
  }
  u %= m;
  if (u < 0) u += m;
  return u;
}

// 素因数分解
vector<pair<ll, ll>> prim;
void pf(ll n)
{
  ll s = sqrt(n);
  ll r = 0;
  for(ll i = 2; i <= s; i++) {
    if((n % i) == 0) {
      r = 0;
      do {
	r++;
	n = n / i;
      } while((n % i) == 0);
      prim.push_back({i, r});
    }
  }
  if(n > s) {
    prim.push_back({n, 1});
  }
}

void solve()
{
  // ll N, K; cin >> N >> K;
  // ll x, y, z; cin >> x >> y >> z;
  // ll a, b, c; cin >> a >> b >> c;
  string s; cin >> s;
  // vector<ll> a(N); rep(i, N) cin >> a[i];
  
  if(s[0] >= 'A' && s[0] <= 'Z') cout << "A" << endl;
  else cout << "a" << endl;
  
  // bool ok = false;

  // cout << ans << endl;
  // cout << (ok?"Yes":"No") << endl;
}


int main(void)
{
  // ll t; cin >> t; rep(i, t)
  solve();
}


Measured memory_bytes: 3616
#include <bits/stdc++.h>
#define rep(i, a, n) for(int i = a; i < n; i++)
#define int long long
using namespace std;
typedef pair<int, int> P;
const int mod = 1000000007;
const int INF = 1e18;

signed main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    vector<string> s(n);
    map<string, int> mp;
    rep(i, 0, n){
        cin >> s[i];
        sort(s[i].begin(), s[i].end());
        mp[s[i]]++;
    } 
    int ans = 0;
    for(auto i : mp){
        ans += i.second * (i.second - 1) / 2;
    }
    cout << ans << endl;
}

Measured memory_bytes: 16640
## for use in beginner level questions where speed is key
## and also for single test case code
## mastercopy for x,y,z

import sys
import heapq, functools, collections
import random
from collections import Counter, defaultdict

# read line as a string
# strr = input()

# read line as an integer
# k = int(input())

# read one line and parse each word as a string
# lst = input().split()

# read one line and parse each word as an integer
n,x,t = list(map(int,input().split()))

res = n//x
if n%x:
    res += 1

print(res*t)


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

using namespace std;

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


int main(void)
{
  string s;
  cin >> s;
  cout << s[0] << int(s.size())-2 << s[int(s.size())-1] << endl;
  return 0;
}


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

// 1 2 3 4 5 6 7 8 9 10 11 12
int main() {
    int n;
    cin >> n;
    vector<int>v(n);
    for(int i = 0;i < n;i++){
        cin >> v[i];
    }
    int ans = 1e9;
    for(int i = 1;i <= 100;i++){
        int count = 0;
        for(int j = 0;j < n;j++){
            count += (v[j] - i) * (v[j] - i);
        }
        ans = min(count,ans);
    }
    cout << ans << endl;
}

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

using namespace std;
typedef long long ll;

#define FAST ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define mp make_pair
#define pb push_back
#define lp(i,s,f) for(ll i = s; i < ll(f); i++)
#define inF freopen("input.in", "r", stdin);
#define outF freopen("output.in", "w", stdout);
#define endl '\n'
#define MOD 1000000007
#define mm(arr) memset(arr, 0, sizeof(arr))
#define int ll

int32_t main(){
    FAST
    int a, b; cin >> a >> b;
    cout << a*b;
    return 0;
}


Measured memory_bytes: 3604
#include<bits/stdc++.h>
#define rep(i,a) for(int i=(int)0;i<(int)a;++i)
#define rrep(i,a) for(int i=(int)a-1;i>=0;--i)
#define REP(i,a,b) for(int i=(int)a;i<(int)b;++i)
#define RREP(i,a,b) for(int i=(int)a-1;i>=b;--i)
#define pb push_back
#define eb emplace_back
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
using ll=long long;
constexpr ll mod = 1e9 + 7;
constexpr ll INF = 1LL << 60;
 
template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}


ll gcd(ll n, ll m) {
    ll tmp;
    while (m!=0) {
        tmp = n % m;
        n = m;
        m = tmp;
    }
    return n;
}
 
ll lcm(ll n, ll m) {
    return abs(n) / gcd(n, m)*abs(m);//gl=xy
}

using namespace std;

template<int mod>
struct Modint{
    int x;
    Modint():x(0){}
    Modint(int64_t y):x((y%mod+mod)%mod){}

    Modint &operator+=(const Modint &p){
			if((x+=p.x)>=mod)
				x -= mod;
			return *this;
		}

		Modint &operator-=(const Modint &p){
			if((x+=mod-p.x)>=mod)
				x -= mod;
			return *this;
		}

		Modint &operator*=(const Modint &p){
			x = (1LL * x * p.x) % mod;
			return *this;
		}

		Modint &operator/=(const Modint &p){
			*this *= p.inverse();
			return *this;
		}

		Modint operator-() const { return Modint(-x); }
		Modint operator+(const Modint &p) const{
			return Modint(*this) += p;
		}
		Modint operator-(const Modint &p) const{
			return Modint(*this) -= p;
		}
		Modint operator*(const Modint &p) const{
			return Modint(*this) *= p;
		}
		Modint operator/(const Modint &p) const{
			return Modint(*this) /= p;
		}

		bool operator==(const Modint &p) const { return x == p.x; }
		bool operator!=(const Modint &p) const{return x != p.x;}

		Modint inverse() const{//非再帰拡張ユークリッド
			int a = x, b = mod, u = 1, v = 0;
			while(b>0){
				int t = a / b;
				swap(a -= t * b, b);
				swap(u -= t * v, v);
			}
			return Modint(u);
		}

		Modint pow(int64_t n) const{//繰り返し二乗法
			Modint ret(1), mul(x);
			while(n>0){
				if(n&1)
					ret *= mul;
				mul *= mul;
				n >>= 1;
			}
			return ret;
		}

		friend ostream &operator<<(ostream &os,const Modint &p){
			return os << p.x;
		}
};

using modint = Modint<mod>;


void solve()
{
	// ll n,s;
	// cin>>n>>s;
	// vector<ll>a(n);
	// rep(i,n)cin>>a[i];
	// const ll m=998244353;
	// vector<vector<Modint<m>>>dp(n+5,vector<Modint<m>>(3005));
	// rep(i,n){
		
	// }
	long double a,b;
	cin>>a>>b;
	long double eps=0.001;
	cout<<(ll)(a*b+eps);
}

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


Measured memory_bytes: 3732
import std.stdio, std.string, std.array, std.conv;

int selectionSort(int n, int[] x) {
    int cnt = 0;
    foreach (i; 0 .. n-1) {
        int minj = i;
        foreach (j; i .. n) {
            if (x[j] < x[minj]) minj = j;
        }
        if (i != minj) {
            int t = x[i];
            x[i] = x[minj];
            x[minj] = t;
            if (i != minj) ++cnt;
        }
    }
    return cnt;
}

void main() {
    int n = readln.chomp.to!int;
    int[] a = readln.chomp.split.to!(int[]);
    int times = selectionSort(n, a);
    foreach (i, x; a) {
        x.write;
        if (i != n - 1) " ".write;
        else writeln;
    }
    times.writeln;
}


Measured memory_bytes: 2488
#include<bits/stdc++.h>
#define ll long long
#define db double
#define lowbit(p) (p&(-p))
#define pb push_back
#define mp make_pair
#define pii pair<int,int>
#define A first
#define B second
using namespace std;
void read(int &x){
	x=0; char c=getchar(); int p=1;
	for (;c<48;c=getchar())if (c=='-')p=-1;
	for (;c>47;c=getchar())x=(x<<1)+(x<<3)+(c^48);
	x*=p;
}
void read(ll &x){
	x=0; char c=getchar(); int p=1;
	for (;c<48;c=getchar())if (c=='-')p=-1;
	for (;c>47;c=getchar())x=(x<<1)+(x<<3)+(c^48);
	x*=p;
}
void Min(int &x,int y){
	if (x>y)x=y;
}
void Max(int &x,int y){
	if (x<y)x=y;
}
void Min(ll &x,ll y){
	if (x>y)x=y;
}
void Max(ll &x,ll y){
	if (x<y)x=y;
}
/*
把图分成两个团.
让团的大小绝对值最小
*/
#define M 705
bool a[M][M],dp[2][M];
int cnt[M][2],tot,col[M],n,m;
struct ed{
	int x,nx;
}e[M*M*2];
int nx[M],ecnt=1;
void add(int x,int y){
	e[ecnt]=(ed){y,nx[x]};
	nx[x]=ecnt++;
}
bool flag=1;
void dfs(int f,int x,int v,int id){
	col[x]=v;
	cnt[id][v]++;
	for (int i=nx[x];i;i=e[i].nx){
		if (col[e[i].x]==-1){
			dfs(x,e[i].x,1-v,id);
		}
		else {
			if (col[x]==col[e[i].x]){
				printf("-1\n");	
				exit(0);
				flag=0;
			}
		}
	}
}
int main(){
//	freopen(".in","r",stdin);
//	freopen(".out","w",stdout);
//	freopen("1.in","r",stdin);
	read(n); read(m);
	int i,x,y,j;
	ll res=m,sz1,sz2;
	for (i=1;i<=m;i++){
		read(x); read(y);
		a[x][y]=a[y][x]=1;
	}
	for (i=1;i<=n;i++){
		col[i]=-1;
		for (j=i+1;j<=n;j++)if (!a[i][j]){
			add(i,j);
			add(j,i);
		}
	}
	for (i=1;i<=n;i++)if (col[i]==-1){
		++tot;
		dfs(i,i,1,tot);
		if (!flag)return 0;
	}
	int now;
	dp[now=0][0]=1;
	for (i=1;i<=tot;i++){
		now=!now;
		memset(dp[now],0,sizeof(dp[now]));
		for (j=n;j>=0;j--)if (dp[!now][j]){
			dp[now][j+cnt[i][0]]=1;
			dp[now][j+cnt[i][1]]=1;
		}
	}
	for (i=0;i<=n;i++)if (dp[now][i]){
		sz1=i; sz2=n-i;
		Min(res,(sz1)*(sz1-1)/2+(sz2)*(sz2-1)/2);
	}
	printf("%lld\n",res);
	return 0;
}

Measured memory_bytes: 6400
#include<iostream>
#include<bits/stdc++.h>
using namespace std;
#define rep(i,a,b) for (int i = a; i <= b; i++)


int h, w, t;
char s[551][551], r[551][551], b[551][551];

int main(){
//freopen("input.txt", "r", stdin);
//freopen("output.txt", "w", stdout);
cin >> h >> w;

rep(i, 0, h-1){
cin >> s[i] ;

rep(j, 0, w-1){

r[i][j]=s[i][j];
b[i][j]=s[i][j];

}
}

rep(i, 0, w-1){
r[0][i]='#';
r[h-1][i]='#';
r[i][0]='#';
r[i][w-1]='#';
}

t=1;
rep(i, 1, h-2){
bool ans = false;
rep(j, 1, w-2){
if(s[i][j]=='#')ans=true;
}
if(ans&&(t&1)){
    rep(j, 1, w-2){
    b[i][j]='#';
    }
    //t++;
}
else if(ans && (t%2==0)){
    rep(j, 1, w-2){
    r[i][j]='#';
    }
    //t++;
}

else rep(j, 1, w-2){
    b[i][j]='#';
    //t++;
}
t++;
}

rep(i, 0, h-1){
cout << r[i];
cout << endl;
}

cout << endl;

rep(i, 0, h-1){
cout << b[i];
cout << endl;
}





}


Measured memory_bytes: 1664
//     . .. ... ..... be naame khodaa ..... .... ... .. .     \\

#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef long double ld;

inline int in(){int x, y; y = scanf("%d", &x); return x;}

const int N = 5005;
const ll INF = 1e18;

ll dp[N][N], best[N];
int p[N], q[N];

int main() {
	int n = in();
	ll R = in(), L = in();
	for(int i = 1; i <= n; i++) {
		q[p[i] = in()] = i;
	}
	for(int j = 0; j <= n; j++) {
		dp[0][j] = j*R;
	}
	fill(best, best + n + 1, INF);
	best[0] = 0;
	for(int i = 1; i <= n; i++)
		for(int j = 0; j <= n; j++) {
			int pos = q[i];
			ll &res = dp[i][j];
			res = INF;
			if(j >= pos - 1)
				res = dp[i - 1][j];
			if(j) {
				if(p[j] <= i)
					res = min(res, dp[i][j - 1]);
				if(p[j] == i)
					res = min(res, dp[i - 1][j - 1]);
				res = min(res, dp[i][j - 1] + R);
			}
			res = min(res, dp[i - 1][j] + L);
			//res = min(min(dp[i - 1][pos - 1], best[i - 1] + L), res);
			best[i] = min(best[i], dp[i][j]);
//			cerr << i << ", " << j << ": " << res << endl;
		}
	cout << best[n] << endl;
}


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

typedef long long ll;

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

    ll H, W, N; cin >> H >> W >> N;
    int a, b;
    map<ll, int> masu;
    for (int i = 0; i < N; i++) {
        cin >> a >> b; a--; b--;
        for (int j = 0; j < 3; j++) {
            for (int k = 0; k < 3; k++) {
                if (0 <= a-j && a-j < H-2 && 0 <= b-k && b-k < W-2) {
                    masu[(a-j)*W + b-k]++;
                }
            }
        }
    }

    ll ans[10];
    fill(ans, ans+10, 0L);
    for (auto x: masu) {
        ans[x.second]++;
    }
    ans[0] = (H-2)*(W-2) - accumulate(ans+1, ans+10, 0L);

    for (int i = 0; i < 10; i++) {
        cout << ans[i] << endl;
    }

    return 0;
}

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


int main(void){
    int n;
    cin >> n;
    vector<int> a(n);
    
    int A;
    for(int i = 0; i < n; i++) {
        cin >> a.at(i);
        if(i == 0) A = a.at(i);
        else A = A^a.at(i);
    }
    
    for(int i = 0; i < n; i++) {
        int ans = A;
        ans = ans^a.at(i);
        cout << ans << ' ';
    }
}


Measured memory_bytes: 4024
#include <stdio.h>

int n, A[50];
int solve(int, int);

int main()
{
    int q, m, i;

    scanf("%d", &n);
    for (i = 0; i < n; i++)
        scanf("%d", &A[i]);
    scanf("%d", &q);
    for (i = 0; i < q; i++)
    {
        scanf("%d", &m);
        if (solve(0, m))
            printf("yes\n");
        else
        {
            printf("no\n");
        }
    }
    return 0;
}
int solve(int a, int b)
{
    if (b == 0)
        return 1;
    if (a >= n)
        return 0;
    int res = solve(a + 1, b) || solve(a + 1, b - A[a]);
    return res;
}


Measured memory_bytes: 2104
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.stream.LongStream;
import java.util.stream.Stream;

public class Main {

	public static void main(String[] args) {
		try (Stream<String> lines = new BufferedReader(new InputStreamReader(System.in)).lines()) {
			new Main().exec(lines.toArray(String[]::new));
		}
	}

	void exec(String[] args) {
		String[] a = args[0].split(" ");
		int n = Integer.parseInt(a[0]);
		int k = Integer.parseInt(a[1]);
		int[] h = Stream.of(args[1].split(" ")).mapToInt(Integer::parseInt).toArray();
		Arrays.sort(h);
		System.out.println(LongStream.range(0, n).map(v -> v < n - k ? h[(int)v] : 0).sum());
	}

}


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

// def
#define debug(x) cout << #x << ": " << x << endl
#define out(x) cout << x << endl
#define repeat(i, a, b) for (int i = (a); i < (b); i++)
#define revrepeat(i, a, b) for (int i = (b)-1; i >= (a); i--)
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define revrep(i, n) for (int i = (n)-1; i >= 0; i--)
typedef long long ll;
const int M = 1e9 + 7;
const int INF = 1e9;

// typedef
typedef pair<int, int> P;
typedef tuple<int, int, int> P3;
typedef vector<vector<int>> Graph;

bool can(int a) {
    if (0 <= a && a <= 9) {
        return true;
    } else {
        return false;
    }
}

int main() {
    int n;
    cin >> n;
    for (int i = 1; i < 10; i++) {
        if (n % i == 0) {
            if (can(n / i)) {
                out("Yes");
                return 0;
            }
        }
    }
    out("No");
    return 0;
}


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

def solve(X: int, Y: int, Z: int):
    print("{} {} {}".format(Z,X,Y))
    return

def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    X = int(next(tokens))  # type: int
    Y = int(next(tokens))  # type: int
    Z = int(next(tokens))  # type: int
    solve(X, Y, Z)

if __name__ == '__main__':
    main()


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

int main(){
    int s1;
    cin >> s1;
    int count = 0;
    if(s1 / 100 == 1)count++;
    if((s1 / 10) % 10 == 1)count++;
    if(s1 % 10 == 1)count++;
    cout << count << endl;
}

Measured memory_bytes: 3556
#include <iostream>
#include <cstring>
#include <string>    
#include <vector>
#include <queue>
#include <map>
#include <algorithm>
#include <cmath>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
ll n, a, b;
string str;

int main(){
	cin >> n >> a >> b;
	cout << min(n*a, b) << endl;
	return 0;
}

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

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

using namespace std;
typedef long long int ll;
const int INF = 1000000000;
const double PI = 3.1415926535897932;
const ll MOD = 1000000007;

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

	if (a > b) {
		int tmp = b;
		b = a;
		a = tmp;
	}
	int ans = 0;
	int mul = 1;
	rep(i, b) {
		ans += a * mul;
		mul *= 10;
	}
	cout << to_string(ans) << endl;
	return 0;
}

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

int main(){
    string s, t;
    cin >> s >> t;
    bool flag = false;

    char tmp;
    for (int i = 0; i < s.size(); i++)
    {
        if(s == t){
            flag = true;
            break;
        }
        s = s.back() + s.substr(0, s.size() - 1);
    }
    if(flag){
        cout << "Yes" << endl;
    }
    else{
        cout << "No" << endl;
    }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
#define int long long int
#define mod 1000000007
#define string_mod 2549536629329_base_255
#define pb push_back
#define F first
#define S second
template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
int power(int x, unsigned int y, int p)
{
    int res = 1;

    x = x % p;
    while (y > 0)
    {

        if (y & 1)
            res = (res * x) % p;

        y = y >> 1;
        x = (x * x) % p;
    }
    return res;
}
int32_t main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    int tc = 1;
    // cin >> tc;
    while (tc--)
    {
        string s, t;
        cin >> s;
        for (int i = 0; i < s.size();i++){
            cout << "x";
        }
    }

    return 0;
}

Measured memory_bytes: 256
function Main(input) {
	input = input.split("\n");
	input.shift();
	var arr = input[0].split("");
	var R  = [0];
	for(var i=1;i<arr.length;i++){
		if(arr[i]=="C"&&arr[i-1]=="A"){
			R.push(R[i-1]+1);
		}else{
			R.push(R[i-1]);
		}
	}
  //console.log(R)
	input.shift();
	for(i=0;i<input.length;i++){
		var mem = input[i].split(" ").map(Number);
    //  console.log(mem)
		var ans = R[mem[1]-1]-R[mem[0]-1];
		console.log(ans)
	}
}Main(require("fs").readFileSync("/dev/stdin", "utf8").trim());

Measured memory_bytes: 35428
/* ex 5_4
   kohei0713 */

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

int main(void){
    int i, length_acgt = 0, ans = 0;
    char sequence[11];

    //input
    scanf("%s", sequence);

    //1文字目から繰り返す
    for(i = 0; i < strlen(sequence); i++){
        if(sequence[i] == 'A' || sequence[i] == 'C' || sequence[i] == 'G' || sequence[i] == 'T' ){
            //sequenceのi+1番目の文字がA,C,G,Tのときlength_acgtを1増やす
            length_acgt = length_acgt + 1;
            if(length_acgt > ans){
                //ansにlength_acgtの最大値を代入する
                ans = length_acgt;
            }
        }else{
            //sequenceのi+1番目の文字がA,C,G,Tでないときlength_acgtを0にする
            length_acgt = 0;
        }
    }

    //ansを出力する
    printf("%d\n", ans);

    return 0;
}

Measured memory_bytes: 1672
#include<string.h>
#include<stdlib.h>
#include<time.h>
#include<math.h>
#include<stdio.h>
int main(void){
    int n,i;
    scanf("%d",&n);
    double a[n],b[n],c=0,d;
    for(i=0;i<n;i++){
        scanf("%lf",&a[i]);
        b[i]=1/a[i];
    }
    for(i=0;i<n;i++){
        c+=b[i];
    }
    d=1/c;
    printf("%f\n",d);
    return 0;
}


Measured memory_bytes: 128
import java.util.HashSet;
import java.util.Scanner;
import java.util.Set;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        String t = sc.next();
        boolean ok = false;
        for (int i = 0; i < s.length(); i++) {
            for (int j = 0; j < t.length(); j++) {
                if (s.charAt(i) < t.charAt(j)) {
                    ok = true;
                }
            }
        }
        if (ok) {
            System.out.println("Yes");
        } else {
            Set<Integer> set = new HashSet<>();
            for (int i = 0; i < s.length(); i++) {
                for (int j = 0; j < t.length(); j++) {
                    if (set.contains(j)) {
                        continue;
                    }
                    if (s.charAt(i) == t.charAt(j)) {
                        set.add(j);
                        break;
                    }
                }
            }
            if (s.length() < t.length() && s.length() == set.size()) {
                System.out.println("Yes");
            } else {
                System.out.println("No");
            }
        }
        sc.close();
    }
}

Measured memory_bytes: 21844
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
#include <iostream>
#include <algorithm>
#include <string.h>
using namespace std;
const int num = 100001, INF = 2000000000;
int a[num];
int dp[num];
int main() {
	int n;
	cin >> n;
	for (int i = 0; i < n; i++)cin >> a[i];
	fill(dp, dp + n, INF);
	for (int i = 0; i < n; i++) {
		*lower_bound(dp, dp + n, a[i]) = a[i];
	}
	cout << lower_bound(dp, dp + n, INF) - dp << endl;
	return 0;
}

Measured memory_bytes: 3872
N, W = map(int, input().split())
ws = []
vs = []
for i in range(N):
    w, v = map(int, input().split())
    ws.append(w)
    vs.append(v)

vss = [[], [], [], []]

for i in range(N):
    ind = ws[i] - ws[0]
    vss[ind].append(vs[i])

for i in range(4):
    vss[i].sort(reverse=True)

dic = {}

# select_S: (a, b, c, d)


def rec(vss, tmp_W, tmp_V, select_S):
    # print(select_S)
    for i in range(4):
        if len(vss[i]) == 0:
            continue
        new_tmp_W = tmp_W + ws[0] + i
        if new_tmp_W > W:
            continue
        new_tmp_V = tmp_V + vss[i][0]
        new_vss = list(vss)
        new_vss[i] = new_vss[i][1:]

        new_select_S = [select_S[j] for j in range(4)]
        new_select_S[i] += 1
        new_select_S = tuple(new_select_S)
        if new_select_S in dic:
            continue

        dic[new_select_S] = new_tmp_V
        rec(new_vss, new_tmp_W, new_tmp_V, new_select_S)


rec(vss, 0, 0, (0, 0, 0, 0))
ans = sorted(list(dic.values()), reverse=True)
if len(ans) == 0:
    print(0)
else:
    print(ans[0])


Measured memory_bytes: 31344
#include <iostream>
#include <memory>
#include <algorithm>
using namespace std;

struct Node;
typedef shared_ptr<Node> NP;
struct Node {
  NP l, r;
};

void test() {
  for (int i = 0; i < 2000000; ++i) NP(new Node());
}

int main() {
  test();
  int a, b, c;
  cin >> a >> b >> c;
  cout << ((a+b+c) == max({a,b,c})*2 ? "Yes" : "No") << endl;
  return 0;
}


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


using namespace std;

#define M 1000000007
#define pb push_back
#define f first
#define s second
#define rep(i, st, ed) for(int i=st; i<ed; i++)
#define repn(i, st, ed) for(int i=st; i<=ed; i++)
#define repb(i, ed, st) for(int i=ed; i>=st; i--)
#define all(v) v.begin(),v.end()
typedef long long ll;
typedef unsigned long long int llt;
typedef long double ld;

const long double PI  =3.141592653589793238463;
const int N = 1010;
const ll INF = 1LL << 60;

template<class T> void chmax(T &a,T b) { if (a<b) a=b;}
template<class T> void chmin(T &a,T b) { if (a>b) a=b;}



// Main Code
int main()
{
	int n;
	cin>>n;
	vector<ll> a(n), s(n);
	ll sum = 0;
	rep(i ,0 ,n)
	{
		cin>>a[i];
		sum += a[i];
		s[i] = sum;
	}
	ll ans = INF;
	ll i = 0;
	ll k = 2;
	rep(j, 1, n-2)
	{
		ll left = s[j];
		ll right = s[n-1] - s[j];
		
		while(true)
		{
			if(2*s[i] > left)
			{
				if(i > 0)
					if(abs(left - 2*s[i-1]) < abs(left - 2*s[i])) i--;
				break;
			}
			i++;
		}
		
		while(true)
		{
			if(2*(s[k] - s[j]) > right)
			{
				if(abs(right - 2*(s[k-1] - s[j])) < abs(right - 2*(s[k] - s[j]))) k--;
				break;
			}
			k++;
		}
		ll p = s[i];
		ll q = s[j] - s[i];
		ll r = s[k] - s[j];
		ll ss = s[n-1] - s[k];
		auto maxx = max({p ,q, r, ss});
		auto minn = min({p, q, r, ss});
		ans = min(ans, abs(maxx - minn));
	}
	cout<<ans<<endl;
}


Measured memory_bytes: 3456
#include<algorithm>
#include<cmath>
#include<cstdlib>
#include<iomanip>
#include<iostream>
#include<numeric>
#include<string>
using namespace std;

long gcd(long x, long y) { if (x > y) { return gcd(y, x); } long r; while (y != 0) { r = x % y; x = y; y = r; }return x; }
long lcm(long x, long y) { return(x / gcd(x, y)) * y; }
void indexsort(long* first, long* last, long* func) { sort(first, last, [&](long a, long b) {return func[a] < func[b]; }); }
//--------------------

int main() {
 
	long N; cin >> N;
	long div = 0;
	long w = 0;
	for (long h = 1; h <= 3500; h++){
		for (long n = 1; n <= 3500; n++){
			div = 4 * n * h - N * h - N * n;
            if (div <= 0 ) continue;
			w = N * h * n / div;
			if (N * h * n % div == 0){ cout << h << " " << n << " " << w << endl; return 0; }      
		}
	}
}

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

#define I inline
#define fi first
#define se second
#define R register
#define LL long long
#define mp make_pair
#define reg register int
#define pii pair<int,int>
#define fo(i, a, b) for(reg i = a; i <= b; i++)
#define fd(i, a, b) for(reg i = a; i >= b; i--)
#define cr const reg&
using namespace std;
const int N = 1e6 + 1, mod = 1e9 + 7;

I int _max(cr x, cr y) {return x > y ? x : y;}
I int _min(cr x, cr y) {return x < y ? x : y;}
I int read() {
	reg x = 0, f = 1; char ch = getchar();
	while(ch < '0' || ch > '9') {if(ch == '-') f = -1; ch = getchar();}
	while(ch >= '0' && ch <= '9') x = (x << 3) + (x << 1) + (ch ^ 48), ch = getchar();
	return x * f;
}
I void ptt(LL x) {if(x >= 10) ptt(x / 10); putchar(x % 10 + '0');}
I void put(LL x) {x < 0 ? putchar('-'), ptt(-x) : ptt(x);}
I void pr1(LL x) {put(x), putchar(' ');}
I void pr2(LL x) {put(x), puts("");}

I int pow_mod(reg a, reg k) {reg ans = 1; for(; k; k >>= 1, a = (LL)a * a % mod) if(k & 1) ans = (LL)ans * a % mod; return ans;}

int jc[N], inv[N], f[N];

I int C(int n, int m) {return (LL)jc[n] * inv[m] % mod * inv[n - m] % mod;}

int main() {
	reg n = read();
	jc[0] = 1; fo(i, 1, n) jc[i] = (LL)jc[i - 1] * i % mod;
	inv[n] = pow_mod(jc[n], mod - 2); fd(i, n, 1) inv[i - 1] = (LL)inv[i] * i % mod;
	reg d = (n + 1) / 2;
	fo(i, d, n - 1) f[i] = (LL)C(i - 1, n - i - 1) * jc[i] % mod * jc[n - i - 1] % mod;
	reg ans = 0;
	fo(i, d, n - 1) ans = (ans + (LL)i * (f[i] - f[i - 1])) % mod;
	pr2(ans < 0 ? ans + mod : ans);
	return 0;
}



Measured memory_bytes: 9984
import java.util.*;
public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		long x = sc.nextLong();
		long result;
		result = 2*(x/11);
		if(x%11>6){
			result += 2;
		}else if(x%11>0){
			result += 1;
		}
		System.out.println(result);
	}
}

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

int main(){
    int n;
    int d;
    int num = 0;
    double total;
    int total_int;
    vector<vector<int>> x(11, vector<int>(11));
    cin >> n >> d;
    for(int i=0; i<n; i++){
        for(int j=0; j<d; j++){
            cin >> x[i][j];
        }
    }
    for(int i=0; i<n-1; i++){
        for(int j=i+1; j<n; j++){
            total = 0;
            for(int k=0; k<d; k++){
                total += (x[i][k] - x[j][k]) * (x[i][k] - x[j][k]);
            }
            total = sqrt(total);
            total_int = int(total);
            total = total - double(total_int);
            if(total==0.0){
                num++;
            }
        }
    }
    cout << num << endl;
}

Measured memory_bytes: 256