akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <algorithm>
#include <cstring>
#include <cmath>
#include <vector>
#include <set>
#include <queue>
#include <map>
#include <string>

#define rep(i, a, b) for ( int i = (a); i < (b); i++ )
#define per(i, a, b) for ( int i = (b)-1; i >= (a); i--)
#define pb push_back
#define mp make_pair
#define bg begin()
#define en end()
#define all(v) (v).begin(), (v).end()
#define sz(v) (int) (v).size()


using namespace std;

typedef long long ll;

static const long long MOD = 1000000007;

int n, a[100005];
int s[5];

int main(void) {
  cin >> n;
  rep(i, 0, n) scanf("%d", &a[i]);
  ll ans = 1;
  for(int i=0; i<n; i++) {
    ll c = 0;
    for (int j=0; j<3; j++) if (s[j] == a[i]) c++;
    ans *= c;
    ans %= MOD;
    for (int j=0; j<3; j++) {
      if (s[j] == a[i]) {
        s[j]++;
        break;
      }
    }
  }
  printf("%lld\n", ans%MOD);
  
  return 0;
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
#include <unordered_map>
#include <unordered_set>
using namespace std;
#define all(v)           ((v).begin()), ((v).end())
#define sz size()
#define clr(v,d)         memset(v,d,sizeof(v))
#define rep(i, v)        for(int i=0;i<(v).sz;++i)
#define lp(i, n)         for(int i=0;i<(int)(n);++i)
#define lpi(i, j, n)     for(int i=(j);i<(int)(n);++i)
#define lpd(i, j, n)     for(int i=(j);i>=(int)(n);--i)
#define pb(e) push_back(e)
#define mp(a, b) make_pair(a, b)
#define fi first
#define se second
#define sci(a)	scanf("%d",&a)
#define scii(a, b)	scanf("%d%d",&a, &b)
#define pri(a)	printf("%d\n",a)
#define prii(a, b)	printf("%d %d\n",a, b)
#define DB1(a)          std::cout<<#a<<"="<<(a)<<endl
#define DB2(a,b)        std::cout<<#a<<"="<<(a)<<", "<<#b<<"="<<(b)<<endl
#define DB3(a,b,c)      std::cout<<#a<<"="<<(a)<<", "<<#b<<"="<<(b)<<", "<<#c<<"="<<(c)<<endl
#define DB4(a,b,c,d)    std::cout<<#a<<"="<<(a)<<", "<<#b<<"="<<(b)<<", "<<#c<<"="<<(c)<<", "<<#d<<"="<<(d)<<endl
#define DB5(a,b,c,d,e)  std::cout<<#a<<"="<<(a)<<", "<<#b<<"="<<(b)<<", "<<#c<<"="<<(c)<<", "<<#d<<"="<<(d)<<", "<<#e<<"="<<(e)<<endl
typedef pair<int, int> pii;
typedef long long ll;
const ll  inf = 1000000000000000000LL;
const double EPS = 1e-9;
const ll mod = 1000000007ll;
#define PI acos(-1)

const int maxn = 300500;


int f[105][12];
int p[105][12];
int c[105];

int main(){
	int n; sci(n);
	lp(i, n){
		lp(j, 10) sci(f[i][j]);
	}
	lp(i, n){
		lp(j, 11) sci(p[i][j]);
	}
	ll ret = -1125899906842624;
	for (int msk = 1; msk < (1 << 10); msk++){
		ll cur = 0;
		memset(c, 0, sizeof(c));
		for (int i = 0; i < n; i++)  lp(j, 10)
			if ((msk&(1 << j)) && f[i][j])
				c[i]++;
		for (int i = 0; i < n; i++) cur += p[i][c[i]];
		ret = max(ret, cur);
	}
	printf("%lld", ret);
}



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

using namespace std;

int main() {
    int n;
    cin >> n;
    vector<int> p(n);
    for(int i=0; i<n; i++) cin >> p[i];
    
    int flag=0;

    for(int i=0; i<n; i++) {
        if(i+1!=p[i]) flag++;
    }

    if(flag>2) cout << "NO" << endl;
    else cout << "YES" << endl;

    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstring>
#include <vector>
#include <deque>
#include <algorithm>
#include <climits>

using namespace std;

int main() {
    int l;
    cin >> l;
    deque<int> a(l);
    for (int i = 0; i < l; i++) {
        cin >> a[i];
    }

    while (a.size() && a.front() == 0) a.pop_front();
    while (a.size() && a.back() == 0) a.pop_back();
    if (a.size() == 0) {
        cout << 0;
        return 0;
    }

    int n = a.size();

    long long dp[200005][5];
    for (int i = 0; i <= n; i++) {
        for (int j = 0; j < 5; j++) {
            dp[i][j] = 1e18;
        }
    }

    dp[0][0] = 0;
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < 5; j++) {
            long long val = dp[i][j];
            if (j == 0) {
                dp[i + 1][0] = min(dp[i + 1][0], val + a[i]);
            }
            else {
                dp[i + 1][4] = min(dp[i + 1][4], val + a[i]);
            }

            if (j <= 2) {
                dp[i + 1][2] = min(dp[i + 1][2], val + (a[i] % 2 == 0));
            }

            if (j <= 1) {
                dp[i + 1][1] = min(dp[i + 1][1], val + (a[i] == 0 ? 2 : (a[i] & 1)));
            }
            else if (j <= 3) {
                dp[i + 1][3] = min(dp[i + 1][3], val + (a[i] == 0 ? 2 : (a[i] & 1)));
            }
        }
    }

    long long ans = dp[n][0];
    for (int i = 0; i < 5; i++) ans = min(ans, dp[n][i]);
    cout << ans;
}

Measured memory_bytes: 8960
program ccc
implicit none

integer :: n, q, ln, i, j
character(100001) :: s
integer,allocatable,dimension(:) :: a, l, r

read*, n, q
read*, s
s=trim(s)
ln=len_trim(s)
allocate(a(0:ln),l(q),r(q))
do i=1, q
read*, l(i), r(i)
end do

j=0
do i=1,n-1
if(s(i:i)=='A'.and.s(i+1:i+1)=='C') j=j+1
a(i)=j
end do
a(0)=0
a(n)=a(n-1)

do i=1,q
write(*,'(i0)') a(r(i)-1)-a(l(i)-1)
end do

end program

Measured memory_bytes: 2340
#include <queue>
#include <stack>
#include <map>
#include <algorithm>
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <vector>
#include <complex>
typedef long long int LL;
using namespace std;

// 插入此處

// int a[10005];

int main() {
    int n;
    scanf("%d", &n);
    int ans = 0;
    for (int i = 0; i < n; i++) {
        int tmp;
        scanf("%d", &tmp);
        while (tmp % 2 == 0) {
            ans++;
            tmp /= 2;
        }
    }
    printf("%d\n", ans);
}


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

int main() {
  int a;
  cin >> a;
  if(a == 0) cout << 1 << endl;
  else cout << 0 << endl;
}

Measured memory_bytes: 3648
def solve():
    s = input()
    t = input()
    s_size = len(s)
    t_size = len(t)
    dp = [[0 for i in range(s_size+1)] for j in range(t_size+1)]
    for i in range(1, t_size+1):
        for j in range(1, s_size+1):
            if t[i-1] == s[j-1]:
                dp[i][j] = dp[i-1][j-1] + 1
            else:
                dp[i][j] = max(dp[i][j-1], dp[i-1][j])
    ans = ""
    i, j = t_size, s_size
    while i > 0 and j > 0:
        if dp[i][j] == dp[i][j-1]:
            j -= 1
        elif dp[i][j] == dp[i-1][j]:
            i -= 1
        else:
            ans = t[i-1] + ans
            i -= 1
            j -= 1
    print(ans)
solve()

Measured memory_bytes: 119644
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace __gnu_pbds;
using namespace std;
typedef tree<pair<int,int>,null_type,less<pair<int,int>>,rb_tree_tag,tree_order_statistics_node_update> oset;
#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
  enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
  ris << "(" << d.first << ", " << d.second << ")";
} 
sim dor(rge<c> d) {
  *this << "[";
  for (auto it = d.b; it != d.e; ++it)
	*this << ", " + 2 * (it == d.b) << *it;
  ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "
using ll = long long;
//#define ar array 

const int BLK = 700 , nax = 5*(1e5)+5;
int n , q , ar[nax] , F[nax] , freq[nax] , cnt = 0;

struct query{
	int L , R , c;
};

bool comp(query a , query b){
	if(a.L/BLK != b.L/BLK)
		return a.L/BLK < b.L/BLK;
	else
		return a.R < b.R;
	}
	
void add(int pos){
	freq[ar[pos]]++;
	if(freq[ar[pos]]==1)
		cnt++;
	}

void remove(int pos){
	freq[ar[pos]]--;
	if(freq[ar[pos]]==0)
		cnt--;
	}
	
void test_case() {
	cin >> n >> q;
	for(int i = 0 ; i < n ; i++)
		cin >> ar[i];
	vector<query> Q;
	vector<int> ans(q);
	int m = 0;
	while(q--){
		query l;
		cin >> l.L >> l.R;
		l.L-- , l.R--;
		l.c = m;
		Q.push_back(l);
		m++;
	}
	sort(Q.begin(),Q.end(),&comp);
	int ML = 0 , MR = -1;
	for(int i = 0 ; i < (int)Q.size() ; i++){
		int l = Q[i].L;
		int r = Q[i].R;
		int idx = Q[i].c;
		while(MR < r)
			MR++ , add(MR);
		while(ML > l)
			ML-- ,add(ML);
		while(MR > r)
			remove(MR),MR--;
		while(ML < l)
			remove(ML),ML++;
		ans[idx] = cnt;
	}
	for(auto &x : ans)
		cout<<x<<"\n";
}
 
int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	int T = 1;
	//~ cin >> T;
	while(T--){
		test_case();
	}
}

// hilbert curve ordering


Measured memory_bytes: 15668
D = int(input())
c_list = [int(i) for i in input().split()]
s_list = []
t_list = []
for _ in range(D):
    s = [int(i) for i in input().split()]
    s_list.append(s)
happy = 0
recent = [0 for _ in range(26)]
for _ in range(D):
    print(1)

Measured memory_bytes: 68116
N = int(input())
G = [[] for i in range(N)]
for i in range(N-1):
    s, t, w = map(int, input().split())
    G[s].append((t, w))
    G[t].append((s, w))

from collections import deque
def bfs(s):
    dist = [None]*N
    que = deque([s])
    dist[s] = 0
    while que:
        v = que.popleft()
        d = dist[v]
        for w, c in G[v]:
            if dist[w] is not None:
                continue
            dist[w] = d + c
            que.append(w)
    d = max(dist)
    return dist.index(d), d
u, _ = bfs(0)
v, d = bfs(u)

print(d)



Measured memory_bytes: 41948
#include <iostream>
#include <algorithm>
typedef long long ll;
using namespace std;

ll dp[3010][3010][4]={}, item[3010][3010]={};

int main() {
	int R, C, K;
	cin >> R >> C >> K;
	for(int i=0; i<K; ++i){
		int r, s;
		ll v;
		cin >> r >> s >> v;
		item[r][s]=v;
	}
	for(int i=1; i<=R; ++i){
		for(int j=1; j<=C; ++j){
			for(int k=0; k<=3; ++k){
				dp[i][j][0]=max(dp[i][j][0], dp[i-1][j][k]);
				dp[i][j][k]=max(dp[i][j][k], dp[i][j-1][k]);
			}
			if(item[i][j]){
				for(int k=2; k>=0; --k){
					dp[i][j][k+1]=max(dp[i][j][k+1], dp[i][j][k]+item[i][j]);
				}
			}
		}
	}
	ll ans=0;
	for(int i=0; i<=3; ++i) ans=max(ans, dp[R][C][i]);
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 356248
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<cstring>
#include<complex>
#include<stack>
#include<queue>
#include<unordered_map>
#include<map>

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

using namespace std;

int main(void) {
  string s, v;
  cin >> s;
  for (int i = 0; i < s.size(); i++) {
    if (s[i] == '0') {
      v += "0";
    } else if (s[i] == '1') {
      v += "1";
    } else {
      if (!v.empty()) {
        v.pop_back();
      }
    }
  }
  cout << v << endl;
}


Measured memory_bytes: 256
#define _ITERATOR_DEBUG_LEVEL 1


#include <iostream>
#include <string>
#include <sstream>
#include <iomanip> 
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <queue>
#include <stack>
#include <vector>
#include <map>
#include <set>
#include <functional>
#include <algorithm>
#include <unordered_map>
#include <unordered_set>
#include <bitset>

using namespace std;



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

	int a, b, c;
	cin >> a >> b >> c;
	if (a + b >= c) cout << "Yes\n";
	else cout << "No\n";

	return 0;
}


Measured memory_bytes: 256
///                                                     ببِسْمِ اللَّهِ الرَّحْمَنِ الرَّحِيم
#include <bits/stdc++.h>
#define off  exit( 0 )
#define cn   continue
#define rt   return
#define sc   scanf
#define pr   printf
#define pb   push_back
#define pf   push_front
#define p_f  pop_front
#define p_b  pop_back
#define ff   first
#define ss   second
#define vec  vector
#define gcd  __gcd
#define pi   acos( -1 )
#define ll   long long
#define ld   long double
#define N    200256
#define M    998244353
#define I    1000000000000000000
#define pdd  pair < ld, ld >
#define pll  pair < ll, ll >
#define pii  pair < int, int >
#define rep( a, b, c, d )  for( int a = b; a <= c; a += d )
#define rvv( a, b, c, d )  for( int a = b; a >= c; a -= d )
#define en                 printf( "\n" )
#define sqr( a )           a * a
#define all( c )           c.begin(), c.end()
#define srt( c )           sort( all( c ) )
#define rev( c )           reverse( all( c ) )
#define srtr( c )          sort( c.rbegin(), c.rend() )
#define numcounts          __builtin_popcount
#define mxn( x, y, z )     max( x, min( y, z ) )
#define mnx( x, y, z )     min( x, max( y, z ) )
const int dx[ ] = { 1, -1, 0, 0 };
const int dy[ ] = { 0, 0, -1, 1 };
using namespace std;
ll tests;
ll n, m, z, x;


void solve()
{
    sc( "%I64d%I64d%I64d%I64d", &n, &m, &z, &x );
    x = (x != 1? 0:1);
    pr("%I64d", x);
}

int main()
{

   /* sc( "%I64d", &tests );
    while( tests -- )*/
        solve();
}






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

#define ll             long long
#define LL             long long
#define gcd(a,b)       __gcd(a, b)
#define lcm(a,b)       a * (b / gcd(a, b))
#define pii            pair<int, int>
#define pll            pair<ll, ll>
#define pil            pair<int, ll>
#define pli            pair<ll, int>
#define vi             vector<int>
#define vl             vector<ll>
#define vii            vector<pii>
#define vll            vector<pll>
#define vil            vector<pil>
#define vli            vector<pli>
#define pb             push_back
#define ppb            pop_back
#define mp             make_pair
#define ff             first
#define ss             second
#define all(v)         v.begin(), v.end()
#define fill(a, b)     memset(a, b, sizeof a)
#define smax(a, b)     a = max(a, b)
#define smin(a, b)     a = min(a, b)
#define sqr(x)         x * x
#define cube(x)        x * x * x
#define endl           '\n'

int in() {
	int n;
	scanf("%d", &n);
	return n;
}

ll Lin() {
	ll n;
	scanf("%lld", &n);
	return n;
}

double Din() {
	double n;
	scanf("%lf", &n);
	return n;
}

const ll inf = (ll)1e17;
const ll mod = (ll)1e9 + 7;
const int N = 1e3 + 5;

ll dp[N][N];
string s[N];

ll call(int n, int m) {
	if (n == -1 || m == -1) return 0;
	if (n == 0 && m == 0) return 1;
	if (s[n][m] == '#') return 0;
	if (dp[n][m] != -1) return dp[n][m];
	return dp[n][m] = (call(n - 1, m) + call(n, m - 1)) % mod;
}

int solve() {
	int n = in(), m = in();
	for (int i = 0; i < n; i++) {
		cin >> s[i];
	}
	fill(dp, -1);
	printf("%lld\n", call(n - 1, m - 1));
	return 0;
}

int main() {
	int test = 1, tc = 0;
	while (test--) {
		//printf("Case %d: ", ++tc);
		solve();
	}
	return 0;
}


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

int main(){
    int A = 0;
    int B = 0;
    int M = 0;
    cin >> A >> B >> M;
    vector<int> a(A);
    vector<int> b(B);
    vector<int> x(M);
    vector<int> y(M);
    vector<int> c(M);
    int ABmin = 0;
    int disacount = 0;
    int Amin = 1000000;
    int Bmin = 1000000;
    for (int i = 0; i < A; i++)
    {
        cin >> a[i];
    }
    for (int i = 0; i < B;i++)
    {
        cin >> b[i];
    }
    for (int i = 0; i < M;i++)
    {
        cin >> x[i] >> y[i] >> c[i];
    }
    //↑入力部
    for (int i = 0; i < A;i++)
    {
        if(a[i] < Amin){
            Amin = a[i];
        }
    }
    for (int i = 0; i < B;i++)
    {
        if(b[i] < Bmin){
            Bmin = b[i];
        }
    }
    ABmin = Amin + Bmin;
    for (int i = 0; i < M; i++)
    {
        disacount = a[x[i]-1] + b[y[i]-1] - c[i];
        if (ABmin > disacount)
        {
            ABmin = disacount;
        }
    }
    cout << ABmin << endl;
}


Measured memory_bytes: 2176
#include<stdio.h>

int sum(int, int,int *,int);

int sum(int i,int m,int *A,int n)
    {
    int s=0;
    if(m==0)return 1;
    if(i>=n)return 0;
    else{
    s+=sum(i+1,m,A,n);
    s+=sum(i+1,m-A[i],A,n);
    }
    return s;
}
int main(){
    int i,n,q;
    scanf("%d",&n);
    int A[n];
    for(i=0; i<n; i++)
    {
        scanf("%d",&A[i]);
    }
    scanf("%d",&q);
    int B[q];
    for(i=0; i<q; i++)
    {
        scanf("%d",&B[i]);
    }
    for(i=0; i<q; i++)
    {
    if(sum(0,B[i],A,n))
        printf("yes\n");
    else
        printf("no\n");
    }
    return 0;
}


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

using namespace std;
typedef long long int ll;
typedef pair<int, int> P;
typedef pair<ll, ll> Pll;
typedef vector<int> Vi;
//typedef tuple<int, int, int> T;
#define FOR(i,s,x) for(int i=s;i<(int)(x);i++)
#define REP(i,x) FOR(i,0,x)
#define ALL(c) c.begin(), c.end()
#define DUMP( x ) cerr << #x << " = " << ( x ) << endl

const int dr[4] = {-1, 0, 1, 0};
const int dc[4] = {0, 1, 0, -1};

#define INF 1<<30

// graph by adjacency list
template <typename T>
struct Edge {
  int dst; T weight;
  Edge(int dst, T weight) : dst(dst), weight(weight) { }
  bool operator < (const Edge<T> &e) const {
    return weight > e.weight;
  }
};

template <typename T>
struct Graph {
  int V;
  vector<vector<Edge<T>>> E;
  Graph(int V) : V(V) { E.resize(V); }
  void add_edge(int src, int dst, T weight) {
    E[src].emplace_back(dst, weight);
  }
};

template <typename T>
struct ShortestPath {
  const Graph<T> g;
  vector<T> dist;
  vector<int> prev;

  ShortestPath(const Graph<T> g) : g(g) { dist.resize(g.V), prev.resize(g.V); }

  void bellman_ford(int start) {
    dist.assign(g.V, INF);
    dist[start] = 0;
    prev[start] = -1;
    while (true) {
      bool update = false;
      for (int i = 0; i < g.V; i++) {
	for (Edge<T> e : g.E[i]) {
	  if (dist[i] != INF && dist[i] + e.weight < dist[e.dst]) {
	    dist[e.dst] = dist[i] + e.weight;
	    prev[e.dst] = i;
	    update = true;
	  }
	}
      }
      if (!update) break;
    }
  }

  vector<int> build_path(int goal) {
    vector<int> path;
    for (int v = goal; v != -1; v = prev[v]) {
      path.emplace_back(v);
    }
    reverse(path.begin(), path.end());
    return path;
  }

  bool find_negative_loop(int start) {
    dist.assign(g.V, INF);
    dist[start] = 0;
    for (int i = 0; i < g.V; i++) {
      for (int j = 0; j < g.V; j++) {
	for (Edge<T> e : g.E[j]) {
	  if (dist[j] != INF && dist[j] + e.weight < dist[e.dst]) {
	    dist[e.dst] = dist[j] + e.weight;
	    if (i == g.V - 1) return true;
	  }
	}
      }
    }
    return false;
  }
};

int main() {
  // use scanf in CodeForces!
  cin.tie(0);
  ios_base::sync_with_stdio(false);
  int V, E, r; cin >> V >> E >> r;
  Graph<int> g(V);
  REP(_, E) {
    int s, t, d; cin >> s >> t >> d;
    g.add_edge(s, t, d);
  }
  ShortestPath<int> sp(g);
  if (sp.find_negative_loop(r)) {
    cout << "NEGATIVE CYCLE" << endl;
  } else {
    REP(i, g.V) {
      if (sp.dist[i] == INF) {
	cout << "INF" << endl;
      } else {
	cout << sp.dist[i] << endl;
      }
    }
  }

  return 0;
}

Measured memory_bytes: 3320
#include <iostream>
#include<algorithm>
#include<string>
using namespace std;
#define MAX 2000000
#define INFTY (1<<30)
int H=0,A[MAX+1];
void maxheap(int i){
    int l,r,max;
    l=2*i;
    r=2*i+1;
    if(l<=H && A[l]>A[i]) max=l;
    else max=i;
    if(r<=H && A[r]>A[max]) max=r;
    if(max!=i){
        swap(A[i],A[max]);
        maxheap(max);
    }
}
int extract(){
    int max;
    if(H<1) return -INFTY;
    max=A[1];
    A[1]=A[H--];
    maxheap(1);
    return max;
}
void Increase(int i,int key){
    if(key<A[i]) return;
    A[i]=key;
    while(i>1 && A[i/2]<A[i]){
        swap(A[i],A[i/2]);
        i=i/2;
    }
}
void insert(int key){
    H++;
    A[H]=-INFTY;
    Increase(H,key);
}
int main(){
    string command;
    int key;
    while(true){
        cin>>command;
        if(command=="end") break;
        if(command=="insert"){
            cin>>key;
            insert(key);
        }
        else{
            cout<<extract()<<endl;
        }
    }
}


Measured memory_bytes: 7112
import sys

input = sys.stdin.readline


def solve(S):
    if S == 'Sunny':
        return 'Cloudy'
    elif S == 'Cloudy':
        return 'Rainy'
    else:
        return 'Sunny'


if __name__ == '__main__':
    S = input()

    answer = solve(S.strip())
    print(answer)


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

int main(){
  string S;
  cin >> S;
  
  int ok = 0;
  if(S.at(0) == 'A'){
    ok = 1;
  }
  
  int o = 0;
  for(int i = 2;i < S.size()-1;i++){
    if(S.at(i) == 'C'){
      o += 1;
    }
  }
  
  int p = 0;
  for(int j = o;j < S.size();j++){
    if(S.at(j) >= 'a' && S.at(j) <= 'z'){
      p += 1;
    }
  }
  
  if(ok == 1 && o == 1 && p == S.size()-2){
    cout << "AC" << endl;
  }
  else{
    cout << "WA" << endl;
  }
}

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

using namespace std;

int main() {

    int N, K;
    cin >> N >> K;
    int R, S, P;
    cin >> R >> S >> P;
    string T;
    cin >> T;

    for(int i = K; i < N; i++) if(T.at(i) == T.at(i - K)) T.at(i) = 'x';

    int score = 0;
    for(int i = 0; i < N; i++) {
        if(T.at(i) == 'r') score += P;
        else if(T.at(i) == 's') score += R;
        else if(T.at(i) == 'p') score += S;
    }

    cout << score << endl;

    return 0;
}

Measured memory_bytes: 512
# include <bits/stdc++.h>
using namespace std;
 
int main() {
  int n,k; cin >> n >> k;
  vector<double> p(n,0); for(int i = 0;i < n;i++) { cin >> p[i]; }
  vector<double> e(n,0); for(int i = 0;i < n;i++) { e[i] = (p[i]+1)/2; }
 
  double sum=0,max;
  for(int i = 0;i < k;i++) { sum += e[i]; }
 
  max = sum;
  for(int i = 1;i+(k-1) < n;i++) {
    sum += (e[i+(k-1)] - e[i-1]);
    if(max < sum) { max = sum; }
  }
 
  //cout << max << endl;
  printf("%.15f\n",max);
  return 0;
}

Measured memory_bytes: 3328
#include <bits/stdc++.h>
using namespace std;
#define REP(i,b,e) for(int i=(b);i<(e);++i)
#define RREP(i,b,e) for(int i=(b)-1;i>=e;--i)
#define rep(i,e) for(int i=0;i<(e);++i)

constexpr int MOD = 1000000007;
constexpr int INF = 1LL << 30;
constexpr long long LLINF = 1LL << 62;
constexpr double EPS = 1e-9;

struct Initializer {
  Initializer() {
    cin.tie(0);
    ios::sync_with_stdio(0);
    cout << fixed << setprecision(15) << boolalpha;
  }
} initializer;

inline void print(void) { cout<<'\n'; }
template<class T> inline void print(const T &x) { cout<<x<<'\n'; }
template<class T, class... U> inline void print(const T &x, const U&... y) { cout<<x<<" "; print(y...); }

int n;
vector<vector<int>> g(210);
vector<int> col(210, 0);

bool is_bipartite(int x, int c) {
  col[x] = c;
  for (auto nx: g[x]) {
    if (col[nx] == c) return false;
    if (col[nx] == 0 && !is_bipartite(nx, -c)) return false;
  }
  return true;
}

int main() {
  cin>>n;
  rep(i, n) rep(j, n) {
    char t; cin>>t;
    if (t == '1') g[i].emplace_back(j);
  }

  bool check = is_bipartite(0, 1);
  if (!check) {
    print(-1);
    return 0;
  }

  int ans = 0;
  rep(i, n) {
    vector<int> dists(n, INF);
    dists[i] = 1;
    queue<int> q;
    q.push(i);

    while (!q.empty()) {
      int x = q.front(); q.pop();
      for (auto nx: g[x]) {
        if (dists[nx] > dists[x] + 1) {
          dists[nx] = dists[x] + 1;
          q.push(nx);
        }
      }
    }
    ans = max(ans, *max_element(dists.begin(), dists.end()));
  }
  print(ans);

  return 0;
}


Measured memory_bytes: 512
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <limits.h>
#include <math.h>

int main(int argc, char *argv[])
{
    int t, x;
    double ans;

    scanf("%d %d", &t, &x);

    ans = (double) t / x;

    printf("%.10f\n", ans);

    return 0;
}


Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(0);cout.tie(0);
    ll n,i,temp,j;
    cin>>n;
    ll score[n+5];
    vector<pair<string,ll> >v,v1;
    map<string,ll> m1;
    map<ll,ll> m2,m3;
    vector<ll> a,a1;
    string str[n+5],s;
    for(i=1;i<=n;i++){
        cin>>str[i]>>score[i];
        m1[str[i]]+=1;
        v.push_back(make_pair(str[i],i));
        m2[i]=score[i];
        m3[score[i]]=i;
    }
    sort(v.begin(),v.end());
    s=v[0].first;
    for(i=0;i<v.size();i++){
        if(s!=v[i].first){
            s=v[i].first;
            sort(a.rbegin(),a.rend());
            for(j=0;j<a.size();j++)
                cout<<m3[a[j]]<<endl;
            a.clear();
            a.push_back(m2[v[i].second]);
        }
        else
            a.push_back(m2[v[i].second]);
    }
    sort(a.rbegin(),a.rend());
    for(j=0;j<a.size();j++)
        cout<<m3[a[j]]<<endl;
    return 0;
}


Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

public class Main {
    public static void main(String[] args) {
    	try{
    		InputStreamReader isr = new InputStreamReader(System.in);
			BufferedReader br = new BufferedReader(isr);
			String buf = br.readLine();
			StringTokenizer st=new StringTokenizer(buf," ");
	    	int a = Integer.parseInt(st.nextToken());
	    	int b = Integer.parseInt(st.nextToken());
	    	int c = Integer.parseInt(st.nextToken());
			int cnt=0;
	    	if(a <= b && 1<=a && 1<= b && 1<=c && a<=10000 && b<=10000 && c<=10000){

	    		for(int i=a; i <= b;i++){
	    			if( (c/i) >=1 && (c%i)==0)	cnt++;
	    		}
	    		System.out.println(cnt);
	    	}

    	} catch(IOException e) {
    		System.err.println(e);
		}
    }
}

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

int main(){
  int n; cin>>n;
  vector<int> d(n);
  for(int i=0;i<n;i++)cin>>d[i];
  sort(d.begin(),d.end());
  cout<<d[n/2]-d[n/2-1]<<endl;
}

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

struct Vector{
	double x;
	double y;
};

Vector sub_vector(Vector &a , Vector &b){
	Vector ret;
	ret.x=a.x-b.x;
	ret.y=a.y-b.y;
	return ret;
}

int main(){
	double x1,y1,x2,y2,x3,y3,xp,yp;
	Vector v[4];
	while(cin>>x1>>y1>>x2>>y2>>x3>>y3>>xp>>yp){
		v[0].x=x1; //a
		v[0].y=y1;
		v[1].x=x2; //b
		v[1].y=y2;
		v[2].x=x3; //c
		v[2].y=y3;
		v[3].x=xp; //p
		v[3].y=yp;
		Vector ba = sub_vector(v[0] , v[1]);
		Vector bp = sub_vector(v[3] , v[1]);
		Vector cb = sub_vector(v[1] , v[2]);
		Vector cp = sub_vector(v[3] , v[2]);
		Vector ac = sub_vector(v[2] , v[0]);
		Vector ap = sub_vector(v[3] , v[0]);
		double c1 = ba.x * bp.y - ba.y * bp.x; //??????
		double c2 = cb.x * cp.y - cb.y * cp.x;
		double c3 = ac.x * ap.y - ac.y * ap.x;
		if((c1<0 && c2<0 && c3 <0)||(c1>=0 && c2>=0 && c3>=0)) {
			cout << "YES" << endl;
		} else {
			cout << "NO" << endl;
		}
		
	}
	return 0;
}

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

int main() {
	// your code goes here
	int n;
	cin>>n;
	int a[n];
	for(int i=0;i<n;++i){ cin>>a[i]; }//cout<<a[i];}
	int dp[n];
	for(int i=1;i<n;i++)
	{
		dp[i]=999999999;
	}
	dp[0]=0;
	for(int i=0;i<n;i++)
	{
		for(int j=i+1;j<=i+2;j++)
		{
			if(j<n)
			{
			dp[j]=min(dp[i]+abs(a[i]-a[j]),dp[j]);
			//cout<<dp[i]+abs(a[i]-a[j])<<endl;
			//cout<<dp[j]<<" ";
			}
		}
	}
	cout<<dp[n-1];
	return 0;
}

Measured memory_bytes: 1024
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        int N = scan.nextInt();
        int p[]=new int [N+1];
        int t[]=new int [N+1];
        int d[]=new int [N+1];
for(int i=1;i<Math.sqrt(N);i++){


    for(int j=1;j<=i;j++){

        for(int k=1;k<=j;k++){
            int n=(int)(Math.pow(i+j,2)+Math.pow(i+k,2)+Math.pow(k+j,2))/2;
            if(n>N){n=N+1;}
            p[n-1]++;
if(i==j&&j==k){t[n-1]++;}
else if(i==j||j==k||k==i){d[n-1]++;}
        }



    }


}
for(int i=0;i<N;i++){System.out.println(d[i]*3+(p[i]-d[i]-t[i])*6+t[i]);}
    }
}

Measured memory_bytes: 30156
H,W=map(int,input().split())
lst=[]
for i in range(H):
    a=list(input())
    lst.append(a)

for i in range(H):
    for j in range(W):
        if lst[i][j]==".":
            cnt=0
            for h,w in ([0,1],[0,-1],[1,0],[-1,0],[1,1],[1,-1],[-1,1],[-1,-1]):
                nh,nw=i+h,j+w
                if nh<0 or nh>H-1 or nw<0 or nw>W-1:
                    continue
                if lst[nh][nw]=="#":
                    cnt+=1
            lst[i][j]=cnt

for i in range(H):
    print("".join(map(str,lst[i])))

Measured memory_bytes: 73932
#include <map>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>
#define For(i, a, b) for (i = a; i <= b; i++)
#define Step(i, a, b, x) for (i = a; i <= b; i += x)
using namespace std;
inline int read() {
    int res = 0; bool bo = 0; char c;
    while (((c = getchar()) < '0' || c > '9') && c != '-');
    if (c == '-') bo = 1; else res = c - 48;
    while ((c = getchar()) >= '0' && c <= '9')
        res = (res << 3) + (res << 1) + (c - 48);
    return bo ? ~res + 1 : res;
}
const int PYZ = 998244353;
map<string, int> f, g;
int F(string); int G(string);
int G(string s) {
    if (g[s]) return g[s]; int i, n = s.size(); if (n == 1) return g[s] = s[0] - '0' + 1;
    int j, k, res = 0; For (i, 1, n - 1) if (n % i == 0) {
        string t = ""; For (j, 1, i) {
            int r = 1; Step (k, j - 1, n - 1, i) r &= s[k] - '0';
            t += (char) (r + '0');
        }
        res = (res + F(t)) % PYZ;
    }
    return g[s] = res;
}
int F(string s) {
    if (f[s]) return f[s]; int i, n = s.size(); if (!n) return f[s] = 1;
    int res = 0; For (i, 1, n)
        res = (res + 1ll * G(s.substr(0, i)) * F(s.substr(i, n)) % PYZ) % PYZ;
    return f[s] = res;
}
int main() {
    string s; cin >> s; cout << F(s) << endl;
    return 0;
}

Measured memory_bytes: 14336
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        final int N = in.nextInt();
        final int K = in.nextInt();
        final String s = in.next();

        int ans = 0;
        int len = s.length();
        int left = 0;
        int right = 0;
        int countZeros = 0;

        while (right < len) {
            if (s.charAt(right) == '0') {
                countZeros++;
                for (int j = right + 1; j < len && s.charAt(j) == '0'; j++) {
                    right = j;
                }
                while (countZeros > K) {
                    if (s.charAt(left) == '0') {
                        --countZeros;
                        for (int j = left; j < len && s.charAt(j) == '0'; j++) {
                            left = j;
                        }
                    }
                    left++;
                }

            }
            ans = Math.max(ans, right - left + 1);
            right++;
        }
        System.out.println(ans);
    }
}

Measured memory_bytes: 24604
package main

import "fmt"

func main() {
	var num int
	var score = [2]int{0, 0}
	var taro, hanako string

	fmt.Scanf("%d", &num)

	for i := 0; i < num; i++ {
		fmt.Scanf("%s %s", &taro, &hanako)
		if taro > hanako {
			score[0] += 3
		} else if taro < hanako {
			score[1] += 3
		} else {
			score[0]++
			score[1]++
		}
	}

	fmt.Printf("%d %d\n", score[0], score[1])
}


Measured memory_bytes: 1180
'use strict';

const testcase = null;

function main(input) {
    const a = parseInt(input.shift());
    const b = parseInt(input.shift());
    console.log(Math.max(0, a - b * 2));
}

if (process.argv[1] == __filename) {
    const input = testcase
        || require('fs')
            .readFileSync('/dev/stdin', 'utf-8');
    main(input.split(/\s/));
}


Measured memory_bytes: 21956
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
const int INF = 100000000;
const int N_MAX = 200;

typedef long long ll;

int N;
int M;
int R;


ll d[300][300];

vector<int> r;



int main()
{
	for(int i = 0;i < 300;i++)
	{
		for(int j = 0;j < 300;j++)
		{
			d[i][j] = INF;
		}
	}
	int a,b,c,ri;
	cin >> N >> M >> R;
	for(int i = 0;i < R;i++)
	{
		cin >> ri;
		r.push_back(ri);	
	}
	for(int i = 0;i < M;i++)
	{
		cin >> a >> b >> c;
		d[a][b] = c;
		d[b][a] = c;
	}
	
for(int k = 1;k <= N;k++)
			{
	for(int i = 1;i <= N;i++)
	{
		for(int j = 1;j <= N;j++)
		{
			
				d[i][j] = min(d[i][j],d[i][k] + d[k][j]);
}
		}
	}
	
	ll min_ = 100000000000LL;

	sort(r.begin(),r.end());
	
	do
	{
		ll sum = 0;
		for(int i = 0;i < r.size() - 1;i++)
		{
			sum += d[r[i]][r[i+1]];
		}
		min_ = min(min_,sum);
	} while(next_permutation(r.begin(),r.end()));
	cout << min_ << endl;
	return 0;
}


Measured memory_bytes: 896
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int s1s2s3, s2s3, s1, s2, s3;
  cin >> s1s2s3;
  s1 = s1s2s3 / 100;
  s2s3 = s1s2s3 - s1 * 100;
  s2 = s2s3 / 10;
  s3 = s2s3 - s2 * 10;
  cout << s1 + s2 +s3 << endl;
}

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

using namespace std;

int main(){
  int n;
  std::cin >> n;
  vector<int> a(n);
  for(int i=0; i<n; i++){
    std::cin >> a[i];
  }

  int serach_num = 1;
  int min = INT_MAX;
  for(int i=0; i<n; i++){
    if( a[i] == serach_num ){
      min = n - serach_num;
      serach_num++;
    }
  }
  if( INT_MAX == min ) std::cout << -1 << '\n';
  else std::cout << min << '\n';
  return 0;
}


Measured memory_bytes: 1024
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
n = int(readline())
s = readline().rstrip().decode('utf-8')

"""
左端に(を、右端に)を必要なだけ与えることで辞書順最小になる
"""

eight = 0
nine = 0
flag = 0
th = 0
res = 0
for i in s:
    if i == ")":
        if th:
            th -= 1
        else:
            res += 1
    elif i == "(":
        th += 1
res2 = 0
th = 0
for i in s[::-1]:
    if i == "(":
        if th:
            th -= 1
        else:
            res2 += 1
    elif i == ")":
        th += 1

s = "("*res + s + ")"*res2
print(s)

Measured memory_bytes: 38256
// {{{
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <complex>
#include <cstdint>
#include <cstdio>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <limits>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <tuple>
#include <utility>
#include <vector>
using namespace std;
// }}}

using ll = long long;

#define FORR(t,x,v) for(t x=(v); x >= 0; x--)

int N;
vector<int> graph[101010];

int color[101010];

int main() {
    cin >> N;
    for (int j = 0; j < N-1; ++j) {
        int a, b; cin >> a >> b;
        --b; --a;
        graph[a].emplace_back(b);
        graph[b].emplace_back(a);
    }
    fill(color, color+N, -1);
    color[0] = 0; color[N-1] = 1;
    queue<int> que;
    que.push(0); que.push(N-1);
    while (!que.empty()) {
        int v = que.front(); que.pop();
        for (int w : graph[v]) {
            if (color[w] == -1) {
                color[w] = color[v];
                que.push(w);
            }
        }
    }

    int p0 = 0, p1 = 0;
    for (int j = 0; j < N; ++j) if (color[j] == 0) p0++;
    for (int j = 0; j < N; ++j) if (color[j] == 1) p1++;
    cout << (p0 > p1 ? "Fennec" : "Snuke") << endl;


    return 0;
}


Measured memory_bytes: 6272
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author aajisaka
 */

#include<bits/stdc++.h>

using namespace std;

void debug_out() { cerr << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cerr << " " << to_string(H);
  debug_out(T...);
}
#ifdef LOCAL
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define debug(...) 42
#endif

#define SPEED ios_base::sync_with_stdio(false);cin.tie(nullptr)
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define all(v) v.begin(), v.end()
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; }

using ll = long long;
using ull = unsigned long long;
using P = pair<ll, ll>;

constexpr long double PI = 3.14159265358979323846264338327950288L;
mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());

class AAC {
public:
    void solve(istream& cin, ostream& cout) {
      SPEED;
      string s; cin >> s;
      if (s[1] == 'B') {
        cout << "ARC" << endl;
      } else {
        cout << "ABC" << endl;
      }
    }
};

signed main() {
  AAC solver;
  std::istream& in(std::cin);
  std::ostream& out(std::cout);
  solver.solve(in, out);
  return 0;
}

Measured memory_bytes: 3648
/******************************************************************************

                            Online C Compiler.
                Code, Compile, Run and Debug C program online.
Write your code in this editor and press "Run" button to compile and execute it.

*******************************************************************************/


int main(void) {
 
    int a,b;
    scanf("%d %d",&a,&b);
    if(a<b)printf("0");
    else printf("10");
    return 0;
}


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

long long int n,a,b,c;
vector<long long int> h;
long long int po = 0;

bool check(long long int i){
    long long int s = 0;
    for(long long int p=0;p<n;p++){
        if(h[p] > (b*i)){
            s += ceil((long double)(h[p]-(b*i))/(long double)c);
        }
    }
    return (i>=s);
}

int main(){
    cin >> n >> a >> b;
    c = a-b;
    for(long long int i=0;i<n;i++){
        cin >> po;
        h.push_back(po);
    }
    long long int l = 0;
    long long int r = 10000000005;
    while(l<=r){
        long long int mid=(l+r)/2;
        if(check(mid))r=mid-1;
        else l=mid+1;
    }
    cout << l <<endl;
    return 0;
}


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

using namespace std;

pair<int, int>v[200002];
int n, p[200002];

int main()
{
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> v[i].first;
    v[i].second = i;
  }
  sort (v + 1, v + n + 1);
  for (int i = 1; i <= n; i++)
    p[v[i].second] = i;
  for (int i = 1; i <= n; i++) {
    int x = p[i];
    if (x <= n / 2)
      cout << v[n / 2 + 1].first << "\n";
    else
      cout << v[n / 2].first << "\n";
  }
  return 0;
}


Measured memory_bytes: 4480
#include<iostream>
#include<string.h>
using namespace std;
const int N=1000000;
bool isprime[N];
int prime[N];
int k=0;
void init()
{
    isprime[0]=isprime[1]=false;
    for(int i=2;i<N;i++)
    {
        if(isprime[i]) prime[k++]=i;
        for(int j=0;j<k;j++)
        {
            int d=i*prime[j];
            if(d>=N) break;
            isprime[d]=false;
            if(i%prime[j]==0) break;
        }
    }
}
int main()
{
    int n;
    memset(isprime,true,sizeof(isprime));
    init();
    while(cin>>n)
    {
        int i;
        for(i=0;i<k;i++)
            if(n<prime[i])
                break;
        cout<<i<<endl;
    }
    return 0;
}

Measured memory_bytes: 4356
#include <stdio.h>
int main(void)
{
	char S[3], T[3];
	int i;
	int count = 0;
	scanf("%s", S);
	scanf("%s", T);
	
	for (i = 0; i < 3; i++) {
		if(S[i] == T[i]){ count++; }
	}
	printf("%d\n", count);
	return 0;
}


Measured memory_bytes: 128
#include <algorithm>
#include <climits>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <limits>
#include <map>
#include <memory>
#include <numeric>
#include <queue>
#include <set>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>

//std::cout << std::fixed << std::setprecision(10)
constexpr long long MOD = 1000000007;

int main()
{
  int N;
  std::cin >> N;
  std::map<int, int> map;
  std::vector<int> A;
  A.reserve(N);
  while(N--)
  {
    int val;
    std::cin >> val;
    A.push_back(val);
    auto it = map.find(val);
    if (it != map.end())
    {
      ++it->second;
    }
    else
    {
      map.insert({val, 1});
    }
  }
  auto maxIt = map.end();
  --maxIt;
  if (1 < maxIt->second)
  {
    for (int i = 0; i < A.size(); ++i)
      std::cout << maxIt->first << "\n";
  }
  else
  {
    for (auto val: A)
    {
      if (val == maxIt->first)
      {
        auto it = maxIt;
        --it;
        std::cout << it->first << "\n";
      }
      else
      {
        std::cout << maxIt->first << "\n";
      }
    }
  }
  std::cout << std::flush;
  return 0;
}



Measured memory_bytes: 7936
import java.util.Scanner;
public class Main {
	//?????°
	public static int x;
	//????????????
		public static void solve(){
			Scanner sc = new Scanner(System.in);
			x =sc.nextInt();
			System.out.println(x*x*x);
		}
		public static void main(String[] args) {
			solve();

		}
}

Measured memory_bytes: 26156
#include <stdio.h>
int main(void)
{
	int x1,x2,a;
	scanf("%d %d",&x1,&x2);
	if(x1>x2){
		a=x1-x2;
	}
	else if(x1<x2){
		a=x2-x1;
	}
	else {
		a=x1-x2;
	}
	printf("%d\n",a);
	return 0;
}


Measured memory_bytes: 2112
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll INF = LONG_LONG_MAX / 2;
const ll mod = 1000000000 + 7;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

int main() {
  int a, b, c, d;
  cin >> a >> b >> c >> d;
  if (abs(a - c) <= d || (abs(a - b) <= d && abs(b - c) <= d))
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
}


Measured memory_bytes: 3596
#include <iostream>
#include <algorithm>
using namespace std; //45351135
int a[4];
int main()
{
    for(int i=1;i<=3;i++) cin>>a[i];
    sort(a+1,a+4);
    if(a[3]-a[2]==a[2]-a[1]) cout<<"YES"<<endl;
    else cout<<"NO"<<endl;
    return 0;
}

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

#define MAX_N 200005
#define INF 1001001001

vector<int> a,ans;
vector<int> edge[MAX_N];
int dp[MAX_N];

void dfs(int v,int p=-1){
  int i = lower_bound(dp,dp+MAX_N,a[v]) - dp;
  int save = dp[i];
  dp[i] = a[v];

  ans[v] = lower_bound(dp,dp+MAX_N,INF) - dp - 1;

  for(auto u: edge[v]){
    if(u==p) continue;
    dfs(u,v);
  }

  dp[i] = save;
}


int main(){

  int N;
  cin >> N;
  a.resize(N);
  ans.resize(N);

  for(int i=0;i<N;i++) cin >> a[i];

  for(int i=0;i<N-1;i++){
    int u,v;
    cin >> u >> v;u--;v--;
    edge[u].push_back(v);
    edge[v].push_back(u);
  }

  for(int i=0;i<MAX_N;i++) dp[i]=INF;
  dp[0]=-INF;

  dfs(0);

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

Measured memory_bytes: 30896
#include<bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i) 
#define PI acos(-1)

using namespace std;
using ll = long long;
using P = pair<int, int>;
using LP = pair<ll, ll>;

bool check(string s) {
    string sr;
    reverse_copy(s.begin(), s.end(), back_inserter(sr));
    return (s == sr);
}

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

    string S;
    cin>>S;
    int n = S.size();

    string sub1, sub2;
    sub1 = S.substr(0, (n - 1) / 2);
    sub2 = S.substr((n + 1) / 2);
    bool res = true;
    res = res && check(S);
    res = res && check(sub1);
    res = res && check(sub2);
    if (res) cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
}

Measured memory_bytes: 256
import java.util.Scanner

import scala.annotation.tailrec

object Main {

  case class GF(representative: Long) extends AnyVal {
    def +(that: GF): GF = GF((this.representative + that.representative) % GF.mod)

    def -(that: GF): GF = GF((this.representative - that.representative + GF.mod) % GF.mod)

    def *(that: GF): GF = GF((this.representative * that.representative) % GF.mod)

    def /(that: GF): GF = this * that.inv

    def unary_- : GF = GF((-this.representative + GF.mod) % GF.mod)

    def inv: GF = GF.powGF(this, GF.mod - 2)
  }

  object GF {
    val mod: Long = (1e9 + 7).toLong

    val _0: GF = GF(0)
    val _1: GF = GF(1)

    def powGF(x: GF, t: Long): GF = {
      if (t == 0) {
        return GF(1)
      }
      val y = powGF(x, t / 2)
      if (t % 2 == 0) {
        y * y
      } else {
        x * y * y
      }
    }
  }

  val fracGF = (1 to 300000).map(GF(_)).scanLeft(GF(1))(_ * _)

  def combGF(n: Int, r: Int): GF = fracGF(n) / (fracGF(r) * fracGF(n - r))


  def read() = {
    val sc = new Scanner(System.in)
    val n, m, k = sc.nextInt()
    (n, m, k)
  }


  def solve(n: Int, m: Int, k: Int): Long = {
    // 0+1+...+p
    def sum(p: Int) = GF(p) * (GF(p) + GF(1)) / GF(2)

    (combGF(n * m - 2, k - 2) / GF(2) *
      (for (y <- 0 until n; x <- 0 until m) yield {
        GF(n) * (sum(x) + sum(m - x - 1)) + GF(m) * (sum(y) + sum(n - y - 1))
      }).foldLeft(GF._0)(_ + _)).representative
  }


  def main(args: Array[String]): Unit = {
    val (n, m, k) = read()
    val result = solve(n, m, k)
    println(result)
  }
}

Measured memory_bytes: 86332
from sys import exit
N,K = [int(n) for n in input().split()]
# N = int(input())
# a = [int(input()) for _ in range(N)]
S = str(input())
L = len(S)
lis = []
if(S[0] == "0"):#偶数Indexがブリッジ
    lis.append(0)
tmp = S[0]

for i in range(1,L):
    if(S[i]!=S[i-1]):
        lis.append(len(tmp))
        tmp =S[i]
    else:
        tmp+=S[i]
lis.append(len(tmp))
#0で終わっていたら最後に１が0個であるとする
if("0" in tmp):
    lis.append(0)
# print(lis)

#累積和をとる
L = len(lis)
# print(L)
asum = [0]*(L+1)
asum[0] = 0
for i in range(1,L+1):
    asum[i] = asum[i-1] + lis[i-1]
# print(asum)

#尺をとる
l = 0
ans = max(lis) if l+2*K+1 < L+1 else sum(lis)
for r in range(l+2*K+1 , L+1,2):
    # print(l,r)
    # print(asum[r] - asum[l])
    ans = max(asum[r] - asum[l],ans)
    l+=2
print(ans)

# 14 2
# 11101010110011
# 10 1
# 0000000001


Measured memory_bytes: 7932
import copy #listは参照渡しだからこれが必要

n = int(input())
a = [int(input()) for i in range(n)]
max_a = max(a)
count_max = a.count(max_a)

if count_max > 1:
    for i in range(n):
        print(max_a)
else:
    for i in range(n):
        if a[i] != max_a:
            print(max_a)
        else:
            b = copy.deepcopy(a) #b = aだとアドレス？ごとbも渡してしまう
            b.pop(b.index(max_a))
            print(max(b))


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

using namespace std;

int main() {
    int n;
    double d;
    cin >> n >> d;
    pair<int,int> a[n];
    for(int i=0;i<n;i++) {
        cin >> a[i].first >> a[i].second;
    }
    int cnt = 0;
    for(int i=0;i<n;i++) {
        double x = (double)(a[i].first);
        double y = (double)(a[i].second);
        double dist = sqrt(x*x + y*y);
        if(dist <= d) {
            cnt++;
        }
    }
    cout << cnt << "\n";
}

Measured memory_bytes: 5276
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <functional>
#include <bitset>
#include <cmath>
#include <stack>
#include <iomanip>
#include <map>
#include <math.h>
typedef long long ll;
using namespace std;
const int MOD = 1000000007;

ll GCD(ll a, ll b) { return b ? GCD(b, a%b) : a; }

int main()
{
    int N;
    cin >> N;
    vector<int> A(N);
    for(int i = 0; i < N; i++) cin >> A[i];
    sort(A.begin(),A.end());
    for(int i = 0; i < N - 1; i++)
    {
        if(A[i] == A[i+1])
        {
            cout << "NO" << endl;
            return(0);
        }
    }
    cout << "YES" << endl;
}

Measured memory_bytes: 1024
import java.util.*;
import javax.lang.model.util.ElementScanner6;

public class Main {

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

        // 入力
        String c = sc.next();

        // 処理
        char out = c.toCharArray()[0];
        out++;

        // 出力
        System.out.println(out);
    }
}

Measured memory_bytes: 23124
#include <iostream>
#include <vector>
#include <string>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <algorithm>	// require sort next_permutation count __gcd reverse etc.
#include <cstdlib>	// require abs exit atof atoi 
#include <cstdio>		// require scanf printf
#include <functional>
#include <numeric>	// require accumulate
#include <cmath>		// require fabs
#include <climits>
#include <limits>
#include <cfloat>
#include <iomanip>	// require setw
#include <sstream>	// require stringstream 
#include <cstring>	// require memset
#include <cctype>		// require tolower, toupper
#include <fstream>	// require freopen
#include <ctime>		// require srand
#define rep(i,n) for(int i=0;i<(n);i++)
#define ALL(A) A.begin(), A.end()

using namespace std;

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

int main()
{
//	cut here before submit 
//	freopen ("testcase.Rank_Checker", "r", stdin );

	int n, m;	// n: 整理番号 m: 正解数
	vector<P> rank; rank.clear();
	while (scanf ("%d,%d", &n, &m ), n|m ){
		rank.push_back (P (-m, n ) );
	} // end while
	sort (ALL (rank ) );
	vector<int> res (rank.size(), 0 );
	res[0] = 1;
	for (int i = 1; i < rank.size(); i++ ){
		if (rank[i].first == rank[i-1].first ){
			res[i] = res[i-1];
		}else{
			res[i] = res[i-1] + 1;
		} // end if
	} // end for
	int q;
	while (scanf ("%d", &q ) != EOF ){
		rep (i, rank.size() ){
			if (rank[i].second == q ){
				printf ("%d\n", res[i] );
				break;
			} // end if
		} // end rep
	} // end while

	return 0;
}

Measured memory_bytes: 1192