akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define rep(i,a,b) for(int i = a; i < b; ++i)
#define all(c) c.begin(), c.end() 
#define gmax(x,y) x=max(x,y)
#define gmin(x,y) x=min(x,y)
using namespace std;

const int MOD = 1e9 + 7;
const int r = 17;

typedef pair<int,int> pii;

int add(int x,int y){
	return (x + y) % MOD;
}

int mul(int x,int y){
	return (1LL*x*y) % MOD;
}

int mod_pow(int x, int p){
	int res = 1;
	while(p){
		if(p&1)res = mul(x, res);
		x = mul(x,x);
		p/=2;
	}
	return res;
}

const int N = 2e5 + 5;

int p[N], inv[N];

struct hush {
	vector<int> h;	
	void init(const vector<int> &a){
		h = vector<int>(a.size())				;
		h[0] = mul(p[0], a[0]);
		rep(i,1,a.size()){
			h[i] = add(h[i-1], mul(p[i], a[i]));
		}
	}
	int calc_hash(int l, int r){
		if(r < l)return 0;
		if(l == 0)return h[r];
		return mul(add(h[r], MOD - h[l-1]), inv[l]);
	}
};

hush hashes[2][2][32];

int main(){
	cin.tie(0);
	cout.tie(0);
	ios_base::sync_with_stdio(0);
	p[0] = 1;
	inv[0] = 1;
	rep(i,1,N){
		p[i] = mul(p[i-1], r);	
		inv[i] = mod_pow(p[i], MOD - 2);
	}
	int n;
	cin >> n;
	vector<vector<int>> v(2, vector<int>(n));
	rep(t,0,2){
		rep(i,0,n){
			cin >> v[t][i];		
		}
	}
	rep(t,0,2){
		rep(k,0,2){
			rep(pow,0,32){
				vector<int> tmp(n);
				rep(i,0,n){
					tmp[i] = ((v[t][i] >> pow) & 1) ^ k;
				}
				hashes[t][k][pow].init(tmp);
			}
		}
	}
	vector<pii> ans;
	rep(i,0,n){
		bool valid = true;
		int x = v[0][i] ^ v[1][0];
		rep(pow,0,32){
			int ftype = (x >> pow) & 1;
			valid &= hashes[0][ftype][pow].calc_hash(i,n-1) == hashes[1][0][pow].calc_hash(0,n-i-1);
			valid &= hashes[0][ftype][pow].calc_hash(0,i-1) == hashes[1][0][pow].calc_hash(n-i,n-1);
		}
		if(valid){
			ans.push_back({i,x});
		}
	}
	for(pii p:ans){
		cout << p.first << ' ' << p.second << '\n';
	}
}


Measured memory_bytes: 109420
import sys
input = sys.stdin.readline

N,W=map(int,input().split())
wv = [list(map(int, input().split())) for _ in range(N)]
dp = [[0]*(W+1) for _ in range(N+1)]
for i in range(1,N+1):
    for j in range(W+1):
        dp[i][j] = dp[i-1][j]
        if j-wv[i-1][0] >= 0:
            dp[i][j] = max(dp[i][j], dp[i-1][j-wv[i-1][0]]+wv[i-1][1])
print(dp[N][W])
    


Measured memory_bytes: 120172
#include <bits/stdc++.h>
using namespace std;
 
int main(){
  int N;
  cin >> N;
  vector<long long> lucas(100);
  lucas.at(0)=2LL;
  lucas.at(1)=1LL;
  if(N<2){
      cout << lucas.at(N) << endl;
  }
  else{
  for(int i=2; i<=N; i++){
    lucas.at(i)=lucas.at(i-1)+lucas.at(i-2);
  }
  cout << lucas.at(N) << endl;
}
}

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

void print(char* ch, int a, int b){
    for(int i=a;i<=b;i++)printf("%c",ch[i]);
    printf("\n");
}

void reverse(char* ch, int a, int b){
    char tmp;
    for(int i=0;i<(b-a+1)/2;i++){
        tmp = ch[a+i];
        ch[a+i] = ch[b-i];
        ch[b-i] = tmp;
    }
}

void replace(char* ch, int a, int b, char* tmp){
    for(int i=0;i<b-a+1;i++){
        ch[a+i] = tmp[i];
    }
}

int main(){
    char ch[1000], tmp[1000];
    char op[8];
    int n=0, a=0, b=0;
    
    scanf("%s",ch);
    scanf("%d",&n);
    for(int i=0;i<n;i++){
        scanf("%s %d %d",op,&a,&b);
        if(strcmp(op,"print")==0){ print(ch, a, b); }
        if(strcmp(op,"reverse")==0){ reverse(ch, a, b); }
        if(strcmp(op,"replace")==0){
            scanf(" %s", tmp);
            replace(ch, a, b, tmp);
        }
    }
    return 0;
}


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

int main() {
    int x,ans;
    cin>>x;
    if(x<=111)ans=111;
    else if(x<=222)ans=222;
    else if(x<=333)ans=333;
    else if(x<=444)ans=444;
    else if(x<=555)ans=555;
    else if(x<=666)ans=666;
    else if(x<=777)ans=777;
    else if(x<=888)ans=888;
    else if(x<=999)ans=999;
    std::cout << ans << std::endl;
    return 0;
}

Measured memory_bytes: 256
/*
 _     _                             
| |__ | |__   __ _  __ _ _   _  __ _ 
| '_ \| '_ \ / _` |/ _` | | | |/ _` |
| |_) | | | | (_| | (_| | |_| | (_| |
|_.__/|_| |_|\__,_|\__, |\__, |\__,_|
                   |___/ |___/       
*/
#include<bits/stdc++.h>

#define ll          long long
#define pb          push_back
#define ppb         pop_back
#define BigInt      __int128
#define endl        '\n'
#define mii         map<ll int,ll int>
#define pii         pair<ll int,ll int>
#define vi          vector<ll int>
#define all(a)      (a).begin(),(a).end()
#define F           first
#define S           second
#define sz(x)       (ll int)x.size()
#define hell        1000000007
#define lbnd        lower_bound
#define ubnd        upper_bound
#define bs          binary_search
#define mp          make_pair
#define sim         template < class c
#define ris         return * this
#define dor         > debug & operator <<
#define eni(x)      sim > typename \
  enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {

using namespace std;

sim > struct rge {c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug 
{
	~debug() 
	{ 
		cerr<<endl; 
	}
	eni(!=) cerr << boolalpha << i; ris; }
	eni(==) ris << range(begin(i), end(i)); }
	sim, class b dor(pair < b, c > d) 
	{
		ris << "(" << d.first << ", " << d.second << ")";
	}
	sim dor(rge<c> d) 
	{
	  	*this << "[";
	  	for (auto it = d.b; it != d.e; ++it)
	    	*this << ", " + 2 * (it == d.b) << *it;
	  	ris << "]";
	}
};
#define fuck(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "

#define N  100005

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	int TESTS=1;
	// cin>>TESTS;
	while(TESTS--)
	{
		ll int n;
		cin>>n;
		mii ma;
		for(ll int i=2;i<=1e7;i++)
		{
			ll int cnt=0;
			while(n%i==0)
			{
				cnt++;
				n/=i;
			}
			if(cnt!=0) ma[i]=cnt;
		}
		if(n!=1) ma[n]=1;
		ll int ans=0;
		for(auto it:ma)
		{
			ll int tmp=0;
			ll int cnt=0;
			for(ll int i=1;true;i++)
			{
				tmp+=i;
				if(tmp<=it.S)
				{
					cnt++;
				}
				else
				{
					break;
				}
			}
			ans+=cnt;
		}
		cout<<ans<<endl;
	}
	return 0;
}

Measured memory_bytes: 3656
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define rrep(ri,n) for(int ri = (int)(n-1); ri >= 0; ri--)
#define rep2(i,x,n) for(int i = (int)(x); i < (int)(n); i++)
#define repit(itr,x) for(auto itr = x.begin(); itr != x.end(); itr++)
#define rrepit(ritr,x) for(auto ritr = x.rbegin(); ritr != x.rend(); ritr++)
#define ALL(n) begin(n), end(n)
using ll = long long;
using namespace std;

ll calcNumOfCombination(ll n, ll r){
	ll num = 1;
	for(ll i = 1; i <= r; i++){
		num = num * (n - i + 1) / i;
	}
	return num;
}

int main(){
	int ev, od;
	cin >> ev >> od;
	int ans = 0;
	if(ev > 1) ans += calcNumOfCombination(ev, 2);
	if(od > 1) ans += calcNumOfCombination(od, 2);
	cout << ans << endl;
	return 0;
}

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

#define NINJA ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define deb(x) cout << #x << " " << x << endl;
#define fo(i,n) for(int i=0;i<n;i++)
#define Fo(i,k,n) for(int i=k;i<n;i++)
#define vi vector<int>
#define ii pair<int,int>
#define vii vector<ii>
#define ll long long
#define pb push_back
#define endl "\n"
#define mp map<int,int>
#define F first
#define S second
#define sz(v) (int)v.size()
#define mod 1000000007

const int mxn = 1e4+500;
vi a(mxn);

int main(){
	NINJA;

	int n,m; cin >> n >> m;

	ll sum = 0;

	fo(i,m){
		cin >> a[i];
		sum += a[i];
	}

	ll ans = n - sum;

	if(ans <0) cout << -1 << endl;
	else cout << ans << endl;



	return 0;
}

Measured memory_bytes: 3656
#include<bits/stdc++.h>
using namespace std;
int main() {
	int x, a, b;
	cin >> x >> a >> b;
	if (a - b >= 0) {
		cout << "delicious" << endl;
	}
	else if (a - b >= -x) {
		cout << "safe" << endl;
	}
	else {
		cout << "dangerous" << endl;
	}
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep_range(i, s, e) for (int i = (s); i < (int)(e); i++)
#define rep_rev(i, s, e) for (int i = (s)-1; i >= (int)(e); i--)
#define sort_vec(v) sort((v).begin(),(v).end())
typedef int64_t lint;
// lint mod = 998244353;

double app() {
  int n;
  cin>>n;

  vector<int> x(n),y(n);
  rep(i,n){
    cin>>x[i]>>y[i];
  }

  double sum=0.;
  rep(i,n){
    rep(j,n){
      int dx=x[i]-x[j];
      int dy=y[i]-y[j];
      sum += sqrt(dx*dx+dy*dy);
    }
  }

return sum/n;
}

int main(){
  cout<<fixed<<setprecision(10);
  cout<<app()<<endl;return 0;}


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

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

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

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

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

void debug_out() { cerr << endl; }

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

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

void test_case() {
	int d;
	cin >> d;
	string ch = "Christmas", ev = " Eve";
	string res = ch;
	for (int i = 0; i < 25 - d; ++i) {
		res += ev;
	}
	cout << res << "\n";
}

int main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	test_case();
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <string.h>
#include <vector>
#include <queue>
#include <cmath>
#include <bitset>
#include <complex>
#include <functional>
#include <numeric>
#include <iomanip>

// output
#define SPBR(w, n) std::cout<<(w + 1 == n ? '\n' : ' ');
#define YES cout << "YES" << endl
#define Yes cout << "Yes" << endl
#define NO cout << "NO" << endl
#define No cout << "No" << endl
// utility
#define ALL(i) (i).begin(), (i).end()
#define FOR(i, a, n) for(int i=(a);i<(n);++i)
#define RFOR(i, a, n) for(int i=(n)-1;i>=(a);--i)
#define REP(i, n) for(int i=0;i<int(n);++i)
#define RREP(i, n) for(int i=int(n)-1;i>=0;--i)
#define IN(a, x, b) (a<=x && x<b)
#define OUT(a, x, b) (x<a || b<=x)
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; }

// type/const
#define int ll
using ll = long long;
using ull = unsigned long long;
using ld = long double;
const int MOD = 1000000007;
/* const int MOD = 998244353; */
const int INF = 1e18;
const double PI = acos(-1);

using namespace std;
struct INIT { INIT(){
  cin.tie(0); ios::sync_with_stdio(false);
  cout << fixed << setprecision(10);
}}INIT;


signed main() {
  int N, M; 
  cin >> N >> M;

  map<int, int> m;
  m[0] = 1;

  int sum = 0;
  REP(i, N){
    int A;
    cin >> A;
    sum += A;
    m[sum%M]++;
  }

  int ans = 0;
  for(auto p : m) ans += p.second*(p.second-1)/2;

  cout << ans << "\n";

  return 0;
}

Measured memory_bytes: 4224
n,m,l = map(int, input().split())
INF = 1001001001
dist = [[INF for i in range(n)] for i in range(n)]
#make graph
for i in range(n):
  dist[i][i] = 0
for i in range(m):
  a, b, c = map(int, input().split())
  dist[a-1][b-1] = dist[b-1][a-1] = c
#warshall-froyd
for k in range(n):
  for i in range(n):
    for j in range(n):
      dist[i][j] = min(dist[i][j], dist[i][k]+dist[k][j])
dist2 =  [[INF for i in range(n)] for i in range(n)]
for i in range(n):
  for j in range(n):
    if dist[i][j] <=l:
      dist2[i][j] = 1
#warshall-froyd
for k in range(n):
  for i in range(n):
    for j in range(n):
      dist2[i][j] = min(dist2[i][j], dist2[i][k]+dist2[k][j])
q = int(input())
for i in range(q):
  s,t = map(int, input().split())
  if dist2[s-1][t-1] == INF:
    print(-1)
  else:
    print(dist2[s-1][t-1]-1)

Measured memory_bytes: 60376
import java.io._
import scala.io.StdIn.{readInt, readLine}

object Main {
  val out:BufferedWriter =
    new BufferedWriter(new OutputStreamWriter(new FileOutputStream(java.io.FileDescriptor.out), "ASCII"), 512)
  var count = 0
  class Node(var key:Int, var left:Node = null, var right:Node = null) { }

  def insert(tree:Node, key:Node) = {
    val keyNode = key
    def getNodeToInsert(node:Node):Node =
      if(node.key > keyNode.key) {
        if(node.left == null) node
        else getNodeToInsert(node.left)
      } else {
        if(node.right == null) node
        else getNodeToInsert(node.right)
      }

    val target = getNodeToInsert(tree)

    if(keyNode.key < target.key) target.left = keyNode
    else target.right = keyNode
  }

  def inOrder(tree:Node):Unit =
    if(tree == null) return
    else {
      inOrder(tree.left)
      out.write(" ")
      out.write(tree.key.toString)
      if(count<1000) count += 1
      else {
        out.flush
        count = 0
      }
      inOrder(tree.right)
    }

  def preOrder(tree:Node):Unit =
    if(tree == null) return
    else {
      out.write(" ")
      out.write(tree.key.toString)
      if(count<1000) count += 1
      else {
        out.flush
        count = 0
      }
      preOrder(tree.left)
      preOrder(tree.right)
    }

  def main(args:Array[String]) = {
    val n = readInt
    val tree = new Node(-1)

    for(i<-0 until n) {
      val s = readLine.split(" ")
      s(0) match {
        case "insert" =>
          if(tree.key == -1) tree.key = s(1).toInt
          else insert(tree, new Node(s(1).toInt))
        case _ => {
          inOrder(tree)
          out.write("\n")
          out.flush()
          preOrder(tree)
          out.write("\n")
          out.flush()
        }
      }
    }
  }
}

Measured memory_bytes: 301840
import math

n = int(input())
x = list(map(int, input().split()))

def c(n):
    if n == 1:
        return 1
    return c(n - 1) + 1 / n

mod = 10 ** 9 + 7
sum = 0
c = 0
for i in range(n - 1):
    c += pow(i + 1, mod - 2, mod)
    c %= mod
    sum += (x[i + 1] - x[i]) * c
    sum %= mod
ans = (sum * math.factorial(n - 1)) % mod
print(ans)


Measured memory_bytes: 15020
def chmin(a,b):
    if a > b:
        return b
    else:
        return a


N, K = map(int, input().split())
h = list(map(int, input().split()))
INF = float('inf')
dp = [INF] * N
dp[0] = 0


for i in range(N):
    for j in range(1,K+1):
        if i+j < N:
            dp[i+j] = chmin(dp[i+j], dp[i] + abs(h[i] - h[i+j]))

print(dp[N-1])

Measured memory_bytes: 55392
#include <iostream>
#include <iomanip>
#include <ios> 
#include <vector>
#include <string>
#include <algorithm>
#include <functional>
#include <queue>
#include <stack>
#include <set>
#include <cmath>
#include <bitset>
#include <map>
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)
#define sz(c) ((int)(c).size())

using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
//const int MAX=;



int main(){
	int N;
	cin>>N;
	bool se=true;
	rep(i,N){
		int a;
		cin>>a;
		if(a%2)se=false;
	}
	if(se)cout<<"second"<<endl;
	else cout<<"first"<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define REP(i,m,n) for(int i=(int)(m); i<(int)(n); i++)
#define rep(i,n) REP(i,0,n)
#define RREP(i,m,n) for(int i=(int)(m); i>=(int)(n); i--)
#define rrep(i,n) RREP(i,n-1,0)
#define all(v) v.begin(), v.end()
const int inf = 1e9+7;
const ll longinf = 1LL<<60;
const ll mod = 1e9+7;

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  string s; cin >> s;
  int k; cin >> k;
  int n = s.size();
  set<string> st;
  rep(i, n) REP(j, i, n) {
    string t = s.substr(i, j-i+1);
    st.insert(t);
    if(st.size()>k && *st.rbegin()==t) {
      st.erase(--st.end()); break;
    } else if(st.size()>k) {
      st.erase(--st.end());
    }
  }
  cout << *st.rbegin() << "\n";
  return 0;
}


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

int main() {
    int n;
    cin >> n;
    for (int i = 1; i <= n; ++i) {
        int x = i;
        if (i % 3 == 0) {
            cout << ' ' << i;
            continue;
        }
        while (x) {
            if (x % 10 == 3) {
                cout << ' ' << i;
                break;
            }
            x /= 10;
        }
    }
    cout << endl;
    
    return 0;
}


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


int main(){
    int n;
    cin >> n;
    int ame[2][100];
    for(int i=0; i<n; i++){
        cin >> ame[0][i];
        if(i>0){
            ame[0][i] += ame[0][i-1];
        }
    }
    for(int i=0; i<n; i++){
        int a;
        cin >> a;
        if(i==0){
            ame[1][i] = ame[0][i]+a;
        }else{
            ame[1][i] = max(ame[1][i-1]+a, ame[0][i]+a);
        }
    }
    cout << ame[1][n-1] << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for(int (i)=0; (i)<(n); (i)++)

using namespace std;
typedef long long ll;

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

int main()
{
  ll N;
  ll K;
  cin >> N >> K;
  ll base=K;
  ll count=0;
  while(base<=N)
    {
      base*=K;
      count++;
    }

  cout << count+1 << endl;
  


  return 0;
}


//cout << setprecision(13);
//next_permutation();
//__gcd();
//reverse();
//set ,tuple ,pair;
//bitset
//vector.find
//vector.count



Measured memory_bytes: 256
#include <bits/stdc++.h> // Include every standard library
using namespace std;
#define pb push_back
#define pf push_front
#define mp make_pair
#define fi first
#define se second
#define prec(n) fixed << setprecision(n)
typedef long long int ll;
typedef unsigned long long ull;
typedef long double ld;
typedef vector<int> vi;

vi graph[100005];
bool visited[100005];
int deg[100005]; //deg[v]= no of edges going into node v. 
int dist[1000005];

void dfs(int v) {
    visited[v] = true;
    for (int a : graph[v]) {
        dist[a] = max(dist[a], dist[v] + 1);
        deg[a]--;
        if(deg[a]==0)
            dfs(a);
    }
}

int main()
{
    int n, m;
    scanf("%d%d", &n, &m);
    while (m--){
        int x,y;
        scanf("%d%d", &x, &y);
        graph[x].pb(y);
        deg[y]++;
    }
    for (int a = 1; a <=n; a++) {
        if (!visited[a] && deg[a] == 0)
            dfs(a);
    }
    int res = 0;
    for (int a = 1; a <= n; a++)
        res = max(res, dist[a]);
    printf("%d", res);
}


Measured memory_bytes: 14756
#include <iostream>
#include <vector>
#include <array>
#include <limits>

using namespace std;
typedef long long ll;

int main(){
    ll n, m;
    cin >> n >> m;
    vector<array<ll, 3>> edge(m);
    for(int i = 0; i < m; ++i){
        ll a, b, c;
        cin >> a >> b >> c;
        a--; b--;
        edge.at(i).at(0) = a;
        edge.at(i).at(1) = b;
        edge.at(i).at(2) = c;
    }

    vector<ll> dist(n, numeric_limits<ll>::min());
    dist.at(0) = 0;
    for(int i = 0; i < n - 1; ++i){
        for(int j = 0; j < m; ++j){
            const ll a = edge.at(j).at(0);
            const ll b = edge.at(j).at(1);
            const ll c = edge.at(j).at(2);
            if(dist.at(a) != numeric_limits<ll>::min() &
               dist.at(b) < dist.at(a) + c){
                dist.at(b) = dist.at(a) + c;
            }
        }
    }

    vector<bool> cycle(n, false);
    for(int j = 0; j < m; ++j){
        const ll a = edge.at(j).at(0);
        const ll b = edge.at(j).at(1);
        const ll c = edge.at(j).at(2);
        if(dist.at(a) != numeric_limits<ll>::min() &
            dist.at(b) < dist.at(a) + c){
            cycle.at(b) = true;
        }
    }

    for(int i = 0; i < n; ++i){
        for(int j = 0; j < m; ++j){
            const ll a = edge.at(j).at(0);
            const ll b = edge.at(j).at(1);
            if(cycle.at(a)){
                cycle.at(b) = true;
            }
        }
    }

    if(cycle.at(n - 1)){
        cout << "inf" << endl;
    }else{
        cout << dist.at(n - 1) << endl;
    }
    return 0;
}


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

using namespace std;

#define ll long long int

int main()
{
    ll n,i,x;
    cin>>n;
    set<ll>S;
    vector<ll>B;
    for(i=0;i<n;i++)
    {
        cin>>x;
        if(S.count(x))
		{
        S.erase(x);
        B.push_back(x);
		}
        else
        S.insert(x);
    }
    sort(B.begin(),B.end());
    if((ll)B.size()<2){
        printf("0\n");
    }
    else
    {
       	x=(ll)B.size();
        printf("%lld",B[x-1]*B[x-2]);
    }
    return 0;
}

Measured memory_bytes: 4992
N = int(input())
L1 = ['3', '5', '7']
L2 = ['3', '5', '7']
for i in range(1, 9):
    for x in L2:
        if len(x) == i:
            for y in L1:
                L2.append(''.join([x, y]))
L2 = [int(x) for x in L2 if '3' in x and '5' in x and '7' in x]
L3 = [1 for x in L2 if x <= N]
print(len(L3))

Measured memory_bytes: 6180
import java.util.*;

public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    String s = sc.next();
    String S[] = s.split("");
    int red = 0;
    int blue = 0;
    String R = "R";
    String B = "B";
    for(int i = 0;i < s.length();i++){
      if(S[i].equals(R)){
        red++;
      }
      else if(S[i].equals(B)){
        blue++;
      }
    }

    if(red > blue){
      System.out.println("Yes");
    }
    else{
      System.out.println("No");
    }
  }
}


Measured memory_bytes: 21716
#include <iostream>
#include <cmath>

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() {
    int maxN = 100001;
    int Q, l, r;
    int Prime[maxN];
    rep(i, maxN) Prime[i] = 1;
    Prime[0] = Prime[1] = 0;
    int x;
    rep(i, sqrt(maxN - 1) + 1) {
        x = i * 2;
        if (!Prime[i]) continue;
        while (x < maxN) {
            Prime[x] = 0;
            x += i;
        }
    }
    for (int i = maxN - 1; i >= 0; i--) if (!Prime[(i + 1) / 2]) Prime[i] = 0;
    rep(i, maxN - 1) {
        Prime[i + 1] += Prime[i];
    }
    cin >> Q;
    int ans;
    rep(i, Q) {
        cin >> l >> r;
        ans = Prime[r] - Prime[l - 1];
        cout << ans << endl;
    }
    return 0;
}

Measured memory_bytes: 1024
#include <string>
#include <vector>
#include <algorithm>
#include <numeric>
#include <set>
#include <map>
#include <queue>
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cmath>
#include <ctime>
#include <cstring>
#include <cctype>
#include <cassert>
#include <limits>
#include <functional>
#include <iomanip>
#include <complex>
#include <bitset>
#include <stack>
 
using namespace std;
 
#define rep(i,n) for(int (i)=0;(i)<(int)(n);++(i))
#define rer(i,l,u) for(int (i)=(int)(l);(i)<=(int)(u);++(i))
#define reu(i,l,u) for(int (i)=(int)(l);(i)<(int)(u);++(i))
#if defined(_MSC_VER) || __cplusplus > 199711L
#define aut(r,v) auto r = (v)
#else
#define aut(r,v) __typeof(v) r = (v)
#endif
#define each(it,o) for(aut(it, (o).begin()); it != (o).end(); ++ it)
#define ktya(x) sort(all(x))
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define all(o) (o).begin(), (o).end()
#define pb(x) push_back(x)
#define mp(x,y) make_pair((x),(y))
#define mset(m,v) memset(m,v,sizeof(m))
#define INF 0x3f3f3f3f3f3f3f3fLL
#define SIZE 200105
#define REP(i,n) for(int i=0;i<(int)n;++i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define ALL(c) (c).begin(), (c).end()
 
typedef vector<int> vi; typedef pair<int, int> pii; typedef vector<pair<int, int> > vpii; typedef long long ll;
typedef pair<int,ll> pill; typedef pair<ll,int> plli; 
typedef pair<double, int> pdi;
template<typename T, typename U> inline void amin(T &x, U y) { if(y < x) x = y; }
template<typename T, typename U> inline void amax(T &x, U y) { if(x < y) x = y; }
typedef complex<double> P;
ll MOD = 1000000007;
//ll MOD=998244353;
typedef ll Weight;
struct Edge {
	int src, dst;
	Weight weight;
};
bool operator < (const Edge &e, const Edge &f) {
	return e.weight != f.weight ? e.weight > f.weight : // !!INVERSE!!
	e.src != f.src ? e.src < f.src : e.dst < f.dst;
}
typedef vector<Edge> Edges;
int N;
ll a[20][20];
ll score[(1<<16) + 5]={0};
ll dp[(1<<16) + 5] = {0};
ll calc(int i, int bcnt){
	ll ret = 0;
	if(i==0)return 0;
	else{
		rep(k,N){
			if(i&(1<<k)){
				ret+=a[bcnt][k];
			}
		}
		return ret;
	}
}
int main(){
	cin>>N;
	rep(i,N)rep(j,N)cin>>a[i][j];
	int now=1;
	int bcnt=0;
	score[0]=0;
	rep(i,(1<<N)){
		if(now*2<=i)now*=2,bcnt++;
		score[i]=score[i-now]+calc(i, bcnt);
	}
	rep(S,(1<<N)){
		dp[S]=max(score[S],(ll)0);
		//cout<<S<<endl;
		for(int T=S;T>0;T=(T-1)&S){
			maxs(dp[S],dp[S-T]+dp[T]);
		}
	}
	cout<<dp[(1<<N)-1]<<endl;
}

Measured memory_bytes: 1280
NumRobot = int(input())
RobotList = [[int(_) for _ in input().split()] for i in range(NumRobot)]

edge_list = []
for i_coordinate, i_arm in RobotList:
    edge_list.append([i_coordinate - i_arm, i_coordinate + i_arm])

edge_list = sorted(edge_list, key=lambda x: x[1])

total_robot = 1
right_edge_compare = edge_list[0][1]

for i_left_edge, i_right_edge in edge_list[1:]:
    if i_left_edge < right_edge_compare:
        continue

    right_edge_compare = i_right_edge
    total_robot += 1

print(total_robot)

Measured memory_bytes: 76376
#include <bits/stdc++.h>
#define REP(i,n) for(int i=0;i<n;i++)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define SORT(c) sort((c).begin(),(c).end())

using namespace std;

inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

//sort(v.rbegin(), v.rend(), [](auto& x, auto& y){return x[1] < y[1];});
//cout << fixed << setprecision(10) << ans << defaultfloat << endl;
typedef long long ll;
typedef vector<int> Vi;
typedef vector<ll> Vl;
typedef vector<double> Vd;
typedef vector<string> Vs;

int main() {
    int N,tmp,S2=0,S1=0,ans=100000;
    cin >> N;
    Vi W(N);
    REP(i,N) {
        cin >> W[i];
        S2 += W[i];
    }
    REP(i,N) {
        tmp = W[i];
        S1+=tmp;
        S2-=tmp;
        ans=min({abs(S2-S1),ans});
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author Yulian
 */

#include <iostream>
#include <iostream>
#include <fstream>
#include <vector>
#include <set>
#include <cmath>
#include <queue>
#include <deque>
#include <string>
#include <algorithm>
#include <map>


#include <iostream>

#include <fstream>
#include <vector>
#include <set>
#include <cmath>
#include <queue>
#include <deque>
#include <string>
#include <algorithm>
#include <map>



#include <assert.h>


using namespace std;
class B {
public:
	void solve(std::istream& in, std::ostream& out) {
    ios::sync_with_stdio(false);
    int w, a, b, res;
    in >> w >> a >> b;

    res = max(0, max(a, b) - min(a, b) - w);
    out << res << endl;
	}
};


int main() {
	B solver;
	std::istream& in(std::cin);
	std::ostream& out(std::cout);
	solver.solve(in, out);
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(void){
   string s,p;
   cin>>s>>p;
    
   string ans="No";
   for(int i=0;i<(int)s.length();i++){
       bool flag=true;
       for(int j=0; j<(int)p.length();j++){
           if(s[(i+j)%(int)s.length()]!=p[j]){
               flag=false;
               break;
           }
       }
       if(flag){
           ans="Yes";
           break;
       }
   }
   cout<<ans<<endl;
}


Measured memory_bytes: 3216
import sys
input = sys.stdin.readline
N,Y = map(int,input().split())
for i in range(N + 1):
    for j in range(N + 1- i):
        if i * 10000 + j * 5000 + (N - i - j) * 1000 == Y:
            print(i, j, N - i - j)
            exit()
print("-1 -1 -1")


Measured memory_bytes: 2940
import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		long a = sc.nextLong();
		long b = sc.nextLong();
		System.out.println(mini(a,b));
	}
	public static long mini(long a, long b) {
		long temp;
		long c = a*b;
		while((temp = a%b) != 0) {
			a = b;
			b = temp;
		}
		return c/b;
	}
}

Measured memory_bytes: 23764
/* ex5-3
   Sagzar1993  */

#include <stdio.h>
#define LIM 100 //行数、列数の上限

int main(void) {
    int row, col; //行と列の数
    int i, j;
    scanf("%d %d", &row, &col); //行数、列数の入力
    char colors[row][col]; //記号の配列
    int whiteRow[LIM] = {0}; //各行のマス目が全て白なら1, 違えば0
    int whiteCol[LIM] = {0}; //各列のマス目が全て白なら1, 違えば0

    for(i = 0; i < row; i++){
        for(j = 0; j < col; j++){
            scanf(" %c", &colors[i][j]); //各マス目の色記号の入力
        }
    }


    for(i = 0; i < row; i++){
        for(j = 0; j < col; j++){
            if(colors[i][j] != '.'){
                break; //各行について、白でないマス目があれば終了して次の行へ
            }
        }
        if(j == col){
            whiteRow[i] = 1; //行の全てのマス目が白ならwhiteRowに1を保存
        }
    }
    
    for(j = 0; j < col; j++){
        for(i = 0; i < row; i++){
            if(colors[i][j] != '.'){
                break; //各列について、白でないマス目があれば終了して次の行へ
            }
        }
        if(i == row){
            whiteCol[j] = 1; //列の全てのマス目が白ならwhiteColに1を保存
        }
    }
    
    for(i = 0; i < row; i++){
        if(whiteRow[i] == 1){
            continue;  //各行について、whiteRowを参照し、その行の全てのマス目が白ならスキップ
        }

        for(j = 0; j < col; j++){
            if(whiteCol[j] == 1){
                continue; //各行の各列のマス目について、その列が全てのマス目が白である列ならスキップ
            }
            printf("%c", colors[i][j]); //そのマス目の行と列がともに全て白でないときは出力
        }
        printf("\n"); //各行について、全てのマス目を調べ終えたら改行
    }
    
    return 0;
}

Measured memory_bytes: 128
/*{{{*/
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<string>
#include<iostream>
#include<sstream>
#include<set>
#include<map>
#include<queue>
#include<bitset>
#include<vector>
#include<limits.h>
#include<assert.h>
#define SZ(X) ((int)(X).size())
#define ALL(X) (X).begin(), (X).end()
#define REP(I, N) for (int I = 0; I < (N); ++I)
#define REPP(I, A, B) for (int I = (A); I < (B); ++I)
#define FOR(I, A, B) for (int I = (A); I <= (B); ++I)
#define FORS(I, S) for (int I = 0; S[I]; ++I)
#define RS(X) scanf("%s", (X))
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define GET_POS(c,x) (lower_bound(c.begin(),c.end(),x)-c.begin())
#define CASET int ___T; scanf("%d", &___T); for(int cs=1;cs<=___T;cs++)
#define MP make_pair
#define PB push_back
#define MS0(X) memset((X), 0, sizeof((X)))
#define MS1(X) memset((X), -1, sizeof((X)))
#define LEN(X) strlen(X)
#define F first
#define S second
using namespace std;
typedef long long LL;
typedef unsigned long long ULL;
typedef long double LD;
typedef pair<int,int> PII;
typedef vector<int> VI;
typedef vector<LL> VL;
typedef vector<PII> VPII;
typedef pair<LL,LL> PLL;
typedef vector<PLL> VPLL;
template<class T> void _R(T &x) { cin >> x; }
void _R(int &x) { scanf("%d", &x); }
void _R(LL &x) { scanf("%lld", &x); }
void _R(double &x) { scanf("%lf", &x); }
void _R(char &x) { scanf(" %c", &x); }
void _R(char *x) { scanf("%s", x); }
void R() {}
template<class T, class... U> void R(T &head, U &... tail) { _R(head); R(tail...); }
template<class T> void _W(const T &x) { cout << x; }
void _W(const int &x) { printf("%d", x); }
void _W(const LL &x) { printf("%lld", x); }
void _W(const double &x) { printf("%.16f", x); }
void _W(const char &x) { putchar(x); }
void _W(const char *x) { printf("%s", x); }
template<class T,class U> void _W(const pair<T,U> &x) {_W(x.F); putchar(' '); _W(x.S);}
template<class T> void _W(const vector<T> &x) { for (auto i = x.begin(); i != x.end(); _W(*i++)) if (i != x.cbegin()) putchar(' '); }
void W() {}
template<class T, class... U> void W(const T &head, const U &... tail) { _W(head); putchar(sizeof...(tail) ? ' ' : '\n'); W(tail...); }
#ifdef HOME
 #define DEBUG(...) {printf("# ");printf(__VA_ARGS__);puts("");}
#else
 #define DEBUG(...)
#endif
int MOD = 1e9+7;
void ADD(LL& x,LL v){x=(x+v)%MOD;if(x<0)x+=MOD;}
/*}}}*/
const int SIZE = 1e6+10;
int main(){
    int A,B;R(A,B);
    W(max({A+B,A-B,A*B}));
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N;
  cin >> N;
 
  if (1 <= N <= 10000) {
    if(N%1000==0){
    cout << 0 << endl;
    }
    if(N%1000!=0){
    cout << (N/1000 + 1) *1000 - N << endl;
    }
  }
}

Measured memory_bytes: 3636
#include <bits/stdc++.h>
#define SIZE 10
#define PI 3.141592653589793

using namespace std;
typedef long long ll;

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

	int N;
	ll i,j;
	int tmp;
	int counter=0;
	ll answer=0;
	vector<int> given;

	cin >> N;

	for(i=1;i<=N;i++){
		if(i%3 && i%5) answer+=i;
	}

	cout << answer << endl;

	return 0;
}



Measured memory_bytes: 3648
#include <bits/stdc++.h>
using namespace std;
int main() {
  int N;
  cin >> N;
  if(N % 10 == 7 || (N / 10) % 10 == 7 || (N / 100) == 7)
    printf("Yes\n");
  else
    printf("No\n");
}

Measured memory_bytes: 3676
#include "bits/stdc++.h"
using namespace std;
#define ll long long int
#define rep(i,n) for( int i = 0; i < n; i++ )
#define rrep(i,n) for( int i = n; i >= 0; i-- )
#define REP(i,s,t) for( int i = s; i <= t; i++ )
#define RREP(i,s,t) for( int i = s; i >= t; i-- )
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define INF 2000000000
#define mod 1000000007
#define INF2 1000000000000000000


int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N, X;
    cin >> N >> X;
    int L[100010];
    rep(i, N) cin >> L[i];
    int ans = 0;
    int d = 0;
    rep(i, N) {
        if (d <= X) ans++;
        d += L[i];
    }
    if (d <= X) ans++;
    cout << ans << endl;

    return 0;
}


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

using ll = long long;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;


#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define all(x) (x).begin(),(x).end()
#define m0(x) memset(x,0,sizeof(x))

int dx4[4] = {1,0,-1,0}, dy4[4] = {0,1,0,-1};


int main()
{
    ll n,ans=0,now=1;
    cin>>n;
    vector<ll> a(n);
    for (int i = 0; i < n; i++)
    {
        cin>>a[i];
    }
    for (int i = 0; i < n; i++)
    {
        if(a[i]==now)
        {
            now++;
        }
        else
        {
            ans++;
        }
        
    }
    if(ans==n) ans=-1;
    cout<<ans<<endl;
    
    return 0;
}

Measured memory_bytes: 1920
#include <bits/stdc++.h>
using namespace std;
using P = pair<int, int>;

int main()
{
    int v, e;
    cin >> v >> e;
    vector<vector<int>> adj(v, vector<int>());
    vector<int> indeg(v, 0);
    for (int i = 0; i < e; i++) {
        int s, t;
        cin >> s >> t;
        adj[s].push_back(t);
        indeg[t]++;
    }

    queue<int> q;
    for (int i = 0; i < v; i++) {
        if (indeg[i] == 0) {
            q.push(i);
        }
    }

    vector<int> ans;
    while (!q.empty()) {
        int u = q.front();
        q.pop();
        ans.push_back(u);
        for (auto v : adj[u]) {
            indeg[v]--;
            if (indeg[v] == 0) {
                q.push(v);
            }
        }
    }

    for (auto u : ans) {
        cout << u << endl;
    }
}


Measured memory_bytes: 3752
from heapq import heappush, heappop, heapify
from collections import deque, defaultdict, Counter
import itertools
from itertools import permutations, combinations, accumulate, product, combinations_with_replacement
import sys
import bisect
import string
import math
import time


def I(): return int(input())
def S(): return input()
def MI(): return map(int, input().split())
def MS(): return map(str, input().split())
def LI(): return [int(i) for i in input().split()]
def LI_(): return [int(i)-1 for i in input().split()]
def StoI(): return [ord(i)-97 for i in input()]
def ItoS(nn): return chr(nn+97)
def input(): return sys.stdin.readline().rstrip()
def list2d(a, b, c): return [[c] * b for i in range(a)]
def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]
def list4d(a, b, c, d, e): return [[[[e] * d for j in range(c)] for j in range(b)] for i in range(a)]
def print_matrix(mat):
    for i in range(len(mat)):
        print(*['IINF' if v == IINF else "{:0=4}".format(v) for v in mat[i]])


yn = {False: 'No', True: 'Yes'}
YN = {False: 'NO', True: 'YES'}
MOD = 10**9+7
inf = float('inf')
IINF = 10**19
l_alp = string.ascii_lowercase
u_alp = string.ascii_uppercase
ts = time.time()
sys.setrecursionlimit(10**6)
nums = ['1', '2', '3', '4', '5', '6', '7', '8', '9', '10']
show_flg = False
# show_flg = True


def main():
    N, X, T = MI()
    a = (N + (X - 1)) // X

    print(a * T)


if __name__ == '__main__':
    main()


Measured memory_bytes: 68252
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace AtCoder
{

    class Program
    {
        static void Main()
        {
            Solve();

            Console.ReadKey();
        }

        static void Solve()
        {
            int N;int X;
            Multi(out N, out X);
            var m = new List<int>();
            for(int i = 0; i < N; i++)
            {
                m.Add(GetInt());
            }
            var ans = N + (X - m.Sum()) / m.Min();

            Console.Write(ans);
        }



        static public string GetStr() { return Console.ReadLine(); }
        static public int GetInt() { return int.Parse(Console.ReadLine()); }
        static public long GetLong() { return long.Parse(Console.ReadLine()); }
        static public string[] GetStrArray() { return Console.ReadLine().Split(' '); }
        static public int[] GetIntArray() { return Console.ReadLine().Split(' ').Select(int.Parse).ToArray(); }
        static public long[] GetLongArray() { return Console.ReadLine().Split(' ').Select(long.Parse).ToArray(); }
        static public List<double> GetDoubleList() { return Console.ReadLine().Split(' ').Select(double.Parse).ToList(); }
        static public void WriteObjects<T>(IEnumerable<T> values) { foreach (var o in values) { Console.Write(o + " "); } }

        static bool eq<T, U>() => typeof(T).Equals(typeof(U));
        static T ct<T, U>(U a) => (T)Convert.ChangeType(a, typeof(T));
        static T cv<T>(string s) => eq<T, int>() ? ct<T, int>(int.Parse(s))
                           : eq<T, long>() ? ct<T, long>(long.Parse(s))
                           : eq<T, double>() ? ct<T, double>(double.Parse(s))
                           : eq<T, char>() ? ct<T, char>(s[0])
                                             : ct<T, string>(s);
        static void Multi<T>(out T a) => a = cv<T>(GetStr());
        static void Multi<T, U>(out T a, out U b)
        {
            var ar = GetStrArray(); a = cv<T>(ar[0]); b = cv<U>(ar[1]);
        }
        static void Multi<T, U, V>(out T a, out U b, out V c)
        {
            var ar = GetStrArray(); a = cv<T>(ar[0]); b = cv<U>(ar[1]); c = cv<V>(ar[2]);
        }
    }
}

Measured memory_bytes: 13268
//https://atcoder.jp/contests/abc163/tasks/abc163_e
//ABC100Dやれ
#include <bits/stdc++.h>
#if LOCAL
#include "dump.hpp"
#else
#define dump(...)
#endif
using namespace std;
using ll=long long;
const ll LINF = 0x1fffffffffffffff;
#define FOR(i,a,b) for(ll i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,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;}
int main() {
#if LOCAL&01
  std::ifstream in("./test/sample-1.in");
  //std::ifstream in("./input.txt");
  std::cin.rdbuf(in.rdbuf());
#else
  cin.tie(0);
  ios::sync_with_stdio(false);
#endif
  ll N; cin>>N;
  using pair=pair<ll,ll>; //ai,i
  vector<pair> an(N+1);
  FOR(i,1,N+1){
    auto && p=an.at(i);
    cin>>p.first;
    p.second=i;
  }
  sort(an.begin()+1,an.end());
  reverse(an.begin()+1,an.end());

  vector<vector<ll>> dp(N+1,vector<ll>(N+1));//左,右
  FOR(i,0,N){
    const auto& pa=an.at(i+1);
    FOR(x,0,i+1){
      ll y=i-x;
      dump(x,y);
      chmax(dp[x+1][y],dp[x][y]+pa.first*abs(pa.second-(x+1)));
      chmax(dp[x][y+1],dp[x][y]+pa.first*abs(pa.second-(N-y)));
    }
  }
  dump(dp);
  ll ans=0;
  FOR(i,0,N+1){
    FOR(j,0,N+1){
      chmax(ans,dp[i][j]);
    }
  }
  cout<<ans<<endl;

  return 0;
}
int main_() {
  ll N; cin>>N;
  vector<ll> an(N+1);
  FOR(i,1,N+1){
    cin>>an.at(i);
  }
  using p = pair<ll,ll>;
  vector<p> lr(N+1);
  ll lp=1,rp=N; //いれれる

  ll ans=0;
  FOR(j,1,N+1){
    ll lv=-1;
    ll l_pos=-1;
    FOR(i,1,N+1){
      ll v=an.at(i)*(i-lp);
      if (chmax(lv,v)){
        l_pos=i;
      }
    }
    ll rv=-1;
    ll r_pos=-1;
    FOR(i,1,N+1){
      ll v=an.at(i)*(rp-i);
      if(chmax(rv,v)){
        r_pos=i;
      }
    }
    if(lv>rv){

    }
  }

  return 0;
}

Measured memory_bytes: 34620
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
#define int long long int
// #define ll int128_t
#define ld long double
#define ff first
#define ss second
#define mp make_pair
#define IOS std::ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define pb push_back
#define eb emplace_back
#define pii pair<int, int>
#define endl '\n'
#define all(x) x.begin(),x.end()
#define f(i,j,l) for(i=j;i<l;i++)
#define smax(a,b) a=max(a,b)
// #if !defined(ONLINE_JUDGE)
// #include "debugging.h"
// #endif
template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
// find_by_order(k)  returns iterator to kth element starting from 0;
// order_of_key(k) returns count of elements strictly smaller than k;
// erase,insert same as normal set

// int const mod = 7340033;
int const mod = 998244353;
int power(int a,int b,int m){
    int res = 1;
    while(b){
        if(b&1){
            res = res*a;
            res %= m;
        }
        a=a*a;
        a%=m;
        b=b/2;
    }
    return res;
}

int inverse(int x){
    return power(x,mod-2,mod);
}

int const N = 2e5+555;
int const inf = 2e16;



void solve(){  
    int i,j,l;
    string s;
    cin >> s;
    cout<<s[0]<<s[1]<<s[2]<<endl;
}           


int32_t main(){
    IOS;
    int t;
    t = 1;
    // precompute();
    // cin>>t;
    for(int tt=1;tt<=t;tt++){
        solve();
    }
    return 0;
}


/*



*/

Measured memory_bytes: 3616
import java.util.Arrays;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int res = 0;
        int N = sc.nextInt();
        int[] L = new int[N];
        for(int i = 0; i < N; i++) L[i] = Integer.parseInt(sc.next());
        Arrays.sort(L);
        for(int i = 0; i < N; i++) {
            for(int j = i + 1; j < N; j++) {
               for(int k = j + 1; k < N; k++) if(L[i] + L[j] > L[k]) res++;
               else break;
            }
        }
        System.out.println(res);
    }
}


Measured memory_bytes: 25772
// A.

#include <iostream>
#include <sstream>
#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <vector>

using namespace std;

typedef pair<int, int> II;

int main(int argc, char* argv[]) {
	int h, w;
	cin >> h >> w;
	vector<string> b(h);
	vector<vector<int>>vis(h, vector<int>(w, -1));
	int sr = 0, sc = 0;
	for (int i = 0; i < h; ++i) {
		cin >> b[i];
	}
	vector<II> q;
	int dx[4] = { -1,1,0,0 };
	int dy[4] = { 0,0,-1,1 };
	for (int i = 0; i < h; ++i) {
		for (int j = 0; j < w; ++j) {
			if (b[i][j] != '#') continue;
			for (int d = 0; d < 4; ++d) {
				int ny = i + dy[d], nx = j + dx[d];
				if (ny >= 0 && ny < h && nx >= 0 && nx < w && b[ny][nx] == '.') {
					b[ny][nx] = '-';
					q.push_back({ ny, nx });
				}
			}
		}
	}
	int ans;
	for (ans = 0; q.size(); ++ans) {
		vector<II> nq;
		for (auto kv : q) {
			for (int d = 0; d < 4; ++d) {
				int ny = kv.first + dy[d], nx = kv.second + dx[d];
				if (ny >= 0 && ny < h && nx >= 0 && nx < w && b[ny][nx] == '.') {
					b[ny][nx] = '-';
					nq.push_back({ ny, nx });
				}
			}
		}
		q = nq;
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 15468
// May this submission get accepted!

#pragma GCC optimize ("O3")
#pragma GCC target ("tune=native")
#pragma GCC target ("avx")

#include <bits/stdc++.h>

// 汎用マクロ
#define ALL_OF(x) (x).begin(), (x).end()
#define REP(i,n) for (long long i=0, i##_len=(n); i<i##_len; i++)
#define RANGE(i,is,ie) for (long long i=(is), i##_end=(ie); i<=i##_end; i++)
#define DSRNG(i,is,ie) for (long long i=(is), i##_end=(ie); i>=i##_end; i--)
#define UNIQUE(v) { sort((v).begin(), (v).end()); (v).erase(unique((v).begin(), (v).end()), (v).end()); }
template<class T> bool chmax(T &a, const T &b) {if (a < b) {a = b; return true;} return false; }
template<class T> bool chmin(T &a, const T &b) {if (a > b) {a = b; return true;} return false; }
#define INF 0x7FFFFFFF
#define LINF 0x7FFFFFFFFFFFFFFFLL
#define Yes(q) ((q) ? "Yes" : "No")
#define YES(q) ((q) ? "YES" : "NO")
#define Possible(q) ((q) ? "Possible" : "Impossible")
#define POSSIBLE(q) ((q) ? "POSSIBLE" : "IMPOSSIBLE")
#define DUMP(q) cerr << "[DEBUG] " #q ": " << (q) << " at " __FILE__ ":" << __LINE__ << endl
#define DUMPALL(q) { cerr << "[DEBUG] " #q ": ["; REP(i, (q).size()) { cerr << (q)[i] << (i == i_len-1 ? "" : ", "); } cerr << "] at " __FILE__ ":" << __LINE__ << endl; }
template<class T> T gcd(const T &a, const T &b) { return a < b ? gcd(b, a) : b ? gcd(b, a % b) : a; }
template<class T> T lcm(const T &a, const T &b) { return a / gcd(a, b) * b; }

// gcc拡張マクロ
#define popcount __builtin_popcount
#define popcountll __builtin_popcountll

// エイリアス
#define DANCE_ long
#define ROBOT_ unsigned
#define HUMAN_ signed
#define CHOKUDAI_ const
using  ll = DANCE_ HUMAN_ DANCE_;
using ull = DANCE_ ROBOT_ DANCE_;
using cll = DANCE_ DANCE_ CHOKUDAI_;
using  ld = long double;
using namespace std;

// モジュール


// 処理内容
int main() {
    
    ll n; cin >> n;
    vector<ll> a(n);
    REP(i, n) cin >> a[i];
    
    vector<ll> acmx(n);
    vector<ll> nonzero; nonzero.reserve(n);
    vector<ll> scmx(n);
    REP(i, n) {
        acmx[i] = !i ? a[i] : max(acmx[i-1], a[i]);
        if (!i || acmx[i-1] != acmx[i]) {
            nonzero.push_back(i);
        }
    }
    REP(i, n) {
        ll j = lower_bound(ALL_OF(acmx), acmx[i]) - acmx.begin();
        scmx[i] = !j ? 0 : acmx[j-1];
    }
    
    // DUMPALL(acmx);
    // DUMPALL(scmx);

    vector<ll> asr = a;
    sort(ALL_OF(asr), greater<ll>());
    vector<ll> asrimos(n+1, 0);
    REP(i, n) asrimos[i+1] = asrimos[i] + asr[i];

    // DUMPALL(asr);
    // DUMPALL(asrimos);

    vector<ll> ans(n, 0);
    ll prev = 0;
    DSRNG(_i, nonzero.size()-1, 1) {
        ll i = nonzero[_i];
        ll je = lower_bound(ALL_OF(asr), scmx[i], greater<ll>()) - asr.begin();
        ll term = asrimos[je] - je * scmx[i];
        ans[i] = term - prev;
        prev = term;
    }
    
    ans[0] = accumulate(ALL_OF(a), 0LL) - prev;

    REP(i, n) cout << ans[i] << '\n';
    
}

Measured memory_bytes: 6528
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
ll sum,a[123],n,k,b[123];

bool ju()
{
	for(int i=1;i<=n;++i)
	if(b[i]>n-1)return 1;
	return 0;
}

bool can(ll m)
{
	ll ret=0;
	for(int i=1;i<=n;++i)b[i]=a[i];
	while(ju())
	{
		ll cnt=0;
		for(int i=1;i<=n;++i)cnt+=b[i]/n;
		for(int i=1;i<=n;++i)
		b[i]=(cnt-b[i]/n)+(b[i]%n);
		ret+=cnt;
		if(ret>m)
			return 0;
	}
	return 1;
}

int main()
{
	cin>>n;
	for(int i=1;i<=n;++i)cin>>a[i],sum+=a[i];
	ll l=-1,r=sum;
	while(r-l>1)
	{
		ll mid=(l+r)>>1;
		if(!can(mid))	l=mid;
		else			r=mid;
	}
	cout<<r;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<set>
using ll = long long;
using namespace std;

int main(){
    ll n,m,x,y,x_max=-100000,y_min=100000,X,Y;
    bool flag=false;
    cin >> n >> m >> X >> Y;
    for(ll i=0;i<n;i++){
         cin >> x;
         x_max = max(x_max,x);
    }
    for(ll i=0;i<m;i++){
         cin >> y;
         y_min = min(y_min,y);
    }
    for(ll i=X+1;i<=Y;i++){
        if(x_max<i&&i<=y_min) flag = true;
    }
    if(!flag) cout << "War\n";
    else cout << "No War\n";
    return 0;
}

Measured memory_bytes: 256