akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0;i<n;i++)
#define erep(i,n) for(int i = 0;i<=n;i++)
#define rep1(i,n) for(int i = 1;i<n;i++)
#define erep1(i,n) for(int i = 1;i<=n;i++)
typedef long long ll;
#define vint vector<int>
#define vvint vector<vector<int>>
#define vstring vector<string>
#define vll vector<ll>
#define vbool vector<bool>
#define INF 100000000


int main(){
  ll x,y;
  cin >> x >> y;
  if(x < 0){
    if(abs(x) < abs(y)){
      if(y >= 0) cout << abs(x + y) + 1 << endl;
      else cout << abs(x - y) + 2 << endl;
    }
    else{
      if(y <= 0) cout << abs(y - x) << endl;
      else cout << abs(x + y) + 1 << endl;
    }
  }
  else{
    if(abs(x) > abs(y)){
      if(y <= 0) cout << abs(x + y) + 1 << endl;
      else cout << abs(x - y) + 2 << endl;
    }
    else{
      if(y >= 0) cout << abs(y - x) << endl;
      else cout << abs(x + y) + 1 << endl;
    }
  }
}




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

int check(char *S){
  for (int i = 1; i < strlen(S); i++){
    if(S[i] == S[i - 1]){
      return -1;
    }
  }
  return 0;
}

int main(){
  char S[5];
  cin >> S;
  if(check(S) == 0){
    cout << "Good" << endl;
  } else {
    cout << "Bad" << endl;
  }
  
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,f,n) for(int i=(f); (i) < (n); i++)
#define repe(i,f,n) for(int i=(f); (i) <= (n); i++)
using namespace std;
using ll = long long;
#define MOD (ll)1000000007
#define PI 3.14159265359
#define debug(x) cout<<#x<<" :: "<<x<<"\n";
#define debug2(x,y) cout<<#x<<" :: "<<x<<"\t"<<#y<<" :: "<<y<<"\n";
#define debug3(x,y,z) cout<<#x<<" :: "<<x<<"\t"<<#y<<" :: "<<y<<"\t"<<#z<<" :: "<<z<<"\n";
#define P pair<int, int>
#define dvec vector<vector<ll>>
//printf("%.10f\n")
//cout << fixed << setprecision(10);
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 = 1e+18;
int iINF = 1e9;


int main()
{
  int N, M; cin >> N >> M;
  vector<vector<int>> G(N);
  rep(i, 0, M){
    int a, b; cin >> a >> b; --a, --b;
    G[a].push_back(b);
    G[b].push_back(a);
  }

  queue<int> q;
  vector<bool> seen(N);
  int ans = 0;

  rep(i, 0, N){
    int comp = 1;
    if(seen[i]) continue;
    else seen[i] = true;
    q.push(i);
    while(!q.empty()){
      int node = q.front();
      q.pop();
      for(auto child : G[node]){
        if(seen[child]) continue;
        seen[child] = true;
        ++comp;
        q.push(child);
      }
    }
    chmax(ans, comp);
  }

  cout << ans << endl;
}


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

int n;
string s, t;

int main()
{
    cin >> n;
    cin >> s >> t;
    for (int i = 0; i < n; i++)
        printf("%c%c", s[i], t[i]);
    printf("\n");
    return 0;
}


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


int main(){
	int a;
	string s;
	cin >> a >> s;
	if(a >= 3200){
		cout << s;
	}else{
		cout << "red";
	}
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<string>
#include<map>
using namespace std;
typedef long long ll;
int main(){
  ll n;
  cin>>n;
  ll ans=17441744174417;
  for(ll i=1;i*i<=n;i++){
    if(n%i==0) ans=min(ans,i+n/i);
  }
  cout<<ans-2<<endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define INT long long int
#define N 3
#define PA pair<INT, INT>
#define oo 9876543219876543
#define MOD 1000000007
#define BND 1000000000
using namespace std;
INT T, n, m, k, x, y, z, a[500050], b[500040], c[500050], Z, Y, dt[2020], mx;
string s, t;
map< INT, set<INT> > d;
pair<INT, INT> p[200020], q[200020];
INT f(INT x, INT y)
{
    return abs(p[x].first-p[y].first) + abs(p[x].second-p[y].second);
}
int main()
{
    ios::sync_with_stdio(false);
    T = 1; //cin>>T;
    while( T-- )
    {
        cin>>n;
        for(int i = 0 ; i < n ; i++ ) cin>>p[i].first>>p[i].second;
        INT mx = 0, id[4] = {0};
        p[n] = {-BND, -BND};
        for(int i = 0 ; i < n ; i++ )
            if( mx < f(n, i) ) id[0] = i, mx = f(n, i);
        mx = 0;
        p[n] = {BND, -BND}, mx = 0;
        for(int i = 0 ; i < n ; i++ )
            if( mx < f(n, i) ) id[1] = i, mx = f(n, i);
         mx = 0;
        p[n] = {-BND, BND}, mx = 0;
        for(int i = 0 ; i < n ; i++ )
            if( mx < f(n, i) ) id[2] = i, mx = f(n, i);
        mx = 0;
        p[n] = {BND, BND}, mx = 0;
        for(int i = 0 ; i < n ; i++ )
            if( mx < f(n, i) ) id[3] = i, mx = f(n, i);
        mx = 0;
        for(int k = 0 ; k < 4 ; k++ )
            for(int i = 0 ; i < n ; i++ )
                if( mx < f(id[k], i) ) mx = f(id[k], i);
        cout<<mx<<endl;
    }
    return 0;
}

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

int main() {
    int i;
    int n;
    int cnt = 0;

    scanf("%d", &n);
    for(i = 1; i <= n; i++){
        if(1 <= i && i <= 9) cnt++;
        if(100 <= i && i <= 999) cnt++;
        if(10000 <= i && i <= 99999) cnt++;
    }
    printf("%d\n", cnt);

    return 0;
}


Measured memory_bytes: 128
k = int(input())

if k < 10:
    print(k)
    exit()

cnt = 9
l = ["1", "2", "3", "4", "5", "6", "7", "8", "9"]

def check():
    if cnt == k:
        print(memo[-1])
        exit()

while True:
    memo = []
    for i in l:
        if i[-1] == "0":
            memo.append(i+"0")
            cnt += 1
            check()

            memo.append(i+"1")
            cnt += 1
            check()

        elif i[-1] == "9":
            memo.append(i+"8")
            cnt += 1
            check()

            memo.append(i+"9")
            cnt += 1
            check()

        else:
            memo.append(i + str(int(i[-1])-1))
            cnt += 1
            check()

            memo.append(i + i[-1])
            cnt += 1
            check()

            memo.append(i + str(int(i[-1]) + 1))
            cnt += 1
            check()

    l = memo[:]

Measured memory_bytes: 8488
import java.util.*;
import java.math.BigDecimal;
public class Main {
  public static void main(String args[]){
    Scanner sc = new Scanner(System.in);
    BigDecimal A = sc.nextBigDecimal();
		BigDecimal B = sc.nextBigDecimal();		
		BigDecimal ans = A.multiply(B);
		System.out.println(ans.toBigInteger());
  }
}  

Measured memory_bytes: 37448
# coding: utf-8
# Your code here!
import math
def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])

    if temp!=1:
        arr.append([temp, 1])

    if arr==[]:
        arr.append([n, 1])

    return arr
n=int(input())
ans=0
insu=factorization(n)

if n==1:
    print(0)
else:
    for i in range(len(insu)):
        ans+=math.floor((-1+math.sqrt(1+8*insu[i][1]))/2)
    
    print(ans)


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

const string YES = "Yes";
const string NO = "No";

void solve(long long A, long long B, long long C)
{
    if (B < A)
    {
        swap(A, B);
    }

    if (A <= C && C <= B)
    {
        cout << YES << endl;
    }
    else
    {
        cout << NO << endl;
    }
}

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


Measured memory_bytes: 256
a, b, c, x = map(int, [input() for i in range(4)])
ans = 0
for a in range(a + 1):
    for b in range(b + 1):
        for c in range(c + 1):
            if( a*500 + b*100 + c*50 == x ):
                ans = ans + 1

print(ans)

Measured memory_bytes: 3060
use std::io;

fn read_line()-> String {
    let mut s = String::new();
    let _ = io::stdin().read_line(&mut s).unwrap();
    s.trim().to_string()
}

fn main() {
	let n = read_line().split("").map(|e|e.parse().unwrap())
	.collect::<Vec<String>>();
	println!("{}",n.iter().filter(|i|i.to_string() == "1").count());
}


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

using namespace std;

const int64_t mod = 1e9 + 7;
const int64_t infll = (1LL << 62) - 1;
const int64_t inf = (1 << 30) - 1;

template <typename T>
ostream &operator<<(ostream &os, const vector<T> &v) {
  os << "[ ";
  for (auto a : v) os << a << " ";
  os << "]";
  return os;
}

int main() {
  int a, b, c;
  cin >> a >> b >> c;
  cout << (a + b + c >= 22 ? "bust" : "win") << endl;
  return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<stdlib.h>
#include<time.h>
#include<math.h>
#include<string.h>
#include<algorithm>
#include<queue>
#include<map>
#include<iomanip>

using namespace std;
int main(void){
 map<int,int> A;
 map<int,int> B;
 vector<int> C;
 vector<int> D; 
 
 int n,v;
 int number;
 int first_max=0;
 int second_max=0;
 int sum=0;
 int sum1=0;

 cin>>n;
 for(int i=0; i<n; i++){
  cin>>v;
  if(i%2==0){
   C.push_back(v);
   A[v]++;
  }
  else{
	D.push_back(v);
    B[v]++;
  }
 }

 for(int i=0; i<C.size(); i++){
  if(A[C[i]]>first_max){
	  first_max=A[C[i]];
	  number=C[i];
  }
 }
 for(int i=0; i<D.size(); i++){
  if(B[D[i]]>second_max&& D[i]!=number){
	  second_max=B[D[i]];
  }
 }
 sum=(C.size()-first_max)+(D.size()-second_max);
 
 first_max=0;
 second_max=0;
 for(int i=0; i<D.size(); i++){
  if(B[D[i]]>first_max){
	  first_max=B[D[i]];
	  number=D[i];
  }
 }
 for(int i=0; i<C.size(); i++){
  if(A[C[i]]>second_max&& C[i]!=number){
	  second_max=A[C[i]];
  }
 }

 sum1=(C.size()-second_max)+(D.size()-first_max);

 std::cout<<min(sum,sum1)<<std::endl;
 return 0;
}

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

#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

#define DIM (long long)100007
#define INF (long long)100000007

using namespace std;
using namespace __gnu_pbds;

typedef long long ll;
typedef long double ld;
typedef pair<ll,ll> pairll;

ll n,m,i,j,sum,f1,f2,v1,v2,k;
ll a[DIM];
ll dp[DIM];
int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);

    cin >> n >> k;
    for(i=1; i<=n; i++) cin >> a[i];

    dp[0]=0;
    for(i=1; i<=k; i++){
            dp[i]=0;
        for(j=1; j<=n; j++){
            if(i-a[j]>=0 && dp[i-a[j]]==0) dp[i]=1;
        }
    }

    if(dp[k]==1) cout << "First" << endl;
    else cout << "Second" << endl;










    return 0;
}


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

typedef long long ll;
const ll INF = 1010000000000000017LL;
const ll MOD = 1000000007LL;

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

//#define DEBUG(fmt, ...)
#define DEBUG(fmt, ...) fprintf(stderr, fmt "\n", ##__VA_ARGS__)

int main(){
    std::cout<<std::fixed<<std::setprecision(10);

    ll N, X;
    cin >> N >> X;

    ll count = 1;
    ll p = 0;
    REP(i, N){ 
       ll l;
       cin >> l;
       p += l;
       if( p <= X ){
         count++;
       }else{
          break;
       }
    }

    cout << count << endl;
}


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

constexpr int si = 201*1001;
int n,m,k;

int64_t Cf(int64_t n1, int64_t k1)
{
   if (k1 > n1) return 0;
   if (k1 > n1 - k1) k1 = n1 - k1;
   if (k1 == 0) return 1;

   int64_t result = n1;
   for (int64_t i = 2; i <= k1; ++i) {
      result *= (n1 - i + 1);
      result /= i;
   }
   return result;
}
int64_t sp1(int64_t e, int64_t o)
{
   int64_t eve= int64_t(1) << e, odd=1;

   for (int64_t i = 2; i <= o; i += 2)
   {
      auto ad = Cf(o, i);
      odd += ad;
   }

   int64_t ret = eve*odd;
   return ret;
}
int64_t sp2(int64_t e, int64_t o)
{
   int64_t eve= int64_t(1) << e, odd=0;

   for (int64_t i = 1; i <= o; i += 2)
   {
      auto ad = Cf(o, i);
      odd += ad;
   }

   int64_t ret = eve*odd;
   return ret;
}

int main()
{
   ios_base::sync_with_stdio(0); cin.tie(0);
   int64_t n1 = 3, k1 = 2;
   auto z = Cf(n1, k1);

   while(cin >> n >> m)
   {
      int ev = 0, od = 0;
      for (int i = 0; i < n; i++) {
         int x;  cin >> x;
         if (x&1)            od++;         else            ev++;
      }

      int64_t ans;
      if (0 == m){
         ans = sp1(ev, od);
      }else{
         if (od) {
            ans = sp2(ev, od);
         }
         else
            ans = 0;
      }
      cout << ans << '\n';
   }
   return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,a,b) for(int i = (a); i <= (b); i++)
#define rng(a) a.begin(), a.end()
#define ina(n,a) cin >> n; for(int i = 1; i <= n; i++) cin >> a[i]
#define sz(x) (int)(x).size()
#define se second
#define fi first
#define prev            coyhhhhhhyoc    
#define next          sdNNNmNNNNNNNmds  
#define y0           hNNNNy_yNNNNNN_sNh
#define y1          mNNNNNdtdNNNNNNtsNNm
#define yn          mNNNNNNNNy___smNNNms
#define tm            oooooosyysooooot 
#define read               tyhyt        
#define rank              ytmNmo         
#define index              yyy
#define pb push_back
#define pcnt __builtin_popcountll
#define rrep(i,a,b) for(int i = (b); i >= (a); i--)
#define rall(x,a) for(auto x : a)
#define MOD 1000000007
#define endl "\n"
typedef long long ll;
using namespace std;

signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    int n, m;
    cin >> n >> m;
    int ans = n * (n - 1) / 2 + m * (m - 1) / 2;
    cout << ans << endl;
    return 0;
}


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

int main() {
string s;
cin >> s;

for(int i = 0; i < s.size(); ++i) {
if(s[i] == ',') {
s[i] = ' ';
}
cout << s[i];
}
cout << endl;
return 0;
}

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

typedef long long llt;

const int MaxN = 100000 + 5;
const int MaxSqr = 1000 + 5;

int N, cnt;
int First_appear[MaxSqr];
vector <int> Ans[MaxSqr];

int main() {
    scanf("%d", &N);
    int k = 0;

    for (int i = 1; i * (i + 1) <= N * 2; ++i) {
        int x = i * (i + 1) / 2;
        if (x == N) k = i;
    }

    if (k == 0) {
        puts("No");
    } else {
        puts("Yes");
        printf("%d\n", k + 1);

        for (int i = 1; i <= k + 1; ++i) {
            for (int j = max(i - k, 1); j < i; ++j) Ans[i].push_back(Ans[j][i - j - 1 + First_appear[j]]);
            First_appear[i] = Ans[i].size();
            while (Ans[i].size() < k) Ans[i].push_back(++cnt);
        }

        for (int i = 1; i <= k + 1; ++i) {
            printf("%d", k);
            for (int j = 0; j < k; ++j) printf(" %d", Ans[i][j]);
            putchar('\n');
        }
    }

    return 0;
}

Measured memory_bytes: 2304
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(500000)

N, *A = map(int, read().split())

cnt = 1
flag = 'E'
for i, a in enumerate(A):
    if i == N - 1:
        break

    if a < A[i + 1]:
        if flag == 'D':
            cnt += 1
            flag = 'E'
        else:
            flag = 'U'
    elif a > A[i + 1]:
        if flag == 'U':
            cnt += 1
            flag = 'E'
        else:
            flag = 'D'

print(cnt)


Measured memory_bytes: 12508
#include <cstdio> 
#include <cstring>
#include <iostream>
using namespace std;
int l;
char s[100001],c[100001];
int main()
{
	cin>>s;
	l=strlen(s);
	for(int i=0;i<l;i++)
	{
		c[i]=s[l-i-1];
		if(c[i]=='q') c[i]='p';
		else if(c[i]=='p') c[i]='q';
		else if(c[i]=='b') c[i]='d';
		else if(c[i]=='d') c[i]='b';
		if(c[i]!=s[i])
		{
			cout<<"No";break;
		}
		if(i==l-1) cout<<"Yes";
	}
	return 0;
}

Measured memory_bytes: 384
#include <iostream>

using namespace std;

int main(){
    int N, A, B, C, D;
    cin >> N >> A >> B >> C >> D;
    A--;
    B--;
    C--;
    D--;
    string S;
    cin >> S;
    if(C < D){
        for(int i = A+1; i <= D; i++){
            if(S[i] == '#' && S[i-1] == '#'){
                cout << "No" << endl;
                return 0;
            }
        }
        cout << "Yes" << endl;
        return 0;
    }else{
        for(int i = A+1; i <= D; i++){
            if(S[i] == '#' && S[i-1] == '#'){
                cout << "No" << endl;
                return 0;
            }
        }
        bool f = false;
        for(int i = B+1; i <= D+1; i++){
            if(S[i] == '.' && S[i-1] == '.' && S[i-2] == '.'){
                f = true;
                break;
            }
        }
        if(f){
            cout << "Yes" << endl;
            return 0;
        }else{
            cout << "No" << endl;
            return 0;
        }
    }
}

Measured memory_bytes: 640
// #define _GLIBCXX_DEBUG
#include <bits/stdc++.h>

#define FOR(i, a, b) for (int i = (a); i < int(b); ++i)
#define RFOR(i, a, b) for (int i = (b)-1; i >= int(a); --i)
#define REP(i, n) FOR(i, 0, n)
#define REP1(i, n) FOR(i, 1, int(n) + 1)
#define RREP(i, n) RFOR(i, 0, n)
#define RREP1(i, n) RFOR(i, 1, int(n) + 1)
#define ALL(c) begin(c), end(c)

int _ = (
#ifndef LOCAL
    std::cin.tie(nullptr), std::ios::sync_with_stdio(false),
#endif
    std::cout.precision(10), std::cout.setf(std::ios::fixed));

using ll = long long;
using ull = unsigned long long;
using ld = long double;
template <typename T> using vec = std::vector<T>;
using namespace std;

int main() {
  ll N;
  cin >> N;
  vec<ll> A(N + 1), B(N);
  REP(i, N + 1) cin >> A[i];
  REP(i, N) cin >> B[i];

  ll answer = 0;
  REP(i, N) {
    if (A[i] < B[i]) {
      const ll rest = min(B[i] - A[i], A[i + 1]);
      A[i + 1] -= rest;
      answer += A[i] + rest;
    } else {
      answer += B[i];
    }
  }
  cout << answer << endl;
  return 0;
}


Measured memory_bytes: 4696
#include <iostream>

using namespace std;

int main() {
    int N, K;

    cin >> N >> K;
    long long ans = 0;
    for (int i = K + 1; i <= N; i++) {
        ans += (N / i) * (i - K);
        if (N % i >= K) {
            ans += N % i - K + 1;
            if (K == 0) ans--;
        }
        // cout << i << ": " << (N / i) * (i - K) + N % i - K + 1 << endl;
    }

    cout << ans << endl;
}

Measured memory_bytes: 256
from collections import deque


def submit():
    n = int(input())
    edges = {i: [] for i in range(n)}
    for _ in range(n - 1):
        a, b, c = map(int, input().split())
        a -= 1
        b -= 1
        edges[a].append((b, c))
        edges[b].append((a, c))
    
    q, k = map(int, input().split())
    k -= 1
    # kからの距離を求める
    dist = [-1 for _ in range(n)]
    s = deque()
    s.append((k, 0))
    while len(s):
        e, d = s.pop()
        for neignbor, cost in edges[e]:
            if dist[neignbor] < 0:
                dist[neignbor] = d + cost
                s.append((neignbor, d + cost))

    # クエリを処理
    res = []
    for _ in range(q):
        x, y = map(int, input().split())
        x -= 1
        y -= 1
        res.append(dist[x] + dist[y])

    for r in res:
        print(r)


submit()

Measured memory_bytes: 95716
#include <bits/stdc++.h>
using namespace std;
#define ll long long
const ll MOD = 1000000007;
const ll INF = 1061109567;
const double EPS = 1e-10;
int main(){
    int h,w;
    cin>>h>>w;
    string s[h];
    for(int i=0;i<h;i++){
        cin>>s[i];
    }
    for(int i=0;i<w+2;i++){
        cout<<"#";
    }
    cout<<endl;

    for(int i=0;i<h;i++){
        cout<<"#"<<s[i]<<"#"<<endl;
    }
    for(int i=0;i<w+2;i++){
        cout<<"#";
    }
    cout<<endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cstdlib>
#include <cmath>
/*
#include <fstream>
#include <sstream>
#include <iomanip>
#include <algorithm>
#include <functional>
#include <stack>
#include <queue>
#include <map>
#include <unordered_map>
#include <bitset>
#include <numeric>
#include <unordered_set>
#include <bitset>
#include <limits>
#include <random>
#include <complex>
#include <numeric>
#include <random>
#include <bits/stdc++.h>
*/

using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
//typedef vector<ll> vec;
//typedef vector<vec> mat;

const ll mod=1000000007ll;
const ll inf=1000000000000000ll;

const ll MAX_N=200010;

ll N;
ll t[MAX_N],x[MAX_N],y[MAX_N];

int main(){
  cin>>N;

  ll ax,ay;
  for(ll i=0;i<N;i++){
    cin>>t[i]>>x[i]>>y[i];
  }
  bool fl=true;
  for(ll i=0;i<N;i++){
    ax=abs(x[i]);ay=abs(y[i]);
    if(t[i]<(ax+ay) || t[i] % 2ll!=(ax+ay)%2ll){
      fl=false;
    }
  }
  if(fl)cout<<"Yes"<<endl;
  else cout<<"No"<<endl;
  return 0;
}


Measured memory_bytes: 3584
#include <bits/stdc++.h>
using namespace std;
int main(){
    int n;
    cin >> n;
    for(int i = 0; i <= n; i++){
        long double tmp = (long double)i * 1.08;
        int ttmp = tmp;
        if(ttmp==n){
            cout << i << endl;
            return 0;
        }
    }
    cout << ":(" << endl;

    return 0;
}

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

using namespace std;

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

    int count[50][26] = {};
    for (int i = 0; i < n; i++) {
        string s;
        cin >> s;

        for (int j = 0; j < s.size(); j++) {
            count[i][s[j] - 'a']++;
        }
    }
    
    for (int i = 0; i < 26; i++) {
        int minCnt = 100;
        for (int j = 0; j < n; j++) {
            minCnt = min(minCnt, count[j][i]);
        }
        for (int j = 0; j < minCnt; j++) {
            cout << char('a' + i);
        }
    }
    cout << endl;

    return 0;
}

Measured memory_bytes: 256
n, k = gets.strip.split.map(&:to_i)

result = 0
(1..n).each do |b|
  pp = n/b
  r = n%b

  result += pp * ([b-k, 0].max) + [r-k+1, 0].max
  result -= 1 if 0%b>=k
end

p result

Measured memory_bytes: 1788
#include <bits/stdc++.h>
using namespace std;
#define fi first
#define se second
const int inf = 1e9;
#define rep(i,n) for(int i = 0;i < n;i++)
#define rrep(i,n) for(int i = 1;i <= n;i++)
typedef pair<int,int> P;

queue<P> q1, q2;
char str[1004][1004];
int a[1004][1004], b[1004][1004], h, w;
int dy[] = {-1, -1, -1, 0, 0, 1, 1, 1};
int dx[] = {-1, 0, 1, -1, 1, -1, 0, 1};
bool ok(int y, int x){
	if(y < 0 || h+1 < y)return 1;
	if(x < 0 || w+1 < x)return 1;
	return 0;
}

void calc(int y, int x){
	if(b[y][x] || !a[y][x] || ok(y, x))return ;
	if(a[y][x] != inf){
		a[y][x]--;
		if(!a[y][x])q1.push(P(y, x));
		return ;
	}
	b[y][x] = 1;
	for(int i = 0;i < 8;i++){
		calc(y+dy[i], x+dx[i]);
	}
}

int solve(int k){
	if(q1.empty())return 0;
	while(!q1.empty()){
		P p = q1.front();q1.pop();
		b[p.fi][p.se] = 1;
		for(int i = 0;i < 8;i++){
			int yy = p.fi+dy[i], xx = p.se+dx[i];
			if(!b[yy][xx] && a[yy][xx] != inf && a[yy][xx] != 0){
				a[yy][xx]--;
				if(a[yy][xx] == 0)q2.push(P(yy, xx));
			}
		}
	}
	swap(q1, q2);
	return k+1;
}

int main(){
	fill((int*)a, (int*)(a+1004), inf);
	scanf("%d%d", &h, &w);
	rep(i,h)scanf("%s", str[i]);
	rep(i,h)rep(j,w){
		if(str[i][j] != '.')
		a[i+1][j+1] = str[i][j]-'0';
	}
	
	int res = 0, ans = 1;
	rrep(i,h)rrep(j,w)if(a[i][j] == inf)calc(i, j);
	while(1){
		res = solve(res);
		if(res == 0)break;
		ans = res;
	}
	printf("%d\n", ans);
	
	/*for(int i = 1;i <= h;i++){
		for(int j = 1;j <= w;j++)printf("%d ", a[i][j]);
		printf("\n");
	}*/
	return 0;
}


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

using namespace std;

const int MAX=1299709;
int prime[MAX+1]={0};//0::prime 1::NOTprime;

void hurui(){
  prime[1]=1;
  for(int i=1;i*i<=MAX;i++){
    for(int j=2;j<=MAX/i;j++){
      if(prime[i]==0)prime[i*j]=1;
    }
  }
}

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

  std::vector<int> v;
  for(int i=1;i<=MAX;i++) if(prime[i]==0)v.push_back(i);
  int n,p;
  while(true){
    cin >> n >> p;
    if(n==-1) break;
    std::vector<int> li;
    int idx=0;
    while(v[idx]<=n)idx++;
    for(int i=idx;i<idx+p;i++){
      for(int j=i;j<idx+p;j++){
          li.push_back(v[i]+v[j]);
      }
    }
    sort(li.begin(),li.end());
    cout<<li[p-1]<<endl;
  }
}

Measured memory_bytes: 8332
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vint;
typedef pair<int,int> pint;
typedef vector<pint> vpint;
#define rep(i,n) for(int i=0;i<(n);i++)
#define REP(i,n) for(int i=n-1;i>=(0);i--)
#define reps(i,f,n) for(int i=(f);i<(n);i++)
#define each(it,v) for(__typeof((v).begin()) it=(v).begin();it!=(v).end();it++)
#define all(v) (v).begin(),(v).end()
#define eall(v) unique(all(v), v.end())
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define chmax(a, b) a = (((a)<(b)) ? (b) : (a))
#define chmin(a, b) a = (((a)>(b)) ? (b) : (a))
const int MOD = 1e9 + 7;
const int INF = 1e9;
const ll INFF = 1e18;

int main(void){
	ll x, y; cin >> x >> y;
	if(abs(x-y)<=1)printf("Brown\n");
	else printf("Alice\n");
	return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;
 
public class Main{
    public Main(){
        Scanner sc = new Scanner(System.in);
         
        while(sc.hasNext()){
            String[] str = (sc.nextLine()).split(" ");
            String m = "", w = "";
             
            int i = 0, max = 0, a;
            for(String s: str){
                a = 0;
                for(String st: str){
                    if(s.equals(st)){
                        a++;
                    }
                }
                if(max < a){
                    max = a;
                    w = s;
                }
                if(s.length() > m.length()){
                    m = s;
                }
                i++;
            }
            System.out.println(w+" "+m);
        }
    }
 
    public static void main(String[] args){
        new Main();
    }
}

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

pub fn read<T: FromStr>() -> T {
  let stdin = stdin();
  let stdin = stdin.lock();
  let token: String = stdin
    .bytes()
    .map(|c| c.expect("failed to read char") as char)
    .skip_while(|c| c.is_whitespace())
    .take_while(|c| !c.is_whitespace())
    .collect();
  token.parse().ok().expect("failed to parse token")
}

use std::cmp::{max, min};
use std::collections::HashMap;

fn main() {
  let n = read::<i64>();
  let m = read::<i64>();

  if n == 1 && m == 1 {
    println!("{}", 1);
  } else if n == 1 {
    println!("{}", m - 2);
  } else if m == 1 {
    println!("{}", n - 2); 
  } else {
    let coner = 4;
    let edge = 2 * (n - 2) + 2 * (m - 2);
    println!("{}", n * m - coner - edge);
  }

}


Measured memory_bytes: 4352
#include <iostream>
#include <cmath>
#include <limits>
 
using namespace std;
int main(void){
   long long a, b, c;
   
   cin >> a >> b >> c;
   
   bool cond = (c - a - b)*(c - a - b) > 4 * a * b && (c - a - b) > 0;
   
   cout << (cond ? "Yes" : "No") << endl;
   
   return 0;
}

Measured memory_bytes: 256
def main():
    q, h, s, d = (int(x) for x in input().split())
    n = int(input())

    one_l = min(q * 4, h * 2, s)
    two_l = d

    if two_l / 2 < one_l:
        cost = (n // 2) * two_l + (n % 2) * one_l
    else:
        cost = n * one_l

    print(cost)


if __name__ == "__main__":
    main()


Measured memory_bytes: 38384
#include <bits/stdc++.h>
using namespace std;
const int N=1e5+10;
int a[N];
int main()
{
    int n,k,s;
    cin>>n>>k>>s;
        for(int i=0;i<k;++i)
            cout<<s<<" ";
        if(s<=100000)
        for(int i=0;i<n-k;++i)
            cout<<"1000000000 ";
        else for(int i=0;i<n-k;++i)
            cout<<"1 ";
    return 0;
}


Measured memory_bytes: 1280
class Dice(object):
    def __init__(self,num):
        self.f=num[0]
        self.s=num[1]
        self.e=num[2]
        self.w=num[3]
        self.n=num[4]
        self.b=num[5]
    def create(self,order):
        if order=='N':
            return [self.s,self.b,self.e,self.w,self.f,self.n]
        elif order=='S':
            return [self.n,self.f,self.e,self.w,self.b,self.s]

        elif order=='E':
            return [self.w,self.s,self.f,self.b,self.n,self.e]
        else:
            return [self.e,self.s,self.b,self.f,self.n,self.w]

    @classmethod
    def Dice_create(cls,num):
            return cls(num)
num=list(map(int,input().split()))
q=eval(input())
Q=[]
dice=Dice(num)
T={0:'N',1:'E',2:'S',3:'W'}
for i in range(q):
    Q.append(list(map(int,input().split())))
for i in range(q):
        while True:
            t=[dice.s,dice.w,dice.n,dice.e]
            if dice.f!=Q[i][0]:
                if dice.b!=Q[i][0]:#??´??¢????????¢?????\?????????
                    dice=Dice.Dice_create(dice.create(T[t.index(Q[i][0])]))
                else:#?????¢????????¢?????\?????????
                    dice=Dice.Dice_create(dice.create('N'))
            else:
                print(t[t.index(Q[i][1])-1])#?????¢?????£???????????¢?????\?????????
                break

Measured memory_bytes: 7780
import sys
import math
import copy
import itertools
from functools import lru_cache


def pythagorean(x1, x2, y1, y2):
    z = (x1 - x2) ** 2 + (y1 - y2) ** 2
    if z > 0:
        return math.sqrt(z)
    else:
        return 0

# @lru_cache()
# def route(summ, now, m, li, x, y):
#     if m == 0:
#         noww = 0
#     summm = 0
#     for g in li:
#         noww = now + pythagorean(x[m], x[g], y[m], y[g])
#         if len(li) != 1:
#             retun = summ + now
#         else:
#             lii = copy.deepcopy(li)
#             lii.remove(g)
#             summm += route(summ, noww, g, x, y)
#     return summm

n = int(sys.stdin.readline())
x = []
y = []
for _ in range(n):
    a, b  = [int(n) for n in input().split()]
    x.append(a)
    y.append(b)

summ = 0
for v in itertools.permutations(range(n)):
    noww = 0
    for nn in range(1, n):

        noww += pythagorean(x[v[nn -1]], x[v[nn]], y[v[nn -1]], y[v[nn]])
    summ += noww

print(summ / math.factorial(n))

Measured memory_bytes: 41452
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <string>
#include <vector>

using namespace std;
using ll = long long;

// inf
constexpr ll infl = 10000000000000000LL;
constexpr int inf = 1000000000;

int main() {
    string s;
    cin >> s;

    vector<int> sum(s.size());
    sum[0] = s[0] == 'S';
    for (int i = 1; i < s.size(); ++i) {
        sum[i] = s[i] == 'S';
        sum[i] += sum[i - 1];
    }
    int scnt = 0;
    for (int i = 0; i < s.size(); ++i) {
        if (s[i] == 'T' && (sum[i] - scnt) >= 1) {
            ++scnt;
        }
    }
    cout << (s.size() - scnt * 2) << endl;
    return 0;
}

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

#define FOR(i, a, b) for (int i = a; i < (int)(b); i++)
#define REP(i, n) FOR(i, 0, n)
const int inf = 1e9;

template <typename T = int>
inline T in() {
  T x;
  cin >> x;
  return x;
}
template <typename T, typename U>
inline bool chmin(T& x, U y) {
  return y <= x && (x = y, 1);
}
struct Edge {
  int from, to, cost;
  Edge(int from, int to, int cost) : from(from), to(to), cost(cost) {}
  bool operator<(const Edge& rhs) const {
    if (cost != rhs.cost) return cost > rhs.cost;
    if (from != rhs.from) return from < rhs.from;
    return to < rhs.to;
  }
};
using Graph = vector<vector<Edge>>;

int main() {
  int N = in(), R = in();
  Graph g(N);
  REP(i, R) {
    int s = in() - 1, t = in() - 1, d = in();
    g[s].emplace_back(s, t, d);
    g[t].emplace_back(t, s, d);
  }
  vector<vector<int>> mdist(N, vector<int>(N, inf));
  vector<vector<vector<int>>> mpre(N, vector<vector<int>>(N));

  vector<pair<int, int>> cand;
  int maxi = -inf;
  REP(v, N) {
    auto& dist = mdist[v];
    auto& pre = mpre[v];
    dist[v] = 0;
    priority_queue<Edge> pq;
    pq.emplace(-1, v, 0);
    while (not pq.empty()) {
      auto e = pq.top();
      pq.pop();
      if (e.cost > dist[e.to]) continue;
      pre[e.to].push_back(e.from);
      if (pre[e.to].size() > 1) continue;
      for (auto&& ee : g[e.to]) {
        int nxtc = ee.cost + e.cost;
        if (chmin(dist[ee.to], nxtc)) { pq.emplace(ee.from, ee.to, nxtc); }
      }
    }
    FOR(u, v + 1, N) {
      if (dist[u] < maxi) continue;
      if (dist[u] > maxi) cand.clear();
      maxi = dist[u];
      cand.emplace_back(v, u);
    }
  }
  vector<bool> used(N, false);
  for (auto&& st : cand) {
    int s = st.first;
    int t = st.second;
    auto& pre = mpre[s];
    vector<bool> vis(N, false);
    vis[t] = true;
    queue<int> Q;
    Q.emplace(t);
    while (not Q.empty()) {
      int v = Q.front();
      Q.pop();
      for (int u : pre[v]) {
        if (u < 0) continue;
        if (vis[u]) continue;
        vis[u] = true;
        Q.push(u);
      }
    }
    REP(i, N) used[i] = used[i] || vis[i];
  }
  vector<int> ans;
  REP(i, N) {
    if (used[i]) continue;
    ans.push_back(i + 1);
  }
  cout << ans.size() << endl;
  for (int v : ans) {
    cout << v << endl;
  }
  return 0;
}

Measured memory_bytes: 143820
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <stdbool.h>
#include <math.h>

int max(int x, int y)
{
    if (x>=y) return x;
    else return y;
}

int main()
{
    int a, b, c, k;
    scanf("%d%d%d", &a, &b, &c);
    scanf("%d", &k);
    int maxm = 0;
    maxm = max(a, max(b,c));
    int tmp = maxm;
    for (int i=1; i<=k; i++)
    {
        maxm *= 2;
    }
    int ans = a + b + c + maxm - tmp;
    printf("%d\n", ans);
    return 0;
}


Measured memory_bytes: 128
#define _USE_MATH_DEFINES
#include<iostream>
#include<string>
#include<cmath>
#include<queue>
#include<map>
#include<set>
#include<list>
#include<iomanip>
#include<vector>
#include<random>
#include<functional>
#include<algorithm>
#include<cstdio>
#include<unordered_map>
using namespace std;
//---------------------------------------------------
//ライブラリゾーン！！！！
typedef long long ll;
typedef long double ld;
#define str string
#define rep(i,j) for(ll i=0;i<(long long)(j);i++)
const ll Mod = 1000000007;
const ll gosenchou = 5000000000000000;
short gh[2][4] = { { 0,0,-1,1 },{ -1,1,0,0 } };
struct P {
	ll pos, cost;
};
bool operator<(P a, P b) { return a.cost < b.cost; }
bool operator>(P a, P b) { return a.cost > b.cost; }
struct B {//隣接リスト表現
	ll to;
	ld cost;
};
struct E {//辺の情報を入れる変数
	ll from, to, cost;
};
bool operator<(E a, E b) {
	return a.cost < b.cost;
}
struct H {
	ll x, y, h;
};
bool operator<(H a, H b) {
	if (a.x != b.x) return a.x < b.x;
	return a.y < b.y;
}
bool operator>(H a, H b) {
	if (a.x != b.x) return a.x > b.x;
	return a.y > b.y;
}
bool operator==(H a, H b) {
	return a.x == b.x&&a.y == b.y;
}
bool operator!=(H a, H b) {
	return a.x != b.x || a.y != b.y;
}
ll gcm(ll i, ll j) {//最大公約数
	if (i > j) swap(i, j);
	if (i == 0) return j;
	return gcm(j%i, i);
}
ld rad(H a, H b) {
	return sqrt(pow(a.x - b.x, 2.0) + pow(a.y - b.y, 2.0));
}//rad＝座標上の2点間の距離
ll ari(ll a, ll b, ll c) {
	return (a + b)*c / 2;
}//等差数列の和
bool suf(ld a, ld b, ld c, ld d) {
	if (b <= c || d <= a) return 0;
	return 1;
}//[a,b),[c,d)
ll fact(ll x, ll k) {//最大値、個数
	ll sum = 1;
	for (int i = 0; i < k; i++)
		sum *= (x--);
	return sum;
}//階乗(正）
ll mod_pow(ll x, ll n, ll p) {
	ll res = 1;
	while (n > 0) {
		if (n & 1) res = res*x%p;
		x = x*x%p;
		n >>= 1;
	}
	return res;
}
#define int long long
const long long inf = 4523372036854775807;
const int iinf = 1500000000;
//----------------------------------------------------
//++++++++++++++++++++++++++++++++++++++++++++++++++++
signed main() {
	string s;
	cin >> s;
	for (int i = 0; i < 4; i++)
		cout << s[i];
	cout << " ";
	for (int i = 4; i < 12; i++)
		cout << s[i];
	cout << endl;
	getchar(); getchar();
}

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

int asc(const void *a, const void *b) {
  return *(int *)a - *(int *)b;
}

int main() {
	int n;
	ll cnt = 0, max = 0;
	string t;
	cin >> n;
	map<string, int> s;
	rep(i, n){
		cin >> t;
		sort(t.begin(), t.end());
		s[t]++;
		cnt += s[t]-1;
	}
	if(max < cnt) max = cnt;
	cout << cnt << endl;
}

Measured memory_bytes: 11136
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define INF 1000000000000000000
#define MOD 1000000007
typedef pair<int, int> P;

bool prime(int n) {
	for (int i = 2; i <= sqrt(n); i++) {
		if (n % i == 0)return false;
	}
	return n != 1;
}
int gcd(int x, int y) {
	if (y == 0)return x;
	return gcd(y, x % y);
}
int lcm(int x, int y) {
	return x / gcd(x, y) * y;
}
int mod_pow(int n, int p, int m) {
	if (p == 0) return 1;
	if (p % 2 == 0) {
		int t = mod_pow(n, p / 2, m);
		return (t * t) % m;
	}
	return n * mod_pow(n, p - 1, m) % m;
}
int extGCD(int a, int b, int& x, int& y) {
	if (b == 0) {
		x = 1;
		y = 0;
		return a;
	}
	long long d = extGCD(b, a % b, y, x);
	y -= a / b * x;
	return d;
}
int modinv(int a, int m) {
	int b = m, u = 1, v = 0;
	while (b) {
		long long t = a / b;
		a -= t * b; swap(a, b);
		u -= t * v; swap(u, v);
	}
	u %= m;
	if (u < 0) u += m;
	return u;
}
int digit(int x) {
	int cnt = 0;
	while (x > 0) {
		cnt += x % 10;
		x /= 10;
	}
	return cnt;
}

signed main() {
	int m, n;
	cin >> m >> n;
	int a[100005];
	rep(i, n) {
		cin >> a[i];
	}
	int cnt = 0;
	if (m == 2) {
		int ans1 = 0, ans2 = 0;
		rep(i, n) {
			if (i % 2 == 0) {
				if (a[i] == 1) ans2++;
				else ans1++;
			}
			else {
				if (a[i] == 1) ans1++;
				else ans2++;
			}
		}
		cout << min(ans1, ans2) << endl;
		return 0;
	}
	for (int i = 1; i < n; i++) {
		if (a[i] == a[i - 1]) {
			cnt++;
			a[i] = 0;
		}
	}
	cout << cnt << endl;

	return 0;
}



Measured memory_bytes: 3884
#include <bits/stdc++.h>
using namespace std;
struct Fast {Fast(){std::cin.tie(0);ios::sync_with_stdio(false);cout.precision(20);}} fast;

/* define */
#define FOR(I,X,Y) for(long long (I)=(X);(I)<(Y);(I)++)
#define REP(I,X,Y) for(long long (I)=(Y)-1;(I)>=(X);(I)--)
#define ALL(X) (X).begin(),(X).end()
#define pb push_back
#define COUNT(V,X) (upper_bound((V).begin(),(V).end(),X)-lower_bound((V).begin(),(V).end(),X))
#define debug(x) cerr<<#x<<':'<<x<<endl;
#define DEBUG(v) cerr<<#v<<':';for(auto xXx:v)cerr<<xXx<<' ';cerr<<endl;
#define Yes(X) if(X){cout<<"Yes"<<endl;}else{cout<<"No"<<endl;}
#define YES(X) if(X){cout<<"YES"<<endl;}else{cout<<"NO"<<endl;}
#define ctoi(C) (C-'0')
#define pow2(x) ((long long)((long long)1<<x))

/* alias */
using ll = long long;
using ld = long double;
using vi = vector<int>;
using vii = vector<vector<int>>;
using vl = vector<long long>;
using vll = vector<vector<long long>>;
using pi = pair<int,int>;
using pl = pair<long long,long long>;
template<typename T> using PQ = priority_queue<T>;
template<typename T> using minPQ = priority_queue<T, vector<T>, greater<T>>;

/* const */
const long long dx[] = {1,0,-1,0};
const long long dy[] = {0,1,0,-1};
const long long dx8[] = {1,1,0,-1,-1,-1,0,1};
const long long dy8[] = {0,1,1,1,0,-1,-1,-1};
const long long dx9[] = {1,1,0,-1,-1,-1,0,1,0};
const long long dy9[] = {0,1,1,1,0,-1,-1,-1,0};
const int INF = 1000000007;
const long long LINF = 1000000000000000007;

/* func */
template <typename T> inline bool chmin(T& a, const T& b) {if (a > b) a = b; return a > b;}
template <typename T> inline bool chmax(T& a, const T& b) {if (a < b) a = b; return a < b;}
long long max(long long x,int y){return max(x,(long long)y);}
long long max(int x,long long y){return max((long long)x,y);}
long long min(long long x,int y){return min(x,(long long)y);}
long long min(int x,long long y){return min((long long)x,y);}

/* liblary */



/* main */

signed main(){
    ll X,Y,Z,K;
    cin >> X >> Y >> Z >> K;
    vl A(X),B(Y),C(Z);
    FOR(i,0,X)cin >> A[i];
    FOR(i,0,Y)cin >> B[i];
    FOR(i,0,X)cin >> C[i];
    vl ans1;
    FOR(i,0,X)FOR(j,0,Y){
        ans1.push_back(A[i] + B[j]);
    }
    sort(ALL(ans1));
    reverse(ALL(ans1));
    vl ans2;
    FOR(i,0,min(K,ans1.size()))FOR(j,0,Z){
        ans2.push_back(ans1[i] + C[j]);
    }
    sort(ALL(ans2));
    reverse(ALL(ans2));
    FOR(i,0,K){
        cout << ans2[i] << endl;
    }
}

Measured memory_bytes: 43240
#include <iostream>
#include <vector>
#include <set>
#include <algorithm>
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;
typedef pair<int,int> P;

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

Measured memory_bytes: 256
n, k = map(int, input().split())
mod = 10**9 + 7

ans = 0
for i in range(k, n+2): 
    a = 0.5 * i * (i - 1)
    b = 0.5 * i * (2 * n - i + 1)
    ans += (b - a + 1)
print(int(ans % mod))

Measured memory_bytes: 9192
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
//1-2-3-4-5
//b-2-3-4-w
//b-b-b-w-w b
  
//1-Nの最短距離をお互いとりあう
//くっついたときに、お互いの陣地をカウント
//DFSでサイズ測れそう
//1からNまでDFSで、Nにいたったら深さをおさえておく
//Nまでの経路を知りたい･･･どうしよう
//1個前の親を記録しておくか
//1が根
//1-2-3-N //2マスうめ、wは3から2以外の方向へのサイズ、 bは2から3以外の方向へのサイズ
//1-2-3-4-N// 3マスうめ w4 b3
//1-2-3-4-5-N // 4 w3 b4vector<vector<ll>> G;
//
vector<bool> seen;
vector<vector<ll>> G;
struct UnionFind{
  vector<ll> par,siz;
  
  UnionFind(ll N):par(N+1),siz(N+1,1){
    for(int i=0; i<=N; i++)
      par[i]=i;
  }
  
  void mkpar(ll n){
    for(auto next_n: G[n]){
      if(seen[next_n]) continue;
      seen[next_n]=true;
      par[next_n]=n;
      mkpar(next_n);
    }
  }
  
  ll root(ll x){
    if(par[x]==x)
      return x;
    return par[x]=root(par[x]);
  }
  
  void unite(ll x, ll y){
    ll rx=root(x), ry=root(y);
    if(rx==ry)
      return;
    par[ry]=rx;
    siz[rx]+=siz[ry];    
  }
  
  bool issame(ll x, ll y){
    return root(x)==root(y);
  }
  
  ll size(ll x){
    return siz[root(x)];
  }
};

void dfs(ll n){
  for(auto next_n:G[n]){
    if(seen[next_n]) continue;
    seen[next_n]=true;
    dfs(next_n);
  }
}

int main(){
  ll N; cin>>N;
  ll wsize=-1,bsize=-1;
  G.assign(N+1, vector<ll>());
  seen.assign(N+1,false);
  for(int i=0; i<N-1; i++){
    ll a,b; cin>>a>>b;
    G[a].emplace_back(b);
    G[b].emplace_back(a);
  }
  UnionFind tree(N);
  seen[1]=true;
  tree.mkpar(1);
  ll cnt=-1, n=N;
  while(n!=1){
    n=tree.par[n];
    cnt++;
  }
  n=N;
  ll wpos=cnt/2;
  while(wpos>0){
    n=tree.par[n];
    wpos--;
  }
  ll w=n,b=tree.par[n];
  seen.assign(N+1,false); seen[b]=true; dfs(w);
  for(int i=1; i<=N; i++) if(seen[i]) wsize++;
  seen.assign(N+1,false); seen[w]=true; dfs(b);
  for(int i=1; i<=N; i++) if(seen[i]) bsize++;
  //3 2=F
  //2 2=S
  //3 4=S
  if(bsize>wsize) cout<<"Fennec"<<endl;
  else cout<<"Snuke"<<endl;
}

Measured memory_bytes: 10112
#include<stdio.h>
#include<math.h>
 
int main( void )
{
 
        int a,i,j;
        scanf("%d",&a);
        double x[a],y[a],z[3],b=0,c=0;
        for(i=0;i<a;i++){
            scanf("%lf",&x[i]);
        }
        for(i=0;i<a;i++){
            scanf("%lf",&y[i]);
        }
        for(i=0;i<3;i++){
            for(j=0;j<a;j++){
                z[i]+=fabs(pow((x[j]-y[j]),i+1));
            }
        }
        for(i=0;i<a;i++){
            b=fabs(x[i]-y[i]);
            if(b>c)c=b;
        }
        printf("%lf\n",z[0]);
        printf("%lf\n",sqrt(z[1]));
        printf("%lf\n",pow(z[2],1.0/3.0));
        printf("%lf\n",c);
         
    return 0;
}

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

typedef long long ll;
typedef long double ld;

typedef pair<int, int> p;

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

    int N, ma, mb;
    cin >> N >> ma >> mb;

    vector<int> a(N);
    vector<int> b(N);
    vector<int> c(N);

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

    vector<vector<vector<int> > > v(N, vector<vector<int> >(401, vector<int>(401, 10000)));

    v[0][0][0] = 0;
    v[0][a[0]][b[0]] = c[0];

    for(int i = 1; i < N; i++) {
        for(int j = 0; j <= 400; j++) {
            for(int k = 0; k <= 400; k++) {
                v[i][j][k] = v[i - 1][j][k];
            }
        }
        for(int j = 0; j < 400; j++) {
            int as = j + a[i];
            if(as > 400) break;
            for(int k = 0; k < 400; k++) {
                int bs = k + b[i];
                if(bs > 400) break;
                v[i][as][bs] = min(v[i][as][bs], c[i] + v[i - 1][j][k]);
            }
        }
    }

    int ans = 10000;

    for(int i = 1; i <= 400; i++) {
        int as = ma * i;
        int bs = mb * i;
        if(as > 400 || bs > 400) break;
        ans = min(ans, v[N - 1][as][bs]);
    }

    if(ans >= 10000) {
        cout << -1 << endl;
        return 0;
    }

    cout << ans << endl;
}

Measured memory_bytes: 26624
#include <cstdio>
#include <algorithm>
#include <iostream>
int w[100];
int sum[100];
int main() {
 	int n;
    scanf("%d", &n);
    scanf("%d", &w[0]);
    sum[0] = w[0];
    for (int i = 1; i < n; ++i) {
        scanf("%d", &w[i]);
        sum[i] = sum[i - 1] + w[i];
    }
    int want = sum[n - 1] / 2;
    if (sum[0] > want) {
        printf("%d\n", sum[0] - (sum[n - 1] - sum[0]));
        return 0;
    }
    bool is_less = true;
    int ans = sum[n - 1] - sum[0] - sum[0];
    for (int i = 0; i < n; ++i) {
        if (sum[i] == want) {
            printf("%d\n", sum[n - 1] - want - want);
            break;
        }
        else if (sum[i] > want) {
            ans = std::min(ans, sum[i] - (sum[n - 1] - sum[i]));
            printf("%d\n", ans);
            return 0;
        }
        else {
            ans = sum[n - 1] - sum[i] - sum[i];
        }
    }
  	return 0;
}

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

using namespace std;

#define FOR(i, m, n) for (int i = m; i < n; ++i)
#define FORD(i, m, n) for (int i = m; i >= n; --i)
#define REP(i, n) for (int i = 0; i < n; ++i)
#define REP1(i, n) for (int i = 0; i <= n; ++i)
#define REPR(i, n) for (int i = n; i >= 0; --i)
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))

using ll = long long;
using ull = unsigned long long;
using ld = long double;

int main()
{
	cin.tie(0);
	ios::sync_with_stdio(false);
	
	string s;
	cin>>s;
	int len=s.length();
	int sum=0;
	REP(i,len)sum+=s[i]-'0';
	if(sum%9==0)cout << "Yes" << endl;
	else cout << "No" << endl;

	return 0;
}


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

#include <boost/range/adaptors.hpp>
#include <boost/range/irange.hpp>

using namespace std;
using namespace boost;
using namespace boost::adaptors;

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

    vector<int64_t> a(n);
    for (auto i : irange(0L, n)) {
        cin >> a[i];
    }

    vector<int64_t> s(n + 1);
    for (auto i : irange(0L, n)) {
        s[i + 1] = s[i] + a[i];
    }

    int64_t ans = numeric_limits<int64_t>::max();
    for (auto i : irange(1L, n - 2)) {
        auto sl = s[i + 1];
        auto sr = s[n] - sl;

        auto it = upper_bound(s.begin(), s.end(), sl / 2);
        auto ssl = *it;
        if ((sl - *(it - 1)) - *(it - 1) < ssl - (sl - ssl)) {
            ssl = *(it - 1);
        }

        auto it2 = upper_bound(s.begin(), s.end(), sl + sr / 2);
        auto ssr = *it2 - sl;
        if ((sr - (*(it2 - 1) - sl)) - (*(it2 - 1) - sl) < ssr - (sr - ssr)) {
            ssr = *(it2 - 1) - sl;
        }

        auto ma = max({ssl, sl - ssl, ssr, sr - ssr});
        auto mi = min({ssl, sl - ssl, ssr, sr - ssr});

        ans = min({ans, ma - mi});
    }

    cout << ans << endl;
}

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

#define ll long long
#define all(x) (x).begin(), (x).end()
const long long INF = 1LL << 60;

#define rep(i, n) for (int i = 0; i < (int)(n); i++)  //(i, 10) i=0～i=9まで
#define repr(i, n) for (int i = n; i >= 0; i--)   // (i, 10) i=10～i=0まで
#define FOR(i, m, n) for (int i = m; i < n; i++)  // (i, 3, 10) i=3～i=9まで

// 総数を1000000007で割った余り
const long long mod = 1e9 + 7;

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

    // 入力
    int a, b, c;
    cin >> a >> b >> c;

    // 処理
    // 出力
    cout << min({a + b, a + c, b + c}) << endl;

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
  int N,ans = 0;
  cin >> N;
  vector<int> A1(N),A2(N);
  for(int i = 0;i < N;i++)cin >> A1[i];
  for(int i = 0;i < N;i++)cin >> A2[i];
  for(int i = 0;i < N;i++){
    ans = max(ans,accumulate(A1.begin(),A1.begin() + i + 1,0)+accumulate(A2.begin()+i,A2.end(),0));
  }
  cout << ans << endl;
}


Measured memory_bytes: 256