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

using namespace std;

#define long long long
#define INF 2e18
#define MOD (long) (1e9 + 7)
#define umap unordered_map

long inv(long x)
{
    long k = MOD - 2;
    long pot = x;
    long y = 1;
    while (k > 0) {
        if (k & 1) y = (y * pot) % MOD;
        pot = (pot * pot) % MOD;
        k >>= 1;
    }
    return y;
}

long bin(long n, long k)
{
    if (k > n/2) k = n - k;
    long x = 1;
    for (long i = n-k+1; i <= n; i++) {
        x = (x * i) % MOD;
    }
    for (long i = 2; i <= k; i++) {
        x = (x * inv(i)) % MOD;
    }
    return x;
}

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

    long t = 1;
    //cin >> t;

    while (t--) {
        long n, k;
        cin >> n >> k;

        k = min(k, n-1);
        long ans = 1;
        long x = 1;
        long y = n-1;
        long aux = 1;
        long bin = 1;
        for (long i = 1; i <= k; i++) {
            bin = (((bin * (y+1)) % MOD) * inv(x)) % MOD;
            aux = (((aux * y) % MOD) * inv(x)) % MOD;
            ans = (ans + (aux * bin)) % MOD;
            x++;
            y--;
        }
        printf("%lld\n", ans);
    }
}


Measured memory_bytes: 3788
//可以解决负环问题，具体可以参考差分约束系统里面的同名文件
//可以用dd表示最短路更新次数，如果更新次数>=V时，则存在负环
//worst O(E*log(V))
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <cstdio>

using namespace std;

const int INF = 0x7fffffff;
const int MAXV=10000+5;

struct edge{ int to, dis, price; };
typedef pair<int, int> P; //first is min distance, second is vertex id

int V;
vector<edge> G[MAXV];
int d[MAXV];
vector<edge> G_in[MAXV];

void dijkstra(int s)
{
    //make priority queue sort smaller integer first
    priority_queue<P, vector<P>, greater<P> > que;
    fill(d, d+V+1, INF);
    d[s]=0;
    que.push(P(0,s));

    while(!que.empty())
    {
        P p = que.top(); que.pop();
        int v = p.second;
        if(d[v] < p.first) continue;
        for(int i=0;i<G[v].size();++i)
        {
            edge e = G[v][i];
            if(d[e.to]>d[v]+e.dis)
            {
                G_in[e.to].clear();
                d[e.to]=d[v]+e.dis;
                que.push(P(d[e.to], e.to));
                G_in[e.to].push_back({v, e.dis, e.price});
            }else if(d[e.to] == d[v]+ e.dis){
                que.push(P(d[e.to], e.to));
                G_in[e.to].push_back({v, e.dis, e.price});
            }
        }
    }
}

int main()
{
    int n,m;
    while(scanf("%d%d", &n, &m)!=EOF){
        if(n==0&&m==0) break;
        V=n;
        for(int i=0;i<=n;++i) {
            G[i].clear();
            G_in[i].clear();
        }
        int u,v,d,c;
        for(int i=0;i<m;++i){
            scanf("%d%d%d%d", &u, &v, &d, &c);
            G[u].push_back({v,d,c});
            G[v].push_back({u,d,c});
        }
        dijkstra(1);
        //cout<<"after dijkstra"<<endl;
        int all_cost=0;
        for(int i=2;i<=n;++i){
            int minp = INF;
            for(int j=0;j<G_in[i].size();++j){
                if(G_in[i][j].price<minp)
                    minp = G_in[i][j].price;
            }
            all_cost+=minp;
        }
        printf("%d\n", all_cost);
    }
    return 0;
}


Measured memory_bytes: 5712
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Dynamic;
using System.Linq;
using System.Numerics;
using System.Security.Cryptography;
using System.Security.Cryptography.X509Certificates;

namespace atcorder
{
    class Program
    {
        static void Main(string[] args)
        {
            int N = int.Parse(Console.ReadLine());
            string S = Console.ReadLine();
            string ans = "";
            char a;
            int len = S.Length;
            for(int i = 0; i < len; i++)
            {
                a = S[i];
                for(int j = 0; j < N; j++)
                {
                    if (a == 'Z')
                        a = 'A';

                    else
                        a = (char)(((int)a) + 1);
                }
                ans += a;
            }
            Console.WriteLine(ans);
        }
    }
}


//文字配列の取得
//string[] strArray = Console.ReadLine().Split(' ').ToArray();
//string S = strArray[0];
//string T = strArray[1];

//文字列の取得
//string s = Console.ReadLine();

//数字配列の取得
//int[] intArray = Console.ReadLine().Split(' ').Select(i => int.Parse(i)).ToArray();
//int H = intArray[0];
//int W = intArray[1];

//数字の取得
//int N = int.Parse(Console.ReadLine());

//リスト型(int)の取得
//List<int> A = new List<int>(Console.ReadLine().Split(' ').Select(i => int.Parse(i)).ToArray());

//出力
//Console.WriteLine(ans);
//Console.WriteLine("Yes");
//Console.WriteLine("No");
//Console.WriteLine(cnt);



Measured memory_bytes: 46204
# http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ALDS1_2_B&lang=jp
sample_input = list(range(3))
sample_input[0] = '''6
5 6 4 2 1 3'''
sample_input[1] = '''6
5 2 4 6 1 3'''
sample_input[2] = ''''''
give_sample_input = None
if give_sample_input is not None:
    sample_input_list = sample_input[give_sample_input].split('\n')
    def input():
        return sample_input_list.pop(0)
        
# main
def swap_list_item(lst, i, j):
    tmp = lst[i]
    lst[i] = lst[j]
    lst[j] = tmp

num_of_data = int(input())
data_list = list(map(int, input().split()))
swap_count = 0
for i in range(num_of_data):
    minj = i
    for j in range(i, num_of_data):
        if data_list[minj] > data_list[j]:
            minj = j
    if not minj == i:
        swap_list_item(data_list, i, minj)
        swap_count += 1

result = ''
for number in data_list:
    result += str(number) + ' '
print(result.strip())
print(swap_count)

Measured memory_bytes: 7760
package main;

import "fmt"

func main() {
	var K, S int
	fmt.Scan(&K, &S)
	count := 0
	for i := 0; i <= K; i++ {
		for j := 0; j <= S - i; j++ {
			if j > K {
				break
			}
			if S - i - j <= K {
				count++
			}
		}
	}
	fmt.Println(count)

}

func min(a int, b int) int {
	if a < b {
		return a
	}
	return b
}




Measured memory_bytes: 512
#include<iostream>
using namespace std;
int main() {
    string s; cin >> s;
    if (s[0] == s[1] && s[1] == s[2]) {
        cout << "Yes" << endl;
    } else if (s[1] == s[2] && s[2] == s[3]) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
    return 0;
}



Measured memory_bytes: 256
import itertools
k,s=map(int,input().split())

arr=[]
cnt=0

for x in range(k+1):
  for y in range(x,k+1):
    z=s-x-y
    if y<=z<=k:
      if x==y==z:
        cnt+=1
      elif x==y or y==z or z==x:
        cnt+=3
      else:
        cnt+=6
print(cnt)

Measured memory_bytes: 3064
#include <stdio.h>

int main()
{
  int n[10000];
  int q[500];
  int i=0,k,a,b,count=0;
  
  //入力
  scanf("%d",&a);
  for(k=0;k<a;k++)
    {
      scanf("%d",&n[k]);
    }
  scanf("%d",&i);
  for(k=0;k<i;k++)
    {
      scanf("%d",&q[k]);
    }

  //数値の探索
  for(k=0;k<i;k++)
    {
      for(b=0;b<a;b++)
	{
	  if(q[k]==n[b])
	    {
	      count++;
	      break;
	    }
	}
    }
  printf("%d\n",count);
  return 0;
}



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

#define INF 1 << 29
#define REP(i,n) for(int i=0; i<(int)(n); i++)
#define FOR(i,k,n) for(int i=(k);i<(int)(n);i++)

using namespace std;

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

void gen_sosuu(int sosuu[]){
  REP(i,100010){
    sosuu[i] = true;
  }
  sosuu[0] = false;
  sosuu[1] = false;
  sosuu[2] = true;
  FOR(i,2,sqrt(100000)+1){
    if(sosuu[i] == false) continue;
    for(int j = 2; i*j<=100000;j++){
      //printf("%d %d %d\n",i*j,i,j);
      sosuu[i*j] =false;
    }
  }
}

char s[3][4];

int main(){
  REP(i,3){
    scanf("%s",s[i]);
  }
  REP(i,3){
    printf("%c",s[i][i]);
  }
  printf("\n");
}


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

//template
#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 ALL(v) (v).begin(),(v).end()
typedef long long int ll; const int inf = 0x3fffffff; const ll INF = 0x3fffffffffffffff;
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; }
//template end

int mod=1e9+7;
struct Mint {
    int val;
    Mint inv() const{
        int tmp,a=val,b=mod,x=1,y=0;
        while(b)tmp=a/b,a-=tmp*b,swap(a,b),x-=tmp*y,swap(x,y);
        return Mint(x);
    }
public:
    Mint():val(0){}
    Mint(ll x):val(x>=0?x%mod:x%mod+mod){}
    Mint pow(ll t){Mint res=1,b=*this; while(t){if(t&1)res*=b;b*=b;t>>=1;}return res;}
    Mint& operator+=(const Mint& x){if((val+=x.val)>=mod)val-=mod;return *this;}
    Mint& operator-=(const Mint& x){if((val+=mod-x.val)>=mod)val-=mod; return *this;}
    Mint& operator*=(const Mint& x){val=(ll)val*x.val%mod; return *this;}
    Mint& operator/=(const Mint& x){return *this*=x.inv();}
    bool operator==(const Mint& x) const{return val==x.val;}
    bool operator!=(const Mint& x) const{return val!=x.val;}
    bool operator<(const Mint& x) const{return val<x.val;}
    bool operator<=(const Mint& x) const{return val<=x.val;}
    bool operator>(const Mint& x) const{return val>x.val;}
    bool operator>=(const Mint& x) const{return val>=x.val;}
    Mint operator+(const Mint& x) const{return Mint(*this)+=x;}
    Mint operator-(const Mint& x) const{return Mint(*this)-=x;}
    Mint operator*(const Mint& x) const{return Mint(*this)*=x;}
    Mint operator/(const Mint& x) const{return Mint(*this)/=x;}
};
struct factorial {
    vector<Mint> Fact, Finv;
public:
    factorial(int maxx){
        Fact.resize(maxx+1),Finv.resize(maxx+1); Fact[0]=Mint(1); rep(i,0,maxx)Fact[i+1]=Fact[i]*(i+1);
        Finv[maxx]=Mint(1)/Fact[maxx]; rrep(i,maxx,0)Finv[i-1]=Finv[i]*i;
    }
    Mint fact(int n,bool inv=0){if(inv)return Finv[n];else return Fact[n];}
    Mint nPr(int n,int r){if(n<0||n<r||r<0)return Mint(0);else return Fact[n]*Finv[n-r];}
    Mint nCr(int n,int r){if(n<0||n<r||r<0)return Mint(0);else return Fact[n]*Finv[r]*Finv[n-r];}
};

int main(){
    string s; cin>>s;
    int n=s.size();
    Mint dp[100010][4]; dp[0][0]=1;
    rep(i,0,n){
        rep(j,0,4){
            if(s[i]=='?')dp[i+1][j]+=dp[i][j]*3;
            else dp[i+1][j]+=dp[i][j];
        }
        if(s[i]=='A'||s[i]=='?')dp[i+1][1]+=dp[i][0];
        if(s[i]=='B'||s[i]=='?')dp[i+1][2]+=dp[i][1];
        if(s[i]=='C'||s[i]=='?')dp[i+1][3]+=dp[i][2];
    }
    printf("%d\n",dp[n][3].val);
    return 0;
}

Measured memory_bytes: 2048
#include <bits/stdc++.h>
using namespace std;
struct edge {
    int to;     // 辺の行き先
    int weight; // 辺の重み
    edge(int t, int w) : to(t), weight(w) { }
};
using Graph = vector<vector<int>>;
using dou =long double;
string Yes="Yes";
string YES="YES";
string NO="NO";
string No="No";
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
#define rep(i, n)         for(int i = 0; i < (int)(n); i++)
#define brep(n)           for(int bit=0;bit<(1<<n);bit++)
#define erep(i,container) for (auto i : container)
#define irep(i, n)        for(int i = n-1; i >= (int)0; i--)
#define rrep(i,m,n) for(int i = m; i < (int)(n); i++)
#define reprep(i,j,h,w) rep(i,h)rep(j,w)
#define all(x) (x).begin(),(x).end()
#define aall(x,n) (x).begin(),(x).begin()+(n)
#define VEC(type,name,n) std::vector<type> name(n);rep(i,n)std::cin >> name[i];
#define pb push_back
#define pf push_front
#define lb lower_bound
#define ub upper_bound
#define res resize
#define as assign
#define fi first
#define se second
#define itn int
#define mp make_pair
#define sum(a) accumulate(all(a),0ll)
#define keta fixed<<setprecision
#define vvector(name,typ,m,n,a)vector<vector<typ> > name(m,vector<typ> (n,a))
#define vvvector(name,t,l,m,n,a) vector<vector<vector<t> > > name(l, vector<vector<t> >(m, vector<t>(n,a)));
#define vvvvector(name,t,k,l,m,n,a) vector<vector<vector<vector<t> > > > name(k,vector<vector<vector<t> > >(l, vector<vector<t> >(m, vector<t>(n,a)) ));
 
typedef long long ll;
const int INF = 2000000000;
const ll INF64 = 922337203685477580ll;
const int mod = 1000000007ll;
const ll  MOD = 1000000007LL;
int main(){
    int x;
    std::cin >> x;
    itn d=x%500,ans=x/500*1000;
    ans+=d/5*5;
    std::cout << ans << std::endl;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

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

		sc.close();

		p = a * 3 + p;

		System.out.print(p / 2);

	}

}


Measured memory_bytes: 21844
#include <iostream>
//#include <iomanip>
#include <string>
#include <vector>
//#include <algorithm>
//#include <utility>
//#include <set>
//#include <map>
//#include <queue>
//#include <deque>
//#include <bitset>
//#include <math.h>
using namespace std ;
//using ll = long long ;
//using ld = long double ;
//using vll = vector<ll> ;
//using vvll = vector<vll> ;
//using vc = vector<char> ;
//using vvc = vector<vc> ;
//using vb = vector<bool> ;
//using vvb = vector<vb> ;
//using pll = pair<ll,ll> ;

//ll mod = 1000000007 ;
//long double pie = acos(-1) ;

//void yorn(bool a){if(a) cout << "Yes" << endl ; else cout << "No" << endl ;}
//void YorN(bool a){if(a) cout << "YES" << endl ; else cout << "NO" << endl ;}
//ll gcd(long long a,long long b){if(b==0) return a ; return gcd(b,a%b) ;}
//ll lcm(long long a,long long b){return a/gcd(a,b)*b ;}
//ll sa(long long a,long long b){if(a>b) return a-b ; return b-a ;}
//void mysort(vector<long long> &a){sort(a.begin(),a.end()) ;}
//void myrev(vector<long long> &a){reverse(a.begin(),a.end()) ;}

int main(){
	string s ; cin >> s ;
	int n = s.size() ;
	int r = 0 ;
	int l = 0 ;
	vector<int> ans(n) ;
	for(int i=0;i<n;i++){
		if(s.at(i)=='R') r++ ;
		else{
			if(r==0) continue ;
			ans.at(i) += r/2 ;
			ans.at(i-1) += r-r/2 ;
			r = 0 ;
		}
	}
	for(int i=n-1;i>=0;i--){
		if(s.at(i)=='L') l++ ;
		else{
			if(l==0) continue ;
			ans.at(i) += l/2 ;
			ans.at(i+1) += l-l/2 ;
			l = 0 ;
		}
	}
	for(int i=0;i<n;i++){
		cout << ans.at(i) ;
		if(i==n-1) cout << endl ;
		else cout << " " ;
	}
}


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

int main(void){
  string str;
  while(cin >> str){
    string ans;
    for(int p=0; p < str.length(); p++){
     if(str[p] != '@'){
        ans.append(1, str[p]);
     }else{
        p++;
        int len = str[p] - '0';
        p++;
        ans.append(len, str[p]);
     }
    }
    cout << ans << endl;
  }

  return 0;
}

Measured memory_bytes: 1188
#include <iostream> // cin, cout, cerr
#include <algorithm> // minmax, sort, swap
#include <numeric> // iota
#include <cstdio> // printf, scanf
#include <string> // string, stoi, to_string
#include <vector> // vector
#include <queue> // queue, priority_queue
#include <deque> // deque
#include <map> // key-value pairs sorted by keys
#include <set> // set
#include <iomanip> // cout<<setprecision(n)
#include <functional> // function<void(int)>
#include <cmath>
#include <cassert>
#include <bitset>
#include <stack>

#ifdef DEBUG
#include "debug.hpp"
#else
#define debug(...)
#endif

#define int long long // at least int64 > 9*10^18
#define EL '\n'
#define rep(i,n) for(int i = 0; i < (n); i++)
#define print(i) std::cout << (i) << '\n'
#define all(v) (v).begin(), (v).end()
using Graph = std::vector<std::vector<int> >;
const int INF = 1e17;
/* libraries */

int f(int a,int x, int b) {
	return (a*x/b)-a*(x/b);
}

signed main() {
	int a,b,n;
	std::cin >> a >> b >> n;
	if(b-1<=n) print(f(a,b-1,b));
	else print(f(a,n,b));

	return 0;
}


Measured memory_bytes: 3632
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i<(n); i++)
#define int long long
#define double long double
#define mod 1000000007
#define F first
#define S second
#define P pair<long long,long long>
#define all(a) a.begin(),a.end()
#define INF 1000000000000000000
#define endl '\n'
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; }
using namespace std;

int lucas[100];
signed main(void){
    lucas[0]=2; lucas[1]=1;
    int n; cin>>n;
    for(int i=2; i<=n; i++)lucas[i]=lucas[i-1]+lucas[i-2];
    cout<<lucas[n]<<endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <cstring>

using namespace std;

const int Z = 1e9+7;

int main() {
    string s;
    cin >> s;

    int n = s.length();
    int dp[n+1][13];
    memset(dp, 0, sizeof(dp));
    dp[n][0] = 1;

    int p = 1;
    for (int i = n - 1; i >= 0; i--) {
        if (s[i] == '?') {
            for (int j = 0; j < 13; j++) {
                for (int k = 0; k < 10; k++) {
                    dp[i][(j+k*p)%13] = (dp[i][(j+k*p)%13] + dp[i+1][j]) % Z;
                }
            }
        } else {
            for (int j = 0; j < 13; j++) {
                dp[i][(j+(s[i]-'0')*p)%13] = (dp[i][(j+(s[i]-'0')*p)%13] + dp[i+1][j]) % Z;
            }
        }
        p = p * 10 % 13;
    }

    cout << dp[0][5] << endl;

    return 0;
}


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

#include <type_traits>
using namespace std;
#define rep(i, n)                    \
  for (int i = 0; i < (int)(n); i++) \
    ;

#define _GLIBCXX_DEBUG
#define _LIBCPP_DEBUG 0

int main() {
  int n;
  cin >> n;
  vector<int> a(n);
  for (int &x : a) {
    cin >> x;
  }

  int max = a.at(0);
  int min = a.at(0);

  for (int x : a) {
    if (x > max) {
      max = x;
    }
    if (x < min) {
      min = x;
    }
  }

  cout << max - min << endl;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
#define MAXN 100000
#define MOD 1000000007
#define ll long long
#define F0R(a,b) for(int a=0; a<b; a++)
#define FOR(a,b,c) for(int a=b; a<c; a++)
#define uosi unordered_set<int>
#define pb push_back

bool vis[MAXN], work[MAXN];
int pre[MAXN];
vector<int> prime;
bool isPrime(int n)
{
	for(int p: prime) if(n%p==0 && n!=p) return 0;
	return 1;
}
int main()
{
	int q; cin >> q;
	memset(vis,0,MAXN); memset(work,0,MAXN); memset(pre,0,MAXN);
	FOR(i,2,400)
	{
		bool flag=0;
		for(int p:prime)
		{
			if(i%p==0) flag=1;
		}
		if(!flag) prime.pb(i);
	}
	F0R(i,MAXN)
	{
		if(i==1) continue;
		if(vis[i]) continue;
		vis[i]=1;
		if(i%6!=1 && i>6) continue;
//		cout<<i<<endl;
		int tmp = i;
		if(isPrime(i))
		{
			i = 2*i-1;
			while(i<MAXN && isPrime(i))
			{
//				cout<<"YAY "<<i<<" "<<isPrime(i)<<endl;
				vis[i]=work[i]=1;
				i = 2*i-1;
			}
//			vis[i]=1;
//			cout<<"NO WORK "<<i<<endl;
		}
		i=tmp;
	}

	pre[0]=0;
	F0R(i,MAXN) pre[i] = pre[i-1] + work[i];
//	F0R(i,20) cout<<prime[i]<<" ";
//	cout<<endl;
//	F0R(i,20) cout<<pre[i]<<"("<<i<<") ";
//	cout<<endl;
	F0R(i,q)
	{
		int L, R; cin >> L >> R;
		cout<<pre[R]-pre[L-1]<<endl;
	}
	return 0;
}



Measured memory_bytes: 1280
#include <bits/stdc++.h>
#define PREP(i, s, x) for(ll i = (s); i < (x); i++)
#define MREP(i, s, x) for(ll i = (s); i >= (x); i--)
#define REP(i, x) PREP(i, 0, x)
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
template<typename T> inline bool chmax(T &a, T b) { return ((a < b) ? (a = b, true) : (false)); }
template<typename T> inline bool chmin(T &a, T b) { return ((a > b) ? (a = b, true) : (false)); }

// variable -------------------------------------------

constexpr ll INF = (1ll << 59);
constexpr ll MOD = 1000000007ll;

// structure ------------------------------------------

// function -------------------------------------------

// 最大公約数を計算 GCD
// 最小公倍数を計算 LCM
ll llgcd(ll a, ll b){
    if(b == 0){
        return a;
    }
    return llgcd(b, a % b);
}
ll lllcm(ll a, ll b){
    if(a == 0 || b == 0){
        return 1;
    }
    return a / llgcd(a, b) * b;
}

// 素因数分解
// prime_factorization(56) = {(2, 3), (7, 1)}
vector<pair<ll, ll>> prime_factorization(ll n){
    vector<pair<ll, ll>> res;
    if(n < 2){
        res.push_back(make_pair(n, 1));
        return res;
    }
    for(ll i = 2; i * i <= n; i ++){
        if(n % i == 0){
            pair<ll, ll> pr;
            pr.first = i;
            pr.second = 1;
            while(n % i == 0){
                n /= i;
                pr.second ++;
            }
            res.push_back(pr);
        }
    }
    if(n != 1){
        res.push_back(make_pair(n, 1));
    }
    return res;
}

// main -----------------------------------------------

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

	bool tagainiso = false;
	ll nowval = a[0];
	PREP(i, 1, n){
		nowval = llgcd(nowval, a[i]);
	}
	if(nowval == 1){
		tagainiso = true;
	}

	bool tuigotoniso = true;

	set<ll> st;
	REP(i, n){
		vector<pair<ll, ll>> soinsu = prime_factorization(a[i]);
		ll len = soinsu.size();
		REP(i, len){
			if(soinsu[i].first == 1) continue;
			if(st.count(soinsu[i].first) == 1){
				tuigotoniso = false;
				goto END;
			}
			st.insert(soinsu[i].first);
		}
	}
	tuigotoniso = true;
	END:


	if(tuigotoniso == true){
		cout << "pairwise coprime" << endl;
	}else if(tagainiso == true){
		cout << "setwise coprime" << endl;
	}else{
		cout << "not coprime" << endl;
	}
	return 0;
}

Measured memory_bytes: 11176
import java.util.*;
import java.util.stream.Collectors;

public class Main {

  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    int min = Integer.MAX_VALUE;
    int max = Integer.MIN_VALUE;
    int total = 0;
    int ans = Integer.MAX_VALUE;
    ;
    ArrayList<Integer> list = new ArrayList<Integer>();
    for (int i = 0; i < N; i++) {
      list.add(sc.nextInt());
      min = Math.min(min, list.get(i));
      max = Math.max(max, list.get(i));
    }
    for (int i = min; i <= max; i++) {
      total = 0;
      for (int j = 0; j < N; j++) {
        total += Math.pow(i - list.get(j), 2);
      }
      ans = Math.min(ans, total);
    }
    System.out.println(ans);
  }
}


Measured memory_bytes: 23636
def tap_dance(st):
  size = len(st)
  for i in range(size):
    if (i+1) % 2 == 0:
      if st[i] not in "LUD":
        return "No"
    else:
      if st[i] not in "RUD":
        return "No"
  return "Yes"
st = input()
print(tap_dance(st))

Measured memory_bytes: 2940
#include <iostream>

using namespace std;

#define rep(i, a, n) for(int i = a; i < (n); ++i)

int main(){
  int k, s;
  scanf("%d%d", &k, &s);

  int ans = 0;
  rep(x, 0, k+1) {
    rep(y, 0, k+1) {
      int z = s - x - y;
      if (x + y + z == s && z >= 0 && z <= k) {
        ++ans;
      }
    }
  }
  printf("%d\n", ans);
}

Measured memory_bytes: 256
open Printf
open Scanf

module P = struct
  type path = Len of int | Inf | Unk

  let min l1 l2 =
    match l1, l2 with
      Len x, Len y when x < y -> Len x
    | Len x, Len y -> Len y
    | Len x, _ -> Len x
    | _, Len y -> Len y
    | _, _ -> Inf
                
  let add l1 l2 =
    match l1, l2 with
      Len x, Len y -> Len (x + y)
    | _, _ -> Inf
                
  let get = function
      Len x -> x
    | Inf -> (-1)
    | _ -> failwith "get"
end
             
let () =
  let nv, ne = scanf "%d %d " (fun x y -> (x, y)) in
  let g = Array.make_matrix nv nv P.Inf in
  let memo = Array.make_matrix (1 lsl nv) nv P.Unk in
  let set_g n =
    let rec loop x =
      if x = 0 then ()
      else let s, t, d = scanf "%d %d %d " (fun x y z -> (x, y, z)) in
           g.(s).(t) <- P.Len d;
           loop (x-1) in
    loop n in
  let rec search s v =
    match memo.(s).(v) with
      P.Unk -> 
      let rec loop u l =
        if u = nv then l
        else
          if s lsr u land 1 = 0 then loop (u+1) (P.min l (P.add g.(v).(u) (search (s lor (1 lsl u)) u)))
          else loop (u+1) l
      in
      let ml = loop 0 P.Inf in
      memo.(s).(v) <- ml; ml
    | x -> x in
  set_g ne;
  memo.((1 lsl nv) - 1 ).(0) <- P.Len 0;
  printf "%d\n" (P.get (search 0 0))

Measured memory_bytes: 11076
#include <iostream>
#include <string>
#include <sstream>
#include <iomanip>
#include <vector>
#include <map>
#include <set>
#include <algorithm>
#include <numeric>
#include <queue>

using namespace std;


void ABC138A()
{
	int a;
	string s;
	cin >> a >> s;
	if (a >= 3200)
	{
		cout << s << endl;
	}
	else
	{
		cout << "red" << endl;
	}
}

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

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

using namespace std;

int cntOfList;
int cnt = 0;
double temp;
double temp1;
int finalAns;

int main()
{
	scanf("%d", &cntOfList);
	int numsToBeOperated[cntOfList];

	for(int i = 0; i < cntOfList; i++)
	{
		scanf("%d", &numsToBeOperated[i]);
		if(numsToBeOperated[i] % 2 == 0)
		{
			cnt++;
		}
	}
	temp = pow(3, cntOfList);
	temp1 = pow(2, cnt);
	finalAns = temp - temp1;

	printf("%d\n", finalAns);

	
	return 0;
}
/*
	Powered by Buggy Plugin
*/


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

int main(){
  string S,T,ans;
  int i,N;
  //ans="\0";
  cin>>N;
  cin>>S>>T;
  //cout<<S[1];
  for(i=0;i<N;i++){
    ans+=S[i];
    ans+=T[i];
  }
  cout<<ans;
}

    


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int INF=0x7fffffff,MAXN=1<<17;
int main()
{
    int n,m;
    cin>>n>>m;
    for(int i=1;i<=n;i++)
    {
        char ch;
        cin>>ch;
        if(i==m)
            printf("%c",ch-'A'+'a');
        else
            cout<<ch;
    }
    return 0;
}


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

int main() {
	int a, b, c, d, e, sum, avg;
	cin >> a >> b >> c >> d >> e;
	if(a<=40) a=40;
	if(b<=40) b=40;
	if(c<=40) c=40;
	if(d<=40) d=40;
	if(e<=40) e=40;
	sum = a+b+c+d+e;
	avg = sum/5;
	cout << avg << endl;
	return 0;
}


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

using namespace std;
using ll = long long;

long double pi = acos(-1);

int main()
{
    int n, m;
    cin >> n >> m;
    int sum = 0;
    for(int i = 0; i < m; i++) {
        int cur ; cin >> cur; sum += cur;
    }
    cout << (n - sum < 0 ? - 1 : n - sum) << endl;
}

Measured memory_bytes: 3632
#include <iostream>
#include <fstream>
#include <string>
#include <vector>
#include <queue>
#include <cmath>
#include <algorithm>
#include <random>
#include <chrono>
#include <iomanip>
#define lint long long int
#define FOR(x, to) for(int x=0; x<(int)(to); x++)
#define DUMP(ar) for(int loop_dump=0; loop_dump<(int)ar.size(); loop_dump++) cout << "[" << loop_dump << "]:" << ar[loop_dump] << endl
#define DUMPL(ar) for(int loop_dump=0; loop_dump<(int)ar.size(); loop_dump++) { cout << ar[loop_dump]; if(loop_dump<(int)ar.size()-1) cout << ' '; } cout << endl;
#define COUT(x) cout << x << endl
#define ALL(ar) ar.begin(), ar.end()
#define LOOPD(i) cout << "ループ[" << i << "]回目---------------" << endl
using namespace std;

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

    int a, b;
    cin >> a >> b;

    if(a == 1){
        if(b == 2){
            COUT("3");
        }else{
            COUT("2");
        }
    }else if(a == 2){
        if(b == 1){
            COUT("3");
        }else{
            COUT("1");
        }
    }else{
        if(b == 1){
            COUT("2");
        }else{
            COUT("1");
        }
    }

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <vector>
#include <map>
using namespace std;
typedef long long LL;
const int MAXN = 1e6 + 10;
inline LL in()
{
    LL x = 0, flag = 1; char ch = getchar();
    while (ch < '0' || ch > '9') {if (ch == '-') flag = -1; ch = getchar();}
    while (ch >= '0' && ch <= '9') x = (x << 3) + (x << 1) + ch - '0', ch = getchar();
    return x * flag;
}
int n, m, ans, kind;
LL xsum, ori[MAXN], tar[MAXN], tot[MAXN];
int a[MAXN], b[MAXN], size[MAXN];
bool vis[MAXN];
int fa[MAXN];
int find(int x)
{
    if (fa[x] != x) fa[x] = find(fa[x]);
    return fa[x];
}
void unite(int x, int y)
{
    int fx = find(x), fy = find(y);
    if (fx == fy) return;
    fa[fy] = fx;
    size[fx] += size[fy];
}
bool judge()
{
    map <LL, int> cnt;
    for (int i = 1; i <= n+1; i ++)
        cnt[ori[i]] ++;
    for (int i = 1; i <= n; i ++)
    {
        if (cnt[tar[i]] > 0)
            cnt[tar[i]] --;
        else
            return false;
    }
    return true;
}
void init()
{
    map <LL, int> id;
    sort(tot + 1, tot + n + 2);
    id[tot[1]] = kind = 1;
    for (int i = 2; i <= n + 1; i ++)
    {
        if (tot[i] != tot[i-1]) kind ++;
        id[tot[i]] = kind;
    }
    for (int i = 1; i <= n+1; i ++)
    {
        a[i] = id[ori[i]];
        b[i] = id[tar[i]];
    }
}
int main()
{
    n = in();
    for (int i = 1; i <= n; i ++)
    {
        tot[i] = ori[i] = in();
        ori[n + 1] ^= ori[i];
    }
    tot[n + 1] = ori[n + 1];
    for (int i = 1; i <= n; i ++)
    {
        tar[i] = in();
        tar[n + 1] ^= tar[i];  
    }
    if (judge() == false)
    {
        printf("-1");
        return 0;
    }
    init();
    for (int i = 1; i <= kind; i ++) fa[i] = i;
    for (int i = 1; i <= n + 1; i ++)
    {
        if (a[i] != b[i])
        {
            ans ++;
            size[a[i]] ++;
        }
    }
    for (int i = 1; i <= n + 1; i ++)
    {
        if (find(a[i]) == find(b[i])) continue;
        unite(a[i], b[i]);
    }
    for (int i = 1; i <= n + 1; i ++)
    {
        if (fa[a[i]] == a[i] && a[i] != b[i] && !vis[a[i]])
        {
            vis[a[i]] = true;
            ans ++;
        }
    }
    if (a[n+1] != b[n+1]) ans --;
    if (size[fa[a[n+1]]] > 1) ans --;
    cout << ans << endl;
    return 0;
}


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

int main() {
	int a,b,c;
	cin>>a>>b>>c;
	if((a+b==c)||(b+c==a)||(c+a==b))
	{
	    cout<<"Yes"<<endl;
	
	}
	else
	cout<<"No"<<endl;// your code goes here
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include<cmath>
#include<cstring>
#include<cstdio>
#include<cstdlib>
#include<vector>
#include<iomanip>
#define sqr(x) (x)*(x)
using namespace std;
long long mod=1e9+7,n,m,i,j,x,y,z,dp[45][1<<(5+7+5+1)],sum;
long long qp(long long x,long long y)
{
	if (y==0) return 1;
	if (y==1) return x;
	long long z=qp(x,y/2);z=z*z%mod;
	if (y&1) z=z*x%mod;
	return z;
}
bool check(long long msk)
{
	/*if (msk==135200)
	{
		int x=1;
		x++;
		x--;
	}*/
	return (msk&(1<<z))&&(msk&(1<<(y+z)))&&(msk&(1<<(x+y+z)));
}
long long dfs(long long x,long long msk)
{
	if (check(msk)) return 0;
	if (!x) return 1;
	if (dp[x][msk]!=-1) return dp[x][msk];
	dp[x][msk]=0;
	int i;
	for (i=1;i<=10;i++)
	{
		dp[x][msk]+=dfs(x-1,((1<<(sum))-1)&((msk<<i)|(1<<i)));
		dp[x][msk]%=mod;
	}
	return dp[x][msk];
}
int main()
{
	cin>>n>>x>>y>>z;
	memset(dp,-1,sizeof(dp));
	sum=x+y+z+1;
	cout<<((qp(10,n)-dfs(n,0))%mod+mod)%mod;
	return 0;
}

Measured memory_bytes: 92416
#include <iostream>
#include <stdio.h>
#include <math.h>
#include <string.h>
#include <time.h>
#include <stdlib.h>
#include <string>
#include <bitset>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <algorithm>
#include <sstream>
#include <stack>
#include <iomanip>
#include <assert.h>
using namespace std;
#define pb push_back
#define mp make_pair
typedef pair<int,int> pii;
typedef long long ll;
typedef double ld;
typedef vector<int> vi;
#define fi first
#define se second
#define fe first
#define FO(x) {freopen(#x".in","r",stdin);freopen(#x".out","w",stdout);}
#define Edg int M=0,fst[SZ],vb[SZ],nxt[SZ];void ad_de(int a,int b){++M;nxt[M]=fst[a];fst[a]=M;vb[M]=b;}void adde(int a,int b){ad_de(a,b);ad_de(b,a);}
#define Edgc int M=0,fst[SZ],vb[SZ],nxt[SZ],vc[SZ];void ad_de(int a,int b,int c){++M;nxt[M]=fst[a];fst[a]=M;vb[M]=b;vc[M]=c;}void adde(int a,int b,int c){ad_de(a,b,c);ad_de(b,a,c);}
#define es(x,e) (int e=fst[x];e;e=nxt[e])
#define esb(x,e,b) (int e=fst[x],b=vb[e];e;e=nxt[e],b=vb[e])
#define SZ 5555555
const int MOD=998244353;
ll qp(ll a,ll b)
{
	ll x=1; a%=MOD;
	while(b)
	{
		if(b&1) x=x*a%MOD;
		a=a*a%MOD; b>>=1;
	}
	return x;
}
int n,a[SZ];
const int r2=(MOD+1)/2;
void fwt(int*t)
{
	for(int i=0;i<n;++i)
		for(int j=0;j<(1<<n);++j) if(j&(1<<i))
		{
			int p=(t[j^(1<<i)]+t[j])%MOD,
			q=(t[j^(1<<i)]-t[j])%MOD;
			t[j^(1<<i)]=p;
			t[j]=q;
		}
}
int w0[SZ];
ll f0[SZ],f1[SZ];
int main()
{
	scanf("%d",&n); int ss=0;
	for(int i=0;i<(1<<n);++i)
		scanf("%d",a+i),ss+=a[i];
	ss=qp(ss,MOD-2);
	for(int i=0;i<(1<<n);++i)
		a[i]=a[i]*(ll)ss%MOD;
	for(int i=0;i<(1<<n);++i)
		w0[i]=-a[i];
	fwt(w0);
	for(int i=0;i<(1<<n);++i)
		if(i==0) w0[i]=0;
		else w0[i]=qp(1+w0[i],MOD-2);
	fwt(w0);
	for(int i=0;i<(1<<n);++i)
	{
		ll t=w0[0]-w0[i];
		t=(t%MOD+MOD)%MOD;
		printf("%d\n",int(t));
	}
}


Measured memory_bytes: 8960
<?php

  $s = trim(fgets(STDIN));
  
  $s = str_split($s);
  

  $count = 0;
  for($i = 0; $i < 3; $i++) {
      if($s[$i] == '1') {
          $count = $count + 1;
      }
  }
  
  echo $count . "\n";

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

int main() {

	long long n, k; cin >> n >> k;

	vector<long long> x(n);	for (long long i = 0; i < n; i++) cin >> x[i];
	
	long long ans = 9223372036854775807LL;
	for (long long i = 0; i < n - k + 1; i++) {

		long long tmp;
		long long x_Left = x[i];
		long long x_Right = x[i + k - 1];

		tmp = min(abs(x_Left) + abs(x_Right - x_Left), abs(x_Right) + abs(x_Right - x_Left));
		ans = min(ans, tmp);

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

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

using namespace std;
#define DBG(x)                         \
    (void)(cout << "L" << __LINE__     \
                << ": " << #x << " = " \
                << (x) << '\n')

typedef long long ll;
using pii = pair<int, int>;
using pli = pair<ll, int>;
using pll = pair<ll, ll>;
const int INF = 0x3f3f3f3f;
const int maxn = 110000;
int main()
{
    //检查有没有特判0,有没有越界限.
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << setiosflags(ios::fixed) << setprecision(12);
    int n;
    cin >> n;
    string s, t;
    cin >> s >> t;
    for (int i = 0; i < n; i++)
    {
        cout << s[i] << t[i];
    }
    cout << "\n";
    return 0;
}

Measured memory_bytes: 3548
#include <string>
#include <queue>
#include <stack>
#include <vector>
#include <sstream>
#include <algorithm>
#include <deque>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <list>
#include <cstdio>
#include <iostream>
#include <cmath>
#include <climits>
#include <bitset>
#include <functional>
#include <numeric>
#include <ctime>
#include <cassert>
#include <cstring>
#include <fstream>

using namespace std;

int main() {
    string s;
    cin >> s;

    string aki = "AKIHABARA";
    bool ans = false;
    for (int i = (1 << 4) - 1; i >= 0; i--) {
        stringstream ss;
        int it = 0;
        for (auto c : aki) {
            if (c != 'A')
                ss << c;
            else {
                if ((i >> it) & 1)
                    ss << c;
                it++;
            }
        }
        if (s == ss.str()) {
            ans = true;
            break;
        }
    }

    cout << (ans ? "YES" : "NO") << endl;
    return 0;
}

Measured memory_bytes: 384
#include <algorithm>
    #include <bits/stdc++.h>
    #include <cctype>
    #include <cmath>
    #include <cstdio>
    #include <iomanip>
    #include <iostream>
    #include <list>

    #include <stack>
    #include <string>
    #include <vector>
    #include <bits/stdc++.h>
    #define INFINI (1000 * 1000 * 1000)

    using namespace std;
    //#define s(T) scanf("%d", &T)
    #define sl(T) scanf("%lld", &T)
    #define fill(a, val) memset(a, val, sizeof(a))
    #define mp make_pair
    #define pb push_back
    #define all(x) x.begin(), x.end()
    #define DREP(x) sort(all(x)); x.erase(unique(all(x)), x.end())
    #define INDEX(a, val) (lower_bound(all(a), val) - a.begin())
    #define mod ll(1e9+7)
    typedef long long ll;


    bool compare_first(pair<ll,ll >a,pair<ll,ll >b)
    {
        return a.first<b.first;
    }

     bool compare_second(pair<int,pair<int , int> > a,pair<int,pair<int , int> > b)
    {
        return a.second.first<b.second.first;
    }


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


    int main() {
      ios::sync_with_stdio(false);


 int a,b,c;
 cin>>a>>b>>c;

 if((a==5&&b==5&&c==7)||(a==5&&b==7&&c==5)||(a==7&&b==5&&c==5))
    cout<<"YES"<<endl;
 else
    cout<<"NO"<<endl;
return 0;
    }


/*

 }
 */


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cstdlib>
#include <cmath>
#include <numeric>

typedef long long ll;
using namespace std;

ll patties(int n, ll x, vector<ll> &p, vector<ll> &pp) {
    if (x <= 0) return 0;
    if (n == 0) return x > 0;
    ll th = p[n] / 2;
    if (x >= p[n]) {
        return pp[n];
    } else if (x < th) {
        return patties(n - 1, x - 1, p, pp);
    } else if (x == th) {
        return pp[n-1];
    } if (x > th) {
        return pp[n-1] + 1 + patties(n - 1, x - th - 1, p, pp);
    }
}

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

    vector<ll> p(51, 1); // p[i] == things in a level-i burger
    vector<ll> pp(51, 1); // pp[i] == patties in a level-i burger
    for (int i = 1; i <= 50; i++) {
        p [i] = p [i-1] * 2 + 3;
        pp[i] = pp[i-1] * 2 + 1;
    }
    
    cout << patties(n, x, p, pp) << endl;
    
}

Measured memory_bytes: 256
fun main(args: Array<String>) {
    val (d, g) = readLine()?.split(" ")?.map { it.toInt() } ?: return
    val pcList: List<Pair<Int, Int>> = (0 until d).map { ignore ->
        val (p, c) = readLine()?.split(" ")?.map { it.toInt() }!!
        p to c
    }

    var result = Int.MAX_VALUE

    for (flg in 0..(1 shl d)) { // 2^dパターンを調べる必要がある
        var total = 0
        var count = 0
        for (i in 0 until d) {
            // bitが立っている問題を完全回答してボーナスをもらう
            if (flg.and(1 shl i) != 0) {
                total += (((i + 1) * 100 * pcList[i].first) + pcList[i].second)
                count += pcList[i].first
            }
        }
        // 目標点に到達していたらそこでおしまい
        if (total >= g) {
            result = Math.min(result, count)
            continue
        }

        // 目標点に届いてない場合には完全回答していない問題のうち、
        // 得点の高い問題から解いていく
        for (i in (d - 1) downTo 0) {
            // 完全回答対象は無視
            if (flg.and(1 shl i) != 0) {
                continue
            }
            // 完全回答はしない
            for (n in 1 until (pcList[i].first)) {
                total += ((i + 1) * 100)
                count++
                if (total >= g) {
                    break
                }
            }

            if (total >= g) {
                result = Math.min(result, count)
                break
            }
        }
    }
    println(result)
}

Measured memory_bytes: 38076
#include <stdio.h>
#include <string.h>

int main()
{
    int num;
    int yen;
    
    int data[100];
    int i,j,k;
    int tmp;
    int cnt = 0;
    
    scanf("%d %d", &num, &yen);
    
    for(i=0; i<num; i++){
        scanf("%d", &data[i]);
    }
    
    for(i=0; i<num; i++){
        for(j=num-1; j>i; j--){
            if(data[j] < data[j-1]){
                tmp = data[j];
                data[j] = data[j-1];
                data[j-1] = tmp;
            }
        }
    }
    
    for(i=0; i<num; i++){
        if(yen < data[i]){
            break;
        }
        
        if(i==num-1){
            if(yen != data[i]){
                break;
            }
        }
        
        yen -= data[i];
        cnt++;
    }
    
    printf("%d\n", cnt);
    
    return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
template <class T> using vec = vector<T>;
template <class T> using vvec = vector<vec<T>>;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int a;
    cin >> a;
    cout << a+a*a+a*a*a << "\n";
}

Measured memory_bytes: 3648
#include<bits/stdc++.h>
#include<iostream>
#include<iomanip>
#include<string>
#include<cctype>
#include<cmath>
#include<queue>
#include<stack> 
#include<vector>
#define rep(i,n) for(int i=0;i<(n);i++)
using namespace std;
//const int MAX_V=105;
const long long mod =1e9+7;


int main(){
  int N;
  cin >> N;
  int l,r,sum=0;
  rep(i,N){
    cin >> l >> r;
    sum += r-l+1;
  }
  cout << sum << endl;

    return 0;
}
 

Measured memory_bytes: 256
N = int(input())
S = [input()[0] for i in range(N)]
B = {}
for c in S:
    if c not in 'MARCH':
        continue
    B[c] = B.get(c, 0) + 1
A = sum(B.values())
ans = A*(A-1)*(A-2)//6
for c1 in B:
    ans -= B[c1] * (B[c1]-1) * (B[c1]-2) // 6
    for c2 in B:
        if not c1 < c2:
            continue
        ans -= B[c1] * (B[c1]-1) * B[c2] // 2
        ans -= B[c2] * (B[c2]-1) * B[c1] // 2
print(ans)

Measured memory_bytes: 3884
#include <stdio.h>

int main(void){
   int a=0,b=0,c=0,tem,i;
   for(i=0;i<10;i++){
      scanf("%d",&tem);
      if(tem>=a){
      c=b;b=a;a=tem;
      }
      else if(tem>=b){
      c=b;b=tem;
      }
      else if(tem>=c){
      c=tem;
      }
   }
   printf("%d\n%d\n%d\n",a,b,c);
   return 0;
}



Measured memory_bytes: 2108
K,X,Y = (int(x) for x in input().split())
ans = [0] * K
ct = 0
for i in range(1,K):
    for j in range (i+1,K+1):
            ans[min(j-i,abs(i-X)+abs(j-Y)+1)] += 1
for k in range (1,K):
    print(ans[k])

Measured memory_bytes: 3444
#include <bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define R cin>>
#define Z class
#define ll long long
#define ln cout<<'\n'
#define in(a) insert(a)
#define pb(a) push_back(a)
#define pd(a) printf("%.10f\n",a)
#define mem(a) memset(a,0,sizeof(a))
#define all(c) (c).begin(),(c).end()
#define iter(c) __typeof((c).begin())
#define rrep(i,n) for(ll i=(ll)(n)-1;i>=0;i--)
#define REP(i,m,n) for(ll i=(ll)(m);i<(ll)(n);i++)
#define rep(i,n) REP(i,0,n)
#define tr(it,c) for(iter(c) it=(c).begin();it!=(c).end();it++)
template<Z A>void pr(A a){cout<<a;ln;}
template<Z A,Z B>void pr(A a,B b){cout<<a<<' ';pr(b);}
template<Z A,Z B,Z C>void pr(A a,B b,C c){cout<<a<<' ';pr(b,c);}
template<Z A,Z B,Z C,Z D>void pr(A a,B b,C c,D d){cout<<a<<' ';pr(b,c,d);}
template<Z A>void PR(A a,ll n){rep(i,n){if(i)cout<<' ';cout<<a[i];}ln;}
ll check(ll n,ll m,ll x,ll y){return x>=0&&x<n&&y>=0&&y<m;}
const ll MAX=1e9+7,MAXL=1LL<<61,dx[4]={-1,0,1,0},dy[4]={0,1,0,-1};
typedef pair<int,int> P;

void Main() {
  int n=3;
  int c[n][n];
  rep(i,n)rep(j,n) R c[i][j];
  set<vector<int> > s[2];
  rep(i,n) {
    vector<int> v(2);
    rep(j,n-1) v[j]=c[i][j]-c[i][j+1];
    s[0].in(v);
  }
  rep(j,n) {
    vector<int> v(2);
    rep(i,n-1) v[i]=c[i][j]-c[i+1][j];
    s[1].in(v);
  }
  if(s[0].size()==1&&s[1].size()==1) pr("Yes");
  else pr("No");
}

int main(){ios::sync_with_stdio(0);cin.tie(0);Main();return 0;}


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

using namespace std;

#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace __gnu_pbds;

#define endl '\n'
#define MAX

typedef long long ll;
typedef pair<int,int> pii;
//typedef tree<int,null_type,less<int>,rb_tree_tag, tree_order_statistics_node_update> indexed_set;


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

	//freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);
	
	int n, m;
	cin >> n >> m;
	vector<vector<int>> g(n);
	vector<int> indeg(n);
	for(int i = 0; i < m; i++){
		int a, b;
		cin >> a >> b;
		a--;
		b--;
		g[a].push_back(b);
		indeg[b]++;
	}
	
	vector<int> order;
	queue<int> Q;
	for(int i = 0; i < n; i++)
		if(indeg[i] == 0)
			Q.push(i);
	
	while(!Q.empty()){
		int node = Q.front();Q.pop();
		order.push_back(node);
		for(auto &adj : g[node]){
			indeg[adj]--;
			if(indeg[adj] == 0)
				Q.push(adj);
		}
	}
	
	int ans = 0;
	vector<int> dp(n);
	
	for(int i = n - 1; i >= 0; i--){
		int x = order[i];
		for(auto &y : g[x])
			dp[x] = max(dp[x], dp[y] + 1);
		ans = max(ans, dp[x]);
	}
		
	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 7032
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <utility>
#include <unordered_map>
#include <cmath>
using namespace std;

typedef long long llong;
typedef unsigned long long ullong;
// -2.1e-9 <= int <= 2.1e9
// 0 <= unsigned int <= 4.2e9

int main()
{
    size_t N, M;
    cin >> N >> M;
    string S(N, '0');
    if (N > 1) {
        S[0] = '1';
    }
    vector<int> c(N+1, -1);
    for (size_t i=0; i<M; i++) {
        size_t si;
        int temp;
        cin >> si >> temp;
        if (c[si] == -1) {
            c[si] = temp;
        }
        else {
            if (c[si] != temp) {
                cout << -1 << endl;
                return 0;
            }
            else {
                c[si] = temp;
            }
        }
        string ss = to_string(temp);
        S[si-1] = ss[0];
    }

    size_t len = S.length();
    if ((S.length() > 1) && (S[0] == '0')) {
        cout << -1 << endl;
        return 0;
    }

    int ans = stoi(S);
    cout << ans << endl;
    bool check = true;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define MAX 2005
#define ll long long
#define upperlimit 1000100
#define INF 1e18
#define eps 1e-8
#define endl '\n'
#define pcc pair<char,char>
#define pii pair<ll,ll>
#define pll pair<ll,ll>
#define tr(container,it) for(typeof(container.begin()) it=container.begin();it!=container.end();it++)
#define MOD 1000000007
#define slld(t) scanf("%lld",&t)
#define sd(t) scanf("%d",&t)
#define pd(t) printf("%d\n",t)
#define plld(t) printf("%lld\n",t)
#define mp(a,b) make_pair(a,b)
#define FF first
#define SS second
#define pb(x) push_back(x)
#define vi vector<int>
#define clr(a) memset(a,0,sizeof(a))
#define debug(a) printf("check%d\n",a)
#define csl ios::sync_with_stdio(false);cin.tie(0);
#define INT_SIZE 32
using namespace std;
 
ll gcd(ll n1,ll n2){
	if(n1%n2==0)return n2;
	return gcd(n2,n1%n2);
}
ll powmod(ll base,ll exponent)
{
	ll ans=1;
	while(exponent){
		if(exponent&1)ans=(ans*base)%MOD;
		base=(base*base)%MOD;
		exponent/=2;
	}
	return ans;
}
int main()
{
	ll x;
	cin>>x;
	ll ans=x/11;
	ans*=2;
	ll rem=x%11;
	if(rem!=0&&rem<=6)
		ans++;
	else if(rem!=0)
		ans+=2;
	cout<<ans<<endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <stdio.h>
#include <cstring>
#include <cstdio>
#include <math.h>
#include <algorithm>
#include <vector>
#include <string>
#include <stdlib.h>
#include <queue>
#include <stack>
#include <utility>
#include <fstream>
#include <random>
#include <map>
#include <unordered_map>
#include <cstdlib>
#include <functional>
#include <random>
#include <time.h>
#include <chrono>
#include <sstream>
#include <iomanip>
#define rep(i,n) for(int i=0;i<n;i++)
#define rrep(i,n) for(int i=n-1;i>=0;i--)
#define FOR(i,a,b) for(int i=a;i<b;i++)
#define ll long long
#define INF 1000000001
#define mod 1000000007
#define SORT(s) sort(s.begin(), s.end());
#define reverse(s) reverse(s.begin(), s.end());
#define P pair<int,int>
#define mp make_pair
#define valid(x,y,h,w) (0<=x&&x<h&&0<=y&&y<w)
int dx[4] = { 0,1,0,-1 };
int dy[4] = { 1,0,-1,0 };
using namespace std;
int POW(int x, int y) { return int(pow(double(x), double(y))); }
double log(double a, double b) { return log(b) / log(a); }




int main() {
	int n,k;
	cin >> n >> k;
	vector<int> v(n);
	rep(i, n) {
		cin >> v[i];
	}

	int ans = 0;
	//i 取り出す回数 k-i回戻す
	rep(i0, k + 1) {
		int i = i0;
		if (n < i) {
			i = n;
		}
		rep(j, i + 1) {

			int score = 0;
			vector<int> boo;

			rep(k, j) {
				score += v[k];
				if (v[k] < 0) {
					boo.push_back(v[k]);
				}
			}
			rep(k, i - j) {
				score += v[n - 1 - k];
				if (v[n - 1 - k] < 0) {
					boo.push_back(v[n - 1 - k]);
				}
			}

			int back = k - i;
			SORT(boo);
			rep(z, back) {
				if (z == boo.size()) {
					break;
				}
				score -= boo[z];
			}
			ans = max(ans, score);
		}
		
	}
	cout << ans << endl;
}



Measured memory_bytes: 256