akhauriyash/Code-Regression huggingface dataset:
"""
https://atcoder.jp/contests/abc151/tasks/abc151_d
"""
H, W = map(int, input().split())
S = []
for i in range(H):
    s = input()
    S.append(list(s))

# 隣接のマスをループで表すために必要
di = [-1, 0, 1, 0]
dj = [0, -1, 0, 1]

def is_street(s, t):
    """
    道であること（壁ではないこと）を確認
    """
    return S[s][t] == '.'

def count(maze):
    """
    最大のコストを探索
    """
    r = -1
    for i in range(H):
        for j in range(W):
            r = max(r, maze[i][j])
    return r

def bfs(h, w):
    """
    h: スタート位置（高さ）
    w: スタート位置（横）
    """
    m = []  # スタート地点からの距離が入る
    for i in range(H):
        s = [-1] * W
        m.append(s)
    m[h][w] = 0  # スタート地点は0

    q = [[h, w]]
    while len(q) != 0:
        si, sj = q.pop(0)
        cost = m[si][sj]

        for i in range(4):
            ni = si + di[i]
            nj = sj + dj[i]
            if not (0 <= ni < H and 0 <= nj < W):
                continue
            if not is_street(ni, nj): 
                continue
            if m[ni][nj] != -1:
                continue

            m[ni][nj] = cost + 1
            q.append([ni, nj])

    max_cost = count(m)
    return max_cost

ans = -1
# 壁以外のすべてのマスをスタートにして探索
for i in range(H):
    for j in range(W):
        if not is_street(i, j):
            continue
        c = bfs(i, j)
        ans = max(ans, c)

print(ans)


Measured memory_bytes: 3188
#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;
typedef tree<pair<int,int>,null_type,less<pair<int,int>>,rb_tree_tag,tree_order_statistics_node_update> oset;
#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
  enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
  ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
  *this << "[";
  for (auto it = d.b; it != d.e; ++it)
	*this << ", " + 2 * (it == d.b) << *it;
  ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "
using ll = long long;

void test_case(){
	vector<vector<int>> hash(3,vector<int>(3));
	for(int i = 0 ; i < 3 ; i++){
		for(int j = 0 ; j < 3 ; j++){
			cin >> hash[i][j];
		}
	}
	vector<vector<bool>> hash1(3,vector<bool>(3,true));

	int n;
	cin >> n;
	while(n--){
		int x;
		cin >> x;
		for(int i = 0 ; i < 3 ; i++){
			for(int j = 0 ; j < 3 ; j++){
				if(hash[i][j]==x)
					hash1[i][j]=false;
			}
		}
	}
	for(int i = 0 ; i < 3 ; i++){
		if(hash1[1][i]==false && hash1[0][i]==false && hash1[2][i]==false){
			cout<<"Yes\n";
			return;
		}
	}
		for(int i = 0 ; i < 3 ; i++){
		if(hash1[i][0]==false && hash1[i][1]==false && hash1[i][2]==false){
			cout<<"Yes\n";
			return;
		}
	}
	if(hash1[0][0]==false && hash1[1][1]==false && hash1[2][2]==false){
		cout<<"Yes\n";
		return;
	}
	if(hash1[0][2]==false && hash1[1][1]==false && hash1[2][0]==false){
		cout<<"Yes\n";
		return;
	}
	cout<<"No\n";
}
 
int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	int T=1;
	//~ cin >> T;
	while(T--){
		test_case();
	}
	return 0;
}


Measured memory_bytes: 3584
#include<iostream>
using namespace std;
int main()
{
    char ar[4]={'A','C','G','T'};
    char x;
    cin>>x;
    if(x=='A')
        cout<<'T';
    else if(x=='T')
        cout<<'A';
    else if(x=='C')
        cout<<'G';
    else if(x=='G')
        cout<<'C';

    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <ctime>
#include <cassert>
#include <complex>
#include <string>
#include <cstring>
#include <chrono>
#include <random>
#include <bitset>
#include<iomanip>
#include<functional>
using namespace std;
typedef long long ll;
#define pi 3.14159265358979323846264338327950L



// a と b の最大公約数を返す関数
long long GCD(long long a, long long b) {
    if (b == 0) return a;
    else return GCD(b, a % b);
}

int main() {
    int a, b, h, m;
    cin >> a >> b >> h >> m;
    long double rad = abs((long double)m * 6 - ((long double)h * 30 + ((long double)m * 6) / 12))/180*pi;
    long double ans = sqrt((long double)(a * a + b * b) - (long double)(2 * a * b * cos(rad)));
    cout << fixed << setprecision(10) << ans << endl;
}


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

int main(){
  ll n; cin >> n ;
  map<ll, ll> m;
  string dest="YES";
  rep(i,n){
    ll a;
    cin >> a;
    m.insert(make_pair(a, a));
  }
  if(m.size()!=n) dest="NO";

  cout << dest;

}

Measured memory_bytes: 12800
#define _USE_MATH_DEFINES
#define INF 100000000

#include <iostream>
#include <sstream>
#include <cmath>
#include <cstdlib>
#include <algorithm>
#include <queue>
#include <stack>
#include <limits>
#include <map>
#include <string>
#include <cstring>
#include <set>
#include <deque>
#include <bitset>
#include <list>
#include <cctype>
#include <utility>

using namespace std;

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

static const double EPS = 1e-8;

int tx[] = {0,1,0,-1};
int ty[] = {-1,0,1,0};

class Point{
public:
	double x;
	double y;
	Point() : x(0),y(0){}
	Point(double _x,double _y){
		x = _x;
		y = _y;
	}
};

class Region{
public:
	int larger_num;
	int smaller_num;
	double size;
	double x;
	double y;
	Region(double _x,double _y,double _size,int _larger_num,int _smaller_num){
		x = _x;
		y = _y;
		size = _size;
		larger_num = _larger_num;
		smaller_num = _smaller_num;
	}

	bool operator<(const Region& r) const{
		return larger_num < r.larger_num;
	}
};

void save(double x,double y,double size,const vector<Point>& points,priority_queue<Region>& que,int maxv){
	int larger_num=0;
	int smaller_num=0;
	double cx = x + (size / 2.0);
	double cy = y + (size / 2.0);

	for(int i=0;i<points.size();i++){
		double d = sqrt((points[i].x - cx) * (points[i].x - cx)
			+ (points[i].y - cy) * (points[i].y - cy));
		if(d <= 1.0) smaller_num++;
		if(d <= 1.0 + (size/2.0)*sqrt(2.0)) larger_num++;
	}

	if(maxv >= larger_num) return;

	que.push(Region(x,y,size,larger_num,smaller_num));
}

int main(){
	int n;
	while(~scanf("%d",&n)){
		if(n==0) break;
		vector<Point> points;
		for(int i=0;i<n;i++){
			double x,y;
			scanf("%lf %lf",&x,&y);
			points.push_back(Point(x,y));
		}

		priority_queue<Region> que;

		int maxv = 1;
		save(0,0,10,points,que,maxv);

		while(!que.empty()){
			Region re = que.top();
			int larger = re.larger_num;
			int smaller = re.smaller_num;
			double size = re.size;
			double x = re.x;
			double y = re.y;

			que.pop();

			if(maxv > larger) continue;
			maxv = max(smaller,maxv);
		
			save(x,y,size/2.0,points,que,maxv);
			save(x+size/2.0,y,size/2.0,points,que,maxv);
			save(x,y+size/2.0,size/2.0,points,que,maxv);
			save(x+size/2.0,y+size/2.0,size/2.0,points,que,maxv);
		}

		printf("%d\n",maxv);
	}
}

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

ll h[100000];
ll dpt[100000];


int main(){
    ll n;
    cin>>n;
    
    for(ll i=0;i<n;i++)
    {
        cin>>h[i];
    }

    dpt[0] =0;
    dpt[1] = abs(h[0]-h[1]);

    for(int i=2;i<n;i++)
    {
        ll a = dpt[i-2] + abs(h[i-2]-h[i]);
        ll b = dpt[i-1] + abs(h[i-1]-h[i]);
        dpt[i] = min(a,b);
    }
    cout<<dpt[n-1];
  
}

Measured memory_bytes: 1792
while True:
    mid, fin, rep = map(int, input().split())
    score = mid + fin
    if mid == -1 and fin == -1 and rep == -1:
        break
    elif mid == -1 or fin == -1:
        print('F')
    elif score >= 80:
        print('A')
    elif 80 > score >= 65:
        print('B')
    elif 65 > score >= 50:
        print('C')
    elif 50 > score >= 30:
        if rep >= 50:
            print('C')
        else:
            print('D')
    else:
        print('F')
    


Measured memory_bytes: 5592
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include<cstdio>
#include<cstring>
#include<queue>
#include<stack>
#include<cmath>
using namespace std;
typedef long long ll;
typedef unsigned long long LL;
typedef pair<int,int> P;
typedef pair<double,double> P_f;
#define rep(i, n) for (int i = 0; i < (int)n; i++)
#define reprev(i, n) for (int i = (int)n - 1; i >= 0; i--)
#define bitrep(bit,n) for(int bit=0; bit<=(1<<n);bit++)
#define MAX 100100
#define MAX_N 200100
#define MAX_T 2001001
#define SENTINEL 20010010010
#define NIL -1
static const int INF = 1 << 29;
const ll INFTY = 1LL<<50;
const int MOD=1e9+7;
LL x;
int main(){
    cin>>x;
    LL remain=x%11;
    LL quot=x/11;
    LL ans=quot*2;
    if(remain<=6 && remain!=0)ans++;
    else if(remain!=0)ans+=2;
    cout<<ans<<endl;
}

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

N = int(input())
B = list(map(int, input().split()))

C = [None] * N
C[0] = B[0]
C[-1] = B[-1]

for i in range(1, N - 1):
    C[i] = min(B[i - 1], B[i])

print(sum(C))

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

 int main() {
 int N, X; cin >> N >> X;
 vector<int> D(N + 1);
 D[0] = 0;
 for (int i = 0; i < N; ++i) {
 int x; cin >> x;
 D[i + 1] = D[i] + x;
 }
 int ans = 0;
 for (int i = 0; i <= N; ++i) {
 if (D[i] <= X) {
 ans++;
 }
 }
 cout << ans << endl;
 return 0;
 }


Measured memory_bytes: 256
using System;

namespace AtCoder
{
    class Program
    {
        public static int CountChar(string s, char c)
        {
            return s.Length - s.Replace(c.ToString(), "").Length;
        }

        static void Main(string[] args)
        {
            int ramen; 
            
            String str = Console.ReadLine();
            int count = CountChar(str,'o');
            switch (count)
            {
                case 0:
                    ramen = 700;
                    Console.WriteLine(ramen);
                    break;
                case 1:
                    ramen = 800;
                    Console.WriteLine(ramen);
                    break;
                case 2:
                    ramen = 900;
                    Console.WriteLine(ramen);
                    break;
                case 3:
                    ramen = 1000;
                    Console.WriteLine(ramen);
                    break;
            }
        }
    }
}


Measured memory_bytes: 13140
#include <bits/stdc++.h>
using namespace std;
int main()
{
    string str;
    cin>>str;
    int n=str.length();
    vector<int> left(n+1,0);
    for(int i=1;i<=n;i++)
    {
        if(str[i-1]=='<')
            left[i]=left[i-1]+1;
        else
            left[i]=0;
    }
    vector<int> right(n+1,0);
    for(int i=n-1;i>=0;i--)
    {
        if(str[i]=='>')
        {
            right[i]=right[i+1]+1;
        }
        else
        {
            right[i]=0;
        }
    }
    long long sum=0;
    for(int i=0;i<=n;i++)
    {
        sum+=(1ll*max(left[i],right[i]));
    }
    cout<<sum<<"\n";
    return 0;
}

Measured memory_bytes: 7640
#include<bits/stdc++.h>
#include<algorithm>
#define int long long
#define what_is(x) cerr << #x << " is " << x << endl;
const int MOD = 1e9 + 7;
using namespace std;
int powmod(int a, int b, int MOD = MOD){
    if(!a and !b)    return 1ll;
    if(!a)    return a;
    int res = 1ll;
    b %= (MOD - 1ll), a %= MOD;
    while(b){
        if(b%2 == 1)    res = (res * a) % MOD;
        a = (a * a) % MOD;
        b /= 2;
    }
    return res;
}
int popcount(uint32_t n)
{
    n = n - ((n >> 1) & 0x55555555);
    n = (n & 0x33333333) + ((n >> 2) & 0x33333333);
    return ((n + (n >> 4) & 0xF0F0F0F) * 0x1010101) >> 24;
}

void solve() {
    int a,b,c;
    cin>>a>>b>>c;
    int t=c-(a-b);
    if(t<0) cout<<0<<"\n";
    else cout<<t<<"\n";
    
}

int32_t main() {
    ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr);
    //cout<<"Hello World"<<"\n";
    //int t;cin>>t;while(t--)
    solve();
   
}

Measured memory_bytes: 256
#include <iostream>
#include <fstream>
#include <cmath>  
#include <cstdlib>
#include <ctime>
#include <algorithm>
#include <numeric>
#include <functional>
#include <string> 
#include <vector>
#include <bitset>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <deque>
#include <random>


using namespace std;
using ll = long long;
using ull = unsigned long long;

#define REP(i,n) for(long long i = 0; i < (n); i++)
#define FOR(i, m, n) for(long long i = (m);i < (n); ++i)
#define ALL(obj) (obj).begin(),(obj).end()

template<class T> using V = vector<T>;
template<class T, class U> using P = pair<T, U>;

const ll MOD = (ll)1e9 + 7;
const ll MOD2 = 998244353;
const ll LLINF = (ll)1e18;
const ll INTINF = (ll)1e9;
const long double PI = 3.1415926535897932384626433;

template <class T> void corner(bool flg, T hoge) { if (flg) { cout << hoge << endl; exit(0); } }
template <class T, class U>ostream &operator<<(ostream &o, const map<T, U>&obj) { o << "{"; for (auto &x : obj) o << " {" << x.first << " : " << x.second << "}" << ","; o << " }"; return o; }
template <class T>ostream &operator<<(ostream &o, const set<T>&obj) { o << "{"; for (auto itr = obj.begin(); itr != obj.end(); ++itr) o << (itr != obj.begin() ? ", " : "") << *itr; o << "}"; return o; }
template <class T>ostream &operator<<(ostream &o, const vector<T>&obj) { o << "{"; for (int i = 0; i < (int)obj.size(); ++i)o << (i > 0 ? ", " : "") << obj[i]; o << "}"; return o; }
template <class T, class U>ostream &operator<<(ostream &o, const pair<T, U>&obj) { o << "{" << obj.first << ", " << obj.second << "}"; return o; }
template <template <class tmp>  class T, class U> ostream &operator<<(ostream &o, const T<U> &obj) { o << "{"; for (auto itr = obj.begin(); itr != obj.end(); ++itr)o << (itr != obj.begin() ? ", " : "") << *itr; o << "}"; return o; }
void print(void) { cout << endl; }
template <class Head> void print(Head&& head) { cout << head; print(); }
template <class Head, class... Tail> void print(Head&& head, Tail&&... tail) { cout << head << " "; print(forward<Tail>(tail)...); }
template <class T> void chmax(T& a, const T b) { a = max<T>(a, b); }
template <class T> void chmin(T& a, const T b) { a = min<T>(a, b); }
void YN(bool flg) { cout << ((flg) ? "YES" : "NO") << endl; }
void Yn(bool flg) { cout << ((flg) ? "Yes" : "No") << endl; }
void yn(bool flg) { cout << ((flg) ? "yes" : "no") << endl; }

int main() {
	int A, B, C, D, E, F, G, H;
	cin >> A >> B >> C >> D >> E >> F >> G >> H;
	cout << max(A + B + C + D, E + F + G + H) << endl;
	return 0;
}




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

void Operate(int& n, const int K) {
	if (n <= K) {
		n *= 2;
	}
	else {
		n += K;
	}
}

int main() {
	int N = 0, K = 0;
	cin >> N >> K;
	int ans = 1;
	for (int i = 0; i < N; i++) {
		Operate(ans, K);
	}
	cout << ans;
}


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

#define ld long double
#define ll long long
#define ALL(a)  (a).begin(),(a).end()
#define ALLR(a)  (a).rbegin(),(a).rend()
#define spa << " " <<
#define MP make_pair
#define test cout<<"test"<<endl;
const ll MOD = 1e9+7;
//const ll MOD = 998244353;
const ll INF = 1e18;
const ll zero=0;
void chmin(ll &a,ll b){if(a>b)a=b;}
void chmax(ll &a,ll b){if(a<b)a=b;}
void pmod(ll &a,ll b){a=(a+b)%MOD;}
void pmod(ll &a,ll b,ll c){a=(b+c)%MOD;}
void qmod(ll &a,ll b){a=(a*b)%MOD;}
void qmod(ll &a,ll b,ll c){a=(b*c)%MOD;}
void ans1(bool x){if(x) cout<<"Yes"<<endl;else cout<<"No"<<endl;}
void ans2(bool x){if(x) cout<<"YES"<<endl;else cout<<"NO"<<endl;}
void ans3(bool x){if(x) cout<<"Yay!"<<endl;else cout<<":("<<endl;}
void ans(bool x,ll y,ll z){if(x)cout<<y<<endl;else cout<<z<<endl;}
void ans(bool x,string y,string z){if(x)cout<<y<<endl;else cout<<z<<endl;}   
ll gcd(ll x,ll y){ll r;while((r=x%y)!=0){x=y;y=r;}return y;}

int main(){
  ll i,j,o;
  ll res=0,res1=INF,res2=-INF,buf=0,buf1=0,buf2=0,buf3=0,buf4=0,sum=0;
  bool judge = true;
  ll n;cin>>n;
  vector<pair<ll,ll>> ab(n);
  for(i=0;i<n;i++){
    cin>>ab[i].second>>ab[i].first;
  }
  sort(ALL(ab));
  buf=0;
  for(i=0;i<n;i++){
    buf+=ab[i].second;
    if(buf>ab[i].first){
      judge=false;
      break;
    }
  }
  ans1(judge);
  
  return 0;
}

Measured memory_bytes: 3328
#include <cstdio>
#include <iostream>
#include <string>

using namespace std;

struct Node
{
  int value;
  Node *right, *left, *parent;
};

Node *root;

Node *treeMin(Node *x)
{
  while (x->left != NULL) x = x->left;
  return x;
}

Node *search(int key)
{
  Node *p = root;
  while (p != NULL)
  {
    if (p->value == key)
    {
      return p;
    }
    else if (p->value > key)
    {
      p = p->left;
    }
    else p = p->right;
  }
  return NULL;
}

Node *treeSuccessor(Node *x)
{
  if (x->right != NULL) return treeMin(x->right);
  Node *y = x->parent;
  while (y != NULL && x == y->right)
  {
    x = y;
    y = y->parent;
  }
  return y;
}

void treeDelete(Node *z)
{
  Node *y;  //y: the (place of) node that is to be deleted
  Node *x;  //x: the child of y
  if (z->left == NULL || z->right == NULL)
  {
    y = z;  //case 1 or 2
  }
  else
  {
    y = treeSuccessor(z);
    z->value = y->value;
  }

  if (y->left != NULL)
  {
    x = y->left;
  }
  else
  {
    x = y->right;
  }

  if (x != NULL) x->parent = y->parent;
  if (y->parent == NULL)
  {
    root = x;
  }
  else
  {
    if (y == y->parent->left)
    {
      y->parent->left = x;
    }
    else
    {
      y->parent->right = x;
    }
  }
}

void insert(int key)
{
  Node *x = root;
  Node *y = NULL;
  Node *in = new Node;
  in->value = key;
  in->left = in->right = in->parent = NULL;
  while (x != NULL)
  {
    y = x;
    if (x->value > key)
    {
      x = x->left;
    }
    else if (x->value < key)
    {
      x = x->right;
    }
  }

  if (y == NULL) root = in;
  else
  {
    in->parent = y;
    if (y->value > key)
    {
      y->left = in;
    }
    else if (y->value < key)
    {
      y->right = in;
    }
  }
}

void inorder(Node *t)
{
  if (t == NULL) return;
  inorder(t->left);
  printf(" %d", t->value);
  inorder(t->right);
}

void preorder(Node *t)
{
  if (t == NULL) return;
  printf(" %d", t->value);
  preorder(t->left);
  preorder(t->right);
}

int main()
{
  // freopen("in.txt", "r", stdin);
  // freopen("out.txt", "w", stdout);
  int n, x;
  string com;
  scanf("%d", &n);

  while (n--)
  {
    cin >> com;
    if (com == "insert")
    {
      scanf("%d", &x);
      insert(x);
    }
    else if (com == "print")
    {
      inorder(root);
      printf("\n");
      preorder(root);
      printf("\n");
    }
    else if (com == "find")
    {
      scanf("%d", &x);
      if (search(x) != NULL) printf("yes\n");
      else printf("no\n");
    }
    else if (com == "delete")
    {
      scanf("%d", &x);
      treeDelete(search(x));
    }
  }
  return 0;
}



Measured memory_bytes: 21940
#include<iostream>
#include<string>
#include<vector>
#include<queue>
#include<algorithm>
#include<cstdint>
using namespace std;

int main()
{
  uint64_t n;

  cin >> n;
  vector<uint64_t> vec;
  vector<uint64_t> vec2;
  vec.resize(n);
  vec2.resize(n);
  for (uint64_t i = 0; i < n; ++i) {
    cin >> vec[i];
    vec2[i] = vec[i];
  }
  sort(vec2.begin(), vec2.end());
  reverse(vec2.begin(), vec2.end());
  for (uint64_t i = 0; i < n; ++i) {
    if (vec[i] == vec2[0]) {
      cout << vec2[1] << endl;
    } else {
      cout << vec2[0] << endl;
    }
  }

  return 0;
}



Measured memory_bytes: 4736
import Control.Monad
import qualified Data.ByteString.Char8 as BS
import Data.Maybe

readInt = fromIntegral . fst . fromJust . BS.readInteger
readIntList = map readInt . BS.words

getInt = readInt <$> BS.getLine
getIntList = readIntList <$> BS.getLine

calcDistance :: Int -> Int -> Int
calcDistance x k | x < k - x = 2 * x
                 | otherwise = 2 * (k - x)

calcAllDistance :: [Int] -> Int -> Int
calcAllDistance xs k = foldr (\ x -> (+) (calcDistance x k)) 0 xs

main = do
  n <- getInt
  k <- getInt
  xs <- getIntList
  print $ calcAllDistance xs k 

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

int main(){
    string s;
    cin>>s;
    int n; n=s.size();
    int count=0;
    for(int i=0;i<n;i++){
        if(s[i]!=s[n-i-1] && i<(n-i-1)){
            count+=1;
        }
        else{
            int uknk=0;
        }
    }
    cout<<count<<endl;
}

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

using namespace std;

using ll = long long;
using pii = pair<int,int>;
using pll = pair<ll,ll>;
using vi = vector<int>;
using vl = vector<ll>;

using _loop_int = int;
#define REP(i,n) for(_loop_int i=0; i<(_loop_int)(n); i++)
#define FOR(i,a,b) for(_loop_int i=(_loop_int)(a); i<(_loop_int)(b); i++)
#define FORR(i,a,b) for(_loop_int i=(_loop_int)(b)-1; i>=(_loop_int)(a); i--)

#define CHMIN(a,b) (a)=min((a),(b))
#define CHMAX(a,b) (a)=max((a),(b))
#define ALL(v) (v).begin(),(v).end()

#define DEBUG(x) cerr<<#x<<": "<<(x)<<endl
#define DEBUG_VEC(v) cerr<<#v<<": ";REP(__i,(v).size())cerr<<((v)[__i])<<", ";cerr<<endl

const ll MOD = 1000000007ll;

#define INF 2e9

int a;

char s[1024];

int main(){

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

    if(a >= 3200){
        printf("%s",s);
    }else{
        printf("red");
    }
    
    return 0;
}

Measured memory_bytes: 256
// #include <bits/stdc++.h>
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <string>
#include <functional>
#include <math.h>
#include <map>
#include <queue>

typedef long long ll;
typedef unsigned long long ull;
#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(i,0,n)
#define RREP(i,n)   RFOR(i,0,n)

const int INF = 1e5;
const int MOD = 1e9+7;

using namespace std;

template <typename _Ty>
ostream& operator << (ostream& ostr, const vector<_Ty>& v) {if (v.empty()) {ostr << "{ }"; return ostr;}
   ostr << "{" << v.front(); for (auto itr = ++v.begin(); itr != v.end(); itr++) {ostr << ", " << *itr;}
   ostr << "}";
   return ostr;}

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; }
typedef pair<int, int> P;

int solve(int H, int W, P start, P goal, vector<vector<char>> maze){
  int sh = start.first;
  int sw = start.second;
  int gh = goal.first;
  int gw = goal.second;

  int dx[4] = {-1, 0, 1, 0};
  int dy[4] = {0, -1, 0, 1};
  vector<vector<int>> dist(H, vector<int>(W, INF));
  dist[sh][sw] = 0;
  queue<P> que;
  que.push(start);
  int ans;
  if (maze[gh][gw] == '#') ans = INF;
  else{
  while (que.size()){
    P val = que.front();
    que.pop();
    int nh = val.first;
    int nw = val.second;
    REP(i, 4){
      int h = nh + dx[i];
      int w = nw + dy[i];
      if (h >= 0  and h < H and w >= 0 and w < W
          and maze[h][w] != '#' and dist[h][w] == INF){
        dist[h][w] = dist[nh][nw] + 1;
        que.push(P(h, w));
      }}
    }
  ans = dist[gh][gw];
  }

  return ans;
}

int main(void){
 ios::sync_with_stdio(false);

 int H,W;
 cin >> H >> W;

 vector<vector<char>> maze(H, vector<char> (W));
 REP(i, H){
   REP(j, W){
     cin >> maze[i][j];
   }
 }

 int ans = 0;
 // get the start indde
 REP(sh, H){
   REP(sw, W){
     REP(gh, H){
       REP(gw, W){
         if (maze[sh][sw] != '#' and maze[gh][gw] != '#'){
           int dis = solve(H, W, P(sh, sw), P(gh, gw), maze);
           ans = max(dis, ans);
         }
       }
     }
     }
   }

 cout << ans << endl;

 return 0;
}



Measured memory_bytes: 256
program d
 integer(8)::a(9)=(/1,2,4,7,12,20,29,38,52/),f(10)=0
 read(*,*) n
 f(3)=1
 do i=4,n
  f(i)=f(i-1)*(a(i-2)+a(i-3)+1)
 enddo
 do i=1,n
  do j=1,n
   write(*,*) merge(0_8,f(max(i,j))*a(min(i,j))+1,i==j)
  enddo
 enddo
end program d

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <math.h>
#include <vector>
#include <string>
#include <queue>
#include <map>
#include <utility>
#include <iomanip>  // std::setprecision()
using namespace std;
using ll = long long;
#define rep(i,a,b) for(int i=(a); i<(b); i++)
#define YES cout << "YES" << endl;
#define NO cout << "NO" << endl;
#define yes cout << "Yes" << endl;
#define no cout << "No" << endl;
ll gcd(ll a, ll b){if (a%b == 0)  return(b);else  return(gcd(b, a%b));}
ll lcm(ll a, ll b){return a * b / gcd(a, b);}
/* map<string,int> */
/* 大文字を小文字に変換 tolower*/
/* 小文字を大文字に変換 toupper*/
/* 辞書順 next_permutation(a.begin(),a.end()) */
 
int main() {
    int n,k;
    cin >> n >>k;
    vector <ll> h(n);
    rep(i,0,n) {cin >> h[i];}
    sort(h.begin(), h.end());
    ll mi = 1000000000;
    rep(i,0,n-k+1) {
        mi = min(mi, h[i+k-1]-h[i]);
    }
    cout << mi <<endl;
}

Measured memory_bytes: 1024
input_nums = input().split()
n = int(input_nums[0])
a = int(input_nums[1])
b = int(input_nums[2])

total = 0

for num in range(1, n+1):
    num_list = list(str(num))
    num_list_int = [int(i) for i in num_list]
    num_list_sum = sum(num_list_int)
    if num_list_sum >= a:
        if num_list_sum <= b:
            total += num
            
print(total)

Measured memory_bytes: 3064
//g++  7.4.0

#include<bits/stdc++.h>
using namespace std;
int main()
{
    int x,a,b;
    cin>>x>>a>>b;
    if(abs(x-a)>abs(x-b)){
        cout<<"B";
    }
    else{
        cout<<"A";
    }
}

Measured memory_bytes: 3564
#include<bits/stdc++.h>
using namespace std ;
#define rep( i, s, t ) for( register int i = s; i <= t; ++ i )
#define re register
#define int long long
int gi() {
	char cc = getchar() ; int cn = 0, flus = 1 ;
	while( cc < '0' || cc > '9' ) {  if( cc == '-' ) flus = - flus ; cc = getchar() ; }
	while( cc >= '0' && cc <= '9' )  cn = cn * 10 + cc - '0', cc = getchar() ;
	return cn * flus ;
}
const int N = 1e5 + 5 ; 
struct node {
	int l, r ; 
} a[N] ; 
int n, Ans, Nxt[N], Pre[N] ; 
bool cmp( node x, node y ) {
	return x.r < y.r ;
}
signed main()
{
	n = gi() ;
	rep( i, 1, n ) a[i].l = gi(), a[i].r = gi(), Ans = max( Ans, a[i].r - a[i].l + 1 ) ; 
	sort( a + 1, a + n + 1, cmp ) ;
	rep( i, 1, n ) Pre[i] = max( Pre[i - 1], a[i].l ) ;
	for( re int i = n; i >= 1; -- i ) Nxt[i] = max( Nxt[i + 1], a[i].l ) ;
	for( re int i = 2; i <= n; ++ i ) {
		int r1 = a[1].r, r2 = a[i].r ;
		int l1 = Pre[i - 1], l2 = a[i].l ;
		if( r1 < l1 ) break ; 
		if( l1 > l2 ) {
			Ans = max( Ans, r2 - l2 + 1 + max( 0ll, r1 - max( l1, Nxt[i + 1] ) + 1 ) ) ;
		}
		else Ans = max( Ans, r1 - l1 + 1 + max( 0ll, r2 - max( l2, Nxt[i + 1] ) + 1 ) ) ;
	}
	cout << Ans << endl ;
	return 0 ;
}

Measured memory_bytes: 3328
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(){
  ll n,a,c,ans = 0,i,j,k;scanf("%lld%lld",&n,&a);
  ll dp[n+1][2501] = {};dp[0][0] = 1;
  for(i=0;i<n;i++){
    scanf("%lld",&c);
    for(k=n-1;k>=0;k--){
      for(j=0;j+c<=2500;j++) dp[k+1][j+c] += dp[k][j];
    }
  }
  for(i=1;i<=n;i++) ans += dp[i][a*i];
  printf("%lld\n",ans);
}

Measured memory_bytes: 1280
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
using P = pair<ll,ll>;
const ll mod = 1e9+7;
#define ALL(x) (x).begin(),(x).end()
#define pow(x,y) modpow(x,y)
#define REP(i,n) for(ll (i)=0;(i)<(n);(i)++)
#define REPS(i,n) for(ll (i)=1;(i)<=(n);(i)++)
#define RREP(i,n) for(ll (i)=(n-1);(i)>=0;(i)--)
#define RREPS(i,n) for(ll (i)=(n);(i)>0;(i)--)
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define UNIQUE(v) v.erase(unique(ALL(v)),v.end());

template <class T = int>T in(){
    T x;
    cin >> x;
    return (x);
}

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

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

signed main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout<<fixed<<setprecision(10);
    ll N = in<ll>();
    ll sum = LLONG_MAX;
    int loop = sqrt(N)+1;
    REPS(i,loop){
        if(N%i == 0){
            chmin(sum,N/i+i-2);
        }
    }
    cout << sum << "\n";
}

Measured memory_bytes: 256
#include<stdio.h>
int main(){
  int i,n;
  int a[50];
  scanf("%d",&n);
  a[0]=1;
  a[1]=1;
  for(i=2;i<=n;i++){
    a[i]=a[i-1]+a[i-2];
  }
  printf("%d\n",a[n]);
}


Measured memory_bytes: 2104
#include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <numeric>
#include <functional>
#include <cmath>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <sstream>
#include <string>
#define _repargs(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define rep(...) _repargs(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define all(x) (x).begin(),(x).end()
#define mod 1000000007
#define inf 2000000007
#define mp make_pair
#define pb push_back
typedef long long ll;
using namespace std;
template <typename T>
inline void output(T a, int p = 0) {
    if(p) cout << fixed << setprecision(p)  << a << "\n";
    else cout << a << "\n";
}
// end of template

int main() {
    cin.tie(0);
    ios::sync_with_stdio(0);
    // source code
    int N;
    cin >> N;
    vector<int> A(N);
    rep(i, N) cin >> A[i];
    A.pb(-100);
    int ans = 0;
    int cur = -1;
    int tmp = 1;
    rep(i, N + 1) {
        if(cur == A[i]) tmp++;
        else {
            ans += tmp / 2;
            tmp = 1;
            cur = A[i];
        }
    }
    output(ans);
    
    return 0;
}


Measured memory_bytes: 256
N, W = map(int, input().split())

v = [0]* N
w = [0]* N

dp = [[0 for i in range(W+1)] for j in range(N+1)]

for k in range(N):
    v[k], w[k] = map(int, input().split())

for i in range(N-1,-1,-1):
    for j in range(W+1):
        if j < w[i]:
            dp[i][j] = dp[i+1][j]
        else:
            dp[i][j] = max(dp[i+1][j], dp[i+1][j-w[i]]+v[i])

print(dp[0][W])

Measured memory_bytes: 26848
#include <bits/stdc++.h>
#define syosu(x) fixed<<setprecision(x)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef pair<double,double> pdd;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<string> vs;
typedef vector<P> vp;
typedef vector<vp> vvp;
typedef vector<pll> vpll;
typedef pair<int,P> pip;
typedef vector<pip> vip;
const int inf=1<<30;
const ll INF=1ll<<60;
const double pi=acos(-1);
const double eps=1e-8;
const ll mod=1e9+7;
const int dx[4]={-1,0,1,0},dy[4]={0,-1,0,1};

int n;
string s;

int main(){
	cin>>n>>s;
	vi a(n);
	int t=0;
	for(int i=0;i<n;i++){
		a[i]=t;
		if(s[i]=='W') t++;
	}
	t=0;
	for(int i=n-1;i>=0;i--){
		a[i]+=t;
		if(s[i]=='E') t++;
	}
	int res=inf;
	for(int i=0;i<n;i++) res=min(res,a[i]);
	cout<<res<<endl;
}

Measured memory_bytes: 1796
package main

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

func main() {
	r := bufio.NewReader(os.Stdin)

	var a, b, m int
	fmt.Scanf("%d %d %d", &a, &b, &m)

	av := make([]int, a)
	bv := make([]int, b)

	N := 200000
	amin, bmin := N, N
	for i := 0; i < a; i++ {
		fmt.Fscan(r, &av[i])
		if amin > av[i] {
			amin = av[i]
		}
	}
	for i := 0; i < b; i++ {
		fmt.Fscan(r, &bv[i])
		if bmin > bv[i] {
			bmin = bv[i]
		}
	}

	res := amin + bmin
	for i := 0; i < m; i++ {
		var x, y, c int
		fmt.Fscan(r, &x, &y, &c)

		t := av[x - 1] + bv[y - 1] - c
		if t < res {
			res = t
		}
	}

	fmt.Println(res)
}


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

int main()
{
	int n;
	cin >> n;
	int z[2][n];
	for (int i = 0; i < n; i++) cin >> z[0][i] >> z[1][i];
	
	sort(z[0], z[0] + n);
	sort(z[1], z[1] + n);
	double mn = z[0][n/2], mx = z[1][n/2];
	if (!(n&1)) {
		mn = (z[0][(n/2) - 1] + mn)/2;
		mx = (z[1][(n/2) - 1] + mx)/2;
	}
	
	long long ans;
	if (n&1) ans = mx - mn + 1 + 1e-3;
	else ans = (2*(mx - mn) + 1 + 1e-3);
	cout << ans;
}

Measured memory_bytes: 5256
#include <algorithm>
#include <cassert>
#include <cfloat>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <deque>
#include <iostream>
#include <iterator>
#include <limits>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>

#define FOR(i,k,n) for(int(i)=(k);(i)<(n);++(i))
#define rep(i,n) FOR(i,0,n)
#define all(v) begin(v),end(v)
#define debug(x) std::cerr<<#x<<": "<<x<<"\n"
#define debug2(x,y) std::cerr<<#x<<": "<<x<<", "<<#y<<": "<<y<<"\n"
#define debug3(x,y,z) std::cerr<<#x<<": "<<x<<", "<<#y<<": "<<y<<", "<<#z<<": "<<z<<"\n"

using ll=long long;
using vi=std::vector<int>;
using vvi=std::vector<vi>;
using vll=std::vector<ll>;
using vvll=std::vector<vll>;
template<typename T> using vvec=std::vector<std::vector<T>>;
template<typename T>
auto make_v(size_t sz){return std::vector<T>(sz);}
template<typename T,typename... Ts>
auto make_v(size_t sz,Ts...ts){return std::vector<decltype(make_v<T>(ts...))>(sz,make_v<T>(ts...));}
template<typename T>
void fill_v(T&var,const T&x){var=x;}
template<typename V,typename T>
void fill_v(V&v,const T&x){for(auto&& w:v){fill_v(w,x);}}

template<typename T> std::ostream& operator<<(std::ostream&s,const std::vector<T>&v){
  int sz=v.size();s<<"\n";rep(i,sz){s<<v[i];if(i<sz-1){s<<"\t";}}s<<"\n";return s;}
template<typename T> std::ostream& operator<<(std::ostream&s,const std::vector<std::vector<T>>&v){
  for(auto&& w:v){s<<w;}return s;}
template<typename T> std::ostream& operator<<(std::ostream&s,const std::deque<T>&v){
  int sz=v.size();s<<"\n";rep(i,sz){s<<v[i];if(i<sz-1){s<<"\t";}}s<<"\n";return s;}
template<typename T> std::ostream& operator<<(std::ostream&s,const std::deque<std::deque<T>>&v){
  for(auto&& w:v){s<<w;}return s;}
template<typename T> std::ostream& operator<<(std::ostream&s, const std::set<T>&v){
  s<<"\n";for(auto&& elm:v){s<<elm<<"\t";}s<<"\n";return s;}

inline void scan(int&a){scanf("%d",&a);}
inline void scan(ll&a){scanf("%lld",&a);}
inline void scan(char&a){scanf(" %c",&a);}
inline void scan(double&a){scanf("%lf",&a);}
template<typename T>
inline void scan(std::vector<T>&v){for(auto&& sv:v){scan(sv);}}
template<typename First,typename...Args>
inline void scan(First&f,Args&...args){scan(f);scan(args...);}
inline void scan(std::string&s){char BUF[3000000];scanf(" %s",BUF);s=std::string(BUF);}
inline void print(int a){printf("%d\n",a);}
inline void print(ll a){printf("%lld\n",a);}
inline void print(double a){printf("%.12f\n",a);}
inline void print(std::string s){std::cout<<s<<"\n";}

using namespace std;

void solve() {
  string s;
  scan(s);
  if (s == "ABC") {
    print("ARC");
  } else {
    print("ABC");
  }
}

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


Measured memory_bytes: 3240
H,W = (int(i) for i in input().split())

C = []
#C[i][j]
for i in range(10):
  C.append([int(j) for j in input().split()])

for s in range(10):
  for i in range(10):
    for j in range(10):
      new_costs = []
      for k in range(10):
        new_costs.append(C[i][k] + C[k][j])

      C[i][j] = min(min(new_costs),C[i][j])

A_dict = {}
for i in range(H):
  A = [int(i) for i in input().split()]
  for a in A:
    A_dict[a] = A_dict.get(a,0)+1

ans = 0
for A in A_dict.keys():
  if A != -1 and A != 1:
    ans += C[A][1]*A_dict[A]

print(ans)


Measured memory_bytes: 3064
#include <iostream>
#include <algorithm>
#include <cstring>
#include <cstdio>
#include<vector>

using namespace std;

int main()
{
    int n;
    scanf("%d", &n);
    int sw[n];
    int i, j;
    for (i = 0; i < n;i++){
        scanf("%d", &sw[i]);
        sw[i] = sw[i] - 1;
    }
    int now = 0, cnt = 0;
    while(1){
        if(now==1){
            printf("%d\n", cnt);
            break;
        }
        if(cnt>=n){
            printf("-1\n");
            break;
        }
        cnt++;
        now = sw[now];
    }

    return 0;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
#define mod 998244353
#define MOD 1000000007
#define inf 0x3f3f3f3f
#define linf 0x3f3f3f3f3f3f3f3fll
typedef long long ll;
typedef pair<int,int> pii;
typedef unsigned long long ull;
const int maxn=1e5+10;
ll ned[maxn];
int n;
ll leavel[maxn],leaver[maxn],pw2[maxn];
int main()
{
	srand(time(0));
	pw2[0]=1;
	for(int i=1;i<=60;i++)
		pw2[i]=pw2[i-1]*2ll;
	for(int i=61;i<maxn;i++)pw2[i]=pw2[i-1];
//	cout<<pw2[maxn-1]<<endl;
	scanf("%d",&n);
//	n=1000;
	for(int i=0;i<=n;i++)
	{
	//	ned[i]=rand()%100;
		scanf("%lld",&ned[i]);
	}
//	ned[n]=rand()+1;
	leavel[n]=leaver[n]=ned[n];
	if(ned[n]>pw2[n])
	{
		printf("-1\n");
		return 0;
	}
	
	for(int lvl=n-1;lvl>=0;lvl--)
	{
		leavel[lvl]=(leavel[lvl+1]+1ll)/2ll;
		leaver[lvl]=leaver[lvl+1];
		
		leavel[lvl]+=ned[lvl];
		leaver[lvl]+=ned[lvl];
		
		leaver[lvl]=min(leaver[lvl],pw2[lvl]);
		if(leavel[lvl]>leaver[lvl])
		{
			printf("-1\n");
			return 0;
		}
	//	cout<<lvl<<" "<<leavel[lvl]<<" "<<leaver[lvl]<<endl;
	}
	ll all=leaver[0],nxt=leaver[0]-ned[0];
	for(int i=1;i<=n;i++)
	{
		nxt*=2ll;
		nxt=min(nxt,leaver[i]);
		all+=nxt;
		if(all<0)
		{
			exit(-1);
		}
		if(nxt<ned[i])
		{
			printf("-1\n");
			return 0;
		}
	//	cout<<i<<" "<<nxt<<" "<<nxt-ned[i]<<" "<<leavel[i]<<" "<<leaver[i]<<" "<<ned[i]<<" "<<pw2[i]<<endl;
	//	system("pause");
		nxt-=ned[i];
	}
//	cout<<nxt<<endl;
	all+=nxt;
	printf("%lld\n",all);
	return 0;
}

Measured memory_bytes: 6848
#include <stdio.h>

#define MAX  200000
#define MAX2 MAX*2



int main(void)
{
	int *d = new int [MAX2];
	for(int i = 0; i < MAX2; i++)
		d[i] = 0;

	d[0] = d[1] = -1;
	//-1は素数ではない事を表す
	for(int i = 3; i < MAX2; i += 2){
		d[i-1] = -1;
		
		if(d[i] != -1){
			for(int j = i * 2; j < MAX2; j += i)
				d[j] = -1;
		}
	}
	d[2] = 0;
	int now = 0;

	for(int i = 0; i < MAX2; i++){
		if(d[i] == -1)
			d[i] = now;
		else {
			now++;
			d[i] = now;
		}
	}

	int n;
	while(scanf("%d", &n), n > 0){
		printf("%d\n", d[n*2] - d[n]);
	}


	delete[] d;
	return 0;
}

Measured memory_bytes: 2328
#template
def inputlist(): return [int(k) for k in input().split()]
#template
N,K = inputlist()
A = inputlist()
from collections import Counter
c = Counter(A)
val = list(c.values())
val.sort()
if len(val)<= K:
    print(0)
    exit()
ans = 0
for i in range(len(val)-K):
    ans += val[i]
print(ans)

Measured memory_bytes: 32520
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
using P = pair<ll,ll>;
const ll mod = 1e9+7;
#define ALL(x) (x).begin(),(x).end()
#define pow(x,y) modpow(x,y)
#define REP(i,n) for(ll (i)=0;(i)<(n);(i)++)
#define REPS(i,n) for(ll (i)=1;(i)<=(n);(i)++)
#define RREP(i,n) for(ll (i)=(n-1);(i)>=0;(i)--)
#define RREPS(i,n) for(ll (i)=(n);(i)>0;(i)--)
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define UNIQUE(v) v.erase(unique(ALL(v)),v.end());

template <class T = int>T in(){
    T x;
    cin >> x;
    return (x);
}

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

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

signed main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout<<fixed<<setprecision(10);
    string s = in<string>();
    string t = in<string>();
    sort(ALL(s));
    sort(ALL(t),greater<>());
    cout << (s < t ? "Yes" : "No") <<  "\n";
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define all(vec) vec.begin(), vec.end()
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
constexpr ll INF = (1LL << 30) - 1LL;
constexpr ll LINF = (1LL << 60) - 1LL;
constexpr double eps = 1e-9;
constexpr ll MOD = 1000000007LL;
template <typename T> bool chmin(T &a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
};
template <typename T> bool chmax(T &a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
};
template <typename T> ostream &operator<<(ostream &os, vector<T> v) {
    for (int i = 0; i < v.size(); i++) {
        os << v[i] << (i + 1 == v.size() ? "\n" : " ");
    }
    return os;
}
template <typename T> vector<T> make_v(size_t a) { return vector<T>(a); }
template <typename T, typename... Ts> auto make_v(size_t a, Ts... ts) {
    return vector<decltype(make_v<T>(ts...))>(a, make_v<T>(ts...));
}
template <typename T, typename V>
typename enable_if<is_class<T>::value == 0>::type fill_v(T &t, const V &v) {
    t = v;
}
template <typename T, typename V>
typename enable_if<is_class<T>::value != 0>::type fill_v(T &t, const V &v) {
    for (auto &e : t) {
        fill_v(e, v);
    }
};
int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    vector<int> a(n);
    bool ff = true;
    for (int i = 0; i < n; i++) {
        cin >> a[i];
        if (i + 1 != a[i]) {
            ff = false;
        }
    }
    if (ff) {
        cout << "YES" << endl;
        return 0;
    }
    for (int i = 0; i < n; i++) {
        for (int j = i + 1; j < n; j++) {
            vector<int> b = a;
            swap(b[i], b[j]);
            bool f = true;
            for (int k = 0; k < n; k++) {
                if (k + 1 != b[k]) {
                    f = false;
                }
            }
            if (f) {
                cout << "YES" << endl;
                return 0;
            }
        }
    }
    cout << "NO" << endl;
}


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

using namespace std;

typedef long long ll;

double getTime() {
  return clock() / (double) CLOCKS_PER_SEC;
}

void read() {};

template<typename T, typename... Args>
void read(T& a, Args&... args) {
  cin >> a;
  read(args...);
}

void print() {};

template <typename T, typename... Args>
void print(T a, Args... args) {
  cout << a << " \n"[sizeof...(args) == 0];
  print(args...);
}

const int N = 1e5 + 5;
const int MOD = 1e9 + 7;

ll get(ll a, ll b) {
  ll res = 1ll;
  while(b) {
    if(b & 1) res = (res * a) % MOD;
    b >>= 1ll;
    a = (a * a) % MOD;
  }
  return res;
}

int main() {
  int n; read(n);
  vector <ll> a(n);
  for(auto &x : a) read(x);
  ll ans = 1e17;
  for(auto can : {-1, 1}) {
    ll sum = 0;
    int cur = can;
    ll cost = 0;
    for(auto x : a) {
      sum += x;
      int p = 0;
      if(sum < 0) p = -1;
      else if(sum > 0) p = 1;
      if(p != cur) {
        cost += abs(sum - cur);
        sum = cur;
      }
      cur = -cur;
    }
    ans = min(ans, cost);
  }
  print(ans);
}

Measured memory_bytes: 1024
c = [list(map(int, input().split())) for _ in range(3)]

a = [0] * 3
b = [0] * 3
ans = "Yes"
a[0] = 0
b[0] = c[0][0] - a[0]
b[1] = c[0][1] - a[0]
b[2] = c[0][2] - a[0]
a[1] = c[1][0] - b[0]
a[2] = c[2][0] - b[0]
for i in range(3):
    for j in range(3):
        if a[i] + b[j] != c[i][j]:
            ans = "No"

print(ans)


Measured memory_bytes: 3064
#include<iostream>
#include<cstring>
#include<cstdio>
#include<vector>
#include<cmath>
#include<algorithm>

using namespace std;

//Nayeem Shahriar Joy,Applied Physics And Electronic Engineering,University of Rajshahi.
int gcd(long int b,long int a)
{
    if(a<b)

    {
        swap(a,b);
    }

    int c=0;

    while(b>0)

    {
        c=a%b;
        a=b;
        b=c;
    }

    return a;
}

int main(){

 long int a,b;
 cin>>a>>b;
 cout<<gcd(a,b)<<endl;

}

Measured memory_bytes: 3088
#include <cstdio>
#include <cstring>
#include <cmath>
#include <vector>
#include <list>
#include <string>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <algorithm>
#include <iostream>
#include <sstream>
using namespace std;

typedef long long int64;
const int inf = (int)1e9;

int main()
{
	while(true) {
		
		int n, k;
		vector<int> x;
		bool zero = false;
		
		scanf("%d%d", &n, &k);
		if(n == 0)
			break;
		x.reserve(k);
		for(int i = 0; i < k; ++i) {
			int t;
			scanf("%d", &t);
			if(t != 0)
				x.push_back(t);
			else
				zero = true;
		}
		
		sort(x.begin(), x.end());
		
		int ans = 1;
		
		if(zero) {
			
			k -= 1;
			
			for(int it = 0; it < k; ++it) {
				
				int r1 = it, r2;
				
				while(++r1 < k) {
					if(x[r1] - x[r1 - 1] != 1)
						break;
				}
				
				r2 = r1;
				
				if(r2 < k && x[r2] - x[r2 - 1] == 2) {
					
					while(++r2 < k) {
						if(x[r2] - x[r2 - 1] != 1)
							break;
					}
					
				}
				
				//printf("[debug] it = %d, %d - %d\n", it, r1, r2);
				
				ans = max(ans, r2 - it + 1);
				
				it = r1 - 1;
			}
			
		} else {
			
			for(int it = 0; it < k; ++it) {
				
				int r = it;
				
				while(++r < k) {
					if(x[r] - x[r - 1] != 1)
						break;
				}
				
				ans = max(ans, r - it);
				
				it = r - 1;
			}
		}
		
		printf("%d\n", ans);
	}
	
	return 0;
}

/* ハラスメントに負けず */
/* 0完太陽にも負けず */
/* はやく人権を獲得したい */
/* nullmineralが書きましたが */
/* 責任はまったくとりません */

Measured memory_bytes: 1264
// parameter "input" gets all data
function Main(input) {
	// the first line is assigned to input[0], the second line is assigned to input[1] similarly.
  var input = input.split("\n");
  var N = parseInt(input[0].split(' ')[0]);
  var A = parseInt(input[0].split(' ')[1]);
  var B = parseInt(input[0].split(' ')[2]);
  var participants = input[1].split('');

  // var arr = tmp.map(function(n){return parseInt(n)});

  var tracker = 0;
  var b_tracker = 0;

  for (var i=0, len=participants.length; i<len; i++){
    switch (participants[i]) {
      case 'a':
        if (tracker<(A+B)){
          console.log('Yes\n');
          tracker++;
        }else{
          console.log('No\n');
        }
        break;
      case 'b':
        if((tracker<(A+B)) && (b_tracker<B)){
          console.log('Yes\n');
          b_tracker++;
          tracker++;
        }else{
          console.log('No\n');
        }
        break;
      case 'c':
        console.log('No\n');
        break;
      default:
        console.log('No\n');
    }

  }

	//output
	// console.log(max_iteration);
}
// Don't edit this line!
Main(require("fs").readFileSync("/dev/stdin", "utf8"));


Measured memory_bytes: 29208
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define PA pair<ll,ll>
#define FOR(I,A,B) for(ll I = int(A); I < int(B); ++I)
#define FORR(I,A,B) for(ll I = int((B)-1); I >= int(A); --I)
#define TO(x,t,f) ((x)?(t):(f))
#define SORT(x) (sort(x.begin(),x.end())) // 0 2 2 3 4 5 8 9
#define POSL(x,v) (lower_bound(x.begin(),x.end(),v)-x.begin()) //xi>=v  x is sorted
#define POSU(x,v) (upper_bound(x.begin(),x.end(),v)-x.begin()) //xi>v  x is sorted
#define NUM(x,v) (POSU(x,v)-POSL(x,v))  //x is sorted
#define REV(x) (reverse(x.begin(),x.end())) //reverse
ll gcd(ll a,ll b){if(a<b)swap(a,b);if(a%b==0)return b;return gcd(b,a%b);}
ll lcm(ll a,ll b){ll c=gcd(a,b);return ((a/c)*(b/c)*c);}//saisyo kobaisu
#define NEXTP(x) next_permutation(x.begin(),x.end())
const ll INF=1e16+7;
const ll MOD=1e9+7;

int main(){
	ll N,M,C,ans=0;
	cin >> N >> M >> C;
	vector<ll> B(M);
	FOR(i,0,M)cin>>B[i];
	FOR(i,0,N){
		ll add = 0;
		FOR(j,0,M){
			ll k;
			cin >> k;
			add += k*B[j];
		}
		if(add+C>0)ans++;
	}
	cout << ans << endl;
}

Measured memory_bytes: 256
s = str(input())
ls = [0]*len(s)
r = 0
l = 0
ind = 0
if s[0] == "R":
    r = 1
else:
    l = 1
for i in range(1,len(s)):
    if s[i-1] == "L" and s[i] == "R":
        ls[ind] = (l - l//2) + r//2
        if ind > 0:
            ls[ind-1] = (r - r//2) + l//2
        l = 0
        r = 1
    elif s[i-1] == "R" and s[i] == "L":
        ind = i
        l += 1
    else:
        if i == len(s)-1:
            if s[i] == "L":
                l += 1
                ls[ind] = (l - l//2) + r//2
                if ind > 0:
                    ls[ind-1] = (r - r//2) + l//2
                r = 0
                l = 0
            else:
                r += 1
                ls[-1] = r
                r = 0
        else:
            if s[i] == "R":
                r += 1
            else:
                l += 1
if r != 0 and l != 0:
    ls[ind] = (l - l//2) + r//2
    if ind > 0:
        ls[ind-1] = (r - r//2) + l//2
elif r != 0:
    ls[-1] = r
print(*ls)

Measured memory_bytes: 78644
n = input()
a = 0
b = 0
c = 0

for i in n:
	if i == "a":
		a += 1
	elif i == "b":
		b += 1
	elif i == "c":
		c += 1
if a == 1 and b == 1 and c == 1:
	print("Yes")
else :
	print("No")

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

int main(){
  int N; cin >> N;
  int pre=0;
  for(int i=0; i<N; i++){
    int h; cin >> h;
    if(pre<h) pre=h-1;
    else if(pre==h) pre=h;
    else{
      cout << "No" << endl;
      return 0;
    }
  }
  cout << "Yes" << endl;
} 

Measured memory_bytes: 256