akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0, i##_len = (n); i < i##_len; ++i)
#define rep2(i, x, n) for(int i = x, i##_len = (n); i < i##_len; ++i)
#define all(n) begin(n), end(n)
using ll = long long;
using P = pair<ll, ll>;
using vi = vector<int>;
using vl = vector<ll>;
using vs = vector<string>;
using vc = vector<char>;
using vb = vector<bool>;
using vd = vector<double>;
vi dir = {-1, 0, 1, 0, -1, -1, 1, 1, -1};

int main() {
  ll n, k;
  cin >> n >> k;
  ll ans = 0;
  rep(i, n) {
    ll h;
    cin >> h;
    if(h >= k) ans++;
  }
  cout << ans << endl;
}

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

X = list(map(int,input().split()))

add = []

for p in range(1000):
    psum = 0
    for i in range(N):
        power = (X[i] - p)**2
        psum = psum + power
        i = i + 1
    add.append(psum)
    
print(min(add))
    

Measured memory_bytes: 3060
#include <math.h>

#include <algorithm>
#include <iostream>
#include <string>
#include <vector>
using namespace std;
#define PI 3.14159265358979323846264338327950L
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define SIZE_OF_ARRAY(array) (sizeof(array) / sizeof(array[0]))

int main() {
  int A, B;
  cin >> A >> B;
  int ans = 0;
  int tap = 1;

  while (tap < B) {
    tap--;
    tap += A;
    ans++;
  }
  cout << ans << endl;
}


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

int main()
{
    double l;
    cin >> l;
    double a,b,c;
    a=l/3.0;
    b=l/3.0;
    c=l/3.0;
    cout << fixed << setprecision(15) <<a*b*c;


}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define endl "\n"
using namespace std;
typedef long long int lli;
int main()
{
    ios::sync_with_stdio(0); 
    cin.tie(0); cout.tie(0);
    lli n,m;
    cin>>n>>m;
    lli i,a[n],ans=0,sum=0;
    for(i=0;i<n;i++) cin>>a[i],sum+=a[i];
    
    for(i=0;i<n;i++) if(a[i]*(4*m)>=sum) ans++;
    
    if(ans>=m) cout<<"Yes";
    else cout<<"No";
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define debug(x) cerr << #x << ':' << x << endl
#define REP(i,n) for(int i=0;i<(int)n;++i)
#define ALL(c) (c).begin(), (c).end()
using namespace std;
typedef long long ll;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    string s;
    cin >> s;
    int n = s.size();
    
    vector<int> L(n, 0), R(n,0);
    int cnt = 0;
    for(int i=0; i<n; i++){
        if (s[i]=='R'){
            cnt+=1;
        }
        else{
            R[i] = cnt;
            cnt=0;
        }
    }
    cnt = 0;
    for(int i=n-1; 0<=i; i--){
        if (s[i]=='L'){
            cnt+=1;
        }
        else{
            L[i] = cnt;
            cnt=0;
        }
    }
    // for(int i=0; i<n; i++){
    //     cout << R[i] << " ";
    // }
    // cout << endl;
    // for(int i=0; i<n; i++){
    //     cout << L[i] << " ";
    // }
    // cout << endl;

    vector<int> T(n, 0);    
    for(int i=0; i<n; i++){
        T[i] = L[i]+R[i];
    }
    // for(int i=0; i<n; i++){
    //     cout << T[i] << " ";
    // }
    // cout << endl;

    for(int i=0; i<n-1; i++){
        if(T[i]==0)continue;
        else{
            int tmp = T[i]+T[i+1];
            if( tmp%2==0 ){
                T[i] = tmp/2;
                T[i+1] = tmp/2;
            }
            else{
                if(T[i+1]%2==1){
                    T[i]=1;
                    T[i+1]=0;
                }
                else {
                    T[i]=0;
                    T[i+1]=1;
                }
                tmp--;
                T[i] += tmp/2;
                T[i+1] += tmp/2;
            }
            i++;
        }
    }

    for(int i=0; i<n; i++){
            cout << T[i] << " ";
        }
        cout << endl;

    return 0;
}

Measured memory_bytes: 1872
#include<bits/stdc++.h>
#define ll long long int
using namespace std;
int main()
{
    ll t,a,b,i,j,k,n;

    char c;
    cin>>a>>c>>b;
    if(c=='+')
    {
        cout<<a+b<<endl;
    }
    else
        cout<<a-b<<endl;
    //cout<<(n*(n+1))/2<<endl;
    return 0;
}


Measured memory_bytes: 3576
#include<bits/stdc++.h>
using namespace std;
const bool debug =0;

inline void read(int &x){
    char ch;
    bool flag=false;
    for (ch=getchar();!isdigit(ch);ch=getchar())if (ch=='-') flag=true;
    for (x=0;isdigit(ch);x=x*10+ch-'0',ch=getchar());
    x=flag?-x:x;
}

inline void write(int x){
    static const int maxlen=100;
    static char s[maxlen];
    if (x<0) {   putchar('-'); x=-x;}
    if(!x){ putchar('0'); return; }
    int len=0; for(;x;x/=10) s[len++]=x % 10+'0';
    for(int i=len-1;i>=0;--i) putchar(s[i]);
}

const int MAXN = 610000;

char s[ MAXN ];
int n;

vector<int> a[3];

int tag[ MAXN ];
int sum_st[ MAXN ];
int sum_ed[ MAXN ];
int nex_mid[ MAXN ];

const int P =998244353;

int main(){
    read(n);
    scanf("%s",s+1);
    for (int i=1;i<=3*n;i++)
    if ( s[i]=='R' )
        a[0].push_back(i);
    else
    if ( s[i]=='G' )
        a[1].push_back(i);
    else
        a[2].push_back(i);

    for (int i=0;i<n;i++)
    {
        int x=a[0][i];
        int y=a[1][i];
        int z=a[2][i];
        int st=min( min( x , y ) , z );
        int ed=max( max( x , y ) , z );
        tag[ st ] =1;
        tag[ ed ] =-1;
    }

    int last=0;
    for (int i=1;i<=3*n;i++)
    if ( tag[i]==0 )
    {
        nex_mid[ i ] = last;
        last = i;
    }

    for (int i=1;i<=3*n;i++)
    {
        sum_st[i]=sum_st[i-1];
        if ( tag[i]==1 )
            sum_st[i]++;
    }

    for (int i=1;i<=3*n;i++)
    {
        sum_ed[i]=sum_ed[i-1];
        if ( tag[i]==-1 )
            sum_ed[i]++;
    }

    /*
    for (int i=1;i<=3*n;i++)
        printf("%d ",tag[i]);
    puts("");
    */

    long long now=0;
    long long ans=1;
    for (int i=1;i<=3*n;i++)
    if ( tag[i] == 0 )
    {
        ans=ans*now%P;
        now--;
    }
    else
    if ( tag[i]==1 )
        now++;


    assert(now==0);
    for (int i=3*n;i>=1;i--)
    if ( tag[i] == 0 )
    {
        ans=ans*now%P;
        now--;
    }
    else
    if ( tag[i]==-1 )
        now++;
    for (int i=1;i<=n;i++)
        ans=ans*i%P;

    cout<<ans<<endl;

    return 0;
}


Measured memory_bytes: 9328
#include <cstdio>
#include <iostream>
#include <cstring>
#include <algorithm>
#include <cmath>
#include <vector>
#include <map>
#include <set>
#include <string>
#include <cstdlib>
#include <ctime>
#include <deque>
using namespace std;

#define P 1000000007
int n, x[110000];

int main() {
	int ans = 1;
	scanf("%d", &n);
	for (int i = 1; i <= n; i++)
		scanf("%d", &x[i]);
	int nowx = 1, prex = 1;
	for (int i = 2; i <= n; i++) {
		// printf("?? %d %d\n", x[i], prex);
		if (x[i] == prex + 1) {
			// printf("?? %d\n", nowx);
			ans = 1LL * ans * (nowx + 1) % P;
		}else {
			nowx += 1;
			prex += 2;
		}
	}
	// printf("hehe %d\n", nowx);
	for (int i = 1; i <= nowx; i++)
		ans = 1LL * ans * i % P;
	printf("%d\n", ans);
}


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

int main() {

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

    int a[502][502];

    for(int i = 1; i <= H ; ++i ) for(int j = 1; j <= W ; ++j ) cin >> a[i][j];

    int N = 0;

    vector<int> y[2], x[2];

    for(int i = 1; i <= H ; ++i ) for(int j = 1; j < W ; ++j ) {
        if( a[i][j] % 2 == 0 ) continue;
        y[0].push_back( i ); y[1].push_back( i );
        x[0].push_back( j ); x[1].push_back(j+1);
        ++N;
        --a[i][j];
        ++a[i][j+1];
    }

    for(int i = 1; i < H ; ++i ) {
        if( a[i][W] % 2 == 0 ) continue;
        y[0].push_back( i ); y[1].push_back(i+1);
        x[0].push_back( W ); x[1].push_back( W );
        ++N;
        --a[i][W];
        ++a[i+1][W];
    }
    
    cout << N << endl;

    for(int i = 0; i < N ; ++i ) {
        cout << y[0][i] << ' ';
        cout << x[0][i] << ' ';
        cout << y[1][i] << ' ';
        cout << x[1][i] << endl;
    }

    return 0;
}


Measured memory_bytes: 5224
import java.util.*;

public class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);

		while(true){
			int n = sc.nextInt();
			int r = sc.nextInt();
			if(n == 0 && r == 0) break;

			ArrayList<Integer> al = new ArrayList<Integer>();
			for(int i=1;i<=n;i++){
				al.add(i);
			}

			for(int i=0;i<r;i++){
				int p = sc.nextInt();
				int c = sc.nextInt();
				for(int j=0;j<c;j++){
					al.add(al.remove(al.size()-p-c+1));
				}
			}

			System.out.println(al.get(al.size()-1));
		}
	}
}

Measured memory_bytes: 12000
// 2011/09/28 Tazoe

#include <iostream>
#include <vector>
using namespace std;

int main()
{
	while(true){
		int n, m, h, k;
		cin >> n >> m >> h >> k;
		if(n==0&&m==0&&h==0&&k==0)
			break;

		int tate[1000];
		for(int i=0; i<n; i++)
			cin >> tate[i];

		vector<int> yoko[1000];
		for(int i=0; i<m; i++){
			int a, b;
			cin >> a >> b;
			yoko[b-1].push_back(a-1);
		}

		for(int i=h-1; i>=0; i--)
			for(int j=0; j<yoko[i].size(); j++){
				int tmp = tate[yoko[i][j]];
				tate[yoko[i][j]] = tate[yoko[i][j]+1];
				tate[yoko[i][j]+1] = tmp;
			}

		int sum = 0;
		for(int i=0; i<k; i++)
			sum += tate[i];

		int min2 = sum;

		int tate2[1000];
		for(int i=0; i<n; i++)
			tate2[i] = i;

	for(int I=0; I<h; I++)
		for(int J=0; J<yoko[I].size(); J++){

			int M = tate2[yoko[I][J]];
			int N = tate2[yoko[I][J]+1];

			tate2[yoko[I][J]] = N;
			tate2[yoko[I][J]+1] = M;

			if(M>N){
				int tmp = M;
				M = N;
				N = tmp;
			}

			if(M<k&&N>=k&&tate[M]>tate[N]&&min2>sum-tate[M]+tate[N])
				min2 = sum-tate[M]+tate[N];
		}

		cout << min2 << endl;
	}

	return 0;
}

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

int main(int argc, char **argv)
{
	int n, k;
	double ans;
	cin >> n >> k;

	double res{0.0};
	for (int num = 1; num <= n; ++num)
	{
		double per = 1.0/n;
		int score = num;
		while (true)
		{
			if (score >= k)
				break;
			score *= 2;
			per *= 0.5;
		}
		res += per;
	}

	std::cout << fixed << setprecision(10) <<res << std::endl;
}

Measured memory_bytes: 256
#include <string>
#include <queue>
#include <stack>
#include <vector>
#include <sstream>
#include <algorithm>
#include <deque>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <list>
#include <cstdio>
#include <iostream>
#include <cmath>
#include <climits>
#include <bitset>
#include <functional>
#include <numeric>
#include <ctime>
#include <cassert>
#include <cstring>
#include <fstream>

using namespace std;

int calc(vector<vector<int>> &m, vector<int> col, vector<vector<int>> &d, vector<vector<int>> &changecost) {
    int cost = 0;
    for (int i = 0; i < 3; i++) {
        cost += changecost[i][col[i]-1];
    }
    return cost;
}

int recur(vector < vector<int>> &m, vector<vector<int>> &d, int c) {
    vector<vector<int>> changecost(3, vector<int>(c, 0));
    for (int i = 0; i < 3; i++) {
        for (int j = 1; j <= c; j++) {
            for (auto t : m[i]) {
                changecost[i][j - 1] += d[t - 1][j - 1];
            }
        }
    }
    int minx = 2000000000;
    for (int i = 1; i <= c; i++) {
        for (int j = 1; j <= c; j++) {
            for (int k = 1; k <= c; k++) {
                if (i == j || j == k || k == i)
                    continue;
                vector<int> col = { i, j, k };
                minx = min(minx, calc(m, col, d, changecost));
            }
        }
    }
    return minx;

}


int main() {
    int n, c;
    cin >> n >> c;
    vector<vector<int>> d(c, vector<int>(c));
    vector<vector<int>> color(n, vector<int>(n));
    for (int i = 0; i < c; i++) {
        for (int j = 0; j < c; j++) {
            cin >> d[i][j];
        }
    }
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < n; j++) {
            cin >> color[i][j];
        }
    }
    vector<vector<int>> m(3);
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < n; j++) {
            m[(i + j) % 3].push_back(color[i][j]);
        }
    }
    for (auto &t : m)
        sort(t.begin(), t.end());

    cout << recur(m, d, c) << endl;
    return 0;
}

Measured memory_bytes: 2428
#include <iostream>
#include <vector>
#include <array>
#include <deque>
#include <stack>
#include <queue>
#include <list>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <algorithm>
#include <numeric>
#include <utility>
#include <cmath>
#include <iomanip>
#include <cassert>
#include <complex>
#include <bitset>
#include <functional>

using namespace std;
using ll=long long int;

int main() {
    int h, w, n;
    cin >> h >> w >> n;

    int t = max(h, w);

    int ans = (n + t - 1) / t;
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256
// A.cpp : このファイルには 'main' 関数が含まれています。プログラム実行の開始と終了がそこで行われます。
//

#include <iostream>
using namespace std;
int main()
{
    int n, p;
    cin >> n >> p;

    cout << (n * 3 + p) / 2 << endl;

    return 0;
    
}



Measured memory_bytes: 3644
program ABC087C
    implicit none
    integer(8)::N,i,j
    integer(8),allocatable,dimension(:,:)::A,dp
    read*,N
    allocate(A(N,2))
    allocate(dp(N,2))
    read*,A
    dp=0

    do i=1,2
        do j=1,N
            if(i==1)then
                if(j==1)then
                    dp(j,i)=A(j,i)
                else
                    dp(j,i)=dp(j-1,i)+A(j,i)
                end if
            else
                if(j==1)then
                    dp(j,i)=dp(j,i-1)+A(j,i)
                else
                    dp(j,i)=max(dp(j-1,i),dp(j,i-1))+A(j,i)
                end if
            end if
        end do
    end do

    print'(i0)',dp(N,2)
end program ABC087C

Measured memory_bytes: 256
#pragma once
#include <sstream>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
#include <iostream>
#include <utility>
#include <set>
#include <cctype>
#include <queue>
#include <stack>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <deque>
using namespace std;
void BuyingSweets() {
	int X, A, B;
	cin >> X >> A >> B;
	int xa = X - A;

	cout << (xa - (xa / B) * B) << endl;
}
int main() {
	BuyingSweets();
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <map>
#include <unordered_map>
#include <queue>
#include <set>
#include <algorithm>
#include <string>
#include <math.h>
#include <limits.h>
#include <stack>
#include <complex>
#include <stdlib.h>
#include <stdio.h>
#include <functional>
#include <cfloat>
#include <math.h>
#include <numeric>
#include <string.h>
#include <sys/time.h>
#include <random>


#define fs first
#define sc second
#define endl "\n"

using namespace std;

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

class modInt{
    ll value;
    static const ll mod = 998244353;

public:
    modInt(ll x=0): value{x % mod}{}

    inline modInt& operator+=(modInt x){
        value = (value + x.value) % mod;
        return *this;
    }

    inline modInt& operator-=(modInt x){
        value = (value + mod - x.value) % mod;
        return *this;
    }

    inline modInt& operator*=(modInt x){
        value = (value * x.value) % mod;
        return *this;
    }


    inline modInt operator/=(modInt x){
        *this *= x.inv();
        return *this;
    }

    inline modInt pow(modInt x, int n){
        modInt res = modInt(1LL);
        while(n > 0){
            if(n & 1)   res *= x;
            x *= x;
            n >>= 1;
        }
        return res;
    }

    inline modInt inv(){
        modInt res = pow(value, mod-2);
        return res;
    }

    inline ll get(){
        return value;
    }
};

modInt operator+(modInt x, modInt y){
    return x += y;
}

modInt operator-(modInt x, modInt y){
    return x -= y;
}

modInt operator*(modInt x, modInt y){
    return x *= y;
}

modInt operator/(modInt x, modInt y){
    return x /= y;
}

ostream& operator<<(ostream& os, modInt x){
    return os << x.get();
}


class modIntCombinations{
    vector<modInt> factArray;

    void make_fact(ll x){
        for(auto i = factArray.size(); i <= x+1; i++){
            modInt y = factArray[i-1] * i;
            factArray.push_back(y);
        }
    }

public:
    modIntCombinations(){
        factArray.emplace_back(1);
    }

    modInt fact(ll x){
        if(factArray.size() < x+1){
            make_fact(x);
        }
        return factArray[x];
    }

    modInt comb(ll n, ll k){
        if(n < k){
            return modInt{0};
        }
        else{
            return fact(n) / fact(k) / fact(n - k);
        }
    }

    modInt perm(ll n, ll k){
        if(n < k){
            return modInt{0};
        }
        else{
            return fact(n) / fact(k);
        }
    }
};


int main(){
    string s, t;    cin >> s >> t;
    for(int i = 0; i < s.length(); i++){
        if(s[i] != t[i]){
            cout << "No" << endl;
            return 0;
        }
    }

    cout << "Yes" << endl;



    return 0;
}


Measured memory_bytes: 3632
#include <bits/stdc++.h>
#include <boost/range/algorithm.hpp>
#include <boost/range/numeric.hpp>
#include <boost/integer/common_factor.hpp>
#include <boost/integer/common_factor_rt.hpp>
#include <boost/multiprecision/cpp_dec_float.hpp>

using std::string;
using std::vector;
using std::set;
using std::multiset;
using std::unordered_set;
using std::map;
using std::multimap;
using std::unordered_map;
using std::pair;
using std::cin;
using std::cout;

typedef uintmax_t    ull;
typedef intmax_t     ll;
typedef uint64_t     ul;
typedef uint32_t     ui;
typedef uint8_t      uc;

typedef boost::multiprecision::number<boost::multiprecision::cpp_dec_float<1000>> cpp_dec_float_1000;

constexpr char CRLF = '\n';
constexpr char SPACE = ' ';
constexpr char VECTOR_COUT_SEPARATOR = SPACE;
constexpr ll INF = 1000'000'007;

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; }
template<class T> std::ostream& operator<< (std::ostream& os, const std::vector<T>& vc) { for(auto it = vc.begin(); it != vc.end(); ++it) { if (std::next(it) == vc.end()) os << *it; else os << *it << VECTOR_COUT_SEPARATOR; } return os; }
template<class T1, class T2> inline std::ostream & operator<< (std::ostream & os, const std::pair<T1, T2> & p) { return os << p.first << ' ' << p.second; }

void solve(void)
{
  ui N, X; cin >> N >> X;
  vector<ui> m(N);
  for(auto& i : m) cin >> i;
  boost::sort(m);
  X -= boost::accumulate(m, 0U);
  ull res = N;

  for(auto it = m.begin(); it != m.end(); ++it)
  {
    if(X < *it)
      break;
    while(X >= *it)
    {
      ++res;
      X -= *it;
    }

  }

  cout << res << CRLF;
  return;
}

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

  solve();

  return 0;
}


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

int main() {
  int n,m; cin >>n >>m;
  cout <<(n-1)*(m-1) <<endl;
  return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
int main()
{
	int n;int j=0;
	scanf("%d",&n);
	char s[n+1];
	scanf("%s",s);
	for(int i=0;s[i]!='\0';i++)
	{
		if(s[i]=='A'&&s[i+1]=='B'&&s[i+2]=='C')
		j++;
	}
	printf("%d",j);
	return 0;
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
#include<atcoder/all>
using namespace std;
using namespace atcoder;
using ll=long long;
template<class T,class U> inline bool chmin(T&x,U y){if(x>y){x=y;return true;}return false;}
template<class T,class U> inline bool chmax(T&x,U y){if(x<y){x=y;return true;}return false;}
#define fr(i,n) for(int i=0;i<(n);++i)
#define Fr(i,n) for(int i=1;i<=(n);++i)
#define ifr(i,n) for(int i=(n)-1;i>=0;--i)
#define iFr(i,n) for(int i=(n);i>0;--i)

void solve(){
    int n,m;
    cin>>n>>m;
    scc_graph g(n);
    {
        int a,b;
        fr(i,m){
            cin>>a>>b;
            g.add_edge(a,b);
        }
    }
    auto s=g.scc();
    cout<<s.size()<<'\n';
    for(auto&c:s){
        cout<<c.size()<<" ";
        for(auto&i:c) cout<<i<<" ";
        cout<<'\n';
    }
}

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

Measured memory_bytes: 40624
const input = require("fs").readFileSync("/dev/stdin", "utf8").split(/\s/);
const a = input[0] - 0 + (input[1] - 0);
const b = input[2] - 0 + (input[3] - 0);
console.log(a < b ? "Right" : a > b ? "Left" : "Balanced");

Measured memory_bytes: 7624
n = int(input())
ab = [tuple(map(int, input().split())) for _ in range(n)]
cd = [tuple(map(int, input().split())) for _ in range(n)]
ab.sort(key=lambda x: (-x[1], x[0]))
cd.sort(key=lambda x: (x[0], x[1]))
s = [0] * n

for i in range(n):
    for j in range(n):
        if s[j] == 0 and ab[j][0] < cd[i][0] and ab[j][1] < cd[i][1]:
            s[j] = 1
            break
print(sum(s))


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

 int main(){
  string s;
   cin >> s;
   
   if(s[0] == s[1] && s[1] == s[2]){
     cout << "No" << endl;
   }
   
   else{
     cout << "Yes" << endl;
   }
   
 }

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <ios>
#include <iomanip>
#include <stack>
#include <queue>
#include <algorithm>

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

using namespace std;

const int INF = 100000000;

int main(){
  int s;
  cin >> s;
  vector<int> a = vector<int>(1,s);

  int i = 1;
  int ans =0;
  while(true){
    int next;
    if (a[i-1] % 2 == 0) {
      next = a[i-1]/2;
    }else{
      next = 3 * a[i-1] + 1;
    }

    REP(j,a.size()){
      if (next == a[j]) {
        ans = i;
        break;
      }
    }
    if (ans != 0) {
      break;
    }
    a.push_back(next);
    i++;
  }

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

Measured memory_bytes: 256
//#include "debug.h"
#include <string.h>
#include <limits.h>
#include <map>
#include <set>
#include <vector>
#include <algorithm>
using namespace std;

//#include "set/union_find.h"

struct ufs {
	int n;
	vector<int> f, c;

	ufs(int n=0) {
		resize(n);
	}

	void resize(int sz) {
		n = sz;
		f.resize(n);
		c.resize(n);
		for (int i=0; i<n; i++)
			f[i] = i, c[i] = 1;
	}

	int find(int v) {
		int r, u;
		for(r=v; f[r]!=r; r=f[r]);
		for(u=v; u!=r; ) {
			int t = f[u];
			f[u] = r;
			u = t;
		}
		return r;
	}

	int merge(int a, int b) {
		a = find(a);
		b = find(b);
		if (a!=b) {
			f[a] = b;
			c[b] += c[a];
		}
		return b;
	}

	int count(int v){
		return c[find(v)];
	}
};


#define MAXN 100000

int n, m;
int a[MAXN];

int input() {
	if (scanf("%d %d", &n, &m) < 0) return 0;
	for (int i=0; i<n; i++) {
		scanf("%d", &a[i]);
		a[i]--;
	}
	return 1;
}

void init() {
}

long solve() {
	ufs u(n);
	for (int i=0; i<m; i++) {
		int x, y;
		scanf("%d %d", &x, &y);
		x--, y--;
		u.merge(a[x], a[y]);
	}
	int r = 0;
	for (int i=0; i<n; i++)
		if (u.find(i) == u.find(a[i])) r++;
	return r;
}

void output(long ans) {
	printf("%ld\n", ans);
}

void cleanup() {
}

int main() {
	while (input()) {
		init();
		output(solve());
		cleanup();
		//break;
	}
}





Measured memory_bytes: 1408
#include <cstdio>

void process() {
    int a, b;
    char op;

    int res;
    do {
        scanf(" %d %c %d", &a, &op, &b);

        switch(op) {
            case '+':
                res = a+b;
                break;

            case '-':
                res = a-b;
                break;

            case '*':
                res = a*b;
                break;

            case '/':
                res = a/b;
                break;

            default:
                return;
        }

        printf("%d\n", res);
    } while( true );
}

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



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

int main(){
  string w, t;
  int answer = 0;
  cin >> w;

  while(true){
    cin >> t;
    if(t == "END_OF_TEXT") break;
    for(int i=0; i<t.size(); i++){
      t[i] = tolower(t[i]);
    }
    if(t == w) answer++;
  }

  cout << answer << endl;
}

Measured memory_bytes: 3220
import math
import fractions
#import sys
#input = sys.stdin.readline

def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    # divisors.sort()
    return divisors

def ValueToBits(x,digit):
    res = [0 for i in range(digit)]
    now = x
    for i in range(digit):
        res[i]=now%2
        now = now >> 1
    return res

def BitsToValue(arr):
    n = len(arr)
    ans = 0
    for i in range(n):
        ans+= arr[i] * 2**i
    return ans

def ZipArray(a):
    aa = [[a[i],i]for i in range(n)]

    aa.sort(key = lambda x : x[0])
    for i in range(n):
        aa[i][0]=i+1
    aa.sort(key = lambda x : x[1])
    b=[aa[i][0] for i in range(len(a))]
    return b

def ValueToArray10(x, digit):
    ans = [0 for i in range(digit)]
    now = x
    for i in range(digit):
        ans[digit-i-1] = now%10
        now = now //10
    return ans

def Zeros(a,b):
    if(b<=-1):
        return [0 for i in range(a)]
    else:
        return [[0 for i in range(b)] for i in range(a)]

class Bit:
    def __init__(self, n):
        self.size = n
        self.tree = [0] * (n + 1)
 
    def sum(self, i):
        s = 0
        while i > 0:
            s += self.tree[i]
            i -= i & -i
        return s
 
    def add(self, i, x):
        while i <= self.size:
            self.tree[i] += x
            i += i & -i


'''
def cmb(n, r, p):
    if (r < 0) or (n < r):
        return 0
    r = min(r, n - r)
    return fact[n] * factinv[r] * factinv[n-r] % p

p = 2
N = 10 ** 6 + 2
fact = [1, 1]  # fact[n] = (n! mod p)
factinv = [1, 1]  # factinv[n] = ((n!)^(-1) mod p)
inv = [0, 1]  # factinv 計算用

for i in range(2, N + 1):
    fact.append((fact[-1] * i) % p)
    inv.append((-inv[p % i] * (p // i)) % p)
    factinv.append((factinv[-1] * inv[-1]) % p)

'''

#a = list(map(int, input().split()))

#################################################
#################################################
#################################################
#################################################



s = input()
n = len(s)
s += "zzzzzzzzzzzzzzzzzzz"
t = ""
while(True):
    if(n - len(t) <= 4):
        break
    if(s[len(t)+2]=='a' and s[len(t)+5]=='r'):
        t+="eraser"
        continue
    elif(s[len(t)+2]=='a'):
        t+="erase"
    elif(s[len(t)+7]=='a' or s[len(t)+5]=='z' or s[len(t)+5]=='d'):
        t+="dream"
    else:
        t+="dreamer"
        
if(s[0:n]==t):
    print("YES")
else:
    print("NO")
#print(s[0:n],t)





































Measured memory_bytes: 147596
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <ctime>
#include <cassert>
#include <iostream>
#include <cctype>
#include <sstream>
#include <string>
#include <list>
#include <vector>
#include <queue>
#include <set>
#include <stack>
#include <map>
#include <utility>
#include <numeric>
#include <algorithm>
#include <iterator>
#include <bitset>
#include <complex>
#include <fstream>
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> T RoundOff(T a){ return int(a+.5-(a<0)); }
template<class T, class C> void chmax(T& a, C b){ if(a < b) a = b; }
template<class T, class C> void chmin(T& a, C b){ if(b < a) a = b; }
template<class T, class C> pair<T, C> mp(T a, C b){ return make_pair(a, b); }

template<class T>
vector<T> getPrimeList(T max)
{
	vector<T> table;

	table.push_back(2);

	for(T i = 3; i <= max; i++)
	{
		bool flag = true;
		for(T j = 2; j*j <= i; j++)
		{
			if(!(i % j))
			{
				flag = false;
				break;
			}	
		}
		if(flag) table.push_back(i);
	}

	return table;
}

int main()
{
	vint p = getPrimeList(104729);
	partial_sum(ALL(p),p.begin());

	int n;

	while(cin >> n && n)
	{
		cout << p[n-1] << endl;
	}
}

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

double dp[3000][3000];
// dp[index][heads] = probability
double p[3000];

int main(){
	int n;
	cin>>n;
	for(int i = 0; i<n; i++){
		cin>>p[i];
	}
	
	dp[0][0] = (1-p[0]);
	dp[0][1] = p[0];
	
	for(int i = 1; i < n ;i++){
		for(int j = 0; j < 3000; j++){
			//tails
			dp[i][j] += (1-p[i]) * dp[i-1][j];
			//heads
			if(j > 0)
				dp[i][j] += p[i] * dp[i-1][j-1];
		}
	}
	
	double ans = 0;
	
	for(int i = n/2 + 1; i < 3000; i++){
		ans += dp[n-1][i];
	}
	
	cout<<setprecision(9);
	cout<<fixed;
	
	cout<<ans;
	
}

Measured memory_bytes: 74072
#include <iostream>
#include <fstream>
#include <stdio.h>
#include <math.h>
#include <time.h>
#include <string>
#include <tuple>
#include <vector>
#include <map>
#include <unordered_map>
#include <list>
#include <set>
#include <stack>
#include <queue>
#include <cstdlib>
#include <algorithm>
#include <random>
#include <cassert>
using namespace std;
#define LL long long
#define MP(a, b) make_pair(a, b)
#define MMP(a, b, c) make_pair(make_pair(a, b), c)
#define MAX 1000000000
#undef INT_MIN
#undef INT_MAX
#define INT_MIN -2147483647
#define INT_MAX 2147483647
#define LL_MIN (LL)-9223372036854775807
#define LL_MAX (LL)9223372036854775807
#define PI 3.14159265359

int main(){
    iostream::sync_with_stdio(false);
    
    int N;
    cin >> N;
    int ans = 0;
    for(int i=0; i<N; i++){
        int l,r;
        cin >> l >> r;
        ans += r-l+1;
    }
    cout << ans << endl;
    
    return 0;
}


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

int n, a, b, x, y;
char ipt[100005];

int main()
{
	scanf("%d%d%d%s",&n,&a,&b,&ipt);
	for(int i=0;i<n;i++) {
		if(ipt[i] == 'a') {
			if(x+y < a+b) {x++; puts("Yes");}
			else puts("No");
		}
		else if(ipt[i] == 'b') {
			if(x+y < a+b && y < b) {y++; puts("Yes");}
			else puts("No");
		}
		else puts("No");
	}
}


Measured memory_bytes: 768
// https://atcoder.jp/contests/abc083/tasks/arc088_b

#include <bits/stdc++.h>

using namespace std;

#define REP(i,n)   for(int i=0; i<(int)(n); i++)
#define FOR(i,b,e) for(int i=(b); i<=(int)(e); i++)
#define DUMP(a, n) REP(_i, n) printf("%d%c", a[_i], _i + 1 == n ? '\n' : ' ')
#define DUMP2D(a, n, m) REP(_i, n) REP(_j, m) printf("%d%c", a[_i][_j], _j + 1 == m ? '\n' : ' '); puts("")

const int S_MAX = 1e5;

char S[S_MAX + 1];

void solve() {
  int N = strlen(S);
  int M = (N + 1) / 2 - 1;
  int f, t;
  for (f = M; f >= 0 && S[f] == S[M]; f--);
  for (t = M; t < N && S[t] == S[M]; t++);
  // printf("M:%d f:%d t:%d\n", M, f, t);
  int ans = min(N - 1 - f, t);
  printf("%d\n", ans);
}

void input() {
  scanf("%s", S);
}

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


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

#define pb push_back
#define endl '\n'
#define fast ios::sync_with_stdio(false); cin.tie(NULL);
#define int long long
const int N = 1e6 + 10;

signed main(){

	string s;
	cin>>s;
	int a = stoi(s.substr(0,2));
	int b = stoi(s.substr(2));

	if(a > 0 && a < 13 && b > 0 && b < 13){

		cout<<"AMBIGUOUS\n";
	}

	else if(a==0 || a > 12){

		if(b > 0 && b < 13){

			cout<<"YYMM\n";
		}
		else cout<<"NA";
	}

	else if(a > 0 && a < 13){

		cout<<"MMYY\n";
	}
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define INF 999999999
#define M_PI 3.14159265358979323846
#define ALL(X) (X).begin(),(X).end()

#ifdef __LOCAL
    #define DBG(X) cout << #X << " = " << (X) << endl;
    #define SAY(X) cout << (X) << endl;
#else
    #define DBG(X)
    #define SAY(X)
#endif

#ifdef __LOCAL
    #include <filesystem>
    namespace fs = std::filesystem;
#endif

using namespace std;

using ll = long long int;
using ull = unsigned long long int;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;

int dx[]={1, 0, -1, 0, 0};
int dy[]={0, 1, 0, -1, 0};
const int INT_INF = (int)(2e9);
const ll  LL_INF = (ll)(2e18);
const int NIL = -1;
static mt19937 _g(time(nullptr));
 
std::string pad(int num){ char buffer[4]; std::snprintf(buffer, sizeof(buffer), "%03d", num); return buffer;}
inline ll randint(ll a, ll b) { ll w = (_g() << 31LL) ^ _g(); return a + w % (b - a + 1); }
inline void fast_io() { ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); };
template<typename T> inline T sign(T x) { return T(x > 0) - T(x < 0); }
template<typename T, typename S> inline ostream& operator<<(ostream& os, const pair<T, S> p) { cout << "[" << p.first << ";" << p.second << "]"; return os; }
template<typename T> inline ostream& operator<<(ostream& os, const vector<T>& v) { for (auto el : v) cout << el << " "; return os; }
template<typename T> inline T fetch() { T ret; cin >> ret; return ret; }
template<typename T> inline vector<T> fetch_vec(int sz) { vector<T> ret(sz); for (auto& elem : ret) cin >> elem; return ret; }

ll gcd(ll a, ll b) {
  ll v0 = a, v1 = b, v2 = a % b;
  while (v2 != 0) {
    v0 = v1;
    v1 = v2;
    v2 = v0 % v1;
  };
  return v1;
}

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

int main()
{
    #ifdef __LOCAL
        fs::path p = __FILE__;
        fs::path input,output;
        input = output = p.parent_path();
        input += string("/input/") + string(p.stem()) + string(".txt");
        output += string("/output/") + string(p.stem()) + string(".txt");
        freopen(input.c_str(), "r", stdin);
        freopen(output.c_str(), "w", stdout);
    #endif

    int N,M;
    vector<ll> A;
    cin >> N >> M;

    FOR(i,0,N){
        ll input;
        cin >> input;
        input /= 2;
        A.push_back(input);
        }

    ll Y=1;
    FOR(i,0,N) Y = lcm(Y,A[i]);
    FOR(i,0,N) if(Y/A[i]%2==0) {cout << 0 << endl; return 0;}
    ll m = M/Y;
    if(m%2==0) {cout << m/2 << endl; return 0;}
    else {cout << (m+1)/2 << endl; return 0;}

    return 0;
}


Measured memory_bytes: 1400
import sys
for line in sys.stdin:
    a,b = map(int, line.split())
    if a < b:
        a,b = b,a

    def gcd(x,y):
        while y > 0:
            x,y = y,x%y
        return x

    def lcm(x,y):
         return x * y / gcd(x, y)

    print(gcd(a,b), int(lcm(a,b)))

Measured memory_bytes: 7760
#include <cstring>
#include <cmath>
#include <algorithm>
#include <string>
#include <iostream>
#include <vector>
#include <queue>
#include <unordered_map>
#include <random>
#include <stack>
#include <set>
#include <unordered_set>

#define bug(x) cout<<"zdongdebug1: "<<x<<endl;
#define bug2(x, y) cout<<"zdongdebug2: "<<x<<" "<<y<<endl;
#define bug3(x, y, z) cout<<"zdongdebug3: "<<x<<" "<<y<<" "<<z<<endl;
using namespace std;
typedef long long ll;
const int maxn = 200005;
const int mod = 1000000007;

int a[maxn], c[maxn];

int main() {
#ifdef suiyuan2009
  freopen("/Users/suiyuan2009/CLionProjects/icpc/input.txt", "r", stdin);
  //freopen("/Users/suiyuan2009/CLionProjects/icpc/output.txt", "w", stdout);
#endif
  int n;
  cin>>n;
  for(int i=1;i<=n;i++){
    cin>>a[i];
    c[a[i]]++;
  }
  ll sum = 0;
  for(int i=1;i<=n;i++){
    if(c[i]>=2)sum+=(c[i]-1)*(ll)c[i]/2;
  }
  for(int i=1;i<=n;i++){
    ll tt = c[a[i]];
    if(tt<2)cout<<sum<<endl;
    else cout<<sum - (tt-1)<<endl;
  }
  return 0;
}

Measured memory_bytes: 3712
import java.io.*;

public class Main {
	public static void main(String[] args) throws IOException {
	BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
	StringBuilder keepfile = new StringBuilder();

 String[] str;

	while(true) {
	//??\???????????????????????????
      str = br.readLine().split(" "); 
	  int n = Integer.parseInt(str[0]);
	  int x = Integer.parseInt(str[1]);;
	  if(n == 0 & x == 0) break;

	//?¨??????????????????????????????? 
      else if(n != 0 & x != 0 | n >= 3 & n <= 100 | x >= 0 & x <= 300) {


     int N = 0 ; //N ???????¨????x??¨????????????????????????????????°??§???
         for(int i = 1; i <= n ; i++) {
	        for(int j = (i+1) ; j <= n ; j++) {
	           int k = 0 ;
	           k = x-i-j ; //x = i+j+k ???????????????k=x-i-j ??¨?????????
               if(j < k & k <= n) N++; 
	       }

	     }
	keepfile.append(N).append("\n");
	}

	}

	//??????????????????????????????
     System.out.print(keepfile);

	br.close();
	}
}

Measured memory_bytes: 24608
#include <bits/stdc++.h>
#define dbug(x) cout<<#x<<"="<<x<<endl
using namespace std;
template <typename T> void read(T &t) {
	t=0; char ch=getchar(); int f=1;
	while ('0'>ch||ch>'9') { if (ch=='-') f=-1; ch=getchar(); }
	do {(t*=10)+=ch-'0';ch=getchar();} while ('0'<=ch&&ch<='9'); t*=f;
}
typedef long long ll;
const ll mod=(1e9)+7;
const int maxn=2000*2000+10;
int n,k;
ll iv[maxn],ivjc[maxn];
ll dp[2010][2010],jc[maxn];
ll C(int x,int y) {
	return jc[x]*ivjc[y]%mod*ivjc[x-y]%mod;
}
ll ksm(ll x,int y) {
	ll res=1;
	while (y) {
		if (y&1) res=res*x%mod;
		x=x*x%mod; y>>=1;
	} return res;
}
int main() {
	//freopen("1.txt","r",stdin);
	read(n); read(k);
	if (k==1) { printf("1\n"); return 0; }
	iv[0]=jc[0]=ivjc[0]=1;
	iv[1]=jc[1]=ivjc[1]=1;
	for (int i=2;i<=n*k;i++)
		jc[i]=jc[i-1]*i%mod;
	ivjc[n*k]=ksm(jc[n*k],mod-2);
	for (int i=n*k-1;i>=2;i--)
		ivjc[i]=ivjc[i+1]*(i+1)%mod;
	dp[0][0]=1;
	for (int i=1;i<=n;i++)
	for (int j=i;j>=0;j--)
		dp[i][j]=(dp[i-1][j-1]*C(k*i-j-1,k-2)+dp[i][j+1])%mod;
	printf("%lld\n",dp[n][0]*jc[n]%mod);
	return 0;
}

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

struct data{
    int ly,lx,ry,rx;
    data(int ly,int lx,int ry,int rx)
        :ly(ly),lx(lx),ry(ry),rx(rx){}
};

const int dlx[]={-1,0,1,0},dly[]={0,-1,0,1};
const int drx[]={1,0,-1,0},dry[]={0,-1,0,1};

const int INF=1001001001;
int H,W;
char L[51][51],R[51][51];
int dist[50][50][50][50];
int sly,slx,sry,srx;
int gly,glx,gry,grx;
bool ok(int y,int x,int isL){
    if(isL)return !(y<0||y>=H||x<0||x>=W||L[y][x]=='#');
    return !(y<0||y>=H||x<0||x>=W||R[y][x]=='#');
}

void solve(){
    queue<data>que;
    fill_n(***dist,50*50*50*50,INF);
    dist[sly][slx][sry][srx]=0;
    que.push(data(sly,slx,sry,srx));

    while(que.size()){
        data d=que.front();que.pop();

        for(int i=0;i<4;i++){
            int nly=d.ly+dly[i],nlx=d.lx+dlx[i];
            int nry=d.ry+dry[i],nrx=d.rx+drx[i];
            if(!ok(nly,nlx,true)){
                nly=d.ly;nlx=d.lx;
            }
            if(!ok(nry,nrx,false)){
                nry=d.ry;nrx=d.rx;
            }

            if(dist[nly][nlx][nry][nrx]!=INF)continue;
            dist[nly][nlx][nry][nrx]=dist[d.ly][d.lx][d.ry][d.rx]+1;
            if((gly==nly&&glx==nlx)&&!(gry==nry&&grx==nrx))continue;
            if(!(gly==nly&&glx==nlx)&&(gry==nry&&grx==nrx))continue;
            que.push(data(nly,nlx,nry,nrx));
        }
    }

    if(dist[gly][glx][gry][grx]!=INF)cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
}

int main(){
    while(cin>>W>>H,W||H){
        for(int i=0;i<H;i++)cin>>L[i]>>R[i];
        for(int i=0;i<H;i++){
            for(int j=0;j<W;j++){
                if(L[i][j]=='L'){
                    sly=i;slx=j;
                }
                if(L[i][j]=='%'){
                    gly=i;glx=j;
                }
                if(R[i][j]=='R'){
                    sry=i;srx=j;
                }
                if(R[i][j]=='%'){
                    gry=i;grx=j;
                }
            }
        }

        solve();

    }
    return 0;
}

Measured memory_bytes: 26552
import Control.Monad.State

type Stack a = StateT [a] IO a

main = getContents >>=  (\x -> evalStateT (moveCars x) []).map read.lines
pop :: Stack a
pop = do
    (x:xs) <- get
    put xs
    return x

push :: a -> Stack a
push x = do
    xs <- get
    put (x:xs)
    return x

moveCars :: [Int] -> StateT [Int] IO ()
moveCars lst = sequence_ $ map toFunc lst

toFunc :: Int -> Stack Int
toFunc x = if x == 0 then do
                         n <- pop
                         liftIO $ print n
                         return n
                     else push x

Measured memory_bytes: 3968
ii = lambda : int(input())
mi = lambda : map(int,input().split())
li = lambda : list(map(int,input().split()))

a,b,c,d = mi()
while True:
    c -= b
    if c <=0:
        print("Yes")
        exit()
    a -= d
    if a <= 0:
        print("No")
        exit()
    

Measured memory_bytes: 9176
from itertools import combinations
S = input().strip()
N = len(S)
answer = int(S)
for c in range(1,N):
    for t in combinations(range(1,N), c):
        i = 0
        for j in t:
            answer += int(S[i:j])
            i = j
        j = N
        answer += int(S[i:j])

print(answer)




Measured memory_bytes: 3060
/*
ID: anonymo14
TASK: wormhole
LANG: C++                 
*/
#include<bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<pair<int,int>> vpii;

#define F first
#define S second
#define PU push
#define PUF push_front
#define PUB push_back
#define PO pop
#define POF pop_front
#define POB pop_back

#define REP(i,a,b) for(int i=a; i<=b; i++)

#define MOD 1000000007

void solve(int test_case) {
	string s;
	cin>>s;
	if(s.length()==3)reverse(s.begin(),s.end());
	cout<<s;
}

int main() {
	
	////// FILE BASED IO////
	//freopen("wormhole.in", "r", stdin);
	//freopen("wormhole.out", "w", stdout);
	///////////////
	
	ios::sync_with_stdio(0);
	cin.tie(0);
	int t=1;
	//cin>>t;
	REP(i,1,t) {
		solve(i);
	}
	return 0;
}	


Measured memory_bytes: 3548
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<algorithm>

using namespace std;

int main(){
	int N; cin >> N;
	map<string, int> S;
	for(int i = 0; i < N; ++i){
		string s; cin >> s;
		S[s]++;
	}
	vector<string> vs;
	//cout << endl;
	
	int max = 0;
	for(auto itr = S.begin(); itr != S.end(); ++itr){
		// cout << itr->first << " " << itr->second << endl;
		if(max < itr->second) max = itr->second;
	}

	for(auto itr = S.begin(); itr != S.end(); ++itr){
		if(itr->second == max) vs.push_back(itr->first);
	}

	for(int i = 0; i < vs.size(); ++i){
		cout << vs[i] << endl;
	}

	return 0;
}


Measured memory_bytes: 28404
N = int(input())
Actions = [list(map(int, input().split())) for i in range(N)]

# dp[i][j] := i日目に行動jをとった場合の最大の幸福度。
dp = [[0, 0, 0] for i in range(N)]
dp[0] = Actions[0]

for i in range(1, N):
    for j in range(3):
        dp[i][j] += Actions[i][j] + max(dp[i - 1][(j + 1) % 3], dp[i - 1][(j + 2) % 3])

print(max(dp[-1]))


Measured memory_bytes: 47256
#include <bits/stdc++.h>
using namespace std;
#define FOR(i, o, n) for (auto i = (o); (i) < (n); ++(i))
#define REP(i, n) FOR(i, 0, n)
#define REPR(i, n) for (auto i = (n)-1; (i) >= 0; --i)
#define REPI(itr, v) for (auto itr = v.begin(); itr != v.end(); ++itr)
#define REPIR(itr, v) for (auto itr = v.rbegin(); itr != v.rend(); ++itr)
#define fi first
#define se second
#define ll long long
#define V2(name, h, w) vector<vector<int> > name((h), vector<int>(w));

signed main(){
  int n; cin >> n;
  int count = 0;
  char pre='!', inp;
  REP(i, n){
    cin >> inp;
    if(pre != inp) count++;
    pre = inp;
  }
  cout << count << endl;
}


Measured memory_bytes: 256
n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
c = list(map(int, input().split()))

m = 20
sum=0


for i in range(n):
    sum += b[a[i]-1]
    if a[i]-1 == m+1:
        sum += c[a[i]-2]
    m = a[i]-1


print(sum)

Measured memory_bytes: 3064
program main
  implicit none
  integer i,N
  real(8) ans
  real(8),allocatable :: A(:)
  read(*, *) N
  allocate(A(N))
  read(*, *) (A(i), i = 1,N)
  ans = 0
  do i = 1,N
    ans = ans + (1/A(i))
  end do

  write(*, *) 1/ans
end program main


Measured memory_bytes: 256
//
//  main.cpp
//  ABC 075C
//
//  Created by Shuangyi Zhang on 10/18/17.
//  Copyright © 2017 Shuangyi Zhang. All rights reserved.
//

#include <iostream>
#include <vector>
#include <cstring>
using namespace std;
vector <vector<int>> g(55);
bool used[55];
int c[55][2];
void dfs(int i,int x,int y){
    used[i]=true;
    //cout<<i<<endl;
    for (auto v:g[i]){
        if (used[v]==false && !(i==x&&v==y)) dfs(v,x,y);
    }
    
}
int main() {
    int n,m,a,b;
    cin>>n>>m;
    for (int i=1;i<=m;i++){
        cin>>a>>b;
        g[a].push_back(b);
        g[b].push_back(a);
        c[i][0]=a;
        c[i][1]=b;
    }
    int res=0;
    for (int i=1;i<=m;i++){
        for (int j=0;j<=55;j++){
            used[j]=false;
        }
        dfs(c[i][0],c[i][0],c[i][1]);
        
        if (!used[c[i][1]]) {
          res++;
            //cout<<c[i][0]<<" "<<c[i][1]<<endl;
        }
        
    }
    cout<<res<<endl;
    
    return 0;
}


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

class UnionFind{
public:
	vector<int> par;
	//0-indexed
	void init(int n = 1) {
		par.resize(n);
		for (int i = 0; i < n; ++i) par[i] = i;
	}
	int root(int x = 1){
		if(par[x]==x)return x;
		else{
			return par[x] = root(par[x]);
		}
	}
	void unite(int x = 1,int y = 1){
		x = root(x);
		y = root(y);
		if(x==y)return;
		else par[x] = y;
	}
	int setsize(){
		boost::dynamic_bitset<> bs(par.size());
		for(auto x:par){
			bs[root(x)] = 1;
		}
		return bs.count();
	}
};

int main(){
	int n,m,a,b;
	cin >> n >> m;
	UnionFind uf;
	uf.init(n);
	while(m--){
		cin >> a >> b >> n;
		uf.unite(a-1,b-1);
	}
	cout << uf.setsize() << endl;
}


Measured memory_bytes: 896
import math

N,D = input().split()
N = int(N)
D = int(D)

xylist = [input() for i in range(N)]

cnt = 0

for xy in xylist:
  x = int(xy.split()[0])
  y = int(xy.split()[1])
  xy2 = x*x + y*y
  len = math.sqrt(xy2)
  if len <= D:
    cnt = cnt + 1

print(cnt)

Measured memory_bytes: 23256
#include<iostream>
    #include<cstdlib>
    #include<math.h>
    #include<set>
    #include<string>
    #include<stdlib.h>

    using namespace std ;

    int main(){
      string S;
      int b=0;
      cin>>S;
      for(int i=0;i<3;i++){
        if(S[i]==S[i+1])b++;
      }
      if(b>0)cout<<"Bad"<<endl;
      else cout<<"Good"<<endl;
      return 0;
    }

Measured memory_bytes: 256
n=int(input())
l=[]
for i in range(n):
  l1=list(map(int,input().split()))
  l.append(l1+["a",0])
for i in range(n):
  l1=list(map(int,input().split()))
  l.append(l1+["b"])
count=0
l=sorted(l)
for i in range(2*n):
  if l[i][2]=="a":
    pass
  else:#bが来たら
    num=l[i][1]
    min=100
    index=-1
    if i==0:
      pass
    else: 
      for j in range(0,i):#0~i-1までをみる
        if l[j][2]=="a":
          if l[j][3]==0:
            if min>num-l[j][1] and num>l[j][1]:
              min=num-l[j][1]
              index=j
      if index!=-1:
        l[index][3]=1
        count+=1
print(count)

Measured memory_bytes: 3188
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <algorithm>
#include <cmath>
#include <climits>

#define X first
#define Y second
#define vsort(v) sort((v).begin(), (v).end())
#define vrev(v) reverse((v).begin(), (v).end())


// INT_MAX
// INT_MIN
// LLONG_MAX
// LLONG_MIN
// DBL_MIN
// DBL_MAX
// LDBL_MIN
// LDBL_MAX

// A-Z: 65~90
// a-z: 97~122
// |a-z| = 26

using namespace std;
using ll = long long;

int main(int argc, const char * argv[]) {
    string s;
    cin >> s;
    
    int min_abs = 1000000000;
    int tmp = 0;
    for (int i = 0; i < s.length() - 2; i++) {
        tmp = abs(stoi(s.substr(i, 3)) - 753);
        if (tmp < min_abs) {
            min_abs = tmp;
        }
    }
    cout << min_abs << endl;
}


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

using namespace std;

using ll = long long;

int main(int argc, const char *argv[]) {
  ll n, a, b, c, d;
  cin >> n >> a >> b >> c >> d;

  bool ans = false;
  for (int i = 0; i < n && !ans; ++i) {
    ll min_s = -d * i + c * (n - 1 - i);
    ll max_s = -c * i + d * (n - 1 - i);
    ll diff = a - b;
    if (min_s <= diff && max_s >= diff) {
      ans = true;
    }
  }

  cout << (ans ? "YES" : "NO") << '\n';
}

Measured memory_bytes: 256
/* *
 *
 * Author: Hamkor
 *
 * */
 
#include <bits/stdc++.h>
 
using namespace std;
 
/* * * *   * * *   	* * * */
typedef long long ll;
const int oo = 1e9;
const ll mod = 100000000;
typedef complex<ll> P;
#define X real()
#define Y imag()
/* * * *   * * *   	* * * */
 
int main(){
	ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	int n; cin>>n;
	bool f = 1;
	double m = 0, p = 0;
	vector<double> a(n);
	for(int i=0; i<n; ++i){
		cin>>a[i];
		m = max(m, a[i]);
	}
	for (int i=0; i<n; ++i){
		if (a[i] == m && f) {p+=a[i]/2; f = 0;}
		else p+=a[i];
	}
	cout<<p;
	return 0;
}

Measured memory_bytes: 256