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

using namespace std;

#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define rep(i, n) FOR(i, 0, n)
#define all(x) (x).begin(), (x).end()
#define pb(i) push_back(i)
#define INF 100100100
#define EPS 1e-9
#define itn int
typedef long long ll;
typedef vector<int> vi;
typedef map<string, int> msi;
const int dx[] = {0, 1, 0, -1, -1, 1, 1, -1};  //座標移動用
const int dy[] = {1, 0, -1, 0, -1, 1, -1, -1};

template<typename T, typename U>
T gcd(T a, T b) {return (b ? gcd(b, a%b) : a);}

template<typename T, typename U>
T lcm(T a, T b) {return (a * b / gcd(a, b));}

int in() {int x; cin >> x; return x;}

int main()
{
    int a;

    cin >> a;

    if (a >= 195) {
        cout << 5 << endl;
    }
    else if (a >= 189) {
        cout << 4 << endl;
    }
    else if (a >= 165) {
        cout << 3 << endl;
    }
    else if (a >= 135) {
        cout << 2 << endl;
    }
    else if (a >= 105) {
        cout << 1 << endl;
    }
    else {
        cout << 0 << endl;
    }

    return (0);
}


Measured memory_bytes: 256
import java.util.*;
public class Main{
  public static void main (String args[]){
    Scanner sc = new Scanner(System.in);
    
    String s = sc.next();
    String t = sc.next();
    int a = sc.nextInt();
    int b = sc.nextInt();
    String u = sc.next();
    
    if(s.equals(u)){
      a--;
    }else{
      b--;
    }
    
    String sA = String.valueOf(a);
    String sB = String.valueOf(b);
    
    System.out.println( sA + " " + sB);
  }
}

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

using namespace std;
#define rep(i, n) for (ll i = 0; i < (n); ++i)
//#define rep(i, n) for (int i = 0; i < (n); ++i)
#define sz(x) ll(x.size())
typedef long long ll;
//typedef pair<int, int> P;
typedef pair<ll, ll> P;
//const double INF = 1e10;
//const ll INF = 10e15;
const ll MINF = -10e10;
const int INF = INT_MAX;
#define cmin(x, y) x = min(x, y)
#define cmax(x, y) x = max(x, y)


//ifstream myfile("~/Downloads/02.txt");
//ofstream outfile("log.txt");
//outfile << setw(6) << setfill('0') << prefecture << setw(6) << setfill('0') << rank << endl;
// std::cout << std::bitset<8>(9);

typedef priority_queue<P, vector<P>, greater<P>> PQ_ASK;
const int mod = 1000000007;


int main() {

    set<ll> have;

    ll n;
    cin >> n;

    rep(i, n) {

        ll a;
        cin >> a;
        if (have.find(a) == have.end()) {
            have.insert(a);
        } else {
            have.erase(a);
        }

    }

    cout << have.size() << endl;


}

Measured memory_bytes: 4864
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> iint;
typedef pair<ll,ll> llll;
#define ALL(x) (x).begin(),(x).end()
const ll zero = 0;
const ll INF = 3000000000000000000; //10^18
const int inINF = 1000000000; //10^9
const ll MOD = 1000000007; //10^9+7
const ll MOD2 = 998244353;
void Yes() {printf("Yes\n");}
void No() {printf("No\n");}
void YES() {printf("YES\n");}
void NO() {printf("NO\n");}

ll N;
vector<ll> A;

ll f(ll x){
    ll ret;
    ret = 0;
    for (ll i = 0; i < N; i++) {
        ret += (A[i]-1) / x;
    }
    return ret;
}

int main(){
    ll K;
    cin >> N >> K;
    A.resize(N);
    for (ll i = 0; i < N; i++) {
        cin >> A[i];
    }

    ll ng = 0;
    ll ok = 1000000005;
    ll mid;
    while(ng + 1 < ok){
        mid = (ng + ok) / 2;
        if(f(mid) > K){
            ng = mid;
        }
        else if(f(mid) < K){
            if(mid >= 2 && f(mid - 1) > K){
                ok = mid;
                break;
            }
            ok = mid;
        }
        else{
            if(mid >= 2 && f(mid - 1) > K){
                ok = mid;
                break;
            }
            else{
                ok = mid;
            }
        }

    }
    printf("%lld\n", ok);

}

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

const int maxn = 1e5 + 5;
int H[maxn];
bool flag[maxn];

int main() {

	int N;
	scanf("%d%d", &N, H);
	flag[0] = true;
	for(int i = 1; i < N; i++) {
        scanf("%d", H+i);
        if(H[i-1]-H[i] > 1 || H[i-1]-H[i] == 1 && !flag[i-1]) {
            printf("No");
            return 0;
        }
        else if(!(H[i-1]-H[i]) && flag[i-1] || H[i]-H[i-1] > 0) flag[i] = true;
	}
	printf("Yes");
    return 0;
}

Measured memory_bytes: 768
import java.util.Scanner;

class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        int a = sc.nextInt();

        int x = a / 100;
        int y = a % 100;

        boolean YYMM = MMJudge(y);
        boolean MMYY = MMJudge(x);

        if (YYMM == true && MMYY == true) {
            System.out.println("AMBIGUOUS");
        }
        if (YYMM == true && MMYY == false) {
            System.out.println("YYMM");
        }
        if (YYMM == false && MMYY == true) {
            System.out.println("MMYY");
        }
        if (YYMM == false && MMYY == false) {
            System.out.println("NA");
        }

        sc.close();

    }

    public static boolean MMJudge(int a) {
        if (1 <= a && a <= 12) {
            return true;
        } else {
            return false;
        }
    }
}

Measured memory_bytes: 22612
#include <bits/stdc++.h>
#define chmin(a, b) ((a)=min((a), (b)))
#define chmax(a, b) ((a)=max((a), (b)))
#define fs first
#define sc second
#define eb emplace_back
using namespace std;

typedef long long ll;
typedef pair<int, int> P;
typedef tuple<int, int, int> T;

const ll MOD=1e9+7;
const ll INF=1e18;

int dx[]={1, -1, 0, 0};
int dy[]={0, 0, 1, -1};

int day[1003][12][23];


int main(){
	int i = 1;
	for(int y = 1;y <= 1000;y++){
		for(int m = 1;m <= 10;m++){
			if(m % 2 == 1 || y % 3 == 0){
				for(int d = 1;d <= 20;d++){
					day[y][m][d] = i;
					i++;
				}
			}else{
				for(int d = 1;d <= 19;d++){
					day[y][m][d] = i;
					i++;
				}
			}
		}
	}
	int n;
	scanf("%d",&n);
	for(int i = 0;i < n;i++){
		int y,m,d;
		cin >> y >> m >> d;
		cout << day[1000][1][1] - day[y][m][d] << endl;
	}
}


Measured memory_bytes: 4232
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
typedef long long ll;
typedef double db;
typedef vector <ll> vll;
typedef pair <ll, ll> pll;
#define pb push_back
#define mp make_pair
#define MAX 1000000
#define mod 1000000007
#define all(_) _.begin(), _.end()
#define F first
#define S second
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>

int main()
{
    ios_base :: sync_with_stdio(false);
    cin.tie(NULL), cout.tie(NULL);
    ll x, y, z;
    cin >> x >> y >> z;
    cout << z << ' ' << x << ' ' << y << endl;
    return 0;
}

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

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

template<typename T>
void chmin(T &a, const T &b){ a = min(a, b); }

template<typename A, size_t N, typename T>
void static_fill(A (&arr)[N], const T &val){
    fill((T*)arr, (T*)(arr+N), val);
}

const int INF = 1e6;
int dp[1<<18][51];
int bit_count[1<<18];

void renum(vector<int> &A, vector<int> &B) {
    vector<int> v = A;
    v.insert(v.end(), B.begin(), B.end());
    sort(v.begin(), v.end());
    v.erase(unique(v.begin(), v.end()), v.end());
    for (int &a: A) a = lower_bound(v.begin(), v.end(), a) - v.begin();
    for (int &b: B) b = lower_bound(v.begin(), v.end(), b) - v.begin();
}

void bit_init() {
    for (int i=0; i<(1<<18); ++i) {
        bit_count[i] = __builtin_popcount(i);
    }
}

int main() {
    bit_init();
    static_fill(dp, INF);

    int N;
    cin >> N;
    vector<int> A(N), B(N);
    for (int i=0; i<N; ++i) cin >> A[i];
    for (int i=0; i<N; ++i) cin >> B[i];
    renum(A, B);

    int M = max(*max_element(A.begin(), A.end()), *max_element(B.begin(), B.end()));

    // 位置iにあるカードを位置jに置くときの表の数字
    auto face = [&](int i, int j){
        return abs(i-j) % 2 ? B[i] : A[i];
    };

    for (int i=0; i<N; ++i) {
        dp[1<<i][face(i, 0)] = 0;
    }
    for (int mask=1; mask<(1<<N); ++mask) {
        for (int i=0; i<=M; ++i) {
            for (int j=0; j<N; ++j) {
                if ((mask >> j) & 1) continue;
                
                int p = bit_count[mask];
                if (i <= face(j, p)) {
                    int inv = bit_count[mask / (1<<(j+1))];
                    chmin(dp[mask|(1<<j)][face(j, p)], dp[mask][i] + inv);
                }
            }
        }
    }
    int res = INF;
    for (int i=0; i<=M; ++i) {
        res = min(res, dp[(1<<N)-1][i]);
    }
    cout << (res == INF ? -1 : res) << endl;

    return 0;
}


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

int main() {
  vector<int> a(5);
  int Min = 1000, s = 0;
  rep(i, 5) {
    cin >> a[i];
    s += 10 * ((a[i]-1) / 10 + 1);
    if (a[i] % 10 != 0)
      Min = min(Min, a[i] % 10);
  }
  if (Min == 1000) Min = 10;
  cout << s + Min - 10<< endl;
  return 0;
}

Measured memory_bytes: 256
s = input()
f = int(s[:2])
b = int(s[2:])
if 1 <= f <= 12:
  if 1 <= b <= 12:
    print('AMBIGUOUS')
  else:
    print('MMYY')
else:
  if 1 <= b <= 12:
    print('YYMM')
  else:
    print('NA')
    

Measured memory_bytes: 2940
#include<bits/stdc++.h>
#define LL long long
const int N=100005;
using namespace std;

int n,ans=0;
int get(int x){
	int res=0;
	for(int i=1;i*i<=x;i++){
		if(x%i!=0)continue;
		res+=2;
		if(i*i==x)res--;
	}
	if(res==8)return 1;
	return 0;
}

int main(){
	scanf("%d",&n);
	for(int i=1;i<=n;i+=2){
		if(get(i))ans++;
	}
	printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 256
n = int(input())
a = [int(x) for x in input().split()]

agg = [0] * 9
free = 0

for rate in a:
    if rate < 400:
        agg[0] += 1
    elif rate < 800:
        agg[1] += 1
    elif rate < 1200:
        agg[2] += 1
    elif rate < 1600:
        agg[3] += 1
    elif rate < 2000:
        agg[4] += 1
    elif rate < 2400:
        agg[5] += 1
    elif rate < 2800:
        agg[6] += 1
    elif rate < 3200:
        agg[7] += 1
    else:
        free += 1

minimum = len([x for x in agg if x > 0])
maximum = minimum + free
if minimum == 0:
    minimum = 1

print(minimum, maximum)

Measured memory_bytes: 3064
import java.util.Scanner;
import java.util.*;
class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int A = sc.nextInt();
        int B = sc.nextInt();
        int add  = (A+B);

        if (add%2 == 1){
            System.out.println("IMPOSSIBLE");
        }
        else{
            System.out.println(add/2);
        }
    }
}


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

using namespace std;

#define endl '\n'

typedef long long int64;
typedef pair<int,int> pii;
typedef vector<int> vi;

const int oo = 0x3f3f3f3f;
const double eps = 1e-9;
const int maxn = 100000 + 10;

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

    int n; cin >> n;

    vector<string> M(n);

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

    int answer = 0;

    for (int k = 0; k < n; ++k){
        bool ok = true;
        for (int i = 0; i < n && ok; ++i)
            for (int j = 0; j < n && ok; ++j){
                if (M[i][j + k] != M[j][i + k])
                    ok = false;
            }

        if (ok) answer += n;
    }

    cout << answer << endl;

    return 0;
}

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

#define rep(i,a,n) for (int i = a;i < n;i++)
#define per(i,n,a) for (int i = n-1;i >= a;i--)
 
typedef long long ll;
using namespace std;
 
int main(){
  string a,b,c;
  cin >> a >> b >> c;
  
  a[0] = toupper(a[0]);
  a[1] = toupper(b[0]);
  a[2] = toupper(c[0]);

  rep(i,0,3){
    printf("%c", a[i]);
  }
  printf("\n");
  return 0;
}

Measured memory_bytes: 256
import Control.Applicative
import Control.Monad
import Data.Vector.Unboxed.Mutable (IOVector)
import qualified Data.Vector.Unboxed.Mutable as VM
import Data.Char (ord)

main :: IO ()
main = getLine >>= solve

solve :: String -> IO ()
solve s = do
  putStr "+++>+++++>+++++++>+>+++>+++++>+++++++>+>+++>+++++>>++++++++[-<<+++++++++++<++++++++++<+++++++++<+++++++<++++++<+++++<++++<++<+<[++++>]>]<<<<<<"
  v <- VM.replicate 13 0 :: IO (IOVector Int)
  VM.write v 3 35
  VM.write v 4 45
  VM.write v 5 55
  VM.write v 6 65
  VM.write v 7 75
  VM.write v 8 85
  VM.write v 9 95
  VM.write v 10 105
  VM.write v 11 115
  VM.write v 12 125
  foldM_ (f v) 8 cs
  putStrLn ""
  where
    cs = map ord s
    f v bi c = do
      let i = c `div` 10
      if bi > i
        then putStr (replicate (bi - i) '<')
        else putStr (replicate (i - bi) '>')
      d <- VM.read v i
      if d > c
        then putStr (replicate (d - c) '-')
        else putStr (replicate (c - d) '+')
      putStr "."
      VM.write v i c
      return i



Measured memory_bytes: 4736
import java.util.Scanner;

public class Main {

  public static void main(String[] args) {

    Scanner sc = new Scanner(System.in);

    int n = Integer.parseInt(sc.next());

    int[] a = new int[n];
    long sum = 0l;
    for (int i = 0; i < n; i++) {
      a[i] = Integer.parseInt(sc.next());
      sum += a[i];
    }

    long x = a[0];
    long y = sum - a[0];
    long ans = Math.abs(x - y);

    for (int i = 1; i < n - 1; i++) {
      x += a[i];
      y -= a[i];
      ans = Math.min(ans, Math.abs(x - y));
      // System.out.println(ans);
    }

    System.out.println(ans);
    sc.close();
  }

}

Measured memory_bytes: 52264
#include<bits/stdc++.h>
using namespace std;
int main(){
int a,b,paper;
scanf("%d %d %d",&paper,&a,&b);
int i=1;
int judge;
if(paper!=2){
while(1){
if(i%2!=0){
if(a+1==b){
judge=0;
break;
}else{
a++;
}
}else{
if(b-1==a){
judge=1;
break;
}else{
b--;
}
}
i++;
}
}
if(paper==2){
printf("Borys\n");
}else if(judge==0){
printf("Borys\n");
}else{
printf("Alice\n");
}
return 0;
}

Measured memory_bytes: 256
# https://atcoder.jp/contests/ddcc2020-qual/tasks/ddcc2020_qual_b

N = int(input())
A = list(map(int, input().split()))
# rA = A.copy()[::-1]

cA = [A[i] for i in range(N)]
for i in range(1, N):
    cA[i] += cA[i - 1]

# print(A)
# print(cA)

diff = int(1e18)
for cut in range(1, N):
    # print(cut)
    costL = cA[cut - 1]
    costR = cA[-1] - cA[cut - 1]
    # print("  ", costL, costR)
    diff = min(diff, abs(costL - costR))

print(diff)

Measured memory_bytes: 99660
#include<bits/stdc++.h>
using namespace std;
char s[12]={};//定义字符数组因为1 ≤ A,B ≤ 5所以到十为止 
int main(){
	int a,b,n=0;
	cin>>a>>b;
	getchar();
    for(int i=1;i<=a+b+1;i++)
	 {
	 	s[i]=getchar();
	 }
	for(int i=1;i<=a;i++)
	{
		if(s[i]<'0'||s[i]>'9')
		{
		  cout<<"No";
		  return 0;
		}
	}
	    if(s[a+1]!='-')
	   	{
		  cout<<"No";
		  return 0;
		} 
		for(int i=a+2;i<=b+a+1;i++)
	{
		if(s[i]<'0'||s[i]>'9')
		{
		  cout<<"No";
		  return 0;
		}
	}
	cout<<"Yes";
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define pb push_back
#define all(x) (x).begin(), (x).end()

using namespace std;
using ll = long long int;
const int MOD = 1e9 + 7;

int main()
{
	ios::sync_with_stdio(0); cin.tie(0);
	ll k, n; cin >> k >> n;
	vector<ll> v(n);
	ll ans = k;
	for (int i = 0; i < n; ++i)
	{
		cin >> v[i];
		if (i) ans = min(ans, k - v[i] + v[i-1]);
	}
	ans = min(ans, v.back() - v[0]);
	cout << ans;
}

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


int main(){
    int N, K, Q;
    cin >> N >> K >> Q;

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

    int point[N];
    for(int i = 0; i < N; i++){
        point[i] = K - Q;
    }

    for(int i = 0; i < Q; i++){
        point[A[i] - 1]++;
    }

    for(int i = 0; i < N; i++){
        if(point[i] <= 0)
            cout << "No" << endl;
        else
            cout << "Yes" << endl;
    }

}

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

#define rep for(int i = 0;i<n;i++)
const int MOD = 1000000007;

int main(){
        int n;cin >> n;
        int x;cin >> x;
        long long a[n];rep{
                cin >> a[i];
        }
        long long ans = 0;
        for(int i = 0;i<n-1;i++){
                long long b = a[i]+a[i+1] - x;
                if(b>0){
                        int c = min(a[i+1],b);
                        ans += c;a[i+1]-=c;
                        b -= c;
                        if(b>0){
                                int d = min(a[i],b);
                                ans += d; a[i] -=d;

                        }
                }
        }
        cout << ans << endl;
}

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

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

	int res = x.size();
	deque<int> dq;
	dq.push_back(0);
	for (int i = 1; i < x.size(); ++i) {
		if (dq.empty()) {
			dq.push_back(i);
			continue;
		}

		if (x[i] == 'T') {
			if (x[dq.back()] == 'S') {
				res -=2;
				dq.pop_back();
			} else {
				dq.push_back(i);
			}
		} else {
			dq.push_back(i);
		}
	}

	cout << res << endl;

	return 0;
}


Measured memory_bytes: 1284
#include <iostream>
#include <vector>
#include <algorithm>
#include <cstdio>
#include <cmath>
#define REP(i, a, n) for(int i = (a); i < (n); i++)
using namespace std;

struct edge {
  int p, q;
  double d;
  bool operator<(const edge &e) const { return d < e.d; }
};

int N;
double X[100], Y[100], Z[100], R[100];

double dist(int i, int j) {
  double dx = X[i] - X[j];
  double dy = Y[i] - Y[j];
  double dz = Z[i] - Z[j];
  return max(sqrt(dx * dx + dy * dy + dz * dz) - R[i] - R[j], 0.0);
}

int find(int *a, int i) { return a[i] == i ? i : (a[i] = find(a, a[i])); }
void unite(int *a, int i, int j) { if(find(a, i) != find(a, j)) a[find(a, i)] = find(a, j); }

int main(void) {
  while(cin >> N, N) {
    REP(i, 0, N) cin >> X[i] >> Y[i] >> Z[i] >> R[i];

    vector<edge> e;
    REP(i, 0, N) REP(j, i + 1, N) e.push_back((edge) { i, j, dist(i, j) });
    sort(e.begin(), e.end());

    double ans = 0.0;
    int g[100];
    REP(i, 0, N) g[i] = i;
    REP(i, 0, e.size()) if(find(g, e[i].p) != find(g, e[i].q)) {
      ans += e[i].d;
      unite(g, e[i].p, e[i].q);
    }
    printf("%.3lf\n", ans);
  }
  return 0;
}

Measured memory_bytes: 3376
#include <cstdio>
#include <iostream>
#include <cmath>
#include <ctype.h>
#include <string>
#include <sstream>
#include <iostream>
#include <algorithm>
#include <cstdlib>
#include <map>
#include <queue>
#include <utility>
#include <vector>
#include <set>
#include <list>
#include <cstring>
#include <stack>

using namespace std;

#define mod 1000000007

int main()
{
	long long int n;
	while(1){
		cin >> n;
		if(n == 0) return 0;
		vector<vector<long long int> > canmeetmember(31);
		for(long long int i = 0; i < n; i++){
			long long int f;
			cin >> f;
			for(long long int j = 0; j < f; j++){
				long long int ff;
				cin >> ff;
				canmeetmember[ff].push_back(i);
			}
		}
		long long int result[51] = {};
		for(long long int i = 0; i < n; i++){
			result[i] = (long long int)1 << i;
			// cout << result[i] << endl;
		}
		long long int ans = -1;
		for(long long int i = 1; i <= 30; i++){
			long long int tmp = 0;
			for(long long int j = 0; j < canmeetmember[i].size(); j++){
				tmp |= result[canmeetmember[i][j]];
			}
			bool gathered = true;
			for(long long int j = 0; j < n; j++){
				if((tmp & (long long int)1 << j) == 0) gathered = false;
			}
			if(gathered){
				ans = i;
				break;
			}
			for(long long int j = 0; j < canmeetmember[i].size(); j++){
				result[canmeetmember[i][j]] = tmp;
			}
		}
		cout << ans << endl;
	}
	return 0;
}

Measured memory_bytes: 3004
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <cstring>
#include <cstdlib>
using namespace std;
#define N 200010
#define M 2010
#define mod 1000000007ll
#define LL long long
int read()
{
	int x = 0; char ch = getchar();
	for(;ch<'0'||ch>'9';ch = getchar());
	for(;ch>='0'&&ch<='9';ch = getchar()) x = (x<<3)+(x<<1)+(ch^48);
	return x;
}

LL q_pow(LL x,int a)
{
	if(a == 1) return x;
	LL ans = q_pow(x,a>>1);
	ans = (ans * ans) % mod;
	if(a & 1) (ans *= x)%=mod;
	return ans;
}

int n;
LL g[10010],inv[10050];
LL C(int n,int m)
{
	return g[n+m]*inv[n]%mod*inv[m]%mod;
}
int a[N],b[N];
int f[4050][4050];
LL ans;
int main()
{
	g[1] = 1;
	inv[1] = 1;
	for(int i=2;i<=8000;i++)
	{
		g[i] = (g[i-1]*(LL)(i))%mod;
		inv[i] = q_pow(g[i],mod-2);
	}
	cin>>n;
	for(int i=1;i<=n;i++)
	{
		scanf("%d%d",&a[i],&b[i]);
		f[-a[i]+M][-b[i]+M] ++;
	}
	for(int i=0;i<=(4020);i++)
		for(int j=0;j<=(4020);j++)
		{
			if(i) f[i][j] += f[i-1][j];
			if(f[i][j] >= mod) f[i][j] -= mod;
			if(j) f[i][j] += f[i][j-1];
			if(f[i][j] >= mod) f[i][j] -= mod;
		}
	for(int i=1;i<=n;i++)
	{
		ans = (ans + f[a[i]+M][b[i]+M])%mod;
		ans = (ans - C(a[i]+a[i],b[i]+b[i]) + mod) % mod;
	}
	cout<<ans*inv[2]% mod<<endl;
	return 0;
}

Measured memory_bytes: 66048
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cstring>
#include<cmath>
#include<set>
#include<map>
#include<queue>
#include<bitset>
#include<complex>
using namespace std;
typedef long long LL;
#define sqr(x) ((x)*(x))
#define mp make_pair
inline char gc(){
    static char buf[100000],*p1=buf,*p2=buf;
    return p1==p2&&(p2=(p1=buf)+fread(buf,1,100000,stdin),p1==p2)?EOF:*p1++;
}
#define gc getchar
inline int read(){
	int x = 0; char ch = gc(); bool positive = 1;
	for (; !isdigit(ch); ch = gc())	if (ch == '-')	positive = 0;
	for (; isdigit(ch); ch = gc())	x = x * 10 + ch - '0';
	return positive ? x : -x;
}
inline void write(int a){
    if(a>=10)write(a/10);
    putchar('0'+a%10);
}
inline void writeln(int a){
    if(a<0){
    	a=-a; putchar('-');
	}
	write(a); puts("");
}
const int N=1000005;
int n,f[N],a[N],b[N],g[N];
int main(){
	n=read();
	for(int i=1;i<=n;i++)a[i]=read();
	for(int i=1;i<=n;i++)b[i]=read();
	for(int i=1;i<=n;i++){
		f[i]=f[i-1]+a[i];
		g[i]=max(f[i],g[i-1])+b[i];
	}
	cout<<g[n]<<endl;
}


Measured memory_bytes: 6400
N = int(input())
lis_h = list(map(int, input().split()))

count = 0
max_move = 0
before = 0

for i in lis_h:
      if i <= before:
            count += 1
            if max_move < count:
                  max_move = count
      else:
            count = 0
      before = i
print(max_move)
            

Measured memory_bytes: 63856
import math

n, d, a = map(int, input().split())
l = [list(map(int, input().split())) for _ in range(n)]
l.sort()
q = []
index = 0
ans = 0
dmg = 0
for i in range(n):
    while index < len(q) and q[index][0] < l[i][0]:
        dmg -= q[index][1]
        index += 1
    if l[i][1] > dmg:
        times = (l[i][1]-dmg)//a if (l[i][1]-dmg)%a == 0 else (l[i][1]-dmg)//a+1
        ans += times
        q.append((l[i][0]+2*d, a*times))
        dmg += a*times
print(ans)

Measured memory_bytes: 80384
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vvvi = vector<vvi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using vvvll = vector<vvll>;
using vs = vector<string>;
using pll = pair<ll, ll>;
using vp = vector<pll>;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define repb(i, n) for (int i = (n-1); i >= 0; i--)
#define rea(i, a, b) for (int i = (a); i < (b); i++)
#define reab(i, a, b) for (int i = (a)-1; i >= (b); i--)
#define ALL(a) (a).begin(),(a).end()
#define SZ(x) ((int)(x).size())
#define PRINT(V) for (auto v:(V)) {cerr << v << " ";} cerr << endl
#define dump(x) cerr << #x << " : " << (x) << endl
#define dump2(x, y) cerr << "(" << #x << ", " << #y << ") = (" << x << ", " << y << ")" << endl
inline ll GCD(ll a, ll b){return b ? GCD(b, a % b) : a;}
const int MOD = 1000000007;
/* END OF TEMPLATE */

int main(){
    ll N;
    cin >> N;
    vll a(N);
    ll ans = 0;
    rep(i, N){
        cin >> a[i];
        while(a[i] % 2 == 0){
            a[i] /= 2;
            ans++;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
using i64 = long long;
#define rep(i,s,e) for(i64 (i) = (s);(i) < (e);(i)++)
#define all(x) x.begin(),x.end()

template<class T>
static inline std::vector<T> ndvec(size_t&& n, T val) { return std::vector<T>(n, std::forward<T>(val)); }
template<class... Tail>
static inline auto ndvec(size_t&& n, Tail&&... tail) {
  return std::vector<decltype(ndvec(std::forward<Tail>(tail)...))>(n, ndvec(std::forward<Tail>(tail)...));
}
template<class Cond> struct chain {
  Cond cond; chain(Cond cond) : cond(cond) {}
  template<class T> bool operator()(T& a, const T& b) const { if(cond(a, b)) { a = b; return true; } return false; }
};
template<class Cond> chain<Cond> make_chain(Cond cond) { return chain<Cond>(cond); }

int main() {
  i64 H1, M1, H2, M2, K;
  cin >> H1 >> M1 >> H2 >> M2 >> K;
  i64 diff = 0;
  if(M1 <= M2) {
    diff += M2 - M1;
  }
  else {
    H2--;
    diff += 60 + M2 - M1;
  }
  diff += (H2 - H1) * 60;
  cout << diff - K << endl;
}


Measured memory_bytes: 3624
s = gets.chomp
n = s.length
sc = s.slice(0..(n-1)/2 - 1)
tc = s.slice((n+3)/2 - 1..n-1)
ans = 'No'

if s == s.reverse && sc == sc.reverse && tc = tc.reverse
    ans = 'Yes'
end

puts ans

Measured memory_bytes: 3836
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <fstream>
#include <sstream>
#include <set>
#include <map>
#include <vector>
#include <list>
#include <algorithm>
#include <cstring>
#include <cmath>
#include <string>
#include <queue>
#include <bitset>     //UWAGA - w czasie kompilacji musi byc znany rozmiar wektora - nie mozna go zmienic
#include <cassert>
#include <iomanip>        //do setprecision
#include <ctime>
#include <complex>
using namespace std;

#define FOR(i,b,e) for(int i=(b);i<(e);++i)
#define FORQ(i,b,e) for(int i=(b);i<=(e);++i)
#define FORD(i,b,e) for(int i=(b)-1;i>=(e);--i)
#define REP(x, n) for(int x = 0; x < (n); ++x)

#define ST first
#define ND second
#define PB push_back
#define MP make_pair
#define LL long long
#define ULL unsigned LL
#define LD long double

const double pi = 3.141592653589793238462643383279502884197169399375105820974944592307816406286208998628034825342;
const int mod=1000000007;

int main(){

    int x1,y1,x2,y2,x3,y3,x4,y4;
    int a,b;

    cin >> x1 >> y1 >> x2 >> y2;

    a = x1 - x2;
    b = y2 - y1;

    x3 = x2 - b;
    y3 = y2 - a;
    x4 = x3 + a;
    y4 = y3 - b;

    cout << x3 << " " << y3 << " " << x4 << " " << y4;

    return 0;
}


Measured memory_bytes: 256
//Patwari26
//#include template<t> as mine
#include<bits/stdc++.h>
using namespace std;

#define ll          int
#define pb          push_back
#define endl        '\n'
#define mii         map<ll,ll>
#define pii         pair<ll,ll>
#define vi          vector<ll>
#define all(a)      (a).begin(),(a).end()
#define x           first
#define y           second
#define sz(x)       (ll)x.size()
#define hell        1000000007
#define INF         (1ll<<60)
#define rep(i,a,b)  for(ll i=a;i<=b;i++)
#define rrep(i,a,b)  for(ll i=a;i>=b;i--)
#define ios ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define time        cerr << "\nTime elapsed: " << 1000 * clock() / CLOCKS_PER_SEC << "ms\n";
ll gcd(ll a, ll b) { return b == 0 ? a : gcd(b, a % b); }
ll lcm(ll a, ll b) { return a * (b / gcd(a, b)); }
const int N=1000005;
void solve(){
    ll n;
    cin>>n;
    vi v(n);
    ll zz;
    ll poss=1;
    ll cc[N];
    memset(cc,0,sizeof(cc)); 
    rep(i,0,n-1){
        cin>>v[i];
        zz=(i==0)?v[i]:gcd(v[i],zz);
        for(int j=2;j*j<=v[i];j++){
            if(v[i]%j==0){
                cc[j]++;
                while(v[i]%j==0) v[i]/=j;
            }
        }
        if(v[i]>1) cc[v[i]]++;
    }
    rep(i,1,N-1) if(cc[i]>1) poss=0;
    if(poss) cout<<"pairwise coprime"<<endl;
    else if(zz==1) cout<<"setwise coprime"<<endl;
    else cout<<"not coprime"<<endl;
}
signed main()
{
    ios
    int TESTS=1;
    //cin>>TESTS;
    while(TESTS--){
        solve();
    }
    // time
    return 0;
}

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

int main() {
    int n, m, t, p;
    while(cin >> n >> m >> t >> p, n) {
        vector<vector<int>> cur(n, vector<int>(m, 1));
        for(int i = 0; i < t; ++i) {
            int d, c; cin >> d >> c;
            const int nw = (d == 2 ? cur.size() : max(c, (int)cur.size() - c));
            const int nh = (d == 1 ? cur[0].size() : max(c, (int)cur[0].size() - c));
            vector<vector<int>> nxt(nw, vector<int>(nh));
            for(int x = 0; x < (int)cur.size(); ++x) {
                for(int y = 0; y < (int)cur[0].size(); ++y) {
                    const int nx = (d == 2 ? x : x < c ? c - x - 1 : x - c);
                    const int ny = (d == 1 ? y : y < c ? c - y - 1 : y - c);
                    nxt[nx][ny] += cur[x][y];
                }
            }
            cur = move(nxt);
        }

        for(int i = 0; i < p; ++i) {
            int x, y; cin >> x >> y;
            cout << cur[x][y] << endl;
        }
    }
}



Measured memory_bytes: 3152
import java.io.*;
import java.util.*;
import java.math.*;
import java.util.concurrent.ThreadLocalRandom;
public class Main 
{
	
	static long gcd(long a, long b) 
	{
		if (b == 0)
		{	
			return a;
		}
		
		else
		{
			 return gcd(b, a % b);
		}
	}
	public static void main(String[] args) throws Exception
	{

		
		   PrintWriter out = new PrintWriter(System.out);
		   Scanner in = new Scanner(System.in);
		 // long n , k , q;
		  
	
	  String s = in.next();
	for(int i = 0; i < s.length(); i++)
		if(s.charAt(i)!= ',')
	  out.print(s.charAt(i));
		else  out.print(' ');
	   out.close();
	}
}

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

long long int MOD = 1000000007;

int main() {
    std::string L;
    std::cin >> L;

    int length = L.length();
    std::vector<long long int> pow3(L.length() + 1, 1), pow2(L.length() + 1, 1);
    for (int i = 1; i <= length; i++) {
        pow3[i] = pow3[i - 1] * 3 % MOD;
        pow2[i] = pow2[i - 1] * 2 % MOD;
    }

    long long int sum = pow3[length];
    int zero_count = 0;
    for (int i = 0; i < length; i++){
        if (L[i] == '0') {
            sum = sum - (pow2[i + 1 - zero_count] * pow3[length - i - 1]) % MOD;
            if (sum < 0)  {
                sum += MOD;
            }
            zero_count++;
        }
    }

    std::cout << sum << std::endl;
}


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

void solve() {
  int a , b ,c ;
  cin >>  a >> b >> c;
  if((b-a) == (c-b)) {
    cout << "YES";
  }
  else {
    cout << "NO";
  }
}

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


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <numeric>
#include <algorithm>
#include <set>
#include <cmath>
#include <iomanip>
#define REP(i, n) for(int i=0; i<n; i++)
#define REPR(i, n) for(int i=n; i>=0; i--)
#define FOR(i, m, n) for(int i=m; i<n; i++)
#define FORR(i, m, n) for(int i=m; i>=n; i--)
#define INF 999999999
#define ll long long
#define VSORT(v) sort(v.begin(), v.end())
#define pb(a) push_back(a)
using namespace std;

#ifdef INPUT
#include <sstream>
stringstream input(R"(
100 100 100
)");
#define cin input
#endif

int main()
{
	int a, b, c;
	cin >> a >> b >> c;

	int a1, a2, a3;
	a1 = abs(a-b);
	a2 = abs(b-c);
	a3 = abs(c-a);

	if (a1>=a2 && a1>=a3)
		cout << a2+a3 << endl;
	else if (a2>=a1 && a2>=a3)
		cout << a3+a1 << endl;
	else if (a3>=a1 && a3>=a2)
		cout << a1+a2 << endl;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int S = sc.nextInt();
		int W = sc.nextInt();
		if (W >= S) {
			System.out.println("unsafe");
		} else {
			System.out.println("safe");
		}
	}

}


Measured memory_bytes: 35804
#include<iostream>
#include<string>
#include<stdio.h>
#include<stdlib.h>
#include <algorithm>
#include <set>
#include<math.h>
#include<vector>
#include<map>
using namespace std;

int main(){
    int s;
    cin >> s;
    int n = s;
    map<int,int>m;
    int i = 1;
    while(1){
        m[n] = -1;
        if(n%2==0){
            n = n/2;
        }else{
            n = 3*n+1;
        }
        i++;
        if(m[n] == -1)break;
    }
    cout << i << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <algorithm>
#include <math.h>
#include <sstream>
#include <numeric>
#include <string>
#include <cassert>
#include <bitset>

using namespace std;
typedef long long ll;

// Return # of pairs (i,j) s.t. A[i] * A[j] < x
ll CountPairs(const vector<ll> &A, ll x) {
  ll count = 0;
  ll N = A.size();

  for (int i = 0; i < N; ++i) {
    if (A[i] >= 0) {
      int p = -1;
      int q = N;
      while (p + 1 < q) {
	int mid = (p + q) / 2;
	if (A[i] * A[mid] < x) {
	  p = mid;
	} else {
	  q = mid;
	}
      }
      count += p + 1;
    } else {
      int p = -1;  // NG
      int q = N;  // OK
      while (p + 1 < q) {
	int mid = (p + q) / 2;
	if (A[i] * A[mid] < x) {
	  q = mid;
	} else {
	  p = mid;
	}
      }
      count += N - q;
    }
  }
  
  for (int i = 0; i < N; ++i) {
    if (A[i] * A[i] < x) --count;
  }
  count /= 2;

  return count;
}

int main() {
  ll N, K;
  cin >> N >> K;
  vector<ll> A(N);
  for (int i = 0; i < N; ++i) {
    cin >> A[i];
  }
  sort(A.begin(), A.end());

  //         123456789012345678
  ll kInf = 1000000000000000001LL;
  ll p = -kInf;
  ll q = +kInf;
  while (p + 1 < q) {
    ll mid = (p + q) / 2;
    if (CountPairs(A, mid) < K) {
      p = mid;
    } else {
      q = mid;
    }
  }

  cout << p << endl;
  
  return 0;
}


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

int main() {
	int n;
	cin >> n;
	long long ans = 1;
	long long max = 1e18;
	bool flag = false;
	vector<long long> v(n);
	for(int i = 0; i < n; i++) {
		cin >> v[i];
		if(v[i] == 0)
			flag = true;
	}
	if(flag) {
		cout << 0;
		return 0;
	}
	for(int i = 0; i < n; i++) {
		if((max/v[i]) < ans) {
			cout << "-1";
			return 0;
		}
		ans *= v[i];
	}
	cout << ans;
}

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

int main() {
  // ここにプログラムを追記
  int a, b;
  int i;
  int j = 0;
  string s;
  
  cin >> a >> b >> s;
  if(s[a] == '-'){
    for(i=0;i<a+b+1;i++){
      if(s[i] == '-'){
        j++;
      }
    }
    if(j>=2){
      cout << "No" << endl;
    }else{
      cout << "Yes" << endl;
    }
  }else{
    cout << "No" << endl;
  }
}

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

#define REP(i, x, n) for (int i = x; i < (int)(n); i++)
#define rep(i, n) REP (i, 0, n)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define sz(x) (int)(x.size())
#define popcount(x) __builtin_popcount(x)
#define popcountll(x) __builtin_popcountll(x)
#define uniq(x) x.erase(unique(x.begin(), x.end()), x.end())
#define F first
#define S second
#define mp make_pair
#define eb emplace_back

using namespace std;

typedef long long ll;

const int INF = 1 << 29;

int main() {
    string ans[] = {"Possible", "Impossible"};

    int N, L;
    int a[100000];

    cin >> N >> L;
    rep (i, N) cin >> a[i];

    int idx = -1;
    rep (i, N - 1) {
        if (a[i] + a[i + 1] >= L) {
            idx = i + 1;
            break;
        }
    }

    if (idx == -1) cout << ans[1] << endl;
    else {
        cout << ans[0] << endl;
        for (int i = 1; i < idx; i++) {
            cout << i << endl;
        }
        for (int i = N - 1; i > idx; i--) {
            cout << i << endl;
        }
        cout << idx << endl;
    }
}


Measured memory_bytes: 1152
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(void)
{
  string s;
  cin >> s;
  if(s[0] == '7') cout << "Yes\n";
  else if(s[1] == '7') cout << "Yes\n";
  else if(s[2] == '7') cout << "Yes\n";
  else cout << "No\n";
  return 0;
}


Measured memory_bytes: 3624
import itertools
num2alpha = lambda c: chr(c+64)
alpha2num = lambda c: ord(c) - ord('A') + 1

N = int(input())
S = list(input())
S_unique = list(set(S))
S_kind = len(S_unique)

count_list = [0] * 27

for i in range(1,27):
    tmp = num2alpha(i).lower()
    count = S.count(tmp)
    count_list[i] = count % 1000000007

count_list_new = []
for i in range(len(count_list)):
    if count_list[i] != 0:
        count_list_new.append(count_list[i]+1)

#print(count_list_new)
ans = 1
for i in range(len(count_list_new)):
    ans *= count_list_new[i] % 1000000007

ans -= 1
print(ans % 1000000007)

Measured memory_bytes: 4084
<?php

fscanf(STDIN, "%d", $n);
$B = array_map('intval', explode(' ', trim(fgets(STDIN))));

$A = [];
$A[0] = $B[0];
for ($i = 1; $i < $n - 1; $i++) {
    $A[$i] = min($B[$i - 1], $B[$i]);
}
$A[$n - 1] = $B[$n - 2];

echo array_sum($A);


Measured memory_bytes: 4604
#include <stdlib.h>
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;   
}



int main() {
    string a;
    cin >>a;
    int b=0;
    rep(i,a.size()){
        if(a.at(i)=='+'){
            b++;   
        }
        else{
            b--;
        }
    }
    cout<<b<<endl;
}




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

using namespace std;
using ll = long long;

#define endl '\n'

const int INF = 1e9 + 5;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int n;
    cin >> n;
    vector<int> h(n);
    for (int& x : h) cin >> x;
    vector<int> dp(n, INF);
    dp[0] = 0;
    for (int i = 0; i < n; ++i) {
        for (int j : {i + 1, i + 2}) {
            if (j < n) {
                dp[j] = min(dp[j], dp[i] + abs(h[i] - h[j]));
            }
        }
    }
    cout << dp[n - 1] << endl;
    return 0;
}

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

int main()
{
	double a, b;
	cin >> a >> b;
	double x = (a + b) / 2;
	int y = x;
	if (y == x)
	{
		cout << y << endl;
	}
	else
	{
		cout << "IMPOSSIBLE" << endl;
	}

}

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

int main(){
    int s;  cin>>s;
    int ans=1;
    while(1){
        if(s==4||s==2||s==1)break;
        ans++;
        if(s%2==0)s/=2;
        else s=s*3+1;
    }
    ans+=3;;
    cout<<ans<<endl;


    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<vector>
#include<algorithm>
#include<map>
#include<string>
#include<cmath>
#include<numeric>
#include<queue>
using namespace std;

int main(void) {

  int x, y, s;
  while(cin >> x >> y >> s){
    if( x == 0 && y == 0 && s == 0 ) break;
    int ans = 0;
    for(int i=1; i<s; i++){
      for(int j=1; j<s; j++){
        int tmp = i * (100+x) / 100 + j * (100+x) / 100;
        if( tmp != s ) continue;
        ans = max(ans, i * (100+y) / 100 + j * (100+y) / 100);
      }
    }
    cout << ans << endl;
  }

  return 0;
}










//

Measured memory_bytes: 3084
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define ALL(x) (x).begin(), (x).end()
typedef long long ll;
typedef pair<int, int> P;
typedef vector<vector<int>> Matrix;
static const int INF = 2000000000;



int main(){
  int a, b;
  cin >> a >> b;
  cout << (a+b)%24 << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define FAST ios_base::sync_with_stdio(false);cin.tie(NULL);
#define ll long long int
#define ull unsigned long long int
#define ld long double
#define mod 1000000007
#define inf 1000000000000000007
#define eps 0.00000001
#define pi 3.141592653589793
#define pii pair<int,int>
#define pdd pair<ld,ld>
#define pll pair<ll,ll>
#define ff first
#define ss second
#define vii vector<int>
#define vpl vector<pll>
#define vll vector<ll>
#define sti stack <int>
#define stll stack <ll>
#define mseti multiset <ll>
#define msetd multiset <ll, greater <ll> >
#define mp make_pair
#define pb push_back
#define lb lower_bound
#define ub upper_bound 
#define stp setprecision(20)//use fixed before stp
#define endl '\n'
int main()
{  
    FAST
    ll x,a;
    cin>>x>>a;
    if(x<a)
        cout<<0;
    else
        cout<<10;
}

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

int main(){
	string S;
	cin >> S;
	bool test=true;
	int cCnt=0;

	for(int i=0;i<S.length();i++){
		if(i==0){
			if(S[i]!='A'){
				test=false;
			}
		}else if(2<=i && i<=S.length()-2){
			if(S[i]=='C'){
				cCnt++;
			}else{
				if(S[i]<'a' || 'z'<S[i]){
					test=false;
				}
			}
		}else{
			if(S[i]<'a' || 'z'<S[i]){
				test=false;
			}
		}
	}
	if(cCnt!=1){
		test=false;
	}
	if(test){
		cout << "AC" << endl;
	}else{
		cout << "WA" << endl;
	}
	return 0;
}


Measured memory_bytes: 256
def main():
    a, b = map(int, input().split())
    if a % 3 == 0 or b % 3 == 0 or (a+b) % 3 == 0:
        ans = 'Possible'
    else:
        ans = 'Impossible'
    print(ans)


if __name__ == "__main__":
    main()


Measured memory_bytes: 2940
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll MOD = 1000000007;

int main() {
    ll a, b, x;
    cin >> a >> b >> x;

    ll res;
    res = b / x - a / x;
    if (a % x == 0) res++;
    cout << res << endl;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
 
using namespace std;
typedef long long ll;
typedef vector<ll> vll;
#define int ll
#define fi first
#define se second
#define SORT(a) sort(a.begin(),a.end())
#define rep(i,n) for(int i = 0;i < (n) ; i++) 
#define REP(i,n) for(int i = 0;i < (n) ; i++) 
#define MP(a,b) make_pair(a,b)
#define pb(a) push_back(a)
#define INF LLONG_MAX/2
#define all(x) (x).begin(),(x).end()
#define debug(x) cerr<<#x<<": "<<x<<endl
#define debug_vec(v) cerr<<#v<<":";rep(i,v.size())cerr<<" "<<v[i];cerr<<endl
/*----------------------------------------------------------------*/

// int MOD = 998244353;
int MOD = 1000000007;

/*----------------------------------------------------------------*/
signed main(){

    int n;
    cin >> n;
    int x[101];
    rep(i,n)cin >> x[i];

    int mini = INF;
    rep(i,101){
        int d = 0;
        rep(j,n)d += (x[j]-i)*(x[j]-i);
        mini = min(mini,d);
    }
    cout << mini << endl;

   



	return 0;
}
/*----------------------------------------------------------------*/

// g++ -std=c++14 code1.cpp
// sudo pip3 install --upgrade online-judge-tools
// rm -r -f test;oj dl https://code-festival-2018-quala.contest.atcoder.jp/tasks/code_festival_2018_quala_c
// rm -r -f test;oj dl https://pakencamp-2019-day3.contest.atcoder.jp/tasks/pakencamp_2019_day3_c
// rm -r -f test;oj dl https://abc156.contest.atcoder.jp/tasks/abc156_b

Measured memory_bytes: 256
N,X,Y = map(int,input().split())
A = list(map(int,input().split()))

if N == 1 :
    a = -1
    b = abs(A[0] - Y)
else :
    a = abs(A[N-1] - Y)
    b = abs(A[N-2] - A[N-1])

print(max(a, b))


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

n,m=map(int,input().split())
lst=[]
for i in range(n):
    lst.append([])

for i in range(m):
    p,y=map(int,input().split())
    lst[p-1].append([i,p,y])

for i in range(n):
    lst[i]=sorted(lst[i],key=lambda x:x[2])

for i in range(n):
    for j in range(len(lst[i])):
        lst[i][j].append(j+1)

lst=[i for j in lst for i in j]
lst=sorted(lst,key=lambda x:x[0])

for i in range(m):
    left=str(lst[i][1])
    right=str(lst[i][3])
    prnt=["0"*(6-len(left)),left,"0"*(6-len(right)),right]
    print("".join(prnt))

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

int main() {
	int a,j=1;
	bool b=0,c=0;
	cin>>a;
	int ant;
	cin>>ant;
	for(int i=0;i<a-1;i++){
		int actual;
		cin>>actual;
		if(actual>ant){
			b=true;
		}
		if(actual<ant){
			c=true;
		}
		if(b && c){
			j++;
			b=false;
			c=false;
		}
		ant=actual;
	}
	cout<<j<<endl;
	return 0;
}

Measured memory_bytes: 3624
while True:
  try:
    a1 = float(input())
    lst = [a1]
    for i in range(2,11):
      if i % 2:
        a1 /= 3
        lst.append(a1)
      else:
        a1 *= 2
        lst.append(a1)

    print(sum(lst))

  except EOFError:
    break




Measured memory_bytes: 5580
#include <bits/stdc++.h>
using namespace std;
#define int long long
typedef pair<int,int> P;
int INF = 1e16+7;
int mod = 1e9+7;
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
signed main() {
    int N;
    cin >> N;
    vector<int>A(N);
    for(int i = 0; i < N; i++) cin >> A[i];
    sort(A.begin(),A.end());
    int sum = 0;
    int ans = 0;
    for(int i = 0; i < N; i++) {
        sum+=A[i];
        if(i+1 != N) {
            if(sum*2 >= A[i+1]) {
                ans++;
            }
            else {
                ans = 0;
                
            }
        }
    }
    ans++;
    cout << ans << endl;
}


Measured memory_bytes: 4008
#pragma region Macros
#include <bits/stdc++.h>
using namespace std;
//#include <boost/multiprecision/cpp_int.hpp>
//using multiInt = boost::multiprecision::cpp_int;

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

const int MOD_TYPE = 1;
const ll MOD = (MOD_TYPE == 1 ? (ll)(1e9 + 7) : 998244353);
const int INF = (int)1e9;
const ll LINF = (ll)4e18;
const ld PI = acos(-1.0);
const ld EPS = 1e-11;

#define REP(i, m, n) for (ll i = m; i < (ll)(n); ++i)
#define rep(i, n) REP(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";

vector<int> Dx = {0, 0, -1, 1, -1, 1, -1, 1, 0};
vector<int> Dy = {1, -1, 0, 0, -1, -1, 1, 1, 0};

#pragma endregion

int main()
{
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << setprecision(30) << setiosflags(ios::fixed);

  ll n, x;
  cin >> n >> x;
  ll g = 0;
  rep(i, n)
  {
    ll a;
    cin >> a;
    g = __gcd(g, abs(a - x));
  }
  cout << g << endl;
  return 0;
}


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

using namespace std;

int main()
{
    long long N, M;
    cin >> N >> M;
    long long x[N][3];
    
    for (int i = 0; i < N; i++)
    {
        for (int j = 0; j < 3; j++)
        {
            cin >> x[i][j];
        }
    }
    
    // a*x + b*y + c*z の最大値を求める
    // ただし、a,b,c = +1, -1
    // ビット演算を用いて全探索を行う

    long long maxValue = - (1LL << 60);

    for (int i = 0; i < 8; i++)
    {
        vector<long long> vec;
        for (int j = 0; j < N; j++)
        {
            long long S = 0;
            for (int k = 0; k < 3; k++)
            {
                if ((i / (1 << k) ) % 2 == 0)
                {
                    S += x[j][k];
                }
                else
                {
                    S -= x[j][k];
                }

            }
            vec.push_back(S);
        }
        sort(vec.begin(), vec.end(), greater<long long>()); // 降順でソート
        long long ans = 0;
        for (int j = 0; j < M; j++)
        {
            ans += vec[j];
        }
        maxValue = max(maxValue, ans);
    }
    
    cout << maxValue << endl;
    return 0;
}

Measured memory_bytes: 256