akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
using namespace std;
int main()
{
	int n;char s[1000];
	cin>>n;
	for(int i=0;i<n;i++)
	cin>>s[i];
	int ans=0,a=0,b=0,c=0,d=0; 
	for(int i=0;i<n;i++)
	{
		if(s[i]=='P'&&a==0){
			ans++;
			a=1; 
		}
		if(s[i]=='W'&&b==0){
			ans++;
			b=1; 
		}
		if(s[i]=='G'&&c==0){
			ans++;
			c=1; 
		}
		if(s[i]=='Y'&&d==0){
			ans++;
			d=1; 
		}
	} 
	if(ans==1)
	{
		cout<<"One";
	}
	else if(ans==2) cout<<"Two";
	else if(ans==3)cout<<"Three";
	else cout<<"Four";
	
	
	return 0;
} 

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define eps 1e-3
#define pi acos(-1.0)
#define inf 0x3f
#define INF 0x3f3f3f3f
#define pb push_back
#define debug1 cout<<"&&";
#define debug2 cout<<"**";
#define ms(a, x) memset(a, x, sizeof(a))
#define for0(i, n) for(int i = 0; i < n; ++i)
#define for1(i, n) for(int i = 1; i <= n; ++i)
using namespace std;
typedef double db;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef pair<long long, int> pli;
typedef pair<long long, long long> pll;
const int mod = 1e9 + 7;
const int N = 1e5+10;
const int M = 1e6+10;
/*=================================================================================*/

db b, c, h, m;

int main() {
   cin>>b>>c>>h>>m;
   db ag1 = h*1.0*360/12 + m*1.0*30/60;
   db ag2 = m*1.0*360/60;
   db ag = max(ag1, ag2) - min(ag1, ag2);
   if(ag > 180) ag = 360-ag;
   
   // debug1 cout<<ag<<endl;
   
   ag= ag*pi/180;
   // debug2 cout<<cos(ag)<<endl;
   db ans = b*b + c*c - 2*b*c*cos(ag);
   // cout<<sqrt(ans)<<endl;
   // debug1 cout<<ans<<endl;
   ans = sqrt(ans);
   printf("%.10lf\n", ans);
   return 0;
}

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


void solve(long long N, long long K, long long X, long long Y){
    cout << ((X*min(K, N)) + (Y * max((long long)0, N-K))) << endl;
}

// Generated by 1.1.5 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
int main(){
    long long N;
    scanf("%lld",&N);
    long long K;
    scanf("%lld",&K);
    long long X;
    scanf("%lld",&X);
    long long Y;
    scanf("%lld",&Y);
    solve(N, K, X, Y);
    return 0;
}


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

int main(){
	int answer = 0;
	string S, T;
	
	cin >> S >> T;
	
	for(int i = 0; i < 3; i++){
		string s = S.substr(i, 1);
		string t = T.substr(i, 1);
		if(s == t) answer++;
	}
	
	cout << answer << endl;
	
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
	int n,m,i,j,p,ac=0,wa=0;
	string s;
	cin>>n>>m;
	//string s[m];
	bool f[n+1];
	int sum[n+1];
	for(i=1;i<=n;i++){f[i]=0;sum[i]=0;}
	
	for(i=0;i<m;i++){
		cin>>p>>s;
		if(f[p])continue;
		if(s=="AC"){ac++;f[p]=1;wa+=sum[p];}
		else sum[p]++;
	}
	if(ac==0)wa=0;
	cout<<ac<<" "<<wa;

	return 0;
}



Measured memory_bytes: 768
n = int(input())
a = [int(input()) for i in range(n)]
b = [[a[i],i] for i in range(n)]
b.sort()

for i in range(n):
    if i==b[n-1][1]:
        if b[n-1][0] != b[n-2][0]:
            print(b[n-2][0])
        else:
            print(b[n-1][0])
    else:
        print(b[n-1][0])


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

#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 ALL(obj) (obj).begin(), (obj).end()
#define INF 1e9
typedef long long ll;


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

    vector<vector<int>> switches(M,vector<int>(N,0));
    REP(i,M){
        int k;
        cin >> k;
        REP(j,k){
            int s;
            cin >> s;
            switches[i][s-1] = 1;
        }
    }
    vector<int> p(M);
    REP(i,M){
        cin >> p[i];
    }

    int ans = 0;
    REP(bit, 1<<N){
        vector<int> B;
        bool ok = true;
        REP(i,N){
            if(bit & (1<<i)){
                B.push_back(i);
            }
        }
        
        REP(i,M){
            int count = 0;
            for(int j: B){
                count += switches[i][j];
            }
            if(count%2 != p[i]){
                ok = false;
            }
        }
        if(ok){
            ans ++;
        }
    }

    cout << ans << endl;


    return 0;
}

Measured memory_bytes: 3576
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {

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

		String str[] = br.readLine().split(" ");

		long a = Long.parseLong(str[0]);
		double b = Double.parseDouble(str[1]);

		long c = (long) b * 100;
		long d = a * (long) (b * 100 + 0.001) / 100;
		System.out.println(d);
	}
}

Measured memory_bytes: 33088
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <algorithm>
#include <map>
#include <unordered_map>
#include <memory>

#define int long long

using namespace std;

void Main()
{
	int n;
	cin >> n;
	cout << n / 2  + n % 2<< endl;
}

int32_t main()
{
	Main();
	return 0;
}



Measured memory_bytes: 256
n=gets.to_i
as=gets.split.map(&:to_i)
bs=gets.split.map(&:to_i)
cs=gets.split.map(&:to_i)
as.sort!
cs.sort!
ans=0
bs.each do |bi|
  anum=as.bsearch_index{|ai| bi<=ai}
  anum=n if anum==nil
  cnum=cs.bsearch_index{|ci| bi<ci}
  ans+=anum*(n-cnum) if cnum
end
puts ans


Measured memory_bytes: 23132
#include<iostream>
#include<queue>
#include<map>
#define ini 100
using namespace std ;

typedef pair<int,int> P ;

queue<P> q ;
int dx[] = {0,1,1,0,-1,-1} ;
int dy[] = {1,1,0,-1,-1,0} ;

int main(){
	
	int t , n ;
	int x , y ;
	int ans ;
	int field[200][200] ;
	/*
	1:コスト(1インデックス)
	0:空き地
	-1:障害物
	*/
	
	while( cin >> t >> n , t ){
		
		
		for( int i=0 ; i<200 ; i++ ){
			for( int j=0 ; j<200 ; j++ ){
				field[i][j] = 0 ;
			}
		}
		
		ans = 1 ;
		
		for( int i=0 ; i<n ; i++ ){
			cin >> x >> y ;
			field[y+ini][x+ini]  = -1 ;
		}
		
		cin >> x >> y ;
		
		q.push( P(x+ini,y+ini) ) ;
		field[y+ini][x+ini] = 1 ;
		
		int j=0 , k=0 ;
		while( !q.empty() ){
			x = q.front().first ;
			y = q.front().second ;
			//cout << "OK" << endl ;//--------------------
			//if( field[y][x] > t+1 ) break ;
			//                 ↑ここ+1したら通ってしまった
			for( int i=0 ; i<6 && field[y][x] <= t ; i++ ){
				if( field[y+dy[i]][x+dx[i]] == 0 ){
					field[y+dy[i]][x+dx[i]] = field[y][x]+1 ;
					q.push( P(x+dx[i],y+dy[i]) ) ;
					//cout<<"# "<<x-ini<<" "<<y-ini<<endl;
					ans++ ;
				}
			}
			q.pop() ;
		}
		
		cout << ans << endl ;
		
		while( !q.empty()  ){
			q.pop() ;
		}
	}
	
return 0 ;
}

Measured memory_bytes: 1376
#include<iostream>
#include<vector>
#include<algorithm>
#include<complex>
#include<string.h>
#include<string>
using namespace std;
typedef long long int llint;
int main() {
	int n, m;
	cin >> n >> m;
	char a[51][51], b[51][51];
	for (int i = 0;i < n;i++) {
		cin >> a[i];
	}
	for (int i = 0;i < m;i++) {
		cin >> b[i];
	}
	for (int i = 0;i <= n - m;i++) {
		for (int j = 0;j <= n - m;j++) {
			for (int k = 0;k < m;k++) {
				if (strncmp(a[i + k] + j, b[k], m) != 0) {
					break;
				}
				if (k == m - 1) {
					cout << "Yes" << endl;
					return 0;
				}
			}
		}
	}
	cout << "No" << endl;
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
using namespace std;
vector<int>ans;
vector<int>G[1001];
int N,M;
vector<int>vis;
bool used[1001];
void dfs(int u)
{
	vis.push_back(u);
	used[u]=true;
	for(int v:G[u])
	{
		if(vis[0]==v)
		{
			if(ans.empty()||ans.size()>vis.size())ans=vis;
		}
		else if(!used[v])dfs(v);
	}
	vis.pop_back();
}
main()
{
	cin>>N>>M;
	for(int i=0;i<M;i++)
	{
		int u,v;cin>>u>>v;
		G[u].push_back(v);
	}
	for(int i=0;i++<N;)
	{
		for(int j=0;j++<N;)used[j]=false;
		dfs(i);
	}
	cout<<(ans.empty()?-1:-9999)<<endl;
}


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

int main()
{
  int n;
  for(;cin>>n,n;)
    {
      int data[n];
      long long int step=0;
      for(int i=0;i<n;i++)
	cin>>data[i];
      
      for(int i=0;i<n;i++)
	for(int j=0;j<n-i-1;j++)
	  {
	    if(data[j]>data[j+1])
	      {
		swap(data[j],data[j+1]);
		step++;
	      }
	  }
      cout<<step<<endl;
    }
}

Measured memory_bytes: 1156
results = [0] * int(input())
m = int(input())
a = list(map(int, input().split()))

for i in range(m):
    target = a[i]
    result = list(map(int, input().split()))
    for i, r in enumerate(result):
        if r == target:
            results[i] += 1
    results[target-1] += len(results) - result.count(target)

print(*results, sep="\n")


Measured memory_bytes: 5620
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>

using namespace std;

int main(){
  long long int n;
  cin >> n;
  vector<int> t;
  vector<int> x;
  vector<int> y;
  for(int i = 0;i < n;i++){
    int T,X,Y;
    cin >> T >> X >> Y;
    t.push_back(T);
    x.push_back(X);
    y.push_back(Y);
  }
  if(n == 1){
    if(t[0] < x[0]+y[0]){
      cout << "No" << endl;
      return 0;  
    }
  }
  vector<int> t_1;
  vector<int> x_1;
  vector<int> y_1;
  for(int i = 1;i < n;i++){
    t_1.push_back(t[i]-t[i-1]);
    x_1.push_back(abs(x[i]-x[i-1]));
    y_1.push_back(abs(y[i]-y[i-1]));
  }
  for(int i = 0;i < n-1;i++){
    long long int xy = x_1[i]+y_1[i];
    if(t_1[i] < xy){
      cout << "No" << endl;
      return 0;
    }
    if(t_1[i]%2 != xy%2){
      cout << "No" << endl;
      return 0;
    }
  }
  cout << "Yes" << endl;
}


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

int main() {
    int n;
  int m;
  double sum =0;

  cin >> n >> m;
  double a[n];
  rep(i,n) {
      cin >> a[i];
      sum += a[i];
  }

  sort(a,a+n);

  if(a[n-m] >= sum/(4*m)){
      cout << "Yes" << endl;

  }

  else{
      cout << "No" << endl;
  }


}

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

int main() {
  string s; cin >> s;
  int sn = s.size();
  if (s[0] == 'A') {
    int cc = 0, j = 0;
    for (int i = 2; i<sn-1; i++) {
      if (s[i] == 'C') {
        j=i;
        cc++;
      }
    }
    if (cc == 1) {
      bool flag = true;
      for (int i = 1; i<sn; i++) {
        if (i==j) continue;
        if (isupper(s[i])) {
          flag = false;
          break;
        }
      }
      if (flag) {
        cout << "AC" << endl;
        return 0;
      }
    }
  }
  cout << "WA" << endl;
  return 0;
}

Measured memory_bytes: 3628
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int a,b,c;
  int min,max;

  vector<int> li;
  int i = 1;
  
  double f1;
    cin >> f1;
  cout << std::fixed << std::setprecision(6) << f1 * f1 * M_PI << " " << f1*2 * M_PI << endl;
}


Measured memory_bytes: 3284
#include<cstdio>
#define N 55
#define p 1000000007
#define ll long long
int a[N],b[N],f[N][N<<1],i,j,k,l,n;
int main()
{
	scanf("%d",&n),*a=a[1]=*b=b[1]=f[1][n-1]=f[1][n]=1;
	for(i=2;i<=n;i++)a[i]=(ll)a[i-1]*i%p,b[i]=(ll)(p-p/i)*b[p%i]%p;
	for(i=2;i<=n;i++)b[i]=(ll)b[i]*b[i-1]%p;
	for(i=1;i<=n;i++)for(j=-n;j<=n;j++)if(f[i][j+n])for(k=j<0?-j:0;i+j+k+k<=n;k++)if(j+k+k)for(l=n<j+k+k?j+k-n:-k;l<=k+j&&k+l<=n;l++)f[i+j+k+k][l+n]=(f[i+j+k+k][l+n]+(ll)b[k+l]*b[k+j-l]%p*f[i][j+n])%p;
	return 0*printf("%lld\n",(ll)f[n][n]*a[n]%p);
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
int main(){
  int N,X,T;
  cin >> N;
  cin >> X;
  cin >> T;
  int ans;
  ans = (N/X)*T;
  if(N%X != 0){
    ans += T;
  }
  cout << ans << endl;
  
  return 0;
}

Measured memory_bytes: 3620
// https://atcoder.jp/contests/dp/tasks/dp_f
#include <bits/stdc++.h>
#define ll long long int
#define pr pair<ll, ll>
#define infinity (ll)4e18
#define tp tuple<ll, ll, ll>
using namespace std;
long long int mod = 1e9 + 7;

ll dp[3010][3010];
ll solve(char s[], char t[], ll i, ll j)
{
    if (i <= 0 || j <= 0)
        return 0;
    if (dp[i][j] != -1)
        return dp[i][j];
    if (s[i] == t[j])
        dp[i][j] = 1 + solve(s, t, i - 1, j - 1);
    else
        dp[i][j] = max(solve(s, t, i - 1, j), solve(s, t, i, j - 1));
    return dp[i][j];
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    char s[4000], t[4000];
    cin >> s + 1 >> t + 1;
    ll sn = strlen(s + 1), tn = strlen(t + 1);
    memset(dp, -1, sizeof(dp));
    solve(s, t, sn, tn);
    ll i = sn, j = tn;
    string ans = "\0";
    while (i && j)
    {
        if (s[i] == t[j])
        {
            ans += s[i];
            i--;
            j--;
        }
        else if (dp[i - 1][j] > dp[i][j - 1])
            i--;
        else
            j--;
    }
    reverse(ans.begin(), ans.end());
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 71424
N = int(input())
A = [0] * N
A = list(map(int, input().split())) 
ANS = 1
if 0 in A:
    print(0)
else:
    for i in range(N):
        ANS = ANS * A[i]
        if ANS > 1000000000000000000:
            print(-1)
            break
        if i == N - 1:
            print(ANS)

Measured memory_bytes: 22556
#include <bits/stdc++.h>
#define F(i,n) for (int i=1; i<=n; i++)
#define FF(i,n) for (int i=0; i<n; i++)
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define re(x) (int)x.size()
#define pi pair < int , int >
#define all(x) x.begin(),x.end()
using namespace std;
typedef long long ll;
const int N = 2e5+228;
const int big = 2e9;
int n,a[N],f[N];
ll ans;
int brute(){
     int ans=0;
     F(i,n){
        int x=a[i];
        for (int j=i+1; j<=n; j++){
            if (x&a[j]) break;
            x|=a[j];
            ans++;
        }
    }
    return ans+n;
}
int main(){
    ios_base::sync_with_stdio(false); cin.tie(0);
//	freopen("input.txt","r",stdin);
//	freopen("output.txt","w",stdout);
    cin>>n;
    F(i,n) cin>>a[i];
    //cout<<brute()<<endl;
    for (int i=n; i>=1; i--)
        if (a[i]==0) f[i]=f[i+1]+1; else f[i]=0;
    ans=0;
    F(i,n){
        int x=a[i];
        for (int j=i+1; j<=n; j++){
            if (f[j]!=0) {ans+=0ll+f[j]; j+=f[j];}
            if (j>n) break;
            if (x&a[j]) break;
            x|=a[j];
            ans++;
        }
    }
    cout<<ans+n<<endl;
    return 0;
}


Measured memory_bytes: 1792
#include <stdio.h>

int main(){
	
	int w,h,x,y,r;
	scanf("%d %d %d %d %d",&w,&h,&x,&y,&r);
	if(r<=x && x<=w-r && r<=y&&y<=h-r)printf("Yes\n");
	else printf("No\n");
	
	return 0;
}


Measured memory_bytes: 580
import java.io.PrintWriter;
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		PrintWriter out = new PrintWriter(System.out);
		//String S = sc.next();
		//int N = Integer.parseInt(sc.next());
		//out.println();
		int N = Integer.parseInt(sc.next());
		String S = sc.next();
		int[] cntnum = new int[N];
		int cnt = 0;
		for(int i=1;i<S.length();i++){
			int ans =0;
			String s1 = S.substring(0,i);
			String s2 = S.substring(i,N);
			for(char c='a';c<='z';c++){
				String d =String.valueOf(c);
				if(s1.indexOf(d)!=-1 && s2.indexOf(d)!=-1){
					ans++;
				}
			}
			if(cnt<ans){
				cnt = ans;
			}
		}
		out.print(cnt);
		out.flush();	
	}
}

Measured memory_bytes: 23252
#ifdef LOCAL
#include <cstdio>
#include <vector>
#include <algorithm>
#include <iostream>
#include <cstring>
#else
#include <bits/stdc++.h>
#endif
using namespace std ;

typedef long long ll ;
typedef unsigned long long ull ;
#define rep(i , n ) for ( int i =0; i < n ; i++)
#define rrep(i , n) for ( int i = n-1; i >=0 ; i--)

#define _sort(arg) sort(begin(arg), end(arg))
#define MOD 1000000007
#define pb push_back
#define DEBUG(x) cout << #x << ": " << x << endl;

class UnionFind {
private:
	ull size_; 
	std::vector<ull> par, rank, count;

public:
	UnionFind() : size_(0), par(std::vector<ull>()), rank(std::vector<ull>()), count(std::vector<ull>()) {};
	UnionFind(ull size__) : size_(size__) {
		par.resize(size_); rank.resize(size_); count.resize(size__);
		for (ull i = 0; i < size_; i++) par[i] = i, rank[i] = 0, count[i] = 1;
	}
	ull size() { return size_; }
	// ull root(ull x) { return par[x] == x ? x : par[x] = root(par[x]); }
	
	ull root(ull x)
	{
		while(par[x] != x)
		{
			par[x] = par[par[x]];
			x = par[x];
		}
		return x;
	}
	
	bool same(ull x, ull y) { return root(x) == root(y); }

	void unite(ull x, ull y) {
		x = root(x), y = root(y);
		if (x == y) return;
		if (rank[x] < rank[y]) par[x] = y, count[y]+=count[x], count[x]=0;
		else if (rank[x] == rank[y]) par[y] = x, rank[x]++, count[x]+=count[y], count[y]=0;
		else par[y] = x, count[x] += count[y], count[y] = 0;
	}

	ull size__(ull x)
	{
		return count[root(x)];
	}

	bool operator==(const UnionFind &u) { return par == u.par; }
	bool operator!=(const UnionFind &u) { return par != u.par; }
};
/*
maybe sth wrong 
got wa in one problem
*/
ll modpow(ll a, ll b)
{
	if (b == 0)
	{
		return 1;
	}

	if (b % 2)
	{
		return a * modpow(a, b-1) % MOD;
	}
	else
	{
		ll halfB = b / 2;
		ll half = modpow(a, halfB);
		return half * half % MOD;
	}
}

ll calcComb(ll n, ll m)
{
	if (m > n-m)
	{
		return calcComb(n, n-m);
	}

	ll ansMul = 1;
	ll ansDiv = 1;

	rep(i, m)
	{
		ansMul *= (n-i);
		ansDiv *= (i+1);
		ansMul %= MOD;
		ansDiv %= MOD;
	}

	return ansMul * modpow(ansDiv, MOD - 2) % MOD;
}

__attribute__((constructor))
void initial()
{
	cin.tie(NULL);
	ios::sync_with_stdio(false);
}


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

	ll A[N];
    ll neg = 0;
    ll ab_min = INT_MAX;

    ll total = 0;
	rep(i, N)
	{
		cin >> A[i];
        if (A[i] < 0)
        {
            neg++;
        }
        total += abs(A[i]);
        ab_min = min(ab_min, abs(A[i]));
	}

    if (neg & 0x01)
    {
        cout << total - 2 * ab_min << endl;
    }
    else
    {
        cout << total << endl;
    }
    

	

	
	return 0;
}


Measured memory_bytes: 1024
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <map>
#include <set>
using namespace std;
int main() {
  int ans[] = {1,2,1,3,1,3,1,1,3,1,3,1};
  int a, b;
  cin >> a >> b;
  if(ans[a-1] == ans[b-1]) cout << "Yes" << endl;
  else cout << "No" << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <boost/range/irange.hpp>
#include <boost/range/adaptors.hpp>

using namespace std;
using boost::adaptors::reversed;
using boost::irange;
using uint = unsigned int;
using ll = long long int;
using ull = unsigned long long int;

int main() {
    ll A, B, C, K;
    cin >> A >> B >> C >> K;
    ll c;
    if (K % 2 == 1){
        c = -1;
    } else {
        c = 1;
    }
    cout << c * (A - B) << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#ifdef LOCAL
#include "debug.h"
#else
#define dump(...)
#endif
#define endl '\n'
#define ll long long
#define FOR(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define REP(i, x) for (int i = 0; i < (int)(x); i++)
#define REPS(i, x) for (int i = 1; i <= (int)(x); i++)
#define RREP(i, x) for (int i = ((int)(x)-1); i >= 0; i--)
#define RREPS(i, x) for (int i = ((int)(x)); i > 0; i--)
#define INF 2147483647
#define LLINF 9223372036854775807LL
#define vi vector<int>
#define vvi vector<vector<int>>
#define pi pair<int, int>
#define ALL(a) (a).begin(), (a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define BIT(n) (1LL << (n))
#define TOUPPER(s) transform(s.begin(), s.end(), s.begin(), ::toupper)
#define TOLOWER(s) transform(s.begin(), s.end(), s.begin(), ::tolower)
#define FILLZERO(s, n)                      \
    do {                                    \
        ostringstream os;                   \
        os << setw(n) << setfill('0') << s; \
        s = os.str();                       \
    } while (0);
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end()) //sortしてからつかうこと
#define INIT                               \
    std::cin.tie(nullptr);                 \
    std::ios_base::sync_with_stdio(false); \
    cout << std::fixed << std::setprecision(10);

template <typename T>
vector<T> make_vec(size_t a, T n) { return vector<T>(a, n); }
template <typename T, typename... Ts>
auto make_vec(size_t a, Ts... ts) { return vector<decltype(make_vec<T>(ts...))>(a, make_vec<T>(ts...)); }
template <class T>
inline bool chmax(T &a, T b) {
    if (a < b) {
        a = b;
        return 1;
    }
    return 0;
}
template <class T>
inline bool chmin(T &a, T b) {
    if (a > b) {
        a = b;
        return 1;
    }
    return 0;
}
template <typename T>
istream &operator>>(istream &is, vector<T> &vec) {
    for (T &x : vec)
        is >> x;
    return is;
}

constexpr ll MOD = 1e9 + 7;
int dx[8] = {1, 0, -1, 0, 1, 1, -1, -1};
int dy[8] = {0, 1, 0, -1, 1, -1, 1, -1};
ll A, B, C, D, E, F, G, H, N, M, L, K, P, Q, R, W, X, Y, Z;
string S, T;
ll ans = 0;

signed main() {
    INIT;
    cin >> X >> Y;
    if (abs(X - Y) <= 1) {
        cout << "Brown" << endl;
    } else {
        cout << "Alice" << endl;
    }
}

Measured memory_bytes: 3616
function Main(arg) {
 
    arg = arg.split("\n")[0];
    var H = arg.split(" ")[0]-0;
    var W = arg.split(" ")[1]-0;
    var A = arg.split(" ")[2]-0;
    var B = arg.split(" ")[3]-0;

    var tmp = new Array(W).fill(0);
    var ans = [];
    for (var i = 0; i < H; i++){
        for (var j = 0; j < W; j++){

            if (j < A && i < B) {
                tmp[j] = 0;
            }
            else if(j >= A && i < B) {
                tmp[j] = 1;
            }
            else if(j < A && i >= B) {
                tmp[j] = 1;
            }
            else if(j >= A && i >= B) {
                tmp[j] = 0;
            }

        }
        ans[i] = tmp.slice();
        tmp.fill(0);
    }

    for (var i = 0; i < H; i++) {
        console.log(ans[i].join(""));
    }
}

Main(require("fs").readFileSync("/dev/stdin", "utf8"));

Measured memory_bytes: 31124
#include <iostream>
#include<queue>
#include<vector>
#include<set>
#include<map>
#include<algorithm>
#include<cstring>
#include<string>
#include<cassert>
#include<cmath>
#include<climits>
#include<iomanip>
#include<bitset>
#include<unordered_map>

using namespace std;

#define MOD 1000000007
#define REP(i,n) for(ll (i)=0;(i)<(n);(i)++)
#define rep(i,l,r) for(ll (i)=(l);(i)<(r);(i)++)
#define FOR(i,c) for(decltype((c).begin())i=(c).begin();i!=(c).end();++i)
#define ll long long
#define ull unsigned long long
#define all(hoge) (hoge).begin(),(hoge).end()
typedef pair<ll, ll> P;
const long long INF = 1LL << 60;
typedef vector<ll> Array;
typedef vector<Array> Matrix;


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

//グラフ関連
struct Edge {//グラフ
	ll to, cap, rev;
	Edge(ll _to, ll _cap, ll _rev) {
		to = _to; cap = _cap; rev = _rev;
	}
};
typedef vector<Edge> Edges;
typedef vector<Edges> Graph;

void add_edge(Graph& G, ll from, ll to, ll cap, bool revFlag, ll revCap) {
	G[from].push_back(Edge(to, cap, (ll)G[to].size()));
	if (revFlag)G[to].push_back(Edge(from, revCap, (ll)G[from].size() - 1));
}

//最短経路(負の辺を含んでいてもOK)
void WarshallFloyd(Graph& G, Matrix& d) {//O(V^3)
	d.resize(G.size());
	REP(i, d.size())d[i].resize(G.size());
	REP(i, d.size()) {
		REP(j, d[i].size()) {
			d[i][j] = INF;
		}
	}
	REP(i, G.size()) {
		REP(j, G[i].size()) {
			d[i][G[i][j].to] = G[i][j].cap;
		}
	}
	REP(i, G.size()) {
		REP(j, G.size()) {
			REP(k, G.size()) {
				chmin(d[j][k], d[j][i] + d[i][k]);
			}
		}
	}
}

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

	ll n, m, l;
	cin >> n >> m >> l;
	Graph g(n);
	REP(i, m) {
		ll a, b, c;
		cin >> a >> b >> c;
		a--; b--;
		if(c<=l) add_edge(g, a, b, c, true, c);
	}

	Matrix d;
	WarshallFloyd(g, d);

	Graph g2(n);
	REP(i, n) {
		REP(j, n) {
			if (d[i][j] <= l) add_edge(g2, i, j, 1, false, 1);
		}
	}
	Matrix ans;
	WarshallFloyd(g2, ans);

	ll q;
	cin >> q;

	REP(i, q) {
		ll s, t;
		cin >> s >> t;
		s--; t--;
		if (ans[s][t] != INF) {
			cout << ans[s][t]-1 << endl;
		}
		else {
			
          cout << -1 << endl;
		}
	}

	return 0;
}

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

fn main() {
    let cin = stdin();
    let mut sc = Scanner::new(cin.lock());

    let n: usize = sc.next();
    let m: usize = sc.next();

    let mut table = vec![vec![0; m + 1]; n + 1];
    for i in 0..n {
        for j in 0..m {
            table[i][j] = sc.next();
        }
    }

    for i in 0..n {
        let mut sum = 0;
        for j in 0..m {
            sum += table[i][j];
        }
        table[i][m] = sum;
    }

    for j in 0..(m + 1) {
        let mut sum = 0;
        for i in 0..n {
            sum += table[i][j];
        }
        table[n][j] = sum;
    }

    for v in table {
        for (x, j) in v.iter().zip(0..(m + 1)) {
            print!("{}{}", x, if j == m { '\n' } else { ' ' });
        }
    }
}

/* ========== Scanner ========== */

struct Scanner<R: Read> {
    reader: R,
}

#[allow(dead_code)]
impl<R: Read> Scanner<R> {
    fn new(reader: R) -> Scanner<R> {
        Scanner { reader: reader }
    }

    fn read<T: FromStr>(&mut self) -> Option<T> {
        let token = self
            .reader
            .by_ref()
            .bytes()
            .map(|c| c.unwrap() as char)
            .skip_while(|c| c.is_whitespace())
            .take_while(|c| !c.is_whitespace())
            .collect::<String>();
        if token.is_empty() {
            None
        } else {
            token.parse::<T>().ok()
        }
    }

    fn next<T: FromStr>(&mut self) -> T {
        if let Some(s) = self.read() {
            s
        } else {
            writeln!(stderr(), "Terminated with EOF").unwrap();
            std::process::exit(0);
        }
    }

    fn vec<T: FromStr>(&mut self, n: usize) -> Vec<T> {
        (0..n).map(|_| self.next()).collect()
    }

    fn chars(&mut self) -> Vec<char> {
        self.next::<String>().chars().collect()
    }

    fn char(&mut self) -> char {
        self.chars()[0]
    }
}



Measured memory_bytes: 5052
from math import ceil
N, H = map(int, input().split())
B = []
a = 0
for i in range(N):
  aa, b = map(int, input().split())
  if a < aa:
    a = aa
  B.append(b)
B.sort(reverse=True)

res = 0
for b in B:
  if a < b:
    H -= b
  else:
    break
  res += 1
  if H <= 0:
    break

if H <= 0:
  print(res)
else:
  print(res+ceil(H/a))

Measured memory_bytes: 55384
#include<iostream>
#include<iomanip>
#include<climits>
#define prDouble(x) cout << fixed << setprecision(10) << x
#define ll long long int
#define ii pair<int,int>
#define fast_io ios_base::sync_with_stdio(false)
using namespace std;
int main()
{
	fast_io;
	int n;
	cin >> n;
	ll nums[n];
	for(int i = 0;i < n;++i)
		cin >> nums[i];
	ll dp[n][n];
	ll sum[n];
	sum[0] = nums[0];
	for(int i = 1;i < n;++i)
		sum[i] = sum[i-1]+nums[i];
	for(int i = 0;i < n;++i)
		dp[i][i] = 0;
	for(int i = n-2;i>=0;--i)
	{
		for(int j = i+1;j < n;++j)
		{
			dp[i][j] = LONG_MAX;
			for(int k = i;k < j;++k)
				dp[i][j] = min(dp[i][j],dp[i][k]+dp[k+1][j]+sum[j]-(i==0?0:sum[i-1]));
		}
	}
	cout << dp[0][n-1] << "\n";
	return 0;
}

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

int main(){
    int n;
    cin >> n;
    string s;
    cin >> s;
    int k;
    cin >> k;
    for(int i=0; i<s.length(); i++){
        if(s[i] != s[k-1]){
            s[i] = '*';
        }
    }

    cout << s << endl;
    return 0;
}

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

struct UnionFind {
    vector<int> par, rnk, cnt;
    UnionFind(int N) : par(N), rnk(N), cnt(N) {
        for (int i = 0; i < N; i++) {
            par[i] = i;
            cnt[i] = 1;
        }
    }

    int root(int x) {
        if (par[x] == x)
            return x;
        return par[x] = root(par[x]);
    }

    void unite(int x, int y) {
        x = root(x), y = root(y);
        if (x == y)
            return;
        if (rnk[x] < rnk[y])
            swap(x, y);
        if (rnk[x] == rnk[y])
            rnk[x]++;
        par[y] = x;
        cnt[x] += cnt[y];
    }

    bool same(int x, int y) {
        return root(x) == root(y);
    }

    int rcnt(int x) {
        return cnt[root(x)];
    }
};

int main() {
    int N, M, K;
    cin >> N >> M >> K;
    vector<int> nocnt(N);
    UnionFind uf(N);
    rep(i, M) {
        int a, b;
        cin >> a >> b;
        a--, b--;
        uf.unite(a, b);
        nocnt[a]++;
        nocnt[b]++;
    }
    rep(i, K) {
        int c, d;
        cin >> c >> d;
        c--, d--;
        if (uf.same(c, d)) {
            nocnt[c]++;
            nocnt[d]++;
        }
    }

    rep(i, N) cout << uf.rcnt(i) - nocnt[i] - 1 << " ";
    cout << endl;

    return 0;
}


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

using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
using WGraph = vector<vector<pair<int, ll>>>;

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

constexpr int dx[4] = {-1, 0, 0, 1}, dy[4] = {0, -1, 1, 0};
constexpr int INF = 1e9;
constexpr int MOD = 1e9 + 7;
constexpr long long LINF = 1e18;
constexpr double EPS = 1e-10;
constexpr double PI = M_PI;

void solve() {
    int N, K;
    cin >> N >> K;
    vector<int> a(N);
    for (int i=0; i<N; ++i) cin >> a[i];

    auto check = [N, K, &a](int m) -> bool {
        int cnt = 0;
        for (int x : a) {
            cnt += (x - 1) / m;
        }
        return cnt <= K;
    };

    int ok = INF, ng = 0;
    while (abs(ok - ng) > 1) {
        int mid = (ok + ng) / 2;
        if (check(mid)) ok = mid;
        else ng = mid;
    }
    cout << ok << '\n';
}

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

    solve();

    return 0;
}


Measured memory_bytes: 3984
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i,s,n) for(ll i = (s); i < (n); i++)
#define all(v) v.begin(), v.end()
#define allr(v) v.rbegin(), v.rend()



int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(18);
  
  ll a;
  long double b;
  cin >> a >> b;
  long double eps = 1e-3;
  cout << (ll)(a*b+eps) << "\n";
}

Measured memory_bytes: 3740
#![allow(non_snake_case)]
#![allow(unused_imports)]

use proconio::{input, fastout};
use proconio::marker::*;
use whiteread::parse_line;
use std::collections::*;
use num::*;
use num_traits::*;
use superslice::*;
use std::ops::*;

use itertools::Itertools;
use itertools_num::ItertoolsNum;

fn main() {
    input!{
        n: usize,
        s: Chars,
    }

    let r_num = s.iter().filter(|&x| *x == 'R').count();
    let b_num = s.iter().filter(|&x| *x == 'B').count();
    let g_num = s.iter().filter(|&x| *x == 'G').count();
    
    let mut cnt = 0;
    for i in 0..n-2 {
        for j in i+1..n-1 {
            let k = 2*j - i;
            if !(k < n) { continue; }
            if s[i] != s[j] && s[j] != s[k] && s[k] != s[i] {
                cnt += 1;
            }
        }
    }
    println!("{}", r_num * b_num * g_num - cnt)
}


Measured memory_bytes: 2172
#include <iostream>
#include <stdio.h>
#include <cmath>

using namespace std;

int main() {
	int  a, b, inteans, r;
	double Realans;

	cin >> a >> b;

	Realans = (double)a / b;
	inteans = floor(Realans);
	r = a % b;

	printf("%d %d %lf", inteans, r, Realans);
	return 0;
}


Measured memory_bytes: 3212
#include<iostream>
#include<cassert>
#include<cctype>
#include<cerrno>
#include<cfloat>
#include<vector>
#include<algorithm>
#include<string>
#include<map>
#include<math.h>
#include<queue>
#include<deque>
#include<stack>
#include<cstdio>
#include<utility>
#include<set>
#include<list>
#include<cmath>
#include<stdio.h>
#include<string.h>
#include<iomanip>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<bitset>
#include<functional>
#include<iterator>
#include<complex>
#include<fstream>
#include<random>
#include<ctype.h>
#include<stdio.h>
using namespace std;
#define FOR(i, a, b) for (int i = (a); i <= (b); i++)
#define REP(i, n) FOR(i, 0, n - 1)
#define NREP(i, n) FOR(i, 1, n)
using ll = long long;
using pii = pair<int, int>;
using PII = pair<ll, ll>;
using piii = pair<pii, pii>;
using Pi = pair<int, pii>;
using Graph = vector<vector<int>>;
const int dx[4] = { 0, -1, 1, 0 };
const int dy[4] = { -1, 0, 0, 1 };
bool check(int x, int y) {
	if (0 <= x && x<55 && 0 <= y && y<55)return true;
	else return false;
}
const ll INF = 1e9 + 7;
int gcd(int x, int y) {
	if (x < y)swap(x, y);
	if (y == 0)return x;
	return gcd(y, x%y);
}
void mul(ll a, ll b) {
	a = a * b % INF;
}
using Graph = vector<vector<int>>;

//iの逆元mod inf
long long modinv(long long a, long long m) {
	long long b = m, u = 1, v = 0;
	while (b) {
		long long t = a / b;
		a -= t * b; swap(a, b);
		u -= t * v; swap(u, v);
	}
	u %= m;
	if (u < 0) u += m;
	return u;
}
const double PI = 3.14159265358979323846;
const int MAX = 510000;
ll fac[MAX], finv[MAX], inv[MAX];
//テーブルをつくる前処理
void COMinit() {
	fac[0] = fac[1] = 1;
	finv[0] = finv[1] = 1;
	inv[1] = 1;//mod pにおける1,2,,,nの逆元
	for (int i = 2; i < MAX; ++i) {
		fac[i] = fac[i - 1] * i%INF;
		inv[i] = INF - inv[INF%i] * (INF / i) % INF;
		finv[i] = finv[i - 1] * inv[i] % INF;
	}
}

ll COM(int n, int k) {
	if (n < k)return 0;
	if (n < 0 || k < 0)return 0;
	return fac[n] * (finv[k] * finv[n - k] % INF) % INF;
}
double Euclidean_distance(double x1, double y1, double x2, double y2) {
	return sqrt((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2));
}

//素因数分解
map<int, int>prime_factor(int n) {
	map<int, int>res;
	for (int i = 2; i*i <= n; ++i) {
		while (n%i == 0) {
			++res[i];
			n /= i;
		}
	}
	if (n != 1)res[n] = 1;
	return res;
}


ll powmod(ll a, ll k, ll mod) {
	ll ap = a, ans = 1;
	while (k) {
		if (k & 1) {
			ans *= ap;
			ans %= mod;
		}
		ap = ap * ap;
		ap %= mod;
		k >>= 1;
	}
	return ans;
}
ll invi(ll a, ll mod) {
	return powmod(a, mod - 2, mod);
}
#define PI 3.14159265358979323846  // 円周率
//逆元Aを足したときのmodで割った余りは
//+=invi(A)
//Yで割ることはY^(10^9+7)-2を掛けることは同値
///////////////////////////////////////

int main() {
	ll ans = 0;
	int n; cin >> n;
	int now = 0;
	REP(i, n) {
		int a; cin >> a;
		if (now < a) {
			now = a;
		}
		else {
			ans += now - a;
		}
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 3720
#include<bits/stdc++.h>
#include<vector>
#include<iostream>
#include<map>
#include<algorithm>
#include<cmath>
#include<queue>
#include<set>
#include<deque>
#define ll long long
using namespace std;
#define BUF_SIZE 1048576
char _buf[BUF_SIZE],*_is=_buf,*_it=_buf;
inline char rdc(){
	if (_is==_it) _it=(_is=_buf)+fread(_buf,1,BUF_SIZE,stdin);
	return *_is++;
}
inline int rdi(){
	int x=0,f=0;
	register char ch=rdc();
	while ((ch<'0' or ch>'9') and (ch^'-')) ch=rdc();
	if (ch=='-') f=1,ch=rdc();
	while (ch>='0' and ch<='9') x=(x<<3)+(x<<1)+(ch^'0'),ch=rdc();
	return f?-x:x;
}
inline void write(int x){
    if(x<0) putchar('-'),x=-x;
    if(x>9) write(x/10);
    putchar(x%10+'0');
}
inline void _write(int x){
	write(x);
	putchar(' ');
}
inline void print(int x){
	write(x);
	putchar('\n');
}
ll dp[100001],w[101],v[101];
int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	int n,W,i,j;
	cin>>n>>W;
	for(i=1;i<=n;++i) cin>>w[i]>>v[i];
	for(i=1;i<=n;++i) for(j=W;j>=w[i];--j) dp[j]=max(dp[j],dp[j-w[i]]+v[i]);
	ll mx=0;
	for(i=1;i<=W;++i) mx=max(mx,dp[i]);
	cout<<mx<<endl;
	return 0;
}

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

#define rep(i,n) for(int (i)=0;(i)<(int)(n);(i)++)
#define rept(i,n) for(ll (i)=0;(i)<=(ll)(n);(i)++)
#define reps(i,s,n) for(ll (i)=(s);(i)<(ll)(n);(i)++)
#define repst(i,s,n) for(ll (i)=(s);(i)<=(ll)(n);(i)++)
#define repr(i,n) for(ll (i)=(n);(i)>=0;(i)--)
#define each(itr,v) for(auto (itr):(v))
#define all(c) (c).begin(),(c).end()
#define pb push_back
#define mp(x,y) make_pair((x),(y))
#define fi first
#define se second
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)
#define ln '\n'
#define dbg(x) cout<<#x" = "<<(x)<<ln

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vector<int> > mat;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

const int inf = (int)1e9;
const ll linf = (ll)1e18;
const int mod = (int)(1e9+7);
const int dx[] = {0, 1, 0, -1};
const int dy[] = {1, 0, -1, 0};
const int ddx[] = {0, 1, 1, 1, 0, -1, -1, -1};
const int ddy[] = {1, 1, 0, -1, -1, -1, 0, 1};

struct oreno_initializer {
	oreno_initializer() {
		cin.tie(0);
		ios::sync_with_stdio(0);
	}
} oreno_initializer;

// ━━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…
// .｡.:( ^ω^)・ﾟ＋.｡.:( ^ω^)・ﾟ＋.｡.:( ^ω^)・ﾟ＋.｡.:( ^ω^)・ﾟ＋.｡.:( ^ω^)・ﾟ＋
// ・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・

int n, t, c0, c1;
string s;

int main() {
	cin >> s;
	n = s.length();
	c0 = c1 = n;
	rep(i,n) {
		t = max(max(n-i-1, 1), max(1,i));
		if (s[i]=='0') chmin(c0, t);
		else chmin(c1, t);
	}
	cout << max(c0, c1) << ln;
}

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

using namespace std;

int main(int argc, char const *argv[]) {

  int N, M, C;
  cin >> N >> M >> C;

  int tmp;
  vector<int> B;
  for (int i = 0; i < M; i++) {
    cin >> tmp;
    B.emplace_back(tmp);
  }

  vector<vector<int>> A(N, vector<int>(M));
  int sum;
  int cnt = 0;
  for (int i = 0; i < N; i++) {
    sum = 0;
    for (int j = 0; j < M; j++) {
      cin >> A.at(i).at(j);
      sum = sum + (A.at(i).at(j)) * (B.at(j));
    }
    if(sum + C > 0) cnt += 1;
  }

  cout << cnt << '\n';

  return 0;

}


Measured memory_bytes: 256
n = int(input())
li_h = list(map(int, input().split()))
save_h = 0
for idx, h in sorted(enumerate(li_h), reverse=True):
    if idx == n - 1:
        save_h = h
    else:
        if h <= save_h:
            save_h = h
        elif (h - save_h) == 1:
            save_h = h - 1
        else:
            print("No")
            exit(0)
else:
    print("Yes")





Measured memory_bytes: 17708
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using vl = vector<ll>;
template<class T> using vc = vector<T>;
template<class T> using vvc = vector<vector<T>>;

#define eb emplace_back
#define all(x) (x).begin(), (x).end()
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define repr(i, n) for (ll i = (n)-1; i >= 0; i--)
#define repe(i, l, r) for (ll i = (l); i < (r); i++)
#define reper(i, l, r) for (ll i = (r)-1; i >= (l); i--)
#define repa(i,n) for (auto& i: n)

template<class T> inline bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> inline bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
void init() {cin.tie(0);ios::sync_with_stdio(false);cout << fixed << setprecision(15);}

#ifdef DEBUG
template <class T, class N> void verr(const T& a, const N& n) { rep(i, n) cerr << a[i] << " "; cerr << "\n" << flush; }
ll dbgt = 1; void err() { cerr << "passed " << dbgt++ << "\n" << flush; }
template<class H, class... T> void err(H&& h,T&&... t){ cerr<< h << (sizeof...(t)?" ":"\n") << flush; if(sizeof...(t)>0) err(forward<T>(t)...); }
#endif

const ll INF = 5e18;
const ld EPS = 1e-11;
const ld PI = acos(-1.0L);
const ll MOD = 1e9 + 7;
// const ll MOD = 998244353;
//--------------------------------------------------------------------------------//

int main() {
    init();
    string s;
    cin >> s;
    if (s.size() == 3) reverse(all(s));
    cout << s << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace __gnu_pbds;   
#define ordered_set tree<ll, null_type,less<ll>, rb_tree_tag,tree_order_statistics_node_update> 
#define ld long double
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define all(a) a.begin(),a.end()
#define sz(a) (ll)(a.size())
const int M = 2e5+5;
vector<int> vtr[M];
bool vis[M];
int c = 0;
void dfs(int x)
{
	if(vis[x])
		return;
	c++;
	vis[x] = 1;
	for(auto u:vtr[x])
		dfs(u);
}
int main()
{
	ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
	int n,m;
	cin>>n>>m;
	for(int i=1;i<=m;i++)
	{
		int u,v;
		cin>>u>>v;
		vtr[u].pb(v);
		vtr[v].pb(u);
	}
	int res = 0;
	for(int i=1;i<=n;i++)
	{
		c = 0;
		dfs(i);
		res = max(res, c);
	}
	cout<<res<<"\n";
	return 0;
}

Measured memory_bytes: 20976
abc = list(map(int,input().split()))
f_count = 0
s_count = 0
for num in abc:
    if num==5:
        f_count += 1
    elif num==7:
        s_count += 1
if f_count==2 and s_count==1:
    print("YES")
else:
    print("NO")

Measured memory_bytes: 3060
#include <bits/stdc++.h>
#define rep(i,n) for (int i = (0); i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define limit(x,l,r) max(l,min(x,r))
#define lims(x,l,r) (x = max(l,min(x,r)))
#define isin(x,l,r) ((l) <= (x) && (x) < (r))
#define show(x) cout << #x << " = " << (x) << endl
#define show2(x,y) cout << #x << " = " << (x) << ", " << #y << " = " << (y) << endl
#define show3(x,y,z) cout << #x << " = " << (x) << ", " << #y << " = " << (y) <<  ", " << #z << " = " << (z) << endl
#define showv(v) rep(i,v.size()) printf("%d%c", v[i], i==v.size()-1?'\n':' ')
#define showv2(v) rep(j,v.size()) showv(v[j])
#define showt(t,n) rep(i,n) printf("%d%c", t[i], i==n-1?'\n':' ')
#define showt2(t,r,c) rep(j,r) showt(t[j],c)
#define showvp(p) rep(i,p.size()) printf("%d %d\n", p[i].first, p[i].second)
#define printv(v) rep(i,v.size()) printf("%d\n", v[i])
#define printt(t,n) rep(i,n) printf("%d\n", t[i])
#define incl(v,x) (find(all(v),x)!=v.end())
#define incls(s,c) (s.find(c)!=string::npos)
#define lb(a,x) distance((a).begin(),lower_bound(all(a),(x)))
#define ub(a,x) distance((a).begin(),upper_bound(all(a),(x)))
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
#define sz(x) (int)(x).size()
#define pcnt __builtin_popcountll
#define bit(n,k) ((n>>k)&1) // nのk bit目
#define bn(x) ((1<<x)-1)
#define dup(x,y) (((x)+(y)-1)/(y))
#define newline puts("")
#define uni(x) x.erase(unique(all(x)),x.end())
#define SP << " " <<
using namespace std;
using ll = long long;
using ld = long double;
using vi = vector<int>;
using vvi = vector<vi>;
using vl = vector<ll>;
using vvl = vector<vl>;
using vc = vector<char>;
using vvc = vector<vc>;
using vs = vector<string>;
using vb = vector<bool>;
using vvb = vector<vb>;
using P = pair<int, int>;
using T = tuple<int, int, int>;
using vp = vector<P>;
using vt = vector<T>;
const int mod = 1000000007;
const double EPS = 1e-9;
//const long double EPS = 1e-14;
const int INF = (1<<30)-1;
const ll LINF = (1LL<<62)-1;
#define dame { puts("No"); return 0;}
#define yn {puts("Yes");}else{puts("No");}
inline int in() { int x; cin >> x; return x;}
inline ll lin() { ll x; cin >> x; return x;}
inline char chin() { char x; cin >> x; return x;}
inline string stin() { string x; cin >> x; return x;}
inline double din() { double x; cin >> x; return x;}
//template<class T = int> inline T in() { T x; cin >> x; return (x);}
template<typename T>inline ll suma(const vector<T>& a) { ll res(0); for (auto&& x : a) res += x; return res;}
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; }
char itoa(int n) { return n + '0';}
ll gcd(ll a, ll b) { return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b) { return a/gcd(a,b)*b;}
const int dx[4] = {1, 0,-1, 0};
const int dy[4] = {0, 1, 0,-1};

int main () {
  int l, r, d;
  cin >> l >> r >> d;
  cout << r/d - (l-1)/d << endl;
  return 0;
}

Measured memory_bytes: 3564
INF = 10 ** 6

class SegTree():
    def __init__(self, A):
        n_ = len(A)
        self.n = 1
        while self.n < n_:
            self.n *= 2
        self.tree = [INF for _ in range(2 * self.n - 1)]
        for k, a in enumerate(A):
            self.update(k, a)
    def update(self, k, a):
        k += self.n - 1
        self.tree[k] = a
        while k > 0:
            k = (k - 1) // 2
            self.tree[k] = min(self.tree[k * 2 + 1], self.tree[k * 2 + 2])
    def query(self, l, r):
        l += self.n - 1
        r += self.n - 2
        res = INF
        while r-l>1:
            if l&1 == 0:
                res = min(res,self.tree[l])
            if r&1 == 1:
                res = min(res,self.tree[r])
                r -= 1
            l = l//2
            r = (r-1)//2
        if l == r:
            res = min(res,self.tree[l])
        else:
            res = min(min(res,self.tree[l]),self.tree[r])
        return res


n = int(input())
p = list(map(int, input().split()))

pii = []

for i, pi in enumerate(p):
    pii.append([pi, i])

pii.sort(reverse=True)

st_r = SegTree([n] * (n+1))
st_l = SegTree([1] * (n+1))

ans = 0

for pi, i in pii:
    # print("###")
    # print(pi, i)
    # print(st_r.tree)
    if pi < n:
        l = -st_l.query(0, i)
        r = st_r.query(i+1, n)
        # print(l, r)
        if l != -1:
            l2 = l - 1
            if l > 0:
                l2 = -st_l.query(0, l)
            ans += (l - l2) * (r - i) * pi
        if r != n:
            r2 = r + 1
            if r < n - 1:
                r2 = st_r.query(r+1, n)
            ans += (i - l) * (r2 - r) * pi

    st_r.update(i, i)
    st_l.update(i, -i)

    
print(ans)


Measured memory_bytes: 100520
#include<iostream>
using namespace std;
int main(){
  string s,t,m="mcxi";
  int n,a,b,c,i,j,k;cin>>n;
  for(i=0;i<n;i++){
    cin>>s>>t;
    a=b=0;
    for(j=0;j<s.size();j++)
      if('9'<s[j]){
	for(k=3,c=1;k>=0;k--){
	  if(s[j]==m[k])break;
	  c*=10;}
	if(j==0||'9'<s[j-1])a+=c;
	else a+=c*(s[j-1]-'0');
      }
    for(j=0;j<t.size();j++)
      if('9'<t[j]){
	for(k=3,c=1;k>=0;k--){
	  if(t[j]==m[k])break;
	  c*=10;}
	if(j==0||'9'<t[j-1])b+=c;
	else b+=c*(t[j-1]-'0');
      }
    c=a+b;
    for(j=0,a=1000;j<4;j++){
      b=c/a,c%=a,a/=10;
      if(b==1)cout<<m[j];
      else if(b>1)cout<<b<<m[j];
    }cout<<endl;
  }
  return 0;
}

Measured memory_bytes: 1216
import std.algorithm, std.conv, std.range, std.stdio, std.string;

void readV(T...)(ref T t){auto r=readln.splitter;foreach(ref v;t){v=r.front.to!(typeof(v));r.popFront;}}
void readA(T)(size_t n,ref T t){t=new T(n);auto r=readln.splitter;foreach(ref v;t){v=r.front.to!(ElementType!T);r.popFront;}}
void readM(T...)(size_t n,ref T t){foreach(ref v;t)v=new typeof(v)(n);foreach(i;0..n){auto r=readln.splitter;foreach(ref v;t){v[i]=r.front.to!(ElementType!(typeof(v)));r.popFront;}}}
void readS(T)(size_t n,ref T t){t=new T(n);foreach(ref v;t){auto r=readln.splitter;foreach(ref j;v.tupleof){j=r.front.to!(typeof(j));r.popFront;}}}

void main()
{
  string[] s; readM(3, s);
  writeln(s[0][0], s[1][1], s[2][2]);
}


Measured memory_bytes: 256
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class Main {

  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    sc.nextLine();
    List<Long> l = new ArrayList<Long>();
    for(int i = 0;i < n;i++) {
      l.add(sc.nextLong());
    }

    if(l.contains(0L)) {
      System.out.println(0);
    }else {
      Long max = 1000000000000000000L;

      Long sum = 1L;

      for(Long l2:l) {
        if(sum > max/l2) {
          System.out.println(-1);
          sum = 0L;
          return;
        }
        sum *= l2;
      }
      System.out.println(sum);
    }

    sc.close();
  }

}


Measured memory_bytes: 61628
#include<iostream>
 
using namespace std;
 
int main() {
    int a;
    int b;
    cin >> a >> b;
    if (a < b) {
        cout << "a < b" << endl;
    }
    if (a > b) {
        cout << "a > b" << endl;
    }
    if (a == b) {
        cout << "a == b" << endl;
    }
    return 0;
}


Measured memory_bytes: 3116