akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<algorithm>
#include<bitset>
#include<cmath>
#include<complex>
#include<deque>
#include<functional>
#include<iomanip>
#include<iostream>
#include<iterator>
#include<map>
#include<numeric>
#include<queue>
#include<set>
#include<stack>
#include<string>
#include<unordered_map>
#include<unordered_set>
#include<utility>
#include<vector>

using namespace std;
typedef long long int ll;

int S,W;

int main(){
    cin>>S>>W;
    if(S<=W)cout<<"unsafe"<<endl;
    else cout<<"safe"<<endl;
}

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

using namespace std;
int fac(int n){
    int t=1;
    for(int i=1;i<=n;i++){
        t=t*i;
    }
    return t;
}
int main()
{
    int n;
    cin>>n;
    int a[n];
    int b[n];
    int a1=0,b1=0;
    int a2,b2;
    int f[n];
    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++){
        f[i]=i+1;
    }
    //cout<<fac(n)<<endl;
    for(int i=0;i<fac(n);i++){

        a1=0,b1=0;
        for(int j=0;j<n;j++){
            if(f[j]==a[j]){
                a1++;
            }
            if(b[j]==f[j]){
                b1++;
            }
        }
        if(a1==n){
            a2=i+1;
        }
        if(b1==n){
            b2=i+1;
        }
        next_permutation(f,f+n);
    }
    cout<<abs(a2-b2)<<endl;
    return 0;
}


Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using static System.Console;

class Program
{
    static void Main(string[] args)
    {
        var NK = ReadLine().Split(' ').Select(s => int.Parse(s)).ToArray();
        var (N, K) = (NK[0], NK[1]);
        var A = ReadLine().Split(' ').Select(s => int.Parse(s)).ToArray();

        for (int i = 0; i < N - K; i++)
        {
            if (A[i] < A[K + i])
                WriteLine("Yes");
            else
                WriteLine("No");
        }
    }
}


Measured memory_bytes: 46324
K, S = map(int, input().split())
ans = 0
for z in range(K+1):
    if S - z > 2*K or S < z:
        continue
    elif K < S - z <= 2*K:
        ans += K - (S - z - K) + 1
    else:
        ans += S - z + 1
print(ans)

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

int main(){
  string S;
  cin >> S;
  const int64_t N= int64_t(S.size());

  int64_t ans= 0;
  int64_t cntA= 0;
  for(int i=0; i<N;){
    char c= S.at(i);
    if(c=='A'){
      cntA++;
      i++;
    }
    else if(c=='C'){
      cntA= 0;
      i++;
    }
    else{ // c=='B'
      i++;
      if(i==N){ break; }
      else{
        if(S.at(i)=='B'){
          cntA= 0;
          i++;
        }
        else if(S.at(i)=='A'){
          cntA= 1;
          i++;
        }
        else{ // S.at(i)=='C'
          ans+= cntA;
          i++;
        }
      }
    }
  }


  cout << ans << endl;
}

Measured memory_bytes: 3756
#include<bits/stdc++.h>
using namespace std;
#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 {
#ifndef ONLINE_JUDGE
~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;
//const int N = 2e5+500;
//vector<ll> t(2*N);
//void build(vector<ll> &a, int v, int tl, int tr) {
	//if(tl==tr) {
		//t[v] = a[tl];
		//return ;
	//} 
	//int mid = (tl+tr)/2;
	//build(a,v*2,tl,mid);
	//build(a,v*2+1,mid+1,tr);
	//t[v] = max(t[v*2],t[v*2+1]);
//}
//void update(int k, ll value, int v, int tl, int tr) {
	//if(tl==tr) {
		//t[v] = value;
		//return;
	//} 
	//int mid = (tl+tr)/2;
	//if(k<=mid) {
		//update(k,value, v*2,tl,mid);
	//} else {
		//update(k,value,v*2+1,mid+1,tr);
	//}
	//t[v] = max(t[v*2],t[v*2+1]);
//}
//int query(int v, int tl, int tr, int l, int r) {
	//if(l>r) return 0;
	//if(l==tl && r==tr) {
		//return t[v];
	//} 
	//int mid = (tl+tr)/2;
	//return max(query(v*2,tl,mid,l,min(mid,r)), query(v*2+1,mid+1,tr,max(l,mid+1),r));
//}
int main() {
	int n;
	cin>>n;
	vector<ll> h(n), a(n);
	for(int i=0;i<n;i++) {
		cin>>h[i];
	}
	for(int i=0;i<n;i++) {
		cin>>a[i];
	}
	int base = 1;
	while(base<=n) {
		base*=2;
	}
	vector<ll> tree(2*base);

	vector<ll> dp(n+1); //max possible score taking the last tree of height i
	for(int i=0;i<n;i++) {
		int x = h[i] + base;
		ll best = 0;
		while(x>1) {
			if(x%2==1) {
				best = max(best, tree[x-1]);
			}
			x/=2;
		}
		dp[h[i]] = best+a[i];
		for(int j=base+h[i];j>=1;j/=2) {
			tree[j] = max(tree[j], dp[h[i]]);
		}
		//for(int j=0;j<h[i];j++) {
			//dp[h[i]] = max(dp[h[i]], dp[j] + a[i]);
		//}
	}
	debug()<<imie(dp);
	ll ans = -1;
	for(ll it:dp) {
		ans = max(ans,it);
	}
	cout<<ans;
}



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

typedef long long ll;

int dx[4] = { 0, -1, 1, 0 };
int dy[4] = { -1, 0, 0, 1 };

int main() {
  int a, b;
  cin >> a >> b;

  if (a <= 8 && b <= 8) cout << "Yay!" << endl;
  else cout << ":(" << endl;

  return 0;
}


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


int n;
double xa, ya, ra;
double xb, yb, rb;


int solve(){
	double d = (xb-xa)*(xb-xa) + (yb-ya)*(yb-ya);
	
	if((rb-ra)*(rb-ra) <= d && d <= (rb+ra)*(rb+ra)) return 1;
	if((rb+ra)*(rb+ra) < d) return 0;
	if(sqrtl(d) < (ra-rb)) return 2;
	if(sqrtl(d) < (rb-ra)) return -2;
	return 3;
}


int main(){
	cin >> n;
	int i = 0;
	while(cin >> xa >> ya >> ra >> xb >> yb >> rb, i < n){
		cout << solve() << endl;
		i++;
	}

	return 0;
}

Measured memory_bytes: 3100
times = int(input())
line = input()
list1 = []
if times <= 1:
  print("%s" % 0)
else:
  for i in line.split():
    if i:
      list1.append(int(i))
  mem = [0] * times
  mem[-2] = abs(list1[-1] - list1[-2])
  for i in range(len(list1)-3, -1, -1):
    step1 = abs(list1[i] - list1[i+1]) + mem[i+1]
    step2 = abs(list1[i] - list1[i+2]) + mem[i+2]
    mem[i] = min(step1,step2)
  print("%s" % mem[0])

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

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

memo = [0]*n
ans_list = []
memo_count = 0
for i in range(n-1,-1,-1):
	if (i+1)*2 <= n:
		memo_count = 0
		for j in range(2,n//(i+1)+1):
			memo_count += memo[(i+1)*j-1]
		if memo_count%2 != list1[i]:
			memo[i] = 1
			ans_list.append(i+1)

	else:
		if list1[i] == 1:
			memo[i] = 1
			ans_list.append(i+1)

ans_list.sort()

print(len(ans_list))
print(" ".join(map(str,ans_list)))

Measured memory_bytes: 81384
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)n;i++)
#define all(c) (c).begin(),(c).end()
#define pb push_back
#define dbg(...) do{cerr<<__LINE__<<": ";dbgprint(#__VA_ARGS__, __VA_ARGS__);}while(0);

using namespace std;

namespace std{template<class S,class T>struct hash<pair<S,T>>{size_t operator()(const pair<S,T>&p)const{return ((size_t)1e9+7)*hash<S>()(p.first)+hash<T>()(p.second);}};template<class T>struct hash<vector<T>>{size_t operator()(const vector<T> &v)const{size_t h=0;for(auto i : v)h=h*((size_t)1e9+7)+hash<T>()(i)+1;return h;}};}
template<class T>ostream& operator<<(ostream &os, const vector<T> &v){os<<"[ ";rep(i,v.size())os<<v[i]<<(i==v.size()-1?" ]":", ");return os;}template<class T>ostream& operator<<(ostream &os,const set<T> &v){os<<"{ "; for(const auto &i:v)os<<i<<", ";return os<<"}";}
template<class T,class U>ostream& operator<<(ostream &os,const map<T,U> &v){os<<"{";for(const auto &i:v)os<<" "<<i.first<<": "<<i.second<<",";return os<<"}";}template<class T,class U>ostream& operator<<(ostream &os,const pair<T,U> &p){return os<<"("<<p.first<<", "<<p.second<<")";}
void dbgprint(const string &fmt){cerr<<endl;}template<class H,class... T>void dbgprint(const string &fmt,const H &h,const T&... r){cerr<<fmt.substr(0,fmt.find(","))<<"= "<<h<<" ";dbgprint(fmt.substr(fmt.find(",")+1),r...);}
typedef long long ll;typedef vector<int> vi;typedef pair<int,int> pi;const int inf = (int)1e9;const double INF = 1e12, EPS = 1e-9;

int n, m;
int qid[11][100010], col[11][100010];
vector<vi> e;

int main(){
	cin.tie(0); cin.sync_with_stdio(0);
	cin >> n >> m;
	e.resize(n);
	rep(i, n) e[i].pb(i);
	rep(i, m){
		int a, b; cin >> a >> b; a--; b--;
		e[a].pb(b);
		e[b].pb(a);
	}
	memset(qid, -1, sizeof(qid));
	
	int q; cin >> q;
	
	rep(i, q){
		int v, d, c; cin >> v >> d >> c; v--;
		qid[d][v] = i;
		col[d][v] = c;
	}
	for(int it = 10; it > 0; it--){
		rep(i, n) if(qid[it][i] >= 0) for(int j : e[i]){
			if(qid[it - 1][j] > qid[it][i]) continue;
			qid[it - 1][j] = qid[it][i];
			col[it - 1][j] = col[it][i];
		}
	}
	rep(i, n) cout << col[0][i] << endl;
	
	return 0;
}

Measured memory_bytes: 15360
import java.util.*;
import java.io.*;

public class Main {
	public static void main(String[] args){
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		
		while(true){
			String input;
			try {
				input = br.readLine();
				String[] str = input.split(" ");
				int a = Integer.parseInt(str[0]);
				int b = Integer.parseInt(str[1]);
				if ((a == 0) && (b == 0)){
					break;
				} else {
					if (a > b){
						int temp;
						temp = b;
						b = a;
						a = temp;
					}
					System.out.println(a + " " + b);
				}
			} catch (IOException e) {
				// TODO 自動生成された catch ブロック
				e.printStackTrace();
			}
		}
	}
}

Measured memory_bytes: 24456
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
public class Main {
	public static void main(String[] args) {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String array = null;
		int sum;

		try {
			while(true) {
				sum = 0;
				array = br.readLine();
				if(array.length() == 1 && array.equals("0")) break;

				for(int i = 0; i < array.length(); i++) {
					sum += (int)array.charAt(i) - '0';
				}
				System.out.printf("%d\n", sum);
			}
		} catch (IOException e) {
			e.printStackTrace();
		}
	}
}



Measured memory_bytes: 24724
#include <bits/stdc++.h>
#define lol long long
using namespace std;
int main(){
  long double ans=0,co=0,x;
  lol n,k,p[200010];
  cin>>n>>k;
  for(lol i=0;i<n;i++){
    cin>>p[i];
    x=p[i];
    co+=(double)x+1.0;
    //cout<<co<<' ';
    if(i+1>k){
      x=(double)p[i-k]+1.0;
      co-=(double)x;
      //cout<<co<<' ';
    }
    if(i >= k-1) ans = max(ans,co/2.0);
    //cout<<ans<<'\n';
  }
  cout<<setprecision(10)<<ans<<"\n";
  return(0);
}


Measured memory_bytes: 1792
package main

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

const mod = 1000000007
var sc = bufio.NewScanner(os.Stdin)

func next() string {
	sc.Scan()
	return sc.Text()
}

func nextInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

func main() {
	sc.Split(bufio.ScanWords)

	a, b := nextInt(), nextInt()
	as, bs := "", ""
	for i := 0; i < b; i++ {
		as += strconv.Itoa(a)
	}
	for i := 0; i < a; i++ {
		bs += strconv.Itoa(b)
	}

	if as < bs {
		fmt.Println(as)
	} else {
		fmt.Println(bs)
	}
}

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

int main(void){
    // Your code here!
    int N;
    cin>>N;
    vector<int>X(N);
    double A=0.0;
    for(int i=0;i<N;i++){
        cin>>X[i];
        A+=X[i];
    }
    int P=A/N;
    A/=N;
    if(A-P>0.5){
        P++;
    }
    int ans=0;
    for(int i=0;i<N;i++){
        ans+=pow((X[i]-P),2);
    }
    cout<<ans<<endl;
    return 0;
}



Measured memory_bytes: 256
#include<stdio.h>
int main()
{
	int n;
	scanf("%d", &n);
	char s[100005];
	scanf("%s", s);
	int i, j;
	char ans[4][100005];
	ans[0][0] = ans[1][0] = 'S';
	ans[2][0] = ans[3][0] = 'W';
	ans[0][1] = ans[2][1] = 'S';
	ans[1][1] = ans[3][1] = 'W';
	for (i = 1; i < n - 1; i++)
	{
		for (j = 0; j < 4; j++)
		{
			if (ans[j][i - 1] == 'S' && ans[j][i] == 'S' && s[i] == 'o')ans[j][i + 1] = 'S';
			if (ans[j][i - 1] == 'S' && ans[j][i] == 'S' && s[i] == 'x')ans[j][i + 1] = 'W';
			if (ans[j][i - 1] == 'S' && ans[j][i] == 'W' && s[i] == 'o')ans[j][i + 1] = 'W';
			if (ans[j][i - 1] == 'S' && ans[j][i] == 'W' && s[i] == 'x')ans[j][i + 1] = 'S';
			if (ans[j][i - 1] == 'W' && ans[j][i] == 'S' && s[i] == 'o')ans[j][i + 1] = 'W';
			if (ans[j][i - 1] == 'W' && ans[j][i] == 'S' && s[i] == 'x')ans[j][i + 1] = 'S';
			if (ans[j][i - 1] == 'W' && ans[j][i] == 'W' && s[i] == 'o')ans[j][i + 1] = 'S';
			if (ans[j][i - 1] == 'W' && ans[j][i] == 'W' && s[i] == 'x')ans[j][i + 1] = 'W';
		}
	}
	for (i = 0; i < 4; i++)
	{
		if (ans[i][0] == 'S' && ans[i][1] == 'S' && ans[i][n - 1] == 'S' && s[0] == 'x')continue;
		if (ans[i][0] == 'S' && ans[i][1] == 'S' && ans[i][n - 1] == 'W' && s[0] == 'o')continue;
		if (ans[i][0] == 'S' && ans[i][1] == 'W' && ans[i][n - 1] == 'S' && s[0] == 'o')continue;
		if (ans[i][0] == 'S' && ans[i][1] == 'W' && ans[i][n - 1] == 'W' && s[0] == 'x')continue;
		if (ans[i][0] == 'W' && ans[i][1] == 'S' && ans[i][n - 1] == 'S' && s[0] == 'o')continue;
		if (ans[i][0] == 'W' && ans[i][1] == 'S' && ans[i][n - 1] == 'W' && s[0] == 'x')continue;
		if (ans[i][0] == 'W' && ans[i][1] == 'W' && ans[i][n - 1] == 'S' && s[0] == 'x')continue;
		if (ans[i][0] == 'W' && ans[i][1] == 'W' && ans[i][n - 1] == 'W' && s[0] == 'o')continue;
		if (ans[i][n - 1] == 'S' && ans[i][n - 2] == 'S' && ans[i][0] == 'S' && s[n - 1] == 'x')continue;
		if (ans[i][n - 1] == 'S' && ans[i][n - 2] == 'S' && ans[i][0] == 'W' && s[n - 1] == 'o')continue;
		if (ans[i][n - 1] == 'S' && ans[i][n - 2] == 'W' && ans[i][0] == 'S' && s[n - 1] == 'o')continue;
		if (ans[i][n - 1] == 'S' && ans[i][n - 2] == 'W' && ans[i][0] == 'W' && s[n - 1] == 'x')continue;
		if (ans[i][n - 1] == 'W' && ans[i][n - 2] == 'S' && ans[i][0] == 'S' && s[n - 1] == 'o')continue;
		if (ans[i][n - 1] == 'W' && ans[i][n - 2] == 'S' && ans[i][0] == 'W' && s[n - 1] == 'x')continue;
		if (ans[i][n - 1] == 'W' && ans[i][n - 2] == 'W' && ans[i][0] == 'S' && s[n - 1] == 'x')continue;
		if (ans[i][n - 1] == 'W' && ans[i][n - 2] == 'W' && ans[i][0] == 'W' && s[n - 1] == 'o')continue;
		ans[i][n] = '\0';
		printf("%s\n", ans[i]);
		return 0;
	}
	printf("-1\n");
	return 0;
}

Measured memory_bytes: 768
#include<iostream>
using namespace std;
int a,b;
int main(){
	cin>>a>>b;
	if(a>0&&b>0)cout<<"Positive\n";
	else if(a<0&&b>0)cout<<"Zero\n";
else if((b-a)%2==0)cout<<"Negative\n";
else cout<<"Positive\n";}

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

int manhat(int *a,int *b,int *c,int *d){
    return abs(*a-*c)+abs(*b-*d);
}

int main(){
    int n,m;
    cin >> n >> m;
    vector<int> a(n);
    vector<int> b(n);
    vector<int> c(m);
    vector<int> d(m);
    for(int i=0;i<n;i++){
        cin >> a[i] >> b[i];
    }
    
    for(int i=0;i<m;i++){
        cin >> c[i] >> d[i];
    }
    
    
    
    for(int i=0;i<n;i++){
        int min = 1000000000;
        int cnt = 0;
        for(int j=0;j<m;j++){
            if(min>manhat(&a[i],&b[i],&c[j],&d[j])){
                min=manhat(&a[i],&b[i],&c[j],&d[j]);
                cnt = j;
            }
        }
        cout << cnt+1 << endl;
    }
    
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <boost/range/adaptor/reversed.hpp>
#include <boost/range/algorithm/sort.hpp>
#include <boost/range/irange.hpp>

using namespace std;
using boost::irange;
using boost::sort;
using boost::adaptors::reversed;

long count(long head, long th) {
    long tail = head % 10;
    long cnt = 0;
    if (head <= th) cnt += 1;
    if (tail - 1 >= 0 && head * 10 + tail - 1 <= th) {
        cnt += count(head * 10 + tail - 1, th);
    }
    if (tail + 1 <= 9 && head * 10 + tail + 1 <= th) {
        cnt += count(head * 10 + tail + 1, th);
    }
    if (head * 10 + tail <= th) {
        cnt += count(head * 10 + tail, th);
    }
    return cnt;
}

int main() {
    long k;
    cin >> k;

    long ok = 0;
    long ng = 3234566667 + 1;

    while (abs(ok - ng) > 1) {
        long mid = (ok + ng) / 2;
        long cnt = 0;
        for (int i = 1; i < 10; i++) {
            cnt += count(i, mid);
        }
        if (cnt < k) {
            ok = mid;
        } else {
            ng = mid;
        }
    }

    cout << ok + 1 << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define debug(x) cerr<<#x<<" = "<<x
#define sp <<"  "
#define el <<endl
#define fgx cerr<<" ---------------------------------------------- "<<endl
#define LL long long
#define uint unsigned int 
#define ULL unsigned long long
#define LDB long double
#define DB double
#define pii pair<int,int>
#define pli pair<LL,int>
#define mp make_pair
#define pb push_back
using namespace std;
inline LL read(){
	LL nm=0; bool fh=true; char cw=getchar();
	for(;!isdigit(cw);cw=getchar()) fh^=(cw=='-');
	for(;isdigit(cw);cw=getchar()) nm=nm*10+(cw-'0');
	return fh?nm:-nm;
}
#define mod 1000000007
namespace  CALC{
	inline int add(int x,int y){return (x+y>=mod)?(x+y-mod):(x+y);}
	inline int mns(int x,int y){return (x-y<0)?(x-y+mod):(x-y);}
	inline int mul(LL x,LL y){return x*y%mod;}
	inline void upd(int &x,int y){x=(x+y>=mod)?(x+y-mod):(x+y);}
	inline void dec(int &x,int y){x=(x-y<0)?(x-y+mod):(x-y);}
	inline int qpow(int x,int sq){int res=1;for(;sq;sq>>=1,x=mul(x,x))if(sq&1)res=mul(res,x);return res;}
}using namespace CALC;
#define M 5020
int n,A,B;
int con0[M],con1[M];
int F[M],G[M];
int main(){
	//freopen(".in","r",stdin);
	//freopen(".out","w",stdout);
	n=read(),A=read(),B=read(); if(A>B) swap(A,B);
	con0[0]=1;
	for(int i=1;i<=n;i++){
		con1[i]=add(con1[i-1],con0[i-1]);
		for(int z=A;z<=i;z++) upd(con0[i],con1[i-z]);
	}
	for(int i=1;i<B;i++) F[i]=add(con0[i],con1[i]);
	for(int i=1;i<A;i++) G[i]=1;
	int ans=F[n]; G[0]=1;
	for(int i=1;i<n;i++){
		if(n-i<A) upd(ans,F[i]);
		if(n-i<B) upd(ans,mul(G[i],add(con0[n-i],con1[n-i])));
		for(int k=1;i+k<=n&&k<B;k++) upd(F[i+k],mul(G[i],con1[k]));
		for(int k=1;i+k<=n&&k<A;k++) upd(G[i+k],F[i]);
	}
	ans=mns(qpow(2,n),ans);
	printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 3820
#include<stdio.h>
int main ()
{
    int n,i;
    scanf("%d",&n);
    int a[n];
    double tem=0,result,flag;
    for(i=0;i<n;i++){
        scanf("%d",&a[i]);
        tem=(tem+1.0/a[i]);
    }
    flag=tem;
    result=1.0/flag;
    printf("%lf\n",result);

    return 0;

}


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

typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
#define all(x) (x).begin(),(x).end()
#define sz(x) ((int)(x).size())

void solve(){
    string s, str="CODEFESTIVAL2016";
    cin >> s;

    int ans=0;
    for (int i = 0; i < s.size(); i++) {
        if (s[i] != str[i]) {
            ans++;
        }
    }

    cout << ans << endl;

    return;
}

int main(int argc, char const* argv[])
{
    solve();
    return 0;
}


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

int main() {
  ll n1,n2;
  string s,ans;
  cin >> s;
  n1=stoi(s.substr(0,2)); n2=stoi(s.substr(2,2));
  if(n1<=12 && n1>=1){
  	if(n2<=12 && n2>=1) ans="AMBIGUOUS";
  	else ans="MMYY";
  }
  else if(n2<=12 && n2>=1) ans="YYMM";
  else ans="NA";
  cout << ans << endl;
}


Measured memory_bytes: 256
#include<iostream>
#include<stdio.h>
#include<string>
#include<vector>
#include<iosfwd>
#include<sstream>
#include<math.h>
#define N 100
using namespace std;

int main(void){
    int a,b;
    cin >> a >> b;
    if(a==b){
        cout << a+b <<endl;
    } else
    {
        int x= max(a,b);
        cout << 2*x-1 << endl;
    }
    

}

Measured memory_bytes: 256
// Contest.cpp : アプリケーションのエントリ ポイントを定義します。
//

#include"iostream"
#include"string"
#include"vector"

using namespace std;

int main()
{
	int n;
	cin >> n;
	if (99 < n&&n<112)
	{
		cout << 111 << endl;
	}
	if (111 < n &&n< 223){
		cout << 222 << endl;
}
	 if (222 < n &&n< 334)
	 {cout << 333 << endl;}
	if (333 < n &&n< 445)
	{cout << 444 << endl;}
	 if (444 < n&&n < 556)
	 {cout << 555 << endl;}
	 if (555 < n &&n< 667)
	 {cout << 666 << endl;}
	 if (666 < n &&n< 778)
	 {cout << 777 << endl;}
	  if (777< n &&n< 889)
	  {cout << 888 << endl;}
	  if (888 < n &&n< 1000)
	  {cout << 999 << endl;}
	
	return 0;
}



Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cstring>
#include<iomanip>
#include<vector>
#include<queue>
#include<map>
#include<set>
#include<bitset>
#include<cmath>
#include<cassert>
#include<algorithm>
using namespace std;

const int _ = 2e5 + 7;
struct Edge{int end , upEd;}Ed[_ << 1];
int head[_] , cntEd , N;

void addEd(int a , int b){Ed[++cntEd] = (Edge){b , head[a]}; head[a] = cntEd;}

int fa[_] , mx[_] , ts; vector < int > nxt[_];
void dfs(int x , int p , int m){
	fa[x] = p; mx[x] = m; if(m < x){nxt[m].push_back(x); m = x;}
	for(int i = head[x] ; i ; i = Ed[i].upEd)
		if(Ed[i].end != p) dfs(Ed[i].end , x , m);
}

int sum[_] , tmp[_];
void down(int x , int p){
	for(int i = head[x] ; i ; i = Ed[i].upEd)
		if(Ed[i].end != p){sum[Ed[i].end] += sum[x]; down(Ed[i].end , x);}
}

int pre[_] , sz[_]; int find(int x){return pre[x] == x ? x : (pre[x] = find(pre[x]));}

signed main(){
	ios::sync_with_stdio(0); cin >> N;
	for(int i = 1 ; i < N ; ++i){int a , b; cin >> a >> b; addEd(a , b); addEd(b , a);}
	dfs(1 , 0 , 0); for(int i = 1 ; i <= N ; ++i) pre[i] = i;
	for(int i = 1 ; i <= N ; ++i){
		if(mx[i] < i){
			for(auto x : nxt[i]){
				int cur = 0;
				for(int j = head[x] ; j ; j = Ed[j].upEd)
					if(Ed[j].end != fa[x]) cur += sz[find(Ed[j].end)];
				tmp[x] = 1 + cur;
				for(int j = head[x] ; j ; j = Ed[j].upEd)
					if(Ed[j].end != fa[x]) sum[Ed[j].end] += cur - sz[find(Ed[j].end)];
			}
			for(int j = head[i] ; j ; j = Ed[j].upEd)
				if(Ed[j].end != fa[i]) sum[Ed[j].end] += sz[find(Ed[j].end)] + 1;
		}
		sz[i] = 1;
		for(int j = head[i] ; j ; j = Ed[j].upEd)
			if(Ed[j].end < i){sz[find(i)] += sz[find(Ed[j].end)]; pre[find(Ed[j].end)] = find(i);}
	}
	down(1 , 0);
	for(int i = 2 ; i <= N ; ++i) printf("%d " , sum[i] + tmp[i] - 1);
	return 0;
}

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

#define ll long long
#define REP(i,n) for(int i = 0; i < n; i++)
#define PI 3.141592653589

using namespace std;

int gcd(int a, int b){return (a % b)? gcd(b, a % b) : b;}
int lcm(int a, int b){return a * b / gcd(a, b);}

void solve_A(){
    int n, m;
    cin >> n >> m;
    int a[m];
    int sum = 0;
    REP(i,m){
        cin >> a[i];
        sum += a[i];
    }

    if(n - sum >= 0) cout << n - sum << endl;
    else cout << "-1" << endl;


}

int main(void){
    solve_A();
    
    return 0;
}

Measured memory_bytes: 3636
#include <bits/stdc++.h>
using namespace std;
#define INF -1e9
typedef long long ll;
ll N;
int M;
int N_digit[10] = {0, 2, 5, 5, 4, 5, 6, 3, 7, 6};

int main(void){
  cin >> N >> M;
  vector<int> A(M);
  ll i;
  //dp[i]:i本使って作れる最大の桁数
  int j,min,dp[N+1];
  min = 10;
  for(i=0;i<M;i++) cin >> A[i];
  dp[0] = 0;
  for(i=1;i<=N;i++){
    dp[i] = INF;
    for(j=0;j<M;j++){
      if( i >= N_digit[A[j]] && dp[i - N_digit[A[j]]] != INF){
        dp[i] = max(dp[i],dp[i-N_digit[A[j]]]+1);
      }
    }
  }

  sort(A.begin(),A.end(),greater<int>());
  ll n=N;
  while(n>0){
    for(i=0;i<M;i++){
      if( n >= N_digit[A[i]] && dp[n-N_digit[A[i]]] == dp[n] - 1){
        cout << A[i];
        n -= (ll) N_digit[A[i]];
        break;
      }
    }
  }
  cout << endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll= long long;
using vi= vector<int>;
using vvi= vector<vi>;
using vd= vector<double>;
using vvd= vector<vd>;
using vc= vector<char>;
using vb= vector<bool>;
#define rep(i,x,n) for(int i=x; i<n; i++)
#define all(x) x.begin(), x.end()


int main(){
  int k,x;
  cin >> k >> x;

  if(500*k>=x){
    cout << "Yes" << endl;
  }else{
    cout << "No" << endl;
  }
}

Measured memory_bytes: 256
#dt = {} for i in x: dt[i] = dt.get(i,0)+1
import sys;input = sys.stdin.readline
inp,ip = lambda :int(input()),lambda :[int(w) for w in input().split()]

M = 10**9+7
h,w = ip()
grid = [input().strip() for i in range(h)]
dp = [[0]*w for i in range(h)]
dp[0][0] = 1
for i in range(h):
    for j in range(w):
        if i-1 >= 0 and grid[i-1][j] == '.':
            dp[i][j] += dp[i-1][j]
        if j-1 >= 0 and grid[i][j-1] == '.':
            dp[i][j] += dp[i][j-1]
        dp[i][j] %= M
print(dp[-1][-1]%M)


Measured memory_bytes: 76840
#include <cstdio>
#include <cstring>
#include <iostream>
#include <string>
#include <cmath>
#include <bitset>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <algorithm>
#include <complex>
#include <unordered_map>
#include <unordered_set>
#include <random>
#include <cassert>
#include <fstream>
#define popcount __builtin_popcount
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;

int main()
{
    int n; cin>>n;
    vector<int> v[101];
    for(int i=0; i<n/2; i++){
        v[i].push_back(i+1);
        if(n%2==0) v[i].push_back(n-i);
        else v[i].push_back(n-i-1);
    }
    if(n%2) v[n/2].push_back(n);
    vector<P> ans;
    for(int i=0; i<(n+1)/2; i++){
        for(int j=i+1; j<(n+1)/2; j++){
            for(auto x:v[i]){
                for(auto y:v[j]){
                    ans.push_back(P(x, y));
                }
            }
        }
    }
    cout<<ans.size()<<endl;
    for(auto p:ans){
        cout<<p.first<<" "<<p.second<<endl;
    }
    return 0;
}

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

typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> pii;
typedef vector<pii> vii;
#define F first
#define S second
#define sz(x) (int)x.size()
#define db(x) cerr << #x << ": " << x << "\n";

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

    int N, M;
    cin >> N >> M;
    vi A[N+1];
    for(int i=0; i<M; i++) {
        int x, y;
        cin >> x >> y;
        A[x].emplace_back(y);
        A[y].emplace_back(x);
    }
    queue<pii> q;
    vi R(N+1,-1);
    q.push({1,0});
    while(!q.empty()) {
        pii act = q.front(); q.pop();
        if(R[act.F] != -1)
            continue;
        R[act.F] = act.S;
        for(int & x : A[act.F])
            q.push({x, act.F});
    }
    cout << "Yes\n";
    for(int i=2; i<=N; i++)
        cout << R[i] << '\n';
}


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

int main(){
  
  int n;
  cin >> n;
  vector<int> a(n);
  for(int i=0;i<n;i++){
    cin >> a.at(i);
  }
  
  vector<pair<int,int>> b;
  for(int j=0;j<n;j++){
    b.push_back(make_pair(a.at(j),j+1));
  }
               
  sort(b.begin(),b.end());
  
  for(pair<int,int> t:b){
    int x,y;
    tie(x,y)=t;
    cout << y << " ";
  }
  cout << endl;
}

Measured memory_bytes: 2164
S = int(input())

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

p = 10 ** 9 + 7
N = S  # N は必要分だけ用意する
fact = [1, 1]  # fact[n] = (n! mod p)
factinv = [1, 1]  # factinv[n] = ((n!)^(-1) mod p)
inv = [0, 1]  # factinv 計算用
 
for i in range(2, N + 1):
    fact.append((fact[-1] * i) % p)
    inv.append((-inv[p % i] * (p // i)) % p)
    factinv.append((factinv[-1] * inv[-1]) % p)

#print(cmb(n, r, p))

ans = 0
for i in range(S):
    ans += cmb(S - (i+1)*2 - 1, i, p)
    ans %= p
print(ans)

Measured memory_bytes: 67960
#include <iostream>
#include <iomanip>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <math.h>
#include <sstream>
#include <numeric>
#include <string>
#include <cassert>
#include <bitset>

using namespace std;
typedef long long ll;

int main() {
  int N, K, S;
  cin >> N >> K >> S;

  int num;
  if (S != 1000000000) {
    num = S + 1;
  } else {
    num = 1;
  }

  for (int i = 0; i < K; ++i) {
    cout << S << " ";
  }
  for (int i = K; i < N; ++i) {
    cout << num << " ";
  }
  cout << endl;
  
  return 0;
}


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

int main() {
  int n;
  cin>>n;
  int t[n], a[n];
  for (int i=0; i<n; i++) cin>>t[i];
  for (int i=0; i<n; i++) cin>>a[i];
  int max_h1[n], min_h1[n];
  max_h1[0] = min_h1[0] = t[0];

  for (int i=1; i<n; i++) {
    if (t[i] == t[i-1]) {
      max_h1[i] = max_h1[i-1];
      min_h1[i] = 1;
    } else {
      max_h1[i] = t[i];
      min_h1[i] = t[i];
    }
  }
  int max_h2[n], min_h2[n];
  max_h2[n-1] = min_h2[n-1] = a[n-1];
  for (int i=n-2; i>=0; i--) {
    if (a[i] == a[i+1]) {
      max_h2[i] = max_h2[i+1];
      min_h2[i] = 1;
    } else {
      max_h2[i] = a[i];
      min_h2[i] = a[i];
    }
  }
  long long ans  = 1;
  long long MOD = (int)1e9 + 7;
  for (int i=0; i<n; i++) {
    int x = min(max_h1[i], max_h2[i]) - max(min_h1[i], min_h2[i]);
    if (x < 0) {
      ans = 0;
      break;
    }
    ans = (ans * (x + 1)) % MOD;
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 2560
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, tan, asin, acos, atan, radians, degrees#, log2
from itertools import accumulate, permutations, combinations, combinations_with_replacement, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left, insort, insort_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10**9 + 7
#from decimal import *

A, B, C = MAP()

if any(x%2 != 0 for x in [A, B, C]):
	print(0)
	exit()

l = [(A, B, C)]

cnt = 0
while 1:
	a = (B+C)/2
	b = (A+C)/2
	c = (A+B)/2
	if any(x%1 != 0 for x in [a, b, c]):
		print(cnt)
		exit()
	elif (a, b, c) in l:
		print(-1)
		exit()
	else:
		A, B, C = a, b, c
		l.append((A, B, C))
		cnt += 1


Measured memory_bytes: 5204
#ifndef CLion
//#pragma GCC optimize ("O3")
#endif

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

#define F first
#define S second
#define pb push_back
#define ll long long
#define all(x) x.begin() , x.end()
#define mod(x,m) ((x%m + m)%m)
#define rep(i,s,e) for (int i = s; i < e; ++i)
#define mem(a,v) memset(a , v , sizeof a)
using namespace std;
using namespace __gnu_pbds;

template<typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag,
        tree_order_statistics_node_update>;

const int N = 2e5 + 9 , base = 26;
ll a[N] , b[N] , n , m , tot;

ll askA( ll have ){
    int idx = upper_bound(a , a + n + 1 , have) - a - 1;
    if ( idx > 0 && idx <= n ) return idx;
    return 0;
}
ll askB( ll have ){
    int idx = upper_bound(b , b + m + 1 , have) - b - 1;
    if ( idx > 0 && idx <= m ) return idx;
    return 0;
}

void Main(int cse , bool last){
    cin >> n >> m >> tot; ll sum = 0;
    rep(i,1,n + 1){
        ll x; cin >> x; sum += x; a[i] = sum;
    }
    sum = 0;
    rep(i,1,m + 1){
        ll x; cin >> x; sum += x; b[i] = sum;
    }

    ll mx = 0;
    rep(i,1,n + 1){
        if ( a[i] <= tot ) mx = max(mx , i + askB(tot - a[i]));
    }
    rep(i,1,m + 1){
        if ( b[i] <= tot ) mx = max(mx , i + askA(tot - b[i]));
    }
    cout << mx;
}

int main(){
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#ifdef CLion
    freopen( "in.txt" , "r" , stdin  );
    //freopen( "out.txt", "w" , stdout );
#endif

    int t = 1;
    //cin >> t;
    for ( int cse = 1; cse <= t; ++cse ) Main(cse, cse == t);
    return 0;
}


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

int main() {

  int n, k;
  cin >> n >> k;
  int x, sum=0;
  
  for(int i=0; i<n; i++){
    cin >> x;
    if(x < abs(x-k)) sum += 2 * x;
    else sum += abs(x-k) * 2;
  }
  
  cout << sum << endl;
  return 0;
  
}


Measured memory_bytes: 256
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
const int mod=1000000007;
inline void add(int &x,int y){(x+=y)>=mod?x-=mod:0;}
inline int pl(int x,int y){return (x+=y)>=mod?x-=mod:x;}
inline int kpow(int a,long long b)
{
	int s=1;
	for(;b;b>>=1,a=1ll*a*a%mod)
		if(b&1)s=1ll*s*a%mod;
	return s;
}
int n,m;
long long k;
char mp[1010][1010];
struct matrix
{
	int a[2][2];
	friend matrix operator * (matrix a,matrix b)
	{
		static matrix c;
		#define calc(i,j) (1ll*a.a[i][0]*b.a[0][j]+1ll*a.a[i][1]*b.a[1][j])%mod
		for(int i=0;i<2;++i)
			for(int j=0;j<2;++j)
				c.a[i][j]=calc(i,j);
		return c;
		#undef calc
	}
}t,s;
int main()
{
	scanf("%d %d %lld",&n,&m,&k);
	for(int i=1;i<=n;++i)scanf("%s",mp[i]+1);
	for(int i=1;i<=n;++i)
		for(int j=1;j<=m;++j)
			mp[i][j]=mp[i][j]=='#';
	bool flag1=0,flag2=0;
	for(int i=1;i<=n;++i)if(mp[i][1]&&mp[i][m])flag1=1;
	for(int i=1;i<=m;++i)if(mp[1][i]&&mp[n][i])flag2=1;
	if((flag1&&flag2)||k==0)return printf("1"),0;
	int c0=0,c1=0,c2=0;
	for(int i=1;i<=n;++i)
		for(int j=1;j<=m;++j)
		{
			c0+=mp[i][j];
			if(mp[i][j]&&mp[i][j+1])++c1;
			if(mp[i][j]&&mp[i+1][j])++c2;
		}
	--k;
	if(!flag1&&!flag2)return printf("%d",kpow(c0,k)),0;
	s.a[0][0]=1;
	if(flag1)
	{
		t.a[0][0]=c0,t.a[0][1]=c1;
		for(int i=1;i<=n;++i)if(mp[i][1]&&mp[i][m])++t.a[1][1];
		for(;k;k>>=1,t=t*t)if(k&1)s=s*t;
	}
	else
	{
		t.a[0][0]=c0,t.a[0][1]=c2;
		for(int i=1;i<=m;++i)if(mp[1][i]&&mp[n][i])++t.a[1][1];
		for(;k;k>>=1,t=t*t)if(k&1)s=s*t;
	}
	printf("%d",pl(s.a[0][0],mod-s.a[0][1]));
	return 0;
}

Measured memory_bytes: 2720
import java.util.*;
public class Main {
	
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        
        int A = sc.nextInt();
        int B = sc.nextInt();
        
        String S = sc.next();
        
        for (int i = 0; i < A; i++) {
        	if (S.charAt(i) == '-') {
        		System.out.println("No");
        		return;
        	}
        }
        
        if (S.charAt(A) != '-') {
    		System.out.println("No");
    		return;
        }
        
        for (int i = A+1; i < B+A+1; i++) {
        	if (S.charAt(i) == '-') {
        		System.out.println("No");
        		return;
        	}
        }
        
        System.out.println("Yes");
    }
    
}

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

int a, b;

int gcd(int x, int y){
    if(x % y == 0) return y;
    
    int res = gcd(y, x % y);
    return res;
}

int main(void){
    cin >> a >> b;
    cout << gcd(a, b) << endl;
}



Measured memory_bytes: 3116
package main

import (
	"fmt"
	"math"
)

const inf = 10000000000.0

func main() {
	var n int
	fmt.Scan(&n)

	arrA := make([]int, n)
	for i := 0; i < n; i++ {
		fmt.Scan(&arrA[i])
	}

	cumSumA := make([]int, n+1)
	cumSumA[0] = 0
	for i, a := range arrA {
		cumSumA[i+1] = cumSumA[i] + a
	}

	ans := inf
	for i := 1; i < n; i++ {
		if math.Abs(float64(cumSumA[n]-(cumSumA[i]*2))) < ans {
			ans = math.Abs(float64(cumSumA[n] - cumSumA[i]*2))
		}
	}

	fmt.Println(int(ans))
}


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

using namespace std;

int main()
{
  int n,m;
  cin>>n>>m;

  vector<int> a;
  vector<int> b;
  int tmp;
  for(int i = 0;i < n+m;++i){
    cin>>tmp;
    if(i < n){
      a.push_back(tmp);
    }
    else{
      b.push_back(tmp);
    }
  }

  vector<int> an;
  set_intersection(a.begin(),a.end(),b.begin(),b.end(),back_inserter(an));
  sort(an.begin(),an.end());

  b.insert(b.end(),a.begin(),a.end());
  sort(b.begin(),b.end());
  b.erase(unique(b.begin(),b.end()),b.end());

  cout<<an.size()<<" "<<b.size()<<endl;
  for(int e : an){
    cout<<e<<endl;
  }
  for(int e : b){
    cout<<e<<endl;
  }

return 0;
}


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

bool isNotDivisor[1000010], isVisited[1000010] = {0};

void sieveDivisor(int arr[], int max, int n)
{
	for(int i = 0; i <= max; i++) isNotDivisor[i] = true;
	for(int i = 0; i < n; i++)
	{
		if(isNotDivisor[arr[i]] && !isVisited[arr[i]])
		{
			isVisited[arr[i]] = 1;
			for(int j = arr[i] * 2; j <= max; j+=arr[i])
				isNotDivisor[j] = false;
		}
		else isNotDivisor[arr[i]] = false;
	}
}

int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	int n, cnt = 0;
	cin >> n;
	int arr[n];
	for(int i = 0; i < n; i++) cin >> arr[i];
	sort(arr, arr + n);
	int max = arr[n-1];
	sieveDivisor(arr, max, n);
	for(int i = 0; i < n; i++)
		if(isNotDivisor[arr[i]])
			cnt++;
	cout << cnt;
	return 0;
}


Measured memory_bytes: 6336
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int g = sc.nextInt();
        int gd = sc.nextInt();
        int pd = sc.nextInt();
        
        System.out.println(gd + Math.min(gd+g+1, pd));
    }
}


Measured memory_bytes: 22996
#include<iostream>
#include<cstring>
#include<string>
#include<cstdio>
#include<algorithm>

using namespace std;

int main(void) {
	string str1;
	while(cin >> str1) {
		if(str1 == "Sunny")
			cout << "Cloudy" << endl;
		else if(str1 == "Cloudy")
			cout << "Rainy" << endl;
		else	
			cout << "Sunny" << endl;
	}
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define int long long
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define for1(i, a, b) for(i = a; i <= b; ++i)
#define for0(i, a, b) for(i = a; i < b; ++i)
#define forw1(i, a, b) for(i = a; i >= b; --i)
#define forw0(i, a, b) for(i = a - 1; i >= b; --i)
#define fora(v, a) for(auto v : a)
#define bp __builtin_popcount
#define bpll __builtin_popcountll

using namespace std;
using cd = complex<double>;

typedef vector<int> vi;
typedef pair<int, int> ii;
typedef vector<cd> vcd;
typedef vector<ii> vii;
typedef vector<vector<int> > vvi;

const int modd1 = 1e9 + 7, modd2 = 998244353, maxn = 10;
const double pi = acos(-1);

void solve(){
    string s; cin >> s;
    if(s == "AAA" || s == "BBB"){
        cout << "No"; return;
    }
    cout << "Yes"; return;
}

signed main() {
    //freopen(".INP", "r", stdin); 
    //freopen(".OUT", "w", stdout);
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    solve();
}

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

int main() {
  int A, B;
  string op;
  cin >> A >> B;
  if (A * B % 2 == 0) {
  cout << "Even" << endl;
  }
  else if (A * B % 2 == 1) {
  cout << "Odd" << endl;
  } 
}


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

#define debug(x) cout <<"DEBUG"<<" "<< #x << ":" << x << '\n'

// n回繰り返し
#define rep(i,n) for(int i = 0; i < ((int)(n)); i++)   // 0-indexed昇順
#define rep1(i,n) for(int i = 1; i <= ((int)(n)); i++) // 1-indexed昇順
#define rrep(i,n) for(int i = ((int)(n)-1); i >= 0; i--)  // 0-indexed降順
#define rrep1(i,n) for(int i = ((int)(n)); i >= 1; i--)   // 1-indexed降順
#define all(x) (x).begin(),(x).end()

typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<vi> vii;  // 2次元配列
typedef vector<ll> vll;
typedef pair<int, int> PII;

template<typename T>
using vec = vector<T>;
template<class T>
using maxheap = std::priority_queue<T>;
template<class T>
using minheap = std::priority_queue<T, std::vector<T>, std::greater<T>>;

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

const ld Pi = std::acos(-1.0L);
const ll infll = (1LL<<62)-1;
const int inf = (1<<30)-1;
const int mod = 1000000007;
// const int mod = 998244353;


/*FUNCs=================================================*/
vec<vll> dp;
vii restore;
/*MAIN==================================================*/
signed main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);   //cin cout 高速化
    // cout << fixed << setprecision(30);

    int n, weight; cin >> n >> weight;
    vi w(n), v(n); rep(i,n) cin >> w[i] >> v[i];

    dp.resize(n+1, vll(100001, infll));
    restore.resize(n+1, vi(100001));
    dp[0][0] = 0;
    for(int i = 0; i < n; ++i) {
        for(int j = 0; j <= 100000; ++j) {
            if(j-v[i] >= 0) {
                if(chmin(dp[i+1][j], dp[i][j-v[i]] + w[i])) {
                    restore[i+1][j] = j-v[i];
                }
            }
            if(chmin(dp[i+1][j], dp[i][j])) {
                restore[i+1][j] = j;
            }
        }
    }
    int ans;
    for(int i = 100000; i >= 0; --i) {
        if(dp[n][i] <= weight) {
            ans = i;
            cout << ans << '\n';
            break;
        }
    }

// 復元
    // int j = ans;
    // for(int i = n-1; i >= 0; --i) {
    //     if(restore[i+1][j] == j - v[i]) {
    //         cout << i+1 << '\n';
    //     }
    //     j = restore[i+1][j];
    // }
}

Measured memory_bytes: 119280
using System;
using System.Linq;
using System.Collections.Generic;

class Program
{
    static void Main()
    {
        var N = Int64.Parse(Console.ReadLine());
        var A = Console.ReadLine().Split(' ').Select(x=>Int64.Parse(x)).ToArray();
        var B = Console.ReadLine().Split(' ').Select(x => Int64.Parse(x)).ToArray();

        var ans = 0L;
        for (int i=0;i<N;++i)
        {
            var monsterNum = A[i] + A[i + 1];
            var taosuNum = B[i] < monsterNum ? B[i] : monsterNum;
            ans += taosuNum;
            var nextMonsterHeruNum = taosuNum - A[i];
            if(0<nextMonsterHeruNum)A[i + 1] -= nextMonsterHeruNum;
        }

        Console.WriteLine(ans);
    }
}


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

using namespace std;

#define REP(i, n) for(int i=0;i<(int)n;i++)
#define ALL(v) v.begin(), v.end()
#define pb push_back
typedef vector<int> vi;

enum DIR { LEFT, RIGHT, FRONT, BACK, BOTTOM, TOP };
int rotm[4][6]={
	{5,4,2,3,0,1},
	{0,1,5,4,2,3},
	{0,1,4,5,3,2},
	{4,5,2,3,1,0}
};

struct Dice{
	vi d, x;
	Dice(vi d):d(d), x(6){
		
	}
	
	inline int &operator[](int i){
		return d[i];
	}
	
	inline void rot(int k){
		REP(i, 6) x[rotm[k][i]] = d[i];
		swap(d, x);
	}
	
	inline int check(){
		if(d[BOTTOM] == -1) return 0;
		const int A = d[BOTTOM] + d[TOP];
		const int B = d[LEFT] + d[RIGHT];
		const int C = d[FRONT] + d[BACK];
		return (A <= B+C && B <= A+C+1 && C <= A+B+1);
	}
	
};
int n;
string db = "ENSW";
int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);cout.tie(0);
	while(1){
		vi t(6);
		REP(i, 6) cin >> t[i];
		sort(ALL(t));
		if(t[5] == 0) break;
		int n = accumulate(ALL(t), 0);
		string ans(n, 'Z');
		do{
			Dice dice(t);
			string tmp;
			int f = 0;
			REP(itr, n){
				REP(i, 4){
					dice.rot(i);
					dice[BOTTOM] --;
					if(dice.check()){
						tmp.pb(db[i]);
						break;
					}
					dice[BOTTOM] ++;
					dice.rot(3-i);
				}
				if(tmp.size() != itr+1 || !f && ans[itr] < tmp[itr]) break;
				f |= ans[itr] > tmp[itr];
			}
			if(tmp.size() == n) ans = min(ans, tmp);
		}while(next_permutation(ALL(t)));
		int p, q;
		cin >> p >> q; p--;
		if(ans[0] == 'Z') cout << "impossible" << '\n';
		else cout << ans.substr(p, q-p) << '\n';
	}
}

Measured memory_bytes: 1360
#include <stdio.h>
#include <math.h>
#define ll long long
 int get(ll n){
 	int res=0;
 	while(n>0){
 		n/=10;
 		res++;
 	}
 	return res;
 }
 int main(void)
 {
 	ll n;
 	scanf("%lld",&n);
 	for(int i=(int)sqrt(n);i>0;i--){
 		if(n%i==0){
 			printf("%d\n",get(n/i));
 			return 0;
 		}
 	}
 	return 0;
 }

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

#define ll long long
#define ull unsigned long long
#define pb push_back
#define pf push_front
#define pof pop_front
#define pob pop_back
#define mp make_pair
#define pll pair<ll,ll>
#define pii pair<int,int>
#define all(s) s.begin(),s.end()
#define vll vector<ll>
#define vi vector<int>
#define vpii vector<pii>
#define vpll vector<pll>
#define vd vector<double>
#define vull vector<ull>
#define vc vector<char>
#define vs vector<string>
#define fi first
#define se second
#define sz(x) x.size()
#define cinarr(n,a) for(int i = 0; i < n; i++) cin >> a[i];
#define coutarr(n,a) for(int i = 0; i < n; i++) cout << a[i] << (i+1==n?'\n':' ');
#define fori(i,a,b,x) for(int i = a; i <= b; i+=x)
#define ford(i,a,b,x) for(int i = a; i >= b; i-=x)
#define tc int t; cin >> t; for(int cs = 1; cs <= t; cs++)
#define IOS ios_base::sync_with_stdio(0); cin.tie(NULL);
#define ld long double
#define reset(x,y) memset(x,y,sizeof x);
#define sqr(x) 1LL*(x)*(x)
#define cube(x) 1LL*(x)*(x)*(x)
#define ub(v, a) upper_bound(all(v), a)
#define lb(v, a) lower_bound(all(v), a)
#define EPS 1e-10
#define INF 2000000000
#define mod 1000000007
#define minof(a) min_element(all(a))
#define maxof(a) max_element(all(a))
#define debug(val) cerr << "The value of " << #val << " is = " << val << endl;
#define testing cerr << "--------------------------\n";

//input space ---> scanf("%[^\n]%*c",s);

int main() {
	IOS
	int a,b;
	cin >> a >> b;
	if(a > 9 or b > 9) {
		cout << -1 << endl;
	} else {
		cout << a*b << endl;
	}
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
int N,X;
  cin>>N>>X;
  vector<int>m(N);
  for(int i=0;i<N;i++)
    cin>>m.at(i);
  int sum=0;
  for(int i=0;i<N;i++)
    sum+=m.at(i);
  X-=sum;
  sort(m.begin(),m.end());
  int x=X/m.at(0);
  int ans=x+N;
  cout<<ans<<endl;
  
   return 0;
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main(){
int n;
cin>>n;
if(n==999){
    cout<<"111";
}
else if (n==111){
    cout<<"999";
}
else if (n==991){
    cout<<"119";
}
else if (n==119){
    cout<<"991";
}
else if (n==919){
    cout<<"191";
}
else if(n==191){
    cout<<"919";
}
else if (n==199){
    cout<<"911";
}
else if (n==911){
    cout<<"199";
}
return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;
public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner scan = new Scanner(System.in);
	    int N = scan.nextInt();
	    String S = scan.next();
	    for(int i=0; i<S.length(); i++){
            int tmp = S.charAt(i)+N;
            if(tmp > 90){
                tmp = S.charAt(i) - 26 + N ;
            }

            System.out.print((char)tmp);
        }
	}

}

Measured memory_bytes: 39768
#include <iostream>
#include <vector>
#include <queue>
#include <algorithm>

using namespace std;
using ll = long long;

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

    long idx=0;
    long k, m;
    cin >> k >> m;
    vector<long> li(m);
    for(size_t i=0;i<m; i++)
    {
        cin >> li[i];
    }
    vector<long> li2(m);
    for(size_t i=0;i<m; i++)
    {
        if(i!=m-1)
        li2[i] = li[i+1] - li[i];
        else 
        li2[i] = k - li[i] + li[0];
        
    }
    sort(li2.begin(), li2.end());
    long ans = 0;
    for(size_t i=0;i<m-1; i++)
    {
        ans += li2[i];
    }
    cout << ans << "\n";

    return 0;
} 

Measured memory_bytes: 3328
#!/usr/bin/env python3
import sys

YES = "Yes"  # type: str
NO = "No"  # type: str


def solve(A: int, B: int, C: int):
    if A == B and A == C:
        print(NO)
    elif A != B and A != C and B != C:
        print(NO)
    else:
        print(YES)
    return


# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    A = int(next(tokens))  # type: int
    B = int(next(tokens))  # type: int
    C = int(next(tokens))  # type: int
    solve(A, B, C)

if __name__ == '__main__':
    main()


Measured memory_bytes: 3064