akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <tuple>
#include <utility>
#include <set>
#include <numeric>
#include <queue>
using namespace std;
using LLI = long long int;

#define Rep(i, N) for (int i=0; i<N; i++)

int main(int argc, char *argv[])
{
    int N;
    LLI M;
    cin >> N >> M;

    vector<pair<int, int>>l(M);
    for (LLI i=0; i<M; i++) {
        int u, v;
        cin >> u >> v;
        l[i] = make_pair(u, v);
    }
    int S, T;
    cin >> S >> T;

    sort(l.begin(), l.end());


    // (pt, i % 3)
    set<pair<int, int>> s;
    s.insert(make_pair(S, 0));
    
    queue<pair<int, int>> q;
    q.push(make_pair(S, 0));

    bool found = false;
    while (!q.empty()) {
        auto p = q.front();
        q.pop();
        if (p.first == T && p.second % 3 == 0) {
            found = true;
            cout << p.second / 3 << endl;
        }

        auto it_l = lower_bound(l.cbegin(), l.cend(), make_pair(p.first, 0));
        auto it_u = lower_bound(l.cbegin(), l.cend(), make_pair(p.first+1, -1));

        for (auto it = it_l; it != it_u; it++) {
            auto newpair = make_pair(it->second, p.second + 1);
            if (s.count(make_pair(newpair.first, newpair.second%3)) == 0) {
                q.push(newpair);
                s.insert(make_pair(newpair.first, newpair.second%3));
            }
        }
    }

    if (!found) {
        cout << -1 << endl;
    }

    return 0;
}

Measured memory_bytes: 15104
k = int(input())
queue = [1,2,3,4,5,6,7,8,9]
cnt = 0
ans = 0
while(True):
    n = queue.pop(0)
    cnt+=1
    last = n%10
    if(0<=(last-1)):
        queue.append(10*n+(last-1))
    queue.append(10*n+last)
    if((last+1)<10):
        queue.append(10*n+last+1)

    if(k==cnt):
        ans = n
        break

print(ans)
    



Measured memory_bytes: 19408
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<cmath>
#include<stack>
#include<queue>
#include<deque>
#include<map>
#include<set>
using namespace std;
typedef long long ll;
typedef vector<int> VI;
#define FOR(i,a,n) for(int (i)=(a);(i)<(n);(i)++)
#define eFOR(i,a,n) for(int (i)=(a);(i)<=(n);(i)++)
#define SORT(i) sort((i).begin(),(i).end())
#define rSORT(i,a) sort((i).begin(),(i).end(),(a))
constexpr auto INF = 1000000000;
constexpr auto LLINF = 1LL << 60;
constexpr auto mod = 1000000007;
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; }

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

    string s;
    cin >> s;
    ll ans = 0;

    int f = 0;
    string e = "";
    FOR(i, 0, s.length()) {
        if (e != s.substr(f, i - f + 1)) {
            ans++;
            e = s.substr(f, i - f + 1);
            f = i + 1;
        }
    }
    cout << ans << "\n";
}

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

/*starry sky tree 
  add(O(logN)):区間[a, b)に値xを加算する
  getMin(O(logN)): 区間の最小値を得る
*/
static const int MAX_SIZE = 1 << 17;
typedef long long ll;
ll segMin[2 * MAX_SIZE - 1], segAdd[2 * MAX_SIZE - 1];

void add(int a, int b, int x, int k = 0, int l = 0, int r = MAX_SIZE){
  if (r <= a || b <= l) return; //もし交差しない区間であれば終える.
  
  if (a <= l && r <= b){ //もし今みている区間[l, r)が[a, b)に完全に内包されていれば
    segAdd[k] += x;  //区間[l, r)にkを加算する.
    return;
  }
	
  //子の区間に(必要があれば)xを加算する.
  add(a, b, x, k * 2 + 1, l, (l + r) / 2); 
  add(a, b, x, k * 2 + 2, (l + r) / 2, r); 

  //親の区間の最小値は, 子の区間の最小値 + 自分に一様に加算されている値 である.一様に加算される値は更新しなくて良い.
  segMin[k] = min(segMin[k * 2 + 1] + segAdd[k * 2 + 1], segMin[k * 2 + 2] + segAdd[k * 2 + 2]);
}

ll getMin(int a, int b, int k = 0, int l = 0, int r = MAX_SIZE){
  if (r <= a || b <= l) return (LLONG_MAX);
  if (a <= l && r <= b) return (segMin[k] + segAdd[k]); //完全に内包されていれば,その区間の最小値を返す.
	
  ll left = getMin(a, b, k * 2 + 1, l, (l + r) / 2); //子の区間の最小値を求める.
  ll right = getMin(a, b, k * 2 + 2, (l + r) / 2, r); //子の区間の最小値を求める

  //親の区間の最小値は, 子の区間の最小値 + 自分に一様に加算されている値 である (大切なので2回書きました!!)
  return (min(left, right) + segAdd[k]); 
	
}

int main(){
  
  int n, q;
  cin>>n>>q;
  
  while(q--){
    
    int a, s, t, x;
    cin>>a>>s>>t;
    
    if(a==0){
      
      cin>>x;
      add(s, t+1, x);
    }
    else{
      
      cout<<getMin(s, t+1)<<endl;
      
    }
  }
  
  return 0;
}



Measured memory_bytes: 5488
#include <bits/stdc++.h>
using namespace std;
vector<vector<int>> graph;
vector<int> segment,lin,l,r;
int cnt = 0;

void dfs(int curr , int par){
	lin.push_back(curr);
	l[curr] = cnt;
	cnt += 1;
	for(int i : graph[curr]){
		if(i != par){
			dfs(i,curr);
		}
	}
	r[curr] = cnt-1;
}

void upd(int a , int b , int val , int curr , int ll , int rr){
	if(b < ll || a > rr){
		return ;
	}
	if(a <= ll && b >= rr){
		segment[curr] += val;
		return ;
	}
	int m = (ll+rr)/2;
	upd(a,b,val,2*curr,ll,m);
	upd(a,b,val,2*curr+1,m+1,rr);
}

int main(){
	int n,q,a,b;
	cin >> n >> q;
	int t = pow(2,ceil(log2(n)));
	segment.resize(2*t,0);
	graph.resize(n+1);
	l.resize(n+1);
	r.resize(n+1);
	for(int i = 0 ; i < n-1 ; i += 1){
		cin >> a >> b;
		graph[a].push_back(b);
		graph[b].push_back(a);
	}
	dfs(1,-1);
	int sum = 0;
	for(int i = 0 ; i < q ; i += 1){
		cin >> a >> b;
		if(a == 1){
			sum += b;
		}
		upd(l[a],r[a],b,1,1,t);
	}
	vector<int> ans(n+1);
	for(int i = 1 ; i <= n ; i += 1){
		int curr = t+i-1,sum=0;
		while(curr > 0){
			sum += segment[curr];
			curr /= 2;
		}
		ans[lin[i]] = sum;
	}
	cout << sum << " ";
	for(int i = 2 ; i <= n ; i += 1){
		cout << ans[i] << " ";
	}cout << endl;
}

Measured memory_bytes: 28024
n, k = map(int, input().split())
a_array = [int(x) for x in input().split()]
INF = 10**9+7

cnt_array = [0 for x in range(2000+1)]
a_array2 = []
ans = 0
for a in a_array:
    cnt_array[a] += 1
    a_array2.append(sum(cnt_array[a+1:]))
a_array3 = []
for i in a_array:
    tmp = 0
    for j in a_array[::-1]:
        if j > i:
            tmp += 1
    a_array3.append(tmp)
for cnt, d in zip(a_array2, a_array3):
    ans += (k*(2*cnt+(k-1)*d))//2
    ans = ans % INF
print(ans)


Measured memory_bytes: 3188
suuretsu=[1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
K=int(input())
print(suuretsu[K-1])


Measured memory_bytes: 2940
#include <iostream>
#include <fstream>
#include <vector>
#include <algorithm>
using namespace std;

void print2d(vector<string> M){
    cout << endl;
    for(string s: M){
        cout << s << endl;
    }
}

// 隣接リストで使う辺を表す型
struct Edge {
    int to, cost;  // 辺の接続先頂点, 辺の重み
    Edge(int to, int cost) : to(to), cost(cost) {}  // コンストラクタ
};

typedef vector<vector<Edge> > AdjList;  // 隣接リストの型
AdjList graph;  // グラフの辺を格納した構造体
// graph[v][i]は頂点vから出るi番目の辺Edge

const long INF = numeric_limits<long>::max();

vector<long> dist;

// 戻り値がtrueなら負の閉路を含む
bool bellman_ford(int n, int s) { // nは頂点数、sは開始頂点
    for (int i = 0; i < n; i++) {
        for (int v = 0; v < n; v++) {
            for (int k = 0; k < graph[v].size(); k++) {
                Edge e = graph[v][k];
                if (dist[v] != INF && dist[e.to] > dist[v] + e.cost) {
                    dist[e.to] = dist[v] + e.cost;
                    if (i == n - 1) return true; // n回目にも更新があるなら負の閉路が存在
                }
            }
        }
    }
    return false;
}

int main(int argc, const char * argv[]) {
    
    int n, m;
    cin >> n >> m;
    
    dist = vector<long>(n, INF);
    dist[0] = 0; // 開始点の距離は0
    
    graph = AdjList(n);
    
    for (int i = 0; i < m; i++) {
        int from, to, cost;
        cin >> from >> to >> cost;
        
        from -= 1;
        to -= 1;
        cost *= -1;
        
        graph[from].push_back(Edge(to, cost));
    }
    
    bool result = bellman_ford(n, 0);
    
    if(result == true){
        long old = dist[n-1];
        bellman_ford(n, 0);
        if(old == dist[n-1]){
            cout << -dist[n-1] << endl;
        }else{
            cout << "inf" << endl;
        }
    }else{
        cout << -dist[n-1] << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include  <iostream>
#include  <stdio.h>
#include <algorithm>
#include <map>
#include <math.h>

using namespace std;
#include <vector>
#define rep(i,n) for (ll i = 0; i < (n) ; i++)
#define INF 1e9
#define llINF 1e18
#define base10_4 10000      //1e4
#define base10_5 100000     //1e5
#define base10_6 1000000    //1e6
#define base10_7 10000000   //1e7
#define base10_8 100000000  //1e8
#define base10_9 1000000000 //1e9

#define MOD 1000000007
#define pb push_back
#define ll long long
#define ull unsigned long long
#define vint vector<int>
#define vll vector<ll>

//#include <stack>
//#include <queue>

// #include <iomanip>
//  cout << fixed << setprecision(15) << y << endl;

string ans_Yes = "Yes"; 
string ans_No = "No"; 
string ans_yes = "yes"; 
string ans_no = "no"; 

ll A;
ll B;
ll C;
ll N;
ll M;
ll K;

ll ltmp;
string stmp;
double dtmp;


/*
max 448,000,000
map<string,ll> count_map;
count_map['0']=0;
for(auto x : count_map) {
    string key = x.first;
    ll value = x.second;
}
*/
int main(){

    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);

    map<string,ll> count_map;


    cin >> N;
    string S;
    rep(ni,N){
        cin >> S;
        count_map[S]++;
    }
    string ans = "AC";
    cout << ans << " x " << count_map[ans] << endl;
    ans = "WA";
    cout << ans << " x " << count_map[ans] << endl;
    ans = "TLE";
    cout << ans << " x " << count_map[ans] << endl;
    ans = "RE";
    cout << ans << " x " << count_map[ans] << endl;

    

    

}

Measured memory_bytes: 3664
#include<stdio.h>
int main()
{
	int n,x,i,m;
	int l[1000],d[1000];
	while(~scanf("%d%d",&n,&x))
	{
		m=0;
		for(i=1;i<=n;i++)
		scanf("%d",&l[i]);
		for(i=1;i<=n;i++)
		{
			d[0]=0;
			d[i]=d[i-1]+l[i];
		}
		for(i=0;i<=n;i++)
		{
			if(d[i]<=x)
			m++;
		}
		printf("%d\n",m);
	}
	return 0;
}//

Measured memory_bytes: 256
X,K,D = map(int, input().split())

X = abs(X)
ans = 0
if K*D < X:
  ans = X - K*D
else:
  if (K - X // D) % 2 == 0:
    ans = X % D
  else:
    ans = abs(X % D - D)
print(ans)

Measured memory_bytes: 61856
#include <iostream>
using namespace std;
 
int main()
{
    int n;
    int array[101];
    cin >> n;
    for(int i = 0; i < n; ++i){
        cin >> array[i];
        if(i != 0) cout <<' ';
        cout << array[i];
    }
    cout << endl;
    
    for(int i = 1; i < n; ++i){
        int key = array[i];
        int j = i - 1;
        while(j >= 0 && array[j] > key){
            array[j + 1] = array[j];
            --j;
        }
        array[j + 1] = key;
        for(int j = 0; j < n; ++j){
            if(j != 0) cout << ' ';
            cout << array[j];
        }
        cout << endl;   
    }
}

Measured memory_bytes: 1160
// --------------------<optimizations>--------------------
#pragma GCC optimize("O3")
//(UNCOMMENT WHEN HAVING LOTS OF RECURSIONS)\
#pragma comment(linker, "/stack:200000000")
//(UNCOMMENT WHEN TRYING TO BRUTEFORCE WITH A LOT OF LOOPS)\
#pragma GCC optimize("unroll-loops")
#include<bits/stdc++.h>

using namespace std;

#define ll long long
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define pii pair<ll,ll>
#define vpii vector<pair<ll,ll> >
#define F first
#define S second
#define ld long double
#define built __builtin_popcountll
#define mst(a,i) memset(a,i,sizeof(a))
#define all(x) x.begin(),x.end()
#define itit(it,a) for(auto it=(a).begin(); it!=(a).end(); it++)
#define rep(i,a,b) for(ll i=a; i<b; i++)
#define repr(i,a,b) for(ll i=a; i>b; i--)
#define reprr(i,a,b) for(ll i=a; i>=b; i--)
#define pi 3.14159265358979323846264338327950288419716939937510582097494459230
ll max3(ll x,ll y,ll z) {return max(max(x,y),z);}
ll min3(ll x,ll y,ll z) {return min(min(x,y),z);}
const ll M=2e5+10,M2=1e6+10,mod=1e9+7,inf=1e17+10;
void add(int& a, int b) {a+=b;if(a>=mod){a-=mod;}}
#define trace1(x)			 	 cerr<<#x<<": "<<x<<endl
#define trace2(x, y)		 	 cerr<<#x<<": "<<x<<" | "<<#y<<": "<<y<<endl
#define trace3(x, y, z)		 	 cerr<<#x<<":" <<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl
#define trace4(a, b, c, d)	 	 cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<endl
#define trace5(a, b, c, d, e)	 cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<endl
#define trace6(a, b, c, d, e, f) cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<" | "<<#f<<": "<<f<<endl
int X[] = {0, 1, 0, -1};
int Y[] = {-1, 0, 1, 0};
ll power(ll x,ll n){ll result=1;while(n>0){if(n%2==1)result=(result*x)%mod; x=((x%mod)*(x%mod))%mod;n=n/2;}return result;}


int main()
{
	ios::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	ll n,m;
	cin >> n >> m;
	ll maxl=0,minr=inf;
	rep(i,0,m){
		ll l,r;
		cin >> l >> r;
		maxl=max(maxl,l);
		minr=min(minr,r);
	}
	cout << max(min(n,minr) - maxl + 1, 0ll);
	return 0;
}
/* The judge is never wrong! Your code is buggy
   Look for:
 * * Read the problem carefully.
 * * Don't forget to sort(), mod, ll!!!!
 * * Initial value = +/- infinity instead of zero!!!
 * * an easier and alternate approach
 * * read the problem statement carefully
 * * if concept is correct and still WA, try with a different implementation
 * * special cases (n=1?)
 * * if you have no idea just guess the appropriate well-known algorithm instead of doing nothing :/
 */


Measured memory_bytes: 256
a = list(input())
b = list(input())
c = list(input())


def solve(a,b,c,value):
    if len(a)==0 and value == "a":
        return print("A")
    elif len(b)==0 and value == "b":
        return print("B")
    elif len(c)==0 and value == "c":
        return print("C")
    else:
        if value == "a":
            return solve(a,b,c,a.pop(0))
        if value == "b":
            return solve(a,b,c,b.pop(0))
        if value == "c":
            return solve(a,b,c,c.pop(0))

solve(a,b,c,a.pop(0))

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

using namespace std;

using int64 = long long;

constexpr int64 P = 1000000007;

// Verified: ABC133E
struct FiniteField {
 private:
  int64 x;
 public:
  FiniteField(int64 input_x) : x(input_x) {}
  FiniteField() : x(0) {}
  int64 value() { return x; }
  inline FiniteField operator+(FiniteField o) {
    FiniteField r(*this); r += o; return r;
  }
  inline FiniteField operator* (FiniteField o) {
    FiniteField r(*this); r *= o; return r;
  }
  inline FiniteField operator/ (FiniteField o) {
    FiniteField r(*this); r /= o; return r;
  }
  inline void operator+= (FiniteField o) { x = (x + o.x) % P; }
  inline void operator*= (FiniteField o) { x = (x * o.x) % P; }
  void operator/=(FiniteField o) {
    int64 p = P - 2; while (p) { if (p % 2) { *this *= o; } o *= o; p /= 2; }
  }
};

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

  int n, k;
  cin >> n >> k;
  // cout << "k: " << k << endl;
  vector<FiniteField> factorials(2 * n + 1);
  factorials[0] = 1;
  for (int i = 1; i <= 2 * n; i++) {
    factorials[i] = factorials[i - 1] * i;
  }
  auto c = [&](int n, int k) {
    return factorials[n] / factorials[k] / factorials[n - k];
  };

  for (int i = 1; i <= k; i++) {
    if (n - k < i - 1) {
      cout << 0 << endl;
    } else {
      auto p1 = c(k - 1, i - 1);
      auto p2 = c(n - k + 1, i);
      auto ans = p1 * p2;
      cout << ans.value() << endl;
    }
  }
}

Measured memory_bytes: 256
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Scanner;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        SemiCommonMultiple solver = new SemiCommonMultiple();
        solver.solve(1, in, out);
        out.close();
    }

    static class SemiCommonMultiple {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            int n = in.nextInt();
            long m = in.nextLong();

            long x = 1;
            long div_num = -1;
            for (int i = 0; i < n; i++) {
                long a = Long.parseLong(in.next()) / 2;
                x = lcm(x, a);

                if (m < x) {
                    out.print(0);
                    return;
                }

                long dnum = 0;
                while (true) {
                    if (a % 2 == 0) {
                        dnum++;
                        a /= 2;
                    } else {
                        break;
                    }
                }
                if (div_num == -1) {
                    div_num = dnum;
                } else {
                    if (div_num != dnum) {
                        out.print(0);
                        return;
                    }
                }
            }

            long p = 0;
            while (1 <= x * (2 * p + 1) && x * (2 * p + 1) <= m) {
                p++;
            }
            out.print(p);
        }

        static long lcm(long a, long b) {
            return a * b / gcd(a, b);
        }

        static long gcd(long a, long b) {
            return b == 0 ? a : gcd(b, a % b);
        }

    }
}



Measured memory_bytes: 58464
N, K = map(int, input().split())
count = 0

for i in range(K + 1, N + 1):
    count += ((N + 1) // i) * (i - K) + max(0, (N + 1) % i - K)

if K == 0:
    count -= len(range(K + 1, N + 1))

print (count)

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

int main()
{
  int n;
  cin >> n;
  vector<int> vec(n);
  for (int i = 0; i < n; i++)
  {
    cin >> vec.at(i);
  }

  sort(vec.begin(), vec.end());

  int half = n / 2;
  int half_left = vec.at(half - 1);
  int half_right = vec.at(half);

  cout << half_right - half_left << endl;
}


Measured memory_bytes: 640
import scala.io.StdIn

object Main {

  def divisors(n: Int): Vector[Int] = {
    def rec(i: Int, acc: Vector[Int]): Vector[Int] = {
      if (i * i > n) acc
      else if (i * i == n) acc :+ i
      else if (n % i == 0) rec(i + 1, acc :+ i :+ (n / i))
      else rec(i + 1, acc)
    }
    rec(1, Vector.empty[Int])
  }

  def switch(as: Vector[Int], n: Int): Vector[Int] = {
    divisors(n).foldLeft(as)((acc, d) => acc.updated(d, 1 - acc(d)))
  }

  def solve(as: Vector[Int], n: Int, acc: Vector[Int]): Vector[Int] = {
     if (n == 0) acc
     else {
       if (as(n) == 0) {
         solve(as, n - 1, acc) 
       } else {
         solve(switch(as, n), n - 1, acc :+ n)
       }
     }
  }

  def main(args: Array[String]): Unit = {
     val n = StdIn.readInt()
     val as = 0 +: StdIn.readLine().split(' ').map(_.toInt).toVector
     val bs = solve(as, n, Vector.empty[Int])
     val m = bs.size
     println(m)
     println(bs.mkString(sep = " "))
  }

}

Measured memory_bytes: 126284
import java.util.*

fun main(args : Array<String>) {

    val sc = Scanner(System.`in`)
    val n = sc.nextLong()
    val walk = sc.nextLong()
    val teleport = sc.nextLong()
    val xList = mutableListOf<Long>()
    for (i in 1..n) {
        xList.add(sc.nextLong())
    }

    var currentPosition = if (xList.size != 0) xList[0] else 0
    var totalDamage = 0L
    xList.forEach { nextTown ->
        val distance = nextTown - currentPosition
        val walkDamage = distance * walk
        totalDamage += Math.min(walkDamage, teleport)
        currentPosition = nextTown
    }

    println(totalDamage)
}

Measured memory_bytes: 55416
#include <bits/stdc++.h>
using namespace std;
typedef int64_t ll;

int main(){
  int a,b,c,k;
  cin>>a>>b>>c>>k;
  for(int i=0;i<k;i++){
    if(a>=b) b*=2;
    else if(b>=c) c*=2;
  }
  cout<<(a<b && b<c ? "Yes" : "No")<<endl;
}


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

int_fast32_t N, M, Q, dp[505][505], l, r;

int main(){
    scanf("%d%d%d", &N, &M, &Q);
    
    for(uint_fast32_t i = 0; i < M; ++i){
        scanf("%d%d", &l, &r);
        ++dp[1][r];
        --dp[l + 1][r];
    }
    
    for(uint_fast32_t i = 1; i <= N; ++i)
        for(uint_fast32_t j = 0; j <= N; ++j)
            dp[i][j] += dp[i - 1][j];
    
    for(uint_fast32_t i = 0; i <= N; ++i)
        partial_sum(dp[i], dp[i + 1], dp[i]);
    
    for(uint_fast32_t i = 0; i < Q; ++i && printf("%d\n", dp[l][r]))
        scanf("%d%d", &l, &r);
    
    return 0;
}


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

#define ll long long
#define ld long double
#define pi 3.14159265359

int main() {
    ll N; cin >> N;
    string S; cin >> S;
    ll r = 0, g = 0, b = 0;
    for (ll i = 0; i < S.size(); i++) {
        if (S.at(i) == 'R') {
            r++;
        }
        else if (S.at(i) == 'G') {
            g++;
        }
        else {
            b++;
        }
    }
    ll sum = r * g * b;
    ll cnt = 0;
    for (ll i = 0; i < N - 2; i++) {
        for (ll j = i + 1; j < N - 1; j++) {
            if (S.at(i) != S.at(j)) {
                ll k = 2 * j - i;
                if (k <= N - 1) {
                    if (S.at(k) != S.at(i) && S.at(k) != S.at(j)) {
                        cnt++;
                    }
                }
            }
        }
    }
    ll ans = sum - cnt;
    cout << ans << endl;
}

Measured memory_bytes: 3612
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.IOException;

public class Main {

    public static void main(String args[]) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out));
        String input;
        while ((input = br.readLine()) != null) {
            for (char c : input.toCharArray()) {
                if (c >= 'A' && c <= 'Z') {
                    bw.append((char) (c + 32));
                } else if (c >= 'a' && c <= 'z') {
                    bw.append((char) (c - 32));
                } else {
                    bw.append(c);
                }
            }
            bw.newLine();
        }
        bw.flush();
    }

}


Measured memory_bytes: 24468
#include <stdio.h>

using namespace std;
typedef long long llong;

#define MAX 4
const llong mod = 1000000000 + 7;

int main()
{
  char S[MAX];
  char Ans[2][MAX] = {"ABC", "ARC"};
  int ans;

  scanf("%s", S);

  ans = S[1] == 'B' ? 1 : 0;

  printf("%s", Ans[ans]);

  return 0;
}

Measured memory_bytes: 1736
#include <cstdio>
int a[4],b[4];main(){int i,j,h,l;for(;~scanf("%d%d%d%d%d%d%d%d",a,a+1,a+2,a+3,b,b+1,b+2,b+3);printf("%d %d\n",h,l))for(i=h=l=0;i<4;i++)for(j=0;j<4;j++)if(a[i]==b[j])i==j?h++:l++;}

Measured memory_bytes: 1024
#include <iostream>
#include <iomanip>
#include <vector>
#include <string>
#include <algorithm>
#include <cmath>
#include <stack>
#include <queue>
#include <functional>
#include <limits.h>
#include <set>
#include <map>
#include <tuple>
using namespace std;

#define ll long long
#define ull unsigned long long
#define rep(i,N) for (int i=0;i<N;i++)
#define loop(i,N,M) for(int i=N;i<M;i++)
#define MAX(v) *max_element(v.begin(),v.end())
#define MIN(v) *min_element(v.begin(),v.end())
#define SORTL2S(type,v) sort(v.begin(),v.end(),greater<type>())
#define SORTS2L(type,v) sort(v.begin(),v.end())
#define SORTMF(v,func) sort(v.begin(),v.end(),func)

//変数
ll N, K;
vector<ll> vec;

//解法
void solve() {
	
	//入力
	cin >> N >> K;

	N = N / 2 + N % 2;
	if (N >= K) {
		cout << "YES";
	}
	else {
		cout << "NO";
	}


	return;
}

int main() {

	solve();
	cout << endl;
	return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<vector>
using namespace std;
typedef pair<int, int> P;
static const int MAX_N = 500000;
static const int INF = 1e9;

bool compare_y(P a, P b){
  return a.second < b.second;
}

int closest_pair(P *a, int n){
  if(n <= 1) return INF;
  int m = n / 2;
  int x = a[m].first;
  int d = min(closest_pair(a, m), closest_pair(a + m, n - m));
  inplace_merge(a, a + m, a + n, compare_y);

  vector<P> b;
  for(int i = 0; i < n; i++){
    if((a[i].first - x) * (a[i].first - x) >= d) continue;
    for(int j = 0; j < b.size(); j++){
      int dx = a[i].first - b[b.size() - j - 1].first;
      int dy = a[i].second - b[b.size() - j - 1].second;
      if(dy * dy >= d) break;
      d = min(d, dx * dx + dy * dy);
    }
    b.push_back(a[i]);
  }
  return d;
}

int main(){
  int n;
  P A[MAX_N];
  cin >> n;
  for(int i = 0; i < n; i++){
    cin >> A[i].first >> A[i].second;
  }
  sort(A, A + n);
  cout << closest_pair(A, n) << endl;
  return 0;
}



Measured memory_bytes: 12436
#include <iostream>
#include <algorithm>
#include <utility>
#include <vector>
#include <string>

using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
#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 RFOR(i, a, b) for (int i = (a); i > (b); i--)
#define ALL(a) (a).begin(), (a).end()

int main() {
    int N;
    cin >> N;
    cout << N / 3 << endl;
    return 0;
}

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

int main(void) {
  int T;
  scanf("%d", &T);
  while(T--) {
    long long A, B, C, D;
    scanf("%lld%lld%lld%lld", &A, &B, &C, &D);
    if(A < B || D < B) puts("No");
    else if((A - C - 1) / __gcd(B, D) - (A - B) / __gcd(B, D) > 0) puts("No");
    else puts("Yes");
  }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
long long a[100];

int main(){
	int n;
	scanf("%d",&n);
	a[0]=2; a[1]=1;
	for(int i=2;i<=n;i++){
		a[i]=a[i-1]+a[i-2];
	}
	printf("%lld",a[n]);
}


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


#define li          long long int
#define rep(i,to)   for(li i=0;i<((li)(to));i++)
#define repp(i,start,to)    for(li i=(li)(start);i<((li)(to));i++)
#define pb          push_back
#define sz(v)       ((li)(v).size())
#define bgn(v)      ((v).begin())
#define eend(v)     ((v).end())
#define allof(v)    (v).begin(), (v).end()
#define dodp(v,n)       memset(v,(li)n,sizeof(v))
#define bit(n)      (1ll<<(li)(n))
#define mp(a,b)     make_pair(a,b)
#define rin rep(i,n)
#define EPS 1e-12
#define ETOL 1e-8
#define MOD 1000000007
typedef pair<li, li> PI;

#define INF bit(60)

#define DBGP 1


#define idp if(DBGP)
#define F first
#define S second
#define p2(a,b)     idp cout<<a<<"\t"<<b<<endl
#define p3(a,b,c)       idp cout<<a<<"\t"<<b<<"\t"<<c<<endl
#define p4(a,b,c,d)     idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<endl
#define p5(a,b,c,d,e)       idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<endl
#define p6(a,b,c,d,e,f)     idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<endl
#define p7(a,b,c,d,e,f,g)       idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<"\t"<<g<<endl
#define p8(a,b,c,d,e,f,g,h)     idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<"\t"<<g<<"\t"<<h<<endl
#define p9(a,b,c,d,e,f,g,h,i)       idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<"\t"<<g<<"\t"<<h<<"\t"<<i<<endl
#define p10(a,b,c,d,e,f,g,h,i,j)        idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<"\t"<<g<<"\t"<<h<<"\t"<<i<<"\t"<<j<<endl
#define foreach(it,v)   for(__typeof((v).begin()) it=(v).begin(); it!=(v).end(); ++it)
#define p2p(x)      idp p2((x).F, (x).S)
#define dump(x,n)   idp{rep(i,n){cout<<x[i]<<" ";}puts("");}
#define dump2(x,n)  idp{rep(i,n){cout<<"["<<x[i].F<<" , "<<x[i].S<<"] ";}puts("");}
#define dumpi(x)    idp{foreach(it, x){cout<<(*it)<<" ";}puts("");}
#define dumpi2(x)   idp{foreach(it, x){cout<<"["<<(it)->F<<" , "<<(it)->S<<"] ";}puts("");}

#define read2d(a,w,h)   rep(i,h)rep(j,w)cin>>a[i][j]
#define dump2d(a,w,h)   rep(i,h){rep(j,w)cout<<a[i][j]<<" ";puts("");}

typedef pair<li, li> PI;

li p[100100];
li q[100100];
li sump[100100];
li sumq[100100];

int main() {
    li w, h;
    cin >> w >> h;
    rep(i, w)cin >> p[i];
    rep(i, h)cin >> q[i];
    sort(p, p + w);
    sort(q, q + h);
    sump[0] = 0;
    sumq[0] = 0;
    rep(i, w) {
        sump[i + 1] = sump[i] + p[i];
    }
    rep(i, h) {
        sumq[i + 1] = sumq[i] + q[i];
    }

    li pi = 0, qi = 0;
    li ww = w + 1, hh = h + 1;
    li res = 0;
    while (pi + qi < w + h) {
        // どっち取るか選択
        bool pp;
        if (pi >= w)pp = false;
        else if (qi >= h)pp = true;
        else pp = (p[pi] <= q[qi]);
        if (pp) {
            res += p[pi] * hh;
            ww--;
            ++pi;
        } else {
            res += q[qi] * ww;
            hh--;
            ++qi;
        }
    }
    cout << res << endl;


    return 0;
}

Measured memory_bytes: 3328
#include <iostream>
#include <string>
#include <set>

using namespace std;

typedef long long ll;

int main() {
    string s;   cin >> s;
    ll ans = 1;

    int i = 1;
    string t;
    t = s[0];

    while (i < s.length()) {
        string v;
        while (1) {
            v.push_back(s[i]);
            i++;
            if (i >= s.length() || t != v) 
                break;
        }
        
        ans ++;
        if (v == t)
            ans--;
        t = v;
    }

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

Measured memory_bytes: 640
def checkdigit arr
    q = [2, 3, 4, 5, 6, 7, 2, 3, 4, 5, 6].reverse
    sum = 0
    arr.zip(q){|x, y| sum += x.to_i * y}
    mn = 11 - (sum % 11)
    mn = 0 if mn >= 10
    mn
end

s = gets.chomp.split("")
idx = s.index("?")
if idx == 11
    mn = checkdigit(s[0, 11])
    puts mn
else
    possible = []
    (0..9).to_a.each{|i|
        s[idx] = i
        mn = checkdigit(s[0, 11])
        possible << i if mn == s[11].to_i
    }
    puts (possible.length == 1 ? possible[0] : "MULTIPLE")
end


Measured memory_bytes: 8896
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
string ALP = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
string alp = "abcdefghijklmnopqrstuvwxyz";
void Yes() {cout << "Yes" << endl;}
void No() {cout << "No" << endl;}
void YES() {cout << "YES" << endl;}
void NO() {cout << "NO" << endl;}
void neg() {cout << -1 << endl;}

int main() {
  int n;
  cin >> n;
  int x = 0, a = 0, b = 0;
  while (7 * b <= n) {
    if ((n - 7 * b) % 4 == 0) {
      Yes();
      return 0;
    }
    b++;
  }
  No();
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int m,n,k;
	cin>>m>>n>>k;
	vector<string> s(m);
	for(int i=0;i<m;i++)
	cin>>s[i];
	int ans=0;
	for(int i=0;i<(1<<m);i++)
	for(int j=0;j<(1<<n);j++)
	{
		int c=0;
		for(int o=0;o<m;o++)
		for(int p=0;p<n;p++){
			if (i>>o&1) continue;
			if (j>>p&1) continue;
			if (s[o][p]=='#') c++;
		}
		if(c==k)
		ans++;
	}
	cout<<ans<<endl;
} 


Measured memory_bytes: 3608
#include <iostream>
#include <string>
#include <vector>
#include <math.h>
#include <algorithm>
#include <cmath>
#include <ios>
#include <ctype.h>
#include <stack>
#include <istream>
#include <stdio.h>
#include <map>
#include <set>
#include <queue>
#include <unordered_map>
#include <functional>
#include <bitset>
#include <list>
#include <deque>
#include <time.h>
#include <random>
#include <iomanip>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define REP(i,a,b) for (int i = a; i < (b); ++i)
#define all(x) (x).begin(),(x).end()
#define pint pair<int,int>
const int INF = 1000000007;
const long double EPS = 1e-15;
const long double PI = acos(-1);
typedef long long ll;
using namespace std;
using Graph = vector<vector<int>>;
using Graph_weighted = vector<vector<pair<int,int>>>;
ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }
ll lcm(ll a, ll b) { return (a * b) / gcd(a,b); }
ll ceil(const ll a, const ll b) { return (a + b - 1) / b; }
map< int64_t, ll > prime_factor(int64_t n) {
  map< int64_t, ll > ret;
  for(int64_t i = 2; i * i <= n; i++) {
    while(n % i == 0) {
      ret[i]++;
      n /= i;
    }
  }
  if(n != 1) ret[n] = 1;
  return ret;
}
int main(){
  ll n,p;
  cin >> n >> p;
  ll ans = 1;
  const auto &res = prime_factor(p);
  for(auto i : res){
    ans *= pow(i.first,i.second / n);
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#define repi(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,a) repi(i,0,a)
#define all(a) (a).begin(), (a).end()

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

std::string S;

int main()
{
  std::cin >> S;

  int N = S.size();
  
  if( S.size()&1 )
  {
    int p = (N-1)/2, cnt = 0;
    char ch = S[p];

    while( p-cnt-1 >= 0 && p+cnt+1 < N && S[p+cnt+1] == ch && ch == S[p-cnt-1] )
      ++cnt;

    printf( "%d\n", p+cnt+1 );
  }
  else
  {
    int p = (N-1)/2, cnt = 1;

    if( S[p] != S[p+1] )
    {
      printf( "%d\n", p+1 );

      return 0;
    }

    char ch = S[p];

    while( p-cnt >= 0 && p+cnt+1 < N && S[p+cnt+1] == ch && ch == S[p-cnt] )
      ++cnt;

    printf( "%d\n", p+cnt+1 );
  }

  return 0;
}

Measured memory_bytes: 512
#include<bits/stdc++.h>
using namespace std;
int main()
{
    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    long long t,i,j,n,m,l,r,a,b;
    cin>>n>>m;
    if(n==1 || m==1)
    {
        cout<<"1\n";
    }
    else
    {
        l=ceil(n*1.0/2);
        r=n/2;
        a=ceil(m*1.0/2);
        b=m/2;
        cout<<(a*l+r*b)<<"\n";
    }
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
using namespace std;
int main(void){
    int a,b;
    cin>>a>>b;
    int s[a];
    int ans=a;
    for(int i=0;i<a;i++){
        cin>>s[i];
    }
    for(int i=0;i<a;i++){
        b=b-s[i];
    }
    sort(s,s+a);
    while(s[0]<=b){
        b=b-s[0];
        ans++;
    }
    cout<<ans<<endl;
}


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

lie = [0] * (n+1)
liw = [0] * (n+1)
ans = 10**10

for i in range(n):
    if s[i] == 'E':
        lie[i+1] = lie[i] + 1
        liw[i+1] = liw[i]
    else:
        lie[i+1] = lie[i]
        liw[i+1] = liw[i] + 1

for i in range(n):
    cnte = lie[-1] - lie[i+1]
    cntw = liw[i]
    ans = min(ans, cnte + cntw)

print(ans)


Measured memory_bytes: 17636
#include <iostream>

using namespace std;

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

    for (int i = 0; i < k; ++i) {
        int a, b; cin >> a >> b;
        cout << (min(min(a, n - a + 1), min(b, n - b + 1)) - 1) % 3 + 1 << endl;
    }
}

Measured memory_bytes: 1164
import qualified Data.ByteString.Lazy.Char8 as B
import Data.Maybe
import qualified Data.Vector.Unboxed as V
import qualified Data.Vector.Unboxed.Mutable as VM
import Data.Char
import Data.List
import Control.Monad

bsReadInts :: B.ByteString -> [Int]
bsReadInts = map (fst . fromJust . B.readInt) . B.words

solve :: String -> Int
solve a = 1 + answer
  where
    vec = V.create $ do
      v <- VM.replicate 26 0
      forM a $ \c -> do
        let idx = ord c - ord 'a'
        when (idx >= 0 && idx < 26) (VM.modify v (+ 1) idx)
      return v
    lst = V.toList vec
    answer = sum $ zipWith (*) lst $ map sum $ tail (tails lst)

main :: IO ()
main = do
  cont <- getContents
--  cont <- B.getContents
--  let answer = solve (B.unpack cont)
  let answer = solve cont
  putStrLn $ show answer
  


Measured memory_bytes: 7548
#include<iostream>
#include<string>
#include<vector>
#include<unordered_map>
#include<algorithm>
#include<cmath>
#include<limits>
#include<iomanip>

const double PI = 3.14159265358979323846;

using namespace std;

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)

int main() {
	cout << fixed << setprecision(10);
	double a, b, x;
	cin >> a >> b >> x;
	if (a * a * b / 2 >= x) {
		cout << atan(a * b * b / 2 / x) * 180 / PI << endl;
		return 0;
	}
	else {
		cout << atan(2 * (b - x / a/a) / a) * 180 / PI << endl;
		return 0;
	}
	return 0;
}

Measured memory_bytes: 256
#!/usr/bin/env python
# -*- coding: utf-8 -*-

import numpy as np
import sys
input = sys.stdin.readline


def main():
    n = int(input())
    a = list(map(int, input().split()))

    SUM = sum(a)

    ans = list()
    left = a[0]
    for i in range(1, n):
        ans.append(abs(2 * left - SUM))
        left += a[i]

    print(min(ans))


if __name__ == '__main__':
    main()


Measured memory_bytes: 32720
A, B = map(int, input().split())

def iskaibun(n):
    n = str(n)
    if n[0]==n[-1] and n[1] == n[-2]:
        return True
    else:
        return False

result = 0
for i in range(A,B+1):
    result += iskaibun(i)

print(result)



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

#define pb push_back
#define eb emplace_back
#define mk make_pair
#define fi first
#define se second
#define mset(a, b) memset(a, b, sizeof(a))
#define DBG(x) cout << "[" << #x << "]: " << x << endl
using ll = long long;
using pii = pair<int, int>;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

template<class Ty> Ty randint(Ty a, Ty b) { return uniform_int_distribution<Ty>(a, b)(rng); }
template<class num> inline void rd(num& x) {
	char c; while(isspace(c = getchar()));
	bool neg = false;
	if(!isdigit(c)) neg = (c == '-'), x = 0;
	else x = c - '0';
	while(isdigit(c = getchar())) x = (x << 3) + (x << 1) + c - '0';
	x = neg ? -x : x; }
template <class... Args> inline void rd(Args&... args) { (rd(args), ...); }
template <class... Args> inline void rf(Args&... args) { (cin >> ... >> args); }
template <class... Args> inline void pr(Args&&... args) { (cout << ... << args); }

const int MAXN = 2e5 + 5, INF = 0x3f3f3f3f;

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

	map<string, int> mp;
	mp["AC"] = 0;
	mp["WA"] = 0;
	mp["TLE"] = 0;
	mp["RE"] = 0;

	int n; cin >> n;
	while(n--) {
		string s; cin >> s;
		mp[s]++;
	}

	cout << "AC x " <<mp["AC"] << "\n";
	cout << "WA x " <<mp["WA"] << "\n";
	cout << "TLE x " <<mp["TLE"] << "\n";
	cout << "RE x " <<mp["RE"] << "\n";


}

Measured memory_bytes: 3632
#include<bits/stdc++.h>
using namespace std;
static const int MAX_N = 100000;

int N, a;
int A[MAX_N + 1];

int main() {
  scanf("%d", &N);
  for (int i = 0; i < N; i++) {
    scanf("%d", &a);
    A[a - 1] = i + 1;
  }

  int score;
  for (int i = 0; i < N; i++) {
    printf("%d\n", A[i]);
  }
  
  return 0;
}

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

#define ll long long
#define fornum(A,B,C) for(A=B;A<C;A++)
#define mp make_pair
#define pii pair<int,int>
#define pll pair<ll,ll>

using namespace std;

/////////////////////////////////////////////////////
ll N,ans,n,i;
int main(){
    scanf("%lld", &N);
    for (n = 1; n * n <= N;n++)
        ;
    fornum(i,1,n){
        if((N-i)%i==0){
            ll a = (N - i) / i;
            if(a>i)
                ans += a;
        }
    }
    printf("%lld", ans);
    return 0;
}

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

int main() {
  int N, power, f;
  cin >> N;
  f = 0;

  for (int i = 0; i < 8; i++) {
    power = pow(10, i + 1);
    f += (N % power) / (power / 10);
  }
  if (N % f == 0) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
}


Measured memory_bytes: 512
package main

import (
	"fmt"
)

func main() {
	var N int
	fmt.Scan(&N)
	B := make([]int, N - 1)
	for i := 0; i < N - 1; i++ {
		fmt.Scan(&B[i])
	}

	res := 0
	for i := 0; i < N; i++ {
		if i == 0 {
			res += B[i]
		} else if i == N - 1 {
			res += B[i - 1]
		} else {
			if B[i] < B[i - 1] {
				res += B[i]
			} else {
				res += B[i - 1]
			}
		}
	}
	fmt.Println(res)
}

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

// #include <chrono>
// using namespace std::chrono;
// auto clockStart = high_resolution_clock::now();
// auto timer() {return duration_cast<milliseconds>(high_resolution_clock::now() - clockStart);}

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
// typedef __int128 int128_t;
// typedef unsigned __int128 uint128_t;

typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<int, ll> pil;
typedef pair<ll, int> pli;
typedef pair<char, int> pci;
typedef tuple<int, int, int> ti3;
typedef tuple<ll, ll, ll> tl3;

typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<vl> vvl;

#define ff          first
#define ss          second

#define pb(x)       push_back(x)
#define ppb()       pop_back()
#define pf(x)       push_front(x)
#define ppf()       pop_front()
#define mp(x,y)     make_pair(x, y)
// #define mk(args...) make_tuple(args...)
#define all(v)     begin(v),end(v)
#define gcd(x, y)   __gcd(x, y)

// pbds and ordered set
// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>
// using namespace __gnu_pbds;
// template <class T, class cmp = less<T> >
// using ordered_set = tree<T, null_type, cmp, rb_tree_tag, tree_order_statistics_node_update>;

// for fast I/O
#define endl '\n'
#define FASTIO() ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr);

const int N = 600;

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

  cout << s.substr(0, 3) << endl;
  
  return 0;
}



Measured memory_bytes: 3652
#include<iostream>
#include<iomanip>
#include<vector>
#include<map>
#include<set>
#include<stack>
#include<queue>
#include<string>
#include<utility>
#include<numeric>
#include<algorithm>
#include<cmath>
#include<climits>
using namespace std;

using ll = long long;

class Stream{
public:
    Stream(){

    }
    //配列以外の入力を受け取る
    void read(){

    }
    template<typename First, typename... Rest>
    void read(First& first, Rest&... rest){
        cin >> first;
        read(rest...);
    }
    template<typename T>
    vector<T> read_vec(size_t n){
        vector<T> tmp(n);
        for(size_t i = 0; i < n; i++){
            cin >> tmp[i];
        }
        return tmp;
    }
    //配列を区切って出力する
    template<typename T>
    void write_vec(vector<T>& v, char divider){
        for(size_t i = 0; i < v.size(); i++){
            cout << v[i] << divider;
        }
    }
};

int main(){
    Stream io;

    int N;
    io.read(N);
    auto a = io.read_vec<int>(N);
    int ans = 0;
    vector<int> visited(N, 0);
    int cur = 0;
    while(true){
        if(cur == 1) break;
        if(visited[cur]){
            ans = -1;
            break;
        }
        visited[cur] = 1;
        cur = a[cur] - 1;
        ans++;
    }
    cout << ans;
    return 0;
}

Measured memory_bytes: 1024
#include"bits/stdc++.h"
#define int long long
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=(a);i<(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define itr(i,x) for(auto i=(x).begin();i!=(x).end();++i)
#define All(x) (x).begin(),(x).end()
#define gridif(a,x,b) if((a)<=(x)&&(x)<(b))

using namespace std;
using Graph = vector<vector<int>>;
typedef pair<int,int> P;
const int mod=1000000007;

int digitsum(int n,int b){
	if(b<2) return -1;
	if(n<b) return n;
	return digitsum(n/b,b)+n%b;
}
int mpow(int a,int x);
int m_inv(int n);
vector<int> split(int n,int a);
string xal_number(int n,int x);
int gcd(int x,int y){return y?gcd(y,x%y):x;}
int lcm(int x,int y){return x*y/gcd(x,y);}
class Factorial{
private:
	vector<int> fac;
public:
	Factorial(int N){
		fac.push_back(1);
		rep(i,N) fac.push_back(fac[i]*(i+1)%mod);
	}
	int fact(int a){return fac[a];}
	int ifac(int a){return m_inv(fac[a]);}
	int cmb(int n,int r);
};
struct UnionFind {
    vector<int> par; // 親ノード
    UnionFind(int n = 1) { init(n);}
    void init(int n = 1) {
        par.resize(n);
        rep(i,n) par[i] = -1;
    }
    int root(int x) {
        if (par[x] <0) return x;
        else return par[x] = root(par[x]);      
    }
    int size(int x){ return -par[root(x)];}
    bool issame(int x, int y) {return root(x)==root(y);}
    bool connect(int x, int y);
};

signed main(){
	int N;
	cin>>N;
	vector<int> a(3*N),S0(N+1,0),S1(N+1,0);
	rep(i,N*3) cin>>a[i];
	multiset<int> st1,st2;
	int S=0;
	rep(i,N){ 
		st1.insert(a[i]);
		S0[0]+=a[i];
		st2.insert(a[3*N-1-i]);
		S1[0]+=a[3*N-1-i];
	}
	//cout<<S0[0]<<" "<<S1[0]<<endl;
	rep(i,N){
		st1.insert(a[i+N]);
		S0[i+1]=S0[i]+a[i+N]-*st1.begin();
		st1.erase(st1.begin());
		auto it=st2.end();it--;
		st2.insert(a[2*N-1-i]);
		S1[i+1]=S1[i]+a[2*N-1-i]-*it;
		st2.erase(it);
	}
	int ans=-LLONG_MAX;
	rep(i,N+1){ 
		ans=max(S0[i]-S1[N-i],ans);
		//cout<<S0[i]<<" "<<S1[N-i]<<endl;
	}
	cout<<ans<<endl;
}

Measured memory_bytes: 13568
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)
#define all(c) c.begin(),c.end()
#define pb push_back
#define fs first
#define sc second
#define show(x) cout << #x << " = " << x << endl
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)
using namespace std;

template<unsigned int mod_>
struct ModInt{
	using uint = unsigned int;
	using ll = long long;
	using ull = unsigned long long;

	constexpr static uint mod = mod_;

	uint v;
	ModInt():v(0){}
	ModInt(ll v):v(normS(v%mod+mod)){}
	explicit operator bool() const {return v!=0;}
	static uint normS(const uint &x){return (x<mod)?x:x-mod;}		// [0 , 2*mod-1] -> [0 , mod-1]
	static ModInt make(const uint &x){ModInt m; m.v=x; return m;}
	ModInt operator+(const ModInt& b) const { return make(normS(v+b.v));}
	ModInt operator-(const ModInt& b) const { return make(normS(v+mod-b.v));}
	ModInt operator-() const { return make(normS(mod-v)); }
	ModInt operator*(const ModInt& b) const { return make((ull)v*b.v%mod);}
	ModInt operator/(const ModInt& b) const { return *this*b.inv();}
	ModInt& operator+=(const ModInt& b){ return *this=*this+b;}
	ModInt& operator-=(const ModInt& b){ return *this=*this-b;}
	ModInt& operator*=(const ModInt& b){ return *this=*this*b;}
	ModInt& operator/=(const ModInt& b){ return *this=*this/b;}
	ll extgcd(ll a,ll b,ll &x,ll &y) const{
		ll u[]={a,1,0},v[]={b,0,1};
		while(*v){
			ll t=*u/ *v;
			rep(i,3) swap(u[i]-=t*v[i],v[i]);
		}
		if(u[0]<0) rep(i,3) u[i]=-u[i];
		x=u[1],y=u[2];
		return u[0];
	}
	ModInt inv() const{
		ll x,y;
		extgcd(v,mod,x,y);
		return make(normS(x+mod));
	}
	bool operator==(const ModInt& b) const { return v==b.v;}
	bool operator!=(const ModInt& b) const { return v!=b.v;}
	friend istream& operator>>(istream &o,ModInt& x){
		ll tmp;
		o>>tmp;
		x=ModInt(tmp);
		return o;
	}
	friend ostream& operator<<(ostream &o,const ModInt& x){ return o<<x.v;}
};
using mint = ModInt<998244353>;

typedef long long ll;
int N;
ll x[2000],y[2000];
ll gcd(ll x,ll y){
	if(y==0) return abs(x);
	return gcd(y,x%y);
}
using T = tuple<ll,ll,ll>;
map<T,int> cnt;
map<int,int> c2i;

mint p2[2001];

int main(){
	cin>>N;
	p2[0] = 1;
	rep1(i,N) p2[i] = p2[i-1]*2;
	for(int i=2;i<=N;i++){
		int x = i*(i-1)/2;
		c2i[x] = i;
	}
	rep(i,N) cin>>x[i]>>y[i];
	rep(i,N) rep(j,i){
		ll a = y[i]-y[j];
		ll b = x[j]-x[i];
		ll c = y[i]*x[j]-y[j]*x[i];
		ll g = gcd(a,gcd(b,c));
		if(a<0 || (a==0&&b<0)) g*=-1;
		a/=g,b/=g,c/=g;
		cnt[T(a,b,c)]++;
	}
	mint ans = p2[N];
	for(auto it:cnt){
		int n = c2i[it.sc];
		ans -= p2[n]-n-1;
	}
	ans -= N+1;
	cout<<ans<<endl;
}


Measured memory_bytes: 1792