akhauriyash/Code-Regression huggingface dataset:
import sys
sys.setrecursionlimit(10**6)
input = sys.stdin.readline
inf = float('inf')

n,m = map(int,input().split())
pathT = [{} for _ in range(n)]
for i in range(m):
    x,y,t = map(int,input().split())
    x -= 1
    y -= 1
    pathT[x][y] = t
    pathT[y][x] = t

import heapq 
def Dijkstra(edge,start):
    d = [[float('inf'),float('inf')] for _ in range(len(edge))]
    d[start][0] = 0
    pq = [(0,start,0)]
    heapq.heapify(pq)
    while pq:
        dist,p,flag = heapq.heappop(pq)
        toflag = flag or (p%n == n-1)
        if dist > d[p][flag]:continue
        for to,cost in edge[p].items():
            if d[to][toflag] <= dist + cost:continue
            d[to][toflag] = dist + cost
            heapq.heappush(pq, (d[to][toflag], to, toflag))
    return d

v0 = int(input())
a,b,c = map(int,input().split())
V = [v0]
v = v0
Vs = set()
while True:
    v = (a*v + b)%c
    if v in Vs:
        loop = V.index(v)
        break
    # print(v)
    V.append(v)
    Vs.add(v)
p = len(V)

path = [{} for _ in range(p*n)]
for now,nxtD in enumerate(pathT):
    for i,v in enumerate(V):
        for nxt,t in nxtD.items():
            if i+1 != p:
                path[i*n + now][(i+1)*n + nxt] = t*v
            else:
                path[i*n + now][loop*n + nxt] = t*v

d = Dijkstra(path,0)
ans = float('inf')
for i in range(p):
    ans = min(ans, d[i*n][1])
    # d2 = Dijkstra(path,i*n + n-1)
    # # res = float('inf')
    # for j in range(p):
    #     # res = min(res, d2[j*n])
    #     ans = min(ans, d[i*n + n-1] + d2[j*n])
print(ans)



Measured memory_bytes: 59604
#include<bits/stdc++.h>
#define IOS ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
using namespace std;
#define watch(x) cout<<(#x)<<" is "<<x<<endl;
#define ll long long int
#define pb push_back
#define in insert
#define mp make_pair
#define F first
#define S second
#define N 1000000
#define MOD 1000000007
#define PI acos(-1)
int main()
{
	IOS
	string s;
	cin>>s;
	if(s=="ABC")
	cout<<"ARC";
	else
	cout<<"ABC";
}

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

int main(){
	ll d,t,s;
	cin >> d >> t >> s;
	if(s * t >= d){
		cout << "Yes" << endl;
	}else{
		cout << "No" << endl;
	}
    return 0;
}



Measured memory_bytes: 3624
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
const int INF = 1e9;
const ll LINF = 1e18;

/*
<url:https://agc008.contest.atcoder.jp/tasks/agc008_a>
問題文============================================================
 すぬけ君は電卓を持っています。 この電卓にはディスプレイと 2 個のボタンが付いています。
 
 最初、ディスプレイの値は整数 x です。
 すぬけ君の目標は、ディスプレイの値を整数 y にすることです。
 そのために、すぬけ君は次の 2 個のボタンを好きな順番で何回か押すことができます。
 
 ボタン A : ディスプレイの値を 1 増やす。
 ボタン B : ディスプレイの値の符号を反転する。
 目標を達成するためにすぬけ君がボタンを押す回数の最小値を求めてください。
 なお、整数 x, y の値によらず、必ず目標を達成できることが示せます。
=================================================================

解説=============================================================

 x,yの符号が一致しており、かつ y - x >= 0 となれば答えは y - xとなる
 よって、x,yの符号をそれぞれ変化させた時、上記条件を満たす最小の値を求めれば良い
 
================================================================
*/
ll F(ll x,ll y){
    if(y - x >= 0) return y - x;
    else return LINF;
}
int main(void) {
	cin.tie(0); ios::sync_with_stdio(false);
    ll x,y; cin >> x >> y;
    cout << min({F(x,y),F(x,-y)+1,F(-x,y)+1,F(-x,-y)+2}) << endl;
	return 0;
}


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

using namespace std;

#define REP(i,a,b) for(int i=a;i<(int)b;i++)
#define rep(i,n) REP(i,0,n)
#define all(c) (c).begin(), (c).end()
#define zero(a) memset(a, 0, sizeof a)
#define minus(a) memset(a, -1, sizeof a)
#define watch(a) { cout << #a << " = " << a << endl; }
template<class T1, class T2> inline bool minimize(T1 &a, T2 b) { return b < a && (a = b, 1); }
template<class T1, class T2> inline bool maximize(T1 &a, T2 b) { return a < b && (a = b, 1); }

typedef long long ll;
int const inf = 1<<29;

int main() {

  int N; cin >> N;
  vector<int> ps(N);
  rep(i, N) {
   scanf("%d", &ps[i]); ps[i]--;
  }

  static const int Max = 40010;

  vector<int> A(N), B(N);
  rep(i, N) {
    A[i] = B[N-1-i] = Max * i + 1;
  }

  rep(i, N) A[ps[i]] += i;

  rep(i, N) {
   printf("%d%c", A[i], " \n"[i == N-1]);
  }
  rep(i, N) {
   printf("%d%c", B[i]," \n"[i == N-1]);
  }
  
  return 0;
}

Measured memory_bytes: 896
n = int(input())
s = list(input())
answer = []

alpha = ["A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"]

for let in s:
    originalIndex = alpha.index(let)
    if originalIndex+n > len(alpha) - 1:
        answer.append(alpha[originalIndex+n-len(alpha)])
    else:
        answer.append(alpha[originalIndex+n])

print("".join(answer))

Measured memory_bytes: 3188
from collections import Counter
S = list(input())
abc = [chr(ord('a') + i) for i in range(26)]

ans = 100000
for s in abc:
    result = S
    count = 0
    while len(set(result)) > 1:
        count += 1
        tmp = ["dd"] * (len(result) - 1)
        for i in range(len(result)-1):
            if result[i] == s or result[i+1] == s:
                tmp[i] = s
            else:
                tmp[i] = result[i]
        result = tmp
    ans = min(ans, count)

print(ans)

Measured memory_bytes: 3316
#include <bits/stdc++.h>
#define f first
#define s second
#define MP make_pair
#define PB push_back
#define LL long long
#define pii pair<int,int>
#define pll pair<LL,LL>
#define ALL(V) V.begin(),V.end()
#define f1(a,b) for(int a=1;a<=b;a++)
#define f0(a,b) for(int a=0;a<b;a++)
#define boost ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define endl "\n"
#define de(x) cerr<<#x<<": "<<x<<endl
using namespace std;
const LL N=1e6+69, base=1024*1024,mod=1e9+7;
int n,w[5][5],t[5][5],wy;
bool test() {
    f0(i,n) w[1][i]=t[0][i]-w[0][0];
    for(int i=1;i<3;i++) w[0][i]=t[i][0]-w[1][0];
    //f0(i,3) cout<<w[0][i]<<" ";
    //cout<<endl;
    //f0(i,3) cout<<w[1][i]<<" ";
    //cout<<endl;
    f0(i,3) {
        //if(w[0][i]+w[1][j]!=t[i][j]) return 0;
        f0(j,3) {
            if(w[0][i]+w[1][j]!=t[i][j]) return 0;
        }
    }
    return 1;
}
int32_t main(void) {
    boost;
    n=3;
    f0(i,n) {
        f0(j,n) {
            cin>>t[i][j];
        }
    }
    for(int i=-1e4;i<=1e4;i++) {
        w[0][0]=i;
        if(test()) wy++;
    }
    //cout<<wy<<endl;
    if(wy>0) cout<<"Yes\n";
    else cout<<"No\n";
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
const int N = 100010;
inline int read()
{
  int p=0; int f=1; char ch=getchar();
  while(ch<'0' || ch>'9'){if(ch=='-') f=-1; ch=getchar();}
  while(ch>='0' && ch<='9'){p=p*10+ch-'0'; ch=getchar();}
  return p*f;
}
int n,a[N]; set<int> s1[N],s2[N]; int num[N];
int fa[N]; int Find(int x){return (fa[x] == x) ? x : fa[x] = Find(fa[x]);}
int main()
{
  n = read(); int q = read(); for(int i=1;i<=n;i++) a[i] = read();
  for(int i=1;i<=n;i++) s1[i].insert(i),s2[i].insert(a[i]),num[i] = i,fa[i]=i;
  while(q--)
  {
    int x = read(); int y = read();
    if(Find(x) != Find(y))
    {
      x = Find(x); y = Find(y);
      fa[x] = y;
      if(s1[num[y]].size() > s1[num[x]].size())
      {
		while(s1[num[x]].size())
		{
	      s1[num[y]].insert(*s1[num[x]].begin()),s1[num[x]].erase(s1[num[x]].begin());
	      s2[num[y]].insert(*s2[num[x]].begin()),s2[num[x]].erase(s2[num[x]].begin());
	    }
      }
      else
      {
        while(s1[num[y]].size())
        {
          s1[num[x]].insert(*s1[num[y]].begin()),s1[num[y]].erase(s1[num[y]].begin());
          s2[num[x]].insert(*s2[num[y]].begin()),s2[num[y]].erase(s2[num[y]].begin());
        }
		num[y] = num[x];
      }
    }
  }
  
  int ans = 0;
  for(int i=1;i<=n;i++)
  {
    if(Find(i) == i)
    {
      while(s2[num[i]].size())
      {
        int x = *s2[num[i]].begin(); 
        s2[num[i]].erase(s2[num[i]].begin());
        if(s1[num[i]].find(x) != s1[num[i]].end()) ans++;
      }
      
    }
  }
  printf("%d\n",ans);
  return 0;
}

Measured memory_bytes: 20224
#include <iostream>
#include <utility>
#include <tuple>
#include <string>
#include <cstdint>
#include <vector>
#include <array>
#include <queue>
#include <set>
#include <map>
#include <algorithm>
#include <cmath>
#include <cassert>
using namespace std;
using i64 = int64_t;
struct E { int v, w; };
int id(int u) { return 20 - u; }
int l;
vector<E> g[20];
int main() {
    cin >> l;
    for (int u = 19; u > 0; --u) {
        g[u].push_back({ u - 1, 0 });
    }
    for (int i = 0; (1 << (i + 1)) <= l; ++i) {
        g[i + 1].push_back({ i, 1 << i });
    }
    for (int i = 0; i < 19; ++i) {
        if ((l & (1 << i))) {
            int x = l & ~((1 << (i + 1)) - 1);
            if (x != 0) {
                g[19].push_back({ i, x });
            }
        }
    }
    int size = 0;
    for (int u = 0; u < 20; ++u) size += g[u].size();
    cout << 20 << ' ' << size << endl;
    for (int u = 19; u >= 0; --u) {
        for (E e : g[u]) {
            cout << id(u) << ' ' << id(e.v) << ' ' <<  e.w << endl;
        }
    }
    return 0;
}

Measured memory_bytes: 256
#define MOD_TYPE 1

#pragma region Macros
#include <bits/stdc++.h>
using namespace std;
/*
#include <boost/multiprecision/cpp_int.hpp>
#include <boost/multiprecision/cpp_dec_float.hpp>
using multiInt = boost::multiprecision::cpp_int;
using lld = boost::multiprecision::cpp_dec_float_100;
*/

#pragma GCC target("avx2")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")

using ll = long long int;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using pld = pair<ld, ld>;
template <typename Q_type>
using smaller_queue = priority_queue<Q_type, vector<Q_type>, greater<Q_type>>;

constexpr ll MOD = (MOD_TYPE == 1 ? (ll)(1e9 + 7) : 998244353);
//constexpr ll MOD = 1;
constexpr int INF = (int)1e9;
constexpr ll LINF = (ll)4e18;
constexpr double PI = acos(-1.0);
constexpr double EPS = 1e-10;
constexpr int Dx[] = {0, 0, -1, 1, -1, 1, -1, 1, 0};
constexpr int Dy[] = {1, -1, 0, 0, -1, -1, 1, 1, 0};

#define REP(i, m, n) for (ll i = m; i < (ll)(n); ++i)
#define rep(i, n) REP(i, 0, n)
#define REPI(i, m, n) for (int i = m; i < (int)(n); ++i)
#define repi(i, n) REPI(i, 0, n)
#define MP make_pair
#define MT make_tuple
#define YES(n) cout << ((n) ? "YES" : "NO") << "\n"
#define Yes(n) cout << ((n) ? "Yes" : "No") << "\n"
#define possible(n) cout << ((n) ? "possible" : "impossible") << "\n"
#define Possible(n) cout << ((n) ? "Possible" : "Impossible") << "\n"
#define Yay(n) cout << ((n) ? "Yay!" : ":(") << "\n"
#define all(v) v.begin(), v.end()
#define NP(v) next_permutation(all(v))
#define dbg(x) cerr << #x << ":" << x << "\n";

inline void init_main()
{
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << setprecision(30) << setiosflags(ios::fixed);
}
template <typename T>
inline bool chmin(T &a, T b)
{
  if (a > b)
  {
    a = b;
    return true;
  }
  return false;
}
template <typename T>
inline bool chmax(T &a, T b)
{
  if (a < b)
  {
    a = b;
    return true;
  }
  return false;
}
inline ll CEIL(ll a, ll b)
{
  return (a + b - 1) / b;
}
template <typename A, size_t N, typename T>
inline void Fill(A (&array)[N], const T &val)
{
  fill((T *)array, (T *)(array + N), val);
}
template <typename T, typename U>
constexpr ostream &operator<<(ostream &os, pair<T, U> &p) noexcept
{
  os << p.first << " " << p.second;
  return os;
}
#pragma endregion

void solve()
{
 int a,b;
 cin >> a>>b;
 cout << a*b << endl;
}

int main()
{
  init_main();

  solve();

  return 0;
}

Measured memory_bytes: 3652
#include <bits/stdc++.h>
#define rep(i,n) for (int i=0; i < (n); i++)
using namespace std;
using ll = long long;

int main(){
    int X,Y;
    cin >> X >> Y;
    
    int asi_max = X * 4;
    int asi_min = X * 2;
    
    if(asi_min <= Y && Y <= asi_max && Y%2==0){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
}


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

using namespace std;

int main()
{
	int N;
	cin >> N;

	vector<int> V(N);
	vector<int> C(N);

	for (auto &x : V) cin >> x;
	for (auto &x : C) cin >> x;

	int ans = 0;
	for (int m = 0; m < (1 << N); ++m) {
		int sum = 0;
		for (int i = 0; i < N; ++i) {
			if (m & (1 << i)) {
				sum += V[i] - C[i];
			}
		}
		ans = max(ans, sum);
	}
	cout << ans << endl;
}


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

int N;

void dfs(string s,char mx){
    if(s.length()==N){
        cout<<s<<endl;
    }
    else{
        for (char c ='a'; c<=mx;c++ ){
            dfs(s+c,((c==mx)? (char)(mx+1):mx));
        }
    }
}

int main(){
    cin>>N;
    dfs("",'a');
    return 0;
}

Measured memory_bytes: 3508
#include <algorithm>
#include <array>
#include <iostream>
#include <vector>

const int NUM = 3;

template<typename T>
class Table : public std::vector<std::vector<T>> {
public:
	using std::vector<std::vector<T>>::vector;

	Table(int y, int x, T value)
		: Table(y, std::vector<T>(x, value))
	{ }
};

int N;
std::vector<std::array<int, NUM>> a;

// day-1日目に index番目の行動をとる場合の最大スコア
int score(int day, int index) {
	static Table<int> memo(N, NUM, -1);
	const auto getMemo = [&](int d, int i) -> int& {
		return memo.at(d).at(i);
	};
	const auto valid = [&](int d, int i) {
		return getMemo(d, i) != -1;
	};

	if(valid(day, index)) {
		return getMemo(day, index);
	} else {
		int result = 0;
		if(day == 0) {
			result = a.at(day).at(index);
		} else {
			std::vector<int> list;
			for(int i = 0; i < NUM; i++) {
				if(i != index) {
					list.emplace_back(score(day - 1, i));
				}
			}
			const int max = *std::max_element(list.begin(), list.end());
			result = max + a.at(day).at(index);
		}
		getMemo(day, index) = result;
		return result;
	}
}

int main() {
	std::cin >> N;
	a.resize(N);
	for(auto &list : a) {
		for(auto &aa : list) {
			std::cin >> aa;
		}
	}

	std::vector<int> list;
	for(int i = 0; i < NUM; i++) {
		list.emplace_back(score(N - 1, i));
	}
	const auto result = *std::max_element(list.begin(), list.end());

	std::cout << result << std::endl;

	return 0;
}

Measured memory_bytes: 19328
XS = list(map(int, open(0).read().split()))
B = ["#."*150, ".#"*150]
for i in range(0, len(XS), 2):
    H = XS[i]
    W = XS[i+1]
    if H == 0 and W == 0:
        break
    for j in range(H):
        print(B[j%2][0:W])
    print("")


Measured memory_bytes: 5636
#include <bits/stdc++.h>
using namespace std;
#define rep(i, c) for (int i = 0; i < (int)c; i++)
using ll = long long;
int main()
{
	ll n, d;
	cin >> n >> d;
	ll count = 0;
	rep(i, n) {
		ll x, y;
		cin >> x >> y;
		if((d * d) >= (x * x + y * y)) count++;
	}
	cout << count << endl;
	return 0;
}

Measured memory_bytes: 3592
#include <iostream>

using ulong = unsigned long int;

int main() {
    ulong n, x;
    ulong minM = 200000;

    std::cin >> n >> x;

    int count = 0;
    for (int i = 0; i < n; ++i) {
        ulong m;
        std::cin >> m;
        minM = m < minM ? m : minM;
        x -= m;
        count++;
    }

    count += x/minM;

    std::cout << count << std::endl;

    return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;
import java.util.Set;
import java.util.TreeSet;

public class Main{
  public static void main(String[] args){
	  Scanner sc = new Scanner(System.in);
	  int x=sc.nextInt(),n=sc.nextInt(),min=Integer.MAX_VALUE,res=0;
	  Set<Integer> set=new TreeSet<>();
	  for(int i=0;i<n;i++)set.add(sc.nextInt());
	  if(set.contains(x)) {
		 for(int i=-200;i<=200;i++) {
			 if(set.contains(i))continue;
			 if(min>Math.abs(x-i)) {
				 res=i;
				 min=x-i;
			 }
		 }
		 System.out.println(res);
	  }else {
		  System.out.println(x);
	  }
  }
}



Measured memory_bytes: 36176
#include "bits/stdc++.h"
using namespace std;
#define ll long long
#define pb push_back
#define all(_obj) _obj.begin(),_obj.end()
#define F first
#define S second
#define INF 1e18
#define pll pair<ll, ll> 
#define vll vector<ll>
#define deb(x) cerr<<#x<<' '<<'='<<' '<<x<<'\n'
ll n,m,a,b,c,k,temp,x,y;
const int MAXN=1e5+11;
inline ll max(ll a,ll b) {return ((a>b)?a:b);}
inline ll min(ll a,ll b) {return ((a>b)?b:a);}
inline ll gcd(ll a ,ll b) {if(b==0) return a;a%=b;return gcd(b,a);}
inline vll read(int n) {vll v(n);for (int i = 0; i < v.size(); i++)cin>>v[i];return v;}
void solveforthiscase(const int & test)
{
cin>>n;
for(int i=1;i<=n;i++)
{
    cin>>a;
    if(i&1 && a&1)
    b++;
}
cout<<b;








return ;
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    clock_t start, end;
    start = clock(); 
    int test=1;
    //cin>>test;
    for(int i=1;i<=test;i++)
    solveforthiscase(i);
    end = clock(); 
    long double t_t = (long double)(end - start) /(long double)(CLOCKS_PER_SEC); 
    cerr << (long double)t_t*1000<< " ms ";
}


Measured memory_bytes: 3756
#include <iostream>
#include <vector>
#include <queue>
#include <stack>
#include <algorithm>
#include <math.h>
#include <string>
#include <cstring>
#include <set>
#include <map>
#include <unordered_map>

using namespace std;

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

#define ri(a) scanf("%d", &a)
#define rii(a,b) scanf("%d %d", &a, &b)
#define riii(a,b,c) scanf("%d %d %d", &a, &b, &c)
#define rl(a) scanf("%lld", &a)
#define rll(a,b) scanf("%lld %lld", &a, &b)
#define FOR(i,n,m) for(int i=n; i<m; i++)
#define ROF(i,n,m) for(int i=n; i>m; i--)
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define F first
#define S second

const int INF = 0x3f3f3f3f;
const ll LLINF = 1e18;
const int maxN = 1e5; // CAMBIAR ESTE

// GJNM

int main(){
	ll x;
	rl(x);
	ll circle = 360;
	while(circle%x != 0)
		circle += 360;
	printf("%lld\n", circle/x);
	return 0;
}

Measured memory_bytes: 3808
#include <bits/stdc++.h>
using namespace std;
int main()
{
    int n,k,c;
    string s;
    cin>>n>>k>>c;
    cin>>s;
    vector<int>A;
    vector<int>B;
    for (int i = 0;i<n;i++){
        if (s[i]=='o'){
            A.push_back(i);
            i+=c;
        }
    }
    for (int i = n-1;i>=0;i--){
        if (s[i]=='o'){
            B.push_back(i);
            i-=c;
        }
    }
    for (int i = 0;i<k;i++){
        if (A[i]==B[k-i-1]){
            cout<<A[i]+1<<endl;
        }
    }
    return 0;
}

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

int main(void){
    int n;
    cin >> n;
    vector<int> a(n + 1);
    for(int i = 0; i < n + 1; ++i){
	cin >> a[i];
    }
    vector<ll> s(n + 1);
    s[n] = a[n];
    for(int i = n - 1; i >= 0; --i){
	s[i] = s[i + 1] + a[i];
    }
    vector<ll> ans(n + 1);
    ans[0] = 1;
    ll x = 1;
    for(int i = 1; i < n + 1; ++i){
	if(ans[i - 1] - a[i - 1] > 0){
	    ans[i] = min(2 * (ans[i - 1] - a[i - 1]), s[i]);
	    x += ans[i];
	}else{
	    cout << "-1" << endl;
	    return 0;
	}
    }
    if(a[0] > 1 || (a[0] == 1 && n != 0) || a[n] != ans[n]){
	cout << "-1" << endl;
    }else{
	cout << x << endl;
    }
    
    return 0;
}


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

typedef long long ll;
const int MAX_N = 100030;    // Change as necessary
const ll  MODD = 1000000009; //

void do_case(){
  
}

int main(){
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  
  string s; cin >> s;
  for(int i=0;i<s.length();i++){
    string t = s.substr(i,3);
    if(t.length() == 3 && (t[0] == t[1] || t[0] == t[2] || t[1] == t[2])){
      cout << i+1 << " " << i+3 << endl;
      return 0;
    }
    t = s.substr(i,2);
    if(t.length() == 2 && (t[0] == t[1])){
      cout << i+1 << " " << i+2 << endl;
      return 0;
    }
  }
  cout << -1 << " " << -1 << endl;
  
  return 0;
}


Measured memory_bytes: 512
/*
Rathin Bhargava
IIIT Bangalore

*/
#include<bits/stdc++.h>
#define mt make_tuple
#define mp make_pair
#define pu push_back
#define INF 1000000001
#define MOD 1000000007
#define EPS 1e-6
#define ll long long int
#define ld long double
#define fi first
#define se second
#define all(v) v.begin(),v.end()
#define pr(v) { for(int i=0;i<v.size();i++) { v[i]==INF? cout<<"INF " : cout<<v[i]<<" "; } cout<<endl;}
#define t1(x)                cerr<<#x<<" : "<<x<<endl
#define t2(x, y)             cerr<<#x<<" : "<<x<<" "<<#y<<" : "<<y<<endl
#define t3(x, y, z)          cerr<<#x<<" : " <<x<<" "<<#y<<" : "<<y<<" "<<#z<<" : "<<z<<endl
#define t4(a,b,c,d)          cerr<<#a<<" : "<<a<<" "<<#b<<" : "<<b<<" "<<#c<<" : "<<c<<" "<<#d<<" : "<<d<<endl
#define t5(a,b,c,d,e)          cerr<<#a<<" : "<<a<<" "<<#b<<" : "<<b<<" "<<#c<<" : "<<c<<" "<<#d<<" : "<<d<<" "<<#e<<" : "<<e<<endl
#define t6(a,b,c,d,e,f)          cerr<<#a<<" : "<<a<<" "<<#b<<" : "<<b<<" "<<#c<<" : "<<c<<" "<<#d<<" : "<<d<<" "<<#e<<" : "<<e<<" "<<#f<<" : "<<f<<endl
#define GET_MACRO(_1,_2,_3,_4,_5,_6,NAME,...) NAME
#define t(...) GET_MACRO(__VA_ARGS__,t6,t5, t4, t3, t2, t1)(__VA_ARGS__)
#define _ cerr<<"here"<<endl;
#define __ {ios::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);}

using namespace std;
template<class A, class B> ostream& operator<<(ostream& out, const pair<A, B> &a){ return out<<"("<<a.first<<", "<<a.second<<")";}
template <int> ostream& operator<<(ostream& os, const vector<int>& v) { os << "["; for (int i = 0; i < v.size(); ++i) { if(v[i]!=INF) os << v[i]; else os << "INF";if (i != v.size() - 1) os << ", "; } os << "]\n"; return os; } 
template <typename T> ostream& operator<<(ostream& os, const vector<T>& v) { os << "["; for (int i = 0; i < v.size(); ++i) { os << v[i]; ;if (i != v.size() - 1) os << ", "; } os << "]\n"; return os; } 

int min(int x, int y)
{
  if(x<y) return x;
  return y;
}

int main()
{
  __;
  int n,w;
  cin >> n >> w;
  vector<vector<int> > dp(2,vector<int> (1e5+10,INF));

  // Base Case
  int weight,value;
  cin >> weight >> value;
  dp[0][value] = weight;
  dp[0][0] = 0;

  for(int i=1;i<n;i++)
  {
    cin >> weight >> value;
    int par = i&1;
    for(int j=0;j<=1e5;j++)
    {
      int a = (j >= value) ? dp[par^1][j-value] + weight: INF;
      // if(a > w) a = INF;
      dp[par][j] = min(a,dp[par^1][j]);
    }
  }

  int ans = -1;
  for(int i=0;i<=1e5;i++)
  {
    int par = (n-1)&1;
    if(dp[par][i] - INF && dp[par][i] <= w) ans = i; 
  }
  cout << ans << endl;
  return 0;
}

/*
3 8
3 1
4 2
5 4

*/

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

int main() {
 int N,D;
 cin >> N >> D;
 int k = 1;
 int sum = 2*D+1;
 while(1){
   if(sum>=N) break;
   sum+= 2*D+1;
   k++;
 }
   cout << k << endl;
  
}



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

#define int long long
#define fi first
#define se second
#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 rep11(i,n) for(int i=1;i<(int)(n);++i)
#define repo(i,o,n) for(int i=o;i<(int)(n);++i)
#define repm(i,n) for(int i=(int)(n)-1;i>=0;--i)
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()
#define pb(n) push_back(n)
#define mp make_pair
#define MOD 1002000007
#define INF LONG_LONG_MAX

int h,a;

signed main() {
    cin >> h >> a;
    cout << (h+a-1)/a << endl;
}



Measured memory_bytes: 764
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
#define rep(i, n) for (ll i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define m0(x) memset(x,-1,sizeof(x))
const int INF = 1000000001;

int main(){
  int n, t, a;
  cin >> n >> t >> a;
  double m = INF;
  int ans = -1;
  rep(i, n){
    int h;
    cin >> h;
    double temp = t - 0.006 * h;
    double d = abs(a - temp);
    if(d < m){
      ans = i;
      m = d;
    }
  }
  cout << ans+1 << endl;
}

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

public class Main {

    static final int[] vol = new int[]{0,2,5,5,4,5,6,3,7,6};
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int M = sc.nextInt();
        int[] A = new int[M];
        for (int i = 0; i < M; i++) {
            A[i] = sc.nextInt();
        }
        // dp[i]：ちょうどｉ本のマッチを使って作れる整数の最大の桁数
        int[] dp = new int[N+1];
        Arrays.fill(dp, Integer.MIN_VALUE);
        dp[0] = 0;
        for (int i = 2; i <= N; i++) {
            for(int a : A){
                if(i >= vol[a]) dp[i] = Math.max(dp[i], dp[i - vol[a]] + 1);
            }
        }
        Arrays.sort(A);
        StringBuilder sb = new StringBuilder();
        while(N > 0){
            for (int i = M-1; i >= 0; i--) {
                if(N - vol[A[i]] >= 0 && dp[N] - 1 == dp[N - vol[A[i]]]){
                    sb.append(A[i]);
                    N -= vol[A[i]];
                    break;
                }
            }
        }

        System.out.println(sb.toString());
        sc.close();

    }

}


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

using namespace std;

const double PI = 3.14159265358979323846;
typedef long long ll;
const double EPS = 1e-9;
#define rep(i, n) for (int i = 0; i < (n); ++i)
//#define rep(i, n) for (ll i = 0; i < (n); ++i)
//typedef pair<ll, ll> P;
typedef pair<double, double> P;
const ll INF = 10e17;
#define cmin(x, y) x = min(x, y)
#define cmax(x, y) x = max(x, y)
#define ret() return 0;

double equal(double a, double b) {
    return fabs(a - b) < DBL_EPSILON;
}

std::istream &operator>>(std::istream &in, set<string> &o) {
    string a;
    in >> a;
    o.insert(a);
    return in;
}

std::istream &operator>>(std::istream &in, queue<int> &o) {
    ll a;
    in >> a;
    o.push(a);
    return in;
}

bool contain(set<int> &s, int a) { return s.find(a) != s.end(); }

//ofstream outfile("log.txt");
//outfile << setw(6) << setfill('0') << prefecture << setw(6) << setfill('0') << rank << endl;
// std::cout << std::bitset<8>(9);
//const ll mod = 1e10;

typedef priority_queue<ll, vector<ll>, greater<ll> > PQ_ASK;

struct Query {
    ll a, b, c, d;
};

std::istream &operator>>(std::istream &in, Query &o) {
    cin >> o.a >> o.b >> o.c >> o.d;
    o.a--;
    o.b--;
    return in;
}

ll check(vector<ll> &v, vector<Query> &query) {
    ll ans = 0;
    for (Query &q : query) {
        if (v[q.b] - v[q.a] == q.c) ans += q.d;
    }
    return ans;
}

ll rec(ll n, ll m, vector<Query> &query, vector<ll> prev) {
    if (prev.size() == n) {
        return check(prev, query);
    }
    ll ans = 0;
    ll start = prev.empty() ? 1 : prev.back();
    for (ll i = start; i <= m; i++) {
        vector<ll> next = prev;
        next.push_back(i);
        ll now = rec(n, m, query, next);
        cmax(ans, now);
    }
    return ans;
}

int main() {
    int n, m, q;
    cin >> n >> m >> q;
    vector<Query> query(q);
    rep(i, q) cin >> query[i];

    vector<ll> a;
    ll ans = rec(n, m, query, a);
    cout << ans << endl;

}


Measured memory_bytes: 3636
#include <bits/stdc++.h>
using namespace std;
int main(void){
    int N;
    cin >> N;
    int a[N];
    int count[8];
    int count3200 = 0;
    int ans = 0;

    for( int i = 0; i < 8; i++){
        count[i] = 0;
    }
    for( int i = 0; i < N; i++){
        cin >> a[i];
    }
    for( int i = 0; i < N; i++){
        for( int j = 0; j < 8; j++){
            if( j * 400 <= a[i] && a[i] < (j+1) * 400){
                count[j] = 1;
            }
        }
        if( a[i] >= 3200){
            count3200++;
        }
    }
    for( int i = 0; i < 8; i++){
        if( count[i] == 1) ans++;
    }
    cout << max(ans,1) << " " << ans + count3200;

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <vector>
#include <queue>
#include <string>
#include <cmath>
#include <algorithm>

using namespace std;

#define pb push_back
#define mp make_pair
#define ff first
#define ss second

typedef long long ll;
typedef vector<ll> vi;
typedef vector<vi> vvi;
typedef pair<ll, ll> pii;
typedef vector<pii> vii;
typedef priority_queue<ll> pq;

const int MOD = 1e9+7;
const int INF = 2e9;
const int MAX_N = 1;

int main() {
  ll a, b, c; cin >> a >> b >> c;
  ll ans;
  if (a+b < c) {
    ans = a+b + b + 1;
  } else {
    ans = b + c;
  }

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


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
	long long n,a,b;
	cin>>n>>a>>b;
	if(n>1&&b>=a||n==1&&a==b)
		cout<<(n-1)*(b-a)+a-b+1<<endl;
	else
		cout<<0<<endl; 
 } 

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

using namespace std;

int n,m;

int main(void){
	scanf("%d%*c",&n);
	for(int dd=0;dd<n;dd++){
		string str;
		getline(cin,str);
		scanf("%d%*c",&m);
		int point=0;
		for(int i=0;i<m;i++){
			string com;
			getline(cin,com);
			if(com=="forward char"){
				if(point<str.size()){
					point++;
				}
			}
			if(com=="forward word"){
				if(point<str.size()){
					while(point<str.size() && str[point]==' ')point++;
					while(point<str.size() && str[point]!=' ')point++;
				}
			}
			if(com=="backward char"){
				if(point>0){
					point--;
				}
			}
			if(com=="backward word"){
				if(point>0){
					while(point>0 && str[point-1]==' ')point--;
					while(point>0 && str[point-1]!=' ')point--;
				}
			}
			if(com[0]=='i'){
				string str2;
				string str3;
				string str4;
				str2=str.substr(0,point);
				str3=str.substr(point);
				str4=com.substr(8,com.size()-9);
				str=str2+str4+str3;
				point+=com.size()-9;
			}
			if(com=="delete char"){
				if(str.size()==point)continue;
				string str2;
				string str3;
				str2=str.substr(0,point);
				str3=str.substr(point+1);
				str=str2+str3;
			}
			if(com=="delete word"){
				if(str.size()==point)continue;
				int e=1;
				if(str[point]==' '){
					while(point+e<str.size() && str[point+e]==' ')e++;
				}
				int flag2=0;
				while(point+e<str.size() && str[point+e]!=' '){
					e++;
					flag2=1;
				}
				if(flag2==0)continue;
				string str2;
				string str3;
				str2=str.substr(0,point);
				str3=str.substr(point+e);
				str=str2+str3;
			}
			//cout << str << endl;
		}
		string res="";
		for(int i=0;i<str.size();i++){
			if(i==point)res+='^';
			res+=str[i];
		}
		if(str.size()==point)res+='^';
		cout << res << endl;
	}
	return 0;
}

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

using namespace std;

int main(void) {

	int a, b;

	cin >> a >> b;

	if (a + b == 15)cout << "+\n";
	else if (a*b == 15)cout << "*\n";
	else cout << "x\n";

	return 0;
}

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

typedef long long ll;
typedef long double Double;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)

void solve(long long K, long long A, long long B) {
  if( B <= A + 2 ){
    cout << K + 1 << endl;
  }else {
    long long k = min(A-1, K);
    K -= k;
    long long ans = A + K % 2 + (B - A) * (K/2);
    cout << ans << endl;
  }
}

int main() {
  long long K;
  scanf("%lld", &K);
  long long A;
  scanf("%lld", &A);
  long long B;
  scanf("%lld", &B);
  solve(K, A, B);
  return 0;
}


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

int main(){
    int N,R;
    cin>>N>>R;

    if(N>10){
        cout<<R<<endl;
    }else{
        cout<<R+100*(10-N)<<endl;
    }

    return 0;
}

Measured memory_bytes: 3572
a,b = map(int, input().split())
if a < 0 and b < 0:
  if (a - b) % 2 == 0:
    print('Negative')
  else:
    print('Positive')
if a < 0 and b >= 0:
  print('Zero')

if a == 0:
  print('Zero')

if a > 0:
  print('Positive')
    

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

#define ll long long
#define ld long double
#define db double
#define str string
#define pb push_back
#define nl '\n'
#define X first
#define Y second
#define nimble ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define all(v) (v).begin(),(v).end()
#define selp(a) for(auto i:a)cout<<i<<" ";cout<<nl;
#define mod(x,m) ((((x)%(m))+(m))%(m))
#define _sz(x) (int)x.size()
#define rep(i,a,b) for(int i=a;i<b;i++)
#define repv(v) for(int i=0;i<_sz(v);i++)
#define rep1(i,b,a) for(int i=b;i>=a;i--)
#define preci(x) fixed<<setprecision(x)
#define tc int tt=1;cin>>tt;while(tt--)

#define TRACE
#ifdef TRACE
#define see(...) __f(#__VA_ARGS__,__VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
	cerr<<name<<" : "<<arg1<<nl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
    const char* comma=strchr(names+1,',');cerr.write(names,comma-names)<<" : "<<arg1<<" | ";__f(comma+1, args...);
}
#else
#endif

int inf=0x3f3f3f3f;
ll infl=0x3f3f3f3f3f3f3f3fLL;
ld infd=1.0/0.0;
const ll MOD=1e9+7;// 998244353 // = (119<<23)+1
const db pi=2*acos(0.0);

int main(){
    nimble
    int k,a,b;
    cin>>k>>a>>b;int f=0;
    for(int i=a;i<=b;i++){
        if(i%k==0){
            f=1;
        }
    }
    if(f)cout<<"OK";
    else cout<<"NG";
    return 0;
}


Measured memory_bytes: 3604
{-
URL: http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=1195&lang=jp
?????????: Encryption System
?????°:
18:50 Haskell?????????????????¨????????§Haskell????????????
19:11 ????\???¢?????±???????¨???\?????????????????????
19:24 ????\???¢?????±?????????????????????????????????????????£????????????????????§??????????????????
19:32 ?????°??£????????§?????´?????????????????????
19:33 AC???????????§?????¬??????????????´???
-}
import Control.Monad
import Control.Applicative
import Data.List

main = do
 info <- getLine
 unless (info == "#") $ do
 let arr = sort $ analyze info
 print (length arr)
 mapM_ putStrLn $ if length arr <= 10 then arr else take 5 arr ++ (reverse . take 5 . reverse)arr 
 main

analyze :: String -> [String]
analyze str = fold arr str
 where arr = map (uncurry decipher) $ zip ['b' ..'z'] ['a' .. 'y']

fold :: (Monad m) => [a -> m a] -> a -> m a
fold [] a = return a
fold (g:fs) a = fold fs a >>= g




-- decipher 'b' 'a' "want a aeer" = ["wbnt a aeer","want b aeer","want a beer","want a aeer"]
decipher :: Char -> Char -> String -> [String]
decipher b a str
 | b `elem` str = let (front,back) = break (==b) str in map (++back) (replaceOne a b front) -- b??\???????????????????????????????????¨back?????¨??????????????£???
 | otherwise = replaceOne' a b str



-- replaceOne 'a' 'b' "an algebra" = ["bn algebra", "an blgebra", "an algebrb"]
replaceOne :: (Eq a) => a -> a -> [a] -> [[a]]
replaceOne a b = init . replaceOne' a b -- ????????????????????????

replaceOne' :: (Eq a) => a -> a -> [a] -> [[a]]
replaceOne' _ _ [] = [[]]
replaceOne' a b (c:xs)
 | a == c = (b:xs) : map (c:) (replaceOne' a b xs) -- ???????????????????????????????????¨???????????????????????¨
 | otherwise = map (c:) (replaceOne' a b xs) -- ???????????£????????????????????????????????????

Measured memory_bytes: 34752
#include <cstring>
#include <unordered_set>
#include <unordered_map>
#include <numeric>
#include <ctime>
#include <bitset>
#include <complex>
#include <chrono>
#include <random>
#include <functional>
#include <iostream>
#include<algorithm>
#include <stdio.h>

using namespace std;

int main() {
	int n,tmp;

	cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> tmp;
		if (tmp % 2 == 0) {
			if (tmp % 3 == 0 || tmp % 5 == 0) {

			}
			else {
				cout << "DENIED";
				return 0;
			}
		}

	}
	cout << "APPROVED";

	return 0;
}

Measured memory_bytes: 256
#define NDEBUG
NDEBUG


#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <cstring>
#include <cmath>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <set>
#include <sstream>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#include <memory>
#include <queue>
#include <random>


using namespace std;


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


// TC_REMOVE_BEGIN
/// caide keep
bool __hack = std::ios::sync_with_stdio(false);
/// caide keep
auto __hack1 = cin.tie(nullptr);
// TC_REMOVE_END


// Section with adoption of array and vector algorithms.


//#include <ext/pb_ds/tree_policy.hpp>
//#include <ext/pb_ds/assoc_container.hpp>
//
//template <class T> using StdTree = tree<T, null_type, less<T>, rb_tree_tag,tree_order_statistics_node_update>;


namespace template_util {
    

    constexpr int bytecount(uint64_t x) {
        return x ? 1 + bytecount(x >> 8) : 0;
    }

    template<int N>
    struct bytetype {
        
    };

    
    /// caide keep
    template<uint64_t N>
    struct minimal_uint : bytetype<bytecount(N)> {
    };
}


template<class T>
T next(istream& in) {
    T ret;
    in >> ret;
    return ret;
}


void solve(istream& in, ostream& out) {
  auto s = next<string>(in);
  auto k = next<int>(in);
  FOR(i, s.length()) {
    if (s[i] == 'a') continue;
    int rest = 26 - (s[i] - 'a');
    if (k >= rest) {
      s[i] = 'a';
      k -= rest;
    }
  }
  k %= 26;
  while (k--) {
    if (s[s.length() - 1] == 'z') {
      s[s.length() - 1] = 'a';
    } else {
      s[s.length() - 1]++;
    }
  }
  out << s << "\n";
}

//#include <fstream>


int main() {
//  ifstream fin("bridges.in");
//  ofstream fout("bridges.out");
    solve(cin, cout);
//  solve(fin, fout);
    return 0;
}



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

public class Main{
	public static void main(String[] args){
		Scanner sc=new Scanner(System.in);
		while(sc.hasNext()) {
			int N = sc.nextInt(), K = sc.nextInt();
			int[] a = new int[N];
			for(int i = 0; i < N; i++) {
				a[i] = sc.nextInt();
			}
			boolean[] dp = new boolean[K + 1];
			Arrays.fill(dp, false);
			for(int i = 1; i <= K; i++) {
				for(int j = 0; j < N; j++) {
					if(i - a[j] >= 0) {
						dp[i] |= !dp[i - a[j]];
					}
				}
			}
			System.out.println(dp[K] ? "First" : "Second");
		}
	}
}

Measured memory_bytes: 21844
#include <bits/stdc++.h>
using namespace std;
#define rep0(i,n) for(int (i) = 0; (i) < (n); ++(i))
#define rrep0(i,n) for(int (i) = (n) - 1; (i) >= 0; --(i))
#define rep1(i,n) for(int (i) = 1; (i) < (n); ++(i))
#define rrep1(i,n) for(int (i) = (n) - 1; (i) >= 1; --(i))
#define nfor(i,a,b) for(int (i) = (a); (i) < (b); ++(i))
#define ll long long
#define mod (1000000007)
#define YES cout << "YES" << endl;
#define Yes cout << "Yes" << endl;
#define yes cout << "yes" << endl;
#define NO cout << "NO" << endl;
#define No cout << "No" << endl;
#define no cout << "no" << endl;
#define all(x) (x).begin(),(x).end()

ll gcd(ll a,ll b){
    if(b == 0) return a;
    return gcd(b,a%b);
}

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

int main()
{
    int n,m,l,r,a,b;
    cin >> n >> m >> l >> r;
    rep1(i, m){
        cin >> a >> b;
        l = max(l, a);
        r = min(r, b);
    }
    if(l > r)cout << 0 << endl;
    else cout << r - l + 1 << endl;
    return 0;
}


Measured memory_bytes: 256
#include<iomanip>
#include<limits>
#include<thread>
#include<utility>
#include<iostream>
#include<string>
#include<algorithm>
#include<set>
#include<map>
#include<vector>
#include<stack>
#include<queue>
#include<cmath>
#include<numeric>
#include<cassert>
#include<random>
#include<chrono>
#include<unordered_map>
#include<fstream>
#include<list>
#include<functional>
using namespace std;
typedef unsigned long long int ull;
typedef long long int ll;
typedef pair<ll,ll> pll;
typedef pair<int,int> pi;
typedef pair<double,double> pd;
typedef pair<double,ll> pdl;
#define F first
#define S second
const ll E=1e18+7;
const ll MOD=1000000007;






int main(){
    ll n,m,x,y;
    cin>>n>>m>>x>>y;
    ll xmx=x,ymi=y;
    for(int i=0;i<n;i++){
        ll b;
        cin>>b;
        xmx=max(xmx,b);
    }
    for(int i=0;i<m;i++){
        ll b;
        cin>>b;
        ymi=min(ymi,b);
    }
    if(xmx<ymi){cout<<"No War"<<endl;}
    else{cout<<"War"<<endl;}
    
    
    
    return 0;
}



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

#define gcu getchar_unlocked
int in(int c){int n=0;bool m=false;if(c=='-')m=true,c=gcu();
	do{n=10*n+(c-'0'),c=gcu();}while(c>='0');return m?-n:n;}
int in() {return in(gcu());}
bool scan(int &n){int c=gcu();return c==EOF?false:(n=in(c),true);}
bool scan(char &c){c=gcu();gcu();return c!=EOF;}
//bool scan(string &s){int c;s="";
//	for(;;){c=gcu();if(c=='\n'||c==' ')return true;else if(c==EOF)return false;s+=c;}}
template <typename head, typename... tail>
bool scan(head &h, tail&&... t){return scan(h) && scan(t...);}
#define pcu putchar_unlocked
#define vo inline void out
template <typename T>
vo(T n){static char buf[20];char *p=buf;
	if(n<0)pcu('-'),n*=-1;if(!n)*p++='0';else while(n)*p++=n%10+'0',n/=10;
	while (p!=buf)pcu(*--p);}
vo(const char *s){while(*s)pcu(*s++);}
vo(char c){pcu(c);}
//vo(string &s){for (char c: s) pcu(c);}
template <typename head, typename... tail> vo(head&& h, tail&&... t){out(h);out(move(t)...);}
//template <typename T> vo(vector<T> &v){for(T &x:v)out(&x == &v[0]?"":" "),out(x);out('\n');}
#undef vo

int main() {
	for (int n; (n = in());)
		while (n--) {
			int a = in(), b = in(), c = in(), d = (a + b + c) / 3;
			out((a == 100 || b == 100 || c == 100 || a + b >= 180 || d >= 80) ? 'A' :
				(d >= 70 || (d >= 50 && (a >= 80 || b >= 80))) ? 'B' : 'C', '\n');
		}
}


Measured memory_bytes: 2548
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <list>
#include <map>
#include <set>
#include <string>
#include <cstring>
#include <sstream>
#include <cmath>
#include <functional>
#include <fstream>
#include <cstdlib>
typedef long long ll;
const int MOD = 1e9+7;


#define REP(i, N) for (int i = 0; i < (N); i++)
#define REPP(i, a, b) for (int i = (a); i < (b); i++)
#define ALL(v) (v).begin(), (v).end()
#define RALL(v) (v).rbegin(), (v).rend()
#define VSORT(c) sort((c).begin(),(c).end())
#define SZ(x) ((int)(x).size())
//vvintを作る　マクロで　 #define vvint(N,M) vector<vector<int>>

using namespace std;


int main(){
    
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll n;
    cin >> n;
    set<ll> a;
    ll tmp;
    for(ll i = 0; i < n;i++){
        cin >> tmp;
        if(a.count(tmp)){
            cout << "NO" << endl;
            return 0;
        }
        a.insert(tmp);
    }

    cout << "YES" << endl;
    

    

    return 0;
}

Measured memory_bytes: 9600
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#define int long long
using namespace std;
signed main() {
	string s; cin >> s;
	int ans = 0, a = 0, bc = 0;
	for (int i = 0; i < s.size(); i++) {
		if (s[i] == 'A') {
			if (i&&s[i - 1] == 'B')a = 0;
			a++;
		}
		else if (s[i] == 'B') {
			if (i&&s[i - 1] == 'B')a = 0;
		}
		else {
			if (!i);
			else if (s[i - 1] == 'B')ans += a;
			else a = 0;
		}
	}
	cout << ans << endl;
	cin >> s;
}

Measured memory_bytes: 640
#include <iostream>

using namespace std;

int main() {
    int min;
    int max_delta = -999999999;
    int n, i;

    cin >> n;

    int input[n];
    for (i = 0; i < n; i++) {
          cin >> input[i];
    }

    for (i = 0; i < n; i++) {
        if (i == 0) {
            min = input[i];
        } else {
        
            if (max_delta < input[i] - min) {
              max_delta = input[i] - min;
            }
            if (min > input[i]) {
                min = input[i];
            }
        }
        
    }
    cout << max_delta << endl;

    return 0;
}


Measured memory_bytes: 3832
N=int(input())
text=input()
ans=0
for i in range(1,N):
  texta=text[:i]
  textb=text[i:]
  seta=set(list(texta))
  setb=set(list(textb))
  m=len(seta&setb)
  if ans<m:
    ans=m
print(ans)

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

#define pb push_back
#define ll long long
#define pi pair<int,int>
#define pii pair<int,pi>
#define pl pair<ll,ll>
#define pll pair<ll,pl>
#define debug cout<<"debugging"<<endl
#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
int I_LIMIT = 999999999;
ll L_LIMIT = 1999999999999999999;
ll mod = 1000000007;
vector <int> v[100005];

void solve()
{
    ll s;
    cin>>s;
    ll i,j;
    ll dp[s+1];
    dp[0]=1;
    if(s<=2)
    {
        cout<<0<<"\n";
        return;
    }
    dp[1]=dp[2]=0;
    for(i=3;i<=s;i++)
    {
        dp[i]=0;
        for(j=i-3;j>=0;j--)
            dp[i] = (dp[i]+dp[j])%mod;
    }
    cout<<dp[s]<<"\n";
}
int main()
{
    IOS;
    int t;
    //cin>>t;
    //for(int i=1;i<=t;i++)
        solve();
}


Measured memory_bytes: 6012
import bisect
def get_sieve_of_eratosthenes(n):
    prime = [2]
    limit = int(n**0.5)
    data = [i + 1 for i in range(2, n, 2)]
    while True:
        p = data[0]
        if limit <= p:
            return prime + data
        prime.append(p)
        data = [e for e in data if e % p != 0]
data = get_sieve_of_eratosthenes(100001)
seta = set(data)
import collections
from collections import deque
que = deque()
for i in range(3,100001,2):
    if i in seta:
        j = (i+1)//2
        if j in seta:
            que.append(i)
listb = list(que)

Q= int(input())
l = [0] * Q
r = [0] * Q
for i in range(Q):
    laa,raa = map(int,input().split())
    l[i] = laa
    r[i] = raa
for i in range(Q):
    la = bisect.bisect_left(listb,l[i])
    ra = bisect.bisect_right(listb,r[i])
    print(ra-la)

Measured memory_bytes: 13032
#include<iostream>
using namespace std;
int main(){
	int n;
	cin>>n;
	int a[n];
	int b[n];
	int c[n-1];
	for(int i=0;i<n;++i)
		cin>>a[i];
	for(int i=0;i<n;++i)
		cin>>b[i];
	for(int i=0;i<n-1;++i)
		cin>>c[i];
	int sum=0;
	for(int i=0;i<n;++i){
		sum+=b[a[i]-1];
		if(i&&a[i-1]==a[i]-1)
			sum+=c[a[i-1]-1];
	}
	cout<<sum<<endl;
	return 0;
}

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

using namespace std;
typedef long long ll;
#define rep(i, j, n) for (int i = j; i < n; i++)
#define out(ans) cout << ans << endl;
const long long mod = 1e9 + 7;

int main(){

  string s[3];
  rep(i,0,3){
    cin>>s[i];
    cout<<s[i][i];
  }
  cout<<endl;




  return 0;
}


Measured memory_bytes: 256
import numpy as np
def cumsum(x):
    return list(np.cumsum(x))

def cumsum_number(N,K,x):
    ans=[0]*(N-K+1)
    number_cumsum = cumsum(x)
    number_cumsum.insert(0,0)
    for i in range(N-K+1):
        ans[i]=number_cumsum[i+K]-number_cumsum[i]
    return ans
"""
int #整数
float #小数

#for
for name in fruits: #fruitの頭から操作
    print(name)

#リスト
list0 = [] #リスト生成
list0 = [1,2,3,4] #初期化
list0 = [0]*10 #[0,0,0,0,0,0,0,0,0,0]
list1= [i for i in range(10)] #>>> [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
list1 = list(map(int, input().split()))　# 複数の入力をリストに入れる
number=[int(input()) for i in range(int(input()))] #複数行の入力をリストに
list1 = list1 + [6, 7, 8] #リストの追加
list2.append(34) #リストの追加　最後に（）内が足される
list.insert(3,10) #リストの追加　任意の位置（追加したい位置,追加したい値）
len(list4) #リストの要素数
max(sa) #list saの最小値
list5.count(2) #リスト(文字列も可）内の2の数
list1.sort() #並び替え小さい順
list1.sort(reverse=True)  #並び替え大きい順
set(list1) #list1内の重複している要素を削除し、小さい順に並べる
sum([2,3,   ,3]) #リストの合計

abs(a) #aの絶対値
max(a,b) min(a,b) #最大値　最小値
text1 = text1.replace("34","test") #text1内の"34"を"test"に書き換える(文字列内の文字を入れ替える)

exit(0) #強制終了

cumsum(リスト) #累積和をリストで返す
cumsum_number(N,K,x) #N個の数が含まれるリストx内のK個からなる部分和をリストで返す
"""
N,K=map(int,input().split())
for i in range(10000):
    if K**i<=N<K**(i+1):
        print(i+1)



Measured memory_bytes: 27056
#include<iostream>
#include<algorithm>
int B[8010][8010], W[8010][8010];
int N, K;
int w;
int ans;
int main() {
	std::cin >> N >> K;
	int D[] = { 0,K,2 * K,K,0,-K,-2 * K,-K,0 };
	int oD[] = { 2 * K,K,0,-K,-2 * K,-K,0,K,0 };
	for (int i = 0; i < N; i++) {
		int a, b;
		char c;
		std::cin >> a >> b >> c;
		if (c == 'W') {
			b += K;
		}
		a++;
		b++;
		a %= 2*K;
		b %= 2*K;
		a += 2 * K;
		b += 2 * K;
		for (int i = 0; i < 9; i++) {
			int x = a + D[i];
			int y = b + oD[i];
			B[x][y]++;
			B[x][y + K]--;
			B[x + K][y]--;
			B[x + K][y + K]++;
		}
	}
	for (int i = 0; i < K * 4; i++) {
		for (int j = 0; j < K * 4; j++) {
			B[i + 1][j] += B[i][j];
		}
	}

	for (int i = 0; i < K * 4; i++) {
		for (int j = 0; j < K * 4; j++) {
			B[i][j + 1] += B[i][j];
		}
	}
	for (int i = 1; i < K * 4; i++) {
		for (int j = 1; j < K * 4; j++) {
			ans = std::max(ans, B[i][j]);
		}
	}
	std::cout << ans << std::endl;
	return 0;
}

Measured memory_bytes: 221440
#include<bits/stdc++.h>
using namespace std;
const long long mod=1e9+7;

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

 vector<int>oks(N+1,true);
 for(int i=0;i<M;++i){
 int a;cin>>a;
 oks[a]=false;
 }

 vector<long long int>dp(N+1);
 dp[0]=1;
 for(int now=0;now<N;++now){
for(int next=now+1;next<=min(N,now+2);++next){
if(oks[next]){
 dp[next]+=dp[now];
 dp[next]%=mod;
 }
 }
 }

 cout<<dp[N]<<endl;
 return 0;
}

Measured memory_bytes: 1408