akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#pragma GCC optimize("Ofast")
#pragma GCC target("avx")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#define all(x) (x).begin(),(x).end()
#define rep(i,n) for(int (i)=0;i<(n);i++)
#define REP(i,m,n) for(int (i)=(m);(i)<(n);(i)++)
#define MOD 1000000007
#define fcout cout << fixed << setprecision(15)
#define int long long
#define endl "\n"
#define yorn(f) puts((f)?"Yes":"No")
#define YORN(f) puts((f)?"YES":"NO")
typedef long long ll;
typedef pair<int, int> P;
int gcd(int a,int b){return b?gcd(b,a%b):a;};
int lcm(int a,int b){return a/gcd(a,b)*b;};
int mod(int a,int b){return (a+b-1)/b;};
template<typename A, size_t N, typename T>
void Fill(A(&array)[N],const T &val){std::fill((T*)array,(T*)(array+N),val);}
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;};

class UnionFind {
public:
    vector <ll> par; // 各元の親を表す配列
    vector <ll> siz; // 素集合のサイズを表す配列(1 で初期化)

    // Constructor
    UnionFind(ll sz_): par(sz_), siz(sz_, 1LL) {
        for (ll i = 0; i < sz_; ++i) par[i] = i; // 初期では親は自分自身
    }
    void init(ll sz_) {
        par.resize(sz_);
        siz.assign(sz_, 1LL);  // resize だとなぜか初期化されなかった
        for (ll i = 0; i < sz_; ++i) par[i] = i; // 初期では親は自分自身
    }

    // Member Function
    // Find
    ll root(ll x) { // 根の検索
        while (par[x] != x) {
            x = par[x] = par[par[x]]; // x の親の親を x の親とする
        }
        return x;
    }

    // Union(Unite, Merge)
    bool unite(ll x, ll y) {
        x = root(x);
        y = root(y);
        if (x == y) return false;
        // merge technique（データ構造をマージするテク．小を大にくっつける）
        if (siz[x] < siz[y]) swap(x, y);
        siz[x] += siz[y];
        par[y] = x;
        return true;
    }

    bool same(ll x, ll y) { // 連結判定
        return root(x) == root(y);
    }

    ll getsize(ll x) { // 素集合のサイズ
        return siz[root(x)];
    }
};

signed main() {
    cin.tie(0);
    cout.tie(0);
    ios::sync_with_stdio(false);
    
    int n, m;
    cin >> n >> m;
    UnionFind ut(n);
    vector<int> p(n);
    rep(i, n) cin >> p[i], p[i]--;
    rep(i, m) {
        int x, y;
        cin >> x >> y;
        ut.unite(--x, --y);
    }
    int ans = 0;
    rep(i, n) {
        if(ut.same(i, p[i])) ans++;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 2560
def solve(a, b):
    d, m = divmod(a + b, 2)
    if m == 0:
        return d
    else:
        return None


def main():
    a, b = (int(z) for z in input().split())
    res = solve(a, b)
    print("IMPOSSIBLE" if res is None else res)


if __name__ == "__main__":
    main()

Measured memory_bytes: 3316
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int i, j, h, w;
        while(true){
            h = sc.nextInt();
            w = sc.nextInt();
            if(h == 0 && w == 0) break;
            for(i = 0; i < h; i++){
                if(i == 0 || i == h - 1){
                    for(j = 0; j < w; j++){
                        System.out.printf("#");
                    }
                }else
                {
                    System.out.printf("#");
                    for(j = 1; j < w - 1; j++){
                        System.out.printf(".");
                    }
                    System.out.printf("#");
                }
                System.out.printf("\n");
            }
            System.out.printf("\n");
        }
        sc.close();
    }
}


Measured memory_bytes: 60744
#include<stdio.h>

int main(void){
    int i,j,k,n,x,count;
    
    while(1){
        count=0;
        scanf("%d %d",&n,&x);
        if(n==0&&x==0){
            break;
        }else{
            for(i=1;i<=n-2;i++){
                for(j=i+1;j<=n-1;j++){
                    for(k=j+1;k<=n;k++){
                        if((i+j+k)==x) count++;
                    }
                }
            }
        }
        printf("%d\n",count);
    }
    
    return 0;
}


Measured memory_bytes: 2100
def main():
    from sys import stdin, setrecursionlimit
    setrecursionlimit(10**6)
    r = stdin.readline()[:-1]
    #n = int(stdin.readline()[:-1])   
    #r = [stdin.readline() for i in range(n)]
    #t = [int(stdin.readline()) for i in range(n)]

    res = 0
    for i in r:
        if i == "+":
            res += 1
        else:
            res -= 1
    print(res)

if __name__ == '__main__':
    main()



Measured memory_bytes: 38256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,c) for(int i=0;i<c;++i)
int main(){
 int a;
 cin >> a;
 vector<int>b(a);
 rep(i,a){
   cin >> b[i];
 }
 sort(b.begin(),b.end());
 int d =0;
 rep(i,b.size()-1){
   d +=b[i];
 }
 if(d>b[a-1]){
   cout << "Yes" << endl;
 }else{
   cout << "No" << endl;
 }
 return 0;
}

Measured memory_bytes: 256
/// إِنَّ مَعَ الْعُسْرِ يُسْرًا
/// لَا أَبْرَحُ حَتَّىٰ أَبْلُغَ

#include <bits/stdc++.h>
#include <ext/rope>
#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>

using namespace __gnu_cxx;
using namespace __gnu_pbds;
using namespace std;
template<class T> using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

#define ll long long
#define ld  double

#define HabdModeActive ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define S second
#define F first
#define PI acos(-1)
#define MAX 5000005
#define file freopen("input.txt","r",stdin); freopen("output.txt","w",stdout);
const int N = 2e5 + 5;
int cnt [N];
int main() {
    HabdModeActive
    int n;
    cin>>n;
    int arr[n+2];
    for(int i=1 ; i<=n; i++)
    {
        cin>>arr[i];
    }
    vector<int>vec;
    for(int i=n ; i>=1  ; i--)
    {
        if(arr[i] != cnt[i]%2)
        {
            vec.push_back(i);
            cnt[i]++;
            for(ll j=1 ;j*j <= i ; j++)
            {
                if(i%j==0 && i!=j)
                {
                    cnt[j]++;
                    if(j*j != i)
                        cnt[i/j]++;
                }
            }
        }
    }
    if(cnt[1]%2 != arr[1])
        cout<<-1;
    else{
        cout<<vec.size()<<endl;
        for(auto v :vec)
            cout<<v<<" ";
    }

    return 0;
}


Measured memory_bytes: 5384
import math
import sys

def main():
    N=int(input())
    C=list(input())
    res=0
    #WRRW WRWRW
    R=0
    W=0
    for i in range(len(C)):
        if C[i]=="W":
            W+=1
        else:
            R+=1
    for i in range(len(C)):
        if i<R:
            if C[i]=="W":
                res+=1
    print(res)
if __name__=="__main__":
    main()

Measured memory_bytes: 73236
#include<bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i) 
#define rrep(i, a, b) for (int i = (a); i < (b); ++i)
#define PI acos(-1)
#define pcnt __builtin_popcountll
#define rng(a) a.begin(), a.end()
#define rrng(a) a.rbegin(), a.rend()
#define sz(x) (int)(x).size()
#define v(T) vector<T>
#define vv(T) v(v(T))
#define fi first
#define se second

using namespace std;
using ll = long long;
using ld = long double;
using P = pair<int, int>;
using LP = pair<ll, ll>;
using vi = vector<int>;
using vvi = vector<vi>;
using vl = vector<ll>;
using vvl = vector<vl>;
using tl = tuple<ll, ll, ll>;

template<typename T>inline istream& operator>>(istream&i,v(T)&v)
{rep(j,sz(v))i>>v[j];return i;}
template<typename T1,typename T2>inline istream& operator>>(istream&i,pair<T1,T2>&v)
{return i>>v.fi>>v.se;}
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; }

ll INF = 1001001001;
ll LINF = 1001001001001001001ll;

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

    ll n, k; cin>>n>>k;
    vl as(n); cin>>as;

    ll ma = 0;
    rep(i, n) chmax(ma, as[i]);

    ll l = 0, r = ma;
    while (l + 1 < r) {
        ll m = (l + r) / 2;
        ll c = 0;
        rep(i, n) {
            c += (as[i] + m - 1) / m - 1;
        }
        if (c <= k) r = m;
        else l = m;
    }
    cout<<r<<endl;
}

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

int main(){
    int n; cin>>n;
    int a[100010],b[100010],c[100010];
    for(int i=0;i<n;i++)cin>>a[i];
    for(int i=0;i<n;i++)cin>>b[i];
    for(int i=0;i<n;i++)cin>>c[i];
    sort(a,a+n);
    sort(c,c+n);
    ll ans=0;
    for(int i=0;i<n;i++){
        int* lb=lower_bound(a,a+n,b[i]);
        int* ub=upper_bound(c,c+n,b[i]);
        ans+=(lb-a)*(n-(int)(ub-c));
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 1408
x, y, a, b, c = map(int,input().split())
alist = list(map(int, input().split()))
alist=sorted(alist, reverse=True)
blist = list(map(int, input().split()))
blist=sorted(blist, reverse=True)
clist = list(map(int, input().split()))
clist=sorted(clist, reverse=True)

ringo=[]
for i in range(x):
    ringo.append(alist[i])
for j in range(y):
    ringo.append(blist[j])

ringo=sorted(ringo)
swit=0
now=0
#print(ringo)
while swit==0:
    if ringo[now]<=clist[now]:
        ringo[now]=clist[now]
        now+=1
        if now>=len(ringo) or now>=len(clist):
            swit=1
    else:
        swit=1

print(sum(ringo))

Measured memory_bytes: 108396
# -*- coding: utf-8 -*-
from sys import stdin

s_in = lambda: stdin.readline()[:-1]  # s = s_in()
d_in = lambda: int(stdin.readline())  # N = d_in()
ds_in = lambda: list(map(int, stdin.readline().split()))  # List = ds_in()

S = s_in()
N = len(S)
right_black = N

ans = 0
for i, s in enumerate(S[::-1]):
    if s == 'B':
        idx = N - i
        ans += right_black - idx
        right_black -= 1

print(ans)


Measured memory_bytes: 3500
#include <iostream>

using namespace std;

int main()
{
    int N;
    int pm,pe,pj;
    cin>>N;
    while(N){
        for(int i=0;i<N;i++){
            cin>>pm>>pe>>pj;
            if(pm==100||pe==100||pj==100||pm+pe>=180||pm+pe+pj>=240){
                cout<<"A"<<endl;
            }else if(pm+pe+pj>=210||(pm+pe+pj>=150&&(pm>=80||pe>=80))){
                cout<<"B"<<endl;
            }else{
                cout<<"C"<<endl;
            }
        }
        cin>>N;
    }
}

Measured memory_bytes: 1152
#include<iostream>
#include<cstring>
#include<cstdio>
#include<cmath>

using namespace std;

int main()
{
	int a,b,c,d;
    scanf("%d%d%d%d",&a,&b,&c,&d);
    if(abs(c-a)<=d)
        printf("Yes");
    else if(abs(a-b)<=d && abs(c-b)<=d)
        printf("Yes");
    else printf("No");
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define show(x) cout << #x << " : " << x << endl

int main ()
{
    int n, m, i, in;
    long long sum = 0;
    cin >> n >> m;
    int a[n+1];
    priority_queue < int > pq;
    for(i = 1; i <= n; i++)
    {
        cin >> in;
        pq.push(in);
    }
    while(m > 0)
    {
        in = pq.top() / 2; pq.pop();
        m--;
        pq.push(in);
    }
    while(!pq.empty())
    {
        sum += pq.top();
        pq.pop();
    }
    cout << sum << endl;
}


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

public class Main
{
  public static void main(String[] args) throws NumberFormatException, IOException
  {
    BufferedReader input = new BufferedReader(new InputStreamReader(System.in));

    while (input.ready())
    {
      String[] dataStr = input.readLine().split(" ");
      int[] dataInt = new int[dataStr.length];
      for (int i = 0; i < dataStr.length; i++)
      {
        dataInt[i] = Integer.valueOf(dataStr[i]);
      }
      System.out.println(getGCD(dataInt[0], dataInt[1]) + " " + getLCM(dataInt[0], dataInt[1]));
    }
  }

  public static int getGCD(int num1, int num2)
  {
    if (num1 == num2)
      return num1;

    int a  = Math.max(num1, num2);
    int b = Math.min(num1, num2);
    int c = 1;

    while (true)
    {
      c = a % b;
      if(c == 0) {
        break;
      }
      a = b;
      b = c;
    }
    return b;
  }

  public static int getLCM(int a, int b)
  {
    int productA = a;
    int productB = b;
    while (productA <= 2000000000)
    {
      if (productA == productB)
      {
        return productA;
      }
      if (productA < productB)
      {
        productA += a;
      }
      else
      {
        productB += b;
      }
    }
    return 0;
  }
}

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

signed main() {
  int n;
  cin >> n;

  vector<int> c(n - 1), s(n - 1), f(n - 1);
  for (int i = 0; i < n - 1; i++) {
    cin >> c[i] >> s[i] >> f[i];
  }

  for (int i = 0; i < n; i++) {
    if(i == n - 1) {
      cout << 0 << '\n';
      break;
    }
    int cur = 0;
    for (int j = i; j < n - 1; j++) {
      if(j == i) {
        cur = cur + s[j] + c[j];
        continue;
      }

      cur = max(cur, s[j]);
      int nxt = (cur + f[j] - 1) / f[j];
      nxt *= f[j];
      cur += (nxt - cur);
      cur += c[j];
    }
    cout << cur << '\n';
  }
}


Measured memory_bytes: 3620
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
#define rep(i,N) for(int i = 0; i < (N); i++)
#define erep(i,N) for(int i = N - 1; i >= 0; i--)
const ll INF = 1000000000;
const ll mod = 1000000007;
#define PI 3.1415926535
using Graph = vector<vector<int>>;
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;}
typedef pair<int, int> pair;
bool seen[505][505];

//dpTable
//bool dp[100050];

int main(){
    int K,X;
    cin >> K >> X;
    for (int i = X - K + 1; i <= X + K - 1; i++) {
        cout << i << ' ';
    }
    cout << endl;
    return 0;
}

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

long long n, m;
vector<vector<long long>> g;
vector<long long> h;

int main() {
  cin >> n >> m;
  g.resize(n);
  h.resize(n);
  for (int i = 0; i < n; ++i) cin >> h[i];
  for (int i = 0; i < m; ++i) {
    int a, b;
    cin >> a >> b;
    --a, --b;
    g[a].push_back(b);
    g[b].push_back(a);
  }
  int res = 0;
  for (int i = 0; i < n; ++i) {
    bool ch = 0;
    for (auto to : g[i])
      if (h[i] <= h[to]) ch = 1;
    if (!ch) ++res;
  }
  cout << res << endl;
  return 0;
}

Measured memory_bytes: 9800
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define mp make_pair
ll pr=0;
map<ll,ll> mmap;
int vis[100005];
ll sum(ll x,ll arr[],ll n)
{
	if(x==n-3)
		return min(abs(arr[x+1]-arr[x])+abs(arr[x+2]-arr[x+1]),abs(arr[x+2]-arr[x]));
	else if(x==n-2)
		return abs(arr[x+1]-arr[x]);
	if(vis[x+1]==0)
	{
		mmap[x+1]=sum(x+1,arr,n);
		vis[x+1]=1;
	}
	if(vis[x+2]==0)
	{
		mmap[x+2]=sum(x+2,arr,n);
		vis[x+2]=1;
	}
	return min(abs(arr[x+1]-arr[x])+mmap[x+1],abs(arr[x+2]-arr[x])+mmap[x+2]);
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll n;
    cin>>n;
    memset(vis,0,sizeof(vis));
	ll arr[n];
	for(int i=0;i<n;i++)
	{
		cin>>arr[i];
	}
	ll ans=sum(0,arr,n);
	cout<<ans<<endl;   
}


Measured memory_bytes: 20224
#include <bits/stdc++.h>
using namespace std;
typedef pair<int,int> pii;

#define mem(dp,a)       memset(dp,a,sizeof dp)
#define ninja           ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define pb(x)           push_back(x)
#define all(c)          c.begin(), c.end()
#define int             long long
#define ff              first
#define ss              second
#define nl              '\n'


int32_t main()
{
	ninja
	int k;cin>>k;
	int a,b; cin>>a>>b;
	for(int i=a;i<=b;i++){
		if(i%k==0){
			cout<<"OK"; return 0;
		}
	}

	cout<<"NG";
}



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

using namespace std;

int main(){
    int a, b; cin >> a >> b;
    if(a+b == 15){
        cout << '+' << endl;
    }else if(a * b == 15){
        cout << '*' << endl;
    }else{
        cout << 'x' << endl;
    }

    return 0;
}

Measured memory_bytes: 256
import sys

input = sys.stdin.readline


def main():
    N = int(input())
    txy = []
    txy.append([0, 0, 0])
    for _ in range(N):
        txy.append([int(x) for x in input().split()])

    for i in range(1, N + 1):
        t, x, y = txy[i]
        pt, px, py = txy[i - 1]
        if abs(px - x) + abs(py - y) > abs(pt - t) or (abs(px - x) + abs(py - y) - abs(pt - t)) % 2 == 1:
            print("No")
            break
    else:
        print("Yes")


if __name__ == '__main__':
    main()


Measured memory_bytes: 21108
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
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;}
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define all(vec) vec.begin(),vec.end()
typedef long long ll;
typedef pair<ll,ll> l_l;
typedef pair<int,int> i_i;
const ll mod=1e9+7;
const int inf=1<<30;

int main(){
  ll n; cin >> n;
  vector<ll> v(5);
  rep(i,5) cin >> v[i];
  sort(all(v));
  ll ans=5+n/v[0];
  if(n%v[0]==0) ans--;
  cout << ans << endl;
  
}

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

using namespace std;


int gcd(int a,int b)
{
	if (a % b == 0)
	{
		return b;
    }
	else
	{
		return gcd(b , a % b);
    }
}


int main() {
	int n;

	cin >> n;

	int a[n];
	int fa[n];
	int ba[n];

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

	fa[0] = a[0];
	for (int i = 1; i < n; i++) {
		fa[i] = gcd(fa[i - 1], a[i]);
	}

	ba[n - 1] = a[n - 1];
	for (int i = n - 2; i >= 0; i--) {
		ba[i] = gcd(a[i], ba[i + 1]);
	}

	int ans = max(ba[1], fa[n - 2]);

	for (int i = 1; i < n - 1; i++) {
		ans = max(ans, gcd(fa[i -1],ba[i+1]));
	}

	cout << ans << endl;

	return 0;

}

Measured memory_bytes: 1408
#include <bits/stdc++.h>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <cstring>
#include <chrono>
#include <complex>
#define endl "\n"
#define ll long long int
#define vi vector<int>
#define vll vector<ll>
#define vvi vector < vi >
#define pii pair<int,int>
#define pll pair<long long, long long>
#define mod 1000000007
#define inf 1000000000000000001;
#define all(c) c.begin(),c.end()
#define mp(x,y) make_pair(x,y)
#define mem(a,val) memset(a,val,sizeof(a))
#define eb emplace_back
#define f first
//#define s second

using namespace std;

void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}

template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i : x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifndef ONLINE_JUDGE
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define debug(x...)
#endif

/*********************************************START**************************************************************************/


int main()
{
	std::ios::sync_with_stdio(false);
	cin.tie(NULL);
	int T  = 1;
	//int T;
	//cin >> T;
	// cin.ignore(); //must be there when using getline(cin, s)
	while (T--)
	{
		int n; cin >> n; 
		vector<ll>arr(n);
		for(int i=0; i<n; i++){
			cin >> arr[i];
		}
		ll ans = 0; 
		for(int i=1; i<n; i++){
			if(arr[i] < arr[i-1]){
				ans += arr[i-1]-arr[i];
				arr[i] = arr[i-1];
			}
		}
		cout << ans << endl;
					
					
	}

	return 0;
}
 


Measured memory_bytes: 4792
#include <bits/stdc++.h>
#include <math.h>
#include <cmath>

using namespace std;
using ll =long long;
#define rep(i,n) ;for( int i =0; i < n ; i ++)
bool is_int_lround(double x){
  return std::lround(x)==x;
}
int ketasuu(int x){
  int n=0;
  while(x>0){
    x /=10 ;
    n ++;
  }
  return n;
}
ll gcd11(ll x, ll y){
  long long a= max(x,y), b=min(x,y), c=a%b;
  while( c!=0){
    a =b;
    b =c;
    c = a%b;
  }
  return b;
}

int abs(int x, int y){
  if(x>=y){
    return x-y;
  }
  else if(y>x){
    return y-x;
  }
}
int fiv(int n){
  if(n==0){
    return 0;
  }
  else if(n==1){
    return 1;
  }
  return fiv(n-1)+fiv(n-2);
}
int main(){
  int n,r;
  cin>>n>>r;
  if(n>=10){
    cout<<r<<endl;
  }
  else{
    cout<<r+100*(10-n)<<endl;
  }
}


Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main() {
    
    int S, h, m, s;
    cin >> S;
    
    h = S / (60 * 60);
    m = S % (60 * 60) / 60;
    s = S % 60;
    
    cout << h << ":" << m << ":" << s << endl;

    
    return 0;
}

Measured memory_bytes: 1164
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
using System.Globalization;
using static System.Console;
using Pair = System.Collections.Generic.KeyValuePair<int, int>;

class Program
{
    static void Main()
    {
        var sw = new StreamWriter(OpenStandardOutput()) { AutoFlush = false };
        SetOut(sw);
        new Program().solve();
        Out.Flush();
    }
    Scanner cin = new Scanner();
    readonly int[] dd = { 0, 1, 0, -1, 0 };
    readonly int mod = 1000000007;
    readonly string alfa = "abcdefghijklmnopqrstuvwxyz";

    bool flag = false;
    string S;
    void solve()
    {
        S = cin.next;
        ans(0);
        if (flag)
        {
            WriteLine("YES");
        }
        else
        {
            WriteLine("NO");
        }
    }
    void ans(int n)
    {
        if(n == S.Length)
        {
            flag = true;
            return;
        }
        if (n + 4 >= S.Length) return;
        if (S[n] == 'e')
        {
            if (S.Substring(n, 5) != "erase") return;

            if (n + 5 < S.Length && S[n + 5] == 'r') ans(n + 6);
            ans(n + 5);
        }
        else if (S[n] == 'd')
        {
            if (S.Substring(n, 5) != "dream") return;
            if (n + 6  < S.Length && S[n + 5] == 'e' && S[n + 6] == 'r') ans(n + 7);
            ans(n + 5);
        }
        else return;
    }
}

class Scanner
{
    string[] s; int i;
    char[] cs = new char[] { ' ' };
    public Scanner() { s = new string[0]; i = 0; }
    public string[] scan { get { return ReadLine().Split(); } }
    public int[] scanint { get { return Array.ConvertAll(scan, int.Parse); } }
    public long[] scanlong { get { return Array.ConvertAll(scan, long.Parse); } }
    public double[] scandouble { get { return Array.ConvertAll(scan, double.Parse); } }
    public string next
    {
        get
        {
            if (i < s.Length) return s[i++];
            string st = ReadLine();
            while (st == "") st = ReadLine();
            s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
            i = 0;
            return next;
        }
    }
    public int nextint { get { return int.Parse(next); } }
    public long nextlong { get { return long.Parse(next); } }
    public double nextdouble { get { return double.Parse(next); } }
}

Measured memory_bytes: 4696
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0, i##_len = (int)(n); i < i##_len; i++)
#define rep1(i, n) for (int i = 1, i##_len = (int)(n); i <= i##_len; i++)
#define rrep(i, n) for (int i = (int)(n)-1; 0 <= i; i--)
#define rrep1(i, n) for (int i = (int)(n); 1 <= i; i--)

#define each(it, c) \
    for (__typeof((c).begin()) it = (c).begin(); it != (c).end(); it++)
#define all(obj) (obj).begin(), (obj).end()

#define pcount __builtin_popcount
#define SZ(x) ((int)(x).size())
#define LEN(x) ((int)(x).length())

#define dump(x) cerr << #x << " = " << (x) << endl;

#define endl "\n"

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

typedef long long lint;

using namespace std;
vector<int> a;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    rep(i, n) {
        int tmp;
        cin >> tmp;
        a.push_back(tmp);
    }
    int ans = 0;
    sort(all(a));
    rep(i, n) {
        bool flag;
        flag = true;
        for (lint j = 1; j * j <= a[i]; j++) {
            if (flag == false) break;
            if (a[i] % j == 0) {
                if (binary_search(all(a), j)) flag = false;
                if (j != 1)
                    if (binary_search(all(a), (a[i] / j))) flag = false;
            }
        }
        if (i != 0)
            if (a[i] == a[i - 1]) flag = false;
        if (i != n - 1) {
            if (a[i] == a[i + 1])
                flag = false;
            else if (i == 0)
                flag = true;
        }
        if (n == 1) flag = true;
        if (flag) ans++;
    }
    cout << ans << endl;
}

Measured memory_bytes: 4260
import math
A, B, H, M = map(int, input().split())

h_angle = 360 / 12 * H + 360 / 12 / 60 * M
m_angle = 360/60*M

dif_angle = (h_angle - m_angle)

c2 = A**2 + B**2-2*A*B*math.cos(dif_angle/180*math.pi)

print(math.sqrt(c2))


Measured memory_bytes: 9556
(H, W, M), *HWs = readlines.map{_1.split.map(&:to_i)}

ht, wt = Array.new(H + 1, 0), Array.new(W + 1, 0)
HWs.each{|h, w| ht[h] += 1; wt[w] += 1}
hm, wm = ht.max, wt.max
hn, wn = ht.count(hm), wt.count(wm)
puts hm + wm - (hn*wn > HWs.count{ht[_1] == hm && wt[_2] == wm} ? 0 : 1)

Measured memory_bytes: 59700
#include<cstdio>
#include<map>
#include<iostream>
#include<queue>
using namespace std;
map<string,int>f;
map<string,bool>ff;
queue<string>Q;
int main()
{
	string s,t;
	int ans=0;
	int a,b;
	scanf("%d",&a);
	for(int i=1;i<=a;i++) {
		cin>>s;
		f[s]++;
		if(!ff[s]) {
			ff[s]=1;
			Q.push(s);
		}
	}
	scanf("%d",&b);
	for(int i=1;i<=b;i++) {
		cin>>t;
		f[t]--;
		if(!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!ff[t]) {
			ff[t]=1;
			Q.push(t);
		}
	}
	while(!Q.empty()) {
		string fff=Q.front();
		Q.pop();
		ans=max(ans,f[fff]);
	}
	printf("%d",ans);//
}

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

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

  for (int i = 0; i <= N / 4; i++) {
    for (int j = 0; j <= N / 7; j++) {
      if (4 * i + 7 * j == N) {
        cout << "Yes" << endl;
        return 0;
      }
    }
  }
  cout << "No" << endl;
}

Measured memory_bytes: 256
i = input()
n = int(i)
len = len(i)

if len == 1:
  print(n)
elif len == 2:
  print(9)
elif len == 3:
  print(n - 90) # 2桁の数は90こ
elif len == 4:
  print(909) # 999 - 90
elif len == 5:
  print(n - 90 - 9000) # 4桁の数は (9999 - 999)
elif len == 6:
  print(90909)

Measured memory_bytes: 2940
#include<bits/stdc++.h>
using namespace std;
#define lli long long int
const lli mod=1e9+7;
const lli INT=1e15;
const lli pINF=LLONG_MAX;
const lli nINF=-LLONG_MAX;
void fast() {std::ios::sync_with_stdio(false);cin.tie(NULL);}
lli power(lli a,lli b){lli ans=1;while(b!=0){ if(b%2==1){ans*=a;}b/=2;a*=a;} return ans;}
lli invmod(lli a) {return pow(a,mod-2);}
#define vi vector<int>
#define vlli vector<lli>
#define PII pair<int,int>
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define si(n) scanf("%d",&n)
#define sli(n) scanf("%lld",&n)
#define printi(n) printf("%d\n",n)
#define printli(n) printf("%lld\n",n)
#define all(v) v.begin(),v.end()
#define forn(i,n) for(int i=0;i<n;i++)
void print(int a[],int n){for(int i=0;i<n;i++) cout<<a[i]<<" ";}

int main()
{
    string s;
    cin>>s;
    
    int ct[26];
    memset(ct,0,sizeof ct);
    
    for(int i=0;i<s.size();i++){
        ct[s[i]-'a']++;
    }
    char ans;
    int x=0;
    for(int i=0;i<26;i++){
        if(ct[i]==0){
            ans=i+'a';
            x=1;
            break;
        }
    }
    
    if(x==0) cout<<"None\n";
    else cout<<ans<<endl;
	return 0;
}

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

// iterator
#define REP(i,from, to) for(lli i=from;i<to;i++)
#define REPE(i,from, to) for(lli i=from;i<=to;i++)
#define REP_R(i,from, to) for(lli i=from;i>to;i--)
#define REPE_R(i,from, to) for(lli i=from;i>=to;i--)
#define REPIT(it,container) for(auto it = container.begin(); it != container.end(); it++)
#define REPIT_R(it,container) for(auto it = container.rbegin(); it != container.rend(); it++)

// input
#define cin1(x)             cin >> x
#define cin2(x, y)          cin >> x >> y
#define cin3(x, y, z)       cin >> x >> y >> z
#define ncin1(n, x)         REP(i, 0, n) {cin1(x[i]);}
#define ncin2(n, x, y)      REP(i, 0, n) {cin2(x[i], y[i]);}
#define ncin3(n, x, y, z)   REP(i, 0, n) {cin3(x[i], y[i], z[i]);}

// output
#define cout1(x)         cout << #x << ": " << x << endl;
#define cout2(x, y)      cout << #x << ": " << x << ", " << #y << ": " << y << endl;
#define cout3(x, y, z)   cout << #x << ": " << x << ", " << #y << ": " << y << ", " << #z << ": " << z << endl;;
#define ncout1(n, x)     REP(i, 0, n) {cout << #x << "[" << i << "]: "<< x[i] << endl;}

#define coutp(p)         cout << #p << ":" <<  " (" << p.first << ", " << p.second << ")" << endl;

// sort
#define sort_r(x, y)        sort(x, y, greater<lli>()); // 降順(5,4,3,,,)

#define ARRAY_LENGTH(array) (sizeof(array) / sizeof(array[0]))

typedef long long int lli;
typedef pair<lli, lli> P;
typedef tuple<lli, lli, lli> tup;
typedef vector<lli> vlli;

int main() {
    lli n;
    cin1(n);
    lli a[n];
    lli b[n];
    lli c[n];
    ncin1(n,a);
    ncin1(n,b);
    ncin1(n,c);

    sort(a, a+n);
    sort(b, b+n);
    sort(c, c+n);

    lli b_c[n];
    // まずbをすべて走査し、それぞれの値についてcが何個使えるかを計算する。O(nlogn)
    // そこから累積和の配列の形にできる
    // あとは、aのそれぞれについて二分探索でbのどの部分に当てはまるか見て、累積和のところからO(1)でとってくる(O(nlogn))
    REP(i,0,n) {
        auto it = upper_bound(c, c+n, b[i]);
        b_c[i] = n-(it-c);
        //cout2(i, b_c[i]);
    }
    lli b_c_sum[n] = {0};
    b_c_sum[n-1] = b_c[n-1];
    REPE_R(i,n-2,0) {
        b_c_sum[i] = b_c_sum[i+1] + b_c[i];
    }
    REP(i,0,n) {
        //cout2(i, b_c_sum[i]);
    }

    lli ans = 0;
    REP(i,0,n) {
        auto it = upper_bound(b, b+n, a[i]);
        if (it == b+n)
            continue;
        ans += b_c_sum[it-b];
        //cout2(i, b_c[i]);
    }
    cout << ans << endl;
}


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

#define INF_LL (int64)1e18
#define INF (int32)1e9
#define REP(i, n) for(int64 i = 0;i < (n);i++)
#define FOR(i, a, b) for(int64 i = (a);i < (b);i++)
#define all(x) x.begin(),x.end()
#define fs first
#define sc second

using int32 = int_fast32_t;
using uint32 = uint_fast32_t;
using int64 = int_fast64_t;
using uint64 = uint_fast64_t;
using PII = pair<int32, int32>;
using PLL = pair<int64, int64>;

const double eps = 1e-10;

template<typename A, typename B>inline void chmin(A &a, B b){if(a > b) a = b;}
template<typename A, typename B>inline void chmax(A &a, B b){if(a < b) a = b;}

template<typename T>
vector<T> make_v(size_t a){return vector<T>(a);}

template<typename T,typename... Ts>
auto make_v(size_t a,Ts... ts){
  return vector<decltype(make_v<T>(ts...))>(a,make_v<T>(ts...));
}

template<typename T,typename U,typename... V>
typename enable_if<is_same<T, U>::value!=0>::type
fill_v(U &u,const V... v){u=U(v...);}

template<typename T,typename U,typename... V>
typename enable_if<is_same<T, U>::value==0>::type
fill_v(U &u,const V... v){
  for(auto &e:u) fill_v<T>(e,v...);
}

int64 d(int64 x) {
  return to_string(x).size();
}

int main(void) {
  int64 N, K;
  cin >> N >> K;
  vector<int64> A(N+1, 0);
  REP(i, N) cin >> A[i+1];
  map<int64, int64> mp;
  int64 res = 0;
  REP(i, N) A[i+1] += A[i];
  REP(i, N+1) {
    if (i >= K) {
      mp[(A[i-K]+N-(i-K))%K]--;
    }
    int64 key = (A[i]+N-i)%K;
//    cout << i << " " << key << " " << mp[key] << endl;
    res += mp[key];
    mp[key]++;
  }
  cout << res << endl;
}

Measured memory_bytes: 14336
#include <iostream>
using namespace std;
int main(){
  int R;
  cin>>R;
  
  if(R>=0 && R <= 1199){
    cout<<"ABC"<<endl;
  }else if(R>=1200 && R<2800){
    cout<<"ARC"<<endl;
  }else{
    cout<<"AGC"<<endl;
  }
  
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h> 
using namespace std;
#define     mod             1e9+7
#define     ll              long long int 
#define     mp              make_pair
#define     t()             int test;cin>>test;while(test--)
#define     setbits(x)      __builtin_popcountll(x)
#define     si              set<int>
#define     ii              pair<int,int>
#define     vi              vector<int>
#define     vvi				vector<vector<int>>
#define     que_max         priority_queue <int>
#define     que_min         priority_queue <int, vi, greater<int>>
#define     IOS             ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define     endl            '\n'


void solve(){

	ll k;
	cin>>k;
	int flag = 0;
	int n = 7;
	for(int i=1;i<=k;i++){
		if(n%k == 0){
			cout<<i;
			flag = 1;
			break;
		}
		else{
			n = (n*10 + 7)%k;
		}
	}
	if(flag == 0) cout<<"-1";

}
 
int32_t main()
 
{  
    #ifndef ONLINE_JUDGE
    	freopen("input.txt", "r", stdin);
    	freopen("output.txt", "w", stdout);
    #endif

    IOS;
    int t = 1;

    solve();
    // t(){
    // 	cout<<"Case #"<<t<<": ";
    // 	solve();
    // 	t++;
    // }


}








Measured memory_bytes: 3648
#include <iostream>
#include <fstream>
#include <string>
#include <vector>
#include <cstdlib>
#include <stdlib.h>

using namespace std;

/*
int count(int l, int arr[]){

    int ans=0;

   for(int i=0; i<l; i++){

        bool notDivisible = true;

        for(int j=0; j<l; j++){

            if(i==j || arr[i] < arr[j]) continue;

            notDivisible = arr[i] % arr[j];
            if(!notDivisible) break;

        }

        if(notDivisible) ans++;

    }

    return ans;

}
*/

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

    int N=0;
    int answer=0;
	
	cin >> N;

	int A[N+1];
    int nl[10000001]={};
    bool f[10000001]={};

    int l, k=0;
    while(cin>>l){
        A[k+1] = l;
        nl[A[k+1]]++;
        k++;
    }

    for (int i = 0; i < 10000001; ++i){

        if(nl[i] >= 1){

            for (int j = 2*i; j < 10000001; j+=i){

                    f[j] = true;

                    // N  4
                    // A  2 3 4 6
                    // i  1 2 3 4 5 6
                    // nl 0 1 1 1 0 1
                    //    0 1 1 2 0 2
                    //    0 1 1 0 0 3 
                
            }

        }

    }

    for (int i = 0; i < 10000001; ++i)
    {
        if(nl[i]==1 && !f[i]) answer++;
    }

    cout << answer << endl;

}

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

#ifndef ONLINE_JUDGE
	#define W(x, y) cerr << "\033[31m" << #x << " = " << x << "\033[0m" << y;
#else
	#define W(x, y)
#endif


#define ll long long
#define pii pair<int, int>
#define pll pair<ll, ll>
#define vi vector<int>
#define vii vector<pii>
#define vl vector<ll>
#define vll vector<pll>
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define pi acos(-1)
#define ld long double
#define prime 1000000007

using namespace std;

#define INF 1000000000

int main(){
	ios::sync_with_stdio(false);
	cin.tie(0); cout.tie(0);
	
	ll n;
	string s;

	cin >> n;
	cin >> s;
	if(n%2 == 1){
		cout << "No" << endl;
		return 0;
	} else{
		for(int i = 0, j = n/2; i < n && j < n; ++i, ++j){
			
			if(s[i] != s[j]){
				cout << "No" << endl;
				return 0;
			}
		}
		cout << "Yes" << endl;
	}

	return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int k = sc.nextInt();
		sc.close();

		int ans = k;
		for (int i = 1; i < n; i++) {
			ans *= k - 1;
		}
		System.out.println(ans);
	}
}


Measured memory_bytes: 35740
N,A,B,C = map(int, input().split())
bamboos = [int(input()) for _ in range(N)]
#print("---", bamboos)
ans = float("inf")
def solve(lst, idx):
    global ans
    if idx == N:
        #print("qqqqq")
        for i in range(3):
            if len(lst[i]) == 0:
                return

        
        pa = 10 * (len(lst[0])-1) + abs(A - sum(lst[0]))
        pb = 10 * (len(lst[1])-1) + abs(B - sum(lst[1]))
        pc = 10 * (len(lst[2])-1) + abs(C - sum(lst[2]))
        #print(pa, pb, pc, lst)
        ans = min(ans, pa + pb + pc)
        #print("aaaaaaa")
        return

    
    for i in range(4):
        nxt_lst = [lst[0][:], lst[1][:], lst[2][:], lst[3][:]]
        nxt_lst[i].append(bamboos[idx])
        #print(lst, nxt_lst)
        
        solve(nxt_lst, idx+1)

empty_lst =  [[], [], [], []]   
solve(empty_lst, 0)
print(ans)

Measured memory_bytes: 76772
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools

sys.setrecursionlimit(10**7)
inf = 10**20
eps = 1.0 / 10**10
mod = 10**9+7
dd = [(-1,0),(0,1),(1,0),(0,-1)]
ddn = [(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()
def pf(s): return print(s, flush=True)


def main():
    a, b = LI()
    if a % b == 0:
        return 0
    return 1




print(main())


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

int main()
{
	string w;
	string t;
	cin>>w;
	cin>>t;
	int count = 0;
	while(t!="END_OF_TEXT"){
		std::transform(t.begin(), t.end(), t.begin(), ::tolower);
		if(w==t) count++;
		cin>>t;
	}
	cout<<count<<endl;
	return 0;
}

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

using namespace std;
const int nmax=144;
long long mi[nmax+5];
int cif[nmax+5],y;
void calculate(int nr)
{
    y=0;
    for(int i=1;9*i<=nr;i++)
        cif[++y]=9;
    cif[++y]=nr%9;
    reverse(cif+1,cif+y+1);
    for(int i=1;i<=y;i++)
        mi[nr]=10*mi[nr]+cif[i];
}
int main()
{
    long long n,ans=0;
    cin>>n;
    for(int i=144;i>=1;i--)
    {
        calculate(i);
        if(mi[i]<=n)
        {
            ans=i;
            break;
        }
    }
    cout<<ans;
	return 0;
}
/**
**/


Measured memory_bytes: 256
import java.util.*;

import static java.lang.System.*;

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

        // ee or eXe だけなのでそれがないかをチェック
        for (int i = 0; i < s.length() - 1; i++) {
            if (s.charAt(i) == s.charAt(i + 1)) {
                out.println((i + 1) + " " + (i + 2));
                return;
            }
        }

        for (int i = 0; i < s.length() - 2; i++) {
            if (s.charAt(i) == s.charAt(i + 2)) {
                out.println((i + 1) + " " + (i + 3));
                return;
            }
        }

        out.println("-1 -1");
    }
}

Measured memory_bytes: 25824
#include <bits/stdc++.h>
using namespace std;
#define ALL(a) (a).begin(),(a).end()
#define rALL(a) (a).rbegin(),(a).rend()
typedef pair<int, int> Pint;
typedef pair<int64_t, int64_t> Pll;
  
int main() {
    int x = 0, ans = 0, N;
    string S;
    cin >> N >> S;
    for (int i = 0; i < N; i++) {
        if (S.at(i) == 'I') {
            x++;
        }
        else {
            x--;
        }
        ans = max(ans, x);
    } 
    cout << ans << endl;
}

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

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

med_a = sum(a) / N

candidate = [int(med_a), int(med_a + 0.9)]
cost = [0, 0]

for i in a:
    for j in range(len(candidate)):
        cost[j] += (i - candidate[j]) ** 2

print(min(cost))

Measured memory_bytes: 3064
n = int(input())

for i in range(1, n + 1):
    if i % 3 == 0:
        print(" {}".format(i), end='')
        continue
    x = i
    while x:
        if x % 10 == 3:
            print(" {}".format(i), end='')
            break
        x //= 10
print()



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

void rec(int from, int n, int v, vector<vector<int>>& r) {
  if (n < 2)
    return;
  int m = n / 2;
  for (int i = from; i < from + m; ++i) {
    for (int j = from + m; j < from + n; ++j) {
      r[i][j] = v;
    }
  }
  rec(from, m, v + 1, r);
  rec(from + m, n - m, v + 1, r);
}

int main() {
  int n;
  cin >> n;
  vector<vector<int>> level(n, vector<int>(n));

  rec(0, n, 1, level);

  for (int i = 0; i < n; ++i) {
    for (int j = i + 1; j < n; ++j) {
      if (j > i + 1)
        cout << " ";
      cout << level[i][j];
    }
    cout << "\n";
  }

  return 0;
}


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

int main() {
	string s[] = {"Sunny", "Cloudy", "Rainy"};
	string str;
	cin >> str;
	int idx;
	for(int i = 0; i < 3; ++i)
		if(str == s[i])
			idx = i;
	++idx;
	idx %= 3;
	cout << s[idx];
}


Measured memory_bytes: 3576
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  string s;
  cin>>s;
  int n=s.size();
  int a[26]={};
  
  if(s=="zyxwvutsrqponmlkjihgfedcba"){
    cout<<-1;
    return 0;
  }
  
  else if(n!=26){
    for(int i=0;i<n;i++)
      a[s[i]-'a']++;
    for(int i=0;i<26;i++)
      if(a[i]==0){
        s+=char(i+'a');
        break;
      }
    cout<<s;
    return 0;
  }
  
  
  else if(n==26){
    char ss[26];
    for(int j=0;j<26;j++)
      ss[j]=s[j];
    next_permutation(ss,ss+n);
    for(int i=0;i<n;i++){
      cout<<char(ss[i]);
      if(s[i]!=ss[i])
        break;
    }
  }

  
  
}

Measured memory_bytes: 256
a = input().split()

for i in range(2):
 if(a[i] == 'A'):
  a[i] = 10
 elif(a[i] == 'B'):
  a[i] = 11
 elif(a[i] == 'C'):
  a[i] = 12
 elif(a[i] == 'D'):
  a[i] = 13
 elif(a[i] == 'E'):
  a[i] = 14
 elif(a[i] == 'F'):
  a[i] = 15
 else:
  a[i] = int(a[i])
  
if(a[0]<a[1]):
  print('<')
elif(a[0]==a[1]):
  print('=')
else:
  print('>')

Measured memory_bytes: 3064
import math

def plot(x,y):
    print(f'{x:.8f} {y:.8f}')
def Koch(n, x1,y1,x2,y2):
    if n ==0:
        plot(x1,y1)
        return
    sx=(2*x1+x2)/3
    sy=(2*y1+y2)/3
    tx=(x1+2*x2)/3
    ty=(y1+2*y2)/3
    ux=(tx-sx)*(1/2)-(ty-sy)*(math.sqrt(3)/2)+sx
    uy=(tx-sx)*(math.sqrt(3)/2)+(ty-sy)*(1/2)+sy
    Koch(n-1,x1,y1, sx,sy)
    Koch(n-1,sx,sy, ux,uy)
    Koch(n-1,ux,uy, tx,ty)
    Koch(n-1,tx,ty, x2,y2)
   
n=int(input())
Koch(n,0,0, 100,0)
plot(100,0)


Measured memory_bytes: 5748
N = int(input())
D = list(map(int, input().split()))

def judge(D):  
    D.sort()
    half = int(N/2)
    
    if (N%2)==1:
        return 0
    if D[half]==D[half-1]:
        return 0
    ans = D[half]-D[half-1]
    return ans

print (judge(D))

Measured memory_bytes: 14396
#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 all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define maxs(a, b) a = max(a, b)
#define mins(a, b) a = min(a, b)
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
const ll linf = (1ll << 61);
const int inf = 1001001001;
const int mod = 1000000007;

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	int h, w;
	cin >> h >> w;
	vector<vector<int>> dist(10, vector<int>(10, inf));
	rep(i, 10)rep(j, 10) {
		int a;
		cin >> a;
		dist[i][j] = a;
	}
	rep(k, 10)rep(i, 10)rep(j, 10) {
		mins(dist[i][j], dist[i][k] + dist[k][j]);
	}
	vector<vector<int>> mp(h, vector<int>(w));
	rep(i, h)rep(j, w) cin >> mp[i][j];
	int ans = 0;
	rep(i, h)rep(j, w) {
		if (mp[i][j] == -1) continue;
		ans += dist[mp[i][j]][1];
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 3772
import java.io.*;
public class Main{
    public static void main(String[] args) throws IOException{
        BufferedReader bf = 
            new BufferedReader(new InputStreamReader(System.in));
        int D = Integer.parseInt(bf.readLine());
        String str;
        switch(D){            
            case 25:
                str = "Christmas";
                break;
            case 24:
                str = "Christmas Eve";
                break;
            case 23:
                str = "Christmas Eve Eve";
                break;
            default:
                str = "Christmas Eve Eve Eve";
        } 
        System.out.println(str);
    }
}

Measured memory_bytes: 21076
#include<stdio.h>
#include<algorithm>
#include<iostream>

using namespace std;

int main ()
{
   long long int n;
  // freopen ("d:\\1.txt","r",stdin);
   long long int h;
   long long int a[100001],b[100001];
   while (scanf ("%lld%lld",&n,&h)!=EOF)
   {
      long long int  sum =0;
      long long int ans=0;
      for (long long int i=0;i<n;i++)
        scanf ("%lld%lld",&a[i],&b[i]);
      long long int tmp;
      sort (a,a+n);
      tmp=a[n-1];
      sort (b,b+n);
      for (long long int i=n-1;i>=0;i--)
      if (b[i]>tmp) {  if (sum>=h) break; ans ++; sum+=b[i];}
      if (sum>=h) printf ("%lld\n",ans);
      else
      {
         // printf ("%lld\n",sum);
          h-=sum;

          if (h%tmp) ans+=1;
          ans+= h/tmp ;
          printf ("%lld\n",ans);
      }
   }
   return 0;
}


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

using namespace std;

const int maxn = 1e5+10;
const long long mod = 1e9+7;

typedef long long ll;

int dp[maxn][2];

vector<int> grafo[maxn];

ll dfs(int u, int p, bool c)
{
	if (u != 1 && grafo[u].size() == 1) return 1;
	if (dp[u][c] != -1) return dp[u][c];

	ll ans = 1LL;
	for (auto v: grafo[u])
	{
		if (v == p) continue;

		ll aux = 0LL;
		if (!c)
		{
			aux = (aux+dfs(v, u, 0))%mod;
			aux = (aux+dfs(v, u, 1))%mod;
		}
		else aux = (aux+dfs(v, u, 0))%mod;

		ans = (ans*aux)%mod;
	}

	return dp[u][c] = ans;
}

int main(void)
{
	int n;
	cin >> n;

	for (int i = 1; i < n; i++)
	{
		int u, v;
		cin >> u >> v;

		grafo[u].push_back(v); grafo[v].push_back(u);
	}

	memset(dp, -1, sizeof dp);

	cout << (dfs(1, 0, 0)+dfs(1, 0, 1))%mod << "\n";
}

Measured memory_bytes: 14848