akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<ll> vi;
typedef vector<bool> vb;
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define sq(x) ((x)*(x))
#define fo(i,n) for(int i=0;i<n;i++)
#define fp(i,k,n) for(int i=k;i<n;i++)
#define Fo(i,n) for(int i=1;i<=n;i++)
#define all(x) x.begin(),x.end()
#define allr(x) x.rbegin(),x.rend()
#define deb(x) cout<<#x<<"="<<x<<"\n"
#define deb2(x,y) cout<<#x<<"="<<x<<" "<<#y<<"="<<y<<"\n"
#define fi first
#define se second
const double pi = 3.14159265358979323846;
#define uni(c) (c).resize(unique(all(c))-(c).begin())
#define fast ios_base::sync_with_stdio(0);cin.tie(NULL)
//pair <int, int> w[4] = {mp(-1, 0), mp(0, -1), mp(1, 0), mp(0, 1)};   // for matrix movement:
void cp()
{
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif // ONLINE_JUDGE
}
unordered_map<int, unordered_set<int>> a;
bool vis[200020];
int dfs(int x)
{
    unordered_set<int> count;
    queue<int> q;
    q.push(x);
    while (!q.empty())
    {
        int temp = q.front();
        q.pop();
        count.insert(temp);
        vis[temp] = 1;
        for (auto it : a[temp])
        {
            if (!vis[it])
            {
                q.push(it);
                vis[it] = 1;
            }
        }
    }
    return (int)count.size();
}
void solve()
{
    int n, m; cin >> n >> m;
    int ans = 0;
    map<int, unordered_set<int>> ho;
    fo(i, m)
    {
        int x, y; cin >> x >> y;
        if (x > y)
            swap(x, y);
        if (ho[x].size() == 0)
        {
            a[y].insert(x);
            a[x].insert(y);
        }
        else if (ho[x].size() > 0 and ho[x].find(y) == ho[x].end()) {
            a[y].insert(x);
            a[x].insert(y);
        }
        ho[x].insert(y);
    }
    if (m == 0)
    {
        cout << 1 << "\n";
        return;
    }
    for (int i = 1; i <= n; i++)
    {
        if (!vis[i])
        {
            ans = max(ans, dfs(i));
        }
    }
    cout << ans;
}
int main()
{
    fast;
    //cp();
    ll t = 1;
    //cin >> t;
    while (t--)
        solve();


    return 0;
}

Measured memory_bytes: 82308
import sys
s = input()

if len(s) == 2 and s[0:1] == s[1:2]:
    print(1, 2)
    sys.exit()

for i in range(len(s)-2):
    temp = s[i:i+3]
    if temp[0:1] == temp[1:2] or temp[1:2] == temp[2:3] or temp[2:3] == temp[0:1]:
        print(i+1, i+3)
        sys.exit()

print(-1, -1)

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

namespace ziyuutyou
{
    class Program
    {
        static void Main(string[] args)
        {
            var str = Console.ReadLine();

            var sum = 0;

            foreach(var ch in str)
            {
                if (ch == '+')
                    sum++;
                else
                    sum--;

            }
            Console.WriteLine(sum);
        }
    }
}


Measured memory_bytes: 11092
#include <bits/stdc++.h>
#include <limits>
#include <math.h>
#include <cmath>
using namespace std;
using ll = long long;
using ull = unsigned long long;
using pii = pair<int, int> ;
using vi = vector<int> ;
using vvi = vector<vector<int>> ;
using vll = vector<long long>;
using vvll = vector<vector<long long >>;
#define PI 3.141592653
#define rep(i, n) for(ll i = 0; i < n; i++)

int main(){
  ll n; cin >> n;
  vector<tuple<ll, ll , ll, ll>> v(n);
  rep(i, n){
    cin >> get<0>(v[i]);
    get<1>(v[i]) = i+1;
    }
  
  sort(v.begin(), v.end());
  
  rep(i, n){
    get<2>(v[i]) = i+1;
    get<3>(v[i]) = 0;
  }

  sort(v.begin(), v.end());

  rep(i, n){
    if(i == 0){
      get<3>(v[0]) = (n-get<2>(v[i])+1)*(get<0>(v[i]));
    }
    else{
      get<3>(v[i]) = (n-get<2>(v[i])+1)*(get<0>(v[i])-get<0>(v[i-1]));
    }
  }

  ll memo = get<1>(v[n-1]);
  ll res = n-1;

  for(ll i = n-1; i >= 0; i--){
    if(memo < get<1>(v[i])){
      get<3>(v[res]) += get<3>(v[i]); get<3>(v[i]) = 0; continue;
    }
    if(memo > get<1>(v[i])){
      memo = get<1>(v[i]); res = i; continue;
    }
  }




  rep(i, n){
    swap(get<1>(v[i]), get<0>(v[i]));
  }

  sort(v.begin(), v.end());

  rep(i, n){
    cout << get<3>(v[i]) << endl;
  }

}       

Measured memory_bytes: 4224
n=gets.chomp.to_s
n=n.split("").map(&:to_s)
if n.count("W")==n.length || n.count("B")==n.length
p 0
exit
end
    count=0
b=0
w=0
v=n.shift

stack=[]
stack.push(v)
while n[0]!=nil
    v=n.shift
if stack[-1]!=v
    count+=1
    stack.push(v)
end
end


p count


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

#define ST_ARR_LEN(array) (sizeof(array)/sizeof(*array))
#define MOD 1000000007

using namespace std;

using ll = long long;
const ll MAX = LLONG_MAX;
const ll MIN = LLONG_MIN;

typedef stack<ll> llStack;
typedef queue<ll> llQueue;
typedef vector<ll> llVector;
typedef list<ll> llList;

typedef struct S{
  int a;
  int b;
} Object;

int main(){
  ll N;
  cin >> N;
  
  N = N%10;
  string ans = "hon";
  if(N == 3){
    ans = "bon";
  }else if((N == 0) || (N == 1) || (N == 6) || (N == 8)){
    ans = "pon";
  }
    
  
  cout << ans << endl;
}

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

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

	int n;
	cin >> n;

	while(n > 0){
		double xa, ya, ra;
		double xb, yb, rb;

		cin >> xa >> ya >> ra;
		cin >> xb >> yb >> rb;

		double d = sqrt((xa - xb) * (xa - xb) + (ya - yb) * (ya - yb));

		if(d > ra + rb) cout << 0 << endl;
		else if(ra > rb && d < ra - rb) cout << 2 << endl;
		else if(rb > ra && d < rb - ra) cout << -2 << endl;
		else cout << 1 << endl;
		--n;
	}

	return 0;
}

Measured memory_bytes: 1244
#include<bits/stdc++.h>
#define ll long long
#define all(a) a.begin(),a.end()
#define sz(a) a.size()
#define re return 
#define MP make_pair
#define pb push_back
#define pii pair<int,int>
#define se second
#define fi first
using namespace std;

signed main(){
	ios_base::sync_with_stdio(0);
	int n,a;
	cin>>n>>a;
	cout<<n*n-a;
	re 0;
}

Measured memory_bytes: 3648
#include<iostream>
using namespace std;
long long dp[404][404],dp1[404][404],a[404],ans;
int n;
int main()
{
    cin>>n;
    for(int i=0;i<n;i++)
    {
        cin>>a[i];
        //dp[i][i]=a[i];
        a[i]+=a[i-1];
    }
    for(int i=0;i<n;i++)
    {
        for(int j=i+1;j<n;j++)
        {
            dp[i][j]=1e18;
        }
    }
    for(int j=1;j<=n-1;j++)
    {
        for(int i=0;i<n;i++)
        {
            if(i+j>n-1)break;
            for(int z=0;z<j;z++)
            {
                long long h=dp[i][i+z];
                long long y=dp[min(i+z+1,n-1)][min(i+j,n-1)];
                dp[i][i+j]=min(dp[i][i+j],h+y+(a[i+j]-a[i-1]));
                //cout<<i<<' '<<i+j<<' '<<i+z<<' '<<i+j<<' '<<dp[i][i+j]<<' '<<h<<' '<<y<<' '<<a[i+j]-a[i-1]<<endl;
            }
        }
    }
    cout<<dp[0][n-1];
}


Measured memory_bytes: 1536
#include "bits/stdc++.h"
#include <boost/multi_array.hpp>
#include <boost/optional.hpp>
#include <boost/range/irange.hpp>
#include <boost/range/algorithm.hpp>
#include <boost/range/adaptors.hpp>
#include <boost/dynamic_bitset.hpp>
namespace adaptor = boost::adaptors;
using index_t = std::size_t;

namespace lib
{
	using graph_t = std::vector<std::set<index_t>>;
	template<class T>using weighted_graph_t = std::vector<std::map<index_t, T>>;

	struct max_t
	{
		template<class T>constexpr T operator()(T const& lhs, T const& rhs)const
		{
			return std::max(lhs, rhs);
		}
	};
	struct min_t
	{
		template<class T>constexpr T operator()(T const& lhs, T const& rhs)const
		{
			return std::min(lhs, rhs);
		}
	};

	constexpr max_t max;
	constexpr min_t min;

	template<class T>auto order_by(T func)
	{
		return [=](auto&& lhs, auto&& rhs)
		{
			return func(lhs) < func(rhs);
		};
	}

	template<class T>constexpr auto max_v = std::numeric_limits<T>::max();
	template<class T>constexpr auto min_v = std::numeric_limits<T>::min();

	template<class T>using p_queue = std::priority_queue<T, std::vector<T>, std::greater<>>;
}

void Main()
{
	int N;
	std::cin >> N;
	std::vector<std::size_t> count(N + 1);
	for (auto i : boost::irange<std::size_t>(1, N + 1))
	{
		for (auto k = i; k <= N; k += i)
		{
			++count[k];
		}
	}
	std::size_t sum = 0;
	for (auto i : boost::irange(N + 1))
	{
		sum += i * count[i];
	}
	std::cout << sum << std::endl;
}

int main()
{
	std::cin.tie(nullptr);
	std::ios_base::sync_with_stdio(false);
	std::cout << std::fixed << std::setprecision(15);
	Main();
}

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

int main() {
    int n; cin >> n;
    int count = 0;
    for(int i = 0; i < n; i ++) {
        int l,r; cin >> l >> r;
        count += r-l+1;
    }
    cout << count << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define lp(i, x, n) for (int i = x; i < (int)n; ++i)
#define all(v) (v).begin(), (v).end()
#define sz(v) (int)(v).size()
#define ll long long
#define N 123451
string s[1001];
int main(){
        int a, b;
        cin >> a>> b;
        lp (i, 0, a) cin >> s[i];
        sort(s, s + a);
        lp (i, 0, a) printf("%s", s[i].c_str());
        return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int w = sc.nextInt();
        int h = sc.nextInt();
        int x = sc.nextInt();
        int y = sc.nextInt();
        sc.close();

        System.out.print(Double.valueOf(w) * Double.valueOf(h) / 2.0);
        if (w / 2 == x && w % 2 == 0 && h / 2 == y && h % 2 == 0) {
            System.out.println(" 1");
        } else {
            System.out.println(" 0");
        }
    }

}


Measured memory_bytes: 21844
#include<stdio.h>
int main(void){//floatよりもdoubleを
int n,a[1001],i,t;
scanf("%d",&n);
for(i=1;i<=n;i++){
	scanf("%d",&a[i]);
}
for(i=n;i>=1;i--){
if(i>=2) printf("%d ",a[i]);
else printf("%d\n",a[i]);
}
return 0;
}


Measured memory_bytes: 2044
/*------------------------- Bism Allah Alruhmin Alrahim -------------------------------*/
#include <bits/stdc++.h>
#define forn(i, n) for (int i = 0; i < n; i++)
#define ford(i, n) for (int i = n - 1; i > -1; i--)
#define forl(i, l, r) for (int i = l; i <= r; i++)
#define vc vector
#define f first
#define s second
#define pb(i) push_back(i)
#define mx(ar, n) (*max_element(ar, ar + n))
#define mn(ar, n) (*min_element(ar, ar + n))

using namespace std;

typedef unsigned long long ull;
typedef long long ll;
typedef long double ld;


int main()
{
    int m , n , c; 
    cin >> n >> m >> c; 
    int x[m] ;
    for (int i = 0; i < m; i++)
    {
        cin >> x[i] ;
    }
    int y = 0;
    for (int i = 0; i < n; i++)
    {
        int sum = c ;
        for (int j = 0; j < m; j++)
        {
            int a ;
            cin >> a;
            sum+=(a*x[j]);
        }
        if(sum > 0){
            y++;
        }
    
    }
    cout << y << endl;
    
    return 0 ;
}

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

int main(void) {
	int position[5], k;
	for (int i = 0; i < 5; i++)
		cin >> position[i];
	cin >> k;
	
	int tmp = position[4] - position[0];
	if (tmp > k) {
		cout << ":(";
	}
	else {
		cout << "Yay!";
	}
	cout << endl;
	return 0;
}

Measured memory_bytes: 256
N, K = map(int, input().split())
h = []
for i in range(N):
    th = int(input())
    h.append(th)
h.sort()
ans = float('INF')
for i in range(N - K + 1):
    ans = min(ans, h[i + K - 1] - h[i])
print(ans)


Measured memory_bytes: 7384
#include <bits/stdc++.h>
using namespace std;
#define rep(i,N) for(int i=0;i<int(N);++i)
#define rep1(i,N) for(int i=1;i<int(N);++i)
#define all(a) (a).begin(),(a).end()
#define print(v) { cerr<<#v<<": [ "; for(auto _ : v) cerr<<_<<", "; cerr<<"]"<<endl; }
#define printpair(v) { cerr<<#v<<": [ "; for(auto _ : v) cerr<<"{"<<_.first<<","<<_.second<<"}"<<", "; cerr<<"]"<<endl; }
#define dump(x) cerr<<#x<<": "<<x<<endl;
#define bit(k) (1LL<<(k))
#define Yes "Yes"
#define No "No"
#define YES "YES"
#define NO "NO"
typedef long long ll;
template <class T> using vec = vector<T>;
template <class T> using vvec = vector<vec<T>>;

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 int INF = (ll)1e9;
const ll INFLL = (ll)1e18+1;
const ll MOD = (ll)1e9+7;
const double PI = acos(-1.0);
/*
const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
const string dir = "DRUL";
*/
int H,W,N;
string S,T;
bool solve(int t, int mx, int sx){
    //Nターン後は、
    //[0, N-1]の区間に入っていられるかどうか
    char plus = 'D';
    char minu = 'U';
    if(t == 1){
        plus = 'R';
        minu = 'L';
    }
    // [l, r)の区間
    int l = 0, r = mx;
    //cerr<<endl;
    for(int i = N-1;i >= 0;i--){
        //cerr << "start: " <<l << " " << r <<endl;
        if(l == r)return false;
        if(T[i] == minu){
            r++;
            chmin(r, mx);
        }
        else if(T[i] == plus){
            l--;
            chmax(l, 0);
        }
        //cerr << l << " " << r << endl;
        if(S[i] == plus){
            r--;
        }
        else if(S[i] == minu){
            l++;
        }
        cerr << l << " " << r << endl;
    }
    //cerr << "finished" << endl;
    //cerr << sx << endl;
    if(sx < l || r <= sx){
        return false;
    }
    return true;
}
int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(20);
    int sx, sy;
    cin >> H >> W >> N;
    cin >> sx >> sy;
    sx--;sy--;
    cin >> S >> T;
    bool ok = true;
    if(!solve(0, H, sx)){
        ok = false;
    } 
    if(!solve(1, W, sy)){
        ok = false;
    }
    cout << (ok ? YES :NO) << endl;
}

Measured memory_bytes: 920
// -> limitless <- //
#include<iostream>
#include<bits/stdc++.h>
#define IO ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
#define PB push_back
#define MP make_pair
#define f(i, x, n) for (int i = x; i < (int)(n); ++i)
#define lp(i, n) for (int i = 0; i < (int)(n); ++i)
#define read(n) scanf ("%d", &n)
using namespace std;
typedef unsigned long long ll;
    const int N = 1e5 + 2;
    const int mod = 1e9 + 7;

int main()
{
    deque<char> dq, dq1;
    string s, s1;
    cin >> s >> s1;
    for(int i = 0; i < s.size(); i++)dq.PB(s[i]);
    for(int i = 0; i < s1.size(); i++)dq1.PB(s1[i]);
    for(int i = 0; i <= s.size(); i++){
        char c = dq.front();
        dq.pop_front();
        dq.PB(c);
        bool b = true;
        for(int i = 0; i < (int)dq.size(); i++)
        if(dq[i] != dq1[i]){b = false; break;}
        if(b){
            cout << "Yes\n";
            return 0;
        }
    }
    cout << "No\n";
	return 0;
}



Measured memory_bytes: 256
#include<cstdio>
#include<cstring>
#define ll long long
using namespace std;
const int N=1e5+5;
int sl,tl,j,Fir[26],Las[26];
ll ans;
char S[N],T[N];
int main(){
	scanf("%s%s",S+1,T+1);
	sl=strlen(S+1),tl=strlen(T+1);
	for(int i=1;i<=sl;++i){
		if(!Fir[S[i]-'a'])Fir[S[i]-'a']=i;
		Las[S[i]-'a']=i;
	}
	j=Fir[T[1]-'a'];
	if(!j){
		printf("-1\n");
		return 0;
	}
	for(int i=2;i<=tl;++i){
		for(++j;j<=Las[T[i]-'a']&&T[i]!=S[j];++j);
		if(j>Las[T[i]-'a'])ans+=sl,j=Fir[T[i]-'a'];
		if(!j){
			printf("-1\n");
			return 0;
		}
	}
	printf("%lld\n",ans+j);
}

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

#define ll long long
#define vvi vector<vector<int>>
#define vec vector
#define pq priority_queue
#define all(v) (v).begin(), (v).end()
#define uniqueV(x) sort(x.begin(), x.end()); x.erase(unique(x.begin(), x.end()), x.end());
#define rep(i, n) for (int (i) = (0); (i) < (n); ++(i))
#define repp(i, m, n) for (int (i) = (m); (i) < (n); ++(i))
#define dbg(x) cerr << #x << ": " << x << endl;
#define dbg2(x, y) cerr<<"("<<#x<<", "<<#y<<") = "<<"("<<x<<", "<<y<<")"<<endl;
#define dbg3(x, y, z) cerr<<"("<<#x<<", "<<#y<<", "<<#z<<") = "<<"("<<x<<", "<<y<<", "<<z<<")"<<endl;
#define dbgB(value, size) cerr<<#value<<": "<<bitset<size>(value) << endl;
#define line() cerr << "---------------" << endl;

const int dx[] = {1, -1, 0, 0};
const int dy[] = {0, 0, -1, 1};
const double PI = 3.14159265358979323846;

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

template<typename T>
void printA(vector<T> &printArray, char between = ' ') {
   int paSize = printArray.size();
   for (int i = 0; i < paSize; i++) { cerr << printArray[i] << between;}
   if (between != '\n') {cerr << endl;}
}

// ------------------------------------------------------------------------------------------


const int INF = 1e8;
int n, m;
int c[22];
int dp[55555];

int main() {
   cin >> n >> m;
   rep (i, m) {
      cin >> c[i];
   }

   fill(dp, dp+n+1, INF);
   dp[0] = 0;

   for (int i = 0; i <= n; i++) {
      for (int j = 0; j < m; j++) {
         if (i + c[j] <= n) {
            dp[i+c[j]] = min(dp[i+c[j]], dp[i] + 1);
         }
      }
   }

   cout << dp[n] << endl;

   return 0;
}


Measured memory_bytes: 3316
{-# LANGUAGE FlexibleContexts #-}
import qualified Data.ByteString.Char8 as BS
import           Data.Char
import           Data.List
import           Data.Sequence         (Seq, (<|), (><), (|>))
import qualified Data.Sequence         as Seq

getAsInt :: IO [Int]
getAsInt =  unfoldr (BS.readInt . BS.dropWhile isSpace) <$> BS.getLine

main :: IO ()
main = do
  [k] <- getAsInt
  print $ solve k

-- solve' :: Int -> Int
-- solve' k = go (Seq.fromList [1,2,3,4,5,6,7,8,9]) 1
--   where go :: Seq Int -> Int -> Int
--         go Seq.Empty _ = 0
--         go (s Seq.:<| seq') n = let a = if s`mod`10/=0 then seq' |> 10*s+(s`mod`10)-1 else seq'
--                                     b = a |> 10*s+(s`mod`10)
--                                     c = if s`mod`10/=9 then b |> 10*s+(s`mod`10)+1 else b
--                                 in if k == n
--                                    then s
--                                    else go c (n+1)

solve :: Int -> Int
solve k = go (Seq.fromList [1,2,3,4,5,6,7,8,9]) 1
  where go :: Seq Int -> Int -> Int
        go sq n
          | Seq.null sq = 0
          | otherwise = let s = sq `Seq.index` 0
                            seq' = Seq.drop 1 sq
                            a = if s`mod`10/=0 then seq' |> 10*s+(s`mod`10)-1 else seq'
                            b = a |> 10*s+(s`mod`10)
                            c = if s`mod`10/=9 then b |> 10*s+(s`mod`10)+1 else b
                        in if k == n
                           then s
                           else go c (n+1)


Measured memory_bytes: 15100
#include<bits/stdc++.h>
using namespace std;
int main()
{
        int a[3]={0};
        cin>>a[0]>>a[1]>>a[2];
        sort(a,a+3);
        int a1=a[2]-a[0],a2=a[2]-a[1];
        int n2=a1/2+a2/2;
        int n1=a1-(a1/2*2)+a2-(a2/2*2);
        if(n1%2==0)
        {
                cout<<n2+n1/2<<endl;
        }
        else
        {
                cout<<n2+(n1+3)/2<<endl;
        }
        return 0;
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using static System.Math;

namespace CSharpSpiral {
	class Program {
		static void Main(string[] args) {
			var sw = new StreamWriter(Console.OpenStandardOutput()) {
				AutoFlush=
#if DEBUG
			true
#else
			false
#endif
			};
			Console.SetOut(sw);
			new Program().Solve(new ConsoleInput(
#if DEBUG
			new StreamReader("../../../inputData.txt")
#else
			Console.In
#endif
			, ' '));
			Console.Out.Flush();
		}
		public void Solve(ConsoleInput cin) {
			var X = cin.ReadLong;
			var money = 100L;
			for(int i = 0; i<10000; i++) {
				money+=money/100;
				if(money>=X) {
					Console.WriteLine(i+1);
					return;
				}
			}
		}
	}
	static class ExtendClass {
		public static string Join<T>(this IEnumerable<T> X, string separator = " ") => string.Join(separator, X);
		
	}
	class ConsoleInput {
		private readonly TextReader _stream;
		private readonly char _separator = ' ';
		private readonly Queue<string> inputStream;
		public ConsoleInput(TextReader stream, char separator = ' ') {
			this._separator=separator;
			this._stream=stream;
			inputStream=new Queue<string>();
		}
		public string Read {
			get {
				if(inputStream.Count!=0) return inputStream.Dequeue();
				string[] tmp = _stream.ReadLine().Split(_separator);
				for(int i = 0; i<tmp.Length; ++i)
					inputStream.Enqueue(tmp[i]);
				return inputStream.Dequeue();
			}
		}
		public string ReadLine { get { return _stream.ReadLine(); } }
		public int ReadInt { get { return int.Parse(Read); } }
		public long ReadLong { get { return long.Parse(Read); } }
		public double ReadDouble { get { return double.Parse(Read); } }
		public string[] ReadStrArray(long N) {
			var ret = new string[N];
			for(long i = 0; i<N; ++i)
				ret[i]=Read;
			return ret;
		}
		public int[] ReadIntArray(long N) { var ret = new int[N]; for(long i = 0; i<N; ++i) ret[i]=ReadInt; return ret; }
		public long[] ReadLongArray(long N) { var ret = new long[N]; for(long i = 0; i<N; ++i) ret[i]=ReadLong; return ret; }
		public double[] ReadDoubleArray(long N) { var ret = new double[N]; for(long i = 0; i<N; ++i) ret[i]=ReadDouble; return ret; }
		public bool isEOF {
			get { return _stream.Peek()==-1; }
		}
	}

}

Measured memory_bytes: 27896
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
using i64 = long long;
int main(void){
    i64 s;
    cin >> s;
    if(s == 1e18){
        cout << "0 0 1000000000 0 0 1000000000" << endl;
        return 0;
    }
    i64 x1 = 0, y1 = 0, x2 = 1e9, y2 = 1, x3 = 1e9 - s % i64(1e9), y3 = s / 1e9 + 1;
    cout << x1 << " " << y1 << " " << x2 << " " << y2 << " " << x3 << " " << y3 << endl;
    
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define FASTIO ios::sync_with_stdio(false);cin.tie(0);
#define ADD +
#define SUBTRACT -
#define MULTIPLY *
#define DIVIDE /
#define MOD %
#define INCREMENT(x) ++x
#define DECREMENT(x) --x
#define in(a,b) cin>>a>>b;
#define out(a,b) cout<<a<<endl<<b<<endl;
#define scan(a) scanf("%d",&a);
#define print(a) printf("%d\n",a);
#define scanii(a,b) scanf("%d %d",&a,&b);
#define printii(a,b) printf("%d\n%d\n",a,b);
#define scaniii(a,b,c) scanf("%d %d %d",&a,&b,&c);
#define pub push_back
#define pob pop_back
#define puf push_front
#define pof pop_front
#define ll long long
#define ull unsigned long long
#define sll signed long long
#define pi acos(-1)
#define mod 1000000007
#define TRUE 1
#define FALSE 0
#define ZERO 0
#define MP make_pair
#define F first
#define S second
#define f1(i,a) for(int i=0;i<a;++i)
#define f2(i,a) for(int i=a-1;i>=0;--i)
#define en puts("");
#define elif else if
typedef ll int lli;
typedef sll int slli;
typedef ull int ulli;
const int sz=10000;
using namespace std;

int clue();
int result();
void show();
bool check();


bool cmp(pair<int,int>p,pair<int,int>q) {
    // return p.first>q.first;//descending by first
    // return p.first<q.first;//ascending by first
    // return p.second>q.second;//descending by second
    return p.second<q.second;//ascending by second
}

// bool cmp(int p,int q) {
    // return p>q;//descending
    // return p<q;//ascending
// }


int main() {

    int t;
    // cin>>t;
    t=1;
    while(t-->0) {
        clue();
    }

    return 0;
}
int clue() {

    
    set<char>s;
    string q;
    cin>>q;
    f1(i,3) {
        s.insert(q[i]);
    }

    int n=s.size();
    (n>1)?cout<<"Yes"<<endl:cout<<"No"<<endl;
    
    return 0;
}

Measured memory_bytes: 3588
use proconio::{input, fastout};
use std::collections::BinaryHeap;
use std::cmp::Reverse;

#[fastout]
fn main() {
    input! {
        t: usize,
    }

    let mut cases = vec![];

    for _ in 0..t {
        input! {
            n: usize,
            klr: [(usize, usize, usize); n],
        }
        let mut left = BinaryHeap::new();
        let mut right = BinaryHeap::new();

        let mut left_sum = 0;
        let mut right_sum = 0;

        for (k, l, r) in klr {
            if l >= r {
                left_sum += r;
                left.push((Reverse(k), l - r));
            } else {
                right_sum += l;
                right.push((Reverse(n - k), r - l));
            }
        }

        cases.push((left, left_sum, right, right_sum));
    }

    for (mut left, mut left_sum, mut right, mut right_sum) in cases {
        let mut pool = BinaryHeap::new();
        while let Some((Reverse(k), value)) = left.pop() {
            pool.push(Reverse(value));
            while pool.len() > k {
                pool.pop();
            }
        }
        while let Some(Reverse(value)) = pool.pop() {
            left_sum += value;
        }

        while let Some((Reverse(k), value)) = right.pop() {
            pool.push(Reverse(value));
            while pool.len() > k {
                pool.pop();
            }
        }
        while let Some(Reverse(value)) = pool.pop() {
            right_sum += value;
        }

        println!("{}", left_sum + right_sum);
    }
}


Measured memory_bytes: 13720
using System;

class Program
{
    static void Main(string[] args)
    {
        string[] input = Console.ReadLine().Split(new string[]{" "}, StringSplitOptions.RemoveEmptyEntries);
        long A = Int64.Parse(input[0]);
        long B = Int64.Parse(input[1]);
        long C = Int64.Parse(input[2]);
        long D = Int64.Parse(input[3]);

        long cNumUntilA = A / C;
        long cNumUntilB = B / C;
        long cNum = cNumUntilB - cNumUntilA;
        // A以上なのでAが割り切れたら1増やす
        cNum += (A % C == 0) ? 1 : 0;

        long dNumUntilA = A / D;
        long dNumUntilB = B / D;
        long dNum = dNumUntilB - dNumUntilA;
        // A以上なのでAが割り切れたら1増やす
        dNum += (A % D == 0) ? 1 : 0;

        long CandD = Lcm(C, D);
        long cdNumUntilA = A / CandD;
        long cdNumUntilB = B / CandD;
        long cdNum = cdNumUntilB - cdNumUntilA;
        cdNum += (A % CandD == 0) ? 1 : 0;

        long ans = B - A + 1 - (cNum + dNum - cdNum);
        Console.WriteLine(ans);
    }

    static long Lcm(long a, long b)
    {
        return a * b / Gcd(a, b);
    }

    static long Gcd(long a, long b)
    {
        if (a < b)
        {
            return Gcd(b, a);
        }
        long d = 0;
        do {
            d = a % b;
            a = b;
            b = d;
        } while (d != 0);
        return a;
    }
}

Measured memory_bytes: 11092
s=input()
length = len(s)//2

s1 = s[:length]
if len(s)%2==0:
    s2 = s[length:]
else:
    s2 = s[length+1:]
s2 = s2[::-1]

ans = 0
for a,b in zip(s1,s2):
    if a!=b:
        ans+=1
print(ans)

Measured memory_bytes: 3060
// AOJ 0623: Zombie Island
// 2017.11.18 bal4u@uu

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

#define QMAX 200000
typedef struct { int node; long long t; } QUE;
QUE que[QMAX]; int qsize;

#define PARENT(i) ((i)>>1)
#define LEFT(i)   ((i)<<1)
#define RIGHT(i)  (((i)<<1)+1)

void min_heapify(int i)
{
	int l, r, min;
	QUE qt;

	l = LEFT(i), r = RIGHT(i);
	if (l < qsize && que[l].t < que[i].t) min = l; else min = i;
	if (r < qsize && que[r].t < que[min].t) min = r;
	if (min != i) {
		qt = que[i], que[i] = que[min], que[min] = qt;
		min_heapify(min);
	}
}

void deq()
{
//	if (qsize == 0) return 0;
//	*n = que[0].node, *t = que[0].t, *c = que[0].c;
	que[0] = que[--qsize];
	min_heapify(0);
//	return 1;
}

void enq(int n, long long t)
{
	int i, min;
	QUE qt;

	i = qsize++;
	que[i].node = n, que[i].t = t;
	while (i > 0 && que[min = PARENT(i)].t > que[i].t) {
		qt = que[i], que[i] = que[min], que[min] = qt;
		i = min;
	}
}

#define MAX 100000
typedef struct { int len, to[20]; } TBL;
TBL tbl[MAX+1];
int len[MAX+1];
int zombie[MAX+1];
char visited[MAX+1];
int N, S, P, Q;

void dijkstra1()
{
	int i, s, e, d;

	while (qsize) {
		s = que[0].node, d = (int)que[0].t, deq();
		if (visited[s]) continue;
		visited[s] = 1;
		zombie[s] = d;
		for (i = 0; i < len[s]; i++) {
			e = tbl[s].to[i];
			if (visited[e]) continue;
			enq(e, d+1);
		}
	}
}

long long fee[MAX+1];
long long dijkstra2(int start, int goal)
{
	int i, s, e;
	long long d = 0;

	qsize = 0;
	for (i = 0; i < N; i++) visited[i] = (zombie[i] == 0);
	enq(start, 0);
	while (qsize) {
		s = que[0].node, d = que[0].t, deq();
		if (s == goal) break;
		if (visited[s]) continue;
		visited[s] = 1;
		for (i = 0; i < len[s]; i++) {
			e = tbl[s].to[i];
			if (visited[e]) continue;
			if (zombie[e] <= S) enq(e, d+Q);
			else enq(e, d+P);
		}
	}
	return d-((zombie[goal] <= S) ? Q : P);
}

char buf[40], *p;
int getint()
{
	int n = 0;
	while (*p >= '0') n = (n<<3) + (n<<1) + (*p++ & 0xf);
	return n;
}

int main()
{
	int M, K, i, a, b, c;

	fgets(p=buf, 40, stdin);
	N = getint(), p++, M = getint(), p++, K = getint(), p++, S = getint();
	fgets(p=buf, 40, stdin);
	P = getint(), p++, Q = getint();
	qsize = 0;
	for (i = 0; i < K; i++) {
		fgets(p=buf, 40, stdin);
		c = getint()-1, enq(c, 0);
	}
	for (i = 0; i < M; i++) {
		fgets(p=buf, 40, stdin);
		a = getint()-1, p++, b = getint()-1;
		tbl[a].to[len[a]++] = b;
		tbl[b].to[len[b]++] = a;
	}
	dijkstra1();
	printf("%lld\n", dijkstra2(0, N-1));
	return 0;
}

Measured memory_bytes: 11376
#include <stdio.h>

int chArray[255];
int hash[1<<24];


int main(void)
{
    int n, q = 1, hash_num = 0;
    char command[12], ch;

    chArray['A'] = 1;
    chArray['C'] = 2;
    chArray['G'] = 3;
    chArray['T'] = 4;
    scanf("%d", &n);
    while(n) {
        scanf("%s", command);
        while((ch = getchar()) != '\n') {
            hash_num += chArray[ch] * q;
            q *= 4;
        }
        if(strcmp(command, "insert") == 0) {
            hash[hash_num] = 1;
        } else if(strcmp(command, "find") == 0) {
            if(hash[hash_num])
                printf("yes\n");
            else
                printf("no\n");
        }
        q = 1;
        hash_num = 0;
        n--;
    }

    return 0;
}

Measured memory_bytes: 23096
#include <iostream>
#include <algorithm>
#include <string>
#include <map>
using namespace std;
#define REP(i, N) for (int i = 0; i < N; i++)

int main() {
  int N;
  string S[100], res = "Yes";
  char tail;

  cin >> N;
  REP(i, N) cin >> S[i];

  REP(i, N) {
    REP(j, N) {
      if (i != j && S[i] == S[j]) {
        res = "No";
        break;
      }
    }
  }
  tail = S[0][0];
  for (int i = 0; i < N; i++) {
    if (tail != S[i][0]) {
      res = "No";
      break;
    }
    tail = S[i][S[i].length() - 1];
}
  cout << res << endl;
  
  return 0;

}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ALL(A) (A).begin(), (A).end()
#define ll long long
#define rep(i, n) for (int i = 0; i < (n); i++)

using namespace std;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }

const ll mod = 1e9 + 7;
const ll INF = -1 * ((1LL << 63) + 1);
const int inf = -1 * ((1 << 31) + 1);

int main(void){
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(20);
    int N,M;
    cin >> N >> M;
    vector<vector<ll>> jobs(M+1);
    for(int i=0;i<N;i++){
        int a,b;
        cin >> a >> b;
        if(a>M)continue;
        jobs[M-a].push_back(b);
    }
    priority_queue<int> q;
    ll ans = 0;
    for(int i=M;i>=0;i--){
        for(int b:jobs[i]){
            q.push(b);
        }
        if(!q.empty()){
            ans += q.top();
            q.pop();
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 5632
#include <bits/stdc++.h>
#define REP(i, n) for(int i=0; i<(int)(n); ++i)
#define FOR(i, s, n) for(int i=(int)(s); i<(int)(n); ++i)
#define ALL(n) (n).begin(), (n).end()
#define pb push_back

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> mat;

const ll MAX = 250000;
const ll INF = 1e9;
const ll MOD = 1e9+7;

ll fact[MAX+1], fact_inv[MAX+1];

ll pow_mod(ll n, ll r, ll p){
    // n^r mod p   O(logn)
    if (r == 0) return 1;
    if (r % 2 == 0) return pow_mod(n*n%p , r/2, p) % p;
    else return n * pow_mod(n, r-1, p) % p;
}

void factorial(ll n, ll p){
    fact[0] = 1;
    fact[1] = 1;
    FOR(i, 2, n+1) fact[i] = i * fact[i-1] % p;
    fact_inv[n] = pow_mod(fact[n], p-2, p);
    for(int i=n-1; i>=0; --i) fact_inv[i] = fact_inv[i+1] * (i+1) % p;
}

ll comb(ll n, ll r, ll p){
    // nCr mod p
    if (n < 0 || r < 0 || r > n) return 0;
    return (fact[n] * fact_inv[r] % p) * fact_inv[n-r] % p;
}


int main(){
    int h, w, a, b; cin >> h >> w >> a >> b;
    factorial(MAX, MOD);
    ll ans = 0;
    REP(i, h-a){
        ans += comb((b-1+i), i, MOD) * comb(h-1-i+(w-b-1), w-b-1, MOD) % MOD;
        ans %= MOD;
    }
    cout << ans << endl;
}


Measured memory_bytes: 4096
#include <bits/stdc++.h>
using namespace std;
string s,t,res;
int n;
int main()
{
    cin>>n>>s>>t;
    for (int i=0;i<n;++i) {
        res+=s[i];
        res+=t[i];
    }
    cout<<res<<endl;
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using ll=long long;
int n,m,k,c[1010],ans=1e9;
char a[15][1010];
int ok(int s){
	for(int i=0,j;i<n;){
		int tot=0;
		for(j=i;j<n;j++){
			tot+=c[j];
			if(s>>j&1)break;
		}
		if(tot>k)return 0;
		i=j+1;
	}
	return 1;
}
int main(){
	scanf("%d%d%d",&n,&m,&k);
	for(int i=0;i<n;i++)
		for(int j=0;j<m;j++)
			scanf(" %c",a[i]+j);
	for(int i=0;i<(1<<n-1);i++){
		int tot=0;
		for(int j=0;j<n-1;j++)if(i>>j&1)tot++;
		for(int j=0,k;j<m;){
			for(int t=0;t<n;t++)c[t]=a[t][j]-'0';
			for(k=j;k<m&&ok(i);k++){
				for(int t=0;t<n;t++)c[t]+=a[t][k+1]-'0';
			}
			if(j==k)goto fail;
			if(k<m)tot++;
			j=k;
		}
		ans=min(ans,tot);fail:;
	}
	cout<<ans<<endl;
	return 0;
}

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

using namespace std;

typedef  pair<int,int> P;
typedef long long LL;
typedef vector<LL> VEC;
typedef vector<VEC> VVEC;

const LL INF=1<<30;
const LL MOD=1000000007;


int b[20];


int main(){
    int n,m,c;
    cin>>n>>m>>c;
    int kazu=0;
    for(int i=0;i<m;++i)cin>>b[i];
    for(int j=0;j<n;++j){
        int ans=0;
    for(int i=0;i<m;++i){
        int a;cin>>a;
        ans+=b[i]*a;
        
    }
    if(ans>-c)kazu++;
    }

cout<<kazu<<endl;

}



Measured memory_bytes: 256
r_str = input()
r_str = r_str.split()
r = [int(s) for s in r_str]
a = 'Yes'
 
if r[0] <= r[1]:
    if r[0] <= r[2] and r[2] <= r[1]:
        a = 'Yes'
    else:
        a = 'No'
else:
    if r[1] <= r[2] and r[2] <= r[0]:
        a = 'Yes'
    else:
        a = 'No'
 
print(a)

Measured memory_bytes: 3060
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);

		String W = sc.next();
		int count = 0;

		while(sc.hasNext()) {  //hasNextメソッドはscannerの入力に別のトークンが残っている場合trueを返す
			String T = sc.next();

			if(T.contentEquals("END_OF_TEXT")) break;

		    T = T.toLowerCase();

		    if(T.equals(W)) count++;
		}

		System.out.println(count);
	}

}



Measured memory_bytes: 26380
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cctype>
#include <cstring>
#include <climits>
#include <iomanip>
#include <bitset>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <list>
#include <map>

using namespace std;

const int N = 100005;

int n, k;
int arr[N];
int memo[N][2];

bool dp(int x, int p) {
  if (x <= 0) return 0;
  if (memo[x][p] != -1) return memo[x][p];
  bool bad = 1;
  for (int i = 0; i < n; i++) {
    bad &= (x - arr[i] < 0);
  }
  if (bad) return memo[x][p] = 0;
  for (int i = 0; i < n; i++) {
    if (x >= arr[i] && !dp(x - arr[i], p ^ 1)) {
      return memo[x][p] = 1;
    }
  }
  return memo[x][p] = 0;
}

int main() {
  //freopen("input.txt", "r", stdin);
  //freopen("output.txt", "w", stdout);
  cin >> n >> k;
  for (int i = 0; i < n; i++) {
    cin >> arr[i];
  }
  memset(memo, -1, sizeof memo);
  if (dp(k, 0)) {
    cout << "First" << endl;
  } else {
    cout << "Second" << endl;
  }
  return 0;
}


Measured memory_bytes: 7296
# すべてのカードを用意
list_mark = ['S', 'H', 'C', 'D']
num_card_max = 13
set_card_all = {f"{mark} {str(i + 1)}" for mark in list_mark  for i in range(num_card_max)}

# 保有するカードを取得
N_card = int(input())
set_card_have = {input() for _ in range(N_card)}

# 持っていないカードの計算
set_card_not_have = set_card_all - set_card_have
list_card_not_have = list(set_card_not_have)
# print(list_card_not_have)

"""
絵柄がスペード、ハート、クラブ、ダイヤの順番で優先的に出力する。
絵柄が同じ場合は、ランクが小さい順に出力する。
"""

list_s = []
list_h = []
list_c = []
list_d = []

for mark_num in list_card_not_have:
    if mark_num[0] == 'S':
        num = int(mark_num[2:])
        list_s.append(num)
    elif mark_num[0] == 'H':
        num = int(mark_num[2:])
        list_h.append(num)
    elif mark_num[0] == 'C':
        num = int(mark_num[2:])
        list_c.append(num)
    else:
        num = int(mark_num[2:])
        list_d.append(num)

list_s.sort()
list_h.sort()
list_c.sort()
list_d.sort()

if len(list_s) != 0:
    for i in list_s:
        print(f"S {i}")
        
if len(list_h) != 0:
    for i in list_h:
        print(f"H {i}")
        
if len(list_c) != 0:
    for i in list_c:
        print(f"C {i}")
        
if len(list_d) != 0:
    for i in list_d:
        print(f"D {i}")




Measured memory_bytes: 5640
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
typedef long long int lli;
#define rep(i,s,N) for(int i=s;i<N;i++)
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; }
const long long INF = 1LL << 60;
vector<int> memo(100001, 0);
vector<bool> done(100001, false);
vector<int> h(100001);
int N;
int do_dp(int);
int main(void) 
{	
	cin >> N;
	rep(i, 0, N)cin >> h[i];
	cout << do_dp(N) << endl;
}

int do_dp(int n) 
{
	
	if (done[n]) {
		return memo[n];
	}
	else if (n == 1) {
		memo[1] = 0;
		done[1] = true;
		return 0;
	}
	else if (n == 2) {
		memo[2] = abs(h[1] - h[0]);
		done[2] = true;
		return memo[2];
	}else {
		memo[n] = min(do_dp(n - 1) + abs(h[n - 1] - h[n - 2]), do_dp(n - 2) + abs(h[n - 1] - h[n - 3]));
		done[n] = true;
		return memo[n];
	}

}

Measured memory_bytes: 4992
#include <bits/stdc++.h>
 
using namespace std;
#define fastio ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define ll long long int
#define pb push_back
#define MOD 1000000007
#define ull unsigned long long
#define all(x) (x).begin(), (x).end()
#define read(a, n) for(ll i = 0;i<n;i++) cin>>a[i];
#define debug1(x) cout<<#x<<" "<<x<<endl;
#define debug2(x,y) cout<<#x<<" "<<x<<" "<<#y<<" "<<y<<endl;
#define debug3(x,y,z) cout<<#x<<" "<<x<<" "<<#y<<" "<<y<<" "<<#z<<" "<<z<<endl;
#define print(x) for(auto it:x) cout<<it<<" "; cout<<<"\n";
#define FileIO freopen("input.txt","r",stdin);freopen("output.txt","w",stdout)
const int INF = 1e9 + 5;

void solve() {
	string s;
	cin>>s;
	
	ull sum = 0;
	for(auto i:s) {
		sum += (i-48);
	} 
	
	if(sum%9 == 0) cout<<"Yes\n";
	else cout<<"No\n";
}

int main()
{
	fastio;
	
	int T = 1;
	//cin>>T;
	
	while(T--) {
		solve();
	}	
	return 0;
}


Measured memory_bytes: 3780
import java.util.Scanner;
class Main{
    public static void main(String[] args) {
        Scanner scn=new Scanner(System.in);
       String a=scn.next();
        String b=scn.next();
        char[] ac=a.toCharArray();
        char[] bc=b.toCharArray();
        scn.close();
        String answer="YES";
        for(int i=0;i<3;i++){
            if(ac[i]!=bc[2-i]){
                answer="NO";
                break;
            }
        }
        System.out.println(answer);
    }
}


Measured memory_bytes: 23508
#include <iostream>
#include <string>
#include <sstream>
#include <vector>

struct st
{
    int m = -1;
    int f = -1;
    int r = -1;
    
    st(int m , int f, int r) : m(m), f(f), r(r) {}
    
    void print() const
    {
        char rank;
        
        if (m == -1 || f == -1)
            rank = 'F';
        else if (m + f >= 80)
            rank = 'A';
        else if (m + f >= 65)
            rank = 'B';
        else if (m + f >= 50)
            rank = 'C';
        else if (m + f >= 30)
        {
            if (r >= 50)
                rank = 'C';
            else
                rank = 'D';
        }
        else
            rank = 'F';
        
        std::cout << rank << std::endl;
    }
};

int main()
{
    std::vector<st> slist;
    
    while (true)
    {
        std::string temp;
        std::getline(std::cin, temp, '\n');
        std::stringstream ss;
        ss << temp;
        
        int loop = 0;
        int m, f, r;
        int* arr[3] = {&m, &f, &r};
        while (std::getline(ss, temp, ' '))
        {
            *(arr[loop++]) = std::stoi(temp);
        }
        
        if (m == -1 && f == -1 && r == -1)
            break;
        
        slist.push_back(st(m, f, r));
    }
    
    for (const auto& s : slist)
        s.print();
}


Measured memory_bytes: 3204
//------------------------------>> tsukasa_diary's template <<------------------------------//
#include <bits/stdc++.h>
using namespace std;

#define for_(i,a,b) for(int i=(a);i<(b);++i)
#define for_rev(i,a,b) for(int i=(a);i>=(b);--i)
#define allof(a) (a).begin(),(a).end()
#define minit(a,b) memset(a,b,sizeof(a))

using lint = long long;
using pii = pair< int, int >;

template< typename T > using Vec = vector< T >;

template< typename T > bool in_range(T x, T lb, T ub) { return lb <= x && x < ub; }
template< typename T > bool in_range(T x, T y, T lb, T ub) { return in_range(x, lb, ub) && in_range(y, lb, ub); }

template< typename T > void modAdd(T& a, T b, T mod) { a = (a + b + mod) % mod; }
template< typename T > void modMul(T& a, T b, T mod) { a = (a * b) % mod; }
template< typename T > void minUpdate(T& a, T b) { a = min(a, b); }
template< typename T > void maxUpdate(T& a, T b) { a = max(a, b); }

int bitCount(int x) { return __builtin_popcount(x); }
int bitCount(lint x) { return __builtin_popcountll(x); }

const int dx[4] = {0,1,0,-1}, dy[4] = {-1,0,1,0};
const int Dx[8] = {0,1,1,1,0,-1,-1,-1}, Dy[8] = {-1,-1,0,1,1,1,0,-1};
const double EPS = 1e-9;
const double PI = acos(-1);

//--------------8---------------->> coding space <<-----------------8-------------//

int N, M;
vector< vector< int > > edge;

int main() {
	cin >> N >> M;
	edge.assign(N, vector< int >());
	
	vector< int > in_deg(N, 0);
	
	for (int i=0; i<N+M-1; ++i) {
		int a, b;
		cin >> a >> b;
		--a; --b;
		
		in_deg[b]++;
		edge[a].push_back(b);
	}
	
	//
	vector< int > dst(N, -1);
	vector< int > ans(N, -1);
	
	for (int i=0; i<N; ++i) {
		if (in_deg[i] == 0) {
			//cerr << "ROOT " << i << endl;
			dst[i] = 0;
			ans[i] = 0;
			queue< int > que;
			que.push(i);
			
			while (!que.empty()) {
				int v = que.front(); que.pop();
				//cerr << "Search " << v << endl;
				for (int u : edge[v]) {
					dst[u] = dst[v] + 1;
					--in_deg[u];
					if (in_deg[u] == 0) que.push(u);
				}
			}
			
			break;
		}
	}
	
	for (int v=0; v<N; ++v) {
		for (int u : edge[v]) {
			if (dst[u] == dst[v] + 1) ans[u] = v+1;
		}
	}
	
	for (int v=0; v<N; ++v) cout << ans[v] << endl;
}
//--------------8---------------->> coding space <<-----------------8-------------//

Measured memory_bytes: 7424
#include<stdio.h>

int height, width;

int main() {
	for (;;) {
		scanf("%d %d", &height, &width);
		if (height == 0 || width == 0) break;

		for (int i = 1; i <= height; i++) {
			for (int j = 1; j <= width; j++) {
				if (j == 1)
					printf("#");
				else if (j == width)
					printf("#\n");
				else
					if (i == 1 || i == height)
						printf("#");
					else
						printf(".");
			}
		}
		printf("\n");
	}

	return 0;
}


Measured memory_bytes: 2056
#include<iostream>
#include<vector>
#include<string>
using namespace std;
int main() {
	int N;
	cin >> N;
	vector<float> x(N);
	vector<string> u(N);
	for (int i = 0; i < N; i++) {
		cin >> x[i] >> u[i];
	}
	float sum = 0;
	for (int i = 0; i < N; i++) {
		if (u[i] == "JPY")sum += x[i];
		else sum += x[i] * 380000;
	}
	cout << sum << endl;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)

#define loop(i,n)for(i=0;i<n;i++)
#define INF 1000000000
using ll = long long int;
typedef pair<int,int> pii;
typedef vector<pii> vii;
typedef vector<int> vi;


#define MAX 100005


int main()
{
    IOS;
    //freopen("inputfile.txt","r",stdin);
   int n;cin>>n;
   set<int>s;
   for(int i=0;i<n;i++)
   {
       int x;cin>>x;
       s.insert(x);
   }
   if(s.size()==n)cout<<"YES"<<endl;
    else cout<<"NO"<<endl;
    return 0;
}


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

using namespace std;

int main() 
{   
        string s;
        cin>>s;
        int q,cnt=0;
        cin>>q;
        deque <char> dq(s.length());
        for (int i=0;i<s.length();i++)
            dq[i] = s[i];
        while (q--)
        {
            int t,f;
            char c;
            cin>>t;
            if (t==1)
                cnt++;
            if (t==2)
            {
                cin>>f>>c;
                if ((f == 1 && cnt%2 == 0) || (f==2 && cnt%2 == 1)) dq.push_front(c);
                else dq.push_back(c);
            }
        }
        while (!dq.empty())
        {
            if (cnt % 2 == 0)
            {
                cout<<dq.front();
                dq.pop_front();
            }
            else{
                cout<<dq.back();
                dq.pop_back();
            }
        }
        return 0;
}

Measured memory_bytes: 896
{-# LANGUAGE BangPatterns #-}
{-# LANGUAGE BinaryLiterals #-}
{-# LANGUAGE MultiWayIf #-}
{-# LANGUAGE NumDecimals #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE TupleSections #-}

import Control.Applicative
import Control.Arrow
import Control.Monad
import Control.Monad.ST

import Data.Char
import Data.List
import Data.Maybe

import qualified Data.ByteString.Char8 as B

import Data.Array.ST.Safe
import Data.STRef

import Debug.Trace
import Text.Printf

readInt = readLn :: IO Int
readInts = map ( fst . fromJust . B.readInt ) . B.words <$> B.getLine
readNInts = readInt >>= flip replicateM readInt

which a b f = if f then a else b
mp [ a, b ] = ( a, b )

main = getLine >>= print . solve ""

solve _ [] = 0
solve leading (c:s)
	| leading /= "" && head leading /= c = 2 + solve ( drop 1 leading ) s
	| otherwise = solve ( c : leading ) s

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

double v[50];

int main(void){
  int n; cin >> n;
  for(int i = 0;i < n;i++)cin >> v[i];
  sort(v, v + n);
  double ave = v[0];
  for(int i = 1;i < n;i++)ave = (ave + v[i])/2.0;
  cout << ave << endl;
}

Measured memory_bytes: 256
#include<vector>
#include<iostream>
#include<string>
#include<algorithm>
#include<math.h>
#include<map>
#include<functional>
#include<queue>
#include<stack>
#include<string.h>
#include<list>
#define MOD 1000000007LL
using namespace std;
typedef long long int ll;
typedef pair<int,int> P;
int g(int n){
    if(n==2){
        return 1;
    }else if(n==4||n==6||n==9||n==11){
        return 2;
    }else{
        return 3;
    }
}
int main() {
    int x,y;
    cin>>x>>y;
    if(g(x)==g(y)){
        cout<<"Yes"<<endl;
    }else{
        cout<<"No"<<endl;
    }
}


Measured memory_bytes: 256
#include<stdio.h>
int main(void)
{
	int a,b,c,d,e,i,l,x;
	scanf("%d %d %d %d %d",&a,&b,&c,&d,&e);
	i=a;
	if(b<i){
		i=b;
	}
	if(c<i){
		i=c;
	}
	l=d;
	if(e<l){
		l=e;
	}
	x=i+l-50;
	printf("%d\n",x);
	return 0;
}

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

int main()
{
	long long int num,i,j,sum=0;
	
	cin >> num;
	i = num;
	
	for(;num!=0;)
	{
		j = num%10;
		sum+=j;
		num/=10;
	}
	
//	cout << sum;
	
	if(i%sum == 0) cout << "Yes";
	else cout << "No";
}

Measured memory_bytes: 3616