akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <cstdio> 
using namespace std;

int main(){
  int m,f,r;

  while(1){
    cin >> m >> f >> r;

    if(m==-1 && f==-1 && r==-1){
      break;
    }

    if(m==-1 || f==-1){
      cout << "F" << endl;
    }else if(m + f >= 80){
      cout << "A" << endl;
    }else if((m + f < 80) && (m + f >= 65)){
      cout << "B" << endl;
    }else if((m + f < 65) && (m + f >= 50)){
      cout << "C" << endl;
    }else if((m + f < 50) && (m + f >= 30) && (r >= 50)){
      cout << "C" << endl;
    }else if((m + f < 50) && (m + f >= 30) && (r < 50)){
      cout << "D" << endl;
    }else if(m + f < 30){
      cout << "F" << endl;
  }
}
}

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

using namespace std;

int main(void) {
    string S;
    cin >> S;
    size_t N = S.size();
    if(N == 2) {
        cout << 1 << " " << 1 << endl;
        return 0;
    }
    vector<int> ans(N);

    if(S.at(1) == S.at(0)) {
        ans.at(0) = 0;
    } else {
        ans.at(0)++;
        int j = 0;
        while(j <= N-3 && S.at(j+1) == 'L' && S.at(j+2) == 'L') {
            ans.at(0)++;
            j += 2;
        }
    }

    for(int i=1; i<N-1; i++) {
        if(S.at(i-1) == S.at(i) && S.at(i+1) == S.at(i)) {
            ans.at(i) = 0;
        } else {
            if(S.at(i) == 'L' && S.at(i-1) == 'R' || S.at(i) == 'R' && S.at(i+1) == 'L') {
                ans.at(i) ++;
            }
            int j = i;
            while(j <= N-3 && S.at(j+1) == 'L' && S.at(j+2) == 'L') {
                ans.at(i)++;
                j += 2;
            }
            j = i;
            while(j >= 2 && S.at(j-1) == 'R' && S.at(j-2) == 'R') {
                ans.at(i)++;
                j -= 2;
            }
        }
    }

    if(S.at(N-1) == S.at(N-2)) {
        ans.at(N-1) = 0;
    } else {
        ans.at(N-1)++;
        int j = N-1;
        while(j >= 2 && S.at(j-1) == 'R' && S.at(j-2) == 'R') {
            ans.at(N-1)++;
            j -= 2;
        }
    }

    for(int i=0; i<N; i++) {
        cout << ans.at(i) << " ";
    }
    cout << endl;
    return 0;
}

Measured memory_bytes: 1024
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <cfloat>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <functional>
using namespace std;

#define rep(i,a,n) for(int (i)=(a); (i)<(n); (i)++)
#define repq(i,a,n) for(int (i)=(a); (i)<=(n); (i)++)
#define repr(i,a,n) for(int (i)=(a); (i)>=(n); (i)--)
#define int long long int

template<typename T> void chmax(T &a, T b) {a = max(a, b);}
template<typename T> void chmin(T &a, T b) {a = min(a, b);}
template<typename T> void chadd(T &a, T b) {a = a + b;}

typedef pair<int, int> pii;
typedef long long ll;

int dx[] = {0, 0, 1, -1};
int dy[] = {1, -1, 0, 0};
constexpr ll INF = 1001001001001001LL;
constexpr ll MOD = 1000000007LL;

signed main() {
    int D; cin >> D;
    while(D--) {
        int m, n; cin >> m >> n;

        int cnt = 0;
        rep(p,-300,300) rep(q,-300,300) {
            if(p == 0 && q == 0) continue;
            int sum = p*p + q*q;
            if((m*p+n*q) % sum) continue;
            if((n*p-m*q) % sum) continue;
            cnt++;
        }
        cout << (cnt == 8 ? "P" : "C") << endl;
    }
    return 0;
}

Measured memory_bytes: 3060
#include<iostream>
using namespace std;
int main(){
    int h,w;
    cin>>h>>w;
    char str[51][51];
    int dx[4]={1,-1,0,0};
    int dy[4]={0,0,1,-1};
    for(int i=0;i<h;i++){
            scanf("%s",str[i]);
        }
    bool ans=true;
    for(int i=0;i<h;i++){
        for(int j=0;j<w;j++){
            if(str[i][j]=='#'){
                bool found=false;
                for(int k=0;k<4;k++){
                    int i2 = i + dx[k];
                    int j2 = j + dy[k];
                    if(i2>=0 && j2>=0 && i2<=h && j2<=w && str[i2][j2]=='#'){
                        found=true;
                    }
                }
                if(!found){
                    ans=false;
                }
            }
        }
    }
    cout<<(ans ? "Yes":"No")<<endl;
    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <limits.h>
#include <string.h>
#define ll long long int

int main(void)
{
    int grid[3][3];
    for (int i=0; i<3; i++)
    {
        for (int j=0; j<3; j++)
            scanf("%d",&grid[i][j]);
    }
    int count = 0;
    int N;
    scanf("%d",&N);
    int array[N];
    for (int i=0; i<N; i++)
    {
        scanf("%d",&array[i]);
    }

    for (int i=0; i<3; i++)
    {
        for (int j=0; j<3; j++)
        {
            for (int k=0;k<N;k++){
            if (array[k]==grid[i][j])
            {
                grid[i][j]=0;
                count++;
            }
            }
        }
    }
    int sum =0;
    if (count >=3)
    {

        for (int i=0; i<3; i++)
        {
            for (int j=0; j<3; j++)
            {
                sum+=grid[i][j];
            }
            if (sum==0){printf("Yes");
                        exit(0);} //To check if return 0 exits too or not
            sum=0;
        }




        for (int i=0; i<3; i++)
        {
            for (int j=0; j<3; j++)
            {
                sum+=grid[j][i];
            }
            if (sum==0){printf("Yes");
                        exit(0);} //To check if return 0 exits too or not
            sum=0;
        }



            for (int j=0; j<3; j++)
            {
                sum+=grid[j][j];
            }
            if (sum==0){printf("Yes");
                        exit(0);} //To check if return 0 exits too or not
            sum=0;


            int idx = 0;
            for (int j=2; j>0; j--)
            {

                sum+=grid[idx][j];
                idx++;
            }
            if (sum==0){printf("Yes");
                        exit(0);} //To check if return 0 exits too or not
    }

    printf("No");
    return EXIT_SUCCESS;
}


Measured memory_bytes: 128
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		char[]c=scan.next().toCharArray();
		int num0=0;
		int  num1=0;
		for(int i=0;i<c.length;i++){
			if(Character.getNumericValue(c[i])==0){
				num0++;
			}else{
				num1++;
			}
		}
		if(num0<num1){
			System.out.println(2*num0);
		}else{
			System.out.println(2*num1);
		}
	}
}

Measured memory_bytes: 29120
#include<iostream>
#include<algorithm>
#include<functional>
#include<cmath>
#include<string>
#include<vector>
#include<stack>
#include<queue>
#include<map>
#include<set>
#include<deque>
using namespace std;
#define ll long long
const int mod = 1000000007;
const ll INF = 1000000000000000000;

int length(ll x) {
	int l = 0;
	while (x > 0) {
		l++;
		x /= 10;
	}
	return l;
}
int main()
{
	ll N; cin >> N;
	int ans = mod;
	for (ll i = 1; i * i <= N; i++) {
		if (N % i == 0) {
			ans = min(ans, max(length(i), length(N / i)));
		}
	}
	cout << ans << endl;
}


Measured memory_bytes: 256
#include <stdio.h>

int main()
{
	int N, Q;
	char S[500001];
	scanf("%d", &N);
	scanf("%s", S);
	scanf("%d", &Q);
	
	int i, j, count[201][26] = {};
	for (i = 0; i < N / 2500; i++) {
		for (j = 0; j < 2500; j++) count[i][S[i*2500+j] - 'a']++;
	}
	for (j = 0; j < N % 2500; j++) count[i][S[i*2500+j] - 'a']++;

	int l, r, q, type, flag[26], ans;
	char c;
	for (q = 0; q < Q; q++) {
		scanf("%d", &type);
		if (type == 1) {
			scanf("%d %c", &i, &c);
			i--;
			count[i/2500][S[i] - 'a']--;
			count[i/2500][c - 'a']++;
			S[i] = c;
		} else {
			scanf("%d %d", &l, &r);
			l--;
			r--;
			for (j = 0; j < 26; j++) flag[j] = 0;
			for (i = (l + 2499) / 2500; i < (r + 1) / 2500; i++) {
				for (j = 0; j < 26; j++) if (count[i][j] > 0) flag[j] = 1;
			}
			for (j = l; j <= r && j % 2500 != 0; j++) flag[S[j] - 'a'] = 1;
			for (j = r; j >= l && (j + 1) % 2500 != 0; j--) flag[S[j] - 'a'] = 1;
			for (j = 0, ans = 0; j < 26; j++) ans += flag[j];
			printf("%d\n", ans);
		}
	}
	
	fflush(stdout);
	return 0;
}

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

#define M 100005
#define MOD 1000000007
#define ep emplace_back
#define mk make_pair
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()

typedef long long int lli;
typedef unsigned long long int ulli;
typedef pair<int,int> PII;
typedef pair<ulli,ulli> PLL;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    // freopen("input.txt","r",stdin);
    // freopen("output.txt","w",stdout);

    int n,k;
    cin>>n>>k;

    vector<int> adjList[n+1];
    for(int i=1;i<=k;i++)
    {
    	int d;
    	cin>>d;
    	for(int j=1;j<=d;j++)
    	{
    		int temp;
    		cin>>temp;
    		adjList[temp].ep(i);
    	}
    }

    int ans = 0;
    for(int i=1;i<=n;i++)
    {
    	if(adjList[i].size()==0)
    		ans++;
    }

    cout<<ans<<"\n";

}


Measured memory_bytes: 3664
#include <cassert>

#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>

// C++
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#include <array>
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
//#include <boost/foreach.hpp>
//#include <boost/range/algorithm.hpp>
#define rep(i,j,k) for(int i=(int)j;i<(int)k;i++)
#define ll long long
#define Sort(v) sort(all(v))
#define INF 1e9
#define LINF 1e18
#define END return 0
#define pb push_back
#define se second
#define fi first
#define pb push_back
#define all(v) (v).begin() , (v).end()
#define MP make_pair
#define MOD 1000000007LL
#define int long long
using namespace std;
int day[12]={31,28,31,30,31,30,31,31,30,31,30,31};
int dx[]={0,1,0,-1};
int dy[]={1,0,-1,0};
struct edge{int to,cost;};
typedef pair<int,int> P;

bool isupper(char c){if('A'<=c&&c<='Z')return 1;return 0;}
bool islower(char c){if('a'<=c&&c<='z')return 1;return 0;}
bool isPrime(int x){if(x==1)return 0;if(x==2)return 1;if(x%2==0)return 0;for(int i=3;i*i<=x;i++)if(x%i==0)return 0;return 1;}
bool iskaibun(string s){for(int i=0;i<s.size()/2;i++)if(s[i]!=s[s.size()-i-1])return 0;return 1;}
bool isnumber(char c){return ('0'<=c&&c<='9');}
bool isalpha(char c){return (isupper(c)&&islower(c));}

struct S{
    char c;
    int y,x;
};

bool qemp(vector<queue<S>> q){
    rep(i,0,q.size())if(!q[i].empty())return true;
    return false;
}

signed main (){
    int n,k;
    cin>>n>>k;
    int ans=0;
    for(int i=0;i<n;i+=2)ans++;
    if(ans>=k)cout<<"YES"<<endl;
    else cout<<"NO"<<endl;

}
/*
*/


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

int main(){
    int h, w;
    cin >> h >> w;

    char a[h][w];
    for(int i = 0; i < h; i++){
        for(int j = 0; j < w; j++){
            cin >> a[i][j];
        }
    }

    for(int i = 0; i < w + 2; i++){
        cout << '#';
    }
    cout << endl;
    for(int i = 0; i < h; i++){
        for(int j = 0; j < w; j++){
            if(w == 1){
                cout << '#' << a[i][j] << '#' << endl;
            }else if(j == 0){
                cout << '#' << a[i][j];
            }else if(j == w - 1){
                cout << a[i][j] << '#' << endl;
            }else{
                cout << a[i][j];
            }
        }
    }
    for(int i = 0; i < w + 2; i++){
        cout << '#';
    }
    cout << endl;
}

Measured memory_bytes: 256
//#pragma GCC optimize ("Ofast")
//#pragma GCC optimize ("unroll-loops")
//#pragma GCC target("avx,avx2,fma")

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/rope>
#define pb push_back
#define F first
#define S second
#define ins insert
#define mp make_pair
#define fo(i, n1, n, x) for(int i = n1; i <= n; i += x)
#define foo(i, n, n1, x) for(int i = n; i >= n1; i -= x)
#define bit __builtin_popcount
#define md (l + ((r - l) / 2))
#define all(x) x.begin(),x.end()
#define eb emplace_back
#define ub upper_bound
#define lb lower_bound
#define ios ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define file(s) if (fopen(s".in", "r")) freopen(s".in", "r", stdin), freopen(s".out", "w", stdout)

using namespace std;
using namespace __gnu_pbds;
using namespace __gnu_cxx;


using ll = long long;

//#define int ll


const int N = 3e5 + 11, mod = 1e9 + 7, mod2 = 998244353;
const int MAX = 1e5 + 11;
const int INF1 = 2e9 + 11;
const ll INF2 = 2e18 + 11;
const double INF3 = 1e8 + 11;
const int base = 500;
const int P = 31;
const int dx[] = {1, -1, 0, 0, 1, 1, -1, -1};
const int dy[] = {0, 0, 1, -1, 1, -1, 1, -1};
const double EPS = 1e-4;
const double PI = acos(-1.0);


template<typename T> using ordered_set = tree <T, null_type, less <T>, rb_tree_tag, tree_order_statistics_node_update>;
template<typename T1, typename T2> inline void chmin(T1 &a, T2 b) { if (a > b) a = b; }
template<typename T1, typename T2> inline void chmax(T1 &a, T2 b) { if (a < b) a = b; }


typedef pair <int, int> pii;
typedef pair <ll, ll> pll;
typedef vector <int> vi;
bool prime(int n) {
    for(int i=2;i<=sqrt(n);i++){
        if(n%i==0){return 0;}
    }return 1;}

int main() {
    ios;
    ll n , m;
    cin >> n >> m;
    cout << (n-1)*n/2 + (m-1)*m/2;
    return 0;
}



Measured memory_bytes: 764
#include<iostream>
using namespace std;
int s, b, nS, nB, w;
int a[101], r[101];
int main(){
    cin >> nS >> nB;
    for(s=1; s<=nS; s++){cin>>a[s];}
    for(b=1; b<=nB; b++){
        for(s=1; s<=nS; s++){
            r[s] = a[s]%b;
        }
        for(s=1; s<=nS-1; s++){
            if(r[s] > r[s+1]){
                swap(a[s], a[s+1]);
                swap(r[s], r[s+1]);
            }
        }
    }
    for(s=1; s<=nS; s++){
        cout << a[s] << endl;
    }
}
void swap(int x, int y){
     w = x;
     x = y;
     y = w;
}

Measured memory_bytes: 3064
import java.io.BufferedReader;
import java.io.InputStreamReader;


public class Main {
    public static void main(String[] args) {
        Main main = new Main();
        main.solve(args);
    }

    public void solve(String[] args) {
        MyScanner scanner = new MyScanner();

        // ビジネスロジックここから
        int a = scanner.nextInt();
        String s = scanner.next();
        
        if (a >= 3200) {
        	System.out.println(s);
        } else {
        	System.out.println("red");
        }
        
        
        // ビジネスロジックここまで

    }

    private class MyScanner {
        String[] s;
        int i;
        BufferedReader br;
        String reg = " ";
        MyScanner () {
            s = new String[0];
            i = 0;
            br = new BufferedReader(new InputStreamReader(System.in));
        }
        public String next() {
            try {
                if (i < s.length) return s[i++];
                String line = br.readLine();
                while (line.equals("")) {line = br.readLine();}
                s = line.split(reg, 0);
                i = 0;return s[i++];
            } catch (Exception e) {e.printStackTrace();}
            return null;
        }
        public int nextInt() {
            try {return Integer.parseInt(next());} catch (Exception e) {e.printStackTrace();}
            return -1;
        }
        public double nextDouble() {
            try {return Double.parseDouble(next());} catch (Exception e) {e.printStackTrace();}
            return -1;
        }
        public long nextLong()  {
            try {return Long.parseLong(next());} catch (Exception e) {e.printStackTrace();}
            return -1;
        }
    }
}


Measured memory_bytes: 20180
import java.util.Scanner;
//import java.util.ArrayList;
class Main {
    public static void main(String[] args) {
        Scanner stdIn = new Scanner(System.in);
        
        int a = stdIn.nextInt();
        String s = stdIn.next();

        if(a>=3200){
            System.out.println(s);
        }else {
            System.out.println("red");
        }
        
    }

}

Measured memory_bytes: 21588
using System;

class Program {
    private static int Main() {
        for( int i = 1; ; ++i ) {
            var input = Console.ReadLine();
            var value = int.Parse( input );
            if( value == 0 ) { break; }

            var output = string.Format( "Case {0}: {1}", i, value );
            Console.WriteLine( output );
        }

        return 0;
    }
}

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

typedef int64_t Int;
#define fi first
#define se second
#define all(x) (x).begin(), (x).end()
 
const double EPS = 1e-10;
const Int INF = 1e18;
const int inf = 1e9;
const Int mod = 1e9+7;

bool print_space_enable = false;
void print() { 
    cout << endl; 
    print_space_enable = false;
}

template <class Head, class... Tail>
void print(Head&& head, Tail&&... tail) {
    if (print_space_enable) cout << " ";
    cout << fixed << setprecision(15) << head;
    print_space_enable = true;
    print(std::forward<Tail>(tail)...);
}

template<typename T>
void print(vector<T> v) {
    for (size_t i = 0; i < v.size(); i++) {
        if (i > 0) std::cout << " ";
        std::cout << v[i];
    }
    std::cout << std::endl;
}

int main() {
    double r;
    cin >> r;
    print(r * 2.0 * M_PI);
    return 0;
}

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

def group_RL(s):
    i = 0
    rl = []
    rl2 = []
    while True:
        RL_idx = s.find('L', i)
        LR_idx = s.find('R', RL_idx)
        if LR_idx < 0:
            rl.append((i, RL_idx-i, len(s)-RL_idx))
            rl2.append((i, RL_idx, LR_idx))
            break
        rl.append((i, RL_idx-i, LR_idx-RL_idx))
        rl2.append((i, RL_idx, LR_idx))
        i = LR_idx
    return rl

if __name__ == "__main__":
    s = input()
    a = []
    RL_grp = group_RL(s)

    for rl in RL_grp:
        n = rl[1]+rl[2]
        a += [0 for i in range(0, rl[1]-1)]
        if n%2 == 0:
            a += [int(n/2), int(n/2)]
        elif rl[1]%2 == 0:
            a += [int(n/2), int(n/2)+1]
        else:
            a += [int(n/2)+1, int(n/2)]
        a += [0 for i in range(0, rl[2]-1)]

    print(" ".join(list(map(str, a))))

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

#define int long long

#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=(int)a, i##_len=(b); i<i##_len; i++)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)

using namespace std;

using P = pair<int, int>;
using ll = long long;

const long long INF = LLONG_MAX/3;

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; }

struct UnionFind{
	std::vector<int> par,siz;
	void init(int n){
		par.resize(n);
		for(int i=0;i<n;i++)par[i]=i;
		siz.resize(n,1);
	}
	UnionFind(int n){
		init(n);
	}
	int root(int n){
		if(par[n]==n)return n;
		else return par[n]=root(par[n]);
	}
	bool issame(int x,int y){
		return (root(x)==root(y));
	}
	bool marge(int a,int b){
		if(issame(a,b))return false;
		else{
			a=root(a),b=root(b);
			if(siz[a]<siz[b])swap(a,b);
			siz[a]+=siz[b];
			par[a]=par[b];
			return true;
		}
	}
	int size(int n){
		return siz[root(n)];
	}
};

long long gcd(long long a,long long b){
    if(b==0)return a;
    return gcd(b,a%b);
}
long long lcm(long long i,long long j){
    return i*(j/gcd(i,j));
}
const int MOD=1e9+7;

signed main(){
	int n;
	cin>>n;
	vector<P> w;
	int a[110000];
	rep(i,n){
		cin>>a[i];
	}
	sort(a,a+n);
	int mi=a[0],ma=a[n-1];
	rep(i,1,n-1){
		if(a[i]<=0){
			w.push_back(P(ma,a[i]));
			ma-=a[i];
		}else{
			w.push_back(P(mi,a[i]));
			mi-=a[i];
		}
	}
	cout<<ma-mi<<endl;
	w.push_back(P(ma,mi));
	rep(i,n-1)cout<<w[i].first<<" "<<w[i].second<<endl;
}

Measured memory_bytes: 4336
# -*- coding: utf-8 -*-
abcd = [int(_) for _ in list(input())]
op = [0, 1]


def cal(ops, abcd):
    if ops:
        op = ops.pop(0)
        _ = abcd.pop(0)
        if op:
            abcd[0] = _ + abcd[0]
            return cal(ops, abcd)
        else:
            abcd[0] = _ - abcd[0]
            return cal(ops, abcd)
    else:
        return abcd[0]


for op1 in op:
    for op2 in op:
        for op3 in op:
            _ = abcd[:]
            __ = [op1, op2, op3]
            if cal(__, _) == 7:
                ops = [op1, op2, op3]

abcd = [str(_) for _ in abcd]
ops = ['+' if op else '-' for op in ops]
tmp = [abcd[i] + _ for i, _ in enumerate(ops)]
tmp.append(abcd[-1])
print(''.join(tmp) + '=7')


Measured memory_bytes: 3064
#include <stdio.h>
#include <string.h>
#include <limits.h>
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <map>
#include <set>
#include <stack>
#include <queue>

typedef unsigned long long ULLONG;
typedef long long LLONG;
static const LLONG MOD_NUM = 1000000007;

template<class _T> static void getint(_T& a) {
	std::cin >> a;
}
template<class _T> static void getint(_T& a, _T& b) {
	std::cin >> a >> b;
}
template<class _T> static void getint(_T& a, _T& b, _T& c) {
	std::cin >> a >> b >> c;
}

static void CodeFes2017FinalC();

int main()
{
	CodeFes2017FinalC();
	fflush(stdout);
	return 0;
}

static int cf2017fC_dfs(const std::vector<int>& di, int idx, std::vector<int>& times)
{
	int orgSize = times.size();

	int time = 0;
	if (idx > 12){
		int size = times.size();
		if (size > 1) {
			time = 36;
			for (int i = 0; i < size; i++) {
				for (int j = i + 1; j < size; j++) {
					int diff = abs(times[i] - times[j]);
					diff = std::min(diff, 24 - diff);
					time = std::min(time, diff);
				}
			}
		}
	}
	else {
		if (di[idx] == 1) {
			times.push_back(idx);
			time = cf2017fC_dfs(di, idx + 1, times);
			times.erase(times.begin() + orgSize, times.end());
			times.push_back(24 - idx);
			time = std::max(time, cf2017fC_dfs(di, idx + 1, times));
		}
		else if (di[idx] == 0) {
			time = cf2017fC_dfs(di, idx + 1, times);
		}
		else if (di[idx] == 2) {
			times.push_back(idx);
			times.push_back(24 - idx);
			time = std::max(time, cf2017fC_dfs(di, idx + 1, times));
		}
	}
	return time;
}

static void CodeFes2017FinalC()
{
	int N;
	getint(N);

	std::vector<int> di(13, 0);
	di[0] = 1;	//	高橋君
	for (int i = 0; i < N; i++) {
		int d;
		getint(d);
		di[d]++;
	}
	std::vector<int> times;
	int maxs = cf2017fC_dfs(di, 0, times);
	printf("%d\n", maxs);
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <map>
#include <set>
#include <vector>
#include <stack>
#include <queue>
#include <bitset>
#include <algorithm>
#include <numeric>
#include <functional>
using namespace std;

#define Rep(b, e, i) for(int i = b; i <= e; i++)
#define Repr(e, b, i) for(int i = e; i >= b; i--)
#define rep(n, i) Rep(0, n-1, i)
#define repr(n, i) Repr(n-1, 0, i)
#define all(v) (v).begin(), (v).end()
#define pb(v) push_back(v)
#define uniq(v) (v).erase(unique(all(v)),(v).end())
#define bitcnt(x) __builtin_popcount(x)

typedef long long ll;
typedef pair<ll, ll> llP;
typedef pair<int, int> intP;
typedef std::priority_queue<int> IntPrioQueue; //Z->A
typedef std::priority_queue<int, std::vector<int>, std::greater<int> > IntReversePrioQueue; //A->Z

const int MAX = 200000;
const double PI = 3.14159265358979323846;
const double EPS = 1e-12;
const int INF = 1<<31-1;
const int MOD = 1000000007;



void solve(void){
    int N;
    cin >> N;
    int o = 0;
    rep(N, i) {
        int x; cin >> x;
        if (x%2) o++;
    }
    cout << ((o%2==0)?"YES":"NO") << endl;
}

int main(void){
  solve();
  //cout << "yui(*-v・)yui" << endl;
  return 0;
}


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

int main() {
  ll n;cin>>n;
  int ans=1e9;
  for(int i=1;i<=sqrt(n);i++){
    if(n%i!=0)continue;
    ll j=n/i;
    string I=to_string(i),J=to_string(j);
    int a=I.size(),b=J.size();
    int f=max(a,b);
    ans=min(ans,f);
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 3760
#include<bits/stdc++.h>
#define int long long
using namespace std;
int n;
int a[11];
void dfs(string s,int x,int y)
{
	if(x==n)
	{
		cout<<s<<endl;
		return;
	}
	for(int i=1;i<=y+1;i++)
	dfs(s+(char)(i+'a'-1),x+1,max(i,y));
}
signed main()
{
	string s;
	scanf("%lld",&n);
	dfs(s,0,0);
    return 0;
}

Measured memory_bytes: 1536
#include <stdio.h>

typedef struct {
  int key;
  int *left;
  int *right;
  int *parent;
} node;

node *root, *NIL;

node *find(node *u,int k)
{

  while(u!=NIL && k!=u->key){
    if(k < u->key){
      u = u->left;
    }
    else{
      u = u->right;
    }
  }

  return u;

}

void insert(int k)
{

  node *x, *y, *z;
  
  y = NIL; // x の親
  x = root;
  z = (node *)malloc(sizeof(node));
  z->key = k;
  z->left = NIL;
  z->right = NIL;
  
  while(x != NIL){
    y = x;// 親を設定
    if(z->key < x->key){
      x = x->left; // 左の子へ移動
    }
    else{ 
      x = x->right;
    }// 右の子へ移動
  }
  z->parent = y;
  if(y == NIL){ // T が空の場合
    root = z;
  }
  else{
    if(z->key < y->key){
    y->left = z;// z を y の左の子にする
  }
    else{
      y->right = z; // z を y の右の子にする
    }
  }

}

void inorder(node *u)
{

  if(u==NIL) return;
  inorder(u->left);
  printf(" %d",u->key);
  inorder(u->right);

}

void preorder(node *u)
{

  if(u==NIL) return;
  printf(" %d",u->key);
  preorder(u->left);
  preorder(u->right);

}

int main()
{

  int n, i, x;
  char com[7];
  node *t;

  scanf("%d",&n);

  for(i=0;i<n;i++){
    scanf("%s",com);
    if(com[0]=='i'){
      scanf("%d",&x);
      insert(x);
    }
    else if(com[0]=='p'){
      inorder(root);
      printf("\n");
      preorder(root);
      printf("\n");
    }
    else if(com[0]=='f'){
      scanf("%d",&x);
      t = find(root,x);
      if(t!=NIL){
	printf("yes\n");
      }
      else{
	printf("no\n");
      }
    }
  }

  return 0;

}






Measured memory_bytes: 20452
#include <iostream>
#include <iterator>
#include <vector>
#include <cmath>
#include <cstdlib>
#include <algorithm>
#include <string>
#include <numeric>
#include <iomanip>
#include <limits>
#include <set>
#include <map>
#include <type_traits>
#include <cstdint>
#include <queue>
#define _USE_MATH_DEFINES
#include <math.h>
#include <sstream> // std::stringstream
#include <bitset>  // std::bitset<N>

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

using namespace std;

//素因数分解
void factoring(ll n, map<ll, ll>& mp) {
	for (ll i = 2; i * i <= n; i++) {
		while (n % i == 0) {
			mp[i]++;
			n /= i;
		}
	}
	if (n != 1) mp[n]++;
}

//絶対値
template<class T, class U = std::make_unsigned_t<T>>
U SafeAbs( T x ) {
    return x < 0 ? -static_cast<uintmax_t>(x) : x;
}

//最大・最小
template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}

//xのn乗
ll mod_pow(ll x, ll n, ll mod) {
    ll res = 1;
    while (n > 0) {
        if (n & 1) res = res * x % mod;
        x = x * x % mod;
        n >>= 1;
    }
    return res;
}
//xの逆元
ll mod_inv(ll x, ll mod) {//O(log(mod))
    return mod_pow(x, mod - 2, mod);
}

//nCr
ll ncr(ll n, ll r, ll mod){
	ll res=1;
	ll num=1,den=1;
	for(ll i=n;i>=n-r+1;i--){
		(den*=i)%=mod;
	}
	for(ll i=1;i<=r;i++){
		(num*=i)%=mod;
	}
	
	res=den*mod_inv(num,mod);

	return res%mod;
}


//二分探索
bool isOk(ll index, ll key,vector<ll> &a){
	
	if(a[index]>key){
		return true;
	}
	
	return false;
}

ll bin_search(ll key, vector<ll> &a){
	
	ll l=-1;
	ll r=a.size();

	while(abs(r-l)>1){
		ll mid = (l+r)/2;
		if(isOk(mid, key, a)){
			r=mid;
		}
		else{
			l=mid;
		}
	}
	return r;
}

/*
//深さ優先探索
void dfs(vector<vector<ll>> &gra,vector<bool> &seen, ll v){

	seen[v]=true;

	for(auto next : gra[v]){
		if(seen[next]){
			continue;
		}

		dfs(gra,seen,next);
	}
	
}
*/
const ll MOD=1000000007;

ll min(ll a, ll b){
	if(a>=b){
		return b;
	}
	else{
		return a;
	}
}

void solve(){
	string n;
	cin >> n;


	ll a = 0;
	for (ll i = 0; i < n.size(); i++)
	{
		a += n[i]-'0';
		a %= 9;
	}

	if(a%9==0){
		cout << "Yes" << endl;
	}
	else{
		cout << "No" << endl;
	}
	
}

int main(){
	
	solve();
	
    return 0;
}



Measured memory_bytes: 3704
import math
import fractions
import copy
import numpy as np
def j(q):
    if q==1: print("Yes")
    elif q == 0:print("No")
    exit(0)
rem = pow(10,9)+7
"""
def ct(x,y):
    if (x>y):print("+")
    elif (x<y): print("-")
    else: print("?")
"""

def ip():
    return int(input())
def iprow():
    return [int(i) for i in input().split()]
def ips():
    return (int(i) for i in input().split())
def printrow(a):
    for i in a:
        print(i)

"""
#decomment when needed
def combinations(n,r):
    if n<r:return 0
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))
def permutations(n,r):
    if n<r:return 0
    return math.factorial(n) // math.factorial(n - r)
def lcm(x, y):
    return (x * y) // fractions.gcd(x, y)
"""
n = ip()
a = iprow()
ans = []
for i in range(n):
    for p in range(len(a)-1,-1,-1):
        if p+1 == a[p]:
            ans.insert(0,p+1)
            a.pop(p)
            break
if len(a):
    print(-1)
else:
    for i in ans:
        print(i)


Measured memory_bytes: 13612
N = int(input())

count = 0
total = 0

for j in range(1,N+1):
    count = 0
    if j % 2 != 0:
        for i in range(1,j+1):
            if j % i == 0:
                count += 1
    if count == 8:
        total += 1
print(total)

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

class Main {
    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String line;

        while ((line = br.readLine()) != null) {
            String[] input = line.split(" ");

            double xa1 = Double.parseDouble(input[0]);
            double ya1 = Double.parseDouble(input[1]);
            double xa2 = Double.parseDouble(input[2]);
            double ya2 = Double.parseDouble(input[3]);
            double xb1 = Double.parseDouble(input[4]);
            double yb1 = Double.parseDouble(input[5]);
            double xb2 = Double.parseDouble(input[6]);
            double yb2 = Double.parseDouble(input[7]);

            boolean result = true;
            if (xa1 > xb2)
                result = false;
            if (xb1 > xa2)
                result = false;
            if (yb1 > ya2)
                result = false;
            if (ya1 > yb2)
                result = false;

            if (result) {
                System.out.println("YES");
            } else {
                System.out.println("NO");
            }
        }
    }
}


Measured memory_bytes: 24244
#include <bits/stdc++.h>
#include <iostream>
using namespace std;
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,a,b) for(int i=a;i>=b;i--)
#define modulo 1000000007
typedef long long int ll;
typedef pair<int, int> P;
typedef tuple<int, int, int> T;


int main() {
	int n,d;
	cin >> n >> d;
	vector<vector<int>> x(n);
	for(int i=0;i<n;i++){
		x[i].resize(d);
		for(int j=0;j<d;j++) cin >> x[i][j];
	}
		
	ll count(0);
	for(int i=0; i<n; i++){
		for(int j=i+1; j<n; j++){
			double dist = 0.;
			for(int k=0; k<d; k++){
				dist += (x[i][k]-x[j][k]) * (x[i][k]-x[j][k]);
			}
			dist = sqrt(dist);
			if(ceil(dist)==floor(dist)) count ++;
		}
	}

	cout << count << endl;

	return 0;
}

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

int main(){
  int m;
  cin>>m;
  for(;m--;)
    {
      int data[5][5];
      memset(data,0,sizeof(data));
      int ans=0;
      for(int i=0;i<5;i++)
	for(int j=0;j<5;j++)
	  {
	    int tmp;
	    cin>>tmp;
	    if(tmp==1)
	      {
		if(j==0)
		  data[i][j]=1;
		else
		  data[i][j]=data[i][j-1]+1;
	      }
	    else
	      data[i][j]=0;
	    ans=max(ans,data[i][j]);
	  }

      for(int i=4;i>=0;i--)
	for(int j=4;j>=0;j--)
	  {
	    if(data[i][j]!=0)
	      {
		int cnt=2;
		int lo=data[i][j];
		for(int ii=i-1;ii>=0 && data[ii][j]!=0;ii--)
		  {
		    lo=min(data[ii][j],lo);
		    ans=max(ans,lo*cnt);
		    cnt++;
		  }
	      }
	  }

      cout<<ans<<endl;
    }

}

Measured memory_bytes: 1160
#include <algorithm>
#include <iostream>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); ++i)

const ll INF = 1e15 + 5;
int main() {
  ll n;
  cin >> n;
  ll mcap = INF;
  rep(i, 5) {
    ll cap;
    cin >> cap;
    mcap = min(mcap, cap);
  }
  cout << (n + mcap - 1) / mcap + 4 << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
using namespace std;

#define ll long long
#define ld long double
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define gcd __gcd
#define lcm(a, b) ((a) * (b) / gcd((a), b))
#define all(x) x.begin(), x.end()
#define rep(i, x, n) for (ll i = x; i < n; i++)
#define fastio() ios_base::sync_with_stdio(NULL); cin.tie(0); cout.tie(0)
#define endl '\n'

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

template <class T> inline T RD(T &a) {T x; cin >> x; return a = x;}

signed main()
{
//	freopen("TEXT.inp", "r", stdin); freopen("TEXT.out", "w", stdout);
	fastio();

    set<string> s;
    string t;
    int n; cin >> n;
    while(n--) {
        cin >> t;
        s.insert(t);
    }
    cout << s.size();
}


Measured memory_bytes: 19108
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.StringTokenizer;

public class Main {
    private static long[] dp;
    private static long cost(int current, int[] arr){
        if(current >= arr.length) return Long.MAX_VALUE;
        if(current == arr.length - 1) return 0;
        if(dp[current] != -1) return dp[current];
        long x = cost(current + 1, arr);
        long y = cost(current + 2, arr);
        if(x != Long.MAX_VALUE) x += Math.abs(arr[current] - arr[current + 1]);
        if(y != Long.MAX_VALUE) y += Math.abs(arr[current] - arr[current + 2]);
        dp[current] = Math.min(x, y);
        return dp[current];
    }

    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        StringBuilder sb = new StringBuilder();
        // code goes here
        int n = nextInt(br);
        int[] arr = nextIntArray(br, n);
        dp = new long[n];
        Arrays.fill(dp, -1);
        sb.append(cost(0, arr));
        System.out.print(sb.toString());
    }

    private static int nextInt(BufferedReader br) throws IOException{
        return Integer.parseInt(br.readLine());
    }

    private static int[] nextIntArray(BufferedReader br, int n) throws IOException{
        StringTokenizer st = new StringTokenizer(br.readLine());
        int[] arr = new int[n];
        for(int i = 0; i < n; i++){
            arr[i] = Integer.parseInt(st.nextToken());
        }
        return arr;
    }

    static class Pair<A, B>{
        A first;
        B second;
        public Pair(A first, B second){
            this.first = first;
            this.second = second;
        }
    }
}

Measured memory_bytes: 57376
A,B = [ int(x) for x in input().split()]

prize = [300000, 200000, 100000]

prize_all = 0
if A < 4:
    prize_all += prize[A - 1]
if B < 4:
    prize_all += prize[B - 1]

if A == 1 and B == 1:
    prize_all += 400000

print("{0}".format(prize_all))

Measured memory_bytes: 3060
import java.util.*;
 
class Point implements Comparable<Point> {
  int a, b;
  Point (int a, int b) {
    this.a = a;
    this.b = b;
  }
 
  public int hashCode() {
    return a ^ ((b << 16) | (b >> 16));
  }
 
  public boolean equals(Object object) {
    Point point = (Point)object;
    return this.a == point.a && this.b == point.b;
  }

  public int compareTo(Point p) {
    if (this.a != p.a) {
      return this.a - p.a;
    }
    return this.b - p.b;
  }
}
 
public class Main {
  public static void main(String[] args) {
    Scanner s = new Scanner(System.in);
    int h = s.nextInt();
    int w = s.nextInt();
    int n = s.nextInt();
    HashMap<Point, Integer> map = new HashMap<Point, Integer>();
//    TreeMap<Point, Integer> map = new TreeMap<Point, Integer>();
    for (int i = 0; i < n; i++) {
      int a = s.nextInt() - 1;
      int b = s.nextInt() - 1;
      for (int da = Math.max(0, a - 2); da <= Math.min(h - 3, a); da++) {
        for (int db = Math.max(0, b - 2); db <= Math.min(w - 3, b); db++) {
          Point p = new Point(da, db);
          if (map.get(p) == null) {
            map.put(p, 1);
          } else {
            map.put(p, map.get(p) + 1);
          }
        }
      }
    }
    long[] output = new long[10];
    output[0] = (long)(h - 2) * (long)(w - 2);
    for (int value : map.values()) {
      output[0]--;
      output[value]++;
    }
    for (long value : output) {
      System.out.println(value);
    }
  }
}


Measured memory_bytes: 133872
#include <iostream>
#include <cstring>
#include <algorithm>
#include <vector>
#include <string>
#include <math.h>
#include <stdio.h>
#include <iomanip>
#include <limits>
#include <list>
#include <queue>
#include <tuple>
#include <map>
#include <sstream>
using namespace std;
#define MOD (long long int)(1e9+7)
#define ll long long int
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define reps(i,n) for(int i=1; i<=(int)(n); i++)
#define REP(i,n) for(int i=n-1; i>=0; i--)
#define REPS(i,n) for(int i=n; i>0; i--)
#define FOR(i,a,b) for(int i=a; i<(int)(b); i++)
#define ALL(x) (x).begin(),(x).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define SORT(c) sort(ALL(x))
#define CLR(a) memset((a), 0 ,sizeof(a))
#define PB push_back
#define MP make_pair
#define SP << " " <<
const int INF = 1001001001;
const ll LINF = 100100100100100100;
const double EPS = 1e-10;
const double PI  = acos(-1.0);
typedef pair<int,int> PII;
typedef vector<int> VI;
typedef vector<VI> VVI;

template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
    std::fill( (T*)array, (T*)(array+N), val );
}

__attribute__((constructor))
void initial(){
	cin.tie(nullptr);
	ios::sync_with_stdio(false);
	cout << fixed << setprecision(15);
}

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


  return 0;
}


Measured memory_bytes: 764
#include<iostream>
#include<cstdio>
#include<cstring>
#include<map>
#include<cstdlib>
#include<stack>
#include<queue>
#include<algorithm>
#include<set>
#include<vector>
#include<cmath>
#include<string>
#include<bitset>
#define lmid l,mid,rt<<1
#define rmid mid+1,r,rt<<1|1
#define ll long long
using namespace std;
int main() {
     string a, b;
     cin >> a >> b;
     string c = a + b, d = b + a;
     int res = 0, ans = 0;
     for (int i = 0; i < c.size(); i++) {
          res = res * 10 + c[i] - '0';
     }
     for (int i = 0; i < d.size(); i++) {
          ans = ans * 10 + d[i] - '0';
     }
     int e = sqrt(res), f = sqrt(ans);
     if (e * e == res || f * f == ans) {
          printf("Yes\n");
     } else printf("No\n");
     return 0;
}


Measured memory_bytes: 256
n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
c = list(map(int, input().split()))
manzoku = 0

for i in range(n):
    manzoku += b[a[i]-1]
    if i>=1 and a[i-1] + 1 == a[i]:
        manzoku += c[a[i-1]-1]
print(manzoku)

Measured memory_bytes: 3064
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <stack>
#include <queue>
#include <cmath>
#include <tuple>
#include <cstdio>
#include <bitset>
#include <sstream>
#include <iterator>
#include <numeric>
#include <map>
#include <cstring>
#include <set>
#include <functional>
#include <iomanip>

using namespace std;

#define DEBUG_ //!!提出時にコメントアウト!!
#ifdef DEBUG_
	#define dump(x)  cerr << #x << " = " << (x) << endl;
#else
	#define dump(x)  ;
#endif

#define equals(a,b) (fabs((a)-(b)) < EPS)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define SZ(x) ((int)(x).size())
#define pb push_back
#define eb emplace_back

//#define int long long

typedef long long LL;
typedef vector<int> VI;
typedef vector<LL> VL;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef pair<LL, LL> PLL;

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>
std::string printVector(const std::vector<T> &data)
{
    std::stringstream ss;
    std::ostream_iterator<T> out_it(ss, ", ");
    ss << "[";
    std::copy(data.begin(), data.end() - 1, out_it);
    ss << data.back() << "]";
    return ss.str();
}

template <typename T>
void print_array(const T &ary, int size){
    REP(i,size){
        cout << ary[i] << " ";
    }
    cout << endl;
}

const int mod = 1e9+7;
const LL LINF = 1001002003004005006ll;
const int INF = 1001001001;
const double EPS = (1e-10);

struct mint {
    LL x; // typedef long long LL;
    mint(LL x=0):x( x >= 0 ? x%mod : x%mod+mod){}
    mint& operator+=(const mint a) {
      if ((x += a.x) >= mod) x -= mod;
      return *this;
    }
    mint& operator-=(const mint a) {
      if ((x += mod-a.x) >= mod) x -= mod;
      return *this;
    }
    mint& operator*=(const mint a) {
      (x *= a.x) %= mod;
      return *this;
    }
    mint operator+(const mint a) const {
      mint res(*this);
      return res+=a;
    }
    mint operator-(const mint a) const {
      mint res(*this);
      return res-=a;
    }
    mint operator*(const mint a) const {
      mint res(*this);
      return res*=a;
    }
    mint pow(LL t) const {
      if (!t) return 1;
      mint a = pow(t>>1);
      a *= a;
      if (t&1) a *= *this;
      return a;
    }
   
    // for prime mod
    mint inv() const {
      return pow(mod-2);
    }
    mint& operator/=(const mint a) {
      return (*this) *= a.inv();
    }
    mint operator/(const mint a) const {
      mint res(*this);
      return res/=a;
    }
  };

signed main(int argc, char const *argv[])
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << setprecision(12);
    LL N,K; cin >> N >> K;

    mint ans = 0;
    for(LL i = K; i <= N+1; i++){
        LL tmin = (i-1) * i / 2;
        LL tmax = (2*N-(i-1)) * i / 2;
        //dump(tmin)
        //dump(tmax)
        ans += tmax - tmin + 1;
    }
    cout << ans.x << endl;


}


Measured memory_bytes: 3652
#include <iostream>
#include <vector>
#include <algorithm>
#include <utility>
#include <queue>
#include <string>
#include <set>
#include <bitset>
#include <unordered_map>
#include <cmath>
#include <functional>
#include <map>
#include <cstdlib>
#include <stack>
#include <cassert>

// aliases
using namespace std;
using ll = long long;
using Pii = pair<int, int>;
using Pll = pair<ll, ll>;
template <class T>
using Vvec = vector<vector<T> >;

// for debug
template <class T>
void debug(T& v)
{
    for(auto& x: v) cout << x << " ";
    cout << endl;
}

void bfs(vector<string>& s, Vvec<int>& dist, const int sh, const int sw){
    const int H = s.size();
    const int W = s[0].size();
    deque<Pii> deq;
    deq.emplace_front(0, sh*W+sw);
    const int infty = 1e9;
    for(auto& v: dist){
        for(auto& e: v) e = infty;
    }
    dist[sh][sw] = 0;

    const int dh[] = {1, 0, -1, 0};
    const int dw[] = {0, 1, 0, -1};
    auto isroad = [&](int h, int w){
        return (h>=0) && (h<H) && (w>=0) && (w<W) && (s[h][w]=='.');
    };

    while(!deq.empty()){
        Pii p = deq.front();
        deq.pop_front();
        int d = p.first;
        int h = p.second / W;
        int w = p.second % W;
        
        // walk
        for(int i=0; i<4; i++){
            int nh = h + dh[i];
            int nw = w + dw[i];
            if(isroad(nh, nw) && dist[nh][nw] > d){
                dist[nh][nw] = d;
                deq.emplace_front(d, nh*W+nw);
            }
        }

        // warp
        for(int i=-2; i<3; i++){
            for(int j=-2; j<3; j++){
                int nh = h + i;
                int nw = w + j;
                if(isroad(nh, nw) && dist[nh][nw] > d+1){
                    dist[nh][nw] = d+1;
                    deq.emplace_back(d+1, nh*W+nw);
                }
            }
        }
    }
}

// answer
int main()
{
    int H, W, sh, sw, th, tw;
    cin >> H >> W >> sh >> sw >> th >> tw;
    sh--; sw--;
    th--; tw--;
    vector<string> s(H);
    for(auto& e: s) cin >> e;

    Vvec<int> dist(H, vector<int>(W));
    bfs(s, dist, sh, sw);

    cout << ((dist[th][tw] > 1e8) ? -1 : dist[th][tw]) << endl;
}

Measured memory_bytes: 8700
'use strict';
const main = input => {
  const n = parseInt(input[0].split(' ')[0]), T = parseInt(input[0].split(' ')[1]);
  let ans = 10000;
  for(let i=0; i<n; i++) {
    let c = parseInt(input[i+1].split(' ')[0]),t = parseInt(input[i+1].split(' ')[1]);
    if (ans > c && T >= t) ans = c;
  }
  console.log(ans==10000?'TLE':ans);
  
}
main(require("fs").readFileSync("/dev/stdin", "utf8").split('\n'));

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

int main() {
  vector <int>vec(3);
  cin>>vec.at(0)>>vec.at(1)>>vec.at(2);
  vector<int>veco={5,5,7};
  sort(vec.begin(),vec.end());
  if(veco==vec){
    cout<<"YES"<<endl;
  }
  else{
    cout<<"NO"<<endl;
  }
}


Measured memory_bytes: 3656
import java.util.*;

public class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        int c = sc.nextInt();

        int ab = a + b;
        int bc = b + c;
        int ac = a + c;

        if(ab == c || bc == a || ac == b){
            System.out.println("Yes");
        } else {
            System.out.println("No");
        }
    }

    public static void printArray(int[] array){
        for(int i=0; i<array.length; i++){
            if(i == array.length){
                System.out.println(array[i]);
            } else {
                System.out.print(String.format("%d ", array[i]));
            }
        }
    }
}


Measured memory_bytes: 21844
#include <bits/stdc++.h>
using namespace std;
#define IOS ios::sync_with_stdio(false); cin.tie(0);
#define FOR(i,s,n) for(int i = s; i < (n); i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(n) (n).begin(), (n).end()
#define RALL(n) (n).rbegin(), (n).rend()
#define ATYN(n) cout << ( (n) ? "Yes":"No") << endl;
#define CFYN(n) cout << ( (n) ? "YES":"NO") << endl;
using ll = long long;
using ull = unsigned long long;

int main(void)
{
    IOS
    int n,m;
    cin >> n >> m;
    vector<pair<int,int>> v1;
    priority_queue<int> v2;
    REP(i,n) {
        int a,b;
        cin >> a >> b;
        v1.emplace_back(make_pair(a,b));
    }

    sort(ALL(v1));
  
    int ans = 0;
    int cnt = 0;
    FOR(i,1,m+1) {
        while(v1[cnt].first <= i && cnt < n) {
            v2.push(v1[cnt].second);
            cnt++;
        }
        if (!v2.empty()) {
            ans += v2.top();
            v2.pop();
        }

    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 1908