akhauriyash/Code-Regression huggingface dataset:
T=input()

result=[]

for i in range(len(T)):
    if T[i]=='?':
        if i==len(T)-1:
            result.append('D')
        elif i==0:
            if T[i+1]=='P':
                result.append('D')
            else:
                result.append('P')
        elif result[i-1]=='P':
            result.append('D')
        else:
            if T[i+1]=='P':
                result.append('D')
            else:
                result.append('P')
    else:
        result.append(T[i])

print(''.join(result))

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

int main() {
  	int X, Y;
  	cin >> X >> Y;
  	if (Y % 2 == 0){
    Y /= 2;
  	if (X <= Y && X * 2 >= Y) cout << "Yes" << endl;
  	else cout << "No" << endl;
    }
  	else cout << "No" << endl;
}

Measured memory_bytes: 3636
#include <bits/stdc++.h>
using namespace std;
#define modulo 1000000007
#define mod(mod_x) ((((long long)mod_x+modulo))%modulo)
#define Inf 10000000000000000



int main(){
	
	string s;
	cin>>s;
	
	string t = "CODEFESTIVAL2016";
	
	int ans = 0;
	
	for(int i=0;i<s.size();i++){
		if(s[i]!=t[i])ans++;
	}
	
	cout<<ans<<endl;

	return 0;
}

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

#define NREP() for(ll i = 0; i < n; i++)
#define REP(i, n) for(ll i = 0; i < n; i++)
#define ALL(x) (x).begin(), (x).end()
#define MSG(x) cout << x << endl;
#define IPT(x) ll t; cin >> t; x.push_back(t);
#define YN(x) x ? cout << "YES" << endl : cout << "NO" << endl;
#define Yn(x) x ? cout << "Yes" << endl : cout << "No" << endl;
#define yn(x) x ? cout << "yes" << endl : cout << "no" << endl;

using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef vector<string> vs;
typedef vector<string> vvs;

const static ll MOD = 1e9 + 7;

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

    set<ll> s;
    s.insert(a);
    s.insert(b);
    s.insert(c);

    MSG(s.size())
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ss second
#define ff first
#define all(x) x.begin(), x.end()

// #define DEBUG 100

using namespace std;
using ll = long long;
using pii = pair<int, int>;

const int oo = 1e9 + 7;
const ll mod = 1e9 + 7,maxn = 100010;
const double PI = acos(-1);


int main (){
    ios_base::sync_with_stdio(false);
    cin.tie(0); 
    int l, r, n;
    cin >> l >> r >> n;

    cout << r/n - (l-1)/n << endl;
    return 0;
}

Measured memory_bytes: 3636
import java.util.Arrays;
import java.util.Scanner;
import static java.lang.Math.*;

//Telescope
public class Main{

	int n, m, INF = 1<<29, s;
	double[] p;
	double[][] dp;
	
	double area(int i, int j){
		return sin((p[j]-p[i])*2*PI)/2;
	}
	
	double get(int j, int k){
		if(j==m-1)return area(k, s);
		if(dp[j][k]!=-INF)return dp[j][k];
		double max = -INF;
		for(int i=k+1;i<n;i++)max=max(max, area(k, i)+get(j+1, i));
		return dp[j][k] = max;
	}
	
	void run(){
		Scanner sc = new Scanner(System.in);
		for(;;){
			n = sc.nextInt(); m = sc.nextInt();
			if((n|m)==0)break;
			p = new double[n];
			for(int i=0;i<n;i++)p[i] = sc.nextDouble();
			double max = 0;
			for(int i=0;i<n;i++){
				dp = new double[m][n];
				for(double[]a:dp)Arrays.fill(a, -INF);
				s = i;
				max = max(max, get(0, s));
			}
			System.out.printf("%.6f\n", max);
		}
	}
	
	public static void main(String[] args) {
		new Main().run();
	}
}

Measured memory_bytes: 13000
#include <bits/stdc++.h>
#include <math.h>
#define _GLIBCXX_DEBUG
using namespace std;
int main() {
  
  int A,B,C;
  char x,y;
  cin>>A>>x>>B>>y>>C;
  
  if(A>2019){
    cout<<"TBD"<<endl;
  }
  else if(A==2019){
    if(B>4){
      cout<<"TBD"<<endl;
    }
    else if(B<=4){
      cout<<"Heisei"<<endl;
    }
  }
  else{
    cout<<"Heisei"<<endl;
  }
}

Measured memory_bytes: 3552
#include<bits/stdc++.h>
using namespace std;
 
int main() {
	int h;
	cin >> h;
	int w;
	cin >> w;
	vector<string> a(h);
	for (int i = 0; i < h; i++) {
		cin >> a[i];
	}
 
	vector<bool> row(h, false);
	vector<bool> col(w, false);
	for (int i = 0; i < h; i++) {
		for (int j = 0; j < w; j++) {
			if (a[i][j] == '#') {
				row[i] = true;
				col[j] = true;
			}
		}
	}
 
	for (int i = 0; i < h; i++) {
		if (row[i]) {
			for (int j = 0; j < w; j++) {
				if (col[j]) {
					cout << a[i][j];
				}
			}
			cout << endl;
		}
	}
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<vector>
using LL = long long;
LL N,w;
LL W, V;
LL size[4],ww[4];
LL ans;
std::vector<LL> dp[4];
void value(LL x, LL y, LL z, LL q) {
	LL sum = 0;
	for (LL aa = 0; aa < x; aa++) {
		sum += dp[0][aa];
	}
	for (LL aa = 0; aa < y; aa++) {
		sum += dp[1][aa];
	}
	for (LL aa = 0; aa < z; aa++) {
		sum += dp[2][aa];
	}
	for (LL aa = 0; aa < q; aa++) {
		sum += dp[3][aa];
	}
	ans = std::max(ans, sum);
	sum = 0;
}
void solve() {
	for (LL i = 0; i <= size[0]; i++) {
		for (LL j = 0; j <= size[1]; j++) {
			for (LL k = 0; k <= size[2]; k++) {
				for (LL l = 0; l <= size[3]; l++) {
					ww[0] = i*w;
					ww[1] = j*(w + 1);
					ww[2] = k*(w + 2);
					ww[3] = l*(w + 3);
					if ((ww[0] + ww[1] + ww[2] + ww[3]) <= W) {
						value(i, j, k, l);
					}
				}
			}
		}
	}
}
int main() {
	std::cin >> N >> W;
	std::cin >> w>> V;
	dp[0].push_back(V);
	for (LL i = 1; i < N; i++) {
		LL tmp,Q;
		std::cin >> tmp >> Q;
		dp[tmp-w].push_back(Q);
	}
	for (LL i = 0;  i < 4; i++) {
		std::sort(dp[i].rbegin(), dp[i].rend());
		size[i] = dp[i].size();
	}
	solve();
	std::cout << ans << std::endl;
	return 0;
}
 

Measured memory_bytes: 256
#include <iostream>
#include <stdio.h>
#include <algorithm>
#include <string.h>
#include <stack>
#include <math.h>
#define ll long long
using namespace std;
//char s[4]= {'R','G','B'};
//int main()
//{
//    int t,k,n;
//    cin>>t;
//    char str[10000];
//    while(t--)
//    {
//        int mx=0;
//        int num=0;
//        scanf("%d%d%s",&n,&k,str);
//        for(int i=0; i<3; i++)
//        {
//            for(int j=0; j<n; j++)
//            {
//                num=0;
//                if(j+k>n)
//                    break;
//                int ii=i,jj=j;
//                for(int l=0; l<k; l++)
//                {
//                    if(ii==3) ii=0;
//                    if(str[jj++]==s[ii++]) num++;
//                }
//                mx=max(mx,num);
//            }
//        }
//
//        printf("%d\n",k-mx);
//    }
//
//return 0;
//}
int main()
{
    stack<int>q;
    int a;
    cin>>a;
    if(a==0)
        printf("0\n");
    while(a)
    {
        int b=abs(a%(-2));
        q.push(b);
        a=(a-b)/(-2);
    }
    while(!q.empty())
    {
        printf("%d",q.top());
        q.pop();
    }
        return 0;

}


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

using namespace std;
typedef long long ll;
typedef pair<int, int> i_i;
typedef pair<ll, ll> l_l;
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
#define int ll
//const ll mod = 1000000007;

using namespace std;

int D,N;
signed main() {
    cin >> D >> N;
    if (N == 100) cout << 101;
    else cout << N;
    while(D) {
        cout << "00";
        D--;
    }
    cout << endl;
    return 0;
}


Measured memory_bytes: 256
import math
a, b, C = map(float,input().split())
S = 0.5 * a * b * math.sin(math.pi * C / 180)
L = math.sqrt(a * a + b * b - 2 * a * b * math.cos(math.pi * C / 180)) + a + b
h = 2 * S / a
print(S)
print(L)
print(h)



Measured memory_bytes: 5688
#include <bits/stdc++.h>
using namespace std;
typedef pair<int, int> P;
struct UnionFind {
    // 根を保存する（根のみ負値で木の大きさが保存される）
    vector<int> Parent;
 
    // 要素数Nで初期化
    UnionFind(int N) { Parent = vector<int>(N, -1); }

    // 根を求める
    int root(int A) {
        if (Parent[A] < 0) return A;
        else return Parent[A] = root(Parent[A]);
    }

    // 属する木の大きさ
    int size(int A) { return -Parent[root(A)]; }
 
    // 統合（rankでなくsizeで統合してるけどいいのか？）
    void unite(int A, int B) {
        A = root(A);
        B = root(B);
        if (A == B) return;
 
        if (size(A) < size(B)) swap(A, B);
 
        Parent[A] += Parent[B];
        Parent[B] = A;
    }
 
    // 同じ木に属するか
    bool same(int A, int B) { return root(A) == root(B); }
};

int main() {
    int n,k,l;
    cin >> n >> k >> l;

    UnionFind roads(1000000);
    UnionFind rails(1000000);

    int p,q,r,s;
    for (int i=0;i<k;i++) {
        cin >> p >> q;
        roads.unite(p,q);
    }
    for (int i=0;i<l;i++) {
        cin >> r >> s;
        rails.unite(r,s);
    }
    map<P,int> mp;
    for (int i=1;i<=n;i++) {
        mp[P(roads.root(i),rails.root(i))]++;
    }

    for (int i=1;i<=n;i++) {
        cout << mp[P(roads.root(i),rails.root(i))] << endl;
    }
}

Measured memory_bytes: 19968
H,W=map(int,input().split())
S=["."+input()+"." for i in range(H)]
S=["."*(W+2)]+S+["."*(W+2)]
flag=0
for i in range(H):
    for j in range(W):
        if S[i][j]=="#":
            if S[i-1][j]=="." and S[i+1][j]=="." and S[i][j-1]=="." and S[i][j+1]==".":
                flag=1
print("Yes" if flag==0 else "No")

Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n;
  cin>>n;
  if(n<105)cout<<'0'<<endl;
  else if(n<135)cout<<'1'<<endl;
  else if(n<165)cout<<'2'<<endl;
  else if(n<189)cout<<'3'<<endl;
  else if(n<195)cout<<'4'<<endl;
  else cout<<'5'<<endl;
  return 0;
}


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

#define rep(i, n) for (int i = 0; i < (n); ++i)
#define Rep(i, sta, n) for (int i = sta; i < n; ++i)

using namespace std;
typedef long long ll;
const int mod = 1000000007;

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

    int a[210010];
    rep(i, n) cin >> a[i];
    
    set<int> added;

    for(int i = n-1; i>=0; --i) {
        int now_val = a[i];
        int cnt = 0;
        for(int j = 2; ((i+1)*j)<=n; ++j) {
            int mul = (i+1) * j;
            auto it = added.find(mul);
            if (it != added.end()) cnt++;
        }
        //cout << i << " " << a[i] << " " << cnt << endl;
        if (a[i] != (cnt % 2)) added.insert(i+1);
    }   
    auto itr = added.begin();
    cout << added.size() << endl;
    while(itr!=added.end()) cout << *itr++ << " ";
    cout << endl;
    return 0;
}


Measured memory_bytes: 7808
#include<bits/stdc++.h>
#define ll long long int
using namespace std;
ll i, temp,t, n,j, mx, a[200600];
bool cond;
string s;
int main()
{
    //I am Monim, a tiny creature of Allah
    cin >> s;
    n = s.size();
    for(i=0;i<n;i++)
    {
        if(s[i]=='R')
            temp++;
        else
        {
            //cout << temp << endl;
            mx = max(mx, temp);
            temp = 0;
        }
    }
    cout << max(temp, mx) << endl;
    return 0;
}



Measured memory_bytes: 3628
#include <bits/stdc++.h>
using namespace std;
//#include <boost/multiprecision/cpp_int.hpp>
//using multiInt = boost::multiprecision::cpp_int;

using ll = long long int;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
template <typename Q_temp>
using smaller_queue = priority_queue<Q_temp, vector<Q_temp>, greater<Q_temp>>;

const ll MOD = (ll)(1e9 + 7);
const int INF = (int)1e9;
const ll LINF = (ll)4e18;
const double PI = acos(-1.0);

#define REP(i, m, n) for (ll i = m; i < (ll)(n); ++i)
#define rep(i, n) REP(i, 0, n)
#define MP make_pair
#define MT make_tuple
#define YES(n) cout << ((n) ? "YES" : "NO") << endl
#define Yes(n) cout << ((n) ? "Yes" : "No") << endl
#define Possible(n) cout << ((n) ? "Possible" : "Impossible") << endl
#define possible(n) cout << ((n) ? "possible" : "impossible") << endl
#define Yay(n) cout << ((n) ? "Yay!" : ":(") << endl
#define all(v) v.begin(), v.end()
#define NP(v) next_permutation(all(v))
#define dbg(x) cerr << #x << ":" << x << endl;

int main()
{
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << setprecision(20) << setiosflags(ios::fixed);
  ll n, k;
  cin >> n >> k;
  unordered_map<char, ll> point;
  cin >> point['r'];
  cin >> point['s'];
  cin >> point['p'];
  unordered_map<char, char> win;
  win['r'] = 'p', win['p'] = 's', win['s'] = 'r';
  string s;
  cin >> s;
  ll sum = 0;
  rep(start, k)
  {
    char before = '@';
    for (int i = start; i < n; i += k)
    {
      if (s[i] != before)
      {
        sum += point[win[s[i]]];
        before = s[i];
      }
      else
      {
        before = '@';
      }
    }
  }
  cout << sum << endl;
  return 0;
}


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

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    #define int long long
    int N, B, C, Q;
    long long s = 0;
    cin >> N;
    vector< int > v(N), count_vec(1e6);
    for (int i = 0; i < 1e6; ++i)
        count_vec[i] = 0;

    for (int i = 0; i < N; ++i) {
        cin >> v[i];
        s += v[i];
        count_vec[v[i]-1]++;
    }

    cin >> Q;
    while (Q--) {
        cin >> B >> C;
        if (count_vec[B-1] != 0) {
            s = s - (count_vec[B-1] * B) + (count_vec[B-1] * C);
            count_vec[C-1] += count_vec[B-1];
            count_vec[B-1] = 0;
        }
        cout << s << endl;
    }

    return 0;
}


Measured memory_bytes: 11848
//#include <ext/pb_ds/assoc_container.hpp> 
    // #include <ext/pb_ds/tree_policy.hpp> 
    #include <iostream>
    #include <iomanip>
    #include <sstream>
    #include <cstring>
    #include <vector>
    #include <deque>
    #include <queue>
    #include <set>
    #include <map>
    #include <valarray>
    #include <iterator>
    #include <functional>
    #include <limits>
    #include <algorithm>
    #include <numeric>
    #include <cmath>
    #include <cassert>
    #include <unordered_map>
    #include <unordered_set>
    #include <stack>
    using namespace std;
    #define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
    #define trace(x) cerr << #x << ": " << x << " " << endl;
     
    typedef int64_t ll;
     
    #define endl '\n'
    #define int ll
    ll mod=1e9+7;
    ll mod1=1e9+5;
     
    ll power(ll a,ll b)
    {
        if(b==0) return 1;
        else if(b%2==0)
            return power((((a%mod)*(a%mod))%mod),b/2)%mod;
        else return ((a%mod)*(power((((a%mod)*(a%mod))%mod),b/2)%mod))%mod;
    }
     
    // using namespace __gnu_pbds;
    // #define ordered_set tree<pair<int,int>, null_type,less<pair<int,int>>, rb_tree_tag,tree_order_statistics_node_update>
    //find_by_order(k)  returns iterator to kth element starting from 0;
    //order_of_key(k) returns count of elements strictly smaller than k;
    //erase,insert same as normal set
  
    int32_t main()
    {
        IOS
  
        
       int h,n;
       cin>>h>>n;
       int sum=0;
       for(int i=1;i<=n;++i)
       {
        int p;
        cin>>p;
        sum+=p;
       }
       if(sum>=h)
       {
        cout<<"Yes";
       }
       else
       {
        cout<<"No";
       }

    }       

Measured memory_bytes: 256
import sys
import math
from functools import reduce


def main():
    input = sys.stdin.readline
    K = int(input())
    assert 1 <= K <= 200
    total = 0
    for i in range(1, K+1):
        for j in range(1, K+1):
            a = euclidean_algorithm(i, j)
            for k in range(1, K+1):
                total += euclidean_algorithm(a, k)
    print(total)


def euclidean_algorithm(a, b):
    r = a % b
    while r != 0:
        a = b
        b = r
        r = a % b
    return b


if __name__ == "__main__":
    main()


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

using namespace std;

#define FAST() ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)

int main()
{
    FAST();
    int i,n,x,y,a[200005],b[200005];
    cin >> n;
    for(i=0;i<n;i++)cin >> a[i] >> b[i];
    sort(a,a+n);
    sort(b,b+n);
    x=a[n/2],y=b[n/2];
    if(n%2 == 0)x+=a[n/2-1],y+=b[n/2-1];
    cout << y-x+1;
    return 0;
}


Measured memory_bytes: 5180
#include <iostream>
#include <vector>
#include <iomanip>
#include <set>
#include <map>
#include <algorithm>
#include <utility>
#include <cmath>
#include <deque>

using namespace std;

long long mod = 1e5 + 7;
long long p = 31;
long long st;

pair<long long, deque<char> > next_(pair<long long, deque<char> > x) {
    long long h = x.first;
    deque<char> cur = x.second;
    long long l = (long long) cur.front();
    h -= (l * st) % mod;
    if (h < 0) {
        h += mod;
        h %= mod;
    }
    h *= p;
    h %= mod;
    h += l;
    h %= mod;
    cur.push_back(cur.front());
    cur.pop_front();
    return {h, cur};
}

long long mxd(long long x) {
    long long y = x;
    long long mx = 0;
    while (y > 0) {
        mx = max(mx, y % 10);
        y /= 10;
    }
    return mx;
}

long long mnd(long long x) {
    long long y = x;
    long long mx = 11;
    while (y > 0) {
        mx = min(mx, y % 10);
        y /= 10;
    }
    return mx;
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    int a;
    string s;
    cin >> a >> s;
    if ((int)s.size() > a) {
        for (int i = 0; i < a; ++i) {
            cout << s[i];
        }
        cout << "...\n";
    } else {
        cout << s << '\n';
    }
    return 0;
}


Measured memory_bytes: 3060
N = int(input())
T,A = map(int, input().split())
min = 10000000000
c=0
for i in list(map(int,input().split())):
    c+=1
    a = T-i*0.006
    if A-a>=0: b=A-a
    else: b=a-A
    if b < min: 
        min = b
        answer = c
print(answer)

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

N = int(input())

task_list = [[0, 0]] * N

for i in range(N):
    task_list[i] = list(map(int, input().split()))

sorted_list = sorted(task_list, key=lambda x: x[1])

goodjob = True
time = 0
for (a_i, b_i) in sorted_list:
    time += a_i
    if time > b_i:
        goodjob = False
        break

if goodjob:
    print("Yes")
else:
    print("No")


Measured memory_bytes: 55196
#include<iostream>
#include<algorithm>
#include<vector>
#include<string.h>
#include<math.h>
#include<map>

using namespace std;
	
int main(){
	int n;
	cin >> n;
	
	vector<long long> a(n);
	
	for(int i=0;i<n;i++){
		cin >> a[i];
	}

	map<int,int> mp;
	
	for(int i=0;i<n;i++){
		mp[a[i]]++;
	}
	
	int cnt_max=0;
	
	for(int i=2;i<=100000;i++){
		int now_sum=mp[i]+mp[i-1]+mp[i-2];
		cnt_max=max(cnt_max,now_sum);
	}
	
	cout << cnt_max << endl;
	return 0;
}


Measured memory_bytes: 5760
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int H, W;
  cin >> H >> W;
  
  vector<string> vec(H);
  
  for (int i = 0; i < W + 2; i++) {
    cout << "#";
  }
  cout << endl;
  
  for (int j = 0; j < H; j++) {
    cin >> vec.at(j);
    cout << "#" << vec.at(j) << "#" << endl;
  }
  
   for (int i = 0; i < W + 2; i++) {
    cout << "#";
  }
  cout << endl;
  
}


Measured memory_bytes: 256
N = gets.to_i
A = gets.split.map(&:to_i)

n = N
f = A.count{ |a| a % 4 == 0 }
e = A.count{ |a| a % 2 == 0 }
o = N - e
t = e - f

ans = "Yes"

b = Array.new(N+1)
b[0] = 4

1.upto N do |i|
  
  if b[i-1] % 4 == 0
    if o > 0
      o -= 1
      b[i] = 1
    elsif t > 0
      t -= 1
      b[i] = 2
    else
      f -= 1
      b[i] = 4
    end
  elsif b[i-1] % 4 == 2
    if t > 0
      t -= 1
      b[i] = 2
      elsif f > 0
      f -= 1
      b[i] = 4
    else
      ans = "No"
      break
    end
  else
    if f > 0
      f -= 1
      b[i] = 4
    else
      ans = "No"
      break
    end
  end
end
    
puts ans


Measured memory_bytes: 9228
#include <algorithm>
#include <cmath>
#include <iostream>
#include <string>
#include <vector>
typedef long long ll;
#define all(x) (x).begin(), (x).end()  // sortなどの引数を省略
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define max3(x, y, z) max(x, max(y, z))

#ifdef _MSC_FULL_VER  //デバッグ出力
#define dout cout
#define debug() if (true)
#define check(x) std::cout << "★" << #x << "の値:" << (x) << endl
#define pass(x) std::cout << "☆" << x << endl
#else
#define dout \
  if (false) cout
#define debug() if (false)
#define check(x) \
  if (false) cout << "★" << #x << "の値:" << (x) << endl
#define pass(x) \
  if (false) cout << "☆" << x << endl
#endif
using namespace std;
int main() {
  int a,b,c;
  cin >> a >> b >> c;
  cout << min(b/a,c);
}
  /*
//よく使うやつ
int N;
cin >> N;
vector<int> list(N);
for (int i = 0; i < N; i++) {
cin >> list[i];
}
// for文
for (int i = 0; i < N; i++) {
}
//配列
vector<int> list;
list.at(i)
vector<vector<int>> list(10, vector<int>(10));
sort(all(list));
sort(all(list), greater<int>());
  //配列の内容表示
dout << "====listの内容====\n";
for (int i = 0; i < N; i++) dout << list[i] << endl;
dout << "====ここまで====\n";
*/


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

for i in range(k, n+2):
  min = int(i * (i - 1) / 2) #等差数列の和
  max = int(i * (2 * n - i + 1) / 2)
  cnt += max - min + 1

print(cnt % mod)


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

class Program
{
    static void Main(string[] args)
    {
        var N = int.Parse(Console.ReadLine());
        var A = new List<int>();
        var line = Console.ReadLine().Split(" ");
        for (int i = 0; i < N; i++)
        {
            A.Add(int.Parse(line[i]));
        };

        var withSteps = new List<int>();
        for (int i = 0; i < N; i++)
        {
            withSteps.Add(-1);
        }

        withSteps[0] = A[0];
        for (int i = 1; i < N; i++)
        {
            if(withSteps[i - 1] > A[i])
            {
                withSteps[i] = withSteps[i - 1];
            }
            else
            {
                withSteps[i] = A[i];
            }
        }

        long total = 0;
        for (int i = 0; i < N; i++)
        {
            total += withSteps[i] - A[i];
        }

        Console.WriteLine(total);

    }
}


Measured memory_bytes: 49332
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < n; i++)
#define all(v) v.begin(), v.end()
int h, w, k;

bool check(bitset<6> &s, bitset<6> &t, vector<vector<char>> &c){
    int cnt = 0;
    rep(i, h){
        //bitが1だったらそこは数えない
        if (s.test(i)) continue;
        rep(j, w){
            if (t.test(j)) continue;
            if (c[i][j] == '#') cnt++;
        }
    }
    return cnt == k;
}

int main(){
    cin >> h >> w >> k;
    vector<vector<char>> c(h, vector<char>(w));
    rep(i, h){
        rep(j, w){
            cin >> c[i][j];
        }
    }

    int res = 0;
    //bit全探索で塗る部分を決める
    for (int i = 0; i < (1 << h); i++){
        bitset<6> s(i);
        for (int j = 0; j < (1 << w); j++){
            bitset<6> t(j);
            if (check(s, t, c)) res++;
        }
    }
    cout << res << endl;
}

Measured memory_bytes: 3636
import java.util.Scanner;
import java.util.Arrays;
public class Main{
  public static void main(String[] args){
    Scanner sc =new Scanner(System.in);
    int n = sc.nextInt();
    int[] a = new int[n];
    for(int i =0; i<n;i++){
      a[i]=sc.nextInt();
    }
    Arrays.sort(a);
    int alice=0, bob=0;
    for(int i =0; i<n;i++){
      if(i%2==0){
        alice+=a[n-1-i];
      }else{
        bob+=a[n-1-i];
      }
    }
    System.out.println(alice-bob);
  }
}

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

using i64=int64_t;

#define rep(i,x,y) for(i64 i=i64(x),i##_max_for_repmacro=i64(y); i<i##_max_for_repmacro; ++i)
#define debug(x) #x << "=" << (x)
 
#ifdef DEBUG
#define _GLIBCXX_DEBUG
#define print(x) std::cerr << debug(x) << " (L:" << __LINE__ << ")" << std::endl
#else
#define print(x)
#endif
 
const int inf=1.01e9;
const i64 inf64=4.01e18;
const double eps=1e-9;
 
template <typename T> ostream &operator<<(ostream &os, const vector<T> &vec){
    os << "[";
    for (const auto &v : vec) {
        os << v << ",";
    }
    os << "]";
    return os;
}

vector<long long int> prime_factor(long long int n){
    vector<long long int> res;
    for(int i=2; i*i<=n; ++i){
        while(n%i==0){
            res.push_back(i);
            n/=i;
        }
    }
    if(n!=1) res.push_back(n);
    return res;
};


void solve(){
    i64 K;
    cin >> K;

    vector<vector<pair<int,i64>>> graph(K);
    rep(i,0,K){
        graph[i].push_back(make_pair((i+1)%K,1));
        graph[i].push_back(make_pair(i*10%K,0));
    }

    vector<i64> dist(K,inf64);
    deque<pair<int,i64>> dq;
    dist[1]=0;
    dq.push_back(make_pair(1,0));
    for(;;){
        int x=dq.front().first;
        i64 d=dq.front().second;
        dq.pop_front();

        if(x==0){
            cout << d+1 << endl;
            return;
        }

        if(d>dist[x]) continue;

        for(auto& edge:graph[x]){
            int y=edge.first;
            i64 cost=edge.second;
            if(d+cost>=dist[y]) continue;
            dist[y]=d+cost;
            if(cost==0) dq.push_front(make_pair(y,dist[y]));
            else dq.push_back(make_pair(y,dist[y]));
        }
    }
}

int main(){
    std::cin.tie(0);
    std::ios::sync_with_stdio(false);
    cout.setf(ios::fixed);
    cout.precision(16);
    solve();
    return 0;
}


Measured memory_bytes: 8832
#include<cstdio>
#include<algorithm>
using namespace std;
const int maxn=100005,maxm=200005;
int n,m;
struct edge{
  int to,next;
}lst[maxm];int len=1,first[maxn];
void addedge(int a,int b){
  lst[len].to=b;lst[len].next=first[a];first[a]=len++;
}
int seq[maxn],cnt=0;
bool vis[maxn];
void dfs(int s){
  vis[s]=true;seq[++cnt]=s;
  for(int pt=first[s];pt;pt=lst[pt].next){
    if(!vis[lst[pt].to]){
      dfs(lst[pt].to);
      return;
    }
  }
}
int main(){
  scanf("%d%d",&n,&m);
  for(int i=1,a,b;i<=m;++i){
    scanf("%d%d",&a,&b);addedge(a,b);addedge(b,a);
  }
  dfs(1);
  for(int i=1;i*2<=cnt;++i)swap(seq[i],seq[cnt-i+1]);
  --cnt;
  dfs(1);
  printf("%d\n",cnt);
  for(int i=1;i<=cnt;++i){
    printf("%d ",seq[i]);
  }
  return 0;
}


Measured memory_bytes: 3072
#include<cstdio>
#include<cstdlib>
#include<cmath>
#include<iostream>
#include<algorithm>
#include<cstring>
#include<string>
using namespace std;
int main(){
	int n,a,b,c,d,ans;
	while(~scanf("%d",&n)){
		ans=0;
		a=n/1000;
		b=(n/100)%10;
		c=(n/10)%10;
		d=n%10;
		if(a==b&&b==c) ans=1;
		else if(b==c&&c==d) ans=1;
		if(ans==1) printf("Yes\n");
		else printf("No\n");
	}
}

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

using namespace std;

int main() {
    int a, n;
    cin >> n;
    vector<int> vec(n);
    for (int i = 0; i < n; ++i) {
        cin >> a;
        vec.at(i) = a;
    }
    sort(vec.begin(), vec.end());
    int min = vec.at(0);
    reverse(vec.begin(), vec.end());
    int max = vec.at(0);
    cout << max - min << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <string>
#include <limits.h>
#include <math.h>
#include <vector>
#include <algorithm>
#include <map>
#include <numeric>

using namespace std;


unsigned long long gcd(unsigned long long x, unsigned long long y){
  unsigned long long r;
  if (x>y){
    while((r=x%y)!=0){
      x=y;
      y=r;
    }
    return y;
  }else{
    while((r=y%x)!=0){
      y=x;
      x=r;
    }
    return x;
  }
}

unsigned long long int lcm(unsigned long long a, unsigned long long b){
  return ( a*(b/gcd(a,b)) );

}

int main(int argc, char* argv[]){
  int i,N;//Lcm:最小公倍数
  cin >> N;
  unsigned long long Lcm = 1;
  unsigned long long T[N];
  for(i=0; i<N; i++){
    cin >> T[i];
    // cout << "T[i] = " << T[i] << endl;
    Lcm = lcm(Lcm, T[i]);
    // cout << "Lcm = " << Lcm << endl;
  }

  cout << Lcm << endl;

  return 0;
}


Measured memory_bytes: 256
import math

a, b, c, d = map(int, input().split())

m = b//c + (-a//c)
n = b//d + (-a//d)
g = c * d // math.gcd(c, d)
p = b//g + (-a//g) 
print(b-a+1-(m+1+n+1-(p+1)))

Measured memory_bytes: 9124
#include<iostream>
#include<vector>
#include<string>

using namespace std;

int main(void){
  vector<string> res;
  vector<int> rei;
  string maxstr;
  string inp;
  while(cin>>inp){
    if(maxstr.size() < inp.size()){
      maxstr = inp;
    }
    bool used = true;
    for(int i = 0 ; i < res.size() ; i ++){
      if(res[i] == inp){
	rei[i]++;
	used = false;
      }
    }
    if(used){
      res.push_back(inp);
      rei.push_back(1);
    }
  }
  string sizee = "";
  int maxw = 0;
  for(int i = 0 ; i < res.size() ; i ++){
    if(maxw < rei[i]){
      sizee = res[i];
      maxw = rei[i];
    }
  }
  cout<<sizee<<" "<<maxstr<<endl;
  
}

Measured memory_bytes: 1212
// #pragma GCC optimize("unroll-loops", "omit-frame-pointer", "inline")
// #pragma GCC option("arch=native", "tune=native", "no-zero-upper")
// #pragma GCC
// target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2,tune=native")
// #pragma GCC optimize("Ofast")
// #pragma GCC optimize("tree-vectorize","openmp","predictive-commoning")
// #pragma GCC option("D_GLIBCXX_PARALLEL","openmp")
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef pair<int, int> P;
typedef vector<int> vi;
typedef vector<ll> vll;
// #define int long long
#define pb push_back
#define mp make_pair
#define eps 1e-9
#define INF 2000000000               // 2e9
#define LLINF 2000000000000000000ll  // 2e18 (llmax:9e18)
#define fi first
#define sec second
#define all(x) (x).begin(), (x).end()
#define sq(x) ((x) * (x))
#define dmp(x) cerr << #x << ": " << x << endl;

template <class T>
void chmin(T &a, const T &b) {
  if (a > b) a = b;
}
template <class T>
void chmax(T &a, const T &b) {
  if (a < b) a = b;
}

template <class T>
using MaxHeap = priority_queue<T>;
template <class T>
using MinHeap = priority_queue<T, vector<T>, greater<T>>;
template <class T>
vector<T> vect(int len, T elem) {
  return vector<T>(len, elem);
}

template <class T, class U>
ostream &operator<<(ostream &os, const pair<T, U> &p) {
  os << p.fi << ',' << p.sec;
  return os;
}
template <class T, class U>
istream &operator>>(istream &is, pair<T, U> &p) {
  is >> p.fi >> p.sec;
  return is;
}
template <class T>
ostream &operator<<(ostream &os, const vector<T> &vec) {
  for (int i = 0; i < vec.size(); i++) {
    os << vec[i];
    if (i + 1 < vec.size()) os << ' ';
  }
  return os;
}
template <class T>
istream &operator>>(istream &is, vector<T> &vec) {
  for (int i = 0; i < vec.size(); i++) is >> vec[i];
  return is;
}
void fastio() {
  cin.tie(0);
  ios::sync_with_stdio(0);
  cout << fixed << setprecision(20);
}

#define endl "\n"

void solve() {
  int N, M;
  cin >> N >> M;
  if (N % 2 == 1) {
    for (int i = 0; i < M; i++) { cout << 1 + i << ' ' << N - 1 - i << endl; }
  } else {
    int K = (N - 2) / 2;
    vector<int> w;
    for (int i = 0; i < (K + 1) / 2; i++) { w.push_back(N - 1 - 2 * i); }
    for (int i = 0; i < K / 2; i++) { w.push_back((i + 1) * 2); }
    sort(all(w));
    reverse(all(w));
    // dmp(w);
    for (int i = 0; i < M; i++) {
      cout << i + 1 << ' ' << i + 1 + w[i] << endl;
    }
  }
  return;
}

signed main() {
  fastio();
  solve();
  // int t; cin >> t; while(t--)solve();

  // int t; cin >> t;
  // for(int i=1;i<=t;i++){
  //   cout << "Case #" << i << ": ";
  //   solve();
  // }
  return 0;
}


Measured memory_bytes: 3752
#include <bits/stdc++.h>
#define MAX_V 10000
#define INF 1e9
using namespace std;

struct edge{int to, cap,cost,rev;};
int V;
vector<edge> G[MAX_V];
int dist[MAX_V];
int prevv[MAX_V],preve[MAX_V];

void add_edge(int from,int to,int cap,int cost){
  G[from].push_back((edge){to,cap,cost,G[to].size()});
  G[to].push_back((edge){from,0,-cost,G[from].size()-1});
}

int min_cost_flow(int s,int t,int f){
  int res=0,pre=0;
  while(f>0){
    fill(dist,dist+V,INF);
    dist[s]=0;
    bool update = true;
    while(update){
      update = false;
      for(int v=0; v<V ;v++){
	if(dist[v]==INF) continue;
	for(int i=0; i<G[v].size(); i++){
	  edge &e = G[v][i];
	  if(e.cap > 0 && dist[e.to] > dist[v]+e.cost) {
	    dist[e.to] = dist[v] + e.cost;
	    prevv[e.to] = v;
	    preve[e.to] = i;
	    update = true;
	  }
	}
      }
    }
    if(dist[t]==INF) return res;

    int d = f;
    for(int v=t; v!=s; v=prevv[v])d=min(d,G[prevv[v]][preve[v]].cap);
    f -= d;
    res += d*dist[t];
    for(int v=t; v!=s; v=prevv[v]){
      edge &e = G[prevv[v]][preve[v]];
      e.cap -= d;
      G[v][e.rev].cap += d;
    }
    if(res>pre) return pre;
    pre=res;
  }
  return res;
}

int main(){
  int n,A[1001],B[1001];
  cin>>n;
  set<int> S;
  for(int i=0;i<n;i++){
    cin>>A[i]>>B[i];
    S.insert(A[i]),S.insert(B[i]);
  }
  vector<int> num;
  for(set<int>::iterator it=S.begin();it!=S.end();it++) num.push_back(*it);
  
  int s=3*n+num.size(),t=s+1;
  for(int i=0;i<n;i++){
    int a=lower_bound(num.begin(),num.end(),A[i])-num.begin();
    int b=lower_bound(num.begin(),num.end(),B[i])-num.begin();
    add_edge(s,i,1,0);
    add_edge(i,n+i*2,1,0);
    add_edge(i,n+i*2+1,1,0);
    add_edge(n+i*2,3*n+a,1,-B[i]);
    add_edge(n+i*2+1,3*n+b,1,-A[i]);
  }
  for(int i=0;i<num.size();i++)add_edge(3*n+i,t,1,0);

  V = 3*n+num.size()+2;
  cout<<-min_cost_flow(s,t,INF)<<endl;

  return 0;
}

Measured memory_bytes: 3932
#include<cstdio>
#include<iostream>
#include<algorithm>
#include<string>
#include<cstring>
#include<cmath>
#include<map>
#include<vector>
#include<utility>
#include<queue>
#include<stack>
#include<set>
#include<ctime>
#include<unordered_map>
const  int N = 2e6*1.0;
const int mod = 1e9 + 7;
const int INF = 0x3f3f3f3f;
typedef long long ll;
typedef long double lw;
#define sc(n) scanf("%d",&n)
#define fo(i,a,b) for(int i=a;i<b;i++)
#define mem(a,b) memset(a,b,sizeof a)
using namespace std;
int a,p;
int main()
{
	cin>>a>>p;
	cout<<(a*3+p)/2<<endl;
	return 0;
 } 

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

int main(){
	long long int h,k,p,ans;
	std::cin>>h;

	if (h == 1) {
		std::cout << 1 << std::endl;
		exit(0);
	}

	if (h % 2 == 1) {
		h = h - 1;
	}

	k = 2;
	p = 4;
	ans = 3;

	for (int i = 0; i < 44; i++) {
		
		if (k <= h&&h < p) {
			std::cout << ans << std::endl;
			exit(0);
		}
		ans = ans * 2 + 1;
		k = k * 2;
		p = p * 2;
	}

	return 0;
}

Measured memory_bytes: 256
#include<iostream>
//#include<string>
//#include<array>
#include<algorithm>
//#include<deque>
#include<vector>
//#include<utility>
//#include<set>
//#include<map>
//#include<list>

int main(void) {
	using namespace std;
	int a,b;
	bool res = false;
	vector<int>vec;
	for (int i = 0; i < 6;i++) {
		cin >> a;
		vec.push_back(a);
	}
	for (int i = 1; i < 5;i++) {
		b = count(vec.begin(), vec.end(), i);
		if (b > 2) {
			res = true;
		}
	}
	if (res) {
		cout << "NO" << endl;
	}
	else {
		cout << "YES" << endl;
	}
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int[] h = new int[n+1];
		h[0] = 0;
		for(int i = 1; i < n+1; i++)
			h[i] = sc.nextInt();
		
		int count = 0;
		for(int i = 1; i < h.length; i++) {
			boolean ok = true;
			for(int j = 0; j < i; j++) {
				if(h[i] < h[j]) {
					ok = false;
					break;
				}
			}
			if(ok)
				count++;
		}
		System.out.println(count);
	}
}


Measured memory_bytes: 23124
#include<stdio.h>

int main() {
	int i, j, k, n, t, m, h, w, g;
	int r, d, x;
	int f = 0;

	scanf("%d %d %d", &r, &d, &x);

	for (i = 0;i < 10;i++) {
		x = r * x - d;
		printf("%d\n", x);
	}



	return 0;
}

Measured memory_bytes: 128
#define _USE_MATH_DEFINES
#include<iostream>
#include<string>
#include<queue>
#include<cmath>
#include<map>
#include<set>
#include<list>
#include<iomanip>
#include<vector>
#include<random>
#include<functional>
#include<algorithm>
#include<stack>
#include<cstdio>
#include<cstring>
#include<bitset>
#include<unordered_map>
#include<climits>
#include<fstream>
#include<time.h>
#include<cassert>

using namespace std;
#define ll long long
#define ld long double
#define int long long
#define all(a) (a).begin(),(a).end()
#define EPS (1e-13)
#define fs first
#define sc second
#define xx first
#define yy second.first
#define zz second.second
#define H pair<int, int>
#define P pair<int, pair<int, int>>
#define Q(i,j,k) mkp(i,mkp(j,k))
#define rep(i,n) for(int (i) = 0 ; (i) < (n) ; (i)++)
#define mkp make_pair
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define crdcomp(b) sort(all((b)));(b).erase(unique(all((b))),(b).end())
#define ssp(i,n) (i==n-1?"\n":" ")
const int mod = 1e9 + 7;
const int Mod = 998244353;
const ll Inf = 3 * 1e18;
const int inf = 15 * 1e8;
ll read() {
	ll u, k = scanf("%lld", &u);
	return u;
}
ll gcd(ll i, ll j) {
	if (i > j) swap(i, j);
	if (i == 0) return j;
	return gcd(j % i, i);
}
ll mod_pow(ll x, ll n, ll p) {
	ll res = 1;
	while (n > 0) {
		if (n & 1) res = res * x % p;
		x = x * x % p;
		n >>= 1;
	}
	return res;
}
ll bcount(ll x) {
	int sum = 0;
	for (int i = 0; i < 20; i++)
		if ((1ll << i) & x) sum++;
	return sum;
}
const int fn_ = 2000000;
ll fact_[fn_], comp_[fn_];
ll comb(ll x, ll y, ll Mod = mod) {
	if (!fact_[0]) {
		fact_[0] = 1; comp_[0] = 1;
		for (int i = 1; i < fn_; i++) {
			fact_[i] = fact_[i - 1] * i % Mod;
			comp_[i] = mod_pow(fact_[i], Mod - 2, Mod);
		}
	}
	if (x < y) return 0;
	return fact_[x] * comp_[x - y] % Mod * comp_[y] % Mod;
}
//---------------------------------------------------
int a, b;
signed main() {
	a = read(), b = read();
	cout << max({ a + b,a - b,a * b }) << endl;
}

Measured memory_bytes: 256
while 1:
    n = input()
    if n == 0: break
    l = [0,0]
    l += [input()]
    l += [1]
    for i in range(n-1):
        x = input()
        if i % 2 == 1:
            if l[-2] == x: l[-1] += 1
            else: l += [x]; l += [1]
        else:
            if l[-2] == x: l[-1] += 1
            else:
                if len(l) > 2:
                    l[-3] += l[-1] + 1
                    l = l[:-2]
                else:
                    l[-2] = x
                    l[-1] += 1
    ans = 0
    for i in range(len(l)/2):
        if l[i*2] == 0: ans += l[i*2 + 1]
    print ans

Measured memory_bytes: 9416
s = input()
x,y = map(int,input().split())

move = [0]
for si in s:
    if(si  == 'F'):
        move[-1] += 1
    else:
        move.append(0)

move_x = move[2::2]
move_y = move[1::2]
for a,move_a in zip([x-move[0],y],[move_x,move_y]):
    m_max = sum(move_a)
    if(m_max < abs(a)):
        print('No')
        exit()

    dp = 2**m_max
    for mi in move_a:
        dp = (dp<<mi) | (dp>>mi)

    if(dp >> (m_max+a))&1:
        continue
    else:
        print('No')
        exit()

print('Yes')

Measured memory_bytes: 73900
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <queue>
#include <cmath>

#define min(x, y)  (((x) < (y)) ? (x) : (y))
#define INF 100000000


int travel[202];
int dp[202][202];
int tsl[(1<<8)+5][10]; //[now][past-sets]
int ans[202];
int n, m, r;


void warshall_floyd() {
	for (int k = 0; k < n; k++) {
		for (int i = 0; i < n; i++) {
			for (int j = 0; j < n; j++) {
				dp[i][j] = min(dp[i][j], dp[i][k] + dp[k][j]);
			}
		}
	}
	return;
}


int tsp(int start){
	for (int i = 0; i < (1<<r); i ++) for (int j = 0; j < r; j++)tsl[i][j] = INF;
	
	tsl[1<<start][start] = 0;
	for (int S = (1<<start); S < (1<<r); S++) {
		for (int u = 0; u < r; u++) {
			for (int v = 0; v < r; v++){
				if ((S & (1<<u)) != 0) { // u in S & v not in S
					tsl[S|(1<<v)][v] = min(tsl[S|(1<<v)][v], tsl[S][u] + dp[travel[u]][travel[v]]);
				}
			}
		}
	}
	int ans=tsl[(1<<r)-1][0];
	for (int i = 1; i < r; i++) ans = min(ans, tsl[(1<<r)-1][i]);
	return ans;
}

int main(){
	int i, j, k, a, b, c;
	
	scanf("%d %d %d\n", &n, &m, &r);
	for (i = 0; i < r; i++) {
		scanf("%d", &travel[i]);
		travel[i] -= 1;
	}
	for (i = 0; i < n; i++) {
		for (j = 0; j < n; j++) {
			if (i == j) dp[i][j] = 0;
			else dp[i][j] = INF;
		}
	}
	for (i = 0; i < m; i++) {
		scanf("%d %d %d\n", &a, &b, &c);
		a -=1; b -= 1;
		dp[a][b] = c;
		dp[b][a] = c;
	}

	warshall_floyd();
	int ans = tsp(0);
	for (i = 1; i < r; i++) ans = min(ans, tsp(i));
	printf("%d\n", ans);

	return 0;
}


Measured memory_bytes: 384
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApp2
{
    class Program
    {
        static void Main(string[] args)
        {
            int N;
            bool isFour = false;
            N = int.Parse(Console.ReadLine());
            string[] str = Console.ReadLine().Split(' ');
            for(int i = 0; i < str.Length; ++i)
            {
                if("Y" == str[i])
                {
                    isFour = true;
                }
            }

            if(true == isFour)
            {
                Console.WriteLine("Four");
            }
            else
            {
                Console.WriteLine("Three");
            }
        }
    }
}


Measured memory_bytes: 13140
import java.util.*;
 
public class Main {
	
    public static void main(String[] args) {
    	Scanner sc = new Scanner(System.in);
    	String S = sc.next();
    	String T = sc.next();
    	String T1 = T.substring(0, S.length());
    	if (S.length() + 1 == T.length() && S.equals(T1)) {
    		System.out.println("Yes");
    	} else {
    		System.out.println("No");
    	}
    }
}

Measured memory_bytes: 35764
#include <bits/stdc++.h>
#define int long long
using namespace std;

void nil()
{
   string s;
   int m= 0;
   cin>>s;
   int c=0;
   
   for(int i=0;i<3;i++)
   {
      if(s[i]=='R') 
      {
         c++;
         //m=max(m,c);
      }
      else
      {
         m=max(m,c);
         c=0;
      }
   }
   m=max(m,c);
   cout<<m<<endl;
}
int32_t main()
{
   #ifndef ONLINE_JUDGE

      freopen("input.txt","r",stdin);
      freopen("output.txt","w",stdout);
   #endif   
      nil();
      /*int t;
      cin>>t;
      while(t--)
      {
         nil();
      }*/
      

}


Measured memory_bytes: 3612
#include<stdio.h>
#include<iostream>
using namespace std;

int main(){

	int t, n, s,f,i,cou;
	
	
	while(1){


		cou = 0;

		cin >> t;
		if(t == 0) break;
		cin >> n;

		for(i = 0;i < n;i ++){

			cin >> s >> f;			
			cou += f - s;
		}

		cou = t - cou;


		if(cou <= 0) cout<< "OK" << endl;
		else if(cou > 0)cout << cou << endl;
		

		
	
	}

	


}

Measured memory_bytes: 1164
#include <bits/stdc++.h>
using namespace std;
#define int long long
int n, a[20][20], val[100100], f[100000];
main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    cin >> n;
    for (int i = 0; i < n; i++)
        for (int j = 0; j < n; j++)
            cin >> a[i][j];
    int tmp = (1 << n);
    for (int mask = 1; mask < tmp; mask++)
    {
        for (int i = 0; i < n; i++)
            if ((mask >> i) & 1)
                for (int j = i + 1; j < n; j++)
                    if ((mask >> j) & 1)
                        val[mask] += a[i][j];
    }
    for (int mask = 1; mask < tmp; mask++)
    {
        f[mask] = max(f[mask], val[mask]);
        for (int preMask = mask; preMask > 0; preMask = (preMask - 1) & mask)
            f[mask] = max(f[mask], f[preMask] + f[(mask ^ preMask)]);
    }
    cout << f[tmp - 1];
}


Measured memory_bytes: 4576
#include <bits/stdc++.h>
using namespace std;
#define endl "\n"
#define IOS ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define int long long
#define pb push_back
#define ff first
#define ss second
#define BS binary_search
#define M 1000000007

const long long INF=1e18;

template <class A, class B> ostream& operator<<(ostream& os, const pair<A,B> p) {return os << "(" << p.first << "," << p.second << ")";} 

void dprint(string s) {cout << endl;}
template <class T, class... U> void dprint(string s, T t, U... u) 
{int w = s.find(','); cout << "[" << s.substr(0,w) << ": " << t << "] "; dprint(s.substr(w+1, (int)s.size()-w), u...);} 

#define DEBUG 
#ifdef DEBUG
#define dbg(X...) dprint(#X,X)
#else
#define dbg(X...) "KEEP CALM" 
#endif

const int N=200005; // Don't forget to CHANGE this value ACC. TO Q.
set<int> adj[N];
int cnt=0;
bool vis[N]={false};
void dfs(int s){
    vis[s]=true;
    cnt++;
    for(auto it: adj[s]){
        if(!vis[it])
            dfs(it);
    }
}
int32_t main()
{
    IOS;
    #ifndef ONLINE_JUDGE
        freopen("input.txt", "r", stdin);
        freopen("output.txt", "w", stdout);
    #endif
    int T=1; 
    //cin>>T;
    while(T--)
    {
        int n,m;cin>>n>>m;
        for(int i=0;i<m;i++){
            int a,b;cin>>a>>b;
            adj[a].insert(b);
            adj[b].insert(a);
        }
        int ans=0;
        for(int i=1;i<=n;i++){
            if(!vis[i]){
                dfs(i);
                ans=max(ans,cnt);
                cnt=0;
            }
        }
        cout<<ans<<endl;
    }
    return 0;
}

Measured memory_bytes: 38128
// È¥°É£¡Æ¤¿¨Çð! °ÑAC´ø»ØÀ´£¡
//      ¤Ø¡¡¡¡¡¡¡¡¡¡£¯|
// ¡¡¡¡/£Ü7¡¡¡¡¡¡ ¡Ï£ß/
// ¡¡ /¡¡©¦¡¡¡¡ £¯¡¡£¯								AC		AC		AC		AC
//    ©¦¡¡Z £ß,£¼¡¡£¯¡¡¡¡ /`©c						AC		AC		AC		AC
//    ©¦¡¡¡¡¡¡¡¡¡¡©c¡¡¡¡ /¡¡¡¡¡µ					AC		AC		AC		AC
// ¡¡Y¡¡¡¡¡¡¡¡¡¡`¡¡ /¡¡¡¡/  /						AC		AC		AC		AC
// ¡¡Øé¡ñ¡¡.¡¡¡ñ¡¡¡¡¡´¡¡/¡¡/						AC		AC		AC		AC
// ¡¡()¡¡ ¤Ø¡¡¡¡¡¡¡¡|¡¡£Ü¡´							AC		AC		AC		AC
// ¡¡¡¡>- ._¡¡ ¥£¡¡ ©¦ £¯£¯							AC		AC		AC		AC
// ¡¡ / ¤Ø¡¡¡¡ /¡¡/£¼| £Ü£Ü							AC		AC		AC		AC
// ¡¡ ©c_/¡¡¡¡(_£¯¡¡ ©¦£¯£¯							AC		AC		AC		AC
// ¡¡¡¡ 7¡¡¡¡¡¡¡¡¡¡¡¡¡¡|£¯							AC		AC		AC		AC
// ¡¡¡¡ £¾¨Dr£þ£þ`-¨D£ß/							AC		AC		AC		AC
//**************************************Accepted*****************************************//

#include<bits/stdc++.h>

#define all(x) x.begin(),x.end()
#define pb push_back
#define mp make_pair
#define Unique(x) x.erase(unique(all(x)),x.end());

using namespace std;

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

const int Days[]={-1,31,28,31,30,31,30,31,31,30,31,30,31};

inline int read()
{
	#define gc getchar
	int ans=0;
	bool f=1;
	char ch=gc();
	
	while(!isdigit(ch))f^=ch=='-',ch=gc();
	
	while(isdigit(ch))ans=((ans<<2)+ans<<1)+(ch^48),ch=gc();
	
	return f?ans:-ans;
	
	#undef gc
}

typedef long long ll;

int main(int argc, char const *argv[])
{
	ios::sync_with_stdio(false);
	
	int n,k,c;
	cin>>n>>k>>c;
	string s;
	cin>>s;
	
	vector<int> b(n,-1);
	{
		int i=0;
		
		for(int t=0;t<k;t++)
		{
			while(s[i]=='x')i++;
			
			b[i]=t;i+=c+1;
		}
	}
	
	vector<int> dp(3*n);
	
	for(int i=n;i--;)
	{
		dp[i]=dp[i+1];
		
		if(s[i]=='o')dp[i]=max(dp[i],1+dp[i+c+1]);
	}
	
	for(int i=0;i<n;i++)if(b[i]!=-1&&b[i]+dp[i+1]<k)cout<<i+1<<endl;
	
	//printf("Time used = %.12f",(double)(clock())/CLOCKS_PER_SEC);
	return 0;
}

/*  GOD BLESS  */


Measured memory_bytes: 5012
using System;
using System.Linq;

class Program
{
    static void Main()
    {
        var N = int.Parse(Console.ReadLine());
        var A = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray();
        var result = A.Select(x => 1.0 / x).Sum();
        Console.WriteLine($"{1 / result}");
    }
}

Measured memory_bytes: 13396
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(){
	int n;
	string s;
	cin >> n >> s;
	int cnt = 0, res = 0;
	for(char c : s){
		if(c == 'R'){
			cnt++;
		}
	}
	int sz = s.size();
	for(int i=0;i<sz;i++){
		if(s[i] == 'W' && i < cnt){
			res++;
		}
	}
	cout << res << '\n';
}

Measured memory_bytes: 3748
#include<iostream>
#include<iomanip>
#include<math.h>
#include<vector>
#include<algorithm>
#include<set>
#include<map>
#include<queue>
#include<stack>
#include<string>
#include<time.h>
#define INF 1000000000ll
#define MOD 1000000007ll
#define EPS 1e-10
#define REP(i,m) for(long long i=0; i<m; ++i)
#define FOR(i,n,m) for(long long i=n; i<m; ++i)
#define DUMP(n,a) for(long long dump=0; dump<n; ++dump) { cout<<a[dump]; if(dump!=n-1) cout<<" "; else cout<<endl; }
#define ALL(v) v.begin(),v.end()
#define pb push_back
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
typedef long double ld;
 
int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	string s;
	cin>>s;
	vector<pair<char,ll>> t;
	REP(i,(ll)s.size()) {
		if(s[i]!='x') {
			t.pb(pair<char,ll>(s[i],i));
		}
	}
	for(ll i=0; i<((ll)t.size()+1)/2; i++) {
		if(t[i].first!=t[(ll)t.size()-1-i].first) {
			cout<<-1<<endl;
			return 0;
		}
	}
	if((ll)s.size()==(ll)t.size()||(ll)t.size()==0) {
		cout<<0<<endl;
		return 0;
	}
	ll ret=0;
	ll lp,rp;
	if((ll)t.size()%2==0) {
		lp=(ll)t.size()/2-1;
		rp=(ll)t.size()/2;
	} else {
		lp=(ll)t.size()/2;
		rp=(ll)t.size()/2;
	}
	FOR(i,1,((ll)t.size()+1)/2) {
		if(t[lp].second-t[lp-1].second!=t[rp+1].second-t[rp].second) {
			ret+=abs((t[lp].second-t[lp-1].second)-(t[rp+1].second-t[rp].second));
		}
		lp--;
		rp++;
	}
	ret+=abs((t[0].second-0)-(((ll)s.size()-1)-t[(ll)t.size()-1].second));
	cout<<ret<<endl;
}

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

int main() {
  string w;
  cin>>w;
  map <char,int> A;
  rep(i,w.size()) {
    A[w[i]]++;
  }
  for(auto x:A) {
    if (x.second % 2 != 0){
      cout << "No" << endl;
      return 0;
    }
  }
  cout << "Yes" << endl;
}

Measured memory_bytes: 256