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

using namespace std;
int  a[10000];
int main()
{
    int n,k;
    scanf("%d%d",&n,&k);
    for(int i=0;i<n;++i){
        cin>>a[i];
    }
    sort(a,a+n);
    int ant=0;
    for(int i=0;i<k;i++){
        ant+=a[i];
    }
    cout<<ant;
}

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

int main(void) {
    int S, M, inputLength;
    string input, next;
    while(true) {
        cin >> input;
        if(input == "-") break;

        inputLength = input.size();
        cin >> M;
        for(int i=0; i < M; i++) {
            cin >> S;
            input += input;
            input = input.substr(S, inputLength);
        }
        cout << input << endl;
    }

    return 0;
}

Measured memory_bytes: 3136
// https://atcoder.jp/contests/abc105/tasks/abc105_c

#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

#define REP(i,n)   for(int i=0; i<(int)(n); i++)
#define FOR(i,b,e) for(int i=(b); i<=(int)(e); i++)
#define DUMP(a, n) REP(_i, n) printf("%d%c", a[_i], _i + 1 == n ? '\n' : ' ')
#define DUMP2D(a, n, m) REP(_i, n) REP(_j, m) printf("%d%c", a[_i][_j], _j + 1 == m ? '\n' : ' '); puts("")
#define DUMPLL(a, n) REP(_i, n) printf("%lld%c", a[_i], _i + 1 == n ? '\n' : ' ')

const int N_MAX = 1e9;
const int S_MAX = 35;

ll N;
ll rng[S_MAX + 2];
int len;
char buf[S_MAX + 1];
char S[S_MAX + 1];

void solve() {
  ll x = 1;
  rng[0] = rng[1] = 0;
  REP(i, S_MAX) {
    rng[i + 2] = rng[i] + x;
    x *= -2;
  }
  // DUMPLL(rng, S_MAX + 2);
  len = 1;
  fill(buf, buf + S_MAX, '0');
  buf[S_MAX] = '\0';
  while (N != 0) {
    int sgn = N > 0 ? 1 : -1;
    int i = N > 0 ? 0 : 1;
    while (i < S_MAX) {
      if (abs(N) <= abs(rng[i + 2])) break;
      i += 2;
    }
    if (i >= S_MAX) break;
    len = max(len, i + 1);
    buf[i] = '1';
    N -= sgn * (1 << i);
  }
  REP(i, len) S[i] = buf[len - 1 - i];
  S[len] = '\0';
  printf("%s\n", S);
}

void input() {
  scanf("%lld", &N);
}

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


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

#define select(_1, _2, x, ...) x

#define repn(i, n) for (int i = 0; i < (n); i++)
#define repr(i, a, b) for (int i = (a); i < (b); i++)
#define rep(i, ...) select(__VA_ARGS__, repr, repn)(i, __VA_ARGS__)

#define rrepn(i, n) for (int i = (n - 1); i >= 0; i--)
#define rrepr(i, a, b) for (int i = (b - 1); i >= (a); i--)
#define rrep(i, ...) select(__VA_ARGS__, rrepr, rrepn)(i, __VA_ARGS__)

#define all(v) v.begin(), v.end()
#define debug(x) cerr << #x << " = " << x << endl

using namespace std;
using ll = long long;

const int INF = 1e9;
const ll LINF = 1e18;


int main() {
    long double l;
    cin >> l;

    long double t = l / (long double)3.0;
    long double a = t * t * t;
    cout << fixed;
    cout << a << endl;

    return 0;
}


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

#define fi first
#define se second
#define all(x) x.begin(), x.end()
using namespace std;
using ull = unsigned long long;
using ll = long long;
constexpr int I_INF = INT_MAX;
constexpr ll L_INF = LLONG_MAX;

struct __INIT {
    __INIT() {
        cin.tie(nullptr);
        ios::sync_with_stdio(false);
        cout << fixed << setprecision(15);
    }
} __init;

int main() {
    int N;
    cin >> N;
    vector<ll> A(N);
    for (int i = 0; i < N; i++) cin >> A[i];

    ll sum = 0;
    ll ans = 0;
    // A[0] > 0
    for (int i = 0; i < N; i++) {
        sum += A[i];
        if (i % 2 == 1 and sum >= 0) {
            ans += (sum + 1);
            sum = -1;
        } else if (i % 2 == 0 and sum <= 0) {
            ans += (1 - sum);
            sum = 1;
        }
    }
    // A[0] < 0
    sum = 0;
    ll ans2 = 0;
    for (int i = 0; i < N; i++) {
        sum += A[i];
        if (i % 2 == 1 and sum <= 0) {
            ans2 += (1 - sum);
            sum = 1;
        } else if (i % 2 == 0 and sum >= 0) {
            ans2 += (sum + 1);
            sum = -1;
        }
    }
    cout << min(ans, ans2) << endl;
}

Measured memory_bytes: 1024
#Greatest Common Divisor
#http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ALDS1_1_B&lang=jp

def gcd(a,b): 
    if ((a%b) == 0 ):
        return b
    else:    
        return (gcd(b,a%b))

(a,b) = map(int,input().split())
print (gcd(a,b))


Measured memory_bytes: 5600
#include<iostream>
using namespace std;
int main()
{
    int n,i;
    cin>>n;
    int dp[n+1]={0};
    dp[0]=0;
    dp[1]=0;
    dp[2]=0;
    dp[3]=1;
    for(i=4;i<=n;i++)
    {
        dp[i]=1;
        for(int j=3;j<=i;j++)
        {
            if(i-j>=3)
            {
                dp[i]=(dp[i]%1000000007+dp[i-j]%1000000007)%1000000007;
            }
        }
    }
    cout<<dp[n]<<endl;
}


Measured memory_bytes: 3628
S = str(input())
T = str(input())

ans = len(T)
for i in range(len(S) - len(T) + 1):
    change_num = len(T)
    for j in range(len(T)):
        if T[j]==S[i+j]:
            change_num -= 1
    ans = min(ans, change_num)
    
print(ans)

Measured memory_bytes: 9116
#include <algorithm>
#include <bitset>
#include <tuple>
#include <cstdint>
#include <cstdio>
#include <cctype>
#include <assert.h>
#include <stdlib.h>
#include <stdio.h>
#include <cassert>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <ctime>
#include <deque>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <list>
#include <limits>
#include <map>
#include <memory>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
#define ArraySizeOf(array)     (sizeof(array) / sizeof(array[0]))
#define res(i,n) for(int i=n;;i++)
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define REP(i,n) for(int i=1;i<n;i++)
#define rev(i,n) for(int i=n-1;i>=0;i--)
#define REV(i,n) for(int i=n-1;i>0;i--)
#define req(i,n,m) for(int i=n;i<m;i++)
#define REQ(i,n,m,l) for(int i=n;i<m;i+=l) 
#define _GLIBCXX_DEBUG
int INF = 1e9 + 7;
unsigned NthDayOfWeekToDay(unsigned n, unsigned dow, unsigned dow1)
{
    unsigned day;
    if (dow < dow1) dow += 7;
    day = dow - dow1;
    day += 7 * n - 6;
    return day;
}
signed gcd(long long x, long long y) {
    if (y == 0)return x;
    return gcd(y, x % y);
}
signed lcm(long long x, long long y) {
    return x / gcd(x, y) * y;
}
unsigned DayToWeekNumber(unsigned day)
{
    return (day - 1) / 7 + 1;
}
unsigned AnotherDayOfWeek(unsigned day, unsigned day0, unsigned dow0)
{
    return (dow0 + 35 + day - day0) % 7;
}
using namespace std;
signed main() {
    int N, Y; cin >> N >> Y;
    rep(i, N + 1) {
        rep(j, N + 1) {
            if (N - i - j < 0)break;
            if (i * 10000 + j * 5000 + (N - i - j) * 1000 == Y) {
                cout << i << " " << j << " " << N - i - j << endl;
                return 0;
            }
        }
    }
    cout << -1 << " " << -1 << " " << -1 << endl;
}

Measured memory_bytes: 3644
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;

namespace AtCoder
{
	public class ABC
	{
		static long mod = 1000000007;  // 10^9+7

		static void Main(string[] args)
		{
			Console.SetOut(new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false });


			int n = int.Parse(Console.ReadLine());
			// string s = Console.ReadLine();
			// int[] vs = Console.ReadLine().Split().Select(int.Parse).ToArray();
			double[][] map = new double[n][];
			for (int i = 0; i < n; i++) {
				map[i] = Console.ReadLine().Split().Select(double.Parse).ToArray();
			}
			double sum = 0;
			for (int i = 0; i < n; i++) {
				for (int j = 0; j < n; j++) {
					if (i != j) {
						double x = map[i][0] - map[j][0];
						double y = map[i][1] - map[j][1];
						sum += Math.Sqrt(x * x + y * y);
						//System.Diagnostics.Debug.WriteLine($"{i} {j} {Math.Sqrt(x * x + y * y)}");
					}
				}
			}
			double ans = sum / n;
			Console.WriteLine(ans);


			Console.Out.Flush();
		}
	}
}


Measured memory_bytes: 13396
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define fi first
#define se second
#define itrfor(itr,A) for(auto itr = A.begin(); itr !=A.end();itr++)
template <class T> using reversed_priority_queue = priority_queue<T, vector<T>, greater<T> >;
typedef long long llong;
char moji[26]={'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'};
char moji2[26]={'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z'};
char moji3[10]={'0','1','2','3','4','5','6','7','8','9'};
#define Sort(a) sort(a.begin(),a.end());
#define Reverse(a) reverse(a.begin(),a.end());
#define print(a) cout << a << endl;
#define MOD llong(1e9+7)
#define MAX int(2 * 1e5 +5)
#define debug(x)  cout << #x << " = " << (x) << endl;
#define pi acos(-1.0)
#define int llong

signed main(){
    int k,a,b; cin >> k >> a >> b;
    if( a + 2 >= b or k <= a){
        cout << k + 1 << endl;
        return 0;
    }
    int ans = b;
    k-= a+1;
    ans += (b-a) * int(k/2);
    ans += k%2;
    cout << ans << endl;
}

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

using namespace std;

int main()
{
	int a,b,c;
  	scanf("%d%d%d",&a,&b,&c);
  	if(a>b)
    {
      if(a>c)
        a*=10;
      else
        c*=10;
    }
  else
  {
    if(b>c)
        b*=10;
      else
        c*=10;
  }
  printf("%d",(a+b+c));
}


Measured memory_bytes: 256
r,c=map(int,input().split())
a=[[0]*c for i in range(r)]

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

b=[[0]*(c+1) for i in range(r+1)]


for i in range(r):
    sum=0
    for j in range(c):
        b[i][j]=a[i][j]
        sum+=a[i][j]
    b[i][c]=sum

for i in range(c):
    sum=0
    for j in range(r):
        sum+=a[j][i]
    b[r][i]=sum

sum=0
for i in range(c):
    sum+=b[r][i]

b[r][c]=sum

for i in range(r+1):
    for j in range(c+1):
        if j>=1:
            print(" "+str(b[i][j]),end="")
        else:
            print(b[i][j],end="")
    print()



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

string S;

int main(void) {
  cin >> S;

  ll l = 0, r = S.length() - 1;
  ll ans = 0;
  while(1) {
    if(l >= r) break;
    if(S[l] == S[r]) {
      l++;
      r--;
      continue;
    }
    if(S[l] != 'x' && S[r] != 'x') {
      cout << -1 << endl;
      return 0;
    }
    if(S[l] == 'x' && S[r] != 'x') {
      l++;
      ans++;
    }
    if(S[l] != 'x' && S[r] == 'x') {
      r--;
      ans++;
    }
  }
  cout << ans << endl;
}


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

typedef long long int ll;

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

    //ll a, c, i, j, k;
    ll a, b1, b2, b;
    char ch;

    cin >> a >> b1 >> ch >> b2;
    b = 100*b1 + b2;

    cout << (a*b)/100 << '\n';
    
    return 0;
}


Measured memory_bytes: 3660
#include<bits/stdc++.h>
using namespace std;
int main()
{



    long long a,b,st=0,td=0;
    cin>>a;
    vector<long long>v;
    vector<long long>area;
   long long arr[3]={0,0,0};
    map<long long,long long>mp,pm;
    map<long long,long long> :: iterator it;
    for(int i=0;i<a;i++)
    {
       cin>>b;
       mp[b]++;
       v.push_back(b);
    }
    for(auto it = mp.rbegin();it != mp.rend();++it)
    {
        long long abc=it->first;
         if(mp[abc]>=4&&st==0)
        {
            area.push_back(abc*abc);
            st=1;
          //  cout<<"sq"<<abc<<endl;
        }

        if(mp[abc]>=2&&td<2)
        {
            arr[td]=abc;
            td++;
          //  cout<<"*"<<abc<<endl;

        }
    }

   /* for(int i=v.size()-1;i>=0;i--)
    {




    }*/
    if(td==2)
        area.push_back(arr[0]*arr[1]);
    if(area.size()!=0)
    {
        sort(area.begin(),area.end());
        cout<<area[area.size()-1];
    }
    else cout<<"0"<<endl;








}


Measured memory_bytes: 7284
n = int(input())
r = []
for i in range(n):
    a = list(input().split())
    a[1] = int(a[1])
    a.append(i + 1)
    r.append(a)
r.sort(key = lambda x: x[1], reverse = True)
r.sort(key = lambda x: x[0])
for i in r:
    print(i[2])

Measured memory_bytes: 9036
#include<algorithm>
#include<vector>
#include<list>
#include<iostream>
#include<utility>
#include<string>
#include<set>
#include<queue>
#include<stack>
#include<iterator>
#include<map>
#include<limits>

const int INF=2147483647;

using namespace std;




int main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    
    int n, m;
    cin>>n>>m;
    vector<vector<int>> graph(n+1);
    for(int i=0; i<m; i++){
        int x,y;
        cin>>x>>y;
        graph[x].push_back(y);
        graph[y].push_back(x);
    }
    vector<bool> visited(n+1,false);
    vector<int> path,path2;
    int pos=1;
    path.push_back(pos);
    visited[pos]=true;
    bool finished=false;
    while(!finished){
        bool found=false;
        for(int i=0; i<graph[pos].size() && !found; i++){
            if(!visited[graph[pos][i]]){
                int x=graph[pos][i];
                found=true;
                path.push_back(x);
                visited[x]=true;
                pos=x;
                
            }
        }
        if(!found) finished=true;
    }
    
    finished=false;
    pos=1;
    while(!finished){
        bool found=false;
        for(int i=0; i<graph[pos].size() && !found; i++){
            if(!visited[graph[pos][i]]){
                int x=graph[pos][i];
                found=true;
                path2.push_back(x);
                visited[x]=true;
                pos=x;
                
            }
        }
        if(!found) finished=true;
    }
    cout<<path2.size()+path.size()<<endl;
    
    reverse(path2.begin(),path2.end());
    for(int i:path2){
        cout<<i<<" ";
    }
    for(int i: path){
        cout<<i<<" ";
    }
    
    
    return 0;
}

Measured memory_bytes: 6776
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define END getchar();getchar();return 0
#define rep(i,n) for(int i=0;i<n;i++)
#define inf 1000000007
typedef pair<int, int> P;

bool prime(int n) {
	for (int i = 2; i <= sqrt(n); i++) {
		if (n%i == 0)return false;
	}
	return n != 1;
}
int gcd(int x, int y) {
	if (y == 0)return x;
	return gcd(y, x%y);
}
int lcm(int x, int y) {
	return x / gcd(x, y)*y;
}

signed main() {
	int n, k, ans = 0;
	char s[114514];
	cin >> n >> k;
	vector<int>l, r;
	rep(i, n) cin >> s[i];
	l.push_back(1);
	r.push_back(1);
	if (s[0] == '1') {
		l.push_back(1);
	}
	for (int i = 1; i < n; i++) {
		if (s[i] == '0' && s[i - 1] == '1') {
			r.push_back(i);
		}
		else if (s[i] == '1' && s[i - 1] == '0') {
			l.push_back(i + 1);
		}
	}
	if (s[n - 1] == '1') {
		r.push_back(n);
	}
	l.push_back(n);
	r.push_back(n);
	if (k >= l.size()) {
		cout << n << endl;
		END;
	}
	for (int i = k; i < l.size(); i++) {
		ans = max(ans, r[i] - l[i - k] + 1);
	}
	cout << ans << endl;

	END;
}


Measured memory_bytes: 1400
#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;
#define out(n) cout << (n) << endl;
using ll = long long;
using ull = unsigned long long;
using pii = pair<int,int>;

int main(void)
{
    IOS
    const int N = 10;
    int h, w;
    cin >> h >> w;
    vector<vector<int>> c(N,vector<int>(N));
    REP(i,N) REP(j,N) cin >> c[i][j];
    vector<vector<int>> a(h,vector<int>(w));
    REP(i,h) REP(j,w) cin >> a[i][j];

    // ワーシャルフロイド
    REP(k,N) REP(i,N) REP(j,N) c[i][j] = min(c[i][j], c[i][k] + c[k][j]);

    int ans = 0;
    REP(i,h) REP(j,w) {
        if (a[i][j] != -1) {
            int x = a[i][j];
            ans += c[x][1];
        }
    }

    cout << ans << endl;

    return 0;
}

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

struct Fast {Fast() {std::cin.tie(0); ios::sync_with_stdio(false);}} fast;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using pii = pair<int, int>;
using vll = vector<long long>;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define mp make_pair
#define MOD 1000000007

int main() {
    ll X,Y; cin >> X >> Y;
    int ans = 0;
    while(X <= Y){
        X *= 2;
        ans++;
    }
    cout << ans << endl;

}


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

vector<vector<ll>> comb(int n, int r) {
    vector<vector<ll>> v(n + 1, vector<ll>(n + 1, 0));
    for (int i = 0; i < v.size(); i++) {
        v[i][0] = 1;
        v[i][i] = 1;
    }
    for (int j = 1; j < v.size(); j++) {
        for (int k = 1; k < j; k++) {
            v[j][k] = (v[j - 1][k - 1] + v[j - 1][k]);
        }
    }
    return v;
}

int main() {
    int n, m;
    cin >> n >> m;
    vector<vector<ll>> ncr, mcr;
    ncr = comb(n, 2);
    mcr = comb(m, 2);
    if (n <= 1 && m <= 1) {
        cout << 0 << endl;
    } else {
        cout << ncr[n][2] + mcr[m][2] << endl;
    }
    return 0;
}

Measured memory_bytes: 384
using System;
using System.Collections.Generic;
             
public static class Program
{
    public static void Main()
    {
        int[] table = new int[4];
        for (int i = 0; i < 3; i++)
        {
            foreach (string c in ReadLine().Split(' '))
            {
                table[int.Parse(c) - 1] += 1;
            }
        }
        for (int i = 0; i < table.Length; i++)
        {
            if (2 < table[i])
            {
                Console.WriteLine("NO");
                return;
            } 
        }
            
	Console.WriteLine("YES");
    }
    
    private static string ReadLine()
    {
    	return Console.In.ReadLine();
    }
    
    public static int[] GetIntArray()
    {
    	List<int> temp = new List<int>();
    	foreach (string c in ReadLine().Split(' '))
            temp.Add(int.Parse(c));
        return temp.ToArray();
    }
    
    public static int GetInt()
    {
    	return int.Parse(ReadLine());
    }
}



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

using LL = long long;
using LD = long double;
using PII = pair<int,int>;
using PIII = pair<int,PII>;
using PLL = pair<LL, LL>;
using PSI = pair<string, int>;
using VI = vector<int>;
using VVI = vector<VI>;
using VL = vector<LL>;
using VVL = vector<VL>;
using VS = vector<string>;
using VVS = vector<VS>;
using VC = vector<char>;
using VVC = vector<VC>;
using VPII = vector<PII>;
#define endl		'\n'
#define X		first
#define Y		second
#define MP		make_pair
#define PB		push_back
#define MIN(a, b, c)	min((a), min((b), (c)))
#define SZ(a)		int(a.size())
#define SQR(a)		((a)*(a))
#define ALL(a)		a.begin(), a.end()
#define FORI(i, a, b)	for(int i = int(a); i < int(b); ++i)
#define FORD(i, a, b)	for(int i = int(b)-1; i >= int(a); --i)
#define FILL(a,v)	memset(a, v, sizeof (a))
struct _ { ios_base::Init i; _() { cin.sync_with_stdio(0); cin.tie(0); } } _;
const double EPS = (double)1e-8;
const int MOD = 1000000007;
const double PI = 3.14159265358979;
//
// Todo, make a template for "for each" loop.
// Template below has been copied from tourist.

string to_string(string s) {
  return '"' + s + '"';
}

string to_string(const char* s) {
  return to_string((string) s);
}

string to_string(bool b) {
  return (b ? "true" : "false");
}

template <typename A, typename B>
string to_string(pair<A, B> p) {
  return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";
}

template <typename A>
string to_string(A v) {
  bool first = true;
  string res = "{";
  for (const auto &x : v) {
    if (!first) {
      res += ", ";
    }
    first = false;
    res += to_string(x);
  }
  res += "}";
  return res;
}

void debug_out() { cerr << endl; }

template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cerr << " " << to_string(H);
  debug_out(T...);
}

#ifdef LOCAL
#define debug(...) cerr << "[" << __FILE__ << "][" << __FUNCTION__ << "][Line " << __LINE__ << "][" <<  #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define debug(...) 42
#endif


int main()
{
    int n; cin >> n;
    
    cout << n*n << endl;
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<functional>
#include<cmath>
#include<numeric>
#include<queue>
#include<string>
#include<vector>
#include <stdio.h>
#define ll long long
#include<cstring>
#define rep(i,n) for(int i=0;i<n;i++)
ll mod = 1000000007;
using namespace std;
priority_queue<ll int>QUE;//きゅー

int length(char* str) {
	int len = strlen(str);
	return len;
}
struct ans{
    int cost;
    int count;
    bool operator<(const ans& b)const {
        return cost < b.cost;
    };
};
ll LCM(ll a,ll b)
{

    ll r, x, tmp;
    ll i, j;
    ll lcm;
    i = a;
    j = b;

    /* 自然数 a > b を確認・入替 */
    if (a < b) {
        tmp = a;
        a = b;
        b = tmp;
    }

    /* ユークリッドの互除法 */
    r = a % b;
    while (r != 0) {
        a = b;
        b = r;
        r = a % b;
    }
    lcm = (i / b) * j;

    return lcm;
}
int main()
{
    int N;
    ll a[1000100];
    ll sum = 0;
    cin >> N;
    for (int i = 0; i < N; i++) {
        cin >> a[i];
        sum += a[i];
    }
    ll ans=100000000000;
    ll L = 0, R = 0;
    for (int i = 0; i < N-1; i++) {
        L += a[i];
        R = sum - L;
        ans = min(ans, abs(L - R));
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 2560
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define mp make_pair
#define sz(x) (int)(x).size()
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define ii pair<int,int>
#define INF 1000000000
#define M 1000000007ll
#define UQ(x) (x).resize(distance((x).begin(),unique(all((x)))))
int h,w;
char s[15][15];
int main() {
	scanf("%d%d",&h,&w);
	for (int i=0;i<h;i++) scanf("%s",s[i]);
		bool die=0;
	for (int i=0;i<h;i++) {
		for (int j=0;j<w;j++) {
			for (int x=0;x<h;x++) {
				for (int y=0;y<w;y++) {
					if (s[i][j]=='#' && s[x][y]=='#' && i>x && j<y) {
						die=1;
						break;
					}
				}
			}
		}
	}
	printf("%s\n", die?"Impossible":"Possible");
}

Measured memory_bytes: 764
S=str(input())
max_count = 0
count = 0
for i in range(len(S)):
  if S[i] == 'A' or S[i] == 'T' or S[i] == 'G' or S[i] == 'C':
    count = count + 1
    if count > max_count:
      max_count = count
  else:
    count = 0
print(max_count)


Measured memory_bytes: 2940
fun main(args: Array<String>) {
    val sLine = readLine()?.split(" ").orEmpty()
    val numN = sLine[0].toInt()
    val numY = sLine[1].toInt()

    var yukichi = - 1
    var ichiyo = - 1
    var goro = - 1


    run loop@{
        for(i in 0 .. numN){
            for( j in 0 .. numN - i){
                var sum = 10000 * i + 5000 * j + 1000 * (numN - i - j)
                if(sum == numY){
                    yukichi = i
                    ichiyo = j
                    goro = numN - i - j
                    return@loop
                }

            }
        }
    }


    println("$yukichi $ichiyo $goro")
}

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

int main() {
  char c;
  cin >> c;
  
  if (c == 'a' || c == 'e' || c == 'i' || c == 'o' || c == 'u') {
    cout << "vowel" << endl;
  }
  else {
    cout << "consonant" << endl;
  }
}

Measured memory_bytes: 256
import * as fs from "fs";

function main(lines: string[][]) {
  const numbers = lines[1].map((l) => parseInt(l));
  let countDiviedBy2 = 0;
  numbers.forEach((num) => {
    while (num % 2 === 0) {
      num /= 2;
      countDiviedBy2++;
    }
  });
  console.log(countDiviedBy2);
}

const lines = fs
  .readFileSync("/dev/stdin", "utf8")
  .split("\n")
  .map((l) => l.split(" "))
  .filter((input) => !(input.length === 1 && input[0] === ""));

main(lines);


Measured memory_bytes: 7756
import java.util.Scanner;

class Main{
	public static void main(String[] args) {
		Scanner sc=new Scanner(System.in);
		int kosu=sc.nextInt();
		long[] a=new long[kosu];
		int initial=sc.nextInt();
		long GCD=0;
		for(int i=0; i<kosu; i++) {
			a[i]=Math.abs(sc.nextLong()-initial);
		}
		if(kosu==1) {
			System.out.println(a[0]);
			System.exit(0);
		}
		else if(kosu==2) {
			GCD=gcd(a[0],a[1]);
			System.out.println(GCD);
			System.exit(0);
		}
		else {
			GCD=gcd(a[0],a[1]);

			for(int i=2; i<kosu; i++) {
				GCD=gcd(GCD,a[i]);
			}
		}
		System.out.println(GCD);
	}

private static long gcd(long m, long n) {
	if(m < n) return gcd(n, m);
	if(n == 0) return m;
		return gcd(n, m % n);
	}
}


Measured memory_bytes: 49680
#include <bits/stdc++.h>
using namespace std;
#define CPP_CAT(x,y) CPP_CAT_I(x,y)
#define CPP_CAT_I(x,y) x ## y

using i8  = int8_t;
using u8  = uint8_t;
using i16 = int16_t;
using u16 = uint16_t;
using i32 = int32_t;
using u32 = uint32_t;
using i64 = int64_t;
using u64 = uint64_t;
using f32 = float;
using f64 = double;
using ll = long long;
constexpr i64 INF = 1010000000000000017LL;
constexpr i64 MOD = 1000000007LL;
constexpr f64 EPS = 1e-12;
constexpr f64 PI = 3.14159265358979323846;
#define FOR(i, start, end) for(i64 i = (start), CPP_CAT(i,xxxx_end)=(end); i < CPP_CAT(i,xxxx_end); ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(f,c,...) (([&](decltype((c)) cccc) { return (f)(std::begin(cccc), std::end(cccc), ## __VA_ARGS__); })(c))
template<typename T, typename U, typename Comp=less<>>
bool chmax(T& xmax, const U& x, Comp comp={}) {
    if(comp(xmax, x)) {
        xmax = x; 
        return true;
    }
    return false;
}
template<typename T, typename U, typename Comp=less<>>
bool chmin(T& xmin, const U& x, Comp comp={}) {
    if(comp(x, xmin)) {
        xmin = x; 
        return true;
    }
    return false;
}
template<typename Val>
bool bitcheck(Val bit, size_t idx) {
    return bit & (1 << idx);
}
struct ProconInit {
    static constexpr int IOS_PREC = 15;
    static constexpr bool AUTOFLUSH = false;
    ProconInit() {
        cin.tie(nullptr); ios::sync_with_stdio(false);
        cout << fixed << setprecision(IOS_PREC);
        if(AUTOFLUSH) cout << unitbuf;
    }
} PROCON_INIT;

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

    ll sum = 0;
    FOR(i, 1, n+1) {
        ll y = n / i;
        sum += y * (y + 1) * i / 2;
    }
    cout << sum << endl;
}

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

Measured memory_bytes: 3656
#include <bits/stdc++.h>
using namespace std;
long long a[200005],b[200005],n,m,k,l,r,sum,f,mx;
int main(){
	cin>>n>>m>>k;
	for(int i=1;i<=n;i++) cin>>a[i];
	for(int i=1;i<=m;i++){
		cin>>b[i];
		if(f==1) continue;
		sum+=b[i];
		r++;
		if(sum>k){
			sum-=b[i];
			r--;
			f=1;
		}
	}
	mx=r;
	while(l<=n&&r>=0){
		if(sum>k) sum-=b[r--];
		else{
			mx=max(mx,l+r);
			sum+=a[++l];
		}
	}
	cout<<mx;
	return 0;
}

Measured memory_bytes: 6740
use std::io::{stdin, Read, StdinLock};
use std::str::FromStr;

// reference: http://ir5.hatenablog.com/entry/20171209/1512821837

struct Scanner<'a> {
    cin: StdinLock<'a>,
}
 
impl<'a> Scanner<'a> {
    fn new(cin: StdinLock<'a>) -> Scanner<'a> {
        Scanner { cin: cin }
    }
 
    fn read1<T: FromStr>(&mut self) -> Option<T> {
        let token = self.cin.by_ref().bytes().map(|c| c.unwrap() as char)
            .skip_while(|c| c.is_whitespace())
            .take_while(|c| !c.is_whitespace())
            .collect::<String>();
        token.parse::<T>().ok()
    }
 
    fn read<T: FromStr>(&mut self) -> T {
        self.read1().unwrap()
    }
}

use std::mem;
use std::cmp;

fn main() {
    let cin = stdin();
    let cin = cin.lock();
    let mut sc = Scanner::new(cin);

    let h: i32 = sc.read();
    let w: i32 = sc.read();
    let mut n: i32 = sc.read();
    if h > w {
        println!("{}", (n + h -1) / h);
    } else {
        println!("{}", (n + w -1) / w);
    }

}

Measured memory_bytes: 2080
def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])

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

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

    return arr

n = int(input())
ans = 0
if n == 1:
    ans = 0
else:
    bunkai = factorization(n)
    for i in bunkai:
        if i[1] < 3:
            ans += 1
        elif i[1] < 6:
            ans += 2
        elif i[1] < 10:
            ans += 3
        elif i[1] < 15:
            ans += 4
        elif i[1] < 21:
            ans += 5
        elif i[1] < 28:
            ans += 6
        elif i[1] < 36:
            ans += 7
        elif i[1] < 45:
            ans += 8
        else:
            ans += 9

print(ans)

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

#define REP(i, n) for(int i = 0; i < (int) (n); i++)
#define ALL(v) (v).begin(), (v).end()
#define INF 1e9

using namespace std;

struct plant{
  string name;
  int price;
  int a, b, c, d, e, f;
  int sell;
  int times;
  double income = f * sell * times - price;
  int span = a + b + c + times * (d + e);
  double eff = income / span;
  plant(string name, int p, int a, int b, int c, int d, int e, int f, int s, int m) : name(name), price(p), a(a), b(b), c(c), d(d), e(e), f(f), sell(s), times(m) {}
  bool operator<(const plant x)const{
    if(eff > x.eff) return true;
    if(eff < x.eff) return false;
    if(name < x.name) return true;
    return false;
  }
};

int main(){
  int n;
  while(cin >> n and n){
    vector<plant> types;
    REP(count, n){
      string name;
      int p, a, b, c, d, e, f, s, m;
      cin >> name >> p >> a >> b >> c >> d >> e >> f >> s >> m;
      types.emplace_back(name, p, a, b, c, d, e, f, s, m);
    }
    sort(ALL(types));
    REP(i, n) cout << types[i].name << endl;
    cout << "#" << endl;
  }
  return 0;
}

Measured memory_bytes: 3028
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(n) for (ll i = 0; i < n; ++i)
#define rep2(i, n) for (ll i = 0; i < n; ++i)
#define rep3(i, a, b) for (ll i = a; i < b; ++i)
#define rep4(i, a, b, c) for (ll i = a; i < b; i += c)
#define erep(n) for (ll i = 0; i <= n; ++i)
#define erep2(i, n) for (ll i = 0; i <= n; ++i)
#define erep3(i, a, b) for (ll i = a; i <= b; ++i)
#define erep4(i, a, b, c) for (ll i = a; i <= b; i += c)
#define rrep(i, a, b) for (ll i = a; i > b; --i)
#define rrep2(i, a, b, c) for (ll i = a; i > b; i -= c)
#define errep(i, a, b) for (ll i = a; i >= b; --i)
#define errep2(i, a, b, c) for (ll i = a; i >= b; i -= c)
#define print(a) cout << a << endl;
#define printVec(v) printf("{"); for (const auto& i : v) { std::cout << i << ", "; } printf("}\n");
#define cin(x) cin >> x;
const ll MOD = 1000000007;
inline int newline() { putchar('\n'); return 0; }

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

    set<ll> s;
    rep(n) {
        ll temp;
        cin >> temp;

        if (s.find(temp) != s.end()) {
            print("NO");
            return 0;
        } else {
            s.insert(temp);
        }
    }

    print("YES");
    return 0;
}

Measured memory_bytes: 9600
N = int(input())
S = tuple(map(int, input()))

ans = 0

for i in range(10):
    if i in S[:N - 2]:
        i_index = S.index(i)
        for j in range(10):
            if j in S[i_index + 1: N - 1]:
                j_index = i_index + S[i_index + 1: N - 1].index(j) + 1
                for k in range(10):
                    if k in S[j_index + 1:]:
                        ans += 1
print(ans)


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

ACcount = 0 
WAcount = 0
TLEcount = 0
REcount = 0
for i in range(N):
	S=input()

	if S == "AC":
		ACcount = ACcount + 1
	elif S == "WA":
		WAcount = WAcount + 1
	elif S == "TLE":
		TLEcount = TLEcount + 1
	elif S == "RE":
		REcount = REcount + 1

print("AC x", ACcount)
print("WA x", WAcount)
print("TLE x", TLEcount)
print("RE x", REcount)


Measured memory_bytes: 9200
#include <iostream>
#include <algorithm>
#include <bitset>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#include <complex>
#include <string.h>
#include <numeric>
using namespace std;

#define int long long
#define reps(i,s,n) for(int (i)=(s);(i)<(n);++(i))
#define rep(i,n) reps(i,0,n)
#define rept(i,n) rep(i,(n)+1)
#define repst(i,s,n) reps(i,s,(n)+1)
#define reprt(i,n,t) for(int (i)=(n);(i)>=(t);--(i))
#define repr(i,n) reprt(i,n,0)
#define each(i,v) for(auto &(i):(v))
#define eachr(i,v) for(auto &(i)=(v).rbegin();(i)!=(v).rend();(i)++)
#define all(c) (c).begin(),(c).end()
#define rall(c) (c).rbegin(),(c).rend()
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define tmax(x,y,z) max(x,max(y,z))
#define tmin(x,y,z) min(x,min(y,z))
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)
#define ln '\n'
#define bln(i,n) (((i)==(n)-1)?'\n':' ')
#define dbg(x) cout<<#x" = "<<(x)<<ln<<flush
#define dbga(x,n) {cout<<#x" : ";for(int (i)=0;i<(n);++i){cout<<((x)[i])<<(i==((n)-1)?'\n':' ')<<flush;}}
#define zero(a) memset(a,0,sizeof(a))
#define unq(a) sort(all(a)),a.erase(unique(all(a)),a.end())

//typedef complex<double> P;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<string> vst;
typedef vector<pii> vpii;
typedef vector<pll> vpll;
typedef vector<vector<int> > mat;

const ll inf = (ll)1e9+10;
const ll linf = (ll)1e18+10;
const ll mod = (ll)(1e9+7);
const int dx[] = {0, 1, 0, -1};
const int dy[] = {1, 0, -1, 0};
const int ddx[] = {0, 1, 1, 1, 0, -1, -1, -1};
const int ddy[] = {1, 1, 0, -1, -1, -1, 0, 1};
const double eps = 1e-10;

ll mop(ll a,ll b,ll m=mod) {ll r=1;a%=m;for(;b;b>>=1){if(b&1)r=r*a%m;a=a*a%m;}return r;}
ll gcd(ll a,ll b) {return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b) {return a/gcd(a,b)*b;}
bool ool(int x,int y,int h,int w) {return((x<0)||(h<=x)||(y<0)||(w<=y));}
bool deq(double a,double b) {return abs(a-b)<eps;}

struct oreno_initializer {
	oreno_initializer() {
		cin.tie(0);
		ios::sync_with_stdio(0);
	}
} oreno_initializer;



int n, a[100100], b[100100], d[100100], t, res;
vector<int> k;

signed main() {
	cin >> n;
	rep(i,n) cin >> a[i];
	rep(i,n) cin >> b[i];
	if (accumulate(a,a+n,0ll) < accumulate(b,b+n,0ll)) return cout << -1 << endl, 0;
	rep(i,n) d[i] = a[i] - b[i];
	sort(d,d+n), reverse(d,d+n);
	if (d[0]>0) k.push_back(d[0]);
	reps(i,1,n) {
		if (d[i]>0) d[i] += d[i-1], k.push_back(d[i]);
		else if (d[i]<0) t += -d[i], res++;
	}
	each(i,k) {
		if (t) res++;
		if (t<=i) break;
	}
	cout << res << endl;
}


Measured memory_bytes: 3196
#include<iostream>
#include<cmath>
#include<algorithm>
#include <cassert>
#include<string>
#include<vector>
#include <utility>
#include <math.h>
using namespace std;
int main(){
	int a = 0, b = 0, c = 0, d = 0, e[100010] = { 0 }, f = 0,g=0;
	cin >> a >> b>>c;
	for (int i = 0; i < a; i++) {
		cin >> e[i];
		if (e[i] <= b) {
			d ++;
		}
		else if (e[i] <= c) {
			f++;
		}
		else { g++; }
		
	}
	
	cout << min(d, min(f, g)) << endl;
	return 0;
}

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

#define Fast            ios_base::sync_with_stdio(false);cin.tie(nullptr);
#define fWrite          freopen ("out.txt","w",stdout);
#define TC              int t;cin >> t;FOR(tc,1,t)
#define LL              long long
#define ULL             unsigned long long
#define ff              first
#define ss              second
#define pb              push_back
#define pii             pair<int,int>
#define all(a)          a.begin(),a.end()
#define MEM(a,x)        memset(a,x,sizeof(a))
#define FOR(i,a,b)      for(int i=a;i<=b;i++)
#define ROF(i,a,b)      for(int i=a;i>=b;i--)
#define REP(i,b)        for(int i=0;i<b;i++)

#define Make(x,p)       (x | (1<<p))
#define DeMake(x,p)     (x & ~(1<<p))
#define Check(x,p)      (x & (1<<p))
#define popcount(x)     __builtin_popcount(x)

const LL MOD=1e9+7;
vector<int>V[100005];
LL dp[100005][2];

void dfs(int s,int pr){
    dp[s][0]=dp[s][1]=1;
    for(int u:V[s]){
        if(u==pr) continue;
        dfs(u,s);
        dp[s][0]=(dp[s][0]*(dp[u][0]+dp[u][1]))%MOD;
        dp[s][1]=(dp[s][1]*dp[u][0])%MOD;
    }
}

int main()
{
    int n;
    cin >> n;
    FOR(i,1,n-1){
        int u,v;
        cin >> u >> v;
        V[u].pb(v);
        V[v].pb(u);
    }
    dfs(1,0);
    cout << (dp[1][0]+dp[1][1])%MOD;
}


Measured memory_bytes: 14208
import math

a,b,x=map(int,input().split())

if x<=(a**2)*b/2:
  y=x/a*2/b
  print(' {:.10f}'.format(math.atan(b/y)/math.pi*180))
else:
  z=b*2-2*x/(a**2)
  print(' {:.10f}'.format(math.atan(z/a)/math.pi*180))



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

using namespace std;

typedef long long ll;
typedef long double ld;

const int INF = (int) 1e9 + 1e6 + 123;
const ll LINF = (ll) 1e18 + 1e9 + 123;
const ld EPS = (ld) 1e-7;
const ll MOD = (ll) 1e9 + 7;

#define sz(x) (int) (x).size()
#define mp(x, y) make_pair(x, y)
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define lb(s, t, x) (int) (lower_bound(s, t, x) - s)
#define ub(s, t, x) (int) (upper_bound(s, t, x) - s)
#define rep(i, f, t) for (int i = f; i < t; i++)
#define per(i, f, t) for (int i = f; i >= t; i--)

ll power(ll x, ll y, ll mod = MOD) {
    if (y == 0) {
        return 1;
    }
    if (y & 1) {
        return power(x, y - 1, mod) * x % mod;
    } else {
        ll tmp = power(x, y / 2, mod);
        return tmp * tmp % mod;
    }
}

template<typename A, typename B> bool mini(A &x, const B &y) {
    if (y < x) {
        x = y;
        return true;
    }
    return false;
}

template<typename A, typename B> bool maxi(A &x, const B &y) {
    if (y > x) {
        x = y;
        return true;
    }
    return false;
}

void add(ll &x, ll y) {
	x += y;
	if (x >= MOD) x -= MOD;
	if (x < 0) x += MOD;
}

ll mult(ll x, ll y) {
	return x * y % MOD;
}

void run();

#define TASK ""

int main() {
#ifdef LOCAL
    if (strlen(TASK) > 0) {
        cerr << "Reminder: you are using file i/o, filename: " TASK "!" << endl << endl;
    }
#endif
#ifndef LOCAL
    if (strlen(TASK)) {
        freopen(TASK ".in", "r", stdin);
        freopen(TASK ".out", "w", stdout);
    }
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
#endif
    cout << fixed << setprecision(12);
    run();
    return 0;
}

// == SOLUTION == //

const int N = (int) 1e5 + 123;

int n;
ll a[N];

ll f(ll x) {
	rep(i, 0, n) {
		x -= x % a[i];
	}
	return x;
}

void run() {
	cin >> n;
	rep(i, 0, n) {
		cin >> a[i];
	}
	
	ll mi = -1, ma = -1;
	
	{
		ll left = 0;
		ll right = LINF;
		while (right - left > 1) {
			ll mid = (left + right) / 2;
			if (f(mid) >= 2) {
				right = mid;
			} else {
				left = mid;
			}
		}
		mi = right;
	}
	
	if (f(mi) != 2) {
		cout << "-1\n";
		return;
	}
	
	{
		ll left = 0;
		ll right = LINF;
		while (right - left > 1) {
			ll mid = (left + right) / 2;
			if (f(mid) > 2) {
				right = mid;
			} else {
				left = mid;
			}
		}
		ma = left;
	}
	
	cout << mi << " " << ma << "\n";
}


Measured memory_bytes: 1024
//----------BHAVIK DIWANI(PICT_COMP)---------------
#include<bits/stdc++.h>
#include<stdlib.h>
#include<stdio.h>
#define mod 1000000007
#define ll long long
#define int long long
#define ull unsigned long long
#define test ll t; cin>>t; while(t--)
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define FOR(p,n) for(ll i=p;i<(ll)n;i++)
#define fastio ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
ll gcd(ll a,ll b){ if(b==0) return a;    return gcd(b,a%b);}
ll lcm(ll a,ll b) { return (a/gcd(a,b)*b);}
ull power(ull a, ull b) {a %= mod;  ull res = 1;  while (b > 0) { if (b & 1) res = res * a % mod;  a = a * a % mod;  b >>= 1; }  return res%mod; }
ll modmul(ll x, ll y){return (x*y)%mod;}
ll modadd(ll x, ll y){return (x+y)%mod;}
ll modsub(ll x, ll y){return (x-y+mod)%mod;}
ll fact[1000007]={0};
void facto() {fact[0]=1;fact[1]=1;for(int i=2;i<100007;i++)fact[i]=(fact[i-1]*i)%mod;}
ll ncr(ll n,ll r) {ll res=1; res=fact[n]; res=(res*(power(fact[r],mod-2)))%mod; res=(res*(power(fact[n-r],mod-2)))%mod; return res;}
ll npr(ll n,ll r) {ll res=1; res=fact[n]; res=(res*(power(fact[n-r],mod-2)))%mod; return res;}
#define MAX 1000005
#define forci(p,q) for(int i=p;i<q;i++)
bool prime[MAX];
/*ull sieve()
{
	memset(prime,true,sizeof(prime));
	for(ull p=2;p*p<MAX;p++)
	{
		if(prime[p]==true){
			for(ull i=2*p;i<MAX;i+=p)
			{
				prime[i]=false;
			}
		}
	}
	prime[0]=0;
	prime[1]=0;
}*/
using namespace std;
int a[200005]={0};
int sum[200008]={0};
signed main()
{
	fastio;
	int n,k;
	cin>>n>>k;
	sum[0]=0;
	int tot=0;
	for(int i=1;i<=n+1;i++)
	{
		a[i]=i-1;
		tot+=a[i];
		sum[i]=tot;
	}
	int max1,min1,ans=0;
	for(int i=k;i<=n+1;i++)
	{
		min1=sum[i];
		max1=sum[n+1]-sum[n+1-i];
//		cout<<min1<<" "<<max1<<endl;
		ans=(ans+max1-min1+1)%mod;			
	}
	cout<<ans<<endl;
}


Measured memory_bytes: 6632
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <queue>
#include <cstring>
#include <vector>
#include <map>
#include <algorithm>
#include <cctype>
#include <cmath>
#include <bitset>
#include <set>
#include <stack>
using namespace std;

#define REP(i,n) for(int i=0;i<(int)(n);i++)
#define RREP(i,n) for(int i=n-1;i>=0;i--)
#define FOR(i,k,n) for(int i=(k);i<(int)(n);i++)
#define all(i,n) (i),(i+n)

int dx4[4]={1,0,-1,0};
int dy4[4]={0,-1,0,1};
int dx8[8]={1,0,-1,1,-1,1,0,-1};
int dy8[8]={1,1,1,0,0,-1,-1,-1};
int dx9[9]={0,1,0,-1,1,-1,1,0,-1};
int dy9[9]={0,1,1,1,0,0,-1,-1,-1};

typedef pair<int, int> P;
typedef pair<string, int> SP;
typedef long long ll;
typedef pair<ll, ll> PLL;

const int INF = 1e9;
const ll LLINF = 1e18;
const int MAX_V = 1e6+1;
const ll mod = 1000000007;
// << fixed << setprecision
// --------------------------------------
int n;
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);

  cin >> n;

  int t = 0, c = 0;
  bool f = false;
  REP(i, n) {
    int a, b;
    cin >> a >> b;
    if(a == b) {
      t++;
    } else {
      t = 0;
    }
    if(t >= 3) f = true;
  }

  cout << (f ? "Yes" : "No") << endl;
}


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


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

struct edge {int to; ll cost; };

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

bool is_prime(ll n){
  if(n==1) return false;
  for(ll i=2; i*i<=n; i++){
    if(n%i==0) return false;
  }
  return true;
}
 
int main(){
  ll x;
  cin >> x;
  if(is_prime(x)){
    cout << 1 << endl;
    return 0;
  }
  ll tmp = x;
  vector<int> mod;
  mod.push_back(0);
  for(int i=1; i<100; i++){
    mod.push_back(mod[i-1]+i);
  }
  int ans = 0;
  for(ll i=2; i*i<=x; i++){
    if(tmp%i!=0) continue;
    int cnt=0;
    while(tmp%i==0){
      tmp /= i;
      cnt++;
    }
    for(int j=0; j<50; j++){
      if(mod[j]>cnt){
        cnt = j-1;
        break;
      }
    }
    ans += cnt;
  }
  if(tmp>1) ans++;
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 3632
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

typedef long long ll;

const ll INF = 1000000000000000000;

struct prze
{
    ll a, b, nr;
};

bool por(prze a, prze b)
{
    if (a.b < b.b)
        return true;
    if (a.b > b.b)
        return false;
    return (a.nr < b.nr);
}

int main()
{
    ios_base::sync_with_stdio(0);
    int n;
    cin >> n;
    vector<prze> a(n);
    for (int i = 0; i < n; ++i)
    {
        ll x, l;
        cin >> x >> l;
        a[i] = {x - l, x + l, i};
    }
    sort(a.begin(), a.end(), por);
    ll odp = 0, ostKon = -INF;
    for (int i = 0; i < n; ++i)
    {
        while (i < n && a[i].a < ostKon)
            ++i;
        if (i < n)
        {
            ostKon = a[i].b;
            ++odp;
        }
    }
    cout << odp;
    return 0;
}


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

int main(void){
    
    int x=0, n;
    int ans = x;
    cin >> x >> n;
    vector<int> p(n);
    for(int i = 0; i < n; i++){
        cin >> p.at(i);
    }
    for(int d = 0; d <= 100; d++){
        int minus = abs(x - d);
        int plus = abs(x + d);
        bool m_flag = false;
        bool p_flag = false;
        for(int i = 0; i < n; i++){
            if(p.at(i) == minus){
                m_flag = true;
            }
            if(p.at(i) == plus){
                p_flag = true;
            }
            if(m_flag && p_flag) break;
        }
        if(m_flag == false){
            ans = minus;
            break;
        }else if(p_flag == false){
            ans = plus;
            break;
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 3624
n = int(input())
s = input()

r = s.count("R")
g = s.count("G")
b = s.count("B")

count = r * g * b

for i in range(n-1):
    for j in range(i + 1, i + ((n - 1 - i) // 2) + 1):
        k = 2 * j - i
        if s[i] != s[j] and s[i] != s[k] and s[j] != s[k]:
            count -= 1

print(count)


Measured memory_bytes: 67872
#include <iostream>
#include <stdio.h>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <iomanip>
#include <queue>
#include <deque>
#include <map>
#include <unordered_map>
#define rep(i,n) for(int i=0;i<n;i++)
#define repn(i,n) for(int i=1;i<=n;i++)
#define repr(e,x) for(auto& e:x)
using namespace std;
typedef long long ll;
typedef pair<int,int> P;

ll const MOD=1'000'000'007;

int N;
string S1,S2;
vector<int> v[52];
map<char,int> m;

int main(){
    rep(i,26){
        m['a'+i]=i;
    }
    rep(i,26){
        m['A'+i]=i+26;
    }
    cin>>N>>S1>>S2;

    ll ans=1;
    ll prev=0;
    rep(i,N){
        if(S1[i]==S2[i]){
            ans*=3-prev;
            prev=1;
        }else{
            if(prev==0){
                ans*=6;
            }
            if(prev==1){
                ans*=2;
            }
            if(prev==2){
                ans*=3;
            }
            prev=2;
            i++;
        }
        ans%=MOD;
    }

    cout<<ans<<endl;
}

Measured memory_bytes: 256
#include <cstdio>

constexpr int MAX_N = 8;

int dfs(int n, int sum = 0);

int N, M;
bool v[MAX_N] = {};
bool e[MAX_N][MAX_N] = {};

int main(){
	scanf("%d%d", &N, &M);

	for(int i = 0; i < M; ++i){
		int a, b;
		scanf("%d%d", &a, &b);
		--a, --b;

		e[a][b] = true;
		e[b][a] = true;
	}

	printf("%d\n", dfs(0));
	return 0;
}

int dfs(int n, int sum){
	if(sum == N - 1){
		return 1;
	}

	int res = 0;
	v[n] = true;

	for(int i = 0; i < N; ++i){
		if(e[n][i] && !v[i]){
			res += dfs(i, sum + 1);
		}
	}

	v[n] = false;
	return res;
}


Measured memory_bytes: 128