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

using namespace std;
typedef long long ll;
#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 FORR(i, m, n) for(int i = m; i >= n; i--)
#define INF (ll)2e9
#define MOD ((ll)1e9+7)
#define ALL(v) v.begin(), v.end()
#define SZ(x) ((int)(x).size())
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
#define y0 y3487465
#define y1 y8687969
#define j0 j1347829
#define j1 j234892
#define next asdnext
#define prev asdprev
#define bit(n) (1LL<<(n))

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

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

template<class InputIterator>
InputIterator adv(InputIterator x, typename std::iterator_traits<InputIterator>::difference_type n) {
    advance(x, n);
    return x;
}

class mod {
    static ll fact[];
public:

    template<class... A>
    static ll mul(A... args) {
        ll res = 1;
        for (ll i : std::initializer_list < ll > {args...}) {
            res = (res * i) % MOD;
        }
        return res;
    }

    static ll power(ll base, ll exp) {
        if (exp == 0) return 1;
        if (exp & 1) {
            return mul(base, power(base, exp - 1));
        } else {
            ll p = power(base, exp / 2);
            return mul(p, p);
        }
    }

    static ll factorial(int n) {
        if (fact[n] != 0) return fact[n];
        if (n == 0) return 1;
        return fact[n] = mul(n, factorial(n - 1));
    }

    static ll inverse(int n) {
        return power(n, MOD - 2);
    }

    static ll comb(int n, int r) {
        if (r < 0 || r > n) return 0;
        return mul(factorial(n), inverse(factorial(n - r)), inverse(factorial(r)));
    }

    template<class... A>
    static ll div(ll dividend, A... args) {
        ll res = dividend;
        for (ll i : std::initializer_list < ll > {args...}) {
            res = mul(res, inverse(i));
        }
        return res;
    }

    template<class... A>
    static ll add(A... args) {
        ll res = 0;
        for (ll i : std::initializer_list < ll > {args...}) {
            res = (res + i) % MOD;
        }
        return res;
    }

    template<class... A>
    static ll sub(ll l, A... args) {
        ll res = l;
        for (ll i : std::initializer_list < ll > {args...}) {
            res = (res - i + MOD) % MOD;
        }
        return res;
    }
};

ll mod::fact[(int) 1e6 + 1];

int ni() {
    int i;
    cin >> i;
    return i;
}

ll nll() {
    ll l;
    cin >> l;
    return l;
}

int main() {
    int N = ni();

    int count[(int)1e5+1] = {};
    REP(i, N) {
        int A = ni();
        count[A]++;
        if (A%2 == N%2 || count[A] > 2 || (count[0] > 1)) {
            cout << 0 << endl;
            return 0;
        }
    }

    cout << mod::power(2, N/2) << endl;
    return 0;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
#define ll                      long long
#define pb                      push_back
#define rep(i,a,b,c)            for(ll i=(a);i<=(b);i+=(c))
#define repb(i,a,b,c)           for(ll i=(a);i>=(b);i-=(c))
#define MOD                     1000000007
#define inf                     3e18
#define ld                      long double
#define mp                      make_pair
#define vpll                    vector<pair<ll,ll> >
#define vll                     vector<ll>
#define vld                     vector<ld>
#define vvll                    vector<vector<ll>>
#define vvld                    vector<vector<ld>>
#define pll                     pair<ll,ll>
#define vvpll                   vector<vector<pair<ll,ll>>>
#define pqll                    priority_queue<ll>
#define mll                     map<ll,ll>
#define mlc                     map<ll,char>
#define um                      unordered_map
#define umll                    um<ll,ll>
#define umlc                    um<ll,char>
#define all(x)                  x.begin(),x.end()
#define fi                      first
#define se                      second
#define ln                      cout<<"\n";
#define endl                    "\n"
#define test                    ll T;cin>>T;while(T--)
#define isvowel(a)              (a == 'a' || a == 'e' || a == 'i' || a == 'o' || a == 'u')
#define fastIO                  ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define show(w,size)            for(ll i=0;i<size;i++) cout<<w[i]<<" ";
#define prll(a)                 cout<<a<<"\n";
#define mset(dp,no)             memset(dp,no,sizeof(dp))
#define input(a,n)              rep(i,0,n-1,1) cin>>a[i];
#define countbit                __builtin_popcount                                           //Number of setbits in decimal notation
#define lb(v,cur)               lower_bound(all(v),cur)-v.begin()
#define ub(v,cur)               upper_bound(all(v),cur)-v.begin()
#define db(...)                 __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1) { cerr << name << " : " << arg1 <<'\n'; }
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args) {
    const char* comma = strchr(names + 1, ',');
    cout.write(names, comma - names) << " : " << arg1 << " | "; __f(comma + 1, args...);
}
long long pows(long long a, long long b) {
  long long res = 1;
    while (b > 0) {
        if (b & 1)
            res = res * a;
        a = a * a;
        b >>= 1;
    }
    return res;
}
ll powm(ll x,ll y,ll m=MOD){x=x%m;ll res=1;while(y){if(y&1)res=res*x;res%=m;y=y>>1;x=x*x;x%=m;}return res;}
ll modInverse(ll a, ll m=MOD){if(m == 1)return 0;ll m0=m,y=0,x=1;while(a>1){ll q=a/m,t=m;m=a%m,a=t;t=y;y=x-q*y;x=t;}if(x<0) x+=m0;return x;}
int main()
{
fastIO
ll m,i,j,k,x,y,z,t,e,f,p,q,g,l,r,w,h,count1=0,prod=1,a,b,c,d,index,diff,ans=0,sum=0,sum1=0,sum2=0,flag=0,flag1=0,flag2=0;
string s,s1,s2;
ll n;
cin>>n;
while(n)
{
  p=n%26;
  p--;
  if(p==-1)
  {
    s1+='z';
  }
  else
  {
    char ch=p+'a';
    s1+=ch;
  }
  n--;
  n/=26;
}
reverse(all(s1));
cout<<s1;
}


Measured memory_bytes: 3616
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>

using namespace std;
#define MAXN 200000
#define MOD 1000000007
#define INF 0x3f3f3f3f
#define rint register int
#define gc() getchar()
inline int read(rint ans = 0, rint sgn = ' ', rint ch = gc())
{
	for(; ch < '0' || ch > '9'; sgn = ch, ch = gc());
	for(; ch >='0' && ch <='9';(ans*=10)+=ch-'0', ch = gc());
	return sgn-'-'?ans:-ans;
}
struct D{int x,y; D(){} D(int _x, int _y){x=_x,y=_y;}}A[MAXN+5], S[MAXN+5]; int f[MAXN+5], s[MAXN+5], n, l = INF, r;
inline bool cmpx(D a, D b){return a.x^b.x?a.x<b.x:a.y<b.y;} inline bool cmpy(D a, D b){return a.y^b.y?a.y<b.y:a.x<b.x;}
int main()
{
	n = read(); for(rint i = 1; i <= n; A[i].x = read(), A[i].y = read(), i++); sort(A+1,A+n+1,cmpy); for(rint i = 1; i <= n; A[i].y = i, i++); sort(A+1,A+n+1,cmpx); for(rint i = 1; i <= n; A[i].x = i, i++);
	for(rint i = 1, w = 0; i <= n; S[i].y = w = max(w,A[i].y), i++); for(rint i = n, w = INF; i; S[i].x = w = min(w,A[i].y), i--); sort(S+1,S+n+1,cmpy); S[n+1].x = S[n+1].y = n+1, f[0] = s[0] = 1;
	for(rint i = 1, j = 0; i <= n+1; f[i] = s[i-1]+MOD-(j?s[j-1]:0), f[i]<MOD?:f[i]-=MOD, s[i] = s[i-1]+f[i], s[i]<MOD?:s[i]-=MOD, i++) for(; j<i&&S[j].y<S[i].x-1; j++); printf("%d\n",f[n+1]); return 0;
}

Measured memory_bytes: 4992
import math
n = int(input())
MAX = int(math.sqrt(n)) + 1

a = [0]*MAX

for i in range(2, MAX):
  while n % i == 0:
    n /= i
    a[i] += 1

if n != 1:
  ans = 1
else:
  ans = 0
  
for i in a:
  for j in range(MAX):
    p = int(j * (j+1) / 2)
    if i < p:
      ans += j - 1
      break
print(ans)

Measured memory_bytes: 16680
import java.io._
import java.util.StringTokenizer
import scala.util.control.Breaks.{breakable,break}
import scala.collection.mutable.{Map, Stack, Queue, PriorityQueue, Set}
import scala.util.Random
import java.util.Date

object Main extends App {
  val startTime = new Date().getTime // to milli seconds

  val in = new InputReader(System.in)
  val pw = new PrintWriter(System.out)

  val D = in.next().toInt
  val c = new Array[Long](26+1)
  val s = Array.ofDim[Long](D+1, 26+1)

  for (i <- 1 to 26) {
    c(i) = in.next().toInt
  }
  for (d <- 1 to D) {
    for (i <- 1 to 26) {
      s(d)(i) = in.next().toInt
    }
  }


  /** functions **/
  def calcScore(t: Array[Int]): Long = {
    val last = new Array[Int](26+1)
    var res = 0L

    for (d <- 1 to D) {
      val ty = t(d)

      res += s(d)(ty)
      last(ty) = d

      for (i <- 1 to 26) {
        res -= c(i) * (d - last(i))
      }
    }

    res
  }


  /** solve **/
  val t = new Array[Int](D+1)
  for (d <- 1 to D) {
    t(d) = (d % 26 + 1)
  }

  val endTime = 1400
  var nowScore = calcScore(t)
  while ((new Date().getTime - startTime) < endTime) {
    for (_ <- 1 to 1000) {
      val d = Random.nextInt(D) + 1
      val ty = Random.nextInt(26) + 1

      val tmp = t(d)
      t(d) = ty
      val score = calcScore(t)
      if (score > nowScore) {
        nowScore = score
      }
      else {
        t(d) = tmp
      }
    }
  }


  for (d <- 1 to D) {
    pw.println(t(d))
  }
  pw.flush()
}

object Sub {
  def print2DimArray[A](mat: Array[Array[A]]): Unit = {
    mat.foreach(lin => println(lin.toList))
  }
}

class InputReader(stream: InputStream) {
  private[this] val reader = new BufferedReader(new InputStreamReader(stream))
  private[this] var tokenizer: StringTokenizer = new StringTokenizer(reader.readLine())
  def next(): String = {
    while (!tokenizer.hasMoreTokens()) {
      tokenizer = new StringTokenizer(reader.readLine())
    }
    tokenizer.nextToken()
  }
}


Measured memory_bytes: 57428
import itertools

while True:
    N,X = map(int,input().split())
    if N == 0 and X == 0:
        break
    else:
        ans = 0
        L = list(itertools.combinations([i for i in range(1,N+1)],3))

        for a,b,c in L:
            if a+b+c == X:
                ans += 1

        print(ans)


Measured memory_bytes: 31424
#include <stdio.h>

int main(void)
{
	int a[31];
	int b, i;

	for (i = 1; i <= 30; i++){
		a[i] = 0;
	}

	for (i = 1; i <= 28; i++){
		scanf("%d", &b);
		a[b] = 1;
	}

	for (i = 1; i <= 30; i++){
		if (a[i] == 0){
			printf("%d\n", i);
		}
	}

	return (0);
}

Measured memory_bytes: 596
#include <bits/stdc++.h>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <deque>
#include <functional>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <utility>
#include <vector>
#define pi 3.14159265358979323846264338327950L
using namespace std;

int main() {
  int N, ans=0;
  cin >> N;
  vector<int64_t> L(N);
  for (int i=0; i<N; i++) {
    cin >> L[i];
  }
  sort(L.begin(),L.end());
  if (N==1 || N==2) {
    ans=0;
  }
  else {
    for (int i=0; i<N-2; i++) {
      for (int j=i+1; j<N-1; j++) {
        for (int k=j+1; k<N; k++) {
          if (L[i]+L[j]>L[k] && L[i]!=L[j] && L[j]!=L[k]) {
            ans=ans+1;
          }
        }
      }
    }
  }
  cout << ans << endl;
}


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

int n, m;
char arr[20];

int main(){
	int i, flag = 1, cnt = 0;
	scanf("%s", arr);
	n = strlen(arr);
	if(arr[0] != 'A') flag = 0;
	if(arr[1] == 'C') flag = 0;
	if(arr[n - 1] == 'C') flag = 0;
	for(i = 1; i < n; i++){
        if(arr[i] == 'C') cnt++;
        else if(arr[i] < 'a' || arr[i] > 'z') flag = 0;
	}
	if(cnt != 1) flag = 0;
	if(flag) printf("AC");
	else printf("WA");
	return 0;
}


Measured memory_bytes: 256
s = input()
s = s.replace('BC','x')

a_flag = False
ans = 0
last_a = 0
for si in s:
    if si == 'A':
        a_flag = True
        last_a += 1
    elif si == 'x' and a_flag:
        # ans += 1
        ans += last_a
    else:
        a_flag = False
        last_a = 0

print(ans)


# while 
# cnt = s.count('ABC')
# s = s.replace('ABC','BCA')
# cnt += s.count('ABC')
# print(cnt)

# ab_flag = False
# a_flag = False
# a_cnt = 0
# ans = 0
# for si in s:
#     if si == 'A': 
#         a_cnt += 1
#         ab_flag = False
#     elif si == 'B':
#         if a_flag: 
#             ab_flag = True
#         else: 
#             a_flag = False
#             ab_flag = False
#     elif si == 'C':
#         if ab_flag:
#             ab_flag = False
#             a_flag = True
#             ans += 1
#         else:
#             ab_flag = False
#             a_flag = False
#     else:
#         ab_flag = False
#         a_flag = False
# print(ans)

Measured memory_bytes: 73796
// Problem : D - RGB Triplets
// Contest : AtCoder - AtCoder Beginner Contest 162
// URL : https://atcoder.jp/contests/abc162/tasks/abc162_d
// Memory Limit : 1024 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

#include<bits/stdc++.h>
using namespace std;

#define ff first
#define fs second
#define lb lower_bound
#define ub upper_bound

#define int long long
#define pii pair<int, int>
#define vi vector<int>
#define vvi vector< vi >
#define vpii vector< pii >
#define vb vector<bool>
#define si set<int>
#define mii map<int, int>
#define mci map<char, int>
#define md 1000000007
#define pb push_back
#define eb emplace_back
#define fio ios_base::sync_with_stdio (false); cin.tie (NULL);  cout.tie (NULL);
#define qw1(x) cerr<<#x<<": "<<x<<" "<<endl
#define qw2(x, y) cerr<<#x<<": "<<x<<" | "<<#y<<": "<<y<<endl
#define qw3(x, y, z) cerr<<#x<<":" <<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl
#define qw4(a, b, c, d) cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<endl


#define f(i,a,b) for(int i=(int)a;i<=(int)b;i++)
#define rl(i,a,b) for(int i=(int)a;i>=(int)b;i--)
#define all(x) x.begin(),x.end()
#define endl '\n'
void printv(vector<int>  v){
	for(int i=0;i<v.size();i++) cout<<v[i]<<' '; 	cout<<endl;   }

int be(int m , int n, int mod) {
	int res=1;
	while(n){
	     if(n%2!=0) { res*=m; res%=mod; }
	     m*=m;   m%=mod;   n/=2;
	}
	return res;
     }

void sieve(int n, vb &prime){
    prime[0]=false;     prime[1]=false;
    for(int i=2;i*i<=n;i++){
         if(prime[i]==true){
              for(int j=i*i;j<=n;j+=i)    prime[j]=false;
             	  }
    	 }
	}


int32_t main ()
{
//fio
int t=1; 
//cin>>t; 
while(t--){
int n; cin>>n;
string s; cin>>s;
vi r,g;
map<int, bool> m;
f(i,0,n-1){
	if(s[i]=='R') r.pb(i);
	else if(s[i]=='G') g.pb(i);
	else m[i]=true;
	
}
//printv(r); printv(g);
int ans=r.size()*g.size()*m.size();
for(auto i:r){
	for(auto j:g){
		if( (i+j)%2==0 && m[ (i+j)/2]) ans--;
		if( m[2*i-j]) ans--;
		if(m[2*j-i]) ans--;
		//qw3(i,j,ans);
		
	
	}
}
cout<<ans;
   
  
}
 
}








Measured memory_bytes: 4380
program example
	implicit none

	integer A,B,i,A1,B1
    
    read(*,*) A,B
    
    do i=1,1250
    
    	A1=int(i*0.08)
        
        B1=int(i*0.10)
        
        if (A==A1 .and. B==B1) then
        
        	write(*,*) i
            goto 1
        end if
        
    end do
    
    write(*,*) "-1"

1 end program example

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

struct RLUQ{
  struct query{
    int type;//0=empty, 1=set
    int value;
    query(int a=0,int b=0):type(a),value(b) {}
  };
  query s[(1<<18)];
  int t[(1<<18)];
  RLUQ(){
    fill(t,t+(1<<18),INT_MAX);
  }
  void compute(int k,int l,int r){
    query q=s[k];
    s[k].type=0;
    if(q.type==0||r-l==1)return;
    s[k*2+1]=s[k*2+2]=q;  
    t[k*2+1]=t[k*2+2]=q.value;
  }
  void Set(int a,int b,int x,int k=0,int l=0,int r=(1<<17)){
    if(b<=l || r<=a)return;
    compute(k,l,r);
    if(a<=l && r<=b){
      s[k]=query(1,x);
      t[k]=x;
    }else{
      int m=(l+r)/2;
      Set(a,b,x,k*2+1,l,m);
      Set(a,b,x,k*2+2,m,r);
      t[k]=min(t[k*2+1],t[k*2+2]);
    }
  }
  int Get(int a,int b,int k=0,int l=0,int r=(1<<17)){
    if(b<=l || r<=a)return INT_MAX;
    compute(k,l,r);
    if(a<=l && r<=b){
      return t[k];
    }else{
      int m=(l+r)/2;
      int lv=Get(a,b,k*2+1,l,m);
      int rv=Get(a,b,k*2+2,m,r);
      return min(lv,rv);
    }
  }
};

int main(){
  RLUQ a;
  int n,q;
  cin>>n>>q;
  int c,s,t,x;
  for(int i=0;i<q;i++){
    cin>>c;
    if(c){
      cin>>s;
      cout<<a.Get(s,s+1)<<endl;
    }
    else{
      cin>>s>>t>>x;
      a.Set(s,t+1,x);
    }
  }
}


Measured memory_bytes: 6180
# -*- coding: utf-8 -*-
# D

import sys
from collections import defaultdict, deque, Counter
from heapq import heappush, heappop
import math
import bisect
input = sys.stdin.readline

# 再起回数上限変更
# sys.setrecursionlimit(1000000)

co = defaultdict(int)

n = int(input())
a = list(map(int, input().split()))
q = int(input())
b = []
c = []

for a_ in a:
    co[a_] += 1
# print(co)

ans = sum(a)

for _ in range(q):
    b_, c_ = map(int, input().split())
    b.append(b_)
    c.append(c_)

    diff = - co[b_] * b_
    diff += co[b_] * c_
    co[c_] += co[b_]
    co[b_] = 0
    ans += diff
    print(ans)




Measured memory_bytes: 99544
import math
a,b,h,m = list(map(int,input().split()))
xa,ya = a*math.sin(-h*math.pi/6 - m*math.pi/360), a*math.cos(-h*math.pi/6 - m*math.pi/360)
xb,yb = b*math.sin(-m*math.pi/30), b*math.cos(-m*math.pi/30)
print(((xa-xb)**2+(ya-yb)**2)**(1/2))

Measured memory_bytes: 9580
//include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <climits>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <queue>
#include <random>
#include <cctype>
#include <complex>
#include <regex>

using namespace std;

#define C_MAX(a, b) ((a)>(b)?(a):(b))
#define SHOW_VECTOR(v) {std::cerr << #v << "\t:";for(const auto& xxx : v){std::cerr << xxx << " ";}std::cerr << "\n";}
#define SHOW_MAP(v) {std::cerr << #v << endl; for(const auto& xxx: v){std::cerr << xxx.first << " " << xxx.second << "\n";}}

#define EPS 1e-8
#define EQ(a, b) (abs((a)-(b)) < EPS)

typedef complex<double> P;

double dot(P a, P b) {
    return a.real() * b.real() + a.imag() * b.imag();
}

double cross(P a, P b) {
    return a.real() * b.imag() - a.imag() * b.real();
}

P normal_unit(P a) {
    return (a / abs(a)) * P(0, -1);
}

int main() {

    double xp1, yp1, xp2, yp2;
    cin >> xp1 >> yp1 >> xp2 >> yp2;

    P a(xp1, yp1);
    P b(xp2, yp2);

    int Q;
    cin >> Q;

    while (Q--) {

        double x, y;
        cin >> x >> y;

        P c(x, y);

        P X = b - a;
        P Y = c - a;

        double t = cross(X, Y) / abs(X);
        P ans = c + normal_unit(X) * t * 2.0;

        cout << fixed << setprecision(10) << ans.real() << " " << ans.imag() << endl;

    }

    return 0;
}














































Measured memory_bytes: 3344
#include <bits/stdc++.h>
using namespace std;
int main() {
  string s;
  cin >> s;
  string need = "AKIHABARA";
  int ptr = 0;
  for (int i = 0; i < need.length(); i++) {
    if (ptr < s.length() && need[i] == s[ptr]) {
      ptr++;
    } else {
      if (need[i] != 'A') {
        puts("NO");
        return 0;
      }
    }
  }
  if (ptr != (int) s.length()) {
    puts("NO");
    return 0;
  }
  puts("YES");
  return 0;
}

Measured memory_bytes: 256
while str = STDIN.gets
	if str == -1 then break end

	a = str.split(' ');
	eps = 1e-12;
	for i in 0...8 do
		a[i] = a[i].to_f
	end

	if ((a[0]-a[2])*(a[4]-a[6])+(a[1]-a[3])*(a[5]-a[7])).abs <= eps then
		puts "YES\n" 
	else
		puts "NO\n"
	end

end

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

int N,M;
vector< vector<int> > st(51, vector<int> (51));
vector<bool> visit(51);
int ans = 0;
bool del[51][51];

void dfs(int n) {
    visit[n] = true;
    for (auto i : st[n]) if (!visit[i] && del[n][i]) dfs(i);
}

int main(void) {
    cin >> N >> M;
    int at,bt,a[M],b[M];
    for (int i=0; i<M; i++) {
        cin >> at >> bt;
        a[i] = at-1; b[i] = bt-1;
        st[a[i]].push_back(b[i]);
        st[b[i]].push_back(a[i]);
        del[a[i]][b[i]] = true;
        del[b[i]][a[i]] = true;
    }

    for (int i=0; i<M; i++) {
        del[a[i]][b[i]] = false; del[b[i]][a[i]] = false;
        for (int j=0; j<N; j++) visit[j] = false;
        dfs(0);
        for (int j=0; j<N; j++) {
            if (!visit[j]) {
                ans++;
                break;
            }
        }
        del[a[i]][b[i]] = true; del[b[i]][a[i]] = true;
    }
    cout << ans << endl;
    return 0;
}


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

const int max_n = 123456*2;
bool is_prime[max_n+1];

int sieve(int n)
{
	int p = 0;
	for(int i=0;i<=2*n;i++){
		is_prime[i] = true;
	}
	is_prime[0] = is_prime[1] = false;
	for(int i=2;i<=2*n;i++){
		if(is_prime[i]){
			if(n<i && i <= 2*n)
				p++;
			for(int j=2*i;j<=2*n;j+=i)
				is_prime[j] = false;
		}
	}
	return p;
}

int main()
{
	int n;
	while(cin >> n){
		if(!n)
			break;
		cout << sieve(n) << endl;
	}
	return 0;
}

Measured memory_bytes: 0
n,m,k=map(int,input().split())
a=list(map(int,input().split()))
b=list(map(int,input().split()))
ans=0
aindex=n
bindex=m
acumsum = [0]
bcumsum = [0]

ab =0
for aa in range(n):
  ab += a[aa]
  acumsum.append(ab)# = ab
  if ab>k:
    aindex= aa
    break

ab =0
for bb in range(m):
  ab += b[bb]
  bcumsum.append(ab)
  if ab>k:
    bindex= bb
    break

j= bindex
for i in range(aindex+1):
  if acumsum[i] >k:
    break
  while bcumsum[j] > k-acumsum[i]:
    j -=1
  ans = max(ans, i+j)

print(ans)


Measured memory_bytes: 40488
#include<stdio.h>
#include<math.h>
#include<algorithm>
#include<queue>
#include<deque>
#include<stack>
#include<string>
#include<string.h>
#include<vector>
#include<set>
#include<map>
#include<bitset>
#include<stdlib.h>
#include<cassert>
#include<time.h>
#include<bitset>
using namespace std;
const long long mod=1000000007;
const long long inf=mod*mod;
const long long d2=(mod+1)/2;
const double EPS=1e-10;
const double INF=1e+10;
const double PI=acos(-1.0);
const int C_SIZE = 210000;
long long fact[C_SIZE];
long long finv[C_SIZE];
long long inv[C_SIZE];
// long long C(int a,int b){
// 	if(a<b||b<0)return 0;
// 	return fact[a]*finv[b]%mod*finv[a-b]%mod;
// }
void init_C(int n){
	fact[0]=finv[0]=inv[1]=1;
	for(int i=2;i<n;i++){
		inv[i]=(mod-(mod/i)*inv[mod%i]%mod)%mod;
	}
	for(int i=1;i<n;i++){
		fact[i]=fact[i-1]*i%mod;
		finv[i]=finv[i-1]*inv[i]%mod;
	}
}
int ABS(int a){return max(a,-a);}
long long ABS(long long a){return max(a,-a);}
double ABS(double a){return max(a,-a);}
// ここから編集しろ
int p[210000];
int q[210000];
int main(){
	int a;scanf("%d",&a);
	for(int i=0;i<a;i++)scanf("%d%d",p+i,q+i);
	long long ret=0;
	for(int i=0;i<a;i++)ret+=p[i];
	bool ok=true;
	for(int i=0;i<a;i++){
		if(p[i]!=q[i])ok=false;
	}
	if(ok){
		printf("0\n");return 0;
	}
	int mv=mod;
	for(int i=0;i<a;i++){
		if(p[i]>q[i])mv=min(mv,q[i]);
	}
	ret-=mv;
	printf("%lld\n",ret);
}

Measured memory_bytes: 256
// Tazoe

#include <iostream>
using namespace std;

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

		if(n==0)
			break;

		int p_max = -1;
		int d_max = -1;
		for(int i=0; i<n; i++){
			int p, d1, d2;
			cin >> p >> d1 >> d2;

			if(d1+d2>d_max){
				p_max = p;
				d_max = d1+d2;
			}
		}

		cout << p_max << ' ' << d_max << '\n';
	}

	return 0;
}

Measured memory_bytes: 864
import sys
def p(*_a):
  _s=" ".join(map(str,_a))
  #print(_s)
  sys.stderr.write(_s+"\n")
#-------------------------------------------------------------------
L,R = map(int, input().split())		# 5 7 2

mod=2019


l = L % mod
r = R % mod

b = ((R-L)>mod)
b = b or (l>=r)
if b:
	print(0)
	exit(0)


while l>r:
	r+=mod

a=0
b=0
ans=mod

p("l,r,a,b,ans",l,r,a,b,ans)

for a in range(l,r):
	for b in range(a+1, r+1):
		ans = min(ans, (a*b)%mod)

#a=l%mod
#b=a+1
#ans=(a*b)%mod

p("l,r,a,b,ans",l,r,a,b,ans)
print(ans%mod)



Measured memory_bytes: 3064
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <cstring>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <algorithm>
using namespace std;

#define REP(i,n) for(int i=0; i<n; ++i)
#define FOR(i,a,b) for(int i=a; i<=b; ++i)
#define FORR(i,a,b) for (int i=a; i>=b; --i)
#define ALL(c) (c).begin(), (c).end()

typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<VI> VVI;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;

int main() {
    int a, b, c;
    cin >> a >> b >> c;
    cout << (b-a == c-b ? "YES" : "NO") << endl;


    return 0;
}

Measured memory_bytes: 256
from itertools import combinations as cmbs
import sys
c = {"M":0,"A":0,"R":0,"C":0,"H":0}
for i in range(int(input())):
  si = sys.stdin.readline()
  if si[0] in c:
    c[si[0]] += 1
ans = 0
for i,j,k in cmbs(c.values(),r=3):
  t = i*j*k
  ans += t
print(ans)


Measured memory_bytes: 9180
import sys, os

f = lambda:list(map(int,input().split()))
if 'local' in os.environ :
    sys.stdin = open('./input.txt', 'r')

def neg(i):
    if i == 'S':
        return 'W'
    else:
        return 'S'

s  = ''
n = 0

def check(build):
    poss = [0, n-1]
    for pos in poss:
        if build[pos] == 'S':
            if s[pos] == 'o' and build[(pos-1+n)%n] != build[(pos+1+n)%n]:
                return False
            if s[pos] == 'x' and build[(pos-1+n)%n] == build[(pos+1+n)%n]:
                return False
        else:
            if s[pos] == 'o' and build[(pos-1+n)%n] == build[(pos+1+n)%n]:
                return False
            if s[pos] == 'x' and build[(pos-1+n)%n] != build[(pos+1+n)%n]:
                return False
    
    return True

def solve():
    global s, n
    n = f()[0]
    s = input()

    for i in [ 'S', 'W']:
        for j in ['S','W']:
            build = i + j
            
            for k in range(1, n-1):
                if s[k] == 'o':
                    if build[k] == 'S':
                        build += build[k-1]
                    else:
                        build += neg(build[k-1])
                else:
                    if build[k] == 'S':
                        build += neg(build[k-1])
                    else:
                        build += build[k-1]

            if check(build):
                print(build)
                return

    print(-1)


solve()


Measured memory_bytes: 3444
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#include<cstring>
#include<queue>
#include<tuple>
#include<utility>
#include<map>
#include<math.h>
#include<iomanip>
#include<stdio.h>
#include<stdlib.h>
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
#define FOR(i, a, b) for (int i=a; i<(b); i++)
#define range(a) a.begin(), a.end()
#define endl "\n"
#define Yes() cout << "Yes" << endl
#define No() cout << "No" << endl
#define MP make_pair
using Graph = vector<vector<int>>;
const unsigned long long mod = 1e9 + 7;
const long long INF = 1LL<<60;
const int dx[4]={1,0,-1,0};
const int dy[4]={0,1,0,-1};
void chmin(long long &a, long long b) { if (a > b) a = b; }
void chmax(long long &a, long long b) { if (a < b) a = b; }

int main(void){
	ios::sync_with_stdio(0);
	cin.tie(0);
	int N;
	cin >> N;
	FOR(i,1,50001){
		if(i*27/25==N){
			cout << i << endl;
			return 0;
		}
	}

	cout << ":(" << endl;


	return 0;
}



Measured memory_bytes: 3648
import sys

stdin = sys.stdin

ns = lambda : stdin.readline().rstrip()
na = lambda : map(int, stdin.readline().split())
ni = lambda : int(ns())
def main():
  n = ni()
  if n == 1:
    print(1)
    return
  nagasa = lambda x: len(str(x))
  def f(a, b):
    x = nagasa(a)
    y = nagasa(b)
    return x if x > y else y

  def divi(n):
    res = []
    for i in range(1, int(n**0.5)+1):
      if n % i == 0:
        res.append(i)
        if i != n // i:
          res.append(n // i)
    return res
  x = divi(n)
  ans = 1e9
  for a in x:
    b = n // a
    ans = min(ans, f(a, b))
  print(ans)

main()

Measured memory_bytes: 3188
#include <bits/stdc++.h> // imports every library in c++
using namespace std; // ; is essential | says that you are USING the libraries

int X, A;

int main() {
    cin >> X;
    cin >> A;
    if (X < A) {
        cout <<  0;
    } else if (X >= A) {
        cout << 10;
    }
    return 0;
}

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

int main()
{
    int n, d;
    cin >> n >> d;
    vector<vector<int>> x(n, vector<int>(d));

    // n * d の二次元配列
    for (int i = 0; i < n; i++)
    {
        for (int j = 0; j < d; j++)
        {
            cin >> x.at(i).at(j);
        }
    }

    // 題意を満たす個数
    int ans = 0;
    // 0 <= i <= n -2
    for (int i = 0; i < n - 1; i++)
    {
        // i + 1 <= j <= n -1
        for (int j = i + 1; j < n; j++)
        {
            // 点の距離がノルム
            int norm = 0;
            // ノルムの計算
            for (int k = 0; k < d; k++)
            {
                int diff = abs(x.at(i).at(k) - x.at(j).at(k));
                norm += diff * diff;
            }

            // 整数判定
            bool flag = false;
            for (int k = 0; k * k <= norm; k++)
            {
                if (k * k == norm)
                    flag = true;
            }
            if (flag)
                ans++;
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <algorithm>
#include <map>
#include <cstdlib>
#include <cmath>
#define _GLIBCXX_DEBUG
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;
typedef long long ll;
const double pi=acos(-1);

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

int main(){
    string s;
    cin >> s;
    int price=700;
    for(int i=0;i<s.size();i++){
        if(s[i]=='o') price+=100;
    }
    cout << price << endl;
}


Measured memory_bytes: 3592
def listToString(_list, split=""):
    maped_list = map(str, _list)  # mapで要素すべてを文字列に
    mojiretu = split.join(maped_list)
    return mojiretu


def stringToList(_string, split=" "):
    str_list = []
    temp = ''
    for x in _string:
        if x == split:  # 区切り文字
            str_list.append(temp)
            temp = ''
        else:
            temp += x
    if temp != '':  # 最後に残った文字列を末尾要素としてリストに追加
        str_list.append(temp)
    return str_list


def asciiToindex(alphabet):
    return ord(alphabet) - ord("a")


s = input()
t = input()
# 　初期状態から、各操後の変換後テーブル
alpha = [i for i in range(asciiToindex("z") + 1)]
visited = [0 for i in range(asciiToindex("z") + 1)]

for i in range(len(s)):
    if alpha[asciiToindex(s[i])] != asciiToindex(t[i]):
        if visited[alpha[asciiToindex(s[i])]] == 1 or\
                        visited[asciiToindex(t[i])] == 1:
            print("No")
            exit()
        else:
            # tmp = 現在のs[i]の値
            tmp = alpha[asciiToindex(s[i])]
            for j in range(len(alpha)):
                if alpha[j] == tmp:
                    alpha[j] = asciiToindex(t[i])
                elif alpha[j] == asciiToindex(t[i]):
                    alpha[j] = tmp
    visited[asciiToindex(t[i])] = 1
    # print(listToString([chr(i+ord("a")) for i in alpha], "_"))
    # print("visited:{}".format(visited))
    # print(alpha)
print("Yes")


Measured memory_bytes: 3684
#include<bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define forn(i,a,b) for(int i =a;i<b;i++)
#define fi first
#define se second
#define fast ios_base::sync_with_stdio(false);
using namespace std;


typedef long long int ll;
typedef vector<int> vi;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;


void solve(){
	int n,k;
	cin >> n >> k;
	ll a[n];
	forn(i,0,n) cin >> a[i];
	sort(a,a+n);
	ll ans =0;
	forn(i,0,k)
	ans += a[i];

	cout << ans << endl;
}

int main(){
	fast;
	#ifndef ONLINE_JUDGE
		freopen("input.txt","r",stdin);
		freopen("output.txt","w",stdout);
	#endif

	// int t;cin >> t;while(t--)
		solve();
}


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

public class Main {
    public static void main(String[] args) throws Exception {

        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String line = br.readLine();
        //文字列に先頭又は最後に空白文字がくっ付いている場合、それらを全て取り除きます。
        line = line.trim();
        //半角スペースを区切り文字として扱う
        String[] readLineArray = line.split("[\\s+]");
        //変数に配列を代入
        int a = Integer.parseInt(readLineArray[0]);
        int b = Integer.parseInt(readLineArray[1]);
        System.out.println(a*b+" "+(a+b)*2);
    }
}

Measured memory_bytes: 16900
#include <algorithm>
#include <cstdio>
#include <functional>
#include <iostream>
#include <cfloat>
#include <climits>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <time.h>
#include <complex>
#include <vector>
#include<limits>
#include<iomanip>

using namespace std;

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

const long double pi = 3.141592653589793;

#define debug(x) cout << #x << " = " << (x) << endl;
#define rep(i, n) for(int i = 0;i < n;i++)
#define repi(i, j, n) for(int i = j;i < n;i++)
#define pb push_back
#define mp make_pair
#define mod 1000000007
#define F first
#define S second

// #define COMMENT

/*

const int NN = 200090;
ll fact[NN];
ll finv[NN];
ll inv[NN];

void inverse_modulao() {
  fact[0] = fact[1] = 1;
  finv[0] = finv[1] = 1;
  inv[1] = 1;

  for(int i = 2;i < NN;i++) {
    fact[i] = fact[i-1]*i%mod;
    inv[i] = mod-mod/i*inv[mod%i]%mod;
    finv[i] = finv[i-1]*inv[i]%mod;
  }
}

ll nCr(int n, int r) {
  return fact[n]*finv[r]%mod*finv[n-r]%mod;
}

*/

int N, A[1<<20];

int main() {

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

  cin >> N;
  rep(i, N) cin >> A[i];
  unordered_map<int,int> uma;
  uma[N-1-A[N-1]]++;
  ll ans = 0;
  for(int i = N-2;i >= 0;i--) {
    if(uma.find(i+A[i]) != uma.end()) {
      ans += uma[i+A[i]];
    }
    uma[i-A[i]]++;
  }
  cout<<ans;


  return 0;
}


Measured memory_bytes: 11812
import sys

input = sys.stdin.readline

n, m = map(int, input().split())
mod = 10 ** 9 + 7
broken_steps = [False for _ in range(n + 1)]

for _ in range(m):
    broken_steps[int(input())] = True

steps = [0 for _ in range(n + 1)]
steps[0] = 1

for now in range(n):
    next = now + 1
    if not broken_steps[next]:
        steps[next] = (steps[now] + steps[now - 1]) % mod

print(steps[n])


Measured memory_bytes: 7832
from collections import defaultdict
g = defaultdict(list)

n, m = map(int, input().split())
if m==0:
    print('Yes')
    exit()
for i in range(m):
    l, r, d = map(int, input().split())
    g[l].append((r, d))
    g[r].append((l, -1*d))
    
visited = {}
vv = {k:None for k in g.keys()}
def dfs(v):
    stack = []
    visited[v] = True
    stack.append((v,0))
    while len(stack)!=0:
        v,w = stack.pop()
        vv[v] = w
        for c,d in g[v]:
            if not visited.get(c, False):
                visited[c] = True
                stack.append((c,w+d))

for f in g.keys():
    if not visited.get(f):
        dfs(f)

for k in g.keys():
    v = vv[k]
    for c,w in g[k]:
        if not v + w == vv[c]:
            print('No')
            exit()

print('Yes')

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

//#pragma GCC optimize("O3")
//#pragma GCC target("sse4")

#define FOR(i, a, b) for(int i = (a); i < (b); ++i)
#define RFOR(i, b, a) for(int i = (b) - 1; i >= (a); --i)
#define ITER(it, a) for(__typeof(a.begin()) it = a.begin(); it != a.end(); it++)
#define FILL(a, value) memset(a, value, sizeof(a))

#define SZ(a) (int)((a).size())
#define ALL(a) a.begin(), a.end()
#define PB push_back
#define MP make_pair

typedef long long LL;
typedef vector<int> VI;
typedef pair<int, int> PII;

const double PI = acos(-1.0);
const int INF = 1000 * 1000 * 1000 + 7;
const LL LINF = (LL)INF * INF;

const int MAX = 100 * 1000 + 7;

struct Edge
{
	int y, u, v;
	bool operator<(const Edge& e) const
	{
		return y < e.y;
	}
} E[MAX];

int x[MAX];
int par[MAX];
int sz[MAX];
LL s[MAX];
int mxW[MAX];
int W[MAX];
vector<pair<PII, int> > g[MAX];
bool used[MAX];
PII order[MAX];
set<int> good;

int find(int v)
{
	return v == par[v] ? v : par[v] = find(par[v]);
}

void unite(int u, int v, int w)
{
	u = find(u);
	v = find(v);
	if(u != v)
	{
		if(sz[u] > sz[v])
			swap(u, v);
		par[u] = v;
		sz[v] += sz[u];
		s[v] += s[u];
	}
	mxW[v] = max(mxW[v], w);
	if(s[v] >= mxW[v])
		W[v] = mxW[v];
}

void dfs(int v, int p, int w)
{
	used[v] = true;
	FOR(i, 0, SZ(g[v]))
	{
		int to = g[v][i].first.first;
		if(g[v][i].first.second > w || to == p)
			continue;
		good.insert(g[v][i].second);
		if(!used[to])
			dfs(to, v, w);
	}
}

int main()
{
	ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	//freopen("In.txt", "r", stdin);
	int n, m;
	cin >> n >> m;
	FOR(i, 0, n)
		cin >> x[i];
	FOR(i, 0, m)
	{
		cin >> E[i].u >> E[i].v >> E[i].y;
		E[i].u--;
		E[i].v--;
		g[E[i].u].PB(MP(MP(E[i].v, E[i].y), i));
		g[E[i].v].PB(MP(MP(E[i].u, E[i].y), i));
	}
	sort(E, E + m);
	FOR(i, 0, n)
	{
		par[i] = i;
		sz[i] = 1;
		s[i] = x[i];
	}
	FOR(i, 0, m)
	{
		unite(E[i].u, E[i].v, E[i].y);
	}
	FOR(i, 0, n)
		order[i] = MP(W[i], i);
	sort(order, order + n);
	RFOR(i, n, 0)
	{
		int v = order[i].second;
		if(!used[v])
			dfs(v, -1, W[v]);
	}
	cout << m - SZ(good);
	return 0;
}

Measured memory_bytes: 24448
#include<algorithm>
#include<complex>
#include<ctype.h>
#include<iomanip>
#include<iostream>
#include<map>
#include<math.h>
#include<numeric>
#include<queue>
#include<set>
#include<stack>
#include<stdio.h>
#include<string>
#include<string>
#include<vector>

using namespace std;
typedef long long ll;

#define FOR(i,a,b) for(ll i=(a);i<(b);++i)
#define ALL(v) (v).begin(), (v).end()
#define p(s) cout<<(s)<<endl
#define p2(s, t) cout << (s) << " " << (t) << endl
#define br() p("")
#define pn(s) cout << (#s) << " " << (s) << endl
#define p_yes() p("YES")
#define p_no() p("NO")

template < typename T >
void vprint(T &V){
	for(auto v : V){
    	cout << v << " ";
	}
	cout << endl;
}

const ll mod = 1e9 + 7;
const ll inf = 1e18;

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

    // input
    ll N, A, B, C;
    cin >> N >> A >> B >> C;

    vector<ll> L(N);
    FOR(i, 0, N){
        cin >> L.at(i);
    }

    ll min_cost = inf;

    FOR(i, 0, 1<<2*N){
        vector<ll> S(4); // sum of A, B, C, D
        vector<ll> merge(4);

        FOR(j, 0, N){
            ll b0 = i >> 2*j & 3;
            S[b0] += L[j];
            merge[b0]++;
        }

        if(S[0]==0 || S[1]==0 || S[2]==0){
            continue;
        }

        merge[0]--;
        merge[1]--;
        merge[2]--;

        ll costA = 10 * merge[0] + abs(A - S[0]);
        ll costB = 10 * merge[1] + abs(B - S[1]);
        ll costC = 10 * merge[2] + abs(C - S[2]);
        ll cost = costA + costB + costC;

        min_cost = min(min_cost, cost);
    }

    p(min_cost);
    
    return 0;
}

Measured memory_bytes: 256
#include<algorithm>
#include<cmath>
#include<iomanip>
#include<iostream>
#include<map>
#include<numeric>
#include<queue>
#include<set>
#include<sstream>
#include<unordered_map>
#include<unordered_set>
#include<vector>
using uint = unsigned int;
using ll = long long;
enum : int { M = (int)1e9 + 7 };
enum : ll { MLL = (ll)1e18L + 9 };
using namespace std;
#ifdef LOCAL
#include"rprint2.hpp"
#include"debug_deque.hpp"
#define vector DebugDeque
#else
#define FUNC(name) template <ostream& out = cout, class... T> void name(T&&...){ }
FUNC(prints) FUNC(printe) FUNC(printw) FUNC(printew) FUNC(printb) FUNC(printd) FUNC(printde);
#endif

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int lim = 1e5;
    vector<char> prime(lim + 1, true);
    prime[0] = prime[1] = false;
    for(int i = 2; i <= lim; i++){
        if(prime[i]){
            for(int j = i + i; j <= lim; j += i){
                prime[j] = false;
            }
        }
    }
    vector<int> accs(lim + 1);
    for(int i = 1; i <= lim; i++){
        accs[i] = accs[i - 1] + (i & 1 && prime[i] && prime[(i + 1) / 2]);
    }
    int q; cin >> q;
    for(int i = 0; i < q; i++){
        int l, r;
        cin >> l >> r;
        cout << accs[r] - accs[l - 1] << '\n';
    }
}


Measured memory_bytes: 1152
#include<iostream>
#include<cmath>
#include<algorithm>
#include<iomanip>
#include<string>
#include<vector>
#include<cstdio>
#include<cstring>
#include<map>
#include<set>
#include<fstream>
#include<sstream>
#include<queue>
#include<iterator>
#include<stack>

using namespace std;

typedef long long ll;
typedef short int si;
typedef pair<int,int> pii;
typedef pair<ll,int> pli;
typedef vector<int> vi;
typedef vector<pii> vpii;
typedef vector<pli> vpli;

#define st first
#define nd second
#define FOR(i,a,b) for(int i=a;i<b;i++)
#define REV(a) reverse(a.begin(),a.end())
#define SORT(a) sort(a.begin(),a.end())
#define inf (int)1e9
#define linf (ll)1e18
#define mod (ll)1e9+7

int n;
pii ha[200000];
int v[200000];

int main() {
		ios_base::sync_with_stdio(false);
/*		cin>>n;
		FOR(i,0,n){
				int x,v;
				cin>>x>>v;
				ha[i]={x,v};
		}
		sort(ha,ha+n);
		FOR(i,0,n){
				v[i]=ha[i].second;
		}

*/
		ll n,a,b;
		cin>>n>>a>>b;
		if(n==1){
				if(a==b){
						cout<<1<<endl;
				}
				else {
						cout<<0<<endl;
				}
				return 0;
		}
		if(a>b){
				cout<<0<<endl;
				return 0;
		}
		cout<<(n-2)*(b-a)+1<<endl;


		return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
using namespace std;
int main(void){
  int n;
  cin >> n;
  
  vector<int>value(n,0);
  for(int i=0;i<n;i++){
    cin >> value[i];
  }
  
  vector<int>cost(n,0);
  for(int i=0;i<n;i++){
    cin >> cost[i];
  }
  
  vector<int>income(n,0);
  for(int i=0;i<n;i++){
    income[i] = value[i] - cost[i];
  }
  
  int ans = 0;
  
  for(int i=0;i<n;i++){
    if(income[i] > 0)
      ans += income[i];
  }
  
  cout << ans << endl;
  
  return 0;
}

    
  
  

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




typedef long long ll;
#define PI 3.14159265359
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define _GLIBCXX_DEBAC
/*map<Keyの型, Valueの型> 変数名;
queue<型> 変数名;
priority_queue<型> 変数名;
priority_queue<型, vector<型>, greater<型>> 変数名;*/
//copy(v1.begin(), v1.end(), back_inserter(v2));
using namespace std;

ll gcd(ll a, ll b) {
	ll c;
	if (a < b) {
		c = a; a = b; b = c;
	}
	while (b != 0) {
		c = a % b; a = b; b = c;
	}
	return a;
}

ll lcm(ll a, ll b) {
	ll c;
	c = a * b / gcd(a, b);
	return c;
}

int sort_greater(int m,int n) {
	vector<int> a(m);
	for (int i = 0; i < m; i++) {
		cin >> a[i];
	}
	sort(a.begin(), a.end(),greater<int>());
	for (int i = 0; i < n; i++) {
		cout << a[i];
	}
		return 0;
}

int bubblesort(int a[], int n) {
	int sw = 0;
	bool flag = 1;
	for (int i = 0; flag; i++) {
		flag = 0;
		for (int j = n - 1; j >= i + 1; j--) {
			if (a[j] < a[j - 1]) {
				swap(a[j], a[j - 1]);
				flag = 1;
				sw += 1;
			}
		}
	}
	return sw;
}

int a_z()
{
	for (int i = 0; i <= ('Z' - 'A'); i++) {
		cout << (char)('A' + i);
	}
	return 0;
}

int selecttionsort(int a[], int n) {
	int t,sw = 0, minj;
	for (int i = 0; i < n - 1; i++) {
		minj = i;
		for (int j = 0; j < n - 1; j++) {
			if (a[j] < a[minj]) {
				minj = j;
			}
		}
		t = a[i]; a[i] = a[minj]; a[minj] = t;
		if (i != minj) sw += 1;

	}
	return sw;
}

bool is_prime(int x) {
	if (x <= 1) return false;
	for (int i = 2; i * i <= x; i++) {
		if (x % i == 0) return false;
	}
	return true;
}

const ll mod = 1000000007;
struct mint {
	ll x;
	mint(ll x = 0):x(x%mod){}
	mint& operator+=(const mint a) {
		if ((x += a.x) >= mod) x -= mod;
		return *this;
	}
	mint& operator-=(const mint a) {
		if ((x += mod - a.x) >= mod) x -= mod;
		return *this;
	}
	mint& operator*=(const mint a) {
		(x *= a.x) %= mod;
		return *this;
	}
	mint operator+(const mint a) const {
		mint res(*this);
		return res += a;
	}
	mint operator-(const mint a) const {
		mint res(*this);
		res -= a;
	}
	mint operator*(const mint a)const {
		mint res(*this);
		return res *= a;
	}
};

map<string, int> memo;

using P=pair<int, int>;




/*void dfs(int v, int p = -1) {
	for (int u : to[v]) {
		if (u == p) continue;
		ans[u] += ans[v];
		dfs(u, v);
	}
}*/


int main() {
	ll n, m;
	cin >> n >> m;
	vector<ll> a(m);
	rep(i, m)cin >> a[i];
	ll sum = 0;
	rep(i, m) sum += a[i];
	if (n - sum >= 0) cout << n - sum;
	else cout << "-1";
	return 0;
}










Measured memory_bytes: 3632
N, M = map(int, input().split())
AS = list(map(int, input().split()))

import math

buckets = [[] for i in range(31)]
count = [0 for i in range(31)]
for num in AS:
    buckets[math.floor(math.log(num)/math.log(2))].append(num)
    
for lst in buckets: lst.sort(reverse=True)

hi = 30
while buckets[hi-1] == []: hi -= 1
found = 0
while True:
    try:
        if M > found:
            for i in range(hi, 31):
                count[i] += 1
            hi -= 1
            M -= found
            found += len(buckets[hi])
        else:
            total = 0
            for i in range(hi):
                total += sum(buckets[i])
                
            lst = []
            for i in range(hi, 30):
                for item in buckets[i]:
                    lst.append(item // pow(2, count[i]))
             
            lst.sort(reverse=True)
            
            for i in range(M):
                lst[i] //= 2

            total += sum(lst)

            print(total)
            break
    except:
        print(0)
        break


Measured memory_bytes: 65644
import java.util.*;
class Main{
    public static void main(String[] args){
        Scanner scanner = new Scanner(System.in);
        double d = scanner.nextDouble();
        double t = scanner.nextDouble();
        double s = scanner.nextDouble();
        if(d/s > t){
            System.out.println("No");
        }else{
            System.out.println("Yes");
        }
    }
}

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

using namespace std;

using ll = long long;

ll Luca(ll n) {
    if (n == 1) return 1;

    vector<ll> l(n + 1);
    l[0] = 2; l[1] = 1;
    for (int i = 2; i <= n; ++i)
        l[i] = l[i - 1] + l[i - 2];

    return l[n];
}

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

    int n;
    cin >> n;
    cout << Luca(n) << endl;

    return 0;
}


Measured memory_bytes: 256
N, A, B, K = [int(_) for _ in input().split()]

L = 300000+1
M = 998244353

Fm = {}
inverseFm = {}
x = 1
for i in range(L):
    Fm[i] = x
    x = x * (i + 1) % M

def inverseFm(x, cache={}):
    if x in cache:
        return cache[x]
    result = pow(Fm[x], M - 2, M)
    cache[x] = result
    return result

def C(n, r):
    result = Fm[n] * inverseFm(r) * inverseFm(n - r) % M
    return result

def solve(N, A, B, K):
    result = 0
    for a in range(0, N+1):
        b, m = divmod(K - A * a, B)
        if m == 0 and 0 <= b <= N:
            result += C(N, a) * C(N, b) % M
    return result % M

print(solve(N, A, B, K))


Measured memory_bytes: 70000
#include <iostream>
using namespace std;
int main(){
    long long int n,m,sum;
    cin >> n >> m;
    sum = 0;
    int s[n];
    long long int h[n];
    for(int i=0; i<n; i++){
        cin >> h[i];
        s[i] = 1;
    }
    for(int i=0; i<m; i++){
        long long int a,b;
        cin >> a >> b;
        if(h[a-1]==h[b-1]){
            s[a-1] = 0;
            s[b-1] = 0;
        }
        else if(h[a-1]>=h[b-1]){
            s[b-1] = 0;
        }
        else{
            s[a-1] = 0;
        }
    }
    for(int i=0; i<n; i++){
        if(s[i]==1){
            sum++;
        }
    }
    cout << sum;
}

Measured memory_bytes: 4332
#include<bits/stdc++.h>
#define ll long long
#define deb(x) cout << #x << " " << x << "\n";
using namespace std;

void solve(){
	ll k;
	cin >> k;
	string s;
	while(k--){
		s+= "ACL";
	}
	cout << s ;
}

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


Measured memory_bytes: 3648