akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;

int main() {
  long long h,w,a;
  cin >> h >> w;
  if (h%2==1 && w%2==1)
    a=h*w/2+1;
  if (h%2==0 && w%2==1)
    a=h/2*w;
  if (w%2==0 && h%2==1)
    a=w/2*h;
  if (h%2==0 && w%2==0)
    a=h/2*w;
  if (h==1 || w==1)
    a=1;
  cout << a << endl;
}

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

#define lli long long int
#define ld long double
#define MAX_L lli max = 9000000000000000000;
#define MIN_L lli min = 9000000000000000000;
#define MAX_D ld max = 4500;
#define MIN_D ld min = -4500;
#define LLI(n) \
  lli n;       \
  cin >> n;
#define LD(n)  \
  ld n;        \
  cin > n;
#define LLIV(a, n)            \
  vector<lli> a(n);           \
  for (lli i = 0; i < n; i++) \
  {                           \
    cin >> a.at(i);           \
  };
#define LDV(a, n)            \
  vector<ld> a(n);           \
  for (lli i = 0; i < n; i++) \
  {                           \
    cin >> a.at(i);           \
  };
#define STR(n) \
  string n;    \
  cin >> n;
#define sum(n) accumulate(n.begin(), n.end(), 0);
#define Sort(n) sort(n.begin(), n.end());
#define Reve(n) reverse(n.begin(), n.end());
#define yes cout << "Yes" << endl;
#define no cout << "No" << endl;
#define C45(n) (n + 1) / 2
#define OUT(n) cout << n << endl;
#define SRC(n, c)                    \
  for (lli i = 0; i < s.size(); i++) \
  {                                  \
    if (s.at(i) == c)                \
    {                                \
      n++;                           \
    }                                \
  };
//こぴー
/*#define ZISYO(s, S)                  \
  for (lli i = 0; i < s.size(); i++) \
  {                                  \
    S.at(i) = s.at(i);               \
  }                                  \
  Sort(S) Reve(S) for (lli i = 0; i < s.size(); i++) { s.at(i) = S.at(i); };
*/

//素数
bool IsPrime(lli num)
{
  if (num < 2)
    return false;
  else if (num == 2)
    return true;
  else if (num % 2 == 0)
    return false;
  long double sqrtNum = sqrt(num);
  for (lli i = 3; i <= sqrtNum; i += 2)
  {
    if (num % i == 0)
      return false;
  }
  return true;
}
//各桁の和
lli KSum(lli n)
{
  lli sum = 0;
  if (n < 0)
    return 0;
  while (n > 0)
  {
    sum += n % 10;
    n /= 10;
  }
  return sum;
}

int main(void)
{
  ios::sync_with_stdio(false);
  STR(s)
  for(lli i = 0;i < s.size();i = i + 2) {
    cout << s[i];
  }
  cout << endl;
}


Measured memory_bytes: 592
#-*-coding:utf-8-*-

import sys

def main():
    fruit_list=[]
    n,m = map(int,input().split())
    fruit_list= [int(i) for i in input().split()]
    fruit_list=sorted(fruit_list)
    print(sum(fruit_list[:m]))

if __name__ == "__main__":
    main()

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

char in[120];
pair<pair<string,int>,int> p[110];
int main(){
  int a;scanf("%d",&a);
  for(int i=0;i<a;i++){
    int t;scanf("%s%d",in,&t);
    string tmp=in;
    p[i]=make_pair(make_pair(in,-t),i);
  }
  std::sort(p,p+a);
  for(int i=0;i<a;i++)printf("%d\n",p[i].second+1);
}

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


using namespace std;
vector<int>ans;


int main(){
	int count = 0;
	while (1){
		int n;
		cin >> n;
		int half = n / 2;
		if (n == 0)break;
		count++;
		const int low_ans = (1 << half) - 1,up_ans=(1<<(n-half))-1;
		vector<unsigned long long int>sk;
		vector<unsigned long long int>upper;
		vector<unsigned long long int>lower;
		for (int i = 0; i < n; i++){
			sk.push_back(0);
			int m;
			cin >> m;
			for (int j = 0; j < m; j++){
				int temp;
				cin >> temp;
				sk[i] |= (1 << temp);
			}
			if (i < half)
				lower.push_back(1 << i),upper.push_back(0);
			else lower.push_back(0), upper.push_back(1 << (i - half));
		}


		int i;
		for (i = 1; i <= 30; i++){
			unsigned long long int check = 1 << i;
			unsigned long long int low = 0,up=0;
			for (int j = 0; j < n; j++)
			if (check&sk[j])
				low |= lower[j],up|=upper[j];
			for (int j = 0; j < n; j++)
			if (check&sk[j])
				lower[j]=low,upper[j]=up;
			if (low==low_ans&&up==up_ans)break;
		}
		if (i == 31)
			i = -1;
		ans.push_back(i);

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


	return(0);
}

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

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

using namespace std;


 
int main(){
    ll n;
    cin >> n;
    vector<ll> a(n);
    rep(i, n)   cin >> a[i];

    list<ll> res;
    if(n%2 == 0){
        rep(i, n/2){
            res.push_back(a[2*i]);
            res.push_front(a[2*i+1]);
        }
    }
    else{
        rep(i, n/2){
            res.push_front(a[2*i]);
            res.push_back(a[2*i+1]);
        }
        res.push_front(a[n-1]);
    }


    string pt = "";
    for(auto iter = res.begin(); iter != res.end(); iter++){
        cout << pt << *iter;
        pt = " ";
    }

    cout << endl;

 
    return 0;
}

Measured memory_bytes: 9984
#include <bits/stdc++.h>
#define sz(x) (int)((x).size())
#define mp make_pair
#define pb push_back
#define F first
#define S second
#define FOR(i, a, n, step) for (int (i) = (a); (i) < (int)(n); (i) += (step))
#define ROF(i, a, n, step) for (int (i) = (a); (i) >= (int)(n); (i) -= (step))
#define FOREACH(it, v) for (auto (it) : (v))

using namespace std;

typedef unsigned long long ull;
typedef long long ll ;
typedef long double ld;
typedef pair <int, int> pii;

template <class T>
const bool is_impar(const T &x) {return (bool) (x & 1);}

int n, m, rez;
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cin >> n >> m;
    if (n == m)
        return !(cout << 1);
    for (int i = 1; i * i <= m; i++)
        if (!(m % i) && n <= i)
            rez = max(rez, m / i);
        else if (!(m % i) && n <= m / i)
            rez = max(rez, i);
    cout << rez;
}


Measured memory_bytes: 256
#include <algorithm>
#include <cstdlib>
#include<iostream>
#include<vector>
#include<map>
#include<cmath>
using namespace std;
int H,W;
bool is_there_black(const vector<char>& a){
        for(int i=0;i<a.size();i++)
        {
        if(a[i]=='#') return true;
        }
    return false;
}

int main(int argc, char const *argv[])
{
    cin>>H>>W;
    vector<vector<char>> a(H,vector<char>(W));
    vector<vector<char>> b(W,vector<char>(H));
    vector<bool> having_black_raw(H,false);
    vector<bool> having_black_col(W,false);

    for(int h=0;h<H;h++){
        for(int w=0;w<W;w++){
            cin>>a[h][w];
        }
    }
    
    for(int h=0;h<H;h++){
        for(int w=0;w<W;w++){
            b[w][h]=a[h][w];
        }
    }
    for(int h=0;h<H;h++){
        having_black_raw[h]=is_there_black(a[h]);
    }
    for(int w=0;w<W;w++){
        having_black_col[w]=is_there_black(b[w]);
    }
    
    for(int h=0;h<H;h++){
        bool flag=false;
        for(int w=0;w<W;w++){
            if(having_black_raw[h]&&having_black_col[w]){
                cout<<a[h][w];
                flag=true;
            }
        }
        if(flag) cout<<endl;
    }
return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using i64 = long long;

int dp[100010][3];

int main() {
    int n, k, r, p, s;
    std::string t;
    std::cin >> n >> k >> r >> s >> p >> t;
    std::vector<int> v(1000);
    v['s'] = r;
    v['p'] = s;
    v['r'] = p;
    int ret = 0;
    std::vector<int> w(n, 1);
    for (int i = 0; i < n; i++) {
        if (i < k || t[i] != t[i - k]) ret += v[t[i]];
        else {
            if (w[i - k] % 2 == 0) ret += v[t[i]];
            w[i] = w[i - k] + 1;
        }
    }

    std::cout << ret << std::endl;

    return 0;
}


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

using namespace std;

int main(void) {
    long int n, k, a, de;
    long int ans = 1000000000000000001;
    vector<int> acc;

    cin >> n >> k;

    acc.push_back(n);

    
    while(!(ans == 0)){
        if(n >= k){
            de = n / k;
            a = abs(n - (k * de));

            ans = min(ans, a);
            acc.push_back(a);
            n = a;
            
        }
        else{
            a = abs(n - k);
            if(ans < a){
                break;
            }
            ans = min(ans, a);
            acc.push_back(a);
            n = a;
        }
    }
    //OUT:

    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>

int main()
{
   using namespace std;

   int N, M, C;
   int source = 0;
   int solved = 0;
   
   cin >> N >> M >> C;

   int *B = new int[M];

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

   int **A = new int*[N];

   for(int i=0;i<N;i++){
      A[i] = new int[M];
      for(int j=0;j<M;j++){
         cin >> A[i][j];
         source += A[i][j] * B[j];
      }
      if(source + C > 0) solved++;
      source = 0;
   }

   cout << solved << endl;

   return 0;   
}


Measured memory_bytes: 256
A = int(input())
B = int(input())
C = int(input())
X = int(input())
N = 0
for i in range(A+1):
	for n in range(B+1):
		for p in range(C+1):
			sum = 500*i + 100*n + 50*p
			if sum == X:
				N = N+1
print(N)

Measured memory_bytes: 3060
using System;
using System.Linq;
using System.Collections.Generic;
using System.IO;

public class Program
{

    public static void Main()
    {
        string[] n = new string[2];
        n[0] = Console.ReadLine();
        n[1] = Console.ReadLine();

        string ans = "";
        if (n[0] == n[1]) ans = "EQUAL";
        else
        {
            if (n[0].Length > n[1].Length) ans = "GREATER";
            else if (n[0].Length < n[1].Length) ans = "LESS";
            else
            {
                char[] a = n[0].ToCharArray();
                char[] b = n[1].ToCharArray();
                for (int i = 0; i < n[0].Length; i++)
                {
                    if (a[i] == b[i]) continue;
                    else if (int.Parse(a[i].ToString()) > int.Parse(b[i].ToString())) { ans = "GREATER"; break; }
                    else if (int.Parse(a[i].ToString()) < int.Parse(b[i].ToString())) { ans = "LESS"; break; }
                }
            }
        }
        Console.WriteLine(ans);
    }

    static int[] s_to_i(string[] s)
    {
        int[] ret = Array.ConvertAll<string, int>(s, delegate (string value) { return int.Parse(value); });
        return ret;
    }
}

Measured memory_bytes: 13140
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>

using namespace std;

typedef long long ll;

int main(){

	ll z;
	while(cin>>z&&z!=0){
		const ll zzz=(ll)(pow(z*1.0,3)+0.00001);
		ll maxNum=0;
		for(ll i = 1; i < z; i++){
			ll prv=(ll)(pow((double)i,3)+0.00001);
			for(ll j = 1; j < z; j++){
				ll nxt=(ll)(pow((double)j,3)+0.00001);
				if(nxt+prv>zzz)
					break;
				maxNum=max(maxNum,nxt+prv);
			}
		}
		cout<<zzz-maxNum<<endl;
	}

	return 0;
}

Measured memory_bytes: 860
#include<cstdio>
#include<algorithm>
#include<vector>
#include<string>
#include<iostream>
#include<queue>
#include<map>
#include<set>
#include<complex>
#include<stack>
#include<cmath>

using namespace std;

#define reps(i,f,n) for(int i=f;i<int(n);i++)
#define rep(i,n) reps(i,0,n)


#define X real()
#define Y imag()
typedef complex<double> P;

int main(){
	
	int m[13]={0,31,29,31,30,31,30,31,31,30,31,30,31};
	string s[7]={"Wednesday","Thursday","Friday","Saturday","Sunday","Monday","Tuesday"};
	while(1){
		int a,b;
		cin>>a>>b;
		if(a==0)break;
		
		int sum = 0;
		rep(i,a)sum+=m[i];
		sum += b;
		
		cout<<s[sum%7]<<endl;
	}
}

Measured memory_bytes: 1196
#include <iostream>
#include <set>
#include <algorithm>
using namespace std;
int main(){
    int n;
    cin >> n;
    int loc[n+1];
    int t;
    for(int i = 0;i<n;i++){
        cin >> t;
        loc[t]=i;
    }
    multiset<int> upper = {-1,-1,n,n};
    long long ans = 0;
    long long tmp[4];
    for(int i = n;i>=1;i--){
        auto itr = upper.upper_bound(loc[i]);
        itr++;
        for(int j = 0;j<4;j++){
            tmp[j] = *itr;
            itr--;
        }
        ans+=i*((tmp[1]-loc[i])*(tmp[2]-tmp[3])+(loc[i]-tmp[2])*(tmp[0]-tmp[1]));
        upper.insert(loc[i]);
    }
    cout << ans << endl;
}

Measured memory_bytes: 5376
#include<bits/stdc++.h>
#define Imposter ios_base::sync_with_stdio(false);cin.tie(NULL);
#define pb push_back
#define ll long long int
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#pragma GCC optimize("O3")
using namespace __gnu_pbds;
#define ordered_set tree<ll, null_type,less_equal<ll>, rb_tree_tag,tree_order_statistics_node_update>//s.order_of_key(val) *s.find_by_order(ind)
using namespace std;
#define f(n) for(ll i=0;i<n;i++)
#define rep(i,a,b) for(i=a;i<b;i++)
#define input(arr,n) for(ll i1=0;i1<n;i1++ )cin>>arr[i1]
#define vll vector<ll>
#define vlll vector<vll>
#define all(x) x.begin(),x.end()
#define N 1000005 
ll power(ll x, ll y, ll p) { 
    ll res = 1;    x = x % p;  
    while(y > 0) {
        if(y & 1) res = (res*x) % p; 
        y = y>>1;    x = (x*x) % p; 
    } return res; 
}
ll a[2002],dp[2002][2002];
ll maxprofit(int begin,int end,int n)
{
    if(dp[begin][end]!=-1)
    return dp[begin][end];
    int year=n-(end-begin);
    if(begin==end)
    return year*a[begin];
    ll x=a[begin]*year + maxprofit(begin+1,end,n);
    ll y=a[end]*year + maxprofit(begin,end-1,n);
    ll ans=max(x,y);
    dp[begin][end]=ans;
    return ans;
    
}
ll maximum(int n)
{
    f(n)
    {
        for(int j=0;j<n;j++)
        dp[i][j]=-1;
    }
    ll ans=maxprofit(0,n-1,n);
    return ans;
}
int main()
{
    Imposter
    
    ll n,m,k;
    cin>>n>>m>>k;
    ll a[n+1],b[m+1];
    for(int i=1;i<=n;i++)
    {
        ll x;
        cin>>x;
        if(i==1)
        a[1]=x;
        else
        a[i]=x+a[i-1];
        //cout<<a[i]<<" ";
    }
    
    for(int i=1;i<=m;i++)
    {
        ll x;
        cin>>x;
        if(i==1)
        b[1]=x;
        else
        b[i]=x+b[i-1];
    }
    a[0]=b[0]=0;
    //find maximum (i+j)==k
    ll j=m,ans=0;
    for(int i=0;i<=n;i++)
    {
        if(a[i]>k)
        break;
        while(b[j]>k-a[i])
        {j--;}
        ans=max(ans,i+j);
        //cout<<ans<<" "<<a[i]<<" "<<j<<endl;
    }
    cout<<ans<<endl;
    
    return 0;
}

Measured memory_bytes: 6768
#include<stdio.h>
int main(void) {
	int n;
	int red, blue;
	char str[200];
	int i;

	red = blue = 0;
	scanf("%d", &n);
	scanf("%s", str);
	for (i = 0; str[i] != '\0'; i++) {
		if (str[i] == 'R') {
			red++;
		}
		else {
			blue++;
		}
	}
	if (red > blue) {
		printf("Yes\n");
	}
	else {
		printf("No\n");
	}
	return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
#define repr(i,a,b) for(int i=a;i<b;i++)
#define rep(i,n) for(int i=0;i<n;i++)
#define reprrev(i,a,b) for(int i=b-1;i>=a;i--) // [a, b)
#define reprev(i,n) reprrev(i,0,n)
typedef long long ll;
typedef unsigned long long ull;
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; }

const ll mod = 1e9+7;

void chmod(ll &M){
    if(M >= mod) M %= mod;
    else if(M < 0){
        M += (abs(M)/mod + 1)*mod;
        M %= mod;
    }
}

ll modpow(ll x, ll n){
    if(n==0) return 1;
    ll res=modpow(x, n/2);

    if(n%2==0) return res*res%mod;
    else return res*res%mod*x%mod;
}

int getl(int i, int N) { return i==0? N-1:i-1; };
int getr(int i, int N) { return i==N-1? 0:i+1; };

// 線分 ab の偏角 返り値は[-π, π]
double argument(const pair<double, double> &a, const pair<double, double> &b){
    double ax=a.first, ay=a.second, bx=b.first, by=b.second;
    return atan2(by-ay, bx-ax);
}

/* <-----------------------------------------------------------------------------------> */
/* <-----------------------------------------------------------------------------------> */
/* <-----------------------------------------------------------------------------------> */
/* <-----------------------------------------------------------------------------------> */
/* <-----------------------------------------------------------------------------------> */
/* <-----------------------------------------------------------------------------------> */
/* <-----------------------------------------------------------------------------------> */
/* <-----------------------------------------------------------------------------------> */

int EditDistance(string const & a, string const & b){
    int m = a.size(), n = b.size();
    vector<vector<int>> dp(m+1, vector<int>(n+1, 0));
    rep(j, n+1) dp[0][j] = j;
    repr(i, 1, m+1){
        dp[i][0] = i;
        repr(j, 1, n+1){
            int ins = dp[i][j-1] + 1;
            int del = dp[i-1][j] + 1;
            int rep = a[i-1] == b[j-1]? dp[i-1][j-1]:dp[i-1][j-1]+1;
            dp[i][j] = min(ins, min(del, rep));
        }
    }
    return dp[m][n];
}

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

    string a, b; cin >> a >> b;
    cout << EditDistance(a, b) << endl;

    return 0;
}


Measured memory_bytes: 6760
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vll = vector<ll>;
#define all(x) (x).begin(), (x).end()
#define fsp(x) fixed << setprecision(x)
const ll inf = LLONG_MAX;
const long double pi = acos(-1);
void Yes() {cout << "Yes" << endl;}
void No() {cout << "No" << endl;}
void YES() {cout << "YES" << endl;}
void NO() {cout << "NO" << endl;}

int main() {
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	//const ll p = 1e9 + 7;
	//const ll p = 998244353;

	ll n;
	cin >> n;
	vll a(n), b(n);
	for (ll i = 0; i < n; i++) cin >> a[i];
	for (ll i = 0; i < n; i++) cin >> b[i];

	vll v(0);
	ll sum = 0, sum2 = 0, cnt = 0;
	for (ll i = 0; i < n; i++) {
		ll x = a[i] - b[i];
		sum += x;
		if (x > 0) v.push_back(x);
		if (x < 0) {
			sum2 -= x;
			cnt++;
		}
	}
	if (sum < 0) {
		cout << -1 << endl;
		return 0;
	}
	if (cnt == 0) {
		cout << 0 << endl;
		return 0;
	}
	sort(all(v));
	reverse(all(v));
	vll w(v.size() + 1, 0);
	for (ll i = 1; i < w.size(); i++) {
		w[i] = w[i - 1] + v[i - 1];
		if (w[i] >= sum2) {
			cout << cnt + i << endl;
			break;
		}
	}
}


Measured memory_bytes: 2808
def main():
    A = int(input().strip())
    B = int(input().strip())
    C = int(input().strip())
    X = int(input().strip())
    
    if 500 > X: A = 0
    if 100 > X: B = 0
    count = 0
    for ai in [x*500 for x in range(A+1)]:
        Xa = X - ai
        for bi in [x*100 for x in range(B+1)]:
            Xb = Xa - bi
            for ci in [x*50 for x in range(C+1)]:
                Xc = Xb - ci
                if Xc == 0:
                    count += 1
    return count
if __name__ == '__main__':
    print(main())

Measured memory_bytes: 3064
#include "bits/stdc++.h"

using namespace std;

int main()
{
    int n,k;
    cin >> n >> k;
    string s;
    cin >> s;
    int ans=0;
    for(int i=0;i<n;i++){
        if(s[i]==s[i+1])ans++;
    }
    cout << min (ans+2*k,n-1)<< endl;
    return 0;
}


Measured memory_bytes: 512
import math

K = int(input())

_sum = 0
_sum = sum([i for i in range(1, K+1)])
_sum += sum([sum([math.gcd(i, j)*6 for i in range(j+1, K+1)]) for j in range(1, K+1)])

for a in range(1, K+1):
    for b in range(a+1, K+1):
        for c in range(b+1, K+1):
            _sum += math.gcd(math.gcd(a, b), c)*6
print(_sum)


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

#define N 100000

bool isBoard(int x,int y,int r,int c) {
    if( (x==0 || x==r) || (y==0 || y==c)) {
        return true;
    }
    return false;
}

int bit(int x,int y,int r,int c) {
    if(y==0) {
        if(x<r) {
            return 0;
        }
    }
    if(x==r) {
        if(y<c) {
            return 1;
        }
    }
    if(y==c) {
        if(0<x && x<=r) {
            return 2;
        }
    }
    return 3;
}

vector<pair<int,int> > in[4];

void push(int bit1,int x,int y,int id) {
    if(bit1==0) {
        in[bit1].push_back(make_pair(x,id));
    } else if(bit1==1) {
        in[bit1].push_back(make_pair(y,id));
    } else if(bit1==2) {
        in[bit1].push_back(make_pair(-x,id));
    } else {
        in[bit1].push_back(make_pair(-y,id));
    }
}
bool isOccured[N];
void solve() {
    int r,c,n;scanf("%d %d %d",&r,&c,&n);
    for(int i=0;i<n;++i) {
        int x1,y1,x2,y2;
        scanf("%d %d %d %d",&x1,&y1,&x2,&y2);
        if(isBoard(x1,y1,r,c) && isBoard(x2,y2,r,c)) {
            int bit1 = bit(x1,y1,r,c);
            push(bit1,x1,y1,i);
            int bit2 = bit(x2,y2,r,c);
            push(bit2,x2,y2,i);
        }
    }
    stack<int> st;
    for(int i=0;i<4;++i) {
        sort(in[i].begin(),in[i].end());
        for(int j = 0;j<in[i].size();++j) {
            int id = in[i][j].second;
            if(isOccured[id]) {
                if(st.empty() || st.top()!=id) {
                    printf("NO\n");
                    return;
                }
                st.pop();
            } else {
                isOccured[id] = true;
                st.push(id);
            }
        }
    }
    printf("YES\n");
}
int main() {
    solve();
    return 0;
}

Measured memory_bytes: 2520
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<map>
#include<math.h>
#include<iomanip>
#include<set>
#include<limits.h>
#include<cmath>
#include<queue>
#include<stack>

#include<stdio.h>
#include<stdlib.h>

#define rep(i,n) for(ll i = 0; i < (ll)n; i++)
#define swap(a,b) a^=b;b^=a;a^=b;
#define chmax(a,b) {if(a < b) a = b;}
#define chmin(a,b) {if(a > b) a = b;}

using namespace std;
typedef long long ll;
ll gcd(ll, ll);
vector<bool> to_binary(int);
ll nCr(ll n, ll r);

const ll INF = 1LL << 60;

typedef tuple<ll, ll> mtupl;

/*

bool mycomp(mtupl x, mtupl y) {
	return get<1>(x) < get<1>(y);
}

int vsum(vector<int> v) {
	int res = 0;
	for (auto it = v.begin(); it != v.end(); it++)
		res += *it;
	return res;
}

int vmin(vector<int> v) {
	int min = INT32_MAX;
	for (auto it = v.begin(); it != v.end(); it++)
		min = std::min(min, *it);
	return min;
}

int vmax(vector<int> v) {
	int max = INT32_MIN;
	for (auto it = v.begin(); it != v.end(); it++)
		max = std::max(max, *it);
	return max;
}

ll gcd(ll A, ll B) {
	if (A == 0 || B == 0) return max(A, B);
	int r = A % B;
	while (r != 0) {
		A = B;
		B = r;
		r = A % B;
	}
	return B;
}

vector<ll> prime_factor(int64_t n) {
	//map< ll, ll > ret;
	vector<ll> ret;
	for (ll i = 2; i * i <= n; i++) {
		while (n % i == 0) {
			//ret[i]++;
			ret.push_back(i);
			n /= i;
		}
	}
	if (n != 1)ret.push_back(n);// ret[n] = 1;
	return ret;
}

const int MAX = 1000000;
const int MOD = 1000000007;
ll fac[MAX], finv[MAX], inv[MAX];

void COMinit() {
	fac[0] = fac[1] = 1;
	finv[0] = finv[1] = 1;
	inv[1] = 1;
	for (int i = 2; i < MAX; i++) {
		fac[i] = fac[i - 1] * i % MOD;
		inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
		finv[i] = finv[i - 1] * inv[i] % MOD;
	}
}
ll COM(int n, int k) {
	if (n < k) return 0;
	if (n < 0 || k < 0) return 0;
	return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

struct edge {
	ll to;
	ll cost;
};

*/

int main(void) {
	cin.tie(0);
	ios::sync_with_stdio(false);
	//Program Start	

	ll N, A, B;
	cin >> N >> A >> B;
	ll ans = 0;
	ans += (N / (A + B)) * A;
	ans += min(N % (A + B), A);

	cout << ans << endl;

ProgramEndPointLabel:;

	//Program End
#ifndef DEBUG
	system("pause");
#endif // !DEBUG


	return 0;
}




Measured memory_bytes: 504
using System;

public class Hello
{
    public static void Main()
    {
        string[] line = Console.ReadLine().Trim().Split(' ');
        var a = int.Parse(line[0]);
        var b = int.Parse(line[1]);
        getAns(a, b);
    }
    static void getAns(int a, int b)
    {
        var ab = (long)a * b;
        var ans = ab / gcd(a, b);
        Console.WriteLine(ans);
    }
    static int gcd(int a, int b)
    {
        if (a < b) return gcd(b, a);
        while (b != 0)
        {
            var w = a % b;
            a = b;
            b = w;
        }
        return a;
    }
}


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

public class Main {
    public static Node[] nodes;
    public static void main (String[] args) throws IOException {
	BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
	int n = Integer.parseInt(br.readLine());
	nodes = new Node[n];
	for (int i = 0; i < n; i++) {
	    nodes[i] = new Node(i);
	}
	String[] input;
	int id, left, right;
	for (int i = 0; i < n; i++) {
	    input = br.readLine().split(" ");
	    id = Integer.parseInt(input[0]);
	    left = Integer.parseInt(input[1]);
	    right = Integer.parseInt(input[2]);
	    nodes[id].id = id;
	    nodes[id].left = left;
	    nodes[id].right = right;
	    if (left == -1 && right == -1) {
		nodes[id].type = 1;
		nodes[id].height = 0;
	    }
	    if (left != -1) {
		nodes[left].parent = id;
		nodes[left].sibling = right;
		nodes[id].degree += 1;
	    }
	    if (right != -1) {
		nodes[right].parent = id;
		nodes[right].sibling = left;
		nodes[id].degree += 1;
	    }
	}
	for (int i = 0; i < n; i++) {
	    nodes[i].depth = setDepth(i);
	}
	
	for (int i = 0; i < n; i++) {
	    nodes[i].height = setHeight(i);
	}
	printNodes(nodes);
    }

    public static int setDepth (int id) {
	if (nodes[id].depth >= 0) {
	    return nodes[id].depth;
	}
	if (nodes[id].parent == -1) {
	    nodes[id].type = -1;
	    return nodes[id].depth = 0;
	}
	return nodes[id].depth = setDepth(nodes[id].parent) + 1;
    }

    public static int setHeight (int id) {
	if (id < 0) {
	    return Integer.MIN_VALUE;
	}
	if (nodes[id].height >= 0) {
	    return nodes[id].height;
	}
	return nodes[id].height = Math.max(setHeight(nodes[id].left), setHeight(nodes[id].right)) + 1;
    }
    
    static void printNodes (Node[] nodes) {
	int n = nodes.length;
	StringBuilder sb = new StringBuilder();
	for (int id = 0; id < n; id++) {
	    sb.append("node " + id);
	    sb.append(": parent = " + nodes[id].parent);
	    sb.append(", sibling = " + nodes[id].sibling);
	    sb.append(", degree = " + nodes[id].degree);
	    sb.append(", depth = " + nodes[id].depth);
	    sb.append(", height = " + nodes[id].height);
	    if (nodes[id].type == -1) {
		sb.append(", root\n");
	    } else if (nodes[id].type == 0) {
		sb.append(", internal node\n");
	    } else if (nodes[id].type == 1) {
		sb.append(", leaf\n");
	    }
	}
	System.out.print(sb);
    }
}
class Node {
    int id;
    int left;
    int right;
    int parent;
    int sibling;
    int degree;
    int depth;
    int height;
    int type; // -1: root, 0: internal node, 1: leaf
    Node (int id) {
	this.id = id;
	type = 0;
	degree = 0;
	sibling = -1;
	parent = -1;
	depth = -1;
	height = -1;
    }
}

Measured memory_bytes: 24400
s = gets.chomp
t_ = gets.chomp

ns = s.length
nt = t_.length
arr = []
(ns - nt + 1).times do |i|
  x = s.clone
  ss = s[i..(i + nt - 1)]
  ok = true
  nt.times do |j|
    if ss[j] != "?" && ss[j] != t_[j]
      ok = false
    end
  end
  if ok
    x[i, nt] = t_
    arr << x
  end
end
if arr.empty?
  puts "UNRESTORABLE"
else
  arr.sort!
  ans = arr[0].gsub("?", "a")
  puts ans
end

Measured memory_bytes: 1788
///Bismillahir Rahmanir Rahim
#include "bits/stdc++.h"

#define                           ll                          long long
#define                           int                         ll
#define                           fi                          first
#define                           si                          second
#define                           mp                          make_pair
#define                           pb                          push_back
#define                           pi                          pair<ll,ll>
#define                           clr(x)                      memset(x,0,sizeof(x));
#define                           f(i,l,r)                    for(int i=l;i<=r;i++)
#define                           rf(i,r,l)                   for(int i=r;i>=l;i--)
#define                           done(i)                     cout<<"done = "<<i<<endl;
#define                           show(x,y)                   cout<<x<<" : ";for(auto z:y)cout<<z<<" ";cout<<endl;
#define                           fast                        ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);

using namespace std;

const ll inf=1e18;
const int mod=1e9+7;
const int M=1000005;
int a[M],n;
bool vis[M];
int spf[M+7];
vector<int>prime;
void sieve()
{
    spf[1]=1;
    f(i,1,M)spf[i]=i;
    for(int i=4;i<=M;i=i+2)
    {
        spf[i]=2;
    }
    for(int i=3;i*i<=M;i=i+2)
    {
        if(spf[i]==i)
        {
           for(int j=i*i;j<=M;j=j+i)
           {
               if(spf[j]==j)
               {
                   spf[j]=i;
               }
           }
        }
    }
}
void prime_factorization(int val)
{
    while(val!=1)
    {
        int p=spf[val],cnt=0;
        prime.pb(p);
        while(val%p==0)val=val/p,cnt++;
    }
}
 main()

{
    fast
    int g=0;
    sieve();
    cin>>n;
    f(i,1,n)
    {
        cin>>a[i];
        g=__gcd(g,a[i]);
    }
    bool yo=true;
    rf(i,n,1)
    {
        prime.clear();
        prime_factorization(a[i]);
        bool flag=0;
        for(auto x:prime)
        {
            if(vis[x]==1)flag=1;
            vis[x]=1;
        }
       if(flag==1)
       {
           yo=false;
       }
    }
    if(yo==true)
    {
        cout<<"pairwise coprime\n";
    }
    else
    {
        if(g==1)
        {
            cout<<"setwise coprime\n";
        }
        else
        {
            cout<<"not coprime\n";
        }
    }
    return 0;

}





































Measured memory_bytes: 20116
n=int(input())
a=list(map(int,input().split()))

for i in range(n):
	v=a[i]
	j=i-1
	while j>=0 and a[j]>v:
		a[j+1]=a[j]
		j=j-1
	a[j+1]=v
	print(' '.join(map(str,a)))


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

vector<vector<int>> furthest_left, furthest_right;
int ans;

void left(int a, int b){
    auto next_a = lower_bound(furthest_left[a].begin(), furthest_left[a].end(), -b);
    if(next_a == furthest_left[a].begin()){
        ans += 1;
        return;
    }
    else{
        ans += 1<<(prev(next_a) - furthest_left[a].begin());
        left(-*prev(next_a),b);
    }
}

void right(int a, int b){
    auto next_a = lower_bound(furthest_right[a].begin(), furthest_right[a].end(), b);
    if(next_a == furthest_right[a].begin()){
        ans += 1;
        return ;
    }
    else{
        ans += 1<<(prev(next_a) - furthest_right[a].begin());
        right(*prev(next_a),b);
    }
}

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

    vector<int> x(n);
    for(int i=0; i<n; i++){
        cin >> x[i];
    }
    
    int l, q;
    cin >> l >> q;
    vector<int> a(q), b(q);
    for(int i=0; i<q; i++){
        cin >> a[i] >> b[i];
        a[i] -= 1;
        b[i] -= 1;
    }

    furthest_left.resize(n);
    furthest_right.resize(n);

    for(int i=0; i<n; i++){
        furthest_left[i].push_back(-(lower_bound(x.begin(), x.end(), x[i] - l) - x.begin()));
        furthest_right[i].push_back(upper_bound(x.begin(), x.end(), x[i] + l) - x.begin() - 1);
        //cout << furthest_left[i] << " " << furthest_right[i] << endl;
    }

    int j = 0;
    while(furthest_left[n-1][j] < 0){
        for(int i=0; i<n; i++){
            furthest_left[i].push_back(furthest_left[-furthest_left[i][j]][j]);
        }
        j += 1;

        bool flag = true;
        for(int i=0; i<n; i++){
            if(furthest_left[i][j] != furthest_left[i][j-1]) flag = false;
        }
        if(flag == true) break;
    }
    
    /*
    for(int x=0; x<=j; x++){
        for(int i=0; i<n; i++) cout << furthest_left[i][x] << " ";
        cout << endl;
    }
    cout << endl;
    */
    
    int k = 0;
    while(furthest_right[0][k] < n-1){
        for(int i=0; i<n; i++){
            furthest_right[i].push_back(furthest_right[furthest_right[i][k]][k]);
        }
        k += 1;

        bool flag = true;
        for(int i=0; i<n; i++){
            if(furthest_right[i][k] != furthest_right[i][k-1]) flag = false;
        }
        if(flag == true) break;
    }
    /*
    for(int x=0; x<=k; x++){
        for(int i=0; i<n; i++) cout << furthest_right[i][x] << " ";
        cout << endl;
    }
    */
    
    for(int i=0; i<q; i++){
        ans = 0;
        if(a[i] > b[i])  left(a[i], b[i]);
        if(a[i] < b[i]) right(a[i], b[i]);
        cout << ans << endl;
    }
    return 0;
}


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

int main(void){
    int n,Cx,Cy,i,Hsample,flag;
    long H[101];
    int x[101],y[101],h[101];
    cin >> n;
    for(i=0;i<n;i++){
        cin >> x[i] >> y[i] >> h[i];
    }
    for(Cx=0;Cx<101;Cx++){
        for(Cy=0;Cy<101;Cy++){
            Hsample=0;
            for(i=0;i<n;i++){
                if(h[i]!=0){
                    Hsample=abs(x[i]-Cx)+abs(y[i]-Cy)+h[i];
                    break;
                }
            }
            for(i=0;i<n;i++){
                if(max(Hsample-abs(x[i]-Cx)-abs(y[i]-Cy),0)!=h[i]){
                    break;
                }
            }
            if(i==n){
                cout << Cx << " " << Cy << " " << Hsample << endl;
                return 0;
            }

        }
    }
    return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <functional>
#include <iostream>
#include <list>
#include <queue>
#include <string>
#include <unordered_map>
#include <vector>

using namespace std;

// rep(i, 100) { cout << i << endl; } => 0 1 2 ... 99
#define rep(i, n) for(int i = 0, i##_len = (n); i < (int)n; i++)

// std::sort(all(v));
#define all(x) (x).begin(), (x).end()

// long long int
using ll = long long;

// utility to cast return value of size function to int
#define SZ(x) ((int)(x).size())

// VS defines "_DEBUG" macro when debug configuration.
#if _DEBUG
#define dump(x) cerr << #x << " = " << (x) << endl
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl
#else
#define dump(x)
#define debug(x)
#endif

// update max
template<class T>bool chmax(T & prov, const T & cur)
{
	if (cur > prov)
	{
		prov = cur;
		return true;
	}
	return false;
}

// update min
template<class T>bool chmin(T & prov, const T & cur)
{
	if (cur < prov)
	{
		prov = cur;
		return true;
	}
	return false;
}

// D

void f(const vector<vector<int>> & node, vector<ll> & counter, int index, int parent)
{
	for (auto && child : node[index])
	{
		if (child == parent) { continue; }
		counter[child] += counter[index];
		f(node, counter, child, index);
	}
}

int main()
{
	int N, Q;
	cin >> N >> Q;
	vector<vector<int>> node(N);

	rep(i, N - 1)
	{
		int a, b;
		cin >> a >> b;
		a--;
		b--;
		node[a].push_back(b);
		node[b].push_back(a);
	}

	vector<ll> px(N, 0);
	rep(i, Q)
	{
		ll p, x;
		cin >> p >> x;
		p--;
		px[p] += x;
	}

	// vector<ll> c(N, 0);
	f(node, px, 0, -1);

	rep(i, N)
	{
		cout << px[i] << " ";
	}
	cout << endl;

	return 0;
}


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

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(a) (a).begin(), (a).end()
#define pb push_back
#define ppb pop_back
#define INF 1e18
typedef long long ll;

using namespace std;

int main(int argc, char *argv[])
{
    ios::sync_with_stdio(false);
    cin.tie(0);

    int n;
    cin >> n;
    vector<int> a(n);
    ll sum = 0;
    rep(i, n)
    {
        cin >> a[i];
        if (i == 0)
            sum += abs(a[i]);
        else
        {
            sum += abs(a[i] - a[i - 1]);
        }
    }
    sum += abs(a[n - 1]);

    ll ans = 0;

    rep(i, n - 1)
    {
        if (i == 0)
        {
            ans += sum - abs(a[0]) - abs(a[1] - a[0]) + abs(a[1]);
        }
        else
        {
            ans += sum - abs(a[i] - a[i - 1]) - abs(a[i] - a[i + 1]) + abs(a[i + 1] - a[i - 1]);
        }
        cout << ans << endl;
        ans = 0;
    }
    ans += sum - abs(a[n - 1]) - abs(a[n - 1] - a[n - 2]) + abs(a[n - 2]);

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 1664
#include <iostream>

using namespace std;

int main()
{
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	
	int n;
	cin >> n;
	
	int four = 0, two = 0;
	for(int i = 0; i < n; i++)
	{
		int foo;
		cin >> foo;
		
		if(foo % 4 == 0)
			four++;
		
		else if(foo % 2 == 0)
			two++;
	}
	
	if(two == 0)
	{
		if(four >= n/2)
		{
			cout << "Yes\n";
			return 0;
		}
		
		cout << "No\n";
		return 0;
	}
	
	n -= two;
	if(four >= (n +1)/2)
	{
		cout << "Yes\n";
		return 0;
	}
	
	cout << "No\n";
	return 0;
}

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

int main(){
    int n, m;
    cin >> n >> m;
    vector<bool> ac(n, 0);
    vector<int> wa(n, 0);
    int g = 0, b = 0;
    while(m--){
        int p;
        string s;
        cin >> p >> s;
        p--;
        if(ac[p])   continue;
        if(s == "WA"){
            wa[p]++;
        }else{
            g++;
            ac[p] = true;
            b += wa[p];
        }
    }
    cout << g << " " << b << endl;
    return 0;
}

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

int main() {
  int K; string S;
  cin >> K >> S;

  if (S.size() <= K) cout << S << endl;
  else cout << S.substr(0,K) << "..." << endl;
  return 0;
}


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

char b;
const char d[4] = {'A', 'C', 'G', 'T'};

int main() {
    cin >> b;
    for (int i = 0; i < 4; i++) {
        if (b == d[i]) cout << d[3-i] << endl;
    }
}

Measured memory_bytes: 256
n=int(input())
t,a=map(int,input().split())
lst=list(map(int,input().split()))

ans = 0
ui=10000
for i in range(len(lst)):
    if ui > abs((t-lst[i]*0.006)-a):
        ui = abs((t-lst[i]*0.006)-a)
        ans = i+1
print(ans)

Measured memory_bytes: 3188
#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <utility>
#include <cmath>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <tuple>
#include <numeric>
#include <functional>
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef pair<ll, ll> P;
#define rep(i, n) for(ll i = 0; i < n; i++)
#define exrep(i, a, b) for(ll i = a; i <= b; i++)
#define out(x) cout << x << endl
#define exout(x) printf("%.10f\n", x)
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define pb push_back
#define re0 return 0
const ll mod = 1000000007;
const ll INF = 1e16;

ll ceil(ll a, ll b) {  // a÷b以上の最小の整数
    if(b == 0) {
        return 0;
    }
    return (a+b-1)/b;
}

int main() {
    ll n, x, t;
    cin >> n >> x >> t;

    out(ceil(n, x)*t);
    re0;
}

Measured memory_bytes: 3592
#include <bits/stdc++.h>
using namespace std;
#define repl(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define rep(i,n) repl(i,0,n)
#define mp(a,b) make_pair((a),(b))
#define pb(a) push_back((a))
#define all(x) (x).begin(),(x).end()
#define uniq(x) sort(all(x)),(x).erase(unique(all(x)),end(x))
#define fi first
#define se second
#define dbg(...) _dbg(#__VA_ARGS__, __VA_ARGS__)
void _dbg(string){cout<<endl;}
template<class H,class... T> void _dbg(string s,H h,T... t){int l=s.find(',');cout<<s.substr(0,l)<<" = "<<h<<", ";_dbg(s.substr(l+1),t...);}
template<class T,class U> ostream& operator<<(ostream& o, const pair<T,U> &p){o<<"("<<p.fi<<","<<p.se<<")";return o;}
template<class T> ostream& operator<<(ostream& o, const vector<T> &v){o<<"[";for(T t:v){o<<t<<",";}o<<"]";return o;}

#define INF 1120000000

int main(){
  string n;
  cin>>n;
  int l = n.size();
  long nn = stoll(n);

  long tens = 1;
  rep(i,l) tens *= 10L;

  vector<int> v;
  rep(i,10) v.pb(i);
  long best = -1, bestd = 0;
  do {
    long nd = 0;
    rep(i,l) nd = nd*10 + v[i];

    long diff = min(abs(nn-nd), tens-abs(nn-nd));
    if(diff > bestd){
      bestd = diff;
      best = nd;
    }

    reverse(v.begin() + l, v.end());
  } while(next_permutation(all(v)));

  vector<int> ans(l,0);
  rep(i,l){
    ans[l-i-1] = best%10;
    best/=10;
  }
  rep(i,l) cout << ans[i];
  cout <<endl;

  return 0;
}

Measured memory_bytes: 3180
#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1000000007;
const long long INF = 1LL << 60;

int main()
{
  int N;
  cin >> N;
  vector<int> X(N);
  for (int i = 0; i < N; i++)
    cin >> X[i];
  long long ans = 1000000000000;
  for (int i = 0; i <= 100; i++)
  {
    long long sum = 0;
    for (int j = 0; j < X.size(); j++)
    {
      sum += (i - X[j]) * (i - X[j]);
    }
    if (ans > sum)
    {
      ans = min(sum, ans);
    }
  }
  cout << ans << endl;
}


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

int main(){
	string s;
	long long k;
	int ans;

	cin >> s >> k;
	for (int i = 0; i < k; i++){
		if (s[i] != '1'){
			cout << s[i] << endl;
			return 0;
		}
	}
	cout << '1' << endl;

	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <cstdio>
#include <queue>
#include <algorithm>
#include <functional>
#include <string>
#include <queue>
#include <cmath>
#include <iomanip>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <random>
#include <unordered_map>
#include <unordered_set>
#include <numeric>
#define ll long long
#define fr(i,k,N) for(ll i=k; i<N;i++)
#define rep(i,N) for(ll i=0; i<N;i++)
#define ALL(v) v.begin(),v.end()
#define mp make_pair
using namespace std;
template <class X> void pr(X test){cout<<test<<endl;}
template <class X> void prr(X test){for(auto it:test){cout<<it<<endl;}}
template <class X> void prrr(X test){int f=0;for(auto it:test){cout<<(f++!=0?" ":"")<<it;}cout<<endl;}
template<typename X>
istream&operator>>(istream&i,vector<X>&v){for(X&x:v)i>>x;return i;}

class UF { // union find from https://github.com/kartikkukreja/blog-codes (MIT)
    // [usage]
    // auto uf = new UF(n);
    // uf->merge(l, r); // 0 <= l, r <= n-1
    // ...
public:
    int *id; // inner id
    int cnt; // number of all vartices
    int *sz; // sz[i] means size of i's set
    UF(int N)   {
        cnt = N;
        id = new int[N];
        sz = new int[N];
        for(int i=0; i<N; i++) {
            id[i] = i;
            sz[i] = 1;
        }
    }
    ~UF() {
        delete [] id;
        delete [] sz;
    }
    int find(int p) {
        int root = p;
        while (root != id[root]) root = id[root];
        while (p != root) {
            int newp = id[p];
            id[p] = root;
            p = newp;
        }
        return root;
    }
    void merge(int x, int y) {
        int i = find(x);
        int j = find(y);
        if (i == j) return;
        
        if (sz[i] < sz[j]) {
            id[i] = j;
            sz[j] += sz[i];
        } else {
            id[j] = i;
            sz[i] += sz[j];
        }
        cnt--;
    }
    bool connected(int x, int y) {
        return find(x) == find(y);
    }
    int count() {
        return cnt;
    }
};

// return sorted 約数list 1 <= x <= n
vector<ll> divv(ll n) {
  vector<ll> v;
  for(ll i = 1; i*i <= n; i++) {
    if(n%i == 0) {
      v.push_back(i);
      if(i*i != n) v.push_back(n/i);
    }
  }
  sort(ALL(v));
  return v;
}

int main() {string s;


    cin>>s;
    if(s[0] == 'S') pr("Cloudy");
    else if (s[0] == 'C') pr("Rainy");
    else pr("Sunny");
    
}


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

//Atcoder用

/*
 * BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String[] abc = br.readLine().split(" ");
		int a = Integer.parseInt(abc[0]);
		int b = Integer.parseInt(abc[1]);
		int c = Integer.parseInt(abc[2]);
 */
public class Main {
	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String[] HW = br.readLine().split(" ");
		int h = Integer.parseInt(HW[0]);
		int w = Integer.parseInt(HW[1]);


		//TODO ArrayListに変える
		ArrayList<ArrayList<String>> ban = new ArrayList();
		//String[][] ban = new String[h][w];
		String[] line;

		for(int height=0;height<h;height++){
			line = br.readLine().split("");
			ArrayList<String> second = new ArrayList<String>();
			for(int width=0;width<w;width++){
				second.add(line[width]);
				//ban[height][width] = line[width];
			}
			ban.add(second);
		}

		/* test
		for(int x=0;x<h;x++){
			for(int y=0;y<w;y++){
				System.out.print(ban.get(x).get(y));
			}
			System.out.println();
		}*/

		boolean isYokoWhite = true;
		boolean isTateWhite = true;

		while(isYokoWhite){
			isYokoWhite = false;
			for(int x=0;x<ban.size();x++){
				isYokoWhite = yoko(ban,x);
				if(isYokoWhite){
					ban.remove(x);
					break;
				}
			}
		}

		if(ban.size()==0)System.exit(0);
		
		while(isTateWhite){
			isTateWhite = false;
			for(int x=0;x<ban.get(0).size();x++){
				isTateWhite = tate(ban,x);
				if(isTateWhite){
					for(int a = 0;a<ban.size();a++){
						ban.get(a).remove(x);
					}
				}
				if(isTateWhite)break;
			}
		}




		for(int x=0;x<ban.size();x++){
			for(int y=0;y<ban.get(0).size();y++){
				System.out.print(ban.get(x).get(y));
			}
			System.out.println();
		}

	}

	static boolean tate(ArrayList<ArrayList<String>> s,int j){
		boolean isWhite = true;
		for (int i = 0;i<s.size();i++){
			if(s.get(i).get(j).equals("#")){
				isWhite = false;
				break;
			}
		}
		return isWhite;
	}

	static boolean yoko(ArrayList<ArrayList<String>> s, int i){
		boolean isWhite = true;
		for(int j = 0;j<s.get(i).size();j++){
			if(s.get(i).get(j).equals("#")){
				isWhite = false;
				break;
			}
		}
		return isWhite;
	}

}


Measured memory_bytes: 25428
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
ll a7=1000000007;
ll inf=100000000000000000;

ll min(ll a,ll b){
    if(a<b)return a;
    return b;
}
ll max(ll a,ll b){
    if(a>b)return a;
    return b;
}

int main(){
    ll n;cin>>n;
    ll a[n];
    ll ans=0;
    for(ll i=0;i<n;i++){
        cin>>a[i];
        ans=ans+a[i]-1;
    }
    cout<<ans<<endl;
    return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define REP(i,n) for(long long i=0;i<n;++i)
#define REPP(i,m,n) for(long long i=m;i<n;++i)
#define rep(i,n) for(long long i = n-1;i>=0;--i)
#define repp(i,n,m) for(long long i = n-1; i >= m; --i)
#define ALL(N) (N.begin(),N.end())
#define de cout << "line : " << __LINE__ << " debug" << endl;
#define pb push_back
#define pq priority_queue
#define Dcout(N) cout << setprecision(20) << N << endl
constexpr int INF = 2147483647;
constexpr long long INFF = 9223372036854775807;

signed main() {  
    int A,B;cin >> A >> B;
    cout << max(0,A - 2*B) << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

#define COUT(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl
template<class T1, class T2> ostream& operator << (ostream &s, pair<T1,T2> P)
{ return s << '<' << P.first << ", " << P.second << '>'; }
template<class T> ostream& operator << (ostream &s, vector<T> P)
{ for (int i = 0; i < P.size(); ++i) { if (i > 0) { s << " "; } s << P[i]; } return s; }
template<class T> ostream& operator << (ostream &s, vector<vector<T> > P)
{ for (int i = 0; i < P.size(); ++i) { s << endl << P[i]; } return s << endl; }
template<class T> ostream& operator << (ostream &s, set<T> P)
{ for(auto it : P) { s << "<" << it << "> "; } return s << endl; }
template<class T1, class T2> ostream& operator << (ostream &s, map<T1,T2> P)
{ for(auto it : P) { s << "<" << it.first << "->" << it.second << "> "; } return s << endl; }



int N, M, Q;
vector<long long> a, b, c, d;

long long calc(const vector<int> &A) {
    long long res = 0;
    for (int i = 0; i < Q; ++i) {
        if (A[b[i]] - A[a[i]] == c[i]) res += d[i];
    }
    return res;
}

void dfs(vector<int> &A, long long &res) {
    if (A.size() == N+1) {
        long long tmp = calc(A);
        chmax(res, tmp);
        return;
    }
    long long ba = A.back();
    for (int add = ba; add <= M; ++add) {
        A.push_back(add);
        dfs(A, res);
        A.pop_back();
    }
}

long long solve() {
    long long res = 0;
    vector<int> A({1});
    dfs(A, res);
    return res;
}

int main() {
    while (cin >> N >> M >> Q) {
        a.resize(Q); b.resize(Q); c.resize(Q); d.resize(Q);
        for (int i = 0; i < Q; ++i) cin >> a[i]>>b[i]>>c[i]>>d[i];
        cout << solve() << endl;
    }
}

















Measured memory_bytes: 3632